@substrate-system/keys 0.2.34 → 0.2.36
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.
- package/README.md +131 -13
- package/dist/_base.min.js +2 -2
- package/dist/_base.min.js.map +3 -3
- package/dist/aes/index.min.js +2 -2
- package/dist/aes/index.min.js.map +3 -3
- package/dist/browser/index.js +107 -15
- package/dist/browser/index.min.js +2 -2
- package/dist/constants.cjs +4 -8
- package/dist/constants.cjs.map +2 -2
- package/dist/constants.d.ts +2 -4
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +4 -8
- package/dist/constants.js.map +2 -2
- package/dist/constants.min.cjs +1 -1
- package/dist/constants.min.cjs.map +3 -3
- package/dist/constants.min.js +1 -1
- package/dist/constants.min.js.map +3 -3
- package/dist/crypto.min.js +2 -2
- package/dist/crypto.min.js.map +3 -3
- package/dist/ecc/index.cjs +103 -7
- package/dist/ecc/index.cjs.map +2 -2
- package/dist/ecc/index.d.ts +34 -3
- package/dist/ecc/index.d.ts.map +1 -1
- package/dist/ecc/index.js +105 -11
- package/dist/ecc/index.js.map +2 -2
- package/dist/ecc/index.min.cjs +1 -1
- package/dist/ecc/index.min.cjs.map +3 -3
- package/dist/ecc/index.min.js +2 -2
- package/dist/ecc/index.min.js.map +3 -3
- package/dist/errors.min.js +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +3 -3
- package/dist/meta.json +14 -16
- package/dist/rsa/index.cjs.map +2 -2
- package/dist/rsa/index.d.ts.map +1 -1
- package/dist/rsa/index.js.map +2 -2
- package/dist/rsa/index.min.cjs.map +2 -2
- package/dist/rsa/index.min.js +2 -2
- package/dist/rsa/index.min.js.map +3 -3
- package/dist/types.cjs.map +2 -2
- package/dist/types.d.ts +10 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +2 -2
- package/dist/types.min.cjs +1 -1
- package/dist/types.min.cjs.map +2 -2
- package/dist/types.min.js +1 -1
- package/dist/types.min.js.map +2 -2
- package/dist/util.min.js +1 -1
- package/dist/util.min.js.map +3 -3
- package/package.json +4 -10
package/dist/ecc/index.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Af=Object.create;var Ee=Object.defineProperty;var mf=Object.getOwnPropertyDescriptor;var wf=Object.getOwnPropertyNames;var Ef=Object.getPrototypeOf,Kf=Object.prototype.hasOwnProperty;var vf=(n,e,f)=>e in n?Ee(n,e,{enumerable:!0,configurable:!0,writable:!0,value:f}):n[e]=f;var y=(n,e)=>Ee(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),Dr=(n,e)=>{for(var f in e)Ee(n,f,{get:e[f],enumerable:!0})},Uf=(n,e,f,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let x of wf(e))!Kf.call(n,x)&&x!==f&&Ee(n,x,{get:()=>e[x],enumerable:!(c=mf(e,x))||c.enumerable});return n};var Sf=(n,e,f)=>(f=n!=null?Af(Ef(n)):{},Uf(e||!n||!n.__esModule?Ee(f,"default",{value:n,enumerable:!0}):f,n));var O=(n,e,f)=>vf(n,typeof e!="symbol"?e+"":e,f);var af=_n(()=>{"use strict"});var sf=_n((ls,Je)=>{"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]),Y=e([56129,1]),er=e([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),br=e([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),sr=e([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),vr=e([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),Yr=e([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function te(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(te,"ts64");function $(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($,"vn");function cr(t,o,i,r){return $(t,o,i,r,16)}y(cr,"crypto_verify_16");function Ur(t,o,i,r){return $(t,o,i,r,32)}y(Ur,"crypto_verify_32");function Er(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,E=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,v=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,H=i[16]&255|(i[17]&255)<<8|(i[18]&255)<<16|(i[19]&255)<<24,j=i[20]&255|(i[21]&255)<<8|(i[22]&255)<<16|(i[23]&255)<<24,N=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,R=r[12]&255|(r[13]&255)<<8|(r[14]&255)<<16|(r[15]&255)<<24,C=a,D=u,U=p,B=b,P=E,K=T,h=v,d=q,m=_,g=M,A=L,w=H,I=j,F=N,V=z,G=R,s,k=0;k<20;k+=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=K+D|0,g^=s<<7|s>>>25,s=g+K|0,F^=s<<9|s>>>23,s=F+g|0,D^=s<<13|s>>>19,s=D+F|0,K^=s<<18|s>>>14,s=A+h|0,V^=s<<7|s>>>25,s=V+A|0,U^=s<<9|s>>>23,s=U+V|0,h^=s<<13|s>>>19,s=h+U|0,A^=s<<18|s>>>14,s=G+w|0,B^=s<<7|s>>>25,s=B+G|0,d^=s<<9|s>>>23,s=d+B|0,w^=s<<13|s>>>19,s=w+d|0,G^=s<<18|s>>>14,s=C+B|0,D^=s<<7|s>>>25,s=D+C|0,U^=s<<9|s>>>23,s=U+D|0,B^=s<<13|s>>>19,s=B+U|0,C^=s<<18|s>>>14,s=K+P|0,h^=s<<7|s>>>25,s=h+K|0,d^=s<<9|s>>>23,s=d+h|0,P^=s<<13|s>>>19,s=P+d|0,K^=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=G+V|0,I^=s<<7|s>>>25,s=I+G|0,F^=s<<9|s>>>23,s=F+I|0,V^=s<<13|s>>>19,s=V+F|0,G^=s<<18|s>>>14;C=C+a|0,D=D+u|0,U=U+p|0,B=B+b|0,P=P+E|0,K=K+T|0,h=h+v|0,d=d+q|0,m=m+_|0,g=g+M|0,A=A+L|0,w=w+H|0,I=I+j|0,F=F+N|0,V=V+z|0,G=G+R|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]=U>>>0&255,t[9]=U>>>8&255,t[10]=U>>>16&255,t[11]=U>>>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]=K>>>0&255,t[21]=K>>>8&255,t[22]=K>>>16&255,t[23]=K>>>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]=F>>>0&255,t[53]=F>>>8&255,t[54]=F>>>16&255,t[55]=F>>>24&255,t[56]=V>>>0&255,t[57]=V>>>8&255,t[58]=V>>>16&255,t[59]=V>>>24&255,t[60]=G>>>0&255,t[61]=G>>>8&255,t[62]=G>>>16&255,t[63]=G>>>24&255}y(Er,"core_salsa20");function lr(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,E=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,v=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,H=i[16]&255|(i[17]&255)<<8|(i[18]&255)<<16|(i[19]&255)<<24,j=i[20]&255|(i[21]&255)<<8|(i[22]&255)<<16|(i[23]&255)<<24,N=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,R=r[12]&255|(r[13]&255)<<8|(r[14]&255)<<16|(r[15]&255)<<24,C=a,D=u,U=p,B=b,P=E,K=T,h=v,d=q,m=_,g=M,A=L,w=H,I=j,F=N,V=z,G=R,s,k=0;k<20;k+=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=K+D|0,g^=s<<7|s>>>25,s=g+K|0,F^=s<<9|s>>>23,s=F+g|0,D^=s<<13|s>>>19,s=D+F|0,K^=s<<18|s>>>14,s=A+h|0,V^=s<<7|s>>>25,s=V+A|0,U^=s<<9|s>>>23,s=U+V|0,h^=s<<13|s>>>19,s=h+U|0,A^=s<<18|s>>>14,s=G+w|0,B^=s<<7|s>>>25,s=B+G|0,d^=s<<9|s>>>23,s=d+B|0,w^=s<<13|s>>>19,s=w+d|0,G^=s<<18|s>>>14,s=C+B|0,D^=s<<7|s>>>25,s=D+C|0,U^=s<<9|s>>>23,s=U+D|0,B^=s<<13|s>>>19,s=B+U|0,C^=s<<18|s>>>14,s=K+P|0,h^=s<<7|s>>>25,s=h+K|0,d^=s<<9|s>>>23,s=d+h|0,P^=s<<13|s>>>19,s=P+d|0,K^=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=G+V|0,I^=s<<7|s>>>25,s=I+G|0,F^=s<<9|s>>>23,s=F+I|0,V^=s<<13|s>>>19,s=V+F|0,G^=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]=K>>>0&255,t[5]=K>>>8&255,t[6]=K>>>16&255,t[7]=K>>>24&255,t[8]=A>>>0&255,t[9]=A>>>8&255,t[10]=A>>>16&255,t[11]=A>>>24&255,t[12]=G>>>0&255,t[13]=G>>>8&255,t[14]=G>>>16&255,t[15]=G>>>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(lr,"core_hsalsa20");function Kr(t,o,i,r){Er(t,o,i,r)}y(Kr,"crypto_core_salsa20");function gr(t,o,i,r){lr(t,o,i,r)}y(gr,"crypto_core_hsalsa20");var hr=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),E=new Uint8Array(64),T,v;for(v=0;v<16;v++)b[v]=0;for(v=0;v<8;v++)b[v]=u[v];for(;a>=64;){for(Kr(E,b,p,hr),v=0;v<64;v++)t[o+v]=i[r+v]^E[v];for(T=1,v=8;v<16;v++)T=T+(b[v]&255)|0,b[v]=T&255,T>>>=8;a-=64,o+=64,r+=64}if(a>0)for(Kr(E,b,p,hr),v=0;v<a;v++)t[o+v]=i[r+v]^E[v];return 0}y(Ir,"crypto_stream_salsa20_xor");function Sr(t,o,i,r,a){var u=new Uint8Array(16),p=new Uint8Array(64),b,E;for(E=0;E<16;E++)u[E]=0;for(E=0;E<8;E++)u[E]=r[E];for(;i>=64;){for(Kr(p,u,a,hr),E=0;E<64;E++)t[o+E]=p[E];for(b=1,E=8;E<16;E++)b=b+(u[E]&255)|0,u[E]=b&255,b>>>=8;i-=64,o+=64}if(i>0)for(Kr(p,u,a,hr),E=0;E<i;E++)t[o+E]=p[E];return 0}y(Sr,"crypto_stream_salsa20");function Pr(t,o,i,r,a){var u=new Uint8Array(32);gr(u,r,a,hr);for(var p=new Uint8Array(8),b=0;b<8;b++)p[b]=r[b+16];return Sr(t,o,i,p,u)}y(Pr,"crypto_stream");function Vr(t,o,i,r,a,u,p){var b=new Uint8Array(32);gr(b,u,p,hr);for(var E=new Uint8Array(8),T=0;T<8;T++)E[T]=u[T+16];return Ir(t,o,i,r,a,E,b)}y(Vr,"crypto_stream_xor");var Ie=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,E;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,E=t[14]&255|(t[15]&255)<<8,this.r[8]=(b>>>8|E<<8)&8191,this.r[9]=E>>>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");Ie.prototype.blocks=function(t,o,i){for(var r=this.fin?0:2048,a,u,p,b,E,T,v,q,_,M,L,H,j,N,z,R,C,D,U,B=this.h[0],P=this.h[1],K=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],F=this.r[0],V=this.r[1],G=this.r[2],s=this.r[3],k=this.r[4],Q=this.r[5],rr=this.r[6],X=this.r[7],Z=this.r[8],J=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,K+=(u>>>10|p<<6)&8191,b=t[o+6]&255|(t[o+7]&255)<<8,h+=(p>>>7|b<<9)&8191,E=t[o+8]&255|(t[o+9]&255)<<8,d+=(b>>>4|E<<12)&8191,m+=E>>>1&8191,T=t[o+10]&255|(t[o+11]&255)<<8,g+=(E>>>14|T<<2)&8191,v=t[o+12]&255|(t[o+13]&255)<<8,A+=(T>>>11|v<<5)&8191,q=t[o+14]&255|(t[o+15]&255)<<8,w+=(v>>>8|q<<8)&8191,I+=q>>>5|r,_=0,M=_,M+=B*F,M+=P*(5*J),M+=K*(5*Z),M+=h*(5*X),M+=d*(5*rr),_=M>>>13,M&=8191,M+=m*(5*Q),M+=g*(5*k),M+=A*(5*s),M+=w*(5*G),M+=I*(5*V),_+=M>>>13,M&=8191,L=_,L+=B*V,L+=P*F,L+=K*(5*J),L+=h*(5*Z),L+=d*(5*X),_=L>>>13,L&=8191,L+=m*(5*rr),L+=g*(5*Q),L+=A*(5*k),L+=w*(5*s),L+=I*(5*G),_+=L>>>13,L&=8191,H=_,H+=B*G,H+=P*V,H+=K*F,H+=h*(5*J),H+=d*(5*Z),_=H>>>13,H&=8191,H+=m*(5*X),H+=g*(5*rr),H+=A*(5*Q),H+=w*(5*k),H+=I*(5*s),_+=H>>>13,H&=8191,j=_,j+=B*s,j+=P*G,j+=K*V,j+=h*F,j+=d*(5*J),_=j>>>13,j&=8191,j+=m*(5*Z),j+=g*(5*X),j+=A*(5*rr),j+=w*(5*Q),j+=I*(5*k),_+=j>>>13,j&=8191,N=_,N+=B*k,N+=P*s,N+=K*G,N+=h*V,N+=d*F,_=N>>>13,N&=8191,N+=m*(5*J),N+=g*(5*Z),N+=A*(5*X),N+=w*(5*rr),N+=I*(5*Q),_+=N>>>13,N&=8191,z=_,z+=B*Q,z+=P*k,z+=K*s,z+=h*G,z+=d*V,_=z>>>13,z&=8191,z+=m*F,z+=g*(5*J),z+=A*(5*Z),z+=w*(5*X),z+=I*(5*rr),_+=z>>>13,z&=8191,R=_,R+=B*rr,R+=P*Q,R+=K*k,R+=h*s,R+=d*G,_=R>>>13,R&=8191,R+=m*V,R+=g*F,R+=A*(5*J),R+=w*(5*Z),R+=I*(5*X),_+=R>>>13,R&=8191,C=_,C+=B*X,C+=P*rr,C+=K*Q,C+=h*k,C+=d*s,_=C>>>13,C&=8191,C+=m*G,C+=g*V,C+=A*F,C+=w*(5*J),C+=I*(5*Z),_+=C>>>13,C&=8191,D=_,D+=B*Z,D+=P*X,D+=K*rr,D+=h*Q,D+=d*k,_=D>>>13,D&=8191,D+=m*s,D+=g*G,D+=A*V,D+=w*F,D+=I*(5*J),_+=D>>>13,D&=8191,U=_,U+=B*J,U+=P*Z,U+=K*X,U+=h*rr,U+=d*Q,_=U>>>13,U&=8191,U+=m*k,U+=g*s,U+=A*G,U+=w*V,U+=I*F,_+=U>>>13,U&=8191,_=(_<<2)+_|0,_=_+M|0,M=_&8191,_=_>>>13,L+=_,B=M,P=L,K=H,h=j,d=N,m=z,g=R,A=C,w=D,I=U,o+=16,i-=16;this.h[0]=B,this.h[1]=P,this.h[2]=K,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},Ie.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},Ie.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 tt(t,o,i,r,a,u){var p=new Ie(u);return p.update(i,r,a),p.finish(t,o),0}y(tt,"crypto_onetimeauth");function un(t,o,i,r,a,u){var p=new Uint8Array(16);return tt(p,0,i,r,a,u),cr(t,o,p,0)}y(un,"crypto_onetimeauth_verify");function nt(t,o,i,r,a){var u;if(i<32)return-1;for(Vr(t,0,o,0,i,r,a),tt(t,16,t,32,i-32,t),u=0;u<16;u++)t[u]=0;return 0}y(nt,"crypto_secretbox");function ft(t,o,i,r,a){var u,p=new Uint8Array(32);if(i<32||(Pr(p,0,32,r,a),un(o,16,o,32,i-32,p)!==0))return-1;for(Vr(t,0,o,0,i,r,a),u=0;u<32;u++)t[u]=0;return 0}y(ft,"crypto_secretbox_open");function jr(t,o){var i;for(i=0;i<16;i++)t[i]=o[i]|0}y(jr,"set25519");function it(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(it,"car25519");function ne(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(ne,"sel25519");function fe(t,o){var i,r,a,u=e(),p=e();for(i=0;i<16;i++)p[i]=o[i];for(it(p),it(p),it(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,ne(p,u,1-a)}for(i=0;i<16;i++)t[2*i]=p[i]&255,t[2*i+1]=p[i]>>8}y(fe,"pack25519");function pn(t,o){var i=new Uint8Array(32),r=new Uint8Array(32);return fe(i,t),fe(r,o),Ur(i,0,r,0)}y(pn,"neq25519");function hn(t){var o=new Uint8Array(32);return fe(o,t),o[0]&1}y(hn,"par25519");function ot(t,o){var i;for(i=0;i<16;i++)t[i]=o[2*i]+(o[2*i+1]<<8);t[15]&=32767}y(ot,"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,E=0,T=0,v=0,q=0,_=0,M=0,L=0,H=0,j=0,N=0,z=0,R=0,C=0,D=0,U=0,B=0,P=0,K=0,h=0,d=0,m=0,g=0,A=0,w=0,I=0,F=0,V=0,G=0,s=i[0],k=i[1],Q=i[2],rr=i[3],X=i[4],Z=i[5],J=i[6],yr=i[7],nr=i[8],fr=i[9],ir=i[10],or=i[11],pr=i[12],Ar=i[13],mr=i[14],wr=i[15];r=o[0],u+=r*s,p+=r*k,b+=r*Q,E+=r*rr,T+=r*X,v+=r*Z,q+=r*J,_+=r*yr,M+=r*nr,L+=r*fr,H+=r*ir,j+=r*or,N+=r*pr,z+=r*Ar,R+=r*mr,C+=r*wr,r=o[1],p+=r*s,b+=r*k,E+=r*Q,T+=r*rr,v+=r*X,q+=r*Z,_+=r*J,M+=r*yr,L+=r*nr,H+=r*fr,j+=r*ir,N+=r*or,z+=r*pr,R+=r*Ar,C+=r*mr,D+=r*wr,r=o[2],b+=r*s,E+=r*k,T+=r*Q,v+=r*rr,q+=r*X,_+=r*Z,M+=r*J,L+=r*yr,H+=r*nr,j+=r*fr,N+=r*ir,z+=r*or,R+=r*pr,C+=r*Ar,D+=r*mr,U+=r*wr,r=o[3],E+=r*s,T+=r*k,v+=r*Q,q+=r*rr,_+=r*X,M+=r*Z,L+=r*J,H+=r*yr,j+=r*nr,N+=r*fr,z+=r*ir,R+=r*or,C+=r*pr,D+=r*Ar,U+=r*mr,B+=r*wr,r=o[4],T+=r*s,v+=r*k,q+=r*Q,_+=r*rr,M+=r*X,L+=r*Z,H+=r*J,j+=r*yr,N+=r*nr,z+=r*fr,R+=r*ir,C+=r*or,D+=r*pr,U+=r*Ar,B+=r*mr,P+=r*wr,r=o[5],v+=r*s,q+=r*k,_+=r*Q,M+=r*rr,L+=r*X,H+=r*Z,j+=r*J,N+=r*yr,z+=r*nr,R+=r*fr,C+=r*ir,D+=r*or,U+=r*pr,B+=r*Ar,P+=r*mr,K+=r*wr,r=o[6],q+=r*s,_+=r*k,M+=r*Q,L+=r*rr,H+=r*X,j+=r*Z,N+=r*J,z+=r*yr,R+=r*nr,C+=r*fr,D+=r*ir,U+=r*or,B+=r*pr,P+=r*Ar,K+=r*mr,h+=r*wr,r=o[7],_+=r*s,M+=r*k,L+=r*Q,H+=r*rr,j+=r*X,N+=r*Z,z+=r*J,R+=r*yr,C+=r*nr,D+=r*fr,U+=r*ir,B+=r*or,P+=r*pr,K+=r*Ar,h+=r*mr,d+=r*wr,r=o[8],M+=r*s,L+=r*k,H+=r*Q,j+=r*rr,N+=r*X,z+=r*Z,R+=r*J,C+=r*yr,D+=r*nr,U+=r*fr,B+=r*ir,P+=r*or,K+=r*pr,h+=r*Ar,d+=r*mr,m+=r*wr,r=o[9],L+=r*s,H+=r*k,j+=r*Q,N+=r*rr,z+=r*X,R+=r*Z,C+=r*J,D+=r*yr,U+=r*nr,B+=r*fr,P+=r*ir,K+=r*or,h+=r*pr,d+=r*Ar,m+=r*mr,g+=r*wr,r=o[10],H+=r*s,j+=r*k,N+=r*Q,z+=r*rr,R+=r*X,C+=r*Z,D+=r*J,U+=r*yr,B+=r*nr,P+=r*fr,K+=r*ir,h+=r*or,d+=r*pr,m+=r*Ar,g+=r*mr,A+=r*wr,r=o[11],j+=r*s,N+=r*k,z+=r*Q,R+=r*rr,C+=r*X,D+=r*Z,U+=r*J,B+=r*yr,P+=r*nr,K+=r*fr,h+=r*ir,d+=r*or,m+=r*pr,g+=r*Ar,A+=r*mr,w+=r*wr,r=o[12],N+=r*s,z+=r*k,R+=r*Q,C+=r*rr,D+=r*X,U+=r*Z,B+=r*J,P+=r*yr,K+=r*nr,h+=r*fr,d+=r*ir,m+=r*or,g+=r*pr,A+=r*Ar,w+=r*mr,I+=r*wr,r=o[13],z+=r*s,R+=r*k,C+=r*Q,D+=r*rr,U+=r*X,B+=r*Z,P+=r*J,K+=r*yr,h+=r*nr,d+=r*fr,m+=r*ir,g+=r*or,A+=r*pr,w+=r*Ar,I+=r*mr,F+=r*wr,r=o[14],R+=r*s,C+=r*k,D+=r*Q,U+=r*rr,B+=r*X,P+=r*Z,K+=r*J,h+=r*yr,d+=r*nr,m+=r*fr,g+=r*ir,A+=r*or,w+=r*pr,I+=r*Ar,F+=r*mr,V+=r*wr,r=o[15],C+=r*s,D+=r*k,U+=r*Q,B+=r*rr,P+=r*X,K+=r*Z,h+=r*J,d+=r*yr,m+=r*nr,g+=r*fr,A+=r*ir,w+=r*or,I+=r*pr,F+=r*Ar,V+=r*mr,G+=r*wr,u+=38*D,p+=38*U,b+=38*B,E+=38*P,T+=38*K,v+=38*h,q+=38*d,_+=38*m,M+=38*g,L+=38*A,H+=38*w,j+=38*I,N+=38*F,z+=38*V,R+=38*G,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=E+a+65535,a=Math.floor(r/65536),E=r-a*65536,r=T+a+65535,a=Math.floor(r/65536),T=r-a*65536,r=v+a+65535,a=Math.floor(r/65536),v=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=H+a+65535,a=Math.floor(r/65536),H=r-a*65536,r=j+a+65535,a=Math.floor(r/65536),j=r-a*65536,r=N+a+65535,a=Math.floor(r/65536),N=r-a*65536,r=z+a+65535,a=Math.floor(r/65536),z=r-a*65536,r=R+a+65535,a=Math.floor(r/65536),R=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=E+a+65535,a=Math.floor(r/65536),E=r-a*65536,r=T+a+65535,a=Math.floor(r/65536),T=r-a*65536,r=v+a+65535,a=Math.floor(r/65536),v=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=H+a+65535,a=Math.floor(r/65536),H=r-a*65536,r=j+a+65535,a=Math.floor(r/65536),j=r-a*65536,r=N+a+65535,a=Math.floor(r/65536),N=r-a*65536,r=z+a+65535,a=Math.floor(r/65536),z=r-a*65536,r=R+a+65535,a=Math.floor(r/65536),R=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]=E,t[4]=T,t[5]=v,t[6]=q,t[7]=_,t[8]=M,t[9]=L,t[10]=H,t[11]=j,t[12]=N,t[13]=z,t[14]=R,t[15]=C}y(W,"M");function Tr(t,o){W(t,o,o)}y(Tr,"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--)Tr(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--)Tr(i,i),r!==1&&W(i,i,o);for(r=0;r<16;r++)t[r]=i[r]}y(ln,"pow2523");function Me(t,o,i){var r=new Uint8Array(32),a=new Float64Array(80),u,p,b=e(),E=e(),T=e(),v=e(),q=e(),_=e();for(p=0;p<31;p++)r[p]=o[p];for(r[31]=o[31]&127|64,r[0]&=248,ot(a,i),p=0;p<16;p++)E[p]=a[p],v[p]=b[p]=T[p]=0;for(b[0]=v[0]=1,p=254;p>=0;--p)u=r[p>>>3]>>>(p&7)&1,ne(b,E,u),ne(T,v,u),Mr(q,b,T),Lr(b,b,T),Mr(T,E,v),Lr(E,E,v),Tr(v,q),Tr(_,b),W(b,T,b),W(T,E,q),Mr(q,b,T),Lr(b,b,T),Tr(E,b),Lr(T,v,_),W(b,T,Y),Mr(b,b,v),W(T,T,b),W(b,v,_),W(v,E,a),Tr(E,q),ne(b,E,u),ne(T,v,u);for(p=0;p<16;p++)a[p+16]=b[p],a[p+32]=T[p],a[p+48]=E[p],a[p+64]=v[p];var M=a.subarray(32),L=a.subarray(16);return dn(M,M),W(L,L,M),fe(t,L),0}y(Me,"crypto_scalarmult");function Le(t,o){return Me(t,o,x)}y(Le,"crypto_scalarmult_base");function gn(t,o){return f(o,32),Le(t,o)}y(gn,"crypto_box_keypair");function Ne(t,o,i){var r=new Uint8Array(32);return Me(r,i,o),gr(t,c,r,hr)}y(Ne,"crypto_box_beforenm");var bn=nt,uf=ft;function pf(t,o,i,r,a,u){var p=new Uint8Array(32);return Ne(p,a,u),bn(t,o,i,r,p)}y(pf,"crypto_box");function hf(t,o,i,r,a,u){var p=new Uint8Array(32);return Ne(p,a,u),uf(t,o,i,r,p)}y(hf,"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,E,T,v,q,_,M,L,H,j,N,z,R,C,D,U,B,P,K,h,d,m,g,A,w,I=t[0],F=t[1],V=t[2],G=t[3],s=t[4],k=t[5],Q=t[6],rr=t[7],X=o[0],Z=o[1],J=o[2],yr=o[3],nr=o[4],fr=o[5],ir=o[6],or=o[7],pr=0;r>=128;){for(P=0;P<16;P++)K=8*P+pr,a[P]=i[K+0]<<24|i[K+1]<<16|i[K+2]<<8|i[K+3],u[P]=i[K+4]<<24|i[K+5]<<16|i[K+6]<<8|i[K+7];for(P=0;P<80;P++)if(p=I,b=F,E=V,T=G,v=s,q=k,_=Q,M=rr,L=X,H=Z,j=J,N=yr,z=nr,R=fr,C=ir,D=or,h=rr,d=or,m=d&65535,g=d>>>16,A=h&65535,w=h>>>16,h=(s>>>14|nr<<18)^(s>>>18|nr<<14)^(nr>>>9|s<<23),d=(nr>>>14|s<<18)^(nr>>>18|s<<14)^(s>>>9|nr<<23),m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,h=s&k^~s&Q,d=nr&fr^~nr&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,U=A&65535|w<<16,B=m&65535|g<<16,h=U,d=B,m=d&65535,g=d>>>16,A=h&65535,w=h>>>16,h=(I>>>28|X<<4)^(X>>>2|I<<30)^(X>>>7|I<<25),d=(X>>>28|I<<4)^(I>>>2|X<<30)^(I>>>7|X<<25),m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,h=I&F^I&V^F&V,d=X&Z^X&J^Z&J,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=N,m=d&65535,g=d>>>16,A=h&65535,w=h>>>16,h=U,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,N=m&65535|g<<16,F=p,V=b,G=E,s=T,k=v,Q=q,rr=_,I=M,Z=L,J=H,yr=j,nr=N,fr=z,ir=R,or=C,X=D,P%16===15)for(K=0;K<16;K++)h=a[K],d=u[K],m=d&65535,g=d>>>16,A=h&65535,w=h>>>16,h=a[(K+9)%16],d=u[(K+9)%16],m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,U=a[(K+1)%16],B=u[(K+1)%16],h=(U>>>1|B<<31)^(U>>>8|B<<24)^U>>>7,d=(B>>>1|U<<31)^(B>>>8|U<<24)^(B>>>7|U<<25),m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,U=a[(K+14)%16],B=u[(K+14)%16],h=(U>>>19|B<<13)^(B>>>29|U<<3)^U>>>6,d=(B>>>19|U<<13)^(U>>>29|B<<3)^(B>>>6|U<<26),m+=d&65535,g+=d>>>16,A+=h&65535,w+=h>>>16,g+=m>>>16,A+=g>>>16,w+=A>>>16,a[K]=A&65535|w<<16,u[K]=m&65535|g<<16;h=I,d=X,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]=X=m&65535|g<<16,h=F,d=Z,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]=F=A&65535|w<<16,o[1]=Z=m&65535|g<<16,h=V,d=J,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]=V=A&65535|w<<16,o[2]=J=m&65535|g<<16,h=G,d=yr,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]=G=A&65535|w<<16,o[3]=yr=m&65535|g<<16,h=s,d=nr,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]=nr=m&65535|g<<16,h=k,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]=k=A&65535|w<<16,o[5]=fr=m&65535|g<<16,h=Q,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]=Q=A&65535|w<<16,o[6]=ir=m&65535|g<<16,h=rr,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]=rr=A&65535|w<<16,o[7]=or=m&65535|g<<16,pr+=128,r-=128}return r}y(mn,"crypto_hashblocks_hl");function $r(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,te(u,i-8,b/536870912|0,b<<3),mn(r,a,u,i),p=0;p<8;p++)te(t,8*p,r[p],a[p]);return 0}y($r,"crypto_hash");function Re(t,o){var i=e(),r=e(),a=e(),u=e(),p=e(),b=e(),E=e(),T=e(),v=e();Lr(i,t[1],t[0]),Lr(v,o[1],o[0]),W(i,i,v),Mr(r,t[0],t[1]),Mr(v,o[0],o[1]),W(r,r,v),W(a,t[3],o[3]),W(a,a,br),W(u,t[2],o[2]),Mr(u,u,u),Lr(p,r,i),Lr(b,u,a),Mr(E,u,a),Mr(T,r,i),W(t[0],p,b),W(t[1],T,E),W(t[2],E,b),W(t[3],p,T)}y(Re,"add");function wn(t,o,i){var r;for(r=0;r<4;r++)ne(t[r],o[r],i)}y(wn,"cswap");function at(t,o){var i=e(),r=e(),a=e();dn(a,o[2]),W(i,o[0],a),W(r,o[1],a),fe(t,r),t[31]^=hn(i)<<7}y(at,"pack");function st(t,o,i){var r,a;for(jr(t[0],l),jr(t[1],S),jr(t[2],S),jr(t[3],l),a=255;a>=0;--a)r=i[a/8|0]>>(a&7)&1,wn(t,o,r),Re(o,t),Re(t,t),wn(t,o,r)}y(st,"scalarmult");function ze(t,o){var i=[e(),e(),e(),e()];jr(i[0],sr),jr(i[1],vr),jr(i[2],S),W(i[3],sr,vr),st(t,i,o)}y(ze,"scalarbase");function ct(t,o,i){var r=new Uint8Array(64),a=[e(),e(),e(),e()],u;for(i||f(o,32),$r(r,o,32),r[0]&=248,r[31]&=127,r[31]|=64,ze(a,r),at(t,a),u=0;u<32;u++)o[u+32]=t[u];return 0}y(ct,"crypto_sign_keypair");var Oe=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 yt(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]*Oe[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)*Oe[a],i=o[a]>>8,o[a]&=255;for(a=0;a<32;a++)o[a]-=i*Oe[a];for(r=0;r<32;r++)o[r+1]+=o[r]>>8,t[r]=o[r]&255}y(yt,"modL");function xt(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;yt(t,o)}y(xt,"reduce");function En(t,o,i,r){var a=new Uint8Array(64),u=new Uint8Array(64),p=new Uint8Array(64),b,E,T=new Float64Array(64),v=[e(),e(),e(),e()];$r(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($r(p,t.subarray(32),i+32),xt(p),ze(v,p),at(t,v),b=32;b<64;b++)t[b]=r[b];for($r(u,t,i+64),xt(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(E=0;E<32;E++)T[b+E]+=u[b]*a[E];return yt(t.subarray(32),T),q}y(En,"crypto_sign");function df(t,o){var i=e(),r=e(),a=e(),u=e(),p=e(),b=e(),E=e();return jr(t[2],S),ot(t[1],o),Tr(a,t[1]),W(u,a,er),Lr(a,a,t[2]),Mr(u,t[2],u),Tr(p,u),Tr(b,p),W(E,b,p),W(i,E,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),Tr(r,t[0]),W(r,r,u),pn(r,a)&&W(t[0],t[0],Yr),Tr(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(df,"unpackneg");function ut(t,o,i,r){var a,u=new Uint8Array(32),p=new Uint8Array(64),b=[e(),e(),e(),e()],E=[e(),e(),e(),e()];if(i<64||df(E,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($r(p,t,i),xt(p),st(b,E,p),ze(E,o.subarray(32)),Re(b,E),at(u,b),i-=64,Ur(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(ut,"crypto_sign_open");var pt=32,Ye=24,be=32,ie=16,Ae=32,je=32,me=32,we=32,ht=32,Kn=Ye,lf=be,gf=ie,Hr=64,Zr=32,oe=64,dt=32,lt=64;n.lowlevel={crypto_core_hsalsa20:gr,crypto_stream_xor:Vr,crypto_stream:Pr,crypto_stream_salsa20_xor:Ir,crypto_stream_salsa20:Sr,crypto_onetimeauth:tt,crypto_onetimeauth_verify:un,crypto_verify_16:cr,crypto_verify_32:Ur,crypto_secretbox:nt,crypto_secretbox_open:ft,crypto_scalarmult:Me,crypto_scalarmult_base:Le,crypto_box_beforenm:Ne,crypto_box_afternm:bn,crypto_box:pf,crypto_box_open:hf,crypto_box_keypair:gn,crypto_hash:$r,crypto_sign:En,crypto_sign_keypair:ct,crypto_sign_open:ut,crypto_secretbox_KEYBYTES:pt,crypto_secretbox_NONCEBYTES:Ye,crypto_secretbox_ZEROBYTES:be,crypto_secretbox_BOXZEROBYTES:ie,crypto_scalarmult_BYTES:Ae,crypto_scalarmult_SCALARBYTES:je,crypto_box_PUBLICKEYBYTES:me,crypto_box_SECRETKEYBYTES:we,crypto_box_BEFORENMBYTES:ht,crypto_box_NONCEBYTES:Kn,crypto_box_ZEROBYTES:lf,crypto_box_BOXZEROBYTES:gf,crypto_sign_BYTES:Hr,crypto_sign_PUBLICKEYBYTES:Zr,crypto_sign_SECRETKEYBYTES:oe,crypto_sign_SEEDBYTES:dt,crypto_hash_BYTES:lt,gf:e,D:er,L:Oe,pack25519:fe,unpack25519:ot,M:W,A:Mr,S:Tr,Z:Lr,pow2523:ln,add:Re,set25519:jr,modL:yt,scalarmult:st,scalarbase:ze};function vn(t,o){if(t.length!==pt)throw new Error("bad key size");if(o.length!==Ye)throw new Error("bad nonce size")}y(vn,"checkLengths");function bf(t,o){if(t.length!==me)throw new Error("bad public key size");if(o.length!==we)throw new Error("bad secret key size")}y(bf,"checkBoxLengths");function Cr(){for(var t=0;t<arguments.length;t++)if(!(arguments[t]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}y(Cr,"checkArrayTypes");function Un(t){for(var o=0;o<t.length;o++)t[o]=0}y(Un,"cleanup"),n.randomBytes=function(t){var o=new Uint8Array(t);return f(o,t),o},n.secretbox=function(t,o,i){Cr(t,o,i),vn(i,o);for(var r=new Uint8Array(be+t.length),a=new Uint8Array(r.length),u=0;u<t.length;u++)r[u+be]=t[u];return nt(a,r,r.length,o,i),a.subarray(ie)},n.secretbox.open=function(t,o,i){Cr(t,o,i),vn(i,o);for(var r=new Uint8Array(ie+t.length),a=new Uint8Array(r.length),u=0;u<t.length;u++)r[u+ie]=t[u];return r.length<32||ft(a,r,r.length,o,i)!==0?null:a.subarray(be)},n.secretbox.keyLength=pt,n.secretbox.nonceLength=Ye,n.secretbox.overheadLength=ie,n.scalarMult=function(t,o){if(Cr(t,o),t.length!==je)throw new Error("bad n size");if(o.length!==Ae)throw new Error("bad p size");var i=new Uint8Array(Ae);return Me(i,t,o),i},n.scalarMult.base=function(t){if(Cr(t),t.length!==je)throw new Error("bad n size");var o=new Uint8Array(Ae);return Le(o,t),o},n.scalarMult.scalarLength=je,n.scalarMult.groupElementLength=Ae,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){Cr(t,o),bf(t,o);var i=new Uint8Array(ht);return Ne(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(me),o=new Uint8Array(we);return gn(t,o),{publicKey:t,secretKey:o}},n.box.keyPair.fromSecretKey=function(t){if(Cr(t),t.length!==we)throw new Error("bad secret key size");var o=new Uint8Array(me);return Le(o,t),{publicKey:o,secretKey:new Uint8Array(t)}},n.box.publicKeyLength=me,n.box.secretKeyLength=we,n.box.sharedKeyLength=ht,n.box.nonceLength=Kn,n.box.overheadLength=n.secretbox.overheadLength,n.sign=function(t,o){if(Cr(t,o),o.length!==oe)throw new Error("bad secret key size");var i=new Uint8Array(Hr+t.length);return En(i,t,t.length,o),i},n.sign.open=function(t,o){if(Cr(t,o),o.length!==Zr)throw new Error("bad public key size");var i=new Uint8Array(t.length),r=ut(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(Hr),a=0;a<r.length;a++)r[a]=i[a];return r},n.sign.detached.verify=function(t,o,i){if(Cr(t,o,i),o.length!==Hr)throw new Error("bad signature size");if(i.length!==Zr)throw new Error("bad public key size");var r=new Uint8Array(Hr+t.length),a=new Uint8Array(Hr+t.length),u;for(u=0;u<Hr;u++)r[u]=o[u];for(u=0;u<t.length;u++)r[u+Hr]=t[u];return ut(a,r,r.length,i)>=0},n.sign.keyPair=function(){var t=new Uint8Array(Zr),o=new Uint8Array(oe);return ct(t,o),{publicKey:t,secretKey:o}},n.sign.keyPair.fromSecretKey=function(t){if(Cr(t),t.length!==oe)throw new Error("bad secret key size");for(var o=new Uint8Array(Zr),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(Cr(t),t.length!==dt)throw new Error("bad seed size");for(var o=new Uint8Array(Zr),i=new Uint8Array(oe),r=0;r<32;r++)i[r]=t[r];return ct(o,i,!0),{publicKey:o,secretKey:i}},n.sign.publicKeyLength=Zr,n.sign.secretKeyLength=oe,n.sign.seedLength=dt,n.sign.signatureLength=Hr,n.hash=function(t){Cr(t);var o=new Uint8Array(lt);return $r(o,t,t.length),o},n.hash.hashLength=lt,n.verify=function(t,o){return Cr(t,o),t.length===0||o.length===0||t.length!==o.length?!1:$(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];Un(u)})}else typeof Sn<"u"&&(t=af(),t&&t.randomBytes&&n.setPRNG(function(i,r){var a,u=t.randomBytes(r);for(a=0;a<r;a++)i[a]=u[a];Un(u)}))})()})(typeof Je<"u"&&Je.exports?Je.exports:self.nacl=self.nacl||{})});var _f=globalThis||window||self,tr=_f.crypto;function Ke(n=0){return new Uint8Array(n)}y(Ke,"allocUnsafe");function gt(n,e){e==null&&(e=n.reduce((x,l)=>x+l.length,0));let f=Ke(e),c=0;for(let x of n)f.set(x,c),c+=x.length;return f}y(gt,"concat");var St={};Dr(St,{base10:()=>Mf});var wo=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 Fr(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(Fr,"coerce");function Bn(n){return new TextEncoder().encode(n)}y(Bn,"fromString");function Pn(n){return new TextDecoder().decode(n)}y(Pn,"toString");function Bf(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 Y=n.length,er=n.charAt(0),br=Math.log(Y)/Math.log(256),sr=Math.log(256)/Math.log(Y);function vr($){if($ instanceof Uint8Array||(ArrayBuffer.isView($)?$=new Uint8Array($.buffer,$.byteOffset,$.byteLength):Array.isArray($)&&($=Uint8Array.from($))),!($ instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if($.length===0)return"";for(var cr=0,Ur=0,Er=0,lr=$.length;Er!==lr&&$[Er]===0;)Er++,cr++;for(var Kr=(lr-Er)*sr+1>>>0,gr=new Uint8Array(Kr);Er!==lr;){for(var hr=$[Er],Ir=0,Sr=Kr-1;(hr!==0||Ir<Ur)&&Sr!==-1;Sr--,Ir++)hr+=256*gr[Sr]>>>0,gr[Sr]=hr%Y>>>0,hr=hr/Y>>>0;if(hr!==0)throw new Error("Non-zero carry");Ur=Ir,Er++}for(var Pr=Kr-Ur;Pr!==Kr&&gr[Pr]===0;)Pr++;for(var Vr=er.repeat(cr);Pr<Kr;++Pr)Vr+=n.charAt(gr[Pr]);return Vr}y(vr,"encode");function Yr($){if(typeof $!="string")throw new TypeError("Expected String");if($.length===0)return new Uint8Array;var cr=0;if($[cr]!==" "){for(var Ur=0,Er=0;$[cr]===er;)Ur++,cr++;for(var lr=($.length-cr)*br+1>>>0,Kr=new Uint8Array(lr);$[cr];){var gr=f[$.charCodeAt(cr)];if(gr===255)return;for(var hr=0,Ir=lr-1;(gr!==0||hr<Er)&&Ir!==-1;Ir--,hr++)gr+=Y*Kr[Ir]>>>0,Kr[Ir]=gr%256>>>0,gr=gr/256>>>0;if(gr!==0)throw new Error("Non-zero carry");Er=hr,cr++}if($[cr]!==" "){for(var Sr=lr-Er;Sr!==lr&&Kr[Sr]===0;)Sr++;for(var Pr=new Uint8Array(Ur+(lr-Sr)),Vr=Ur;Sr!==lr;)Pr[Vr++]=Kr[Sr++];return Pr}}}y(Yr,"decodeUnsafe");function te($){var cr=Yr($);if(cr)return cr;throw new Error(`Non-${e} character`)}return y(te,"decode"),{encode:vr,decodeUnsafe:Yr,decode:te}}y(Bf,"base");var Pf=Bf,Tf=Pf,Dn=Tf;var Et=class Et{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(Et,"Encoder");var bt=Et,Kt=class Kt{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(Kt,"Decoder");var At=Kt,vt=class vt{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(vt,"ComposedDecoder");var mt=vt;function In(n,e){return new mt({...n.decoders??{[n.prefix]:n},...e.decoders??{[e.prefix]:e}})}y(In,"or");var Ut=class Ut{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 bt(e,f,c),this.decoder=new At(e,f,x)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};y(Ut,"Codec");var wt=Ut;function ae({name:n,prefix:e,encode:f,decode:c}){return new wt(n,e,f,c)}y(ae,"from");function Xr({name:n,prefix:e,alphabet:f}){let{encode:c,decode:x}=Dn(f,n);return ae({prefix:e,name:n,encode:c,decode:y(l=>Fr(x(l)),"decode")})}y(Xr,"baseX");function Df(n,e,f,c){let x={};for(let sr=0;sr<e.length;++sr)x[e[sr]]=sr;let l=n.length;for(;n[l-1]==="=";)--l;let S=new Uint8Array(l*f/8|0),Y=0,er=0,br=0;for(let sr=0;sr<l;++sr){let vr=x[n[sr]];if(vr===void 0)throw new SyntaxError(`Non-${c} character`);er=er<<f|vr,Y+=f,Y>=8&&(Y-=8,S[br++]=255&er>>Y)}if(Y>=f||(255&er<<8-Y)!==0)throw new SyntaxError("Unexpected end of data");return S}y(Df,"decode");function If(n,e,f){let c=e[e.length-1]==="=",x=(1<<f)-1,l="",S=0,Y=0;for(let er=0;er<n.length;++er)for(Y=Y<<8|n[er],S+=8;S>f;)S-=f,l+=e[x&Y>>S];if(S!==0&&(l+=e[x&Y<<f-S]),c)for(;(l.length*f&7)!==0;)l+="=";return l}y(If,"encode");function ar({name:n,prefix:e,bitsPerChar:f,alphabet:c}){return ae({prefix:e,name:n,encode(x){return If(x,c,f)},decode(x){return Df(x,c,f,n)}})}y(ar,"rfc4648");var Mf=Xr({prefix:"9",name:"base10",alphabet:"0123456789"});var _t={};Dr(_t,{base16:()=>Lf,base16upper:()=>Nf});var Lf=ar({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Nf=ar({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Ct={};Dr(Ct,{base2:()=>Rf});var Rf=ar({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Bt={};Dr(Bt,{base256emoji:()=>Hf});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}"),zf=Mn.reduce((n,e,f)=>(n[f]=e,n),[]),Of=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 Yf(n){return n.reduce((e,f)=>(e+=zf[f],e),"")}y(Yf,"encode");function jf(n){let e=[];for(let f of n){let c=f.codePointAt(0);if(c==null)throw new Error(`Invalid character: ${f}`);let x=Of[c];if(x==null)throw new Error(`Non-base256emoji character: ${f}`);e.push(x)}return new Uint8Array(e)}y(jf,"decode");var Hf=ae({prefix:"\u{1F680}",name:"base256emoji",encode:Yf,decode:jf});var Pt={};Dr(Pt,{base32:()=>se,base32hex:()=>Xf,base32hexpad:()=>Wf,base32hexpadupper:()=>$f,base32hexupper:()=>kf,base32pad:()=>Gf,base32padupper:()=>Vf,base32upper:()=>Ff,base32z:()=>Zf});var se=ar({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Ff=ar({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Gf=ar({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Vf=ar({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Xf=ar({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),kf=ar({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Wf=ar({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),$f=ar({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Zf=ar({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Tt={};Dr(Tt,{base36:()=>ve,base36upper:()=>Jf});var ve=Xr({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Jf=Xr({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Dt={};Dr(Dt,{base58btc:()=>Rr,base58flickr:()=>qf});var Rr=Xr({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),qf=Xr({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var It={};Dr(It,{base64:()=>Qf,base64pad:()=>ri,base64url:()=>ei,base64urlpad:()=>ti});var Qf=ar({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),ri=ar({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),ei=ar({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),ti=ar({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Mt={};Dr(Mt,{base8:()=>ni});var ni=ar({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Lt={};Dr(Lt,{identity:()=>fi});var fi=ae({prefix:"\0",name:"identity",encode:y(n=>Pn(n),"encode"),decode:y(n=>Bn(n),"decode")});var Ho=new TextEncoder,Fo=new TextDecoder;var zt={};Dr(zt,{identity:()=>_i});var ai=Rn,Ln=128,si=127,ci=~si,yi=Math.pow(2,31);function Rn(n,e,f){e=e||[],f=f||0;for(var c=f;n>=yi;)e[f++]=n&255|Ln,n/=128;for(;n&ci;)e[f++]=n&255|Ln,n>>>=7;return e[f]=n|0,Rn.bytes=f-c+1,e}y(Rn,"encode");var xi=Nt,ui=128,Nn=127;function Nt(n,c){var f=0,c=c||0,x=0,l=c,S,Y=n.length;do{if(l>=Y)throw Nt.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>=ui);return Nt.bytes=l-c,f}y(Nt,"read");var pi=Math.pow(2,7),hi=Math.pow(2,14),di=Math.pow(2,21),li=Math.pow(2,28),gi=Math.pow(2,35),bi=Math.pow(2,42),Ai=Math.pow(2,49),mi=Math.pow(2,56),wi=Math.pow(2,63),Ei=y(function(n){return n<pi?1:n<hi?2:n<di?3:n<li?4:n<gi?5:n<bi?6:n<Ai?7:n<mi?8:n<wi?9:10},"length"),Ki={encode:ai,decode:xi,encodingLength:Ei},vi=Ki,Ue=vi;function Se(n,e=0){return[Ue.decode(n,e),Ue.decode.bytes]}y(Se,"decode");function ce(n,e,f=0){return Ue.encode(n,e,f),e}y(ce,"encodeTo");function ye(n){return Ue.encodingLength(n)}y(ye,"encodingLength");function Jr(n,e){let f=e.byteLength,c=ye(n),x=c+ye(f),l=new Uint8Array(x+f);return ce(n,l,0),ce(f,l,c),l.set(e,x),new xe(n,f,e,l)}y(Jr,"create");function zn(n){let e=Fr(n),[f,c]=Se(e),[x,l]=Se(e.subarray(c)),S=e.subarray(c+l);if(S.byteLength!==x)throw new Error("Incorrect length");return new xe(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 Rt=class Rt{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(Rt,"Digest");var xe=Rt;var Yn=0,Ui="identity",jn=Fr;function Si(n){return Jr(Yn,jn(n))}y(Si,"digest");var _i={code:Yn,name:Ui,encode:jn,digest:Si};var Ht={};Dr(Ht,{sha256:()=>Ci,sha512:()=>Bi});function Yt({name:n,code:e,encode:f}){return new Ot(n,e,f)}y(Yt,"from");var jt=class jt{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?Jr(this.code,f):f.then(c=>Jr(this.code,c))}else throw Error("Unknown type, must be binary type")}};y(jt,"Hasher");var Ot=jt;function Fn(n){return async e=>new Uint8Array(await crypto.subtle.digest(n,e))}y(Fn,"sha");var Ci=Yt({name:"sha2-256",code:18,encode:Fn("SHA-256")}),Bi=Yt({name:"sha2-512",code:19,encode:Fn("SHA-512")});function Gn(n,e){let{bytes:f,version:c}=n;switch(c){case 0:return Ti(f,Ft(n),e??Rr.encoder);default:return Di(f,Ft(n),e??se.encoder)}}y(Gn,"format");var Vn=new WeakMap;function Ft(n){let e=Vn.get(n);if(e==null){let f=new Map;return Vn.set(n,f),f}return e}y(Ft,"baseCache");var kn,dr=class dr{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!==Ce)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(f.code!==Ii)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return dr.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=Jr(e,f);return dr.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 dr.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 dr)return f;if(f["/"]!=null&&f["/"]===f.bytes||f.asCID===f){let{version:c,code:x,multihash:l,bytes:S}=f;return new dr(c,x,l,S??Xn(c,x,l.bytes))}else if(f[Mi]===!0){let{version:c,multihash:x,code:l}=f,S=zn(x);return dr.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!==Ce)throw new Error(`Version 0 CID must use dag-pb (code: ${Ce}) block encoding`);return new dr(e,f,c,c.bytes)}case 1:{let x=Xn(e,f,c.bytes);return new dr(e,f,c,x)}default:throw new Error("Invalid version")}}static createV0(e){return dr.create(0,Ce,e)}static createV1(e,f){return dr.create(1,e,f)}static decode(e){let[f,c]=dr.decodeFirst(e);if(c.length!==0)throw new Error("Incorrect length");return f}static decodeFirst(e){let f=dr.inspectBytes(e),c=f.size-f.multihashSize,x=Fr(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 xe(f.multihashCode,f.digestSize,l,x);return[f.version===0?dr.createV0(S):dr.createV1(f.codec,S),e.subarray(f.size)]}static inspectBytes(e){let f=0,c=y(()=>{let[vr,Yr]=Se(e.subarray(f));return f+=Yr,vr},"next"),x=c(),l=Ce;if(x===18?(x=0,f=0):l=c(),x!==0&&x!==1)throw new RangeError(`Invalid CID version ${x}`);let S=f,Y=c(),er=c(),br=f+er,sr=br-S;return{version:x,codec:l,multihashCode:Y,digestSize:er,multihashSize:sr,size:br}}static parse(e,f){let[c,x]=Pi(e,f),l=dr.decode(x);if(l.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Ft(l).set(c,e),l}};y(dr,"CID");var Fe=dr;function Pi(n,e){switch(n[0]){case"Q":{let f=e??Rr;return[Rr.prefix,f.decode(`${Rr.prefix}${n}`)]}case Rr.prefix:{let f=e??Rr;return[Rr.prefix,f.decode(n)]}case se.prefix:{let f=e??se;return[se.prefix,f.decode(n)]}case ve.prefix:{let f=e??ve;return[ve.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(Pi,"parseCIDtoBytes");function Ti(n,e,f){let{prefix:c}=f;if(c!==Rr.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(Ti,"toStringV0");function Di(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(Di,"toStringV1");var Ce=112,Ii=18;function Xn(n,e,f){let c=ye(n),x=c+ye(e),l=new Uint8Array(x+f.byteLength);return ce(n,l,0),ce(e,l,c),l.set(f,x),l}y(Xn,"encodeCID");var Mi=Symbol.for("@ipld/js-cid/CID");var Gt={...Lt,...Ct,...Mt,...St,..._t,...Pt,...Tt,...Dt,...It,...Bt},ma={...Ht,...zt};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))),Vt=$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=Ke(n.length);for(let f=0;f<n.length;f++)e[f]=n.charCodeAt(f);return e}),Li={utf8:Wn,"utf-8":Wn,hex:Gt.base16,latin1:Vt,ascii:Vt,binary:Vt,...Gt},Ge=Li;function Br(n,e="utf8"){let f=Ge[e];if(f==null)throw new Error(`Unsupported encoding "${e}"`);return f.decoder.decode(`${f.prefix}${n}`)}y(Br,"fromString");function xr(n,e="utf8"){let f=Ge[e];if(f==null)throw new Error(`Unsupported encoding "${e}"`);return f.encoder.encode(n).substring(1)}y(xr,"toString");var qr="did:key:z",Be="Ed25519",Zn="X25519",Xa="X25519",Jn="Ed25519",qn="X25519";var ue="RSA-OAEP",pe="RSASSA-PKCS1-v1_5",Xt="SHA-256",kt=new Uint8Array([0,245,2]),ka=2048,Wt="SHA-256",he=8,de="AES-GCM",Gr=de,Qr=256,kr=12,$t=new Uint8Array([234,1]),Zt=new Uint8Array([237,1]),Ve={RSA:"rsa",Edwards:"ed25519",BLS:"bls12-381"};var Xe="ecc-exchange",ke="ecc-write",zr=16;var Qn=new Error("Invalid key use. Please use 'encryption' or 'signing"),zi=new Error("Max must be less than 256 and greater than 0");function ur(n){return new Uint8Array(n).buffer}y(ur,"toArrayBuffer");async function rf(n){return new Uint8Array(await tr.subtle.digest("sha-256",n.buffer))}y(rf,"sha256");function Or(n){let e=Br(n,"base64pad");return ur(e)}y(Or,"base64ToArrBuf");var Te=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 We(n){return Te(n,Or)}y(We,"normalizeBase64ToBuf");var Oi=y(n=>Te(n,e=>ef(e,8)),"normalizeUtf8ToBuf");function ef(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(ef,"strToArrBuf");var Yi=y(n=>Te(n,e=>ef(e,16)),"normalizeUtf16ToBuf");function le(n,e){switch(e){case 8:return Oi(n);default:return Yi(n)}}y(le,"normalizeUnicodeToBuf");function tf(n){if(!n.startsWith(qr))throw new Error("Please use a base58-encoded DID formatted `did:key:z...`");let e=""+n.substring(qr.length),f=Br(e,"base58btc"),{keyBuffer:c,type:x}=ji(ur(f));return{publicKey:new Uint8Array(c),type:x}}y(tf,"didToPublicKey");function ji(n){if(Pe(n,ur(kt)))return{keyBuffer:n.slice(kt.byteLength),type:Ve.RSA};if(Pe(n,ur(Zt)))return{keyBuffer:n.slice(Zt.byteLength),type:Ve.Edwards};if(Pe(n,ur($t)))return{keyBuffer:n.slice($t.byteLength),type:Ve.BLS};throw new Error("Unsupported key algorithm. Try using RSA.")}y(ji,"parseMagicBytes");var Hi={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 Pe(n,e){return Hi.equal(e,n.slice(0,e.byteLength))}y(Pe,"hasPrefix");function Nr(n){return xr(n instanceof ArrayBuffer?new Uint8Array(n):n,"base64pad")}y(Nr,"toBase64");async function qt(n,e){let f=typeof n=="string"?Or(n):ur(n);return tr.subtle.importKey("raw",f,{name:e?.alg||Gr,length:e?.length||Qr},!0,["encrypt","decrypt"])}y(qt,"importKey");function nf(n,{max:e}={max:255}){if(e<1||e>255)throw zi;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(nf,"randomBuf");function $e(n,e){let f=n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(ur(n)),c=e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(ur(e)),x=new Uint8Array(f.length+c.length);return x.set(f),x.set(c,f.length),x.buffer}y($e,"joinBufs");var fs=new Error("Key does not exist. Make sure you properly instantiated the keystore."),is=new Error("Retrieved a symmetric key when an asymmetric keypair was expected. Please use a different key name."),os=new Error("Retrieved an asymmetric keypair when an symmetric key was expected. Please use a different key name."),as=new Error("ECC is not enabled for this browser. Please use RSA instead."),ss=new Error("Cryptosystem not supported. Please use ECC or RSA"),Fi=new Error("Invalid key use. Please use 'exchange' or 'write'"),cs=new Error("Max must be less than 256 and greater than 0");function ff(n){Gi(n,["exchange","write","signing"],Fi)}y(ff,"checkValidKeyUse");function Gi(n,e,f){if(!e.some(x=>x===n))throw f}y(Gi,"checkValid");function Ze(n){return new Promise((e,f)=>{n.oncomplete=n.onsuccess=()=>e(n.result),n.onabort=n.onerror=()=>f(n.error)})}y(Ze,"promisifyRequest");function Vi(n,e){let f,c=y(()=>{if(f)return f;let x=indexedDB.open(n);return x.onupgradeneeded=()=>x.result.createObjectStore(e),f=Ze(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(Vi,"createStore");var Qt;function rn(){return Qt||(Qt=Vi("keyval-store","keyval")),Qt}y(rn,"defaultGetStore");function en(n,e=rn()){return e("readonly",f=>Ze(f.get(n)))}y(en,"get");function tn(n,e,f=rn()){return f("readwrite",c=>(c.put(e,n),Ze(c.transaction)))}y(tn,"set");function of(n,e=rn()){return e("readwrite",f=>(n.forEach(c=>f.delete(c)),Ze(f.transaction)))}y(of,"delMany");var cf=Sf(sf(),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:ki},ed25519:{magicBytes:new Uint8Array([237,1]),verify:Xi}}};async function Xi({message:n,publicKey:e,signature:f}){let c=n;typeof n=="string"&&(c=Br(n,"utf8"));let x=f;typeof f=="string"&&(x=Br(f,"base64pad"));let l=e;if(typeof e=="string"&&(l=yf(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 cf.default.sign.detached.verify(c,x,l)}y(Xi,"ed25519Verify");async function ki({message:n,publicKey:e,signature:f}){let c=e;return typeof e=="string"&&(c=yf(e).publicKey),an.verify(n,f,await tr.subtle.importKey("spki",ur(c),{name:pe,hash:Xt},!1,["verify"]),8)}y(ki,"rsaVerify");var an={verify:y(async function(e,f,c,x=he,l=Wt){return tr.subtle.verify({name:pe,saltLength:zr},typeof c=="string"?await nn(c,l,"signing"):c,We(f),le(e,x))},"rsaVerify"),sign:y(async function(e,f,c=he){return tr.subtle.sign({name:pe,saltLength:zr},f,le(e,c))},"sign"),encrypt:y(async function(e,f,c=he,x=Wt){let l;return typeof f=="string"?l=await nn(f,x,"exchange"):l=f instanceof Uint8Array?await nn(ur(f),x,"exchange"):f,tr.subtle.encrypt({name:ue},l,le(e,c))},"rsaEncrypt"),decrypt:y(async function(e,f){let c=qe(f)?f:await Ji(f,["decrypt"]),x;typeof e=="string"?x=Br(e,"base64pad"):x=e;let l=await tr.subtle.decrypt({name:ue},c,x instanceof Uint8Array?ur(x):x);return new Uint8Array(l)},"rsaDecrypt")};async function nn(n,e,f){Wi(f);let c=f==="exchange"?ue:pe,x=f==="exchange"?["encrypt"]:["verify"],l=typeof n=="string"?Or(Zi(n)):n;return tr.subtle.importKey("spki",l,{name:c,hash:{name:e}},!0,x)}y(nn,"rsaImportPublicKey");function Wi(n){$i(n,["signing","exchange"],Qn)}y(Wi,"checkValidKeyUse");function $i(n,e,f){if(!e.some(x=>x===n))throw f}y($i,"checkValid");function Zi(n){return n.replace(`-----BEGIN PUBLIC KEY-----
|
|
1
|
+
var gf=Object.create;var vr=Object.defineProperty;var bf=Object.getOwnPropertyDescriptor;var mf=Object.getOwnPropertyNames;var Af=Object.getPrototypeOf,wf=Object.prototype.hasOwnProperty;var Kf=(n,r,f)=>r in n?vr(n,r,{enumerable:!0,configurable:!0,writable:!0,value:f}):n[r]=f;var y=(n,r)=>vr(n,"name",{value:r,configurable:!0}),_n=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(r,f)=>(typeof require<"u"?require:r)[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,r)=>()=>(r||n((r={exports:{}}).exports,r),r.exports),Le=(n,r)=>{for(var f in r)vr(n,f,{get:r[f],enumerable:!0})},Ef=(n,r,f,c)=>{if(r&&typeof r=="object"||typeof r=="function")for(let x of mf(r))!wf.call(n,x)&&x!==f&&vr(n,x,{get:()=>r[x],enumerable:!(c=bf(r,x))||c.enumerable});return n};var Uf=(n,r,f)=>(f=n!=null?gf(Af(n)):{},Ef(r||!n||!n.__esModule?vr(f,"default",{value:n,enumerable:!0}):f,n));var Y=(n,r,f)=>Kf(n,typeof r!="symbol"?r+"":r,f);var ff=Cn(()=>{"use strict"});var of=Cn((hs,Qr)=>{"use strict";(function(n){"use strict";var r=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=r(),v=r([1]),M=r([56129,1]),$=r([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),ue=r([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),ie=r([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),pe=r([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),Be=r([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function Fe(t,o,i,e){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]=e>>24&255,t[o+5]=e>>16&255,t[o+6]=e>>8&255,t[o+7]=e&255}y(Fe,"ts64");function W(t,o,i,e,a){var u,p=0;for(u=0;u<a;u++)p|=t[o+u]^i[e+u];return(1&p-1>>>8)-1}y(W,"vn");function fe(t,o,i,e){return W(t,o,i,e,16)}y(fe,"crypto_verify_16");function Ae(t,o,i,e){return W(t,o,i,e,32)}y(Ae,"crypto_verify_32");function Ue(t,o,i,e){for(var a=e[0]&255|(e[1]&255)<<8|(e[2]&255)<<16|(e[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=e[4]&255|(e[5]&255)<<8|(e[6]&255)<<16|(e[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,L=o[12]&255|(o[13]&255)<<8|(o[14]&255)<<16|(o[15]&255)<<24,R=e[8]&255|(e[9]&255)<<8|(e[10]&255)<<16|(e[11]&255)<<24,H=i[16]&255|(i[17]&255)<<8|(i[18]&255)<<16|(i[19]&255)<<24,j=i[20]&255|(i[21]&255)<<8|(i[22]&255)<<16|(i[23]&255)<<24,N=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,O=e[12]&255|(e[13]&255)<<8|(e[14]&255)<<16|(e[15]&255)<<24,C=a,D=u,S=p,B=b,P=K,E=T,h=U,d=Q,A=_,g=L,m=R,w=H,I=j,F=N,V=z,G=O,s,X=0;X<20;X+=2)s=C+I|0,P^=s<<7|s>>>25,s=P+C|0,A^=s<<9|s>>>23,s=A+P|0,I^=s<<13|s>>>19,s=I+A|0,C^=s<<18|s>>>14,s=E+D|0,g^=s<<7|s>>>25,s=g+E|0,F^=s<<9|s>>>23,s=F+g|0,D^=s<<13|s>>>19,s=D+F|0,E^=s<<18|s>>>14,s=m+h|0,V^=s<<7|s>>>25,s=V+m|0,S^=s<<9|s>>>23,s=S+V|0,h^=s<<13|s>>>19,s=h+S|0,m^=s<<18|s>>>14,s=G+w|0,B^=s<<7|s>>>25,s=B+G|0,d^=s<<9|s>>>23,s=d+B|0,w^=s<<13|s>>>19,s=w+d|0,G^=s<<18|s>>>14,s=C+B|0,D^=s<<7|s>>>25,s=D+C|0,S^=s<<9|s>>>23,s=S+D|0,B^=s<<13|s>>>19,s=B+S|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=m+g|0,w^=s<<7|s>>>25,s=w+m|0,A^=s<<9|s>>>23,s=A+w|0,g^=s<<13|s>>>19,s=g+A|0,m^=s<<18|s>>>14,s=G+V|0,I^=s<<7|s>>>25,s=I+G|0,F^=s<<9|s>>>23,s=F+I|0,V^=s<<13|s>>>19,s=V+F|0,G^=s<<18|s>>>14;C=C+a|0,D=D+u|0,S=S+p|0,B=B+b|0,P=P+K|0,E=E+T|0,h=h+U|0,d=d+Q|0,A=A+_|0,g=g+L|0,m=m+R|0,w=w+H|0,I=I+j|0,F=F+N|0,V=V+z|0,G=G+O|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]=S>>>0&255,t[9]=S>>>8&255,t[10]=S>>>16&255,t[11]=S>>>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]=A>>>0&255,t[33]=A>>>8&255,t[34]=A>>>16&255,t[35]=A>>>24&255,t[36]=g>>>0&255,t[37]=g>>>8&255,t[38]=g>>>16&255,t[39]=g>>>24&255,t[40]=m>>>0&255,t[41]=m>>>8&255,t[42]=m>>>16&255,t[43]=m>>>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]=F>>>0&255,t[53]=F>>>8&255,t[54]=F>>>16&255,t[55]=F>>>24&255,t[56]=V>>>0&255,t[57]=V>>>8&255,t[58]=V>>>16&255,t[59]=V>>>24&255,t[60]=G>>>0&255,t[61]=G>>>8&255,t[62]=G>>>16&255,t[63]=G>>>24&255}y(Ue,"core_salsa20");function be(t,o,i,e){for(var a=e[0]&255|(e[1]&255)<<8|(e[2]&255)<<16|(e[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=e[4]&255|(e[5]&255)<<8|(e[6]&255)<<16|(e[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,L=o[12]&255|(o[13]&255)<<8|(o[14]&255)<<16|(o[15]&255)<<24,R=e[8]&255|(e[9]&255)<<8|(e[10]&255)<<16|(e[11]&255)<<24,H=i[16]&255|(i[17]&255)<<8|(i[18]&255)<<16|(i[19]&255)<<24,j=i[20]&255|(i[21]&255)<<8|(i[22]&255)<<16|(i[23]&255)<<24,N=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,O=e[12]&255|(e[13]&255)<<8|(e[14]&255)<<16|(e[15]&255)<<24,C=a,D=u,S=p,B=b,P=K,E=T,h=U,d=Q,A=_,g=L,m=R,w=H,I=j,F=N,V=z,G=O,s,X=0;X<20;X+=2)s=C+I|0,P^=s<<7|s>>>25,s=P+C|0,A^=s<<9|s>>>23,s=A+P|0,I^=s<<13|s>>>19,s=I+A|0,C^=s<<18|s>>>14,s=E+D|0,g^=s<<7|s>>>25,s=g+E|0,F^=s<<9|s>>>23,s=F+g|0,D^=s<<13|s>>>19,s=D+F|0,E^=s<<18|s>>>14,s=m+h|0,V^=s<<7|s>>>25,s=V+m|0,S^=s<<9|s>>>23,s=S+V|0,h^=s<<13|s>>>19,s=h+S|0,m^=s<<18|s>>>14,s=G+w|0,B^=s<<7|s>>>25,s=B+G|0,d^=s<<9|s>>>23,s=d+B|0,w^=s<<13|s>>>19,s=w+d|0,G^=s<<18|s>>>14,s=C+B|0,D^=s<<7|s>>>25,s=D+C|0,S^=s<<9|s>>>23,s=S+D|0,B^=s<<13|s>>>19,s=B+S|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=m+g|0,w^=s<<7|s>>>25,s=w+m|0,A^=s<<9|s>>>23,s=A+w|0,g^=s<<13|s>>>19,s=g+A|0,m^=s<<18|s>>>14,s=G+V|0,I^=s<<7|s>>>25,s=I+G|0,F^=s<<9|s>>>23,s=F+I|0,V^=s<<13|s>>>19,s=V+F|0,G^=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]=m>>>0&255,t[9]=m>>>8&255,t[10]=m>>>16&255,t[11]=m>>>24&255,t[12]=G>>>0&255,t[13]=G>>>8&255,t[14]=G>>>16&255,t[15]=G>>>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]=A>>>0&255,t[25]=A>>>8&255,t[26]=A>>>16&255,t[27]=A>>>24&255,t[28]=g>>>0&255,t[29]=g>>>8&255,t[30]=g>>>16&255,t[31]=g>>>24&255}y(be,"core_hsalsa20");function ve(t,o,i,e){Ue(t,o,i,e)}y(ve,"crypto_core_salsa20");function me(t,o,i,e){be(t,o,i,e)}y(me,"crypto_core_hsalsa20");var le=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function Oe(t,o,i,e,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(ve(K,b,p,le),U=0;U<64;U++)t[o+U]=i[e+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,e+=64}if(a>0)for(ve(K,b,p,le),U=0;U<a;U++)t[o+U]=i[e+U]^K[U];return 0}y(Oe,"crypto_stream_salsa20_xor");function Ce(t,o,i,e,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]=e[K];for(;i>=64;){for(ve(p,u,a,le),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(ve(p,u,a,le),K=0;K<i;K++)t[o+K]=p[K];return 0}y(Ce,"crypto_stream_salsa20");function Ie(t,o,i,e,a){var u=new Uint8Array(32);me(u,e,a,le);for(var p=new Uint8Array(8),b=0;b<8;b++)p[b]=e[b+16];return Ce(t,o,i,p,u)}y(Ie,"crypto_stream");function Xe(t,o,i,e,a,u,p){var b=new Uint8Array(32);me(b,u,p,le);for(var K=new Uint8Array(8),T=0;T<8;T++)K[T]=u[T+16];return Oe(t,o,i,e,a,K,b)}y(Xe,"crypto_stream_xor");var Lr=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,e,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,e=t[4]&255|(t[5]&255)<<8,this.r[2]=(i>>>10|e<<6)&7939,a=t[6]&255|(t[7]&255)<<8,this.r[3]=(e>>>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");Lr.prototype.blocks=function(t,o,i){for(var e=this.fin?0:2048,a,u,p,b,K,T,U,Q,_,L,R,H,j,N,z,O,C,D,S,B=this.h[0],P=this.h[1],E=this.h[2],h=this.h[3],d=this.h[4],A=this.h[5],g=this.h[6],m=this.h[7],w=this.h[8],I=this.h[9],F=this.r[0],V=this.r[1],G=this.r[2],s=this.r[3],X=this.r[4],ee=this.r[5],re=this.r[6],k=this.r[7],J=this.r[8],q=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,A+=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,m+=(T>>>11|U<<5)&8191,Q=t[o+14]&255|(t[o+15]&255)<<8,w+=(U>>>8|Q<<8)&8191,I+=Q>>>5|e,_=0,L=_,L+=B*F,L+=P*(5*q),L+=E*(5*J),L+=h*(5*k),L+=d*(5*re),_=L>>>13,L&=8191,L+=A*(5*ee),L+=g*(5*X),L+=m*(5*s),L+=w*(5*G),L+=I*(5*V),_+=L>>>13,L&=8191,R=_,R+=B*V,R+=P*F,R+=E*(5*q),R+=h*(5*J),R+=d*(5*k),_=R>>>13,R&=8191,R+=A*(5*re),R+=g*(5*ee),R+=m*(5*X),R+=w*(5*s),R+=I*(5*G),_+=R>>>13,R&=8191,H=_,H+=B*G,H+=P*V,H+=E*F,H+=h*(5*q),H+=d*(5*J),_=H>>>13,H&=8191,H+=A*(5*k),H+=g*(5*re),H+=m*(5*ee),H+=w*(5*X),H+=I*(5*s),_+=H>>>13,H&=8191,j=_,j+=B*s,j+=P*G,j+=E*V,j+=h*F,j+=d*(5*q),_=j>>>13,j&=8191,j+=A*(5*J),j+=g*(5*k),j+=m*(5*re),j+=w*(5*ee),j+=I*(5*X),_+=j>>>13,j&=8191,N=_,N+=B*X,N+=P*s,N+=E*G,N+=h*V,N+=d*F,_=N>>>13,N&=8191,N+=A*(5*q),N+=g*(5*J),N+=m*(5*k),N+=w*(5*re),N+=I*(5*ee),_+=N>>>13,N&=8191,z=_,z+=B*ee,z+=P*X,z+=E*s,z+=h*G,z+=d*V,_=z>>>13,z&=8191,z+=A*F,z+=g*(5*q),z+=m*(5*J),z+=w*(5*k),z+=I*(5*re),_+=z>>>13,z&=8191,O=_,O+=B*re,O+=P*ee,O+=E*X,O+=h*s,O+=d*G,_=O>>>13,O&=8191,O+=A*V,O+=g*F,O+=m*(5*q),O+=w*(5*J),O+=I*(5*k),_+=O>>>13,O&=8191,C=_,C+=B*k,C+=P*re,C+=E*ee,C+=h*X,C+=d*s,_=C>>>13,C&=8191,C+=A*G,C+=g*V,C+=m*F,C+=w*(5*q),C+=I*(5*J),_+=C>>>13,C&=8191,D=_,D+=B*J,D+=P*k,D+=E*re,D+=h*ee,D+=d*X,_=D>>>13,D&=8191,D+=A*s,D+=g*G,D+=m*V,D+=w*F,D+=I*(5*q),_+=D>>>13,D&=8191,S=_,S+=B*q,S+=P*J,S+=E*k,S+=h*re,S+=d*ee,_=S>>>13,S&=8191,S+=A*X,S+=g*s,S+=m*G,S+=w*V,S+=I*F,_+=S>>>13,S&=8191,_=(_<<2)+_|0,_=_+L|0,L=_&8191,_=_>>>13,R+=_,B=L,P=R,E=H,h=j,d=N,A=z,g=O,m=C,w=D,I=S,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]=A,this.h[6]=g,this.h[7]=m,this.h[8]=w,this.h[9]=I},Lr.prototype.finish=function(t,o){var i=new Uint16Array(10),e,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(e=this.h[1]>>>13,this.h[1]&=8191,p=2;p<10;p++)this.h[p]+=e,e=this.h[p]>>>13,this.h[p]&=8191;for(this.h[0]+=e*5,e=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=e,e=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=e,i[0]=this.h[0]+5,e=i[0]>>>13,i[0]&=8191,p=1;p<10;p++)i[p]=this.h[p]+e,e=i[p]>>>13,i[p]&=8191;for(i[9]-=8192,a=(e^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},Lr.prototype.update=function(t,o,i){var e,a;if(this.leftover){for(a=16-this.leftover,a>i&&(a=i),e=0;e<a;e++)this.buffer[this.leftover+e]=t[o+e];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(e=0;e<i;e++)this.buffer[this.leftover+e]=t[o+e];this.leftover+=i}};function nt(t,o,i,e,a,u){var p=new Lr(u);return p.update(i,e,a),p.finish(t,o),0}y(nt,"crypto_onetimeauth");function pn(t,o,i,e,a,u){var p=new Uint8Array(16);return nt(p,0,i,e,a,u),fe(t,o,p,0)}y(pn,"crypto_onetimeauth_verify");function ft(t,o,i,e,a){var u;if(i<32)return-1;for(Xe(t,0,o,0,i,e,a),nt(t,16,t,32,i-32,t),u=0;u<16;u++)t[u]=0;return 0}y(ft,"crypto_secretbox");function it(t,o,i,e,a){var u,p=new Uint8Array(32);if(i<32||(Ie(p,0,32,e,a),pn(o,16,o,32,i-32,p)!==0))return-1;for(Xe(t,0,o,0,i,e,a),u=0;u<32;u++)t[u]=0;return 0}y(it,"crypto_secretbox_open");function Ge(t,o){var i;for(i=0;i<16;i++)t[i]=o[i]|0}y(Ge,"set25519");function ot(t){var o,i,e=1;for(o=0;o<16;o++)i=t[o]+e+65535,e=Math.floor(i/65536),t[o]=i-e*65536;t[0]+=e-1+37*(e-1)}y(ot,"car25519");function fr(t,o,i){for(var e,a=~(i-1),u=0;u<16;u++)e=a&(t[u]^o[u]),t[u]^=e,o[u]^=e}y(fr,"sel25519");function ir(t,o){var i,e,a,u=r(),p=r();for(i=0;i<16;i++)p[i]=o[i];for(ot(p),ot(p),ot(p),e=0;e<2;e++){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,fr(p,u,1-a)}for(i=0;i<16;i++)t[2*i]=p[i]&255,t[2*i+1]=p[i]>>8}y(ir,"pack25519");function hn(t,o){var i=new Uint8Array(32),e=new Uint8Array(32);return ir(i,t),ir(e,o),Ae(i,0,e,0)}y(hn,"neq25519");function dn(t){var o=new Uint8Array(32);return ir(o,t),o[0]&1}y(dn,"par25519");function at(t,o){var i;for(i=0;i<16;i++)t[i]=o[2*i]+(o[2*i+1]<<8);t[15]&=32767}y(at,"unpack25519");function ze(t,o,i){for(var e=0;e<16;e++)t[e]=o[e]+i[e]}y(ze,"A");function Ye(t,o,i){for(var e=0;e<16;e++)t[e]=o[e]-i[e]}y(Ye,"Z");function Z(t,o,i){var e,a,u=0,p=0,b=0,K=0,T=0,U=0,Q=0,_=0,L=0,R=0,H=0,j=0,N=0,z=0,O=0,C=0,D=0,S=0,B=0,P=0,E=0,h=0,d=0,A=0,g=0,m=0,w=0,I=0,F=0,V=0,G=0,s=i[0],X=i[1],ee=i[2],re=i[3],k=i[4],J=i[5],q=i[6],ye=i[7],ne=i[8],oe=i[9],ae=i[10],se=i[11],de=i[12],we=i[13],Ke=i[14],Ee=i[15];e=o[0],u+=e*s,p+=e*X,b+=e*ee,K+=e*re,T+=e*k,U+=e*J,Q+=e*q,_+=e*ye,L+=e*ne,R+=e*oe,H+=e*ae,j+=e*se,N+=e*de,z+=e*we,O+=e*Ke,C+=e*Ee,e=o[1],p+=e*s,b+=e*X,K+=e*ee,T+=e*re,U+=e*k,Q+=e*J,_+=e*q,L+=e*ye,R+=e*ne,H+=e*oe,j+=e*ae,N+=e*se,z+=e*de,O+=e*we,C+=e*Ke,D+=e*Ee,e=o[2],b+=e*s,K+=e*X,T+=e*ee,U+=e*re,Q+=e*k,_+=e*J,L+=e*q,R+=e*ye,H+=e*ne,j+=e*oe,N+=e*ae,z+=e*se,O+=e*de,C+=e*we,D+=e*Ke,S+=e*Ee,e=o[3],K+=e*s,T+=e*X,U+=e*ee,Q+=e*re,_+=e*k,L+=e*J,R+=e*q,H+=e*ye,j+=e*ne,N+=e*oe,z+=e*ae,O+=e*se,C+=e*de,D+=e*we,S+=e*Ke,B+=e*Ee,e=o[4],T+=e*s,U+=e*X,Q+=e*ee,_+=e*re,L+=e*k,R+=e*J,H+=e*q,j+=e*ye,N+=e*ne,z+=e*oe,O+=e*ae,C+=e*se,D+=e*de,S+=e*we,B+=e*Ke,P+=e*Ee,e=o[5],U+=e*s,Q+=e*X,_+=e*ee,L+=e*re,R+=e*k,H+=e*J,j+=e*q,N+=e*ye,z+=e*ne,O+=e*oe,C+=e*ae,D+=e*se,S+=e*de,B+=e*we,P+=e*Ke,E+=e*Ee,e=o[6],Q+=e*s,_+=e*X,L+=e*ee,R+=e*re,H+=e*k,j+=e*J,N+=e*q,z+=e*ye,O+=e*ne,C+=e*oe,D+=e*ae,S+=e*se,B+=e*de,P+=e*we,E+=e*Ke,h+=e*Ee,e=o[7],_+=e*s,L+=e*X,R+=e*ee,H+=e*re,j+=e*k,N+=e*J,z+=e*q,O+=e*ye,C+=e*ne,D+=e*oe,S+=e*ae,B+=e*se,P+=e*de,E+=e*we,h+=e*Ke,d+=e*Ee,e=o[8],L+=e*s,R+=e*X,H+=e*ee,j+=e*re,N+=e*k,z+=e*J,O+=e*q,C+=e*ye,D+=e*ne,S+=e*oe,B+=e*ae,P+=e*se,E+=e*de,h+=e*we,d+=e*Ke,A+=e*Ee,e=o[9],R+=e*s,H+=e*X,j+=e*ee,N+=e*re,z+=e*k,O+=e*J,C+=e*q,D+=e*ye,S+=e*ne,B+=e*oe,P+=e*ae,E+=e*se,h+=e*de,d+=e*we,A+=e*Ke,g+=e*Ee,e=o[10],H+=e*s,j+=e*X,N+=e*ee,z+=e*re,O+=e*k,C+=e*J,D+=e*q,S+=e*ye,B+=e*ne,P+=e*oe,E+=e*ae,h+=e*se,d+=e*de,A+=e*we,g+=e*Ke,m+=e*Ee,e=o[11],j+=e*s,N+=e*X,z+=e*ee,O+=e*re,C+=e*k,D+=e*J,S+=e*q,B+=e*ye,P+=e*ne,E+=e*oe,h+=e*ae,d+=e*se,A+=e*de,g+=e*we,m+=e*Ke,w+=e*Ee,e=o[12],N+=e*s,z+=e*X,O+=e*ee,C+=e*re,D+=e*k,S+=e*J,B+=e*q,P+=e*ye,E+=e*ne,h+=e*oe,d+=e*ae,A+=e*se,g+=e*de,m+=e*we,w+=e*Ke,I+=e*Ee,e=o[13],z+=e*s,O+=e*X,C+=e*ee,D+=e*re,S+=e*k,B+=e*J,P+=e*q,E+=e*ye,h+=e*ne,d+=e*oe,A+=e*ae,g+=e*se,m+=e*de,w+=e*we,I+=e*Ke,F+=e*Ee,e=o[14],O+=e*s,C+=e*X,D+=e*ee,S+=e*re,B+=e*k,P+=e*J,E+=e*q,h+=e*ye,d+=e*ne,A+=e*oe,g+=e*ae,m+=e*se,w+=e*de,I+=e*we,F+=e*Ke,V+=e*Ee,e=o[15],C+=e*s,D+=e*X,S+=e*ee,B+=e*re,P+=e*k,E+=e*J,h+=e*q,d+=e*ye,A+=e*ne,g+=e*oe,m+=e*ae,w+=e*se,I+=e*de,F+=e*we,V+=e*Ke,G+=e*Ee,u+=38*D,p+=38*S,b+=38*B,K+=38*P,T+=38*E,U+=38*h,Q+=38*d,_+=38*A,L+=38*g,R+=38*m,H+=38*w,j+=38*I,N+=38*F,z+=38*V,O+=38*G,a=1,e=u+a+65535,a=Math.floor(e/65536),u=e-a*65536,e=p+a+65535,a=Math.floor(e/65536),p=e-a*65536,e=b+a+65535,a=Math.floor(e/65536),b=e-a*65536,e=K+a+65535,a=Math.floor(e/65536),K=e-a*65536,e=T+a+65535,a=Math.floor(e/65536),T=e-a*65536,e=U+a+65535,a=Math.floor(e/65536),U=e-a*65536,e=Q+a+65535,a=Math.floor(e/65536),Q=e-a*65536,e=_+a+65535,a=Math.floor(e/65536),_=e-a*65536,e=L+a+65535,a=Math.floor(e/65536),L=e-a*65536,e=R+a+65535,a=Math.floor(e/65536),R=e-a*65536,e=H+a+65535,a=Math.floor(e/65536),H=e-a*65536,e=j+a+65535,a=Math.floor(e/65536),j=e-a*65536,e=N+a+65535,a=Math.floor(e/65536),N=e-a*65536,e=z+a+65535,a=Math.floor(e/65536),z=e-a*65536,e=O+a+65535,a=Math.floor(e/65536),O=e-a*65536,e=C+a+65535,a=Math.floor(e/65536),C=e-a*65536,u+=a-1+37*(a-1),a=1,e=u+a+65535,a=Math.floor(e/65536),u=e-a*65536,e=p+a+65535,a=Math.floor(e/65536),p=e-a*65536,e=b+a+65535,a=Math.floor(e/65536),b=e-a*65536,e=K+a+65535,a=Math.floor(e/65536),K=e-a*65536,e=T+a+65535,a=Math.floor(e/65536),T=e-a*65536,e=U+a+65535,a=Math.floor(e/65536),U=e-a*65536,e=Q+a+65535,a=Math.floor(e/65536),Q=e-a*65536,e=_+a+65535,a=Math.floor(e/65536),_=e-a*65536,e=L+a+65535,a=Math.floor(e/65536),L=e-a*65536,e=R+a+65535,a=Math.floor(e/65536),R=e-a*65536,e=H+a+65535,a=Math.floor(e/65536),H=e-a*65536,e=j+a+65535,a=Math.floor(e/65536),j=e-a*65536,e=N+a+65535,a=Math.floor(e/65536),N=e-a*65536,e=z+a+65535,a=Math.floor(e/65536),z=e-a*65536,e=O+a+65535,a=Math.floor(e/65536),O=e-a*65536,e=C+a+65535,a=Math.floor(e/65536),C=e-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]=L,t[9]=R,t[10]=H,t[11]=j,t[12]=N,t[13]=z,t[14]=O,t[15]=C}y(Z,"M");function Me(t,o){Z(t,o,o)}y(Me,"S");function ln(t,o){var i=r(),e;for(e=0;e<16;e++)i[e]=o[e];for(e=253;e>=0;e--)Me(i,i),e!==2&&e!==4&&Z(i,i,o);for(e=0;e<16;e++)t[e]=i[e]}y(ln,"inv25519");function gn(t,o){var i=r(),e;for(e=0;e<16;e++)i[e]=o[e];for(e=250;e>=0;e--)Me(i,i),e!==1&&Z(i,i,o);for(e=0;e<16;e++)t[e]=i[e]}y(gn,"pow2523");function Rr(t,o,i){var e=new Uint8Array(32),a=new Float64Array(80),u,p,b=r(),K=r(),T=r(),U=r(),Q=r(),_=r();for(p=0;p<31;p++)e[p]=o[p];for(e[31]=o[31]&127|64,e[0]&=248,at(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=e[p>>>3]>>>(p&7)&1,fr(b,K,u),fr(T,U,u),ze(Q,b,T),Ye(b,b,T),ze(T,K,U),Ye(K,K,U),Me(U,Q),Me(_,b),Z(b,T,b),Z(T,K,Q),ze(Q,b,T),Ye(b,b,T),Me(K,b),Ye(T,U,_),Z(b,T,M),ze(b,b,U),Z(T,T,b),Z(b,U,_),Z(U,K,a),Me(K,Q),fr(b,K,u),fr(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 L=a.subarray(32),R=a.subarray(16);return ln(L,L),Z(R,R,L),ir(t,R),0}y(Rr,"crypto_scalarmult");function Nr(t,o){return Rr(t,o,x)}y(Nr,"crypto_scalarmult_base");function bn(t,o){return f(o,32),Nr(t,o)}y(bn,"crypto_box_keypair");function Or(t,o,i){var e=new Uint8Array(32);return Rr(e,i,o),me(t,c,e,le)}y(Or,"crypto_box_beforenm");var mn=ft,yf=it;function xf(t,o,i,e,a,u){var p=new Uint8Array(32);return Or(p,a,u),mn(t,o,i,e,p)}y(xf,"crypto_box");function uf(t,o,i,e,a,u){var p=new Uint8Array(32);return Or(p,a,u),yf(t,o,i,e,p)}y(uf,"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 wn(t,o,i,e){for(var a=new Int32Array(16),u=new Int32Array(16),p,b,K,T,U,Q,_,L,R,H,j,N,z,O,C,D,S,B,P,E,h,d,A,g,m,w,I=t[0],F=t[1],V=t[2],G=t[3],s=t[4],X=t[5],ee=t[6],re=t[7],k=o[0],J=o[1],q=o[2],ye=o[3],ne=o[4],oe=o[5],ae=o[6],se=o[7],de=0;e>=128;){for(P=0;P<16;P++)E=8*P+de,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=F,K=V,T=G,U=s,Q=X,_=ee,L=re,R=k,H=J,j=q,N=ye,z=ne,O=oe,C=ae,D=se,h=re,d=se,A=d&65535,g=d>>>16,m=h&65535,w=h>>>16,h=(s>>>14|ne<<18)^(s>>>18|ne<<14)^(ne>>>9|s<<23),d=(ne>>>14|s<<18)^(ne>>>18|s<<14)^(s>>>9|ne<<23),A+=d&65535,g+=d>>>16,m+=h&65535,w+=h>>>16,h=s&X^~s&ee,d=ne&oe^~ne&ae,A+=d&65535,g+=d>>>16,m+=h&65535,w+=h>>>16,h=An[P*2],d=An[P*2+1],A+=d&65535,g+=d>>>16,m+=h&65535,w+=h>>>16,h=a[P%16],d=u[P%16],A+=d&65535,g+=d>>>16,m+=h&65535,w+=h>>>16,g+=A>>>16,m+=g>>>16,w+=m>>>16,S=m&65535|w<<16,B=A&65535|g<<16,h=S,d=B,A=d&65535,g=d>>>16,m=h&65535,w=h>>>16,h=(I>>>28|k<<4)^(k>>>2|I<<30)^(k>>>7|I<<25),d=(k>>>28|I<<4)^(I>>>2|k<<30)^(I>>>7|k<<25),A+=d&65535,g+=d>>>16,m+=h&65535,w+=h>>>16,h=I&F^I&V^F&V,d=k&J^k&q^J&q,A+=d&65535,g+=d>>>16,m+=h&65535,w+=h>>>16,g+=A>>>16,m+=g>>>16,w+=m>>>16,L=m&65535|w<<16,D=A&65535|g<<16,h=T,d=N,A=d&65535,g=d>>>16,m=h&65535,w=h>>>16,h=S,d=B,A+=d&65535,g+=d>>>16,m+=h&65535,w+=h>>>16,g+=A>>>16,m+=g>>>16,w+=m>>>16,T=m&65535|w<<16,N=A&65535|g<<16,F=p,V=b,G=K,s=T,X=U,ee=Q,re=_,I=L,J=R,q=H,ye=j,ne=N,oe=z,ae=O,se=C,k=D,P%16===15)for(E=0;E<16;E++)h=a[E],d=u[E],A=d&65535,g=d>>>16,m=h&65535,w=h>>>16,h=a[(E+9)%16],d=u[(E+9)%16],A+=d&65535,g+=d>>>16,m+=h&65535,w+=h>>>16,S=a[(E+1)%16],B=u[(E+1)%16],h=(S>>>1|B<<31)^(S>>>8|B<<24)^S>>>7,d=(B>>>1|S<<31)^(B>>>8|S<<24)^(B>>>7|S<<25),A+=d&65535,g+=d>>>16,m+=h&65535,w+=h>>>16,S=a[(E+14)%16],B=u[(E+14)%16],h=(S>>>19|B<<13)^(B>>>29|S<<3)^S>>>6,d=(B>>>19|S<<13)^(S>>>29|B<<3)^(B>>>6|S<<26),A+=d&65535,g+=d>>>16,m+=h&65535,w+=h>>>16,g+=A>>>16,m+=g>>>16,w+=m>>>16,a[E]=m&65535|w<<16,u[E]=A&65535|g<<16;h=I,d=k,A=d&65535,g=d>>>16,m=h&65535,w=h>>>16,h=t[0],d=o[0],A+=d&65535,g+=d>>>16,m+=h&65535,w+=h>>>16,g+=A>>>16,m+=g>>>16,w+=m>>>16,t[0]=I=m&65535|w<<16,o[0]=k=A&65535|g<<16,h=F,d=J,A=d&65535,g=d>>>16,m=h&65535,w=h>>>16,h=t[1],d=o[1],A+=d&65535,g+=d>>>16,m+=h&65535,w+=h>>>16,g+=A>>>16,m+=g>>>16,w+=m>>>16,t[1]=F=m&65535|w<<16,o[1]=J=A&65535|g<<16,h=V,d=q,A=d&65535,g=d>>>16,m=h&65535,w=h>>>16,h=t[2],d=o[2],A+=d&65535,g+=d>>>16,m+=h&65535,w+=h>>>16,g+=A>>>16,m+=g>>>16,w+=m>>>16,t[2]=V=m&65535|w<<16,o[2]=q=A&65535|g<<16,h=G,d=ye,A=d&65535,g=d>>>16,m=h&65535,w=h>>>16,h=t[3],d=o[3],A+=d&65535,g+=d>>>16,m+=h&65535,w+=h>>>16,g+=A>>>16,m+=g>>>16,w+=m>>>16,t[3]=G=m&65535|w<<16,o[3]=ye=A&65535|g<<16,h=s,d=ne,A=d&65535,g=d>>>16,m=h&65535,w=h>>>16,h=t[4],d=o[4],A+=d&65535,g+=d>>>16,m+=h&65535,w+=h>>>16,g+=A>>>16,m+=g>>>16,w+=m>>>16,t[4]=s=m&65535|w<<16,o[4]=ne=A&65535|g<<16,h=X,d=oe,A=d&65535,g=d>>>16,m=h&65535,w=h>>>16,h=t[5],d=o[5],A+=d&65535,g+=d>>>16,m+=h&65535,w+=h>>>16,g+=A>>>16,m+=g>>>16,w+=m>>>16,t[5]=X=m&65535|w<<16,o[5]=oe=A&65535|g<<16,h=ee,d=ae,A=d&65535,g=d>>>16,m=h&65535,w=h>>>16,h=t[6],d=o[6],A+=d&65535,g+=d>>>16,m+=h&65535,w+=h>>>16,g+=A>>>16,m+=g>>>16,w+=m>>>16,t[6]=ee=m&65535|w<<16,o[6]=ae=A&65535|g<<16,h=re,d=se,A=d&65535,g=d>>>16,m=h&65535,w=h>>>16,h=t[7],d=o[7],A+=d&65535,g+=d>>>16,m+=h&65535,w+=h>>>16,g+=A>>>16,m+=g>>>16,w+=m>>>16,t[7]=re=m&65535|w<<16,o[7]=se=A&65535|g<<16,de+=128,e-=128}return e}y(wn,"crypto_hashblocks_hl");function Ze(t,o,i){var e=new Int32Array(8),a=new Int32Array(8),u=new Uint8Array(256),p,b=i;for(e[0]=1779033703,e[1]=3144134277,e[2]=1013904242,e[3]=2773480762,e[4]=1359893119,e[5]=2600822924,e[6]=528734635,e[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(e,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,Fe(u,i-8,b/536870912|0,b<<3),wn(e,a,u,i),p=0;p<8;p++)Fe(t,8*p,e[p],a[p]);return 0}y(Ze,"crypto_hash");function zr(t,o){var i=r(),e=r(),a=r(),u=r(),p=r(),b=r(),K=r(),T=r(),U=r();Ye(i,t[1],t[0]),Ye(U,o[1],o[0]),Z(i,i,U),ze(e,t[0],t[1]),ze(U,o[0],o[1]),Z(e,e,U),Z(a,t[3],o[3]),Z(a,a,ue),Z(u,t[2],o[2]),ze(u,u,u),Ye(p,e,i),Ye(b,u,a),ze(K,u,a),ze(T,e,i),Z(t[0],p,b),Z(t[1],T,K),Z(t[2],K,b),Z(t[3],p,T)}y(zr,"add");function Kn(t,o,i){var e;for(e=0;e<4;e++)fr(t[e],o[e],i)}y(Kn,"cswap");function st(t,o){var i=r(),e=r(),a=r();ln(a,o[2]),Z(i,o[0],a),Z(e,o[1],a),ir(t,e),t[31]^=dn(i)<<7}y(st,"pack");function ct(t,o,i){var e,a;for(Ge(t[0],l),Ge(t[1],v),Ge(t[2],v),Ge(t[3],l),a=255;a>=0;--a)e=i[a/8|0]>>(a&7)&1,Kn(t,o,e),zr(o,t),zr(t,t),Kn(t,o,e)}y(ct,"scalarmult");function Yr(t,o){var i=[r(),r(),r(),r()];Ge(i[0],ie),Ge(i[1],pe),Ge(i[2],v),Z(i[3],ie,pe),ct(t,i,o)}y(Yr,"scalarbase");function yt(t,o,i){var e=new Uint8Array(64),a=[r(),r(),r(),r()],u;for(i||f(o,32),Ze(e,o,32),e[0]&=248,e[31]&=127,e[31]|=64,Yr(a,e),st(t,a),u=0;u<32;u++)o[u+32]=t[u];return 0}y(yt,"crypto_sign_keypair");var jr=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 xt(t,o){var i,e,a,u;for(e=63;e>=32;--e){for(i=0,a=e-32,u=e-12;a<u;++a)o[a]+=i-16*o[e]*jr[a-(e-32)],i=Math.floor((o[a]+128)/256),o[a]-=i*256;o[a]+=i,o[e]=0}for(i=0,a=0;a<32;a++)o[a]+=i-(o[31]>>4)*jr[a],i=o[a]>>8,o[a]&=255;for(a=0;a<32;a++)o[a]-=i*jr[a];for(e=0;e<32;e++)o[e+1]+=o[e]>>8,t[e]=o[e]&255}y(xt,"modL");function ut(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;xt(t,o)}y(ut,"reduce");function En(t,o,i,e){var a=new Uint8Array(64),u=new Uint8Array(64),p=new Uint8Array(64),b,K,T=new Float64Array(64),U=[r(),r(),r(),r()];Ze(a,e,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(Ze(p,t.subarray(32),i+32),ut(p),Yr(U,p),st(t,U),b=32;b<64;b++)t[b]=e[b];for(Ze(u,t,i+64),ut(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 xt(t.subarray(32),T),Q}y(En,"crypto_sign");function pf(t,o){var i=r(),e=r(),a=r(),u=r(),p=r(),b=r(),K=r();return Ge(t[2],v),at(t[1],o),Me(a,t[1]),Z(u,a,$),Ye(a,a,t[2]),ze(u,t[2],u),Me(p,u),Me(b,p),Z(K,b,p),Z(i,K,a),Z(i,i,u),gn(i,i),Z(i,i,a),Z(i,i,u),Z(i,i,u),Z(t[0],i,u),Me(e,t[0]),Z(e,e,u),hn(e,a)&&Z(t[0],t[0],Be),Me(e,t[0]),Z(e,e,u),hn(e,a)?-1:(dn(t[0])===o[31]>>7&&Ye(t[0],l,t[0]),Z(t[3],t[0],t[1]),0)}y(pf,"unpackneg");function pt(t,o,i,e){var a,u=new Uint8Array(32),p=new Uint8Array(64),b=[r(),r(),r(),r()],K=[r(),r(),r(),r()];if(i<64||pf(K,e))return-1;for(a=0;a<i;a++)t[a]=o[a];for(a=0;a<32;a++)t[a+32]=e[a];if(Ze(p,t,i),ut(p),ct(b,K,p),Yr(K,o.subarray(32)),zr(b,K),st(u,b),i-=64,Ae(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(pt,"crypto_sign_open");var ht=32,Hr=24,wr=32,or=16,Kr=32,Fr=32,Er=32,Ur=32,dt=32,Un=Hr,hf=wr,df=or,Ve=64,Je=32,ar=64,lt=32,gt=64;n.lowlevel={crypto_core_hsalsa20:me,crypto_stream_xor:Xe,crypto_stream:Ie,crypto_stream_salsa20_xor:Oe,crypto_stream_salsa20:Ce,crypto_onetimeauth:nt,crypto_onetimeauth_verify:pn,crypto_verify_16:fe,crypto_verify_32:Ae,crypto_secretbox:ft,crypto_secretbox_open:it,crypto_scalarmult:Rr,crypto_scalarmult_base:Nr,crypto_box_beforenm:Or,crypto_box_afternm:mn,crypto_box:xf,crypto_box_open:uf,crypto_box_keypair:bn,crypto_hash:Ze,crypto_sign:En,crypto_sign_keypair:yt,crypto_sign_open:pt,crypto_secretbox_KEYBYTES:ht,crypto_secretbox_NONCEBYTES:Hr,crypto_secretbox_ZEROBYTES:wr,crypto_secretbox_BOXZEROBYTES:or,crypto_scalarmult_BYTES:Kr,crypto_scalarmult_SCALARBYTES:Fr,crypto_box_PUBLICKEYBYTES:Er,crypto_box_SECRETKEYBYTES:Ur,crypto_box_BEFORENMBYTES:dt,crypto_box_NONCEBYTES:Un,crypto_box_ZEROBYTES:hf,crypto_box_BOXZEROBYTES:df,crypto_sign_BYTES:Ve,crypto_sign_PUBLICKEYBYTES:Je,crypto_sign_SECRETKEYBYTES:ar,crypto_sign_SEEDBYTES:lt,crypto_hash_BYTES:gt,gf:r,D:$,L:jr,pack25519:ir,unpack25519:at,M:Z,A:ze,S:Me,Z:Ye,pow2523:gn,add:zr,set25519:Ge,modL:xt,scalarmult:ct,scalarbase:Yr};function vn(t,o){if(t.length!==ht)throw new Error("bad key size");if(o.length!==Hr)throw new Error("bad nonce size")}y(vn,"checkLengths");function lf(t,o){if(t.length!==Er)throw new Error("bad public key size");if(o.length!==Ur)throw new Error("bad secret key size")}y(lf,"checkBoxLengths");function Pe(){for(var t=0;t<arguments.length;t++)if(!(arguments[t]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}y(Pe,"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){Pe(t,o,i),vn(i,o);for(var e=new Uint8Array(wr+t.length),a=new Uint8Array(e.length),u=0;u<t.length;u++)e[u+wr]=t[u];return ft(a,e,e.length,o,i),a.subarray(or)},n.secretbox.open=function(t,o,i){Pe(t,o,i),vn(i,o);for(var e=new Uint8Array(or+t.length),a=new Uint8Array(e.length),u=0;u<t.length;u++)e[u+or]=t[u];return e.length<32||it(a,e,e.length,o,i)!==0?null:a.subarray(wr)},n.secretbox.keyLength=ht,n.secretbox.nonceLength=Hr,n.secretbox.overheadLength=or,n.scalarMult=function(t,o){if(Pe(t,o),t.length!==Fr)throw new Error("bad n size");if(o.length!==Kr)throw new Error("bad p size");var i=new Uint8Array(Kr);return Rr(i,t,o),i},n.scalarMult.base=function(t){if(Pe(t),t.length!==Fr)throw new Error("bad n size");var o=new Uint8Array(Kr);return Nr(o,t),o},n.scalarMult.scalarLength=Fr,n.scalarMult.groupElementLength=Kr,n.box=function(t,o,i,e){var a=n.box.before(i,e);return n.secretbox(t,o,a)},n.box.before=function(t,o){Pe(t,o),lf(t,o);var i=new Uint8Array(dt);return Or(i,t,o),i},n.box.after=n.secretbox,n.box.open=function(t,o,i,e){var a=n.box.before(i,e);return n.secretbox.open(t,o,a)},n.box.open.after=n.secretbox.open,n.box.keyPair=function(){var t=new Uint8Array(Er),o=new Uint8Array(Ur);return bn(t,o),{publicKey:t,secretKey:o}},n.box.keyPair.fromSecretKey=function(t){if(Pe(t),t.length!==Ur)throw new Error("bad secret key size");var o=new Uint8Array(Er);return Nr(o,t),{publicKey:o,secretKey:new Uint8Array(t)}},n.box.publicKeyLength=Er,n.box.secretKeyLength=Ur,n.box.sharedKeyLength=dt,n.box.nonceLength=Un,n.box.overheadLength=n.secretbox.overheadLength,n.sign=function(t,o){if(Pe(t,o),o.length!==ar)throw new Error("bad secret key size");var i=new Uint8Array(Ve+t.length);return En(i,t,t.length,o),i},n.sign.open=function(t,o){if(Pe(t,o),o.length!==Je)throw new Error("bad public key size");var i=new Uint8Array(t.length),e=pt(i,t,t.length,o);if(e<0)return null;for(var a=new Uint8Array(e),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),e=new Uint8Array(Ve),a=0;a<e.length;a++)e[a]=i[a];return e},n.sign.detached.verify=function(t,o,i){if(Pe(t,o,i),o.length!==Ve)throw new Error("bad signature size");if(i.length!==Je)throw new Error("bad public key size");var e=new Uint8Array(Ve+t.length),a=new Uint8Array(Ve+t.length),u;for(u=0;u<Ve;u++)e[u]=o[u];for(u=0;u<t.length;u++)e[u+Ve]=t[u];return pt(a,e,e.length,i)>=0},n.sign.keyPair=function(){var t=new Uint8Array(Je),o=new Uint8Array(ar);return yt(t,o),{publicKey:t,secretKey:o}},n.sign.keyPair.fromSecretKey=function(t){if(Pe(t),t.length!==ar)throw new Error("bad secret key size");for(var o=new Uint8Array(Je),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(Pe(t),t.length!==lt)throw new Error("bad seed size");for(var o=new Uint8Array(Je),i=new Uint8Array(ar),e=0;e<32;e++)i[e]=t[e];return yt(o,i,!0),{publicKey:o,secretKey:i}},n.sign.publicKeyLength=Je,n.sign.secretKeyLength=ar,n.sign.seedLength=lt,n.sign.signatureLength=Ve,n.hash=function(t){Pe(t);var o=new Uint8Array(gt);return Ze(o,t,t.length),o},n.hash.hashLength=gt,n.verify=function(t,o){return Pe(t,o),t.length===0||o.length===0||t.length!==o.length?!1:W(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,e){var a,u=new Uint8Array(e);for(a=0;a<e;a+=o)t.getRandomValues(u.subarray(a,a+Math.min(e-a,o)));for(a=0;a<e;a++)i[a]=u[a];Sn(u)})}else typeof _n<"u"&&(t=ff(),t&&t.randomBytes&&n.setPRNG(function(i,e){var a,u=t.randomBytes(e);for(a=0;a<e;a++)i[a]=u[a];Sn(u)}))})()})(typeof Qr<"u"&&Qr.exports?Qr.exports:self.nacl=self.nacl||{})});var vf=globalThis||window||self,te=vf.crypto;function Sr(n=0){return new Uint8Array(n)}y(Sr,"allocUnsafe");function bt(n,r){r==null&&(r=n.reduce((x,l)=>x+l.length,0));let f=Sr(r),c=0;for(let x of n)f.set(x,c),c+=x.length;return f}y(bt,"concat");var _t={};Le(_t,{base10:()=>Df});var mo=new Uint8Array(0);function Bn(n,r){if(n===r)return!0;if(n.byteLength!==r.byteLength)return!1;for(let f=0;f<n.byteLength;f++)if(n[f]!==r[f])return!1;return!0}y(Bn,"equals");function ke(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(ke,"coerce");function Pn(n){return new TextEncoder().encode(n)}y(Pn,"fromString");function Tn(n){return new TextDecoder().decode(n)}y(Tn,"toString");function _f(n,r){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),v=l.charCodeAt(0);if(f[v]!==255)throw new TypeError(l+" is ambiguous");f[v]=x}var M=n.length,$=n.charAt(0),ue=Math.log(M)/Math.log(256),ie=Math.log(256)/Math.log(M);function pe(W){if(W instanceof Uint8Array||(ArrayBuffer.isView(W)?W=new Uint8Array(W.buffer,W.byteOffset,W.byteLength):Array.isArray(W)&&(W=Uint8Array.from(W))),!(W instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(W.length===0)return"";for(var fe=0,Ae=0,Ue=0,be=W.length;Ue!==be&&W[Ue]===0;)Ue++,fe++;for(var ve=(be-Ue)*ie+1>>>0,me=new Uint8Array(ve);Ue!==be;){for(var le=W[Ue],Oe=0,Ce=ve-1;(le!==0||Oe<Ae)&&Ce!==-1;Ce--,Oe++)le+=256*me[Ce]>>>0,me[Ce]=le%M>>>0,le=le/M>>>0;if(le!==0)throw new Error("Non-zero carry");Ae=Oe,Ue++}for(var Ie=ve-Ae;Ie!==ve&&me[Ie]===0;)Ie++;for(var Xe=$.repeat(fe);Ie<ve;++Ie)Xe+=n.charAt(me[Ie]);return Xe}y(pe,"encode");function Be(W){if(typeof W!="string")throw new TypeError("Expected String");if(W.length===0)return new Uint8Array;var fe=0;if(W[fe]!==" "){for(var Ae=0,Ue=0;W[fe]===$;)Ae++,fe++;for(var be=(W.length-fe)*ue+1>>>0,ve=new Uint8Array(be);W[fe];){var me=f[W.charCodeAt(fe)];if(me===255)return;for(var le=0,Oe=be-1;(me!==0||le<Ue)&&Oe!==-1;Oe--,le++)me+=M*ve[Oe]>>>0,ve[Oe]=me%256>>>0,me=me/256>>>0;if(me!==0)throw new Error("Non-zero carry");Ue=le,fe++}if(W[fe]!==" "){for(var Ce=be-Ue;Ce!==be&&ve[Ce]===0;)Ce++;for(var Ie=new Uint8Array(Ae+(be-Ce)),Xe=Ae;Ce!==be;)Ie[Xe++]=ve[Ce++];return Ie}}}y(Be,"decodeUnsafe");function Fe(W){var fe=Be(W);if(fe)return fe;throw new Error(`Non-${r} character`)}return y(Fe,"decode"),{encode:pe,decodeUnsafe:Be,decode:Fe}}y(_f,"base");var Cf=_f,Bf=Cf,In=Bf;var Et=class Et{constructor(r,f,c){Y(this,"name");Y(this,"prefix");Y(this,"baseEncode");this.name=r,this.prefix=f,this.baseEncode=c}encode(r){if(r instanceof Uint8Array)return`${this.prefix}${this.baseEncode(r)}`;throw Error("Unknown type, must be binary type")}};y(Et,"Encoder");var mt=Et,Ut=class Ut{constructor(r,f,c){Y(this,"name");Y(this,"prefix");Y(this,"baseDecode");Y(this,"prefixCodePoint");this.name=r,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(r){if(typeof r=="string"){if(r.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(r)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(r.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(r){return Mn(this,r)}};y(Ut,"Decoder");var At=Ut,vt=class vt{constructor(r){Y(this,"decoders");this.decoders=r}or(r){return Mn(this,r)}decode(r){let f=r[0],c=this.decoders[f];if(c!=null)return c.decode(r);throw RangeError(`Unable to decode multibase string ${JSON.stringify(r)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};y(vt,"ComposedDecoder");var wt=vt;function Mn(n,r){return new wt({...n.decoders??{[n.prefix]:n},...r.decoders??{[r.prefix]:r}})}y(Mn,"or");var St=class St{constructor(r,f,c,x){Y(this,"name");Y(this,"prefix");Y(this,"baseEncode");Y(this,"baseDecode");Y(this,"encoder");Y(this,"decoder");this.name=r,this.prefix=f,this.baseEncode=c,this.baseDecode=x,this.encoder=new mt(r,f,c),this.decoder=new At(r,f,x)}encode(r){return this.encoder.encode(r)}decode(r){return this.decoder.decode(r)}};y(St,"Codec");var Kt=St;function sr({name:n,prefix:r,encode:f,decode:c}){return new Kt(n,r,f,c)}y(sr,"from");function We({name:n,prefix:r,alphabet:f}){let{encode:c,decode:x}=In(f,n);return sr({prefix:r,name:n,encode:c,decode:y(l=>ke(x(l)),"decode")})}y(We,"baseX");function Pf(n,r,f,c){let x={};for(let ie=0;ie<r.length;++ie)x[r[ie]]=ie;let l=n.length;for(;n[l-1]==="=";)--l;let v=new Uint8Array(l*f/8|0),M=0,$=0,ue=0;for(let ie=0;ie<l;++ie){let pe=x[n[ie]];if(pe===void 0)throw new SyntaxError(`Non-${c} character`);$=$<<f|pe,M+=f,M>=8&&(M-=8,v[ue++]=255&$>>M)}if(M>=f||(255&$<<8-M)!==0)throw new SyntaxError("Unexpected end of data");return v}y(Pf,"decode");function Tf(n,r,f){let c=r[r.length-1]==="=",x=(1<<f)-1,l="",v=0,M=0;for(let $=0;$<n.length;++$)for(M=M<<8|n[$],v+=8;v>f;)v-=f,l+=r[x&M>>v];if(v!==0&&(l+=r[x&M<<f-v]),c)for(;(l.length*f&7)!==0;)l+="=";return l}y(Tf,"encode");function ce({name:n,prefix:r,bitsPerChar:f,alphabet:c}){return sr({prefix:r,name:n,encode(x){return Tf(x,c,f)},decode(x){return Pf(x,c,f,n)}})}y(ce,"rfc4648");var Df=We({prefix:"9",name:"base10",alphabet:"0123456789"});var Ct={};Le(Ct,{base16:()=>If,base16upper:()=>Mf});var If=ce({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Mf=ce({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Bt={};Le(Bt,{base2:()=>Lf});var Lf=ce({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Pt={};Le(Pt,{base256emoji:()=>Yf});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}"),Rf=Ln.reduce((n,r,f)=>(n[f]=r,n),[]),Nf=Ln.reduce((n,r,f)=>{let c=r.codePointAt(0);if(c==null)throw new Error(`Invalid character: ${r}`);return n[c]=f,n},[]);function Of(n){return n.reduce((r,f)=>(r+=Rf[f],r),"")}y(Of,"encode");function zf(n){let r=[];for(let f of n){let c=f.codePointAt(0);if(c==null)throw new Error(`Invalid character: ${f}`);let x=Nf[c];if(x==null)throw new Error(`Non-base256emoji character: ${f}`);r.push(x)}return new Uint8Array(r)}y(zf,"decode");var Yf=sr({prefix:"\u{1F680}",name:"base256emoji",encode:Of,decode:zf});var Tt={};Le(Tt,{base32:()=>cr,base32hex:()=>Gf,base32hexpad:()=>kf,base32hexpadupper:()=>Xf,base32hexupper:()=>Vf,base32pad:()=>Hf,base32padupper:()=>Ff,base32upper:()=>jf,base32z:()=>Wf});var cr=ce({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),jf=ce({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Hf=ce({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Ff=ce({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Gf=ce({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Vf=ce({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),kf=ce({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Xf=ce({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Wf=ce({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Dt={};Le(Dt,{base36:()=>_r,base36upper:()=>$f});var _r=We({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),$f=We({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var It={};Le(It,{base58btc:()=>He,base58flickr:()=>Zf});var He=We({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Zf=We({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Mt={};Le(Mt,{base64:()=>Jf,base64pad:()=>qf,base64url:()=>Qf,base64urlpad:()=>ei});var Jf=ce({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),qf=ce({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Qf=ce({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),ei=ce({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Lt={};Le(Lt,{base8:()=>ri});var ri=ce({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Rt={};Le(Rt,{identity:()=>ti});var ti=sr({prefix:"\0",name:"identity",encode:y(n=>Tn(n),"encode"),decode:y(n=>Pn(n),"decode")});var Yo=new TextEncoder,jo=new TextDecoder;var zt={};Le(zt,{identity:()=>vi});var ii=On,Rn=128,oi=127,ai=~oi,si=Math.pow(2,31);function On(n,r,f){r=r||[],f=f||0;for(var c=f;n>=si;)r[f++]=n&255|Rn,n/=128;for(;n&ai;)r[f++]=n&255|Rn,n>>>=7;return r[f]=n|0,On.bytes=f-c+1,r}y(On,"encode");var ci=Nt,yi=128,Nn=127;function Nt(n,c){var f=0,c=c||0,x=0,l=c,v,M=n.length;do{if(l>=M)throw Nt.bytes=0,new RangeError("Could not decode varint");v=n[l++],f+=x<28?(v&Nn)<<x:(v&Nn)*Math.pow(2,x),x+=7}while(v>=yi);return Nt.bytes=l-c,f}y(Nt,"read");var xi=Math.pow(2,7),ui=Math.pow(2,14),pi=Math.pow(2,21),hi=Math.pow(2,28),di=Math.pow(2,35),li=Math.pow(2,42),gi=Math.pow(2,49),bi=Math.pow(2,56),mi=Math.pow(2,63),Ai=y(function(n){return n<xi?1:n<ui?2:n<pi?3:n<hi?4:n<di?5:n<li?6:n<gi?7:n<bi?8:n<mi?9:10},"length"),wi={encode:ii,decode:ci,encodingLength:Ai},Ki=wi,Cr=Ki;function Br(n,r=0){return[Cr.decode(n,r),Cr.decode.bytes]}y(Br,"decode");function yr(n,r,f=0){return Cr.encode(n,r,f),r}y(yr,"encodeTo");function xr(n){return Cr.encodingLength(n)}y(xr,"encodingLength");function qe(n,r){let f=r.byteLength,c=xr(n),x=c+xr(f),l=new Uint8Array(x+f);return yr(n,l,0),yr(f,l,c),l.set(r,x),new ur(n,f,r,l)}y(qe,"create");function zn(n){let r=ke(n),[f,c]=Br(r),[x,l]=Br(r.subarray(c)),v=r.subarray(c+l);if(v.byteLength!==x)throw new Error("Incorrect length");return new ur(f,x,v,r)}y(zn,"decode");function Yn(n,r){if(n===r)return!0;{let f=r;return n.code===f.code&&n.size===f.size&&f.bytes instanceof Uint8Array&&Bn(n.bytes,f.bytes)}}y(Yn,"equals");var Ot=class Ot{constructor(r,f,c,x){Y(this,"code");Y(this,"size");Y(this,"digest");Y(this,"bytes");this.code=r,this.size=f,this.digest=c,this.bytes=x}};y(Ot,"Digest");var ur=Ot;var jn=0,Ei="identity",Hn=ke;function Ui(n){return qe(jn,Hn(n))}y(Ui,"digest");var vi={code:jn,name:Ei,encode:Hn,digest:Ui};var Ft={};Le(Ft,{sha256:()=>Si,sha512:()=>_i});function jt({name:n,code:r,encode:f}){return new Yt(n,r,f)}y(jt,"from");var Ht=class Ht{constructor(r,f,c){Y(this,"name");Y(this,"code");Y(this,"encode");this.name=r,this.code=f,this.encode=c}digest(r){if(r instanceof Uint8Array){let f=this.encode(r);return f instanceof Uint8Array?qe(this.code,f):f.then(c=>qe(this.code,c))}else throw Error("Unknown type, must be binary type")}};y(Ht,"Hasher");var Yt=Ht;function Gn(n){return async r=>new Uint8Array(await crypto.subtle.digest(n,r))}y(Gn,"sha");var Si=jt({name:"sha2-256",code:18,encode:Gn("SHA-256")}),_i=jt({name:"sha2-512",code:19,encode:Gn("SHA-512")});function Vn(n,r){let{bytes:f,version:c}=n;switch(c){case 0:return Bi(f,Gt(n),r??He.encoder);default:return Pi(f,Gt(n),r??cr.encoder)}}y(Vn,"format");var kn=new WeakMap;function Gt(n){let r=kn.get(n);if(r==null){let f=new Map;return kn.set(n,f),f}return r}y(Gt,"baseCache");var Wn,ge=class ge{constructor(r,f,c,x){Y(this,"code");Y(this,"version");Y(this,"multihash");Y(this,"bytes");Y(this,"/");Y(this,Wn,"CID");this.code=f,this.version=r,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:r,multihash:f}=this;if(r!==Tr)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(f.code!==Ti)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return ge.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:r,digest:f}=this.multihash,c=qe(r,f);return ge.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(r){return ge.equals(this,r)}static equals(r,f){let c=f;return c!=null&&r.code===c.code&&r.version===c.version&&Yn(r.multihash,c.multihash)}toString(r){return Vn(this,r)}toJSON(){return{"/":Vn(this)}}link(){return this}[(Wn=Symbol.toStringTag,Symbol.for("nodejs.util.inspect.custom"))](){return`CID(${this.toString()})`}static asCID(r){if(r==null)return null;let f=r;if(f instanceof ge)return f;if(f["/"]!=null&&f["/"]===f.bytes||f.asCID===f){let{version:c,code:x,multihash:l,bytes:v}=f;return new ge(c,x,l,v??Xn(c,x,l.bytes))}else if(f[Di]===!0){let{version:c,multihash:x,code:l}=f,v=zn(x);return ge.create(c,l,v)}else return null}static create(r,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(r){case 0:{if(f!==Tr)throw new Error(`Version 0 CID must use dag-pb (code: ${Tr}) block encoding`);return new ge(r,f,c,c.bytes)}case 1:{let x=Xn(r,f,c.bytes);return new ge(r,f,c,x)}default:throw new Error("Invalid version")}}static createV0(r){return ge.create(0,Tr,r)}static createV1(r,f){return ge.create(1,r,f)}static decode(r){let[f,c]=ge.decodeFirst(r);if(c.length!==0)throw new Error("Incorrect length");return f}static decodeFirst(r){let f=ge.inspectBytes(r),c=f.size-f.multihashSize,x=ke(r.subarray(c,c+f.multihashSize));if(x.byteLength!==f.multihashSize)throw new Error("Incorrect length");let l=x.subarray(f.multihashSize-f.digestSize),v=new ur(f.multihashCode,f.digestSize,l,x);return[f.version===0?ge.createV0(v):ge.createV1(f.codec,v),r.subarray(f.size)]}static inspectBytes(r){let f=0,c=y(()=>{let[pe,Be]=Br(r.subarray(f));return f+=Be,pe},"next"),x=c(),l=Tr;if(x===18?(x=0,f=0):l=c(),x!==0&&x!==1)throw new RangeError(`Invalid CID version ${x}`);let v=f,M=c(),$=c(),ue=f+$,ie=ue-v;return{version:x,codec:l,multihashCode:M,digestSize:$,multihashSize:ie,size:ue}}static parse(r,f){let[c,x]=Ci(r,f),l=ge.decode(x);if(l.version===0&&r[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Gt(l).set(c,r),l}};y(ge,"CID");var Vr=ge;function Ci(n,r){switch(n[0]){case"Q":{let f=r??He;return[He.prefix,f.decode(`${He.prefix}${n}`)]}case He.prefix:{let f=r??He;return[He.prefix,f.decode(n)]}case cr.prefix:{let f=r??cr;return[cr.prefix,f.decode(n)]}case _r.prefix:{let f=r??_r;return[_r.prefix,f.decode(n)]}default:{if(r==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[n[0],r.decode(n)]}}}y(Ci,"parseCIDtoBytes");function Bi(n,r,f){let{prefix:c}=f;if(c!==He.prefix)throw Error(`Cannot string encode V0 in ${f.name} encoding`);let x=r.get(c);if(x==null){let l=f.encode(n).slice(1);return r.set(c,l),l}else return x}y(Bi,"toStringV0");function Pi(n,r,f){let{prefix:c}=f,x=r.get(c);if(x==null){let l=f.encode(n);return r.set(c,l),l}else return x}y(Pi,"toStringV1");var Tr=112,Ti=18;function Xn(n,r,f){let c=xr(n),x=c+xr(r),l=new Uint8Array(x+f.byteLength);return yr(n,l,0),yr(r,l,c),l.set(f,x),l}y(Xn,"encodeCID");var Di=Symbol.for("@ipld/js-cid/CID");var Vt={...Rt,...Bt,...Lt,..._t,...Ct,...Tt,...Dt,...It,...Mt,...Pt},ba={...Ft,...zt};function Zn(n,r,f,c){return{name:n,prefix:r,encoder:{name:n,prefix:r,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))),kt=Zn("ascii","a",n=>{let r="a";for(let f=0;f<n.length;f++)r+=String.fromCharCode(n[f]);return r},n=>{n=n.substring(1);let r=Sr(n.length);for(let f=0;f<n.length;f++)r[f]=n.charCodeAt(f);return r}),Ii={utf8:$n,"utf-8":$n,hex:Vt.base16,latin1:kt,ascii:kt,binary:kt,...Vt},kr=Ii;function Te(n,r="utf8"){let f=kr[r];if(f==null)throw new Error(`Unsupported encoding "${r}"`);return f.decoder.decode(`${f.prefix}${n}`)}y(Te,"fromString");function xe(n,r="utf8"){let f=kr[r];if(f==null)throw new Error(`Unsupported encoding "${r}"`);return f.encoder.encode(n).substring(1)}y(xe,"toString");var Qe="did:key:z",pr="Ed25519",Xt="X25519",Ga="X25519";var hr="RSA-OAEP",dr="RSASSA-PKCS1-v1_5",Wt="SHA-256",$t=new Uint8Array([0,245,2]),Va=2048,Zt="SHA-256",lr=8,gr="AES-GCM",Re=gr,er=256,je=12,Jt=new Uint8Array([234,1]),qt=new Uint8Array([237,1]),Xr={RSA:"rsa",Edwards:"ed25519",BLS:"bls12-381"};var Wr="ecc-exchange",$r="ecc-write",Se=16;var Jn=new Error("Invalid key use. Please use 'encryption' or 'signing"),Ri=new Error("Max must be less than 256 and greater than 0");function he(n){return new Uint8Array(n).buffer}y(he,"toArrayBuffer");async function qn(n){return new Uint8Array(await te.subtle.digest("sha-256",n.buffer))}y(qn,"sha256");function Ne(n){let r=Te(n,"base64pad");return he(r)}y(Ne,"base64ToArrBuf");var Ir=y((n,r)=>{if(typeof n=="string")return r(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 Zr(n){return Ir(n,Ne)}y(Zr,"normalizeBase64ToBuf");var Ni=y(n=>Ir(n,r=>Qn(r,8)),"normalizeUtf8ToBuf");function Qn(n,r){let f=r===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 Oi=y(n=>Ir(n,r=>Qn(r,16)),"normalizeUtf16ToBuf");function br(n,r){switch(r){case 8:return Ni(n);default:return Oi(n)}}y(br,"normalizeUnicodeToBuf");function ef(n){if(!n.startsWith(Qe))throw new Error("Please use a base58-encoded DID formatted `did:key:z...`");let r=""+n.substring(Qe.length),f=Te(r,"base58btc"),{keyBuffer:c,type:x}=zi(he(f));return{publicKey:new Uint8Array(c),type:x}}y(ef,"didToPublicKey");function zi(n){if(Dr(n,he($t)))return{keyBuffer:n.slice($t.byteLength),type:Xr.RSA};if(Dr(n,he(qt)))return{keyBuffer:n.slice(qt.byteLength),type:Xr.Edwards};if(Dr(n,he(Jt)))return{keyBuffer:n.slice(Jt.byteLength),type:Xr.BLS};throw new Error("Unsupported key algorithm. Try using RSA.")}y(zi,"parseMagicBytes");var Yi={equal:y((n,r)=>{let f=new Uint8Array(n),c=new Uint8Array(r);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 Dr(n,r){return Yi.equal(r,n.slice(0,r.byteLength))}y(Dr,"hasPrefix");function De(n){return xe(n instanceof ArrayBuffer?new Uint8Array(n):n,"base64pad")}y(De,"toBase64");async function en(n,r){let f=typeof n=="string"?Ne(n):he(n);return te.subtle.importKey("raw",f,{name:r?.alg||Re,length:r?.length||er},!0,["encrypt","decrypt"])}y(en,"importKey");function rf(n,{max:r}={max:255}){if(r<1||r>255)throw Ri;let f=new Uint8Array(n);if(r===255)return te.getRandomValues(f),f.buffer;let c=0,x=r+1,l=Math.floor(256/x)*x,v=new Uint8Array(1);for(;c<f.length;)te.getRandomValues(v),v[0]<l&&(f[c]=v[0]%x,c++);return f.buffer}y(rf,"randomBuf");function Jr(n,r){let f=n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(he(n)),c=r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(he(r)),x=new Uint8Array(f.length+c.length);return x.set(f),x.set(c,f.length),x.buffer}y(Jr,"joinBufs");var ts=new Error("Key does not exist. Make sure you properly instantiated the keystore."),ns=new Error("Retrieved a symmetric key when an asymmetric keypair was expected. Please use a different key name."),fs=new Error("Retrieved an asymmetric keypair when an symmetric key was expected. Please use a different key name."),is=new Error("ECC is not enabled for this browser. Please use RSA instead."),os=new Error("Cryptosystem not supported. Please use ECC or RSA"),ji=new Error("Invalid key use. Please use 'exchange' or 'write'"),as=new Error("Max must be less than 256 and greater than 0");function tf(n){Hi(n,["exchange","write","signing"],ji)}y(tf,"checkValidKeyUse");function Hi(n,r,f){if(!r.some(x=>x===n))throw f}y(Hi,"checkValid");function qr(n){return new Promise((r,f)=>{n.oncomplete=n.onsuccess=()=>r(n.result),n.onabort=n.onerror=()=>f(n.error)})}y(qr,"promisifyRequest");function Fi(n,r){let f,c=y(()=>{if(f)return f;let x=indexedDB.open(n);return x.onupgradeneeded=()=>x.result.createObjectStore(r),f=qr(x),f.then(l=>{l.onclose=()=>f=void 0},()=>{}),f},"getDB");return(x,l)=>c().then(v=>l(v.transaction(r,x).objectStore(r)))}y(Fi,"createStore");var rn;function tn(){return rn||(rn=Fi("keyval-store","keyval")),rn}y(tn,"defaultGetStore");function nn(n,r=tn()){return r("readonly",f=>qr(f.get(n)))}y(nn,"get");function fn(n,r,f=tn()){return f("readwrite",c=>(c.put(r,n),qr(c.transaction)))}y(fn,"set");function nf(n,r=tn()){return r("readwrite",f=>(n.forEach(c=>f.delete(c)),qr(f.transaction)))}y(nf,"delMany");var af=Uf(of(),1);var sn={keyTypes:{"bls12-381":{magicBytes:new Uint8Array([234,1]),verify:y(()=>{throw new Error("Not implemented")},"verify")},rsa:{magicBytes:new Uint8Array([0,245,2]),verify:Vi},ed25519:{magicBytes:new Uint8Array([237,1]),verify:Gi}}};async function Gi({message:n,publicKey:r,signature:f}){let c=n;typeof n=="string"&&(c=Te(n,"utf8"));let x=f;typeof f=="string"&&(x=Te(f,"base64pad"));let l=r;if(typeof r=="string"&&(l=sf(r).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 af.default.sign.detached.verify(c,x,l)}y(Gi,"ed25519Verify");async function Vi({message:n,publicKey:r,signature:f}){let c=r;return typeof r=="string"&&(c=sf(r).publicKey),cn.verify(n,f,await te.subtle.importKey("spki",he(c),{name:dr,hash:Wt},!1,["verify"]),8)}y(Vi,"rsaVerify");var cn={verify:y(async function(r,f,c,x=lr,l=Zt){return te.subtle.verify({name:dr,saltLength:Se},typeof c=="string"?await on(c,l,"signing"):c,Zr(f),br(r,x))},"rsaVerify"),sign:y(async function(r,f,c=lr){return te.subtle.sign({name:dr,saltLength:Se},f,br(r,c))},"sign"),encrypt:y(async function(r,f,c=lr,x=Zt){let l;return typeof f=="string"?l=await on(f,x,"exchange"):l=f instanceof Uint8Array?await on(he(f),x,"exchange"):f,te.subtle.encrypt({name:hr},l,br(r,c))},"rsaEncrypt"),decrypt:y(async function(r,f){let c=et(f)?f:await $i(f,["decrypt"]),x;typeof r=="string"?x=Te(r,"base64pad"):x=r;let l=await te.subtle.decrypt({name:hr},c,x instanceof Uint8Array?he(x):x);return new Uint8Array(l)},"rsaDecrypt")};async function on(n,r,f){ki(f);let c=f==="exchange"?hr:dr,x=f==="exchange"?["encrypt"]:["verify"],l=typeof n=="string"?Ne(Wi(n)):n;return te.subtle.importKey("spki",l,{name:c,hash:{name:r}},!0,x)}y(on,"rsaImportPublicKey");function ki(n){Xi(n,["signing","exchange"],Jn)}y(ki,"checkValidKeyUse");function Xi(n,r,f){if(!r.some(x=>x===n))throw f}y(Xi,"checkValid");function Wi(n){return n.replace(`-----BEGIN PUBLIC KEY-----
|
|
2
2
|
`,"").replace(`
|
|
3
|
-
-----END PUBLIC KEY-----`,"")}y(Zi,"stripKeyHeader");function qe(n){return fn(n,"algorithm")&&fn(n,"extractable")&&fn(n,"type")}y(qe,"isCryptoKey");function fn(n,e){return typeof n=="object"&&n!=null&&e in n}y(fn,"hasProp");function Ji(n,e){return tr.subtle.importKey("spki",n instanceof Uint8Array?ur(n):n,{name:ue,hash:Xt},!1,e)}y(Ji,"importRsaKey");async function sn(n,e="rsa"){let f=n instanceof CryptoKey?new Uint8Array(await ge(n)):n;n instanceof CryptoKey&&(e=n.algorithm.name.includes("RSA")?"rsa":"ed25519");let c=on.keyTypes[e]?.magicBytes;if(!c)throw new Error(`Key type '${e}' not supported, available types: ${Object.keys(on.keyTypes).join(", ")}`);let x=gt([c,f]);return qr+xr(x,"base58btc")}y(sn,"publicKeyToDid");async function ge(n){return n instanceof CryptoKey?await tr.subtle.exportKey("spki",n):await tr.subtle.exportKey("spki",n.publicKey)}y(ge,"getPublicKeyAsArrayBuffer");function yf(n){if(!n.startsWith(qr))throw new Error("Please use a base58-encoded DID formatted `did:key:z...`");let e=n.substring(qr.length),f=Br(e,"base58btc"),c=Object.entries(on.keyTypes).find(([l,S])=>Pe(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(yf,"didToPublicKey");var re={create(n={alg:Gr,length:Qr}){let e=n.length||Qr,f=n.alg||Gr;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 re.export(n);return e?xr(f,e):Nr(f)},"asString")}),import(n){return cn(typeof n=="string"?Or(n):n)},async exportAsString(n){let e=await re.export(n);return Nr(e)},encrypt:qi,async decrypt(n,e,f){let c=qe(e)?e:await cn(e),x=f?await tr.subtle.decrypt({name:de,iv:ur(f)},c,typeof n=="string"?ur(Br(n)):n instanceof Uint8Array?ur(n):n):await ro(n,c);return new Uint8Array(x)}};function cn(n,e){return tr.subtle.importKey("raw",n instanceof Uint8Array?ur(n):n,{name:de,length:e||256},!0,["encrypt","decrypt"])}y(cn,"importAesKey");async function qi(n,e,f,c){let x=qe(e)?e:await cn(e),l=c?await tr.subtle.encrypt({name:de,iv:ur(c)},x,ur(n)):await Qi(n,x);return f&&f==="arraybuffer"?l:new Uint8Array(l)}y(qi,"encrypt");async function Qi(n,e,f){let c=le(n,f?.charsize??he),x=typeof e=="string"?await qt(e,f):e,l=f?.iv||nf(kr),S=await tr.subtle.encrypt({name:de,iv:l},x,c);return $e(l,S)}y(Qi,"encryptBytes");async function ro(n,e,f){let c=We(n),x=typeof e=="string"?await qt(e,f):e,l=c.slice(0,kr),S=c.slice(kr);return await tr.subtle.decrypt({name:Gr,iv:l},x,S)}y(ro,"decryptBytes");var Wr=class Wr{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 ge(this.writeKey),x=new Uint8Array(c);return f?xr(x,f):Nr(x)},"asString")})}get publicExchangeKey(){let e=this.exchangeKey.publicKey;return Object.assign(e,{asString:y(async f=>{let c=await ge(this.exchangeKey),x=new Uint8Array(c);return f?xr(x,f):Nr(x)},"asString")})}get privateWriteKey(){return this.writeKey.privateKey}get privateExchangeKey(){return this.exchangeKey.privateKey}get deviceName(){return Wr.deviceName(this.DID)}static deviceName(e){return eo(e)}async persist(){if(this.isSessionOnly)return;let e=this.constructor.EXCHANGE_KEY_NAME,f=this.constructor.WRITE_KEY_NAME;await Promise.all([tn(e,this.exchangeKey),tn(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 Wr.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 ge(l),Y=await sn(new Uint8Array(S),this.TYPE==="ecc"?"ed25519":"rsa"),er=new this({keys:{exchange:x,write:l},did:Y,hasPersisted:!1,isSessionOnly:!!e});return this._instance=er,er}static async load(e={session:!1}){if(this._instance)return this._instance;let f=!0,c=await en(e.encryptionKeyName||this.EXCHANGE_KEY_NAME),x=await en(e.writeKeyName||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 ge(x),S=await sn(new Uint8Array(l),this.TYPE==="ecc"?"ed25519":"rsa"),Y=new this({keys:{exchange:c,write:x},did:S,hasPersisted:f,isSessionOnly:!!e.session});return this._instance=Y,Y}};y(Wr,"AbstractKeys"),O(Wr,"EXCHANGE_KEY_NAME"),O(Wr,"WRITE_KEY_NAME"),O(Wr,"_instance");var Qe=Wr;async function xf(n,e){let{content:f,publicKey:c}=n,x=e||await re.create(),l=await re.encrypt(typeof f=="string"?Br(f):f,typeof x=="string"?await re.import(x):x),S=await yn({key:x,publicKey:c});return $e(S,l)}y(xf,"encryptTo");xf.asString=async function(n,e){let f=await xf(n,e);return xr(new Uint8Array(f),"base64pad")};async function yn({key:n,publicKey:e},f){let c;n instanceof CryptoKey?c=await re.export(n):c=n;let x=await an.encrypt(c,e);return f&&f==="arraybuffer"?x:new Uint8Array(x)}y(yn,"encryptKeyTo");yn.asString=async function({key:n,publicKey:e},f){let c=await yn({key:n,publicKey:e});return f?xr(c,f):Nr(c)};async function eo(n){let e=await rf(new TextEncoder().encode(n.normalize("NFD")));return xr(e,"base32").slice(0,32)}y(eo,"getDeviceName");function De(n){return new Uint8Array(n).buffer}y(De,"toArrayBuffer");var _r=class _r extends Qe{static async create(e,f,c){return await super.create(e,f,c)}constructor(e){super(e),_r.EXCHANGE_KEY_NAME=e.exchangeKeyName||Xe,_r.WRITE_KEY_NAME=e.writeKeyName||ke}get publicExchangeKey(){let e=this.exchangeKey.publicKey;return Object.assign(e,{asString:y(async f=>{let c=await xn(this.exchangeKey),x=new Uint8Array(c);return f?xr(x,f):Nr(c)},"asString")})}get publicWriteKey(){let e=this.writeKey.publicKey;return Object.assign(e,{asString:y(async f=>{let c=await xn(this.writeKey),x=new Uint8Array(c);return f?xr(x,f):Nr(c)},"asString")})}static async _createExchangeKeys(e=!1){return await tr.subtle.generateKey({name:qn},e,["deriveKey","deriveBits"])}static async _createWriteKeys(e=!1){return await tr.subtle.generateKey({name:Jn},e,["sign","verify"])}static async load(e={session:!1}){if(this._instance)return this._instance;let f=e.encryptionKeyName||Xe,c=e.writeKeyName||ke;return super.load({...e,encryptionKeyName:f,writeKeyName:c})}async toJson(e){let f=this.DID,c=await xn(this.exchangeKey);return{publicExchangeKey:e?xr(new Uint8Array(c),e):Nr(c),DID:f}}async encrypt(e,f,c,x,l){let S=new TextEncoder,Y=crypto.getRandomValues(new Uint8Array(zr)),er=f||this.exchangeKey.publicKey,br;typeof er=="string"?br=await et(er,"X25519","exchange"):br=er;let sr=x||await rt(this.exchangeKey.privateKey,br,Y,c||_r.INFO,l);sr instanceof CryptoKey||(sr=await rt(this.exchangeKey.privateKey,br,Y,c||_r.INFO));let vr=crypto.getRandomValues(new Uint8Array(kr)),Yr=typeof e=="string"?S.encode(e):e,te=await crypto.subtle.encrypt({name:Gr,iv:vr},sr,De(Yr)),$=new Uint8Array(Y),cr=new Uint8Array(vr),Ur=new Uint8Array(te),Er=$.length+cr.length+Ur.length,lr=new Uint8Array(Er);return lr.set($,0),lr.set(cr,$.length),lr.set(Ur,$.length+cr.length),lr}async encryptAsString(e,f,c,x,l){let S=await this.encrypt(e,f,c||_r.INFO,x,l);return xr(new Uint8Array(S),"base64pad")}async decrypt(e,f,c,x){let l=typeof f=="string"?await et(f,"X25519","write"):f;l||(l=this.publicExchangeKey);let S=Te(e,Or),Y=S.slice(0,zr),er=S.slice(zr,zr+kr),br=S.slice(zr+kr),{privateKey:sr}=this.exchangeKey,vr=await rt(sr,l,Y,x||_r.INFO);return await crypto.subtle.decrypt({name:c||Gr,iv:er},vr,br)}async decryptAsString(e,f,c,x){let l=await this.decrypt(e,f,c,x);return xr(new Uint8Array(l))}async getAesKey(e,f){e||(e=this.publicExchangeKey);let c;typeof e=="string"?c=await et(e,"X25519","exchange"):c=e;let x=crypto.getRandomValues(new Uint8Array(zr));return await rt(this.exchangeKey.privateKey,c,x,f||_r.INFO)}async sign(e,f){let c=new TextEncoder,x;typeof e=="string"?x=c.encode(e):e instanceof ArrayBuffer?x=new Uint8Array(e):x=e;let l=await tr.subtle.sign({name:Be},this.writeKey.privateKey,De(x));return new Uint8Array(l)}async signAsString(e,f){let c=await this.sign(e,f);return xr(c,"base64pad")}};y(_r,"EccKeys"),O(_r,"TYPE","ecc"),O(_r,"EXCHANGE_KEY_NAME",Xe),O(_r,"WRITE_KEY_NAME",ke),O(_r,"INFO","keys");var ee=_r;Object.assign(ee.prototype.sign,{asString:y(async function(n,e){let f=await this.sign(n,e);return xr(f,"base64pad")},"asString")});async function xn(n,e="raw"){return await crypto.subtle.exportKey(e,n.publicKey)}y(xn,"exportPublicKey");async function et(n,e,f){ff(f);let c=f==="exchange"?Zn:Be,x=f==="exchange"?[]:["verify"],l=Or(n),S=e==="X25519"?{name:c}:{name:c,namedCurve:e};return tr.subtle.importKey("raw",l,S,!0,x)}y(et,"importPublicKey");var Js={EccKeys:ee,importPublicKey:et};Object.assign(ee.prototype.encrypt,{asString:y(async function(n,e,f,c,x){return this.encryptAsString(n,e,f,c,x)},"asString")});Object.assign(ee.prototype.decrypt,{asString:y(async function(n,e,f){return this.decryptAsString(n,e,f)},"asString")});Object.assign(ee.prototype.sign,{asString:y(async function(n,e){return this.signAsString(n,e)},"asString")});async function qs(n,e,f){try{let c=tf(f);if(c.type!=="ed25519")throw new Error(`Expected Ed25519 key for ECC verification, got ${c.type}`);let x=c.publicKey.slice(-32),l=await tr.subtle.importKey("raw",x,{name:Be},!0,["verify"]),S=new TextEncoder,Y;typeof n=="string"?Y=S.encode(n):n instanceof ArrayBuffer?Y=new Uint8Array(n):Y=n;let er;return typeof e=="string"?er=new Uint8Array(Or(e)):er=e,await tr.subtle.verify({name:Be},l,De(er),De(Y))}catch{return!1}}y(qs,"verify");async function rt(n,e,f,c,x){let l=new TextEncoder,S=await crypto.subtle.deriveBits({name:"X25519",public:e},n,256),Y=await crypto.subtle.importKey("raw",S,"HKDF",!1,["deriveKey"]);return crypto.subtle.deriveKey({name:"HKDF",hash:"SHA-256",salt:f instanceof Uint8Array?De(f):f,info:l.encode(c)},Y,{name:"AES-GCM",length:x||Qr},!1,["encrypt","decrypt"])}y(rt,"deriveKey");export{ee as EccKeys,Js as default,xn as exportPublicKey,et as importPublicKey,qs as verify};
|
|
3
|
+
-----END PUBLIC KEY-----`,"")}y(Wi,"stripKeyHeader");function et(n){return an(n,"algorithm")&&an(n,"extractable")&&an(n,"type")}y(et,"isCryptoKey");function an(n,r){return typeof n=="object"&&n!=null&&r in n}y(an,"hasProp");function $i(n,r){return te.subtle.importKey("spki",n instanceof Uint8Array?he(n):n,{name:hr,hash:Wt},!1,r)}y($i,"importRsaKey");async function yn(n,r="rsa"){let f=n instanceof CryptoKey?new Uint8Array(await mr(n)):n;n instanceof CryptoKey&&(r=n.algorithm.name.includes("RSA")?"rsa":"ed25519");let c=sn.keyTypes[r]?.magicBytes;if(!c)throw new Error(`Key type '${r}' not supported, available types: ${Object.keys(sn.keyTypes).join(", ")}`);let x=bt([c,f]);return Qe+xe(x,"base58btc")}y(yn,"publicKeyToDid");async function mr(n){return n instanceof CryptoKey?await te.subtle.exportKey("spki",n):await te.subtle.exportKey("spki",n.publicKey)}y(mr,"getPublicKeyAsArrayBuffer");function sf(n){if(!n.startsWith(Qe))throw new Error("Please use a base58-encoded DID formatted `did:key:z...`");let r=n.substring(Qe.length),f=Te(r,"base58btc"),c=Object.entries(sn.keyTypes).find(([l,v])=>Dr(f.buffer,v.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(sf,"didToPublicKey");var rr={create(n={alg:Re,length:er}){let r=n.length||er,f=n.alg||Re;return te.subtle.generateKey({name:f,length:r},!0,["encrypt","decrypt"])},export:Object.assign(async n=>{let r=await te.subtle.exportKey("raw",n);return new Uint8Array(r)},{asString:y(async(n,r)=>{let f=await rr.export(n);return r?xe(f,r):De(f)},"asString")}),import(n){return xn(typeof n=="string"?Ne(n):n)},async exportAsString(n){let r=await rr.export(n);return De(r)},encrypt:Zi,async decrypt(n,r,f){let c=et(r)?r:await xn(r),x=f?await te.subtle.decrypt({name:gr,iv:he(f)},c,typeof n=="string"?he(Te(n)):n instanceof Uint8Array?he(n):n):await qi(n,c);return new Uint8Array(x)}};function xn(n,r){return te.subtle.importKey("raw",n instanceof Uint8Array?he(n):n,{name:gr,length:r||256},!0,["encrypt","decrypt"])}y(xn,"importAesKey");async function Zi(n,r,f,c){let x=et(r)?r:await xn(r),l=c?await te.subtle.encrypt({name:gr,iv:he(c)},x,he(n)):await Ji(n,x);return f&&f==="arraybuffer"?l:new Uint8Array(l)}y(Zi,"encrypt");async function Ji(n,r,f){let c=br(n,f?.charsize??lr),x=typeof r=="string"?await en(r,f):r,l=f?.iv||rf(je),v=await te.subtle.encrypt({name:gr,iv:l},x,c);return Jr(l,v)}y(Ji,"encryptBytes");async function qi(n,r,f){let c=Zr(n),x=typeof r=="string"?await en(r,f):r,l=c.slice(0,je),v=c.slice(je);return await te.subtle.decrypt({name:Re,iv:l},x,v)}y(qi,"decryptBytes");var $e=class $e{constructor(r){Y(this,"DID");Y(this,"exchangeKey");Y(this,"writeKey");Y(this,"hasPersisted");Y(this,"isSessionOnly");let{keys:f}=r;this.DID=r.did,this.exchangeKey=f.exchange,this.writeKey=f.write,this.hasPersisted=r.hasPersisted,this.isSessionOnly=!!r.isSessionOnly}publicExchangeKeyAsString(r){return this.publicExchangeKey.asString(r)}publicWriteKeyAsString(r){return this.publicWriteKey.asString(r)}get publicWriteKey(){let r=this.writeKey.publicKey;return Object.assign(r,{asString:y(async f=>{let c=await mr(this.writeKey),x=new Uint8Array(c);return f?xe(x,f):De(x)},"asString")})}get publicExchangeKey(){let r=this.exchangeKey.publicKey;return Object.assign(r,{asString:y(async f=>{let c=await mr(this.exchangeKey),x=new Uint8Array(c);return f?xe(x,f):De(x)},"asString")})}get privateWriteKey(){return this.writeKey.privateKey}get privateExchangeKey(){return this.exchangeKey.privateKey}get deviceName(){return $e.deviceName(this.DID)}static deviceName(r){return Qi(r)}async persist(){if(this.isSessionOnly)return;let r=this.constructor.EXCHANGE_KEY_NAME,f=this.constructor.WRITE_KEY_NAME;await Promise.all([fn(r,this.exchangeKey),fn(f,this.writeKey)]),this.hasPersisted=!0}async delete(){await nf([this.constructor.EXCHANGE_KEY_NAME,this.constructor.WRITE_KEY_NAME]),this.hasPersisted=!1}async getDeviceName(){return $e.deviceName(this.DID)}static _createExchangeKeys(r){throw new Error("The child should implement this")}static _createWriteKeys(r){throw new Error("The child should implement this")}static async create(r,f,c){let x=c?.exchangeKeys||await this._createExchangeKeys(f),l=c?.writeKeys||await this._createWriteKeys(f),v=await mr(l),M=await yn(new Uint8Array(v),this.TYPE==="ecc"?"ed25519":"rsa"),$=new this({keys:{exchange:x,write:l},did:M,hasPersisted:!1,isSessionOnly:!!r});return this._instance=$,$}static async load(r={session:!1}){if(this._instance)return this._instance;let f=!0,c=await nn(r.encryptionKeyName||this.EXCHANGE_KEY_NAME),x=await nn(r.writeKeyName||this.WRITE_KEY_NAME);c||(f=!1,c=await this._createExchangeKeys(r.extractable)),x||(f=!1,x=await this._createWriteKeys(r.extractable));let l=await mr(x),v=await yn(new Uint8Array(l),this.TYPE==="ecc"?"ed25519":"rsa"),M=new this({keys:{exchange:c,write:x},did:v,hasPersisted:f,isSessionOnly:!!r.session});return this._instance=M,M}};y($e,"AbstractKeys"),Y($e,"EXCHANGE_KEY_NAME"),Y($e,"WRITE_KEY_NAME"),Y($e,"_instance");var rt=$e;async function cf(n,r){let{content:f,publicKey:c}=n,x=r||await rr.create(),l=await rr.encrypt(typeof f=="string"?Te(f):f,typeof x=="string"?await rr.import(x):x),v=await un({key:x,publicKey:c});return Jr(v,l)}y(cf,"encryptTo");cf.asString=async function(n,r){let f=await cf(n,r);return xe(new Uint8Array(f),"base64pad")};async function un({key:n,publicKey:r},f){let c;n instanceof CryptoKey?c=await rr.export(n):c=n;let x=await cn.encrypt(c,r);return f&&f==="arraybuffer"?x:new Uint8Array(x)}y(un,"encryptKeyTo");un.asString=async function({key:n,publicKey:r},f){let c=await un({key:n,publicKey:r});return f?xe(c,f):De(c)};async function Qi(n){let r=await qn(new TextEncoder().encode(n.normalize("NFD")));return xe(r,"base32").slice(0,32)}y(Qi,"getDeviceName");function tr(n){return new Uint8Array(n).buffer}y(tr,"toArrayBuffer");var _e=class _e extends rt{static async create(r,f,c){return await super.create(r,f,c)}constructor(r){super(r),_e.EXCHANGE_KEY_NAME=r.exchangeKeyName||Wr,_e.WRITE_KEY_NAME=r.writeKeyName||$r}get publicExchangeKey(){let r=this.exchangeKey.publicKey;return Object.assign(r,{asString:y(async f=>{let c=await tt(this.exchangeKey),x=new Uint8Array(c);return f?xe(x,f):De(c)},"asString")})}get publicWriteKey(){let r=this.writeKey.publicKey;return Object.assign(r,{asString:y(async f=>{let c=await tt(this.writeKey),x=new Uint8Array(c);return f?xe(x,f):De(c)},"asString")})}static async _createExchangeKeys(r=!1){return await te.subtle.generateKey({name:Xt},r,["deriveKey","deriveBits"])}static async _createWriteKeys(r=!1){return await te.subtle.generateKey({name:pr},r,["sign","verify"])}static async load(r={session:!1}){if(this._instance)return this._instance;let f=r.encryptionKeyName||Wr,c=r.writeKeyName||$r;return super.load({...r,encryptionKeyName:f,writeKeyName:c})}async toJson(r){let f=this.DID,c=await tt(this.exchangeKey);return{publicExchangeKey:r?xe(new Uint8Array(c),r):De(c),DID:f}}async wrap(r,f,c){let x=await _e._createExchangeKeys(!0),l=crypto.getRandomValues(new Uint8Array(Se)),v=await Ar(x.privateKey,f,l,c||"key-wrap"),M;if(r instanceof CryptoKey){let Ae=await crypto.subtle.exportKey("raw",r);M=new Uint8Array(Ae)}else typeof r=="string"?M=new Uint8Array(Ne(r)):M=r;let $=crypto.getRandomValues(new Uint8Array(je)),ue=await crypto.subtle.encrypt({name:Re,iv:$},v,tr(M)),ie=await tt(x),pe=new Uint8Array(l),Be=new Uint8Array($),Fe=new Uint8Array(ue),W=pe.length+Be.length+Fe.length,fe=new Uint8Array(W);return fe.set(pe,0),fe.set(Be,pe.length),fe.set(Fe,pe.length+Be.length),{enc:De(new Uint8Array(ie)),wrappedKey:De(fe)}}async unwrap(r,f,c){let x=await Mr(r,"X25519","exchange"),l=new Uint8Array(Ne(f)),v=l.slice(0,Se),M=l.slice(Se,Se+je),$=l.slice(Se+je),ue=await Ar(this.exchangeKey.privateKey,x,v,c||"key-wrap"),ie=await crypto.subtle.decrypt({name:Re,iv:M},ue,tr($));return await crypto.subtle.importKey("raw",ie,{name:Re},!0,["encrypt","decrypt"])}async encrypt(r,f,c,x,l){let v=new TextEncoder,M=crypto.getRandomValues(new Uint8Array(Se)),$=f||this.exchangeKey.publicKey,ue;typeof $=="string"?ue=await Mr($,"X25519","exchange"):ue=$;let ie=x||await Ar(this.exchangeKey.privateKey,ue,M,c||_e.INFO,l);ie instanceof CryptoKey||(ie=await Ar(this.exchangeKey.privateKey,ue,M,c||_e.INFO));let pe=crypto.getRandomValues(new Uint8Array(je)),Be=typeof r=="string"?v.encode(r):r,Fe=await crypto.subtle.encrypt({name:Re,iv:pe},ie,tr(Be)),W=new Uint8Array(M),fe=new Uint8Array(pe),Ae=new Uint8Array(Fe),Ue=W.length+fe.length+Ae.length,be=new Uint8Array(Ue);return be.set(W,0),be.set(fe,W.length),be.set(Ae,W.length+fe.length),be}async encryptAsString(r,f,c,x,l){let v=await this.encrypt(r,f,c||_e.INFO,x,l);return xe(new Uint8Array(v),"base64pad")}async decrypt(r,f,c,x){let l=typeof f=="string"?await Mr(f,"X25519","write"):f;l||(l=this.publicExchangeKey);let v=Ir(r,Ne),M=v.slice(0,Se),$=v.slice(Se,Se+je),ue=v.slice(Se+je),{privateKey:ie}=this.exchangeKey,pe=await Ar(ie,l,M,x||_e.INFO);return await crypto.subtle.decrypt({name:c||Re,iv:$},pe,ue)}async decryptAsString(r,f,c,x){let l=await this.decrypt(r,f,c,x);return xe(new Uint8Array(l))}async getAesKey(r,f){r||(r=this.publicExchangeKey);let c;typeof r=="string"?c=await Mr(r,"X25519","exchange"):c=r;let x=crypto.getRandomValues(new Uint8Array(Se));return await Ar(this.exchangeKey.privateKey,c,x,f||_e.INFO)}async sign(r,f){let c=new TextEncoder,x;typeof r=="string"?x=c.encode(r):r instanceof ArrayBuffer?x=new Uint8Array(r):x=r;let l=await te.subtle.sign({name:pr},this.writeKey.privateKey,tr(x));return new Uint8Array(l)}async signAsString(r,f){let c=await this.sign(r,f);return xe(c,"base64pad")}};y(_e,"EccKeys"),Y(_e,"TYPE","ecc"),Y(_e,"EXCHANGE_KEY_NAME",Wr),Y(_e,"WRITE_KEY_NAME",$r),Y(_e,"INFO","keys");var nr=_e;Object.assign(nr.prototype.sign,{asString:y(async function(n,r){let f=await this.sign(n,r);return xe(f,"base64pad")},"asString")});async function tt(n,r="raw"){return await crypto.subtle.exportKey(r,n.publicKey)}y(tt,"exportPublicKey");async function Mr(n,r,f){tf(f);let c=f==="exchange"?Xt:pr,x=f==="exchange"?[]:["verify"],l=Ne(n),v=r==="X25519"?{name:c}:{name:c,namedCurve:r};return te.subtle.importKey("raw",l,v,!0,x)}y(Mr,"importPublicKey");var $s={EccKeys:nr,importPublicKey:Mr};Object.assign(nr.prototype.encrypt,{asString:y(async function(n,r,f,c,x){return this.encryptAsString(n,r,f,c,x)},"asString")});Object.assign(nr.prototype.decrypt,{asString:y(async function(n,r,f){return this.decryptAsString(n,r,f)},"asString")});Object.assign(nr.prototype.sign,{asString:y(async function(n,r){return this.signAsString(n,r)},"asString")});async function Zs(n,r,f){try{let c=ef(f);if(c.type!=="ed25519")throw new Error(`Expected Ed25519 key for ECC verification, got ${c.type}`);let x=c.publicKey.slice(-32),l=await te.subtle.importKey("raw",x,{name:pr},!0,["verify"]),v=new TextEncoder,M;typeof n=="string"?M=v.encode(n):n instanceof ArrayBuffer?M=new Uint8Array(n):M=n;let $;return typeof r=="string"?$=new Uint8Array(Ne(r)):$=r,await te.subtle.verify({name:pr},l,tr($),tr(M))}catch{return!1}}y(Zs,"verify");async function Ar(n,r,f,c,x){let l=new TextEncoder,v=await crypto.subtle.deriveBits({name:"X25519",public:r},n,256),M=await crypto.subtle.importKey("raw",v,"HKDF",!1,["deriveKey"]);return crypto.subtle.deriveKey({name:"HKDF",hash:"SHA-256",salt:f instanceof Uint8Array?tr(f):f,info:l.encode(c)},M,{name:"AES-GCM",length:x||er},!1,["encrypt","decrypt"])}y(Ar,"deriveKey");export{nr as EccKeys,$s as default,tt as exportPublicKey,Mr as importPublicKey,Zs as verify};
|
|
4
4
|
//# sourceMappingURL=index.min.js.map
|