@sentio/sdk-bundle 2.52.1 → 2.52.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.
Files changed (65) hide show
  1. package/lib/aptos/builtin/0x1.js +1 -1
  2. package/lib/aptos/builtin/0x3.js +1 -1
  3. package/lib/aptos/builtin/index.js +1 -1
  4. package/lib/aptos/ext/index.js +1 -1
  5. package/lib/aptos/index.js +1 -1
  6. package/lib/{chunk-LS5ONP4K.js → chunk-3634LO26.js} +2 -2
  7. package/lib/{chunk-HU7476GK.js → chunk-44SNVBZO.js} +2 -2
  8. package/lib/chunk-44SNVBZO.js.map +1 -0
  9. package/lib/{chunk-CLSYYTRT.js → chunk-ATMZMMXQ.js} +1 -1
  10. package/lib/{chunk-CLSYYTRT.js.map → chunk-ATMZMMXQ.js.map} +1 -1
  11. package/lib/{chunk-BQ4EQVA4.js → chunk-B5LNOVX3.js} +2 -2
  12. package/lib/{chunk-D65UDVQD.js → chunk-DX3D2XZ3.js} +2 -2
  13. package/lib/{chunk-QLPYMSRX.js → chunk-ETUGBNCT.js} +2 -2
  14. package/lib/chunk-FK3BI3F2.js +3 -0
  15. package/lib/chunk-FK3BI3F2.js.map +1 -0
  16. package/lib/{chunk-YEV4EYDY.js → chunk-IK2PE6IH.js} +2 -2
  17. package/lib/{chunk-NTLEUEZI.js → chunk-JURNVTQE.js} +2 -2
  18. package/lib/{chunk-CCFVCRAB.js → chunk-KASA2EOQ.js} +2 -2
  19. package/lib/{chunk-CDLQI5ZO.js → chunk-KWR5UGTL.js} +2 -2
  20. package/lib/{chunk-K4KEQFTU.js → chunk-NIASZQ5Z.js} +2 -2
  21. package/lib/chunk-OCBJUHGM.js +3 -0
  22. package/lib/chunk-OCBJUHGM.js.map +1 -0
  23. package/lib/{chunk-4F62GJFK.js → chunk-PH74HXF3.js} +2 -2
  24. package/lib/{chunk-HV44MLJG.js → chunk-PRVQK7HO.js} +2 -2
  25. package/lib/{chunk-SR7XAINJ.js → chunk-VEG4HJOH.js} +2 -2
  26. package/lib/{chunk-SR7XAINJ.js.map → chunk-VEG4HJOH.js.map} +1 -1
  27. package/lib/{chunk-FKFODQAR.js → chunk-XJWATGGD.js} +2 -2
  28. package/lib/eth/builtin/eacaggregatorproxy.js +1 -1
  29. package/lib/eth/builtin/erc1155.js +1 -1
  30. package/lib/eth/builtin/erc20.js +1 -1
  31. package/lib/eth/builtin/erc721.js +1 -1
  32. package/lib/eth/builtin/index.js +1 -1
  33. package/lib/eth/builtin/weth9.js +1 -1
  34. package/lib/eth/index.js +1 -1
  35. package/lib/fuel/index.js +1 -1
  36. package/lib/move/index.js +1 -1
  37. package/lib/solana/builtin/index.js +1 -1
  38. package/lib/solana/index.js +1 -1
  39. package/lib/stark/index.js +1 -1
  40. package/lib/sui/builtin/0x1.js +1 -1
  41. package/lib/sui/builtin/0x2.js +1 -1
  42. package/lib/sui/builtin/0x3.js +1 -1
  43. package/lib/sui/builtin/index.js +1 -1
  44. package/lib/sui/ext/index.js +1 -1
  45. package/lib/sui/index.js +1 -1
  46. package/lib/testing/index.js +1 -1
  47. package/lib/utils/index.js +1 -1
  48. package/package.json +2 -2
  49. package/lib/chunk-2QI24JA5.js +0 -3
  50. package/lib/chunk-2QI24JA5.js.map +0 -1
  51. package/lib/chunk-HU7476GK.js.map +0 -1
  52. package/lib/chunk-XVOZ4ULD.js +0 -3
  53. package/lib/chunk-XVOZ4ULD.js.map +0 -1
  54. /package/lib/{chunk-LS5ONP4K.js.map → chunk-3634LO26.js.map} +0 -0
  55. /package/lib/{chunk-BQ4EQVA4.js.map → chunk-B5LNOVX3.js.map} +0 -0
  56. /package/lib/{chunk-D65UDVQD.js.map → chunk-DX3D2XZ3.js.map} +0 -0
  57. /package/lib/{chunk-QLPYMSRX.js.map → chunk-ETUGBNCT.js.map} +0 -0
  58. /package/lib/{chunk-YEV4EYDY.js.map → chunk-IK2PE6IH.js.map} +0 -0
  59. /package/lib/{chunk-NTLEUEZI.js.map → chunk-JURNVTQE.js.map} +0 -0
  60. /package/lib/{chunk-CCFVCRAB.js.map → chunk-KASA2EOQ.js.map} +0 -0
  61. /package/lib/{chunk-CDLQI5ZO.js.map → chunk-KWR5UGTL.js.map} +0 -0
  62. /package/lib/{chunk-K4KEQFTU.js.map → chunk-NIASZQ5Z.js.map} +0 -0
  63. /package/lib/{chunk-4F62GJFK.js.map → chunk-PH74HXF3.js.map} +0 -0
  64. /package/lib/{chunk-HV44MLJG.js.map → chunk-PRVQK7HO.js.map} +0 -0
  65. /package/lib/{chunk-FKFODQAR.js.map → chunk-XJWATGGD.js.map} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { createRequire as createRequireSdkShim } from 'module'; const require = createRequireSdkShim(import.meta.url);
