@junobuild/core 0.0.6 → 0.0.8

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.
Files changed (41) hide show
  1. package/dist/browser/canisterStatus-CMO3J52U.js +2 -0
  2. package/dist/browser/chunk-A53P2AD6.js +35 -0
  3. package/dist/browser/chunk-A53P2AD6.js.map +7 -0
  4. package/dist/browser/index.js +33 -0
  5. package/dist/browser/index.js.map +7 -0
  6. package/dist/declarations/cmc/cmc.did.d.ts +2 -2
  7. package/dist/declarations/console/console.did.d.ts +1 -1
  8. package/dist/declarations/frontend/frontend.did +42 -1
  9. package/dist/declarations/frontend/frontend.did.d.ts +58 -14
  10. package/dist/declarations/frontend/frontend.factory.did.js +45 -2
  11. package/dist/declarations/internet_identity/internet_identity.did.d.ts +9 -9
  12. package/dist/declarations/ledger/ledger.did.d.ts +4 -4
  13. package/dist/declarations/satellite/satellite.did.d.ts +19 -17
  14. package/dist/declarations/satellite/satellite.factory.did.js +9 -4
  15. package/dist/declarations/satellite/satellite.factory.did.mjs +9 -4
  16. package/dist/node/index.mjs +73 -0
  17. package/dist/node/index.mjs.map +7 -0
  18. package/dist/types/constants/auth.constants.d.ts +1 -0
  19. package/dist/types/index.d.ts +7 -4
  20. package/dist/types/services/auth-timout.services.d.ts +3 -0
  21. package/dist/types/stores/auth.store.d.ts +2 -1
  22. package/dist/types/types/env.types.d.ts +6 -0
  23. package/dist/types/types/list.types.d.ts +6 -4
  24. package/dist/types/types/post-message.d.ts +5 -0
  25. package/dist/types/types/subscription.types.d.ts +1 -0
  26. package/dist/types/utils/auth.utils.d.ts +2 -0
  27. package/dist/types/utils/did.utils.d.ts +1 -1
  28. package/dist/types/utils/events.utils.d.ts +4 -0
  29. package/dist/types/utils/list.utils.d.ts +2 -8
  30. package/dist/types/workers/auth.worker.d.ts +6 -0
  31. package/dist/workers/auth.worker.js +32 -0
  32. package/dist/workers/auth.worker.js.map +7 -0
  33. package/package.json +8 -7
  34. package/dist/cjs/index.cjs.js +0 -71
  35. package/dist/cjs/index.cjs.js.map +0 -7
  36. package/dist/esm/canisterStatus-UMNLFNN3.js +0 -2
  37. package/dist/esm/chunk-QVUY65GN.js +0 -63
  38. package/dist/esm/chunk-QVUY65GN.js.map +0 -7
  39. package/dist/esm/index.js +0 -3
  40. package/dist/esm/index.js.map +0 -7
  41. /package/dist/{esm/canisterStatus-UMNLFNN3.js.map → browser/canisterStatus-CMO3J52U.js.map} +0 -0
