@pelican-identity/vanilla 1.0.37 → 1.0.39

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/dist/index.min.js CHANGED
@@ -1,11 +1,11 @@
1
- var Pelican=(function(exports){'use strict';var ci=Object.create;var Or=Object.defineProperty;var li=Object.getOwnPropertyDescriptor;var ui=Object.getOwnPropertyNames;var hi=Object.getPrototypeOf,di=Object.prototype.hasOwnProperty;var qr=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,i)=>(typeof require<"u"?require:e)[i]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var et=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var xi=(n,e,i,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of ui(e))!di.call(n,c)&&c!==i&&Or(n,c,{get:()=>e[c],enumerable:!(a=li(e,c))||a.enumerable});return n};var pi=(n,e,i)=>(i=n!=null?ci(hi(n)):{},xi(!n||!n.__esModule?Or(i,"default",{value:n,enumerable:true}):i,n));var Kr=et(()=>{});var Yr=et((Ao,Ie)=>{(function(n){var e=function(r){var s,o=new Float64Array(16);if(r)for(s=0;s<r.length;s++)o[s]=r[s];return o},i=function(){throw new Error("no PRNG")},a=new Uint8Array(16),c=new Uint8Array(32);c[0]=9;var u=e(),g=e([1]),y=e([56129,1]),E=e([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),z=e([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),q=e([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),st=e([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),nt=e([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function bt(r,s,o,t){r[s]=o>>24&255,r[s+1]=o>>16&255,r[s+2]=o>>8&255,r[s+3]=o&255,r[s+4]=t>>24&255,r[s+5]=t>>16&255,r[s+6]=t>>8&255,r[s+7]=t&255;}function mt(r,s,o,t,f){var h,d=0;for(h=0;h<f;h++)d|=r[s+h]^o[t+h];return (1&d-1>>>8)-1}function vt(r,s,o,t){return mt(r,s,o,t,16)}function kt(r,s,o,t){return mt(r,s,o,t,32)}function qt(r,s,o,t){for(var f=t[0]&255|(t[1]&255)<<8|(t[2]&255)<<16|(t[3]&255)<<24,h=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,m=o[8]&255|(o[9]&255)<<8|(o[10]&255)<<16|(o[11]&255)<<24,A=o[12]&255|(o[13]&255)<<8|(o[14]&255)<<16|(o[15]&255)<<24,U=t[4]&255|(t[5]&255)<<8|(t[6]&255)<<16|(t[7]&255)<<24,_=s[0]&255|(s[1]&255)<<8|(s[2]&255)<<16|(s[3]&255)<<24,G=s[4]&255|(s[5]&255)<<8|(s[6]&255)<<16|(s[7]&255)<<24,M=s[8]&255|(s[9]&255)<<8|(s[10]&255)<<16|(s[11]&255)<<24,k=s[12]&255|(s[13]&255)<<8|(s[14]&255)<<16|(s[15]&255)<<24,N=t[8]&255|(t[9]&255)<<8|(t[10]&255)<<16|(t[11]&255)<<24,Y=o[16]&255|(o[17]&255)<<8|(o[18]&255)<<16|(o[19]&255)<<24,K=o[20]&255|(o[21]&255)<<8|(o[22]&255)<<16|(o[23]&255)<<24,j=o[24]&255|(o[25]&255)<<8|(o[26]&255)<<16|(o[27]&255)<<24,O=o[28]&255|(o[29]&255)<<8|(o[30]&255)<<16|(o[31]&255)<<24,D=t[12]&255|(t[13]&255)<<8|(t[14]&255)<<16|(t[15]&255)<<24,T=f,R=h,B=d,I=m,L=A,S=U,x=_,p=G,v=M,b=k,w=N,C=Y,P=K,F=j,H=O,$=D,l,W=0;W<20;W+=2)l=T+P|0,L^=l<<7|l>>>25,l=L+T|0,v^=l<<9|l>>>23,l=v+L|0,P^=l<<13|l>>>19,l=P+v|0,T^=l<<18|l>>>14,l=S+R|0,b^=l<<7|l>>>25,l=b+S|0,F^=l<<9|l>>>23,l=F+b|0,R^=l<<13|l>>>19,l=R+F|0,S^=l<<18|l>>>14,l=w+x|0,H^=l<<7|l>>>25,l=H+w|0,B^=l<<9|l>>>23,l=B+H|0,x^=l<<13|l>>>19,l=x+B|0,w^=l<<18|l>>>14,l=$+C|0,I^=l<<7|l>>>25,l=I+$|0,p^=l<<9|l>>>23,l=p+I|0,C^=l<<13|l>>>19,l=C+p|0,$^=l<<18|l>>>14,l=T+I|0,R^=l<<7|l>>>25,l=R+T|0,B^=l<<9|l>>>23,l=B+R|0,I^=l<<13|l>>>19,l=I+B|0,T^=l<<18|l>>>14,l=S+L|0,x^=l<<7|l>>>25,l=x+S|0,p^=l<<9|l>>>23,l=p+x|0,L^=l<<13|l>>>19,l=L+p|0,S^=l<<18|l>>>14,l=w+b|0,C^=l<<7|l>>>25,l=C+w|0,v^=l<<9|l>>>23,l=v+C|0,b^=l<<13|l>>>19,l=b+v|0,w^=l<<18|l>>>14,l=$+H|0,P^=l<<7|l>>>25,l=P+$|0,F^=l<<9|l>>>23,l=F+P|0,H^=l<<13|l>>>19,l=H+F|0,$^=l<<18|l>>>14;T=T+f|0,R=R+h|0,B=B+d|0,I=I+m|0,L=L+A|0,S=S+U|0,x=x+_|0,p=p+G|0,v=v+M|0,b=b+k|0,w=w+N|0,C=C+Y|0,P=P+K|0,F=F+j|0,H=H+O|0,$=$+D|0,r[0]=T>>>0&255,r[1]=T>>>8&255,r[2]=T>>>16&255,r[3]=T>>>24&255,r[4]=R>>>0&255,r[5]=R>>>8&255,r[6]=R>>>16&255,r[7]=R>>>24&255,r[8]=B>>>0&255,r[9]=B>>>8&255,r[10]=B>>>16&255,r[11]=B>>>24&255,r[12]=I>>>0&255,r[13]=I>>>8&255,r[14]=I>>>16&255,r[15]=I>>>24&255,r[16]=L>>>0&255,r[17]=L>>>8&255,r[18]=L>>>16&255,r[19]=L>>>24&255,r[20]=S>>>0&255,r[21]=S>>>8&255,r[22]=S>>>16&255,r[23]=S>>>24&255,r[24]=x>>>0&255,r[25]=x>>>8&255,r[26]=x>>>16&255,r[27]=x>>>24&255,r[28]=p>>>0&255,r[29]=p>>>8&255,r[30]=p>>>16&255,r[31]=p>>>24&255,r[32]=v>>>0&255,r[33]=v>>>8&255,r[34]=v>>>16&255,r[35]=v>>>24&255,r[36]=b>>>0&255,r[37]=b>>>8&255,r[38]=b>>>16&255,r[39]=b>>>24&255,r[40]=w>>>0&255,r[41]=w>>>8&255,r[42]=w>>>16&255,r[43]=w>>>24&255,r[44]=C>>>0&255,r[45]=C>>>8&255,r[46]=C>>>16&255,r[47]=C>>>24&255,r[48]=P>>>0&255,r[49]=P>>>8&255,r[50]=P>>>16&255,r[51]=P>>>24&255,r[52]=F>>>0&255,r[53]=F>>>8&255,r[54]=F>>>16&255,r[55]=F>>>24&255,r[56]=H>>>0&255,r[57]=H>>>8&255,r[58]=H>>>16&255,r[59]=H>>>24&255,r[60]=$>>>0&255,r[61]=$>>>8&255,r[62]=$>>>16&255,r[63]=$>>>24&255;}function fe(r,s,o,t){for(var f=t[0]&255|(t[1]&255)<<8|(t[2]&255)<<16|(t[3]&255)<<24,h=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,m=o[8]&255|(o[9]&255)<<8|(o[10]&255)<<16|(o[11]&255)<<24,A=o[12]&255|(o[13]&255)<<8|(o[14]&255)<<16|(o[15]&255)<<24,U=t[4]&255|(t[5]&255)<<8|(t[6]&255)<<16|(t[7]&255)<<24,_=s[0]&255|(s[1]&255)<<8|(s[2]&255)<<16|(s[3]&255)<<24,G=s[4]&255|(s[5]&255)<<8|(s[6]&255)<<16|(s[7]&255)<<24,M=s[8]&255|(s[9]&255)<<8|(s[10]&255)<<16|(s[11]&255)<<24,k=s[12]&255|(s[13]&255)<<8|(s[14]&255)<<16|(s[15]&255)<<24,N=t[8]&255|(t[9]&255)<<8|(t[10]&255)<<16|(t[11]&255)<<24,Y=o[16]&255|(o[17]&255)<<8|(o[18]&255)<<16|(o[19]&255)<<24,K=o[20]&255|(o[21]&255)<<8|(o[22]&255)<<16|(o[23]&255)<<24,j=o[24]&255|(o[25]&255)<<8|(o[26]&255)<<16|(o[27]&255)<<24,O=o[28]&255|(o[29]&255)<<8|(o[30]&255)<<16|(o[31]&255)<<24,D=t[12]&255|(t[13]&255)<<8|(t[14]&255)<<16|(t[15]&255)<<24,T=f,R=h,B=d,I=m,L=A,S=U,x=_,p=G,v=M,b=k,w=N,C=Y,P=K,F=j,H=O,$=D,l,W=0;W<20;W+=2)l=T+P|0,L^=l<<7|l>>>25,l=L+T|0,v^=l<<9|l>>>23,l=v+L|0,P^=l<<13|l>>>19,l=P+v|0,T^=l<<18|l>>>14,l=S+R|0,b^=l<<7|l>>>25,l=b+S|0,F^=l<<9|l>>>23,l=F+b|0,R^=l<<13|l>>>19,l=R+F|0,S^=l<<18|l>>>14,l=w+x|0,H^=l<<7|l>>>25,l=H+w|0,B^=l<<9|l>>>23,l=B+H|0,x^=l<<13|l>>>19,l=x+B|0,w^=l<<18|l>>>14,l=$+C|0,I^=l<<7|l>>>25,l=I+$|0,p^=l<<9|l>>>23,l=p+I|0,C^=l<<13|l>>>19,l=C+p|0,$^=l<<18|l>>>14,l=T+I|0,R^=l<<7|l>>>25,l=R+T|0,B^=l<<9|l>>>23,l=B+R|0,I^=l<<13|l>>>19,l=I+B|0,T^=l<<18|l>>>14,l=S+L|0,x^=l<<7|l>>>25,l=x+S|0,p^=l<<9|l>>>23,l=p+x|0,L^=l<<13|l>>>19,l=L+p|0,S^=l<<18|l>>>14,l=w+b|0,C^=l<<7|l>>>25,l=C+w|0,v^=l<<9|l>>>23,l=v+C|0,b^=l<<13|l>>>19,l=b+v|0,w^=l<<18|l>>>14,l=$+H|0,P^=l<<7|l>>>25,l=P+$|0,F^=l<<9|l>>>23,l=F+P|0,H^=l<<13|l>>>19,l=H+F|0,$^=l<<18|l>>>14;r[0]=T>>>0&255,r[1]=T>>>8&255,r[2]=T>>>16&255,r[3]=T>>>24&255,r[4]=S>>>0&255,r[5]=S>>>8&255,r[6]=S>>>16&255,r[7]=S>>>24&255,r[8]=w>>>0&255,r[9]=w>>>8&255,r[10]=w>>>16&255,r[11]=w>>>24&255,r[12]=$>>>0&255,r[13]=$>>>8&255,r[14]=$>>>16&255,r[15]=$>>>24&255,r[16]=x>>>0&255,r[17]=x>>>8&255,r[18]=x>>>16&255,r[19]=x>>>24&255,r[20]=p>>>0&255,r[21]=p>>>8&255,r[22]=p>>>16&255,r[23]=p>>>24&255,r[24]=v>>>0&255,r[25]=v>>>8&255,r[26]=v>>>16&255,r[27]=v>>>24&255,r[28]=b>>>0&255,r[29]=b>>>8&255,r[30]=b>>>16&255,r[31]=b>>>24&255;}function Tt(r,s,o,t){qt(r,s,o,t);}function It(r,s,o,t){fe(r,s,o,t);}var dt=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function wt(r,s,o,t,f,h,d){var m=new Uint8Array(16),A=new Uint8Array(64),U,_;for(_=0;_<16;_++)m[_]=0;for(_=0;_<8;_++)m[_]=h[_];for(;f>=64;){for(Tt(A,m,d,dt),_=0;_<64;_++)r[s+_]=o[t+_]^A[_];for(U=1,_=8;_<16;_++)U=U+(m[_]&255)|0,m[_]=U&255,U>>>=8;f-=64,s+=64,t+=64;}if(f>0)for(Tt(A,m,d,dt),_=0;_<f;_++)r[s+_]=o[t+_]^A[_];return 0}function _t(r,s,o,t,f){var h=new Uint8Array(16),d=new Uint8Array(64),m,A;for(A=0;A<16;A++)h[A]=0;for(A=0;A<8;A++)h[A]=t[A];for(;o>=64;){for(Tt(d,h,f,dt),A=0;A<64;A++)r[s+A]=d[A];for(m=1,A=8;A<16;A++)m=m+(h[A]&255)|0,h[A]=m&255,m>>>=8;o-=64,s+=64;}if(o>0)for(Tt(d,h,f,dt),A=0;A<o;A++)r[s+A]=d[A];return 0}function Nt(r,s,o,t,f){var h=new Uint8Array(32);It(h,t,f,dt);for(var d=new Uint8Array(8),m=0;m<8;m++)d[m]=t[m+16];return _t(r,s,o,d,h)}function ae(r,s,o,t,f,h,d){var m=new Uint8Array(32);It(m,h,d,dt);for(var A=new Uint8Array(8),U=0;U<8;U++)A[U]=h[U+16];return wt(r,s,o,t,f,A,m)}var Jt=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 s,o,t,f,h,d,m,A;s=r[0]&255|(r[1]&255)<<8,this.r[0]=s&8191,o=r[2]&255|(r[3]&255)<<8,this.r[1]=(s>>>13|o<<3)&8191,t=r[4]&255|(r[5]&255)<<8,this.r[2]=(o>>>10|t<<6)&7939,f=r[6]&255|(r[7]&255)<<8,this.r[3]=(t>>>7|f<<9)&8191,h=r[8]&255|(r[9]&255)<<8,this.r[4]=(f>>>4|h<<12)&255,this.r[5]=h>>>1&8190,d=r[10]&255|(r[11]&255)<<8,this.r[6]=(h>>>14|d<<2)&8191,m=r[12]&255|(r[13]&255)<<8,this.r[7]=(d>>>11|m<<5)&8065,A=r[14]&255|(r[15]&255)<<8,this.r[8]=(m>>>8|A<<8)&8191,this.r[9]=A>>>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;};Jt.prototype.blocks=function(r,s,o){for(var t=this.fin?0:2048,f,h,d,m,A,U,_,G,M,k,N,Y,K,j,O,D,T,R,B,I=this.h[0],L=this.h[1],S=this.h[2],x=this.h[3],p=this.h[4],v=this.h[5],b=this.h[6],w=this.h[7],C=this.h[8],P=this.h[9],F=this.r[0],H=this.r[1],$=this.r[2],l=this.r[3],W=this.r[4],X=this.r[5],tt=this.r[6],V=this.r[7],Z=this.r[8],Q=this.r[9];o>=16;)f=r[s+0]&255|(r[s+1]&255)<<8,I+=f&8191,h=r[s+2]&255|(r[s+3]&255)<<8,L+=(f>>>13|h<<3)&8191,d=r[s+4]&255|(r[s+5]&255)<<8,S+=(h>>>10|d<<6)&8191,m=r[s+6]&255|(r[s+7]&255)<<8,x+=(d>>>7|m<<9)&8191,A=r[s+8]&255|(r[s+9]&255)<<8,p+=(m>>>4|A<<12)&8191,v+=A>>>1&8191,U=r[s+10]&255|(r[s+11]&255)<<8,b+=(A>>>14|U<<2)&8191,_=r[s+12]&255|(r[s+13]&255)<<8,w+=(U>>>11|_<<5)&8191,G=r[s+14]&255|(r[s+15]&255)<<8,C+=(_>>>8|G<<8)&8191,P+=G>>>5|t,M=0,k=M,k+=I*F,k+=L*(5*Q),k+=S*(5*Z),k+=x*(5*V),k+=p*(5*tt),M=k>>>13,k&=8191,k+=v*(5*X),k+=b*(5*W),k+=w*(5*l),k+=C*(5*$),k+=P*(5*H),M+=k>>>13,k&=8191,N=M,N+=I*H,N+=L*F,N+=S*(5*Q),N+=x*(5*Z),N+=p*(5*V),M=N>>>13,N&=8191,N+=v*(5*tt),N+=b*(5*X),N+=w*(5*W),N+=C*(5*l),N+=P*(5*$),M+=N>>>13,N&=8191,Y=M,Y+=I*$,Y+=L*H,Y+=S*F,Y+=x*(5*Q),Y+=p*(5*Z),M=Y>>>13,Y&=8191,Y+=v*(5*V),Y+=b*(5*tt),Y+=w*(5*X),Y+=C*(5*W),Y+=P*(5*l),M+=Y>>>13,Y&=8191,K=M,K+=I*l,K+=L*$,K+=S*H,K+=x*F,K+=p*(5*Q),M=K>>>13,K&=8191,K+=v*(5*Z),K+=b*(5*V),K+=w*(5*tt),K+=C*(5*X),K+=P*(5*W),M+=K>>>13,K&=8191,j=M,j+=I*W,j+=L*l,j+=S*$,j+=x*H,j+=p*F,M=j>>>13,j&=8191,j+=v*(5*Q),j+=b*(5*Z),j+=w*(5*V),j+=C*(5*tt),j+=P*(5*X),M+=j>>>13,j&=8191,O=M,O+=I*X,O+=L*W,O+=S*l,O+=x*$,O+=p*H,M=O>>>13,O&=8191,O+=v*F,O+=b*(5*Q),O+=w*(5*Z),O+=C*(5*V),O+=P*(5*tt),M+=O>>>13,O&=8191,D=M,D+=I*tt,D+=L*X,D+=S*W,D+=x*l,D+=p*$,M=D>>>13,D&=8191,D+=v*H,D+=b*F,D+=w*(5*Q),D+=C*(5*Z),D+=P*(5*V),M+=D>>>13,D&=8191,T=M,T+=I*V,T+=L*tt,T+=S*X,T+=x*W,T+=p*l,M=T>>>13,T&=8191,T+=v*$,T+=b*H,T+=w*F,T+=C*(5*Q),T+=P*(5*Z),M+=T>>>13,T&=8191,R=M,R+=I*Z,R+=L*V,R+=S*tt,R+=x*X,R+=p*W,M=R>>>13,R&=8191,R+=v*l,R+=b*$,R+=w*H,R+=C*F,R+=P*(5*Q),M+=R>>>13,R&=8191,B=M,B+=I*Q,B+=L*Z,B+=S*V,B+=x*tt,B+=p*X,M=B>>>13,B&=8191,B+=v*W,B+=b*l,B+=w*$,B+=C*H,B+=P*F,M+=B>>>13,B&=8191,M=(M<<2)+M|0,M=M+k|0,k=M&8191,M=M>>>13,N+=M,I=k,L=N,S=Y,x=K,p=j,v=O,b=D,w=T,C=R,P=B,s+=16,o-=16;this.h[0]=I,this.h[1]=L,this.h[2]=S,this.h[3]=x,this.h[4]=p,this.h[5]=v,this.h[6]=b,this.h[7]=w,this.h[8]=C,this.h[9]=P;},Jt.prototype.finish=function(r,s){var o=new Uint16Array(10),t,f,h,d;if(this.leftover){for(d=this.leftover,this.buffer[d++]=1;d<16;d++)this.buffer[d]=0;this.fin=1,this.blocks(this.buffer,0,16);}for(t=this.h[1]>>>13,this.h[1]&=8191,d=2;d<10;d++)this.h[d]+=t,t=this.h[d]>>>13,this.h[d]&=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,o[0]=this.h[0]+5,t=o[0]>>>13,o[0]&=8191,d=1;d<10;d++)o[d]=this.h[d]+t,t=o[d]>>>13,o[d]&=8191;for(o[9]-=8192,f=(t^1)-1,d=0;d<10;d++)o[d]&=f;for(f=~f,d=0;d<10;d++)this.h[d]=this.h[d]&f|o[d];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,h=this.h[0]+this.pad[0],this.h[0]=h&65535,d=1;d<8;d++)h=(this.h[d]+this.pad[d]|0)+(h>>>16)|0,this.h[d]=h&65535;r[s+0]=this.h[0]>>>0&255,r[s+1]=this.h[0]>>>8&255,r[s+2]=this.h[1]>>>0&255,r[s+3]=this.h[1]>>>8&255,r[s+4]=this.h[2]>>>0&255,r[s+5]=this.h[2]>>>8&255,r[s+6]=this.h[3]>>>0&255,r[s+7]=this.h[3]>>>8&255,r[s+8]=this.h[4]>>>0&255,r[s+9]=this.h[4]>>>8&255,r[s+10]=this.h[5]>>>0&255,r[s+11]=this.h[5]>>>8&255,r[s+12]=this.h[6]>>>0&255,r[s+13]=this.h[6]>>>8&255,r[s+14]=this.h[7]>>>0&255,r[s+15]=this.h[7]>>>8&255;},Jt.prototype.update=function(r,s,o){var t,f;if(this.leftover){for(f=16-this.leftover,f>o&&(f=o),t=0;t<f;t++)this.buffer[this.leftover+t]=r[s+t];if(o-=f,s+=f,this.leftover+=f,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0;}if(o>=16&&(f=o-o%16,this.blocks(r,s,f),s+=f,o-=f),o){for(t=0;t<o;t++)this.buffer[this.leftover+t]=r[s+t];this.leftover+=o;}};function ce(r,s,o,t,f,h){var d=new Jt(h);return d.update(o,t,f),d.finish(r,s),0}function ft(r,s,o,t,f,h){var d=new Uint8Array(16);return ce(d,0,o,t,f,h),vt(r,s,d,0)}function Ut(r,s,o,t,f){var h;if(o<32)return -1;for(ae(r,0,s,0,o,t,f),ce(r,16,r,32,o-32,r),h=0;h<16;h++)r[h]=0;return 0}function Zt(r,s,o,t,f){var h,d=new Uint8Array(32);if(o<32||(Nt(d,0,32,t,f),ft(s,16,s,32,o-32,d)!==0))return -1;for(ae(r,0,s,0,o,t,f),h=0;h<32;h++)r[h]=0;return 0}function Ct(r,s){var o;for(o=0;o<16;o++)r[o]=s[o]|0;}function Qt(r){var s,o,t=1;for(s=0;s<16;s++)o=r[s]+t+65535,t=Math.floor(o/65536),r[s]=o-t*65536;r[0]+=t-1+37*(t-1);}function Gt(r,s,o){for(var t,f=~(o-1),h=0;h<16;h++)t=f&(r[h]^s[h]),r[h]^=t,s[h]^=t;}function Xt(r,s){var o,t,f,h=e(),d=e();for(o=0;o<16;o++)d[o]=s[o];for(Qt(d),Qt(d),Qt(d),t=0;t<2;t++){for(h[0]=d[0]-65517,o=1;o<15;o++)h[o]=d[o]-65535-(h[o-1]>>16&1),h[o-1]&=65535;h[15]=d[15]-32767-(h[14]>>16&1),f=h[15]>>16&1,h[14]&=65535,Gt(d,h,1-f);}for(o=0;o<16;o++)r[2*o]=d[o]&255,r[2*o+1]=d[o]>>8;}function Br(r,s){var o=new Uint8Array(32),t=new Uint8Array(32);return Xt(o,r),Xt(t,s),kt(o,0,t,0)}function Mr(r){var s=new Uint8Array(32);return Xt(s,r),s[0]&1}function He(r,s){var o;for(o=0;o<16;o++)r[o]=s[2*o]+(s[2*o+1]<<8);r[15]&=32767;}function Bt(r,s,o){for(var t=0;t<16;t++)r[t]=s[t]+o[t];}function Mt(r,s,o){for(var t=0;t<16;t++)r[t]=s[t]-o[t];}function J(r,s,o){var t,f,h=0,d=0,m=0,A=0,U=0,_=0,G=0,M=0,k=0,N=0,Y=0,K=0,j=0,O=0,D=0,T=0,R=0,B=0,I=0,L=0,S=0,x=0,p=0,v=0,b=0,w=0,C=0,P=0,F=0,H=0,$=0,l=o[0],W=o[1],X=o[2],tt=o[3],V=o[4],Z=o[5],Q=o[6],ut=o[7],it=o[8],at=o[9],ct=o[10],lt=o[11],xt=o[12],pt=o[13],gt=o[14],yt=o[15];t=s[0],h+=t*l,d+=t*W,m+=t*X,A+=t*tt,U+=t*V,_+=t*Z,G+=t*Q,M+=t*ut,k+=t*it,N+=t*at,Y+=t*ct,K+=t*lt,j+=t*xt,O+=t*pt,D+=t*gt,T+=t*yt,t=s[1],d+=t*l,m+=t*W,A+=t*X,U+=t*tt,_+=t*V,G+=t*Z,M+=t*Q,k+=t*ut,N+=t*it,Y+=t*at,K+=t*ct,j+=t*lt,O+=t*xt,D+=t*pt,T+=t*gt,R+=t*yt,t=s[2],m+=t*l,A+=t*W,U+=t*X,_+=t*tt,G+=t*V,M+=t*Z,k+=t*Q,N+=t*ut,Y+=t*it,K+=t*at,j+=t*ct,O+=t*lt,D+=t*xt,T+=t*pt,R+=t*gt,B+=t*yt,t=s[3],A+=t*l,U+=t*W,_+=t*X,G+=t*tt,M+=t*V,k+=t*Z,N+=t*Q,Y+=t*ut,K+=t*it,j+=t*at,O+=t*ct,D+=t*lt,T+=t*xt,R+=t*pt,B+=t*gt,I+=t*yt,t=s[4],U+=t*l,_+=t*W,G+=t*X,M+=t*tt,k+=t*V,N+=t*Z,Y+=t*Q,K+=t*ut,j+=t*it,O+=t*at,D+=t*ct,T+=t*lt,R+=t*xt,B+=t*pt,I+=t*gt,L+=t*yt,t=s[5],_+=t*l,G+=t*W,M+=t*X,k+=t*tt,N+=t*V,Y+=t*Z,K+=t*Q,j+=t*ut,O+=t*it,D+=t*at,T+=t*ct,R+=t*lt,B+=t*xt,I+=t*pt,L+=t*gt,S+=t*yt,t=s[6],G+=t*l,M+=t*W,k+=t*X,N+=t*tt,Y+=t*V,K+=t*Z,j+=t*Q,O+=t*ut,D+=t*it,T+=t*at,R+=t*ct,B+=t*lt,I+=t*xt,L+=t*pt,S+=t*gt,x+=t*yt,t=s[7],M+=t*l,k+=t*W,N+=t*X,Y+=t*tt,K+=t*V,j+=t*Z,O+=t*Q,D+=t*ut,T+=t*it,R+=t*at,B+=t*ct,I+=t*lt,L+=t*xt,S+=t*pt,x+=t*gt,p+=t*yt,t=s[8],k+=t*l,N+=t*W,Y+=t*X,K+=t*tt,j+=t*V,O+=t*Z,D+=t*Q,T+=t*ut,R+=t*it,B+=t*at,I+=t*ct,L+=t*lt,S+=t*xt,x+=t*pt,p+=t*gt,v+=t*yt,t=s[9],N+=t*l,Y+=t*W,K+=t*X,j+=t*tt,O+=t*V,D+=t*Z,T+=t*Q,R+=t*ut,B+=t*it,I+=t*at,L+=t*ct,S+=t*lt,x+=t*xt,p+=t*pt,v+=t*gt,b+=t*yt,t=s[10],Y+=t*l,K+=t*W,j+=t*X,O+=t*tt,D+=t*V,T+=t*Z,R+=t*Q,B+=t*ut,I+=t*it,L+=t*at,S+=t*ct,x+=t*lt,p+=t*xt,v+=t*pt,b+=t*gt,w+=t*yt,t=s[11],K+=t*l,j+=t*W,O+=t*X,D+=t*tt,T+=t*V,R+=t*Z,B+=t*Q,I+=t*ut,L+=t*it,S+=t*at,x+=t*ct,p+=t*lt,v+=t*xt,b+=t*pt,w+=t*gt,C+=t*yt,t=s[12],j+=t*l,O+=t*W,D+=t*X,T+=t*tt,R+=t*V,B+=t*Z,I+=t*Q,L+=t*ut,S+=t*it,x+=t*at,p+=t*ct,v+=t*lt,b+=t*xt,w+=t*pt,C+=t*gt,P+=t*yt,t=s[13],O+=t*l,D+=t*W,T+=t*X,R+=t*tt,B+=t*V,I+=t*Z,L+=t*Q,S+=t*ut,x+=t*it,p+=t*at,v+=t*ct,b+=t*lt,w+=t*xt,C+=t*pt,P+=t*gt,F+=t*yt,t=s[14],D+=t*l,T+=t*W,R+=t*X,B+=t*tt,I+=t*V,L+=t*Z,S+=t*Q,x+=t*ut,p+=t*it,v+=t*at,b+=t*ct,w+=t*lt,C+=t*xt,P+=t*pt,F+=t*gt,H+=t*yt,t=s[15],T+=t*l,R+=t*W,B+=t*X,I+=t*tt,L+=t*V,S+=t*Z,x+=t*Q,p+=t*ut,v+=t*it,b+=t*at,w+=t*ct,C+=t*lt,P+=t*xt,F+=t*pt,H+=t*gt,$+=t*yt,h+=38*R,d+=38*B,m+=38*I,A+=38*L,U+=38*S,_+=38*x,G+=38*p,M+=38*v,k+=38*b,N+=38*w,Y+=38*C,K+=38*P,j+=38*F,O+=38*H,D+=38*$,f=1,t=h+f+65535,f=Math.floor(t/65536),h=t-f*65536,t=d+f+65535,f=Math.floor(t/65536),d=t-f*65536,t=m+f+65535,f=Math.floor(t/65536),m=t-f*65536,t=A+f+65535,f=Math.floor(t/65536),A=t-f*65536,t=U+f+65535,f=Math.floor(t/65536),U=t-f*65536,t=_+f+65535,f=Math.floor(t/65536),_=t-f*65536,t=G+f+65535,f=Math.floor(t/65536),G=t-f*65536,t=M+f+65535,f=Math.floor(t/65536),M=t-f*65536,t=k+f+65535,f=Math.floor(t/65536),k=t-f*65536,t=N+f+65535,f=Math.floor(t/65536),N=t-f*65536,t=Y+f+65535,f=Math.floor(t/65536),Y=t-f*65536,t=K+f+65535,f=Math.floor(t/65536),K=t-f*65536,t=j+f+65535,f=Math.floor(t/65536),j=t-f*65536,t=O+f+65535,f=Math.floor(t/65536),O=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,h+=f-1+37*(f-1),f=1,t=h+f+65535,f=Math.floor(t/65536),h=t-f*65536,t=d+f+65535,f=Math.floor(t/65536),d=t-f*65536,t=m+f+65535,f=Math.floor(t/65536),m=t-f*65536,t=A+f+65535,f=Math.floor(t/65536),A=t-f*65536,t=U+f+65535,f=Math.floor(t/65536),U=t-f*65536,t=_+f+65535,f=Math.floor(t/65536),_=t-f*65536,t=G+f+65535,f=Math.floor(t/65536),G=t-f*65536,t=M+f+65535,f=Math.floor(t/65536),M=t-f*65536,t=k+f+65535,f=Math.floor(t/65536),k=t-f*65536,t=N+f+65535,f=Math.floor(t/65536),N=t-f*65536,t=Y+f+65535,f=Math.floor(t/65536),Y=t-f*65536,t=K+f+65535,f=Math.floor(t/65536),K=t-f*65536,t=j+f+65535,f=Math.floor(t/65536),j=t-f*65536,t=O+f+65535,f=Math.floor(t/65536),O=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,h+=f-1+37*(f-1),r[0]=h,r[1]=d,r[2]=m,r[3]=A,r[4]=U,r[5]=_,r[6]=G,r[7]=M,r[8]=k,r[9]=N,r[10]=Y,r[11]=K,r[12]=j,r[13]=O,r[14]=D,r[15]=T;}function At(r,s){J(r,s,s);}function Tr(r,s){var o=e(),t;for(t=0;t<16;t++)o[t]=s[t];for(t=253;t>=0;t--)At(o,o),t!==2&&t!==4&&J(o,o,s);for(t=0;t<16;t++)r[t]=o[t];}function Ir(r,s){var o=e(),t;for(t=0;t<16;t++)o[t]=s[t];for(t=250;t>=0;t--)At(o,o),t!==1&&J(o,o,s);for(t=0;t<16;t++)r[t]=o[t];}function Ee(r,s,o){var t=new Uint8Array(32),f=new Float64Array(80),h,d,m=e(),A=e(),U=e(),_=e(),G=e(),M=e();for(d=0;d<31;d++)t[d]=s[d];for(t[31]=s[31]&127|64,t[0]&=248,He(f,o),d=0;d<16;d++)A[d]=f[d],_[d]=m[d]=U[d]=0;for(m[0]=_[0]=1,d=254;d>=0;--d)h=t[d>>>3]>>>(d&7)&1,Gt(m,A,h),Gt(U,_,h),Bt(G,m,U),Mt(m,m,U),Bt(U,A,_),Mt(A,A,_),At(_,G),At(M,m),J(m,U,m),J(U,A,G),Bt(G,m,U),Mt(m,m,U),At(A,m),Mt(U,_,M),J(m,U,y),Bt(m,m,_),J(U,U,m),J(m,_,M),J(_,A,f),At(A,G),Gt(m,A,h),Gt(U,_,h);for(d=0;d<16;d++)f[d+16]=m[d],f[d+32]=U[d],f[d+48]=A[d],f[d+64]=_[d];var k=f.subarray(32),N=f.subarray(16);return Tr(k,k),J(N,N,k),Xt(r,N),0}function Ce(r,s){return Ee(r,s,c)}function Lr(r,s){return i(s,32),Ce(r,s)}function Ae(r,s,o){var t=new Uint8Array(32);return Ee(t,o,s),It(r,a,t,dt)}var Ur=Ut,ri=Zt;function ni(r,s,o,t,f,h){var d=new Uint8Array(32);return Ae(d,f,h),Ur(r,s,o,t,d)}function ii(r,s,o,t,f,h){var d=new Uint8Array(32);return Ae(d,f,h),ri(r,s,o,t,d)}var Rr=[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 Pr(r,s,o,t){for(var f=new Int32Array(16),h=new Int32Array(16),d,m,A,U,_,G,M,k,N,Y,K,j,O,D,T,R,B,I,L,S,x,p,v,b,w,C,P=r[0],F=r[1],H=r[2],$=r[3],l=r[4],W=r[5],X=r[6],tt=r[7],V=s[0],Z=s[1],Q=s[2],ut=s[3],it=s[4],at=s[5],ct=s[6],lt=s[7],xt=0;t>=128;){for(L=0;L<16;L++)S=8*L+xt,f[L]=o[S+0]<<24|o[S+1]<<16|o[S+2]<<8|o[S+3],h[L]=o[S+4]<<24|o[S+5]<<16|o[S+6]<<8|o[S+7];for(L=0;L<80;L++)if(d=P,m=F,A=H,U=$,_=l,G=W,M=X,k=tt,N=V,Y=Z,K=Q,j=ut,O=it,D=at,T=ct,R=lt,x=tt,p=lt,v=p&65535,b=p>>>16,w=x&65535,C=x>>>16,x=(l>>>14|it<<18)^(l>>>18|it<<14)^(it>>>9|l<<23),p=(it>>>14|l<<18)^(it>>>18|l<<14)^(l>>>9|it<<23),v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,x=l&W^~l&X,p=it&at^~it&ct,v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,x=Rr[L*2],p=Rr[L*2+1],v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,x=f[L%16],p=h[L%16],v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,B=w&65535|C<<16,I=v&65535|b<<16,x=B,p=I,v=p&65535,b=p>>>16,w=x&65535,C=x>>>16,x=(P>>>28|V<<4)^(V>>>2|P<<30)^(V>>>7|P<<25),p=(V>>>28|P<<4)^(P>>>2|V<<30)^(P>>>7|V<<25),v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,x=P&F^P&H^F&H,p=V&Z^V&Q^Z&Q,v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,k=w&65535|C<<16,R=v&65535|b<<16,x=U,p=j,v=p&65535,b=p>>>16,w=x&65535,C=x>>>16,x=B,p=I,v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,U=w&65535|C<<16,j=v&65535|b<<16,F=d,H=m,$=A,l=U,W=_,X=G,tt=M,P=k,Z=N,Q=Y,ut=K,it=j,at=O,ct=D,lt=T,V=R,L%16===15)for(S=0;S<16;S++)x=f[S],p=h[S],v=p&65535,b=p>>>16,w=x&65535,C=x>>>16,x=f[(S+9)%16],p=h[(S+9)%16],v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,B=f[(S+1)%16],I=h[(S+1)%16],x=(B>>>1|I<<31)^(B>>>8|I<<24)^B>>>7,p=(I>>>1|B<<31)^(I>>>8|B<<24)^(I>>>7|B<<25),v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,B=f[(S+14)%16],I=h[(S+14)%16],x=(B>>>19|I<<13)^(I>>>29|B<<3)^B>>>6,p=(I>>>19|B<<13)^(B>>>29|I<<3)^(I>>>6|B<<26),v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,f[S]=w&65535|C<<16,h[S]=v&65535|b<<16;x=P,p=V,v=p&65535,b=p>>>16,w=x&65535,C=x>>>16,x=r[0],p=s[0],v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,r[0]=P=w&65535|C<<16,s[0]=V=v&65535|b<<16,x=F,p=Z,v=p&65535,b=p>>>16,w=x&65535,C=x>>>16,x=r[1],p=s[1],v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,r[1]=F=w&65535|C<<16,s[1]=Z=v&65535|b<<16,x=H,p=Q,v=p&65535,b=p>>>16,w=x&65535,C=x>>>16,x=r[2],p=s[2],v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,r[2]=H=w&65535|C<<16,s[2]=Q=v&65535|b<<16,x=$,p=ut,v=p&65535,b=p>>>16,w=x&65535,C=x>>>16,x=r[3],p=s[3],v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,r[3]=$=w&65535|C<<16,s[3]=ut=v&65535|b<<16,x=l,p=it,v=p&65535,b=p>>>16,w=x&65535,C=x>>>16,x=r[4],p=s[4],v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,r[4]=l=w&65535|C<<16,s[4]=it=v&65535|b<<16,x=W,p=at,v=p&65535,b=p>>>16,w=x&65535,C=x>>>16,x=r[5],p=s[5],v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,r[5]=W=w&65535|C<<16,s[5]=at=v&65535|b<<16,x=X,p=ct,v=p&65535,b=p>>>16,w=x&65535,C=x>>>16,x=r[6],p=s[6],v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,r[6]=X=w&65535|C<<16,s[6]=ct=v&65535|b<<16,x=tt,p=lt,v=p&65535,b=p>>>16,w=x&65535,C=x>>>16,x=r[7],p=s[7],v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,r[7]=tt=w&65535|C<<16,s[7]=lt=v&65535|b<<16,xt+=128,t-=128;}return t}function Kt(r,s,o){var t=new Int32Array(8),f=new Int32Array(8),h=new Uint8Array(256),d,m=o;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,Pr(t,f,s,o),o%=128,d=0;d<o;d++)h[d]=s[m-o+d];for(h[o]=128,o=256-128*(o<112?1:0),h[o-9]=0,bt(h,o-8,m/536870912|0,m<<3),Pr(t,f,h,o),d=0;d<8;d++)bt(r,8*d,t[d],f[d]);return 0}function Se(r,s){var o=e(),t=e(),f=e(),h=e(),d=e(),m=e(),A=e(),U=e(),_=e();Mt(o,r[1],r[0]),Mt(_,s[1],s[0]),J(o,o,_),Bt(t,r[0],r[1]),Bt(_,s[0],s[1]),J(t,t,_),J(f,r[3],s[3]),J(f,f,z),J(h,r[2],s[2]),Bt(h,h,h),Mt(d,t,o),Mt(m,h,f),Bt(A,h,f),Bt(U,t,o),J(r[0],d,m),J(r[1],U,A),J(r[2],A,m),J(r[3],d,U);}function kr(r,s,o){var t;for(t=0;t<4;t++)Gt(r[t],s[t],o);}function Ve(r,s){var o=e(),t=e(),f=e();Tr(f,s[2]),J(o,s[0],f),J(t,s[1],f),Xt(r,t),r[31]^=Mr(o)<<7;}function We(r,s,o){var t,f;for(Ct(r[0],u),Ct(r[1],g),Ct(r[2],g),Ct(r[3],u),f=255;f>=0;--f)t=o[f/8|0]>>(f&7)&1,kr(r,s,t),Se(s,r),Se(r,r),kr(r,s,t);}function _e(r,s){var o=[e(),e(),e(),e()];Ct(o[0],q),Ct(o[1],st),Ct(o[2],g),J(o[3],q,st),We(r,o,s);}function Je(r,s,o){var t=new Uint8Array(64),f=[e(),e(),e(),e()],h;for(o||i(s,32),Kt(t,s,32),t[0]&=248,t[31]&=127,t[31]|=64,_e(f,t),Ve(r,f),h=0;h<32;h++)s[h+32]=r[h];return 0}var Be=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 Ze(r,s){var o,t,f,h;for(t=63;t>=32;--t){for(o=0,f=t-32,h=t-12;f<h;++f)s[f]+=o-16*s[t]*Be[f-(t-32)],o=Math.floor((s[f]+128)/256),s[f]-=o*256;s[f]+=o,s[t]=0;}for(o=0,f=0;f<32;f++)s[f]+=o-(s[31]>>4)*Be[f],o=s[f]>>8,s[f]&=255;for(f=0;f<32;f++)s[f]-=o*Be[f];for(t=0;t<32;t++)s[t+1]+=s[t]>>8,r[t]=s[t]&255;}function Qe(r){var s=new Float64Array(64),o;for(o=0;o<64;o++)s[o]=r[o];for(o=0;o<64;o++)r[o]=0;Ze(r,s);}function Nr(r,s,o,t){var f=new Uint8Array(64),h=new Uint8Array(64),d=new Uint8Array(64),m,A,U=new Float64Array(64),_=[e(),e(),e(),e()];Kt(f,t,32),f[0]&=248,f[31]&=127,f[31]|=64;var G=o+64;for(m=0;m<o;m++)r[64+m]=s[m];for(m=0;m<32;m++)r[32+m]=f[32+m];for(Kt(d,r.subarray(32),o+32),Qe(d),_e(_,d),Ve(r,_),m=32;m<64;m++)r[m]=t[m];for(Kt(h,r,o+64),Qe(h),m=0;m<64;m++)U[m]=0;for(m=0;m<32;m++)U[m]=d[m];for(m=0;m<32;m++)for(A=0;A<32;A++)U[m+A]+=h[m]*f[A];return Ze(r.subarray(32),U),G}function oi(r,s){var o=e(),t=e(),f=e(),h=e(),d=e(),m=e(),A=e();return Ct(r[2],g),He(r[1],s),At(f,r[1]),J(h,f,E),Mt(f,f,r[2]),Bt(h,r[2],h),At(d,h),At(m,d),J(A,m,d),J(o,A,f),J(o,o,h),Ir(o,o),J(o,o,f),J(o,o,h),J(o,o,h),J(r[0],o,h),At(t,r[0]),J(t,t,h),Br(t,f)&&J(r[0],r[0],nt),At(t,r[0]),J(t,t,h),Br(t,f)?-1:(Mr(r[0])===s[31]>>7&&Mt(r[0],u,r[0]),J(r[3],r[0],r[1]),0)}function Ge(r,s,o,t){var f,h=new Uint8Array(32),d=new Uint8Array(64),m=[e(),e(),e(),e()],A=[e(),e(),e(),e()];if(o<64||oi(A,t))return -1;for(f=0;f<o;f++)r[f]=s[f];for(f=0;f<32;f++)r[f+32]=t[f];if(Kt(d,r,o),Qe(d),We(m,A,d),_e(A,s.subarray(32)),Se(m,A),Ve(h,m),o-=64,kt(s,0,h,0)){for(f=0;f<o;f++)r[f]=0;return -1}for(f=0;f<o;f++)r[f]=s[f+64];return o}var Xe=32,Me=24,le=32,te=16,ue=32,Te=32,he=32,de=32,tr=32,jr=Me,si=le,fi=te,Rt=64,Yt=32,ee=64,er=32,rr=64;n.lowlevel={crypto_core_hsalsa20:It,crypto_stream_xor:ae,crypto_stream:Nt,crypto_stream_salsa20_xor:wt,crypto_stream_salsa20:_t,crypto_onetimeauth:ce,crypto_onetimeauth_verify:ft,crypto_verify_16:vt,crypto_verify_32:kt,crypto_secretbox:Ut,crypto_secretbox_open:Zt,crypto_scalarmult:Ee,crypto_scalarmult_base:Ce,crypto_box_beforenm:Ae,crypto_box_afternm:Ur,crypto_box:ni,crypto_box_open:ii,crypto_box_keypair:Lr,crypto_hash:Kt,crypto_sign:Nr,crypto_sign_keypair:Je,crypto_sign_open:Ge,crypto_secretbox_KEYBYTES:Xe,crypto_secretbox_NONCEBYTES:Me,crypto_secretbox_ZEROBYTES:le,crypto_secretbox_BOXZEROBYTES:te,crypto_scalarmult_BYTES:ue,crypto_scalarmult_SCALARBYTES:Te,crypto_box_PUBLICKEYBYTES:he,crypto_box_SECRETKEYBYTES:de,crypto_box_BEFORENMBYTES:tr,crypto_box_NONCEBYTES:jr,crypto_box_ZEROBYTES:si,crypto_box_BOXZEROBYTES:fi,crypto_sign_BYTES:Rt,crypto_sign_PUBLICKEYBYTES:Yt,crypto_sign_SECRETKEYBYTES:ee,crypto_sign_SEEDBYTES:er,crypto_hash_BYTES:rr,gf:e,D:E,L:Be,pack25519:Xt,unpack25519:He,M:J,A:Bt,S:At,Z:Mt,pow2523:Ir,add:Se,set25519:Ct,modL:Ze,scalarmult:We,scalarbase:_e};function Dr(r,s){if(r.length!==Xe)throw new Error("bad key size");if(s.length!==Me)throw new Error("bad nonce size")}function ai(r,s){if(r.length!==he)throw new Error("bad public key size");if(s.length!==de)throw new Error("bad secret key size")}function Et(){for(var r=0;r<arguments.length;r++)if(!(arguments[r]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function zr(r){for(var s=0;s<r.length;s++)r[s]=0;}n.randomBytes=function(r){var s=new Uint8Array(r);return i(s,r),s},n.secretbox=function(r,s,o){Et(r,s,o),Dr(o,s);for(var t=new Uint8Array(le+r.length),f=new Uint8Array(t.length),h=0;h<r.length;h++)t[h+le]=r[h];return Ut(f,t,t.length,s,o),f.subarray(te)},n.secretbox.open=function(r,s,o){Et(r,s,o),Dr(o,s);for(var t=new Uint8Array(te+r.length),f=new Uint8Array(t.length),h=0;h<r.length;h++)t[h+te]=r[h];return t.length<32||Zt(f,t,t.length,s,o)!==0?null:f.subarray(le)},n.secretbox.keyLength=Xe,n.secretbox.nonceLength=Me,n.secretbox.overheadLength=te,n.scalarMult=function(r,s){if(Et(r,s),r.length!==Te)throw new Error("bad n size");if(s.length!==ue)throw new Error("bad p size");var o=new Uint8Array(ue);return Ee(o,r,s),o},n.scalarMult.base=function(r){if(Et(r),r.length!==Te)throw new Error("bad n size");var s=new Uint8Array(ue);return Ce(s,r),s},n.scalarMult.scalarLength=Te,n.scalarMult.groupElementLength=ue,n.box=function(r,s,o,t){var f=n.box.before(o,t);return n.secretbox(r,s,f)},n.box.before=function(r,s){Et(r,s),ai(r,s);var o=new Uint8Array(tr);return Ae(o,r,s),o},n.box.after=n.secretbox,n.box.open=function(r,s,o,t){var f=n.box.before(o,t);return n.secretbox.open(r,s,f)},n.box.open.after=n.secretbox.open,n.box.keyPair=function(){var r=new Uint8Array(he),s=new Uint8Array(de);return Lr(r,s),{publicKey:r,secretKey:s}},n.box.keyPair.fromSecretKey=function(r){if(Et(r),r.length!==de)throw new Error("bad secret key size");var s=new Uint8Array(he);return Ce(s,r),{publicKey:s,secretKey:new Uint8Array(r)}},n.box.publicKeyLength=he,n.box.secretKeyLength=de,n.box.sharedKeyLength=tr,n.box.nonceLength=jr,n.box.overheadLength=n.secretbox.overheadLength,n.sign=function(r,s){if(Et(r,s),s.length!==ee)throw new Error("bad secret key size");var o=new Uint8Array(Rt+r.length);return Nr(o,r,r.length,s),o},n.sign.open=function(r,s){if(Et(r,s),s.length!==Yt)throw new Error("bad public key size");var o=new Uint8Array(r.length),t=Ge(o,r,r.length,s);if(t<0)return null;for(var f=new Uint8Array(t),h=0;h<f.length;h++)f[h]=o[h];return f},n.sign.detached=function(r,s){for(var o=n.sign(r,s),t=new Uint8Array(Rt),f=0;f<t.length;f++)t[f]=o[f];return t},n.sign.detached.verify=function(r,s,o){if(Et(r,s,o),s.length!==Rt)throw new Error("bad signature size");if(o.length!==Yt)throw new Error("bad public key size");var t=new Uint8Array(Rt+r.length),f=new Uint8Array(Rt+r.length),h;for(h=0;h<Rt;h++)t[h]=s[h];for(h=0;h<r.length;h++)t[h+Rt]=r[h];return Ge(f,t,t.length,o)>=0},n.sign.keyPair=function(){var r=new Uint8Array(Yt),s=new Uint8Array(ee);return Je(r,s),{publicKey:r,secretKey:s}},n.sign.keyPair.fromSecretKey=function(r){if(Et(r),r.length!==ee)throw new Error("bad secret key size");for(var s=new Uint8Array(Yt),o=0;o<s.length;o++)s[o]=r[32+o];return {publicKey:s,secretKey:new Uint8Array(r)}},n.sign.keyPair.fromSeed=function(r){if(Et(r),r.length!==er)throw new Error("bad seed size");for(var s=new Uint8Array(Yt),o=new Uint8Array(ee),t=0;t<32;t++)o[t]=r[t];return Je(s,o,true),{publicKey:s,secretKey:o}},n.sign.publicKeyLength=Yt,n.sign.secretKeyLength=ee,n.sign.seedLength=er,n.sign.signatureLength=Rt,n.hash=function(r){Et(r);var s=new Uint8Array(rr);return Kt(s,r,r.length),s},n.hash.hashLength=rr,n.verify=function(r,s){return Et(r,s),r.length===0||s.length===0||r.length!==s.length?false:mt(r,0,s,0,r.length)===0},n.setPRNG=function(r){i=r;},(function(){var r=typeof self<"u"?self.crypto||self.msCrypto:null;if(r&&r.getRandomValues){var s=65536;n.setPRNG(function(o,t){var f,h=new Uint8Array(t);for(f=0;f<t;f+=s)r.getRandomValues(h.subarray(f,f+Math.min(t-f,s)));for(f=0;f<t;f++)o[f]=h[f];zr(h);});}else typeof qr<"u"&&(r=Kr(),r&&r.randomBytes&&n.setPRNG(function(o,t){var f,h=r.randomBytes(t);for(f=0;f<t;f++)o[f]=h[f];zr(h);}));})();})(typeof Ie<"u"&&Ie.exports?Ie.exports:self.nacl=self.nacl||{});});var $r=et((Fr,Le)=>{(function(n,e){typeof Le<"u"&&Le.exports?Le.exports=e():(n.nacl||(n.nacl={}),n.nacl.util=e());})(Fr,function(){var n={};function e(i){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(i))throw new TypeError("invalid encoding")}return n.decodeUTF8=function(i){if(typeof i!="string")throw new TypeError("expected string");var a,c=unescape(encodeURIComponent(i)),u=new Uint8Array(c.length);for(a=0;a<c.length;a++)u[a]=c.charCodeAt(a);return u},n.encodeUTF8=function(i){var a,c=[];for(a=0;a<i.length;a++)c.push(String.fromCharCode(i[a]));return decodeURIComponent(escape(c.join("")))},typeof atob>"u"?typeof Buffer.from<"u"?(n.encodeBase64=function(i){return Buffer.from(i).toString("base64")},n.decodeBase64=function(i){return e(i),new Uint8Array(Array.prototype.slice.call(Buffer.from(i,"base64"),0))}):(n.encodeBase64=function(i){return new Buffer(i).toString("base64")},n.decodeBase64=function(i){return e(i),new Uint8Array(Array.prototype.slice.call(new Buffer(i,"base64"),0))}):(n.encodeBase64=function(i){var a,c=[],u=i.length;for(a=0;a<u;a++)c.push(String.fromCharCode(i[a]));return btoa(c.join(""))},n.decodeBase64=function(i){e(i);var a,c=atob(i),u=new Uint8Array(c.length);for(a=0;a<c.length;a++)u[a]=c.charCodeAt(a);return u}),n});});var Vr=et((_o,Hr)=>{Hr.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then};});var jt=et(Ft=>{var nr,gi=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];Ft.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};Ft.getSymbolTotalCodewords=function(e){return gi[e]};Ft.getBCHDigit=function(n){let e=0;for(;n!==0;)e++,n>>>=1;return e};Ft.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');nr=e;};Ft.isKanjiModeEnabled=function(){return typeof nr<"u"};Ft.toSJIS=function(e){return nr(e)};});var Ue=et(St=>{St.L={bit:1};St.M={bit:0};St.Q={bit:3};St.H={bit:2};function yi(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case "l":case "low":return St.L;case "m":case "medium":return St.M;case "q":case "quartile":return St.Q;case "h":case "high":return St.H;default:throw new Error("Unknown EC Level: "+n)}}St.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};St.from=function(e,i){if(St.isValid(e))return e;try{return yi(e)}catch{return i}};});var Zr=et((To,Jr)=>{function Wr(){this.buffer=[],this.length=0;}Wr.prototype={get:function(n){let e=Math.floor(n/8);return (this.buffer[e]>>>7-n%8&1)===1},put:function(n,e){for(let i=0;i<e;i++)this.putBit((n>>>e-i-1&1)===1);},getLengthInBits:function(){return this.length},putBit:function(n){let e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),n&&(this.buffer[e]|=128>>>this.length%8),this.length++;}};Jr.exports=Wr;});var Gr=et((Io,Qr)=>{function xe(n){if(!n||n<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=n,this.data=new Uint8Array(n*n),this.reservedBit=new Uint8Array(n*n);}xe.prototype.set=function(n,e,i,a){let c=n*this.size+e;this.data[c]=i,a&&(this.reservedBit[c]=true);};xe.prototype.get=function(n,e){return this.data[n*this.size+e]};xe.prototype.xor=function(n,e,i){this.data[n*this.size+e]^=i;};xe.prototype.isReserved=function(n,e){return this.reservedBit[n*this.size+e]};Qr.exports=xe;});var Xr=et(Re=>{var bi=jt().getSymbolSize;Re.getRowColCoords=function(e){if(e===1)return [];let i=Math.floor(e/7)+2,a=bi(e),c=a===145?26:Math.ceil((a-13)/(2*i-2))*2,u=[a-7];for(let g=1;g<i-1;g++)u[g]=u[g-1]-c;return u.push(6),u.reverse()};Re.getPositions=function(e){let i=[],a=Re.getRowColCoords(e),c=a.length;for(let u=0;u<c;u++)for(let g=0;g<c;g++)u===0&&g===0||u===0&&g===c-1||u===c-1&&g===0||i.push([a[u],a[g]]);return i};});var rn=et(en=>{var mi=jt().getSymbolSize,tn=7;en.getPositions=function(e){let i=mi(e);return [[0,0],[i-tn,0],[0,i-tn]]};});var nn=et(ot=>{ot.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var $t={N1:3,N2:3,N3:40,N4:10};ot.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};ot.from=function(e){return ot.isValid(e)?parseInt(e,10):void 0};ot.getPenaltyN1=function(e){let i=e.size,a=0,c=0,u=0,g=null,y=null;for(let E=0;E<i;E++){c=u=0,g=y=null;for(let z=0;z<i;z++){let q=e.get(E,z);q===g?c++:(c>=5&&(a+=$t.N1+(c-5)),g=q,c=1),q=e.get(z,E),q===y?u++:(u>=5&&(a+=$t.N1+(u-5)),y=q,u=1);}c>=5&&(a+=$t.N1+(c-5)),u>=5&&(a+=$t.N1+(u-5));}return a};ot.getPenaltyN2=function(e){let i=e.size,a=0;for(let c=0;c<i-1;c++)for(let u=0;u<i-1;u++){let g=e.get(c,u)+e.get(c,u+1)+e.get(c+1,u)+e.get(c+1,u+1);(g===4||g===0)&&a++;}return a*$t.N2};ot.getPenaltyN3=function(e){let i=e.size,a=0,c=0,u=0;for(let g=0;g<i;g++){c=u=0;for(let y=0;y<i;y++)c=c<<1&2047|e.get(g,y),y>=10&&(c===1488||c===93)&&a++,u=u<<1&2047|e.get(y,g),y>=10&&(u===1488||u===93)&&a++;}return a*$t.N3};ot.getPenaltyN4=function(e){let i=0,a=e.data.length;for(let u=0;u<a;u++)i+=e.data[u];return Math.abs(Math.ceil(i*100/a/5)-10)*$t.N4};function wi(n,e,i){switch(n){case ot.Patterns.PATTERN000:return (e+i)%2===0;case ot.Patterns.PATTERN001:return e%2===0;case ot.Patterns.PATTERN010:return i%3===0;case ot.Patterns.PATTERN011:return (e+i)%3===0;case ot.Patterns.PATTERN100:return (Math.floor(e/2)+Math.floor(i/3))%2===0;case ot.Patterns.PATTERN101:return e*i%2+e*i%3===0;case ot.Patterns.PATTERN110:return (e*i%2+e*i%3)%2===0;case ot.Patterns.PATTERN111:return (e*i%3+(e+i)%2)%2===0;default:throw new Error("bad maskPattern:"+n)}}ot.applyMask=function(e,i){let a=i.size;for(let c=0;c<a;c++)for(let u=0;u<a;u++)i.isReserved(u,c)||i.xor(u,c,wi(e,u,c));};ot.getBestMask=function(e,i){let a=Object.keys(ot.Patterns).length,c=0,u=1/0;for(let g=0;g<a;g++){i(g),ot.applyMask(g,e);let y=ot.getPenaltyN1(e)+ot.getPenaltyN2(e)+ot.getPenaltyN3(e)+ot.getPenaltyN4(e);ot.applyMask(g,e),y<u&&(u=y,c=g);}return c};});var or=et(ir=>{var Dt=Ue(),Pe=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],ke=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];ir.getBlocksCount=function(e,i){switch(i){case Dt.L:return Pe[(e-1)*4+0];case Dt.M:return Pe[(e-1)*4+1];case Dt.Q:return Pe[(e-1)*4+2];case Dt.H:return Pe[(e-1)*4+3];default:return}};ir.getTotalCodewordsCount=function(e,i){switch(i){case Dt.L:return ke[(e-1)*4+0];case Dt.M:return ke[(e-1)*4+1];case Dt.Q:return ke[(e-1)*4+2];case Dt.H:return ke[(e-1)*4+3];default:return}};});var on=et(je=>{var pe=new Uint8Array(512),Ne=new Uint8Array(256);(function(){let e=1;for(let i=0;i<255;i++)pe[i]=e,Ne[e]=i,e<<=1,e&256&&(e^=285);for(let i=255;i<512;i++)pe[i]=pe[i-255];})();je.log=function(e){if(e<1)throw new Error("log("+e+")");return Ne[e]};je.exp=function(e){return pe[e]};je.mul=function(e,i){return e===0||i===0?0:pe[Ne[e]+Ne[i]]};});var sn=et(ge=>{var sr=on();ge.mul=function(e,i){let a=new Uint8Array(e.length+i.length-1);for(let c=0;c<e.length;c++)for(let u=0;u<i.length;u++)a[c+u]^=sr.mul(e[c],i[u]);return a};ge.mod=function(e,i){let a=new Uint8Array(e);for(;a.length-i.length>=0;){let c=a[0];for(let g=0;g<i.length;g++)a[g]^=sr.mul(i[g],c);let u=0;for(;u<a.length&&a[u]===0;)u++;a=a.slice(u);}return a};ge.generateECPolynomial=function(e){let i=new Uint8Array([1]);for(let a=0;a<e;a++)i=ge.mul(i,new Uint8Array([1,sr.exp(a)]));return i};});var cn=et((jo,an)=>{var fn=sn();function fr(n){this.genPoly=void 0,this.degree=n,this.degree&&this.initialize(this.degree);}fr.prototype.initialize=function(e){this.degree=e,this.genPoly=fn.generateECPolynomial(this.degree);};fr.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");let i=new Uint8Array(e.length+this.degree);i.set(e);let a=fn.mod(i,this.genPoly),c=this.degree-a.length;if(c>0){let u=new Uint8Array(this.degree);return u.set(a,c),u}return a};an.exports=fr;});var ar=et(ln=>{ln.isValid=function(e){return !isNaN(e)&&e>=1&&e<=40};});var cr=et(Pt=>{var un="[0-9]+",vi="[A-Z $%*+\\-./:]+",ye="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";ye=ye.replace(/u/g,"\\u");var Ei="(?:(?![A-Z0-9 $%*+\\-./:]|"+ye+`)(?:.|[\r
2
- ]))+`;Pt.KANJI=new RegExp(ye,"g");Pt.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");Pt.BYTE=new RegExp(Ei,"g");Pt.NUMERIC=new RegExp(un,"g");Pt.ALPHANUMERIC=new RegExp(vi,"g");var Ci=new RegExp("^"+ye+"$"),Ai=new RegExp("^"+un+"$"),Si=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");Pt.testKanji=function(e){return Ci.test(e)};Pt.testNumeric=function(e){return Ai.test(e)};Pt.testAlphanumeric=function(e){return Si.test(e)};});var zt=et(ht=>{var _i=ar(),lr=cr();ht.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};ht.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};ht.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};ht.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};ht.MIXED={bit:-1};ht.getCharCountIndicator=function(e,i){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!_i.isValid(i))throw new Error("Invalid version: "+i);return i>=1&&i<10?e.ccBits[0]:i<27?e.ccBits[1]:e.ccBits[2]};ht.getBestModeForData=function(e){return lr.testNumeric(e)?ht.NUMERIC:lr.testAlphanumeric(e)?ht.ALPHANUMERIC:lr.testKanji(e)?ht.KANJI:ht.BYTE};ht.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};ht.isValid=function(e){return e&&e.bit&&e.ccBits};function Bi(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case "numeric":return ht.NUMERIC;case "alphanumeric":return ht.ALPHANUMERIC;case "kanji":return ht.KANJI;case "byte":return ht.BYTE;default:throw new Error("Unknown mode: "+n)}}ht.from=function(e,i){if(ht.isValid(e))return e;try{return Bi(e)}catch{return i}};});var gn=et(Ht=>{var De=jt(),Mi=or(),hn=Ue(),Ot=zt(),ur=ar(),xn=7973,dn=De.getBCHDigit(xn);function Ti(n,e,i){for(let a=1;a<=40;a++)if(e<=Ht.getCapacity(a,i,n))return a}function pn(n,e){return Ot.getCharCountIndicator(n,e)+4}function Ii(n,e){let i=0;return n.forEach(function(a){let c=pn(a.mode,e);i+=c+a.getBitsLength();}),i}function Li(n,e){for(let i=1;i<=40;i++)if(Ii(n,i)<=Ht.getCapacity(i,e,Ot.MIXED))return i}Ht.from=function(e,i){return ur.isValid(e)?parseInt(e,10):i};Ht.getCapacity=function(e,i,a){if(!ur.isValid(e))throw new Error("Invalid QR Code version");typeof a>"u"&&(a=Ot.BYTE);let c=De.getSymbolTotalCodewords(e),u=Mi.getTotalCodewordsCount(e,i),g=(c-u)*8;if(a===Ot.MIXED)return g;let y=g-pn(a,e);switch(a){case Ot.NUMERIC:return Math.floor(y/10*3);case Ot.ALPHANUMERIC:return Math.floor(y/11*2);case Ot.KANJI:return Math.floor(y/13);case Ot.BYTE:default:return Math.floor(y/8)}};Ht.getBestVersionForData=function(e,i){let a,c=hn.from(i,hn.M);if(Array.isArray(e)){if(e.length>1)return Li(e,c);if(e.length===0)return 1;a=e[0];}else a=e;return Ti(a.mode,a.getLength(),c)};Ht.getEncodedBits=function(e){if(!ur.isValid(e)||e<7)throw new Error("Invalid QR Code version");let i=e<<12;for(;De.getBCHDigit(i)-dn>=0;)i^=xn<<De.getBCHDigit(i)-dn;return e<<12|i};});var wn=et(mn=>{var hr=jt(),bn=1335,Ui=21522,yn=hr.getBCHDigit(bn);mn.getEncodedBits=function(e,i){let a=e.bit<<3|i,c=a<<10;for(;hr.getBCHDigit(c)-yn>=0;)c^=bn<<hr.getBCHDigit(c)-yn;return (a<<10|c)^Ui};});var En=et((Yo,vn)=>{var Ri=zt();function re(n){this.mode=Ri.NUMERIC,this.data=n.toString();}re.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};re.prototype.getLength=function(){return this.data.length};re.prototype.getBitsLength=function(){return re.getBitsLength(this.data.length)};re.prototype.write=function(e){let i,a,c;for(i=0;i+3<=this.data.length;i+=3)a=this.data.substr(i,3),c=parseInt(a,10),e.put(c,10);let u=this.data.length-i;u>0&&(a=this.data.substr(i),c=parseInt(a,10),e.put(c,u*3+1));};vn.exports=re;});var An=et((Fo,Cn)=>{var Pi=zt(),dr=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function ne(n){this.mode=Pi.ALPHANUMERIC,this.data=n;}ne.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};ne.prototype.getLength=function(){return this.data.length};ne.prototype.getBitsLength=function(){return ne.getBitsLength(this.data.length)};ne.prototype.write=function(e){let i;for(i=0;i+2<=this.data.length;i+=2){let a=dr.indexOf(this.data[i])*45;a+=dr.indexOf(this.data[i+1]),e.put(a,11);}this.data.length%2&&e.put(dr.indexOf(this.data[i]),6);};Cn.exports=ne;});var _n=et(($o,Sn)=>{var ki=zt();function ie(n){this.mode=ki.BYTE,typeof n=="string"?this.data=new TextEncoder().encode(n):this.data=new Uint8Array(n);}ie.getBitsLength=function(e){return e*8};ie.prototype.getLength=function(){return this.data.length};ie.prototype.getBitsLength=function(){return ie.getBitsLength(this.data.length)};ie.prototype.write=function(n){for(let e=0,i=this.data.length;e<i;e++)n.put(this.data[e],8);};Sn.exports=ie;});var Mn=et((Ho,Bn)=>{var Ni=zt(),ji=jt();function oe(n){this.mode=Ni.KANJI,this.data=n;}oe.getBitsLength=function(e){return e*13};oe.prototype.getLength=function(){return this.data.length};oe.prototype.getBitsLength=function(){return oe.getBitsLength(this.data.length)};oe.prototype.write=function(n){let e;for(e=0;e<this.data.length;e++){let i=ji.toSJIS(this.data[e]);if(i>=33088&&i<=40956)i-=33088;else if(i>=57408&&i<=60351)i-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+`
3
- Make sure your charset is UTF-8`);i=(i>>>8&255)*192+(i&255),n.put(i,13);}};Bn.exports=oe;});var Tn=et((Vo,xr)=>{var be={single_source_shortest_paths:function(n,e,i){var a={},c={};c[e]=0;var u=be.PriorityQueue.make();u.push(e,0);for(var g,y,E,z,q,st,nt,bt,mt;!u.empty();){g=u.pop(),y=g.value,z=g.cost,q=n[y]||{};for(E in q)q.hasOwnProperty(E)&&(st=q[E],nt=z+st,bt=c[E],mt=typeof c[E]>"u",(mt||bt>nt)&&(c[E]=nt,u.push(E,nt),a[E]=y));}if(typeof i<"u"&&typeof c[i]>"u"){var vt=["Could not find a path from ",e," to ",i,"."].join("");throw new Error(vt)}return a},extract_shortest_path_from_predecessor_list:function(n,e){for(var i=[],a=e,c;a;)i.push(a),c=n[a],a=n[a];return i.reverse(),i},find_path:function(n,e,i){var a=be.single_source_shortest_paths(n,e,i);return be.extract_shortest_path_from_predecessor_list(a,i)},PriorityQueue:{make:function(n){var e=be.PriorityQueue,i={},a;n=n||{};for(a in e)e.hasOwnProperty(a)&&(i[a]=e[a]);return i.queue=[],i.sorter=n.sorter||e.default_sorter,i},default_sorter:function(n,e){return n.cost-e.cost},push:function(n,e){var i={value:n,cost:e};this.queue.push(i),this.queue.sort(this.sorter);},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof xr<"u"&&(xr.exports=be);});var jn=et(se=>{var rt=zt(),Un=En(),Rn=An(),Pn=_n(),kn=Mn(),me=cr(),ze=jt(),Di=Tn();function In(n){return unescape(encodeURIComponent(n)).length}function we(n,e,i){let a=[],c;for(;(c=n.exec(i))!==null;)a.push({data:c[0],index:c.index,mode:e,length:c[0].length});return a}function Nn(n){let e=we(me.NUMERIC,rt.NUMERIC,n),i=we(me.ALPHANUMERIC,rt.ALPHANUMERIC,n),a,c;return ze.isKanjiModeEnabled()?(a=we(me.BYTE,rt.BYTE,n),c=we(me.KANJI,rt.KANJI,n)):(a=we(me.BYTE_KANJI,rt.BYTE,n),c=[]),e.concat(i,a,c).sort(function(g,y){return g.index-y.index}).map(function(g){return {data:g.data,mode:g.mode,length:g.length}})}function pr(n,e){switch(e){case rt.NUMERIC:return Un.getBitsLength(n);case rt.ALPHANUMERIC:return Rn.getBitsLength(n);case rt.KANJI:return kn.getBitsLength(n);case rt.BYTE:return Pn.getBitsLength(n)}}function zi(n){return n.reduce(function(e,i){let a=e.length-1>=0?e[e.length-1]:null;return a&&a.mode===i.mode?(e[e.length-1].data+=i.data,e):(e.push(i),e)},[])}function Oi(n){let e=[];for(let i=0;i<n.length;i++){let a=n[i];switch(a.mode){case rt.NUMERIC:e.push([a,{data:a.data,mode:rt.ALPHANUMERIC,length:a.length},{data:a.data,mode:rt.BYTE,length:a.length}]);break;case rt.ALPHANUMERIC:e.push([a,{data:a.data,mode:rt.BYTE,length:a.length}]);break;case rt.KANJI:e.push([a,{data:a.data,mode:rt.BYTE,length:In(a.data)}]);break;case rt.BYTE:e.push([{data:a.data,mode:rt.BYTE,length:In(a.data)}]);}}return e}function qi(n,e){let i={},a={start:{}},c=["start"];for(let u=0;u<n.length;u++){let g=n[u],y=[];for(let E=0;E<g.length;E++){let z=g[E],q=""+u+E;y.push(q),i[q]={node:z,lastCount:0},a[q]={};for(let st=0;st<c.length;st++){let nt=c[st];i[nt]&&i[nt].node.mode===z.mode?(a[nt][q]=pr(i[nt].lastCount+z.length,z.mode)-pr(i[nt].lastCount,z.mode),i[nt].lastCount+=z.length):(i[nt]&&(i[nt].lastCount=z.length),a[nt][q]=pr(z.length,z.mode)+4+rt.getCharCountIndicator(z.mode,e));}}c=y;}for(let u=0;u<c.length;u++)a[c[u]].end=0;return {map:a,table:i}}function Ln(n,e){let i,a=rt.getBestModeForData(n);if(i=rt.from(e,a),i!==rt.BYTE&&i.bit<a.bit)throw new Error('"'+n+'" cannot be encoded with mode '+rt.toString(i)+`.
4
- Suggested mode is: `+rt.toString(a));switch(i===rt.KANJI&&!ze.isKanjiModeEnabled()&&(i=rt.BYTE),i){case rt.NUMERIC:return new Un(n);case rt.ALPHANUMERIC:return new Rn(n);case rt.KANJI:return new kn(n);case rt.BYTE:return new Pn(n)}}se.fromArray=function(e){return e.reduce(function(i,a){return typeof a=="string"?i.push(Ln(a,null)):a.data&&i.push(Ln(a.data,a.mode)),i},[])};se.fromString=function(e,i){let a=Nn(e,ze.isKanjiModeEnabled()),c=Oi(a),u=qi(c,i),g=Di.find_path(u.map,"start","end"),y=[];for(let E=1;E<g.length-1;E++)y.push(u.table[g[E]].node);return se.fromArray(zi(y))};se.rawSplit=function(e){return se.fromArray(Nn(e,ze.isKanjiModeEnabled()))};});var zn=et(Dn=>{var qe=jt(),gr=Ue(),Ki=Zr(),Yi=Gr(),Fi=Xr(),$i=rn(),mr=nn(),wr=or(),Hi=cn(),Oe=gn(),Vi=wn(),Wi=zt(),yr=jn();function Ji(n,e){let i=n.size,a=$i.getPositions(e);for(let c=0;c<a.length;c++){let u=a[c][0],g=a[c][1];for(let y=-1;y<=7;y++)if(!(u+y<=-1||i<=u+y))for(let E=-1;E<=7;E++)g+E<=-1||i<=g+E||(y>=0&&y<=6&&(E===0||E===6)||E>=0&&E<=6&&(y===0||y===6)||y>=2&&y<=4&&E>=2&&E<=4?n.set(u+y,g+E,true,true):n.set(u+y,g+E,false,true));}}function Zi(n){let e=n.size;for(let i=8;i<e-8;i++){let a=i%2===0;n.set(i,6,a,true),n.set(6,i,a,true);}}function Qi(n,e){let i=Fi.getPositions(e);for(let a=0;a<i.length;a++){let c=i[a][0],u=i[a][1];for(let g=-2;g<=2;g++)for(let y=-2;y<=2;y++)g===-2||g===2||y===-2||y===2||g===0&&y===0?n.set(c+g,u+y,true,true):n.set(c+g,u+y,false,true);}}function Gi(n,e){let i=n.size,a=Oe.getEncodedBits(e),c,u,g;for(let y=0;y<18;y++)c=Math.floor(y/3),u=y%3+i-8-3,g=(a>>y&1)===1,n.set(c,u,g,true),n.set(u,c,g,true);}function br(n,e,i){let a=n.size,c=Vi.getEncodedBits(e,i),u,g;for(u=0;u<15;u++)g=(c>>u&1)===1,u<6?n.set(u,8,g,true):u<8?n.set(u+1,8,g,true):n.set(a-15+u,8,g,true),u<8?n.set(8,a-u-1,g,true):u<9?n.set(8,15-u-1+1,g,true):n.set(8,15-u-1,g,true);n.set(a-8,8,1,true);}function Xi(n,e){let i=n.size,a=-1,c=i-1,u=7,g=0;for(let y=i-1;y>0;y-=2)for(y===6&&y--;;){for(let E=0;E<2;E++)if(!n.isReserved(c,y-E)){let z=false;g<e.length&&(z=(e[g]>>>u&1)===1),n.set(c,y-E,z),u--,u===-1&&(g++,u=7);}if(c+=a,c<0||i<=c){c-=a,a=-a;break}}}function to(n,e,i){let a=new Ki;i.forEach(function(E){a.put(E.mode.bit,4),a.put(E.getLength(),Wi.getCharCountIndicator(E.mode,n)),E.write(a);});let c=qe.getSymbolTotalCodewords(n),u=wr.getTotalCodewordsCount(n,e),g=(c-u)*8;for(a.getLengthInBits()+4<=g&&a.put(0,4);a.getLengthInBits()%8!==0;)a.putBit(0);let y=(g-a.getLengthInBits())/8;for(let E=0;E<y;E++)a.put(E%2?17:236,8);return eo(a,n,e)}function eo(n,e,i){let a=qe.getSymbolTotalCodewords(e),c=wr.getTotalCodewordsCount(e,i),u=a-c,g=wr.getBlocksCount(e,i),y=a%g,E=g-y,z=Math.floor(a/g),q=Math.floor(u/g),st=q+1,nt=z-q,bt=new Hi(nt),mt=0,vt=new Array(g),kt=new Array(g),qt=0,fe=new Uint8Array(n.buffer);for(let _t=0;_t<g;_t++){let Nt=_t<E?q:st;vt[_t]=fe.slice(mt,mt+Nt),kt[_t]=bt.encode(vt[_t]),mt+=Nt,qt=Math.max(qt,Nt);}let Tt=new Uint8Array(a),It=0,dt,wt;for(dt=0;dt<qt;dt++)for(wt=0;wt<g;wt++)dt<vt[wt].length&&(Tt[It++]=vt[wt][dt]);for(dt=0;dt<nt;dt++)for(wt=0;wt<g;wt++)Tt[It++]=kt[wt][dt];return Tt}function ro(n,e,i,a){let c;if(Array.isArray(n))c=yr.fromArray(n);else if(typeof n=="string"){let z=e;if(!z){let q=yr.rawSplit(n);z=Oe.getBestVersionForData(q,i);}c=yr.fromString(n,z||40);}else throw new Error("Invalid data");let u=Oe.getBestVersionForData(c,i);if(!u)throw new Error("The amount of data is too big to be stored in a QR Code");if(!e)e=u;else if(e<u)throw new Error(`
1
+ var Pelican=(function(exports){'use strict';var ci=Object.create;var Or=Object.defineProperty;var li=Object.getOwnPropertyDescriptor;var ui=Object.getOwnPropertyNames;var hi=Object.getPrototypeOf,di=Object.prototype.hasOwnProperty;var qr=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,i)=>(typeof require<"u"?require:e)[i]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var et=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var xi=(n,e,i,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of ui(e))!di.call(n,c)&&c!==i&&Or(n,c,{get:()=>e[c],enumerable:!(a=li(e,c))||a.enumerable});return n};var pi=(n,e,i)=>(i=n!=null?ci(hi(n)):{},xi(!n||!n.__esModule?Or(i,"default",{value:n,enumerable:true}):i,n));var Yr=et(()=>{});var Kr=et((Ao,Ie)=>{(function(n){var e=function(r){var s,o=new Float64Array(16);if(r)for(s=0;s<r.length;s++)o[s]=r[s];return o},i=function(){throw new Error("no PRNG")},a=new Uint8Array(16),c=new Uint8Array(32);c[0]=9;var u=e(),p=e([1]),y=e([56129,1]),E=e([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),z=e([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),q=e([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),st=e([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),nt=e([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function bt(r,s,o,t){r[s]=o>>24&255,r[s+1]=o>>16&255,r[s+2]=o>>8&255,r[s+3]=o&255,r[s+4]=t>>24&255,r[s+5]=t>>16&255,r[s+6]=t>>8&255,r[s+7]=t&255;}function mt(r,s,o,t,f){var h,d=0;for(h=0;h<f;h++)d|=r[s+h]^o[t+h];return (1&d-1>>>8)-1}function vt(r,s,o,t){return mt(r,s,o,t,16)}function kt(r,s,o,t){return mt(r,s,o,t,32)}function qt(r,s,o,t){for(var f=t[0]&255|(t[1]&255)<<8|(t[2]&255)<<16|(t[3]&255)<<24,h=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,m=o[8]&255|(o[9]&255)<<8|(o[10]&255)<<16|(o[11]&255)<<24,A=o[12]&255|(o[13]&255)<<8|(o[14]&255)<<16|(o[15]&255)<<24,U=t[4]&255|(t[5]&255)<<8|(t[6]&255)<<16|(t[7]&255)<<24,_=s[0]&255|(s[1]&255)<<8|(s[2]&255)<<16|(s[3]&255)<<24,G=s[4]&255|(s[5]&255)<<8|(s[6]&255)<<16|(s[7]&255)<<24,M=s[8]&255|(s[9]&255)<<8|(s[10]&255)<<16|(s[11]&255)<<24,k=s[12]&255|(s[13]&255)<<8|(s[14]&255)<<16|(s[15]&255)<<24,N=t[8]&255|(t[9]&255)<<8|(t[10]&255)<<16|(t[11]&255)<<24,K=o[16]&255|(o[17]&255)<<8|(o[18]&255)<<16|(o[19]&255)<<24,Y=o[20]&255|(o[21]&255)<<8|(o[22]&255)<<16|(o[23]&255)<<24,D=o[24]&255|(o[25]&255)<<8|(o[26]&255)<<16|(o[27]&255)<<24,O=o[28]&255|(o[29]&255)<<8|(o[30]&255)<<16|(o[31]&255)<<24,j=t[12]&255|(t[13]&255)<<8|(t[14]&255)<<16|(t[15]&255)<<24,T=f,R=h,B=d,I=m,L=A,S=U,x=_,g=G,v=M,b=k,w=N,C=K,P=Y,F=D,H=O,$=j,l,W=0;W<20;W+=2)l=T+P|0,L^=l<<7|l>>>25,l=L+T|0,v^=l<<9|l>>>23,l=v+L|0,P^=l<<13|l>>>19,l=P+v|0,T^=l<<18|l>>>14,l=S+R|0,b^=l<<7|l>>>25,l=b+S|0,F^=l<<9|l>>>23,l=F+b|0,R^=l<<13|l>>>19,l=R+F|0,S^=l<<18|l>>>14,l=w+x|0,H^=l<<7|l>>>25,l=H+w|0,B^=l<<9|l>>>23,l=B+H|0,x^=l<<13|l>>>19,l=x+B|0,w^=l<<18|l>>>14,l=$+C|0,I^=l<<7|l>>>25,l=I+$|0,g^=l<<9|l>>>23,l=g+I|0,C^=l<<13|l>>>19,l=C+g|0,$^=l<<18|l>>>14,l=T+I|0,R^=l<<7|l>>>25,l=R+T|0,B^=l<<9|l>>>23,l=B+R|0,I^=l<<13|l>>>19,l=I+B|0,T^=l<<18|l>>>14,l=S+L|0,x^=l<<7|l>>>25,l=x+S|0,g^=l<<9|l>>>23,l=g+x|0,L^=l<<13|l>>>19,l=L+g|0,S^=l<<18|l>>>14,l=w+b|0,C^=l<<7|l>>>25,l=C+w|0,v^=l<<9|l>>>23,l=v+C|0,b^=l<<13|l>>>19,l=b+v|0,w^=l<<18|l>>>14,l=$+H|0,P^=l<<7|l>>>25,l=P+$|0,F^=l<<9|l>>>23,l=F+P|0,H^=l<<13|l>>>19,l=H+F|0,$^=l<<18|l>>>14;T=T+f|0,R=R+h|0,B=B+d|0,I=I+m|0,L=L+A|0,S=S+U|0,x=x+_|0,g=g+G|0,v=v+M|0,b=b+k|0,w=w+N|0,C=C+K|0,P=P+Y|0,F=F+D|0,H=H+O|0,$=$+j|0,r[0]=T>>>0&255,r[1]=T>>>8&255,r[2]=T>>>16&255,r[3]=T>>>24&255,r[4]=R>>>0&255,r[5]=R>>>8&255,r[6]=R>>>16&255,r[7]=R>>>24&255,r[8]=B>>>0&255,r[9]=B>>>8&255,r[10]=B>>>16&255,r[11]=B>>>24&255,r[12]=I>>>0&255,r[13]=I>>>8&255,r[14]=I>>>16&255,r[15]=I>>>24&255,r[16]=L>>>0&255,r[17]=L>>>8&255,r[18]=L>>>16&255,r[19]=L>>>24&255,r[20]=S>>>0&255,r[21]=S>>>8&255,r[22]=S>>>16&255,r[23]=S>>>24&255,r[24]=x>>>0&255,r[25]=x>>>8&255,r[26]=x>>>16&255,r[27]=x>>>24&255,r[28]=g>>>0&255,r[29]=g>>>8&255,r[30]=g>>>16&255,r[31]=g>>>24&255,r[32]=v>>>0&255,r[33]=v>>>8&255,r[34]=v>>>16&255,r[35]=v>>>24&255,r[36]=b>>>0&255,r[37]=b>>>8&255,r[38]=b>>>16&255,r[39]=b>>>24&255,r[40]=w>>>0&255,r[41]=w>>>8&255,r[42]=w>>>16&255,r[43]=w>>>24&255,r[44]=C>>>0&255,r[45]=C>>>8&255,r[46]=C>>>16&255,r[47]=C>>>24&255,r[48]=P>>>0&255,r[49]=P>>>8&255,r[50]=P>>>16&255,r[51]=P>>>24&255,r[52]=F>>>0&255,r[53]=F>>>8&255,r[54]=F>>>16&255,r[55]=F>>>24&255,r[56]=H>>>0&255,r[57]=H>>>8&255,r[58]=H>>>16&255,r[59]=H>>>24&255,r[60]=$>>>0&255,r[61]=$>>>8&255,r[62]=$>>>16&255,r[63]=$>>>24&255;}function fe(r,s,o,t){for(var f=t[0]&255|(t[1]&255)<<8|(t[2]&255)<<16|(t[3]&255)<<24,h=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,m=o[8]&255|(o[9]&255)<<8|(o[10]&255)<<16|(o[11]&255)<<24,A=o[12]&255|(o[13]&255)<<8|(o[14]&255)<<16|(o[15]&255)<<24,U=t[4]&255|(t[5]&255)<<8|(t[6]&255)<<16|(t[7]&255)<<24,_=s[0]&255|(s[1]&255)<<8|(s[2]&255)<<16|(s[3]&255)<<24,G=s[4]&255|(s[5]&255)<<8|(s[6]&255)<<16|(s[7]&255)<<24,M=s[8]&255|(s[9]&255)<<8|(s[10]&255)<<16|(s[11]&255)<<24,k=s[12]&255|(s[13]&255)<<8|(s[14]&255)<<16|(s[15]&255)<<24,N=t[8]&255|(t[9]&255)<<8|(t[10]&255)<<16|(t[11]&255)<<24,K=o[16]&255|(o[17]&255)<<8|(o[18]&255)<<16|(o[19]&255)<<24,Y=o[20]&255|(o[21]&255)<<8|(o[22]&255)<<16|(o[23]&255)<<24,D=o[24]&255|(o[25]&255)<<8|(o[26]&255)<<16|(o[27]&255)<<24,O=o[28]&255|(o[29]&255)<<8|(o[30]&255)<<16|(o[31]&255)<<24,j=t[12]&255|(t[13]&255)<<8|(t[14]&255)<<16|(t[15]&255)<<24,T=f,R=h,B=d,I=m,L=A,S=U,x=_,g=G,v=M,b=k,w=N,C=K,P=Y,F=D,H=O,$=j,l,W=0;W<20;W+=2)l=T+P|0,L^=l<<7|l>>>25,l=L+T|0,v^=l<<9|l>>>23,l=v+L|0,P^=l<<13|l>>>19,l=P+v|0,T^=l<<18|l>>>14,l=S+R|0,b^=l<<7|l>>>25,l=b+S|0,F^=l<<9|l>>>23,l=F+b|0,R^=l<<13|l>>>19,l=R+F|0,S^=l<<18|l>>>14,l=w+x|0,H^=l<<7|l>>>25,l=H+w|0,B^=l<<9|l>>>23,l=B+H|0,x^=l<<13|l>>>19,l=x+B|0,w^=l<<18|l>>>14,l=$+C|0,I^=l<<7|l>>>25,l=I+$|0,g^=l<<9|l>>>23,l=g+I|0,C^=l<<13|l>>>19,l=C+g|0,$^=l<<18|l>>>14,l=T+I|0,R^=l<<7|l>>>25,l=R+T|0,B^=l<<9|l>>>23,l=B+R|0,I^=l<<13|l>>>19,l=I+B|0,T^=l<<18|l>>>14,l=S+L|0,x^=l<<7|l>>>25,l=x+S|0,g^=l<<9|l>>>23,l=g+x|0,L^=l<<13|l>>>19,l=L+g|0,S^=l<<18|l>>>14,l=w+b|0,C^=l<<7|l>>>25,l=C+w|0,v^=l<<9|l>>>23,l=v+C|0,b^=l<<13|l>>>19,l=b+v|0,w^=l<<18|l>>>14,l=$+H|0,P^=l<<7|l>>>25,l=P+$|0,F^=l<<9|l>>>23,l=F+P|0,H^=l<<13|l>>>19,l=H+F|0,$^=l<<18|l>>>14;r[0]=T>>>0&255,r[1]=T>>>8&255,r[2]=T>>>16&255,r[3]=T>>>24&255,r[4]=S>>>0&255,r[5]=S>>>8&255,r[6]=S>>>16&255,r[7]=S>>>24&255,r[8]=w>>>0&255,r[9]=w>>>8&255,r[10]=w>>>16&255,r[11]=w>>>24&255,r[12]=$>>>0&255,r[13]=$>>>8&255,r[14]=$>>>16&255,r[15]=$>>>24&255,r[16]=x>>>0&255,r[17]=x>>>8&255,r[18]=x>>>16&255,r[19]=x>>>24&255,r[20]=g>>>0&255,r[21]=g>>>8&255,r[22]=g>>>16&255,r[23]=g>>>24&255,r[24]=v>>>0&255,r[25]=v>>>8&255,r[26]=v>>>16&255,r[27]=v>>>24&255,r[28]=b>>>0&255,r[29]=b>>>8&255,r[30]=b>>>16&255,r[31]=b>>>24&255;}function Tt(r,s,o,t){qt(r,s,o,t);}function It(r,s,o,t){fe(r,s,o,t);}var dt=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function wt(r,s,o,t,f,h,d){var m=new Uint8Array(16),A=new Uint8Array(64),U,_;for(_=0;_<16;_++)m[_]=0;for(_=0;_<8;_++)m[_]=h[_];for(;f>=64;){for(Tt(A,m,d,dt),_=0;_<64;_++)r[s+_]=o[t+_]^A[_];for(U=1,_=8;_<16;_++)U=U+(m[_]&255)|0,m[_]=U&255,U>>>=8;f-=64,s+=64,t+=64;}if(f>0)for(Tt(A,m,d,dt),_=0;_<f;_++)r[s+_]=o[t+_]^A[_];return 0}function _t(r,s,o,t,f){var h=new Uint8Array(16),d=new Uint8Array(64),m,A;for(A=0;A<16;A++)h[A]=0;for(A=0;A<8;A++)h[A]=t[A];for(;o>=64;){for(Tt(d,h,f,dt),A=0;A<64;A++)r[s+A]=d[A];for(m=1,A=8;A<16;A++)m=m+(h[A]&255)|0,h[A]=m&255,m>>>=8;o-=64,s+=64;}if(o>0)for(Tt(d,h,f,dt),A=0;A<o;A++)r[s+A]=d[A];return 0}function Nt(r,s,o,t,f){var h=new Uint8Array(32);It(h,t,f,dt);for(var d=new Uint8Array(8),m=0;m<8;m++)d[m]=t[m+16];return _t(r,s,o,d,h)}function ae(r,s,o,t,f,h,d){var m=new Uint8Array(32);It(m,h,d,dt);for(var A=new Uint8Array(8),U=0;U<8;U++)A[U]=h[U+16];return wt(r,s,o,t,f,A,m)}var Jt=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 s,o,t,f,h,d,m,A;s=r[0]&255|(r[1]&255)<<8,this.r[0]=s&8191,o=r[2]&255|(r[3]&255)<<8,this.r[1]=(s>>>13|o<<3)&8191,t=r[4]&255|(r[5]&255)<<8,this.r[2]=(o>>>10|t<<6)&7939,f=r[6]&255|(r[7]&255)<<8,this.r[3]=(t>>>7|f<<9)&8191,h=r[8]&255|(r[9]&255)<<8,this.r[4]=(f>>>4|h<<12)&255,this.r[5]=h>>>1&8190,d=r[10]&255|(r[11]&255)<<8,this.r[6]=(h>>>14|d<<2)&8191,m=r[12]&255|(r[13]&255)<<8,this.r[7]=(d>>>11|m<<5)&8065,A=r[14]&255|(r[15]&255)<<8,this.r[8]=(m>>>8|A<<8)&8191,this.r[9]=A>>>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;};Jt.prototype.blocks=function(r,s,o){for(var t=this.fin?0:2048,f,h,d,m,A,U,_,G,M,k,N,K,Y,D,O,j,T,R,B,I=this.h[0],L=this.h[1],S=this.h[2],x=this.h[3],g=this.h[4],v=this.h[5],b=this.h[6],w=this.h[7],C=this.h[8],P=this.h[9],F=this.r[0],H=this.r[1],$=this.r[2],l=this.r[3],W=this.r[4],X=this.r[5],tt=this.r[6],V=this.r[7],Z=this.r[8],Q=this.r[9];o>=16;)f=r[s+0]&255|(r[s+1]&255)<<8,I+=f&8191,h=r[s+2]&255|(r[s+3]&255)<<8,L+=(f>>>13|h<<3)&8191,d=r[s+4]&255|(r[s+5]&255)<<8,S+=(h>>>10|d<<6)&8191,m=r[s+6]&255|(r[s+7]&255)<<8,x+=(d>>>7|m<<9)&8191,A=r[s+8]&255|(r[s+9]&255)<<8,g+=(m>>>4|A<<12)&8191,v+=A>>>1&8191,U=r[s+10]&255|(r[s+11]&255)<<8,b+=(A>>>14|U<<2)&8191,_=r[s+12]&255|(r[s+13]&255)<<8,w+=(U>>>11|_<<5)&8191,G=r[s+14]&255|(r[s+15]&255)<<8,C+=(_>>>8|G<<8)&8191,P+=G>>>5|t,M=0,k=M,k+=I*F,k+=L*(5*Q),k+=S*(5*Z),k+=x*(5*V),k+=g*(5*tt),M=k>>>13,k&=8191,k+=v*(5*X),k+=b*(5*W),k+=w*(5*l),k+=C*(5*$),k+=P*(5*H),M+=k>>>13,k&=8191,N=M,N+=I*H,N+=L*F,N+=S*(5*Q),N+=x*(5*Z),N+=g*(5*V),M=N>>>13,N&=8191,N+=v*(5*tt),N+=b*(5*X),N+=w*(5*W),N+=C*(5*l),N+=P*(5*$),M+=N>>>13,N&=8191,K=M,K+=I*$,K+=L*H,K+=S*F,K+=x*(5*Q),K+=g*(5*Z),M=K>>>13,K&=8191,K+=v*(5*V),K+=b*(5*tt),K+=w*(5*X),K+=C*(5*W),K+=P*(5*l),M+=K>>>13,K&=8191,Y=M,Y+=I*l,Y+=L*$,Y+=S*H,Y+=x*F,Y+=g*(5*Q),M=Y>>>13,Y&=8191,Y+=v*(5*Z),Y+=b*(5*V),Y+=w*(5*tt),Y+=C*(5*X),Y+=P*(5*W),M+=Y>>>13,Y&=8191,D=M,D+=I*W,D+=L*l,D+=S*$,D+=x*H,D+=g*F,M=D>>>13,D&=8191,D+=v*(5*Q),D+=b*(5*Z),D+=w*(5*V),D+=C*(5*tt),D+=P*(5*X),M+=D>>>13,D&=8191,O=M,O+=I*X,O+=L*W,O+=S*l,O+=x*$,O+=g*H,M=O>>>13,O&=8191,O+=v*F,O+=b*(5*Q),O+=w*(5*Z),O+=C*(5*V),O+=P*(5*tt),M+=O>>>13,O&=8191,j=M,j+=I*tt,j+=L*X,j+=S*W,j+=x*l,j+=g*$,M=j>>>13,j&=8191,j+=v*H,j+=b*F,j+=w*(5*Q),j+=C*(5*Z),j+=P*(5*V),M+=j>>>13,j&=8191,T=M,T+=I*V,T+=L*tt,T+=S*X,T+=x*W,T+=g*l,M=T>>>13,T&=8191,T+=v*$,T+=b*H,T+=w*F,T+=C*(5*Q),T+=P*(5*Z),M+=T>>>13,T&=8191,R=M,R+=I*Z,R+=L*V,R+=S*tt,R+=x*X,R+=g*W,M=R>>>13,R&=8191,R+=v*l,R+=b*$,R+=w*H,R+=C*F,R+=P*(5*Q),M+=R>>>13,R&=8191,B=M,B+=I*Q,B+=L*Z,B+=S*V,B+=x*tt,B+=g*X,M=B>>>13,B&=8191,B+=v*W,B+=b*l,B+=w*$,B+=C*H,B+=P*F,M+=B>>>13,B&=8191,M=(M<<2)+M|0,M=M+k|0,k=M&8191,M=M>>>13,N+=M,I=k,L=N,S=K,x=Y,g=D,v=O,b=j,w=T,C=R,P=B,s+=16,o-=16;this.h[0]=I,this.h[1]=L,this.h[2]=S,this.h[3]=x,this.h[4]=g,this.h[5]=v,this.h[6]=b,this.h[7]=w,this.h[8]=C,this.h[9]=P;},Jt.prototype.finish=function(r,s){var o=new Uint16Array(10),t,f,h,d;if(this.leftover){for(d=this.leftover,this.buffer[d++]=1;d<16;d++)this.buffer[d]=0;this.fin=1,this.blocks(this.buffer,0,16);}for(t=this.h[1]>>>13,this.h[1]&=8191,d=2;d<10;d++)this.h[d]+=t,t=this.h[d]>>>13,this.h[d]&=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,o[0]=this.h[0]+5,t=o[0]>>>13,o[0]&=8191,d=1;d<10;d++)o[d]=this.h[d]+t,t=o[d]>>>13,o[d]&=8191;for(o[9]-=8192,f=(t^1)-1,d=0;d<10;d++)o[d]&=f;for(f=~f,d=0;d<10;d++)this.h[d]=this.h[d]&f|o[d];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,h=this.h[0]+this.pad[0],this.h[0]=h&65535,d=1;d<8;d++)h=(this.h[d]+this.pad[d]|0)+(h>>>16)|0,this.h[d]=h&65535;r[s+0]=this.h[0]>>>0&255,r[s+1]=this.h[0]>>>8&255,r[s+2]=this.h[1]>>>0&255,r[s+3]=this.h[1]>>>8&255,r[s+4]=this.h[2]>>>0&255,r[s+5]=this.h[2]>>>8&255,r[s+6]=this.h[3]>>>0&255,r[s+7]=this.h[3]>>>8&255,r[s+8]=this.h[4]>>>0&255,r[s+9]=this.h[4]>>>8&255,r[s+10]=this.h[5]>>>0&255,r[s+11]=this.h[5]>>>8&255,r[s+12]=this.h[6]>>>0&255,r[s+13]=this.h[6]>>>8&255,r[s+14]=this.h[7]>>>0&255,r[s+15]=this.h[7]>>>8&255;},Jt.prototype.update=function(r,s,o){var t,f;if(this.leftover){for(f=16-this.leftover,f>o&&(f=o),t=0;t<f;t++)this.buffer[this.leftover+t]=r[s+t];if(o-=f,s+=f,this.leftover+=f,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0;}if(o>=16&&(f=o-o%16,this.blocks(r,s,f),s+=f,o-=f),o){for(t=0;t<o;t++)this.buffer[this.leftover+t]=r[s+t];this.leftover+=o;}};function ce(r,s,o,t,f,h){var d=new Jt(h);return d.update(o,t,f),d.finish(r,s),0}function ft(r,s,o,t,f,h){var d=new Uint8Array(16);return ce(d,0,o,t,f,h),vt(r,s,d,0)}function Ut(r,s,o,t,f){var h;if(o<32)return -1;for(ae(r,0,s,0,o,t,f),ce(r,16,r,32,o-32,r),h=0;h<16;h++)r[h]=0;return 0}function Zt(r,s,o,t,f){var h,d=new Uint8Array(32);if(o<32||(Nt(d,0,32,t,f),ft(s,16,s,32,o-32,d)!==0))return -1;for(ae(r,0,s,0,o,t,f),h=0;h<32;h++)r[h]=0;return 0}function Ct(r,s){var o;for(o=0;o<16;o++)r[o]=s[o]|0;}function Qt(r){var s,o,t=1;for(s=0;s<16;s++)o=r[s]+t+65535,t=Math.floor(o/65536),r[s]=o-t*65536;r[0]+=t-1+37*(t-1);}function Gt(r,s,o){for(var t,f=~(o-1),h=0;h<16;h++)t=f&(r[h]^s[h]),r[h]^=t,s[h]^=t;}function Xt(r,s){var o,t,f,h=e(),d=e();for(o=0;o<16;o++)d[o]=s[o];for(Qt(d),Qt(d),Qt(d),t=0;t<2;t++){for(h[0]=d[0]-65517,o=1;o<15;o++)h[o]=d[o]-65535-(h[o-1]>>16&1),h[o-1]&=65535;h[15]=d[15]-32767-(h[14]>>16&1),f=h[15]>>16&1,h[14]&=65535,Gt(d,h,1-f);}for(o=0;o<16;o++)r[2*o]=d[o]&255,r[2*o+1]=d[o]>>8;}function Br(r,s){var o=new Uint8Array(32),t=new Uint8Array(32);return Xt(o,r),Xt(t,s),kt(o,0,t,0)}function Mr(r){var s=new Uint8Array(32);return Xt(s,r),s[0]&1}function He(r,s){var o;for(o=0;o<16;o++)r[o]=s[2*o]+(s[2*o+1]<<8);r[15]&=32767;}function Bt(r,s,o){for(var t=0;t<16;t++)r[t]=s[t]+o[t];}function Mt(r,s,o){for(var t=0;t<16;t++)r[t]=s[t]-o[t];}function J(r,s,o){var t,f,h=0,d=0,m=0,A=0,U=0,_=0,G=0,M=0,k=0,N=0,K=0,Y=0,D=0,O=0,j=0,T=0,R=0,B=0,I=0,L=0,S=0,x=0,g=0,v=0,b=0,w=0,C=0,P=0,F=0,H=0,$=0,l=o[0],W=o[1],X=o[2],tt=o[3],V=o[4],Z=o[5],Q=o[6],ut=o[7],it=o[8],at=o[9],ct=o[10],lt=o[11],xt=o[12],pt=o[13],gt=o[14],yt=o[15];t=s[0],h+=t*l,d+=t*W,m+=t*X,A+=t*tt,U+=t*V,_+=t*Z,G+=t*Q,M+=t*ut,k+=t*it,N+=t*at,K+=t*ct,Y+=t*lt,D+=t*xt,O+=t*pt,j+=t*gt,T+=t*yt,t=s[1],d+=t*l,m+=t*W,A+=t*X,U+=t*tt,_+=t*V,G+=t*Z,M+=t*Q,k+=t*ut,N+=t*it,K+=t*at,Y+=t*ct,D+=t*lt,O+=t*xt,j+=t*pt,T+=t*gt,R+=t*yt,t=s[2],m+=t*l,A+=t*W,U+=t*X,_+=t*tt,G+=t*V,M+=t*Z,k+=t*Q,N+=t*ut,K+=t*it,Y+=t*at,D+=t*ct,O+=t*lt,j+=t*xt,T+=t*pt,R+=t*gt,B+=t*yt,t=s[3],A+=t*l,U+=t*W,_+=t*X,G+=t*tt,M+=t*V,k+=t*Z,N+=t*Q,K+=t*ut,Y+=t*it,D+=t*at,O+=t*ct,j+=t*lt,T+=t*xt,R+=t*pt,B+=t*gt,I+=t*yt,t=s[4],U+=t*l,_+=t*W,G+=t*X,M+=t*tt,k+=t*V,N+=t*Z,K+=t*Q,Y+=t*ut,D+=t*it,O+=t*at,j+=t*ct,T+=t*lt,R+=t*xt,B+=t*pt,I+=t*gt,L+=t*yt,t=s[5],_+=t*l,G+=t*W,M+=t*X,k+=t*tt,N+=t*V,K+=t*Z,Y+=t*Q,D+=t*ut,O+=t*it,j+=t*at,T+=t*ct,R+=t*lt,B+=t*xt,I+=t*pt,L+=t*gt,S+=t*yt,t=s[6],G+=t*l,M+=t*W,k+=t*X,N+=t*tt,K+=t*V,Y+=t*Z,D+=t*Q,O+=t*ut,j+=t*it,T+=t*at,R+=t*ct,B+=t*lt,I+=t*xt,L+=t*pt,S+=t*gt,x+=t*yt,t=s[7],M+=t*l,k+=t*W,N+=t*X,K+=t*tt,Y+=t*V,D+=t*Z,O+=t*Q,j+=t*ut,T+=t*it,R+=t*at,B+=t*ct,I+=t*lt,L+=t*xt,S+=t*pt,x+=t*gt,g+=t*yt,t=s[8],k+=t*l,N+=t*W,K+=t*X,Y+=t*tt,D+=t*V,O+=t*Z,j+=t*Q,T+=t*ut,R+=t*it,B+=t*at,I+=t*ct,L+=t*lt,S+=t*xt,x+=t*pt,g+=t*gt,v+=t*yt,t=s[9],N+=t*l,K+=t*W,Y+=t*X,D+=t*tt,O+=t*V,j+=t*Z,T+=t*Q,R+=t*ut,B+=t*it,I+=t*at,L+=t*ct,S+=t*lt,x+=t*xt,g+=t*pt,v+=t*gt,b+=t*yt,t=s[10],K+=t*l,Y+=t*W,D+=t*X,O+=t*tt,j+=t*V,T+=t*Z,R+=t*Q,B+=t*ut,I+=t*it,L+=t*at,S+=t*ct,x+=t*lt,g+=t*xt,v+=t*pt,b+=t*gt,w+=t*yt,t=s[11],Y+=t*l,D+=t*W,O+=t*X,j+=t*tt,T+=t*V,R+=t*Z,B+=t*Q,I+=t*ut,L+=t*it,S+=t*at,x+=t*ct,g+=t*lt,v+=t*xt,b+=t*pt,w+=t*gt,C+=t*yt,t=s[12],D+=t*l,O+=t*W,j+=t*X,T+=t*tt,R+=t*V,B+=t*Z,I+=t*Q,L+=t*ut,S+=t*it,x+=t*at,g+=t*ct,v+=t*lt,b+=t*xt,w+=t*pt,C+=t*gt,P+=t*yt,t=s[13],O+=t*l,j+=t*W,T+=t*X,R+=t*tt,B+=t*V,I+=t*Z,L+=t*Q,S+=t*ut,x+=t*it,g+=t*at,v+=t*ct,b+=t*lt,w+=t*xt,C+=t*pt,P+=t*gt,F+=t*yt,t=s[14],j+=t*l,T+=t*W,R+=t*X,B+=t*tt,I+=t*V,L+=t*Z,S+=t*Q,x+=t*ut,g+=t*it,v+=t*at,b+=t*ct,w+=t*lt,C+=t*xt,P+=t*pt,F+=t*gt,H+=t*yt,t=s[15],T+=t*l,R+=t*W,B+=t*X,I+=t*tt,L+=t*V,S+=t*Z,x+=t*Q,g+=t*ut,v+=t*it,b+=t*at,w+=t*ct,C+=t*lt,P+=t*xt,F+=t*pt,H+=t*gt,$+=t*yt,h+=38*R,d+=38*B,m+=38*I,A+=38*L,U+=38*S,_+=38*x,G+=38*g,M+=38*v,k+=38*b,N+=38*w,K+=38*C,Y+=38*P,D+=38*F,O+=38*H,j+=38*$,f=1,t=h+f+65535,f=Math.floor(t/65536),h=t-f*65536,t=d+f+65535,f=Math.floor(t/65536),d=t-f*65536,t=m+f+65535,f=Math.floor(t/65536),m=t-f*65536,t=A+f+65535,f=Math.floor(t/65536),A=t-f*65536,t=U+f+65535,f=Math.floor(t/65536),U=t-f*65536,t=_+f+65535,f=Math.floor(t/65536),_=t-f*65536,t=G+f+65535,f=Math.floor(t/65536),G=t-f*65536,t=M+f+65535,f=Math.floor(t/65536),M=t-f*65536,t=k+f+65535,f=Math.floor(t/65536),k=t-f*65536,t=N+f+65535,f=Math.floor(t/65536),N=t-f*65536,t=K+f+65535,f=Math.floor(t/65536),K=t-f*65536,t=Y+f+65535,f=Math.floor(t/65536),Y=t-f*65536,t=D+f+65535,f=Math.floor(t/65536),D=t-f*65536,t=O+f+65535,f=Math.floor(t/65536),O=t-f*65536,t=j+f+65535,f=Math.floor(t/65536),j=t-f*65536,t=T+f+65535,f=Math.floor(t/65536),T=t-f*65536,h+=f-1+37*(f-1),f=1,t=h+f+65535,f=Math.floor(t/65536),h=t-f*65536,t=d+f+65535,f=Math.floor(t/65536),d=t-f*65536,t=m+f+65535,f=Math.floor(t/65536),m=t-f*65536,t=A+f+65535,f=Math.floor(t/65536),A=t-f*65536,t=U+f+65535,f=Math.floor(t/65536),U=t-f*65536,t=_+f+65535,f=Math.floor(t/65536),_=t-f*65536,t=G+f+65535,f=Math.floor(t/65536),G=t-f*65536,t=M+f+65535,f=Math.floor(t/65536),M=t-f*65536,t=k+f+65535,f=Math.floor(t/65536),k=t-f*65536,t=N+f+65535,f=Math.floor(t/65536),N=t-f*65536,t=K+f+65535,f=Math.floor(t/65536),K=t-f*65536,t=Y+f+65535,f=Math.floor(t/65536),Y=t-f*65536,t=D+f+65535,f=Math.floor(t/65536),D=t-f*65536,t=O+f+65535,f=Math.floor(t/65536),O=t-f*65536,t=j+f+65535,f=Math.floor(t/65536),j=t-f*65536,t=T+f+65535,f=Math.floor(t/65536),T=t-f*65536,h+=f-1+37*(f-1),r[0]=h,r[1]=d,r[2]=m,r[3]=A,r[4]=U,r[5]=_,r[6]=G,r[7]=M,r[8]=k,r[9]=N,r[10]=K,r[11]=Y,r[12]=D,r[13]=O,r[14]=j,r[15]=T;}function At(r,s){J(r,s,s);}function Tr(r,s){var o=e(),t;for(t=0;t<16;t++)o[t]=s[t];for(t=253;t>=0;t--)At(o,o),t!==2&&t!==4&&J(o,o,s);for(t=0;t<16;t++)r[t]=o[t];}function Ir(r,s){var o=e(),t;for(t=0;t<16;t++)o[t]=s[t];for(t=250;t>=0;t--)At(o,o),t!==1&&J(o,o,s);for(t=0;t<16;t++)r[t]=o[t];}function Ee(r,s,o){var t=new Uint8Array(32),f=new Float64Array(80),h,d,m=e(),A=e(),U=e(),_=e(),G=e(),M=e();for(d=0;d<31;d++)t[d]=s[d];for(t[31]=s[31]&127|64,t[0]&=248,He(f,o),d=0;d<16;d++)A[d]=f[d],_[d]=m[d]=U[d]=0;for(m[0]=_[0]=1,d=254;d>=0;--d)h=t[d>>>3]>>>(d&7)&1,Gt(m,A,h),Gt(U,_,h),Bt(G,m,U),Mt(m,m,U),Bt(U,A,_),Mt(A,A,_),At(_,G),At(M,m),J(m,U,m),J(U,A,G),Bt(G,m,U),Mt(m,m,U),At(A,m),Mt(U,_,M),J(m,U,y),Bt(m,m,_),J(U,U,m),J(m,_,M),J(_,A,f),At(A,G),Gt(m,A,h),Gt(U,_,h);for(d=0;d<16;d++)f[d+16]=m[d],f[d+32]=U[d],f[d+48]=A[d],f[d+64]=_[d];var k=f.subarray(32),N=f.subarray(16);return Tr(k,k),J(N,N,k),Xt(r,N),0}function Ce(r,s){return Ee(r,s,c)}function Lr(r,s){return i(s,32),Ce(r,s)}function Ae(r,s,o){var t=new Uint8Array(32);return Ee(t,o,s),It(r,a,t,dt)}var Ur=Ut,ri=Zt;function ni(r,s,o,t,f,h){var d=new Uint8Array(32);return Ae(d,f,h),Ur(r,s,o,t,d)}function ii(r,s,o,t,f,h){var d=new Uint8Array(32);return Ae(d,f,h),ri(r,s,o,t,d)}var Rr=[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 Pr(r,s,o,t){for(var f=new Int32Array(16),h=new Int32Array(16),d,m,A,U,_,G,M,k,N,K,Y,D,O,j,T,R,B,I,L,S,x,g,v,b,w,C,P=r[0],F=r[1],H=r[2],$=r[3],l=r[4],W=r[5],X=r[6],tt=r[7],V=s[0],Z=s[1],Q=s[2],ut=s[3],it=s[4],at=s[5],ct=s[6],lt=s[7],xt=0;t>=128;){for(L=0;L<16;L++)S=8*L+xt,f[L]=o[S+0]<<24|o[S+1]<<16|o[S+2]<<8|o[S+3],h[L]=o[S+4]<<24|o[S+5]<<16|o[S+6]<<8|o[S+7];for(L=0;L<80;L++)if(d=P,m=F,A=H,U=$,_=l,G=W,M=X,k=tt,N=V,K=Z,Y=Q,D=ut,O=it,j=at,T=ct,R=lt,x=tt,g=lt,v=g&65535,b=g>>>16,w=x&65535,C=x>>>16,x=(l>>>14|it<<18)^(l>>>18|it<<14)^(it>>>9|l<<23),g=(it>>>14|l<<18)^(it>>>18|l<<14)^(l>>>9|it<<23),v+=g&65535,b+=g>>>16,w+=x&65535,C+=x>>>16,x=l&W^~l&X,g=it&at^~it&ct,v+=g&65535,b+=g>>>16,w+=x&65535,C+=x>>>16,x=Rr[L*2],g=Rr[L*2+1],v+=g&65535,b+=g>>>16,w+=x&65535,C+=x>>>16,x=f[L%16],g=h[L%16],v+=g&65535,b+=g>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,B=w&65535|C<<16,I=v&65535|b<<16,x=B,g=I,v=g&65535,b=g>>>16,w=x&65535,C=x>>>16,x=(P>>>28|V<<4)^(V>>>2|P<<30)^(V>>>7|P<<25),g=(V>>>28|P<<4)^(P>>>2|V<<30)^(P>>>7|V<<25),v+=g&65535,b+=g>>>16,w+=x&65535,C+=x>>>16,x=P&F^P&H^F&H,g=V&Z^V&Q^Z&Q,v+=g&65535,b+=g>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,k=w&65535|C<<16,R=v&65535|b<<16,x=U,g=D,v=g&65535,b=g>>>16,w=x&65535,C=x>>>16,x=B,g=I,v+=g&65535,b+=g>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,U=w&65535|C<<16,D=v&65535|b<<16,F=d,H=m,$=A,l=U,W=_,X=G,tt=M,P=k,Z=N,Q=K,ut=Y,it=D,at=O,ct=j,lt=T,V=R,L%16===15)for(S=0;S<16;S++)x=f[S],g=h[S],v=g&65535,b=g>>>16,w=x&65535,C=x>>>16,x=f[(S+9)%16],g=h[(S+9)%16],v+=g&65535,b+=g>>>16,w+=x&65535,C+=x>>>16,B=f[(S+1)%16],I=h[(S+1)%16],x=(B>>>1|I<<31)^(B>>>8|I<<24)^B>>>7,g=(I>>>1|B<<31)^(I>>>8|B<<24)^(I>>>7|B<<25),v+=g&65535,b+=g>>>16,w+=x&65535,C+=x>>>16,B=f[(S+14)%16],I=h[(S+14)%16],x=(B>>>19|I<<13)^(I>>>29|B<<3)^B>>>6,g=(I>>>19|B<<13)^(B>>>29|I<<3)^(I>>>6|B<<26),v+=g&65535,b+=g>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,f[S]=w&65535|C<<16,h[S]=v&65535|b<<16;x=P,g=V,v=g&65535,b=g>>>16,w=x&65535,C=x>>>16,x=r[0],g=s[0],v+=g&65535,b+=g>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,r[0]=P=w&65535|C<<16,s[0]=V=v&65535|b<<16,x=F,g=Z,v=g&65535,b=g>>>16,w=x&65535,C=x>>>16,x=r[1],g=s[1],v+=g&65535,b+=g>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,r[1]=F=w&65535|C<<16,s[1]=Z=v&65535|b<<16,x=H,g=Q,v=g&65535,b=g>>>16,w=x&65535,C=x>>>16,x=r[2],g=s[2],v+=g&65535,b+=g>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,r[2]=H=w&65535|C<<16,s[2]=Q=v&65535|b<<16,x=$,g=ut,v=g&65535,b=g>>>16,w=x&65535,C=x>>>16,x=r[3],g=s[3],v+=g&65535,b+=g>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,r[3]=$=w&65535|C<<16,s[3]=ut=v&65535|b<<16,x=l,g=it,v=g&65535,b=g>>>16,w=x&65535,C=x>>>16,x=r[4],g=s[4],v+=g&65535,b+=g>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,r[4]=l=w&65535|C<<16,s[4]=it=v&65535|b<<16,x=W,g=at,v=g&65535,b=g>>>16,w=x&65535,C=x>>>16,x=r[5],g=s[5],v+=g&65535,b+=g>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,r[5]=W=w&65535|C<<16,s[5]=at=v&65535|b<<16,x=X,g=ct,v=g&65535,b=g>>>16,w=x&65535,C=x>>>16,x=r[6],g=s[6],v+=g&65535,b+=g>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,r[6]=X=w&65535|C<<16,s[6]=ct=v&65535|b<<16,x=tt,g=lt,v=g&65535,b=g>>>16,w=x&65535,C=x>>>16,x=r[7],g=s[7],v+=g&65535,b+=g>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,r[7]=tt=w&65535|C<<16,s[7]=lt=v&65535|b<<16,xt+=128,t-=128;}return t}function Yt(r,s,o){var t=new Int32Array(8),f=new Int32Array(8),h=new Uint8Array(256),d,m=o;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,Pr(t,f,s,o),o%=128,d=0;d<o;d++)h[d]=s[m-o+d];for(h[o]=128,o=256-128*(o<112?1:0),h[o-9]=0,bt(h,o-8,m/536870912|0,m<<3),Pr(t,f,h,o),d=0;d<8;d++)bt(r,8*d,t[d],f[d]);return 0}function Se(r,s){var o=e(),t=e(),f=e(),h=e(),d=e(),m=e(),A=e(),U=e(),_=e();Mt(o,r[1],r[0]),Mt(_,s[1],s[0]),J(o,o,_),Bt(t,r[0],r[1]),Bt(_,s[0],s[1]),J(t,t,_),J(f,r[3],s[3]),J(f,f,z),J(h,r[2],s[2]),Bt(h,h,h),Mt(d,t,o),Mt(m,h,f),Bt(A,h,f),Bt(U,t,o),J(r[0],d,m),J(r[1],U,A),J(r[2],A,m),J(r[3],d,U);}function kr(r,s,o){var t;for(t=0;t<4;t++)Gt(r[t],s[t],o);}function Ve(r,s){var o=e(),t=e(),f=e();Tr(f,s[2]),J(o,s[0],f),J(t,s[1],f),Xt(r,t),r[31]^=Mr(o)<<7;}function We(r,s,o){var t,f;for(Ct(r[0],u),Ct(r[1],p),Ct(r[2],p),Ct(r[3],u),f=255;f>=0;--f)t=o[f/8|0]>>(f&7)&1,kr(r,s,t),Se(s,r),Se(r,r),kr(r,s,t);}function _e(r,s){var o=[e(),e(),e(),e()];Ct(o[0],q),Ct(o[1],st),Ct(o[2],p),J(o[3],q,st),We(r,o,s);}function Je(r,s,o){var t=new Uint8Array(64),f=[e(),e(),e(),e()],h;for(o||i(s,32),Yt(t,s,32),t[0]&=248,t[31]&=127,t[31]|=64,_e(f,t),Ve(r,f),h=0;h<32;h++)s[h+32]=r[h];return 0}var Be=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 Ze(r,s){var o,t,f,h;for(t=63;t>=32;--t){for(o=0,f=t-32,h=t-12;f<h;++f)s[f]+=o-16*s[t]*Be[f-(t-32)],o=Math.floor((s[f]+128)/256),s[f]-=o*256;s[f]+=o,s[t]=0;}for(o=0,f=0;f<32;f++)s[f]+=o-(s[31]>>4)*Be[f],o=s[f]>>8,s[f]&=255;for(f=0;f<32;f++)s[f]-=o*Be[f];for(t=0;t<32;t++)s[t+1]+=s[t]>>8,r[t]=s[t]&255;}function Qe(r){var s=new Float64Array(64),o;for(o=0;o<64;o++)s[o]=r[o];for(o=0;o<64;o++)r[o]=0;Ze(r,s);}function Nr(r,s,o,t){var f=new Uint8Array(64),h=new Uint8Array(64),d=new Uint8Array(64),m,A,U=new Float64Array(64),_=[e(),e(),e(),e()];Yt(f,t,32),f[0]&=248,f[31]&=127,f[31]|=64;var G=o+64;for(m=0;m<o;m++)r[64+m]=s[m];for(m=0;m<32;m++)r[32+m]=f[32+m];for(Yt(d,r.subarray(32),o+32),Qe(d),_e(_,d),Ve(r,_),m=32;m<64;m++)r[m]=t[m];for(Yt(h,r,o+64),Qe(h),m=0;m<64;m++)U[m]=0;for(m=0;m<32;m++)U[m]=d[m];for(m=0;m<32;m++)for(A=0;A<32;A++)U[m+A]+=h[m]*f[A];return Ze(r.subarray(32),U),G}function oi(r,s){var o=e(),t=e(),f=e(),h=e(),d=e(),m=e(),A=e();return Ct(r[2],p),He(r[1],s),At(f,r[1]),J(h,f,E),Mt(f,f,r[2]),Bt(h,r[2],h),At(d,h),At(m,d),J(A,m,d),J(o,A,f),J(o,o,h),Ir(o,o),J(o,o,f),J(o,o,h),J(o,o,h),J(r[0],o,h),At(t,r[0]),J(t,t,h),Br(t,f)&&J(r[0],r[0],nt),At(t,r[0]),J(t,t,h),Br(t,f)?-1:(Mr(r[0])===s[31]>>7&&Mt(r[0],u,r[0]),J(r[3],r[0],r[1]),0)}function Ge(r,s,o,t){var f,h=new Uint8Array(32),d=new Uint8Array(64),m=[e(),e(),e(),e()],A=[e(),e(),e(),e()];if(o<64||oi(A,t))return -1;for(f=0;f<o;f++)r[f]=s[f];for(f=0;f<32;f++)r[f+32]=t[f];if(Yt(d,r,o),Qe(d),We(m,A,d),_e(A,s.subarray(32)),Se(m,A),Ve(h,m),o-=64,kt(s,0,h,0)){for(f=0;f<o;f++)r[f]=0;return -1}for(f=0;f<o;f++)r[f]=s[f+64];return o}var Xe=32,Me=24,le=32,te=16,ue=32,Te=32,he=32,de=32,tr=32,Dr=Me,si=le,fi=te,Rt=64,Kt=32,ee=64,er=32,rr=64;n.lowlevel={crypto_core_hsalsa20:It,crypto_stream_xor:ae,crypto_stream:Nt,crypto_stream_salsa20_xor:wt,crypto_stream_salsa20:_t,crypto_onetimeauth:ce,crypto_onetimeauth_verify:ft,crypto_verify_16:vt,crypto_verify_32:kt,crypto_secretbox:Ut,crypto_secretbox_open:Zt,crypto_scalarmult:Ee,crypto_scalarmult_base:Ce,crypto_box_beforenm:Ae,crypto_box_afternm:Ur,crypto_box:ni,crypto_box_open:ii,crypto_box_keypair:Lr,crypto_hash:Yt,crypto_sign:Nr,crypto_sign_keypair:Je,crypto_sign_open:Ge,crypto_secretbox_KEYBYTES:Xe,crypto_secretbox_NONCEBYTES:Me,crypto_secretbox_ZEROBYTES:le,crypto_secretbox_BOXZEROBYTES:te,crypto_scalarmult_BYTES:ue,crypto_scalarmult_SCALARBYTES:Te,crypto_box_PUBLICKEYBYTES:he,crypto_box_SECRETKEYBYTES:de,crypto_box_BEFORENMBYTES:tr,crypto_box_NONCEBYTES:Dr,crypto_box_ZEROBYTES:si,crypto_box_BOXZEROBYTES:fi,crypto_sign_BYTES:Rt,crypto_sign_PUBLICKEYBYTES:Kt,crypto_sign_SECRETKEYBYTES:ee,crypto_sign_SEEDBYTES:er,crypto_hash_BYTES:rr,gf:e,D:E,L:Be,pack25519:Xt,unpack25519:He,M:J,A:Bt,S:At,Z:Mt,pow2523:Ir,add:Se,set25519:Ct,modL:Ze,scalarmult:We,scalarbase:_e};function jr(r,s){if(r.length!==Xe)throw new Error("bad key size");if(s.length!==Me)throw new Error("bad nonce size")}function ai(r,s){if(r.length!==he)throw new Error("bad public key size");if(s.length!==de)throw new Error("bad secret key size")}function Et(){for(var r=0;r<arguments.length;r++)if(!(arguments[r]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function zr(r){for(var s=0;s<r.length;s++)r[s]=0;}n.randomBytes=function(r){var s=new Uint8Array(r);return i(s,r),s},n.secretbox=function(r,s,o){Et(r,s,o),jr(o,s);for(var t=new Uint8Array(le+r.length),f=new Uint8Array(t.length),h=0;h<r.length;h++)t[h+le]=r[h];return Ut(f,t,t.length,s,o),f.subarray(te)},n.secretbox.open=function(r,s,o){Et(r,s,o),jr(o,s);for(var t=new Uint8Array(te+r.length),f=new Uint8Array(t.length),h=0;h<r.length;h++)t[h+te]=r[h];return t.length<32||Zt(f,t,t.length,s,o)!==0?null:f.subarray(le)},n.secretbox.keyLength=Xe,n.secretbox.nonceLength=Me,n.secretbox.overheadLength=te,n.scalarMult=function(r,s){if(Et(r,s),r.length!==Te)throw new Error("bad n size");if(s.length!==ue)throw new Error("bad p size");var o=new Uint8Array(ue);return Ee(o,r,s),o},n.scalarMult.base=function(r){if(Et(r),r.length!==Te)throw new Error("bad n size");var s=new Uint8Array(ue);return Ce(s,r),s},n.scalarMult.scalarLength=Te,n.scalarMult.groupElementLength=ue,n.box=function(r,s,o,t){var f=n.box.before(o,t);return n.secretbox(r,s,f)},n.box.before=function(r,s){Et(r,s),ai(r,s);var o=new Uint8Array(tr);return Ae(o,r,s),o},n.box.after=n.secretbox,n.box.open=function(r,s,o,t){var f=n.box.before(o,t);return n.secretbox.open(r,s,f)},n.box.open.after=n.secretbox.open,n.box.keyPair=function(){var r=new Uint8Array(he),s=new Uint8Array(de);return Lr(r,s),{publicKey:r,secretKey:s}},n.box.keyPair.fromSecretKey=function(r){if(Et(r),r.length!==de)throw new Error("bad secret key size");var s=new Uint8Array(he);return Ce(s,r),{publicKey:s,secretKey:new Uint8Array(r)}},n.box.publicKeyLength=he,n.box.secretKeyLength=de,n.box.sharedKeyLength=tr,n.box.nonceLength=Dr,n.box.overheadLength=n.secretbox.overheadLength,n.sign=function(r,s){if(Et(r,s),s.length!==ee)throw new Error("bad secret key size");var o=new Uint8Array(Rt+r.length);return Nr(o,r,r.length,s),o},n.sign.open=function(r,s){if(Et(r,s),s.length!==Kt)throw new Error("bad public key size");var o=new Uint8Array(r.length),t=Ge(o,r,r.length,s);if(t<0)return null;for(var f=new Uint8Array(t),h=0;h<f.length;h++)f[h]=o[h];return f},n.sign.detached=function(r,s){for(var o=n.sign(r,s),t=new Uint8Array(Rt),f=0;f<t.length;f++)t[f]=o[f];return t},n.sign.detached.verify=function(r,s,o){if(Et(r,s,o),s.length!==Rt)throw new Error("bad signature size");if(o.length!==Kt)throw new Error("bad public key size");var t=new Uint8Array(Rt+r.length),f=new Uint8Array(Rt+r.length),h;for(h=0;h<Rt;h++)t[h]=s[h];for(h=0;h<r.length;h++)t[h+Rt]=r[h];return Ge(f,t,t.length,o)>=0},n.sign.keyPair=function(){var r=new Uint8Array(Kt),s=new Uint8Array(ee);return Je(r,s),{publicKey:r,secretKey:s}},n.sign.keyPair.fromSecretKey=function(r){if(Et(r),r.length!==ee)throw new Error("bad secret key size");for(var s=new Uint8Array(Kt),o=0;o<s.length;o++)s[o]=r[32+o];return {publicKey:s,secretKey:new Uint8Array(r)}},n.sign.keyPair.fromSeed=function(r){if(Et(r),r.length!==er)throw new Error("bad seed size");for(var s=new Uint8Array(Kt),o=new Uint8Array(ee),t=0;t<32;t++)o[t]=r[t];return Je(s,o,true),{publicKey:s,secretKey:o}},n.sign.publicKeyLength=Kt,n.sign.secretKeyLength=ee,n.sign.seedLength=er,n.sign.signatureLength=Rt,n.hash=function(r){Et(r);var s=new Uint8Array(rr);return Yt(s,r,r.length),s},n.hash.hashLength=rr,n.verify=function(r,s){return Et(r,s),r.length===0||s.length===0||r.length!==s.length?false:mt(r,0,s,0,r.length)===0},n.setPRNG=function(r){i=r;},(function(){var r=typeof self<"u"?self.crypto||self.msCrypto:null;if(r&&r.getRandomValues){var s=65536;n.setPRNG(function(o,t){var f,h=new Uint8Array(t);for(f=0;f<t;f+=s)r.getRandomValues(h.subarray(f,f+Math.min(t-f,s)));for(f=0;f<t;f++)o[f]=h[f];zr(h);});}else typeof qr<"u"&&(r=Yr(),r&&r.randomBytes&&n.setPRNG(function(o,t){var f,h=r.randomBytes(t);for(f=0;f<t;f++)o[f]=h[f];zr(h);}));})();})(typeof Ie<"u"&&Ie.exports?Ie.exports:self.nacl=self.nacl||{});});var $r=et((Fr,Le)=>{(function(n,e){typeof Le<"u"&&Le.exports?Le.exports=e():(n.nacl||(n.nacl={}),n.nacl.util=e());})(Fr,function(){var n={};function e(i){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(i))throw new TypeError("invalid encoding")}return n.decodeUTF8=function(i){if(typeof i!="string")throw new TypeError("expected string");var a,c=unescape(encodeURIComponent(i)),u=new Uint8Array(c.length);for(a=0;a<c.length;a++)u[a]=c.charCodeAt(a);return u},n.encodeUTF8=function(i){var a,c=[];for(a=0;a<i.length;a++)c.push(String.fromCharCode(i[a]));return decodeURIComponent(escape(c.join("")))},typeof atob>"u"?typeof Buffer.from<"u"?(n.encodeBase64=function(i){return Buffer.from(i).toString("base64")},n.decodeBase64=function(i){return e(i),new Uint8Array(Array.prototype.slice.call(Buffer.from(i,"base64"),0))}):(n.encodeBase64=function(i){return new Buffer(i).toString("base64")},n.decodeBase64=function(i){return e(i),new Uint8Array(Array.prototype.slice.call(new Buffer(i,"base64"),0))}):(n.encodeBase64=function(i){var a,c=[],u=i.length;for(a=0;a<u;a++)c.push(String.fromCharCode(i[a]));return btoa(c.join(""))},n.decodeBase64=function(i){e(i);var a,c=atob(i),u=new Uint8Array(c.length);for(a=0;a<c.length;a++)u[a]=c.charCodeAt(a);return u}),n});});var Vr=et((_o,Hr)=>{Hr.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then};});var Dt=et(Ft=>{var nr,gi=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];Ft.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};Ft.getSymbolTotalCodewords=function(e){return gi[e]};Ft.getBCHDigit=function(n){let e=0;for(;n!==0;)e++,n>>>=1;return e};Ft.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');nr=e;};Ft.isKanjiModeEnabled=function(){return typeof nr<"u"};Ft.toSJIS=function(e){return nr(e)};});var Ue=et(St=>{St.L={bit:1};St.M={bit:0};St.Q={bit:3};St.H={bit:2};function yi(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case "l":case "low":return St.L;case "m":case "medium":return St.M;case "q":case "quartile":return St.Q;case "h":case "high":return St.H;default:throw new Error("Unknown EC Level: "+n)}}St.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};St.from=function(e,i){if(St.isValid(e))return e;try{return yi(e)}catch{return i}};});var Zr=et((To,Jr)=>{function Wr(){this.buffer=[],this.length=0;}Wr.prototype={get:function(n){let e=Math.floor(n/8);return (this.buffer[e]>>>7-n%8&1)===1},put:function(n,e){for(let i=0;i<e;i++)this.putBit((n>>>e-i-1&1)===1);},getLengthInBits:function(){return this.length},putBit:function(n){let e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),n&&(this.buffer[e]|=128>>>this.length%8),this.length++;}};Jr.exports=Wr;});var Gr=et((Io,Qr)=>{function xe(n){if(!n||n<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=n,this.data=new Uint8Array(n*n),this.reservedBit=new Uint8Array(n*n);}xe.prototype.set=function(n,e,i,a){let c=n*this.size+e;this.data[c]=i,a&&(this.reservedBit[c]=true);};xe.prototype.get=function(n,e){return this.data[n*this.size+e]};xe.prototype.xor=function(n,e,i){this.data[n*this.size+e]^=i;};xe.prototype.isReserved=function(n,e){return this.reservedBit[n*this.size+e]};Qr.exports=xe;});var Xr=et(Re=>{var bi=Dt().getSymbolSize;Re.getRowColCoords=function(e){if(e===1)return [];let i=Math.floor(e/7)+2,a=bi(e),c=a===145?26:Math.ceil((a-13)/(2*i-2))*2,u=[a-7];for(let p=1;p<i-1;p++)u[p]=u[p-1]-c;return u.push(6),u.reverse()};Re.getPositions=function(e){let i=[],a=Re.getRowColCoords(e),c=a.length;for(let u=0;u<c;u++)for(let p=0;p<c;p++)u===0&&p===0||u===0&&p===c-1||u===c-1&&p===0||i.push([a[u],a[p]]);return i};});var rn=et(en=>{var mi=Dt().getSymbolSize,tn=7;en.getPositions=function(e){let i=mi(e);return [[0,0],[i-tn,0],[0,i-tn]]};});var nn=et(ot=>{ot.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var $t={N1:3,N2:3,N3:40,N4:10};ot.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};ot.from=function(e){return ot.isValid(e)?parseInt(e,10):void 0};ot.getPenaltyN1=function(e){let i=e.size,a=0,c=0,u=0,p=null,y=null;for(let E=0;E<i;E++){c=u=0,p=y=null;for(let z=0;z<i;z++){let q=e.get(E,z);q===p?c++:(c>=5&&(a+=$t.N1+(c-5)),p=q,c=1),q=e.get(z,E),q===y?u++:(u>=5&&(a+=$t.N1+(u-5)),y=q,u=1);}c>=5&&(a+=$t.N1+(c-5)),u>=5&&(a+=$t.N1+(u-5));}return a};ot.getPenaltyN2=function(e){let i=e.size,a=0;for(let c=0;c<i-1;c++)for(let u=0;u<i-1;u++){let p=e.get(c,u)+e.get(c,u+1)+e.get(c+1,u)+e.get(c+1,u+1);(p===4||p===0)&&a++;}return a*$t.N2};ot.getPenaltyN3=function(e){let i=e.size,a=0,c=0,u=0;for(let p=0;p<i;p++){c=u=0;for(let y=0;y<i;y++)c=c<<1&2047|e.get(p,y),y>=10&&(c===1488||c===93)&&a++,u=u<<1&2047|e.get(y,p),y>=10&&(u===1488||u===93)&&a++;}return a*$t.N3};ot.getPenaltyN4=function(e){let i=0,a=e.data.length;for(let u=0;u<a;u++)i+=e.data[u];return Math.abs(Math.ceil(i*100/a/5)-10)*$t.N4};function wi(n,e,i){switch(n){case ot.Patterns.PATTERN000:return (e+i)%2===0;case ot.Patterns.PATTERN001:return e%2===0;case ot.Patterns.PATTERN010:return i%3===0;case ot.Patterns.PATTERN011:return (e+i)%3===0;case ot.Patterns.PATTERN100:return (Math.floor(e/2)+Math.floor(i/3))%2===0;case ot.Patterns.PATTERN101:return e*i%2+e*i%3===0;case ot.Patterns.PATTERN110:return (e*i%2+e*i%3)%2===0;case ot.Patterns.PATTERN111:return (e*i%3+(e+i)%2)%2===0;default:throw new Error("bad maskPattern:"+n)}}ot.applyMask=function(e,i){let a=i.size;for(let c=0;c<a;c++)for(let u=0;u<a;u++)i.isReserved(u,c)||i.xor(u,c,wi(e,u,c));};ot.getBestMask=function(e,i){let a=Object.keys(ot.Patterns).length,c=0,u=1/0;for(let p=0;p<a;p++){i(p),ot.applyMask(p,e);let y=ot.getPenaltyN1(e)+ot.getPenaltyN2(e)+ot.getPenaltyN3(e)+ot.getPenaltyN4(e);ot.applyMask(p,e),y<u&&(u=y,c=p);}return c};});var or=et(ir=>{var jt=Ue(),Pe=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],ke=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];ir.getBlocksCount=function(e,i){switch(i){case jt.L:return Pe[(e-1)*4+0];case jt.M:return Pe[(e-1)*4+1];case jt.Q:return Pe[(e-1)*4+2];case jt.H:return Pe[(e-1)*4+3];default:return}};ir.getTotalCodewordsCount=function(e,i){switch(i){case jt.L:return ke[(e-1)*4+0];case jt.M:return ke[(e-1)*4+1];case jt.Q:return ke[(e-1)*4+2];case jt.H:return ke[(e-1)*4+3];default:return}};});var on=et(De=>{var pe=new Uint8Array(512),Ne=new Uint8Array(256);(function(){let e=1;for(let i=0;i<255;i++)pe[i]=e,Ne[e]=i,e<<=1,e&256&&(e^=285);for(let i=255;i<512;i++)pe[i]=pe[i-255];})();De.log=function(e){if(e<1)throw new Error("log("+e+")");return Ne[e]};De.exp=function(e){return pe[e]};De.mul=function(e,i){return e===0||i===0?0:pe[Ne[e]+Ne[i]]};});var sn=et(ge=>{var sr=on();ge.mul=function(e,i){let a=new Uint8Array(e.length+i.length-1);for(let c=0;c<e.length;c++)for(let u=0;u<i.length;u++)a[c+u]^=sr.mul(e[c],i[u]);return a};ge.mod=function(e,i){let a=new Uint8Array(e);for(;a.length-i.length>=0;){let c=a[0];for(let p=0;p<i.length;p++)a[p]^=sr.mul(i[p],c);let u=0;for(;u<a.length&&a[u]===0;)u++;a=a.slice(u);}return a};ge.generateECPolynomial=function(e){let i=new Uint8Array([1]);for(let a=0;a<e;a++)i=ge.mul(i,new Uint8Array([1,sr.exp(a)]));return i};});var cn=et((Do,an)=>{var fn=sn();function fr(n){this.genPoly=void 0,this.degree=n,this.degree&&this.initialize(this.degree);}fr.prototype.initialize=function(e){this.degree=e,this.genPoly=fn.generateECPolynomial(this.degree);};fr.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");let i=new Uint8Array(e.length+this.degree);i.set(e);let a=fn.mod(i,this.genPoly),c=this.degree-a.length;if(c>0){let u=new Uint8Array(this.degree);return u.set(a,c),u}return a};an.exports=fr;});var ar=et(ln=>{ln.isValid=function(e){return !isNaN(e)&&e>=1&&e<=40};});var cr=et(Pt=>{var un="[0-9]+",vi="[A-Z $%*+\\-./:]+",ye="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";ye=ye.replace(/u/g,"\\u");var Ei="(?:(?![A-Z0-9 $%*+\\-./:]|"+ye+`)(?:.|[\r
2
+ ]))+`;Pt.KANJI=new RegExp(ye,"g");Pt.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");Pt.BYTE=new RegExp(Ei,"g");Pt.NUMERIC=new RegExp(un,"g");Pt.ALPHANUMERIC=new RegExp(vi,"g");var Ci=new RegExp("^"+ye+"$"),Ai=new RegExp("^"+un+"$"),Si=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");Pt.testKanji=function(e){return Ci.test(e)};Pt.testNumeric=function(e){return Ai.test(e)};Pt.testAlphanumeric=function(e){return Si.test(e)};});var zt=et(ht=>{var _i=ar(),lr=cr();ht.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};ht.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};ht.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};ht.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};ht.MIXED={bit:-1};ht.getCharCountIndicator=function(e,i){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!_i.isValid(i))throw new Error("Invalid version: "+i);return i>=1&&i<10?e.ccBits[0]:i<27?e.ccBits[1]:e.ccBits[2]};ht.getBestModeForData=function(e){return lr.testNumeric(e)?ht.NUMERIC:lr.testAlphanumeric(e)?ht.ALPHANUMERIC:lr.testKanji(e)?ht.KANJI:ht.BYTE};ht.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};ht.isValid=function(e){return e&&e.bit&&e.ccBits};function Bi(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case "numeric":return ht.NUMERIC;case "alphanumeric":return ht.ALPHANUMERIC;case "kanji":return ht.KANJI;case "byte":return ht.BYTE;default:throw new Error("Unknown mode: "+n)}}ht.from=function(e,i){if(ht.isValid(e))return e;try{return Bi(e)}catch{return i}};});var gn=et(Ht=>{var je=Dt(),Mi=or(),hn=Ue(),Ot=zt(),ur=ar(),xn=7973,dn=je.getBCHDigit(xn);function Ti(n,e,i){for(let a=1;a<=40;a++)if(e<=Ht.getCapacity(a,i,n))return a}function pn(n,e){return Ot.getCharCountIndicator(n,e)+4}function Ii(n,e){let i=0;return n.forEach(function(a){let c=pn(a.mode,e);i+=c+a.getBitsLength();}),i}function Li(n,e){for(let i=1;i<=40;i++)if(Ii(n,i)<=Ht.getCapacity(i,e,Ot.MIXED))return i}Ht.from=function(e,i){return ur.isValid(e)?parseInt(e,10):i};Ht.getCapacity=function(e,i,a){if(!ur.isValid(e))throw new Error("Invalid QR Code version");typeof a>"u"&&(a=Ot.BYTE);let c=je.getSymbolTotalCodewords(e),u=Mi.getTotalCodewordsCount(e,i),p=(c-u)*8;if(a===Ot.MIXED)return p;let y=p-pn(a,e);switch(a){case Ot.NUMERIC:return Math.floor(y/10*3);case Ot.ALPHANUMERIC:return Math.floor(y/11*2);case Ot.KANJI:return Math.floor(y/13);case Ot.BYTE:default:return Math.floor(y/8)}};Ht.getBestVersionForData=function(e,i){let a,c=hn.from(i,hn.M);if(Array.isArray(e)){if(e.length>1)return Li(e,c);if(e.length===0)return 1;a=e[0];}else a=e;return Ti(a.mode,a.getLength(),c)};Ht.getEncodedBits=function(e){if(!ur.isValid(e)||e<7)throw new Error("Invalid QR Code version");let i=e<<12;for(;je.getBCHDigit(i)-dn>=0;)i^=xn<<je.getBCHDigit(i)-dn;return e<<12|i};});var wn=et(mn=>{var hr=Dt(),bn=1335,Ui=21522,yn=hr.getBCHDigit(bn);mn.getEncodedBits=function(e,i){let a=e.bit<<3|i,c=a<<10;for(;hr.getBCHDigit(c)-yn>=0;)c^=bn<<hr.getBCHDigit(c)-yn;return (a<<10|c)^Ui};});var En=et((Ko,vn)=>{var Ri=zt();function re(n){this.mode=Ri.NUMERIC,this.data=n.toString();}re.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};re.prototype.getLength=function(){return this.data.length};re.prototype.getBitsLength=function(){return re.getBitsLength(this.data.length)};re.prototype.write=function(e){let i,a,c;for(i=0;i+3<=this.data.length;i+=3)a=this.data.substr(i,3),c=parseInt(a,10),e.put(c,10);let u=this.data.length-i;u>0&&(a=this.data.substr(i),c=parseInt(a,10),e.put(c,u*3+1));};vn.exports=re;});var An=et((Fo,Cn)=>{var Pi=zt(),dr=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function ne(n){this.mode=Pi.ALPHANUMERIC,this.data=n;}ne.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};ne.prototype.getLength=function(){return this.data.length};ne.prototype.getBitsLength=function(){return ne.getBitsLength(this.data.length)};ne.prototype.write=function(e){let i;for(i=0;i+2<=this.data.length;i+=2){let a=dr.indexOf(this.data[i])*45;a+=dr.indexOf(this.data[i+1]),e.put(a,11);}this.data.length%2&&e.put(dr.indexOf(this.data[i]),6);};Cn.exports=ne;});var _n=et(($o,Sn)=>{var ki=zt();function ie(n){this.mode=ki.BYTE,typeof n=="string"?this.data=new TextEncoder().encode(n):this.data=new Uint8Array(n);}ie.getBitsLength=function(e){return e*8};ie.prototype.getLength=function(){return this.data.length};ie.prototype.getBitsLength=function(){return ie.getBitsLength(this.data.length)};ie.prototype.write=function(n){for(let e=0,i=this.data.length;e<i;e++)n.put(this.data[e],8);};Sn.exports=ie;});var Mn=et((Ho,Bn)=>{var Ni=zt(),Di=Dt();function oe(n){this.mode=Ni.KANJI,this.data=n;}oe.getBitsLength=function(e){return e*13};oe.prototype.getLength=function(){return this.data.length};oe.prototype.getBitsLength=function(){return oe.getBitsLength(this.data.length)};oe.prototype.write=function(n){let e;for(e=0;e<this.data.length;e++){let i=Di.toSJIS(this.data[e]);if(i>=33088&&i<=40956)i-=33088;else if(i>=57408&&i<=60351)i-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+`
3
+ Make sure your charset is UTF-8`);i=(i>>>8&255)*192+(i&255),n.put(i,13);}};Bn.exports=oe;});var Tn=et((Vo,xr)=>{var be={single_source_shortest_paths:function(n,e,i){var a={},c={};c[e]=0;var u=be.PriorityQueue.make();u.push(e,0);for(var p,y,E,z,q,st,nt,bt,mt;!u.empty();){p=u.pop(),y=p.value,z=p.cost,q=n[y]||{};for(E in q)q.hasOwnProperty(E)&&(st=q[E],nt=z+st,bt=c[E],mt=typeof c[E]>"u",(mt||bt>nt)&&(c[E]=nt,u.push(E,nt),a[E]=y));}if(typeof i<"u"&&typeof c[i]>"u"){var vt=["Could not find a path from ",e," to ",i,"."].join("");throw new Error(vt)}return a},extract_shortest_path_from_predecessor_list:function(n,e){for(var i=[],a=e,c;a;)i.push(a),c=n[a],a=n[a];return i.reverse(),i},find_path:function(n,e,i){var a=be.single_source_shortest_paths(n,e,i);return be.extract_shortest_path_from_predecessor_list(a,i)},PriorityQueue:{make:function(n){var e=be.PriorityQueue,i={},a;n=n||{};for(a in e)e.hasOwnProperty(a)&&(i[a]=e[a]);return i.queue=[],i.sorter=n.sorter||e.default_sorter,i},default_sorter:function(n,e){return n.cost-e.cost},push:function(n,e){var i={value:n,cost:e};this.queue.push(i),this.queue.sort(this.sorter);},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof xr<"u"&&(xr.exports=be);});var Dn=et(se=>{var rt=zt(),Un=En(),Rn=An(),Pn=_n(),kn=Mn(),me=cr(),ze=Dt(),ji=Tn();function In(n){return unescape(encodeURIComponent(n)).length}function we(n,e,i){let a=[],c;for(;(c=n.exec(i))!==null;)a.push({data:c[0],index:c.index,mode:e,length:c[0].length});return a}function Nn(n){let e=we(me.NUMERIC,rt.NUMERIC,n),i=we(me.ALPHANUMERIC,rt.ALPHANUMERIC,n),a,c;return ze.isKanjiModeEnabled()?(a=we(me.BYTE,rt.BYTE,n),c=we(me.KANJI,rt.KANJI,n)):(a=we(me.BYTE_KANJI,rt.BYTE,n),c=[]),e.concat(i,a,c).sort(function(p,y){return p.index-y.index}).map(function(p){return {data:p.data,mode:p.mode,length:p.length}})}function pr(n,e){switch(e){case rt.NUMERIC:return Un.getBitsLength(n);case rt.ALPHANUMERIC:return Rn.getBitsLength(n);case rt.KANJI:return kn.getBitsLength(n);case rt.BYTE:return Pn.getBitsLength(n)}}function zi(n){return n.reduce(function(e,i){let a=e.length-1>=0?e[e.length-1]:null;return a&&a.mode===i.mode?(e[e.length-1].data+=i.data,e):(e.push(i),e)},[])}function Oi(n){let e=[];for(let i=0;i<n.length;i++){let a=n[i];switch(a.mode){case rt.NUMERIC:e.push([a,{data:a.data,mode:rt.ALPHANUMERIC,length:a.length},{data:a.data,mode:rt.BYTE,length:a.length}]);break;case rt.ALPHANUMERIC:e.push([a,{data:a.data,mode:rt.BYTE,length:a.length}]);break;case rt.KANJI:e.push([a,{data:a.data,mode:rt.BYTE,length:In(a.data)}]);break;case rt.BYTE:e.push([{data:a.data,mode:rt.BYTE,length:In(a.data)}]);}}return e}function qi(n,e){let i={},a={start:{}},c=["start"];for(let u=0;u<n.length;u++){let p=n[u],y=[];for(let E=0;E<p.length;E++){let z=p[E],q=""+u+E;y.push(q),i[q]={node:z,lastCount:0},a[q]={};for(let st=0;st<c.length;st++){let nt=c[st];i[nt]&&i[nt].node.mode===z.mode?(a[nt][q]=pr(i[nt].lastCount+z.length,z.mode)-pr(i[nt].lastCount,z.mode),i[nt].lastCount+=z.length):(i[nt]&&(i[nt].lastCount=z.length),a[nt][q]=pr(z.length,z.mode)+4+rt.getCharCountIndicator(z.mode,e));}}c=y;}for(let u=0;u<c.length;u++)a[c[u]].end=0;return {map:a,table:i}}function Ln(n,e){let i,a=rt.getBestModeForData(n);if(i=rt.from(e,a),i!==rt.BYTE&&i.bit<a.bit)throw new Error('"'+n+'" cannot be encoded with mode '+rt.toString(i)+`.
4
+ Suggested mode is: `+rt.toString(a));switch(i===rt.KANJI&&!ze.isKanjiModeEnabled()&&(i=rt.BYTE),i){case rt.NUMERIC:return new Un(n);case rt.ALPHANUMERIC:return new Rn(n);case rt.KANJI:return new kn(n);case rt.BYTE:return new Pn(n)}}se.fromArray=function(e){return e.reduce(function(i,a){return typeof a=="string"?i.push(Ln(a,null)):a.data&&i.push(Ln(a.data,a.mode)),i},[])};se.fromString=function(e,i){let a=Nn(e,ze.isKanjiModeEnabled()),c=Oi(a),u=qi(c,i),p=ji.find_path(u.map,"start","end"),y=[];for(let E=1;E<p.length-1;E++)y.push(u.table[p[E]].node);return se.fromArray(zi(y))};se.rawSplit=function(e){return se.fromArray(Nn(e,ze.isKanjiModeEnabled()))};});var zn=et(jn=>{var qe=Dt(),gr=Ue(),Yi=Zr(),Ki=Gr(),Fi=Xr(),$i=rn(),mr=nn(),wr=or(),Hi=cn(),Oe=gn(),Vi=wn(),Wi=zt(),yr=Dn();function Ji(n,e){let i=n.size,a=$i.getPositions(e);for(let c=0;c<a.length;c++){let u=a[c][0],p=a[c][1];for(let y=-1;y<=7;y++)if(!(u+y<=-1||i<=u+y))for(let E=-1;E<=7;E++)p+E<=-1||i<=p+E||(y>=0&&y<=6&&(E===0||E===6)||E>=0&&E<=6&&(y===0||y===6)||y>=2&&y<=4&&E>=2&&E<=4?n.set(u+y,p+E,true,true):n.set(u+y,p+E,false,true));}}function Zi(n){let e=n.size;for(let i=8;i<e-8;i++){let a=i%2===0;n.set(i,6,a,true),n.set(6,i,a,true);}}function Qi(n,e){let i=Fi.getPositions(e);for(let a=0;a<i.length;a++){let c=i[a][0],u=i[a][1];for(let p=-2;p<=2;p++)for(let y=-2;y<=2;y++)p===-2||p===2||y===-2||y===2||p===0&&y===0?n.set(c+p,u+y,true,true):n.set(c+p,u+y,false,true);}}function Gi(n,e){let i=n.size,a=Oe.getEncodedBits(e),c,u,p;for(let y=0;y<18;y++)c=Math.floor(y/3),u=y%3+i-8-3,p=(a>>y&1)===1,n.set(c,u,p,true),n.set(u,c,p,true);}function br(n,e,i){let a=n.size,c=Vi.getEncodedBits(e,i),u,p;for(u=0;u<15;u++)p=(c>>u&1)===1,u<6?n.set(u,8,p,true):u<8?n.set(u+1,8,p,true):n.set(a-15+u,8,p,true),u<8?n.set(8,a-u-1,p,true):u<9?n.set(8,15-u-1+1,p,true):n.set(8,15-u-1,p,true);n.set(a-8,8,1,true);}function Xi(n,e){let i=n.size,a=-1,c=i-1,u=7,p=0;for(let y=i-1;y>0;y-=2)for(y===6&&y--;;){for(let E=0;E<2;E++)if(!n.isReserved(c,y-E)){let z=false;p<e.length&&(z=(e[p]>>>u&1)===1),n.set(c,y-E,z),u--,u===-1&&(p++,u=7);}if(c+=a,c<0||i<=c){c-=a,a=-a;break}}}function to(n,e,i){let a=new Yi;i.forEach(function(E){a.put(E.mode.bit,4),a.put(E.getLength(),Wi.getCharCountIndicator(E.mode,n)),E.write(a);});let c=qe.getSymbolTotalCodewords(n),u=wr.getTotalCodewordsCount(n,e),p=(c-u)*8;for(a.getLengthInBits()+4<=p&&a.put(0,4);a.getLengthInBits()%8!==0;)a.putBit(0);let y=(p-a.getLengthInBits())/8;for(let E=0;E<y;E++)a.put(E%2?17:236,8);return eo(a,n,e)}function eo(n,e,i){let a=qe.getSymbolTotalCodewords(e),c=wr.getTotalCodewordsCount(e,i),u=a-c,p=wr.getBlocksCount(e,i),y=a%p,E=p-y,z=Math.floor(a/p),q=Math.floor(u/p),st=q+1,nt=z-q,bt=new Hi(nt),mt=0,vt=new Array(p),kt=new Array(p),qt=0,fe=new Uint8Array(n.buffer);for(let _t=0;_t<p;_t++){let Nt=_t<E?q:st;vt[_t]=fe.slice(mt,mt+Nt),kt[_t]=bt.encode(vt[_t]),mt+=Nt,qt=Math.max(qt,Nt);}let Tt=new Uint8Array(a),It=0,dt,wt;for(dt=0;dt<qt;dt++)for(wt=0;wt<p;wt++)dt<vt[wt].length&&(Tt[It++]=vt[wt][dt]);for(dt=0;dt<nt;dt++)for(wt=0;wt<p;wt++)Tt[It++]=kt[wt][dt];return Tt}function ro(n,e,i,a){let c;if(Array.isArray(n))c=yr.fromArray(n);else if(typeof n=="string"){let z=e;if(!z){let q=yr.rawSplit(n);z=Oe.getBestVersionForData(q,i);}c=yr.fromString(n,z||40);}else throw new Error("Invalid data");let u=Oe.getBestVersionForData(c,i);if(!u)throw new Error("The amount of data is too big to be stored in a QR Code");if(!e)e=u;else if(e<u)throw new Error(`
5
5
  The chosen QR Code version cannot contain this amount of data.
6
6
  Minimum version required to store current data is: `+u+`.
7
- `);let g=to(e,i,c),y=qe.getSymbolSize(e),E=new Yi(y);return Ji(E,e),Zi(E),Qi(E,e),br(E,i,0),e>=7&&Gi(E,e),Xi(E,g),isNaN(a)&&(a=mr.getBestMask(E,br.bind(null,E,i))),mr.applyMask(a,E),br(E,i,a),{modules:E,version:e,errorCorrectionLevel:i,maskPattern:a,segments:c}}Dn.create=function(e,i){if(typeof e>"u"||e==="")throw new Error("No input text");let a=gr.M,c,u;return typeof i<"u"&&(a=gr.from(i.errorCorrectionLevel,gr.M),c=Oe.from(i.version),u=mr.from(i.maskPattern),i.toSJISFunc&&qe.setToSJISFunction(i.toSJISFunc)),ro(e,c,a,u)};});var vr=et(Vt=>{function On(n){if(typeof n=="number"&&(n=n.toString()),typeof n!="string")throw new Error("Color should be defined as hex string");let e=n.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8)throw new Error("Invalid hex color: "+n);(e.length===3||e.length===4)&&(e=Array.prototype.concat.apply([],e.map(function(a){return [a,a]}))),e.length===6&&e.push("F","F");let i=parseInt(e.join(""),16);return {r:i>>24&255,g:i>>16&255,b:i>>8&255,a:i&255,hex:"#"+e.slice(0,6).join("")}}Vt.getOptions=function(e){e||(e={}),e.color||(e.color={});let i=typeof e.margin>"u"||e.margin===null||e.margin<0?4:e.margin,a=e.width&&e.width>=21?e.width:void 0,c=e.scale||4;return {width:a,scale:a?4:c,margin:i,color:{dark:On(e.color.dark||"#000000ff"),light:On(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};Vt.getScale=function(e,i){return i.width&&i.width>=e+i.margin*2?i.width/(e+i.margin*2):i.scale};Vt.getImageWidth=function(e,i){let a=Vt.getScale(e,i);return Math.floor((e+i.margin*2)*a)};Vt.qrToImageData=function(e,i,a){let c=i.modules.size,u=i.modules.data,g=Vt.getScale(c,a),y=Math.floor((c+a.margin*2)*g),E=a.margin*g,z=[a.color.light,a.color.dark];for(let q=0;q<y;q++)for(let st=0;st<y;st++){let nt=(q*y+st)*4,bt=a.color.light;if(q>=E&&st>=E&&q<y-E&&st<y-E){let mt=Math.floor((q-E)/g),vt=Math.floor((st-E)/g);bt=z[u[mt*c+vt]?1:0];}e[nt++]=bt.r,e[nt++]=bt.g,e[nt++]=bt.b,e[nt]=bt.a;}};});var qn=et(Ke=>{var Er=vr();function no(n,e,i){n.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=i,e.width=i,e.style.height=i+"px",e.style.width=i+"px";}function io(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}Ke.render=function(e,i,a){let c=a,u=i;typeof c>"u"&&(!i||!i.getContext)&&(c=i,i=void 0),i||(u=io()),c=Er.getOptions(c);let g=Er.getImageWidth(e.modules.size,c),y=u.getContext("2d"),E=y.createImageData(g,g);return Er.qrToImageData(E.data,e,c),no(y,u,g),y.putImageData(E,0,0),u};Ke.renderToDataURL=function(e,i,a){let c=a;typeof c>"u"&&(!i||!i.getContext)&&(c=i,i=void 0),c||(c={});let u=Ke.render(e,i,c),g=c.type||"image/png",y=c.rendererOpts||{};return u.toDataURL(g,y.quality)};});var Fn=et(Yn=>{var oo=vr();function Kn(n,e){let i=n.a/255,a=e+'="'+n.hex+'"';return i<1?a+" "+e+'-opacity="'+i.toFixed(2).slice(1)+'"':a}function Cr(n,e,i){let a=n+e;return typeof i<"u"&&(a+=" "+i),a}function so(n,e,i){let a="",c=0,u=false,g=0;for(let y=0;y<n.length;y++){let E=Math.floor(y%e),z=Math.floor(y/e);!E&&!u&&(u=true),n[y]?(g++,y>0&&E>0&&n[y-1]||(a+=u?Cr("M",E+i,.5+z+i):Cr("m",c,0),c=0,u=false),E+1<e&&n[y+1]||(a+=Cr("h",g),g=0)):c++;}return a}Yn.render=function(e,i,a){let c=oo.getOptions(i),u=e.modules.size,g=e.modules.data,y=u+c.margin*2,E=c.color.light.a?"<path "+Kn(c.color.light,"fill")+' d="M0 0h'+y+"v"+y+'H0z"/>':"",z="<path "+Kn(c.color.dark,"stroke")+' d="'+so(g,u,c.margin)+'"/>',q='viewBox="0 0 '+y+" "+y+'"',nt='<svg xmlns="http://www.w3.org/2000/svg" '+(c.width?'width="'+c.width+'" height="'+c.width+'" ':"")+q+' shape-rendering="crispEdges">'+E+z+`</svg>
8
- `;return typeof a=="function"&&a(null,nt),nt};});var Hn=et(ve=>{var fo=Vr(),Ar=zn(),$n=qn(),ao=Fn();function Sr(n,e,i,a,c){let u=[].slice.call(arguments,1),g=u.length,y=typeof u[g-1]=="function";if(!y&&!fo())throw new Error("Callback required as last argument");if(y){if(g<2)throw new Error("Too few arguments provided");g===2?(c=i,i=e,e=a=void 0):g===3&&(e.getContext&&typeof c>"u"?(c=a,a=void 0):(c=a,a=i,i=e,e=void 0));}else {if(g<1)throw new Error("Too few arguments provided");return g===1?(i=e,e=a=void 0):g===2&&!e.getContext&&(a=i,i=e,e=void 0),new Promise(function(E,z){try{let q=Ar.create(i,a);E(n(q,e,a));}catch(q){z(q);}})}try{let E=Ar.create(i,a);c(null,n(E,e,a));}catch(E){c(E);}}ve.create=Ar.create;ve.toCanvas=Sr.bind(null,$n.render);ve.toDataURL=Sr.bind(null,$n.renderToDataURL);ve.toString=Sr.bind(null,function(n,e,i){return ao.render(n,i)});});var Xn=et(Lt=>{var co=Yr(),Wt=$r(),lo=Hn();function Vn(n){return n&&n.__esModule?n:{default:n}}var Ye=Vn(co),uo=Vn(lo),Wn=class{generateSymmetricKey(){let n=Ye.default.randomBytes(32);return Wt.encodeBase64(n)}encryptSymmetric({plaintext:n,keyString:e}){let i=Wt.decodeBase64(e),a=Ye.default.randomBytes(24),c=new TextEncoder().encode(n),u=Ye.default.secretbox(c,a,i);return {cipher:Wt.encodeBase64(u),nonce:Wt.encodeBase64(a)}}decryptSymmetric({encrypted:n,keyString:e}){try{let i=Wt.decodeBase64(e),a=Wt.decodeBase64(n.cipher),c=Wt.decodeBase64(n.nonce),u=Ye.default.secretbox.open(a,c,i);if(!u)throw new Error("Decryption failed - invalid key or corrupted data");return new TextDecoder().decode(u)}catch(i){return console.error("Decryption failed",i),null}}},ho=Wn,xo=class{constructor(){this.prefix="pelican_auth_",this.defaultTTL=300*1e3,this.memoryCache=new Map;}set(n,e,i={}){let{ttlMs:a=this.defaultTTL,useSessionStorage:c=true}=i,u=Date.now()+a,g={value:e,expiresAt:u};if(c)try{sessionStorage.setItem(`${this.prefix}${n}`,JSON.stringify(g));}catch(y){console.warn("SessionStorage unavailable, using memory:",y),this.setMemory(n,g);}else this.setMemory(n,g);}get(n){try{let e=sessionStorage.getItem(`${this.prefix}${n}`);if(e){let i=JSON.parse(e);return Date.now()>i.expiresAt?(this.remove(n),null):i.value}}catch{}return this.getMemory(n)}remove(n){try{sessionStorage.removeItem(`${this.prefix}${n}`);}catch{}this.memoryCache.delete(n);}clear(){try{Object.keys(sessionStorage).forEach(n=>{n.startsWith(this.prefix)&&sessionStorage.removeItem(n);});}catch{}this.memoryCache.clear();}setMemory(n,e){this.memoryCache.set(n,e);let i=e.expiresAt-Date.now();setTimeout(()=>{this.memoryCache.delete(n);},i);}getMemory(n){let e=this.memoryCache.get(n);return e?Date.now()>e.expiresAt?(this.memoryCache.delete(n),null):e.value:null}},$e=new xo,Jn=(n,e,i)=>{$e.set("session",{sessionId:n,sessionKey:e},{ttlMs:i});},Zn=()=>$e.get("session"),Fe=()=>{$e.remove("session");},po=()=>{$e.clear();},Qn=class{constructor(){this.state="idle",this.listeners=new Set;}get current(){return this.state}transition(n){this.state=n,this.listeners.forEach(e=>e(n));}subscribe(n){return this.listeners.add(n),()=>this.listeners.delete(n)}},Gn=class{constructor(n){this.reconnectAttempts=0,this.maxReconnectAttempts=3,this.isExplicitlyClosed=false,this.isReconnecting=false,this.handlers=n;}connect(n){this.url=n,this.isExplicitlyClosed=false,this.socket&&(this.socket.onclose=null,this.socket.onerror=null,this.socket.onmessage=null,this.socket.onopen=null,(this.socket.readyState===WebSocket.OPEN||this.socket.readyState===WebSocket.CONNECTING)&&this.socket.close()),this.socket=new WebSocket(n),this.socket.onopen=()=>{this.reconnectAttempts=0,this.isReconnecting=false,this.handlers.onOpen?.();},this.socket.onmessage=e=>{try{let i=JSON.parse(e.data);this.handlers.onMessage?.(i);}catch(i){console.error("Failed to parse WebSocket message",i);}},this.socket.onerror=e=>{!this.isReconnecting&&!this.isExplicitlyClosed&&this.handlers.onError?.(e);},this.socket.onclose=e=>{this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0),this.isReconnecting||this.handlers.onClose?.(e),!this.isExplicitlyClosed&&!this.isReconnecting&&this.reconnectAttempts<this.maxReconnectAttempts&&this.attemptReconnect();};}attemptReconnect(){if(this.reconnectAttempts>=this.maxReconnectAttempts){console.warn("Max WebSocket reconnect attempts reached");return}this.isReconnecting=true,this.reconnectAttempts++;let n=Math.min(Math.pow(2,this.reconnectAttempts-1)*500,2e3);console.log(`Reconnecting WebSocket (attempt ${this.reconnectAttempts}/${this.maxReconnectAttempts}) in ${n}ms...`),this.reconnectTimeout=window.setTimeout(()=>{this.url&&!this.isExplicitlyClosed&&this.connect(this.url);},n);}send(n){if(this.socket?.readyState===WebSocket.OPEN)try{this.socket.send(JSON.stringify(n));}catch(e){console.error("Failed to send WebSocket message:",e);}else console.warn("WebSocket not open, message not sent:",this.socket?.readyState);}close(){this.isExplicitlyClosed=true,this.isReconnecting=false,this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0),this.socket&&(this.socket.onclose=null,this.socket.onerror=null,this.socket.onmessage=null,this.socket.onopen=null,(this.socket.readyState===WebSocket.OPEN||this.socket.readyState===WebSocket.CONNECTING)&&this.socket.close(),this.socket=void 0);}get readyState(){return this.socket?.readyState}get isOpen(){return this.socket?.readyState===WebSocket.OPEN}},_r="https://identityapi.pelicanidentity.com",go="https://apps.apple.com/us/app/pelican-vault/id6755097751",yo="https://play.google.com/store/apps/details?id=com.HeraculesDesignTechLtd.pelican",bo="https://pelicanidentity.com/pelican-vault",mo=class{constructor(n){if(this.crypto=new ho,this.stateMachine=new Qn,this.sessionId="",this.sessionKey=null,this.useWebSocket=true,this.deeplinkUrl=null,this.listeners={},!n.publicKey)throw new Error("Missing publicKey");if(!n.projectId)throw new Error("Missing projectId");if(!n.authType)throw new Error("Missing authType");this.config={continuousMode:false,forceQRCode:false,...n},this.stateMachine.subscribe(e=>this.emit("state",e));}on(n,e){var i;return (i=this.listeners)[n]??(i[n]=new Set),this.listeners[n].add(e),()=>this.listeners[n].delete(e)}async start(){if(this.config.authType!=="id-verification"&&this.config.authType!=="signup"&&this.config.authType!=="login"){this.fail(new Error("Invalid authType"));return}if(!this.config.projectId){this.fail(new Error("Missing projectId"));return}if(!this.config.publicKey){this.fail(new Error("Missing publicKey"));return}if(this.stateMachine.current==="idle"){this.resetSession(),Fe(),this.stateMachine.transition("initializing");try{this.sessionKey=this.crypto.generateSymmetricKey(),this.sessionId=crypto.randomUUID()+crypto.randomUUID(),this.useWebSocket=this.shouldUseWebSocket(),this.useWebSocket?await this.startWebSocketFlow():await this.startDeepLinkFlow();}catch(n){this.fail(n instanceof Error?n:new Error("Start failed"));}}}stop(){this.terminate(false);}openWebAuth(){if(!this.sessionKey||!this.sessionId){this.fail(new Error("No active session. Call start() before openWebAuth()."));return}let n=window.location.origin,i=`https://vault.pelicanidentity.com/auth?${new URLSearchParams({projectId:this.config.projectId,publicKey:this.config.publicKey,authType:this.config.authType,sessionId:this.sessionId,sessionKey:this.sessionKey,origin:n}).toString()}`,a=window.open(i,"pelican-auth","width=480,height=640,left=400,top=100,resizable=no,scrollbars=no")??window.open(i,"_blank");if(!a){this.fail(new Error("Unable to open authentication window. Please allow popups for this site and try again."));return}this.detachVisibilityRecovery(),this.transport?.close(),this.transport=void 0,a.focus(),this.stateMachine.transition("awaiting-pair");let c=()=>{window.removeEventListener("message",u),clearInterval(g);},u=y=>{if(y.origin!=="https://vault.pelicanidentity.com"||y.source!==a)return;let{type:E,payload:z}=y.data??{};if(E==="pelican-auth-success"){if(console.log("Web auth success"),c(),!z?.cipher||!z?.nonce){this.fail(new Error("Invalid web auth payload")),this.restartIfContinuous();return}try{let q=this.crypto.decryptSymmetric({encrypted:{cipher:z.cipher,nonce:z.nonce},keyString:this.sessionKey});if(!q){this.fail(new Error("Failed to decrypt web auth response")),this.restartIfContinuous();return}let st=JSON.parse(q);this.emit("success",st),this.stateMachine.transition("authenticated"),this.restartIfContinuous();}catch{this.fail(new Error("Failed to decrypt web auth response")),this.restartIfContinuous();}}E==="pelican-auth-cancelled"&&(c(),this.fail(new Error("Authentication cancelled")),this.restartIfContinuous()),E==="pelican-auth-error"&&(c(),this.fail(new Error(z?.message??"Web auth failed")),this.restartIfContinuous());};window.addEventListener("message",u);let g=setInterval(()=>{a.closed&&(c(),["authenticated","confirmed","error"].includes(this.stateMachine.current)||(this.fail(new Error("Authentication window closed")),this.restartIfContinuous()));},500);}destroy(){this.detachVisibilityRecovery(),this.clearBackupCheck(),this.transport?.close(),this.transport=void 0,this.listeners={};}useQrInstead(){this.useWebSocket=true,this.emit("deeplink",""),this.stateMachine.transition("initializing"),this.startWebSocketFlow();}useDeepLinkInstead(){this.useWebSocket=false,this.stateMachine.transition("initializing"),this.startDeepLinkFlow();}shouldUseWebSocket(){let n=navigator.userAgent,e=/(iPad|Android(?!.*Mobile))/i.test(n),a=/Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(n)&&!e;return this.config.forceQRCode||!a}async startWebSocketFlow(){let{relayUrl:n,deeplinkUrl:e}=await this.fetchRelayUrl();this.transport=new Gn({onOpen:()=>{this.transport.send({type:"register",sessionID:this.sessionId,...this.config}),this.stateMachine.transition("awaiting-pair");},onMessage:i=>this.handleWebSocketMessage(i),onError:i=>{console.error("WebSocket error:",i),this.fail(new Error("WebSocket connection failed"));}}),this.transport.connect(n),await this.emitQRCode(e);}handleWebSocketMessage(n){switch(n.type){case "paired":this.stateMachine.transition("paired"),this.transport.send({type:"authenticate",sessionID:this.sessionId,...this.config,url:window.location.href});return;case "phone-auth-success":this.handleAuthSuccess(n);return;case "phone-terminated":this.fail(new Error("Authentication cancelled on device")),this.restartIfContinuous();return;case "confirmed":this.terminate(true),this.restartIfContinuous();return}}handleAuthSuccess(n){if(!this.sessionKey||!n.cipher||!n.nonce){this.fail(new Error("Invalid authentication payload")),this.restartIfContinuous();return}try{let e=this.crypto.decryptSymmetric({encrypted:{cipher:n.cipher,nonce:n.nonce},keyString:this.sessionKey});if(!e){this.fail(new Error("Invalid authentication data")),this.restartIfContinuous();return}let i=JSON.parse(e);this.emit("success",i),this.stateMachine.transition("authenticated"),this.transport?.send({type:"confirm",sessionID:this.sessionId});}catch{this.fail(new Error("Failed to decrypt authentication data")),this.restartIfContinuous();}}async startDeepLinkFlow(){let{deeplinkUrl:n}=await this.fetchRelayUrl();this.sessionKey&&Jn(this.sessionId,this.sessionKey,10*6e4),await this.emitDeepLink(n),this.deeplinkUrl=n,this.stateMachine.transition("awaiting-pair");}openDeepLink(){if(!this.deeplinkUrl){this.fail(new Error("Deep link not found"));return}let n=navigator.userAgent,e=bo;/iPad|iPhone|iPod/.test(n)?e=go:/android/i.test(n)&&(e=yo);let i=Date.now();window.location.href=this.deeplinkUrl,setTimeout(()=>{Date.now()-i<3500&&(window.location.href=e);},3e3);}clearBackupCheck(){this.backupCheckTimeout&&(clearTimeout(this.backupCheckTimeout),this.backupCheckTimeout=void 0);}async checkSession(){let n=Zn();if(!n){this.fail(new Error("Authentication session not found")),this.restartIfContinuous();return}this.stateMachine.transition("awaiting-auth");try{let e=await fetch(`${_r}/session?session_id=${n.sessionId}`);if(!e.ok){this.fail(new Error("Session not found")),this.restartIfContinuous();return}let i=await e.json(),a=this.crypto.decryptSymmetric({encrypted:{cipher:i.cipher,nonce:i.nonce},keyString:n.sessionKey});if(!a){console.warn("Failed to decrypt session"),this.fail(new Error("Failed to decrypt session")),this.restartIfContinuous();return}let c=JSON.parse(a);this.clearBackupCheck(),Fe(),this.emit("success",c),this.stateMachine.transition("authenticated"),this.config.continuousMode?setTimeout(()=>{this.stateMachine.transition("idle"),this.start();},1500):this.stateMachine.transition("idle");}catch(e){console.debug("Session check failed:",e),this.fail(new Error("Session check failed")),this.restartIfContinuous();return}}async emitQRCode(n){let e=`${n}?sessionID=${encodeURIComponent(this.sessionId)}&sessionKey=${encodeURIComponent(this.sessionKey)}&publicKey=${encodeURIComponent(this.config.publicKey)}&authType=${this.config.authType}&projectId=${encodeURIComponent(this.config.projectId)}`,i=await uo.default.toDataURL(e,{type:"image/png",scale:3,color:{light:"#ffffff",dark:"#424242ff"}});this.emit("qr",i);}async emitDeepLink(n){let e=`${n}?sessionID=${encodeURIComponent(this.sessionId)}&sessionKey=${encodeURIComponent(this.sessionKey)}&publicKey=${encodeURIComponent(this.config.publicKey)}&authType=${this.config.authType}&projectId=${encodeURIComponent(this.config.projectId)}`;this.emit("deeplink",e);}attachVisibilityRecovery(){let n=false;this.visibilityHandler=async()=>{document.visibilityState==="visible"&&(this.useWebSocket||n||(n=true,await this.checkSession()));},document.addEventListener("visibilitychange",this.visibilityHandler);}detachVisibilityRecovery(){this.visibilityHandler&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=void 0);}async fetchRelayUrl(){let{publicKey:n,projectId:e,authType:i}=this.config,a=await fetch(`${_r}/relay?public_key=${n}&auth_type=${i}&project_id=${e}`);if(!a.ok){let u=await a.text();throw new Error(u)}let c=await a.json();return {deeplinkUrl:c.deeplink_url,relayUrl:c.relay_url}}terminate(n){this.clearBackupCheck(),this.transport&&(n||this.transport.send({type:"client-terminated",sessionID:this.sessionId,projectId:this.config.projectId,publicKey:this.config.publicKey,authType:this.config.authType}),this.transport.close(),this.transport=void 0),Fe(),this.resetSession(),this.config.continuousMode||this.detachVisibilityRecovery(),this.stateMachine.transition(n?"confirmed":"idle");}restartIfContinuous(){this.config.continuousMode?(this.stateMachine.transition("idle"),this.clearBackupCheck(),this.transport?.close(),this.transport=void 0,setTimeout(()=>{this.start();},150)):this.stateMachine.transition("idle");}resetSession(){this.sessionId="",this.sessionKey=null;}emit(n,e){this.listeners[n]?.forEach(i=>i(e));}fail(n){this.emit("error",n),this.stateMachine.transition("error");}};Lt.BASEURL=_r;Lt.CryptoService=Wn;Lt.PelicanAuthentication=mo;Lt.StateMachine=Qn;Lt.Transport=Gn;Lt.clearAllAuthData=po;Lt.clearAuthSession=Fe;Lt.getAuthSession=Zn;Lt.storeAuthSession=Jn;});var ti=pi(Xn());function wo(){if(document.getElementById("pelican-auth-styles"))return;let n=document.createElement("style");n.id="pelican-auth-styles",n.textContent=`
7
+ `);let p=to(e,i,c),y=qe.getSymbolSize(e),E=new Ki(y);return Ji(E,e),Zi(E),Qi(E,e),br(E,i,0),e>=7&&Gi(E,e),Xi(E,p),isNaN(a)&&(a=mr.getBestMask(E,br.bind(null,E,i))),mr.applyMask(a,E),br(E,i,a),{modules:E,version:e,errorCorrectionLevel:i,maskPattern:a,segments:c}}jn.create=function(e,i){if(typeof e>"u"||e==="")throw new Error("No input text");let a=gr.M,c,u;return typeof i<"u"&&(a=gr.from(i.errorCorrectionLevel,gr.M),c=Oe.from(i.version),u=mr.from(i.maskPattern),i.toSJISFunc&&qe.setToSJISFunction(i.toSJISFunc)),ro(e,c,a,u)};});var vr=et(Vt=>{function On(n){if(typeof n=="number"&&(n=n.toString()),typeof n!="string")throw new Error("Color should be defined as hex string");let e=n.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8)throw new Error("Invalid hex color: "+n);(e.length===3||e.length===4)&&(e=Array.prototype.concat.apply([],e.map(function(a){return [a,a]}))),e.length===6&&e.push("F","F");let i=parseInt(e.join(""),16);return {r:i>>24&255,g:i>>16&255,b:i>>8&255,a:i&255,hex:"#"+e.slice(0,6).join("")}}Vt.getOptions=function(e){e||(e={}),e.color||(e.color={});let i=typeof e.margin>"u"||e.margin===null||e.margin<0?4:e.margin,a=e.width&&e.width>=21?e.width:void 0,c=e.scale||4;return {width:a,scale:a?4:c,margin:i,color:{dark:On(e.color.dark||"#000000ff"),light:On(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};Vt.getScale=function(e,i){return i.width&&i.width>=e+i.margin*2?i.width/(e+i.margin*2):i.scale};Vt.getImageWidth=function(e,i){let a=Vt.getScale(e,i);return Math.floor((e+i.margin*2)*a)};Vt.qrToImageData=function(e,i,a){let c=i.modules.size,u=i.modules.data,p=Vt.getScale(c,a),y=Math.floor((c+a.margin*2)*p),E=a.margin*p,z=[a.color.light,a.color.dark];for(let q=0;q<y;q++)for(let st=0;st<y;st++){let nt=(q*y+st)*4,bt=a.color.light;if(q>=E&&st>=E&&q<y-E&&st<y-E){let mt=Math.floor((q-E)/p),vt=Math.floor((st-E)/p);bt=z[u[mt*c+vt]?1:0];}e[nt++]=bt.r,e[nt++]=bt.g,e[nt++]=bt.b,e[nt]=bt.a;}};});var qn=et(Ye=>{var Er=vr();function no(n,e,i){n.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=i,e.width=i,e.style.height=i+"px",e.style.width=i+"px";}function io(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}Ye.render=function(e,i,a){let c=a,u=i;typeof c>"u"&&(!i||!i.getContext)&&(c=i,i=void 0),i||(u=io()),c=Er.getOptions(c);let p=Er.getImageWidth(e.modules.size,c),y=u.getContext("2d"),E=y.createImageData(p,p);return Er.qrToImageData(E.data,e,c),no(y,u,p),y.putImageData(E,0,0),u};Ye.renderToDataURL=function(e,i,a){let c=a;typeof c>"u"&&(!i||!i.getContext)&&(c=i,i=void 0),c||(c={});let u=Ye.render(e,i,c),p=c.type||"image/png",y=c.rendererOpts||{};return u.toDataURL(p,y.quality)};});var Fn=et(Kn=>{var oo=vr();function Yn(n,e){let i=n.a/255,a=e+'="'+n.hex+'"';return i<1?a+" "+e+'-opacity="'+i.toFixed(2).slice(1)+'"':a}function Cr(n,e,i){let a=n+e;return typeof i<"u"&&(a+=" "+i),a}function so(n,e,i){let a="",c=0,u=false,p=0;for(let y=0;y<n.length;y++){let E=Math.floor(y%e),z=Math.floor(y/e);!E&&!u&&(u=true),n[y]?(p++,y>0&&E>0&&n[y-1]||(a+=u?Cr("M",E+i,.5+z+i):Cr("m",c,0),c=0,u=false),E+1<e&&n[y+1]||(a+=Cr("h",p),p=0)):c++;}return a}Kn.render=function(e,i,a){let c=oo.getOptions(i),u=e.modules.size,p=e.modules.data,y=u+c.margin*2,E=c.color.light.a?"<path "+Yn(c.color.light,"fill")+' d="M0 0h'+y+"v"+y+'H0z"/>':"",z="<path "+Yn(c.color.dark,"stroke")+' d="'+so(p,u,c.margin)+'"/>',q='viewBox="0 0 '+y+" "+y+'"',nt='<svg xmlns="http://www.w3.org/2000/svg" '+(c.width?'width="'+c.width+'" height="'+c.width+'" ':"")+q+' shape-rendering="crispEdges">'+E+z+`</svg>
8
+ `;return typeof a=="function"&&a(null,nt),nt};});var Hn=et(ve=>{var fo=Vr(),Ar=zn(),$n=qn(),ao=Fn();function Sr(n,e,i,a,c){let u=[].slice.call(arguments,1),p=u.length,y=typeof u[p-1]=="function";if(!y&&!fo())throw new Error("Callback required as last argument");if(y){if(p<2)throw new Error("Too few arguments provided");p===2?(c=i,i=e,e=a=void 0):p===3&&(e.getContext&&typeof c>"u"?(c=a,a=void 0):(c=a,a=i,i=e,e=void 0));}else {if(p<1)throw new Error("Too few arguments provided");return p===1?(i=e,e=a=void 0):p===2&&!e.getContext&&(a=i,i=e,e=void 0),new Promise(function(E,z){try{let q=Ar.create(i,a);E(n(q,e,a));}catch(q){z(q);}})}try{let E=Ar.create(i,a);c(null,n(E,e,a));}catch(E){c(E);}}ve.create=Ar.create;ve.toCanvas=Sr.bind(null,$n.render);ve.toDataURL=Sr.bind(null,$n.renderToDataURL);ve.toString=Sr.bind(null,function(n,e,i){return ao.render(n,i)});});var Xn=et(Lt=>{var co=Kr(),Wt=$r(),lo=Hn();function Vn(n){return n&&n.__esModule?n:{default:n}}var Ke=Vn(co),uo=Vn(lo),Wn=class{generateSymmetricKey(){let n=Ke.default.randomBytes(32);return Wt.encodeBase64(n)}encryptSymmetric({plaintext:n,keyString:e}){let i=Wt.decodeBase64(e),a=Ke.default.randomBytes(24),c=new TextEncoder().encode(n),u=Ke.default.secretbox(c,a,i);return {cipher:Wt.encodeBase64(u),nonce:Wt.encodeBase64(a)}}decryptSymmetric({encrypted:n,keyString:e}){try{let i=Wt.decodeBase64(e),a=Wt.decodeBase64(n.cipher),c=Wt.decodeBase64(n.nonce),u=Ke.default.secretbox.open(a,c,i);if(!u)throw new Error("Decryption failed - invalid key or corrupted data");return new TextDecoder().decode(u)}catch(i){return console.error("Decryption failed",i),null}}},ho=Wn,xo=class{constructor(){this.prefix="pelican_auth_",this.defaultTTL=300*1e3,this.memoryCache=new Map;}set(n,e,i={}){let{ttlMs:a=this.defaultTTL,useSessionStorage:c=true}=i,u=Date.now()+a,p={value:e,expiresAt:u};if(c)try{sessionStorage.setItem(`${this.prefix}${n}`,JSON.stringify(p));}catch(y){console.warn("SessionStorage unavailable, using memory:",y),this.setMemory(n,p);}else this.setMemory(n,p);}get(n){try{let e=sessionStorage.getItem(`${this.prefix}${n}`);if(e){let i=JSON.parse(e);return Date.now()>i.expiresAt?(this.remove(n),null):i.value}}catch{}return this.getMemory(n)}remove(n){try{sessionStorage.removeItem(`${this.prefix}${n}`);}catch{}this.memoryCache.delete(n);}clear(){try{Object.keys(sessionStorage).forEach(n=>{n.startsWith(this.prefix)&&sessionStorage.removeItem(n);});}catch{}this.memoryCache.clear();}setMemory(n,e){this.memoryCache.set(n,e);let i=e.expiresAt-Date.now();setTimeout(()=>{this.memoryCache.delete(n);},i);}getMemory(n){let e=this.memoryCache.get(n);return e?Date.now()>e.expiresAt?(this.memoryCache.delete(n),null):e.value:null}},$e=new xo,Jn=(n,e,i)=>{$e.set("session",{sessionId:n,sessionKey:e},{ttlMs:i});},Zn=()=>$e.get("session"),Fe=()=>{$e.remove("session");},po=()=>{$e.clear();},Qn=class{constructor(){this.state="idle",this.listeners=new Set;}get current(){return this.state}transition(n){this.state=n,this.listeners.forEach(e=>e(n));}subscribe(n){return this.listeners.add(n),()=>this.listeners.delete(n)}},Gn=class{constructor(n){this.reconnectAttempts=0,this.maxReconnectAttempts=3,this.isExplicitlyClosed=false,this.isReconnecting=false,this.handlers=n;}connect(n){this.url=n,this.isExplicitlyClosed=false,this.socket&&(this.socket.onclose=null,this.socket.onerror=null,this.socket.onmessage=null,this.socket.onopen=null,(this.socket.readyState===WebSocket.OPEN||this.socket.readyState===WebSocket.CONNECTING)&&this.socket.close()),this.socket=new WebSocket(n),this.socket.onopen=()=>{this.reconnectAttempts=0,this.isReconnecting=false,this.handlers.onOpen?.();},this.socket.onmessage=e=>{try{let i=JSON.parse(e.data);this.handlers.onMessage?.(i);}catch(i){console.error("Failed to parse WebSocket message",i);}},this.socket.onerror=e=>{!this.isReconnecting&&!this.isExplicitlyClosed&&this.handlers.onError?.(e);},this.socket.onclose=e=>{this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0),this.isReconnecting||this.handlers.onClose?.(e),!this.isExplicitlyClosed&&!this.isReconnecting&&this.reconnectAttempts<this.maxReconnectAttempts&&this.attemptReconnect();};}attemptReconnect(){if(this.reconnectAttempts>=this.maxReconnectAttempts){console.warn("Max WebSocket reconnect attempts reached");return}this.isReconnecting=true,this.reconnectAttempts++;let n=Math.min(Math.pow(2,this.reconnectAttempts-1)*500,2e3);console.log(`Reconnecting WebSocket (attempt ${this.reconnectAttempts}/${this.maxReconnectAttempts}) in ${n}ms...`),this.reconnectTimeout=window.setTimeout(()=>{this.url&&!this.isExplicitlyClosed&&this.connect(this.url);},n);}send(n){if(this.socket?.readyState===WebSocket.OPEN)try{this.socket.send(JSON.stringify(n));}catch(e){console.error("Failed to send WebSocket message:",e);}else console.warn("WebSocket not open, message not sent:",this.socket?.readyState);}close(){this.isExplicitlyClosed=true,this.isReconnecting=false,this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0),this.socket&&(this.socket.onclose=null,this.socket.onerror=null,this.socket.onmessage=null,this.socket.onopen=null,(this.socket.readyState===WebSocket.OPEN||this.socket.readyState===WebSocket.CONNECTING)&&this.socket.close(),this.socket=void 0);}get readyState(){return this.socket?.readyState}get isOpen(){return this.socket?.readyState===WebSocket.OPEN}},_r="https://identityapi.pelicanidentity.com",go="https://apps.apple.com/us/app/pelican-vault/id6755097751",yo="https://play.google.com/store/apps/details?id=com.HeraculesDesignTechLtd.pelican",bo="https://pelicanidentity.com/pelican-vault",mo=class{constructor(n){if(this.crypto=new ho,this.stateMachine=new Qn,this.sessionId="",this.sessionKey=null,this.MAX_POLLING_DURATION=120*1e3,this.INITIAL_DELAY=2e3,this.MAX_DELAY=1e4,this.pollingStartTime=0,this.useWebSocket=true,this.deeplinkUrl=null,this.fallbackTimer=null,this.listeners={},this.pollingTimeout=null,!n.publicKey)throw new Error("Missing publicKey");if(!n.projectId)throw new Error("Missing projectId");if(!n.authType)throw new Error("Missing authType");this.config={continuousMode:false,forceQRCode:false,...n},this.stateMachine.subscribe(e=>this.emit("state",e));}on(n,e){var i;return (i=this.listeners)[n]??(i[n]=new Set),this.listeners[n].add(e),()=>this.listeners[n].delete(e)}async start(){if(this.config.authType!=="id-verification"&&this.config.authType!=="signup"&&this.config.authType!=="login"){this.fail(new Error("Invalid authType"));return}if(!this.config.projectId){this.fail(new Error("Missing projectId"));return}if(!this.config.publicKey){this.fail(new Error("Missing publicKey"));return}if(this.stateMachine.current==="idle"){this.resetSession(),Fe(),this.stateMachine.transition("initializing");try{this.sessionKey=this.crypto.generateSymmetricKey(),this.sessionId=crypto.randomUUID()+crypto.randomUUID(),this.useWebSocket=this.shouldUseWebSocket(),this.useWebSocket?await this.startWebSocketFlow():await this.startDeepLinkFlow();}catch(n){this.fail(n instanceof Error?n:new Error("Start failed"));}}}stop(){this.terminate(false);}openWebAuth(){if(!this.sessionKey||!this.sessionId){this.fail(new Error("No active session. Call start() before openWebAuth()."));return}let n=window.location.origin,i=`https://vault.pelicanidentity.com/auth?${new URLSearchParams({projectId:this.config.projectId,publicKey:this.config.publicKey,authType:this.config.authType,sessionId:this.sessionId,sessionKey:this.sessionKey,origin:n}).toString()}`,a=window.open(i,"pelican-auth","width=480,height=640,left=400,top=100,resizable=no,scrollbars=no")??window.open(i,"_blank");if(!a){this.fail(new Error("Unable to open authentication window. Please allow popups for this site and try again."));return}this.detachVisibilityRecovery(),this.transport?.close(),this.transport=void 0,a.focus(),this.stateMachine.transition("awaiting-pair");let c=()=>{window.removeEventListener("message",u),clearInterval(p);},u=y=>{if(y.origin!=="https://vault.pelicanidentity.com"||y.source!==a)return;let{type:E,payload:z}=y.data??{};if(E==="pelican-auth-success"){if(console.log("Web auth success"),c(),!z?.cipher||!z?.nonce){this.fail(new Error("Invalid web auth payload")),this.restartIfContinuous();return}try{let q=this.crypto.decryptSymmetric({encrypted:{cipher:z.cipher,nonce:z.nonce},keyString:this.sessionKey});if(!q){this.fail(new Error("Failed to decrypt web auth response")),this.restartIfContinuous();return}let st=JSON.parse(q);this.emit("success",st),this.stateMachine.transition("authenticated"),this.restartIfContinuous();}catch{this.fail(new Error("Failed to decrypt web auth response")),this.restartIfContinuous();}}E==="pelican-auth-cancelled"&&(c(),this.fail(new Error("Authentication cancelled")),this.restartIfContinuous()),E==="pelican-auth-error"&&(c(),this.fail(new Error(z?.message??"Web auth failed")),this.restartIfContinuous());};window.addEventListener("message",u);let p=setInterval(()=>{a.closed&&(c(),["authenticated","confirmed","error"].includes(this.stateMachine.current)||(this.fail(new Error("Authentication window closed")),this.restartIfContinuous()));},500);}destroy(){this.detachVisibilityRecovery(),this.clearBackupCheck(),this.transport?.close(),this.transport=void 0,this.listeners={};}useQrInstead(){this.useWebSocket=true,this.emit("deeplink",""),this.stateMachine.transition("initializing"),this.startWebSocketFlow();}useDeepLinkInstead(){this.useWebSocket=false,this.stateMachine.transition("initializing"),this.startDeepLinkFlow();}shouldUseWebSocket(){let n=navigator.userAgent,e=/(iPad|Android(?!.*Mobile))/i.test(n),a=/Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(n)&&!e;return this.config.forceQRCode||!a}async startWebSocketFlow(){let{relayUrl:n,deeplinkUrl:e}=await this.fetchRelayUrl();this.transport=new Gn({onOpen:()=>{this.transport.send({type:"register",sessionID:this.sessionId,...this.config}),this.stateMachine.transition("awaiting-pair");},onMessage:i=>this.handleWebSocketMessage(i),onError:i=>{console.error("WebSocket error:",i),this.fail(new Error("WebSocket connection failed"));}}),this.transport.connect(n),await this.emitQRCode(e);}handleWebSocketMessage(n){switch(n.type){case "paired":this.stateMachine.transition("paired"),this.transport.send({type:"authenticate",sessionID:this.sessionId,...this.config,url:window.location.href});return;case "phone-auth-success":this.handleAuthSuccess(n);return;case "phone-terminated":this.fail(new Error("Authentication cancelled on device")),this.restartIfContinuous();return;case "confirmed":this.terminate(true),this.restartIfContinuous();return}}handleAuthSuccess(n){if(!this.sessionKey||!n.cipher||!n.nonce){this.fail(new Error("Invalid authentication payload")),this.restartIfContinuous();return}try{let e=this.crypto.decryptSymmetric({encrypted:{cipher:n.cipher,nonce:n.nonce},keyString:this.sessionKey});if(!e){this.fail(new Error("Invalid authentication data")),this.restartIfContinuous();return}let i=JSON.parse(e);this.emit("success",i),this.stateMachine.transition("authenticated"),this.transport?.send({type:"confirm",sessionID:this.sessionId});}catch{this.fail(new Error("Failed to decrypt authentication data")),this.restartIfContinuous();}}async startDeepLinkFlow(){let{deeplinkUrl:n}=await this.fetchRelayUrl();this.sessionKey&&Jn(this.sessionId,this.sessionKey,10*6e4),await this.emitDeepLink(n),this.stateMachine.transition("awaiting-pair");}openDeepLink(){if(!this.deeplinkUrl){this.fail(new Error("Deep link not found"));return}let n=navigator.userAgent,e=bo;/iPad|iPhone|iPod/.test(n)?e=go:/android/i.test(n)&&(e=yo);let i=Date.now();this.fallbackTimer=setTimeout(()=>{Date.now()-i<3500&&(window.location.href=e);},3e3),this.attachVisibilityRecovery(),window.location.href=this.deeplinkUrl;}clearBackupCheck(){this.backupCheckTimeout&&(clearTimeout(this.backupCheckTimeout),this.backupCheckTimeout=void 0);}async checkSession(){let n=Zn();if(!n){this.fail(new Error("Authentication session not found")),this.restartIfContinuous();return}this.stopPolling(),this.pollingStartTime=Date.now(),this.stateMachine.transition("awaiting-auth");let e=this.INITIAL_DELAY,i=async()=>{if(Date.now()-this.pollingStartTime>this.MAX_POLLING_DURATION){this.stopPolling(),this.fail(new Error("Authentication timed out. Please try again."));return}try{let a=await fetch(`${_r}/session?session_id=${n.sessionId}`);if(a.ok){let c=await a.json(),u=this.crypto.decryptSymmetric({encrypted:{cipher:c.cipher,nonce:c.nonce},keyString:n.sessionKey});if(!u){this.stopPolling(),this.fail(new Error("Failed to decrypt session"));return}this.stopPolling(),this.clearBackupCheck(),Fe();let p=JSON.parse(u);this.emit("success",p),this.stateMachine.transition("authenticated"),this.restartIfContinuous();return}console.debug("Session not ready yet...");}catch(a){console.debug("Network error during session check, retrying:",a);}this.stateMachine.current==="awaiting-auth"&&(this.pollingTimeout=setTimeout(()=>{e=Math.min(e*1.5,this.MAX_DELAY),i();},e));};await i();}stopPolling(){this.pollingTimeout&&(clearTimeout(this.pollingTimeout),this.pollingTimeout=null);}async emitQRCode(n){let e=`${n}?sessionID=${encodeURIComponent(this.sessionId)}&sessionKey=${encodeURIComponent(this.sessionKey)}&publicKey=${encodeURIComponent(this.config.publicKey)}&authType=${this.config.authType}&projectId=${encodeURIComponent(this.config.projectId)}`,i=await uo.default.toDataURL(e,{type:"image/png",scale:3,color:{light:"#ffffff",dark:"#424242ff"}});this.emit("qr",i);}async emitDeepLink(n){let e=`${n}?sessionID=${encodeURIComponent(this.sessionId)}&sessionKey=${encodeURIComponent(this.sessionKey)}&publicKey=${encodeURIComponent(this.config.publicKey)}&authType=${this.config.authType}&projectId=${encodeURIComponent(this.config.projectId)}`;this.deeplinkUrl=e,this.emit("deeplink",e);}attachVisibilityRecovery(){let n=false;this.visibilityHandler=async()=>{this.fallbackTimer&&(clearTimeout(this.fallbackTimer),this.fallbackTimer=null),document.visibilityState==="visible"&&(this.useWebSocket||n||(n=true,await this.checkSession()));},document.addEventListener("visibilitychange",this.visibilityHandler);}detachVisibilityRecovery(){this.visibilityHandler&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=void 0);}async fetchRelayUrl(){let{publicKey:n,projectId:e,authType:i}=this.config,a=await fetch(`${_r}/relay?public_key=${n}&auth_type=${i}&project_id=${e}`);if(!a.ok){let u=await a.text();throw new Error(u)}let c=await a.json();return {deeplinkUrl:c.deeplink_url,relayUrl:c.relay_url}}terminate(n){this.clearBackupCheck(),this.transport&&(n||this.transport.send({type:"client-terminated",sessionID:this.sessionId,projectId:this.config.projectId,publicKey:this.config.publicKey,authType:this.config.authType}),this.transport.close(),this.transport=void 0),Fe(),this.resetSession(),this.config.continuousMode||this.detachVisibilityRecovery(),this.stateMachine.transition(n?"confirmed":"idle");}restartIfContinuous(){this.config.continuousMode?(this.stateMachine.transition("idle"),this.clearBackupCheck(),this.transport?.close(),this.transport=void 0,setTimeout(()=>{this.start();},150)):this.stateMachine.transition("idle");}resetSession(){this.sessionId="",this.sessionKey=null;}emit(n,e){this.listeners[n]?.forEach(i=>i(e));}fail(n){this.emit("error",n),this.stateMachine.transition("error");}};Lt.BASEURL=_r;Lt.CryptoService=Wn;Lt.PelicanAuthentication=mo;Lt.StateMachine=Qn;Lt.Transport=Gn;Lt.clearAllAuthData=po;Lt.clearAuthSession=Fe;Lt.getAuthSession=Zn;Lt.storeAuthSession=Jn;});var ti=pi(Xn());function wo(){if(document.getElementById("pelican-auth-styles"))return;let n=document.createElement("style");n.id="pelican-auth-styles",n.textContent=`
9
9
  /* Pelican Auth Button Wrapper Styles */
10
10
  .pelican-auth-btn-wrapper * {
11
11
  box-sizing: border-box;
@@ -460,7 +460,7 @@ Minimum version required to store current data is: `+u+`.
460
460
  .store-icon-button:hover {
461
461
  background-color: #f5f5f5 !important;
462
462
  }
463
- `,document.head.appendChild(n);}function ei(n,e){wo();let i=document.getElementById(n);if(!i)throw new Error(`Container with id "${n}" not found`);let a=new ti.PelicanAuthentication(e),c={isOpen:e.continuousMode||false,qr:null,deeplink:null,authState:"idle",successMessage:null,error:null},u={isProcessing:()=>["initializing","paired","awaiting-auth"].includes(c.authState),showMobileAuth:()=>!e.forceQRCode&&!!c.deeplink,showQRView:()=>e.forceQRCode&&!!c.qr&&c.authState==="awaiting-pair"||!e.forceQRCode&&!!c.qr&&c.authState==="awaiting-pair",successText:()=>`${e.authType==="login"?"login":e.authType==="signup"?"signup":e.authType==="id-verification"?"verification":"authentication"} complete!`},g=[a.on("qr",ft=>{c.qr=ft,y();}),a.on("deeplink",ft=>{c.deeplink=ft,y();}),a.on("state",ft=>{c.authState=ft,y();}),a.on("success",ft=>{e.onSuccess(ft),e.continuousMode?(c.successMessage=u.successText(),y(),setTimeout(()=>{c.successMessage=null,y();},2e3)):(c.isOpen=false,y());}),a.on("error",ft=>{c.error=ft,e.onError?.(ft),y();})];function y(){if(!i)return;let ft=E();i.innerHTML=ft,wt();}function E(){return `
463
+ `,document.head.appendChild(n);}function ei(n,e){wo();let i=document.getElementById(n);if(!i)throw new Error(`Container with id "${n}" not found`);let a=new ti.PelicanAuthentication(e),c={isOpen:e.continuousMode||false,qr:null,deeplink:null,authState:"idle",successMessage:null,error:null},u={isProcessing:()=>["initializing","paired","awaiting-auth"].includes(c.authState),showMobileAuth:()=>!e.forceQRCode&&!!c.deeplink,showQRView:()=>e.forceQRCode&&!!c.qr&&c.authState==="awaiting-pair"||!e.forceQRCode&&!!c.qr&&c.authState==="awaiting-pair",successText:()=>`${e.authType==="login"?"login":e.authType==="signup"?"signup":e.authType==="id-verification"?"verification":"authentication"} complete!`},p=[a.on("qr",ft=>{c.qr=ft,y();}),a.on("deeplink",ft=>{c.deeplink=ft,y();}),a.on("state",ft=>{c.authState=ft,y();}),a.on("success",ft=>{e.onSuccess(ft),e.continuousMode?(c.successMessage=u.successText(),y(),setTimeout(()=>{c.successMessage=null,y();},2e3)):(c.isOpen=false,y());}),a.on("error",ft=>{c.error=ft,e.onError?.(ft),y();})];function y(){if(!i)return;let ft=E();i.innerHTML=ft,wt();}function E(){return `
464
464
  <section style="max-width: 520px; width: 100%;">
465
465
  ${z()}
466
466
  ${q()}
@@ -616,5 +616,5 @@ Minimum version required to store current data is: `+u+`.
616
616
  </a>
617
617
  </div>
618
618
  </div>
619
- `}function wt(){let ft=document.getElementById("pelican-start-btn");ft&&ft.addEventListener("click",_t);let Ut=document.getElementById("pelican-stop-btn");Ut&&Ut.addEventListener("click",Nt);let Zt=document.getElementById("pelican-web-auth-btn");Zt&&Zt.addEventListener("click",Jt);let Ct=document.getElementById("pelican-use-qr-btn");Ct&&Ct.addEventListener("click",ce);let Qt=document.getElementById("pelican-open-deeplink-btn");Qt&&Qt.addEventListener("click",ae);}function _t(){a.start(),c.isOpen=true,y();}function Nt(){a.stop(),e.onClose?.(),c.isOpen=false,y();}function ae(){a.openDeepLink(),y();}function Jt(){a.openWebAuth(),c.isOpen=true,y();}function ce(){a.useQrInstead(),y();}return y(),e.continuousMode&&a.start(),function(){g.forEach(Ut=>Ut()),a.destroy(),i.innerHTML="";}}typeof window<"u"&&(window.Pelican={createPelicanAuth:ei});exports.createPelicanAuth=ei;return exports;})({});//# sourceMappingURL=index.min.js.map
619
+ `}function wt(){let ft=document.getElementById("pelican-start-btn");ft&&ft.addEventListener("click",_t);let Ut=document.getElementById("pelican-stop-btn");Ut&&Ut.addEventListener("click",Nt);let Zt=document.getElementById("pelican-web-auth-btn");Zt&&Zt.addEventListener("click",Jt);let Ct=document.getElementById("pelican-use-qr-btn");Ct&&Ct.addEventListener("click",ce);let Qt=document.getElementById("pelican-open-deeplink-btn");Qt&&Qt.addEventListener("click",ae);}function _t(){a.start(),c.isOpen=true,y();}function Nt(){a.stop(),e.onClose?.(),c.isOpen=false,y();}function ae(){a.openDeepLink(),y();}function Jt(){a.openWebAuth(),c.isOpen=true,y();}function ce(){a.useQrInstead(),y();}return y(),e.continuousMode&&a.start(),function(){p.forEach(Ut=>Ut()),a.destroy(),i.innerHTML="";}}typeof window<"u"&&(window.Pelican={createPelicanAuth:ei});exports.createPelicanAuth=ei;return exports;})({});//# sourceMappingURL=index.min.js.map
620
620
  //# sourceMappingURL=index.min.js.map