@aptos-labs/ts-sdk 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- "use strict";var aptosSDK=(()=>{var fd=Object.create;var to=Object.defineProperty;var qa=Object.getOwnPropertyDescriptor;var ld=Object.getOwnPropertyNames;var dd=Object.getPrototypeOf,pd=Object.prototype.hasOwnProperty;var Na=(r=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(r,{get:(e,t)=>(typeof require!="undefined"?require:e)[t]}):r)(function(r){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+r+'" is not supported')});var ce=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Da=(r,e)=>{for(var t in e)to(r,t,{get:e[t],enumerable:!0})},Ma=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ld(e))!pd.call(r,o)&&o!==t&&to(r,o,{get:()=>e[o],enumerable:!(n=qa(e,o))||n.enumerable});return r};var oi=(r,e,t)=>(t=r!=null?fd(dd(r)):{},Ma(e||!r||!r.__esModule?to(t,"default",{value:r,enumerable:!0}):t,r)),hd=r=>Ma(to({},"__esModule",{value:!0}),r),Ar=(r,e,t,n)=>{for(var o=n>1?void 0:n?qa(e,t):e,i=r.length-1,a;i>=0;i--)(a=r[i])&&(o=(n?a(e,t,o):a(o))||o);return n&&o&&to(e,t,o),o};var pc=ce(()=>{});var hc=ce((wy,os)=>{(function(r){"use strict";var e=function(c){var l,f=new Float64Array(16);if(c)for(l=0;l<c.length;l++)f[l]=c[l];return f},t=function(){throw new Error("no PRNG")},n=new Uint8Array(16),o=new Uint8Array(32);o[0]=9;var i=e(),a=e([1]),u=e([56129,1]),d=e([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),h=e([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),x=e([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),y=e([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),T=e([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function E(c,l,f,s){c[l]=f>>24&255,c[l+1]=f>>16&255,c[l+2]=f>>8&255,c[l+3]=f&255,c[l+4]=s>>24&255,c[l+5]=s>>16&255,c[l+6]=s>>8&255,c[l+7]=s&255}function I(c,l,f,s,p){var m,b=0;for(m=0;m<p;m++)b|=c[l+m]^f[s+m];return(1&b-1>>>8)-1}function A(c,l,f,s){return I(c,l,f,s,16)}function v(c,l,f,s){return I(c,l,f,s,32)}function k(c,l,f,s){for(var p=s[0]&255|(s[1]&255)<<8|(s[2]&255)<<16|(s[3]&255)<<24,m=f[0]&255|(f[1]&255)<<8|(f[2]&255)<<16|(f[3]&255)<<24,b=f[4]&255|(f[5]&255)<<8|(f[6]&255)<<16|(f[7]&255)<<24,U=f[8]&255|(f[9]&255)<<8|(f[10]&255)<<16|(f[11]&255)<<24,z=f[12]&255|(f[13]&255)<<8|(f[14]&255)<<16|(f[15]&255)<<24,V=s[4]&255|(s[5]&255)<<8|(s[6]&255)<<16|(s[7]&255)<<24,q=l[0]&255|(l[1]&255)<<8|(l[2]&255)<<16|(l[3]&255)<<24,Se=l[4]&255|(l[5]&255)<<8|(l[6]&255)<<16|(l[7]&255)<<24,G=l[8]&255|(l[9]&255)<<8|(l[10]&255)<<16|(l[11]&255)<<24,re=l[12]&255|(l[13]&255)<<8|(l[14]&255)<<16|(l[15]&255)<<24,oe=s[8]&255|(s[9]&255)<<8|(s[10]&255)<<16|(s[11]&255)<<24,pe=f[16]&255|(f[17]&255)<<8|(f[18]&255)<<16|(f[19]&255)<<24,de=f[20]&255|(f[21]&255)<<8|(f[22]&255)<<16|(f[23]&255)<<24,se=f[24]&255|(f[25]&255)<<8|(f[26]&255)<<16|(f[27]&255)<<24,ae=f[28]&255|(f[29]&255)<<8|(f[30]&255)<<16|(f[31]&255)<<24,ie=s[12]&255|(s[13]&255)<<8|(s[14]&255)<<16|(s[15]&255)<<24,L=p,Y=m,D=b,j=U,K=z,H=V,w=q,_=Se,R=G,S=re,C=oe,O=pe,ee=de,he=se,xe=ae,ge=ie,g,we=0;we<20;we+=2)g=L+ee|0,K^=g<<7|g>>>32-7,g=K+L|0,R^=g<<9|g>>>32-9,g=R+K|0,ee^=g<<13|g>>>32-13,g=ee+R|0,L^=g<<18|g>>>32-18,g=H+Y|0,S^=g<<7|g>>>32-7,g=S+H|0,he^=g<<9|g>>>32-9,g=he+S|0,Y^=g<<13|g>>>32-13,g=Y+he|0,H^=g<<18|g>>>32-18,g=C+w|0,xe^=g<<7|g>>>32-7,g=xe+C|0,D^=g<<9|g>>>32-9,g=D+xe|0,w^=g<<13|g>>>32-13,g=w+D|0,C^=g<<18|g>>>32-18,g=ge+O|0,j^=g<<7|g>>>32-7,g=j+ge|0,_^=g<<9|g>>>32-9,g=_+j|0,O^=g<<13|g>>>32-13,g=O+_|0,ge^=g<<18|g>>>32-18,g=L+j|0,Y^=g<<7|g>>>32-7,g=Y+L|0,D^=g<<9|g>>>32-9,g=D+Y|0,j^=g<<13|g>>>32-13,g=j+D|0,L^=g<<18|g>>>32-18,g=H+K|0,w^=g<<7|g>>>32-7,g=w+H|0,_^=g<<9|g>>>32-9,g=_+w|0,K^=g<<13|g>>>32-13,g=K+_|0,H^=g<<18|g>>>32-18,g=C+S|0,O^=g<<7|g>>>32-7,g=O+C|0,R^=g<<9|g>>>32-9,g=R+O|0,S^=g<<13|g>>>32-13,g=S+R|0,C^=g<<18|g>>>32-18,g=ge+xe|0,ee^=g<<7|g>>>32-7,g=ee+ge|0,he^=g<<9|g>>>32-9,g=he+ee|0,xe^=g<<13|g>>>32-13,g=xe+he|0,ge^=g<<18|g>>>32-18;L=L+p|0,Y=Y+m|0,D=D+b|0,j=j+U|0,K=K+z|0,H=H+V|0,w=w+q|0,_=_+Se|0,R=R+G|0,S=S+re|0,C=C+oe|0,O=O+pe|0,ee=ee+de|0,he=he+se|0,xe=xe+ae|0,ge=ge+ie|0,c[0]=L>>>0&255,c[1]=L>>>8&255,c[2]=L>>>16&255,c[3]=L>>>24&255,c[4]=Y>>>0&255,c[5]=Y>>>8&255,c[6]=Y>>>16&255,c[7]=Y>>>24&255,c[8]=D>>>0&255,c[9]=D>>>8&255,c[10]=D>>>16&255,c[11]=D>>>24&255,c[12]=j>>>0&255,c[13]=j>>>8&255,c[14]=j>>>16&255,c[15]=j>>>24&255,c[16]=K>>>0&255,c[17]=K>>>8&255,c[18]=K>>>16&255,c[19]=K>>>24&255,c[20]=H>>>0&255,c[21]=H>>>8&255,c[22]=H>>>16&255,c[23]=H>>>24&255,c[24]=w>>>0&255,c[25]=w>>>8&255,c[26]=w>>>16&255,c[27]=w>>>24&255,c[28]=_>>>0&255,c[29]=_>>>8&255,c[30]=_>>>16&255,c[31]=_>>>24&255,c[32]=R>>>0&255,c[33]=R>>>8&255,c[34]=R>>>16&255,c[35]=R>>>24&255,c[36]=S>>>0&255,c[37]=S>>>8&255,c[38]=S>>>16&255,c[39]=S>>>24&255,c[40]=C>>>0&255,c[41]=C>>>8&255,c[42]=C>>>16&255,c[43]=C>>>24&255,c[44]=O>>>0&255,c[45]=O>>>8&255,c[46]=O>>>16&255,c[47]=O>>>24&255,c[48]=ee>>>0&255,c[49]=ee>>>8&255,c[50]=ee>>>16&255,c[51]=ee>>>24&255,c[52]=he>>>0&255,c[53]=he>>>8&255,c[54]=he>>>16&255,c[55]=he>>>24&255,c[56]=xe>>>0&255,c[57]=xe>>>8&255,c[58]=xe>>>16&255,c[59]=xe>>>24&255,c[60]=ge>>>0&255,c[61]=ge>>>8&255,c[62]=ge>>>16&255,c[63]=ge>>>24&255}function N(c,l,f,s){for(var p=s[0]&255|(s[1]&255)<<8|(s[2]&255)<<16|(s[3]&255)<<24,m=f[0]&255|(f[1]&255)<<8|(f[2]&255)<<16|(f[3]&255)<<24,b=f[4]&255|(f[5]&255)<<8|(f[6]&255)<<16|(f[7]&255)<<24,U=f[8]&255|(f[9]&255)<<8|(f[10]&255)<<16|(f[11]&255)<<24,z=f[12]&255|(f[13]&255)<<8|(f[14]&255)<<16|(f[15]&255)<<24,V=s[4]&255|(s[5]&255)<<8|(s[6]&255)<<16|(s[7]&255)<<24,q=l[0]&255|(l[1]&255)<<8|(l[2]&255)<<16|(l[3]&255)<<24,Se=l[4]&255|(l[5]&255)<<8|(l[6]&255)<<16|(l[7]&255)<<24,G=l[8]&255|(l[9]&255)<<8|(l[10]&255)<<16|(l[11]&255)<<24,re=l[12]&255|(l[13]&255)<<8|(l[14]&255)<<16|(l[15]&255)<<24,oe=s[8]&255|(s[9]&255)<<8|(s[10]&255)<<16|(s[11]&255)<<24,pe=f[16]&255|(f[17]&255)<<8|(f[18]&255)<<16|(f[19]&255)<<24,de=f[20]&255|(f[21]&255)<<8|(f[22]&255)<<16|(f[23]&255)<<24,se=f[24]&255|(f[25]&255)<<8|(f[26]&255)<<16|(f[27]&255)<<24,ae=f[28]&255|(f[29]&255)<<8|(f[30]&255)<<16|(f[31]&255)<<24,ie=s[12]&255|(s[13]&255)<<8|(s[14]&255)<<16|(s[15]&255)<<24,L=p,Y=m,D=b,j=U,K=z,H=V,w=q,_=Se,R=G,S=re,C=oe,O=pe,ee=de,he=se,xe=ae,ge=ie,g,we=0;we<20;we+=2)g=L+ee|0,K^=g<<7|g>>>32-7,g=K+L|0,R^=g<<9|g>>>32-9,g=R+K|0,ee^=g<<13|g>>>32-13,g=ee+R|0,L^=g<<18|g>>>32-18,g=H+Y|0,S^=g<<7|g>>>32-7,g=S+H|0,he^=g<<9|g>>>32-9,g=he+S|0,Y^=g<<13|g>>>32-13,g=Y+he|0,H^=g<<18|g>>>32-18,g=C+w|0,xe^=g<<7|g>>>32-7,g=xe+C|0,D^=g<<9|g>>>32-9,g=D+xe|0,w^=g<<13|g>>>32-13,g=w+D|0,C^=g<<18|g>>>32-18,g=ge+O|0,j^=g<<7|g>>>32-7,g=j+ge|0,_^=g<<9|g>>>32-9,g=_+j|0,O^=g<<13|g>>>32-13,g=O+_|0,ge^=g<<18|g>>>32-18,g=L+j|0,Y^=g<<7|g>>>32-7,g=Y+L|0,D^=g<<9|g>>>32-9,g=D+Y|0,j^=g<<13|g>>>32-13,g=j+D|0,L^=g<<18|g>>>32-18,g=H+K|0,w^=g<<7|g>>>32-7,g=w+H|0,_^=g<<9|g>>>32-9,g=_+w|0,K^=g<<13|g>>>32-13,g=K+_|0,H^=g<<18|g>>>32-18,g=C+S|0,O^=g<<7|g>>>32-7,g=O+C|0,R^=g<<9|g>>>32-9,g=R+O|0,S^=g<<13|g>>>32-13,g=S+R|0,C^=g<<18|g>>>32-18,g=ge+xe|0,ee^=g<<7|g>>>32-7,g=ee+ge|0,he^=g<<9|g>>>32-9,g=he+ee|0,xe^=g<<13|g>>>32-13,g=xe+he|0,ge^=g<<18|g>>>32-18;c[0]=L>>>0&255,c[1]=L>>>8&255,c[2]=L>>>16&255,c[3]=L>>>24&255,c[4]=H>>>0&255,c[5]=H>>>8&255,c[6]=H>>>16&255,c[7]=H>>>24&255,c[8]=C>>>0&255,c[9]=C>>>8&255,c[10]=C>>>16&255,c[11]=C>>>24&255,c[12]=ge>>>0&255,c[13]=ge>>>8&255,c[14]=ge>>>16&255,c[15]=ge>>>24&255,c[16]=w>>>0&255,c[17]=w>>>8&255,c[18]=w>>>16&255,c[19]=w>>>24&255,c[20]=_>>>0&255,c[21]=_>>>8&255,c[22]=_>>>16&255,c[23]=_>>>24&255,c[24]=R>>>0&255,c[25]=R>>>8&255,c[26]=R>>>16&255,c[27]=R>>>24&255,c[28]=S>>>0&255,c[29]=S>>>8&255,c[30]=S>>>16&255,c[31]=S>>>24&255}function B(c,l,f,s){k(c,l,f,s)}function Z(c,l,f,s){N(c,l,f,s)}var F=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function Q(c,l,f,s,p,m,b){var U=new Uint8Array(16),z=new Uint8Array(64),V,q;for(q=0;q<16;q++)U[q]=0;for(q=0;q<8;q++)U[q]=m[q];for(;p>=64;){for(B(z,U,b,F),q=0;q<64;q++)c[l+q]=f[s+q]^z[q];for(V=1,q=8;q<16;q++)V=V+(U[q]&255)|0,U[q]=V&255,V>>>=8;p-=64,l+=64,s+=64}if(p>0)for(B(z,U,b,F),q=0;q<p;q++)c[l+q]=f[s+q]^z[q];return 0}function J(c,l,f,s,p){var m=new Uint8Array(16),b=new Uint8Array(64),U,z;for(z=0;z<16;z++)m[z]=0;for(z=0;z<8;z++)m[z]=s[z];for(;f>=64;){for(B(b,m,p,F),z=0;z<64;z++)c[l+z]=b[z];for(U=1,z=8;z<16;z++)U=U+(m[z]&255)|0,m[z]=U&255,U>>>=8;f-=64,l+=64}if(f>0)for(B(b,m,p,F),z=0;z<f;z++)c[l+z]=b[z];return 0}function W(c,l,f,s,p){var m=new Uint8Array(32);Z(m,s,p,F);for(var b=new Uint8Array(8),U=0;U<8;U++)b[U]=s[U+16];return J(c,l,f,b,m)}function Te(c,l,f,s,p,m,b){var U=new Uint8Array(32);Z(U,m,b,F);for(var z=new Uint8Array(8),V=0;V<8;V++)z[V]=m[V+16];return Q(c,l,f,s,p,z,U)}var Ae=function(c){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 l,f,s,p,m,b,U,z;l=c[0]&255|(c[1]&255)<<8,this.r[0]=l&8191,f=c[2]&255|(c[3]&255)<<8,this.r[1]=(l>>>13|f<<3)&8191,s=c[4]&255|(c[5]&255)<<8,this.r[2]=(f>>>10|s<<6)&7939,p=c[6]&255|(c[7]&255)<<8,this.r[3]=(s>>>7|p<<9)&8191,m=c[8]&255|(c[9]&255)<<8,this.r[4]=(p>>>4|m<<12)&255,this.r[5]=m>>>1&8190,b=c[10]&255|(c[11]&255)<<8,this.r[6]=(m>>>14|b<<2)&8191,U=c[12]&255|(c[13]&255)<<8,this.r[7]=(b>>>11|U<<5)&8065,z=c[14]&255|(c[15]&255)<<8,this.r[8]=(U>>>8|z<<8)&8191,this.r[9]=z>>>5&127,this.pad[0]=c[16]&255|(c[17]&255)<<8,this.pad[1]=c[18]&255|(c[19]&255)<<8,this.pad[2]=c[20]&255|(c[21]&255)<<8,this.pad[3]=c[22]&255|(c[23]&255)<<8,this.pad[4]=c[24]&255|(c[25]&255)<<8,this.pad[5]=c[26]&255|(c[27]&255)<<8,this.pad[6]=c[28]&255|(c[29]&255)<<8,this.pad[7]=c[30]&255|(c[31]&255)<<8};Ae.prototype.blocks=function(c,l,f){for(var s=this.fin?0:2048,p,m,b,U,z,V,q,Se,G,re,oe,pe,de,se,ae,ie,L,Y,D,j=this.h[0],K=this.h[1],H=this.h[2],w=this.h[3],_=this.h[4],R=this.h[5],S=this.h[6],C=this.h[7],O=this.h[8],ee=this.h[9],he=this.r[0],xe=this.r[1],ge=this.r[2],g=this.r[3],we=this.r[4],Ue=this.r[5],Ce=this.r[6],me=this.r[7],ve=this.r[8],Ee=this.r[9];f>=16;)p=c[l+0]&255|(c[l+1]&255)<<8,j+=p&8191,m=c[l+2]&255|(c[l+3]&255)<<8,K+=(p>>>13|m<<3)&8191,b=c[l+4]&255|(c[l+5]&255)<<8,H+=(m>>>10|b<<6)&8191,U=c[l+6]&255|(c[l+7]&255)<<8,w+=(b>>>7|U<<9)&8191,z=c[l+8]&255|(c[l+9]&255)<<8,_+=(U>>>4|z<<12)&8191,R+=z>>>1&8191,V=c[l+10]&255|(c[l+11]&255)<<8,S+=(z>>>14|V<<2)&8191,q=c[l+12]&255|(c[l+13]&255)<<8,C+=(V>>>11|q<<5)&8191,Se=c[l+14]&255|(c[l+15]&255)<<8,O+=(q>>>8|Se<<8)&8191,ee+=Se>>>5|s,G=0,re=G,re+=j*he,re+=K*(5*Ee),re+=H*(5*ve),re+=w*(5*me),re+=_*(5*Ce),G=re>>>13,re&=8191,re+=R*(5*Ue),re+=S*(5*we),re+=C*(5*g),re+=O*(5*ge),re+=ee*(5*xe),G+=re>>>13,re&=8191,oe=G,oe+=j*xe,oe+=K*he,oe+=H*(5*Ee),oe+=w*(5*ve),oe+=_*(5*me),G=oe>>>13,oe&=8191,oe+=R*(5*Ce),oe+=S*(5*Ue),oe+=C*(5*we),oe+=O*(5*g),oe+=ee*(5*ge),G+=oe>>>13,oe&=8191,pe=G,pe+=j*ge,pe+=K*xe,pe+=H*he,pe+=w*(5*Ee),pe+=_*(5*ve),G=pe>>>13,pe&=8191,pe+=R*(5*me),pe+=S*(5*Ce),pe+=C*(5*Ue),pe+=O*(5*we),pe+=ee*(5*g),G+=pe>>>13,pe&=8191,de=G,de+=j*g,de+=K*ge,de+=H*xe,de+=w*he,de+=_*(5*Ee),G=de>>>13,de&=8191,de+=R*(5*ve),de+=S*(5*me),de+=C*(5*Ce),de+=O*(5*Ue),de+=ee*(5*we),G+=de>>>13,de&=8191,se=G,se+=j*we,se+=K*g,se+=H*ge,se+=w*xe,se+=_*he,G=se>>>13,se&=8191,se+=R*(5*Ee),se+=S*(5*ve),se+=C*(5*me),se+=O*(5*Ce),se+=ee*(5*Ue),G+=se>>>13,se&=8191,ae=G,ae+=j*Ue,ae+=K*we,ae+=H*g,ae+=w*ge,ae+=_*xe,G=ae>>>13,ae&=8191,ae+=R*he,ae+=S*(5*Ee),ae+=C*(5*ve),ae+=O*(5*me),ae+=ee*(5*Ce),G+=ae>>>13,ae&=8191,ie=G,ie+=j*Ce,ie+=K*Ue,ie+=H*we,ie+=w*g,ie+=_*ge,G=ie>>>13,ie&=8191,ie+=R*xe,ie+=S*he,ie+=C*(5*Ee),ie+=O*(5*ve),ie+=ee*(5*me),G+=ie>>>13,ie&=8191,L=G,L+=j*me,L+=K*Ce,L+=H*Ue,L+=w*we,L+=_*g,G=L>>>13,L&=8191,L+=R*ge,L+=S*xe,L+=C*he,L+=O*(5*Ee),L+=ee*(5*ve),G+=L>>>13,L&=8191,Y=G,Y+=j*ve,Y+=K*me,Y+=H*Ce,Y+=w*Ue,Y+=_*we,G=Y>>>13,Y&=8191,Y+=R*g,Y+=S*ge,Y+=C*xe,Y+=O*he,Y+=ee*(5*Ee),G+=Y>>>13,Y&=8191,D=G,D+=j*Ee,D+=K*ve,D+=H*me,D+=w*Ce,D+=_*Ue,G=D>>>13,D&=8191,D+=R*we,D+=S*g,D+=C*ge,D+=O*xe,D+=ee*he,G+=D>>>13,D&=8191,G=(G<<2)+G|0,G=G+re|0,re=G&8191,G=G>>>13,oe+=G,j=re,K=oe,H=pe,w=de,_=se,R=ae,S=ie,C=L,O=Y,ee=D,l+=16,f-=16;this.h[0]=j,this.h[1]=K,this.h[2]=H,this.h[3]=w,this.h[4]=_,this.h[5]=R,this.h[6]=S,this.h[7]=C,this.h[8]=O,this.h[9]=ee},Ae.prototype.finish=function(c,l){var f=new Uint16Array(10),s,p,m,b;if(this.leftover){for(b=this.leftover,this.buffer[b++]=1;b<16;b++)this.buffer[b]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(s=this.h[1]>>>13,this.h[1]&=8191,b=2;b<10;b++)this.h[b]+=s,s=this.h[b]>>>13,this.h[b]&=8191;for(this.h[0]+=s*5,s=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=s,s=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=s,f[0]=this.h[0]+5,s=f[0]>>>13,f[0]&=8191,b=1;b<10;b++)f[b]=this.h[b]+s,s=f[b]>>>13,f[b]&=8191;for(f[9]-=1<<13,p=(s^1)-1,b=0;b<10;b++)f[b]&=p;for(p=~p,b=0;b<10;b++)this.h[b]=this.h[b]&p|f[b];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,m=this.h[0]+this.pad[0],this.h[0]=m&65535,b=1;b<8;b++)m=(this.h[b]+this.pad[b]|0)+(m>>>16)|0,this.h[b]=m&65535;c[l+0]=this.h[0]>>>0&255,c[l+1]=this.h[0]>>>8&255,c[l+2]=this.h[1]>>>0&255,c[l+3]=this.h[1]>>>8&255,c[l+4]=this.h[2]>>>0&255,c[l+5]=this.h[2]>>>8&255,c[l+6]=this.h[3]>>>0&255,c[l+7]=this.h[3]>>>8&255,c[l+8]=this.h[4]>>>0&255,c[l+9]=this.h[4]>>>8&255,c[l+10]=this.h[5]>>>0&255,c[l+11]=this.h[5]>>>8&255,c[l+12]=this.h[6]>>>0&255,c[l+13]=this.h[6]>>>8&255,c[l+14]=this.h[7]>>>0&255,c[l+15]=this.h[7]>>>8&255},Ae.prototype.update=function(c,l,f){var s,p;if(this.leftover){for(p=16-this.leftover,p>f&&(p=f),s=0;s<p;s++)this.buffer[this.leftover+s]=c[l+s];if(f-=p,l+=p,this.leftover+=p,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(f>=16&&(p=f-f%16,this.blocks(c,l,p),l+=p,f-=p),f){for(s=0;s<f;s++)this.buffer[this.leftover+s]=c[l+s];this.leftover+=f}};function ye(c,l,f,s,p,m){var b=new Ae(m);return b.update(f,s,p),b.finish(c,l),0}function ze(c,l,f,s,p,m){var b=new Uint8Array(16);return ye(b,0,f,s,p,m),A(c,l,b,0)}function Pe(c,l,f,s,p){var m;if(f<32)return-1;for(Te(c,0,l,0,f,s,p),ye(c,16,c,32,f-32,c),m=0;m<16;m++)c[m]=0;return 0}function rt(c,l,f,s,p){var m,b=new Uint8Array(32);if(f<32||(W(b,0,32,s,p),ze(l,16,l,32,f-32,b)!==0))return-1;for(Te(c,0,l,0,f,s,p),m=0;m<32;m++)c[m]=0;return 0}function P(c,l){var f;for(f=0;f<16;f++)c[f]=l[f]|0}function $(c){var l,f,s=1;for(l=0;l<16;l++)f=c[l]+s+65535,s=Math.floor(f/65536),c[l]=f-s*65536;c[0]+=s-1+37*(s-1)}function ue(c,l,f){for(var s,p=~(f-1),m=0;m<16;m++)s=p&(c[m]^l[m]),c[m]^=s,l[m]^=s}function Be(c,l){var f,s,p,m=e(),b=e();for(f=0;f<16;f++)b[f]=l[f];for($(b),$(b),$(b),s=0;s<2;s++){for(m[0]=b[0]-65517,f=1;f<15;f++)m[f]=b[f]-65535-(m[f-1]>>16&1),m[f-1]&=65535;m[15]=b[15]-32767-(m[14]>>16&1),p=m[15]>>16&1,m[14]&=65535,ue(b,m,1-p)}for(f=0;f<16;f++)c[2*f]=b[f]&255,c[2*f+1]=b[f]>>8}function Ie(c,l){var f=new Uint8Array(32),s=new Uint8Array(32);return Be(f,c),Be(s,l),v(f,0,s,0)}function Le(c){var l=new Uint8Array(32);return Be(l,c),l[0]&1}function tt(c,l){var f;for(f=0;f<16;f++)c[f]=l[2*f]+(l[2*f+1]<<8);c[15]&=32767}function He(c,l,f){for(var s=0;s<16;s++)c[s]=l[s]+f[s]}function je(c,l,f){for(var s=0;s<16;s++)c[s]=l[s]-f[s]}function fe(c,l,f){var s,p,m=0,b=0,U=0,z=0,V=0,q=0,Se=0,G=0,re=0,oe=0,pe=0,de=0,se=0,ae=0,ie=0,L=0,Y=0,D=0,j=0,K=0,H=0,w=0,_=0,R=0,S=0,C=0,O=0,ee=0,he=0,xe=0,ge=0,g=f[0],we=f[1],Ue=f[2],Ce=f[3],me=f[4],ve=f[5],Ee=f[6],Fe=f[7],Re=f[8],Ne=f[9],De=f[10],Me=f[11],Qe=f[12],nt=f[13],ot=f[14],st=f[15];s=l[0],m+=s*g,b+=s*we,U+=s*Ue,z+=s*Ce,V+=s*me,q+=s*ve,Se+=s*Ee,G+=s*Fe,re+=s*Re,oe+=s*Ne,pe+=s*De,de+=s*Me,se+=s*Qe,ae+=s*nt,ie+=s*ot,L+=s*st,s=l[1],b+=s*g,U+=s*we,z+=s*Ue,V+=s*Ce,q+=s*me,Se+=s*ve,G+=s*Ee,re+=s*Fe,oe+=s*Re,pe+=s*Ne,de+=s*De,se+=s*Me,ae+=s*Qe,ie+=s*nt,L+=s*ot,Y+=s*st,s=l[2],U+=s*g,z+=s*we,V+=s*Ue,q+=s*Ce,Se+=s*me,G+=s*ve,re+=s*Ee,oe+=s*Fe,pe+=s*Re,de+=s*Ne,se+=s*De,ae+=s*Me,ie+=s*Qe,L+=s*nt,Y+=s*ot,D+=s*st,s=l[3],z+=s*g,V+=s*we,q+=s*Ue,Se+=s*Ce,G+=s*me,re+=s*ve,oe+=s*Ee,pe+=s*Fe,de+=s*Re,se+=s*Ne,ae+=s*De,ie+=s*Me,L+=s*Qe,Y+=s*nt,D+=s*ot,j+=s*st,s=l[4],V+=s*g,q+=s*we,Se+=s*Ue,G+=s*Ce,re+=s*me,oe+=s*ve,pe+=s*Ee,de+=s*Fe,se+=s*Re,ae+=s*Ne,ie+=s*De,L+=s*Me,Y+=s*Qe,D+=s*nt,j+=s*ot,K+=s*st,s=l[5],q+=s*g,Se+=s*we,G+=s*Ue,re+=s*Ce,oe+=s*me,pe+=s*ve,de+=s*Ee,se+=s*Fe,ae+=s*Re,ie+=s*Ne,L+=s*De,Y+=s*Me,D+=s*Qe,j+=s*nt,K+=s*ot,H+=s*st,s=l[6],Se+=s*g,G+=s*we,re+=s*Ue,oe+=s*Ce,pe+=s*me,de+=s*ve,se+=s*Ee,ae+=s*Fe,ie+=s*Re,L+=s*Ne,Y+=s*De,D+=s*Me,j+=s*Qe,K+=s*nt,H+=s*ot,w+=s*st,s=l[7],G+=s*g,re+=s*we,oe+=s*Ue,pe+=s*Ce,de+=s*me,se+=s*ve,ae+=s*Ee,ie+=s*Fe,L+=s*Re,Y+=s*Ne,D+=s*De,j+=s*Me,K+=s*Qe,H+=s*nt,w+=s*ot,_+=s*st,s=l[8],re+=s*g,oe+=s*we,pe+=s*Ue,de+=s*Ce,se+=s*me,ae+=s*ve,ie+=s*Ee,L+=s*Fe,Y+=s*Re,D+=s*Ne,j+=s*De,K+=s*Me,H+=s*Qe,w+=s*nt,_+=s*ot,R+=s*st,s=l[9],oe+=s*g,pe+=s*we,de+=s*Ue,se+=s*Ce,ae+=s*me,ie+=s*ve,L+=s*Ee,Y+=s*Fe,D+=s*Re,j+=s*Ne,K+=s*De,H+=s*Me,w+=s*Qe,_+=s*nt,R+=s*ot,S+=s*st,s=l[10],pe+=s*g,de+=s*we,se+=s*Ue,ae+=s*Ce,ie+=s*me,L+=s*ve,Y+=s*Ee,D+=s*Fe,j+=s*Re,K+=s*Ne,H+=s*De,w+=s*Me,_+=s*Qe,R+=s*nt,S+=s*ot,C+=s*st,s=l[11],de+=s*g,se+=s*we,ae+=s*Ue,ie+=s*Ce,L+=s*me,Y+=s*ve,D+=s*Ee,j+=s*Fe,K+=s*Re,H+=s*Ne,w+=s*De,_+=s*Me,R+=s*Qe,S+=s*nt,C+=s*ot,O+=s*st,s=l[12],se+=s*g,ae+=s*we,ie+=s*Ue,L+=s*Ce,Y+=s*me,D+=s*ve,j+=s*Ee,K+=s*Fe,H+=s*Re,w+=s*Ne,_+=s*De,R+=s*Me,S+=s*Qe,C+=s*nt,O+=s*ot,ee+=s*st,s=l[13],ae+=s*g,ie+=s*we,L+=s*Ue,Y+=s*Ce,D+=s*me,j+=s*ve,K+=s*Ee,H+=s*Fe,w+=s*Re,_+=s*Ne,R+=s*De,S+=s*Me,C+=s*Qe,O+=s*nt,ee+=s*ot,he+=s*st,s=l[14],ie+=s*g,L+=s*we,Y+=s*Ue,D+=s*Ce,j+=s*me,K+=s*ve,H+=s*Ee,w+=s*Fe,_+=s*Re,R+=s*Ne,S+=s*De,C+=s*Me,O+=s*Qe,ee+=s*nt,he+=s*ot,xe+=s*st,s=l[15],L+=s*g,Y+=s*we,D+=s*Ue,j+=s*Ce,K+=s*me,H+=s*ve,w+=s*Ee,_+=s*Fe,R+=s*Re,S+=s*Ne,C+=s*De,O+=s*Me,ee+=s*Qe,he+=s*nt,xe+=s*ot,ge+=s*st,m+=38*Y,b+=38*D,U+=38*j,z+=38*K,V+=38*H,q+=38*w,Se+=38*_,G+=38*R,re+=38*S,oe+=38*C,pe+=38*O,de+=38*ee,se+=38*he,ae+=38*xe,ie+=38*ge,p=1,s=m+p+65535,p=Math.floor(s/65536),m=s-p*65536,s=b+p+65535,p=Math.floor(s/65536),b=s-p*65536,s=U+p+65535,p=Math.floor(s/65536),U=s-p*65536,s=z+p+65535,p=Math.floor(s/65536),z=s-p*65536,s=V+p+65535,p=Math.floor(s/65536),V=s-p*65536,s=q+p+65535,p=Math.floor(s/65536),q=s-p*65536,s=Se+p+65535,p=Math.floor(s/65536),Se=s-p*65536,s=G+p+65535,p=Math.floor(s/65536),G=s-p*65536,s=re+p+65535,p=Math.floor(s/65536),re=s-p*65536,s=oe+p+65535,p=Math.floor(s/65536),oe=s-p*65536,s=pe+p+65535,p=Math.floor(s/65536),pe=s-p*65536,s=de+p+65535,p=Math.floor(s/65536),de=s-p*65536,s=se+p+65535,p=Math.floor(s/65536),se=s-p*65536,s=ae+p+65535,p=Math.floor(s/65536),ae=s-p*65536,s=ie+p+65535,p=Math.floor(s/65536),ie=s-p*65536,s=L+p+65535,p=Math.floor(s/65536),L=s-p*65536,m+=p-1+37*(p-1),p=1,s=m+p+65535,p=Math.floor(s/65536),m=s-p*65536,s=b+p+65535,p=Math.floor(s/65536),b=s-p*65536,s=U+p+65535,p=Math.floor(s/65536),U=s-p*65536,s=z+p+65535,p=Math.floor(s/65536),z=s-p*65536,s=V+p+65535,p=Math.floor(s/65536),V=s-p*65536,s=q+p+65535,p=Math.floor(s/65536),q=s-p*65536,s=Se+p+65535,p=Math.floor(s/65536),Se=s-p*65536,s=G+p+65535,p=Math.floor(s/65536),G=s-p*65536,s=re+p+65535,p=Math.floor(s/65536),re=s-p*65536,s=oe+p+65535,p=Math.floor(s/65536),oe=s-p*65536,s=pe+p+65535,p=Math.floor(s/65536),pe=s-p*65536,s=de+p+65535,p=Math.floor(s/65536),de=s-p*65536,s=se+p+65535,p=Math.floor(s/65536),se=s-p*65536,s=ae+p+65535,p=Math.floor(s/65536),ae=s-p*65536,s=ie+p+65535,p=Math.floor(s/65536),ie=s-p*65536,s=L+p+65535,p=Math.floor(s/65536),L=s-p*65536,m+=p-1+37*(p-1),c[0]=m,c[1]=b,c[2]=U,c[3]=z,c[4]=V,c[5]=q,c[6]=Se,c[7]=G,c[8]=re,c[9]=oe,c[10]=pe,c[11]=de,c[12]=se,c[13]=ae,c[14]=ie,c[15]=L}function Ve(c,l){fe(c,l,l)}function xr(c,l){var f=e(),s;for(s=0;s<16;s++)f[s]=l[s];for(s=253;s>=0;s--)Ve(f,f),s!==2&&s!==4&&fe(f,f,l);for(s=0;s<16;s++)c[s]=f[s]}function Ot(c,l){var f=e(),s;for(s=0;s<16;s++)f[s]=l[s];for(s=250;s>=0;s--)Ve(f,f),s!==1&&fe(f,f,l);for(s=0;s<16;s++)c[s]=f[s]}function mr(c,l,f){var s=new Uint8Array(32),p=new Float64Array(80),m,b,U=e(),z=e(),V=e(),q=e(),Se=e(),G=e();for(b=0;b<31;b++)s[b]=l[b];for(s[31]=l[31]&127|64,s[0]&=248,tt(p,f),b=0;b<16;b++)z[b]=p[b],q[b]=U[b]=V[b]=0;for(U[0]=q[0]=1,b=254;b>=0;--b)m=s[b>>>3]>>>(b&7)&1,ue(U,z,m),ue(V,q,m),He(Se,U,V),je(U,U,V),He(V,z,q),je(z,z,q),Ve(q,Se),Ve(G,U),fe(U,V,U),fe(V,z,Se),He(Se,U,V),je(U,U,V),Ve(z,U),je(V,q,G),fe(U,V,u),He(U,U,q),fe(V,V,U),fe(U,q,G),fe(q,z,p),Ve(z,Se),ue(U,z,m),ue(V,q,m);for(b=0;b<16;b++)p[b+16]=U[b],p[b+32]=V[b],p[b+48]=z[b],p[b+64]=q[b];var re=p.subarray(32),oe=p.subarray(16);return xr(re,re),fe(oe,oe,re),Be(c,oe),0}function Ut(c,l){return mr(c,l,o)}function rr(c,l){return t(l,32),Ut(c,l)}function Kr(c,l,f){var s=new Uint8Array(32);return mr(s,f,l),Z(c,n,s,F)}var nr=Pe,xt=rt;function br(c,l,f,s,p,m){var b=new Uint8Array(32);return Kr(b,p,m),nr(c,l,f,s,b)}function Do(c,l,f,s,p,m){var b=new Uint8Array(32);return Kr(b,p,m),xt(c,l,f,s,b)}var Yn=[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 Ra(c,l,f,s){for(var p=new Int32Array(16),m=new Int32Array(16),b,U,z,V,q,Se,G,re,oe,pe,de,se,ae,ie,L,Y,D,j,K,H,w,_,R,S,C,O,ee=c[0],he=c[1],xe=c[2],ge=c[3],g=c[4],we=c[5],Ue=c[6],Ce=c[7],me=l[0],ve=l[1],Ee=l[2],Fe=l[3],Re=l[4],Ne=l[5],De=l[6],Me=l[7],Qe=0;s>=128;){for(K=0;K<16;K++)H=8*K+Qe,p[K]=f[H+0]<<24|f[H+1]<<16|f[H+2]<<8|f[H+3],m[K]=f[H+4]<<24|f[H+5]<<16|f[H+6]<<8|f[H+7];for(K=0;K<80;K++)if(b=ee,U=he,z=xe,V=ge,q=g,Se=we,G=Ue,re=Ce,oe=me,pe=ve,de=Ee,se=Fe,ae=Re,ie=Ne,L=De,Y=Me,w=Ce,_=Me,R=_&65535,S=_>>>16,C=w&65535,O=w>>>16,w=(g>>>14|Re<<32-14)^(g>>>18|Re<<32-18)^(Re>>>41-32|g<<32-(41-32)),_=(Re>>>14|g<<32-14)^(Re>>>18|g<<32-18)^(g>>>41-32|Re<<32-(41-32)),R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,w=g&we^~g&Ue,_=Re&Ne^~Re&De,R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,w=Yn[K*2],_=Yn[K*2+1],R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,w=p[K%16],_=m[K%16],R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,S+=R>>>16,C+=S>>>16,O+=C>>>16,D=C&65535|O<<16,j=R&65535|S<<16,w=D,_=j,R=_&65535,S=_>>>16,C=w&65535,O=w>>>16,w=(ee>>>28|me<<32-28)^(me>>>34-32|ee<<32-(34-32))^(me>>>39-32|ee<<32-(39-32)),_=(me>>>28|ee<<32-28)^(ee>>>34-32|me<<32-(34-32))^(ee>>>39-32|me<<32-(39-32)),R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,w=ee&he^ee&xe^he&xe,_=me&ve^me&Ee^ve&Ee,R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,S+=R>>>16,C+=S>>>16,O+=C>>>16,re=C&65535|O<<16,Y=R&65535|S<<16,w=V,_=se,R=_&65535,S=_>>>16,C=w&65535,O=w>>>16,w=D,_=j,R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,S+=R>>>16,C+=S>>>16,O+=C>>>16,V=C&65535|O<<16,se=R&65535|S<<16,he=b,xe=U,ge=z,g=V,we=q,Ue=Se,Ce=G,ee=re,ve=oe,Ee=pe,Fe=de,Re=se,Ne=ae,De=ie,Me=L,me=Y,K%16===15)for(H=0;H<16;H++)w=p[H],_=m[H],R=_&65535,S=_>>>16,C=w&65535,O=w>>>16,w=p[(H+9)%16],_=m[(H+9)%16],R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,D=p[(H+1)%16],j=m[(H+1)%16],w=(D>>>1|j<<32-1)^(D>>>8|j<<32-8)^D>>>7,_=(j>>>1|D<<32-1)^(j>>>8|D<<32-8)^(j>>>7|D<<32-7),R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,D=p[(H+14)%16],j=m[(H+14)%16],w=(D>>>19|j<<32-19)^(j>>>61-32|D<<32-(61-32))^D>>>6,_=(j>>>19|D<<32-19)^(D>>>61-32|j<<32-(61-32))^(j>>>6|D<<32-6),R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,S+=R>>>16,C+=S>>>16,O+=C>>>16,p[H]=C&65535|O<<16,m[H]=R&65535|S<<16;w=ee,_=me,R=_&65535,S=_>>>16,C=w&65535,O=w>>>16,w=c[0],_=l[0],R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,S+=R>>>16,C+=S>>>16,O+=C>>>16,c[0]=ee=C&65535|O<<16,l[0]=me=R&65535|S<<16,w=he,_=ve,R=_&65535,S=_>>>16,C=w&65535,O=w>>>16,w=c[1],_=l[1],R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,S+=R>>>16,C+=S>>>16,O+=C>>>16,c[1]=he=C&65535|O<<16,l[1]=ve=R&65535|S<<16,w=xe,_=Ee,R=_&65535,S=_>>>16,C=w&65535,O=w>>>16,w=c[2],_=l[2],R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,S+=R>>>16,C+=S>>>16,O+=C>>>16,c[2]=xe=C&65535|O<<16,l[2]=Ee=R&65535|S<<16,w=ge,_=Fe,R=_&65535,S=_>>>16,C=w&65535,O=w>>>16,w=c[3],_=l[3],R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,S+=R>>>16,C+=S>>>16,O+=C>>>16,c[3]=ge=C&65535|O<<16,l[3]=Fe=R&65535|S<<16,w=g,_=Re,R=_&65535,S=_>>>16,C=w&65535,O=w>>>16,w=c[4],_=l[4],R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,S+=R>>>16,C+=S>>>16,O+=C>>>16,c[4]=g=C&65535|O<<16,l[4]=Re=R&65535|S<<16,w=we,_=Ne,R=_&65535,S=_>>>16,C=w&65535,O=w>>>16,w=c[5],_=l[5],R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,S+=R>>>16,C+=S>>>16,O+=C>>>16,c[5]=we=C&65535|O<<16,l[5]=Ne=R&65535|S<<16,w=Ue,_=De,R=_&65535,S=_>>>16,C=w&65535,O=w>>>16,w=c[6],_=l[6],R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,S+=R>>>16,C+=S>>>16,O+=C>>>16,c[6]=Ue=C&65535|O<<16,l[6]=De=R&65535|S<<16,w=Ce,_=Me,R=_&65535,S=_>>>16,C=w&65535,O=w>>>16,w=c[7],_=l[7],R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,S+=R>>>16,C+=S>>>16,O+=C>>>16,c[7]=Ce=C&65535|O<<16,l[7]=Me=R&65535|S<<16,Qe+=128,s-=128}return s}function Vr(c,l,f){var s=new Int32Array(8),p=new Int32Array(8),m=new Uint8Array(256),b,U=f;for(s[0]=1779033703,s[1]=3144134277,s[2]=1013904242,s[3]=2773480762,s[4]=1359893119,s[5]=2600822924,s[6]=528734635,s[7]=1541459225,p[0]=4089235720,p[1]=2227873595,p[2]=4271175723,p[3]=1595750129,p[4]=2917565137,p[5]=725511199,p[6]=4215389547,p[7]=327033209,Ra(s,p,l,f),f%=128,b=0;b<f;b++)m[b]=l[U-f+b];for(m[f]=128,f=256-128*(f<112?1:0),m[f-9]=0,E(m,f-8,U/536870912|0,U<<3),Ra(s,p,m,f),b=0;b<8;b++)E(c,8*b,s[b],p[b]);return 0}function Mo(c,l){var f=e(),s=e(),p=e(),m=e(),b=e(),U=e(),z=e(),V=e(),q=e();je(f,c[1],c[0]),je(q,l[1],l[0]),fe(f,f,q),He(s,c[0],c[1]),He(q,l[0],l[1]),fe(s,s,q),fe(p,c[3],l[3]),fe(p,p,h),fe(m,c[2],l[2]),He(m,m,m),je(b,s,f),je(U,m,p),He(z,m,p),He(V,s,f),fe(c[0],b,U),fe(c[1],V,z),fe(c[2],z,U),fe(c[3],b,V)}function ka(c,l,f){var s;for(s=0;s<4;s++)ue(c[s],l[s],f)}function Qs(c,l){var f=e(),s=e(),p=e();xr(p,l[2]),fe(f,l[0],p),fe(s,l[1],p),Be(c,s),c[31]^=Le(f)<<7}function Ws(c,l,f){var s,p;for(P(c[0],i),P(c[1],a),P(c[2],a),P(c[3],i),p=255;p>=0;--p)s=f[p/8|0]>>(p&7)&1,ka(c,l,s),Mo(l,c),Mo(c,c),ka(c,l,s)}function Go(c,l){var f=[e(),e(),e(),e()];P(f[0],x),P(f[1],y),P(f[2],a),fe(f[3],x,y),Ws(c,f,l)}function Ys(c,l,f){var s=new Uint8Array(64),p=[e(),e(),e(),e()],m;for(f||t(l,32),Vr(s,l,32),s[0]&=248,s[31]&=127,s[31]|=64,Go(p,s),Qs(c,p),m=0;m<32;m++)l[m+32]=c[m];return 0}var Lo=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 Xs(c,l){var f,s,p,m;for(s=63;s>=32;--s){for(f=0,p=s-32,m=s-12;p<m;++p)l[p]+=f-16*l[s]*Lo[p-(s-32)],f=Math.floor((l[p]+128)/256),l[p]-=f*256;l[p]+=f,l[s]=0}for(f=0,p=0;p<32;p++)l[p]+=f-(l[31]>>4)*Lo[p],f=l[p]>>8,l[p]&=255;for(p=0;p<32;p++)l[p]-=f*Lo[p];for(s=0;s<32;s++)l[s+1]+=l[s]>>8,c[s]=l[s]&255}function Zs(c){var l=new Float64Array(64),f;for(f=0;f<64;f++)l[f]=c[f];for(f=0;f<64;f++)c[f]=0;Xs(c,l)}function Oa(c,l,f,s){var p=new Uint8Array(64),m=new Uint8Array(64),b=new Uint8Array(64),U,z,V=new Float64Array(64),q=[e(),e(),e(),e()];Vr(p,s,32),p[0]&=248,p[31]&=127,p[31]|=64;var Se=f+64;for(U=0;U<f;U++)c[64+U]=l[U];for(U=0;U<32;U++)c[32+U]=p[32+U];for(Vr(b,c.subarray(32),f+32),Zs(b),Go(q,b),Qs(c,q),U=32;U<64;U++)c[U]=s[U];for(Vr(m,c,f+64),Zs(m),U=0;U<64;U++)V[U]=0;for(U=0;U<32;U++)V[U]=b[U];for(U=0;U<32;U++)for(z=0;z<32;z++)V[U+z]+=m[U]*p[z];return Xs(c.subarray(32),V),Se}function id(c,l){var f=e(),s=e(),p=e(),m=e(),b=e(),U=e(),z=e();return P(c[2],a),tt(c[1],l),Ve(p,c[1]),fe(m,p,d),je(p,p,c[2]),He(m,c[2],m),Ve(b,m),Ve(U,b),fe(z,U,b),fe(f,z,p),fe(f,f,m),Ot(f,f),fe(f,f,p),fe(f,f,m),fe(f,f,m),fe(c[0],f,m),Ve(s,c[0]),fe(s,s,m),Ie(s,p)&&fe(c[0],c[0],T),Ve(s,c[0]),fe(s,s,m),Ie(s,p)?-1:(Le(c[0])===l[31]>>7&&je(c[0],i,c[0]),fe(c[3],c[0],c[1]),0)}function Js(c,l,f,s){var p,m=new Uint8Array(32),b=new Uint8Array(64),U=[e(),e(),e(),e()],z=[e(),e(),e(),e()];if(f<64||id(z,s))return-1;for(p=0;p<f;p++)c[p]=l[p];for(p=0;p<32;p++)c[p+32]=s[p];if(Vr(b,c,f),Zs(b),Ws(U,z,b),Go(z,l.subarray(32)),Mo(U,z),Qs(m,U),f-=64,v(l,0,m,0)){for(p=0;p<f;p++)c[p]=0;return-1}for(p=0;p<f;p++)c[p]=l[p+64];return f}var ei=32,Fo=24,Xn=32,Un=16,Zn=32,$o=32,Jn=32,eo=32,ti=32,za=Fo,ad=Xn,cd=Un,or=64,Qr=32,Cn=64,ri=32,ni=64;r.lowlevel={crypto_core_hsalsa20:Z,crypto_stream_xor:Te,crypto_stream:W,crypto_stream_salsa20_xor:Q,crypto_stream_salsa20:J,crypto_onetimeauth:ye,crypto_onetimeauth_verify:ze,crypto_verify_16:A,crypto_verify_32:v,crypto_secretbox:Pe,crypto_secretbox_open:rt,crypto_scalarmult:mr,crypto_scalarmult_base:Ut,crypto_box_beforenm:Kr,crypto_box_afternm:nr,crypto_box:br,crypto_box_open:Do,crypto_box_keypair:rr,crypto_hash:Vr,crypto_sign:Oa,crypto_sign_keypair:Ys,crypto_sign_open:Js,crypto_secretbox_KEYBYTES:ei,crypto_secretbox_NONCEBYTES:Fo,crypto_secretbox_ZEROBYTES:Xn,crypto_secretbox_BOXZEROBYTES:Un,crypto_scalarmult_BYTES:Zn,crypto_scalarmult_SCALARBYTES:$o,crypto_box_PUBLICKEYBYTES:Jn,crypto_box_SECRETKEYBYTES:eo,crypto_box_BEFORENMBYTES:ti,crypto_box_NONCEBYTES:za,crypto_box_ZEROBYTES:ad,crypto_box_BOXZEROBYTES:cd,crypto_sign_BYTES:or,crypto_sign_PUBLICKEYBYTES:Qr,crypto_sign_SECRETKEYBYTES:Cn,crypto_sign_SEEDBYTES:ri,crypto_hash_BYTES:ni,gf:e,D:d,L:Lo,pack25519:Be,unpack25519:tt,M:fe,A:He,S:Ve,Z:je,pow2523:Ot,add:Mo,set25519:P,modL:Xs,scalarmult:Ws,scalarbase:Go};function Pa(c,l){if(c.length!==ei)throw new Error("bad key size");if(l.length!==Fo)throw new Error("bad nonce size")}function ud(c,l){if(c.length!==Jn)throw new Error("bad public key size");if(l.length!==eo)throw new Error("bad secret key size")}function mt(){for(var c=0;c<arguments.length;c++)if(!(arguments[c]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Ha(c){for(var l=0;l<c.length;l++)c[l]=0}r.randomBytes=function(c){var l=new Uint8Array(c);return t(l,c),l},r.secretbox=function(c,l,f){mt(c,l,f),Pa(f,l);for(var s=new Uint8Array(Xn+c.length),p=new Uint8Array(s.length),m=0;m<c.length;m++)s[m+Xn]=c[m];return Pe(p,s,s.length,l,f),p.subarray(Un)},r.secretbox.open=function(c,l,f){mt(c,l,f),Pa(f,l);for(var s=new Uint8Array(Un+c.length),p=new Uint8Array(s.length),m=0;m<c.length;m++)s[m+Un]=c[m];return s.length<32||rt(p,s,s.length,l,f)!==0?null:p.subarray(Xn)},r.secretbox.keyLength=ei,r.secretbox.nonceLength=Fo,r.secretbox.overheadLength=Un,r.scalarMult=function(c,l){if(mt(c,l),c.length!==$o)throw new Error("bad n size");if(l.length!==Zn)throw new Error("bad p size");var f=new Uint8Array(Zn);return mr(f,c,l),f},r.scalarMult.base=function(c){if(mt(c),c.length!==$o)throw new Error("bad n size");var l=new Uint8Array(Zn);return Ut(l,c),l},r.scalarMult.scalarLength=$o,r.scalarMult.groupElementLength=Zn,r.box=function(c,l,f,s){var p=r.box.before(f,s);return r.secretbox(c,l,p)},r.box.before=function(c,l){mt(c,l),ud(c,l);var f=new Uint8Array(ti);return Kr(f,c,l),f},r.box.after=r.secretbox,r.box.open=function(c,l,f,s){var p=r.box.before(f,s);return r.secretbox.open(c,l,p)},r.box.open.after=r.secretbox.open,r.box.keyPair=function(){var c=new Uint8Array(Jn),l=new Uint8Array(eo);return rr(c,l),{publicKey:c,secretKey:l}},r.box.keyPair.fromSecretKey=function(c){if(mt(c),c.length!==eo)throw new Error("bad secret key size");var l=new Uint8Array(Jn);return Ut(l,c),{publicKey:l,secretKey:new Uint8Array(c)}},r.box.publicKeyLength=Jn,r.box.secretKeyLength=eo,r.box.sharedKeyLength=ti,r.box.nonceLength=za,r.box.overheadLength=r.secretbox.overheadLength,r.sign=function(c,l){if(mt(c,l),l.length!==Cn)throw new Error("bad secret key size");var f=new Uint8Array(or+c.length);return Oa(f,c,c.length,l),f},r.sign.open=function(c,l){if(mt(c,l),l.length!==Qr)throw new Error("bad public key size");var f=new Uint8Array(c.length),s=Js(f,c,c.length,l);if(s<0)return null;for(var p=new Uint8Array(s),m=0;m<p.length;m++)p[m]=f[m];return p},r.sign.detached=function(c,l){for(var f=r.sign(c,l),s=new Uint8Array(or),p=0;p<s.length;p++)s[p]=f[p];return s},r.sign.detached.verify=function(c,l,f){if(mt(c,l,f),l.length!==or)throw new Error("bad signature size");if(f.length!==Qr)throw new Error("bad public key size");var s=new Uint8Array(or+c.length),p=new Uint8Array(or+c.length),m;for(m=0;m<or;m++)s[m]=l[m];for(m=0;m<c.length;m++)s[m+or]=c[m];return Js(p,s,s.length,f)>=0},r.sign.keyPair=function(){var c=new Uint8Array(Qr),l=new Uint8Array(Cn);return Ys(c,l),{publicKey:c,secretKey:l}},r.sign.keyPair.fromSecretKey=function(c){if(mt(c),c.length!==Cn)throw new Error("bad secret key size");for(var l=new Uint8Array(Qr),f=0;f<l.length;f++)l[f]=c[32+f];return{publicKey:l,secretKey:new Uint8Array(c)}},r.sign.keyPair.fromSeed=function(c){if(mt(c),c.length!==ri)throw new Error("bad seed size");for(var l=new Uint8Array(Qr),f=new Uint8Array(Cn),s=0;s<32;s++)f[s]=c[s];return Ys(l,f,!0),{publicKey:l,secretKey:f}},r.sign.publicKeyLength=Qr,r.sign.secretKeyLength=Cn,r.sign.seedLength=ri,r.sign.signatureLength=or,r.hash=function(c){mt(c);var l=new Uint8Array(ni);return Vr(l,c,c.length),l},r.hash.hashLength=ni,r.verify=function(c,l){return mt(c,l),c.length===0||l.length===0||c.length!==l.length?!1:I(c,0,l,0,c.length)===0},r.setPRNG=function(c){t=c},function(){var c=typeof self!="undefined"?self.crypto||self.msCrypto:null;if(c&&c.getRandomValues){var l=65536;r.setPRNG(function(f,s){var p,m=new Uint8Array(s);for(p=0;p<s;p+=l)c.getRandomValues(m.subarray(p,p+Math.min(s-p,l)));for(p=0;p<s;p++)f[p]=m[p];Ha(m)})}else typeof Na!="undefined"&&(c=pc(),c&&c.randomBytes&&r.setPRNG(function(f,s){var p,m=c.randomBytes(s);for(p=0;p<s;p++)f[p]=m[p];Ha(m)}))}()})(typeof os!="undefined"&&os.exports?os.exports:self.nacl=self.nacl||{})});var xo=ce(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.output=dt.exists=dt.hash=dt.bytes=dt.bool=dt.number=void 0;function ys(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`Wrong positive integer: ${r}`)}dt.number=ys;function Dc(r){if(typeof r!="boolean")throw new Error(`Expected boolean, not ${r}`)}dt.bool=Dc;function Hi(r,...e){if(!(r instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(e.length>0&&!e.includes(r.length))throw new TypeError(`Expected Uint8Array of length ${e}, not of length=${r.length}`)}dt.bytes=Hi;function Mc(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");ys(r.outputLen),ys(r.blockLen)}dt.hash=Mc;function Gc(r,e=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(e&&r.finished)throw new Error("Hash#digest() has already been called")}dt.exists=Gc;function Lc(r,e){Hi(r);let t=e.outputLen;if(r.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)}dt.output=Lc;var Np={number:ys,bool:Dc,bytes:Hi,hash:Mc,exists:Gc,output:Lc};dt.default=Np});var Fc=ce(xs=>{"use strict";Object.defineProperty(xs,"__esModule",{value:!0});xs.crypto=void 0;xs.crypto={node:void 0,web:typeof self=="object"&&"crypto"in self?self.crypto:void 0}});var un=ce(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.randomBytes=_e.wrapConstructorWithOpts=_e.wrapConstructor=_e.checkOpts=_e.Hash=_e.concatBytes=_e.toBytes=_e.utf8ToBytes=_e.asyncLoop=_e.nextTick=_e.hexToBytes=_e.bytesToHex=_e.isLE=_e.rotr=_e.createView=_e.u32=_e.u8=void 0;var ms=Fc(),Dp=r=>new Uint8Array(r.buffer,r.byteOffset,r.byteLength);_e.u8=Dp;var Mp=r=>new Uint32Array(r.buffer,r.byteOffset,Math.floor(r.byteLength/4));_e.u32=Mp;var Gp=r=>new DataView(r.buffer,r.byteOffset,r.byteLength);_e.createView=Gp;var Lp=(r,e)=>r<<32-e|r>>>e;_e.rotr=Lp;_e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!_e.isLE)throw new Error("Non little-endian hardware is not supported");var Fp=Array.from({length:256},(r,e)=>e.toString(16).padStart(2,"0"));function $p(r){if(!(r instanceof Uint8Array))throw new Error("Uint8Array expected");let e="";for(let t=0;t<r.length;t++)e+=Fp[r[t]];return e}_e.bytesToHex=$p;function jp(r){if(typeof r!="string")throw new TypeError("hexToBytes: expected string, got "+typeof r);if(r.length%2)throw new Error("hexToBytes: received invalid unpadded hex");let e=new Uint8Array(r.length/2);for(let t=0;t<e.length;t++){let n=t*2,o=r.slice(n,n+2),i=Number.parseInt(o,16);if(Number.isNaN(i)||i<0)throw new Error("Invalid byte sequence");e[t]=i}return e}_e.hexToBytes=jp;var Kp=async()=>{};_e.nextTick=Kp;async function Vp(r,e,t){let n=Date.now();for(let o=0;o<r;o++){t(o);let i=Date.now()-n;i>=0&&i<e||(await(0,_e.nextTick)(),n+=i)}}_e.asyncLoop=Vp;function $c(r){if(typeof r!="string")throw new TypeError(`utf8ToBytes expected string, got ${typeof r}`);return new TextEncoder().encode(r)}_e.utf8ToBytes=$c;function Ni(r){if(typeof r=="string"&&(r=$c(r)),!(r instanceof Uint8Array))throw new TypeError(`Expected input type is Uint8Array (got ${typeof r})`);return r}_e.toBytes=Ni;function Qp(...r){if(!r.every(n=>n instanceof Uint8Array))throw new Error("Uint8Array list expected");if(r.length===1)return r[0];let e=r.reduce((n,o)=>n+o.length,0),t=new Uint8Array(e);for(let n=0,o=0;n<r.length;n++){let i=r[n];t.set(i,o),o+=i.length}return t}_e.concatBytes=Qp;var qi=class{clone(){return this._cloneInto()}};_e.Hash=qi;var Wp=r=>Object.prototype.toString.call(r)==="[object Object]"&&r.constructor===Object;function Yp(r,e){if(e!==void 0&&(typeof e!="object"||!Wp(e)))throw new TypeError("Options should be object or undefined");return Object.assign(r,e)}_e.checkOpts=Yp;function Xp(r){let e=n=>r().update(Ni(n)).digest(),t=r();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>r(),e}_e.wrapConstructor=Xp;function Zp(r){let e=(n,o)=>r(o).update(Ni(n)).digest(),t=r({});return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=n=>r(n),e}_e.wrapConstructorWithOpts=Zp;function Jp(r=32){if(ms.crypto.web)return ms.crypto.web.getRandomValues(new Uint8Array(r));if(ms.crypto.node)return new Uint8Array(ms.crypto.node.randomBytes(r).buffer);throw new Error("The environment doesn't have randomBytes function")}_e.randomBytes=Jp});var Kc=ce(mo=>{"use strict";Object.defineProperty(mo,"__esModule",{value:!0});mo.hmac=void 0;var bs=xo(),jc=un(),As=class extends jc.Hash{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,bs.default.hash(e);let n=(0,jc.toBytes)(t);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new TypeError("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let o=this.blockLen,i=new Uint8Array(o);i.set(n.length>o?e.create().update(n).digest():n);for(let a=0;a<i.length;a++)i[a]^=54;this.iHash.update(i),this.oHash=e.create();for(let a=0;a<i.length;a++)i[a]^=106;this.oHash.update(i),i.fill(0)}update(e){return bs.default.exists(this),this.iHash.update(e),this}digestInto(e){bs.default.exists(this),bs.default.bytes(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));let{oHash:t,iHash:n,finished:o,destroyed:i,blockLen:a,outputLen:u}=this;return e=e,e.finished=o,e.destroyed=i,e.blockLen=a,e.outputLen=u,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},eh=(r,e,t)=>new As(r,e).update(t).digest();mo.hmac=eh;mo.hmac.create=(r,e)=>new As(r,e)});var Wc=ce(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});Gn.pbkdf2Async=Gn.pbkdf2=void 0;var ws=xo(),th=Kc(),Mn=un();function Vc(r,e,t,n){ws.default.hash(r);let o=(0,Mn.checkOpts)({dkLen:32,asyncTick:10},n),{c:i,dkLen:a,asyncTick:u}=o;if(ws.default.number(i),ws.default.number(a),ws.default.number(u),i<1)throw new Error("PBKDF2: iterations (c) should be >= 1");let d=(0,Mn.toBytes)(e),h=(0,Mn.toBytes)(t),x=new Uint8Array(a),y=th.hmac.create(r,d),T=y._cloneInto().update(h);return{c:i,dkLen:a,asyncTick:u,DK:x,PRF:y,PRFSalt:T}}function Qc(r,e,t,n,o){return r.destroy(),e.destroy(),n&&n.destroy(),o.fill(0),t}function rh(r,e,t,n){let{c:o,dkLen:i,DK:a,PRF:u,PRFSalt:d}=Vc(r,e,t,n),h,x=new Uint8Array(4),y=(0,Mn.createView)(x),T=new Uint8Array(u.outputLen);for(let E=1,I=0;I<i;E++,I+=u.outputLen){let A=a.subarray(I,I+u.outputLen);y.setInt32(0,E,!1),(h=d._cloneInto(h)).update(x).digestInto(T),A.set(T.subarray(0,A.length));for(let v=1;v<o;v++){u._cloneInto(h).update(T).digestInto(T);for(let k=0;k<A.length;k++)A[k]^=T[k]}}return Qc(u,d,a,h,T)}Gn.pbkdf2=rh;async function nh(r,e,t,n){let{c:o,dkLen:i,asyncTick:a,DK:u,PRF:d,PRFSalt:h}=Vc(r,e,t,n),x,y=new Uint8Array(4),T=(0,Mn.createView)(y),E=new Uint8Array(d.outputLen);for(let I=1,A=0;A<i;I++,A+=d.outputLen){let v=u.subarray(A,A+d.outputLen);T.setInt32(0,I,!1),(x=h._cloneInto(x)).update(y).digestInto(E),v.set(E.subarray(0,v.length)),await(0,Mn.asyncLoop)(o-1,a,k=>{d._cloneInto(x).update(E).digestInto(E);for(let N=0;N<v.length;N++)v[N]^=E[N]})}return Qc(d,h,u,x,E)}Gn.pbkdf2Async=nh});var Gi=ce(_s=>{"use strict";Object.defineProperty(_s,"__esModule",{value:!0});_s.SHA2=void 0;var Di=xo(),bo=un();function oh(r,e,t,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(e,t,n);let o=BigInt(32),i=BigInt(4294967295),a=Number(t>>o&i),u=Number(t&i),d=n?4:0,h=n?0:4;r.setUint32(e+d,a,n),r.setUint32(e+h,u,n)}var Mi=class extends bo.Hash{constructor(e,t,n,o){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=(0,bo.createView)(this.buffer)}update(e){Di.default.exists(this);let{view:t,buffer:n,blockLen:o}=this;e=(0,bo.toBytes)(e);let i=e.length;for(let a=0;a<i;){let u=Math.min(o-this.pos,i-a);if(u===o){let d=(0,bo.createView)(e);for(;o<=i-a;a+=o)this.process(d,a);continue}n.set(e.subarray(a,a+u),this.pos),this.pos+=u,a+=u,this.pos===o&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Di.default.exists(this),Di.default.output(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:o,isLE:i}=this,{pos:a}=this;t[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>o-a&&(this.process(n,0),a=0);for(let d=a;d<o;d++)t[d]=0;oh(n,o-8,BigInt(this.length*8),i),this.process(n,0);let u=(0,bo.createView)(e);this.get().forEach((d,h)=>u.setUint32(4*h,d,i))}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:n,length:o,finished:i,destroyed:a,pos:u}=this;return e.length=o,e.pos=u,e.finished=i,e.destroyed=a,o%t&&e.buffer.set(n),e}};_s.SHA2=Mi});var Yc=ce(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});Ts.sha256=void 0;var sh=Gi(),Ht=un(),ih=(r,e,t)=>r&e^~r&t,ah=(r,e,t)=>r&e^r&t^e&t,ch=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Rr=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),kr=new Uint32Array(64),Li=class extends sh.SHA2{constructor(){super(64,32,8,!1),this.A=Rr[0]|0,this.B=Rr[1]|0,this.C=Rr[2]|0,this.D=Rr[3]|0,this.E=Rr[4]|0,this.F=Rr[5]|0,this.G=Rr[6]|0,this.H=Rr[7]|0}get(){let{A:e,B:t,C:n,D:o,E:i,F:a,G:u,H:d}=this;return[e,t,n,o,i,a,u,d]}set(e,t,n,o,i,a,u,d){this.A=e|0,this.B=t|0,this.C=n|0,this.D=o|0,this.E=i|0,this.F=a|0,this.G=u|0,this.H=d|0}process(e,t){for(let y=0;y<16;y++,t+=4)kr[y]=e.getUint32(t,!1);for(let y=16;y<64;y++){let T=kr[y-15],E=kr[y-2],I=(0,Ht.rotr)(T,7)^(0,Ht.rotr)(T,18)^T>>>3,A=(0,Ht.rotr)(E,17)^(0,Ht.rotr)(E,19)^E>>>10;kr[y]=A+kr[y-7]+I+kr[y-16]|0}let{A:n,B:o,C:i,D:a,E:u,F:d,G:h,H:x}=this;for(let y=0;y<64;y++){let T=(0,Ht.rotr)(u,6)^(0,Ht.rotr)(u,11)^(0,Ht.rotr)(u,25),E=x+T+ih(u,d,h)+ch[y]+kr[y]|0,A=((0,Ht.rotr)(n,2)^(0,Ht.rotr)(n,13)^(0,Ht.rotr)(n,22))+ah(n,o,i)|0;x=h,h=d,d=u,u=a+E|0,a=i,i=o,o=n,n=E+A|0}n=n+this.A|0,o=o+this.B|0,i=i+this.C|0,a=a+this.D|0,u=u+this.E|0,d=d+this.F|0,h=h+this.G|0,x=x+this.H|0,this.set(n,o,i,a,u,d,h,x)}roundClean(){kr.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};Ts.sha256=(0,Ht.wrapConstructor)(()=>new Li)});var Jc=ce(Rt=>{"use strict";Object.defineProperty(Rt,"__esModule",{value:!0});Rt.add=Rt.toBig=Rt.split=Rt.fromBig=void 0;var vs=BigInt(2**32-1),Fi=BigInt(32);function $i(r,e=!1){return e?{h:Number(r&vs),l:Number(r>>Fi&vs)}:{h:Number(r>>Fi&vs)|0,l:Number(r&vs)|0}}Rt.fromBig=$i;function Xc(r,e=!1){let t=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let o=0;o<r.length;o++){let{h:i,l:a}=$i(r[o],e);[t[o],n[o]]=[i,a]}return[t,n]}Rt.split=Xc;var uh=(r,e)=>BigInt(r>>>0)<<Fi|BigInt(e>>>0);Rt.toBig=uh;var fh=(r,e,t)=>r>>>t,lh=(r,e,t)=>r<<32-t|e>>>t,dh=(r,e,t)=>r>>>t|e<<32-t,ph=(r,e,t)=>r<<32-t|e>>>t,hh=(r,e,t)=>r<<64-t|e>>>t-32,gh=(r,e,t)=>r>>>t-32|e<<64-t,yh=(r,e)=>e,xh=(r,e)=>r,mh=(r,e,t)=>r<<t|e>>>32-t,bh=(r,e,t)=>e<<t|r>>>32-t,Ah=(r,e,t)=>e<<t-32|r>>>64-t,wh=(r,e,t)=>r<<t-32|e>>>64-t;function Zc(r,e,t,n){let o=(e>>>0)+(n>>>0);return{h:r+t+(o/2**32|0)|0,l:o|0}}Rt.add=Zc;var _h=(r,e,t)=>(r>>>0)+(e>>>0)+(t>>>0),Th=(r,e,t,n)=>e+t+n+(r/2**32|0)|0,vh=(r,e,t,n)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0),Eh=(r,e,t,n,o)=>e+t+n+o+(r/2**32|0)|0,Sh=(r,e,t,n,o)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0)+(o>>>0),Uh=(r,e,t,n,o,i)=>e+t+n+o+i+(r/2**32|0)|0,Ch={fromBig:$i,split:Xc,toBig:Rt.toBig,shrSH:fh,shrSL:lh,rotrSH:dh,rotrSL:ph,rotrBH:hh,rotrBL:gh,rotr32H:yh,rotr32L:xh,rotlSH:mh,rotlSL:bh,rotlBH:Ah,rotlBL:wh,add:Zc,add3L:_h,add3H:Th,add4L:vh,add4H:Eh,add5H:Uh,add5L:Sh};Rt.default=Ch});var eu=ce(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.sha384=jt.sha512_256=jt.sha512=jt.SHA512=void 0;var Bh=Gi(),be=Jc(),Vi=un(),[Ih,Rh]=be.default.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(r=>BigInt(r))),Or=new Uint32Array(80),zr=new Uint32Array(80),Ln=class extends Bh.SHA2{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:e,Al:t,Bh:n,Bl:o,Ch:i,Cl:a,Dh:u,Dl:d,Eh:h,El:x,Fh:y,Fl:T,Gh:E,Gl:I,Hh:A,Hl:v}=this;return[e,t,n,o,i,a,u,d,h,x,y,T,E,I,A,v]}set(e,t,n,o,i,a,u,d,h,x,y,T,E,I,A,v){this.Ah=e|0,this.Al=t|0,this.Bh=n|0,this.Bl=o|0,this.Ch=i|0,this.Cl=a|0,this.Dh=u|0,this.Dl=d|0,this.Eh=h|0,this.El=x|0,this.Fh=y|0,this.Fl=T|0,this.Gh=E|0,this.Gl=I|0,this.Hh=A|0,this.Hl=v|0}process(e,t){for(let B=0;B<16;B++,t+=4)Or[B]=e.getUint32(t),zr[B]=e.getUint32(t+=4);for(let B=16;B<80;B++){let Z=Or[B-15]|0,F=zr[B-15]|0,Q=be.default.rotrSH(Z,F,1)^be.default.rotrSH(Z,F,8)^be.default.shrSH(Z,F,7),J=be.default.rotrSL(Z,F,1)^be.default.rotrSL(Z,F,8)^be.default.shrSL(Z,F,7),W=Or[B-2]|0,Te=zr[B-2]|0,Ae=be.default.rotrSH(W,Te,19)^be.default.rotrBH(W,Te,61)^be.default.shrSH(W,Te,6),ye=be.default.rotrSL(W,Te,19)^be.default.rotrBL(W,Te,61)^be.default.shrSL(W,Te,6),ze=be.default.add4L(J,ye,zr[B-7],zr[B-16]),Pe=be.default.add4H(ze,Q,Ae,Or[B-7],Or[B-16]);Or[B]=Pe|0,zr[B]=ze|0}let{Ah:n,Al:o,Bh:i,Bl:a,Ch:u,Cl:d,Dh:h,Dl:x,Eh:y,El:T,Fh:E,Fl:I,Gh:A,Gl:v,Hh:k,Hl:N}=this;for(let B=0;B<80;B++){let Z=be.default.rotrSH(y,T,14)^be.default.rotrSH(y,T,18)^be.default.rotrBH(y,T,41),F=be.default.rotrSL(y,T,14)^be.default.rotrSL(y,T,18)^be.default.rotrBL(y,T,41),Q=y&E^~y&A,J=T&I^~T&v,W=be.default.add5L(N,F,J,Rh[B],zr[B]),Te=be.default.add5H(W,k,Z,Q,Ih[B],Or[B]),Ae=W|0,ye=be.default.rotrSH(n,o,28)^be.default.rotrBH(n,o,34)^be.default.rotrBH(n,o,39),ze=be.default.rotrSL(n,o,28)^be.default.rotrBL(n,o,34)^be.default.rotrBL(n,o,39),Pe=n&i^n&u^i&u,rt=o&a^o&d^a&d;k=A|0,N=v|0,A=E|0,v=I|0,E=y|0,I=T|0,{h:y,l:T}=be.default.add(h|0,x|0,Te|0,Ae|0),h=u|0,x=d|0,u=i|0,d=a|0,i=n|0,a=o|0;let P=be.default.add3L(Ae,ze,rt);n=be.default.add3H(P,Te,ye,Pe),o=P|0}({h:n,l:o}=be.default.add(this.Ah|0,this.Al|0,n|0,o|0)),{h:i,l:a}=be.default.add(this.Bh|0,this.Bl|0,i|0,a|0),{h:u,l:d}=be.default.add(this.Ch|0,this.Cl|0,u|0,d|0),{h,l:x}=be.default.add(this.Dh|0,this.Dl|0,h|0,x|0),{h:y,l:T}=be.default.add(this.Eh|0,this.El|0,y|0,T|0),{h:E,l:I}=be.default.add(this.Fh|0,this.Fl|0,E|0,I|0),{h:A,l:v}=be.default.add(this.Gh|0,this.Gl|0,A|0,v|0),{h:k,l:N}=be.default.add(this.Hh|0,this.Hl|0,k|0,N|0),this.set(n,o,i,a,u,d,h,x,y,T,E,I,A,v,k,N)}roundClean(){Or.fill(0),zr.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};jt.SHA512=Ln;var ji=class extends Ln{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}},Ki=class extends Ln{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}};jt.sha512=(0,Vi.wrapConstructor)(()=>new Ln);jt.sha512_256=(0,Vi.wrapConstructor)(()=>new ji);jt.sha384=(0,Vi.wrapConstructor)(()=>new Ki)});var du=ce(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.bytes=X.stringToBytes=X.str=X.bytesToString=X.hex=X.utf8=X.bech32m=X.bech32=X.base58check=X.base58xmr=X.base58xrp=X.base58flickr=X.base58=X.base64url=X.base64=X.base32crockford=X.base32hex=X.base32=X.base16=X.utils=X.assertNumber=void 0;function Pr(r){if(!Number.isSafeInteger(r))throw new Error(`Wrong integer: ${r}`)}X.assertNumber=Pr;function qt(...r){let e=(o,i)=>a=>o(i(a)),t=Array.from(r).reverse().reduce((o,i)=>o?e(o,i.encode):i.encode,void 0),n=r.reduce((o,i)=>o?e(o,i.decode):i.decode,void 0);return{encode:t,decode:n}}function Kt(r){return{encode:e=>{if(!Array.isArray(e)||e.length&&typeof e[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return e.map(t=>{if(Pr(t),t<0||t>=r.length)throw new Error(`Digit index outside alphabet: ${t} (alphabet: ${r.length})`);return r[t]})},decode:e=>{if(!Array.isArray(e)||e.length&&typeof e[0]!="string")throw new Error("alphabet.decode input should be array of strings");return e.map(t=>{if(typeof t!="string")throw new Error(`alphabet.decode: not string element=${t}`);let n=r.indexOf(t);if(n===-1)throw new Error(`Unknown letter: "${t}". Allowed: ${r}`);return n})}}}function Vt(r=""){if(typeof r!="string")throw new Error("join separator should be string");return{encode:e=>{if(!Array.isArray(e)||e.length&&typeof e[0]!="string")throw new Error("join.encode input should be array of strings");for(let t of e)if(typeof t!="string")throw new Error(`join.encode: non-string input=${t}`);return e.join(r)},decode:e=>{if(typeof e!="string")throw new Error("join.decode input should be string");return e.split(r)}}}function _o(r,e="="){if(Pr(r),typeof e!="string")throw new Error("padding chr should be string");return{encode(t){if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("padding.encode input should be array of strings");for(let n of t)if(typeof n!="string")throw new Error(`padding.encode: non-string input=${n}`);for(;t.length*r%8;)t.push(e);return t},decode(t){if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("padding.encode input should be array of strings");for(let o of t)if(typeof o!="string")throw new Error(`padding.decode: non-string input=${o}`);let n=t.length;if(n*r%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;n>0&&t[n-1]===e;n--)if(!((n-1)*r%8))throw new Error("Invalid padding: string has too much padding");return t.slice(0,n)}}}function iu(r){if(typeof r!="function")throw new Error("normalize fn should be function");return{encode:e=>e,decode:e=>r(e)}}function tu(r,e,t){if(e<2)throw new Error(`convertRadix: wrong from=${e}, base cannot be less than 2`);if(t<2)throw new Error(`convertRadix: wrong to=${t}, base cannot be less than 2`);if(!Array.isArray(r))throw new Error("convertRadix: data should be array");if(!r.length)return[];let n=0,o=[],i=Array.from(r);for(i.forEach(a=>{if(Pr(a),a<0||a>=e)throw new Error(`Wrong integer: ${a}`)});;){let a=0,u=!0;for(let d=n;d<i.length;d++){let h=i[d],x=e*a+h;if(!Number.isSafeInteger(x)||e*a/e!==a||x-h!==e*a)throw new Error("convertRadix: carry overflow");if(a=x%t,i[d]=Math.floor(x/t),!Number.isSafeInteger(i[d])||i[d]*t+a!==x)throw new Error("convertRadix: carry overflow");if(u)i[d]?u=!1:n=d;else continue}if(o.push(a),u)break}for(let a=0;a<r.length-1&&r[a]===0;a++)o.push(0);return o.reverse()}var au=(r,e)=>e?au(e,r%e):r,Es=(r,e)=>r+(e-au(r,e));function Qi(r,e,t,n){if(!Array.isArray(r))throw new Error("convertRadix2: data should be array");if(e<=0||e>32)throw new Error(`convertRadix2: wrong from=${e}`);if(t<=0||t>32)throw new Error(`convertRadix2: wrong to=${t}`);if(Es(e,t)>32)throw new Error(`convertRadix2: carry overflow from=${e} to=${t} carryBits=${Es(e,t)}`);let o=0,i=0,a=2**t-1,u=[];for(let d of r){if(Pr(d),d>=2**e)throw new Error(`convertRadix2: invalid data word=${d} from=${e}`);if(o=o<<e|d,i+e>32)throw new Error(`convertRadix2: carry overflow pos=${i} from=${e}`);for(i+=e;i>=t;i-=t)u.push((o>>i-t&a)>>>0);o&=2**i-1}if(o=o<<t-i&a,!n&&i>=e)throw new Error("Excess padding");if(!n&&o)throw new Error(`Non-zero padding: ${o}`);return n&&i>0&&u.push(o>>>0),u}function cu(r){return Pr(r),{encode:e=>{if(!(e instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return tu(Array.from(e),2**8,r)},decode:e=>{if(!Array.isArray(e)||e.length&&typeof e[0]!="number")throw new Error("radix.decode input should be array of strings");return Uint8Array.from(tu(e,r,2**8))}}}function hr(r,e=!1){if(Pr(r),r<=0||r>32)throw new Error("radix2: bits should be in (0..32]");if(Es(8,r)>32||Es(r,8)>32)throw new Error("radix2: carry overflow");return{encode:t=>{if(!(t instanceof Uint8Array))throw new Error("radix2.encode input should be Uint8Array");return Qi(Array.from(t),8,r,!e)},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("radix2.decode input should be array of strings");return Uint8Array.from(Qi(t,r,8,e))}}}function ru(r){if(typeof r!="function")throw new Error("unsafeWrapper fn should be function");return function(...e){try{return r.apply(null,e)}catch(t){}}}function uu(r,e){if(Pr(r),typeof e!="function")throw new Error("checksum fn should be function");return{encode(t){if(!(t instanceof Uint8Array))throw new Error("checksum.encode: input should be Uint8Array");let n=e(t).slice(0,r),o=new Uint8Array(t.length+r);return o.set(t),o.set(n,t.length),o},decode(t){if(!(t instanceof Uint8Array))throw new Error("checksum.decode: input should be Uint8Array");let n=t.slice(0,-r),o=e(n).slice(0,r),i=t.slice(-r);for(let a=0;a<r;a++)if(o[a]!==i[a])throw new Error("Invalid checksum");return n}}}X.utils={alphabet:Kt,chain:qt,checksum:uu,radix:cu,radix2:hr,join:Vt,padding:_o};X.base16=qt(hr(4),Kt("0123456789ABCDEF"),Vt(""));X.base32=qt(hr(5),Kt("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),_o(5),Vt(""));X.base32hex=qt(hr(5),Kt("0123456789ABCDEFGHIJKLMNOPQRSTUV"),_o(5),Vt(""));X.base32crockford=qt(hr(5),Kt("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),Vt(""),iu(r=>r.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")));X.base64=qt(hr(6),Kt("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),_o(6),Vt(""));X.base64url=qt(hr(6),Kt("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),_o(6),Vt(""));var Yi=r=>qt(cu(58),Kt(r),Vt(""));X.base58=Yi("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");X.base58flickr=Yi("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ");X.base58xrp=Yi("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");var nu=[0,2,3,5,6,7,9,10,11];X.base58xmr={encode(r){let e="";for(let t=0;t<r.length;t+=8){let n=r.subarray(t,t+8);e+=X.base58.encode(n).padStart(nu[n.length],"1")}return e},decode(r){let e=[];for(let t=0;t<r.length;t+=11){let n=r.slice(t,t+11),o=nu.indexOf(n.length),i=X.base58.decode(n);for(let a=0;a<i.length-o;a++)if(i[a]!==0)throw new Error("base58xmr: wrong padding");e=e.concat(Array.from(i.slice(i.length-o)))}return Uint8Array.from(e)}};var kh=r=>qt(uu(4,e=>r(r(e))),X.base58);X.base58check=kh;var Wi=qt(Kt("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),Vt("")),ou=[996825010,642813549,513874426,1027748829,705979059];function Ao(r){let e=r>>25,t=(r&33554431)<<5;for(let n=0;n<ou.length;n++)(e>>n&1)===1&&(t^=ou[n]);return t}function su(r,e,t=1){let n=r.length,o=1;for(let i=0;i<n;i++){let a=r.charCodeAt(i);if(a<33||a>126)throw new Error(`Invalid prefix (${r})`);o=Ao(o)^a>>5}o=Ao(o);for(let i=0;i<n;i++)o=Ao(o)^r.charCodeAt(i)&31;for(let i of e)o=Ao(o)^i;for(let i=0;i<6;i++)o=Ao(o);return o^=t,Wi.encode(Qi([o%2**30],30,5,!1))}function fu(r){let e=r==="bech32"?1:734539939,t=hr(5),n=t.decode,o=t.encode,i=ru(n);function a(x,y,T=90){if(typeof x!="string")throw new Error(`bech32.encode prefix should be string, not ${typeof x}`);if(!Array.isArray(y)||y.length&&typeof y[0]!="number")throw new Error(`bech32.encode words should be array of numbers, not ${typeof y}`);let E=x.length+7+y.length;if(T!==!1&&E>T)throw new TypeError(`Length ${E} exceeds limit ${T}`);return x=x.toLowerCase(),`${x}1${Wi.encode(y)}${su(x,y,e)}`}function u(x,y=90){if(typeof x!="string")throw new Error(`bech32.decode input should be string, not ${typeof x}`);if(x.length<8||y!==!1&&x.length>y)throw new TypeError(`Wrong string length: ${x.length} (${x}). Expected (8..${y})`);let T=x.toLowerCase();if(x!==T&&x!==x.toUpperCase())throw new Error("String must be lowercase or uppercase");x=T;let E=x.lastIndexOf("1");if(E===0||E===-1)throw new Error('Letter "1" must be present between prefix and data only');let I=x.slice(0,E),A=x.slice(E+1);if(A.length<6)throw new Error("Data must be at least 6 characters long");let v=Wi.decode(A).slice(0,-6),k=su(I,v,e);if(!A.endsWith(k))throw new Error(`Invalid checksum in ${x}: expected "${k}"`);return{prefix:I,words:v}}let d=ru(u);function h(x){let{prefix:y,words:T}=u(x,!1);return{prefix:y,words:T,bytes:n(T)}}return{encode:a,decode:u,decodeToBytes:h,decodeUnsafe:d,fromWords:n,fromWordsUnsafe:i,toWords:o}}X.bech32=fu("bech32");X.bech32m=fu("bech32m");X.utf8={encode:r=>new TextDecoder().decode(r),decode:r=>new TextEncoder().encode(r)};X.hex=qt(hr(4),Kt("0123456789abcdef"),Vt(""),iu(r=>{if(typeof r!="string"||r.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof r} with length ${r.length}`);return r.toLowerCase()}));var wo={utf8:X.utf8,hex:X.hex,base16:X.base16,base32:X.base32,base64:X.base64,base64url:X.base64url,base58:X.base58,base58xmr:X.base58xmr},lu=`Invalid encoding type. Available types: ${Object.keys(wo).join(", ")}`,Oh=(r,e)=>{if(typeof r!="string"||!wo.hasOwnProperty(r))throw new TypeError(lu);if(!(e instanceof Uint8Array))throw new TypeError("bytesToString() expects Uint8Array");return wo[r].encode(e)};X.bytesToString=Oh;X.str=X.bytesToString;var zh=(r,e)=>{if(!wo.hasOwnProperty(r))throw new TypeError(lu);if(typeof e!="string")throw new TypeError("stringToBytes() expects string");return wo[r].decode(e)};X.stringToBytes=zh;X.bytes=X.stringToBytes});var _u=ce(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.mnemonicToSeedSync=gt.mnemonicToSeed=gt.validateMnemonic=gt.entropyToMnemonic=gt.mnemonicToEntropy=gt.generateMnemonic=void 0;var pu=xo(),hu=Wc(),Ph=Yc(),gu=eu(),Hh=un(),Ss=du(),qh=r=>r[0]==="\u3042\u3044\u3053\u304F\u3057\u3093";function yu(r){if(typeof r!="string")throw new TypeError(`Invalid mnemonic type: ${typeof r}`);return r.normalize("NFKD")}function Xi(r){let e=yu(r),t=e.split(" ");if(![12,15,18,21,24].includes(t.length))throw new Error("Invalid mnemonic");return{nfkd:e,words:t}}function xu(r){pu.default.bytes(r,16,20,24,28,32)}function Nh(r,e=128){if(pu.default.number(e),e%32!==0||e>256)throw new TypeError("Invalid entropy");return Au((0,Hh.randomBytes)(e/8),r)}gt.generateMnemonic=Nh;var Dh=r=>{let e=8-r.length/4;return new Uint8Array([(0,Ph.sha256)(r)[0]>>e<<e])};function mu(r){if(!Array.isArray(r)||r.length!==2**11||typeof r[0]!="string")throw new Error("Worlist: expected array of 2048 strings");return r.forEach(e=>{if(typeof e!="string")throw new Error(`Wordlist: non-string element: ${e}`)}),Ss.utils.chain(Ss.utils.checksum(1,Dh),Ss.utils.radix2(11,!0),Ss.utils.alphabet(r))}function bu(r,e){let{words:t}=Xi(r),n=mu(e).decode(t);return xu(n),n}gt.mnemonicToEntropy=bu;function Au(r,e){return xu(r),mu(e).encode(r).join(qh(e)?"\u3000":" ")}gt.entropyToMnemonic=Au;function Mh(r,e){try{bu(r,e)}catch(t){return!1}return!0}gt.validateMnemonic=Mh;var wu=r=>yu(`mnemonic${r}`);function Gh(r,e=""){return(0,hu.pbkdf2Async)(gu.sha512,Xi(r).nfkd,wu(e),{c:2048,dkLen:64})}gt.mnemonicToSeed=Gh;function Lh(r,e=""){return(0,hu.pbkdf2)(gu.sha512,Xi(r).nfkd,wu(e),{c:2048,dkLen:64})}gt.mnemonicToSeedSync=Lh});var oa=ce((xb,lf)=>{"use strict";lf.exports=function(e,t){return function(){for(var o=new Array(arguments.length),i=0;i<o.length;i++)o[i]=arguments[i];return e.apply(t,o)}}});var Je=ce((mb,hf)=>{"use strict";var Wh=oa(),ia=Object.prototype.toString,aa=function(r){return function(e){var t=ia.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())}}(Object.create(null));function fn(r){return r=r.toLowerCase(),function(t){return aa(t)===r}}function ca(r){return Array.isArray(r)}function zs(r){return typeof r=="undefined"}function Yh(r){return r!==null&&!zs(r)&&r.constructor!==null&&!zs(r.constructor)&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}var df=fn("ArrayBuffer");function Xh(r){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&df(r.buffer),e}function Zh(r){return typeof r=="string"}function Jh(r){return typeof r=="number"}function pf(r){return r!==null&&typeof r=="object"}function Os(r){if(aa(r)!=="object")return!1;var e=Object.getPrototypeOf(r);return e===null||e===Object.prototype}var e0=fn("Date"),t0=fn("File"),r0=fn("Blob"),n0=fn("FileList");function ua(r){return ia.call(r)==="[object Function]"}function o0(r){return pf(r)&&ua(r.pipe)}function s0(r){var e="[object FormData]";return r&&(typeof FormData=="function"&&r instanceof FormData||ia.call(r)===e||ua(r.toString)&&r.toString()===e)}var i0=fn("URLSearchParams");function a0(r){return r.trim?r.trim():r.replace(/^\s+|\s+$/g,"")}function c0(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function fa(r,e){if(!(r===null||typeof r=="undefined"))if(typeof r!="object"&&(r=[r]),ca(r))for(var t=0,n=r.length;t<n;t++)e.call(null,r[t],t,r);else for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&e.call(null,r[o],o,r)}function sa(){var r={};function e(o,i){Os(r[i])&&Os(o)?r[i]=sa(r[i],o):Os(o)?r[i]=sa({},o):ca(o)?r[i]=o.slice():r[i]=o}for(var t=0,n=arguments.length;t<n;t++)fa(arguments[t],e);return r}function u0(r,e,t){return fa(e,function(o,i){t&&typeof o=="function"?r[i]=Wh(o,t):r[i]=o}),r}function f0(r){return r.charCodeAt(0)===65279&&(r=r.slice(1)),r}function l0(r,e,t,n){r.prototype=Object.create(e.prototype,n),r.prototype.constructor=r,t&&Object.assign(r.prototype,t)}function d0(r,e,t){var n,o,i,a={};e=e||{};do{for(n=Object.getOwnPropertyNames(r),o=n.length;o-- >0;)i=n[o],a[i]||(e[i]=r[i],a[i]=!0);r=Object.getPrototypeOf(r)}while(r&&(!t||t(r,e))&&r!==Object.prototype);return e}function p0(r,e,t){r=String(r),(t===void 0||t>r.length)&&(t=r.length),t-=e.length;var n=r.indexOf(e,t);return n!==-1&&n===t}function h0(r){if(!r)return null;var e=r.length;if(zs(e))return null;for(var t=new Array(e);e-- >0;)t[e]=r[e];return t}var g0=function(r){return function(e){return r&&e instanceof r}}(typeof Uint8Array!="undefined"&&Object.getPrototypeOf(Uint8Array));hf.exports={isArray:ca,isArrayBuffer:df,isBuffer:Yh,isFormData:s0,isArrayBufferView:Xh,isString:Zh,isNumber:Jh,isObject:pf,isPlainObject:Os,isUndefined:zs,isDate:e0,isFile:t0,isBlob:r0,isFunction:ua,isStream:o0,isURLSearchParams:i0,isStandardBrowserEnv:c0,forEach:fa,merge:sa,extend:u0,trim:a0,stripBOM:f0,inherits:l0,toFlatObject:d0,kindOf:aa,kindOfTest:fn,endsWith:p0,toArray:h0,isTypedArray:g0,isFileList:n0}});var la=ce((bb,yf)=>{"use strict";var Fn=Je();function gf(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}yf.exports=function(e,t,n){if(!t)return e;var o;if(n)o=n(t);else if(Fn.isURLSearchParams(t))o=t.toString();else{var i=[];Fn.forEach(t,function(d,h){d===null||typeof d=="undefined"||(Fn.isArray(d)?h=h+"[]":d=[d],Fn.forEach(d,function(y){Fn.isDate(y)?y=y.toISOString():Fn.isObject(y)&&(y=JSON.stringify(y)),i.push(gf(h)+"="+gf(y))}))}),o=i.join("&")}if(o){var a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}});var mf=ce((Ab,xf)=>{"use strict";var y0=Je();function Ps(){this.handlers=[]}Ps.prototype.use=function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1};Ps.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};Ps.prototype.forEach=function(e){y0.forEach(this.handlers,function(n){n!==null&&e(n)})};xf.exports=Ps});var Af=ce((wb,bf)=>{"use strict";var x0=Je();bf.exports=function(e,t){x0.forEach(e,function(o,i){i!==t&&i.toUpperCase()===t.toUpperCase()&&(e[t]=o,delete e[i])})}});var ln=ce((_b,vf)=>{"use strict";var wf=Je();function $n(r,e,t,n,o){Error.call(this),this.message=r,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),n&&(this.request=n),o&&(this.response=o)}wf.inherits($n,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var _f=$n.prototype,Tf={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED"].forEach(function(r){Tf[r]={value:r}});Object.defineProperties($n,Tf);Object.defineProperty(_f,"isAxiosError",{value:!0});$n.from=function(r,e,t,n,o,i){var a=Object.create(_f);return wf.toFlatObject(r,a,function(d){return d!==Error.prototype}),$n.call(a,r.message,e,t,n,o),a.name=r.name,i&&Object.assign(a,i),a};vf.exports=$n});var da=ce((Tb,Ef)=>{"use strict";Ef.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}});var pa=ce((vb,Sf)=>{"use strict";var Nt=Je();function m0(r,e){e=e||new FormData;var t=[];function n(i){return i===null?"":Nt.isDate(i)?i.toISOString():Nt.isArrayBuffer(i)||Nt.isTypedArray(i)?typeof Blob=="function"?new Blob([i]):Buffer.from(i):i}function o(i,a){if(Nt.isPlainObject(i)||Nt.isArray(i)){if(t.indexOf(i)!==-1)throw Error("Circular reference detected in "+a);t.push(i),Nt.forEach(i,function(d,h){if(!Nt.isUndefined(d)){var x=a?a+"."+h:h,y;if(d&&!a&&typeof d=="object"){if(Nt.endsWith(h,"{}"))d=JSON.stringify(d);else if(Nt.endsWith(h,"[]")&&(y=Nt.toArray(d))){y.forEach(function(T){!Nt.isUndefined(T)&&e.append(x,n(T))});return}}o(d,x)}}),t.pop()}else e.append(a,n(i))}return o(r),e}Sf.exports=m0});var Cf=ce((Eb,Uf)=>{"use strict";var ha=ln();Uf.exports=function(e,t,n){var o=n.config.validateStatus;!n.status||!o||o(n.status)?e(n):t(new ha("Request failed with status code "+n.status,[ha.ERR_BAD_REQUEST,ha.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}});var If=ce((Sb,Bf)=>{"use strict";var Hs=Je();Bf.exports=Hs.isStandardBrowserEnv()?function(){return{write:function(t,n,o,i,a,u){var d=[];d.push(t+"="+encodeURIComponent(n)),Hs.isNumber(o)&&d.push("expires="+new Date(o).toGMTString()),Hs.isString(i)&&d.push("path="+i),Hs.isString(a)&&d.push("domain="+a),u===!0&&d.push("secure"),document.cookie=d.join("; ")},read:function(t){var n=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var kf=ce((Ub,Rf)=>{"use strict";Rf.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}});var zf=ce((Cb,Of)=>{"use strict";Of.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}});var ga=ce((Bb,Pf)=>{"use strict";var b0=kf(),A0=zf();Pf.exports=function(e,t){return e&&!b0(t)?A0(e,t):t}});var qf=ce((Ib,Hf)=>{"use strict";var ya=Je(),w0=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];Hf.exports=function(e){var t={},n,o,i;return e&&ya.forEach(e.split(`
2
- `),function(u){if(i=u.indexOf(":"),n=ya.trim(u.substr(0,i)).toLowerCase(),o=ya.trim(u.substr(i+1)),n){if(t[n]&&w0.indexOf(n)>=0)return;n==="set-cookie"?t[n]=(t[n]?t[n]:[]).concat([o]):t[n]=t[n]?t[n]+", "+o:o}}),t}});var Mf=ce((Rb,Df)=>{"use strict";var Nf=Je();Df.exports=Nf.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a"),n;function o(i){var a=i;return e&&(t.setAttribute("href",a),a=t.href),t.setAttribute("href",a),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return n=o(window.location.href),function(a){var u=Nf.isString(a)?o(a):a;return u.protocol===n.protocol&&u.host===n.host}}():function(){return function(){return!0}}()});var vo=ce((kb,Lf)=>{"use strict";var xa=ln(),_0=Je();function Gf(r){xa.call(this,r==null?"canceled":r,xa.ERR_CANCELED),this.name="CanceledError"}_0.inherits(Gf,xa,{__CANCEL__:!0});Lf.exports=Gf});var $f=ce((Ob,Ff)=>{"use strict";Ff.exports=function(e){var t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}});var ma=ce((zb,jf)=>{"use strict";var Eo=Je(),T0=Cf(),v0=If(),E0=la(),S0=ga(),U0=qf(),C0=Mf(),B0=da(),gr=ln(),I0=vo(),R0=$f();jf.exports=function(e){return new Promise(function(n,o){var i=e.data,a=e.headers,u=e.responseType,d;function h(){e.cancelToken&&e.cancelToken.unsubscribe(d),e.signal&&e.signal.removeEventListener("abort",d)}Eo.isFormData(i)&&Eo.isStandardBrowserEnv()&&delete a["Content-Type"];var x=new XMLHttpRequest;if(e.auth){var y=e.auth.username||"",T=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";a.Authorization="Basic "+btoa(y+":"+T)}var E=S0(e.baseURL,e.url);x.open(e.method.toUpperCase(),E0(E,e.params,e.paramsSerializer),!0),x.timeout=e.timeout;function I(){if(!!x){var k="getAllResponseHeaders"in x?U0(x.getAllResponseHeaders()):null,N=!u||u==="text"||u==="json"?x.responseText:x.response,B={data:N,status:x.status,statusText:x.statusText,headers:k,config:e,request:x};T0(function(F){n(F),h()},function(F){o(F),h()},B),x=null}}if("onloadend"in x?x.onloadend=I:x.onreadystatechange=function(){!x||x.readyState!==4||x.status===0&&!(x.responseURL&&x.responseURL.indexOf("file:")===0)||setTimeout(I)},x.onabort=function(){!x||(o(new gr("Request aborted",gr.ECONNABORTED,e,x)),x=null)},x.onerror=function(){o(new gr("Network Error",gr.ERR_NETWORK,e,x,x)),x=null},x.ontimeout=function(){var N=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",B=e.transitional||B0;e.timeoutErrorMessage&&(N=e.timeoutErrorMessage),o(new gr(N,B.clarifyTimeoutError?gr.ETIMEDOUT:gr.ECONNABORTED,e,x)),x=null},Eo.isStandardBrowserEnv()){var A=(e.withCredentials||C0(E))&&e.xsrfCookieName?v0.read(e.xsrfCookieName):void 0;A&&(a[e.xsrfHeaderName]=A)}"setRequestHeader"in x&&Eo.forEach(a,function(N,B){typeof i=="undefined"&&B.toLowerCase()==="content-type"?delete a[B]:x.setRequestHeader(B,N)}),Eo.isUndefined(e.withCredentials)||(x.withCredentials=!!e.withCredentials),u&&u!=="json"&&(x.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&x.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&x.upload&&x.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(d=function(k){!x||(o(!k||k&&k.type?new I0:k),x.abort(),x=null)},e.cancelToken&&e.cancelToken.subscribe(d),e.signal&&(e.signal.aborted?d():e.signal.addEventListener("abort",d))),i||(i=null);var v=R0(E);if(v&&["http","https","file"].indexOf(v)===-1){o(new gr("Unsupported protocol "+v+":",gr.ERR_BAD_REQUEST,e));return}x.send(i)})}});var Vf=ce((Pb,Kf)=>{Kf.exports=null});var Ns=ce((Hb,Xf)=>{"use strict";var et=Je(),Qf=Af(),Wf=ln(),k0=da(),O0=pa(),z0={"Content-Type":"application/x-www-form-urlencoded"};function Yf(r,e){!et.isUndefined(r)&&et.isUndefined(r["Content-Type"])&&(r["Content-Type"]=e)}function P0(){var r;return typeof XMLHttpRequest!="undefined"?r=ma():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(r=ma()),r}function H0(r,e,t){if(et.isString(r))try{return(e||JSON.parse)(r),et.trim(r)}catch(n){if(n.name!=="SyntaxError")throw n}return(t||JSON.stringify)(r)}var qs={transitional:k0,adapter:P0(),transformRequest:[function(e,t){if(Qf(t,"Accept"),Qf(t,"Content-Type"),et.isFormData(e)||et.isArrayBuffer(e)||et.isBuffer(e)||et.isStream(e)||et.isFile(e)||et.isBlob(e))return e;if(et.isArrayBufferView(e))return e.buffer;if(et.isURLSearchParams(e))return Yf(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString();var n=et.isObject(e),o=t&&t["Content-Type"],i;if((i=et.isFileList(e))||n&&o==="multipart/form-data"){var a=this.env&&this.env.FormData;return O0(i?{"files[]":e}:e,a&&new a)}else if(n||o==="application/json")return Yf(t,"application/json"),H0(e);return e}],transformResponse:[function(e){var t=this.transitional||qs.transitional,n=t&&t.silentJSONParsing,o=t&&t.forcedJSONParsing,i=!n&&this.responseType==="json";if(i||o&&et.isString(e)&&e.length)try{return JSON.parse(e)}catch(a){if(i)throw a.name==="SyntaxError"?Wf.from(a,Wf.ERR_BAD_RESPONSE,this,null,this.response):a}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Vf()},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};et.forEach(["delete","get","head"],function(e){qs.headers[e]={}});et.forEach(["post","put","patch"],function(e){qs.headers[e]=et.merge(z0)});Xf.exports=qs});var Jf=ce((qb,Zf)=>{"use strict";var q0=Je(),N0=Ns();Zf.exports=function(e,t,n){var o=this||N0;return q0.forEach(n,function(a){e=a.call(o,e,t)}),e}});var ba=ce((Nb,el)=>{"use strict";el.exports=function(e){return!!(e&&e.__CANCEL__)}});var nl=ce((Db,rl)=>{"use strict";var tl=Je(),Aa=Jf(),D0=ba(),M0=Ns(),G0=vo();function wa(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new G0}rl.exports=function(e){wa(e),e.headers=e.headers||{},e.data=Aa.call(e,e.data,e.headers,e.transformRequest),e.headers=tl.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),tl.forEach(["delete","get","head","post","put","patch","common"],function(o){delete e.headers[o]});var t=e.adapter||M0.adapter;return t(e).then(function(o){return wa(e),o.data=Aa.call(e,o.data,o.headers,e.transformResponse),o},function(o){return D0(o)||(wa(e),o&&o.response&&(o.response.data=Aa.call(e,o.response.data,o.response.headers,e.transformResponse))),Promise.reject(o)})}});var _a=ce((Mb,ol)=>{"use strict";var _t=Je();ol.exports=function(e,t){t=t||{};var n={};function o(x,y){return _t.isPlainObject(x)&&_t.isPlainObject(y)?_t.merge(x,y):_t.isPlainObject(y)?_t.merge({},y):_t.isArray(y)?y.slice():y}function i(x){if(_t.isUndefined(t[x])){if(!_t.isUndefined(e[x]))return o(void 0,e[x])}else return o(e[x],t[x])}function a(x){if(!_t.isUndefined(t[x]))return o(void 0,t[x])}function u(x){if(_t.isUndefined(t[x])){if(!_t.isUndefined(e[x]))return o(void 0,e[x])}else return o(void 0,t[x])}function d(x){if(x in t)return o(e[x],t[x]);if(x in e)return o(void 0,e[x])}var h={url:a,method:a,data:a,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,beforeRedirect:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:d};return _t.forEach(Object.keys(e).concat(Object.keys(t)),function(y){var T=h[y]||i,E=T(y);_t.isUndefined(E)&&T!==d||(n[y]=E)}),n}});var Ta=ce((Gb,sl)=>{sl.exports={version:"0.27.2"}});var cl=ce((Lb,al)=>{"use strict";var L0=Ta().version,Hr=ln(),va={};["object","boolean","number","function","string","symbol"].forEach(function(r,e){va[r]=function(n){return typeof n===r||"a"+(e<1?"n ":" ")+r}});var il={};va.transitional=function(e,t,n){function o(i,a){return"[Axios v"+L0+"] Transitional option '"+i+"'"+a+(n?". "+n:"")}return function(i,a,u){if(e===!1)throw new Hr(o(a," has been removed"+(t?" in "+t:"")),Hr.ERR_DEPRECATED);return t&&!il[a]&&(il[a]=!0,console.warn(o(a," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(i,a,u):!0}};function F0(r,e,t){if(typeof r!="object")throw new Hr("options must be an object",Hr.ERR_BAD_OPTION_VALUE);for(var n=Object.keys(r),o=n.length;o-- >0;){var i=n[o],a=e[i];if(a){var u=r[i],d=u===void 0||a(u,i,r);if(d!==!0)throw new Hr("option "+i+" must be "+d,Hr.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new Hr("Unknown option "+i,Hr.ERR_BAD_OPTION)}}al.exports={assertOptions:F0,validators:va}});var hl=ce((Fb,pl)=>{"use strict";var ll=Je(),$0=la(),ul=mf(),fl=nl(),Ds=_a(),j0=ga(),dl=cl(),jn=dl.validators;function Kn(r){this.defaults=r,this.interceptors={request:new ul,response:new ul}}Kn.prototype.request=function(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Ds(this.defaults,t),t.method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var n=t.transitional;n!==void 0&&dl.assertOptions(n,{silentJSONParsing:jn.transitional(jn.boolean),forcedJSONParsing:jn.transitional(jn.boolean),clarifyTimeoutError:jn.transitional(jn.boolean)},!1);var o=[],i=!0;this.interceptors.request.forEach(function(E){typeof E.runWhen=="function"&&E.runWhen(t)===!1||(i=i&&E.synchronous,o.unshift(E.fulfilled,E.rejected))});var a=[];this.interceptors.response.forEach(function(E){a.push(E.fulfilled,E.rejected)});var u;if(!i){var d=[fl,void 0];for(Array.prototype.unshift.apply(d,o),d=d.concat(a),u=Promise.resolve(t);d.length;)u=u.then(d.shift(),d.shift());return u}for(var h=t;o.length;){var x=o.shift(),y=o.shift();try{h=x(h)}catch(T){y(T);break}}try{u=fl(h)}catch(T){return Promise.reject(T)}for(;a.length;)u=u.then(a.shift(),a.shift());return u};Kn.prototype.getUri=function(e){e=Ds(this.defaults,e);var t=j0(e.baseURL,e.url);return $0(t,e.params,e.paramsSerializer)};ll.forEach(["delete","get","head","options"],function(e){Kn.prototype[e]=function(t,n){return this.request(Ds(n||{},{method:e,url:t,data:(n||{}).data}))}});ll.forEach(["post","put","patch"],function(e){function t(n){return function(i,a,u){return this.request(Ds(u||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}Kn.prototype[e]=t(),Kn.prototype[e+"Form"]=t(!0)});pl.exports=Kn});var yl=ce(($b,gl)=>{"use strict";var K0=vo();function Vn(r){if(typeof r!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(o){e=o});var t=this;this.promise.then(function(n){if(!!t._listeners){var o,i=t._listeners.length;for(o=0;o<i;o++)t._listeners[o](n);t._listeners=null}}),this.promise.then=function(n){var o,i=new Promise(function(a){t.subscribe(a),o=a}).then(n);return i.cancel=function(){t.unsubscribe(o)},i},r(function(o){t.reason||(t.reason=new K0(o),e(t.reason))})}Vn.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};Vn.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]};Vn.prototype.unsubscribe=function(e){if(!!this._listeners){var t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}};Vn.source=function(){var e,t=new Vn(function(o){e=o});return{token:t,cancel:e}};gl.exports=Vn});var ml=ce((jb,xl)=>{"use strict";xl.exports=function(e){return function(n){return e.apply(null,n)}}});var Al=ce((Kb,bl)=>{"use strict";var V0=Je();bl.exports=function(e){return V0.isObject(e)&&e.isAxiosError===!0}});var Tl=ce((Vb,Ea)=>{"use strict";var wl=Je(),Q0=oa(),Ms=hl(),W0=_a(),Y0=Ns();function _l(r){var e=new Ms(r),t=Q0(Ms.prototype.request,e);return wl.extend(t,Ms.prototype,e),wl.extend(t,e),t.create=function(o){return _l(W0(r,o))},t}var yt=_l(Y0);yt.Axios=Ms;yt.CanceledError=vo();yt.CancelToken=yl();yt.isCancel=ba();yt.VERSION=Ta().version;yt.toFormData=pa();yt.AxiosError=ln();yt.Cancel=yt.CanceledError;yt.all=function(e){return Promise.all(e)};yt.spread=ml();yt.isAxiosError=Al();Ea.exports=yt;Ea.exports.default=yt});var El=ce((Qb,vl)=>{vl.exports=Tl()});var ag={};Da(ag,{APTOS_PATH_REGEX:()=>vu,Account:()=>Qt,AccountAddress:()=>M,AccountAuthenticatorVariant:()=>ui,AddressInvalidReason:()=>oc,Aptos:()=>St,AptosApiError:()=>Dt,AptosConfig:()=>So,AuthenticationKey:()=>Dn,Bool:()=>Ke,DeriveScheme:()=>ja,Deserializer:()=>en,Ed25519PrivateKey:()=>nn,Ed25519PublicKey:()=>qe,Ed25519Signature:()=>We,EntryFunctionBytes:()=>tn,FixedBytes:()=>vr,Hex:()=>te,HexInvalidReason:()=>rc,KeyType:()=>Zi,MimeType:()=>jo,MoveAbility:()=>Fa,MoveFunctionVisibility:()=>La,MoveObject:()=>ao,MoveOption:()=>bt,MoveString:()=>lt,MoveVector:()=>Oe,MultiEd25519PublicKey:()=>ht,MultiEd25519Signature:()=>lr,Network:()=>Vo,NetworkToChainId:()=>Qo,NetworkToFaucetAPI:()=>di,NetworkToIndexerAPI:()=>Ko,NetworkToNodeAPI:()=>li,ParsingError:()=>ft,PrivateKey:()=>rn,PublicKey:()=>ar,RoleType:()=>$a,ScriptTransactionArgumentVariants:()=>Bn,Secp256k1PrivateKey:()=>qn,Secp256k1PublicKey:()=>ut,Secp256k1Signature:()=>It,Serializable:()=>le,Serializer:()=>zt,Signature:()=>cr,SigningScheme:()=>ro,StructTag:()=>Tt,TransactionAuthenticatorVariant:()=>ci,TransactionPayloadVariants:()=>ii,TransactionResponseType:()=>fi,TransactionVariants:()=>ai,TypeTag:()=>Xe,TypeTagAddress:()=>Nr,TypeTagBool:()=>dn,TypeTagParser:()=>Wn,TypeTagParserError:()=>Gs,TypeTagSigner:()=>Qn,TypeTagStruct:()=>Wt,TypeTagU128:()=>xn,TypeTagU16:()=>hn,TypeTagU256:()=>mn,TypeTagU32:()=>gn,TypeTagU64:()=>yn,TypeTagU8:()=>pn,TypeTagVariants:()=>si,TypeTagVector:()=>bn,U128:()=>Lt,U16:()=>Mt,U256:()=>Ft,U32:()=>Gt,U64:()=>at,U8:()=>Ct,aptosRequest:()=>no,derivePrivateKeyFromMnemonic:()=>Ji,ensureBoolean:()=>rs,get:()=>Ja,getAptosFullNode:()=>pt,isValidPath:()=>Uu,objectStructTag:()=>Z0,optionStructTag:()=>X0,outOfRangeErrorMessage:()=>nc,paginateWithCursor:()=>Wr,post:()=>Yo,postAptosFaucet:()=>gi,postAptosFullNode:()=>Yr,postAptosIndexer:()=>hi,request:()=>Ka,stringStructTag:()=>Il,validateNumberInRange:()=>ir});var Dt=class extends Error{constructor(t,n,o){super(o);this.name="AptosApiError",this.url=n.url,this.status=n.status,this.statusText=n.statusText,this.data=n.data,this.request=t}};var Ga="0.0.0";var jo=(n=>(n.JSON="application/json",n.BCS="application/x-bcs",n.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",n))(jo||{}),si=(y=>(y[y.Bool=0]="Bool",y[y.U8=1]="U8",y[y.U64=2]="U64",y[y.U128=3]="U128",y[y.Address=4]="Address",y[y.Signer=5]="Signer",y[y.Vector=6]="Vector",y[y.Struct=7]="Struct",y[y.U16=8]="U16",y[y.U32=9]="U32",y[y.U256=10]="U256",y))(si||{}),Bn=(h=>(h[h.U8=0]="U8",h[h.U64=1]="U64",h[h.U128=2]="U128",h[h.Address=3]="Address",h[h.U8Vector=4]="U8Vector",h[h.Bool=5]="Bool",h[h.U16=6]="U16",h[h.U32=7]="U32",h[h.U256=8]="U256",h))(Bn||{}),ii=(n=>(n[n.Script=0]="Script",n[n.EntryFunction=2]="EntryFunction",n[n.Multisig=3]="Multisig",n))(ii||{}),ai=(t=>(t[t.MultiAgentTransaction=0]="MultiAgentTransaction",t[t.FeePayerTransaction=1]="FeePayerTransaction",t))(ai||{}),ci=(i=>(i[i.Ed25519=0]="Ed25519",i[i.MultiEd25519=1]="MultiEd25519",i[i.MultiAgent=2]="MultiAgent",i[i.FeePayer=3]="FeePayer",i[i.Secp256k1Ecdsa=4]="Secp256k1Ecdsa",i))(ci||{}),ui=(n=>(n[n.Ed25519=0]="Ed25519",n[n.MultiEd25519=1]="MultiEd25519",n[n.Secp256k1=2]="Secp256k1",n))(ui||{}),fi=(i=>(i.Pending="pending_transaction",i.User="user_transaction",i.Genesis="genesis_transaction",i.BlockMetadata="block_metadata_transaction",i.StateCheckpoint="state_checkpoint_transaction",i))(fi||{}),La=(n=>(n.PRIVATE="private",n.PUBLIC="public",n.FRIEND="friend",n))(La||{}),Fa=(o=>(o.STORE="store",o.DROP="drop",o.KEY="key",o.COPY="copy",o))(Fa||{}),$a=(t=>(t.VALIDATOR="validator",t.FULL_NODE="full_node",t))($a||{}),ro=(n=>(n[n.Ed25519=0]="Ed25519",n[n.MultiEd25519=1]="MultiEd25519",n[n.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",n))(ro||{}),ja=(i=>(i[i.DeriveAuid=251]="DeriveAuid",i[i.DeriveObjectAddressFromObject=252]="DeriveObjectAddressFromObject",i[i.DeriveObjectAddressFromGuid=253]="DeriveObjectAddressFromGuid",i[i.DeriveObjectAddressFromSeed=254]="DeriveObjectAddressFromSeed",i[i.DeriveResourceAccountAddress=255]="DeriveResourceAccountAddress",i))(ja||{});var gd={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",429:"Too Many Requests",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable"};async function Ka(r,e){let{url:t,method:n,body:o,contentType:i,params:a,overrides:u}=r,d={...u==null?void 0:u.HEADERS,"x-aptos-client":`aptos-ts-sdk/${Ga}`,"content-type":i!=null?i:"application/json"};return u!=null&&u.TOKEN&&(d.Authorization=`Bearer ${u==null?void 0:u.TOKEN}`),e.provider({url:t,method:n,body:o,params:a,headers:d,overrides:u})}async function no(r,e){var d;let{url:t,path:n}=r,o=`${t}/${n!=null?n:""}`,i=await Ka({...r,url:o},e.client),a={status:i.status,statusText:i.statusText,data:i.data,headers:i.headers,config:i.config,request:i.request,url:o};if(e.isIndexerRequest(t)){if(a.data.errors)throw new Dt(r,a,(d=i.data.errors[0].message)!=null?d:`Unhandled Error ${i.status} : ${i.statusText}`);a.data=a.data.data}if(a.status>=200&&a.status<300)return a;let u=gd[a.status];throw new Dt(r,a,u!=null?u:`Unhandled Error ${i.status} : ${i.statusText}`)}var Ko={mainnet:"https://indexer.mainnet.aptoslabs.com/v1/graphql",testnet:"https://indexer-testnet.staging.gcp.aptosdev.com/v1/graphql",devnet:"https://indexer-devnet.staging.gcp.aptosdev.com/v1/graphql",local:"http://127.0.0.1:8090/v1/graphql"},li={mainnet:"https://fullnode.mainnet.aptoslabs.com/v1",testnet:"https://fullnode.testnet.aptoslabs.com/v1",devnet:"https://fullnode.devnet.aptoslabs.com/v1",local:"http://127.0.0.1:8080/v1"},di={mainnet:"https://faucet.mainnet.aptoslabs.com",testnet:"https://faucet.testnet.aptoslabs.com",devnet:"https://faucet.devnet.aptoslabs.com",local:"http://127.0.0.1:8081"},Vo=(i=>(i.MAINNET="mainnet",i.TESTNET="testnet",i.DEVNET="devnet",i.LOCAL="local",i.CUSTOM="custom",i))(Vo||{}),Qo={mainnet:1,testnet:2};var Va="devnet",Qa=2e5,Wa=20,Wo=20,Ya="0x1::aptos_coin::AptosCoin",Xa="APTOS::RawTransaction",pi="APTOS::RawTransactionWithData";async function Ja(r){let{aptosConfig:e,overrides:t,params:n,contentType:o,acceptType:i,path:a,originMethod:u,type:d}=r,h=e.getRequestUrl(d);return no({url:h,method:"GET",originMethod:u,path:a,contentType:o==null?void 0:o.valueOf(),acceptType:i==null?void 0:i.valueOf(),params:n,overrides:{...e,...t}},e)}async function pt(r){return Ja({...r,type:0})}async function Wr(r){let e=[],t,n=r.params;for(;;){n.start=t;let o=await pt({aptosConfig:r.aptosConfig,originMethod:r.originMethod,path:r.path,params:n,overrides:r.overrides});if(t=o.headers["x-aptos-cursor"],delete o.headers,e.push(...o.data),t==null)break}return e}async function Yo(r){let{type:e,originMethod:t,path:n,body:o,acceptType:i,contentType:a,params:u,aptosConfig:d,overrides:h}=r,x=d.getRequestUrl(e);return no({url:x,method:"POST",originMethod:t,path:n,body:o,contentType:a==null?void 0:a.valueOf(),acceptType:i==null?void 0:i.valueOf(),params:u,overrides:{...d,...h}},d)}async function Yr(r){return Yo({...r,type:0})}async function hi(r){return Yo({...r,type:1})}async function gi(r){return Yo({...r,type:2})}var yd={node:void 0,web:typeof self=="object"&&"crypto"in self?self.crypto:void 0};var ec=r=>new Uint32Array(r.buffer,r.byteOffset,Math.floor(r.byteLength/4)),Xo=r=>new DataView(r.buffer,r.byteOffset,r.byteLength);var xd=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!xd)throw new Error("Non little-endian hardware is not supported");var md=Array.from({length:256},(r,e)=>e.toString(16).padStart(2,"0"));function oo(r){if(!(r instanceof Uint8Array))throw new Error("Uint8Array expected");let e="";for(let t=0;t<r.length;t++)e+=md[r[t]];return e}function Zo(r){if(typeof r!="string")throw new TypeError("hexToBytes: expected string, got "+typeof r);if(r.length%2)throw new Error("hexToBytes: received invalid unpadded hex");let e=new Uint8Array(r.length/2);for(let t=0;t<e.length;t++){let n=t*2,o=r.slice(n,n+2),i=Number.parseInt(o,16);if(Number.isNaN(i)||i<0)throw new Error("Invalid byte sequence");e[t]=i}return e}function bd(r){if(typeof r!="string")throw new TypeError(`utf8ToBytes expected string, got ${typeof r}`);return new TextEncoder().encode(r)}function _r(r){if(typeof r=="string"&&(r=bd(r)),!(r instanceof Uint8Array))throw new TypeError(`Expected input type is Uint8Array (got ${typeof r})`);return r}var wr=class{clone(){return this._cloneInto()}};function In(r){let e=n=>r().update(_r(n)).digest(),t=r();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>r(),e}function tc(r){let e=(n,o)=>r(o).update(_r(n)).digest(),t=r({});return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=n=>r(n),e}var Jo=2**8-1,es=2**16-1,sr=2**32-1,Xr=BigInt(2)**BigInt(64)-BigInt(1),so=BigInt(2)**BigInt(128)-BigInt(1),ts=BigInt(2)**BigInt(256)-BigInt(1);var ft=class extends Error{constructor(t,n){super(t);this.invalidReason=n}};var rc=(n=>(n.TOO_SHORT="too_short",n.INVALID_LENGTH="invalid_length",n.INVALID_HEX_CHARS="invalid_hex_chars",n))(rc||{}),te=class{constructor(e){this.data=e}toUint8Array(){return this.data}toStringWithoutPrefix(){return oo(this.data)}toString(){return`0x${this.toStringWithoutPrefix()}`}static fromString(e){let t=e;if(t.startsWith("0x")&&(t=t.slice(2)),t.length===0)throw new ft("Hex string is too short, must be at least 1 char long, excluding the optional leading 0x.","too_short");if(t.length%2!==0)throw new ft("Hex string must be an even number of hex characters.","invalid_length");try{return new te(Zo(t))}catch(n){let o=n;throw new ft(`Hex string contains invalid hex characters: ${o.message}`,"invalid_hex_chars")}}static fromHexInput(e){return e instanceof Uint8Array?new te(e):te.fromString(e)}static isValid(e){try{return te.fromString(e),{valid:!0}}catch(t){let n=t;return{valid:!1,invalidReason:n.invalidReason,invalidReasonMessage:n.message}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((t,n)=>t===e.data[n])}};var le=class{bcsToBytes(){let e=new zt;return this.serialize(e),e.toUint8Array()}bcsToHex(){let e=this.bcsToBytes();return te.fromHexInput(e)}},zt=class{constructor(e=64){if(e<=0)throw new Error("Length needs to be greater than 0");this.buffer=new ArrayBuffer(e),this.offset=0}ensureBufferWillHandleSize(e){for(;this.buffer.byteLength<this.offset+e;){let t=new ArrayBuffer(this.buffer.byteLength*2);new Uint8Array(t).set(new Uint8Array(this.buffer)),this.buffer=t}}appendToBuffer(e){this.ensureBufferWillHandleSize(e.length),new Uint8Array(this.buffer,this.offset).set(e),this.offset+=e.length}serializeWithFunction(e,t,n){this.ensureBufferWillHandleSize(t);let o=new DataView(this.buffer,this.offset);e.apply(o,[0,n,!0]),this.offset+=t}serializeStr(e){let t=new TextEncoder;this.serializeBytes(t.encode(e))}serializeBytes(e){this.serializeU32AsUleb128(e.length),this.appendToBuffer(e)}serializeFixedBytes(e){this.appendToBuffer(e)}serializeBool(e){rs(e);let t=e?1:0;this.appendToBuffer(new Uint8Array([t]))}serializeU8(e){this.appendToBuffer(new Uint8Array([e]))}serializeU16(e){this.serializeWithFunction(DataView.prototype.setUint16,2,e)}serializeU32(e){this.serializeWithFunction(DataView.prototype.setUint32,4,e)}serializeU64(e){let t=BigInt(e)&BigInt(sr),n=BigInt(e)>>BigInt(32);this.serializeU32(Number(t)),this.serializeU32(Number(n))}serializeU128(e){let t=BigInt(e)&Xr,n=BigInt(e)>>BigInt(64);this.serializeU64(t),this.serializeU64(n)}serializeU256(e){let t=BigInt(e)&so,n=BigInt(e)>>BigInt(128);this.serializeU128(t),this.serializeU128(n)}serializeU32AsUleb128(e){let t=e,n=[];for(;t>>>7!==0;)n.push(t&127|128),t>>>=7;n.push(t),this.appendToBuffer(new Uint8Array(n))}toUint8Array(){return new Uint8Array(this.buffer).slice(0,this.offset)}serialize(e){e.serialize(this)}serializeVector(e){this.serializeU32AsUleb128(e.length),e.forEach(t=>{t.serialize(this)})}};Ar([Zr(0,Jo)],zt.prototype,"serializeU8",1),Ar([Zr(0,es)],zt.prototype,"serializeU16",1),Ar([Zr(0,sr)],zt.prototype,"serializeU32",1),Ar([Zr(BigInt(0),Xr)],zt.prototype,"serializeU64",1),Ar([Zr(BigInt(0),so)],zt.prototype,"serializeU128",1),Ar([Zr(BigInt(0),ts)],zt.prototype,"serializeU256",1),Ar([Zr(0,sr)],zt.prototype,"serializeU32AsUleb128",1);function rs(r){if(typeof r!="boolean")throw new Error(`${r} is not a boolean value`)}var nc=(r,e,t)=>`${r} is out of range: [${e}, ${t}]`;function ir(r,e,t){let n=BigInt(r);if(n>BigInt(t)||n<BigInt(e))throw new Error(nc(r,e,t))}function Zr(r,e){return(t,n,o)=>{let i=o.value;return o.value=function(u){return ir(u,r,e),i.apply(this,[u])},o}}var oc=(u=>(u.INCORRECT_NUMBER_OF_BYTES="incorrect_number_of_bytes",u.INVALID_HEX_CHARS="invalid_hex_chars",u.TOO_SHORT="too_short",u.TOO_LONG="too_long",u.LEADING_ZERO_X_REQUIRED="leading_zero_x_required",u.LONG_FORM_REQUIRED_UNLESS_SPECIAL="long_form_required_unless_special",u.INVALID_PADDING_ZEROES="INVALID_PADDING_ZEROES",u))(oc||{}),Ze=class extends le{constructor(t){super();if(t.data.length!==Ze.LENGTH)throw new ft("AccountAddress data should be exactly 32 bytes long","incorrect_number_of_bytes");this.data=t.data}isSpecial(){return this.data.slice(0,this.data.length-1).every(t=>t===0)&&this.data[this.data.length-1]<16}toString(){return`0x${this.toStringWithoutPrefix()}`}toStringWithoutPrefix(){let t=oo(this.data);return this.isSpecial()&&(t=t[t.length-1]),t}toStringLong(){return`0x${this.toStringLongWithoutPrefix()}`}toStringLongWithoutPrefix(){return oo(this.data)}toUint8Array(){return this.data}serialize(t){t.serializeFixedBytes(this.data)}serializeForEntryFunction(t){let n=this.bcsToBytes();t.serializeBytes(n)}serializeForScriptFunction(t){t.serializeU32AsUleb128(3),t.serialize(this)}static deserialize(t){let n=t.deserializeFixedBytes(Ze.LENGTH);return new Ze({data:n})}static fromString(t){if(!t.startsWith("0x"))throw new ft("Hex string must start with a leading 0x.","leading_zero_x_required");let n=Ze.fromStringRelaxed(t);if(t.length!==Ze.LONG_STRING_LENGTH+2)if(n.isSpecial()){if(t.length!==3)throw new ft(`The given hex string ${t} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,"INVALID_PADDING_ZEROES")}else throw new ft(`The given hex string ${n} is not a special address, it must be represented as 0x + 64 chars.`,"long_form_required_unless_special");return n}static fromStringRelaxed(t){let n=t;if(t.startsWith("0x")&&(n=t.slice(2)),n.length===0)throw new ft("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(n.length>64)throw new ft("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.","too_long");let o;try{o=Zo(n.padStart(64,"0"))}catch(i){let a=i;throw new ft(`Hex characters are invalid: ${a.message}`,"invalid_hex_chars")}return new Ze({data:o})}static fromHexInput(t){return t instanceof Uint8Array?new Ze({data:t}):Ze.fromString(t)}static fromHexInputRelaxed(t){return t instanceof Uint8Array?new Ze({data:t}):Ze.fromStringRelaxed(t)}static isValid(t){try{return t.relaxed?Ze.fromStringRelaxed(t.input):Ze.fromString(t.input),{valid:!0}}catch(n){let o=n;return{valid:!1,invalidReason:o.invalidReason,invalidReasonMessage:o.message}}}equals(t){return this.data.length!==t.data.length?!1:this.data.every((n,o)=>n===t.data[o])}},M=Ze;M.LENGTH=32,M.LONG_STRING_LENGTH=64,M.ONE=Ze.fromString("0x1"),M.TWO=Ze.fromString("0x2"),M.THREE=Ze.fromString("0x3"),M.FOUR=Ze.fromString("0x4");function yi(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`Wrong positive integer: ${r}`)}function Ad(r){if(typeof r!="boolean")throw new Error(`Expected boolean, not ${r}`)}function sc(r,...e){if(!(r instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(e.length>0&&!e.includes(r.length))throw new TypeError(`Expected Uint8Array of length ${e}, not of length=${r.length}`)}function wd(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");yi(r.outputLen),yi(r.blockLen)}function _d(r,e=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(e&&r.finished)throw new Error("Hash#digest() has already been called")}function Td(r,e){sc(r);let t=e.outputLen;if(r.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)}var vd={number:yi,bool:Ad,bytes:sc,hash:wd,exists:_d,output:Td},it=vd;var ns=BigInt(4294967295),xi=BigInt(32);function ic(r,e=!1){return e?{h:Number(r&ns),l:Number(r>>xi&ns)}:{h:Number(r>>xi&ns)|0,l:Number(r&ns)|0}}function Ed(r,e=!1){let t=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let o=0;o<r.length;o++){let{h:i,l:a}=ic(r[o],e);[t[o],n[o]]=[i,a]}return[t,n]}var Sd=(r,e)=>BigInt(r>>>0)<<xi|BigInt(e>>>0),Ud=(r,e,t)=>r>>>t,Cd=(r,e,t)=>r<<32-t|e>>>t,Bd=(r,e,t)=>r>>>t|e<<32-t,Id=(r,e,t)=>r<<32-t|e>>>t,Rd=(r,e,t)=>r<<64-t|e>>>t-32,kd=(r,e,t)=>r>>>t-32|e<<64-t,Od=(r,e)=>e,zd=(r,e)=>r,Pd=(r,e,t)=>r<<t|e>>>32-t,Hd=(r,e,t)=>e<<t|r>>>32-t,qd=(r,e,t)=>e<<t-32|r>>>64-t,Nd=(r,e,t)=>r<<t-32|e>>>64-t;function Dd(r,e,t,n){let o=(e>>>0)+(n>>>0);return{h:r+t+(o/2**32|0)|0,l:o|0}}var Md=(r,e,t)=>(r>>>0)+(e>>>0)+(t>>>0),Gd=(r,e,t,n)=>e+t+n+(r/2**32|0)|0,Ld=(r,e,t,n)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0),Fd=(r,e,t,n,o)=>e+t+n+o+(r/2**32|0)|0,$d=(r,e,t,n,o)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0)+(o>>>0),jd=(r,e,t,n,o,i)=>e+t+n+o+i+(r/2**32|0)|0,Kd={fromBig:ic,split:Ed,toBig:Sd,shrSH:Ud,shrSL:Cd,rotrSH:Bd,rotrSL:Id,rotrBH:Rd,rotrBL:kd,rotr32H:Od,rotr32L:zd,rotlSH:Pd,rotlSL:Hd,rotlBH:qd,rotlBL:Nd,add:Dd,add3L:Md,add3H:Gd,add4L:Ld,add4H:Fd,add5H:jd,add5L:$d},ne=Kd;var[uc,fc,lc]=[[],[],[]],Vd=BigInt(0),io=BigInt(1),Qd=BigInt(2),Wd=BigInt(7),Yd=BigInt(256),Xd=BigInt(113);for(let r=0,e=io,t=1,n=0;r<24;r++){[t,n]=[n,(2*t+3*n)%5],uc.push(2*(5*n+t)),fc.push((r+1)*(r+2)/2%64);let o=Vd;for(let i=0;i<7;i++)e=(e<<io^(e>>Wd)*Xd)%Yd,e&Qd&&(o^=io<<(io<<BigInt(i))-io);lc.push(o)}var[Zd,Jd]=ne.split(lc,!0),ac=(r,e,t)=>t>32?ne.rotlBH(r,e,t):ne.rotlSH(r,e,t),cc=(r,e,t)=>t>32?ne.rotlBL(r,e,t):ne.rotlSL(r,e,t);function ep(r,e=24){let t=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let a=0;a<10;a++)t[a]=r[a]^r[a+10]^r[a+20]^r[a+30]^r[a+40];for(let a=0;a<10;a+=2){let u=(a+8)%10,d=(a+2)%10,h=t[d],x=t[d+1],y=ac(h,x,1)^t[u],T=cc(h,x,1)^t[u+1];for(let E=0;E<50;E+=10)r[a+E]^=y,r[a+E+1]^=T}let o=r[2],i=r[3];for(let a=0;a<24;a++){let u=fc[a],d=ac(o,i,u),h=cc(o,i,u),x=uc[a];o=r[x],i=r[x+1],r[x]=d,r[x+1]=h}for(let a=0;a<50;a+=10){for(let u=0;u<10;u++)t[u]=r[a+u];for(let u=0;u<10;u++)r[a+u]^=~t[(u+2)%10]&t[(u+4)%10]}r[0]^=Zd[n],r[1]^=Jd[n]}t.fill(0)}var Rn=class extends wr{constructor(e,t,n,o=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=o,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,it.number(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=ec(this.state)}keccak(){ep(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){it.exists(this);let{blockLen:t,state:n}=this;e=_r(e);let o=e.length;for(let i=0;i<o;){let a=Math.min(t-this.pos,o-i);for(let u=0;u<a;u++)n[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:n,blockLen:o}=this;e[n]^=t,(t&128)!==0&&n===o-1&&this.keccak(),e[o-1]^=128,this.keccak()}writeInto(e){it.exists(this,!1),it.bytes(e),this.finish();let t=this.state,{blockLen:n}=this;for(let o=0,i=e.length;o<i;){this.posOut>=n&&this.keccak();let a=Math.min(n-this.posOut,i-o);e.set(t.subarray(this.posOut,this.posOut+a),o),this.posOut+=a,o+=a}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return it.number(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(it.output(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){let{blockLen:t,suffix:n,outputLen:o,rounds:i,enableXOF:a}=this;return e||(e=new Rn(t,n,o,a,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=n,e.outputLen=o,e.enableXOF=a,e.destroyed=this.destroyed,e}},Tr=(r,e,t)=>In(()=>new Rn(e,r,t)),uy=Tr(6,144,224/8),Jr=Tr(6,136,256/8),fy=Tr(6,104,384/8),ly=Tr(6,72,512/8),dy=Tr(1,144,224/8),py=Tr(1,136,256/8),hy=Tr(1,104,384/8),gy=Tr(1,72,512/8),dc=(r,e,t)=>tc((n={})=>new Rn(e,r,n.dkLen===void 0?t:n.dkLen,!0)),yy=dc(31,168,128/8),xy=dc(31,136,256/8);var co=oi(hc());var en=class{constructor(e){this.buffer=new ArrayBuffer(e.length),new Uint8Array(this.buffer).set(e,0),this.offset=0}read(e){if(this.offset+e>this.buffer.byteLength)throw new Error("Reached to the end of buffer");let t=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}deserializeStr(){let e=this.deserializeBytes();return new TextDecoder().decode(e)}deserializeBytes(){let e=this.deserializeUleb128AsU32();return new Uint8Array(this.read(e))}deserializeFixedBytes(e){return new Uint8Array(this.read(e))}deserializeBool(){let e=new Uint8Array(this.read(1))[0];if(e!==1&&e!==0)throw new Error("Invalid boolean value");return e===1}deserializeU8(){return new DataView(this.read(1)).getUint8(0)}deserializeU16(){return new DataView(this.read(2)).getUint16(0,!0)}deserializeU32(){return new DataView(this.read(4)).getUint32(0,!0)}deserializeU64(){let e=this.deserializeU32(),t=this.deserializeU32();return BigInt(BigInt(t)<<BigInt(32)|BigInt(e))}deserializeU128(){let e=this.deserializeU64(),t=this.deserializeU64();return BigInt(t<<BigInt(64)|e)}deserializeU256(){let e=this.deserializeU128(),t=this.deserializeU128();return BigInt(t<<BigInt(128)|e)}deserializeUleb128AsU32(){let e=BigInt(0),t=0;for(;e<sr;){let n=this.deserializeU8();if(e|=BigInt(n&127)<<BigInt(t),(n&128)===0)break;t+=7}if(e>sr)throw new Error("Overflow while parsing uleb128-encoded uint32 value");return Number(e)}deserialize(e){return e.deserialize(this)}deserializeVector(e){let t=this.deserializeUleb128AsU32(),n=new Array;for(let o=0;o<t;o+=1)n.push(this.deserialize(e));return n}};var vr=class extends le{constructor(t){super();this.value=te.fromHexInput(t).toUint8Array()}serialize(t){t.serializeFixedBytes(this.value)}serializeForEntryFunction(t){t.serialize(this)}serializeForScriptFunction(t){t.serialize(this)}static deserialize(t,n){let o=t.deserializeFixedBytes(n);return new vr(o)}};var tn=class extends le{constructor(t){super();this.value=new vr(t)}serialize(t){t.serialize(this.value)}serializeForEntryFunction(t){t.serializeU32AsUleb128(this.value.value.length),t.serialize(this)}static deserialize(t,n){let o=vr.deserialize(t,n);return new tn(o.value)}};var Ke=class extends le{constructor(t){super();rs(t),this.value=t}serialize(t){t.serializeBool(this.value)}serializeForEntryFunction(t){let n=this.bcsToBytes();t.serializeBytes(n)}serializeForScriptFunction(t){t.serializeU32AsUleb128(5),t.serialize(this)}static deserialize(t){return new Ke(t.deserializeBool())}},Ct=class extends le{constructor(t){super();ir(t,0,Jo),this.value=t}serialize(t){t.serializeU8(this.value)}serializeForEntryFunction(t){let n=this.bcsToBytes();t.serializeBytes(n)}serializeForScriptFunction(t){t.serializeU32AsUleb128(0),t.serialize(this)}static deserialize(t){return new Ct(t.deserializeU8())}},Mt=class extends le{constructor(t){super();ir(t,0,es),this.value=t}serialize(t){t.serializeU16(this.value)}serializeForEntryFunction(t){let n=this.bcsToBytes();t.serializeBytes(n)}serializeForScriptFunction(t){t.serializeU32AsUleb128(6),t.serialize(this)}static deserialize(t){return new Mt(t.deserializeU16())}},Gt=class extends le{constructor(t){super();ir(t,0,sr),this.value=t}serialize(t){t.serializeU32(this.value)}serializeForEntryFunction(t){let n=this.bcsToBytes();t.serializeBytes(n)}serializeForScriptFunction(t){t.serializeU32AsUleb128(7),t.serialize(this)}static deserialize(t){return new Gt(t.deserializeU32())}},at=class extends le{constructor(t){super();ir(t,BigInt(0),Xr),this.value=BigInt(t)}serialize(t){t.serializeU64(this.value)}serializeForEntryFunction(t){let n=this.bcsToBytes();t.serializeBytes(n)}serializeForScriptFunction(t){t.serializeU32AsUleb128(1),t.serialize(this)}static deserialize(t){return new at(t.deserializeU64())}},Lt=class extends le{constructor(t){super();ir(t,BigInt(0),so),this.value=BigInt(t)}serialize(t){t.serializeU128(this.value)}serializeForEntryFunction(t){let n=this.bcsToBytes();t.serializeBytes(n)}serializeForScriptFunction(t){t.serializeU32AsUleb128(2),t.serialize(this)}static deserialize(t){return new Lt(t.deserializeU128())}},Ft=class extends le{constructor(t){super();ir(t,BigInt(0),ts),this.value=BigInt(t)}serialize(t){t.serializeU256(this.value)}serializeForEntryFunction(t){let n=this.bcsToBytes();t.serializeBytes(n)}serializeForScriptFunction(t){t.serializeU32AsUleb128(8),t.serialize(this)}static deserialize(t){return new Ft(t.deserializeU256())}};var Oe=class extends le{constructor(t){super();this.values=t}serializeForEntryFunction(t){let n=this.bcsToBytes();t.serializeBytes(n)}serializeForScriptFunction(t){if(!(this.values[0]instanceof Ct))throw new Error("Script function arguments only accept u8 vectors");t.serializeU32AsUleb128(4),t.serialize(this)}static U8(t){let n;if(Array.isArray(t)&&typeof t[0]=="number")n=t;else if(typeof t=="string"){let o=te.fromHexInput(t);n=Array.from(o.toUint8Array())}else if(t instanceof Uint8Array)n=Array.from(t);else throw new Error("Invalid input type");return new Oe(n.map(o=>new Ct(o)))}static U16(t){return new Oe(t.map(n=>new Mt(n)))}static U32(t){return new Oe(t.map(n=>new Gt(n)))}static U64(t){return new Oe(t.map(n=>new at(n)))}static U128(t){return new Oe(t.map(n=>new Lt(n)))}static U256(t){return new Oe(t.map(n=>new Ft(n)))}static Bool(t){return new Oe(t.map(n=>new Ke(n)))}static MoveString(t){return new Oe(t.map(n=>new lt(n)))}serialize(t){t.serializeVector(this.values)}static deserialize(t,n){let o=t.deserializeUleb128AsU32(),i=new Array;for(let a=0;a<o;a+=1)i.push(n.deserialize(t));return new Oe(i)}},lt=class extends le{constructor(t){super();this.value=t}serialize(t){t.serializeStr(this.value)}serializeForEntryFunction(t){let n=this.bcsToBytes();t.serializeBytes(n)}serializeForScriptFunction(t){Oe.U8(this.bcsToBytes()).serializeForScriptFunction(t)}static deserialize(t){return new lt(t.deserializeStr())}},bt=class extends le{constructor(t){super();typeof t!="undefined"&&t!==null?this.vec=new Oe([t]):this.vec=new Oe([]),[this.value]=this.vec.values}serializeForEntryFunction(t){let n=this.bcsToBytes();t.serializeBytes(n)}unwrap(){if(this.isSome())return this.vec.values[0];throw new Error("Called unwrap on a MoveOption with no value")}isSome(){return this.vec.values.length===1}serialize(t){this.vec.serialize(t)}static U8(t){return new bt(t!=null?new Ct(t):void 0)}static U16(t){return new bt(t!=null?new Mt(t):void 0)}static U32(t){return new bt(t!=null?new Gt(t):void 0)}static U64(t){return new bt(t!=null?new at(t):void 0)}static U128(t){return new bt(t!=null?new Lt(t):void 0)}static U256(t){return new bt(t!=null?new Ft(t):void 0)}static Bool(t){return new bt(t!=null?new Ke(t):void 0)}static MoveString(t){return new bt(t!=null?new lt(t):void 0)}static deserialize(t,n){let o=Oe.deserialize(t,n);return new bt(o.values[0])}},ao=class extends le{constructor(t){super();t instanceof M?this.value=t:this.value=M.fromHexInputRelaxed(t)}serialize(t){t.serialize(this.value)}serializeForEntryFunction(t){this.value.serializeForEntryFunction(t)}serializeForScriptFunction(t){this.value.serializeForScriptFunction(t)}static deserialize(t){let n=t.deserialize(M);return new ao(n)}};var ar=class extends le{},rn=class extends le{},cr=class extends le{};var uo=class extends ar{constructor(t){super();let n=te.fromHexInput(t);if(n.toUint8Array().length!==uo.LENGTH)throw new Error(`PublicKey length should be ${uo.LENGTH}`);this.key=n}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(t){let{message:n,signature:o}=t,i=te.fromHexInput(n).toUint8Array(),a=te.fromHexInput(o.toUint8Array()).toUint8Array();return co.default.sign.detached.verify(i,a,this.key.toUint8Array())}serialize(t){t.serializeBytes(this.key.toUint8Array())}static deserialize(t){let n=t.deserializeBytes();return new uo(n)}},qe=uo;qe.LENGTH=32;var ur=class extends rn{constructor(t){super();let n=te.fromHexInput(t);if(n.toUint8Array().length!==ur.LENGTH)throw new Error(`PrivateKey length should be ${ur.LENGTH}`);this.signingKeyPair=co.default.sign.keyPair.fromSeed(n.toUint8Array().slice(0,ur.LENGTH))}toUint8Array(){return this.signingKeyPair.secretKey.slice(0,ur.LENGTH)}toString(){return te.fromHexInput(this.toUint8Array()).toString()}sign(t){let n=te.fromHexInput(t),o=co.default.sign.detached(n.toUint8Array(),this.signingKeyPair.secretKey);return new We(o)}serialize(t){t.serializeBytes(this.toUint8Array())}static deserialize(t){let n=t.deserializeBytes();return new ur(n)}static generate(){let t=co.default.sign.keyPair();return new ur(t.secretKey.slice(0,ur.LENGTH))}publicKey(){let t=this.signingKeyPair.publicKey;return new qe(t)}},nn=ur;nn.LENGTH=32;var fo=class extends cr{constructor(t){super();let n=te.fromHexInput(t);if(n.toUint8Array().length!==fo.LENGTH)throw new Error(`Signature length should be ${fo.LENGTH}`);this.data=n}toUint8Array(){return this.data.toUint8Array()}toString(){return this.data.toString()}serialize(t){t.serializeBytes(this.data.toUint8Array())}static deserialize(t){let n=t.deserializeBytes();return new fo(n)}},We=fo;We.LENGTH=64;var fr=class extends ar{constructor(t){super();let{publicKeys:n,threshold:o}=t;if(n.length>fr.MAX_KEYS||n.length<fr.MIN_KEYS)throw new Error(`Must have between ${fr.MIN_KEYS} and ${fr.MAX_KEYS} public keys, inclusive`);if(o<fr.MIN_THRESHOLD||o>n.length)throw new Error(`Threshold must be between ${fr.MIN_THRESHOLD} and ${n.length}, inclusive`);this.publicKeys=n,this.threshold=o}toUint8Array(){let t=new Uint8Array(this.publicKeys.length*qe.LENGTH+1);return this.publicKeys.forEach((n,o)=>{t.set(n.toUint8Array(),o*qe.LENGTH)}),t[this.publicKeys.length*qe.LENGTH]=this.threshold,t}toString(){return te.fromHexInput(this.toUint8Array()).toString()}verifySignature(t){throw new Error("TODO - Method not implemented.")}serialize(t){t.serializeBytes(this.toUint8Array())}static deserialize(t){let n=t.deserializeBytes(),o=n[n.length-1],i=[];for(let a=0;a<n.length-1;a+=qe.LENGTH){let u=a;i.push(new qe(n.subarray(u,u+qe.LENGTH)))}return new fr({publicKeys:i,threshold:o})}},ht=fr;ht.MAX_KEYS=32,ht.MIN_KEYS=2,ht.MIN_THRESHOLD=1;var $t=class extends cr{constructor(t){super();let{signatures:n,bitmap:o}=t;if(o.length!==$t.BITMAP_LEN)throw new Error(`"bitmap" length should be ${$t.BITMAP_LEN}`);if(n.length>$t.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${$t.MAX_SIGNATURES_SUPPORTED}`);this.signatures=n,this.bitmap=o}toUint8Array(){let t=new Uint8Array(this.signatures.length*We.LENGTH+$t.BITMAP_LEN);return this.signatures.forEach((n,o)=>{t.set(n.toUint8Array(),o*We.LENGTH)}),t.set(this.bitmap,this.signatures.length*We.LENGTH),t}toString(){return te.fromHexInput(this.toUint8Array()).toString()}static createBitmap(t){let{bits:n}=t,o=128,i=new Uint8Array([0,0,0,0]),a=new Set;return n.forEach(u=>{if(u>=$t.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${$t.MAX_SIGNATURES_SUPPORTED-1}.`);if(a.has(u))throw new Error("Duplicate bits detected.");a.add(u);let d=Math.floor(u/8),h=i[d];h|=o>>u%8,i[d]=h}),i}serialize(t){t.serializeBytes(this.toUint8Array())}static deserialize(t){let n=t.deserializeBytes(),o=n.subarray(n.length-4),i=[];for(let a=0;a<n.length-o.length;a+=We.LENGTH){let u=a;i.push(new We(n.subarray(u,u+We.LENGTH)))}return new $t({signatures:i,bitmap:o})}},lr=$t;lr.MAX_SIGNATURES_SUPPORTED=32,lr.BITMAP_LEN=4;function gc(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`Wrong positive integer: ${r}`)}function mi(r,...e){if(!(r instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(r.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${r.length}`)}function yc(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");gc(r.outputLen),gc(r.blockLen)}function kn(r,e=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(e&&r.finished)throw new Error("Hash#digest() has already been called")}function xc(r,e){mi(r);let t=e.outputLen;if(r.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)}var ss=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var mc=r=>r instanceof Uint8Array;var is=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),Pt=(r,e)=>r<<32-e|r>>>e,tp=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!tp)throw new Error("Non little-endian hardware is not supported");function rp(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function lo(r){if(typeof r=="string"&&(r=rp(r)),!mc(r))throw new Error(`expected Uint8Array, got ${typeof r}`);return r}function bc(...r){let e=new Uint8Array(r.reduce((n,o)=>n+o.length,0)),t=0;return r.forEach(n=>{if(!mc(n))throw new Error("Uint8Array expected");e.set(n,t),t+=n.length}),e}var On=class{clone(){return this._cloneInto()}},xx={}.toString;function Ac(r){let e=n=>r().update(lo(n)).digest(),t=r();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>r(),e}function wc(r=32){if(ss&&typeof ss.getRandomValues=="function")return ss.getRandomValues(new Uint8Array(r));throw new Error("crypto.getRandomValues must be defined")}function np(r,e,t,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(e,t,n);let o=BigInt(32),i=BigInt(4294967295),a=Number(t>>o&i),u=Number(t&i),d=n?4:0,h=n?0:4;r.setUint32(e+d,a,n),r.setUint32(e+h,u,n)}var as=class extends On{constructor(e,t,n,o){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=is(this.buffer)}update(e){kn(this);let{view:t,buffer:n,blockLen:o}=this;e=lo(e);let i=e.length;for(let a=0;a<i;){let u=Math.min(o-this.pos,i-a);if(u===o){let d=is(e);for(;o<=i-a;a+=o)this.process(d,a);continue}n.set(e.subarray(a,a+u),this.pos),this.pos+=u,a+=u,this.pos===o&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){kn(this),xc(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:o,isLE:i}=this,{pos:a}=this;t[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>o-a&&(this.process(n,0),a=0);for(let y=a;y<o;y++)t[y]=0;np(n,o-8,BigInt(this.length*8),i),this.process(n,0);let u=is(e),d=this.outputLen;if(d%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let h=d/4,x=this.get();if(h>x.length)throw new Error("_sha2: outputLen bigger than state");for(let y=0;y<h;y++)u.setUint32(4*y,x[y],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:n,length:o,finished:i,destroyed:a,pos:u}=this;return e.length=o,e.pos=u,e.finished=i,e.destroyed=a,o%t&&e.buffer.set(n),e}};var op=(r,e,t)=>r&e^~r&t,sp=(r,e,t)=>r&e^r&t^e&t,ip=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Er=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Sr=new Uint32Array(64),bi=class extends as{constructor(){super(64,32,8,!1),this.A=Er[0]|0,this.B=Er[1]|0,this.C=Er[2]|0,this.D=Er[3]|0,this.E=Er[4]|0,this.F=Er[5]|0,this.G=Er[6]|0,this.H=Er[7]|0}get(){let{A:e,B:t,C:n,D:o,E:i,F:a,G:u,H:d}=this;return[e,t,n,o,i,a,u,d]}set(e,t,n,o,i,a,u,d){this.A=e|0,this.B=t|0,this.C=n|0,this.D=o|0,this.E=i|0,this.F=a|0,this.G=u|0,this.H=d|0}process(e,t){for(let y=0;y<16;y++,t+=4)Sr[y]=e.getUint32(t,!1);for(let y=16;y<64;y++){let T=Sr[y-15],E=Sr[y-2],I=Pt(T,7)^Pt(T,18)^T>>>3,A=Pt(E,17)^Pt(E,19)^E>>>10;Sr[y]=A+Sr[y-7]+I+Sr[y-16]|0}let{A:n,B:o,C:i,D:a,E:u,F:d,G:h,H:x}=this;for(let y=0;y<64;y++){let T=Pt(u,6)^Pt(u,11)^Pt(u,25),E=x+T+op(u,d,h)+ip[y]+Sr[y]|0,A=(Pt(n,2)^Pt(n,13)^Pt(n,22))+sp(n,o,i)|0;x=h,h=d,d=u,u=a+E|0,a=i,i=o,o=n,n=E+A|0}n=n+this.A|0,o=o+this.B|0,i=i+this.C|0,a=a+this.D|0,u=u+this.E|0,d=d+this.F|0,h=h+this.G|0,x=x+this.H|0,this.set(n,o,i,a,u,d,h,x)}roundClean(){Sr.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var _c=Ac(()=>new bi);var Ti={};Da(Ti,{bitGet:()=>pp,bitLen:()=>dp,bitMask:()=>po,bitSet:()=>hp,bytesToHex:()=>on,bytesToNumberBE:()=>dr,bytesToNumberLE:()=>fs,concatBytes:()=>zn,createHmacDrbg:()=>_i,ensureBytes:()=>At,equalBytes:()=>fp,hexToBytes:()=>sn,hexToNumber:()=>wi,numberToBytesBE:()=>Ur,numberToBytesLE:()=>ls,numberToHexUnpadded:()=>Ec,numberToVarBytesBE:()=>up,utf8ToBytes:()=>lp,validateObject:()=>Cr});var vc=BigInt(0),cs=BigInt(1),ap=BigInt(2),us=r=>r instanceof Uint8Array,cp=Array.from({length:256},(r,e)=>e.toString(16).padStart(2,"0"));function on(r){if(!us(r))throw new Error("Uint8Array expected");let e="";for(let t=0;t<r.length;t++)e+=cp[r[t]];return e}function Ec(r){let e=r.toString(16);return e.length&1?`0${e}`:e}function wi(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);return BigInt(r===""?"0":`0x${r}`)}function sn(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);let e=r.length;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);let t=new Uint8Array(e/2);for(let n=0;n<t.length;n++){let o=n*2,i=r.slice(o,o+2),a=Number.parseInt(i,16);if(Number.isNaN(a)||a<0)throw new Error("Invalid byte sequence");t[n]=a}return t}function dr(r){return wi(on(r))}function fs(r){if(!us(r))throw new Error("Uint8Array expected");return wi(on(Uint8Array.from(r).reverse()))}function Ur(r,e){return sn(r.toString(16).padStart(e*2,"0"))}function ls(r,e){return Ur(r,e).reverse()}function up(r){return sn(Ec(r))}function At(r,e,t){let n;if(typeof e=="string")try{n=sn(e)}catch(i){throw new Error(`${r} must be valid hex string, got "${e}". Cause: ${i}`)}else if(us(e))n=Uint8Array.from(e);else throw new Error(`${r} must be hex string or Uint8Array`);let o=n.length;if(typeof t=="number"&&o!==t)throw new Error(`${r} expected ${t} bytes, got ${o}`);return n}function zn(...r){let e=new Uint8Array(r.reduce((n,o)=>n+o.length,0)),t=0;return r.forEach(n=>{if(!us(n))throw new Error("Uint8Array expected");e.set(n,t),t+=n.length}),e}function fp(r,e){if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(r[t]!==e[t])return!1;return!0}function lp(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function dp(r){let e;for(e=0;r>vc;r>>=cs,e+=1);return e}function pp(r,e){return r>>BigInt(e)&cs}var hp=(r,e,t)=>r|(t?cs:vc)<<BigInt(e),po=r=>(ap<<BigInt(r-1))-cs,Ai=r=>new Uint8Array(r),Tc=r=>Uint8Array.from(r);function _i(r,e,t){if(typeof r!="number"||r<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof t!="function")throw new Error("hmacFn must be a function");let n=Ai(r),o=Ai(r),i=0,a=()=>{n.fill(1),o.fill(0),i=0},u=(...y)=>t(o,n,...y),d=(y=Ai())=>{o=u(Tc([0]),y),n=u(),y.length!==0&&(o=u(Tc([1]),y),n=u())},h=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let y=0,T=[];for(;y<e;){n=u();let E=n.slice();T.push(E),y+=n.length}return zn(...T)};return(y,T)=>{a(),d(y);let E;for(;!(E=T(h()));)d();return a(),E}}var gp={bigint:r=>typeof r=="bigint",function:r=>typeof r=="function",boolean:r=>typeof r=="boolean",string:r=>typeof r=="string",stringOrUint8Array:r=>typeof r=="string"||r instanceof Uint8Array,isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,e)=>e.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};function Cr(r,e,t={}){let n=(o,i,a)=>{let u=gp[i];if(typeof u!="function")throw new Error(`Invalid validator "${i}", expected function`);let d=r[o];if(!(a&&d===void 0)&&!u(d,r))throw new Error(`Invalid param ${String(o)}=${d} (${typeof d}), expected ${i}`)};for(let[o,i]of Object.entries(e))n(o,i,!1);for(let[o,i]of Object.entries(t))n(o,i,!0);return r}var Ye=BigInt(0),Ge=BigInt(1),an=BigInt(2),yp=BigInt(3),vi=BigInt(4),Sc=BigInt(5),Uc=BigInt(8),xp=BigInt(9),mp=BigInt(16);function ct(r,e){let t=r%e;return t>=Ye?t:e+t}function bp(r,e,t){if(t<=Ye||e<Ye)throw new Error("Expected power/modulo > 0");if(t===Ge)return Ye;let n=Ge;for(;e>Ye;)e&Ge&&(n=n*r%t),r=r*r%t,e>>=Ge;return n}function wt(r,e,t){let n=r;for(;e-- >Ye;)n*=n,n%=t;return n}function ds(r,e){if(r===Ye||e<=Ye)throw new Error(`invert: expected positive integers, got n=${r} mod=${e}`);let t=ct(r,e),n=e,o=Ye,i=Ge,a=Ge,u=Ye;for(;t!==Ye;){let h=n/t,x=n%t,y=o-a*h,T=i-u*h;n=t,t=x,o=a,i=u,a=y,u=T}if(n!==Ge)throw new Error("invert: does not exist");return ct(o,e)}function Ap(r){let e=(r-Ge)/an,t,n,o;for(t=r-Ge,n=0;t%an===Ye;t/=an,n++);for(o=an;o<r&&bp(o,e,r)!==r-Ge;o++);if(n===1){let a=(r+Ge)/vi;return function(d,h){let x=d.pow(h,a);if(!d.eql(d.sqr(x),h))throw new Error("Cannot find square root");return x}}let i=(t+Ge)/an;return function(u,d){if(u.pow(d,e)===u.neg(u.ONE))throw new Error("Cannot find square root");let h=n,x=u.pow(u.mul(u.ONE,o),t),y=u.pow(d,i),T=u.pow(d,t);for(;!u.eql(T,u.ONE);){if(u.eql(T,u.ZERO))return u.ZERO;let E=1;for(let A=u.sqr(T);E<h&&!u.eql(A,u.ONE);E++)A=u.sqr(A);let I=u.pow(x,Ge<<BigInt(h-E-1));x=u.sqr(I),y=u.mul(y,I),T=u.mul(T,x),h=E}return y}}function wp(r){if(r%vi===yp){let e=(r+Ge)/vi;return function(n,o){let i=n.pow(o,e);if(!n.eql(n.sqr(i),o))throw new Error("Cannot find square root");return i}}if(r%Uc===Sc){let e=(r-Sc)/Uc;return function(n,o){let i=n.mul(o,an),a=n.pow(i,e),u=n.mul(o,a),d=n.mul(n.mul(u,an),a),h=n.mul(u,n.sub(d,n.ONE));if(!n.eql(n.sqr(h),o))throw new Error("Cannot find square root");return h}}return r%mp,Ap(r)}var _p=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Ei(r){let e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},t=_p.reduce((n,o)=>(n[o]="function",n),e);return Cr(r,t)}function Tp(r,e,t){if(t<Ye)throw new Error("Expected power > 0");if(t===Ye)return r.ONE;if(t===Ge)return e;let n=r.ONE,o=e;for(;t>Ye;)t&Ge&&(n=r.mul(n,o)),o=r.sqr(o),t>>=Ge;return n}function vp(r,e){let t=new Array(e.length),n=e.reduce((i,a,u)=>r.is0(a)?i:(t[u]=i,r.mul(i,a)),r.ONE),o=r.inv(n);return e.reduceRight((i,a,u)=>r.is0(a)?i:(t[u]=r.mul(i,t[u]),r.mul(i,a)),o),t}function Si(r,e){let t=e!==void 0?e:r.toString(2).length,n=Math.ceil(t/8);return{nBitLength:t,nByteLength:n}}function Cc(r,e,t=!1,n={}){if(r<=Ye)throw new Error(`Expected Field ORDER > 0, got ${r}`);let{nBitLength:o,nByteLength:i}=Si(r,e);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");let a=wp(r),u=Object.freeze({ORDER:r,BITS:o,BYTES:i,MASK:po(o),ZERO:Ye,ONE:Ge,create:d=>ct(d,r),isValid:d=>{if(typeof d!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof d}`);return Ye<=d&&d<r},is0:d=>d===Ye,isOdd:d=>(d&Ge)===Ge,neg:d=>ct(-d,r),eql:(d,h)=>d===h,sqr:d=>ct(d*d,r),add:(d,h)=>ct(d+h,r),sub:(d,h)=>ct(d-h,r),mul:(d,h)=>ct(d*h,r),pow:(d,h)=>Tp(u,d,h),div:(d,h)=>ct(d*ds(h,r),r),sqrN:d=>d*d,addN:(d,h)=>d+h,subN:(d,h)=>d-h,mulN:(d,h)=>d*h,inv:d=>ds(d,r),sqrt:n.sqrt||(d=>a(u,d)),invertBatch:d=>vp(u,d),cmov:(d,h,x)=>x?h:d,toBytes:d=>t?ls(d,i):Ur(d,i),fromBytes:d=>{if(d.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${d.length}`);return t?fs(d):dr(d)}});return Object.freeze(u)}function Bc(r){if(typeof r!="bigint")throw new Error("field order must be bigint");let e=r.toString(2).length;return Math.ceil(e/8)}function Ui(r){let e=Bc(r);return e+Math.ceil(e/2)}function Ic(r,e,t=!1){let n=r.length,o=Bc(e),i=Ui(e);if(n<16||n<i||n>1024)throw new Error(`expected ${i}-1024 bytes of input, got ${n}`);let a=t?dr(r):fs(r),u=ct(a,e-Ge)+Ge;return t?ls(u,o):Ur(u,o)}var Sp=BigInt(0),Ci=BigInt(1);function Rc(r,e){let t=(o,i)=>{let a=i.negate();return o?a:i},n=o=>{let i=Math.ceil(e/o)+1,a=2**(o-1);return{windows:i,windowSize:a}};return{constTimeNegate:t,unsafeLadder(o,i){let a=r.ZERO,u=o;for(;i>Sp;)i&Ci&&(a=a.add(u)),u=u.double(),i>>=Ci;return a},precomputeWindow(o,i){let{windows:a,windowSize:u}=n(i),d=[],h=o,x=h;for(let y=0;y<a;y++){x=h,d.push(x);for(let T=1;T<u;T++)x=x.add(h),d.push(x);h=x.double()}return d},wNAF(o,i,a){let{windows:u,windowSize:d}=n(o),h=r.ZERO,x=r.BASE,y=BigInt(2**o-1),T=2**o,E=BigInt(o);for(let I=0;I<u;I++){let A=I*d,v=Number(a&y);a>>=E,v>d&&(v-=T,a+=Ci);let k=A,N=A+Math.abs(v)-1,B=I%2!==0,Z=v<0;v===0?x=x.add(t(B,i[k])):h=h.add(t(Z,i[N]))}return{p:h,f:x}},wNAFCached(o,i,a,u){let d=o._WINDOW_SIZE||1,h=i.get(o);return h||(h=this.precomputeWindow(o,d),d!==1&&i.set(o,u(h))),this.wNAF(d,h,a)}}}function Bi(r){return Ei(r.Fp),Cr(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Si(r.n,r.nBitLength),...r,p:r.Fp.ORDER})}function Up(r){let e=Bi(r);Cr(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:t,Fp:n,a:o}=e;if(t){if(!n.eql(o,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof t!="object"||typeof t.beta!="bigint"||typeof t.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}var{bytesToNumberBE:Cp,hexToBytes:Bp}=Ti,cn={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(r){let{Err:e}=cn;if(r.length<2||r[0]!==2)throw new e("Invalid signature integer tag");let t=r[1],n=r.subarray(2,t+2);if(!t||n.length!==t)throw new e("Invalid signature integer: wrong length");if(n[0]&128)throw new e("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:Cp(n),l:r.subarray(t+2)}},toSig(r){let{Err:e}=cn,t=typeof r=="string"?Bp(r):r;if(!(t instanceof Uint8Array))throw new Error("ui8a expected");let n=t.length;if(n<2||t[0]!=48)throw new e("Invalid signature tag");if(t[1]!==n-2)throw new e("Invalid signature: incorrect length");let{d:o,l:i}=cn._parseInt(t.subarray(2)),{d:a,l:u}=cn._parseInt(i);if(u.length)throw new e("Invalid signature: left bytes after parsing");return{r:o,s:a}},hexFromSig(r){let e=h=>Number.parseInt(h[0],16)&8?"00"+h:h,t=h=>{let x=h.toString(16);return x.length&1?`0${x}`:x},n=e(t(r.s)),o=e(t(r.r)),i=n.length/2,a=o.length/2,u=t(i),d=t(a);return`30${t(a+i+4)}02${d}${o}02${u}${n}`}},pr=BigInt(0),Bt=BigInt(1),kx=BigInt(2),kc=BigInt(3),Ox=BigInt(4);function Ip(r){let e=Up(r),{Fp:t}=e,n=e.toBytes||((I,A,v)=>{let k=A.toAffine();return zn(Uint8Array.from([4]),t.toBytes(k.x),t.toBytes(k.y))}),o=e.fromBytes||(I=>{let A=I.subarray(1),v=t.fromBytes(A.subarray(0,t.BYTES)),k=t.fromBytes(A.subarray(t.BYTES,2*t.BYTES));return{x:v,y:k}});function i(I){let{a:A,b:v}=e,k=t.sqr(I),N=t.mul(k,I);return t.add(t.add(N,t.mul(I,A)),v)}if(!t.eql(t.sqr(e.Gy),i(e.Gx)))throw new Error("bad generator point: equation left != right");function a(I){return typeof I=="bigint"&&pr<I&&I<e.n}function u(I){if(!a(I))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function d(I){let{allowedPrivateKeyLengths:A,nByteLength:v,wrapPrivateKey:k,n:N}=e;if(A&&typeof I!="bigint"){if(I instanceof Uint8Array&&(I=on(I)),typeof I!="string"||!A.includes(I.length))throw new Error("Invalid key");I=I.padStart(v*2,"0")}let B;try{B=typeof I=="bigint"?I:dr(At("private key",I,v))}catch(Z){throw new Error(`private key must be ${v} bytes, hex or bigint, not ${typeof I}`)}return k&&(B=ct(B,N)),u(B),B}let h=new Map;function x(I){if(!(I instanceof y))throw new Error("ProjectivePoint expected")}class y{constructor(A,v,k){if(this.px=A,this.py=v,this.pz=k,A==null||!t.isValid(A))throw new Error("x required");if(v==null||!t.isValid(v))throw new Error("y required");if(k==null||!t.isValid(k))throw new Error("z required")}static fromAffine(A){let{x:v,y:k}=A||{};if(!A||!t.isValid(v)||!t.isValid(k))throw new Error("invalid affine point");if(A instanceof y)throw new Error("projective point not allowed");let N=B=>t.eql(B,t.ZERO);return N(v)&&N(k)?y.ZERO:new y(v,k,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(A){let v=t.invertBatch(A.map(k=>k.pz));return A.map((k,N)=>k.toAffine(v[N])).map(y.fromAffine)}static fromHex(A){let v=y.fromAffine(o(At("pointHex",A)));return v.assertValidity(),v}static fromPrivateKey(A){return y.BASE.multiply(d(A))}_setWindowSize(A){this._WINDOW_SIZE=A,h.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!t.is0(this.py))return;throw new Error("bad point: ZERO")}let{x:A,y:v}=this.toAffine();if(!t.isValid(A)||!t.isValid(v))throw new Error("bad point: x or y not FE");let k=t.sqr(v),N=i(A);if(!t.eql(k,N))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:A}=this.toAffine();if(t.isOdd)return!t.isOdd(A);throw new Error("Field doesn't support isOdd")}equals(A){x(A);let{px:v,py:k,pz:N}=this,{px:B,py:Z,pz:F}=A,Q=t.eql(t.mul(v,F),t.mul(B,N)),J=t.eql(t.mul(k,F),t.mul(Z,N));return Q&&J}negate(){return new y(this.px,t.neg(this.py),this.pz)}double(){let{a:A,b:v}=e,k=t.mul(v,kc),{px:N,py:B,pz:Z}=this,F=t.ZERO,Q=t.ZERO,J=t.ZERO,W=t.mul(N,N),Te=t.mul(B,B),Ae=t.mul(Z,Z),ye=t.mul(N,B);return ye=t.add(ye,ye),J=t.mul(N,Z),J=t.add(J,J),F=t.mul(A,J),Q=t.mul(k,Ae),Q=t.add(F,Q),F=t.sub(Te,Q),Q=t.add(Te,Q),Q=t.mul(F,Q),F=t.mul(ye,F),J=t.mul(k,J),Ae=t.mul(A,Ae),ye=t.sub(W,Ae),ye=t.mul(A,ye),ye=t.add(ye,J),J=t.add(W,W),W=t.add(J,W),W=t.add(W,Ae),W=t.mul(W,ye),Q=t.add(Q,W),Ae=t.mul(B,Z),Ae=t.add(Ae,Ae),W=t.mul(Ae,ye),F=t.sub(F,W),J=t.mul(Ae,Te),J=t.add(J,J),J=t.add(J,J),new y(F,Q,J)}add(A){x(A);let{px:v,py:k,pz:N}=this,{px:B,py:Z,pz:F}=A,Q=t.ZERO,J=t.ZERO,W=t.ZERO,Te=e.a,Ae=t.mul(e.b,kc),ye=t.mul(v,B),ze=t.mul(k,Z),Pe=t.mul(N,F),rt=t.add(v,k),P=t.add(B,Z);rt=t.mul(rt,P),P=t.add(ye,ze),rt=t.sub(rt,P),P=t.add(v,N);let $=t.add(B,F);return P=t.mul(P,$),$=t.add(ye,Pe),P=t.sub(P,$),$=t.add(k,N),Q=t.add(Z,F),$=t.mul($,Q),Q=t.add(ze,Pe),$=t.sub($,Q),W=t.mul(Te,P),Q=t.mul(Ae,Pe),W=t.add(Q,W),Q=t.sub(ze,W),W=t.add(ze,W),J=t.mul(Q,W),ze=t.add(ye,ye),ze=t.add(ze,ye),Pe=t.mul(Te,Pe),P=t.mul(Ae,P),ze=t.add(ze,Pe),Pe=t.sub(ye,Pe),Pe=t.mul(Te,Pe),P=t.add(P,Pe),ye=t.mul(ze,P),J=t.add(J,ye),ye=t.mul($,P),Q=t.mul(rt,Q),Q=t.sub(Q,ye),ye=t.mul(rt,ze),W=t.mul($,W),W=t.add(W,ye),new y(Q,J,W)}subtract(A){return this.add(A.negate())}is0(){return this.equals(y.ZERO)}wNAF(A){return E.wNAFCached(this,h,A,v=>{let k=t.invertBatch(v.map(N=>N.pz));return v.map((N,B)=>N.toAffine(k[B])).map(y.fromAffine)})}multiplyUnsafe(A){let v=y.ZERO;if(A===pr)return v;if(u(A),A===Bt)return this;let{endo:k}=e;if(!k)return E.unsafeLadder(this,A);let{k1neg:N,k1:B,k2neg:Z,k2:F}=k.splitScalar(A),Q=v,J=v,W=this;for(;B>pr||F>pr;)B&Bt&&(Q=Q.add(W)),F&Bt&&(J=J.add(W)),W=W.double(),B>>=Bt,F>>=Bt;return N&&(Q=Q.negate()),Z&&(J=J.negate()),J=new y(t.mul(J.px,k.beta),J.py,J.pz),Q.add(J)}multiply(A){u(A);let v=A,k,N,{endo:B}=e;if(B){let{k1neg:Z,k1:F,k2neg:Q,k2:J}=B.splitScalar(v),{p:W,f:Te}=this.wNAF(F),{p:Ae,f:ye}=this.wNAF(J);W=E.constTimeNegate(Z,W),Ae=E.constTimeNegate(Q,Ae),Ae=new y(t.mul(Ae.px,B.beta),Ae.py,Ae.pz),k=W.add(Ae),N=Te.add(ye)}else{let{p:Z,f:F}=this.wNAF(v);k=Z,N=F}return y.normalizeZ([k,N])[0]}multiplyAndAddUnsafe(A,v,k){let N=y.BASE,B=(F,Q)=>Q===pr||Q===Bt||!F.equals(N)?F.multiplyUnsafe(Q):F.multiply(Q),Z=B(this,v).add(B(A,k));return Z.is0()?void 0:Z}toAffine(A){let{px:v,py:k,pz:N}=this,B=this.is0();A==null&&(A=B?t.ONE:t.inv(N));let Z=t.mul(v,A),F=t.mul(k,A),Q=t.mul(N,A);if(B)return{x:t.ZERO,y:t.ZERO};if(!t.eql(Q,t.ONE))throw new Error("invZ was invalid");return{x:Z,y:F}}isTorsionFree(){let{h:A,isTorsionFree:v}=e;if(A===Bt)return!0;if(v)return v(y,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:A,clearCofactor:v}=e;return A===Bt?this:v?v(y,this):this.multiplyUnsafe(e.h)}toRawBytes(A=!0){return this.assertValidity(),n(y,this,A)}toHex(A=!0){return on(this.toRawBytes(A))}}y.BASE=new y(e.Gx,e.Gy,t.ONE),y.ZERO=new y(t.ZERO,t.ONE,t.ZERO);let T=e.nBitLength,E=Rc(y,e.endo?Math.ceil(T/2):T);return{CURVE:e,ProjectivePoint:y,normPrivateKeyToScalar:d,weierstrassEquation:i,isWithinCurveOrder:a}}function Rp(r){let e=Bi(r);return Cr(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function Oc(r){let e=Rp(r),{Fp:t,n}=e,o=t.BYTES+1,i=2*t.BYTES+1;function a(P){return pr<P&&P<t.ORDER}function u(P){return ct(P,n)}function d(P){return ds(P,n)}let{ProjectivePoint:h,normPrivateKeyToScalar:x,weierstrassEquation:y,isWithinCurveOrder:T}=Ip({...e,toBytes(P,$,ue){let Be=$.toAffine(),Ie=t.toBytes(Be.x),Le=zn;return ue?Le(Uint8Array.from([$.hasEvenY()?2:3]),Ie):Le(Uint8Array.from([4]),Ie,t.toBytes(Be.y))},fromBytes(P){let $=P.length,ue=P[0],Be=P.subarray(1);if($===o&&(ue===2||ue===3)){let Ie=dr(Be);if(!a(Ie))throw new Error("Point is not on curve");let Le=y(Ie),tt=t.sqrt(Le),He=(tt&Bt)===Bt;return(ue&1)===1!==He&&(tt=t.neg(tt)),{x:Ie,y:tt}}else if($===i&&ue===4){let Ie=t.fromBytes(Be.subarray(0,t.BYTES)),Le=t.fromBytes(Be.subarray(t.BYTES,2*t.BYTES));return{x:Ie,y:Le}}else throw new Error(`Point of length ${$} was invalid. Expected ${o} compressed bytes or ${i} uncompressed bytes`)}}),E=P=>on(Ur(P,e.nByteLength));function I(P){let $=n>>Bt;return P>$}function A(P){return I(P)?u(-P):P}let v=(P,$,ue)=>dr(P.slice($,ue));class k{constructor($,ue,Be){this.r=$,this.s=ue,this.recovery=Be,this.assertValidity()}static fromCompact($){let ue=e.nByteLength;return $=At("compactSignature",$,ue*2),new k(v($,0,ue),v($,ue,2*ue))}static fromDER($){let{r:ue,s:Be}=cn.toSig(At("DER",$));return new k(ue,Be)}assertValidity(){if(!T(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!T(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit($){return new k(this.r,this.s,$)}recoverPublicKey($){let{r:ue,s:Be,recovery:Ie}=this,Le=J(At("msgHash",$));if(Ie==null||![0,1,2,3].includes(Ie))throw new Error("recovery id invalid");let tt=Ie===2||Ie===3?ue+e.n:ue;if(tt>=t.ORDER)throw new Error("recovery id 2 or 3 invalid");let He=(Ie&1)===0?"02":"03",je=h.fromHex(He+E(tt)),fe=d(tt),Ve=u(-Le*fe),xr=u(Be*fe),Ot=h.BASE.multiplyAndAddUnsafe(je,Ve,xr);if(!Ot)throw new Error("point at infinify");return Ot.assertValidity(),Ot}hasHighS(){return I(this.s)}normalizeS(){return this.hasHighS()?new k(this.r,u(-this.s),this.recovery):this}toDERRawBytes(){return sn(this.toDERHex())}toDERHex(){return cn.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return sn(this.toCompactHex())}toCompactHex(){return E(this.r)+E(this.s)}}let N={isValidPrivateKey(P){try{return x(P),!0}catch($){return!1}},normPrivateKeyToScalar:x,randomPrivateKey:()=>{let P=Ui(e.n);return Ic(e.randomBytes(P),e.n)},precompute(P=8,$=h.BASE){return $._setWindowSize(P),$.multiply(BigInt(3)),$}};function B(P,$=!0){return h.fromPrivateKey(P).toRawBytes($)}function Z(P){let $=P instanceof Uint8Array,ue=typeof P=="string",Be=($||ue)&&P.length;return $?Be===o||Be===i:ue?Be===2*o||Be===2*i:P instanceof h}function F(P,$,ue=!0){if(Z(P))throw new Error("first arg must be private key");if(!Z($))throw new Error("second arg must be public key");return h.fromHex($).multiply(x(P)).toRawBytes(ue)}let Q=e.bits2int||function(P){let $=dr(P),ue=P.length*8-e.nBitLength;return ue>0?$>>BigInt(ue):$},J=e.bits2int_modN||function(P){return u(Q(P))},W=po(e.nBitLength);function Te(P){if(typeof P!="bigint")throw new Error("bigint expected");if(!(pr<=P&&P<W))throw new Error(`bigint expected < 2^${e.nBitLength}`);return Ur(P,e.nByteLength)}function Ae(P,$,ue=ye){if(["recovered","canonical"].some(Ut=>Ut in ue))throw new Error("sign() legacy options not supported");let{hash:Be,randomBytes:Ie}=e,{lowS:Le,prehash:tt,extraEntropy:He}=ue;Le==null&&(Le=!0),P=At("msgHash",P),tt&&(P=At("prehashed msgHash",Be(P)));let je=J(P),fe=x($),Ve=[Te(fe),Te(je)];if(He!=null){let Ut=He===!0?Ie(t.BYTES):He;Ve.push(At("extraEntropy",Ut))}let xr=zn(...Ve),Ot=je;function mr(Ut){let rr=Q(Ut);if(!T(rr))return;let Kr=d(rr),nr=h.BASE.multiply(rr).toAffine(),xt=u(nr.x);if(xt===pr)return;let br=u(Kr*u(Ot+xt*fe));if(br===pr)return;let Do=(nr.x===xt?0:2)|Number(nr.y&Bt),Yn=br;return Le&&I(br)&&(Yn=A(br),Do^=1),new k(xt,Yn,Do)}return{seed:xr,k2sig:mr}}let ye={lowS:e.lowS,prehash:!1},ze={lowS:e.lowS,prehash:!1};function Pe(P,$,ue=ye){let{seed:Be,k2sig:Ie}=Ae(P,$,ue),Le=e;return _i(Le.hash.outputLen,Le.nByteLength,Le.hmac)(Be,Ie)}h.BASE._setWindowSize(8);function rt(P,$,ue,Be=ze){var nr;let Ie=P;if($=At("msgHash",$),ue=At("publicKey",ue),"strict"in Be)throw new Error("options.strict was renamed to lowS");let{lowS:Le,prehash:tt}=Be,He,je;try{if(typeof Ie=="string"||Ie instanceof Uint8Array)try{He=k.fromDER(Ie)}catch(xt){if(!(xt instanceof cn.Err))throw xt;He=k.fromCompact(Ie)}else if(typeof Ie=="object"&&typeof Ie.r=="bigint"&&typeof Ie.s=="bigint"){let{r:xt,s:br}=Ie;He=new k(xt,br)}else throw new Error("PARSE");je=h.fromHex(ue)}catch(xt){if(xt.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(Le&&He.hasHighS())return!1;tt&&($=e.hash($));let{r:fe,s:Ve}=He,xr=J($),Ot=d(Ve),mr=u(xr*Ot),Ut=u(fe*Ot),rr=(nr=h.BASE.multiplyAndAddUnsafe(je,mr,Ut))==null?void 0:nr.toAffine();return rr?u(rr.x)===fe:!1}return{CURVE:e,getPublicKey:B,getSharedSecret:F,sign:Pe,verify:rt,ProjectivePoint:h,Signature:k,utils:N}}var ps=class extends On{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,yc(e);let n=lo(t);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let o=this.blockLen,i=new Uint8Array(o);i.set(n.length>o?e.create().update(n).digest():n);for(let a=0;a<i.length;a++)i[a]^=54;this.iHash.update(i),this.oHash=e.create();for(let a=0;a<i.length;a++)i[a]^=106;this.oHash.update(i),i.fill(0)}update(e){return kn(this),this.iHash.update(e),this}digestInto(e){kn(this),mi(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));let{oHash:t,iHash:n,finished:o,destroyed:i,blockLen:a,outputLen:u}=this;return e=e,e.finished=o,e.destroyed=i,e.blockLen=a,e.outputLen=u,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},Ii=(r,e,t)=>new ps(r,e).update(t).digest();Ii.create=(r,e)=>new ps(r,e);function kp(r){return{hash:r,hmac:(e,...t)=>Ii(r,e,bc(...t)),randomBytes:wc}}function zc(r,e){let t=n=>Oc({...r,...kp(n)});return Object.freeze({...t(e),create:t})}var qc=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Pc=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Op=BigInt(1),Ri=BigInt(2),Hc=(r,e)=>(r+e/Ri)/e;function zp(r){let e=qc,t=BigInt(3),n=BigInt(6),o=BigInt(11),i=BigInt(22),a=BigInt(23),u=BigInt(44),d=BigInt(88),h=r*r*r%e,x=h*h*r%e,y=wt(x,t,e)*x%e,T=wt(y,t,e)*x%e,E=wt(T,Ri,e)*h%e,I=wt(E,o,e)*E%e,A=wt(I,i,e)*I%e,v=wt(A,u,e)*A%e,k=wt(v,d,e)*v%e,N=wt(k,u,e)*A%e,B=wt(N,t,e)*x%e,Z=wt(B,a,e)*I%e,F=wt(Z,n,e)*h%e,Q=wt(F,Ri,e);if(!ki.eql(ki.sqr(Q),r))throw new Error("Cannot find square root");return Q}var ki=Cc(qc,void 0,void 0,{sqrt:zp}),Pn=zc({a:BigInt(0),b:BigInt(7),Fp:ki,n:Pc,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:r=>{let e=Pc,t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-Op*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=t,a=BigInt("0x100000000000000000000000000000000"),u=Hc(i*r,e),d=Hc(-n*r,e),h=ct(r-u*t-d*o,e),x=ct(-u*n-d*i,e),y=h>a,T=x>a;if(y&&(h=e-h),T&&(x=e-x),h>a||x>a)throw new Error("splitScalar: Endomorphism failed, k="+r);return{k1neg:y,k1:h,k2neg:T,k2:x}}}},_c),jx=BigInt(0);var Kx=Pn.ProjectivePoint;var ho=class extends ar{constructor(t){super();let n=te.fromHexInput(t);if(n.toUint8Array().length!==ho.LENGTH)throw new Error(`PublicKey length should be ${ho.LENGTH}`);this.key=n}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(t){let{message:n,signature:o}=t,i=te.fromHexInput(n).toUint8Array(),a=Jr(i),u=o.toUint8Array();return Pn.verify(u,a,this.toUint8Array())}serialize(t){t.serializeBytes(this.key.toUint8Array())}static deserialize(t){let n=t.deserializeBytes();return new ho(n)}},ut=ho;ut.LENGTH=65;var Hn=class extends rn{constructor(t){super();let n=te.fromHexInput(t);if(n.toUint8Array().length!==Hn.LENGTH)throw new Error(`PrivateKey length should be ${Hn.LENGTH}`);this.key=n}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}sign(t){let n=te.fromHexInput(t),o=Jr(n.toUint8Array()),i=Pn.sign(o,this.key.toUint8Array());return new It(i.toCompactRawBytes())}serialize(t){t.serializeBytes(this.toUint8Array())}static deserialize(t){let n=t.deserializeBytes();return new Hn(n)}static generate(){let t=Pn.utils.randomPrivateKey();return new Hn(t)}publicKey(){let t=Pn.getPublicKey(this.key.toUint8Array(),!1);return new ut(t)}},qn=Hn;qn.LENGTH=32;var go=class extends cr{constructor(t){super();let n=te.fromHexInput(t);if(n.toUint8Array().length!==go.LENGTH)throw new Error(`Signature length should be ${go.LENGTH}`);this.data=n}toUint8Array(){return this.data.toUint8Array()}toString(){return this.data.toString()}serialize(t){t.serializeBytes(this.data.toUint8Array())}static deserialize(t){let n=t.deserializeBytes();return new go(n)}},It=go;It.LENGTH=64;var Nn=class{constructor(e){let{data:t}=e,n=te.fromHexInput(t);if(n.toUint8Array().length!==Nn.LENGTH)throw new Error(`Authentication Key length should be ${Nn.LENGTH}`);this.data=n}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromBytesAndScheme(e){let{bytes:t,scheme:n}=e,o=te.fromHexInput(t).toUint8Array(),i=new Uint8Array(o.length+1);i.set(o),i.set([n],o.length);let a=Jr.create();return a.update(i),new Nn({data:a.digest()})}static fromPublicKey(e){let{publicKey:t}=e,n;if(t instanceof qe)n=0 .valueOf();else if(t instanceof ht)n=1 .valueOf();else if(t instanceof ut)n=2 .valueOf();else throw new Error("No supported authentication scheme for public key");let o=t.toUint8Array();return Nn.fromBytesAndScheme({bytes:o,scheme:n})}derivedAddress(){return new M({data:this.data.toUint8Array()})}},Dn=Nn;Dn.LENGTH=32;var hs=class extends wr{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,it.hash(e);let n=_r(t);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new TypeError("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let o=this.blockLen,i=new Uint8Array(o);i.set(n.length>o?e.create().update(n).digest():n);for(let a=0;a<i.length;a++)i[a]^=54;this.iHash.update(i),this.oHash=e.create();for(let a=0;a<i.length;a++)i[a]^=106;this.oHash.update(i),i.fill(0)}update(e){return it.exists(this),this.iHash.update(e),this}digestInto(e){it.exists(this),it.bytes(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));let{oHash:t,iHash:n,finished:o,destroyed:i,blockLen:a,outputLen:u}=this;return e=e,e.finished=o,e.destroyed=i,e.blockLen=a,e.outputLen=u,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},Oi=(r,e,t)=>new hs(r,e).update(t).digest();Oi.create=(r,e)=>new hs(r,e);function Pp(r,e,t,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(e,t,n);let o=BigInt(32),i=BigInt(4294967295),a=Number(t>>o&i),u=Number(t&i),d=n?4:0,h=n?0:4;r.setUint32(e+d,a,n),r.setUint32(e+h,u,n)}var gs=class extends wr{constructor(e,t,n,o){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Xo(this.buffer)}update(e){it.exists(this);let{view:t,buffer:n,blockLen:o}=this;e=_r(e);let i=e.length;for(let a=0;a<i;){let u=Math.min(o-this.pos,i-a);if(u===o){let d=Xo(e);for(;o<=i-a;a+=o)this.process(d,a);continue}n.set(e.subarray(a,a+u),this.pos),this.pos+=u,a+=u,this.pos===o&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){it.exists(this),it.output(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:o,isLE:i}=this,{pos:a}=this;t[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>o-a&&(this.process(n,0),a=0);for(let d=a;d<o;d++)t[d]=0;Pp(n,o-8,BigInt(this.length*8),i),this.process(n,0);let u=Xo(e);this.get().forEach((d,h)=>u.setUint32(4*h,d,i))}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:n,length:o,finished:i,destroyed:a,pos:u}=this;return e.length=o,e.pos=u,e.finished=i,e.destroyed=a,o%t&&e.buffer.set(n),e}};var[Hp,qp]=ne.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(r=>BigInt(r))),Br=new Uint32Array(80),Ir=new Uint32Array(80),yo=class extends gs{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:e,Al:t,Bh:n,Bl:o,Ch:i,Cl:a,Dh:u,Dl:d,Eh:h,El:x,Fh:y,Fl:T,Gh:E,Gl:I,Hh:A,Hl:v}=this;return[e,t,n,o,i,a,u,d,h,x,y,T,E,I,A,v]}set(e,t,n,o,i,a,u,d,h,x,y,T,E,I,A,v){this.Ah=e|0,this.Al=t|0,this.Bh=n|0,this.Bl=o|0,this.Ch=i|0,this.Cl=a|0,this.Dh=u|0,this.Dl=d|0,this.Eh=h|0,this.El=x|0,this.Fh=y|0,this.Fl=T|0,this.Gh=E|0,this.Gl=I|0,this.Hh=A|0,this.Hl=v|0}process(e,t){for(let B=0;B<16;B++,t+=4)Br[B]=e.getUint32(t),Ir[B]=e.getUint32(t+=4);for(let B=16;B<80;B++){let Z=Br[B-15]|0,F=Ir[B-15]|0,Q=ne.rotrSH(Z,F,1)^ne.rotrSH(Z,F,8)^ne.shrSH(Z,F,7),J=ne.rotrSL(Z,F,1)^ne.rotrSL(Z,F,8)^ne.shrSL(Z,F,7),W=Br[B-2]|0,Te=Ir[B-2]|0,Ae=ne.rotrSH(W,Te,19)^ne.rotrBH(W,Te,61)^ne.shrSH(W,Te,6),ye=ne.rotrSL(W,Te,19)^ne.rotrBL(W,Te,61)^ne.shrSL(W,Te,6),ze=ne.add4L(J,ye,Ir[B-7],Ir[B-16]),Pe=ne.add4H(ze,Q,Ae,Br[B-7],Br[B-16]);Br[B]=Pe|0,Ir[B]=ze|0}let{Ah:n,Al:o,Bh:i,Bl:a,Ch:u,Cl:d,Dh:h,Dl:x,Eh:y,El:T,Fh:E,Fl:I,Gh:A,Gl:v,Hh:k,Hl:N}=this;for(let B=0;B<80;B++){let Z=ne.rotrSH(y,T,14)^ne.rotrSH(y,T,18)^ne.rotrBH(y,T,41),F=ne.rotrSL(y,T,14)^ne.rotrSL(y,T,18)^ne.rotrBL(y,T,41),Q=y&E^~y&A,J=T&I^~T&v,W=ne.add5L(N,F,J,qp[B],Ir[B]),Te=ne.add5H(W,k,Z,Q,Hp[B],Br[B]),Ae=W|0,ye=ne.rotrSH(n,o,28)^ne.rotrBH(n,o,34)^ne.rotrBH(n,o,39),ze=ne.rotrSL(n,o,28)^ne.rotrBL(n,o,34)^ne.rotrBL(n,o,39),Pe=n&i^n&u^i&u,rt=o&a^o&d^a&d;k=A|0,N=v|0,A=E|0,v=I|0,E=y|0,I=T|0,{h:y,l:T}=ne.add(h|0,x|0,Te|0,Ae|0),h=u|0,x=d|0,u=i|0,d=a|0,i=n|0,a=o|0;let P=ne.add3L(Ae,ze,rt);n=ne.add3H(P,Te,ye,Pe),o=P|0}({h:n,l:o}=ne.add(this.Ah|0,this.Al|0,n|0,o|0)),{h:i,l:a}=ne.add(this.Bh|0,this.Bl|0,i|0,a|0),{h:u,l:d}=ne.add(this.Ch|0,this.Cl|0,u|0,d|0),{h,l:x}=ne.add(this.Dh|0,this.Dl|0,h|0,x|0),{h:y,l:T}=ne.add(this.Eh|0,this.El|0,y|0,T|0),{h:E,l:I}=ne.add(this.Fh|0,this.Fl|0,E|0,I|0),{h:A,l:v}=ne.add(this.Gh|0,this.Gl|0,A|0,v|0),{h:k,l:N}=ne.add(this.Hh|0,this.Hl|0,k|0,N|0),this.set(n,o,i,a,u,d,h,x,y,T,E,I,A,v,k,N)}roundClean(){Br.fill(0),Ir.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},zi=class extends yo{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}},Pi=class extends yo{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}},Nc=In(()=>new yo),mm=In(()=>new zi),bm=In(()=>new Pi);var Tu=oi(_u()),vu=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,Zi=(e=>(e.ED25519="ed25519 seed",e))(Zi||{}),Fh=2147483648,Eu=(r,e)=>{let t=Oi.create(Nc,r).update(e).digest();return{key:t.slice(0,32),chainCode:t.slice(32)}},$h=({key:r,chainCode:e},t)=>{let n=new ArrayBuffer(4);new DataView(n).setUint32(0,t);let o=new Uint8Array(n),i=new Uint8Array([0]),a=new Uint8Array([...i,...r,...o]);return Eu(e,a)},jh=r=>r.replace("'",""),Su=r=>r.split("/").slice(1).map(jh),Uu=r=>vu.test(r)?!Su(r).some(Number.isNaN):!1,Kh=r=>{let e=r.trim().split(/\s+/).map(t=>t.toLowerCase()).join(" ");return Tu.mnemonicToSeedSync(e)},Ji=(r,e,t,n=Fh)=>{if(!Uu(e))throw new Error("Invalid derivation path");let{key:o,chainCode:i}=Eu(r,Kh(t));return Su(e).map(u=>parseInt(u,10)).reduce((u,d)=>$h(u,d+n),{key:o,chainCode:i})};var Qt=class{constructor(e){let{privateKey:t,address:n}=e;if(this.publicKey=t.publicKey(),this.publicKey instanceof qe)this.signingScheme=0;else if(this.publicKey instanceof ht)this.signingScheme=1;else if(this.publicKey instanceof ut)this.signingScheme=2;else throw new Error("Can not create new Account, unsupported public key type");this.privateKey=t,this.accountAddress=n}static generate(e){let t;switch(e){case 2:t=qn.generate();break;default:t=nn.generate()}let n=new M({data:Qt.authKey({publicKey:t.publicKey()}).toUint8Array()});return new Qt({privateKey:t,address:n})}static fromPrivateKey(e){let t=e.publicKey(),n=Qt.authKey({publicKey:t}),o=new M({data:n.toUint8Array()});return Qt.fromPrivateKeyAndAddress({privateKey:e,address:o})}static fromPrivateKeyAndAddress(e){return new Qt(e)}static fromDerivationPath(e){let{path:t,mnemonic:n}=e,{key:o}=Ji("ed25519 seed",t,n),i=new nn(o);return Qt.fromPrivateKey(i)}static authKey(e){let{publicKey:t}=e;return Dn.fromPublicKey({publicKey:t}).data}sign(e){return this.privateKey.sign(e)}verifySignature(e){let{message:t,signature:n}=e,o=te.fromHexInput(t).toUint8Array();return this.publicKey.verifySignature({message:o,signature:n})}};var Us=`
1
+ "use strict";var aptosSDK=(()=>{var xd=Object.create;var co=Object.defineProperty;var $a=Object.getOwnPropertyDescriptor;var md=Object.getOwnPropertyNames;var bd=Object.getPrototypeOf,Ad=Object.prototype.hasOwnProperty;var Ka=(r=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(r,{get:(t,e)=>(typeof require!="undefined"?require:t)[e]}):r)(function(r){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+r+'" is not supported')});var ue=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),ja=(r,t)=>{for(var e in t)co(r,e,{get:t[e],enumerable:!0})},Va=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of md(t))!Ad.call(r,o)&&o!==e&&co(r,o,{get:()=>t[o],enumerable:!(n=$a(t,o))||n.enumerable});return r};var ii=(r,t,e)=>(e=r!=null?xd(bd(r)):{},Va(t||!r||!r.__esModule?co(e,"default",{value:r,enumerable:!0}):e,r)),wd=r=>Va(co({},"__esModule",{value:!0}),r),vr=(r,t,e,n)=>{for(var o=n>1?void 0:n?$a(t,e):t,i=r.length-1,a;i>=0;i--)(a=r[i])&&(o=(n?a(t,e,o):a(o))||o);return n&&o&&co(t,e,o),o};var Ac=ue(()=>{});var wc=ue((Cy,as)=>{(function(r){"use strict";var t=function(c){var l,f=new Float64Array(16);if(c)for(l=0;l<c.length;l++)f[l]=c[l];return f},e=function(){throw new Error("no PRNG")},n=new Uint8Array(16),o=new Uint8Array(32);o[0]=9;var i=t(),a=t([1]),u=t([56129,1]),d=t([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),h=t([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),x=t([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),y=t([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),T=t([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function E(c,l,f,s){c[l]=f>>24&255,c[l+1]=f>>16&255,c[l+2]=f>>8&255,c[l+3]=f&255,c[l+4]=s>>24&255,c[l+5]=s>>16&255,c[l+6]=s>>8&255,c[l+7]=s&255}function I(c,l,f,s,p){var m,b=0;for(m=0;m<p;m++)b|=c[l+m]^f[s+m];return(1&b-1>>>8)-1}function A(c,l,f,s){return I(c,l,f,s,16)}function v(c,l,f,s){return I(c,l,f,s,32)}function k(c,l,f,s){for(var p=s[0]&255|(s[1]&255)<<8|(s[2]&255)<<16|(s[3]&255)<<24,m=f[0]&255|(f[1]&255)<<8|(f[2]&255)<<16|(f[3]&255)<<24,b=f[4]&255|(f[5]&255)<<8|(f[6]&255)<<16|(f[7]&255)<<24,U=f[8]&255|(f[9]&255)<<8|(f[10]&255)<<16|(f[11]&255)<<24,P=f[12]&255|(f[13]&255)<<8|(f[14]&255)<<16|(f[15]&255)<<24,V=s[4]&255|(s[5]&255)<<8|(s[6]&255)<<16|(s[7]&255)<<24,q=l[0]&255|(l[1]&255)<<8|(l[2]&255)<<16|(l[3]&255)<<24,Se=l[4]&255|(l[5]&255)<<8|(l[6]&255)<<16|(l[7]&255)<<24,G=l[8]&255|(l[9]&255)<<8|(l[10]&255)<<16|(l[11]&255)<<24,re=l[12]&255|(l[13]&255)<<8|(l[14]&255)<<16|(l[15]&255)<<24,oe=s[8]&255|(s[9]&255)<<8|(s[10]&255)<<16|(s[11]&255)<<24,pe=f[16]&255|(f[17]&255)<<8|(f[18]&255)<<16|(f[19]&255)<<24,de=f[20]&255|(f[21]&255)<<8|(f[22]&255)<<16|(f[23]&255)<<24,se=f[24]&255|(f[25]&255)<<8|(f[26]&255)<<16|(f[27]&255)<<24,ce=f[28]&255|(f[29]&255)<<8|(f[30]&255)<<16|(f[31]&255)<<24,ie=s[12]&255|(s[13]&255)<<8|(s[14]&255)<<16|(s[15]&255)<<24,L=p,Y=m,M=b,K=U,j=P,H=V,w=q,_=Se,R=G,S=re,C=oe,O=pe,ee=de,he=se,xe=ce,ge=ie,g,we=0;we<20;we+=2)g=L+ee|0,j^=g<<7|g>>>32-7,g=j+L|0,R^=g<<9|g>>>32-9,g=R+j|0,ee^=g<<13|g>>>32-13,g=ee+R|0,L^=g<<18|g>>>32-18,g=H+Y|0,S^=g<<7|g>>>32-7,g=S+H|0,he^=g<<9|g>>>32-9,g=he+S|0,Y^=g<<13|g>>>32-13,g=Y+he|0,H^=g<<18|g>>>32-18,g=C+w|0,xe^=g<<7|g>>>32-7,g=xe+C|0,M^=g<<9|g>>>32-9,g=M+xe|0,w^=g<<13|g>>>32-13,g=w+M|0,C^=g<<18|g>>>32-18,g=ge+O|0,K^=g<<7|g>>>32-7,g=K+ge|0,_^=g<<9|g>>>32-9,g=_+K|0,O^=g<<13|g>>>32-13,g=O+_|0,ge^=g<<18|g>>>32-18,g=L+K|0,Y^=g<<7|g>>>32-7,g=Y+L|0,M^=g<<9|g>>>32-9,g=M+Y|0,K^=g<<13|g>>>32-13,g=K+M|0,L^=g<<18|g>>>32-18,g=H+j|0,w^=g<<7|g>>>32-7,g=w+H|0,_^=g<<9|g>>>32-9,g=_+w|0,j^=g<<13|g>>>32-13,g=j+_|0,H^=g<<18|g>>>32-18,g=C+S|0,O^=g<<7|g>>>32-7,g=O+C|0,R^=g<<9|g>>>32-9,g=R+O|0,S^=g<<13|g>>>32-13,g=S+R|0,C^=g<<18|g>>>32-18,g=ge+xe|0,ee^=g<<7|g>>>32-7,g=ee+ge|0,he^=g<<9|g>>>32-9,g=he+ee|0,xe^=g<<13|g>>>32-13,g=xe+he|0,ge^=g<<18|g>>>32-18;L=L+p|0,Y=Y+m|0,M=M+b|0,K=K+U|0,j=j+P|0,H=H+V|0,w=w+q|0,_=_+Se|0,R=R+G|0,S=S+re|0,C=C+oe|0,O=O+pe|0,ee=ee+de|0,he=he+se|0,xe=xe+ce|0,ge=ge+ie|0,c[0]=L>>>0&255,c[1]=L>>>8&255,c[2]=L>>>16&255,c[3]=L>>>24&255,c[4]=Y>>>0&255,c[5]=Y>>>8&255,c[6]=Y>>>16&255,c[7]=Y>>>24&255,c[8]=M>>>0&255,c[9]=M>>>8&255,c[10]=M>>>16&255,c[11]=M>>>24&255,c[12]=K>>>0&255,c[13]=K>>>8&255,c[14]=K>>>16&255,c[15]=K>>>24&255,c[16]=j>>>0&255,c[17]=j>>>8&255,c[18]=j>>>16&255,c[19]=j>>>24&255,c[20]=H>>>0&255,c[21]=H>>>8&255,c[22]=H>>>16&255,c[23]=H>>>24&255,c[24]=w>>>0&255,c[25]=w>>>8&255,c[26]=w>>>16&255,c[27]=w>>>24&255,c[28]=_>>>0&255,c[29]=_>>>8&255,c[30]=_>>>16&255,c[31]=_>>>24&255,c[32]=R>>>0&255,c[33]=R>>>8&255,c[34]=R>>>16&255,c[35]=R>>>24&255,c[36]=S>>>0&255,c[37]=S>>>8&255,c[38]=S>>>16&255,c[39]=S>>>24&255,c[40]=C>>>0&255,c[41]=C>>>8&255,c[42]=C>>>16&255,c[43]=C>>>24&255,c[44]=O>>>0&255,c[45]=O>>>8&255,c[46]=O>>>16&255,c[47]=O>>>24&255,c[48]=ee>>>0&255,c[49]=ee>>>8&255,c[50]=ee>>>16&255,c[51]=ee>>>24&255,c[52]=he>>>0&255,c[53]=he>>>8&255,c[54]=he>>>16&255,c[55]=he>>>24&255,c[56]=xe>>>0&255,c[57]=xe>>>8&255,c[58]=xe>>>16&255,c[59]=xe>>>24&255,c[60]=ge>>>0&255,c[61]=ge>>>8&255,c[62]=ge>>>16&255,c[63]=ge>>>24&255}function N(c,l,f,s){for(var p=s[0]&255|(s[1]&255)<<8|(s[2]&255)<<16|(s[3]&255)<<24,m=f[0]&255|(f[1]&255)<<8|(f[2]&255)<<16|(f[3]&255)<<24,b=f[4]&255|(f[5]&255)<<8|(f[6]&255)<<16|(f[7]&255)<<24,U=f[8]&255|(f[9]&255)<<8|(f[10]&255)<<16|(f[11]&255)<<24,P=f[12]&255|(f[13]&255)<<8|(f[14]&255)<<16|(f[15]&255)<<24,V=s[4]&255|(s[5]&255)<<8|(s[6]&255)<<16|(s[7]&255)<<24,q=l[0]&255|(l[1]&255)<<8|(l[2]&255)<<16|(l[3]&255)<<24,Se=l[4]&255|(l[5]&255)<<8|(l[6]&255)<<16|(l[7]&255)<<24,G=l[8]&255|(l[9]&255)<<8|(l[10]&255)<<16|(l[11]&255)<<24,re=l[12]&255|(l[13]&255)<<8|(l[14]&255)<<16|(l[15]&255)<<24,oe=s[8]&255|(s[9]&255)<<8|(s[10]&255)<<16|(s[11]&255)<<24,pe=f[16]&255|(f[17]&255)<<8|(f[18]&255)<<16|(f[19]&255)<<24,de=f[20]&255|(f[21]&255)<<8|(f[22]&255)<<16|(f[23]&255)<<24,se=f[24]&255|(f[25]&255)<<8|(f[26]&255)<<16|(f[27]&255)<<24,ce=f[28]&255|(f[29]&255)<<8|(f[30]&255)<<16|(f[31]&255)<<24,ie=s[12]&255|(s[13]&255)<<8|(s[14]&255)<<16|(s[15]&255)<<24,L=p,Y=m,M=b,K=U,j=P,H=V,w=q,_=Se,R=G,S=re,C=oe,O=pe,ee=de,he=se,xe=ce,ge=ie,g,we=0;we<20;we+=2)g=L+ee|0,j^=g<<7|g>>>32-7,g=j+L|0,R^=g<<9|g>>>32-9,g=R+j|0,ee^=g<<13|g>>>32-13,g=ee+R|0,L^=g<<18|g>>>32-18,g=H+Y|0,S^=g<<7|g>>>32-7,g=S+H|0,he^=g<<9|g>>>32-9,g=he+S|0,Y^=g<<13|g>>>32-13,g=Y+he|0,H^=g<<18|g>>>32-18,g=C+w|0,xe^=g<<7|g>>>32-7,g=xe+C|0,M^=g<<9|g>>>32-9,g=M+xe|0,w^=g<<13|g>>>32-13,g=w+M|0,C^=g<<18|g>>>32-18,g=ge+O|0,K^=g<<7|g>>>32-7,g=K+ge|0,_^=g<<9|g>>>32-9,g=_+K|0,O^=g<<13|g>>>32-13,g=O+_|0,ge^=g<<18|g>>>32-18,g=L+K|0,Y^=g<<7|g>>>32-7,g=Y+L|0,M^=g<<9|g>>>32-9,g=M+Y|0,K^=g<<13|g>>>32-13,g=K+M|0,L^=g<<18|g>>>32-18,g=H+j|0,w^=g<<7|g>>>32-7,g=w+H|0,_^=g<<9|g>>>32-9,g=_+w|0,j^=g<<13|g>>>32-13,g=j+_|0,H^=g<<18|g>>>32-18,g=C+S|0,O^=g<<7|g>>>32-7,g=O+C|0,R^=g<<9|g>>>32-9,g=R+O|0,S^=g<<13|g>>>32-13,g=S+R|0,C^=g<<18|g>>>32-18,g=ge+xe|0,ee^=g<<7|g>>>32-7,g=ee+ge|0,he^=g<<9|g>>>32-9,g=he+ee|0,xe^=g<<13|g>>>32-13,g=xe+he|0,ge^=g<<18|g>>>32-18;c[0]=L>>>0&255,c[1]=L>>>8&255,c[2]=L>>>16&255,c[3]=L>>>24&255,c[4]=H>>>0&255,c[5]=H>>>8&255,c[6]=H>>>16&255,c[7]=H>>>24&255,c[8]=C>>>0&255,c[9]=C>>>8&255,c[10]=C>>>16&255,c[11]=C>>>24&255,c[12]=ge>>>0&255,c[13]=ge>>>8&255,c[14]=ge>>>16&255,c[15]=ge>>>24&255,c[16]=w>>>0&255,c[17]=w>>>8&255,c[18]=w>>>16&255,c[19]=w>>>24&255,c[20]=_>>>0&255,c[21]=_>>>8&255,c[22]=_>>>16&255,c[23]=_>>>24&255,c[24]=R>>>0&255,c[25]=R>>>8&255,c[26]=R>>>16&255,c[27]=R>>>24&255,c[28]=S>>>0&255,c[29]=S>>>8&255,c[30]=S>>>16&255,c[31]=S>>>24&255}function B(c,l,f,s){k(c,l,f,s)}function Z(c,l,f,s){N(c,l,f,s)}var F=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function Q(c,l,f,s,p,m,b){var U=new Uint8Array(16),P=new Uint8Array(64),V,q;for(q=0;q<16;q++)U[q]=0;for(q=0;q<8;q++)U[q]=m[q];for(;p>=64;){for(B(P,U,b,F),q=0;q<64;q++)c[l+q]=f[s+q]^P[q];for(V=1,q=8;q<16;q++)V=V+(U[q]&255)|0,U[q]=V&255,V>>>=8;p-=64,l+=64,s+=64}if(p>0)for(B(P,U,b,F),q=0;q<p;q++)c[l+q]=f[s+q]^P[q];return 0}function J(c,l,f,s,p){var m=new Uint8Array(16),b=new Uint8Array(64),U,P;for(P=0;P<16;P++)m[P]=0;for(P=0;P<8;P++)m[P]=s[P];for(;f>=64;){for(B(b,m,p,F),P=0;P<64;P++)c[l+P]=b[P];for(U=1,P=8;P<16;P++)U=U+(m[P]&255)|0,m[P]=U&255,U>>>=8;f-=64,l+=64}if(f>0)for(B(b,m,p,F),P=0;P<f;P++)c[l+P]=b[P];return 0}function W(c,l,f,s,p){var m=new Uint8Array(32);Z(m,s,p,F);for(var b=new Uint8Array(8),U=0;U<8;U++)b[U]=s[U+16];return J(c,l,f,b,m)}function Te(c,l,f,s,p,m,b){var U=new Uint8Array(32);Z(U,m,b,F);for(var P=new Uint8Array(8),V=0;V<8;V++)P[V]=m[V+16];return Q(c,l,f,s,p,P,U)}var Ae=function(c){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 l,f,s,p,m,b,U,P;l=c[0]&255|(c[1]&255)<<8,this.r[0]=l&8191,f=c[2]&255|(c[3]&255)<<8,this.r[1]=(l>>>13|f<<3)&8191,s=c[4]&255|(c[5]&255)<<8,this.r[2]=(f>>>10|s<<6)&7939,p=c[6]&255|(c[7]&255)<<8,this.r[3]=(s>>>7|p<<9)&8191,m=c[8]&255|(c[9]&255)<<8,this.r[4]=(p>>>4|m<<12)&255,this.r[5]=m>>>1&8190,b=c[10]&255|(c[11]&255)<<8,this.r[6]=(m>>>14|b<<2)&8191,U=c[12]&255|(c[13]&255)<<8,this.r[7]=(b>>>11|U<<5)&8065,P=c[14]&255|(c[15]&255)<<8,this.r[8]=(U>>>8|P<<8)&8191,this.r[9]=P>>>5&127,this.pad[0]=c[16]&255|(c[17]&255)<<8,this.pad[1]=c[18]&255|(c[19]&255)<<8,this.pad[2]=c[20]&255|(c[21]&255)<<8,this.pad[3]=c[22]&255|(c[23]&255)<<8,this.pad[4]=c[24]&255|(c[25]&255)<<8,this.pad[5]=c[26]&255|(c[27]&255)<<8,this.pad[6]=c[28]&255|(c[29]&255)<<8,this.pad[7]=c[30]&255|(c[31]&255)<<8};Ae.prototype.blocks=function(c,l,f){for(var s=this.fin?0:2048,p,m,b,U,P,V,q,Se,G,re,oe,pe,de,se,ce,ie,L,Y,M,K=this.h[0],j=this.h[1],H=this.h[2],w=this.h[3],_=this.h[4],R=this.h[5],S=this.h[6],C=this.h[7],O=this.h[8],ee=this.h[9],he=this.r[0],xe=this.r[1],ge=this.r[2],g=this.r[3],we=this.r[4],Ue=this.r[5],Ce=this.r[6],me=this.r[7],ve=this.r[8],Ee=this.r[9];f>=16;)p=c[l+0]&255|(c[l+1]&255)<<8,K+=p&8191,m=c[l+2]&255|(c[l+3]&255)<<8,j+=(p>>>13|m<<3)&8191,b=c[l+4]&255|(c[l+5]&255)<<8,H+=(m>>>10|b<<6)&8191,U=c[l+6]&255|(c[l+7]&255)<<8,w+=(b>>>7|U<<9)&8191,P=c[l+8]&255|(c[l+9]&255)<<8,_+=(U>>>4|P<<12)&8191,R+=P>>>1&8191,V=c[l+10]&255|(c[l+11]&255)<<8,S+=(P>>>14|V<<2)&8191,q=c[l+12]&255|(c[l+13]&255)<<8,C+=(V>>>11|q<<5)&8191,Se=c[l+14]&255|(c[l+15]&255)<<8,O+=(q>>>8|Se<<8)&8191,ee+=Se>>>5|s,G=0,re=G,re+=K*he,re+=j*(5*Ee),re+=H*(5*ve),re+=w*(5*me),re+=_*(5*Ce),G=re>>>13,re&=8191,re+=R*(5*Ue),re+=S*(5*we),re+=C*(5*g),re+=O*(5*ge),re+=ee*(5*xe),G+=re>>>13,re&=8191,oe=G,oe+=K*xe,oe+=j*he,oe+=H*(5*Ee),oe+=w*(5*ve),oe+=_*(5*me),G=oe>>>13,oe&=8191,oe+=R*(5*Ce),oe+=S*(5*Ue),oe+=C*(5*we),oe+=O*(5*g),oe+=ee*(5*ge),G+=oe>>>13,oe&=8191,pe=G,pe+=K*ge,pe+=j*xe,pe+=H*he,pe+=w*(5*Ee),pe+=_*(5*ve),G=pe>>>13,pe&=8191,pe+=R*(5*me),pe+=S*(5*Ce),pe+=C*(5*Ue),pe+=O*(5*we),pe+=ee*(5*g),G+=pe>>>13,pe&=8191,de=G,de+=K*g,de+=j*ge,de+=H*xe,de+=w*he,de+=_*(5*Ee),G=de>>>13,de&=8191,de+=R*(5*ve),de+=S*(5*me),de+=C*(5*Ce),de+=O*(5*Ue),de+=ee*(5*we),G+=de>>>13,de&=8191,se=G,se+=K*we,se+=j*g,se+=H*ge,se+=w*xe,se+=_*he,G=se>>>13,se&=8191,se+=R*(5*Ee),se+=S*(5*ve),se+=C*(5*me),se+=O*(5*Ce),se+=ee*(5*Ue),G+=se>>>13,se&=8191,ce=G,ce+=K*Ue,ce+=j*we,ce+=H*g,ce+=w*ge,ce+=_*xe,G=ce>>>13,ce&=8191,ce+=R*he,ce+=S*(5*Ee),ce+=C*(5*ve),ce+=O*(5*me),ce+=ee*(5*Ce),G+=ce>>>13,ce&=8191,ie=G,ie+=K*Ce,ie+=j*Ue,ie+=H*we,ie+=w*g,ie+=_*ge,G=ie>>>13,ie&=8191,ie+=R*xe,ie+=S*he,ie+=C*(5*Ee),ie+=O*(5*ve),ie+=ee*(5*me),G+=ie>>>13,ie&=8191,L=G,L+=K*me,L+=j*Ce,L+=H*Ue,L+=w*we,L+=_*g,G=L>>>13,L&=8191,L+=R*ge,L+=S*xe,L+=C*he,L+=O*(5*Ee),L+=ee*(5*ve),G+=L>>>13,L&=8191,Y=G,Y+=K*ve,Y+=j*me,Y+=H*Ce,Y+=w*Ue,Y+=_*we,G=Y>>>13,Y&=8191,Y+=R*g,Y+=S*ge,Y+=C*xe,Y+=O*he,Y+=ee*(5*Ee),G+=Y>>>13,Y&=8191,M=G,M+=K*Ee,M+=j*ve,M+=H*me,M+=w*Ce,M+=_*Ue,G=M>>>13,M&=8191,M+=R*we,M+=S*g,M+=C*ge,M+=O*xe,M+=ee*he,G+=M>>>13,M&=8191,G=(G<<2)+G|0,G=G+re|0,re=G&8191,G=G>>>13,oe+=G,K=re,j=oe,H=pe,w=de,_=se,R=ce,S=ie,C=L,O=Y,ee=M,l+=16,f-=16;this.h[0]=K,this.h[1]=j,this.h[2]=H,this.h[3]=w,this.h[4]=_,this.h[5]=R,this.h[6]=S,this.h[7]=C,this.h[8]=O,this.h[9]=ee},Ae.prototype.finish=function(c,l){var f=new Uint16Array(10),s,p,m,b;if(this.leftover){for(b=this.leftover,this.buffer[b++]=1;b<16;b++)this.buffer[b]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(s=this.h[1]>>>13,this.h[1]&=8191,b=2;b<10;b++)this.h[b]+=s,s=this.h[b]>>>13,this.h[b]&=8191;for(this.h[0]+=s*5,s=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=s,s=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=s,f[0]=this.h[0]+5,s=f[0]>>>13,f[0]&=8191,b=1;b<10;b++)f[b]=this.h[b]+s,s=f[b]>>>13,f[b]&=8191;for(f[9]-=1<<13,p=(s^1)-1,b=0;b<10;b++)f[b]&=p;for(p=~p,b=0;b<10;b++)this.h[b]=this.h[b]&p|f[b];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,m=this.h[0]+this.pad[0],this.h[0]=m&65535,b=1;b<8;b++)m=(this.h[b]+this.pad[b]|0)+(m>>>16)|0,this.h[b]=m&65535;c[l+0]=this.h[0]>>>0&255,c[l+1]=this.h[0]>>>8&255,c[l+2]=this.h[1]>>>0&255,c[l+3]=this.h[1]>>>8&255,c[l+4]=this.h[2]>>>0&255,c[l+5]=this.h[2]>>>8&255,c[l+6]=this.h[3]>>>0&255,c[l+7]=this.h[3]>>>8&255,c[l+8]=this.h[4]>>>0&255,c[l+9]=this.h[4]>>>8&255,c[l+10]=this.h[5]>>>0&255,c[l+11]=this.h[5]>>>8&255,c[l+12]=this.h[6]>>>0&255,c[l+13]=this.h[6]>>>8&255,c[l+14]=this.h[7]>>>0&255,c[l+15]=this.h[7]>>>8&255},Ae.prototype.update=function(c,l,f){var s,p;if(this.leftover){for(p=16-this.leftover,p>f&&(p=f),s=0;s<p;s++)this.buffer[this.leftover+s]=c[l+s];if(f-=p,l+=p,this.leftover+=p,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(f>=16&&(p=f-f%16,this.blocks(c,l,p),l+=p,f-=p),f){for(s=0;s<f;s++)this.buffer[this.leftover+s]=c[l+s];this.leftover+=f}};function ye(c,l,f,s,p,m){var b=new Ae(m);return b.update(f,s,p),b.finish(c,l),0}function ze(c,l,f,s,p,m){var b=new Uint8Array(16);return ye(b,0,f,s,p,m),A(c,l,b,0)}function He(c,l,f,s,p){var m;if(f<32)return-1;for(Te(c,0,l,0,f,s,p),ye(c,16,c,32,f-32,c),m=0;m<16;m++)c[m]=0;return 0}function nt(c,l,f,s,p){var m,b=new Uint8Array(32);if(f<32||(W(b,0,32,s,p),ze(l,16,l,32,f-32,b)!==0))return-1;for(Te(c,0,l,0,f,s,p),m=0;m<32;m++)c[m]=0;return 0}function z(c,l){var f;for(f=0;f<16;f++)c[f]=l[f]|0}function $(c){var l,f,s=1;for(l=0;l<16;l++)f=c[l]+s+65535,s=Math.floor(f/65536),c[l]=f-s*65536;c[0]+=s-1+37*(s-1)}function fe(c,l,f){for(var s,p=~(f-1),m=0;m<16;m++)s=p&(c[m]^l[m]),c[m]^=s,l[m]^=s}function Be(c,l){var f,s,p,m=t(),b=t();for(f=0;f<16;f++)b[f]=l[f];for($(b),$(b),$(b),s=0;s<2;s++){for(m[0]=b[0]-65517,f=1;f<15;f++)m[f]=b[f]-65535-(m[f-1]>>16&1),m[f-1]&=65535;m[15]=b[15]-32767-(m[14]>>16&1),p=m[15]>>16&1,m[14]&=65535,fe(b,m,1-p)}for(f=0;f<16;f++)c[2*f]=b[f]&255,c[2*f+1]=b[f]>>8}function Ie(c,l){var f=new Uint8Array(32),s=new Uint8Array(32);return Be(f,c),Be(s,l),v(f,0,s,0)}function Fe(c){var l=new Uint8Array(32);return Be(l,c),l[0]&1}function tt(c,l){var f;for(f=0;f<16;f++)c[f]=l[2*f]+(l[2*f+1]<<8);c[15]&=32767}function De(c,l,f){for(var s=0;s<16;s++)c[s]=l[s]+f[s]}function je(c,l,f){for(var s=0;s<16;s++)c[s]=l[s]-f[s]}function le(c,l,f){var s,p,m=0,b=0,U=0,P=0,V=0,q=0,Se=0,G=0,re=0,oe=0,pe=0,de=0,se=0,ce=0,ie=0,L=0,Y=0,M=0,K=0,j=0,H=0,w=0,_=0,R=0,S=0,C=0,O=0,ee=0,he=0,xe=0,ge=0,g=f[0],we=f[1],Ue=f[2],Ce=f[3],me=f[4],ve=f[5],Ee=f[6],$e=f[7],Re=f[8],Ne=f[9],Me=f[10],Ge=f[11],We=f[12],ot=f[13],st=f[14],it=f[15];s=l[0],m+=s*g,b+=s*we,U+=s*Ue,P+=s*Ce,V+=s*me,q+=s*ve,Se+=s*Ee,G+=s*$e,re+=s*Re,oe+=s*Ne,pe+=s*Me,de+=s*Ge,se+=s*We,ce+=s*ot,ie+=s*st,L+=s*it,s=l[1],b+=s*g,U+=s*we,P+=s*Ue,V+=s*Ce,q+=s*me,Se+=s*ve,G+=s*Ee,re+=s*$e,oe+=s*Re,pe+=s*Ne,de+=s*Me,se+=s*Ge,ce+=s*We,ie+=s*ot,L+=s*st,Y+=s*it,s=l[2],U+=s*g,P+=s*we,V+=s*Ue,q+=s*Ce,Se+=s*me,G+=s*ve,re+=s*Ee,oe+=s*$e,pe+=s*Re,de+=s*Ne,se+=s*Me,ce+=s*Ge,ie+=s*We,L+=s*ot,Y+=s*st,M+=s*it,s=l[3],P+=s*g,V+=s*we,q+=s*Ue,Se+=s*Ce,G+=s*me,re+=s*ve,oe+=s*Ee,pe+=s*$e,de+=s*Re,se+=s*Ne,ce+=s*Me,ie+=s*Ge,L+=s*We,Y+=s*ot,M+=s*st,K+=s*it,s=l[4],V+=s*g,q+=s*we,Se+=s*Ue,G+=s*Ce,re+=s*me,oe+=s*ve,pe+=s*Ee,de+=s*$e,se+=s*Re,ce+=s*Ne,ie+=s*Me,L+=s*Ge,Y+=s*We,M+=s*ot,K+=s*st,j+=s*it,s=l[5],q+=s*g,Se+=s*we,G+=s*Ue,re+=s*Ce,oe+=s*me,pe+=s*ve,de+=s*Ee,se+=s*$e,ce+=s*Re,ie+=s*Ne,L+=s*Me,Y+=s*Ge,M+=s*We,K+=s*ot,j+=s*st,H+=s*it,s=l[6],Se+=s*g,G+=s*we,re+=s*Ue,oe+=s*Ce,pe+=s*me,de+=s*ve,se+=s*Ee,ce+=s*$e,ie+=s*Re,L+=s*Ne,Y+=s*Me,M+=s*Ge,K+=s*We,j+=s*ot,H+=s*st,w+=s*it,s=l[7],G+=s*g,re+=s*we,oe+=s*Ue,pe+=s*Ce,de+=s*me,se+=s*ve,ce+=s*Ee,ie+=s*$e,L+=s*Re,Y+=s*Ne,M+=s*Me,K+=s*Ge,j+=s*We,H+=s*ot,w+=s*st,_+=s*it,s=l[8],re+=s*g,oe+=s*we,pe+=s*Ue,de+=s*Ce,se+=s*me,ce+=s*ve,ie+=s*Ee,L+=s*$e,Y+=s*Re,M+=s*Ne,K+=s*Me,j+=s*Ge,H+=s*We,w+=s*ot,_+=s*st,R+=s*it,s=l[9],oe+=s*g,pe+=s*we,de+=s*Ue,se+=s*Ce,ce+=s*me,ie+=s*ve,L+=s*Ee,Y+=s*$e,M+=s*Re,K+=s*Ne,j+=s*Me,H+=s*Ge,w+=s*We,_+=s*ot,R+=s*st,S+=s*it,s=l[10],pe+=s*g,de+=s*we,se+=s*Ue,ce+=s*Ce,ie+=s*me,L+=s*ve,Y+=s*Ee,M+=s*$e,K+=s*Re,j+=s*Ne,H+=s*Me,w+=s*Ge,_+=s*We,R+=s*ot,S+=s*st,C+=s*it,s=l[11],de+=s*g,se+=s*we,ce+=s*Ue,ie+=s*Ce,L+=s*me,Y+=s*ve,M+=s*Ee,K+=s*$e,j+=s*Re,H+=s*Ne,w+=s*Me,_+=s*Ge,R+=s*We,S+=s*ot,C+=s*st,O+=s*it,s=l[12],se+=s*g,ce+=s*we,ie+=s*Ue,L+=s*Ce,Y+=s*me,M+=s*ve,K+=s*Ee,j+=s*$e,H+=s*Re,w+=s*Ne,_+=s*Me,R+=s*Ge,S+=s*We,C+=s*ot,O+=s*st,ee+=s*it,s=l[13],ce+=s*g,ie+=s*we,L+=s*Ue,Y+=s*Ce,M+=s*me,K+=s*ve,j+=s*Ee,H+=s*$e,w+=s*Re,_+=s*Ne,R+=s*Me,S+=s*Ge,C+=s*We,O+=s*ot,ee+=s*st,he+=s*it,s=l[14],ie+=s*g,L+=s*we,Y+=s*Ue,M+=s*Ce,K+=s*me,j+=s*ve,H+=s*Ee,w+=s*$e,_+=s*Re,R+=s*Ne,S+=s*Me,C+=s*Ge,O+=s*We,ee+=s*ot,he+=s*st,xe+=s*it,s=l[15],L+=s*g,Y+=s*we,M+=s*Ue,K+=s*Ce,j+=s*me,H+=s*ve,w+=s*Ee,_+=s*$e,R+=s*Re,S+=s*Ne,C+=s*Me,O+=s*Ge,ee+=s*We,he+=s*ot,xe+=s*st,ge+=s*it,m+=38*Y,b+=38*M,U+=38*K,P+=38*j,V+=38*H,q+=38*w,Se+=38*_,G+=38*R,re+=38*S,oe+=38*C,pe+=38*O,de+=38*ee,se+=38*he,ce+=38*xe,ie+=38*ge,p=1,s=m+p+65535,p=Math.floor(s/65536),m=s-p*65536,s=b+p+65535,p=Math.floor(s/65536),b=s-p*65536,s=U+p+65535,p=Math.floor(s/65536),U=s-p*65536,s=P+p+65535,p=Math.floor(s/65536),P=s-p*65536,s=V+p+65535,p=Math.floor(s/65536),V=s-p*65536,s=q+p+65535,p=Math.floor(s/65536),q=s-p*65536,s=Se+p+65535,p=Math.floor(s/65536),Se=s-p*65536,s=G+p+65535,p=Math.floor(s/65536),G=s-p*65536,s=re+p+65535,p=Math.floor(s/65536),re=s-p*65536,s=oe+p+65535,p=Math.floor(s/65536),oe=s-p*65536,s=pe+p+65535,p=Math.floor(s/65536),pe=s-p*65536,s=de+p+65535,p=Math.floor(s/65536),de=s-p*65536,s=se+p+65535,p=Math.floor(s/65536),se=s-p*65536,s=ce+p+65535,p=Math.floor(s/65536),ce=s-p*65536,s=ie+p+65535,p=Math.floor(s/65536),ie=s-p*65536,s=L+p+65535,p=Math.floor(s/65536),L=s-p*65536,m+=p-1+37*(p-1),p=1,s=m+p+65535,p=Math.floor(s/65536),m=s-p*65536,s=b+p+65535,p=Math.floor(s/65536),b=s-p*65536,s=U+p+65535,p=Math.floor(s/65536),U=s-p*65536,s=P+p+65535,p=Math.floor(s/65536),P=s-p*65536,s=V+p+65535,p=Math.floor(s/65536),V=s-p*65536,s=q+p+65535,p=Math.floor(s/65536),q=s-p*65536,s=Se+p+65535,p=Math.floor(s/65536),Se=s-p*65536,s=G+p+65535,p=Math.floor(s/65536),G=s-p*65536,s=re+p+65535,p=Math.floor(s/65536),re=s-p*65536,s=oe+p+65535,p=Math.floor(s/65536),oe=s-p*65536,s=pe+p+65535,p=Math.floor(s/65536),pe=s-p*65536,s=de+p+65535,p=Math.floor(s/65536),de=s-p*65536,s=se+p+65535,p=Math.floor(s/65536),se=s-p*65536,s=ce+p+65535,p=Math.floor(s/65536),ce=s-p*65536,s=ie+p+65535,p=Math.floor(s/65536),ie=s-p*65536,s=L+p+65535,p=Math.floor(s/65536),L=s-p*65536,m+=p-1+37*(p-1),c[0]=m,c[1]=b,c[2]=U,c[3]=P,c[4]=V,c[5]=q,c[6]=Se,c[7]=G,c[8]=re,c[9]=oe,c[10]=pe,c[11]=de,c[12]=se,c[13]=ce,c[14]=ie,c[15]=L}function Qe(c,l){le(c,l,l)}function wr(c,l){var f=t(),s;for(s=0;s<16;s++)f[s]=l[s];for(s=253;s>=0;s--)Qe(f,f),s!==2&&s!==4&&le(f,f,l);for(s=0;s<16;s++)c[s]=f[s]}function zt(c,l){var f=t(),s;for(s=0;s<16;s++)f[s]=l[s];for(s=250;s>=0;s--)Qe(f,f),s!==1&&le(f,f,l);for(s=0;s<16;s++)c[s]=f[s]}function _r(c,l,f){var s=new Uint8Array(32),p=new Float64Array(80),m,b,U=t(),P=t(),V=t(),q=t(),Se=t(),G=t();for(b=0;b<31;b++)s[b]=l[b];for(s[31]=l[31]&127|64,s[0]&=248,tt(p,f),b=0;b<16;b++)P[b]=p[b],q[b]=U[b]=V[b]=0;for(U[0]=q[0]=1,b=254;b>=0;--b)m=s[b>>>3]>>>(b&7)&1,fe(U,P,m),fe(V,q,m),De(Se,U,V),je(U,U,V),De(V,P,q),je(P,P,q),Qe(q,Se),Qe(G,U),le(U,V,U),le(V,P,Se),De(Se,U,V),je(U,U,V),Qe(P,U),je(V,q,G),le(U,V,u),De(U,U,q),le(V,V,U),le(U,q,G),le(q,P,p),Qe(P,Se),fe(U,P,m),fe(V,q,m);for(b=0;b<16;b++)p[b+16]=U[b],p[b+32]=V[b],p[b+48]=P[b],p[b+64]=q[b];var re=p.subarray(32),oe=p.subarray(16);return wr(re,re),le(oe,oe,re),Be(c,oe),0}function Bt(c,l){return _r(c,l,o)}function ar(c,l){return e(l,32),Bt(c,l)}function Xr(c,l,f){var s=new Uint8Array(32);return _r(s,f,l),Z(c,n,s,F)}var cr=He,mt=nt;function Tr(c,l,f,s,p,m){var b=new Uint8Array(32);return Xr(b,p,m),cr(c,l,f,s,b)}function Lo(c,l,f,s,p,m){var b=new Uint8Array(32);return Xr(b,p,m),mt(c,l,f,s,b)}var no=[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 qa(c,l,f,s){for(var p=new Int32Array(16),m=new Int32Array(16),b,U,P,V,q,Se,G,re,oe,pe,de,se,ce,ie,L,Y,M,K,j,H,w,_,R,S,C,O,ee=c[0],he=c[1],xe=c[2],ge=c[3],g=c[4],we=c[5],Ue=c[6],Ce=c[7],me=l[0],ve=l[1],Ee=l[2],$e=l[3],Re=l[4],Ne=l[5],Me=l[6],Ge=l[7],We=0;s>=128;){for(j=0;j<16;j++)H=8*j+We,p[j]=f[H+0]<<24|f[H+1]<<16|f[H+2]<<8|f[H+3],m[j]=f[H+4]<<24|f[H+5]<<16|f[H+6]<<8|f[H+7];for(j=0;j<80;j++)if(b=ee,U=he,P=xe,V=ge,q=g,Se=we,G=Ue,re=Ce,oe=me,pe=ve,de=Ee,se=$e,ce=Re,ie=Ne,L=Me,Y=Ge,w=Ce,_=Ge,R=_&65535,S=_>>>16,C=w&65535,O=w>>>16,w=(g>>>14|Re<<32-14)^(g>>>18|Re<<32-18)^(Re>>>41-32|g<<32-(41-32)),_=(Re>>>14|g<<32-14)^(Re>>>18|g<<32-18)^(g>>>41-32|Re<<32-(41-32)),R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,w=g&we^~g&Ue,_=Re&Ne^~Re&Me,R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,w=no[j*2],_=no[j*2+1],R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,w=p[j%16],_=m[j%16],R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,S+=R>>>16,C+=S>>>16,O+=C>>>16,M=C&65535|O<<16,K=R&65535|S<<16,w=M,_=K,R=_&65535,S=_>>>16,C=w&65535,O=w>>>16,w=(ee>>>28|me<<32-28)^(me>>>34-32|ee<<32-(34-32))^(me>>>39-32|ee<<32-(39-32)),_=(me>>>28|ee<<32-28)^(ee>>>34-32|me<<32-(34-32))^(ee>>>39-32|me<<32-(39-32)),R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,w=ee&he^ee&xe^he&xe,_=me&ve^me&Ee^ve&Ee,R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,S+=R>>>16,C+=S>>>16,O+=C>>>16,re=C&65535|O<<16,Y=R&65535|S<<16,w=V,_=se,R=_&65535,S=_>>>16,C=w&65535,O=w>>>16,w=M,_=K,R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,S+=R>>>16,C+=S>>>16,O+=C>>>16,V=C&65535|O<<16,se=R&65535|S<<16,he=b,xe=U,ge=P,g=V,we=q,Ue=Se,Ce=G,ee=re,ve=oe,Ee=pe,$e=de,Re=se,Ne=ce,Me=ie,Ge=L,me=Y,j%16===15)for(H=0;H<16;H++)w=p[H],_=m[H],R=_&65535,S=_>>>16,C=w&65535,O=w>>>16,w=p[(H+9)%16],_=m[(H+9)%16],R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,M=p[(H+1)%16],K=m[(H+1)%16],w=(M>>>1|K<<32-1)^(M>>>8|K<<32-8)^M>>>7,_=(K>>>1|M<<32-1)^(K>>>8|M<<32-8)^(K>>>7|M<<32-7),R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,M=p[(H+14)%16],K=m[(H+14)%16],w=(M>>>19|K<<32-19)^(K>>>61-32|M<<32-(61-32))^M>>>6,_=(K>>>19|M<<32-19)^(M>>>61-32|K<<32-(61-32))^(K>>>6|M<<32-6),R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,S+=R>>>16,C+=S>>>16,O+=C>>>16,p[H]=C&65535|O<<16,m[H]=R&65535|S<<16;w=ee,_=me,R=_&65535,S=_>>>16,C=w&65535,O=w>>>16,w=c[0],_=l[0],R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,S+=R>>>16,C+=S>>>16,O+=C>>>16,c[0]=ee=C&65535|O<<16,l[0]=me=R&65535|S<<16,w=he,_=ve,R=_&65535,S=_>>>16,C=w&65535,O=w>>>16,w=c[1],_=l[1],R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,S+=R>>>16,C+=S>>>16,O+=C>>>16,c[1]=he=C&65535|O<<16,l[1]=ve=R&65535|S<<16,w=xe,_=Ee,R=_&65535,S=_>>>16,C=w&65535,O=w>>>16,w=c[2],_=l[2],R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,S+=R>>>16,C+=S>>>16,O+=C>>>16,c[2]=xe=C&65535|O<<16,l[2]=Ee=R&65535|S<<16,w=ge,_=$e,R=_&65535,S=_>>>16,C=w&65535,O=w>>>16,w=c[3],_=l[3],R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,S+=R>>>16,C+=S>>>16,O+=C>>>16,c[3]=ge=C&65535|O<<16,l[3]=$e=R&65535|S<<16,w=g,_=Re,R=_&65535,S=_>>>16,C=w&65535,O=w>>>16,w=c[4],_=l[4],R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,S+=R>>>16,C+=S>>>16,O+=C>>>16,c[4]=g=C&65535|O<<16,l[4]=Re=R&65535|S<<16,w=we,_=Ne,R=_&65535,S=_>>>16,C=w&65535,O=w>>>16,w=c[5],_=l[5],R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,S+=R>>>16,C+=S>>>16,O+=C>>>16,c[5]=we=C&65535|O<<16,l[5]=Ne=R&65535|S<<16,w=Ue,_=Me,R=_&65535,S=_>>>16,C=w&65535,O=w>>>16,w=c[6],_=l[6],R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,S+=R>>>16,C+=S>>>16,O+=C>>>16,c[6]=Ue=C&65535|O<<16,l[6]=Me=R&65535|S<<16,w=Ce,_=Ge,R=_&65535,S=_>>>16,C=w&65535,O=w>>>16,w=c[7],_=l[7],R+=_&65535,S+=_>>>16,C+=w&65535,O+=w>>>16,S+=R>>>16,C+=S>>>16,O+=C>>>16,c[7]=Ce=C&65535|O<<16,l[7]=Ge=R&65535|S<<16,We+=128,s-=128}return s}function Zr(c,l,f){var s=new Int32Array(8),p=new Int32Array(8),m=new Uint8Array(256),b,U=f;for(s[0]=1779033703,s[1]=3144134277,s[2]=1013904242,s[3]=2773480762,s[4]=1359893119,s[5]=2600822924,s[6]=528734635,s[7]=1541459225,p[0]=4089235720,p[1]=2227873595,p[2]=4271175723,p[3]=1595750129,p[4]=2917565137,p[5]=725511199,p[6]=4215389547,p[7]=327033209,qa(s,p,l,f),f%=128,b=0;b<f;b++)m[b]=l[U-f+b];for(m[f]=128,f=256-128*(f<112?1:0),m[f-9]=0,E(m,f-8,U/536870912|0,U<<3),qa(s,p,m,f),b=0;b<8;b++)E(c,8*b,s[b],p[b]);return 0}function Fo(c,l){var f=t(),s=t(),p=t(),m=t(),b=t(),U=t(),P=t(),V=t(),q=t();je(f,c[1],c[0]),je(q,l[1],l[0]),le(f,f,q),De(s,c[0],c[1]),De(q,l[0],l[1]),le(s,s,q),le(p,c[3],l[3]),le(p,p,h),le(m,c[2],l[2]),De(m,m,m),je(b,s,f),je(U,m,p),De(P,m,p),De(V,s,f),le(c[0],b,U),le(c[1],V,P),le(c[2],P,U),le(c[3],b,V)}function Na(c,l,f){var s;for(s=0;s<4;s++)fe(c[s],l[s],f)}function Ys(c,l){var f=t(),s=t(),p=t();wr(p,l[2]),le(f,l[0],p),le(s,l[1],p),Be(c,s),c[31]^=Fe(f)<<7}function Xs(c,l,f){var s,p;for(z(c[0],i),z(c[1],a),z(c[2],a),z(c[3],i),p=255;p>=0;--p)s=f[p/8|0]>>(p&7)&1,Na(c,l,s),Fo(l,c),Fo(c,c),Na(c,l,s)}function $o(c,l){var f=[t(),t(),t(),t()];z(f[0],x),z(f[1],y),z(f[2],a),le(f[3],x,y),Xs(c,f,l)}function Zs(c,l,f){var s=new Uint8Array(64),p=[t(),t(),t(),t()],m;for(f||e(l,32),Zr(s,l,32),s[0]&=248,s[31]&=127,s[31]|=64,$o(p,s),Ys(c,p),m=0;m<32;m++)l[m+32]=c[m];return 0}var Ko=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 Js(c,l){var f,s,p,m;for(s=63;s>=32;--s){for(f=0,p=s-32,m=s-12;p<m;++p)l[p]+=f-16*l[s]*Ko[p-(s-32)],f=Math.floor((l[p]+128)/256),l[p]-=f*256;l[p]+=f,l[s]=0}for(f=0,p=0;p<32;p++)l[p]+=f-(l[31]>>4)*Ko[p],f=l[p]>>8,l[p]&=255;for(p=0;p<32;p++)l[p]-=f*Ko[p];for(s=0;s<32;s++)l[s+1]+=l[s]>>8,c[s]=l[s]&255}function ei(c){var l=new Float64Array(64),f;for(f=0;f<64;f++)l[f]=c[f];for(f=0;f<64;f++)c[f]=0;Js(c,l)}function Ma(c,l,f,s){var p=new Uint8Array(64),m=new Uint8Array(64),b=new Uint8Array(64),U,P,V=new Float64Array(64),q=[t(),t(),t(),t()];Zr(p,s,32),p[0]&=248,p[31]&=127,p[31]|=64;var Se=f+64;for(U=0;U<f;U++)c[64+U]=l[U];for(U=0;U<32;U++)c[32+U]=p[32+U];for(Zr(b,c.subarray(32),f+32),ei(b),$o(q,b),Ys(c,q),U=32;U<64;U++)c[U]=s[U];for(Zr(m,c,f+64),ei(m),U=0;U<64;U++)V[U]=0;for(U=0;U<32;U++)V[U]=b[U];for(U=0;U<32;U++)for(P=0;P<32;P++)V[U+P]+=m[U]*p[P];return Js(c.subarray(32),V),Se}function pd(c,l){var f=t(),s=t(),p=t(),m=t(),b=t(),U=t(),P=t();return z(c[2],a),tt(c[1],l),Qe(p,c[1]),le(m,p,d),je(p,p,c[2]),De(m,c[2],m),Qe(b,m),Qe(U,b),le(P,U,b),le(f,P,p),le(f,f,m),zt(f,f),le(f,f,p),le(f,f,m),le(f,f,m),le(c[0],f,m),Qe(s,c[0]),le(s,s,m),Ie(s,p)&&le(c[0],c[0],T),Qe(s,c[0]),le(s,s,m),Ie(s,p)?-1:(Fe(c[0])===l[31]>>7&&je(c[0],i,c[0]),le(c[3],c[0],c[1]),0)}function ti(c,l,f,s){var p,m=new Uint8Array(32),b=new Uint8Array(64),U=[t(),t(),t(),t()],P=[t(),t(),t(),t()];if(f<64||pd(P,s))return-1;for(p=0;p<f;p++)c[p]=l[p];for(p=0;p<32;p++)c[p+32]=s[p];if(Zr(b,c,f),ei(b),Xs(U,P,b),$o(P,l.subarray(32)),Fo(U,P),Ys(m,U),f-=64,v(l,0,m,0)){for(p=0;p<f;p++)c[p]=0;return-1}for(p=0;p<f;p++)c[p]=l[p+64];return f}var ri=32,jo=24,oo=32,Rn=16,so=32,Vo=32,io=32,ao=32,ni=32,Ga=jo,hd=oo,gd=Rn,ur=64,Jr=32,kn=64,oi=32,si=64;r.lowlevel={crypto_core_hsalsa20:Z,crypto_stream_xor:Te,crypto_stream:W,crypto_stream_salsa20_xor:Q,crypto_stream_salsa20:J,crypto_onetimeauth:ye,crypto_onetimeauth_verify:ze,crypto_verify_16:A,crypto_verify_32:v,crypto_secretbox:He,crypto_secretbox_open:nt,crypto_scalarmult:_r,crypto_scalarmult_base:Bt,crypto_box_beforenm:Xr,crypto_box_afternm:cr,crypto_box:Tr,crypto_box_open:Lo,crypto_box_keypair:ar,crypto_hash:Zr,crypto_sign:Ma,crypto_sign_keypair:Zs,crypto_sign_open:ti,crypto_secretbox_KEYBYTES:ri,crypto_secretbox_NONCEBYTES:jo,crypto_secretbox_ZEROBYTES:oo,crypto_secretbox_BOXZEROBYTES:Rn,crypto_scalarmult_BYTES:so,crypto_scalarmult_SCALARBYTES:Vo,crypto_box_PUBLICKEYBYTES:io,crypto_box_SECRETKEYBYTES:ao,crypto_box_BEFORENMBYTES:ni,crypto_box_NONCEBYTES:Ga,crypto_box_ZEROBYTES:hd,crypto_box_BOXZEROBYTES:gd,crypto_sign_BYTES:ur,crypto_sign_PUBLICKEYBYTES:Jr,crypto_sign_SECRETKEYBYTES:kn,crypto_sign_SEEDBYTES:oi,crypto_hash_BYTES:si,gf:t,D:d,L:Ko,pack25519:Be,unpack25519:tt,M:le,A:De,S:Qe,Z:je,pow2523:zt,add:Fo,set25519:z,modL:Js,scalarmult:Xs,scalarbase:$o};function La(c,l){if(c.length!==ri)throw new Error("bad key size");if(l.length!==jo)throw new Error("bad nonce size")}function yd(c,l){if(c.length!==io)throw new Error("bad public key size");if(l.length!==ao)throw new Error("bad secret key size")}function bt(){for(var c=0;c<arguments.length;c++)if(!(arguments[c]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Fa(c){for(var l=0;l<c.length;l++)c[l]=0}r.randomBytes=function(c){var l=new Uint8Array(c);return e(l,c),l},r.secretbox=function(c,l,f){bt(c,l,f),La(f,l);for(var s=new Uint8Array(oo+c.length),p=new Uint8Array(s.length),m=0;m<c.length;m++)s[m+oo]=c[m];return He(p,s,s.length,l,f),p.subarray(Rn)},r.secretbox.open=function(c,l,f){bt(c,l,f),La(f,l);for(var s=new Uint8Array(Rn+c.length),p=new Uint8Array(s.length),m=0;m<c.length;m++)s[m+Rn]=c[m];return s.length<32||nt(p,s,s.length,l,f)!==0?null:p.subarray(oo)},r.secretbox.keyLength=ri,r.secretbox.nonceLength=jo,r.secretbox.overheadLength=Rn,r.scalarMult=function(c,l){if(bt(c,l),c.length!==Vo)throw new Error("bad n size");if(l.length!==so)throw new Error("bad p size");var f=new Uint8Array(so);return _r(f,c,l),f},r.scalarMult.base=function(c){if(bt(c),c.length!==Vo)throw new Error("bad n size");var l=new Uint8Array(so);return Bt(l,c),l},r.scalarMult.scalarLength=Vo,r.scalarMult.groupElementLength=so,r.box=function(c,l,f,s){var p=r.box.before(f,s);return r.secretbox(c,l,p)},r.box.before=function(c,l){bt(c,l),yd(c,l);var f=new Uint8Array(ni);return Xr(f,c,l),f},r.box.after=r.secretbox,r.box.open=function(c,l,f,s){var p=r.box.before(f,s);return r.secretbox.open(c,l,p)},r.box.open.after=r.secretbox.open,r.box.keyPair=function(){var c=new Uint8Array(io),l=new Uint8Array(ao);return ar(c,l),{publicKey:c,secretKey:l}},r.box.keyPair.fromSecretKey=function(c){if(bt(c),c.length!==ao)throw new Error("bad secret key size");var l=new Uint8Array(io);return Bt(l,c),{publicKey:l,secretKey:new Uint8Array(c)}},r.box.publicKeyLength=io,r.box.secretKeyLength=ao,r.box.sharedKeyLength=ni,r.box.nonceLength=Ga,r.box.overheadLength=r.secretbox.overheadLength,r.sign=function(c,l){if(bt(c,l),l.length!==kn)throw new Error("bad secret key size");var f=new Uint8Array(ur+c.length);return Ma(f,c,c.length,l),f},r.sign.open=function(c,l){if(bt(c,l),l.length!==Jr)throw new Error("bad public key size");var f=new Uint8Array(c.length),s=ti(f,c,c.length,l);if(s<0)return null;for(var p=new Uint8Array(s),m=0;m<p.length;m++)p[m]=f[m];return p},r.sign.detached=function(c,l){for(var f=r.sign(c,l),s=new Uint8Array(ur),p=0;p<s.length;p++)s[p]=f[p];return s},r.sign.detached.verify=function(c,l,f){if(bt(c,l,f),l.length!==ur)throw new Error("bad signature size");if(f.length!==Jr)throw new Error("bad public key size");var s=new Uint8Array(ur+c.length),p=new Uint8Array(ur+c.length),m;for(m=0;m<ur;m++)s[m]=l[m];for(m=0;m<c.length;m++)s[m+ur]=c[m];return ti(p,s,s.length,f)>=0},r.sign.keyPair=function(){var c=new Uint8Array(Jr),l=new Uint8Array(kn);return Zs(c,l),{publicKey:c,secretKey:l}},r.sign.keyPair.fromSecretKey=function(c){if(bt(c),c.length!==kn)throw new Error("bad secret key size");for(var l=new Uint8Array(Jr),f=0;f<l.length;f++)l[f]=c[32+f];return{publicKey:l,secretKey:new Uint8Array(c)}},r.sign.keyPair.fromSeed=function(c){if(bt(c),c.length!==oi)throw new Error("bad seed size");for(var l=new Uint8Array(Jr),f=new Uint8Array(kn),s=0;s<32;s++)f[s]=c[s];return Zs(l,f,!0),{publicKey:l,secretKey:f}},r.sign.publicKeyLength=Jr,r.sign.secretKeyLength=kn,r.sign.seedLength=oi,r.sign.signatureLength=ur,r.hash=function(c){bt(c);var l=new Uint8Array(si);return Zr(l,c,c.length),l},r.hash.hashLength=si,r.verify=function(c,l){return bt(c,l),c.length===0||l.length===0||c.length!==l.length?!1:I(c,0,l,0,c.length)===0},r.setPRNG=function(c){e=c},function(){var c=typeof self!="undefined"?self.crypto||self.msCrypto:null;if(c&&c.getRandomValues){var l=65536;r.setPRNG(function(f,s){var p,m=new Uint8Array(s);for(p=0;p<s;p+=l)c.getRandomValues(m.subarray(p,p+Math.min(s-p,l)));for(p=0;p<s;p++)f[p]=m[p];Fa(m)})}else typeof Ka!="undefined"&&(c=Ac(),c&&c.randomBytes&&r.setPRNG(function(f,s){var p,m=c.randomBytes(s);for(p=0;p<s;p++)f[p]=m[p];Fa(m)}))}()})(typeof as!="undefined"&&as.exports?as.exports:self.nacl=self.nacl||{})});var bo=ue(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.output=dt.exists=dt.hash=dt.bytes=dt.bool=dt.number=void 0;function bs(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`Wrong positive integer: ${r}`)}dt.number=bs;function jc(r){if(typeof r!="boolean")throw new Error(`Expected boolean, not ${r}`)}dt.bool=jc;function Gi(r,...t){if(!(r instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(t.length>0&&!t.includes(r.length))throw new TypeError(`Expected Uint8Array of length ${t}, not of length=${r.length}`)}dt.bytes=Gi;function Vc(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");bs(r.outputLen),bs(r.blockLen)}dt.hash=Vc;function Qc(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}dt.exists=Qc;function Wc(r,t){Gi(r);let e=t.outputLen;if(r.length<e)throw new Error(`digestInto() expects output buffer of length at least ${e}`)}dt.output=Wc;var Kp={number:bs,bool:jc,bytes:Gi,hash:Vc,exists:Qc,output:Wc};dt.default=Kp});var Yc=ue(As=>{"use strict";Object.defineProperty(As,"__esModule",{value:!0});As.crypto=void 0;As.crypto={node:void 0,web:typeof self=="object"&&"crypto"in self?self.crypto:void 0}});var pn=ue(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.randomBytes=_e.wrapConstructorWithOpts=_e.wrapConstructor=_e.checkOpts=_e.Hash=_e.concatBytes=_e.toBytes=_e.utf8ToBytes=_e.asyncLoop=_e.nextTick=_e.hexToBytes=_e.bytesToHex=_e.isLE=_e.rotr=_e.createView=_e.u32=_e.u8=void 0;var ws=Yc(),jp=r=>new Uint8Array(r.buffer,r.byteOffset,r.byteLength);_e.u8=jp;var Vp=r=>new Uint32Array(r.buffer,r.byteOffset,Math.floor(r.byteLength/4));_e.u32=Vp;var Qp=r=>new DataView(r.buffer,r.byteOffset,r.byteLength);_e.createView=Qp;var Wp=(r,t)=>r<<32-t|r>>>t;_e.rotr=Wp;_e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!_e.isLE)throw new Error("Non little-endian hardware is not supported");var Yp=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function Xp(r){if(!(r instanceof Uint8Array))throw new Error("Uint8Array expected");let t="";for(let e=0;e<r.length;e++)t+=Yp[r[e]];return t}_e.bytesToHex=Xp;function Zp(r){if(typeof r!="string")throw new TypeError("hexToBytes: expected string, got "+typeof r);if(r.length%2)throw new Error("hexToBytes: received invalid unpadded hex");let t=new Uint8Array(r.length/2);for(let e=0;e<t.length;e++){let n=e*2,o=r.slice(n,n+2),i=Number.parseInt(o,16);if(Number.isNaN(i)||i<0)throw new Error("Invalid byte sequence");t[e]=i}return t}_e.hexToBytes=Zp;var Jp=async()=>{};_e.nextTick=Jp;async function eh(r,t,e){let n=Date.now();for(let o=0;o<r;o++){e(o);let i=Date.now()-n;i>=0&&i<t||(await(0,_e.nextTick)(),n+=i)}}_e.asyncLoop=eh;function Xc(r){if(typeof r!="string")throw new TypeError(`utf8ToBytes expected string, got ${typeof r}`);return new TextEncoder().encode(r)}_e.utf8ToBytes=Xc;function Fi(r){if(typeof r=="string"&&(r=Xc(r)),!(r instanceof Uint8Array))throw new TypeError(`Expected input type is Uint8Array (got ${typeof r})`);return r}_e.toBytes=Fi;function th(...r){if(!r.every(n=>n instanceof Uint8Array))throw new Error("Uint8Array list expected");if(r.length===1)return r[0];let t=r.reduce((n,o)=>n+o.length,0),e=new Uint8Array(t);for(let n=0,o=0;n<r.length;n++){let i=r[n];e.set(i,o),o+=i.length}return e}_e.concatBytes=th;var Li=class{clone(){return this._cloneInto()}};_e.Hash=Li;var rh=r=>Object.prototype.toString.call(r)==="[object Object]"&&r.constructor===Object;function nh(r,t){if(t!==void 0&&(typeof t!="object"||!rh(t)))throw new TypeError("Options should be object or undefined");return Object.assign(r,t)}_e.checkOpts=nh;function oh(r){let t=n=>r().update(Fi(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}_e.wrapConstructor=oh;function sh(r){let t=(n,o)=>r(o).update(Fi(n)).digest(),e=r({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=n=>r(n),t}_e.wrapConstructorWithOpts=sh;function ih(r=32){if(ws.crypto.web)return ws.crypto.web.getRandomValues(new Uint8Array(r));if(ws.crypto.node)return new Uint8Array(ws.crypto.node.randomBytes(r).buffer);throw new Error("The environment doesn't have randomBytes function")}_e.randomBytes=ih});var Jc=ue(Ao=>{"use strict";Object.defineProperty(Ao,"__esModule",{value:!0});Ao.hmac=void 0;var _s=bo(),Zc=pn(),Ts=class extends Zc.Hash{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,_s.default.hash(t);let n=(0,Zc.toBytes)(e);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new TypeError("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let o=this.blockLen,i=new Uint8Array(o);i.set(n.length>o?t.create().update(n).digest():n);for(let a=0;a<i.length;a++)i[a]^=54;this.iHash.update(i),this.oHash=t.create();for(let a=0;a<i.length;a++)i[a]^=106;this.oHash.update(i),i.fill(0)}update(t){return _s.default.exists(this),this.iHash.update(t),this}digestInto(t){_s.default.exists(this),_s.default.bytes(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){let t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));let{oHash:e,iHash:n,finished:o,destroyed:i,blockLen:a,outputLen:u}=this;return t=t,t.finished=o,t.destroyed=i,t.blockLen=a,t.outputLen=u,t.oHash=e._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},ah=(r,t,e)=>new Ts(r,t).update(e).digest();Ao.hmac=ah;Ao.hmac.create=(r,t)=>new Ts(r,t)});var ru=ue(Qn=>{"use strict";Object.defineProperty(Qn,"__esModule",{value:!0});Qn.pbkdf2Async=Qn.pbkdf2=void 0;var vs=bo(),ch=Jc(),Vn=pn();function eu(r,t,e,n){vs.default.hash(r);let o=(0,Vn.checkOpts)({dkLen:32,asyncTick:10},n),{c:i,dkLen:a,asyncTick:u}=o;if(vs.default.number(i),vs.default.number(a),vs.default.number(u),i<1)throw new Error("PBKDF2: iterations (c) should be >= 1");let d=(0,Vn.toBytes)(t),h=(0,Vn.toBytes)(e),x=new Uint8Array(a),y=ch.hmac.create(r,d),T=y._cloneInto().update(h);return{c:i,dkLen:a,asyncTick:u,DK:x,PRF:y,PRFSalt:T}}function tu(r,t,e,n,o){return r.destroy(),t.destroy(),n&&n.destroy(),o.fill(0),e}function uh(r,t,e,n){let{c:o,dkLen:i,DK:a,PRF:u,PRFSalt:d}=eu(r,t,e,n),h,x=new Uint8Array(4),y=(0,Vn.createView)(x),T=new Uint8Array(u.outputLen);for(let E=1,I=0;I<i;E++,I+=u.outputLen){let A=a.subarray(I,I+u.outputLen);y.setInt32(0,E,!1),(h=d._cloneInto(h)).update(x).digestInto(T),A.set(T.subarray(0,A.length));for(let v=1;v<o;v++){u._cloneInto(h).update(T).digestInto(T);for(let k=0;k<A.length;k++)A[k]^=T[k]}}return tu(u,d,a,h,T)}Qn.pbkdf2=uh;async function fh(r,t,e,n){let{c:o,dkLen:i,asyncTick:a,DK:u,PRF:d,PRFSalt:h}=eu(r,t,e,n),x,y=new Uint8Array(4),T=(0,Vn.createView)(y),E=new Uint8Array(d.outputLen);for(let I=1,A=0;A<i;I++,A+=d.outputLen){let v=u.subarray(A,A+d.outputLen);T.setInt32(0,I,!1),(x=h._cloneInto(x)).update(y).digestInto(E),v.set(E.subarray(0,v.length)),await(0,Vn.asyncLoop)(o-1,a,k=>{d._cloneInto(x).update(E).digestInto(E);for(let N=0;N<v.length;N++)v[N]^=E[N]})}return tu(d,h,u,x,E)}Qn.pbkdf2Async=fh});var ji=ue(Es=>{"use strict";Object.defineProperty(Es,"__esModule",{value:!0});Es.SHA2=void 0;var $i=bo(),wo=pn();function lh(r,t,e,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(t,e,n);let o=BigInt(32),i=BigInt(4294967295),a=Number(e>>o&i),u=Number(e&i),d=n?4:0,h=n?0:4;r.setUint32(t+d,a,n),r.setUint32(t+h,u,n)}var Ki=class extends wo.Hash{constructor(t,e,n,o){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=(0,wo.createView)(this.buffer)}update(t){$i.default.exists(this);let{view:e,buffer:n,blockLen:o}=this;t=(0,wo.toBytes)(t);let i=t.length;for(let a=0;a<i;){let u=Math.min(o-this.pos,i-a);if(u===o){let d=(0,wo.createView)(t);for(;o<=i-a;a+=o)this.process(d,a);continue}n.set(t.subarray(a,a+u),this.pos),this.pos+=u,a+=u,this.pos===o&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){$i.default.exists(this),$i.default.output(t,this),this.finished=!0;let{buffer:e,view:n,blockLen:o,isLE:i}=this,{pos:a}=this;e[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>o-a&&(this.process(n,0),a=0);for(let d=a;d<o;d++)e[d]=0;lh(n,o-8,BigInt(this.length*8),i),this.process(n,0);let u=(0,wo.createView)(t);this.get().forEach((d,h)=>u.setUint32(4*h,d,i))}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:e,buffer:n,length:o,finished:i,destroyed:a,pos:u}=this;return t.length=o,t.pos=u,t.finished=i,t.destroyed=a,o%e&&t.buffer.set(n),t}};Es.SHA2=Ki});var nu=ue(Ss=>{"use strict";Object.defineProperty(Ss,"__esModule",{value:!0});Ss.sha256=void 0;var dh=ji(),Mt=pn(),ph=(r,t,e)=>r&t^~r&e,hh=(r,t,e)=>r&t^r&e^t&e,gh=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Hr=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Dr=new Uint32Array(64),Vi=class extends dh.SHA2{constructor(){super(64,32,8,!1),this.A=Hr[0]|0,this.B=Hr[1]|0,this.C=Hr[2]|0,this.D=Hr[3]|0,this.E=Hr[4]|0,this.F=Hr[5]|0,this.G=Hr[6]|0,this.H=Hr[7]|0}get(){let{A:t,B:e,C:n,D:o,E:i,F:a,G:u,H:d}=this;return[t,e,n,o,i,a,u,d]}set(t,e,n,o,i,a,u,d){this.A=t|0,this.B=e|0,this.C=n|0,this.D=o|0,this.E=i|0,this.F=a|0,this.G=u|0,this.H=d|0}process(t,e){for(let y=0;y<16;y++,e+=4)Dr[y]=t.getUint32(e,!1);for(let y=16;y<64;y++){let T=Dr[y-15],E=Dr[y-2],I=(0,Mt.rotr)(T,7)^(0,Mt.rotr)(T,18)^T>>>3,A=(0,Mt.rotr)(E,17)^(0,Mt.rotr)(E,19)^E>>>10;Dr[y]=A+Dr[y-7]+I+Dr[y-16]|0}let{A:n,B:o,C:i,D:a,E:u,F:d,G:h,H:x}=this;for(let y=0;y<64;y++){let T=(0,Mt.rotr)(u,6)^(0,Mt.rotr)(u,11)^(0,Mt.rotr)(u,25),E=x+T+ph(u,d,h)+gh[y]+Dr[y]|0,A=((0,Mt.rotr)(n,2)^(0,Mt.rotr)(n,13)^(0,Mt.rotr)(n,22))+hh(n,o,i)|0;x=h,h=d,d=u,u=a+E|0,a=i,i=o,o=n,n=E+A|0}n=n+this.A|0,o=o+this.B|0,i=i+this.C|0,a=a+this.D|0,u=u+this.E|0,d=d+this.F|0,h=h+this.G|0,x=x+this.H|0,this.set(n,o,i,a,u,d,h,x)}roundClean(){Dr.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};Ss.sha256=(0,Mt.wrapConstructor)(()=>new Vi)});var iu=ue(Ot=>{"use strict";Object.defineProperty(Ot,"__esModule",{value:!0});Ot.add=Ot.toBig=Ot.split=Ot.fromBig=void 0;var Us=BigInt(2**32-1),Qi=BigInt(32);function Wi(r,t=!1){return t?{h:Number(r&Us),l:Number(r>>Qi&Us)}:{h:Number(r>>Qi&Us)|0,l:Number(r&Us)|0}}Ot.fromBig=Wi;function ou(r,t=!1){let e=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let o=0;o<r.length;o++){let{h:i,l:a}=Wi(r[o],t);[e[o],n[o]]=[i,a]}return[e,n]}Ot.split=ou;var yh=(r,t)=>BigInt(r>>>0)<<Qi|BigInt(t>>>0);Ot.toBig=yh;var xh=(r,t,e)=>r>>>e,mh=(r,t,e)=>r<<32-e|t>>>e,bh=(r,t,e)=>r>>>e|t<<32-e,Ah=(r,t,e)=>r<<32-e|t>>>e,wh=(r,t,e)=>r<<64-e|t>>>e-32,_h=(r,t,e)=>r>>>e-32|t<<64-e,Th=(r,t)=>t,vh=(r,t)=>r,Eh=(r,t,e)=>r<<e|t>>>32-e,Sh=(r,t,e)=>t<<e|r>>>32-e,Uh=(r,t,e)=>t<<e-32|r>>>64-e,Ch=(r,t,e)=>r<<e-32|t>>>64-e;function su(r,t,e,n){let o=(t>>>0)+(n>>>0);return{h:r+e+(o/2**32|0)|0,l:o|0}}Ot.add=su;var Bh=(r,t,e)=>(r>>>0)+(t>>>0)+(e>>>0),Ih=(r,t,e,n)=>t+e+n+(r/2**32|0)|0,Rh=(r,t,e,n)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0),kh=(r,t,e,n,o)=>t+e+n+o+(r/2**32|0)|0,Oh=(r,t,e,n,o)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(o>>>0),Ph=(r,t,e,n,o,i)=>t+e+n+o+i+(r/2**32|0)|0,zh={fromBig:Wi,split:ou,toBig:Ot.toBig,shrSH:xh,shrSL:mh,rotrSH:bh,rotrSL:Ah,rotrBH:wh,rotrBL:_h,rotr32H:Th,rotr32L:vh,rotlSH:Eh,rotlSL:Sh,rotlBH:Uh,rotlBL:Ch,add:su,add3L:Bh,add3H:Ih,add4L:Rh,add4H:kh,add5H:Ph,add5L:Oh};Ot.default=zh});var au=ue(Zt=>{"use strict";Object.defineProperty(Zt,"__esModule",{value:!0});Zt.sha384=Zt.sha512_256=Zt.sha512=Zt.SHA512=void 0;var Hh=ji(),be=iu(),Zi=pn(),[Dh,qh]=be.default.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(r=>BigInt(r))),qr=new Uint32Array(80),Nr=new Uint32Array(80),Wn=class extends Hh.SHA2{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:t,Al:e,Bh:n,Bl:o,Ch:i,Cl:a,Dh:u,Dl:d,Eh:h,El:x,Fh:y,Fl:T,Gh:E,Gl:I,Hh:A,Hl:v}=this;return[t,e,n,o,i,a,u,d,h,x,y,T,E,I,A,v]}set(t,e,n,o,i,a,u,d,h,x,y,T,E,I,A,v){this.Ah=t|0,this.Al=e|0,this.Bh=n|0,this.Bl=o|0,this.Ch=i|0,this.Cl=a|0,this.Dh=u|0,this.Dl=d|0,this.Eh=h|0,this.El=x|0,this.Fh=y|0,this.Fl=T|0,this.Gh=E|0,this.Gl=I|0,this.Hh=A|0,this.Hl=v|0}process(t,e){for(let B=0;B<16;B++,e+=4)qr[B]=t.getUint32(e),Nr[B]=t.getUint32(e+=4);for(let B=16;B<80;B++){let Z=qr[B-15]|0,F=Nr[B-15]|0,Q=be.default.rotrSH(Z,F,1)^be.default.rotrSH(Z,F,8)^be.default.shrSH(Z,F,7),J=be.default.rotrSL(Z,F,1)^be.default.rotrSL(Z,F,8)^be.default.shrSL(Z,F,7),W=qr[B-2]|0,Te=Nr[B-2]|0,Ae=be.default.rotrSH(W,Te,19)^be.default.rotrBH(W,Te,61)^be.default.shrSH(W,Te,6),ye=be.default.rotrSL(W,Te,19)^be.default.rotrBL(W,Te,61)^be.default.shrSL(W,Te,6),ze=be.default.add4L(J,ye,Nr[B-7],Nr[B-16]),He=be.default.add4H(ze,Q,Ae,qr[B-7],qr[B-16]);qr[B]=He|0,Nr[B]=ze|0}let{Ah:n,Al:o,Bh:i,Bl:a,Ch:u,Cl:d,Dh:h,Dl:x,Eh:y,El:T,Fh:E,Fl:I,Gh:A,Gl:v,Hh:k,Hl:N}=this;for(let B=0;B<80;B++){let Z=be.default.rotrSH(y,T,14)^be.default.rotrSH(y,T,18)^be.default.rotrBH(y,T,41),F=be.default.rotrSL(y,T,14)^be.default.rotrSL(y,T,18)^be.default.rotrBL(y,T,41),Q=y&E^~y&A,J=T&I^~T&v,W=be.default.add5L(N,F,J,qh[B],Nr[B]),Te=be.default.add5H(W,k,Z,Q,Dh[B],qr[B]),Ae=W|0,ye=be.default.rotrSH(n,o,28)^be.default.rotrBH(n,o,34)^be.default.rotrBH(n,o,39),ze=be.default.rotrSL(n,o,28)^be.default.rotrBL(n,o,34)^be.default.rotrBL(n,o,39),He=n&i^n&u^i&u,nt=o&a^o&d^a&d;k=A|0,N=v|0,A=E|0,v=I|0,E=y|0,I=T|0,{h:y,l:T}=be.default.add(h|0,x|0,Te|0,Ae|0),h=u|0,x=d|0,u=i|0,d=a|0,i=n|0,a=o|0;let z=be.default.add3L(Ae,ze,nt);n=be.default.add3H(z,Te,ye,He),o=z|0}({h:n,l:o}=be.default.add(this.Ah|0,this.Al|0,n|0,o|0)),{h:i,l:a}=be.default.add(this.Bh|0,this.Bl|0,i|0,a|0),{h:u,l:d}=be.default.add(this.Ch|0,this.Cl|0,u|0,d|0),{h,l:x}=be.default.add(this.Dh|0,this.Dl|0,h|0,x|0),{h:y,l:T}=be.default.add(this.Eh|0,this.El|0,y|0,T|0),{h:E,l:I}=be.default.add(this.Fh|0,this.Fl|0,E|0,I|0),{h:A,l:v}=be.default.add(this.Gh|0,this.Gl|0,A|0,v|0),{h:k,l:N}=be.default.add(this.Hh|0,this.Hl|0,k|0,N|0),this.set(n,o,i,a,u,d,h,x,y,T,E,I,A,v,k,N)}roundClean(){qr.fill(0),Nr.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};Zt.SHA512=Wn;var Yi=class extends Wn{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}},Xi=class extends Wn{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}};Zt.sha512=(0,Zi.wrapConstructor)(()=>new Wn);Zt.sha512_256=(0,Zi.wrapConstructor)(()=>new Yi);Zt.sha384=(0,Zi.wrapConstructor)(()=>new Xi)});var bu=ue(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.bytes=X.stringToBytes=X.str=X.bytesToString=X.hex=X.utf8=X.bech32m=X.bech32=X.base58check=X.base58xmr=X.base58xrp=X.base58flickr=X.base58=X.base64url=X.base64=X.base32crockford=X.base32hex=X.base32=X.base16=X.utils=X.assertNumber=void 0;function Mr(r){if(!Number.isSafeInteger(r))throw new Error(`Wrong integer: ${r}`)}X.assertNumber=Mr;function Gt(...r){let t=(o,i)=>a=>o(i(a)),e=Array.from(r).reverse().reduce((o,i)=>o?t(o,i.encode):i.encode,void 0),n=r.reduce((o,i)=>o?t(o,i.decode):i.decode,void 0);return{encode:e,decode:n}}function Jt(r){return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return t.map(e=>{if(Mr(e),e<0||e>=r.length)throw new Error(`Digit index outside alphabet: ${e} (alphabet: ${r.length})`);return r[e]})},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("alphabet.decode input should be array of strings");return t.map(e=>{if(typeof e!="string")throw new Error(`alphabet.decode: not string element=${e}`);let n=r.indexOf(e);if(n===-1)throw new Error(`Unknown letter: "${e}". Allowed: ${r}`);return n})}}}function er(r=""){if(typeof r!="string")throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("join.encode input should be array of strings");for(let e of t)if(typeof e!="string")throw new Error(`join.encode: non-string input=${e}`);return t.join(r)},decode:t=>{if(typeof t!="string")throw new Error("join.decode input should be string");return t.split(r)}}}function vo(r,t="="){if(Mr(r),typeof t!="string")throw new Error("padding chr should be string");return{encode(e){if(!Array.isArray(e)||e.length&&typeof e[0]!="string")throw new Error("padding.encode input should be array of strings");for(let n of e)if(typeof n!="string")throw new Error(`padding.encode: non-string input=${n}`);for(;e.length*r%8;)e.push(t);return e},decode(e){if(!Array.isArray(e)||e.length&&typeof e[0]!="string")throw new Error("padding.encode input should be array of strings");for(let o of e)if(typeof o!="string")throw new Error(`padding.decode: non-string input=${o}`);let n=e.length;if(n*r%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;n>0&&e[n-1]===t;n--)if(!((n-1)*r%8))throw new Error("Invalid padding: string has too much padding");return e.slice(0,n)}}}function pu(r){if(typeof r!="function")throw new Error("normalize fn should be function");return{encode:t=>t,decode:t=>r(t)}}function cu(r,t,e){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(e<2)throw new Error(`convertRadix: wrong to=${e}, base cannot be less than 2`);if(!Array.isArray(r))throw new Error("convertRadix: data should be array");if(!r.length)return[];let n=0,o=[],i=Array.from(r);for(i.forEach(a=>{if(Mr(a),a<0||a>=t)throw new Error(`Wrong integer: ${a}`)});;){let a=0,u=!0;for(let d=n;d<i.length;d++){let h=i[d],x=t*a+h;if(!Number.isSafeInteger(x)||t*a/t!==a||x-h!==t*a)throw new Error("convertRadix: carry overflow");if(a=x%e,i[d]=Math.floor(x/e),!Number.isSafeInteger(i[d])||i[d]*e+a!==x)throw new Error("convertRadix: carry overflow");if(u)i[d]?u=!1:n=d;else continue}if(o.push(a),u)break}for(let a=0;a<r.length-1&&r[a]===0;a++)o.push(0);return o.reverse()}var hu=(r,t)=>t?hu(t,r%t):r,Cs=(r,t)=>r+(t-hu(r,t));function Ji(r,t,e,n){if(!Array.isArray(r))throw new Error("convertRadix2: data should be array");if(t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(e<=0||e>32)throw new Error(`convertRadix2: wrong to=${e}`);if(Cs(t,e)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${e} carryBits=${Cs(t,e)}`);let o=0,i=0,a=2**e-1,u=[];for(let d of r){if(Mr(d),d>=2**t)throw new Error(`convertRadix2: invalid data word=${d} from=${t}`);if(o=o<<t|d,i+t>32)throw new Error(`convertRadix2: carry overflow pos=${i} from=${t}`);for(i+=t;i>=e;i-=e)u.push((o>>i-e&a)>>>0);o&=2**i-1}if(o=o<<e-i&a,!n&&i>=t)throw new Error("Excess padding");if(!n&&o)throw new Error(`Non-zero padding: ${o}`);return n&&i>0&&u.push(o>>>0),u}function gu(r){return Mr(r),{encode:t=>{if(!(t instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return cu(Array.from(t),2**8,r)},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("radix.decode input should be array of strings");return Uint8Array.from(cu(t,r,2**8))}}}function mr(r,t=!1){if(Mr(r),r<=0||r>32)throw new Error("radix2: bits should be in (0..32]");if(Cs(8,r)>32||Cs(r,8)>32)throw new Error("radix2: carry overflow");return{encode:e=>{if(!(e instanceof Uint8Array))throw new Error("radix2.encode input should be Uint8Array");return Ji(Array.from(e),8,r,!t)},decode:e=>{if(!Array.isArray(e)||e.length&&typeof e[0]!="number")throw new Error("radix2.decode input should be array of strings");return Uint8Array.from(Ji(e,r,8,t))}}}function uu(r){if(typeof r!="function")throw new Error("unsafeWrapper fn should be function");return function(...t){try{return r.apply(null,t)}catch(e){}}}function yu(r,t){if(Mr(r),typeof t!="function")throw new Error("checksum fn should be function");return{encode(e){if(!(e instanceof Uint8Array))throw new Error("checksum.encode: input should be Uint8Array");let n=t(e).slice(0,r),o=new Uint8Array(e.length+r);return o.set(e),o.set(n,e.length),o},decode(e){if(!(e instanceof Uint8Array))throw new Error("checksum.decode: input should be Uint8Array");let n=e.slice(0,-r),o=t(n).slice(0,r),i=e.slice(-r);for(let a=0;a<r;a++)if(o[a]!==i[a])throw new Error("Invalid checksum");return n}}}X.utils={alphabet:Jt,chain:Gt,checksum:yu,radix:gu,radix2:mr,join:er,padding:vo};X.base16=Gt(mr(4),Jt("0123456789ABCDEF"),er(""));X.base32=Gt(mr(5),Jt("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),vo(5),er(""));X.base32hex=Gt(mr(5),Jt("0123456789ABCDEFGHIJKLMNOPQRSTUV"),vo(5),er(""));X.base32crockford=Gt(mr(5),Jt("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),er(""),pu(r=>r.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")));X.base64=Gt(mr(6),Jt("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),vo(6),er(""));X.base64url=Gt(mr(6),Jt("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),vo(6),er(""));var ta=r=>Gt(gu(58),Jt(r),er(""));X.base58=ta("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");X.base58flickr=ta("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ");X.base58xrp=ta("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");var fu=[0,2,3,5,6,7,9,10,11];X.base58xmr={encode(r){let t="";for(let e=0;e<r.length;e+=8){let n=r.subarray(e,e+8);t+=X.base58.encode(n).padStart(fu[n.length],"1")}return t},decode(r){let t=[];for(let e=0;e<r.length;e+=11){let n=r.slice(e,e+11),o=fu.indexOf(n.length),i=X.base58.decode(n);for(let a=0;a<i.length-o;a++)if(i[a]!==0)throw new Error("base58xmr: wrong padding");t=t.concat(Array.from(i.slice(i.length-o)))}return Uint8Array.from(t)}};var Nh=r=>Gt(yu(4,t=>r(r(t))),X.base58);X.base58check=Nh;var ea=Gt(Jt("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),er("")),lu=[996825010,642813549,513874426,1027748829,705979059];function _o(r){let t=r>>25,e=(r&33554431)<<5;for(let n=0;n<lu.length;n++)(t>>n&1)===1&&(e^=lu[n]);return e}function du(r,t,e=1){let n=r.length,o=1;for(let i=0;i<n;i++){let a=r.charCodeAt(i);if(a<33||a>126)throw new Error(`Invalid prefix (${r})`);o=_o(o)^a>>5}o=_o(o);for(let i=0;i<n;i++)o=_o(o)^r.charCodeAt(i)&31;for(let i of t)o=_o(o)^i;for(let i=0;i<6;i++)o=_o(o);return o^=e,ea.encode(Ji([o%2**30],30,5,!1))}function xu(r){let t=r==="bech32"?1:734539939,e=mr(5),n=e.decode,o=e.encode,i=uu(n);function a(x,y,T=90){if(typeof x!="string")throw new Error(`bech32.encode prefix should be string, not ${typeof x}`);if(!Array.isArray(y)||y.length&&typeof y[0]!="number")throw new Error(`bech32.encode words should be array of numbers, not ${typeof y}`);let E=x.length+7+y.length;if(T!==!1&&E>T)throw new TypeError(`Length ${E} exceeds limit ${T}`);return x=x.toLowerCase(),`${x}1${ea.encode(y)}${du(x,y,t)}`}function u(x,y=90){if(typeof x!="string")throw new Error(`bech32.decode input should be string, not ${typeof x}`);if(x.length<8||y!==!1&&x.length>y)throw new TypeError(`Wrong string length: ${x.length} (${x}). Expected (8..${y})`);let T=x.toLowerCase();if(x!==T&&x!==x.toUpperCase())throw new Error("String must be lowercase or uppercase");x=T;let E=x.lastIndexOf("1");if(E===0||E===-1)throw new Error('Letter "1" must be present between prefix and data only');let I=x.slice(0,E),A=x.slice(E+1);if(A.length<6)throw new Error("Data must be at least 6 characters long");let v=ea.decode(A).slice(0,-6),k=du(I,v,t);if(!A.endsWith(k))throw new Error(`Invalid checksum in ${x}: expected "${k}"`);return{prefix:I,words:v}}let d=uu(u);function h(x){let{prefix:y,words:T}=u(x,!1);return{prefix:y,words:T,bytes:n(T)}}return{encode:a,decode:u,decodeToBytes:h,decodeUnsafe:d,fromWords:n,fromWordsUnsafe:i,toWords:o}}X.bech32=xu("bech32");X.bech32m=xu("bech32m");X.utf8={encode:r=>new TextDecoder().decode(r),decode:r=>new TextEncoder().encode(r)};X.hex=Gt(mr(4),Jt("0123456789abcdef"),er(""),pu(r=>{if(typeof r!="string"||r.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof r} with length ${r.length}`);return r.toLowerCase()}));var To={utf8:X.utf8,hex:X.hex,base16:X.base16,base32:X.base32,base64:X.base64,base64url:X.base64url,base58:X.base58,base58xmr:X.base58xmr},mu=`Invalid encoding type. Available types: ${Object.keys(To).join(", ")}`,Mh=(r,t)=>{if(typeof r!="string"||!To.hasOwnProperty(r))throw new TypeError(mu);if(!(t instanceof Uint8Array))throw new TypeError("bytesToString() expects Uint8Array");return To[r].encode(t)};X.bytesToString=Mh;X.str=X.bytesToString;var Gh=(r,t)=>{if(!To.hasOwnProperty(r))throw new TypeError(mu);if(typeof t!="string")throw new TypeError("stringToBytes() expects string");return To[r].decode(t)};X.stringToBytes=Gh;X.bytes=X.stringToBytes});var Bu=ue(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.mnemonicToSeedSync=gt.mnemonicToSeed=gt.validateMnemonic=gt.entropyToMnemonic=gt.mnemonicToEntropy=gt.generateMnemonic=void 0;var Au=bo(),wu=ru(),Lh=nu(),_u=au(),Fh=pn(),Bs=bu(),$h=r=>r[0]==="\u3042\u3044\u3053\u304F\u3057\u3093";function Tu(r){if(typeof r!="string")throw new TypeError(`Invalid mnemonic type: ${typeof r}`);return r.normalize("NFKD")}function ra(r){let t=Tu(r),e=t.split(" ");if(![12,15,18,21,24].includes(e.length))throw new Error("Invalid mnemonic");return{nfkd:t,words:e}}function vu(r){Au.default.bytes(r,16,20,24,28,32)}function Kh(r,t=128){if(Au.default.number(t),t%32!==0||t>256)throw new TypeError("Invalid entropy");return Uu((0,Fh.randomBytes)(t/8),r)}gt.generateMnemonic=Kh;var jh=r=>{let t=8-r.length/4;return new Uint8Array([(0,Lh.sha256)(r)[0]>>t<<t])};function Eu(r){if(!Array.isArray(r)||r.length!==2**11||typeof r[0]!="string")throw new Error("Worlist: expected array of 2048 strings");return r.forEach(t=>{if(typeof t!="string")throw new Error(`Wordlist: non-string element: ${t}`)}),Bs.utils.chain(Bs.utils.checksum(1,jh),Bs.utils.radix2(11,!0),Bs.utils.alphabet(r))}function Su(r,t){let{words:e}=ra(r),n=Eu(t).decode(e);return vu(n),n}gt.mnemonicToEntropy=Su;function Uu(r,t){return vu(r),Eu(t).encode(r).join($h(t)?"\u3000":" ")}gt.entropyToMnemonic=Uu;function Vh(r,t){try{Su(r,t)}catch(e){return!1}return!0}gt.validateMnemonic=Vh;var Cu=r=>Tu(`mnemonic${r}`);function Qh(r,t=""){return(0,wu.pbkdf2Async)(_u.sha512,ra(r).nfkd,Cu(t),{c:2048,dkLen:64})}gt.mnemonicToSeed=Qh;function Wh(r,t=""){return(0,wu.pbkdf2)(_u.sha512,ra(r).nfkd,Cu(t),{c:2048,dkLen:64})}gt.mnemonicToSeedSync=Wh});var fa=ue((Zb,bf)=>{"use strict";bf.exports=function(t,e){return function(){for(var o=new Array(arguments.length),i=0;i<o.length;i++)o[i]=arguments[i];return t.apply(e,o)}}});var Je=ue((Jb,_f)=>{"use strict";var r0=fa(),da=Object.prototype.toString,pa=function(r){return function(t){var e=da.call(t);return r[e]||(r[e]=e.slice(8,-1).toLowerCase())}}(Object.create(null));function hn(r){return r=r.toLowerCase(),function(e){return pa(e)===r}}function ha(r){return Array.isArray(r)}function Hs(r){return typeof r=="undefined"}function n0(r){return r!==null&&!Hs(r)&&r.constructor!==null&&!Hs(r.constructor)&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}var Af=hn("ArrayBuffer");function o0(r){var t;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?t=ArrayBuffer.isView(r):t=r&&r.buffer&&Af(r.buffer),t}function s0(r){return typeof r=="string"}function i0(r){return typeof r=="number"}function wf(r){return r!==null&&typeof r=="object"}function zs(r){if(pa(r)!=="object")return!1;var t=Object.getPrototypeOf(r);return t===null||t===Object.prototype}var a0=hn("Date"),c0=hn("File"),u0=hn("Blob"),f0=hn("FileList");function ga(r){return da.call(r)==="[object Function]"}function l0(r){return wf(r)&&ga(r.pipe)}function d0(r){var t="[object FormData]";return r&&(typeof FormData=="function"&&r instanceof FormData||da.call(r)===t||ga(r.toString)&&r.toString()===t)}var p0=hn("URLSearchParams");function h0(r){return r.trim?r.trim():r.replace(/^\s+|\s+$/g,"")}function g0(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function ya(r,t){if(!(r===null||typeof r=="undefined"))if(typeof r!="object"&&(r=[r]),ha(r))for(var e=0,n=r.length;e<n;e++)t.call(null,r[e],e,r);else for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&t.call(null,r[o],o,r)}function la(){var r={};function t(o,i){zs(r[i])&&zs(o)?r[i]=la(r[i],o):zs(o)?r[i]=la({},o):ha(o)?r[i]=o.slice():r[i]=o}for(var e=0,n=arguments.length;e<n;e++)ya(arguments[e],t);return r}function y0(r,t,e){return ya(t,function(o,i){e&&typeof o=="function"?r[i]=r0(o,e):r[i]=o}),r}function x0(r){return r.charCodeAt(0)===65279&&(r=r.slice(1)),r}function m0(r,t,e,n){r.prototype=Object.create(t.prototype,n),r.prototype.constructor=r,e&&Object.assign(r.prototype,e)}function b0(r,t,e){var n,o,i,a={};t=t||{};do{for(n=Object.getOwnPropertyNames(r),o=n.length;o-- >0;)i=n[o],a[i]||(t[i]=r[i],a[i]=!0);r=Object.getPrototypeOf(r)}while(r&&(!e||e(r,t))&&r!==Object.prototype);return t}function A0(r,t,e){r=String(r),(e===void 0||e>r.length)&&(e=r.length),e-=t.length;var n=r.indexOf(t,e);return n!==-1&&n===e}function w0(r){if(!r)return null;var t=r.length;if(Hs(t))return null;for(var e=new Array(t);t-- >0;)e[t]=r[t];return e}var _0=function(r){return function(t){return r&&t instanceof r}}(typeof Uint8Array!="undefined"&&Object.getPrototypeOf(Uint8Array));_f.exports={isArray:ha,isArrayBuffer:Af,isBuffer:n0,isFormData:d0,isArrayBufferView:o0,isString:s0,isNumber:i0,isObject:wf,isPlainObject:zs,isUndefined:Hs,isDate:a0,isFile:c0,isBlob:u0,isFunction:ga,isStream:l0,isURLSearchParams:p0,isStandardBrowserEnv:g0,forEach:ya,merge:la,extend:y0,trim:h0,stripBOM:x0,inherits:m0,toFlatObject:b0,kindOf:pa,kindOfTest:hn,endsWith:A0,toArray:w0,isTypedArray:_0,isFileList:f0}});var xa=ue((e1,vf)=>{"use strict";var Yn=Je();function Tf(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}vf.exports=function(t,e,n){if(!e)return t;var o;if(n)o=n(e);else if(Yn.isURLSearchParams(e))o=e.toString();else{var i=[];Yn.forEach(e,function(d,h){d===null||typeof d=="undefined"||(Yn.isArray(d)?h=h+"[]":d=[d],Yn.forEach(d,function(y){Yn.isDate(y)?y=y.toISOString():Yn.isObject(y)&&(y=JSON.stringify(y)),i.push(Tf(h)+"="+Tf(y))}))}),o=i.join("&")}if(o){var a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+o}return t}});var Sf=ue((t1,Ef)=>{"use strict";var T0=Je();function Ds(){this.handlers=[]}Ds.prototype.use=function(t,e,n){return this.handlers.push({fulfilled:t,rejected:e,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1};Ds.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)};Ds.prototype.forEach=function(t){T0.forEach(this.handlers,function(n){n!==null&&t(n)})};Ef.exports=Ds});var Cf=ue((r1,Uf)=>{"use strict";var v0=Je();Uf.exports=function(t,e){v0.forEach(t,function(o,i){i!==e&&i.toUpperCase()===e.toUpperCase()&&(t[e]=o,delete t[i])})}});var gn=ue((n1,kf)=>{"use strict";var Bf=Je();function Xn(r,t,e,n,o){Error.call(this),this.message=r,this.name="AxiosError",t&&(this.code=t),e&&(this.config=e),n&&(this.request=n),o&&(this.response=o)}Bf.inherits(Xn,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var If=Xn.prototype,Rf={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED"].forEach(function(r){Rf[r]={value:r}});Object.defineProperties(Xn,Rf);Object.defineProperty(If,"isAxiosError",{value:!0});Xn.from=function(r,t,e,n,o,i){var a=Object.create(If);return Bf.toFlatObject(r,a,function(d){return d!==Error.prototype}),Xn.call(a,r.message,t,e,n,o),a.name=r.name,i&&Object.assign(a,i),a};kf.exports=Xn});var ma=ue((o1,Of)=>{"use strict";Of.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}});var ba=ue((s1,Pf)=>{"use strict";var Lt=Je();function E0(r,t){t=t||new FormData;var e=[];function n(i){return i===null?"":Lt.isDate(i)?i.toISOString():Lt.isArrayBuffer(i)||Lt.isTypedArray(i)?typeof Blob=="function"?new Blob([i]):Buffer.from(i):i}function o(i,a){if(Lt.isPlainObject(i)||Lt.isArray(i)){if(e.indexOf(i)!==-1)throw Error("Circular reference detected in "+a);e.push(i),Lt.forEach(i,function(d,h){if(!Lt.isUndefined(d)){var x=a?a+"."+h:h,y;if(d&&!a&&typeof d=="object"){if(Lt.endsWith(h,"{}"))d=JSON.stringify(d);else if(Lt.endsWith(h,"[]")&&(y=Lt.toArray(d))){y.forEach(function(T){!Lt.isUndefined(T)&&t.append(x,n(T))});return}}o(d,x)}}),e.pop()}else t.append(a,n(i))}return o(r),t}Pf.exports=E0});var Hf=ue((i1,zf)=>{"use strict";var Aa=gn();zf.exports=function(t,e,n){var o=n.config.validateStatus;!n.status||!o||o(n.status)?t(n):e(new Aa("Request failed with status code "+n.status,[Aa.ERR_BAD_REQUEST,Aa.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}});var qf=ue((a1,Df)=>{"use strict";var qs=Je();Df.exports=qs.isStandardBrowserEnv()?function(){return{write:function(e,n,o,i,a,u){var d=[];d.push(e+"="+encodeURIComponent(n)),qs.isNumber(o)&&d.push("expires="+new Date(o).toGMTString()),qs.isString(i)&&d.push("path="+i),qs.isString(a)&&d.push("domain="+a),u===!0&&d.push("secure"),document.cookie=d.join("; ")},read:function(e){var n=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var Mf=ue((c1,Nf)=>{"use strict";Nf.exports=function(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}});var Lf=ue((u1,Gf)=>{"use strict";Gf.exports=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}});var wa=ue((f1,Ff)=>{"use strict";var S0=Mf(),U0=Lf();Ff.exports=function(t,e){return t&&!S0(e)?U0(t,e):e}});var Kf=ue((l1,$f)=>{"use strict";var _a=Je(),C0=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];$f.exports=function(t){var e={},n,o,i;return t&&_a.forEach(t.split(`
2
+ `),function(u){if(i=u.indexOf(":"),n=_a.trim(u.substr(0,i)).toLowerCase(),o=_a.trim(u.substr(i+1)),n){if(e[n]&&C0.indexOf(n)>=0)return;n==="set-cookie"?e[n]=(e[n]?e[n]:[]).concat([o]):e[n]=e[n]?e[n]+", "+o:o}}),e}});var Qf=ue((d1,Vf)=>{"use strict";var jf=Je();Vf.exports=jf.isStandardBrowserEnv()?function(){var t=/(msie|trident)/i.test(navigator.userAgent),e=document.createElement("a"),n;function o(i){var a=i;return t&&(e.setAttribute("href",a),a=e.href),e.setAttribute("href",a),{href:e.href,protocol:e.protocol?e.protocol.replace(/:$/,""):"",host:e.host,search:e.search?e.search.replace(/^\?/,""):"",hash:e.hash?e.hash.replace(/^#/,""):"",hostname:e.hostname,port:e.port,pathname:e.pathname.charAt(0)==="/"?e.pathname:"/"+e.pathname}}return n=o(window.location.href),function(a){var u=jf.isString(a)?o(a):a;return u.protocol===n.protocol&&u.host===n.host}}():function(){return function(){return!0}}()});var Uo=ue((p1,Yf)=>{"use strict";var Ta=gn(),B0=Je();function Wf(r){Ta.call(this,r==null?"canceled":r,Ta.ERR_CANCELED),this.name="CanceledError"}B0.inherits(Wf,Ta,{__CANCEL__:!0});Yf.exports=Wf});var Zf=ue((h1,Xf)=>{"use strict";Xf.exports=function(t){var e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}});var va=ue((g1,Jf)=>{"use strict";var Co=Je(),I0=Hf(),R0=qf(),k0=xa(),O0=wa(),P0=Kf(),z0=Qf(),H0=ma(),br=gn(),D0=Uo(),q0=Zf();Jf.exports=function(t){return new Promise(function(n,o){var i=t.data,a=t.headers,u=t.responseType,d;function h(){t.cancelToken&&t.cancelToken.unsubscribe(d),t.signal&&t.signal.removeEventListener("abort",d)}Co.isFormData(i)&&Co.isStandardBrowserEnv()&&delete a["Content-Type"];var x=new XMLHttpRequest;if(t.auth){var y=t.auth.username||"",T=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";a.Authorization="Basic "+btoa(y+":"+T)}var E=O0(t.baseURL,t.url);x.open(t.method.toUpperCase(),k0(E,t.params,t.paramsSerializer),!0),x.timeout=t.timeout;function I(){if(!!x){var k="getAllResponseHeaders"in x?P0(x.getAllResponseHeaders()):null,N=!u||u==="text"||u==="json"?x.responseText:x.response,B={data:N,status:x.status,statusText:x.statusText,headers:k,config:t,request:x};I0(function(F){n(F),h()},function(F){o(F),h()},B),x=null}}if("onloadend"in x?x.onloadend=I:x.onreadystatechange=function(){!x||x.readyState!==4||x.status===0&&!(x.responseURL&&x.responseURL.indexOf("file:")===0)||setTimeout(I)},x.onabort=function(){!x||(o(new br("Request aborted",br.ECONNABORTED,t,x)),x=null)},x.onerror=function(){o(new br("Network Error",br.ERR_NETWORK,t,x,x)),x=null},x.ontimeout=function(){var N=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",B=t.transitional||H0;t.timeoutErrorMessage&&(N=t.timeoutErrorMessage),o(new br(N,B.clarifyTimeoutError?br.ETIMEDOUT:br.ECONNABORTED,t,x)),x=null},Co.isStandardBrowserEnv()){var A=(t.withCredentials||z0(E))&&t.xsrfCookieName?R0.read(t.xsrfCookieName):void 0;A&&(a[t.xsrfHeaderName]=A)}"setRequestHeader"in x&&Co.forEach(a,function(N,B){typeof i=="undefined"&&B.toLowerCase()==="content-type"?delete a[B]:x.setRequestHeader(B,N)}),Co.isUndefined(t.withCredentials)||(x.withCredentials=!!t.withCredentials),u&&u!=="json"&&(x.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&x.addEventListener("progress",t.onDownloadProgress),typeof t.onUploadProgress=="function"&&x.upload&&x.upload.addEventListener("progress",t.onUploadProgress),(t.cancelToken||t.signal)&&(d=function(k){!x||(o(!k||k&&k.type?new D0:k),x.abort(),x=null)},t.cancelToken&&t.cancelToken.subscribe(d),t.signal&&(t.signal.aborted?d():t.signal.addEventListener("abort",d))),i||(i=null);var v=q0(E);if(v&&["http","https","file"].indexOf(v)===-1){o(new br("Unsupported protocol "+v+":",br.ERR_BAD_REQUEST,t));return}x.send(i)})}});var tl=ue((y1,el)=>{el.exports=null});var Ms=ue((x1,sl)=>{"use strict";var et=Je(),rl=Cf(),nl=gn(),N0=ma(),M0=ba(),G0={"Content-Type":"application/x-www-form-urlencoded"};function ol(r,t){!et.isUndefined(r)&&et.isUndefined(r["Content-Type"])&&(r["Content-Type"]=t)}function L0(){var r;return typeof XMLHttpRequest!="undefined"?r=va():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(r=va()),r}function F0(r,t,e){if(et.isString(r))try{return(t||JSON.parse)(r),et.trim(r)}catch(n){if(n.name!=="SyntaxError")throw n}return(e||JSON.stringify)(r)}var Ns={transitional:N0,adapter:L0(),transformRequest:[function(t,e){if(rl(e,"Accept"),rl(e,"Content-Type"),et.isFormData(t)||et.isArrayBuffer(t)||et.isBuffer(t)||et.isStream(t)||et.isFile(t)||et.isBlob(t))return t;if(et.isArrayBufferView(t))return t.buffer;if(et.isURLSearchParams(t))return ol(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString();var n=et.isObject(t),o=e&&e["Content-Type"],i;if((i=et.isFileList(t))||n&&o==="multipart/form-data"){var a=this.env&&this.env.FormData;return M0(i?{"files[]":t}:t,a&&new a)}else if(n||o==="application/json")return ol(e,"application/json"),F0(t);return t}],transformResponse:[function(t){var e=this.transitional||Ns.transitional,n=e&&e.silentJSONParsing,o=e&&e.forcedJSONParsing,i=!n&&this.responseType==="json";if(i||o&&et.isString(t)&&t.length)try{return JSON.parse(t)}catch(a){if(i)throw a.name==="SyntaxError"?nl.from(a,nl.ERR_BAD_RESPONSE,this,null,this.response):a}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:tl()},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};et.forEach(["delete","get","head"],function(t){Ns.headers[t]={}});et.forEach(["post","put","patch"],function(t){Ns.headers[t]=et.merge(G0)});sl.exports=Ns});var al=ue((m1,il)=>{"use strict";var $0=Je(),K0=Ms();il.exports=function(t,e,n){var o=this||K0;return $0.forEach(n,function(a){t=a.call(o,t,e)}),t}});var Ea=ue((b1,cl)=>{"use strict";cl.exports=function(t){return!!(t&&t.__CANCEL__)}});var ll=ue((A1,fl)=>{"use strict";var ul=Je(),Sa=al(),j0=Ea(),V0=Ms(),Q0=Uo();function Ua(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new Q0}fl.exports=function(t){Ua(t),t.headers=t.headers||{},t.data=Sa.call(t,t.data,t.headers,t.transformRequest),t.headers=ul.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),ul.forEach(["delete","get","head","post","put","patch","common"],function(o){delete t.headers[o]});var e=t.adapter||V0.adapter;return e(t).then(function(o){return Ua(t),o.data=Sa.call(t,o.data,o.headers,t.transformResponse),o},function(o){return j0(o)||(Ua(t),o&&o.response&&(o.response.data=Sa.call(t,o.response.data,o.response.headers,t.transformResponse))),Promise.reject(o)})}});var Ca=ue((w1,dl)=>{"use strict";var Et=Je();dl.exports=function(t,e){e=e||{};var n={};function o(x,y){return Et.isPlainObject(x)&&Et.isPlainObject(y)?Et.merge(x,y):Et.isPlainObject(y)?Et.merge({},y):Et.isArray(y)?y.slice():y}function i(x){if(Et.isUndefined(e[x])){if(!Et.isUndefined(t[x]))return o(void 0,t[x])}else return o(t[x],e[x])}function a(x){if(!Et.isUndefined(e[x]))return o(void 0,e[x])}function u(x){if(Et.isUndefined(e[x])){if(!Et.isUndefined(t[x]))return o(void 0,t[x])}else return o(void 0,e[x])}function d(x){if(x in e)return o(t[x],e[x]);if(x in t)return o(void 0,t[x])}var h={url:a,method:a,data:a,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,beforeRedirect:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:d};return Et.forEach(Object.keys(t).concat(Object.keys(e)),function(y){var T=h[y]||i,E=T(y);Et.isUndefined(E)&&T!==d||(n[y]=E)}),n}});var Ba=ue((_1,pl)=>{pl.exports={version:"0.27.2"}});var yl=ue((T1,gl)=>{"use strict";var W0=Ba().version,Gr=gn(),Ia={};["object","boolean","number","function","string","symbol"].forEach(function(r,t){Ia[r]=function(n){return typeof n===r||"a"+(t<1?"n ":" ")+r}});var hl={};Ia.transitional=function(t,e,n){function o(i,a){return"[Axios v"+W0+"] Transitional option '"+i+"'"+a+(n?". "+n:"")}return function(i,a,u){if(t===!1)throw new Gr(o(a," has been removed"+(e?" in "+e:"")),Gr.ERR_DEPRECATED);return e&&!hl[a]&&(hl[a]=!0,console.warn(o(a," has been deprecated since v"+e+" and will be removed in the near future"))),t?t(i,a,u):!0}};function Y0(r,t,e){if(typeof r!="object")throw new Gr("options must be an object",Gr.ERR_BAD_OPTION_VALUE);for(var n=Object.keys(r),o=n.length;o-- >0;){var i=n[o],a=t[i];if(a){var u=r[i],d=u===void 0||a(u,i,r);if(d!==!0)throw new Gr("option "+i+" must be "+d,Gr.ERR_BAD_OPTION_VALUE);continue}if(e!==!0)throw new Gr("Unknown option "+i,Gr.ERR_BAD_OPTION)}}gl.exports={assertOptions:Y0,validators:Ia}});var _l=ue((v1,wl)=>{"use strict";var bl=Je(),X0=xa(),xl=Sf(),ml=ll(),Gs=Ca(),Z0=wa(),Al=yl(),Zn=Al.validators;function Jn(r){this.defaults=r,this.interceptors={request:new xl,response:new xl}}Jn.prototype.request=function(t,e){typeof t=="string"?(e=e||{},e.url=t):e=t||{},e=Gs(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var n=e.transitional;n!==void 0&&Al.assertOptions(n,{silentJSONParsing:Zn.transitional(Zn.boolean),forcedJSONParsing:Zn.transitional(Zn.boolean),clarifyTimeoutError:Zn.transitional(Zn.boolean)},!1);var o=[],i=!0;this.interceptors.request.forEach(function(E){typeof E.runWhen=="function"&&E.runWhen(e)===!1||(i=i&&E.synchronous,o.unshift(E.fulfilled,E.rejected))});var a=[];this.interceptors.response.forEach(function(E){a.push(E.fulfilled,E.rejected)});var u;if(!i){var d=[ml,void 0];for(Array.prototype.unshift.apply(d,o),d=d.concat(a),u=Promise.resolve(e);d.length;)u=u.then(d.shift(),d.shift());return u}for(var h=e;o.length;){var x=o.shift(),y=o.shift();try{h=x(h)}catch(T){y(T);break}}try{u=ml(h)}catch(T){return Promise.reject(T)}for(;a.length;)u=u.then(a.shift(),a.shift());return u};Jn.prototype.getUri=function(t){t=Gs(this.defaults,t);var e=Z0(t.baseURL,t.url);return X0(e,t.params,t.paramsSerializer)};bl.forEach(["delete","get","head","options"],function(t){Jn.prototype[t]=function(e,n){return this.request(Gs(n||{},{method:t,url:e,data:(n||{}).data}))}});bl.forEach(["post","put","patch"],function(t){function e(n){return function(i,a,u){return this.request(Gs(u||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}Jn.prototype[t]=e(),Jn.prototype[t+"Form"]=e(!0)});wl.exports=Jn});var vl=ue((E1,Tl)=>{"use strict";var J0=Uo();function eo(r){if(typeof r!="function")throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(o){t=o});var e=this;this.promise.then(function(n){if(!!e._listeners){var o,i=e._listeners.length;for(o=0;o<i;o++)e._listeners[o](n);e._listeners=null}}),this.promise.then=function(n){var o,i=new Promise(function(a){e.subscribe(a),o=a}).then(n);return i.cancel=function(){e.unsubscribe(o)},i},r(function(o){e.reason||(e.reason=new J0(o),t(e.reason))})}eo.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};eo.prototype.subscribe=function(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]};eo.prototype.unsubscribe=function(t){if(!!this._listeners){var e=this._listeners.indexOf(t);e!==-1&&this._listeners.splice(e,1)}};eo.source=function(){var t,e=new eo(function(o){t=o});return{token:e,cancel:t}};Tl.exports=eo});var Sl=ue((S1,El)=>{"use strict";El.exports=function(t){return function(n){return t.apply(null,n)}}});var Cl=ue((U1,Ul)=>{"use strict";var eg=Je();Ul.exports=function(t){return eg.isObject(t)&&t.isAxiosError===!0}});var Rl=ue((C1,Ra)=>{"use strict";var Bl=Je(),tg=fa(),Ls=_l(),rg=Ca(),ng=Ms();function Il(r){var t=new Ls(r),e=tg(Ls.prototype.request,t);return Bl.extend(e,Ls.prototype,t),Bl.extend(e,t),e.create=function(o){return Il(rg(r,o))},e}var yt=Il(ng);yt.Axios=Ls;yt.CanceledError=Uo();yt.CancelToken=vl();yt.isCancel=Ea();yt.VERSION=Ba().version;yt.toFormData=ba();yt.AxiosError=gn();yt.Cancel=yt.CanceledError;yt.all=function(t){return Promise.all(t)};yt.spread=Sl();yt.isAxiosError=Cl();Ra.exports=yt;Ra.exports.default=yt});var Ol=ue((B1,kl)=>{kl.exports=Rl()});var hg={};ja(hg,{APTOS_PATH_REGEX:()=>Ru,Account:()=>vt,AccountAddress:()=>D,AccountAuthenticatorVariant:()=>li,AddressInvalidReason:()=>lc,AnyPublicKeyVariant:()=>di,AnySignatureVariant:()=>pi,Aptos:()=>Ct,AptosApiError:()=>Kt,AptosConfig:()=>Bo,AuthenticationKey:()=>Xt,Bool:()=>Ve,DeriveScheme:()=>Za,Deserializer:()=>sn,Ed25519PrivateKey:()=>pr,Ed25519PublicKey:()=>Oe,Ed25519Signature:()=>qe,EntryFunctionBytes:()=>an,FixedBytes:()=>Cr,Hex:()=>te,HexInvalidReason:()=>uc,KeyType:()=>na,MimeType:()=>Qo,MoveAbility:()=>Ya,MoveFunctionVisibility:()=>Wa,MoveObject:()=>ho,MoveOption:()=>At,MoveString:()=>lt,MoveVector:()=>Pe,MultiEd25519PublicKey:()=>ht,MultiEd25519Signature:()=>gr,Network:()=>Yo,NetworkToChainId:()=>Xo,NetworkToFaucetAPI:()=>xi,NetworkToIndexerAPI:()=>Wo,NetworkToNodeAPI:()=>yi,ParsingError:()=>ft,PrivateKey:()=>cn,PublicKey:()=>Dt,RoleType:()=>Xa,ScriptTransactionArgumentVariants:()=>On,Secp256k1PrivateKey:()=>Or,Secp256k1PublicKey:()=>Tt,Secp256k1Signature:()=>kt,Serializable:()=>ae,Serializer:()=>Ht,Signature:()=>qt,SigningScheme:()=>Pn,SigningSchemeInput:()=>gi,StructTag:()=>St,TransactionAuthenticatorVariant:()=>fi,TransactionPayloadVariants:()=>ci,TransactionResponseType:()=>hi,TransactionVariants:()=>ui,TypeTag:()=>Xe,TypeTagAddress:()=>Fr,TypeTagBool:()=>yn,TypeTagParser:()=>ro,TypeTagParserError:()=>Fs,TypeTagSigner:()=>to,TypeTagStruct:()=>tr,TypeTagU128:()=>wn,TypeTagU16:()=>mn,TypeTagU256:()=>_n,TypeTagU32:()=>bn,TypeTagU64:()=>An,TypeTagU8:()=>xn,TypeTagVariants:()=>ai,TypeTagVector:()=>Tn,U128:()=>Qt,U16:()=>jt,U256:()=>Wt,U32:()=>Vt,U64:()=>ct,U8:()=>It,aptosRequest:()=>uo,derivePrivateKeyFromMnemonic:()=>oa,ensureBoolean:()=>ss,get:()=>ic,getAptosFullNode:()=>pt,isValidPath:()=>Pu,objectStructTag:()=>sg,optionStructTag:()=>og,outOfRangeErrorMessage:()=>fc,paginateWithCursor:()=>en,post:()=>Jo,postAptosFaucet:()=>Ai,postAptosFullNode:()=>tn,postAptosIndexer:()=>bi,request:()=>Ja,stringStructTag:()=>ql,validateNumberInRange:()=>lr});var Kt=class extends Error{constructor(e,n,o){super(o);this.name="AptosApiError",this.url=n.url,this.status=n.status,this.statusText=n.statusText,this.data=n.data,this.request=e}};var Qa="2.0.0";var Qo=(n=>(n.JSON="application/json",n.BCS="application/x-bcs",n.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",n))(Qo||{}),ai=(y=>(y[y.Bool=0]="Bool",y[y.U8=1]="U8",y[y.U64=2]="U64",y[y.U128=3]="U128",y[y.Address=4]="Address",y[y.Signer=5]="Signer",y[y.Vector=6]="Vector",y[y.Struct=7]="Struct",y[y.U16=8]="U16",y[y.U32=9]="U32",y[y.U256=10]="U256",y))(ai||{}),On=(h=>(h[h.U8=0]="U8",h[h.U64=1]="U64",h[h.U128=2]="U128",h[h.Address=3]="Address",h[h.U8Vector=4]="U8Vector",h[h.Bool=5]="Bool",h[h.U16=6]="U16",h[h.U32=7]="U32",h[h.U256=8]="U256",h))(On||{}),ci=(n=>(n[n.Script=0]="Script",n[n.EntryFunction=2]="EntryFunction",n[n.Multisig=3]="Multisig",n))(ci||{}),ui=(e=>(e[e.MultiAgentTransaction=0]="MultiAgentTransaction",e[e.FeePayerTransaction=1]="FeePayerTransaction",e))(ui||{}),fi=(i=>(i[i.Ed25519=0]="Ed25519",i[i.MultiEd25519=1]="MultiEd25519",i[i.MultiAgent=2]="MultiAgent",i[i.FeePayer=3]="FeePayer",i[i.SingleSenderTransactionAuthenticator=4]="SingleSenderTransactionAuthenticator",i))(fi||{}),li=(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(li||{}),di=(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1=1]="Secp256k1",e))(di||{}),pi=(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1=1]="Secp256k1",e))(pi||{}),hi=(i=>(i.Pending="pending_transaction",i.User="user_transaction",i.Genesis="genesis_transaction",i.BlockMetadata="block_metadata_transaction",i.StateCheckpoint="state_checkpoint_transaction",i))(hi||{}),Wa=(n=>(n.PRIVATE="private",n.PUBLIC="public",n.FRIEND="friend",n))(Wa||{}),Ya=(o=>(o.STORE="store",o.DROP="drop",o.KEY="key",o.COPY="copy",o))(Ya||{}),Xa=(e=>(e.VALIDATOR="validator",e.FULL_NODE="full_node",e))(Xa||{}),Pn=(n=>(n[n.Ed25519=0]="Ed25519",n[n.MultiEd25519=1]="MultiEd25519",n[n.SingleKey=2]="SingleKey",n))(Pn||{}),gi=(n=>(n[n.Ed25519=0]="Ed25519",n[n.MultiEd25519=1]="MultiEd25519",n[n.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",n))(gi||{}),Za=(i=>(i[i.DeriveAuid=251]="DeriveAuid",i[i.DeriveObjectAddressFromObject=252]="DeriveObjectAddressFromObject",i[i.DeriveObjectAddressFromGuid=253]="DeriveObjectAddressFromGuid",i[i.DeriveObjectAddressFromSeed=254]="DeriveObjectAddressFromSeed",i[i.DeriveResourceAccountAddress=255]="DeriveResourceAccountAddress",i))(Za||{});var _d={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",429:"Too Many Requests",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable"};async function Ja(r,t){let{url:e,method:n,body:o,contentType:i,params:a,overrides:u}=r,d={...u==null?void 0:u.HEADERS,"x-aptos-client":`aptos-ts-sdk/${Qa}`,"content-type":i!=null?i:"application/json"};return u!=null&&u.TOKEN&&(d.Authorization=`Bearer ${u==null?void 0:u.TOKEN}`),t.provider({url:e,method:n,body:o,params:a,headers:d,overrides:u})}async function uo(r,t){var d;let{url:e,path:n}=r,o=`${e}/${n!=null?n:""}`,i=await Ja({...r,url:o},t.client),a={status:i.status,statusText:i.statusText,data:i.data,headers:i.headers,config:i.config,request:i.request,url:o};if(t.isIndexerRequest(e)){let h=a.data;if(h.errors)throw new Kt(r,a,(d=h.errors[0].message)!=null?d:`Unhandled Error ${i.status} : ${i.statusText}`);a.data=h.data}if(a.status>=200&&a.status<300)return a;let u=_d[a.status];throw new Kt(r,a,u!=null?u:`Unhandled Error ${i.status} : ${i.statusText}`)}var Wo={mainnet:"https://indexer.mainnet.aptoslabs.com/v1/graphql",testnet:"https://indexer-testnet.staging.gcp.aptosdev.com/v1/graphql",devnet:"https://indexer-devnet.staging.gcp.aptosdev.com/v1/graphql",local:"http://127.0.0.1:8090/v1/graphql"},yi={mainnet:"https://fullnode.mainnet.aptoslabs.com/v1",testnet:"https://fullnode.testnet.aptoslabs.com/v1",devnet:"https://fullnode.devnet.aptoslabs.com/v1",local:"http://127.0.0.1:8080/v1"},xi={mainnet:"https://faucet.mainnet.aptoslabs.com",testnet:"https://faucet.testnet.aptoslabs.com",devnet:"https://faucet.devnet.aptoslabs.com",local:"http://127.0.0.1:8081"},Yo=(i=>(i.MAINNET="mainnet",i.TESTNET="testnet",i.DEVNET="devnet",i.LOCAL="local",i.CUSTOM="custom",i))(Yo||{}),Xo={mainnet:1,testnet:2};var ec="devnet",tc=2e5,rc=20,Zo=20,nc="0x1::aptos_coin::AptosCoin",oc="APTOS::RawTransaction",mi="APTOS::RawTransactionWithData";async function ic(r){let{aptosConfig:t,overrides:e,params:n,contentType:o,acceptType:i,path:a,originMethod:u,type:d}=r,h=t.getRequestUrl(d);return uo({url:h,method:"GET",originMethod:u,path:a,contentType:o==null?void 0:o.valueOf(),acceptType:i==null?void 0:i.valueOf(),params:n,overrides:{...t.clientConfig,...e}},t)}async function pt(r){return ic({...r,type:0})}async function en(r){let t=[],e,n=r.params;for(;;){n.start=e;let o=await pt({aptosConfig:r.aptosConfig,originMethod:r.originMethod,path:r.path,params:n,overrides:r.overrides});if(e=o.headers["x-aptos-cursor"],delete o.headers,t.push(...o.data),e==null)break}return t}async function Jo(r){let{type:t,originMethod:e,path:n,body:o,acceptType:i,contentType:a,params:u,aptosConfig:d,overrides:h}=r,x=d.getRequestUrl(t);return uo({url:x,method:"POST",originMethod:e,path:n,body:o,contentType:a==null?void 0:a.valueOf(),acceptType:i==null?void 0:i.valueOf(),params:u,overrides:{...d.clientConfig,...h}},d)}async function tn(r){return Jo({...r,type:0})}async function bi(r){return Jo({...r,type:1})}async function Ai(r){return Jo({...r,type:2})}var Td={node:void 0,web:typeof self=="object"&&"crypto"in self?self.crypto:void 0};var ac=r=>new Uint32Array(r.buffer,r.byteOffset,Math.floor(r.byteLength/4)),es=r=>new DataView(r.buffer,r.byteOffset,r.byteLength);var vd=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!vd)throw new Error("Non little-endian hardware is not supported");var Ed=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function fo(r){if(!(r instanceof Uint8Array))throw new Error("Uint8Array expected");let t="";for(let e=0;e<r.length;e++)t+=Ed[r[e]];return t}function ts(r){if(typeof r!="string")throw new TypeError("hexToBytes: expected string, got "+typeof r);if(r.length%2)throw new Error("hexToBytes: received invalid unpadded hex");let t=new Uint8Array(r.length/2);for(let e=0;e<t.length;e++){let n=e*2,o=r.slice(n,n+2),i=Number.parseInt(o,16);if(Number.isNaN(i)||i<0)throw new Error("Invalid byte sequence");t[e]=i}return t}function Sd(r){if(typeof r!="string")throw new TypeError(`utf8ToBytes expected string, got ${typeof r}`);return new TextEncoder().encode(r)}function Sr(r){if(typeof r=="string"&&(r=Sd(r)),!(r instanceof Uint8Array))throw new TypeError(`Expected input type is Uint8Array (got ${typeof r})`);return r}var Er=class{clone(){return this._cloneInto()}};function zn(r){let t=n=>r().update(Sr(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function cc(r){let t=(n,o)=>r(o).update(Sr(n)).digest(),e=r({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=n=>r(n),t}var rs=2**8-1,ns=2**16-1,fr=2**32-1,rn=BigInt(2)**BigInt(64)-BigInt(1),lo=BigInt(2)**BigInt(128)-BigInt(1),os=BigInt(2)**BigInt(256)-BigInt(1);var ft=class extends Error{constructor(e,n){super(e);this.invalidReason=n}};var uc=(n=>(n.TOO_SHORT="too_short",n.INVALID_LENGTH="invalid_length",n.INVALID_HEX_CHARS="invalid_hex_chars",n))(uc||{}),te=class{constructor(t){this.data=t}toUint8Array(){return this.data}toStringWithoutPrefix(){return fo(this.data)}toString(){return`0x${this.toStringWithoutPrefix()}`}static fromString(t){let e=t;if(e.startsWith("0x")&&(e=e.slice(2)),e.length===0)throw new ft("Hex string is too short, must be at least 1 char long, excluding the optional leading 0x.","too_short");if(e.length%2!==0)throw new ft("Hex string must be an even number of hex characters.","invalid_length");try{return new te(ts(e))}catch(n){let o=n;throw new ft(`Hex string contains invalid hex characters: ${o.message}`,"invalid_hex_chars")}}static fromHexInput(t){return t instanceof Uint8Array?new te(t):te.fromString(t)}static isValid(t){try{return te.fromString(t),{valid:!0}}catch(e){let n=e;return{valid:!1,invalidReason:n.invalidReason,invalidReasonMessage:n.message}}}equals(t){return this.data.length!==t.data.length?!1:this.data.every((e,n)=>e===t.data[n])}};var ae=class{bcsToBytes(){let t=new Ht;return this.serialize(t),t.toUint8Array()}bcsToHex(){let t=this.bcsToBytes();return te.fromHexInput(t)}},Ht=class{constructor(t=64){if(t<=0)throw new Error("Length needs to be greater than 0");this.buffer=new ArrayBuffer(t),this.offset=0}ensureBufferWillHandleSize(t){for(;this.buffer.byteLength<this.offset+t;){let e=new ArrayBuffer(this.buffer.byteLength*2);new Uint8Array(e).set(new Uint8Array(this.buffer)),this.buffer=e}}appendToBuffer(t){this.ensureBufferWillHandleSize(t.length),new Uint8Array(this.buffer,this.offset).set(t),this.offset+=t.length}serializeWithFunction(t,e,n){this.ensureBufferWillHandleSize(e);let o=new DataView(this.buffer,this.offset);t.apply(o,[0,n,!0]),this.offset+=e}serializeStr(t){let e=new TextEncoder;this.serializeBytes(e.encode(t))}serializeBytes(t){this.serializeU32AsUleb128(t.length),this.appendToBuffer(t)}serializeFixedBytes(t){this.appendToBuffer(t)}serializeBool(t){ss(t);let e=t?1:0;this.appendToBuffer(new Uint8Array([e]))}serializeU8(t){this.appendToBuffer(new Uint8Array([t]))}serializeU16(t){this.serializeWithFunction(DataView.prototype.setUint16,2,t)}serializeU32(t){this.serializeWithFunction(DataView.prototype.setUint32,4,t)}serializeU64(t){let e=BigInt(t)&BigInt(fr),n=BigInt(t)>>BigInt(32);this.serializeU32(Number(e)),this.serializeU32(Number(n))}serializeU128(t){let e=BigInt(t)&rn,n=BigInt(t)>>BigInt(64);this.serializeU64(e),this.serializeU64(n)}serializeU256(t){let e=BigInt(t)&lo,n=BigInt(t)>>BigInt(128);this.serializeU128(e),this.serializeU128(n)}serializeU32AsUleb128(t){let e=t,n=[];for(;e>>>7!==0;)n.push(e&127|128),e>>>=7;n.push(e),this.appendToBuffer(new Uint8Array(n))}toUint8Array(){return new Uint8Array(this.buffer).slice(0,this.offset)}serialize(t){t.serialize(this)}serializeVector(t){this.serializeU32AsUleb128(t.length),t.forEach(e=>{e.serialize(this)})}};vr([nn(0,rs)],Ht.prototype,"serializeU8",1),vr([nn(0,ns)],Ht.prototype,"serializeU16",1),vr([nn(0,fr)],Ht.prototype,"serializeU32",1),vr([nn(BigInt(0),rn)],Ht.prototype,"serializeU64",1),vr([nn(BigInt(0),lo)],Ht.prototype,"serializeU128",1),vr([nn(BigInt(0),os)],Ht.prototype,"serializeU256",1),vr([nn(0,fr)],Ht.prototype,"serializeU32AsUleb128",1);function ss(r){if(typeof r!="boolean")throw new Error(`${r} is not a boolean value`)}var fc=(r,t,e)=>`${r} is out of range: [${t}, ${e}]`;function lr(r,t,e){let n=BigInt(r);if(n>BigInt(e)||n<BigInt(t))throw new Error(fc(r,t,e))}function nn(r,t){return(e,n,o)=>{let i=o.value;return o.value=function(u){return lr(u,r,t),i.apply(this,[u])},o}}var lc=(u=>(u.INCORRECT_NUMBER_OF_BYTES="incorrect_number_of_bytes",u.INVALID_HEX_CHARS="invalid_hex_chars",u.TOO_SHORT="too_short",u.TOO_LONG="too_long",u.LEADING_ZERO_X_REQUIRED="leading_zero_x_required",u.LONG_FORM_REQUIRED_UNLESS_SPECIAL="long_form_required_unless_special",u.INVALID_PADDING_ZEROES="INVALID_PADDING_ZEROES",u))(lc||{}),Ze=class extends ae{constructor(e){super();if(e.data.length!==Ze.LENGTH)throw new ft("AccountAddress data should be exactly 32 bytes long","incorrect_number_of_bytes");this.data=e.data}isSpecial(){return this.data.slice(0,this.data.length-1).every(e=>e===0)&&this.data[this.data.length-1]<16}toString(){return`0x${this.toStringWithoutPrefix()}`}toStringWithoutPrefix(){let e=fo(this.data);return this.isSpecial()&&(e=e[e.length-1]),e}toStringLong(){return`0x${this.toStringLongWithoutPrefix()}`}toStringLongWithoutPrefix(){return fo(this.data)}toUint8Array(){return this.data}serialize(e){e.serializeFixedBytes(this.data)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(3),e.serialize(this)}static deserialize(e){let n=e.deserializeFixedBytes(Ze.LENGTH);return new Ze({data:n})}static fromString(e){if(!e.startsWith("0x"))throw new ft("Hex string must start with a leading 0x.","leading_zero_x_required");let n=Ze.fromStringRelaxed(e);if(e.length!==Ze.LONG_STRING_LENGTH+2)if(n.isSpecial()){if(e.length!==3)throw new ft(`The given hex string ${e} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,"INVALID_PADDING_ZEROES")}else throw new ft(`The given hex string ${n} is not a special address, it must be represented as 0x + 64 chars.`,"long_form_required_unless_special");return n}static fromStringRelaxed(e){let n=e;if(e.startsWith("0x")&&(n=e.slice(2)),n.length===0)throw new ft("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(n.length>64)throw new ft("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.","too_long");let o;try{o=ts(n.padStart(64,"0"))}catch(i){let a=i;throw new ft(`Hex characters are invalid: ${a.message}`,"invalid_hex_chars")}return new Ze({data:o})}static fromHexInput(e){return e instanceof Uint8Array?new Ze({data:e}):Ze.fromString(e)}static fromHexInputRelaxed(e){return e instanceof Uint8Array?new Ze({data:e}):Ze.fromStringRelaxed(e)}static isValid(e){try{return e.relaxed?Ze.fromStringRelaxed(e.input):Ze.fromString(e.input),{valid:!0}}catch(n){let o=n;return{valid:!1,invalidReason:o.invalidReason,invalidReasonMessage:o.message}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((n,o)=>n===e.data[o])}},D=Ze;D.LENGTH=32,D.LONG_STRING_LENGTH=64,D.ONE=Ze.fromString("0x1"),D.TWO=Ze.fromString("0x2"),D.THREE=Ze.fromString("0x3"),D.FOUR=Ze.fromString("0x4");function wi(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`Wrong positive integer: ${r}`)}function Ud(r){if(typeof r!="boolean")throw new Error(`Expected boolean, not ${r}`)}function dc(r,...t){if(!(r instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(t.length>0&&!t.includes(r.length))throw new TypeError(`Expected Uint8Array of length ${t}, not of length=${r.length}`)}function Cd(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");wi(r.outputLen),wi(r.blockLen)}function Bd(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function Id(r,t){dc(r);let e=t.outputLen;if(r.length<e)throw new Error(`digestInto() expects output buffer of length at least ${e}`)}var Rd={number:wi,bool:Ud,bytes:dc,hash:Cd,exists:Bd,output:Id},at=Rd;var is=BigInt(4294967295),_i=BigInt(32);function pc(r,t=!1){return t?{h:Number(r&is),l:Number(r>>_i&is)}:{h:Number(r>>_i&is)|0,l:Number(r&is)|0}}function kd(r,t=!1){let e=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let o=0;o<r.length;o++){let{h:i,l:a}=pc(r[o],t);[e[o],n[o]]=[i,a]}return[e,n]}var Od=(r,t)=>BigInt(r>>>0)<<_i|BigInt(t>>>0),Pd=(r,t,e)=>r>>>e,zd=(r,t,e)=>r<<32-e|t>>>e,Hd=(r,t,e)=>r>>>e|t<<32-e,Dd=(r,t,e)=>r<<32-e|t>>>e,qd=(r,t,e)=>r<<64-e|t>>>e-32,Nd=(r,t,e)=>r>>>e-32|t<<64-e,Md=(r,t)=>t,Gd=(r,t)=>r,Ld=(r,t,e)=>r<<e|t>>>32-e,Fd=(r,t,e)=>t<<e|r>>>32-e,$d=(r,t,e)=>t<<e-32|r>>>64-e,Kd=(r,t,e)=>r<<e-32|t>>>64-e;function jd(r,t,e,n){let o=(t>>>0)+(n>>>0);return{h:r+e+(o/2**32|0)|0,l:o|0}}var Vd=(r,t,e)=>(r>>>0)+(t>>>0)+(e>>>0),Qd=(r,t,e,n)=>t+e+n+(r/2**32|0)|0,Wd=(r,t,e,n)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0),Yd=(r,t,e,n,o)=>t+e+n+o+(r/2**32|0)|0,Xd=(r,t,e,n,o)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(o>>>0),Zd=(r,t,e,n,o,i)=>t+e+n+o+i+(r/2**32|0)|0,Jd={fromBig:pc,split:kd,toBig:Od,shrSH:Pd,shrSL:zd,rotrSH:Hd,rotrSL:Dd,rotrBH:qd,rotrBL:Nd,rotr32H:Md,rotr32L:Gd,rotlSH:Ld,rotlSL:Fd,rotlBH:$d,rotlBL:Kd,add:jd,add3L:Vd,add3H:Qd,add4L:Wd,add4H:Yd,add5H:Zd,add5L:Xd},ne=Jd;var[yc,xc,mc]=[[],[],[]],ep=BigInt(0),po=BigInt(1),tp=BigInt(2),rp=BigInt(7),np=BigInt(256),op=BigInt(113);for(let r=0,t=po,e=1,n=0;r<24;r++){[e,n]=[n,(2*e+3*n)%5],yc.push(2*(5*n+e)),xc.push((r+1)*(r+2)/2%64);let o=ep;for(let i=0;i<7;i++)t=(t<<po^(t>>rp)*op)%np,t&tp&&(o^=po<<(po<<BigInt(i))-po);mc.push(o)}var[sp,ip]=ne.split(mc,!0),hc=(r,t,e)=>e>32?ne.rotlBH(r,t,e):ne.rotlSH(r,t,e),gc=(r,t,e)=>e>32?ne.rotlBL(r,t,e):ne.rotlSL(r,t,e);function ap(r,t=24){let e=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let a=0;a<10;a++)e[a]=r[a]^r[a+10]^r[a+20]^r[a+30]^r[a+40];for(let a=0;a<10;a+=2){let u=(a+8)%10,d=(a+2)%10,h=e[d],x=e[d+1],y=hc(h,x,1)^e[u],T=gc(h,x,1)^e[u+1];for(let E=0;E<50;E+=10)r[a+E]^=y,r[a+E+1]^=T}let o=r[2],i=r[3];for(let a=0;a<24;a++){let u=xc[a],d=hc(o,i,u),h=gc(o,i,u),x=yc[a];o=r[x],i=r[x+1],r[x]=d,r[x+1]=h}for(let a=0;a<50;a+=10){for(let u=0;u<10;u++)e[u]=r[a+u];for(let u=0;u<10;u++)r[a+u]^=~e[(u+2)%10]&e[(u+4)%10]}r[0]^=sp[n],r[1]^=ip[n]}e.fill(0)}var Hn=class extends Er{constructor(t,e,n,o=!1,i=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=o,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,at.number(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=ac(this.state)}keccak(){ap(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){at.exists(this);let{blockLen:e,state:n}=this;t=Sr(t);let o=t.length;for(let i=0;i<o;){let a=Math.min(e-this.pos,o-i);for(let u=0;u<a;u++)n[this.pos++]^=t[i++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:e,pos:n,blockLen:o}=this;t[n]^=e,(e&128)!==0&&n===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){at.exists(this,!1),at.bytes(t),this.finish();let e=this.state,{blockLen:n}=this;for(let o=0,i=t.length;o<i;){this.posOut>=n&&this.keccak();let a=Math.min(n-this.posOut,i-o);t.set(e.subarray(this.posOut,this.posOut+a),o),this.posOut+=a,o+=a}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return at.number(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(at.output(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){let{blockLen:e,suffix:n,outputLen:o,rounds:i,enableXOF:a}=this;return t||(t=new Hn(e,n,o,a,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=n,t.outputLen=o,t.enableXOF=a,t.destroyed=this.destroyed,t}},Ur=(r,t,e)=>zn(()=>new Hn(t,r,e)),yy=Ur(6,144,224/8),on=Ur(6,136,256/8),xy=Ur(6,104,384/8),my=Ur(6,72,512/8),by=Ur(1,144,224/8),Ay=Ur(1,136,256/8),wy=Ur(1,104,384/8),_y=Ur(1,72,512/8),bc=(r,t,e)=>cc((n={})=>new Hn(t,r,n.dkLen===void 0?e:n.dkLen,!0)),Ty=bc(31,168,128/8),vy=bc(31,136,256/8);var go=ii(wc());var sn=class{constructor(t){this.buffer=new ArrayBuffer(t.length),new Uint8Array(this.buffer).set(t,0),this.offset=0}read(t){if(this.offset+t>this.buffer.byteLength)throw new Error("Reached to the end of buffer");let e=this.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e}deserializeStr(){let t=this.deserializeBytes();return new TextDecoder().decode(t)}deserializeBytes(){let t=this.deserializeUleb128AsU32();return new Uint8Array(this.read(t))}deserializeFixedBytes(t){return new Uint8Array(this.read(t))}deserializeBool(){let t=new Uint8Array(this.read(1))[0];if(t!==1&&t!==0)throw new Error("Invalid boolean value");return t===1}deserializeU8(){return new DataView(this.read(1)).getUint8(0)}deserializeU16(){return new DataView(this.read(2)).getUint16(0,!0)}deserializeU32(){return new DataView(this.read(4)).getUint32(0,!0)}deserializeU64(){let t=this.deserializeU32(),e=this.deserializeU32();return BigInt(BigInt(e)<<BigInt(32)|BigInt(t))}deserializeU128(){let t=this.deserializeU64(),e=this.deserializeU64();return BigInt(e<<BigInt(64)|t)}deserializeU256(){let t=this.deserializeU128(),e=this.deserializeU128();return BigInt(e<<BigInt(128)|t)}deserializeUleb128AsU32(){let t=BigInt(0),e=0;for(;t<fr;){let n=this.deserializeU8();if(t|=BigInt(n&127)<<BigInt(e),(n&128)===0)break;e+=7}if(t>fr)throw new Error("Overflow while parsing uleb128-encoded uint32 value");return Number(t)}deserialize(t){return t.deserialize(this)}deserializeVector(t){let e=this.deserializeUleb128AsU32(),n=new Array;for(let o=0;o<e;o+=1)n.push(this.deserialize(t));return n}};var Cr=class extends ae{constructor(e){super();this.value=te.fromHexInput(e).toUint8Array()}serialize(e){e.serializeFixedBytes(this.value)}serializeForEntryFunction(e){e.serialize(this)}serializeForScriptFunction(e){e.serialize(this)}static deserialize(e,n){let o=e.deserializeFixedBytes(n);return new Cr(o)}};var an=class extends ae{constructor(e){super();this.value=new Cr(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,n){let o=Cr.deserialize(e,n);return new an(o.value)}};var Ve=class extends ae{constructor(e){super();ss(e),this.value=e}serialize(e){e.serializeBool(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(5),e.serialize(this)}static deserialize(e){return new Ve(e.deserializeBool())}},It=class extends ae{constructor(e){super();lr(e,0,rs),this.value=e}serialize(e){e.serializeU8(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(0),e.serialize(this)}static deserialize(e){return new It(e.deserializeU8())}},jt=class extends ae{constructor(e){super();lr(e,0,ns),this.value=e}serialize(e){e.serializeU16(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(6),e.serialize(this)}static deserialize(e){return new jt(e.deserializeU16())}},Vt=class extends ae{constructor(e){super();lr(e,0,fr),this.value=e}serialize(e){e.serializeU32(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(7),e.serialize(this)}static deserialize(e){return new Vt(e.deserializeU32())}},ct=class extends ae{constructor(e){super();lr(e,BigInt(0),rn),this.value=BigInt(e)}serialize(e){e.serializeU64(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(1),e.serialize(this)}static deserialize(e){return new ct(e.deserializeU64())}},Qt=class extends ae{constructor(e){super();lr(e,BigInt(0),lo),this.value=BigInt(e)}serialize(e){e.serializeU128(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(2),e.serialize(this)}static deserialize(e){return new Qt(e.deserializeU128())}},Wt=class extends ae{constructor(e){super();lr(e,BigInt(0),os),this.value=BigInt(e)}serialize(e){e.serializeU256(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(8),e.serialize(this)}static deserialize(e){return new Wt(e.deserializeU256())}};var Pe=class extends ae{constructor(e){super();this.values=e}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){if(!(this.values[0]instanceof It))throw new Error("Script function arguments only accept u8 vectors");e.serializeU32AsUleb128(4),e.serialize(this)}static U8(e){let n;if(Array.isArray(e)&&typeof e[0]=="number")n=e;else if(typeof e=="string"){let o=te.fromHexInput(e);n=Array.from(o.toUint8Array())}else if(e instanceof Uint8Array)n=Array.from(e);else throw new Error("Invalid input type");return new Pe(n.map(o=>new It(o)))}static U16(e){return new Pe(e.map(n=>new jt(n)))}static U32(e){return new Pe(e.map(n=>new Vt(n)))}static U64(e){return new Pe(e.map(n=>new ct(n)))}static U128(e){return new Pe(e.map(n=>new Qt(n)))}static U256(e){return new Pe(e.map(n=>new Wt(n)))}static Bool(e){return new Pe(e.map(n=>new Ve(n)))}static MoveString(e){return new Pe(e.map(n=>new lt(n)))}serialize(e){e.serializeVector(this.values)}static deserialize(e,n){let o=e.deserializeUleb128AsU32(),i=new Array;for(let a=0;a<o;a+=1)i.push(n.deserialize(e));return new Pe(i)}},lt=class extends ae{constructor(e){super();this.value=e}serialize(e){e.serializeStr(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){Pe.U8(this.bcsToBytes()).serializeForScriptFunction(e)}static deserialize(e){return new lt(e.deserializeStr())}},At=class extends ae{constructor(e){super();typeof e!="undefined"&&e!==null?this.vec=new Pe([e]):this.vec=new Pe([]),[this.value]=this.vec.values}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}unwrap(){if(this.isSome())return this.vec.values[0];throw new Error("Called unwrap on a MoveOption with no value")}isSome(){return this.vec.values.length===1}serialize(e){this.vec.serialize(e)}static U8(e){return new At(e!=null?new It(e):void 0)}static U16(e){return new At(e!=null?new jt(e):void 0)}static U32(e){return new At(e!=null?new Vt(e):void 0)}static U64(e){return new At(e!=null?new ct(e):void 0)}static U128(e){return new At(e!=null?new Qt(e):void 0)}static U256(e){return new At(e!=null?new Wt(e):void 0)}static Bool(e){return new At(e!=null?new Ve(e):void 0)}static MoveString(e){return new At(e!=null?new lt(e):void 0)}static deserialize(e,n){let o=Pe.deserialize(e,n);return new At(o.values[0])}},ho=class extends ae{constructor(e){super();e instanceof D?this.value=e:this.value=D.fromHexInputRelaxed(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){this.value.serializeForEntryFunction(e)}serializeForScriptFunction(e){this.value.serializeForScriptFunction(e)}static deserialize(e){let n=e.deserialize(D);return new ho(n)}};var Dt=class extends ae{},cn=class extends ae{},qt=class extends ae{};var Dn=class extends Dt{constructor(e){super();let n=te.fromHexInput(e);if(n.toUint8Array().length!==Dn.LENGTH)throw new Error(`PublicKey length should be ${Dn.LENGTH}`);this.key=n}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(e){let{message:n,signature:o}=e,i=te.fromHexInput(n).toUint8Array(),a=te.fromHexInput(o.toUint8Array()).toUint8Array();return go.default.sign.detached.verify(i,a,this.key.toUint8Array())}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new Dn(n)}static load(e){let n=e.deserializeBytes();return new Dn(n)}},Oe=Dn;Oe.LENGTH=32;var dr=class extends cn{constructor(e){super();let n=te.fromHexInput(e);if(n.toUint8Array().length!==dr.LENGTH)throw new Error(`PrivateKey length should be ${dr.LENGTH}`);this.signingKeyPair=go.default.sign.keyPair.fromSeed(n.toUint8Array().slice(0,dr.LENGTH))}toUint8Array(){return this.signingKeyPair.secretKey.slice(0,dr.LENGTH)}toString(){return te.fromHexInput(this.toUint8Array()).toString()}sign(e){let n=te.fromHexInput(e),o=go.default.sign.detached(n.toUint8Array(),this.signingKeyPair.secretKey);return new qe(o)}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new dr(n)}static generate(){let e=go.default.sign.keyPair();return new dr(e.secretKey.slice(0,dr.LENGTH))}publicKey(){let e=this.signingKeyPair.publicKey;return new Oe(e)}},pr=dr;pr.LENGTH=32;var qn=class extends qt{constructor(e){super();let n=te.fromHexInput(e);if(n.toUint8Array().length!==qn.LENGTH)throw new Error(`Signature length should be ${qn.LENGTH}`);this.data=n}toUint8Array(){return this.data.toUint8Array()}toString(){return this.data.toString()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new qn(n)}static load(e){let n=e.deserializeBytes();return new qn(n)}},qe=qn;qe.LENGTH=64;var hr=class extends Dt{constructor(e){super();let{publicKeys:n,threshold:o}=e;if(n.length>hr.MAX_KEYS||n.length<hr.MIN_KEYS)throw new Error(`Must have between ${hr.MIN_KEYS} and ${hr.MAX_KEYS} public keys, inclusive`);if(o<hr.MIN_THRESHOLD||o>n.length)throw new Error(`Threshold must be between ${hr.MIN_THRESHOLD} and ${n.length}, inclusive`);this.publicKeys=n,this.threshold=o}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*Oe.LENGTH+1);return this.publicKeys.forEach((n,o)=>{e.set(n.toUint8Array(),o*Oe.LENGTH)}),e[this.publicKeys.length*Oe.LENGTH]=this.threshold,e}toString(){return te.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("TODO - Method not implemented.")}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let n=e.deserializeBytes(),o=n[n.length-1],i=[];for(let a=0;a<n.length-1;a+=Oe.LENGTH){let u=a;i.push(new Oe(n.subarray(u,u+Oe.LENGTH)))}return new hr({publicKeys:i,threshold:o})}},ht=hr;ht.MAX_KEYS=32,ht.MIN_KEYS=2,ht.MIN_THRESHOLD=1;var Yt=class extends qt{constructor(e){super();let{signatures:n,bitmap:o}=e;if(o.length!==Yt.BITMAP_LEN)throw new Error(`"bitmap" length should be ${Yt.BITMAP_LEN}`);if(n.length>Yt.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${Yt.MAX_SIGNATURES_SUPPORTED}`);this.signatures=n,this.bitmap=o}toUint8Array(){let e=new Uint8Array(this.signatures.length*qe.LENGTH+Yt.BITMAP_LEN);return this.signatures.forEach((n,o)=>{e.set(n.toUint8Array(),o*qe.LENGTH)}),e.set(this.bitmap,this.signatures.length*qe.LENGTH),e}toString(){return te.fromHexInput(this.toUint8Array()).toString()}static createBitmap(e){let{bits:n}=e,o=128,i=new Uint8Array([0,0,0,0]),a=new Set;return n.forEach(u=>{if(u>=Yt.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${Yt.MAX_SIGNATURES_SUPPORTED-1}.`);if(a.has(u))throw new Error("Duplicate bits detected.");a.add(u);let d=Math.floor(u/8),h=i[d];h|=o>>u%8,i[d]=h}),i}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let n=e.deserializeBytes(),o=n.subarray(n.length-4),i=[];for(let a=0;a<n.length-o.length;a+=qe.LENGTH){let u=a;i.push(new qe(n.subarray(u,u+qe.LENGTH)))}return new Yt({signatures:i,bitmap:o})}},gr=Yt;gr.MAX_SIGNATURES_SUPPORTED=32,gr.BITMAP_LEN=4;function _c(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`Wrong positive integer: ${r}`)}function Ti(r,...t){if(!(r instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(r.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${r.length}`)}function Tc(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");_c(r.outputLen),_c(r.blockLen)}function Nn(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function vc(r,t){Ti(r);let e=t.outputLen;if(r.length<e)throw new Error(`digestInto() expects output buffer of length at least ${e}`)}var cs=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var Ec=r=>r instanceof Uint8Array;var us=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),Nt=(r,t)=>r<<32-t|r>>>t,cp=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!cp)throw new Error("Non little-endian hardware is not supported");function up(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function yo(r){if(typeof r=="string"&&(r=up(r)),!Ec(r))throw new Error(`expected Uint8Array, got ${typeof r}`);return r}function Sc(...r){let t=new Uint8Array(r.reduce((n,o)=>n+o.length,0)),e=0;return r.forEach(n=>{if(!Ec(n))throw new Error("Uint8Array expected");t.set(n,e),e+=n.length}),t}var Mn=class{clone(){return this._cloneInto()}},vx={}.toString;function Uc(r){let t=n=>r().update(yo(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function Cc(r=32){if(cs&&typeof cs.getRandomValues=="function")return cs.getRandomValues(new Uint8Array(r));throw new Error("crypto.getRandomValues must be defined")}function fp(r,t,e,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(t,e,n);let o=BigInt(32),i=BigInt(4294967295),a=Number(e>>o&i),u=Number(e&i),d=n?4:0,h=n?0:4;r.setUint32(t+d,a,n),r.setUint32(t+h,u,n)}var fs=class extends Mn{constructor(t,e,n,o){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=us(this.buffer)}update(t){Nn(this);let{view:e,buffer:n,blockLen:o}=this;t=yo(t);let i=t.length;for(let a=0;a<i;){let u=Math.min(o-this.pos,i-a);if(u===o){let d=us(t);for(;o<=i-a;a+=o)this.process(d,a);continue}n.set(t.subarray(a,a+u),this.pos),this.pos+=u,a+=u,this.pos===o&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Nn(this),vc(t,this),this.finished=!0;let{buffer:e,view:n,blockLen:o,isLE:i}=this,{pos:a}=this;e[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>o-a&&(this.process(n,0),a=0);for(let y=a;y<o;y++)e[y]=0;fp(n,o-8,BigInt(this.length*8),i),this.process(n,0);let u=us(t),d=this.outputLen;if(d%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let h=d/4,x=this.get();if(h>x.length)throw new Error("_sha2: outputLen bigger than state");for(let y=0;y<h;y++)u.setUint32(4*y,x[y],i)}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:e,buffer:n,length:o,finished:i,destroyed:a,pos:u}=this;return t.length=o,t.pos=u,t.finished=i,t.destroyed=a,o%e&&t.buffer.set(n),t}};var lp=(r,t,e)=>r&t^~r&e,dp=(r,t,e)=>r&t^r&e^t&e,pp=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Br=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ir=new Uint32Array(64),vi=class extends fs{constructor(){super(64,32,8,!1),this.A=Br[0]|0,this.B=Br[1]|0,this.C=Br[2]|0,this.D=Br[3]|0,this.E=Br[4]|0,this.F=Br[5]|0,this.G=Br[6]|0,this.H=Br[7]|0}get(){let{A:t,B:e,C:n,D:o,E:i,F:a,G:u,H:d}=this;return[t,e,n,o,i,a,u,d]}set(t,e,n,o,i,a,u,d){this.A=t|0,this.B=e|0,this.C=n|0,this.D=o|0,this.E=i|0,this.F=a|0,this.G=u|0,this.H=d|0}process(t,e){for(let y=0;y<16;y++,e+=4)Ir[y]=t.getUint32(e,!1);for(let y=16;y<64;y++){let T=Ir[y-15],E=Ir[y-2],I=Nt(T,7)^Nt(T,18)^T>>>3,A=Nt(E,17)^Nt(E,19)^E>>>10;Ir[y]=A+Ir[y-7]+I+Ir[y-16]|0}let{A:n,B:o,C:i,D:a,E:u,F:d,G:h,H:x}=this;for(let y=0;y<64;y++){let T=Nt(u,6)^Nt(u,11)^Nt(u,25),E=x+T+lp(u,d,h)+pp[y]+Ir[y]|0,A=(Nt(n,2)^Nt(n,13)^Nt(n,22))+dp(n,o,i)|0;x=h,h=d,d=u,u=a+E|0,a=i,i=o,o=n,n=E+A|0}n=n+this.A|0,o=o+this.B|0,i=i+this.C|0,a=a+this.D|0,u=u+this.E|0,d=d+this.F|0,h=h+this.G|0,x=x+this.H|0,this.set(n,o,i,a,u,d,h,x)}roundClean(){Ir.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var Bc=Uc(()=>new vi);var Ci={};ja(Ci,{bitGet:()=>Ap,bitLen:()=>bp,bitMask:()=>xo,bitSet:()=>wp,bytesToHex:()=>un,bytesToNumberBE:()=>yr,bytesToNumberLE:()=>ps,concatBytes:()=>Gn,createHmacDrbg:()=>Ui,ensureBytes:()=>wt,equalBytes:()=>xp,hexToBytes:()=>fn,hexToNumber:()=>Si,numberToBytesBE:()=>Rr,numberToBytesLE:()=>hs,numberToHexUnpadded:()=>kc,numberToVarBytesBE:()=>yp,utf8ToBytes:()=>mp,validateObject:()=>kr});var Rc=BigInt(0),ls=BigInt(1),hp=BigInt(2),ds=r=>r instanceof Uint8Array,gp=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function un(r){if(!ds(r))throw new Error("Uint8Array expected");let t="";for(let e=0;e<r.length;e++)t+=gp[r[e]];return t}function kc(r){let t=r.toString(16);return t.length&1?`0${t}`:t}function Si(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);return BigInt(r===""?"0":`0x${r}`)}function fn(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);let t=r.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);let e=new Uint8Array(t/2);for(let n=0;n<e.length;n++){let o=n*2,i=r.slice(o,o+2),a=Number.parseInt(i,16);if(Number.isNaN(a)||a<0)throw new Error("Invalid byte sequence");e[n]=a}return e}function yr(r){return Si(un(r))}function ps(r){if(!ds(r))throw new Error("Uint8Array expected");return Si(un(Uint8Array.from(r).reverse()))}function Rr(r,t){return fn(r.toString(16).padStart(t*2,"0"))}function hs(r,t){return Rr(r,t).reverse()}function yp(r){return fn(kc(r))}function wt(r,t,e){let n;if(typeof t=="string")try{n=fn(t)}catch(i){throw new Error(`${r} must be valid hex string, got "${t}". Cause: ${i}`)}else if(ds(t))n=Uint8Array.from(t);else throw new Error(`${r} must be hex string or Uint8Array`);let o=n.length;if(typeof e=="number"&&o!==e)throw new Error(`${r} expected ${e} bytes, got ${o}`);return n}function Gn(...r){let t=new Uint8Array(r.reduce((n,o)=>n+o.length,0)),e=0;return r.forEach(n=>{if(!ds(n))throw new Error("Uint8Array expected");t.set(n,e),e+=n.length}),t}function xp(r,t){if(r.length!==t.length)return!1;for(let e=0;e<r.length;e++)if(r[e]!==t[e])return!1;return!0}function mp(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function bp(r){let t;for(t=0;r>Rc;r>>=ls,t+=1);return t}function Ap(r,t){return r>>BigInt(t)&ls}var wp=(r,t,e)=>r|(e?ls:Rc)<<BigInt(t),xo=r=>(hp<<BigInt(r-1))-ls,Ei=r=>new Uint8Array(r),Ic=r=>Uint8Array.from(r);function Ui(r,t,e){if(typeof r!="number"||r<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof e!="function")throw new Error("hmacFn must be a function");let n=Ei(r),o=Ei(r),i=0,a=()=>{n.fill(1),o.fill(0),i=0},u=(...y)=>e(o,n,...y),d=(y=Ei())=>{o=u(Ic([0]),y),n=u(),y.length!==0&&(o=u(Ic([1]),y),n=u())},h=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let y=0,T=[];for(;y<t;){n=u();let E=n.slice();T.push(E),y+=n.length}return Gn(...T)};return(y,T)=>{a(),d(y);let E;for(;!(E=T(h()));)d();return a(),E}}var _p={bigint:r=>typeof r=="bigint",function:r=>typeof r=="function",boolean:r=>typeof r=="boolean",string:r=>typeof r=="string",stringOrUint8Array:r=>typeof r=="string"||r instanceof Uint8Array,isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,t)=>t.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};function kr(r,t,e={}){let n=(o,i,a)=>{let u=_p[i];if(typeof u!="function")throw new Error(`Invalid validator "${i}", expected function`);let d=r[o];if(!(a&&d===void 0)&&!u(d,r))throw new Error(`Invalid param ${String(o)}=${d} (${typeof d}), expected ${i}`)};for(let[o,i]of Object.entries(t))n(o,i,!1);for(let[o,i]of Object.entries(e))n(o,i,!0);return r}var Ye=BigInt(0),Le=BigInt(1),ln=BigInt(2),Tp=BigInt(3),Bi=BigInt(4),Oc=BigInt(5),Pc=BigInt(8),vp=BigInt(9),Ep=BigInt(16);function ut(r,t){let e=r%t;return e>=Ye?e:t+e}function Sp(r,t,e){if(e<=Ye||t<Ye)throw new Error("Expected power/modulo > 0");if(e===Le)return Ye;let n=Le;for(;t>Ye;)t&Le&&(n=n*r%e),r=r*r%e,t>>=Le;return n}function _t(r,t,e){let n=r;for(;t-- >Ye;)n*=n,n%=e;return n}function gs(r,t){if(r===Ye||t<=Ye)throw new Error(`invert: expected positive integers, got n=${r} mod=${t}`);let e=ut(r,t),n=t,o=Ye,i=Le,a=Le,u=Ye;for(;e!==Ye;){let h=n/e,x=n%e,y=o-a*h,T=i-u*h;n=e,e=x,o=a,i=u,a=y,u=T}if(n!==Le)throw new Error("invert: does not exist");return ut(o,t)}function Up(r){let t=(r-Le)/ln,e,n,o;for(e=r-Le,n=0;e%ln===Ye;e/=ln,n++);for(o=ln;o<r&&Sp(o,t,r)!==r-Le;o++);if(n===1){let a=(r+Le)/Bi;return function(d,h){let x=d.pow(h,a);if(!d.eql(d.sqr(x),h))throw new Error("Cannot find square root");return x}}let i=(e+Le)/ln;return function(u,d){if(u.pow(d,t)===u.neg(u.ONE))throw new Error("Cannot find square root");let h=n,x=u.pow(u.mul(u.ONE,o),e),y=u.pow(d,i),T=u.pow(d,e);for(;!u.eql(T,u.ONE);){if(u.eql(T,u.ZERO))return u.ZERO;let E=1;for(let A=u.sqr(T);E<h&&!u.eql(A,u.ONE);E++)A=u.sqr(A);let I=u.pow(x,Le<<BigInt(h-E-1));x=u.sqr(I),y=u.mul(y,I),T=u.mul(T,x),h=E}return y}}function Cp(r){if(r%Bi===Tp){let t=(r+Le)/Bi;return function(n,o){let i=n.pow(o,t);if(!n.eql(n.sqr(i),o))throw new Error("Cannot find square root");return i}}if(r%Pc===Oc){let t=(r-Oc)/Pc;return function(n,o){let i=n.mul(o,ln),a=n.pow(i,t),u=n.mul(o,a),d=n.mul(n.mul(u,ln),a),h=n.mul(u,n.sub(d,n.ONE));if(!n.eql(n.sqr(h),o))throw new Error("Cannot find square root");return h}}return r%Ep,Up(r)}var Bp=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Ii(r){let t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},e=Bp.reduce((n,o)=>(n[o]="function",n),t);return kr(r,e)}function Ip(r,t,e){if(e<Ye)throw new Error("Expected power > 0");if(e===Ye)return r.ONE;if(e===Le)return t;let n=r.ONE,o=t;for(;e>Ye;)e&Le&&(n=r.mul(n,o)),o=r.sqr(o),e>>=Le;return n}function Rp(r,t){let e=new Array(t.length),n=t.reduce((i,a,u)=>r.is0(a)?i:(e[u]=i,r.mul(i,a)),r.ONE),o=r.inv(n);return t.reduceRight((i,a,u)=>r.is0(a)?i:(e[u]=r.mul(i,e[u]),r.mul(i,a)),o),e}function Ri(r,t){let e=t!==void 0?t:r.toString(2).length,n=Math.ceil(e/8);return{nBitLength:e,nByteLength:n}}function zc(r,t,e=!1,n={}){if(r<=Ye)throw new Error(`Expected Field ORDER > 0, got ${r}`);let{nBitLength:o,nByteLength:i}=Ri(r,t);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");let a=Cp(r),u=Object.freeze({ORDER:r,BITS:o,BYTES:i,MASK:xo(o),ZERO:Ye,ONE:Le,create:d=>ut(d,r),isValid:d=>{if(typeof d!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof d}`);return Ye<=d&&d<r},is0:d=>d===Ye,isOdd:d=>(d&Le)===Le,neg:d=>ut(-d,r),eql:(d,h)=>d===h,sqr:d=>ut(d*d,r),add:(d,h)=>ut(d+h,r),sub:(d,h)=>ut(d-h,r),mul:(d,h)=>ut(d*h,r),pow:(d,h)=>Ip(u,d,h),div:(d,h)=>ut(d*gs(h,r),r),sqrN:d=>d*d,addN:(d,h)=>d+h,subN:(d,h)=>d-h,mulN:(d,h)=>d*h,inv:d=>gs(d,r),sqrt:n.sqrt||(d=>a(u,d)),invertBatch:d=>Rp(u,d),cmov:(d,h,x)=>x?h:d,toBytes:d=>e?hs(d,i):Rr(d,i),fromBytes:d=>{if(d.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${d.length}`);return e?ps(d):yr(d)}});return Object.freeze(u)}function Hc(r){if(typeof r!="bigint")throw new Error("field order must be bigint");let t=r.toString(2).length;return Math.ceil(t/8)}function ki(r){let t=Hc(r);return t+Math.ceil(t/2)}function Dc(r,t,e=!1){let n=r.length,o=Hc(t),i=ki(t);if(n<16||n<i||n>1024)throw new Error(`expected ${i}-1024 bytes of input, got ${n}`);let a=e?yr(r):ps(r),u=ut(a,t-Le)+Le;return e?hs(u,o):Rr(u,o)}var Op=BigInt(0),Oi=BigInt(1);function qc(r,t){let e=(o,i)=>{let a=i.negate();return o?a:i},n=o=>{let i=Math.ceil(t/o)+1,a=2**(o-1);return{windows:i,windowSize:a}};return{constTimeNegate:e,unsafeLadder(o,i){let a=r.ZERO,u=o;for(;i>Op;)i&Oi&&(a=a.add(u)),u=u.double(),i>>=Oi;return a},precomputeWindow(o,i){let{windows:a,windowSize:u}=n(i),d=[],h=o,x=h;for(let y=0;y<a;y++){x=h,d.push(x);for(let T=1;T<u;T++)x=x.add(h),d.push(x);h=x.double()}return d},wNAF(o,i,a){let{windows:u,windowSize:d}=n(o),h=r.ZERO,x=r.BASE,y=BigInt(2**o-1),T=2**o,E=BigInt(o);for(let I=0;I<u;I++){let A=I*d,v=Number(a&y);a>>=E,v>d&&(v-=T,a+=Oi);let k=A,N=A+Math.abs(v)-1,B=I%2!==0,Z=v<0;v===0?x=x.add(e(B,i[k])):h=h.add(e(Z,i[N]))}return{p:h,f:x}},wNAFCached(o,i,a,u){let d=o._WINDOW_SIZE||1,h=i.get(o);return h||(h=this.precomputeWindow(o,d),d!==1&&i.set(o,u(h))),this.wNAF(d,h,a)}}}function Pi(r){return Ii(r.Fp),kr(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Ri(r.n,r.nBitLength),...r,p:r.Fp.ORDER})}function Pp(r){let t=Pi(r);kr(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:e,Fp:n,a:o}=t;if(e){if(!n.eql(o,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof e!="object"||typeof e.beta!="bigint"||typeof e.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}var{bytesToNumberBE:zp,hexToBytes:Hp}=Ci,dn={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(r){let{Err:t}=dn;if(r.length<2||r[0]!==2)throw new t("Invalid signature integer tag");let e=r[1],n=r.subarray(2,e+2);if(!e||n.length!==e)throw new t("Invalid signature integer: wrong length");if(n[0]&128)throw new t("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new t("Invalid signature integer: unnecessary leading zero");return{d:zp(n),l:r.subarray(e+2)}},toSig(r){let{Err:t}=dn,e=typeof r=="string"?Hp(r):r;if(!(e instanceof Uint8Array))throw new Error("ui8a expected");let n=e.length;if(n<2||e[0]!=48)throw new t("Invalid signature tag");if(e[1]!==n-2)throw new t("Invalid signature: incorrect length");let{d:o,l:i}=dn._parseInt(e.subarray(2)),{d:a,l:u}=dn._parseInt(i);if(u.length)throw new t("Invalid signature: left bytes after parsing");return{r:o,s:a}},hexFromSig(r){let t=h=>Number.parseInt(h[0],16)&8?"00"+h:h,e=h=>{let x=h.toString(16);return x.length&1?`0${x}`:x},n=t(e(r.s)),o=t(e(r.r)),i=n.length/2,a=o.length/2,u=e(i),d=e(a);return`30${e(a+i+4)}02${d}${o}02${u}${n}`}},xr=BigInt(0),Rt=BigInt(1),Nx=BigInt(2),Nc=BigInt(3),Mx=BigInt(4);function Dp(r){let t=Pp(r),{Fp:e}=t,n=t.toBytes||((I,A,v)=>{let k=A.toAffine();return Gn(Uint8Array.from([4]),e.toBytes(k.x),e.toBytes(k.y))}),o=t.fromBytes||(I=>{let A=I.subarray(1),v=e.fromBytes(A.subarray(0,e.BYTES)),k=e.fromBytes(A.subarray(e.BYTES,2*e.BYTES));return{x:v,y:k}});function i(I){let{a:A,b:v}=t,k=e.sqr(I),N=e.mul(k,I);return e.add(e.add(N,e.mul(I,A)),v)}if(!e.eql(e.sqr(t.Gy),i(t.Gx)))throw new Error("bad generator point: equation left != right");function a(I){return typeof I=="bigint"&&xr<I&&I<t.n}function u(I){if(!a(I))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function d(I){let{allowedPrivateKeyLengths:A,nByteLength:v,wrapPrivateKey:k,n:N}=t;if(A&&typeof I!="bigint"){if(I instanceof Uint8Array&&(I=un(I)),typeof I!="string"||!A.includes(I.length))throw new Error("Invalid key");I=I.padStart(v*2,"0")}let B;try{B=typeof I=="bigint"?I:yr(wt("private key",I,v))}catch(Z){throw new Error(`private key must be ${v} bytes, hex or bigint, not ${typeof I}`)}return k&&(B=ut(B,N)),u(B),B}let h=new Map;function x(I){if(!(I instanceof y))throw new Error("ProjectivePoint expected")}class y{constructor(A,v,k){if(this.px=A,this.py=v,this.pz=k,A==null||!e.isValid(A))throw new Error("x required");if(v==null||!e.isValid(v))throw new Error("y required");if(k==null||!e.isValid(k))throw new Error("z required")}static fromAffine(A){let{x:v,y:k}=A||{};if(!A||!e.isValid(v)||!e.isValid(k))throw new Error("invalid affine point");if(A instanceof y)throw new Error("projective point not allowed");let N=B=>e.eql(B,e.ZERO);return N(v)&&N(k)?y.ZERO:new y(v,k,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(A){let v=e.invertBatch(A.map(k=>k.pz));return A.map((k,N)=>k.toAffine(v[N])).map(y.fromAffine)}static fromHex(A){let v=y.fromAffine(o(wt("pointHex",A)));return v.assertValidity(),v}static fromPrivateKey(A){return y.BASE.multiply(d(A))}_setWindowSize(A){this._WINDOW_SIZE=A,h.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!e.is0(this.py))return;throw new Error("bad point: ZERO")}let{x:A,y:v}=this.toAffine();if(!e.isValid(A)||!e.isValid(v))throw new Error("bad point: x or y not FE");let k=e.sqr(v),N=i(A);if(!e.eql(k,N))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:A}=this.toAffine();if(e.isOdd)return!e.isOdd(A);throw new Error("Field doesn't support isOdd")}equals(A){x(A);let{px:v,py:k,pz:N}=this,{px:B,py:Z,pz:F}=A,Q=e.eql(e.mul(v,F),e.mul(B,N)),J=e.eql(e.mul(k,F),e.mul(Z,N));return Q&&J}negate(){return new y(this.px,e.neg(this.py),this.pz)}double(){let{a:A,b:v}=t,k=e.mul(v,Nc),{px:N,py:B,pz:Z}=this,F=e.ZERO,Q=e.ZERO,J=e.ZERO,W=e.mul(N,N),Te=e.mul(B,B),Ae=e.mul(Z,Z),ye=e.mul(N,B);return ye=e.add(ye,ye),J=e.mul(N,Z),J=e.add(J,J),F=e.mul(A,J),Q=e.mul(k,Ae),Q=e.add(F,Q),F=e.sub(Te,Q),Q=e.add(Te,Q),Q=e.mul(F,Q),F=e.mul(ye,F),J=e.mul(k,J),Ae=e.mul(A,Ae),ye=e.sub(W,Ae),ye=e.mul(A,ye),ye=e.add(ye,J),J=e.add(W,W),W=e.add(J,W),W=e.add(W,Ae),W=e.mul(W,ye),Q=e.add(Q,W),Ae=e.mul(B,Z),Ae=e.add(Ae,Ae),W=e.mul(Ae,ye),F=e.sub(F,W),J=e.mul(Ae,Te),J=e.add(J,J),J=e.add(J,J),new y(F,Q,J)}add(A){x(A);let{px:v,py:k,pz:N}=this,{px:B,py:Z,pz:F}=A,Q=e.ZERO,J=e.ZERO,W=e.ZERO,Te=t.a,Ae=e.mul(t.b,Nc),ye=e.mul(v,B),ze=e.mul(k,Z),He=e.mul(N,F),nt=e.add(v,k),z=e.add(B,Z);nt=e.mul(nt,z),z=e.add(ye,ze),nt=e.sub(nt,z),z=e.add(v,N);let $=e.add(B,F);return z=e.mul(z,$),$=e.add(ye,He),z=e.sub(z,$),$=e.add(k,N),Q=e.add(Z,F),$=e.mul($,Q),Q=e.add(ze,He),$=e.sub($,Q),W=e.mul(Te,z),Q=e.mul(Ae,He),W=e.add(Q,W),Q=e.sub(ze,W),W=e.add(ze,W),J=e.mul(Q,W),ze=e.add(ye,ye),ze=e.add(ze,ye),He=e.mul(Te,He),z=e.mul(Ae,z),ze=e.add(ze,He),He=e.sub(ye,He),He=e.mul(Te,He),z=e.add(z,He),ye=e.mul(ze,z),J=e.add(J,ye),ye=e.mul($,z),Q=e.mul(nt,Q),Q=e.sub(Q,ye),ye=e.mul(nt,ze),W=e.mul($,W),W=e.add(W,ye),new y(Q,J,W)}subtract(A){return this.add(A.negate())}is0(){return this.equals(y.ZERO)}wNAF(A){return E.wNAFCached(this,h,A,v=>{let k=e.invertBatch(v.map(N=>N.pz));return v.map((N,B)=>N.toAffine(k[B])).map(y.fromAffine)})}multiplyUnsafe(A){let v=y.ZERO;if(A===xr)return v;if(u(A),A===Rt)return this;let{endo:k}=t;if(!k)return E.unsafeLadder(this,A);let{k1neg:N,k1:B,k2neg:Z,k2:F}=k.splitScalar(A),Q=v,J=v,W=this;for(;B>xr||F>xr;)B&Rt&&(Q=Q.add(W)),F&Rt&&(J=J.add(W)),W=W.double(),B>>=Rt,F>>=Rt;return N&&(Q=Q.negate()),Z&&(J=J.negate()),J=new y(e.mul(J.px,k.beta),J.py,J.pz),Q.add(J)}multiply(A){u(A);let v=A,k,N,{endo:B}=t;if(B){let{k1neg:Z,k1:F,k2neg:Q,k2:J}=B.splitScalar(v),{p:W,f:Te}=this.wNAF(F),{p:Ae,f:ye}=this.wNAF(J);W=E.constTimeNegate(Z,W),Ae=E.constTimeNegate(Q,Ae),Ae=new y(e.mul(Ae.px,B.beta),Ae.py,Ae.pz),k=W.add(Ae),N=Te.add(ye)}else{let{p:Z,f:F}=this.wNAF(v);k=Z,N=F}return y.normalizeZ([k,N])[0]}multiplyAndAddUnsafe(A,v,k){let N=y.BASE,B=(F,Q)=>Q===xr||Q===Rt||!F.equals(N)?F.multiplyUnsafe(Q):F.multiply(Q),Z=B(this,v).add(B(A,k));return Z.is0()?void 0:Z}toAffine(A){let{px:v,py:k,pz:N}=this,B=this.is0();A==null&&(A=B?e.ONE:e.inv(N));let Z=e.mul(v,A),F=e.mul(k,A),Q=e.mul(N,A);if(B)return{x:e.ZERO,y:e.ZERO};if(!e.eql(Q,e.ONE))throw new Error("invZ was invalid");return{x:Z,y:F}}isTorsionFree(){let{h:A,isTorsionFree:v}=t;if(A===Rt)return!0;if(v)return v(y,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:A,clearCofactor:v}=t;return A===Rt?this:v?v(y,this):this.multiplyUnsafe(t.h)}toRawBytes(A=!0){return this.assertValidity(),n(y,this,A)}toHex(A=!0){return un(this.toRawBytes(A))}}y.BASE=new y(t.Gx,t.Gy,e.ONE),y.ZERO=new y(e.ZERO,e.ONE,e.ZERO);let T=t.nBitLength,E=qc(y,t.endo?Math.ceil(T/2):T);return{CURVE:t,ProjectivePoint:y,normPrivateKeyToScalar:d,weierstrassEquation:i,isWithinCurveOrder:a}}function qp(r){let t=Pi(r);return kr(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function Mc(r){let t=qp(r),{Fp:e,n}=t,o=e.BYTES+1,i=2*e.BYTES+1;function a(z){return xr<z&&z<e.ORDER}function u(z){return ut(z,n)}function d(z){return gs(z,n)}let{ProjectivePoint:h,normPrivateKeyToScalar:x,weierstrassEquation:y,isWithinCurveOrder:T}=Dp({...t,toBytes(z,$,fe){let Be=$.toAffine(),Ie=e.toBytes(Be.x),Fe=Gn;return fe?Fe(Uint8Array.from([$.hasEvenY()?2:3]),Ie):Fe(Uint8Array.from([4]),Ie,e.toBytes(Be.y))},fromBytes(z){let $=z.length,fe=z[0],Be=z.subarray(1);if($===o&&(fe===2||fe===3)){let Ie=yr(Be);if(!a(Ie))throw new Error("Point is not on curve");let Fe=y(Ie),tt=e.sqrt(Fe),De=(tt&Rt)===Rt;return(fe&1)===1!==De&&(tt=e.neg(tt)),{x:Ie,y:tt}}else if($===i&&fe===4){let Ie=e.fromBytes(Be.subarray(0,e.BYTES)),Fe=e.fromBytes(Be.subarray(e.BYTES,2*e.BYTES));return{x:Ie,y:Fe}}else throw new Error(`Point of length ${$} was invalid. Expected ${o} compressed bytes or ${i} uncompressed bytes`)}}),E=z=>un(Rr(z,t.nByteLength));function I(z){let $=n>>Rt;return z>$}function A(z){return I(z)?u(-z):z}let v=(z,$,fe)=>yr(z.slice($,fe));class k{constructor($,fe,Be){this.r=$,this.s=fe,this.recovery=Be,this.assertValidity()}static fromCompact($){let fe=t.nByteLength;return $=wt("compactSignature",$,fe*2),new k(v($,0,fe),v($,fe,2*fe))}static fromDER($){let{r:fe,s:Be}=dn.toSig(wt("DER",$));return new k(fe,Be)}assertValidity(){if(!T(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!T(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit($){return new k(this.r,this.s,$)}recoverPublicKey($){let{r:fe,s:Be,recovery:Ie}=this,Fe=J(wt("msgHash",$));if(Ie==null||![0,1,2,3].includes(Ie))throw new Error("recovery id invalid");let tt=Ie===2||Ie===3?fe+t.n:fe;if(tt>=e.ORDER)throw new Error("recovery id 2 or 3 invalid");let De=(Ie&1)===0?"02":"03",je=h.fromHex(De+E(tt)),le=d(tt),Qe=u(-Fe*le),wr=u(Be*le),zt=h.BASE.multiplyAndAddUnsafe(je,Qe,wr);if(!zt)throw new Error("point at infinify");return zt.assertValidity(),zt}hasHighS(){return I(this.s)}normalizeS(){return this.hasHighS()?new k(this.r,u(-this.s),this.recovery):this}toDERRawBytes(){return fn(this.toDERHex())}toDERHex(){return dn.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return fn(this.toCompactHex())}toCompactHex(){return E(this.r)+E(this.s)}}let N={isValidPrivateKey(z){try{return x(z),!0}catch($){return!1}},normPrivateKeyToScalar:x,randomPrivateKey:()=>{let z=ki(t.n);return Dc(t.randomBytes(z),t.n)},precompute(z=8,$=h.BASE){return $._setWindowSize(z),$.multiply(BigInt(3)),$}};function B(z,$=!0){return h.fromPrivateKey(z).toRawBytes($)}function Z(z){let $=z instanceof Uint8Array,fe=typeof z=="string",Be=($||fe)&&z.length;return $?Be===o||Be===i:fe?Be===2*o||Be===2*i:z instanceof h}function F(z,$,fe=!0){if(Z(z))throw new Error("first arg must be private key");if(!Z($))throw new Error("second arg must be public key");return h.fromHex($).multiply(x(z)).toRawBytes(fe)}let Q=t.bits2int||function(z){let $=yr(z),fe=z.length*8-t.nBitLength;return fe>0?$>>BigInt(fe):$},J=t.bits2int_modN||function(z){return u(Q(z))},W=xo(t.nBitLength);function Te(z){if(typeof z!="bigint")throw new Error("bigint expected");if(!(xr<=z&&z<W))throw new Error(`bigint expected < 2^${t.nBitLength}`);return Rr(z,t.nByteLength)}function Ae(z,$,fe=ye){if(["recovered","canonical"].some(Bt=>Bt in fe))throw new Error("sign() legacy options not supported");let{hash:Be,randomBytes:Ie}=t,{lowS:Fe,prehash:tt,extraEntropy:De}=fe;Fe==null&&(Fe=!0),z=wt("msgHash",z),tt&&(z=wt("prehashed msgHash",Be(z)));let je=J(z),le=x($),Qe=[Te(le),Te(je)];if(De!=null){let Bt=De===!0?Ie(e.BYTES):De;Qe.push(wt("extraEntropy",Bt))}let wr=Gn(...Qe),zt=je;function _r(Bt){let ar=Q(Bt);if(!T(ar))return;let Xr=d(ar),cr=h.BASE.multiply(ar).toAffine(),mt=u(cr.x);if(mt===xr)return;let Tr=u(Xr*u(zt+mt*le));if(Tr===xr)return;let Lo=(cr.x===mt?0:2)|Number(cr.y&Rt),no=Tr;return Fe&&I(Tr)&&(no=A(Tr),Lo^=1),new k(mt,no,Lo)}return{seed:wr,k2sig:_r}}let ye={lowS:t.lowS,prehash:!1},ze={lowS:t.lowS,prehash:!1};function He(z,$,fe=ye){let{seed:Be,k2sig:Ie}=Ae(z,$,fe),Fe=t;return Ui(Fe.hash.outputLen,Fe.nByteLength,Fe.hmac)(Be,Ie)}h.BASE._setWindowSize(8);function nt(z,$,fe,Be=ze){var cr;let Ie=z;if($=wt("msgHash",$),fe=wt("publicKey",fe),"strict"in Be)throw new Error("options.strict was renamed to lowS");let{lowS:Fe,prehash:tt}=Be,De,je;try{if(typeof Ie=="string"||Ie instanceof Uint8Array)try{De=k.fromDER(Ie)}catch(mt){if(!(mt instanceof dn.Err))throw mt;De=k.fromCompact(Ie)}else if(typeof Ie=="object"&&typeof Ie.r=="bigint"&&typeof Ie.s=="bigint"){let{r:mt,s:Tr}=Ie;De=new k(mt,Tr)}else throw new Error("PARSE");je=h.fromHex(fe)}catch(mt){if(mt.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(Fe&&De.hasHighS())return!1;tt&&($=t.hash($));let{r:le,s:Qe}=De,wr=J($),zt=d(Qe),_r=u(wr*zt),Bt=u(le*zt),ar=(cr=h.BASE.multiplyAndAddUnsafe(je,_r,Bt))==null?void 0:cr.toAffine();return ar?u(ar.x)===le:!1}return{CURVE:t,getPublicKey:B,getSharedSecret:F,sign:He,verify:nt,ProjectivePoint:h,Signature:k,utils:N}}var ys=class extends Mn{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,Tc(t);let n=yo(e);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let o=this.blockLen,i=new Uint8Array(o);i.set(n.length>o?t.create().update(n).digest():n);for(let a=0;a<i.length;a++)i[a]^=54;this.iHash.update(i),this.oHash=t.create();for(let a=0;a<i.length;a++)i[a]^=106;this.oHash.update(i),i.fill(0)}update(t){return Nn(this),this.iHash.update(t),this}digestInto(t){Nn(this),Ti(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){let t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));let{oHash:e,iHash:n,finished:o,destroyed:i,blockLen:a,outputLen:u}=this;return t=t,t.finished=o,t.destroyed=i,t.blockLen=a,t.outputLen=u,t.oHash=e._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},zi=(r,t,e)=>new ys(r,t).update(e).digest();zi.create=(r,t)=>new ys(r,t);function Np(r){return{hash:r,hmac:(t,...e)=>zi(r,t,Sc(...e)),randomBytes:Cc}}function Gc(r,t){let e=n=>Mc({...r,...Np(n)});return Object.freeze({...e(t),create:e})}var $c=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Lc=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Mp=BigInt(1),Hi=BigInt(2),Fc=(r,t)=>(r+t/Hi)/t;function Gp(r){let t=$c,e=BigInt(3),n=BigInt(6),o=BigInt(11),i=BigInt(22),a=BigInt(23),u=BigInt(44),d=BigInt(88),h=r*r*r%t,x=h*h*r%t,y=_t(x,e,t)*x%t,T=_t(y,e,t)*x%t,E=_t(T,Hi,t)*h%t,I=_t(E,o,t)*E%t,A=_t(I,i,t)*I%t,v=_t(A,u,t)*A%t,k=_t(v,d,t)*v%t,N=_t(k,u,t)*A%t,B=_t(N,e,t)*x%t,Z=_t(B,a,t)*I%t,F=_t(Z,n,t)*h%t,Q=_t(F,Hi,t);if(!Di.eql(Di.sqr(Q),r))throw new Error("Cannot find square root");return Q}var Di=zc($c,void 0,void 0,{sqrt:Gp}),Ln=Gc({a:BigInt(0),b:BigInt(7),Fp:Di,n:Lc,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:r=>{let t=Lc,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-Mp*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=e,a=BigInt("0x100000000000000000000000000000000"),u=Fc(i*r,t),d=Fc(-n*r,t),h=ut(r-u*e-d*o,t),x=ut(-u*n-d*i,t),y=h>a,T=x>a;if(y&&(h=t-h),T&&(x=t-x),h>a||x>a)throw new Error("splitScalar: Endomorphism failed, k="+r);return{k1neg:y,k1:h,k2neg:T,k2:x}}}},Bc),Zx=BigInt(0);var Jx=Ln.ProjectivePoint;var Fn=class extends Dt{constructor(e){super();let n=te.fromHexInput(e);if(n.toUint8Array().length!==Fn.LENGTH)throw new Error(`PublicKey length should be ${Fn.LENGTH}`);this.key=n}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(e){let{message:n,signature:o}=e,i=te.fromHexInput(n).toUint8Array(),a=on(i),u=o.toUint8Array();return Ln.verify(u,a,this.toUint8Array())}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new Fn(n)}static load(e){let n=e.deserializeBytes();return new Fn(n)}},Tt=Fn;Tt.LENGTH=65;var $n=class extends cn{constructor(e){super();let n=te.fromHexInput(e);if(n.toUint8Array().length!==$n.LENGTH)throw new Error(`PrivateKey length should be ${$n.LENGTH}`);this.key=n}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}sign(e){let n=te.fromHexInput(e),o=on(n.toUint8Array()),i=Ln.sign(o,this.key.toUint8Array());return new kt(i.toCompactRawBytes())}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new $n(n)}static generate(){let e=Ln.utils.randomPrivateKey();return new $n(e)}publicKey(){let e=Ln.getPublicKey(this.key.toUint8Array(),!1);return new Tt(e)}},Or=$n;Or.LENGTH=32;var Kn=class extends qt{constructor(e){super();let n=te.fromHexInput(e);if(n.toUint8Array().length!==Kn.LENGTH)throw new Error(`Signature length should be ${Kn.LENGTH}, recieved ${n.toUint8Array().length}`);this.data=n}toUint8Array(){return this.data.toUint8Array()}toString(){return this.data.toString()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new Kn(n)}static load(e){let n=e.deserializeBytes();return new Kn(n)}},kt=Kn;kt.LENGTH=64;var rt=class extends Dt{constructor(e){super();this.publicKey=e}toUint8Array(){return this.publicKey.toUint8Array()}toString(){return this.publicKey.toString()}verifySignature(e){let{message:n,signature:o}=e;if(this.isED25519Signature(o))return this.publicKey.verifySignature({message:n,signature:o.signature});if(this.isSecp256k1Signature(o))return this.publicKey.verifySignature({message:n,signature:o.signature});throw new Error("Unknown public key type")}isED25519Signature(e){return this.publicKey instanceof Oe&&e.signature instanceof qe}isSecp256k1Signature(e){return this.publicKey instanceof Tt&&e.signature instanceof kt}serialize(e){if(this.publicKey instanceof Oe)e.serializeU32AsUleb128(0),this.publicKey.serialize(e);else if(this.publicKey instanceof Tt)e.serializeU32AsUleb128(1),this.publicKey.serialize(e);else throw new Error("Unknown public key type")}static deserialize(e){let n=e.deserializeUleb128AsU32();switch(n){case 0:return new rt(Oe.load(e));case 1:return new rt(Tt.load(e));default:throw new Error(`Unknown variant index for AnyPublicKey: ${n}`)}}};var jn=class{constructor(t){let{data:e}=t,n=te.fromHexInput(e);if(n.toUint8Array().length!==jn.LENGTH)throw new Error(`Authentication Key length should be ${jn.LENGTH}`);this.data=n}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromPublicKeyAndScheme(t){let{publicKey:e,scheme:n}=t,o;switch(n){case 2:{let u=e.bcsToBytes();o=new Uint8Array([...u,n]);break}case 0:case 1:{let u=e.toUint8Array(),d=te.fromHexInput(u).toUint8Array();o=new Uint8Array([...d,n]);break}default:throw new Error(`Scheme ${n} is not supported`)}let i=on.create();i.update(o);let a=i.digest();return new jn({data:a})}static fromPublicKey(t){let{publicKey:e}=t,n;if(e instanceof Oe)n=0 .valueOf();else if(e instanceof ht)n=1 .valueOf();else if(e instanceof rt)n=2 .valueOf();else throw new Error("No supported authentication scheme for public key");return jn.fromPublicKeyAndScheme({publicKey:e,scheme:n})}derivedAddress(){return new D({data:this.data.toUint8Array()})}},Xt=jn;Xt.LENGTH=32;var xs=class extends Er{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,at.hash(t);let n=Sr(e);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new TypeError("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let o=this.blockLen,i=new Uint8Array(o);i.set(n.length>o?t.create().update(n).digest():n);for(let a=0;a<i.length;a++)i[a]^=54;this.iHash.update(i),this.oHash=t.create();for(let a=0;a<i.length;a++)i[a]^=106;this.oHash.update(i),i.fill(0)}update(t){return at.exists(this),this.iHash.update(t),this}digestInto(t){at.exists(this),at.bytes(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){let t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));let{oHash:e,iHash:n,finished:o,destroyed:i,blockLen:a,outputLen:u}=this;return t=t,t.finished=o,t.destroyed=i,t.blockLen=a,t.outputLen=u,t.oHash=e._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},qi=(r,t,e)=>new xs(r,t).update(e).digest();qi.create=(r,t)=>new xs(r,t);function Lp(r,t,e,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(t,e,n);let o=BigInt(32),i=BigInt(4294967295),a=Number(e>>o&i),u=Number(e&i),d=n?4:0,h=n?0:4;r.setUint32(t+d,a,n),r.setUint32(t+h,u,n)}var ms=class extends Er{constructor(t,e,n,o){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=es(this.buffer)}update(t){at.exists(this);let{view:e,buffer:n,blockLen:o}=this;t=Sr(t);let i=t.length;for(let a=0;a<i;){let u=Math.min(o-this.pos,i-a);if(u===o){let d=es(t);for(;o<=i-a;a+=o)this.process(d,a);continue}n.set(t.subarray(a,a+u),this.pos),this.pos+=u,a+=u,this.pos===o&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){at.exists(this),at.output(t,this),this.finished=!0;let{buffer:e,view:n,blockLen:o,isLE:i}=this,{pos:a}=this;e[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>o-a&&(this.process(n,0),a=0);for(let d=a;d<o;d++)e[d]=0;Lp(n,o-8,BigInt(this.length*8),i),this.process(n,0);let u=es(t);this.get().forEach((d,h)=>u.setUint32(4*h,d,i))}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:e,buffer:n,length:o,finished:i,destroyed:a,pos:u}=this;return t.length=o,t.pos=u,t.finished=i,t.destroyed=a,o%e&&t.buffer.set(n),t}};var[Fp,$p]=ne.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(r=>BigInt(r))),Pr=new Uint32Array(80),zr=new Uint32Array(80),mo=class extends ms{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:t,Al:e,Bh:n,Bl:o,Ch:i,Cl:a,Dh:u,Dl:d,Eh:h,El:x,Fh:y,Fl:T,Gh:E,Gl:I,Hh:A,Hl:v}=this;return[t,e,n,o,i,a,u,d,h,x,y,T,E,I,A,v]}set(t,e,n,o,i,a,u,d,h,x,y,T,E,I,A,v){this.Ah=t|0,this.Al=e|0,this.Bh=n|0,this.Bl=o|0,this.Ch=i|0,this.Cl=a|0,this.Dh=u|0,this.Dl=d|0,this.Eh=h|0,this.El=x|0,this.Fh=y|0,this.Fl=T|0,this.Gh=E|0,this.Gl=I|0,this.Hh=A|0,this.Hl=v|0}process(t,e){for(let B=0;B<16;B++,e+=4)Pr[B]=t.getUint32(e),zr[B]=t.getUint32(e+=4);for(let B=16;B<80;B++){let Z=Pr[B-15]|0,F=zr[B-15]|0,Q=ne.rotrSH(Z,F,1)^ne.rotrSH(Z,F,8)^ne.shrSH(Z,F,7),J=ne.rotrSL(Z,F,1)^ne.rotrSL(Z,F,8)^ne.shrSL(Z,F,7),W=Pr[B-2]|0,Te=zr[B-2]|0,Ae=ne.rotrSH(W,Te,19)^ne.rotrBH(W,Te,61)^ne.shrSH(W,Te,6),ye=ne.rotrSL(W,Te,19)^ne.rotrBL(W,Te,61)^ne.shrSL(W,Te,6),ze=ne.add4L(J,ye,zr[B-7],zr[B-16]),He=ne.add4H(ze,Q,Ae,Pr[B-7],Pr[B-16]);Pr[B]=He|0,zr[B]=ze|0}let{Ah:n,Al:o,Bh:i,Bl:a,Ch:u,Cl:d,Dh:h,Dl:x,Eh:y,El:T,Fh:E,Fl:I,Gh:A,Gl:v,Hh:k,Hl:N}=this;for(let B=0;B<80;B++){let Z=ne.rotrSH(y,T,14)^ne.rotrSH(y,T,18)^ne.rotrBH(y,T,41),F=ne.rotrSL(y,T,14)^ne.rotrSL(y,T,18)^ne.rotrBL(y,T,41),Q=y&E^~y&A,J=T&I^~T&v,W=ne.add5L(N,F,J,$p[B],zr[B]),Te=ne.add5H(W,k,Z,Q,Fp[B],Pr[B]),Ae=W|0,ye=ne.rotrSH(n,o,28)^ne.rotrBH(n,o,34)^ne.rotrBH(n,o,39),ze=ne.rotrSL(n,o,28)^ne.rotrBL(n,o,34)^ne.rotrBL(n,o,39),He=n&i^n&u^i&u,nt=o&a^o&d^a&d;k=A|0,N=v|0,A=E|0,v=I|0,E=y|0,I=T|0,{h:y,l:T}=ne.add(h|0,x|0,Te|0,Ae|0),h=u|0,x=d|0,u=i|0,d=a|0,i=n|0,a=o|0;let z=ne.add3L(Ae,ze,nt);n=ne.add3H(z,Te,ye,He),o=z|0}({h:n,l:o}=ne.add(this.Ah|0,this.Al|0,n|0,o|0)),{h:i,l:a}=ne.add(this.Bh|0,this.Bl|0,i|0,a|0),{h:u,l:d}=ne.add(this.Ch|0,this.Cl|0,u|0,d|0),{h,l:x}=ne.add(this.Dh|0,this.Dl|0,h|0,x|0),{h:y,l:T}=ne.add(this.Eh|0,this.El|0,y|0,T|0),{h:E,l:I}=ne.add(this.Fh|0,this.Fl|0,E|0,I|0),{h:A,l:v}=ne.add(this.Gh|0,this.Gl|0,A|0,v|0),{h:k,l:N}=ne.add(this.Hh|0,this.Hl|0,k|0,N|0),this.set(n,o,i,a,u,d,h,x,y,T,E,I,A,v,k,N)}roundClean(){Pr.fill(0),zr.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},Ni=class extends mo{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}},Mi=class extends mo{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}},Kc=zn(()=>new mo),Rm=zn(()=>new Ni),km=zn(()=>new Mi);var Iu=ii(Bu()),Ru=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,na=(t=>(t.ED25519="ed25519 seed",t))(na||{}),Yh=2147483648,ku=(r,t)=>{let e=qi.create(Kc,r).update(t).digest();return{key:e.slice(0,32),chainCode:e.slice(32)}},Xh=({key:r,chainCode:t},e)=>{let n=new ArrayBuffer(4);new DataView(n).setUint32(0,e);let o=new Uint8Array(n),i=new Uint8Array([0]),a=new Uint8Array([...i,...r,...o]);return ku(t,a)},Zh=r=>r.replace("'",""),Ou=r=>r.split("/").slice(1).map(Zh),Pu=r=>Ru.test(r)?!Ou(r).some(Number.isNaN):!1,Jh=r=>{let t=r.trim().split(/\s+/).map(e=>e.toLowerCase()).join(" ");return Iu.mnemonicToSeedSync(t)},oa=(r,t,e,n=Yh)=>{if(!Pu(t))throw new Error("Invalid derivation path");let{key:o,chainCode:i}=ku(r,Jh(e));return Ou(t).map(u=>parseInt(u,10)).reduce((u,d)=>Xh(u,d+n),{key:o,chainCode:i})};var vt=class{constructor(t){let{privateKey:e,address:n,legacy:o}=t;if(this.publicKey=e.publicKey(),this.publicKey instanceof Oe)o?this.signingScheme=0:(this.publicKey=new rt(this.publicKey),this.signingScheme=2);else if(this.publicKey instanceof ht)this.signingScheme=1;else if(this.publicKey instanceof Tt)this.publicKey=new rt(this.publicKey),this.signingScheme=2;else throw new Error("Can not create new Account, unsupported public key type");this.privateKey=e,this.accountAddress=n}static generate(t){let e;switch(t==null?void 0:t.scheme){case 2:e=Or.generate();break;default:e=pr.generate()}let n=e.publicKey();t!=null&&t.legacy||(n=new rt(e.publicKey()));let o=new D({data:vt.authKey({publicKey:n}).toUint8Array()});return new vt({privateKey:e,address:o,legacy:t==null?void 0:t.legacy})}static fromPrivateKey(t){let{privateKey:e,address:n,legacy:o}=t;return new vt({privateKey:e,address:n,legacy:o})}static fromDerivationPath(t){let{path:e,mnemonic:n}=t,{key:o}=oa("ed25519 seed",e,n),i=new pr(o),a=i.publicKey(),u=vt.authKey({publicKey:a}),d=new D({data:u.toUint8Array()});return new vt({privateKey:i,address:d,legacy:!0})}static authKey(t){let{publicKey:e}=t;return Xt.fromPublicKey({publicKey:e}).data}sign(t){return this.privateKey.sign(t)}verifySignature(t){let{message:e,signature:n}=t,o=te.fromHexInput(e).toUint8Array();return this.publicKey.verifySignature({message:o,signature:n})}};var Is=`
3
3
  fragment CurrentTokenOwnershipFields on current_token_ownerships_v2 {
4
4
  token_standard
5
5
  token_properties_mutated_v1
@@ -45,7 +45,7 @@
45
45
  }
46
46
  }
47
47
  }
48
- `,Vh=`
48
+ `,e0=`
49
49
  fragment TokenActivitiesFields on token_activities_v2 {
50
50
  after_value
51
51
  before_value
@@ -63,7 +63,7 @@
63
63
  transaction_version
64
64
  type
65
65
  }
66
- `,Cu=`
66
+ `,zu=`
67
67
  query getAccountCoinsCount($address: String) {
68
68
  current_fungible_asset_balances_aggregate(
69
69
  where: {owner_address: {_eq: $address}}
@@ -73,7 +73,7 @@
73
73
  }
74
74
  }
75
75
  }
76
- `,Bu=`
76
+ `,Hu=`
77
77
  query getAccountCoinsData($where_condition: current_fungible_asset_balances_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_fungible_asset_balances_order_by!]) {
78
78
  current_fungible_asset_balances(
79
79
  where: $where_condition
@@ -106,7 +106,7 @@
106
106
  }
107
107
  }
108
108
  }
109
- `,Iu=`
109
+ `,Du=`
110
110
  query getAccountCollectionsWithOwnedTokens($where_condition: current_collection_ownership_v2_view_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_collection_ownership_v2_view_order_by!]) {
111
111
  current_collection_ownership_v2_view(
112
112
  where: $where_condition
@@ -140,7 +140,7 @@
140
140
  single_token_uri
141
141
  }
142
142
  }
143
- `,Ru=`
143
+ `,qu=`
144
144
  query getAccountOwnedObjects($where_condition: current_objects_bool_exp, $offset: Int, $limit: Int, $order_by: [current_objects_order_by!]) {
145
145
  current_objects(
146
146
  where: $where_condition
@@ -157,7 +157,7 @@
157
157
  is_deleted
158
158
  }
159
159
  }
160
- `,ku=`
160
+ `,Nu=`
161
161
  query getAccountOwnedTokens($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
162
162
  current_token_ownerships_v2(
163
163
  where: $where_condition
@@ -168,7 +168,7 @@
168
168
  ...CurrentTokenOwnershipFields
169
169
  }
170
170
  }
171
- ${Us}`,nb=`
171
+ ${Is}`,ib=`
172
172
  query getAccountOwnedTokensByTokenData($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
173
173
  current_token_ownerships_v2(
174
174
  where: $where_condition
@@ -179,7 +179,7 @@
179
179
  ...CurrentTokenOwnershipFields
180
180
  }
181
181
  }
182
- ${Us}`,Ou=`
182
+ ${Is}`,Mu=`
183
183
  query getAccountOwnedTokensFromCollection($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
184
184
  current_token_ownerships_v2(
185
185
  where: $where_condition
@@ -190,7 +190,7 @@
190
190
  ...CurrentTokenOwnershipFields
191
191
  }
192
192
  }
193
- ${Us}`,zu=`
193
+ ${Is}`,Gu=`
194
194
  query getAccountTokensCount($where_condition: current_token_ownerships_v2_bool_exp, $offset: Int, $limit: Int) {
195
195
  current_token_ownerships_v2_aggregate(
196
196
  where: $where_condition
@@ -202,7 +202,7 @@
202
202
  }
203
203
  }
204
204
  }
205
- `,Pu=`
205
+ `,Lu=`
206
206
  query getAccountTransactionsCount($address: String) {
207
207
  account_transactions_aggregate(where: {account_address: {_eq: $address}}) {
208
208
  aggregate {
@@ -210,13 +210,13 @@
210
210
  }
211
211
  }
212
212
  }
213
- `,Hu=`
213
+ `,Fu=`
214
214
  query getChainTopUserTransactions($limit: Int) {
215
215
  user_transactions(limit: $limit, order_by: {version: desc}) {
216
216
  version
217
217
  }
218
218
  }
219
- `,qu=`
219
+ `,$u=`
220
220
  query getCollectionData($where_condition: current_collections_v2_bool_exp!) {
221
221
  current_collections_v2(where: $where_condition) {
222
222
  collection_id
@@ -235,7 +235,7 @@
235
235
  uri
236
236
  }
237
237
  }
238
- `,Nu=`
238
+ `,Ku=`
239
239
  query getCurrentFungibleAssetBalances($where_condition: current_fungible_asset_balances_bool_exp, $offset: Int, $limit: Int) {
240
240
  current_fungible_asset_balances(
241
241
  where: $where_condition
@@ -253,7 +253,7 @@
253
253
  token_standard
254
254
  }
255
255
  }
256
- `,Du=`
256
+ `,ju=`
257
257
  query getDelegatedStakingActivities($delegatorAddress: String, $poolAddress: String) {
258
258
  delegated_staking_activities(
259
259
  where: {delegator_address: {_eq: $delegatorAddress}, pool_address: {_eq: $poolAddress}}
@@ -266,7 +266,7 @@
266
266
  transaction_version
267
267
  }
268
268
  }
269
- `,Mu=`
269
+ `,Vu=`
270
270
  query getEvents($where_condition: events_bool_exp, $offset: Int, $limit: Int, $order_by: [events_order_by!]) {
271
271
  events(
272
272
  where: $where_condition
@@ -284,7 +284,7 @@
284
284
  type
285
285
  }
286
286
  }
287
- `,Gu=`
287
+ `,Qu=`
288
288
  query getFungibleAssetActivities($where_condition: fungible_asset_activities_bool_exp, $offset: Int, $limit: Int) {
289
289
  fungible_asset_activities(
290
290
  where: $where_condition
@@ -309,7 +309,7 @@
309
309
  type
310
310
  }
311
311
  }
312
- `,Lu=`
312
+ `,Wu=`
313
313
  query getFungibleAssetMetadata($where_condition: fungible_asset_metadata_bool_exp, $offset: Int, $limit: Int) {
314
314
  fungible_asset_metadata(where: $where_condition, offset: $offset, limit: $limit) {
315
315
  icon_uri
@@ -326,14 +326,14 @@
326
326
  token_standard
327
327
  }
328
328
  }
329
- `,ea=`
329
+ `,sa=`
330
330
  query getNumberOfDelegators($where_condition: num_active_delegator_per_pool_bool_exp!, $order_by: [num_active_delegator_per_pool_order_by!]) {
331
331
  num_active_delegator_per_pool(where: $where_condition, order_by: $order_by) {
332
332
  num_active_delegator
333
333
  pool_address
334
334
  }
335
335
  }
336
- `,Fu=`
336
+ `,Yu=`
337
337
  query getProcessorStatus {
338
338
  processor_status {
339
339
  last_success_version
@@ -341,7 +341,7 @@
341
341
  last_updated
342
342
  }
343
343
  }
344
- `,$u=`
344
+ `,Xu=`
345
345
  query getTokenActivity($where_condition: token_activities_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [token_activities_v2_order_by!]) {
346
346
  token_activities_v2(
347
347
  where: $where_condition
@@ -352,7 +352,7 @@
352
352
  ...TokenActivitiesFields
353
353
  }
354
354
  }
355
- ${Vh}`,ta=`
355
+ ${e0}`,ia=`
356
356
  query getCurrentTokenOwnership($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
357
357
  current_token_ownerships_v2(
358
358
  where: $where_condition
@@ -363,7 +363,7 @@
363
363
  ...CurrentTokenOwnershipFields
364
364
  }
365
365
  }
366
- ${Us}`,ju=`
366
+ ${Is}`,Zu=`
367
367
  query getTokenData($where_condition: current_token_datas_v2_bool_exp, $offset: Int, $limit: Int, $order_by: [current_token_datas_v2_order_by!]) {
368
368
  current_token_datas_v2(
369
369
  where: $where_condition
@@ -402,7 +402,7 @@
402
402
  }
403
403
  }
404
404
  }
405
- `;async function Cs(r){let{aptosConfig:e}=r,{data:t}=await pt({aptosConfig:e,originMethod:"getLedgerInfo",path:""});return t}async function Ku(r){let{aptosConfig:e,ledgerVersion:t,options:n}=r,{data:o}=await pt({aptosConfig:e,originMethod:"getBlockByVersion",path:`blocks/by_version/${t}`,params:{with_transactions:n==null?void 0:n.withTransactions}});return o}async function Vu(r){let{aptosConfig:e,blockHeight:t,options:n}=r,{data:o}=await pt({aptosConfig:e,originMethod:"getBlockByHeight",path:`blocks/by_height/${t}`,params:{with_transactions:n==null?void 0:n.withTransactions}});return o}async function Bs(r){let{aptosConfig:e,handle:t,data:n,options:o}=r;return(await Yr({aptosConfig:e,originMethod:"getTableItem",path:`tables/${t}/item`,params:{ledger_version:o==null?void 0:o.ledgerVersion},body:n})).data}async function Qu(r){var i,a;let{aptosConfig:e,payload:t,options:n}=r,{data:o}=await Yr({aptosConfig:e,originMethod:"view",path:"view",params:{ledger_version:n==null?void 0:n.ledgerVersion},body:{function:t.function,type_arguments:(i=t.typeArguments)!=null?i:[],arguments:(a=t.arguments)!=null?a:[]}});return o}async function Wu(r){let{aptosConfig:e,limit:t}=r;return(await ke({aptosConfig:e,query:{query:Hu,variables:{limit:t}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function ke(r){let{aptosConfig:e,query:t,originMethod:n}=r,{data:o}=await hi({aptosConfig:e,originMethod:n!=null?n:"queryIndexer",path:"",body:t,overrides:{WITH_CREDENTIALS:!1}});return o}async function Qh(r){let{aptosConfig:e}=r;return(await ke({aptosConfig:e,query:{query:Fu},originMethod:"getProcessorStatuses"})).processor_status}async function Is(r){return(await Qh({aptosConfig:r.aptosConfig}))[0].last_success_version}var ra=new Map;function Rs(r,e,t){return async(...n)=>{if(ra.has(e)){let{value:i,timestamp:a}=ra.get(e);if(t===void 0||Date.now()-a<=t)return i}let o=await r(...n);return ra.set(e,{value:o,timestamp:Date.now()}),o}}async function ks(r){let{aptosConfig:e,accountAddress:t}=r,{data:n}=await pt({aptosConfig:e,originMethod:"getInfo",path:`accounts/${M.fromHexInput(t).toString()}`});return n}async function Xu(r){var o;let{aptosConfig:e,accountAddress:t,options:n}=r;return Wr({aptosConfig:e,originMethod:"getModules",path:`accounts/${M.fromHexInput(t).toString()}/modules`,params:{ledger_version:n==null?void 0:n.ledgerVersion,start:n==null?void 0:n.offset,limit:(o=n==null?void 0:n.limit)!=null?o:1e3}})}async function Zu(r){var e;return((e=r.options)==null?void 0:e.ledgerVersion)!==void 0?Yu(r):Rs(async()=>Yu(r),`module-${r.accountAddress}-${r.moduleName}`,1e3*60*5)()}async function Yu(r){let{aptosConfig:e,accountAddress:t,moduleName:n,options:o}=r,{data:i}=await pt({aptosConfig:e,originMethod:"getModule",path:`accounts/${M.fromHexInput(t).toString()}/module/${n}`,params:{ledger_version:o==null?void 0:o.ledgerVersion}});return i}async function Ju(r){let{aptosConfig:e,accountAddress:t,options:n}=r;return Wr({aptosConfig:e,originMethod:"getTransactions",path:`accounts/${M.fromHexInput(t).toString()}/transactions`,params:{start:n==null?void 0:n.offset,limit:n==null?void 0:n.limit}})}async function ef(r){var o;let{aptosConfig:e,accountAddress:t,options:n}=r;return Wr({aptosConfig:e,originMethod:"getResources",path:`accounts/${M.fromHexInput(t).toString()}/resources`,params:{ledger_version:n==null?void 0:n.ledgerVersion,start:n==null?void 0:n.offset,limit:(o=n==null?void 0:n.limit)!=null?o:999}})}async function na(r){let{aptosConfig:e,accountAddress:t,resourceType:n,options:o}=r,{data:i}=await pt({aptosConfig:e,originMethod:"getResource",path:`accounts/${M.fromHexInput(t).toString()}/resource/${n}`,params:{ledger_version:o==null?void 0:o.ledgerVersion}});return i}async function tf(r){let{aptosConfig:e,authenticationKey:t,options:n}=r,o=await na({aptosConfig:e,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:n}),{address_map:{handle:i}}=o.data;try{let a=await Bs({aptosConfig:e,handle:i,data:{key:te.fromHexInput(t).toString(),key_type:"address",value_type:"address"},options:n});return M.fromHexInput(a)}catch(a){if(a instanceof Dt&&a.data.error_code==="table_item_not_found")return M.fromHexInput(t);throw a}}async function rf(r){let{aptosConfig:e,accountAddress:t}=r,o={owner_address:{_eq:M.fromHexInput(t).toString()},amount:{_gt:"0"}},a=await ke({aptosConfig:e,query:{query:zu,variables:{where_condition:o}},originMethod:"getAccountTokensCount"});if(!a.current_token_ownerships_v2_aggregate.aggregate)throw Error("Failed to get the count of account tokens");return a.current_token_ownerships_v2_aggregate.aggregate.count}async function nf(r){var d,h;let{aptosConfig:e,accountAddress:t,options:n}=r,i={owner_address:{_eq:M.fromHexInput(t).toString()},amount:{_gt:0}};n!=null&&n.tokenStandard&&(i.token_standard={_eq:n==null?void 0:n.tokenStandard});let a={query:ku,variables:{where_condition:i,offset:(d=n==null?void 0:n.pagination)==null?void 0:d.offset,limit:(h=n==null?void 0:n.pagination)==null?void 0:h.limit,order_by:n==null?void 0:n.orderBy}};return(await ke({aptosConfig:e,query:a,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function of(r){var x,y;let{aptosConfig:e,accountAddress:t,collectionAddress:n,options:o}=r,i=M.fromHexInput(t).toString(),a=te.fromHexInput(n).toString(),u={owner_address:{_eq:i},current_token_data:{collection_id:{_eq:a}},amount:{_gt:0}};o!=null&&o.tokenStandard&&(u.token_standard={_eq:o==null?void 0:o.tokenStandard});let d={query:Ou,variables:{where_condition:u,offset:(x=o==null?void 0:o.pagination)==null?void 0:x.offset,limit:(y=o==null?void 0:o.pagination)==null?void 0:y.limit,order_by:o==null?void 0:o.orderBy}};return(await ke({aptosConfig:e,query:d,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function sf(r){var d,h;let{aptosConfig:e,accountAddress:t,options:n}=r,i={owner_address:{_eq:M.fromHexInput(t).toString()},amount:{_gt:0}};n!=null&&n.tokenStandard&&(i.current_collection={token_standard:{_eq:n==null?void 0:n.tokenStandard}});let a={query:Iu,variables:{where_condition:i,offset:(d=n==null?void 0:n.pagination)==null?void 0:d.offset,limit:(h=n==null?void 0:n.pagination)==null?void 0:h.limit,order_by:n==null?void 0:n.orderBy}};return(await ke({aptosConfig:e,query:a,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function af(r){let{aptosConfig:e,accountAddress:t}=r,n=M.fromHexInput(t).toString(),i=await ke({aptosConfig:e,query:{query:Pu,variables:{address:n}},originMethod:"getAccountTransactionsCount"});if(!i.account_transactions_aggregate.aggregate)throw Error("Failed to get the count of account transactions");return i.account_transactions_aggregate.aggregate.count}async function cf(r){var d,h;let{aptosConfig:e,accountAddress:t,options:n}=r,i={owner_address:{_eq:M.fromHexInput(t).toString()}},a={query:Bu,variables:{where_condition:i,offset:(d=n==null?void 0:n.pagination)==null?void 0:d.offset,limit:(h=n==null?void 0:n.pagination)==null?void 0:h.limit,order_by:n==null?void 0:n.orderBy}};return(await ke({aptosConfig:e,query:a,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function uf(r){let{aptosConfig:e,accountAddress:t}=r,n=M.fromHexInput(t).toString(),i=await ke({aptosConfig:e,query:{query:Cu,variables:{address:n}},originMethod:"getAccountCoinsCount"});if(!i.current_fungible_asset_balances_aggregate.aggregate)throw Error("Failed to get the count of account coins");return i.current_fungible_asset_balances_aggregate.aggregate.count}async function ff(r){var d,h;let{aptosConfig:e,accountAddress:t,options:n}=r,i={owner_address:{_eq:M.fromHexInput(t).toString()}},a={query:Ru,variables:{where_condition:i,offset:(d=n==null?void 0:n.pagination)==null?void 0:d.offset,limit:(h=n==null?void 0:n.pagination)==null?void 0:h.limit,order_by:n==null?void 0:n.orderBy}};return(await ke({aptosConfig:e,query:a,originMethod:"getAccountOwnedObjects"})).current_objects}var To=class{constructor(e){this.config=e}async getAccountInfo(e){return ks({aptosConfig:this.config,...e})}async getAccountModules(e){return Xu({aptosConfig:this.config,...e})}async getAccountModule(e){return Zu({aptosConfig:this.config,...e})}async getAccountTransactions(e){return Ju({aptosConfig:this.config,...e})}async getAccountResources(e){return ef({aptosConfig:this.config,...e})}async getAccountResource(e){return na({aptosConfig:this.config,...e})}async lookupOriginalAccountAddress(e){return tf({aptosConfig:this.config,...e})}async getAccountTokensCount(e){return rf({aptosConfig:this.config,...e})}async getAccountOwnedTokens(e){return nf({aptosConfig:this.config,...e})}async getAccountOwnedTokensFromCollectionAddress(e){return of({aptosConfig:this.config,...e})}async getAccountCollectionsWithOwnedTokens(e){return sf({aptosConfig:this.config,...e})}async getAccountTransactionsCount(e){return af({aptosConfig:this.config,...e})}async getAccountCoinsData(e){return cf({aptosConfig:this.config,...e})}async getAccountCoinsCount(e){return uf({aptosConfig:this.config,...e})}async getAccountOwnedObjects(e){return ff({aptosConfig:this.config,...e})}};var Sl=oi(El(),1);async function Ul(r){var e;let{params:t,method:n,url:o,headers:i,body:a,overrides:u}=r,d={headers:i,method:n,url:o,params:t,data:a,withCredentials:(e=u==null?void 0:u.WITH_CREDENTIALS)!=null?e:!0};try{let h=await(0,Sl.default)(d);return{status:h.status,statusText:h.statusText,data:h.data,headers:h.headers,config:h.config}}catch(h){let x=h;if(x.response)return x.response;throw h}}var So=class{constructor(e){var t,n,o;this.network=(t=e==null?void 0:e.network)!=null?t:Va,this.fullnode=e==null?void 0:e.fullnode,this.faucet=e==null?void 0:e.faucet,this.indexer=e==null?void 0:e.indexer,this.client=(n=e==null?void 0:e.client)!=null?n:{provider:Ul},this.clientConfig=(o=e==null?void 0:e.clientConfig)!=null?o:{}}getRequestUrl(e){switch(e){case 0:if(this.fullnode!==void 0)return this.fullnode;if(this.network==="custom")throw new Error("Please provide a custom full node url");return li[this.network];case 2:if(this.faucet!==void 0)return this.faucet;if(this.network==="custom")throw new Error("Please provide a custom faucet url");return di[this.network];case 1:if(this.indexer!==void 0)return this.indexer;if(this.network==="custom")throw new Error("Please provide a custom indexer url");return Ko[this.network];default:throw Error(`apiType ${e} is not supported`)}}isIndexerRequest(e){return Ko[this.network]===e}};var $e=class extends le{constructor(t){super();this.identifier=t}serialize(t){t.serializeStr(this.identifier)}static deserialize(t){let n=t.deserializeStr();return new $e(n)}};var Xe=class extends le{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return dn.load(e);case 1:return pn.load(e);case 2:return yn.load(e);case 3:return xn.load(e);case 4:return Nr.load(e);case 5:return Qn.load(e);case 6:return bn.load(e);case 7:return Wt.load(e);case 8:return hn.load(e);case 9:return gn.load(e);case 10:return mn.load(e);default:throw new Error(`Unknown variant index for TypeTag: ${t}`)}}},dn=class extends Xe{serialize(e){e.serializeU32AsUleb128(0)}static load(e){return new dn}},pn=class extends Xe{serialize(e){e.serializeU32AsUleb128(1)}static load(e){return new pn}},hn=class extends Xe{serialize(e){e.serializeU32AsUleb128(8)}static load(e){return new hn}},gn=class extends Xe{serialize(e){e.serializeU32AsUleb128(9)}static load(e){return new gn}},yn=class extends Xe{serialize(e){e.serializeU32AsUleb128(2)}static load(e){return new yn}},xn=class extends Xe{serialize(e){e.serializeU32AsUleb128(3)}static load(e){return new xn}},mn=class extends Xe{serialize(e){e.serializeU32AsUleb128(10)}static load(e){return new mn}},Nr=class extends Xe{serialize(e){e.serializeU32AsUleb128(4)}static load(e){return new Nr}},Qn=class extends Xe{serialize(e){e.serializeU32AsUleb128(5)}static load(e){return new Qn}},bn=class extends Xe{constructor(t){super();this.value=t}serialize(t){t.serializeU32AsUleb128(6),this.value.serialize(t)}static load(t){let n=Xe.deserialize(t);return new bn(n)}},Wt=class extends Xe{constructor(t){super();this.value=t}serialize(t){t.serializeU32AsUleb128(7),this.value.serialize(t)}static load(t){let n=Tt.deserialize(t);return new Wt(n)}isStringTypeTag(){return this.value.module_name.identifier==="string"&&this.value.name.identifier==="String"&&this.value.address.toString()===M.ONE.toString()}},Tt=class extends le{constructor(t,n,o,i){super();this.address=t,this.module_name=n,this.name=o,this.type_args=i}static fromString(t){let n=new Wn(t).parseTypeTag();return new Tt(n.value.address,n.value.module_name,n.value.name,n.value.type_args)}serialize(t){t.serialize(this.address),t.serialize(this.module_name),t.serialize(this.name),t.serializeVector(this.type_args)}static deserialize(t){let n=M.deserialize(t),o=$e.deserialize(t),i=$e.deserialize(t),a=t.deserializeVector(Xe);return new Tt(n,o,i,a)}},Il=()=>new Tt(M.ONE,new $e("string"),new $e("String"),[]);function X0(r){return new Tt(M.ONE,new $e("option"),new $e("Option"),[r])}function Z0(r){return new Tt(M.ONE,new $e("object"),new $e("Object"),[r])}var Wn=class{constructor(e,t){this.typeTags=[];this.tokens=J0(e),this.typeTags=t||[]}consume(e){let t=this.tokens.shift();(!t||t[1]!==e)&&qr("Invalid type tag.")}consumeWholeGeneric(){for(this.consume("<");this.tokens[0][1]!==">";)this.tokens[0][1]==="<"?this.consumeWholeGeneric():this.tokens.shift();this.consume(">")}parseCommaList(e,t){let n=[];for(this.tokens.length<=0&&qr("Invalid type tag.");this.tokens[0][1]!==e&&(n.push(this.parseTypeTag()),!(this.tokens.length>0&&this.tokens[0][1]===e||(this.consume(","),this.tokens.length>0&&this.tokens[0][1]===e&&t)));)this.tokens.length<=0&&qr("Invalid type tag.");return n}parseTypeTag(){this.tokens.length===0&&qr("Invalid type tag.");let[e,t]=this.tokens.shift();if(t==="u8")return new pn;if(t==="u16")return new hn;if(t==="u32")return new gn;if(t==="u64")return new yn;if(t==="u128")return new xn;if(t==="u256")return new mn;if(t==="bool")return new dn;if(t==="address")return new Nr;if(t==="vector"){this.consume("<");let n=this.parseTypeTag();return this.consume(">"),new bn(n)}if(t==="string")return new Wt(Il());if(e==="IDENT"&&(t.startsWith("0x")||t.startsWith("0X"))){let n=M.fromHexInput(t);this.consume("::");let[o,i]=this.tokens.shift();o!=="IDENT"&&qr("Invalid type tag."),this.consume("::");let[a,u]=this.tokens.shift();if(a!=="IDENT"&&qr("Invalid type tag."),M.ONE.toString()===n.toString()&&i==="object"&&u==="Object")return this.consumeWholeGeneric(),new Nr;let d=[];this.tokens.length>0&&this.tokens[0][1]==="<"&&(this.consume("<"),d=this.parseCommaList(">",!0),this.consume(">"));let h=new Tt(n,new $e(i),new $e(u),d);return new Wt(h)}if(e==="GENERIC"){this.typeTags.length===0&&qr("Can't convert generic type since no typeTags were specified.");let n=parseInt(t.substring(1),10);return new Wn(this.typeTags[n]).parseTypeTag()}throw new Error("Invalid type tag.")}},Gs=class extends Error{constructor(e){super(e),this.name="TypeTagParserError"}};function J0(r){let e=0,t=[];for(;e<r.length;){let[n,o]=tg(r,e);n[0]!=="SPACE"&&t.push(n),e+=o}return t}function qr(r){throw new Gs(r)}function Cl(r){return!!r.match(/\s/)}function Bl(r){return!!r.match(/[_A-Za-z0-9]/g)}function eg(r){return!!r.match(/T\d+/g)}function tg(r,e){let t=r[e];if(t===":"){if(r.slice(e,e+2)==="::")return[["COLON","::"],2];qr("Unrecognized token.")}else{if(t==="<")return[["LT","<"],1];if(t===">")return[["GT",">"],1];if(t===",")return[["COMMA",","],1];if(Cl(t)){let n="";for(let o=e;o<r.length;o+=1){let i=r[o];if(Cl(i))n=`${n}${i}`;else break}return[["SPACE",n],n.length]}else if(Bl(t)){let n="";for(let o=e;o<r.length;o+=1){let i=r[o];if(Bl(i))n=`${n}${i}`;else break}return eg(n)?[["GENERIC",n],n.length]:[["IDENT",n],n.length]}}throw new Error("Unrecognized token.")}async function Sa(r){return new Promise(e=>{setTimeout(e,r)})}async function Rl(r){let{aptosConfig:e,options:t}=r;return Wr({aptosConfig:e,originMethod:"getTransactions",path:"transactions",params:{start:t==null?void 0:t.offset,limit:t==null?void 0:t.limit}})}async function Ls(r){let{aptosConfig:e}=r;return Rs(async()=>{let{data:t}=await pt({aptosConfig:e,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return t},`gas-price-${e.network}`,1e3*60*5)()}async function kl(r){let{aptosConfig:e,ledgerVersion:t}=r,{data:n}=await pt({aptosConfig:e,originMethod:"getTransactionByVersion",path:`transactions/by_version/${t}`});return n}async function Fs(r){let{aptosConfig:e,transactionHash:t}=r,{data:n}=await pt({aptosConfig:e,path:`transactions/by_hash/${t}`,originMethod:"getTransactionByHash"});return n}async function Ol(r){let{aptosConfig:e,transactionHash:t}=r;try{return(await Fs({aptosConfig:e,transactionHash:t})).type==="pending_transaction"}catch(n){if((n==null?void 0:n.status)===404)return!0;throw n}}async function $s(r){var E,I,A;let{aptosConfig:e,transactionHash:t,options:n}=r,o=(E=n==null?void 0:n.timeoutSecs)!=null?E:Wo,i=(I=n==null?void 0:n.checkSuccess)!=null?I:!0,a=(A=n==null?void 0:n.indexerVersionCheck)!=null?A:!0,u=!0,d=0,h,x,y=200,T=1.5;for(;u&&!(d>=o);){try{if(h=await Fs({aptosConfig:e,transactionHash:t}),u=h.type==="pending_transaction",!u)break}catch(v){if(!(v instanceof Dt)||(x=v,v.status!==404&&v.status>=400&&v.status<500))throw v}await Sa(y),d+=y/1e3,y*=T}if(h===void 0)throw x||new Uo(`Fetching transaction ${t} failed and timed out after ${o} seconds`,h);if(h.type==="pending_transaction")throw new Uo(`Transaction ${t} timed out in pending state after ${o} seconds`,h);if(!i)return h;if(!h.success)throw new Ua(`Transaction ${t} failed with an error: ${h.vm_status}`,h);if(a)try{await rg({aptosConfig:e,ledgerVersion:Number(h.version)})}catch(v){throw new Uo(`Transaction ${t} committed, but timed out waiting for indexer to sync with ledger version ${h.version}.You can disable this check by setting \`indexerVersionCheck\` to false in the \`extraArgs\` parameter.`,h)}return h}async function rg(r){let{aptosConfig:e,ledgerVersion:t}=r,n=3e3,o=new Date().getTime(),i=-1;for(;i<t;){if(new Date().getTime()-o>n)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(i=await Is({aptosConfig:e}),i>=t)break;await Sa(200)}}var Uo=class extends Error{constructor(t,n){super(t);this.lastSubmittedTransaction=n}},Ua=class extends Error{constructor(t,n){super(t);this.transaction=n}};var vt=class extends le{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return Yt.load(e);case 1:return Co.load(e);case 2:return Xt.load(e);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${t}`)}}},Yt=class extends vt{constructor(t,n){super();this.public_key=t,this.signature=n}serialize(t){t.serializeU32AsUleb128(0),this.public_key.serialize(t),this.signature.serialize(t)}static load(t){let n=qe.deserialize(t),o=We.deserialize(t);return new Yt(n,o)}},Co=class extends vt{constructor(t,n){super();this.public_key=t,this.signature=n}serialize(t){t.serializeU32AsUleb128(1),this.public_key.serialize(t),this.signature.serialize(t)}static load(t){let n=ht.deserialize(t),o=lr.deserialize(t);return new Co(n,o)}},Xt=class extends vt{constructor(t,n){super();this.public_key=t,this.signature=n}serialize(t){t.serializeU32AsUleb128(2),this.public_key.serialize(t),this.signature.serialize(t)}static load(t){let n=ut.deserialize(t),o=It.deserialize(t);return new Xt(n,o)}};var yr=class{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return Dr.load(e);case 1:return Bo.load(e);case 2:return Mr.load(e);case 3:return Gr.load(e);case 4:return Lr.load(e);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${t}`)}}},Dr=class extends yr{constructor(t,n){super();this.public_key=t,this.signature=n}serialize(t){t.serializeU32AsUleb128(0),this.public_key.serialize(t),this.signature.serialize(t)}static load(t){let n=qe.deserialize(t),o=We.deserialize(t);return new Dr(n,o)}},Bo=class extends yr{constructor(t,n){super();this.public_key=t,this.signature=n}serialize(t){t.serializeU32AsUleb128(1),this.public_key.serialize(t),this.signature.serialize(t)}static load(t){let n=ht.deserialize(t),o=lr.deserialize(t);return new Bo(n,o)}},Mr=class extends yr{constructor(t,n,o){super();this.sender=t,this.secondary_signer_addresses=n,this.secondary_signers=o}serialize(t){t.serializeU32AsUleb128(2),this.sender.serialize(t),t.serializeVector(this.secondary_signer_addresses),t.serializeVector(this.secondary_signers)}static load(t){let n=vt.deserialize(t),o=t.deserializeVector(M),i=t.deserializeVector(vt);return new Mr(n,o,i)}},Gr=class extends yr{constructor(t,n,o,i){super();this.sender=t,this.secondary_signer_addresses=n,this.secondary_signers=o,this.fee_payer=i}serialize(t){t.serializeU32AsUleb128(3),this.sender.serialize(t),t.serializeVector(this.secondary_signer_addresses),t.serializeVector(this.secondary_signers),this.fee_payer.address.serialize(t),this.fee_payer.authenticator.serialize(t)}static load(t){let n=vt.deserialize(t),o=t.deserializeVector(M),i=t.deserializeVector(vt),a=M.deserialize(t),u=vt.deserialize(t),d={address:a,authenticator:u};return new Gr(n,o,i,d)}},Lr=class extends yr{constructor(t,n){super();this.public_key=t,this.signature=n}serialize(t){t.serializeU32AsUleb128(4),this.public_key.serialize(t),this.signature.serialize(t)}static load(t){let n=ut.deserialize(t),o=It.deserialize(t);return new Lr(n,o)}};var Fr=class extends le{constructor(t){super();this.chainId=t}serialize(t){t.serializeU8(this.chainId)}static deserialize(t){let n=t.deserializeU8();return new Fr(n)}};var $r=class extends le{constructor(t,n){super();this.address=t,this.name=n}static fromStr(t){let n=t.split("::");if(n.length!==2)throw new Error("Invalid module id.");return new $r(M.fromString(n[0]),new $e(n[1]))}serialize(t){this.address.serialize(t),this.name.serialize(t)}static deserialize(t){let n=M.deserialize(t),o=$e.deserialize(t);return new $r(n,o)}};function ng(r){let e=r.deserializeUleb128AsU32();switch(e){case 0:return Ct.deserialize(r);case 1:return at.deserialize(r);case 2:return Lt.deserialize(r);case 3:return M.deserialize(r);case 4:return Oe.deserialize(r,Ct);case 5:return Ke.deserialize(r);case 6:return Mt.deserialize(r);case 7:return Gt.deserialize(r);case 8:return Ft.deserialize(r);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${e}`)}}var An=class extends le{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return wn.load(e);case 2:return _n.load(e);case 3:return Tn.load(e);default:throw new Error(`Unknown variant index for TransactionPayload: ${t}`)}}},wn=class extends An{constructor(t){super();this.script=t}serialize(t){t.serializeU32AsUleb128(0),this.script.serialize(t)}static load(t){let n=vn.deserialize(t);return new wn(n)}},_n=class extends An{constructor(t){super();this.entryFunction=t}serialize(t){t.serializeU32AsUleb128(2),this.entryFunction.serialize(t)}static load(t){let n=Zt.deserialize(t);return new _n(n)}},Tn=class extends An{constructor(t){super();this.multiSig=t}serialize(t){t.serializeU32AsUleb128(3),this.multiSig.serialize(t)}static load(t){let n=En.deserialize(t);return new Tn(n)}},Zt=class{constructor(e,t,n,o){this.module_name=e,this.function_name=t,this.type_args=n,this.args=o}static build(e,t,n,o){return new Zt($r.fromStr(e),new $e(t),n,o)}serialize(e){this.module_name.serialize(e),this.function_name.serialize(e),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(t=>{t.serializeForEntryFunction(e)})}static deserialize(e){let t=$r.deserialize(e),n=$e.deserialize(e),o=e.deserializeVector(Xe),i=e.deserializeUleb128AsU32(),a=new Array;for(let u=0;u<i;u+=1){let d=e.deserializeUleb128AsU32(),h=tn.deserialize(e,d);a.push(h)}return new Zt(t,n,o,a)}},vn=class{constructor(e,t,n){this.bytecode=e,this.type_args=t,this.args=n}serialize(e){e.serializeBytes(this.bytecode),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(t=>{t.serializeForScriptFunction(e)})}static deserialize(e){let t=e.deserializeBytes(),n=e.deserializeVector(Xe),o=e.deserializeUleb128AsU32(),i=new Array;for(let a=0;a<o;a+=1){let u=ng(e);i.push(u)}return new vn(t,n,i)}},En=class{constructor(e,t){this.multisig_address=e,this.transaction_payload=t}serialize(e){this.multisig_address.serialize(e),this.transaction_payload===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.transaction_payload.serialize(e))}static deserialize(e){let t=M.deserialize(e),n=e.deserializeBool(),o;return n&&(o=Sn.deserialize(e)),new En(t,o)}},Sn=class{constructor(e){this.transaction_payload=e}serialize(e){e.serializeU32AsUleb128(0),this.transaction_payload.serialize(e)}static deserialize(e){return e.deserializeUleb128AsU32(),new Sn(Zt.deserialize(e))}};var Et=class extends le{constructor(t,n,o,i,a,u,d){super();this.sender=t,this.sequence_number=n,this.payload=o,this.max_gas_amount=i,this.gas_unit_price=a,this.expiration_timestamp_secs=u,this.chain_id=d}serialize(t){this.sender.serialize(t),t.serializeU64(this.sequence_number),this.payload.serialize(t),t.serializeU64(this.max_gas_amount),t.serializeU64(this.gas_unit_price),t.serializeU64(this.expiration_timestamp_secs),this.chain_id.serialize(t)}static deserialize(t){let n=M.deserialize(t),o=t.deserializeU64(),i=An.deserialize(t),a=t.deserializeU64(),u=t.deserializeU64(),d=t.deserializeU64(),h=Fr.deserialize(t);return new Et(n,o,i,a,u,d,h)}},js=class extends le{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return Jt.load(e);case 1:return er.load(e);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${t}`)}}},Jt=class extends js{constructor(t,n){super();this.raw_txn=t,this.secondary_signer_addresses=n}serialize(t){t.serializeU32AsUleb128(0),this.raw_txn.serialize(t),t.serializeVector(this.secondary_signer_addresses)}static load(t){let n=Et.deserialize(t),o=t.deserializeVector(M);return new Jt(n,o)}},er=class extends js{constructor(t,n,o){super();this.raw_txn=t,this.secondary_signer_addresses=n,this.fee_payer_address=o}serialize(t){t.serializeU32AsUleb128(1),this.raw_txn.serialize(t),t.serializeVector(this.secondary_signer_addresses),this.fee_payer_address.serialize(t)}static load(t){let n=Et.deserialize(t),o=t.deserializeVector(M),i=M.deserialize(t);return new er(n,o,i)}};var kt=class extends le{constructor(t,n){super();this.raw_txn=t,this.authenticator=n}serialize(t){this.raw_txn.serialize(t),this.authenticator.serialize(t)}static deserialize(t){let n=Et.deserialize(t),o=yr.deserialize(t);return new kt(n,o)}};function zl(r){var t,n,o;if("bytecode"in r)return new wn(new vn(te.fromHexInput(r.bytecode).toUint8Array(),(t=r.typeArguments)!=null?t:[],r.arguments));if("multisigAddress"in r){let i=r.function.split("::");return new Tn(new En(r.multisigAddress,new Sn(Zt.build(`${i[0]}::${i[1]}`,i[2],(n=r.typeArguments)!=null?n:[],r.arguments))))}let e=r.function.split("::");return new _n(Zt.build(`${e[0]}::${e[1]}`,e[2],(o=r.typeArguments)!=null?o:[],r.arguments))}async function og(r){let{aptosConfig:e,sender:t,payload:n,options:o}=r,i=o!=null&&o.accountSequenceNumber?Promise.resolve({sequence_number:o.accountSequenceNumber}):ks({aptosConfig:e,accountAddress:t}),a=Qo[e.network]?Promise.resolve({chain_id:Qo[e.network]}):Cs({aptosConfig:e}),u=o!=null&&o.gasUnitPrice?Promise.resolve({gas_estimate:o.gasUnitPrice}):Ls({aptosConfig:e}),[{sequence_number:d},{chain_id:h},{gas_estimate:x}]=await Promise.all([i,a,u]),{maxGasAmount:y,gasUnitPrice:T,expireTimestamp:E}={maxGasAmount:BigInt(Qa),gasUnitPrice:BigInt(x),expireTimestamp:BigInt(Math.floor(Date.now()/1e3)+Wa),...o};return new Et(M.fromHexInput(t),BigInt(d),n,BigInt(y),BigInt(T),BigInt(E),new Fr(h))}async function Pl(r){let{aptosConfig:e,sender:t,payload:n,options:o,secondarySignerAddresses:i,feePayerAddress:a}=r,u=await og({aptosConfig:e,sender:t,payload:n,options:o});if(a){let d=i?i.map(h=>M.fromHexInput(h)):[];return{rawTransaction:u.bcsToBytes(),secondarySignerAddresses:d,feePayerAddress:M.fromHexInput(a)}}if(i){let d=i.map(h=>M.fromHexInput(h));return{rawTransaction:u.bcsToBytes(),secondarySignerAddresses:d}}return{rawTransaction:u.bcsToBytes()}}function Hl(r){var h,x;let{signerPublicKey:e,transaction:t,secondarySignersPublicKeys:n,feePayerPublicKey:o}=r,i=new en(t.rawTransaction),a=Et.deserialize(i),u=Ks(e);if(t.feePayerAddress){let y=new er(a,(h=t.secondarySignerAddresses)!=null?h:[],t.feePayerAddress),T=[];n&&(T=n.map(A=>Ks(A)));let E=Ks(o),I=new Gr(u,(x=t.secondarySignerAddresses)!=null?x:[],T,{address:t.feePayerAddress,authenticator:E});return new kt(y.raw_txn,I).bcsToBytes()}if(t.secondarySignerAddresses){let y=new Jt(a,t.secondarySignerAddresses),T=[];T=n.map(I=>Ks(I));let E=new Mr(u,t.secondarySignerAddresses,T);return new kt(y.raw_txn,E).bcsToBytes()}let d;if(u instanceof Yt)d=new Dr(u.public_key,u.signature);else if(u instanceof Xt)d=new Lr(u.public_key,u.signature);else throw new Error("Invalid public key");return new kt(a,d).bcsToBytes()}function Ks(r){return r instanceof qe?new Yt(new qe(r.toUint8Array()),new We(new Uint8Array(64))):new Xt(new ut(r.toUint8Array()),new It(new Uint8Array(64)))}function ql(r){let{signer:e,transaction:t}=r,n=Dl(t),o=ig(n),i=e.sign(o);switch(e.signingScheme){case 0:return new Yt(new qe(e.publicKey.toUint8Array()),new We(i.toUint8Array()));case 2:return new Xt(new ut(e.publicKey.toUint8Array()),new It(i.toUint8Array()));default:throw new Error(`Cannot sign transaction, signing scheme ${e.signingScheme} not supported`)}}function Nl(r){let{transaction:e,senderAuthenticator:t,secondarySignerAuthenticators:n}=r,o=Dl(e);if(n)return sg(o,t,n);let i=new en(t.bcsToBytes()),a=vt.deserialize(i);if(a instanceof Yt){let u=new Dr(a.public_key,a.signature);return new kt(o,u).bcsToBytes()}if(a instanceof Xt){let u=new Lr(a.public_key,a.signature);return new kt(o,u).bcsToBytes()}throw new Error(`Cannot generate a signed transaction, ${a} is not a supported account authentication scheme`)}function Dl(r){var n;let e=new en(r.rawTransaction),t=Et.deserialize(e);return r.feePayerAddress?new er(t,(n=r.secondarySignerAddresses)!=null?n:[],r.feePayerAddress):r.secondarySignerAddresses?new Jt(t,r.secondarySignerAddresses):t}function sg(r,e,t){if(r instanceof er){if(!t.feePayerAuthenticator)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");let{feePayerAuthenticator:n,additionalSignersAuthenticators:o}=t,i=new Gr(e,r.secondary_signer_addresses,o!=null?o:[],{address:r.fee_payer_address,authenticator:n});return new kt(r.raw_txn,i).bcsToBytes()}if(r instanceof Jt){if(!t.additionalSignersAuthenticators)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");let{additionalSignersAuthenticators:n}=t,o=new Mr(e,r.secondary_signer_addresses,n!=null?n:[]);return new kt(r.raw_txn,o).bcsToBytes()}throw new Error(`Cannot prepare multi signers transaction to submission, ${typeof r} transaction is not supported`)}function ig(r){let e=Jr.create();if(r instanceof Et)e.update(Xa);else if(r instanceof Jt)e.update(pi);else if(r instanceof er)e.update(pi);else throw new Error(`Unknown transaction type to sign on: ${r}`);let t=e.digest(),n=r.bcsToBytes(),o=new Uint8Array(t.length+n.length);return o.set(t),o.set(n,t.length),o}async function jr(r){let{aptosConfig:e,sender:t,data:n,options:o,secondarySignerAddresses:i,feePayerAddress:a}=r,u=await zl(n);return Pl({aptosConfig:e,sender:t,payload:u,options:o,secondarySignerAddresses:i,feePayerAddress:a})}function Ca(r){return ql({...r})}async function Ml(r){var h,x,y,T,E,I;let{aptosConfig:e,transaction:t,signerPublicKey:n,secondarySignersPublicKeys:o,feePayerPublicKey:i,options:a}=r,u=Hl({transaction:t,signerPublicKey:n,secondarySignersPublicKeys:o,feePayerPublicKey:i,options:a}),{data:d}=await Yr({aptosConfig:e,body:u,path:"transactions/simulate",params:{estimate_gas_unit_price:(x=(h=r.options)==null?void 0:h.estimateGasUnitPrice)!=null?x:!1,estimate_max_gas_amount:(T=(y=r.options)==null?void 0:y.estimateMaxGasAmount)!=null?T:!1,estimate_prioritized_gas_unit_price:(I=(E=r.options)==null?void 0:E.estimatePrioritizedGasUnitPrice)!=null?I:!1},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return d}async function Ba(r){let{aptosConfig:e}=r,t=Nl({...r}),{data:n}=await Yr({aptosConfig:e,body:t,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return n}async function Gl(r){let{aptosConfig:e,signer:t,transaction:n}=r,o=Ca({signer:t,transaction:n});return Ba({aptosConfig:e,transaction:n,senderAuthenticator:o})}async function Ll(r){let{aptosConfig:e,account:t,metadataBytes:n,byteCode:o,options:i}=r;return await jr({aptosConfig:e,sender:t,data:{function:"0x1::code::publish_package_txn",arguments:[Oe.U8(n),new Oe([Oe.U8(o)])]},options:i})}async function Fl(r){let{aptosConfig:e,sender:t,recipient:n,amount:o,coinType:i,options:a}=r,u=i!=null?i:Ya;return await jr({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[new Wt(Tt.fromString(u))],arguments:[M.fromHexInput(n),new at(o)]},options:a})}var Io=class{constructor(e){this.config=e}async transferCoinTransaction(e){return Fl({aptosConfig:this.config,...e})}};async function $l(r){let{aptosConfig:e,options:t,creator:n}=r;return await jr({aptosConfig:e,sender:n.accountAddress.toString(),data:{function:"0x4::aptos_token::mint",arguments:[new lt(r.collection),new lt(r.description),new lt(r.name),new lt(r.uri),Oe.MoveString([]),Oe.MoveString([]),new Oe([])]},options:t})}async function jl(r){let{aptosConfig:e,tokenAddress:t}=r,n={token_data_id:{_eq:te.fromHexInput(t).toString()}};return(await ke({aptosConfig:e,query:{query:ju,variables:{where_condition:n}},originMethod:"getTokenData"})).current_token_datas_v2[0]}async function Kl(r){let{aptosConfig:e,tokenAddress:t}=r,n={token_data_id:{_eq:te.fromHexInput(t).toString()}};return(await ke({aptosConfig:e,query:{query:ta,variables:{where_condition:n}},originMethod:"getCurrentTokenOwnership"})).current_token_ownerships_v2[0]}async function Vl(r){var u,d;let{aptosConfig:e,ownerAddress:t,options:n}=r,o={owner_address:{_eq:te.fromHexInput(t).toString()}},i={query:ta,variables:{where_condition:o,offset:(u=n==null?void 0:n.pagination)==null?void 0:u.offset,limit:(d=n==null?void 0:n.pagination)==null?void 0:d.limit,order_by:n==null?void 0:n.orderBy}};return(await ke({aptosConfig:e,query:i,originMethod:"getOwnedTokens"})).current_token_ownerships_v2}async function Ql(r){var u,d;let{aptosConfig:e,tokenAddress:t,options:n}=r,o={token_data_id:{_eq:te.fromHexInput(t).toString()}},i={query:$u,variables:{where_condition:o,offset:(u=n==null?void 0:n.pagination)==null?void 0:u.offset,limit:(d=n==null?void 0:n.pagination)==null?void 0:d.limit,order_by:n==null?void 0:n.orderBy}};return(await ke({aptosConfig:e,query:i,originMethod:"getTokenActivity"})).token_activities_v2}async function Wl(r){var i,a,u,d,h,x,y,T,E,I,A,v;let{aptosConfig:e,options:t,creator:n}=r;return await jr({aptosConfig:e,sender:n.accountAddress.toString(),data:{function:"0x4::aptos_token::create_collection",arguments:[new lt(r.description),new at((i=r.maxSupply)!=null?i:Xr),new lt(r.name),new lt(r.uri),new Ke((a=r.mutableDescription)!=null?a:!0),new Ke((u=r.mutableRoyalty)!=null?u:!0),new Ke((d=r.mutableURI)!=null?d:!0),new Ke((h=r.mutableTokenDescription)!=null?h:!0),new Ke((x=r.mutableTokenName)!=null?x:!0),new Ke((y=r.mutableTokenProperties)!=null?y:!0),new Ke((T=r.mutableTokenURI)!=null?T:!0),new Ke((E=r.tokensBurnableByCreator)!=null?E:!0),new Ke((I=r.tokensFreezableByCreator)!=null?I:!0),new at((A=r.royaltyNumerator)!=null?A:0),new at((v=r.royaltyDenominator)!=null?v:1)]},options:t})}async function Ia(r){var h;let{aptosConfig:e,creatorAddress:t,collectionName:n,options:o}=r,i=te.fromHexInput(t).toString(),a={collection_name:{_eq:n},creator_address:{_eq:i}};o!=null&&o.tokenStandard&&(a.token_standard={_eq:(h=o==null?void 0:o.tokenStandard)!=null?h:"v2"});let d=await ke({aptosConfig:e,query:{query:qu,variables:{where_condition:a}},originMethod:"getCollectionData"});if(d.current_collections_v2.length===0)throw Error("Collection not found");return d.current_collections_v2[0]}async function Yl(r){return(await Ia(r)).collection_id}var Ro=class{constructor(e){this.config=e}async createCollectionTransaction(e){return Wl({aptosConfig:this.config,...e})}async getCollectionData(e){return Ia({aptosConfig:this.config,...e})}async getCollectionId(e){return Yl({aptosConfig:this.config,...e})}async mintTokenTransaction(e){return $l({aptosConfig:this.config,...e})}async getTokenData(e){return jl({aptosConfig:this.config,...e})}async getCurrentTokenOwnership(e){return Kl({aptosConfig:this.config,...e})}async getOwnedTokens(e){return Vl({aptosConfig:this.config,...e})}async getTokenActivity(e){return Ql({aptosConfig:this.config,...e})}};async function Xl(r){let{accountAddress:e,aptosConfig:t,creationNumber:n}=r,i={account_address:{_eq:M.fromHexInput(e).toString()},creation_number:{_eq:n}};return Vs({aptosConfig:t,options:{where:i}})}async function Zl(r){let{accountAddress:e,aptosConfig:t,eventType:n,options:o}=r,u={where:{account_address:{_eq:M.fromHexInput(e).toString()},type:{_eq:n}},pagination:o==null?void 0:o.pagination,orderBy:o==null?void 0:o.orderBy};return Vs({aptosConfig:t,options:u})}async function Vs(r){var i,a;let{aptosConfig:e,options:t}=r,n={query:Mu,variables:{where_condition:t==null?void 0:t.where,offset:(i=t==null?void 0:t.pagination)==null?void 0:i.offset,limit:(a=t==null?void 0:t.pagination)==null?void 0:a.limit,order_by:t==null?void 0:t.orderBy}};return(await ke({aptosConfig:e,query:n,originMethod:"getEvents"})).events}var ko=class{constructor(e){this.config=e}async getAccountEventsByCreationNumber(e){return Xl({aptosConfig:this.config,...e})}async getAccountEventsByEventType(e){return Zl({aptosConfig:this.config,...e})}async getEvents(e){return Vs({aptosConfig:this.config,...e})}};async function Jl(r){var u;let{aptosConfig:e,accountAddress:t,amount:n}=r,o=(u=r.timeoutSecs)!=null?u:Wo,{data:i}=await gi({aptosConfig:e,path:"fund",body:{address:M.fromHexInput(t).toString(),amount:n},originMethod:"fundAccount"}),a=i.txn_hashes[0];return await $s({aptosConfig:e,transactionHash:a,options:{timeoutSecs:o}}),a}var Oo=class{constructor(e){this.config=e}async fundAccount(e){return Jl({aptosConfig:this.config,...e})}};async function ed(r){var i,a;let{aptosConfig:e,options:t}=r,n={query:Lu,variables:{where_condition:t==null?void 0:t.where,limit:(i=t==null?void 0:t.pagination)==null?void 0:i.limit,offset:(a=t==null?void 0:t.pagination)==null?void 0:a.offset}};return(await ke({aptosConfig:e,query:n,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function td(r){var i,a;let{aptosConfig:e,options:t}=r,n={query:Gu,variables:{where_condition:t==null?void 0:t.where,limit:(i=t==null?void 0:t.pagination)==null?void 0:i.limit,offset:(a=t==null?void 0:t.pagination)==null?void 0:a.offset}};return(await ke({aptosConfig:e,query:n,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function rd(r){var i,a;let{aptosConfig:e,options:t}=r,n={query:Nu,variables:{where_condition:t==null?void 0:t.where,limit:(i=t==null?void 0:t.pagination)==null?void 0:i.limit,offset:(a=t==null?void 0:t.pagination)==null?void 0:a.offset}};return(await ke({aptosConfig:e,query:n,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var zo=class{constructor(e){this.config=e}async getFungibleAssetMetadata(e){return ed({aptosConfig:this.config,...e})}async getFungibleAssetActivities(e){return td({aptosConfig:this.config,...e})}async getCurrentFungibleAssetBalances(e){return rd({aptosConfig:this.config,...e})}};var Po=class{constructor(e){this.config=e}async getLedgerInfo(){return Cs({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(e){return Ku({aptosConfig:this.config,...e})}async getBlockByHeight(e){return Vu({aptosConfig:this.config,...e})}async getTableItem(e){return Bs({aptosConfig:this.config,...e})}async view(e){return Qu({aptosConfig:this.config,...e})}async getChainTopUserTransactions(e){return Wu({aptosConfig:this.config,...e})}async queryIndexer(e){return ke({aptosConfig:this.config,...e})}async getIndexerLastSuccessVersion(){return Is({aptosConfig:this.config})}};async function nd(r){let{aptosConfig:e,poolAddress:t}=r,n=te.fromHexInput(t).toString(),i=await ke({aptosConfig:e,query:{query:ea,variables:{where_condition:{pool_address:{_eq:n}}}}});if(i.num_active_delegator_per_pool.length===0)throw Error("Delegator pool not found");return i.num_active_delegator_per_pool[0].num_active_delegator}async function od(r){let{aptosConfig:e,options:t}=r,n={query:ea,variables:{where_condition:{},order_by:t==null?void 0:t.orderBy}};return(await ke({aptosConfig:e,query:n})).num_active_delegator_per_pool}async function sd(r){let{aptosConfig:e,delegatorAddress:t,poolAddress:n}=r,o={query:Du,variables:{delegatorAddress:te.fromHexInput(t).toString(),poolAddress:te.fromHexInput(n).toString()}};return(await ke({aptosConfig:e,query:o})).delegated_staking_activities}var Ho=class{constructor(e){this.config=e}async getNumberOfDelegators(e){return nd({aptosConfig:this.config,...e})}async getNumberOfDelegatorsForAllPools(e){return od({aptosConfig:this.config,...e})}async getDelegatedStakingActivities(e){return sd({aptosConfig:this.config,...e})}};var qo=class{constructor(e){this.config=e}async getTransactions(e){return Rl({aptosConfig:this.config,...e})}async getTransactionByVersion(e){return kl({aptosConfig:this.config,...e})}async getTransactionByHash(e){return Fs({aptosConfig:this.config,...e})}async isPendingTransaction(e){return Ol({aptosConfig:this.config,...e})}async waitForTransaction(e){return $s({aptosConfig:this.config,...e})}async getGasPriceEstimation(){return Ls({aptosConfig:this.config})}};var No=class{constructor(e){this.config=e}async generateTransaction(e){return jr({aptosConfig:this.config,...e})}signTransaction(e){return Ca({...e})}async simulateTransaction(e){return Ml({aptosConfig:this.config,...e})}async submitTransaction(e){return Ba({aptosConfig:this.config,...e})}async signAndSubmitTransaction(e){let{signer:t,transaction:n}=e;return Gl({aptosConfig:this.config,signer:t,transaction:n})}async publishModuleTransaction(e){return Ll({aptosConfig:this.config,...e})}};var St=class{constructor(e){this.config=new So(e),this.account=new To(this.config),this.coin=new Io(this.config),this.digitalAsset=new Ro(this.config),this.event=new ko(this.config),this.faucet=new Oo(this.config),this.fungibleAsset=new zo(this.config),this.general=new Po(this.config),this.staking=new Ho(this.config),this.transaction=new qo(this.config),this.transactionSubmission=new No(this.config)}};function tr(r,e,t){Object.getOwnPropertyNames(e.prototype).forEach(n=>{let o=Object.getOwnPropertyDescriptor(e.prototype,n);!o||(o.value=function(...i){return this[t][n](...i)},Object.defineProperty(r.prototype,n,o))})}tr(St,To,"account");tr(St,Io,"coin");tr(St,Ro,"digitalAsset");tr(St,ko,"event");tr(St,Oo,"faucet");tr(St,zo,"fungibleAsset");tr(St,Po,"general");tr(St,Ho,"staking");tr(St,qo,"transaction");tr(St,No,"transactionSubmission");return hd(ag);})();
405
+ `;async function Rs(r){let{aptosConfig:t}=r,{data:e}=await pt({aptosConfig:t,originMethod:"getLedgerInfo",path:""});return e}async function Ju(r){let{aptosConfig:t,ledgerVersion:e,options:n}=r,{data:o}=await pt({aptosConfig:t,originMethod:"getBlockByVersion",path:`blocks/by_version/${e}`,params:{with_transactions:n==null?void 0:n.withTransactions}});return o}async function ef(r){let{aptosConfig:t,blockHeight:e,options:n}=r,{data:o}=await pt({aptosConfig:t,originMethod:"getBlockByHeight",path:`blocks/by_height/${e}`,params:{with_transactions:n==null?void 0:n.withTransactions}});return o}async function ks(r){let{aptosConfig:t,handle:e,data:n,options:o}=r;return(await tn({aptosConfig:t,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:o==null?void 0:o.ledgerVersion},body:n})).data}async function tf(r){var i,a;let{aptosConfig:t,payload:e,options:n}=r,{data:o}=await tn({aptosConfig:t,originMethod:"view",path:"view",params:{ledger_version:n==null?void 0:n.ledgerVersion},body:{function:e.function,type_arguments:(i=e.typeArguments)!=null?i:[],arguments:(a=e.functionArguments)!=null?a:[]}});return o}async function rf(r){let{aptosConfig:t,limit:e}=r;return(await ke({aptosConfig:t,query:{query:Fu,variables:{limit:e}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function ke(r){let{aptosConfig:t,query:e,originMethod:n}=r,{data:o}=await bi({aptosConfig:t,originMethod:n!=null?n:"queryIndexer",path:"",body:e,overrides:{WITH_CREDENTIALS:!1}});return o}async function t0(r){let{aptosConfig:t}=r;return(await ke({aptosConfig:t,query:{query:Yu},originMethod:"getProcessorStatuses"})).processor_status}async function Os(r){return(await t0({aptosConfig:r.aptosConfig}))[0].last_success_version}var aa=new Map;function Ps(r,t,e){return async(...n)=>{if(aa.has(t)){let{value:i,timestamp:a}=aa.get(t);if(e===void 0||Date.now()-a<=e)return i}let o=await r(...n);return aa.set(t,{value:o,timestamp:Date.now()}),o}}async function Eo(r){let{aptosConfig:t,accountAddress:e}=r,{data:n}=await pt({aptosConfig:t,originMethod:"getInfo",path:`accounts/${D.fromHexInput(e).toString()}`});return n}async function sf(r){var o;let{aptosConfig:t,accountAddress:e,options:n}=r;return en({aptosConfig:t,originMethod:"getModules",path:`accounts/${D.fromHexInput(e).toString()}/modules`,params:{ledger_version:n==null?void 0:n.ledgerVersion,start:n==null?void 0:n.offset,limit:(o=n==null?void 0:n.limit)!=null?o:1e3}})}async function af(r){var t;return((t=r.options)==null?void 0:t.ledgerVersion)!==void 0?nf(r):Ps(async()=>nf(r),`module-${r.accountAddress}-${r.moduleName}`,1e3*60*5)()}async function nf(r){let{aptosConfig:t,accountAddress:e,moduleName:n,options:o}=r,{data:i}=await pt({aptosConfig:t,originMethod:"getModule",path:`accounts/${D.fromHexInput(e).toString()}/module/${n}`,params:{ledger_version:o==null?void 0:o.ledgerVersion}});return i}async function cf(r){let{aptosConfig:t,accountAddress:e,options:n}=r;return en({aptosConfig:t,originMethod:"getTransactions",path:`accounts/${D.fromHexInput(e).toString()}/transactions`,params:{start:n==null?void 0:n.offset,limit:n==null?void 0:n.limit}})}async function uf(r){var o;let{aptosConfig:t,accountAddress:e,options:n}=r;return en({aptosConfig:t,originMethod:"getResources",path:`accounts/${D.fromHexInput(e).toString()}/resources`,params:{ledger_version:n==null?void 0:n.ledgerVersion,start:n==null?void 0:n.offset,limit:(o=n==null?void 0:n.limit)!=null?o:999}})}async function ca(r){let{aptosConfig:t,accountAddress:e,resourceType:n,options:o}=r,{data:i}=await pt({aptosConfig:t,originMethod:"getResource",path:`accounts/${D.fromHexInput(e).toString()}/resource/${n}`,params:{ledger_version:o==null?void 0:o.ledgerVersion}});return i.data}async function ua(r){let{aptosConfig:t,authenticationKey:e,options:n}=r,o=await ca({aptosConfig:t,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:n}),{address_map:{handle:i}}=o;try{let a=await ks({aptosConfig:t,handle:i,data:{key:te.fromHexInput(e).toString(),key_type:"address",value_type:"address"},options:n});return D.fromHexInput(a)}catch(a){if(a instanceof Kt&&a.data.error_code==="table_item_not_found")return D.fromHexInput(e);throw a}}async function ff(r){let{aptosConfig:t,accountAddress:e}=r,o={owner_address:{_eq:D.fromHexInput(e).toString()},amount:{_gt:"0"}},a=await ke({aptosConfig:t,query:{query:Gu,variables:{where_condition:o}},originMethod:"getAccountTokensCount"});if(!a.current_token_ownerships_v2_aggregate.aggregate)throw Error("Failed to get the count of account tokens");return a.current_token_ownerships_v2_aggregate.aggregate.count}async function lf(r){var d,h;let{aptosConfig:t,accountAddress:e,options:n}=r,i={owner_address:{_eq:D.fromHexInput(e).toString()},amount:{_gt:0}};n!=null&&n.tokenStandard&&(i.token_standard={_eq:n==null?void 0:n.tokenStandard});let a={query:Nu,variables:{where_condition:i,offset:(d=n==null?void 0:n.pagination)==null?void 0:d.offset,limit:(h=n==null?void 0:n.pagination)==null?void 0:h.limit,order_by:n==null?void 0:n.orderBy}};return(await ke({aptosConfig:t,query:a,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function df(r){var x,y;let{aptosConfig:t,accountAddress:e,collectionAddress:n,options:o}=r,i=D.fromHexInput(e).toString(),a=te.fromHexInput(n).toString(),u={owner_address:{_eq:i},current_token_data:{collection_id:{_eq:a}},amount:{_gt:0}};o!=null&&o.tokenStandard&&(u.token_standard={_eq:o==null?void 0:o.tokenStandard});let d={query:Mu,variables:{where_condition:u,offset:(x=o==null?void 0:o.pagination)==null?void 0:x.offset,limit:(y=o==null?void 0:o.pagination)==null?void 0:y.limit,order_by:o==null?void 0:o.orderBy}};return(await ke({aptosConfig:t,query:d,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function pf(r){var d,h;let{aptosConfig:t,accountAddress:e,options:n}=r,i={owner_address:{_eq:D.fromHexInput(e).toString()},amount:{_gt:0}};n!=null&&n.tokenStandard&&(i.current_collection={token_standard:{_eq:n==null?void 0:n.tokenStandard}});let a={query:Du,variables:{where_condition:i,offset:(d=n==null?void 0:n.pagination)==null?void 0:d.offset,limit:(h=n==null?void 0:n.pagination)==null?void 0:h.limit,order_by:n==null?void 0:n.orderBy}};return(await ke({aptosConfig:t,query:a,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function hf(r){let{aptosConfig:t,accountAddress:e}=r,n=D.fromHexInput(e).toString(),i=await ke({aptosConfig:t,query:{query:Lu,variables:{address:n}},originMethod:"getAccountTransactionsCount"});if(!i.account_transactions_aggregate.aggregate)throw Error("Failed to get the count of account transactions");return i.account_transactions_aggregate.aggregate.count}async function gf(r){var d,h;let{aptosConfig:t,accountAddress:e,options:n}=r,i={owner_address:{_eq:D.fromHexInput(e).toString()}},a={query:Hu,variables:{where_condition:i,offset:(d=n==null?void 0:n.pagination)==null?void 0:d.offset,limit:(h=n==null?void 0:n.pagination)==null?void 0:h.limit,order_by:n==null?void 0:n.orderBy}};return(await ke({aptosConfig:t,query:a,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function yf(r){let{aptosConfig:t,accountAddress:e}=r,n=D.fromHexInput(e).toString(),i=await ke({aptosConfig:t,query:{query:zu,variables:{address:n}},originMethod:"getAccountCoinsCount"});if(!i.current_fungible_asset_balances_aggregate.aggregate)throw Error("Failed to get the count of account coins");return i.current_fungible_asset_balances_aggregate.aggregate.count}async function xf(r){var d,h;let{aptosConfig:t,accountAddress:e,options:n}=r,i={owner_address:{_eq:D.fromHexInput(e).toString()}},a={query:qu,variables:{where_condition:i,offset:(d=n==null?void 0:n.pagination)==null?void 0:d.offset,limit:(h=n==null?void 0:n.pagination)==null?void 0:h.limit,order_by:n==null?void 0:n.orderBy}};return(await ke({aptosConfig:t,query:a,originMethod:"getAccountOwnedObjects"})).current_objects}async function mf(r){let{aptosConfig:t,privateKey:e}=r,n=new rt(e.publicKey());if(e instanceof Or){let o=Xt.fromPublicKeyAndScheme({publicKey:n,scheme:2}),i=new D({data:o.toUint8Array()});return vt.fromPrivateKey({privateKey:e,address:i})}if(e instanceof pr){let o=Xt.fromPublicKeyAndScheme({publicKey:n,scheme:2});if(await of({authKey:o,aptosConfig:t})){let d=new D({data:o.toUint8Array()});return vt.fromPrivateKey({privateKey:e,address:d})}let a=Xt.fromPublicKeyAndScheme({publicKey:n,scheme:0});if(await of({authKey:a,aptosConfig:t})){let d=new D({data:a.toUint8Array()});return vt.fromPrivateKey({privateKey:e,address:d,legacy:!0})}}throw new Error(`Can't derive account from private key ${e}`)}async function of(r){let{aptosConfig:t,authKey:e}=r,n=await ua({aptosConfig:t,authenticationKey:e.toString()});try{return await Eo({aptosConfig:t,accountAddress:n.toString()}),!0}catch(o){if(o.status===404)return!1;throw new Error(`Error while looking for an account info ${n.toString()}`)}}var So=class{constructor(t){this.config=t}async getAccountInfo(t){return Eo({aptosConfig:this.config,...t})}async getAccountModules(t){return sf({aptosConfig:this.config,...t})}async getAccountModule(t){return af({aptosConfig:this.config,...t})}async getAccountTransactions(t){return cf({aptosConfig:this.config,...t})}async getAccountResources(t){return uf({aptosConfig:this.config,...t})}async getAccountResource(t){return ca({aptosConfig:this.config,...t})}async lookupOriginalAccountAddress(t){return ua({aptosConfig:this.config,...t})}async getAccountTokensCount(t){return ff({aptosConfig:this.config,...t})}async getAccountOwnedTokens(t){return lf({aptosConfig:this.config,...t})}async getAccountOwnedTokensFromCollectionAddress(t){return df({aptosConfig:this.config,...t})}async getAccountCollectionsWithOwnedTokens(t){return pf({aptosConfig:this.config,...t})}async getAccountTransactionsCount(t){return hf({aptosConfig:this.config,...t})}async getAccountCoinsData(t){return gf({aptosConfig:this.config,...t})}async getAccountCoinsCount(t){return yf({aptosConfig:this.config,...t})}async getAccountOwnedObjects(t){return xf({aptosConfig:this.config,...t})}async deriveAccountFromPrivateKey(t){return mf({aptosConfig:this.config,...t})}};var Pl=ii(Ol(),1);async function zl(r){var t;let{params:e,method:n,url:o,headers:i,body:a,overrides:u}=r,d={headers:i,method:n,url:o,params:e,data:a,withCredentials:(t=u==null?void 0:u.WITH_CREDENTIALS)!=null?t:!0};try{let h=await(0,Pl.default)(d);return{status:h.status,statusText:h.statusText,data:h.data,headers:h.headers,config:h.config}}catch(h){let x=h;if(x.response)return x.response;throw h}}var Bo=class{constructor(t){var e,n,o;this.network=(e=t==null?void 0:t.network)!=null?e:ec,this.fullnode=t==null?void 0:t.fullnode,this.faucet=t==null?void 0:t.faucet,this.indexer=t==null?void 0:t.indexer,this.client=(n=t==null?void 0:t.client)!=null?n:{provider:zl},this.clientConfig=(o=t==null?void 0:t.clientConfig)!=null?o:{}}getRequestUrl(t){switch(t){case 0:if(this.fullnode!==void 0)return this.fullnode;if(this.network==="custom")throw new Error("Please provide a custom full node url");return yi[this.network];case 2:if(this.faucet!==void 0)return this.faucet;if(this.network==="custom")throw new Error("Please provide a custom faucet url");return xi[this.network];case 1:if(this.indexer!==void 0)return this.indexer;if(this.network==="custom")throw new Error("Please provide a custom indexer url");return Wo[this.network];default:throw Error(`apiType ${t} is not supported`)}}isIndexerRequest(t){return Wo[this.network]===t}};var Ke=class extends ae{constructor(e){super();this.identifier=e}serialize(e){e.serializeStr(this.identifier)}static deserialize(e){let n=e.deserializeStr();return new Ke(n)}};var Xe=class extends ae{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return yn.load(t);case 1:return xn.load(t);case 2:return An.load(t);case 3:return wn.load(t);case 4:return Fr.load(t);case 5:return to.load(t);case 6:return Tn.load(t);case 7:return tr.load(t);case 8:return mn.load(t);case 9:return bn.load(t);case 10:return _n.load(t);default:throw new Error(`Unknown variant index for TypeTag: ${e}`)}}},yn=class extends Xe{serialize(t){t.serializeU32AsUleb128(0)}static load(t){return new yn}},xn=class extends Xe{serialize(t){t.serializeU32AsUleb128(1)}static load(t){return new xn}},mn=class extends Xe{serialize(t){t.serializeU32AsUleb128(8)}static load(t){return new mn}},bn=class extends Xe{serialize(t){t.serializeU32AsUleb128(9)}static load(t){return new bn}},An=class extends Xe{serialize(t){t.serializeU32AsUleb128(2)}static load(t){return new An}},wn=class extends Xe{serialize(t){t.serializeU32AsUleb128(3)}static load(t){return new wn}},_n=class extends Xe{serialize(t){t.serializeU32AsUleb128(10)}static load(t){return new _n}},Fr=class extends Xe{serialize(t){t.serializeU32AsUleb128(4)}static load(t){return new Fr}},to=class extends Xe{serialize(t){t.serializeU32AsUleb128(5)}static load(t){return new to}},Tn=class extends Xe{constructor(e){super();this.value=e}serialize(e){e.serializeU32AsUleb128(6),this.value.serialize(e)}static load(e){let n=Xe.deserialize(e);return new Tn(n)}},tr=class extends Xe{constructor(e){super();this.value=e}serialize(e){e.serializeU32AsUleb128(7),this.value.serialize(e)}static load(e){let n=St.deserialize(e);return new tr(n)}isStringTypeTag(){return this.value.module_name.identifier==="string"&&this.value.name.identifier==="String"&&this.value.address.toString()===D.ONE.toString()}},St=class extends ae{constructor(e,n,o,i){super();this.address=e,this.module_name=n,this.name=o,this.type_args=i}static fromString(e){let n=new ro(e).parseTypeTag();return new St(n.value.address,n.value.module_name,n.value.name,n.value.type_args)}serialize(e){e.serialize(this.address),e.serialize(this.module_name),e.serialize(this.name),e.serializeVector(this.type_args)}static deserialize(e){let n=D.deserialize(e),o=Ke.deserialize(e),i=Ke.deserialize(e),a=e.deserializeVector(Xe);return new St(n,o,i,a)}},ql=()=>new St(D.ONE,new Ke("string"),new Ke("String"),[]);function og(r){return new St(D.ONE,new Ke("option"),new Ke("Option"),[r])}function sg(r){return new St(D.ONE,new Ke("object"),new Ke("Object"),[r])}var ro=class{constructor(t,e){this.typeTags=[];this.tokens=ig(t),this.typeTags=e||[]}consume(t){let e=this.tokens.shift();(!e||e[1]!==t)&&Lr("Invalid type tag.")}consumeWholeGeneric(){for(this.consume("<");this.tokens[0][1]!==">";)this.tokens[0][1]==="<"?this.consumeWholeGeneric():this.tokens.shift();this.consume(">")}parseCommaList(t,e){let n=[];for(this.tokens.length<=0&&Lr("Invalid type tag.");this.tokens[0][1]!==t&&(n.push(this.parseTypeTag()),!(this.tokens.length>0&&this.tokens[0][1]===t||(this.consume(","),this.tokens.length>0&&this.tokens[0][1]===t&&e)));)this.tokens.length<=0&&Lr("Invalid type tag.");return n}parseTypeTag(){this.tokens.length===0&&Lr("Invalid type tag.");let[t,e]=this.tokens.shift();if(e==="u8")return new xn;if(e==="u16")return new mn;if(e==="u32")return new bn;if(e==="u64")return new An;if(e==="u128")return new wn;if(e==="u256")return new _n;if(e==="bool")return new yn;if(e==="address")return new Fr;if(e==="vector"){this.consume("<");let n=this.parseTypeTag();return this.consume(">"),new Tn(n)}if(e==="string")return new tr(ql());if(t==="IDENT"&&(e.startsWith("0x")||e.startsWith("0X"))){let n=D.fromHexInput(e);this.consume("::");let[o,i]=this.tokens.shift();o!=="IDENT"&&Lr("Invalid type tag."),this.consume("::");let[a,u]=this.tokens.shift();if(a!=="IDENT"&&Lr("Invalid type tag."),D.ONE.toString()===n.toString()&&i==="object"&&u==="Object")return this.consumeWholeGeneric(),new Fr;let d=[];this.tokens.length>0&&this.tokens[0][1]==="<"&&(this.consume("<"),d=this.parseCommaList(">",!0),this.consume(">"));let h=new St(n,new Ke(i),new Ke(u),d);return new tr(h)}if(t==="GENERIC"){this.typeTags.length===0&&Lr("Can't convert generic type since no typeTags were specified.");let n=parseInt(e.substring(1),10);return new ro(this.typeTags[n]).parseTypeTag()}throw new Error("Invalid type tag.")}},Fs=class extends Error{constructor(t){super(t),this.name="TypeTagParserError"}};function ig(r){let t=0,e=[];for(;t<r.length;){let[n,o]=cg(r,t);n[0]!=="SPACE"&&e.push(n),t+=o}return e}function Lr(r){throw new Fs(r)}function Hl(r){return!!r.match(/\s/)}function Dl(r){return!!r.match(/[_A-Za-z0-9]/g)}function ag(r){return!!r.match(/T\d+/g)}function cg(r,t){let e=r[t];if(e===":"){if(r.slice(t,t+2)==="::")return[["COLON","::"],2];Lr("Unrecognized token.")}else{if(e==="<")return[["LT","<"],1];if(e===">")return[["GT",">"],1];if(e===",")return[["COMMA",","],1];if(Hl(e)){let n="";for(let o=t;o<r.length;o+=1){let i=r[o];if(Hl(i))n=`${n}${i}`;else break}return[["SPACE",n],n.length]}else if(Dl(e)){let n="";for(let o=t;o<r.length;o+=1){let i=r[o];if(Dl(i))n=`${n}${i}`;else break}return ag(n)?[["GENERIC",n],n.length]:[["IDENT",n],n.length]}}throw new Error("Unrecognized token.")}var Ft=class extends qt{constructor(e){super();this.signature=e}toUint8Array(){return this.signature.toUint8Array()}toString(){return this.signature.toString()}serialize(e){if(this.signature instanceof qe)e.serializeU32AsUleb128(0),this.signature.serialize(e);else if(this.signature instanceof kt)e.serializeU32AsUleb128(1),this.signature.serialize(e);else throw new Error("Unknown signature type")}static deserialize(e){let n=e.deserializeUleb128AsU32();switch(n){case 0:return new Ft(qe.load(e));case 1:return new Ft(kt.load(e));default:throw new Error(`Unknown variant index for AnySignature: ${n}`)}}};async function ka(r){return new Promise(t=>{setTimeout(t,r)})}async function Nl(r){let{aptosConfig:t,options:e}=r;return en({aptosConfig:t,originMethod:"getTransactions",path:"transactions",params:{start:e==null?void 0:e.offset,limit:e==null?void 0:e.limit}})}async function $s(r){let{aptosConfig:t}=r;return Ps(async()=>{let{data:e}=await pt({aptosConfig:t,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return e},`gas-price-${t.network}`,1e3*60*5)()}async function Ml(r){let{aptosConfig:t,ledgerVersion:e}=r,{data:n}=await pt({aptosConfig:t,originMethod:"getTransactionByVersion",path:`transactions/by_version/${e}`});return n}async function Ks(r){let{aptosConfig:t,transactionHash:e}=r,{data:n}=await pt({aptosConfig:t,path:`transactions/by_hash/${e}`,originMethod:"getTransactionByHash"});return n}async function Gl(r){let{aptosConfig:t,transactionHash:e}=r;try{return(await Ks({aptosConfig:t,transactionHash:e})).type==="pending_transaction"}catch(n){if((n==null?void 0:n.status)===404)return!0;throw n}}async function js(r){var E,I,A;let{aptosConfig:t,transactionHash:e,options:n}=r,o=(E=n==null?void 0:n.timeoutSecs)!=null?E:Zo,i=(I=n==null?void 0:n.checkSuccess)!=null?I:!0,a=(A=n==null?void 0:n.indexerVersionCheck)!=null?A:!0,u=!0,d=0,h,x,y=200,T=1.5;for(;u&&!(d>=o);){try{if(h=await Ks({aptosConfig:t,transactionHash:e}),u=h.type==="pending_transaction",!u)break}catch(v){if(!(v instanceof Kt)||(x=v,v.status!==404&&v.status>=400&&v.status<500))throw v}await ka(y),d+=y/1e3,y*=T}if(h===void 0)throw x||new Io(`Fetching transaction ${e} failed and timed out after ${o} seconds`,h);if(h.type==="pending_transaction")throw new Io(`Transaction ${e} timed out in pending state after ${o} seconds`,h);if(!i)return h;if(!h.success)throw new Oa(`Transaction ${e} failed with an error: ${h.vm_status}`,h);if(a)try{await ug({aptosConfig:t,ledgerVersion:Number(h.version)})}catch(v){throw new Io(`Transaction ${e} committed, but timed out waiting for indexer to sync with ledger version ${h.version}.You can disable this check by setting \`indexerVersionCheck\` to false in the \`extraArgs\` parameter.`,h)}return h}async function ug(r){let{aptosConfig:t,ledgerVersion:e}=r,n=3e3,o=new Date().getTime(),i=-1;for(;i<e;){if(new Date().getTime()-o>n)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(i=await Os({aptosConfig:t}),i>=e)break;await ka(200)}}var Io=class extends Error{constructor(e,n){super(e);this.lastSubmittedTransaction=n}},Oa=class extends Error{constructor(e,n){super(e);this.transaction=n}};var xt=class extends ae{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return rr.load(t);case 1:return Ro.load(t);case 2:return $t.load(t);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${e}`)}}},rr=class extends xt{constructor(e,n){super();this.public_key=e,this.signature=n}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let n=Oe.deserialize(e),o=qe.deserialize(e);return new rr(n,o)}},Ro=class extends xt{constructor(e,n){super();this.public_key=e,this.signature=n}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let n=ht.deserialize(e),o=gr.deserialize(e);return new Ro(n,o)}},$t=class extends xt{constructor(e,n){super();this.public_key=e,this.signature=n}serialize(e){e.serializeU32AsUleb128(2),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let n=rt.deserialize(e),o=Ft.deserialize(e);return new $t(n,o)}};var Ar=class extends ae{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return $r.load(t);case 1:return ko.load(t);case 2:return Kr.load(t);case 3:return jr.load(t);case 4:return Vr.load(t);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${e}`)}}},$r=class extends Ar{constructor(e,n){super();this.public_key=e,this.signature=n}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let n=Oe.deserialize(e),o=qe.deserialize(e);return new $r(n,o)}},ko=class extends Ar{constructor(e,n){super();this.public_key=e,this.signature=n}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let n=ht.deserialize(e),o=gr.deserialize(e);return new ko(n,o)}},Kr=class extends Ar{constructor(e,n,o){super();this.sender=e,this.secondary_signer_addresses=n,this.secondary_signers=o}serialize(e){e.serializeU32AsUleb128(2),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers)}static load(e){let n=xt.deserialize(e),o=e.deserializeVector(D),i=e.deserializeVector(xt);return new Kr(n,o,i)}},jr=class extends Ar{constructor(e,n,o,i){super();this.sender=e,this.secondary_signer_addresses=n,this.secondary_signers=o,this.fee_payer=i}serialize(e){e.serializeU32AsUleb128(3),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers),this.fee_payer.address.serialize(e),this.fee_payer.authenticator.serialize(e)}static load(e){let n=xt.deserialize(e),o=e.deserializeVector(D),i=e.deserializeVector(xt),a=D.deserialize(e),u=xt.deserialize(e),d={address:a,authenticator:u};return new jr(n,o,i,d)}},Vr=class extends Ar{constructor(e){super();this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let n=xt.deserialize(e);return new Vr(n)}};var Qr=class extends ae{constructor(e){super();this.chainId=e}serialize(e){e.serializeU8(this.chainId)}static deserialize(e){let n=e.deserializeU8();return new Qr(n)}};var Wr=class extends ae{constructor(e,n){super();this.address=e,this.name=n}static fromStr(e){let n=e.split("::");if(n.length!==2)throw new Error("Invalid module id.");return new Wr(D.fromString(n[0]),new Ke(n[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let n=D.deserialize(e),o=Ke.deserialize(e);return new Wr(n,o)}};function fg(r){let t=r.deserializeUleb128AsU32();switch(t){case 0:return It.deserialize(r);case 1:return ct.deserialize(r);case 2:return Qt.deserialize(r);case 3:return D.deserialize(r);case 4:return Pe.deserialize(r,It);case 5:return Ve.deserialize(r);case 6:return jt.deserialize(r);case 7:return Vt.deserialize(r);case 8:return Wt.deserialize(r);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${t}`)}}var vn=class extends ae{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return En.load(t);case 2:return Sn.load(t);case 3:return Un.load(t);default:throw new Error(`Unknown variant index for TransactionPayload: ${e}`)}}},En=class extends vn{constructor(e){super();this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let n=Cn.deserialize(e);return new En(n)}},Sn=class extends vn{constructor(e){super();this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let n=nr.deserialize(e);return new Sn(n)}},Un=class extends vn{constructor(e){super();this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let n=Bn.deserialize(e);return new Un(n)}},nr=class{constructor(t,e,n,o){this.module_name=t,this.function_name=e,this.type_args=n,this.args=o}static build(t,e,n,o){return new nr(Wr.fromStr(t),new Ke(e),n,o)}serialize(t){this.module_name.serialize(t),this.function_name.serialize(t),t.serializeVector(this.type_args),t.serializeU32AsUleb128(this.args.length),this.args.forEach(e=>{e.serializeForEntryFunction(t)})}static deserialize(t){let e=Wr.deserialize(t),n=Ke.deserialize(t),o=t.deserializeVector(Xe),i=t.deserializeUleb128AsU32(),a=new Array;for(let u=0;u<i;u+=1){let d=t.deserializeUleb128AsU32(),h=an.deserialize(t,d);a.push(h)}return new nr(e,n,o,a)}},Cn=class{constructor(t,e,n){this.bytecode=t,this.type_args=e,this.args=n}serialize(t){t.serializeBytes(this.bytecode),t.serializeVector(this.type_args),t.serializeU32AsUleb128(this.args.length),this.args.forEach(e=>{e.serializeForScriptFunction(t)})}static deserialize(t){let e=t.deserializeBytes(),n=t.deserializeVector(Xe),o=t.deserializeUleb128AsU32(),i=new Array;for(let a=0;a<o;a+=1){let u=fg(t);i.push(u)}return new Cn(e,n,i)}},Bn=class{constructor(t,e){this.multisig_address=t,this.transaction_payload=e}serialize(t){this.multisig_address.serialize(t),this.transaction_payload===void 0?t.serializeBool(!1):(t.serializeBool(!0),this.transaction_payload.serialize(t))}static deserialize(t){let e=D.deserialize(t),n=t.deserializeBool(),o;return n&&(o=In.deserialize(t)),new Bn(e,o)}},In=class{constructor(t){this.transaction_payload=t}serialize(t){t.serializeU32AsUleb128(0),this.transaction_payload.serialize(t)}static deserialize(t){return t.deserializeUleb128AsU32(),new In(nr.deserialize(t))}};var Ut=class extends ae{constructor(e,n,o,i,a,u,d){super();this.sender=e,this.sequence_number=n,this.payload=o,this.max_gas_amount=i,this.gas_unit_price=a,this.expiration_timestamp_secs=u,this.chain_id=d}serialize(e){this.sender.serialize(e),e.serializeU64(this.sequence_number),this.payload.serialize(e),e.serializeU64(this.max_gas_amount),e.serializeU64(this.gas_unit_price),e.serializeU64(this.expiration_timestamp_secs),this.chain_id.serialize(e)}static deserialize(e){let n=D.deserialize(e),o=e.deserializeU64(),i=vn.deserialize(e),a=e.deserializeU64(),u=e.deserializeU64(),d=e.deserializeU64(),h=Qr.deserialize(e);return new Ut(n,o,i,a,u,d,h)}},Vs=class extends ae{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return or.load(t);case 1:return sr.load(t);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${e}`)}}},or=class extends Vs{constructor(e,n){super();this.raw_txn=e,this.secondary_signer_addresses=n}serialize(e){e.serializeU32AsUleb128(0),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses)}static load(e){let n=Ut.deserialize(e),o=e.deserializeVector(D);return new or(n,o)}},sr=class extends Vs{constructor(e,n,o){super();this.raw_txn=e,this.secondary_signer_addresses=n,this.fee_payer_address=o}serialize(e){e.serializeU32AsUleb128(1),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses),this.fee_payer_address.serialize(e)}static load(e){let n=Ut.deserialize(e),o=e.deserializeVector(D),i=D.deserialize(e);return new sr(n,o,i)}};var Pt=class extends ae{constructor(e,n){super();this.raw_txn=e,this.authenticator=n}serialize(e){this.raw_txn.serialize(e),this.authenticator.serialize(e)}static deserialize(e){let n=Ut.deserialize(e),o=Ar.deserialize(e);return new Pt(n,o)}};function Ll(r){var e,n,o;if("bytecode"in r)return new En(new Cn(te.fromHexInput(r.bytecode).toUint8Array(),(e=r.typeArguments)!=null?e:[],r.functionArguments));if("multisigAddress"in r){let i=r.function.split("::");return new Un(new Bn(r.multisigAddress,new In(nr.build(`${i[0]}::${i[1]}`,i[2],(n=r.typeArguments)!=null?n:[],r.functionArguments))))}let t=r.function.split("::");return new Sn(nr.build(`${t[0]}::${t[1]}`,t[2],(o=r.typeArguments)!=null?o:[],r.functionArguments))}async function lg(r){let{aptosConfig:t,sender:e,payload:n,options:o}=r,i=o!=null&&o.accountSequenceNumber?Promise.resolve({sequence_number:o.accountSequenceNumber}):Eo({aptosConfig:t,accountAddress:e}),a=Xo[t.network]?Promise.resolve({chain_id:Xo[t.network]}):Rs({aptosConfig:t}),u=o!=null&&o.gasUnitPrice?Promise.resolve({gas_estimate:o.gasUnitPrice}):$s({aptosConfig:t}),[{sequence_number:d},{chain_id:h},{gas_estimate:x}]=await Promise.all([i,a,u]),{maxGasAmount:y,gasUnitPrice:T,expireTimestamp:E}={maxGasAmount:BigInt(tc),gasUnitPrice:BigInt(x),expireTimestamp:BigInt(Math.floor(Date.now()/1e3)+rc),...o};return new Ut(D.fromHexInput(e),BigInt(d),n,BigInt(y),BigInt(T),BigInt(E),new Qr(h))}async function Fl(r){let{aptosConfig:t,sender:e,payload:n,options:o,secondarySignerAddresses:i,feePayerAddress:a}=r,u=await lg({aptosConfig:t,sender:e,payload:n,options:o});if(a){let d=i?i.map(h=>D.fromHexInput(h)):[];return{rawTransaction:u.bcsToBytes(),secondarySignerAddresses:d,feePayerAddress:D.fromHexInput(a)}}if(i){let d=i.map(h=>D.fromHexInput(h));return{rawTransaction:u.bcsToBytes(),secondarySignerAddresses:d}}return{rawTransaction:u.bcsToBytes()}}function $l(r){var h,x;let{signerPublicKey:t,transaction:e,secondarySignersPublicKeys:n,feePayerPublicKey:o}=r,i=new sn(e.rawTransaction),a=Ut.deserialize(i),u=Qs(t);if(e.feePayerAddress){let y=new sr(a,(h=e.secondarySignerAddresses)!=null?h:[],e.feePayerAddress),T=[];n&&(T=n.map(A=>Qs(A)));let E=Qs(o),I=new jr(u,(x=e.secondarySignerAddresses)!=null?x:[],T,{address:e.feePayerAddress,authenticator:E});return new Pt(y.raw_txn,I).bcsToBytes()}if(e.secondarySignerAddresses){let y=new or(a,e.secondarySignerAddresses),T=[];T=n.map(I=>Qs(I));let E=new Kr(u,e.secondarySignerAddresses,T);return new Pt(y.raw_txn,E).bcsToBytes()}let d;if(u instanceof rr)d=new $r(u.public_key,u.signature);else if(u instanceof $t)d=new Vr(u);else throw new Error("Invalid public key");return new Pt(a,d).bcsToBytes()}function Qs(r){if(r instanceof rt){if(r.publicKey instanceof Oe)return new $t(r,new Ft(new qe(new Uint8Array(64))));if(r.publicKey instanceof Tt)return new $t(r,new Ft(new kt(new Uint8Array(64))))}return new rr(new Oe(r.toUint8Array()),new qe(new Uint8Array(64)))}function Kl(r){let{signer:t,transaction:e}=r,n=Vl(e),o=pg(n),i=t.sign(o);switch(t.signingScheme){case 0:return new rr(new Oe(t.publicKey.toUint8Array()),new qe(i.toUint8Array()));case 2:return new $t(t.publicKey,new Ft(i));default:throw new Error(`Cannot sign transaction, signing scheme ${t.signingScheme} not supported`)}}function jl(r){let{transaction:t,senderAuthenticator:e,secondarySignerAuthenticators:n}=r,o=Vl(t);if(n)return dg(o,e,n);let i=new sn(e.bcsToBytes()),a=xt.deserialize(i);if(a instanceof rr){let u=new $r(a.public_key,a.signature);return new Pt(o,u).bcsToBytes()}if(a instanceof $t){let u=new Vr(a);return new Pt(o,u).bcsToBytes()}throw new Error(`Cannot generate a signed transaction, ${a} is not a supported account authentication scheme`)}function Vl(r){var n;let t=new sn(r.rawTransaction),e=Ut.deserialize(t);return r.feePayerAddress?new sr(e,(n=r.secondarySignerAddresses)!=null?n:[],r.feePayerAddress):r.secondarySignerAddresses?new or(e,r.secondarySignerAddresses):e}function dg(r,t,e){if(r instanceof sr){if(!e.feePayerAuthenticator)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");let{feePayerAuthenticator:n,additionalSignersAuthenticators:o}=e,i=new jr(t,r.secondary_signer_addresses,o!=null?o:[],{address:r.fee_payer_address,authenticator:n});return new Pt(r.raw_txn,i).bcsToBytes()}if(r instanceof or){if(!e.additionalSignersAuthenticators)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");let{additionalSignersAuthenticators:n}=e,o=new Kr(t,r.secondary_signer_addresses,n!=null?n:[]);return new Pt(r.raw_txn,o).bcsToBytes()}throw new Error(`Cannot prepare multi signers transaction to submission, ${typeof r} transaction is not supported`)}function pg(r){let t=on.create();if(r instanceof Ut)t.update(oc);else if(r instanceof or)t.update(mi);else if(r instanceof sr)t.update(mi);else throw new Error(`Unknown transaction type to sign on: ${r}`);let e=t.digest(),n=r.bcsToBytes(),o=new Uint8Array(e.length+n.length);return o.set(e),o.set(n,e.length),o}async function Yr(r){let{aptosConfig:t,sender:e,data:n,options:o,secondarySignerAddresses:i,feePayerAddress:a}=r,u=await Ll(n);return Fl({aptosConfig:t,sender:e,payload:u,options:o,secondarySignerAddresses:i,feePayerAddress:a})}function Pa(r){return Kl({...r})}async function Ql(r){var h,x,y,T,E,I;let{aptosConfig:t,transaction:e,signerPublicKey:n,secondarySignersPublicKeys:o,feePayerPublicKey:i,options:a}=r,u=$l({transaction:e,signerPublicKey:n,secondarySignersPublicKeys:o,feePayerPublicKey:i,options:a}),{data:d}=await tn({aptosConfig:t,body:u,path:"transactions/simulate",params:{estimate_gas_unit_price:(x=(h=r.options)==null?void 0:h.estimateGasUnitPrice)!=null?x:!1,estimate_max_gas_amount:(T=(y=r.options)==null?void 0:y.estimateMaxGasAmount)!=null?T:!1,estimate_prioritized_gas_unit_price:(I=(E=r.options)==null?void 0:E.estimatePrioritizedGasUnitPrice)!=null?I:!1},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return d}async function za(r){let{aptosConfig:t}=r,e=jl({...r}),{data:n}=await tn({aptosConfig:t,body:e,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return n}async function Wl(r){let{aptosConfig:t,signer:e,transaction:n}=r,o=Pa({signer:e,transaction:n});return za({aptosConfig:t,transaction:n,senderAuthenticator:o})}async function Yl(r){let{aptosConfig:t,account:e,metadataBytes:n,byteCode:o,options:i}=r;return await Yr({aptosConfig:t,sender:e,data:{function:"0x1::code::publish_package_txn",functionArguments:[Pe.U8(n),new Pe([Pe.U8(o)])]},options:i})}async function Xl(r){let{aptosConfig:t,sender:e,recipient:n,amount:o,coinType:i,options:a}=r,u=i!=null?i:nc;return await Yr({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[new tr(St.fromString(u))],functionArguments:[D.fromHexInput(n),new ct(o)]},options:a})}var Oo=class{constructor(t){this.config=t}async transferCoinTransaction(t){return Xl({aptosConfig:this.config,...t})}};async function Zl(r){let{aptosConfig:t,options:e,creator:n}=r;return await Yr({aptosConfig:t,sender:n.accountAddress.toString(),data:{function:"0x4::aptos_token::mint",functionArguments:[new lt(r.collection),new lt(r.description),new lt(r.name),new lt(r.uri),Pe.MoveString([]),Pe.MoveString([]),new Pe([])]},options:e})}async function Jl(r){let{aptosConfig:t,tokenAddress:e}=r,n={token_data_id:{_eq:te.fromHexInput(e).toString()}};return(await ke({aptosConfig:t,query:{query:Zu,variables:{where_condition:n}},originMethod:"getTokenData"})).current_token_datas_v2[0]}async function ed(r){let{aptosConfig:t,tokenAddress:e}=r,n={token_data_id:{_eq:te.fromHexInput(e).toString()}};return(await ke({aptosConfig:t,query:{query:ia,variables:{where_condition:n}},originMethod:"getCurrentTokenOwnership"})).current_token_ownerships_v2[0]}async function td(r){var u,d;let{aptosConfig:t,ownerAddress:e,options:n}=r,o={owner_address:{_eq:te.fromHexInput(e).toString()}},i={query:ia,variables:{where_condition:o,offset:(u=n==null?void 0:n.pagination)==null?void 0:u.offset,limit:(d=n==null?void 0:n.pagination)==null?void 0:d.limit,order_by:n==null?void 0:n.orderBy}};return(await ke({aptosConfig:t,query:i,originMethod:"getOwnedTokens"})).current_token_ownerships_v2}async function rd(r){var u,d;let{aptosConfig:t,tokenAddress:e,options:n}=r,o={token_data_id:{_eq:te.fromHexInput(e).toString()}},i={query:Xu,variables:{where_condition:o,offset:(u=n==null?void 0:n.pagination)==null?void 0:u.offset,limit:(d=n==null?void 0:n.pagination)==null?void 0:d.limit,order_by:n==null?void 0:n.orderBy}};return(await ke({aptosConfig:t,query:i,originMethod:"getTokenActivity"})).token_activities_v2}async function nd(r){var i,a,u,d,h,x,y,T,E,I,A,v;let{aptosConfig:t,options:e,creator:n}=r;return await Yr({aptosConfig:t,sender:n.accountAddress.toString(),data:{function:"0x4::aptos_token::create_collection",functionArguments:[new lt(r.description),new ct((i=r.maxSupply)!=null?i:rn),new lt(r.name),new lt(r.uri),new Ve((a=r.mutableDescription)!=null?a:!0),new Ve((u=r.mutableRoyalty)!=null?u:!0),new Ve((d=r.mutableURI)!=null?d:!0),new Ve((h=r.mutableTokenDescription)!=null?h:!0),new Ve((x=r.mutableTokenName)!=null?x:!0),new Ve((y=r.mutableTokenProperties)!=null?y:!0),new Ve((T=r.mutableTokenURI)!=null?T:!0),new Ve((E=r.tokensBurnableByCreator)!=null?E:!0),new Ve((I=r.tokensFreezableByCreator)!=null?I:!0),new ct((A=r.royaltyNumerator)!=null?A:0),new ct((v=r.royaltyDenominator)!=null?v:1)]},options:e})}async function Ha(r){var h;let{aptosConfig:t,creatorAddress:e,collectionName:n,options:o}=r,i=te.fromHexInput(e).toString(),a={collection_name:{_eq:n},creator_address:{_eq:i}};return o!=null&&o.tokenStandard&&(a.token_standard={_eq:(h=o==null?void 0:o.tokenStandard)!=null?h:"v2"}),(await ke({aptosConfig:t,query:{query:$u,variables:{where_condition:a}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function od(r){return(await Ha(r)).collection_id}var Po=class{constructor(t){this.config=t}async createCollectionTransaction(t){return nd({aptosConfig:this.config,...t})}async getCollectionData(t){return Ha({aptosConfig:this.config,...t})}async getCollectionId(t){return od({aptosConfig:this.config,...t})}async mintTokenTransaction(t){return Zl({aptosConfig:this.config,...t})}async getTokenData(t){return Jl({aptosConfig:this.config,...t})}async getCurrentTokenOwnership(t){return ed({aptosConfig:this.config,...t})}async getOwnedTokens(t){return td({aptosConfig:this.config,...t})}async getTokenActivity(t){return rd({aptosConfig:this.config,...t})}};async function sd(r){let{accountAddress:t,aptosConfig:e,creationNumber:n}=r,i={account_address:{_eq:D.fromHexInput(t).toString()},creation_number:{_eq:n}};return Ws({aptosConfig:e,options:{where:i}})}async function id(r){let{accountAddress:t,aptosConfig:e,eventType:n,options:o}=r,u={where:{account_address:{_eq:D.fromHexInput(t).toString()},type:{_eq:n}},pagination:o==null?void 0:o.pagination,orderBy:o==null?void 0:o.orderBy};return Ws({aptosConfig:e,options:u})}async function Ws(r){var i,a;let{aptosConfig:t,options:e}=r,n={query:Vu,variables:{where_condition:e==null?void 0:e.where,offset:(i=e==null?void 0:e.pagination)==null?void 0:i.offset,limit:(a=e==null?void 0:e.pagination)==null?void 0:a.limit,order_by:e==null?void 0:e.orderBy}};return(await ke({aptosConfig:t,query:n,originMethod:"getEvents"})).events}var zo=class{constructor(t){this.config=t}async getAccountEventsByCreationNumber(t){return sd({aptosConfig:this.config,...t})}async getAccountEventsByEventType(t){return id({aptosConfig:this.config,...t})}async getEvents(t){return Ws({aptosConfig:this.config,...t})}};async function ad(r){var u;let{aptosConfig:t,accountAddress:e,amount:n}=r,o=(u=r.timeoutSecs)!=null?u:Zo,{data:i}=await Ai({aptosConfig:t,path:"fund",body:{address:D.fromHexInput(e).toString(),amount:n},originMethod:"fundAccount"}),a=i.txn_hashes[0];return await js({aptosConfig:t,transactionHash:a,options:{timeoutSecs:o}}),a}var Ho=class{constructor(t){this.config=t}async fundAccount(t){return ad({aptosConfig:this.config,...t})}};async function Da(r){var i,a;let{aptosConfig:t,options:e}=r,n={query:Wu,variables:{where_condition:e==null?void 0:e.where,limit:(i=e==null?void 0:e.pagination)==null?void 0:i.limit,offset:(a=e==null?void 0:e.pagination)==null?void 0:a.offset}};return(await ke({aptosConfig:t,query:n,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function cd(r){var i,a;let{aptosConfig:t,options:e}=r,n={query:Qu,variables:{where_condition:e==null?void 0:e.where,limit:(i=e==null?void 0:e.pagination)==null?void 0:i.limit,offset:(a=e==null?void 0:e.pagination)==null?void 0:a.offset}};return(await ke({aptosConfig:t,query:n,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function ud(r){var i,a;let{aptosConfig:t,options:e}=r,n={query:Ku,variables:{where_condition:e==null?void 0:e.where,limit:(i=e==null?void 0:e.pagination)==null?void 0:i.limit,offset:(a=e==null?void 0:e.pagination)==null?void 0:a.offset}};return(await ke({aptosConfig:t,query:n,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var Do=class{constructor(t){this.config=t}async getFungibleAssetMetadata(t){return Da({aptosConfig:this.config,...t})}async getFungibleAssetMetadataByAssetType(t){return(await Da({aptosConfig:this.config,options:{where:{asset_type:{_eq:t}}}}))[0]}async getFungibleAssetActivities(t){return cd({aptosConfig:this.config,...t})}async getCurrentFungibleAssetBalances(t){return ud({aptosConfig:this.config,...t})}};var qo=class{constructor(t){this.config=t}async getLedgerInfo(){return Rs({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(t){return Ju({aptosConfig:this.config,...t})}async getBlockByHeight(t){return ef({aptosConfig:this.config,...t})}async getTableItem(t){return ks({aptosConfig:this.config,...t})}async view(t){return tf({aptosConfig:this.config,...t})}async getChainTopUserTransactions(t){return rf({aptosConfig:this.config,...t})}async queryIndexer(t){return ke({aptosConfig:this.config,...t})}async getIndexerLastSuccessVersion(){return Os({aptosConfig:this.config})}};async function fd(r){let{aptosConfig:t,poolAddress:e}=r,n=te.fromHexInput(e).toString(),i=await ke({aptosConfig:t,query:{query:sa,variables:{where_condition:{pool_address:{_eq:n}}}}});if(i.num_active_delegator_per_pool.length===0)throw Error("Delegator pool not found");return i.num_active_delegator_per_pool[0].num_active_delegator}async function ld(r){let{aptosConfig:t,options:e}=r,n={query:sa,variables:{where_condition:{},order_by:e==null?void 0:e.orderBy}};return(await ke({aptosConfig:t,query:n})).num_active_delegator_per_pool}async function dd(r){let{aptosConfig:t,delegatorAddress:e,poolAddress:n}=r,o={query:ju,variables:{delegatorAddress:te.fromHexInput(e).toString(),poolAddress:te.fromHexInput(n).toString()}};return(await ke({aptosConfig:t,query:o})).delegated_staking_activities}var No=class{constructor(t){this.config=t}async getNumberOfDelegators(t){return fd({aptosConfig:this.config,...t})}async getNumberOfDelegatorsForAllPools(t){return ld({aptosConfig:this.config,...t})}async getDelegatedStakingActivities(t){return dd({aptosConfig:this.config,...t})}};var Mo=class{constructor(t){this.config=t}async getTransactions(t){return Nl({aptosConfig:this.config,...t})}async getTransactionByVersion(t){return Ml({aptosConfig:this.config,...t})}async getTransactionByHash(t){return Ks({aptosConfig:this.config,...t})}async isPendingTransaction(t){return Gl({aptosConfig:this.config,...t})}async waitForTransaction(t){return js({aptosConfig:this.config,...t})}async getGasPriceEstimation(){return $s({aptosConfig:this.config})}};var Go=class{constructor(t){this.config=t}async generateTransaction(t){return Yr({aptosConfig:this.config,...t})}signTransaction(t){return Pa({...t})}async simulateTransaction(t){return Ql({aptosConfig:this.config,...t})}async submitTransaction(t){return za({aptosConfig:this.config,...t})}async signAndSubmitTransaction(t){let{signer:e,transaction:n}=t;return Wl({aptosConfig:this.config,signer:e,transaction:n})}async publishModuleTransaction(t){return Yl({aptosConfig:this.config,...t})}};var Ct=class{constructor(t){this.config=new Bo(t),this.account=new So(this.config),this.coin=new Oo(this.config),this.digitalAsset=new Po(this.config),this.event=new zo(this.config),this.faucet=new Ho(this.config),this.fungibleAsset=new Do(this.config),this.general=new qo(this.config),this.staking=new No(this.config),this.transaction=new Mo(this.config),this.transactionSubmission=new Go(this.config)}};function ir(r,t,e){Object.getOwnPropertyNames(t.prototype).forEach(n=>{let o=Object.getOwnPropertyDescriptor(t.prototype,n);!o||(o.value=function(...i){return this[e][n](...i)},Object.defineProperty(r.prototype,n,o))})}ir(Ct,So,"account");ir(Ct,Oo,"coin");ir(Ct,Po,"digitalAsset");ir(Ct,zo,"event");ir(Ct,Ho,"faucet");ir(Ct,Do,"fungibleAsset");ir(Ct,qo,"general");ir(Ct,No,"staking");ir(Ct,Mo,"transaction");ir(Ct,Go,"transactionSubmission");return wd(hg);})();
406
406
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
407
407
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
408
408
  /*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */