@substrate-system/keys 0.2.27 → 0.2.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- var lf=Object.create;var ve=Object.defineProperty;var gf=Object.getOwnPropertyDescriptor;var bf=Object.getOwnPropertyNames;var Af=Object.getPrototypeOf,mf=Object.prototype.hasOwnProperty;var wf=(n,e,f)=>e in n?ve(n,e,{enumerable:!0,configurable:!0,writable:!0,value:f}):n[e]=f;var y=(n,e)=>ve(n,"name",{value:e,configurable:!0}),_n=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,f)=>(typeof require<"u"?require:e)[f]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var Cn=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Pr=(n,e)=>{for(var f in e)ve(n,f,{get:e[f],enumerable:!0})},Kf=(n,e,f,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let x of bf(e))!mf.call(n,x)&&x!==f&&ve(n,x,{get:()=>e[x],enumerable:!(c=gf(e,x))||c.enumerable});return n};var Ef=(n,e,f)=>(f=n!=null?lf(Af(n)):{},Kf(e||!n||!n.__esModule?ve(f,"default",{value:n,enumerable:!0}):f,n));var O=(n,e,f)=>wf(n,typeof e!="symbol"?e+"":e,f);var ef=Cn(()=>{"use strict"});var tf=Cn((as,et)=>{"use strict";(function(n){"use strict";var e=y(function(t){var o,i=new Float64Array(16);if(t)for(o=0;o<t.length;o++)i[o]=t[o];return i},"gf"),f=y(function(){throw new Error("no PRNG")},"randombytes"),c=new Uint8Array(16),x=new Uint8Array(32);x[0]=9;var l=e(),S=e([1]),k=e([56129,1]),nr=e([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),Kr=e([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),hr=e([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),Tr=e([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),Xr=e([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function Oe(t,o,i,r){t[o]=i>>24&255,t[o+1]=i>>16&255,t[o+2]=i>>8&255,t[o+3]=i&255,t[o+4]=r>>24&255,t[o+5]=r>>16&255,t[o+6]=r>>8&255,t[o+7]=r&255}y(Oe,"ts64");function rr(t,o,i,r,a){var u,p=0;for(u=0;u<a;u++)p|=t[o+u]^i[r+u];return(1&p-1>>>8)-1}y(rr,"vn");function dr(t,o,i,r){return rr(t,o,i,r,16)}y(dr,"crypto_verify_16");function Dr(t,o,i,r){return rr(t,o,i,r,32)}y(Dr,"crypto_verify_32");function Ur(t,o,i,r){for(var a=r[0]&255|(r[1]&255)<<8|(r[2]&255)<<16|(r[3]&255)<<24,u=i[0]&255|(i[1]&255)<<8|(i[2]&255)<<16|(i[3]&255)<<24,p=i[4]&255|(i[5]&255)<<8|(i[6]&255)<<16|(i[7]&255)<<24,b=i[8]&255|(i[9]&255)<<8|(i[10]&255)<<16|(i[11]&255)<<24,K=i[12]&255|(i[13]&255)<<8|(i[14]&255)<<16|(i[15]&255)<<24,T=r[4]&255|(r[5]&255)<<8|(r[6]&255)<<16|(r[7]&255)<<24,U=o[0]&255|(o[1]&255)<<8|(o[2]&255)<<16|(o[3]&255)<<24,q=o[4]&255|(o[5]&255)<<8|(o[6]&255)<<16|(o[7]&255)<<24,_=o[8]&255|(o[9]&255)<<8|(o[10]&255)<<16|(o[11]&255)<<24,I=o[12]&255|(o[13]&255)<<8|(o[14]&255)<<16|(o[15]&255)<<24,L=r[8]&255|(r[9]&255)<<8|(r[10]&255)<<16|(r[11]&255)<<24,j=i[16]&255|(i[17]&255)<<8|(i[18]&255)<<16|(i[19]&255)<<24,Y=i[20]&255|(i[21]&255)<<8|(i[22]&255)<<16|(i[23]&255)<<24,R=i[24]&255|(i[25]&255)<<8|(i[26]&255)<<16|(i[27]&255)<<24,z=i[28]&255|(i[29]&255)<<8|(i[30]&255)<<16|(i[31]&255)<<24,N=r[12]&255|(r[13]&255)<<8|(r[14]&255)<<16|(r[15]&255)<<24,C=a,D=u,v=p,B=b,P=K,E=T,h=U,d=q,m=_,g=I,A=L,w=j,M=Y,H=R,G=z,F=N,s,X=0;X<20;X+=2)s=C+M|0,P^=s<<7|s>>>25,s=P+C|0,m^=s<<9|s>>>23,s=m+P|0,M^=s<<13|s>>>19,s=M+m|0,C^=s<<18|s>>>14,s=E+D|0,g^=s<<7|s>>>25,s=g+E|0,H^=s<<9|s>>>23,s=H+g|0,D^=s<<13|s>>>19,s=D+H|0,E^=s<<18|s>>>14,s=A+h|0,G^=s<<7|s>>>25,s=G+A|0,v^=s<<9|s>>>23,s=v+G|0,h^=s<<13|s>>>19,s=h+v|0,A^=s<<18|s>>>14,s=F+w|0,B^=s<<7|s>>>25,s=B+F|0,d^=s<<9|s>>>23,s=d+B|0,w^=s<<13|s>>>19,s=w+d|0,F^=s<<18|s>>>14,s=C+B|0,D^=s<<7|s>>>25,s=D+C|0,v^=s<<9|s>>>23,s=v+D|0,B^=s<<13|s>>>19,s=B+v|0,C^=s<<18|s>>>14,s=E+P|0,h^=s<<7|s>>>25,s=h+E|0,d^=s<<9|s>>>23,s=d+h|0,P^=s<<13|s>>>19,s=P+d|0,E^=s<<18|s>>>14,s=A+g|0,w^=s<<7|s>>>25,s=w+A|0,m^=s<<9|s>>>23,s=m+w|0,g^=s<<13|s>>>19,s=g+m|0,A^=s<<18|s>>>14,s=F+G|0,M^=s<<7|s>>>25,s=M+F|0,H^=s<<9|s>>>23,s=H+M|0,G^=s<<13|s>>>19,s=G+H|0,F^=s<<18|s>>>14;C=C+a|0,D=D+u|0,v=v+p|0,B=B+b|0,P=P+K|0,E=E+T|0,h=h+U|0,d=d+q|0,m=m+_|0,g=g+I|0,A=A+L|0,w=w+j|0,M=M+Y|0,H=H+R|0,G=G+z|0,F=F+N|0,t[0]=C>>>0&255,t[1]=C>>>8&255,t[2]=C>>>16&255,t[3]=C>>>24&255,t[4]=D>>>0&255,t[5]=D>>>8&255,t[6]=D>>>16&255,t[7]=D>>>24&255,t[8]=v>>>0&255,t[9]=v>>>8&255,t[10]=v>>>16&255,t[11]=v>>>24&255,t[12]=B>>>0&255,t[13]=B>>>8&255,t[14]=B>>>16&255,t[15]=B>>>24&255,t[16]=P>>>0&255,t[17]=P>>>8&255,t[18]=P>>>16&255,t[19]=P>>>24&255,t[20]=E>>>0&255,t[21]=E>>>8&255,t[22]=E>>>16&255,t[23]=E>>>24&255,t[24]=h>>>0&255,t[25]=h>>>8&255,t[26]=h>>>16&255,t[27]=h>>>24&255,t[28]=d>>>0&255,t[29]=d>>>8&255,t[30]=d>>>16&255,t[31]=d>>>24&255,t[32]=m>>>0&255,t[33]=m>>>8&255,t[34]=m>>>16&255,t[35]=m>>>24&255,t[36]=g>>>0&255,t[37]=g>>>8&255,t[38]=g>>>16&255,t[39]=g>>>24&255,t[40]=A>>>0&255,t[41]=A>>>8&255,t[42]=A>>>16&255,t[43]=A>>>24&255,t[44]=w>>>0&255,t[45]=w>>>8&255,t[46]=w>>>16&255,t[47]=w>>>24&255,t[48]=M>>>0&255,t[49]=M>>>8&255,t[50]=M>>>16&255,t[51]=M>>>24&255,t[52]=H>>>0&255,t[53]=H>>>8&255,t[54]=H>>>16&255,t[55]=H>>>24&255,t[56]=G>>>0&255,t[57]=G>>>8&255,t[58]=G>>>16&255,t[59]=G>>>24&255,t[60]=F>>>0&255,t[61]=F>>>8&255,t[62]=F>>>16&255,t[63]=F>>>24&255}y(Ur,"core_salsa20");function _r(t,o,i,r){for(var a=r[0]&255|(r[1]&255)<<8|(r[2]&255)<<16|(r[3]&255)<<24,u=i[0]&255|(i[1]&255)<<8|(i[2]&255)<<16|(i[3]&255)<<24,p=i[4]&255|(i[5]&255)<<8|(i[6]&255)<<16|(i[7]&255)<<24,b=i[8]&255|(i[9]&255)<<8|(i[10]&255)<<16|(i[11]&255)<<24,K=i[12]&255|(i[13]&255)<<8|(i[14]&255)<<16|(i[15]&255)<<24,T=r[4]&255|(r[5]&255)<<8|(r[6]&255)<<16|(r[7]&255)<<24,U=o[0]&255|(o[1]&255)<<8|(o[2]&255)<<16|(o[3]&255)<<24,q=o[4]&255|(o[5]&255)<<8|(o[6]&255)<<16|(o[7]&255)<<24,_=o[8]&255|(o[9]&255)<<8|(o[10]&255)<<16|(o[11]&255)<<24,I=o[12]&255|(o[13]&255)<<8|(o[14]&255)<<16|(o[15]&255)<<24,L=r[8]&255|(r[9]&255)<<8|(r[10]&255)<<16|(r[11]&255)<<24,j=i[16]&255|(i[17]&255)<<8|(i[18]&255)<<16|(i[19]&255)<<24,Y=i[20]&255|(i[21]&255)<<8|(i[22]&255)<<16|(i[23]&255)<<24,R=i[24]&255|(i[25]&255)<<8|(i[26]&255)<<16|(i[27]&255)<<24,z=i[28]&255|(i[29]&255)<<8|(i[30]&255)<<16|(i[31]&255)<<24,N=r[12]&255|(r[13]&255)<<8|(r[14]&255)<<16|(r[15]&255)<<24,C=a,D=u,v=p,B=b,P=K,E=T,h=U,d=q,m=_,g=I,A=L,w=j,M=Y,H=R,G=z,F=N,s,X=0;X<20;X+=2)s=C+M|0,P^=s<<7|s>>>25,s=P+C|0,m^=s<<9|s>>>23,s=m+P|0,M^=s<<13|s>>>19,s=M+m|0,C^=s<<18|s>>>14,s=E+D|0,g^=s<<7|s>>>25,s=g+E|0,H^=s<<9|s>>>23,s=H+g|0,D^=s<<13|s>>>19,s=D+H|0,E^=s<<18|s>>>14,s=A+h|0,G^=s<<7|s>>>25,s=G+A|0,v^=s<<9|s>>>23,s=v+G|0,h^=s<<13|s>>>19,s=h+v|0,A^=s<<18|s>>>14,s=F+w|0,B^=s<<7|s>>>25,s=B+F|0,d^=s<<9|s>>>23,s=d+B|0,w^=s<<13|s>>>19,s=w+d|0,F^=s<<18|s>>>14,s=C+B|0,D^=s<<7|s>>>25,s=D+C|0,v^=s<<9|s>>>23,s=v+D|0,B^=s<<13|s>>>19,s=B+v|0,C^=s<<18|s>>>14,s=E+P|0,h^=s<<7|s>>>25,s=h+E|0,d^=s<<9|s>>>23,s=d+h|0,P^=s<<13|s>>>19,s=P+d|0,E^=s<<18|s>>>14,s=A+g|0,w^=s<<7|s>>>25,s=w+A|0,m^=s<<9|s>>>23,s=m+w|0,g^=s<<13|s>>>19,s=g+m|0,A^=s<<18|s>>>14,s=F+G|0,M^=s<<7|s>>>25,s=M+F|0,H^=s<<9|s>>>23,s=H+M|0,G^=s<<13|s>>>19,s=G+H|0,F^=s<<18|s>>>14;t[0]=C>>>0&255,t[1]=C>>>8&255,t[2]=C>>>16&255,t[3]=C>>>24&255,t[4]=E>>>0&255,t[5]=E>>>8&255,t[6]=E>>>16&255,t[7]=E>>>24&255,t[8]=A>>>0&255,t[9]=A>>>8&255,t[10]=A>>>16&255,t[11]=A>>>24&255,t[12]=F>>>0&255,t[13]=F>>>8&255,t[14]=F>>>16&255,t[15]=F>>>24&255,t[16]=h>>>0&255,t[17]=h>>>8&255,t[18]=h>>>16&255,t[19]=h>>>24&255,t[20]=d>>>0&255,t[21]=d>>>8&255,t[22]=d>>>16&255,t[23]=d>>>24&255,t[24]=m>>>0&255,t[25]=m>>>8&255,t[26]=m>>>16&255,t[27]=m>>>24&255,t[28]=g>>>0&255,t[29]=g>>>8&255,t[30]=g>>>16&255,t[31]=g>>>24&255}y(_r,"core_hsalsa20");function wr(t,o,i,r){Ur(t,o,i,r)}y(wr,"crypto_core_salsa20");function lr(t,o,i,r){_r(t,o,i,r)}y(lr,"crypto_core_hsalsa20");var ur=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function Mr(t,o,i,r,a,u,p){var b=new Uint8Array(16),K=new Uint8Array(64),T,U;for(U=0;U<16;U++)b[U]=0;for(U=0;U<8;U++)b[U]=u[U];for(;a>=64;){for(wr(K,b,p,ur),U=0;U<64;U++)t[o+U]=i[r+U]^K[U];for(T=1,U=8;U<16;U++)T=T+(b[U]&255)|0,b[U]=T&255,T>>>=8;a-=64,o+=64,r+=64}if(a>0)for(wr(K,b,p,ur),U=0;U<a;U++)t[o+U]=i[r+U]^K[U];return 0}y(Mr,"crypto_stream_salsa20_xor");function Er(t,o,i,r,a){var u=new Uint8Array(16),p=new Uint8Array(64),b,K;for(K=0;K<16;K++)u[K]=0;for(K=0;K<8;K++)u[K]=r[K];for(;i>=64;){for(wr(p,u,a,ur),K=0;K<64;K++)t[o+K]=p[K];for(b=1,K=8;K<16;K++)b=b+(u[K]&255)|0,u[K]=b&255,b>>>=8;i-=64,o+=64}if(i>0)for(wr(p,u,a,ur),K=0;K<i;K++)t[o+K]=p[K];return 0}y(Er,"crypto_stream_salsa20");function Cr(t,o,i,r,a){var u=new Uint8Array(32);lr(u,r,a,ur);for(var p=new Uint8Array(8),b=0;b<8;b++)p[b]=r[b+16];return Er(t,o,i,p,u)}y(Cr,"crypto_stream");function kr(t,o,i,r,a,u,p){var b=new Uint8Array(32);lr(b,u,p,ur);for(var K=new Uint8Array(8),T=0;T<8;T++)K[T]=u[T+16];return Mr(t,o,i,r,a,K,b)}y(kr,"crypto_stream_xor");var Ye=y(function(t){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 o,i,r,a,u,p,b,K;o=t[0]&255|(t[1]&255)<<8,this.r[0]=o&8191,i=t[2]&255|(t[3]&255)<<8,this.r[1]=(o>>>13|i<<3)&8191,r=t[4]&255|(t[5]&255)<<8,this.r[2]=(i>>>10|r<<6)&7939,a=t[6]&255|(t[7]&255)<<8,this.r[3]=(r>>>7|a<<9)&8191,u=t[8]&255|(t[9]&255)<<8,this.r[4]=(a>>>4|u<<12)&255,this.r[5]=u>>>1&8190,p=t[10]&255|(t[11]&255)<<8,this.r[6]=(u>>>14|p<<2)&8191,b=t[12]&255|(t[13]&255)<<8,this.r[7]=(p>>>11|b<<5)&8065,K=t[14]&255|(t[15]&255)<<8,this.r[8]=(b>>>8|K<<8)&8191,this.r[9]=K>>>5&127,this.pad[0]=t[16]&255|(t[17]&255)<<8,this.pad[1]=t[18]&255|(t[19]&255)<<8,this.pad[2]=t[20]&255|(t[21]&255)<<8,this.pad[3]=t[22]&255|(t[23]&255)<<8,this.pad[4]=t[24]&255|(t[25]&255)<<8,this.pad[5]=t[26]&255|(t[27]&255)<<8,this.pad[6]=t[28]&255|(t[29]&255)<<8,this.pad[7]=t[30]&255|(t[31]&255)<<8},"poly1305");Ye.prototype.blocks=function(t,o,i){for(var r=this.fin?0:2048,a,u,p,b,K,T,U,q,_,I,L,j,Y,R,z,N,C,D,v,B=this.h[0],P=this.h[1],E=this.h[2],h=this.h[3],d=this.h[4],m=this.h[5],g=this.h[6],A=this.h[7],w=this.h[8],M=this.h[9],H=this.r[0],G=this.r[1],F=this.r[2],s=this.r[3],X=this.r[4],J=this.r[5],Q=this.r[6],V=this.r[7],$=this.r[8],Z=this.r[9];i>=16;)a=t[o+0]&255|(t[o+1]&255)<<8,B+=a&8191,u=t[o+2]&255|(t[o+3]&255)<<8,P+=(a>>>13|u<<3)&8191,p=t[o+4]&255|(t[o+5]&255)<<8,E+=(u>>>10|p<<6)&8191,b=t[o+6]&255|(t[o+7]&255)<<8,h+=(p>>>7|b<<9)&8191,K=t[o+8]&255|(t[o+9]&255)<<8,d+=(b>>>4|K<<12)&8191,m+=K>>>1&8191,T=t[o+10]&255|(t[o+11]&255)<<8,g+=(K>>>14|T<<2)&8191,U=t[o+12]&255|(t[o+13]&255)<<8,A+=(T>>>11|U<<5)&8191,q=t[o+14]&255|(t[o+15]&255)<<8,w+=(U>>>8|q<<8)&8191,M+=q>>>5|r,_=0,I=_,I+=B*H,I+=P*(5*Z),I+=E*(5*$),I+=h*(5*V),I+=d*(5*Q),_=I>>>13,I&=8191,I+=m*(5*J),I+=g*(5*X),I+=A*(5*s),I+=w*(5*F),I+=M*(5*G),_+=I>>>13,I&=8191,L=_,L+=B*G,L+=P*H,L+=E*(5*Z),L+=h*(5*$),L+=d*(5*V),_=L>>>13,L&=8191,L+=m*(5*Q),L+=g*(5*J),L+=A*(5*X),L+=w*(5*s),L+=M*(5*F),_+=L>>>13,L&=8191,j=_,j+=B*F,j+=P*G,j+=E*H,j+=h*(5*Z),j+=d*(5*$),_=j>>>13,j&=8191,j+=m*(5*V),j+=g*(5*Q),j+=A*(5*J),j+=w*(5*X),j+=M*(5*s),_+=j>>>13,j&=8191,Y=_,Y+=B*s,Y+=P*F,Y+=E*G,Y+=h*H,Y+=d*(5*Z),_=Y>>>13,Y&=8191,Y+=m*(5*$),Y+=g*(5*V),Y+=A*(5*Q),Y+=w*(5*J),Y+=M*(5*X),_+=Y>>>13,Y&=8191,R=_,R+=B*X,R+=P*s,R+=E*F,R+=h*G,R+=d*H,_=R>>>13,R&=8191,R+=m*(5*Z),R+=g*(5*$),R+=A*(5*V),R+=w*(5*Q),R+=M*(5*J),_+=R>>>13,R&=8191,z=_,z+=B*J,z+=P*X,z+=E*s,z+=h*F,z+=d*G,_=z>>>13,z&=8191,z+=m*H,z+=g*(5*Z),z+=A*(5*$),z+=w*(5*V),z+=M*(5*Q),_+=z>>>13,z&=8191,N=_,N+=B*Q,N+=P*J,N+=E*X,N+=h*s,N+=d*F,_=N>>>13,N&=8191,N+=m*G,N+=g*H,N+=A*(5*Z),N+=w*(5*$),N+=M*(5*V),_+=N>>>13,N&=8191,C=_,C+=B*V,C+=P*Q,C+=E*J,C+=h*X,C+=d*s,_=C>>>13,C&=8191,C+=m*F,C+=g*G,C+=A*H,C+=w*(5*Z),C+=M*(5*$),_+=C>>>13,C&=8191,D=_,D+=B*$,D+=P*V,D+=E*Q,D+=h*J,D+=d*X,_=D>>>13,D&=8191,D+=m*s,D+=g*F,D+=A*G,D+=w*H,D+=M*(5*Z),_+=D>>>13,D&=8191,v=_,v+=B*Z,v+=P*$,v+=E*V,v+=h*Q,v+=d*J,_=v>>>13,v&=8191,v+=m*X,v+=g*s,v+=A*F,v+=w*G,v+=M*H,_+=v>>>13,v&=8191,_=(_<<2)+_|0,_=_+I|0,I=_&8191,_=_>>>13,L+=_,B=I,P=L,E=j,h=Y,d=R,m=z,g=N,A=C,w=D,M=v,o+=16,i-=16;this.h[0]=B,this.h[1]=P,this.h[2]=E,this.h[3]=h,this.h[4]=d,this.h[5]=m,this.h[6]=g,this.h[7]=A,this.h[8]=w,this.h[9]=M},Ye.prototype.finish=function(t,o){var i=new Uint16Array(10),r,a,u,p;if(this.leftover){for(p=this.leftover,this.buffer[p++]=1;p<16;p++)this.buffer[p]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,p=2;p<10;p++)this.h[p]+=r,r=this.h[p]>>>13,this.h[p]&=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,i[0]=this.h[0]+5,r=i[0]>>>13,i[0]&=8191,p=1;p<10;p++)i[p]=this.h[p]+r,r=i[p]>>>13,i[p]&=8191;for(i[9]-=8192,a=(r^1)-1,p=0;p<10;p++)i[p]&=a;for(a=~a,p=0;p<10;p++)this.h[p]=this.h[p]&a|i[p];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,u=this.h[0]+this.pad[0],this.h[0]=u&65535,p=1;p<8;p++)u=(this.h[p]+this.pad[p]|0)+(u>>>16)|0,this.h[p]=u&65535;t[o+0]=this.h[0]>>>0&255,t[o+1]=this.h[0]>>>8&255,t[o+2]=this.h[1]>>>0&255,t[o+3]=this.h[1]>>>8&255,t[o+4]=this.h[2]>>>0&255,t[o+5]=this.h[2]>>>8&255,t[o+6]=this.h[3]>>>0&255,t[o+7]=this.h[3]>>>8&255,t[o+8]=this.h[4]>>>0&255,t[o+9]=this.h[4]>>>8&255,t[o+10]=this.h[5]>>>0&255,t[o+11]=this.h[5]>>>8&255,t[o+12]=this.h[6]>>>0&255,t[o+13]=this.h[6]>>>8&255,t[o+14]=this.h[7]>>>0&255,t[o+15]=this.h[7]>>>8&255},Ye.prototype.update=function(t,o,i){var r,a;if(this.leftover){for(a=16-this.leftover,a>i&&(a=i),r=0;r<a;r++)this.buffer[this.leftover+r]=t[o+r];if(i-=a,o+=a,this.leftover+=a,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(i>=16&&(a=i-i%16,this.blocks(t,o,a),o+=a,i-=a),i){for(r=0;r<i;r++)this.buffer[this.leftover+r]=t[o+r];this.leftover+=i}};function it(t,o,i,r,a,u){var p=new Ye(u);return p.update(i,r,a),p.finish(t,o),0}y(it,"crypto_onetimeauth");function pn(t,o,i,r,a,u){var p=new Uint8Array(16);return it(p,0,i,r,a,u),dr(t,o,p,0)}y(pn,"crypto_onetimeauth_verify");function ot(t,o,i,r,a){var u;if(i<32)return-1;for(kr(t,0,o,0,i,r,a),it(t,16,t,32,i-32,t),u=0;u<16;u++)t[u]=0;return 0}y(ot,"crypto_secretbox");function at(t,o,i,r,a){var u,p=new Uint8Array(32);if(i<32||(Cr(p,0,32,r,a),pn(o,16,o,32,i-32,p)!==0))return-1;for(kr(t,0,o,0,i,r,a),u=0;u<32;u++)t[u]=0;return 0}y(at,"crypto_secretbox_open");function zr(t,o){var i;for(i=0;i<16;i++)t[i]=o[i]|0}y(zr,"set25519");function st(t){var o,i,r=1;for(o=0;o<16;o++)i=t[o]+r+65535,r=Math.floor(i/65536),t[o]=i-r*65536;t[0]+=r-1+37*(r-1)}y(st,"car25519");function oe(t,o,i){for(var r,a=~(i-1),u=0;u<16;u++)r=a&(t[u]^o[u]),t[u]^=r,o[u]^=r}y(oe,"sel25519");function ae(t,o){var i,r,a,u=e(),p=e();for(i=0;i<16;i++)p[i]=o[i];for(st(p),st(p),st(p),r=0;r<2;r++){for(u[0]=p[0]-65517,i=1;i<15;i++)u[i]=p[i]-65535-(u[i-1]>>16&1),u[i-1]&=65535;u[15]=p[15]-32767-(u[14]>>16&1),a=u[15]>>16&1,u[14]&=65535,oe(p,u,1-a)}for(i=0;i<16;i++)t[2*i]=p[i]&255,t[2*i+1]=p[i]>>8}y(ae,"pack25519");function hn(t,o){var i=new Uint8Array(32),r=new Uint8Array(32);return ae(i,t),ae(r,o),Dr(i,0,r,0)}y(hn,"neq25519");function dn(t){var o=new Uint8Array(32);return ae(o,t),o[0]&1}y(dn,"par25519");function ct(t,o){var i;for(i=0;i<16;i++)t[i]=o[2*i]+(o[2*i+1]<<8);t[15]&=32767}y(ct,"unpack25519");function Ir(t,o,i){for(var r=0;r<16;r++)t[r]=o[r]+i[r]}y(Ir,"A");function Lr(t,o,i){for(var r=0;r<16;r++)t[r]=o[r]-i[r]}y(Lr,"Z");function W(t,o,i){var r,a,u=0,p=0,b=0,K=0,T=0,U=0,q=0,_=0,I=0,L=0,j=0,Y=0,R=0,z=0,N=0,C=0,D=0,v=0,B=0,P=0,E=0,h=0,d=0,m=0,g=0,A=0,w=0,M=0,H=0,G=0,F=0,s=i[0],X=i[1],J=i[2],Q=i[3],V=i[4],$=i[5],Z=i[6],sr=i[7],er=i[8],fr=i[9],ir=i[10],or=i[11],xr=i[12],br=i[13],Ar=i[14],mr=i[15];r=o[0],u+=r*s,p+=r*X,b+=r*J,K+=r*Q,T+=r*V,U+=r*$,q+=r*Z,_+=r*sr,I+=r*er,L+=r*fr,j+=r*ir,Y+=r*or,R+=r*xr,z+=r*br,N+=r*Ar,C+=r*mr,r=o[1],p+=r*s,b+=r*X,K+=r*J,T+=r*Q,U+=r*V,q+=r*$,_+=r*Z,I+=r*sr,L+=r*er,j+=r*fr,Y+=r*ir,R+=r*or,z+=r*xr,N+=r*br,C+=r*Ar,D+=r*mr,r=o[2],b+=r*s,K+=r*X,T+=r*J,U+=r*Q,q+=r*V,_+=r*$,I+=r*Z,L+=r*sr,j+=r*er,Y+=r*fr,R+=r*ir,z+=r*or,N+=r*xr,C+=r*br,D+=r*Ar,v+=r*mr,r=o[3],K+=r*s,T+=r*X,U+=r*J,q+=r*Q,_+=r*V,I+=r*$,L+=r*Z,j+=r*sr,Y+=r*er,R+=r*fr,z+=r*ir,N+=r*or,C+=r*xr,D+=r*br,v+=r*Ar,B+=r*mr,r=o[4],T+=r*s,U+=r*X,q+=r*J,_+=r*Q,I+=r*V,L+=r*$,j+=r*Z,Y+=r*sr,R+=r*er,z+=r*fr,N+=r*ir,C+=r*or,D+=r*xr,v+=r*br,B+=r*Ar,P+=r*mr,r=o[5],U+=r*s,q+=r*X,_+=r*J,I+=r*Q,L+=r*V,j+=r*$,Y+=r*Z,R+=r*sr,z+=r*er,N+=r*fr,C+=r*ir,D+=r*or,v+=r*xr,B+=r*br,P+=r*Ar,E+=r*mr,r=o[6],q+=r*s,_+=r*X,I+=r*J,L+=r*Q,j+=r*V,Y+=r*$,R+=r*Z,z+=r*sr,N+=r*er,C+=r*fr,D+=r*ir,v+=r*or,B+=r*xr,P+=r*br,E+=r*Ar,h+=r*mr,r=o[7],_+=r*s,I+=r*X,L+=r*J,j+=r*Q,Y+=r*V,R+=r*$,z+=r*Z,N+=r*sr,C+=r*er,D+=r*fr,v+=r*ir,B+=r*or,P+=r*xr,E+=r*br,h+=r*Ar,d+=r*mr,r=o[8],I+=r*s,L+=r*X,j+=r*J,Y+=r*Q,R+=r*V,z+=r*$,N+=r*Z,C+=r*sr,D+=r*er,v+=r*fr,B+=r*ir,P+=r*or,E+=r*xr,h+=r*br,d+=r*Ar,m+=r*mr,r=o[9],L+=r*s,j+=r*X,Y+=r*J,R+=r*Q,z+=r*V,N+=r*$,C+=r*Z,D+=r*sr,v+=r*er,B+=r*fr,P+=r*ir,E+=r*or,h+=r*xr,d+=r*br,m+=r*Ar,g+=r*mr,r=o[10],j+=r*s,Y+=r*X,R+=r*J,z+=r*Q,N+=r*V,C+=r*$,D+=r*Z,v+=r*sr,B+=r*er,P+=r*fr,E+=r*ir,h+=r*or,d+=r*xr,m+=r*br,g+=r*Ar,A+=r*mr,r=o[11],Y+=r*s,R+=r*X,z+=r*J,N+=r*Q,C+=r*V,D+=r*$,v+=r*Z,B+=r*sr,P+=r*er,E+=r*fr,h+=r*ir,d+=r*or,m+=r*xr,g+=r*br,A+=r*Ar,w+=r*mr,r=o[12],R+=r*s,z+=r*X,N+=r*J,C+=r*Q,D+=r*V,v+=r*$,B+=r*Z,P+=r*sr,E+=r*er,h+=r*fr,d+=r*ir,m+=r*or,g+=r*xr,A+=r*br,w+=r*Ar,M+=r*mr,r=o[13],z+=r*s,N+=r*X,C+=r*J,D+=r*Q,v+=r*V,B+=r*$,P+=r*Z,E+=r*sr,h+=r*er,d+=r*fr,m+=r*ir,g+=r*or,A+=r*xr,w+=r*br,M+=r*Ar,H+=r*mr,r=o[14],N+=r*s,C+=r*X,D+=r*J,v+=r*Q,B+=r*V,P+=r*$,E+=r*Z,h+=r*sr,d+=r*er,m+=r*fr,g+=r*ir,A+=r*or,w+=r*xr,M+=r*br,H+=r*Ar,G+=r*mr,r=o[15],C+=r*s,D+=r*X,v+=r*J,B+=r*Q,P+=r*V,E+=r*$,h+=r*Z,d+=r*sr,m+=r*er,g+=r*fr,A+=r*ir,w+=r*or,M+=r*xr,H+=r*br,G+=r*Ar,F+=r*mr,u+=38*D,p+=38*v,b+=38*B,K+=38*P,T+=38*E,U+=38*h,q+=38*d,_+=38*m,I+=38*g,L+=38*A,j+=38*w,Y+=38*M,R+=38*H,z+=38*G,N+=38*F,a=1,r=u+a+65535,a=Math.floor(r/65536),u=r-a*65536,r=p+a+65535,a=Math.floor(r/65536),p=r-a*65536,r=b+a+65535,a=Math.floor(r/65536),b=r-a*65536,r=K+a+65535,a=Math.floor(r/65536),K=r-a*65536,r=T+a+65535,a=Math.floor(r/65536),T=r-a*65536,r=U+a+65535,a=Math.floor(r/65536),U=r-a*65536,r=q+a+65535,a=Math.floor(r/65536),q=r-a*65536,r=_+a+65535,a=Math.floor(r/65536),_=r-a*65536,r=I+a+65535,a=Math.floor(r/65536),I=r-a*65536,r=L+a+65535,a=Math.floor(r/65536),L=r-a*65536,r=j+a+65535,a=Math.floor(r/65536),j=r-a*65536,r=Y+a+65535,a=Math.floor(r/65536),Y=r-a*65536,r=R+a+65535,a=Math.floor(r/65536),R=r-a*65536,r=z+a+65535,a=Math.floor(r/65536),z=r-a*65536,r=N+a+65535,a=Math.floor(r/65536),N=r-a*65536,r=C+a+65535,a=Math.floor(r/65536),C=r-a*65536,u+=a-1+37*(a-1),a=1,r=u+a+65535,a=Math.floor(r/65536),u=r-a*65536,r=p+a+65535,a=Math.floor(r/65536),p=r-a*65536,r=b+a+65535,a=Math.floor(r/65536),b=r-a*65536,r=K+a+65535,a=Math.floor(r/65536),K=r-a*65536,r=T+a+65535,a=Math.floor(r/65536),T=r-a*65536,r=U+a+65535,a=Math.floor(r/65536),U=r-a*65536,r=q+a+65535,a=Math.floor(r/65536),q=r-a*65536,r=_+a+65535,a=Math.floor(r/65536),_=r-a*65536,r=I+a+65535,a=Math.floor(r/65536),I=r-a*65536,r=L+a+65535,a=Math.floor(r/65536),L=r-a*65536,r=j+a+65535,a=Math.floor(r/65536),j=r-a*65536,r=Y+a+65535,a=Math.floor(r/65536),Y=r-a*65536,r=R+a+65535,a=Math.floor(r/65536),R=r-a*65536,r=z+a+65535,a=Math.floor(r/65536),z=r-a*65536,r=N+a+65535,a=Math.floor(r/65536),N=r-a*65536,r=C+a+65535,a=Math.floor(r/65536),C=r-a*65536,u+=a-1+37*(a-1),t[0]=u,t[1]=p,t[2]=b,t[3]=K,t[4]=T,t[5]=U,t[6]=q,t[7]=_,t[8]=I,t[9]=L,t[10]=j,t[11]=Y,t[12]=R,t[13]=z,t[14]=N,t[15]=C}y(W,"M");function Br(t,o){W(t,o,o)}y(Br,"S");function ln(t,o){var i=e(),r;for(r=0;r<16;r++)i[r]=o[r];for(r=253;r>=0;r--)Br(i,i),r!==2&&r!==4&&W(i,i,o);for(r=0;r<16;r++)t[r]=i[r]}y(ln,"inv25519");function gn(t,o){var i=e(),r;for(r=0;r<16;r++)i[r]=o[r];for(r=250;r>=0;r--)Br(i,i),r!==1&&W(i,i,o);for(r=0;r<16;r++)t[r]=i[r]}y(gn,"pow2523");function je(t,o,i){var r=new Uint8Array(32),a=new Float64Array(80),u,p,b=e(),K=e(),T=e(),U=e(),q=e(),_=e();for(p=0;p<31;p++)r[p]=o[p];for(r[31]=o[31]&127|64,r[0]&=248,ct(a,i),p=0;p<16;p++)K[p]=a[p],U[p]=b[p]=T[p]=0;for(b[0]=U[0]=1,p=254;p>=0;--p)u=r[p>>>3]>>>(p&7)&1,oe(b,K,u),oe(T,U,u),Ir(q,b,T),Lr(b,b,T),Ir(T,K,U),Lr(K,K,U),Br(U,q),Br(_,b),W(b,T,b),W(T,K,q),Ir(q,b,T),Lr(b,b,T),Br(K,b),Lr(T,U,_),W(b,T,k),Ir(b,b,U),W(T,T,b),W(b,U,_),W(U,K,a),Br(K,q),oe(b,K,u),oe(T,U,u);for(p=0;p<16;p++)a[p+16]=b[p],a[p+32]=T[p],a[p+48]=K[p],a[p+64]=U[p];var I=a.subarray(32),L=a.subarray(16);return ln(I,I),W(L,L,I),ae(t,L),0}y(je,"crypto_scalarmult");function He(t,o){return je(t,o,x)}y(He,"crypto_scalarmult_base");function bn(t,o){return f(o,32),He(t,o)}y(bn,"crypto_box_keypair");function Fe(t,o,i){var r=new Uint8Array(32);return je(r,i,o),lr(t,c,r,ur)}y(Fe,"crypto_box_beforenm");var An=ot,cf=at;function yf(t,o,i,r,a,u){var p=new Uint8Array(32);return Fe(p,a,u),An(t,o,i,r,p)}y(yf,"crypto_box");function xf(t,o,i,r,a,u){var p=new Uint8Array(32);return Fe(p,a,u),cf(t,o,i,r,p)}y(xf,"crypto_box_open");var mn=[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 wn(t,o,i,r){for(var a=new Int32Array(16),u=new Int32Array(16),p,b,K,T,U,q,_,I,L,j,Y,R,z,N,C,D,v,B,P,E,h,d,m,g,A,w,M=t[0],H=t[1],G=t[2],F=t[3],s=t[4],X=t[5],J=t[6],Q=t[7],V=o[0],$=o[1],Z=o[2],sr=o[3],er=o[4],fr=o[5],ir=o[6],or=o[7],xr=0;r>=128;){for(P=0;P<16;P++)E=8*P+xr,a[P]=i[E+0]<<24|i[E+1]<<16|i[E+2]<<8|i[E+3],u[P]=i[E+4]<<24|i[E+5]<<16|i[E+6]<<8|i[E+7];for(P=0;P<80;P++)if(p=M,b=H,K=G,T=F,U=s,q=X,_=J,I=Q,L=V,j=$,Y=Z,R=sr,z=er,N=fr,C=ir,D=or,h=Q,d=or,m=d&65535,g=d>>>16,A=h&65535,w=h>>>16,h=(s>>>14|er<<18)^(s>>>18|er<<14)^(er>>>9|s<<23),d=(er>>>14|s<<18)^(er>>>18|s<<14)^(s>>>9|er<<23),m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,h=s&X^~s&J,d=er&fr^~er&ir,m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,h=mn[P*2],d=mn[P*2+1],m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,h=a[P%16],d=u[P%16],m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,g+=m>>>16,A+=g>>>16,w+=A>>>16,v=A&65535|w<<16,B=m&65535|g<<16,h=v,d=B,m=d&65535,g=d>>>16,A=h&65535,w=h>>>16,h=(M>>>28|V<<4)^(V>>>2|M<<30)^(V>>>7|M<<25),d=(V>>>28|M<<4)^(M>>>2|V<<30)^(M>>>7|V<<25),m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,h=M&H^M&G^H&G,d=V&$^V&Z^$&Z,m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,g+=m>>>16,A+=g>>>16,w+=A>>>16,I=A&65535|w<<16,D=m&65535|g<<16,h=T,d=R,m=d&65535,g=d>>>16,A=h&65535,w=h>>>16,h=v,d=B,m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,g+=m>>>16,A+=g>>>16,w+=A>>>16,T=A&65535|w<<16,R=m&65535|g<<16,H=p,G=b,F=K,s=T,X=U,J=q,Q=_,M=I,$=L,Z=j,sr=Y,er=R,fr=z,ir=N,or=C,V=D,P%16===15)for(E=0;E<16;E++)h=a[E],d=u[E],m=d&65535,g=d>>>16,A=h&65535,w=h>>>16,h=a[(E+9)%16],d=u[(E+9)%16],m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,v=a[(E+1)%16],B=u[(E+1)%16],h=(v>>>1|B<<31)^(v>>>8|B<<24)^v>>>7,d=(B>>>1|v<<31)^(B>>>8|v<<24)^(B>>>7|v<<25),m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,v=a[(E+14)%16],B=u[(E+14)%16],h=(v>>>19|B<<13)^(B>>>29|v<<3)^v>>>6,d=(B>>>19|v<<13)^(v>>>29|B<<3)^(B>>>6|v<<26),m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,g+=m>>>16,A+=g>>>16,w+=A>>>16,a[E]=A&65535|w<<16,u[E]=m&65535|g<<16;h=M,d=V,m=d&65535,g=d>>>16,A=h&65535,w=h>>>16,h=t[0],d=o[0],m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,g+=m>>>16,A+=g>>>16,w+=A>>>16,t[0]=M=A&65535|w<<16,o[0]=V=m&65535|g<<16,h=H,d=$,m=d&65535,g=d>>>16,A=h&65535,w=h>>>16,h=t[1],d=o[1],m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,g+=m>>>16,A+=g>>>16,w+=A>>>16,t[1]=H=A&65535|w<<16,o[1]=$=m&65535|g<<16,h=G,d=Z,m=d&65535,g=d>>>16,A=h&65535,w=h>>>16,h=t[2],d=o[2],m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,g+=m>>>16,A+=g>>>16,w+=A>>>16,t[2]=G=A&65535|w<<16,o[2]=Z=m&65535|g<<16,h=F,d=sr,m=d&65535,g=d>>>16,A=h&65535,w=h>>>16,h=t[3],d=o[3],m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,g+=m>>>16,A+=g>>>16,w+=A>>>16,t[3]=F=A&65535|w<<16,o[3]=sr=m&65535|g<<16,h=s,d=er,m=d&65535,g=d>>>16,A=h&65535,w=h>>>16,h=t[4],d=o[4],m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,g+=m>>>16,A+=g>>>16,w+=A>>>16,t[4]=s=A&65535|w<<16,o[4]=er=m&65535|g<<16,h=X,d=fr,m=d&65535,g=d>>>16,A=h&65535,w=h>>>16,h=t[5],d=o[5],m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,g+=m>>>16,A+=g>>>16,w+=A>>>16,t[5]=X=A&65535|w<<16,o[5]=fr=m&65535|g<<16,h=J,d=ir,m=d&65535,g=d>>>16,A=h&65535,w=h>>>16,h=t[6],d=o[6],m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,g+=m>>>16,A+=g>>>16,w+=A>>>16,t[6]=J=A&65535|w<<16,o[6]=ir=m&65535|g<<16,h=Q,d=or,m=d&65535,g=d>>>16,A=h&65535,w=h>>>16,h=t[7],d=o[7],m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,g+=m>>>16,A+=g>>>16,w+=A>>>16,t[7]=Q=A&65535|w<<16,o[7]=or=m&65535|g<<16,xr+=128,r-=128}return r}y(wn,"crypto_hashblocks_hl");function Qr(t,o,i){var r=new Int32Array(8),a=new Int32Array(8),u=new Uint8Array(256),p,b=i;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,a[0]=4089235720,a[1]=2227873595,a[2]=4271175723,a[3]=1595750129,a[4]=2917565137,a[5]=725511199,a[6]=4215389547,a[7]=327033209,wn(r,a,o,i),i%=128,p=0;p<i;p++)u[p]=o[b-i+p];for(u[i]=128,i=256-128*(i<112?1:0),u[i-9]=0,Oe(u,i-8,b/536870912|0,b<<3),wn(r,a,u,i),p=0;p<8;p++)Oe(t,8*p,r[p],a[p]);return 0}y(Qr,"crypto_hash");function Ge(t,o){var i=e(),r=e(),a=e(),u=e(),p=e(),b=e(),K=e(),T=e(),U=e();Lr(i,t[1],t[0]),Lr(U,o[1],o[0]),W(i,i,U),Ir(r,t[0],t[1]),Ir(U,o[0],o[1]),W(r,r,U),W(a,t[3],o[3]),W(a,a,Kr),W(u,t[2],o[2]),Ir(u,u,u),Lr(p,r,i),Lr(b,u,a),Ir(K,u,a),Ir(T,r,i),W(t[0],p,b),W(t[1],T,K),W(t[2],K,b),W(t[3],p,T)}y(Ge,"add");function Kn(t,o,i){var r;for(r=0;r<4;r++)oe(t[r],o[r],i)}y(Kn,"cswap");function yt(t,o){var i=e(),r=e(),a=e();ln(a,o[2]),W(i,o[0],a),W(r,o[1],a),ae(t,r),t[31]^=dn(i)<<7}y(yt,"pack");function xt(t,o,i){var r,a;for(zr(t[0],l),zr(t[1],S),zr(t[2],S),zr(t[3],l),a=255;a>=0;--a)r=i[a/8|0]>>(a&7)&1,Kn(t,o,r),Ge(o,t),Ge(t,t),Kn(t,o,r)}y(xt,"scalarmult");function Ve(t,o){var i=[e(),e(),e(),e()];zr(i[0],hr),zr(i[1],Tr),zr(i[2],S),W(i[3],hr,Tr),xt(t,i,o)}y(Ve,"scalarbase");function ut(t,o,i){var r=new Uint8Array(64),a=[e(),e(),e(),e()],u;for(i||f(o,32),Qr(r,o,32),r[0]&=248,r[31]&=127,r[31]|=64,Ve(a,r),yt(t,a),u=0;u<32;u++)o[u+32]=t[u];return 0}y(ut,"crypto_sign_keypair");var Xe=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 pt(t,o){var i,r,a,u;for(r=63;r>=32;--r){for(i=0,a=r-32,u=r-12;a<u;++a)o[a]+=i-16*o[r]*Xe[a-(r-32)],i=Math.floor((o[a]+128)/256),o[a]-=i*256;o[a]+=i,o[r]=0}for(i=0,a=0;a<32;a++)o[a]+=i-(o[31]>>4)*Xe[a],i=o[a]>>8,o[a]&=255;for(a=0;a<32;a++)o[a]-=i*Xe[a];for(r=0;r<32;r++)o[r+1]+=o[r]>>8,t[r]=o[r]&255}y(pt,"modL");function ht(t){var o=new Float64Array(64),i;for(i=0;i<64;i++)o[i]=t[i];for(i=0;i<64;i++)t[i]=0;pt(t,o)}y(ht,"reduce");function En(t,o,i,r){var a=new Uint8Array(64),u=new Uint8Array(64),p=new Uint8Array(64),b,K,T=new Float64Array(64),U=[e(),e(),e(),e()];Qr(a,r,32),a[0]&=248,a[31]&=127,a[31]|=64;var q=i+64;for(b=0;b<i;b++)t[64+b]=o[b];for(b=0;b<32;b++)t[32+b]=a[32+b];for(Qr(p,t.subarray(32),i+32),ht(p),Ve(U,p),yt(t,U),b=32;b<64;b++)t[b]=r[b];for(Qr(u,t,i+64),ht(u),b=0;b<64;b++)T[b]=0;for(b=0;b<32;b++)T[b]=p[b];for(b=0;b<32;b++)for(K=0;K<32;K++)T[b+K]+=u[b]*a[K];return pt(t.subarray(32),T),q}y(En,"crypto_sign");function uf(t,o){var i=e(),r=e(),a=e(),u=e(),p=e(),b=e(),K=e();return zr(t[2],S),ct(t[1],o),Br(a,t[1]),W(u,a,nr),Lr(a,a,t[2]),Ir(u,t[2],u),Br(p,u),Br(b,p),W(K,b,p),W(i,K,a),W(i,i,u),gn(i,i),W(i,i,a),W(i,i,u),W(i,i,u),W(t[0],i,u),Br(r,t[0]),W(r,r,u),hn(r,a)&&W(t[0],t[0],Xr),Br(r,t[0]),W(r,r,u),hn(r,a)?-1:(dn(t[0])===o[31]>>7&&Lr(t[0],l,t[0]),W(t[3],t[0],t[1]),0)}y(uf,"unpackneg");function dt(t,o,i,r){var a,u=new Uint8Array(32),p=new Uint8Array(64),b=[e(),e(),e(),e()],K=[e(),e(),e(),e()];if(i<64||uf(K,r))return-1;for(a=0;a<i;a++)t[a]=o[a];for(a=0;a<32;a++)t[a+32]=r[a];if(Qr(p,t,i),ht(p),xt(b,K,p),Ve(K,o.subarray(32)),Ge(b,K),yt(u,b),i-=64,Dr(o,0,u,0)){for(a=0;a<i;a++)t[a]=0;return-1}for(a=0;a<i;a++)t[a]=o[a+64];return i}y(dt,"crypto_sign_open");var lt=32,ke=24,we=32,se=16,Ke=32,We=32,Ee=32,Ue=32,gt=32,Un=ke,pf=we,hf=se,Or=64,re=32,ce=64,bt=32,At=64;n.lowlevel={crypto_core_hsalsa20:lr,crypto_stream_xor:kr,crypto_stream:Cr,crypto_stream_salsa20_xor:Mr,crypto_stream_salsa20:Er,crypto_onetimeauth:it,crypto_onetimeauth_verify:pn,crypto_verify_16:dr,crypto_verify_32:Dr,crypto_secretbox:ot,crypto_secretbox_open:at,crypto_scalarmult:je,crypto_scalarmult_base:He,crypto_box_beforenm:Fe,crypto_box_afternm:An,crypto_box:yf,crypto_box_open:xf,crypto_box_keypair:bn,crypto_hash:Qr,crypto_sign:En,crypto_sign_keypair:ut,crypto_sign_open:dt,crypto_secretbox_KEYBYTES:lt,crypto_secretbox_NONCEBYTES:ke,crypto_secretbox_ZEROBYTES:we,crypto_secretbox_BOXZEROBYTES:se,crypto_scalarmult_BYTES:Ke,crypto_scalarmult_SCALARBYTES:We,crypto_box_PUBLICKEYBYTES:Ee,crypto_box_SECRETKEYBYTES:Ue,crypto_box_BEFORENMBYTES:gt,crypto_box_NONCEBYTES:Un,crypto_box_ZEROBYTES:pf,crypto_box_BOXZEROBYTES:hf,crypto_sign_BYTES:Or,crypto_sign_PUBLICKEYBYTES:re,crypto_sign_SECRETKEYBYTES:ce,crypto_sign_SEEDBYTES:bt,crypto_hash_BYTES:At,gf:e,D:nr,L:Xe,pack25519:ae,unpack25519:ct,M:W,A:Ir,S:Br,Z:Lr,pow2523:gn,add:Ge,set25519:zr,modL:pt,scalarmult:xt,scalarbase:Ve};function vn(t,o){if(t.length!==lt)throw new Error("bad key size");if(o.length!==ke)throw new Error("bad nonce size")}y(vn,"checkLengths");function df(t,o){if(t.length!==Ee)throw new Error("bad public key size");if(o.length!==Ue)throw new Error("bad secret key size")}y(df,"checkBoxLengths");function vr(){for(var t=0;t<arguments.length;t++)if(!(arguments[t]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}y(vr,"checkArrayTypes");function Sn(t){for(var o=0;o<t.length;o++)t[o]=0}y(Sn,"cleanup"),n.randomBytes=function(t){var o=new Uint8Array(t);return f(o,t),o},n.secretbox=function(t,o,i){vr(t,o,i),vn(i,o);for(var r=new Uint8Array(we+t.length),a=new Uint8Array(r.length),u=0;u<t.length;u++)r[u+we]=t[u];return ot(a,r,r.length,o,i),a.subarray(se)},n.secretbox.open=function(t,o,i){vr(t,o,i),vn(i,o);for(var r=new Uint8Array(se+t.length),a=new Uint8Array(r.length),u=0;u<t.length;u++)r[u+se]=t[u];return r.length<32||at(a,r,r.length,o,i)!==0?null:a.subarray(we)},n.secretbox.keyLength=lt,n.secretbox.nonceLength=ke,n.secretbox.overheadLength=se,n.scalarMult=function(t,o){if(vr(t,o),t.length!==We)throw new Error("bad n size");if(o.length!==Ke)throw new Error("bad p size");var i=new Uint8Array(Ke);return je(i,t,o),i},n.scalarMult.base=function(t){if(vr(t),t.length!==We)throw new Error("bad n size");var o=new Uint8Array(Ke);return He(o,t),o},n.scalarMult.scalarLength=We,n.scalarMult.groupElementLength=Ke,n.box=function(t,o,i,r){var a=n.box.before(i,r);return n.secretbox(t,o,a)},n.box.before=function(t,o){vr(t,o),df(t,o);var i=new Uint8Array(gt);return Fe(i,t,o),i},n.box.after=n.secretbox,n.box.open=function(t,o,i,r){var a=n.box.before(i,r);return n.secretbox.open(t,o,a)},n.box.open.after=n.secretbox.open,n.box.keyPair=function(){var t=new Uint8Array(Ee),o=new Uint8Array(Ue);return bn(t,o),{publicKey:t,secretKey:o}},n.box.keyPair.fromSecretKey=function(t){if(vr(t),t.length!==Ue)throw new Error("bad secret key size");var o=new Uint8Array(Ee);return He(o,t),{publicKey:o,secretKey:new Uint8Array(t)}},n.box.publicKeyLength=Ee,n.box.secretKeyLength=Ue,n.box.sharedKeyLength=gt,n.box.nonceLength=Un,n.box.overheadLength=n.secretbox.overheadLength,n.sign=function(t,o){if(vr(t,o),o.length!==ce)throw new Error("bad secret key size");var i=new Uint8Array(Or+t.length);return En(i,t,t.length,o),i},n.sign.open=function(t,o){if(vr(t,o),o.length!==re)throw new Error("bad public key size");var i=new Uint8Array(t.length),r=dt(i,t,t.length,o);if(r<0)return null;for(var a=new Uint8Array(r),u=0;u<a.length;u++)a[u]=i[u];return a},n.sign.detached=function(t,o){for(var i=n.sign(t,o),r=new Uint8Array(Or),a=0;a<r.length;a++)r[a]=i[a];return r},n.sign.detached.verify=function(t,o,i){if(vr(t,o,i),o.length!==Or)throw new Error("bad signature size");if(i.length!==re)throw new Error("bad public key size");var r=new Uint8Array(Or+t.length),a=new Uint8Array(Or+t.length),u;for(u=0;u<Or;u++)r[u]=o[u];for(u=0;u<t.length;u++)r[u+Or]=t[u];return dt(a,r,r.length,i)>=0},n.sign.keyPair=function(){var t=new Uint8Array(re),o=new Uint8Array(ce);return ut(t,o),{publicKey:t,secretKey:o}},n.sign.keyPair.fromSecretKey=function(t){if(vr(t),t.length!==ce)throw new Error("bad secret key size");for(var o=new Uint8Array(re),i=0;i<o.length;i++)o[i]=t[32+i];return{publicKey:o,secretKey:new Uint8Array(t)}},n.sign.keyPair.fromSeed=function(t){if(vr(t),t.length!==bt)throw new Error("bad seed size");for(var o=new Uint8Array(re),i=new Uint8Array(ce),r=0;r<32;r++)i[r]=t[r];return ut(o,i,!0),{publicKey:o,secretKey:i}},n.sign.publicKeyLength=re,n.sign.secretKeyLength=ce,n.sign.seedLength=bt,n.sign.signatureLength=Or,n.hash=function(t){vr(t);var o=new Uint8Array(At);return Qr(o,t,t.length),o},n.hash.hashLength=At,n.verify=function(t,o){return vr(t,o),t.length===0||o.length===0||t.length!==o.length?!1:rr(t,0,o,0,t.length)===0},n.setPRNG=function(t){f=t},function(){var t=typeof self<"u"?self.crypto||self.msCrypto:null;if(t&&t.getRandomValues){var o=65536;n.setPRNG(function(i,r){var a,u=new Uint8Array(r);for(a=0;a<r;a+=o)t.getRandomValues(u.subarray(a,a+Math.min(r-a,o)));for(a=0;a<r;a++)i[a]=u[a];Sn(u)})}else typeof _n<"u"&&(t=ef(),t&&t.randomBytes&&n.setPRNG(function(i,r){var a,u=t.randomBytes(r);for(a=0;a<r;a++)i[a]=u[a];Sn(u)}))}()})(typeof et<"u"&&et.exports?et.exports:self.nacl=self.nacl||{})});var Uf=globalThis||window||self,tr=Uf.crypto;function Se(n=0){return new Uint8Array(n)}y(Se,"allocUnsafe");function mt(n,e){e==null&&(e=n.reduce((x,l)=>x+l.length,0));let f=Se(e),c=0;for(let x of n)f.set(x,c),c+=x.length;return f}y(mt,"concat");var Bt={};Pr(Bt,{base10:()=>Tf});var mo=new Uint8Array(0);function Bn(n,e){if(n===e)return!0;if(n.byteLength!==e.byteLength)return!1;for(let f=0;f<n.byteLength;f++)if(n[f]!==e[f])return!1;return!0}y(Bn,"equals");function Yr(n){if(n instanceof Uint8Array&&n.constructor.name==="Uint8Array")return n;if(n instanceof ArrayBuffer)return new Uint8Array(n);if(ArrayBuffer.isView(n))return new Uint8Array(n.buffer,n.byteOffset,n.byteLength);throw new Error("Unknown type, must be binary type")}y(Yr,"coerce");function Pn(n){return new TextEncoder().encode(n)}y(Pn,"fromString");function Tn(n){return new TextDecoder().decode(n)}y(Tn,"toString");function Sf(n,e){if(n.length>=255)throw new TypeError("Alphabet too long");for(var f=new Uint8Array(256),c=0;c<f.length;c++)f[c]=255;for(var x=0;x<n.length;x++){var l=n.charAt(x),S=l.charCodeAt(0);if(f[S]!==255)throw new TypeError(l+" is ambiguous");f[S]=x}var k=n.length,nr=n.charAt(0),Kr=Math.log(k)/Math.log(256),hr=Math.log(256)/Math.log(k);function Tr(rr){if(rr instanceof Uint8Array||(ArrayBuffer.isView(rr)?rr=new Uint8Array(rr.buffer,rr.byteOffset,rr.byteLength):Array.isArray(rr)&&(rr=Uint8Array.from(rr))),!(rr instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(rr.length===0)return"";for(var dr=0,Dr=0,Ur=0,_r=rr.length;Ur!==_r&&rr[Ur]===0;)Ur++,dr++;for(var wr=(_r-Ur)*hr+1>>>0,lr=new Uint8Array(wr);Ur!==_r;){for(var ur=rr[Ur],Mr=0,Er=wr-1;(ur!==0||Mr<Dr)&&Er!==-1;Er--,Mr++)ur+=256*lr[Er]>>>0,lr[Er]=ur%k>>>0,ur=ur/k>>>0;if(ur!==0)throw new Error("Non-zero carry");Dr=Mr,Ur++}for(var Cr=wr-Dr;Cr!==wr&&lr[Cr]===0;)Cr++;for(var kr=nr.repeat(dr);Cr<wr;++Cr)kr+=n.charAt(lr[Cr]);return kr}y(Tr,"encode");function Xr(rr){if(typeof rr!="string")throw new TypeError("Expected String");if(rr.length===0)return new Uint8Array;var dr=0;if(rr[dr]!==" "){for(var Dr=0,Ur=0;rr[dr]===nr;)Dr++,dr++;for(var _r=(rr.length-dr)*Kr+1>>>0,wr=new Uint8Array(_r);rr[dr];){var lr=f[rr.charCodeAt(dr)];if(lr===255)return;for(var ur=0,Mr=_r-1;(lr!==0||ur<Ur)&&Mr!==-1;Mr--,ur++)lr+=k*wr[Mr]>>>0,wr[Mr]=lr%256>>>0,lr=lr/256>>>0;if(lr!==0)throw new Error("Non-zero carry");Ur=ur,dr++}if(rr[dr]!==" "){for(var Er=_r-Ur;Er!==_r&&wr[Er]===0;)Er++;for(var Cr=new Uint8Array(Dr+(_r-Er)),kr=Dr;Er!==_r;)Cr[kr++]=wr[Er++];return Cr}}}y(Xr,"decodeUnsafe");function Oe(rr){var dr=Xr(rr);if(dr)return dr;throw new Error(`Non-${e} character`)}return y(Oe,"decode"),{encode:Tr,decodeUnsafe:Xr,decode:Oe}}y(Sf,"base");var _f=Sf,Cf=_f,Mn=Cf;var vt=class vt{constructor(e,f,c){O(this,"name");O(this,"prefix");O(this,"baseEncode");this.name=e,this.prefix=f,this.baseEncode=c}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}};y(vt,"Encoder");var wt=vt,St=class St{constructor(e,f,c){O(this,"name");O(this,"prefix");O(this,"baseDecode");O(this,"prefixCodePoint");this.name=e,this.prefix=f;let x=f.codePointAt(0);if(x===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=x,this.baseDecode=c}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return In(this,e)}};y(St,"Decoder");var Kt=St,_t=class _t{constructor(e){O(this,"decoders");this.decoders=e}or(e){return In(this,e)}decode(e){let f=e[0],c=this.decoders[f];if(c!=null)return c.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};y(_t,"ComposedDecoder");var Et=_t;function In(n,e){return new Et({...n.decoders??{[n.prefix]:n},...e.decoders??{[e.prefix]:e}})}y(In,"or");var Ct=class Ct{constructor(e,f,c,x){O(this,"name");O(this,"prefix");O(this,"baseEncode");O(this,"baseDecode");O(this,"encoder");O(this,"decoder");this.name=e,this.prefix=f,this.baseEncode=c,this.baseDecode=x,this.encoder=new wt(e,f,c),this.decoder=new Kt(e,f,x)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};y(Ct,"Codec");var Ut=Ct;function ye({name:n,prefix:e,encode:f,decode:c}){return new Ut(n,e,f,c)}y(ye,"from");function Wr({name:n,prefix:e,alphabet:f}){let{encode:c,decode:x}=Mn(f,n);return ye({prefix:e,name:n,encode:c,decode:y(l=>Yr(x(l)),"decode")})}y(Wr,"baseX");function Bf(n,e,f,c){let x={};for(let hr=0;hr<e.length;++hr)x[e[hr]]=hr;let l=n.length;for(;n[l-1]==="=";)--l;let S=new Uint8Array(l*f/8|0),k=0,nr=0,Kr=0;for(let hr=0;hr<l;++hr){let Tr=x[n[hr]];if(Tr===void 0)throw new SyntaxError(`Non-${c} character`);nr=nr<<f|Tr,k+=f,k>=8&&(k-=8,S[Kr++]=255&nr>>k)}if(k>=f||(255&nr<<8-k)!==0)throw new SyntaxError("Unexpected end of data");return S}y(Bf,"decode");function Pf(n,e,f){let c=e[e.length-1]==="=",x=(1<<f)-1,l="",S=0,k=0;for(let nr=0;nr<n.length;++nr)for(k=k<<8|n[nr],S+=8;S>f;)S-=f,l+=e[x&k>>S];if(S!==0&&(l+=e[x&k<<f-S]),c)for(;(l.length*f&7)!==0;)l+="=";return l}y(Pf,"encode");function ar({name:n,prefix:e,bitsPerChar:f,alphabet:c}){return ye({prefix:e,name:n,encode(x){return Pf(x,c,f)},decode(x){return Bf(x,c,f,n)}})}y(ar,"rfc4648");var Tf=Wr({prefix:"9",name:"base10",alphabet:"0123456789"});var Pt={};Pr(Pt,{base16:()=>Df,base16upper:()=>Mf});var Df=ar({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Mf=ar({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Tt={};Pr(Tt,{base2:()=>If});var If=ar({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Dt={};Pr(Dt,{base256emoji:()=>Of});var Ln=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),Lf=Ln.reduce((n,e,f)=>(n[f]=e,n),[]),Rf=Ln.reduce((n,e,f)=>{let c=e.codePointAt(0);if(c==null)throw new Error(`Invalid character: ${e}`);return n[c]=f,n},[]);function Nf(n){return n.reduce((e,f)=>(e+=Lf[f],e),"")}y(Nf,"encode");function zf(n){let e=[];for(let f of n){let c=f.codePointAt(0);if(c==null)throw new Error(`Invalid character: ${f}`);let x=Rf[c];if(x==null)throw new Error(`Non-base256emoji character: ${f}`);e.push(x)}return new Uint8Array(e)}y(zf,"decode");var Of=ye({prefix:"\u{1F680}",name:"base256emoji",encode:Nf,decode:zf});var Mt={};Pr(Mt,{base32:()=>xe,base32hex:()=>Ff,base32hexpad:()=>Vf,base32hexpadupper:()=>Xf,base32hexupper:()=>Gf,base32pad:()=>jf,base32padupper:()=>Hf,base32upper:()=>Yf,base32z:()=>kf});var xe=ar({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Yf=ar({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),jf=ar({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Hf=ar({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Ff=ar({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Gf=ar({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Vf=ar({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Xf=ar({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),kf=ar({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var It={};Pr(It,{base36:()=>_e,base36upper:()=>Wf});var _e=Wr({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Wf=Wr({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Lt={};Pr(Lt,{base58btc:()=>Nr,base58flickr:()=>$f});var Nr=Wr({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),$f=Wr({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Rt={};Pr(Rt,{base64:()=>Zf,base64pad:()=>qf,base64url:()=>Jf,base64urlpad:()=>Qf});var Zf=ar({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),qf=ar({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Jf=ar({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Qf=ar({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Nt={};Pr(Nt,{base8:()=>ri});var ri=ar({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var zt={};Pr(zt,{identity:()=>ei});var ei=ye({prefix:"\0",name:"identity",encode:y(n=>Tn(n),"encode"),decode:y(n=>Pn(n),"decode")});var jo=new TextEncoder,Ho=new TextDecoder;var jt={};Pr(jt,{identity:()=>Ui});var fi=zn,Rn=128,ii=127,oi=~ii,ai=Math.pow(2,31);function zn(n,e,f){e=e||[],f=f||0;for(var c=f;n>=ai;)e[f++]=n&255|Rn,n/=128;for(;n&oi;)e[f++]=n&255|Rn,n>>>=7;return e[f]=n|0,zn.bytes=f-c+1,e}y(zn,"encode");var si=Ot,ci=128,Nn=127;function Ot(n,c){var f=0,c=c||0,x=0,l=c,S,k=n.length;do{if(l>=k)throw Ot.bytes=0,new RangeError("Could not decode varint");S=n[l++],f+=x<28?(S&Nn)<<x:(S&Nn)*Math.pow(2,x),x+=7}while(S>=ci);return Ot.bytes=l-c,f}y(Ot,"read");var yi=Math.pow(2,7),xi=Math.pow(2,14),ui=Math.pow(2,21),pi=Math.pow(2,28),hi=Math.pow(2,35),di=Math.pow(2,42),li=Math.pow(2,49),gi=Math.pow(2,56),bi=Math.pow(2,63),Ai=y(function(n){return n<yi?1:n<xi?2:n<ui?3:n<pi?4:n<hi?5:n<di?6:n<li?7:n<gi?8:n<bi?9:10},"length"),mi={encode:fi,decode:si,encodingLength:Ai},wi=mi,Ce=wi;function Be(n,e=0){return[Ce.decode(n,e),Ce.decode.bytes]}y(Be,"decode");function ue(n,e,f=0){return Ce.encode(n,e,f),e}y(ue,"encodeTo");function pe(n){return Ce.encodingLength(n)}y(pe,"encodingLength");function ee(n,e){let f=e.byteLength,c=pe(n),x=c+pe(f),l=new Uint8Array(x+f);return ue(n,l,0),ue(f,l,c),l.set(e,x),new he(n,f,e,l)}y(ee,"create");function On(n){let e=Yr(n),[f,c]=Be(e),[x,l]=Be(e.subarray(c)),S=e.subarray(c+l);if(S.byteLength!==x)throw new Error("Incorrect length");return new he(f,x,S,e)}y(On,"decode");function Yn(n,e){if(n===e)return!0;{let f=e;return n.code===f.code&&n.size===f.size&&f.bytes instanceof Uint8Array&&Bn(n.bytes,f.bytes)}}y(Yn,"equals");var Yt=class Yt{constructor(e,f,c,x){O(this,"code");O(this,"size");O(this,"digest");O(this,"bytes");this.code=e,this.size=f,this.digest=c,this.bytes=x}};y(Yt,"Digest");var he=Yt;var jn=0,Ki="identity",Hn=Yr;function Ei(n){return ee(jn,Hn(n))}y(Ei,"digest");var Ui={code:jn,name:Ki,encode:Hn,digest:Ei};var Vt={};Pr(Vt,{sha256:()=>vi,sha512:()=>Si});function Ft({name:n,code:e,encode:f}){return new Ht(n,e,f)}y(Ft,"from");var Gt=class Gt{constructor(e,f,c){O(this,"name");O(this,"code");O(this,"encode");this.name=e,this.code=f,this.encode=c}digest(e){if(e instanceof Uint8Array){let f=this.encode(e);return f instanceof Uint8Array?ee(this.code,f):f.then(c=>ee(this.code,c))}else throw Error("Unknown type, must be binary type")}};y(Gt,"Hasher");var Ht=Gt;function Gn(n){return async e=>new Uint8Array(await crypto.subtle.digest(n,e))}y(Gn,"sha");var vi=Ft({name:"sha2-256",code:18,encode:Gn("SHA-256")}),Si=Ft({name:"sha2-512",code:19,encode:Gn("SHA-512")});function Vn(n,e){let{bytes:f,version:c}=n;switch(c){case 0:return Ci(f,Xt(n),e??Nr.encoder);default:return Bi(f,Xt(n),e??xe.encoder)}}y(Vn,"format");var Xn=new WeakMap;function Xt(n){let e=Xn.get(n);if(e==null){let f=new Map;return Xn.set(n,f),f}return e}y(Xt,"baseCache");var Wn,pr=class pr{constructor(e,f,c,x){O(this,"code");O(this,"version");O(this,"multihash");O(this,"bytes");O(this,"/");O(this,Wn,"CID");this.code=f,this.version=e,this.multihash=c,this.bytes=x,this["/"]=x}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:f}=this;if(e!==Te)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(f.code!==Pi)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return pr.createV0(f)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:f}=this.multihash,c=ee(e,f);return pr.createV1(this.code,c)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return pr.equals(this,e)}static equals(e,f){let c=f;return c!=null&&e.code===c.code&&e.version===c.version&&Yn(e.multihash,c.multihash)}toString(e){return Vn(this,e)}toJSON(){return{"/":Vn(this)}}link(){return this}[(Wn=Symbol.toStringTag,Symbol.for("nodejs.util.inspect.custom"))](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let f=e;if(f instanceof pr)return f;if(f["/"]!=null&&f["/"]===f.bytes||f.asCID===f){let{version:c,code:x,multihash:l,bytes:S}=f;return new pr(c,x,l,S??kn(c,x,l.bytes))}else if(f[Ti]===!0){let{version:c,multihash:x,code:l}=f,S=On(x);return pr.create(c,l,S)}else return null}static create(e,f,c){if(typeof f!="number")throw new Error("String codecs are no longer supported");if(!(c.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(f!==Te)throw new Error(`Version 0 CID must use dag-pb (code: ${Te}) block encoding`);return new pr(e,f,c,c.bytes)}case 1:{let x=kn(e,f,c.bytes);return new pr(e,f,c,x)}default:throw new Error("Invalid version")}}static createV0(e){return pr.create(0,Te,e)}static createV1(e,f){return pr.create(1,e,f)}static decode(e){let[f,c]=pr.decodeFirst(e);if(c.length!==0)throw new Error("Incorrect length");return f}static decodeFirst(e){let f=pr.inspectBytes(e),c=f.size-f.multihashSize,x=Yr(e.subarray(c,c+f.multihashSize));if(x.byteLength!==f.multihashSize)throw new Error("Incorrect length");let l=x.subarray(f.multihashSize-f.digestSize),S=new he(f.multihashCode,f.digestSize,l,x);return[f.version===0?pr.createV0(S):pr.createV1(f.codec,S),e.subarray(f.size)]}static inspectBytes(e){let f=0,c=y(()=>{let[Tr,Xr]=Be(e.subarray(f));return f+=Xr,Tr},"next"),x=c(),l=Te;if(x===18?(x=0,f=0):l=c(),x!==0&&x!==1)throw new RangeError(`Invalid CID version ${x}`);let S=f,k=c(),nr=c(),Kr=f+nr,hr=Kr-S;return{version:x,codec:l,multihashCode:k,digestSize:nr,multihashSize:hr,size:Kr}}static parse(e,f){let[c,x]=_i(e,f),l=pr.decode(x);if(l.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Xt(l).set(c,e),l}};y(pr,"CID");var Ze=pr;function _i(n,e){switch(n[0]){case"Q":{let f=e??Nr;return[Nr.prefix,f.decode(`${Nr.prefix}${n}`)]}case Nr.prefix:{let f=e??Nr;return[Nr.prefix,f.decode(n)]}case xe.prefix:{let f=e??xe;return[xe.prefix,f.decode(n)]}case _e.prefix:{let f=e??_e;return[_e.prefix,f.decode(n)]}default:{if(e==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[n[0],e.decode(n)]}}}y(_i,"parseCIDtoBytes");function Ci(n,e,f){let{prefix:c}=f;if(c!==Nr.prefix)throw Error(`Cannot string encode V0 in ${f.name} encoding`);let x=e.get(c);if(x==null){let l=f.encode(n).slice(1);return e.set(c,l),l}else return x}y(Ci,"toStringV0");function Bi(n,e,f){let{prefix:c}=f,x=e.get(c);if(x==null){let l=f.encode(n);return e.set(c,l),l}else return x}y(Bi,"toStringV1");var Te=112,Pi=18;function kn(n,e,f){let c=pe(n),x=c+pe(e),l=new Uint8Array(x+f.byteLength);return ue(n,l,0),ue(e,l,c),l.set(f,x),l}y(kn,"encodeCID");var Ti=Symbol.for("@ipld/js-cid/CID");var kt={...zt,...Tt,...Nt,...Bt,...Pt,...Mt,...It,...Lt,...Rt,...Dt},Aa={...Vt,...jt};function Zn(n,e,f,c){return{name:n,prefix:e,encoder:{name:n,prefix:e,encode:f},decoder:{decode:c}}}y(Zn,"createCodec");var $n=Zn("utf8","u",n=>"u"+new TextDecoder("utf8").decode(n),n=>new TextEncoder().encode(n.substring(1))),Wt=Zn("ascii","a",n=>{let e="a";for(let f=0;f<n.length;f++)e+=String.fromCharCode(n[f]);return e},n=>{n=n.substring(1);let e=Se(n.length);for(let f=0;f<n.length;f++)e[f]=n.charCodeAt(f);return e}),Di={utf8:$n,"utf-8":$n,hex:kt.base16,latin1:Wt,ascii:Wt,binary:Wt,...kt},qe=Di;function gr(n,e="utf8"){let f=qe[e];if(f==null)throw new Error(`Unsupported encoding "${e}"`);return f.decoder.decode(`${f.prefix}${n}`)}y(gr,"fromString");function cr(n,e="utf8"){let f=qe[e];if(f==null)throw new Error(`Unsupported encoding "${e}"`);return f.encoder.encode(n).substring(1)}y(cr,"toString");var De=(c=>(c.Sign="signing",c.Exchange="exchange",c.Write="write",c))(De||{});var te="did:key:z",Va="Ed25519",Xa="X25519",ka="X25519",Wa="Ed25519",$a="X25519",Li={sign:["sign","verify"],encrypt:["deriveKey","deriveBits"]},ne="RSA-OAEP",fe="RSASSA-PKCS1-v1_5",$t="SHA-256",Zt=new Uint8Array([0,245,2]),qt=2048,de="SHA-256",jr=8,Hr="AES-GCM",le=Hr,ie=256,ge=12,Jt=new Uint8Array([234,1]),Qt=new Uint8Array([237,1]),Je={RSA:"rsa",Edwards:"ed25519",BLS:"bls12-381"},rn="rsa-exchange-key",en="rsa-write-key",Za="ecc-exchange",qa="ecc-write",tn=16;var qn=new Error("Invalid key use. Please use 'encryption' or 'signing"),Ri=new Error("Max must be less than 256 and greater than 0");function Sr(n){return new Uint8Array(n).buffer}y(Sr,"toArrayBuffer");async function Jn(n){return new Uint8Array(await tr.subtle.digest("sha-256",n.buffer))}y(Jn,"sha256");function $r(n){let e=gr(n,"base64pad");return Sr(e)}y($r,"base64ToArrBuf");var Ie=y((n,e)=>{if(typeof n=="string")return e(n);if(typeof n=="object"&&n.byteLength!==void 0)return new Uint8Array(n).buffer;throw new Error("Improper value. Must be a string, ArrayBuffer, Uint8Array")},"normalizeToBuf");function Qe(n){return Ie(n,$r)}y(Qe,"normalizeBase64ToBuf");var Ni=y(n=>Ie(n,e=>Qn(e,8)),"normalizeUtf8ToBuf");function Qn(n,e){let f=e===8?new Uint8Array(n.length):new Uint16Array(n.length);for(let c=0,x=n.length;c<x;c++)f[c]=n.charCodeAt(c);return f.buffer}y(Qn,"strToArrBuf");var zi=y(n=>Ie(n,e=>Qn(e,16)),"normalizeUtf16ToBuf");function Zr(n,e){switch(e){case 8:return Ni(n);default:return zi(n)}}y(Zr,"normalizeUnicodeToBuf");function rf(n){if(!n.startsWith(te))throw new Error("Please use a base58-encoded DID formatted `did:key:z...`");let e=""+n.substring(te.length),f=gr(e,"base58btc"),{keyBuffer:c,type:x}=Oi(Sr(f));return{publicKey:new Uint8Array(c),type:x}}y(rf,"didToPublicKey");function Oi(n){if(Me(n,Sr(Zt)))return{keyBuffer:n.slice(Zt.byteLength),type:Je.RSA};if(Me(n,Sr(Qt)))return{keyBuffer:n.slice(Qt.byteLength),type:Je.Edwards};if(Me(n,Sr(Jt)))return{keyBuffer:n.slice(Jt.byteLength),type:Je.BLS};throw new Error("Unsupported key algorithm. Try using RSA.")}y(Oi,"parseMagicBytes");var Yi={equal:y((n,e)=>{let f=new Uint8Array(n),c=new Uint8Array(e);if(f.length!==c.length)return!1;for(let x=0;x<f.length;x++)if(f[x]!==c[x])return!1;return!0},"equal")};function Me(n,e){return Yi.equal(e,n.slice(0,e.byteLength))}y(Me,"hasPrefix");function Rr(n){return cr(n instanceof ArrayBuffer?new Uint8Array(n):n,"base64pad")}y(Rr,"toBase64");async function Le(n,e){let f=typeof n=="string"?$r(n):Sr(n);return tr.subtle.importKey("raw",f,{name:e?.alg||le,length:e?.length||ie},!0,["encrypt","decrypt"])}y(Le,"importKey");function rt(n,{max:e}={max:255}){if(e<1||e>255)throw Ri;let f=new Uint8Array(n);if(e===255)return tr.getRandomValues(f),f.buffer;let c=0,x=e+1,l=Math.floor(256/x)*x,S=new Uint8Array(1);for(;c<f.length;)tr.getRandomValues(S),S[0]<l&&(f[c]=S[0]%x,c++);return f.buffer}y(rt,"randomBuf");function Fr(n,e){let f=n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(Sr(n)),c=e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(Sr(e)),x=new Uint8Array(f.length+c.length);return x.set(f),x.set(c,f.length),x.buffer}y(Fr,"joinBufs");async function nn(n,e,f,c=!1){let x=c;if(!Object.values(De).includes(f))throw new Error("invalid key use");let l=f==="exchange"?ne:fe,S=f==="exchange"?["encrypt","decrypt"]:["sign","verify"];return tr.subtle.generateKey({name:l,modulusLength:n,publicExponent:ji(),hash:{name:e}},x,S)}y(nn,"makeRSAKeypair");function ji(){return new Uint8Array([1,0,1])}y(ji,"publicExponent");var nf=Ef(tf(),1);var on={keyTypes:{"bls12-381":{magicBytes:new Uint8Array([234,1]),verify:y(()=>{throw new Error("Not implemented")},"verify")},rsa:{magicBytes:new Uint8Array([0,245,2]),verify:Fi},ed25519:{magicBytes:new Uint8Array([237,1]),verify:Hi}}};async function Hi({message:n,publicKey:e,signature:f}){let c=n;typeof n=="string"&&(c=gr(n,"utf8"));let x=f;typeof f=="string"&&(x=gr(f,"base64pad"));let l=e;if(typeof e=="string"&&(l=of(e).publicKey),l.length!==32)throw new Error(`Invalid Ed25519 public key size: ${l.length} bytes, expected 32`);if(x.length!==64)throw new Error(`Invalid Ed25519 signature size: ${x.length} bytes, expected 64`);return nf.default.sign.detached.verify(c,x,l)}y(Hi,"ed25519Verify");async function Fi({message:n,publicKey:e,signature:f}){let c=e;return typeof e=="string"&&(c=of(e).publicKey),Gr.verify(n,f,await tr.subtle.importKey("spki",Sr(c),{name:fe,hash:$t},!1,["verify"]),8)}y(Fi,"rsaVerify");var Gr={verify:y(async function(e,f,c,x=jr,l=de){return tr.subtle.verify({name:fe,saltLength:tn},typeof c=="string"?await Re(c,l,"signing"):c,Qe(f),Zr(e,x))},"rsaVerify"),sign:y(async function(e,f,c=jr){return tr.subtle.sign({name:fe,saltLength:tn},f,Zr(e,c))},"sign"),encrypt:y(async function(e,f,c=jr,x=de){let l;return typeof f=="string"?l=await Re(f,x,"exchange"):l=f instanceof Uint8Array?await Re(Sr(f),x,"exchange"):f,tr.subtle.encrypt({name:ne},l,Zr(e,c))},"rsaEncrypt"),decrypt:y(async function(e,f){let c=be(f)?f:await ki(f,["decrypt"]),x;typeof e=="string"?x=gr(e,"base64pad"):x=e;let l=await tr.subtle.decrypt({name:ne},c,x instanceof Uint8Array?Sr(x):x);return new Uint8Array(l)},"rsaDecrypt")};async function Re(n,e,f){Gi(f);let c=f==="exchange"?ne:fe,x=f==="exchange"?["encrypt"]:["verify"],l=typeof n=="string"?$r(Xi(n)):n;return tr.subtle.importKey("spki",l,{name:c,hash:{name:e}},!0,x)}y(Re,"importPublicKey");function Gi(n){Vi(n,["signing","exchange"],qn)}y(Gi,"checkValidKeyUse");function Vi(n,e,f){if(!e.some(x=>x===n))throw f}y(Vi,"checkValid");function Xi(n){return n.replace(`-----BEGIN PUBLIC KEY-----
1
+ var lf=Object.create;var ve=Object.defineProperty;var gf=Object.getOwnPropertyDescriptor;var bf=Object.getOwnPropertyNames;var Af=Object.getPrototypeOf,mf=Object.prototype.hasOwnProperty;var wf=(n,e,f)=>e in n?ve(n,e,{enumerable:!0,configurable:!0,writable:!0,value:f}):n[e]=f;var y=(n,e)=>ve(n,"name",{value:e,configurable:!0}),Sn=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,f)=>(typeof require<"u"?require:e)[f]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var _n=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Pr=(n,e)=>{for(var f in e)ve(n,f,{get:e[f],enumerable:!0})},Kf=(n,e,f,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let x of bf(e))!mf.call(n,x)&&x!==f&&ve(n,x,{get:()=>e[x],enumerable:!(c=gf(e,x))||c.enumerable});return n};var Ef=(n,e,f)=>(f=n!=null?lf(Af(n)):{},Kf(e||!n||!n.__esModule?ve(f,"default",{value:n,enumerable:!0}):f,n));var O=(n,e,f)=>wf(n,typeof e!="symbol"?e+"":e,f);var rf=_n(()=>{"use strict"});var ef=_n((as,et)=>{"use strict";(function(n){"use strict";var e=y(function(t){var o,i=new Float64Array(16);if(t)for(o=0;o<t.length;o++)i[o]=t[o];return i},"gf"),f=y(function(){throw new Error("no PRNG")},"randombytes"),c=new Uint8Array(16),x=new Uint8Array(32);x[0]=9;var l=e(),S=e([1]),k=e([56129,1]),nr=e([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),Kr=e([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),hr=e([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),Tr=e([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),Xr=e([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function Oe(t,o,i,r){t[o]=i>>24&255,t[o+1]=i>>16&255,t[o+2]=i>>8&255,t[o+3]=i&255,t[o+4]=r>>24&255,t[o+5]=r>>16&255,t[o+6]=r>>8&255,t[o+7]=r&255}y(Oe,"ts64");function rr(t,o,i,r,a){var u,p=0;for(u=0;u<a;u++)p|=t[o+u]^i[r+u];return(1&p-1>>>8)-1}y(rr,"vn");function dr(t,o,i,r){return rr(t,o,i,r,16)}y(dr,"crypto_verify_16");function Dr(t,o,i,r){return rr(t,o,i,r,32)}y(Dr,"crypto_verify_32");function Ur(t,o,i,r){for(var a=r[0]&255|(r[1]&255)<<8|(r[2]&255)<<16|(r[3]&255)<<24,u=i[0]&255|(i[1]&255)<<8|(i[2]&255)<<16|(i[3]&255)<<24,p=i[4]&255|(i[5]&255)<<8|(i[6]&255)<<16|(i[7]&255)<<24,b=i[8]&255|(i[9]&255)<<8|(i[10]&255)<<16|(i[11]&255)<<24,K=i[12]&255|(i[13]&255)<<8|(i[14]&255)<<16|(i[15]&255)<<24,T=r[4]&255|(r[5]&255)<<8|(r[6]&255)<<16|(r[7]&255)<<24,U=o[0]&255|(o[1]&255)<<8|(o[2]&255)<<16|(o[3]&255)<<24,q=o[4]&255|(o[5]&255)<<8|(o[6]&255)<<16|(o[7]&255)<<24,_=o[8]&255|(o[9]&255)<<8|(o[10]&255)<<16|(o[11]&255)<<24,M=o[12]&255|(o[13]&255)<<8|(o[14]&255)<<16|(o[15]&255)<<24,L=r[8]&255|(r[9]&255)<<8|(r[10]&255)<<16|(r[11]&255)<<24,j=i[16]&255|(i[17]&255)<<8|(i[18]&255)<<16|(i[19]&255)<<24,Y=i[20]&255|(i[21]&255)<<8|(i[22]&255)<<16|(i[23]&255)<<24,R=i[24]&255|(i[25]&255)<<8|(i[26]&255)<<16|(i[27]&255)<<24,z=i[28]&255|(i[29]&255)<<8|(i[30]&255)<<16|(i[31]&255)<<24,N=r[12]&255|(r[13]&255)<<8|(r[14]&255)<<16|(r[15]&255)<<24,C=a,D=u,v=p,B=b,P=K,E=T,h=U,d=q,m=_,g=M,A=L,w=j,I=Y,H=R,G=z,F=N,s,X=0;X<20;X+=2)s=C+I|0,P^=s<<7|s>>>25,s=P+C|0,m^=s<<9|s>>>23,s=m+P|0,I^=s<<13|s>>>19,s=I+m|0,C^=s<<18|s>>>14,s=E+D|0,g^=s<<7|s>>>25,s=g+E|0,H^=s<<9|s>>>23,s=H+g|0,D^=s<<13|s>>>19,s=D+H|0,E^=s<<18|s>>>14,s=A+h|0,G^=s<<7|s>>>25,s=G+A|0,v^=s<<9|s>>>23,s=v+G|0,h^=s<<13|s>>>19,s=h+v|0,A^=s<<18|s>>>14,s=F+w|0,B^=s<<7|s>>>25,s=B+F|0,d^=s<<9|s>>>23,s=d+B|0,w^=s<<13|s>>>19,s=w+d|0,F^=s<<18|s>>>14,s=C+B|0,D^=s<<7|s>>>25,s=D+C|0,v^=s<<9|s>>>23,s=v+D|0,B^=s<<13|s>>>19,s=B+v|0,C^=s<<18|s>>>14,s=E+P|0,h^=s<<7|s>>>25,s=h+E|0,d^=s<<9|s>>>23,s=d+h|0,P^=s<<13|s>>>19,s=P+d|0,E^=s<<18|s>>>14,s=A+g|0,w^=s<<7|s>>>25,s=w+A|0,m^=s<<9|s>>>23,s=m+w|0,g^=s<<13|s>>>19,s=g+m|0,A^=s<<18|s>>>14,s=F+G|0,I^=s<<7|s>>>25,s=I+F|0,H^=s<<9|s>>>23,s=H+I|0,G^=s<<13|s>>>19,s=G+H|0,F^=s<<18|s>>>14;C=C+a|0,D=D+u|0,v=v+p|0,B=B+b|0,P=P+K|0,E=E+T|0,h=h+U|0,d=d+q|0,m=m+_|0,g=g+M|0,A=A+L|0,w=w+j|0,I=I+Y|0,H=H+R|0,G=G+z|0,F=F+N|0,t[0]=C>>>0&255,t[1]=C>>>8&255,t[2]=C>>>16&255,t[3]=C>>>24&255,t[4]=D>>>0&255,t[5]=D>>>8&255,t[6]=D>>>16&255,t[7]=D>>>24&255,t[8]=v>>>0&255,t[9]=v>>>8&255,t[10]=v>>>16&255,t[11]=v>>>24&255,t[12]=B>>>0&255,t[13]=B>>>8&255,t[14]=B>>>16&255,t[15]=B>>>24&255,t[16]=P>>>0&255,t[17]=P>>>8&255,t[18]=P>>>16&255,t[19]=P>>>24&255,t[20]=E>>>0&255,t[21]=E>>>8&255,t[22]=E>>>16&255,t[23]=E>>>24&255,t[24]=h>>>0&255,t[25]=h>>>8&255,t[26]=h>>>16&255,t[27]=h>>>24&255,t[28]=d>>>0&255,t[29]=d>>>8&255,t[30]=d>>>16&255,t[31]=d>>>24&255,t[32]=m>>>0&255,t[33]=m>>>8&255,t[34]=m>>>16&255,t[35]=m>>>24&255,t[36]=g>>>0&255,t[37]=g>>>8&255,t[38]=g>>>16&255,t[39]=g>>>24&255,t[40]=A>>>0&255,t[41]=A>>>8&255,t[42]=A>>>16&255,t[43]=A>>>24&255,t[44]=w>>>0&255,t[45]=w>>>8&255,t[46]=w>>>16&255,t[47]=w>>>24&255,t[48]=I>>>0&255,t[49]=I>>>8&255,t[50]=I>>>16&255,t[51]=I>>>24&255,t[52]=H>>>0&255,t[53]=H>>>8&255,t[54]=H>>>16&255,t[55]=H>>>24&255,t[56]=G>>>0&255,t[57]=G>>>8&255,t[58]=G>>>16&255,t[59]=G>>>24&255,t[60]=F>>>0&255,t[61]=F>>>8&255,t[62]=F>>>16&255,t[63]=F>>>24&255}y(Ur,"core_salsa20");function _r(t,o,i,r){for(var a=r[0]&255|(r[1]&255)<<8|(r[2]&255)<<16|(r[3]&255)<<24,u=i[0]&255|(i[1]&255)<<8|(i[2]&255)<<16|(i[3]&255)<<24,p=i[4]&255|(i[5]&255)<<8|(i[6]&255)<<16|(i[7]&255)<<24,b=i[8]&255|(i[9]&255)<<8|(i[10]&255)<<16|(i[11]&255)<<24,K=i[12]&255|(i[13]&255)<<8|(i[14]&255)<<16|(i[15]&255)<<24,T=r[4]&255|(r[5]&255)<<8|(r[6]&255)<<16|(r[7]&255)<<24,U=o[0]&255|(o[1]&255)<<8|(o[2]&255)<<16|(o[3]&255)<<24,q=o[4]&255|(o[5]&255)<<8|(o[6]&255)<<16|(o[7]&255)<<24,_=o[8]&255|(o[9]&255)<<8|(o[10]&255)<<16|(o[11]&255)<<24,M=o[12]&255|(o[13]&255)<<8|(o[14]&255)<<16|(o[15]&255)<<24,L=r[8]&255|(r[9]&255)<<8|(r[10]&255)<<16|(r[11]&255)<<24,j=i[16]&255|(i[17]&255)<<8|(i[18]&255)<<16|(i[19]&255)<<24,Y=i[20]&255|(i[21]&255)<<8|(i[22]&255)<<16|(i[23]&255)<<24,R=i[24]&255|(i[25]&255)<<8|(i[26]&255)<<16|(i[27]&255)<<24,z=i[28]&255|(i[29]&255)<<8|(i[30]&255)<<16|(i[31]&255)<<24,N=r[12]&255|(r[13]&255)<<8|(r[14]&255)<<16|(r[15]&255)<<24,C=a,D=u,v=p,B=b,P=K,E=T,h=U,d=q,m=_,g=M,A=L,w=j,I=Y,H=R,G=z,F=N,s,X=0;X<20;X+=2)s=C+I|0,P^=s<<7|s>>>25,s=P+C|0,m^=s<<9|s>>>23,s=m+P|0,I^=s<<13|s>>>19,s=I+m|0,C^=s<<18|s>>>14,s=E+D|0,g^=s<<7|s>>>25,s=g+E|0,H^=s<<9|s>>>23,s=H+g|0,D^=s<<13|s>>>19,s=D+H|0,E^=s<<18|s>>>14,s=A+h|0,G^=s<<7|s>>>25,s=G+A|0,v^=s<<9|s>>>23,s=v+G|0,h^=s<<13|s>>>19,s=h+v|0,A^=s<<18|s>>>14,s=F+w|0,B^=s<<7|s>>>25,s=B+F|0,d^=s<<9|s>>>23,s=d+B|0,w^=s<<13|s>>>19,s=w+d|0,F^=s<<18|s>>>14,s=C+B|0,D^=s<<7|s>>>25,s=D+C|0,v^=s<<9|s>>>23,s=v+D|0,B^=s<<13|s>>>19,s=B+v|0,C^=s<<18|s>>>14,s=E+P|0,h^=s<<7|s>>>25,s=h+E|0,d^=s<<9|s>>>23,s=d+h|0,P^=s<<13|s>>>19,s=P+d|0,E^=s<<18|s>>>14,s=A+g|0,w^=s<<7|s>>>25,s=w+A|0,m^=s<<9|s>>>23,s=m+w|0,g^=s<<13|s>>>19,s=g+m|0,A^=s<<18|s>>>14,s=F+G|0,I^=s<<7|s>>>25,s=I+F|0,H^=s<<9|s>>>23,s=H+I|0,G^=s<<13|s>>>19,s=G+H|0,F^=s<<18|s>>>14;t[0]=C>>>0&255,t[1]=C>>>8&255,t[2]=C>>>16&255,t[3]=C>>>24&255,t[4]=E>>>0&255,t[5]=E>>>8&255,t[6]=E>>>16&255,t[7]=E>>>24&255,t[8]=A>>>0&255,t[9]=A>>>8&255,t[10]=A>>>16&255,t[11]=A>>>24&255,t[12]=F>>>0&255,t[13]=F>>>8&255,t[14]=F>>>16&255,t[15]=F>>>24&255,t[16]=h>>>0&255,t[17]=h>>>8&255,t[18]=h>>>16&255,t[19]=h>>>24&255,t[20]=d>>>0&255,t[21]=d>>>8&255,t[22]=d>>>16&255,t[23]=d>>>24&255,t[24]=m>>>0&255,t[25]=m>>>8&255,t[26]=m>>>16&255,t[27]=m>>>24&255,t[28]=g>>>0&255,t[29]=g>>>8&255,t[30]=g>>>16&255,t[31]=g>>>24&255}y(_r,"core_hsalsa20");function wr(t,o,i,r){Ur(t,o,i,r)}y(wr,"crypto_core_salsa20");function lr(t,o,i,r){_r(t,o,i,r)}y(lr,"crypto_core_hsalsa20");var ur=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function Ir(t,o,i,r,a,u,p){var b=new Uint8Array(16),K=new Uint8Array(64),T,U;for(U=0;U<16;U++)b[U]=0;for(U=0;U<8;U++)b[U]=u[U];for(;a>=64;){for(wr(K,b,p,ur),U=0;U<64;U++)t[o+U]=i[r+U]^K[U];for(T=1,U=8;U<16;U++)T=T+(b[U]&255)|0,b[U]=T&255,T>>>=8;a-=64,o+=64,r+=64}if(a>0)for(wr(K,b,p,ur),U=0;U<a;U++)t[o+U]=i[r+U]^K[U];return 0}y(Ir,"crypto_stream_salsa20_xor");function Er(t,o,i,r,a){var u=new Uint8Array(16),p=new Uint8Array(64),b,K;for(K=0;K<16;K++)u[K]=0;for(K=0;K<8;K++)u[K]=r[K];for(;i>=64;){for(wr(p,u,a,ur),K=0;K<64;K++)t[o+K]=p[K];for(b=1,K=8;K<16;K++)b=b+(u[K]&255)|0,u[K]=b&255,b>>>=8;i-=64,o+=64}if(i>0)for(wr(p,u,a,ur),K=0;K<i;K++)t[o+K]=p[K];return 0}y(Er,"crypto_stream_salsa20");function Cr(t,o,i,r,a){var u=new Uint8Array(32);lr(u,r,a,ur);for(var p=new Uint8Array(8),b=0;b<8;b++)p[b]=r[b+16];return Er(t,o,i,p,u)}y(Cr,"crypto_stream");function kr(t,o,i,r,a,u,p){var b=new Uint8Array(32);lr(b,u,p,ur);for(var K=new Uint8Array(8),T=0;T<8;T++)K[T]=u[T+16];return Ir(t,o,i,r,a,K,b)}y(kr,"crypto_stream_xor");var Ye=y(function(t){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 o,i,r,a,u,p,b,K;o=t[0]&255|(t[1]&255)<<8,this.r[0]=o&8191,i=t[2]&255|(t[3]&255)<<8,this.r[1]=(o>>>13|i<<3)&8191,r=t[4]&255|(t[5]&255)<<8,this.r[2]=(i>>>10|r<<6)&7939,a=t[6]&255|(t[7]&255)<<8,this.r[3]=(r>>>7|a<<9)&8191,u=t[8]&255|(t[9]&255)<<8,this.r[4]=(a>>>4|u<<12)&255,this.r[5]=u>>>1&8190,p=t[10]&255|(t[11]&255)<<8,this.r[6]=(u>>>14|p<<2)&8191,b=t[12]&255|(t[13]&255)<<8,this.r[7]=(p>>>11|b<<5)&8065,K=t[14]&255|(t[15]&255)<<8,this.r[8]=(b>>>8|K<<8)&8191,this.r[9]=K>>>5&127,this.pad[0]=t[16]&255|(t[17]&255)<<8,this.pad[1]=t[18]&255|(t[19]&255)<<8,this.pad[2]=t[20]&255|(t[21]&255)<<8,this.pad[3]=t[22]&255|(t[23]&255)<<8,this.pad[4]=t[24]&255|(t[25]&255)<<8,this.pad[5]=t[26]&255|(t[27]&255)<<8,this.pad[6]=t[28]&255|(t[29]&255)<<8,this.pad[7]=t[30]&255|(t[31]&255)<<8},"poly1305");Ye.prototype.blocks=function(t,o,i){for(var r=this.fin?0:2048,a,u,p,b,K,T,U,q,_,M,L,j,Y,R,z,N,C,D,v,B=this.h[0],P=this.h[1],E=this.h[2],h=this.h[3],d=this.h[4],m=this.h[5],g=this.h[6],A=this.h[7],w=this.h[8],I=this.h[9],H=this.r[0],G=this.r[1],F=this.r[2],s=this.r[3],X=this.r[4],J=this.r[5],Q=this.r[6],V=this.r[7],$=this.r[8],Z=this.r[9];i>=16;)a=t[o+0]&255|(t[o+1]&255)<<8,B+=a&8191,u=t[o+2]&255|(t[o+3]&255)<<8,P+=(a>>>13|u<<3)&8191,p=t[o+4]&255|(t[o+5]&255)<<8,E+=(u>>>10|p<<6)&8191,b=t[o+6]&255|(t[o+7]&255)<<8,h+=(p>>>7|b<<9)&8191,K=t[o+8]&255|(t[o+9]&255)<<8,d+=(b>>>4|K<<12)&8191,m+=K>>>1&8191,T=t[o+10]&255|(t[o+11]&255)<<8,g+=(K>>>14|T<<2)&8191,U=t[o+12]&255|(t[o+13]&255)<<8,A+=(T>>>11|U<<5)&8191,q=t[o+14]&255|(t[o+15]&255)<<8,w+=(U>>>8|q<<8)&8191,I+=q>>>5|r,_=0,M=_,M+=B*H,M+=P*(5*Z),M+=E*(5*$),M+=h*(5*V),M+=d*(5*Q),_=M>>>13,M&=8191,M+=m*(5*J),M+=g*(5*X),M+=A*(5*s),M+=w*(5*F),M+=I*(5*G),_+=M>>>13,M&=8191,L=_,L+=B*G,L+=P*H,L+=E*(5*Z),L+=h*(5*$),L+=d*(5*V),_=L>>>13,L&=8191,L+=m*(5*Q),L+=g*(5*J),L+=A*(5*X),L+=w*(5*s),L+=I*(5*F),_+=L>>>13,L&=8191,j=_,j+=B*F,j+=P*G,j+=E*H,j+=h*(5*Z),j+=d*(5*$),_=j>>>13,j&=8191,j+=m*(5*V),j+=g*(5*Q),j+=A*(5*J),j+=w*(5*X),j+=I*(5*s),_+=j>>>13,j&=8191,Y=_,Y+=B*s,Y+=P*F,Y+=E*G,Y+=h*H,Y+=d*(5*Z),_=Y>>>13,Y&=8191,Y+=m*(5*$),Y+=g*(5*V),Y+=A*(5*Q),Y+=w*(5*J),Y+=I*(5*X),_+=Y>>>13,Y&=8191,R=_,R+=B*X,R+=P*s,R+=E*F,R+=h*G,R+=d*H,_=R>>>13,R&=8191,R+=m*(5*Z),R+=g*(5*$),R+=A*(5*V),R+=w*(5*Q),R+=I*(5*J),_+=R>>>13,R&=8191,z=_,z+=B*J,z+=P*X,z+=E*s,z+=h*F,z+=d*G,_=z>>>13,z&=8191,z+=m*H,z+=g*(5*Z),z+=A*(5*$),z+=w*(5*V),z+=I*(5*Q),_+=z>>>13,z&=8191,N=_,N+=B*Q,N+=P*J,N+=E*X,N+=h*s,N+=d*F,_=N>>>13,N&=8191,N+=m*G,N+=g*H,N+=A*(5*Z),N+=w*(5*$),N+=I*(5*V),_+=N>>>13,N&=8191,C=_,C+=B*V,C+=P*Q,C+=E*J,C+=h*X,C+=d*s,_=C>>>13,C&=8191,C+=m*F,C+=g*G,C+=A*H,C+=w*(5*Z),C+=I*(5*$),_+=C>>>13,C&=8191,D=_,D+=B*$,D+=P*V,D+=E*Q,D+=h*J,D+=d*X,_=D>>>13,D&=8191,D+=m*s,D+=g*F,D+=A*G,D+=w*H,D+=I*(5*Z),_+=D>>>13,D&=8191,v=_,v+=B*Z,v+=P*$,v+=E*V,v+=h*Q,v+=d*J,_=v>>>13,v&=8191,v+=m*X,v+=g*s,v+=A*F,v+=w*G,v+=I*H,_+=v>>>13,v&=8191,_=(_<<2)+_|0,_=_+M|0,M=_&8191,_=_>>>13,L+=_,B=M,P=L,E=j,h=Y,d=R,m=z,g=N,A=C,w=D,I=v,o+=16,i-=16;this.h[0]=B,this.h[1]=P,this.h[2]=E,this.h[3]=h,this.h[4]=d,this.h[5]=m,this.h[6]=g,this.h[7]=A,this.h[8]=w,this.h[9]=I},Ye.prototype.finish=function(t,o){var i=new Uint16Array(10),r,a,u,p;if(this.leftover){for(p=this.leftover,this.buffer[p++]=1;p<16;p++)this.buffer[p]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,p=2;p<10;p++)this.h[p]+=r,r=this.h[p]>>>13,this.h[p]&=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,i[0]=this.h[0]+5,r=i[0]>>>13,i[0]&=8191,p=1;p<10;p++)i[p]=this.h[p]+r,r=i[p]>>>13,i[p]&=8191;for(i[9]-=8192,a=(r^1)-1,p=0;p<10;p++)i[p]&=a;for(a=~a,p=0;p<10;p++)this.h[p]=this.h[p]&a|i[p];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,u=this.h[0]+this.pad[0],this.h[0]=u&65535,p=1;p<8;p++)u=(this.h[p]+this.pad[p]|0)+(u>>>16)|0,this.h[p]=u&65535;t[o+0]=this.h[0]>>>0&255,t[o+1]=this.h[0]>>>8&255,t[o+2]=this.h[1]>>>0&255,t[o+3]=this.h[1]>>>8&255,t[o+4]=this.h[2]>>>0&255,t[o+5]=this.h[2]>>>8&255,t[o+6]=this.h[3]>>>0&255,t[o+7]=this.h[3]>>>8&255,t[o+8]=this.h[4]>>>0&255,t[o+9]=this.h[4]>>>8&255,t[o+10]=this.h[5]>>>0&255,t[o+11]=this.h[5]>>>8&255,t[o+12]=this.h[6]>>>0&255,t[o+13]=this.h[6]>>>8&255,t[o+14]=this.h[7]>>>0&255,t[o+15]=this.h[7]>>>8&255},Ye.prototype.update=function(t,o,i){var r,a;if(this.leftover){for(a=16-this.leftover,a>i&&(a=i),r=0;r<a;r++)this.buffer[this.leftover+r]=t[o+r];if(i-=a,o+=a,this.leftover+=a,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(i>=16&&(a=i-i%16,this.blocks(t,o,a),o+=a,i-=a),i){for(r=0;r<i;r++)this.buffer[this.leftover+r]=t[o+r];this.leftover+=i}};function it(t,o,i,r,a,u){var p=new Ye(u);return p.update(i,r,a),p.finish(t,o),0}y(it,"crypto_onetimeauth");function un(t,o,i,r,a,u){var p=new Uint8Array(16);return it(p,0,i,r,a,u),dr(t,o,p,0)}y(un,"crypto_onetimeauth_verify");function ot(t,o,i,r,a){var u;if(i<32)return-1;for(kr(t,0,o,0,i,r,a),it(t,16,t,32,i-32,t),u=0;u<16;u++)t[u]=0;return 0}y(ot,"crypto_secretbox");function at(t,o,i,r,a){var u,p=new Uint8Array(32);if(i<32||(Cr(p,0,32,r,a),un(o,16,o,32,i-32,p)!==0))return-1;for(kr(t,0,o,0,i,r,a),u=0;u<32;u++)t[u]=0;return 0}y(at,"crypto_secretbox_open");function zr(t,o){var i;for(i=0;i<16;i++)t[i]=o[i]|0}y(zr,"set25519");function st(t){var o,i,r=1;for(o=0;o<16;o++)i=t[o]+r+65535,r=Math.floor(i/65536),t[o]=i-r*65536;t[0]+=r-1+37*(r-1)}y(st,"car25519");function oe(t,o,i){for(var r,a=~(i-1),u=0;u<16;u++)r=a&(t[u]^o[u]),t[u]^=r,o[u]^=r}y(oe,"sel25519");function ae(t,o){var i,r,a,u=e(),p=e();for(i=0;i<16;i++)p[i]=o[i];for(st(p),st(p),st(p),r=0;r<2;r++){for(u[0]=p[0]-65517,i=1;i<15;i++)u[i]=p[i]-65535-(u[i-1]>>16&1),u[i-1]&=65535;u[15]=p[15]-32767-(u[14]>>16&1),a=u[15]>>16&1,u[14]&=65535,oe(p,u,1-a)}for(i=0;i<16;i++)t[2*i]=p[i]&255,t[2*i+1]=p[i]>>8}y(ae,"pack25519");function pn(t,o){var i=new Uint8Array(32),r=new Uint8Array(32);return ae(i,t),ae(r,o),Dr(i,0,r,0)}y(pn,"neq25519");function hn(t){var o=new Uint8Array(32);return ae(o,t),o[0]&1}y(hn,"par25519");function ct(t,o){var i;for(i=0;i<16;i++)t[i]=o[2*i]+(o[2*i+1]<<8);t[15]&=32767}y(ct,"unpack25519");function Mr(t,o,i){for(var r=0;r<16;r++)t[r]=o[r]+i[r]}y(Mr,"A");function Lr(t,o,i){for(var r=0;r<16;r++)t[r]=o[r]-i[r]}y(Lr,"Z");function W(t,o,i){var r,a,u=0,p=0,b=0,K=0,T=0,U=0,q=0,_=0,M=0,L=0,j=0,Y=0,R=0,z=0,N=0,C=0,D=0,v=0,B=0,P=0,E=0,h=0,d=0,m=0,g=0,A=0,w=0,I=0,H=0,G=0,F=0,s=i[0],X=i[1],J=i[2],Q=i[3],V=i[4],$=i[5],Z=i[6],sr=i[7],er=i[8],fr=i[9],ir=i[10],or=i[11],xr=i[12],br=i[13],Ar=i[14],mr=i[15];r=o[0],u+=r*s,p+=r*X,b+=r*J,K+=r*Q,T+=r*V,U+=r*$,q+=r*Z,_+=r*sr,M+=r*er,L+=r*fr,j+=r*ir,Y+=r*or,R+=r*xr,z+=r*br,N+=r*Ar,C+=r*mr,r=o[1],p+=r*s,b+=r*X,K+=r*J,T+=r*Q,U+=r*V,q+=r*$,_+=r*Z,M+=r*sr,L+=r*er,j+=r*fr,Y+=r*ir,R+=r*or,z+=r*xr,N+=r*br,C+=r*Ar,D+=r*mr,r=o[2],b+=r*s,K+=r*X,T+=r*J,U+=r*Q,q+=r*V,_+=r*$,M+=r*Z,L+=r*sr,j+=r*er,Y+=r*fr,R+=r*ir,z+=r*or,N+=r*xr,C+=r*br,D+=r*Ar,v+=r*mr,r=o[3],K+=r*s,T+=r*X,U+=r*J,q+=r*Q,_+=r*V,M+=r*$,L+=r*Z,j+=r*sr,Y+=r*er,R+=r*fr,z+=r*ir,N+=r*or,C+=r*xr,D+=r*br,v+=r*Ar,B+=r*mr,r=o[4],T+=r*s,U+=r*X,q+=r*J,_+=r*Q,M+=r*V,L+=r*$,j+=r*Z,Y+=r*sr,R+=r*er,z+=r*fr,N+=r*ir,C+=r*or,D+=r*xr,v+=r*br,B+=r*Ar,P+=r*mr,r=o[5],U+=r*s,q+=r*X,_+=r*J,M+=r*Q,L+=r*V,j+=r*$,Y+=r*Z,R+=r*sr,z+=r*er,N+=r*fr,C+=r*ir,D+=r*or,v+=r*xr,B+=r*br,P+=r*Ar,E+=r*mr,r=o[6],q+=r*s,_+=r*X,M+=r*J,L+=r*Q,j+=r*V,Y+=r*$,R+=r*Z,z+=r*sr,N+=r*er,C+=r*fr,D+=r*ir,v+=r*or,B+=r*xr,P+=r*br,E+=r*Ar,h+=r*mr,r=o[7],_+=r*s,M+=r*X,L+=r*J,j+=r*Q,Y+=r*V,R+=r*$,z+=r*Z,N+=r*sr,C+=r*er,D+=r*fr,v+=r*ir,B+=r*or,P+=r*xr,E+=r*br,h+=r*Ar,d+=r*mr,r=o[8],M+=r*s,L+=r*X,j+=r*J,Y+=r*Q,R+=r*V,z+=r*$,N+=r*Z,C+=r*sr,D+=r*er,v+=r*fr,B+=r*ir,P+=r*or,E+=r*xr,h+=r*br,d+=r*Ar,m+=r*mr,r=o[9],L+=r*s,j+=r*X,Y+=r*J,R+=r*Q,z+=r*V,N+=r*$,C+=r*Z,D+=r*sr,v+=r*er,B+=r*fr,P+=r*ir,E+=r*or,h+=r*xr,d+=r*br,m+=r*Ar,g+=r*mr,r=o[10],j+=r*s,Y+=r*X,R+=r*J,z+=r*Q,N+=r*V,C+=r*$,D+=r*Z,v+=r*sr,B+=r*er,P+=r*fr,E+=r*ir,h+=r*or,d+=r*xr,m+=r*br,g+=r*Ar,A+=r*mr,r=o[11],Y+=r*s,R+=r*X,z+=r*J,N+=r*Q,C+=r*V,D+=r*$,v+=r*Z,B+=r*sr,P+=r*er,E+=r*fr,h+=r*ir,d+=r*or,m+=r*xr,g+=r*br,A+=r*Ar,w+=r*mr,r=o[12],R+=r*s,z+=r*X,N+=r*J,C+=r*Q,D+=r*V,v+=r*$,B+=r*Z,P+=r*sr,E+=r*er,h+=r*fr,d+=r*ir,m+=r*or,g+=r*xr,A+=r*br,w+=r*Ar,I+=r*mr,r=o[13],z+=r*s,N+=r*X,C+=r*J,D+=r*Q,v+=r*V,B+=r*$,P+=r*Z,E+=r*sr,h+=r*er,d+=r*fr,m+=r*ir,g+=r*or,A+=r*xr,w+=r*br,I+=r*Ar,H+=r*mr,r=o[14],N+=r*s,C+=r*X,D+=r*J,v+=r*Q,B+=r*V,P+=r*$,E+=r*Z,h+=r*sr,d+=r*er,m+=r*fr,g+=r*ir,A+=r*or,w+=r*xr,I+=r*br,H+=r*Ar,G+=r*mr,r=o[15],C+=r*s,D+=r*X,v+=r*J,B+=r*Q,P+=r*V,E+=r*$,h+=r*Z,d+=r*sr,m+=r*er,g+=r*fr,A+=r*ir,w+=r*or,I+=r*xr,H+=r*br,G+=r*Ar,F+=r*mr,u+=38*D,p+=38*v,b+=38*B,K+=38*P,T+=38*E,U+=38*h,q+=38*d,_+=38*m,M+=38*g,L+=38*A,j+=38*w,Y+=38*I,R+=38*H,z+=38*G,N+=38*F,a=1,r=u+a+65535,a=Math.floor(r/65536),u=r-a*65536,r=p+a+65535,a=Math.floor(r/65536),p=r-a*65536,r=b+a+65535,a=Math.floor(r/65536),b=r-a*65536,r=K+a+65535,a=Math.floor(r/65536),K=r-a*65536,r=T+a+65535,a=Math.floor(r/65536),T=r-a*65536,r=U+a+65535,a=Math.floor(r/65536),U=r-a*65536,r=q+a+65535,a=Math.floor(r/65536),q=r-a*65536,r=_+a+65535,a=Math.floor(r/65536),_=r-a*65536,r=M+a+65535,a=Math.floor(r/65536),M=r-a*65536,r=L+a+65535,a=Math.floor(r/65536),L=r-a*65536,r=j+a+65535,a=Math.floor(r/65536),j=r-a*65536,r=Y+a+65535,a=Math.floor(r/65536),Y=r-a*65536,r=R+a+65535,a=Math.floor(r/65536),R=r-a*65536,r=z+a+65535,a=Math.floor(r/65536),z=r-a*65536,r=N+a+65535,a=Math.floor(r/65536),N=r-a*65536,r=C+a+65535,a=Math.floor(r/65536),C=r-a*65536,u+=a-1+37*(a-1),a=1,r=u+a+65535,a=Math.floor(r/65536),u=r-a*65536,r=p+a+65535,a=Math.floor(r/65536),p=r-a*65536,r=b+a+65535,a=Math.floor(r/65536),b=r-a*65536,r=K+a+65535,a=Math.floor(r/65536),K=r-a*65536,r=T+a+65535,a=Math.floor(r/65536),T=r-a*65536,r=U+a+65535,a=Math.floor(r/65536),U=r-a*65536,r=q+a+65535,a=Math.floor(r/65536),q=r-a*65536,r=_+a+65535,a=Math.floor(r/65536),_=r-a*65536,r=M+a+65535,a=Math.floor(r/65536),M=r-a*65536,r=L+a+65535,a=Math.floor(r/65536),L=r-a*65536,r=j+a+65535,a=Math.floor(r/65536),j=r-a*65536,r=Y+a+65535,a=Math.floor(r/65536),Y=r-a*65536,r=R+a+65535,a=Math.floor(r/65536),R=r-a*65536,r=z+a+65535,a=Math.floor(r/65536),z=r-a*65536,r=N+a+65535,a=Math.floor(r/65536),N=r-a*65536,r=C+a+65535,a=Math.floor(r/65536),C=r-a*65536,u+=a-1+37*(a-1),t[0]=u,t[1]=p,t[2]=b,t[3]=K,t[4]=T,t[5]=U,t[6]=q,t[7]=_,t[8]=M,t[9]=L,t[10]=j,t[11]=Y,t[12]=R,t[13]=z,t[14]=N,t[15]=C}y(W,"M");function Br(t,o){W(t,o,o)}y(Br,"S");function dn(t,o){var i=e(),r;for(r=0;r<16;r++)i[r]=o[r];for(r=253;r>=0;r--)Br(i,i),r!==2&&r!==4&&W(i,i,o);for(r=0;r<16;r++)t[r]=i[r]}y(dn,"inv25519");function ln(t,o){var i=e(),r;for(r=0;r<16;r++)i[r]=o[r];for(r=250;r>=0;r--)Br(i,i),r!==1&&W(i,i,o);for(r=0;r<16;r++)t[r]=i[r]}y(ln,"pow2523");function je(t,o,i){var r=new Uint8Array(32),a=new Float64Array(80),u,p,b=e(),K=e(),T=e(),U=e(),q=e(),_=e();for(p=0;p<31;p++)r[p]=o[p];for(r[31]=o[31]&127|64,r[0]&=248,ct(a,i),p=0;p<16;p++)K[p]=a[p],U[p]=b[p]=T[p]=0;for(b[0]=U[0]=1,p=254;p>=0;--p)u=r[p>>>3]>>>(p&7)&1,oe(b,K,u),oe(T,U,u),Mr(q,b,T),Lr(b,b,T),Mr(T,K,U),Lr(K,K,U),Br(U,q),Br(_,b),W(b,T,b),W(T,K,q),Mr(q,b,T),Lr(b,b,T),Br(K,b),Lr(T,U,_),W(b,T,k),Mr(b,b,U),W(T,T,b),W(b,U,_),W(U,K,a),Br(K,q),oe(b,K,u),oe(T,U,u);for(p=0;p<16;p++)a[p+16]=b[p],a[p+32]=T[p],a[p+48]=K[p],a[p+64]=U[p];var M=a.subarray(32),L=a.subarray(16);return dn(M,M),W(L,L,M),ae(t,L),0}y(je,"crypto_scalarmult");function He(t,o){return je(t,o,x)}y(He,"crypto_scalarmult_base");function gn(t,o){return f(o,32),He(t,o)}y(gn,"crypto_box_keypair");function Fe(t,o,i){var r=new Uint8Array(32);return je(r,i,o),lr(t,c,r,ur)}y(Fe,"crypto_box_beforenm");var bn=ot,cf=at;function yf(t,o,i,r,a,u){var p=new Uint8Array(32);return Fe(p,a,u),bn(t,o,i,r,p)}y(yf,"crypto_box");function xf(t,o,i,r,a,u){var p=new Uint8Array(32);return Fe(p,a,u),cf(t,o,i,r,p)}y(xf,"crypto_box_open");var An=[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 mn(t,o,i,r){for(var a=new Int32Array(16),u=new Int32Array(16),p,b,K,T,U,q,_,M,L,j,Y,R,z,N,C,D,v,B,P,E,h,d,m,g,A,w,I=t[0],H=t[1],G=t[2],F=t[3],s=t[4],X=t[5],J=t[6],Q=t[7],V=o[0],$=o[1],Z=o[2],sr=o[3],er=o[4],fr=o[5],ir=o[6],or=o[7],xr=0;r>=128;){for(P=0;P<16;P++)E=8*P+xr,a[P]=i[E+0]<<24|i[E+1]<<16|i[E+2]<<8|i[E+3],u[P]=i[E+4]<<24|i[E+5]<<16|i[E+6]<<8|i[E+7];for(P=0;P<80;P++)if(p=I,b=H,K=G,T=F,U=s,q=X,_=J,M=Q,L=V,j=$,Y=Z,R=sr,z=er,N=fr,C=ir,D=or,h=Q,d=or,m=d&65535,g=d>>>16,A=h&65535,w=h>>>16,h=(s>>>14|er<<18)^(s>>>18|er<<14)^(er>>>9|s<<23),d=(er>>>14|s<<18)^(er>>>18|s<<14)^(s>>>9|er<<23),m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,h=s&X^~s&J,d=er&fr^~er&ir,m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,h=An[P*2],d=An[P*2+1],m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,h=a[P%16],d=u[P%16],m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,g+=m>>>16,A+=g>>>16,w+=A>>>16,v=A&65535|w<<16,B=m&65535|g<<16,h=v,d=B,m=d&65535,g=d>>>16,A=h&65535,w=h>>>16,h=(I>>>28|V<<4)^(V>>>2|I<<30)^(V>>>7|I<<25),d=(V>>>28|I<<4)^(I>>>2|V<<30)^(I>>>7|V<<25),m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,h=I&H^I&G^H&G,d=V&$^V&Z^$&Z,m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,g+=m>>>16,A+=g>>>16,w+=A>>>16,M=A&65535|w<<16,D=m&65535|g<<16,h=T,d=R,m=d&65535,g=d>>>16,A=h&65535,w=h>>>16,h=v,d=B,m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,g+=m>>>16,A+=g>>>16,w+=A>>>16,T=A&65535|w<<16,R=m&65535|g<<16,H=p,G=b,F=K,s=T,X=U,J=q,Q=_,I=M,$=L,Z=j,sr=Y,er=R,fr=z,ir=N,or=C,V=D,P%16===15)for(E=0;E<16;E++)h=a[E],d=u[E],m=d&65535,g=d>>>16,A=h&65535,w=h>>>16,h=a[(E+9)%16],d=u[(E+9)%16],m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,v=a[(E+1)%16],B=u[(E+1)%16],h=(v>>>1|B<<31)^(v>>>8|B<<24)^v>>>7,d=(B>>>1|v<<31)^(B>>>8|v<<24)^(B>>>7|v<<25),m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,v=a[(E+14)%16],B=u[(E+14)%16],h=(v>>>19|B<<13)^(B>>>29|v<<3)^v>>>6,d=(B>>>19|v<<13)^(v>>>29|B<<3)^(B>>>6|v<<26),m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,g+=m>>>16,A+=g>>>16,w+=A>>>16,a[E]=A&65535|w<<16,u[E]=m&65535|g<<16;h=I,d=V,m=d&65535,g=d>>>16,A=h&65535,w=h>>>16,h=t[0],d=o[0],m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,g+=m>>>16,A+=g>>>16,w+=A>>>16,t[0]=I=A&65535|w<<16,o[0]=V=m&65535|g<<16,h=H,d=$,m=d&65535,g=d>>>16,A=h&65535,w=h>>>16,h=t[1],d=o[1],m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,g+=m>>>16,A+=g>>>16,w+=A>>>16,t[1]=H=A&65535|w<<16,o[1]=$=m&65535|g<<16,h=G,d=Z,m=d&65535,g=d>>>16,A=h&65535,w=h>>>16,h=t[2],d=o[2],m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,g+=m>>>16,A+=g>>>16,w+=A>>>16,t[2]=G=A&65535|w<<16,o[2]=Z=m&65535|g<<16,h=F,d=sr,m=d&65535,g=d>>>16,A=h&65535,w=h>>>16,h=t[3],d=o[3],m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,g+=m>>>16,A+=g>>>16,w+=A>>>16,t[3]=F=A&65535|w<<16,o[3]=sr=m&65535|g<<16,h=s,d=er,m=d&65535,g=d>>>16,A=h&65535,w=h>>>16,h=t[4],d=o[4],m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,g+=m>>>16,A+=g>>>16,w+=A>>>16,t[4]=s=A&65535|w<<16,o[4]=er=m&65535|g<<16,h=X,d=fr,m=d&65535,g=d>>>16,A=h&65535,w=h>>>16,h=t[5],d=o[5],m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,g+=m>>>16,A+=g>>>16,w+=A>>>16,t[5]=X=A&65535|w<<16,o[5]=fr=m&65535|g<<16,h=J,d=ir,m=d&65535,g=d>>>16,A=h&65535,w=h>>>16,h=t[6],d=o[6],m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,g+=m>>>16,A+=g>>>16,w+=A>>>16,t[6]=J=A&65535|w<<16,o[6]=ir=m&65535|g<<16,h=Q,d=or,m=d&65535,g=d>>>16,A=h&65535,w=h>>>16,h=t[7],d=o[7],m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,g+=m>>>16,A+=g>>>16,w+=A>>>16,t[7]=Q=A&65535|w<<16,o[7]=or=m&65535|g<<16,xr+=128,r-=128}return r}y(mn,"crypto_hashblocks_hl");function Qr(t,o,i){var r=new Int32Array(8),a=new Int32Array(8),u=new Uint8Array(256),p,b=i;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,a[0]=4089235720,a[1]=2227873595,a[2]=4271175723,a[3]=1595750129,a[4]=2917565137,a[5]=725511199,a[6]=4215389547,a[7]=327033209,mn(r,a,o,i),i%=128,p=0;p<i;p++)u[p]=o[b-i+p];for(u[i]=128,i=256-128*(i<112?1:0),u[i-9]=0,Oe(u,i-8,b/536870912|0,b<<3),mn(r,a,u,i),p=0;p<8;p++)Oe(t,8*p,r[p],a[p]);return 0}y(Qr,"crypto_hash");function Ge(t,o){var i=e(),r=e(),a=e(),u=e(),p=e(),b=e(),K=e(),T=e(),U=e();Lr(i,t[1],t[0]),Lr(U,o[1],o[0]),W(i,i,U),Mr(r,t[0],t[1]),Mr(U,o[0],o[1]),W(r,r,U),W(a,t[3],o[3]),W(a,a,Kr),W(u,t[2],o[2]),Mr(u,u,u),Lr(p,r,i),Lr(b,u,a),Mr(K,u,a),Mr(T,r,i),W(t[0],p,b),W(t[1],T,K),W(t[2],K,b),W(t[3],p,T)}y(Ge,"add");function wn(t,o,i){var r;for(r=0;r<4;r++)oe(t[r],o[r],i)}y(wn,"cswap");function yt(t,o){var i=e(),r=e(),a=e();dn(a,o[2]),W(i,o[0],a),W(r,o[1],a),ae(t,r),t[31]^=hn(i)<<7}y(yt,"pack");function xt(t,o,i){var r,a;for(zr(t[0],l),zr(t[1],S),zr(t[2],S),zr(t[3],l),a=255;a>=0;--a)r=i[a/8|0]>>(a&7)&1,wn(t,o,r),Ge(o,t),Ge(t,t),wn(t,o,r)}y(xt,"scalarmult");function Ve(t,o){var i=[e(),e(),e(),e()];zr(i[0],hr),zr(i[1],Tr),zr(i[2],S),W(i[3],hr,Tr),xt(t,i,o)}y(Ve,"scalarbase");function ut(t,o,i){var r=new Uint8Array(64),a=[e(),e(),e(),e()],u;for(i||f(o,32),Qr(r,o,32),r[0]&=248,r[31]&=127,r[31]|=64,Ve(a,r),yt(t,a),u=0;u<32;u++)o[u+32]=t[u];return 0}y(ut,"crypto_sign_keypair");var Xe=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 pt(t,o){var i,r,a,u;for(r=63;r>=32;--r){for(i=0,a=r-32,u=r-12;a<u;++a)o[a]+=i-16*o[r]*Xe[a-(r-32)],i=Math.floor((o[a]+128)/256),o[a]-=i*256;o[a]+=i,o[r]=0}for(i=0,a=0;a<32;a++)o[a]+=i-(o[31]>>4)*Xe[a],i=o[a]>>8,o[a]&=255;for(a=0;a<32;a++)o[a]-=i*Xe[a];for(r=0;r<32;r++)o[r+1]+=o[r]>>8,t[r]=o[r]&255}y(pt,"modL");function ht(t){var o=new Float64Array(64),i;for(i=0;i<64;i++)o[i]=t[i];for(i=0;i<64;i++)t[i]=0;pt(t,o)}y(ht,"reduce");function Kn(t,o,i,r){var a=new Uint8Array(64),u=new Uint8Array(64),p=new Uint8Array(64),b,K,T=new Float64Array(64),U=[e(),e(),e(),e()];Qr(a,r,32),a[0]&=248,a[31]&=127,a[31]|=64;var q=i+64;for(b=0;b<i;b++)t[64+b]=o[b];for(b=0;b<32;b++)t[32+b]=a[32+b];for(Qr(p,t.subarray(32),i+32),ht(p),Ve(U,p),yt(t,U),b=32;b<64;b++)t[b]=r[b];for(Qr(u,t,i+64),ht(u),b=0;b<64;b++)T[b]=0;for(b=0;b<32;b++)T[b]=p[b];for(b=0;b<32;b++)for(K=0;K<32;K++)T[b+K]+=u[b]*a[K];return pt(t.subarray(32),T),q}y(Kn,"crypto_sign");function uf(t,o){var i=e(),r=e(),a=e(),u=e(),p=e(),b=e(),K=e();return zr(t[2],S),ct(t[1],o),Br(a,t[1]),W(u,a,nr),Lr(a,a,t[2]),Mr(u,t[2],u),Br(p,u),Br(b,p),W(K,b,p),W(i,K,a),W(i,i,u),ln(i,i),W(i,i,a),W(i,i,u),W(i,i,u),W(t[0],i,u),Br(r,t[0]),W(r,r,u),pn(r,a)&&W(t[0],t[0],Xr),Br(r,t[0]),W(r,r,u),pn(r,a)?-1:(hn(t[0])===o[31]>>7&&Lr(t[0],l,t[0]),W(t[3],t[0],t[1]),0)}y(uf,"unpackneg");function dt(t,o,i,r){var a,u=new Uint8Array(32),p=new Uint8Array(64),b=[e(),e(),e(),e()],K=[e(),e(),e(),e()];if(i<64||uf(K,r))return-1;for(a=0;a<i;a++)t[a]=o[a];for(a=0;a<32;a++)t[a+32]=r[a];if(Qr(p,t,i),ht(p),xt(b,K,p),Ve(K,o.subarray(32)),Ge(b,K),yt(u,b),i-=64,Dr(o,0,u,0)){for(a=0;a<i;a++)t[a]=0;return-1}for(a=0;a<i;a++)t[a]=o[a+64];return i}y(dt,"crypto_sign_open");var lt=32,ke=24,we=32,se=16,Ke=32,We=32,Ee=32,Ue=32,gt=32,En=ke,pf=we,hf=se,Or=64,re=32,ce=64,bt=32,At=64;n.lowlevel={crypto_core_hsalsa20:lr,crypto_stream_xor:kr,crypto_stream:Cr,crypto_stream_salsa20_xor:Ir,crypto_stream_salsa20:Er,crypto_onetimeauth:it,crypto_onetimeauth_verify:un,crypto_verify_16:dr,crypto_verify_32:Dr,crypto_secretbox:ot,crypto_secretbox_open:at,crypto_scalarmult:je,crypto_scalarmult_base:He,crypto_box_beforenm:Fe,crypto_box_afternm:bn,crypto_box:yf,crypto_box_open:xf,crypto_box_keypair:gn,crypto_hash:Qr,crypto_sign:Kn,crypto_sign_keypair:ut,crypto_sign_open:dt,crypto_secretbox_KEYBYTES:lt,crypto_secretbox_NONCEBYTES:ke,crypto_secretbox_ZEROBYTES:we,crypto_secretbox_BOXZEROBYTES:se,crypto_scalarmult_BYTES:Ke,crypto_scalarmult_SCALARBYTES:We,crypto_box_PUBLICKEYBYTES:Ee,crypto_box_SECRETKEYBYTES:Ue,crypto_box_BEFORENMBYTES:gt,crypto_box_NONCEBYTES:En,crypto_box_ZEROBYTES:pf,crypto_box_BOXZEROBYTES:hf,crypto_sign_BYTES:Or,crypto_sign_PUBLICKEYBYTES:re,crypto_sign_SECRETKEYBYTES:ce,crypto_sign_SEEDBYTES:bt,crypto_hash_BYTES:At,gf:e,D:nr,L:Xe,pack25519:ae,unpack25519:ct,M:W,A:Mr,S:Br,Z:Lr,pow2523:ln,add:Ge,set25519:zr,modL:pt,scalarmult:xt,scalarbase:Ve};function Un(t,o){if(t.length!==lt)throw new Error("bad key size");if(o.length!==ke)throw new Error("bad nonce size")}y(Un,"checkLengths");function df(t,o){if(t.length!==Ee)throw new Error("bad public key size");if(o.length!==Ue)throw new Error("bad secret key size")}y(df,"checkBoxLengths");function vr(){for(var t=0;t<arguments.length;t++)if(!(arguments[t]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}y(vr,"checkArrayTypes");function vn(t){for(var o=0;o<t.length;o++)t[o]=0}y(vn,"cleanup"),n.randomBytes=function(t){var o=new Uint8Array(t);return f(o,t),o},n.secretbox=function(t,o,i){vr(t,o,i),Un(i,o);for(var r=new Uint8Array(we+t.length),a=new Uint8Array(r.length),u=0;u<t.length;u++)r[u+we]=t[u];return ot(a,r,r.length,o,i),a.subarray(se)},n.secretbox.open=function(t,o,i){vr(t,o,i),Un(i,o);for(var r=new Uint8Array(se+t.length),a=new Uint8Array(r.length),u=0;u<t.length;u++)r[u+se]=t[u];return r.length<32||at(a,r,r.length,o,i)!==0?null:a.subarray(we)},n.secretbox.keyLength=lt,n.secretbox.nonceLength=ke,n.secretbox.overheadLength=se,n.scalarMult=function(t,o){if(vr(t,o),t.length!==We)throw new Error("bad n size");if(o.length!==Ke)throw new Error("bad p size");var i=new Uint8Array(Ke);return je(i,t,o),i},n.scalarMult.base=function(t){if(vr(t),t.length!==We)throw new Error("bad n size");var o=new Uint8Array(Ke);return He(o,t),o},n.scalarMult.scalarLength=We,n.scalarMult.groupElementLength=Ke,n.box=function(t,o,i,r){var a=n.box.before(i,r);return n.secretbox(t,o,a)},n.box.before=function(t,o){vr(t,o),df(t,o);var i=new Uint8Array(gt);return Fe(i,t,o),i},n.box.after=n.secretbox,n.box.open=function(t,o,i,r){var a=n.box.before(i,r);return n.secretbox.open(t,o,a)},n.box.open.after=n.secretbox.open,n.box.keyPair=function(){var t=new Uint8Array(Ee),o=new Uint8Array(Ue);return gn(t,o),{publicKey:t,secretKey:o}},n.box.keyPair.fromSecretKey=function(t){if(vr(t),t.length!==Ue)throw new Error("bad secret key size");var o=new Uint8Array(Ee);return He(o,t),{publicKey:o,secretKey:new Uint8Array(t)}},n.box.publicKeyLength=Ee,n.box.secretKeyLength=Ue,n.box.sharedKeyLength=gt,n.box.nonceLength=En,n.box.overheadLength=n.secretbox.overheadLength,n.sign=function(t,o){if(vr(t,o),o.length!==ce)throw new Error("bad secret key size");var i=new Uint8Array(Or+t.length);return Kn(i,t,t.length,o),i},n.sign.open=function(t,o){if(vr(t,o),o.length!==re)throw new Error("bad public key size");var i=new Uint8Array(t.length),r=dt(i,t,t.length,o);if(r<0)return null;for(var a=new Uint8Array(r),u=0;u<a.length;u++)a[u]=i[u];return a},n.sign.detached=function(t,o){for(var i=n.sign(t,o),r=new Uint8Array(Or),a=0;a<r.length;a++)r[a]=i[a];return r},n.sign.detached.verify=function(t,o,i){if(vr(t,o,i),o.length!==Or)throw new Error("bad signature size");if(i.length!==re)throw new Error("bad public key size");var r=new Uint8Array(Or+t.length),a=new Uint8Array(Or+t.length),u;for(u=0;u<Or;u++)r[u]=o[u];for(u=0;u<t.length;u++)r[u+Or]=t[u];return dt(a,r,r.length,i)>=0},n.sign.keyPair=function(){var t=new Uint8Array(re),o=new Uint8Array(ce);return ut(t,o),{publicKey:t,secretKey:o}},n.sign.keyPair.fromSecretKey=function(t){if(vr(t),t.length!==ce)throw new Error("bad secret key size");for(var o=new Uint8Array(re),i=0;i<o.length;i++)o[i]=t[32+i];return{publicKey:o,secretKey:new Uint8Array(t)}},n.sign.keyPair.fromSeed=function(t){if(vr(t),t.length!==bt)throw new Error("bad seed size");for(var o=new Uint8Array(re),i=new Uint8Array(ce),r=0;r<32;r++)i[r]=t[r];return ut(o,i,!0),{publicKey:o,secretKey:i}},n.sign.publicKeyLength=re,n.sign.secretKeyLength=ce,n.sign.seedLength=bt,n.sign.signatureLength=Or,n.hash=function(t){vr(t);var o=new Uint8Array(At);return Qr(o,t,t.length),o},n.hash.hashLength=At,n.verify=function(t,o){return vr(t,o),t.length===0||o.length===0||t.length!==o.length?!1:rr(t,0,o,0,t.length)===0},n.setPRNG=function(t){f=t},function(){var t=typeof self<"u"?self.crypto||self.msCrypto:null;if(t&&t.getRandomValues){var o=65536;n.setPRNG(function(i,r){var a,u=new Uint8Array(r);for(a=0;a<r;a+=o)t.getRandomValues(u.subarray(a,a+Math.min(r-a,o)));for(a=0;a<r;a++)i[a]=u[a];vn(u)})}else typeof Sn<"u"&&(t=rf(),t&&t.randomBytes&&n.setPRNG(function(i,r){var a,u=t.randomBytes(r);for(a=0;a<r;a++)i[a]=u[a];vn(u)}))}()})(typeof et<"u"&&et.exports?et.exports:self.nacl=self.nacl||{})});var Uf=globalThis||window||self,tr=Uf.crypto;function Se(n=0){return new Uint8Array(n)}y(Se,"allocUnsafe");function mt(n,e){e==null&&(e=n.reduce((x,l)=>x+l.length,0));let f=Se(e),c=0;for(let x of n)f.set(x,c),c+=x.length;return f}y(mt,"concat");var Bt={};Pr(Bt,{base10:()=>Tf});var mo=new Uint8Array(0);function Cn(n,e){if(n===e)return!0;if(n.byteLength!==e.byteLength)return!1;for(let f=0;f<n.byteLength;f++)if(n[f]!==e[f])return!1;return!0}y(Cn,"equals");function Yr(n){if(n instanceof Uint8Array&&n.constructor.name==="Uint8Array")return n;if(n instanceof ArrayBuffer)return new Uint8Array(n);if(ArrayBuffer.isView(n))return new Uint8Array(n.buffer,n.byteOffset,n.byteLength);throw new Error("Unknown type, must be binary type")}y(Yr,"coerce");function Bn(n){return new TextEncoder().encode(n)}y(Bn,"fromString");function Pn(n){return new TextDecoder().decode(n)}y(Pn,"toString");function Sf(n,e){if(n.length>=255)throw new TypeError("Alphabet too long");for(var f=new Uint8Array(256),c=0;c<f.length;c++)f[c]=255;for(var x=0;x<n.length;x++){var l=n.charAt(x),S=l.charCodeAt(0);if(f[S]!==255)throw new TypeError(l+" is ambiguous");f[S]=x}var k=n.length,nr=n.charAt(0),Kr=Math.log(k)/Math.log(256),hr=Math.log(256)/Math.log(k);function Tr(rr){if(rr instanceof Uint8Array||(ArrayBuffer.isView(rr)?rr=new Uint8Array(rr.buffer,rr.byteOffset,rr.byteLength):Array.isArray(rr)&&(rr=Uint8Array.from(rr))),!(rr instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(rr.length===0)return"";for(var dr=0,Dr=0,Ur=0,_r=rr.length;Ur!==_r&&rr[Ur]===0;)Ur++,dr++;for(var wr=(_r-Ur)*hr+1>>>0,lr=new Uint8Array(wr);Ur!==_r;){for(var ur=rr[Ur],Ir=0,Er=wr-1;(ur!==0||Ir<Dr)&&Er!==-1;Er--,Ir++)ur+=256*lr[Er]>>>0,lr[Er]=ur%k>>>0,ur=ur/k>>>0;if(ur!==0)throw new Error("Non-zero carry");Dr=Ir,Ur++}for(var Cr=wr-Dr;Cr!==wr&&lr[Cr]===0;)Cr++;for(var kr=nr.repeat(dr);Cr<wr;++Cr)kr+=n.charAt(lr[Cr]);return kr}y(Tr,"encode");function Xr(rr){if(typeof rr!="string")throw new TypeError("Expected String");if(rr.length===0)return new Uint8Array;var dr=0;if(rr[dr]!==" "){for(var Dr=0,Ur=0;rr[dr]===nr;)Dr++,dr++;for(var _r=(rr.length-dr)*Kr+1>>>0,wr=new Uint8Array(_r);rr[dr];){var lr=f[rr.charCodeAt(dr)];if(lr===255)return;for(var ur=0,Ir=_r-1;(lr!==0||ur<Ur)&&Ir!==-1;Ir--,ur++)lr+=k*wr[Ir]>>>0,wr[Ir]=lr%256>>>0,lr=lr/256>>>0;if(lr!==0)throw new Error("Non-zero carry");Ur=ur,dr++}if(rr[dr]!==" "){for(var Er=_r-Ur;Er!==_r&&wr[Er]===0;)Er++;for(var Cr=new Uint8Array(Dr+(_r-Er)),kr=Dr;Er!==_r;)Cr[kr++]=wr[Er++];return Cr}}}y(Xr,"decodeUnsafe");function Oe(rr){var dr=Xr(rr);if(dr)return dr;throw new Error(`Non-${e} character`)}return y(Oe,"decode"),{encode:Tr,decodeUnsafe:Xr,decode:Oe}}y(Sf,"base");var _f=Sf,Cf=_f,Dn=Cf;var vt=class vt{constructor(e,f,c){O(this,"name");O(this,"prefix");O(this,"baseEncode");this.name=e,this.prefix=f,this.baseEncode=c}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}};y(vt,"Encoder");var wt=vt,St=class St{constructor(e,f,c){O(this,"name");O(this,"prefix");O(this,"baseDecode");O(this,"prefixCodePoint");this.name=e,this.prefix=f;let x=f.codePointAt(0);if(x===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=x,this.baseDecode=c}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return In(this,e)}};y(St,"Decoder");var Kt=St,_t=class _t{constructor(e){O(this,"decoders");this.decoders=e}or(e){return In(this,e)}decode(e){let f=e[0],c=this.decoders[f];if(c!=null)return c.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};y(_t,"ComposedDecoder");var Et=_t;function In(n,e){return new Et({...n.decoders??{[n.prefix]:n},...e.decoders??{[e.prefix]:e}})}y(In,"or");var Ct=class Ct{constructor(e,f,c,x){O(this,"name");O(this,"prefix");O(this,"baseEncode");O(this,"baseDecode");O(this,"encoder");O(this,"decoder");this.name=e,this.prefix=f,this.baseEncode=c,this.baseDecode=x,this.encoder=new wt(e,f,c),this.decoder=new Kt(e,f,x)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};y(Ct,"Codec");var Ut=Ct;function ye({name:n,prefix:e,encode:f,decode:c}){return new Ut(n,e,f,c)}y(ye,"from");function Wr({name:n,prefix:e,alphabet:f}){let{encode:c,decode:x}=Dn(f,n);return ye({prefix:e,name:n,encode:c,decode:y(l=>Yr(x(l)),"decode")})}y(Wr,"baseX");function Bf(n,e,f,c){let x={};for(let hr=0;hr<e.length;++hr)x[e[hr]]=hr;let l=n.length;for(;n[l-1]==="=";)--l;let S=new Uint8Array(l*f/8|0),k=0,nr=0,Kr=0;for(let hr=0;hr<l;++hr){let Tr=x[n[hr]];if(Tr===void 0)throw new SyntaxError(`Non-${c} character`);nr=nr<<f|Tr,k+=f,k>=8&&(k-=8,S[Kr++]=255&nr>>k)}if(k>=f||(255&nr<<8-k)!==0)throw new SyntaxError("Unexpected end of data");return S}y(Bf,"decode");function Pf(n,e,f){let c=e[e.length-1]==="=",x=(1<<f)-1,l="",S=0,k=0;for(let nr=0;nr<n.length;++nr)for(k=k<<8|n[nr],S+=8;S>f;)S-=f,l+=e[x&k>>S];if(S!==0&&(l+=e[x&k<<f-S]),c)for(;(l.length*f&7)!==0;)l+="=";return l}y(Pf,"encode");function ar({name:n,prefix:e,bitsPerChar:f,alphabet:c}){return ye({prefix:e,name:n,encode(x){return Pf(x,c,f)},decode(x){return Bf(x,c,f,n)}})}y(ar,"rfc4648");var Tf=Wr({prefix:"9",name:"base10",alphabet:"0123456789"});var Pt={};Pr(Pt,{base16:()=>Df,base16upper:()=>If});var Df=ar({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),If=ar({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Tt={};Pr(Tt,{base2:()=>Mf});var Mf=ar({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Dt={};Pr(Dt,{base256emoji:()=>Of});var Mn=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),Lf=Mn.reduce((n,e,f)=>(n[f]=e,n),[]),Rf=Mn.reduce((n,e,f)=>{let c=e.codePointAt(0);if(c==null)throw new Error(`Invalid character: ${e}`);return n[c]=f,n},[]);function Nf(n){return n.reduce((e,f)=>(e+=Lf[f],e),"")}y(Nf,"encode");function zf(n){let e=[];for(let f of n){let c=f.codePointAt(0);if(c==null)throw new Error(`Invalid character: ${f}`);let x=Rf[c];if(x==null)throw new Error(`Non-base256emoji character: ${f}`);e.push(x)}return new Uint8Array(e)}y(zf,"decode");var Of=ye({prefix:"\u{1F680}",name:"base256emoji",encode:Nf,decode:zf});var It={};Pr(It,{base32:()=>xe,base32hex:()=>Ff,base32hexpad:()=>Vf,base32hexpadupper:()=>Xf,base32hexupper:()=>Gf,base32pad:()=>jf,base32padupper:()=>Hf,base32upper:()=>Yf,base32z:()=>kf});var xe=ar({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Yf=ar({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),jf=ar({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Hf=ar({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Ff=ar({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Gf=ar({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Vf=ar({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Xf=ar({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),kf=ar({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Mt={};Pr(Mt,{base36:()=>_e,base36upper:()=>Wf});var _e=Wr({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Wf=Wr({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Lt={};Pr(Lt,{base58btc:()=>Nr,base58flickr:()=>$f});var Nr=Wr({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),$f=Wr({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Rt={};Pr(Rt,{base64:()=>Zf,base64pad:()=>qf,base64url:()=>Jf,base64urlpad:()=>Qf});var Zf=ar({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),qf=ar({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Jf=ar({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Qf=ar({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Nt={};Pr(Nt,{base8:()=>ri});var ri=ar({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var zt={};Pr(zt,{identity:()=>ei});var ei=ye({prefix:"\0",name:"identity",encode:y(n=>Pn(n),"encode"),decode:y(n=>Bn(n),"decode")});var jo=new TextEncoder,Ho=new TextDecoder;var jt={};Pr(jt,{identity:()=>Ui});var fi=Nn,Ln=128,ii=127,oi=~ii,ai=Math.pow(2,31);function Nn(n,e,f){e=e||[],f=f||0;for(var c=f;n>=ai;)e[f++]=n&255|Ln,n/=128;for(;n&oi;)e[f++]=n&255|Ln,n>>>=7;return e[f]=n|0,Nn.bytes=f-c+1,e}y(Nn,"encode");var si=Ot,ci=128,Rn=127;function Ot(n,c){var f=0,c=c||0,x=0,l=c,S,k=n.length;do{if(l>=k)throw Ot.bytes=0,new RangeError("Could not decode varint");S=n[l++],f+=x<28?(S&Rn)<<x:(S&Rn)*Math.pow(2,x),x+=7}while(S>=ci);return Ot.bytes=l-c,f}y(Ot,"read");var yi=Math.pow(2,7),xi=Math.pow(2,14),ui=Math.pow(2,21),pi=Math.pow(2,28),hi=Math.pow(2,35),di=Math.pow(2,42),li=Math.pow(2,49),gi=Math.pow(2,56),bi=Math.pow(2,63),Ai=y(function(n){return n<yi?1:n<xi?2:n<ui?3:n<pi?4:n<hi?5:n<di?6:n<li?7:n<gi?8:n<bi?9:10},"length"),mi={encode:fi,decode:si,encodingLength:Ai},wi=mi,Ce=wi;function Be(n,e=0){return[Ce.decode(n,e),Ce.decode.bytes]}y(Be,"decode");function ue(n,e,f=0){return Ce.encode(n,e,f),e}y(ue,"encodeTo");function pe(n){return Ce.encodingLength(n)}y(pe,"encodingLength");function ee(n,e){let f=e.byteLength,c=pe(n),x=c+pe(f),l=new Uint8Array(x+f);return ue(n,l,0),ue(f,l,c),l.set(e,x),new he(n,f,e,l)}y(ee,"create");function zn(n){let e=Yr(n),[f,c]=Be(e),[x,l]=Be(e.subarray(c)),S=e.subarray(c+l);if(S.byteLength!==x)throw new Error("Incorrect length");return new he(f,x,S,e)}y(zn,"decode");function On(n,e){if(n===e)return!0;{let f=e;return n.code===f.code&&n.size===f.size&&f.bytes instanceof Uint8Array&&Cn(n.bytes,f.bytes)}}y(On,"equals");var Yt=class Yt{constructor(e,f,c,x){O(this,"code");O(this,"size");O(this,"digest");O(this,"bytes");this.code=e,this.size=f,this.digest=c,this.bytes=x}};y(Yt,"Digest");var he=Yt;var Yn=0,Ki="identity",jn=Yr;function Ei(n){return ee(Yn,jn(n))}y(Ei,"digest");var Ui={code:Yn,name:Ki,encode:jn,digest:Ei};var Vt={};Pr(Vt,{sha256:()=>vi,sha512:()=>Si});function Ft({name:n,code:e,encode:f}){return new Ht(n,e,f)}y(Ft,"from");var Gt=class Gt{constructor(e,f,c){O(this,"name");O(this,"code");O(this,"encode");this.name=e,this.code=f,this.encode=c}digest(e){if(e instanceof Uint8Array){let f=this.encode(e);return f instanceof Uint8Array?ee(this.code,f):f.then(c=>ee(this.code,c))}else throw Error("Unknown type, must be binary type")}};y(Gt,"Hasher");var Ht=Gt;function Fn(n){return async e=>new Uint8Array(await crypto.subtle.digest(n,e))}y(Fn,"sha");var vi=Ft({name:"sha2-256",code:18,encode:Fn("SHA-256")}),Si=Ft({name:"sha2-512",code:19,encode:Fn("SHA-512")});function Gn(n,e){let{bytes:f,version:c}=n;switch(c){case 0:return Ci(f,Xt(n),e??Nr.encoder);default:return Bi(f,Xt(n),e??xe.encoder)}}y(Gn,"format");var Vn=new WeakMap;function Xt(n){let e=Vn.get(n);if(e==null){let f=new Map;return Vn.set(n,f),f}return e}y(Xt,"baseCache");var kn,pr=class pr{constructor(e,f,c,x){O(this,"code");O(this,"version");O(this,"multihash");O(this,"bytes");O(this,"/");O(this,kn,"CID");this.code=f,this.version=e,this.multihash=c,this.bytes=x,this["/"]=x}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:f}=this;if(e!==Te)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(f.code!==Pi)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return pr.createV0(f)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:f}=this.multihash,c=ee(e,f);return pr.createV1(this.code,c)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return pr.equals(this,e)}static equals(e,f){let c=f;return c!=null&&e.code===c.code&&e.version===c.version&&On(e.multihash,c.multihash)}toString(e){return Gn(this,e)}toJSON(){return{"/":Gn(this)}}link(){return this}[(kn=Symbol.toStringTag,Symbol.for("nodejs.util.inspect.custom"))](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let f=e;if(f instanceof pr)return f;if(f["/"]!=null&&f["/"]===f.bytes||f.asCID===f){let{version:c,code:x,multihash:l,bytes:S}=f;return new pr(c,x,l,S??Xn(c,x,l.bytes))}else if(f[Ti]===!0){let{version:c,multihash:x,code:l}=f,S=zn(x);return pr.create(c,l,S)}else return null}static create(e,f,c){if(typeof f!="number")throw new Error("String codecs are no longer supported");if(!(c.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(f!==Te)throw new Error(`Version 0 CID must use dag-pb (code: ${Te}) block encoding`);return new pr(e,f,c,c.bytes)}case 1:{let x=Xn(e,f,c.bytes);return new pr(e,f,c,x)}default:throw new Error("Invalid version")}}static createV0(e){return pr.create(0,Te,e)}static createV1(e,f){return pr.create(1,e,f)}static decode(e){let[f,c]=pr.decodeFirst(e);if(c.length!==0)throw new Error("Incorrect length");return f}static decodeFirst(e){let f=pr.inspectBytes(e),c=f.size-f.multihashSize,x=Yr(e.subarray(c,c+f.multihashSize));if(x.byteLength!==f.multihashSize)throw new Error("Incorrect length");let l=x.subarray(f.multihashSize-f.digestSize),S=new he(f.multihashCode,f.digestSize,l,x);return[f.version===0?pr.createV0(S):pr.createV1(f.codec,S),e.subarray(f.size)]}static inspectBytes(e){let f=0,c=y(()=>{let[Tr,Xr]=Be(e.subarray(f));return f+=Xr,Tr},"next"),x=c(),l=Te;if(x===18?(x=0,f=0):l=c(),x!==0&&x!==1)throw new RangeError(`Invalid CID version ${x}`);let S=f,k=c(),nr=c(),Kr=f+nr,hr=Kr-S;return{version:x,codec:l,multihashCode:k,digestSize:nr,multihashSize:hr,size:Kr}}static parse(e,f){let[c,x]=_i(e,f),l=pr.decode(x);if(l.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Xt(l).set(c,e),l}};y(pr,"CID");var Ze=pr;function _i(n,e){switch(n[0]){case"Q":{let f=e??Nr;return[Nr.prefix,f.decode(`${Nr.prefix}${n}`)]}case Nr.prefix:{let f=e??Nr;return[Nr.prefix,f.decode(n)]}case xe.prefix:{let f=e??xe;return[xe.prefix,f.decode(n)]}case _e.prefix:{let f=e??_e;return[_e.prefix,f.decode(n)]}default:{if(e==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[n[0],e.decode(n)]}}}y(_i,"parseCIDtoBytes");function Ci(n,e,f){let{prefix:c}=f;if(c!==Nr.prefix)throw Error(`Cannot string encode V0 in ${f.name} encoding`);let x=e.get(c);if(x==null){let l=f.encode(n).slice(1);return e.set(c,l),l}else return x}y(Ci,"toStringV0");function Bi(n,e,f){let{prefix:c}=f,x=e.get(c);if(x==null){let l=f.encode(n);return e.set(c,l),l}else return x}y(Bi,"toStringV1");var Te=112,Pi=18;function Xn(n,e,f){let c=pe(n),x=c+pe(e),l=new Uint8Array(x+f.byteLength);return ue(n,l,0),ue(e,l,c),l.set(f,x),l}y(Xn,"encodeCID");var Ti=Symbol.for("@ipld/js-cid/CID");var kt={...zt,...Tt,...Nt,...Bt,...Pt,...It,...Mt,...Lt,...Rt,...Dt},Aa={...Vt,...jt};function $n(n,e,f,c){return{name:n,prefix:e,encoder:{name:n,prefix:e,encode:f},decoder:{decode:c}}}y($n,"createCodec");var Wn=$n("utf8","u",n=>"u"+new TextDecoder("utf8").decode(n),n=>new TextEncoder().encode(n.substring(1))),Wt=$n("ascii","a",n=>{let e="a";for(let f=0;f<n.length;f++)e+=String.fromCharCode(n[f]);return e},n=>{n=n.substring(1);let e=Se(n.length);for(let f=0;f<n.length;f++)e[f]=n.charCodeAt(f);return e}),Di={utf8:Wn,"utf-8":Wn,hex:kt.base16,latin1:Wt,ascii:Wt,binary:Wt,...kt},qe=Di;function gr(n,e="utf8"){let f=qe[e];if(f==null)throw new Error(`Unsupported encoding "${e}"`);return f.decoder.decode(`${f.prefix}${n}`)}y(gr,"fromString");function cr(n,e="utf8"){let f=qe[e];if(f==null)throw new Error(`Unsupported encoding "${e}"`);return f.encoder.encode(n).substring(1)}y(cr,"toString");var De=(c=>(c.Sign="signing",c.Exchange="exchange",c.Write="write",c))(De||{});var te="did:key:z",Va="Ed25519",Xa="X25519",ka="X25519",Wa="Ed25519",$a="X25519",Li={sign:["sign","verify"],encrypt:["deriveKey","deriveBits"]},ne="RSA-OAEP",fe="RSASSA-PKCS1-v1_5",$t="SHA-256",Zt=new Uint8Array([0,245,2]),qt=2048,de="SHA-256",jr=8,Hr="AES-GCM",le=Hr,ie=256,ge=12,Jt=new Uint8Array([234,1]),Qt=new Uint8Array([237,1]),Je={RSA:"rsa",Edwards:"ed25519",BLS:"bls12-381"},rn="rsa-exchange-key",en="rsa-write-key",Za="ecc-exchange",qa="ecc-write",tn=16;var Zn=new Error("Invalid key use. Please use 'encryption' or 'signing"),Ri=new Error("Max must be less than 256 and greater than 0");function Sr(n){return new Uint8Array(n).buffer}y(Sr,"toArrayBuffer");async function qn(n){return new Uint8Array(await tr.subtle.digest("sha-256",n.buffer))}y(qn,"sha256");function $r(n){let e=gr(n,"base64pad");return Sr(e)}y($r,"base64ToArrBuf");var Me=y((n,e)=>{if(typeof n=="string")return e(n);if(typeof n=="object"&&n.byteLength!==void 0)return new Uint8Array(n).buffer;throw new Error("Improper value. Must be a string, ArrayBuffer, Uint8Array")},"normalizeToBuf");function Qe(n){return Me(n,$r)}y(Qe,"normalizeBase64ToBuf");var Ni=y(n=>Me(n,e=>Jn(e,8)),"normalizeUtf8ToBuf");function Jn(n,e){let f=e===8?new Uint8Array(n.length):new Uint16Array(n.length);for(let c=0,x=n.length;c<x;c++)f[c]=n.charCodeAt(c);return f.buffer}y(Jn,"strToArrBuf");var zi=y(n=>Me(n,e=>Jn(e,16)),"normalizeUtf16ToBuf");function Zr(n,e){switch(e){case 8:return Ni(n);default:return zi(n)}}y(Zr,"normalizeUnicodeToBuf");function Qn(n){if(!n.startsWith(te))throw new Error("Please use a base58-encoded DID formatted `did:key:z...`");let e=""+n.substring(te.length),f=gr(e,"base58btc"),{keyBuffer:c,type:x}=Oi(Sr(f));return{publicKey:new Uint8Array(c),type:x}}y(Qn,"didToPublicKey");function Oi(n){if(Ie(n,Sr(Zt)))return{keyBuffer:n.slice(Zt.byteLength),type:Je.RSA};if(Ie(n,Sr(Qt)))return{keyBuffer:n.slice(Qt.byteLength),type:Je.Edwards};if(Ie(n,Sr(Jt)))return{keyBuffer:n.slice(Jt.byteLength),type:Je.BLS};throw new Error("Unsupported key algorithm. Try using RSA.")}y(Oi,"parseMagicBytes");var Yi={equal:y((n,e)=>{let f=new Uint8Array(n),c=new Uint8Array(e);if(f.length!==c.length)return!1;for(let x=0;x<f.length;x++)if(f[x]!==c[x])return!1;return!0},"equal")};function Ie(n,e){return Yi.equal(e,n.slice(0,e.byteLength))}y(Ie,"hasPrefix");function Rr(n){return cr(n instanceof ArrayBuffer?new Uint8Array(n):n,"base64pad")}y(Rr,"toBase64");async function Le(n,e){let f=typeof n=="string"?$r(n):Sr(n);return tr.subtle.importKey("raw",f,{name:e?.alg||le,length:e?.length||ie},!0,["encrypt","decrypt"])}y(Le,"importKey");function rt(n,{max:e}={max:255}){if(e<1||e>255)throw Ri;let f=new Uint8Array(n);if(e===255)return tr.getRandomValues(f),f.buffer;let c=0,x=e+1,l=Math.floor(256/x)*x,S=new Uint8Array(1);for(;c<f.length;)tr.getRandomValues(S),S[0]<l&&(f[c]=S[0]%x,c++);return f.buffer}y(rt,"randomBuf");function Fr(n,e){let f=n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(Sr(n)),c=e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(Sr(e)),x=new Uint8Array(f.length+c.length);return x.set(f),x.set(c,f.length),x.buffer}y(Fr,"joinBufs");async function nn(n,e,f,c=!1){let x=c;if(!Object.values(De).includes(f))throw new Error("invalid key use");let l=f==="exchange"?ne:fe,S=f==="exchange"?["encrypt","decrypt"]:["sign","verify"];return tr.subtle.generateKey({name:l,modulusLength:n,publicExponent:ji(),hash:{name:e}},x,S)}y(nn,"makeRSAKeypair");function ji(){return new Uint8Array([1,0,1])}y(ji,"publicExponent");var tf=Ef(ef(),1);var on={keyTypes:{"bls12-381":{magicBytes:new Uint8Array([234,1]),verify:y(()=>{throw new Error("Not implemented")},"verify")},rsa:{magicBytes:new Uint8Array([0,245,2]),verify:Fi},ed25519:{magicBytes:new Uint8Array([237,1]),verify:Hi}}};async function Hi({message:n,publicKey:e,signature:f}){let c=n;typeof n=="string"&&(c=gr(n,"utf8"));let x=f;typeof f=="string"&&(x=gr(f,"base64pad"));let l=e;if(typeof e=="string"&&(l=ff(e).publicKey),l.length!==32)throw new Error(`Invalid Ed25519 public key size: ${l.length} bytes, expected 32`);if(x.length!==64)throw new Error(`Invalid Ed25519 signature size: ${x.length} bytes, expected 64`);return tf.default.sign.detached.verify(c,x,l)}y(Hi,"ed25519Verify");async function Fi({message:n,publicKey:e,signature:f}){let c=e;return typeof e=="string"&&(c=ff(e).publicKey),Gr.verify(n,f,await tr.subtle.importKey("spki",Sr(c),{name:fe,hash:$t},!1,["verify"]),8)}y(Fi,"rsaVerify");var Gr={verify:y(async function(e,f,c,x=jr,l=de){return tr.subtle.verify({name:fe,saltLength:tn},typeof c=="string"?await Re(c,l,"signing"):c,Qe(f),Zr(e,x))},"rsaVerify"),sign:y(async function(e,f,c=jr){return tr.subtle.sign({name:fe,saltLength:tn},f,Zr(e,c))},"sign"),encrypt:y(async function(e,f,c=jr,x=de){let l;return typeof f=="string"?l=await Re(f,x,"exchange"):l=f instanceof Uint8Array?await Re(Sr(f),x,"exchange"):f,tr.subtle.encrypt({name:ne},l,Zr(e,c))},"rsaEncrypt"),decrypt:y(async function(e,f){let c=be(f)?f:await ki(f,["decrypt"]),x;typeof e=="string"?x=gr(e,"base64pad"):x=e;let l=await tr.subtle.decrypt({name:ne},c,x instanceof Uint8Array?Sr(x):x);return new Uint8Array(l)},"rsaDecrypt")};async function Re(n,e,f){Gi(f);let c=f==="exchange"?ne:fe,x=f==="exchange"?["encrypt"]:["verify"],l=typeof n=="string"?$r(Xi(n)):n;return tr.subtle.importKey("spki",l,{name:c,hash:{name:e}},!0,x)}y(Re,"rsaImportPublicKey");function Gi(n){Vi(n,["signing","exchange"],Zn)}y(Gi,"checkValidKeyUse");function Vi(n,e,f){if(!e.some(x=>x===n))throw f}y(Vi,"checkValid");function Xi(n){return n.replace(`-----BEGIN PUBLIC KEY-----
2
2
  `,"").replace(`
3
- -----END PUBLIC KEY-----`,"")}y(Xi,"stripKeyHeader");function be(n){return fn(n,"algorithm")&&fn(n,"extractable")&&fn(n,"type")}y(be,"isCryptoKey");function fn(n,e){return typeof n=="object"&&n!=null&&e in n}y(fn,"hasProp");function ki(n,e){return tr.subtle.importKey("spki",n instanceof Uint8Array?Sr(n):n,{name:ne,hash:$t},!1,e)}y(ki,"importRsaKey");async function tt(n,e="rsa"){let f=n instanceof CryptoKey?new Uint8Array(await qr(n)):n,c=on.keyTypes[e]?.magicBytes;if(!c)throw new Error(`Key type '${e}' not supported, available types: ${Object.keys(on.keyTypes).join(", ")}`);let x=mt([c,f]);return te+cr(x,"base58btc")}y(tt,"publicKeyToDid");async function qr(n){return n instanceof CryptoKey?await tr.subtle.exportKey("spki",n):await tr.subtle.exportKey("spki",n.publicKey)}y(qr,"getPublicKeyAsArrayBuffer");async function ff(n){let e=await qr(n);return new Uint8Array(e)}y(ff,"getPublicKeyAsUint8Array");function of(n){if(!n.startsWith(te))throw new Error("Please use a base58-encoded DID formatted `did:key:z...`");let e=n.substr(te.length),f=gr(e,"base58btc"),c=Object.entries(on.keyTypes).find(([l,S])=>Me(f.buffer,S.magicBytes.buffer));if(!c)throw new Error("Unsupported key algorithm.");let x=f.slice(c[1].magicBytes.length);return c[0]==="ed25519"&&x.length===44?{publicKey:x.slice(-32),type:c[0]}:{publicKey:x,type:c[0]}}y(of,"didToPublicKey");function Ae(n){return new Uint8Array(n).buffer}y(Ae,"toArrayBuffer");var yr={create(n={alg:le,length:ie}){let e=n.length||ie,f=n.alg||le;return tr.subtle.generateKey({name:f,length:e},!0,["encrypt","decrypt"])},export:Object.assign(async n=>{let e=await tr.subtle.exportKey("raw",n);return new Uint8Array(e)},{asString:y(async(n,e)=>{let f=await yr.export(n);return e?cr(f,e):Rr(f)},"asString")}),import(n){return Ne(typeof n=="string"?$r(n):n)},async exportAsString(n){let e=await yr.export(n);return Rr(e)},encrypt:Wi,async decrypt(n,e,f){let c=be(e)?e:await Ne(e),x=f?await tr.subtle.decrypt({name:Hr,iv:Ae(f)},c,typeof n=="string"?Ae(gr(n)):n instanceof Uint8Array?Ae(n):n):await Zi(n,c);return new Uint8Array(x)}};function Ne(n,e){return tr.subtle.importKey("raw",n instanceof Uint8Array?Ae(n):n,{name:Hr,length:e||256},!0,["encrypt","decrypt"])}y(Ne,"importAesKey");async function Wi(n,e,f,c){let x=be(e)?e:await Ne(e),l=c?await tr.subtle.encrypt({name:Hr,iv:Ae(c)},x,Ae(n)):await $i(n,x);return f&&f==="arraybuffer"?l:new Uint8Array(l)}y(Wi,"encrypt");async function $i(n,e,f){let c=Zr(n,f?.charsize??jr),x=typeof e=="string"?await Le(e,f):e,l=f?.iv||rt(ge),S=await tr.subtle.encrypt({name:Hr,iv:l},x,c);return Fr(l,S)}y($i,"encryptBytes");async function Zi(n,e,f){let c=Qe(n),x=typeof e=="string"?await Le(e,f):e,l=c.slice(0,ge),S=c.slice(ge);return await tr.subtle.decrypt({name:le,iv:l},x,S)}y(Zi,"decryptBytes");function nt(n){return new Promise((e,f)=>{n.oncomplete=n.onsuccess=()=>e(n.result),n.onabort=n.onerror=()=>f(n.error)})}y(nt,"promisifyRequest");function qi(n,e){let f,c=y(()=>{if(f)return f;let x=indexedDB.open(n);return x.onupgradeneeded=()=>x.result.createObjectStore(e),f=nt(x),f.then(l=>{l.onclose=()=>f=void 0},()=>{}),f},"getDB");return(x,l)=>c().then(S=>l(S.transaction(e,x).objectStore(e)))}y(qi,"createStore");var an;function sn(){return an||(an=qi("keyval-store","keyval")),an}y(sn,"defaultGetStore");function cn(n,e=sn()){return e("readonly",f=>nt(f.get(n)))}y(cn,"get");function yn(n,e,f=sn()){return f("readwrite",c=>(c.put(e,n),nt(c.transaction)))}y(yn,"set");function af(n,e=sn()){return e("readwrite",f=>(n.forEach(c=>f.delete(c)),nt(f.transaction)))}y(af,"delMany");var Jr=class Jr{constructor(e){O(this,"DID");O(this,"exchangeKey");O(this,"writeKey");O(this,"hasPersisted");O(this,"isSessionOnly");let{keys:f}=e;this.DID=e.did,this.exchangeKey=f.exchange,this.writeKey=f.write,this.hasPersisted=e.hasPersisted,this.isSessionOnly=!!e.isSessionOnly}publicExchangeKeyAsString(e){return this.publicExchangeKey.asString(e)}publicWriteKeyAsString(e){return this.publicWriteKey.asString(e)}get publicWriteKey(){let e=this.writeKey.publicKey;return Object.assign(e,{asString:y(async f=>{let c=await qr(this.writeKey),x=new Uint8Array(c);return f?cr(x,f):Rr(x)},"asString")})}get publicExchangeKey(){let e=this.exchangeKey.publicKey;return Object.assign(e,{asString:y(async f=>{let c=await qr(this.exchangeKey),x=new Uint8Array(c);return f?cr(x,f):Rr(x)},"asString")})}get privateWriteKey(){return this.writeKey.privateKey}get privateExchangeKey(){return this.exchangeKey.privateKey}get deviceName(){return Jr.deviceName(this.DID)}static deviceName(e){return Ji(e)}async persist(){if(this.isSessionOnly)return;let e=this.constructor.EXCHANGE_KEY_NAME,f=this.constructor.WRITE_KEY_NAME;await Promise.all([yn(e,this.exchangeKey),yn(f,this.writeKey)]),this.hasPersisted=!0}async delete(){await af([this.constructor.EXCHANGE_KEY_NAME,this.constructor.WRITE_KEY_NAME]),this.hasPersisted=!1}async getDeviceName(){return Jr.deviceName(this.DID)}static _createExchangeKeys(e){throw new Error("The child should implement this")}static _createWriteKeys(e){throw new Error("The child should implement this")}static async create(e,f,c){let x=c?.exchangeKeys||await this._createExchangeKeys(f),l=c?.writeKeys||await this._createWriteKeys(f),S=await qr(l),k=await tt(new Uint8Array(S),this.TYPE==="ecc"?"ed25519":"rsa"),nr=new this({keys:{exchange:x,write:l},did:k,hasPersisted:!1,isSessionOnly:!!e});return this._instance=nr,nr}static async load(e={session:!1}){if(this._instance)return this._instance;let f=!0,c=await cn(e.encryptionKeyName||this.EXCHANGE_KEY_NAME),x=await cn(e.signingKeyName||this.WRITE_KEY_NAME);c||(f=!1,c=await this._createExchangeKeys(e.extractable)),x||(f=!1,x=await this._createWriteKeys(e.extractable));let l=await qr(x),S=await tt(new Uint8Array(l),this.TYPE==="ecc"?"ed25519":"rsa"),k=new this({keys:{exchange:c,write:x},did:S,hasPersisted:f,isSessionOnly:!!e.session});return this._instance=k,k}};y(Jr,"AbstractKeys"),O(Jr,"EXCHANGE_KEY_NAME"),O(Jr,"WRITE_KEY_NAME"),O(Jr,"_instance");var ft=Jr;async function sf(n,e){let{content:f,publicKey:c}=n,x=e||await yr.create(),l=await yr.encrypt(typeof f=="string"?gr(f):f,typeof x=="string"?await yr.import(x):x),S=await xn({key:x,publicKey:c});return Fr(S,l)}y(sf,"encryptTo");sf.asString=async function(n,e){let f=await sf(n,e);return cr(new Uint8Array(f),"base64pad")};async function xn({key:n,publicKey:e},f){let c;n instanceof CryptoKey?c=await yr.export(n):c=n;let x=await Gr.encrypt(c,e);return f&&f==="arraybuffer"?x:new Uint8Array(x)}y(xn,"encryptKeyTo");xn.asString=async function({key:n,publicKey:e},f){let c=await xn({key:n,publicKey:e});return f?cr(c,f):Rr(c)};async function Ji(n){let e=await Jn(new TextEncoder().encode(n.normalize("NFD")));return cr(e,"base32").slice(0,32)}y(Ji,"getDeviceName");function un(n){return new Uint8Array(n).buffer}y(un,"toArrayBuffer");var Vr=class Vr extends ft{static async create(e,f,c){return await super.create(e,f,c)}constructor(e){super(e),Vr.EXCHANGE_KEY_NAME=e.exchangeKeyName||rn,Vr.WRITE_KEY_NAME=e.writeKeyName||en}static async _createExchangeKeys(e=!1){return await nn(qt,de,"exchange",e)}static async _createWriteKeys(e=!1){return await nn(qt,de,"write",e)}async toJson(e){let f=this.publicExchangeKey,c=this.DID,x=await tr.subtle.exportKey("spki",f);return{publicExchangeKey:e?cr(new Uint8Array(x),e):Rr(x),DID:c}}async sign(e,f=jr){let c=this.writeKey,x=await Gr.sign(e,c.privateKey,f);return new Uint8Array(x)}async signAsString(e,f){let c=await this.sign(e,f);return Rr(c)}async encrypt(e,f,c,x,l){let S=f||this.exchangeKey.publicKey,k=c,nr=x,Kr=k||await yr.create({length:nr||l}),hr=await yr.encrypt(typeof e=="string"?gr(e):e,typeof Kr=="string"?await yr.import(Kr):Kr),Tr=await ze({key:Kr,publicKey:S}),Xr=Fr(Tr,hr);return new Uint8Array(Xr)}async encryptAsString(e,f,c,x,l){let S=await this.encrypt(e,f,c,x,l);return cr(S,"base64pad")}async decrypt(e,f,c){let x=(typeof f=="number"?f:void 0)||ie,l=Ie(e,$r),S=l.slice(0,x),k=l.slice(x),nr=await this.decryptKey(S);return await yr.decrypt(k,nr)}async decryptAsString(e,f,c){let x=await this.decrypt(e,f,c);return cr(x)}async decryptKey(e){return await Gr.decrypt(e,this.exchangeKey.privateKey)}async decryptKeyAsString(e,f){let c=await Gr.decrypt(e,this.exchangeKey.privateKey);return cr(c,f)}async getAesKey(e,f){if(!e)throw new Error("RSA requires an encrypted AES key to decrypt");if(typeof e=="string"){let c=await this.decryptKey(e);return await yr.import(c)}else return e}};y(Vr,"RsaKeys"),O(Vr,"TYPE","rsa"),O(Vr,"INFO","keys"),O(Vr,"EXCHANGE_KEY_NAME",rn),O(Vr,"WRITE_KEY_NAME",en);var me=Vr;Object.assign(me.prototype.sign,{asString:y(async function(n,e){return this.signAsString(n,e)},"asString")});Object.assign(me.prototype.encrypt,{asString:y(async function(n,e,f,c){return this.encryptAsString(n,e,f,c)},"asString")});Object.assign(me.prototype.decrypt,{asString:y(async function(n,e){return this.decryptAsString(n,e)},"asString")});async function Gs(n,e,f){let c=rf(f),x=await Re(un(c.publicKey),"SHA-256","signing");try{return Gr.verify(n,e,x)}catch{return!1}}y(Gs,"verify");Object.assign(me.prototype.decryptKey,{asString:y(async function(n,e){return this.decryptKeyAsString(n,e)},"asString")});async function Qi(n,e){let{content:f,publicKey:c}=n,x=e||await yr.create(),l=await yr.encrypt(typeof f=="string"?gr(f):f,typeof x=="string"?await yr.import(x):x),S=await ze({key:x,publicKey:c});return Fr(S,l)}y(Qi,"encryptTo");Qi.asString=async function(n,e){let{content:f,publicKey:c}=n,x=e||await yr.create(),l=await yr.encrypt(typeof f=="string"?gr(f):f,typeof x=="string"?await yr.import(x):x,"arraybuffer"),S=await ze({key:x,publicKey:c}),k=Fr(S,l);return cr(new Uint8Array(k),"base64pad")};async function ze({key:n,publicKey:e},f){let c;n instanceof CryptoKey?c=await yr.export(n):c=n;let x=await Gr.encrypt(c,e);return f&&f==="arraybuffer"?x:new Uint8Array(x)}y(ze,"encryptKeyTo");ze.asString=async function({key:n,publicKey:e},f){let c=await ze({key:n,publicKey:e});return f?cr(c,f):Rr(c)};async function Vs(n,e,f,c){let x=be(e)?e:await Ne(e),l=c?await tr.subtle.encrypt({name:Hr,iv:un(c)},x,un(n)):await ro(n,x);return f&&f==="arraybuffer"?l:new Uint8Array(l)}y(Vs,"encrypt");async function ro(n,e,f){let c=Zr(n,f?.charsize??jr),x=typeof e=="string"?await Le(e,f):e,l=f?.iv||rt(ge),S=await tr.subtle.encrypt({name:Hr,iv:l},x,c);return Fr(l,S)}y(ro,"encryptBytes");export{Hr as AES_GCM,te as BASE58_DID_PREFIX,Jt as BLS_DID_PREFIX,jr as DEFAULT_CHAR_SIZE,Za as DEFAULT_ECC_EXCHANGE,ka as DEFAULT_ECC_EXCHANGE_CURVE,qa as DEFAULT_ECC_WRITE,de as DEFAULT_HASH_ALGORITHM,rn as DEFAULT_RSA_EXCHANGE,qt as DEFAULT_RSA_SIZE,en as DEFAULT_RSA_WRITE,le as DEFAULT_SYMM_ALGORITHM,ie as DEFAULT_SYMM_LENGTH,Xa as ECC_EXCHANGE_ALG,$a as ECC_EXCHANGE_NAME,Va as ECC_WRITE_ALG,Wa as ECC_WRITE_NAME,Qt as EDWARDS_DID_PREFIX,ge as IV_LENGTH,Je as KEY_TYPE,Li as KEY_USE,ne as RSA_ALGORITHM,Zt as RSA_DID_PREFIX,$t as RSA_HASHING_ALGORITHM,fe as RSA_SIGN_ALGORITHM,me as RsaKeys,tn as SALT_LENGTH,Vs as encrypt,ze as encryptKeyTo,Qi as encryptTo,qr as getPublicKeyAsArrayBuffer,ff as getPublicKeyAsUint8Array,tt as publicKeyToDid,Gs as verify};
3
+ -----END PUBLIC KEY-----`,"")}y(Xi,"stripKeyHeader");function be(n){return fn(n,"algorithm")&&fn(n,"extractable")&&fn(n,"type")}y(be,"isCryptoKey");function fn(n,e){return typeof n=="object"&&n!=null&&e in n}y(fn,"hasProp");function ki(n,e){return tr.subtle.importKey("spki",n instanceof Uint8Array?Sr(n):n,{name:ne,hash:$t},!1,e)}y(ki,"importRsaKey");async function tt(n,e="rsa"){let f=n instanceof CryptoKey?new Uint8Array(await qr(n)):n,c=on.keyTypes[e]?.magicBytes;if(!c)throw new Error(`Key type '${e}' not supported, available types: ${Object.keys(on.keyTypes).join(", ")}`);let x=mt([c,f]);return te+cr(x,"base58btc")}y(tt,"publicKeyToDid");async function qr(n){return n instanceof CryptoKey?await tr.subtle.exportKey("spki",n):await tr.subtle.exportKey("spki",n.publicKey)}y(qr,"getPublicKeyAsArrayBuffer");async function nf(n){let e=await qr(n);return new Uint8Array(e)}y(nf,"getPublicKeyAsUint8Array");function ff(n){if(!n.startsWith(te))throw new Error("Please use a base58-encoded DID formatted `did:key:z...`");let e=n.substr(te.length),f=gr(e,"base58btc"),c=Object.entries(on.keyTypes).find(([l,S])=>Ie(f.buffer,S.magicBytes.buffer));if(!c)throw new Error("Unsupported key algorithm.");let x=f.slice(c[1].magicBytes.length);return c[0]==="ed25519"&&x.length===44?{publicKey:x.slice(-32),type:c[0]}:{publicKey:x,type:c[0]}}y(ff,"didToPublicKey");function Ae(n){return new Uint8Array(n).buffer}y(Ae,"toArrayBuffer");var yr={create(n={alg:le,length:ie}){let e=n.length||ie,f=n.alg||le;return tr.subtle.generateKey({name:f,length:e},!0,["encrypt","decrypt"])},export:Object.assign(async n=>{let e=await tr.subtle.exportKey("raw",n);return new Uint8Array(e)},{asString:y(async(n,e)=>{let f=await yr.export(n);return e?cr(f,e):Rr(f)},"asString")}),import(n){return Ne(typeof n=="string"?$r(n):n)},async exportAsString(n){let e=await yr.export(n);return Rr(e)},encrypt:Wi,async decrypt(n,e,f){let c=be(e)?e:await Ne(e),x=f?await tr.subtle.decrypt({name:Hr,iv:Ae(f)},c,typeof n=="string"?Ae(gr(n)):n instanceof Uint8Array?Ae(n):n):await Zi(n,c);return new Uint8Array(x)}};function Ne(n,e){return tr.subtle.importKey("raw",n instanceof Uint8Array?Ae(n):n,{name:Hr,length:e||256},!0,["encrypt","decrypt"])}y(Ne,"importAesKey");async function Wi(n,e,f,c){let x=be(e)?e:await Ne(e),l=c?await tr.subtle.encrypt({name:Hr,iv:Ae(c)},x,Ae(n)):await $i(n,x);return f&&f==="arraybuffer"?l:new Uint8Array(l)}y(Wi,"encrypt");async function $i(n,e,f){let c=Zr(n,f?.charsize??jr),x=typeof e=="string"?await Le(e,f):e,l=f?.iv||rt(ge),S=await tr.subtle.encrypt({name:Hr,iv:l},x,c);return Fr(l,S)}y($i,"encryptBytes");async function Zi(n,e,f){let c=Qe(n),x=typeof e=="string"?await Le(e,f):e,l=c.slice(0,ge),S=c.slice(ge);return await tr.subtle.decrypt({name:le,iv:l},x,S)}y(Zi,"decryptBytes");function nt(n){return new Promise((e,f)=>{n.oncomplete=n.onsuccess=()=>e(n.result),n.onabort=n.onerror=()=>f(n.error)})}y(nt,"promisifyRequest");function qi(n,e){let f,c=y(()=>{if(f)return f;let x=indexedDB.open(n);return x.onupgradeneeded=()=>x.result.createObjectStore(e),f=nt(x),f.then(l=>{l.onclose=()=>f=void 0},()=>{}),f},"getDB");return(x,l)=>c().then(S=>l(S.transaction(e,x).objectStore(e)))}y(qi,"createStore");var an;function sn(){return an||(an=qi("keyval-store","keyval")),an}y(sn,"defaultGetStore");function cn(n,e=sn()){return e("readonly",f=>nt(f.get(n)))}y(cn,"get");function yn(n,e,f=sn()){return f("readwrite",c=>(c.put(e,n),nt(c.transaction)))}y(yn,"set");function of(n,e=sn()){return e("readwrite",f=>(n.forEach(c=>f.delete(c)),nt(f.transaction)))}y(of,"delMany");var Jr=class Jr{constructor(e){O(this,"DID");O(this,"exchangeKey");O(this,"writeKey");O(this,"hasPersisted");O(this,"isSessionOnly");let{keys:f}=e;this.DID=e.did,this.exchangeKey=f.exchange,this.writeKey=f.write,this.hasPersisted=e.hasPersisted,this.isSessionOnly=!!e.isSessionOnly}publicExchangeKeyAsString(e){return this.publicExchangeKey.asString(e)}publicWriteKeyAsString(e){return this.publicWriteKey.asString(e)}get publicWriteKey(){let e=this.writeKey.publicKey;return Object.assign(e,{asString:y(async f=>{let c=await qr(this.writeKey),x=new Uint8Array(c);return f?cr(x,f):Rr(x)},"asString")})}get publicExchangeKey(){let e=this.exchangeKey.publicKey;return Object.assign(e,{asString:y(async f=>{let c=await qr(this.exchangeKey),x=new Uint8Array(c);return f?cr(x,f):Rr(x)},"asString")})}get privateWriteKey(){return this.writeKey.privateKey}get privateExchangeKey(){return this.exchangeKey.privateKey}get deviceName(){return Jr.deviceName(this.DID)}static deviceName(e){return Ji(e)}async persist(){if(this.isSessionOnly)return;let e=this.constructor.EXCHANGE_KEY_NAME,f=this.constructor.WRITE_KEY_NAME;await Promise.all([yn(e,this.exchangeKey),yn(f,this.writeKey)]),this.hasPersisted=!0}async delete(){await of([this.constructor.EXCHANGE_KEY_NAME,this.constructor.WRITE_KEY_NAME]),this.hasPersisted=!1}async getDeviceName(){return Jr.deviceName(this.DID)}static _createExchangeKeys(e){throw new Error("The child should implement this")}static _createWriteKeys(e){throw new Error("The child should implement this")}static async create(e,f,c){let x=c?.exchangeKeys||await this._createExchangeKeys(f),l=c?.writeKeys||await this._createWriteKeys(f),S=await qr(l),k=await tt(new Uint8Array(S),this.TYPE==="ecc"?"ed25519":"rsa"),nr=new this({keys:{exchange:x,write:l},did:k,hasPersisted:!1,isSessionOnly:!!e});return this._instance=nr,nr}static async load(e={session:!1}){if(this._instance)return this._instance;let f=!0,c=await cn(e.encryptionKeyName||this.EXCHANGE_KEY_NAME),x=await cn(e.signingKeyName||this.WRITE_KEY_NAME);c||(f=!1,c=await this._createExchangeKeys(e.extractable)),x||(f=!1,x=await this._createWriteKeys(e.extractable));let l=await qr(x),S=await tt(new Uint8Array(l),this.TYPE==="ecc"?"ed25519":"rsa"),k=new this({keys:{exchange:c,write:x},did:S,hasPersisted:f,isSessionOnly:!!e.session});return this._instance=k,k}};y(Jr,"AbstractKeys"),O(Jr,"EXCHANGE_KEY_NAME"),O(Jr,"WRITE_KEY_NAME"),O(Jr,"_instance");var ft=Jr;async function af(n,e){let{content:f,publicKey:c}=n,x=e||await yr.create(),l=await yr.encrypt(typeof f=="string"?gr(f):f,typeof x=="string"?await yr.import(x):x),S=await xn({key:x,publicKey:c});return Fr(S,l)}y(af,"encryptTo");af.asString=async function(n,e){let f=await af(n,e);return cr(new Uint8Array(f),"base64pad")};async function xn({key:n,publicKey:e},f){let c;n instanceof CryptoKey?c=await yr.export(n):c=n;let x=await Gr.encrypt(c,e);return f&&f==="arraybuffer"?x:new Uint8Array(x)}y(xn,"encryptKeyTo");xn.asString=async function({key:n,publicKey:e},f){let c=await xn({key:n,publicKey:e});return f?cr(c,f):Rr(c)};async function Ji(n){let e=await qn(new TextEncoder().encode(n.normalize("NFD")));return cr(e,"base32").slice(0,32)}y(Ji,"getDeviceName");function sf(n){return new Uint8Array(n).buffer}y(sf,"toArrayBuffer");var Vr=class Vr extends ft{static async create(e,f,c){return await super.create(e,f,c)}constructor(e){super(e),Vr.EXCHANGE_KEY_NAME=e.exchangeKeyName||rn,Vr.WRITE_KEY_NAME=e.writeKeyName||en}static async _createExchangeKeys(e=!1){return await nn(qt,de,"exchange",e)}static async _createWriteKeys(e=!1){return await nn(qt,de,"write",e)}async toJson(e){let f=this.publicExchangeKey,c=this.DID,x=await tr.subtle.exportKey("spki",f);return{publicExchangeKey:e?cr(new Uint8Array(x),e):Rr(x),DID:c}}async sign(e,f=jr){let c=this.writeKey,x=await Gr.sign(e,c.privateKey,f);return new Uint8Array(x)}async signAsString(e,f){let c=await this.sign(e,f);return Rr(c)}async encrypt(e,f,c,x,l){let S=f||this.exchangeKey.publicKey,k=c,nr=x,Kr=k||await yr.create({length:nr||l}),hr=await yr.encrypt(typeof e=="string"?gr(e):e,typeof Kr=="string"?await yr.import(Kr):Kr),Tr=await ze({key:Kr,publicKey:S}),Xr=Fr(Tr,hr);return new Uint8Array(Xr)}async encryptAsString(e,f,c,x,l){let S=await this.encrypt(e,f,c,x,l);return cr(S,"base64pad")}async decrypt(e,f,c){let x=(typeof f=="number"?f:void 0)||ie,l=Me(e,$r),S=l.slice(0,x),k=l.slice(x),nr=await this.decryptKey(S);return await yr.decrypt(k,nr)}async decryptAsString(e,f,c){let x=await this.decrypt(e,f,c);return cr(x)}async decryptKey(e){return await Gr.decrypt(e,this.exchangeKey.privateKey)}async decryptKeyAsString(e,f){let c=await Gr.decrypt(e,this.exchangeKey.privateKey);return cr(c,f)}async getAesKey(e,f){if(!e)throw new Error("RSA requires an encrypted AES key to decrypt");if(typeof e=="string"){let c=await this.decryptKey(e);return await yr.import(c)}else return e}};y(Vr,"RsaKeys"),O(Vr,"TYPE","rsa"),O(Vr,"INFO","keys"),O(Vr,"EXCHANGE_KEY_NAME",rn),O(Vr,"WRITE_KEY_NAME",en);var me=Vr;Object.assign(me.prototype.sign,{asString:y(async function(n,e){return this.signAsString(n,e)},"asString")});Object.assign(me.prototype.encrypt,{asString:y(async function(n,e,f,c){return this.encryptAsString(n,e,f,c)},"asString")});Object.assign(me.prototype.decrypt,{asString:y(async function(n,e){return this.decryptAsString(n,e)},"asString")});async function Gs(n,e,f){let c=Qn(f),x=await Re(c.publicKey.buffer,"SHA-256","signing");try{return Gr.verify(n,e,x)}catch{return!1}}y(Gs,"verify");Object.assign(me.prototype.decryptKey,{asString:y(async function(n,e){return this.decryptKeyAsString(n,e)},"asString")});async function Qi(n,e){let{content:f,publicKey:c}=n,x=e||await yr.create(),l=await yr.encrypt(typeof f=="string"?gr(f):f,typeof x=="string"?await yr.import(x):x),S=await ze({key:x,publicKey:c});return Fr(S,l)}y(Qi,"encryptTo");Qi.asString=async function(n,e){let{content:f,publicKey:c}=n,x=e||await yr.create(),l=await yr.encrypt(typeof f=="string"?gr(f):f,typeof x=="string"?await yr.import(x):x,"arraybuffer"),S=await ze({key:x,publicKey:c}),k=Fr(S,l);return cr(new Uint8Array(k),"base64pad")};async function ze({key:n,publicKey:e},f){let c;n instanceof CryptoKey?c=await yr.export(n):c=n;let x=await Gr.encrypt(c,e);return f&&f==="arraybuffer"?x:new Uint8Array(x)}y(ze,"encryptKeyTo");ze.asString=async function({key:n,publicKey:e},f){let c=await ze({key:n,publicKey:e});return f?cr(c,f):Rr(c)};async function Vs(n,e,f,c){let x=be(e)?e:await Ne(e),l=c?await tr.subtle.encrypt({name:Hr,iv:sf(c)},x,sf(n)):await ro(n,x);return f&&f==="arraybuffer"?l:new Uint8Array(l)}y(Vs,"encrypt");async function ro(n,e,f){let c=Zr(n,f?.charsize??jr),x=typeof e=="string"?await Le(e,f):e,l=f?.iv||rt(ge),S=await tr.subtle.encrypt({name:Hr,iv:l},x,c);return Fr(l,S)}y(ro,"encryptBytes");export{Hr as AES_GCM,te as BASE58_DID_PREFIX,Jt as BLS_DID_PREFIX,jr as DEFAULT_CHAR_SIZE,Za as DEFAULT_ECC_EXCHANGE,ka as DEFAULT_ECC_EXCHANGE_CURVE,qa as DEFAULT_ECC_WRITE,de as DEFAULT_HASH_ALGORITHM,rn as DEFAULT_RSA_EXCHANGE,qt as DEFAULT_RSA_SIZE,en as DEFAULT_RSA_WRITE,le as DEFAULT_SYMM_ALGORITHM,ie as DEFAULT_SYMM_LENGTH,Xa as ECC_EXCHANGE_ALG,$a as ECC_EXCHANGE_NAME,Va as ECC_WRITE_ALG,Wa as ECC_WRITE_NAME,Qt as EDWARDS_DID_PREFIX,ge as IV_LENGTH,Je as KEY_TYPE,Li as KEY_USE,ne as RSA_ALGORITHM,Zt as RSA_DID_PREFIX,$t as RSA_HASHING_ALGORITHM,fe as RSA_SIGN_ALGORITHM,me as RsaKeys,tn as SALT_LENGTH,Vs as encrypt,ze as encryptKeyTo,Qi as encryptTo,qr as getPublicKeyAsArrayBuffer,nf as getPublicKeyAsUint8Array,tt as publicKeyToDid,Gs as verify};
4
4
  //# sourceMappingURL=index.min.js.map