@magic-ext/web3modal-ethers5 4.0.0 → 4.0.1-canary.9adf27d.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/extension.js CHANGED
@@ -9975,5 +9975,5 @@ function print() { __p += __j.call(arguments, '') }
9975
9975
  }`;var Br=Aj(function(){return Ti(re,$t+"return "+$e).apply(r,he)});if(Br.source=$e,HC(Br))throw Br;return Br}function axe(l){return Oi(l).toLowerCase()}function cxe(l){return Oi(l).toUpperCase()}function lxe(l,p,S){if(l=Oi(l),l&&(S||p===r))return OU(l);if(!l||!(p=Ea(p)))return l;var N=fl(l),H=fl(p),re=MU(N,H),he=DU(N,H)+1;return Oh(N,re,he).join("")}function uxe(l,p,S){if(l=Oi(l),l&&(S||p===r))return l.slice(0,BU(l)+1);if(!l||!(p=Ea(p)))return l;var N=fl(l),H=DU(N,fl(p))+1;return Oh(N,0,H).join("")}function fxe(l,p,S){if(l=Oi(l),l&&(S||p===r))return l.replace(Xe,"");if(!l||!(p=Ea(p)))return l;var N=fl(l),H=MU(N,fl(p));return Oh(N,H).join("")}function hxe(l,p){var S=V,N=M;if(dn(p)){var H="separator"in p?p.separator:H;S="length"in p?Mr(p.length):S,N="omission"in p?Ea(p.omission):N}l=Oi(l);var re=l.length;if(ig(l)){var he=fl(l);re=he.length}if(S>=re)return l;var ge=S-ng(N);if(ge<1)return N;var be=he?Oh(he,0,ge).join(""):l.slice(0,ge);if(H===r)return be+N;if(he&&(ge+=be.length-ge),zC(H)){if(l.slice(ge).search(H)){var Oe,Me=be;for(H.global||(H=aC(H.source,Oi(rt.exec(H))+"g")),H.lastIndex=0;Oe=H.exec(Me);)var $e=Oe.index;be=be.slice(0,$e===r?ge:$e)}}else if(l.indexOf(Ea(H),ge)!=ge){var gt=be.lastIndexOf(H);gt>-1&&(be=be.slice(0,gt))}return be+N}function dxe(l){return l=Oi(l),l&&Pt.test(l)?l.replace(et,Wwe):l}var pxe=fg(function(l,p,S){return l+(S?" ":"")+p.toUpperCase()}),GC=CF("toUpperCase");function Ej(l,p,S){return l=Oi(l),p=S?r:p,p===r?Bwe(l)?zwe(l):Twe(l):l.match(p)||[]}var Aj=Wr(function(l,p){try{return xa(l,r,p)}catch(S){return HC(S)?S:new br(S)}}),mxe=Gf(function(l,p){return uc(p,function(S){S=iu(S),Vf(l,S,WC(l[S],l))}),l});function gxe(l){var p=l==null?0:l.length,S=Qt();return l=p?nn(l,function(N){if(typeof N[1]!="function")throw new fc(s);return[S(N[0]),N[1]]}):[],Wr(function(N){for(var H=-1;++H<p;){var re=l[H];if(xa(re[0],this,N))return xa(re[1],this,N)}})}function wxe(l){return W3e(dc(l,b))}function ZC(l){return function(){return l}}function vxe(l,p){return l==null||l!==l?p:l}var bxe=IF(),yxe=IF(!0);function Zs(l){return l}function YC(l){return iF(typeof l=="function"?l:dc(l,b))}function xxe(l){return oF(dc(l,b))}function _xe(l,p){return sF(l,dc(p,b))}var Exe=Wr(function(l,p){return function(S){return rv(S,l,p)}}),Axe=Wr(function(l,p){return function(S){return rv(l,S,p)}});function JC(l,p,S){var N=uo(p),H=zx(p,N);S==null&&!(dn(p)&&(H.length||!N.length))&&(S=p,p=l,l=this,H=zx(p,uo(p)));var re=!(dn(S)&&"chain"in S)||!!S.chain,he=Yf(l);return uc(H,function(ge){var be=p[ge];l[ge]=be,he&&(l.prototype[ge]=function(){var Oe=this.__chain__;if(re||Oe){var Me=l(this.__wrapped__),$e=Me.__actions__=Vs(this.__actions__);return $e.push({func:be,args:arguments,thisArg:l}),Me.__chain__=Oe,Me}return be.apply(l,Ih([this.value()],arguments))})}),l}function Cxe(){return Po._===this&&(Po._=Jwe),this}function QC(){}function Sxe(l){return l=Mr(l),Wr(function(p){return aF(p,l)})}var Ixe=RC(nn),Txe=RC(TU),Rxe=RC(eC);function Cj(l){return LC(l)?tC(iu(l)):ove(l)}function kxe(l){return function(p){return l==null?r:Ap(l,p)}}var Nxe=RF(),Pxe=RF(!0);function XC(){return[]}function eS(){return!1}function Oxe(){return{}}function Mxe(){return""}function Dxe(){return!0}function Lxe(l,p){if(l=Mr(l),l<1||l>C)return[];var S=d,N=Yo(l,d);p=Qt(p),l-=d;for(var H=nC(N,p);++S<l;)p(S);return H}function Bxe(l){return Ar(l)?nn(l,iu):Aa(l)?[l]:Vs(zF(Oi(l)))}function Uxe(l){var p=++Zwe;return Oi(l)+p}var Fxe=Jx(function(l,p){return l+p},0),jxe=kC("ceil"),$xe=Jx(function(l,p){return l/p},1),Wxe=kC("floor");function qxe(l){return l&&l.length?Hx(l,Zs,mC):r}function Hxe(l,p){return l&&l.length?Hx(l,Qt(p,2),mC):r}function zxe(l){return NU(l,Zs)}function Vxe(l,p){return NU(l,Qt(p,2))}function Kxe(l){return l&&l.length?Hx(l,Zs,bC):r}function Gxe(l,p){return l&&l.length?Hx(l,Qt(p,2),bC):r}var Zxe=Jx(function(l,p){return l*p},1),Yxe=kC("round"),Jxe=Jx(function(l,p){return l-p},0);function Qxe(l){return l&&l.length?iC(l,Zs):0}function Xxe(l,p){return l&&l.length?iC(l,Qt(p,2)):0}return Y.after=xye,Y.ary=rj,Y.assign=c5e,Y.assignIn=gj,Y.assignInWith=u4,Y.assignWith=l5e,Y.at=u5e,Y.before=ij,Y.bind=WC,Y.bindAll=mxe,Y.bindKey=nj,Y.castArray=Oye,Y.chain=XF,Y.chunk=Wve,Y.compact=qve,Y.concat=Hve,Y.cond=gxe,Y.conforms=wxe,Y.constant=ZC,Y.countBy=Qbe,Y.create=f5e,Y.curry=oj,Y.curryRight=sj,Y.debounce=aj,Y.defaults=h5e,Y.defaultsDeep=d5e,Y.defer=_ye,Y.delay=Eye,Y.difference=zve,Y.differenceBy=Vve,Y.differenceWith=Kve,Y.drop=Gve,Y.dropRight=Zve,Y.dropRightWhile=Yve,Y.dropWhile=Jve,Y.fill=Qve,Y.filter=eye,Y.flatMap=iye,Y.flatMapDeep=nye,Y.flatMapDepth=oye,Y.flatten=ZF,Y.flattenDeep=Xve,Y.flattenDepth=ebe,Y.flip=Aye,Y.flow=bxe,Y.flowRight=yxe,Y.fromPairs=tbe,Y.functions=y5e,Y.functionsIn=x5e,Y.groupBy=sye,Y.initial=ibe,Y.intersection=nbe,Y.intersectionBy=obe,Y.intersectionWith=sbe,Y.invert=E5e,Y.invertBy=A5e,Y.invokeMap=cye,Y.iteratee=YC,Y.keyBy=lye,Y.keys=uo,Y.keysIn=Gs,Y.map=n4,Y.mapKeys=S5e,Y.mapValues=I5e,Y.matches=xxe,Y.matchesProperty=_xe,Y.memoize=s4,Y.merge=T5e,Y.mergeWith=wj,Y.method=Exe,Y.methodOf=Axe,Y.mixin=JC,Y.negate=a4,Y.nthArg=Sxe,Y.omit=R5e,Y.omitBy=k5e,Y.once=Cye,Y.orderBy=uye,Y.over=Ixe,Y.overArgs=Sye,Y.overEvery=Txe,Y.overSome=Rxe,Y.partial=qC,Y.partialRight=cj,Y.partition=fye,Y.pick=N5e,Y.pickBy=vj,Y.property=Cj,Y.propertyOf=kxe,Y.pull=ube,Y.pullAll=JF,Y.pullAllBy=fbe,Y.pullAllWith=hbe,Y.pullAt=dbe,Y.range=Nxe,Y.rangeRight=Pxe,Y.rearg=Iye,Y.reject=pye,Y.remove=pbe,Y.rest=Tye,Y.reverse=jC,Y.sampleSize=gye,Y.set=O5e,Y.setWith=M5e,Y.shuffle=wye,Y.slice=mbe,Y.sortBy=yye,Y.sortedUniq=_be,Y.sortedUniqBy=Ebe,Y.split=ixe,Y.spread=Rye,Y.tail=Abe,Y.take=Cbe,Y.takeRight=Sbe,Y.takeRightWhile=Ibe,Y.takeWhile=Tbe,Y.tap=qbe,Y.throttle=kye,Y.thru=i4,Y.toArray=dj,Y.toPairs=bj,Y.toPairsIn=yj,Y.toPath=Bxe,Y.toPlainObject=mj,Y.transform=D5e,Y.unary=Nye,Y.union=Rbe,Y.unionBy=kbe,Y.unionWith=Nbe,Y.uniq=Pbe,Y.uniqBy=Obe,Y.uniqWith=Mbe,Y.unset=L5e,Y.unzip=$C,Y.unzipWith=QF,Y.update=B5e,Y.updateWith=U5e,Y.values=pg,Y.valuesIn=F5e,Y.without=Dbe,Y.words=Ej,Y.wrap=Pye,Y.xor=Lbe,Y.xorBy=Bbe,Y.xorWith=Ube,Y.zip=Fbe,Y.zipObject=jbe,Y.zipObjectDeep=$be,Y.zipWith=Wbe,Y.entries=bj,Y.entriesIn=yj,Y.extend=gj,Y.extendWith=u4,JC(Y,Y),Y.add=Fxe,Y.attempt=Aj,Y.camelCase=q5e,Y.capitalize=xj,Y.ceil=jxe,Y.clamp=j5e,Y.clone=Mye,Y.cloneDeep=Lye,Y.cloneDeepWith=Bye,Y.cloneWith=Dye,Y.conformsTo=Uye,Y.deburr=_j,Y.defaultTo=vxe,Y.divide=$xe,Y.endsWith=H5e,Y.eq=dl,Y.escape=z5e,Y.escapeRegExp=V5e,Y.every=Xbe,Y.find=tye,Y.findIndex=KF,Y.findKey=p5e,Y.findLast=rye,Y.findLastIndex=GF,Y.findLastKey=m5e,Y.floor=Wxe,Y.forEach=ej,Y.forEachRight=tj,Y.forIn=g5e,Y.forInRight=w5e,Y.forOwn=v5e,Y.forOwnRight=b5e,Y.get=VC,Y.gt=Fye,Y.gte=jye,Y.has=_5e,Y.hasIn=KC,Y.head=YF,Y.identity=Zs,Y.includes=aye,Y.indexOf=rbe,Y.inRange=$5e,Y.invoke=C5e,Y.isArguments=Ip,Y.isArray=Ar,Y.isArrayBuffer=$ye,Y.isArrayLike=Ks,Y.isArrayLikeObject=On,Y.isBoolean=Wye,Y.isBuffer=Mh,Y.isDate=qye,Y.isElement=Hye,Y.isEmpty=zye,Y.isEqual=Vye,Y.isEqualWith=Kye,Y.isError=HC,Y.isFinite=Gye,Y.isFunction=Yf,Y.isInteger=lj,Y.isLength=c4,Y.isMap=uj,Y.isMatch=Zye,Y.isMatchWith=Yye,Y.isNaN=Jye,Y.isNative=Qye,Y.isNil=e5e,Y.isNull=Xye,Y.isNumber=fj,Y.isObject=dn,Y.isObjectLike=An,Y.isPlainObject=cv,Y.isRegExp=zC,Y.isSafeInteger=t5e,Y.isSet=hj,Y.isString=l4,Y.isSymbol=Aa,Y.isTypedArray=dg,Y.isUndefined=r5e,Y.isWeakMap=i5e,Y.isWeakSet=n5e,Y.join=abe,Y.kebabCase=K5e,Y.last=mc,Y.lastIndexOf=cbe,Y.lowerCase=G5e,Y.lowerFirst=Z5e,Y.lt=o5e,Y.lte=s5e,Y.max=qxe,Y.maxBy=Hxe,Y.mean=zxe,Y.meanBy=Vxe,Y.min=Kxe,Y.minBy=Gxe,Y.stubArray=XC,Y.stubFalse=eS,Y.stubObject=Oxe,Y.stubString=Mxe,Y.stubTrue=Dxe,Y.multiply=Zxe,Y.nth=lbe,Y.noConflict=Cxe,Y.noop=QC,Y.now=o4,Y.pad=Y5e,Y.padEnd=J5e,Y.padStart=Q5e,Y.parseInt=X5e,Y.random=W5e,Y.reduce=hye,Y.reduceRight=dye,Y.repeat=exe,Y.replace=txe,Y.result=P5e,Y.round=Yxe,Y.runInContext=ve,Y.sample=mye,Y.size=vye,Y.snakeCase=rxe,Y.some=bye,Y.sortedIndex=gbe,Y.sortedIndexBy=wbe,Y.sortedIndexOf=vbe,Y.sortedLastIndex=bbe,Y.sortedLastIndexBy=ybe,Y.sortedLastIndexOf=xbe,Y.startCase=nxe,Y.startsWith=oxe,Y.subtract=Jxe,Y.sum=Qxe,Y.sumBy=Xxe,Y.template=sxe,Y.times=Lxe,Y.toFinite=Jf,Y.toInteger=Mr,Y.toLength=pj,Y.toLower=axe,Y.toNumber=gc,Y.toSafeInteger=a5e,Y.toString=Oi,Y.toUpper=cxe,Y.trim=lxe,Y.trimEnd=uxe,Y.trimStart=fxe,Y.truncate=hxe,Y.unescape=dxe,Y.uniqueId=Uxe,Y.upperCase=pxe,Y.upperFirst=GC,Y.each=ej,Y.eachRight=tj,Y.first=YF,JC(Y,function(){var l={};return tu(Y,function(p,S){Fi.call(Y.prototype,S)||(l[S]=p)}),l}(),{chain:!1}),Y.VERSION=i,uc(["bind","bindKey","curry","curryRight","partial","partialRight"],function(l){Y[l].placeholder=Y}),uc(["drop","take"],function(l,p){Xr.prototype[l]=function(S){S=S===r?1:Qn(Mr(S),0);var N=this.__filtered__&&!p?new Xr(this):this.clone();return N.__filtered__?N.__takeCount__=Yo(S,N.__takeCount__):N.__views__.push({size:Yo(S,d),type:l+(N.__dir__<0?"Right":"")}),N},Xr.prototype[l+"Right"]=function(S){return this.reverse()[l](S).reverse()}}),uc(["filter","map","takeWhile"],function(l,p){var S=p+1,N=S==f||S==y;Xr.prototype[l]=function(H){var re=this.clone();return re.__iteratees__.push({iteratee:Qt(H,3),type:S}),re.__filtered__=re.__filtered__||N,re}}),uc(["head","last"],function(l,p){var S="take"+(p?"Right":"");Xr.prototype[l]=function(){return this[S](1).value()[0]}}),uc(["initial","tail"],function(l,p){var S="drop"+(p?"":"Right");Xr.prototype[l]=function(){return this.__filtered__?new Xr(this):this[S](1)}}),Xr.prototype.compact=function(){return this.filter(Zs)},Xr.prototype.find=function(l){return this.filter(l).head()},Xr.prototype.findLast=function(l){return this.reverse().find(l)},Xr.prototype.invokeMap=Wr(function(l,p){return typeof l=="function"?new Xr(this):this.map(function(S){return rv(S,l,p)})}),Xr.prototype.reject=function(l){return this.filter(a4(Qt(l)))},Xr.prototype.slice=function(l,p){l=Mr(l);var S=this;return S.__filtered__&&(l>0||p<0)?new Xr(S):(l<0?S=S.takeRight(-l):l&&(S=S.drop(l)),p!==r&&(p=Mr(p),S=p<0?S.dropRight(-p):S.take(p-l)),S)},Xr.prototype.takeRightWhile=function(l){return this.reverse().takeWhile(l).reverse()},Xr.prototype.toArray=function(){return this.take(d)},tu(Xr.prototype,function(l,p){var S=/^(?:filter|find|map|reject)|While$/.test(p),N=/^(?:head|last)$/.test(p),H=Y[N?"take"+(p=="last"?"Right":""):p],re=N||/^find/.test(p);H&&(Y.prototype[p]=function(){var he=this.__wrapped__,ge=N?[1]:arguments,be=he instanceof Xr,Oe=ge[0],Me=be||Ar(he),$e=function(Yr){var ai=H.apply(Y,Ih([Yr],ge));return N&&gt?ai[0]:ai};Me&&S&&typeof Oe=="function"&&Oe.length!=1&&(be=Me=!1);var gt=this.__chain__,$t=!!this.__actions__.length,tr=re&&!gt,Br=be&&!$t;if(!re&&Me){he=Br?he:new Xr(this);var rr=l.apply(he,ge);return rr.__actions__.push({func:i4,args:[$e],thisArg:r}),new hc(rr,gt)}return tr&&Br?l.apply(this,ge):(rr=this.thru($e),tr?N?rr.value()[0]:rr.value():rr)})}),uc(["pop","push","shift","sort","splice","unshift"],function(l){var p=Rx[l],S=/^(?:push|sort|unshift)$/.test(l)?"tap":"thru",N=/^(?:pop|shift)$/.test(l);Y.prototype[l]=function(){var H=arguments;if(N&&!this.__chain__){var re=this.value();return p.apply(Ar(re)?re:[],H)}return this[S](function(he){return p.apply(Ar(he)?he:[],H)})}}),tu(Xr.prototype,function(l,p){var S=Y[p];if(S){var N=S.name+"";Fi.call(cg,N)||(cg[N]=[]),cg[N].push({name:p,func:S})}}),cg[Yx(r,j).name]=[{name:"wrapper",func:r}],Xr.prototype.clone=d3e,Xr.prototype.reverse=p3e,Xr.prototype.value=m3e,Y.prototype.at=Hbe,Y.prototype.chain=zbe,Y.prototype.commit=Vbe,Y.prototype.next=Kbe,Y.prototype.plant=Zbe,Y.prototype.reverse=Ybe,Y.prototype.toJSON=Y.prototype.valueOf=Y.prototype.value=Jbe,Y.prototype.first=Y.prototype.head,Z3&&(Y.prototype[Z3]=Gbe),Y},og=Vwe();bp?((bp.exports=og)._=og,YA._=og):Po._=og}).call(Py)})(eO,eO.exports);var zUe=Object.defineProperty,VUe=Object.defineProperties,KUe=Object.getOwnPropertyDescriptors,Jae=Object.getOwnPropertySymbols,GUe=Object.prototype.hasOwnProperty,ZUe=Object.prototype.propertyIsEnumerable,Qae=(t,e,r)=>e in t?zUe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,T9=(t,e)=>{for(var r in e||(e={}))GUe.call(e,r)&&Qae(t,r,e[r]);if(Jae)for(var r of Jae(e))ZUe.call(e,r)&&Qae(t,r,e[r]);return t},YUe=(t,e)=>VUe(t,KUe(e));function zd(t,e,r){var i;let n=X2(t);return((i=e.rpcMap)==null?void 0:i[n.reference])||`${HUe}?chainId=${n.namespace}:${n.reference}&projectId=${r}`}function fm(t){return t.includes(":")?t.split(":")[1]:t}function nce(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function JUe(t,e){let r=Object.keys(e.namespaces).filter(n=>n.includes(t));if(!r.length)return[];let i=[];return r.forEach(n=>{let o=e.namespaces[n].accounts;i.push(...o)}),i}function YP(t={},e={}){let r=Xae(t),i=Xae(e);return eO.exports.merge(r,i)}function Xae(t){var e,r,i,n;let o={};if(!X1(t))return o;for(let[s,a]of Object.entries(t)){let c=N7(s)?[s]:a.chains,h=a.methods||[],g=a.events||[],b=a.rpcMap||{},E=lw(s);o[E]=YUe(T9(T9({},o[E]),a),{chains:sy(c,(e=o[E])==null?void 0:e.chains),methods:sy(h,(r=o[E])==null?void 0:r.methods),events:sy(g,(i=o[E])==null?void 0:i.events),rpcMap:T9(T9({},b),(n=o[E])==null?void 0:n.rpcMap)})}return o}function QUe(t){return t.includes(":")?t.split(":")[2]:t}function ece(t){let e={};for(let[r,i]of Object.entries(t)){let n=i.methods||[],o=i.events||[],s=i.accounts||[],a=N7(r)?[r]:i.chains?i.chains:nce(i.accounts);e[r]={chains:a,methods:n,events:o,accounts:s}}return e}function JP(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}var oce={},un=t=>oce[t],QP=(t,e)=>{oce[t]=e},tO=class{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=un("events"),this.client=un("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Z0.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){let e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(r=>{var i;let n=fm(r);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[r])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){let i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProvider(e,r){let i=r||zd(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ya(new Vc(i,un("disableProviderPing")))}},rO=class{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=un("events"),this.client=un("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r),this.chainId=parseInt(e),this.events.emit(Z0.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,r){let i=r||zd(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ya(new Vc(i,un("disableProviderPing")))}setHttpProvider(e,r){let i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProviders(){let e={};return this.namespace.chains.forEach(r=>{var i;let n=parseInt(fm(r));e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[r])}),e}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){let e=this.chainId,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}async handleSwitchChain(e){var r,i;let n=e.request.params?(r=e.request.params[0])==null?void 0:r.chainId:"0x0";n=n.startsWith("0x")?n:`0x${n}`;let o=parseInt(n,16);if(this.isChainApproved(o))this.setDefaultChain(`${o}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:n}]},chainId:(i=this.namespace.chains)==null?void 0:i[0]}),this.setDefaultChain(`${o}`);else throw new Error(`Failed to switch to chain 'eip155:${o}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}},iO=class{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=un("events"),this.client=un("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Z0.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(r=>{var i;let n=fm(r);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[r])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){let i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProvider(e,r){let i=r||zd(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ya(new Vc(i,un("disableProviderPing")))}},nO=class{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=un("events"),this.client=un("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Z0.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(r=>{var i;let n=fm(r);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[r])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){let i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProvider(e,r){let i=r||zd(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ya(new Vc(i,un("disableProviderPing")))}},oO=class{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=un("events"),this.client=un("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Z0.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(r=>{let i=this.getCardanoRPCUrl(r),n=fm(r);e[n]=this.createHttpProvider(n,i)}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}getCardanoRPCUrl(e){let r=this.namespace.rpcMap;if(r)return r[e]}setHttpProvider(e,r){let i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProvider(e,r){let i=r||this.getCardanoRPCUrl(e);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ya(new Vc(i,un("disableProviderPing")))}},sO=class{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=un("events"),this.client=un("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Z0.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(r=>{var i;let n=fm(r);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[r])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){let i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProvider(e,r){let i=r||zd(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ya(new Vc(i,un("disableProviderPing")))}},aO=class{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=un("events"),this.client=un("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Z0.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(r=>{var i;let n=fm(r);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[r])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){let i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProvider(e,r){let i=r||zd(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ya(new Vc(i,un("disableProviderPing")))}},cO=class{constructor(e){this.name="near",this.namespace=e.namespace,this.events=un("events"),this.client=un("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){let i=r||zd(`${this.name}:${e}`,this.namespace);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.events.emit(Z0.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){let e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(r=>{var i;e[r]=this.createHttpProvider(r,(i=this.namespace.rpcMap)==null?void 0:i[r])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){let i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProvider(e,r){let i=r||zd(e,this.namespace);return typeof i>"u"?void 0:new Ya(new Vc(i,un("disableProviderPing")))}},XUe=Object.defineProperty,eFe=Object.defineProperties,tFe=Object.getOwnPropertyDescriptors,tce=Object.getOwnPropertySymbols,rFe=Object.prototype.hasOwnProperty,iFe=Object.prototype.propertyIsEnumerable,rce=(t,e,r)=>e in t?XUe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,R9=(t,e)=>{for(var r in e||(e={}))rFe.call(e,r)&&rce(t,r,e[r]);if(tce)for(var r of tce(e))iFe.call(e,r)&&rce(t,r,e[r]);return t},XP=(t,e)=>eFe(t,tFe(e)),lO=class t{constructor(e){this.events=new ice.default,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:(0,Yp.default)(Kh({level:e?.logger||Zae})),this.disableProviderPing=e?.disableProviderPing||!1}static async init(e){let r=new t(e);return await r.initialize(),r}async request(e,r,i){let[n,o]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(n).request({request:R9({},e),chainId:`${n}:${o}`,topic:this.session.topic,expiry:i})}sendAsync(e,r,i,n){let o=new Date().getTime();this.request(e,i,n).then(s=>r(null,Fd(o,s))).catch(s=>r(s,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:gi("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();let{uri:r,response:i}=await this.client.authenticate(e);r&&(this.uri=r,this.events.emit("display_uri",r));let n=await i();if(this.session=n.session,this.session){let o=ece(this.session.namespaces);this.namespaces=YP(this.namespaces,o),this.persist("namespaces",this.namespaces),this.onConnect()}return n}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");let{uri:i,approval:n}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});i&&(this.uri=i,this.events.emit("display_uri",i)),await n().then(o=>{this.session=o;let s=ece(o.namespaces);this.namespaces=YP(this.namespaces,s),this.persist("namespaces",this.namespaces)}).catch(o=>{if(o.message!==GP)throw o;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;let[i,n]=this.validateChain(e);this.getProvider(i).setDefaultChain(n,r)}catch(i){if(!/Please call connect/.test(i.message))throw i}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");let r=this.client.pairing.getAll();if(Ga(r)){for(let i of r)e.deletePairings?this.client.core.expirer.set(i.topic,0):await this.client.core.relayer.subscriber.unsubscribe(i.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){let e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await E9.init({logger:this.providerOpts.logger||Zae,relayUrl:this.providerOpts.relayUrl||$Ue,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");let e=[...new Set(Object.keys(this.session.namespaces).map(r=>lw(r)))];QP("client",this.client),QP("events",this.events),QP("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;let i=JUe(r,this.session),n=nce(i),o=YP(this.namespaces,this.optionalNamespaces),s=XP(R9({},o[r]),{accounts:i,chains:n});switch(r){case"eip155":this.rpcProviders[r]=new rO({namespace:s});break;case"solana":this.rpcProviders[r]=new iO({namespace:s});break;case"cosmos":this.rpcProviders[r]=new nO({namespace:s});break;case"polkadot":this.rpcProviders[r]=new tO({namespace:s});break;case"cip34":this.rpcProviders[r]=new oO({namespace:s});break;case"elrond":this.rpcProviders[r]=new sO({namespace:s});break;case"multiversx":this.rpcProviders[r]=new aO({namespace:s});break;case"near":this.rpcProviders[r]=new cO({namespace:s});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{let{params:r}=e,{event:i}=r;if(i.name==="accountsChanged"){let n=i.data;n&&Ga(n)&&this.events.emit("accountsChanged",n.map(QUe))}else if(i.name==="chainChanged"){let n=r.chainId,o=r.event.data,s=lw(n),a=JP(n)!==JP(o)?`${s}:${JP(o)}`:n;this.onChainChanged(a)}else this.events.emit(i.name,i.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var i;let{namespaces:n}=r,o=(i=this.client)==null?void 0:i.session.get(e);this.session=XP(R9({},o),{namespaces:n}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",XP(R9({},gi("USER_DISCONNECTED")),{data:e.topic}))}),this.on(Z0.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){if(!this.rpcProviders[e])throw new Error(`Provider not found: ${e}`);return this.rpcProviders[e]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){let{namespaces:r,optionalNamespaces:i,sessionProperties:n}=e;r&&Object.keys(r).length&&(this.namespaces=r),i&&Object.keys(i).length&&(this.optionalNamespaces=i),this.sessionProperties=n,this.persist("namespaces",r),this.persist("optionalNamespaces",i)}validateChain(e){let[r,i]=e?.split(":")||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,i];if(r&&!Object.keys(this.namespaces||{}).map(s=>lw(s)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&i)return[r,i];let n=lw(Object.keys(this.namespaces)[0]),o=this.rpcProviders[n].getDefaultChain();return[n,o]}async requestAccounts(){let[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,r=!1){if(!this.namespaces)return;let[i,n]=this.validateChain(e);n&&(r||this.getProvider(i).setDefaultChain(n),this.namespaces[i]?this.namespaces[i].defaultChain=n:this.namespaces[`${i}:${n}`]?this.namespaces[`${i}:${n}`].defaultChain=n:this.namespaces[`${i}:${n}`]={defaultChain:n},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",n))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,r){this.client.core.storage.setItem(`${Yae}/${e}`,r)}async getFromStore(e){return await this.client.core.storage.getItem(`${Yae}/${e}`)}},sce=lO;var nWe="wc",oWe="ethereum_provider",sWe=`${nWe}@2:${oWe}:`,aWe="https://rpc.walletconnect.com/v1/",kM=["eth_sendTransaction","personal_sign"],PM=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],NM=["chainChanged","accountsChanged"],cWe=["chainChanged","accountsChanged","message","disconnect","connect"],lWe=Object.defineProperty,uWe=Object.defineProperties,fWe=Object.getOwnPropertyDescriptors,aue=Object.getOwnPropertySymbols,hWe=Object.prototype.hasOwnProperty,dWe=Object.prototype.propertyIsEnumerable,cue=(t,e,r)=>e in t?lWe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Pw=(t,e)=>{for(var r in e||(e={}))hWe.call(e,r)&&cue(t,r,e[r]);if(aue)for(var r of aue(e))dWe.call(e,r)&&cue(t,r,e[r]);return t},RM=(t,e)=>uWe(t,fWe(e));function t_(t){return Number(t[0].split(":")[1])}function e_(t){return`0x${t.toString(16)}`}function pWe(t){let{chains:e,optionalChains:r,methods:i,optionalMethods:n,events:o,optionalEvents:s,rpcMap:a}=t;if(!Ga(e))throw new Error("Invalid chains");let c={chains:e,methods:i||kM,events:o||NM,rpcMap:Pw({},e.length?{[t_(e)]:a[t_(e)]}:{})},h=o?.filter(A=>!NM.includes(A)),g=i?.filter(A=>!kM.includes(A));if(!r&&!s&&!n&&!(h!=null&&h.length)&&!(g!=null&&g.length))return{required:e.length?c:void 0};let b=h?.length&&g?.length||!r,E={chains:[...new Set(b?c.chains.concat(r||[]):r)],methods:[...new Set(c.methods.concat(n!=null&&n.length?n:PM))],events:[...new Set(c.events.concat(s!=null&&s.length?s:cWe))],rpcMap:a};return{required:e.length?c:void 0,optional:r.length?E:void 0}}var r_=class t{constructor(){this.events=new lue.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=sWe,this.on=(e,r)=>(this.events.on(e,r),this),this.once=(e,r)=>(this.events.once(e,r),this),this.removeListener=(e,r)=>(this.events.removeListener(e,r),this),this.off=(e,r)=>(this.events.off(e,r),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){let r=new t;return await r.initialize(e),r}async request(e,r){return await this.signer.request(e,this.formatChainId(this.chainId),r)}sendAsync(e,r,i){this.signer.sendAsync(e,r,this.formatChainId(this.chainId),i)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);let{required:r,optional:i}=pWe(this.rpc);try{let n=await new Promise(async(s,a)=>{var c;this.rpc.showQrModal&&((c=this.modal)==null||c.subscribeModal(h=>{!h.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),a(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(RM(Pw({namespaces:Pw({},r&&{[this.namespace]:r})},i&&{optionalNamespaces:{[this.namespace]:i}}),{pairingTopic:e?.pairingTopic})).then(h=>{s(h)}).catch(h=>{a(new Error(h.message))})});if(!n)return;let o=Zk(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:o),this.setAccounts(o),this.events.emit("connect",{chainId:e_(this.chainId)})}catch(n){throw this.signer.logger.error(n),n}finally{this.modal&&this.modal.closeModal()}}async authenticate(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:e?.chains});try{let r=await new Promise(async(n,o)=>{var s;this.rpc.showQrModal&&((s=this.modal)==null||s.subscribeModal(a=>{!a.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),o(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(RM(Pw({},e),{chains:this.rpc.chains})).then(a=>{n(a)}).catch(a=>{o(new Error(a.message))})}),i=r.session;if(i){let n=Zk(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:n),this.setAccounts(n),this.events.emit("connect",{chainId:e_(this.chainId)})}return r}catch(r){throw this.signer.logger.error(r),r}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",e=>{let{params:r}=e,{event:i}=r;i.name==="accountsChanged"?(this.accounts=this.parseAccounts(i.data),this.events.emit("accountsChanged",this.accounts)):i.name==="chainChanged"?this.setChainId(this.formatChainId(i.data)):this.events.emit(i.name,i.data),this.events.emit("session_event",e)}),this.signer.on("chainChanged",e=>{let r=parseInt(e);this.chainId=r,this.events.emit("chainChanged",e_(this.chainId)),this.persist()}),this.signer.on("session_update",e=>{this.events.emit("session_update",e)}),this.signer.on("session_delete",e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",RM(Pw({},gi("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var r,i;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(i=this.modal)==null||i.openModal({uri:e})),this.events.emit("display_uri",e)})}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return typeof e=="string"?e.startsWith(`${this.namespace}:`):!1}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){let r=e.filter(i=>this.isCompatibleChainId(i)).map(i=>this.parseChainId(i));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",e_(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){let r=this.parseChainId(e);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(e){let[r,i,n]=e.split(":");return{chainId:`${r}:${i}`,address:n}}setAccounts(e){this.accounts=e.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var r,i;let n=(r=e?.chains)!=null?r:[],o=(i=e?.optionalChains)!=null?i:[],s=n.concat(o);if(!s.length)throw new Error("No chains specified in either `chains` or `optionalChains`");let a=n.length?e?.methods||kM:[],c=n.length?e?.events||NM:[],h=e?.optionalMethods||[],g=e?.optionalEvents||[],b=e?.rpcMap||this.buildRpcMap(s,e.projectId),E=e?.qrModalOptions||void 0;return{chains:n?.map(A=>this.formatChainId(A)),optionalChains:o.map(A=>this.formatChainId(A)),methods:a,events:c,optionalMethods:h,optionalEvents:g,rpcMap:b,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:E,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,r){let i={};return e.forEach(n=>{i[n]=this.getRpcUrl(n,r)}),i}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?t_(this.rpc.chains):t_(this.rpc.optionalChains),this.signer=await sce.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{let{WalletConnectModal:i}=await Promise.resolve().then(()=>(sue(),oue));r=i}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(Pw({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(i){throw this.signer.logger.error(i),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;let{chains:r,optionalChains:i,rpcMap:n}=e;r&&Ga(r)&&(this.rpc.chains=r.map(o=>this.formatChainId(o)),r.forEach(o=>{this.rpc.rpcMap[o]=n?.[o]||this.getRpcUrl(o)})),i&&Ga(i)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=i?.map(o=>this.formatChainId(o)),i.forEach(o=>{this.rpc.rpcMap[o]=n?.[o]||this.getRpcUrl(o)}))}getRpcUrl(e,r){var i;return((i=this.rpc.rpcMap)==null?void 0:i[e])||`${aWe}?chainId=eip155:${e}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{let e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:r?.accounts),this.setAccounts(r?.accounts)}catch(e){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(e),await this.disconnect().catch(r=>this.signer.logger.warn(r))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return typeof e=="string"||e instanceof String?[this.parseAccount(e)]:e.map(r=>this.parseAccount(r))}};var yh={};Mi(yh,{BaseContract:()=>r3,BigNumber:()=>Ue,Contract:()=>Lm,ContractFactory:()=>x5,FixedNumber:()=>ep,Signer:()=>rc,VoidSigner:()=>Nm,Wallet:()=>I5,Wordlist:()=>Tf,constants:()=>__,errors:()=>ua,getDefaultProvider:()=>pE,logger:()=>Vhe,providers:()=>mE,utils:()=>ac,version:()=>wE,wordlists:()=>Um});var Eue=Wt(MM());var hue="logger/5.7.0";var due=!1,pue=!1,i_={debug:1,default:2,info:2,warning:3,error:4,off:5},mue=i_.default,DM=null;function mWe(){try{let t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("\xE9".normalize("NFD")!=="e\u0301")throw new Error("broken implementation")}catch(t){return t.message}return null}var gue=mWe(),LM;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(LM||(LM={}));var ua;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(ua||(ua={}));var wue="0123456789abcdef",fe=class t{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){let i=e.toLowerCase();i_[i]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(mue>i_[i])&&console.log.apply(console,r)}debug(...e){this._log(t.levels.DEBUG,e)}info(...e){this._log(t.levels.INFO,e)}warn(...e){this._log(t.levels.WARNING,e)}makeError(e,r,i){if(pue)return this.makeError("censored error",r,{});r||(r=t.errors.UNKNOWN_ERROR),i||(i={});let n=[];Object.keys(i).forEach(c=>{let h=i[c];try{if(h instanceof Uint8Array){let g="";for(let b=0;b<h.length;b++)g+=wue[h[b]>>4],g+=wue[h[b]&15];n.push(c+"=Uint8Array(0x"+g+")")}else n.push(c+"="+JSON.stringify(h))}catch{n.push(c+"="+JSON.stringify(i[c].toString()))}}),n.push(`code=${r}`),n.push(`version=${this.version}`);let o=e,s="";switch(r){case ua.NUMERIC_FAULT:{s="NUMERIC_FAULT";let c=e;switch(c){case"overflow":case"underflow":case"division-by-zero":s+="-"+c;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result";break}break}case ua.CALL_EXCEPTION:case ua.INSUFFICIENT_FUNDS:case ua.MISSING_NEW:case ua.NONCE_EXPIRED:case ua.REPLACEMENT_UNDERPRICED:case ua.TRANSACTION_REPLACED:case ua.UNPREDICTABLE_GAS_LIMIT:s=r;break}s&&(e+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),n.length&&(e+=" ("+n.join(", ")+")");let a=new Error(e);return a.reason=o,a.code=r,Object.keys(i).forEach(function(c){a[c]=i[c]}),a}throwError(e,r,i){throw this.makeError(e,r,i)}throwArgumentError(e,r,i){return this.throwError(e,t.errors.INVALID_ARGUMENT,{argument:r,value:i})}assert(e,r,i,n){e||this.throwError(r,i,n)}assertArgument(e,r,i,n){e||this.throwArgumentError(r,i,n)}checkNormalize(e){e==null&&(e="platform missing String.prototype.normalize"),gue&&this.throwError("platform missing String.prototype.normalize",t.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:gue})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,i){i?i=": "+i:i="",e<r&&this.throwError("missing argument"+i,t.errors.MISSING_ARGUMENT,{count:e,expectedCount:r}),e>r&&this.throwError("too many arguments"+i,t.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",t.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",t.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",t.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return DM||(DM=new t(hue)),DM}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),due){if(!e)return;this.globalLogger().throwError("error censorship permanent",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}pue=!!e,due=!!r}static setLogLevel(e){let r=i_[e.toLowerCase()];if(r==null){t.globalLogger().warn("invalid log level - "+e);return}mue=r}static from(e){return new t(e)}};fe.errors=ua;fe.levels=LM;var vue="bytes/5.7.0";var Nn=new fe(vue);function yue(t){return!!t.toHexString}function Ow(t){return t.slice||(t.slice=function(){let e=Array.prototype.slice.call(arguments);return Ow(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function nh(t){return Zt(t)&&!(t.length%2)||Zc(t)}function bue(t){return typeof t=="number"&&t==t&&t%1===0}function Zc(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!bue(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){let r=t[e];if(!bue(r)||r<0||r>=256)return!1}return!0}function ke(t,e){if(e||(e={}),typeof t=="number"){Nn.checkSafeUint53(t,"invalid arrayify value");let r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),Ow(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),yue(t)&&(t=t.toHexString()),Zt(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":Nn.throwArgumentError("hex data is odd-length","value",t));let i=[];for(let n=0;n<r.length;n+=2)i.push(parseInt(r.substring(n,n+2),16));return Ow(new Uint8Array(i))}return Zc(t)?Ow(new Uint8Array(t)):Nn.throwArgumentError("invalid arrayify value","value",t)}function Fr(t){let e=t.map(n=>ke(n)),r=e.reduce((n,o)=>n+o.length,0),i=new Uint8Array(r);return e.reduce((n,o)=>(i.set(o,n),n+o.length),0),Ow(i)}function Xa(t){let e=ke(t);if(e.length===0)return e;let r=0;for(;r<e.length&&e[r]===0;)r++;return r&&(e=e.slice(r)),e}function Cm(t,e){t=ke(t),t.length>e&&Nn.throwArgumentError("value out of range","value",arguments[0]);let r=new Uint8Array(e);return r.set(t,e-t.length),Ow(r)}function Zt(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}var BM="0123456789abcdef";function De(t,e){if(e||(e={}),typeof t=="number"){Nn.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=BM[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),yue(t))return t.toHexString();if(Zt(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":Nn.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(Zc(t)){let r="0x";for(let i=0;i<t.length;i++){let n=t[i];r+=BM[(n&240)>>4]+BM[n&15]}return r}return Nn.throwArgumentError("invalid hexlify value","value",t)}function ps(t){if(typeof t!="string")t=De(t);else if(!Zt(t)||t.length%2)return null;return(t.length-2)/2}function ji(t,e,r){return typeof t!="string"?t=De(t):(!Zt(t)||t.length%2)&&Nn.throwArgumentError("invalid hexData","value",t),e=2+2*e,r!=null?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function Vn(t){let e="0x";return t.forEach(r=>{e+=De(r).substring(2)}),e}function hf(t){let e=UM(De(t,{hexPad:"left"}));return e==="0x"?"0x0":e}function UM(t){typeof t!="string"&&(t=De(t)),Zt(t)||Nn.throwArgumentError("invalid hex string","value",t),t=t.substring(2);let e=0;for(;e<t.length&&t[e]==="0";)e++;return"0x"+t.substring(e)}function Kr(t,e){for(typeof t!="string"?t=De(t):Zt(t)||Nn.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&Nn.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function df(t){let e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(nh(t)){let r=ke(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=De(r.slice(0,32)),e.s=De(r.slice(32,64))):r.length===65?(e.r=De(r.slice(0,32)),e.s=De(r.slice(32,64)),e.v=r[64]):Nn.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:Nn.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=De(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){let n=Cm(ke(e._vs),32);e._vs=De(n);let o=n[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=o:e.recoveryParam!==o&&Nn.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),n[0]&=127;let s=De(n);e.s==null?e.s=s:e.s!==s&&Nn.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?Nn.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{let n=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==n&&Nn.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!Zt(e.r)?Nn.throwArgumentError("signature missing or invalid r","signature",t):e.r=Kr(e.r,32),e.s==null||!Zt(e.s)?Nn.throwArgumentError("signature missing or invalid s","signature",t):e.s=Kr(e.s,32);let r=ke(e.s);r[0]>=128&&Nn.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);let i=De(r);e._vs&&(Zt(e._vs)||Nn.throwArgumentError("signature invalid _vs","signature",t),e._vs=Kr(e._vs,32)),e._vs==null?e._vs=i:e._vs!==i&&Nn.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function i5(t){return t=df(t),De(Fr([t.r,t.s,t.recoveryParam?"0x1c":"0x1b"]))}var n_="bignumber/5.7.0";var n5=Eue.default.BN,oh=new fe(n_),FM={},xue=9007199254740991;function Aue(t){return t!=null&&(Ue.isBigNumber(t)||typeof t=="number"&&t%1===0||typeof t=="string"&&!!t.match(/^-?[0-9]+$/)||Zt(t)||typeof t=="bigint"||Zc(t))}var _ue=!1,Ue=class t{constructor(e,r){e!==FM&&oh.throwError("cannot call constructor directly; use BigNumber.from",fe.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return fa(oi(this).fromTwos(e))}toTwos(e){return fa(oi(this).toTwos(e))}abs(){return this._hex[0]==="-"?t.from(this._hex.substring(1)):this}add(e){return fa(oi(this).add(oi(e)))}sub(e){return fa(oi(this).sub(oi(e)))}div(e){return t.from(e).isZero()&&Yc("division-by-zero","div"),fa(oi(this).div(oi(e)))}mul(e){return fa(oi(this).mul(oi(e)))}mod(e){let r=oi(e);return r.isNeg()&&Yc("division-by-zero","mod"),fa(oi(this).umod(r))}pow(e){let r=oi(e);return r.isNeg()&&Yc("negative-power","pow"),fa(oi(this).pow(r))}and(e){let r=oi(e);return(this.isNegative()||r.isNeg())&&Yc("unbound-bitwise-result","and"),fa(oi(this).and(r))}or(e){let r=oi(e);return(this.isNegative()||r.isNeg())&&Yc("unbound-bitwise-result","or"),fa(oi(this).or(r))}xor(e){let r=oi(e);return(this.isNegative()||r.isNeg())&&Yc("unbound-bitwise-result","xor"),fa(oi(this).xor(r))}mask(e){return(this.isNegative()||e<0)&&Yc("negative-width","mask"),fa(oi(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Yc("negative-width","shl"),fa(oi(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Yc("negative-width","shr"),fa(oi(this).shrn(e))}eq(e){return oi(this).eq(oi(e))}lt(e){return oi(this).lt(oi(e))}lte(e){return oi(this).lte(oi(e))}gt(e){return oi(this).gt(oi(e))}gte(e){return oi(this).gte(oi(e))}isNegative(){return this._hex[0]==="-"}isZero(){return oi(this).isZero()}toNumber(){try{return oi(this).toNumber()}catch{Yc("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return oh.throwError("this platform does not support BigInt",fe.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?_ue||(_ue=!0,oh.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?oh.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",fe.errors.UNEXPECTED_ARGUMENT,{}):oh.throwError("BigNumber.toString does not accept parameters",fe.errors.UNEXPECTED_ARGUMENT,{})),oi(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof t)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new t(FM,o5(e)):e.match(/^-?[0-9]+$/)?new t(FM,o5(new n5(e))):oh.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&Yc("underflow","BigNumber.from",e),(e>=xue||e<=-xue)&&Yc("overflow","BigNumber.from",e),t.from(String(e));let r=e;if(typeof r=="bigint")return t.from(r.toString());if(Zc(r))return t.from(De(r));if(r)if(r.toHexString){let i=r.toHexString();if(typeof i=="string")return t.from(i)}else{let i=r._hex;if(i==null&&r.type==="BigNumber"&&(i=r.hex),typeof i=="string"&&(Zt(i)||i[0]==="-"&&Zt(i.substring(1))))return t.from(i)}return oh.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}};function o5(t){if(typeof t!="string")return o5(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&oh.throwArgumentError("invalid hex","value",t),t=o5(t),t==="0x00"?t:"-"+t;if(t.substring(0,2)!=="0x"&&(t="0x"+t),t==="0x")return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&t.substring(0,4)==="0x00";)t="0x"+t.substring(4);return t}function fa(t){return Ue.from(o5(t))}function oi(t){let e=Ue.from(t).toHexString();return e[0]==="-"?new n5("-"+e.substring(3),16):new n5(e.substring(2),16)}function Yc(t,e,r){let i={fault:t,operation:e};return r!=null&&(i.value=r),oh.throwError(t,fe.errors.NUMERIC_FAULT,i)}function jM(t){return new n5(t,36).toString(16)}function $M(t){return new n5(t,16).toString(36)}var Ws=new fe(n_),s5={},Sue=Ue.from(0),Iue=Ue.from(-1);function Tue(t,e,r,i){let n={fault:e,operation:r};return i!==void 0&&(n.value=i),Ws.throwError(t,fe.errors.NUMERIC_FAULT,n)}var a5="0";for(;a5.length<256;)a5+=a5;function WM(t){if(typeof t!="number")try{t=Ue.from(t).toNumber()}catch{}return typeof t=="number"&&t>=0&&t<=256&&!(t%1)?"1"+a5.substring(0,t):Ws.throwArgumentError("invalid decimal size","decimals",t)}function Mw(t,e){e==null&&(e=0);let r=WM(e);t=Ue.from(t);let i=t.lt(Sue);i&&(t=t.mul(Iue));let n=t.mod(r).toString();for(;n.length<r.length-1;)n="0"+n;n=n.match(/^([0-9]*[1-9]|0)(0*)/)[1];let o=t.div(r).toString();return r.length===1?t=o:t=o+"."+n,i&&(t="-"+t),t}function Jc(t,e){e==null&&(e=0);let r=WM(e);(typeof t!="string"||!t.match(/^-?[0-9.]+$/))&&Ws.throwArgumentError("invalid decimal value","value",t);let i=t.substring(0,1)==="-";i&&(t=t.substring(1)),t==="."&&Ws.throwArgumentError("missing value","value",t);let n=t.split(".");n.length>2&&Ws.throwArgumentError("too many decimal points","value",t);let o=n[0],s=n[1];for(o||(o="0"),s||(s="0");s[s.length-1]==="0";)s=s.substring(0,s.length-1);for(s.length>r.length-1&&Tue("fractional component exceeds decimals","underflow","parseFixed"),s===""&&(s="0");s.length<r.length-1;)s+="0";let a=Ue.from(o),c=Ue.from(s),h=a.mul(r).add(c);return i&&(h=h.mul(Iue)),h}var Dw=class t{constructor(e,r,i,n){e!==s5&&Ws.throwError("cannot use FixedFormat constructor; use FixedFormat.from",fe.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=r,this.width=i,this.decimals=n,this.name=(r?"":"u")+"fixed"+String(i)+"x"+String(n),this._multiplier=WM(n),Object.freeze(this)}static from(e){if(e instanceof t)return e;typeof e=="number"&&(e=`fixed128x${e}`);let r=!0,i=128,n=18;if(typeof e=="string"){if(e!=="fixed")if(e==="ufixed")r=!1;else{let o=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);o||Ws.throwArgumentError("invalid fixed format","format",e),r=o[1]!=="u",i=parseInt(o[2]),n=parseInt(o[3])}}else if(e){let o=(s,a,c)=>e[s]==null?c:(typeof e[s]!==a&&Ws.throwArgumentError("invalid fixed format ("+s+" not "+a+")","format."+s,e[s]),e[s]);r=o("signed","boolean",r),i=o("width","number",i),n=o("decimals","number",n)}return i%8&&Ws.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",i),n>80&&Ws.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new t(s5,r,i,n)}},ep=class t{constructor(e,r,i,n){e!==s5&&Ws.throwError("cannot use FixedNumber constructor; use FixedNumber.from",fe.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=r,this._value=i,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&Ws.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);let r=Jc(this._value,this.format.decimals),i=Jc(e._value,e.format.decimals);return t.fromValue(r.add(i),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);let r=Jc(this._value,this.format.decimals),i=Jc(e._value,e.format.decimals);return t.fromValue(r.sub(i),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);let r=Jc(this._value,this.format.decimals),i=Jc(e._value,e.format.decimals);return t.fromValue(r.mul(i).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);let r=Jc(this._value,this.format.decimals),i=Jc(e._value,e.format.decimals);return t.fromValue(r.mul(this.format._multiplier).div(i),this.format.decimals,this.format)}floor(){let e=this.toString().split(".");e.length===1&&e.push("0");let r=t.from(e[0],this.format),i=!e[1].match(/^(0*)$/);return this.isNegative()&&i&&(r=r.subUnsafe(Cue.toFormat(r.format))),r}ceiling(){let e=this.toString().split(".");e.length===1&&e.push("0");let r=t.from(e[0],this.format),i=!e[1].match(/^(0*)$/);return!this.isNegative()&&i&&(r=r.addUnsafe(Cue.toFormat(r.format))),r}round(e){e==null&&(e=0);let r=this.toString().split(".");if(r.length===1&&r.push("0"),(e<0||e>80||e%1)&&Ws.throwArgumentError("invalid decimal count","decimals",e),r[1].length<=e)return this;let i=t.from("1"+a5.substring(0,e),this.format),n=gWe.toFormat(this.format);return this.mulUnsafe(i).addUnsafe(n).floor().divUnsafe(i)}isZero(){return this._value==="0.0"||this._value==="0"}isNegative(){return this._value[0]==="-"}toString(){return this._value}toHexString(e){if(e==null)return this._hex;e%8&&Ws.throwArgumentError("invalid byte width","width",e);let r=Ue.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return Kr(r,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return t.fromString(this._value,e)}static fromValue(e,r,i){return i==null&&r!=null&&!Aue(r)&&(i=r,r=null),r==null&&(r=0),i==null&&(i="fixed"),t.fromString(Mw(e,r),Dw.from(i))}static fromString(e,r){r==null&&(r="fixed");let i=Dw.from(r),n=Jc(e,i.decimals);!i.signed&&n.lt(Sue)&&Tue("unsigned value cannot be negative","overflow","value",e);let o=null;i.signed?o=n.toTwos(i.width).toHexString():(o=n.toHexString(),o=Kr(o,i.width/8));let s=Mw(n,i.decimals);return new t(s5,o,s,i)}static fromBytes(e,r){r==null&&(r="fixed");let i=Dw.from(r);if(ke(e).length>i.width/8)throw new Error("overflow");let n=Ue.from(e);i.signed&&(n=n.fromTwos(i.width));let o=n.toTwos((i.signed?0:1)+i.width).toHexString(),s=Mw(n,i.decimals);return new t(s5,o,s,i)}static from(e,r){if(typeof e=="string")return t.fromString(e,r);if(Zc(e))return t.fromBytes(e,r);try{return t.fromValue(e,0,r)}catch(i){if(i.code!==fe.errors.INVALID_ARGUMENT)throw i}return Ws.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!!(e&&e._isFixedNumber)}},Cue=ep.from(1),gWe=ep.from("0.5");var Rue="properties/5.7.0";var wWe=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},o_=new fe(Rue);function ye(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function bn(t,e){for(let r=0;r<32;r++){if(t[e])return t[e];if(!t.prototype||typeof t.prototype!="object")break;t=Object.getPrototypeOf(t.prototype).constructor}return null}function $i(t){return wWe(this,void 0,void 0,function*(){let e=Object.keys(t).map(i=>{let n=t[i];return Promise.resolve(n).then(o=>({key:i,value:o}))});return(yield Promise.all(e)).reduce((i,n)=>(i[n.key]=n.value,i),{})})}function Lw(t,e){(!t||typeof t!="object")&&o_.throwArgumentError("invalid object","object",t),Object.keys(t).forEach(r=>{e[r]||o_.throwArgumentError("invalid object key - "+r,"transaction:"+r,t)})}function pi(t){let e={};for(let r in t)e[r]=t[r];return e}var vWe={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function kue(t){if(t==null||vWe[typeof t])return!0;if(Array.isArray(t)||typeof t=="object"){if(!Object.isFrozen(t))return!1;let e=Object.keys(t);for(let r=0;r<e.length;r++){let i=null;try{i=t[e[r]]}catch{continue}if(!kue(i))return!1}return!0}return o_.throwArgumentError(`Cannot deepCopy ${typeof t}`,"object",t)}function bWe(t){if(kue(t))return t;if(Array.isArray(t))return Object.freeze(t.map(e=>vn(e)));if(typeof t=="object"){let e={};for(let r in t){let i=t[r];i!==void 0&&ye(e,r,vn(i))}return e}return o_.throwArgumentError(`Cannot deepCopy ${typeof t}`,"object",t)}function vn(t){return bWe(t)}var ec=class{constructor(e){for(let r in e)this[r]=vn(e[r])}};var pf="abi/5.7.0";var ui=new fe(pf),Sm={},Nue={calldata:!0,memory:!0,storage:!0},yWe={calldata:!0,memory:!0};function s_(t,e){if(t==="bytes"||t==="string"){if(Nue[e])return!0}else if(t==="address"){if(e==="payable")return!0}else if((t.indexOf("[")>=0||t==="tuple")&&yWe[e])return!0;return(Nue[e]||e==="payable")&&ui.throwArgumentError("invalid modifier","name",e),!1}function xWe(t,e){let r=t;function i(a){ui.throwArgumentError(`unexpected character at position ${a}`,"param",t)}t=t.replace(/\s/g," ");function n(a){let c={type:"",name:"",parent:a,state:{allowType:!0}};return e&&(c.indexed=!1),c}let o={type:"",name:"",state:{allowType:!0}},s=o;for(let a=0;a<t.length;a++){let c=t[a];switch(c){case"(":s.state.allowType&&s.type===""?s.type="tuple":s.state.allowParams||i(a),s.state.allowType=!1,s.type=Bw(s.type),s.components=[n(s)],s=s.components[0];break;case")":delete s.state,s.name==="indexed"&&(e||i(a),s.indexed=!0,s.name=""),s_(s.type,s.name)&&(s.name=""),s.type=Bw(s.type);let h=s;s=s.parent,s||i(a),delete h.parent,s.state.allowParams=!1,s.state.allowName=!0,s.state.allowArray=!0;break;case",":delete s.state,s.name==="indexed"&&(e||i(a),s.indexed=!0,s.name=""),s_(s.type,s.name)&&(s.name=""),s.type=Bw(s.type);let g=n(s.parent);s.parent.components.push(g),delete s.parent,s=g;break;case" ":s.state.allowType&&s.type!==""&&(s.type=Bw(s.type),delete s.state.allowType,s.state.allowName=!0,s.state.allowParams=!0),s.state.allowName&&s.name!==""&&(s.name==="indexed"?(e||i(a),s.indexed&&i(a),s.indexed=!0,s.name=""):s_(s.type,s.name)?s.name="":s.state.allowName=!1);break;case"[":s.state.allowArray||i(a),s.type+=c,s.state.allowArray=!1,s.state.allowName=!1,s.state.readArray=!0;break;case"]":s.state.readArray||i(a),s.type+=c,s.state.readArray=!1,s.state.allowArray=!0,s.state.allowName=!0;break;default:s.state.allowType?(s.type+=c,s.state.allowParams=!0,s.state.allowArray=!0):s.state.allowName?(s.name+=c,delete s.state.allowArray):s.state.readArray?s.type+=c:i(a)}}return s.parent&&ui.throwArgumentError("unexpected eof","param",t),delete o.state,s.name==="indexed"?(e||i(r.length-7),s.indexed&&i(r.length-7),s.indexed=!0,s.name=""):s_(s.type,s.name)&&(s.name=""),o.type=Bw(o.type),o}function a_(t,e){for(let r in e)ye(t,r,e[r])}var si=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),_We=new RegExp(/^(.*)\[([0-9]*)\]$/),Vo=class t{constructor(e,r){e!==Sm&&ui.throwError("use fromString",fe.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),a_(this,r);let i=this.type.match(_We);i?a_(this,{arrayLength:parseInt(i[2]||"-1"),arrayChildren:t.fromObject({type:i[1],components:this.components}),baseType:"array"}):a_(this,{arrayLength:null,arrayChildren:null,baseType:this.components!=null?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(e){if(e||(e=si.sighash),si[e]||ui.throwArgumentError("invalid format type","format",e),e===si.json){let i={type:this.baseType==="tuple"?"tuple":this.type,name:this.name||void 0};return typeof this.indexed=="boolean"&&(i.indexed=this.indexed),this.components&&(i.components=this.components.map(n=>JSON.parse(n.format(e)))),JSON.stringify(i)}let r="";return this.baseType==="array"?(r+=this.arrayChildren.format(e),r+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):this.baseType==="tuple"?(e!==si.sighash&&(r+=this.type),r+="("+this.components.map(i=>i.format(e)).join(e===si.full?", ":",")+")"):r+=this.type,e!==si.sighash&&(this.indexed===!0&&(r+=" indexed"),e===si.full&&this.name&&(r+=" "+this.name)),r}static from(e,r){return typeof e=="string"?t.fromString(e,r):t.fromObject(e)}static fromObject(e){return t.isParamType(e)?e:new t(Sm,{name:e.name||null,type:Bw(e.type),indexed:e.indexed==null?null:!!e.indexed,components:e.components?e.components.map(t.fromObject):null})}static fromString(e,r){function i(n){return t.fromObject({name:n.name,type:n.type,indexed:n.indexed,components:n.components})}return i(xWe(e,!!r))}static isParamType(e){return!!(e!=null&&e._isParamType)}};function c5(t,e){return AWe(t).map(r=>Vo.fromString(r,e))}var mf=class t{constructor(e,r){e!==Sm&&ui.throwError("use a static from method",fe.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),a_(this,r),this._isFragment=!0,Object.freeze(this)}static from(e){return t.isFragment(e)?e:typeof e=="string"?t.fromString(e):t.fromObject(e)}static fromObject(e){if(t.isFragment(e))return e;switch(e.type){case"function":return wf.fromObject(e);case"event":return sh.fromObject(e);case"constructor":return gf.fromObject(e);case"error":return Im.fromObject(e);case"fallback":case"receive":return null}return ui.throwArgumentError("invalid fragment object","value",e)}static fromString(e){return e=e.replace(/\s/g," "),e=e.replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," "),e=e.trim(),e.split(" ")[0]==="event"?sh.fromString(e.substring(5).trim()):e.split(" ")[0]==="function"?wf.fromString(e.substring(8).trim()):e.split("(")[0].trim()==="constructor"?gf.fromString(e.trim()):e.split(" ")[0]==="error"?Im.fromString(e.substring(5).trim()):ui.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!!(e&&e._isFragment)}},sh=class t extends mf{format(e){if(e||(e=si.sighash),si[e]||ui.throwArgumentError("invalid format type","format",e),e===si.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(i=>JSON.parse(i.format(e)))});let r="";return e!==si.sighash&&(r+="event "),r+=this.name+"("+this.inputs.map(i=>i.format(e)).join(e===si.full?", ":",")+") ",e!==si.sighash&&this.anonymous&&(r+="anonymous "),r.trim()}static from(e){return typeof e=="string"?t.fromString(e):t.fromObject(e)}static fromObject(e){if(t.isEventFragment(e))return e;e.type!=="event"&&ui.throwArgumentError("invalid event object","value",e);let r={name:l5(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(Vo.fromObject):[],type:"event"};return new t(Sm,r)}static fromString(e){let r=e.match(u5);r||ui.throwArgumentError("invalid event string","value",e);let i=!1;return r[3].split(" ").forEach(n=>{switch(n.trim()){case"anonymous":i=!0;break;case"":break;default:ui.warn("unknown modifier: "+n)}}),t.fromObject({name:r[1].trim(),anonymous:i,inputs:c5(r[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&e.type==="event"}};function Oue(t,e){e.gas=null;let r=t.split("@");return r.length!==1?(r.length>2&&ui.throwArgumentError("invalid human-readable ABI signature","value",t),r[1].match(/^[0-9]+$/)||ui.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=Ue.from(r[1]),r[0]):t}function Mue(t,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",t.split(" ").forEach(r=>{switch(r.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+r)}})}function Due(t){let e={constant:!1,payable:!0,stateMutability:"payable"};return t.stateMutability!=null?(e.stateMutability=t.stateMutability,e.constant=e.stateMutability==="view"||e.stateMutability==="pure",t.constant!=null&&!!t.constant!==e.constant&&ui.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable=e.stateMutability==="payable",t.payable!=null&&!!t.payable!==e.payable&&ui.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",t)):t.payable!=null?(e.payable=!!t.payable,t.constant==null&&!e.payable&&t.type!=="constructor"&&ui.throwArgumentError("unable to determine stateMutability","value",t),e.constant=!!t.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&ui.throwArgumentError("cannot have constant payable function","value",t)):t.constant!=null?(e.constant=!!t.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):t.type!=="constructor"&&ui.throwArgumentError("unable to determine stateMutability","value",t),e}var gf=class t extends mf{format(e){if(e||(e=si.sighash),si[e]||ui.throwArgumentError("invalid format type","format",e),e===si.json)return JSON.stringify({type:"constructor",stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(i=>JSON.parse(i.format(e)))});e===si.sighash&&ui.throwError("cannot format a constructor for sighash",fe.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let r="constructor("+this.inputs.map(i=>i.format(e)).join(e===si.full?", ":",")+") ";return this.stateMutability&&this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "),r.trim()}static from(e){return typeof e=="string"?t.fromString(e):t.fromObject(e)}static fromObject(e){if(t.isConstructorFragment(e))return e;e.type!=="constructor"&&ui.throwArgumentError("invalid constructor object","value",e);let r=Due(e);r.constant&&ui.throwArgumentError("constructor cannot be constant","value",e);let i={name:null,type:e.type,inputs:e.inputs?e.inputs.map(Vo.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?Ue.from(e.gas):null};return new t(Sm,i)}static fromString(e){let r={type:"constructor"};e=Oue(e,r);let i=e.match(u5);return(!i||i[1].trim()!=="constructor")&&ui.throwArgumentError("invalid constructor string","value",e),r.inputs=c5(i[2].trim(),!1),Mue(i[3].trim(),r),t.fromObject(r)}static isConstructorFragment(e){return e&&e._isFragment&&e.type==="constructor"}},wf=class t extends gf{format(e){if(e||(e=si.sighash),si[e]||ui.throwArgumentError("invalid format type","format",e),e===si.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?this.gas.toNumber():void 0,inputs:this.inputs.map(i=>JSON.parse(i.format(e))),outputs:this.outputs.map(i=>JSON.parse(i.format(e)))});let r="";return e!==si.sighash&&(r+="function "),r+=this.name+"("+this.inputs.map(i=>i.format(e)).join(e===si.full?", ":",")+") ",e!==si.sighash&&(this.stateMutability?this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "):this.constant&&(r+="view "),this.outputs&&this.outputs.length&&(r+="returns ("+this.outputs.map(i=>i.format(e)).join(", ")+") "),this.gas!=null&&(r+="@"+this.gas.toString()+" ")),r.trim()}static from(e){return typeof e=="string"?t.fromString(e):t.fromObject(e)}static fromObject(e){if(t.isFunctionFragment(e))return e;e.type!=="function"&&ui.throwArgumentError("invalid function object","value",e);let r=Due(e),i={type:e.type,name:l5(e.name),constant:r.constant,inputs:e.inputs?e.inputs.map(Vo.fromObject):[],outputs:e.outputs?e.outputs.map(Vo.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?Ue.from(e.gas):null};return new t(Sm,i)}static fromString(e){let r={type:"function"};e=Oue(e,r);let i=e.split(" returns ");i.length>2&&ui.throwArgumentError("invalid function string","value",e);let n=i[0].match(u5);if(n||ui.throwArgumentError("invalid function signature","value",e),r.name=n[1].trim(),r.name&&l5(r.name),r.inputs=c5(n[2],!1),Mue(n[3].trim(),r),i.length>1){let o=i[1].match(u5);(o[1].trim()!=""||o[3].trim()!="")&&ui.throwArgumentError("unexpected tokens","value",e),r.outputs=c5(o[2],!1)}else r.outputs=[];return t.fromObject(r)}static isFunctionFragment(e){return e&&e._isFragment&&e.type==="function"}};function Pue(t){let e=t.format();return(e==="Error(string)"||e==="Panic(uint256)")&&ui.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}var Im=class t extends mf{format(e){if(e||(e=si.sighash),si[e]||ui.throwArgumentError("invalid format type","format",e),e===si.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(i=>JSON.parse(i.format(e)))});let r="";return e!==si.sighash&&(r+="error "),r+=this.name+"("+this.inputs.map(i=>i.format(e)).join(e===si.full?", ":",")+") ",r.trim()}static from(e){return typeof e=="string"?t.fromString(e):t.fromObject(e)}static fromObject(e){if(t.isErrorFragment(e))return e;e.type!=="error"&&ui.throwArgumentError("invalid error object","value",e);let r={type:e.type,name:l5(e.name),inputs:e.inputs?e.inputs.map(Vo.fromObject):[]};return Pue(new t(Sm,r))}static fromString(e){let r={type:"error"},i=e.match(u5);return i||ui.throwArgumentError("invalid error signature","value",e),r.name=i[1].trim(),r.name&&l5(r.name),r.inputs=c5(i[2],!1),Pue(t.fromObject(r))}static isErrorFragment(e){return e&&e._isFragment&&e.type==="error"}};function Bw(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}var EWe=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function l5(t){return(!t||!t.match(EWe))&&ui.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}var u5=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function AWe(t){t=t.trim();let e=[],r="",i=0;for(let n=0;n<t.length;n++){let o=t[n];o===","&&i===0?(e.push(r),r=""):(r+=o,o==="("?i++:o===")"&&(i--,i===-1&&ui.throwArgumentError("unbalanced parenthesis","value",t)))}return r&&e.push(r),e}var qM=new fe(pf);function Uw(t){let e=[],r=function(i,n){if(Array.isArray(n))for(let o in n){let s=i.slice();s.push(o);try{r(s,n[o])}catch(a){e.push({path:s,error:a})}}};return r([],t),e}var Kn=class{constructor(e,r,i,n){this.name=e,this.type=r,this.localName=i,this.dynamic=n}_throwError(e,r){qM.throwArgumentError(e,this.localName,r)}},Tm=class{constructor(e){ye(this,"wordSize",e||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(e)}get data(){return Vn(this._data)}get length(){return this._dataLength}_writeData(e){return this._data.push(e),this._dataLength+=e.length,e.length}appendWriter(e){return this._writeData(Fr(e._data))}writeBytes(e){let r=ke(e),i=r.length%this.wordSize;return i&&(r=Fr([r,this._padding.slice(i)])),this._writeData(r)}_getValue(e){let r=ke(Ue.from(e));return r.length>this.wordSize&&qM.throwError("value out-of-bounds",fe.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:r.length}),r.length%this.wordSize&&(r=Fr([this._padding.slice(r.length%this.wordSize),r])),r}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){let e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,r=>{this._data[e]=this._getValue(r)}}},c_=class t{constructor(e,r,i,n){ye(this,"_data",ke(e)),ye(this,"wordSize",r||32),ye(this,"_coerceFunc",i),ye(this,"allowLoose",n),this._offset=0}get data(){return De(this._data)}get consumed(){return this._offset}static coerce(e,r){let i=e.match("^u?int([0-9]+)$");return i&&parseInt(i[1])<=48&&(r=r.toNumber()),r}coerce(e,r){return this._coerceFunc?this._coerceFunc(e,r):t.coerce(e,r)}_peekBytes(e,r,i){let n=Math.ceil(r/this.wordSize)*this.wordSize;return this._offset+n>this._data.length&&(this.allowLoose&&i&&this._offset+r<=this._data.length?n=r:qM.throwError("data out-of-bounds",fe.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+n})),this._data.slice(this._offset,this._offset+n)}subReader(e){return new t(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,r){let i=this._peekBytes(0,e,!!r);return this._offset+=i.length,i.slice(0,e)}readValue(){return Ue.from(this.readBytes(this.wordSize))}};var Bue=Wt(Lue());function jr(t){return"0x"+Bue.default.keccak_256(ke(t))}var u_={};Mi(u_,{decode:()=>f5,encode:()=>ah});var Uue="rlp/5.7.0";var vf=new fe(Uue);function Fue(t){let e=[];for(;t;)e.unshift(t&255),t>>=8;return e}function jue(t,e,r){let i=0;for(let n=0;n<r;n++)i=i*256+t[e+n];return i}function Wue(t){if(Array.isArray(t)){let i=[];if(t.forEach(function(o){i=i.concat(Wue(o))}),i.length<=55)return i.unshift(192+i.length),i;let n=Fue(i.length);return n.unshift(247+n.length),n.concat(i)}nh(t)||vf.throwArgumentError("RLP object must be BytesLike","object",t);let e=Array.prototype.slice.call(ke(t));if(e.length===1&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;let r=Fue(e.length);return r.unshift(183+r.length),r.concat(e)}function ah(t){return De(Wue(t))}function $ue(t,e,r,i){let n=[];for(;r<e+1+i;){let o=que(t,r);n.push(o.result),r+=o.consumed,r>e+1+i&&vf.throwError("child data too short",fe.errors.BUFFER_OVERRUN,{})}return{consumed:1+i,result:n}}function que(t,e){if(t.length===0&&vf.throwError("data too short",fe.errors.BUFFER_OVERRUN,{}),t[e]>=248){let r=t[e]-247;e+1+r>t.length&&vf.throwError("data short segment too short",fe.errors.BUFFER_OVERRUN,{});let i=jue(t,e+1,r);return e+1+r+i>t.length&&vf.throwError("data long segment too short",fe.errors.BUFFER_OVERRUN,{}),$ue(t,e,e+1+r,r+i)}else if(t[e]>=192){let r=t[e]-192;return e+1+r>t.length&&vf.throwError("data array too short",fe.errors.BUFFER_OVERRUN,{}),$ue(t,e,e+1,r)}else if(t[e]>=184){let r=t[e]-183;e+1+r>t.length&&vf.throwError("data array too short",fe.errors.BUFFER_OVERRUN,{});let i=jue(t,e+1,r);e+1+r+i>t.length&&vf.throwError("data array too short",fe.errors.BUFFER_OVERRUN,{});let n=De(t.slice(e+1+r,e+1+r+i));return{consumed:1+r+i,result:n}}else if(t[e]>=128){let r=t[e]-128;e+1+r>t.length&&vf.throwError("data too short",fe.errors.BUFFER_OVERRUN,{});let i=De(t.slice(e+1,e+1+r));return{consumed:1+r,result:i}}return{consumed:1,result:De(t[e])}}function f5(t){let e=ke(t),r=que(e,0);return r.consumed!==e.length&&vf.throwArgumentError("invalid rlp data","data",t),r.result}var Hue="address/5.7.0";var tp=new fe(Hue);function zue(t){Zt(t,20)||tp.throwArgumentError("invalid address","address",t),t=t.toLowerCase();let e=t.substring(2).split(""),r=new Uint8Array(40);for(let n=0;n<40;n++)r[n]=e[n].charCodeAt(0);let i=ke(jr(r));for(let n=0;n<40;n+=2)i[n>>1]>>4>=8&&(e[n]=e[n].toUpperCase()),(i[n>>1]&15)>=8&&(e[n+1]=e[n+1].toUpperCase());return"0x"+e.join("")}var CWe=9007199254740991;function SWe(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}var HM={};for(let t=0;t<10;t++)HM[String(t)]=String(t);for(let t=0;t<26;t++)HM[String.fromCharCode(65+t)]=String(10+t);var Vue=Math.floor(SWe(CWe));function Kue(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(i=>HM[i]).join("");for(;e.length>=Vue;){let i=e.substring(0,Vue);e=parseInt(i,10)%97+e.substring(i.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function $r(t){let e=null;if(typeof t!="string"&&tp.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=zue(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&tp.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==Kue(t)&&tp.throwArgumentError("bad icap checksum","address",t),e=jM(t.substring(4));e.length<40;)e="0"+e;e=zue("0x"+e)}else tp.throwArgumentError("invalid address","address",t);return e}function Gue(t){try{return $r(t),!0}catch{}return!1}function Zue(t){let e=$M($r(t).substring(2)).toUpperCase();for(;e.length<30;)e="0"+e;return"XE"+Kue("XE00"+e)+e}function Rm(t){let e=null;try{e=$r(t.from)}catch{tp.throwArgumentError("missing from address","transaction",t)}let r=Xa(ke(Ue.from(t.nonce).toHexString()));return $r(ji(jr(ah([e,r])),12))}function Yue(t,e,r){return ps(e)!==32&&tp.throwArgumentError("salt must be 32 bytes","salt",e),ps(r)!==32&&tp.throwArgumentError("initCodeHash must be 32 bytes","initCodeHash",r),$r(ji(jr(Fr(["0xff",$r(t),e,r])),12))}var f_=class extends Kn{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,r){try{r=$r(r)}catch(i){this._throwError(i.message,r)}return e.writeValue(r)}decode(e){return $r(Kr(e.readValue().toHexString(),20))}};var h_=class extends Kn{constructor(e){super(e.name,e.type,void 0,e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,r){return this.coder.encode(e,r)}decode(e){return this.coder.decode(e)}};var Fw=new fe(pf);function zM(t,e,r){let i=null;if(Array.isArray(r))i=r;else if(r&&typeof r=="object"){let c={};i=e.map(h=>{let g=h.localName;return g||Fw.throwError("cannot encode object for signature with missing names",fe.errors.INVALID_ARGUMENT,{argument:"values",coder:h,value:r}),c[g]&&Fw.throwError("cannot encode object for signature with duplicate names",fe.errors.INVALID_ARGUMENT,{argument:"values",coder:h,value:r}),c[g]=!0,r[g]})}else Fw.throwArgumentError("invalid tuple value","tuple",r);e.length!==i.length&&Fw.throwArgumentError("types/value length mismatch","tuple",r);let n=new Tm(t.wordSize),o=new Tm(t.wordSize),s=[];e.forEach((c,h)=>{let g=i[h];if(c.dynamic){let b=o.length;c.encode(o,g);let E=n.writeUpdatableValue();s.push(A=>{E(A+b)})}else c.encode(n,g)}),s.forEach(c=>{c(n.length)});let a=t.appendWriter(n);return a+=t.appendWriter(o),a}function VM(t,e){let r=[],i=t.subReader(0);e.forEach(o=>{let s=null;if(o.dynamic){let a=t.readValue(),c=i.subReader(a.toNumber());try{s=o.decode(c)}catch(h){if(h.code===fe.errors.BUFFER_OVERRUN)throw h;s=h,s.baseType=o.name,s.name=o.localName,s.type=o.type}}else try{s=o.decode(t)}catch(a){if(a.code===fe.errors.BUFFER_OVERRUN)throw a;s=a,s.baseType=o.name,s.name=o.localName,s.type=o.type}s!=null&&r.push(s)});let n=e.reduce((o,s)=>{let a=s.localName;return a&&(o[a]||(o[a]=0),o[a]++),o},{});e.forEach((o,s)=>{let a=o.localName;if(!a||n[a]!==1||(a==="length"&&(a="_length"),r[a]!=null))return;let c=r[s];c instanceof Error?Object.defineProperty(r,a,{enumerable:!0,get:()=>{throw c}}):r[a]=c});for(let o=0;o<r.length;o++){let s=r[o];s instanceof Error&&Object.defineProperty(r,o,{enumerable:!0,get:()=>{throw s}})}return Object.freeze(r)}var d_=class extends Kn{constructor(e,r,i){let n=e.type+"["+(r>=0?r:"")+"]",o=r===-1||e.dynamic;super("array",n,i,o),this.coder=e,this.length=r}defaultValue(){let e=this.coder.defaultValue(),r=[];for(let i=0;i<this.length;i++)r.push(e);return r}encode(e,r){Array.isArray(r)||this._throwError("expected array value",r);let i=this.length;i===-1&&(i=r.length,e.writeValue(r.length)),Fw.checkArgumentCount(r.length,i,"coder array"+(this.localName?" "+this.localName:""));let n=[];for(let o=0;o<r.length;o++)n.push(this.coder);return zM(e,n,r)}decode(e){let r=this.length;r===-1&&(r=e.readValue().toNumber(),r*32>e._data.length&&Fw.throwError("insufficient data length",fe.errors.BUFFER_OVERRUN,{length:e._data.length,count:r}));let i=[];for(let n=0;n<r;n++)i.push(new h_(this.coder));return e.coerce(this.name,VM(e,i))}};var p_=class extends Kn{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,r){return e.writeValue(r?1:0)}decode(e){return e.coerce(this.type,!e.readValue().isZero())}};var h5=class extends Kn{constructor(e,r){super(e,e,r,!0)}defaultValue(){return"0x"}encode(e,r){r=ke(r);let i=e.writeValue(r.length);return i+=e.writeBytes(r),i}decode(e){return e.readBytes(e.readValue().toNumber(),!0)}},m_=class extends h5{constructor(e){super("bytes",e)}decode(e){return e.coerce(this.name,De(super.decode(e)))}};var g_=class extends Kn{constructor(e,r){let i="bytes"+String(e);super(i,i,r,!1),this.size=e}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(e,r){let i=ke(r);return i.length!==this.size&&this._throwError("incorrect data length",r),e.writeBytes(i)}decode(e){return e.coerce(this.name,De(e.readBytes(this.size)))}};var w_=class extends Kn{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,r){return r!=null&&this._throwError("not null",r),e.writeBytes([])}decode(e){return e.readBytes(0),e.coerce(this.name,null)}};var __={};Mi(__,{AddressZero:()=>v_,EtherSymbol:()=>tfe,HashZero:()=>$w,MaxInt256:()=>efe,MaxUint256:()=>x_,MinInt256:()=>Xue,NegativeOne:()=>b_,One:()=>y_,Two:()=>Jue,WeiPerEther:()=>Que,Zero:()=>jw});var v_="0x0000000000000000000000000000000000000000";var b_=Ue.from(-1),jw=Ue.from(0),y_=Ue.from(1),Jue=Ue.from(2),Que=Ue.from("1000000000000000000"),x_=Ue.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Xue=Ue.from("-0x8000000000000000000000000000000000000000000000000000000000000000"),efe=Ue.from("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var $w="0x0000000000000000000000000000000000000000000000000000000000000000";var tfe="\u039E";var E_=class extends Kn{constructor(e,r,i){let n=(r?"int":"uint")+e*8;super(n,n,i,!1),this.size=e,this.signed=r}defaultValue(){return 0}encode(e,r){let i=Ue.from(r),n=x_.mask(e.wordSize*8);if(this.signed){let o=n.mask(this.size*8-1);(i.gt(o)||i.lt(o.add(y_).mul(b_)))&&this._throwError("value out-of-bounds",r)}else(i.lt(jw)||i.gt(n.mask(this.size*8)))&&this._throwError("value out-of-bounds",r);return i=i.toTwos(this.size*8).mask(this.size*8),this.signed&&(i=i.fromTwos(this.size*8).toTwos(8*e.wordSize)),e.writeValue(i)}decode(e){let r=e.readValue().mask(this.size*8);return this.signed&&(r=r.fromTwos(this.size*8)),e.coerce(this.name,r)}};var rfe="strings/5.7.0";var ife=new fe(rfe),qs;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(qs||(qs={}));var ms;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(ms||(ms={}));function IWe(t,e,r,i,n){return ife.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)}function nfe(t,e,r,i,n){if(t===ms.BAD_PREFIX||t===ms.UNEXPECTED_CONTINUE){let o=0;for(let s=e+1;s<r.length&&r[s]>>6===2;s++)o++;return o}return t===ms.OVERRUN?r.length-e-1:0}function TWe(t,e,r,i,n){return t===ms.OVERLONG?(i.push(n),0):(i.push(65533),nfe(t,e,r,i,n))}var A_=Object.freeze({error:IWe,ignore:nfe,replace:TWe});function GM(t,e){e==null&&(e=A_.error),t=ke(t);let r=[],i=0;for(;i<t.length;){let n=t[i++];if(n>>7===0){r.push(n);continue}let o=null,s=null;if((n&224)===192)o=1,s=127;else if((n&240)===224)o=2,s=2047;else if((n&248)===240)o=3,s=65535;else{(n&192)===128?i+=e(ms.UNEXPECTED_CONTINUE,i-1,t,r):i+=e(ms.BAD_PREFIX,i-1,t,r);continue}if(i-1+o>=t.length){i+=e(ms.OVERRUN,i-1,t,r);continue}let a=n&(1<<8-o-1)-1;for(let c=0;c<o;c++){let h=t[i];if((h&192)!=128){i+=e(ms.MISSING_CONTINUE,i,t,r),a=null;break}a=a<<6|h&63,i++}if(a!==null){if(a>1114111){i+=e(ms.OUT_OF_RANGE,i-1-o,t,r,a);continue}if(a>=55296&&a<=57343){i+=e(ms.UTF16_SURROGATE,i-1-o,t,r,a);continue}if(a<=s){i+=e(ms.OVERLONG,i-1-o,t,r,a);continue}r.push(a)}}return r}function fi(t,e=qs.current){e!=qs.current&&(ife.checkNormalize(),t=t.normalize(e));let r=[];for(let i=0;i<t.length;i++){let n=t.charCodeAt(i);if(n<128)r.push(n);else if(n<2048)r.push(n>>6|192),r.push(n&63|128);else if((n&64512)==55296){i++;let o=t.charCodeAt(i);if(i>=t.length||(o&64512)!==56320)throw new Error("invalid utf-8 string");let s=65536+((n&1023)<<10)+(o&1023);r.push(s>>18|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(s&63|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(n&63|128)}return ke(r)}function KM(t){let e="0000"+t.toString(16);return"\\u"+e.substring(e.length-4)}function ZM(t,e){return'"'+GM(t,e).map(r=>{if(r<256){switch(r){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 13:return"\\r";case 34:return'\\"';case 92:return"\\\\"}if(r>=32&&r<127)return String.fromCharCode(r)}return r<=65535?KM(r):(r-=65536,KM((r>>10&1023)+55296)+KM((r&1023)+56320))}).join("")+'"'}function C_(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function ha(t,e){return C_(GM(t,e))}function rp(t,e=qs.current){return GM(fi(t,e))}function YM(t){let e=fi(t);if(e.length>31)throw new Error("bytes32 string must be less than 32 bytes");return De(Fr([e,$w]).slice(0,32))}function JM(t){let e=ke(t);if(e.length!==32)throw new Error("invalid bytes32 - not 32 bytes long");if(e[31]!==0)throw new Error("invalid bytes32 string - no null terminator");let r=31;for(;e[r-1]===0;)r--;return ha(e.slice(0,r))}function RWe(t){if(t.length%4!==0)throw new Error("bad data");let e=[];for(let r=0;r<t.length;r+=4)e.push(parseInt(t.substring(r,r+4),16));return e}function QM(t,e){e||(e=function(n){return[parseInt(n,16)]});let r=0,i={};return t.split(",").forEach(n=>{let o=n.split(":");r+=parseInt(o[0],16),i[r]=e(o[1])}),i}function ofe(t){let e=0;return t.split(",").map(r=>{let i=r.split("-");i.length===1?i[1]="0":i[1]===""&&(i[1]="1");let n=e+parseInt(i[0],16);return e=parseInt(i[1],16),{l:n,h:e}})}function XM(t,e){let r=0;for(let i=0;i<e.length;i++){let n=e[i];if(r+=n.l,t>=r&&t<=r+n.h&&(t-r)%(n.d||1)===0){if(n.e&&n.e.indexOf(t-r)!==-1)continue;return n}}return null}var kWe=ofe("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),NWe="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(t=>parseInt(t,16)),PWe=[{h:25,s:32,l:65},{h:30,s:32,e:[23],l:127},{h:54,s:1,e:[48],l:64,d:2},{h:14,s:1,l:57,d:2},{h:44,s:1,l:17,d:2},{h:10,s:1,e:[2,6,8],l:61,d:2},{h:16,s:1,l:68,d:2},{h:84,s:1,e:[18,24,66],l:19,d:2},{h:26,s:32,e:[17],l:435},{h:22,s:1,l:71,d:2},{h:15,s:80,l:40},{h:31,s:32,l:16},{h:32,s:1,l:80,d:2},{h:52,s:1,l:42,d:2},{h:12,s:1,l:55,d:2},{h:40,s:1,e:[38],l:15,d:2},{h:14,s:1,l:48,d:2},{h:37,s:48,l:49},{h:148,s:1,l:6351,d:2},{h:88,s:1,l:160,d:2},{h:15,s:16,l:704},{h:25,s:26,l:854},{h:25,s:32,l:55915},{h:37,s:40,l:1247},{h:25,s:-119711,l:53248},{h:25,s:-119763,l:52},{h:25,s:-119815,l:52},{h:25,s:-119867,e:[1,4,5,7,8,11,12,17],l:52},{h:25,s:-119919,l:52},{h:24,s:-119971,e:[2,7,8,17],l:52},{h:24,s:-120023,e:[2,7,13,15,16,17],l:52},{h:25,s:-120075,l:52},{h:25,s:-120127,l:52},{h:25,s:-120179,l:52},{h:25,s:-120231,l:52},{h:25,s:-120283,l:52},{h:25,s:-120335,l:52},{h:24,s:-119543,e:[17],l:56},{h:24,s:-119601,e:[17],l:58},{h:24,s:-119659,e:[17],l:58},{h:24,s:-119717,e:[17],l:58},{h:24,s:-119775,e:[17],l:58}],OWe=QM("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),MWe=QM("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),DWe=QM("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",RWe),LWe=ofe("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");function BWe(t){return t.reduce((e,r)=>(r.forEach(i=>{e.push(i)}),e),[])}function UWe(t){return!!XM(t,kWe)}function FWe(t){let e=XM(t,PWe);if(e)return[t+e.s];let r=OWe[t];if(r)return r;let i=MWe[t];if(i)return[t+i[0]];let n=DWe[t];return n||null}function jWe(t){return!!XM(t,LWe)}function eD(t){if(t.match(/^[a-z0-9-]*$/i)&&t.length<=59)return t.toLowerCase();let e=rp(t);e=BWe(e.map(i=>{if(NWe.indexOf(i)>=0)return[];if(i>=65024&&i<=65039)return[];let n=FWe(i);return n||[i]})),e=rp(C_(e),qs.NFKC),e.forEach(i=>{if(jWe(i))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")}),e.forEach(i=>{if(UWe(i))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")});let r=C_(e);if(r.substring(0,1)==="-"||r.substring(2,4)==="--"||r.substring(r.length-1)==="-")throw new Error("invalid hyphen");return r}var S_=class extends h5{constructor(e){super("string",e)}defaultValue(){return""}encode(e,r){return super.encode(e,fi(r))}decode(e){return ha(super.decode(e))}};var km=class extends Kn{constructor(e,r){let i=!1,n=[];e.forEach(s=>{s.dynamic&&(i=!0),n.push(s.type)});let o="tuple("+n.join(",")+")";super("tuple",o,r,i),this.coders=e}defaultValue(){let e=[];this.coders.forEach(i=>{e.push(i.defaultValue())});let r=this.coders.reduce((i,n)=>{let o=n.localName;return o&&(i[o]||(i[o]=0),i[o]++),i},{});return this.coders.forEach((i,n)=>{let o=i.localName;!o||r[o]!==1||(o==="length"&&(o="_length"),e[o]==null&&(e[o]=e[n]))}),Object.freeze(e)}encode(e,r){return zM(e,this.coders,r)}decode(e){return e.coerce(this.name,VM(e,this.coders))}};var I_=new fe(pf),$We=new RegExp(/^bytes([0-9]*)$/),WWe=new RegExp(/^(u?int)([0-9]*)$/),Ww=class{constructor(e){ye(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new f_(e.name);case"bool":return new p_(e.name);case"string":return new S_(e.name);case"bytes":return new m_(e.name);case"array":return new d_(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new km((e.components||[]).map(i=>this._getCoder(i)),e.name);case"":return new w_(e.name)}let r=e.type.match(WWe);if(r){let i=parseInt(r[2]||"256");return(i===0||i>256||i%8!==0)&&I_.throwArgumentError("invalid "+r[1]+" bit length","param",e),new E_(i/8,r[1]==="int",e.name)}if(r=e.type.match($We),r){let i=parseInt(r[1]);return(i===0||i>32)&&I_.throwArgumentError("invalid bytes length","param",e),new g_(i,e.name)}return I_.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,r){return new c_(e,this._getWordSize(),this.coerceFunc,r)}_getWriter(){return new Tm(this._getWordSize())}getDefaultValue(e){let r=e.map(n=>this._getCoder(Vo.from(n)));return new km(r,"_").defaultValue()}encode(e,r){e.length!==r.length&&I_.throwError("types/values length mismatch",fe.errors.INVALID_ARGUMENT,{count:{types:e.length,values:r.length},value:{types:e,values:r}});let i=e.map(s=>this._getCoder(Vo.from(s))),n=new km(i,"_"),o=this._getWriter();return n.encode(o,r),o.data}decode(e,r,i){let n=e.map(s=>this._getCoder(Vo.from(s)));return new km(n,"_").decode(this._getReader(ke(r),i))}},d5=new Ww;function tc(t){return jr(fi(t))}var T_="hash/5.7.0";var tD={};Mi(tD,{decode:()=>qw,encode:()=>Hw});function qw(t){t=atob(t);let e=[];for(let r=0;r<t.length;r++)e.push(t.charCodeAt(r));return ke(e)}function Hw(t){t=ke(t);let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function afe(t,e){e==null&&(e=1);let r=[],i=r.forEach,n=function(o,s){i.call(o,function(a){s>0&&Array.isArray(a)?n(a,s-1):r.push(a)})};return n(t,e),r}function qWe(t){let e={};for(let r=0;r<t.length;r++){let i=t[r];e[i[0]]=i[1]}return e}function HWe(t){let e=0;function r(){return t[e++]<<8|t[e++]}let i=r(),n=1,o=[0,1];for(let te=1;te<i;te++)o.push(n+=r());let s=r(),a=e;e+=s;let c=0,h=0;function g(){return c==0&&(h=h<<8|t[e++],c=8),h>>--c&1}let b=31,E=Math.pow(2,b),A=E>>>1,T=A>>1,P=E-1,L=0;for(let te=0;te<b;te++)L=L<<1|g();let j=[],$=0,G=E;for(;;){let te=Math.floor(((L-$+1)*n-1)/G),se=0,X=i;for(;X-se>1;){let V=se+X>>>1;te<o[V]?X=V:se=V}if(se==0)break;j.push(se);let k=$+Math.floor(G*o[se]/n),F=$+Math.floor(G*o[se+1]/n)-1;for(;((k^F)&A)==0;)L=L<<1&P|g(),k=k<<1&P,F=F<<1&P|1;for(;k&~F&T;)L=L&A|L<<1&P>>>1|g(),k=k<<1^A,F=(F^A)<<1|A|1;$=k,G=1+F-k}let Z=i-4;return j.map(te=>{switch(te-Z){case 3:return Z+65792+(t[a++]<<16|t[a++]<<8|t[a++]);case 2:return Z+256+(t[a++]<<8|t[a++]);case 1:return Z+t[a++];default:return te-1}})}function zWe(t){let e=0;return()=>t[e++]}function cfe(t){return zWe(HWe(t))}function VWe(t){return t&1?~t>>1:t>>1}function KWe(t,e){let r=Array(t);for(let i=0;i<t;i++)r[i]=1+e();return r}function sfe(t,e){let r=Array(t);for(let i=0,n=-1;i<t;i++)r[i]=n+=1+e();return r}function GWe(t,e){let r=Array(t);for(let i=0,n=0;i<t;i++)r[i]=n+=VWe(e());return r}function p5(t,e){let r=sfe(t(),t),i=t(),n=sfe(i,t),o=KWe(i,t);for(let s=0;s<i;s++)for(let a=0;a<o[s];a++)r.push(n[s]+a);return e?r.map(s=>e[s]):r}function lfe(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(YWe(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(JWe(r,t))}return qWe(afe(e))}function ZWe(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(r)}return e}function ufe(t,e,r){let i=Array(t).fill(void 0).map(()=>[]);for(let n=0;n<e;n++)GWe(t,r).forEach((o,s)=>i[s].push(o));return i}function YWe(t,e){let r=1+e(),i=e(),n=ZWe(e),o=ufe(n.length,1+t,e);return afe(o.map((s,a)=>{let c=s[0],h=s.slice(1);return Array(n[a]).fill(void 0).map((g,b)=>{let E=b*i;return[c+b*r,h.map(A=>A+E)]})}))}function JWe(t,e){let r=1+e();return ufe(r,1+t,e).map(n=>[n[0],n.slice(1)])}function ffe(t){let e=p5(t).sort((i,n)=>i-n);return r();function r(){let i=[];for(;;){let h=p5(t,e);if(h.length==0)break;i.push({set:new Set(h),node:r()})}i.sort((h,g)=>g.set.size-h.set.size);let n=t(),o=n%3;n=n/3|0;let s=!!(n&1);n>>=1;let a=n==1,c=n==2;return{branches:i,valid:o,fe0f:s,save:a,check:c}}}function hfe(){return cfe(qw("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}var R_=hfe(),QWe=new Set(p5(R_)),XWe=new Set(p5(R_)),eqe=lfe(R_),tqe=ffe(R_),dfe=45,pfe=95;function mfe(t){return rp(t)}function rqe(t){return t.filter(e=>e!=65039)}function gfe(t){for(let e of t.split(".")){let r=mfe(e);try{for(let i=r.lastIndexOf(pfe)-1;i>=0;i--)if(r[i]!==pfe)throw new Error("underscore only allowed at start");if(r.length>=4&&r.every(i=>i<128)&&r[2]===dfe&&r[3]===dfe)throw new Error("invalid label extension")}catch(i){throw new Error(`Invalid label "${e}": ${i.message}`)}}return t}function wfe(t){return gfe(iqe(t,rqe))}function iqe(t,e){let r=mfe(t).reverse(),i=[];for(;r.length;){let n=oqe(r);if(n){i.push(...e(n));continue}let o=r.pop();if(QWe.has(o)){i.push(o);continue}if(XWe.has(o))continue;let s=eqe[o];if(s){i.push(...s);continue}throw new Error(`Disallowed codepoint: 0x${o.toString(16).toUpperCase()}`)}return gfe(nqe(String.fromCodePoint(...i)))}function nqe(t){return t.normalize("NFC")}function oqe(t,e){var r;let i=tqe,n,o,s=[],a=t.length;for(e&&(e.length=0);a;){let c=t[--a];if(i=(r=i.branches.find(h=>h.set.has(c)))===null||r===void 0?void 0:r.node,!i)break;if(i.save)o=c;else if(i.check&&c===o)break;s.push(c),i.fe0f&&(s.push(65039),a>0&&t[a-1]==65039&&a--),i.valid&&(n=s.slice(),i.valid==2&&n.splice(1,1),e&&e.push(...t.slice(a).reverse()),t.length=a)}return n}var sqe=new fe(T_),bfe=new Uint8Array(32);bfe.fill(0);function vfe(t){if(t.length===0)throw new Error("invalid ENS name; empty component");return t}function rD(t){let e=fi(wfe(t)),r=[];if(t.length===0)return r;let i=0;for(let n=0;n<e.length;n++)e[n]===46&&(r.push(vfe(e.slice(i,n))),i=n+1);if(i>=e.length)throw new Error("invalid ENS name; empty component");return r.push(vfe(e.slice(i))),r}function iD(t){try{return rD(t).length!==0}catch{}return!1}function ip(t){typeof t!="string"&&sqe.throwArgumentError("invalid ENS name; not a string","name",t);let e=bfe,r=rD(t);for(;r.length;)e=jr(Fr([e,jr(r.pop())]));return De(e)}function m5(t){return De(Fr(rD(t).map(e=>{if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");let r=new Uint8Array(e.length+1);return r.set(e,1),r[0]=r.length-1,r})))+"00"}var yfe=`Ethereum Signed Message:
9976
9976
  `;function zw(t){return typeof t=="string"&&(t=fi(t)),jr(Fr([fi(yfe),fi(String(t.length)),t]))}var aqe=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},yn=new fe(T_),Afe=new Uint8Array(32);Afe.fill(0);var cqe=Ue.from(-1),Cfe=Ue.from(0),Sfe=Ue.from(1),lqe=Ue.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function uqe(t){let e=ke(t),r=e.length%32;return r?Vn([e,Afe.slice(r)]):De(e)}var fqe=Kr(Sfe.toHexString(),32),hqe=Kr(Cfe.toHexString(),32),xfe={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},nD=["name","version","chainId","verifyingContract","salt"];function _fe(t){return function(e){return typeof e!="string"&&yn.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}var dqe={name:_fe("name"),version:_fe("version"),chainId:function(t){try{return Ue.from(t).toString()}catch{}return yn.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return $r(t).toLowerCase()}catch{}return yn.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{let e=ke(t);if(e.length!==32)throw new Error("bad length");return De(e)}catch{}return yn.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function oD(t){{let e=t.match(/^(u?)int(\d*)$/);if(e){let r=e[1]==="",i=parseInt(e[2]||"256");(i%8!==0||i>256||e[2]&&e[2]!==String(i))&&yn.throwArgumentError("invalid numeric width","type",t);let n=lqe.mask(r?i-1:i),o=r?n.add(Sfe).mul(cqe):Cfe;return function(s){let a=Ue.from(s);return(a.lt(o)||a.gt(n))&&yn.throwArgumentError(`value out-of-bounds for ${t}`,"value",s),Kr(a.toTwos(256).toHexString(),32)}}}{let e=t.match(/^bytes(\d+)$/);if(e){let r=parseInt(e[1]);return(r===0||r>32||e[1]!==String(r))&&yn.throwArgumentError("invalid bytes width","type",t),function(i){return ke(i).length!==r&&yn.throwArgumentError(`invalid length for ${t}`,"value",i),uqe(i)}}}switch(t){case"address":return function(e){return Kr($r(e),32)};case"bool":return function(e){return e?fqe:hqe};case"bytes":return function(e){return jr(e)};case"string":return function(e){return tc(e)}}return null}function Efe(t,e){return`${t}(${e.map(({name:r,type:i})=>i+" "+r).join(",")})`}var Qc=class t{constructor(e){ye(this,"types",Object.freeze(vn(e))),ye(this,"_encoderCache",{}),ye(this,"_types",{});let r={},i={},n={};Object.keys(e).forEach(a=>{r[a]={},i[a]=[],n[a]={}});for(let a in e){let c={};e[a].forEach(h=>{c[h.name]&&yn.throwArgumentError(`duplicate variable name ${JSON.stringify(h.name)} in ${JSON.stringify(a)}`,"types",e),c[h.name]=!0;let g=h.type.match(/^([^\x5b]*)(\x5b|$)/)[1];g===a&&yn.throwArgumentError(`circular type reference to ${JSON.stringify(g)}`,"types",e),!oD(g)&&(i[g]||yn.throwArgumentError(`unknown type ${JSON.stringify(g)}`,"types",e),i[g].push(a),r[a][g]=!0)})}let o=Object.keys(i).filter(a=>i[a].length===0);o.length===0?yn.throwArgumentError("missing primary type","types",e):o.length>1&&yn.throwArgumentError(`ambiguous primary types or unused types: ${o.map(a=>JSON.stringify(a)).join(", ")}`,"types",e),ye(this,"primaryType",o[0]);function s(a,c){c[a]&&yn.throwArgumentError(`circular type reference to ${JSON.stringify(a)}`,"types",e),c[a]=!0,Object.keys(r[a]).forEach(h=>{i[h]&&(s(h,c),Object.keys(c).forEach(g=>{n[g][h]=!0}))}),delete c[a]}s(this.primaryType,{});for(let a in n){let c=Object.keys(n[a]);c.sort(),this._types[a]=Efe(a,e[a])+c.map(h=>Efe(h,e[h])).join("")}}getEncoder(e){let r=this._encoderCache[e];return r||(r=this._encoderCache[e]=this._getEncoder(e)),r}_getEncoder(e){{let n=oD(e);if(n)return n}let r=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){let n=r[1],o=this.getEncoder(n),s=parseInt(r[3]);return a=>{s>=0&&a.length!==s&&yn.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",a);let c=a.map(o);return this._types[n]&&(c=c.map(jr)),jr(Vn(c))}}let i=this.types[e];if(i){let n=tc(this._types[e]);return o=>{let s=i.map(({name:a,type:c})=>{let h=this.getEncoder(c)(o[a]);return this._types[c]?jr(h):h});return s.unshift(n),Vn(s)}}return yn.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){let r=this._types[e];return r||yn.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),r}encodeData(e,r){return this.getEncoder(e)(r)}hashStruct(e,r){return jr(this.encodeData(e,r))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,r,i){if(oD(e))return i(e,r);let n=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){let s=n[1],a=parseInt(n[3]);return a>=0&&r.length!==a&&yn.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",r),r.map(c=>this._visit(s,c,i))}let o=this.types[e];return o?o.reduce((s,{name:a,type:c})=>(s[a]=this._visit(c,r[a],i),s),{}):yn.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,r){return this._visit(this.primaryType,e,r)}static from(e){return new t(e)}static getPrimaryType(e){return t.from(e).primaryType}static hashStruct(e,r,i){return t.from(r).hashStruct(e,i)}static hashDomain(e){let r=[];for(let i in e){let n=xfe[i];n||yn.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(i)}`,"domain",e),r.push({name:i,type:n})}return r.sort((i,n)=>nD.indexOf(i.name)-nD.indexOf(n.name)),t.hashStruct("EIP712Domain",{EIP712Domain:r},e)}static encode(e,r,i){return Vn(["0x1901",t.hashDomain(e),t.from(r).hash(i)])}static hash(e,r,i){return jr(t.encode(e,r,i))}static resolveNames(e,r,i,n){return aqe(this,void 0,void 0,function*(){e=pi(e);let o={};e.verifyingContract&&!Zt(e.verifyingContract,20)&&(o[e.verifyingContract]="0x");let s=t.from(r);s.visit(i,(a,c)=>(a==="address"&&!Zt(c,20)&&(o[c]="0x"),c));for(let a in o)o[a]=yield n(a);return e.verifyingContract&&o[e.verifyingContract]&&(e.verifyingContract=o[e.verifyingContract]),i=s.visit(i,(a,c)=>a==="address"&&o[c]?o[c]:c),{domain:e,value:i}})}static getPayload(e,r,i){t.hashDomain(e);let n={},o=[];nD.forEach(c=>{let h=e[c];h!=null&&(n[c]=dqe[c](h),o.push({name:c,type:xfe[c]}))});let s=t.from(r),a=pi(r);return a.EIP712Domain?yn.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",r):a.EIP712Domain=o,s.encode(i),{types:a,domain:n,primaryType:s.primaryType,message:s.visit(i,(c,h)=>{if(c.match(/^bytes(\d*)/))return De(ke(h));if(c.match(/^u?int/))return Ue.from(h).toString();switch(c){case"address":return h.toLowerCase();case"bool":return!!h;case"string":return typeof h!="string"&&yn.throwArgumentError("invalid string","value",h),h}return yn.throwArgumentError("unsupported type","type",c)})}}};var xn=new fe(pf);var Vw=class extends ec{},Kw=class extends ec{},sD=class extends ec{},ch=class extends ec{static isIndexed(e){return!!(e&&e._isIndexed)}},pqe={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function Ife(t,e){let r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return r.error=e,r}var np=class{constructor(e){let r=[];typeof e=="string"?r=JSON.parse(e):r=e,ye(this,"fragments",r.map(i=>mf.from(i)).filter(i=>i!=null)),ye(this,"_abiCoder",bn(new.target,"getAbiCoder")()),ye(this,"functions",{}),ye(this,"errors",{}),ye(this,"events",{}),ye(this,"structs",{}),this.fragments.forEach(i=>{let n=null;switch(i.type){case"constructor":if(this.deploy){xn.warn("duplicate definition - constructor");return}ye(this,"deploy",i);return;case"function":n=this.functions;break;case"event":n=this.events;break;case"error":n=this.errors;break;default:return}let o=i.format();if(n[o]){xn.warn("duplicate definition - "+o);return}n[o]=i}),this.deploy||ye(this,"deploy",gf.from({payable:!1,type:"constructor"})),ye(this,"_isInterface",!0)}format(e){e||(e=si.full),e===si.sighash&&xn.throwArgumentError("interface does not support formatting sighash","format",e);let r=this.fragments.map(i=>i.format(e));return e===si.json?JSON.stringify(r.map(i=>JSON.parse(i))):r}static getAbiCoder(){return d5}static getAddress(e){return $r(e)}static getSighash(e){return ji(tc(e.format()),0,4)}static getEventTopic(e){return tc(e.format())}getFunction(e){if(Zt(e)){for(let i in this.functions)if(e===this.getSighash(i))return this.functions[i];xn.throwArgumentError("no matching function","sighash",e)}if(e.indexOf("(")===-1){let i=e.trim(),n=Object.keys(this.functions).filter(o=>o.split("(")[0]===i);return n.length===0?xn.throwArgumentError("no matching function","name",i):n.length>1&&xn.throwArgumentError("multiple matching functions","name",i),this.functions[n[0]]}let r=this.functions[wf.fromString(e).format()];return r||xn.throwArgumentError("no matching function","signature",e),r}getEvent(e){if(Zt(e)){let i=e.toLowerCase();for(let n in this.events)if(i===this.getEventTopic(n))return this.events[n];xn.throwArgumentError("no matching event","topichash",i)}if(e.indexOf("(")===-1){let i=e.trim(),n=Object.keys(this.events).filter(o=>o.split("(")[0]===i);return n.length===0?xn.throwArgumentError("no matching event","name",i):n.length>1&&xn.throwArgumentError("multiple matching events","name",i),this.events[n[0]]}let r=this.events[sh.fromString(e).format()];return r||xn.throwArgumentError("no matching event","signature",e),r}getError(e){if(Zt(e)){let i=bn(this.constructor,"getSighash");for(let n in this.errors){let o=this.errors[n];if(e===i(o))return this.errors[n]}xn.throwArgumentError("no matching error","sighash",e)}if(e.indexOf("(")===-1){let i=e.trim(),n=Object.keys(this.errors).filter(o=>o.split("(")[0]===i);return n.length===0?xn.throwArgumentError("no matching error","name",i):n.length>1&&xn.throwArgumentError("multiple matching errors","name",i),this.errors[n[0]]}let r=this.errors[wf.fromString(e).format()];return r||xn.throwArgumentError("no matching error","signature",e),r}getSighash(e){if(typeof e=="string")try{e=this.getFunction(e)}catch(r){try{e=this.getError(e)}catch{throw r}}return bn(this.constructor,"getSighash")(e)}getEventTopic(e){return typeof e=="string"&&(e=this.getEvent(e)),bn(this.constructor,"getEventTopic")(e)}_decodeParams(e,r){return this._abiCoder.decode(e,r)}_encodeParams(e,r){return this._abiCoder.encode(e,r)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,r){typeof e=="string"&&(e=this.getError(e));let i=ke(r);return De(i.slice(0,4))!==this.getSighash(e)&&xn.throwArgumentError(`data signature does not match error ${e.name}.`,"data",De(i)),this._decodeParams(e.inputs,i.slice(4))}encodeErrorResult(e,r){return typeof e=="string"&&(e=this.getError(e)),De(Fr([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionData(e,r){typeof e=="string"&&(e=this.getFunction(e));let i=ke(r);return De(i.slice(0,4))!==this.getSighash(e)&&xn.throwArgumentError(`data signature does not match function ${e.name}.`,"data",De(i)),this._decodeParams(e.inputs,i.slice(4))}encodeFunctionData(e,r){return typeof e=="string"&&(e=this.getFunction(e)),De(Fr([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionResult(e,r){typeof e=="string"&&(e=this.getFunction(e));let i=ke(r),n=null,o="",s=null,a=null,c=null;switch(i.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,i)}catch{}break;case 4:{let h=De(i.slice(0,4)),g=pqe[h];if(g)s=this._abiCoder.decode(g.inputs,i.slice(4)),a=g.name,c=g.signature,g.reason&&(n=s[0]),a==="Error"?o=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(s[0])}`:a==="Panic"&&(o=`; VM Exception while processing transaction: reverted with panic code ${s[0]}`);else try{let b=this.getError(h);s=this._abiCoder.decode(b.inputs,i.slice(4)),a=b.name,c=b.format()}catch{}break}}return xn.throwError("call revert exception"+o,fe.errors.CALL_EXCEPTION,{method:e.format(),data:De(r),errorArgs:s,errorName:a,errorSignature:c,reason:n})}encodeFunctionResult(e,r){return typeof e=="string"&&(e=this.getFunction(e)),De(this._abiCoder.encode(e.outputs,r||[]))}encodeFilterTopics(e,r){typeof e=="string"&&(e=this.getEvent(e)),r.length>e.inputs.length&&xn.throwError("too many arguments for "+e.format(),fe.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:r});let i=[];e.anonymous||i.push(this.getEventTopic(e));let n=(o,s)=>o.type==="string"?tc(s):o.type==="bytes"?jr(De(s)):(o.type==="bool"&&typeof s=="boolean"&&(s=s?"0x01":"0x00"),o.type.match(/^u?int/)&&(s=Ue.from(s).toHexString()),o.type==="address"&&this._abiCoder.encode(["address"],[s]),Kr(De(s),32));for(r.forEach((o,s)=>{let a=e.inputs[s];if(!a.indexed){o!=null&&xn.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+a.name,o);return}o==null?i.push(null):a.baseType==="array"||a.baseType==="tuple"?xn.throwArgumentError("filtering with tuples or arrays not supported","contract."+a.name,o):Array.isArray(o)?i.push(o.map(c=>n(a,c))):i.push(n(a,o))});i.length&&i[i.length-1]===null;)i.pop();return i}encodeEventLog(e,r){typeof e=="string"&&(e=this.getEvent(e));let i=[],n=[],o=[];return e.anonymous||i.push(this.getEventTopic(e)),r.length!==e.inputs.length&&xn.throwArgumentError("event arguments/values mismatch","values",r),e.inputs.forEach((s,a)=>{let c=r[a];if(s.indexed)if(s.type==="string")i.push(tc(c));else if(s.type==="bytes")i.push(jr(c));else{if(s.baseType==="tuple"||s.baseType==="array")throw new Error("not implemented");i.push(this._abiCoder.encode([s.type],[c]))}else n.push(s),o.push(c)}),{data:this._abiCoder.encode(n,o),topics:i}}decodeEventLog(e,r,i){if(typeof e=="string"&&(e=this.getEvent(e)),i!=null&&!e.anonymous){let E=this.getEventTopic(e);(!Zt(i[0],32)||i[0].toLowerCase()!==E)&&xn.throwError("fragment/topic mismatch",fe.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:E,value:i[0]}),i=i.slice(1)}let n=[],o=[],s=[];e.inputs.forEach((E,A)=>{E.indexed?E.type==="string"||E.type==="bytes"||E.baseType==="tuple"||E.baseType==="array"?(n.push(Vo.fromObject({type:"bytes32",name:E.name})),s.push(!0)):(n.push(E),s.push(!1)):(o.push(E),s.push(!1))});let a=i!=null?this._abiCoder.decode(n,Fr(i)):null,c=this._abiCoder.decode(o,r,!0),h=[],g=0,b=0;e.inputs.forEach((E,A)=>{if(E.indexed)if(a==null)h[A]=new ch({_isIndexed:!0,hash:null});else if(s[A])h[A]=new ch({_isIndexed:!0,hash:a[b++]});else try{h[A]=a[b++]}catch(T){h[A]=T}else try{h[A]=c[g++]}catch(T){h[A]=T}if(E.name&&h[E.name]==null){let T=h[A];T instanceof Error?Object.defineProperty(h,E.name,{enumerable:!0,get:()=>{throw Ife(`property ${JSON.stringify(E.name)}`,T)}}):h[E.name]=T}});for(let E=0;E<h.length;E++){let A=h[E];A instanceof Error&&Object.defineProperty(h,E,{enumerable:!0,get:()=>{throw Ife(`index ${E}`,A)}})}return Object.freeze(h)}parseTransaction(e){let r=this.getFunction(e.data.substring(0,10).toLowerCase());return r?new Kw({args:this._abiCoder.decode(r.inputs,"0x"+e.data.substring(10)),functionFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r),value:Ue.from(e.value||"0")}):null}parseLog(e){let r=this.getEvent(e.topics[0]);return!r||r.anonymous?null:new Vw({eventFragment:r,name:r.name,signature:r.format(),topic:this.getEventTopic(r),args:this.decodeEventLog(r,e.data,e.topics)})}parseError(e){let r=De(e),i=this.getError(r.substring(0,10).toLowerCase());return i?new sD({args:this._abiCoder.decode(i.inputs,"0x"+r.substring(10)),errorFragment:i,name:i.name,signature:i.format(),sighash:this.getSighash(i)}):null}static isInterface(e){return!!(e&&e._isInterface)}};var Tfe="abstract-provider/5.7.0";var mqe=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},gqe=new fe(Tfe),k_=class extends ec{static isForkEvent(e){return!!(e&&e._isForkEvent)}};var Xc=class t{constructor(){gqe.checkAbstract(new.target,t),ye(this,"_isProvider",!0)}getFeeData(){return mqe(this,void 0,void 0,function*(){let{block:e,gasPrice:r}=yield $i({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch(s=>null)}),i=null,n=null,o=null;return e&&e.baseFeePerGas&&(i=e.baseFeePerGas,o=Ue.from("1500000000"),n=e.baseFeePerGas.mul(2).add(o)),{lastBaseFeePerGas:i,maxFeePerGas:n,maxPriorityFeePerGas:o,gasPrice:r}})}addListener(e,r){return this.on(e,r)}removeListener(e,r){return this.off(e,r)}static isProvider(e){return!!(e&&e._isProvider)}};var Rfe="abstract-signer/5.7.0";var zl=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},el=new fe(Rfe),wqe=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],vqe=[fe.errors.INSUFFICIENT_FUNDS,fe.errors.NONCE_EXPIRED,fe.errors.REPLACEMENT_UNDERPRICED],rc=class t{constructor(){el.checkAbstract(new.target,t),ye(this,"_isSigner",!0)}getBalance(e){return zl(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)})}getTransactionCount(e){return zl(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)})}estimateGas(e){return zl(this,void 0,void 0,function*(){this._checkProvider("estimateGas");let r=yield $i(this.checkTransaction(e));return yield this.provider.estimateGas(r)})}call(e,r){return zl(this,void 0,void 0,function*(){this._checkProvider("call");let i=yield $i(this.checkTransaction(e));return yield this.provider.call(i,r)})}sendTransaction(e){return zl(this,void 0,void 0,function*(){this._checkProvider("sendTransaction");let r=yield this.populateTransaction(e),i=yield this.signTransaction(r);return yield this.provider.sendTransaction(i)})}getChainId(){return zl(this,void 0,void 0,function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId})}getGasPrice(){return zl(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return zl(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(e){return zl(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)})}checkTransaction(e){for(let i in e)wqe.indexOf(i)===-1&&el.throwArgumentError("invalid transaction key: "+i,"transaction",e);let r=pi(e);return r.from==null?r.from=this.getAddress():r.from=Promise.all([Promise.resolve(r.from),this.getAddress()]).then(i=>(i[0].toLowerCase()!==i[1].toLowerCase()&&el.throwArgumentError("from address mismatch","transaction",e),i[0])),r}populateTransaction(e){return zl(this,void 0,void 0,function*(){let r=yield $i(this.checkTransaction(e));r.to!=null&&(r.to=Promise.resolve(r.to).then(n=>zl(this,void 0,void 0,function*(){if(n==null)return null;let o=yield this.resolveName(n);return o==null&&el.throwArgumentError("provided ENS name resolves to null","tx.to",n),o})),r.to.catch(n=>{}));let i=r.maxFeePerGas!=null||r.maxPriorityFeePerGas!=null;if(r.gasPrice!=null&&(r.type===2||i)?el.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e):(r.type===0||r.type===1)&&i&&el.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e),(r.type===2||r.type==null)&&r.maxFeePerGas!=null&&r.maxPriorityFeePerGas!=null)r.type=2;else if(r.type===0||r.type===1)r.gasPrice==null&&(r.gasPrice=this.getGasPrice());else{let n=yield this.getFeeData();if(r.type==null)if(n.maxFeePerGas!=null&&n.maxPriorityFeePerGas!=null)if(r.type=2,r.gasPrice!=null){let o=r.gasPrice;delete r.gasPrice,r.maxFeePerGas=o,r.maxPriorityFeePerGas=o}else r.maxFeePerGas==null&&(r.maxFeePerGas=n.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=n.maxPriorityFeePerGas);else n.gasPrice!=null?(i&&el.throwError("network does not support EIP-1559",fe.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),r.gasPrice==null&&(r.gasPrice=n.gasPrice),r.type=0):el.throwError("failed to get consistent fee data",fe.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else r.type===2&&(r.maxFeePerGas==null&&(r.maxFeePerGas=n.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=n.maxPriorityFeePerGas))}return r.nonce==null&&(r.nonce=this.getTransactionCount("pending")),r.gasLimit==null&&(r.gasLimit=this.estimateGas(r).catch(n=>{if(vqe.indexOf(n.code)>=0)throw n;return el.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",fe.errors.UNPREDICTABLE_GAS_LIMIT,{error:n,tx:r})})),r.chainId==null?r.chainId=this.getChainId():r.chainId=Promise.all([Promise.resolve(r.chainId),this.getChainId()]).then(n=>(n[1]!==0&&n[0]!==n[1]&&el.throwArgumentError("chainId address mismatch","transaction",e),n[0])),yield $i(r)})}_checkProvider(e){this.provider||el.throwError("missing provider",fe.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!!(e&&e._isSigner)}},Nm=class t extends rc{constructor(e,r){super(),ye(this,"address",e),ye(this,"provider",r||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,r){return Promise.resolve().then(()=>{el.throwError(e,fe.errors.UNSUPPORTED_OPERATION,{operation:r})})}signMessage(e){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(e){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(e,r,i){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(e){return new t(this.address,e)}};var kr=Wt(MM()),Cf=Wt(gD());function t3(t,e,r){return r={path:e,exports:{},require:function(i,n){return $He(i,n??r.path)}},t(r,r.exports),r.exports}function $He(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var yD=h0e;function h0e(t,e){if(!t)throw new Error(e||"Assertion failed")}h0e.equal=function(e,r,i){if(e!=r)throw new Error(i||"Assertion failed: "+e+" != "+r)};var Zl=t3(function(t,e){"use strict";var r=e;function i(s,a){if(Array.isArray(s))return s.slice();if(!s)return[];var c=[];if(typeof s!="string"){for(var h=0;h<s.length;h++)c[h]=s[h]|0;return c}if(a==="hex"){s=s.replace(/[^a-z0-9]+/ig,""),s.length%2!==0&&(s="0"+s);for(var h=0;h<s.length;h+=2)c.push(parseInt(s[h]+s[h+1],16))}else for(var h=0;h<s.length;h++){var g=s.charCodeAt(h),b=g>>8,E=g&255;b?c.push(b,E):c.push(E)}return c}r.toArray=i;function n(s){return s.length===1?"0"+s:s}r.zero2=n;function o(s){for(var a="",c=0;c<s.length;c++)a+=n(s[c].toString(16));return a}r.toHex=o,r.encode=function(a,c){return c==="hex"?o(a):a}}),nc=t3(function(t,e){"use strict";var r=e;r.assert=yD,r.toArray=Zl.toArray,r.zero2=Zl.zero2,r.toHex=Zl.toHex,r.encode=Zl.encode;function i(c,h,g){var b=new Array(Math.max(c.bitLength(),g)+1);b.fill(0);for(var E=1<<h+1,A=c.clone(),T=0;T<b.length;T++){var P,L=A.andln(E-1);A.isOdd()?(L>(E>>1)-1?P=(E>>1)-L:P=L,A.isubn(P)):P=0,b[T]=P,A.iushrn(1)}return b}r.getNAF=i;function n(c,h){var g=[[],[]];c=c.clone(),h=h.clone();for(var b=0,E=0,A;c.cmpn(-b)>0||h.cmpn(-E)>0;){var T=c.andln(3)+b&3,P=h.andln(3)+E&3;T===3&&(T=-1),P===3&&(P=-1);var L;(T&1)===0?L=0:(A=c.andln(7)+b&7,(A===3||A===5)&&P===2?L=-T:L=T),g[0].push(L);var j;(P&1)===0?j=0:(A=h.andln(7)+E&7,(A===3||A===5)&&T===2?j=-P:j=P),g[1].push(j),2*b===L+1&&(b=1-b),2*E===j+1&&(E=1-E),c.iushrn(1),h.iushrn(1)}return g}r.getJSF=n;function o(c,h,g){var b="_"+h;c.prototype[h]=function(){return this[b]!==void 0?this[b]:this[b]=g.call(this)}}r.cachedProperty=o;function s(c){return typeof c=="string"?r.toArray(c,"hex"):c}r.parseBytes=s;function a(c){return new kr.default(c,"hex","le")}r.intFromLE=a}),D_=nc.getNAF,WHe=nc.getJSF,L_=nc.assert;function ap(t,e){this.type=t,this.p=new kr.default(e.p,16),this.red=e.prime?kr.default.red(e.prime):kr.default.mont(this.p),this.zero=new kr.default(0).toRed(this.red),this.one=new kr.default(1).toRed(this.red),this.two=new kr.default(2).toRed(this.red),this.n=e.n&&new kr.default(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Om=ap;ap.prototype.point=function(){throw new Error("Not implemented")};ap.prototype.validate=function(){throw new Error("Not implemented")};ap.prototype._fixedNafMul=function(e,r){L_(e.precomputed);var i=e._getDoubles(),n=D_(r,1,this._bitLength),o=(1<<i.step+1)-(i.step%2===0?2:1);o/=3;var s=[],a,c;for(a=0;a<n.length;a+=i.step){c=0;for(var h=a+i.step-1;h>=a;h--)c=(c<<1)+n[h];s.push(c)}for(var g=this.jpoint(null,null,null),b=this.jpoint(null,null,null),E=o;E>0;E--){for(a=0;a<s.length;a++)c=s[a],c===E?b=b.mixedAdd(i.points[a]):c===-E&&(b=b.mixedAdd(i.points[a].neg()));g=g.add(b)}return g.toP()};ap.prototype._wnafMul=function(e,r){var i=4,n=e._getNAFPoints(i);i=n.wnd;for(var o=n.points,s=D_(r,i,this._bitLength),a=this.jpoint(null,null,null),c=s.length-1;c>=0;c--){for(var h=0;c>=0&&s[c]===0;c--)h++;if(c>=0&&h++,a=a.dblp(h),c<0)break;var g=s[c];L_(g!==0),e.type==="affine"?g>0?a=a.mixedAdd(o[g-1>>1]):a=a.mixedAdd(o[-g-1>>1].neg()):g>0?a=a.add(o[g-1>>1]):a=a.add(o[-g-1>>1].neg())}return e.type==="affine"?a.toP():a};ap.prototype._wnafMulAdd=function(e,r,i,n,o){var s=this._wnafT1,a=this._wnafT2,c=this._wnafT3,h=0,g,b,E;for(g=0;g<n;g++){E=r[g];var A=E._getNAFPoints(e);s[g]=A.wnd,a[g]=A.points}for(g=n-1;g>=1;g-=2){var T=g-1,P=g;if(s[T]!==1||s[P]!==1){c[T]=D_(i[T],s[T],this._bitLength),c[P]=D_(i[P],s[P],this._bitLength),h=Math.max(c[T].length,h),h=Math.max(c[P].length,h);continue}var L=[r[T],null,null,r[P]];r[T].y.cmp(r[P].y)===0?(L[1]=r[T].add(r[P]),L[2]=r[T].toJ().mixedAdd(r[P].neg())):r[T].y.cmp(r[P].y.redNeg())===0?(L[1]=r[T].toJ().mixedAdd(r[P]),L[2]=r[T].add(r[P].neg())):(L[1]=r[T].toJ().mixedAdd(r[P]),L[2]=r[T].toJ().mixedAdd(r[P].neg()));var j=[-3,-1,-5,-7,0,7,5,1,3],$=WHe(i[T],i[P]);for(h=Math.max($[0].length,h),c[T]=new Array(h),c[P]=new Array(h),b=0;b<h;b++){var G=$[0][b]|0,Z=$[1][b]|0;c[T][b]=j[(G+1)*3+(Z+1)],c[P][b]=0,a[T]=L}}var te=this.jpoint(null,null,null),se=this._wnafT4;for(g=h;g>=0;g--){for(var X=0;g>=0;){var k=!0;for(b=0;b<n;b++)se[b]=c[b][g]|0,se[b]!==0&&(k=!1);if(!k)break;X++,g--}if(g>=0&&X++,te=te.dblp(X),g<0)break;for(b=0;b<n;b++){var F=se[b];F!==0&&(F>0?E=a[b][F-1>>1]:F<0&&(E=a[b][-F-1>>1].neg()),E.type==="affine"?te=te.mixedAdd(E):te=te.add(E))}}for(g=0;g<n;g++)a[g]=null;return o?te:te.toP()};function rl(t,e){this.curve=t,this.type=e,this.precomputed=null}ap.BasePoint=rl;rl.prototype.eq=function(){throw new Error("Not implemented")};rl.prototype.validate=function(){return this.curve.validate(this)};ap.prototype.decodePoint=function(e,r){e=nc.toArray(e,r);var i=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1===2*i){e[0]===6?L_(e[e.length-1]%2===0):e[0]===7&&L_(e[e.length-1]%2===1);var n=this.point(e.slice(1,1+i),e.slice(1+i,1+2*i));return n}else if((e[0]===2||e[0]===3)&&e.length-1===i)return this.pointFromX(e.slice(1,1+i),e[0]===3);throw new Error("Unknown point format")};rl.prototype.encodeCompressed=function(e){return this.encode(e,!0)};rl.prototype._encode=function(e){var r=this.curve.p.byteLength(),i=this.getX().toArray("be",r);return e?[this.getY().isEven()?2:3].concat(i):[4].concat(i,this.getY().toArray("be",r))};rl.prototype.encode=function(e,r){return nc.encode(this._encode(r),e)};rl.prototype.precompute=function(e){if(this.precomputed)return this;var r={doubles:null,naf:null,beta:null};return r.naf=this._getNAFPoints(8),r.doubles=this._getDoubles(4,e),r.beta=this._getBeta(),this.precomputed=r,this};rl.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var r=this.precomputed.doubles;return r?r.points.length>=Math.ceil((e.bitLength()+1)/r.step):!1};rl.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var i=[this],n=this,o=0;o<r;o+=e){for(var s=0;s<e;s++)n=n.dbl();i.push(n)}return{step:e,points:i}};rl.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var r=[this],i=(1<<e)-1,n=i===1?null:this.dbl(),o=1;o<i;o++)r[o]=r[o-1].add(n);return{wnd:e,points:r}};rl.prototype._getBeta=function(){return null};rl.prototype.dblp=function(e){for(var r=this,i=0;i<e;i++)r=r.dbl();return r};var xD=t3(function(t){typeof Object.create=="function"?t.exports=function(r,i){i&&(r.super_=i,r.prototype=Object.create(i.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(r,i){if(i){r.super_=i;var n=function(){};n.prototype=i.prototype,r.prototype=new n,r.prototype.constructor=r}}}),qHe=nc.assert;function il(t){Om.call(this,"short",t),this.a=new kr.default(t.a,16).toRed(this.red),this.b=new kr.default(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}xD(il,Om);var HHe=il;il.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var r,i;if(e.beta)r=new kr.default(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);r=n[0].cmp(n[1])<0?n[0]:n[1],r=r.toRed(this.red)}if(e.lambda)i=new kr.default(e.lambda,16);else{var o=this._getEndoRoots(this.n);this.g.mul(o[0]).x.cmp(this.g.x.redMul(r))===0?i=o[0]:(i=o[1],qHe(this.g.mul(i).x.cmp(this.g.x.redMul(r))===0))}var s;return e.basis?s=e.basis.map(function(a){return{a:new kr.default(a.a,16),b:new kr.default(a.b,16)}}):s=this._getEndoBasis(i),{beta:r,lambda:i,basis:s}}};il.prototype._getEndoRoots=function(e){var r=e===this.p?this.red:kr.default.mont(e),i=new kr.default(2).toRed(r).redInvm(),n=i.redNeg(),o=new kr.default(3).toRed(r).redNeg().redSqrt().redMul(i),s=n.redAdd(o).fromRed(),a=n.redSub(o).fromRed();return[s,a]};il.prototype._getEndoBasis=function(e){for(var r=this.n.ushrn(Math.floor(this.n.bitLength()/2)),i=e,n=this.n.clone(),o=new kr.default(1),s=new kr.default(0),a=new kr.default(0),c=new kr.default(1),h,g,b,E,A,T,P,L=0,j,$;i.cmpn(0)!==0;){var G=n.div(i);j=n.sub(G.mul(i)),$=a.sub(G.mul(o));var Z=c.sub(G.mul(s));if(!b&&j.cmp(r)<0)h=P.neg(),g=o,b=j.neg(),E=$;else if(b&&++L===2)break;P=j,n=i,i=j,a=o,o=$,c=s,s=Z}A=j.neg(),T=$;var te=b.sqr().add(E.sqr()),se=A.sqr().add(T.sqr());return se.cmp(te)>=0&&(A=h,T=g),b.negative&&(b=b.neg(),E=E.neg()),A.negative&&(A=A.neg(),T=T.neg()),[{a:b,b:E},{a:A,b:T}]};il.prototype._endoSplit=function(e){var r=this.endo.basis,i=r[0],n=r[1],o=n.b.mul(e).divRound(this.n),s=i.b.neg().mul(e).divRound(this.n),a=o.mul(i.a),c=s.mul(n.a),h=o.mul(i.b),g=s.mul(n.b),b=e.sub(a).sub(c),E=h.add(g).neg();return{k1:b,k2:E}};il.prototype.pointFromX=function(e,r){e=new kr.default(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=i.redSqrt();if(n.redSqr().redSub(i).cmp(this.zero)!==0)throw new Error("invalid point");var o=n.fromRed().isOdd();return(r&&!o||!r&&o)&&(n=n.redNeg()),this.point(e,n)};il.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,i=e.y,n=this.a.redMul(r),o=r.redSqr().redMul(r).redIAdd(n).redIAdd(this.b);return i.redSqr().redISub(o).cmpn(0)===0};il.prototype._endoWnafMulAdd=function(e,r,i){for(var n=this._endoWnafT1,o=this._endoWnafT2,s=0;s<e.length;s++){var a=this._endoSplit(r[s]),c=e[s],h=c._getBeta();a.k1.negative&&(a.k1.ineg(),c=c.neg(!0)),a.k2.negative&&(a.k2.ineg(),h=h.neg(!0)),n[s*2]=c,n[s*2+1]=h,o[s*2]=a.k1,o[s*2+1]=a.k2}for(var g=this._wnafMulAdd(1,n,o,s*2,i),b=0;b<s*2;b++)n[b]=null,o[b]=null;return g};function _o(t,e,r,i){Om.BasePoint.call(this,t,"affine"),e===null&&r===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new kr.default(e,16),this.y=new kr.default(r,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}xD(_o,Om.BasePoint);il.prototype.point=function(e,r,i){return new _o(this,e,r,i)};il.prototype.pointFromJSON=function(e,r){return _o.fromJSON(this,e,r)};_o.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var r=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var i=this.curve,n=function(o){return i.point(o.x.redMul(i.endo.beta),o.y)};e.beta=r,r.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return r}};_o.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]};_o.fromJSON=function(e,r,i){typeof r=="string"&&(r=JSON.parse(r));var n=e.point(r[0],r[1],i);if(!r[2])return n;function o(a){return e.point(a[0],a[1],i)}var s=r[2];return n.precomputed={beta:null,doubles:s.doubles&&{step:s.doubles.step,points:[n].concat(s.doubles.points.map(o))},naf:s.naf&&{wnd:s.naf.wnd,points:[n].concat(s.naf.points.map(o))}},n};_o.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"};_o.prototype.isInfinity=function(){return this.inf};_o.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var i=r.redSqr().redISub(this.x).redISub(e.x),n=r.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,n)};_o.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,i=this.x.redSqr(),n=e.redInvm(),o=i.redAdd(i).redIAdd(i).redIAdd(r).redMul(n),s=o.redSqr().redISub(this.x.redAdd(this.x)),a=o.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,a)};_o.prototype.getX=function(){return this.x.fromRed()};_o.prototype.getY=function(){return this.y.fromRed()};_o.prototype.mul=function(e){return e=new kr.default(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};_o.prototype.mulAdd=function(e,r,i){var n=[this,r],o=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,o):this.curve._wnafMulAdd(1,n,o,2)};_o.prototype.jmulAdd=function(e,r,i){var n=[this,r],o=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,o,!0):this.curve._wnafMulAdd(1,n,o,2,!0)};_o.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};_o.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var i=this.precomputed,n=function(o){return o.neg()};r.precomputed={naf:i.naf&&{wnd:i.naf.wnd,points:i.naf.points.map(n)},doubles:i.doubles&&{step:i.doubles.step,points:i.doubles.points.map(n)}}}return r};_o.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Go(t,e,r,i){Om.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new kr.default(0)):(this.x=new kr.default(e,16),this.y=new kr.default(r,16),this.z=new kr.default(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}xD(Go,Om.BasePoint);il.prototype.jpoint=function(e,r,i){return new Go(this,e,r,i)};Go.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),i=this.x.redMul(r),n=this.y.redMul(r).redMul(e);return this.curve.point(i,n)};Go.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Go.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),i=this.z.redSqr(),n=this.x.redMul(r),o=e.x.redMul(i),s=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(i.redMul(this.z)),c=n.redSub(o),h=s.redSub(a);if(c.cmpn(0)===0)return h.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var g=c.redSqr(),b=g.redMul(c),E=n.redMul(g),A=h.redSqr().redIAdd(b).redISub(E).redISub(E),T=h.redMul(E.redISub(A)).redISub(s.redMul(b)),P=this.z.redMul(e.z).redMul(c);return this.curve.jpoint(A,T,P)};Go.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),i=this.x,n=e.x.redMul(r),o=this.y,s=e.y.redMul(r).redMul(this.z),a=i.redSub(n),c=o.redSub(s);if(a.cmpn(0)===0)return c.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var h=a.redSqr(),g=h.redMul(a),b=i.redMul(h),E=c.redSqr().redIAdd(g).redISub(b).redISub(b),A=c.redMul(b.redISub(E)).redISub(o.redMul(g)),T=this.z.redMul(a);return this.curve.jpoint(E,A,T)};Go.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var i=this;for(r=0;r<e;r++)i=i.dbl();return i}var n=this.curve.a,o=this.curve.tinv,s=this.x,a=this.y,c=this.z,h=c.redSqr().redSqr(),g=a.redAdd(a);for(r=0;r<e;r++){var b=s.redSqr(),E=g.redSqr(),A=E.redSqr(),T=b.redAdd(b).redIAdd(b).redIAdd(n.redMul(h)),P=s.redMul(E),L=T.redSqr().redISub(P.redAdd(P)),j=P.redISub(L),$=T.redMul(j);$=$.redIAdd($).redISub(A);var G=g.redMul(c);r+1<e&&(h=h.redMul(A)),s=L,c=G,g=$}return this.curve.jpoint(s,g.redMul(o),c)};Go.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()};Go.prototype._zeroDbl=function(){var e,r,i;if(this.zOne){var n=this.x.redSqr(),o=this.y.redSqr(),s=o.redSqr(),a=this.x.redAdd(o).redSqr().redISub(n).redISub(s);a=a.redIAdd(a);var c=n.redAdd(n).redIAdd(n),h=c.redSqr().redISub(a).redISub(a),g=s.redIAdd(s);g=g.redIAdd(g),g=g.redIAdd(g),e=h,r=c.redMul(a.redISub(h)).redISub(g),i=this.y.redAdd(this.y)}else{var b=this.x.redSqr(),E=this.y.redSqr(),A=E.redSqr(),T=this.x.redAdd(E).redSqr().redISub(b).redISub(A);T=T.redIAdd(T);var P=b.redAdd(b).redIAdd(b),L=P.redSqr(),j=A.redIAdd(A);j=j.redIAdd(j),j=j.redIAdd(j),e=L.redISub(T).redISub(T),r=P.redMul(T.redISub(e)).redISub(j),i=this.y.redMul(this.z),i=i.redIAdd(i)}return this.curve.jpoint(e,r,i)};Go.prototype._threeDbl=function(){var e,r,i;if(this.zOne){var n=this.x.redSqr(),o=this.y.redSqr(),s=o.redSqr(),a=this.x.redAdd(o).redSqr().redISub(n).redISub(s);a=a.redIAdd(a);var c=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),h=c.redSqr().redISub(a).redISub(a);e=h;var g=s.redIAdd(s);g=g.redIAdd(g),g=g.redIAdd(g),r=c.redMul(a.redISub(h)).redISub(g),i=this.y.redAdd(this.y)}else{var b=this.z.redSqr(),E=this.y.redSqr(),A=this.x.redMul(E),T=this.x.redSub(b).redMul(this.x.redAdd(b));T=T.redAdd(T).redIAdd(T);var P=A.redIAdd(A);P=P.redIAdd(P);var L=P.redAdd(P);e=T.redSqr().redISub(L),i=this.y.redAdd(this.z).redSqr().redISub(E).redISub(b);var j=E.redSqr();j=j.redIAdd(j),j=j.redIAdd(j),j=j.redIAdd(j),r=T.redMul(P.redISub(e)).redISub(j)}return this.curve.jpoint(e,r,i)};Go.prototype._dbl=function(){var e=this.curve.a,r=this.x,i=this.y,n=this.z,o=n.redSqr().redSqr(),s=r.redSqr(),a=i.redSqr(),c=s.redAdd(s).redIAdd(s).redIAdd(e.redMul(o)),h=r.redAdd(r);h=h.redIAdd(h);var g=h.redMul(a),b=c.redSqr().redISub(g.redAdd(g)),E=g.redISub(b),A=a.redSqr();A=A.redIAdd(A),A=A.redIAdd(A),A=A.redIAdd(A);var T=c.redMul(E).redISub(A),P=i.redAdd(i).redMul(n);return this.curve.jpoint(b,T,P)};Go.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),r=this.y.redSqr(),i=this.z.redSqr(),n=r.redSqr(),o=e.redAdd(e).redIAdd(e),s=o.redSqr(),a=this.x.redAdd(r).redSqr().redISub(e).redISub(n);a=a.redIAdd(a),a=a.redAdd(a).redIAdd(a),a=a.redISub(s);var c=a.redSqr(),h=n.redIAdd(n);h=h.redIAdd(h),h=h.redIAdd(h),h=h.redIAdd(h);var g=o.redIAdd(a).redSqr().redISub(s).redISub(c).redISub(h),b=r.redMul(g);b=b.redIAdd(b),b=b.redIAdd(b);var E=this.x.redMul(c).redISub(b);E=E.redIAdd(E),E=E.redIAdd(E);var A=this.y.redMul(g.redMul(h.redISub(g)).redISub(a.redMul(c)));A=A.redIAdd(A),A=A.redIAdd(A),A=A.redIAdd(A);var T=this.z.redAdd(a).redSqr().redISub(i).redISub(c);return this.curve.jpoint(E,A,T)};Go.prototype.mul=function(e,r){return e=new kr.default(e,r),this.curve._wnafMul(this,e)};Go.prototype.eq=function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var r=this.z.redSqr(),i=e.z.redSqr();if(this.x.redMul(i).redISub(e.x.redMul(r)).cmpn(0)!==0)return!1;var n=r.redMul(this.z),o=i.redMul(e.z);return this.y.redMul(o).redISub(e.y.redMul(n)).cmpn(0)===0};Go.prototype.eqXToP=function(e){var r=this.z.redSqr(),i=e.toRed(this.curve.red).redMul(r);if(this.x.cmp(i)===0)return!0;for(var n=e.clone(),o=this.curve.redN.redMul(r);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(i.redIAdd(o),this.x.cmp(i)===0)return!0}};Go.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"};Go.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var O_=t3(function(t,e){"use strict";var r=e;r.base=Om,r.short=HHe,r.mont=null,r.edwards=null}),M_=t3(function(t,e){"use strict";var r=e,i=nc.assert;function n(a){a.type==="short"?this.curve=new O_.short(a):a.type==="edwards"?this.curve=new O_.edwards(a):this.curve=new O_.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=n;function o(a,c){Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get:function(){var h=new n(c);return Object.defineProperty(r,a,{configurable:!0,enumerable:!0,value:h}),h}})}o("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:Cf.default.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),o("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:Cf.default.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),o("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:Cf.default.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),o("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:Cf.default.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),o("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:Cf.default.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),o("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Cf.default.sha256,gRed:!1,g:["9"]}),o("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Cf.default.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var s;try{s=null.crash()}catch{s=void 0}o("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:Cf.default.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",s]})});function sp(t){if(!(this instanceof sp))return new sp(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Zl.toArray(t.entropy,t.entropyEnc||"hex"),r=Zl.toArray(t.nonce,t.nonceEnc||"hex"),i=Zl.toArray(t.pers,t.persEnc||"hex");yD(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,i)}var d0e=sp;sp.prototype._init=function(e,r,i){var n=e.concat(r).concat(i);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var o=0;o<this.V.length;o++)this.K[o]=0,this.V[o]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656};sp.prototype._hmac=function(){return new Cf.default.hmac(this.hash,this.K)};sp.prototype._update=function(e){var r=this._hmac().update(this.V).update([0]);e&&(r=r.update(e)),this.K=r.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())};sp.prototype.reseed=function(e,r,i,n){typeof r!="string"&&(n=i,i=r,r=null),e=Zl.toArray(e,r),i=Zl.toArray(i,n),yD(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(i||[])),this._reseed=1};sp.prototype.generate=function(e,r,i,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(n=i,i=r,r=null),i&&(i=Zl.toArray(i,n||"hex"),this._update(i));for(var o=[];o.length<e;)this.V=this._hmac().update(this.V).digest(),o=o.concat(this.V);var s=o.slice(0,e);return this._update(i),this._reseed++,Zl.encode(s,r)};var bD=nc.assert;function gs(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var _D=gs;gs.fromPublic=function(e,r,i){return r instanceof gs?r:new gs(e,{pub:r,pubEnc:i})};gs.fromPrivate=function(e,r,i){return r instanceof gs?r:new gs(e,{priv:r,privEnc:i})};gs.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}};gs.prototype.getPublic=function(e,r){return typeof e=="string"&&(r=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),r?this.pub.encode(r,e):this.pub};gs.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv};gs.prototype._importPrivate=function(e,r){this.priv=new kr.default(e,r||16),this.priv=this.priv.umod(this.ec.curve.n)};gs.prototype._importPublic=function(e,r){if(e.x||e.y){this.ec.curve.type==="mont"?bD(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&bD(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,r)};gs.prototype.derive=function(e){return e.validate()||bD(e.validate(),"public point not validated"),e.mul(this.priv).getX()};gs.prototype.sign=function(e,r,i){return this.ec.sign(e,this,r,i)};gs.prototype.verify=function(e,r){return this.ec.verify(e,r,this)};gs.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var zHe=nc.assert;function B_(t,e){if(t instanceof B_)return t;this._importDER(t,e)||(zHe(t.r&&t.s,"Signature without r or s"),this.r=new kr.default(t.r,16),this.s=new kr.default(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var U_=B_;function VHe(){this.place=0}function wD(t,e){var r=t[e.place++];if(!(r&128))return r;var i=r&15;if(i===0||i>4)return!1;for(var n=0,o=0,s=e.place;o<i;o++,s++)n<<=8,n|=t[s],n>>>=0;return n<=127?!1:(e.place=s,n)}function f0e(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e<r;)e++;return e===0?t:t.slice(e)}B_.prototype._importDER=function(e,r){e=nc.toArray(e,r);var i=new VHe;if(e[i.place++]!==48)return!1;var n=wD(e,i);if(n===!1||n+i.place!==e.length||e[i.place++]!==2)return!1;var o=wD(e,i);if(o===!1)return!1;var s=e.slice(i.place,o+i.place);if(i.place+=o,e[i.place++]!==2)return!1;var a=wD(e,i);if(a===!1||e.length!==a+i.place)return!1;var c=e.slice(i.place,a+i.place);if(s[0]===0)if(s[1]&128)s=s.slice(1);else return!1;if(c[0]===0)if(c[1]&128)c=c.slice(1);else return!1;return this.r=new kr.default(s),this.s=new kr.default(c),this.recoveryParam=null,!0};function vD(t,e){if(e<128){t.push(e);return}var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}B_.prototype.toDER=function(e){var r=this.r.toArray(),i=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),i[0]&128&&(i=[0].concat(i)),r=f0e(r),i=f0e(i);!i[0]&&!(i[1]&128);)i=i.slice(1);var n=[2];vD(n,r.length),n=n.concat(r),n.push(2),vD(n,i.length);var o=n.concat(i),s=[48];return vD(s,o.length),s=s.concat(o),nc.encode(s,e)};var KHe=function(){throw new Error("unsupported")},p0e=nc.assert;function tl(t){if(!(this instanceof tl))return new tl(t);typeof t=="string"&&(p0e(Object.prototype.hasOwnProperty.call(M_,t),"Unknown curve "+t),t=M_[t]),t instanceof M_.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var GHe=tl;tl.prototype.keyPair=function(e){return new _D(this,e)};tl.prototype.keyFromPrivate=function(e,r){return _D.fromPrivate(this,e,r)};tl.prototype.keyFromPublic=function(e,r){return _D.fromPublic(this,e,r)};tl.prototype.genKeyPair=function(e){e||(e={});for(var r=new d0e({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||KHe(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),i=this.n.byteLength(),n=this.n.sub(new kr.default(2));;){var o=new kr.default(r.generate(i));if(!(o.cmp(n)>0))return o.iaddn(1),this.keyFromPrivate(o)}};tl.prototype._truncateToN=function(e,r){var i=e.byteLength()*8-this.n.bitLength();return i>0&&(e=e.ushrn(i)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e};tl.prototype.sign=function(e,r,i,n){typeof i=="object"&&(n=i,i=null),n||(n={}),r=this.keyFromPrivate(r,i),e=this._truncateToN(new kr.default(e,16));for(var o=this.n.byteLength(),s=r.getPrivate().toArray("be",o),a=e.toArray("be",o),c=new d0e({hash:this.hash,entropy:s,nonce:a,pers:n.pers,persEnc:n.persEnc||"utf8"}),h=this.n.sub(new kr.default(1)),g=0;;g++){var b=n.k?n.k(g):new kr.default(c.generate(this.n.byteLength()));if(b=this._truncateToN(b,!0),!(b.cmpn(1)<=0||b.cmp(h)>=0)){var E=this.g.mul(b);if(!E.isInfinity()){var A=E.getX(),T=A.umod(this.n);if(T.cmpn(0)!==0){var P=b.invm(this.n).mul(T.mul(r.getPrivate()).iadd(e));if(P=P.umod(this.n),P.cmpn(0)!==0){var L=(E.getY().isOdd()?1:0)|(A.cmp(T)!==0?2:0);return n.canonical&&P.cmp(this.nh)>0&&(P=this.n.sub(P),L^=1),new U_({r:T,s:P,recoveryParam:L})}}}}}};tl.prototype.verify=function(e,r,i,n){e=this._truncateToN(new kr.default(e,16)),i=this.keyFromPublic(i,n),r=new U_(r,"hex");var o=r.r,s=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a=s.invm(this.n),c=a.mul(e).umod(this.n),h=a.mul(o).umod(this.n),g;return this.curve._maxwellTrick?(g=this.g.jmulAdd(c,i.getPublic(),h),g.isInfinity()?!1:g.eqXToP(o)):(g=this.g.mulAdd(c,i.getPublic(),h),g.isInfinity()?!1:g.getX().umod(this.n).cmp(o)===0)};tl.prototype.recoverPubKey=function(t,e,r,i){p0e((3&r)===r,"The recovery param is more than two bits"),e=new U_(e,i);var n=this.n,o=new kr.default(t),s=e.r,a=e.s,c=r&1,h=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&h)throw new Error("Unable to find sencond key candinate");h?s=this.curve.pointFromX(s.add(this.curve.n),c):s=this.curve.pointFromX(s,c);var g=e.r.invm(n),b=n.sub(o).mul(g).umod(n),E=a.mul(g).umod(n);return this.g.mulAdd(b,s,E)};tl.prototype.getKeyRecoveryParam=function(t,e,r,i){if(e=new U_(e,i),e.recoveryParam!==null)return e.recoveryParam;for(var n=0;n<4;n++){var o;try{o=this.recoverPubKey(t,e,n)}catch{continue}if(o.eq(r))return n}throw new Error("Unable to find valid recovery factor")};var ZHe=t3(function(t,e){"use strict";var r=e;r.version="6.5.4",r.utils=nc,r.rand=function(){throw new Error("unsupported")},r.curve=O_,r.curves=M_,r.ec=GHe,r.eddsa=null}),m0e=ZHe.ec;var g0e="signing-key/5.7.0";var AD=new fe(g0e),ED=null;function Sf(){return ED||(ED=new m0e("secp256k1")),ED}var nl=class{constructor(e){ye(this,"curve","secp256k1"),ye(this,"privateKey",De(e)),ps(this.privateKey)!==32&&AD.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");let r=Sf().keyFromPrivate(ke(this.privateKey));ye(this,"publicKey","0x"+r.getPublic(!1,"hex")),ye(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),ye(this,"_isSigningKey",!0)}_addPoint(e){let r=Sf().keyFromPublic(ke(this.publicKey)),i=Sf().keyFromPublic(ke(e));return"0x"+r.pub.add(i.pub).encodeCompressed("hex")}signDigest(e){let r=Sf().keyFromPrivate(ke(this.privateKey)),i=ke(e);i.length!==32&&AD.throwArgumentError("bad digest length","digest",e);let n=r.sign(i,{canonical:!0});return df({recoveryParam:n.recoveryParam,r:Kr("0x"+n.r.toString(16),32),s:Kr("0x"+n.s.toString(16),32)})}computeSharedSecret(e){let r=Sf().keyFromPrivate(ke(this.privateKey)),i=Sf().keyFromPublic(ke(v5(e)));return Kr("0x"+r.derive(i.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}};function F_(t,e){let r=df(e),i={r:ke(r.r),s:ke(r.s)};return"0x"+Sf().recoverPubKey(ke(t),i,r.recoveryParam).encode("hex",!1)}function v5(t,e){let r=ke(t);if(r.length===32){let i=new nl(r);return e?"0x"+Sf().keyFromPrivate(r).getPublic(!0,"hex"):i.publicKey}else{if(r.length===33)return e?De(r):"0x"+Sf().keyFromPublic(r).getPublic(!1,"hex");if(r.length===65)return e?"0x"+Sf().keyFromPublic(r).getPublic(!0,"hex"):De(r)}return AD.throwArgumentError("invalid public or private key","key","[REDACTED]")}var w0e="transactions/5.7.0";var vs=new fe(w0e),j_;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(j_||(j_={}));function SD(t){return t==="0x"?null:$r(t)}function ws(t){return t==="0x"?jw:Ue.from(t)}var YHe=[{name:"nonce",maxLength:32,numeric:!0},{name:"gasPrice",maxLength:32,numeric:!0},{name:"gasLimit",maxLength:32,numeric:!0},{name:"to",length:20},{name:"value",maxLength:32,numeric:!0},{name:"data"}],JHe={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,type:!0,value:!0};function ol(t){let e=v5(t);return $r(ji(jr(ji(e,1)),12))}function Mm(t,e){return ol(F_(ke(t),e))}function oc(t,e){let r=Xa(Ue.from(t).toHexString());return r.length>32&&vs.throwArgumentError("invalid length for "+e,"transaction:"+e,t),r}function CD(t,e){return{address:$r(t),storageKeys:(e||[]).map((r,i)=>(ps(r)!==32&&vs.throwArgumentError("invalid access list storageKey",`accessList[${t}:${i}]`,r),r.toLowerCase()))}}function sc(t){if(Array.isArray(t))return t.map((r,i)=>Array.isArray(r)?(r.length>2&&vs.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${i}]`,r),CD(r[0],r[1])):CD(r.address,r.storageKeys));let e=Object.keys(t).map(r=>{let i=t[r].reduce((n,o)=>(n[o]=!0,n),{});return CD(r,Object.keys(i).sort())});return e.sort((r,i)=>r.address.localeCompare(i.address)),e}function v0e(t){return sc(t).map(e=>[e.address,e.storageKeys])}function b0e(t,e){if(t.gasPrice!=null){let i=Ue.from(t.gasPrice),n=Ue.from(t.maxFeePerGas||0);i.eq(n)||vs.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:i,maxFeePerGas:n})}let r=[oc(t.chainId||0,"chainId"),oc(t.nonce||0,"nonce"),oc(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),oc(t.maxFeePerGas||0,"maxFeePerGas"),oc(t.gasLimit||0,"gasLimit"),t.to!=null?$r(t.to):"0x",oc(t.value||0,"value"),t.data||"0x",v0e(t.accessList||[])];if(e){let i=df(e);r.push(oc(i.recoveryParam,"recoveryParam")),r.push(Xa(i.r)),r.push(Xa(i.s))}return Vn(["0x02",ah(r)])}function y0e(t,e){let r=[oc(t.chainId||0,"chainId"),oc(t.nonce||0,"nonce"),oc(t.gasPrice||0,"gasPrice"),oc(t.gasLimit||0,"gasLimit"),t.to!=null?$r(t.to):"0x",oc(t.value||0,"value"),t.data||"0x",v0e(t.accessList||[])];if(e){let i=df(e);r.push(oc(i.recoveryParam,"recoveryParam")),r.push(Xa(i.r)),r.push(Xa(i.s))}return Vn(["0x01",ah(r)])}function QHe(t,e){Lw(t,JHe);let r=[];YHe.forEach(function(s){let a=t[s.name]||[],c={};s.numeric&&(c.hexPad="left"),a=ke(De(a,c)),s.length&&a.length!==s.length&&a.length>0&&vs.throwArgumentError("invalid length for "+s.name,"transaction:"+s.name,a),s.maxLength&&(a=Xa(a),a.length>s.maxLength&&vs.throwArgumentError("invalid length for "+s.name,"transaction:"+s.name,a)),r.push(De(a))});let i=0;if(t.chainId!=null?(i=t.chainId,typeof i!="number"&&vs.throwArgumentError("invalid transaction.chainId","transaction",t)):e&&!nh(e)&&e.v>28&&(i=Math.floor((e.v-35)/2)),i!==0&&(r.push(De(i)),r.push("0x"),r.push("0x")),!e)return ah(r);let n=df(e),o=27+n.recoveryParam;return i!==0?(r.pop(),r.pop(),r.pop(),o+=i*2+8,n.v>28&&n.v!==o&&vs.throwArgumentError("transaction.chainId/signature.v mismatch","signature",e)):n.v!==o&&vs.throwArgumentError("transaction.chainId/signature.v mismatch","signature",e),r.push(De(o)),r.push(Xa(ke(n.r))),r.push(Xa(ke(n.s))),ah(r)}function b5(t,e){if(t.type==null||t.type===0)return t.accessList!=null&&vs.throwArgumentError("untyped transactions do not support accessList; include type: 1","transaction",t),QHe(t,e);switch(t.type){case 1:return y0e(t,e);case 2:return b0e(t,e);default:break}return vs.throwError(`unsupported transaction type: ${t.type}`,fe.errors.UNSUPPORTED_OPERATION,{operation:"serializeTransaction",transactionType:t.type})}function x0e(t,e,r){try{let i=ws(e[0]).toNumber();if(i!==0&&i!==1)throw new Error("bad recid");t.v=i}catch{vs.throwArgumentError("invalid v for transaction type: 1","v",e[0])}t.r=Kr(e[1],32),t.s=Kr(e[2],32);try{let i=jr(r(t));t.from=Mm(i,{r:t.r,s:t.s,recoveryParam:t.v})}catch{}}function XHe(t){let e=f5(t.slice(1));e.length!==9&&e.length!==12&&vs.throwArgumentError("invalid component count for transaction type: 2","payload",De(t));let r=ws(e[2]),i=ws(e[3]),n={type:2,chainId:ws(e[0]).toNumber(),nonce:ws(e[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:i,gasPrice:null,gasLimit:ws(e[4]),to:SD(e[5]),value:ws(e[6]),data:e[7],accessList:sc(e[8])};return e.length===9||(n.hash=jr(t),x0e(n,e.slice(9),b0e)),n}function eze(t){let e=f5(t.slice(1));e.length!==8&&e.length!==11&&vs.throwArgumentError("invalid component count for transaction type: 1","payload",De(t));let r={type:1,chainId:ws(e[0]).toNumber(),nonce:ws(e[1]).toNumber(),gasPrice:ws(e[2]),gasLimit:ws(e[3]),to:SD(e[4]),value:ws(e[5]),data:e[6],accessList:sc(e[7])};return e.length===8||(r.hash=jr(t),x0e(r,e.slice(8),y0e)),r}function tze(t){let e=f5(t);e.length!==9&&e.length!==6&&vs.throwArgumentError("invalid raw transaction","rawTransaction",t);let r={nonce:ws(e[0]).toNumber(),gasPrice:ws(e[1]),gasLimit:ws(e[2]),to:SD(e[3]),value:ws(e[4]),data:e[5],chainId:0};if(e.length===6)return r;try{r.v=Ue.from(e[6]).toNumber()}catch{return r}if(r.r=Kr(e[7],32),r.s=Kr(e[8],32),Ue.from(r.r).isZero()&&Ue.from(r.s).isZero())r.chainId=r.v,r.v=0;else{r.chainId=Math.floor((r.v-35)/2),r.chainId<0&&(r.chainId=0);let i=r.v-27,n=e.slice(0,6);r.chainId!==0&&(n.push(De(r.chainId)),n.push("0x"),n.push("0x"),i-=r.chainId*2+8);let o=jr(ah(n));try{r.from=Mm(o,{r:De(r.r),s:De(r.s),recoveryParam:i})}catch{}r.hash=jr(t)}return r.type=null,r}function $_(t){let e=ke(t);if(e[0]>127)return tze(e);switch(e[0]){case 1:return eze(e);case 2:return XHe(e);default:break}return vs.throwError(`unsupported transaction type: ${e[0]}`,fe.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}var _0e="contracts/5.7.0";var cp=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},zi=new fe(_0e),rze={chainId:!0,data:!0,from:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0,customData:!0,ccipReadEnabled:!0};function W_(t,e){return cp(this,void 0,void 0,function*(){let r=yield e;typeof r!="string"&&zi.throwArgumentError("invalid address or ENS name","name",r);try{return $r(r)}catch{}t||zi.throwError("a provider or signer is needed to resolve ENS names",fe.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});let i=yield t.resolveName(r);return i==null&&zi.throwArgumentError("resolver or addr is not configured for ENS name","name",r),i})}function y5(t,e,r){return cp(this,void 0,void 0,function*(){return Array.isArray(r)?yield Promise.all(r.map((i,n)=>y5(t,Array.isArray(e)?e[n]:e[i.name],i))):r.type==="address"?yield W_(t,e):r.type==="tuple"?yield y5(t,e,r.components):r.baseType==="array"?Array.isArray(e)?yield Promise.all(e.map(i=>y5(t,i,r.arrayChildren))):Promise.reject(zi.makeError("invalid value for array",fe.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e})}function z_(t,e,r){return cp(this,void 0,void 0,function*(){let i={};r.length===e.inputs.length+1&&typeof r[r.length-1]=="object"&&(i=pi(r.pop())),zi.checkArgumentCount(r.length,e.inputs.length,"passed to contract"),t.signer?i.from?i.from=$i({override:W_(t.signer,i.from),signer:t.signer.getAddress()}).then(h=>cp(this,void 0,void 0,function*(){return $r(h.signer)!==h.override&&zi.throwError("Contract with a Signer cannot override from",fe.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),h.override})):i.from=t.signer.getAddress():i.from&&(i.from=W_(t.provider,i.from));let n=yield $i({args:y5(t.signer||t.provider,r,e.inputs),address:t.resolvedAddress,overrides:$i(i)||{}}),o=t.interface.encodeFunctionData(e,n.args),s={data:o,to:n.address},a=n.overrides;if(a.nonce!=null&&(s.nonce=Ue.from(a.nonce).toNumber()),a.gasLimit!=null&&(s.gasLimit=Ue.from(a.gasLimit)),a.gasPrice!=null&&(s.gasPrice=Ue.from(a.gasPrice)),a.maxFeePerGas!=null&&(s.maxFeePerGas=Ue.from(a.maxFeePerGas)),a.maxPriorityFeePerGas!=null&&(s.maxPriorityFeePerGas=Ue.from(a.maxPriorityFeePerGas)),a.from!=null&&(s.from=a.from),a.type!=null&&(s.type=a.type),a.accessList!=null&&(s.accessList=sc(a.accessList)),s.gasLimit==null&&e.gas!=null){let h=21e3,g=ke(o);for(let b=0;b<g.length;b++)h+=4,g[b]&&(h+=64);s.gasLimit=Ue.from(e.gas).add(h)}if(a.value){let h=Ue.from(a.value);!h.isZero()&&!e.payable&&zi.throwError("non-payable method cannot override value",fe.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:i.value}),s.value=h}a.customData&&(s.customData=pi(a.customData)),a.ccipReadEnabled&&(s.ccipReadEnabled=!!a.ccipReadEnabled),delete i.nonce,delete i.gasLimit,delete i.gasPrice,delete i.from,delete i.value,delete i.type,delete i.accessList,delete i.maxFeePerGas,delete i.maxPriorityFeePerGas,delete i.customData,delete i.ccipReadEnabled;let c=Object.keys(i).filter(h=>i[h]!=null);return c.length&&zi.throwError(`cannot override ${c.map(h=>JSON.stringify(h)).join(",")}`,fe.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:c}),s})}function ize(t,e){return function(...r){return z_(t,e,r)}}function nze(t,e){let r=t.signer||t.provider;return function(...i){return cp(this,void 0,void 0,function*(){r||zi.throwError("estimate require a provider or signer",fe.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});let n=yield z_(t,e,i);return yield r.estimateGas(n)})}}function A0e(t,e){let r=e.wait.bind(e);e.wait=i=>r(i).then(n=>(n.events=n.logs.map(o=>{let s=vn(o),a=null;try{a=t.interface.parseLog(o)}catch{}return a&&(s.args=a.args,s.decode=(c,h)=>t.interface.decodeEventLog(a.eventFragment,c,h),s.event=a.name,s.eventSignature=a.signature),s.removeListener=()=>t.provider,s.getBlock=()=>t.provider.getBlock(n.blockHash),s.getTransaction=()=>t.provider.getTransaction(n.transactionHash),s.getTransactionReceipt=()=>Promise.resolve(n),s}),n))}function C0e(t,e,r){let i=t.signer||t.provider;return function(...n){return cp(this,void 0,void 0,function*(){let o;if(n.length===e.inputs.length+1&&typeof n[n.length-1]=="object"){let c=pi(n.pop());c.blockTag!=null&&(o=yield c.blockTag),delete c.blockTag,n.push(c)}t.deployTransaction!=null&&(yield t._deployed(o));let s=yield z_(t,e,n),a=yield i.call(s,o);try{let c=t.interface.decodeFunctionResult(e,a);return r&&e.outputs.length===1&&(c=c[0]),c}catch(c){throw c.code===fe.errors.CALL_EXCEPTION&&(c.address=t.address,c.args=n,c.transaction=s),c}})}}function oze(t,e){return function(...r){return cp(this,void 0,void 0,function*(){t.signer||zi.throwError("sending a transaction requires a signer",fe.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),t.deployTransaction!=null&&(yield t._deployed());let i=yield z_(t,e,r),n=yield t.signer.sendTransaction(i);return A0e(t,n),n})}}function E0e(t,e,r){return e.constant?C0e(t,e,r):oze(t,e)}function S0e(t){return t.address&&(t.topics==null||t.topics.length===0)?"*":(t.address||"*")+"@"+(t.topics?t.topics.map(e=>Array.isArray(e)?e.join("|"):e).join(":"):"")}var Dm=class{constructor(e,r){ye(this,"tag",e),ye(this,"filter",r),this._listeners=[]}addListener(e,r){this._listeners.push({listener:e,once:r})}removeListener(e){let r=!1;this._listeners=this._listeners.filter(i=>r||i.listener!==e?!0:(r=!0,!1))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map(e=>e.listener)}listenerCount(){return this._listeners.length}run(e){let r=this.listenerCount();return this._listeners=this._listeners.filter(i=>{let n=e.slice();return setTimeout(()=>{i.listener.apply(this,n)},0),!i.once}),r}prepareEvent(e){}getEmit(e){return[e]}},ID=class extends Dm{constructor(){super("error",null)}},q_=class extends Dm{constructor(e,r,i,n){let o={address:e},s=r.getEventTopic(i);n?(s!==n[0]&&zi.throwArgumentError("topic mismatch","topics",n),o.topics=n.slice()):o.topics=[s],super(S0e(o),o),ye(this,"address",e),ye(this,"interface",r),ye(this,"fragment",i)}prepareEvent(e){super.prepareEvent(e),e.event=this.fragment.name,e.eventSignature=this.fragment.format(),e.decode=(r,i)=>this.interface.decodeEventLog(this.fragment,r,i);try{e.args=this.interface.decodeEventLog(this.fragment,e.data,e.topics)}catch(r){e.args=null,e.decodeError=r}}getEmit(e){let r=Uw(e.args);if(r.length)throw r[0].error;let i=(e.args||[]).slice();return i.push(e),i}},H_=class extends Dm{constructor(e,r){super("*",{address:e}),ye(this,"address",e),ye(this,"interface",r)}prepareEvent(e){super.prepareEvent(e);try{let r=this.interface.parseLog(e);e.event=r.name,e.eventSignature=r.signature,e.decode=(i,n)=>this.interface.decodeEventLog(r.eventFragment,i,n),e.args=r.args}catch{}}},r3=class{constructor(e,r,i){ye(this,"interface",bn(new.target,"getInterface")(r)),i==null?(ye(this,"provider",null),ye(this,"signer",null)):rc.isSigner(i)?(ye(this,"provider",i.provider||null),ye(this,"signer",i)):Xc.isProvider(i)?(ye(this,"provider",i),ye(this,"signer",null)):zi.throwArgumentError("invalid signer or provider","signerOrProvider",i),ye(this,"callStatic",{}),ye(this,"estimateGas",{}),ye(this,"functions",{}),ye(this,"populateTransaction",{}),ye(this,"filters",{});{let s={};Object.keys(this.interface.events).forEach(a=>{let c=this.interface.events[a];ye(this.filters,a,(...h)=>({address:this.address,topics:this.interface.encodeFilterTopics(c,h)})),s[c.name]||(s[c.name]=[]),s[c.name].push(a)}),Object.keys(s).forEach(a=>{let c=s[a];c.length===1?ye(this.filters,a,this.filters[c[0]]):zi.warn(`Duplicate definition of ${a} (${c.join(", ")})`)})}if(ye(this,"_runningEvents",{}),ye(this,"_wrappedEmits",{}),e==null&&zi.throwArgumentError("invalid contract address or ENS name","addressOrName",e),ye(this,"address",e),this.provider)ye(this,"resolvedAddress",W_(this.provider,e));else try{ye(this,"resolvedAddress",Promise.resolve($r(e)))}catch{zi.throwError("provider is required to use ENS name as contract address",fe.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch(s=>{});let n={},o={};Object.keys(this.interface.functions).forEach(s=>{let a=this.interface.functions[s];if(o[s]){zi.warn(`Duplicate ABI entry for ${JSON.stringify(s)}`);return}o[s]=!0;{let c=a.name;n[`%${c}`]||(n[`%${c}`]=[]),n[`%${c}`].push(s)}this[s]==null&&ye(this,s,E0e(this,a,!0)),this.functions[s]==null&&ye(this.functions,s,E0e(this,a,!1)),this.callStatic[s]==null&&ye(this.callStatic,s,C0e(this,a,!0)),this.populateTransaction[s]==null&&ye(this.populateTransaction,s,ize(this,a)),this.estimateGas[s]==null&&ye(this.estimateGas,s,nze(this,a))}),Object.keys(n).forEach(s=>{let a=n[s];if(a.length>1)return;s=s.substring(1);let c=a[0];try{this[s]==null&&ye(this,s,this[c])}catch{}this.functions[s]==null&&ye(this.functions,s,this.functions[c]),this.callStatic[s]==null&&ye(this.callStatic,s,this.callStatic[c]),this.populateTransaction[s]==null&&ye(this.populateTransaction,s,this.populateTransaction[c]),this.estimateGas[s]==null&&ye(this.estimateGas,s,this.estimateGas[c])})}static getContractAddress(e){return Rm(e)}static getInterface(e){return np.isInterface(e)?e:new np(e)}deployed(){return this._deployed()}_deployed(e){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then(()=>this):this._deployedPromise=this.provider.getCode(this.address,e).then(r=>(r==="0x"&&zi.throwError("contract not deployed",fe.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this))),this._deployedPromise}fallback(e){this.signer||zi.throwError("sending a transactions require a signer",fe.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});let r=pi(e||{});return["from","to"].forEach(function(i){r[i]!=null&&zi.throwError("cannot override "+i,fe.errors.UNSUPPORTED_OPERATION,{operation:i})}),r.to=this.resolvedAddress,this.deployed().then(()=>this.signer.sendTransaction(r))}connect(e){typeof e=="string"&&(e=new Nm(e,this.provider));let r=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&ye(r,"deployTransaction",this.deployTransaction),r}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return ch.isIndexed(e)}_normalizeRunningEvent(e){return this._runningEvents[e.tag]?this._runningEvents[e.tag]:e}_getRunningEvent(e){if(typeof e=="string"){if(e==="error")return this._normalizeRunningEvent(new ID);if(e==="event")return this._normalizeRunningEvent(new Dm("event",null));if(e==="*")return this._normalizeRunningEvent(new H_(this.address,this.interface));let r=this.interface.getEvent(e);return this._normalizeRunningEvent(new q_(this.address,this.interface,r))}if(e.topics&&e.topics.length>0){try{let i=e.topics[0];if(typeof i!="string")throw new Error("invalid topic");let n=this.interface.getEvent(i);return this._normalizeRunningEvent(new q_(this.address,this.interface,n,e.topics))}catch{}let r={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new Dm(S0e(r),r))}return this._normalizeRunningEvent(new H_(this.address,this.interface))}_checkRunningEvents(e){if(e.listenerCount()===0){delete this._runningEvents[e.tag];let r=this._wrappedEmits[e.tag];r&&e.filter&&(this.provider.off(e.filter,r),delete this._wrappedEmits[e.tag])}}_wrapEvent(e,r,i){let n=vn(r);return n.removeListener=()=>{i&&(e.removeListener(i),this._checkRunningEvents(e))},n.getBlock=()=>this.provider.getBlock(r.blockHash),n.getTransaction=()=>this.provider.getTransaction(r.transactionHash),n.getTransactionReceipt=()=>this.provider.getTransactionReceipt(r.transactionHash),e.prepareEvent(n),n}_addEventListener(e,r,i){if(this.provider||zi.throwError("events require a provider or a signer with a provider",fe.errors.UNSUPPORTED_OPERATION,{operation:"once"}),e.addListener(r,i),this._runningEvents[e.tag]=e,!this._wrappedEmits[e.tag]){let n=o=>{let s=this._wrapEvent(e,o,r);if(s.decodeError==null)try{let a=e.getEmit(s);this.emit(e.filter,...a)}catch(a){s.decodeError=a.error}e.filter!=null&&this.emit("event",s),s.decodeError!=null&&this.emit("error",s.decodeError,s)};this._wrappedEmits[e.tag]=n,e.filter!=null&&this.provider.on(e.filter,n)}}queryFilter(e,r,i){let n=this._getRunningEvent(e),o=pi(n.filter);return typeof r=="string"&&Zt(r,32)?(i!=null&&zi.throwArgumentError("cannot specify toBlock with blockhash","toBlock",i),o.blockHash=r):(o.fromBlock=r??0,o.toBlock=i??"latest"),this.provider.getLogs(o).then(s=>s.map(a=>this._wrapEvent(n,a,null)))}on(e,r){return this._addEventListener(this._getRunningEvent(e),r,!1),this}once(e,r){return this._addEventListener(this._getRunningEvent(e),r,!0),this}emit(e,...r){if(!this.provider)return!1;let i=this._getRunningEvent(e),n=i.run(r)>0;return this._checkRunningEvents(i),n}listenerCount(e){return this.provider?e==null?Object.keys(this._runningEvents).reduce((r,i)=>r+this._runningEvents[i].listenerCount(),0):this._getRunningEvent(e).listenerCount():0}listeners(e){if(!this.provider)return[];if(e==null){let r=[];for(let i in this._runningEvents)this._runningEvents[i].listeners().forEach(n=>{r.push(n)});return r}return this._getRunningEvent(e).listeners()}removeAllListeners(e){if(!this.provider)return this;if(e==null){for(let i in this._runningEvents){let n=this._runningEvents[i];n.removeAllListeners(),this._checkRunningEvents(n)}return this}let r=this._getRunningEvent(e);return r.removeAllListeners(),this._checkRunningEvents(r),this}off(e,r){if(!this.provider)return this;let i=this._getRunningEvent(e);return i.removeListener(r),this._checkRunningEvents(i),this}removeListener(e,r){return this.off(e,r)}},Lm=class extends r3{},x5=class{constructor(e,r,i){let n=null;typeof r=="string"?n=r:Zc(r)?n=De(r):r&&typeof r.object=="string"?n=r.object:n="!",n.substring(0,2)!=="0x"&&(n="0x"+n),(!Zt(n)||n.length%2)&&zi.throwArgumentError("invalid bytecode","bytecode",r),i&&!rc.isSigner(i)&&zi.throwArgumentError("invalid signer","signer",i),ye(this,"bytecode",n),ye(this,"interface",bn(new.target,"getInterface")(e)),ye(this,"signer",i||null)}getDeployTransaction(...e){let r={};if(e.length===this.interface.deploy.inputs.length+1&&typeof e[e.length-1]=="object"){r=pi(e.pop());for(let i in r)if(!rze[i])throw new Error("unknown transaction override "+i)}return["data","from","to"].forEach(i=>{r[i]!=null&&zi.throwError("cannot override "+i,fe.errors.UNSUPPORTED_OPERATION,{operation:i})}),r.value&&!Ue.from(r.value).isZero()&&!this.interface.deploy.payable&&zi.throwError("non-payable constructor cannot override value",fe.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:r.value}),zi.checkArgumentCount(e.length,this.interface.deploy.inputs.length," in Contract constructor"),r.data=De(Fr([this.bytecode,this.interface.encodeDeploy(e)])),r}deploy(...e){return cp(this,void 0,void 0,function*(){let r={};e.length===this.interface.deploy.inputs.length+1&&(r=e.pop()),zi.checkArgumentCount(e.length,this.interface.deploy.inputs.length," in Contract constructor");let i=yield y5(this.signer,e,this.interface.deploy.inputs);i.push(r);let n=this.getDeployTransaction(...i),o=yield this.signer.sendTransaction(n),s=bn(this.constructor,"getContractAddress")(o),a=bn(this.constructor,"getContract")(s,this.interface,this.signer);return A0e(a,o),ye(a,"deployTransaction",o),a})}attach(e){return this.constructor.getContract(e,this.interface,this.signer)}connect(e){return new this.constructor(this.interface,this.bytecode,e)}static fromSolidity(e,r){e==null&&zi.throwError("missing compiler output",fe.errors.MISSING_ARGUMENT,{argument:"compilerOutput"}),typeof e=="string"&&(e=JSON.parse(e));let i=e.abi,n=null;return e.bytecode?n=e.bytecode:e.evm&&e.evm.bytecode&&(n=e.evm.bytecode),new this(i,n,r)}static getInterface(e){return Lm.getInterface(e)}static getContractAddress(e){return Rm(e)}static getContract(e,r,i){return new Lm(e,r,i)}};var V_=class{constructor(e){ye(this,"alphabet",e),ye(this,"base",e.length),ye(this,"_alphabetMap",{}),ye(this,"_leader",e.charAt(0));for(let r=0;r<e.length;r++)this._alphabetMap[e.charAt(r)]=r}encode(e){let r=ke(e);if(r.length===0)return"";let i=[0];for(let o=0;o<r.length;++o){let s=r[o];for(let a=0;a<i.length;++a)s+=i[a]<<8,i[a]=s%this.base,s=s/this.base|0;for(;s>0;)i.push(s%this.base),s=s/this.base|0}let n="";for(let o=0;r[o]===0&&o<r.length-1;++o)n+=this._leader;for(let o=i.length-1;o>=0;--o)n+=this.alphabet[i[o]];return n}decode(e){if(typeof e!="string")throw new TypeError("Expected String");let r=[];if(e.length===0)return new Uint8Array(r);r.push(0);for(let i=0;i<e.length;i++){let n=this._alphabetMap[e[i]];if(n===void 0)throw new Error("Non-base"+this.base+" character");let o=n;for(let s=0;s<r.length;++s)o+=r[s]*this.base,r[s]=o&255,o>>=8;for(;o>0;)r.push(o&255),o>>=8}for(let i=0;e[i]===this._leader&&i<e.length-1;++i)r.push(0);return ke(new Uint8Array(r.reverse()))}},KZt=new V_("abcdefghijklmnopqrstuvwxyz234567"),hh=new V_("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var i3=Wt(gD());var If;(function(t){t.sha256="sha256",t.sha512="sha512"})(If||(If={}));var I0e="sha2/5.7.0";var sze=new fe(I0e);function _5(t){return"0x"+i3.default.ripemd160().update(ke(t)).digest("hex")}function pa(t){return"0x"+i3.default.sha256().update(ke(t)).digest("hex")}function TD(t){return"0x"+i3.default.sha512().update(ke(t)).digest("hex")}function dh(t,e,r){return If[t]||sze.throwError("unsupported algorithm "+t,fe.errors.UNSUPPORTED_OPERATION,{operation:"hmac",algorithm:t}),"0x"+i3.default.hmac(i3.default[t],ke(e)).update(ke(r)).digest("hex")}function Bm(t,e,r,i,n){t=ke(t),e=ke(e);let o,s=1,a=new Uint8Array(i),c=new Uint8Array(e.length+4);c.set(e);let h,g;for(let b=1;b<=s;b++){c[e.length]=b>>24&255,c[e.length+1]=b>>16&255,c[e.length+2]=b>>8&255,c[e.length+3]=b&255;let E=ke(dh(n,t,c));o||(o=E.length,g=new Uint8Array(o),s=Math.ceil(i/o),h=i-(s-1)*o),g.set(E);for(let P=1;P<r;P++){E=ke(dh(n,t,E));for(let L=0;L<o;L++)g[L]^=E[L]}let A=(b-1)*o,T=b===s?h:o;a.set(ke(g).slice(0,T),A)}return De(a)}var T0e="wordlists/5.7.0";var aze=!1,R0e=new fe(T0e),Tf=class t{constructor(e){R0e.checkAbstract(new.target,t),ye(this,"locale",e)}split(e){return e.toLowerCase().split(/ +/g)}join(e){return e.join(" ")}static check(e){let r=[];for(let i=0;i<2048;i++){let n=e.getWord(i);if(i!==e.getWordIndex(n))return"0x";r.push(n)}return tc(r.join(`
9977
9977
  `)+`
9978
- `)}static register(e,r){if(r||(r=e.locale),aze)try{let i=window;i._ethers&&i._ethers.wordlists&&(i._ethers.wordlists[r]||ye(i._ethers.wordlists,r,e))}catch{}}};var cze="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo",E5=null;function k0e(t){if(E5==null&&(E5=cze.replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),Tf.check(t)!=="0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"))throw E5=null,new Error("BIP39 Wordlist for en (English) FAILED")}var RD=class extends Tf{constructor(){super("en")}getWord(e){return k0e(this),E5[e]}getWordIndex(e){return k0e(this),E5.indexOf(e)}},kD=new RD;Tf.register(kD);var Um={en:kD};var N0e="hdnode/5.7.0";var A5=new fe(N0e),lze=Ue.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),uze=fi("Bitcoin seed"),o3=2147483648;function O0e(t){return(1<<t)-1<<8-t}function fze(t){return(1<<t)-1}function K_(t){return Kr(De(t),32)}function P0e(t){return hh.encode(Fr([t,ji(pa(pa(t)),0,4)]))}function ND(t){if(t==null)return Um.en;if(typeof t=="string"){let e=Um[t];return e==null&&A5.throwArgumentError("unknown locale","wordlist",t),e}return t}var n3={},ph="m/44'/60'/0'/0/0",Rf=class t{constructor(e,r,i,n,o,s,a,c){if(e!==n3)throw new Error("HDNode constructor cannot be called directly");if(r){let h=new nl(r);ye(this,"privateKey",h.privateKey),ye(this,"publicKey",h.compressedPublicKey)}else ye(this,"privateKey",null),ye(this,"publicKey",De(i));ye(this,"parentFingerprint",n),ye(this,"fingerprint",ji(_5(pa(this.publicKey)),0,4)),ye(this,"address",ol(this.publicKey)),ye(this,"chainCode",o),ye(this,"index",s),ye(this,"depth",a),c==null?(ye(this,"mnemonic",null),ye(this,"path",null)):typeof c=="string"?(ye(this,"mnemonic",null),ye(this,"path",c)):(ye(this,"mnemonic",c),ye(this,"path",c.path))}get extendedKey(){if(this.depth>=256)throw new Error("Depth too large!");return P0e(Fr([this.privateKey!=null?"0x0488ADE4":"0x0488B21E",De(this.depth),this.parentFingerprint,Kr(De(this.index),4),this.chainCode,this.privateKey!=null?Fr(["0x00",this.privateKey]):this.publicKey]))}neuter(){return new t(n3,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,this.path)}_derive(e){if(e>4294967295)throw new Error("invalid index - "+String(e));let r=this.path;r&&(r+="/"+(e&~o3));let i=new Uint8Array(37);if(e&o3){if(!this.privateKey)throw new Error("cannot derive child of neutered node");i.set(ke(this.privateKey),1),r&&(r+="'")}else i.set(ke(this.publicKey));for(let b=24;b>=0;b-=8)i[33+(b>>3)]=e>>24-b&255;let n=ke(dh(If.sha512,this.chainCode,i)),o=n.slice(0,32),s=n.slice(32),a=null,c=null;this.privateKey?a=K_(Ue.from(o).add(this.privateKey).mod(lze)):c=new nl(De(o))._addPoint(this.publicKey);let h=r,g=this.mnemonic;return g&&(h=Object.freeze({phrase:g.phrase,path:r,locale:g.locale||"en"})),new t(n3,a,c,this.fingerprint,K_(s),e,this.depth+1,h)}derivePath(e){let r=e.split("/");if(r.length===0||r[0]==="m"&&this.depth!==0)throw new Error("invalid path - "+e);r[0]==="m"&&r.shift();let i=this;for(let n=0;n<r.length;n++){let o=r[n];if(o.match(/^[0-9]+'$/)){let s=parseInt(o.substring(0,o.length-1));if(s>=o3)throw new Error("invalid path index - "+o);i=i._derive(o3+s)}else if(o.match(/^[0-9]+$/)){let s=parseInt(o);if(s>=o3)throw new Error("invalid path index - "+o);i=i._derive(s)}else throw new Error("invalid path component - "+o)}return i}static _fromSeed(e,r){let i=ke(e);if(i.length<16||i.length>64)throw new Error("invalid seed");let n=ke(dh(If.sha512,uze,i));return new t(n3,K_(n.slice(0,32)),null,"0x00000000",K_(n.slice(32)),0,0,r)}static fromMnemonic(e,r,i){return i=ND(i),e=Fm(s3(e,i),i),t._fromSeed(PD(e,r),{phrase:e,path:"m",locale:i.locale})}static fromSeed(e){return t._fromSeed(e,null)}static fromExtendedKey(e){let r=hh.decode(e);(r.length!==82||P0e(r.slice(0,78))!==e)&&A5.throwArgumentError("invalid extended key","extendedKey","[REDACTED]");let i=r[4],n=De(r.slice(5,9)),o=parseInt(De(r.slice(9,13)).substring(2),16),s=De(r.slice(13,45)),a=r.slice(45,78);switch(De(r.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new t(n3,null,De(a),n,s,o,i,null);case"0x0488ade4":case"0x04358394 ":if(a[0]!==0)break;return new t(n3,De(a.slice(1)),null,n,s,o,i,null)}return A5.throwArgumentError("invalid extended key","extendedKey","[REDACTED]")}};function PD(t,e){e||(e="");let r=fi("mnemonic"+e,qs.NFKD);return Bm(fi(t,qs.NFKD),r,2048,64,"sha512")}function s3(t,e){e=ND(e),A5.checkNormalize();let r=e.split(t);if(r.length%3!==0)throw new Error("invalid mnemonic");let i=ke(new Uint8Array(Math.ceil(11*r.length/8))),n=0;for(let h=0;h<r.length;h++){let g=e.getWordIndex(r[h].normalize("NFKD"));if(g===-1)throw new Error("invalid mnemonic");for(let b=0;b<11;b++)g&1<<10-b&&(i[n>>3]|=1<<7-n%8),n++}let o=32*r.length/3,s=r.length/3,a=O0e(s);if((ke(pa(i.slice(0,o/8)))[0]&a)!==(i[i.length-1]&a))throw new Error("invalid checksum");return De(i.slice(0,o/8))}function Fm(t,e){if(e=ND(e),t=ke(t),t.length%4!==0||t.length<16||t.length>32)throw new Error("invalid entropy");let r=[0],i=11;for(let s=0;s<t.length;s++)i>8?(r[r.length-1]<<=8,r[r.length-1]|=t[s],i-=8):(r[r.length-1]<<=i,r[r.length-1]|=t[s]>>8-i,r.push(t[s]&fze(8-i)),i+=3);let n=t.length/4,o=ke(pa(t))[0]&O0e(n);return r[r.length-1]<<=n,r[r.length-1]|=o>>8-n,e.join(r.map(s=>e.getWord(s)))}function M0e(t,e){try{return s3(t,e),!0}catch{}return!1}function D0e(t){return(typeof t!="number"||t<0||t>=o3||t%1)&&A5.throwArgumentError("invalid account index","index",t),`m/44'/60'/${t}'/0/0`}var L0e="random/5.7.0";var OD=new fe(L0e);function hze(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")}var B0e=hze(),G_=B0e.crypto||B0e.msCrypto;(!G_||!G_.getRandomValues)&&(OD.warn("WARNING: Missing strong random number source"),G_={getRandomValues:function(t){return OD.throwError("no secure random source avaialble",fe.errors.UNSUPPORTED_OPERATION,{operation:"crypto.getRandomValues"})}});function kf(t){(t<=0||t>1024||t%1||t!=t)&&OD.throwArgumentError("invalid length","length",t);let e=new Uint8Array(t);return G_.getRandomValues(e),ke(e)}function C5(t){t=t.slice();for(let e=t.length-1;e>0;e--){let r=Math.floor(Math.random()*(e+1)),i=t[e];t[e]=t[r],t[r]=i}return t}var LD=Wt(DD());var Z_="json-wallets/5.7.0";function mh(t){return typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),ke(t)}function a3(t,e){for(t=String(t);t.length<e;)t="0"+t;return t}function S5(t){return typeof t=="string"?fi(t,qs.NFKC):ke(t)}function _n(t,e){let r=t,i=e.toLowerCase().split("/");for(let n=0;n<i.length;n++){let o=null;for(let s in r)if(s.toLowerCase()===i[n]){o=r[s];break}if(o===null)return null;r=o}return r}function F0e(t){let e=ke(t);e[6]=e[6]&15|64,e[8]=e[8]&63|128;let r=De(e);return[r.substring(2,10),r.substring(10,14),r.substring(14,18),r.substring(18,22),r.substring(22,34)].join("-")}var dze=new fe(Z_),BD=class extends ec{isCrowdsaleAccount(e){return!!(e&&e._isCrowdsaleAccount)}};function UD(t,e){let r=JSON.parse(t);e=S5(e);let i=$r(_n(r,"ethaddr")),n=mh(_n(r,"encseed"));(!n||n.length%16!==0)&&dze.throwArgumentError("invalid encseed","json",t);let o=ke(Bm(e,e,2e3,32,"sha256")).slice(0,16),s=n.slice(0,16),a=n.slice(16),c=new LD.default.ModeOfOperation.cbc(o,s),h=LD.default.padding.pkcs7.strip(ke(c.decrypt(a))),g="";for(let A=0;A<h.length;A++)g+=String.fromCharCode(h[A]);let b=fi(g),E=jr(b);return new BD({_isCrowdsaleAccount:!0,address:i,privateKey:E})}function Y_(t){let e=null;try{e=JSON.parse(t)}catch{return!1}return e.encseed&&e.ethaddr}function J_(t){let e=null;try{e=JSON.parse(t)}catch{return!1}return!(!e.version||parseInt(e.version)!==e.version||parseInt(e.version)!==3)}function FD(t){if(Y_(t))try{return $r(JSON.parse(t).ethaddr)}catch{return null}if(J_(t))try{return $r(JSON.parse(t).address)}catch{return null}return null}var gh=Wt(DD()),Q_=Wt($0e());var pze=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},$D=new fe(Z_);function W0e(t){return t!=null&&t.mnemonic&&t.mnemonic.phrase}var WD=class extends ec{isKeystoreAccount(e){return!!(e&&e._isKeystoreAccount)}};function mze(t,e,r){if(_n(t,"crypto/cipher")==="aes-128-ctr"){let n=mh(_n(t,"crypto/cipherparams/iv")),o=new gh.default.Counter(n),s=new gh.default.ModeOfOperation.ctr(e,o);return ke(s.decrypt(r))}return null}function q0e(t,e){let r=mh(_n(t,"crypto/ciphertext"));if(De(jr(Fr([e.slice(16,32),r]))).substring(2)!==_n(t,"crypto/mac").toLowerCase())throw new Error("invalid password");let n=mze(t,e.slice(0,16),r);n||$D.throwError("unsupported cipher",fe.errors.UNSUPPORTED_OPERATION,{operation:"decrypt"});let o=e.slice(32,64),s=ol(n);if(t.address){let c=t.address.toLowerCase();if(c.substring(0,2)!=="0x"&&(c="0x"+c),$r(c)!==s)throw new Error("address mismatch")}let a={_isKeystoreAccount:!0,address:s,privateKey:De(n)};if(_n(t,"x-ethers/version")==="0.1"){let c=mh(_n(t,"x-ethers/mnemonicCiphertext")),h=mh(_n(t,"x-ethers/mnemonicCounter")),g=new gh.default.Counter(h),b=new gh.default.ModeOfOperation.ctr(o,g),E=_n(t,"x-ethers/path")||ph,A=_n(t,"x-ethers/locale")||"en",T=ke(b.decrypt(c));try{let P=Fm(T,A),L=Rf.fromMnemonic(P,null,A).derivePath(E);if(L.privateKey!=a.privateKey)throw new Error("mnemonic mismatch");a.mnemonic=L.mnemonic}catch(P){if(P.code!==fe.errors.INVALID_ARGUMENT||P.argument!=="wordlist")throw P}}return new WD(a)}function H0e(t,e,r,i,n){return ke(Bm(t,e,r,i,n))}function gze(t,e,r,i,n){return Promise.resolve(H0e(t,e,r,i,n))}function z0e(t,e,r,i,n){let o=S5(e),s=_n(t,"crypto/kdf");if(s&&typeof s=="string"){let a=function(c,h){return $D.throwArgumentError("invalid key-derivation function parameters",c,h)};if(s.toLowerCase()==="scrypt"){let c=mh(_n(t,"crypto/kdfparams/salt")),h=parseInt(_n(t,"crypto/kdfparams/n")),g=parseInt(_n(t,"crypto/kdfparams/r")),b=parseInt(_n(t,"crypto/kdfparams/p"));(!h||!g||!b)&&a("kdf",s),(h&h-1)!==0&&a("N",h);let E=parseInt(_n(t,"crypto/kdfparams/dklen"));return E!==32&&a("dklen",E),i(o,c,h,g,b,64,n)}else if(s.toLowerCase()==="pbkdf2"){let c=mh(_n(t,"crypto/kdfparams/salt")),h=null,g=_n(t,"crypto/kdfparams/prf");g==="hmac-sha256"?h="sha256":g==="hmac-sha512"?h="sha512":a("prf",g);let b=parseInt(_n(t,"crypto/kdfparams/c")),E=parseInt(_n(t,"crypto/kdfparams/dklen"));return E!==32&&a("dklen",E),r(o,c,b,E,h)}}return $D.throwArgumentError("unsupported key-derivation function","kdf",s)}function V0e(t,e){let r=JSON.parse(t),i=z0e(r,e,H0e,Q_.default.syncScrypt);return q0e(r,i)}function K0e(t,e,r){return pze(this,void 0,void 0,function*(){let i=JSON.parse(t),n=yield z0e(i,e,gze,Q_.default.scrypt,r);return q0e(i,n)})}function qD(t,e,r,i){try{if($r(t.address)!==ol(t.privateKey))throw new Error("address/privateKey mismatch");if(W0e(t)){let L=t.mnemonic;if(Rf.fromMnemonic(L.phrase,null,L.locale).derivePath(L.path||ph).privateKey!=t.privateKey)throw new Error("mnemonic mismatch")}}catch(L){return Promise.reject(L)}typeof r=="function"&&!i&&(i=r,r={}),r||(r={});let n=ke(t.privateKey),o=S5(e),s=null,a=null,c=null;if(W0e(t)){let L=t.mnemonic;s=ke(s3(L.phrase,L.locale||"en")),a=L.path||ph,c=L.locale||"en"}let h=r.client;h||(h="ethers.js");let g=null;r.salt?g=ke(r.salt):g=kf(32);let b=null;if(r.iv){if(b=ke(r.iv),b.length!==16)throw new Error("invalid iv")}else b=kf(16);let E=null;if(r.uuid){if(E=ke(r.uuid),E.length!==16)throw new Error("invalid uuid")}else E=kf(16);let A=1<<17,T=8,P=1;return r.scrypt&&(r.scrypt.N&&(A=r.scrypt.N),r.scrypt.r&&(T=r.scrypt.r),r.scrypt.p&&(P=r.scrypt.p)),Q_.default.scrypt(o,g,A,T,P,64,i).then(L=>{L=ke(L);let j=L.slice(0,16),$=L.slice(16,32),G=L.slice(32,64),Z=new gh.default.Counter(b),te=new gh.default.ModeOfOperation.ctr(j,Z),se=ke(te.encrypt(n)),X=jr(Fr([$,se])),k={address:t.address.substring(2).toLowerCase(),id:F0e(E),version:3,crypto:{cipher:"aes-128-ctr",cipherparams:{iv:De(b).substring(2)},ciphertext:De(se).substring(2),kdf:"scrypt",kdfparams:{salt:De(g).substring(2),n:A,dklen:32,p:P,r:T},mac:X.substring(2)}};if(s){let F=kf(16),V=new gh.default.Counter(F),M=new gh.default.ModeOfOperation.ctr(G,V),B=ke(M.encrypt(s)),u=new Date,f=u.getUTCFullYear()+"-"+a3(u.getUTCMonth()+1,2)+"-"+a3(u.getUTCDate(),2)+"T"+a3(u.getUTCHours(),2)+"-"+a3(u.getUTCMinutes(),2)+"-"+a3(u.getUTCSeconds(),2)+".0Z";k["x-ethers"]={client:h,gethFilename:"UTC--"+f+"--"+k.address,mnemonicCounter:De(F).substring(2),mnemonicCiphertext:De(B).substring(2),path:a,locale:c,version:"0.1"}}return JSON.stringify(k)})}function G0e(t,e,r){if(Y_(t)){r&&r(0);let i=UD(t,e);return r&&r(1),Promise.resolve(i)}return J_(t)?K0e(t,e,r):Promise.reject(new Error("invalid JSON wallet"))}function Z0e(t,e){if(Y_(t))return UD(t,e);if(J_(t))return V0e(t,e);throw new Error("invalid JSON wallet")}var Y0e="wallet/5.7.0";var J0e=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},c3=new fe(Y0e);function wze(t){return t!=null&&Zt(t.privateKey,32)&&t.address!=null}function vze(t){let e=t.mnemonic;return e&&e.phrase}var I5=class t extends rc{constructor(e,r){if(super(),wze(e)){let i=new nl(e.privateKey);if(ye(this,"_signingKey",()=>i),ye(this,"address",ol(this.publicKey)),this.address!==$r(e.address)&&c3.throwArgumentError("privateKey/address mismatch","privateKey","[REDACTED]"),vze(e)){let n=e.mnemonic;ye(this,"_mnemonic",()=>({phrase:n.phrase,path:n.path||ph,locale:n.locale||"en"}));let o=this.mnemonic,s=Rf.fromMnemonic(o.phrase,null,o.locale).derivePath(o.path);ol(s.privateKey)!==this.address&&c3.throwArgumentError("mnemonic/address mismatch","privateKey","[REDACTED]")}else ye(this,"_mnemonic",()=>null)}else{if(nl.isSigningKey(e))e.curve!=="secp256k1"&&c3.throwArgumentError("unsupported curve; must be secp256k1","privateKey","[REDACTED]"),ye(this,"_signingKey",()=>e);else{typeof e=="string"&&e.match(/^[0-9a-f]*$/i)&&e.length===64&&(e="0x"+e);let i=new nl(e);ye(this,"_signingKey",()=>i)}ye(this,"_mnemonic",()=>null),ye(this,"address",ol(this.publicKey))}r&&!Xc.isProvider(r)&&c3.throwArgumentError("invalid provider","provider",r),ye(this,"provider",r||null)}get mnemonic(){return this._mnemonic()}get privateKey(){return this._signingKey().privateKey}get publicKey(){return this._signingKey().publicKey}getAddress(){return Promise.resolve(this.address)}connect(e){return new t(this,e)}signTransaction(e){return $i(e).then(r=>{r.from!=null&&($r(r.from)!==this.address&&c3.throwArgumentError("transaction from address mismatch","transaction.from",e.from),delete r.from);let i=this._signingKey().signDigest(jr(b5(r)));return b5(r,i)})}signMessage(e){return J0e(this,void 0,void 0,function*(){return i5(this._signingKey().signDigest(zw(e)))})}_signTypedData(e,r,i){return J0e(this,void 0,void 0,function*(){let n=yield Qc.resolveNames(e,r,i,o=>(this.provider==null&&c3.throwError("cannot resolve ENS names without a provider",fe.errors.UNSUPPORTED_OPERATION,{operation:"resolveName",value:o}),this.provider.resolveName(o)));return i5(this._signingKey().signDigest(Qc.hash(n.domain,r,n.value)))})}encrypt(e,r,i){if(typeof r=="function"&&!i&&(i=r,r={}),i&&typeof i!="function")throw new Error("invalid callback");return r||(r={}),qD(this,e,r,i)}static createRandom(e){let r=kf(16);e||(e={}),e.extraEntropy&&(r=ke(ji(jr(Fr([r,e.extraEntropy])),0,16)));let i=Fm(r,e.locale);return t.fromMnemonic(i,e.path,e.locale)}static fromEncryptedJson(e,r,i){return G0e(e,r,i).then(n=>new t(n))}static fromEncryptedJsonSync(e,r){return new t(Z0e(e,r))}static fromMnemonic(e,r,i){return r||(r=ph),new t(Rf.fromMnemonic(e,null,i).derivePath(r))}};function Q0e(t,e){return Mm(zw(t),e)}function X0e(t,e,r,i){return Mm(Qc.hash(t,e,r),i)}var mE={};Mi(mE,{AlchemyProvider:()=>p3,AlchemyWebSocketProvider:()=>U5,AnkrProvider:()=>F5,BaseProvider:()=>Pf,CloudflareProvider:()=>j5,EtherscanProvider:()=>$5,FallbackProvider:()=>q5,Formatter:()=>jm,InfuraProvider:()=>g3,InfuraWebSocketProvider:()=>z5,IpcProvider:()=>rL,JsonRpcBatchProvider:()=>dE,JsonRpcProvider:()=>ma,JsonRpcSigner:()=>h3,NodesmithProvider:()=>V5,PocketProvider:()=>K5,Provider:()=>Xc,Resolver:()=>f3,StaticJsonRpcProvider:()=>B5,UrlJsonRpcProvider:()=>bs,Web3Provider:()=>G5,WebSocketProvider:()=>bh,getDefaultProvider:()=>pE,getNetwork:()=>T5,isCommunityResourcable:()=>VD,isCommunityResource:()=>N5,showThrottleMessage:()=>Nf});var ehe="networks/5.7.1";var the=new fe(ehe);function bze(t){return t&&typeof t.renetwork=="function"}function wh(t){let e=function(r,i){i==null&&(i={});let n=[];if(r.InfuraProvider&&i.infura!=="-")try{n.push(new r.InfuraProvider(t,i.infura))}catch{}if(r.EtherscanProvider&&i.etherscan!=="-")try{n.push(new r.EtherscanProvider(t,i.etherscan))}catch{}if(r.AlchemyProvider&&i.alchemy!=="-")try{n.push(new r.AlchemyProvider(t,i.alchemy))}catch{}if(r.PocketProvider&&i.pocket!=="-"){let o=["goerli","ropsten","rinkeby","sepolia"];try{let s=new r.PocketProvider(t,i.pocket);s.network&&o.indexOf(s.network.name)===-1&&n.push(s)}catch{}}if(r.CloudflareProvider&&i.cloudflare!=="-")try{n.push(new r.CloudflareProvider(t))}catch{}if(r.AnkrProvider&&i.ankr!=="-")try{let o=["ropsten"],s=new r.AnkrProvider(t,i.ankr);s.network&&o.indexOf(s.network.name)===-1&&n.push(s)}catch{}if(n.length===0)return null;if(r.FallbackProvider){let o=1;return i.quorum!=null?o=i.quorum:t==="homestead"&&(o=2),new r.FallbackProvider(n,o)}return n[0]};return e.renetwork=function(r){return wh(r)},e}function eE(t,e){let r=function(i,n){return i.JsonRpcProvider?new i.JsonRpcProvider(t,e):null};return r.renetwork=function(i){return eE(t,i)},r}var rhe={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:wh("homestead")},ihe={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:wh("ropsten")},nhe={chainId:63,name:"classicMordor",_defaultProvider:eE("https://www.ethercluster.com/mordor","classicMordor")},X_={unspecified:{chainId:0,name:"unspecified"},homestead:rhe,mainnet:rhe,morden:{chainId:2,name:"morden"},ropsten:ihe,testnet:ihe,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:wh("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:wh("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:wh("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:wh("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:eE("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:nhe,classicTestnet:nhe,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:eE("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:wh("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:wh("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function T5(t){if(t==null)return null;if(typeof t=="number"){for(let i in X_){let n=X_[i];if(n.chainId===t)return{name:n.name,chainId:n.chainId,ensAddress:n.ensAddress||null,_defaultProvider:n._defaultProvider||null}}return{chainId:t,name:"unknown"}}if(typeof t=="string"){let i=X_[t];return i==null?null:{name:i.name,chainId:i.chainId,ensAddress:i.ensAddress,_defaultProvider:i._defaultProvider||null}}let e=X_[t.name];if(!e)return typeof t.chainId!="number"&&the.throwArgumentError("invalid network chainId","network",t),t;t.chainId!==0&&t.chainId!==e.chainId&&the.throwArgumentError("network chainId mismatch","network",t);let r=t._defaultProvider||null;return r==null&&e._defaultProvider&&(bze(e._defaultProvider)?r=e._defaultProvider.renetwork(t):r=e._defaultProvider),{name:t.name,chainId:e.chainId,ensAddress:t.ensAddress||e.ensAddress||null,_defaultProvider:r}}var ohe="web/5.7.1";var yze=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})};function she(t,e){return yze(this,void 0,void 0,function*(){e==null&&(e={});let r={method:e.method||"GET",headers:e.headers||{},body:e.body||void 0};if(e.skipFetchSetup!==!0&&(r.mode="cors",r.cache="no-cache",r.credentials="same-origin",r.redirect="follow",r.referrer="client"),e.fetchOptions!=null){let s=e.fetchOptions;s.mode&&(r.mode=s.mode),s.cache&&(r.cache=s.cache),s.credentials&&(r.credentials=s.credentials),s.redirect&&(r.redirect=s.redirect),s.referrer&&(r.referrer=s.referrer)}let i=yield fetch(t,r),n=yield i.arrayBuffer(),o={};return i.headers.forEach?i.headers.forEach((s,a)=>{o[a.toLowerCase()]=s}):i.headers.keys().forEach(s=>{o[s.toLowerCase()]=i.headers.get(s)}),{headers:o,statusCode:i.status,statusMessage:i.statusText,body:ke(new Uint8Array(n))}})}var xze=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},Yl=new fe(ohe);function ahe(t){return new Promise(e=>{setTimeout(e,t)})}function lp(t,e){if(t==null)return null;if(typeof t=="string")return t;if(nh(t)){if(e&&(e.split("/")[0]==="text"||e.split(";")[0].trim()==="application/json"))try{return ha(t)}catch{}return De(t)}return t}function _ze(t){return fi(t.replace(/%([0-9a-f][0-9a-f])/gi,(e,r)=>String.fromCharCode(parseInt(r,16))))}function HD(t,e,r){let i=typeof t=="object"&&t.throttleLimit!=null?t.throttleLimit:12;Yl.assertArgument(i>0&&i%1===0,"invalid connection throttle limit","connection.throttleLimit",i);let n=typeof t=="object"?t.throttleCallback:null,o=typeof t=="object"&&typeof t.throttleSlotInterval=="number"?t.throttleSlotInterval:100;Yl.assertArgument(o>0&&o%1===0,"invalid connection throttle slot interval","connection.throttleSlotInterval",o);let s=typeof t=="object"?!!t.errorPassThrough:!1,a={},c=null,h={method:"GET"},g=!1,b=2*60*1e3;if(typeof t=="string")c=t;else if(typeof t=="object"){if((t==null||t.url==null)&&Yl.throwArgumentError("missing URL","connection.url",t),c=t.url,typeof t.timeout=="number"&&t.timeout>0&&(b=t.timeout),t.headers)for(let j in t.headers)a[j.toLowerCase()]={key:j,value:String(t.headers[j])},["if-none-match","if-modified-since"].indexOf(j.toLowerCase())>=0&&(g=!0);if(h.allowGzip=!!t.allowGzip,t.user!=null&&t.password!=null){c.substring(0,6)!=="https:"&&t.allowInsecureAuthentication!==!0&&Yl.throwError("basic authentication requires a secure https url",fe.errors.INVALID_ARGUMENT,{argument:"url",url:c,user:t.user,password:"[REDACTED]"});let j=t.user+":"+t.password;a.authorization={key:"Authorization",value:"Basic "+Hw(fi(j))}}t.skipFetchSetup!=null&&(h.skipFetchSetup=!!t.skipFetchSetup),t.fetchOptions!=null&&(h.fetchOptions=pi(t.fetchOptions))}let E=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),A=c?c.match(E):null;if(A)try{let j={statusCode:200,statusMessage:"OK",headers:{"content-type":A[1]||"text/plain"},body:A[2]?qw(A[3]):_ze(A[3])},$=j.body;return r&&($=r(j.body,j)),Promise.resolve($)}catch(j){Yl.throwError("processing response error",fe.errors.SERVER_ERROR,{body:lp(A[1],A[2]),error:j,requestBody:null,requestMethod:"GET",url:c})}e&&(h.method="POST",h.body=e,a["content-type"]==null&&(a["content-type"]={key:"Content-Type",value:"application/octet-stream"}),a["content-length"]==null&&(a["content-length"]={key:"Content-Length",value:String(e.length)}));let T={};Object.keys(a).forEach(j=>{let $=a[j];T[$.key]=$.value}),h.headers=T;let P=function(){let j=null;return{promise:new Promise(function(Z,te){b&&(j=setTimeout(()=>{j!=null&&(j=null,te(Yl.makeError("timeout",fe.errors.TIMEOUT,{requestBody:lp(h.body,T["content-type"]),requestMethod:h.method,timeout:b,url:c})))},b))}),cancel:function(){j!=null&&(clearTimeout(j),j=null)}}}(),L=function(){return xze(this,void 0,void 0,function*(){for(let j=0;j<i;j++){let $=null;try{if($=yield she(c,h),j<i){if($.statusCode===301||$.statusCode===302){let Z=$.headers.location||"";if(h.method==="GET"&&Z.match(/^https:/)){c=$.headers.location;continue}}else if($.statusCode===429){let Z=!0;if(n&&(Z=yield n(j,c)),Z){let te=0,se=$.headers["retry-after"];typeof se=="string"&&se.match(/^[1-9][0-9]*$/)?te=parseInt(se)*1e3:te=o*parseInt(String(Math.random()*Math.pow(2,j))),yield ahe(te);continue}}}}catch(Z){$=Z.response,$==null&&(P.cancel(),Yl.throwError("missing response",fe.errors.SERVER_ERROR,{requestBody:lp(h.body,T["content-type"]),requestMethod:h.method,serverError:Z,url:c}))}let G=$.body;if(g&&$.statusCode===304?G=null:!s&&($.statusCode<200||$.statusCode>=300)&&(P.cancel(),Yl.throwError("bad response",fe.errors.SERVER_ERROR,{status:$.statusCode,headers:$.headers,body:lp(G,$.headers?$.headers["content-type"]:null),requestBody:lp(h.body,T["content-type"]),requestMethod:h.method,url:c})),r)try{let Z=yield r(G,$);return P.cancel(),Z}catch(Z){if(Z.throttleRetry&&j<i){let te=!0;if(n&&(te=yield n(j,c)),te){let se=o*parseInt(String(Math.random()*Math.pow(2,j)));yield ahe(se);continue}}P.cancel(),Yl.throwError("processing response error",fe.errors.SERVER_ERROR,{body:lp(G,$.headers?$.headers["content-type"]:null),error:Z,requestBody:lp(h.body,T["content-type"]),requestMethod:h.method,url:c})}return P.cancel(),G}return Yl.throwError("failed response",fe.errors.SERVER_ERROR,{requestBody:lp(h.body,T["content-type"]),requestMethod:h.method,url:c})})}();return Promise.race([P.promise,L])}function Jl(t,e,r){let i=(o,s)=>{let a=null;if(o!=null)try{a=JSON.parse(ha(o))}catch(c){Yl.throwError("invalid JSON",fe.errors.SERVER_ERROR,{body:o,error:c})}return r&&(a=r(a,s)),a},n=null;if(e!=null){n=fi(e);let o=typeof t=="string"?{url:t}:pi(t);o.headers?Object.keys(o.headers).filter(a=>a.toLowerCase()==="content-type").length!==0||(o.headers=pi(o.headers),o.headers["content-type"]="application/json"):o.headers={"content-type":"application/json"},t=o}return HD(t,n,i)}function Ql(t,e){return e||(e={}),e=pi(e),e.floor==null&&(e.floor=0),e.ceiling==null&&(e.ceiling=1e4),e.interval==null&&(e.interval=250),new Promise(function(r,i){let n=null,o=!1,s=()=>o?!1:(o=!0,n&&clearTimeout(n),!0);e.timeout&&(n=setTimeout(()=>{s()&&i(new Error("timeout"))},e.timeout));let a=e.retryLimit,c=0;function h(){return t().then(function(g){if(g!==void 0)s()&&r(g);else if(e.oncePoll)e.oncePoll.once("poll",h);else if(e.onceBlock)e.onceBlock.once("block",h);else if(!o){if(c++,c>a){s()&&i(new Error("retry limit reached"));return}let b=e.interval*parseInt(String(Math.random()*Math.pow(2,c)));b<e.floor&&(b=e.floor),b>e.ceiling&&(b=e.ceiling),setTimeout(h,b)}return null},function(g){s()&&i(g)})}h()})}var YD=Wt(fhe());var Si="providers/5.7.2";var k5=new fe(Si),jm=class t{constructor(){this.formats=this.getDefaultFormats()}getDefaultFormats(){let e={},r=this.address.bind(this),i=this.bigNumber.bind(this),n=this.blockTag.bind(this),o=this.data.bind(this),s=this.hash.bind(this),a=this.hex.bind(this),c=this.number.bind(this),h=this.type.bind(this),g=b=>this.data(b,!0);return e.transaction={hash:s,type:h,accessList:t.allowNull(this.accessList.bind(this),null),blockHash:t.allowNull(s,null),blockNumber:t.allowNull(c,null),transactionIndex:t.allowNull(c,null),confirmations:t.allowNull(c,null),from:r,gasPrice:t.allowNull(i),maxPriorityFeePerGas:t.allowNull(i),maxFeePerGas:t.allowNull(i),gasLimit:i,to:t.allowNull(r,null),value:i,nonce:c,data:o,r:t.allowNull(this.uint256),s:t.allowNull(this.uint256),v:t.allowNull(c),creates:t.allowNull(r,null),raw:t.allowNull(o)},e.transactionRequest={from:t.allowNull(r),nonce:t.allowNull(c),gasLimit:t.allowNull(i),gasPrice:t.allowNull(i),maxPriorityFeePerGas:t.allowNull(i),maxFeePerGas:t.allowNull(i),to:t.allowNull(r),value:t.allowNull(i),data:t.allowNull(g),type:t.allowNull(c),accessList:t.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:c,blockNumber:c,transactionHash:s,address:r,topics:t.arrayOf(s),data:o,logIndex:c,blockHash:s},e.receipt={to:t.allowNull(this.address,null),from:t.allowNull(this.address,null),contractAddress:t.allowNull(r,null),transactionIndex:c,root:t.allowNull(a),gasUsed:i,logsBloom:t.allowNull(o),blockHash:s,transactionHash:s,logs:t.arrayOf(this.receiptLog.bind(this)),blockNumber:c,confirmations:t.allowNull(c,null),cumulativeGasUsed:i,effectiveGasPrice:t.allowNull(i),status:t.allowNull(c),type:h},e.block={hash:t.allowNull(s),parentHash:s,number:c,timestamp:c,nonce:t.allowNull(a),difficulty:this.difficulty.bind(this),gasLimit:i,gasUsed:i,miner:t.allowNull(r),extraData:o,transactions:t.allowNull(t.arrayOf(s)),baseFeePerGas:t.allowNull(i)},e.blockWithTransactions=pi(e.block),e.blockWithTransactions.transactions=t.allowNull(t.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:t.allowNull(n,void 0),toBlock:t.allowNull(n,void 0),blockHash:t.allowNull(s,void 0),address:t.allowNull(r,void 0),topics:t.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:t.allowNull(c),blockHash:t.allowNull(s),transactionIndex:c,removed:t.allowNull(this.boolean.bind(this)),address:r,data:t.allowFalsish(o,"0x"),topics:t.arrayOf(s),transactionHash:s,logIndex:c},e}accessList(e){return sc(e||[])}number(e){return e==="0x"?0:Ue.from(e).toNumber()}type(e){return e==="0x"||e==null?0:Ue.from(e).toNumber()}bigNumber(e){return Ue.from(e)}boolean(e){if(typeof e=="boolean")return e;if(typeof e=="string"){if(e=e.toLowerCase(),e==="true")return!0;if(e==="false")return!1}throw new Error("invalid boolean - "+e)}hex(e,r){return typeof e=="string"&&(!r&&e.substring(0,2)!=="0x"&&(e="0x"+e),Zt(e))?e.toLowerCase():k5.throwArgumentError("invalid hash","value",e)}data(e,r){let i=this.hex(e,r);if(i.length%2!==0)throw new Error("invalid data; odd-length - "+e);return i}address(e){return $r(e)}callAddress(e){if(!Zt(e,32))return null;let r=$r(ji(e,12));return r===v_?null:r}contractAddress(e){return Rm(e)}blockTag(e){if(e==null)return"latest";if(e==="earliest")return"0x0";switch(e){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return e}if(typeof e=="number"||Zt(e))return hf(e);throw new Error("invalid blockTag")}hash(e,r){let i=this.hex(e,r);return ps(i)!==32?k5.throwArgumentError("invalid hash","value",e):i}difficulty(e){if(e==null)return null;let r=Ue.from(e);try{return r.toNumber()}catch{}return null}uint256(e){if(!Zt(e))throw new Error("invalid uint256");return Kr(e,32)}_block(e,r){e.author!=null&&e.miner==null&&(e.miner=e.author);let i=e._difficulty!=null?e._difficulty:e.difficulty,n=t.check(r,e);return n._difficulty=i==null?null:Ue.from(i),n}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return t.check(this.formats.transactionRequest,e)}transactionResponse(e){e.gas!=null&&e.gasLimit==null&&(e.gasLimit=e.gas),e.to&&Ue.from(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),e.input!=null&&e.data==null&&(e.data=e.input),e.to==null&&e.creates==null&&(e.creates=this.contractAddress(e)),(e.type===1||e.type===2)&&e.accessList==null&&(e.accessList=[]);let r=t.check(this.formats.transaction,e);if(e.chainId!=null){let i=e.chainId;Zt(i)&&(i=Ue.from(i).toNumber()),r.chainId=i}else{let i=e.networkId;i==null&&r.v==null&&(i=e.chainId),Zt(i)&&(i=Ue.from(i).toNumber()),typeof i!="number"&&r.v!=null&&(i=(r.v-35)/2,i<0&&(i=0),i=parseInt(i)),typeof i!="number"&&(i=0),r.chainId=i}return r.blockHash&&r.blockHash.replace(/0/g,"")==="x"&&(r.blockHash=null),r}transaction(e){return $_(e)}receiptLog(e){return t.check(this.formats.receiptLog,e)}receipt(e){let r=t.check(this.formats.receipt,e);if(r.root!=null)if(r.root.length<=4){let i=Ue.from(r.root).toNumber();i===0||i===1?(r.status!=null&&r.status!==i&&k5.throwArgumentError("alt-root-status/status mismatch","value",{root:r.root,status:r.status}),r.status=i,delete r.root):k5.throwArgumentError("invalid alt-root-status","value.root",r.root)}else r.root.length!==66&&k5.throwArgumentError("invalid root hash","value.root",r.root);return r.status!=null&&(r.byzantium=!0),r}topics(e){return Array.isArray(e)?e.map(r=>this.topics(r)):e!=null?this.hash(e,!0):null}filter(e){return t.check(this.formats.filter,e)}filterLog(e){return t.check(this.formats.filterLog,e)}static check(e,r){let i={};for(let n in e)try{let o=e[n](r[n]);o!==void 0&&(i[n]=o)}catch(o){throw o.checkKey=n,o.checkValue=r[n],o}return i}static allowNull(e,r){return function(i){return i==null?r:e(i)}}static allowFalsish(e,r){return function(i){return i?e(i):r}}static arrayOf(e){return function(r){if(!Array.isArray(r))throw new Error("not an array");let i=[];return r.forEach(function(n){i.push(e(n))}),i}}};function VD(t){return t&&typeof t.isCommunityResource=="function"}function N5(t){return VD(t)&&t.isCommunityResource()}var hhe=!1;function Nf(){hhe||(hhe=!0,console.log("========= NOTICE ========="),console.log("Request-Rate Exceeded (this message will not be repeated)"),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.io/api-keys/"),console.log("=========================="))}var Er=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},Gr=new fe(Si),kze=10;function dhe(t){return t==null?"null":(ps(t)!==32&&Gr.throwArgumentError("invalid topic","topic",t),t.toLowerCase())}function phe(t){for(t=t.slice();t.length>0&&t[t.length-1]==null;)t.pop();return t.map(e=>{if(Array.isArray(e)){let r={};e.forEach(n=>{r[dhe(n)]=!0});let i=Object.keys(r);return i.sort(),i.join("|")}else return dhe(e)}).join("&")}function Nze(t){return t===""?[]:t.split(/&/g).map(e=>{if(e==="")return[];let r=e.split("|").map(i=>i==="null"?null:i);return r.length===1?r[0]:r})}function u3(t){if(typeof t=="string"){if(t=t.toLowerCase(),ps(t)===32)return"tx:"+t;if(t.indexOf(":")===-1)return t}else{if(Array.isArray(t))return"filter:*:"+phe(t);if(k_.isForkEvent(t))throw Gr.warn("not implemented"),new Error("not implemented");if(t&&typeof t=="object")return"filter:"+(t.address||"*")+":"+phe(t.topics||[])}throw new Error("invalid event - "+t)}function P5(){return new Date().getTime()}function mhe(t){return new Promise(e=>{setTimeout(e,t)})}var Pze=["block","network","pending","poll"],JD=class{constructor(e,r,i){ye(this,"tag",e),ye(this,"listener",r),ye(this,"once",i),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){let e=this.tag.split(":");return e[0]!=="tx"?null:e[1]}get filter(){let e=this.tag.split(":");if(e[0]!=="filter")return null;let r=e[1],i=Nze(e[2]),n={};return i.length>0&&(n.topics=i),r&&r!=="*"&&(n.address=r),n}pollable(){return this.tag.indexOf(":")>=0||Pze.indexOf(this.tag)>=0}},Oze={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function KD(t){return Kr(Ue.from(t).toHexString(),32)}function ghe(t){return hh.encode(Fr([t,ji(pa(pa(t)),0,4)]))}var bhe=new RegExp("^(ipfs)://(.*)$","i"),whe=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),bhe,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function nE(t,e){try{return ha(O5(t,e))}catch{}return null}function O5(t,e){if(t==="0x")return null;let r=Ue.from(ji(t,e,e+32)).toNumber(),i=Ue.from(ji(t,r,r+32)).toNumber();return ji(t,r+32,r+32+i)}function GD(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):Gr.throwArgumentError("unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}function vhe(t){let e=ke(t);if(e.length>32)throw new Error("internal; should not happen");let r=new Uint8Array(32);return r.set(e,32-e.length),r}function Mze(t){if(t.length%32===0)return t;let e=new Uint8Array(Math.ceil(t.length/32)*32);return e.set(t),e}function yhe(t){let e=[],r=0;for(let i=0;i<t.length;i++)e.push(null),r+=32;for(let i=0;i<t.length;i++){let n=ke(t[i]);e[i]=vhe(r),e.push(vhe(n.length)),e.push(Mze(n)),r+=32+Math.ceil(n.length/32)*32}return Vn(e)}var f3=class{constructor(e,r,i,n){ye(this,"provider",e),ye(this,"name",i),ye(this,"address",e.formatter.address(r)),ye(this,"_resolvedAddress",n)}supportsWildcard(){return this._supportsEip2544||(this._supportsEip2544=this.provider.call({to:this.address,data:"0x01ffc9a79061b92300000000000000000000000000000000000000000000000000000000"}).then(e=>Ue.from(e).eq(1)).catch(e=>{if(e.code===fe.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e})),this._supportsEip2544}_fetch(e,r){return Er(this,void 0,void 0,function*(){let i={to:this.address,ccipReadEnabled:!0,data:Vn([e,ip(this.name),r||"0x"])},n=!1;(yield this.supportsWildcard())&&(n=!0,i.data=Vn(["0x9061b923",yhe([m5(this.name),i.data])]));try{let o=yield this.provider.call(i);return ke(o).length%32===4&&Gr.throwError("resolver threw error",fe.errors.CALL_EXCEPTION,{transaction:i,data:o}),n&&(o=O5(o,0)),o}catch(o){if(o.code===fe.errors.CALL_EXCEPTION)return null;throw o}})}_fetchBytes(e,r){return Er(this,void 0,void 0,function*(){let i=yield this._fetch(e,r);return i!=null?O5(i,0):null})}_getAddress(e,r){let i=Oze[String(e)];if(i==null&&Gr.throwError(`unsupported coin type: ${e}`,fe.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),i.ilk==="eth")return this.provider.formatter.address(r);let n=ke(r);if(i.p2pkh!=null){let o=r.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(o){let s=parseInt(o[1],16);if(o[2].length===s*2&&s>=1&&s<=75)return ghe(Fr([[i.p2pkh],"0x"+o[2]]))}}if(i.p2sh!=null){let o=r.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(o){let s=parseInt(o[1],16);if(o[2].length===s*2&&s>=1&&s<=75)return ghe(Fr([[i.p2sh],"0x"+o[2]]))}}if(i.prefix!=null){let o=n[1],s=n[0];if(s===0?o!==20&&o!==32&&(s=-1):s=-1,s>=0&&n.length===2+o&&o>=1&&o<=75){let a=YD.default.toWords(n.slice(2));return a.unshift(s),YD.default.encode(i.prefix,a)}}return null}getAddress(e){return Er(this,void 0,void 0,function*(){if(e==null&&(e=60),e===60)try{let n=yield this._fetch("0x3b3b57de");return n==="0x"||n===$w?null:this.provider.formatter.callAddress(n)}catch(n){if(n.code===fe.errors.CALL_EXCEPTION)return null;throw n}let r=yield this._fetchBytes("0xf1cb7e06",KD(e));if(r==null||r==="0x")return null;let i=this._getAddress(e,r);return i==null&&Gr.throwError("invalid or unsupported coin data",fe.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:r}),i})}getAvatar(){return Er(this,void 0,void 0,function*(){let e=[{type:"name",content:this.name}];try{let r=yield this.getText("avatar");if(r==null)return null;for(let i=0;i<whe.length;i++){let n=r.match(whe[i]);if(n==null)continue;let o=n[1].toLowerCase();switch(o){case"https":return e.push({type:"url",content:r}),{linkage:e,url:r};case"data":return e.push({type:"data",content:r}),{linkage:e,url:r};case"ipfs":return e.push({type:"ipfs",content:r}),{linkage:e,url:GD(r)};case"erc721":case"erc1155":{let s=o==="erc721"?"0xc87b56dd":"0x0e89341c";e.push({type:o,content:r});let a=this._resolvedAddress||(yield this.getAddress()),c=(n[2]||"").split("/");if(c.length!==2)return null;let h=yield this.provider.formatter.address(c[0]),g=Kr(Ue.from(c[1]).toHexString(),32);if(o==="erc721"){let P=this.provider.formatter.callAddress(yield this.provider.call({to:h,data:Vn(["0x6352211e",g])}));if(a!==P)return null;e.push({type:"owner",content:P})}else if(o==="erc1155"){let P=Ue.from(yield this.provider.call({to:h,data:Vn(["0x00fdd58e",Kr(a,32),g])}));if(P.isZero())return null;e.push({type:"balance",content:P.toString()})}let b={to:this.provider.formatter.address(c[0]),data:Vn([s,g])},E=nE(yield this.provider.call(b),0);if(E==null)return null;e.push({type:"metadata-url-base",content:E}),o==="erc1155"&&(E=E.replace("{id}",g.substring(2)),e.push({type:"metadata-url-expanded",content:E})),E.match(/^ipfs:/i)&&(E=GD(E)),e.push({type:"metadata-url",content:E});let A=yield Jl(E);if(!A)return null;e.push({type:"metadata",content:JSON.stringify(A)});let T=A.image;if(typeof T!="string")return null;if(!T.match(/^(https:\/\/|data:)/i)){if(T.match(bhe)==null)return null;e.push({type:"url-ipfs",content:T}),T=GD(T)}return e.push({type:"url",content:T}),{linkage:e,url:T}}}}}catch{}return null})}getContentHash(){return Er(this,void 0,void 0,function*(){let e=yield this._fetchBytes("0xbc1c58d1");if(e==null||e==="0x")return null;let r=e.match(/^0xe3010170(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(r){let s=parseInt(r[3],16);if(r[4].length===s*2)return"ipfs://"+hh.encode("0x"+r[1])}let i=e.match(/^0xe5010172(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(i){let s=parseInt(i[3],16);if(i[4].length===s*2)return"ipns://"+hh.encode("0x"+i[1])}let n=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(n&&n[1].length===32*2)return"bzz://"+n[1];let o=e.match(/^0x90b2c605([0-9a-f]*)$/);if(o&&o[1].length===34*2){let s={"=":"","+":"-","/":"_"};return"sia://"+Hw("0x"+o[1]).replace(/[=+\/]/g,c=>s[c])}return Gr.throwError("invalid or unsupported content hash data",fe.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})})}getText(e){return Er(this,void 0,void 0,function*(){let r=fi(e);r=Fr([KD(64),KD(r.length),r]),r.length%32!==0&&(r=Fr([r,Kr("0x",32-e.length%32)]));let i=yield this._fetchBytes("0x59d1d43c",De(r));return i==null||i==="0x"?null:ha(i)})}},ZD=null,Dze=1,Pf=class extends Xc{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),ye(this,"anyNetwork",e==="any"),this.anyNetwork&&(e=this.detectNetwork()),e instanceof Promise)this._networkPromise=e,e.catch(r=>{}),this._ready().catch(r=>{});else{let r=bn(new.target,"getNetwork")(e);r?(ye(this,"_network",r),this.emit("network",r,null)):Gr.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return Er(this,void 0,void 0,function*(){if(this._network==null){let e=null;if(this._networkPromise)try{e=yield this._networkPromise}catch{}e==null&&(e=yield this.detectNetwork()),e||Gr.throwError("no network detected",fe.errors.UNKNOWN_ERROR,{}),this._network==null&&(this.anyNetwork?this._network=e:ye(this,"_network",e),this.emit("network",e,null))}return this._network})}get ready(){return Ql(()=>this._ready().then(e=>e,e=>{if(!(e.code===fe.errors.NETWORK_ERROR&&e.event==="noNetwork"))throw e}))}static getFormatter(){return ZD==null&&(ZD=new jm),ZD}static getNetwork(e){return T5(e??"homestead")}ccipReadFetch(e,r,i){return Er(this,void 0,void 0,function*(){if(this.disableCcipRead||i.length===0)return null;let n=e.to.toLowerCase(),o=r.toLowerCase(),s=[];for(let a=0;a<i.length;a++){let c=i[a],h=c.replace("{sender}",n).replace("{data}",o),g=c.indexOf("{data}")>=0?null:JSON.stringify({data:o,sender:n}),b=yield Jl({url:h,errorPassThrough:!0},g,(A,T)=>(A.status=T.statusCode,A));if(b.data)return b.data;let E=b.message||"unknown error";if(b.status>=400&&b.status<500)return Gr.throwError(`response not found during CCIP fetch: ${E}`,fe.errors.SERVER_ERROR,{url:c,errorMessage:E});s.push(E)}return Gr.throwError(`error encountered during CCIP fetch: ${s.map(a=>JSON.stringify(a)).join(", ")}`,fe.errors.SERVER_ERROR,{urls:i,errorMessages:s})})}_getInternalBlockNumber(e){return Er(this,void 0,void 0,function*(){if(yield this._ready(),e>0)for(;this._internalBlockNumber;){let n=this._internalBlockNumber;try{let o=yield n;if(P5()-o.respTime<=e)return o.blockNumber;break}catch{if(this._internalBlockNumber===n)break}}let r=P5(),i=$i({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then(n=>null,n=>n)}).then(({blockNumber:n,networkError:o})=>{if(o)throw this._internalBlockNumber===i&&(this._internalBlockNumber=null),o;let s=P5();return n=Ue.from(n).toNumber(),n<this._maxInternalBlockNumber&&(n=this._maxInternalBlockNumber),this._maxInternalBlockNumber=n,this._setFastBlockNumber(n),{blockNumber:n,reqTime:r,respTime:s}});return this._internalBlockNumber=i,i.catch(n=>{this._internalBlockNumber===i&&(this._internalBlockNumber=null)}),(yield i).blockNumber})}poll(){return Er(this,void 0,void 0,function*(){let e=Dze++,r=[],i=null;try{i=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(n){this.emit("error",n);return}if(this._setFastBlockNumber(i),this.emit("poll",e,i),i===this._lastBlockNumber){this.emit("didPoll",e);return}if(this._emitted.block===-2&&(this._emitted.block=i-1),Math.abs(this._emitted.block-i)>1e3)Gr.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${i})`),this.emit("error",Gr.makeError("network block skew detected",fe.errors.NETWORK_ERROR,{blockNumber:i,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",i);else for(let n=this._emitted.block+1;n<=i;n++)this.emit("block",n);this._emitted.block!==i&&(this._emitted.block=i,Object.keys(this._emitted).forEach(n=>{if(n==="block")return;let o=this._emitted[n];o!=="pending"&&i-o>12&&delete this._emitted[n]})),this._lastBlockNumber===-2&&(this._lastBlockNumber=i-1),this._events.forEach(n=>{switch(n.type){case"tx":{let o=n.hash,s=this.getTransactionReceipt(o).then(a=>(!a||a.blockNumber==null||(this._emitted["t:"+o]=a.blockNumber,this.emit(o,a)),null)).catch(a=>{this.emit("error",a)});r.push(s);break}case"filter":{if(!n._inflight){n._inflight=!0,n._lastBlockNumber===-2&&(n._lastBlockNumber=i-1);let o=n.filter;o.fromBlock=n._lastBlockNumber+1,o.toBlock=i;let s=o.toBlock-this._maxFilterBlockRange;s>o.fromBlock&&(o.fromBlock=s),o.fromBlock<0&&(o.fromBlock=0);let a=this.getLogs(o).then(c=>{n._inflight=!1,c.length!==0&&c.forEach(h=>{h.blockNumber>n._lastBlockNumber&&(n._lastBlockNumber=h.blockNumber),this._emitted["b:"+h.blockHash]=h.blockNumber,this._emitted["t:"+h.transactionHash]=h.blockNumber,this.emit(o,h)})}).catch(c=>{this.emit("error",c),n._inflight=!1});r.push(a)}break}}}),this._lastBlockNumber=i,Promise.all(r).then(()=>{this.emit("didPoll",e)}).catch(n=>{this.emit("error",n)})})}resetEventsBlock(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return Er(this,void 0,void 0,function*(){return Gr.throwError("provider does not support network detection",fe.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})})}getNetwork(){return Er(this,void 0,void 0,function*(){let e=yield this._ready(),r=yield this.detectNetwork();if(e.chainId!==r.chainId){if(this.anyNetwork)return this._network=r,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",r,e),yield mhe(0),this._network;let i=Gr.makeError("underlying network changed",fe.errors.NETWORK_ERROR,{event:"changed",network:e,detectedNetwork:r});throw this.emit("error",i),i}return e})}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then(e=>{this._setFastBlockNumber(e)},e=>{}),this._fastBlockNumber!=null?this._fastBlockNumber:-1}get polling(){return this._poller!=null}set polling(e){e&&!this._poller?(this._poller=setInterval(()=>{this.poll()},this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout(()=>{this.poll(),this._bootstrapPoll=setTimeout(()=>{this._poller||this.poll(),this._bootstrapPoll=null},this.pollingInterval)},0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(e){if(typeof e!="number"||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval(()=>{this.poll()},this._pollingInterval))}_getFastBlockNumber(){let e=P5();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then(r=>((this._fastBlockNumber==null||r>this._fastBlockNumber)&&(this._fastBlockNumber=r),this._fastBlockNumber))),this._fastBlockNumberPromise}_setFastBlockNumber(e){this._fastBlockNumber!=null&&e<this._fastBlockNumber||(this._fastQueryDate=P5(),(this._fastBlockNumber==null||e>this._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,r,i){return Er(this,void 0,void 0,function*(){return this._waitForTransaction(e,r??1,i||0,null)})}_waitForTransaction(e,r,i,n){return Er(this,void 0,void 0,function*(){let o=yield this.getTransactionReceipt(e);return(o?o.confirmations:0)>=r?o:new Promise((s,a)=>{let c=[],h=!1,g=function(){return h?!0:(h=!0,c.forEach(E=>{E()}),!1)},b=E=>{E.confirmations<r||g()||s(E)};if(this.on(e,b),c.push(()=>{this.removeListener(e,b)}),n){let E=n.startBlock,A=null,T=P=>Er(this,void 0,void 0,function*(){h||(yield mhe(1e3),this.getTransactionCount(n.from).then(L=>Er(this,void 0,void 0,function*(){if(!h){if(L<=n.nonce)E=P;else{{let j=yield this.getTransaction(e);if(j&&j.blockNumber!=null)return}for(A==null&&(A=E-3,A<n.startBlock&&(A=n.startBlock));A<=P;){if(h)return;let j=yield this.getBlockWithTransactions(A);for(let $=0;$<j.transactions.length;$++){let G=j.transactions[$];if(G.hash===e)return;if(G.from===n.from&&G.nonce===n.nonce){if(h)return;let Z=yield this.waitForTransaction(G.hash,r);if(g())return;let te="replaced";G.data===n.data&&G.to===n.to&&G.value.eq(n.value)?te="repriced":G.data==="0x"&&G.from===G.to&&G.value.isZero()&&(te="cancelled"),a(Gr.makeError("transaction was replaced",fe.errors.TRANSACTION_REPLACED,{cancelled:te==="replaced"||te==="cancelled",reason:te,replacement:this._wrapTransaction(G),hash:e,receipt:Z}));return}}A++}}h||this.once("block",T)}}),L=>{h||this.once("block",T)}))});if(h)return;this.once("block",T),c.push(()=>{this.removeListener("block",T)})}if(typeof i=="number"&&i>0){let E=setTimeout(()=>{g()||a(Gr.makeError("timeout exceeded",fe.errors.TIMEOUT,{timeout:i}))},i);E.unref&&E.unref(),c.push(()=>{clearTimeout(E)})}})})}getBlockNumber(){return Er(this,void 0,void 0,function*(){return this._getInternalBlockNumber(0)})}getGasPrice(){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let e=yield this.perform("getGasPrice",{});try{return Ue.from(e)}catch(r){return Gr.throwError("bad result from backend",fe.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:r})}})}getBalance(e,r){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let i=yield $i({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),n=yield this.perform("getBalance",i);try{return Ue.from(n)}catch(o){return Gr.throwError("bad result from backend",fe.errors.SERVER_ERROR,{method:"getBalance",params:i,result:n,error:o})}})}getTransactionCount(e,r){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let i=yield $i({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),n=yield this.perform("getTransactionCount",i);try{return Ue.from(n).toNumber()}catch(o){return Gr.throwError("bad result from backend",fe.errors.SERVER_ERROR,{method:"getTransactionCount",params:i,result:n,error:o})}})}getCode(e,r){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let i=yield $i({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),n=yield this.perform("getCode",i);try{return De(n)}catch(o){return Gr.throwError("bad result from backend",fe.errors.SERVER_ERROR,{method:"getCode",params:i,result:n,error:o})}})}getStorageAt(e,r,i){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let n=yield $i({address:this._getAddress(e),blockTag:this._getBlockTag(i),position:Promise.resolve(r).then(s=>hf(s))}),o=yield this.perform("getStorageAt",n);try{return De(o)}catch(s){return Gr.throwError("bad result from backend",fe.errors.SERVER_ERROR,{method:"getStorageAt",params:n,result:o,error:s})}})}_wrapTransaction(e,r,i){if(r!=null&&ps(r)!==32)throw new Error("invalid response - sendTransaction");let n=e;return r!=null&&e.hash!==r&&Gr.throwError("Transaction hash mismatch from Provider.sendTransaction.",fe.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:r}),n.wait=(o,s)=>Er(this,void 0,void 0,function*(){o==null&&(o=1),s==null&&(s=0);let a;o!==0&&i!=null&&(a={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:i});let c=yield this._waitForTransaction(e.hash,o,s,a);return c==null&&o===0?null:(this._emitted["t:"+e.hash]=c.blockNumber,c.status===0&&Gr.throwError("transaction failed",fe.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:c}),c)}),n}sendTransaction(e){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let r=yield Promise.resolve(e).then(o=>De(o)),i=this.formatter.transaction(e);i.confirmations==null&&(i.confirmations=0);let n=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{let o=yield this.perform("sendTransaction",{signedTransaction:r});return this._wrapTransaction(i,o,n)}catch(o){throw o.transaction=i,o.transactionHash=i.hash,o}})}_getTransactionRequest(e){return Er(this,void 0,void 0,function*(){let r=yield e,i={};return["from","to"].forEach(n=>{r[n]!=null&&(i[n]=Promise.resolve(r[n]).then(o=>o?this._getAddress(o):null))}),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach(n=>{r[n]!=null&&(i[n]=Promise.resolve(r[n]).then(o=>o?Ue.from(o):null))}),["type"].forEach(n=>{r[n]!=null&&(i[n]=Promise.resolve(r[n]).then(o=>o??null))}),r.accessList&&(i.accessList=this.formatter.accessList(r.accessList)),["data"].forEach(n=>{r[n]!=null&&(i[n]=Promise.resolve(r[n]).then(o=>o?De(o):null))}),this.formatter.transactionRequest(yield $i(i))})}_getFilter(e){return Er(this,void 0,void 0,function*(){e=yield e;let r={};return e.address!=null&&(r.address=this._getAddress(e.address)),["blockHash","topics"].forEach(i=>{e[i]!=null&&(r[i]=e[i])}),["fromBlock","toBlock"].forEach(i=>{e[i]!=null&&(r[i]=this._getBlockTag(e[i]))}),this.formatter.filter(yield $i(r))})}_call(e,r,i){return Er(this,void 0,void 0,function*(){i>=kze&&Gr.throwError("CCIP read exceeded maximum redirections",fe.errors.SERVER_ERROR,{redirects:i,transaction:e});let n=e.to,o=yield this.perform("call",{transaction:e,blockTag:r});if(i>=0&&r==="latest"&&n!=null&&o.substring(0,10)==="0x556f1830"&&ps(o)%32===4)try{let s=ji(o,4),a=ji(s,0,32);Ue.from(a).eq(n)||Gr.throwError("CCIP Read sender did not match",fe.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:o});let c=[],h=Ue.from(ji(s,32,64)).toNumber(),g=Ue.from(ji(s,h,h+32)).toNumber(),b=ji(s,h+32);for(let j=0;j<g;j++){let $=nE(b,j*32);$==null&&Gr.throwError("CCIP Read contained corrupt URL string",fe.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:o}),c.push($)}let E=O5(s,64);Ue.from(ji(s,100,128)).isZero()||Gr.throwError("CCIP Read callback selector included junk",fe.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:o});let A=ji(s,96,100),T=O5(s,128),P=yield this.ccipReadFetch(e,E,c);P==null&&Gr.throwError("CCIP Read disabled or provided no URLs",fe.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:o});let L={to:n,data:Vn([A,yhe([P,T])])};return this._call(L,r,i+1)}catch(s){if(s.code===fe.errors.SERVER_ERROR)throw s}try{return De(o)}catch(s){return Gr.throwError("bad result from backend",fe.errors.SERVER_ERROR,{method:"call",params:{transaction:e,blockTag:r},result:o,error:s})}})}call(e,r){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let i=yield $i({transaction:this._getTransactionRequest(e),blockTag:this._getBlockTag(r),ccipReadEnabled:Promise.resolve(e.ccipReadEnabled)});return this._call(i.transaction,i.blockTag,i.ccipReadEnabled?0:-1)})}estimateGas(e){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let r=yield $i({transaction:this._getTransactionRequest(e)}),i=yield this.perform("estimateGas",r);try{return Ue.from(i)}catch(n){return Gr.throwError("bad result from backend",fe.errors.SERVER_ERROR,{method:"estimateGas",params:r,result:i,error:n})}})}_getAddress(e){return Er(this,void 0,void 0,function*(){e=yield e,typeof e!="string"&&Gr.throwArgumentError("invalid address or ENS name","name",e);let r=yield this.resolveName(e);return r==null&&Gr.throwError("ENS name not configured",fe.errors.UNSUPPORTED_OPERATION,{operation:`resolveName(${JSON.stringify(e)})`}),r})}_getBlock(e,r){return Er(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;let i=-128,n={includeTransactions:!!r};if(Zt(e,32))n.blockHash=e;else try{n.blockTag=yield this._getBlockTag(e),Zt(n.blockTag)&&(i=parseInt(n.blockTag.substring(2),16))}catch{Gr.throwArgumentError("invalid block hash or block tag","blockHashOrBlockTag",e)}return Ql(()=>Er(this,void 0,void 0,function*(){let o=yield this.perform("getBlock",n);if(o==null)return n.blockHash!=null&&this._emitted["b:"+n.blockHash]==null||n.blockTag!=null&&i>this._emitted.block?null:void 0;if(r){let s=null;for(let c=0;c<o.transactions.length;c++){let h=o.transactions[c];if(h.blockNumber==null)h.confirmations=0;else if(h.confirmations==null){s==null&&(s=yield this._getInternalBlockNumber(100+2*this.pollingInterval));let g=s-h.blockNumber+1;g<=0&&(g=1),h.confirmations=g}}let a=this.formatter.blockWithTransactions(o);return a.transactions=a.transactions.map(c=>this._wrapTransaction(c)),a}return this.formatter.block(o)}),{oncePoll:this})})}getBlock(e){return this._getBlock(e,!1)}getBlockWithTransactions(e){return this._getBlock(e,!0)}getTransaction(e){return Er(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;let r={transactionHash:this.formatter.hash(e,!0)};return Ql(()=>Er(this,void 0,void 0,function*(){let i=yield this.perform("getTransaction",r);if(i==null)return this._emitted["t:"+e]==null?null:void 0;let n=this.formatter.transactionResponse(i);if(n.blockNumber==null)n.confirmations=0;else if(n.confirmations==null){let s=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-n.blockNumber+1;s<=0&&(s=1),n.confirmations=s}return this._wrapTransaction(n)}),{oncePoll:this})})}getTransactionReceipt(e){return Er(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;let r={transactionHash:this.formatter.hash(e,!0)};return Ql(()=>Er(this,void 0,void 0,function*(){let i=yield this.perform("getTransactionReceipt",r);if(i==null)return this._emitted["t:"+e]==null?null:void 0;if(i.blockHash==null)return;let n=this.formatter.receipt(i);if(n.blockNumber==null)n.confirmations=0;else if(n.confirmations==null){let s=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-n.blockNumber+1;s<=0&&(s=1),n.confirmations=s}return n}),{oncePoll:this})})}getLogs(e){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let r=yield $i({filter:this._getFilter(e)}),i=yield this.perform("getLogs",r);return i.forEach(n=>{n.removed==null&&(n.removed=!1)}),jm.arrayOf(this.formatter.filterLog.bind(this.formatter))(i)})}getEtherPrice(){return Er(this,void 0,void 0,function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})})}_getBlockTag(e){return Er(this,void 0,void 0,function*(){if(e=yield e,typeof e=="number"&&e<0){e%1&&Gr.throwArgumentError("invalid BlockTag","blockTag",e);let r=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return r+=e,r<0&&(r=0),this.formatter.blockTag(r)}return this.formatter.blockTag(e)})}getResolver(e){return Er(this,void 0,void 0,function*(){let r=e;for(;;){if(r===""||r==="."||e!=="eth"&&r==="eth")return null;let i=yield this._getResolver(r,"getResolver");if(i!=null){let n=new f3(this,i,e);return r!==e&&!(yield n.supportsWildcard())?null:n}r=r.split(".").slice(1).join(".")}})}_getResolver(e,r){return Er(this,void 0,void 0,function*(){r==null&&(r="ENS");let i=yield this.getNetwork();i.ensAddress||Gr.throwError("network does not support ENS",fe.errors.UNSUPPORTED_OPERATION,{operation:r,network:i.name});try{let n=yield this.call({to:i.ensAddress,data:"0x0178b8bf"+ip(e).substring(2)});return this.formatter.callAddress(n)}catch{}return null})}resolveName(e){return Er(this,void 0,void 0,function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(i){if(Zt(e))throw i}typeof e!="string"&&Gr.throwArgumentError("invalid ENS name","name",e);let r=yield this.getResolver(e);return r?yield r.getAddress():null})}lookupAddress(e){return Er(this,void 0,void 0,function*(){e=yield e,e=this.formatter.address(e);let r=e.substring(2).toLowerCase()+".addr.reverse",i=yield this._getResolver(r,"lookupAddress");if(i==null)return null;let n=nE(yield this.call({to:i,data:"0x691f3431"+ip(r).substring(2)}),0);return(yield this.resolveName(n))!=e?null:n})}getAvatar(e){return Er(this,void 0,void 0,function*(){let r=null;if(Zt(e)){let o=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",s=yield this._getResolver(o,"getAvatar");if(!s)return null;r=new f3(this,s,o);try{let a=yield r.getAvatar();if(a)return a.url}catch(a){if(a.code!==fe.errors.CALL_EXCEPTION)throw a}try{let a=nE(yield this.call({to:s,data:"0x691f3431"+ip(o).substring(2)}),0);r=yield this.getResolver(a)}catch(a){if(a.code!==fe.errors.CALL_EXCEPTION)throw a;return null}}else if(r=yield this.getResolver(e),!r)return null;let i=yield r.getAvatar();return i==null?null:i.url})}perform(e,r){return Gr.throwError(e+" not implemented",fe.errors.NOT_IMPLEMENTED,{operation:e})}_startEvent(e){this.polling=this._events.filter(r=>r.pollable()).length>0}_stopEvent(e){this.polling=this._events.filter(r=>r.pollable()).length>0}_addEventListener(e,r,i){let n=new JD(u3(e),r,i);return this._events.push(n),this._startEvent(n),this}on(e,r){return this._addEventListener(e,r,!1)}once(e,r){return this._addEventListener(e,r,!0)}emit(e,...r){let i=!1,n=[],o=u3(e);return this._events=this._events.filter(s=>s.tag!==o?!0:(setTimeout(()=>{s.listener.apply(this,r)},0),i=!0,s.once?(n.push(s),!1):!0)),n.forEach(s=>{this._stopEvent(s)}),i}listenerCount(e){if(!e)return this._events.length;let r=u3(e);return this._events.filter(i=>i.tag===r).length}listeners(e){if(e==null)return this._events.map(i=>i.listener);let r=u3(e);return this._events.filter(i=>i.tag===r).map(i=>i.listener)}off(e,r){if(r==null)return this.removeAllListeners(e);let i=[],n=!1,o=u3(e);return this._events=this._events.filter(s=>s.tag!==o||s.listener!=r||n?!0:(n=!0,i.push(s),!1)),i.forEach(s=>{this._stopEvent(s)}),this}removeAllListeners(e){let r=[];if(e==null)r=this._events,this._events=[];else{let i=u3(e);this._events=this._events.filter(n=>n.tag!==i?!0:(r.push(n),!1))}return r.forEach(i=>{this._stopEvent(i)}),this}};var vh=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},Gn=new fe(Si),Lze=["call","estimateGas"];function D5(t,e){if(t==null)return null;if(typeof t.message=="string"&&t.message.match("reverted")){let r=Zt(t.data)?t.data:null;if(!e||r)return{message:t.message,data:r}}if(typeof t=="object"){for(let r in t){let i=D5(t[r],e);if(i)return i}return null}if(typeof t=="string")try{return D5(JSON.parse(t),e)}catch{}return null}function _he(t,e,r){let i=r.transaction||r.signedTransaction;if(t==="call"){let o=D5(e,!0);if(o)return o.data;Gn.throwError("missing revert data in call exception; Transaction reverted without a reason string",fe.errors.CALL_EXCEPTION,{data:"0x",transaction:i,error:e})}if(t==="estimateGas"){let o=D5(e.body,!1);o==null&&(o=D5(e,!1)),o&&Gn.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",fe.errors.UNPREDICTABLE_GAS_LIMIT,{reason:o.message,method:t,transaction:i,error:e})}let n=e.message;throw e.code===fe.errors.SERVER_ERROR&&e.error&&typeof e.error.message=="string"?n=e.error.message:typeof e.body=="string"?n=e.body:typeof e.responseText=="string"&&(n=e.responseText),n=(n||"").toLowerCase(),n.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&Gn.throwError("insufficient funds for intrinsic transaction cost",fe.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:i}),n.match(/nonce (is )?too low/i)&&Gn.throwError("nonce has already been used",fe.errors.NONCE_EXPIRED,{error:e,method:t,transaction:i}),n.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&Gn.throwError("replacement fee too low",fe.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:i}),n.match(/only replay-protected/i)&&Gn.throwError("legacy pre-eip-155 transactions not supported",fe.errors.UNSUPPORTED_OPERATION,{error:e,method:t,transaction:i}),Lze.indexOf(t)>=0&&n.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&Gn.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",fe.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:i}),e}function xhe(t){return new Promise(function(e){setTimeout(e,t)})}function Bze(t){if(t.error){let e=new Error(t.error.message);throw e.code=t.error.code,e.data=t.error.data,e}return t.result}function M5(t){return t&&t.toLowerCase()}var QD={},h3=class extends rc{constructor(e,r,i){if(super(),e!==QD)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");ye(this,"provider",r),i==null&&(i=0),typeof i=="string"?(ye(this,"_address",this.provider.formatter.address(i)),ye(this,"_index",null)):typeof i=="number"?(ye(this,"_index",i),ye(this,"_address",null)):Gn.throwArgumentError("invalid address or index","addressOrIndex",i)}connect(e){return Gn.throwError("cannot alter JSON-RPC Signer connection",fe.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new XD(QD,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then(e=>(e.length<=this._index&&Gn.throwError("unknown account #"+this._index,fe.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index])))}sendUncheckedTransaction(e){e=pi(e);let r=this.getAddress().then(i=>(i&&(i=i.toLowerCase()),i));if(e.gasLimit==null){let i=pi(e);i.from=r,e.gasLimit=this.provider.estimateGas(i)}return e.to!=null&&(e.to=Promise.resolve(e.to).then(i=>vh(this,void 0,void 0,function*(){if(i==null)return null;let n=yield this.provider.resolveName(i);return n==null&&Gn.throwArgumentError("provided ENS name resolves to null","tx.to",i),n}))),$i({tx:$i(e),sender:r}).then(({tx:i,sender:n})=>{i.from!=null?i.from.toLowerCase()!==n&&Gn.throwArgumentError("from address mismatch","transaction",e):i.from=n;let o=this.provider.constructor.hexlifyTransaction(i,{from:!0});return this.provider.send("eth_sendTransaction",[o]).then(s=>s,s=>(typeof s.message=="string"&&s.message.match(/user denied/i)&&Gn.throwError("user rejected transaction",fe.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:i}),_he("sendTransaction",s,o)))})}signTransaction(e){return Gn.throwError("signing transactions is unsupported",fe.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return vh(this,void 0,void 0,function*(){let r=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),i=yield this.sendUncheckedTransaction(e);try{return yield Ql(()=>vh(this,void 0,void 0,function*(){let n=yield this.provider.getTransaction(i);if(n!==null)return this.provider._wrapTransaction(n,i,r)}),{oncePoll:this.provider})}catch(n){throw n.transactionHash=i,n}})}signMessage(e){return vh(this,void 0,void 0,function*(){let r=typeof e=="string"?fi(e):e,i=yield this.getAddress();try{return yield this.provider.send("personal_sign",[De(r),i.toLowerCase()])}catch(n){throw typeof n.message=="string"&&n.message.match(/user denied/i)&&Gn.throwError("user rejected signing",fe.errors.ACTION_REJECTED,{action:"signMessage",from:i,messageData:e}),n}})}_legacySignMessage(e){return vh(this,void 0,void 0,function*(){let r=typeof e=="string"?fi(e):e,i=yield this.getAddress();try{return yield this.provider.send("eth_sign",[i.toLowerCase(),De(r)])}catch(n){throw typeof n.message=="string"&&n.message.match(/user denied/i)&&Gn.throwError("user rejected signing",fe.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:i,messageData:e}),n}})}_signTypedData(e,r,i){return vh(this,void 0,void 0,function*(){let n=yield Qc.resolveNames(e,r,i,s=>this.provider.resolveName(s)),o=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[o.toLowerCase(),JSON.stringify(Qc.getPayload(n.domain,r,n.value))])}catch(s){throw typeof s.message=="string"&&s.message.match(/user denied/i)&&Gn.throwError("user rejected signing",fe.errors.ACTION_REJECTED,{action:"_signTypedData",from:o,messageData:{domain:n.domain,types:r,value:n.value}}),s}})}unlock(e){return vh(this,void 0,void 0,function*(){let r=this.provider,i=yield this.getAddress();return r.send("personal_unlockAccount",[i.toLowerCase(),e,null])})}},XD=class extends h3{sendTransaction(e){return this.sendUncheckedTransaction(e).then(r=>({hash:r,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:i=>this.provider.waitForTransaction(r,i)}))}},Uze={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0},ma=class extends Pf{constructor(e,r){let i=r;i==null&&(i=new Promise((n,o)=>{setTimeout(()=>{this.detectNetwork().then(s=>{n(s)},s=>{o(s)})},0)})),super(i),e||(e=bn(this.constructor,"defaultUrl")()),typeof e=="string"?ye(this,"connection",Object.freeze({url:e})):ye(this,"connection",Object.freeze(pi(e))),this._nextId=42}get _cache(){return this._eventLoopCache==null&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout(()=>{this._cache.detectNetwork=null},0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return vh(this,void 0,void 0,function*(){yield xhe(0);let e=null;try{e=yield this.send("eth_chainId",[])}catch{try{e=yield this.send("net_version",[])}catch{}}if(e!=null){let r=bn(this.constructor,"getNetwork");try{return r(Ue.from(e).toNumber())}catch(i){return Gn.throwError("could not detect network",fe.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:i})}}return Gn.throwError("could not detect network",fe.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(e){return new h3(QD,this,e)}getUncheckedSigner(e){return this.getSigner(e).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then(e=>e.map(r=>this.formatter.address(r)))}send(e,r){let i={method:e,params:r,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:vn(i),provider:this});let n=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(n&&this._cache[e])return this._cache[e];let o=Jl(this.connection,JSON.stringify(i),Bze).then(s=>(this.emit("debug",{action:"response",request:i,response:s,provider:this}),s),s=>{throw this.emit("debug",{action:"response",error:s,request:i,provider:this}),s});return n&&(this._cache[e]=o,setTimeout(()=>{this._cache[e]=null},0)),o}prepareRequest(e,r){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[M5(r.address),r.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[M5(r.address),r.blockTag]];case"getCode":return["eth_getCode",[M5(r.address),r.blockTag]];case"getStorageAt":return["eth_getStorageAt",[M5(r.address),Kr(r.position,32),r.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[r.signedTransaction]];case"getBlock":return r.blockTag?["eth_getBlockByNumber",[r.blockTag,!!r.includeTransactions]]:r.blockHash?["eth_getBlockByHash",[r.blockHash,!!r.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[r.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[r.transactionHash]];case"call":return["eth_call",[bn(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0}),r.blockTag]];case"estimateGas":return["eth_estimateGas",[bn(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0})]];case"getLogs":return r.filter&&r.filter.address!=null&&(r.filter.address=M5(r.filter.address)),["eth_getLogs",[r.filter]];default:break}return null}perform(e,r){return vh(this,void 0,void 0,function*(){if(e==="call"||e==="estimateGas"){let n=r.transaction;if(n&&n.type!=null&&Ue.from(n.type).isZero()&&n.maxFeePerGas==null&&n.maxPriorityFeePerGas==null){let o=yield this.getFeeData();o.maxFeePerGas==null&&o.maxPriorityFeePerGas==null&&(r=pi(r),r.transaction=pi(n),delete r.transaction.type)}}let i=this.prepareRequest(e,r);i==null&&Gn.throwError(e+" not implemented",fe.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(i[0],i[1])}catch(n){return _he(e,n,r)}})}_startEvent(e){e.tag==="pending"&&this._startPending(),super._startEvent(e)}_startPending(){if(this._pendingFilter!=null)return;let e=this,r=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=r,r.then(function(i){function n(){e.send("eth_getFilterChanges",[i]).then(function(o){if(e._pendingFilter!=r)return null;let s=Promise.resolve();return o.forEach(function(a){e._emitted["t:"+a.toLowerCase()]="pending",s=s.then(function(){return e.getTransaction(a).then(function(c){return e.emit("pending",c),null})})}),s.then(function(){return xhe(1e3)})}).then(function(){if(e._pendingFilter!=r){e.send("eth_uninstallFilter",[i]);return}return setTimeout(function(){n()},0),null}).catch(o=>{})}return n(),i}).catch(i=>{})}_stopEvent(e){e.tag==="pending"&&this.listenerCount("pending")===0&&(this._pendingFilter=null),super._stopEvent(e)}static hexlifyTransaction(e,r){let i=pi(Uze);if(r)for(let o in r)r[o]&&(i[o]=!0);Lw(e,i);let n={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(o){if(e[o]==null)return;let s=hf(Ue.from(e[o]));o==="gasLimit"&&(o="gas"),n[o]=s}),["from","to","data"].forEach(function(o){e[o]!=null&&(n[o]=De(e[o]))}),e.accessList&&(n.accessList=sc(e.accessList)),n}};var d3=null;try{if(d3=WebSocket,d3==null)throw new Error("inject please")}catch{let e=new fe(Si);d3=function(){e.throwError("WebSockets not supported in this environment",fe.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var eL=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},oE=new fe(Si),Fze=1,bh=class extends ma{constructor(e,r){r==="any"&&oE.throwError("WebSocketProvider does not support 'any' network yet",fe.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),typeof e=="string"?super(e,r):super("_websocket",r),this._pollingInterval=-1,this._wsReady=!1,typeof e=="string"?ye(this,"_websocket",new d3(this.connection.url)):ye(this,"_websocket",e),ye(this,"_requests",{}),ye(this,"_subs",{}),ye(this,"_subIds",{}),ye(this,"_detectNetwork",super.detectNetwork()),this.websocket.onopen=()=>{this._wsReady=!0,Object.keys(this._requests).forEach(n=>{this.websocket.send(this._requests[n].payload)})},this.websocket.onmessage=n=>{let o=n.data,s=JSON.parse(o);if(s.id!=null){let a=String(s.id),c=this._requests[a];if(delete this._requests[a],s.result!==void 0)c.callback(null,s.result),this.emit("debug",{action:"response",request:JSON.parse(c.payload),response:s.result,provider:this});else{let h=null;s.error?(h=new Error(s.error.message||"unknown error"),ye(h,"code",s.error.code||null),ye(h,"response",o)):h=new Error("unknown error"),c.callback(h,void 0),this.emit("debug",{action:"response",error:h,request:JSON.parse(c.payload),provider:this})}}else if(s.method==="eth_subscription"){let a=this._subs[s.params.subscription];a&&a.processFunc(s.params.result)}else console.warn("this should not happen")};let i=setInterval(()=>{this.emit("poll")},1e3);i.unref&&i.unref()}get websocket(){return this._websocket}detectNetwork(){return this._detectNetwork}get pollingInterval(){return 0}resetEventsBlock(e){oE.throwError("cannot reset events block on WebSocketProvider",fe.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(e){oE.throwError("cannot set polling interval on WebSocketProvider",fe.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return eL(this,void 0,void 0,function*(){return null})}set polling(e){e&&oE.throwError("cannot set polling on WebSocketProvider",fe.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(e,r){let i=Fze++;return new Promise((n,o)=>{function s(c,h){return c?o(c):n(h)}let a=JSON.stringify({method:e,params:r,id:i,jsonrpc:"2.0"});this.emit("debug",{action:"request",request:JSON.parse(a),provider:this}),this._requests[String(i)]={callback:s,payload:a},this._wsReady&&this.websocket.send(a)})}static defaultUrl(){return"ws://localhost:8546"}_subscribe(e,r,i){return eL(this,void 0,void 0,function*(){let n=this._subIds[e];n==null&&(n=Promise.all(r).then(s=>this.send("eth_subscribe",s)),this._subIds[e]=n);let o=yield n;this._subs[o]={tag:e,processFunc:i}})}_startEvent(e){switch(e.type){case"block":this._subscribe("block",["newHeads"],r=>{let i=Ue.from(r.number).toNumber();this._emitted.block=i,this.emit("block",i)});break;case"pending":this._subscribe("pending",["newPendingTransactions"],r=>{this.emit("pending",r)});break;case"filter":this._subscribe(e.tag,["logs",this._getFilter(e.filter)],r=>{r.removed==null&&(r.removed=!1),this.emit(e.filter,this.formatter.filterLog(r))});break;case"tx":{let r=i=>{let n=i.hash;this.getTransactionReceipt(n).then(o=>{o&&this.emit(n,o)})};r(e),this._subscribe("tx",["newHeads"],i=>{this._events.filter(n=>n.type==="tx").forEach(r)});break}case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",e);break}}_stopEvent(e){let r=e.tag;if(e.type==="tx"){if(this._events.filter(n=>n.type==="tx").length)return;r="tx"}else if(this.listenerCount(e.event))return;let i=this._subIds[r];i&&(delete this._subIds[r],i.then(n=>{this._subs[n]&&(delete this._subs[n],this.send("eth_unsubscribe",[n]))}))}destroy(){return eL(this,void 0,void 0,function*(){this.websocket.readyState===d3.CONNECTING&&(yield new Promise(e=>{this.websocket.onopen=function(){e(!0)},this.websocket.onerror=function(){e(!1)}})),this.websocket.close(1e3)})}};var jze=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},L5=new fe(Si),B5=class extends ma{detectNetwork(){let e=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return jze(this,void 0,void 0,function*(){let r=this.network;return r==null&&(r=yield e.detectNetwork.call(this),r||L5.throwError("no network detected",fe.errors.UNKNOWN_ERROR,{}),this._network==null&&(ye(this,"_network",r),this.emit("network",r,null))),r})}},bs=class t extends B5{constructor(e,r){L5.checkAbstract(new.target,t),e=bn(new.target,"getNetwork")(e),r=bn(new.target,"getApiKey")(r);let i=bn(new.target,"getUrl")(e,r);super(i,e),typeof r=="string"?ye(this,"apiKey",r):r!=null&&Object.keys(r).forEach(n=>{ye(this,n,r[n])})}_startPending(){L5.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(e){return L5.throwError("API provider does not support signing",fe.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(e){return e}static getUrl(e,r){return L5.throwError("not implemented; sub-classes must override getUrl",fe.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}};var Ehe=new fe(Si),sE="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",U5=class extends bh{constructor(e,r){let i=new p3(e,r),n=i.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi.");super(n,i.network),ye(this,"apiKey",i.apiKey)}isCommunityResource(){return this.apiKey===sE}},p3=class extends bs{static getWebSocketProvider(e,r){return new U5(e,r)}static getApiKey(e){return e==null?sE:(e&&typeof e!="string"&&Ehe.throwArgumentError("invalid apiKey","apiKey",e),e)}static getUrl(e,r){let i=null;switch(e.name){case"homestead":i="eth-mainnet.alchemyapi.io/v2/";break;case"goerli":i="eth-goerli.g.alchemy.com/v2/";break;case"matic":i="polygon-mainnet.g.alchemy.com/v2/";break;case"maticmum":i="polygon-mumbai.g.alchemy.com/v2/";break;case"arbitrum":i="arb-mainnet.g.alchemy.com/v2/";break;case"arbitrum-goerli":i="arb-goerli.g.alchemy.com/v2/";break;case"optimism":i="opt-mainnet.g.alchemy.com/v2/";break;case"optimism-goerli":i="opt-goerli.g.alchemy.com/v2/";break;default:Ehe.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+i+r,throttleCallback:(n,o)=>(r===sE&&Nf(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===sE}};var $ze=new fe(Si),aE="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function Wze(t){switch(t){case"homestead":return"rpc.ankr.com/eth/";case"ropsten":return"rpc.ankr.com/eth_ropsten/";case"rinkeby":return"rpc.ankr.com/eth_rinkeby/";case"goerli":return"rpc.ankr.com/eth_goerli/";case"matic":return"rpc.ankr.com/polygon/";case"arbitrum":return"rpc.ankr.com/arbitrum/"}return $ze.throwArgumentError("unsupported network","name",t)}var F5=class extends bs{isCommunityResource(){return this.apiKey===aE}static getApiKey(e){return e??aE}static getUrl(e,r){r==null&&(r=aE);let i={allowGzip:!0,url:"https://"+Wze(e.name)+r,throttleCallback:(n,o)=>(r.apiKey===aE&&Nf(),Promise.resolve(!0))};return r.projectSecret!=null&&(i.user="",i.password=r.projectSecret),i}};var qze=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},Ahe=new fe(Si),j5=class extends bs{static getApiKey(e){return e!=null&&Ahe.throwArgumentError("apiKey not supported for cloudflare","apiKey",e),null}static getUrl(e,r){let i=null;switch(e.name){case"homestead":i="https://cloudflare-eth.com/";break;default:Ahe.throwArgumentError("unsupported network","network",arguments[0])}return i}perform(e,r){let i=Object.create(null,{perform:{get:()=>super.perform}});return qze(this,void 0,void 0,function*(){return e==="getBlockNumber"?(yield i.perform.call(this,"getBlock",{blockTag:"latest"})).number:i.perform.call(this,e,r)})}};var cE=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},up=new fe(Si);function Che(t){let e={};for(let r in t){if(t[r]==null)continue;let i=t[r];r==="type"&&i===0||({type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[r]?i=hf(De(i)):r==="accessList"?i="["+sc(i).map(n=>`{address:"${n.address}",storageKeys:["${n.storageKeys.join('","')}"]}`).join(",")+"]":i=De(i),e[r]=i)}return e}function Hze(t){if(t.status==0&&(t.message==="No records found"||t.message==="No transactions found"))return t.result;if(t.status!=1||typeof t.message!="string"||!t.message.match(/^OK/)){let e=new Error("invalid response");throw e.result=JSON.stringify(t),(t.result||"").toLowerCase().indexOf("rate limit")>=0&&(e.throttleRetry=!0),e}return t.result}function She(t){if(t&&t.status==0&&t.message=="NOTOK"&&(t.result||"").toLowerCase().indexOf("rate limit")>=0){let e=new Error("throttled response");throw e.result=JSON.stringify(t),e.throttleRetry=!0,e}if(t.jsonrpc!="2.0"){let e=new Error("invalid response");throw e.result=JSON.stringify(t),e}if(t.error){let e=new Error(t.error.message||"unknown error");throw t.error.code&&(e.code=t.error.code),t.error.data&&(e.data=t.error.data),e}return t.result}function Ihe(t){if(t==="pending")throw new Error("pending not supported");return t==="latest"?t:parseInt(t.substring(2),16)}function tL(t,e,r){if(t==="call"&&e.code===fe.errors.SERVER_ERROR){let n=e.error;if(n&&(n.message.match(/reverted/i)||n.message.match(/VM execution error/i))){let o=n.data;if(o&&(o="0x"+o.replace(/^.*0x/i,"")),Zt(o))return o;up.throwError("missing revert data in call exception",fe.errors.CALL_EXCEPTION,{error:e,data:"0x"})}}let i=e.message;throw e.code===fe.errors.SERVER_ERROR&&(e.error&&typeof e.error.message=="string"?i=e.error.message:typeof e.body=="string"?i=e.body:typeof e.responseText=="string"&&(i=e.responseText)),i=(i||"").toLowerCase(),i.match(/insufficient funds/)&&up.throwError("insufficient funds for intrinsic transaction cost",fe.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:r}),i.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&up.throwError("nonce has already been used",fe.errors.NONCE_EXPIRED,{error:e,method:t,transaction:r}),i.match(/another transaction with same nonce/)&&up.throwError("replacement fee too low",fe.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:r}),i.match(/execution failed due to an exception|execution reverted/)&&up.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",fe.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:r}),e}var $5=class extends Pf{constructor(e,r){super(e),ye(this,"baseUrl",this.getBaseUrl()),ye(this,"apiKey",r||null)}getBaseUrl(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"matic":return"https://api.polygonscan.com";case"maticmum":return"https://api-testnet.polygonscan.com";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io";default:}return up.throwArgumentError("unsupported network","network",this.network.name)}getUrl(e,r){let i=Object.keys(r).reduce((o,s)=>{let a=r[s];return a!=null&&(o+=`&${s}=${a}`),o},""),n=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.baseUrl}/api?module=${e}${i}${n}`}getPostUrl(){return`${this.baseUrl}/api`}getPostData(e,r){return r.module=e,r.apikey=this.apiKey,r}fetch(e,r,i){return cE(this,void 0,void 0,function*(){let n=i?this.getPostUrl():this.getUrl(e,r),o=i?this.getPostData(e,r):null,s=e==="proxy"?She:Hze;this.emit("debug",{action:"request",request:n,provider:this});let a={url:n,throttleSlotInterval:1e3,throttleCallback:(g,b)=>(this.isCommunityResource()&&Nf(),Promise.resolve(!0))},c=null;o&&(a.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},c=Object.keys(o).map(g=>`${g}=${o[g]}`).join("&"));let h=yield Jl(a,c,s||She);return this.emit("debug",{action:"response",request:n,response:vn(h),provider:this}),h})}detectNetwork(){return cE(this,void 0,void 0,function*(){return this.network})}perform(e,r){let i=Object.create(null,{perform:{get:()=>super.perform}});return cE(this,void 0,void 0,function*(){switch(e){case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getBalance":return this.fetch("account",{action:"balance",address:r.address,tag:r.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:r.address,tag:r.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:r.address,tag:r.blockTag});case"getStorageAt":return this.fetch("proxy",{action:"eth_getStorageAt",address:r.address,position:r.position,tag:r.blockTag});case"sendTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:r.signedTransaction},!0).catch(n=>tL("sendTransaction",n,r.signedTransaction));case"getBlock":if(r.blockTag)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:r.blockTag,boolean:r.includeTransactions?"true":"false"});throw new Error("getBlock by blockHash not implemented");case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:r.transactionHash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:r.transactionHash});case"call":{if(r.blockTag!=="latest")throw new Error("EtherscanProvider does not support blockTag for call");let n=Che(r.transaction);n.module="proxy",n.action="eth_call";try{return yield this.fetch("proxy",n,!0)}catch(o){return tL("call",o,r.transaction)}}case"estimateGas":{let n=Che(r.transaction);n.module="proxy",n.action="eth_estimateGas";try{return yield this.fetch("proxy",n,!0)}catch(o){return tL("estimateGas",o,r.transaction)}}case"getLogs":{let n={action:"getLogs"};if(r.filter.fromBlock&&(n.fromBlock=Ihe(r.filter.fromBlock)),r.filter.toBlock&&(n.toBlock=Ihe(r.filter.toBlock)),r.filter.address&&(n.address=r.filter.address),r.filter.topics&&r.filter.topics.length>0&&(r.filter.topics.length>1&&up.throwError("unsupported topic count",fe.errors.UNSUPPORTED_OPERATION,{topics:r.filter.topics}),r.filter.topics.length===1)){let a=r.filter.topics[0];(typeof a!="string"||a.length!==66)&&up.throwError("unsupported topic format",fe.errors.UNSUPPORTED_OPERATION,{topic0:a}),n.topic0=a}let o=yield this.fetch("logs",n),s={};for(let a=0;a<o.length;a++){let c=o[a];if(c.blockHash==null){if(s[c.blockNumber]==null){let h=yield this.getBlock(c.blockNumber);h&&(s[c.blockNumber]=h.hash)}c.blockHash=s[c.blockNumber]}}return o}case"getEtherPrice":return this.network.name!=="homestead"?0:parseFloat((yield this.fetch("stats",{action:"ethprice"})).ethusd);default:break}return i.perform.call(this,e,r)})}getHistory(e,r,i){return cE(this,void 0,void 0,function*(){let n={action:"txlist",address:yield this.resolveName(e),startblock:r??0,endblock:i??99999999,sort:"asc"};return(yield this.fetch("account",n)).map(s=>{["contractAddress","to"].forEach(function(c){s[c]==""&&delete s[c]}),s.creates==null&&s.contractAddress!=null&&(s.creates=s.contractAddress);let a=this.formatter.transactionResponse(s);return s.timeStamp&&(a.timestamp=parseInt(s.timeStamp)),a})})}isCommunityResource(){return this.apiKey==null}};var fE=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},$m=new fe(Si);function lE(){return new Date().getTime()}function The(t){let e=null;for(let r=0;r<t.length;r++){let i=t[r];if(i==null)return null;e?e.name===i.name&&e.chainId===i.chainId&&(e.ensAddress===i.ensAddress||e.ensAddress==null&&i.ensAddress==null)||$m.throwArgumentError("provider mismatch","networks",t):e=i}return e}function Rhe(t,e){t=t.slice().sort();let r=Math.floor(t.length/2);if(t.length%2)return t[r];let i=t[r-1],n=t[r];return e!=null&&Math.abs(i-n)>e?null:(i+n)/2}function m3(t){if(t===null)return"null";if(typeof t=="number"||typeof t=="boolean")return JSON.stringify(t);if(typeof t=="string")return t;if(Ue.isBigNumber(t))return t.toString();if(Array.isArray(t))return JSON.stringify(t.map(e=>m3(e)));if(typeof t=="object"){let e=Object.keys(t);return e.sort(),"{"+e.map(r=>{let i=t[r];return typeof i=="function"?i="[function]":i=m3(i),JSON.stringify(r)+":"+i}).join(",")+"}"}throw new Error("unknown value type: "+typeof t)}var zze=1;function khe(t){let e=null,r=null,i=new Promise(s=>{e=function(){r&&(clearTimeout(r),r=null),s()},r=setTimeout(e,t)}),n=s=>(i=i.then(s),i);function o(){return i}return{cancel:e,getPromise:o,wait:n}}var Vze=[fe.errors.CALL_EXCEPTION,fe.errors.INSUFFICIENT_FUNDS,fe.errors.NONCE_EXPIRED,fe.errors.REPLACEMENT_UNDERPRICED,fe.errors.UNPREDICTABLE_GAS_LIMIT],Kze=["address","args","errorArgs","errorSignature","method","transaction"];function uE(t,e){let r={weight:t.weight};return Object.defineProperty(r,"provider",{get:()=>t.provider}),t.start&&(r.start=t.start),e&&(r.duration=e-t.start),t.done&&(t.error?r.error=t.error:r.result=t.result||null),r}function Gze(t,e){return function(r){let i={};r.forEach(o=>{let s=t(o.result);i[s]||(i[s]={count:0,result:o.result}),i[s].count++});let n=Object.keys(i);for(let o=0;o<n.length;o++){let s=i[n[o]];if(s.count>=e)return s.result}}}function Zze(t,e,r){let i=m3;switch(e){case"getBlockNumber":return function(n){let o=n.map(a=>a.result),s=Rhe(n.map(a=>a.result),2);if(s!=null)return s=Math.ceil(s),o.indexOf(s+1)>=0&&s++,s>=t._highestBlockNumber&&(t._highestBlockNumber=s),t._highestBlockNumber};case"getGasPrice":return function(n){let o=n.map(s=>s.result);return o.sort(),o[Math.floor(o.length/2)]};case"getEtherPrice":return function(n){return Rhe(n.map(o=>o.result))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":i=function(n){return n==null?null:(n=pi(n),n.confirmations=-1,m3(n))};break;case"getBlock":r.includeTransactions?i=function(n){return n==null?null:(n=pi(n),n.transactions=n.transactions.map(o=>(o=pi(o),o.confirmations=-1,o)),m3(n))}:i=function(n){return n==null?null:m3(n)};break;default:throw new Error("unknown method: "+e)}return Gze(i,t.quorum)}function W5(t,e){return fE(this,void 0,void 0,function*(){let r=t.provider;return r.blockNumber!=null&&r.blockNumber>=e||e===-1?r:Ql(()=>new Promise((i,n)=>{setTimeout(function(){return r.blockNumber>=e?i(r):t.cancelled?i(null):i(void 0)},0)}),{oncePoll:r})})}function Yze(t,e,r,i){return fE(this,void 0,void 0,function*(){let n=t.provider;switch(r){case"getBlockNumber":case"getGasPrice":return n[r]();case"getEtherPrice":if(n.getEtherPrice)return n.getEtherPrice();break;case"getBalance":case"getTransactionCount":case"getCode":return i.blockTag&&Zt(i.blockTag)&&(n=yield W5(t,e)),n[r](i.address,i.blockTag||"latest");case"getStorageAt":return i.blockTag&&Zt(i.blockTag)&&(n=yield W5(t,e)),n.getStorageAt(i.address,i.position,i.blockTag||"latest");case"getBlock":return i.blockTag&&Zt(i.blockTag)&&(n=yield W5(t,e)),n[i.includeTransactions?"getBlockWithTransactions":"getBlock"](i.blockTag||i.blockHash);case"call":case"estimateGas":return i.blockTag&&Zt(i.blockTag)&&(n=yield W5(t,e)),r==="call"&&i.blockTag?n[r](i.transaction,i.blockTag):n[r](i.transaction);case"getTransaction":case"getTransactionReceipt":return n[r](i.transactionHash);case"getLogs":{let o=i.filter;return(o.fromBlock&&Zt(o.fromBlock)||o.toBlock&&Zt(o.toBlock))&&(n=yield W5(t,e)),n.getLogs(o)}}return $m.throwError("unknown method error",fe.errors.UNKNOWN_ERROR,{method:r,params:i})})}var q5=class extends Pf{constructor(e,r){e.length===0&&$m.throwArgumentError("missing providers","providers",e);let i=e.map((s,a)=>{if(Xc.isProvider(s)){let g=N5(s)?2e3:750;return Object.freeze({provider:s,weight:1,stallTimeout:g,priority:1})}let c=pi(s);c.priority==null&&(c.priority=1),c.stallTimeout==null&&(c.stallTimeout=N5(s)?2e3:750),c.weight==null&&(c.weight=1);let h=c.weight;return(h%1||h>512||h<1)&&$m.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${a}].weight`,h),Object.freeze(c)}),n=i.reduce((s,a)=>s+a.weight,0);r==null?r=n/2:r>n&&$m.throwArgumentError("quorum will always fail; larger than total weight","quorum",r);let o=The(i.map(s=>s.provider.network));o==null&&(o=new Promise((s,a)=>{setTimeout(()=>{this.detectNetwork().then(s,a)},0)})),super(o),ye(this,"providerConfigs",Object.freeze(i)),ye(this,"quorum",r),this._highestBlockNumber=-1}detectNetwork(){return fE(this,void 0,void 0,function*(){let e=yield Promise.all(this.providerConfigs.map(r=>r.provider.getNetwork()));return The(e)})}perform(e,r){return fE(this,void 0,void 0,function*(){if(e==="sendTransaction"){let c=yield Promise.all(this.providerConfigs.map(h=>h.provider.sendTransaction(r.signedTransaction).then(g=>g.hash,g=>g)));for(let h=0;h<c.length;h++){let g=c[h];if(typeof g=="string")return g}throw c[0]}this._highestBlockNumber===-1&&e!=="getBlockNumber"&&(yield this.getBlockNumber());let i=Zze(this,e,r),n=C5(this.providerConfigs.map(pi));n.sort((c,h)=>c.priority-h.priority);let o=this._highestBlockNumber,s=0,a=!0;for(;;){let c=lE(),h=n.filter(A=>A.runner&&c-A.start<A.stallTimeout).reduce((A,T)=>A+T.weight,0);for(;h<this.quorum&&s<n.length;){let A=n[s++],T=zze++;A.start=lE(),A.staller=khe(A.stallTimeout),A.staller.wait(()=>{A.staller=null}),A.runner=Yze(A,o,e,r).then(P=>{A.done=!0,A.result=P,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:T,backend:uE(A,lE()),request:{method:e,params:vn(r)},provider:this})},P=>{A.done=!0,A.error=P,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:T,backend:uE(A,lE()),request:{method:e,params:vn(r)},provider:this})}),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:T,backend:uE(A,null),request:{method:e,params:vn(r)},provider:this}),h+=A.weight}let g=[];n.forEach(A=>{A.done||!A.runner||(g.push(A.runner),A.staller&&g.push(A.staller.getPromise()))}),g.length&&(yield Promise.race(g));let b=n.filter(A=>A.done&&A.error==null);if(b.length>=this.quorum){let A=i(b);if(A!==void 0)return n.forEach(T=>{T.staller&&T.staller.cancel(),T.cancelled=!0}),A;a||(yield khe(100).getPromise()),a=!1}let E=n.reduce((A,T)=>{if(!T.done||T.error==null)return A;let P=T.error.code;return Vze.indexOf(P)>=0&&(A[P]||(A[P]={error:T.error,weight:0}),A[P].weight+=T.weight),A},{});if(Object.keys(E).forEach(A=>{let T=E[A];if(T.weight<this.quorum)return;n.forEach(j=>{j.staller&&j.staller.cancel(),j.cancelled=!0});let P=T.error,L={};Kze.forEach(j=>{P[j]!=null&&(L[j]=P[j])}),$m.throwError(P.reason||P.message,A,L)}),n.filter(A=>!A.done).length===0)break}return n.forEach(c=>{c.staller&&c.staller.cancel(),c.cancelled=!0}),$m.throwError("failed to meet quorum",fe.errors.SERVER_ERROR,{method:e,params:r,results:n.map(c=>uE(c)),provider:this})})}};var rL=null;var hE=new fe(Si),H5="84842078b09946638c03157f83405213",z5=class extends bh{constructor(e,r){let i=new g3(e,r),n=i.connection;n.password&&hE.throwError("INFURA WebSocket project secrets unsupported",fe.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"});let o=n.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(o,e),ye(this,"apiKey",i.projectId),ye(this,"projectId",i.projectId),ye(this,"projectSecret",i.projectSecret)}isCommunityResource(){return this.projectId===H5}},g3=class extends bs{static getWebSocketProvider(e,r){return new z5(e,r)}static getApiKey(e){let r={apiKey:H5,projectId:H5,projectSecret:null};return e==null||(typeof e=="string"?r.projectId=e:e.projectSecret!=null?(hE.assertArgument(typeof e.projectId=="string","projectSecret requires a projectId","projectId",e.projectId),hE.assertArgument(typeof e.projectSecret=="string","invalid projectSecret","projectSecret","[REDACTED]"),r.projectId=e.projectId,r.projectSecret=e.projectSecret):e.projectId&&(r.projectId=e.projectId),r.apiKey=r.projectId),r}static getUrl(e,r){let i=null;switch(e?e.name:"unknown"){case"homestead":i="mainnet.infura.io";break;case"goerli":i="goerli.infura.io";break;case"sepolia":i="sepolia.infura.io";break;case"matic":i="polygon-mainnet.infura.io";break;case"maticmum":i="polygon-mumbai.infura.io";break;case"optimism":i="optimism-mainnet.infura.io";break;case"optimism-goerli":i="optimism-goerli.infura.io";break;case"arbitrum":i="arbitrum-mainnet.infura.io";break;case"arbitrum-goerli":i="arbitrum-goerli.infura.io";break;default:hE.throwError("unsupported network",fe.errors.INVALID_ARGUMENT,{argument:"network",value:e})}let n={allowGzip:!0,url:"https://"+i+"/v3/"+r.projectId,throttleCallback:(o,s)=>(r.projectId===H5&&Nf(),Promise.resolve(!0))};return r.projectSecret!=null&&(n.user="",n.password=r.projectSecret),n}isCommunityResource(){return this.projectId===H5}};var dE=class extends ma{send(e,r){let i={method:e,params:r,id:this._nextId++,jsonrpc:"2.0"};this._pendingBatch==null&&(this._pendingBatch=[]);let n={request:i,resolve:null,reject:null},o=new Promise((s,a)=>{n.resolve=s,n.reject=a});return this._pendingBatch.push(n),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout(()=>{let s=this._pendingBatch;this._pendingBatch=null,this._pendingBatchAggregator=null;let a=s.map(c=>c.request);return this.emit("debug",{action:"requestBatch",request:vn(a),provider:this}),Jl(this.connection,JSON.stringify(a)).then(c=>{this.emit("debug",{action:"response",request:a,response:c,provider:this}),s.forEach((h,g)=>{let b=c[g];if(b.error){let E=new Error(b.error.message);E.code=b.error.code,E.data=b.error.data,h.reject(E)}else h.resolve(b.result)})},c=>{this.emit("debug",{action:"response",error:c,request:a,provider:this}),s.forEach(h=>{h.reject(c)})})},10)),o}};var iL=new fe(Si),Jze="ETHERS_JS_SHARED",V5=class extends bs{static getApiKey(e){return e&&typeof e!="string"&&iL.throwArgumentError("invalid apiKey","apiKey",e),e||Jze}static getUrl(e,r){iL.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.");let i=null;switch(e.name){case"homestead":i="https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc";break;case"ropsten":i="https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc";break;case"rinkeby":i="https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc";break;case"goerli":i="https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc";break;case"kovan":i="https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";break;default:iL.throwArgumentError("unsupported network","network",arguments[0])}return i+"?apiKey="+r}};var Nhe=new fe(Si),Phe="62e1ad51b37b8e00394bda3b",K5=class extends bs{static getApiKey(e){let r={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return e==null?r.applicationId=Phe:typeof e=="string"?r.applicationId=e:e.applicationSecretKey!=null?(r.applicationId=e.applicationId,r.applicationSecretKey=e.applicationSecretKey):e.applicationId?r.applicationId=e.applicationId:Nhe.throwArgumentError("unsupported PocketProvider apiKey","apiKey",e),r}static getUrl(e,r){let i=null;switch(e?e.name:"unknown"){case"goerli":i="eth-goerli.gateway.pokt.network";break;case"homestead":i="eth-mainnet.gateway.pokt.network";break;case"kovan":i="poa-kovan.gateway.pokt.network";break;case"matic":i="poly-mainnet.gateway.pokt.network";break;case"maticmum":i="polygon-mumbai-rpc.gateway.pokt.network";break;case"rinkeby":i="eth-rinkeby.gateway.pokt.network";break;case"ropsten":i="eth-ropsten.gateway.pokt.network";break;default:Nhe.throwError("unsupported network",fe.errors.INVALID_ARGUMENT,{argument:"network",value:e})}let n=`https://${i}/v1/lb/${r.applicationId}`,o={headers:{},url:n};return r.applicationSecretKey!=null&&(o.user="",o.password=r.applicationSecretKey),o}isCommunityResource(){return this.applicationId===Phe}};var Ohe=new fe(Si),Qze=1;function Mhe(t,e){let r="Web3LegacyFetcher";return function(i,n){let o={method:i,params:n,id:Qze++,jsonrpc:"2.0"};return new Promise((s,a)=>{this.emit("debug",{action:"request",fetcher:r,request:vn(o),provider:this}),e(o,(c,h)=>{if(c)return this.emit("debug",{action:"response",fetcher:r,error:c,request:o,provider:this}),a(c);if(this.emit("debug",{action:"response",fetcher:r,request:o,response:h,provider:this}),h.error){let g=new Error(h.error.message);return g.code=h.error.code,g.data=h.error.data,a(g)}s(h.result)})})}}function Xze(t){return function(e,r){r==null&&(r=[]);let i={method:e,params:r};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:vn(i),provider:this}),t.request(i).then(n=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:i,response:n,provider:this}),n),n=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:i,error:n,provider:this}),n})}}var G5=class extends ma{constructor(e,r){e==null&&Ohe.throwArgumentError("missing provider","provider",e);let i=null,n=null,o=null;typeof e=="function"?(i="unknown:",n=e):(i=e.host||e.path||"",!i&&e.isMetaMask&&(i="metamask"),o=e,e.request?(i===""&&(i="eip-1193:"),n=Xze(e)):e.sendAsync?n=Mhe(e,e.sendAsync.bind(e)):e.send?n=Mhe(e,e.send.bind(e)):Ohe.throwArgumentError("unsupported provider","provider",e),i||(i="unknown:")),super(i,r),ye(this,"jsonRpcFetchFunc",n),ye(this,"provider",o)}send(e,r){return this.jsonRpcFetchFunc(e,r)}};var Dhe=new fe(Si);function pE(t,e){if(t==null&&(t="homestead"),typeof t=="string"){let i=t.match(/^(ws|http)s?:/i);if(i)switch(i[1].toLowerCase()){case"http":case"https":return new ma(t);case"ws":case"wss":return new bh(t);default:Dhe.throwArgumentError("unsupported URL scheme","network",t)}}let r=T5(t);return(!r||!r._defaultProvider)&&Dhe.throwError("unsupported getDefaultProvider network",fe.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:t}),r._defaultProvider({FallbackProvider:q5,AlchemyProvider:p3,AnkrProvider:F5,CloudflareProvider:j5,EtherscanProvider:$5,InfuraProvider:g3,JsonRpcProvider:ma,NodesmithProvider:V5,PocketProvider:K5,Web3Provider:G5,IpcProvider:null},e)}var ac={};Mi(ac,{AbiCoder:()=>Ww,ConstructorFragment:()=>gf,ErrorFragment:()=>Im,EventFragment:()=>sh,FormatTypes:()=>si,Fragment:()=>mf,FunctionFragment:()=>wf,HDNode:()=>Rf,Indexed:()=>ch,Interface:()=>np,LogDescription:()=>Vw,Logger:()=>fe,ParamType:()=>Vo,RLP:()=>u_,SigningKey:()=>nl,SupportedAlgorithm:()=>If,TransactionDescription:()=>Kw,TransactionTypes:()=>j_,UnicodeNormalizationForm:()=>qs,Utf8ErrorFuncs:()=>A_,Utf8ErrorReason:()=>ms,_TypedDataEncoder:()=>Qc,_fetchData:()=>HD,_toEscapedUtf8String:()=>ZM,accessListify:()=>sc,arrayify:()=>ke,base58:()=>hh,base64:()=>tD,checkProperties:()=>Lw,checkResultErrors:()=>Uw,commify:()=>qhe,computeAddress:()=>ol,computeHmac:()=>dh,computePublicKey:()=>v5,concat:()=>Fr,deepCopy:()=>vn,defaultAbiCoder:()=>d5,defaultPath:()=>ph,defineReadOnly:()=>ye,dnsEncode:()=>m5,entropyToMnemonic:()=>Fm,fetchJson:()=>Jl,formatBytes32String:()=>YM,formatEther:()=>Hhe,formatUnits:()=>nL,getAccountPath:()=>D0e,getAddress:()=>$r,getContractAddress:()=>Rm,getCreate2Address:()=>Yue,getIcapAddress:()=>Zue,getJsonWalletAddress:()=>FD,getStatic:()=>bn,hashMessage:()=>zw,hexConcat:()=>Vn,hexDataLength:()=>ps,hexDataSlice:()=>ji,hexStripZeros:()=>UM,hexValue:()=>hf,hexZeroPad:()=>Kr,hexlify:()=>De,id:()=>tc,isAddress:()=>Gue,isBytes:()=>Zc,isBytesLike:()=>nh,isHexString:()=>Zt,isValidMnemonic:()=>M0e,isValidName:()=>iD,joinSignature:()=>i5,keccak256:()=>jr,mnemonicToEntropy:()=>s3,mnemonicToSeed:()=>PD,namehash:()=>ip,nameprep:()=>eD,parseBytes32String:()=>JM,parseEther:()=>zhe,parseTransaction:()=>$_,parseUnits:()=>oL,poll:()=>Ql,randomBytes:()=>kf,recoverAddress:()=>Mm,recoverPublicKey:()=>F_,resolveProperties:()=>$i,ripemd160:()=>_5,serializeTransaction:()=>b5,sha256:()=>pa,sha512:()=>TD,shallowCopy:()=>pi,shuffled:()=>C5,solidityKeccak256:()=>Uhe,solidityPack:()=>gE,soliditySha256:()=>Fhe,splitSignature:()=>df,stripZeros:()=>Xa,toUtf8Bytes:()=>fi,toUtf8CodePoints:()=>rp,toUtf8String:()=>ha,verifyMessage:()=>Q0e,verifyTypedData:()=>X0e,zeroPad:()=>Cm});var Lhe="solidity/5.7.0";var eVe=new RegExp("^bytes([0-9]+)$"),tVe=new RegExp("^(u?int)([0-9]*)$"),rVe=new RegExp("^(.*)\\[([0-9]*)\\]$"),iVe="0000000000000000000000000000000000000000000000000000000000000000",w3=new fe(Lhe);function Bhe(t,e,r){switch(t){case"address":return r?Cm(e,32):ke(e);case"string":return fi(e);case"bytes":return ke(e);case"bool":return e=e?"0x01":"0x00",r?Cm(e,32):ke(e)}let i=t.match(tVe);if(i){let n=parseInt(i[2]||"256");return(i[2]&&String(n)!==i[2]||n%8!==0||n===0||n>256)&&w3.throwArgumentError("invalid number type","type",t),r&&(n=256),e=Ue.from(e).toTwos(n),Cm(e,n/8)}if(i=t.match(eVe),i){let n=parseInt(i[1]);return(String(n)!==i[1]||n===0||n>32)&&w3.throwArgumentError("invalid bytes type","type",t),ke(e).byteLength!==n&&w3.throwArgumentError(`invalid value for ${t}`,"value",e),r?ke((e+iVe).substring(0,66)):e}if(i=t.match(rVe),i&&Array.isArray(e)){let n=i[1];parseInt(i[2]||String(e.length))!=e.length&&w3.throwArgumentError(`invalid array length for ${t}`,"value",e);let s=[];return e.forEach(function(a){s.push(Bhe(n,a,!0))}),Fr(s)}return w3.throwArgumentError("invalid type","type",t)}function gE(t,e){t.length!=e.length&&w3.throwArgumentError("wrong number of values; expected ${ types.length }","values",e);let r=[];return t.forEach(function(i,n){r.push(Bhe(i,e[n]))}),De(Fr(r))}function Uhe(t,e){return jr(gE(t,e))}function Fhe(t,e){return pa(gE(t,e))}var jhe="units/5.7.0";var $he=new fe(jhe),Whe=["wei","kwei","mwei","gwei","szabo","finney","ether"];function qhe(t){let e=String(t).split(".");(e.length>2||!e[0].match(/^-?[0-9]*$/)||e[1]&&!e[1].match(/^[0-9]*$/)||t==="."||t==="-.")&&$he.throwArgumentError("invalid value","value",t);let r=e[0],i="";for(r.substring(0,1)==="-"&&(i="-",r=r.substring(1));r.substring(0,1)==="0";)r=r.substring(1);r===""&&(r="0");let n="";for(e.length===2&&(n="."+(e[1]||"0"));n.length>2&&n[n.length-1]==="0";)n=n.substring(0,n.length-1);let o=[];for(;r.length;)if(r.length<=3){o.unshift(r);break}else{let s=r.length-3;o.unshift(r.substring(s)),r=r.substring(0,s)}return i+o.join(",")+n}function nL(t,e){if(typeof e=="string"){let r=Whe.indexOf(e);r!==-1&&(e=3*r)}return Mw(t,e??18)}function oL(t,e){if(typeof t!="string"&&$he.throwArgumentError("value must be a string","value",t),typeof e=="string"){let r=Whe.indexOf(e);r!==-1&&(e=3*r)}return Jc(t,e??18)}function Hhe(t){return nL(t,18)}function zhe(t){return oL(t,18)}var wE="ethers/5.7.2";var Vhe=new fe(wE);try{let t=window;t._ethers==null&&(t._ethers=yh)}catch{}var Ii={WALLET_ID:"@w3m/wallet_id",ERROR_CODE_UNRECOGNIZED_CHAIN_ID:4902,ERROR_CODE_DEFAULT:5e3};var Eo={getCaipDefaultChain(t){if(t)return{id:`${Ge.EIP155}:${t.chainId}`,name:t.name,imageId:to.EIP155NetworkImageIds[t.chainId]}},hexStringToNumber(t){let e=t.startsWith("0x")?t.slice(2):t;return parseInt(e,16)},numberToHexString(t){return`0x${t.toString(16)}`},async getUserInfo(t){let[e,r]=await Promise.all([Eo.getAddress(t),Eo.getChainId(t)]);return{chainId:r,address:e}},async getChainId(t){let e=await t.request({method:"eth_chainId"});return Number(e)},async getAddress(t){let[e]=await t.request({method:"eth_accounts"});return e},async addEthereumChain(t,e){await t.request({method:"wallet_addEthereumChain",params:[{chainId:Eo.numberToHexString(e.chainId),rpcUrls:[e.rpcUrl],chainName:e.name,nativeCurrency:{name:e.currency,decimals:18,symbol:e.currency},blockExplorerUrls:[e.explorerUrl],iconUrls:[to.EIP155NetworkImageIds[e.chainId]]}]})}};Qo();on();var Zn=Jt({provider:void 0,providerType:void 0,address:void 0,chainId:void 0,status:"reconnecting",isConnected:!1}),ut={state:Zn,subscribeKey(t,e){return hi(Zn,t,e)},subscribe(t){return Dr(Zn,()=>t(Zn))},setProvider(t){t&&(Zn.provider=Mo(t))},setProviderType(t){Zn.providerType=t},setAddress(t){Zn.address=t},setPreferredAccountType(t){Zn.preferredAccountType=t},setChainId(t){Zn.chainId=t},setStatus(t){Zn.status=t},setIsConnected(t){Zn.isConnected=t},setError(t){Zn.error=t},reset(){Zn.provider=void 0,Zn.address=void 0,Zn.chainId=void 0,Zn.providerType=void 0,Zn.status="disconnected",Zn.isConnected=!1,Zn.error=void 0,Zn.preferredAccountType=void 0}};Di();var vE=class extends Kb{constructor(e){let{ethersConfig:r,siweConfig:i,chains:n,defaultChain:o,tokens:s,chainImages:a,_sdkVersion:c,...h}=e;if(!r)throw new Error("web3modal:constructor - ethersConfig is undefined");if(!h.projectId)throw new Error("web3modal:constructor - projectId is undefined");let g={switchCaipNetwork:async E=>{let A=ml.caipNetworkIdToNumber(E?.id);if(A)try{ut.setError(void 0),await this.switchNetwork(A)}catch(T){throw ut.setError(T),new Error("networkControllerClient:switchCaipNetwork - unable to switch chain")}},getApprovedCaipNetworksData:async()=>new Promise(async E=>{if(localStorage.getItem(Ii.WALLET_ID)?.includes(Ge.WALLET_CONNECT_CONNECTOR_ID)){let T=await this.getWalletConnectProvider();if(!T)throw new Error("networkControllerClient:getApprovedCaipNetworks - provider is undefined");let P=T.signer?.session?.namespaces,L=P?.[Ge.EIP155]?.methods,j=P?.[Ge.EIP155]?.chains,$={supportsAllNetworks:L?.includes(Ge.ADD_CHAIN_METHOD)??!1,approvedCaipNetworkIds:j};E($)}else E({approvedCaipNetworkIds:void 0,supportsAllNetworks:!0})})},b={connectWalletConnect:async E=>{let A=await this.getWalletConnectProvider();if(!A)throw new Error("connectionControllerClient:getWalletConnectUri - provider is undefined");if(A.on("display_uri",T=>{E(T)}),i?.options?.enabled){let{SIWEController:T,getDidChainId:P,getDidAddress:L}=await Promise.resolve().then(()=>(k0(),R0)),$=(await A.authenticate({nonce:await i.getNonce(),methods:PM,...await i.getMessageParams()}))?.auths?.[0];if($){let{p:G,s:Z}=$,te=P(G.iss),se=L(G.iss);se&&te&&T.setSession({address:se,chainId:parseInt(te,10)});try{let X=A.signer.client.formatAuthMessage({request:G,iss:G.iss});await T.verifyMessage({message:X,signature:Z.s,cacao:$})}catch(X){throw console.error("Error verifying message",X),await A.disconnect().catch(console.error),await T.signOut().catch(console.error),X}}}else await A.connect();await this.setWalletConnectProvider()},connectExternal:async({id:E,info:A,provider:T})=>{if(E===Ge.INJECTED_CONNECTOR_ID){let P=r.injected;if(!P)throw new Error("connectionControllerClient:connectInjected - provider is undefined");try{ut.setError(void 0),await P.request({method:"eth_requestAccounts"}),this.setInjectedProvider(r)}catch(L){ut.setError(L)}}else if(E===Ge.EIP6963_CONNECTOR_ID&&A&&T){try{ut.setError(void 0),await T.request({method:"eth_requestAccounts"})}catch(P){ut.setError(P)}this.setEIP6963Provider(T,A.name)}else if(E===Ge.COINBASE_SDK_CONNECTOR_ID){let P=r.coinbase;if(!P)throw new Error("connectionControllerClient:connectCoinbase - connector is undefined");try{ut.setError(void 0),await P.request({method:"eth_requestAccounts"}),this.setCoinbaseProvider(r)}catch(L){throw ut.setError(L),new Error(L.message)}}},checkInstalled:E=>E?r.injected&&!window?.ethereum?!1:E.some(A=>!!window.ethereum?.[String(A)]):!!window.ethereum,disconnect:async()=>{let E=ut.state.provider,A=ut.state.providerType;if(localStorage.removeItem(Ii.WALLET_ID),ut.reset(),i?.options?.signOutOnDisconnect){let{SIWEController:T}=await Promise.resolve().then(()=>(k0(),R0));await T.signOut()}A===Ge.WALLET_CONNECT_CONNECTOR_ID?await E.disconnect():E&&E.emit("disconnect")},signMessage:async E=>{let A=ut.state.provider;if(!A)throw new Error("connectionControllerClient:signMessage - provider is undefined");let T=ac.isHexString(E)?E:ac.hexlify(ac.toUtf8Bytes(E));return await A.request({method:"personal_sign",params:[T,this.getAddress()]})},parseUnits:(E,A)=>yh.utils.parseUnits(E,A).toBigInt(),formatUnits:(E,A)=>yh.utils.formatUnits(E,A),sendTransaction:async E=>{let A=ut.state.provider,T=ut.state.address;if(!A)throw new Error("connectionControllerClient:sendTransaction - provider is undefined");if(!T)throw new Error("connectionControllerClient:sendTransaction - address is undefined");let P={to:E.to,value:E.value,gasLimit:E.gas,gasPrice:E.gasPrice,data:E.data,type:0};return(await(await new yh.providers.Web3Provider(A).getSigner().sendTransaction(P)).wait())?.blockHash||null}};super({networkControllerClient:g,connectionControllerClient:b,siweControllerClient:i,defaultChain:Eo.getCaipDefaultChain(o),tokens:dT.getCaipTokens(s),_sdkVersion:c??`html-ethers5-${Ge.VERSION}`,...h}),this.hasSyncedConnectedAccount=!1,this.EIP6963Providers=[],this.options=void 0,this.options=e,this.metadata=r.metadata,this.projectId=h.projectId,this.chains=n,this.createProvider(),ut.subscribeKey("address",()=>{this.syncAccount()}),ut.subscribeKey("chainId",()=>{this.syncNetwork(a)}),this.syncRequestedNetworks(n,a),this.syncConnectors(r),r.injected&&this.checkActiveInjectedProvider(r),r.coinbase&&this.checkActiveCoinbaseProvider(r),typeof window<"u"&&(this.listenConnectors(!0),this.checkActive6963Provider()),this.setEIP6963Enabled(r.EIP6963)}getState(){let e=super.getState();return{...e,selectedNetworkId:ml.caipNetworkIdToNumber(e.selectedNetworkId)}}subscribeState(e){return super.subscribeState(r=>e({...r,selectedNetworkId:ml.caipNetworkIdToNumber(r.selectedNetworkId)}))}setAddress(e){let r=e?ac.getAddress(e):void 0;ut.setAddress(r)}getAddress(){let{address:e}=ut.state;return e&&ac.getAddress(e)}getError(){return ut.state.error}getChainId(){return ut.state.chainId}getStatus(){return ut.state.status}getIsConnected(){return ut.state.isConnected}getWalletProvider(){return ut.state.provider}getWalletProviderType(){return ut.state.providerType}subscribeProvider(e){return ut.subscribe(e)}async disconnect(){let{provider:e,providerType:r}=ut.state;localStorage.removeItem(Ii.WALLET_ID),ut.reset(),r==="injected"||r==="eip6963"?e?.emit("disconnect"):await e.disconnect()}createProvider(){return!this.walletConnectProviderInitPromise&&typeof window<"u"&&(this.walletConnectProviderInitPromise=this.initWalletConnectProvider()),this.walletConnectProviderInitPromise}async initWalletConnectProvider(){let e={projectId:this.projectId,showQrModal:!1,rpcMap:this.chains?this.chains.reduce((r,i)=>(r[i.chainId]=i.rpcUrl,r),{}):{},optionalChains:[...this.chains.map(r=>r.chainId)],metadata:{name:this.metadata?this.metadata.name:"",description:this.metadata?this.metadata.description:"",url:this.metadata?this.metadata.url:"",icons:this.metadata?this.metadata.icons:[""]}};this.walletConnectProvider=await r_.init(e),await this.checkActiveWalletConnectProvider()}async getWalletConnectProvider(){if(!this.walletConnectProvider)try{ut.setError(void 0),await this.createProvider()}catch(e){ut.setError(e)}return this.walletConnectProvider}syncRequestedNetworks(e,r){let i=e?.map(n=>({id:`${Ge.EIP155}:${n.chainId}`,name:n.name,imageId:to.EIP155NetworkImageIds[n.chainId],imageUrl:r?.[n.chainId]}));this.setRequestedCaipNetworks(i??[])}async checkActiveWalletConnectProvider(){let e=await this.getWalletConnectProvider(),r=localStorage.getItem(Ii.WALLET_ID);e&&r===Ge.WALLET_CONNECT_CONNECTOR_ID&&await this.setWalletConnectProvider();let i=ut.state.isConnected;ut.setStatus(i?"connected":"disconnected")}checkActiveInjectedProvider(e){let r=e.injected,i=localStorage.getItem(Ii.WALLET_ID);r&&i===Ge.INJECTED_CONNECTOR_ID&&(this.setInjectedProvider(e),this.watchInjected(e))}checkActiveCoinbaseProvider(e){let r=e.coinbase,i=localStorage.getItem(Ii.WALLET_ID);r&&i===Ge.COINBASE_SDK_CONNECTOR_ID&&(r._addresses&&r._addresses?.length>0?(this.setCoinbaseProvider(e),this.watchCoinbase(e)):(localStorage.removeItem(Ii.WALLET_ID),ut.reset()))}checkActive6963Provider(){let e=window?.localStorage.getItem(Ii.WALLET_ID);if(e){let r=this.EIP6963Providers.find(i=>i.info.name===e);r&&this.setEIP6963Provider(r.provider,r.info.name)}}async setWalletConnectProvider(){window?.localStorage.setItem(Ii.WALLET_ID,Ge.WALLET_CONNECT_CONNECTOR_ID);let e=await this.getWalletConnectProvider();e&&(ut.setChainId(e.chainId),ut.setProviderType("walletConnect"),ut.setProvider(e),ut.setStatus("connected"),ut.setIsConnected(!0),this.setAddress(e.accounts?.[0]),this.watchWalletConnect())}async setEIP6963Provider(e,r){if(window?.localStorage.setItem(Ii.WALLET_ID,r),e){let{address:i,chainId:n}=await Eo.getUserInfo(e);i&&n&&(ut.setChainId(n),ut.setProviderType("eip6963"),ut.setProvider(e),ut.setStatus("connected"),ut.setIsConnected(!0),this.setAddress(i),this.watchEIP6963(e))}}async setInjectedProvider(e){window?.localStorage.setItem(Ii.WALLET_ID,Ge.INJECTED_CONNECTOR_ID);let r=e.injected;if(r){let{address:i,chainId:n}=await Eo.getUserInfo(r);i&&n&&(ut.setChainId(n),ut.setProviderType("injected"),ut.setProvider(e.injected),ut.setStatus("connected"),ut.setIsConnected(!0),this.setAddress(i),this.watchCoinbase(e))}}async setCoinbaseProvider(e){window?.localStorage.setItem(Ii.WALLET_ID,Ge.COINBASE_SDK_CONNECTOR_ID);let r=e.coinbase;if(r){let{address:i,chainId:n}=await Eo.getUserInfo(r);i&&n&&(ut.setChainId(n),ut.setProviderType("coinbaseWalletSDK"),ut.setProvider(e.coinbase),ut.setStatus("connected"),ut.setIsConnected(!0),this.setAddress(i),this.watchCoinbase(e))}}async watchWalletConnect(){let e=await this.getWalletConnectProvider();function r(){localStorage.removeItem(Ii.WALLET_ID),ut.reset(),e?.removeListener("disconnect",r),e?.removeListener("accountsChanged",n),e?.removeListener("chainChanged",i)}function i(o){if(o){let s=Eo.hexStringToNumber(o);ut.setChainId(s)}}let n=async o=>{o.length>0&&await this.setWalletConnectProvider()};e&&(e.on("disconnect",r),e.on("accountsChanged",n),e.on("chainChanged",i))}watchInjected(e){let r=e.injected;function i(){localStorage.removeItem(Ii.WALLET_ID),ut.reset(),r?.removeListener("disconnect",i),r?.removeListener("accountsChanged",n),r?.removeListener("chainChanged",o)}function n(s){let a=s?.[0];a?ut.setAddress(ac.getAddress(a)):(localStorage.removeItem(Ii.WALLET_ID),ut.reset())}function o(s){if(s){let a=typeof s=="string"?Eo.hexStringToNumber(s):Number(s);ut.setChainId(a)}}r&&(r.on("disconnect",i),r.on("accountsChanged",n),r.on("chainChanged",o))}watchEIP6963(e){function r(){localStorage.removeItem(Ii.WALLET_ID),ut.reset(),e.removeListener("disconnect",r),e.removeListener("accountsChanged",i),e.removeListener("chainChanged",n)}function i(o){let s=o?.[0];s?ut.setAddress(ac.getAddress(s)):(localStorage.removeItem(Ii.WALLET_ID),ut.reset())}function n(o){if(o){let s=typeof o=="string"?Eo.hexStringToNumber(o):Number(o);ut.setChainId(s)}}e.on("disconnect",r),e.on("accountsChanged",i),e.on("chainChanged",n)}watchCoinbase(e){let r=e.coinbase,i=localStorage.getItem(Ii.WALLET_ID);function n(){localStorage.removeItem(Ii.WALLET_ID),ut.reset(),r?.removeListener("disconnect",n),r?.removeListener("accountsChanged",o),r?.removeListener("chainChanged",s)}function o(a){a.length===0?(localStorage.removeItem(Ii.WALLET_ID),ut.reset()):ut.setAddress(a[0])}function s(a){if(a&&i===Ge.COINBASE_SDK_CONNECTOR_ID){let c=Number(a);ut.setChainId(c)}}r&&(r.on("disconnect",n),r.on("accountsChanged",o),r.on("chainChanged",s))}async syncAccount(){let e=ut.state.address,r=ut.state.chainId,i=ut.state.isConnected;if(this.resetAccount(),i&&e&&r){let n=`${Ge.EIP155}:${r}:${e}`;this.setIsConnected(i),this.setCaipAddress(n),this.syncConnectedWalletInfo(),await Promise.all([this.syncProfile(e),this.syncBalance(e),this.getApprovedCaipNetworksData()]),this.hasSyncedConnectedAccount=!0}else!i&&this.hasSyncedConnectedAccount&&(this.resetWcConnection(),this.resetNetwork())}async syncNetwork(e){let r=ut.state.address,i=ut.state.chainId,n=ut.state.isConnected;if(this.chains){let o=this.chains.find(s=>s.chainId===i);if(o){let s=`${Ge.EIP155}:${o.chainId}`;if(this.setCaipNetwork({id:s,name:o.name,imageId:to.EIP155NetworkImageIds[o.chainId],imageUrl:e?.[o.chainId]}),n&&r){let a=`${Ge.EIP155}:${i}:${r}`;if(this.setCaipAddress(a),o.explorerUrl){let c=`${o.explorerUrl}/address/${r}`;this.setAddressExplorerUrl(c)}else this.setAddressExplorerUrl(void 0);this.hasSyncedConnectedAccount&&await this.syncBalance(r)}}else n&&this.setCaipNetwork({id:`${Ge.EIP155}:${i}`})}}async syncProfile(e){let r=ut.state.chainId;try{let{name:i,avatar:n}=await this.fetchIdentity({address:e});this.setProfileName(i),this.setProfileImage(n)}catch{if(r===1){let i=new yh.providers.InfuraProvider("mainnet"),n=await i.lookupAddress(e),o=await i.getAvatar(e);n&&this.setProfileName(n),o&&this.setProfileImage(o)}else this.setProfileName(null),this.setProfileImage(null)}}async syncBalance(e){let r=ut.state.chainId;if(r&&this.chains){let i=this.chains.find(n=>n.chainId===r);if(i){let n=new yh.providers.JsonRpcProvider(i.rpcUrl,{chainId:r,name:i.name});if(n){let o=await n.getBalance(e),s=ac.formatEther(o);this.setBalance(s,i.currency)}}}}syncConnectedWalletInfo(){let e=window?.localStorage.getItem(Ii.WALLET_ID),r=ut.state.providerType;if(r===Ge.EIP6963_CONNECTOR_ID){if(e){let i=this.EIP6963Providers.find(n=>n.info.name===e);i&&this.setConnectedWalletInfo({...i.info})}}else if(r===Ge.WALLET_CONNECT_CONNECTOR_ID){let i=ut.state.provider;i.session&&this.setConnectedWalletInfo({...i.session.peer.metadata,name:i.session.peer.metadata.name,icon:i.session.peer.metadata.icons?.[0]})}else e&&this.setConnectedWalletInfo({name:e})}async switchNetwork(e){let r=ut.state.provider,i=ut.state.providerType;if(this.chains){let n=this.chains.find(o=>o.chainId===e);if(i===Ge.WALLET_CONNECT_CONNECTOR_ID&&n){let o=r;if(o)try{await o.request({method:"wallet_switchEthereumChain",params:[{chainId:Eo.numberToHexString(n.chainId)}]}),ut.setChainId(e)}catch(s){if(s.code===Ii.ERROR_CODE_UNRECOGNIZED_CHAIN_ID||s.code===Ii.ERROR_CODE_DEFAULT||s?.data?.originalError?.code===Ii.ERROR_CODE_UNRECOGNIZED_CHAIN_ID)await Eo.addEthereumChain(o,n);else throw new Error("Chain is not supported")}}else if(i===Ge.EIP6963_CONNECTOR_ID&&n){let o=r;if(o)try{await o.request({method:"wallet_switchEthereumChain",params:[{chainId:Eo.numberToHexString(n.chainId)}]}),ut.setChainId(n.chainId)}catch(s){if(s.code===Ii.ERROR_CODE_UNRECOGNIZED_CHAIN_ID||s.code===Ii.ERROR_CODE_DEFAULT||s?.data?.originalError?.code===Ii.ERROR_CODE_UNRECOGNIZED_CHAIN_ID)await Eo.addEthereumChain(o,n);else throw new Error("Chain is not supported")}}else if(i===Ge.COINBASE_SDK_CONNECTOR_ID&&n){let o=r;if(o)try{await o.request({method:"wallet_switchEthereumChain",params:[{chainId:Eo.numberToHexString(n.chainId)}]}),ut.setChainId(n.chainId)}catch(s){(s.code===Ii.ERROR_CODE_UNRECOGNIZED_CHAIN_ID||s.code===Ii.ERROR_CODE_DEFAULT||s?.data?.originalError?.code===Ii.ERROR_CODE_UNRECOGNIZED_CHAIN_ID)&&await Eo.addEthereumChain(o,n)}}}}syncConnectors(e){let r=[],i=to.ConnectorTypesMap[Ge.WALLET_CONNECT_CONNECTOR_ID];if(i&&r.push({id:Ge.WALLET_CONNECT_CONNECTOR_ID,explorerId:to.ConnectorExplorerIds[Ge.WALLET_CONNECT_CONNECTOR_ID],imageId:to.ConnectorImageIds[Ge.WALLET_CONNECT_CONNECTOR_ID],imageUrl:this.options?.connectorImages?.[Ge.WALLET_CONNECT_CONNECTOR_ID],name:to.ConnectorNamesMap[Ge.WALLET_CONNECT_CONNECTOR_ID],type:i}),e.injected){let n=to.ConnectorTypesMap[Ge.INJECTED_CONNECTOR_ID];n&&r.push({id:Ge.INJECTED_CONNECTOR_ID,explorerId:to.ConnectorExplorerIds[Ge.INJECTED_CONNECTOR_ID],imageId:to.ConnectorImageIds[Ge.INJECTED_CONNECTOR_ID],imageUrl:this.options?.connectorImages?.[Ge.INJECTED_CONNECTOR_ID],name:to.ConnectorNamesMap[Ge.INJECTED_CONNECTOR_ID],type:n})}e.coinbase&&r.push({id:Ge.COINBASE_SDK_CONNECTOR_ID,explorerId:to.ConnectorExplorerIds[Ge.COINBASE_SDK_CONNECTOR_ID],imageId:to.ConnectorImageIds[Ge.COINBASE_SDK_CONNECTOR_ID],imageUrl:this.options?.connectorImages?.[Ge.COINBASE_SDK_CONNECTOR_ID],name:to.ConnectorNamesMap[Ge.COINBASE_SDK_CONNECTOR_ID],type:"EXTERNAL"}),this.setConnectors(r)}eip6963EventHandler(e){if(e.detail){let{info:r,provider:i}=e.detail,n=this.getConnectors(),o=n.find(c=>c.name===r.name),a=n.find(c=>c.id===Ge.COINBASE_SDK_CONNECTOR_ID)&&e.detail.info.rdns===Ge.CONNECTOR_RDNS_MAP[Ge.COINBASE_SDK_CONNECTOR_ID];if(!o&&!a){let c=to.ConnectorTypesMap[Ge.EIP6963_CONNECTOR_ID];if(c){this.addConnector({id:Ge.EIP6963_CONNECTOR_ID,type:c,imageUrl:r.icon??this.options?.connectorImages?.[Ge.EIP6963_CONNECTOR_ID],name:r.name,provider:i,info:r});let h={provider:i,info:r};this.EIP6963Providers.push(h)}}}}listenConnectors(e){if(typeof window<"u"&&e){let r=this.eip6963EventHandler.bind(this);window.addEventListener(Ge.EIP6963_ANNOUNCE_EVENT,r),window.dispatchEvent(new Event(Ge.EIP6963_REQUEST_EVENT))}}};US();var J2e=Wt(Y2e(),1);function oU(t){let{enableEIP6963:e=!0,enableInjected:r=!0,enableCoinbase:i=!0,metadata:n}=t,o,s,a={metadata:n};function c(){if(o)return o;if(!(typeof window>"u")&&window.ethereum)return o=window.ethereum,o}function h(){return s||(typeof window>"u"?void 0:(s=new J2e.CoinbaseWalletSDK({appName:n.name,appLogoUrl:n.icons[0],appChainIds:t.chains?.map(b=>b.chainId)||[1,84532]}).makeWeb3Provider({options:t.coinbasePreference||"all"}),s))}return i&&(a.coinbase=h()),r&&(a.injected=c()),e&&(a.EIP6963=!0),a}function Q2e(t){return new vE({...t,_sdkVersion:`html-ethers5-${Ge.VERSION}`})}var yXe=(t=>(t.MissingApiKey="MISSING_API_KEY",t.ModalNotReady="MODAL_NOT_READY",t.ConnectionLost="CONNECTION_WAS_LOST",t.MalformedResponse="MALFORMED_RESPONSE",t.InvalidArgument="INVALID_ARGUMENT",t.ExtensionNotInitialized="EXTENSION_NOT_INITIALIZED",t.IncompatibleExtensions="INCOMPATIBLE_EXTENSIONS",t))(yXe||{}),xXe=(t=>(t.SyncWeb3Method="SYNC_WEB3_METHOD",t.DuplicateIframe="DUPLICATE_IFRAME",t.ReactNativeEndpointConfiguration="REACT_NATIVE_ENDPOINT_CONFIGURATION",t.DeprecationNotice="DEPRECATION_NOTICE",t.ProductAnnouncement="ANNOUNCEMENT",t))(xXe||{}),_Xe=(t=>(t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.MagicLinkFailedVerification=-1e4]="MagicLinkFailedVerification",t[t.MagicLinkExpired=-10001]="MagicLinkExpired",t[t.MagicLinkRateLimited=-10002]="MagicLinkRateLimited",t[t.MagicLinkInvalidRedirectURL=-10006]="MagicLinkInvalidRedirectURL",t[t.UserAlreadyLoggedIn=-10003]="UserAlreadyLoggedIn",t[t.UpdateEmailFailed=-10004]="UpdateEmailFailed",t[t.UserRequestEditEmail=-10005]="UserRequestEditEmail",t[t.InactiveRecipient=-10010]="InactiveRecipient",t[t.AccessDeniedToUser=-10011]="AccessDeniedToUser",t[t.RedirectLoginComplete=-10015]="RedirectLoginComplete",t[t.DpopInvalidated=-10019]="DpopInvalidated",t))(_Xe||{}),eu=(t=>(t.PROVIDER="magic_3pw_provider",t.ADDRESS="magic_3pw_address",t.CHAIN_ID="magic_3pw_chainId",t))(eu||{}),K3=(t=>(t.WalletConnected="wallet_connected",t.WalletRejected="wallet_rejected",t.Web3ModalSelected="web3modal_selected",t))(K3||{}),EXe=(t=>(t.LoginWithSms="magic_auth_login_with_sms",t.LoginWithEmailOTP="magic_auth_login_with_email_otp",t.LoginWithMagicLink="magic_auth_login_with_magic_link",t.LoginWithCredential="magic_auth_login_with_credential",t.SetAuthorizationToken="magic_auth_set_authorization_token",t.GetIdToken="magic_auth_get_id_token",t.GenerateIdToken="magic_auth_generate_id_token",t.GetMetadata="magic_auth_get_metadata",t.IsLoggedIn="magic_is_logged_in",t.Logout="magic_auth_logout",t.UpdateEmail="magic_auth_update_email",t.UserSettings="magic_auth_settings",t.UserSettingsTestMode="magic_auth_settings_testing_mode",t.LoginWithSmsTestMode="magic_auth_login_with_sms_testing_mode",t.LoginWithEmailOTPTestMode="magic_auth_login_with_email_otp_testing_mode",t.LoginWithMagicLinkTestMode="magic_login_with_magic_link_testing_mode",t.LoginWithCredentialTestMode="magic_auth_login_with_credential_testing_mode",t.GetIdTokenTestMode="magic_auth_get_id_token_testing_mode",t.GenerateIdTokenTestMode="magic_auth_generate_id_token_testing_mode",t.GetMetadataTestMode="magic_auth_get_metadata_testing_mode",t.IsLoggedInTestMode="magic_auth_is_logged_in_testing_mode",t.LogoutTestMode="magic_auth_logout_testing_mode",t.UpdateEmailTestMode="magic_auth_update_email_testing_mode",t.IntermediaryEvent="magic_intermediary_event",t.RequestAccounts="eth_requestAccounts",t.GetInfo="magic_get_info",t.ShowUI="magic_wallet",t.NFTPurchase="magic_nft_purchase",t.NFTCheckout="magic_nft_checkout",t.NFTTransfer="magic_nft_transfer",t.RequestUserInfoWithUI="mc_request_user_info",t.Disconnect="mc_disconnect",t.RecoverAccount="magic_auth_recover_account",t.RecoverAccountTestMode="magic_auth_recover_account_testing_mode",t.MagicBoxHeartBeat="magic_box_heart_beat",t.AutoConnect="mc_auto_connect",t.Login="mc_login",t.EncryptV1="magic_auth_encrypt_v1",t.DecryptV1="magic_auth_decrypt_v1",t.ShowNFTs="magic_show_nfts",t.ShowOnRamp="magic_show_fiat_onramp",t.ShowSendTokensUI="magic_show_send_tokens_ui",t.ShowAddress="magic_show_address",t.ShowBalances="magic_show_balances",t.SendGaslessTransaction="eth_sendGaslessTransaction",t.RevealPK="magic_reveal_key",t.EnableMFA="magic_auth_enable_mfa_flow",t.DisableMFA="magic_auth_disable_mfa_flow",t.GetMultichainPublicAddress="magic_get_multichain_public_address",t))(EXe||{});var AXe=(t=>(t.MAGIC_HANDLE_RESPONSE="MAGIC_HANDLE_RESPONSE",t.MAGIC_OVERLAY_READY="MAGIC_OVERLAY_READY",t.MAGIC_SHOW_OVERLAY="MAGIC_SHOW_OVERLAY",t.MAGIC_HIDE_OVERLAY="MAGIC_HIDE_OVERLAY",t.MAGIC_HANDLE_EVENT="MAGIC_HANDLE_EVENT",t.MAGIC_MG_BOX_SEND_RECEIPT="MAGIC_MG_BOX_SEND_RECEIPT",t.MAGIC_SEND_PRODUCT_ANNOUNCEMENT="MAGIC_SEND_PRODUCT_ANNOUNCEMENT",t.MAGIC_PONG="MAGIC_PONG",t.MAGIC_POPUP_RESPONSE="MAGIC_POPUP_RESPONSE",t.MAGIC_POPUP_OAUTH_VERIFY_RESPONSE="MAGIC_POPUP_OAUTH_VERIFY_RESPONSE",t))(AXe||{}),CXe=(t=>(t.MAGIC_HANDLE_REQUEST="MAGIC_HANDLE_REQUEST",t.MAGIC_PING="MAGIC_PING",t))(CXe||{}),SXe=(t=>(t.UpdateEmail="update-email",t.MFA="mfa",t.Recovery="recovery",t))(SXe||{}),IXe=(t=>(t.Retry="retry",t))(IXe||{}),TXe=(t=>(t.EmailSent="email-sent",t.EmailNotDeliverable="email-not-deliverable",t))(TXe||{}),RXe=(t=>(t.VerifyEmailOtp="verify-email-otp",t.VerifyMFACode="verify-mfa-code",t.LostDevice="lost-device",t.VerifyRecoveryCode="verify-recovery-code",t.Cancel="cancel",t))(RXe||{}),kXe=(t=>(t.VerifySmsOtp="verify-sms-otp",t.Cancel="cancel",t.Retry="retry",t))(kXe||{}),NXe=(t=>(t.SmsOTPSent="sms-otp-sent",t.InvalidSmsOtp="invalid-sms-otp",t.ExpiredSmsOtp="expired-sms-otp",t))(NXe||{}),PXe=(t=>(t.EmailOTPSent="email-otp-sent",t.InvalidEmailOtp="invalid-email-otp",t.InvalidMfaOtp="invalid-mfa-otp",t.ExpiredEmailOtp="expired-email-otp",t.MfaSentHandle="mfa-sent-handle",t.RecoveryCodeSentHandle="recovery-code-sent-handle",t.InvalidRecoveryCode="invalid-recovery-code",t.RecoveryCodeSuccess="recovery-code-success",t.LoginThrottled="login-throttled",t))(PXe||{}),OXe=(t=>(t.Retry="device-retry",t))(OXe||{}),MXe=(t=>(t.DeviceApproved="device-approved",t.DeviceNeedsApproval="device-needs-approval",t.DeviceVerificationLinkExpired="device-verification-link-expired",t.DeviceVerificationEmailSent="device-verification-email-sent",t))(MXe||{}),DXe=(t=>(t.Retry="Recency/auth-factor-retry",t.Cancel="Recency/auth-factor-verification-cancel",t.VerifyEmailOtp="Recency/auth-factor-verify-email-otp",t.VerifyMFACode="Recency/verify-mfa-code",t))(DXe||{}),LXe=(t=>(t.PrimaryAuthFactorNeedsVerification="Recency/auth-factor-needs-verification",t.PrimaryAuthFactorVerified="Recency/auth-factor-verified",t.InvalidEmailOtp="Recency/auth-factor-invalid-email-otp",t.EmailExpired="Recency/auth-factor-verification-email-expired",t.EmailSent="Recency/auth-factor-verification-email-sent",t.EmailNotDeliverable="Recency/auth-factor-verification-email-not-deliverable",t))(LXe||{}),BXe=(t=>(t.RetryWithNewEmail="UpdateEmail/retry-with-new-email",t.Cancel="UpdateEmail/new-email-verification-cancel",t.VerifyEmailOtp="UpdateEmail/new-email-verify-otp",t))(BXe||{}),UXe=(t=>(t.NewAuthFactorNeedsVerification="UpdateEmail/new-email-needs-verification",t.EmailUpdated="UpdateEmail/email-updated",t.InvalidEmailOtp="UpdateEmail/new-email-invalid-email-otp",t.EmailExpired="UpdateEmail/new-email-verification-email-expired",t.EmailSent="UpdateEmail/new-email-verification-email-sent",t.EmailNotDeliverable="UpdateEmail/new-email-verification-email-not-deliverable",t.InvalidEmail="UpdateEmail/new-email-invalid",t.EmailAlreadyExists="UpdateEmail/new-email-already-exists",t))(UXe||{}),FXe=(t=>(t.IDTokenCreated="Auth/id-token-created",t))(FXe||{}),jXe=(t=>(t.Cancel="Farcaster/cancel",t))(jXe||{}),$Xe=(t=>(t.MFASecretGenerated="mfa-secret-generated",t.InvalidMFAOtp="invalid-mfa-otp",t.MFARecoveryCodes="mfa-recovery-codes",t))($Xe||{}),WXe=(t=>(t.VerifyMFACode="verify-mfa-code",t.Cancel="cancel-mfa-setup",t))(WXe||{}),qXe=(t=>(t.MFACodeRequested="mfa-code-requested",t.InvalidMFAOtp="invalid-mfa-otp",t.InvalidRecoveryCode="invalid-recovery-code",t))(qXe||{}),HXe=(t=>(t.VerifyMFACode="verify-mfa-code",t.LostDevice="lost-device",t.Cancel="cancel-mfa-disable",t))(HXe||{}),zXe=(t=>(t.Harmony="HARMONY",t))(zXe||{}),VXe=(t=>(t.ClosedByUser="closed-by-user",t))(VXe||{}),KXe=(t=>(t.ClosedByUser="closed-by-user-on-received",t))(KXe||{}),GXe=(t=>(t.EnterNewPhoneNumber="enter-new-phone-number",t.EnterOtpCode="enter-otp-code",t.RecoveryFactorAlreadyExists="recovery-factor-already-exists",t.MalformedPhoneNumber="malformed-phone-number",t.InvalidOtpCode="invalid-otp-code",t.RecoveryFactorUpdated="recovery-factor-updated",t.RecoveryFactorDeleted="recovery-factor-deleted",t))(GXe||{}),ZXe=(t=>(t.SendNewPhoneNumber="send-new-phone-number",t.SendOtpCode="send-otp-code",t.Cancel="cancel",t.StartEditPhoneNumber="start-edit-phone-number",t))(ZXe||{}),YXe=(t=>(t.PhoneNumber="phone_number",t))(YXe||{}),JXe=(t=>(t.SmsOtpSent="sms-otp-sent",t.LoginThrottled="login-throttled",t.InvalidSmsOtp="invalid-sms-otp",t.SmsVerified="sms-verified",t.AccountRecovered="account-recovered",t.UpdateEmailRequired="update-email-required",t))(JXe||{}),QXe=(t=>(t.Cancel="cancel",t.VerifyOtp="verify-otp-code",t.ResendSms="resend-sms-otp",t.UpdateEmail="update-email",t))(QXe||{}),XXe=(t=>(t.Success="nft-checkout-success",t.Failure="nft-checkout-failure",t.Initiated="nft-checkout-initiated",t.Disconnect="disconnect",t))(XXe||{}),eet=(t=>(t.WalletInfoFetched="Wallet/wallet-info-fetched",t))(eet||{}),tet=(t=>(t.CloseMagicWindow="close-magic-window",t))(tet||{}),ret=(t=>(t.PopupUrl="popup-url",t))(ret||{}),iet=(t=>(t.PopupEvent="popup-event",t.Cancel="cancel",t))(iet||{});var HA=class t extends X2e.Extension.Internal{name="web3modal";config={};modal;static eventsListenerAdded=!1;constructor({configOptions:e,modalOptions:r}){super(),this.modal=Q2e({...r,themeVariables:{...r.themeVariables||{},"--w3m-z-index":3e9},ethersConfig:oU(e)});let i=this.modal.subscribeProvider(({status:n})=>{n==="connected"&&(i(),this.setIsConnected(),this.setEip1193EventListeners()),n==="disconnected"&&i()})}setIsConnected(){localStorage.setItem(eu.PROVIDER,"web3modal"),localStorage.setItem(eu.ADDRESS,this.modal.getAddress()),localStorage.setItem(eu.CHAIN_ID,this.modal.getChainId().toString()),this.sdk.thirdPartyWallets.isConnected=!0}initialize(){this.sdk.thirdPartyWallets.enabledWallets.web3modal=!0,this.sdk.thirdPartyWallets.isConnected=!!localStorage.getItem(eu.ADDRESS),this.sdk.thirdPartyWallets.eventListeners.push({event:K3.Web3ModalSelected,callback:async e=>{await this.connectToWeb3modal(e)}})}setEip1193EventListeners(){t.eventsListenerAdded||(t.eventsListenerAdded=!0,this.modal.subscribeProvider(({address:e,chainId:r})=>!e&&localStorage.getItem(eu.ADDRESS)?(this.sdk.thirdPartyWallets.resetThirdPartyWalletState(),this.sdk.rpcProvider.emit("accountsChanged",[])):e&&e!==localStorage.getItem(eu.ADDRESS)?(localStorage.setItem(eu.ADDRESS,e),this.sdk.rpcProvider.emit("accountsChanged",[e])):r&&r!==Number(localStorage.getItem(eu.CHAIN_ID))?(localStorage.setItem(eu.CHAIN_ID,r.toString()),this.sdk.rpcProvider.emit("chainChanged",r)):null))}handleUserConnected(e,r=this.modal.getAddress()){this.setIsConnected(),this.createIntermediaryEvent(K3.WalletConnected,e)(r),this.setEip1193EventListeners()}connectToWeb3modal(e){let{modal:r}=this;return this.utils.createPromiEvent(async()=>{try{r.getIsConnected()&&await r.disconnect()}catch(s){console.error(s)}let n=r.subscribeProvider(({address:s,error:a})=>{a&&(console.error("Provider event error:",a),n(),this.createIntermediaryEvent(K3.WalletRejected,e)()),s&&(this.handleUserConnected(e),n())}),o=r.subscribeEvents(s=>{s.data.event==="MODAL_CLOSE"&&(o(),n(),this.createIntermediaryEvent(K3.WalletRejected,e)())});r.open()})}};var net=HA;return Xf(oet);})();
9978
+ `)}static register(e,r){if(r||(r=e.locale),aze)try{let i=window;i._ethers&&i._ethers.wordlists&&(i._ethers.wordlists[r]||ye(i._ethers.wordlists,r,e))}catch{}}};var cze="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo",E5=null;function k0e(t){if(E5==null&&(E5=cze.replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),Tf.check(t)!=="0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"))throw E5=null,new Error("BIP39 Wordlist for en (English) FAILED")}var RD=class extends Tf{constructor(){super("en")}getWord(e){return k0e(this),E5[e]}getWordIndex(e){return k0e(this),E5.indexOf(e)}},kD=new RD;Tf.register(kD);var Um={en:kD};var N0e="hdnode/5.7.0";var A5=new fe(N0e),lze=Ue.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),uze=fi("Bitcoin seed"),o3=2147483648;function O0e(t){return(1<<t)-1<<8-t}function fze(t){return(1<<t)-1}function K_(t){return Kr(De(t),32)}function P0e(t){return hh.encode(Fr([t,ji(pa(pa(t)),0,4)]))}function ND(t){if(t==null)return Um.en;if(typeof t=="string"){let e=Um[t];return e==null&&A5.throwArgumentError("unknown locale","wordlist",t),e}return t}var n3={},ph="m/44'/60'/0'/0/0",Rf=class t{constructor(e,r,i,n,o,s,a,c){if(e!==n3)throw new Error("HDNode constructor cannot be called directly");if(r){let h=new nl(r);ye(this,"privateKey",h.privateKey),ye(this,"publicKey",h.compressedPublicKey)}else ye(this,"privateKey",null),ye(this,"publicKey",De(i));ye(this,"parentFingerprint",n),ye(this,"fingerprint",ji(_5(pa(this.publicKey)),0,4)),ye(this,"address",ol(this.publicKey)),ye(this,"chainCode",o),ye(this,"index",s),ye(this,"depth",a),c==null?(ye(this,"mnemonic",null),ye(this,"path",null)):typeof c=="string"?(ye(this,"mnemonic",null),ye(this,"path",c)):(ye(this,"mnemonic",c),ye(this,"path",c.path))}get extendedKey(){if(this.depth>=256)throw new Error("Depth too large!");return P0e(Fr([this.privateKey!=null?"0x0488ADE4":"0x0488B21E",De(this.depth),this.parentFingerprint,Kr(De(this.index),4),this.chainCode,this.privateKey!=null?Fr(["0x00",this.privateKey]):this.publicKey]))}neuter(){return new t(n3,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,this.path)}_derive(e){if(e>4294967295)throw new Error("invalid index - "+String(e));let r=this.path;r&&(r+="/"+(e&~o3));let i=new Uint8Array(37);if(e&o3){if(!this.privateKey)throw new Error("cannot derive child of neutered node");i.set(ke(this.privateKey),1),r&&(r+="'")}else i.set(ke(this.publicKey));for(let b=24;b>=0;b-=8)i[33+(b>>3)]=e>>24-b&255;let n=ke(dh(If.sha512,this.chainCode,i)),o=n.slice(0,32),s=n.slice(32),a=null,c=null;this.privateKey?a=K_(Ue.from(o).add(this.privateKey).mod(lze)):c=new nl(De(o))._addPoint(this.publicKey);let h=r,g=this.mnemonic;return g&&(h=Object.freeze({phrase:g.phrase,path:r,locale:g.locale||"en"})),new t(n3,a,c,this.fingerprint,K_(s),e,this.depth+1,h)}derivePath(e){let r=e.split("/");if(r.length===0||r[0]==="m"&&this.depth!==0)throw new Error("invalid path - "+e);r[0]==="m"&&r.shift();let i=this;for(let n=0;n<r.length;n++){let o=r[n];if(o.match(/^[0-9]+'$/)){let s=parseInt(o.substring(0,o.length-1));if(s>=o3)throw new Error("invalid path index - "+o);i=i._derive(o3+s)}else if(o.match(/^[0-9]+$/)){let s=parseInt(o);if(s>=o3)throw new Error("invalid path index - "+o);i=i._derive(s)}else throw new Error("invalid path component - "+o)}return i}static _fromSeed(e,r){let i=ke(e);if(i.length<16||i.length>64)throw new Error("invalid seed");let n=ke(dh(If.sha512,uze,i));return new t(n3,K_(n.slice(0,32)),null,"0x00000000",K_(n.slice(32)),0,0,r)}static fromMnemonic(e,r,i){return i=ND(i),e=Fm(s3(e,i),i),t._fromSeed(PD(e,r),{phrase:e,path:"m",locale:i.locale})}static fromSeed(e){return t._fromSeed(e,null)}static fromExtendedKey(e){let r=hh.decode(e);(r.length!==82||P0e(r.slice(0,78))!==e)&&A5.throwArgumentError("invalid extended key","extendedKey","[REDACTED]");let i=r[4],n=De(r.slice(5,9)),o=parseInt(De(r.slice(9,13)).substring(2),16),s=De(r.slice(13,45)),a=r.slice(45,78);switch(De(r.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new t(n3,null,De(a),n,s,o,i,null);case"0x0488ade4":case"0x04358394 ":if(a[0]!==0)break;return new t(n3,De(a.slice(1)),null,n,s,o,i,null)}return A5.throwArgumentError("invalid extended key","extendedKey","[REDACTED]")}};function PD(t,e){e||(e="");let r=fi("mnemonic"+e,qs.NFKD);return Bm(fi(t,qs.NFKD),r,2048,64,"sha512")}function s3(t,e){e=ND(e),A5.checkNormalize();let r=e.split(t);if(r.length%3!==0)throw new Error("invalid mnemonic");let i=ke(new Uint8Array(Math.ceil(11*r.length/8))),n=0;for(let h=0;h<r.length;h++){let g=e.getWordIndex(r[h].normalize("NFKD"));if(g===-1)throw new Error("invalid mnemonic");for(let b=0;b<11;b++)g&1<<10-b&&(i[n>>3]|=1<<7-n%8),n++}let o=32*r.length/3,s=r.length/3,a=O0e(s);if((ke(pa(i.slice(0,o/8)))[0]&a)!==(i[i.length-1]&a))throw new Error("invalid checksum");return De(i.slice(0,o/8))}function Fm(t,e){if(e=ND(e),t=ke(t),t.length%4!==0||t.length<16||t.length>32)throw new Error("invalid entropy");let r=[0],i=11;for(let s=0;s<t.length;s++)i>8?(r[r.length-1]<<=8,r[r.length-1]|=t[s],i-=8):(r[r.length-1]<<=i,r[r.length-1]|=t[s]>>8-i,r.push(t[s]&fze(8-i)),i+=3);let n=t.length/4,o=ke(pa(t))[0]&O0e(n);return r[r.length-1]<<=n,r[r.length-1]|=o>>8-n,e.join(r.map(s=>e.getWord(s)))}function M0e(t,e){try{return s3(t,e),!0}catch{}return!1}function D0e(t){return(typeof t!="number"||t<0||t>=o3||t%1)&&A5.throwArgumentError("invalid account index","index",t),`m/44'/60'/${t}'/0/0`}var L0e="random/5.7.0";var OD=new fe(L0e);function hze(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")}var B0e=hze(),G_=B0e.crypto||B0e.msCrypto;(!G_||!G_.getRandomValues)&&(OD.warn("WARNING: Missing strong random number source"),G_={getRandomValues:function(t){return OD.throwError("no secure random source avaialble",fe.errors.UNSUPPORTED_OPERATION,{operation:"crypto.getRandomValues"})}});function kf(t){(t<=0||t>1024||t%1||t!=t)&&OD.throwArgumentError("invalid length","length",t);let e=new Uint8Array(t);return G_.getRandomValues(e),ke(e)}function C5(t){t=t.slice();for(let e=t.length-1;e>0;e--){let r=Math.floor(Math.random()*(e+1)),i=t[e];t[e]=t[r],t[r]=i}return t}var LD=Wt(DD());var Z_="json-wallets/5.7.0";function mh(t){return typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),ke(t)}function a3(t,e){for(t=String(t);t.length<e;)t="0"+t;return t}function S5(t){return typeof t=="string"?fi(t,qs.NFKC):ke(t)}function _n(t,e){let r=t,i=e.toLowerCase().split("/");for(let n=0;n<i.length;n++){let o=null;for(let s in r)if(s.toLowerCase()===i[n]){o=r[s];break}if(o===null)return null;r=o}return r}function F0e(t){let e=ke(t);e[6]=e[6]&15|64,e[8]=e[8]&63|128;let r=De(e);return[r.substring(2,10),r.substring(10,14),r.substring(14,18),r.substring(18,22),r.substring(22,34)].join("-")}var dze=new fe(Z_),BD=class extends ec{isCrowdsaleAccount(e){return!!(e&&e._isCrowdsaleAccount)}};function UD(t,e){let r=JSON.parse(t);e=S5(e);let i=$r(_n(r,"ethaddr")),n=mh(_n(r,"encseed"));(!n||n.length%16!==0)&&dze.throwArgumentError("invalid encseed","json",t);let o=ke(Bm(e,e,2e3,32,"sha256")).slice(0,16),s=n.slice(0,16),a=n.slice(16),c=new LD.default.ModeOfOperation.cbc(o,s),h=LD.default.padding.pkcs7.strip(ke(c.decrypt(a))),g="";for(let A=0;A<h.length;A++)g+=String.fromCharCode(h[A]);let b=fi(g),E=jr(b);return new BD({_isCrowdsaleAccount:!0,address:i,privateKey:E})}function Y_(t){let e=null;try{e=JSON.parse(t)}catch{return!1}return e.encseed&&e.ethaddr}function J_(t){let e=null;try{e=JSON.parse(t)}catch{return!1}return!(!e.version||parseInt(e.version)!==e.version||parseInt(e.version)!==3)}function FD(t){if(Y_(t))try{return $r(JSON.parse(t).ethaddr)}catch{return null}if(J_(t))try{return $r(JSON.parse(t).address)}catch{return null}return null}var gh=Wt(DD()),Q_=Wt($0e());var pze=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},$D=new fe(Z_);function W0e(t){return t!=null&&t.mnemonic&&t.mnemonic.phrase}var WD=class extends ec{isKeystoreAccount(e){return!!(e&&e._isKeystoreAccount)}};function mze(t,e,r){if(_n(t,"crypto/cipher")==="aes-128-ctr"){let n=mh(_n(t,"crypto/cipherparams/iv")),o=new gh.default.Counter(n),s=new gh.default.ModeOfOperation.ctr(e,o);return ke(s.decrypt(r))}return null}function q0e(t,e){let r=mh(_n(t,"crypto/ciphertext"));if(De(jr(Fr([e.slice(16,32),r]))).substring(2)!==_n(t,"crypto/mac").toLowerCase())throw new Error("invalid password");let n=mze(t,e.slice(0,16),r);n||$D.throwError("unsupported cipher",fe.errors.UNSUPPORTED_OPERATION,{operation:"decrypt"});let o=e.slice(32,64),s=ol(n);if(t.address){let c=t.address.toLowerCase();if(c.substring(0,2)!=="0x"&&(c="0x"+c),$r(c)!==s)throw new Error("address mismatch")}let a={_isKeystoreAccount:!0,address:s,privateKey:De(n)};if(_n(t,"x-ethers/version")==="0.1"){let c=mh(_n(t,"x-ethers/mnemonicCiphertext")),h=mh(_n(t,"x-ethers/mnemonicCounter")),g=new gh.default.Counter(h),b=new gh.default.ModeOfOperation.ctr(o,g),E=_n(t,"x-ethers/path")||ph,A=_n(t,"x-ethers/locale")||"en",T=ke(b.decrypt(c));try{let P=Fm(T,A),L=Rf.fromMnemonic(P,null,A).derivePath(E);if(L.privateKey!=a.privateKey)throw new Error("mnemonic mismatch");a.mnemonic=L.mnemonic}catch(P){if(P.code!==fe.errors.INVALID_ARGUMENT||P.argument!=="wordlist")throw P}}return new WD(a)}function H0e(t,e,r,i,n){return ke(Bm(t,e,r,i,n))}function gze(t,e,r,i,n){return Promise.resolve(H0e(t,e,r,i,n))}function z0e(t,e,r,i,n){let o=S5(e),s=_n(t,"crypto/kdf");if(s&&typeof s=="string"){let a=function(c,h){return $D.throwArgumentError("invalid key-derivation function parameters",c,h)};if(s.toLowerCase()==="scrypt"){let c=mh(_n(t,"crypto/kdfparams/salt")),h=parseInt(_n(t,"crypto/kdfparams/n")),g=parseInt(_n(t,"crypto/kdfparams/r")),b=parseInt(_n(t,"crypto/kdfparams/p"));(!h||!g||!b)&&a("kdf",s),(h&h-1)!==0&&a("N",h);let E=parseInt(_n(t,"crypto/kdfparams/dklen"));return E!==32&&a("dklen",E),i(o,c,h,g,b,64,n)}else if(s.toLowerCase()==="pbkdf2"){let c=mh(_n(t,"crypto/kdfparams/salt")),h=null,g=_n(t,"crypto/kdfparams/prf");g==="hmac-sha256"?h="sha256":g==="hmac-sha512"?h="sha512":a("prf",g);let b=parseInt(_n(t,"crypto/kdfparams/c")),E=parseInt(_n(t,"crypto/kdfparams/dklen"));return E!==32&&a("dklen",E),r(o,c,b,E,h)}}return $D.throwArgumentError("unsupported key-derivation function","kdf",s)}function V0e(t,e){let r=JSON.parse(t),i=z0e(r,e,H0e,Q_.default.syncScrypt);return q0e(r,i)}function K0e(t,e,r){return pze(this,void 0,void 0,function*(){let i=JSON.parse(t),n=yield z0e(i,e,gze,Q_.default.scrypt,r);return q0e(i,n)})}function qD(t,e,r,i){try{if($r(t.address)!==ol(t.privateKey))throw new Error("address/privateKey mismatch");if(W0e(t)){let L=t.mnemonic;if(Rf.fromMnemonic(L.phrase,null,L.locale).derivePath(L.path||ph).privateKey!=t.privateKey)throw new Error("mnemonic mismatch")}}catch(L){return Promise.reject(L)}typeof r=="function"&&!i&&(i=r,r={}),r||(r={});let n=ke(t.privateKey),o=S5(e),s=null,a=null,c=null;if(W0e(t)){let L=t.mnemonic;s=ke(s3(L.phrase,L.locale||"en")),a=L.path||ph,c=L.locale||"en"}let h=r.client;h||(h="ethers.js");let g=null;r.salt?g=ke(r.salt):g=kf(32);let b=null;if(r.iv){if(b=ke(r.iv),b.length!==16)throw new Error("invalid iv")}else b=kf(16);let E=null;if(r.uuid){if(E=ke(r.uuid),E.length!==16)throw new Error("invalid uuid")}else E=kf(16);let A=1<<17,T=8,P=1;return r.scrypt&&(r.scrypt.N&&(A=r.scrypt.N),r.scrypt.r&&(T=r.scrypt.r),r.scrypt.p&&(P=r.scrypt.p)),Q_.default.scrypt(o,g,A,T,P,64,i).then(L=>{L=ke(L);let j=L.slice(0,16),$=L.slice(16,32),G=L.slice(32,64),Z=new gh.default.Counter(b),te=new gh.default.ModeOfOperation.ctr(j,Z),se=ke(te.encrypt(n)),X=jr(Fr([$,se])),k={address:t.address.substring(2).toLowerCase(),id:F0e(E),version:3,crypto:{cipher:"aes-128-ctr",cipherparams:{iv:De(b).substring(2)},ciphertext:De(se).substring(2),kdf:"scrypt",kdfparams:{salt:De(g).substring(2),n:A,dklen:32,p:P,r:T},mac:X.substring(2)}};if(s){let F=kf(16),V=new gh.default.Counter(F),M=new gh.default.ModeOfOperation.ctr(G,V),B=ke(M.encrypt(s)),u=new Date,f=u.getUTCFullYear()+"-"+a3(u.getUTCMonth()+1,2)+"-"+a3(u.getUTCDate(),2)+"T"+a3(u.getUTCHours(),2)+"-"+a3(u.getUTCMinutes(),2)+"-"+a3(u.getUTCSeconds(),2)+".0Z";k["x-ethers"]={client:h,gethFilename:"UTC--"+f+"--"+k.address,mnemonicCounter:De(F).substring(2),mnemonicCiphertext:De(B).substring(2),path:a,locale:c,version:"0.1"}}return JSON.stringify(k)})}function G0e(t,e,r){if(Y_(t)){r&&r(0);let i=UD(t,e);return r&&r(1),Promise.resolve(i)}return J_(t)?K0e(t,e,r):Promise.reject(new Error("invalid JSON wallet"))}function Z0e(t,e){if(Y_(t))return UD(t,e);if(J_(t))return V0e(t,e);throw new Error("invalid JSON wallet")}var Y0e="wallet/5.7.0";var J0e=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},c3=new fe(Y0e);function wze(t){return t!=null&&Zt(t.privateKey,32)&&t.address!=null}function vze(t){let e=t.mnemonic;return e&&e.phrase}var I5=class t extends rc{constructor(e,r){if(super(),wze(e)){let i=new nl(e.privateKey);if(ye(this,"_signingKey",()=>i),ye(this,"address",ol(this.publicKey)),this.address!==$r(e.address)&&c3.throwArgumentError("privateKey/address mismatch","privateKey","[REDACTED]"),vze(e)){let n=e.mnemonic;ye(this,"_mnemonic",()=>({phrase:n.phrase,path:n.path||ph,locale:n.locale||"en"}));let o=this.mnemonic,s=Rf.fromMnemonic(o.phrase,null,o.locale).derivePath(o.path);ol(s.privateKey)!==this.address&&c3.throwArgumentError("mnemonic/address mismatch","privateKey","[REDACTED]")}else ye(this,"_mnemonic",()=>null)}else{if(nl.isSigningKey(e))e.curve!=="secp256k1"&&c3.throwArgumentError("unsupported curve; must be secp256k1","privateKey","[REDACTED]"),ye(this,"_signingKey",()=>e);else{typeof e=="string"&&e.match(/^[0-9a-f]*$/i)&&e.length===64&&(e="0x"+e);let i=new nl(e);ye(this,"_signingKey",()=>i)}ye(this,"_mnemonic",()=>null),ye(this,"address",ol(this.publicKey))}r&&!Xc.isProvider(r)&&c3.throwArgumentError("invalid provider","provider",r),ye(this,"provider",r||null)}get mnemonic(){return this._mnemonic()}get privateKey(){return this._signingKey().privateKey}get publicKey(){return this._signingKey().publicKey}getAddress(){return Promise.resolve(this.address)}connect(e){return new t(this,e)}signTransaction(e){return $i(e).then(r=>{r.from!=null&&($r(r.from)!==this.address&&c3.throwArgumentError("transaction from address mismatch","transaction.from",e.from),delete r.from);let i=this._signingKey().signDigest(jr(b5(r)));return b5(r,i)})}signMessage(e){return J0e(this,void 0,void 0,function*(){return i5(this._signingKey().signDigest(zw(e)))})}_signTypedData(e,r,i){return J0e(this,void 0,void 0,function*(){let n=yield Qc.resolveNames(e,r,i,o=>(this.provider==null&&c3.throwError("cannot resolve ENS names without a provider",fe.errors.UNSUPPORTED_OPERATION,{operation:"resolveName",value:o}),this.provider.resolveName(o)));return i5(this._signingKey().signDigest(Qc.hash(n.domain,r,n.value)))})}encrypt(e,r,i){if(typeof r=="function"&&!i&&(i=r,r={}),i&&typeof i!="function")throw new Error("invalid callback");return r||(r={}),qD(this,e,r,i)}static createRandom(e){let r=kf(16);e||(e={}),e.extraEntropy&&(r=ke(ji(jr(Fr([r,e.extraEntropy])),0,16)));let i=Fm(r,e.locale);return t.fromMnemonic(i,e.path,e.locale)}static fromEncryptedJson(e,r,i){return G0e(e,r,i).then(n=>new t(n))}static fromEncryptedJsonSync(e,r){return new t(Z0e(e,r))}static fromMnemonic(e,r,i){return r||(r=ph),new t(Rf.fromMnemonic(e,null,i).derivePath(r))}};function Q0e(t,e){return Mm(zw(t),e)}function X0e(t,e,r,i){return Mm(Qc.hash(t,e,r),i)}var mE={};Mi(mE,{AlchemyProvider:()=>p3,AlchemyWebSocketProvider:()=>U5,AnkrProvider:()=>F5,BaseProvider:()=>Pf,CloudflareProvider:()=>j5,EtherscanProvider:()=>$5,FallbackProvider:()=>q5,Formatter:()=>jm,InfuraProvider:()=>g3,InfuraWebSocketProvider:()=>z5,IpcProvider:()=>rL,JsonRpcBatchProvider:()=>dE,JsonRpcProvider:()=>ma,JsonRpcSigner:()=>h3,NodesmithProvider:()=>V5,PocketProvider:()=>K5,Provider:()=>Xc,Resolver:()=>f3,StaticJsonRpcProvider:()=>B5,UrlJsonRpcProvider:()=>bs,Web3Provider:()=>G5,WebSocketProvider:()=>bh,getDefaultProvider:()=>pE,getNetwork:()=>T5,isCommunityResourcable:()=>VD,isCommunityResource:()=>N5,showThrottleMessage:()=>Nf});var ehe="networks/5.7.1";var the=new fe(ehe);function bze(t){return t&&typeof t.renetwork=="function"}function wh(t){let e=function(r,i){i==null&&(i={});let n=[];if(r.InfuraProvider&&i.infura!=="-")try{n.push(new r.InfuraProvider(t,i.infura))}catch{}if(r.EtherscanProvider&&i.etherscan!=="-")try{n.push(new r.EtherscanProvider(t,i.etherscan))}catch{}if(r.AlchemyProvider&&i.alchemy!=="-")try{n.push(new r.AlchemyProvider(t,i.alchemy))}catch{}if(r.PocketProvider&&i.pocket!=="-"){let o=["goerli","ropsten","rinkeby","sepolia"];try{let s=new r.PocketProvider(t,i.pocket);s.network&&o.indexOf(s.network.name)===-1&&n.push(s)}catch{}}if(r.CloudflareProvider&&i.cloudflare!=="-")try{n.push(new r.CloudflareProvider(t))}catch{}if(r.AnkrProvider&&i.ankr!=="-")try{let o=["ropsten"],s=new r.AnkrProvider(t,i.ankr);s.network&&o.indexOf(s.network.name)===-1&&n.push(s)}catch{}if(n.length===0)return null;if(r.FallbackProvider){let o=1;return i.quorum!=null?o=i.quorum:t==="homestead"&&(o=2),new r.FallbackProvider(n,o)}return n[0]};return e.renetwork=function(r){return wh(r)},e}function eE(t,e){let r=function(i,n){return i.JsonRpcProvider?new i.JsonRpcProvider(t,e):null};return r.renetwork=function(i){return eE(t,i)},r}var rhe={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:wh("homestead")},ihe={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:wh("ropsten")},nhe={chainId:63,name:"classicMordor",_defaultProvider:eE("https://www.ethercluster.com/mordor","classicMordor")},X_={unspecified:{chainId:0,name:"unspecified"},homestead:rhe,mainnet:rhe,morden:{chainId:2,name:"morden"},ropsten:ihe,testnet:ihe,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:wh("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:wh("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:wh("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:wh("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:eE("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:nhe,classicTestnet:nhe,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:eE("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:wh("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:wh("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function T5(t){if(t==null)return null;if(typeof t=="number"){for(let i in X_){let n=X_[i];if(n.chainId===t)return{name:n.name,chainId:n.chainId,ensAddress:n.ensAddress||null,_defaultProvider:n._defaultProvider||null}}return{chainId:t,name:"unknown"}}if(typeof t=="string"){let i=X_[t];return i==null?null:{name:i.name,chainId:i.chainId,ensAddress:i.ensAddress,_defaultProvider:i._defaultProvider||null}}let e=X_[t.name];if(!e)return typeof t.chainId!="number"&&the.throwArgumentError("invalid network chainId","network",t),t;t.chainId!==0&&t.chainId!==e.chainId&&the.throwArgumentError("network chainId mismatch","network",t);let r=t._defaultProvider||null;return r==null&&e._defaultProvider&&(bze(e._defaultProvider)?r=e._defaultProvider.renetwork(t):r=e._defaultProvider),{name:t.name,chainId:e.chainId,ensAddress:t.ensAddress||e.ensAddress||null,_defaultProvider:r}}var ohe="web/5.7.1";var yze=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})};function she(t,e){return yze(this,void 0,void 0,function*(){e==null&&(e={});let r={method:e.method||"GET",headers:e.headers||{},body:e.body||void 0};if(e.skipFetchSetup!==!0&&(r.mode="cors",r.cache="no-cache",r.credentials="same-origin",r.redirect="follow",r.referrer="client"),e.fetchOptions!=null){let s=e.fetchOptions;s.mode&&(r.mode=s.mode),s.cache&&(r.cache=s.cache),s.credentials&&(r.credentials=s.credentials),s.redirect&&(r.redirect=s.redirect),s.referrer&&(r.referrer=s.referrer)}let i=yield fetch(t,r),n=yield i.arrayBuffer(),o={};return i.headers.forEach?i.headers.forEach((s,a)=>{o[a.toLowerCase()]=s}):i.headers.keys().forEach(s=>{o[s.toLowerCase()]=i.headers.get(s)}),{headers:o,statusCode:i.status,statusMessage:i.statusText,body:ke(new Uint8Array(n))}})}var xze=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},Yl=new fe(ohe);function ahe(t){return new Promise(e=>{setTimeout(e,t)})}function lp(t,e){if(t==null)return null;if(typeof t=="string")return t;if(nh(t)){if(e&&(e.split("/")[0]==="text"||e.split(";")[0].trim()==="application/json"))try{return ha(t)}catch{}return De(t)}return t}function _ze(t){return fi(t.replace(/%([0-9a-f][0-9a-f])/gi,(e,r)=>String.fromCharCode(parseInt(r,16))))}function HD(t,e,r){let i=typeof t=="object"&&t.throttleLimit!=null?t.throttleLimit:12;Yl.assertArgument(i>0&&i%1===0,"invalid connection throttle limit","connection.throttleLimit",i);let n=typeof t=="object"?t.throttleCallback:null,o=typeof t=="object"&&typeof t.throttleSlotInterval=="number"?t.throttleSlotInterval:100;Yl.assertArgument(o>0&&o%1===0,"invalid connection throttle slot interval","connection.throttleSlotInterval",o);let s=typeof t=="object"?!!t.errorPassThrough:!1,a={},c=null,h={method:"GET"},g=!1,b=2*60*1e3;if(typeof t=="string")c=t;else if(typeof t=="object"){if((t==null||t.url==null)&&Yl.throwArgumentError("missing URL","connection.url",t),c=t.url,typeof t.timeout=="number"&&t.timeout>0&&(b=t.timeout),t.headers)for(let j in t.headers)a[j.toLowerCase()]={key:j,value:String(t.headers[j])},["if-none-match","if-modified-since"].indexOf(j.toLowerCase())>=0&&(g=!0);if(h.allowGzip=!!t.allowGzip,t.user!=null&&t.password!=null){c.substring(0,6)!=="https:"&&t.allowInsecureAuthentication!==!0&&Yl.throwError("basic authentication requires a secure https url",fe.errors.INVALID_ARGUMENT,{argument:"url",url:c,user:t.user,password:"[REDACTED]"});let j=t.user+":"+t.password;a.authorization={key:"Authorization",value:"Basic "+Hw(fi(j))}}t.skipFetchSetup!=null&&(h.skipFetchSetup=!!t.skipFetchSetup),t.fetchOptions!=null&&(h.fetchOptions=pi(t.fetchOptions))}let E=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),A=c?c.match(E):null;if(A)try{let j={statusCode:200,statusMessage:"OK",headers:{"content-type":A[1]||"text/plain"},body:A[2]?qw(A[3]):_ze(A[3])},$=j.body;return r&&($=r(j.body,j)),Promise.resolve($)}catch(j){Yl.throwError("processing response error",fe.errors.SERVER_ERROR,{body:lp(A[1],A[2]),error:j,requestBody:null,requestMethod:"GET",url:c})}e&&(h.method="POST",h.body=e,a["content-type"]==null&&(a["content-type"]={key:"Content-Type",value:"application/octet-stream"}),a["content-length"]==null&&(a["content-length"]={key:"Content-Length",value:String(e.length)}));let T={};Object.keys(a).forEach(j=>{let $=a[j];T[$.key]=$.value}),h.headers=T;let P=function(){let j=null;return{promise:new Promise(function(Z,te){b&&(j=setTimeout(()=>{j!=null&&(j=null,te(Yl.makeError("timeout",fe.errors.TIMEOUT,{requestBody:lp(h.body,T["content-type"]),requestMethod:h.method,timeout:b,url:c})))},b))}),cancel:function(){j!=null&&(clearTimeout(j),j=null)}}}(),L=function(){return xze(this,void 0,void 0,function*(){for(let j=0;j<i;j++){let $=null;try{if($=yield she(c,h),j<i){if($.statusCode===301||$.statusCode===302){let Z=$.headers.location||"";if(h.method==="GET"&&Z.match(/^https:/)){c=$.headers.location;continue}}else if($.statusCode===429){let Z=!0;if(n&&(Z=yield n(j,c)),Z){let te=0,se=$.headers["retry-after"];typeof se=="string"&&se.match(/^[1-9][0-9]*$/)?te=parseInt(se)*1e3:te=o*parseInt(String(Math.random()*Math.pow(2,j))),yield ahe(te);continue}}}}catch(Z){$=Z.response,$==null&&(P.cancel(),Yl.throwError("missing response",fe.errors.SERVER_ERROR,{requestBody:lp(h.body,T["content-type"]),requestMethod:h.method,serverError:Z,url:c}))}let G=$.body;if(g&&$.statusCode===304?G=null:!s&&($.statusCode<200||$.statusCode>=300)&&(P.cancel(),Yl.throwError("bad response",fe.errors.SERVER_ERROR,{status:$.statusCode,headers:$.headers,body:lp(G,$.headers?$.headers["content-type"]:null),requestBody:lp(h.body,T["content-type"]),requestMethod:h.method,url:c})),r)try{let Z=yield r(G,$);return P.cancel(),Z}catch(Z){if(Z.throttleRetry&&j<i){let te=!0;if(n&&(te=yield n(j,c)),te){let se=o*parseInt(String(Math.random()*Math.pow(2,j)));yield ahe(se);continue}}P.cancel(),Yl.throwError("processing response error",fe.errors.SERVER_ERROR,{body:lp(G,$.headers?$.headers["content-type"]:null),error:Z,requestBody:lp(h.body,T["content-type"]),requestMethod:h.method,url:c})}return P.cancel(),G}return Yl.throwError("failed response",fe.errors.SERVER_ERROR,{requestBody:lp(h.body,T["content-type"]),requestMethod:h.method,url:c})})}();return Promise.race([P.promise,L])}function Jl(t,e,r){let i=(o,s)=>{let a=null;if(o!=null)try{a=JSON.parse(ha(o))}catch(c){Yl.throwError("invalid JSON",fe.errors.SERVER_ERROR,{body:o,error:c})}return r&&(a=r(a,s)),a},n=null;if(e!=null){n=fi(e);let o=typeof t=="string"?{url:t}:pi(t);o.headers?Object.keys(o.headers).filter(a=>a.toLowerCase()==="content-type").length!==0||(o.headers=pi(o.headers),o.headers["content-type"]="application/json"):o.headers={"content-type":"application/json"},t=o}return HD(t,n,i)}function Ql(t,e){return e||(e={}),e=pi(e),e.floor==null&&(e.floor=0),e.ceiling==null&&(e.ceiling=1e4),e.interval==null&&(e.interval=250),new Promise(function(r,i){let n=null,o=!1,s=()=>o?!1:(o=!0,n&&clearTimeout(n),!0);e.timeout&&(n=setTimeout(()=>{s()&&i(new Error("timeout"))},e.timeout));let a=e.retryLimit,c=0;function h(){return t().then(function(g){if(g!==void 0)s()&&r(g);else if(e.oncePoll)e.oncePoll.once("poll",h);else if(e.onceBlock)e.onceBlock.once("block",h);else if(!o){if(c++,c>a){s()&&i(new Error("retry limit reached"));return}let b=e.interval*parseInt(String(Math.random()*Math.pow(2,c)));b<e.floor&&(b=e.floor),b>e.ceiling&&(b=e.ceiling),setTimeout(h,b)}return null},function(g){s()&&i(g)})}h()})}var YD=Wt(fhe());var Si="providers/5.7.2";var k5=new fe(Si),jm=class t{constructor(){this.formats=this.getDefaultFormats()}getDefaultFormats(){let e={},r=this.address.bind(this),i=this.bigNumber.bind(this),n=this.blockTag.bind(this),o=this.data.bind(this),s=this.hash.bind(this),a=this.hex.bind(this),c=this.number.bind(this),h=this.type.bind(this),g=b=>this.data(b,!0);return e.transaction={hash:s,type:h,accessList:t.allowNull(this.accessList.bind(this),null),blockHash:t.allowNull(s,null),blockNumber:t.allowNull(c,null),transactionIndex:t.allowNull(c,null),confirmations:t.allowNull(c,null),from:r,gasPrice:t.allowNull(i),maxPriorityFeePerGas:t.allowNull(i),maxFeePerGas:t.allowNull(i),gasLimit:i,to:t.allowNull(r,null),value:i,nonce:c,data:o,r:t.allowNull(this.uint256),s:t.allowNull(this.uint256),v:t.allowNull(c),creates:t.allowNull(r,null),raw:t.allowNull(o)},e.transactionRequest={from:t.allowNull(r),nonce:t.allowNull(c),gasLimit:t.allowNull(i),gasPrice:t.allowNull(i),maxPriorityFeePerGas:t.allowNull(i),maxFeePerGas:t.allowNull(i),to:t.allowNull(r),value:t.allowNull(i),data:t.allowNull(g),type:t.allowNull(c),accessList:t.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:c,blockNumber:c,transactionHash:s,address:r,topics:t.arrayOf(s),data:o,logIndex:c,blockHash:s},e.receipt={to:t.allowNull(this.address,null),from:t.allowNull(this.address,null),contractAddress:t.allowNull(r,null),transactionIndex:c,root:t.allowNull(a),gasUsed:i,logsBloom:t.allowNull(o),blockHash:s,transactionHash:s,logs:t.arrayOf(this.receiptLog.bind(this)),blockNumber:c,confirmations:t.allowNull(c,null),cumulativeGasUsed:i,effectiveGasPrice:t.allowNull(i),status:t.allowNull(c),type:h},e.block={hash:t.allowNull(s),parentHash:s,number:c,timestamp:c,nonce:t.allowNull(a),difficulty:this.difficulty.bind(this),gasLimit:i,gasUsed:i,miner:t.allowNull(r),extraData:o,transactions:t.allowNull(t.arrayOf(s)),baseFeePerGas:t.allowNull(i)},e.blockWithTransactions=pi(e.block),e.blockWithTransactions.transactions=t.allowNull(t.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:t.allowNull(n,void 0),toBlock:t.allowNull(n,void 0),blockHash:t.allowNull(s,void 0),address:t.allowNull(r,void 0),topics:t.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:t.allowNull(c),blockHash:t.allowNull(s),transactionIndex:c,removed:t.allowNull(this.boolean.bind(this)),address:r,data:t.allowFalsish(o,"0x"),topics:t.arrayOf(s),transactionHash:s,logIndex:c},e}accessList(e){return sc(e||[])}number(e){return e==="0x"?0:Ue.from(e).toNumber()}type(e){return e==="0x"||e==null?0:Ue.from(e).toNumber()}bigNumber(e){return Ue.from(e)}boolean(e){if(typeof e=="boolean")return e;if(typeof e=="string"){if(e=e.toLowerCase(),e==="true")return!0;if(e==="false")return!1}throw new Error("invalid boolean - "+e)}hex(e,r){return typeof e=="string"&&(!r&&e.substring(0,2)!=="0x"&&(e="0x"+e),Zt(e))?e.toLowerCase():k5.throwArgumentError("invalid hash","value",e)}data(e,r){let i=this.hex(e,r);if(i.length%2!==0)throw new Error("invalid data; odd-length - "+e);return i}address(e){return $r(e)}callAddress(e){if(!Zt(e,32))return null;let r=$r(ji(e,12));return r===v_?null:r}contractAddress(e){return Rm(e)}blockTag(e){if(e==null)return"latest";if(e==="earliest")return"0x0";switch(e){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return e}if(typeof e=="number"||Zt(e))return hf(e);throw new Error("invalid blockTag")}hash(e,r){let i=this.hex(e,r);return ps(i)!==32?k5.throwArgumentError("invalid hash","value",e):i}difficulty(e){if(e==null)return null;let r=Ue.from(e);try{return r.toNumber()}catch{}return null}uint256(e){if(!Zt(e))throw new Error("invalid uint256");return Kr(e,32)}_block(e,r){e.author!=null&&e.miner==null&&(e.miner=e.author);let i=e._difficulty!=null?e._difficulty:e.difficulty,n=t.check(r,e);return n._difficulty=i==null?null:Ue.from(i),n}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return t.check(this.formats.transactionRequest,e)}transactionResponse(e){e.gas!=null&&e.gasLimit==null&&(e.gasLimit=e.gas),e.to&&Ue.from(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),e.input!=null&&e.data==null&&(e.data=e.input),e.to==null&&e.creates==null&&(e.creates=this.contractAddress(e)),(e.type===1||e.type===2)&&e.accessList==null&&(e.accessList=[]);let r=t.check(this.formats.transaction,e);if(e.chainId!=null){let i=e.chainId;Zt(i)&&(i=Ue.from(i).toNumber()),r.chainId=i}else{let i=e.networkId;i==null&&r.v==null&&(i=e.chainId),Zt(i)&&(i=Ue.from(i).toNumber()),typeof i!="number"&&r.v!=null&&(i=(r.v-35)/2,i<0&&(i=0),i=parseInt(i)),typeof i!="number"&&(i=0),r.chainId=i}return r.blockHash&&r.blockHash.replace(/0/g,"")==="x"&&(r.blockHash=null),r}transaction(e){return $_(e)}receiptLog(e){return t.check(this.formats.receiptLog,e)}receipt(e){let r=t.check(this.formats.receipt,e);if(r.root!=null)if(r.root.length<=4){let i=Ue.from(r.root).toNumber();i===0||i===1?(r.status!=null&&r.status!==i&&k5.throwArgumentError("alt-root-status/status mismatch","value",{root:r.root,status:r.status}),r.status=i,delete r.root):k5.throwArgumentError("invalid alt-root-status","value.root",r.root)}else r.root.length!==66&&k5.throwArgumentError("invalid root hash","value.root",r.root);return r.status!=null&&(r.byzantium=!0),r}topics(e){return Array.isArray(e)?e.map(r=>this.topics(r)):e!=null?this.hash(e,!0):null}filter(e){return t.check(this.formats.filter,e)}filterLog(e){return t.check(this.formats.filterLog,e)}static check(e,r){let i={};for(let n in e)try{let o=e[n](r[n]);o!==void 0&&(i[n]=o)}catch(o){throw o.checkKey=n,o.checkValue=r[n],o}return i}static allowNull(e,r){return function(i){return i==null?r:e(i)}}static allowFalsish(e,r){return function(i){return i?e(i):r}}static arrayOf(e){return function(r){if(!Array.isArray(r))throw new Error("not an array");let i=[];return r.forEach(function(n){i.push(e(n))}),i}}};function VD(t){return t&&typeof t.isCommunityResource=="function"}function N5(t){return VD(t)&&t.isCommunityResource()}var hhe=!1;function Nf(){hhe||(hhe=!0,console.log("========= NOTICE ========="),console.log("Request-Rate Exceeded (this message will not be repeated)"),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.io/api-keys/"),console.log("=========================="))}var Er=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},Gr=new fe(Si),kze=10;function dhe(t){return t==null?"null":(ps(t)!==32&&Gr.throwArgumentError("invalid topic","topic",t),t.toLowerCase())}function phe(t){for(t=t.slice();t.length>0&&t[t.length-1]==null;)t.pop();return t.map(e=>{if(Array.isArray(e)){let r={};e.forEach(n=>{r[dhe(n)]=!0});let i=Object.keys(r);return i.sort(),i.join("|")}else return dhe(e)}).join("&")}function Nze(t){return t===""?[]:t.split(/&/g).map(e=>{if(e==="")return[];let r=e.split("|").map(i=>i==="null"?null:i);return r.length===1?r[0]:r})}function u3(t){if(typeof t=="string"){if(t=t.toLowerCase(),ps(t)===32)return"tx:"+t;if(t.indexOf(":")===-1)return t}else{if(Array.isArray(t))return"filter:*:"+phe(t);if(k_.isForkEvent(t))throw Gr.warn("not implemented"),new Error("not implemented");if(t&&typeof t=="object")return"filter:"+(t.address||"*")+":"+phe(t.topics||[])}throw new Error("invalid event - "+t)}function P5(){return new Date().getTime()}function mhe(t){return new Promise(e=>{setTimeout(e,t)})}var Pze=["block","network","pending","poll"],JD=class{constructor(e,r,i){ye(this,"tag",e),ye(this,"listener",r),ye(this,"once",i),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){let e=this.tag.split(":");return e[0]!=="tx"?null:e[1]}get filter(){let e=this.tag.split(":");if(e[0]!=="filter")return null;let r=e[1],i=Nze(e[2]),n={};return i.length>0&&(n.topics=i),r&&r!=="*"&&(n.address=r),n}pollable(){return this.tag.indexOf(":")>=0||Pze.indexOf(this.tag)>=0}},Oze={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function KD(t){return Kr(Ue.from(t).toHexString(),32)}function ghe(t){return hh.encode(Fr([t,ji(pa(pa(t)),0,4)]))}var bhe=new RegExp("^(ipfs)://(.*)$","i"),whe=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),bhe,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function nE(t,e){try{return ha(O5(t,e))}catch{}return null}function O5(t,e){if(t==="0x")return null;let r=Ue.from(ji(t,e,e+32)).toNumber(),i=Ue.from(ji(t,r,r+32)).toNumber();return ji(t,r+32,r+32+i)}function GD(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):Gr.throwArgumentError("unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}function vhe(t){let e=ke(t);if(e.length>32)throw new Error("internal; should not happen");let r=new Uint8Array(32);return r.set(e,32-e.length),r}function Mze(t){if(t.length%32===0)return t;let e=new Uint8Array(Math.ceil(t.length/32)*32);return e.set(t),e}function yhe(t){let e=[],r=0;for(let i=0;i<t.length;i++)e.push(null),r+=32;for(let i=0;i<t.length;i++){let n=ke(t[i]);e[i]=vhe(r),e.push(vhe(n.length)),e.push(Mze(n)),r+=32+Math.ceil(n.length/32)*32}return Vn(e)}var f3=class{constructor(e,r,i,n){ye(this,"provider",e),ye(this,"name",i),ye(this,"address",e.formatter.address(r)),ye(this,"_resolvedAddress",n)}supportsWildcard(){return this._supportsEip2544||(this._supportsEip2544=this.provider.call({to:this.address,data:"0x01ffc9a79061b92300000000000000000000000000000000000000000000000000000000"}).then(e=>Ue.from(e).eq(1)).catch(e=>{if(e.code===fe.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e})),this._supportsEip2544}_fetch(e,r){return Er(this,void 0,void 0,function*(){let i={to:this.address,ccipReadEnabled:!0,data:Vn([e,ip(this.name),r||"0x"])},n=!1;(yield this.supportsWildcard())&&(n=!0,i.data=Vn(["0x9061b923",yhe([m5(this.name),i.data])]));try{let o=yield this.provider.call(i);return ke(o).length%32===4&&Gr.throwError("resolver threw error",fe.errors.CALL_EXCEPTION,{transaction:i,data:o}),n&&(o=O5(o,0)),o}catch(o){if(o.code===fe.errors.CALL_EXCEPTION)return null;throw o}})}_fetchBytes(e,r){return Er(this,void 0,void 0,function*(){let i=yield this._fetch(e,r);return i!=null?O5(i,0):null})}_getAddress(e,r){let i=Oze[String(e)];if(i==null&&Gr.throwError(`unsupported coin type: ${e}`,fe.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),i.ilk==="eth")return this.provider.formatter.address(r);let n=ke(r);if(i.p2pkh!=null){let o=r.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(o){let s=parseInt(o[1],16);if(o[2].length===s*2&&s>=1&&s<=75)return ghe(Fr([[i.p2pkh],"0x"+o[2]]))}}if(i.p2sh!=null){let o=r.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(o){let s=parseInt(o[1],16);if(o[2].length===s*2&&s>=1&&s<=75)return ghe(Fr([[i.p2sh],"0x"+o[2]]))}}if(i.prefix!=null){let o=n[1],s=n[0];if(s===0?o!==20&&o!==32&&(s=-1):s=-1,s>=0&&n.length===2+o&&o>=1&&o<=75){let a=YD.default.toWords(n.slice(2));return a.unshift(s),YD.default.encode(i.prefix,a)}}return null}getAddress(e){return Er(this,void 0,void 0,function*(){if(e==null&&(e=60),e===60)try{let n=yield this._fetch("0x3b3b57de");return n==="0x"||n===$w?null:this.provider.formatter.callAddress(n)}catch(n){if(n.code===fe.errors.CALL_EXCEPTION)return null;throw n}let r=yield this._fetchBytes("0xf1cb7e06",KD(e));if(r==null||r==="0x")return null;let i=this._getAddress(e,r);return i==null&&Gr.throwError("invalid or unsupported coin data",fe.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:r}),i})}getAvatar(){return Er(this,void 0,void 0,function*(){let e=[{type:"name",content:this.name}];try{let r=yield this.getText("avatar");if(r==null)return null;for(let i=0;i<whe.length;i++){let n=r.match(whe[i]);if(n==null)continue;let o=n[1].toLowerCase();switch(o){case"https":return e.push({type:"url",content:r}),{linkage:e,url:r};case"data":return e.push({type:"data",content:r}),{linkage:e,url:r};case"ipfs":return e.push({type:"ipfs",content:r}),{linkage:e,url:GD(r)};case"erc721":case"erc1155":{let s=o==="erc721"?"0xc87b56dd":"0x0e89341c";e.push({type:o,content:r});let a=this._resolvedAddress||(yield this.getAddress()),c=(n[2]||"").split("/");if(c.length!==2)return null;let h=yield this.provider.formatter.address(c[0]),g=Kr(Ue.from(c[1]).toHexString(),32);if(o==="erc721"){let P=this.provider.formatter.callAddress(yield this.provider.call({to:h,data:Vn(["0x6352211e",g])}));if(a!==P)return null;e.push({type:"owner",content:P})}else if(o==="erc1155"){let P=Ue.from(yield this.provider.call({to:h,data:Vn(["0x00fdd58e",Kr(a,32),g])}));if(P.isZero())return null;e.push({type:"balance",content:P.toString()})}let b={to:this.provider.formatter.address(c[0]),data:Vn([s,g])},E=nE(yield this.provider.call(b),0);if(E==null)return null;e.push({type:"metadata-url-base",content:E}),o==="erc1155"&&(E=E.replace("{id}",g.substring(2)),e.push({type:"metadata-url-expanded",content:E})),E.match(/^ipfs:/i)&&(E=GD(E)),e.push({type:"metadata-url",content:E});let A=yield Jl(E);if(!A)return null;e.push({type:"metadata",content:JSON.stringify(A)});let T=A.image;if(typeof T!="string")return null;if(!T.match(/^(https:\/\/|data:)/i)){if(T.match(bhe)==null)return null;e.push({type:"url-ipfs",content:T}),T=GD(T)}return e.push({type:"url",content:T}),{linkage:e,url:T}}}}}catch{}return null})}getContentHash(){return Er(this,void 0,void 0,function*(){let e=yield this._fetchBytes("0xbc1c58d1");if(e==null||e==="0x")return null;let r=e.match(/^0xe3010170(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(r){let s=parseInt(r[3],16);if(r[4].length===s*2)return"ipfs://"+hh.encode("0x"+r[1])}let i=e.match(/^0xe5010172(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(i){let s=parseInt(i[3],16);if(i[4].length===s*2)return"ipns://"+hh.encode("0x"+i[1])}let n=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(n&&n[1].length===32*2)return"bzz://"+n[1];let o=e.match(/^0x90b2c605([0-9a-f]*)$/);if(o&&o[1].length===34*2){let s={"=":"","+":"-","/":"_"};return"sia://"+Hw("0x"+o[1]).replace(/[=+\/]/g,c=>s[c])}return Gr.throwError("invalid or unsupported content hash data",fe.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})})}getText(e){return Er(this,void 0,void 0,function*(){let r=fi(e);r=Fr([KD(64),KD(r.length),r]),r.length%32!==0&&(r=Fr([r,Kr("0x",32-e.length%32)]));let i=yield this._fetchBytes("0x59d1d43c",De(r));return i==null||i==="0x"?null:ha(i)})}},ZD=null,Dze=1,Pf=class extends Xc{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),ye(this,"anyNetwork",e==="any"),this.anyNetwork&&(e=this.detectNetwork()),e instanceof Promise)this._networkPromise=e,e.catch(r=>{}),this._ready().catch(r=>{});else{let r=bn(new.target,"getNetwork")(e);r?(ye(this,"_network",r),this.emit("network",r,null)):Gr.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return Er(this,void 0,void 0,function*(){if(this._network==null){let e=null;if(this._networkPromise)try{e=yield this._networkPromise}catch{}e==null&&(e=yield this.detectNetwork()),e||Gr.throwError("no network detected",fe.errors.UNKNOWN_ERROR,{}),this._network==null&&(this.anyNetwork?this._network=e:ye(this,"_network",e),this.emit("network",e,null))}return this._network})}get ready(){return Ql(()=>this._ready().then(e=>e,e=>{if(!(e.code===fe.errors.NETWORK_ERROR&&e.event==="noNetwork"))throw e}))}static getFormatter(){return ZD==null&&(ZD=new jm),ZD}static getNetwork(e){return T5(e??"homestead")}ccipReadFetch(e,r,i){return Er(this,void 0,void 0,function*(){if(this.disableCcipRead||i.length===0)return null;let n=e.to.toLowerCase(),o=r.toLowerCase(),s=[];for(let a=0;a<i.length;a++){let c=i[a],h=c.replace("{sender}",n).replace("{data}",o),g=c.indexOf("{data}")>=0?null:JSON.stringify({data:o,sender:n}),b=yield Jl({url:h,errorPassThrough:!0},g,(A,T)=>(A.status=T.statusCode,A));if(b.data)return b.data;let E=b.message||"unknown error";if(b.status>=400&&b.status<500)return Gr.throwError(`response not found during CCIP fetch: ${E}`,fe.errors.SERVER_ERROR,{url:c,errorMessage:E});s.push(E)}return Gr.throwError(`error encountered during CCIP fetch: ${s.map(a=>JSON.stringify(a)).join(", ")}`,fe.errors.SERVER_ERROR,{urls:i,errorMessages:s})})}_getInternalBlockNumber(e){return Er(this,void 0,void 0,function*(){if(yield this._ready(),e>0)for(;this._internalBlockNumber;){let n=this._internalBlockNumber;try{let o=yield n;if(P5()-o.respTime<=e)return o.blockNumber;break}catch{if(this._internalBlockNumber===n)break}}let r=P5(),i=$i({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then(n=>null,n=>n)}).then(({blockNumber:n,networkError:o})=>{if(o)throw this._internalBlockNumber===i&&(this._internalBlockNumber=null),o;let s=P5();return n=Ue.from(n).toNumber(),n<this._maxInternalBlockNumber&&(n=this._maxInternalBlockNumber),this._maxInternalBlockNumber=n,this._setFastBlockNumber(n),{blockNumber:n,reqTime:r,respTime:s}});return this._internalBlockNumber=i,i.catch(n=>{this._internalBlockNumber===i&&(this._internalBlockNumber=null)}),(yield i).blockNumber})}poll(){return Er(this,void 0,void 0,function*(){let e=Dze++,r=[],i=null;try{i=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(n){this.emit("error",n);return}if(this._setFastBlockNumber(i),this.emit("poll",e,i),i===this._lastBlockNumber){this.emit("didPoll",e);return}if(this._emitted.block===-2&&(this._emitted.block=i-1),Math.abs(this._emitted.block-i)>1e3)Gr.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${i})`),this.emit("error",Gr.makeError("network block skew detected",fe.errors.NETWORK_ERROR,{blockNumber:i,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",i);else for(let n=this._emitted.block+1;n<=i;n++)this.emit("block",n);this._emitted.block!==i&&(this._emitted.block=i,Object.keys(this._emitted).forEach(n=>{if(n==="block")return;let o=this._emitted[n];o!=="pending"&&i-o>12&&delete this._emitted[n]})),this._lastBlockNumber===-2&&(this._lastBlockNumber=i-1),this._events.forEach(n=>{switch(n.type){case"tx":{let o=n.hash,s=this.getTransactionReceipt(o).then(a=>(!a||a.blockNumber==null||(this._emitted["t:"+o]=a.blockNumber,this.emit(o,a)),null)).catch(a=>{this.emit("error",a)});r.push(s);break}case"filter":{if(!n._inflight){n._inflight=!0,n._lastBlockNumber===-2&&(n._lastBlockNumber=i-1);let o=n.filter;o.fromBlock=n._lastBlockNumber+1,o.toBlock=i;let s=o.toBlock-this._maxFilterBlockRange;s>o.fromBlock&&(o.fromBlock=s),o.fromBlock<0&&(o.fromBlock=0);let a=this.getLogs(o).then(c=>{n._inflight=!1,c.length!==0&&c.forEach(h=>{h.blockNumber>n._lastBlockNumber&&(n._lastBlockNumber=h.blockNumber),this._emitted["b:"+h.blockHash]=h.blockNumber,this._emitted["t:"+h.transactionHash]=h.blockNumber,this.emit(o,h)})}).catch(c=>{this.emit("error",c),n._inflight=!1});r.push(a)}break}}}),this._lastBlockNumber=i,Promise.all(r).then(()=>{this.emit("didPoll",e)}).catch(n=>{this.emit("error",n)})})}resetEventsBlock(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return Er(this,void 0,void 0,function*(){return Gr.throwError("provider does not support network detection",fe.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})})}getNetwork(){return Er(this,void 0,void 0,function*(){let e=yield this._ready(),r=yield this.detectNetwork();if(e.chainId!==r.chainId){if(this.anyNetwork)return this._network=r,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",r,e),yield mhe(0),this._network;let i=Gr.makeError("underlying network changed",fe.errors.NETWORK_ERROR,{event:"changed",network:e,detectedNetwork:r});throw this.emit("error",i),i}return e})}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then(e=>{this._setFastBlockNumber(e)},e=>{}),this._fastBlockNumber!=null?this._fastBlockNumber:-1}get polling(){return this._poller!=null}set polling(e){e&&!this._poller?(this._poller=setInterval(()=>{this.poll()},this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout(()=>{this.poll(),this._bootstrapPoll=setTimeout(()=>{this._poller||this.poll(),this._bootstrapPoll=null},this.pollingInterval)},0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(e){if(typeof e!="number"||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval(()=>{this.poll()},this._pollingInterval))}_getFastBlockNumber(){let e=P5();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then(r=>((this._fastBlockNumber==null||r>this._fastBlockNumber)&&(this._fastBlockNumber=r),this._fastBlockNumber))),this._fastBlockNumberPromise}_setFastBlockNumber(e){this._fastBlockNumber!=null&&e<this._fastBlockNumber||(this._fastQueryDate=P5(),(this._fastBlockNumber==null||e>this._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,r,i){return Er(this,void 0,void 0,function*(){return this._waitForTransaction(e,r??1,i||0,null)})}_waitForTransaction(e,r,i,n){return Er(this,void 0,void 0,function*(){let o=yield this.getTransactionReceipt(e);return(o?o.confirmations:0)>=r?o:new Promise((s,a)=>{let c=[],h=!1,g=function(){return h?!0:(h=!0,c.forEach(E=>{E()}),!1)},b=E=>{E.confirmations<r||g()||s(E)};if(this.on(e,b),c.push(()=>{this.removeListener(e,b)}),n){let E=n.startBlock,A=null,T=P=>Er(this,void 0,void 0,function*(){h||(yield mhe(1e3),this.getTransactionCount(n.from).then(L=>Er(this,void 0,void 0,function*(){if(!h){if(L<=n.nonce)E=P;else{{let j=yield this.getTransaction(e);if(j&&j.blockNumber!=null)return}for(A==null&&(A=E-3,A<n.startBlock&&(A=n.startBlock));A<=P;){if(h)return;let j=yield this.getBlockWithTransactions(A);for(let $=0;$<j.transactions.length;$++){let G=j.transactions[$];if(G.hash===e)return;if(G.from===n.from&&G.nonce===n.nonce){if(h)return;let Z=yield this.waitForTransaction(G.hash,r);if(g())return;let te="replaced";G.data===n.data&&G.to===n.to&&G.value.eq(n.value)?te="repriced":G.data==="0x"&&G.from===G.to&&G.value.isZero()&&(te="cancelled"),a(Gr.makeError("transaction was replaced",fe.errors.TRANSACTION_REPLACED,{cancelled:te==="replaced"||te==="cancelled",reason:te,replacement:this._wrapTransaction(G),hash:e,receipt:Z}));return}}A++}}h||this.once("block",T)}}),L=>{h||this.once("block",T)}))});if(h)return;this.once("block",T),c.push(()=>{this.removeListener("block",T)})}if(typeof i=="number"&&i>0){let E=setTimeout(()=>{g()||a(Gr.makeError("timeout exceeded",fe.errors.TIMEOUT,{timeout:i}))},i);E.unref&&E.unref(),c.push(()=>{clearTimeout(E)})}})})}getBlockNumber(){return Er(this,void 0,void 0,function*(){return this._getInternalBlockNumber(0)})}getGasPrice(){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let e=yield this.perform("getGasPrice",{});try{return Ue.from(e)}catch(r){return Gr.throwError("bad result from backend",fe.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:r})}})}getBalance(e,r){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let i=yield $i({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),n=yield this.perform("getBalance",i);try{return Ue.from(n)}catch(o){return Gr.throwError("bad result from backend",fe.errors.SERVER_ERROR,{method:"getBalance",params:i,result:n,error:o})}})}getTransactionCount(e,r){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let i=yield $i({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),n=yield this.perform("getTransactionCount",i);try{return Ue.from(n).toNumber()}catch(o){return Gr.throwError("bad result from backend",fe.errors.SERVER_ERROR,{method:"getTransactionCount",params:i,result:n,error:o})}})}getCode(e,r){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let i=yield $i({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),n=yield this.perform("getCode",i);try{return De(n)}catch(o){return Gr.throwError("bad result from backend",fe.errors.SERVER_ERROR,{method:"getCode",params:i,result:n,error:o})}})}getStorageAt(e,r,i){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let n=yield $i({address:this._getAddress(e),blockTag:this._getBlockTag(i),position:Promise.resolve(r).then(s=>hf(s))}),o=yield this.perform("getStorageAt",n);try{return De(o)}catch(s){return Gr.throwError("bad result from backend",fe.errors.SERVER_ERROR,{method:"getStorageAt",params:n,result:o,error:s})}})}_wrapTransaction(e,r,i){if(r!=null&&ps(r)!==32)throw new Error("invalid response - sendTransaction");let n=e;return r!=null&&e.hash!==r&&Gr.throwError("Transaction hash mismatch from Provider.sendTransaction.",fe.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:r}),n.wait=(o,s)=>Er(this,void 0,void 0,function*(){o==null&&(o=1),s==null&&(s=0);let a;o!==0&&i!=null&&(a={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:i});let c=yield this._waitForTransaction(e.hash,o,s,a);return c==null&&o===0?null:(this._emitted["t:"+e.hash]=c.blockNumber,c.status===0&&Gr.throwError("transaction failed",fe.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:c}),c)}),n}sendTransaction(e){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let r=yield Promise.resolve(e).then(o=>De(o)),i=this.formatter.transaction(e);i.confirmations==null&&(i.confirmations=0);let n=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{let o=yield this.perform("sendTransaction",{signedTransaction:r});return this._wrapTransaction(i,o,n)}catch(o){throw o.transaction=i,o.transactionHash=i.hash,o}})}_getTransactionRequest(e){return Er(this,void 0,void 0,function*(){let r=yield e,i={};return["from","to"].forEach(n=>{r[n]!=null&&(i[n]=Promise.resolve(r[n]).then(o=>o?this._getAddress(o):null))}),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach(n=>{r[n]!=null&&(i[n]=Promise.resolve(r[n]).then(o=>o?Ue.from(o):null))}),["type"].forEach(n=>{r[n]!=null&&(i[n]=Promise.resolve(r[n]).then(o=>o??null))}),r.accessList&&(i.accessList=this.formatter.accessList(r.accessList)),["data"].forEach(n=>{r[n]!=null&&(i[n]=Promise.resolve(r[n]).then(o=>o?De(o):null))}),this.formatter.transactionRequest(yield $i(i))})}_getFilter(e){return Er(this,void 0,void 0,function*(){e=yield e;let r={};return e.address!=null&&(r.address=this._getAddress(e.address)),["blockHash","topics"].forEach(i=>{e[i]!=null&&(r[i]=e[i])}),["fromBlock","toBlock"].forEach(i=>{e[i]!=null&&(r[i]=this._getBlockTag(e[i]))}),this.formatter.filter(yield $i(r))})}_call(e,r,i){return Er(this,void 0,void 0,function*(){i>=kze&&Gr.throwError("CCIP read exceeded maximum redirections",fe.errors.SERVER_ERROR,{redirects:i,transaction:e});let n=e.to,o=yield this.perform("call",{transaction:e,blockTag:r});if(i>=0&&r==="latest"&&n!=null&&o.substring(0,10)==="0x556f1830"&&ps(o)%32===4)try{let s=ji(o,4),a=ji(s,0,32);Ue.from(a).eq(n)||Gr.throwError("CCIP Read sender did not match",fe.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:o});let c=[],h=Ue.from(ji(s,32,64)).toNumber(),g=Ue.from(ji(s,h,h+32)).toNumber(),b=ji(s,h+32);for(let j=0;j<g;j++){let $=nE(b,j*32);$==null&&Gr.throwError("CCIP Read contained corrupt URL string",fe.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:o}),c.push($)}let E=O5(s,64);Ue.from(ji(s,100,128)).isZero()||Gr.throwError("CCIP Read callback selector included junk",fe.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:o});let A=ji(s,96,100),T=O5(s,128),P=yield this.ccipReadFetch(e,E,c);P==null&&Gr.throwError("CCIP Read disabled or provided no URLs",fe.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:o});let L={to:n,data:Vn([A,yhe([P,T])])};return this._call(L,r,i+1)}catch(s){if(s.code===fe.errors.SERVER_ERROR)throw s}try{return De(o)}catch(s){return Gr.throwError("bad result from backend",fe.errors.SERVER_ERROR,{method:"call",params:{transaction:e,blockTag:r},result:o,error:s})}})}call(e,r){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let i=yield $i({transaction:this._getTransactionRequest(e),blockTag:this._getBlockTag(r),ccipReadEnabled:Promise.resolve(e.ccipReadEnabled)});return this._call(i.transaction,i.blockTag,i.ccipReadEnabled?0:-1)})}estimateGas(e){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let r=yield $i({transaction:this._getTransactionRequest(e)}),i=yield this.perform("estimateGas",r);try{return Ue.from(i)}catch(n){return Gr.throwError("bad result from backend",fe.errors.SERVER_ERROR,{method:"estimateGas",params:r,result:i,error:n})}})}_getAddress(e){return Er(this,void 0,void 0,function*(){e=yield e,typeof e!="string"&&Gr.throwArgumentError("invalid address or ENS name","name",e);let r=yield this.resolveName(e);return r==null&&Gr.throwError("ENS name not configured",fe.errors.UNSUPPORTED_OPERATION,{operation:`resolveName(${JSON.stringify(e)})`}),r})}_getBlock(e,r){return Er(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;let i=-128,n={includeTransactions:!!r};if(Zt(e,32))n.blockHash=e;else try{n.blockTag=yield this._getBlockTag(e),Zt(n.blockTag)&&(i=parseInt(n.blockTag.substring(2),16))}catch{Gr.throwArgumentError("invalid block hash or block tag","blockHashOrBlockTag",e)}return Ql(()=>Er(this,void 0,void 0,function*(){let o=yield this.perform("getBlock",n);if(o==null)return n.blockHash!=null&&this._emitted["b:"+n.blockHash]==null||n.blockTag!=null&&i>this._emitted.block?null:void 0;if(r){let s=null;for(let c=0;c<o.transactions.length;c++){let h=o.transactions[c];if(h.blockNumber==null)h.confirmations=0;else if(h.confirmations==null){s==null&&(s=yield this._getInternalBlockNumber(100+2*this.pollingInterval));let g=s-h.blockNumber+1;g<=0&&(g=1),h.confirmations=g}}let a=this.formatter.blockWithTransactions(o);return a.transactions=a.transactions.map(c=>this._wrapTransaction(c)),a}return this.formatter.block(o)}),{oncePoll:this})})}getBlock(e){return this._getBlock(e,!1)}getBlockWithTransactions(e){return this._getBlock(e,!0)}getTransaction(e){return Er(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;let r={transactionHash:this.formatter.hash(e,!0)};return Ql(()=>Er(this,void 0,void 0,function*(){let i=yield this.perform("getTransaction",r);if(i==null)return this._emitted["t:"+e]==null?null:void 0;let n=this.formatter.transactionResponse(i);if(n.blockNumber==null)n.confirmations=0;else if(n.confirmations==null){let s=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-n.blockNumber+1;s<=0&&(s=1),n.confirmations=s}return this._wrapTransaction(n)}),{oncePoll:this})})}getTransactionReceipt(e){return Er(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;let r={transactionHash:this.formatter.hash(e,!0)};return Ql(()=>Er(this,void 0,void 0,function*(){let i=yield this.perform("getTransactionReceipt",r);if(i==null)return this._emitted["t:"+e]==null?null:void 0;if(i.blockHash==null)return;let n=this.formatter.receipt(i);if(n.blockNumber==null)n.confirmations=0;else if(n.confirmations==null){let s=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-n.blockNumber+1;s<=0&&(s=1),n.confirmations=s}return n}),{oncePoll:this})})}getLogs(e){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let r=yield $i({filter:this._getFilter(e)}),i=yield this.perform("getLogs",r);return i.forEach(n=>{n.removed==null&&(n.removed=!1)}),jm.arrayOf(this.formatter.filterLog.bind(this.formatter))(i)})}getEtherPrice(){return Er(this,void 0,void 0,function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})})}_getBlockTag(e){return Er(this,void 0,void 0,function*(){if(e=yield e,typeof e=="number"&&e<0){e%1&&Gr.throwArgumentError("invalid BlockTag","blockTag",e);let r=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return r+=e,r<0&&(r=0),this.formatter.blockTag(r)}return this.formatter.blockTag(e)})}getResolver(e){return Er(this,void 0,void 0,function*(){let r=e;for(;;){if(r===""||r==="."||e!=="eth"&&r==="eth")return null;let i=yield this._getResolver(r,"getResolver");if(i!=null){let n=new f3(this,i,e);return r!==e&&!(yield n.supportsWildcard())?null:n}r=r.split(".").slice(1).join(".")}})}_getResolver(e,r){return Er(this,void 0,void 0,function*(){r==null&&(r="ENS");let i=yield this.getNetwork();i.ensAddress||Gr.throwError("network does not support ENS",fe.errors.UNSUPPORTED_OPERATION,{operation:r,network:i.name});try{let n=yield this.call({to:i.ensAddress,data:"0x0178b8bf"+ip(e).substring(2)});return this.formatter.callAddress(n)}catch{}return null})}resolveName(e){return Er(this,void 0,void 0,function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(i){if(Zt(e))throw i}typeof e!="string"&&Gr.throwArgumentError("invalid ENS name","name",e);let r=yield this.getResolver(e);return r?yield r.getAddress():null})}lookupAddress(e){return Er(this,void 0,void 0,function*(){e=yield e,e=this.formatter.address(e);let r=e.substring(2).toLowerCase()+".addr.reverse",i=yield this._getResolver(r,"lookupAddress");if(i==null)return null;let n=nE(yield this.call({to:i,data:"0x691f3431"+ip(r).substring(2)}),0);return(yield this.resolveName(n))!=e?null:n})}getAvatar(e){return Er(this,void 0,void 0,function*(){let r=null;if(Zt(e)){let o=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",s=yield this._getResolver(o,"getAvatar");if(!s)return null;r=new f3(this,s,o);try{let a=yield r.getAvatar();if(a)return a.url}catch(a){if(a.code!==fe.errors.CALL_EXCEPTION)throw a}try{let a=nE(yield this.call({to:s,data:"0x691f3431"+ip(o).substring(2)}),0);r=yield this.getResolver(a)}catch(a){if(a.code!==fe.errors.CALL_EXCEPTION)throw a;return null}}else if(r=yield this.getResolver(e),!r)return null;let i=yield r.getAvatar();return i==null?null:i.url})}perform(e,r){return Gr.throwError(e+" not implemented",fe.errors.NOT_IMPLEMENTED,{operation:e})}_startEvent(e){this.polling=this._events.filter(r=>r.pollable()).length>0}_stopEvent(e){this.polling=this._events.filter(r=>r.pollable()).length>0}_addEventListener(e,r,i){let n=new JD(u3(e),r,i);return this._events.push(n),this._startEvent(n),this}on(e,r){return this._addEventListener(e,r,!1)}once(e,r){return this._addEventListener(e,r,!0)}emit(e,...r){let i=!1,n=[],o=u3(e);return this._events=this._events.filter(s=>s.tag!==o?!0:(setTimeout(()=>{s.listener.apply(this,r)},0),i=!0,s.once?(n.push(s),!1):!0)),n.forEach(s=>{this._stopEvent(s)}),i}listenerCount(e){if(!e)return this._events.length;let r=u3(e);return this._events.filter(i=>i.tag===r).length}listeners(e){if(e==null)return this._events.map(i=>i.listener);let r=u3(e);return this._events.filter(i=>i.tag===r).map(i=>i.listener)}off(e,r){if(r==null)return this.removeAllListeners(e);let i=[],n=!1,o=u3(e);return this._events=this._events.filter(s=>s.tag!==o||s.listener!=r||n?!0:(n=!0,i.push(s),!1)),i.forEach(s=>{this._stopEvent(s)}),this}removeAllListeners(e){let r=[];if(e==null)r=this._events,this._events=[];else{let i=u3(e);this._events=this._events.filter(n=>n.tag!==i?!0:(r.push(n),!1))}return r.forEach(i=>{this._stopEvent(i)}),this}};var vh=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},Gn=new fe(Si),Lze=["call","estimateGas"];function D5(t,e){if(t==null)return null;if(typeof t.message=="string"&&t.message.match("reverted")){let r=Zt(t.data)?t.data:null;if(!e||r)return{message:t.message,data:r}}if(typeof t=="object"){for(let r in t){let i=D5(t[r],e);if(i)return i}return null}if(typeof t=="string")try{return D5(JSON.parse(t),e)}catch{}return null}function _he(t,e,r){let i=r.transaction||r.signedTransaction;if(t==="call"){let o=D5(e,!0);if(o)return o.data;Gn.throwError("missing revert data in call exception; Transaction reverted without a reason string",fe.errors.CALL_EXCEPTION,{data:"0x",transaction:i,error:e})}if(t==="estimateGas"){let o=D5(e.body,!1);o==null&&(o=D5(e,!1)),o&&Gn.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",fe.errors.UNPREDICTABLE_GAS_LIMIT,{reason:o.message,method:t,transaction:i,error:e})}let n=e.message;throw e.code===fe.errors.SERVER_ERROR&&e.error&&typeof e.error.message=="string"?n=e.error.message:typeof e.body=="string"?n=e.body:typeof e.responseText=="string"&&(n=e.responseText),n=(n||"").toLowerCase(),n.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&Gn.throwError("insufficient funds for intrinsic transaction cost",fe.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:i}),n.match(/nonce (is )?too low/i)&&Gn.throwError("nonce has already been used",fe.errors.NONCE_EXPIRED,{error:e,method:t,transaction:i}),n.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&Gn.throwError("replacement fee too low",fe.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:i}),n.match(/only replay-protected/i)&&Gn.throwError("legacy pre-eip-155 transactions not supported",fe.errors.UNSUPPORTED_OPERATION,{error:e,method:t,transaction:i}),Lze.indexOf(t)>=0&&n.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&Gn.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",fe.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:i}),e}function xhe(t){return new Promise(function(e){setTimeout(e,t)})}function Bze(t){if(t.error){let e=new Error(t.error.message);throw e.code=t.error.code,e.data=t.error.data,e}return t.result}function M5(t){return t&&t.toLowerCase()}var QD={},h3=class extends rc{constructor(e,r,i){if(super(),e!==QD)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");ye(this,"provider",r),i==null&&(i=0),typeof i=="string"?(ye(this,"_address",this.provider.formatter.address(i)),ye(this,"_index",null)):typeof i=="number"?(ye(this,"_index",i),ye(this,"_address",null)):Gn.throwArgumentError("invalid address or index","addressOrIndex",i)}connect(e){return Gn.throwError("cannot alter JSON-RPC Signer connection",fe.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new XD(QD,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then(e=>(e.length<=this._index&&Gn.throwError("unknown account #"+this._index,fe.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index])))}sendUncheckedTransaction(e){e=pi(e);let r=this.getAddress().then(i=>(i&&(i=i.toLowerCase()),i));if(e.gasLimit==null){let i=pi(e);i.from=r,e.gasLimit=this.provider.estimateGas(i)}return e.to!=null&&(e.to=Promise.resolve(e.to).then(i=>vh(this,void 0,void 0,function*(){if(i==null)return null;let n=yield this.provider.resolveName(i);return n==null&&Gn.throwArgumentError("provided ENS name resolves to null","tx.to",i),n}))),$i({tx:$i(e),sender:r}).then(({tx:i,sender:n})=>{i.from!=null?i.from.toLowerCase()!==n&&Gn.throwArgumentError("from address mismatch","transaction",e):i.from=n;let o=this.provider.constructor.hexlifyTransaction(i,{from:!0});return this.provider.send("eth_sendTransaction",[o]).then(s=>s,s=>(typeof s.message=="string"&&s.message.match(/user denied/i)&&Gn.throwError("user rejected transaction",fe.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:i}),_he("sendTransaction",s,o)))})}signTransaction(e){return Gn.throwError("signing transactions is unsupported",fe.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return vh(this,void 0,void 0,function*(){let r=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),i=yield this.sendUncheckedTransaction(e);try{return yield Ql(()=>vh(this,void 0,void 0,function*(){let n=yield this.provider.getTransaction(i);if(n!==null)return this.provider._wrapTransaction(n,i,r)}),{oncePoll:this.provider})}catch(n){throw n.transactionHash=i,n}})}signMessage(e){return vh(this,void 0,void 0,function*(){let r=typeof e=="string"?fi(e):e,i=yield this.getAddress();try{return yield this.provider.send("personal_sign",[De(r),i.toLowerCase()])}catch(n){throw typeof n.message=="string"&&n.message.match(/user denied/i)&&Gn.throwError("user rejected signing",fe.errors.ACTION_REJECTED,{action:"signMessage",from:i,messageData:e}),n}})}_legacySignMessage(e){return vh(this,void 0,void 0,function*(){let r=typeof e=="string"?fi(e):e,i=yield this.getAddress();try{return yield this.provider.send("eth_sign",[i.toLowerCase(),De(r)])}catch(n){throw typeof n.message=="string"&&n.message.match(/user denied/i)&&Gn.throwError("user rejected signing",fe.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:i,messageData:e}),n}})}_signTypedData(e,r,i){return vh(this,void 0,void 0,function*(){let n=yield Qc.resolveNames(e,r,i,s=>this.provider.resolveName(s)),o=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[o.toLowerCase(),JSON.stringify(Qc.getPayload(n.domain,r,n.value))])}catch(s){throw typeof s.message=="string"&&s.message.match(/user denied/i)&&Gn.throwError("user rejected signing",fe.errors.ACTION_REJECTED,{action:"_signTypedData",from:o,messageData:{domain:n.domain,types:r,value:n.value}}),s}})}unlock(e){return vh(this,void 0,void 0,function*(){let r=this.provider,i=yield this.getAddress();return r.send("personal_unlockAccount",[i.toLowerCase(),e,null])})}},XD=class extends h3{sendTransaction(e){return this.sendUncheckedTransaction(e).then(r=>({hash:r,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:i=>this.provider.waitForTransaction(r,i)}))}},Uze={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0},ma=class extends Pf{constructor(e,r){let i=r;i==null&&(i=new Promise((n,o)=>{setTimeout(()=>{this.detectNetwork().then(s=>{n(s)},s=>{o(s)})},0)})),super(i),e||(e=bn(this.constructor,"defaultUrl")()),typeof e=="string"?ye(this,"connection",Object.freeze({url:e})):ye(this,"connection",Object.freeze(pi(e))),this._nextId=42}get _cache(){return this._eventLoopCache==null&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout(()=>{this._cache.detectNetwork=null},0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return vh(this,void 0,void 0,function*(){yield xhe(0);let e=null;try{e=yield this.send("eth_chainId",[])}catch{try{e=yield this.send("net_version",[])}catch{}}if(e!=null){let r=bn(this.constructor,"getNetwork");try{return r(Ue.from(e).toNumber())}catch(i){return Gn.throwError("could not detect network",fe.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:i})}}return Gn.throwError("could not detect network",fe.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(e){return new h3(QD,this,e)}getUncheckedSigner(e){return this.getSigner(e).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then(e=>e.map(r=>this.formatter.address(r)))}send(e,r){let i={method:e,params:r,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:vn(i),provider:this});let n=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(n&&this._cache[e])return this._cache[e];let o=Jl(this.connection,JSON.stringify(i),Bze).then(s=>(this.emit("debug",{action:"response",request:i,response:s,provider:this}),s),s=>{throw this.emit("debug",{action:"response",error:s,request:i,provider:this}),s});return n&&(this._cache[e]=o,setTimeout(()=>{this._cache[e]=null},0)),o}prepareRequest(e,r){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[M5(r.address),r.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[M5(r.address),r.blockTag]];case"getCode":return["eth_getCode",[M5(r.address),r.blockTag]];case"getStorageAt":return["eth_getStorageAt",[M5(r.address),Kr(r.position,32),r.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[r.signedTransaction]];case"getBlock":return r.blockTag?["eth_getBlockByNumber",[r.blockTag,!!r.includeTransactions]]:r.blockHash?["eth_getBlockByHash",[r.blockHash,!!r.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[r.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[r.transactionHash]];case"call":return["eth_call",[bn(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0}),r.blockTag]];case"estimateGas":return["eth_estimateGas",[bn(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0})]];case"getLogs":return r.filter&&r.filter.address!=null&&(r.filter.address=M5(r.filter.address)),["eth_getLogs",[r.filter]];default:break}return null}perform(e,r){return vh(this,void 0,void 0,function*(){if(e==="call"||e==="estimateGas"){let n=r.transaction;if(n&&n.type!=null&&Ue.from(n.type).isZero()&&n.maxFeePerGas==null&&n.maxPriorityFeePerGas==null){let o=yield this.getFeeData();o.maxFeePerGas==null&&o.maxPriorityFeePerGas==null&&(r=pi(r),r.transaction=pi(n),delete r.transaction.type)}}let i=this.prepareRequest(e,r);i==null&&Gn.throwError(e+" not implemented",fe.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(i[0],i[1])}catch(n){return _he(e,n,r)}})}_startEvent(e){e.tag==="pending"&&this._startPending(),super._startEvent(e)}_startPending(){if(this._pendingFilter!=null)return;let e=this,r=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=r,r.then(function(i){function n(){e.send("eth_getFilterChanges",[i]).then(function(o){if(e._pendingFilter!=r)return null;let s=Promise.resolve();return o.forEach(function(a){e._emitted["t:"+a.toLowerCase()]="pending",s=s.then(function(){return e.getTransaction(a).then(function(c){return e.emit("pending",c),null})})}),s.then(function(){return xhe(1e3)})}).then(function(){if(e._pendingFilter!=r){e.send("eth_uninstallFilter",[i]);return}return setTimeout(function(){n()},0),null}).catch(o=>{})}return n(),i}).catch(i=>{})}_stopEvent(e){e.tag==="pending"&&this.listenerCount("pending")===0&&(this._pendingFilter=null),super._stopEvent(e)}static hexlifyTransaction(e,r){let i=pi(Uze);if(r)for(let o in r)r[o]&&(i[o]=!0);Lw(e,i);let n={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(o){if(e[o]==null)return;let s=hf(Ue.from(e[o]));o==="gasLimit"&&(o="gas"),n[o]=s}),["from","to","data"].forEach(function(o){e[o]!=null&&(n[o]=De(e[o]))}),e.accessList&&(n.accessList=sc(e.accessList)),n}};var d3=null;try{if(d3=WebSocket,d3==null)throw new Error("inject please")}catch{let e=new fe(Si);d3=function(){e.throwError("WebSockets not supported in this environment",fe.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var eL=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},oE=new fe(Si),Fze=1,bh=class extends ma{constructor(e,r){r==="any"&&oE.throwError("WebSocketProvider does not support 'any' network yet",fe.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),typeof e=="string"?super(e,r):super("_websocket",r),this._pollingInterval=-1,this._wsReady=!1,typeof e=="string"?ye(this,"_websocket",new d3(this.connection.url)):ye(this,"_websocket",e),ye(this,"_requests",{}),ye(this,"_subs",{}),ye(this,"_subIds",{}),ye(this,"_detectNetwork",super.detectNetwork()),this.websocket.onopen=()=>{this._wsReady=!0,Object.keys(this._requests).forEach(n=>{this.websocket.send(this._requests[n].payload)})},this.websocket.onmessage=n=>{let o=n.data,s=JSON.parse(o);if(s.id!=null){let a=String(s.id),c=this._requests[a];if(delete this._requests[a],s.result!==void 0)c.callback(null,s.result),this.emit("debug",{action:"response",request:JSON.parse(c.payload),response:s.result,provider:this});else{let h=null;s.error?(h=new Error(s.error.message||"unknown error"),ye(h,"code",s.error.code||null),ye(h,"response",o)):h=new Error("unknown error"),c.callback(h,void 0),this.emit("debug",{action:"response",error:h,request:JSON.parse(c.payload),provider:this})}}else if(s.method==="eth_subscription"){let a=this._subs[s.params.subscription];a&&a.processFunc(s.params.result)}else console.warn("this should not happen")};let i=setInterval(()=>{this.emit("poll")},1e3);i.unref&&i.unref()}get websocket(){return this._websocket}detectNetwork(){return this._detectNetwork}get pollingInterval(){return 0}resetEventsBlock(e){oE.throwError("cannot reset events block on WebSocketProvider",fe.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(e){oE.throwError("cannot set polling interval on WebSocketProvider",fe.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return eL(this,void 0,void 0,function*(){return null})}set polling(e){e&&oE.throwError("cannot set polling on WebSocketProvider",fe.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(e,r){let i=Fze++;return new Promise((n,o)=>{function s(c,h){return c?o(c):n(h)}let a=JSON.stringify({method:e,params:r,id:i,jsonrpc:"2.0"});this.emit("debug",{action:"request",request:JSON.parse(a),provider:this}),this._requests[String(i)]={callback:s,payload:a},this._wsReady&&this.websocket.send(a)})}static defaultUrl(){return"ws://localhost:8546"}_subscribe(e,r,i){return eL(this,void 0,void 0,function*(){let n=this._subIds[e];n==null&&(n=Promise.all(r).then(s=>this.send("eth_subscribe",s)),this._subIds[e]=n);let o=yield n;this._subs[o]={tag:e,processFunc:i}})}_startEvent(e){switch(e.type){case"block":this._subscribe("block",["newHeads"],r=>{let i=Ue.from(r.number).toNumber();this._emitted.block=i,this.emit("block",i)});break;case"pending":this._subscribe("pending",["newPendingTransactions"],r=>{this.emit("pending",r)});break;case"filter":this._subscribe(e.tag,["logs",this._getFilter(e.filter)],r=>{r.removed==null&&(r.removed=!1),this.emit(e.filter,this.formatter.filterLog(r))});break;case"tx":{let r=i=>{let n=i.hash;this.getTransactionReceipt(n).then(o=>{o&&this.emit(n,o)})};r(e),this._subscribe("tx",["newHeads"],i=>{this._events.filter(n=>n.type==="tx").forEach(r)});break}case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",e);break}}_stopEvent(e){let r=e.tag;if(e.type==="tx"){if(this._events.filter(n=>n.type==="tx").length)return;r="tx"}else if(this.listenerCount(e.event))return;let i=this._subIds[r];i&&(delete this._subIds[r],i.then(n=>{this._subs[n]&&(delete this._subs[n],this.send("eth_unsubscribe",[n]))}))}destroy(){return eL(this,void 0,void 0,function*(){this.websocket.readyState===d3.CONNECTING&&(yield new Promise(e=>{this.websocket.onopen=function(){e(!0)},this.websocket.onerror=function(){e(!1)}})),this.websocket.close(1e3)})}};var jze=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},L5=new fe(Si),B5=class extends ma{detectNetwork(){let e=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return jze(this,void 0,void 0,function*(){let r=this.network;return r==null&&(r=yield e.detectNetwork.call(this),r||L5.throwError("no network detected",fe.errors.UNKNOWN_ERROR,{}),this._network==null&&(ye(this,"_network",r),this.emit("network",r,null))),r})}},bs=class t extends B5{constructor(e,r){L5.checkAbstract(new.target,t),e=bn(new.target,"getNetwork")(e),r=bn(new.target,"getApiKey")(r);let i=bn(new.target,"getUrl")(e,r);super(i,e),typeof r=="string"?ye(this,"apiKey",r):r!=null&&Object.keys(r).forEach(n=>{ye(this,n,r[n])})}_startPending(){L5.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(e){return L5.throwError("API provider does not support signing",fe.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(e){return e}static getUrl(e,r){return L5.throwError("not implemented; sub-classes must override getUrl",fe.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}};var Ehe=new fe(Si),sE="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",U5=class extends bh{constructor(e,r){let i=new p3(e,r),n=i.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi.");super(n,i.network),ye(this,"apiKey",i.apiKey)}isCommunityResource(){return this.apiKey===sE}},p3=class extends bs{static getWebSocketProvider(e,r){return new U5(e,r)}static getApiKey(e){return e==null?sE:(e&&typeof e!="string"&&Ehe.throwArgumentError("invalid apiKey","apiKey",e),e)}static getUrl(e,r){let i=null;switch(e.name){case"homestead":i="eth-mainnet.alchemyapi.io/v2/";break;case"goerli":i="eth-goerli.g.alchemy.com/v2/";break;case"matic":i="polygon-mainnet.g.alchemy.com/v2/";break;case"maticmum":i="polygon-mumbai.g.alchemy.com/v2/";break;case"arbitrum":i="arb-mainnet.g.alchemy.com/v2/";break;case"arbitrum-goerli":i="arb-goerli.g.alchemy.com/v2/";break;case"optimism":i="opt-mainnet.g.alchemy.com/v2/";break;case"optimism-goerli":i="opt-goerli.g.alchemy.com/v2/";break;default:Ehe.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+i+r,throttleCallback:(n,o)=>(r===sE&&Nf(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===sE}};var $ze=new fe(Si),aE="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function Wze(t){switch(t){case"homestead":return"rpc.ankr.com/eth/";case"ropsten":return"rpc.ankr.com/eth_ropsten/";case"rinkeby":return"rpc.ankr.com/eth_rinkeby/";case"goerli":return"rpc.ankr.com/eth_goerli/";case"matic":return"rpc.ankr.com/polygon/";case"arbitrum":return"rpc.ankr.com/arbitrum/"}return $ze.throwArgumentError("unsupported network","name",t)}var F5=class extends bs{isCommunityResource(){return this.apiKey===aE}static getApiKey(e){return e??aE}static getUrl(e,r){r==null&&(r=aE);let i={allowGzip:!0,url:"https://"+Wze(e.name)+r,throttleCallback:(n,o)=>(r.apiKey===aE&&Nf(),Promise.resolve(!0))};return r.projectSecret!=null&&(i.user="",i.password=r.projectSecret),i}};var qze=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},Ahe=new fe(Si),j5=class extends bs{static getApiKey(e){return e!=null&&Ahe.throwArgumentError("apiKey not supported for cloudflare","apiKey",e),null}static getUrl(e,r){let i=null;switch(e.name){case"homestead":i="https://cloudflare-eth.com/";break;default:Ahe.throwArgumentError("unsupported network","network",arguments[0])}return i}perform(e,r){let i=Object.create(null,{perform:{get:()=>super.perform}});return qze(this,void 0,void 0,function*(){return e==="getBlockNumber"?(yield i.perform.call(this,"getBlock",{blockTag:"latest"})).number:i.perform.call(this,e,r)})}};var cE=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},up=new fe(Si);function Che(t){let e={};for(let r in t){if(t[r]==null)continue;let i=t[r];r==="type"&&i===0||({type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[r]?i=hf(De(i)):r==="accessList"?i="["+sc(i).map(n=>`{address:"${n.address}",storageKeys:["${n.storageKeys.join('","')}"]}`).join(",")+"]":i=De(i),e[r]=i)}return e}function Hze(t){if(t.status==0&&(t.message==="No records found"||t.message==="No transactions found"))return t.result;if(t.status!=1||typeof t.message!="string"||!t.message.match(/^OK/)){let e=new Error("invalid response");throw e.result=JSON.stringify(t),(t.result||"").toLowerCase().indexOf("rate limit")>=0&&(e.throttleRetry=!0),e}return t.result}function She(t){if(t&&t.status==0&&t.message=="NOTOK"&&(t.result||"").toLowerCase().indexOf("rate limit")>=0){let e=new Error("throttled response");throw e.result=JSON.stringify(t),e.throttleRetry=!0,e}if(t.jsonrpc!="2.0"){let e=new Error("invalid response");throw e.result=JSON.stringify(t),e}if(t.error){let e=new Error(t.error.message||"unknown error");throw t.error.code&&(e.code=t.error.code),t.error.data&&(e.data=t.error.data),e}return t.result}function Ihe(t){if(t==="pending")throw new Error("pending not supported");return t==="latest"?t:parseInt(t.substring(2),16)}function tL(t,e,r){if(t==="call"&&e.code===fe.errors.SERVER_ERROR){let n=e.error;if(n&&(n.message.match(/reverted/i)||n.message.match(/VM execution error/i))){let o=n.data;if(o&&(o="0x"+o.replace(/^.*0x/i,"")),Zt(o))return o;up.throwError("missing revert data in call exception",fe.errors.CALL_EXCEPTION,{error:e,data:"0x"})}}let i=e.message;throw e.code===fe.errors.SERVER_ERROR&&(e.error&&typeof e.error.message=="string"?i=e.error.message:typeof e.body=="string"?i=e.body:typeof e.responseText=="string"&&(i=e.responseText)),i=(i||"").toLowerCase(),i.match(/insufficient funds/)&&up.throwError("insufficient funds for intrinsic transaction cost",fe.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:r}),i.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&up.throwError("nonce has already been used",fe.errors.NONCE_EXPIRED,{error:e,method:t,transaction:r}),i.match(/another transaction with same nonce/)&&up.throwError("replacement fee too low",fe.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:r}),i.match(/execution failed due to an exception|execution reverted/)&&up.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",fe.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:r}),e}var $5=class extends Pf{constructor(e,r){super(e),ye(this,"baseUrl",this.getBaseUrl()),ye(this,"apiKey",r||null)}getBaseUrl(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"matic":return"https://api.polygonscan.com";case"maticmum":return"https://api-testnet.polygonscan.com";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io";default:}return up.throwArgumentError("unsupported network","network",this.network.name)}getUrl(e,r){let i=Object.keys(r).reduce((o,s)=>{let a=r[s];return a!=null&&(o+=`&${s}=${a}`),o},""),n=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.baseUrl}/api?module=${e}${i}${n}`}getPostUrl(){return`${this.baseUrl}/api`}getPostData(e,r){return r.module=e,r.apikey=this.apiKey,r}fetch(e,r,i){return cE(this,void 0,void 0,function*(){let n=i?this.getPostUrl():this.getUrl(e,r),o=i?this.getPostData(e,r):null,s=e==="proxy"?She:Hze;this.emit("debug",{action:"request",request:n,provider:this});let a={url:n,throttleSlotInterval:1e3,throttleCallback:(g,b)=>(this.isCommunityResource()&&Nf(),Promise.resolve(!0))},c=null;o&&(a.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},c=Object.keys(o).map(g=>`${g}=${o[g]}`).join("&"));let h=yield Jl(a,c,s||She);return this.emit("debug",{action:"response",request:n,response:vn(h),provider:this}),h})}detectNetwork(){return cE(this,void 0,void 0,function*(){return this.network})}perform(e,r){let i=Object.create(null,{perform:{get:()=>super.perform}});return cE(this,void 0,void 0,function*(){switch(e){case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getBalance":return this.fetch("account",{action:"balance",address:r.address,tag:r.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:r.address,tag:r.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:r.address,tag:r.blockTag});case"getStorageAt":return this.fetch("proxy",{action:"eth_getStorageAt",address:r.address,position:r.position,tag:r.blockTag});case"sendTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:r.signedTransaction},!0).catch(n=>tL("sendTransaction",n,r.signedTransaction));case"getBlock":if(r.blockTag)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:r.blockTag,boolean:r.includeTransactions?"true":"false"});throw new Error("getBlock by blockHash not implemented");case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:r.transactionHash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:r.transactionHash});case"call":{if(r.blockTag!=="latest")throw new Error("EtherscanProvider does not support blockTag for call");let n=Che(r.transaction);n.module="proxy",n.action="eth_call";try{return yield this.fetch("proxy",n,!0)}catch(o){return tL("call",o,r.transaction)}}case"estimateGas":{let n=Che(r.transaction);n.module="proxy",n.action="eth_estimateGas";try{return yield this.fetch("proxy",n,!0)}catch(o){return tL("estimateGas",o,r.transaction)}}case"getLogs":{let n={action:"getLogs"};if(r.filter.fromBlock&&(n.fromBlock=Ihe(r.filter.fromBlock)),r.filter.toBlock&&(n.toBlock=Ihe(r.filter.toBlock)),r.filter.address&&(n.address=r.filter.address),r.filter.topics&&r.filter.topics.length>0&&(r.filter.topics.length>1&&up.throwError("unsupported topic count",fe.errors.UNSUPPORTED_OPERATION,{topics:r.filter.topics}),r.filter.topics.length===1)){let a=r.filter.topics[0];(typeof a!="string"||a.length!==66)&&up.throwError("unsupported topic format",fe.errors.UNSUPPORTED_OPERATION,{topic0:a}),n.topic0=a}let o=yield this.fetch("logs",n),s={};for(let a=0;a<o.length;a++){let c=o[a];if(c.blockHash==null){if(s[c.blockNumber]==null){let h=yield this.getBlock(c.blockNumber);h&&(s[c.blockNumber]=h.hash)}c.blockHash=s[c.blockNumber]}}return o}case"getEtherPrice":return this.network.name!=="homestead"?0:parseFloat((yield this.fetch("stats",{action:"ethprice"})).ethusd);default:break}return i.perform.call(this,e,r)})}getHistory(e,r,i){return cE(this,void 0,void 0,function*(){let n={action:"txlist",address:yield this.resolveName(e),startblock:r??0,endblock:i??99999999,sort:"asc"};return(yield this.fetch("account",n)).map(s=>{["contractAddress","to"].forEach(function(c){s[c]==""&&delete s[c]}),s.creates==null&&s.contractAddress!=null&&(s.creates=s.contractAddress);let a=this.formatter.transactionResponse(s);return s.timeStamp&&(a.timestamp=parseInt(s.timeStamp)),a})})}isCommunityResource(){return this.apiKey==null}};var fE=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},$m=new fe(Si);function lE(){return new Date().getTime()}function The(t){let e=null;for(let r=0;r<t.length;r++){let i=t[r];if(i==null)return null;e?e.name===i.name&&e.chainId===i.chainId&&(e.ensAddress===i.ensAddress||e.ensAddress==null&&i.ensAddress==null)||$m.throwArgumentError("provider mismatch","networks",t):e=i}return e}function Rhe(t,e){t=t.slice().sort();let r=Math.floor(t.length/2);if(t.length%2)return t[r];let i=t[r-1],n=t[r];return e!=null&&Math.abs(i-n)>e?null:(i+n)/2}function m3(t){if(t===null)return"null";if(typeof t=="number"||typeof t=="boolean")return JSON.stringify(t);if(typeof t=="string")return t;if(Ue.isBigNumber(t))return t.toString();if(Array.isArray(t))return JSON.stringify(t.map(e=>m3(e)));if(typeof t=="object"){let e=Object.keys(t);return e.sort(),"{"+e.map(r=>{let i=t[r];return typeof i=="function"?i="[function]":i=m3(i),JSON.stringify(r)+":"+i}).join(",")+"}"}throw new Error("unknown value type: "+typeof t)}var zze=1;function khe(t){let e=null,r=null,i=new Promise(s=>{e=function(){r&&(clearTimeout(r),r=null),s()},r=setTimeout(e,t)}),n=s=>(i=i.then(s),i);function o(){return i}return{cancel:e,getPromise:o,wait:n}}var Vze=[fe.errors.CALL_EXCEPTION,fe.errors.INSUFFICIENT_FUNDS,fe.errors.NONCE_EXPIRED,fe.errors.REPLACEMENT_UNDERPRICED,fe.errors.UNPREDICTABLE_GAS_LIMIT],Kze=["address","args","errorArgs","errorSignature","method","transaction"];function uE(t,e){let r={weight:t.weight};return Object.defineProperty(r,"provider",{get:()=>t.provider}),t.start&&(r.start=t.start),e&&(r.duration=e-t.start),t.done&&(t.error?r.error=t.error:r.result=t.result||null),r}function Gze(t,e){return function(r){let i={};r.forEach(o=>{let s=t(o.result);i[s]||(i[s]={count:0,result:o.result}),i[s].count++});let n=Object.keys(i);for(let o=0;o<n.length;o++){let s=i[n[o]];if(s.count>=e)return s.result}}}function Zze(t,e,r){let i=m3;switch(e){case"getBlockNumber":return function(n){let o=n.map(a=>a.result),s=Rhe(n.map(a=>a.result),2);if(s!=null)return s=Math.ceil(s),o.indexOf(s+1)>=0&&s++,s>=t._highestBlockNumber&&(t._highestBlockNumber=s),t._highestBlockNumber};case"getGasPrice":return function(n){let o=n.map(s=>s.result);return o.sort(),o[Math.floor(o.length/2)]};case"getEtherPrice":return function(n){return Rhe(n.map(o=>o.result))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":i=function(n){return n==null?null:(n=pi(n),n.confirmations=-1,m3(n))};break;case"getBlock":r.includeTransactions?i=function(n){return n==null?null:(n=pi(n),n.transactions=n.transactions.map(o=>(o=pi(o),o.confirmations=-1,o)),m3(n))}:i=function(n){return n==null?null:m3(n)};break;default:throw new Error("unknown method: "+e)}return Gze(i,t.quorum)}function W5(t,e){return fE(this,void 0,void 0,function*(){let r=t.provider;return r.blockNumber!=null&&r.blockNumber>=e||e===-1?r:Ql(()=>new Promise((i,n)=>{setTimeout(function(){return r.blockNumber>=e?i(r):t.cancelled?i(null):i(void 0)},0)}),{oncePoll:r})})}function Yze(t,e,r,i){return fE(this,void 0,void 0,function*(){let n=t.provider;switch(r){case"getBlockNumber":case"getGasPrice":return n[r]();case"getEtherPrice":if(n.getEtherPrice)return n.getEtherPrice();break;case"getBalance":case"getTransactionCount":case"getCode":return i.blockTag&&Zt(i.blockTag)&&(n=yield W5(t,e)),n[r](i.address,i.blockTag||"latest");case"getStorageAt":return i.blockTag&&Zt(i.blockTag)&&(n=yield W5(t,e)),n.getStorageAt(i.address,i.position,i.blockTag||"latest");case"getBlock":return i.blockTag&&Zt(i.blockTag)&&(n=yield W5(t,e)),n[i.includeTransactions?"getBlockWithTransactions":"getBlock"](i.blockTag||i.blockHash);case"call":case"estimateGas":return i.blockTag&&Zt(i.blockTag)&&(n=yield W5(t,e)),r==="call"&&i.blockTag?n[r](i.transaction,i.blockTag):n[r](i.transaction);case"getTransaction":case"getTransactionReceipt":return n[r](i.transactionHash);case"getLogs":{let o=i.filter;return(o.fromBlock&&Zt(o.fromBlock)||o.toBlock&&Zt(o.toBlock))&&(n=yield W5(t,e)),n.getLogs(o)}}return $m.throwError("unknown method error",fe.errors.UNKNOWN_ERROR,{method:r,params:i})})}var q5=class extends Pf{constructor(e,r){e.length===0&&$m.throwArgumentError("missing providers","providers",e);let i=e.map((s,a)=>{if(Xc.isProvider(s)){let g=N5(s)?2e3:750;return Object.freeze({provider:s,weight:1,stallTimeout:g,priority:1})}let c=pi(s);c.priority==null&&(c.priority=1),c.stallTimeout==null&&(c.stallTimeout=N5(s)?2e3:750),c.weight==null&&(c.weight=1);let h=c.weight;return(h%1||h>512||h<1)&&$m.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${a}].weight`,h),Object.freeze(c)}),n=i.reduce((s,a)=>s+a.weight,0);r==null?r=n/2:r>n&&$m.throwArgumentError("quorum will always fail; larger than total weight","quorum",r);let o=The(i.map(s=>s.provider.network));o==null&&(o=new Promise((s,a)=>{setTimeout(()=>{this.detectNetwork().then(s,a)},0)})),super(o),ye(this,"providerConfigs",Object.freeze(i)),ye(this,"quorum",r),this._highestBlockNumber=-1}detectNetwork(){return fE(this,void 0,void 0,function*(){let e=yield Promise.all(this.providerConfigs.map(r=>r.provider.getNetwork()));return The(e)})}perform(e,r){return fE(this,void 0,void 0,function*(){if(e==="sendTransaction"){let c=yield Promise.all(this.providerConfigs.map(h=>h.provider.sendTransaction(r.signedTransaction).then(g=>g.hash,g=>g)));for(let h=0;h<c.length;h++){let g=c[h];if(typeof g=="string")return g}throw c[0]}this._highestBlockNumber===-1&&e!=="getBlockNumber"&&(yield this.getBlockNumber());let i=Zze(this,e,r),n=C5(this.providerConfigs.map(pi));n.sort((c,h)=>c.priority-h.priority);let o=this._highestBlockNumber,s=0,a=!0;for(;;){let c=lE(),h=n.filter(A=>A.runner&&c-A.start<A.stallTimeout).reduce((A,T)=>A+T.weight,0);for(;h<this.quorum&&s<n.length;){let A=n[s++],T=zze++;A.start=lE(),A.staller=khe(A.stallTimeout),A.staller.wait(()=>{A.staller=null}),A.runner=Yze(A,o,e,r).then(P=>{A.done=!0,A.result=P,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:T,backend:uE(A,lE()),request:{method:e,params:vn(r)},provider:this})},P=>{A.done=!0,A.error=P,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:T,backend:uE(A,lE()),request:{method:e,params:vn(r)},provider:this})}),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:T,backend:uE(A,null),request:{method:e,params:vn(r)},provider:this}),h+=A.weight}let g=[];n.forEach(A=>{A.done||!A.runner||(g.push(A.runner),A.staller&&g.push(A.staller.getPromise()))}),g.length&&(yield Promise.race(g));let b=n.filter(A=>A.done&&A.error==null);if(b.length>=this.quorum){let A=i(b);if(A!==void 0)return n.forEach(T=>{T.staller&&T.staller.cancel(),T.cancelled=!0}),A;a||(yield khe(100).getPromise()),a=!1}let E=n.reduce((A,T)=>{if(!T.done||T.error==null)return A;let P=T.error.code;return Vze.indexOf(P)>=0&&(A[P]||(A[P]={error:T.error,weight:0}),A[P].weight+=T.weight),A},{});if(Object.keys(E).forEach(A=>{let T=E[A];if(T.weight<this.quorum)return;n.forEach(j=>{j.staller&&j.staller.cancel(),j.cancelled=!0});let P=T.error,L={};Kze.forEach(j=>{P[j]!=null&&(L[j]=P[j])}),$m.throwError(P.reason||P.message,A,L)}),n.filter(A=>!A.done).length===0)break}return n.forEach(c=>{c.staller&&c.staller.cancel(),c.cancelled=!0}),$m.throwError("failed to meet quorum",fe.errors.SERVER_ERROR,{method:e,params:r,results:n.map(c=>uE(c)),provider:this})})}};var rL=null;var hE=new fe(Si),H5="84842078b09946638c03157f83405213",z5=class extends bh{constructor(e,r){let i=new g3(e,r),n=i.connection;n.password&&hE.throwError("INFURA WebSocket project secrets unsupported",fe.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"});let o=n.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(o,e),ye(this,"apiKey",i.projectId),ye(this,"projectId",i.projectId),ye(this,"projectSecret",i.projectSecret)}isCommunityResource(){return this.projectId===H5}},g3=class extends bs{static getWebSocketProvider(e,r){return new z5(e,r)}static getApiKey(e){let r={apiKey:H5,projectId:H5,projectSecret:null};return e==null||(typeof e=="string"?r.projectId=e:e.projectSecret!=null?(hE.assertArgument(typeof e.projectId=="string","projectSecret requires a projectId","projectId",e.projectId),hE.assertArgument(typeof e.projectSecret=="string","invalid projectSecret","projectSecret","[REDACTED]"),r.projectId=e.projectId,r.projectSecret=e.projectSecret):e.projectId&&(r.projectId=e.projectId),r.apiKey=r.projectId),r}static getUrl(e,r){let i=null;switch(e?e.name:"unknown"){case"homestead":i="mainnet.infura.io";break;case"goerli":i="goerli.infura.io";break;case"sepolia":i="sepolia.infura.io";break;case"matic":i="polygon-mainnet.infura.io";break;case"maticmum":i="polygon-mumbai.infura.io";break;case"optimism":i="optimism-mainnet.infura.io";break;case"optimism-goerli":i="optimism-goerli.infura.io";break;case"arbitrum":i="arbitrum-mainnet.infura.io";break;case"arbitrum-goerli":i="arbitrum-goerli.infura.io";break;default:hE.throwError("unsupported network",fe.errors.INVALID_ARGUMENT,{argument:"network",value:e})}let n={allowGzip:!0,url:"https://"+i+"/v3/"+r.projectId,throttleCallback:(o,s)=>(r.projectId===H5&&Nf(),Promise.resolve(!0))};return r.projectSecret!=null&&(n.user="",n.password=r.projectSecret),n}isCommunityResource(){return this.projectId===H5}};var dE=class extends ma{send(e,r){let i={method:e,params:r,id:this._nextId++,jsonrpc:"2.0"};this._pendingBatch==null&&(this._pendingBatch=[]);let n={request:i,resolve:null,reject:null},o=new Promise((s,a)=>{n.resolve=s,n.reject=a});return this._pendingBatch.push(n),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout(()=>{let s=this._pendingBatch;this._pendingBatch=null,this._pendingBatchAggregator=null;let a=s.map(c=>c.request);return this.emit("debug",{action:"requestBatch",request:vn(a),provider:this}),Jl(this.connection,JSON.stringify(a)).then(c=>{this.emit("debug",{action:"response",request:a,response:c,provider:this}),s.forEach((h,g)=>{let b=c[g];if(b.error){let E=new Error(b.error.message);E.code=b.error.code,E.data=b.error.data,h.reject(E)}else h.resolve(b.result)})},c=>{this.emit("debug",{action:"response",error:c,request:a,provider:this}),s.forEach(h=>{h.reject(c)})})},10)),o}};var iL=new fe(Si),Jze="ETHERS_JS_SHARED",V5=class extends bs{static getApiKey(e){return e&&typeof e!="string"&&iL.throwArgumentError("invalid apiKey","apiKey",e),e||Jze}static getUrl(e,r){iL.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.");let i=null;switch(e.name){case"homestead":i="https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc";break;case"ropsten":i="https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc";break;case"rinkeby":i="https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc";break;case"goerli":i="https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc";break;case"kovan":i="https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";break;default:iL.throwArgumentError("unsupported network","network",arguments[0])}return i+"?apiKey="+r}};var Nhe=new fe(Si),Phe="62e1ad51b37b8e00394bda3b",K5=class extends bs{static getApiKey(e){let r={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return e==null?r.applicationId=Phe:typeof e=="string"?r.applicationId=e:e.applicationSecretKey!=null?(r.applicationId=e.applicationId,r.applicationSecretKey=e.applicationSecretKey):e.applicationId?r.applicationId=e.applicationId:Nhe.throwArgumentError("unsupported PocketProvider apiKey","apiKey",e),r}static getUrl(e,r){let i=null;switch(e?e.name:"unknown"){case"goerli":i="eth-goerli.gateway.pokt.network";break;case"homestead":i="eth-mainnet.gateway.pokt.network";break;case"kovan":i="poa-kovan.gateway.pokt.network";break;case"matic":i="poly-mainnet.gateway.pokt.network";break;case"maticmum":i="polygon-mumbai-rpc.gateway.pokt.network";break;case"rinkeby":i="eth-rinkeby.gateway.pokt.network";break;case"ropsten":i="eth-ropsten.gateway.pokt.network";break;default:Nhe.throwError("unsupported network",fe.errors.INVALID_ARGUMENT,{argument:"network",value:e})}let n=`https://${i}/v1/lb/${r.applicationId}`,o={headers:{},url:n};return r.applicationSecretKey!=null&&(o.user="",o.password=r.applicationSecretKey),o}isCommunityResource(){return this.applicationId===Phe}};var Ohe=new fe(Si),Qze=1;function Mhe(t,e){let r="Web3LegacyFetcher";return function(i,n){let o={method:i,params:n,id:Qze++,jsonrpc:"2.0"};return new Promise((s,a)=>{this.emit("debug",{action:"request",fetcher:r,request:vn(o),provider:this}),e(o,(c,h)=>{if(c)return this.emit("debug",{action:"response",fetcher:r,error:c,request:o,provider:this}),a(c);if(this.emit("debug",{action:"response",fetcher:r,request:o,response:h,provider:this}),h.error){let g=new Error(h.error.message);return g.code=h.error.code,g.data=h.error.data,a(g)}s(h.result)})})}}function Xze(t){return function(e,r){r==null&&(r=[]);let i={method:e,params:r};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:vn(i),provider:this}),t.request(i).then(n=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:i,response:n,provider:this}),n),n=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:i,error:n,provider:this}),n})}}var G5=class extends ma{constructor(e,r){e==null&&Ohe.throwArgumentError("missing provider","provider",e);let i=null,n=null,o=null;typeof e=="function"?(i="unknown:",n=e):(i=e.host||e.path||"",!i&&e.isMetaMask&&(i="metamask"),o=e,e.request?(i===""&&(i="eip-1193:"),n=Xze(e)):e.sendAsync?n=Mhe(e,e.sendAsync.bind(e)):e.send?n=Mhe(e,e.send.bind(e)):Ohe.throwArgumentError("unsupported provider","provider",e),i||(i="unknown:")),super(i,r),ye(this,"jsonRpcFetchFunc",n),ye(this,"provider",o)}send(e,r){return this.jsonRpcFetchFunc(e,r)}};var Dhe=new fe(Si);function pE(t,e){if(t==null&&(t="homestead"),typeof t=="string"){let i=t.match(/^(ws|http)s?:/i);if(i)switch(i[1].toLowerCase()){case"http":case"https":return new ma(t);case"ws":case"wss":return new bh(t);default:Dhe.throwArgumentError("unsupported URL scheme","network",t)}}let r=T5(t);return(!r||!r._defaultProvider)&&Dhe.throwError("unsupported getDefaultProvider network",fe.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:t}),r._defaultProvider({FallbackProvider:q5,AlchemyProvider:p3,AnkrProvider:F5,CloudflareProvider:j5,EtherscanProvider:$5,InfuraProvider:g3,JsonRpcProvider:ma,NodesmithProvider:V5,PocketProvider:K5,Web3Provider:G5,IpcProvider:null},e)}var ac={};Mi(ac,{AbiCoder:()=>Ww,ConstructorFragment:()=>gf,ErrorFragment:()=>Im,EventFragment:()=>sh,FormatTypes:()=>si,Fragment:()=>mf,FunctionFragment:()=>wf,HDNode:()=>Rf,Indexed:()=>ch,Interface:()=>np,LogDescription:()=>Vw,Logger:()=>fe,ParamType:()=>Vo,RLP:()=>u_,SigningKey:()=>nl,SupportedAlgorithm:()=>If,TransactionDescription:()=>Kw,TransactionTypes:()=>j_,UnicodeNormalizationForm:()=>qs,Utf8ErrorFuncs:()=>A_,Utf8ErrorReason:()=>ms,_TypedDataEncoder:()=>Qc,_fetchData:()=>HD,_toEscapedUtf8String:()=>ZM,accessListify:()=>sc,arrayify:()=>ke,base58:()=>hh,base64:()=>tD,checkProperties:()=>Lw,checkResultErrors:()=>Uw,commify:()=>qhe,computeAddress:()=>ol,computeHmac:()=>dh,computePublicKey:()=>v5,concat:()=>Fr,deepCopy:()=>vn,defaultAbiCoder:()=>d5,defaultPath:()=>ph,defineReadOnly:()=>ye,dnsEncode:()=>m5,entropyToMnemonic:()=>Fm,fetchJson:()=>Jl,formatBytes32String:()=>YM,formatEther:()=>Hhe,formatUnits:()=>nL,getAccountPath:()=>D0e,getAddress:()=>$r,getContractAddress:()=>Rm,getCreate2Address:()=>Yue,getIcapAddress:()=>Zue,getJsonWalletAddress:()=>FD,getStatic:()=>bn,hashMessage:()=>zw,hexConcat:()=>Vn,hexDataLength:()=>ps,hexDataSlice:()=>ji,hexStripZeros:()=>UM,hexValue:()=>hf,hexZeroPad:()=>Kr,hexlify:()=>De,id:()=>tc,isAddress:()=>Gue,isBytes:()=>Zc,isBytesLike:()=>nh,isHexString:()=>Zt,isValidMnemonic:()=>M0e,isValidName:()=>iD,joinSignature:()=>i5,keccak256:()=>jr,mnemonicToEntropy:()=>s3,mnemonicToSeed:()=>PD,namehash:()=>ip,nameprep:()=>eD,parseBytes32String:()=>JM,parseEther:()=>zhe,parseTransaction:()=>$_,parseUnits:()=>oL,poll:()=>Ql,randomBytes:()=>kf,recoverAddress:()=>Mm,recoverPublicKey:()=>F_,resolveProperties:()=>$i,ripemd160:()=>_5,serializeTransaction:()=>b5,sha256:()=>pa,sha512:()=>TD,shallowCopy:()=>pi,shuffled:()=>C5,solidityKeccak256:()=>Uhe,solidityPack:()=>gE,soliditySha256:()=>Fhe,splitSignature:()=>df,stripZeros:()=>Xa,toUtf8Bytes:()=>fi,toUtf8CodePoints:()=>rp,toUtf8String:()=>ha,verifyMessage:()=>Q0e,verifyTypedData:()=>X0e,zeroPad:()=>Cm});var Lhe="solidity/5.7.0";var eVe=new RegExp("^bytes([0-9]+)$"),tVe=new RegExp("^(u?int)([0-9]*)$"),rVe=new RegExp("^(.*)\\[([0-9]*)\\]$"),iVe="0000000000000000000000000000000000000000000000000000000000000000",w3=new fe(Lhe);function Bhe(t,e,r){switch(t){case"address":return r?Cm(e,32):ke(e);case"string":return fi(e);case"bytes":return ke(e);case"bool":return e=e?"0x01":"0x00",r?Cm(e,32):ke(e)}let i=t.match(tVe);if(i){let n=parseInt(i[2]||"256");return(i[2]&&String(n)!==i[2]||n%8!==0||n===0||n>256)&&w3.throwArgumentError("invalid number type","type",t),r&&(n=256),e=Ue.from(e).toTwos(n),Cm(e,n/8)}if(i=t.match(eVe),i){let n=parseInt(i[1]);return(String(n)!==i[1]||n===0||n>32)&&w3.throwArgumentError("invalid bytes type","type",t),ke(e).byteLength!==n&&w3.throwArgumentError(`invalid value for ${t}`,"value",e),r?ke((e+iVe).substring(0,66)):e}if(i=t.match(rVe),i&&Array.isArray(e)){let n=i[1];parseInt(i[2]||String(e.length))!=e.length&&w3.throwArgumentError(`invalid array length for ${t}`,"value",e);let s=[];return e.forEach(function(a){s.push(Bhe(n,a,!0))}),Fr(s)}return w3.throwArgumentError("invalid type","type",t)}function gE(t,e){t.length!=e.length&&w3.throwArgumentError("wrong number of values; expected ${ types.length }","values",e);let r=[];return t.forEach(function(i,n){r.push(Bhe(i,e[n]))}),De(Fr(r))}function Uhe(t,e){return jr(gE(t,e))}function Fhe(t,e){return pa(gE(t,e))}var jhe="units/5.7.0";var $he=new fe(jhe),Whe=["wei","kwei","mwei","gwei","szabo","finney","ether"];function qhe(t){let e=String(t).split(".");(e.length>2||!e[0].match(/^-?[0-9]*$/)||e[1]&&!e[1].match(/^[0-9]*$/)||t==="."||t==="-.")&&$he.throwArgumentError("invalid value","value",t);let r=e[0],i="";for(r.substring(0,1)==="-"&&(i="-",r=r.substring(1));r.substring(0,1)==="0";)r=r.substring(1);r===""&&(r="0");let n="";for(e.length===2&&(n="."+(e[1]||"0"));n.length>2&&n[n.length-1]==="0";)n=n.substring(0,n.length-1);let o=[];for(;r.length;)if(r.length<=3){o.unshift(r);break}else{let s=r.length-3;o.unshift(r.substring(s)),r=r.substring(0,s)}return i+o.join(",")+n}function nL(t,e){if(typeof e=="string"){let r=Whe.indexOf(e);r!==-1&&(e=3*r)}return Mw(t,e??18)}function oL(t,e){if(typeof t!="string"&&$he.throwArgumentError("value must be a string","value",t),typeof e=="string"){let r=Whe.indexOf(e);r!==-1&&(e=3*r)}return Jc(t,e??18)}function Hhe(t){return nL(t,18)}function zhe(t){return oL(t,18)}var wE="ethers/5.7.2";var Vhe=new fe(wE);try{let t=window;t._ethers==null&&(t._ethers=yh)}catch{}var Ii={WALLET_ID:"@w3m/wallet_id",ERROR_CODE_UNRECOGNIZED_CHAIN_ID:4902,ERROR_CODE_DEFAULT:5e3};var Eo={getCaipDefaultChain(t){if(t)return{id:`${Ge.EIP155}:${t.chainId}`,name:t.name,imageId:to.EIP155NetworkImageIds[t.chainId]}},hexStringToNumber(t){let e=t.startsWith("0x")?t.slice(2):t;return parseInt(e,16)},numberToHexString(t){return`0x${t.toString(16)}`},async getUserInfo(t){let[e,r]=await Promise.all([Eo.getAddress(t),Eo.getChainId(t)]);return{chainId:r,address:e}},async getChainId(t){let e=await t.request({method:"eth_chainId"});return Number(e)},async getAddress(t){let[e]=await t.request({method:"eth_accounts"});return e},async addEthereumChain(t,e){await t.request({method:"wallet_addEthereumChain",params:[{chainId:Eo.numberToHexString(e.chainId),rpcUrls:[e.rpcUrl],chainName:e.name,nativeCurrency:{name:e.currency,decimals:18,symbol:e.currency},blockExplorerUrls:[e.explorerUrl],iconUrls:[to.EIP155NetworkImageIds[e.chainId]]}]})}};Qo();on();var Zn=Jt({provider:void 0,providerType:void 0,address:void 0,chainId:void 0,status:"reconnecting",isConnected:!1}),ut={state:Zn,subscribeKey(t,e){return hi(Zn,t,e)},subscribe(t){return Dr(Zn,()=>t(Zn))},setProvider(t){t&&(Zn.provider=Mo(t))},setProviderType(t){Zn.providerType=t},setAddress(t){Zn.address=t},setPreferredAccountType(t){Zn.preferredAccountType=t},setChainId(t){Zn.chainId=t},setStatus(t){Zn.status=t},setIsConnected(t){Zn.isConnected=t},setError(t){Zn.error=t},reset(){Zn.provider=void 0,Zn.address=void 0,Zn.chainId=void 0,Zn.providerType=void 0,Zn.status="disconnected",Zn.isConnected=!1,Zn.error=void 0,Zn.preferredAccountType=void 0}};Di();var vE=class extends Kb{constructor(e){let{ethersConfig:r,siweConfig:i,chains:n,defaultChain:o,tokens:s,chainImages:a,_sdkVersion:c,...h}=e;if(!r)throw new Error("web3modal:constructor - ethersConfig is undefined");if(!h.projectId)throw new Error("web3modal:constructor - projectId is undefined");let g={switchCaipNetwork:async E=>{let A=ml.caipNetworkIdToNumber(E?.id);if(A)try{ut.setError(void 0),await this.switchNetwork(A)}catch(T){throw ut.setError(T),new Error("networkControllerClient:switchCaipNetwork - unable to switch chain")}},getApprovedCaipNetworksData:async()=>new Promise(async E=>{if(localStorage.getItem(Ii.WALLET_ID)?.includes(Ge.WALLET_CONNECT_CONNECTOR_ID)){let T=await this.getWalletConnectProvider();if(!T)throw new Error("networkControllerClient:getApprovedCaipNetworks - provider is undefined");let P=T.signer?.session?.namespaces,L=P?.[Ge.EIP155]?.methods,j=P?.[Ge.EIP155]?.chains,$={supportsAllNetworks:L?.includes(Ge.ADD_CHAIN_METHOD)??!1,approvedCaipNetworkIds:j};E($)}else E({approvedCaipNetworkIds:void 0,supportsAllNetworks:!0})})},b={connectWalletConnect:async E=>{let A=await this.getWalletConnectProvider();if(!A)throw new Error("connectionControllerClient:getWalletConnectUri - provider is undefined");if(A.on("display_uri",T=>{E(T)}),i?.options?.enabled){let{SIWEController:T,getDidChainId:P,getDidAddress:L}=await Promise.resolve().then(()=>(k0(),R0)),$=(await A.authenticate({nonce:await i.getNonce(),methods:PM,...await i.getMessageParams()}))?.auths?.[0];if($){let{p:G,s:Z}=$,te=P(G.iss),se=L(G.iss);se&&te&&T.setSession({address:se,chainId:parseInt(te,10)});try{let X=A.signer.client.formatAuthMessage({request:G,iss:G.iss});await T.verifyMessage({message:X,signature:Z.s,cacao:$})}catch(X){throw console.error("Error verifying message",X),await A.disconnect().catch(console.error),await T.signOut().catch(console.error),X}}}else await A.connect();await this.setWalletConnectProvider()},connectExternal:async({id:E,info:A,provider:T})=>{if(E===Ge.INJECTED_CONNECTOR_ID){let P=r.injected;if(!P)throw new Error("connectionControllerClient:connectInjected - provider is undefined");try{ut.setError(void 0),await P.request({method:"eth_requestAccounts"}),this.setInjectedProvider(r)}catch(L){ut.setError(L)}}else if(E===Ge.EIP6963_CONNECTOR_ID&&A&&T){try{ut.setError(void 0),await T.request({method:"eth_requestAccounts"})}catch(P){ut.setError(P)}this.setEIP6963Provider(T,A.name)}else if(E===Ge.COINBASE_SDK_CONNECTOR_ID){let P=r.coinbase;if(!P)throw new Error("connectionControllerClient:connectCoinbase - connector is undefined");try{ut.setError(void 0),await P.request({method:"eth_requestAccounts"}),this.setCoinbaseProvider(r)}catch(L){throw ut.setError(L),new Error(L.message)}}},checkInstalled:E=>E?r.injected&&!window?.ethereum?!1:E.some(A=>!!window.ethereum?.[String(A)]):!!window.ethereum,disconnect:async()=>{let E=ut.state.provider,A=ut.state.providerType;if(localStorage.removeItem(Ii.WALLET_ID),ut.reset(),i?.options?.signOutOnDisconnect){let{SIWEController:T}=await Promise.resolve().then(()=>(k0(),R0));await T.signOut()}A===Ge.WALLET_CONNECT_CONNECTOR_ID?await E.disconnect():E&&E.emit("disconnect")},signMessage:async E=>{let A=ut.state.provider;if(!A)throw new Error("connectionControllerClient:signMessage - provider is undefined");let T=ac.isHexString(E)?E:ac.hexlify(ac.toUtf8Bytes(E));return await A.request({method:"personal_sign",params:[T,this.getAddress()]})},parseUnits:(E,A)=>yh.utils.parseUnits(E,A).toBigInt(),formatUnits:(E,A)=>yh.utils.formatUnits(E,A),sendTransaction:async E=>{let A=ut.state.provider,T=ut.state.address;if(!A)throw new Error("connectionControllerClient:sendTransaction - provider is undefined");if(!T)throw new Error("connectionControllerClient:sendTransaction - address is undefined");let P={to:E.to,value:E.value,gasLimit:E.gas,gasPrice:E.gasPrice,data:E.data,type:0};return(await(await new yh.providers.Web3Provider(A).getSigner().sendTransaction(P)).wait())?.blockHash||null}};super({networkControllerClient:g,connectionControllerClient:b,siweControllerClient:i,defaultChain:Eo.getCaipDefaultChain(o),tokens:dT.getCaipTokens(s),_sdkVersion:c??`html-ethers5-${Ge.VERSION}`,...h}),this.hasSyncedConnectedAccount=!1,this.EIP6963Providers=[],this.options=void 0,this.options=e,this.metadata=r.metadata,this.projectId=h.projectId,this.chains=n,this.createProvider(),ut.subscribeKey("address",()=>{this.syncAccount()}),ut.subscribeKey("chainId",()=>{this.syncNetwork(a)}),this.syncRequestedNetworks(n,a),this.syncConnectors(r),r.injected&&this.checkActiveInjectedProvider(r),r.coinbase&&this.checkActiveCoinbaseProvider(r),typeof window<"u"&&(this.listenConnectors(!0),this.checkActive6963Provider()),this.setEIP6963Enabled(r.EIP6963)}getState(){let e=super.getState();return{...e,selectedNetworkId:ml.caipNetworkIdToNumber(e.selectedNetworkId)}}subscribeState(e){return super.subscribeState(r=>e({...r,selectedNetworkId:ml.caipNetworkIdToNumber(r.selectedNetworkId)}))}setAddress(e){let r=e?ac.getAddress(e):void 0;ut.setAddress(r)}getAddress(){let{address:e}=ut.state;return e&&ac.getAddress(e)}getError(){return ut.state.error}getChainId(){return ut.state.chainId}getStatus(){return ut.state.status}getIsConnected(){return ut.state.isConnected}getWalletProvider(){return ut.state.provider}getWalletProviderType(){return ut.state.providerType}subscribeProvider(e){return ut.subscribe(e)}async disconnect(){let{provider:e,providerType:r}=ut.state;localStorage.removeItem(Ii.WALLET_ID),ut.reset(),r==="injected"||r==="eip6963"?e?.emit("disconnect"):await e.disconnect()}createProvider(){return!this.walletConnectProviderInitPromise&&typeof window<"u"&&(this.walletConnectProviderInitPromise=this.initWalletConnectProvider()),this.walletConnectProviderInitPromise}async initWalletConnectProvider(){let e={projectId:this.projectId,showQrModal:!1,rpcMap:this.chains?this.chains.reduce((r,i)=>(r[i.chainId]=i.rpcUrl,r),{}):{},optionalChains:[...this.chains.map(r=>r.chainId)],metadata:{name:this.metadata?this.metadata.name:"",description:this.metadata?this.metadata.description:"",url:this.metadata?this.metadata.url:"",icons:this.metadata?this.metadata.icons:[""]}};this.walletConnectProvider=await r_.init(e),await this.checkActiveWalletConnectProvider()}async getWalletConnectProvider(){if(!this.walletConnectProvider)try{ut.setError(void 0),await this.createProvider()}catch(e){ut.setError(e)}return this.walletConnectProvider}syncRequestedNetworks(e,r){let i=e?.map(n=>({id:`${Ge.EIP155}:${n.chainId}`,name:n.name,imageId:to.EIP155NetworkImageIds[n.chainId],imageUrl:r?.[n.chainId]}));this.setRequestedCaipNetworks(i??[])}async checkActiveWalletConnectProvider(){let e=await this.getWalletConnectProvider(),r=localStorage.getItem(Ii.WALLET_ID);e&&r===Ge.WALLET_CONNECT_CONNECTOR_ID&&await this.setWalletConnectProvider();let i=ut.state.isConnected;ut.setStatus(i?"connected":"disconnected")}checkActiveInjectedProvider(e){let r=e.injected,i=localStorage.getItem(Ii.WALLET_ID);r&&i===Ge.INJECTED_CONNECTOR_ID&&(this.setInjectedProvider(e),this.watchInjected(e))}checkActiveCoinbaseProvider(e){let r=e.coinbase,i=localStorage.getItem(Ii.WALLET_ID);r&&i===Ge.COINBASE_SDK_CONNECTOR_ID&&(r._addresses&&r._addresses?.length>0?(this.setCoinbaseProvider(e),this.watchCoinbase(e)):(localStorage.removeItem(Ii.WALLET_ID),ut.reset()))}checkActive6963Provider(){let e=window?.localStorage.getItem(Ii.WALLET_ID);if(e){let r=this.EIP6963Providers.find(i=>i.info.name===e);r&&this.setEIP6963Provider(r.provider,r.info.name)}}async setWalletConnectProvider(){window?.localStorage.setItem(Ii.WALLET_ID,Ge.WALLET_CONNECT_CONNECTOR_ID);let e=await this.getWalletConnectProvider();e&&(ut.setChainId(e.chainId),ut.setProviderType("walletConnect"),ut.setProvider(e),ut.setStatus("connected"),ut.setIsConnected(!0),this.setAddress(e.accounts?.[0]),this.watchWalletConnect())}async setEIP6963Provider(e,r){if(window?.localStorage.setItem(Ii.WALLET_ID,r),e){let{address:i,chainId:n}=await Eo.getUserInfo(e);i&&n&&(ut.setChainId(n),ut.setProviderType("eip6963"),ut.setProvider(e),ut.setStatus("connected"),ut.setIsConnected(!0),this.setAddress(i),this.watchEIP6963(e))}}async setInjectedProvider(e){window?.localStorage.setItem(Ii.WALLET_ID,Ge.INJECTED_CONNECTOR_ID);let r=e.injected;if(r){let{address:i,chainId:n}=await Eo.getUserInfo(r);i&&n&&(ut.setChainId(n),ut.setProviderType("injected"),ut.setProvider(e.injected),ut.setStatus("connected"),ut.setIsConnected(!0),this.setAddress(i),this.watchCoinbase(e))}}async setCoinbaseProvider(e){window?.localStorage.setItem(Ii.WALLET_ID,Ge.COINBASE_SDK_CONNECTOR_ID);let r=e.coinbase;if(r){let{address:i,chainId:n}=await Eo.getUserInfo(r);i&&n&&(ut.setChainId(n),ut.setProviderType("coinbaseWalletSDK"),ut.setProvider(e.coinbase),ut.setStatus("connected"),ut.setIsConnected(!0),this.setAddress(i),this.watchCoinbase(e))}}async watchWalletConnect(){let e=await this.getWalletConnectProvider();function r(){localStorage.removeItem(Ii.WALLET_ID),ut.reset(),e?.removeListener("disconnect",r),e?.removeListener("accountsChanged",n),e?.removeListener("chainChanged",i)}function i(o){if(o){let s=Eo.hexStringToNumber(o);ut.setChainId(s)}}let n=async o=>{o.length>0&&await this.setWalletConnectProvider()};e&&(e.on("disconnect",r),e.on("accountsChanged",n),e.on("chainChanged",i))}watchInjected(e){let r=e.injected;function i(){localStorage.removeItem(Ii.WALLET_ID),ut.reset(),r?.removeListener("disconnect",i),r?.removeListener("accountsChanged",n),r?.removeListener("chainChanged",o)}function n(s){let a=s?.[0];a?ut.setAddress(ac.getAddress(a)):(localStorage.removeItem(Ii.WALLET_ID),ut.reset())}function o(s){if(s){let a=typeof s=="string"?Eo.hexStringToNumber(s):Number(s);ut.setChainId(a)}}r&&(r.on("disconnect",i),r.on("accountsChanged",n),r.on("chainChanged",o))}watchEIP6963(e){function r(){localStorage.removeItem(Ii.WALLET_ID),ut.reset(),e.removeListener("disconnect",r),e.removeListener("accountsChanged",i),e.removeListener("chainChanged",n)}function i(o){let s=o?.[0];s?ut.setAddress(ac.getAddress(s)):(localStorage.removeItem(Ii.WALLET_ID),ut.reset())}function n(o){if(o){let s=typeof o=="string"?Eo.hexStringToNumber(o):Number(o);ut.setChainId(s)}}e.on("disconnect",r),e.on("accountsChanged",i),e.on("chainChanged",n)}watchCoinbase(e){let r=e.coinbase,i=localStorage.getItem(Ii.WALLET_ID);function n(){localStorage.removeItem(Ii.WALLET_ID),ut.reset(),r?.removeListener("disconnect",n),r?.removeListener("accountsChanged",o),r?.removeListener("chainChanged",s)}function o(a){a.length===0?(localStorage.removeItem(Ii.WALLET_ID),ut.reset()):ut.setAddress(a[0])}function s(a){if(a&&i===Ge.COINBASE_SDK_CONNECTOR_ID){let c=Number(a);ut.setChainId(c)}}r&&(r.on("disconnect",n),r.on("accountsChanged",o),r.on("chainChanged",s))}async syncAccount(){let e=ut.state.address,r=ut.state.chainId,i=ut.state.isConnected;if(this.resetAccount(),i&&e&&r){let n=`${Ge.EIP155}:${r}:${e}`;this.setIsConnected(i),this.setCaipAddress(n),this.syncConnectedWalletInfo(),await Promise.all([this.syncProfile(e),this.syncBalance(e),this.getApprovedCaipNetworksData()]),this.hasSyncedConnectedAccount=!0}else!i&&this.hasSyncedConnectedAccount&&(this.resetWcConnection(),this.resetNetwork())}async syncNetwork(e){let r=ut.state.address,i=ut.state.chainId,n=ut.state.isConnected;if(this.chains){let o=this.chains.find(s=>s.chainId===i);if(o){let s=`${Ge.EIP155}:${o.chainId}`;if(this.setCaipNetwork({id:s,name:o.name,imageId:to.EIP155NetworkImageIds[o.chainId],imageUrl:e?.[o.chainId]}),n&&r){let a=`${Ge.EIP155}:${i}:${r}`;if(this.setCaipAddress(a),o.explorerUrl){let c=`${o.explorerUrl}/address/${r}`;this.setAddressExplorerUrl(c)}else this.setAddressExplorerUrl(void 0);this.hasSyncedConnectedAccount&&await this.syncBalance(r)}}else n&&this.setCaipNetwork({id:`${Ge.EIP155}:${i}`})}}async syncProfile(e){let r=ut.state.chainId;try{let{name:i,avatar:n}=await this.fetchIdentity({address:e});this.setProfileName(i),this.setProfileImage(n)}catch{if(r===1){let i=new yh.providers.InfuraProvider("mainnet"),n=await i.lookupAddress(e),o=await i.getAvatar(e);n&&this.setProfileName(n),o&&this.setProfileImage(o)}else this.setProfileName(null),this.setProfileImage(null)}}async syncBalance(e){let r=ut.state.chainId;if(r&&this.chains){let i=this.chains.find(n=>n.chainId===r);if(i){let n=new yh.providers.JsonRpcProvider(i.rpcUrl,{chainId:r,name:i.name});if(n){let o=await n.getBalance(e),s=ac.formatEther(o);this.setBalance(s,i.currency)}}}}syncConnectedWalletInfo(){let e=window?.localStorage.getItem(Ii.WALLET_ID),r=ut.state.providerType;if(r===Ge.EIP6963_CONNECTOR_ID){if(e){let i=this.EIP6963Providers.find(n=>n.info.name===e);i&&this.setConnectedWalletInfo({...i.info})}}else if(r===Ge.WALLET_CONNECT_CONNECTOR_ID){let i=ut.state.provider;i.session&&this.setConnectedWalletInfo({...i.session.peer.metadata,name:i.session.peer.metadata.name,icon:i.session.peer.metadata.icons?.[0]})}else e&&this.setConnectedWalletInfo({name:e})}async switchNetwork(e){let r=ut.state.provider,i=ut.state.providerType;if(this.chains){let n=this.chains.find(o=>o.chainId===e);if(i===Ge.WALLET_CONNECT_CONNECTOR_ID&&n){let o=r;if(o)try{await o.request({method:"wallet_switchEthereumChain",params:[{chainId:Eo.numberToHexString(n.chainId)}]}),ut.setChainId(e)}catch(s){if(s.code===Ii.ERROR_CODE_UNRECOGNIZED_CHAIN_ID||s.code===Ii.ERROR_CODE_DEFAULT||s?.data?.originalError?.code===Ii.ERROR_CODE_UNRECOGNIZED_CHAIN_ID)await Eo.addEthereumChain(o,n);else throw new Error("Chain is not supported")}}else if(i===Ge.EIP6963_CONNECTOR_ID&&n){let o=r;if(o)try{await o.request({method:"wallet_switchEthereumChain",params:[{chainId:Eo.numberToHexString(n.chainId)}]}),ut.setChainId(n.chainId)}catch(s){if(s.code===Ii.ERROR_CODE_UNRECOGNIZED_CHAIN_ID||s.code===Ii.ERROR_CODE_DEFAULT||s?.data?.originalError?.code===Ii.ERROR_CODE_UNRECOGNIZED_CHAIN_ID)await Eo.addEthereumChain(o,n);else throw new Error("Chain is not supported")}}else if(i===Ge.COINBASE_SDK_CONNECTOR_ID&&n){let o=r;if(o)try{await o.request({method:"wallet_switchEthereumChain",params:[{chainId:Eo.numberToHexString(n.chainId)}]}),ut.setChainId(n.chainId)}catch(s){(s.code===Ii.ERROR_CODE_UNRECOGNIZED_CHAIN_ID||s.code===Ii.ERROR_CODE_DEFAULT||s?.data?.originalError?.code===Ii.ERROR_CODE_UNRECOGNIZED_CHAIN_ID)&&await Eo.addEthereumChain(o,n)}}}}syncConnectors(e){let r=[],i=to.ConnectorTypesMap[Ge.WALLET_CONNECT_CONNECTOR_ID];if(i&&r.push({id:Ge.WALLET_CONNECT_CONNECTOR_ID,explorerId:to.ConnectorExplorerIds[Ge.WALLET_CONNECT_CONNECTOR_ID],imageId:to.ConnectorImageIds[Ge.WALLET_CONNECT_CONNECTOR_ID],imageUrl:this.options?.connectorImages?.[Ge.WALLET_CONNECT_CONNECTOR_ID],name:to.ConnectorNamesMap[Ge.WALLET_CONNECT_CONNECTOR_ID],type:i}),e.injected){let n=to.ConnectorTypesMap[Ge.INJECTED_CONNECTOR_ID];n&&r.push({id:Ge.INJECTED_CONNECTOR_ID,explorerId:to.ConnectorExplorerIds[Ge.INJECTED_CONNECTOR_ID],imageId:to.ConnectorImageIds[Ge.INJECTED_CONNECTOR_ID],imageUrl:this.options?.connectorImages?.[Ge.INJECTED_CONNECTOR_ID],name:to.ConnectorNamesMap[Ge.INJECTED_CONNECTOR_ID],type:n})}e.coinbase&&r.push({id:Ge.COINBASE_SDK_CONNECTOR_ID,explorerId:to.ConnectorExplorerIds[Ge.COINBASE_SDK_CONNECTOR_ID],imageId:to.ConnectorImageIds[Ge.COINBASE_SDK_CONNECTOR_ID],imageUrl:this.options?.connectorImages?.[Ge.COINBASE_SDK_CONNECTOR_ID],name:to.ConnectorNamesMap[Ge.COINBASE_SDK_CONNECTOR_ID],type:"EXTERNAL"}),this.setConnectors(r)}eip6963EventHandler(e){if(e.detail){let{info:r,provider:i}=e.detail,n=this.getConnectors(),o=n.find(c=>c.name===r.name),a=n.find(c=>c.id===Ge.COINBASE_SDK_CONNECTOR_ID)&&e.detail.info.rdns===Ge.CONNECTOR_RDNS_MAP[Ge.COINBASE_SDK_CONNECTOR_ID];if(!o&&!a){let c=to.ConnectorTypesMap[Ge.EIP6963_CONNECTOR_ID];if(c){this.addConnector({id:Ge.EIP6963_CONNECTOR_ID,type:c,imageUrl:r.icon??this.options?.connectorImages?.[Ge.EIP6963_CONNECTOR_ID],name:r.name,provider:i,info:r});let h={provider:i,info:r};this.EIP6963Providers.push(h)}}}}listenConnectors(e){if(typeof window<"u"&&e){let r=this.eip6963EventHandler.bind(this);window.addEventListener(Ge.EIP6963_ANNOUNCE_EVENT,r),window.dispatchEvent(new Event(Ge.EIP6963_REQUEST_EVENT))}}};US();var J2e=Wt(Y2e(),1);function oU(t){let{enableEIP6963:e=!0,enableInjected:r=!0,enableCoinbase:i=!0,metadata:n}=t,o,s,a={metadata:n};function c(){if(o)return o;if(!(typeof window>"u")&&window.ethereum)return o=window.ethereum,o}function h(){return s||(typeof window>"u"?void 0:(s=new J2e.CoinbaseWalletSDK({appName:n.name,appLogoUrl:n.icons[0],appChainIds:t.chains?.map(b=>b.chainId)||[1,84532]}).makeWeb3Provider({options:t.coinbasePreference||"all"}),s))}return i&&(a.coinbase=h()),r&&(a.injected=c()),e&&(a.EIP6963=!0),a}function Q2e(t){return new vE({...t,_sdkVersion:`html-ethers5-${Ge.VERSION}`})}var yXe=(t=>(t.MissingApiKey="MISSING_API_KEY",t.ModalNotReady="MODAL_NOT_READY",t.ConnectionLost="CONNECTION_WAS_LOST",t.MalformedResponse="MALFORMED_RESPONSE",t.InvalidArgument="INVALID_ARGUMENT",t.ExtensionNotInitialized="EXTENSION_NOT_INITIALIZED",t.IncompatibleExtensions="INCOMPATIBLE_EXTENSIONS",t))(yXe||{}),xXe=(t=>(t.SyncWeb3Method="SYNC_WEB3_METHOD",t.DuplicateIframe="DUPLICATE_IFRAME",t.ReactNativeEndpointConfiguration="REACT_NATIVE_ENDPOINT_CONFIGURATION",t.DeprecationNotice="DEPRECATION_NOTICE",t.ProductAnnouncement="ANNOUNCEMENT",t))(xXe||{}),_Xe=(t=>(t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.MagicLinkFailedVerification=-1e4]="MagicLinkFailedVerification",t[t.MagicLinkExpired=-10001]="MagicLinkExpired",t[t.MagicLinkRateLimited=-10002]="MagicLinkRateLimited",t[t.MagicLinkInvalidRedirectURL=-10006]="MagicLinkInvalidRedirectURL",t[t.UserAlreadyLoggedIn=-10003]="UserAlreadyLoggedIn",t[t.UpdateEmailFailed=-10004]="UpdateEmailFailed",t[t.UserRequestEditEmail=-10005]="UserRequestEditEmail",t[t.InactiveRecipient=-10010]="InactiveRecipient",t[t.AccessDeniedToUser=-10011]="AccessDeniedToUser",t[t.RedirectLoginComplete=-10015]="RedirectLoginComplete",t[t.DpopInvalidated=-10019]="DpopInvalidated",t))(_Xe||{}),eu=(t=>(t.PROVIDER="magic_3pw_provider",t.ADDRESS="magic_3pw_address",t.CHAIN_ID="magic_3pw_chainId",t))(eu||{}),K3=(t=>(t.WalletConnected="wallet_connected",t.WalletRejected="wallet_rejected",t.Web3ModalSelected="web3modal_selected",t))(K3||{}),EXe=(t=>(t.LoginWithSms="magic_auth_login_with_sms",t.LoginWithEmailOTP="magic_auth_login_with_email_otp",t.LoginWithMagicLink="magic_auth_login_with_magic_link",t.LoginWithCredential="magic_auth_login_with_credential",t.SetAuthorizationToken="magic_auth_set_authorization_token",t.GetIdToken="magic_auth_get_id_token",t.GenerateIdToken="magic_auth_generate_id_token",t.GetMetadata="magic_auth_get_metadata",t.IsLoggedIn="magic_is_logged_in",t.Logout="magic_auth_logout",t.UpdateEmail="magic_auth_update_email",t.UserSettings="magic_auth_settings",t.UserSettingsTestMode="magic_auth_settings_testing_mode",t.LoginWithSmsTestMode="magic_auth_login_with_sms_testing_mode",t.LoginWithEmailOTPTestMode="magic_auth_login_with_email_otp_testing_mode",t.LoginWithMagicLinkTestMode="magic_login_with_magic_link_testing_mode",t.LoginWithCredentialTestMode="magic_auth_login_with_credential_testing_mode",t.GetIdTokenTestMode="magic_auth_get_id_token_testing_mode",t.GenerateIdTokenTestMode="magic_auth_generate_id_token_testing_mode",t.GetMetadataTestMode="magic_auth_get_metadata_testing_mode",t.IsLoggedInTestMode="magic_auth_is_logged_in_testing_mode",t.LogoutTestMode="magic_auth_logout_testing_mode",t.UpdateEmailTestMode="magic_auth_update_email_testing_mode",t.IntermediaryEvent="magic_intermediary_event",t.RequestAccounts="eth_requestAccounts",t.GetInfo="magic_get_info",t.ShowUI="magic_wallet",t.NFTPurchase="magic_nft_purchase",t.NFTCheckout="magic_nft_checkout",t.NFTTransfer="magic_nft_transfer",t.RequestUserInfoWithUI="mc_request_user_info",t.Disconnect="mc_disconnect",t.RecoverAccount="magic_auth_recover_account",t.RecoverAccountTestMode="magic_auth_recover_account_testing_mode",t.MagicBoxHeartBeat="magic_box_heart_beat",t.AutoConnect="mc_auto_connect",t.Login="mc_login",t.EncryptV1="magic_auth_encrypt_v1",t.DecryptV1="magic_auth_decrypt_v1",t.ShowNFTs="magic_show_nfts",t.ShowOnRamp="magic_show_fiat_onramp",t.ShowSendTokensUI="magic_show_send_tokens_ui",t.ShowAddress="magic_show_address",t.ShowBalances="magic_show_balances",t.SendGaslessTransaction="eth_sendGaslessTransaction",t.RevealPK="magic_reveal_key",t.EnableMFA="magic_auth_enable_mfa_flow",t.DisableMFA="magic_auth_disable_mfa_flow",t.GetMultichainPublicAddress="magic_get_multichain_public_address",t))(EXe||{});var AXe=(t=>(t.MAGIC_HANDLE_RESPONSE="MAGIC_HANDLE_RESPONSE",t.MAGIC_OVERLAY_READY="MAGIC_OVERLAY_READY",t.MAGIC_SHOW_OVERLAY="MAGIC_SHOW_OVERLAY",t.MAGIC_HIDE_OVERLAY="MAGIC_HIDE_OVERLAY",t.MAGIC_HANDLE_EVENT="MAGIC_HANDLE_EVENT",t.MAGIC_MG_BOX_SEND_RECEIPT="MAGIC_MG_BOX_SEND_RECEIPT",t.MAGIC_SEND_PRODUCT_ANNOUNCEMENT="MAGIC_SEND_PRODUCT_ANNOUNCEMENT",t.MAGIC_PONG="MAGIC_PONG",t.MAGIC_POPUP_RESPONSE="MAGIC_POPUP_RESPONSE",t.MAGIC_POPUP_OAUTH_VERIFY_RESPONSE="MAGIC_POPUP_OAUTH_VERIFY_RESPONSE",t))(AXe||{}),CXe=(t=>(t.MAGIC_HANDLE_REQUEST="MAGIC_HANDLE_REQUEST",t.MAGIC_PING="MAGIC_PING",t))(CXe||{}),SXe=(t=>(t.UpdateEmail="update-email",t.MFA="mfa",t.Recovery="recovery",t))(SXe||{}),IXe=(t=>(t.Retry="retry",t))(IXe||{}),TXe=(t=>(t.EmailSent="email-sent",t.EmailNotDeliverable="email-not-deliverable",t))(TXe||{}),RXe=(t=>(t.VerifyEmailOtp="verify-email-otp",t.VerifyMFACode="verify-mfa-code",t.LostDevice="lost-device",t.VerifyRecoveryCode="verify-recovery-code",t.Cancel="cancel",t))(RXe||{}),kXe=(t=>(t.VerifySmsOtp="verify-sms-otp",t.Cancel="cancel",t.Retry="retry",t))(kXe||{}),NXe=(t=>(t.SmsOTPSent="sms-otp-sent",t.InvalidSmsOtp="invalid-sms-otp",t.ExpiredSmsOtp="expired-sms-otp",t))(NXe||{}),PXe=(t=>(t.EmailOTPSent="email-otp-sent",t.InvalidEmailOtp="invalid-email-otp",t.InvalidMfaOtp="invalid-mfa-otp",t.ExpiredEmailOtp="expired-email-otp",t.MfaSentHandle="mfa-sent-handle",t.RecoveryCodeSentHandle="recovery-code-sent-handle",t.InvalidRecoveryCode="invalid-recovery-code",t.RecoveryCodeSuccess="recovery-code-success",t.LoginThrottled="login-throttled",t.MaxAttemptsReached="max-attempts-reached",t))(PXe||{}),OXe=(t=>(t.Retry="device-retry",t))(OXe||{}),MXe=(t=>(t.DeviceApproved="device-approved",t.DeviceNeedsApproval="device-needs-approval",t.DeviceVerificationLinkExpired="device-verification-link-expired",t.DeviceVerificationEmailSent="device-verification-email-sent",t))(MXe||{}),DXe=(t=>(t.Retry="Recency/auth-factor-retry",t.Cancel="Recency/auth-factor-verification-cancel",t.VerifyEmailOtp="Recency/auth-factor-verify-email-otp",t.VerifyMFACode="Recency/verify-mfa-code",t))(DXe||{}),LXe=(t=>(t.PrimaryAuthFactorNeedsVerification="Recency/auth-factor-needs-verification",t.PrimaryAuthFactorVerified="Recency/auth-factor-verified",t.InvalidEmailOtp="Recency/auth-factor-invalid-email-otp",t.EmailExpired="Recency/auth-factor-verification-email-expired",t.EmailSent="Recency/auth-factor-verification-email-sent",t.EmailNotDeliverable="Recency/auth-factor-verification-email-not-deliverable",t))(LXe||{}),BXe=(t=>(t.RetryWithNewEmail="UpdateEmail/retry-with-new-email",t.Cancel="UpdateEmail/new-email-verification-cancel",t.VerifyEmailOtp="UpdateEmail/new-email-verify-otp",t))(BXe||{}),UXe=(t=>(t.NewAuthFactorNeedsVerification="UpdateEmail/new-email-needs-verification",t.EmailUpdated="UpdateEmail/email-updated",t.InvalidEmailOtp="UpdateEmail/new-email-invalid-email-otp",t.EmailExpired="UpdateEmail/new-email-verification-email-expired",t.EmailSent="UpdateEmail/new-email-verification-email-sent",t.EmailNotDeliverable="UpdateEmail/new-email-verification-email-not-deliverable",t.InvalidEmail="UpdateEmail/new-email-invalid",t.EmailAlreadyExists="UpdateEmail/new-email-already-exists",t))(UXe||{}),FXe=(t=>(t.IDTokenCreated="Auth/id-token-created",t))(FXe||{}),jXe=(t=>(t.Cancel="Farcaster/cancel",t))(jXe||{}),$Xe=(t=>(t.MFASecretGenerated="mfa-secret-generated",t.InvalidMFAOtp="invalid-mfa-otp",t.MFARecoveryCodes="mfa-recovery-codes",t))($Xe||{}),WXe=(t=>(t.VerifyMFACode="verify-mfa-code",t.Cancel="cancel-mfa-setup",t))(WXe||{}),qXe=(t=>(t.MFACodeRequested="mfa-code-requested",t.InvalidMFAOtp="invalid-mfa-otp",t.InvalidRecoveryCode="invalid-recovery-code",t))(qXe||{}),HXe=(t=>(t.VerifyMFACode="verify-mfa-code",t.LostDevice="lost-device",t.Cancel="cancel-mfa-disable",t))(HXe||{}),zXe=(t=>(t.Harmony="HARMONY",t))(zXe||{}),VXe=(t=>(t.ClosedByUser="closed-by-user",t))(VXe||{}),KXe=(t=>(t.ClosedByUser="closed-by-user-on-received",t))(KXe||{}),GXe=(t=>(t.EnterNewPhoneNumber="enter-new-phone-number",t.EnterOtpCode="enter-otp-code",t.RecoveryFactorAlreadyExists="recovery-factor-already-exists",t.MalformedPhoneNumber="malformed-phone-number",t.InvalidOtpCode="invalid-otp-code",t.RecoveryFactorUpdated="recovery-factor-updated",t.RecoveryFactorDeleted="recovery-factor-deleted",t))(GXe||{}),ZXe=(t=>(t.SendNewPhoneNumber="send-new-phone-number",t.SendOtpCode="send-otp-code",t.Cancel="cancel",t.StartEditPhoneNumber="start-edit-phone-number",t))(ZXe||{}),YXe=(t=>(t.PhoneNumber="phone_number",t))(YXe||{}),JXe=(t=>(t.SmsOtpSent="sms-otp-sent",t.LoginThrottled="login-throttled",t.InvalidSmsOtp="invalid-sms-otp",t.SmsVerified="sms-verified",t.AccountRecovered="account-recovered",t.UpdateEmailRequired="update-email-required",t))(JXe||{}),QXe=(t=>(t.Cancel="cancel",t.VerifyOtp="verify-otp-code",t.ResendSms="resend-sms-otp",t.UpdateEmail="update-email",t))(QXe||{}),XXe=(t=>(t.Success="nft-checkout-success",t.Failure="nft-checkout-failure",t.Initiated="nft-checkout-initiated",t.Disconnect="disconnect",t))(XXe||{}),eet=(t=>(t.WalletInfoFetched="Wallet/wallet-info-fetched",t))(eet||{}),tet=(t=>(t.CloseMagicWindow="close-magic-window",t))(tet||{}),ret=(t=>(t.PopupUrl="popup-url",t))(ret||{}),iet=(t=>(t.PopupEvent="popup-event",t.Cancel="cancel",t))(iet||{});var HA=class t extends X2e.Extension.Internal{name="web3modal";config={};modal;static eventsListenerAdded=!1;constructor({configOptions:e,modalOptions:r}){super(),this.modal=Q2e({...r,themeVariables:{...r.themeVariables||{},"--w3m-z-index":3e9},ethersConfig:oU(e)});let i=this.modal.subscribeProvider(({status:n})=>{n==="connected"&&(i(),this.setIsConnected(),this.setEip1193EventListeners()),n==="disconnected"&&i()})}setIsConnected(){localStorage.setItem(eu.PROVIDER,"web3modal"),localStorage.setItem(eu.ADDRESS,this.modal.getAddress()),localStorage.setItem(eu.CHAIN_ID,this.modal.getChainId().toString()),this.sdk.thirdPartyWallets.isConnected=!0}initialize(){this.sdk.thirdPartyWallets.enabledWallets.web3modal=!0,this.sdk.thirdPartyWallets.isConnected=!!localStorage.getItem(eu.ADDRESS),this.sdk.thirdPartyWallets.eventListeners.push({event:K3.Web3ModalSelected,callback:async e=>{await this.connectToWeb3modal(e)}})}setEip1193EventListeners(){t.eventsListenerAdded||(t.eventsListenerAdded=!0,this.modal.subscribeProvider(({address:e,chainId:r})=>!e&&localStorage.getItem(eu.ADDRESS)?(this.sdk.thirdPartyWallets.resetThirdPartyWalletState(),this.sdk.rpcProvider.emit("accountsChanged",[])):e&&e!==localStorage.getItem(eu.ADDRESS)?(localStorage.setItem(eu.ADDRESS,e),this.sdk.rpcProvider.emit("accountsChanged",[e])):r&&r!==Number(localStorage.getItem(eu.CHAIN_ID))?(localStorage.setItem(eu.CHAIN_ID,r.toString()),this.sdk.rpcProvider.emit("chainChanged",r)):null))}handleUserConnected(e,r=this.modal.getAddress()){this.setIsConnected(),this.createIntermediaryEvent(K3.WalletConnected,e)(r),this.setEip1193EventListeners()}connectToWeb3modal(e){let{modal:r}=this;return this.utils.createPromiEvent(async()=>{try{r.getIsConnected()&&await r.disconnect()}catch(s){console.error(s)}let n=r.subscribeProvider(({address:s,error:a})=>{a&&(console.error("Provider event error:",a),n(),this.createIntermediaryEvent(K3.WalletRejected,e)()),s&&(this.handleUserConnected(e),n())}),o=r.subscribeEvents(s=>{s.data.event==="MODAL_CLOSE"&&(o(),n(),this.createIntermediaryEvent(K3.WalletRejected,e)())});r.open()})}};var net=HA;return Xf(oet);})();
9979
9979
  if (MagicWeb3ModalExtension && MagicWeb3ModalExtension.default != null) { MagicWeb3ModalExtension = Object.assign(MagicWeb3ModalExtension.default, MagicWeb3ModalExtension); delete MagicWeb3ModalExtension.default; }