2
- import{a as Xe}from"./chunk-2QI24JA5.js";import{B as it,Bb as be,Eb as ee,Nd as Cs,Sd as wn,U as Ca,Ud as Ee,cd as Ke,da as ys,ma as ct,rd as xa,y as ya}from"./chunk-KFSMJYAT.js";import{a as i,d as ai,e as gs,f as At}from"./chunk-G5BIPHMS.js";var Jo=ai((ef,qn)=>{"use strict";(function(){"use strict";var n="input is invalid type",t="finalize already called",e=typeof window=="object",r=e?window:{};r.JS_SHA3_NO_WINDOW&&(e=!1);var a=!e&&typeof self=="object",s=!r.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;s?r=global:a&&(r=self);for(var o=!r.JS_SHA3_NO_COMMON_JS&&typeof qn=="object"&&qn.exports,l=typeof define=="function"&&define.amd,u=!r.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",p="0123456789abcdef".split(""),d=[31,7936,2031616,520093696],f=[4,1024,262144,67108864],h=[1,256,65536,16777216],C=[6,1536,393216,100663296],E=[0,8,16,24],A=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],S=[224,256,384,512],R=[128,256],H=["hex","buffer","arrayBuffer","array","digest"],M={128:168,256:136},Vt=r.JS_SHA3_NO_NODE_JS||!Array.isArray?function(c){return Object.prototype.toString.call(c)==="[object Array]"}:Array.isArray,te=u&&(r.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)?function(c){return typeof c=="object"&&c.buffer&&c.buffer.constructor===ArrayBuffer}:ArrayBuffer.isView,fa=i(function(c){var g=typeof c;if(g==="string")return[c,!0];if(g!=="object"||c===null)throw new Error(n);if(u&&c.constructor===ArrayBuffer)return[new Uint8Array(c),!1];if(!Vt(c)&&!te(c))throw new Error(n);return[c,!1]},"formatMessage"),cs=i(function(c){return fa(c)[0].length===0},"empty"),ha=i(function(c){for(var g=[],y=0;y<c.length;++y)g[y]=c[y];return g},"cloneArray"),ls=i(function(c,g,y){return function(x){return new X(c,g,c).update(x)[y]()}},"createOutputMethod"),us=i(function(c,g,y){return function(x,T){return new X(c,g,T).update(x)[y]()}},"createShakeOutputMethod"),ps=i(function(c,g,y){return function(x,T,P,O){return kt["cshake"+c].update(x,T,P,O)[y]()}},"createCshakeOutputMethod"),ds=i(function(c,g,y){return function(x,T,P,O){return kt["kmac"+c].update(x,T,P,O)[y]()}},"createKmacOutputMethod"),br=i(function(c,g,y,x){for(var T=0;T<H.length;++T){var P=H[T];c[P]=g(y,x,P)}return c},"createOutputMethods"),fs=i(function(c,g){var y=ls(c,g,"hex");return y.create=function(){return new X(c,g,c)},y.update=function(x){return y.create().update(x)},br(y,ls,c,g)},"createMethod"),ei=i(function(c,g){var y=us(c,g,"hex");return y.create=function(x){return new X(c,g,x)},y.update=function(x,T){return y.create(T).update(x)},br(y,us,c,g)},"createShakeMethod"),ri=i(function(c,g){var y=M[c],x=ps(c,g,"hex");return x.create=function(T,P,O){return cs(P)&&cs(O)?kt["shake"+c].create(T):new X(c,g,T).bytepad([P,O],y)},x.update=function(T,P,O,k){return x.create(P,O,k).update(T)},br(x,ps,c,g)},"createCshakeMethod"),ni=i(function(c,g){var y=M[c],x=ds(c,g,"hex");return x.create=function(T,P,O){return new ga(c,g,P).bytepad(["KMAC",O],y).bytepad([T],y)},x.update=function(T,P,O,k){return x.create(T,O,k).update(P)},br(x,ds,c,g)},"createKmacMethod"),hs=[{name:"keccak",padding:h,bits:S,createMethod:fs},{name:"sha3",padding:C,bits:S,createMethod:fs},{name:"shake",padding:d,bits:R,createMethod:ei},{name:"cshake",padding:f,bits:R,createMethod:ri},{name:"kmac",padding:f,bits:R,createMethod:ni}],kt={},ze=[],Mt=0;Mt<hs.length;++Mt)for(var xe=hs[Mt],Er=xe.bits,Je=0;Je<Er.length;++Je){var ma=xe.name+"_"+Er[Je];if(ze.push(ma),kt[ma]=xe.createMethod(Er[Je],xe.padding),xe.name!=="sha3"){var ms=xe.name+Er[Je];ze.push(ms),kt[ms]=kt[ma]}}function X(c,g,y){this.blocks=[],this.s=[],this.padding=g,this.outputBits=y,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(c<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=y>>5,this.extraBytes=(y&31)>>3;for(var x=0;x<50;++x)this.s[x]=0}i(X,"Keccak"),X.prototype.update=function(c){if(this.finalized)throw new Error(t);var g=fa(c);c=g[0];for(var y=g[1],x=this.blocks,T=this.byteCount,P=c.length,O=this.blockCount,k=0,Z=this.s,N,K;k<P;){if(this.reset)for(this.reset=!1,x[0]=this.block,N=1;N<O+1;++N)x[N]=0;if(y)for(N=this.start;k<P&&N<T;++k)K=c.charCodeAt(k),K<128?x[N>>2]|=K<<E[N++&3]:K<2048?(x[N>>2]|=(192|K>>6)<<E[N++&3],x[N>>2]|=(128|K&63)<<E[N++&3]):K<55296||K>=57344?(x[N>>2]|=(224|K>>12)<<E[N++&3],x[N>>2]|=(128|K>>6&63)<<E[N++&3],x[N>>2]|=(128|K&63)<<E[N++&3]):(K=65536+((K&1023)<<10|c.charCodeAt(++k)&1023),x[N>>2]|=(240|K>>18)<<E[N++&3],x[N>>2]|=(128|K>>12&63)<<E[N++&3],x[N>>2]|=(128|K>>6&63)<<E[N++&3],x[N>>2]|=(128|K&63)<<E[N++&3]);else for(N=this.start;k<P&&N<T;++k)x[N>>2]|=c[k]<<E[N++&3];if(this.lastByteIndex=N,N>=T){for(this.start=N-T,this.block=x[O],N=0;N<O;++N)Z[N]^=x[N];We(Z),this.reset=!0}else this.start=N}return this},X.prototype.encode=function(c,g){var y=c&255,x=1,T=[y];for(c=c>>8,y=c&255;y>0;)T.unshift(y),c=c>>8,y=c&255,++x;return g?T.push(x):T.unshift(x),this.update(T),T.length},X.prototype.encodeString=function(c){var g=fa(c);c=g[0];var y=g[1],x=0,T=c.length;if(y)for(var P=0;P<c.length;++P){var O=c.charCodeAt(P);O<128?x+=1:O<2048?x+=2:O<55296||O>=57344?x+=3:(O=65536+((O&1023)<<10|c.charCodeAt(++P)&1023),x+=4)}else x=T;return x+=this.encode(x*8),this.update(c),x},X.prototype.bytepad=function(c,g){for(var y=this.encode(g),x=0;x<c.length;++x)y+=this.encodeString(c[x]);var T=(g-y%g)%g,P=[];return P.length=T,this.update(P),this},X.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var c=this.blocks,g=this.lastByteIndex,y=this.blockCount,x=this.s;if(c[g>>2]|=this.padding[g&3],this.lastByteIndex===this.byteCount)for(c[0]=c[y],g=1;g<y+1;++g)c[g]=0;for(c[y-1]|=2147483648,g=0;g<y;++g)x[g]^=c[g];We(x)}},X.prototype.toString=X.prototype.hex=function(){this.finalize();for(var c=this.blockCount,g=this.s,y=this.outputBlocks,x=this.extraBytes,T=0,P=0,O="",k;P<y;){for(T=0;T<c&&P<y;++T,++P)k=g[T],O+=p[k>>4&15]+p[k&15]+p[k>>12&15]+p[k>>8&15]+p[k>>20&15]+p[k>>16&15]+p[k>>28&15]+p[k>>24&15];P%c===0&&(g=ha(g),We(g),T=0)}return x&&(k=g[T],O+=p[k>>4&15]+p[k&15],x>1&&(O+=p[k>>12&15]+p[k>>8&15]),x>2&&(O+=p[k>>20&15]+p[k>>16&15])),O},X.prototype.arrayBuffer=function(){this.finalize();var c=this.blockCount,g=this.s,y=this.outputBlocks,x=this.extraBytes,T=0,P=0,O=this.outputBits>>3,k;x?k=new ArrayBuffer(y+1<<2):k=new ArrayBuffer(O);for(var Z=new Uint32Array(k);P<y;){for(T=0;T<c&&P<y;++T,++P)Z[P]=g[T];P%c===0&&(g=ha(g),We(g))}return x&&(Z[P]=g[T],k=k.slice(0,O)),k},X.prototype.buffer=X.prototype.arrayBuffer,X.prototype.digest=X.prototype.array=function(){this.finalize();for(var c=this.blockCount,g=this.s,y=this.outputBlocks,x=this.extraBytes,T=0,P=0,O=[],k,Z;P<y;){for(T=0;T<c&&P<y;++T,++P)k=P<<2,Z=g[T],O[k]=Z&255,O[k+1]=Z>>8&255,O[k+2]=Z>>16&255,O[k+3]=Z>>24&255;P%c===0&&(g=ha(g),We(g))}return x&&(k=P<<2,Z=g[T],O[k]=Z&255,x>1&&(O[k+1]=Z>>8&255),x>2&&(O[k+2]=Z>>16&255)),O};function ga(c,g,y){X.call(this,c,g,y)}i(ga,"Kmac"),ga.prototype=new X,ga.prototype.finalize=function(){return this.encode(this.outputBits,!0),X.prototype.finalize.call(this)};var We=i(function(c){var g,y,x,T,P,O,k,Z,N,K,wr,Tr,vr,Pr,kr,Ar,Rr,Ir,Or,Br,Nr,Fr,Sr,Dr,_r,Lr,Hr,Ur,Vr,Mr,Gr,$r,jr,zr,Jr,Wr,Kr,Xr,Zr,Yr,Qr,qr,tn,en,rn,nn,an,sn,on,cn,ln,un,pn,dn,fn,hn,mn,gn,yn,Cn,xn,bn,En;for(x=0;x<48;x+=2)T=c[0]^c[10]^c[20]^c[30]^c[40],P=c[1]^c[11]^c[21]^c[31]^c[41],O=c[2]^c[12]^c[22]^c[32]^c[42],k=c[3]^c[13]^c[23]^c[33]^c[43],Z=c[4]^c[14]^c[24]^c[34]^c[44],N=c[5]^c[15]^c[25]^c[35]^c[45],K=c[6]^c[16]^c[26]^c[36]^c[46],wr=c[7]^c[17]^c[27]^c[37]^c[47],Tr=c[8]^c[18]^c[28]^c[38]^c[48],vr=c[9]^c[19]^c[29]^c[39]^c[49],g=Tr^(O<<1|k>>>31),y=vr^(k<<1|O>>>31),c[0]^=g,c[1]^=y,c[10]^=g,c[11]^=y,c[20]^=g,c[21]^=y,c[30]^=g,c[31]^=y,c[40]^=g,c[41]^=y,g=T^(Z<<1|N>>>31),y=P^(N<<1|Z>>>31),c[2]^=g,c[3]^=y,c[12]^=g,c[13]^=y,c[22]^=g,c[23]^=y,c[32]^=g,c[33]^=y,c[42]^=g,c[43]^=y,g=O^(K<<1|wr>>>31),y=k^(wr<<1|K>>>31),c[4]^=g,c[5]^=y,c[14]^=g,c[15]^=y,c[24]^=g,c[25]^=y,c[34]^=g,c[35]^=y,c[44]^=g,c[45]^=y,g=Z^(Tr<<1|vr>>>31),y=N^(vr<<1|Tr>>>31),c[6]^=g,c[7]^=y,c[16]^=g,c[17]^=y,c[26]^=g,c[27]^=y,c[36]^=g,c[37]^=y,c[46]^=g,c[47]^=y,g=K^(T<<1|P>>>31),y=wr^(P<<1|T>>>31),c[8]^=g,c[9]^=y,c[18]^=g,c[19]^=y,c[28]^=g,c[29]^=y,c[38]^=g,c[39]^=y,c[48]^=g,c[49]^=y,Pr=c[0],kr=c[1],nn=c[11]<<4|c[10]>>>28,an=c[10]<<4|c[11]>>>28,Ur=c[20]<<3|c[21]>>>29,Vr=c[21]<<3|c[20]>>>29,Cn=c[31]<<9|c[30]>>>23,xn=c[30]<<9|c[31]>>>23,qr=c[40]<<18|c[41]>>>14,tn=c[41]<<18|c[40]>>>14,zr=c[2]<<1|c[3]>>>31,Jr=c[3]<<1|c[2]>>>31,Ar=c[13]<<12|c[12]>>>20,Rr=c[12]<<12|c[13]>>>20,sn=c[22]<<10|c[23]>>>22,on=c[23]<<10|c[22]>>>22,Mr=c[33]<<13|c[32]>>>19,Gr=c[32]<<13|c[33]>>>19,bn=c[42]<<2|c[43]>>>30,En=c[43]<<2|c[42]>>>30,dn=c[5]<<30|c[4]>>>2,fn=c[4]<<30|c[5]>>>2,Wr=c[14]<<6|c[15]>>>26,Kr=c[15]<<6|c[14]>>>26,Ir=c[25]<<11|c[24]>>>21,Or=c[24]<<11|c[25]>>>21,cn=c[34]<<15|c[35]>>>17,ln=c[35]<<15|c[34]>>>17,$r=c[45]<<29|c[44]>>>3,jr=c[44]<<29|c[45]>>>3,Dr=c[6]<<28|c[7]>>>4,_r=c[7]<<28|c[6]>>>4,hn=c[17]<<23|c[16]>>>9,mn=c[16]<<23|c[17]>>>9,Xr=c[26]<<25|c[27]>>>7,Zr=c[27]<<25|c[26]>>>7,Br=c[36]<<21|c[37]>>>11,Nr=c[37]<<21|c[36]>>>11,un=c[47]<<24|c[46]>>>8,pn=c[46]<<24|c[47]>>>8,en=c[8]<<27|c[9]>>>5,rn=c[9]<<27|c[8]>>>5,Lr=c[18]<<20|c[19]>>>12,Hr=c[19]<<20|c[18]>>>12,gn=c[29]<<7|c[28]>>>25,yn=c[28]<<7|c[29]>>>25,Yr=c[38]<<8|c[39]>>>24,Qr=c[39]<<8|c[38]>>>24,Fr=c[48]<<14|c[49]>>>18,Sr=c[49]<<14|c[48]>>>18,c[0]=Pr^~Ar&Ir,c[1]=kr^~Rr&Or,c[10]=Dr^~Lr&Ur,c[11]=_r^~Hr&Vr,c[20]=zr^~Wr&Xr,c[21]=Jr^~Kr&Zr,c[30]=en^~nn&sn,c[31]=rn^~an&on,c[40]=dn^~hn&gn,c[41]=fn^~mn&yn,c[2]=Ar^~Ir&Br,c[3]=Rr^~Or&Nr,c[12]=Lr^~Ur&Mr,c[13]=Hr^~Vr&Gr,c[22]=Wr^~Xr&Yr,c[23]=Kr^~Zr&Qr,c[32]=nn^~sn&cn,c[33]=an^~on&ln,c[42]=hn^~gn&Cn,c[43]=mn^~yn&xn,c[4]=Ir^~Br&Fr,c[5]=Or^~Nr&Sr,c[14]=Ur^~Mr&$r,c[15]=Vr^~Gr&jr,c[24]=Xr^~Yr&qr,c[25]=Zr^~Qr&tn,c[34]=sn^~cn&un,c[35]=on^~ln&pn,c[44]=gn^~Cn&bn,c[45]=yn^~xn&En,c[6]=Br^~Fr&Pr,c[7]=Nr^~Sr&kr,c[16]=Mr^~$r&Dr,c[17]=Gr^~jr&_r,c[26]=Yr^~qr&zr,c[27]=Qr^~tn&Jr,c[36]=cn^~un&en,c[37]=ln^~pn&rn,c[46]=Cn^~bn&dn,c[47]=xn^~En&fn,c[8]=Fr^~Pr&Ar,c[9]=Sr^~kr&Rr,c[18]=$r^~Dr&Lr,c[19]=jr^~_r&Hr,c[28]=qr^~zr&Wr,c[29]=tn^~Jr&Kr,c[38]=un^~en&nn,c[39]=pn^~rn&an,c[48]=bn^~dn&hn,c[49]=En^~fn&mn,c[0]^=A[x],c[1]^=A[x+1]},"f");if(o)qn.exports=kt;else{for(Mt=0;Mt<ze.length;++Mt)r[ze[Mt]]=kt[ze[Mt]];l&&define(function(){return kt})}})()});var Ic={};gs(Ic,{ERC721BoundContractView:()=>xr,ERC721ContractView:()=>da,ERC721Processor:()=>Ht,ERC721ProcessorTemplate:()=>os,ERC721__factory:()=>Pt,getERC721Contract:()=>Ce,getERC721ContractOnContext:()=>Pc,mockApprovalForAllLog:()=>Ac,mockApprovalLog:()=>kc,mockTransferLog:()=>Rc});var Gt=class extends Cs{static{i(this,"EthContext")}chainId;address;log;block;trace;blockNumber;transactionHash;transaction;transactionReceipt;timestamp;preparedData;constructor(t,e,r,a,s,o,l,u,p,d){super(p),this.chainId=t,this.log=s,this.block=a,this.trace=o,this.address=e.toLowerCase(),this.transaction=l,this.transactionReceipt=u,this.timestamp=r||new Date(0),this.preparedData=d,s?(this.blockNumber=s.blockNumber,this.transactionHash=s.transactionHash):a?this.blockNumber=a.number:o&&(this.blockNumber=o.blockNumber,this.transactionHash=o.transactionHash)}getChainId(){return this.chainId}getMetaDataInternal(t,e){if(this.log)return{address:this.address,contractName:this.getContractName(),blockNumber:BigInt(this.blockNumber),transactionIndex:this.log.transactionIndex,transactionHash:this.transactionHash||"",logIndex:this.log.index,chainId:this.chainId,name:t,labels:Ke(e)};if(this.trace)return{address:this.address,contractName:this.getContractName(),blockNumber:BigInt(this.blockNumber),transactionIndex:this.trace.transactionPosition,transactionHash:this.transactionHash||"",logIndex:-1,chainId:this.chainId.toString(),name:t,labels:Ke(e)};if(this.transaction)return{address:this.address,contractName:this.getContractName(),blockNumber:BigInt(this.blockNumber),transactionIndex:this.transaction.index||0,transactionHash:this.transaction.hash||"",logIndex:-1,chainId:this.chainId.toString(),name:t,labels:Ke(e)};if(this.block)return{address:this.address,contractName:this.getContractName(),blockNumber:BigInt(this.blockNumber),transactionIndex:-1,transactionHash:"",logIndex:-1,chainId:this.chainId.toString(),name:t,labels:Ke(e)};throw new Error("Invaid ctx argument can't happen")}getBlockTag(t){let e="0x"+this.blockNumber.toString(16);return t?.blockTag&&(e=typeof t.blockTag=="string"?t.blockTag:"0x"+t.blockTag.toString(16)),e}getEthCallContext(){return{chainId:this.chainId,blockTag:"0x"+this.blockNumber.toString(16),address:this.address}}},we=class extends Gt{static{i(this,"AccountContext")}getContractName(){return"account"}},bt=class extends Gt{static{i(this,"GlobalContext")}constructor(t,e,r,a,s,o,l,u,p,d){super(t,e,r,a,s,o,l,u,p,d)}getContractName(){return"*"}getMetaDataInternal(t,e){let r=this.address;this.address="*";let a=super.getMetaDataInternal(t,e);return this.address=r,a}},Et=class extends Gt{static{i(this,"ContractContext")}contract;contractName;constructor(t,e,r,a,s,o,l,u,p,d,f){super(r,e.address,a,s,o,l,u,p,d,f),e.context=this,e.callStatic&&(e.callStatic.context=this),e.encodeCall&&(e.encodeCall.context=this),this.contractName=t,this.contract=e}getContractName(){return this.contractName}},Rt=class{constructor(t){this.contract=t}static{i(this,"ContractView")}get rawContract(){return this.contract}get provider(){if(this.contract.runner?.provider)return this.contract.runner.provider;throw Error("Can't find provider for contract"+this.contract.toString())}},It=class{static{i(this,"BoundContractView")}view;address;context;callStatic;encodeCall;constructor(t,e){this.address=t,this.view=e}get rawContract(){return this.view.rawContract}get provider(){return this.view.provider}get filters(){return this.view.rawContract.filters}};import("node:process").then(n=>n.stdout.write(""));var j=At(xa(),1);var xs="6.13.1";function si(n,t,e){let r=t.split("|").map(s=>s.trim());for(let s=0;s<r.length;s++)switch(t){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof n===t)return}let a=new Error(`invalid value for type ${t}`);throw a.code="INVALID_ARGUMENT",a.argument=`value.${e}`,a.value=n,a}i(si,"checkType");async function Te(n){let t=Object.keys(n);return(await Promise.all(t.map(r=>Promise.resolve(n[r])))).reduce((r,a,s)=>(r[t[s]]=a,r),{})}i(Te,"resolveProperties");function v(n,t,e){for(let r in t){let a=t[r],s=e?e[r]:null;s&&si(a,s,r),Object.defineProperty(n,r,{enumerable:!0,value:a,writable:!1})}}i(v,"defineProperties");function ve(n){if(n==null)return"null";if(Array.isArray(n))return"[ "+n.map(ve).join(", ")+" ]";if(n instanceof Uint8Array){let t="0123456789abcdef",e="0x";for(let r=0;r<n.length;r++)e+=t[n[r]>>4],e+=t[n[r]&15];return e}if(typeof n=="object"&&typeof n.toJSON=="function")return ve(n.toJSON());switch(typeof n){case"boolean":case"symbol":return n.toString();case"bigint":return BigInt(n).toString();case"number":return n.toString();case"string":return JSON.stringify(n);case"object":{let t=Object.keys(n);return t.sort(),"{ "+t.map(e=>`${ve(e)}: ${ve(n[e])}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}i(ve,"stringify");function wt(n,t){return n&&n.code===t}i(wt,"isError");function Tn(n){return wt(n,"CALL_EXCEPTION")}i(Tn,"isCallException");function Ot(n,t,e){let r=n;{let s=[];if(e){if("message"in e||"code"in e||"name"in e)throw new Error(`value will overwrite populated values: ${ve(e)}`);for(let o in e){if(o==="shortMessage")continue;let l=e[o];s.push(o+"="+ve(l))}}s.push(`code=${t}`),s.push(`version=${xs}`),s.length&&(n+=" ("+s.join(", ")+")")}let a;switch(t){case"INVALID_ARGUMENT":a=new TypeError(n);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":a=new RangeError(n);break;default:a=new Error(n)}return v(a,{code:t}),e&&Object.assign(a,e),a.shortMessage==null&&v(a,{shortMessage:r}),a}i(Ot,"makeError");function w(n,t,e,r){if(!n)throw Ot(t,e,r)}i(w,"assert");function m(n,t,e,r){w(n,t,"INVALID_ARGUMENT",{argument:e,value:r})}i(m,"assertArgument");function Ze(n,t,e){e==null&&(e=""),e&&(e=": "+e),w(n>=t,"missing arguemnt"+e,"MISSING_ARGUMENT",{count:n,expectedCount:t}),w(n<=t,"too many arguments"+e,"UNEXPECTED_ARGUMENT",{count:n,expectedCount:t})}i(Ze,"assertArgumentCount");var oi=["NFD","NFC","NFKD","NFKC"].reduce((n,t)=>{try{if("test".normalize(t)!=="test")throw new Error("bad");if(t==="NFD"&&"\xE9".normalize("NFD")!=="e\u0301")throw new Error("broken");n.push(t)}catch{}return n},[]);function ba(n){w(oi.indexOf(n)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:n}})}i(ba,"assertNormalize");function $t(n,t,e){if(e==null&&(e=""),n!==t){let r=e,a="new";e&&(r+=".",a+=" "+e),w(!1,`private constructor; use ${r}from* methods`,"UNSUPPORTED_OPERATION",{operation:a})}}i($t,"assertPrivate");function Es(n,t,e){if(n instanceof Uint8Array)return e?new Uint8Array(n):n;if(typeof n=="string"&&n.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){let r=new Uint8Array((n.length-2)/2),a=2;for(let s=0;s<r.length;s++)r[s]=parseInt(n.substring(a,a+2),16),a+=2;return r}m(!1,"invalid BytesLike value",t||"value",n)}i(Es,"_getBytes");function z(n,t){return Es(n,t,!1)}i(z,"getBytes");function nt(n,t){return Es(n,t,!0)}i(nt,"getBytesCopy");function Y(n,t){return!(typeof n!="string"||!n.match(/^0x[0-9A-Fa-f]*$/)||typeof t=="number"&&n.length!==2+2*t||t===!0&&n.length%2!==0)}i(Y,"isHexString");function Ea(n){return Y(n,!0)||n instanceof Uint8Array}i(Ea,"isBytesLike");var bs="0123456789abcdef";function D(n){let t=z(n),e="0x";for(let r=0;r<t.length;r++){let a=t[r];e+=bs[(a&240)>>4]+bs[a&15]}return e}i(D,"hexlify");function lt(n){return"0x"+n.map(t=>D(t).substring(2)).join("")}i(lt,"concat");function vn(n){return Y(n,!0)?(n.length-2)/2:z(n).length}i(vn,"dataLength");function Tt(n,t,e){let r=z(n);return e!=null&&e>r.length&&w(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:r,length:r.length,offset:e}),D(r.slice(t??0,e??r.length))}i(Tt,"dataSlice");function ws(n,t,e){let r=z(n);w(t>=r.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(r),length:t,offset:t+1});let a=new Uint8Array(t);return a.fill(0),e?a.set(r,t-r.length):a.set(r,0),D(a)}i(ws,"zeroPad");function Pe(n,t){return ws(n,t,!0)}i(Pe,"zeroPadValue");function Pn(n,t){return ws(n,t,!1)}i(Pn,"zeroPadBytes");var kn=BigInt(0),gt=BigInt(1),ke=9007199254740991;function wa(n,t){let e=Ye(n,"value"),r=BigInt(_(t,"width"));if(w(e>>r===kn,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:n}),e>>r-gt){let a=(gt<<r)-gt;return-((~e&a)+gt)}return e}i(wa,"fromTwos");function Ta(n,t){let e=I(n,"value"),r=BigInt(_(t,"width")),a=gt<<r-gt;if(e<kn){e=-e,w(e<=a,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:n});let s=(gt<<r)-gt;return(~e&s)+gt}else w(e<a,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:n});return e}i(Ta,"toTwos");function Ae(n,t){let e=Ye(n,"value"),r=BigInt(_(t,"bits"));return e&(gt<<r)-gt}i(Ae,"mask");function I(n,t){switch(typeof n){case"bigint":return n;case"number":return m(Number.isInteger(n),"underflow",t||"value",n),m(n>=-ke&&n<=ke,"overflow",t||"value",n),BigInt(n);case"string":try{if(n==="")throw new Error("empty string");return n[0]==="-"&&n[1]!=="-"?-BigInt(n.substring(1)):BigInt(n)}catch(e){m(!1,`invalid BigNumberish string: ${e.message}`,t||"value",n)}}m(!1,"invalid BigNumberish value",t||"value",n)}i(I,"getBigInt");function Ye(n,t){let e=I(n,t);return w(e>=kn,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:n}),e}i(Ye,"getUint");var Ts="0123456789abcdef";function An(n){if(n instanceof Uint8Array){let t="0x0";for(let e of n)t+=Ts[e>>4],t+=Ts[e&15];return BigInt(t)}return I(n)}i(An,"toBigInt");function _(n,t){switch(typeof n){case"bigint":return m(n>=-ke&&n<=ke,"overflow",t||"value",n),Number(n);case"number":return m(Number.isInteger(n),"underflow",t||"value",n),m(n>=-ke&&n<=ke,"overflow",t||"value",n),n;case"string":try{if(n==="")throw new Error("empty string");return _(BigInt(n),t)}catch(e){m(!1,`invalid numeric string: ${e.message}`,t||"value",n)}}m(!1,"invalid numeric value",t||"value",n)}i(_,"getNumber");function va(n){return _(An(n))}i(va,"toNumber");function Qe(n,t){let r=Ye(n,"value").toString(16);if(t==null)r.length%2&&(r="0"+r);else{let a=_(t,"width");for(w(a*2>=r.length,`value exceeds width (${a} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:n});r.length<a*2;)r="0"+r}return"0x"+r}i(Qe,"toBeHex");function qe(n){let t=Ye(n,"value");if(t===kn)return new Uint8Array([]);let e=t.toString(16);e.length%2&&(e="0"+e);let r=new Uint8Array(e.length/2);for(let a=0;a<r.length;a++){let s=a*2;r[a]=parseInt(e.substring(s,s+2),16)}return r}i(qe,"toBeArray");var tr=class{static{i(this,"EventPayload")}filter;emitter;#t;constructor(t,e,r){this.#t=e,v(this,{emitter:t,filter:r})}async removeListener(){this.#t!=null&&await this.emitter.off(this.filter,this.#t)}};function ii(n,t,e,r,a){m(!1,`invalid codepoint at offset ${t}; ${n}`,"bytes",e)}i(ii,"errorFunc");function vs(n,t,e,r,a){if(n==="BAD_PREFIX"||n==="UNEXPECTED_CONTINUE"){let s=0;for(let o=t+1;o<e.length&&e[o]>>6===2;o++)s++;return s}return n==="OVERRUN"?e.length-t-1:0}i(vs,"ignoreFunc");function ci(n,t,e,r,a){return n==="OVERLONG"?(m(typeof a=="number","invalid bad code point for replacement","badCodepoint",a),r.push(a),0):(r.push(65533),vs(n,t,e,r,a))}i(ci,"replaceFunc");var Ps=Object.freeze({error:ii,ignore:vs,replace:ci});function li(n,t){t==null&&(t=Ps.error);let e=z(n,"bytes"),r=[],a=0;for(;a<e.length;){let s=e[a++];if(!(s>>7)){r.push(s);continue}let o=null,l=null;if((s&224)===192)o=1,l=127;else if((s&240)===224)o=2,l=2047;else if((s&248)===240)o=3,l=65535;else{(s&192)===128?a+=t("UNEXPECTED_CONTINUE",a-1,e,r):a+=t("BAD_PREFIX",a-1,e,r);continue}if(a-1+o>=e.length){a+=t("OVERRUN",a-1,e,r);continue}let u=s&(1<<8-o-1)-1;for(let p=0;p<o;p++){let d=e[a];if((d&192)!=128){a+=t("MISSING_CONTINUE",a,e,r),u=null;break}u=u<<6|d&63,a++}if(u!==null){if(u>1114111){a+=t("OUT_OF_RANGE",a-1-o,e,r,u);continue}if(u>=55296&&u<=57343){a+=t("UTF16_SURROGATE",a-1-o,e,r,u);continue}if(u<=l){a+=t("OVERLONG",a-1-o,e,r,u);continue}r.push(u)}}return r}i(li,"getUtf8CodePoints");function Re(n,t){m(typeof n=="string","invalid string value","str",n),t!=null&&(ba(t),n=n.normalize(t));let e=[];for(let r=0;r<n.length;r++){let a=n.charCodeAt(r);if(a<128)e.push(a);else if(a<2048)e.push(a>>6|192),e.push(a&63|128);else if((a&64512)==55296){r++;let s=n.charCodeAt(r);m(r<n.length&&(s&64512)===56320,"invalid surrogate pair","str",n);let o=65536+((a&1023)<<10)+(s&1023);e.push(o>>18|240),e.push(o>>12&63|128),e.push(o>>6&63|128),e.push(o&63|128)}else e.push(a>>12|224),e.push(a>>6&63|128),e.push(a&63|128)}return new Uint8Array(e)}i(Re,"toUtf8Bytes");function ui(n){return n.map(t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10&1023)+55296,(t&1023)+56320))).join("")}i(ui,"_toUtf8String");function er(n,t){return ui(li(n,t))}i(er,"toUtf8String");function ks(n){let t=[];for(;n;)t.unshift(n&255),n>>=8;return t}i(ks,"arrayifyInteger");function Rs(n){if(Array.isArray(n)){let r=[];if(n.forEach(function(s){r=r.concat(Rs(s))}),r.length<=55)return r.unshift(192+r.length),r;let a=ks(r.length);return a.unshift(247+a.length),a.concat(r)}let t=Array.prototype.slice.call(z(n,"object"));if(t.length===1&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;let e=ks(t.length);return e.unshift(183+e.length),e.concat(t)}i(Rs,"_encode");var As="0123456789abcdef";function Pa(n){let t="0x";for(let e of Rs(n))t+=As[e>>4],t+=As[e&15];return t}i(Pa,"encodeRlp");function ka(n){if(!Number.isSafeInteger(n)||n<0)throw new Error(`Wrong positive integer: ${n}`)}i(ka,"number");function Aa(n,...t){if(!(n instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(n.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${n.length}`)}i(Aa,"bytes");function Ra(n,t=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(t&&n.finished)throw new Error("Hash#digest() has already been called")}i(Ra,"exists");function Is(n,t){Aa(n);let e=t.outputLen;if(n.length<e)throw new Error(`digestInto() expects output buffer of length at least ${e}`)}i(Is,"output");var Rn=BigInt(4294967295),Os=BigInt(32);function pi(n,t=!1){return t?{h:Number(n&Rn),l:Number(n>>Os&Rn)}:{h:Number(n>>Os&Rn)|0,l:Number(n&Rn)|0}}i(pi,"fromBig");function Bs(n,t=!1){let e=new Uint32Array(n.length),r=new Uint32Array(n.length);for(let a=0;a<n.length;a++){let{h:s,l:o}=pi(n[a],t);[e[a],r[a]]=[s,o]}return[e,r]}i(Bs,"split");var Ns=i((n,t,e)=>n<<e|t>>>32-e,"rotlSH"),Fs=i((n,t,e)=>t<<e|n>>>32-e,"rotlSL"),Ss=i((n,t,e)=>t<<e-32|n>>>64-e,"rotlBH"),Ds=i((n,t,e)=>n<<e-32|t>>>64-e,"rotlBL");var di=i(n=>n instanceof Uint8Array,"u8a");var _s=i(n=>new Uint32Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/4)),"u32");var fi=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!fi)throw new Error("Non little-endian hardware is not supported");function hi(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}i(hi,"utf8ToBytes");function On(n){if(typeof n=="string"&&(n=hi(n)),!di(n))throw new Error(`expected Uint8Array, got ${typeof n}`);return n}i(On,"toBytes");var In=class{static{i(this,"Hash")}clone(){return this._cloneInto()}},xl={}.toString;function Ls(n){let t=i(r=>n().update(On(r)).digest(),"hashC"),e=n();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>n(),t}i(Ls,"wrapConstructor");function Hs(n){let t=i((r,a)=>n(a).update(On(r)).digest(),"hashC"),e=n({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=r=>n(r),t}i(Hs,"wrapXOFConstructorWithOpts");var[Ms,Gs,$s]=[[],[],[]],mi=BigInt(0),rr=BigInt(1),gi=BigInt(2),yi=BigInt(7),Ci=BigInt(256),xi=BigInt(113);for(let n=0,t=rr,e=1,r=0;n<24;n++){[e,r]=[r,(2*e+3*r)%5],Ms.push(2*(5*r+e)),Gs.push((n+1)*(n+2)/2%64);let a=mi;for(let s=0;s<7;s++)t=(t<<rr^(t>>yi)*xi)%Ci,t&gi&&(a^=rr<<(rr<<BigInt(s))-rr);$s.push(a)}var[bi,Ei]=Bs($s,!0),Us=i((n,t,e)=>e>32?Ss(n,t,e):Ns(n,t,e),"rotlH"),Vs=i((n,t,e)=>e>32?Ds(n,t,e):Fs(n,t,e),"rotlL");function wi(n,t=24){let e=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)e[o]=n[o]^n[o+10]^n[o+20]^n[o+30]^n[o+40];for(let o=0;o<10;o+=2){let l=(o+8)%10,u=(o+2)%10,p=e[u],d=e[u+1],f=Us(p,d,1)^e[l],h=Vs(p,d,1)^e[l+1];for(let C=0;C<50;C+=10)n[o+C]^=f,n[o+C+1]^=h}let a=n[2],s=n[3];for(let o=0;o<24;o++){let l=Gs[o],u=Us(a,s,l),p=Vs(a,s,l),d=Ms[o];a=n[d],s=n[d+1],n[d]=u,n[d+1]=p}for(let o=0;o<50;o+=10){for(let l=0;l<10;l++)e[l]=n[o+l];for(let l=0;l<10;l++)n[o+l]^=~e[(l+2)%10]&e[(l+4)%10]}n[0]^=bi[r],n[1]^=Ei[r]}e.fill(0)}i(wi,"keccakP");var Bn=class n extends In{static{i(this,"Keccak")}constructor(t,e,r,a=!1,s=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=r,this.enableXOF=a,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,ka(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=_s(this.state)}keccak(){wi(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){Ra(this);let{blockLen:e,state:r}=this;t=On(t);let a=t.length;for(let s=0;s<a;){let o=Math.min(e-this.pos,a-s);for(let l=0;l<o;l++)r[this.pos++]^=t[s++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:e,pos:r,blockLen:a}=this;t[r]^=e,e&128&&r===a-1&&this.keccak(),t[a-1]^=128,this.keccak()}writeInto(t){Ra(this,!1),Aa(t),this.finish();let e=this.state,{blockLen:r}=this;for(let a=0,s=t.length;a<s;){this.posOut>=r&&this.keccak();let o=Math.min(r-this.posOut,s-a);t.set(e.subarray(this.posOut,this.posOut+o),a),this.posOut+=o,a+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return ka(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Is(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:r,outputLen:a,rounds:s,enableXOF:o}=this;return t||(t=new n(e,r,a,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=a,t.enableXOF=o,t.destroyed=this.destroyed,t}},jt=i((n,t,e)=>Ls(()=>new Bn(t,n,e)),"gen"),Pl=jt(6,144,224/8),kl=jt(6,136,256/8),Al=jt(6,104,384/8),Rl=jt(6,72,512/8),Il=jt(1,144,224/8),js=jt(1,136,256/8),Ol=jt(1,104,384/8),Bl=jt(1,72,512/8),zs=i((n,t,e)=>Hs((r={})=>new Bn(t,n,r.dkLen===void 0?e:r.dkLen,!0)),"genShake"),Nl=zs(31,168,128/8),Fl=zs(31,136,256/8);var Js=!1,Ws=i(function(n){return js(n)},"_keccak256"),Ks=Ws;function st(n){let t=z(n,"data");return D(Ks(t))}i(st,"keccak256");st._=Ws;st.lock=function(){Js=!0};st.register=function(n){if(Js)throw new TypeError("keccak256 is locked");Ks=n};Object.freeze(st);var Nn="0x0000000000000000000000000000000000000000000000000000000000000000";var Xs=BigInt(0),Zs=BigInt(1),Ys=BigInt(2),Qs=BigInt(27),qs=BigInt(28),Fn=BigInt(35),Ie={};function to(n){return Pe(qe(n),32)}i(to,"toUint256");var Oe=class n{static{i(this,"Signature")}#t;#e;#r;#n;get r(){return this.#t}set r(t){m(vn(t)===32,"invalid r","value",t),this.#t=D(t)}get s(){return this.#e}set s(t){m(vn(t)===32,"invalid s","value",t);let e=D(t);m(parseInt(e.substring(0,3))<8,"non-canonical s","value",e),this.#e=e}get v(){return this.#r}set v(t){let e=_(t,"value");m(e===27||e===28,"invalid v","v",t),this.#r=e}get networkV(){return this.#n}get legacyChainId(){let t=this.networkV;return t==null?null:n.getChainId(t)}get yParity(){return this.v===27?0:1}get yParityAndS(){let t=z(this.s);return this.yParity&&(t[0]|=128),D(t)}get compactSerialized(){return lt([this.r,this.yParityAndS])}get serialized(){return lt([this.r,this.s,this.yParity?"0x1c":"0x1b"])}constructor(t,e,r,a){$t(t,Ie,"Signature"),this.#t=e,this.#e=r,this.#r=a,this.#n=null}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){let t=new n(Ie,this.r,this.s,this.v);return this.networkV&&(t.#n=this.networkV),t}toJSON(){let t=this.networkV;return{_type:"signature",networkV:t!=null?t.toString():null,r:this.r,s:this.s,v:this.v}}static getChainId(t){let e=I(t,"v");return e==Qs||e==qs?Xs:(m(e>=Fn,"invalid EIP-155 v","v",t),(e-Fn)/Ys)}static getChainIdV(t,e){return I(t)*Ys+BigInt(35+e-27)}static getNormalizedV(t){let e=I(t);return e===Xs||e===Qs?27:e===Zs||e===qs?28:(m(e>=Fn,"invalid v","v",t),e&Zs?27:28)}static from(t){function e(p,d){m(p,d,"signature",t)}if(i(e,"assertError"),t==null)return new n(Ie,Nn,Nn,27);if(typeof t=="string"){let p=z(t,"signature");if(p.length===64){let d=D(p.slice(0,32)),f=p.slice(32,64),h=f[0]&128?28:27;return f[0]&=127,new n(Ie,d,D(f),h)}if(p.length===65){let d=D(p.slice(0,32)),f=p.slice(32,64);e((f[0]&128)===0,"non-canonical s");let h=n.getNormalizedV(p[64]);return new n(Ie,d,D(f),h)}e(!1,"invalid raw signature length")}if(t instanceof n)return t.clone();let r=t.r;e(r!=null,"missing r");let a=to(r),s=function(p,d){if(p!=null)return to(p);if(d!=null){e(Y(d,32),"invalid yParityAndS");let f=z(d);return f[0]&=127,D(f)}e(!1,"missing s")}(t.s,t.yParityAndS);e((z(s)[0]&128)==0,"non-canonical s");let{networkV:o,v:l}=function(p,d,f){if(p!=null){let h=I(p);return{networkV:h>=Fn?h:void 0,v:n.getNormalizedV(h)}}if(d!=null)return e(Y(d,32),"invalid yParityAndS"),{v:z(d)[0]&128?28:27};if(f!=null){switch(_(f,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}e(!1,"invalid yParity")}e(!1,"missing v")}(t.v,t.yParityAndS,t.yParity),u=new n(Ie,a,s,l);return o&&(u.#n=o),e(t.yParity==null||_(t.yParity,"sig.yParity")===u.yParity,"yParity mismatch"),e(t.yParityAndS==null||t.yParityAndS===u.yParityAndS,"yParityAndS mismatch"),u}};var Ti=BigInt(0),vi=BigInt(36);function eo(n){n=n.toLowerCase();let t=n.substring(2).split(""),e=new Uint8Array(40);for(let a=0;a<40;a++)e[a]=t[a].charCodeAt(0);let r=z(st(e));for(let a=0;a<40;a+=2)r[a>>1]>>4>=8&&(t[a]=t[a].toUpperCase()),(r[a>>1]&15)>=8&&(t[a+1]=t[a+1].toUpperCase());return"0x"+t.join("")}i(eo,"getChecksumAddress");var Ia={};for(let n=0;n<10;n++)Ia[String(n)]=String(n);for(let n=0;n<26;n++)Ia[String.fromCharCode(65+n)]=String(10+n);var ro=15;function Pi(n){n=n.toUpperCase(),n=n.substring(4)+n.substring(0,2)+"00";let t=n.split("").map(r=>Ia[r]).join("");for(;t.length>=ro;){let r=t.substring(0,ro);t=parseInt(r,10)%97+t.substring(r.length)}let e=String(98-parseInt(t,10)%97);for(;e.length<2;)e="0"+e;return e}i(Pi,"ibanChecksum");var ki=function(){let n={};for(let t=0;t<36;t++){let e="0123456789abcdefghijklmnopqrstuvwxyz"[t];n[e]=BigInt(t)}return n}();function Ai(n){n=n.toLowerCase();let t=Ti;for(let e=0;e<n.length;e++)t=t*vi+ki[n[e]];return t}i(Ai,"fromBase36");function $(n){if(m(typeof n=="string","invalid address","address",n),n.match(/^(0x)?[0-9a-fA-F]{40}$/)){n.startsWith("0x")||(n="0x"+n);let t=eo(n);return m(!n.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||t===n,"bad address checksum","address",n),t}if(n.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){m(n.substring(2,4)===Pi(n),"bad icap checksum","address",n);let t=Ai(n.substring(4)).toString(16);for(;t.length<40;)t="0"+t;return eo("0x"+t)}m(!1,"invalid address","address",n)}i($,"getAddress");function Oa(n){let t=$(n.from),r=I(n.nonce,"tx.nonce").toString(16);return r==="0"?r="0x":r.length%2?r="0x0"+r:r="0x"+r,$(Tt(st(Pa([t,r])),12))}i(Oa,"getCreateAddress");function Sn(n){return n&&typeof n.getAddress=="function"}i(Sn,"isAddressable");async function Ba(n,t){let e=await t;return(e==null||e==="0x0000000000000000000000000000000000000000")&&(w(typeof n!="string","unconfigured name","UNCONFIGURED_NAME",{value:n}),m(!1,"invalid AddressLike value; did not resolve to a value address","target",n)),$(e)}i(Ba,"checkAddress");function re(n,t){if(typeof n=="string")return n.match(/^0x[0-9a-f]{40}$/i)?$(n):(w(t!=null,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),Ba(n,t.resolveName(n)));if(Sn(n))return Ba(n,n.getAddress());if(n&&typeof n.then=="function")return Ba(n,n);m(!1,"unsupported addressable value","target",n)}i(re,"resolveAddress");var et=32,Na=new Uint8Array(et),Ri=["then"],Dn={},so=new WeakMap;function ne(n){return so.get(n)}i(ne,"getNames");function no(n,t){so.set(n,t)}i(no,"setNames");function nr(n,t){let e=new Error(`deferred error during ABI decoding triggered accessing ${n}`);throw e.error=t,e}i(nr,"throwError");function Fa(n,t,e){return n.indexOf(null)>=0?t.map((r,a)=>r instanceof dt?Fa(ne(r),r,e):r):n.reduce((r,a,s)=>{let o=t.getValue(a);return a in r||(e&&o instanceof dt&&(o=Fa(ne(o),o,e)),r[a]=o),r},{})}i(Fa,"toObject");var dt=class n extends Array{static{i(this,"Result")}#t;constructor(...t){let e=t[0],r=t[1],a=(t[2]||[]).slice(),s=!0;e!==Dn&&(r=t,a=[],s=!1),super(r.length),r.forEach((u,p)=>{this[p]=u});let o=a.reduce((u,p)=>(typeof p=="string"&&u.set(p,(u.get(p)||0)+1),u),new Map);if(no(this,Object.freeze(r.map((u,p)=>{let d=a[p];return d!=null&&o.get(d)===1?d:null}))),this.#t=[],this.#t==null&&this.#t,!s)return;Object.freeze(this);let l=new Proxy(this,{get:i((u,p,d)=>{if(typeof p=="string"){if(p.match(/^[0-9]+$/)){let h=_(p,"%index");if(h<0||h>=this.length)throw new RangeError("out of result range");let C=u[h];return C instanceof Error&&nr(`index ${h}`,C),C}if(Ri.indexOf(p)>=0)return Reflect.get(u,p,d);let f=u[p];if(f instanceof Function)return function(...h){return f.apply(this===d?u:this,h)};if(!(p in u))return u.getValue.apply(this===d?u:this,[p])}return Reflect.get(u,p,d)},"get")});return no(l,ne(this)),l}toArray(t){let e=[];return this.forEach((r,a)=>{r instanceof Error&&nr(`index ${a}`,r),t&&r instanceof n&&(r=r.toArray(t)),e.push(r)}),e}toObject(t){let e=ne(this);return e.reduce((r,a,s)=>(w(a!=null,`value at index ${s} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),Fa(e,this,t)),{})}slice(t,e){t==null&&(t=0),t<0&&(t+=this.length,t<0&&(t=0)),e==null&&(e=this.length),e<0&&(e+=this.length,e<0&&(e=0)),e>this.length&&(e=this.length);let r=ne(this),a=[],s=[];for(let o=t;o<e;o++)a.push(this[o]),s.push(r[o]);return new n(Dn,a,s)}filter(t,e){let r=ne(this),a=[],s=[];for(let o=0;o<this.length;o++){let l=this[o];l instanceof Error&&nr(`index ${o}`,l),t.call(e,l,o,this)&&(a.push(l),s.push(r[o]))}return new n(Dn,a,s)}map(t,e){let r=[];for(let a=0;a<this.length;a++){let s=this[a];s instanceof Error&&nr(`index ${a}`,s),r.push(t.call(e,s,a,this))}return r}getValue(t){let e=ne(this).indexOf(t);if(e===-1)return;let r=this[e];return r instanceof Error&&nr(`property ${JSON.stringify(t)}`,r.error),r}static fromItems(t,e){return new n(Dn,t,e)}};function ao(n){let t=qe(n);return w(t.length<=et,"value out-of-bounds","BUFFER_OVERRUN",{buffer:t,length:et,offset:t.length}),t.length!==et&&(t=nt(lt([Na.slice(t.length%et),t]))),t}i(ao,"getValue");var Q=class{static{i(this,"Coder")}name;type;localName;dynamic;constructor(t,e,r,a){v(this,{name:t,type:e,localName:r,dynamic:a},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(t,e){m(!1,t,this.localName,e)}},ae=class{static{i(this,"Writer")}#t;#e;constructor(){this.#t=[],this.#e=0}get data(){return lt(this.#t)}get length(){return this.#e}#r(t){return this.#t.push(t),this.#e+=t.length,t.length}appendWriter(t){return this.#r(nt(t.data))}writeBytes(t){let e=nt(t),r=e.length%et;return r&&(e=nt(lt([e,Na.slice(r)]))),this.#r(e)}writeValue(t){return this.#r(ao(t))}writeUpdatableValue(){let t=this.#t.length;return this.#t.push(Na),this.#e+=et,e=>{this.#t[t]=ao(e)}}},_n=class n{static{i(this,"Reader")}allowLoose;#t;#e;#r;#n;#a;constructor(t,e,r){v(this,{allowLoose:!!e}),this.#t=nt(t),this.#r=0,this.#n=null,this.#a=r??1024,this.#e=0}get data(){return D(this.#t)}get dataLength(){return this.#t.length}get consumed(){return this.#e}get bytes(){return new Uint8Array(this.#t)}#s(t){if(this.#n)return this.#n.#s(t);this.#r+=t,w(this.#a<1||this.#r<=this.#a*this.dataLength,`compressed ABI data exceeds inflation ratio of ${this.#a} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:nt(this.#t),offset:this.#e,length:t,info:{bytesRead:this.#r,dataLength:this.dataLength}})}#o(t,e,r){let a=Math.ceil(e/et)*et;return this.#e+a>this.#t.length&&(this.allowLoose&&r&&this.#e+e<=this.#t.length?a=e:w(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:nt(this.#t),length:this.#t.length,offset:this.#e+a})),this.#t.slice(this.#e,this.#e+a)}subReader(t){let e=new n(this.#t.slice(this.#e+t),this.allowLoose,this.#a);return e.#n=this,e}readBytes(t,e){let r=this.#o(0,t,!!e);return this.#s(t),this.#e+=r.length,r.slice(0,t)}readValue(){return An(this.readBytes(et))}readIndex(){return va(this.readBytes(et))}};var yt={};function b(n,t){let e=!1;return t<0&&(e=!0,t*=-1),new J(yt,`${e?"":"u"}int${t}`,n,{signed:e,width:t})}i(b,"n");function G(n,t){return new J(yt,`bytes${t||""}`,n,{size:t})}i(G,"b");var oo=Symbol.for("_ethers_typed"),J=class n{static{i(this,"Typed")}type;value;#t;_typedSymbol;constructor(t,e,r,a){a==null&&(a=null),$t(yt,t,"Typed"),v(this,{_typedSymbol:oo,type:e,value:r}),this.#t=a,this.format()}format(){if(this.type==="array")throw new Error("");if(this.type==="dynamicArray")throw new Error("");return this.type==="tuple"?`tuple(${this.value.map(t=>t.format()).join(",")})`:this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return this.type==="string"}get tupleName(){if(this.type!=="tuple")throw TypeError("not a tuple");return this.#t}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return this.#t===!0?-1:this.#t===!1?this.value.length:null}static from(t,e){return new n(yt,t,e)}static uint8(t){return b(t,8)}static uint16(t){return b(t,16)}static uint24(t){return b(t,24)}static uint32(t){return b(t,32)}static uint40(t){return b(t,40)}static uint48(t){return b(t,48)}static uint56(t){return b(t,56)}static uint64(t){return b(t,64)}static uint72(t){return b(t,72)}static uint80(t){return b(t,80)}static uint88(t){return b(t,88)}static uint96(t){return b(t,96)}static uint104(t){return b(t,104)}static uint112(t){return b(t,112)}static uint120(t){return b(t,120)}static uint128(t){return b(t,128)}static uint136(t){return b(t,136)}static uint144(t){return b(t,144)}static uint152(t){return b(t,152)}static uint160(t){return b(t,160)}static uint168(t){return b(t,168)}static uint176(t){return b(t,176)}static uint184(t){return b(t,184)}static uint192(t){return b(t,192)}static uint200(t){return b(t,200)}static uint208(t){return b(t,208)}static uint216(t){return b(t,216)}static uint224(t){return b(t,224)}static uint232(t){return b(t,232)}static uint240(t){return b(t,240)}static uint248(t){return b(t,248)}static uint256(t){return b(t,256)}static uint(t){return b(t,256)}static int8(t){return b(t,-8)}static int16(t){return b(t,-16)}static int24(t){return b(t,-24)}static int32(t){return b(t,-32)}static int40(t){return b(t,-40)}static int48(t){return b(t,-48)}static int56(t){return b(t,-56)}static int64(t){return b(t,-64)}static int72(t){return b(t,-72)}static int80(t){return b(t,-80)}static int88(t){return b(t,-88)}static int96(t){return b(t,-96)}static int104(t){return b(t,-104)}static int112(t){return b(t,-112)}static int120(t){return b(t,-120)}static int128(t){return b(t,-128)}static int136(t){return b(t,-136)}static int144(t){return b(t,-144)}static int152(t){return b(t,-152)}static int160(t){return b(t,-160)}static int168(t){return b(t,-168)}static int176(t){return b(t,-176)}static int184(t){return b(t,-184)}static int192(t){return b(t,-192)}static int200(t){return b(t,-200)}static int208(t){return b(t,-208)}static int216(t){return b(t,-216)}static int224(t){return b(t,-224)}static int232(t){return b(t,-232)}static int240(t){return b(t,-240)}static int248(t){return b(t,-248)}static int256(t){return b(t,-256)}static int(t){return b(t,-256)}static bytes1(t){return G(t,1)}static bytes2(t){return G(t,2)}static bytes3(t){return G(t,3)}static bytes4(t){return G(t,4)}static bytes5(t){return G(t,5)}static bytes6(t){return G(t,6)}static bytes7(t){return G(t,7)}static bytes8(t){return G(t,8)}static bytes9(t){return G(t,9)}static bytes10(t){return G(t,10)}static bytes11(t){return G(t,11)}static bytes12(t){return G(t,12)}static bytes13(t){return G(t,13)}static bytes14(t){return G(t,14)}static bytes15(t){return G(t,15)}static bytes16(t){return G(t,16)}static bytes17(t){return G(t,17)}static bytes18(t){return G(t,18)}static bytes19(t){return G(t,19)}static bytes20(t){return G(t,20)}static bytes21(t){return G(t,21)}static bytes22(t){return G(t,22)}static bytes23(t){return G(t,23)}static bytes24(t){return G(t,24)}static bytes25(t){return G(t,25)}static bytes26(t){return G(t,26)}static bytes27(t){return G(t,27)}static bytes28(t){return G(t,28)}static bytes29(t){return G(t,29)}static bytes30(t){return G(t,30)}static bytes31(t){return G(t,31)}static bytes32(t){return G(t,32)}static address(t){return new n(yt,"address",t)}static bool(t){return new n(yt,"bool",!!t)}static bytes(t){return new n(yt,"bytes",t)}static string(t){return new n(yt,"string",t)}static array(t,e){throw new Error("not implemented yet")}static tuple(t,e){throw new Error("not implemented yet")}static overrides(t){return new n(yt,"overrides",Object.assign({},t))}static isTyped(t){return t&&typeof t=="object"&&"_typedSymbol"in t&&t._typedSymbol===oo}static dereference(t,e){if(n.isTyped(t)){if(t.type!==e)throw new Error(`invalid type: expecetd ${e}, got ${t.type}`);return t.value}return t}};var Ln=class extends Q{static{i(this,"AddressCoder")}constructor(t){super("address","address",t,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(t,e){let r=J.dereference(e,"string");try{r=$(r)}catch(a){return this._throwError(a.message,e)}return t.writeValue(r)}decode(t){return $(Qe(t.readValue(),20))}};var Hn=class extends Q{static{i(this,"AnonymousCoder")}coder;constructor(t){super(t.name,t.type,"_",t.dynamic),this.coder=t}defaultValue(){return this.coder.defaultValue()}encode(t,e){return this.coder.encode(t,e)}decode(t){return this.coder.decode(t)}};function Sa(n,t,e){let r=[];if(Array.isArray(e))r=e;else if(e&&typeof e=="object"){let u={};r=t.map(p=>{let d=p.localName;return w(d,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:p},value:e}),w(!u[d],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:p},value:e}),u[d]=!0,e[d]})}else m(!1,"invalid tuple value","tuple",e);m(t.length===r.length,"types/value length mismatch","tuple",e);let a=new ae,s=new ae,o=[];t.forEach((u,p)=>{let d=r[p];if(u.dynamic){let f=s.length;u.encode(s,d);let h=a.writeUpdatableValue();o.push(C=>{h(C+f)})}else u.encode(a,d)}),o.forEach(u=>{u(a.length)});let l=n.appendWriter(a);return l+=n.appendWriter(s),l}i(Sa,"pack");function Da(n,t){let e=[],r=[],a=n.subReader(0);return t.forEach(s=>{let o=null;if(s.dynamic){let l=n.readIndex(),u=a.subReader(l);try{o=s.decode(u)}catch(p){if(wt(p,"BUFFER_OVERRUN"))throw p;o=p,o.baseType=s.name,o.name=s.localName,o.type=s.type}}else try{o=s.decode(n)}catch(l){if(wt(l,"BUFFER_OVERRUN"))throw l;o=l,o.baseType=s.name,o.name=s.localName,o.type=s.type}if(o==null)throw new Error("investigate");e.push(o),r.push(s.localName||null)}),dt.fromItems(e,r)}i(Da,"unpack");var Un=class extends Q{static{i(this,"ArrayCoder")}coder;length;constructor(t,e,r){let a=t.type+"["+(e>=0?e:"")+"]",s=e===-1||t.dynamic;super("array",a,r,s),v(this,{coder:t,length:e})}defaultValue(){let t=this.coder.defaultValue(),e=[];for(let r=0;r<this.length;r++)e.push(t);return e}encode(t,e){let r=J.dereference(e,"array");Array.isArray(r)||this._throwError("expected array value",r);let a=this.length;a===-1&&(a=r.length,t.writeValue(r.length)),Ze(r.length,a,"coder array"+(this.localName?" "+this.localName:""));let s=[];for(let o=0;o<r.length;o++)s.push(this.coder);return Sa(t,s,r)}decode(t){let e=this.length;e===-1&&(e=t.readIndex(),w(e*et<=t.dataLength,"insufficient data length","BUFFER_OVERRUN",{buffer:t.bytes,offset:e*et,length:t.dataLength}));let r=[];for(let a=0;a<e;a++)r.push(new Hn(this.coder));return Da(t,r)}};var Vn=class extends Q{static{i(this,"BooleanCoder")}constructor(t){super("bool","bool",t,!1)}defaultValue(){return!1}encode(t,e){let r=J.dereference(e,"bool");return t.writeValue(r?1:0)}decode(t){return!!t.readValue()}};var ar=class extends Q{static{i(this,"DynamicBytesCoder")}constructor(t,e){super(t,t,e,!0)}defaultValue(){return"0x"}encode(t,e){e=nt(e);let r=t.writeValue(e.length);return r+=t.writeBytes(e),r}decode(t){return t.readBytes(t.readIndex(),!0)}},Mn=class extends ar{static{i(this,"BytesCoder")}constructor(t){super("bytes",t)}decode(t){return D(super.decode(t))}};var Gn=class extends Q{static{i(this,"FixedBytesCoder")}size;constructor(t,e){let r="bytes"+String(t);super(r,r,e,!1),v(this,{size:t},{size:"number"})}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(t,e){let r=nt(J.dereference(e,this.type));return r.length!==this.size&&this._throwError("incorrect data length",e),t.writeBytes(r)}decode(t){return D(t.readBytes(this.size))}};var Ii=new Uint8Array([]),$n=class extends Q{static{i(this,"NullCoder")}constructor(t){super("null","",t,!1)}defaultValue(){return null}encode(t,e){return e!=null&&this._throwError("not null",e),t.writeBytes(Ii)}decode(t){return t.readBytes(0),null}};var Oi=BigInt(0),Bi=BigInt(1),Ni=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),jn=class extends Q{static{i(this,"NumberCoder")}size;signed;constructor(t,e,r){let a=(e?"int":"uint")+t*8;super(a,a,r,!1),v(this,{size:t,signed:e},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(t,e){let r=I(J.dereference(e,this.type)),a=Ae(Ni,et*8);if(this.signed){let s=Ae(a,this.size*8-1);(r>s||r<-(s+Bi))&&this._throwError("value out-of-bounds",e),r=Ta(r,8*et)}else(r<Oi||r>Ae(a,this.size*8))&&this._throwError("value out-of-bounds",e);return t.writeValue(r)}decode(t){let e=Ae(t.readValue(),this.size*8);return this.signed&&(e=wa(e,this.size*8)),e}};var zn=class extends ar{static{i(this,"StringCoder")}constructor(t){super("string",t)}defaultValue(){return""}encode(t,e){return super.encode(t,Re(J.dereference(e,"string")))}decode(t){return er(super.decode(t))}};var se=class extends Q{static{i(this,"TupleCoder")}coders;constructor(t,e){let r=!1,a=[];t.forEach(o=>{o.dynamic&&(r=!0),a.push(o.type)});let s="tuple("+a.join(",")+")";super("tuple",s,e,r),v(this,{coders:Object.freeze(t.slice())})}defaultValue(){let t=[];this.coders.forEach(r=>{t.push(r.defaultValue())});let e=this.coders.reduce((r,a)=>{let s=a.localName;return s&&(r[s]||(r[s]=0),r[s]++),r},{});return this.coders.forEach((r,a)=>{let s=r.localName;!s||e[s]!==1||(s==="length"&&(s="_length"),t[s]==null&&(t[s]=t[a]))}),Object.freeze(t)}encode(t,e){let r=J.dereference(e,"tuple");return Sa(t,this.coders,r)}decode(t){return Da(t,this.coders)}};function zt(n){return st(Re(n))}i(zt,"id");function _a(n,t){return{address:$(n),storageKeys:t.map((e,r)=>(m(Y(e,32),"invalid slot",`storageKeys[${r}]`,e),e.toLowerCase()))}}i(_a,"accessSetify");function sr(n){if(Array.isArray(n))return n.map((e,r)=>Array.isArray(e)?(m(e.length===2,"invalid slot set",`value[${r}]`,e),_a(e[0],e[1])):(m(e!=null&&typeof e=="object","invalid address-slot set","value",n),_a(e.address,e.storageKeys)));m(n!=null&&typeof n=="object","invalid access list","value",n);let t=Object.keys(n).map(e=>{let r=n[e].reduce((a,s)=>(a[s]=!0,a),{});return _a(e,Object.keys(r).sort())});return t.sort((e,r)=>e.address.localeCompare(r.address)),t}i(sr,"accessListify");function at(n){let t=new Set;return n.forEach(e=>t.add(e)),Object.freeze(t)}i(at,"setify");var Fi="external public payable override",Si=at(Fi.split(" ")),yo="constant external internal payable private public pure view override",Di=at(yo.split(" ")),Co="constructor error event fallback function receive struct",xo=at(Co.split(" ")),bo="calldata memory storage payable indexed",_i=at(bo.split(" ")),Li="tuple returns",Hi=[Co,bo,Li,yo].join(" "),Ui=at(Hi.split(" ")),Vi={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},Mi=new RegExp("^(\\s*)"),Gi=new RegExp("^([0-9]+)"),$i=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),Eo=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),wo=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$"),Ct=class n{static{i(this,"TokenString")}#t;#e;get offset(){return this.#t}get length(){return this.#e.length-this.#t}constructor(t){this.#t=0,this.#e=t.slice()}clone(){return new n(this.#e)}reset(){this.#t=0}#r(t=0,e=0){return new n(this.#e.slice(t,e).map(r=>Object.freeze(Object.assign({},r,{match:r.match-t,linkBack:r.linkBack-t,linkNext:r.linkNext-t}))))}popKeyword(t){let e=this.peek();if(e.type!=="KEYWORD"||!t.has(e.text))throw new Error(`expected keyword ${e.text}`);return this.pop().text}popType(t){if(this.peek().type!==t){let e=this.peek();throw new Error(`expected ${t}; got ${e.type} ${JSON.stringify(e.text)}`)}return this.pop().text}popParen(){let t=this.peek();if(t.type!=="OPEN_PAREN")throw new Error("bad start");let e=this.#r(this.#t+1,t.match+1);return this.#t=t.match+1,e}popParams(){let t=this.peek();if(t.type!=="OPEN_PAREN")throw new Error("bad start");let e=[];for(;this.#t<t.match-1;){let r=this.peek().linkNext;e.push(this.#r(this.#t+1,r)),this.#t=r}return this.#t=t.match+1,e}peek(){if(this.#t>=this.#e.length)throw new Error("out-of-bounds");return this.#e[this.#t]}peekKeyword(t){let e=this.peekType("KEYWORD");return e!=null&&t.has(e)?e:null}peekType(t){if(this.length===0)return null;let e=this.peek();return e.type===t?e.text:null}pop(){let t=this.peek();return this.#t++,t}toString(){let t=[];for(let e=this.#t;e<this.#e.length;e++){let r=this.#e[e];t.push(`${r.type}:${r.text}`)}return`<TokenString ${t.join(" ")}>`}};function Zt(n){let t=[],e=i(o=>{let l=s<n.length?JSON.stringify(n[s]):"$EOI";throw new Error(`invalid token ${l} at ${s}: ${o}`)},"throwError"),r=[],a=[],s=0;for(;s<n.length;){let o=n.substring(s),l=o.match(Mi);l&&(s+=l[1].length,o=n.substring(s));let u={depth:r.length,linkBack:-1,linkNext:-1,match:-1,type:"",text:"",offset:s,value:-1};t.push(u);let p=Vi[o[0]]||"";if(p){if(u.type=p,u.text=o[0],s++,p==="OPEN_PAREN")r.push(t.length-1),a.push(t.length-1);else if(p=="CLOSE_PAREN")r.length===0&&e("no matching open bracket"),u.match=r.pop(),t[u.match].match=t.length-1,u.depth--,u.linkBack=a.pop(),t[u.linkBack].linkNext=t.length-1;else if(p==="COMMA")u.linkBack=a.pop(),t[u.linkBack].linkNext=t.length-1,a.push(t.length-1);else if(p==="OPEN_BRACKET")u.type="BRACKET";else if(p==="CLOSE_BRACKET"){let d=t.pop().text;if(t.length>0&&t[t.length-1].type==="NUMBER"){let f=t.pop().text;d=f+d,t[t.length-1].value=_(f)}if(t.length===0||t[t.length-1].type!=="BRACKET")throw new Error("missing opening bracket");t[t.length-1].text+=d}continue}if(l=o.match($i),l){if(u.text=l[1],s+=u.text.length,Ui.has(u.text)){u.type="KEYWORD";continue}if(u.text.match(wo)){u.type="TYPE";continue}u.type="ID";continue}if(l=o.match(Gi),l){u.text=l[1],u.type="NUMBER",s+=u.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(o[0])} at position ${s}`)}return new Ct(t.map(o=>Object.freeze(o)))}i(Zt,"lex");function io(n,t){let e=[];for(let r in t.keys())n.has(r)&&e.push(r);if(e.length>1)throw new Error(`conflicting types: ${e.join(", ")}`)}i(io,"allowSingle");function Jn(n,t){if(t.peekKeyword(xo)){let e=t.pop().text;if(e!==n)throw new Error(`expected ${n}, got ${e}`)}return t.popType("ID")}i(Jn,"consumeName");function Nt(n,t){let e=new Set;for(;;){let r=n.peekType("KEYWORD");if(r==null||t&&!t.has(r))break;if(n.pop(),e.has(r))throw new Error(`duplicate keywords: ${JSON.stringify(r)}`);e.add(r)}return Object.freeze(e)}i(Nt,"consumeKeywords");function To(n){let t=Nt(n,Di);return io(t,at("constant payable nonpayable".split(" "))),io(t,at("pure view payable nonpayable".split(" "))),t.has("view")?"view":t.has("pure")?"pure":t.has("payable")?"payable":t.has("nonpayable")?"nonpayable":t.has("constant")?"view":"nonpayable"}i(To,"consumeMutability");function Bt(n,t){return n.popParams().map(e=>q.from(e,t))}i(Bt,"consumeParams");function vo(n){if(n.peekType("AT")){if(n.pop(),n.peekType("NUMBER"))return I(n.pop().text);throw new Error("invalid gas")}return null}i(vo,"consumeGas");function oe(n){if(n.length)throw new Error(`unexpected tokens at offset ${n.offset}: ${n.toString()}`)}i(oe,"consumeEoi");var ji=new RegExp(/^(.*)\[([0-9]*)\]$/);function co(n){let t=n.match(wo);if(m(t,"invalid type","type",n),n==="uint")return"uint256";if(n==="int")return"int256";if(t[2]){let e=parseInt(t[2]);m(e!==0&&e<=32,"invalid bytes length","type",n)}else if(t[3]){let e=parseInt(t[3]);m(e!==0&&e<=256&&e%8===0,"invalid numeric width","type",n)}return n}i(co,"verifyBasicType");var W={},ot=Symbol.for("_ethers_internal"),lo="_ParamTypeInternal",uo="_ErrorInternal",po="_EventInternal",fo="_ConstructorInternal",ho="_FallbackInternal",mo="_FunctionInternal",go="_StructInternal",q=class n{static{i(this,"ParamType")}name;type;baseType;indexed;components;arrayLength;arrayChildren;constructor(t,e,r,a,s,o,l,u){if($t(t,W,"ParamType"),Object.defineProperty(this,ot,{value:lo}),o&&(o=Object.freeze(o.slice())),a==="array"){if(l==null||u==null)throw new Error("")}else if(l!=null||u!=null)throw new Error("");if(a==="tuple"){if(o==null)throw new Error("")}else if(o!=null)throw new Error("");v(this,{name:e,type:r,baseType:a,indexed:s,components:o,arrayLength:l,arrayChildren:u})}format(t){if(t==null&&(t="sighash"),t==="json"){let r=this.name||"";if(this.isArray()){let s=JSON.parse(this.arrayChildren.format("json"));return s.name=r,s.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(s)}let a={type:this.baseType==="tuple"?"tuple":this.type,name:r};return typeof this.indexed=="boolean"&&(a.indexed=this.indexed),this.isTuple()&&(a.components=this.components.map(s=>JSON.parse(s.format(t)))),JSON.stringify(a)}let e="";return this.isArray()?(e+=this.arrayChildren.format(t),e+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?e+="("+this.components.map(r=>r.format(t)).join(t==="full"?", ":",")+")":e+=this.type,t!=="sighash"&&(this.indexed===!0&&(e+=" indexed"),t==="full"&&this.name&&(e+=" "+this.name)),e}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(t,e){if(this.isArray()){if(!Array.isArray(t))throw new Error("invalid array value");if(this.arrayLength!==-1&&t.length!==this.arrayLength)throw new Error("array is wrong length");let r=this;return t.map(a=>r.arrayChildren.walk(a,e))}if(this.isTuple()){if(!Array.isArray(t))throw new Error("invalid tuple value");if(t.length!==this.components.length)throw new Error("array is wrong length");let r=this;return t.map((a,s)=>r.components[s].walk(a,e))}return e(this.type,t)}#t(t,e,r,a){if(this.isArray()){if(!Array.isArray(e))throw new Error("invalid array value");if(this.arrayLength!==-1&&e.length!==this.arrayLength)throw new Error("array is wrong length");let o=this.arrayChildren,l=e.slice();l.forEach((u,p)=>{o.#t(t,u,r,d=>{l[p]=d})}),a(l);return}if(this.isTuple()){let o=this.components,l;if(Array.isArray(e))l=e.slice();else{if(e==null||typeof e!="object")throw new Error("invalid tuple value");l=o.map(u=>{if(!u.name)throw new Error("cannot use object value with unnamed components");if(!(u.name in e))throw new Error(`missing value for component ${u.name}`);return e[u.name]})}if(l.length!==this.components.length)throw new Error("array is wrong length");l.forEach((u,p)=>{o[p].#t(t,u,r,d=>{l[p]=d})}),a(l);return}let s=r(this.type,e);s.then?t.push(async function(){a(await s)}()):a(s)}async walkAsync(t,e){let r=[],a=[t];return this.#t(r,t,e,s=>{a[0]=s}),r.length&&await Promise.all(r),a[0]}static from(t,e){if(n.isParamType(t))return t;if(typeof t=="string")try{return n.from(Zt(t),e)}catch{m(!1,"invalid param type","obj",t)}else if(t instanceof Ct){let l="",u="",p=null;Nt(t,at(["tuple"])).has("tuple")||t.peekType("OPEN_PAREN")?(u="tuple",p=t.popParams().map(A=>n.from(A)),l=`tuple(${p.map(A=>A.format()).join(",")})`):(l=co(t.popType("TYPE")),u=l);let d=null,f=null;for(;t.length&&t.peekType("BRACKET");){let A=t.pop();d=new n(W,"",l,u,null,p,f,d),f=A.value,l+=A.text,u="array",p=null}let h=null;if(Nt(t,_i).has("indexed")){if(!e)throw new Error("");h=!0}let E=t.peekType("ID")?t.pop().text:"";if(t.length)throw new Error("leftover tokens");return new n(W,E,l,u,h,p,f,d)}let r=t.name;m(!r||typeof r=="string"&&r.match(Eo),"invalid name","obj.name",r);let a=t.indexed;a==!0?(m(e,"parameter cannot be indexed","obj.indexed",t.indexed),a=!0):a=!1;let s=t.type,o=s.match(ji);if(o){let l=parseInt(o[2]||"-1"),u=n.from({type:o[1],components:t.components});return new n(W,r||"",s,"array",a,null,l,u)}if(s==="tuple"||s.startsWith("tuple(")||s.startsWith("(")){let l=t.components!=null?t.components.map(p=>n.from(p)):null;return new n(W,r||"",s,"tuple",a,l,null,null)}return s=co(t.type),new n(W,r||"",s,s,a,null,null,null)}static isParamType(t){return t&&t[ot]===lo}},Xt=class n{static{i(this,"Fragment")}type;inputs;constructor(t,e,r){$t(t,W,"Fragment"),r=Object.freeze(r.slice()),v(this,{type:e,inputs:r})}static from(t){if(typeof t=="string"){try{n.from(JSON.parse(t))}catch{}return n.from(Zt(t))}if(t instanceof Ct)switch(t.peekKeyword(xo)){case"constructor":return Wt.from(t);case"error":return ut.from(t);case"event":return Jt.from(t);case"fallback":case"receive":return ir.from(t);case"function":return Kt.from(t);case"struct":return Be.from(t)}else if(typeof t=="object"){switch(t.type){case"constructor":return Wt.from(t);case"error":return ut.from(t);case"event":return Jt.from(t);case"fallback":case"receive":return ir.from(t);case"function":return Kt.from(t);case"struct":return Be.from(t)}w(!1,`unsupported type: ${t.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}m(!1,"unsupported frgament object","obj",t)}static isConstructor(t){return Wt.isFragment(t)}static isError(t){return ut.isFragment(t)}static isEvent(t){return Jt.isFragment(t)}static isFunction(t){return Kt.isFragment(t)}static isStruct(t){return Be.isFragment(t)}},ie=class extends Xt{static{i(this,"NamedFragment")}name;constructor(t,e,r,a){super(t,e,a),m(typeof r=="string"&&r.match(Eo),"invalid identifier","name",r),a=Object.freeze(a.slice()),v(this,{name:r})}};function or(n,t){return"("+t.map(e=>e.format(n)).join(n==="full"?", ":",")+")"}i(or,"joinParams");var ut=class n extends ie{static{i(this,"ErrorFragment")}constructor(t,e,r){super(t,"error",e,r),Object.defineProperty(this,ot,{value:uo})}get selector(){return zt(this.format("sighash")).substring(0,10)}format(t){if(t==null&&(t="sighash"),t==="json")return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(t)))});let e=[];return t!=="sighash"&&e.push("error"),e.push(this.name+or(t,this.inputs)),e.join(" ")}static from(t){if(n.isFragment(t))return t;if(typeof t=="string")return n.from(Zt(t));if(t instanceof Ct){let e=Jn("error",t),r=Bt(t);return oe(t),new n(W,e,r)}return new n(W,t.name,t.inputs?t.inputs.map(q.from):[])}static isFragment(t){return t&&t[ot]===uo}},Jt=class n extends ie{static{i(this,"EventFragment")}anonymous;constructor(t,e,r,a){super(t,"event",e,r),Object.defineProperty(this,ot,{value:po}),v(this,{anonymous:a})}get topicHash(){return zt(this.format("sighash"))}format(t){if(t==null&&(t="sighash"),t==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(t)))});let e=[];return t!=="sighash"&&e.push("event"),e.push(this.name+or(t,this.inputs)),t!=="sighash"&&this.anonymous&&e.push("anonymous"),e.join(" ")}static getTopicHash(t,e){return e=(e||[]).map(a=>q.from(a)),new n(W,t,e,!1).topicHash}static from(t){if(n.isFragment(t))return t;if(typeof t=="string")try{return n.from(Zt(t))}catch{m(!1,"invalid event fragment","obj",t)}else if(t instanceof Ct){let e=Jn("event",t),r=Bt(t,!0),a=!!Nt(t,at(["anonymous"])).has("anonymous");return oe(t),new n(W,e,r,a)}return new n(W,t.name,t.inputs?t.inputs.map(e=>q.from(e,!0)):[],!!t.anonymous)}static isFragment(t){return t&&t[ot]===po}},Wt=class n extends Xt{static{i(this,"ConstructorFragment")}payable;gas;constructor(t,e,r,a,s){super(t,e,r),Object.defineProperty(this,ot,{value:fo}),v(this,{payable:a,gas:s})}format(t){if(w(t!=null&&t!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),t==="json")return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(r=>JSON.parse(r.format(t)))});let e=[`constructor${or(t,this.inputs)}`];return this.payable&&e.push("payable"),this.gas!=null&&e.push(`@${this.gas.toString()}`),e.join(" ")}static from(t){if(n.isFragment(t))return t;if(typeof t=="string")try{return n.from(Zt(t))}catch{m(!1,"invalid constuctor fragment","obj",t)}else if(t instanceof Ct){Nt(t,at(["constructor"]));let e=Bt(t),r=!!Nt(t,Si).has("payable"),a=vo(t);return oe(t),new n(W,"constructor",e,r,a)}return new n(W,"constructor",t.inputs?t.inputs.map(q.from):[],!!t.payable,t.gas!=null?t.gas:null)}static isFragment(t){return t&&t[ot]===fo}},ir=class n extends Xt{static{i(this,"FallbackFragment")}payable;constructor(t,e,r){super(t,"fallback",e),Object.defineProperty(this,ot,{value:ho}),v(this,{payable:r})}format(t){let e=this.inputs.length===0?"receive":"fallback";if(t==="json"){let r=this.payable?"payable":"nonpayable";return JSON.stringify({type:e,stateMutability:r})}return`${e}()${this.payable?" payable":""}`}static from(t){if(n.isFragment(t))return t;if(typeof t=="string")try{return n.from(Zt(t))}catch{m(!1,"invalid fallback fragment","obj",t)}else if(t instanceof Ct){let e=t.toString(),r=t.peekKeyword(at(["fallback","receive"]));if(m(r,"type must be fallback or receive","obj",e),t.popKeyword(at(["fallback","receive"]))==="receive"){let l=Bt(t);return m(l.length===0,"receive cannot have arguments","obj.inputs",l),Nt(t,at(["payable"])),oe(t),new n(W,[],!0)}let s=Bt(t);s.length?m(s.length===1&&s[0].type==="bytes","invalid fallback inputs","obj.inputs",s.map(l=>l.format("minimal")).join(", ")):s=[q.from("bytes")];let o=To(t);if(m(o==="nonpayable"||o==="payable","fallback cannot be constants","obj.stateMutability",o),Nt(t,at(["returns"])).has("returns")){let l=Bt(t);m(l.length===1&&l[0].type==="bytes","invalid fallback outputs","obj.outputs",l.map(u=>u.format("minimal")).join(", "))}return oe(t),new n(W,s,o==="payable")}if(t.type==="receive")return new n(W,[],!0);if(t.type==="fallback"){let e=[q.from("bytes")],r=t.stateMutability==="payable";return new n(W,e,r)}m(!1,"invalid fallback description","obj",t)}static isFragment(t){return t&&t[ot]===ho}},Kt=class n extends ie{static{i(this,"FunctionFragment")}constant;outputs;stateMutability;payable;gas;constructor(t,e,r,a,s,o){super(t,"function",e,a),Object.defineProperty(this,ot,{value:mo}),s=Object.freeze(s.slice()),v(this,{constant:r==="view"||r==="pure",gas:o,outputs:s,payable:r==="payable",stateMutability:r})}get selector(){return zt(this.format("sighash")).substring(0,10)}format(t){if(t==null&&(t="sighash"),t==="json")return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(r=>JSON.parse(r.format(t))),outputs:this.outputs.map(r=>JSON.parse(r.format(t)))});let e=[];return t!=="sighash"&&e.push("function"),e.push(this.name+or(t,this.inputs)),t!=="sighash"&&(this.stateMutability!=="nonpayable"&&e.push(this.stateMutability),this.outputs&&this.outputs.length&&(e.push("returns"),e.push(or(t,this.outputs))),this.gas!=null&&e.push(`@${this.gas.toString()}`)),e.join(" ")}static getSelector(t,e){return e=(e||[]).map(a=>q.from(a)),new n(W,t,"view",e,[],null).selector}static from(t){if(n.isFragment(t))return t;if(typeof t=="string")try{return n.from(Zt(t))}catch{m(!1,"invalid function fragment","obj",t)}else if(t instanceof Ct){let r=Jn("function",t),a=Bt(t),s=To(t),o=[];Nt(t,at(["returns"])).has("returns")&&(o=Bt(t));let l=vo(t);return oe(t),new n(W,r,s,a,o,l)}let e=t.stateMutability;return e==null&&(e="payable",typeof t.constant=="boolean"?(e="view",t.constant||(e="payable",typeof t.payable=="boolean"&&!t.payable&&(e="nonpayable"))):typeof t.payable=="boolean"&&!t.payable&&(e="nonpayable")),new n(W,t.name,e,t.inputs?t.inputs.map(q.from):[],t.outputs?t.outputs.map(q.from):[],t.gas!=null?t.gas:null)}static isFragment(t){return t&&t[ot]===mo}},Be=class n extends ie{static{i(this,"StructFragment")}constructor(t,e,r){super(t,"struct",e,r),Object.defineProperty(this,ot,{value:go})}format(){throw new Error("@TODO")}static from(t){if(typeof t=="string")try{return n.from(Zt(t))}catch{m(!1,"invalid struct fragment","obj",t)}else if(t instanceof Ct){let e=Jn("struct",t),r=Bt(t);return oe(t),new n(W,e,r)}return new n(W,t.name,t.inputs?t.inputs.map(q.from):[])}static isFragment(t){return t&&t[ot]===go}};var xt=new Map;xt.set(0,"GENERIC_PANIC");xt.set(1,"ASSERT_FALSE");xt.set(17,"OVERFLOW");xt.set(18,"DIVIDE_BY_ZERO");xt.set(33,"ENUM_RANGE_ERROR");xt.set(34,"BAD_STORAGE_DATA");xt.set(49,"STACK_UNDERFLOW");xt.set(50,"ARRAY_RANGE_ERROR");xt.set(65,"OUT_OF_MEMORY");xt.set(81,"UNINITIALIZED_FUNCTION_CALL");var zi=new RegExp(/^bytes([0-9]*)$/),Ji=new RegExp(/^(u?int)([0-9]*)$/),La=null,Po=1024;function Wi(n,t,e,r){let a="missing revert data",s=null,o=null,l=null;if(e){a="execution reverted";let p=z(e);if(e=D(e),p.length===0)a+=" (no data present; likely require(false) occurred",s="require(false)";else if(p.length%32!==4)a+=" (could not decode reason; invalid data length)";else if(D(p.slice(0,4))==="0x08c379a0")try{s=r.decode(["string"],p.slice(4))[0],l={signature:"Error(string)",name:"Error",args:[s]},a+=`: ${JSON.stringify(s)}`}catch{a+=" (could not decode reason; invalid string data)"}else if(D(p.slice(0,4))==="0x4e487b71")try{let d=Number(r.decode(["uint256"],p.slice(4))[0]);l={signature:"Panic(uint256)",name:"Panic",args:[d]},s=`Panic due to ${xt.get(d)||"UNKNOWN"}(${d})`,a+=`: ${s}`}catch{a+=" (could not decode panic code)"}else a+=" (unknown custom error)"}let u={to:t.to?$(t.to):null,data:t.data||"0x"};return t.from&&(u.from=$(t.from)),Ot(a,"CALL_EXCEPTION",{action:n,data:e,reason:s,transaction:u,invocation:o,revert:l})}i(Wi,"getBuiltinCallException");var Ne=class n{static{i(this,"AbiCoder")}#t(t){if(t.isArray())return new Un(this.#t(t.arrayChildren),t.arrayLength,t.name);if(t.isTuple())return new se(t.components.map(r=>this.#t(r)),t.name);switch(t.baseType){case"address":return new Ln(t.name);case"bool":return new Vn(t.name);case"string":return new zn(t.name);case"bytes":return new Mn(t.name);case"":return new $n(t.name)}let e=t.type.match(Ji);if(e){let r=parseInt(e[2]||"256");return m(r!==0&&r<=256&&r%8===0,"invalid "+e[1]+" bit length","param",t),new jn(r/8,e[1]==="int",t.name)}if(e=t.type.match(zi),e){let r=parseInt(e[1]);return m(r!==0&&r<=32,"invalid bytes length","param",t),new Gn(r,t.name)}m(!1,"invalid type","type",t.type)}getDefaultValue(t){let e=t.map(a=>this.#t(q.from(a)));return new se(e,"_").defaultValue()}encode(t,e){Ze(e.length,t.length,"types/values length mismatch");let r=t.map(o=>this.#t(q.from(o))),a=new se(r,"_"),s=new ae;return a.encode(s,e),s.data}decode(t,e,r){let a=t.map(o=>this.#t(q.from(o)));return new se(a,"_").decode(new _n(e,r,Po))}static _setDefaultMaxInflation(t){m(typeof t=="number"&&Number.isInteger(t),"invalid defaultMaxInflation factor","value",t),Po=t}static defaultAbiCoder(){return La==null&&(La=new n),La}static getBuiltinCallException(t,e,r){return Wi(t,e,r,n.defaultAbiCoder())}};function ko(n){let t=z(n,"bytes");if(t.length!==32)throw new Error("invalid bytes32 - not 32 bytes long");if(t[31]!==0)throw new Error("invalid bytes32 string - no null terminator");let e=31;for(;t[e-1]===0;)e--;return er(t.slice(0,e))}i(ko,"decodeBytes32String");var cr=class{static{i(this,"LogDescription")}fragment;name;signature;topic;args;constructor(t,e,r){let a=t.name,s=t.format();v(this,{fragment:t,name:a,signature:s,topic:e,args:r})}},lr=class{static{i(this,"TransactionDescription")}fragment;name;args;signature;selector;value;constructor(t,e,r,a){let s=t.name,o=t.format();v(this,{fragment:t,name:s,args:r,signature:o,selector:e,value:a})}},ur=class{static{i(this,"ErrorDescription")}fragment;name;args;signature;selector;constructor(t,e,r){let a=t.name,s=t.format();v(this,{fragment:t,name:a,args:r,signature:s,selector:e})}},Fe=class{static{i(this,"Indexed")}hash;_isIndexed;static isIndexed(t){return!!(t&&t._isIndexed)}constructor(t){v(this,{hash:t,_isIndexed:!0})}},Ao={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"},Ro={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:i(n=>`reverted with reason string ${JSON.stringify(n)}`,"reason")},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:i(n=>{let t="unknown panic code";return n>=0&&n<=255&&Ao[n.toString()]&&(t=Ao[n.toString()]),`reverted with panic code 0x${n.toString(16)} (${t})`},"reason")}},Ft=class n{static{i(this,"Interface")}fragments;deploy;fallback;receive;#t;#e;#r;#n;constructor(t){let e=[];typeof t=="string"?e=JSON.parse(t):e=t,this.#r=new Map,this.#t=new Map,this.#e=new Map;let r=[];for(let o of e)try{r.push(Xt.from(o))}catch(l){console.log(`[Warning] Invalid Fragment ${JSON.stringify(o)}:`,l.message)}v(this,{fragments:Object.freeze(r)});let a=null,s=!1;this.#n=this.getAbiCoder(),this.fragments.forEach((o,l)=>{let u;switch(o.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}v(this,{deploy:o});return;case"fallback":o.inputs.length===0?s=!0:(m(!a||o.payable!==a.payable,"conflicting fallback fragments",`fragments[${l}]`,o),a=o,s=a.payable);return;case"function":u=this.#r;break;case"event":u=this.#e;break;case"error":u=this.#t;break;default:return}let p=o.format();u.has(p)||u.set(p,o)}),this.deploy||v(this,{deploy:Wt.from("constructor()")}),v(this,{fallback:a,receive:s})}format(t){let e=t?"minimal":"full";return this.fragments.map(a=>a.format(e))}formatJson(){let t=this.fragments.map(e=>e.format("json"));return JSON.stringify(t.map(e=>JSON.parse(e)))}getAbiCoder(){return Ne.defaultAbiCoder()}#a(t,e,r){if(Y(t)){let s=t.toLowerCase();for(let o of this.#r.values())if(s===o.selector)return o;return null}if(t.indexOf("(")===-1){let s=[];for(let[o,l]of this.#r)o.split("(")[0]===t&&s.push(l);if(e){let o=e.length>0?e[e.length-1]:null,l=e.length,u=!0;J.isTyped(o)&&o.type==="overrides"&&(u=!1,l--);for(let p=s.length-1;p>=0;p--){let d=s[p].inputs.length;d!==l&&(!u||d!==l-1)&&s.splice(p,1)}for(let p=s.length-1;p>=0;p--){let d=s[p].inputs;for(let f=0;f<e.length;f++)if(J.isTyped(e[f])){if(f>=d.length){if(e[f].type==="overrides")continue;s.splice(p,1);break}if(e[f].type!==d[f].baseType){s.splice(p,1);break}}}}if(s.length===1&&e&&e.length!==s[0].inputs.length){let o=e[e.length-1];(o==null||Array.isArray(o)||typeof o!="object")&&s.splice(0,1)}if(s.length===0)return null;if(s.length>1&&r){let o=s.map(l=>JSON.stringify(l.format())).join(", ");m(!1,`ambiguous function description (i.e. matches ${o})`,"key",t)}return s[0]}let a=this.#r.get(Kt.from(t).format());return a||null}getFunctionName(t){let e=this.#a(t,null,!1);return m(e,"no matching function","key",t),e.name}hasFunction(t){return!!this.#a(t,null,!1)}getFunction(t,e){return this.#a(t,e||null,!0)}forEachFunction(t){let e=Array.from(this.#r.keys());e.sort((r,a)=>r.localeCompare(a));for(let r=0;r<e.length;r++){let a=e[r];t(this.#r.get(a),r)}}#s(t,e,r){if(Y(t)){let s=t.toLowerCase();for(let o of this.#e.values())if(s===o.topicHash)return o;return null}if(t.indexOf("(")===-1){let s=[];for(let[o,l]of this.#e)o.split("(")[0]===t&&s.push(l);if(e){for(let o=s.length-1;o>=0;o--)s[o].inputs.length<e.length&&s.splice(o,1);for(let o=s.length-1;o>=0;o--){let l=s[o].inputs;for(let u=0;u<e.length;u++)if(J.isTyped(e[u])&&e[u].type!==l[u].baseType){s.splice(o,1);break}}}if(s.length===0)return null;if(s.length>1&&r){let o=s.map(l=>JSON.stringify(l.format())).join(", ");m(!1,`ambiguous event description (i.e. matches ${o})`,"key",t)}return s[0]}let a=this.#e.get(Jt.from(t).format());return a||null}getEventName(t){let e=this.#s(t,null,!1);return m(e,"no matching event","key",t),e.name}hasEvent(t){return!!this.#s(t,null,!1)}getEvent(t,e){return this.#s(t,e||null,!0)}forEachEvent(t){let e=Array.from(this.#e.keys());e.sort((r,a)=>r.localeCompare(a));for(let r=0;r<e.length;r++){let a=e[r];t(this.#e.get(a),r)}}getError(t,e){if(Y(t)){let a=t.toLowerCase();if(Ro[a])return ut.from(Ro[a].signature);for(let s of this.#t.values())if(a===s.selector)return s;return null}if(t.indexOf("(")===-1){let a=[];for(let[s,o]of this.#t)s.split("(")[0]===t&&a.push(o);if(a.length===0)return t==="Error"?ut.from("error Error(string)"):t==="Panic"?ut.from("error Panic(uint256)"):null;if(a.length>1){let s=a.map(o=>JSON.stringify(o.format())).join(", ");m(!1,`ambiguous error description (i.e. ${s})`,"name",t)}return a[0]}if(t=ut.from(t).format(),t==="Error(string)")return ut.from("error Error(string)");if(t==="Panic(uint256)")return ut.from("error Panic(uint256)");let r=this.#t.get(t);return r||null}forEachError(t){let e=Array.from(this.#t.keys());e.sort((r,a)=>r.localeCompare(a));for(let r=0;r<e.length;r++){let a=e[r];t(this.#t.get(a),r)}}_decodeParams(t,e){return this.#n.decode(t,e)}_encodeParams(t,e){return this.#n.encode(t,e)}encodeDeploy(t){return this._encodeParams(this.deploy.inputs,t||[])}decodeErrorResult(t,e){if(typeof t=="string"){let r=this.getError(t);m(r,"unknown error","fragment",t),t=r}return m(Tt(e,0,4)===t.selector,`data signature does not match error ${t.name}.`,"data",e),this._decodeParams(t.inputs,Tt(e,4))}encodeErrorResult(t,e){if(typeof t=="string"){let r=this.getError(t);m(r,"unknown error","fragment",t),t=r}return lt([t.selector,this._encodeParams(t.inputs,e||[])])}decodeFunctionData(t,e){if(typeof t=="string"){let r=this.getFunction(t);m(r,"unknown function","fragment",t),t=r}return m(Tt(e,0,4)===t.selector,`data signature does not match function ${t.name}.`,"data",e),this._decodeParams(t.inputs,Tt(e,4))}encodeFunctionData(t,e){if(typeof t=="string"){let r=this.getFunction(t);m(r,"unknown function","fragment",t),t=r}return lt([t.selector,this._encodeParams(t.inputs,e||[])])}decodeFunctionResult(t,e){if(typeof t=="string"){let s=this.getFunction(t);m(s,"unknown function","fragment",t),t=s}let r="invalid length for result data",a=nt(e);if(a.length%32===0)try{return this.#n.decode(t.outputs,a)}catch{r="could not decode result data"}w(!1,r,"BAD_DATA",{value:D(a),info:{method:t.name,signature:t.format()}})}makeError(t,e){let r=z(t,"data"),a=Ne.getBuiltinCallException("call",e,r);if(a.message.startsWith("execution reverted (unknown custom error)")){let l=D(r.slice(0,4)),u=this.getError(l);if(u)try{let p=this.#n.decode(u.inputs,r.slice(4));a.revert={name:u.name,signature:u.format(),args:p},a.reason=a.revert.signature,a.message=`execution reverted: ${a.reason}`}catch{a.message="execution reverted (coult not decode custom error)"}}let o=this.parseTransaction(e);return o&&(a.invocation={method:o.name,signature:o.signature,args:o.args}),a}encodeFunctionResult(t,e){if(typeof t=="string"){let r=this.getFunction(t);m(r,"unknown function","fragment",t),t=r}return D(this.#n.encode(t.outputs,e||[]))}encodeFilterTopics(t,e){if(typeof t=="string"){let s=this.getEvent(t);m(s,"unknown event","eventFragment",t),t=s}w(e.length<=t.inputs.length,`too many arguments for ${t.format()}`,"UNEXPECTED_ARGUMENT",{count:e.length,expectedCount:t.inputs.length});let r=[];t.anonymous||r.push(t.topicHash);let a=i((s,o)=>s.type==="string"?zt(o):s.type==="bytes"?st(D(o)):(s.type==="bool"&&typeof o=="boolean"?o=o?"0x01":"0x00":s.type.match(/^u?int/)?o=Qe(o):s.type.match(/^bytes/)?o=Pn(o,32):s.type==="address"&&this.#n.encode(["address"],[o]),Pe(D(o),32)),"encodeTopic");for(e.forEach((s,o)=>{let l=t.inputs[o];if(!l.indexed){m(s==null,"cannot filter non-indexed parameters; must be null","contract."+l.name,s);return}s==null?r.push(null):l.baseType==="array"||l.baseType==="tuple"?m(!1,"filtering with tuples or arrays not supported","contract."+l.name,s):Array.isArray(s)?r.push(s.map(u=>a(l,u))):r.push(a(l,s))});r.length&&r[r.length-1]===null;)r.pop();return r}encodeEventLog(t,e){if(typeof t=="string"){let o=this.getEvent(t);m(o,"unknown event","eventFragment",t),t=o}let r=[],a=[],s=[];return t.anonymous||r.push(t.topicHash),m(e.length===t.inputs.length,"event arguments/values mismatch","values",e),t.inputs.forEach((o,l)=>{let u=e[l];if(o.indexed)if(o.type==="string")r.push(zt(u));else if(o.type==="bytes")r.push(st(u));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");r.push(this.#n.encode([o.type],[u]))}else a.push(o),s.push(u)}),{data:this.#n.encode(a,s),topics:r}}decodeEventLog(t,e,r){if(typeof t=="string"){let C=this.getEvent(t);m(C,"unknown event","eventFragment",t),t=C}if(r!=null&&!t.anonymous){let C=t.topicHash;m(Y(r[0],32)&&r[0].toLowerCase()===C,"fragment/topic mismatch","topics[0]",r[0]),r=r.slice(1)}let a=[],s=[],o=[];t.inputs.forEach((C,E)=>{C.indexed?C.type==="string"||C.type==="bytes"||C.baseType==="tuple"||C.baseType==="array"?(a.push(q.from({type:"bytes32",name:C.name})),o.push(!0)):(a.push(C),o.push(!1)):(s.push(C),o.push(!1))});let l=r!=null?this.#n.decode(a,lt(r)):null,u=this.#n.decode(s,e,!0),p=[],d=[],f=0,h=0;return t.inputs.forEach((C,E)=>{let A=null;if(C.indexed)if(l==null)A=new Fe(null);else if(o[E])A=new Fe(l[h++]);else try{A=l[h++]}catch(S){A=S}else try{A=u[f++]}catch(S){A=S}p.push(A),d.push(C.name||null)}),dt.fromItems(p,d)}parseTransaction(t){let e=z(t.data,"tx.data"),r=I(t.value!=null?t.value:0,"tx.value"),a=this.getFunction(D(e.slice(0,4)));if(!a)return null;let s=this.#n.decode(a.inputs,e.slice(4));return new lr(a,a.selector,s,r)}parseCallResult(t){throw new Error("@TODO")}parseLog(t){let e=this.getEvent(t.topics[0]);return!e||e.anonymous?null:new cr(e,e.topicHash,this.decodeEventLog(e,t.data,t.topics))}parseError(t){let e=D(t),r=this.getError(Tt(e,0,4));if(!r)return null;let a=this.#n.decode(r.inputs,Tt(e,4));return new ur(r,r.selector,a)}static from(t){return t instanceof n?t:typeof t=="string"?new n(JSON.parse(t)):typeof t.formatJson=="function"?new n(t.formatJson()):typeof t.format=="function"?new n(t.format("json")):new n(t)}};var Oo=BigInt(0);function ft(n){return n==null?null:n.toString()}i(ft,"toJson");function Bo(n){let t={};n.to&&(t.to=n.to),n.from&&(t.from=n.from),n.data&&(t.data=D(n.data));let e="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(let a of e)!(a in n)||n[a]==null||(t[a]=I(n[a],`request.${a}`));let r="type,nonce".split(/,/);for(let a of r)!(a in n)||n[a]==null||(t[a]=_(n[a],`request.${a}`));return n.accessList&&(t.accessList=sr(n.accessList)),"blockTag"in n&&(t.blockTag=n.blockTag),"enableCcipRead"in n&&(t.enableCcipRead=!!n.enableCcipRead),"customData"in n&&(t.customData=n.customData),"blobVersionedHashes"in n&&n.blobVersionedHashes&&(t.blobVersionedHashes=n.blobVersionedHashes.slice()),"kzg"in n&&(t.kzg=n.kzg),"blobs"in n&&n.blobs&&(t.blobs=n.blobs.map(a=>Ea(a)?D(a):Object.assign({},a))),t}i(Bo,"copyRequest");var Yt=class{static{i(this,"Log")}provider;transactionHash;blockHash;blockNumber;removed;address;data;topics;index;transactionIndex;constructor(t,e){this.provider=e;let r=Object.freeze(t.topics.slice());v(this,{transactionHash:t.transactionHash,blockHash:t.blockHash,blockNumber:t.blockNumber,removed:t.removed,address:t.address,data:t.data,topics:r,index:t.index,transactionIndex:t.transactionIndex})}toJSON(){let{address:t,blockHash:e,blockNumber:r,data:a,index:s,removed:o,topics:l,transactionHash:u,transactionIndex:p}=this;return{_type:"log",address:t,blockHash:e,blockNumber:r,data:a,index:s,removed:o,topics:l,transactionHash:u,transactionIndex:p}}async getBlock(){let t=await this.provider.getBlock(this.blockHash);return w(!!t,"failed to find transaction","UNKNOWN_ERROR",{}),t}async getTransaction(){let t=await this.provider.getTransaction(this.transactionHash);return w(!!t,"failed to find transaction","UNKNOWN_ERROR",{}),t}async getTransactionReceipt(){let t=await this.provider.getTransactionReceipt(this.transactionHash);return w(!!t,"failed to find transaction receipt","UNKNOWN_ERROR",{}),t}removedEvent(){return Xi(this)}},Wn=class{static{i(this,"TransactionReceipt")}provider;to;from;contractAddress;hash;index;blockHash;blockNumber;logsBloom;gasUsed;blobGasUsed;cumulativeGasUsed;gasPrice;blobGasPrice;type;status;root;#t;constructor(t,e){this.#t=Object.freeze(t.logs.map(a=>new Yt(a,e)));let r=Oo;t.effectiveGasPrice!=null?r=t.effectiveGasPrice:t.gasPrice!=null&&(r=t.gasPrice),v(this,{provider:e,to:t.to,from:t.from,contractAddress:t.contractAddress,hash:t.hash,index:t.index,blockHash:t.blockHash,blockNumber:t.blockNumber,logsBloom:t.logsBloom,gasUsed:t.gasUsed,cumulativeGasUsed:t.cumulativeGasUsed,blobGasUsed:t.blobGasUsed,gasPrice:r,blobGasPrice:t.blobGasPrice,type:t.type,status:t.status,root:t.root})}get logs(){return this.#t}toJSON(){let{to:t,from:e,contractAddress:r,hash:a,index:s,blockHash:o,blockNumber:l,logsBloom:u,logs:p,status:d,root:f}=this;return{_type:"TransactionReceipt",blockHash:o,blockNumber:l,contractAddress:r,cumulativeGasUsed:ft(this.cumulativeGasUsed),from:e,gasPrice:ft(this.gasPrice),blobGasUsed:ft(this.blobGasUsed),blobGasPrice:ft(this.blobGasPrice),gasUsed:ft(this.gasUsed),hash:a,index:s,logs:p,logsBloom:u,root:f,status:d,to:t}}get length(){return this.logs.length}[Symbol.iterator](){let t=0;return{next:i(()=>t<this.length?{value:this.logs[t++],done:!1}:{value:void 0,done:!0},"next")}}get fee(){return this.gasUsed*this.gasPrice}async getBlock(){let t=await this.provider.getBlock(this.blockHash);if(t==null)throw new Error("TODO");return t}async getTransaction(){let t=await this.provider.getTransaction(this.hash);if(t==null)throw new Error("TODO");return t}async getResult(){return await this.provider.getTransactionResult(this.hash)}async confirmations(){return await this.provider.getBlockNumber()-this.blockNumber+1}removedEvent(){return Fo(this)}reorderedEvent(t){return w(!t||t.isMined(),"unmined 'other' transction cannot be orphaned","UNSUPPORTED_OPERATION",{operation:"reorderedEvent(other)"}),No(this,t)}},Kn=class n{static{i(this,"TransactionResponse")}provider;blockNumber;blockHash;index;hash;type;to;from;nonce;gasLimit;gasPrice;maxPriorityFeePerGas;maxFeePerGas;maxFeePerBlobGas;data;value;chainId;signature;accessList;blobVersionedHashes;#t;constructor(t,e){this.provider=e,this.blockNumber=t.blockNumber!=null?t.blockNumber:null,this.blockHash=t.blockHash!=null?t.blockHash:null,this.hash=t.hash,this.index=t.index,this.type=t.type,this.from=t.from,this.to=t.to||null,this.gasLimit=t.gasLimit,this.nonce=t.nonce,this.data=t.data,this.value=t.value,this.gasPrice=t.gasPrice,this.maxPriorityFeePerGas=t.maxPriorityFeePerGas!=null?t.maxPriorityFeePerGas:null,this.maxFeePerGas=t.maxFeePerGas!=null?t.maxFeePerGas:null,this.maxFeePerBlobGas=t.maxFeePerBlobGas!=null?t.maxFeePerBlobGas:null,this.chainId=t.chainId,this.signature=t.signature,this.accessList=t.accessList!=null?t.accessList:null,this.blobVersionedHashes=t.blobVersionedHashes!=null?t.blobVersionedHashes:null,this.#t=-1}toJSON(){let{blockNumber:t,blockHash:e,index:r,hash:a,type:s,to:o,from:l,nonce:u,data:p,signature:d,accessList:f,blobVersionedHashes:h}=this;return{_type:"TransactionResponse",accessList:f,blockNumber:t,blockHash:e,blobVersionedHashes:h,chainId:ft(this.chainId),data:p,from:l,gasLimit:ft(this.gasLimit),gasPrice:ft(this.gasPrice),hash:a,maxFeePerGas:ft(this.maxFeePerGas),maxPriorityFeePerGas:ft(this.maxPriorityFeePerGas),maxFeePerBlobGas:ft(this.maxFeePerBlobGas),nonce:u,signature:d,to:o,index:r,type:s,value:ft(this.value)}}async getBlock(){let t=this.blockNumber;if(t==null){let r=await this.getTransaction();r&&(t=r.blockNumber)}if(t==null)return null;let e=this.provider.getBlock(t);if(e==null)throw new Error("TODO");return e}async getTransaction(){return this.provider.getTransaction(this.hash)}async confirmations(){if(this.blockNumber==null){let{tx:e,blockNumber:r}=await Te({tx:this.getTransaction(),blockNumber:this.provider.getBlockNumber()});return e==null||e.blockNumber==null?0:r-e.blockNumber+1}return await this.provider.getBlockNumber()-this.blockNumber+1}async wait(t,e){let r=t??1,a=e??0,s=this.#t,o=-1,l=s===-1,u=i(async()=>{if(l)return null;let{blockNumber:h,nonce:C}=await Te({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(C<this.nonce){s=h;return}if(l)return null;let E=await this.getTransaction();if(!(E&&E.blockNumber!=null))for(o===-1&&(o=s-3,o<this.#t&&(o=this.#t));o<=h;){if(l)return null;let A=await this.provider.getBlock(o,!0);if(A==null)return;for(let S of A)if(S===this.hash)return;for(let S=0;S<A.length;S++){let R=await A.getTransaction(S);if(R.from===this.from&&R.nonce===this.nonce){if(l)return null;let H=await this.provider.getTransactionReceipt(R.hash);if(H==null||h-H.blockNumber+1<r)return;let M="replaced";R.data===this.data&&R.to===this.to&&R.value===this.value?M="repriced":R.data==="0x"&&R.from===R.to&&R.value===Oo&&(M="cancelled"),w(!1,"transaction was replaced","TRANSACTION_REPLACED",{cancelled:M==="replaced"||M==="cancelled",reason:M,replacement:R.replaceableTransaction(s),hash:R.hash,receipt:H})}}o++}},"checkReplacement"),p=i(h=>{if(h==null||h.status!==0)return h;w(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:h.to,from:h.from,data:""},receipt:h})},"checkReceipt"),d=await this.provider.getTransactionReceipt(this.hash);if(r===0)return p(d);if(d){if(await d.confirmations()>=r)return p(d)}else if(await u(),r===0)return null;return await new Promise((h,C)=>{let E=[],A=i(()=>{E.forEach(R=>R())},"cancel");if(E.push(()=>{l=!0}),a>0){let R=setTimeout(()=>{A(),C(Ot("wait for transaction timeout","TIMEOUT"))},a);E.push(()=>{clearTimeout(R)})}let S=i(async R=>{if(await R.confirmations()>=r){A();try{h(p(R))}catch(H){C(H)}}},"txListener");if(E.push(()=>{this.provider.off(this.hash,S)}),this.provider.on(this.hash,S),s>=0){let R=i(async()=>{try{await u()}catch(H){if(wt(H,"TRANSACTION_REPLACED")){A(),C(H);return}}l||this.provider.once("block",R)},"replaceListener");E.push(()=>{this.provider.off("block",R)}),this.provider.once("block",R)}})}isMined(){return this.blockHash!=null}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}removedEvent(){return w(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),Fo(this)}reorderedEvent(t){return w(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),w(!t||t.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),No(this,t)}replaceableTransaction(t){m(Number.isInteger(t)&&t>=0,"invalid startBlock","startBlock",t);let e=new n(this,this.provider);return e.#t=t,e}};function No(n,t){return{orphan:"reorder-transaction",tx:n,other:t}}i(No,"createReorderedTransactionFilter");function Fo(n){return{orphan:"drop-transaction",tx:n}}i(Fo,"createRemovedTransactionFilter");function Xi(n){return{orphan:"drop-log",log:{transactionHash:n.transactionHash,blockHash:n.blockHash,blockNumber:n.blockNumber,address:n.address,data:n.data,topics:Object.freeze(n.topics.slice()),index:n.index}}}i(Xi,"createRemovedLogFilter");var ce=class extends Yt{static{i(this,"EventLog")}interface;fragment;args;constructor(t,e,r){super(t,t.provider);let a=e.decodeEventLog(r,t.data,t.topics);v(this,{args:a,fragment:r,interface:e})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}},Se=class extends Yt{static{i(this,"UndecodedEventLog")}error;constructor(t,e){super(t,t.provider),v(this,{error:e})}},Xn=class extends Wn{static{i(this,"ContractTransactionReceipt")}#t;constructor(t,e,r){super(r,e),this.#t=t}get logs(){return super.logs.map(t=>{let e=t.topics.length?this.#t.getEvent(t.topics[0]):null;if(e)try{return new ce(t,this.#t,e)}catch(r){return new Se(t,r)}return t})}},le=class extends Kn{static{i(this,"ContractTransactionResponse")}#t;constructor(t,e,r){super(r,e),this.#t=t}async wait(t,e){let r=await super.wait(t,e);return r==null?null:new Xn(this.#t,this.provider,r)}},De=class extends tr{static{i(this,"ContractUnknownEventPayload")}log;constructor(t,e,r,a){super(t,e,r),v(this,{log:a})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}},pr=class extends De{static{i(this,"ContractEventPayload")}constructor(t,e,r,a,s){super(t,e,r,new ce(s,t.interface,a));let o=t.interface.decodeEventLog(a,this.log.data,this.log.topics);v(this,{args:o,fragment:a})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}};var So=BigInt(0);function _o(n){return n&&typeof n.call=="function"}i(_o,"canCall");function Lo(n){return n&&typeof n.estimateGas=="function"}i(Lo,"canEstimate");function Qn(n){return n&&typeof n.resolveName=="function"}i(Qn,"canResolve");function Ho(n){return n&&typeof n.sendTransaction=="function"}i(Ho,"canSend");function Uo(n){if(n!=null){if(Qn(n))return n;if(n.provider)return n.provider}}i(Uo,"getResolver");var Ha=class{static{i(this,"PreparedTopicFilter")}#t;fragment;constructor(t,e,r){if(v(this,{fragment:e}),e.inputs.length<r.length)throw new Error("too many arguments");let a=pe(t.runner,"resolveName"),s=Qn(a)?a:null;this.#t=async function(){let o=await Promise.all(e.inputs.map((l,u)=>r[u]==null?null:l.walkAsync(r[u],(d,f)=>d==="address"?Array.isArray(f)?Promise.all(f.map(h=>re(h,s))):re(f,s):f)));return t.interface.encodeFilterTopics(e,o)}()}getTopicFilter(){return this.#t}};function pe(n,t){return n==null?null:typeof n[t]=="function"?n:n.provider&&typeof n.provider[t]=="function"?n.provider:null}i(pe,"getRunner");function ue(n){return n==null?null:n.provider||null}i(ue,"getProvider");async function Vo(n,t){let e=J.dereference(n,"overrides");m(typeof e=="object","invalid overrides parameter","overrides",n);let r=Bo(e);return m(r.to==null||(t||[]).indexOf("to")>=0,"cannot override to","overrides.to",r.to),m(r.data==null||(t||[]).indexOf("data")>=0,"cannot override data","overrides.data",r.data),r.from&&(r.from=r.from),r}i(Vo,"copyOverrides");async function Zi(n,t,e){let r=pe(n,"resolveName"),a=Qn(r)?r:null;return await Promise.all(t.map((s,o)=>s.walkAsync(e[o],(l,u)=>(u=J.dereference(u,l),l==="address"?re(u,a):u))))}i(Zi,"resolveArgs");function Yi(n){let t=i(async function(o){let l=await Vo(o,["data"]);l.to=await n.getAddress(),l.from&&(l.from=await re(l.from,Uo(n.runner)));let u=n.interface,p=I(l.value||So,"overrides.value")===So,d=(l.data||"0x")==="0x";u.fallback&&!u.fallback.payable&&u.receive&&!d&&!p&&m(!1,"cannot send data to receive or send value to non-payable fallback","overrides",o),m(u.fallback||d,"cannot send data to receive-only contract","overrides.data",l.data);let f=u.receive||u.fallback&&u.fallback.payable;return m(f||p,"cannot send value to non-payable fallback","overrides.value",l.value),m(u.fallback||d,"cannot send data to receive-only contract","overrides.data",l.data),l},"populateTransaction"),e=i(async function(o){let l=pe(n.runner,"call");w(_o(l),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});let u=await t(o);try{return await l.call(u)}catch(p){throw Tn(p)&&p.data?n.interface.makeError(p.data,u):p}},"staticCall"),r=i(async function(o){let l=n.runner;w(Ho(l),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});let u=await l.sendTransaction(await t(o)),p=ue(n.runner);return new le(n.interface,p,u)},"send"),a=i(async function(o){let l=pe(n.runner,"estimateGas");return w(Lo(l),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await l.estimateGas(await t(o))},"estimateGas"),s=i(async o=>await r(o),"method");return v(s,{_contract:n,estimateGas:a,populateTransaction:t,send:r,staticCall:e}),s}i(Yi,"buildWrappedFallback");function Qi(n,t){let e=i(function(...p){let d=n.interface.getFunction(t,p);return w(d,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t,args:p}}),d},"getFragment"),r=i(async function(...p){let d=e(...p),f={};if(d.inputs.length+1===p.length&&(f=await Vo(p.pop()),f.from&&(f.from=await re(f.from,Uo(n.runner)))),d.inputs.length!==p.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");let h=await Zi(n.runner,d.inputs,p);return Object.assign({},f,await Te({to:n.getAddress(),data:n.interface.encodeFunctionData(d,h)}))},"populateTransaction"),a=i(async function(...p){let d=await l(...p);return d.length===1?d[0]:d},"staticCall"),s=i(async function(...p){let d=n.runner;w(Ho(d),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});let f=await d.sendTransaction(await r(...p)),h=ue(n.runner);return new le(n.interface,h,f)},"send"),o=i(async function(...p){let d=pe(n.runner,"estimateGas");return w(Lo(d),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await d.estimateGas(await r(...p))},"estimateGas"),l=i(async function(...p){let d=pe(n.runner,"call");w(_o(d),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});let f;try{f=await r(...p)}catch(E){let A=p.at(-1).blockTag;throw A&&(E.blockNumber=A),E}let h="0x";try{h=await d.call(f)}catch(E){throw Tn(E)&&E.data?n.interface.makeError(E.data,f):E}let C=e(...p);return n.interface.decodeFunctionResult(C,h)},"staticCallResult"),u=i(async(...p)=>e(...p).constant?await a(...p):await s(...p),"method");return v(u,{name:n.interface.getFunctionName(t),_contract:n,_key:t,getFragment:e,estimateGas:o,populateTransaction:r,send:s,staticCall:a,staticCallResult:l}),Object.defineProperty(u,"fragment",{configurable:!1,enumerable:!0,get:i(()=>{let p=n.interface.getFunction(t);return w(p,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t}}),p},"get")}),u}i(Qi,"buildWrappedMethod");function qi(n,t){let e=i(function(...a){let s=n.interface.getEvent(t,a);return w(s,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t,args:a}}),s},"getFragment"),r=i(function(...a){return new Ha(n,e(...a),a)},"method");return v(r,{name:n.interface.getEventName(t),_contract:n,_key:t,getFragment:e}),Object.defineProperty(r,"fragment",{configurable:!1,enumerable:!0,get:i(()=>{let a=n.interface.getEvent(t);return w(a,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t}}),a},"get")}),r}i(qi,"buildWrappedEvent");var Yn=Symbol.for("_ethersInternal_contract"),Mo=new WeakMap;function tc(n,t){Mo.set(n[Yn],t)}i(tc,"setInternal");function pt(n){return Mo.get(n[Yn])}i(pt,"getInternal");function ec(n){return n&&typeof n=="object"&&"getTopicFilter"in n&&typeof n.getTopicFilter=="function"&&n.fragment}i(ec,"isDeferred");async function Ma(n,t){let e,r=null;if(Array.isArray(t)){let s=i(function(o){if(Y(o,32))return o;let l=n.interface.getEvent(o);return m(l,"unknown fragment","name",o),l.topicHash},"topicHashify");e=t.map(o=>o==null?null:Array.isArray(o)?o.map(s):s(o))}else t==="*"?e=[null]:typeof t=="string"?Y(t,32)?e=[t]:(r=n.interface.getEvent(t),m(r,"unknown fragment","event",t),e=[r.topicHash]):ec(t)?e=await t.getTopicFilter():"fragment"in t?(r=t.fragment,e=[r.topicHash]):m(!1,"unknown event name","event",t);e=e.map(s=>{if(s==null)return null;if(Array.isArray(s)){let o=Array.from(new Set(s.map(l=>l.toLowerCase())).values());return o.length===1?o[0]:(o.sort(),o)}return s.toLowerCase()});let a=e.map(s=>s==null?"null":Array.isArray(s)?s.join("|"):s).join("&");return{fragment:r,tag:a,topics:e}}i(Ma,"getSubInfo");async function dr(n,t){let{subs:e}=pt(n);return e.get((await Ma(n,t)).tag)||null}i(dr,"hasSub");async function Do(n,t,e){let r=ue(n.runner);w(r,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:t});let{fragment:a,tag:s,topics:o}=await Ma(n,e),{addr:l,subs:u}=pt(n),p=u.get(s);if(!p){let f={address:l||n,topics:o},h=i(S=>{let R=a;if(R==null)try{R=n.interface.getEvent(S.topics[0])}catch{}if(R){let H=R,M=a?n.interface.decodeEventLog(a,S.data,S.topics):[];Va(n,e,M,Vt=>new pr(n,Vt,e,H,S))}else Va(n,e,[],H=>new De(n,H,e,S))},"listener"),C=[];p={tag:s,listeners:[],start:i(()=>{C.length||C.push(r.on(f,h))},"start"),stop:i(async()=>{if(C.length==0)return;let S=C;C=[],await Promise.all(S),r.off(f,h)},"stop")},u.set(s,p)}return p}i(Do,"getSub");var Ua=Promise.resolve();async function rc(n,t,e,r){await Ua;let a=await dr(n,t);if(!a)return!1;let s=a.listeners.length;return a.listeners=a.listeners.filter(({listener:o,once:l})=>{let u=Array.from(e);r&&u.push(r(l?null:o));try{o.call(n,...u)}catch{}return!l}),a.listeners.length===0&&(a.stop(),pt(n).subs.delete(a.tag)),s>0}i(rc,"_emit");async function Va(n,t,e,r){try{await Ua}catch{}let a=rc(n,t,e,r);return Ua=a,await a}i(Va,"emit");var Zn=["then"],de=class n{static{i(this,"BaseContract")}target;interface;runner;filters;[Yn];fallback;constructor(t,e,r,a){m(typeof t=="string"||Sn(t),"invalid value for Contract target","target",t),r==null&&(r=null);let s=Ft.from(e);v(this,{target:t,runner:r,interface:s}),Object.defineProperty(this,Yn,{value:{}});let o,l=null,u=null;if(a){let f=ue(r);u=new le(this.interface,f,a)}let p=new Map;if(typeof t=="string")if(Y(t))l=t,o=Promise.resolve(t);else{let f=pe(r,"resolveName");if(!Qn(f))throw Ot("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});o=f.resolveName(t).then(h=>{if(h==null)throw Ot("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:t});return pt(this).addr=h,h})}else o=t.getAddress().then(f=>{if(f==null)throw new Error("TODO");return pt(this).addr=f,f});tc(this,{addrPromise:o,addr:l,deployTx:u,subs:p});let d=new Proxy({},{get:i((f,h,C)=>{if(typeof h=="symbol"||Zn.indexOf(h)>=0)return Reflect.get(f,h,C);try{return this.getEvent(h)}catch(E){if(!wt(E,"INVALID_ARGUMENT")||E.argument!=="key")throw E}},"get"),has:i((f,h)=>Zn.indexOf(h)>=0?Reflect.has(f,h):Reflect.has(f,h)||this.interface.hasEvent(String(h)),"has")});return v(this,{filters:d}),v(this,{fallback:s.receive||s.fallback?Yi(this):null}),new Proxy(this,{get:i((f,h,C)=>{if(typeof h=="symbol"||h in f||Zn.indexOf(h)>=0)return Reflect.get(f,h,C);try{return f.getFunction(h)}catch(E){if(!wt(E,"INVALID_ARGUMENT")||E.argument!=="key")throw E}},"get"),has:i((f,h)=>typeof h=="symbol"||h in f||Zn.indexOf(h)>=0?Reflect.has(f,h):f.interface.hasFunction(h),"has")})}connect(t){return new n(this.target,this.interface,t)}attach(t){return new n(t,this.interface,this.runner)}async getAddress(){return await pt(this).addrPromise}async getDeployedCode(){let t=ue(this.runner);w(t,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});let e=await t.getCode(await this.getAddress());return e==="0x"?null:e}async waitForDeployment(){let t=this.deploymentTransaction();if(t)return await t.wait(),this;if(await this.getDeployedCode()!=null)return this;let r=ue(this.runner);return w(r!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((a,s)=>{let o=i(async()=>{try{if(await this.getDeployedCode()!=null)return a(this);r.once("block",o)}catch(l){s(l)}},"checkCode");o()})}deploymentTransaction(){return pt(this).deployTx}getFunction(t){return typeof t!="string"&&(t=t.format()),Qi(this,t)}getEvent(t){return typeof t!="string"&&(t=t.format()),qi(this,t)}async queryTransaction(t){throw new Error("@TODO")}async queryFilter(t,e,r){e==null&&(e=0),r==null&&(r="latest");let{addr:a,addrPromise:s}=pt(this),o=a||await s,{fragment:l,topics:u}=await Ma(this,t),p={address:o,topics:u,fromBlock:e,toBlock:r},d=ue(this.runner);return w(d,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await d.getLogs(p)).map(f=>{let h=l;if(h==null)try{h=this.interface.getEvent(f.topics[0])}catch{}if(h)try{return new ce(f,this.interface,h)}catch(C){return new Se(f,C)}return new Yt(f,d)})}async on(t,e){let r=await Do(this,"on",t);return r.listeners.push({listener:e,once:!1}),r.start(),this}async once(t,e){let r=await Do(this,"once",t);return r.listeners.push({listener:e,once:!0}),r.start(),this}async emit(t,...e){return await Va(this,t,e,null)}async listenerCount(t){if(t){let a=await dr(this,t);return a?a.listeners.length:0}let{subs:e}=pt(this),r=0;for(let{listeners:a}of e.values())r+=a.length;return r}async listeners(t){if(t){let a=await dr(this,t);return a?a.listeners.map(({listener:s})=>s):[]}let{subs:e}=pt(this),r=[];for(let{listeners:a}of e.values())r=r.concat(a.map(({listener:s})=>s));return r}async off(t,e){let r=await dr(this,t);if(!r)return this;if(e){let a=r.listeners.map(({listener:s})=>s).indexOf(e);a>=0&&r.listeners.splice(a,1)}return(e==null||r.listeners.length===0)&&(r.stop(),pt(this).subs.delete(r.tag)),this}async removeAllListeners(t){if(t){let e=await dr(this,t);if(!e)return this;e.stop(),pt(this).subs.delete(e.tag)}else{let{subs:e}=pt(this);for(let{tag:r,stop:a}of e.values())a(),e.delete(r)}return this}async addListener(t,e){return await this.on(t,e)}async removeListener(t,e){return await this.off(t,e)}static buildClass(t){class e extends n{static{i(this,"CustomContract")}constructor(a,s=null){super(a,t,s)}}return e}static from(t,e,r){return r==null&&(r=null),new this(t,e,r)}};function nc(){return de}i(nc,"_ContractBase");var _e=class extends nc(){static{i(this,"Contract")}};var Go=BigInt(0);function B(n,t){return function(e){return e==null?t:n(e)}}i(B,"allowNull");function Le(n,t){return e=>{if(t&&e==null)return null;if(!Array.isArray(e))throw new Error("not an array");return e.map(r=>n(r))}}i(Le,"arrayOf");function fe(n,t){return e=>{let r={};for(let a in n){let s=a;if(t&&a in t&&!(s in e)){for(let o of t[a])if(o in e){s=o;break}}try{let o=n[a](e[s]);o!==void 0&&(r[a]=o)}catch(o){let l=o instanceof Error?o.message:"not-an-error";w(!1,`invalid value for value.${a} (${l})`,"BAD_DATA",{value:e})}}return r}}i(fe,"object");function ac(n){switch(n){case!0:case"true":return!0;case!1:case"false":return!1}m(!1,`invalid boolean; ${JSON.stringify(n)}`,"value",n)}i(ac,"formatBoolean");function Qt(n){return m(Y(n,!0),"invalid data","value",n),n}i(Qt,"formatData");function tt(n){return m(Y(n,32),"invalid hash","value",n),n}i(tt,"formatHash");var sc=fe({address:$,blockHash:tt,blockNumber:_,data:Qt,index:_,removed:B(ac,!1),topics:Le(tt),transactionHash:tt,transactionIndex:_},{index:["logIndex"]});function $o(n){return sc(n)}i($o,"formatLog");var oc=fe({hash:B(tt),parentHash:tt,parentBeaconBlockRoot:B(tt,null),number:_,timestamp:_,nonce:B(Qt),difficulty:I,gasLimit:I,gasUsed:I,stateRoot:B(tt,null),receiptsRoot:B(tt,null),blobGasUsed:B(I,null),excessBlobGas:B(I,null),miner:B($),prevRandao:B(tt,null),extraData:Qt,baseFeePerGas:B(I)},{prevRandao:["mixHash"]});function jo(n){let t=oc(n);return t.transactions=n.transactions.map(e=>typeof e=="string"?e:$a(e)),t}i(jo,"formatBlock");var ic=fe({transactionIndex:_,blockNumber:_,transactionHash:tt,address:$,topics:Le(tt),data:Qt,index:_,blockHash:tt},{index:["logIndex"]});function Ga(n){return ic(n)}i(Ga,"formatReceiptLog");var Bd=fe({to:B($,null),from:B($,null),contractAddress:B($,null),index:_,root:B(D),gasUsed:I,blobGasUsed:B(I,null),logsBloom:B(Qt),blockHash:tt,hash:tt,logs:Le(Ga),blockNumber:_,cumulativeGasUsed:I,effectiveGasPrice:B(I),blobGasPrice:B(I,null),status:B(_),type:B(_,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function $a(n){n.to&&I(n.to)===Go&&(n.to="0x0000000000000000000000000000000000000000");let t=fe({hash:tt,index:B(_,void 0),type:i(e=>e==="0x"||e==null?0:_(e),"type"),accessList:B(sr,null),blobVersionedHashes:B(Le(tt,!0),null),blockHash:B(tt,null),blockNumber:B(_,null),transactionIndex:B(_,null),from:$,gasPrice:B(I),maxPriorityFeePerGas:B(I),maxFeePerGas:B(I),maxFeePerBlobGas:B(I,null),gasLimit:I,to:B($,null),value:I,nonce:_,data:Qt,creates:B($,null),chainId:B(I,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(n);if(t.to==null&&t.creates==null&&(t.creates=Oa(t)),(n.type===1||n.type===2)&&n.accessList==null&&(t.accessList=[]),n.signature?t.signature=Oe.from(n.signature):t.signature=Oe.from(n),t.chainId==null){let e=t.signature.legacyChainId;e!=null&&(t.chainId=e)}return t.blockHash&&I(t.blockHash)===Go&&(t.blockHash=null),t}i($a,"formatTransactionResponse");var fr=class extends Error{static{i(this,"SimpleEthersError")}e;constructor(t,e,r){super(t),this.stack=r}toString(){return this.message+`
2
+ import{a as Xe}from"./chunk-FK3BI3F2.js";import{B as it,Bb as be,Eb as ee,Nd as Cs,Sd as wn,U as Ca,Ud as Ee,cd as Ke,da as ys,ma as ct,rd as xa,y as ya}from"./chunk-KFSMJYAT.js";import{a as i,d as ai,e as gs,f as At}from"./chunk-G5BIPHMS.js";var Jo=ai((ef,qn)=>{"use strict";(function(){"use strict";var n="input is invalid type",t="finalize already called",e=typeof window=="object",r=e?window:{};r.JS_SHA3_NO_WINDOW&&(e=!1);var a=!e&&typeof self=="object",s=!r.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;s?r=global:a&&(r=self);for(var o=!r.JS_SHA3_NO_COMMON_JS&&typeof qn=="object"&&qn.exports,l=typeof define=="function"&&define.amd,u=!r.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",p="0123456789abcdef".split(""),d=[31,7936,2031616,520093696],f=[4,1024,262144,67108864],h=[1,256,65536,16777216],C=[6,1536,393216,100663296],E=[0,8,16,24],A=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],S=[224,256,384,512],R=[128,256],H=["hex","buffer","arrayBuffer","array","digest"],M={128:168,256:136},Vt=r.JS_SHA3_NO_NODE_JS||!Array.isArray?function(c){return Object.prototype.toString.call(c)==="[object Array]"}:Array.isArray,te=u&&(r.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)?function(c){return typeof c=="object"&&c.buffer&&c.buffer.constructor===ArrayBuffer}:ArrayBuffer.isView,fa=i(function(c){var g=typeof c;if(g==="string")return[c,!0];if(g!=="object"||c===null)throw new Error(n);if(u&&c.constructor===ArrayBuffer)return[new Uint8Array(c),!1];if(!Vt(c)&&!te(c))throw new Error(n);return[c,!1]},"formatMessage"),cs=i(function(c){return fa(c)[0].length===0},"empty"),ha=i(function(c){for(var g=[],y=0;y<c.length;++y)g[y]=c[y];return g},"cloneArray"),ls=i(function(c,g,y){return function(x){return new X(c,g,c).update(x)[y]()}},"createOutputMethod"),us=i(function(c,g,y){return function(x,T){return new X(c,g,T).update(x)[y]()}},"createShakeOutputMethod"),ps=i(function(c,g,y){return function(x,T,P,O){return kt["cshake"+c].update(x,T,P,O)[y]()}},"createCshakeOutputMethod"),ds=i(function(c,g,y){return function(x,T,P,O){return kt["kmac"+c].update(x,T,P,O)[y]()}},"createKmacOutputMethod"),br=i(function(c,g,y,x){for(var T=0;T<H.length;++T){var P=H[T];c[P]=g(y,x,P)}return c},"createOutputMethods"),fs=i(function(c,g){var y=ls(c,g,"hex");return y.create=function(){return new X(c,g,c)},y.update=function(x){return y.create().update(x)},br(y,ls,c,g)},"createMethod"),ei=i(function(c,g){var y=us(c,g,"hex");return y.create=function(x){return new X(c,g,x)},y.update=function(x,T){return y.create(T).update(x)},br(y,us,c,g)},"createShakeMethod"),ri=i(function(c,g){var y=M[c],x=ps(c,g,"hex");return x.create=function(T,P,O){return cs(P)&&cs(O)?kt["shake"+c].create(T):new X(c,g,T).bytepad([P,O],y)},x.update=function(T,P,O,k){return x.create(P,O,k).update(T)},br(x,ps,c,g)},"createCshakeMethod"),ni=i(function(c,g){var y=M[c],x=ds(c,g,"hex");return x.create=function(T,P,O){return new ga(c,g,P).bytepad(["KMAC",O],y).bytepad([T],y)},x.update=function(T,P,O,k){return x.create(T,O,k).update(P)},br(x,ds,c,g)},"createKmacMethod"),hs=[{name:"keccak",padding:h,bits:S,createMethod:fs},{name:"sha3",padding:C,bits:S,createMethod:fs},{name:"shake",padding:d,bits:R,createMethod:ei},{name:"cshake",padding:f,bits:R,createMethod:ri},{name:"kmac",padding:f,bits:R,createMethod:ni}],kt={},ze=[],Mt=0;Mt<hs.length;++Mt)for(var xe=hs[Mt],Er=xe.bits,Je=0;Je<Er.length;++Je){var ma=xe.name+"_"+Er[Je];if(ze.push(ma),kt[ma]=xe.createMethod(Er[Je],xe.padding),xe.name!=="sha3"){var ms=xe.name+Er[Je];ze.push(ms),kt[ms]=kt[ma]}}function X(c,g,y){this.blocks=[],this.s=[],this.padding=g,this.outputBits=y,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(c<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=y>>5,this.extraBytes=(y&31)>>3;for(var x=0;x<50;++x)this.s[x]=0}i(X,"Keccak"),X.prototype.update=function(c){if(this.finalized)throw new Error(t);var g=fa(c);c=g[0];for(var y=g[1],x=this.blocks,T=this.byteCount,P=c.length,O=this.blockCount,k=0,Z=this.s,N,K;k<P;){if(this.reset)for(this.reset=!1,x[0]=this.block,N=1;N<O+1;++N)x[N]=0;if(y)for(N=this.start;k<P&&N<T;++k)K=c.charCodeAt(k),K<128?x[N>>2]|=K<<E[N++&3]:K<2048?(x[N>>2]|=(192|K>>6)<<E[N++&3],x[N>>2]|=(128|K&63)<<E[N++&3]):K<55296||K>=57344?(x[N>>2]|=(224|K>>12)<<E[N++&3],x[N>>2]|=(128|K>>6&63)<<E[N++&3],x[N>>2]|=(128|K&63)<<E[N++&3]):(K=65536+((K&1023)<<10|c.charCodeAt(++k)&1023),x[N>>2]|=(240|K>>18)<<E[N++&3],x[N>>2]|=(128|K>>12&63)<<E[N++&3],x[N>>2]|=(128|K>>6&63)<<E[N++&3],x[N>>2]|=(128|K&63)<<E[N++&3]);else for(N=this.start;k<P&&N<T;++k)x[N>>2]|=c[k]<<E[N++&3];if(this.lastByteIndex=N,N>=T){for(this.start=N-T,this.block=x[O],N=0;N<O;++N)Z[N]^=x[N];We(Z),this.reset=!0}else this.start=N}return this},X.prototype.encode=function(c,g){var y=c&255,x=1,T=[y];for(c=c>>8,y=c&255;y>0;)T.unshift(y),c=c>>8,y=c&255,++x;return g?T.push(x):T.unshift(x),this.update(T),T.length},X.prototype.encodeString=function(c){var g=fa(c);c=g[0];var y=g[1],x=0,T=c.length;if(y)for(var P=0;P<c.length;++P){var O=c.charCodeAt(P);O<128?x+=1:O<2048?x+=2:O<55296||O>=57344?x+=3:(O=65536+((O&1023)<<10|c.charCodeAt(++P)&1023),x+=4)}else x=T;return x+=this.encode(x*8),this.update(c),x},X.prototype.bytepad=function(c,g){for(var y=this.encode(g),x=0;x<c.length;++x)y+=this.encodeString(c[x]);var T=(g-y%g)%g,P=[];return P.length=T,this.update(P),this},X.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var c=this.blocks,g=this.lastByteIndex,y=this.blockCount,x=this.s;if(c[g>>2]|=this.padding[g&3],this.lastByteIndex===this.byteCount)for(c[0]=c[y],g=1;g<y+1;++g)c[g]=0;for(c[y-1]|=2147483648,g=0;g<y;++g)x[g]^=c[g];We(x)}},X.prototype.toString=X.prototype.hex=function(){this.finalize();for(var c=this.blockCount,g=this.s,y=this.outputBlocks,x=this.extraBytes,T=0,P=0,O="",k;P<y;){for(T=0;T<c&&P<y;++T,++P)k=g[T],O+=p[k>>4&15]+p[k&15]+p[k>>12&15]+p[k>>8&15]+p[k>>20&15]+p[k>>16&15]+p[k>>28&15]+p[k>>24&15];P%c===0&&(g=ha(g),We(g),T=0)}return x&&(k=g[T],O+=p[k>>4&15]+p[k&15],x>1&&(O+=p[k>>12&15]+p[k>>8&15]),x>2&&(O+=p[k>>20&15]+p[k>>16&15])),O},X.prototype.arrayBuffer=function(){this.finalize();var c=this.blockCount,g=this.s,y=this.outputBlocks,x=this.extraBytes,T=0,P=0,O=this.outputBits>>3,k;x?k=new ArrayBuffer(y+1<<2):k=new ArrayBuffer(O);for(var Z=new Uint32Array(k);P<y;){for(T=0;T<c&&P<y;++T,++P)Z[P]=g[T];P%c===0&&(g=ha(g),We(g))}return x&&(Z[P]=g[T],k=k.slice(0,O)),k},X.prototype.buffer=X.prototype.arrayBuffer,X.prototype.digest=X.prototype.array=function(){this.finalize();for(var c=this.blockCount,g=this.s,y=this.outputBlocks,x=this.extraBytes,T=0,P=0,O=[],k,Z;P<y;){for(T=0;T<c&&P<y;++T,++P)k=P<<2,Z=g[T],O[k]=Z&255,O[k+1]=Z>>8&255,O[k+2]=Z>>16&255,O[k+3]=Z>>24&255;P%c===0&&(g=ha(g),We(g))}return x&&(k=P<<2,Z=g[T],O[k]=Z&255,x>1&&(O[k+1]=Z>>8&255),x>2&&(O[k+2]=Z>>16&255)),O};function ga(c,g,y){X.call(this,c,g,y)}i(ga,"Kmac"),ga.prototype=new X,ga.prototype.finalize=function(){return this.encode(this.outputBits,!0),X.prototype.finalize.call(this)};var We=i(function(c){var g,y,x,T,P,O,k,Z,N,K,wr,Tr,vr,Pr,kr,Ar,Rr,Ir,Or,Br,Nr,Fr,Sr,Dr,_r,Lr,Hr,Ur,Vr,Mr,Gr,$r,jr,zr,Jr,Wr,Kr,Xr,Zr,Yr,Qr,qr,tn,en,rn,nn,an,sn,on,cn,ln,un,pn,dn,fn,hn,mn,gn,yn,Cn,xn,bn,En;for(x=0;x<48;x+=2)T=c[0]^c[10]^c[20]^c[30]^c[40],P=c[1]^c[11]^c[21]^c[31]^c[41],O=c[2]^c[12]^c[22]^c[32]^c[42],k=c[3]^c[13]^c[23]^c[33]^c[43],Z=c[4]^c[14]^c[24]^c[34]^c[44],N=c[5]^c[15]^c[25]^c[35]^c[45],K=c[6]^c[16]^c[26]^c[36]^c[46],wr=c[7]^c[17]^c[27]^c[37]^c[47],Tr=c[8]^c[18]^c[28]^c[38]^c[48],vr=c[9]^c[19]^c[29]^c[39]^c[49],g=Tr^(O<<1|k>>>31),y=vr^(k<<1|O>>>31),c[0]^=g,c[1]^=y,c[10]^=g,c[11]^=y,c[20]^=g,c[21]^=y,c[30]^=g,c[31]^=y,c[40]^=g,c[41]^=y,g=T^(Z<<1|N>>>31),y=P^(N<<1|Z>>>31),c[2]^=g,c[3]^=y,c[12]^=g,c[13]^=y,c[22]^=g,c[23]^=y,c[32]^=g,c[33]^=y,c[42]^=g,c[43]^=y,g=O^(K<<1|wr>>>31),y=k^(wr<<1|K>>>31),c[4]^=g,c[5]^=y,c[14]^=g,c[15]^=y,c[24]^=g,c[25]^=y,c[34]^=g,c[35]^=y,c[44]^=g,c[45]^=y,g=Z^(Tr<<1|vr>>>31),y=N^(vr<<1|Tr>>>31),c[6]^=g,c[7]^=y,c[16]^=g,c[17]^=y,c[26]^=g,c[27]^=y,c[36]^=g,c[37]^=y,c[46]^=g,c[47]^=y,g=K^(T<<1|P>>>31),y=wr^(P<<1|T>>>31),c[8]^=g,c[9]^=y,c[18]^=g,c[19]^=y,c[28]^=g,c[29]^=y,c[38]^=g,c[39]^=y,c[48]^=g,c[49]^=y,Pr=c[0],kr=c[1],nn=c[11]<<4|c[10]>>>28,an=c[10]<<4|c[11]>>>28,Ur=c[20]<<3|c[21]>>>29,Vr=c[21]<<3|c[20]>>>29,Cn=c[31]<<9|c[30]>>>23,xn=c[30]<<9|c[31]>>>23,qr=c[40]<<18|c[41]>>>14,tn=c[41]<<18|c[40]>>>14,zr=c[2]<<1|c[3]>>>31,Jr=c[3]<<1|c[2]>>>31,Ar=c[13]<<12|c[12]>>>20,Rr=c[12]<<12|c[13]>>>20,sn=c[22]<<10|c[23]>>>22,on=c[23]<<10|c[22]>>>22,Mr=c[33]<<13|c[32]>>>19,Gr=c[32]<<13|c[33]>>>19,bn=c[42]<<2|c[43]>>>30,En=c[43]<<2|c[42]>>>30,dn=c[5]<<30|c[4]>>>2,fn=c[4]<<30|c[5]>>>2,Wr=c[14]<<6|c[15]>>>26,Kr=c[15]<<6|c[14]>>>26,Ir=c[25]<<11|c[24]>>>21,Or=c[24]<<11|c[25]>>>21,cn=c[34]<<15|c[35]>>>17,ln=c[35]<<15|c[34]>>>17,$r=c[45]<<29|c[44]>>>3,jr=c[44]<<29|c[45]>>>3,Dr=c[6]<<28|c[7]>>>4,_r=c[7]<<28|c[6]>>>4,hn=c[17]<<23|c[16]>>>9,mn=c[16]<<23|c[17]>>>9,Xr=c[26]<<25|c[27]>>>7,Zr=c[27]<<25|c[26]>>>7,Br=c[36]<<21|c[37]>>>11,Nr=c[37]<<21|c[36]>>>11,un=c[47]<<24|c[46]>>>8,pn=c[46]<<24|c[47]>>>8,en=c[8]<<27|c[9]>>>5,rn=c[9]<<27|c[8]>>>5,Lr=c[18]<<20|c[19]>>>12,Hr=c[19]<<20|c[18]>>>12,gn=c[29]<<7|c[28]>>>25,yn=c[28]<<7|c[29]>>>25,Yr=c[38]<<8|c[39]>>>24,Qr=c[39]<<8|c[38]>>>24,Fr=c[48]<<14|c[49]>>>18,Sr=c[49]<<14|c[48]>>>18,c[0]=Pr^~Ar&Ir,c[1]=kr^~Rr&Or,c[10]=Dr^~Lr&Ur,c[11]=_r^~Hr&Vr,c[20]=zr^~Wr&Xr,c[21]=Jr^~Kr&Zr,c[30]=en^~nn&sn,c[31]=rn^~an&on,c[40]=dn^~hn&gn,c[41]=fn^~mn&yn,c[2]=Ar^~Ir&Br,c[3]=Rr^~Or&Nr,c[12]=Lr^~Ur&Mr,c[13]=Hr^~Vr&Gr,c[22]=Wr^~Xr&Yr,c[23]=Kr^~Zr&Qr,c[32]=nn^~sn&cn,c[33]=an^~on&ln,c[42]=hn^~gn&Cn,c[43]=mn^~yn&xn,c[4]=Ir^~Br&Fr,c[5]=Or^~Nr&Sr,c[14]=Ur^~Mr&$r,c[15]=Vr^~Gr&jr,c[24]=Xr^~Yr&qr,c[25]=Zr^~Qr&tn,c[34]=sn^~cn&un,c[35]=on^~ln&pn,c[44]=gn^~Cn&bn,c[45]=yn^~xn&En,c[6]=Br^~Fr&Pr,c[7]=Nr^~Sr&kr,c[16]=Mr^~$r&Dr,c[17]=Gr^~jr&_r,c[26]=Yr^~qr&zr,c[27]=Qr^~tn&Jr,c[36]=cn^~un&en,c[37]=ln^~pn&rn,c[46]=Cn^~bn&dn,c[47]=xn^~En&fn,c[8]=Fr^~Pr&Ar,c[9]=Sr^~kr&Rr,c[18]=$r^~Dr&Lr,c[19]=jr^~_r&Hr,c[28]=qr^~zr&Wr,c[29]=tn^~Jr&Kr,c[38]=un^~en&nn,c[39]=pn^~rn&an,c[48]=bn^~dn&hn,c[49]=En^~fn&mn,c[0]^=A[x],c[1]^=A[x+1]},"f");if(o)qn.exports=kt;else{for(Mt=0;Mt<ze.length;++Mt)r[ze[Mt]]=kt[ze[Mt]];l&&define(function(){return kt})}})()});var Ic={};gs(Ic,{ERC721BoundContractView:()=>xr,ERC721ContractView:()=>da,ERC721Processor:()=>Ht,ERC721ProcessorTemplate:()=>os,ERC721__factory:()=>Pt,getERC721Contract:()=>Ce,getERC721ContractOnContext:()=>Pc,mockApprovalForAllLog:()=>Ac,mockApprovalLog:()=>kc,mockTransferLog:()=>Rc});var Gt=class extends Cs{static{i(this,"EthContext")}chainId;address;log;block;trace;blockNumber;transactionHash;transaction;transactionReceipt;timestamp;preparedData;constructor(t,e,r,a,s,o,l,u,p,d){super(p),this.chainId=t,this.log=s,this.block=a,this.trace=o,this.address=e.toLowerCase(),this.transaction=l,this.transactionReceipt=u,this.timestamp=r||new Date(0),this.preparedData=d,s?(this.blockNumber=s.blockNumber,this.transactionHash=s.transactionHash):a?this.blockNumber=a.number:o&&(this.blockNumber=o.blockNumber,this.transactionHash=o.transactionHash)}getChainId(){return this.chainId}getMetaDataInternal(t,e){if(this.log)return{address:this.address,contractName:this.getContractName(),blockNumber:BigInt(this.blockNumber),transactionIndex:this.log.transactionIndex,transactionHash:this.transactionHash||"",logIndex:this.log.index,chainId:this.chainId,name:t,labels:Ke(e)};if(this.trace)return{address:this.address,contractName:this.getContractName(),blockNumber:BigInt(this.blockNumber),transactionIndex:this.trace.transactionPosition,transactionHash:this.transactionHash||"",logIndex:-1,chainId:this.chainId.toString(),name:t,labels:Ke(e)};if(this.transaction)return{address:this.address,contractName:this.getContractName(),blockNumber:BigInt(this.blockNumber),transactionIndex:this.transaction.index||0,transactionHash:this.transaction.hash||"",logIndex:-1,chainId:this.chainId.toString(),name:t,labels:Ke(e)};if(this.block)return{address:this.address,contractName:this.getContractName(),blockNumber:BigInt(this.blockNumber),transactionIndex:-1,transactionHash:"",logIndex:-1,chainId:this.chainId.toString(),name:t,labels:Ke(e)};throw new Error("Invaid ctx argument can't happen")}getBlockTag(t){let e="0x"+this.blockNumber.toString(16);return t?.blockTag&&(e=typeof t.blockTag=="string"?t.blockTag:"0x"+t.blockTag.toString(16)),e}getEthCallContext(){return{chainId:this.chainId,blockTag:"0x"+this.blockNumber.toString(16),address:this.address}}},we=class extends Gt{static{i(this,"AccountContext")}getContractName(){return"account"}},bt=class extends Gt{static{i(this,"GlobalContext")}constructor(t,e,r,a,s,o,l,u,p,d){super(t,e,r,a,s,o,l,u,p,d)}getContractName(){return"*"}getMetaDataInternal(t,e){let r=this.address;this.address="*";let a=super.getMetaDataInternal(t,e);return this.address=r,a}},Et=class extends Gt{static{i(this,"ContractContext")}contract;contractName;constructor(t,e,r,a,s,o,l,u,p,d,f){super(r,e.address,a,s,o,l,u,p,d,f),e.context=this,e.callStatic&&(e.callStatic.context=this),e.encodeCall&&(e.encodeCall.context=this),this.contractName=t,this.contract=e}getContractName(){return this.contractName}},Rt=class{constructor(t){this.contract=t}static{i(this,"ContractView")}get rawContract(){return this.contract}get provider(){if(this.contract.runner?.provider)return this.contract.runner.provider;throw Error("Can't find provider for contract"+this.contract.toString())}},It=class{static{i(this,"BoundContractView")}view;address;context;callStatic;encodeCall;constructor(t,e){this.address=t,this.view=e}get rawContract(){return this.view.rawContract}get provider(){return this.view.provider}get filters(){return this.view.rawContract.filters}};import("node:process").then(n=>n.stdout.write(""));var j=At(xa(),1);var xs="6.13.1";function si(n,t,e){let r=t.split("|").map(s=>s.trim());for(let s=0;s<r.length;s++)switch(t){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof n===t)return}let a=new Error(`invalid value for type ${t}`);throw a.code="INVALID_ARGUMENT",a.argument=`value.${e}`,a.value=n,a}i(si,"checkType");async function Te(n){let t=Object.keys(n);return(await Promise.all(t.map(r=>Promise.resolve(n[r])))).reduce((r,a,s)=>(r[t[s]]=a,r),{})}i(Te,"resolveProperties");function v(n,t,e){for(let r in t){let a=t[r],s=e?e[r]:null;s&&si(a,s,r),Object.defineProperty(n,r,{enumerable:!0,value:a,writable:!1})}}i(v,"defineProperties");function ve(n){if(n==null)return"null";if(Array.isArray(n))return"[ "+n.map(ve).join(", ")+" ]";if(n instanceof Uint8Array){let t="0123456789abcdef",e="0x";for(let r=0;r<n.length;r++)e+=t[n[r]>>4],e+=t[n[r]&15];return e}if(typeof n=="object"&&typeof n.toJSON=="function")return ve(n.toJSON());switch(typeof n){case"boolean":case"symbol":return n.toString();case"bigint":return BigInt(n).toString();case"number":return n.toString();case"string":return JSON.stringify(n);case"object":{let t=Object.keys(n);return t.sort(),"{ "+t.map(e=>`${ve(e)}: ${ve(n[e])}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}i(ve,"stringify");function wt(n,t){return n&&n.code===t}i(wt,"isError");function Tn(n){return wt(n,"CALL_EXCEPTION")}i(Tn,"isCallException");function Ot(n,t,e){let r=n;{let s=[];if(e){if("message"in e||"code"in e||"name"in e)throw new Error(`value will overwrite populated values: ${ve(e)}`);for(let o in e){if(o==="shortMessage")continue;let l=e[o];s.push(o+"="+ve(l))}}s.push(`code=${t}`),s.push(`version=${xs}`),s.length&&(n+=" ("+s.join(", ")+")")}let a;switch(t){case"INVALID_ARGUMENT":a=new TypeError(n);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":a=new RangeError(n);break;default:a=new Error(n)}return v(a,{code:t}),e&&Object.assign(a,e),a.shortMessage==null&&v(a,{shortMessage:r}),a}i(Ot,"makeError");function w(n,t,e,r){if(!n)throw Ot(t,e,r)}i(w,"assert");function m(n,t,e,r){w(n,t,"INVALID_ARGUMENT",{argument:e,value:r})}i(m,"assertArgument");function Ze(n,t,e){e==null&&(e=""),e&&(e=": "+e),w(n>=t,"missing arguemnt"+e,"MISSING_ARGUMENT",{count:n,expectedCount:t}),w(n<=t,"too many arguments"+e,"UNEXPECTED_ARGUMENT",{count:n,expectedCount:t})}i(Ze,"assertArgumentCount");var oi=["NFD","NFC","NFKD","NFKC"].reduce((n,t)=>{try{if("test".normalize(t)!=="test")throw new Error("bad");if(t==="NFD"&&"\xE9".normalize("NFD")!=="e\u0301")throw new Error("broken");n.push(t)}catch{}return n},[]);function ba(n){w(oi.indexOf(n)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:n}})}i(ba,"assertNormalize");function $t(n,t,e){if(e==null&&(e=""),n!==t){let r=e,a="new";e&&(r+=".",a+=" "+e),w(!1,`private constructor; use ${r}from* methods`,"UNSUPPORTED_OPERATION",{operation:a})}}i($t,"assertPrivate");function Es(n,t,e){if(n instanceof Uint8Array)return e?new Uint8Array(n):n;if(typeof n=="string"&&n.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){let r=new Uint8Array((n.length-2)/2),a=2;for(let s=0;s<r.length;s++)r[s]=parseInt(n.substring(a,a+2),16),a+=2;return r}m(!1,"invalid BytesLike value",t||"value",n)}i(Es,"_getBytes");function z(n,t){return Es(n,t,!1)}i(z,"getBytes");function nt(n,t){return Es(n,t,!0)}i(nt,"getBytesCopy");function Y(n,t){return!(typeof n!="string"||!n.match(/^0x[0-9A-Fa-f]*$/)||typeof t=="number"&&n.length!==2+2*t||t===!0&&n.length%2!==0)}i(Y,"isHexString");function Ea(n){return Y(n,!0)||n instanceof Uint8Array}i(Ea,"isBytesLike");var bs="0123456789abcdef";function D(n){let t=z(n),e="0x";for(let r=0;r<t.length;r++){let a=t[r];e+=bs[(a&240)>>4]+bs[a&15]}return e}i(D,"hexlify");function lt(n){return"0x"+n.map(t=>D(t).substring(2)).join("")}i(lt,"concat");function vn(n){return Y(n,!0)?(n.length-2)/2:z(n).length}i(vn,"dataLength");function Tt(n,t,e){let r=z(n);return e!=null&&e>r.length&&w(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:r,length:r.length,offset:e}),D(r.slice(t??0,e??r.length))}i(Tt,"dataSlice");function ws(n,t,e){let r=z(n);w(t>=r.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(r),length:t,offset:t+1});let a=new Uint8Array(t);return a.fill(0),e?a.set(r,t-r.length):a.set(r,0),D(a)}i(ws,"zeroPad");function Pe(n,t){return ws(n,t,!0)}i(Pe,"zeroPadValue");function Pn(n,t){return ws(n,t,!1)}i(Pn,"zeroPadBytes");var kn=BigInt(0),gt=BigInt(1),ke=9007199254740991;function wa(n,t){let e=Ye(n,"value"),r=BigInt(_(t,"width"));if(w(e>>r===kn,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:n}),e>>r-gt){let a=(gt<<r)-gt;return-((~e&a)+gt)}return e}i(wa,"fromTwos");function Ta(n,t){let e=I(n,"value"),r=BigInt(_(t,"width")),a=gt<<r-gt;if(e<kn){e=-e,w(e<=a,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:n});let s=(gt<<r)-gt;return(~e&s)+gt}else w(e<a,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:n});return e}i(Ta,"toTwos");function Ae(n,t){let e=Ye(n,"value"),r=BigInt(_(t,"bits"));return e&(gt<<r)-gt}i(Ae,"mask");function I(n,t){switch(typeof n){case"bigint":return n;case"number":return m(Number.isInteger(n),"underflow",t||"value",n),m(n>=-ke&&n<=ke,"overflow",t||"value",n),BigInt(n);case"string":try{if(n==="")throw new Error("empty string");return n[0]==="-"&&n[1]!=="-"?-BigInt(n.substring(1)):BigInt(n)}catch(e){m(!1,`invalid BigNumberish string: ${e.message}`,t||"value",n)}}m(!1,"invalid BigNumberish value",t||"value",n)}i(I,"getBigInt");function Ye(n,t){let e=I(n,t);return w(e>=kn,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:n}),e}i(Ye,"getUint");var Ts="0123456789abcdef";function An(n){if(n instanceof Uint8Array){let t="0x0";for(let e of n)t+=Ts[e>>4],t+=Ts[e&15];return BigInt(t)}return I(n)}i(An,"toBigInt");function _(n,t){switch(typeof n){case"bigint":return m(n>=-ke&&n<=ke,"overflow",t||"value",n),Number(n);case"number":return m(Number.isInteger(n),"underflow",t||"value",n),m(n>=-ke&&n<=ke,"overflow",t||"value",n),n;case"string":try{if(n==="")throw new Error("empty string");return _(BigInt(n),t)}catch(e){m(!1,`invalid numeric string: ${e.message}`,t||"value",n)}}m(!1,"invalid numeric value",t||"value",n)}i(_,"getNumber");function va(n){return _(An(n))}i(va,"toNumber");function Qe(n,t){let r=Ye(n,"value").toString(16);if(t==null)r.length%2&&(r="0"+r);else{let a=_(t,"width");for(w(a*2>=r.length,`value exceeds width (${a} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:n});r.length<a*2;)r="0"+r}return"0x"+r}i(Qe,"toBeHex");function qe(n){let t=Ye(n,"value");if(t===kn)return new Uint8Array([]);let e=t.toString(16);e.length%2&&(e="0"+e);let r=new Uint8Array(e.length/2);for(let a=0;a<r.length;a++){let s=a*2;r[a]=parseInt(e.substring(s,s+2),16)}return r}i(qe,"toBeArray");var tr=class{static{i(this,"EventPayload")}filter;emitter;#t;constructor(t,e,r){this.#t=e,v(this,{emitter:t,filter:r})}async removeListener(){this.#t!=null&&await this.emitter.off(this.filter,this.#t)}};function ii(n,t,e,r,a){m(!1,`invalid codepoint at offset ${t}; ${n}`,"bytes",e)}i(ii,"errorFunc");function vs(n,t,e,r,a){if(n==="BAD_PREFIX"||n==="UNEXPECTED_CONTINUE"){let s=0;for(let o=t+1;o<e.length&&e[o]>>6===2;o++)s++;return s}return n==="OVERRUN"?e.length-t-1:0}i(vs,"ignoreFunc");function ci(n,t,e,r,a){return n==="OVERLONG"?(m(typeof a=="number","invalid bad code point for replacement","badCodepoint",a),r.push(a),0):(r.push(65533),vs(n,t,e,r,a))}i(ci,"replaceFunc");var Ps=Object.freeze({error:ii,ignore:vs,replace:ci});function li(n,t){t==null&&(t=Ps.error);let e=z(n,"bytes"),r=[],a=0;for(;a<e.length;){let s=e[a++];if(!(s>>7)){r.push(s);continue}let o=null,l=null;if((s&224)===192)o=1,l=127;else if((s&240)===224)o=2,l=2047;else if((s&248)===240)o=3,l=65535;else{(s&192)===128?a+=t("UNEXPECTED_CONTINUE",a-1,e,r):a+=t("BAD_PREFIX",a-1,e,r);continue}if(a-1+o>=e.length){a+=t("OVERRUN",a-1,e,r);continue}let u=s&(1<<8-o-1)-1;for(let p=0;p<o;p++){let d=e[a];if((d&192)!=128){a+=t("MISSING_CONTINUE",a,e,r),u=null;break}u=u<<6|d&63,a++}if(u!==null){if(u>1114111){a+=t("OUT_OF_RANGE",a-1-o,e,r,u);continue}if(u>=55296&&u<=57343){a+=t("UTF16_SURROGATE",a-1-o,e,r,u);continue}if(u<=l){a+=t("OVERLONG",a-1-o,e,r,u);continue}r.push(u)}}return r}i(li,"getUtf8CodePoints");function Re(n,t){m(typeof n=="string","invalid string value","str",n),t!=null&&(ba(t),n=n.normalize(t));let e=[];for(let r=0;r<n.length;r++){let a=n.charCodeAt(r);if(a<128)e.push(a);else if(a<2048)e.push(a>>6|192),e.push(a&63|128);else if((a&64512)==55296){r++;let s=n.charCodeAt(r);m(r<n.length&&(s&64512)===56320,"invalid surrogate pair","str",n);let o=65536+((a&1023)<<10)+(s&1023);e.push(o>>18|240),e.push(o>>12&63|128),e.push(o>>6&63|128),e.push(o&63|128)}else e.push(a>>12|224),e.push(a>>6&63|128),e.push(a&63|128)}return new Uint8Array(e)}i(Re,"toUtf8Bytes");function ui(n){return n.map(t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10&1023)+55296,(t&1023)+56320))).join("")}i(ui,"_toUtf8String");function er(n,t){return ui(li(n,t))}i(er,"toUtf8String");function ks(n){let t=[];for(;n;)t.unshift(n&255),n>>=8;return t}i(ks,"arrayifyInteger");function Rs(n){if(Array.isArray(n)){let r=[];if(n.forEach(function(s){r=r.concat(Rs(s))}),r.length<=55)return r.unshift(192+r.length),r;let a=ks(r.length);return a.unshift(247+a.length),a.concat(r)}let t=Array.prototype.slice.call(z(n,"object"));if(t.length===1&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;let e=ks(t.length);return e.unshift(183+e.length),e.concat(t)}i(Rs,"_encode");var As="0123456789abcdef";function Pa(n){let t="0x";for(let e of Rs(n))t+=As[e>>4],t+=As[e&15];return t}i(Pa,"encodeRlp");function ka(n){if(!Number.isSafeInteger(n)||n<0)throw new Error(`Wrong positive integer: ${n}`)}i(ka,"number");function Aa(n,...t){if(!(n instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(n.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${n.length}`)}i(Aa,"bytes");function Ra(n,t=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(t&&n.finished)throw new Error("Hash#digest() has already been called")}i(Ra,"exists");function Is(n,t){Aa(n);let e=t.outputLen;if(n.length<e)throw new Error(`digestInto() expects output buffer of length at least ${e}`)}i(Is,"output");var Rn=BigInt(4294967295),Os=BigInt(32);function pi(n,t=!1){return t?{h:Number(n&Rn),l:Number(n>>Os&Rn)}:{h:Number(n>>Os&Rn)|0,l:Number(n&Rn)|0}}i(pi,"fromBig");function Bs(n,t=!1){let e=new Uint32Array(n.length),r=new Uint32Array(n.length);for(let a=0;a<n.length;a++){let{h:s,l:o}=pi(n[a],t);[e[a],r[a]]=[s,o]}return[e,r]}i(Bs,"split");var Ns=i((n,t,e)=>n<<e|t>>>32-e,"rotlSH"),Fs=i((n,t,e)=>t<<e|n>>>32-e,"rotlSL"),Ss=i((n,t,e)=>t<<e-32|n>>>64-e,"rotlBH"),Ds=i((n,t,e)=>n<<e-32|t>>>64-e,"rotlBL");var di=i(n=>n instanceof Uint8Array,"u8a");var _s=i(n=>new Uint32Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/4)),"u32");var fi=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!fi)throw new Error("Non little-endian hardware is not supported");function hi(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}i(hi,"utf8ToBytes");function On(n){if(typeof n=="string"&&(n=hi(n)),!di(n))throw new Error(`expected Uint8Array, got ${typeof n}`);return n}i(On,"toBytes");var In=class{static{i(this,"Hash")}clone(){return this._cloneInto()}},xl={}.toString;function Ls(n){let t=i(r=>n().update(On(r)).digest(),"hashC"),e=n();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>n(),t}i(Ls,"wrapConstructor");function Hs(n){let t=i((r,a)=>n(a).update(On(r)).digest(),"hashC"),e=n({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=r=>n(r),t}i(Hs,"wrapXOFConstructorWithOpts");var[Ms,Gs,$s]=[[],[],[]],mi=BigInt(0),rr=BigInt(1),gi=BigInt(2),yi=BigInt(7),Ci=BigInt(256),xi=BigInt(113);for(let n=0,t=rr,e=1,r=0;n<24;n++){[e,r]=[r,(2*e+3*r)%5],Ms.push(2*(5*r+e)),Gs.push((n+1)*(n+2)/2%64);let a=mi;for(let s=0;s<7;s++)t=(t<<rr^(t>>yi)*xi)%Ci,t&gi&&(a^=rr<<(rr<<BigInt(s))-rr);$s.push(a)}var[bi,Ei]=Bs($s,!0),Us=i((n,t,e)=>e>32?Ss(n,t,e):Ns(n,t,e),"rotlH"),Vs=i((n,t,e)=>e>32?Ds(n,t,e):Fs(n,t,e),"rotlL");function wi(n,t=24){let e=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)e[o]=n[o]^n[o+10]^n[o+20]^n[o+30]^n[o+40];for(let o=0;o<10;o+=2){let l=(o+8)%10,u=(o+2)%10,p=e[u],d=e[u+1],f=Us(p,d,1)^e[l],h=Vs(p,d,1)^e[l+1];for(let C=0;C<50;C+=10)n[o+C]^=f,n[o+C+1]^=h}let a=n[2],s=n[3];for(let o=0;o<24;o++){let l=Gs[o],u=Us(a,s,l),p=Vs(a,s,l),d=Ms[o];a=n[d],s=n[d+1],n[d]=u,n[d+1]=p}for(let o=0;o<50;o+=10){for(let l=0;l<10;l++)e[l]=n[o+l];for(let l=0;l<10;l++)n[o+l]^=~e[(l+2)%10]&e[(l+4)%10]}n[0]^=bi[r],n[1]^=Ei[r]}e.fill(0)}i(wi,"keccakP");var Bn=class n extends In{static{i(this,"Keccak")}constructor(t,e,r,a=!1,s=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=r,this.enableXOF=a,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,ka(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=_s(this.state)}keccak(){wi(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){Ra(this);let{blockLen:e,state:r}=this;t=On(t);let a=t.length;for(let s=0;s<a;){let o=Math.min(e-this.pos,a-s);for(let l=0;l<o;l++)r[this.pos++]^=t[s++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:e,pos:r,blockLen:a}=this;t[r]^=e,e&128&&r===a-1&&this.keccak(),t[a-1]^=128,this.keccak()}writeInto(t){Ra(this,!1),Aa(t),this.finish();let e=this.state,{blockLen:r}=this;for(let a=0,s=t.length;a<s;){this.posOut>=r&&this.keccak();let o=Math.min(r-this.posOut,s-a);t.set(e.subarray(this.posOut,this.posOut+o),a),this.posOut+=o,a+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return ka(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Is(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:r,outputLen:a,rounds:s,enableXOF:o}=this;return t||(t=new n(e,r,a,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=a,t.enableXOF=o,t.destroyed=this.destroyed,t}},jt=i((n,t,e)=>Ls(()=>new Bn(t,n,e)),"gen"),Pl=jt(6,144,224/8),kl=jt(6,136,256/8),Al=jt(6,104,384/8),Rl=jt(6,72,512/8),Il=jt(1,144,224/8),js=jt(1,136,256/8),Ol=jt(1,104,384/8),Bl=jt(1,72,512/8),zs=i((n,t,e)=>Hs((r={})=>new Bn(t,n,r.dkLen===void 0?e:r.dkLen,!0)),"genShake"),Nl=zs(31,168,128/8),Fl=zs(31,136,256/8);var Js=!1,Ws=i(function(n){return js(n)},"_keccak256"),Ks=Ws;function st(n){let t=z(n,"data");return D(Ks(t))}i(st,"keccak256");st._=Ws;st.lock=function(){Js=!0};st.register=function(n){if(Js)throw new TypeError("keccak256 is locked");Ks=n};Object.freeze(st);var Nn="0x0000000000000000000000000000000000000000000000000000000000000000";var Xs=BigInt(0),Zs=BigInt(1),Ys=BigInt(2),Qs=BigInt(27),qs=BigInt(28),Fn=BigInt(35),Ie={};function to(n){return Pe(qe(n),32)}i(to,"toUint256");var Oe=class n{static{i(this,"Signature")}#t;#e;#r;#n;get r(){return this.#t}set r(t){m(vn(t)===32,"invalid r","value",t),this.#t=D(t)}get s(){return this.#e}set s(t){m(vn(t)===32,"invalid s","value",t);let e=D(t);m(parseInt(e.substring(0,3))<8,"non-canonical s","value",e),this.#e=e}get v(){return this.#r}set v(t){let e=_(t,"value");m(e===27||e===28,"invalid v","v",t),this.#r=e}get networkV(){return this.#n}get legacyChainId(){let t=this.networkV;return t==null?null:n.getChainId(t)}get yParity(){return this.v===27?0:1}get yParityAndS(){let t=z(this.s);return this.yParity&&(t[0]|=128),D(t)}get compactSerialized(){return lt([this.r,this.yParityAndS])}get serialized(){return lt([this.r,this.s,this.yParity?"0x1c":"0x1b"])}constructor(t,e,r,a){$t(t,Ie,"Signature"),this.#t=e,this.#e=r,this.#r=a,this.#n=null}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){let t=new n(Ie,this.r,this.s,this.v);return this.networkV&&(t.#n=this.networkV),t}toJSON(){let t=this.networkV;return{_type:"signature",networkV:t!=null?t.toString():null,r:this.r,s:this.s,v:this.v}}static getChainId(t){let e=I(t,"v");return e==Qs||e==qs?Xs:(m(e>=Fn,"invalid EIP-155 v","v",t),(e-Fn)/Ys)}static getChainIdV(t,e){return I(t)*Ys+BigInt(35+e-27)}static getNormalizedV(t){let e=I(t);return e===Xs||e===Qs?27:e===Zs||e===qs?28:(m(e>=Fn,"invalid v","v",t),e&Zs?27:28)}static from(t){function e(p,d){m(p,d,"signature",t)}if(i(e,"assertError"),t==null)return new n(Ie,Nn,Nn,27);if(typeof t=="string"){let p=z(t,"signature");if(p.length===64){let d=D(p.slice(0,32)),f=p.slice(32,64),h=f[0]&128?28:27;return f[0]&=127,new n(Ie,d,D(f),h)}if(p.length===65){let d=D(p.slice(0,32)),f=p.slice(32,64);e((f[0]&128)===0,"non-canonical s");let h=n.getNormalizedV(p[64]);return new n(Ie,d,D(f),h)}e(!1,"invalid raw signature length")}if(t instanceof n)return t.clone();let r=t.r;e(r!=null,"missing r");let a=to(r),s=function(p,d){if(p!=null)return to(p);if(d!=null){e(Y(d,32),"invalid yParityAndS");let f=z(d);return f[0]&=127,D(f)}e(!1,"missing s")}(t.s,t.yParityAndS);e((z(s)[0]&128)==0,"non-canonical s");let{networkV:o,v:l}=function(p,d,f){if(p!=null){let h=I(p);return{networkV:h>=Fn?h:void 0,v:n.getNormalizedV(h)}}if(d!=null)return e(Y(d,32),"invalid yParityAndS"),{v:z(d)[0]&128?28:27};if(f!=null){switch(_(f,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}e(!1,"invalid yParity")}e(!1,"missing v")}(t.v,t.yParityAndS,t.yParity),u=new n(Ie,a,s,l);return o&&(u.#n=o),e(t.yParity==null||_(t.yParity,"sig.yParity")===u.yParity,"yParity mismatch"),e(t.yParityAndS==null||t.yParityAndS===u.yParityAndS,"yParityAndS mismatch"),u}};var Ti=BigInt(0),vi=BigInt(36);function eo(n){n=n.toLowerCase();let t=n.substring(2).split(""),e=new Uint8Array(40);for(let a=0;a<40;a++)e[a]=t[a].charCodeAt(0);let r=z(st(e));for(let a=0;a<40;a+=2)r[a>>1]>>4>=8&&(t[a]=t[a].toUpperCase()),(r[a>>1]&15)>=8&&(t[a+1]=t[a+1].toUpperCase());return"0x"+t.join("")}i(eo,"getChecksumAddress");var Ia={};for(let n=0;n<10;n++)Ia[String(n)]=String(n);for(let n=0;n<26;n++)Ia[String.fromCharCode(65+n)]=String(10+n);var ro=15;function Pi(n){n=n.toUpperCase(),n=n.substring(4)+n.substring(0,2)+"00";let t=n.split("").map(r=>Ia[r]).join("");for(;t.length>=ro;){let r=t.substring(0,ro);t=parseInt(r,10)%97+t.substring(r.length)}let e=String(98-parseInt(t,10)%97);for(;e.length<2;)e="0"+e;return e}i(Pi,"ibanChecksum");var ki=function(){let n={};for(let t=0;t<36;t++){let e="0123456789abcdefghijklmnopqrstuvwxyz"[t];n[e]=BigInt(t)}return n}();function Ai(n){n=n.toLowerCase();let t=Ti;for(let e=0;e<n.length;e++)t=t*vi+ki[n[e]];return t}i(Ai,"fromBase36");function $(n){if(m(typeof n=="string","invalid address","address",n),n.match(/^(0x)?[0-9a-fA-F]{40}$/)){n.startsWith("0x")||(n="0x"+n);let t=eo(n);return m(!n.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||t===n,"bad address checksum","address",n),t}if(n.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){m(n.substring(2,4)===Pi(n),"bad icap checksum","address",n);let t=Ai(n.substring(4)).toString(16);for(;t.length<40;)t="0"+t;return eo("0x"+t)}m(!1,"invalid address","address",n)}i($,"getAddress");function Oa(n){let t=$(n.from),r=I(n.nonce,"tx.nonce").toString(16);return r==="0"?r="0x":r.length%2?r="0x0"+r:r="0x"+r,$(Tt(st(Pa([t,r])),12))}i(Oa,"getCreateAddress");function Sn(n){return n&&typeof n.getAddress=="function"}i(Sn,"isAddressable");async function Ba(n,t){let e=await t;return(e==null||e==="0x0000000000000000000000000000000000000000")&&(w(typeof n!="string","unconfigured name","UNCONFIGURED_NAME",{value:n}),m(!1,"invalid AddressLike value; did not resolve to a value address","target",n)),$(e)}i(Ba,"checkAddress");function re(n,t){if(typeof n=="string")return n.match(/^0x[0-9a-f]{40}$/i)?$(n):(w(t!=null,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),Ba(n,t.resolveName(n)));if(Sn(n))return Ba(n,n.getAddress());if(n&&typeof n.then=="function")return Ba(n,n);m(!1,"unsupported addressable value","target",n)}i(re,"resolveAddress");var et=32,Na=new Uint8Array(et),Ri=["then"],Dn={},so=new WeakMap;function ne(n){return so.get(n)}i(ne,"getNames");function no(n,t){so.set(n,t)}i(no,"setNames");function nr(n,t){let e=new Error(`deferred error during ABI decoding triggered accessing ${n}`);throw e.error=t,e}i(nr,"throwError");function Fa(n,t,e){return n.indexOf(null)>=0?t.map((r,a)=>r instanceof dt?Fa(ne(r),r,e):r):n.reduce((r,a,s)=>{let o=t.getValue(a);return a in r||(e&&o instanceof dt&&(o=Fa(ne(o),o,e)),r[a]=o),r},{})}i(Fa,"toObject");var dt=class n extends Array{static{i(this,"Result")}#t;constructor(...t){let e=t[0],r=t[1],a=(t[2]||[]).slice(),s=!0;e!==Dn&&(r=t,a=[],s=!1),super(r.length),r.forEach((u,p)=>{this[p]=u});let o=a.reduce((u,p)=>(typeof p=="string"&&u.set(p,(u.get(p)||0)+1),u),new Map);if(no(this,Object.freeze(r.map((u,p)=>{let d=a[p];return d!=null&&o.get(d)===1?d:null}))),this.#t=[],this.#t==null&&this.#t,!s)return;Object.freeze(this);let l=new Proxy(this,{get:i((u,p,d)=>{if(typeof p=="string"){if(p.match(/^[0-9]+$/)){let h=_(p,"%index");if(h<0||h>=this.length)throw new RangeError("out of result range");let C=u[h];return C instanceof Error&&nr(`index ${h}`,C),C}if(Ri.indexOf(p)>=0)return Reflect.get(u,p,d);let f=u[p];if(f instanceof Function)return function(...h){return f.apply(this===d?u:this,h)};if(!(p in u))return u.getValue.apply(this===d?u:this,[p])}return Reflect.get(u,p,d)},"get")});return no(l,ne(this)),l}toArray(t){let e=[];return this.forEach((r,a)=>{r instanceof Error&&nr(`index ${a}`,r),t&&r instanceof n&&(r=r.toArray(t)),e.push(r)}),e}toObject(t){let e=ne(this);return e.reduce((r,a,s)=>(w(a!=null,`value at index ${s} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),Fa(e,this,t)),{})}slice(t,e){t==null&&(t=0),t<0&&(t+=this.length,t<0&&(t=0)),e==null&&(e=this.length),e<0&&(e+=this.length,e<0&&(e=0)),e>this.length&&(e=this.length);let r=ne(this),a=[],s=[];for(let o=t;o<e;o++)a.push(this[o]),s.push(r[o]);return new n(Dn,a,s)}filter(t,e){let r=ne(this),a=[],s=[];for(let o=0;o<this.length;o++){let l=this[o];l instanceof Error&&nr(`index ${o}`,l),t.call(e,l,o,this)&&(a.push(l),s.push(r[o]))}return new n(Dn,a,s)}map(t,e){let r=[];for(let a=0;a<this.length;a++){let s=this[a];s instanceof Error&&nr(`index ${a}`,s),r.push(t.call(e,s,a,this))}return r}getValue(t){let e=ne(this).indexOf(t);if(e===-1)return;let r=this[e];return r instanceof Error&&nr(`property ${JSON.stringify(t)}`,r.error),r}static fromItems(t,e){return new n(Dn,t,e)}};function ao(n){let t=qe(n);return w(t.length<=et,"value out-of-bounds","BUFFER_OVERRUN",{buffer:t,length:et,offset:t.length}),t.length!==et&&(t=nt(lt([Na.slice(t.length%et),t]))),t}i(ao,"getValue");var Q=class{static{i(this,"Coder")}name;type;localName;dynamic;constructor(t,e,r,a){v(this,{name:t,type:e,localName:r,dynamic:a},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(t,e){m(!1,t,this.localName,e)}},ae=class{static{i(this,"Writer")}#t;#e;constructor(){this.#t=[],this.#e=0}get data(){return lt(this.#t)}get length(){return this.#e}#r(t){return this.#t.push(t),this.#e+=t.length,t.length}appendWriter(t){return this.#r(nt(t.data))}writeBytes(t){let e=nt(t),r=e.length%et;return r&&(e=nt(lt([e,Na.slice(r)]))),this.#r(e)}writeValue(t){return this.#r(ao(t))}writeUpdatableValue(){let t=this.#t.length;return this.#t.push(Na),this.#e+=et,e=>{this.#t[t]=ao(e)}}},_n=class n{static{i(this,"Reader")}allowLoose;#t;#e;#r;#n;#a;constructor(t,e,r){v(this,{allowLoose:!!e}),this.#t=nt(t),this.#r=0,this.#n=null,this.#a=r??1024,this.#e=0}get data(){return D(this.#t)}get dataLength(){return this.#t.length}get consumed(){return this.#e}get bytes(){return new Uint8Array(this.#t)}#s(t){if(this.#n)return this.#n.#s(t);this.#r+=t,w(this.#a<1||this.#r<=this.#a*this.dataLength,`compressed ABI data exceeds inflation ratio of ${this.#a} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:nt(this.#t),offset:this.#e,length:t,info:{bytesRead:this.#r,dataLength:this.dataLength}})}#o(t,e,r){let a=Math.ceil(e/et)*et;return this.#e+a>this.#t.length&&(this.allowLoose&&r&&this.#e+e<=this.#t.length?a=e:w(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:nt(this.#t),length:this.#t.length,offset:this.#e+a})),this.#t.slice(this.#e,this.#e+a)}subReader(t){let e=new n(this.#t.slice(this.#e+t),this.allowLoose,this.#a);return e.#n=this,e}readBytes(t,e){let r=this.#o(0,t,!!e);return this.#s(t),this.#e+=r.length,r.slice(0,t)}readValue(){return An(this.readBytes(et))}readIndex(){return va(this.readBytes(et))}};var yt={};function b(n,t){let e=!1;return t<0&&(e=!0,t*=-1),new J(yt,`${e?"":"u"}int${t}`,n,{signed:e,width:t})}i(b,"n");function G(n,t){return new J(yt,`bytes${t||""}`,n,{size:t})}i(G,"b");var oo=Symbol.for("_ethers_typed"),J=class n{static{i(this,"Typed")}type;value;#t;_typedSymbol;constructor(t,e,r,a){a==null&&(a=null),$t(yt,t,"Typed"),v(this,{_typedSymbol:oo,type:e,value:r}),this.#t=a,this.format()}format(){if(this.type==="array")throw new Error("");if(this.type==="dynamicArray")throw new Error("");return this.type==="tuple"?`tuple(${this.value.map(t=>t.format()).join(",")})`:this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return this.type==="string"}get tupleName(){if(this.type!=="tuple")throw TypeError("not a tuple");return this.#t}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return this.#t===!0?-1:this.#t===!1?this.value.length:null}static from(t,e){return new n(yt,t,e)}static uint8(t){return b(t,8)}static uint16(t){return b(t,16)}static uint24(t){return b(t,24)}static uint32(t){return b(t,32)}static uint40(t){return b(t,40)}static uint48(t){return b(t,48)}static uint56(t){return b(t,56)}static uint64(t){return b(t,64)}static uint72(t){return b(t,72)}static uint80(t){return b(t,80)}static uint88(t){return b(t,88)}static uint96(t){return b(t,96)}static uint104(t){return b(t,104)}static uint112(t){return b(t,112)}static uint120(t){return b(t,120)}static uint128(t){return b(t,128)}static uint136(t){return b(t,136)}static uint144(t){return b(t,144)}static uint152(t){return b(t,152)}static uint160(t){return b(t,160)}static uint168(t){return b(t,168)}static uint176(t){return b(t,176)}static uint184(t){return b(t,184)}static uint192(t){return b(t,192)}static uint200(t){return b(t,200)}static uint208(t){return b(t,208)}static uint216(t){return b(t,216)}static uint224(t){return b(t,224)}static uint232(t){return b(t,232)}static uint240(t){return b(t,240)}static uint248(t){return b(t,248)}static uint256(t){return b(t,256)}static uint(t){return b(t,256)}static int8(t){return b(t,-8)}static int16(t){return b(t,-16)}static int24(t){return b(t,-24)}static int32(t){return b(t,-32)}static int40(t){return b(t,-40)}static int48(t){return b(t,-48)}static int56(t){return b(t,-56)}static int64(t){return b(t,-64)}static int72(t){return b(t,-72)}static int80(t){return b(t,-80)}static int88(t){return b(t,-88)}static int96(t){return b(t,-96)}static int104(t){return b(t,-104)}static int112(t){return b(t,-112)}static int120(t){return b(t,-120)}static int128(t){return b(t,-128)}static int136(t){return b(t,-136)}static int144(t){return b(t,-144)}static int152(t){return b(t,-152)}static int160(t){return b(t,-160)}static int168(t){return b(t,-168)}static int176(t){return b(t,-176)}static int184(t){return b(t,-184)}static int192(t){return b(t,-192)}static int200(t){return b(t,-200)}static int208(t){return b(t,-208)}static int216(t){return b(t,-216)}static int224(t){return b(t,-224)}static int232(t){return b(t,-232)}static int240(t){return b(t,-240)}static int248(t){return b(t,-248)}static int256(t){return b(t,-256)}static int(t){return b(t,-256)}static bytes1(t){return G(t,1)}static bytes2(t){return G(t,2)}static bytes3(t){return G(t,3)}static bytes4(t){return G(t,4)}static bytes5(t){return G(t,5)}static bytes6(t){return G(t,6)}static bytes7(t){return G(t,7)}static bytes8(t){return G(t,8)}static bytes9(t){return G(t,9)}static bytes10(t){return G(t,10)}static bytes11(t){return G(t,11)}static bytes12(t){return G(t,12)}static bytes13(t){return G(t,13)}static bytes14(t){return G(t,14)}static bytes15(t){return G(t,15)}static bytes16(t){return G(t,16)}static bytes17(t){return G(t,17)}static bytes18(t){return G(t,18)}static bytes19(t){return G(t,19)}static bytes20(t){return G(t,20)}static bytes21(t){return G(t,21)}static bytes22(t){return G(t,22)}static bytes23(t){return G(t,23)}static bytes24(t){return G(t,24)}static bytes25(t){return G(t,25)}static bytes26(t){return G(t,26)}static bytes27(t){return G(t,27)}static bytes28(t){return G(t,28)}static bytes29(t){return G(t,29)}static bytes30(t){return G(t,30)}static bytes31(t){return G(t,31)}static bytes32(t){return G(t,32)}static address(t){return new n(yt,"address",t)}static bool(t){return new n(yt,"bool",!!t)}static bytes(t){return new n(yt,"bytes",t)}static string(t){return new n(yt,"string",t)}static array(t,e){throw new Error("not implemented yet")}static tuple(t,e){throw new Error("not implemented yet")}static overrides(t){return new n(yt,"overrides",Object.assign({},t))}static isTyped(t){return t&&typeof t=="object"&&"_typedSymbol"in t&&t._typedSymbol===oo}static dereference(t,e){if(n.isTyped(t)){if(t.type!==e)throw new Error(`invalid type: expecetd ${e}, got ${t.type}`);return t.value}return t}};var Ln=class extends Q{static{i(this,"AddressCoder")}constructor(t){super("address","address",t,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(t,e){let r=J.dereference(e,"string");try{r=$(r)}catch(a){return this._throwError(a.message,e)}return t.writeValue(r)}decode(t){return $(Qe(t.readValue(),20))}};var Hn=class extends Q{static{i(this,"AnonymousCoder")}coder;constructor(t){super(t.name,t.type,"_",t.dynamic),this.coder=t}defaultValue(){return this.coder.defaultValue()}encode(t,e){return this.coder.encode(t,e)}decode(t){return this.coder.decode(t)}};function Sa(n,t,e){let r=[];if(Array.isArray(e))r=e;else if(e&&typeof e=="object"){let u={};r=t.map(p=>{let d=p.localName;return w(d,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:p},value:e}),w(!u[d],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:p},value:e}),u[d]=!0,e[d]})}else m(!1,"invalid tuple value","tuple",e);m(t.length===r.length,"types/value length mismatch","tuple",e);let a=new ae,s=new ae,o=[];t.forEach((u,p)=>{let d=r[p];if(u.dynamic){let f=s.length;u.encode(s,d);let h=a.writeUpdatableValue();o.push(C=>{h(C+f)})}else u.encode(a,d)}),o.forEach(u=>{u(a.length)});let l=n.appendWriter(a);return l+=n.appendWriter(s),l}i(Sa,"pack");function Da(n,t){let e=[],r=[],a=n.subReader(0);return t.forEach(s=>{let o=null;if(s.dynamic){let l=n.readIndex(),u=a.subReader(l);try{o=s.decode(u)}catch(p){if(wt(p,"BUFFER_OVERRUN"))throw p;o=p,o.baseType=s.name,o.name=s.localName,o.type=s.type}}else try{o=s.decode(n)}catch(l){if(wt(l,"BUFFER_OVERRUN"))throw l;o=l,o.baseType=s.name,o.name=s.localName,o.type=s.type}if(o==null)throw new Error("investigate");e.push(o),r.push(s.localName||null)}),dt.fromItems(e,r)}i(Da,"unpack");var Un=class extends Q{static{i(this,"ArrayCoder")}coder;length;constructor(t,e,r){let a=t.type+"["+(e>=0?e:"")+"]",s=e===-1||t.dynamic;super("array",a,r,s),v(this,{coder:t,length:e})}defaultValue(){let t=this.coder.defaultValue(),e=[];for(let r=0;r<this.length;r++)e.push(t);return e}encode(t,e){let r=J.dereference(e,"array");Array.isArray(r)||this._throwError("expected array value",r);let a=this.length;a===-1&&(a=r.length,t.writeValue(r.length)),Ze(r.length,a,"coder array"+(this.localName?" "+this.localName:""));let s=[];for(let o=0;o<r.length;o++)s.push(this.coder);return Sa(t,s,r)}decode(t){let e=this.length;e===-1&&(e=t.readIndex(),w(e*et<=t.dataLength,"insufficient data length","BUFFER_OVERRUN",{buffer:t.bytes,offset:e*et,length:t.dataLength}));let r=[];for(let a=0;a<e;a++)r.push(new Hn(this.coder));return Da(t,r)}};var Vn=class extends Q{static{i(this,"BooleanCoder")}constructor(t){super("bool","bool",t,!1)}defaultValue(){return!1}encode(t,e){let r=J.dereference(e,"bool");return t.writeValue(r?1:0)}decode(t){return!!t.readValue()}};var ar=class extends Q{static{i(this,"DynamicBytesCoder")}constructor(t,e){super(t,t,e,!0)}defaultValue(){return"0x"}encode(t,e){e=nt(e);let r=t.writeValue(e.length);return r+=t.writeBytes(e),r}decode(t){return t.readBytes(t.readIndex(),!0)}},Mn=class extends ar{static{i(this,"BytesCoder")}constructor(t){super("bytes",t)}decode(t){return D(super.decode(t))}};var Gn=class extends Q{static{i(this,"FixedBytesCoder")}size;constructor(t,e){let r="bytes"+String(t);super(r,r,e,!1),v(this,{size:t},{size:"number"})}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(t,e){let r=nt(J.dereference(e,this.type));return r.length!==this.size&&this._throwError("incorrect data length",e),t.writeBytes(r)}decode(t){return D(t.readBytes(this.size))}};var Ii=new Uint8Array([]),$n=class extends Q{static{i(this,"NullCoder")}constructor(t){super("null","",t,!1)}defaultValue(){return null}encode(t,e){return e!=null&&this._throwError("not null",e),t.writeBytes(Ii)}decode(t){return t.readBytes(0),null}};var Oi=BigInt(0),Bi=BigInt(1),Ni=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),jn=class extends Q{static{i(this,"NumberCoder")}size;signed;constructor(t,e,r){let a=(e?"int":"uint")+t*8;super(a,a,r,!1),v(this,{size:t,signed:e},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(t,e){let r=I(J.dereference(e,this.type)),a=Ae(Ni,et*8);if(this.signed){let s=Ae(a,this.size*8-1);(r>s||r<-(s+Bi))&&this._throwError("value out-of-bounds",e),r=Ta(r,8*et)}else(r<Oi||r>Ae(a,this.size*8))&&this._throwError("value out-of-bounds",e);return t.writeValue(r)}decode(t){let e=Ae(t.readValue(),this.size*8);return this.signed&&(e=wa(e,this.size*8)),e}};var zn=class extends ar{static{i(this,"StringCoder")}constructor(t){super("string",t)}defaultValue(){return""}encode(t,e){return super.encode(t,Re(J.dereference(e,"string")))}decode(t){return er(super.decode(t))}};var se=class extends Q{static{i(this,"TupleCoder")}coders;constructor(t,e){let r=!1,a=[];t.forEach(o=>{o.dynamic&&(r=!0),a.push(o.type)});let s="tuple("+a.join(",")+")";super("tuple",s,e,r),v(this,{coders:Object.freeze(t.slice())})}defaultValue(){let t=[];this.coders.forEach(r=>{t.push(r.defaultValue())});let e=this.coders.reduce((r,a)=>{let s=a.localName;return s&&(r[s]||(r[s]=0),r[s]++),r},{});return this.coders.forEach((r,a)=>{let s=r.localName;!s||e[s]!==1||(s==="length"&&(s="_length"),t[s]==null&&(t[s]=t[a]))}),Object.freeze(t)}encode(t,e){let r=J.dereference(e,"tuple");return Sa(t,this.coders,r)}decode(t){return Da(t,this.coders)}};function zt(n){return st(Re(n))}i(zt,"id");function _a(n,t){return{address:$(n),storageKeys:t.map((e,r)=>(m(Y(e,32),"invalid slot",`storageKeys[${r}]`,e),e.toLowerCase()))}}i(_a,"accessSetify");function sr(n){if(Array.isArray(n))return n.map((e,r)=>Array.isArray(e)?(m(e.length===2,"invalid slot set",`value[${r}]`,e),_a(e[0],e[1])):(m(e!=null&&typeof e=="object","invalid address-slot set","value",n),_a(e.address,e.storageKeys)));m(n!=null&&typeof n=="object","invalid access list","value",n);let t=Object.keys(n).map(e=>{let r=n[e].reduce((a,s)=>(a[s]=!0,a),{});return _a(e,Object.keys(r).sort())});return t.sort((e,r)=>e.address.localeCompare(r.address)),t}i(sr,"accessListify");function at(n){let t=new Set;return n.forEach(e=>t.add(e)),Object.freeze(t)}i(at,"setify");var Fi="external public payable override",Si=at(Fi.split(" ")),yo="constant external internal payable private public pure view override",Di=at(yo.split(" ")),Co="constructor error event fallback function receive struct",xo=at(Co.split(" ")),bo="calldata memory storage payable indexed",_i=at(bo.split(" ")),Li="tuple returns",Hi=[Co,bo,Li,yo].join(" "),Ui=at(Hi.split(" ")),Vi={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},Mi=new RegExp("^(\\s*)"),Gi=new RegExp("^([0-9]+)"),$i=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),Eo=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),wo=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$"),Ct=class n{static{i(this,"TokenString")}#t;#e;get offset(){return this.#t}get length(){return this.#e.length-this.#t}constructor(t){this.#t=0,this.#e=t.slice()}clone(){return new n(this.#e)}reset(){this.#t=0}#r(t=0,e=0){return new n(this.#e.slice(t,e).map(r=>Object.freeze(Object.assign({},r,{match:r.match-t,linkBack:r.linkBack-t,linkNext:r.linkNext-t}))))}popKeyword(t){let e=this.peek();if(e.type!=="KEYWORD"||!t.has(e.text))throw new Error(`expected keyword ${e.text}`);return this.pop().text}popType(t){if(this.peek().type!==t){let e=this.peek();throw new Error(`expected ${t}; got ${e.type} ${JSON.stringify(e.text)}`)}return this.pop().text}popParen(){let t=this.peek();if(t.type!=="OPEN_PAREN")throw new Error("bad start");let e=this.#r(this.#t+1,t.match+1);return this.#t=t.match+1,e}popParams(){let t=this.peek();if(t.type!=="OPEN_PAREN")throw new Error("bad start");let e=[];for(;this.#t<t.match-1;){let r=this.peek().linkNext;e.push(this.#r(this.#t+1,r)),this.#t=r}return this.#t=t.match+1,e}peek(){if(this.#t>=this.#e.length)throw new Error("out-of-bounds");return this.#e[this.#t]}peekKeyword(t){let e=this.peekType("KEYWORD");return e!=null&&t.has(e)?e:null}peekType(t){if(this.length===0)return null;let e=this.peek();return e.type===t?e.text:null}pop(){let t=this.peek();return this.#t++,t}toString(){let t=[];for(let e=this.#t;e<this.#e.length;e++){let r=this.#e[e];t.push(`${r.type}:${r.text}`)}return`<TokenString ${t.join(" ")}>`}};function Zt(n){let t=[],e=i(o=>{let l=s<n.length?JSON.stringify(n[s]):"$EOI";throw new Error(`invalid token ${l} at ${s}: ${o}`)},"throwError"),r=[],a=[],s=0;for(;s<n.length;){let o=n.substring(s),l=o.match(Mi);l&&(s+=l[1].length,o=n.substring(s));let u={depth:r.length,linkBack:-1,linkNext:-1,match:-1,type:"",text:"",offset:s,value:-1};t.push(u);let p=Vi[o[0]]||"";if(p){if(u.type=p,u.text=o[0],s++,p==="OPEN_PAREN")r.push(t.length-1),a.push(t.length-1);else if(p=="CLOSE_PAREN")r.length===0&&e("no matching open bracket"),u.match=r.pop(),t[u.match].match=t.length-1,u.depth--,u.linkBack=a.pop(),t[u.linkBack].linkNext=t.length-1;else if(p==="COMMA")u.linkBack=a.pop(),t[u.linkBack].linkNext=t.length-1,a.push(t.length-1);else if(p==="OPEN_BRACKET")u.type="BRACKET";else if(p==="CLOSE_BRACKET"){let d=t.pop().text;if(t.length>0&&t[t.length-1].type==="NUMBER"){let f=t.pop().text;d=f+d,t[t.length-1].value=_(f)}if(t.length===0||t[t.length-1].type!=="BRACKET")throw new Error("missing opening bracket");t[t.length-1].text+=d}continue}if(l=o.match($i),l){if(u.text=l[1],s+=u.text.length,Ui.has(u.text)){u.type="KEYWORD";continue}if(u.text.match(wo)){u.type="TYPE";continue}u.type="ID";continue}if(l=o.match(Gi),l){u.text=l[1],u.type="NUMBER",s+=u.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(o[0])} at position ${s}`)}return new Ct(t.map(o=>Object.freeze(o)))}i(Zt,"lex");function io(n,t){let e=[];for(let r in t.keys())n.has(r)&&e.push(r);if(e.length>1)throw new Error(`conflicting types: ${e.join(", ")}`)}i(io,"allowSingle");function Jn(n,t){if(t.peekKeyword(xo)){let e=t.pop().text;if(e!==n)throw new Error(`expected ${n}, got ${e}`)}return t.popType("ID")}i(Jn,"consumeName");function Nt(n,t){let e=new Set;for(;;){let r=n.peekType("KEYWORD");if(r==null||t&&!t.has(r))break;if(n.pop(),e.has(r))throw new Error(`duplicate keywords: ${JSON.stringify(r)}`);e.add(r)}return Object.freeze(e)}i(Nt,"consumeKeywords");function To(n){let t=Nt(n,Di);return io(t,at("constant payable nonpayable".split(" "))),io(t,at("pure view payable nonpayable".split(" "))),t.has("view")?"view":t.has("pure")?"pure":t.has("payable")?"payable":t.has("nonpayable")?"nonpayable":t.has("constant")?"view":"nonpayable"}i(To,"consumeMutability");function Bt(n,t){return n.popParams().map(e=>q.from(e,t))}i(Bt,"consumeParams");function vo(n){if(n.peekType("AT")){if(n.pop(),n.peekType("NUMBER"))return I(n.pop().text);throw new Error("invalid gas")}return null}i(vo,"consumeGas");function oe(n){if(n.length)throw new Error(`unexpected tokens at offset ${n.offset}: ${n.toString()}`)}i(oe,"consumeEoi");var ji=new RegExp(/^(.*)\[([0-9]*)\]$/);function co(n){let t=n.match(wo);if(m(t,"invalid type","type",n),n==="uint")return"uint256";if(n==="int")return"int256";if(t[2]){let e=parseInt(t[2]);m(e!==0&&e<=32,"invalid bytes length","type",n)}else if(t[3]){let e=parseInt(t[3]);m(e!==0&&e<=256&&e%8===0,"invalid numeric width","type",n)}return n}i(co,"verifyBasicType");var W={},ot=Symbol.for("_ethers_internal"),lo="_ParamTypeInternal",uo="_ErrorInternal",po="_EventInternal",fo="_ConstructorInternal",ho="_FallbackInternal",mo="_FunctionInternal",go="_StructInternal",q=class n{static{i(this,"ParamType")}name;type;baseType;indexed;components;arrayLength;arrayChildren;constructor(t,e,r,a,s,o,l,u){if($t(t,W,"ParamType"),Object.defineProperty(this,ot,{value:lo}),o&&(o=Object.freeze(o.slice())),a==="array"){if(l==null||u==null)throw new Error("")}else if(l!=null||u!=null)throw new Error("");if(a==="tuple"){if(o==null)throw new Error("")}else if(o!=null)throw new Error("");v(this,{name:e,type:r,baseType:a,indexed:s,components:o,arrayLength:l,arrayChildren:u})}format(t){if(t==null&&(t="sighash"),t==="json"){let r=this.name||"";if(this.isArray()){let s=JSON.parse(this.arrayChildren.format("json"));return s.name=r,s.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(s)}let a={type:this.baseType==="tuple"?"tuple":this.type,name:r};return typeof this.indexed=="boolean"&&(a.indexed=this.indexed),this.isTuple()&&(a.components=this.components.map(s=>JSON.parse(s.format(t)))),JSON.stringify(a)}let e="";return this.isArray()?(e+=this.arrayChildren.format(t),e+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?e+="("+this.components.map(r=>r.format(t)).join(t==="full"?", ":",")+")":e+=this.type,t!=="sighash"&&(this.indexed===!0&&(e+=" indexed"),t==="full"&&this.name&&(e+=" "+this.name)),e}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(t,e){if(this.isArray()){if(!Array.isArray(t))throw new Error("invalid array value");if(this.arrayLength!==-1&&t.length!==this.arrayLength)throw new Error("array is wrong length");let r=this;return t.map(a=>r.arrayChildren.walk(a,e))}if(this.isTuple()){if(!Array.isArray(t))throw new Error("invalid tuple value");if(t.length!==this.components.length)throw new Error("array is wrong length");let r=this;return t.map((a,s)=>r.components[s].walk(a,e))}return e(this.type,t)}#t(t,e,r,a){if(this.isArray()){if(!Array.isArray(e))throw new Error("invalid array value");if(this.arrayLength!==-1&&e.length!==this.arrayLength)throw new Error("array is wrong length");let o=this.arrayChildren,l=e.slice();l.forEach((u,p)=>{o.#t(t,u,r,d=>{l[p]=d})}),a(l);return}if(this.isTuple()){let o=this.components,l;if(Array.isArray(e))l=e.slice();else{if(e==null||typeof e!="object")throw new Error("invalid tuple value");l=o.map(u=>{if(!u.name)throw new Error("cannot use object value with unnamed components");if(!(u.name in e))throw new Error(`missing value for component ${u.name}`);return e[u.name]})}if(l.length!==this.components.length)throw new Error("array is wrong length");l.forEach((u,p)=>{o[p].#t(t,u,r,d=>{l[p]=d})}),a(l);return}let s=r(this.type,e);s.then?t.push(async function(){a(await s)}()):a(s)}async walkAsync(t,e){let r=[],a=[t];return this.#t(r,t,e,s=>{a[0]=s}),r.length&&await Promise.all(r),a[0]}static from(t,e){if(n.isParamType(t))return t;if(typeof t=="string")try{return n.from(Zt(t),e)}catch{m(!1,"invalid param type","obj",t)}else if(t instanceof Ct){let l="",u="",p=null;Nt(t,at(["tuple"])).has("tuple")||t.peekType("OPEN_PAREN")?(u="tuple",p=t.popParams().map(A=>n.from(A)),l=`tuple(${p.map(A=>A.format()).join(",")})`):(l=co(t.popType("TYPE")),u=l);let d=null,f=null;for(;t.length&&t.peekType("BRACKET");){let A=t.pop();d=new n(W,"",l,u,null,p,f,d),f=A.value,l+=A.text,u="array",p=null}let h=null;if(Nt(t,_i).has("indexed")){if(!e)throw new Error("");h=!0}let E=t.peekType("ID")?t.pop().text:"";if(t.length)throw new Error("leftover tokens");return new n(W,E,l,u,h,p,f,d)}let r=t.name;m(!r||typeof r=="string"&&r.match(Eo),"invalid name","obj.name",r);let a=t.indexed;a==!0?(m(e,"parameter cannot be indexed","obj.indexed",t.indexed),a=!0):a=!1;let s=t.type,o=s.match(ji);if(o){let l=parseInt(o[2]||"-1"),u=n.from({type:o[1],components:t.components});return new n(W,r||"",s,"array",a,null,l,u)}if(s==="tuple"||s.startsWith("tuple(")||s.startsWith("(")){let l=t.components!=null?t.components.map(p=>n.from(p)):null;return new n(W,r||"",s,"tuple",a,l,null,null)}return s=co(t.type),new n(W,r||"",s,s,a,null,null,null)}static isParamType(t){return t&&t[ot]===lo}},Xt=class n{static{i(this,"Fragment")}type;inputs;constructor(t,e,r){$t(t,W,"Fragment"),r=Object.freeze(r.slice()),v(this,{type:e,inputs:r})}static from(t){if(typeof t=="string"){try{n.from(JSON.parse(t))}catch{}return n.from(Zt(t))}if(t instanceof Ct)switch(t.peekKeyword(xo)){case"constructor":return Wt.from(t);case"error":return ut.from(t);case"event":return Jt.from(t);case"fallback":case"receive":return ir.from(t);case"function":return Kt.from(t);case"struct":return Be.from(t)}else if(typeof t=="object"){switch(t.type){case"constructor":return Wt.from(t);case"error":return ut.from(t);case"event":return Jt.from(t);case"fallback":case"receive":return ir.from(t);case"function":return Kt.from(t);case"struct":return Be.from(t)}w(!1,`unsupported type: ${t.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}m(!1,"unsupported frgament object","obj",t)}static isConstructor(t){return Wt.isFragment(t)}static isError(t){return ut.isFragment(t)}static isEvent(t){return Jt.isFragment(t)}static isFunction(t){return Kt.isFragment(t)}static isStruct(t){return Be.isFragment(t)}},ie=class extends Xt{static{i(this,"NamedFragment")}name;constructor(t,e,r,a){super(t,e,a),m(typeof r=="string"&&r.match(Eo),"invalid identifier","name",r),a=Object.freeze(a.slice()),v(this,{name:r})}};function or(n,t){return"("+t.map(e=>e.format(n)).join(n==="full"?", ":",")+")"}i(or,"joinParams");var ut=class n extends ie{static{i(this,"ErrorFragment")}constructor(t,e,r){super(t,"error",e,r),Object.defineProperty(this,ot,{value:uo})}get selector(){return zt(this.format("sighash")).substring(0,10)}format(t){if(t==null&&(t="sighash"),t==="json")return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(t)))});let e=[];return t!=="sighash"&&e.push("error"),e.push(this.name+or(t,this.inputs)),e.join(" ")}static from(t){if(n.isFragment(t))return t;if(typeof t=="string")return n.from(Zt(t));if(t instanceof Ct){let e=Jn("error",t),r=Bt(t);return oe(t),new n(W,e,r)}return new n(W,t.name,t.inputs?t.inputs.map(q.from):[])}static isFragment(t){return t&&t[ot]===uo}},Jt=class n extends ie{static{i(this,"EventFragment")}anonymous;constructor(t,e,r,a){super(t,"event",e,r),Object.defineProperty(this,ot,{value:po}),v(this,{anonymous:a})}get topicHash(){return zt(this.format("sighash"))}format(t){if(t==null&&(t="sighash"),t==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(t)))});let e=[];return t!=="sighash"&&e.push("event"),e.push(this.name+or(t,this.inputs)),t!=="sighash"&&this.anonymous&&e.push("anonymous"),e.join(" ")}static getTopicHash(t,e){return e=(e||[]).map(a=>q.from(a)),new n(W,t,e,!1).topicHash}static from(t){if(n.isFragment(t))return t;if(typeof t=="string")try{return n.from(Zt(t))}catch{m(!1,"invalid event fragment","obj",t)}else if(t instanceof Ct){let e=Jn("event",t),r=Bt(t,!0),a=!!Nt(t,at(["anonymous"])).has("anonymous");return oe(t),new n(W,e,r,a)}return new n(W,t.name,t.inputs?t.inputs.map(e=>q.from(e,!0)):[],!!t.anonymous)}static isFragment(t){return t&&t[ot]===po}},Wt=class n extends Xt{static{i(this,"ConstructorFragment")}payable;gas;constructor(t,e,r,a,s){super(t,e,r),Object.defineProperty(this,ot,{value:fo}),v(this,{payable:a,gas:s})}format(t){if(w(t!=null&&t!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),t==="json")return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(r=>JSON.parse(r.format(t)))});let e=[`constructor${or(t,this.inputs)}`];return this.payable&&e.push("payable"),this.gas!=null&&e.push(`@${this.gas.toString()}`),e.join(" ")}static from(t){if(n.isFragment(t))return t;if(typeof t=="string")try{return n.from(Zt(t))}catch{m(!1,"invalid constuctor fragment","obj",t)}else if(t instanceof Ct){Nt(t,at(["constructor"]));let e=Bt(t),r=!!Nt(t,Si).has("payable"),a=vo(t);return oe(t),new n(W,"constructor",e,r,a)}return new n(W,"constructor",t.inputs?t.inputs.map(q.from):[],!!t.payable,t.gas!=null?t.gas:null)}static isFragment(t){return t&&t[ot]===fo}},ir=class n extends Xt{static{i(this,"FallbackFragment")}payable;constructor(t,e,r){super(t,"fallback",e),Object.defineProperty(this,ot,{value:ho}),v(this,{payable:r})}format(t){let e=this.inputs.length===0?"receive":"fallback";if(t==="json"){let r=this.payable?"payable":"nonpayable";return JSON.stringify({type:e,stateMutability:r})}return`${e}()${this.payable?" payable":""}`}static from(t){if(n.isFragment(t))return t;if(typeof t=="string")try{return n.from(Zt(t))}catch{m(!1,"invalid fallback fragment","obj",t)}else if(t instanceof Ct){let e=t.toString(),r=t.peekKeyword(at(["fallback","receive"]));if(m(r,"type must be fallback or receive","obj",e),t.popKeyword(at(["fallback","receive"]))==="receive"){let l=Bt(t);return m(l.length===0,"receive cannot have arguments","obj.inputs",l),Nt(t,at(["payable"])),oe(t),new n(W,[],!0)}let s=Bt(t);s.length?m(s.length===1&&s[0].type==="bytes","invalid fallback inputs","obj.inputs",s.map(l=>l.format("minimal")).join(", ")):s=[q.from("bytes")];let o=To(t);if(m(o==="nonpayable"||o==="payable","fallback cannot be constants","obj.stateMutability",o),Nt(t,at(["returns"])).has("returns")){let l=Bt(t);m(l.length===1&&l[0].type==="bytes","invalid fallback outputs","obj.outputs",l.map(u=>u.format("minimal")).join(", "))}return oe(t),new n(W,s,o==="payable")}if(t.type==="receive")return new n(W,[],!0);if(t.type==="fallback"){let e=[q.from("bytes")],r=t.stateMutability==="payable";return new n(W,e,r)}m(!1,"invalid fallback description","obj",t)}static isFragment(t){return t&&t[ot]===ho}},Kt=class n extends ie{static{i(this,"FunctionFragment")}constant;outputs;stateMutability;payable;gas;constructor(t,e,r,a,s,o){super(t,"function",e,a),Object.defineProperty(this,ot,{value:mo}),s=Object.freeze(s.slice()),v(this,{constant:r==="view"||r==="pure",gas:o,outputs:s,payable:r==="payable",stateMutability:r})}get selector(){return zt(this.format("sighash")).substring(0,10)}format(t){if(t==null&&(t="sighash"),t==="json")return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(r=>JSON.parse(r.format(t))),outputs:this.outputs.map(r=>JSON.parse(r.format(t)))});let e=[];return t!=="sighash"&&e.push("function"),e.push(this.name+or(t,this.inputs)),t!=="sighash"&&(this.stateMutability!=="nonpayable"&&e.push(this.stateMutability),this.outputs&&this.outputs.length&&(e.push("returns"),e.push(or(t,this.outputs))),this.gas!=null&&e.push(`@${this.gas.toString()}`)),e.join(" ")}static getSelector(t,e){return e=(e||[]).map(a=>q.from(a)),new n(W,t,"view",e,[],null).selector}static from(t){if(n.isFragment(t))return t;if(typeof t=="string")try{return n.from(Zt(t))}catch{m(!1,"invalid function fragment","obj",t)}else if(t instanceof Ct){let r=Jn("function",t),a=Bt(t),s=To(t),o=[];Nt(t,at(["returns"])).has("returns")&&(o=Bt(t));let l=vo(t);return oe(t),new n(W,r,s,a,o,l)}let e=t.stateMutability;return e==null&&(e="payable",typeof t.constant=="boolean"?(e="view",t.constant||(e="payable",typeof t.payable=="boolean"&&!t.payable&&(e="nonpayable"))):typeof t.payable=="boolean"&&!t.payable&&(e="nonpayable")),new n(W,t.name,e,t.inputs?t.inputs.map(q.from):[],t.outputs?t.outputs.map(q.from):[],t.gas!=null?t.gas:null)}static isFragment(t){return t&&t[ot]===mo}},Be=class n extends ie{static{i(this,"StructFragment")}constructor(t,e,r){super(t,"struct",e,r),Object.defineProperty(this,ot,{value:go})}format(){throw new Error("@TODO")}static from(t){if(typeof t=="string")try{return n.from(Zt(t))}catch{m(!1,"invalid struct fragment","obj",t)}else if(t instanceof Ct){let e=Jn("struct",t),r=Bt(t);return oe(t),new n(W,e,r)}return new n(W,t.name,t.inputs?t.inputs.map(q.from):[])}static isFragment(t){return t&&t[ot]===go}};var xt=new Map;xt.set(0,"GENERIC_PANIC");xt.set(1,"ASSERT_FALSE");xt.set(17,"OVERFLOW");xt.set(18,"DIVIDE_BY_ZERO");xt.set(33,"ENUM_RANGE_ERROR");xt.set(34,"BAD_STORAGE_DATA");xt.set(49,"STACK_UNDERFLOW");xt.set(50,"ARRAY_RANGE_ERROR");xt.set(65,"OUT_OF_MEMORY");xt.set(81,"UNINITIALIZED_FUNCTION_CALL");var zi=new RegExp(/^bytes([0-9]*)$/),Ji=new RegExp(/^(u?int)([0-9]*)$/),La=null,Po=1024;function Wi(n,t,e,r){let a="missing revert data",s=null,o=null,l=null;if(e){a="execution reverted";let p=z(e);if(e=D(e),p.length===0)a+=" (no data present; likely require(false) occurred",s="require(false)";else if(p.length%32!==4)a+=" (could not decode reason; invalid data length)";else if(D(p.slice(0,4))==="0x08c379a0")try{s=r.decode(["string"],p.slice(4))[0],l={signature:"Error(string)",name:"Error",args:[s]},a+=`: ${JSON.stringify(s)}`}catch{a+=" (could not decode reason; invalid string data)"}else if(D(p.slice(0,4))==="0x4e487b71")try{let d=Number(r.decode(["uint256"],p.slice(4))[0]);l={signature:"Panic(uint256)",name:"Panic",args:[d]},s=`Panic due to ${xt.get(d)||"UNKNOWN"}(${d})`,a+=`: ${s}`}catch{a+=" (could not decode panic code)"}else a+=" (unknown custom error)"}let u={to:t.to?$(t.to):null,data:t.data||"0x"};return t.from&&(u.from=$(t.from)),Ot(a,"CALL_EXCEPTION",{action:n,data:e,reason:s,transaction:u,invocation:o,revert:l})}i(Wi,"getBuiltinCallException");var Ne=class n{static{i(this,"AbiCoder")}#t(t){if(t.isArray())return new Un(this.#t(t.arrayChildren),t.arrayLength,t.name);if(t.isTuple())return new se(t.components.map(r=>this.#t(r)),t.name);switch(t.baseType){case"address":return new Ln(t.name);case"bool":return new Vn(t.name);case"string":return new zn(t.name);case"bytes":return new Mn(t.name);case"":return new $n(t.name)}let e=t.type.match(Ji);if(e){let r=parseInt(e[2]||"256");return m(r!==0&&r<=256&&r%8===0,"invalid "+e[1]+" bit length","param",t),new jn(r/8,e[1]==="int",t.name)}if(e=t.type.match(zi),e){let r=parseInt(e[1]);return m(r!==0&&r<=32,"invalid bytes length","param",t),new Gn(r,t.name)}m(!1,"invalid type","type",t.type)}getDefaultValue(t){let e=t.map(a=>this.#t(q.from(a)));return new se(e,"_").defaultValue()}encode(t,e){Ze(e.length,t.length,"types/values length mismatch");let r=t.map(o=>this.#t(q.from(o))),a=new se(r,"_"),s=new ae;return a.encode(s,e),s.data}decode(t,e,r){let a=t.map(o=>this.#t(q.from(o)));return new se(a,"_").decode(new _n(e,r,Po))}static _setDefaultMaxInflation(t){m(typeof t=="number"&&Number.isInteger(t),"invalid defaultMaxInflation factor","value",t),Po=t}static defaultAbiCoder(){return La==null&&(La=new n),La}static getBuiltinCallException(t,e,r){return Wi(t,e,r,n.defaultAbiCoder())}};function ko(n){let t=z(n,"bytes");if(t.length!==32)throw new Error("invalid bytes32 - not 32 bytes long");if(t[31]!==0)throw new Error("invalid bytes32 string - no null terminator");let e=31;for(;t[e-1]===0;)e--;return er(t.slice(0,e))}i(ko,"decodeBytes32String");var cr=class{static{i(this,"LogDescription")}fragment;name;signature;topic;args;constructor(t,e,r){let a=t.name,s=t.format();v(this,{fragment:t,name:a,signature:s,topic:e,args:r})}},lr=class{static{i(this,"TransactionDescription")}fragment;name;args;signature;selector;value;constructor(t,e,r,a){let s=t.name,o=t.format();v(this,{fragment:t,name:s,args:r,signature:o,selector:e,value:a})}},ur=class{static{i(this,"ErrorDescription")}fragment;name;args;signature;selector;constructor(t,e,r){let a=t.name,s=t.format();v(this,{fragment:t,name:a,args:r,signature:s,selector:e})}},Fe=class{static{i(this,"Indexed")}hash;_isIndexed;static isIndexed(t){return!!(t&&t._isIndexed)}constructor(t){v(this,{hash:t,_isIndexed:!0})}},Ao={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"},Ro={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:i(n=>`reverted with reason string ${JSON.stringify(n)}`,"reason")},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:i(n=>{let t="unknown panic code";return n>=0&&n<=255&&Ao[n.toString()]&&(t=Ao[n.toString()]),`reverted with panic code 0x${n.toString(16)} (${t})`},"reason")}},Ft=class n{static{i(this,"Interface")}fragments;deploy;fallback;receive;#t;#e;#r;#n;constructor(t){let e=[];typeof t=="string"?e=JSON.parse(t):e=t,this.#r=new Map,this.#t=new Map,this.#e=new Map;let r=[];for(let o of e)try{r.push(Xt.from(o))}catch(l){console.log(`[Warning] Invalid Fragment ${JSON.stringify(o)}:`,l.message)}v(this,{fragments:Object.freeze(r)});let a=null,s=!1;this.#n=this.getAbiCoder(),this.fragments.forEach((o,l)=>{let u;switch(o.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}v(this,{deploy:o});return;case"fallback":o.inputs.length===0?s=!0:(m(!a||o.payable!==a.payable,"conflicting fallback fragments",`fragments[${l}]`,o),a=o,s=a.payable);return;case"function":u=this.#r;break;case"event":u=this.#e;break;case"error":u=this.#t;break;default:return}let p=o.format();u.has(p)||u.set(p,o)}),this.deploy||v(this,{deploy:Wt.from("constructor()")}),v(this,{fallback:a,receive:s})}format(t){let e=t?"minimal":"full";return this.fragments.map(a=>a.format(e))}formatJson(){let t=this.fragments.map(e=>e.format("json"));return JSON.stringify(t.map(e=>JSON.parse(e)))}getAbiCoder(){return Ne.defaultAbiCoder()}#a(t,e,r){if(Y(t)){let s=t.toLowerCase();for(let o of this.#r.values())if(s===o.selector)return o;return null}if(t.indexOf("(")===-1){let s=[];for(let[o,l]of this.#r)o.split("(")[0]===t&&s.push(l);if(e){let o=e.length>0?e[e.length-1]:null,l=e.length,u=!0;J.isTyped(o)&&o.type==="overrides"&&(u=!1,l--);for(let p=s.length-1;p>=0;p--){let d=s[p].inputs.length;d!==l&&(!u||d!==l-1)&&s.splice(p,1)}for(let p=s.length-1;p>=0;p--){let d=s[p].inputs;for(let f=0;f<e.length;f++)if(J.isTyped(e[f])){if(f>=d.length){if(e[f].type==="overrides")continue;s.splice(p,1);break}if(e[f].type!==d[f].baseType){s.splice(p,1);break}}}}if(s.length===1&&e&&e.length!==s[0].inputs.length){let o=e[e.length-1];(o==null||Array.isArray(o)||typeof o!="object")&&s.splice(0,1)}if(s.length===0)return null;if(s.length>1&&r){let o=s.map(l=>JSON.stringify(l.format())).join(", ");m(!1,`ambiguous function description (i.e. matches ${o})`,"key",t)}return s[0]}let a=this.#r.get(Kt.from(t).format());return a||null}getFunctionName(t){let e=this.#a(t,null,!1);return m(e,"no matching function","key",t),e.name}hasFunction(t){return!!this.#a(t,null,!1)}getFunction(t,e){return this.#a(t,e||null,!0)}forEachFunction(t){let e=Array.from(this.#r.keys());e.sort((r,a)=>r.localeCompare(a));for(let r=0;r<e.length;r++){let a=e[r];t(this.#r.get(a),r)}}#s(t,e,r){if(Y(t)){let s=t.toLowerCase();for(let o of this.#e.values())if(s===o.topicHash)return o;return null}if(t.indexOf("(")===-1){let s=[];for(let[o,l]of this.#e)o.split("(")[0]===t&&s.push(l);if(e){for(let o=s.length-1;o>=0;o--)s[o].inputs.length<e.length&&s.splice(o,1);for(let o=s.length-1;o>=0;o--){let l=s[o].inputs;for(let u=0;u<e.length;u++)if(J.isTyped(e[u])&&e[u].type!==l[u].baseType){s.splice(o,1);break}}}if(s.length===0)return null;if(s.length>1&&r){let o=s.map(l=>JSON.stringify(l.format())).join(", ");m(!1,`ambiguous event description (i.e. matches ${o})`,"key",t)}return s[0]}let a=this.#e.get(Jt.from(t).format());return a||null}getEventName(t){let e=this.#s(t,null,!1);return m(e,"no matching event","key",t),e.name}hasEvent(t){return!!this.#s(t,null,!1)}getEvent(t,e){return this.#s(t,e||null,!0)}forEachEvent(t){let e=Array.from(this.#e.keys());e.sort((r,a)=>r.localeCompare(a));for(let r=0;r<e.length;r++){let a=e[r];t(this.#e.get(a),r)}}getError(t,e){if(Y(t)){let a=t.toLowerCase();if(Ro[a])return ut.from(Ro[a].signature);for(let s of this.#t.values())if(a===s.selector)return s;return null}if(t.indexOf("(")===-1){let a=[];for(let[s,o]of this.#t)s.split("(")[0]===t&&a.push(o);if(a.length===0)return t==="Error"?ut.from("error Error(string)"):t==="Panic"?ut.from("error Panic(uint256)"):null;if(a.length>1){let s=a.map(o=>JSON.stringify(o.format())).join(", ");m(!1,`ambiguous error description (i.e. ${s})`,"name",t)}return a[0]}if(t=ut.from(t).format(),t==="Error(string)")return ut.from("error Error(string)");if(t==="Panic(uint256)")return ut.from("error Panic(uint256)");let r=this.#t.get(t);return r||null}forEachError(t){let e=Array.from(this.#t.keys());e.sort((r,a)=>r.localeCompare(a));for(let r=0;r<e.length;r++){let a=e[r];t(this.#t.get(a),r)}}_decodeParams(t,e){return this.#n.decode(t,e)}_encodeParams(t,e){return this.#n.encode(t,e)}encodeDeploy(t){return this._encodeParams(this.deploy.inputs,t||[])}decodeErrorResult(t,e){if(typeof t=="string"){let r=this.getError(t);m(r,"unknown error","fragment",t),t=r}return m(Tt(e,0,4)===t.selector,`data signature does not match error ${t.name}.`,"data",e),this._decodeParams(t.inputs,Tt(e,4))}encodeErrorResult(t,e){if(typeof t=="string"){let r=this.getError(t);m(r,"unknown error","fragment",t),t=r}return lt([t.selector,this._encodeParams(t.inputs,e||[])])}decodeFunctionData(t,e){if(typeof t=="string"){let r=this.getFunction(t);m(r,"unknown function","fragment",t),t=r}return m(Tt(e,0,4)===t.selector,`data signature does not match function ${t.name}.`,"data",e),this._decodeParams(t.inputs,Tt(e,4))}encodeFunctionData(t,e){if(typeof t=="string"){let r=this.getFunction(t);m(r,"unknown function","fragment",t),t=r}return lt([t.selector,this._encodeParams(t.inputs,e||[])])}decodeFunctionResult(t,e){if(typeof t=="string"){let s=this.getFunction(t);m(s,"unknown function","fragment",t),t=s}let r="invalid length for result data",a=nt(e);if(a.length%32===0)try{return this.#n.decode(t.outputs,a)}catch{r="could not decode result data"}w(!1,r,"BAD_DATA",{value:D(a),info:{method:t.name,signature:t.format()}})}makeError(t,e){let r=z(t,"data"),a=Ne.getBuiltinCallException("call",e,r);if(a.message.startsWith("execution reverted (unknown custom error)")){let l=D(r.slice(0,4)),u=this.getError(l);if(u)try{let p=this.#n.decode(u.inputs,r.slice(4));a.revert={name:u.name,signature:u.format(),args:p},a.reason=a.revert.signature,a.message=`execution reverted: ${a.reason}`}catch{a.message="execution reverted (coult not decode custom error)"}}let o=this.parseTransaction(e);return o&&(a.invocation={method:o.name,signature:o.signature,args:o.args}),a}encodeFunctionResult(t,e){if(typeof t=="string"){let r=this.getFunction(t);m(r,"unknown function","fragment",t),t=r}return D(this.#n.encode(t.outputs,e||[]))}encodeFilterTopics(t,e){if(typeof t=="string"){let s=this.getEvent(t);m(s,"unknown event","eventFragment",t),t=s}w(e.length<=t.inputs.length,`too many arguments for ${t.format()}`,"UNEXPECTED_ARGUMENT",{count:e.length,expectedCount:t.inputs.length});let r=[];t.anonymous||r.push(t.topicHash);let a=i((s,o)=>s.type==="string"?zt(o):s.type==="bytes"?st(D(o)):(s.type==="bool"&&typeof o=="boolean"?o=o?"0x01":"0x00":s.type.match(/^u?int/)?o=Qe(o):s.type.match(/^bytes/)?o=Pn(o,32):s.type==="address"&&this.#n.encode(["address"],[o]),Pe(D(o),32)),"encodeTopic");for(e.forEach((s,o)=>{let l=t.inputs[o];if(!l.indexed){m(s==null,"cannot filter non-indexed parameters; must be null","contract."+l.name,s);return}s==null?r.push(null):l.baseType==="array"||l.baseType==="tuple"?m(!1,"filtering with tuples or arrays not supported","contract."+l.name,s):Array.isArray(s)?r.push(s.map(u=>a(l,u))):r.push(a(l,s))});r.length&&r[r.length-1]===null;)r.pop();return r}encodeEventLog(t,e){if(typeof t=="string"){let o=this.getEvent(t);m(o,"unknown event","eventFragment",t),t=o}let r=[],a=[],s=[];return t.anonymous||r.push(t.topicHash),m(e.length===t.inputs.length,"event arguments/values mismatch","values",e),t.inputs.forEach((o,l)=>{let u=e[l];if(o.indexed)if(o.type==="string")r.push(zt(u));else if(o.type==="bytes")r.push(st(u));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");r.push(this.#n.encode([o.type],[u]))}else a.push(o),s.push(u)}),{data:this.#n.encode(a,s),topics:r}}decodeEventLog(t,e,r){if(typeof t=="string"){let C=this.getEvent(t);m(C,"unknown event","eventFragment",t),t=C}if(r!=null&&!t.anonymous){let C=t.topicHash;m(Y(r[0],32)&&r[0].toLowerCase()===C,"fragment/topic mismatch","topics[0]",r[0]),r=r.slice(1)}let a=[],s=[],o=[];t.inputs.forEach((C,E)=>{C.indexed?C.type==="string"||C.type==="bytes"||C.baseType==="tuple"||C.baseType==="array"?(a.push(q.from({type:"bytes32",name:C.name})),o.push(!0)):(a.push(C),o.push(!1)):(s.push(C),o.push(!1))});let l=r!=null?this.#n.decode(a,lt(r)):null,u=this.#n.decode(s,e,!0),p=[],d=[],f=0,h=0;return t.inputs.forEach((C,E)=>{let A=null;if(C.indexed)if(l==null)A=new Fe(null);else if(o[E])A=new Fe(l[h++]);else try{A=l[h++]}catch(S){A=S}else try{A=u[f++]}catch(S){A=S}p.push(A),d.push(C.name||null)}),dt.fromItems(p,d)}parseTransaction(t){let e=z(t.data,"tx.data"),r=I(t.value!=null?t.value:0,"tx.value"),a=this.getFunction(D(e.slice(0,4)));if(!a)return null;let s=this.#n.decode(a.inputs,e.slice(4));return new lr(a,a.selector,s,r)}parseCallResult(t){throw new Error("@TODO")}parseLog(t){let e=this.getEvent(t.topics[0]);return!e||e.anonymous?null:new cr(e,e.topicHash,this.decodeEventLog(e,t.data,t.topics))}parseError(t){let e=D(t),r=this.getError(Tt(e,0,4));if(!r)return null;let a=this.#n.decode(r.inputs,Tt(e,4));return new ur(r,r.selector,a)}static from(t){return t instanceof n?t:typeof t=="string"?new n(JSON.parse(t)):typeof t.formatJson=="function"?new n(t.formatJson()):typeof t.format=="function"?new n(t.format("json")):new n(t)}};var Oo=BigInt(0);function ft(n){return n==null?null:n.toString()}i(ft,"toJson");function Bo(n){let t={};n.to&&(t.to=n.to),n.from&&(t.from=n.from),n.data&&(t.data=D(n.data));let e="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(let a of e)!(a in n)||n[a]==null||(t[a]=I(n[a],`request.${a}`));let r="type,nonce".split(/,/);for(let a of r)!(a in n)||n[a]==null||(t[a]=_(n[a],`request.${a}`));return n.accessList&&(t.accessList=sr(n.accessList)),"blockTag"in n&&(t.blockTag=n.blockTag),"enableCcipRead"in n&&(t.enableCcipRead=!!n.enableCcipRead),"customData"in n&&(t.customData=n.customData),"blobVersionedHashes"in n&&n.blobVersionedHashes&&(t.blobVersionedHashes=n.blobVersionedHashes.slice()),"kzg"in n&&(t.kzg=n.kzg),"blobs"in n&&n.blobs&&(t.blobs=n.blobs.map(a=>Ea(a)?D(a):Object.assign({},a))),t}i(Bo,"copyRequest");var Yt=class{static{i(this,"Log")}provider;transactionHash;blockHash;blockNumber;removed;address;data;topics;index;transactionIndex;constructor(t,e){this.provider=e;let r=Object.freeze(t.topics.slice());v(this,{transactionHash:t.transactionHash,blockHash:t.blockHash,blockNumber:t.blockNumber,removed:t.removed,address:t.address,data:t.data,topics:r,index:t.index,transactionIndex:t.transactionIndex})}toJSON(){let{address:t,blockHash:e,blockNumber:r,data:a,index:s,removed:o,topics:l,transactionHash:u,transactionIndex:p}=this;return{_type:"log",address:t,blockHash:e,blockNumber:r,data:a,index:s,removed:o,topics:l,transactionHash:u,transactionIndex:p}}async getBlock(){let t=await this.provider.getBlock(this.blockHash);return w(!!t,"failed to find transaction","UNKNOWN_ERROR",{}),t}async getTransaction(){let t=await this.provider.getTransaction(this.transactionHash);return w(!!t,"failed to find transaction","UNKNOWN_ERROR",{}),t}async getTransactionReceipt(){let t=await this.provider.getTransactionReceipt(this.transactionHash);return w(!!t,"failed to find transaction receipt","UNKNOWN_ERROR",{}),t}removedEvent(){return Xi(this)}},Wn=class{static{i(this,"TransactionReceipt")}provider;to;from;contractAddress;hash;index;blockHash;blockNumber;logsBloom;gasUsed;blobGasUsed;cumulativeGasUsed;gasPrice;blobGasPrice;type;status;root;#t;constructor(t,e){this.#t=Object.freeze(t.logs.map(a=>new Yt(a,e)));let r=Oo;t.effectiveGasPrice!=null?r=t.effectiveGasPrice:t.gasPrice!=null&&(r=t.gasPrice),v(this,{provider:e,to:t.to,from:t.from,contractAddress:t.contractAddress,hash:t.hash,index:t.index,blockHash:t.blockHash,blockNumber:t.blockNumber,logsBloom:t.logsBloom,gasUsed:t.gasUsed,cumulativeGasUsed:t.cumulativeGasUsed,blobGasUsed:t.blobGasUsed,gasPrice:r,blobGasPrice:t.blobGasPrice,type:t.type,status:t.status,root:t.root})}get logs(){return this.#t}toJSON(){let{to:t,from:e,contractAddress:r,hash:a,index:s,blockHash:o,blockNumber:l,logsBloom:u,logs:p,status:d,root:f}=this;return{_type:"TransactionReceipt",blockHash:o,blockNumber:l,contractAddress:r,cumulativeGasUsed:ft(this.cumulativeGasUsed),from:e,gasPrice:ft(this.gasPrice),blobGasUsed:ft(this.blobGasUsed),blobGasPrice:ft(this.blobGasPrice),gasUsed:ft(this.gasUsed),hash:a,index:s,logs:p,logsBloom:u,root:f,status:d,to:t}}get length(){return this.logs.length}[Symbol.iterator](){let t=0;return{next:i(()=>t<this.length?{value:this.logs[t++],done:!1}:{value:void 0,done:!0},"next")}}get fee(){return this.gasUsed*this.gasPrice}async getBlock(){let t=await this.provider.getBlock(this.blockHash);if(t==null)throw new Error("TODO");return t}async getTransaction(){let t=await this.provider.getTransaction(this.hash);if(t==null)throw new Error("TODO");return t}async getResult(){return await this.provider.getTransactionResult(this.hash)}async confirmations(){return await this.provider.getBlockNumber()-this.blockNumber+1}removedEvent(){return Fo(this)}reorderedEvent(t){return w(!t||t.isMined(),"unmined 'other' transction cannot be orphaned","UNSUPPORTED_OPERATION",{operation:"reorderedEvent(other)"}),No(this,t)}},Kn=class n{static{i(this,"TransactionResponse")}provider;blockNumber;blockHash;index;hash;type;to;from;nonce;gasLimit;gasPrice;maxPriorityFeePerGas;maxFeePerGas;maxFeePerBlobGas;data;value;chainId;signature;accessList;blobVersionedHashes;#t;constructor(t,e){this.provider=e,this.blockNumber=t.blockNumber!=null?t.blockNumber:null,this.blockHash=t.blockHash!=null?t.blockHash:null,this.hash=t.hash,this.index=t.index,this.type=t.type,this.from=t.from,this.to=t.to||null,this.gasLimit=t.gasLimit,this.nonce=t.nonce,this.data=t.data,this.value=t.value,this.gasPrice=t.gasPrice,this.maxPriorityFeePerGas=t.maxPriorityFeePerGas!=null?t.maxPriorityFeePerGas:null,this.maxFeePerGas=t.maxFeePerGas!=null?t.maxFeePerGas:null,this.maxFeePerBlobGas=t.maxFeePerBlobGas!=null?t.maxFeePerBlobGas:null,this.chainId=t.chainId,this.signature=t.signature,this.accessList=t.accessList!=null?t.accessList:null,this.blobVersionedHashes=t.blobVersionedHashes!=null?t.blobVersionedHashes:null,this.#t=-1}toJSON(){let{blockNumber:t,blockHash:e,index:r,hash:a,type:s,to:o,from:l,nonce:u,data:p,signature:d,accessList:f,blobVersionedHashes:h}=this;return{_type:"TransactionResponse",accessList:f,blockNumber:t,blockHash:e,blobVersionedHashes:h,chainId:ft(this.chainId),data:p,from:l,gasLimit:ft(this.gasLimit),gasPrice:ft(this.gasPrice),hash:a,maxFeePerGas:ft(this.maxFeePerGas),maxPriorityFeePerGas:ft(this.maxPriorityFeePerGas),maxFeePerBlobGas:ft(this.maxFeePerBlobGas),nonce:u,signature:d,to:o,index:r,type:s,value:ft(this.value)}}async getBlock(){let t=this.blockNumber;if(t==null){let r=await this.getTransaction();r&&(t=r.blockNumber)}if(t==null)return null;let e=this.provider.getBlock(t);if(e==null)throw new Error("TODO");return e}async getTransaction(){return this.provider.getTransaction(this.hash)}async confirmations(){if(this.blockNumber==null){let{tx:e,blockNumber:r}=await Te({tx:this.getTransaction(),blockNumber:this.provider.getBlockNumber()});return e==null||e.blockNumber==null?0:r-e.blockNumber+1}return await this.provider.getBlockNumber()-this.blockNumber+1}async wait(t,e){let r=t??1,a=e??0,s=this.#t,o=-1,l=s===-1,u=i(async()=>{if(l)return null;let{blockNumber:h,nonce:C}=await Te({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(C<this.nonce){s=h;return}if(l)return null;let E=await this.getTransaction();if(!(E&&E.blockNumber!=null))for(o===-1&&(o=s-3,o<this.#t&&(o=this.#t));o<=h;){if(l)return null;let A=await this.provider.getBlock(o,!0);if(A==null)return;for(let S of A)if(S===this.hash)return;for(let S=0;S<A.length;S++){let R=await A.getTransaction(S);if(R.from===this.from&&R.nonce===this.nonce){if(l)return null;let H=await this.provider.getTransactionReceipt(R.hash);if(H==null||h-H.blockNumber+1<r)return;let M="replaced";R.data===this.data&&R.to===this.to&&R.value===this.value?M="repriced":R.data==="0x"&&R.from===R.to&&R.value===Oo&&(M="cancelled"),w(!1,"transaction was replaced","TRANSACTION_REPLACED",{cancelled:M==="replaced"||M==="cancelled",reason:M,replacement:R.replaceableTransaction(s),hash:R.hash,receipt:H})}}o++}},"checkReplacement"),p=i(h=>{if(h==null||h.status!==0)return h;w(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:h.to,from:h.from,data:""},receipt:h})},"checkReceipt"),d=await this.provider.getTransactionReceipt(this.hash);if(r===0)return p(d);if(d){if(await d.confirmations()>=r)return p(d)}else if(await u(),r===0)return null;return await new Promise((h,C)=>{let E=[],A=i(()=>{E.forEach(R=>R())},"cancel");if(E.push(()=>{l=!0}),a>0){let R=setTimeout(()=>{A(),C(Ot("wait for transaction timeout","TIMEOUT"))},a);E.push(()=>{clearTimeout(R)})}let S=i(async R=>{if(await R.confirmations()>=r){A();try{h(p(R))}catch(H){C(H)}}},"txListener");if(E.push(()=>{this.provider.off(this.hash,S)}),this.provider.on(this.hash,S),s>=0){let R=i(async()=>{try{await u()}catch(H){if(wt(H,"TRANSACTION_REPLACED")){A(),C(H);return}}l||this.provider.once("block",R)},"replaceListener");E.push(()=>{this.provider.off("block",R)}),this.provider.once("block",R)}})}isMined(){return this.blockHash!=null}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}removedEvent(){return w(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),Fo(this)}reorderedEvent(t){return w(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),w(!t||t.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),No(this,t)}replaceableTransaction(t){m(Number.isInteger(t)&&t>=0,"invalid startBlock","startBlock",t);let e=new n(this,this.provider);return e.#t=t,e}};function No(n,t){return{orphan:"reorder-transaction",tx:n,other:t}}i(No,"createReorderedTransactionFilter");function Fo(n){return{orphan:"drop-transaction",tx:n}}i(Fo,"createRemovedTransactionFilter");function Xi(n){return{orphan:"drop-log",log:{transactionHash:n.transactionHash,blockHash:n.blockHash,blockNumber:n.blockNumber,address:n.address,data:n.data,topics:Object.freeze(n.topics.slice()),index:n.index}}}i(Xi,"createRemovedLogFilter");var ce=class extends Yt{static{i(this,"EventLog")}interface;fragment;args;constructor(t,e,r){super(t,t.provider);let a=e.decodeEventLog(r,t.data,t.topics);v(this,{args:a,fragment:r,interface:e})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}},Se=class extends Yt{static{i(this,"UndecodedEventLog")}error;constructor(t,e){super(t,t.provider),v(this,{error:e})}},Xn=class extends Wn{static{i(this,"ContractTransactionReceipt")}#t;constructor(t,e,r){super(r,e),this.#t=t}get logs(){return super.logs.map(t=>{let e=t.topics.length?this.#t.getEvent(t.topics[0]):null;if(e)try{return new ce(t,this.#t,e)}catch(r){return new Se(t,r)}return t})}},le=class extends Kn{static{i(this,"ContractTransactionResponse")}#t;constructor(t,e,r){super(r,e),this.#t=t}async wait(t,e){let r=await super.wait(t,e);return r==null?null:new Xn(this.#t,this.provider,r)}},De=class extends tr{static{i(this,"ContractUnknownEventPayload")}log;constructor(t,e,r,a){super(t,e,r),v(this,{log:a})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}},pr=class extends De{static{i(this,"ContractEventPayload")}constructor(t,e,r,a,s){super(t,e,r,new ce(s,t.interface,a));let o=t.interface.decodeEventLog(a,this.log.data,this.log.topics);v(this,{args:o,fragment:a})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}};var So=BigInt(0);function _o(n){return n&&typeof n.call=="function"}i(_o,"canCall");function Lo(n){return n&&typeof n.estimateGas=="function"}i(Lo,"canEstimate");function Qn(n){return n&&typeof n.resolveName=="function"}i(Qn,"canResolve");function Ho(n){return n&&typeof n.sendTransaction=="function"}i(Ho,"canSend");function Uo(n){if(n!=null){if(Qn(n))return n;if(n.provider)return n.provider}}i(Uo,"getResolver");var Ha=class{static{i(this,"PreparedTopicFilter")}#t;fragment;constructor(t,e,r){if(v(this,{fragment:e}),e.inputs.length<r.length)throw new Error("too many arguments");let a=pe(t.runner,"resolveName"),s=Qn(a)?a:null;this.#t=async function(){let o=await Promise.all(e.inputs.map((l,u)=>r[u]==null?null:l.walkAsync(r[u],(d,f)=>d==="address"?Array.isArray(f)?Promise.all(f.map(h=>re(h,s))):re(f,s):f)));return t.interface.encodeFilterTopics(e,o)}()}getTopicFilter(){return this.#t}};function pe(n,t){return n==null?null:typeof n[t]=="function"?n:n.provider&&typeof n.provider[t]=="function"?n.provider:null}i(pe,"getRunner");function ue(n){return n==null?null:n.provider||null}i(ue,"getProvider");async function Vo(n,t){let e=J.dereference(n,"overrides");m(typeof e=="object","invalid overrides parameter","overrides",n);let r=Bo(e);return m(r.to==null||(t||[]).indexOf("to")>=0,"cannot override to","overrides.to",r.to),m(r.data==null||(t||[]).indexOf("data")>=0,"cannot override data","overrides.data",r.data),r.from&&(r.from=r.from),r}i(Vo,"copyOverrides");async function Zi(n,t,e){let r=pe(n,"resolveName"),a=Qn(r)?r:null;return await Promise.all(t.map((s,o)=>s.walkAsync(e[o],(l,u)=>(u=J.dereference(u,l),l==="address"?re(u,a):u))))}i(Zi,"resolveArgs");function Yi(n){let t=i(async function(o){let l=await Vo(o,["data"]);l.to=await n.getAddress(),l.from&&(l.from=await re(l.from,Uo(n.runner)));let u=n.interface,p=I(l.value||So,"overrides.value")===So,d=(l.data||"0x")==="0x";u.fallback&&!u.fallback.payable&&u.receive&&!d&&!p&&m(!1,"cannot send data to receive or send value to non-payable fallback","overrides",o),m(u.fallback||d,"cannot send data to receive-only contract","overrides.data",l.data);let f=u.receive||u.fallback&&u.fallback.payable;return m(f||p,"cannot send value to non-payable fallback","overrides.value",l.value),m(u.fallback||d,"cannot send data to receive-only contract","overrides.data",l.data),l},"populateTransaction"),e=i(async function(o){let l=pe(n.runner,"call");w(_o(l),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});let u=await t(o);try{return await l.call(u)}catch(p){throw Tn(p)&&p.data?n.interface.makeError(p.data,u):p}},"staticCall"),r=i(async function(o){let l=n.runner;w(Ho(l),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});let u=await l.sendTransaction(await t(o)),p=ue(n.runner);return new le(n.interface,p,u)},"send"),a=i(async function(o){let l=pe(n.runner,"estimateGas");return w(Lo(l),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await l.estimateGas(await t(o))},"estimateGas"),s=i(async o=>await r(o),"method");return v(s,{_contract:n,estimateGas:a,populateTransaction:t,send:r,staticCall:e}),s}i(Yi,"buildWrappedFallback");function Qi(n,t){let e=i(function(...p){let d=n.interface.getFunction(t,p);return w(d,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t,args:p}}),d},"getFragment"),r=i(async function(...p){let d=e(...p),f={};if(d.inputs.length+1===p.length&&(f=await Vo(p.pop()),f.from&&(f.from=await re(f.from,Uo(n.runner)))),d.inputs.length!==p.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");let h=await Zi(n.runner,d.inputs,p);return Object.assign({},f,await Te({to:n.getAddress(),data:n.interface.encodeFunctionData(d,h)}))},"populateTransaction"),a=i(async function(...p){let d=await l(...p);return d.length===1?d[0]:d},"staticCall"),s=i(async function(...p){let d=n.runner;w(Ho(d),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});let f=await d.sendTransaction(await r(...p)),h=ue(n.runner);return new le(n.interface,h,f)},"send"),o=i(async function(...p){let d=pe(n.runner,"estimateGas");return w(Lo(d),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await d.estimateGas(await r(...p))},"estimateGas"),l=i(async function(...p){let d=pe(n.runner,"call");w(_o(d),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});let f;try{f=await r(...p)}catch(E){let A=p.at(-1).blockTag;throw A&&(E.blockNumber=A),E}let h="0x";try{h=await d.call(f)}catch(E){throw Tn(E)&&E.data?n.interface.makeError(E.data,f):E}let C=e(...p);return n.interface.decodeFunctionResult(C,h)},"staticCallResult"),u=i(async(...p)=>e(...p).constant?await a(...p):await s(...p),"method");return v(u,{name:n.interface.getFunctionName(t),_contract:n,_key:t,getFragment:e,estimateGas:o,populateTransaction:r,send:s,staticCall:a,staticCallResult:l}),Object.defineProperty(u,"fragment",{configurable:!1,enumerable:!0,get:i(()=>{let p=n.interface.getFunction(t);return w(p,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t}}),p},"get")}),u}i(Qi,"buildWrappedMethod");function qi(n,t){let e=i(function(...a){let s=n.interface.getEvent(t,a);return w(s,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t,args:a}}),s},"getFragment"),r=i(function(...a){return new Ha(n,e(...a),a)},"method");return v(r,{name:n.interface.getEventName(t),_contract:n,_key:t,getFragment:e}),Object.defineProperty(r,"fragment",{configurable:!1,enumerable:!0,get:i(()=>{let a=n.interface.getEvent(t);return w(a,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t}}),a},"get")}),r}i(qi,"buildWrappedEvent");var Yn=Symbol.for("_ethersInternal_contract"),Mo=new WeakMap;function tc(n,t){Mo.set(n[Yn],t)}i(tc,"setInternal");function pt(n){return Mo.get(n[Yn])}i(pt,"getInternal");function ec(n){return n&&typeof n=="object"&&"getTopicFilter"in n&&typeof n.getTopicFilter=="function"&&n.fragment}i(ec,"isDeferred");async function Ma(n,t){let e,r=null;if(Array.isArray(t)){let s=i(function(o){if(Y(o,32))return o;let l=n.interface.getEvent(o);return m(l,"unknown fragment","name",o),l.topicHash},"topicHashify");e=t.map(o=>o==null?null:Array.isArray(o)?o.map(s):s(o))}else t==="*"?e=[null]:typeof t=="string"?Y(t,32)?e=[t]:(r=n.interface.getEvent(t),m(r,"unknown fragment","event",t),e=[r.topicHash]):ec(t)?e=await t.getTopicFilter():"fragment"in t?(r=t.fragment,e=[r.topicHash]):m(!1,"unknown event name","event",t);e=e.map(s=>{if(s==null)return null;if(Array.isArray(s)){let o=Array.from(new Set(s.map(l=>l.toLowerCase())).values());return o.length===1?o[0]:(o.sort(),o)}return s.toLowerCase()});let a=e.map(s=>s==null?"null":Array.isArray(s)?s.join("|"):s).join("&");return{fragment:r,tag:a,topics:e}}i(Ma,"getSubInfo");async function dr(n,t){let{subs:e}=pt(n);return e.get((await Ma(n,t)).tag)||null}i(dr,"hasSub");async function Do(n,t,e){let r=ue(n.runner);w(r,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:t});let{fragment:a,tag:s,topics:o}=await Ma(n,e),{addr:l,subs:u}=pt(n),p=u.get(s);if(!p){let f={address:l||n,topics:o},h=i(S=>{let R=a;if(R==null)try{R=n.interface.getEvent(S.topics[0])}catch{}if(R){let H=R,M=a?n.interface.decodeEventLog(a,S.data,S.topics):[];Va(n,e,M,Vt=>new pr(n,Vt,e,H,S))}else Va(n,e,[],H=>new De(n,H,e,S))},"listener"),C=[];p={tag:s,listeners:[],start:i(()=>{C.length||C.push(r.on(f,h))},"start"),stop:i(async()=>{if(C.length==0)return;let S=C;C=[],await Promise.all(S),r.off(f,h)},"stop")},u.set(s,p)}return p}i(Do,"getSub");var Ua=Promise.resolve();async function rc(n,t,e,r){await Ua;let a=await dr(n,t);if(!a)return!1;let s=a.listeners.length;return a.listeners=a.listeners.filter(({listener:o,once:l})=>{let u=Array.from(e);r&&u.push(r(l?null:o));try{o.call(n,...u)}catch{}return!l}),a.listeners.length===0&&(a.stop(),pt(n).subs.delete(a.tag)),s>0}i(rc,"_emit");async function Va(n,t,e,r){try{await Ua}catch{}let a=rc(n,t,e,r);return Ua=a,await a}i(Va,"emit");var Zn=["then"],de=class n{static{i(this,"BaseContract")}target;interface;runner;filters;[Yn];fallback;constructor(t,e,r,a){m(typeof t=="string"||Sn(t),"invalid value for Contract target","target",t),r==null&&(r=null);let s=Ft.from(e);v(this,{target:t,runner:r,interface:s}),Object.defineProperty(this,Yn,{value:{}});let o,l=null,u=null;if(a){let f=ue(r);u=new le(this.interface,f,a)}let p=new Map;if(typeof t=="string")if(Y(t))l=t,o=Promise.resolve(t);else{let f=pe(r,"resolveName");if(!Qn(f))throw Ot("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});o=f.resolveName(t).then(h=>{if(h==null)throw Ot("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:t});return pt(this).addr=h,h})}else o=t.getAddress().then(f=>{if(f==null)throw new Error("TODO");return pt(this).addr=f,f});tc(this,{addrPromise:o,addr:l,deployTx:u,subs:p});let d=new Proxy({},{get:i((f,h,C)=>{if(typeof h=="symbol"||Zn.indexOf(h)>=0)return Reflect.get(f,h,C);try{return this.getEvent(h)}catch(E){if(!wt(E,"INVALID_ARGUMENT")||E.argument!=="key")throw E}},"get"),has:i((f,h)=>Zn.indexOf(h)>=0?Reflect.has(f,h):Reflect.has(f,h)||this.interface.hasEvent(String(h)),"has")});return v(this,{filters:d}),v(this,{fallback:s.receive||s.fallback?Yi(this):null}),new Proxy(this,{get:i((f,h,C)=>{if(typeof h=="symbol"||h in f||Zn.indexOf(h)>=0)return Reflect.get(f,h,C);try{return f.getFunction(h)}catch(E){if(!wt(E,"INVALID_ARGUMENT")||E.argument!=="key")throw E}},"get"),has:i((f,h)=>typeof h=="symbol"||h in f||Zn.indexOf(h)>=0?Reflect.has(f,h):f.interface.hasFunction(h),"has")})}connect(t){return new n(this.target,this.interface,t)}attach(t){return new n(t,this.interface,this.runner)}async getAddress(){return await pt(this).addrPromise}async getDeployedCode(){let t=ue(this.runner);w(t,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});let e=await t.getCode(await this.getAddress());return e==="0x"?null:e}async waitForDeployment(){let t=this.deploymentTransaction();if(t)return await t.wait(),this;if(await this.getDeployedCode()!=null)return this;let r=ue(this.runner);return w(r!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((a,s)=>{let o=i(async()=>{try{if(await this.getDeployedCode()!=null)return a(this);r.once("block",o)}catch(l){s(l)}},"checkCode");o()})}deploymentTransaction(){return pt(this).deployTx}getFunction(t){return typeof t!="string"&&(t=t.format()),Qi(this,t)}getEvent(t){return typeof t!="string"&&(t=t.format()),qi(this,t)}async queryTransaction(t){throw new Error("@TODO")}async queryFilter(t,e,r){e==null&&(e=0),r==null&&(r="latest");let{addr:a,addrPromise:s}=pt(this),o=a||await s,{fragment:l,topics:u}=await Ma(this,t),p={address:o,topics:u,fromBlock:e,toBlock:r},d=ue(this.runner);return w(d,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await d.getLogs(p)).map(f=>{let h=l;if(h==null)try{h=this.interface.getEvent(f.topics[0])}catch{}if(h)try{return new ce(f,this.interface,h)}catch(C){return new Se(f,C)}return new Yt(f,d)})}async on(t,e){let r=await Do(this,"on",t);return r.listeners.push({listener:e,once:!1}),r.start(),this}async once(t,e){let r=await Do(this,"once",t);return r.listeners.push({listener:e,once:!0}),r.start(),this}async emit(t,...e){return await Va(this,t,e,null)}async listenerCount(t){if(t){let a=await dr(this,t);return a?a.listeners.length:0}let{subs:e}=pt(this),r=0;for(let{listeners:a}of e.values())r+=a.length;return r}async listeners(t){if(t){let a=await dr(this,t);return a?a.listeners.map(({listener:s})=>s):[]}let{subs:e}=pt(this),r=[];for(let{listeners:a}of e.values())r=r.concat(a.map(({listener:s})=>s));return r}async off(t,e){let r=await dr(this,t);if(!r)return this;if(e){let a=r.listeners.map(({listener:s})=>s).indexOf(e);a>=0&&r.listeners.splice(a,1)}return(e==null||r.listeners.length===0)&&(r.stop(),pt(this).subs.delete(r.tag)),this}async removeAllListeners(t){if(t){let e=await dr(this,t);if(!e)return this;e.stop(),pt(this).subs.delete(e.tag)}else{let{subs:e}=pt(this);for(let{tag:r,stop:a}of e.values())a(),e.delete(r)}return this}async addListener(t,e){return await this.on(t,e)}async removeListener(t,e){return await this.off(t,e)}static buildClass(t){class e extends n{static{i(this,"CustomContract")}constructor(a,s=null){super(a,t,s)}}return e}static from(t,e,r){return r==null&&(r=null),new this(t,e,r)}};function nc(){return de}i(nc,"_ContractBase");var _e=class extends nc(){static{i(this,"Contract")}};var Go=BigInt(0);function B(n,t){return function(e){return e==null?t:n(e)}}i(B,"allowNull");function Le(n,t){return e=>{if(t&&e==null)return null;if(!Array.isArray(e))throw new Error("not an array");return e.map(r=>n(r))}}i(Le,"arrayOf");function fe(n,t){return e=>{let r={};for(let a in n){let s=a;if(t&&a in t&&!(s in e)){for(let o of t[a])if(o in e){s=o;break}}try{let o=n[a](e[s]);o!==void 0&&(r[a]=o)}catch(o){let l=o instanceof Error?o.message:"not-an-error";w(!1,`invalid value for value.${a} (${l})`,"BAD_DATA",{value:e})}}return r}}i(fe,"object");function ac(n){switch(n){case!0:case"true":return!0;case!1:case"false":return!1}m(!1,`invalid boolean; ${JSON.stringify(n)}`,"value",n)}i(ac,"formatBoolean");function Qt(n){return m(Y(n,!0),"invalid data","value",n),n}i(Qt,"formatData");function tt(n){return m(Y(n,32),"invalid hash","value",n),n}i(tt,"formatHash");var sc=fe({address:$,blockHash:tt,blockNumber:_,data:Qt,index:_,removed:B(ac,!1),topics:Le(tt),transactionHash:tt,transactionIndex:_},{index:["logIndex"]});function $o(n){return sc(n)}i($o,"formatLog");var oc=fe({hash:B(tt),parentHash:tt,parentBeaconBlockRoot:B(tt,null),number:_,timestamp:_,nonce:B(Qt),difficulty:I,gasLimit:I,gasUsed:I,stateRoot:B(tt,null),receiptsRoot:B(tt,null),blobGasUsed:B(I,null),excessBlobGas:B(I,null),miner:B($),prevRandao:B(tt,null),extraData:Qt,baseFeePerGas:B(I)},{prevRandao:["mixHash"]});function jo(n){let t=oc(n);return t.transactions=n.transactions.map(e=>typeof e=="string"?e:$a(e)),t}i(jo,"formatBlock");var ic=fe({transactionIndex:_,blockNumber:_,transactionHash:tt,address:$,topics:Le(tt),data:Qt,index:_,blockHash:tt},{index:["logIndex"]});function Ga(n){return ic(n)}i(Ga,"formatReceiptLog");var Bd=fe({to:B($,null),from:B($,null),contractAddress:B($,null),index:_,root:B(D),gasUsed:I,blobGasUsed:B(I,null),logsBloom:B(Qt),blockHash:tt,hash:tt,logs:Le(Ga),blockNumber:_,cumulativeGasUsed:I,effectiveGasPrice:B(I),blobGasPrice:B(I,null),status:B(_),type:B(_,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function $a(n){n.to&&I(n.to)===Go&&(n.to="0x0000000000000000000000000000000000000000");let t=fe({hash:tt,index:B(_,void 0),type:i(e=>e==="0x"||e==null?0:_(e),"type"),accessList:B(sr,null),blobVersionedHashes:B(Le(tt,!0),null),blockHash:B(tt,null),blockNumber:B(_,null),transactionIndex:B(_,null),from:$,gasPrice:B(I),maxPriorityFeePerGas:B(I),maxFeePerGas:B(I),maxFeePerBlobGas:B(I,null),gasLimit:I,to:B($,null),value:I,nonce:_,data:Qt,creates:B($,null),chainId:B(I,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(n);if(t.to==null&&t.creates==null&&(t.creates=Oa(t)),(n.type===1||n.type===2)&&n.accessList==null&&(t.accessList=[]),n.signature?t.signature=Oe.from(n.signature):t.signature=Oe.from(n),t.chainId==null){let e=t.signature.legacyChainId;e!=null&&(t.chainId=e)}return t.blockHash&&I(t.blockHash)===Go&&(t.blockHash=null),t}i($a,"formatTransactionResponse");var fr=class extends Error{static{i(this,"SimpleEthersError")}e;constructor(t,e,r){super(t),this.stack=r}toString(){return this.message+`
3
3
  `+this.stack?.toString()}};function U(n,t,e){if(n instanceof fr)return n;let r="Check here for possible cause and fix: https://docs.sentio.xyz/docs/handling-errors#ethers-error",a="",s=n;return s.code==="CALL_EXCEPTION"||s.code==="BAD_DATA"?s.data==="0x"?(t?a=`jsonrpc eth_call return '0x' (likely contract not existed) at chain ${t.chainId}, ${r}:
4
4
  ${n.message}`:a=`jsonrpc eth_call return '0x' (likely contract not existed), ${r}:
5
5
  ${n.message}`,new fr(a,s,e)):new fr(`eth call error ${s.message}, ${r}:
@@ -29,4 +29,4 @@ js-sha3/src/sha3.js:
29
29
  @noble/hashes/esm/utils.js:
30
30
  (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
31
31
  */
32
- //# sourceMappingURL=chunk-QLPYMSRX.js.map
32
+ //# sourceMappingURL=chunk-ETUGBNCT.js.map