package/dist/esm/index.js DELETED
@@ -1,3 +0,0 @@
1
- import{a as Rr,b as Un,c as Br,d as Rn,e as Oe,f as Bn,g as Ne,h as Pe,i as Kn,j as rr,k as Vt,l as nr,m as Cn,p as Kr,q as Cr}from"./chunk-QVUY65GN.js";var Mr={};Rn(Mr,{default:()=>Mn});var Mn,Yr=Un(()=>{Mn={}});var jr=Br((di,Ue)=>{var kt=(Yr(),Bn(Mr));if(kt&&kt.default){Ue.exports=kt.default;for(let e in kt)Ue.exports[e]=kt[e]}else kt&&(Ue.exports=kt)});var ir=Br((ui,Re)=>{(function(e){"use strict";var n=function(r){var o,i=new Float64Array(16);if(r)for(o=0;o<r.length;o++)i[o]=r[o];return i},a=function(){throw new Error("no PRNG")},u=new Uint8Array(16),h=new Uint8Array(32);h[0]=9;var b=n(),v=n([1]),B=n([56129,1]),C=n([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),P=n([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),tt=n([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),rt=n([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),ht=n([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function St(r,o,i,t){r[o]=i>>24&255,r[o+1]=i>>16&255,r[o+2]=i>>8&255,r[o+3]=i&255,r[o+4]=t>>24&255,r[o+5]=t>>16&255,r[o+6]=t>>8&255,r[o+7]=t&255}function st(r,o,i,t,f){var c,l=0;for(c=0;c<f;c++)l|=r[o+c]^i[t+c];return(1&l-1>>>8)-1}function Tt(r,o,i,t){return st(r,o,i,t,16)}function Kt(r,o,i,t){return st(r,o,i,t,32)}function He(r,o,i,t){for(var f=t[0]&255|(t[1]&255)<<8|(t[2]&255)<<16|(t[3]&255)<<24,c=i[0]&255|(i[1]&255)<<8|(i[2]&255)<<16|(i[3]&255)<<24,l=i[4]&255|(i[5]&255)<<8|(i[6]&255)<<16|(i[7]&255)<<24,y=i[8]&255|(i[9]&255)<<8|(i[10]&255)<<16|(i[11]&255)<<24,_=i[12]&255|(i[13]&255)<<8|(i[14]&255)<<16|(i[15]&255)<<24,R=t[4]&255|(t[5]&255)<<8|(t[6]&255)<<16|(t[7]&255)<<24,A=o[0]&255|(o[1]&255)<<8|(o[2]&255)<<16|(o[3]&255)<<24,D=o[4]&255|(o[5]&255)<<8|(o[6]&255)<<16|(o[7]&255)<<24,T=o[8]&255|(o[9]&255)<<8|(o[10]&255)<<16|(o[11]&255)<<24,Y=o[12]&255|(o[13]&255)<<8|(o[14]&255)<<16|(o[15]&255)<<24,j=t[8]&255|(t[9]&255)<<8|(t[10]&255)<<16|(t[11]&255)<<24,z=i[16]&255|(i[17]&255)<<8|(i[18]&255)<<16|(i[19]&255)<<24,H=i[20]&255|(i[21]&255)<<8|(i[22]&255)<<16|(i[23]&255)<<24,V=i[24]&255|(i[25]&255)<<8|(i[26]&255)<<16|(i[27]&255)<<24,F=i[28]&255|(i[29]&255)<<8|(i[30]&255)<<16|(i[31]&255)<<24,k=t[12]&255|(t[13]&255)<<8|(t[14]&255)<<16|(t[15]&255)<<24,O=f,K=c,S=l,N=y,U=_,E=R,x=A,d=D,m=T,p=Y,g=j,w=z,M=H,W=V,$=F,J=k,s,q=0;q<20;q+=2)s=O+M|0,U^=s<<7|s>>>32-7,s=U+O|0,m^=s<<9|s>>>32-9,s=m+U|0,M^=s<<13|s>>>32-13,s=M+m|0,O^=s<<18|s>>>32-18,s=E+K|0,p^=s<<7|s>>>32-7,s=p+E|0,W^=s<<9|s>>>32-9,s=W+p|0,K^=s<<13|s>>>32-13,s=K+W|0,E^=s<<18|s>>>32-18,s=g+x|0,$^=s<<7|s>>>32-7,s=$+g|0,S^=s<<9|s>>>32-9,s=S+$|0,x^=s<<13|s>>>32-13,s=x+S|0,g^=s<<18|s>>>32-18,s=J+w|0,N^=s<<7|s>>>32-7,s=N+J|0,d^=s<<9|s>>>32-9,s=d+N|0,w^=s<<13|s>>>32-13,s=w+d|0,J^=s<<18|s>>>32-18,s=O+N|0,K^=s<<7|s>>>32-7,s=K+O|0,S^=s<<9|s>>>32-9,s=S+K|0,N^=s<<13|s>>>32-13,s=N+S|0,O^=s<<18|s>>>32-18,s=E+U|0,x^=s<<7|s>>>32-7,s=x+E|0,d^=s<<9|s>>>32-9,s=d+x|0,U^=s<<13|s>>>32-13,s=U+d|0,E^=s<<18|s>>>32-18,s=g+p|0,w^=s<<7|s>>>32-7,s=w+g|0,m^=s<<9|s>>>32-9,s=m+w|0,p^=s<<13|s>>>32-13,s=p+m|0,g^=s<<18|s>>>32-18,s=J+$|0,M^=s<<7|s>>>32-7,s=M+J|0,W^=s<<9|s>>>32-9,s=W+M|0,$^=s<<13|s>>>32-13,s=$+W|0,J^=s<<18|s>>>32-18;O=O+f|0,K=K+c|0,S=S+l|0,N=N+y|0,U=U+_|0,E=E+R|0,x=x+A|0,d=d+D|0,m=m+T|0,p=p+Y|0,g=g+j|0,w=w+z|0,M=M+H|0,W=W+V|0,$=$+F|0,J=J+k|0,r[0]=O>>>0&255,r[1]=O>>>8&255,r[2]=O>>>16&255,r[3]=O>>>24&255,r[4]=K>>>0&255,r[5]=K>>>8&255,r[6]=K>>>16&255,r[7]=K>>>24&255,r[8]=S>>>0&255,r[9]=S>>>8&255,r[10]=S>>>16&255,r[11]=S>>>24&255,r[12]=N>>>0&255,r[13]=N>>>8&255,r[14]=N>>>16&255,r[15]=N>>>24&255,r[16]=U>>>0&255,r[17]=U>>>8&255,r[18]=U>>>16&255,r[19]=U>>>24&255,r[20]=E>>>0&255,r[21]=E>>>8&255,r[22]=E>>>16&255,r[23]=E>>>24&255,r[24]=x>>>0&255,r[25]=x>>>8&255,r[26]=x>>>16&255,r[27]=x>>>24&255,r[28]=d>>>0&255,r[29]=d>>>8&255,r[30]=d>>>16&255,r[31]=d>>>24&255,r[32]=m>>>0&255,r[33]=m>>>8&255,r[34]=m>>>16&255,r[35]=m>>>24&255,r[36]=p>>>0&255,r[37]=p>>>8&255,r[38]=p>>>16&255,r[39]=p>>>24&255,r[40]=g>>>0&255,r[41]=g>>>8&255,r[42]=g>>>16&255,r[43]=g>>>24&255,r[44]=w>>>0&255,r[45]=w>>>8&255,r[46]=w>>>16&255,r[47]=w>>>24&255,r[48]=M>>>0&255,r[49]=M>>>8&255,r[50]=M>>>16&255,r[51]=M>>>24&255,r[52]=W>>>0&255,r[53]=W>>>8&255,r[54]=W>>>16&255,r[55]=W>>>24&255,r[56]=$>>>0&255,r[57]=$>>>8&255,r[58]=$>>>16&255,r[59]=$>>>24&255,r[60]=J>>>0&255,r[61]=J>>>8&255,r[62]=J>>>16&255,r[63]=J>>>24&255}function ze(r,o,i,t){for(var f=t[0]&255|(t[1]&255)<<8|(t[2]&255)<<16|(t[3]&255)<<24,c=i[0]&255|(i[1]&255)<<8|(i[2]&255)<<16|(i[3]&255)<<24,l=i[4]&255|(i[5]&255)<<8|(i[6]&255)<<16|(i[7]&255)<<24,y=i[8]&255|(i[9]&255)<<8|(i[10]&255)<<16|(i[11]&255)<<24,_=i[12]&255|(i[13]&255)<<8|(i[14]&255)<<16|(i[15]&255)<<24,R=t[4]&255|(t[5]&255)<<8|(t[6]&255)<<16|(t[7]&255)<<24,A=o[0]&255|(o[1]&255)<<8|(o[2]&255)<<16|(o[3]&255)<<24,D=o[4]&255|(o[5]&255)<<8|(o[6]&255)<<16|(o[7]&255)<<24,T=o[8]&255|(o[9]&255)<<8|(o[10]&255)<<16|(o[11]&255)<<24,Y=o[12]&255|(o[13]&255)<<8|(o[14]&255)<<16|(o[15]&255)<<24,j=t[8]&255|(t[9]&255)<<8|(t[10]&255)<<16|(t[11]&255)<<24,z=i[16]&255|(i[17]&255)<<8|(i[18]&255)<<16|(i[19]&255)<<24,H=i[20]&255|(i[21]&255)<<8|(i[22]&255)<<16|(i[23]&255)<<24,V=i[24]&255|(i[25]&255)<<8|(i[26]&255)<<16|(i[27]&255)<<24,F=i[28]&255|(i[29]&255)<<8|(i[30]&255)<<16|(i[31]&255)<<24,k=t[12]&255|(t[13]&255)<<8|(t[14]&255)<<16|(t[15]&255)<<24,O=f,K=c,S=l,N=y,U=_,E=R,x=A,d=D,m=T,p=Y,g=j,w=z,M=H,W=V,$=F,J=k,s,q=0;q<20;q+=2)s=O+M|0,U^=s<<7|s>>>32-7,s=U+O|0,m^=s<<9|s>>>32-9,s=m+U|0,M^=s<<13|s>>>32-13,s=M+m|0,O^=s<<18|s>>>32-18,s=E+K|0,p^=s<<7|s>>>32-7,s=p+E|0,W^=s<<9|s>>>32-9,s=W+p|0,K^=s<<13|s>>>32-13,s=K+W|0,E^=s<<18|s>>>32-18,s=g+x|0,$^=s<<7|s>>>32-7,s=$+g|0,S^=s<<9|s>>>32-9,s=S+$|0,x^=s<<13|s>>>32-13,s=x+S|0,g^=s<<18|s>>>32-18,s=J+w|0,N^=s<<7|s>>>32-7,s=N+J|0,d^=s<<9|s>>>32-9,s=d+N|0,w^=s<<13|s>>>32-13,s=w+d|0,J^=s<<18|s>>>32-18,s=O+N|0,K^=s<<7|s>>>32-7,s=K+O|0,S^=s<<9|s>>>32-9,s=S+K|0,N^=s<<13|s>>>32-13,s=N+S|0,O^=s<<18|s>>>32-18,s=E+U|0,x^=s<<7|s>>>32-7,s=x+E|0,d^=s<<9|s>>>32-9,s=d+x|0,U^=s<<13|s>>>32-13,s=U+d|0,E^=s<<18|s>>>32-18,s=g+p|0,w^=s<<7|s>>>32-7,s=w+g|0,m^=s<<9|s>>>32-9,s=m+w|0,p^=s<<13|s>>>32-13,s=p+m|0,g^=s<<18|s>>>32-18,s=J+$|0,M^=s<<7|s>>>32-7,s=M+J|0,W^=s<<9|s>>>32-9,s=W+M|0,$^=s<<13|s>>>32-13,s=$+W|0,J^=s<<18|s>>>32-18;r[0]=O>>>0&255,r[1]=O>>>8&255,r[2]=O>>>16&255,r[3]=O>>>24&255,r[4]=E>>>0&255,r[5]=E>>>8&255,r[6]=E>>>16&255,r[7]=E>>>24&255,r[8]=g>>>0&255,r[9]=g>>>8&255,r[10]=g>>>16&255,r[11]=g>>>24&255,r[12]=J>>>0&255,r[13]=J>>>8&255,r[14]=J>>>16&255,r[15]=J>>>24&255,r[16]=x>>>0&255,r[17]=x>>>8&255,r[18]=x>>>16&255,r[19]=x>>>24&255,r[20]=d>>>0&255,r[21]=d>>>8&255,r[22]=d>>>16&255,r[23]=d>>>24&255,r[24]=m>>>0&255,r[25]=m>>>8&255,r[26]=m>>>16&255,r[27]=m>>>24&255,r[28]=p>>>0&255,r[29]=p>>>8&255,r[30]=p>>>16&255,r[31]=p>>>24&255}function Wt(r,o,i,t){He(r,o,i,t)}function Jt(r,o,i,t){ze(r,o,i,t)}var Ot=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function ge(r,o,i,t,f,c,l){var y=new Uint8Array(16),_=new Uint8Array(64),R,A;for(A=0;A<16;A++)y[A]=0;for(A=0;A<8;A++)y[A]=c[A];for(;f>=64;){for(Wt(_,y,l,Ot),A=0;A<64;A++)r[o+A]=i[t+A]^_[A];for(R=1,A=8;A<16;A++)R=R+(y[A]&255)|0,y[A]=R&255,R>>>=8;f-=64,o+=64,t+=64}if(f>0)for(Wt(_,y,l,Ot),A=0;A<f;A++)r[o+A]=i[t+A]^_[A];return 0}function ne(r,o,i,t,f){var c=new Uint8Array(16),l=new Uint8Array(64),y,_;for(_=0;_<16;_++)c[_]=0;for(_=0;_<8;_++)c[_]=t[_];for(;i>=64;){for(Wt(l,c,f,Ot),_=0;_<64;_++)r[o+_]=l[_];for(y=1,_=8;_<16;_++)y=y+(c[_]&255)|0,c[_]=y&255,y>>>=8;i-=64,o+=64}if(i>0)for(Wt(l,c,f,Ot),_=0;_<i;_++)r[o+_]=l[_];return 0}function Mt(r,o,i,t,f){var c=new Uint8Array(32);Jt(c,t,f,Ot);for(var l=new Uint8Array(8),y=0;y<8;y++)l[y]=t[y+16];return ne(r,o,i,l,c)}function ie(r,o,i,t,f,c,l){var y=new Uint8Array(32);Jt(y,c,l,Ot);for(var _=new Uint8Array(8),R=0;R<8;R++)_[R]=c[R+16];return ge(r,o,i,t,f,_,y)}var $t=function(r){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,t,f,c,l,y,_;o=r[0]&255|(r[1]&255)<<8,this.r[0]=o&8191,i=r[2]&255|(r[3]&255)<<8,this.r[1]=(o>>>13|i<<3)&8191,t=r[4]&255|(r[5]&255)<<8,this.r[2]=(i>>>10|t<<6)&7939,f=r[6]&255|(r[7]&255)<<8,this.r[3]=(t>>>7|f<<9)&8191,c=r[8]&255|(r[9]&255)<<8,this.r[4]=(f>>>4|c<<12)&255,this.r[5]=c>>>1&8190,l=r[10]&255|(r[11]&255)<<8,this.r[6]=(c>>>14|l<<2)&8191,y=r[12]&255|(r[13]&255)<<8,this.r[7]=(l>>>11|y<<5)&8065,_=r[14]&255|(r[15]&255)<<8,this.r[8]=(y>>>8|_<<8)&8191,this.r[9]=_>>>5&127,this.pad[0]=r[16]&255|(r[17]&255)<<8,this.pad[1]=r[18]&255|(r[19]&255)<<8,this.pad[2]=r[20]&255|(r[21]&255)<<8,this.pad[3]=r[22]&255|(r[23]&255)<<8,this.pad[4]=r[24]&255|(r[25]&255)<<8,this.pad[5]=r[26]&255|(r[27]&255)<<8,this.pad[6]=r[28]&255|(r[29]&255)<<8,this.pad[7]=r[30]&255|(r[31]&255)<<8};$t.prototype.blocks=function(r,o,i){for(var t=this.fin?0:2048,f,c,l,y,_,R,A,D,T,Y,j,z,H,V,F,k,O,K,S,N=this.h[0],U=this.h[1],E=this.h[2],x=this.h[3],d=this.h[4],m=this.h[5],p=this.h[6],g=this.h[7],w=this.h[8],M=this.h[9],W=this.r[0],$=this.r[1],J=this.r[2],s=this.r[3],q=this.r[4],I=this.r[5],L=this.r[6],G=this.r[7],X=this.r[8],Q=this.r[9];i>=16;)f=r[o+0]&255|(r[o+1]&255)<<8,N+=f&8191,c=r[o+2]&255|(r[o+3]&255)<<8,U+=(f>>>13|c<<3)&8191,l=r[o+4]&255|(r[o+5]&255)<<8,E+=(c>>>10|l<<6)&8191,y=r[o+6]&255|(r[o+7]&255)<<8,x+=(l>>>7|y<<9)&8191,_=r[o+8]&255|(r[o+9]&255)<<8,d+=(y>>>4|_<<12)&8191,m+=_>>>1&8191,R=r[o+10]&255|(r[o+11]&255)<<8,p+=(_>>>14|R<<2)&8191,A=r[o+12]&255|(r[o+13]&255)<<8,g+=(R>>>11|A<<5)&8191,D=r[o+14]&255|(r[o+15]&255)<<8,w+=(A>>>8|D<<8)&8191,M+=D>>>5|t,T=0,Y=T,Y+=N*W,Y+=U*(5*Q),Y+=E*(5*X),Y+=x*(5*G),Y+=d*(5*L),T=Y>>>13,Y&=8191,Y+=m*(5*I),Y+=p*(5*q),Y+=g*(5*s),Y+=w*(5*J),Y+=M*(5*$),T+=Y>>>13,Y&=8191,j=T,j+=N*$,j+=U*W,j+=E*(5*Q),j+=x*(5*X),j+=d*(5*G),T=j>>>13,j&=8191,j+=m*(5*L),j+=p*(5*I),j+=g*(5*q),j+=w*(5*s),j+=M*(5*J),T+=j>>>13,j&=8191,z=T,z+=N*J,z+=U*$,z+=E*W,z+=x*(5*Q),z+=d*(5*X),T=z>>>13,z&=8191,z+=m*(5*G),z+=p*(5*L),z+=g*(5*I),z+=w*(5*q),z+=M*(5*s),T+=z>>>13,z&=8191,H=T,H+=N*s,H+=U*J,H+=E*$,H+=x*W,H+=d*(5*Q),T=H>>>13,H&=8191,H+=m*(5*X),H+=p*(5*G),H+=g*(5*L),H+=w*(5*I),H+=M*(5*q),T+=H>>>13,H&=8191,V=T,V+=N*q,V+=U*s,V+=E*J,V+=x*$,V+=d*W,T=V>>>13,V&=8191,V+=m*(5*Q),V+=p*(5*X),V+=g*(5*G),V+=w*(5*L),V+=M*(5*I),T+=V>>>13,V&=8191,F=T,F+=N*I,F+=U*q,F+=E*s,F+=x*J,F+=d*$,T=F>>>13,F&=8191,F+=m*W,F+=p*(5*Q),F+=g*(5*X),F+=w*(5*G),F+=M*(5*L),T+=F>>>13,F&=8191,k=T,k+=N*L,k+=U*I,k+=E*q,k+=x*s,k+=d*J,T=k>>>13,k&=8191,k+=m*$,k+=p*W,k+=g*(5*Q),k+=w*(5*X),k+=M*(5*G),T+=k>>>13,k&=8191,O=T,O+=N*G,O+=U*L,O+=E*I,O+=x*q,O+=d*s,T=O>>>13,O&=8191,O+=m*J,O+=p*$,O+=g*W,O+=w*(5*Q),O+=M*(5*X),T+=O>>>13,O&=8191,K=T,K+=N*X,K+=U*G,K+=E*L,K+=x*I,K+=d*q,T=K>>>13,K&=8191,K+=m*s,K+=p*J,K+=g*$,K+=w*W,K+=M*(5*Q),T+=K>>>13,K&=8191,S=T,S+=N*Q,S+=U*X,S+=E*G,S+=x*L,S+=d*I,T=S>>>13,S&=8191,S+=m*q,S+=p*s,S+=g*J,S+=w*$,S+=M*W,T+=S>>>13,S&=8191,T=(T<<2)+T|0,T=T+Y|0,Y=T&8191,T=T>>>13,j+=T,N=Y,U=j,E=z,x=H,d=V,m=F,p=k,g=O,w=K,M=S,o+=16,i-=16;this.h[0]=N,this.h[1]=U,this.h[2]=E,this.h[3]=x,this.h[4]=d,this.h[5]=m,this.h[6]=p,this.h[7]=g,this.h[8]=w,this.h[9]=M},$t.prototype.finish=function(r,o){var i=new Uint16Array(10),t,f,c,l;if(this.leftover){for(l=this.leftover,this.buffer[l++]=1;l<16;l++)this.buffer[l]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(t=this.h[1]>>>13,this.h[1]&=8191,l=2;l<10;l++)this.h[l]+=t,t=this.h[l]>>>13,this.h[l]&=8191;for(this.h[0]+=t*5,t=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=t,t=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=t,i[0]=this.h[0]+5,t=i[0]>>>13,i[0]&=8191,l=1;l<10;l++)i[l]=this.h[l]+t,t=i[l]>>>13,i[l]&=8191;for(i[9]-=1<<13,f=(t^1)-1,l=0;l<10;l++)i[l]&=f;for(f=~f,l=0;l<10;l++)this.h[l]=this.h[l]&f|i[l];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,c=this.h[0]+this.pad[0],this.h[0]=c&65535,l=1;l<8;l++)c=(this.h[l]+this.pad[l]|0)+(c>>>16)|0,this.h[l]=c&65535;r[o+0]=this.h[0]>>>0&255,r[o+1]=this.h[0]>>>8&255,r[o+2]=this.h[1]>>>0&255,r[o+3]=this.h[1]>>>8&255,r[o+4]=this.h[2]>>>0&255,r[o+5]=this.h[2]>>>8&255,r[o+6]=this.h[3]>>>0&255,r[o+7]=this.h[3]>>>8&255,r[o+8]=this.h[4]>>>0&255,r[o+9]=this.h[4]>>>8&255,r[o+10]=this.h[5]>>>0&255,r[o+11]=this.h[5]>>>8&255,r[o+12]=this.h[6]>>>0&255,r[o+13]=this.h[6]>>>8&255,r[o+14]=this.h[7]>>>0&255,r[o+15]=this.h[7]>>>8&255},$t.prototype.update=function(r,o,i){var t,f;if(this.leftover){for(f=16-this.leftover,f>i&&(f=i),t=0;t<f;t++)this.buffer[this.leftover+t]=r[o+t];if(i-=f,o+=f,this.leftover+=f,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(i>=16&&(f=i-i%16,this.blocks(r,o,f),o+=f,i-=f),i){for(t=0;t<i;t++)this.buffer[this.leftover+t]=r[o+t];this.leftover+=i}};function oe(r,o,i,t,f,c){var l=new $t(c);return l.update(i,t,f),l.finish(r,o),0}function be(r,o,i,t,f,c){var l=new Uint8Array(16);return oe(l,0,i,t,f,c),Tt(r,o,l,0)}function fe(r,o,i,t,f){var c;if(i<32)return-1;for(ie(r,0,o,0,i,t,f),oe(r,16,r,32,i-32,r),c=0;c<16;c++)r[c]=0;return 0}function We(r,o,i,t,f){var c,l=new Uint8Array(32);if(i<32||(Mt(l,0,32,t,f),be(o,16,o,32,i-32,l)!==0))return-1;for(ie(r,0,o,0,i,t,f),c=0;c<32;c++)r[c]=0;return 0}function Nt(r,o){var i;for(i=0;i<16;i++)r[i]=o[i]|0}function Je(r){var o,i,t=1;for(o=0;o<16;o++)i=r[o]+t+65535,t=Math.floor(i/65536),r[o]=i-t*65536;r[0]+=t-1+37*(t-1)}function Gt(r,o,i){for(var t,f=~(i-1),c=0;c<16;c++)t=f&(r[c]^o[c]),r[c]^=t,o[c]^=t}function qt(r,o){var i,t,f,c=n(),l=n();for(i=0;i<16;i++)l[i]=o[i];for(Je(l),Je(l),Je(l),t=0;t<2;t++){for(c[0]=l[0]-65517,i=1;i<15;i++)c[i]=l[i]-65535-(c[i-1]>>16&1),c[i-1]&=65535;c[15]=l[15]-32767-(c[14]>>16&1),f=c[15]>>16&1,c[14]&=65535,Gt(l,c,1-f)}for(i=0;i<16;i++)r[2*i]=l[i]&255,r[2*i+1]=l[i]>>8}function br(r,o){var i=new Uint8Array(32),t=new Uint8Array(32);return qt(i,r),qt(t,o),Kt(i,0,t,0)}function mr(r){var o=new Uint8Array(32);return qt(o,r),o[0]&1}function $e(r,o){var i;for(i=0;i<16;i++)r[i]=o[2*i]+(o[2*i+1]<<8);r[15]&=32767}function bt(r,o,i){for(var t=0;t<16;t++)r[t]=o[t]+i[t]}function mt(r,o,i){for(var t=0;t<16;t++)r[t]=o[t]-i[t]}function Z(r,o,i){var t,f,c=0,l=0,y=0,_=0,R=0,A=0,D=0,T=0,Y=0,j=0,z=0,H=0,V=0,F=0,k=0,O=0,K=0,S=0,N=0,U=0,E=0,x=0,d=0,m=0,p=0,g=0,w=0,M=0,W=0,$=0,J=0,s=i[0],q=i[1],I=i[2],L=i[3],G=i[4],X=i[5],Q=i[6],ft=i[7],et=i[8],nt=i[9],it=i[10],ot=i[11],at=i[12],ct=i[13],lt=i[14],xt=i[15];t=o[0],c+=t*s,l+=t*q,y+=t*I,_+=t*L,R+=t*G,A+=t*X,D+=t*Q,T+=t*ft,Y+=t*et,j+=t*nt,z+=t*it,H+=t*ot,V+=t*at,F+=t*ct,k+=t*lt,O+=t*xt,t=o[1],l+=t*s,y+=t*q,_+=t*I,R+=t*L,A+=t*G,D+=t*X,T+=t*Q,Y+=t*ft,j+=t*et,z+=t*nt,H+=t*it,V+=t*ot,F+=t*at,k+=t*ct,O+=t*lt,K+=t*xt,t=o[2],y+=t*s,_+=t*q,R+=t*I,A+=t*L,D+=t*G,T+=t*X,Y+=t*Q,j+=t*ft,z+=t*et,H+=t*nt,V+=t*it,F+=t*ot,k+=t*at,O+=t*ct,K+=t*lt,S+=t*xt,t=o[3],_+=t*s,R+=t*q,A+=t*I,D+=t*L,T+=t*G,Y+=t*X,j+=t*Q,z+=t*ft,H+=t*et,V+=t*nt,F+=t*it,k+=t*ot,O+=t*at,K+=t*ct,S+=t*lt,N+=t*xt,t=o[4],R+=t*s,A+=t*q,D+=t*I,T+=t*L,Y+=t*G,j+=t*X,z+=t*Q,H+=t*ft,V+=t*et,F+=t*nt,k+=t*it,O+=t*ot,K+=t*at,S+=t*ct,N+=t*lt,U+=t*xt,t=o[5],A+=t*s,D+=t*q,T+=t*I,Y+=t*L,j+=t*G,z+=t*X,H+=t*Q,V+=t*ft,F+=t*et,k+=t*nt,O+=t*it,K+=t*ot,S+=t*at,N+=t*ct,U+=t*lt,E+=t*xt,t=o[6],D+=t*s,T+=t*q,Y+=t*I,j+=t*L,z+=t*G,H+=t*X,V+=t*Q,F+=t*ft,k+=t*et,O+=t*nt,K+=t*it,S+=t*ot,N+=t*at,U+=t*ct,E+=t*lt,x+=t*xt,t=o[7],T+=t*s,Y+=t*q,j+=t*I,z+=t*L,H+=t*G,V+=t*X,F+=t*Q,k+=t*ft,O+=t*et,K+=t*nt,S+=t*it,N+=t*ot,U+=t*at,E+=t*ct,x+=t*lt,d+=t*xt,t=o[8],Y+=t*s,j+=t*q,z+=t*I,H+=t*L,V+=t*G,F+=t*X,k+=t*Q,O+=t*ft,K+=t*et,S+=t*nt,N+=t*it,U+=t*ot,E+=t*at,x+=t*ct,d+=t*lt,m+=t*xt,t=o[9],j+=t*s,z+=t*q,H+=t*I,V+=t*L,F+=t*G,k+=t*X,O+=t*Q,K+=t*ft,S+=t*et,N+=t*nt,U+=t*it,E+=t*ot,x+=t*at,d+=t*ct,m+=t*lt,p+=t*xt,t=o[10],z+=t*s,H+=t*q,V+=t*I,F+=t*L,k+=t*G,O+=t*X,K+=t*Q,S+=t*ft,N+=t*et,U+=t*nt,E+=t*it,x+=t*ot,d+=t*at,m+=t*ct,p+=t*lt,g+=t*xt,t=o[11],H+=t*s,V+=t*q,F+=t*I,k+=t*L,O+=t*G,K+=t*X,S+=t*Q,N+=t*ft,U+=t*et,E+=t*nt,x+=t*it,d+=t*ot,m+=t*at,p+=t*ct,g+=t*lt,w+=t*xt,t=o[12],V+=t*s,F+=t*q,k+=t*I,O+=t*L,K+=t*G,S+=t*X,N+=t*Q,U+=t*ft,E+=t*et,x+=t*nt,d+=t*it,m+=t*ot,p+=t*at,g+=t*ct,w+=t*lt,M+=t*xt,t=o[13],F+=t*s,k+=t*q,O+=t*I,K+=t*L,S+=t*G,N+=t*X,U+=t*Q,E+=t*ft,x+=t*et,d+=t*nt,m+=t*it,p+=t*ot,g+=t*at,w+=t*ct,M+=t*lt,W+=t*xt,t=o[14],k+=t*s,O+=t*q,K+=t*I,S+=t*L,N+=t*G,U+=t*X,E+=t*Q,x+=t*ft,d+=t*et,m+=t*nt,p+=t*it,g+=t*ot,w+=t*at,M+=t*ct,W+=t*lt,$+=t*xt,t=o[15],O+=t*s,K+=t*q,S+=t*I,N+=t*L,U+=t*G,E+=t*X,x+=t*Q,d+=t*ft,m+=t*et,p+=t*nt,g+=t*it,w+=t*ot,M+=t*at,W+=t*ct,$+=t*lt,J+=t*xt,c+=38*K,l+=38*S,y+=38*N,_+=38*U,R+=38*E,A+=38*x,D+=38*d,T+=38*m,Y+=38*p,j+=38*g,z+=38*w,H+=38*M,V+=38*W,F+=38*$,k+=38*J,f=1,t=c+f+65535,f=Math.floor(t/65536),c=t-f*65536,t=l+f+65535,f=Math.floor(t/65536),l=t-f*65536,t=y+f+65535,f=Math.floor(t/65536),y=t-f*65536,t=_+f+65535,f=Math.floor(t/65536),_=t-f*65536,t=R+f+65535,f=Math.floor(t/65536),R=t-f*65536,t=A+f+65535,f=Math.floor(t/65536),A=t-f*65536,t=D+f+65535,f=Math.floor(t/65536),D=t-f*65536,t=T+f+65535,f=Math.floor(t/65536),T=t-f*65536,t=Y+f+65535,f=Math.floor(t/65536),Y=t-f*65536,t=j+f+65535,f=Math.floor(t/65536),j=t-f*65536,t=z+f+65535,f=Math.floor(t/65536),z=t-f*65536,t=H+f+65535,f=Math.floor(t/65536),H=t-f*65536,t=V+f+65535,f=Math.floor(t/65536),V=t-f*65536,t=F+f+65535,f=Math.floor(t/65536),F=t-f*65536,t=k+f+65535,f=Math.floor(t/65536),k=t-f*65536,t=O+f+65535,f=Math.floor(t/65536),O=t-f*65536,c+=f-1+37*(f-1),f=1,t=c+f+65535,f=Math.floor(t/65536),c=t-f*65536,t=l+f+65535,f=Math.floor(t/65536),l=t-f*65536,t=y+f+65535,f=Math.floor(t/65536),y=t-f*65536,t=_+f+65535,f=Math.floor(t/65536),_=t-f*65536,t=R+f+65535,f=Math.floor(t/65536),R=t-f*65536,t=A+f+65535,f=Math.floor(t/65536),A=t-f*65536,t=D+f+65535,f=Math.floor(t/65536),D=t-f*65536,t=T+f+65535,f=Math.floor(t/65536),T=t-f*65536,t=Y+f+65535,f=Math.floor(t/65536),Y=t-f*65536,t=j+f+65535,f=Math.floor(t/65536),j=t-f*65536,t=z+f+65535,f=Math.floor(t/65536),z=t-f*65536,t=H+f+65535,f=Math.floor(t/65536),H=t-f*65536,t=V+f+65535,f=Math.floor(t/65536),V=t-f*65536,t=F+f+65535,f=Math.floor(t/65536),F=t-f*65536,t=k+f+65535,f=Math.floor(t/65536),k=t-f*65536,t=O+f+65535,f=Math.floor(t/65536),O=t-f*65536,c+=f-1+37*(f-1),r[0]=c,r[1]=l,r[2]=y,r[3]=_,r[4]=R,r[5]=A,r[6]=D,r[7]=T,r[8]=Y,r[9]=j,r[10]=z,r[11]=H,r[12]=V,r[13]=F,r[14]=k,r[15]=O}function yt(r,o){Z(r,o,o)}function wr(r,o){var i=n(),t;for(t=0;t<16;t++)i[t]=o[t];for(t=253;t>=0;t--)yt(i,i),t!==2&&t!==4&&Z(i,i,o);for(t=0;t<16;t++)r[t]=i[t]}function _r(r,o){var i=n(),t;for(t=0;t<16;t++)i[t]=o[t];for(t=250;t>=0;t--)yt(i,i),t!==1&&Z(i,i,o);for(t=0;t<16;t++)r[t]=i[t]}function me(r,o,i){var t=new Uint8Array(32),f=new Float64Array(80),c,l,y=n(),_=n(),R=n(),A=n(),D=n(),T=n();for(l=0;l<31;l++)t[l]=o[l];for(t[31]=o[31]&127|64,t[0]&=248,$e(f,i),l=0;l<16;l++)_[l]=f[l],A[l]=y[l]=R[l]=0;for(y[0]=A[0]=1,l=254;l>=0;--l)c=t[l>>>3]>>>(l&7)&1,Gt(y,_,c),Gt(R,A,c),bt(D,y,R),mt(y,y,R),bt(R,_,A),mt(_,_,A),yt(A,D),yt(T,y),Z(y,R,y),Z(R,_,D),bt(D,y,R),mt(y,y,R),yt(_,y),mt(R,A,T),Z(y,R,B),bt(y,y,A),Z(R,R,y),Z(y,A,T),Z(A,_,f),yt(_,D),Gt(y,_,c),Gt(R,A,c);for(l=0;l<16;l++)f[l+16]=y[l],f[l+32]=R[l],f[l+48]=_[l],f[l+64]=A[l];var Y=f.subarray(32),j=f.subarray(16);return wr(Y,Y),Z(j,j,Y),qt(r,j),0}function we(r,o){return me(r,o,h)}function vr(r,o){return a(o,32),we(r,o)}function _e(r,o,i){var t=new Uint8Array(32);return me(t,i,o),Jt(r,u,t,Ot)}var Er=fe,En=We;function An(r,o,i,t,f,c){var l=new Uint8Array(32);return _e(l,f,c),Er(r,o,i,t,l)}function Sn(r,o,i,t,f,c){var l=new Uint8Array(32);return _e(l,f,c),En(r,o,i,t,l)}var Ar=[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 Sr(r,o,i,t){for(var f=new Int32Array(16),c=new Int32Array(16),l,y,_,R,A,D,T,Y,j,z,H,V,F,k,O,K,S,N,U,E,x,d,m,p,g,w,M=r[0],W=r[1],$=r[2],J=r[3],s=r[4],q=r[5],I=r[6],L=r[7],G=o[0],X=o[1],Q=o[2],ft=o[3],et=o[4],nt=o[5],it=o[6],ot=o[7],at=0;t>=128;){for(U=0;U<16;U++)E=8*U+at,f[U]=i[E+0]<<24|i[E+1]<<16|i[E+2]<<8|i[E+3],c[U]=i[E+4]<<24|i[E+5]<<16|i[E+6]<<8|i[E+7];for(U=0;U<80;U++)if(l=M,y=W,_=$,R=J,A=s,D=q,T=I,Y=L,j=G,z=X,H=Q,V=ft,F=et,k=nt,O=it,K=ot,x=L,d=ot,m=d&65535,p=d>>>16,g=x&65535,w=x>>>16,x=(s>>>14|et<<32-14)^(s>>>18|et<<32-18)^(et>>>41-32|s<<32-(41-32)),d=(et>>>14|s<<32-14)^(et>>>18|s<<32-18)^(s>>>41-32|et<<32-(41-32)),m+=d&65535,p+=d>>>16,g+=x&65535,w+=x>>>16,x=s&q^~s&I,d=et&nt^~et&it,m+=d&65535,p+=d>>>16,g+=x&65535,w+=x>>>16,x=Ar[U*2],d=Ar[U*2+1],m+=d&65535,p+=d>>>16,g+=x&65535,w+=x>>>16,x=f[U%16],d=c[U%16],m+=d&65535,p+=d>>>16,g+=x&65535,w+=x>>>16,p+=m>>>16,g+=p>>>16,w+=g>>>16,S=g&65535|w<<16,N=m&65535|p<<16,x=S,d=N,m=d&65535,p=d>>>16,g=x&65535,w=x>>>16,x=(M>>>28|G<<32-28)^(G>>>34-32|M<<32-(34-32))^(G>>>39-32|M<<32-(39-32)),d=(G>>>28|M<<32-28)^(M>>>34-32|G<<32-(34-32))^(M>>>39-32|G<<32-(39-32)),m+=d&65535,p+=d>>>16,g+=x&65535,w+=x>>>16,x=M&W^M&$^W&$,d=G&X^G&Q^X&Q,m+=d&65535,p+=d>>>16,g+=x&65535,w+=x>>>16,p+=m>>>16,g+=p>>>16,w+=g>>>16,Y=g&65535|w<<16,K=m&65535|p<<16,x=R,d=V,m=d&65535,p=d>>>16,g=x&65535,w=x>>>16,x=S,d=N,m+=d&65535,p+=d>>>16,g+=x&65535,w+=x>>>16,p+=m>>>16,g+=p>>>16,w+=g>>>16,R=g&65535|w<<16,V=m&65535|p<<16,W=l,$=y,J=_,s=R,q=A,I=D,L=T,M=Y,X=j,Q=z,ft=H,et=V,nt=F,it=k,ot=O,G=K,U%16===15)for(E=0;E<16;E++)x=f[E],d=c[E],m=d&65535,p=d>>>16,g=x&65535,w=x>>>16,x=f[(E+9)%16],d=c[(E+9)%16],m+=d&65535,p+=d>>>16,g+=x&65535,w+=x>>>16,S=f[(E+1)%16],N=c[(E+1)%16],x=(S>>>1|N<<32-1)^(S>>>8|N<<32-8)^S>>>7,d=(N>>>1|S<<32-1)^(N>>>8|S<<32-8)^(N>>>7|S<<32-7),m+=d&65535,p+=d>>>16,g+=x&65535,w+=x>>>16,S=f[(E+14)%16],N=c[(E+14)%16],x=(S>>>19|N<<32-19)^(N>>>61-32|S<<32-(61-32))^S>>>6,d=(N>>>19|S<<32-19)^(S>>>61-32|N<<32-(61-32))^(N>>>6|S<<32-6),m+=d&65535,p+=d>>>16,g+=x&65535,w+=x>>>16,p+=m>>>16,g+=p>>>16,w+=g>>>16,f[E]=g&65535|w<<16,c[E]=m&65535|p<<16;x=M,d=G,m=d&65535,p=d>>>16,g=x&65535,w=x>>>16,x=r[0],d=o[0],m+=d&65535,p+=d>>>16,g+=x&65535,w+=x>>>16,p+=m>>>16,g+=p>>>16,w+=g>>>16,r[0]=M=g&65535|w<<16,o[0]=G=m&65535|p<<16,x=W,d=X,m=d&65535,p=d>>>16,g=x&65535,w=x>>>16,x=r[1],d=o[1],m+=d&65535,p+=d>>>16,g+=x&65535,w+=x>>>16,p+=m>>>16,g+=p>>>16,w+=g>>>16,r[1]=W=g&65535|w<<16,o[1]=X=m&65535|p<<16,x=$,d=Q,m=d&65535,p=d>>>16,g=x&65535,w=x>>>16,x=r[2],d=o[2],m+=d&65535,p+=d>>>16,g+=x&65535,w+=x>>>16,p+=m>>>16,g+=p>>>16,w+=g>>>16,r[2]=$=g&65535|w<<16,o[2]=Q=m&65535|p<<16,x=J,d=ft,m=d&65535,p=d>>>16,g=x&65535,w=x>>>16,x=r[3],d=o[3],m+=d&65535,p+=d>>>16,g+=x&65535,w+=x>>>16,p+=m>>>16,g+=p>>>16,w+=g>>>16,r[3]=J=g&65535|w<<16,o[3]=ft=m&65535|p<<16,x=s,d=et,m=d&65535,p=d>>>16,g=x&65535,w=x>>>16,x=r[4],d=o[4],m+=d&65535,p+=d>>>16,g+=x&65535,w+=x>>>16,p+=m>>>16,g+=p>>>16,w+=g>>>16,r[4]=s=g&65535|w<<16,o[4]=et=m&65535|p<<16,x=q,d=nt,m=d&65535,p=d>>>16,g=x&65535,w=x>>>16,x=r[5],d=o[5],m+=d&65535,p+=d>>>16,g+=x&65535,w+=x>>>16,p+=m>>>16,g+=p>>>16,w+=g>>>16,r[5]=q=g&65535|w<<16,o[5]=nt=m&65535|p<<16,x=I,d=it,m=d&65535,p=d>>>16,g=x&65535,w=x>>>16,x=r[6],d=o[6],m+=d&65535,p+=d>>>16,g+=x&65535,w+=x>>>16,p+=m>>>16,g+=p>>>16,w+=g>>>16,r[6]=I=g&65535|w<<16,o[6]=it=m&65535|p<<16,x=L,d=ot,m=d&65535,p=d>>>16,g=x&65535,w=x>>>16,x=r[7],d=o[7],m+=d&65535,p+=d>>>16,g+=x&65535,w+=x>>>16,p+=m>>>16,g+=p>>>16,w+=g>>>16,r[7]=L=g&65535|w<<16,o[7]=ot=m&65535|p<<16,at+=128,t-=128}return t}function Yt(r,o,i){var t=new Int32Array(8),f=new Int32Array(8),c=new Uint8Array(256),l,y=i;for(t[0]=1779033703,t[1]=3144134277,t[2]=1013904242,t[3]=2773480762,t[4]=1359893119,t[5]=2600822924,t[6]=528734635,t[7]=1541459225,f[0]=4089235720,f[1]=2227873595,f[2]=4271175723,f[3]=1595750129,f[4]=2917565137,f[5]=725511199,f[6]=4215389547,f[7]=327033209,Sr(t,f,o,i),i%=128,l=0;l<i;l++)c[l]=o[y-i+l];for(c[i]=128,i=256-128*(i<112?1:0),c[i-9]=0,St(c,i-8,y/536870912|0,y<<3),Sr(t,f,c,i),l=0;l<8;l++)St(r,8*l,t[l],f[l]);return 0}function ve(r,o){var i=n(),t=n(),f=n(),c=n(),l=n(),y=n(),_=n(),R=n(),A=n();mt(i,r[1],r[0]),mt(A,o[1],o[0]),Z(i,i,A),bt(t,r[0],r[1]),bt(A,o[0],o[1]),Z(t,t,A),Z(f,r[3],o[3]),Z(f,f,P),Z(c,r[2],o[2]),bt(c,c,c),mt(l,t,i),mt(y,c,f),bt(_,c,f),bt(R,t,i),Z(r[0],l,y),Z(r[1],R,_),Z(r[2],_,y),Z(r[3],l,R)}function Tr(r,o,i){var t;for(t=0;t<4;t++)Gt(r[t],o[t],i)}function Ge(r,o){var i=n(),t=n(),f=n();wr(f,o[2]),Z(i,o[0],f),Z(t,o[1],f),qt(r,t),r[31]^=mr(i)<<7}function qe(r,o,i){var t,f;for(Nt(r[0],b),Nt(r[1],v),Nt(r[2],v),Nt(r[3],b),f=255;f>=0;--f)t=i[f/8|0]>>(f&7)&1,Tr(r,o,t),ve(o,r),ve(r,r),Tr(r,o,t)}function Ee(r,o){var i=[n(),n(),n(),n()];Nt(i[0],tt),Nt(i[1],rt),Nt(i[2],v),Z(i[3],tt,rt),qe(r,i,o)}function Ze(r,o,i){var t=new Uint8Array(64),f=[n(),n(),n(),n()],c;for(i||a(o,32),Yt(t,o,32),t[0]&=248,t[31]&=127,t[31]|=64,Ee(f,t),Ge(r,f),c=0;c<32;c++)o[c+32]=r[c];return 0}var Ae=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 Xe(r,o){var i,t,f,c;for(t=63;t>=32;--t){for(i=0,f=t-32,c=t-12;f<c;++f)o[f]+=i-16*o[t]*Ae[f-(t-32)],i=Math.floor((o[f]+128)/256),o[f]-=i*256;o[f]+=i,o[t]=0}for(i=0,f=0;f<32;f++)o[f]+=i-(o[31]>>4)*Ae[f],i=o[f]>>8,o[f]&=255;for(f=0;f<32;f++)o[f]-=i*Ae[f];for(t=0;t<32;t++)o[t+1]+=o[t]>>8,r[t]=o[t]&255}function Qe(r){var o=new Float64Array(64),i;for(i=0;i<64;i++)o[i]=r[i];for(i=0;i<64;i++)r[i]=0;Xe(r,o)}function Or(r,o,i,t){var f=new Uint8Array(64),c=new Uint8Array(64),l=new Uint8Array(64),y,_,R=new Float64Array(64),A=[n(),n(),n(),n()];Yt(f,t,32),f[0]&=248,f[31]&=127,f[31]|=64;var D=i+64;for(y=0;y<i;y++)r[64+y]=o[y];for(y=0;y<32;y++)r[32+y]=f[32+y];for(Yt(l,r.subarray(32),i+32),Qe(l),Ee(A,l),Ge(r,A),y=32;y<64;y++)r[y]=t[y];for(Yt(c,r,i+64),Qe(c),y=0;y<64;y++)R[y]=0;for(y=0;y<32;y++)R[y]=l[y];for(y=0;y<32;y++)for(_=0;_<32;_++)R[y+_]+=c[y]*f[_];return Xe(r.subarray(32),R),D}function Tn(r,o){var i=n(),t=n(),f=n(),c=n(),l=n(),y=n(),_=n();return Nt(r[2],v),$e(r[1],o),yt(f,r[1]),Z(c,f,C),mt(f,f,r[2]),bt(c,r[2],c),yt(l,c),yt(y,l),Z(_,y,l),Z(i,_,f),Z(i,i,c),_r(i,i),Z(i,i,f),Z(i,i,c),Z(i,i,c),Z(r[0],i,c),yt(t,r[0]),Z(t,t,c),br(t,f)&&Z(r[0],r[0],ht),yt(t,r[0]),Z(t,t,c),br(t,f)?-1:(mr(r[0])===o[31]>>7&&mt(r[0],b,r[0]),Z(r[3],r[0],r[1]),0)}function De(r,o,i,t){var f,c=new Uint8Array(32),l=new Uint8Array(64),y=[n(),n(),n(),n()],_=[n(),n(),n(),n()];if(i<64||Tn(_,t))return-1;for(f=0;f<i;f++)r[f]=o[f];for(f=0;f<32;f++)r[f+32]=t[f];if(Yt(l,r,i),Qe(l),qe(y,_,l),Ee(_,o.subarray(32)),ve(y,_),Ge(c,y),i-=64,Kt(o,0,c,0)){for(f=0;f<i;f++)r[f]=0;return-1}for(f=0;f<i;f++)r[f]=o[f+64];return i}var Ie=32,Se=24,ae=32,Zt=16,se=32,Te=32,ce=32,le=32,Le=32,Nr=Se,On=ae,Nn=Zt,Pt=64,jt=32,Xt=64,tr=32,er=64;e.lowlevel={crypto_core_hsalsa20:Jt,crypto_stream_xor:ie,crypto_stream:Mt,crypto_stream_salsa20_xor:ge,crypto_stream_salsa20:ne,crypto_onetimeauth:oe,crypto_onetimeauth_verify:be,crypto_verify_16:Tt,crypto_verify_32:Kt,crypto_secretbox:fe,crypto_secretbox_open:We,crypto_scalarmult:me,crypto_scalarmult_base:we,crypto_box_beforenm:_e,crypto_box_afternm:Er,crypto_box:An,crypto_box_open:Sn,crypto_box_keypair:vr,crypto_hash:Yt,crypto_sign:Or,crypto_sign_keypair:Ze,crypto_sign_open:De,crypto_secretbox_KEYBYTES:Ie,crypto_secretbox_NONCEBYTES:Se,crypto_secretbox_ZEROBYTES:ae,crypto_secretbox_BOXZEROBYTES:Zt,crypto_scalarmult_BYTES:se,crypto_scalarmult_SCALARBYTES:Te,crypto_box_PUBLICKEYBYTES:ce,crypto_box_SECRETKEYBYTES:le,crypto_box_BEFORENMBYTES:Le,crypto_box_NONCEBYTES:Nr,crypto_box_ZEROBYTES:On,crypto_box_BOXZEROBYTES:Nn,crypto_sign_BYTES:Pt,crypto_sign_PUBLICKEYBYTES:jt,crypto_sign_SECRETKEYBYTES:Xt,crypto_sign_SEEDBYTES:tr,crypto_hash_BYTES:er,gf:n,D:C,L:Ae,pack25519:qt,unpack25519:$e,M:Z,A:bt,S:yt,Z:mt,pow2523:_r,add:ve,set25519:Nt,modL:Xe,scalarmult:qe,scalarbase:Ee};function Pr(r,o){if(r.length!==Ie)throw new Error("bad key size");if(o.length!==Se)throw new Error("bad nonce size")}function Pn(r,o){if(r.length!==ce)throw new Error("bad public key size");if(o.length!==le)throw new Error("bad secret key size")}function pt(){for(var r=0;r<arguments.length;r++)if(!(arguments[r]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Ur(r){for(var o=0;o<r.length;o++)r[o]=0}e.randomBytes=function(r){var o=new Uint8Array(r);return a(o,r),o},e.secretbox=function(r,o,i){pt(r,o,i),Pr(i,o);for(var t=new Uint8Array(ae+r.length),f=new Uint8Array(t.length),c=0;c<r.length;c++)t[c+ae]=r[c];return fe(f,t,t.length,o,i),f.subarray(Zt)},e.secretbox.open=function(r,o,i){pt(r,o,i),Pr(i,o);for(var t=new Uint8Array(Zt+r.length),f=new Uint8Array(t.length),c=0;c<r.length;c++)t[c+Zt]=r[c];return t.length<32||We(f,t,t.length,o,i)!==0?null:f.subarray(ae)},e.secretbox.keyLength=Ie,e.secretbox.nonceLength=Se,e.secretbox.overheadLength=Zt,e.scalarMult=function(r,o){if(pt(r,o),r.length!==Te)throw new Error("bad n size");if(o.length!==se)throw new Error("bad p size");var i=new Uint8Array(se);return me(i,r,o),i},e.scalarMult.base=function(r){if(pt(r),r.length!==Te)throw new Error("bad n size");var o=new Uint8Array(se);return we(o,r),o},e.scalarMult.scalarLength=Te,e.scalarMult.groupElementLength=se,e.box=function(r,o,i,t){var f=e.box.before(i,t);return e.secretbox(r,o,f)},e.box.before=function(r,o){pt(r,o),Pn(r,o);var i=new Uint8Array(Le);return _e(i,r,o),i},e.box.after=e.secretbox,e.box.open=function(r,o,i,t){var f=e.box.before(i,t);return e.secretbox.open(r,o,f)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var r=new Uint8Array(ce),o=new Uint8Array(le);return vr(r,o),{publicKey:r,secretKey:o}},e.box.keyPair.fromSecretKey=function(r){if(pt(r),r.length!==le)throw new Error("bad secret key size");var o=new Uint8Array(ce);return we(o,r),{publicKey:o,secretKey:new Uint8Array(r)}},e.box.publicKeyLength=ce,e.box.secretKeyLength=le,e.box.sharedKeyLength=Le,e.box.nonceLength=Nr,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(r,o){if(pt(r,o),o.length!==Xt)throw new Error("bad secret key size");var i=new Uint8Array(Pt+r.length);return Or(i,r,r.length,o),i},e.sign.open=function(r,o){if(pt(r,o),o.length!==jt)throw new Error("bad public key size");var i=new Uint8Array(r.length),t=De(i,r,r.length,o);if(t<0)return null;for(var f=new Uint8Array(t),c=0;c<f.length;c++)f[c]=i[c];return f},e.sign.detached=function(r,o){for(var i=e.sign(r,o),t=new Uint8Array(Pt),f=0;f<t.length;f++)t[f]=i[f];return t},e.sign.detached.verify=function(r,o,i){if(pt(r,o,i),o.length!==Pt)throw new Error("bad signature size");if(i.length!==jt)throw new Error("bad public key size");var t=new Uint8Array(Pt+r.length),f=new Uint8Array(Pt+r.length),c;for(c=0;c<Pt;c++)t[c]=o[c];for(c=0;c<r.length;c++)t[c+Pt]=r[c];return De(f,t,t.length,i)>=0},e.sign.keyPair=function(){var r=new Uint8Array(jt),o=new Uint8Array(Xt);return Ze(r,o),{publicKey:r,secretKey:o}},e.sign.keyPair.fromSecretKey=function(r){if(pt(r),r.length!==Xt)throw new Error("bad secret key size");for(var o=new Uint8Array(jt),i=0;i<o.length;i++)o[i]=r[32+i];return{publicKey:o,secretKey:new Uint8Array(r)}},e.sign.keyPair.fromSeed=function(r){if(pt(r),r.length!==tr)throw new Error("bad seed size");for(var o=new Uint8Array(jt),i=new Uint8Array(Xt),t=0;t<32;t++)i[t]=r[t];return Ze(o,i,!0),{publicKey:o,secretKey:i}},e.sign.publicKeyLength=jt,e.sign.secretKeyLength=Xt,e.sign.seedLength=tr,e.sign.signatureLength=Pt,e.hash=function(r){pt(r);var o=new Uint8Array(er);return Yt(o,r,r.length),o},e.hash.hashLength=er,e.verify=function(r,o){return pt(r,o),r.length===0||o.length===0||r.length!==o.length?!1:st(r,0,o,0,r.length)===0},e.setPRNG=function(r){a=r},function(){var r=typeof self<"u"?self.crypto||self.msCrypto:null;if(r&&r.getRandomValues){var o=65536;e.setPRNG(function(i,t){var f,c=new Uint8Array(t);for(f=0;f<t;f+=o)r.getRandomValues(c.subarray(f,f+Math.min(t-f,o)));for(f=0;f<t;f++)i[f]=c[f];Ur(c)})}else typeof Rr<"u"&&(r=jr(),r&&r.randomBytes&&e.setPRNG(function(i,t){var f,c=r.randomBytes(t);for(f=0;f<t;f++)i[f]=c[f];Ur(c)}))}()})(typeof Re<"u"&&Re.exports?Re.exports:self.nacl=self.nacl||{})});var xe=Oe(ir());function Qt(e){var n;return new Uint8Array(((n=e.match(/.{1,2}/g))!==null&&n!==void 0?n:[]).map(a=>parseInt(a,16))).buffer}function Ut(e){return new Uint8Array(e).reduce((n,a)=>n+a.toString(16).padStart(2,"0"),"")}var Yn=(e,n)=>{if(e.byteLength!==n.byteLength)return!1;let a=new Uint8Array(e),u=new Uint8Array(n);for(let h=0;h<a.length;h++)if(a[h]!==u[h])return!1;return!0},Vr=e=>{if(e<=127)return 1;if(e<=255)return 2;if(e<=65535)return 3;if(e<=16777215)return 4;throw new Error("Length too long (> 4 bytes)")},kr=(e,n,a)=>{if(a<=127)return e[n]=a,1;if(a<=255)return e[n]=129,e[n+1]=a,2;if(a<=65535)return e[n]=130,e[n+1]=a>>8,e[n+2]=a,3;if(a<=16777215)return e[n]=131,e[n+1]=a>>16,e[n+2]=a>>8,e[n+3]=a,4;throw new Error("Length too long (> 4 bytes)")},or=(e,n)=>{if(e[n]<128)return 1;if(e[n]===128)throw new Error("Invalid length 0");if(e[n]===129)return 2;if(e[n]===130)return 3;if(e[n]===131)return 4;throw new Error("Length too long (> 4 bytes)")},jn=(e,n)=>{let a=or(e,n);if(a===1)return e[n];if(a===2)return e[n+1];if(a===3)return(e[n+1]<<8)+e[n+2];if(a===4)return(e[n+1]<<16)+(e[n+2]<<8)+e[n+3];throw new Error("Length too long (> 4 bytes)")},Fr=Uint8Array.from([48,12,6,10,43,6,1,4,1,131,184,67,1,1]),Be=Uint8Array.from([48,5,6,3,43,101,112]),yi=Uint8Array.from([48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,10]);function Ke(e,n){let a=2+Vr(e.byteLength+1),u=n.byteLength+a+e.byteLength,h=0,b=new Uint8Array(1+Vr(u)+u);return b[h++]=48,h+=kr(b,h,u),b.set(n,h),h+=n.byteLength,b[h++]=3,h+=kr(b,h,e.byteLength+1),b[h++]=0,b.set(new Uint8Array(e),h),b}var fr=(e,n)=>{let a=0,u=(B,C)=>{if(h[a++]!==B)throw new Error("Expected: "+C)},h=new Uint8Array(e);if(u(48,"sequence"),a+=or(h,a),!Yn(h.slice(a,a+n.byteLength),n))throw new Error("Not the expected OID.");a+=n.byteLength,u(3,"bit string");let b=jn(h,a)-1;a+=or(h,a),u(0,"0 padding");let v=h.slice(a);if(b!==v.length)throw new Error(`DER payload mismatch: Expected length ${b} actual length ${v.length}`);return v};var gt=class{constructor(n){this.rawKey=n,this.derKey=gt.derEncode(n)}static from(n){return this.fromDer(n.toDer())}static fromRaw(n){return new gt(n)}static fromDer(n){return new gt(this.derDecode(n))}static derEncode(n){return Ke(n,Be).buffer}static derDecode(n){let a=fr(n,Be);if(a.length!==this.RAW_KEY_LENGTH)throw new Error("An Ed25519 public key must be exactly 32bytes long");return a}toDer(){return this.derKey}toRaw(){return this.rawKey}};gt.RAW_KEY_LENGTH=32;var Rt=class extends Vt{constructor(n,a){super(),this._privateKey=a,this._publicKey=gt.from(n)}static generate(n){if(n&&n.length!==32)throw new Error("Ed25519 Seed needs to be 32 bytes long.");let{publicKey:a,secretKey:u}=n===void 0?xe.sign.keyPair():xe.sign.keyPair.fromSeed(n);return new this(gt.fromRaw(a),u)}static fromParsedJson(n){let[a,u]=n;return new Rt(gt.fromDer(Qt(a)),Qt(u))}static fromJSON(n){let a=JSON.parse(n);if(Array.isArray(a)){if(typeof a[0]=="string"&&typeof a[1]=="string")return this.fromParsedJson([a[0],a[1]]);throw new Error("Deserialization error: JSON must have at least 2 items.")}throw new Error(`Deserialization error: Invalid JSON type for string: ${JSON.stringify(n)}`)}static fromKeyPair(n,a){return new Rt(gt.fromRaw(n),a)}static fromSecretKey(n){let a=xe.sign.keyPair.fromSecretKey(new Uint8Array(n));return Rt.fromKeyPair(a.publicKey,a.secretKey)}toJSON(){return[Ut(this._publicKey.toDer()),Ut(this._privateKey)]}getKeyPair(){return{secretKey:this._privateKey,publicKey:this._publicKey}}getPublicKey(){return this._publicKey}async sign(n){let a=new Uint8Array(n);return xe.sign.detached(a,new Uint8Array(this._privateKey)).buffer}};var de=class extends Error{constructor(n){super(n),this.message=n,Object.setPrototypeOf(this,de.prototype)}};function Hr(e){if(e)return e;if(typeof crypto<"u"&&crypto.subtle)return crypto.subtle;throw new de("Global crypto was not available and none was provided. Please inlcude a SubtleCrypto implementation. See https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto")}var Ft=class extends Vt{constructor(n,a,u){super(),this._keyPair=n,this._derKey=a,this._subtleCrypto=u}static async generate(n){let{extractable:a=!1,keyUsages:u=["sign","verify"],subtleCrypto:h}=n??{},b=Hr(h),v=await b.generateKey({name:"ECDSA",namedCurve:"P-256"},a,u),B=await b.exportKey("spki",v.publicKey);return new this(v,B,b)}static async fromKeyPair(n,a){let u=Hr(a),h=await u.exportKey("spki",n.publicKey);return new Ft(n,h,u)}getKeyPair(){return this._keyPair}getPublicKey(){let n=this._derKey,a=Object.create(this._keyPair.publicKey);return a.toDer=function(){return n},a}async sign(n){let a={name:"ECDSA",hash:{name:"SHA-256"}};return this._keyPair.privateKey,await this._subtleCrypto.sign(a,this._keyPair.privateKey,n)}};var Dt=Oe(Cn());var Vn=function(e,n){var a={};for(var u in e)Object.prototype.hasOwnProperty.call(e,u)&&n.indexOf(u)<0&&(a[u]=e[u]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var h=0,u=Object.getOwnPropertySymbols(e);h<u.length;h++)n.indexOf(u[h])<0&&Object.prototype.propertyIsEnumerable.call(e,u[h])&&(a[u[h]]=e[u[h]]);return a},kn=new TextEncoder().encode("ic-request-auth-delegation"),Fn=new TextEncoder().encode(`
2
- ic-request`);function ar(e){if(typeof e!="string"||e.length<64)throw new Error("Invalid public key.");return Qt(e)}var It=class{constructor(n,a,u){this.pubkey=n,this.expiration=a,this.targets=u}toCBOR(){return Dt.value.map(Object.assign({pubkey:Dt.value.bytes(this.pubkey),expiration:Dt.value.u64(this.expiration.toString(16),16)},this.targets&&{targets:Dt.value.array(this.targets.map(n=>Dt.value.bytes(n.toUint8Array())))}))}toJSON(){return Object.assign({expiration:this.expiration.toString(16),pubkey:Ut(this.pubkey)},this.targets&&{targets:this.targets.map(n=>n.toHex())})}};async function Hn(e,n,a,u){let h=new It(n.toDer(),BigInt(+a)*BigInt(1e6),u),b=new Uint8Array([...kn,...new Uint8Array(rr(h))]),v=await e.sign(b);return{delegation:h,signature:v}}var Ht=class{constructor(n,a){this.delegations=n,this.publicKey=a}static async create(n,a,u=new Date(Date.now()+15*60*1e3),h={}){var b,v;let B=await Hn(n,a,u,h.targets);return new Ht([...((b=h.previous)===null||b===void 0?void 0:b.delegations)||[],B],((v=h.previous)===null||v===void 0?void 0:v.publicKey)||n.getPublicKey().toDer())}static fromJSON(n){let{publicKey:a,delegations:u}=typeof n=="string"?JSON.parse(n):n;if(!Array.isArray(u))throw new Error("Invalid delegations.");let h=u.map(b=>{let{delegation:v,signature:B}=b,{pubkey:C,expiration:P,targets:tt}=v;if(tt!==void 0&&!Array.isArray(tt))throw new Error("Invalid targets.");return{delegation:new It(ar(C),BigInt(`0x${P}`),tt&&tt.map(rt=>{if(typeof rt!="string")throw new Error("Invalid target.");return Pe.fromHex(rt)})),signature:ar(B)}});return new this(h,ar(a))}static fromDelegations(n,a){return new this(n,a)}toJSON(){return{delegations:this.delegations.map(n=>{let{delegation:a,signature:u}=n,{targets:h}=a;return{delegation:Object.assign({expiration:a.expiration.toString(16),pubkey:Ut(a.pubkey)},h&&{targets:h.map(b=>b.toHex())}),signature:Ut(u)}}),publicKey:Ut(this.publicKey)}}},ue=class extends Vt{constructor(n,a){super(),this._inner=n,this._delegation=a}static fromDelegation(n,a){return new this(n,a)}getDelegation(){return this._delegation}getPublicKey(){return{toDer:()=>this._delegation.publicKey}}sign(n){return this._inner.sign(n)}async transformRequest(n){let{body:a}=n,u=Vn(n,["body"]),h=await rr(a);return Object.assign(Object.assign({},u),{body:{content:a,sender_sig:await this.sign(new Uint8Array([...Fn,...new Uint8Array(h)])),sender_delegation:this._delegation.delegations,sender_pubkey:this._delegation.publicKey}})}};function zr(e,n){for(let{delegation:h}of e.delegations)if(+new Date(Number(h.expiration/BigInt(1e6)))<=+Date.now())return!1;let a=[],u=n?.scope;u&&(Array.isArray(u)?a.push(...u.map(h=>typeof h=="string"?Pe.fromText(h):h)):a.push(typeof u=="string"?Pe.fromText(u):u));for(let h of a){let b=h.toText();for(let{delegation:v}of e.delegations){if(v.targets===void 0)continue;let B=!0;for(let C of v.targets)if(C.toText()===b){B=!1;break}if(B)return!1}}return!0}var zn=Oe(Kn()),Wn=Oe(ir());var Wr;(function(e){e[e.ECDSA_WITH_SHA256=-7]="ECDSA_WITH_SHA256"})(Wr||(Wr={}));var Jr=["mousedown","mousemove","keydown","touchstart","wheel"],he=class{constructor(n={}){var a;this.callbacks=[],this.idleTimeout=10*60*1e3,this.timeoutID=void 0;let{onIdle:u,idleTimeout:h=10*60*1e3}=n||{};this.callbacks=u?[u]:[],this.idleTimeout=h;let b=this._resetTimer.bind(this);window.addEventListener("load",b,!0),Jr.forEach(function(B){document.addEventListener(B,b,!0)});let v=(B,C)=>{let P;return(...tt)=>{let rt=this,ht=function(){P=void 0,B.apply(rt,tt)};clearTimeout(P),P=window.setTimeout(ht,C)}};if(n?.captureScroll){let B=v(b,(a=n?.scrollDebounce)!==null&&a!==void 0?a:100);window.addEventListener("scroll",B,!0)}b()}static create(n={}){return new this(n)}registerCallback(n){this.callbacks.push(n)}exit(){clearTimeout(this.timeoutID),window.removeEventListener("load",this._resetTimer,!0);let n=this._resetTimer.bind(this);Jr.forEach(function(a){document.removeEventListener(a,n,!0)}),this.callbacks.forEach(a=>a())}_resetTimer(){let n=this.exit.bind(this);window.clearTimeout(this.timeoutID),this.timeoutID=window.setTimeout(n,this.idleTimeout)}};var Jn=(e,n)=>n.some(a=>e instanceof a),$r,Gr;function $n(){return $r||($r=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Gn(){return Gr||(Gr=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var qr=new WeakMap,cr=new WeakMap,Zr=new WeakMap,sr=new WeakMap,xr=new WeakMap;function qn(e){let n=new Promise((a,u)=>{let h=()=>{e.removeEventListener("success",b),e.removeEventListener("error",v)},b=()=>{a(_t(e.result)),h()},v=()=>{u(e.error),h()};e.addEventListener("success",b),e.addEventListener("error",v)});return n.then(a=>{a instanceof IDBCursor&&qr.set(a,e)}).catch(()=>{}),xr.set(n,e),n}function Zn(e){if(cr.has(e))return;let n=new Promise((a,u)=>{let h=()=>{e.removeEventListener("complete",b),e.removeEventListener("error",v),e.removeEventListener("abort",v)},b=()=>{a(),h()},v=()=>{u(e.error||new DOMException("AbortError","AbortError")),h()};e.addEventListener("complete",b),e.addEventListener("error",v),e.addEventListener("abort",v)});cr.set(e,n)}var lr={get(e,n,a){if(e instanceof IDBTransaction){if(n==="done")return cr.get(e);if(n==="objectStoreNames")return e.objectStoreNames||Zr.get(e);if(n==="store")return a.objectStoreNames[1]?void 0:a.objectStore(a.objectStoreNames[0])}return _t(e[n])},set(e,n,a){return e[n]=a,!0},has(e,n){return e instanceof IDBTransaction&&(n==="done"||n==="store")?!0:n in e}};function Xr(e){lr=e(lr)}function Xn(e){return e===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(n,...a){let u=e.call(Ce(this),n,...a);return Zr.set(u,n.sort?n.sort():[n]),_t(u)}:Gn().includes(e)?function(...n){return e.apply(Ce(this),n),_t(qr.get(this))}:function(...n){return _t(e.apply(Ce(this),n))}}function Qn(e){return typeof e=="function"?Xn(e):(e instanceof IDBTransaction&&Zn(e),Jn(e,$n())?new Proxy(e,lr):e)}function _t(e){if(e instanceof IDBRequest)return qn(e);if(sr.has(e))return sr.get(e);let n=Qn(e);return n!==e&&(sr.set(e,n),xr.set(n,e)),n}var Ce=e=>xr.get(e);function Dr(e,n,{blocked:a,upgrade:u,blocking:h,terminated:b}={}){let v=indexedDB.open(e,n),B=_t(v);return u&&v.addEventListener("upgradeneeded",C=>{u(_t(v.result),C.oldVersion,C.newVersion,_t(v.transaction),C)}),a&&v.addEventListener("blocked",C=>a(C.oldVersion,C.newVersion,C)),B.then(C=>{b&&C.addEventListener("close",()=>b()),h&&C.addEventListener("versionchange",P=>h(P.oldVersion,P.newVersion,P))}).catch(()=>{}),B}var Dn=["get","getKey","getAll","getAllKeys","count"],In=["put","add","delete","clear"],dr=new Map;function Qr(e,n){if(!(e instanceof IDBDatabase&&!(n in e)&&typeof n=="string"))return;if(dr.get(n))return dr.get(n);let a=n.replace(/FromIndex$/,""),u=n!==a,h=In.includes(a);if(!(a in(u?IDBIndex:IDBObjectStore).prototype)||!(h||Dn.includes(a)))return;let b=async function(v,...B){let C=this.transaction(v,h?"readwrite":"readonly"),P=C.store;return u&&(P=P.index(B.shift())),(await Promise.all([P[a](...B),h&&C.done]))[0]};return dr.set(n,b),b}Xr(e=>({...e,get:(n,a,u)=>Qr(n,a)||e.get(n,a,u),has:(n,a)=>!!Qr(n,a)||e.has(n,a)}));var Ir="auth-client-db",Lr="ic-keyval",Ln=async(e=Ir,n=Lr,a)=>(Me&&(localStorage!=null&&localStorage.getItem(wt))&&(localStorage.removeItem(wt),localStorage.removeItem(vt)),await Dr(e,a,{upgrade:u=>{u.objectStoreNames,u.objectStoreNames.contains(n)&&u.clear(n),u.createObjectStore(n)}}));async function ti(e,n,a){return await e.get(n,a)}async function ei(e,n,a,u){return await e.put(n,u,a)}async function ri(e,n,a){return await e.delete(n,a)}var zt=class{constructor(n,a){this._db=n,this._storeName=a}static async create(n){let{dbName:a=Ir,storeName:u=Lr,version:h=1}=n??{},b=await Ln(a,u,h);return new zt(b,u)}async set(n,a){return await ei(this._db,this._storeName,n,a)}async get(n){var a;return(a=await ti(this._db,this._storeName,n))!==null&&a!==void 0?a:null}async remove(n){return await ri(this._db,this._storeName,n)}};var vt="identity",wt="delegation",tn="iv",ni=1,Me=typeof window<"u",pe=class{constructor(n="ic-",a){this.prefix=n,this._localStorage=a}get(n){return Promise.resolve(this._getLocalStorage().getItem(this.prefix+n))}set(n,a){return this._getLocalStorage().setItem(this.prefix+n,a),Promise.resolve()}remove(n){return this._getLocalStorage().removeItem(this.prefix+n),Promise.resolve()}_getLocalStorage(){if(this._localStorage)return this._localStorage;let n=typeof window>"u"&&typeof window>"u"?typeof self>"u"?void 0:self.localStorage:window.localStorage;if(!n)throw new Error("Could not find local storage.");return n}},ye=class{get _db(){return new Promise(n=>{if(this.initializedDb){n(this.initializedDb);return}zt.create({version:ni}).then(a=>{this.initializedDb=a,n(a)})})}async get(n){return await(await this._db).get(n)}async set(n,a){await(await this._db).set(n,a)}async remove(n){await(await this._db).remove(n)}};var ii="https://identity.ic0.app",oi="#authorize",fi=500,ai="UserInterrupt",Ye=class{constructor(n,a,u,h,b,v,B,C){var P;this._identity=n,this._key=a,this._chain=u,this._storage=h,this.idleManager=b,this._createOptions=v,this._idpWindow=B,this._eventHandler=C;let tt=this.logout.bind(this),rt=v?.idleOptions;!rt?.onIdle&&!rt?.disableDefaultIdleCallback&&((P=this.idleManager)===null||P===void 0||P.registerCallback(()=>{tt(),location.reload()}))}static async create(n={}){var a,u;let h=(a=n.storage)!==null&&a!==void 0?a:new ye,b=null;if(n.identity)b=n.identity;else{let P=await h.get(vt);if(!P&&Me)try{let tt=new pe,rt=await tt.get(wt),ht=await tt.get(vt);rt&&ht&&(console.log("Discovered an identity stored in localstorage. Migrating to IndexedDB"),await h.set(wt,rt),await h.set(vt,ht),P=rt,await tt.remove(wt),await tt.remove(vt))}catch(tt){console.error("error while attempting to recover localstorage: "+tt)}if(P)try{typeof P=="object"?b=await Ft.fromKeyPair(P):typeof P=="string"&&(b=Rt.fromJSON(P))}catch{}}let v=new nr,B=null;if(b)try{let P=await h.get(wt);if(typeof P=="object"&&P!==null)throw new Error("Delegation chain is incorrectly stored. A delegation chain should be stored as a string.");n.identity?v=n.identity:P&&(B=Ht.fromJSON(P),zr(B)?v=ue.fromDelegation(b,B):(await ur(h),b=null))}catch(P){console.error(P),await ur(h),b=null}let C;return!((u=n.idleOptions)===null||u===void 0)&&u.disableIdle?C=void 0:(B||n.identity)&&(C=he.create(n.idleOptions)),b||(b=await Ft.generate(),await h.set(vt,b.getKeyPair())),new this(v,b,B,h,C,n)}_handleSuccess(n,a){var u,h,b;let v=n.delegations.map(P=>({delegation:new It(P.delegation.pubkey,P.delegation.expiration,P.delegation.targets),signature:P.signature.buffer})),B=Ht.fromDelegations(v,n.userPublicKey.buffer),C=this._key;if(C){if(this._chain=B,this._identity=ue.fromDelegation(C,this._chain),(u=this._idpWindow)===null||u===void 0||u.close(),!this.idleManager){let P=(h=this._createOptions)===null||h===void 0?void 0:h.idleOptions;this.idleManager=he.create(P),!P?.onIdle&&!P?.disableDefaultIdleCallback&&((b=this.idleManager)===null||b===void 0||b.registerCallback(()=>{this.logout(),location.reload()}))}a?.(),this._removeEventListener(),delete this._idpWindow}}getIdentity(){return this._identity}async isAuthenticated(){return!this.getIdentity().getPrincipal().isAnonymous()&&this._chain!==null}async login(n){var a,u,h,b;let v=BigInt(8)*BigInt(36e11),B=new URL(((a=n?.identityProvider)===null||a===void 0?void 0:a.toString())||ii);B.hash=oi,(u=this._idpWindow)===null||u===void 0||u.close(),this._removeEventListener(),this._eventHandler=this._getEventHandler(B,Object.assign({maxTimeToLive:(h=n?.maxTimeToLive)!==null&&h!==void 0?h:v},n)),window.addEventListener("message",this._eventHandler),this._idpWindow=(b=window.open(B.toString(),"idpWindow",n?.windowOpenerFeatures))!==null&&b!==void 0?b:void 0;let C=()=>{this._idpWindow&&(this._idpWindow.closed?this._handleFailure(ai,n?.onError):setTimeout(C,fi))};C()}_getEventHandler(n,a){return async u=>{var h,b,v;if(u.origin!==n.origin){console.warn(`WARNING: expected origin '${n.origin}', got '${u.origin}' (ignoring)`);return}let B=u.data;switch(B.kind){case"authorize-ready":{let C={kind:"authorize-client",sessionPublicKey:new Uint8Array((h=this._key)===null||h===void 0?void 0:h.getPublicKey().toDer()),maxTimeToLive:a?.maxTimeToLive,derivationOrigin:(b=a?.derivationOrigin)===null||b===void 0?void 0:b.toString()};(v=this._idpWindow)===null||v===void 0||v.postMessage(C,n.origin);break}case"authorize-client-success":try{this._handleSuccess(B,a?.onSuccess),this._chain&&await this._storage.set(wt,JSON.stringify(this._chain.toJSON()))}catch(C){this._handleFailure(C.message,a?.onError)}break;case"authorize-client-failure":this._handleFailure(B.text,a?.onError);break;default:break}}}_handleFailure(n,a){var u;(u=this._idpWindow)===null||u===void 0||u.close(),a?.(n),this._removeEventListener(),delete this._idpWindow}_removeEventListener(){this._eventHandler&&window.removeEventListener("message",this._eventHandler),this._eventHandler=void 0}async logout(n={}){if(await ur(this._storage),this._identity=new nr,this._chain=null,n.returnTo)try{window.history.pushState({},"",n.returnTo)}catch{window.location.href=n.returnTo}}};async function ur(e){await e.remove(vt),await e.remove(wt),await e.remove(tn)}var en=BigInt(144e11),rn=576,nn=576;var Lt=class{callbacks=[];populate(n){this.callbacks.forEach(({callback:a})=>a(n))}subscribe(n){let a=Symbol();return this.callbacks.push({id:a,callback:n}),()=>this.callbacks=this.callbacks.filter(({id:u})=>u!==a)}};var te=class extends Lt{authUser=null;constructor(){super()}static getInstance(){return te.instance||(te.instance=new te),te.instance}set(n){this.authUser=n,this.populate(n)}get(){return this.authUser}subscribe(n){let a=super.subscribe(n);return n(this.authUser),a}isLoggedIn(){return!this.authUser?.data?.principal.isAnonymous()}reset(){this.authUser=null,this.populate(this.authUser)}},Ct=te;Ne(Ct,"instance");var ee=class extends Lt{env;constructor(){super()}static getInstance(){return ee.instance||(ee.instance=new ee),ee.instance}set(n){this.env=n,this.populate(n)}get(){return this.env}localIdentity(){return this.get()?.localIdentityCanisterId!==void 0}subscribe(n){let a=super.subscribe(n);return n(this.env),a}},dt=ee;Ne(dt,"instance");var je=()=>typeof window<"u",hr=()=>{let e=dt.getInstance().get()?.satelliteId??"unknown";return dt.getInstance().localIdentity()?`http://${e}.localhost:8000`:`https://${e}.ic0.app`};var re=e=>e==null;var on=({width:e,height:n})=>{if(!je()||re(window)||re(window.top))return;let{top:{innerWidth:a,innerHeight:u}}=window,h=u/2+screenY-n/2,b=a/2+screenX-e/2;return`toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=${e}, height=${n}, top=${h}, left=${b}`};var ut=e=>e?[e]:[],Ve=e=>e?.[0],fn=async e=>{let n=new Blob([JSON.stringify(e)],{type:"application/json; charset=utf-8"});return new Uint8Array(await n.arrayBuffer())},pr=async e=>{let n=new Blob([e],{type:"application/json; charset=utf-8"});return JSON.parse(await n.text())};var ke=({matcher:e,paginate:n,order:a})=>({matcher:ut(e),paginate:ut(re(n)?void 0:{start_after:ut(n.startAfter),limit:ut(re(n.limit)?void 0:BigInt(n.limit))}),order:ut(a)});var an=({IDL:e})=>{let n=e.Record({controllers:e.Vec(e.Principal)}),a=e.Record({batch_id:e.Nat,headers:e.Vec(e.Tuple(e.Text,e.Text)),chunk_ids:e.Vec(e.Nat)}),u=e.Record({updated_at:e.Opt(e.Nat64)}),h=e.Record({headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text))))}),b=e.Record({storage:h}),v=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),created_at:e.Nat64}),B=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text))}),C=e.Record({token:e.Opt(e.Text),sha256:e.Opt(e.Vec(e.Nat8)),headers:e.Vec(e.Tuple(e.Text,e.Text)),index:e.Nat64,encoding_type:e.Text,full_path:e.Text}),P=e.Variant({Callback:e.Record({token:C,callback:e.Func([],[],[])})}),tt=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(P),status_code:e.Nat16}),rt=e.Record({token:e.Opt(C),body:e.Vec(e.Nat8)}),ht=e.Record({token:e.Opt(e.Text),collection:e.Text,name:e.Text,encoding_type:e.Opt(e.Text),full_path:e.Text}),St=e.Record({batch_id:e.Nat}),st=e.Record({desc:e.Bool}),Tt=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),Kt=e.Record({order:e.Opt(st),matcher:e.Opt(e.Text),paginate:e.Opt(Tt)}),He=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),ze=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),Wt=e.Record({key:He,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,ze)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),Jt=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,Wt))}),Ot=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),ge=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,v))}),ne=e.Variant({Db:e.Null,Storage:e.Null}),Mt=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),ie=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:Mt,created_at:e.Nat64,write:Mt}),$t=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8)}),oe=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:Mt,write:Mt}),be=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat}),fe=e.Record({chunk_id:e.Nat});return e.Service({add_controllers:e.Func([n],[e.Vec(e.Principal)],[]),commit_asset_upload:e.Func([a],[],[]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Opt(e.Text)],[],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,u],[],[]),get_config:e.Func([],[b],[]),get_doc:e.Func([e.Text,e.Text],[e.Opt(v)],["query"]),http_request:e.Func([B],[tt],["query"]),http_request_streaming_callback:e.Func([C],[rt],["query"]),init_asset_upload:e.Func([ht],[St],[]),list_assets:e.Func([e.Opt(e.Text),Kt],[Jt],["query"]),list_controllers:e.Func([],[e.Vec(e.Principal)],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,Ot))],["query"]),list_docs:e.Func([e.Text,Kt],[ge],["query"]),list_rules:e.Func([ne],[e.Vec(e.Tuple(e.Text,ie))],["query"]),remove_controllers:e.Func([n],[e.Vec(e.Principal)],[]),set_config:e.Func([b],[],[]),set_custom_domain:e.Func([e.Text,e.Opt(e.Text)],[],[]),set_doc:e.Func([e.Text,e.Text,$t],[v],[]),set_rule:e.Func([ne,e.Text,oe],[],[]),upload_asset_chunk:e.Func([be],[fe],[]),version:e.Func([],[e.Text],["query"])})};var sn=async({satelliteId:e,idlFactory:n,identity:a,fetch:u,env:h="prod"})=>{let b=h==="dev"||dt.getInstance().localIdentity(),v=b?"http://127.0.0.1:8000/":"https://ic0.app",B=new Kr({identity:a,...v&&{host:v},...u&&{fetch:u}});return b&&await B.fetchRootKey(),Cr.createActor(n,{agent:B,canisterId:e})};var Et=async({satelliteId:e,...n})=>{let{satelliteId:a}=e!==void 0?{satelliteId:e}:dt.getInstance().get()??{satelliteId:void 0};if(!a)throw new Error("No satellite principal defined.");return sn({satelliteId:a,idlFactory:an,...n})};var cn=async({collection:e,key:n,satellite:a})=>{let u=await Et(a),h=Ve(await u.get_doc(e,n));if(!h)return;let b=await pr(h.data);return{key:n,data:b,created_at:h.created_at,updated_at:h.updated_at}},ln=async({collection:e,doc:n,satellite:a})=>{let u=await Et(a),{key:h,data:b,updated_at:v}=n,B=await u.set_doc(e,h,{data:await fn(b),updated_at:ut(v)});return{key:h,data:b,created_at:B.created_at,updated_at:B.updated_at}},xn=async({collection:e,doc:n,satellite:a})=>{let u=await Et(a),{key:h,updated_at:b}=n;return u.del_doc(e,h,{updated_at:ut(b)})},dn=async({collection:e,filter:n,satellite:a})=>{let u=await Et(a),{items:h,matches_length:b,length:v}=await u.list_docs(e,ke(n)),B=[];for(let[C,P]of h)B.push({key:C,data:await pr(P.data),created_at:P.created_at,updated_at:P.updated_at});return{items:B,length:v,matches_length:b}};var At=e=>{if(e!==void 0)return e;let n=Fe();if(!n)throw new Error("No internet identity.");return n};var un=async({satellite:e,...n})=>{let a=At(e?.identity);return cn({...n,satellite:{...e,identity:a}})},hn=async({satellite:e,...n})=>{let a=At(e?.identity);return ln({...n,satellite:{...e,identity:a}})},Vo=async({satellite:e,...n})=>{let a=At(e?.identity);return xn({...n,satellite:{...e,identity:a}})},ko=async({satellite:e,...n})=>{let a=At(e?.identity);return dn({...n,satellite:{...e,identity:a}})};var pn=async()=>{let e=Fe();if(!e)throw new Error("No internet identity.");let n=e.getPrincipal().toText(),a=await un({collection:"#user",key:n});return a||await si({userId:n,principal:e.getPrincipal()})},si=async({userId:e,principal:n})=>{let a=new Date;return hn({collection:"#user",doc:{key:e,data:{principal:n,created_at:a,updated_at:a}}})};var Bt,yn=()=>Ye.create({idleOptions:{disableIdle:!0,disableDefaultIdleCallback:!0}}),yr=async()=>{if(Bt=Bt??await yn(),!(await Bt?.isAuthenticated()||!1))return;let n=await pn();Ct.getInstance().set(n)},ci=async e=>new Promise(async(n,a)=>{Bt=Bt??await yn(),await Bt.login({onSuccess:async()=>{await yr(),n()},onError:u=>a(u),maxTimeToLive:e?.maxTimeToLive??en,...dt.getInstance().localIdentity()&&{identityProvider:`http://${dt.getInstance().get()?.localIdentityCanisterId}.localhost:8000?#authorize`},...e?.derivationOrigin!==void 0&&{derivationOrigin:e.derivationOrigin},...e?.windowed!==!1&&{windowOpenerFeatures:on({width:rn,height:nn})}})}),li=async()=>{await Bt?.logout(),Bt=void 0,Ct.getInstance().reset()},Fe=()=>Bt?.getIdentity();var gn=async({data:e,filename:n,collection:a,headers:u,token:h,fullPath:b,encoding:v,satellite:B})=>{let C=await Et(B),{batch_id:P}=await C.init_asset_upload({collection:a,full_path:b,name:n,token:ut(h),encoding_type:ut(v)}),tt=7e5,rt=[],ht=je()?new Blob([await e.arrayBuffer()]):e;for(let st=0;st<ht.size;st+=tt){let Tt=ht.slice(st,st+tt);rt.push(await xi({batchId:P,chunk:Tt,actor:C}))}let St=u.find(([st,Tt])=>st.toLowerCase()==="content-type")===void 0&&e.type!==void 0&&e.type!==""?[["Content-Type",e.type]]:void 0;await C.commit_asset_upload({batch_id:P,chunk_ids:rt.map(({chunk_id:st})=>st),headers:[...u,...St||[]]})},xi=async({batchId:e,chunk:n,actor:a})=>a.upload_asset_chunk({batch_id:e,content:new Uint8Array(await n.arrayBuffer())}),bn=async({collection:e,satellite:n,filter:a})=>{let u=await Et(n),{items:h,matches_length:b,length:v}=await u.list_assets(ut(e),ke(a));return{items:h.map(([B,C])=>C),length:v,matches_length:b}},mn=async({collection:e,storageFile:n,satellite:a})=>{let u=await Et(a),{fullPath:h}=n;return u.del_asset(e,h)},wn=async({collection:e,satellite:n})=>(await Et(n)).del_assets(ut(e));var _n=e=>btoa([...e].map(n=>String.fromCharCode(n)).join(""));var gr=e=>encodeURI(e.toLowerCase().replace(/\s/g,"-"));var xf=async e=>vn(e),df=async e=>vn({filename:e.data.name,...e}),vn=async({filename:e,data:n,collection:a,headers:u=[],fullPath:h,token:b,satellite:v,encoding:B})=>{let C=At(v?.identity),P=gr(e),tt=h||`/${a}/${P}`;return await gn({data:n,filename:gr(P),collection:a,token:b,headers:u,fullPath:tt,encoding:B,satellite:{...v,identity:C}}),{downloadUrl:`${hr()}${tt}${b!==void 0?`?token=${b}`:""}`,fullPath:tt,name:P}},uf=async({collection:e,satellite:n,filter:a})=>{let{items:u,...h}=await bn({collection:e,satellite:{...n,identity:At(n?.identity)},filter:a??{}}),b=hr();return{assets:u.map(({key:{full_path:v,token:B,name:C},headers:P,encodings:tt})=>{let rt=Ve(B);return{fullPath:v,name:C,downloadUrl:`${b}${v}${rt!==void 0?`?token=${rt}`:""}`,token:rt,headers:P,encodings:tt.reduce((ht,[St,{modified:st,sha256:Tt,total_length:Kt}])=>({...ht,[St]:{modified:st,sha256:_n(Tt),total_length:Kt}}),{})}}),...h}},hf=async({storageFile:e,collection:n,satellite:a})=>mn({collection:n,storageFile:e,satellite:{...a,identity:At(a?.identity)}}),pf=async({collection:e,satellite:n})=>wn({collection:e,satellite:{...n,identity:At(n?.identity)}});var wf=async e=>{dt.getInstance().set(e),await yr()},_f=e=>Ct.getInstance().subscribe(e);export{_f as authSubscribe,Vo as delDoc,hf as deleteAsset,pf as deleteAssets,un as getDoc,wf as initJuno,uf as listAssets,ko as listDocs,hn as setDoc,ci as signIn,li as signOut,xf as uploadBlob,df as uploadFile};
3
- //# sourceMappingURL=index.js.map