var _te=Object.defineProperty;var OR=t=>{throw TypeError(t)};var Ete=(t,e,r)=>e in t?_te(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Cte=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var ce=(t,e,r)=>Ete(t,typeof e!="symbol"?e+"":e,r),Qx=(t,e,r)=>e.has(t)||OR("Cannot "+r);var H=(t,e,r)=>(Qx(t,e,"read from private field"),r?r.call(t):e.get(t)),me=(t,e,r)=>e.has(t)?OR("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Z=(t,e,r,n)=>(Qx(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),Pe=(t,e,r)=>(Qx(t,e,"access private method"),r);var I1=(t,e,r,n)=>({set _(i){Z(t,e,i,r)},get _(){return H(t,e,n)}});var sNe=Cte(Eb=>{(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=r(i);fetch(i.href,s)}})();function Ate(t){return{formatters:void 0,fees:void 0,serializers:void 0,...t}}const ZW="2.31.0";let P1={getDocsUrl:({docsBaseUrl:t,docsPath:e="",docsSlug:r})=>e?`${t??"https://viem.sh"}${e}${r?`#${r}`:""}`:void 0,version:`viem@${ZW}`},_r=class GT extends Error{constructor(e,r={}){var a;const n=(()=>{var c;return r.cause instanceof GT?r.cause.details:(c=r.cause)!=null&&c.message?r.cause.message:r.details})(),i=r.cause instanceof GT&&r.cause.docsPath||r.docsPath,s=(a=P1.getDocsUrl)==null?void 0:a.call(P1,{...r,docsPath:i}),o=[e||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...n?[`Details: ${n}`]:[],...P1.version?[`Version: ${P1.version}`]:[]].join(` `);super(o,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=i,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=e,this.version=ZW}walk(e){return YW(this,e)}};function YW(t,e){return e!=null&&e(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?YW(t.cause,e):e?null:t}let JW=class extends _r{constructor({max:e,min:r,signed:n,size:i,value:s}){super(`Number "${s}" is not in safe ${i?`${i*8}-bit ${n?"signed":"unsigned"} `:""}integer range ${e?`(${r} to ${e})`:`(above ${r})`}`,{name:"IntegerOutOfRangeError"})}},xte=class extends _r{constructor({givenSize:e,maxSize:r}){super(`Size cannot exceed ${r} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}};function _v(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function Ci(t){return _v(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}class QW extends _r{constructor({offset:e,position:r,size:n}){super(`Slice ${r==="start"?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${n}).`,{name:"SliceOffsetOutOfBoundsError"})}}let XW=class extends _r{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${r}).`,{name:"SizeExceedsPaddingSizeError"})}};function Jm(t,{dir:e,size:r=32}={}){return typeof t=="string"?ad(t,{dir:e,size:r}):Ste(t,{dir:e,size:r})}function ad(t,{dir:e,size:r=32}={}){if(r===null)return t;const n=t.replace("0x","");if(n.length>r*2)throw new XW({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n[e==="right"?"padEnd":"padStart"](r*2,"0")}`}function Ste(t,{dir:e,size:r=32}={}){if(r===null)return t;if(t.length>r)throw new XW({size:t.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let i=0;ie.toString(16).padStart(2,"0"));function Tb(t,e={}){return typeof t=="number"||typeof t=="bigint"?$d(t,e):typeof t=="string"?Ib(t,e):typeof t=="boolean"?eV(t,e):C9(t,e)}function eV(t,e={}){const r=`0x${Number(t)}`;return typeof e.size=="number"?(Ev(r,{size:e.size}),Jm(r,{size:e.size})):r}function C9(t,e={}){let r="";for(let i=0;is||i=mc.zero&&t<=mc.nine)return t-mc.zero;if(t>=mc.A&&t<=mc.F)return t-(mc.A-10);if(t>=mc.a&&t<=mc.f)return t-(mc.a-10)}function rV(t,e={}){let r=t;e.size&&(Ev(r,{size:e.size}),r=Jm(r,{dir:"right",size:e.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const i=n.length/2,s=new Uint8Array(i);for(let o=0,a=0;oe)throw new xte({givenSize:Ci(t),maxSize:e})}function md(t){return typeof t[0]=="string"?iV(t):kte(t)}function kte(t){let e=0;for(const i of t)e+=i.length;const r=new Uint8Array(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function iV(t){return`0x${t.reduce((e,r)=>e+r.replace("0x",""),"")}`}function Nte(t,e){let r=t.toString();const n=r.startsWith("-");n&&(r=r.slice(1)),r=r.padStart(e,"0");let[i,s]=[r.slice(0,r.length-e),r.slice(r.length-e)];return s=s.replace(/(0+)$/,""),`${n?"-":""}${i||"0"}${s?`.${s}`:""}`}/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function $te(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function kR(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function tm(t,...e){if(!$te(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function mC(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function sV(t,e){tm(t);const r=e.outputLen;if(t.length>>e}const Bte=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Dte(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function Mte(t){for(let e=0;et:Mte,Lte=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Ute=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Fte(t){if(tm(t),Lte)return t.toHex();let e="";for(let r=0;rt().update(A9(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function qte(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),c=n?4:0,u=n?0:4;t.setUint32(e+c,o,n),t.setUint32(e+u,a,n)}function zte(t,e,r){return t&e^~t&r}function Wte(t,e,r){return t&e^t&r^e&r}let Vte=class extends oV{constructor(e,r,n,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.buffer=new Uint8Array(e),this.view=Xx(this.buffer)}update(e){mC(this),e=A9(e),tm(e);const{view:r,buffer:n,blockLen:i}=this,s=e.length;for(let o=0;oi-o&&(this.process(n,0),o=0);for(let d=o;dl.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d>$R&G2)}:{h:Number(t>>$R&G2)|0,l:Number(t&G2)|0}}function Kte(t,e=!1){const r=t.length;let n=new Uint32Array(r),i=new Uint32Array(r);for(let s=0;st<>>32-r,Yte=(t,e,r)=>e<>>32-r,Jte=(t,e,r)=>e<>>64-r,Qte=(t,e,r)=>t<>>64-r,Xte=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),dl=new Uint32Array(64);let ere=class extends Vte{constructor(e=32){super(64,e,8,!1),this.A=ll[0]|0,this.B=ll[1]|0,this.C=ll[2]|0,this.D=ll[3]|0,this.E=ll[4]|0,this.F=ll[5]|0,this.G=ll[6]|0,this.H=ll[7]|0}get(){const{A:e,B:r,C:n,D:i,E:s,F:o,G:a,H:c}=this;return[e,r,n,i,s,o,a,c]}set(e,r,n,i,s,o,a,c){this.A=e|0,this.B=r|0,this.C=n|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=a|0,this.H=c|0}process(e,r){for(let d=0;d<16;d++,r+=4)dl[d]=e.getUint32(r,!1);for(let d=16;d<64;d++){const h=dl[d-15],f=dl[d-2],g=ga(h,7)^ga(h,18)^h>>>3,p=ga(f,17)^ga(f,19)^f>>>10;dl[d]=p+dl[d-7]+g+dl[d-16]|0}let{A:n,B:i,C:s,D:o,E:a,F:c,G:u,H:l}=this;for(let d=0;d<64;d++){const h=ga(a,6)^ga(a,11)^ga(a,25),f=l+h+zte(a,c,u)+Xte[d]+dl[d]|0,p=(ga(n,2)^ga(n,13)^ga(n,22))+Wte(n,i,s)|0;l=u,u=c,c=a,a=o+f|0,o=s,s=i,i=n,n=f+p|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(n,i,s,o,a,c,u,l)}roundClean(){Pb(dl)}destroy(){this.set(0,0,0,0,0,0,0,0),Pb(this.buffer)}};const tre=aV(()=>new ere),rre=tre;class cV extends _r{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class x9 extends _r{constructor({cause:e,message:r}={}){var i;const n=(i=r==null?void 0:r.replace("execution reverted: ",""))==null?void 0:i.replace("execution reverted","");super(`Execution reverted ${n?`with reason: ${n}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"})}}Object.defineProperty(x9,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(x9,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});let S9=class extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const r=super.get(e);return super.has(e)&&r!==void 0&&(this.delete(e),super.set(e,r)),r}set(e,r){if(super.set(e,r),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}};const nre=BigInt(0),O1=BigInt(1),ire=BigInt(2),sre=BigInt(7),ore=BigInt(256),are=BigInt(113),uV=[],lV=[],dV=[];for(let t=0,e=O1,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],uV.push(2*(5*n+r)),lV.push((t+1)*(t+2)/2%64);let i=nre;for(let s=0;s<7;s++)e=(e<>sre)*are)%ore,e&ire&&(i^=O1<<(O1<r>32?Jte(t,e,r):Zte(t,e,r),BR=(t,e,r)=>r>32?Qte(t,e,r):Yte(t,e,r);function lre(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,u=r[c],l=r[c+1],d=jR(u,l,1)^r[a],h=BR(u,l,1)^r[a+1];for(let f=0;f<50;f+=10)t[o+f]^=d,t[o+f+1]^=h}let i=t[2],s=t[3];for(let o=0;o<24;o++){const a=lV[o],c=jR(i,s,a),u=BR(i,s,a),l=uV[o];i=t[l],s=t[l+1],t[l]=c,t[l+1]=u}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)r[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~r[(a+2)%10]&r[(a+4)%10]}t[0]^=cre[n],t[1]^=ure[n]}Pb(r)}let dre=class fV extends oV{constructor(e,r,n,i=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,kR(n),!(0=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);e.set(r.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return kR(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(sV(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,Pb(this.state)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return e||(e=new fV(r,n,i,o,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=n,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}};const hre=(t,e,r)=>aV(()=>new dre(e,t,r)),fre=hre(1,136,256/8);function qa(t,e){const r=e||"hex",n=fre(_v(t,{strict:!1})?tV(t):t);return r==="bytes"?n:Tb(n)}const e8=new S9(8192);function pre(t,e){if(e8.has(`${t}.${e}`))return e8.get(`${t}.${e}`);const r=t.substring(2).toLowerCase(),n=qa(nV(r),"bytes"),i=r.split("");for(let o=0;o<40;o+=2)n[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(n[o>>1]&15)>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const s=`0x${i.join("")}`;return e8.set(`${t}.${e}`,s),s}const gre=/^0x[a-fA-F0-9]{40}$/,t8=new S9(8192);function Ob(t,e){const{strict:r=!0}=e??{},n=`${t}.${r}`;if(t8.has(n))return t8.get(n);const i=gre.test(t)?t.toLowerCase()===t?!0:r?pre(t)===t:!0:!1;return t8.set(n,i),i}function pV(t,e,r,{strict:n}={}){return _v(t,{strict:!1})?wre(t,e,r,{strict:n}):mre(t,e,r,{strict:n})}function gV(t,e){if(typeof e=="number"&&e>0&&e>Ci(t)-1)throw new QW({offset:e,position:"start",size:Ci(t)})}function mV(t,e,r){if(typeof e=="number"&&typeof r=="number"&&Ci(t)!==r-e)throw new QW({offset:r,position:"end",size:Ci(t)})}function mre(t,e,r,{strict:n}={}){gV(t,e);const i=t.slice(e,r);return n&&mV(i,e,r),i}function wre(t,e,r,{strict:n}={}){gV(t,e);const i=`0x${t.replace("0x","").slice((e??0)*2,(r??t.length)*2)}`;return n&&mV(i,e,r),i}function KT(t,{includeName:e=!1}={}){if(t.type!=="function"&&t.type!=="event"&&t.type!=="error")throw new Sre(t.type);return`${t.name}(${wV(t.inputs,{includeName:e})})`}function wV(t,{includeName:e=!1}={}){return t?t.map(r=>bre(r,{includeName:e})).join(e?", ":","):""}function bre(t,{includeName:e}){return t.type.startsWith("tuple")?`(${wV(t.components,{includeName:e})})${t.type.slice(5)}`:t.type+(e&&t.name?` ${t.name}`:"")}class yre extends _r{constructor({expectedLength:e,givenLength:r,type:n}){super([`ABI encoding array length mismatch for type ${n}.`,`Expected length: ${e}`,`Given length: ${r}`].join(` `),{name:"AbiEncodingArrayLengthMismatchError"})}}class vre extends _r{constructor({expectedSize:e,value:r}){super(`Size of bytes "${r}" (bytes${Ci(r)}) does not match expected size (bytes${e}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class _re extends _r{constructor({expectedLength:e,givenLength:r}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${e}`,`Given length (values): ${r}`].join(` `),{name:"AbiEncodingLengthMismatchError"})}}class DR extends _r{constructor(e,{docsPath:r}={}){super([`Function ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(` `),{docsPath:r,name:"AbiFunctionNotFoundError"})}}class Ere extends _r{constructor(e,r){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${e.type}\` in \`${KT(e.abiItem)}\`, and`,`\`${r.type}\` in \`${KT(r.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}class Cre extends _r{constructor({expectedSize:e,givenSize:r}){super(`Expected bytes${e}, got bytes${r}.`,{name:"BytesSizeMismatchError"})}}class Are extends _r{constructor(e,{docsPath:r}){super([`Type "${e}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(` `),{docsPath:r,name:"InvalidAbiEncodingType"})}}class xre extends _r{constructor(e){super([`Value "${e}" is not a valid array.`].join(` `),{name:"InvalidArrayError"})}}class Sre extends _r{constructor(e){super([`"${e}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(` `),{name:"InvalidDefinitionTypeError"})}}const Tre=t=>qa(tV(t));function Ire(t){return Tre(t)}function Pre(t,e){const r=t.exec(e);return r==null?void 0:r.groups}const MR=/^tuple(?(\[(\d*)\])*)$/;function ZT(t){let e=t.type;if(MR.test(t.type)&&"components"in t){e="(";const r=t.components.length;for(let i=0;i{const e=typeof t=="string"?t:Ore(t);return Rre(e)};function bV(t){return Ire(kre(t))}const yV=t=>pV(bV(t),0,4),Nre=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,vV=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function T9(t,e){if(t.length!==e.length)throw new _re({expectedLength:t.length,givenLength:e.length});const r=$re({params:t,values:e}),n=P9(r);return n.length===0?"0x":n}function $re({params:t,values:e}){const r=[];for(let n=0;n0?md([a,o]):a}}if(i)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:md(s.map(({encoded:o})=>o))}}function Dre(t,{param:e}){const[,r]=e.type.split("bytes"),n=Ci(t);if(!r){let i=t;return n%32!==0&&(i=ad(i,{dir:"right",size:Math.ceil((t.length-2)/2/32)*32})),{dynamic:!0,encoded:md([ad($d(n,{size:32})),i])}}if(n!==Number.parseInt(r))throw new vre({expectedSize:Number.parseInt(r),value:t});return{dynamic:!1,encoded:ad(t,{dir:"right"})}}function Mre(t){if(typeof t!="boolean")throw new _r(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:ad(eV(t))}}function Lre(t,{signed:e,size:r=256}){if(typeof r=="number"){const n=2n**(BigInt(r)-(e?1n:0n))-1n,i=e?-n-1n:0n;if(t>n||ti))}}function Hre(t){const e=t.match(/^(.*)\[(\d+)?\]$/);return e?[e[2]?Number(e[2]):null,e[1]]:void 0}const cd=(t,e,r)=>JSON.stringify(t,(n,i)=>typeof i=="bigint"?i.toString():i,r),qre=bV;function zre(t){const{abi:e,args:r=[],name:n}=t,i=_v(n,{strict:!1}),s=e.filter(a=>i?a.type==="function"?yV(a)===n:a.type==="event"?qre(a)===n:!1:"name"in a&&a.name===n);if(s.length===0)return;if(s.length===1)return s[0];let o;for(const a of s){if(!("inputs"in a))continue;if(!r||r.length===0){if(!a.inputs||a.inputs.length===0)return a;continue}if(!a.inputs||a.inputs.length===0||a.inputs.length!==r.length)continue;if(r.every((u,l)=>{const d="inputs"in a&&a.inputs[l];return d?YT(u,d):!1})){if(o&&"inputs"in o&&o.inputs){const u=_V(a.inputs,o.inputs,r);if(u)throw new Ere({abiItem:a,type:u[0]},{abiItem:o,type:u[1]})}o=a}}return o||s[0]}function YT(t,e){const r=typeof t,n=e.type;switch(n){case"address":return Ob(t,{strict:!1});case"bool":return r==="boolean";case"function":return r==="string";case"string":return r==="string";default:return n==="tuple"&&"components"in e?Object.values(e.components).every((i,s)=>YT(Object.values(t)[s],i)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n)?r==="number"||r==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n)?r==="string"||t instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n)?Array.isArray(t)&&t.every(i=>YT(i,{...e,type:n.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function _V(t,e,r){for(const n in t){const i=t[n],s=e[n];if(i.type==="tuple"&&s.type==="tuple"&&"components"in i&&"components"in s)return _V(i.components,s.components,r[n]);const o=[i.type,s.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?Ob(r[n],{strict:!1}):o.includes("address")&&o.includes("bytes")?Ob(r[n],{strict:!1}):!1)return o}}const O9=t=>t;class ub extends _r{constructor({body:e,cause:r,details:n,headers:i,status:s,url:o}){super("HTTP request failed.",{cause:r,details:n,metaMessages:[s&&`Status: ${s}`,`URL: ${O9(o)}`,e&&`Request body: ${cd(e)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=i,this.status=s,this.url=o}}class EV extends _r{constructor({body:e,error:r,url:n}){super("RPC Request failed.",{cause:r,details:r.message,metaMessages:[`URL: ${O9(n)}`,`Request body: ${cd(e)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=r.code,this.data=r.data}}class LR extends _r{constructor({body:e,url:r}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${O9(r)}`,`Request body: ${cd(e)}`],name:"TimeoutError"})}}const Wre=-1;class Xi extends _r{constructor(e,{code:r,docsPath:n,metaMessages:i,name:s,shortMessage:o}){super(o,{cause:e,docsPath:n,metaMessages:i||(e==null?void 0:e.metaMessages),name:s||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=s||e.name,this.code=e instanceof EV?e.code:r??Wre}}class Rs extends Xi{constructor(e,r){super(e,r),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=r.data}}class Rb extends Xi{constructor(e){super(e,{code:Rb.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(Rb,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class kb extends Xi{constructor(e){super(e,{code:kb.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(kb,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class Nb extends Xi{constructor(e,{method:r}={}){super(e,{code:Nb.code,name:"MethodNotFoundRpcError",shortMessage:`The method${r?` "${r}"`:""} does not exist / is not available.`})}}Object.defineProperty(Nb,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class $b extends Xi{constructor(e){super(e,{code:$b.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(` `)})}}Object.defineProperty($b,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class rm extends Xi{constructor(e){super(e,{code:rm.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(rm,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class jb extends Xi{constructor(e){super(e,{code:jb.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(` `)})}}Object.defineProperty(jb,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class Bb extends Xi{constructor(e){super(e,{code:Bb.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(Bb,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Db extends Xi{constructor(e){super(e,{code:Db.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Db,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class nm extends Xi{constructor(e){super(e,{code:nm.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(nm,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Zh extends Xi{constructor(e,{method:r}={}){super(e,{code:Zh.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${r?` "${r}"`:""} is not supported.`})}}Object.defineProperty(Zh,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class im extends Xi{constructor(e){super(e,{code:im.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(im,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class Mb extends Xi{constructor(e){super(e,{code:Mb.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(Mb,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class xf extends Rs{constructor(e){super(e,{code:xf.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(xf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class Lb extends Rs{constructor(e){super(e,{code:Lb.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(Lb,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class Ub extends Rs{constructor(e,{method:r}={}){super(e,{code:Ub.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${r?` " ${r}"`:""}.`})}}Object.defineProperty(Ub,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class Fb extends Rs{constructor(e){super(e,{code:Fb.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(Fb,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class Hb extends Rs{constructor(e){super(e,{code:Hb.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(Hb,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class qb extends Rs{constructor(e){super(e,{code:qb.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(qb,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class zb extends Rs{constructor(e){super(e,{code:zb.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(zb,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class Wb extends Rs{constructor(e){super(e,{code:Wb.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(Wb,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class Vb extends Rs{constructor(e){super(e,{code:Vb.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(Vb,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class Gb extends Rs{constructor(e){super(e,{code:Gb.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(Gb,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class Kb extends Rs{constructor(e){super(e,{code:Kb.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(Kb,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class Zb extends Rs{constructor(e){super(e,{code:Zb.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(Zb,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class Yb extends Rs{constructor(e){super(e,{code:Yb.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(Yb,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class Vre extends Xi{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const Gre=Ate({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://eth.merkle.io"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xce01f8eee7E479C928F8919abD53E553a36CeF67",blockCreated:19258213},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}});function Qm(t){return{formatters:void 0,fees:void 0,serializers:void 0,...t}}const UR=Qm({id:"5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",name:"Solana",network:"solana-mainnet",nativeCurrency:{name:"Solana",symbol:"SOL",decimals:9},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},blockExplorers:{default:{name:"Solscan",url:"https://solscan.io"}},testnet:!1,chainNamespace:"solana",caipNetworkId:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",deprecatedCaipNetworkId:"solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ"}),FR=Qm({id:"EtWTRABZaYq6iMfeYKouRu166VU2xqa1",name:"Solana Devnet",network:"solana-devnet",nativeCurrency:{name:"Solana",symbol:"SOL",decimals:9},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},blockExplorers:{default:{name:"Solscan",url:"https://solscan.io"}},testnet:!0,chainNamespace:"solana",caipNetworkId:"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",deprecatedCaipNetworkId:"solana:8E9rvCKLFQia2Y35HXjjpWzj8weVo44K"});Qm({id:"4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z",name:"Solana Testnet",network:"solana-testnet",nativeCurrency:{name:"Solana",symbol:"SOL",decimals:9},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},blockExplorers:{default:{name:"Solscan",url:"https://solscan.io"}},testnet:!0,chainNamespace:"solana",caipNetworkId:"solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z"});Qm({id:"000000000019d6689c085ae165831e93",caipNetworkId:"bip122:000000000019d6689c085ae165831e93",chainNamespace:"bip122",name:"Bitcoin",nativeCurrency:{name:"Bitcoin",symbol:"BTC",decimals:8},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}}});Qm({id:"000000000933ea01ad0ee984209779ba",caipNetworkId:"bip122:000000000933ea01ad0ee984209779ba",chainNamespace:"bip122",name:"Bitcoin Testnet",nativeCurrency:{name:"Bitcoin",symbol:"BTC",decimals:8},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},testnet:!0});const Kre=Symbol(),HR=Object.getPrototypeOf,JT=new WeakMap,Zre=t=>t&&(JT.has(t)?JT.get(t):HR(t)===Object.prototype||HR(t)===Array.prototype),Yre=t=>Zre(t)&&t[Kre]||null,qR=(t,e=!0)=>{JT.set(t,e)},wC={},r8=t=>typeof t=="object"&&t!==null,jl=new WeakMap,eb=new WeakSet,Jre=(t=Object.is,e=(u,l)=>new Proxy(u,l),r=u=>r8(u)&&!eb.has(u)&&(Array.isArray(u)||!(Symbol.iterator in u))&&!(u instanceof WeakMap)&&!(u instanceof WeakSet)&&!(u instanceof Error)&&!(u instanceof Number)&&!(u instanceof Date)&&!(u instanceof String)&&!(u instanceof RegExp)&&!(u instanceof ArrayBuffer),n=u=>{switch(u.status){case"fulfilled":return u.value;case"rejected":throw u.reason;default:throw u}},i=new WeakMap,s=(u,l,d=n)=>{const h=i.get(u);if((h==null?void 0:h[0])===l)return h[1];const f=Array.isArray(u)?[]:Object.create(Object.getPrototypeOf(u));return qR(f,!0),i.set(u,[l,f]),Reflect.ownKeys(u).forEach(g=>{if(Object.getOwnPropertyDescriptor(f,g))return;const p=Reflect.get(u,g),{enumerable:m}=Reflect.getOwnPropertyDescriptor(u,g),b={value:p,enumerable:m,configurable:!0};if(eb.has(p))qR(p,!1);else if(p instanceof Promise)delete b.value,b.get=()=>d(p);else if(jl.has(p)){const[v,E]=jl.get(p);b.value=s(v,E(),d)}Object.defineProperty(f,g,b)}),Object.preventExtensions(f)},o=new WeakMap,a=[1,1],c=u=>{if(!r8(u))throw new Error("object required");const l=o.get(u);if(l)return l;let d=a[0];const h=new Set,f=(A,T=++a[0])=>{d!==T&&(d=T,h.forEach(O=>O(A,T)))};let g=a[1];const p=(A=++a[1])=>(g!==A&&!h.size&&(g=A,b.forEach(([T])=>{const O=T[1](A);O>d&&(d=O)})),d),m=A=>(T,O)=>{const k=[...T];k[1]=[A,...k[1]],f(k,O)},b=new Map,v=(A,T)=>{if((wC?"production":void 0)!=="production"&&b.has(A))throw new Error("prop listener already exists");if(h.size){const O=T[3](m(A));b.set(A,[T,O])}else b.set(A,[T])},E=A=>{var T;const O=b.get(A);O&&(b.delete(A),(T=O[1])==null||T.call(O))},w=A=>(h.add(A),h.size===1&&b.forEach(([O,k],j)=>{if((wC?"production":void 0)!=="production"&&k)throw new Error("remove already exists");const N=O[3](m(j));b.set(j,[O,N])}),()=>{h.delete(A),h.size===0&&b.forEach(([O,k],j)=>{k&&(k(),b.set(j,[O]))})}),C=Array.isArray(u)?[]:Object.create(Object.getPrototypeOf(u)),_=e(C,{deleteProperty(A,T){const O=Reflect.get(A,T);E(T);const k=Reflect.deleteProperty(A,T);return k&&f(["delete",[T],O]),k},set(A,T,O,k){const j=Reflect.has(A,T),N=Reflect.get(A,T,k);if(j&&(t(N,O)||o.has(O)&&t(N,o.get(O))))return!0;E(T),r8(O)&&(O=Yre(O)||O);let S=O;if(O instanceof Promise)O.then(P=>{O.status="fulfilled",O.value=P,f(["resolve",[T],P])}).catch(P=>{O.status="rejected",O.reason=P,f(["reject",[T],P])});else{!jl.has(O)&&r(O)&&(S=c(O));const P=!eb.has(S)&&jl.get(S);P&&v(T,P)}return Reflect.set(A,T,S,k),f(["set",[T],O,N]),!0}});o.set(u,_);const x=[C,p,s,w];return jl.set(_,x),Reflect.ownKeys(u).forEach(A=>{const T=Object.getOwnPropertyDescriptor(u,A);"value"in T&&(_[A]=u[A],delete T.value,delete T.writable),Object.defineProperty(C,A,T)}),_})=>[c,jl,eb,t,e,r,n,i,s,o,a],[Qre]=Jre();function rr(t={}){return Qre(t)}function ln(t,e,r){const n=jl.get(t);(wC?"production":void 0)!=="production"&&!n&&console.warn("Please use proxy object");let i;const s=[],o=n[3];let a=!1;const u=o(l=>{s.push(l),i||(i=Promise.resolve().then(()=>{i=void 0,a&&e(s.splice(0))}))});return a=!0,()=>{a=!1,u()}}function Jb(t,e){const r=jl.get(t);(wC?"production":void 0)!=="production"&&!r&&console.warn("Please use proxy object");const[n,i,s]=r;return s(n,i(),e)}function Nf(t){return eb.add(t),t}function dn(t,e,r,n){let i=t[e];return ln(t,()=>{const s=t[e];Object.is(i,s)||r(i=s)})}function Xre(t){const e=rr({data:Array.from([]),has(r){return this.data.some(n=>n[0]===r)},set(r,n){const i=this.data.find(s=>s[0]===r);return i?i[1]=n:this.data.push([r,n]),this},get(r){var n;return(n=this.data.find(i=>i[0]===r))==null?void 0:n[1]},delete(r){const n=this.data.findIndex(i=>i[0]===r);return n===-1?!1:(this.data.splice(n,1),!0)},clear(){this.data.splice(0)},get size(){return this.data.length},toJSON(){return new Map(this.data)},forEach(r){this.data.forEach(n=>{r(n[1],n[0],this)})},keys(){return this.data.map(r=>r[0]).values()},values(){return this.data.map(r=>r[1]).values()},entries(){return new Map(this.data).entries()},get[Symbol.toStringTag](){return"Map"},[Symbol.iterator](){return this.entries()}});return Object.defineProperties(e,{data:{enumerable:!1},size:{enumerable:!1},toJSON:{enumerable:!1}}),Object.seal(e),e}var Da=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function cc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function CV(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var F4={exports:{}},ene=F4.exports,zR;function tne(){return zR||(zR=1,function(t,e){(function(r,n){t.exports=n()})(ene,function(){var r=1e3,n=6e4,i=36e5,s="millisecond",o="second",a="minute",c="hour",u="day",l="week",d="month",h="quarter",f="year",g="date",p="Invalid Date",m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,b=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,v={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(N){var S=["th","st","nd","rd"],P=N%100;return"["+N+(S[(P-20)%10]||S[P]||S[0])+"]"}},E=function(N,S,P){var I=String(N);return!I||I.length>=S?N:""+Array(S+1-I.length).join(P)+N},w={s:E,z:function(N){var S=-N.utcOffset(),P=Math.abs(S),I=Math.floor(P/60),B=P%60;return(S<=0?"+":"-")+E(I,2,"0")+":"+E(B,2,"0")},m:function N(S,P){if(S.date()1)return N(R[0])}else{var D=S.name;y[D]=S,B=D}return!I&&B&&(C=B),B||!I&&C},T=function(N,S){if(x(N))return N.clone();var P=typeof S=="object"?S:{};return P.date=N,P.args=arguments,new k(P)},O=w;O.l=A,O.i=x,O.w=function(N,S){return T(N,{locale:S.$L,utc:S.$u,x:S.$x,$offset:S.$offset})};var k=function(){function N(P){this.$L=A(P.locale,null,!0),this.parse(P),this.$x=this.$x||P.x||{},this[_]=!0}var S=N.prototype;return S.parse=function(P){this.$d=function(I){var B=I.date,$=I.utc;if(B===null)return new Date(NaN);if(O.u(B))return new Date;if(B instanceof Date)return new Date(B);if(typeof B=="string"&&!/Z$/i.test(B)){var R=B.match(m);if(R){var D=R[2]-1||0,L=(R[7]||"0").substring(0,3);return $?new Date(Date.UTC(R[1],D,R[3]||1,R[4]||0,R[5]||0,R[6]||0,L)):new Date(R[1],D,R[3]||1,R[4]||0,R[5]||0,R[6]||0,L)}}return new Date(B)}(P),this.init()},S.init=function(){var P=this.$d;this.$y=P.getFullYear(),this.$M=P.getMonth(),this.$D=P.getDate(),this.$W=P.getDay(),this.$H=P.getHours(),this.$m=P.getMinutes(),this.$s=P.getSeconds(),this.$ms=P.getMilliseconds()},S.$utils=function(){return O},S.isValid=function(){return this.$d.toString()!==p},S.isSame=function(P,I){var B=T(P);return this.startOf(I)<=B&&B<=this.endOf(I)},S.isAfter=function(P,I){return T(P)0,y<=C.r||!C.r){y<=1&&w>0&&(C=v[w-1]);var _=b[C.l];f&&(y=f(""+y)),p=typeof _=="string"?_.replace("%d",y):_(y,l,C.l,m);break}}if(l)return p;var x=m?b.future:b.past;return typeof x=="function"?x(p):x.replace("%s",p)},s.to=function(u,l){return a(u,l,this,!0)},s.from=function(u,l){return a(u,l,this)};var c=function(u){return u.$u?i.utc():i()};s.toNow=function(u){return this.to(c(this),u)},s.fromNow=function(u){return this.from(c(this),u)}}})}(q4)),q4.exports}var une=cne();const lne=cc(une);var z4={exports:{}},dne=z4.exports,GR;function hne(){return GR||(GR=1,function(t,e){(function(r,n){t.exports=n()})(dne,function(){return function(r,n,i){i.updateLocale=function(s,o){var a=i.Ls[s];if(a)return(o?Object.keys(o):[]).forEach(function(c){a[c]=o[c]}),a}}})}(z4)),z4.exports}var fne=hne();const pne=cc(fne);ng.extend(lne);ng.extend(pne);const gne={...one,name:"en-web3-modal",relativeTime:{future:"in %s",past:"%s ago",s:"%d sec",m:"1 min",mm:"%d min",h:"1 hr",hh:"%d hrs",d:"1 d",dd:"%d d",M:"1 mo",MM:"%d mo",y:"1 yr",yy:"%d yr"}},mne=["January","February","March","April","May","June","July","August","September","October","November","December"];ng.locale("en-web3-modal",gne);const bC={getMonthNameByIndex(t){return mne[t]},getYear(t=new Date().toISOString()){return ng(t).year()},getRelativeDateFromNow(t){return ng(t).locale("en-web3-modal").fromNow(!0)},formatDate(t,e="DD MMM"){return ng(t).format(e)}};var KR={};const _e={WC_NAME_SUFFIX:".reown.id",WC_NAME_SUFFIX_LEGACY:".wcn.id",BLOCKCHAIN_API_RPC_URL:"https://rpc.walletconnect.org",PULSE_API_URL:"https://pulse.walletconnect.org",W3M_API_URL:"https://api.web3modal.org",CONNECTOR_ID:{WALLET_CONNECT:"walletConnect",INJECTED:"injected",WALLET_STANDARD:"announced",COINBASE:"coinbaseWallet",COINBASE_SDK:"coinbaseWalletSDK",SAFE:"safe",LEDGER:"ledger",OKX:"okx",EIP6963:"eip6963",AUTH:"ID_AUTH"},CONNECTOR_NAMES:{AUTH:"Auth"},AUTH_CONNECTOR_SUPPORTED_CHAINS:["eip155","solana"],LIMITS:{PENDING_TRANSACTIONS:99},CHAIN:{EVM:"eip155",SOLANA:"solana",POLKADOT:"polkadot",BITCOIN:"bip122"},CHAIN_NAME_MAP:{eip155:"EVM Networks",solana:"Solana",polkadot:"Polkadot",bip122:"Bitcoin",cosmos:"Cosmos"},ADAPTER_TYPES:{BITCOIN:"bitcoin",SOLANA:"solana",WAGMI:"wagmi",ETHERS:"ethers",ETHERS5:"ethers5"},USDT_CONTRACT_ADDRESSES:["0xdac17f958d2ee523a2206206994597c13d831ec7","0xc2132d05d31c914a87c6611c10748aeb04b58e8f","0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7","0x919C1c267BC06a7039e03fcc2eF738525769109c","0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e","0x55d398326f99059fF775485246999027B3197955","0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9"],HTTP_STATUS_CODES:{SERVICE_UNAVAILABLE:503,FORBIDDEN:403},UNSUPPORTED_NETWORK_NAME:"Unknown Network",SECURE_SITE_SDK_ORIGIN:(typeof process<"u"&&typeof KR<"u"?KR.NEXT_PUBLIC_SECURE_SITE_ORIGIN:void 0)||"https://secure.walletconnect.org"},AV={caipNetworkIdToNumber(t){return t?Number(t.split(":")[1]):void 0},parseEvmChainId(t){return typeof t=="string"?this.caipNetworkIdToNumber(t):t},getNetworksByNamespace(t,e){return(t==null?void 0:t.filter(r=>r.chainNamespace===e))||[]},getFirstNetworkByNamespace(t,e){return this.getNetworksByNamespace(t,e)[0]},getNetworkNameByCaipNetworkId(t,e){var i;if(!e)return;const r=t.find(s=>s.caipNetworkId===e);if(r)return r.name;const[n]=e.split(":");return((i=_e.CHAIN_NAME_MAP)==null?void 0:i[n])||void 0}};var wne=20,bne=1,$f=1e6,ZR=1e6,yne=-7,vne=21,_ne=!1,Cv="[big.js] ",mp=Cv+"Invalid ",F6=mp+"decimal places",Ene=mp+"rounding mode",xV=Cv+"Division by zero",tr={},Va=void 0,Cne=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function SV(){function t(e){var r=this;if(!(r instanceof t))return e===Va?SV():new t(e);if(e instanceof t)r.s=e.s,r.e=e.e,r.c=e.c.slice();else{if(typeof e!="string"){if(t.strict===!0&&typeof e!="bigint")throw TypeError(mp+"value");e=e===0&&1/e<0?"-0":String(e)}Ane(r,e)}r.constructor=t}return t.prototype=tr,t.DP=wne,t.RM=bne,t.NE=yne,t.PE=vne,t.strict=_ne,t.roundDown=0,t.roundHalfUp=1,t.roundHalfEven=2,t.roundUp=3,t}function Ane(t,e){var r,n,i;if(!Cne.test(e))throw Error(mp+"number");for(t.s=e.charAt(0)=="-"?(e=e.slice(1),-1):1,(r=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(r<0&&(r=n),r+=+e.slice(n+1),e=e.substring(0,n)):r<0&&(r=e.length),i=e.length,n=0;n0&&e.charAt(--i)=="0";);for(t.e=r-n-1,t.c=[],r=0;n<=i;)t.c[r++]=+e.charAt(n++)}return t}function wp(t,e,r,n){var i=t.c;if(r===Va&&(r=t.constructor.RM),r!==0&&r!==1&&r!==2&&r!==3)throw Error(Ene);if(e<1)n=r===3&&(n||!!i[0])||e===0&&(r===1&&i[0]>=5||r===2&&(i[0]>5||i[0]===5&&(n||i[1]!==Va))),i.length=1,n?(t.e=t.e-e+1,i[0]=1):i[0]=t.e=0;else if(e=5||r===2&&(i[e]>5||i[e]===5&&(n||i[e+1]!==Va||i[e-1]&1))||r===3&&(n||!!i[0]),i.length=e,n){for(;++i[--e]>9;)if(i[e]=0,e===0){++t.e,i.unshift(1);break}}for(e=i.length;!i[--e];)i.pop()}return t}function bp(t,e,r){var n=t.e,i=t.c.join(""),s=i.length;if(e)i=i.charAt(0)+(s>1?"."+i.slice(1):"")+(n<0?"e":"e+")+n;else if(n<0){for(;++n;)i="0"+i;i="0."+i}else if(n>0)if(++n>s)for(n-=s;n--;)i+="0";else n1&&(i=i.charAt(0)+"."+i.slice(1));return t.s<0&&r?"-"+i:i}tr.abs=function(){var t=new this.constructor(this);return t.s=1,t};tr.cmp=function(t){var e,r=this,n=r.c,i=(t=new r.constructor(t)).c,s=r.s,o=t.s,a=r.e,c=t.e;if(!n[0]||!i[0])return n[0]?s:i[0]?-o:0;if(s!=o)return s;if(e=s<0,a!=c)return a>c^e?1:-1;for(o=(a=n.length)<(c=i.length)?a:c,s=-1;++si[s]^e?1:-1;return a==c?0:a>c^e?1:-1};tr.div=function(t){var e=this,r=e.constructor,n=e.c,i=(t=new r(t)).c,s=e.s==t.s?1:-1,o=r.DP;if(o!==~~o||o<0||o>$f)throw Error(F6);if(!i[0])throw Error(xV);if(!n[0])return t.s=s,t.c=[t.e=0],t;var a,c,u,l,d,h=i.slice(),f=a=i.length,g=n.length,p=n.slice(0,a),m=p.length,b=t,v=b.c=[],E=0,w=o+(b.e=e.e-t.e)+1;for(b.s=s,s=w<0?0:w,h.unshift(0);m++m?1:-1;else for(d=-1,l=0;++dp[d]?1:-1;break}if(l<0){for(c=m==a?i:h;m;){if(p[--m]w&&wp(b,w,r.RM,p[0]!==Va),b};tr.eq=function(t){return this.cmp(t)===0};tr.gt=function(t){return this.cmp(t)>0};tr.gte=function(t){return this.cmp(t)>-1};tr.lt=function(t){return this.cmp(t)<0};tr.lte=function(t){return this.cmp(t)<1};tr.minus=tr.sub=function(t){var e,r,n,i,s=this,o=s.constructor,a=s.s,c=(t=new o(t)).s;if(a!=c)return t.s=-c,s.plus(t);var u=s.c.slice(),l=s.e,d=t.c,h=t.e;if(!u[0]||!d[0])return d[0]?t.s=-c:u[0]?t=new o(s):t.s=1,t;if(a=l-h){for((i=a<0)?(a=-a,n=u):(h=l,n=d),n.reverse(),c=a;c--;)n.push(0);n.reverse()}else for(r=((i=u.length0)for(;c--;)u[e++]=0;for(c=e;r>a;){if(u[--r]0?(c=o,n=u):(e=-e,n=a),n.reverse();e--;)n.push(0);n.reverse()}for(a.length-u.length<0&&(n=u,u=a,a=n),e=u.length,r=0;e;a[e]%=10)r=(a[--e]=a[e]+u[e]+r)/10|0;for(r&&(a.unshift(r),++c),e=a.length;a[--e]===0;)a.pop();return t.c=a,t.e=c,t};tr.pow=function(t){var e=this,r=new e.constructor("1"),n=r,i=t<0;if(t!==~~t||t<-ZR||t>ZR)throw Error(mp+"exponent");for(i&&(t=-t);t&1&&(n=n.times(e)),t>>=1,!!t;)e=e.times(e);return i?r.div(n):n};tr.prec=function(t,e){if(t!==~~t||t<1||t>$f)throw Error(mp+"precision");return wp(new this.constructor(this),t,e)};tr.round=function(t,e){if(t===Va)t=0;else if(t!==~~t||t<-$f||t>$f)throw Error(F6);return wp(new this.constructor(this),t+this.e+1,e)};tr.sqrt=function(){var t,e,r,n=this,i=n.constructor,s=n.s,o=n.e,a=new i("0.5");if(!n.c[0])return new i(n);if(s<0)throw Error(Cv+"No square root");s=Math.sqrt(+bp(n,!0,!0)),s===0||s===1/0?(e=n.c.join(""),e.length+o&1||(e+="0"),s=Math.sqrt(e),o=((o+1)/2|0)-(o<0||o&1),t=new i((s==1/0?"5e":(s=s.toExponential()).slice(0,s.indexOf("e")+1))+o)):t=new i(s+""),o=t.e+(i.DP+=4);do r=t,t=a.times(r.plus(n.div(r)));while(r.c.slice(0,o).join("")!==t.c.slice(0,o).join(""));return wp(t,(i.DP-=4)+t.e+1,i.RM)};tr.times=tr.mul=function(t){var e,r=this,n=r.constructor,i=r.c,s=(t=new n(t)).c,o=i.length,a=s.length,c=r.e,u=t.e;if(t.s=r.s==t.s?1:-1,!i[0]||!s[0])return t.c=[t.e=0],t;for(t.e=c+u,oc;)a=e[u]+s[c]*i[u-c-1]+a,e[u--]=a%10,a=a/10|0;e[u]=a}for(a?++t.e:e.shift(),c=e.length;!e[--c];)e.pop();return t.c=e,t};tr.toExponential=function(t,e){var r=this,n=r.c[0];if(t!==Va){if(t!==~~t||t<0||t>$f)throw Error(F6);for(r=wp(new r.constructor(r),++t,e);r.c.length$f)throw Error(F6);for(r=wp(new r.constructor(r),t+r.e+1,e),t=t+r.e+1;r.c.length=e.PE,!!t.c[0])};tr.toNumber=function(){var t=+bp(this,!0,!0);if(this.constructor.strict===!0&&!this.eq(t.toString()))throw Error(Cv+"Imprecise conversion");return t};tr.toPrecision=function(t,e){var r=this,n=r.constructor,i=r.c[0];if(t!==Va){if(t!==~~t||t<1||t>$f)throw Error(mp+"precision");for(r=wp(new n(r),t,e);r.c.length=n.PE,!!i)};tr.valueOf=function(){var t=this,e=t.constructor;if(e.strict===!0)throw Error(Cv+"valueOf disallowed");return bp(t,t.e<=e.NE||t.e>=e.PE,!0)};var k1=SV();const Dt={bigNumber(t){return t?new k1(t):new k1(0)},multiply(t,e){if(t===void 0||e===void 0)return new k1(0);const r=new k1(t),n=new k1(e);return r.times(n)},formatNumberToLocalString(t,e=2){return t===void 0?"0.00":typeof t=="number"?t.toLocaleString("en-US",{maximumFractionDigits:e,minimumFractionDigits:e}):parseFloat(t).toLocaleString("en-US",{maximumFractionDigits:e,minimumFractionDigits:e})},parseLocalStringToNumber(t){return t===void 0?0:parseFloat(t.replace(/,/gu,""))}},xne={numericInputKeyDown(t,e,r){const n=["Backspace","Meta","Ctrl","a","A","c","C","x","X","v","V","ArrowLeft","ArrowRight","Tab"],i=t.metaKey||t.ctrlKey,s=t.key,o=s.toLocaleLowerCase(),a=o==="a",c=o==="c",u=o==="v",l=o==="x",d=s===",",h=s===".",f=s>="0"&&s<="9";!i&&(a||c||u||l)&&t.preventDefault(),e==="0"&&!d&&!h&&s==="0"&&t.preventDefault(),e==="0"&&f&&(r(s),t.preventDefault()),(d||h)&&(e||(r("0."),t.preventDefault()),(e!=null&&e.includes(".")||e!=null&&e.includes(","))&&t.preventDefault()),!f&&!n.includes(s)&&!h&&!d&&t.preventDefault()}},Sne=[{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_value",type:"uint256"}],outputs:[{name:"",type:"bool"}]}],Tne=[{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}],Ine=[{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]}],TV={getERC20Abi:t=>_e.USDT_CONTRACT_ADDRESSES.includes(t)?Ine:Sne,getSwapAbi:()=>Tne},IV={URLS:{FAQ:"https://walletconnect.com/faq"}},bs={validateCaipAddress(t){var e;if(((e=t.split(":"))==null?void 0:e.length)!==3)throw new Error("Invalid CAIP Address");return t},parseCaipAddress(t){const e=t.split(":");if(e.length!==3)throw new Error(`Invalid CAIP-10 address: ${t}`);const[r,n,i]=e;if(!r||!n||!i)throw new Error(`Invalid CAIP-10 address: ${t}`);return{chainNamespace:r,chainId:n,address:i}},parseCaipNetworkId(t){const e=t.split(":");if(e.length!==2)throw new Error(`Invalid CAIP-2 network id: ${t}`);const[r,n]=e;if(!r||!n)throw new Error(`Invalid CAIP-2 network id: ${t}`);return{chainNamespace:r,chainId:n}}},mt={WALLET_ID:"@appkit/wallet_id",WALLET_NAME:"@appkit/wallet_name",SOLANA_WALLET:"@appkit/solana_wallet",SOLANA_CAIP_CHAIN:"@appkit/solana_caip_chain",ACTIVE_CAIP_NETWORK_ID:"@appkit/active_caip_network_id",CONNECTED_SOCIAL:"@appkit/connected_social",CONNECTED_SOCIAL_USERNAME:"@appkit-wallet/SOCIAL_USERNAME",RECENT_WALLETS:"@appkit/recent_wallets",DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",ACTIVE_NAMESPACE:"@appkit/active_namespace",CONNECTED_NAMESPACES:"@appkit/connected_namespaces",CONNECTION_STATUS:"@appkit/connection_status",SIWX_AUTH_TOKEN:"@appkit/siwx-auth-token",SIWX_NONCE_TOKEN:"@appkit/siwx-nonce-token",TELEGRAM_SOCIAL_PROVIDER:"@appkit/social_provider",NATIVE_BALANCE_CACHE:"@appkit/native_balance_cache",PORTFOLIO_CACHE:"@appkit/portfolio_cache",ENS_CACHE:"@appkit/ens_cache",IDENTITY_CACHE:"@appkit/identity_cache",PREFERRED_ACCOUNT_TYPES:"@appkit/preferred_account_types",CONNECTIONS:"@appkit/connections"};function n8(t){if(!t)throw new Error("Namespace is required for CONNECTED_CONNECTOR_ID");return`@appkit/${t}:connected_connector_id`}const dt={setItem(t,e){tb()&&e!==void 0&&localStorage.setItem(t,e)},getItem(t){if(tb())return localStorage.getItem(t)||void 0},removeItem(t){tb()&&localStorage.removeItem(t)},clear(){tb()&&localStorage.clear()}};function tb(){return typeof window<"u"&&typeof localStorage<"u"}function za(t,e){return e==="light"?{"--w3m-accent":(t==null?void 0:t["--w3m-accent"])||"hsla(231, 100%, 70%, 1)","--w3m-background":"#fff"}:{"--w3m-accent":(t==null?void 0:t["--w3m-accent"])||"hsla(230, 100%, 67%, 1)","--w3m-background":"#121313"}}var YR={};const i8=(typeof process<"u"&&typeof YR<"u"?YR.NEXT_PUBLIC_SECURE_SITE_ORIGIN:void 0)||"https://secure.walletconnect.org",PV=[{label:"Coinbase",name:"coinbase",feeRange:"1-2%",url:"",supportedChains:["eip155"]},{label:"Meld.io",name:"meld",feeRange:"1-2%",url:"https://meldcrypto.com",supportedChains:["eip155","solana"]}],Pne="WXETMuFUQmqqybHuRkSgxv:25B8LJHSfpG6LVjR2ytU5Cwh7Z4Sch2ocoU",ct={FOUR_MINUTES_MS:24e4,TEN_SEC_MS:1e4,FIVE_SEC_MS:5e3,THREE_SEC_MS:3e3,ONE_SEC_MS:1e3,SECURE_SITE:i8,SECURE_SITE_DASHBOARD:`${i8}/dashboard`,SECURE_SITE_FAVICON:`${i8}/images/favicon.png`,RESTRICTED_TIMEZONES:["ASIA/SHANGHAI","ASIA/URUMQI","ASIA/CHONGQING","ASIA/HARBIN","ASIA/KASHGAR","ASIA/MACAU","ASIA/HONG_KONG","ASIA/MACAO","ASIA/BEIJING","ASIA/HARBIN"],WC_COINBASE_PAY_SDK_CHAINS:["ethereum","arbitrum","polygon","berachain","avalanche-c-chain","optimism","celo","base"],WC_COINBASE_PAY_SDK_FALLBACK_CHAIN:"ethereum",WC_COINBASE_PAY_SDK_CHAIN_NAME_MAP:{Ethereum:"ethereum","Arbitrum One":"arbitrum",Polygon:"polygon",Berachain:"berachain",Avalanche:"avalanche-c-chain","OP Mainnet":"optimism",Celo:"celo",Base:"base"},WC_COINBASE_ONRAMP_APP_ID:"bf18c88d-495a-463b-b249-0b9d3656cf5e",SWAP_SUGGESTED_TOKENS:["ETH","UNI","1INCH","AAVE","SOL","ADA","AVAX","DOT","LINK","NITRO","GAIA","MILK","TRX","NEAR","GNO","WBTC","DAI","WETH","USDC","USDT","ARB","BAL","BICO","CRV","ENS","MATIC","OP"],SWAP_POPULAR_TOKENS:["ETH","UNI","1INCH","AAVE","SOL","ADA","AVAX","DOT","LINK","NITRO","GAIA","MILK","TRX","NEAR","GNO","WBTC","DAI","WETH","USDC","USDT","ARB","BAL","BICO","CRV","ENS","MATIC","OP","METAL","DAI","CHAMP","WOLF","SALE","BAL","BUSD","MUST","BTCpx","ROUTE","HEX","WELT","amDAI","VSQ","VISION","AURUM","pSP","SNX","VC","LINK","CHP","amUSDT","SPHERE","FOX","GIDDY","GFC","OMEN","OX_OLD","DE","WNT"],BALANCE_SUPPORTED_CHAINS:["eip155","solana"],SWAP_SUPPORTED_NETWORKS:["eip155:1","eip155:42161","eip155:10","eip155:324","eip155:8453","eip155:56","eip155:137","eip155:100","eip155:43114","eip155:250","eip155:8217","eip155:1313161554"],NAMES_SUPPORTED_CHAIN_NAMESPACES:["eip155"],ONRAMP_SUPPORTED_CHAIN_NAMESPACES:["eip155","solana"],ACTIVITY_ENABLED_CHAIN_NAMESPACES:["eip155"],NATIVE_TOKEN_ADDRESS:{eip155:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",solana:"So11111111111111111111111111111111111111111",polkadot:"0x",bip122:"0x",cosmos:"0x"},CONVERT_SLIPPAGE_TOLERANCE:1,CONNECT_LABELS:{MOBILE:"Open and continue in the wallet app",WEB:"Open and continue in the wallet app"},SEND_SUPPORTED_NAMESPACES:["eip155","solana"],DEFAULT_REMOTE_FEATURES:{swaps:["1inch"],onramp:["coinbase","meld"],email:!0,socials:["google","x","discord","farcaster","github","apple","facebook"],activity:!0,reownBranding:!0},DEFAULT_REMOTE_FEATURES_DISABLED:{email:!1,socials:!1,swaps:!1,onramp:!1,activity:!1,reownBranding:!1},DEFAULT_FEATURES:{receive:!0,send:!0,emailShowWallets:!0,connectorTypeOrder:["walletConnect","recent","injected","featured","custom","external","recommended"],analytics:!0,allWallets:!0,legalCheckbox:!1,smartSessions:!1,collapseWallets:!1,walletFeaturesOrder:["onramp","swaps","receive","send"],connectMethodsOrder:void 0,pay:!1},DEFAULT_SOCIALS:["google","x","farcaster","discord","apple","github","facebook"],DEFAULT_ACCOUNT_TYPES:{bip122:"payment",eip155:"smartAccount",polkadot:"eoa",solana:"eoa"},ADAPTER_TYPES:{UNIVERSAL:"universal",SOLANA:"solana",WAGMI:"wagmi",ETHERS:"ethers",ETHERS5:"ethers5",BITCOIN:"bitcoin"}},Le={cacheExpiry:{portfolio:3e4,nativeBalance:3e4,ens:3e5,identity:3e5},isCacheExpired(t,e){return Date.now()-t>e},getActiveNetworkProps(){const t=Le.getActiveNamespace(),e=Le.getActiveCaipNetworkId(),r=e?e.split(":")[1]:void 0,n=r?isNaN(Number(r))?r:Number(r):void 0;return{namespace:t,caipNetworkId:e,chainId:n}},setWalletConnectDeepLink({name:t,href:e}){try{dt.setItem(mt.DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},getWalletConnectDeepLink(){try{const t=dt.getItem(mt.DEEPLINK_CHOICE);if(t)return JSON.parse(t)}catch{console.info("Unable to get WalletConnect deep link")}},deleteWalletConnectDeepLink(){try{dt.removeItem(mt.DEEPLINK_CHOICE)}catch{console.info("Unable to delete WalletConnect deep link")}},setActiveNamespace(t){try{dt.setItem(mt.ACTIVE_NAMESPACE,t)}catch{console.info("Unable to set active namespace")}},setActiveCaipNetworkId(t){try{dt.setItem(mt.ACTIVE_CAIP_NETWORK_ID,t),Le.setActiveNamespace(t.split(":")[0])}catch{console.info("Unable to set active caip network id")}},getActiveCaipNetworkId(){try{return dt.getItem(mt.ACTIVE_CAIP_NETWORK_ID)}catch{console.info("Unable to get active caip network id");return}},deleteActiveCaipNetworkId(){try{dt.removeItem(mt.ACTIVE_CAIP_NETWORK_ID)}catch{console.info("Unable to delete active caip network id")}},deleteConnectedConnectorId(t){try{const e=n8(t);dt.removeItem(e)}catch{console.info("Unable to delete connected connector id")}},setAppKitRecent(t){try{const e=Le.getRecentWallets();e.find(n=>n.id===t.id)||(e.unshift(t),e.length>2&&e.pop(),dt.setItem(mt.RECENT_WALLETS,JSON.stringify(e)))}catch{console.info("Unable to set AppKit recent")}},getRecentWallets(){try{const t=dt.getItem(mt.RECENT_WALLETS);return t?JSON.parse(t):[]}catch{console.info("Unable to get AppKit recent")}return[]},setConnectedConnectorId(t,e){try{const r=n8(t);dt.setItem(r,e)}catch{console.info("Unable to set Connected Connector Id")}},getActiveNamespace(){try{return dt.getItem(mt.ACTIVE_NAMESPACE)}catch{console.info("Unable to get active namespace")}},getConnectedConnectorId(t){if(t)try{const e=n8(t);return dt.getItem(e)}catch{console.info("Unable to get connected connector id in namespace ",t)}},setConnectedSocialProvider(t){try{dt.setItem(mt.CONNECTED_SOCIAL,t)}catch{console.info("Unable to set connected social provider")}},getConnectedSocialProvider(){try{return dt.getItem(mt.CONNECTED_SOCIAL)}catch{console.info("Unable to get connected social provider")}},deleteConnectedSocialProvider(){try{dt.removeItem(mt.CONNECTED_SOCIAL)}catch{console.info("Unable to delete connected social provider")}},getConnectedSocialUsername(){try{return dt.getItem(mt.CONNECTED_SOCIAL_USERNAME)}catch{console.info("Unable to get connected social username")}},getStoredActiveCaipNetworkId(){var r;const t=dt.getItem(mt.ACTIVE_CAIP_NETWORK_ID);return(r=t==null?void 0:t.split(":"))==null?void 0:r[1]},setConnectionStatus(t){try{dt.setItem(mt.CONNECTION_STATUS,t)}catch{console.info("Unable to set connection status")}},getConnectionStatus(){try{return dt.getItem(mt.CONNECTION_STATUS)}catch{return}},getConnectedNamespaces(){try{const t=dt.getItem(mt.CONNECTED_NAMESPACES);return t!=null&&t.length?t.split(","):[]}catch{return[]}},setConnectedNamespaces(t){try{const e=Array.from(new Set(t));dt.setItem(mt.CONNECTED_NAMESPACES,e.join(","))}catch{console.info("Unable to set namespaces in storage")}},addConnectedNamespace(t){try{const e=Le.getConnectedNamespaces();e.includes(t)||(e.push(t),Le.setConnectedNamespaces(e))}catch{console.info("Unable to add connected namespace")}},removeConnectedNamespace(t){try{const e=Le.getConnectedNamespaces(),r=e.indexOf(t);r>-1&&(e.splice(r,1),Le.setConnectedNamespaces(e))}catch{console.info("Unable to remove connected namespace")}},getTelegramSocialProvider(){try{return dt.getItem(mt.TELEGRAM_SOCIAL_PROVIDER)}catch{return console.info("Unable to get telegram social provider"),null}},setTelegramSocialProvider(t){try{dt.setItem(mt.TELEGRAM_SOCIAL_PROVIDER,t)}catch{console.info("Unable to set telegram social provider")}},removeTelegramSocialProvider(){try{dt.removeItem(mt.TELEGRAM_SOCIAL_PROVIDER)}catch{console.info("Unable to remove telegram social provider")}},getBalanceCache(){let t={};try{const e=dt.getItem(mt.PORTFOLIO_CACHE);t=e?JSON.parse(e):{}}catch{console.info("Unable to get balance cache")}return t},removeAddressFromBalanceCache(t){try{const e=Le.getBalanceCache();dt.setItem(mt.PORTFOLIO_CACHE,JSON.stringify({...e,[t]:void 0}))}catch{console.info("Unable to remove address from balance cache",t)}},getBalanceCacheForCaipAddress(t){try{const r=Le.getBalanceCache()[t];if(r&&!this.isCacheExpired(r.timestamp,this.cacheExpiry.portfolio))return r.balance;Le.removeAddressFromBalanceCache(t)}catch{console.info("Unable to get balance cache for address",t)}},updateBalanceCache(t){try{const e=Le.getBalanceCache();e[t.caipAddress]=t,dt.setItem(mt.PORTFOLIO_CACHE,JSON.stringify(e))}catch{console.info("Unable to update balance cache",t)}},getNativeBalanceCache(){let t={};try{const e=dt.getItem(mt.NATIVE_BALANCE_CACHE);t=e?JSON.parse(e):{}}catch{console.info("Unable to get balance cache")}return t},removeAddressFromNativeBalanceCache(t){try{const e=Le.getBalanceCache();dt.setItem(mt.NATIVE_BALANCE_CACHE,JSON.stringify({...e,[t]:void 0}))}catch{console.info("Unable to remove address from balance cache",t)}},getNativeBalanceCacheForCaipAddress(t){try{const r=Le.getNativeBalanceCache()[t];if(r&&!this.isCacheExpired(r.timestamp,this.cacheExpiry.nativeBalance))return r;console.info("Discarding cache for address",t),Le.removeAddressFromBalanceCache(t)}catch{console.info("Unable to get balance cache for address",t)}},updateNativeBalanceCache(t){try{const e=Le.getNativeBalanceCache();e[t.caipAddress]=t,dt.setItem(mt.NATIVE_BALANCE_CACHE,JSON.stringify(e))}catch{console.info("Unable to update balance cache",t)}},getEnsCache(){let t={};try{const e=dt.getItem(mt.ENS_CACHE);t=e?JSON.parse(e):{}}catch{console.info("Unable to get ens name cache")}return t},getEnsFromCacheForAddress(t){try{const r=Le.getEnsCache()[t];if(r&&!this.isCacheExpired(r.timestamp,this.cacheExpiry.ens))return r.ens;Le.removeEnsFromCache(t)}catch{console.info("Unable to get ens name from cache",t)}},updateEnsCache(t){try{const e=Le.getEnsCache();e[t.address]=t,dt.setItem(mt.ENS_CACHE,JSON.stringify(e))}catch{console.info("Unable to update ens name cache",t)}},removeEnsFromCache(t){try{const e=Le.getEnsCache();dt.setItem(mt.ENS_CACHE,JSON.stringify({...e,[t]:void 0}))}catch{console.info("Unable to remove ens name from cache",t)}},getIdentityCache(){let t={};try{const e=dt.getItem(mt.IDENTITY_CACHE);t=e?JSON.parse(e):{}}catch{console.info("Unable to get identity cache")}return t},getIdentityFromCacheForAddress(t){try{const r=Le.getIdentityCache()[t];if(r&&!this.isCacheExpired(r.timestamp,this.cacheExpiry.identity))return r.identity;Le.removeIdentityFromCache(t)}catch{console.info("Unable to get identity from cache",t)}},updateIdentityCache(t){try{const e=Le.getIdentityCache();e[t.address]={identity:t.identity,timestamp:t.timestamp},dt.setItem(mt.IDENTITY_CACHE,JSON.stringify(e))}catch{console.info("Unable to update identity cache",t)}},removeIdentityFromCache(t){try{const e=Le.getIdentityCache();dt.setItem(mt.IDENTITY_CACHE,JSON.stringify({...e,[t]:void 0}))}catch{console.info("Unable to remove identity from cache",t)}},clearAddressCache(){try{dt.removeItem(mt.PORTFOLIO_CACHE),dt.removeItem(mt.NATIVE_BALANCE_CACHE),dt.removeItem(mt.ENS_CACHE),dt.removeItem(mt.IDENTITY_CACHE)}catch{console.info("Unable to clear address cache")}},setPreferredAccountTypes(t){try{dt.setItem(mt.PREFERRED_ACCOUNT_TYPES,JSON.stringify(t))}catch{console.info("Unable to set preferred account types",t)}},getPreferredAccountTypes(){try{const t=dt.getItem(mt.PREFERRED_ACCOUNT_TYPES);return t?JSON.parse(t):{}}catch{console.info("Unable to get preferred account types")}return{}},setConnections(t,e){try{const r={...Le.getConnections(),[e]:t};dt.setItem(mt.CONNECTIONS,JSON.stringify(r))}catch(r){console.error("Unable to sync connections to storage",r)}},getConnections(){try{const t=dt.getItem(mt.CONNECTIONS);return t?JSON.parse(t):{}}catch(t){return console.error("Unable to get connections from storage",t),{}}}},ue={isMobile(){var t;return this.isClient()?!!(typeof(window==null?void 0:window.matchMedia)=="function"&&((t=window==null?void 0:window.matchMedia("(pointer:coarse)"))!=null&&t.matches)||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},checkCaipNetwork(t,e=""){return t==null?void 0:t.caipNetworkId.toLocaleLowerCase().includes(e.toLowerCase())},isAndroid(){if(!this.isMobile())return!1;const t=window==null?void 0:window.navigator.userAgent.toLowerCase();return ue.isMobile()&&t.includes("android")},isIos(){if(!this.isMobile())return!1;const t=window==null?void 0:window.navigator.userAgent.toLowerCase();return t.includes("iphone")||t.includes("ipad")},isSafari(){return this.isClient()?(window==null?void 0:window.navigator.userAgent.toLowerCase()).includes("safari"):!1},isClient(){return typeof window<"u"},isPairingExpired(t){return t?t-Date.now()<=ct.TEN_SEC_MS:!0},isAllowedRetry(t,e=ct.ONE_SEC_MS){return Date.now()-t>=e},copyToClopboard(t){navigator.clipboard.writeText(t)},isIframe(){try{return(window==null?void 0:window.self)!==(window==null?void 0:window.top)}catch{return!1}},isSafeApp(){var t,e;if(ue.isClient()&&window.self!==window.top)try{const r=(e=(t=window==null?void 0:window.location)==null?void 0:t.ancestorOrigins)==null?void 0:e[0],n="https://app.safe.global";if(r){const i=new URL(r),s=new URL(n);return i.hostname===s.hostname}}catch{return!1}return!1},getPairingExpiry(){return Date.now()+ct.FOUR_MINUTES_MS},getNetworkId(t){return t==null?void 0:t.split(":")[1]},getPlainAddress(t){return t==null?void 0:t.split(":")[2]},async wait(t){return new Promise(e=>{setTimeout(e,t)})},debounce(t,e=500){let r;return(...n)=>{function i(){t(...n)}r&&clearTimeout(r),r=setTimeout(i,e)}},isHttpUrl(t){return t.startsWith("http://")||t.startsWith("https://")},formatNativeUrl(t,e,r=null){if(ue.isHttpUrl(t))return this.formatUniversalUrl(t,e);let n=t,i=r;n.includes("://")||(n=t.replaceAll("/","").replaceAll(":",""),n=`${n}://`),n.endsWith("/")||(n=`${n}/`),i&&!(i!=null&&i.endsWith("/"))&&(i=`${i}/`),this.isTelegram()&&this.isAndroid()&&(e=encodeURIComponent(e));const s=encodeURIComponent(e);return{redirect:`${n}wc?uri=${s}`,redirectUniversalLink:i?`${i}wc?uri=${s}`:void 0,href:n}},formatUniversalUrl(t,e){if(!ue.isHttpUrl(t))return this.formatNativeUrl(t,e);let r=t;r.endsWith("/")||(r=`${r}/`);const n=encodeURIComponent(e);return{redirect:`${r}wc?uri=${n}`,href:r}},getOpenTargetForPlatform(t){return t==="popupWindow"?t:this.isTelegram()?Le.getTelegramSocialProvider()?"_top":"_blank":t},openHref(t,e,r){window==null||window.open(t,this.getOpenTargetForPlatform(e),r||"noreferrer noopener")},returnOpenHref(t,e,r){return window==null?void 0:window.open(t,this.getOpenTargetForPlatform(e),r||"noreferrer noopener")},isTelegram(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)},isPWA(){var r,n,i;if(typeof window>"u")return!1;const t=(n=(r=window.matchMedia)==null?void 0:r.call(window,"(display-mode: standalone)"))==null?void 0:n.matches,e=(i=window==null?void 0:window.navigator)==null?void 0:i.standalone;return!!(t||e)},async preloadImage(t){const e=new Promise((r,n)=>{const i=new Image;i.onload=r,i.onerror=n,i.crossOrigin="anonymous",i.src=t});return Promise.race([e,ue.wait(2e3)])},formatBalance(t,e){let r="0.000";if(typeof t=="string"){const n=Number(t);if(n){const i=Math.floor(n*1e3)/1e3;i&&(r=i.toString())}}return`${r}${e?` ${e}`:""}`},formatBalance2(t,e){var n;let r;if(t==="0")r="0";else if(typeof t=="string"){const i=Number(t);i&&(r=(n=i.toString().match(/^-?\d+(?:\.\d{0,3})?/u))==null?void 0:n[0])}return{value:r??"0",rest:r==="0"?"000":"",symbol:e}},getApiUrl(){return _e.W3M_API_URL},getBlockchainApiUrl(){return _e.BLOCKCHAIN_API_RPC_URL},getAnalyticsUrl(){return _e.PULSE_API_URL},getUUID(){return crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})},parseError(t){var e,r;return typeof t=="string"?t:typeof((r=(e=t==null?void 0:t.issues)==null?void 0:e[0])==null?void 0:r.message)=="string"?t.issues[0].message:t instanceof Error?t.message:"Unknown error"},sortRequestedNetworks(t,e=[]){const r={};return e&&t&&(t.forEach((n,i)=>{r[n]=i}),e.sort((n,i)=>{const s=r[n.id],o=r[i.id];return s!==void 0&&o!==void 0?s-o:s!==void 0?-1:o!==void 0?1:0})),e},calculateBalance(t){let e=0;for(const r of t)e+=r.value??0;return e},formatTokenBalance(t){const e=t.toFixed(2),[r,n]=e.split(".");return{dollars:r,pennies:n}},isAddress(t,e="eip155"){switch(e){case"eip155":if(/^(?:0x)?[0-9a-f]{40}$/iu.test(t)){if(/^(?:0x)?[0-9a-f]{40}$/iu.test(t)||/^(?:0x)?[0-9A-F]{40}$/iu.test(t))return!0}else return!1;return!1;case"solana":return/[1-9A-HJ-NP-Za-km-z]{32,44}$/iu.test(t);default:return!1}},uniqueBy(t,e){const r=new Set;return t.filter(n=>{const i=n[e];return r.has(i)?!1:(r.add(i),!0)})},generateSdkVersion(t,e,r){const i=t.length===0?ct.ADAPTER_TYPES.UNIVERSAL:t.map(s=>s.adapterType).join(",");return`${e}-${i}-${r}`},createAccount(t,e,r,n,i){return{namespace:t,address:e,type:r,publicKey:n,path:i}},isCaipAddress(t){if(typeof t!="string")return!1;const e=t.split(":"),r=e[0];return e.filter(Boolean).length===3&&r in _e.CHAIN_NAME_MAP},isMac(){const t=window==null?void 0:window.navigator.userAgent.toLowerCase();return t.includes("macintosh")&&!t.includes("safari")},formatTelegramSocialLoginUrl(t){const e=`--${encodeURIComponent(window==null?void 0:window.location.href)}`,r="state=";if(new URL(t).host==="auth.magic.link"){const i="provider_authorization_url=",s=t.substring(t.indexOf(i)+i.length),o=this.injectIntoUrl(decodeURIComponent(s),r,e);return t.replace(s,encodeURIComponent(o))}return this.injectIntoUrl(t,r,e)},injectIntoUrl(t,e,r){const n=t.indexOf(e);if(n===-1)throw new Error(`${e} parameter not found in the URL: ${t}`);const i=t.indexOf("&",n),s=e.length,o=i!==-1?i:t.length,a=t.substring(0,n+s),c=t.substring(n+s,o),u=t.substring(i),l=c+r;return a+l+u}};async function N1(...t){const e=await fetch(...t);if(!e.ok)throw new Error(`HTTP status code: ${e.status}`,{cause:e});return e}class Av{constructor({baseUrl:e,clientId:r}){this.baseUrl=e,this.clientId=r}async get({headers:e,signal:r,cache:n,...i}){const s=this.createUrl(i);return(await N1(s,{method:"GET",headers:e,signal:r,cache:n})).json()}async getBlob({headers:e,signal:r,...n}){const i=this.createUrl(n);return(await N1(i,{method:"GET",headers:e,signal:r})).blob()}async post({body:e,headers:r,signal:n,...i}){const s=this.createUrl(i);return(await N1(s,{method:"POST",headers:r,body:e?JSON.stringify(e):void 0,signal:n})).json()}async put({body:e,headers:r,signal:n,...i}){const s=this.createUrl(i);return(await N1(s,{method:"PUT",headers:r,body:e?JSON.stringify(e):void 0,signal:n})).json()}async delete({body:e,headers:r,signal:n,...i}){const s=this.createUrl(i);return(await N1(s,{method:"DELETE",headers:r,body:e?JSON.stringify(e):void 0,signal:n})).json()}createUrl({path:e,params:r}){const n=new URL(e,this.baseUrl);return r&&Object.entries(r).forEach(([i,s])=>{s&&n.searchParams.append(i,s)}),this.clientId&&n.searchParams.append("clientId",this.clientId),n}}const One={getFeatureValue(t,e){const r=e==null?void 0:e[t];return r===void 0?ct.DEFAULT_FEATURES[t]:r},filterSocialsByPlatform(t){if(!t||!t.length)return t;if(ue.isTelegram()){if(ue.isIos())return t.filter(e=>e!=="google");if(ue.isMac())return t.filter(e=>e!=="x");if(ue.isAndroid())return t.filter(e=>!["facebook","x"].includes(e))}return t}},at=rr({features:ct.DEFAULT_FEATURES,projectId:"",sdkType:"appkit",sdkVersion:"html-wagmi-undefined",defaultAccountTypes:ct.DEFAULT_ACCOUNT_TYPES,enableNetworkSwitch:!0,experimental_preferUniversalLinks:!1,remoteFeatures:{}}),oe={state:at,subscribeKey(t,e){return dn(at,t,e)},setOptions(t){Object.assign(at,t)},setRemoteFeatures(t){var r;if(!t)return;const e={...at.remoteFeatures,...t};at.remoteFeatures=e,(r=at.remoteFeatures)!=null&&r.socials&&(at.remoteFeatures.socials=One.filterSocialsByPlatform(at.remoteFeatures.socials))},setFeatures(t){if(!t)return;at.features||(at.features=ct.DEFAULT_FEATURES);const e={...at.features,...t};at.features=e},setProjectId(t){at.projectId=t},setCustomRpcUrls(t){at.customRpcUrls=t},setAllWallets(t){at.allWallets=t},setIncludeWalletIds(t){at.includeWalletIds=t},setExcludeWalletIds(t){at.excludeWalletIds=t},setFeaturedWalletIds(t){at.featuredWalletIds=t},setTokens(t){at.tokens=t},setTermsConditionsUrl(t){at.termsConditionsUrl=t},setPrivacyPolicyUrl(t){at.privacyPolicyUrl=t},setCustomWallets(t){at.customWallets=t},setIsSiweEnabled(t){at.isSiweEnabled=t},setIsUniversalProvider(t){at.isUniversalProvider=t},setSdkVersion(t){at.sdkVersion=t},setMetadata(t){at.metadata=t},setDisableAppend(t){at.disableAppend=t},setEIP6963Enabled(t){at.enableEIP6963=t},setDebug(t){at.debug=t},setEnableWalletConnect(t){at.enableWalletConnect=t},setEnableWalletGuide(t){at.enableWalletGuide=t},setEnableAuthLogger(t){at.enableAuthLogger=t},setEnableWallets(t){at.enableWallets=t},setPreferUniversalLinks(t){at.experimental_preferUniversalLinks=t},setHasMultipleAddresses(t){at.hasMultipleAddresses=t},setSIWX(t){at.siwx=t},setConnectMethodsOrder(t){at.features={...at.features,connectMethodsOrder:t}},setWalletFeaturesOrder(t){at.features={...at.features,walletFeaturesOrder:t}},setSocialsOrder(t){at.remoteFeatures={...at.remoteFeatures,socials:t}},setCollapseWallets(t){at.features={...at.features,collapseWallets:t}},setEnableEmbedded(t){at.enableEmbedded=t},setAllowUnsupportedChain(t){at.allowUnsupportedChain=t},setManualWCControl(t){at.manualWCControl=t},setEnableNetworkSwitch(t){at.enableNetworkSwitch=t},setDefaultAccountTypes(t={}){Object.entries(t).forEach(([e,r])=>{r&&(at.defaultAccountTypes[e]=r)})},setUniversalProviderConfigOverride(t){at.universalProviderConfigOverride=t},getUniversalProviderConfigOverride(){return at.universalProviderConfigOverride},getSnapshot(){return Jb(at)}},Rne=Object.freeze({enabled:!0,events:[]}),kne=new Av({baseUrl:ue.getAnalyticsUrl(),clientId:null}),Nne=5,$ne=60*1e3,hl=rr({...Rne}),jne={state:hl,subscribeKey(t,e){return dn(hl,t,e)},async sendError(t,e){if(!hl.enabled)return;const r=Date.now();if(hl.events.filter(s=>{const o=new Date(s.properties.timestamp||"").getTime();return r-o<$ne}).length>=Nne)return;const i={type:"error",event:e,properties:{errorType:t.name,errorMessage:t.message,stackTrace:t.stack,timestamp:new Date().toISOString()}};hl.events.push(i);try{if(typeof window>"u")return;const{projectId:s,sdkType:o,sdkVersion:a}=oe.state;await kne.post({path:"/e",params:{projectId:s,st:o,sv:a||"html-wagmi-4.2.2"},body:{eventId:ue.getUUID(),url:window.location.href,domain:window.location.hostname,timestamp:new Date().toISOString(),props:{type:"error",event:e,errorType:t.name,errorMessage:t.message,stackTrace:t.stack}}})}catch{}},enable(){hl.enabled=!0},disable(){hl.enabled=!1},clearEvents(){hl.events=[]}};class sm extends Error{constructor(e,r,n){super(e),this.name="AppKitError",this.category=r,this.originalError=n,Object.setPrototypeOf(this,sm.prototype);let i=!1;if(n instanceof Error&&typeof n.stack=="string"&&n.stack){const s=n.stack,o=s.indexOf(` `);if(o>-1){const a=s.substring(o+1);this.stack=`${this.name}: ${this.message} ${a}`,i=!0}}i||(Error.captureStackTrace?Error.captureStackTrace(this,sm):this.stack||(this.stack=`${this.name}: ${this.message}`))}}function JR(t,e){const r=t instanceof sm?t:new sm(t instanceof Error?t.message:String(t),e,t);throw jne.sendError(r,r.category),r}function Pi(t,e="INTERNAL_SDK_ERROR"){const r={};return Object.keys(t).forEach(n=>{const i=t[n];if(typeof i=="function"){let s=i;i.constructor.name==="AsyncFunction"?s=async(...o)=>{try{return await i(...o)}catch(a){return JR(a,e)}}:s=(...o)=>{try{return i(...o)}catch(a){return JR(a,e)}},r[n]=s}else r[n]=i}),r}const Ma={PHANTOM:{id:"a797aa35c0fadbfc1a53e7f675162ed5226968b44a19ee3d24385c64d1d3c393",url:"https://phantom.app"},SOLFLARE:{id:"1ca0bdd4747578705b1939af023d120677c64fe6ca76add81fda36e350605e79",url:"https://solflare.com"},COINBASE:{id:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",url:"https://go.cb-w.com"}},Bne={handleMobileDeeplinkRedirect(t,e){const r=window.location.href,n=encodeURIComponent(r);if(t===Ma.PHANTOM.id&&!("phantom"in window)){const i=r.startsWith("https")?"https":"http",s=r.split("/")[2],o=encodeURIComponent(`${i}://${s}`);window.location.href=`${Ma.PHANTOM.url}/ul/browse/${n}?ref=${o}`}t===Ma.SOLFLARE.id&&!("solflare"in window)&&(window.location.href=`${Ma.SOLFLARE.url}/ul/v1/browse/${n}?ref=${n}`),e===_e.CHAIN.SOLANA&&t===Ma.COINBASE.id&&!("coinbaseSolana"in window)&&(window.location.href=`${Ma.COINBASE.url}/dapp?cb_url=${n}`)}},ss=rr({walletImages:{},networkImages:{},chainImages:{},connectorImages:{},tokenImages:{},currencyImages:{}}),Dne={state:ss,subscribeNetworkImages(t){return ln(ss.networkImages,()=>t(ss.networkImages))},subscribeKey(t,e){return dn(ss,t,e)},subscribe(t){return ln(ss,()=>t(ss))},setWalletImage(t,e){ss.walletImages[t]=e},setNetworkImage(t,e){ss.networkImages[t]=e},setChainImage(t,e){ss.chainImages[t]=e},setConnectorImage(t,e){ss.connectorImages={...ss.connectorImages,[t]:e}},setTokenImage(t,e){ss.tokenImages[t]=e},setCurrencyImage(t,e){ss.currencyImages[t]=e}},er=Pi(Dne),Mne={eip155:"ba0ba0cd-17c6-4806-ad93-f9d174f17900",solana:"a1b58899-f671-4276-6a5e-56ca5bd59700",polkadot:"",bip122:"0b4838db-0161-4ffe-022d-532bf03dba00",cosmos:""},s8=rr({networkImagePromises:{}}),pt={async fetchWalletImage(t){if(t)return await Ne._fetchWalletImage(t),this.getWalletImageById(t)},async fetchNetworkImage(t){if(!t)return;const e=this.getNetworkImageById(t);return e||(s8.networkImagePromises[t]||(s8.networkImagePromises[t]=Ne._fetchNetworkImage(t)),await s8.networkImagePromises[t],this.getNetworkImageById(t))},getWalletImageById(t){if(t)return er.state.walletImages[t]},getWalletImage(t){if(t!=null&&t.image_url)return t==null?void 0:t.image_url;if(t!=null&&t.image_id)return er.state.walletImages[t.image_id]},getNetworkImage(t){var e,r,n;if((e=t==null?void 0:t.assets)!=null&&e.imageUrl)return(r=t==null?void 0:t.assets)==null?void 0:r.imageUrl;if((n=t==null?void 0:t.assets)!=null&&n.imageId)return er.state.networkImages[t.assets.imageId]},getNetworkImageById(t){if(t)return er.state.networkImages[t]},getConnectorImage(t){if(t!=null&&t.imageUrl)return t.imageUrl;if(t!=null&&t.imageId)return er.state.connectorImages[t.imageId]},getChainImage(t){return er.state.networkImages[Mne[t]]}},fl=rr({message:"",variant:"info",open:!1}),Lne={state:fl,subscribeKey(t,e){return dn(fl,t,e)},open(t,e){const{debug:r}=oe.state,{shortMessage:n,longMessage:i}=t;r&&(fl.message=n,fl.variant=e,fl.open=!0),i&&console.error(typeof i=="function"?i():i)},close(){fl.open=!1,fl.message="",fl.variant="info"}},Fn=Pi(Lne),Une=ue.getAnalyticsUrl(),Fne=new Av({baseUrl:Une,clientId:null}),Hne=["MODAL_CREATED"],wc=rr({timestamp:Date.now(),reportedErrors:{},data:{type:"track",event:"MODAL_CREATED"}}),Re={state:wc,subscribe(t){return ln(wc,()=>t(wc))},getSdkProperties(){const{projectId:t,sdkType:e,sdkVersion:r}=oe.state;return{projectId:t,st:e,sv:r||"html-wagmi-4.2.2"}},async _sendAnalyticsEvent(t){try{const e=re.state.address;if(Hne.includes(t.data.event)||typeof window>"u")return;await Fne.post({path:"/e",params:Re.getSdkProperties(),body:{eventId:ue.getUUID(),url:window.location.href,domain:window.location.hostname,timestamp:t.timestamp,props:{...t.data,address:e}}}),wc.reportedErrors.FORBIDDEN=!1}catch(e){e instanceof Error&&e.cause instanceof Response&&e.cause.status===_e.HTTP_STATUS_CODES.FORBIDDEN&&!wc.reportedErrors.FORBIDDEN&&(Fn.open({shortMessage:"Invalid App Configuration",longMessage:`Origin ${tb()?window.origin:"uknown"} not found on Allowlist - update configuration on cloud.reown.com`},"error"),wc.reportedErrors.FORBIDDEN=!0)}},sendEvent(t){var e;wc.timestamp=Date.now(),wc.data=t,(e=oe.state.features)!=null&&e.analytics&&Re._sendAnalyticsEvent(wc)}},qne=ue.getApiUrl(),Ni=new Av({baseUrl:qne,clientId:null}),zne=40,QR=4,Wne=20,wt=rr({promises:{},page:1,count:0,featured:[],allFeatured:[],recommended:[],allRecommended:[],wallets:[],filteredWallets:[],search:[],isAnalyticsEnabled:!1,excludedWallets:[],isFetchingRecommendedWallets:!1}),Ne={state:wt,subscribeKey(t,e){return dn(wt,t,e)},_getSdkProperties(){const{projectId:t,sdkType:e,sdkVersion:r}=oe.state;return{projectId:t,st:e||"appkit",sv:r||"html-wagmi-4.2.2"}},_filterOutExtensions(t){return oe.state.isUniversalProvider?t.filter(e=>!!(e.mobile_link||e.desktop_link||e.webapp_link)):t},async _fetchWalletImage(t){const e=`${Ni.baseUrl}/getWalletImage/${t}`,r=await Ni.getBlob({path:e,params:Ne._getSdkProperties()});er.setWalletImage(t,URL.createObjectURL(r))},async _fetchNetworkImage(t){const e=`${Ni.baseUrl}/public/getAssetImage/${t}`,r=await Ni.getBlob({path:e,params:Ne._getSdkProperties()});er.setNetworkImage(t,URL.createObjectURL(r))},async _fetchConnectorImage(t){const e=`${Ni.baseUrl}/public/getAssetImage/${t}`,r=await Ni.getBlob({path:e,params:Ne._getSdkProperties()});er.setConnectorImage(t,URL.createObjectURL(r))},async _fetchCurrencyImage(t){const e=`${Ni.baseUrl}/public/getCurrencyImage/${t}`,r=await Ni.getBlob({path:e,params:Ne._getSdkProperties()});er.setCurrencyImage(t,URL.createObjectURL(r))},async _fetchTokenImage(t){const e=`${Ni.baseUrl}/public/getTokenImage/${t}`,r=await Ni.getBlob({path:e,params:Ne._getSdkProperties()});er.setTokenImage(t,URL.createObjectURL(r))},_filterWalletsByPlatform(t){return ue.isMobile()?t==null?void 0:t.filter(r=>r.mobile_link||r.id===Ma.COINBASE.id?!0:F.state.activeChain==="solana"&&(r.id===Ma.SOLFLARE.id||r.id===Ma.PHANTOM.id)):t},async fetchProjectConfig(){return(await Ni.get({path:"/appkit/v1/config",params:Ne._getSdkProperties()})).features},async fetchAllowedOrigins(){try{const{allowedOrigins:t}=await Ni.get({path:"/projects/v1/origins",params:Ne._getSdkProperties()});return t}catch{return[]}},async fetchNetworkImages(){const t=F.getAllRequestedCaipNetworks(),e=t==null?void 0:t.map(({assets:r})=>r==null?void 0:r.imageId).filter(Boolean).filter(r=>!pt.getNetworkImageById(r));e&&await Promise.allSettled(e.map(r=>Ne._fetchNetworkImage(r)))},async fetchConnectorImages(){const{connectors:t}=ge.state,e=t.map(({imageId:r})=>r).filter(Boolean);await Promise.allSettled(e.map(r=>Ne._fetchConnectorImage(r)))},async fetchCurrencyImages(t=[]){await Promise.allSettled(t.map(e=>Ne._fetchCurrencyImage(e)))},async fetchTokenImages(t=[]){await Promise.allSettled(t.map(e=>Ne._fetchTokenImage(e)))},async fetchWallets(t){var s;const e=t.exclude??[];Ne._getSdkProperties().sv.startsWith("html-core-")&&e.push(...Object.values(Ma).map(o=>o.id));const n=await Ni.get({path:"/getWallets",params:{...Ne._getSdkProperties(),...t,page:String(t.page),entries:String(t.entries),include:(s=t.include)==null?void 0:s.join(","),exclude:e.join(",")}});return{data:Ne._filterWalletsByPlatform(n==null?void 0:n.data)||[],count:n==null?void 0:n.count}},async fetchFeaturedWallets(){const{featuredWalletIds:t}=oe.state;if(t!=null&&t.length){const e={...Ne._getSdkProperties(),page:1,entries:(t==null?void 0:t.length)??QR,include:t},{data:r}=await Ne.fetchWallets(e),n=[...r].sort((s,o)=>t.indexOf(s.id)-t.indexOf(o.id)),i=n.map(s=>s.image_id).filter(Boolean);await Promise.allSettled(i.map(s=>Ne._fetchWalletImage(s))),wt.featured=n,wt.allFeatured=n}},async fetchRecommendedWallets(){try{wt.isFetchingRecommendedWallets=!0;const{includeWalletIds:t,excludeWalletIds:e,featuredWalletIds:r}=oe.state,n=[...e??[],...r??[]].filter(Boolean),i=F.getRequestedCaipNetworkIds().join(","),s={page:1,entries:QR,include:t,exclude:n,chains:i},{data:o,count:a}=await Ne.fetchWallets(s),c=Le.getRecentWallets(),u=o.map(d=>d.image_id).filter(Boolean),l=c.map(d=>d.image_id).filter(Boolean);await Promise.allSettled([...u,...l].map(d=>Ne._fetchWalletImage(d))),wt.recommended=o,wt.allRecommended=o,wt.count=a??0}catch{}finally{wt.isFetchingRecommendedWallets=!1}},async fetchWalletsByPage({page:t}){const{includeWalletIds:e,excludeWalletIds:r,featuredWalletIds:n}=oe.state,i=F.getRequestedCaipNetworkIds().join(","),s=[...wt.recommended.map(({id:l})=>l),...r??[],...n??[]].filter(Boolean),o={page:t,entries:zne,include:e,exclude:s,chains:i},{data:a,count:c}=await Ne.fetchWallets(o),u=a.slice(0,Wne).map(l=>l.image_id).filter(Boolean);await Promise.allSettled(u.map(l=>Ne._fetchWalletImage(l))),wt.wallets=ue.uniqueBy([...wt.wallets,...Ne._filterOutExtensions(a)],"id").filter(l=>{var d;return(d=l.chains)==null?void 0:d.some(h=>i.includes(h))}),wt.count=c>wt.count?c:wt.count,wt.page=t},async initializeExcludedWallets({ids:t}){const e={page:1,entries:t.length,include:t},{data:r}=await Ne.fetchWallets(e);r&&r.forEach(n=>{wt.excludedWallets.push({rdns:n.rdns,name:n.name})})},async searchWallet({search:t,badge:e}){const{includeWalletIds:r,excludeWalletIds:n}=oe.state,i=F.getRequestedCaipNetworkIds().join(",");wt.search=[];const s={page:1,entries:100,search:t==null?void 0:t.trim(),badge_type:e,include:r,exclude:n,chains:i},{data:o}=await Ne.fetchWallets(s);Re.sendEvent({type:"track",event:"SEARCH_WALLET",properties:{badge:e??"",search:t??""}});const a=o.map(c=>c.image_id).filter(Boolean);await Promise.allSettled([...a.map(c=>Ne._fetchWalletImage(c)),ue.wait(300)]),wt.search=Ne._filterOutExtensions(o)},initPromise(t,e){const r=wt.promises[t];return r||(wt.promises[t]=e())},prefetch({fetchConnectorImages:t=!0,fetchFeaturedWallets:e=!0,fetchRecommendedWallets:r=!0,fetchNetworkImages:n=!0}={}){const i=[t&&Ne.initPromise("connectorImages",Ne.fetchConnectorImages),e&&Ne.initPromise("featuredWallets",Ne.fetchFeaturedWallets),r&&Ne.initPromise("recommendedWallets",Ne.fetchRecommendedWallets),n&&Ne.initPromise("networkImages",Ne.fetchNetworkImages)].filter(Boolean);return Promise.allSettled(i)},prefetchAnalyticsConfig(){var t;(t=oe.state.features)!=null&&t.analytics&&Ne.fetchAnalyticsConfig()},async fetchAnalyticsConfig(){try{const{isAnalyticsEnabled:t}=await Ni.get({path:"/getAnalyticsConfig",params:Ne._getSdkProperties()});oe.setFeatures({analytics:t})}catch{oe.setFeatures({analytics:!1})}},filterByNamespaces(t){if(!(t!=null&&t.length)){wt.featured=wt.allFeatured,wt.recommended=wt.allRecommended;return}const e=F.getRequestedCaipNetworkIds().join(",");wt.featured=wt.allFeatured.filter(r=>{var n;return(n=r.chains)==null?void 0:n.some(i=>e.includes(i))}),wt.recommended=wt.allRecommended.filter(r=>{var n;return(n=r.chains)==null?void 0:n.some(i=>e.includes(i))}),wt.filteredWallets=wt.wallets.filter(r=>{var n;return(n=r.chains)==null?void 0:n.some(i=>e.includes(i))})},clearFilterByNamespaces(){wt.filteredWallets=[]},setFilterByNamespace(t){if(!t){wt.featured=wt.allFeatured,wt.recommended=wt.allRecommended;return}const e=F.getRequestedCaipNetworkIds().join(",");wt.featured=wt.allFeatured.filter(r=>{var n;return(n=r.chains)==null?void 0:n.some(i=>e.includes(i))}),wt.recommended=wt.allRecommended.filter(r=>{var n;return(n=r.chains)==null?void 0:n.some(i=>e.includes(i))}),wt.filteredWallets=wt.wallets.filter(r=>{var n;return(n=r.chains)==null?void 0:n.some(i=>e.includes(i))})}},nr=rr({view:"Connect",history:["Connect"],transactionStack:[]}),Vne={state:nr,subscribeKey(t,e){return dn(nr,t,e)},pushTransactionStack(t){nr.transactionStack.push(t)},popTransactionStack(t){const e=nr.transactionStack.pop();if(!e)return;const{onSuccess:r,onError:n,onCancel:i}=e;switch(t){case"success":r==null||r();break;case"error":n==null||n(),X.goBack();break;case"cancel":i==null||i(),X.goBack();break}},push(t,e){t!==nr.view&&(nr.view=t,nr.history.push(t),nr.data=e)},reset(t,e){nr.view=t,nr.history=[t],nr.data=e},replace(t,e){nr.history.at(-1)===t||(nr.view=t,nr.history[nr.history.length-1]=t,nr.data=e)},goBack(){var n;const t=F.state.activeCaipAddress,e=X.state.view==="ConnectingFarcaster",r=!t&&e;if(nr.history.length>1){nr.history.pop();const[i]=nr.history.slice(-1);i&&(t&&i==="Connect"?nr.view="Account":nr.view=i)}else We.close();(n=nr.data)!=null&&n.wallet&&(nr.data.wallet=void 0),setTimeout(()=>{var i,s,o;if(r){re.setFarcasterUrl(void 0,F.state.activeChain);const a=ge.getAuthConnector();(i=a==null?void 0:a.provider)==null||i.reload();const c=Jb(oe.state);(o=(s=a==null?void 0:a.provider)==null?void 0:s.syncDappData)==null||o.call(s,{metadata:c.metadata,sdkVersion:c.sdkVersion,projectId:c.projectId,sdkType:c.sdkType})}},100)},goBackToIndex(t){if(nr.history.length>1){nr.history=nr.history.slice(0,t+1);const[e]=nr.history.slice(-1);e&&(nr.view=e)}},goBackOrCloseModal(){X.state.history.length>1?X.goBack():We.close()}},X=Pi(Vne),bc=rr({themeMode:"dark",themeVariables:{},w3mThemeVariables:void 0}),QT={state:bc,subscribe(t){return ln(bc,()=>t(bc))},setThemeMode(t){bc.themeMode=t;try{const e=ge.getAuthConnector();if(e){const r=QT.getSnapshot().themeVariables;e.provider.syncTheme({themeMode:t,themeVariables:r,w3mThemeVariables:za(r,t)})}}catch{console.info("Unable to sync theme to auth connector")}},setThemeVariables(t){bc.themeVariables={...bc.themeVariables,...t};try{const e=ge.getAuthConnector();if(e){const r=QT.getSnapshot().themeVariables;e.provider.syncTheme({themeVariables:r,w3mThemeVariables:za(bc.themeVariables,bc.themeMode)})}}catch{console.info("Unable to sync theme to auth connector")}},getSnapshot(){return Jb(bc)}},ar=Pi(QT),OV={eip155:void 0,solana:void 0,polkadot:void 0,bip122:void 0,cosmos:void 0},Lt=rr({allConnectors:[],connectors:[],activeConnector:void 0,filterByNamespace:void 0,activeConnectorIds:{...OV},filterByNamespaceMap:{eip155:!0,solana:!0,polkadot:!0,bip122:!0,cosmos:!0}}),Gne={state:Lt,subscribe(t){return ln(Lt,()=>{t(Lt)})},subscribeKey(t,e){return dn(Lt,t,e)},initialize(t){t.forEach(e=>{const r=Le.getConnectedConnectorId(e);r&&ge.setConnectorId(r,e)})},setActiveConnector(t){t&&(Lt.activeConnector=Nf(t))},setConnectors(t){t.filter(i=>!Lt.allConnectors.some(s=>s.id===i.id&&ge.getConnectorName(s.name)===ge.getConnectorName(i.name)&&s.chain===i.chain)).forEach(i=>{i.type!=="MULTI_CHAIN"&&Lt.allConnectors.push(Nf(i))});const r=ge.getEnabledNamespaces(),n=ge.getEnabledConnectors(r);Lt.connectors=ge.mergeMultiChainConnectors(n)},filterByNamespaces(t){Object.keys(Lt.filterByNamespaceMap).forEach(e=>{Lt.filterByNamespaceMap[e]=!1}),t.forEach(e=>{Lt.filterByNamespaceMap[e]=!0}),ge.updateConnectorsForEnabledNamespaces()},filterByNamespace(t,e){Lt.filterByNamespaceMap[t]=e,ge.updateConnectorsForEnabledNamespaces()},updateConnectorsForEnabledNamespaces(){const t=ge.getEnabledNamespaces(),e=ge.getEnabledConnectors(t),r=ge.areAllNamespacesEnabled();Lt.connectors=ge.mergeMultiChainConnectors(e),r?Ne.clearFilterByNamespaces():Ne.filterByNamespaces(t)},getEnabledNamespaces(){return Object.entries(Lt.filterByNamespaceMap).filter(([t,e])=>e).map(([t])=>t)},getEnabledConnectors(t){return Lt.allConnectors.filter(e=>t.includes(e.chain))},areAllNamespacesEnabled(){return Object.values(Lt.filterByNamespaceMap).every(t=>t)},mergeMultiChainConnectors(t){const e=ge.generateConnectorMapByName(t),r=[];return e.forEach(n=>{const i=n[0],s=(i==null?void 0:i.id)===_e.CONNECTOR_ID.AUTH;n.length>1&&i?r.push({name:i.name,imageUrl:i.imageUrl,imageId:i.imageId,connectors:[...n],type:s?"AUTH":"MULTI_CHAIN",chain:"eip155",id:(i==null?void 0:i.id)||""}):i&&r.push(i)}),r},generateConnectorMapByName(t){const e=new Map;return t.forEach(r=>{const{name:n}=r,i=ge.getConnectorName(n);if(!i)return;const s=e.get(i)||[];s.find(a=>a.chain===r.chain)||s.push(r),e.set(i,s)}),e},getConnectorName(t){return t&&({"Trust Wallet":"Trust"}[t]||t)},getUniqueConnectorsByName(t){const e=[];return t.forEach(r=>{e.find(n=>n.chain===r.chain)||e.push(r)}),e},addConnector(t){var e,r,n;if(t.id===_e.CONNECTOR_ID.AUTH){const i=t,s=Jb(oe.state),o=ar.getSnapshot().themeMode,a=ar.getSnapshot().themeVariables;(r=(e=i==null?void 0:i.provider)==null?void 0:e.syncDappData)==null||r.call(e,{metadata:s.metadata,sdkVersion:s.sdkVersion,projectId:s.projectId,sdkType:s.sdkType}),(n=i==null?void 0:i.provider)==null||n.syncTheme({themeMode:o,themeVariables:a,w3mThemeVariables:za(a,o)}),ge.setConnectors([t])}else ge.setConnectors([t])},getAuthConnector(t){var n;const e=t||F.state.activeChain,r=Lt.connectors.find(i=>i.id===_e.CONNECTOR_ID.AUTH);if(r)return(n=r==null?void 0:r.connectors)!=null&&n.length?r.connectors.find(s=>s.chain===e):r},getAnnouncedConnectorRdns(){return Lt.connectors.filter(t=>t.type==="ANNOUNCED").map(t=>{var e;return(e=t.info)==null?void 0:e.rdns})},getConnectorById(t){return Lt.allConnectors.find(e=>e.id===t)},getConnector(t,e){return Lt.allConnectors.filter(n=>n.chain===F.state.activeChain).find(n=>{var i;return n.explorerId===t||((i=n.info)==null?void 0:i.rdns)===e})},syncIfAuthConnector(t){var s,o;if(t.id!=="ID_AUTH")return;const e=t,r=Jb(oe.state),n=ar.getSnapshot().themeMode,i=ar.getSnapshot().themeVariables;(o=(s=e==null?void 0:e.provider)==null?void 0:s.syncDappData)==null||o.call(s,{metadata:r.metadata,sdkVersion:r.sdkVersion,sdkType:r.sdkType,projectId:r.projectId}),e.provider.syncTheme({themeMode:n,themeVariables:i,w3mThemeVariables:za(i,n)})},getConnectorsByNamespace(t){const e=Lt.allConnectors.filter(r=>r.chain===t);return ge.mergeMultiChainConnectors(e)},selectWalletConnector(t){const e=ge.getConnector(t.id,t.rdns),r=F.state.activeChain;Bne.handleMobileDeeplinkRedirect((e==null?void 0:e.explorerId)||t.id,r),e?X.push("ConnectingExternal",{connector:e}):X.push("ConnectingWalletConnect",{wallet:t})},getConnectors(t){return t?ge.getConnectorsByNamespace(t):ge.mergeMultiChainConnectors(Lt.allConnectors)},setFilterByNamespace(t){Lt.filterByNamespace=t,Lt.connectors=ge.getConnectors(t),Ne.setFilterByNamespace(t)},setConnectorId(t,e){t&&(Lt.activeConnectorIds={...Lt.activeConnectorIds,[e]:t},Le.setConnectedConnectorId(e,t))},removeConnectorId(t){Lt.activeConnectorIds={...Lt.activeConnectorIds,[t]:void 0},Le.deleteConnectedConnectorId(t)},getConnectorId(t){if(t)return Lt.activeConnectorIds[t]},isConnected(t){return t?!!Lt.activeConnectorIds[t]:Object.values(Lt.activeConnectorIds).some(e=>!!e)},resetConnectorIds(){Lt.activeConnectorIds={...OV}}},ge=Pi(Gne);var om={};const Kne="https://secure.walletconnect.org/sdk",Zne=(typeof process<"u"&&typeof om<"u"?om.NEXT_PUBLIC_SECURE_SITE_SDK_URL:void 0)||Kne,Yne=(typeof process<"u"&&typeof om<"u"?om.NEXT_PUBLIC_DEFAULT_LOG_LEVEL:void 0)||"error",Jne=(typeof process<"u"&&typeof om<"u"?om.NEXT_PUBLIC_SECURE_SITE_SDK_VERSION:void 0)||"4",Ye={APP_EVENT_KEY:"@w3m-app/",FRAME_EVENT_KEY:"@w3m-frame/",RPC_METHOD_KEY:"RPC_",STORAGE_KEY:"@appkit-wallet/",SESSION_TOKEN_KEY:"SESSION_TOKEN_KEY",EMAIL_LOGIN_USED_KEY:"EMAIL_LOGIN_USED_KEY",LAST_USED_CHAIN_KEY:"LAST_USED_CHAIN_KEY",LAST_EMAIL_LOGIN_TIME:"LAST_EMAIL_LOGIN_TIME",EMAIL:"EMAIL",PREFERRED_ACCOUNT_TYPE:"PREFERRED_ACCOUNT_TYPE",SMART_ACCOUNT_ENABLED:"SMART_ACCOUNT_ENABLED",SMART_ACCOUNT_ENABLED_NETWORKS:"SMART_ACCOUNT_ENABLED_NETWORKS",SOCIAL_USERNAME:"SOCIAL_USERNAME",APP_SWITCH_NETWORK:"@w3m-app/SWITCH_NETWORK",APP_CONNECT_EMAIL:"@w3m-app/CONNECT_EMAIL",APP_CONNECT_DEVICE:"@w3m-app/CONNECT_DEVICE",APP_CONNECT_OTP:"@w3m-app/CONNECT_OTP",APP_CONNECT_SOCIAL:"@w3m-app/CONNECT_SOCIAL",APP_GET_SOCIAL_REDIRECT_URI:"@w3m-app/GET_SOCIAL_REDIRECT_URI",APP_GET_USER:"@w3m-app/GET_USER",APP_SIGN_OUT:"@w3m-app/SIGN_OUT",APP_IS_CONNECTED:"@w3m-app/IS_CONNECTED",APP_GET_CHAIN_ID:"@w3m-app/GET_CHAIN_ID",APP_RPC_REQUEST:"@w3m-app/RPC_REQUEST",APP_UPDATE_EMAIL:"@w3m-app/UPDATE_EMAIL",APP_UPDATE_EMAIL_PRIMARY_OTP:"@w3m-app/UPDATE_EMAIL_PRIMARY_OTP",APP_UPDATE_EMAIL_SECONDARY_OTP:"@w3m-app/UPDATE_EMAIL_SECONDARY_OTP",APP_AWAIT_UPDATE_EMAIL:"@w3m-app/AWAIT_UPDATE_EMAIL",APP_SYNC_THEME:"@w3m-app/SYNC_THEME",APP_SYNC_DAPP_DATA:"@w3m-app/SYNC_DAPP_DATA",APP_GET_SMART_ACCOUNT_ENABLED_NETWORKS:"@w3m-app/GET_SMART_ACCOUNT_ENABLED_NETWORKS",APP_INIT_SMART_ACCOUNT:"@w3m-app/INIT_SMART_ACCOUNT",APP_SET_PREFERRED_ACCOUNT:"@w3m-app/SET_PREFERRED_ACCOUNT",APP_CONNECT_FARCASTER:"@w3m-app/CONNECT_FARCASTER",APP_GET_FARCASTER_URI:"@w3m-app/GET_FARCASTER_URI",APP_RELOAD:"@w3m-app/RELOAD",FRAME_SWITCH_NETWORK_ERROR:"@w3m-frame/SWITCH_NETWORK_ERROR",FRAME_SWITCH_NETWORK_SUCCESS:"@w3m-frame/SWITCH_NETWORK_SUCCESS",FRAME_CONNECT_EMAIL_ERROR:"@w3m-frame/CONNECT_EMAIL_ERROR",FRAME_CONNECT_EMAIL_SUCCESS:"@w3m-frame/CONNECT_EMAIL_SUCCESS",FRAME_CONNECT_DEVICE_ERROR:"@w3m-frame/CONNECT_DEVICE_ERROR",FRAME_CONNECT_DEVICE_SUCCESS:"@w3m-frame/CONNECT_DEVICE_SUCCESS",FRAME_CONNECT_OTP_SUCCESS:"@w3m-frame/CONNECT_OTP_SUCCESS",FRAME_CONNECT_OTP_ERROR:"@w3m-frame/CONNECT_OTP_ERROR",FRAME_CONNECT_SOCIAL_SUCCESS:"@w3m-frame/CONNECT_SOCIAL_SUCCESS",FRAME_CONNECT_SOCIAL_ERROR:"@w3m-frame/CONNECT_SOCIAL_ERROR",FRAME_CONNECT_FARCASTER_SUCCESS:"@w3m-frame/CONNECT_FARCASTER_SUCCESS",FRAME_CONNECT_FARCASTER_ERROR:"@w3m-frame/CONNECT_FARCASTER_ERROR",FRAME_GET_FARCASTER_URI_SUCCESS:"@w3m-frame/GET_FARCASTER_URI_SUCCESS",FRAME_GET_FARCASTER_URI_ERROR:"@w3m-frame/GET_FARCASTER_URI_ERROR",FRAME_GET_SOCIAL_REDIRECT_URI_SUCCESS:"@w3m-frame/GET_SOCIAL_REDIRECT_URI_SUCCESS",FRAME_GET_SOCIAL_REDIRECT_URI_ERROR:"@w3m-frame/GET_SOCIAL_REDIRECT_URI_ERROR",FRAME_GET_USER_SUCCESS:"@w3m-frame/GET_USER_SUCCESS",FRAME_GET_USER_ERROR:"@w3m-frame/GET_USER_ERROR",FRAME_SIGN_OUT_SUCCESS:"@w3m-frame/SIGN_OUT_SUCCESS",FRAME_SIGN_OUT_ERROR:"@w3m-frame/SIGN_OUT_ERROR",FRAME_IS_CONNECTED_SUCCESS:"@w3m-frame/IS_CONNECTED_SUCCESS",FRAME_IS_CONNECTED_ERROR:"@w3m-frame/IS_CONNECTED_ERROR",FRAME_GET_CHAIN_ID_SUCCESS:"@w3m-frame/GET_CHAIN_ID_SUCCESS",FRAME_GET_CHAIN_ID_ERROR:"@w3m-frame/GET_CHAIN_ID_ERROR",FRAME_RPC_REQUEST_SUCCESS:"@w3m-frame/RPC_REQUEST_SUCCESS",FRAME_RPC_REQUEST_ERROR:"@w3m-frame/RPC_REQUEST_ERROR",FRAME_SESSION_UPDATE:"@w3m-frame/SESSION_UPDATE",FRAME_UPDATE_EMAIL_SUCCESS:"@w3m-frame/UPDATE_EMAIL_SUCCESS",FRAME_UPDATE_EMAIL_ERROR:"@w3m-frame/UPDATE_EMAIL_ERROR",FRAME_UPDATE_EMAIL_PRIMARY_OTP_SUCCESS:"@w3m-frame/UPDATE_EMAIL_PRIMARY_OTP_SUCCESS",FRAME_UPDATE_EMAIL_PRIMARY_OTP_ERROR:"@w3m-frame/UPDATE_EMAIL_PRIMARY_OTP_ERROR",FRAME_UPDATE_EMAIL_SECONDARY_OTP_SUCCESS:"@w3m-frame/UPDATE_EMAIL_SECONDARY_OTP_SUCCESS",FRAME_UPDATE_EMAIL_SECONDARY_OTP_ERROR:"@w3m-frame/UPDATE_EMAIL_SECONDARY_OTP_ERROR",FRAME_SYNC_THEME_SUCCESS:"@w3m-frame/SYNC_THEME_SUCCESS",FRAME_SYNC_THEME_ERROR:"@w3m-frame/SYNC_THEME_ERROR",FRAME_SYNC_DAPP_DATA_SUCCESS:"@w3m-frame/SYNC_DAPP_DATA_SUCCESS",FRAME_SYNC_DAPP_DATA_ERROR:"@w3m-frame/SYNC_DAPP_DATA_ERROR",FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS:"@w3m-frame/GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS",FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR:"@w3m-frame/GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR",FRAME_INIT_SMART_ACCOUNT_SUCCESS:"@w3m-frame/INIT_SMART_ACCOUNT_SUCCESS",FRAME_INIT_SMART_ACCOUNT_ERROR:"@w3m-frame/INIT_SMART_ACCOUNT_ERROR",FRAME_SET_PREFERRED_ACCOUNT_SUCCESS:"@w3m-frame/SET_PREFERRED_ACCOUNT_SUCCESS",FRAME_SET_PREFERRED_ACCOUNT_ERROR:"@w3m-frame/SET_PREFERRED_ACCOUNT_ERROR",FRAME_READY:"@w3m-frame/READY",FRAME_RELOAD_SUCCESS:"@w3m-frame/RELOAD_SUCCESS",FRAME_RELOAD_ERROR:"@w3m-frame/RELOAD_ERROR",RPC_RESPONSE_TYPE_ERROR:"RPC_RESPONSE_ERROR",RPC_RESPONSE_TYPE_TX:"RPC_RESPONSE_TRANSACTION_HASH",RPC_RESPONSE_TYPE_OBJECT:"RPC_RESPONSE_OBJECT"},bt={SAFE_RPC_METHODS:["eth_accounts","eth_blockNumber","eth_call","eth_chainId","eth_estimateGas","eth_feeHistory","eth_gasPrice","eth_getAccount","eth_getBalance","eth_getBlockByHash","eth_getBlockByNumber","eth_getBlockReceipts","eth_getBlockTransactionCountByHash","eth_getBlockTransactionCountByNumber","eth_getCode","eth_getFilterChanges","eth_getFilterLogs","eth_getLogs","eth_getProof","eth_getStorageAt","eth_getTransactionByBlockHashAndIndex","eth_getTransactionByBlockNumberAndIndex","eth_getTransactionByHash","eth_getTransactionCount","eth_getTransactionReceipt","eth_getUncleCountByBlockHash","eth_getUncleCountByBlockNumber","eth_maxPriorityFeePerGas","eth_newBlockFilter","eth_newFilter","eth_newPendingTransactionFilter","eth_sendRawTransaction","eth_syncing","eth_uninstallFilter","wallet_getCapabilities","wallet_getCallsStatus","eth_getUserOperationReceipt","eth_estimateUserOperationGas","eth_getUserOperationByHash","eth_supportedEntryPoints","wallet_getAssets"],NOT_SAFE_RPC_METHODS:["personal_sign","eth_signTypedData_v4","eth_sendTransaction","solana_signMessage","solana_signTransaction","solana_signAllTransactions","solana_signAndSendTransaction","wallet_sendCalls","wallet_grantPermissions","wallet_revokePermissions","eth_sendUserOperation"],GET_CHAIN_ID:"eth_chainId",RPC_METHOD_NOT_ALLOWED_MESSAGE:"Requested RPC call is not allowed",RPC_METHOD_NOT_ALLOWED_UI_MESSAGE:"Action not allowed",ACCOUNT_TYPES:{EOA:"eoa",SMART_ACCOUNT:"smartAccount"}},$h=Object.freeze({message:"",variant:"success",svg:void 0,open:!1,autoClose:!0}),pn=rr({...$h}),Qne={state:pn,subscribeKey(t,e){return dn(pn,t,e)},showLoading(t,e={}){this._showMessage({message:t,variant:"loading",...e})},showSuccess(t){this._showMessage({message:t,variant:"success"})},showSvg(t,e){this._showMessage({message:t,svg:e})},showError(t){const e=ue.parseError(t);this._showMessage({message:e,variant:"error"})},hide(){pn.message=$h.message,pn.variant=$h.variant,pn.svg=$h.svg,pn.open=$h.open,pn.autoClose=$h.autoClose},_showMessage({message:t,svg:e,variant:r="success",autoClose:n=$h.autoClose}){pn.open?(pn.open=!1,setTimeout(()=>{pn.message=t,pn.variant=r,pn.svg=e,pn.open=!0,pn.autoClose=n},150)):(pn.message=t,pn.variant=r,pn.svg=e,pn.open=!0,pn.autoClose=n)}},Fe=Qne,Ar=rr({transactions:[],coinbaseTransactions:{},transactionsByYear:{},lastNetworkInView:void 0,loading:!1,empty:!1,next:void 0}),Xne={state:Ar,subscribe(t){return ln(Ar,()=>t(Ar))},setLastNetworkInView(t){Ar.lastNetworkInView=t},async fetchTransactions(t,e){var r,n;if(!t)throw new Error("Transactions can't be fetched without an accountAddress");Ar.loading=!0;try{const i=await Xe.fetchTransactions({account:t,cursor:Ar.next,onramp:e,cache:e==="coinbase"?"no-cache":void 0,chainId:(r=F.state.activeCaipNetwork)==null?void 0:r.caipNetworkId}),s=Dr.filterSpamTransactions(i.data),o=Dr.filterByConnectedChain(s),a=[...Ar.transactions,...o];Ar.loading=!1,e==="coinbase"?Ar.coinbaseTransactions=Dr.groupTransactionsByYearAndMonth(Ar.coinbaseTransactions,i.data):(Ar.transactions=a,Ar.transactionsByYear=Dr.groupTransactionsByYearAndMonth(Ar.transactionsByYear,o)),Ar.empty=a.length===0,Ar.next=i.next?i.next:void 0}catch{const s=F.state.activeChain;Re.sendEvent({type:"track",event:"ERROR_FETCH_TRANSACTIONS",properties:{address:t,projectId:oe.state.projectId,cursor:Ar.next,isSmartAccount:((n=re.state.preferredAccountTypes)==null?void 0:n[s])===bt.ACCOUNT_TYPES.SMART_ACCOUNT}}),Fe.showError("Failed to fetch transactions"),Ar.loading=!1,Ar.empty=!0,Ar.next=void 0}},groupTransactionsByYearAndMonth(t={},e=[]){const r=t;return e.forEach(n=>{const i=new Date(n.metadata.minedAt).getFullYear(),s=new Date(n.metadata.minedAt).getMonth(),o=r[i]??{},c=(o[s]??[]).filter(u=>u.id!==n.id);r[i]={...o,[s]:[...c,n].sort((u,l)=>new Date(l.metadata.minedAt).getTime()-new Date(u.metadata.minedAt).getTime())}}),r},filterSpamTransactions(t){return t.filter(e=>!e.transfers.every(n=>{var i;return((i=n.nft_info)==null?void 0:i.flags.is_spam)===!0}))},filterByConnectedChain(t){var n;const e=(n=F.state.activeCaipNetwork)==null?void 0:n.caipNetworkId;return t.filter(i=>i.metadata.chain===e)},clearCursor(){Ar.next=void 0},resetTransactions(){Ar.transactions=[],Ar.transactionsByYear={},Ar.lastNetworkInView=void 0,Ar.loading=!1,Ar.empty=!1,Ar.next=void 0}},Dr=Pi(Xne,"API_ERROR"),fr=rr({connections:new Map,wcError:!1,buffering:!1,status:"disconnected"});let ah;const eie={state:fr,subscribeKey(t,e){return dn(fr,t,e)},_getClient(){return fr._client},setClient(t){fr._client=Nf(t)},async connectWalletConnect(){var t,e,r,n;if(ue.isTelegram()||ue.isSafari()&&ue.isIos()){if(ah){await ah,ah=void 0;return}if(!ue.isPairingExpired(fr==null?void 0:fr.wcPairingExpiry)){const i=fr.wcUri;fr.wcUri=i;return}ah=(e=(t=xe._getClient())==null?void 0:t.connectWalletConnect)==null?void 0:e.call(t).catch(()=>{}),xe.state.status="connecting",await ah,ah=void 0,fr.wcPairingExpiry=void 0,xe.state.status="connected"}else await((n=(r=xe._getClient())==null?void 0:r.connectWalletConnect)==null?void 0:n.call(r))},async connectExternal(t,e,r=!0){var n,i;await((i=(n=xe._getClient())==null?void 0:n.connectExternal)==null?void 0:i.call(n,t)),r&&F.setActiveNamespace(e)},async reconnectExternal(t){var r,n;await((n=(r=xe._getClient())==null?void 0:r.reconnectExternal)==null?void 0:n.call(r,t));const e=t.chain||F.state.activeChain;e&&ge.setConnectorId(t.id,e)},async setPreferredAccountType(t,e){var n;We.setLoading(!0,F.state.activeChain);const r=ge.getAuthConnector();r&&(re.setPreferredAccountType(t,e),await r.provider.setPreferredAccount(t),Le.setPreferredAccountTypes(re.state.preferredAccountTypes??{[e]:t}),await xe.reconnectExternal(r),We.setLoading(!1,F.state.activeChain),Re.sendEvent({type:"track",event:"SET_PREFERRED_ACCOUNT_TYPE",properties:{accountType:t,network:((n=F.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)||""}}))},async signMessage(t){var e;return(e=xe._getClient())==null?void 0:e.signMessage(t)},parseUnits(t,e){var r;return(r=xe._getClient())==null?void 0:r.parseUnits(t,e)},formatUnits(t,e){var r;return(r=xe._getClient())==null?void 0:r.formatUnits(t,e)},async sendTransaction(t){var e;return(e=xe._getClient())==null?void 0:e.sendTransaction(t)},async getCapabilities(t){var e;return(e=xe._getClient())==null?void 0:e.getCapabilities(t)},async grantPermissions(t){var e;return(e=xe._getClient())==null?void 0:e.grantPermissions(t)},async walletGetAssets(t){var e;return((e=xe._getClient())==null?void 0:e.walletGetAssets(t))??{}},async estimateGas(t){var e;return(e=xe._getClient())==null?void 0:e.estimateGas(t)},async writeContract(t){var e;return(e=xe._getClient())==null?void 0:e.writeContract(t)},async getEnsAddress(t){var e;return(e=xe._getClient())==null?void 0:e.getEnsAddress(t)},async getEnsAvatar(t){var e;return(e=xe._getClient())==null?void 0:e.getEnsAvatar(t)},checkInstalled(t){var e,r;return((r=(e=xe._getClient())==null?void 0:e.checkInstalled)==null?void 0:r.call(e,t))||!1},resetWcConnection(){fr.wcUri=void 0,fr.wcPairingExpiry=void 0,fr.wcLinking=void 0,fr.recentWallet=void 0,fr.status="disconnected",Dr.resetTransactions(),Le.deleteWalletConnectDeepLink()},resetUri(){fr.wcUri=void 0,fr.wcPairingExpiry=void 0,ah=void 0},finalizeWcConnection(){var r,n;const{wcLinking:t,recentWallet:e}=xe.state;t&&Le.setWalletConnectDeepLink(t),e&&Le.setAppKitRecent(e),Re.sendEvent({type:"track",event:"CONNECT_SUCCESS",properties:{method:t?"mobile":"qrcode",name:((n=(r=X.state.data)==null?void 0:r.wallet)==null?void 0:n.name)||"Unknown"}})},setWcBasic(t){fr.wcBasic=t},setUri(t){fr.wcUri=t,fr.wcPairingExpiry=ue.getPairingExpiry()},setWcLinking(t){fr.wcLinking=t},setWcError(t){fr.wcError=t,fr.buffering=!1},setRecentWallet(t){fr.recentWallet=t},setBuffering(t){fr.buffering=t},setStatus(t){fr.status=t},async disconnect(t){var e;try{await((e=xe._getClient())==null?void 0:e.disconnect(t))}catch(r){throw new sm("Failed to disconnect","INTERNAL_SDK_ERROR",r)}},setConnections(t,e){fr.connections.set(e,t)},switchAccount({connection:t,address:e,namespace:r}){if(ge.state.activeConnectorIds[r]===t.connectorId){const s=F.state.activeCaipNetwork;if(s){const o=`${r}:${s.id}:${e}`;re.setCaipAddress(o,r)}else console.warn(`No current network found for namespace "${r}"`)}else{const s=ge.getConnector(t.connectorId);s?xe.connectExternal(s,r):console.warn(`No connector found for namespace "${r}"`)}}},xe=Pi(eie),Wp=rr({loading:!1,open:!1,selectedNetworkId:void 0,activeChain:void 0,initialized:!1}),Ga={state:Wp,subscribe(t){return ln(Wp,()=>t(Wp))},subscribeOpen(t){return dn(Wp,"open",t)},set(t){Object.assign(Wp,{...Wp,...t})}},XR="/docs/contract/encodeFunctionData";function tie(t){const{abi:e,args:r,functionName:n}=t;let i=e[0];if(n){const s=zre({abi:e,args:r,name:n});if(!s)throw new DR(n,{docsPath:XR});i=s}if(i.type!=="function")throw new DR(void 0,{docsPath:XR});return{abi:[i],functionName:yV(KT(i))}}function ek(t){const{args:e}=t,{abi:r,functionName:n}=(()=>{var a;return t.abi.length===1&&((a=t.functionName)!=null&&a.startsWith("0x"))?t:tie(t)})(),i=r[0],s=n,o="inputs"in i&&i.inputs?T9(i.inputs,e??[]):void 0;return iV([s,o??"0x"])}const rie="modulepreload",nie=function(t){return"/"+t},tk={},ke=function(e,r,n){let i=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));i=Promise.allSettled(r.map(c=>{if(c=nie(c),c in tk)return;tk[c]=!0;const u=c.endsWith(".css"),l=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${l}`))return;const d=document.createElement("link");if(d.rel=u?"stylesheet":rie,u||(d.as="script"),d.crossOrigin="",d.href=c,a&&d.setAttribute("nonce",a),document.head.appendChild(d),u)return new Promise((h,f)=>{d.addEventListener("load",h),d.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})};function iie(){let t=()=>{},e=()=>{};return{promise:new Promise((n,i)=>{t=n,e=i}),resolve:t,reject:e}}const o8=new Map;function sie({fn:t,id:e,shouldSplitBatch:r,wait:n=0,sort:i}){const s=async()=>{const l=c();o();const d=l.map(({args:h})=>h);d.length!==0&&t(d).then(h=>{i&&Array.isArray(h)&&h.sort(i);for(let f=0;f{for(let f=0;fo8.delete(e),a=()=>c().map(({args:l})=>l),c=()=>o8.get(e)||[],u=l=>o8.set(e,[...c(),l]);return{flush:o,async schedule(l){const{promise:d,resolve:h,reject:f}=iie();return(r==null?void 0:r([...a(),l]))&&s(),c().length>0?(u({args:l,resolve:h,reject:f}),d):(u({args:l,resolve:h,reject:f}),setTimeout(s,n),d)}}}async function RV(t){return new Promise(e=>setTimeout(e,t))}const XT=256;let K2=XT,Z2;function oie(t=11){if(!Z2||K2+t>XT*2){Z2="",K2=0;for(let e=0;eY2.delete(r));return Y2.set(r,n),n}function cie(t,{delay:e=100,retryCount:r=2,shouldRetry:n=()=>!0}={}){return new Promise((i,s)=>{const o=async({count:a=0}={})=>{const c=async({error:u})=>{const l=typeof e=="function"?e({count:a,error:u}):e;l&&await RV(l),o({count:a+1})};try{const u=await t();i(u)}catch(u){if(a{var d;const{dedupe:i=!1,methods:s,retryDelay:o=150,retryCount:a=3,uid:c}={...e,...n},{method:u}=r;if((d=s==null?void 0:s.exclude)!=null&&d.includes(u))throw new Zh(new Error("method not supported"),{method:u});if(s!=null&&s.include&&!s.include.includes(u))throw new Zh(new Error("method not supported"),{method:u});const l=i?Ib(`${c}.${cd(r)}`):void 0;return aie(()=>cie(async()=>{try{return await t(r)}catch(h){const f=h;switch(f.code){case Rb.code:throw new Rb(f);case kb.code:throw new kb(f);case Nb.code:throw new Nb(f,{method:r.method});case $b.code:throw new $b(f);case rm.code:throw new rm(f);case jb.code:throw new jb(f);case Bb.code:throw new Bb(f);case Db.code:throw new Db(f);case nm.code:throw new nm(f);case Zh.code:throw new Zh(f,{method:r.method});case im.code:throw new im(f);case Mb.code:throw new Mb(f);case xf.code:throw new xf(f);case Lb.code:throw new Lb(f);case Ub.code:throw new Ub(f);case Fb.code:throw new Fb(f);case Hb.code:throw new Hb(f);case qb.code:throw new qb(f);case zb.code:throw new zb(f);case Wb.code:throw new Wb(f);case Vb.code:throw new Vb(f);case Gb.code:throw new Gb(f);case Kb.code:throw new Kb(f);case Zb.code:throw new Zb(f);case Yb.code:throw new Yb(f);case 5e3:throw new xf(f);default:throw h instanceof _r?h:new Vre(f)}}},{delay:({count:h,error:f})=>{var g;if(f&&f instanceof ub){const p=(g=f==null?void 0:f.headers)==null?void 0:g.get("Retry-After");if(p!=null&&p.match(/\d/))return Number.parseInt(p)*1e3}return~~(1<lie(h)}),{enabled:i,id:l})}}function lie(t){return"code"in t&&typeof t.code=="number"?t.code===-1||t.code===im.code||t.code===rm.code:t instanceof ub&&t.status?t.status===403||t.status===408||t.status===413||t.status===429||t.status===500||t.status===502||t.status===503||t.status===504:!0}function kV({key:t,methods:e,name:r,request:n,retryCount:i=3,retryDelay:s=150,timeout:o,type:a},c){const u=oie();return{config:{key:t,methods:e,name:r,request:n,retryCount:i,retryDelay:s,timeout:o,type:a},request:uie(n,{methods:e,retryCount:i,retryDelay:s,uid:u}),value:c}}function rk(t,e={}){const{key:r="fallback",name:n="Fallback",rank:i=!1,shouldThrow:s=die,retryCount:o,retryDelay:a}=e;return({chain:c,pollingInterval:u=4e3,timeout:l,...d})=>{let h=t,f=()=>{};const g=kV({key:r,name:n,async request({method:p,params:m}){let b;const v=async(E=0)=>{const w=h[E]({...d,chain:c,retryCount:0,timeout:l});try{const C=await w.request({method:p,params:m});return f({method:p,params:m,response:C,transport:w,status:"success"}),C}catch(C){if(f({error:C,method:p,params:m,transport:w,status:"error"}),s(C)||E===h.length-1||(b??(b=h.slice(E+1).some(y=>{const{include:_,exclude:x}=y({chain:c}).config.methods||{};return _?_.includes(p):x?!x.includes(p):!0})),!b))throw C;return v(E+1)}};return v()},retryCount:o,retryDelay:a,type:"fallback"},{onResponse:p=>f=p,transports:h.map(p=>p({chain:c,retryCount:0}))});if(i){const p=typeof i=="object"?i:{};hie({chain:c,interval:p.interval??u,onTransports:m=>h=m,ping:p.ping,sampleCount:p.sampleCount,timeout:p.timeout,transports:h,weights:p.weights})}return g}}function die(t){return!!("code"in t&&typeof t.code=="number"&&(t.code===nm.code||t.code===xf.code||x9.nodeMessage.test(t.message)||t.code===5e3))}function hie({chain:t,interval:e=4e3,onTransports:r,ping:n,sampleCount:i=10,timeout:s=1e3,transports:o,weights:a={}}){const{stability:c=.7,latency:u=.3}=a,l=[],d=async()=>{const h=await Promise.all(o.map(async p=>{const m=p({chain:t,retryCount:0,timeout:s}),b=Date.now();let v,E;try{await(n?n({transport:m}):m.request({method:"net_listening"})),E=1}catch{E=0}finally{v=Date.now()}return{latency:v-b,success:E}}));l.push(h),l.length>i&&l.shift();const f=Math.max(...l.map(p=>Math.max(...p.map(({latency:m})=>m)))),g=o.map((p,m)=>{const b=l.map(y=>y[m].latency),E=1-b.reduce((y,_)=>y+_,0)/b.length/f,w=l.map(y=>y[m].success),C=w.reduce((y,_)=>y+_,0)/w.length;return C===0?[0,m]:[u*E+c*C,m]}).sort((p,m)=>m[0]-p[0]);r(g.map(([,p])=>o[p])),await RV(e),d()};d()}class fie extends _r{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}function pie(t,{errorInstance:e=new Error("timed out"),timeout:r,signal:n}){return new Promise((i,s)=>{(async()=>{let o;try{const a=new AbortController;r>0&&(o=setTimeout(()=>{n&&a.abort()},r)),i(await t({signal:(a==null?void 0:a.signal)||null}))}catch(a){(a==null?void 0:a.name)==="AbortError"&&s(e),s(a)}finally{clearTimeout(o)}})()})}function gie(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const nk=gie();function mie(t,e={}){return{async request(r){var d;const{body:n,onRequest:i=e.onRequest,onResponse:s=e.onResponse,timeout:o=e.timeout??1e4}=r,a={...e.fetchOptions??{},...r.fetchOptions??{}},{headers:c,method:u,signal:l}=a;try{const h=await pie(async({signal:g})=>{const p={...a,body:Array.isArray(n)?cd(n.map(E=>({jsonrpc:"2.0",id:E.id??nk.take(),...E}))):cd({jsonrpc:"2.0",id:n.id??nk.take(),...n}),headers:{"Content-Type":"application/json",...c},method:u||"POST",signal:l||(o>0?g:null)},m=new Request(t,p),b=await(i==null?void 0:i(m,p))??{...p,url:t};return await fetch(b.url??t,b)},{errorInstance:new LR({body:n,url:t}),timeout:o,signal:!0});s&&await s(h);let f;if((d=h.headers.get("Content-Type"))!=null&&d.startsWith("application/json"))f=await h.json();else{f=await h.text();try{f=JSON.parse(f||"{}")}catch(g){if(h.ok)throw g;f={error:f}}}if(!h.ok)throw new ub({body:n,details:cd(f.error)||h.statusText,headers:h.headers,status:h.status,url:t});return f}catch(h){throw h instanceof ub||h instanceof LR?h:new ub({body:n,cause:h,url:t})}}}}function J2(t,e={}){const{batch:r,fetchOptions:n,key:i="http",methods:s,name:o="HTTP JSON-RPC",onFetchRequest:a,onFetchResponse:c,retryDelay:u,raw:l}=e;return({chain:d,retryCount:h,timeout:f})=>{const{batchSize:g=1e3,wait:p=0}=typeof r=="object"?r:{},m=e.retryCount??h,b=f??e.timeout??1e4,v=t||(d==null?void 0:d.rpcUrls.default.http[0]);if(!v)throw new fie;const E=mie(v,{fetchOptions:n,onRequest:a,onResponse:c,timeout:b});return kV({key:i,methods:s,name:o,async request({method:w,params:C}){const y={method:w,params:C},{schedule:_}=sie({id:v,wait:p,shouldSplitBatch(O){return O.length>g},fn:O=>E.request({body:O}),sort:(O,k)=>O.id-k.id}),x=async O=>r?_(O):[await E.request({body:O})],[{error:A,result:T}]=await x(y);if(l)return{error:A,result:T};if(A)throw new EV({body:y,error:A,url:v});return T},retryCount:m,retryDelay:u,timeout:b,type:"http"},{fetchOptions:n,url:v})}}class wie extends _r{constructor({domain:e}){super(`Invalid domain "${cd(e)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class bie extends _r{constructor({primaryType:e,types:r}){super(`Invalid primary type \`${e}\` must be one of \`${JSON.stringify(Object.keys(r))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class yie extends _r{constructor({type:e}){super(`Struct type "${e}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function vie(t){const{domain:e={},message:r,primaryType:n}=t,i={EIP712Domain:xie({domain:e}),...t.types};Aie({domain:e,message:r,primaryType:n,types:i});const s=["0x1901"];return e&&s.push(_ie({domain:e,types:i})),n!=="EIP712Domain"&&s.push(NV({data:r,primaryType:n,types:i})),qa(md(s))}function _ie({domain:t,types:e}){return NV({data:t,primaryType:"EIP712Domain",types:e})}function NV({data:t,primaryType:e,types:r}){const n=$V({data:t,primaryType:e,types:r});return qa(n)}function $V({data:t,primaryType:e,types:r}){const n=[{type:"bytes32"}],i=[Eie({primaryType:e,types:r})];for(const s of r[e]){const[o,a]=BV({types:r,name:s.name,type:s.type,value:t[s.name]});n.push(o),i.push(a)}return T9(n,i)}function Eie({primaryType:t,types:e}){const r=Tb(Cie({primaryType:t,types:e}));return qa(r)}function Cie({primaryType:t,types:e}){let r="";const n=jV({primaryType:t,types:e});n.delete(t);const i=[t,...Array.from(n).sort()];for(const s of i)r+=`${s}(${e[s].map(({name:o,type:a})=>`${a} ${o}`).join(",")})`;return r}function jV({primaryType:t,types:e},r=new Set){const n=t.match(/^\w*/u),i=n==null?void 0:n[0];if(r.has(i)||e[i]===void 0)return r;r.add(i);for(const s of e[i])jV({primaryType:s.type,types:e},r);return r}function BV({types:t,name:e,type:r,value:n}){if(t[r]!==void 0)return[{type:"bytes32"},qa($V({data:n,primaryType:r,types:t}))];if(r==="bytes")return n=`0x${(n.length%2?"0":"")+n.slice(2)}`,[{type:"bytes32"},qa(n)];if(r==="string")return[{type:"bytes32"},qa(Tb(n))];if(r.lastIndexOf("]")===r.length-1){const i=r.slice(0,r.lastIndexOf("[")),s=n.map(o=>BV({name:e,type:i,types:t,value:o}));return[{type:"bytes32"},qa(T9(s.map(([o])=>o),s.map(([,o])=>o)))]}return[{type:r},n]}function Aie(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(o,a)=>{for(const c of o){const{name:u,type:l}=c,d=a[u],h=l.match(vV);if(h&&(typeof d=="number"||typeof d=="bigint")){const[p,m,b]=h;$d(d,{signed:m==="int",size:Number.parseInt(b)/8})}if(l==="address"&&typeof d=="string"&&!Ob(d))throw new cV({address:d});const f=l.match(Nre);if(f){const[p,m]=f;if(m&&Ci(d)!==Number.parseInt(m))throw new Cre({expectedSize:Number.parseInt(m),givenSize:Ci(d)})}const g=i[l];g&&(Sie(l),s(g,d))}};if(i.EIP712Domain&&e){if(typeof e!="object")throw new wie({domain:e});s(i.EIP712Domain,e)}if(n!=="EIP712Domain")if(i[n])s(i[n],r);else throw new bie({primaryType:n,types:i})}function xie({domain:t}){return[typeof(t==null?void 0:t.name)=="string"&&{name:"name",type:"string"},(t==null?void 0:t.version)&&{name:"version",type:"string"},(typeof(t==null?void 0:t.chainId)=="number"||typeof(t==null?void 0:t.chainId)=="bigint")&&{name:"chainId",type:"uint256"},(t==null?void 0:t.verifyingContract)&&{name:"verifyingContract",type:"address"},(t==null?void 0:t.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function Sie(t){if(t==="address"||t==="bool"||t==="string"||t.startsWith("bytes")||t.startsWith("uint")||t.startsWith("int"))throw new yie({type:t})}const Tie=`Ethereum Signed Message: `;function Iie(t){const e=typeof t=="string"?Ib(t):typeof t.raw=="string"?t.raw:C9(t.raw),r=Ib(`${Tie}${Ci(e)}`);return md([r,e])}function Pie(t,e){return qa(Iie(t),e)}const a8={createBalance(t,e){const r={name:t.metadata.name||"",symbol:t.metadata.symbol||"",decimals:t.metadata.decimals||0,value:t.metadata.value||0,price:t.metadata.price||0,iconUrl:t.metadata.iconUrl||""};return{name:r.name,symbol:r.symbol,chainId:e,address:t.address==="native"?void 0:this.convertAddressToCAIP10Address(t.address,e),value:r.value,price:r.price,quantity:{decimals:r.decimals.toString(),numeric:this.convertHexToBalance({hex:t.balance,decimals:r.decimals})},iconUrl:r.iconUrl}},convertHexToBalance({hex:t,decimals:e}){return Nte(BigInt(t),e)},convertAddressToCAIP10Address(t,e){return`${e}:${t}`},createCAIP2ChainId(t,e){return`${e}:${parseInt(t,16)}`},getChainIdHexFromCAIP2ChainId(t){const e=t.split(":");if(e.length<2||!e[1])return"0x0";const r=e[1],n=parseInt(r,10);return isNaN(n)?"0x0":`0x${n.toString(16)}`},isWalletGetAssetsResponse(t){return typeof t!="object"||t===null?!1:Object.values(t).every(e=>Array.isArray(e)&&e.every(r=>this.isValidAsset(r)))},isValidAsset(t){return typeof t=="object"&&t!==null&&typeof t.address=="string"&&typeof t.balance=="string"&&(t.type==="ERC20"||t.type==="NATIVE")&&typeof t.metadata=="object"&&t.metadata!==null&&typeof t.metadata.name=="string"&&typeof t.metadata.symbol=="string"&&typeof t.metadata.decimals=="number"&&typeof t.metadata.price=="number"&&typeof t.metadata.iconUrl=="string"}},yC={async getMyTokensWithBalance(t){const e=re.state.address,r=F.state.activeCaipNetwork;if(!e||!r)return[];if(r.chainNamespace==="eip155"){const i=await this.getEIP155Balances(e,r);if(i)return this.filterLowQualityTokens(i)}const n=await Xe.getBalance(e,r.caipNetworkId,t);return this.filterLowQualityTokens(n.balances)},async getEIP155Balances(t,e){var r,n;try{const i=a8.getChainIdHexFromCAIP2ChainId(e.caipNetworkId),s=await xe.getCapabilities(t);if(!((n=(r=s==null?void 0:s[i])==null?void 0:r.assetDiscovery)!=null&&n.supported))return null;const o=await xe.walletGetAssets({account:t,chainFilter:[i]});return a8.isWalletGetAssetsResponse(o)?(o[i]||[]).map(c=>a8.createBalance(c,e.caipNetworkId)):null}catch{return null}},filterLowQualityTokens(t){return t.filter(e=>e.quantity.decimals!=="0")},mapBalancesToSwapTokens(t){return(t==null?void 0:t.map(e=>({...e,address:e!=null&&e.address?e.address:F.getActiveNetworkTokenAddress(),decimals:parseInt(e.quantity.decimals,10),logoUri:e.iconUrl,eip2612:!1})))||[]}},Yt=rr({tokenBalances:[],loading:!1}),Oie={state:Yt,subscribe(t){return ln(Yt,()=>t(Yt))},subscribeKey(t,e){return dn(Yt,t,e)},setToken(t){t&&(Yt.token=Nf(t))},setTokenAmount(t){Yt.sendTokenAmount=t},setReceiverAddress(t){Yt.receiverAddress=t},setReceiverProfileImageUrl(t){Yt.receiverProfileImageUrl=t},setReceiverProfileName(t){Yt.receiverProfileName=t},setNetworkBalanceInUsd(t){Yt.networkBalanceInUSD=t},setLoading(t){Yt.loading=t},async sendToken(){var t;try{switch(Qe.setLoading(!0),(t=F.state.activeCaipNetwork)==null?void 0:t.chainNamespace){case"eip155":await Qe.sendEvmToken();return;case"solana":await Qe.sendSolanaToken();return;default:throw new Error("Unsupported chain")}}finally{Qe.setLoading(!1)}},async sendEvmToken(){var r,n,i,s;const t=F.state.activeChain,e=(r=re.state.preferredAccountTypes)==null?void 0:r[t];if(!Qe.state.sendTokenAmount||!Qe.state.receiverAddress)throw new Error("An amount and receiver address are required");if(!Qe.state.token)throw new Error("A token is required");(n=Qe.state.token)!=null&&n.address?(Re.sendEvent({type:"track",event:"SEND_INITIATED",properties:{isSmartAccount:e===bt.ACCOUNT_TYPES.SMART_ACCOUNT,token:Qe.state.token.address,amount:Qe.state.sendTokenAmount,network:((i=F.state.activeCaipNetwork)==null?void 0:i.caipNetworkId)||""}}),await Qe.sendERC20Token({receiverAddress:Qe.state.receiverAddress,tokenAddress:Qe.state.token.address,sendTokenAmount:Qe.state.sendTokenAmount,decimals:Qe.state.token.quantity.decimals})):(Re.sendEvent({type:"track",event:"SEND_INITIATED",properties:{isSmartAccount:e===bt.ACCOUNT_TYPES.SMART_ACCOUNT,token:Qe.state.token.symbol||"",amount:Qe.state.sendTokenAmount,network:((s=F.state.activeCaipNetwork)==null?void 0:s.caipNetworkId)||""}}),await Qe.sendNativeToken({receiverAddress:Qe.state.receiverAddress,sendTokenAmount:Qe.state.sendTokenAmount,decimals:Qe.state.token.quantity.decimals}))},async fetchTokenBalance(t){var s,o;Yt.loading=!0;const e=(s=F.state.activeCaipNetwork)==null?void 0:s.caipNetworkId,r=(o=F.state.activeCaipNetwork)==null?void 0:o.chainNamespace,n=F.state.activeCaipAddress,i=n?ue.getPlainAddress(n):void 0;if(Yt.lastRetry&&!ue.isAllowedRetry(Yt.lastRetry,30*ct.ONE_SEC_MS))return Yt.loading=!1,[];try{if(i&&e&&r){const a=await yC.getMyTokensWithBalance();return Yt.tokenBalances=a,Yt.lastRetry=void 0,a}}catch(a){Yt.lastRetry=Date.now(),t==null||t(a),Fe.showError("Token Balance Unavailable")}finally{Yt.loading=!1}return[]},fetchNetworkBalance(){if(Yt.tokenBalances.length===0)return;const t=yC.mapBalancesToSwapTokens(Yt.tokenBalances);if(!t)return;const e=t.find(r=>r.address===F.getActiveNetworkTokenAddress());e&&(Yt.networkBalanceInUSD=e?Dt.multiply(e.quantity.numeric,e.price).toString():"0")},async sendNativeToken(t){var s,o,a,c;X.pushTransactionStack({});const e=t.receiverAddress,r=re.state.address,n=xe.parseUnits(t.sendTokenAmount.toString(),Number(t.decimals));await xe.sendTransaction({chainNamespace:"eip155",to:e,address:r,data:"0x",value:n??BigInt(0)}),Re.sendEvent({type:"track",event:"SEND_SUCCESS",properties:{isSmartAccount:((s=re.state.preferredAccountTypes)==null?void 0:s.eip155)===bt.ACCOUNT_TYPES.SMART_ACCOUNT,token:((o=Qe.state.token)==null?void 0:o.symbol)||"",amount:t.sendTokenAmount,network:((a=F.state.activeCaipNetwork)==null?void 0:a.caipNetworkId)||""}}),(c=xe._getClient())==null||c.updateBalance("eip155"),Qe.resetSend()},async sendERC20Token(t){X.pushTransactionStack({onSuccess(){X.replace("Account")}});const e=xe.parseUnits(t.sendTokenAmount.toString(),Number(t.decimals));if(re.state.address&&t.sendTokenAmount&&t.receiverAddress&&t.tokenAddress){const r=ue.getPlainAddress(t.tokenAddress);await xe.writeContract({fromAddress:re.state.address,tokenAddress:r,args:[t.receiverAddress,e??BigInt(0)],method:"transfer",abi:TV.getERC20Abi(r),chainNamespace:"eip155"}),Qe.resetSend()}},async sendSolanaToken(){var t;if(!Qe.state.sendTokenAmount||!Qe.state.receiverAddress)throw new Error("An amount and receiver address are required");X.pushTransactionStack({onSuccess(){X.replace("Account")}}),await xe.sendTransaction({chainNamespace:"solana",to:Qe.state.receiverAddress,value:Qe.state.sendTokenAmount}),(t=xe._getClient())==null||t.updateBalance("solana"),Qe.resetSend()},resetSend(){Yt.token=void 0,Yt.sendTokenAmount=void 0,Yt.receiverAddress=void 0,Yt.receiverProfileImageUrl=void 0,Yt.receiverProfileName=void 0,Yt.loading=!1,Yt.tokenBalances=[]}},Qe=Pi(Oie),c8={currentTab:0,tokenBalance:[],smartAccountDeployed:!1,addressLabels:new Map,allAccounts:[],user:void 0},Q2={caipNetwork:void 0,supportsAllNetworks:!0,smartAccountEnabledNetworks:[]},Ue=rr({chains:Xre(),activeCaipAddress:void 0,activeChain:void 0,activeCaipNetwork:void 0,noAdapters:!1,universalAdapter:{networkControllerClient:void 0,connectionControllerClient:void 0},isSwitchingNamespace:!1}),Rie={state:Ue,subscribe(t){return ln(Ue,()=>{t(Ue)})},subscribeKey(t,e){return dn(Ue,t,e)},subscribeChainProp(t,e,r){let n;return ln(Ue.chains,()=>{var s;const i=r||Ue.activeChain;if(i){const o=(s=Ue.chains.get(i))==null?void 0:s[t];n!==o&&(n=o,e(o))}})},initialize(t,e,r){const{chainId:n,namespace:i}=Le.getActiveNetworkProps(),s=e==null?void 0:e.find(l=>l.id.toString()===(n==null?void 0:n.toString())),a=t.find(l=>(l==null?void 0:l.namespace)===i)||(t==null?void 0:t[0]),c=t.map(l=>l.namespace).filter(l=>l!==void 0),u=oe.state.enableEmbedded?new Set([...c]):new Set([...(e==null?void 0:e.map(l=>l.chainNamespace))??[]]);((t==null?void 0:t.length)===0||!a)&&(Ue.noAdapters=!0),Ue.noAdapters||(Ue.activeChain=a==null?void 0:a.namespace,Ue.activeCaipNetwork=s,F.setChainNetworkData(a==null?void 0:a.namespace,{caipNetwork:s}),Ue.activeChain&&Ga.set({activeChain:a==null?void 0:a.namespace})),u.forEach(l=>{const d=e==null?void 0:e.filter(h=>h.chainNamespace===l);F.state.chains.set(l,{namespace:l,networkState:rr({...Q2,caipNetwork:d==null?void 0:d[0]}),accountState:rr(c8),caipNetworks:d??[],...r}),F.setRequestedCaipNetworks(d??[],l)})},removeAdapter(t){var e,r;if(Ue.activeChain===t){const n=Array.from(Ue.chains.entries()).find(([i])=>i!==t);if(n){const i=(r=(e=n[1])==null?void 0:e.caipNetworks)==null?void 0:r[0];i&&F.setActiveCaipNetwork(i)}}Ue.chains.delete(t)},addAdapter(t,{networkControllerClient:e,connectionControllerClient:r},n){Ue.chains.set(t.namespace,{namespace:t.namespace,networkState:{...Q2,caipNetwork:n[0]},accountState:c8,caipNetworks:n,connectionControllerClient:r,networkControllerClient:e}),F.setRequestedCaipNetworks((n==null?void 0:n.filter(i=>i.chainNamespace===t.namespace))??[],t.namespace)},addNetwork(t){var r;const e=Ue.chains.get(t.chainNamespace);if(e){const n=[...e.caipNetworks||[]];(r=e.caipNetworks)!=null&&r.find(i=>i.id===t.id)||n.push(t),Ue.chains.set(t.chainNamespace,{...e,caipNetworks:n}),F.setRequestedCaipNetworks(n,t.chainNamespace),ge.filterByNamespace(t.chainNamespace,!0)}},removeNetwork(t,e){var n,i,s;const r=Ue.chains.get(t);if(r){const o=((n=Ue.activeCaipNetwork)==null?void 0:n.id)===e,a=[...((i=r.caipNetworks)==null?void 0:i.filter(c=>c.id!==e))||[]];o&&((s=r==null?void 0:r.caipNetworks)!=null&&s[0])&&F.setActiveCaipNetwork(r.caipNetworks[0]),Ue.chains.set(t,{...r,caipNetworks:a}),F.setRequestedCaipNetworks(a||[],t),a.length===0&&ge.filterByNamespace(t,!1)}},setAdapterNetworkState(t,e){const r=Ue.chains.get(t);r&&(r.networkState={...r.networkState||Q2,...e},Ue.chains.set(t,r))},setChainAccountData(t,e,r=!0){if(!t)throw new Error("Chain is required to update chain account data");const n=Ue.chains.get(t);if(n){const i={...n.accountState||c8,...e};Ue.chains.set(t,{...n,accountState:i}),(Ue.chains.size===1||Ue.activeChain===t)&&(e.caipAddress&&(Ue.activeCaipAddress=e.caipAddress),re.replaceState(i))}},setChainNetworkData(t,e){if(!t)return;const r=Ue.chains.get(t);if(r){const n={...r.networkState||Q2,...e};Ue.chains.set(t,{...r,networkState:n})}},setAccountProp(t,e,r,n=!0){F.setChainAccountData(r,{[t]:e},n),t==="status"&&e==="disconnected"&&r&&ge.removeConnectorId(r)},setActiveNamespace(t){var n,i;Ue.activeChain=t;const e=t?Ue.chains.get(t):void 0,r=(n=e==null?void 0:e.networkState)==null?void 0:n.caipNetwork;r!=null&&r.id&&t&&(Ue.activeCaipAddress=(i=e==null?void 0:e.accountState)==null?void 0:i.caipAddress,Ue.activeCaipNetwork=r,F.setChainNetworkData(t,{caipNetwork:r}),Le.setActiveCaipNetworkId(r==null?void 0:r.caipNetworkId),Ga.set({activeChain:t,selectedNetworkId:r==null?void 0:r.caipNetworkId}))},setActiveCaipNetwork(t){var n,i,s;if(!t)return;Ue.activeChain!==t.chainNamespace&&F.setIsSwitchingNamespace(!0);const e=Ue.chains.get(t.chainNamespace);Ue.activeChain=t.chainNamespace,Ue.activeCaipNetwork=t,F.setChainNetworkData(t.chainNamespace,{caipNetwork:t}),(n=e==null?void 0:e.accountState)!=null&&n.address?Ue.activeCaipAddress=`${t.chainNamespace}:${t.id}:${(i=e==null?void 0:e.accountState)==null?void 0:i.address}`:Ue.activeCaipAddress=void 0,F.setAccountProp("caipAddress",Ue.activeCaipAddress,t.chainNamespace),e&&re.replaceState(e.accountState),Qe.resetSend(),Ga.set({activeChain:Ue.activeChain,selectedNetworkId:(s=Ue.activeCaipNetwork)==null?void 0:s.caipNetworkId}),Le.setActiveCaipNetworkId(t.caipNetworkId),!F.checkIfSupportedNetwork(t.chainNamespace)&&oe.state.enableNetworkSwitch&&!oe.state.allowUnsupportedChain&&!xe.state.wcBasic&&F.showUnsupportedChainUI()},addCaipNetwork(t){var r;if(!t)return;const e=Ue.chains.get(t.chainNamespace);e&&((r=e==null?void 0:e.caipNetworks)==null||r.push(t))},async switchActiveNamespace(t){var i;if(!t)return;const e=t!==F.state.activeChain,r=(i=F.getNetworkData(t))==null?void 0:i.caipNetwork,n=F.getCaipNetworkByNamespace(t,r==null?void 0:r.id);e&&n&&await F.switchActiveNetwork(n)},async switchActiveNetwork(t){var i;const e=F.state.chains.get(F.state.activeChain),r=!((i=e==null?void 0:e.caipNetworks)!=null&&i.some(s=>{var o;return s.id===((o=Ue.activeCaipNetwork)==null?void 0:o.id)})),n=F.getNetworkControllerClient(t.chainNamespace);if(n){try{await n.switchCaipNetwork(t),r&&We.close()}catch{X.goBack()}Re.sendEvent({type:"track",event:"SWITCH_NETWORK",properties:{network:t.caipNetworkId}})}},getNetworkControllerClient(t){const e=t||Ue.activeChain,r=Ue.chains.get(e);if(!r)throw new Error("Chain adapter not found");if(!r.networkControllerClient)throw new Error("NetworkController client not set");return r.networkControllerClient},getConnectionControllerClient(t){const e=t||Ue.activeChain;if(!e)throw new Error("Chain is required to get connection controller client");const r=Ue.chains.get(e);if(!(r!=null&&r.connectionControllerClient))throw new Error("ConnectionController client not set");return r.connectionControllerClient},getAccountProp(t,e){var i;let r=Ue.activeChain;if(e&&(r=e),!r)return;const n=(i=Ue.chains.get(r))==null?void 0:i.accountState;if(n)return n[t]},getNetworkProp(t,e){var n;const r=(n=Ue.chains.get(e))==null?void 0:n.networkState;if(r)return r[t]},getRequestedCaipNetworks(t){const e=Ue.chains.get(t),{approvedCaipNetworkIds:r=[],requestedCaipNetworks:n=[]}=(e==null?void 0:e.networkState)||{};return ue.sortRequestedNetworks(r,n)},getAllRequestedCaipNetworks(){const t=[];return Ue.chains.forEach(e=>{const r=F.getRequestedCaipNetworks(e.namespace);t.push(...r)}),t},setRequestedCaipNetworks(t,e){F.setAdapterNetworkState(e,{requestedCaipNetworks:t});const n=F.getAllRequestedCaipNetworks().map(s=>s.chainNamespace),i=Array.from(new Set(n));ge.filterByNamespaces(i)},getAllApprovedCaipNetworkIds(){const t=[];return Ue.chains.forEach(e=>{const r=F.getApprovedCaipNetworkIds(e.namespace);t.push(...r)}),t},getActiveCaipNetwork(){return Ue.activeCaipNetwork},getActiveCaipAddress(){return Ue.activeCaipAddress},getApprovedCaipNetworkIds(t){var n;const e=Ue.chains.get(t);return((n=e==null?void 0:e.networkState)==null?void 0:n.approvedCaipNetworkIds)||[]},async setApprovedCaipNetworksData(t){const e=F.getNetworkControllerClient(),r=await(e==null?void 0:e.getApprovedCaipNetworksData());F.setAdapterNetworkState(t,{approvedCaipNetworkIds:r==null?void 0:r.approvedCaipNetworkIds,supportsAllNetworks:r==null?void 0:r.supportsAllNetworks})},checkIfSupportedNetwork(t,e){const r=e||Ue.activeCaipNetwork,n=F.getRequestedCaipNetworks(t);return n.length?n==null?void 0:n.some(i=>i.id===(r==null?void 0:r.id)):!0},checkIfSupportedChainId(t){if(!Ue.activeChain)return!0;const e=F.getRequestedCaipNetworks(Ue.activeChain);return e==null?void 0:e.some(r=>r.id===t)},setSmartAccountEnabledNetworks(t,e){F.setAdapterNetworkState(e,{smartAccountEnabledNetworks:t})},checkIfSmartAccountEnabled(){var n;const t=AV.caipNetworkIdToNumber((n=Ue.activeCaipNetwork)==null?void 0:n.caipNetworkId),e=Ue.activeChain;if(!e||!t)return!1;const r=F.getNetworkProp("smartAccountEnabledNetworks",e);return!!(r!=null&&r.includes(Number(t)))},getActiveNetworkTokenAddress(){var n,i;const t=((n=Ue.activeCaipNetwork)==null?void 0:n.chainNamespace)||"eip155",e=((i=Ue.activeCaipNetwork)==null?void 0:i.id)||1,r=ct.NATIVE_TOKEN_ADDRESS[t];return`${t}:${e}:${r}`},showUnsupportedChainUI(){We.open({view:"UnsupportedChain"})},checkIfNamesSupported(){const t=Ue.activeCaipNetwork;return!!(t!=null&&t.chainNamespace&&ct.NAMES_SUPPORTED_CHAIN_NAMESPACES.includes(t.chainNamespace))},resetNetwork(t){F.setAdapterNetworkState(t,{approvedCaipNetworkIds:void 0,supportsAllNetworks:!0,smartAccountEnabledNetworks:[]})},resetAccount(t){const e=t;if(!e)throw new Error("Chain is required to set account prop");Ue.activeCaipAddress=void 0,F.setChainAccountData(e,{smartAccountDeployed:!1,currentTab:0,caipAddress:void 0,address:void 0,balance:void 0,balanceSymbol:void 0,profileName:void 0,profileImage:void 0,addressExplorerUrl:void 0,tokenBalance:[],connectedWalletInfo:void 0,preferredAccountTypes:void 0,socialProvider:void 0,socialWindow:void 0,farcasterUrl:void 0,allAccounts:[],user:void 0,status:"disconnected"}),ge.removeConnectorId(e)},setIsSwitchingNamespace(t){Ue.isSwitchingNamespace=t},getFirstCaipNetworkSupportsAuthConnector(){var r,n;const t=[];let e;if(Ue.chains.forEach(i=>{_e.AUTH_CONNECTOR_SUPPORTED_CHAINS.find(s=>s===i.namespace)&&i.namespace&&t.push(i.namespace)}),t.length>0){const i=t[0];return e=i?(n=(r=Ue.chains.get(i))==null?void 0:r.caipNetworks)==null?void 0:n[0]:void 0,e}},getAccountData(t){var e;return t?(e=F.state.chains.get(t))==null?void 0:e.accountState:re.state},getNetworkData(t){var r;const e=t||Ue.activeChain;if(e)return(r=F.state.chains.get(e))==null?void 0:r.networkState},getCaipNetworkByNamespace(t,e){var i,s,o;if(!t)return;const r=F.state.chains.get(t),n=(i=r==null?void 0:r.caipNetworks)==null?void 0:i.find(a=>a.id===e);return n||((s=r==null?void 0:r.networkState)==null?void 0:s.caipNetwork)||((o=r==null?void 0:r.caipNetworks)==null?void 0:o[0])},getRequestedCaipNetworkIds(){const t=ge.state.filterByNamespace;return(t?[Ue.chains.get(t)]:Array.from(Ue.chains.values())).flatMap(r=>(r==null?void 0:r.caipNetworks)||[]).map(r=>r.caipNetworkId)},getCaipNetworks(t){return t?F.getRequestedCaipNetworks(t):F.getAllRequestedCaipNetworks()}},F=Pi(Rie),kie={purchaseCurrencies:[{id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"USD Coin",symbol:"USDC",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]},{id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"Ether",symbol:"ETH",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]}],paymentCurrencies:[{id:"USD",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]},{id:"EUR",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]}]},DV=ue.getBlockchainApiUrl(),$i=rr({clientId:null,api:new Av({baseUrl:DV,clientId:null}),supportedChains:{http:[],ws:[]}}),Xe={state:$i,async get(t){const{st:e,sv:r}=Xe.getSdkProperties(),n=oe.state.projectId,i={...t.params||{},st:e,sv:r,projectId:n};return $i.api.get({...t,params:i})},getSdkProperties(){const{sdkType:t,sdkVersion:e}=oe.state;return{st:t||"unknown",sv:e||"unknown"}},async isNetworkSupported(t){if(!t)return!1;try{$i.supportedChains.http.length||await Xe.getSupportedNetworks()}catch{return!1}return $i.supportedChains.http.includes(t)},async getSupportedNetworks(){try{const t=await Xe.get({path:"v1/supported-chains"});return $i.supportedChains=t,t}catch{return $i.supportedChains}},async fetchIdentity({address:t,caipNetworkId:e}){if(!await Xe.isNetworkSupported(e))return{avatar:"",name:""};const n=Le.getIdentityFromCacheForAddress(t);if(n)return n;const i=await Xe.get({path:`/v1/identity/${t}`,params:{sender:F.state.activeCaipAddress?ue.getPlainAddress(F.state.activeCaipAddress):void 0}});return Le.updateIdentityCache({address:t,identity:i,timestamp:Date.now()}),i},async fetchTransactions({account:t,cursor:e,onramp:r,signal:n,cache:i,chainId:s}){var a;return await Xe.isNetworkSupported((a=F.state.activeCaipNetwork)==null?void 0:a.caipNetworkId)?Xe.get({path:`/v1/account/${t}/history`,params:{cursor:e,onramp:r,chainId:s},signal:n,cache:i}):{data:[],next:void 0}},async fetchSwapQuote({amount:t,userAddress:e,from:r,to:n,gasPrice:i}){var o;return await Xe.isNetworkSupported((o=F.state.activeCaipNetwork)==null?void 0:o.caipNetworkId)?Xe.get({path:"/v1/convert/quotes",headers:{"Content-Type":"application/json"},params:{amount:t,userAddress:e,from:r,to:n,gasPrice:i}}):{quotes:[]}},async fetchSwapTokens({chainId:t}){var r;return await Xe.isNetworkSupported((r=F.state.activeCaipNetwork)==null?void 0:r.caipNetworkId)?Xe.get({path:"/v1/convert/tokens",params:{chainId:t}}):{tokens:[]}},async fetchTokenPrice({addresses:t}){var r;return await Xe.isNetworkSupported((r=F.state.activeCaipNetwork)==null?void 0:r.caipNetworkId)?$i.api.post({path:"/v1/fungible/price",body:{currency:"usd",addresses:t,projectId:oe.state.projectId},headers:{"Content-Type":"application/json"}}):{fungibles:[]}},async fetchSwapAllowance({tokenAddress:t,userAddress:e}){var n;return await Xe.isNetworkSupported((n=F.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)?Xe.get({path:"/v1/convert/allowance",params:{tokenAddress:t,userAddress:e},headers:{"Content-Type":"application/json"}}):{allowance:"0"}},async fetchGasPrice({chainId:t}){var i;const{st:e,sv:r}=Xe.getSdkProperties();if(!await Xe.isNetworkSupported((i=F.state.activeCaipNetwork)==null?void 0:i.caipNetworkId))throw new Error("Network not supported for Gas Price");return Xe.get({path:"/v1/convert/gas-price",headers:{"Content-Type":"application/json"},params:{chainId:t,st:e,sv:r}})},async generateSwapCalldata({amount:t,from:e,to:r,userAddress:n,disableEstimate:i}){var o;if(!await Xe.isNetworkSupported((o=F.state.activeCaipNetwork)==null?void 0:o.caipNetworkId))throw new Error("Network not supported for Swaps");return $i.api.post({path:"/v1/convert/build-transaction",headers:{"Content-Type":"application/json"},body:{amount:t,eip155:{slippage:ct.CONVERT_SLIPPAGE_TOLERANCE},projectId:oe.state.projectId,from:e,to:r,userAddress:n,disableEstimate:i}})},async generateApproveCalldata({from:t,to:e,userAddress:r}){var o;const{st:n,sv:i}=Xe.getSdkProperties();if(!await Xe.isNetworkSupported((o=F.state.activeCaipNetwork)==null?void 0:o.caipNetworkId))throw new Error("Network not supported for Swaps");return Xe.get({path:"/v1/convert/build-approve",headers:{"Content-Type":"application/json"},params:{userAddress:r,from:t,to:e,st:n,sv:i}})},async getBalance(t,e,r){var u;const{st:n,sv:i}=Xe.getSdkProperties();if(!await Xe.isNetworkSupported((u=F.state.activeCaipNetwork)==null?void 0:u.caipNetworkId))return Fe.showError("Token Balance Unavailable"),{balances:[]};const o=`${e}:${t}`,a=Le.getBalanceCacheForCaipAddress(o);if(a)return a;const c=await Xe.get({path:`/v1/account/${t}/balance`,params:{currency:"usd",chainId:e,forceUpdate:r,st:n,sv:i}});return Le.updateBalanceCache({caipAddress:o,balance:c,timestamp:Date.now()}),c},async lookupEnsName(t){var r;return await Xe.isNetworkSupported((r=F.state.activeCaipNetwork)==null?void 0:r.caipNetworkId)?Xe.get({path:`/v1/profile/account/${t}`,params:{apiVersion:"2"}}):{addresses:{},attributes:[]}},async reverseLookupEnsName({address:t}){var r;return await Xe.isNetworkSupported((r=F.state.activeCaipNetwork)==null?void 0:r.caipNetworkId)?Xe.get({path:`/v1/profile/reverse/${t}`,params:{sender:re.state.address,apiVersion:"2"}}):[]},async getEnsNameSuggestions(t){var r;return await Xe.isNetworkSupported((r=F.state.activeCaipNetwork)==null?void 0:r.caipNetworkId)?Xe.get({path:`/v1/profile/suggestions/${t}`,params:{zone:"reown.id"}}):{suggestions:[]}},async registerEnsName({coinType:t,address:e,message:r,signature:n}){var s;return await Xe.isNetworkSupported((s=F.state.activeCaipNetwork)==null?void 0:s.caipNetworkId)?$i.api.post({path:"/v1/profile/account",body:{coin_type:t,address:e,message:r,signature:n},headers:{"Content-Type":"application/json"}}):{success:!1}},async generateOnRampURL({destinationWallets:t,partnerUserId:e,defaultNetwork:r,purchaseAmount:n,paymentAmount:i}){var a;return await Xe.isNetworkSupported((a=F.state.activeCaipNetwork)==null?void 0:a.caipNetworkId)?(await $i.api.post({path:"/v1/generators/onrampurl",params:{projectId:oe.state.projectId},body:{destinationWallets:t,defaultNetwork:r,partnerUserId:e,defaultExperience:"buy",presetCryptoAmount:n,presetFiatAmount:i}})).url:""},async getOnrampOptions(){var e;if(!await Xe.isNetworkSupported((e=F.state.activeCaipNetwork)==null?void 0:e.caipNetworkId))return{paymentCurrencies:[],purchaseCurrencies:[]};try{return await Xe.get({path:"/v1/onramp/options"})}catch{return kie}},async getOnrampQuote({purchaseCurrency:t,paymentCurrency:e,amount:r,network:n}){var i;try{return await Xe.isNetworkSupported((i=F.state.activeCaipNetwork)==null?void 0:i.caipNetworkId)?await $i.api.post({path:"/v1/onramp/quote",params:{projectId:oe.state.projectId},body:{purchaseCurrency:t,paymentCurrency:e,amount:r,network:n}}):null}catch{return{coinbaseFee:{amount:r,currency:e.id},networkFee:{amount:r,currency:e.id},paymentSubtotal:{amount:r,currency:e.id},paymentTotal:{amount:r,currency:e.id},purchaseAmount:{amount:r,currency:e.id},quoteId:"mocked-quote-id"}}},async getSmartSessions(t){var r;return await Xe.isNetworkSupported((r=F.state.activeCaipNetwork)==null?void 0:r.caipNetworkId)?Xe.get({path:`/v1/sessions/${t}`}):[]},async revokeSmartSession(t,e,r){var i;return await Xe.isNetworkSupported((i=F.state.activeCaipNetwork)==null?void 0:i.caipNetworkId)?$i.api.post({path:`/v1/sessions/${t}/revoke`,params:{projectId:oe.state.projectId},body:{pci:e,signature:r}}):{success:!1}},setClientId(t){$i.clientId=t,$i.api=new Av({baseUrl:DV,clientId:t})}},Ls=rr({currentTab:0,tokenBalance:[],smartAccountDeployed:!1,addressLabels:new Map,allAccounts:[]}),Nie={state:Ls,replaceState(t){t&&Object.assign(Ls,Nf(t))},subscribe(t){return F.subscribeChainProp("accountState",e=>{if(e)return t(e)})},subscribeKey(t,e,r){let n;return F.subscribeChainProp("accountState",i=>{if(i){const s=i[t];n!==s&&(n=s,e(s))}},r)},setStatus(t,e){F.setAccountProp("status",t,e)},getCaipAddress(t){return F.getAccountProp("caipAddress",t)},setCaipAddress(t,e){const r=t?ue.getPlainAddress(t):void 0;e===F.state.activeChain&&(F.state.activeCaipAddress=t),F.setAccountProp("caipAddress",t,e),F.setAccountProp("address",r,e)},setBalance(t,e,r){F.setAccountProp("balance",t,r),F.setAccountProp("balanceSymbol",e,r)},setProfileName(t,e){F.setAccountProp("profileName",t,e)},setProfileImage(t,e){F.setAccountProp("profileImage",t,e)},setUser(t,e){F.setAccountProp("user",t,e)},setAddressExplorerUrl(t,e){F.setAccountProp("addressExplorerUrl",t,e)},setSmartAccountDeployed(t,e){F.setAccountProp("smartAccountDeployed",t,e)},setCurrentTab(t){F.setAccountProp("currentTab",t,F.state.activeChain)},setTokenBalance(t,e){t&&F.setAccountProp("tokenBalance",t,e)},setShouldUpdateToAddress(t,e){F.setAccountProp("shouldUpdateToAddress",t,e)},setAllAccounts(t,e){F.setAccountProp("allAccounts",t,e)},addAddressLabel(t,e,r){const n=F.getAccountProp("addressLabels",r)||new Map;n.set(t,e),F.setAccountProp("addressLabels",n,r)},removeAddressLabel(t,e){const r=F.getAccountProp("addressLabels",e)||new Map;r.delete(t),F.setAccountProp("addressLabels",r,e)},setConnectedWalletInfo(t,e){F.setAccountProp("connectedWalletInfo",t,e,!1)},setPreferredAccountType(t,e){F.setAccountProp("preferredAccountTypes",{...Ls.preferredAccountTypes,[e]:t},e)},setPreferredAccountTypes(t){Ls.preferredAccountTypes=t},setSocialProvider(t,e){t&&F.setAccountProp("socialProvider",t,e)},setSocialWindow(t,e){F.setAccountProp("socialWindow",t?Nf(t):void 0,e)},setFarcasterUrl(t,e){F.setAccountProp("farcasterUrl",t,e)},async fetchTokenBalance(t){var s,o;Ls.balanceLoading=!0;const e=(s=F.state.activeCaipNetwork)==null?void 0:s.caipNetworkId,r=(o=F.state.activeCaipNetwork)==null?void 0:o.chainNamespace,n=F.state.activeCaipAddress,i=n?ue.getPlainAddress(n):void 0;if(Ls.lastRetry&&!ue.isAllowedRetry(Ls.lastRetry,30*ct.ONE_SEC_MS))return Ls.balanceLoading=!1,[];try{if(i&&e&&r){const c=(await Xe.getBalance(i,e)).balances.filter(u=>u.quantity.decimals!=="0");return re.setTokenBalance(c,r),Ls.lastRetry=void 0,Ls.balanceLoading=!1,c}}catch(a){Ls.lastRetry=Date.now(),t==null||t(a),Fe.showError("Token Balance Unavailable")}finally{Ls.balanceLoading=!1}return[]},resetAccount(t){F.resetAccount(t)}},re=Pi(Nie),MV={onSwitchNetwork({network:t,ignoreSwitchConfirmation:e=!1}){const r=F.state.activeCaipNetwork,n=X.state.data;if(t.id===(r==null?void 0:r.id))return;const s=re.getCaipAddress(F.state.activeChain),o=t.chainNamespace!==F.state.activeChain,a=re.getCaipAddress(t.chainNamespace),u=ge.getConnectorId(F.state.activeChain)===_e.CONNECTOR_ID.AUTH,l=_e.AUTH_CONNECTOR_SUPPORTED_CHAINS.find(d=>d===t.chainNamespace);e||u&&l?X.push("SwitchNetwork",{...n,network:t}):s&&o&&!a?X.push("SwitchActiveChain",{switchToChain:t.chainNamespace,navigateTo:"Connect",navigateWithReplace:!0,network:t}):X.push("SwitchNetwork",{...n,network:t})}},ji=rr({loading:!1,loadingNamespaceMap:new Map,open:!1,shake:!1,namespace:void 0}),$ie={state:ji,subscribe(t){return ln(ji,()=>t(ji))},subscribeKey(t,e){return dn(ji,t,e)},async open(t){var o,a;const e=re.state.status==="connected",r=t==null?void 0:t.namespace,n=F.state.activeChain,i=r&&r!==n,s=(o=F.getAccountData(t==null?void 0:t.namespace))==null?void 0:o.caipAddress;if(xe.state.wcBasic?Ne.prefetch({fetchNetworkImages:!1,fetchConnectorImages:!1}):await Ne.prefetch({fetchConnectorImages:!e,fetchFeaturedWallets:!e,fetchRecommendedWallets:!e}),ge.setFilterByNamespace(t==null?void 0:t.namespace),We.setLoading(!0,r),r&&i){const c=((a=F.getNetworkData(r))==null?void 0:a.caipNetwork)||F.getRequestedCaipNetworks(r)[0];c&&MV.onSwitchNetwork({network:c,ignoreSwitchConfirmation:!0})}else{const c=F.state.noAdapters;oe.state.manualWCControl||c&&!s?ue.isMobile()?X.reset("AllWallets"):X.reset("ConnectingWalletConnectBasic"):t!=null&&t.view?X.reset(t.view,t.data):s?X.reset("Account"):X.reset("Connect")}ji.open=!0,Ga.set({open:!0}),Re.sendEvent({type:"track",event:"MODAL_OPEN",properties:{connected:!!s}})},close(){const t=oe.state.enableEmbedded,e=!!F.state.activeCaipAddress;ji.open&&Re.sendEvent({type:"track",event:"MODAL_CLOSE",properties:{connected:e}}),ji.open=!1,X.reset("Connect"),We.clearLoading(),t?e?X.replace("Account"):X.push("Connect"):Ga.set({open:!1}),xe.resetUri()},setLoading(t,e){e&&ji.loadingNamespaceMap.set(e,t),ji.loading=t,Ga.set({loading:t})},clearLoading(){ji.loadingNamespaceMap.clear(),ji.loading=!1},shake(){ji.shake||(ji.shake=!0,setTimeout(()=>{ji.shake=!1},500))}},We=Pi($ie),lb={id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"USD Coin",symbol:"USDC",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]},eI={id:"USD",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]},jie={providers:PV,selectedProvider:null,error:null,purchaseCurrency:lb,paymentCurrency:eI,purchaseCurrencies:[lb],paymentCurrencies:[],quotesLoading:!1},Bt=rr(jie),Bie={state:Bt,subscribe(t){return ln(Bt,()=>t(Bt))},subscribeKey(t,e){return dn(Bt,t,e)},setSelectedProvider(t){if(t&&t.name==="meld"){const e=F.state.activeChain===_e.CHAIN.SOLANA?"SOL":"USDC",r=re.state.address??"",n=new URL(t.url);n.searchParams.append("publicKey",Pne),n.searchParams.append("destinationCurrencyCode",e),n.searchParams.append("walletAddress",r),n.searchParams.append("externalCustomerId",oe.state.projectId),Bt.selectedProvider={...t,url:n.toString()}}else Bt.selectedProvider=t},setOnrampProviders(t){if(Array.isArray(t)&&t.every(e=>typeof e=="string")){const e=t,r=PV.filter(n=>e.includes(n.name));Bt.providers=r}else Bt.providers=[]},setPurchaseCurrency(t){Bt.purchaseCurrency=t},setPaymentCurrency(t){Bt.paymentCurrency=t},setPurchaseAmount(t){$t.state.purchaseAmount=t},setPaymentAmount(t){$t.state.paymentAmount=t},async getAvailableCurrencies(){const t=await Xe.getOnrampOptions();Bt.purchaseCurrencies=t.purchaseCurrencies,Bt.paymentCurrencies=t.paymentCurrencies,Bt.paymentCurrency=t.paymentCurrencies[0]||eI,Bt.purchaseCurrency=t.purchaseCurrencies[0]||lb,await Ne.fetchCurrencyImages(t.paymentCurrencies.map(e=>e.id)),await Ne.fetchTokenImages(t.purchaseCurrencies.map(e=>e.symbol))},async getQuote(){var t,e;Bt.quotesLoading=!0;try{const r=await Xe.getOnrampQuote({purchaseCurrency:Bt.purchaseCurrency,paymentCurrency:Bt.paymentCurrency,amount:((t=Bt.paymentAmount)==null?void 0:t.toString())||"0",network:(e=Bt.purchaseCurrency)==null?void 0:e.symbol});return Bt.quotesLoading=!1,Bt.purchaseAmount=Number(r==null?void 0:r.purchaseAmount.amount),r}catch(r){return Bt.error=r.message,Bt.quotesLoading=!1,null}finally{Bt.quotesLoading=!1}},resetState(){Bt.selectedProvider=null,Bt.error=null,Bt.purchaseCurrency=lb,Bt.paymentCurrency=eI,Bt.purchaseCurrencies=[lb],Bt.paymentCurrencies=[],Bt.paymentAmount=void 0,Bt.purchaseAmount=void 0,Bt.quotesLoading=!1}},$t=Pi(Bie),u8={async getTokenList(){var n;const t=F.state.activeCaipNetwork,e=await Xe.fetchSwapTokens({chainId:t==null?void 0:t.caipNetworkId});return((n=e==null?void 0:e.tokens)==null?void 0:n.map(i=>({...i,eip2612:!1,quantity:{decimals:"0",numeric:"0"},price:0,value:0})))||[]},async fetchGasPrice(){var e;const t=F.state.activeCaipNetwork;if(!t)return null;try{switch(t.chainNamespace){case"solana":const r=(e=await(xe==null?void 0:xe.estimateGas({chainNamespace:"solana"})))==null?void 0:e.toString();return{standard:r,fast:r,instant:r};case"eip155":default:return await Xe.fetchGasPrice({chainId:t.caipNetworkId})}}catch{return null}},async fetchSwapAllowance({tokenAddress:t,userAddress:e,sourceTokenAmount:r,sourceTokenDecimals:n}){const i=await Xe.fetchSwapAllowance({tokenAddress:t,userAddress:e});if(i!=null&&i.allowance&&r&&n){const s=xe.parseUnits(r,n)||0;return BigInt(i.allowance)>=s}return!1},async getMyTokensWithBalance(t){const e=re.state.address,r=F.state.activeCaipNetwork;if(!e||!r)return[];const i=(await Xe.getBalance(e,r.caipNetworkId,t)).balances.filter(s=>s.quantity.decimals!=="0");return re.setTokenBalance(i,F.state.activeChain),this.mapBalancesToSwapTokens(i)},mapBalancesToSwapTokens(t){return(t==null?void 0:t.map(e=>({...e,address:e!=null&&e.address?e.address:F.getActiveNetworkTokenAddress(),decimals:parseInt(e.quantity.decimals,10),logoUri:e.iconUrl,eip2612:!1})))||[]}},Nl={getGasPriceInEther(t,e){const r=e*t;return Number(r)/1e18},getGasPriceInUSD(t,e,r){const n=Nl.getGasPriceInEther(e,r);return Dt.bigNumber(t).times(n).toNumber()},getPriceImpact({sourceTokenAmount:t,sourceTokenPriceInUSD:e,toTokenPriceInUSD:r,toTokenAmount:n}){const i=Dt.bigNumber(t).times(e),s=Dt.bigNumber(n).times(r);return i.minus(s).div(i).times(100).toNumber()},getMaxSlippage(t,e){const r=Dt.bigNumber(t).div(100);return Dt.multiply(e,r).toNumber()},getProviderFee(t,e=.0085){return Dt.bigNumber(t).times(e).toString()},isInsufficientNetworkTokenForGas(t,e){const r=e||"0";return Dt.bigNumber(t).eq(0)?!0:Dt.bigNumber(Dt.bigNumber(r)).gt(t)},isInsufficientSourceTokenForSwap(t,e,r){var s,o;const n=(o=(s=r==null?void 0:r.find(a=>a.address===e))==null?void 0:s.quantity)==null?void 0:o.numeric;return Dt.bigNumber(n||"0").lt(t)},getToTokenAmount({sourceToken:t,toToken:e,sourceTokenPrice:r,toTokenPrice:n,sourceTokenAmount:i}){if(i==="0"||!t||!e)return"0";const s=t.decimals,o=r,a=e.decimals,c=n;if(c<=0)return"0";const u=Dt.bigNumber(i).times(.0085),d=Dt.bigNumber(i).minus(u).times(Dt.bigNumber(10).pow(s)),h=Dt.bigNumber(o).div(c),f=s-a;return d.times(h).div(Dt.bigNumber(10).pow(f)).div(Dt.bigNumber(10).pow(a)).toFixed(a).toString()}},ik=15e4,Die=6,fi={initializing:!1,initialized:!1,loadingPrices:!1,loadingQuote:!1,loadingApprovalTransaction:!1,loadingBuildTransaction:!1,loadingTransaction:!1,fetchError:!1,approvalTransaction:void 0,swapTransaction:void 0,transactionError:void 0,sourceToken:void 0,sourceTokenAmount:"",sourceTokenPriceInUSD:0,toToken:void 0,toTokenAmount:"",toTokenPriceInUSD:0,networkPrice:"0",networkBalanceInUSD:"0",networkTokenSymbol:"",inputError:void 0,slippage:ct.CONVERT_SLIPPAGE_TOLERANCE,tokens:void 0,popularTokens:void 0,suggestedTokens:void 0,foundTokens:void 0,myTokensWithBalance:void 0,tokensPriceMap:{},gasFee:"0",gasPriceInUSD:0,priceImpact:void 0,maxSlippage:void 0,providerFee:void 0},le=rr(fi),W4={state:le,subscribe(t){return ln(le,()=>t(le))},subscribeKey(t,e){return dn(le,t,e)},getParams(){var c,u,l,d,h,f,g,p;const t=F.state.activeCaipAddress,e=F.state.activeChain,r=ue.getPlainAddress(t),n=F.getActiveNetworkTokenAddress(),i=ge.getConnectorId(e);if(!r)throw new Error("No address found to swap the tokens from.");const s=!((c=le.toToken)!=null&&c.address)||!((u=le.toToken)!=null&&u.decimals),o=!((l=le.sourceToken)!=null&&l.address)||!((d=le.sourceToken)!=null&&d.decimals)||!Dt.bigNumber(le.sourceTokenAmount).gt(0),a=!le.sourceTokenAmount;return{networkAddress:n,fromAddress:r,fromCaipAddress:t,sourceTokenAddress:(h=le.sourceToken)==null?void 0:h.address,toTokenAddress:(f=le.toToken)==null?void 0:f.address,toTokenAmount:le.toTokenAmount,toTokenDecimals:(g=le.toToken)==null?void 0:g.decimals,sourceTokenAmount:le.sourceTokenAmount,sourceTokenDecimals:(p=le.sourceToken)==null?void 0:p.decimals,invalidToToken:s,invalidSourceToken:o,invalidSourceTokenAmount:a,availableToSwap:t&&!s&&!o&&!a,isAuthConnector:i===_e.CONNECTOR_ID.AUTH}},setSourceToken(t){if(!t){le.sourceToken=t,le.sourceTokenAmount="",le.sourceTokenPriceInUSD=0;return}le.sourceToken=t,ye.setTokenPrice(t.address,"sourceToken")},setSourceTokenAmount(t){le.sourceTokenAmount=t},setToToken(t){if(!t){le.toToken=t,le.toTokenAmount="",le.toTokenPriceInUSD=0;return}le.toToken=t,ye.setTokenPrice(t.address,"toToken")},setToTokenAmount(t){le.toTokenAmount=t?Dt.formatNumberToLocalString(t,Die):""},async setTokenPrice(t,e){let r=le.tokensPriceMap[t]||0;r||(le.loadingPrices=!0,r=await ye.getAddressPrice(t)),e==="sourceToken"?le.sourceTokenPriceInUSD=r:e==="toToken"&&(le.toTokenPriceInUSD=r),le.loadingPrices&&(le.loadingPrices=!1),ye.getParams().availableToSwap&&ye.swapTokens()},switchTokens(){if(le.initializing||!le.initialized)return;const t=le.toToken?{...le.toToken}:void 0,e=le.sourceToken?{...le.sourceToken}:void 0,r=t&&le.toTokenAmount===""?"1":le.toTokenAmount;ye.setSourceToken(t),ye.setToToken(e),ye.setSourceTokenAmount(r),ye.setToTokenAmount(""),ye.swapTokens()},resetState(){le.myTokensWithBalance=fi.myTokensWithBalance,le.tokensPriceMap=fi.tokensPriceMap,le.initialized=fi.initialized,le.sourceToken=fi.sourceToken,le.sourceTokenAmount=fi.sourceTokenAmount,le.sourceTokenPriceInUSD=fi.sourceTokenPriceInUSD,le.toToken=fi.toToken,le.toTokenAmount=fi.toTokenAmount,le.toTokenPriceInUSD=fi.toTokenPriceInUSD,le.networkPrice=fi.networkPrice,le.networkTokenSymbol=fi.networkTokenSymbol,le.networkBalanceInUSD=fi.networkBalanceInUSD,le.inputError=fi.inputError,le.myTokensWithBalance=fi.myTokensWithBalance},resetValues(){var r;const{networkAddress:t}=ye.getParams(),e=(r=le.tokens)==null?void 0:r.find(n=>n.address===t);ye.setSourceToken(e),ye.setToToken(void 0)},getApprovalLoadingState(){return le.loadingApprovalTransaction},clearError(){le.transactionError=void 0},async initializeState(){if(!le.initializing){if(le.initializing=!0,!le.initialized)try{await ye.fetchTokens(),le.initialized=!0}catch{le.initialized=!1,Fe.showError("Failed to initialize swap"),X.goBack()}le.initializing=!1}},async fetchTokens(){var r;const{networkAddress:t}=ye.getParams();await ye.getTokenList(),await ye.getNetworkTokenPrice(),await ye.getMyTokensWithBalance();const e=(r=le.tokens)==null?void 0:r.find(n=>n.address===t);e&&(le.networkTokenSymbol=e.symbol,ye.setSourceToken(e),ye.setSourceTokenAmount("1"))},async getTokenList(){const t=await u8.getTokenList();le.tokens=t,le.popularTokens=t.sort((e,r)=>e.symbolr.symbol?1:0),le.suggestedTokens=t.filter(e=>!!ct.SWAP_SUGGESTED_TOKENS.includes(e.symbol),{})},async getAddressPrice(t){var c,u;const e=le.tokensPriceMap[t];if(e)return e;const r=await Xe.fetchTokenPrice({addresses:[t]}),n=(r==null?void 0:r.fungibles)||[],i=[...le.tokens||[],...le.myTokensWithBalance||[]],s=(c=i==null?void 0:i.find(l=>l.address===t))==null?void 0:c.symbol,o=((u=n.find(l=>l.symbol.toLowerCase()===(s==null?void 0:s.toLowerCase())))==null?void 0:u.price)||0,a=parseFloat(o.toString());return le.tokensPriceMap[t]=a,a},async getNetworkTokenPrice(){var i;const{networkAddress:t}=ye.getParams(),r=(i=(await Xe.fetchTokenPrice({addresses:[t]}).catch(()=>(Fe.showError("Failed to fetch network token price"),{fungibles:[]}))).fungibles)==null?void 0:i[0],n=(r==null?void 0:r.price.toString())||"0";le.tokensPriceMap[t]=parseFloat(n),le.networkTokenSymbol=(r==null?void 0:r.symbol)||"",le.networkPrice=n},async getMyTokensWithBalance(t){const e=await yC.getMyTokensWithBalance(t),r=yC.mapBalancesToSwapTokens(e);r&&(await ye.getInitialGasPrice(),ye.setBalances(r))},setBalances(t){const{networkAddress:e}=ye.getParams(),r=F.state.activeCaipNetwork;if(!r)return;const n=t.find(i=>i.address===e);t.forEach(i=>{le.tokensPriceMap[i.address]=i.price||0}),le.myTokensWithBalance=t.filter(i=>i.address.startsWith(r.caipNetworkId)),le.networkBalanceInUSD=n?Dt.multiply(n.quantity.numeric,n.price).toString():"0"},async getInitialGasPrice(){var e,r;const t=await u8.fetchGasPrice();if(!t)return{gasPrice:null,gasPriceInUSD:null};switch((r=(e=F.state)==null?void 0:e.activeCaipNetwork)==null?void 0:r.chainNamespace){case"solana":return le.gasFee=t.standard??"0",le.gasPriceInUSD=Dt.multiply(t.standard,le.networkPrice).div(1e9).toNumber(),{gasPrice:BigInt(le.gasFee),gasPriceInUSD:Number(le.gasPriceInUSD)};case"eip155":default:const n=t.standard??"0",i=BigInt(n),s=BigInt(ik),o=Nl.getGasPriceInUSD(le.networkPrice,s,i);return le.gasFee=n,le.gasPriceInUSD=o,{gasPrice:i,gasPriceInUSD:o}}},async swapTokens(){var s,o;const t=re.state.address,e=le.sourceToken,r=le.toToken,n=Dt.bigNumber(le.sourceTokenAmount).gt(0);if(n||ye.setToTokenAmount(""),!r||!e||le.loadingPrices||!n)return;le.loadingQuote=!0;const i=Dt.bigNumber(le.sourceTokenAmount).times(10**e.decimals).round(0);try{const a=await Xe.fetchSwapQuote({userAddress:t,from:e.address,to:r.address,gasPrice:le.gasFee,amount:i.toString()});le.loadingQuote=!1;const c=(o=(s=a==null?void 0:a.quotes)==null?void 0:s[0])==null?void 0:o.toAmount;if(!c){Fn.open({shortMessage:"Incorrect amount",longMessage:"Please enter a valid amount"},"error");return}const u=Dt.bigNumber(c).div(10**r.decimals).toString();ye.setToTokenAmount(u),ye.hasInsufficientToken(le.sourceTokenAmount,e.address)?le.inputError="Insufficient balance":(le.inputError=void 0,ye.setTransactionDetails())}catch{le.loadingQuote=!1,le.inputError="Insufficient balance"}},async getTransaction(){const{fromCaipAddress:t,availableToSwap:e}=ye.getParams(),r=le.sourceToken,n=le.toToken;if(!(!t||!e||!r||!n||le.loadingQuote))try{le.loadingBuildTransaction=!0;const i=await u8.fetchSwapAllowance({userAddress:t,tokenAddress:r.address,sourceTokenAmount:le.sourceTokenAmount,sourceTokenDecimals:r.decimals});let s;return i?s=await ye.createSwapTransaction():s=await ye.createAllowanceTransaction(),le.loadingBuildTransaction=!1,le.fetchError=!1,s}catch{X.goBack(),Fe.showError("Failed to check allowance"),le.loadingBuildTransaction=!1,le.approvalTransaction=void 0,le.swapTransaction=void 0,le.fetchError=!0;return}},async createAllowanceTransaction(){const{fromCaipAddress:t,sourceTokenAddress:e,toTokenAddress:r}=ye.getParams();if(!(!t||!r)){if(!e)throw new Error("createAllowanceTransaction - No source token address found.");try{const n=await Xe.generateApproveCalldata({from:e,to:r,userAddress:t}),i={data:n.tx.data,to:ue.getPlainAddress(n.tx.from),gasPrice:BigInt(n.tx.eip155.gasPrice),value:BigInt(n.tx.value),toAmount:le.toTokenAmount};return le.swapTransaction=void 0,le.approvalTransaction={data:i.data,to:i.to,gasPrice:i.gasPrice,value:i.value,toAmount:i.toAmount},{data:i.data,to:i.to,gasPrice:i.gasPrice,value:i.value,toAmount:i.toAmount}}catch{X.goBack(),Fe.showError("Failed to create approval transaction"),le.approvalTransaction=void 0,le.swapTransaction=void 0,le.fetchError=!0;return}}},async createSwapTransaction(){var o;const{networkAddress:t,fromCaipAddress:e,sourceTokenAmount:r}=ye.getParams(),n=le.sourceToken,i=le.toToken;if(!e||!r||!n||!i)return;const s=(o=xe.parseUnits(r,n.decimals))==null?void 0:o.toString();try{const a=await Xe.generateSwapCalldata({userAddress:e,from:n.address,to:i.address,amount:s,disableEstimate:!0}),c=n.address===t,u=BigInt(a.tx.eip155.gas),l=BigInt(a.tx.eip155.gasPrice),d={data:a.tx.data,to:ue.getPlainAddress(a.tx.to),gas:u,gasPrice:l,value:BigInt(c?s??"0":"0"),toAmount:le.toTokenAmount};return le.gasPriceInUSD=Nl.getGasPriceInUSD(le.networkPrice,u,l),le.approvalTransaction=void 0,le.swapTransaction=d,d}catch{X.goBack(),Fe.showError("Failed to create transaction"),le.approvalTransaction=void 0,le.swapTransaction=void 0,le.fetchError=!0;return}},async sendTransactionForApproval(t){var i,s,o,a;const{fromAddress:e,isAuthConnector:r}=ye.getParams();le.loadingApprovalTransaction=!0;const n="Approve limit increase in your wallet";r?X.pushTransactionStack({onSuccess(){Fe.showLoading(n)}}):Fe.showLoading(n);try{await xe.sendTransaction({address:e,to:t.to,data:t.data,value:t.value,chainNamespace:"eip155"}),await ye.swapTokens(),await ye.getTransaction(),le.approvalTransaction=void 0,le.loadingApprovalTransaction=!1}catch(c){const u=c;le.transactionError=u==null?void 0:u.shortMessage,le.loadingApprovalTransaction=!1,Fe.showError((u==null?void 0:u.shortMessage)||"Transaction error"),Re.sendEvent({type:"track",event:"SWAP_APPROVAL_ERROR",properties:{message:(u==null?void 0:u.shortMessage)||(u==null?void 0:u.message)||"Unknown",network:((i=F.state.activeCaipNetwork)==null?void 0:i.caipNetworkId)||"",swapFromToken:((s=ye.state.sourceToken)==null?void 0:s.symbol)||"",swapToToken:((o=ye.state.toToken)==null?void 0:o.symbol)||"",swapFromAmount:ye.state.sourceTokenAmount||"",swapToAmount:ye.state.toTokenAmount||"",isSmartAccount:((a=re.state.preferredAccountTypes)==null?void 0:a.eip155)===bt.ACCOUNT_TYPES.SMART_ACCOUNT}})}},async sendTransactionForSwap(t){var o,a,c,u,l,d,h,f,g,p,m,b,v,E;if(!t)return;const{fromAddress:e,toTokenAmount:r,isAuthConnector:n}=ye.getParams();le.loadingTransaction=!0;const i=`Swapping ${(o=le.sourceToken)==null?void 0:o.symbol} to ${Dt.formatNumberToLocalString(r,3)} ${(a=le.toToken)==null?void 0:a.symbol}`,s=`Swapped ${(c=le.sourceToken)==null?void 0:c.symbol} to ${Dt.formatNumberToLocalString(r,3)} ${(u=le.toToken)==null?void 0:u.symbol}`;n?X.pushTransactionStack({onSuccess(){X.replace("Account"),Fe.showLoading(i),W4.resetState()}}):Fe.showLoading("Confirm transaction in your wallet");try{const w=[(l=le.sourceToken)==null?void 0:l.address,(d=le.toToken)==null?void 0:d.address].join(","),C=await xe.sendTransaction({address:e,to:t.to,data:t.data,value:t.value,chainNamespace:"eip155"});return le.loadingTransaction=!1,Fe.showSuccess(s),Re.sendEvent({type:"track",event:"SWAP_SUCCESS",properties:{network:((h=F.state.activeCaipNetwork)==null?void 0:h.caipNetworkId)||"",swapFromToken:((f=ye.state.sourceToken)==null?void 0:f.symbol)||"",swapToToken:((g=ye.state.toToken)==null?void 0:g.symbol)||"",swapFromAmount:ye.state.sourceTokenAmount||"",swapToAmount:ye.state.toTokenAmount||"",isSmartAccount:((p=re.state.preferredAccountTypes)==null?void 0:p.eip155)===bt.ACCOUNT_TYPES.SMART_ACCOUNT}}),W4.resetState(),n||X.replace("Account"),W4.getMyTokensWithBalance(w),C}catch(w){const C=w;le.transactionError=C==null?void 0:C.shortMessage,le.loadingTransaction=!1,Fe.showError((C==null?void 0:C.shortMessage)||"Transaction error"),Re.sendEvent({type:"track",event:"SWAP_ERROR",properties:{message:(C==null?void 0:C.shortMessage)||(C==null?void 0:C.message)||"Unknown",network:((m=F.state.activeCaipNetwork)==null?void 0:m.caipNetworkId)||"",swapFromToken:((b=ye.state.sourceToken)==null?void 0:b.symbol)||"",swapToToken:((v=ye.state.toToken)==null?void 0:v.symbol)||"",swapFromAmount:ye.state.sourceTokenAmount||"",swapToAmount:ye.state.toTokenAmount||"",isSmartAccount:((E=re.state.preferredAccountTypes)==null?void 0:E.eip155)===bt.ACCOUNT_TYPES.SMART_ACCOUNT}});return}},hasInsufficientToken(t,e){return Nl.isInsufficientSourceTokenForSwap(t,e,le.myTokensWithBalance)},setTransactionDetails(){const{toTokenAddress:t,toTokenDecimals:e}=ye.getParams();!t||!e||(le.gasPriceInUSD=Nl.getGasPriceInUSD(le.networkPrice,BigInt(le.gasFee),BigInt(ik)),le.priceImpact=Nl.getPriceImpact({sourceTokenAmount:le.sourceTokenAmount,sourceTokenPriceInUSD:le.sourceTokenPriceInUSD,toTokenPriceInUSD:le.toTokenPriceInUSD,toTokenAmount:le.toTokenAmount}),le.maxSlippage=Nl.getMaxSlippage(le.slippage,le.toTokenAmount),le.providerFee=Nl.getProviderFee(le.sourceTokenAmount))}},ye=Pi(W4),wo=rr({message:"",open:!1,triggerRect:{width:0,height:0,top:0,left:0},variant:"shade"}),Mie={state:wo,subscribe(t){return ln(wo,()=>t(wo))},subscribeKey(t,e){return dn(wo,t,e)},showTooltip({message:t,triggerRect:e,variant:r}){wo.open=!0,wo.message=t,wo.triggerRect=e,wo.variant=r},hide(){wo.open=!1,wo.message="",wo.triggerRect={width:0,height:0,top:0,left:0}}},_s=Pi(Mie),sk=2147483648,Lie={convertEVMChainIdToCoinType(t){if(t>=sk)throw new Error("Invalid chainId");return(sk|t)>>>0}},Us=rr({suggestions:[],loading:!1}),Uie={state:Us,subscribe(t){return ln(Us,()=>t(Us))},subscribeKey(t,e){return dn(Us,t,e)},async resolveName(t){var e,r;try{return await Xe.lookupEnsName(t)}catch(n){const i=n;throw new Error(((r=(e=i==null?void 0:i.reasons)==null?void 0:e[0])==null?void 0:r.description)||"Error resolving name")}},async isNameRegistered(t){try{return await Xe.lookupEnsName(t),!0}catch{return!1}},async getSuggestions(t){try{Us.loading=!0,Us.suggestions=[];const e=await Xe.getEnsNameSuggestions(t);return Us.suggestions=e.suggestions.map(r=>({...r,name:r.name}))||[],Us.suggestions}catch(e){const r=ys.parseEnsApiError(e,"Error fetching name suggestions");throw new Error(r)}finally{Us.loading=!1}},async getNamesForAddress(t){try{if(!F.state.activeCaipNetwork)return[];const r=Le.getEnsFromCacheForAddress(t);if(r)return r;const n=await Xe.reverseLookupEnsName({address:t});return Le.updateEnsCache({address:t,ens:n,timestamp:Date.now()}),n}catch(e){const r=ys.parseEnsApiError(e,"Error fetching names for address");throw new Error(r)}},async registerName(t){const e=F.state.activeCaipNetwork;if(!e)throw new Error("Network not found");const r=re.state.address,n=ge.getAuthConnector();if(!r||!n)throw new Error("Address or auth connector not found");Us.loading=!0;try{const i=JSON.stringify({name:t,attributes:{},timestamp:Math.floor(Date.now()/1e3)});X.pushTransactionStack({onCancel(){X.replace("RegisterAccountName")}});const s=await xe.signMessage(i);Us.loading=!1;const o=e.id;if(!o)throw new Error("Network not found");const a=Lie.convertEVMChainIdToCoinType(Number(o));await Xe.registerEnsName({coinType:a,address:r,signature:s,message:i}),re.setProfileName(t,e.chainNamespace),X.replace("RegisterAccountNameSuccess")}catch(i){const s=ys.parseEnsApiError(i,`Error registering name ${t}`);throw X.replace("RegisterAccountName"),new Error(s)}finally{Us.loading=!1}},validateName(t){return/^[a-zA-Z0-9-]{4,}$/u.test(t)},parseEnsApiError(t,e){var n,i;const r=t;return((i=(n=r==null?void 0:r.reasons)==null?void 0:n[0])==null?void 0:i.description)||e}},ys=Pi(Uie),$1=rr({isLegalCheckboxChecked:!1}),As={state:$1,subscribe(t){return ln($1,()=>t($1))},subscribeKey(t,e){return dn($1,t,e)},setIsLegalCheckboxChecked(t){$1.isLegalCheckboxChecked=t}};var X2={exports:{}},ok;function LV(){if(ok)return X2.exports;ok=1;var t=typeof Reflect=="object"?Reflect:null,e=t&&typeof t.apply=="function"?t.apply:function(C,y,_){return Function.prototype.apply.call(C,y,_)},r;t&&typeof t.ownKeys=="function"?r=t.ownKeys:Object.getOwnPropertySymbols?r=function(C){return Object.getOwnPropertyNames(C).concat(Object.getOwnPropertySymbols(C))}:r=function(C){return Object.getOwnPropertyNames(C)};function n(w){console&&console.warn&&console.warn(w)}var i=Number.isNaN||function(C){return C!==C};function s(){s.init.call(this)}X2.exports=s,X2.exports.once=b,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=10;function a(w){if(typeof w!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof w)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(w){if(typeof w!="number"||w<0||i(w))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+w+".");o=w}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(C){if(typeof C!="number"||C<0||i(C))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+C+".");return this._maxListeners=C,this};function c(w){return w._maxListeners===void 0?s.defaultMaxListeners:w._maxListeners}s.prototype.getMaxListeners=function(){return c(this)},s.prototype.emit=function(C){for(var y=[],_=1;_0&&(T=y[0]),T instanceof Error)throw T;var O=new Error("Unhandled error."+(T?" ("+T.message+")":""));throw O.context=T,O}var k=A[C];if(k===void 0)return!1;if(typeof k=="function")e(k,this,y);else for(var j=k.length,N=g(k,j),_=0;_0&&T.length>x&&!T.warned){T.warned=!0;var O=new Error("Possible EventEmitter memory leak detected. "+T.length+" "+String(C)+" listeners added. Use emitter.setMaxListeners() to increase limit");O.name="MaxListenersExceededWarning",O.emitter=w,O.type=C,O.count=T.length,n(O)}return w}s.prototype.addListener=function(C,y){return u(this,C,y,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(C,y){return u(this,C,y,!0)};function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(w,C,y){var _={fired:!1,wrapFn:void 0,target:w,type:C,listener:y},x=l.bind(_);return x.listener=y,_.wrapFn=x,x}s.prototype.once=function(C,y){return a(y),this.on(C,d(this,C,y)),this},s.prototype.prependOnceListener=function(C,y){return a(y),this.prependListener(C,d(this,C,y)),this},s.prototype.removeListener=function(C,y){var _,x,A,T,O;if(a(y),x=this._events,x===void 0)return this;if(_=x[C],_===void 0)return this;if(_===y||_.listener===y)--this._eventsCount===0?this._events=Object.create(null):(delete x[C],x.removeListener&&this.emit("removeListener",C,_.listener||y));else if(typeof _!="function"){for(A=-1,T=_.length-1;T>=0;T--)if(_[T]===y||_[T].listener===y){O=_[T].listener,A=T;break}if(A<0)return this;A===0?_.shift():p(_,A),_.length===1&&(x[C]=_[0]),x.removeListener!==void 0&&this.emit("removeListener",C,O||y)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(C){var y,_,x;if(_=this._events,_===void 0)return this;if(_.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):_[C]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete _[C]),this;if(arguments.length===0){var A=Object.keys(_),T;for(x=0;x=0;x--)this.removeListener(C,y[x]);return this};function h(w,C,y){var _=w._events;if(_===void 0)return[];var x=_[C];return x===void 0?[]:typeof x=="function"?y?[x.listener||x]:[x]:y?m(x):g(x,x.length)}s.prototype.listeners=function(C){return h(this,C,!0)},s.prototype.rawListeners=function(C){return h(this,C,!1)},s.listenerCount=function(w,C){return typeof w.listenerCount=="function"?w.listenerCount(C):f.call(w,C)},s.prototype.listenerCount=f;function f(w){var C=this._events;if(C!==void 0){var y=C[w];if(typeof y=="function")return 1;if(y!==void 0)return y.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]};function g(w,C){for(var y=new Array(C),_=0;_=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function zie(t,e){return function(r,n){e(r,n,t)}}function Wie(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Vie(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{u(n.next(l))}catch(d){o(d)}}function c(l){try{u(n.throw(l))}catch(d){o(d)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})}function Gie(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(u){return function(l){return c([u,l])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=u[0]&2?i.return:u[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,u[1])).done)return s;switch(i=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function UV(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function Yie(){for(var t=[],e=0;e1||a(h,f)})})}function a(h,f){try{c(n[h](f))}catch(g){d(s[0][3],g)}}function c(h){h.value instanceof Qb?Promise.resolve(h.value.v).then(u,l):d(s[0][2],h)}function u(h){a("next",h)}function l(h){a("throw",h)}function d(h,f){h(f),s.shift(),s.length&&a(s[0][0],s[0][1])}}function Xie(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:Qb(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function ese(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof nI=="function"?nI(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,c){o=t[s](o),i(a,c,o.done,o.value)})}}function i(s,o,a,c){Promise.resolve(c).then(function(u){s({value:u,done:a})},o)}}function tse(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function rse(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function nse(t){return t&&t.__esModule?t:{default:t}}function ise(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function sse(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}const ose=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return rI},__asyncDelegator:Xie,__asyncGenerator:Qie,__asyncValues:ese,__await:Qb,__awaiter:Vie,__classPrivateFieldGet:ise,__classPrivateFieldSet:sse,__createBinding:Kie,__decorate:qie,__exportStar:Zie,__extends:Fie,__generator:Gie,__importDefault:nse,__importStar:rse,__makeTemplateObject:tse,__metadata:Wie,__param:zie,__read:UV,__rest:Hie,__spread:Yie,__spreadArrays:Jie,__values:nI},Symbol.toStringTag,{value:"Module"})),xv=CV(ose);var d8={},j1={},ak;function ase(){if(ak)return j1;ak=1,Object.defineProperty(j1,"__esModule",{value:!0}),j1.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return j1.delay=t,j1}var ch={},h8={},uh={},ck;function cse(){return ck||(ck=1,Object.defineProperty(uh,"__esModule",{value:!0}),uh.ONE_THOUSAND=uh.ONE_HUNDRED=void 0,uh.ONE_HUNDRED=100,uh.ONE_THOUSAND=1e3),uh}var f8={},uk;function use(){return uk||(uk=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=t.ONE_MINUTE*5,t.TEN_MINUTES=t.ONE_MINUTE*10,t.THIRTY_MINUTES=t.ONE_MINUTE*30,t.SIXTY_MINUTES=t.ONE_MINUTE*60,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=t.ONE_HOUR*3,t.SIX_HOURS=t.ONE_HOUR*6,t.TWELVE_HOURS=t.ONE_HOUR*12,t.TWENTY_FOUR_HOURS=t.ONE_HOUR*24,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=t.ONE_DAY*3,t.FIVE_DAYS=t.ONE_DAY*5,t.SEVEN_DAYS=t.ONE_DAY*7,t.THIRTY_DAYS=t.ONE_DAY*30,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=t.ONE_WEEK*2,t.THREE_WEEKS=t.ONE_WEEK*3,t.FOUR_WEEKS=t.ONE_WEEK*4,t.ONE_YEAR=t.ONE_DAY*365}(f8)),f8}var lk;function FV(){return lk||(lk=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=xv;e.__exportStar(cse(),t),e.__exportStar(use(),t)}(h8)),h8}var dk;function lse(){if(dk)return ch;dk=1,Object.defineProperty(ch,"__esModule",{value:!0}),ch.fromMiliseconds=ch.toMiliseconds=void 0;const t=FV();function e(n){return n*t.ONE_THOUSAND}ch.toMiliseconds=e;function r(n){return Math.floor(n/t.ONE_THOUSAND)}return ch.fromMiliseconds=r,ch}var hk;function dse(){return hk||(hk=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=xv;e.__exportStar(ase(),t),e.__exportStar(lse(),t)}(d8)),d8}var Vp={},fk;function hse(){if(fk)return Vp;fk=1,Object.defineProperty(Vp,"__esModule",{value:!0}),Vp.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(r){if(this.timestamps.has(r))throw new Error(`Watch already started for label: ${r}`);this.timestamps.set(r,{started:Date.now()})}stop(r){const n=this.get(r);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const i=Date.now()-n.started;this.timestamps.set(r,{started:n.started,elapsed:i})}get(r){const n=this.timestamps.get(r);if(typeof n>"u")throw new Error(`No timestamp found for label: ${r}`);return n}elapsed(r){const n=this.get(r);return n.elapsed||Date.now()-n.started}}return Vp.Watch=t,Vp.default=t,Vp}var p8={},B1={},pk;function fse(){if(pk)return B1;pk=1,Object.defineProperty(B1,"__esModule",{value:!0}),B1.IWatch=void 0;class t{}return B1.IWatch=t,B1}var gk;function pse(){return gk||(gk=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),xv.__exportStar(fse(),t)}(p8)),p8}var mk;function gse(){return mk||(mk=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=xv;e.__exportStar(dse(),t),e.__exportStar(hse(),t),e.__exportStar(pse(),t),e.__exportStar(FV(),t)}(l8)),l8}var Be=gse();class yp{}let mse=class extends yp{constructor(e){super()}};const wk=Be.FIVE_SECONDS,vp={pulse:"heartbeat_pulse"};let wse=class HV extends mse{constructor(e){super(e),this.events=new ao.EventEmitter,this.interval=wk,this.interval=(e==null?void 0:e.interval)||wk}static async init(e){const r=new HV(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),Be.toMiliseconds(this.interval))}pulse(){this.events.emit(vp.pulse)}};const bse=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,yse=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,vse=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function _se(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){Ese(t);return}return e}function Ese(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function e3(t,e={}){if(typeof t!="string")return t;if(t[0]==='"'&&t[t.length-1]==='"'&&t.indexOf("\\")===-1)return t.slice(1,-1);const r=t.trim();if(r.length<=9)switch(r.toLowerCase()){case"true":return!0;case"false":return!1;case"undefined":return;case"null":return null;case"nan":return Number.NaN;case"infinity":return Number.POSITIVE_INFINITY;case"-infinity":return Number.NEGATIVE_INFINITY}if(!vse.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(bse.test(t)||yse.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,_se)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}function Cse(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function yn(t,...e){try{return Cse(t(...e))}catch(r){return Promise.reject(r)}}function Ase(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function xse(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function V4(t){if(Ase(t))return String(t);if(xse(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return V4(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const iI="base64:";function Sse(t){return typeof t=="string"?t:iI+Pse(t)}function Tse(t){return typeof t!="string"||!t.startsWith(iI)?t:Ise(t.slice(iI.length))}function Ise(t){return globalThis.Buffer?Buffer.from(t,"base64"):Uint8Array.from(globalThis.atob(t),e=>e.codePointAt(0))}function Pse(t){return globalThis.Buffer?Buffer.from(t).toString("base64"):globalThis.btoa(String.fromCodePoint(...t))}function Ui(t){var e;return t&&((e=t.split("?")[0])==null?void 0:e.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""))||""}function Ose(...t){return Ui(t.join(":"))}function t3(t){return t=Ui(t),t?t+":":""}function Rse(t,e){if(e===void 0)return!0;let r=0,n=t.indexOf(":");for(;n>-1;)r++,n=t.indexOf(":",n+1);return r<=e}function kse(t,e){return e?t.startsWith(e)&&t[t.length-1]!=="$":t[t.length-1]!=="$"}const Nse="memory",$se=()=>{const t=new Map;return{name:Nse,getInstance:()=>t,hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function jse(t={}){const e={mounts:{"":t.driver||$se()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=u=>{for(const l of e.mountpoints)if(u.startsWith(l))return{base:l,relativeKey:u.slice(l.length),driver:e.mounts[l]};return{base:"",relativeKey:u,driver:e.mounts[""]}},n=(u,l)=>e.mountpoints.filter(d=>d.startsWith(u)||l&&u.startsWith(d)).map(d=>({relativeBase:u.length>d.length?u.slice(d.length):void 0,mountpoint:d,driver:e.mounts[d]})),i=(u,l)=>{if(e.watching){l=Ui(l);for(const d of e.watchListeners)d(u,l)}},s=async()=>{if(!e.watching){e.watching=!0;for(const u in e.mounts)e.unwatch[u]=await bk(e.mounts[u],i,u)}},o=async()=>{if(e.watching){for(const u in e.unwatch)await e.unwatch[u]();e.unwatch={},e.watching=!1}},a=(u,l,d)=>{const h=new Map,f=g=>{let p=h.get(g.base);return p||(p={driver:g.driver,base:g.base,items:[]},h.set(g.base,p)),p};for(const g of u){const p=typeof g=="string",m=Ui(p?g:g.key),b=p?void 0:g.value,v=p||!g.options?l:{...l,...g.options},E=r(m);f(E).items.push({key:m,value:b,relativeKey:E.relativeKey,options:v})}return Promise.all([...h.values()].map(g=>d(g))).then(g=>g.flat())},c={hasItem(u,l={}){u=Ui(u);const{relativeKey:d,driver:h}=r(u);return yn(h.hasItem,d,l)},getItem(u,l={}){u=Ui(u);const{relativeKey:d,driver:h}=r(u);return yn(h.getItem,d,l).then(f=>e3(f))},getItems(u,l={}){return a(u,l,d=>d.driver.getItems?yn(d.driver.getItems,d.items.map(h=>({key:h.relativeKey,options:h.options})),l).then(h=>h.map(f=>({key:Ose(d.base,f.key),value:e3(f.value)}))):Promise.all(d.items.map(h=>yn(d.driver.getItem,h.relativeKey,h.options).then(f=>({key:h.key,value:e3(f)})))))},getItemRaw(u,l={}){u=Ui(u);const{relativeKey:d,driver:h}=r(u);return h.getItemRaw?yn(h.getItemRaw,d,l):yn(h.getItem,d,l).then(f=>Tse(f))},async setItem(u,l,d={}){if(l===void 0)return c.removeItem(u);u=Ui(u);const{relativeKey:h,driver:f}=r(u);f.setItem&&(await yn(f.setItem,h,V4(l),d),f.watch||i("update",u))},async setItems(u,l){await a(u,l,async d=>{if(d.driver.setItems)return yn(d.driver.setItems,d.items.map(h=>({key:h.relativeKey,value:V4(h.value),options:h.options})),l);d.driver.setItem&&await Promise.all(d.items.map(h=>yn(d.driver.setItem,h.relativeKey,V4(h.value),h.options)))})},async setItemRaw(u,l,d={}){if(l===void 0)return c.removeItem(u,d);u=Ui(u);const{relativeKey:h,driver:f}=r(u);if(f.setItemRaw)await yn(f.setItemRaw,h,l,d);else if(f.setItem)await yn(f.setItem,h,Sse(l),d);else return;f.watch||i("update",u)},async removeItem(u,l={}){typeof l=="boolean"&&(l={removeMeta:l}),u=Ui(u);const{relativeKey:d,driver:h}=r(u);h.removeItem&&(await yn(h.removeItem,d,l),(l.removeMeta||l.removeMata)&&await yn(h.removeItem,d+"$",l),h.watch||i("remove",u))},async getMeta(u,l={}){typeof l=="boolean"&&(l={nativeOnly:l}),u=Ui(u);const{relativeKey:d,driver:h}=r(u),f=Object.create(null);if(h.getMeta&&Object.assign(f,await yn(h.getMeta,d,l)),!l.nativeOnly){const g=await yn(h.getItem,d+"$",l).then(p=>e3(p));g&&typeof g=="object"&&(typeof g.atime=="string"&&(g.atime=new Date(g.atime)),typeof g.mtime=="string"&&(g.mtime=new Date(g.mtime)),Object.assign(f,g))}return f},setMeta(u,l,d={}){return this.setItem(u+"$",l,d)},removeMeta(u,l={}){return this.removeItem(u+"$",l)},async getKeys(u,l={}){var m;u=t3(u);const d=n(u,!0);let h=[];const f=[];let g=!0;for(const b of d){(m=b.driver.flags)!=null&&m.maxDepth||(g=!1);const v=await yn(b.driver.getKeys,b.relativeBase,l);for(const E of v){const w=b.mountpoint+Ui(E);h.some(C=>w.startsWith(C))||f.push(w)}h=[b.mountpoint,...h.filter(E=>!E.startsWith(b.mountpoint))]}const p=l.maxDepth!==void 0&&!g;return f.filter(b=>(!p||Rse(b,l.maxDepth))&&kse(b,u))},async clear(u,l={}){u=t3(u),await Promise.all(n(u,!1).map(async d=>{if(d.driver.clear)return yn(d.driver.clear,d.relativeBase,l);if(d.driver.removeItem){const h=await d.driver.getKeys(d.relativeBase||"",l);return Promise.all(h.map(f=>d.driver.removeItem(f,l)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(u=>yk(u)))},async watch(u){return await s(),e.watchListeners.push(u),async()=>{e.watchListeners=e.watchListeners.filter(l=>l!==u),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(u,l){if(u=t3(u),u&&e.mounts[u])throw new Error(`already mounted at ${u}`);return u&&(e.mountpoints.push(u),e.mountpoints.sort((d,h)=>h.length-d.length)),e.mounts[u]=l,e.watching&&Promise.resolve(bk(l,i,u)).then(d=>{e.unwatch[u]=d}).catch(console.error),c},async unmount(u,l=!0){var d,h;u=t3(u),!(!u||!e.mounts[u])&&(e.watching&&u in e.unwatch&&((h=(d=e.unwatch)[u])==null||h.call(d),delete e.unwatch[u]),l&&await yk(e.mounts[u]),e.mountpoints=e.mountpoints.filter(f=>f!==u),delete e.mounts[u])},getMount(u=""){u=Ui(u)+":";const l=r(u);return{driver:l.driver,base:l.base}},getMounts(u="",l={}){return u=Ui(u),n(u,l.parents).map(h=>({driver:h.driver,base:h.mountpoint}))},keys:(u,l={})=>c.getKeys(u,l),get:(u,l={})=>c.getItem(u,l),set:(u,l,d={})=>c.setItem(u,l,d),has:(u,l={})=>c.hasItem(u,l),del:(u,l={})=>c.removeItem(u,l),remove:(u,l={})=>c.removeItem(u,l)};return c}function bk(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function yk(t){typeof t.dispose=="function"&&await yn(t.dispose)}function _p(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function qV(t,e){let r;const n=()=>{if(r)return r;const i=indexedDB.open(t);return i.onupgradeneeded=()=>i.result.createObjectStore(e),r=_p(i),r.then(s=>{s.onclose=()=>r=void 0},()=>{}),r};return(i,s)=>n().then(o=>s(o.transaction(e,i).objectStore(e)))}let g8;function Sv(){return g8||(g8=qV("keyval-store","keyval")),g8}function vk(t,e=Sv()){return e("readonly",r=>_p(r.get(t)))}function Bse(t,e,r=Sv()){return r("readwrite",n=>(n.put(e,t),_p(n.transaction)))}function Dse(t,e=Sv()){return e("readwrite",r=>(r.delete(t),_p(r.transaction)))}function Mse(t=Sv()){return t("readwrite",e=>(e.clear(),_p(e.transaction)))}function Lse(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},_p(t.transaction)}function Use(t=Sv()){return t("readonly",e=>{if(e.getAllKeys)return _p(e.getAllKeys());const r=[];return Lse(e,n=>r.push(n.key)).then(()=>r)})}const Fse=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),Hse=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)};function jf(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return Hse(t)}catch{return t}}function Tu(t){return typeof t=="string"?t:Fse(t)||""}const qse="idb-keyval";var zse=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i;let n;return t.dbName&&t.storeName&&(n=qV(t.dbName,t.storeName)),{name:qse,options:t,async hasItem(i){return!(typeof await vk(r(i),n)>"u")},async getItem(i){return await vk(r(i),n)??null},setItem(i,s){return Bse(r(i),s,n)},removeItem(i){return Dse(r(i),n)},getKeys(){return Use(n)},clear(){return Mse(n)}}};const Wse="WALLET_CONNECT_V2_INDEXED_DB",Vse="keyvaluestorage";let Gse=class{constructor(){this.indexedDb=jse({driver:zse({dbName:Wse,storeName:Vse})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,Tu(r))}async removeItem(e){await this.indexedDb.removeItem(e)}};var m8=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},G4={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof m8<"u"&&m8.localStorage?G4.exports=m8.localStorage:typeof window<"u"&&window.localStorage?G4.exports=window.localStorage:G4.exports=new e})();function Kse(t){var e;return[t[0],jf((e=t[1])!=null?e:"")]}let Zse=class{constructor(){this.localStorage=G4.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(Kse)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return jf(r)}async setItem(e,r){this.localStorage.setItem(e,Tu(r))}async removeItem(e){this.localStorage.removeItem(e)}};const Yse="wc_storage_version",_k=1,Jse=async(t,e,r)=>{const n=Yse,i=await e.getItem(n);if(i&&i>=_k){r(e);return}const s=await t.getKeys();if(!s.length){r(e);return}const o=[];for(;s.length;){const a=s.shift();if(!a)continue;const c=a.toLowerCase();if(c.includes("wc@")||c.includes("walletconnect")||c.includes("wc_")||c.includes("wallet_connect")){const u=await t.getItem(a);await e.setItem(a,u),o.push(a)}}await e.setItem(n,_k),r(e),Qse(t,o)},Qse=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};let Xse=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new Zse;this.storage=e;try{const r=new Gse;Jse(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}};var w8,Ek;function eoe(){if(Ek)return w8;Ek=1;function t(r){try{return JSON.stringify(r)}catch{return'"[Circular]"'}}w8=e;function e(r,n,i){var s=i&&i.stringify||t,o=1;if(typeof r=="object"&&r!==null){var a=n.length+o;if(a===1)return r;var c=new Array(a);c[0]=s(r);for(var u=1;u-1?f:0,r.charCodeAt(p+1)){case 100:case 102:if(h>=l||n[h]==null)break;f=l||n[h]==null)break;f=l||n[h]===void 0)break;f",f=p+2,p++;break}d+=s(n[h]),f=p+2,p++;break;case 115:if(h>=l)break;f-1&&(O=!1);const k=["error","fatal","warn","info","debug","trace"];typeof x=="function"&&(x.error=x.fatal=x.warn=x.info=x.debug=x.trace=x),y.enabled===!1&&(y.level="silent");const j=y.level||"info",N=Object.create(x);N.log||(N.log=m),Object.defineProperty(N,"levelVal",{get:P}),Object.defineProperty(N,"level",{get:I,set:B});const S={transmit:_,serialize:T,asObject:y.browser.asObject,levels:k,timestamp:f(y)};N.levels=i.levels,N.level=j,N.setMaxListeners=N.getMaxListeners=N.emit=N.addListener=N.on=N.prependListener=N.once=N.prependOnceListener=N.removeListener=N.removeAllListeners=N.listeners=N.listenerCount=N.eventNames=N.write=N.flush=m,N.serializers=A,N._serialize=T,N._stdErrSerialize=O,N.child=$,_&&(N._logEvent=d());function P(){return this.level==="silent"?1/0:this.levels.values[this.level]}function I(){return this._level}function B(R){if(R!=="silent"&&!this.levels.values[R])throw Error("unknown level "+R);this._level=R,s(S,N,"error","log"),s(S,N,"fatal","error"),s(S,N,"warn","error"),s(S,N,"info","log"),s(S,N,"debug","log"),s(S,N,"trace","log")}function $(R,D){if(!R)throw new Error("missing bindings for child Pino");D=D||{},T&&R.serializers&&(D.serializers=R.serializers);const L=D.serializers;if(T&&L){var U=Object.assign({},A,L),z=y.browser.serialize===!0?Object.keys(U):T;delete R.serializers,c([R],z,U,this._stdErrSerialize)}function W(K){this._childLevel=(K._childLevel|0)+1,this.error=u(K,R,"error"),this.fatal=u(K,R,"fatal"),this.warn=u(K,R,"warn"),this.info=u(K,R,"info"),this.debug=u(K,R,"debug"),this.trace=u(K,R,"trace"),U&&(this.serializers=U,this._serialize=z),_&&(this._logEvent=d([].concat(K._logEvent.bindings,R)))}return W.prototype=this,new W(this)}return N}i.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},i.stdSerializers=r,i.stdTimeFunctions=Object.assign({},{nullTime:b,epochTime:v,unixTime:E,isoTime:w});function s(y,_,x,A){const T=Object.getPrototypeOf(_);_[x]=_.levelVal>_.levels.values[x]?m:T[x]?T[x]:e[x]||e[A]||m,o(y,_,x)}function o(y,_,x){!y.transmit&&_[x]===m||(_[x]=function(A){return function(){const O=y.timestamp(),k=new Array(arguments.length),j=Object.getPrototypeOf&&Object.getPrototypeOf(this)===e?e:this;for(var N=0;N-1&&O in x&&(y[T][O]=x[O](y[T][O]))}function u(y,_,x){return function(){const A=new Array(1+arguments.length);A[0]=_;for(var T=1;Tthis.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const r=e.value;return e=e.next,{done:!1,value:r}}}}},zV=class{constructor(e,r=k9){this.level=e??"error",this.levelValue=B0.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new Ak(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===B0.levels.values.error?console.error(e):r===B0.levels.values.warn?console.warn(e):r===B0.levels.values.debug?console.debug(e):r===B0.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(Tu({timestamp:new Date().toISOString(),log:e}));const r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new Ak(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(Tu({extraMetadata:e})),new Blob(r,{type:"application/json"})}},ioe=class{constructor(e,r=k9){this.baseChunkLogger=new zV(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const r=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=r,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}},soe=class{constructor(e,r=k9){this.baseChunkLogger=new zV(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}};var ooe=Object.defineProperty,aoe=Object.defineProperties,coe=Object.getOwnPropertyDescriptors,xk=Object.getOwnPropertySymbols,uoe=Object.prototype.hasOwnProperty,loe=Object.prototype.propertyIsEnumerable,Sk=(t,e,r)=>e in t?ooe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,vC=(t,e)=>{for(var r in e||(e={}))uoe.call(e,r)&&Sk(t,r,e[r]);if(xk)for(var r of xk(e))loe.call(e,r)&&Sk(t,r,e[r]);return t},_C=(t,e)=>aoe(t,coe(e));function Xm(t){return _C(vC({},t),{level:(t==null?void 0:t.level)||roe.level})}function doe(t,e=Iv){return t[e]||""}function hoe(t,e,r=Iv){return t[r]=e,t}function es(t,e=Iv){let r="";return typeof t.bindings>"u"?r=doe(t,e):r=t.bindings().context||"",r}function foe(t,e,r=Iv){const n=es(t,r);return n.trim()?`${n}/${e}`:e}function si(t,e,r=Iv){const n=foe(t,e,r),i=t.child({context:n});return hoe(i,n,r)}function poe(t){var e,r;const n=new ioe((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Tv(_C(vC({},t.opts),{level:"trace",browser:_C(vC({},(r=t.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function goe(t){var e;const r=new soe((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Tv(_C(vC({},t.opts),{level:"trace"}),r),chunkLoggerController:r}}function N9(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?poe(t):goe(t)}var moe=Object.defineProperty,woe=(t,e,r)=>e in t?moe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Tk=(t,e,r)=>woe(t,typeof e!="symbol"?e+"":e,r);let boe=class extends yp{constructor(e){super(),this.opts=e,Tk(this,"protocol","wc"),Tk(this,"version",2)}};var yoe=Object.defineProperty,voe=(t,e,r)=>e in t?yoe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,_oe=(t,e,r)=>voe(t,e+"",r);let Eoe=class extends yp{constructor(e,r){super(),this.core=e,this.logger=r,_oe(this,"records",new Map)}},Coe=class{constructor(e,r){this.logger=e,this.core=r}},Aoe=class extends yp{constructor(e,r){super(),this.relayer=e,this.logger=r}},xoe=class extends yp{constructor(e){super()}},Soe=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},Toe=class extends yp{constructor(e,r){super(),this.relayer=e,this.logger=r}},Ioe=class extends yp{constructor(e,r){super(),this.core=e,this.logger=r}},Poe=class{constructor(e,r,n){this.core=e,this.logger=r,this.store=n}},Ooe=class{constructor(e,r){this.projectId=e,this.logger=r}},Roe=class{constructor(e,r,n){this.core=e,this.logger=r,this.telemetryEnabled=n}};var koe=Object.defineProperty,Noe=(t,e,r)=>e in t?koe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ik=(t,e,r)=>Noe(t,typeof e!="symbol"?e+"":e,r);let $oe=class{constructor(e){this.opts=e,Ik(this,"protocol","wc"),Ik(this,"version",2)}},joe=class{constructor(e){this.client=e}};function Boe(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function WV(t,...e){if(!Boe(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function Pk(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function Doe(t,e){WV(t);const r=e.outputLen;if(t.lengthnew DataView(t.buffer,t.byteOffset,t.byteLength);function Moe(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))}function VV(t){return typeof t=="string"&&(t=Moe(t)),WV(t),t}let Loe=class{clone(){return this._cloneInto()}};function Uoe(t){const e=n=>t().update(VV(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function GV(t=32){if(Gp&&typeof Gp.getRandomValues=="function")return Gp.getRandomValues(new Uint8Array(t));if(Gp&&typeof Gp.randomBytes=="function")return Gp.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}function Foe(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),c=n?4:0,u=n?0:4;t.setUint32(e+c,o,n),t.setUint32(e+u,a,n)}let Hoe=class extends Loe{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=y8(this.buffer)}update(e){Pk(this);const{view:r,buffer:n,blockLen:i}=this;e=VV(e);const s=e.length;for(let o=0;oi-o&&(this.process(n,0),o=0);for(let d=o;dl.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d>sI&r3)}:{h:Number(t>>sI&r3)|0,l:Number(t&r3)|0}}function qoe(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;iBigInt(t>>>0)<>>0),Woe=(t,e,r)=>t>>>r,Voe=(t,e,r)=>t<<32-r|e>>>r,Goe=(t,e,r)=>t>>>r|e<<32-r,Koe=(t,e,r)=>t<<32-r|e>>>r,Zoe=(t,e,r)=>t<<64-r|e>>>r-32,Yoe=(t,e,r)=>t>>>r-32|e<<64-r,Joe=(t,e)=>e,Qoe=(t,e)=>t,Xoe=(t,e,r)=>t<>>32-r,eae=(t,e,r)=>e<>>32-r,tae=(t,e,r)=>e<>>64-r,rae=(t,e,r)=>t<>>64-r;function nae(t,e,r,n){const i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:i|0}}const iae=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),sae=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,oae=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),aae=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0,cae=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0),uae=(t,e,r,n,i,s)=>e+r+n+i+s+(t/2**32|0)|0,At={fromBig:KV,split:qoe,toBig:zoe,shrSH:Woe,shrSL:Voe,rotrSH:Goe,rotrSL:Koe,rotrBH:Zoe,rotrBL:Yoe,rotr32H:Joe,rotr32L:Qoe,rotlSH:Xoe,rotlSL:eae,rotlBH:tae,rotlBL:rae,add:nae,add3L:iae,add3H:sae,add4L:oae,add4H:aae,add5H:uae,add5L:cae},[lae,dae]=At.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))),pl=new Uint32Array(80),gl=new Uint32Array(80);let hae=class extends Hoe{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:r,Bh:n,Bl:i,Ch:s,Cl:o,Dh:a,Dl:c,Eh:u,El:l,Fh:d,Fl:h,Gh:f,Gl:g,Hh:p,Hl:m}=this;return[e,r,n,i,s,o,a,c,u,l,d,h,f,g,p,m]}set(e,r,n,i,s,o,a,c,u,l,d,h,f,g,p,m){this.Ah=e|0,this.Al=r|0,this.Bh=n|0,this.Bl=i|0,this.Ch=s|0,this.Cl=o|0,this.Dh=a|0,this.Dl=c|0,this.Eh=u|0,this.El=l|0,this.Fh=d|0,this.Fl=h|0,this.Gh=f|0,this.Gl=g|0,this.Hh=p|0,this.Hl=m|0}process(e,r){for(let E=0;E<16;E++,r+=4)pl[E]=e.getUint32(r),gl[E]=e.getUint32(r+=4);for(let E=16;E<80;E++){const w=pl[E-15]|0,C=gl[E-15]|0,y=At.rotrSH(w,C,1)^At.rotrSH(w,C,8)^At.shrSH(w,C,7),_=At.rotrSL(w,C,1)^At.rotrSL(w,C,8)^At.shrSL(w,C,7),x=pl[E-2]|0,A=gl[E-2]|0,T=At.rotrSH(x,A,19)^At.rotrBH(x,A,61)^At.shrSH(x,A,6),O=At.rotrSL(x,A,19)^At.rotrBL(x,A,61)^At.shrSL(x,A,6),k=At.add4L(_,O,gl[E-7],gl[E-16]),j=At.add4H(k,y,T,pl[E-7],pl[E-16]);pl[E]=j|0,gl[E]=k|0}let{Ah:n,Al:i,Bh:s,Bl:o,Ch:a,Cl:c,Dh:u,Dl:l,Eh:d,El:h,Fh:f,Fl:g,Gh:p,Gl:m,Hh:b,Hl:v}=this;for(let E=0;E<80;E++){const w=At.rotrSH(d,h,14)^At.rotrSH(d,h,18)^At.rotrBH(d,h,41),C=At.rotrSL(d,h,14)^At.rotrSL(d,h,18)^At.rotrBL(d,h,41),y=d&f^~d&p,_=h&g^~h&m,x=At.add5L(v,C,_,dae[E],gl[E]),A=At.add5H(x,b,w,y,lae[E],pl[E]),T=x|0,O=At.rotrSH(n,i,28)^At.rotrBH(n,i,34)^At.rotrBH(n,i,39),k=At.rotrSL(n,i,28)^At.rotrBL(n,i,34)^At.rotrBL(n,i,39),j=n&s^n&a^s&a,N=i&o^i&c^o&c;b=p|0,v=m|0,p=f|0,m=g|0,f=d|0,g=h|0,{h:d,l:h}=At.add(u|0,l|0,A|0,T|0),u=a|0,l=c|0,a=s|0,c=o|0,s=n|0,o=i|0;const S=At.add3L(T,k,N);n=At.add3H(S,A,O,j),i=S|0}({h:n,l:i}=At.add(this.Ah|0,this.Al|0,n|0,i|0)),{h:s,l:o}=At.add(this.Bh|0,this.Bl|0,s|0,o|0),{h:a,l:c}=At.add(this.Ch|0,this.Cl|0,a|0,c|0),{h:u,l}=At.add(this.Dh|0,this.Dl|0,u|0,l|0),{h:d,l:h}=At.add(this.Eh|0,this.El|0,d|0,h|0),{h:f,l:g}=At.add(this.Fh|0,this.Fl|0,f|0,g|0),{h:p,l:m}=At.add(this.Gh|0,this.Gl|0,p|0,m|0),{h:b,l:v}=At.add(this.Hh|0,this.Hl|0,b|0,v|0),this.set(n,i,s,o,a,c,u,l,d,h,f,g,p,m,b,v)}roundClean(){pl.fill(0),gl.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};const fae=Uoe(()=>new hae);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const $9=BigInt(0),ZV=BigInt(1),pae=BigInt(2);function j9(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function B9(t){if(!j9(t))throw new Error("Uint8Array expected")}function v8(t,e){if(typeof e!="boolean")throw new Error(t+" boolean expected, got "+e)}const gae=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function D9(t){B9(t);let e="";for(let r=0;r=yc._0&&t<=yc._9)return t-yc._0;if(t>=yc.A&&t<=yc.F)return t-(yc.A-10);if(t>=yc.a&&t<=yc.f)return t-(yc.a-10)}function JV(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length,r=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let i=0,s=0;itypeof t=="bigint"&&$9<=t;function wae(t,e,r){return _8(t)&&_8(e)&&_8(r)&&e<=t&&t$9;t>>=ZV,e+=1);return e}const yae=t=>(pae<typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||j9(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function M9(t,e,r={}){const n=(i,s,o)=>{const a=vae[s];if(typeof a!="function")throw new Error("invalid validator function");const c=t[i];if(!(o&&c===void 0)&&!a(c,t))throw new Error("param "+String(i)+" is invalid. Expected "+s+", got "+c)};for(const[i,s]of Object.entries(e))n(i,s,!1);for(const[i,s]of Object.entries(r))n(i,s,!0);return t}function kk(t){const e=new WeakMap;return(r,...n)=>{const i=e.get(r);if(i!==void 0)return i;const s=t(r,...n);return e.set(r,s),s}}const Sn=BigInt(0),Kr=BigInt(1),Mh=BigInt(2),_ae=BigInt(3),aI=BigInt(4),Nk=BigInt(5),$k=BigInt(8);function mn(t,e){const r=t%e;return r>=Sn?r:e+r}function Eae(t,e,r){if(eSn;)e&Kr&&(n=n*t%r),t=t*t%r,e>>=Kr;return n}function ma(t,e,r){let n=t;for(;e-- >Sn;)n*=n,n%=r;return n}function jk(t,e){if(t===Sn)throw new Error("invert: expected non-zero number");if(e<=Sn)throw new Error("invert: expected positive modulus, got "+e);let r=mn(t,e),n=e,i=Sn,s=Kr;for(;r!==Sn;){const o=n/r,a=n%r,c=i-s*o;n=r,r=a,i=s,s=c}if(n!==Kr)throw new Error("invert: does not exist");return mn(i,e)}function Cae(t){const e=(t-Kr)/Mh;let r,n,i;for(r=t-Kr,n=0;r%Mh===Sn;r/=Mh,n++);for(i=Mh;i1e3)throw new Error("Cannot find square root: likely non-prime P");if(n===1){const o=(t+Kr)/aI;return function(a,c){const u=a.pow(c,o);if(!a.eql(a.sqr(u),c))throw new Error("Cannot find square root");return u}}const s=(r+Kr)/Mh;return function(o,a){if(o.pow(a,e)===o.neg(o.ONE))throw new Error("Cannot find square root");let c=n,u=o.pow(o.mul(o.ONE,i),r),l=o.pow(a,s),d=o.pow(a,r);for(;!o.eql(d,o.ONE);){if(o.eql(d,o.ZERO))return o.ZERO;let h=1;for(let g=o.sqr(d);h(mn(t,e)&Kr)===Kr,Sae=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Tae(t){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=Sae.reduce((n,i)=>(n[i]="function",n),e);return M9(t,r)}function Iae(t,e,r){if(rSn;)r&Kr&&(n=t.mul(n,i)),i=t.sqr(i),r>>=Kr;return n}function Pae(t,e){const r=new Array(e.length),n=e.reduce((s,o,a)=>t.is0(o)?s:(r[a]=s,t.mul(s,o)),t.ONE),i=t.inv(n);return e.reduceRight((s,o,a)=>t.is0(o)?s:(r[a]=t.mul(s,r[a]),t.mul(s,o)),i),r}function XV(t,e){const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function eG(t,e,r=!1,n={}){if(t<=Sn)throw new Error("invalid field: expected ORDER > 0, got "+t);const{nBitLength:i,nByteLength:s}=XV(t,e);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const a=Object.freeze({ORDER:t,isLE:r,BITS:i,BYTES:s,MASK:yae(i),ZERO:Sn,ONE:Kr,create:c=>mn(c,t),isValid:c=>{if(typeof c!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof c);return Sn<=c&&cc===Sn,isOdd:c=>(c&Kr)===Kr,neg:c=>mn(-c,t),eql:(c,u)=>c===u,sqr:c=>mn(c*c,t),add:(c,u)=>mn(c+u,t),sub:(c,u)=>mn(c-u,t),mul:(c,u)=>mn(c*u,t),pow:(c,u)=>Iae(a,c,u),div:(c,u)=>mn(c*jk(u,t),t),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>jk(c,t),sqrt:n.sqrt||(c=>(o||(o=Aae(t)),o(a,c))),invertBatch:c=>Pae(a,c),cmov:(c,u,l)=>l?u:c,toBytes:c=>r?oI(c,s):QV(c,s),fromBytes:c=>{if(c.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+c.length);return r?K4(c):mae(c)}});return Object.freeze(a)}const Bk=BigInt(0),n3=BigInt(1);function E8(t,e){const r=e.negate();return t?r:e}function tG(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function C8(t,e){tG(t,e);const r=Math.ceil(e/t)+1,n=2**(t-1);return{windows:r,windowSize:n}}function Oae(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach((r,n)=>{if(!(r instanceof e))throw new Error("invalid point at index "+n)})}function Rae(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach((r,n)=>{if(!e.isValid(r))throw new Error("invalid scalar at index "+n)})}const A8=new WeakMap,rG=new WeakMap;function x8(t){return rG.get(t)||1}function kae(t,e){return{constTimeNegate:E8,hasPrecomputes(r){return x8(r)!==1},unsafeLadder(r,n,i=t.ZERO){let s=r;for(;n>Bk;)n&n3&&(i=i.add(s)),s=s.double(),n>>=n3;return i},precomputeWindow(r,n){const{windows:i,windowSize:s}=C8(n,e),o=[];let a=r,c=a;for(let u=0;u>=d,g>o&&(g-=l,i+=n3);const p=f,m=f+Math.abs(g)-1,b=h%2!==0,v=g<0;g===0?c=c.add(E8(b,n[p])):a=a.add(E8(v,n[m]))}return{p:a,f:c}},wNAFUnsafe(r,n,i,s=t.ZERO){const{windows:o,windowSize:a}=C8(r,e),c=BigInt(2**r-1),u=2**r,l=BigInt(r);for(let d=0;d>=l,f>a&&(f-=u,i+=n3),f===0)continue;let g=n[h+Math.abs(f)-1];f<0&&(g=g.negate()),s=s.add(g)}return s},getPrecomputes(r,n,i){let s=A8.get(n);return s||(s=this.precomputeWindow(n,r),r!==1&&A8.set(n,i(s))),s},wNAFCached(r,n,i){const s=x8(r);return this.wNAF(s,this.getPrecomputes(s,r,i),n)},wNAFCachedUnsafe(r,n,i,s){const o=x8(r);return o===1?this.unsafeLadder(r,n,s):this.wNAFUnsafe(o,this.getPrecomputes(o,r,i),n,s)},setWindowSize(r,n){tG(n,e),rG.set(r,n),A8.delete(r)}}}function Nae(t,e,r,n){if(Oae(r,t),Rae(n,e),r.length!==n.length)throw new Error("arrays of points and scalars must have equal length");const i=t.ZERO,s=bae(BigInt(r.length)),o=s>12?s-3:s>4?s-2:s?2:1,a=(1<=0;d-=o){c.fill(i);for(let f=0;f>BigInt(d)&BigInt(a));c[p]=c[p].add(r[f])}let h=i;for(let f=c.length-1,g=i;f>0;f--)g=g.add(c[f]),h=h.add(g);if(l=l.add(h),d!==0)for(let f=0;f{try{return{isValid:!0,value:r.sqrt(S*r.inv(P))}}catch{return{isValid:!1,value:bo}}}),f=e.adjustScalarBytes||(S=>S),g=e.domain||((S,P,I)=>{if(v8("phflag",I),P.length||I)throw new Error("Contexts/pre-hash are not supported");return S});function p(S,P){D1("coordinate "+S,P,bo,u)}function m(S){if(!(S instanceof E))throw new Error("ExtendedPoint expected")}const b=kk((S,P)=>{const{ex:I,ey:B,ez:$}=S,R=S.is0();P==null&&(P=R?jae:r.inv($));const D=l(I*P),L=l(B*P),U=l($*P);if(R)return{x:bo,y:Bi};if(U!==Bi)throw new Error("invZ was invalid");return{x:D,y:L}}),v=kk(S=>{const{a:P,d:I}=e;if(S.is0())throw new Error("bad point: ZERO");const{ex:B,ey:$,ez:R,et:D}=S,L=l(B*B),U=l($*$),z=l(R*R),W=l(z*z),K=l(L*P),J=l(z*l(K+U)),ne=l(W+l(I*l(L*U)));if(J!==ne)throw new Error("bad point: equation left != right (1)");const ae=l(B*$),he=l(R*D);if(ae!==he)throw new Error("bad point: equation left != right (2)");return!0});class E{constructor(P,I,B,$){this.ex=P,this.ey=I,this.ez=B,this.et=$,p("x",P),p("y",I),p("z",B),p("t",$),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(P){if(P instanceof E)throw new Error("extended point not allowed");const{x:I,y:B}=P||{};return p("x",I),p("y",B),new E(I,B,Bi,l(I*B))}static normalizeZ(P){const I=r.invertBatch(P.map(B=>B.ez));return P.map((B,$)=>B.toAffine(I[$])).map(E.fromAffine)}static msm(P,I){return Nae(E,d,P,I)}_setWindowSize(P){y.setWindowSize(this,P)}assertValidity(){v(this)}equals(P){m(P);const{ex:I,ey:B,ez:$}=this,{ex:R,ey:D,ez:L}=P,U=l(I*L),z=l(R*$),W=l(B*L),K=l(D*$);return U===z&&W===K}is0(){return this.equals(E.ZERO)}negate(){return new E(l(-this.ex),this.ey,this.ez,l(-this.et))}double(){const{a:P}=e,{ex:I,ey:B,ez:$}=this,R=l(I*I),D=l(B*B),L=l(i3*l($*$)),U=l(P*R),z=I+B,W=l(l(z*z)-R-D),K=U+D,J=K-L,ne=U-D,ae=l(W*J),he=l(K*ne),ie=l(W*ne),Ee=l(J*K);return new E(ae,he,Ee,ie)}add(P){m(P);const{a:I,d:B}=e,{ex:$,ey:R,ez:D,et:L}=this,{ex:U,ey:z,ez:W,et:K}=P;if(I===BigInt(-1)){const ft=l((R-$)*(z+U)),Wt=l((R+$)*(z-U)),lr=l(Wt-ft);if(lr===bo)return this.double();const dr=l(D*i3*K),hr=l(L*i3*W),Er=hr+dr,be=Wt+ft,Te=hr-dr,Me=l(Er*lr),st=l(be*Te),Cr=l(Er*Te),hn=l(lr*be);return new E(Me,st,hn,Cr)}const J=l($*U),ne=l(R*z),ae=l(L*B*K),he=l(D*W),ie=l(($+R)*(U+z)-J-ne),Ee=he-ae,pe=he+ae,ve=l(ne-I*J),je=l(ie*Ee),rt=l(pe*ve),Ce=l(ie*ve),fe=l(Ee*pe);return new E(je,rt,fe,Ce)}subtract(P){return this.add(P.negate())}wNAF(P){return y.wNAFCached(this,P,E.normalizeZ)}multiply(P){const I=P;D1("scalar",I,Bi,n);const{p:B,f:$}=this.wNAF(I);return E.normalizeZ([B,$])[0]}multiplyUnsafe(P,I=E.ZERO){const B=P;return D1("scalar",B,bo,n),B===bo?C:this.is0()||B===Bi?this:y.wNAFCachedUnsafe(this,B,E.normalizeZ,I)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return y.unsafeLadder(this,n).is0()}toAffine(P){return b(this,P)}clearCofactor(){const{h:P}=e;return P===Bi?this:this.multiplyUnsafe(P)}static fromHex(P,I=!1){const{d:B,a:$}=e,R=r.BYTES;P=vc("pointHex",P,R),v8("zip215",I);const D=P.slice(),L=P[R-1];D[R-1]=L&-129;const U=K4(D),z=I?u:r.ORDER;D1("pointHex.y",U,bo,z);const W=l(U*U),K=l(W-Bi),J=l(B*W-$);let{isValid:ne,value:ae}=h(K,J);if(!ne)throw new Error("Point.fromHex: invalid y coordinate");const he=(ae&Bi)===Bi,ie=(L&128)!==0;if(!I&&ae===bo&&ie)throw new Error("Point.fromHex: x=0 and x_0=1");return ie!==he&&(ae=l(-ae)),E.fromAffine({x:ae,y:U})}static fromPrivateKey(P){return A(P).point}toRawBytes(){const{x:P,y:I}=this.toAffine(),B=oI(I,r.BYTES);return B[B.length-1]|=P&Bi?128:0,B}toHex(){return D9(this.toRawBytes())}}E.BASE=new E(e.Gx,e.Gy,Bi,l(e.Gx*e.Gy)),E.ZERO=new E(bo,Bi,Bi,bo);const{BASE:w,ZERO:C}=E,y=kae(E,a*8);function _(S){return mn(S,n)}function x(S){return _(K4(S))}function A(S){const P=r.BYTES;S=vc("private key",S,P);const I=vc("hashed private key",s(S),2*P),B=f(I.slice(0,P)),$=I.slice(P,2*P),R=x(B),D=w.multiply(R),L=D.toRawBytes();return{head:B,prefix:$,scalar:R,point:D,pointBytes:L}}function T(S){return A(S).pointBytes}function O(S=new Uint8Array,...P){const I=Rk(...P);return x(s(g(I,vc("context",S),!!i)))}function k(S,P,I={}){S=vc("message",S),i&&(S=i(S));const{prefix:B,scalar:$,pointBytes:R}=A(P),D=O(I.context,B,S),L=w.multiply(D).toRawBytes(),U=O(I.context,L,R,S),z=_(D+U*$);D1("signature.s",z,bo,n);const W=Rk(L,oI(z,r.BYTES));return vc("result",W,r.BYTES*2)}const j=Bae;function N(S,P,I,B=j){const{context:$,zip215:R}=B,D=r.BYTES;S=vc("signature",S,2*D),P=vc("message",P),I=vc("publicKey",I,D),R!==void 0&&v8("zip215",R),i&&(P=i(P));const L=K4(S.slice(D,2*D));let U,z,W;try{U=E.fromHex(I,R),z=E.fromHex(S.slice(0,D),R),W=w.multiplyUnsafe(L)}catch{return!1}if(!R&&U.isSmallOrder())return!1;const K=O($,z.toRawBytes(),U.toRawBytes(),P);return z.add(U.multiplyUnsafe(K)).subtract(W).clearCofactor().equals(E.ZERO)}return w._setWindowSize(8),{CURVE:e,getPublicKey:T,sign:k,verify:N,ExtendedPoint:E,utils:{getExtendedPublicKey:A,randomPrivateKey:()=>o(r.BYTES),precompute(S=8,P=E.BASE){return P._setWindowSize(S),P.multiply(BigInt(3)),P}}}}BigInt(0),BigInt(1);const L9=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),Dk=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const Lae=BigInt(1),Mk=BigInt(2);BigInt(3);const Uae=BigInt(5),Fae=BigInt(8);function Hae(t){const e=BigInt(10),r=BigInt(20),n=BigInt(40),i=BigInt(80),s=L9,o=t*t%s*t%s,a=ma(o,Mk,s)*o%s,c=ma(a,Lae,s)*t%s,u=ma(c,Uae,s)*c%s,l=ma(u,e,s)*u%s,d=ma(l,r,s)*l%s,h=ma(d,n,s)*d%s,f=ma(h,i,s)*h%s,g=ma(f,i,s)*h%s,p=ma(g,e,s)*u%s;return{pow_p_5_8:ma(p,Mk,s)*t%s,b2:o}}function qae(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}function zae(t,e){const r=L9,n=mn(e*e*e,r),i=mn(n*n*e,r),s=Hae(t*i).pow_p_5_8;let o=mn(t*n*s,r);const a=mn(e*o*o,r),c=o,u=mn(o*Dk,r),l=a===t,d=a===mn(-t,r),h=a===mn(-t*Dk,r);return l&&(o=c),(d||h)&&(o=u),xae(o,r)&&(o=mn(-o,r)),{isValid:l||d,value:o}}const Wae=eG(L9,void 0,!0),Vae={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Wae,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:Fae,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:fae,randomBytes:GV,adjustScalarBytes:qae,uvRatio:zae},nG=Mae(Vae),Gae="EdDSA",Kae="JWT",EC=".",H6="base64url",iG="utf8",sG="utf8",Zae=":",Yae="did",Jae="key",Lk="base58btc",Qae="z",Xae="K36",ece=32;function U9(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function oG(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?U9(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function aG(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));const r=oG(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return U9(r)}function tce(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,w=new Uint8Array(E);b!==v;){for(var C=g[b],y=0,_=E-1;(C!==0||y>>0,w[_]=C%a>>>0,C=C/a>>>0;if(C!==0)throw new Error("Non-zero carry");m=y,b++}for(var x=E-m;x!==E&&w[x]===0;)x++;for(var A=c.repeat(p);x>>0,E=new Uint8Array(v);g[p];){var w=r[g.charCodeAt(p)];if(w===255)return;for(var C=0,y=v-1;(w!==0||C>>0,E[y]=w%256>>>0,w=w/256>>>0;if(w!==0)throw new Error("Non-zero carry");b=C,p++}if(g[p]!==" "){for(var _=v-b;_!==v&&E[_]===0;)_++;for(var x=new Uint8Array(m+(v-_)),A=m;_!==v;)x[A++]=E[_++];return x}}}function f(g){var p=h(g);if(p)return p;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:h,decode:f}}var rce=tce,nce=rce;const cG=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},ice=t=>new TextEncoder().encode(t),sce=t=>new TextDecoder().decode(t);let oce=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},ace=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return uG(this,e)}},cce=class{constructor(e){this.decoders=e}or(e){return uG(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};const uG=(t,e)=>new cce({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});let uce=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new oce(e,r,n),this.decoder=new ace(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};const q6=({name:t,prefix:e,encode:r,decode:n})=>new uce(t,e,r,n),Pv=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=nce(r,e);return q6({prefix:t,name:e,encode:n,decode:s=>cG(i(s))})},lce=(t,e,r,n)=>{const i={};for(let l=0;l=8&&(a-=8,o[u++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o},dce=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<q6({prefix:e,name:t,encode(i){return dce(i,n,r)},decode(i){return lce(i,n,r,t)}}),hce=q6({prefix:"\0",name:"identity",encode:t=>sce(t),decode:t=>ice(t)});var fce=Object.freeze({__proto__:null,identity:hce});const pce=qn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var gce=Object.freeze({__proto__:null,base2:pce});const mce=qn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var wce=Object.freeze({__proto__:null,base8:mce});const bce=Pv({prefix:"9",name:"base10",alphabet:"0123456789"});var yce=Object.freeze({__proto__:null,base10:bce});const vce=qn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),_ce=qn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Ece=Object.freeze({__proto__:null,base16:vce,base16upper:_ce});const Cce=qn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Ace=qn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),xce=qn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Sce=qn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Tce=qn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Ice=qn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Pce=qn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Oce=qn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Rce=qn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var kce=Object.freeze({__proto__:null,base32:Cce,base32upper:Ace,base32pad:xce,base32padupper:Sce,base32hex:Tce,base32hexupper:Ice,base32hexpad:Pce,base32hexpadupper:Oce,base32z:Rce});const Nce=Pv({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),$ce=Pv({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var jce=Object.freeze({__proto__:null,base36:Nce,base36upper:$ce});const Bce=Pv({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Dce=Pv({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Mce=Object.freeze({__proto__:null,base58btc:Bce,base58flickr:Dce});const Lce=qn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Uce=qn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Fce=qn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Hce=qn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var qce=Object.freeze({__proto__:null,base64:Lce,base64pad:Uce,base64url:Fce,base64urlpad:Hce});const lG=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),zce=lG.reduce((t,e,r)=>(t[r]=e,t),[]),Wce=lG.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Vce(t){return t.reduce((e,r)=>(e+=zce[r],e),"")}function Gce(t){const e=[];for(const r of t){const n=Wce[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const Kce=q6({prefix:"🚀",name:"base256emoji",encode:Vce,decode:Gce});var Zce=Object.freeze({__proto__:null,base256emoji:Kce}),Yce=dG,Uk=128,Jce=-128,Qce=Math.pow(2,31);function dG(t,e,r){e=e||[],r=r||0;for(var n=r;t>=Qce;)e[r++]=t&255|Uk,t/=128;for(;t&Jce;)e[r++]=t&255|Uk,t>>>=7;return e[r]=t|0,dG.bytes=r-n+1,e}var Xce=cI,eue=128,Fk=127;function cI(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw cI.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&Fk)<=eue);return cI.bytes=s-n,r}var tue=Math.pow(2,7),rue=Math.pow(2,14),nue=Math.pow(2,21),iue=Math.pow(2,28),sue=Math.pow(2,35),oue=Math.pow(2,42),aue=Math.pow(2,49),cue=Math.pow(2,56),uue=Math.pow(2,63),lue=function(t){return t(hG.encode(t,e,r),e),qk=t=>hG.encodingLength(t),uI=(t,e)=>{const r=e.byteLength,n=qk(t),i=n+qk(r),s=new Uint8Array(i+r);return Hk(t,s,0),Hk(r,s,n),s.set(e,i),new hue(t,r,e,s)};let hue=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}};const fG=({name:t,code:e,encode:r})=>new fue(t,e,r);let fue=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?uI(this.code,r):r.then(n=>uI(this.code,n))}else throw Error("Unknown type, must be binary type")}};const pG=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),pue=fG({name:"sha2-256",code:18,encode:pG("SHA-256")}),gue=fG({name:"sha2-512",code:19,encode:pG("SHA-512")});var mue=Object.freeze({__proto__:null,sha256:pue,sha512:gue});const gG=0,wue="identity",mG=cG,bue=t=>uI(gG,mG(t)),yue={code:gG,name:wue,encode:mG,digest:bue};var vue=Object.freeze({__proto__:null,identity:yue});new TextEncoder,new TextDecoder;const zk={...fce,...gce,...wce,...yce,...Ece,...kce,...jce,...Mce,...qce,...Zce};({...mue,...vue});function wG(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const Wk=wG("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),S8=wG("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=oG(t.length);for(let r=0;r"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Oue:typeof navigator<"u"?Bue(navigator.userAgent):Mue()}function jue(t){return t!==""&&Nue.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function Bue(t){var e=jue(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new Pue;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length-1){const v=m.getAttribute("href");if(v)if(v.toLowerCase().indexOf("https:")===-1&&v.toLowerCase().indexOf("http:")===-1&&v.indexOf("//")!==0){let E=n.protocol+"//"+n.host;if(v.indexOf("/")===0)E+=v;else{const w=n.pathname.split("/");w.pop();const C=w.join("/");E+=C+"/"+v}g.push(E)}else if(v.indexOf("//")===0){const E=n.protocol+v;g.push(E)}else g.push(v)}}return g}function s(...f){const g=r.getElementsByTagName("meta");for(let p=0;pm.getAttribute(v)).filter(v=>v?f.includes(v):!1);if(b.length&&b){const v=m.getAttribute("content");if(v)return v}}return""}function o(){let f=s("name","og:site_name","og:title","twitter:title");return f||(f=r.title),f}function a(){return s("description","og:description","twitter:description","keywords")}const c=o(),u=a(),l=n.origin,d=i();return{description:u,url:l,icons:d,name:c}}return M1.getWindowMetadata=e,M1}var Fue=Uue();function Xb(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function Xk(t){return Xb(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}const _G="2.23.2";let L1={getDocsUrl:({docsBaseUrl:t,docsPath:e="",docsSlug:r})=>e?`${t??"https://viem.sh"}${e}${r?`#${r}`:""}`:void 0,version:`viem@${_G}`};class Bf extends Error{constructor(e,r={}){var a;const n=(()=>{var c;return r.cause instanceof Bf?r.cause.details:(c=r.cause)!=null&&c.message?r.cause.message:r.details})(),i=r.cause instanceof Bf&&r.cause.docsPath||r.docsPath,s=(a=L1.getDocsUrl)==null?void 0:a.call(L1,{...r,docsPath:i}),o=[e||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...n?[`Details: ${n}`]:[],...L1.version?[`Version: ${L1.version}`]:[]].join(` `);super(o,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=i,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=e,this.version=_G}walk(e){return EG(this,e)}}function EG(t,e){return e!=null&&e(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?EG(t.cause,e):e?null:t}class CG extends Bf{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${r}).`,{name:"SizeExceedsPaddingSizeError"})}}function t1(t,{dir:e,size:r=32}={}){return typeof t=="string"?Hue(t,{dir:e,size:r}):que(t,{dir:e,size:r})}function Hue(t,{dir:e,size:r=32}={}){if(r===null)return t;const n=t.replace("0x","");if(n.length>r*2)throw new CG({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n[e==="right"?"padEnd":"padStart"](r*2,"0")}`}function que(t,{dir:e,size:r=32}={}){if(r===null)return t;if(t.length>r)throw new CG({size:t.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let i=0;ie)throw new Wue({givenSize:Xk(t),maxSize:e})}function dI(t,e={}){const{signed:r}=e;e.size&&r1(t,{size:e.size});const n=BigInt(t);if(!r)return n;const i=(t.length-2)/2,s=(1n<e.toString(16).padStart(2,"0"));function hI(t,e={}){return typeof t=="number"||typeof t=="bigint"?xG(t,e):typeof t=="string"?Yue(t,e):typeof t=="boolean"?Kue(t,e):AG(t,e)}function Kue(t,e={}){const r=`0x${Number(t)}`;return typeof e.size=="number"?(r1(r,{size:e.size}),t1(r,{size:e.size})):r}function AG(t,e={}){let r="";for(let i=0;is||i=_c.zero&&t<=_c.nine)return t-_c.zero;if(t>=_c.A&&t<=_c.F)return t-(_c.A-10);if(t>=_c.a&&t<=_c.f)return t-(_c.a-10)}function SG(t,e={}){let r=t;e.size&&(r1(r,{size:e.size}),r=t1(r,{dir:"right",size:e.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const i=n.length/2,s=new Uint8Array(i);for(let o=0,a=0;o0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function rle(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");AC(t.outputLen),AC(t.blockLen)}function am(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function IG(t,e){Ov(t);const r=e.outputLen;if(t.length>tN&s3)}:{h:Number(t>>tN&s3)|0,l:Number(t&s3)|0}}function ile(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;it<>>32-r,ole=(t,e,r)=>e<>>32-r,ale=(t,e,r)=>e<>>64-r,cle=(t,e,r)=>t<>>64-r,Kp=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function ule(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function T8(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function wa(t,e){return t<<32-e|t>>>e}const rN=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function lle(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function nN(t){for(let e=0;et().update(W6(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function fle(t=32){if(Kp&&typeof Kp.getRandomValues=="function")return Kp.getRandomValues(new Uint8Array(t));if(Kp&&typeof Kp.randomBytes=="function")return Kp.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}const OG=[],RG=[],kG=[],ple=BigInt(0),U1=BigInt(1),gle=BigInt(2),mle=BigInt(7),wle=BigInt(256),ble=BigInt(113);for(let t=0,e=U1,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],OG.push(2*(5*n+r)),RG.push((t+1)*(t+2)/2%64);let i=ple;for(let s=0;s<7;s++)e=(e<>mle)*ble)%wle,e&gle&&(i^=U1<<(U1<r>32?ale(t,e,r):sle(t,e,r),sN=(t,e,r)=>r>32?cle(t,e,r):ole(t,e,r);function _le(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,u=r[c],l=r[c+1],d=iN(u,l,1)^r[a],h=sN(u,l,1)^r[a+1];for(let f=0;f<50;f+=10)t[o+f]^=d,t[o+f+1]^=h}let i=t[2],s=t[3];for(let o=0;o<24;o++){const a=RG[o],c=iN(i,s,a),u=sN(i,s,a),l=OG[o];i=t[l],s=t[l+1],t[l]=c,t[l+1]=u}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)r[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~r[(a+2)%10]&r[(a+4)%10]}t[0]^=yle[n],t[1]^=vle[n]}r.fill(0)}let Ele=class NG extends F9{constructor(e,r,n,i=!1,s=24){if(super(),this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,AC(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=ule(this.state)}keccak(){rN||nN(this.state32),_le(this.state32,this.rounds),rN||nN(this.state32),this.posOut=0,this.pos=0}update(e){am(this);const{blockLen:r,state:n}=this;e=W6(e);const i=e.length;for(let s=0;s=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);e.set(r.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return AC(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(IG(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return e||(e=new NG(r,n,i,o,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=n,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}};const Cle=(t,e,r)=>PG(()=>new Ele(e,t,r)),Ale=Cle(1,136,256/8);function $G(t,e){const r=e||"hex",n=Ale(Xb(t,{strict:!1})?Que(t):t);return r==="bytes"?n:hI(n)}class xle extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const r=super.get(e);return super.has(e)&&r!==void 0&&(this.delete(e),super.set(e,r)),r}set(e,r){if(super.set(e,r),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}const I8=new xle(8192);function Sle(t,e){if(I8.has(`${t}.${e}`))return I8.get(`${t}.${e}`);const r=t.substring(2).toLowerCase(),n=$G(TG(r),"bytes"),i=r.split("");for(let o=0;o<40;o+=2)n[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(n[o>>1]&15)>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const s=`0x${i.join("")}`;return I8.set(`${t}.${e}`,s),s}function Tle(t){const e=$G(`0x${t.substring(4)}`).substring(26);return Sle(`0x${e}`)}async function Ile({hash:t,signature:e}){const r=Xb(t)?t:hI(t),{secp256k1:n}=await ke(async()=>{const{secp256k1:o}=await Promise.resolve().then(()=>wde);return{secp256k1:o}},void 0);return`0x${(()=>{if(typeof e=="object"&&"r"in e&&"s"in e){const{r:u,s:l,v:d,yParity:h}=e,f=Number(h??d),g=oN(f);return new n.Signature(dI(u),dI(l)).addRecoveryBit(g)}const o=Xb(e)?e:hI(e),a=Vue(`0x${o.slice(130)}`),c=oN(a);return n.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(c)})().recoverPublicKey(r.substring(2)).toHex(!1)}`}function oN(t){if(t===0||t===1)return t;if(t===27)return 0;if(t===28)return 1;throw new Error("Invalid yParityOrV value")}async function Ple({hash:t,signature:e}){return Tle(await Ile({hash:t,signature:e}))}function Ole(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),c=n?4:0,u=n?0:4;t.setUint32(e+c,o,n),t.setUint32(e+u,a,n)}function Rle(t,e,r){return t&e^~t&r}function kle(t,e,r){return t&e^t&r^e&r}class Nle extends F9{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=T8(this.buffer)}update(e){am(this);const{view:r,buffer:n,blockLen:i}=this;e=W6(e);const s=e.length;for(let o=0;oi-o&&(this.process(n,0),o=0);for(let d=o;dl.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d>>3,p=wa(f,17)^wa(f,19)^f>>>10;wl[d]=p+wl[d-7]+g+wl[d-16]|0}let{A:n,B:i,C:s,D:o,E:a,F:c,G:u,H:l}=this;for(let d=0;d<64;d++){const h=wa(a,6)^wa(a,11)^wa(a,25),f=l+h+Rle(a,c,u)+$le[d]+wl[d]|0,p=(wa(n,2)^wa(n,13)^wa(n,22))+kle(n,i,s)|0;l=u,u=c,c=a,a=o+f|0,o=s,s=i,i=n,n=f+p|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(n,i,s,o,a,c,u,l)}roundClean(){wl.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const Ble=PG(()=>new jle);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const V6=BigInt(0),G6=BigInt(1),Dle=BigInt(2);function Df(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function Rv(t){if(!Df(t))throw new Error("Uint8Array expected")}function cm(t,e){if(typeof e!="boolean")throw new Error(t+" boolean expected, got "+e)}const Mle=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function um(t){Rv(t);let e="";for(let r=0;r=Ec._0&&t<=Ec._9)return t-Ec._0;if(t>=Ec.A&&t<=Ec.F)return t-(Ec.A-10);if(t>=Ec.a&&t<=Ec.f)return t-(Ec.a-10)}function lm(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length,r=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let i=0,s=0;itypeof t=="bigint"&&V6<=t;function K6(t,e,r){return P8(t)&&P8(e)&&P8(r)&&e<=t&&tV6;t>>=G6,e+=1);return e}function Hle(t,e){return t>>BigInt(e)&G6}function qle(t,e,r){return t|(r?G6:V6)<(Dle<new Uint8Array(t),cN=t=>Uint8Array.from(t);function BG(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=O8(t),i=O8(t),s=0;const o=()=>{n.fill(1),i.fill(0),s=0},a=(...d)=>r(i,n,...d),c=(d=O8())=>{i=a(cN([0]),d),n=a(),d.length!==0&&(i=a(cN([1]),d),n=a())},u=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let d=0;const h=[];for(;d{o(),c(d);let f;for(;!(f=h(u()));)c();return o(),f}}const zle={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||Df(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function kv(t,e,r={}){const n=(i,s,o)=>{const a=zle[s];if(typeof a!="function")throw new Error("invalid validator function");const c=t[i];if(!(o&&c===void 0)&&!a(c,t))throw new Error("param "+String(i)+" is invalid. Expected "+s+", got "+c)};for(const[i,s]of Object.entries(e))n(i,s,!1);for(const[i,s]of Object.entries(r))n(i,s,!0);return t}const Wle=()=>{throw new Error("not implemented")};function fI(t){const e=new WeakMap;return(r,...n)=>{const i=e.get(r);if(i!==void 0)return i;const s=t(r,...n);return e.set(r,s),s}}const Vle=Object.freeze(Object.defineProperty({__proto__:null,aInRange:Tf,abool:cm,abytes:Rv,bitGet:Hle,bitLen:jG,bitMask:W9,bitSet:qle,bytesToHex:um,bytesToNumberBE:Sf,bytesToNumberLE:q9,concatBytes:ey,createHmacDrbg:BG,ensureBytes:Oo,equalBytes:Ule,hexToBytes:lm,hexToNumber:H9,inRange:K6,isBytes:Df,memoized:fI,notImplemented:Wle,numberToBytesBE:dm,numberToBytesLE:z9,numberToHexUnpadded:z0,numberToVarBytesBE:Lle,utf8ToBytes:Fle,validateObject:kv},Symbol.toStringTag,{value:"Module"}));let DG=class extends F9{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,rle(e);const n=W6(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(n.length>i?e.create().update(n).digest():n);for(let o=0;onew DG(t,e).update(r).digest();MG.create=(t,e)=>new DG(t,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Tn=BigInt(0),Zr=BigInt(1),Lh=BigInt(2),Gle=BigInt(3),pI=BigInt(4),uN=BigInt(5),lN=BigInt(8);function zi(t,e){const r=t%e;return r>=Tn?r:e+r}function Kle(t,e,r){if(eTn;)e&Zr&&(n=n*t%r),t=t*t%r,e>>=Zr;return n}function Fs(t,e,r){let n=t;for(;e-- >Tn;)n*=n,n%=r;return n}function gI(t,e){if(t===Tn)throw new Error("invert: expected non-zero number");if(e<=Tn)throw new Error("invert: expected positive modulus, got "+e);let r=zi(t,e),n=e,i=Tn,s=Zr;for(;r!==Tn;){const a=n/r,c=n%r,u=i-s*a;n=r,r=c,i=s,s=u}if(n!==Zr)throw new Error("invert: does not exist");return zi(i,e)}function Zle(t){const e=(t-Zr)/Lh;let r,n,i;for(r=t-Zr,n=0;r%Lh===Tn;r/=Lh,n++);for(i=Lh;i1e3)throw new Error("Cannot find square root: likely non-prime P");if(n===1){const o=(t+Zr)/pI;return function(c,u){const l=c.pow(u,o);if(!c.eql(c.sqr(l),u))throw new Error("Cannot find square root");return l}}const s=(r+Zr)/Lh;return function(a,c){if(a.pow(c,e)===a.neg(a.ONE))throw new Error("Cannot find square root");let u=n,l=a.pow(a.mul(a.ONE,i),r),d=a.pow(c,s),h=a.pow(c,r);for(;!a.eql(h,a.ONE);){if(a.eql(h,a.ZERO))return a.ZERO;let f=1;for(let p=a.sqr(h);f(n[i]="function",n),e);return kv(t,r)}function Xle(t,e,r){if(rTn;)r&Zr&&(n=t.mul(n,i)),i=t.sqr(i),r>>=Zr;return n}function ede(t,e){const r=new Array(e.length),n=e.reduce((s,o,a)=>t.is0(o)?s:(r[a]=s,t.mul(s,o)),t.ONE),i=t.inv(n);return e.reduceRight((s,o,a)=>t.is0(o)?s:(r[a]=t.mul(s,r[a]),t.mul(s,o)),i),r}function LG(t,e){const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function UG(t,e,r=!1,n={}){if(t<=Tn)throw new Error("invalid field: expected ORDER > 0, got "+t);const{nBitLength:i,nByteLength:s}=LG(t,e);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const a=Object.freeze({ORDER:t,isLE:r,BITS:i,BYTES:s,MASK:W9(i),ZERO:Tn,ONE:Zr,create:c=>zi(c,t),isValid:c=>{if(typeof c!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof c);return Tn<=c&&cc===Tn,isOdd:c=>(c&Zr)===Zr,neg:c=>zi(-c,t),eql:(c,u)=>c===u,sqr:c=>zi(c*c,t),add:(c,u)=>zi(c+u,t),sub:(c,u)=>zi(c-u,t),mul:(c,u)=>zi(c*u,t),pow:(c,u)=>Xle(a,c,u),div:(c,u)=>zi(c*gI(u,t),t),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>gI(c,t),sqrt:n.sqrt||(c=>(o||(o=Yle(t)),o(a,c))),invertBatch:c=>ede(a,c),cmov:(c,u,l)=>l?u:c,toBytes:c=>r?z9(c,s):dm(c,s),fromBytes:c=>{if(c.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+c.length);return r?q9(c):Sf(c)}});return Object.freeze(a)}function FG(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function HG(t){const e=FG(t);return e+Math.ceil(e/2)}function tde(t,e,r=!1){const n=t.length,i=FG(e),s=HG(e);if(n<16||n1024)throw new Error("expected "+s+"-1024 bytes of input, got "+n);const o=r?q9(t):Sf(t),a=zi(o,e-Zr)+Zr;return r?z9(a,i):dm(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const dN=BigInt(0),o3=BigInt(1);function R8(t,e){const r=e.negate();return t?r:e}function qG(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function k8(t,e){qG(t,e);const r=Math.ceil(e/t)+1,n=2**(t-1);return{windows:r,windowSize:n}}function rde(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach((r,n)=>{if(!(r instanceof e))throw new Error("invalid point at index "+n)})}function nde(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach((r,n)=>{if(!e.isValid(r))throw new Error("invalid scalar at index "+n)})}const N8=new WeakMap,zG=new WeakMap;function $8(t){return zG.get(t)||1}function ide(t,e){return{constTimeNegate:R8,hasPrecomputes(r){return $8(r)!==1},unsafeLadder(r,n,i=t.ZERO){let s=r;for(;n>dN;)n&o3&&(i=i.add(s)),s=s.double(),n>>=o3;return i},precomputeWindow(r,n){const{windows:i,windowSize:s}=k8(n,e),o=[];let a=r,c=a;for(let u=0;u>=d,g>o&&(g-=l,i+=o3);const p=f,m=f+Math.abs(g)-1,b=h%2!==0,v=g<0;g===0?c=c.add(R8(b,n[p])):a=a.add(R8(v,n[m]))}return{p:a,f:c}},wNAFUnsafe(r,n,i,s=t.ZERO){const{windows:o,windowSize:a}=k8(r,e),c=BigInt(2**r-1),u=2**r,l=BigInt(r);for(let d=0;d>=l,f>a&&(f-=u,i+=o3),f===0)continue;let g=n[h+Math.abs(f)-1];f<0&&(g=g.negate()),s=s.add(g)}return s},getPrecomputes(r,n,i){let s=N8.get(n);return s||(s=this.precomputeWindow(n,r),r!==1&&N8.set(n,i(s))),s},wNAFCached(r,n,i){const s=$8(r);return this.wNAF(s,this.getPrecomputes(s,r,i),n)},wNAFCachedUnsafe(r,n,i,s){const o=$8(r);return o===1?this.unsafeLadder(r,n,s):this.wNAFUnsafe(o,this.getPrecomputes(o,r,i),n,s)},setWindowSize(r,n){qG(n,e),zG.set(r,n),N8.delete(r)}}}function sde(t,e,r,n){if(rde(r,t),nde(n,e),r.length!==n.length)throw new Error("arrays of points and scalars must have equal length");const i=t.ZERO,s=jG(BigInt(r.length)),o=s>12?s-3:s>4?s-2:s?2:1,a=(1<=0;d-=o){c.fill(i);for(let f=0;f>BigInt(d)&BigInt(a));c[p]=c[p].add(r[f])}let h=i;for(let f=c.length-1,g=i;f>0;f--)g=g.add(c[f]),h=h.add(g);if(l=l.add(h),d!==0)for(let f=0;f{const{Err:r}=Jc;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length&1)throw new r("tlv.encode: unpadded data");const n=e.length/2,i=z0(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");const s=n>127?z0(i.length/2|128):"";return z0(t)+s+i+e},decode(t,e){const{Err:r}=Jc;let n=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");const i=e[n++],s=!!(i&128);let o=0;if(!s)o=i;else{const c=i&127;if(!c)throw new r("tlv.decode(long): indefinite length not supported");if(c>4)throw new r("tlv.decode(long): byte length is too big");const u=e.subarray(n,n+c);if(u.length!==c)throw new r("tlv.decode: length bytes not complete");if(u[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(const l of u)o=o<<8|l;if(n+=c,o<128)throw new r("tlv.decode(long): not minimal encoding")}const a=e.subarray(n,n+o);if(a.length!==o)throw new r("tlv.decode: wrong value length");return{v:a,l:e.subarray(n+o)}}},_int:{encode(t){const{Err:e}=Jc;if(t{const v=m.toAffine();return ey(Uint8Array.from([4]),r.toBytes(v.x),r.toBytes(v.y))}),s=e.fromBytes||(p=>{const m=p.subarray(1),b=r.fromBytes(m.subarray(0,r.BYTES)),v=r.fromBytes(m.subarray(r.BYTES,2*r.BYTES));return{x:b,y:v}});function o(p){const{a:m,b}=e,v=r.sqr(p),E=r.mul(v,p);return r.add(r.add(E,r.mul(p,m)),b)}if(!r.eql(r.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function a(p){return K6(p,_n,e.n)}function c(p){const{allowedPrivateKeyLengths:m,nByteLength:b,wrapPrivateKey:v,n:E}=e;if(m&&typeof p!="bigint"){if(Df(p)&&(p=um(p)),typeof p!="string"||!m.includes(p.length))throw new Error("invalid private key");p=p.padStart(b*2,"0")}let w;try{w=typeof p=="bigint"?p:Sf(Oo("private key",p,b))}catch{throw new Error("invalid private key, expected hex or "+b+" bytes, got "+typeof p)}return v&&(w=zi(w,E)),Tf("private key",w,_n,E),w}function u(p){if(!(p instanceof h))throw new Error("ProjectivePoint expected")}const l=fI((p,m)=>{const{px:b,py:v,pz:E}=p;if(r.eql(E,r.ONE))return{x:b,y:v};const w=p.is0();m==null&&(m=w?r.ONE:r.inv(E));const C=r.mul(b,m),y=r.mul(v,m),_=r.mul(E,m);if(w)return{x:r.ZERO,y:r.ZERO};if(!r.eql(_,r.ONE))throw new Error("invZ was invalid");return{x:C,y}}),d=fI(p=>{if(p.is0()){if(e.allowInfinityPoint&&!r.is0(p.py))return;throw new Error("bad point: ZERO")}const{x:m,y:b}=p.toAffine();if(!r.isValid(m)||!r.isValid(b))throw new Error("bad point: x or y not FE");const v=r.sqr(b),E=o(m);if(!r.eql(v,E))throw new Error("bad point: equation left != right");if(!p.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class h{constructor(m,b,v){if(this.px=m,this.py=b,this.pz=v,m==null||!r.isValid(m))throw new Error("x required");if(b==null||!r.isValid(b))throw new Error("y required");if(v==null||!r.isValid(v))throw new Error("z required");Object.freeze(this)}static fromAffine(m){const{x:b,y:v}=m||{};if(!m||!r.isValid(b)||!r.isValid(v))throw new Error("invalid affine point");if(m instanceof h)throw new Error("projective point not allowed");const E=w=>r.eql(w,r.ZERO);return E(b)&&E(v)?h.ZERO:new h(b,v,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(m){const b=r.invertBatch(m.map(v=>v.pz));return m.map((v,E)=>v.toAffine(b[E])).map(h.fromAffine)}static fromHex(m){const b=h.fromAffine(s(Oo("pointHex",m)));return b.assertValidity(),b}static fromPrivateKey(m){return h.BASE.multiply(c(m))}static msm(m,b){return sde(h,n,m,b)}_setWindowSize(m){g.setWindowSize(this,m)}assertValidity(){d(this)}hasEvenY(){const{y:m}=this.toAffine();if(r.isOdd)return!r.isOdd(m);throw new Error("Field doesn't support isOdd")}equals(m){u(m);const{px:b,py:v,pz:E}=this,{px:w,py:C,pz:y}=m,_=r.eql(r.mul(b,y),r.mul(w,E)),x=r.eql(r.mul(v,y),r.mul(C,E));return _&&x}negate(){return new h(this.px,r.neg(this.py),this.pz)}double(){const{a:m,b}=e,v=r.mul(b,fN),{px:E,py:w,pz:C}=this;let y=r.ZERO,_=r.ZERO,x=r.ZERO,A=r.mul(E,E),T=r.mul(w,w),O=r.mul(C,C),k=r.mul(E,w);return k=r.add(k,k),x=r.mul(E,C),x=r.add(x,x),y=r.mul(m,x),_=r.mul(v,O),_=r.add(y,_),y=r.sub(T,_),_=r.add(T,_),_=r.mul(y,_),y=r.mul(k,y),x=r.mul(v,x),O=r.mul(m,O),k=r.sub(A,O),k=r.mul(m,k),k=r.add(k,x),x=r.add(A,A),A=r.add(x,A),A=r.add(A,O),A=r.mul(A,k),_=r.add(_,A),O=r.mul(w,C),O=r.add(O,O),A=r.mul(O,k),y=r.sub(y,A),x=r.mul(O,T),x=r.add(x,x),x=r.add(x,x),new h(y,_,x)}add(m){u(m);const{px:b,py:v,pz:E}=this,{px:w,py:C,pz:y}=m;let _=r.ZERO,x=r.ZERO,A=r.ZERO;const T=e.a,O=r.mul(e.b,fN);let k=r.mul(b,w),j=r.mul(v,C),N=r.mul(E,y),S=r.add(b,v),P=r.add(w,C);S=r.mul(S,P),P=r.add(k,j),S=r.sub(S,P),P=r.add(b,E);let I=r.add(w,y);return P=r.mul(P,I),I=r.add(k,N),P=r.sub(P,I),I=r.add(v,E),_=r.add(C,y),I=r.mul(I,_),_=r.add(j,N),I=r.sub(I,_),A=r.mul(T,P),_=r.mul(O,N),A=r.add(_,A),_=r.sub(j,A),A=r.add(j,A),x=r.mul(_,A),j=r.add(k,k),j=r.add(j,k),N=r.mul(T,N),P=r.mul(O,P),j=r.add(j,N),N=r.sub(k,N),N=r.mul(T,N),P=r.add(P,N),k=r.mul(j,P),x=r.add(x,k),k=r.mul(I,P),_=r.mul(S,_),_=r.sub(_,k),k=r.mul(S,j),A=r.mul(I,A),A=r.add(A,k),new h(_,x,A)}subtract(m){return this.add(m.negate())}is0(){return this.equals(h.ZERO)}wNAF(m){return g.wNAFCached(this,m,h.normalizeZ)}multiplyUnsafe(m){const{endo:b,n:v}=e;Tf("scalar",m,pu,v);const E=h.ZERO;if(m===pu)return E;if(this.is0()||m===_n)return this;if(!b||g.hasPrecomputes(this))return g.wNAFCachedUnsafe(this,m,h.normalizeZ);let{k1neg:w,k1:C,k2neg:y,k2:_}=b.splitScalar(m),x=E,A=E,T=this;for(;C>pu||_>pu;)C&_n&&(x=x.add(T)),_&_n&&(A=A.add(T)),T=T.double(),C>>=_n,_>>=_n;return w&&(x=x.negate()),y&&(A=A.negate()),A=new h(r.mul(A.px,b.beta),A.py,A.pz),x.add(A)}multiply(m){const{endo:b,n:v}=e;Tf("scalar",m,_n,v);let E,w;if(b){const{k1neg:C,k1:y,k2neg:_,k2:x}=b.splitScalar(m);let{p:A,f:T}=this.wNAF(y),{p:O,f:k}=this.wNAF(x);A=g.constTimeNegate(C,A),O=g.constTimeNegate(_,O),O=new h(r.mul(O.px,b.beta),O.py,O.pz),E=A.add(O),w=T.add(k)}else{const{p:C,f:y}=this.wNAF(m);E=C,w=y}return h.normalizeZ([E,w])[0]}multiplyAndAddUnsafe(m,b,v){const E=h.BASE,w=(y,_)=>_===pu||_===_n||!y.equals(E)?y.multiplyUnsafe(_):y.multiply(_),C=w(this,b).add(w(m,v));return C.is0()?void 0:C}toAffine(m){return l(this,m)}isTorsionFree(){const{h:m,isTorsionFree:b}=e;if(m===_n)return!0;if(b)return b(h,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:m,clearCofactor:b}=e;return m===_n?this:b?b(h,this):this.multiplyUnsafe(e.h)}toRawBytes(m=!0){return cm("isCompressed",m),this.assertValidity(),i(h,this,m)}toHex(m=!0){return cm("isCompressed",m),um(this.toRawBytes(m))}}h.BASE=new h(e.Gx,e.Gy,r.ONE),h.ZERO=new h(r.ZERO,r.ONE,r.ZERO);const f=e.nBitLength,g=ide(h,e.endo?Math.ceil(f/2):f);return{CURVE:e,ProjectivePoint:h,normPrivateKeyToScalar:c,weierstrassEquation:o,isWithinCurveOrder:a}}function dde(t){const e=WG(t);return kv(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function hde(t){const e=dde(t),{Fp:r,n}=e,i=r.BYTES+1,s=2*r.BYTES+1;function o(N){return zi(N,n)}function a(N){return gI(N,n)}const{ProjectivePoint:c,normPrivateKeyToScalar:u,weierstrassEquation:l,isWithinCurveOrder:d}=lde({...e,toBytes(N,S,P){const I=S.toAffine(),B=r.toBytes(I.x),$=ey;return cm("isCompressed",P),P?$(Uint8Array.from([S.hasEvenY()?2:3]),B):$(Uint8Array.from([4]),B,r.toBytes(I.y))},fromBytes(N){const S=N.length,P=N[0],I=N.subarray(1);if(S===i&&(P===2||P===3)){const B=Sf(I);if(!K6(B,_n,r.ORDER))throw new Error("Point is not on curve");const $=l(B);let R;try{R=r.sqrt($)}catch(U){const z=U instanceof Error?": "+U.message:"";throw new Error("Point is not on curve"+z)}const D=(R&_n)===_n;return(P&1)===1!==D&&(R=r.neg(R)),{x:B,y:R}}else if(S===s&&P===4){const B=r.fromBytes(I.subarray(0,r.BYTES)),$=r.fromBytes(I.subarray(r.BYTES,2*r.BYTES));return{x:B,y:$}}else{const B=i,$=s;throw new Error("invalid Point, expected length of "+B+", or uncompressed "+$+", got "+S)}}}),h=N=>um(dm(N,e.nByteLength));function f(N){const S=n>>_n;return N>S}function g(N){return f(N)?o(-N):N}const p=(N,S,P)=>Sf(N.slice(S,P));class m{constructor(S,P,I){this.r=S,this.s=P,this.recovery=I,this.assertValidity()}static fromCompact(S){const P=e.nByteLength;return S=Oo("compactSignature",S,P*2),new m(p(S,0,P),p(S,P,2*P))}static fromDER(S){const{r:P,s:I}=Jc.toSig(Oo("DER",S));return new m(P,I)}assertValidity(){Tf("r",this.r,_n,n),Tf("s",this.s,_n,n)}addRecoveryBit(S){return new m(this.r,this.s,S)}recoverPublicKey(S){const{r:P,s:I,recovery:B}=this,$=y(Oo("msgHash",S));if(B==null||![0,1,2,3].includes(B))throw new Error("recovery id invalid");const R=B===2||B===3?P+e.n:P;if(R>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const D=(B&1)===0?"02":"03",L=c.fromHex(D+h(R)),U=a(R),z=o(-$*U),W=o(I*U),K=c.BASE.multiplyAndAddUnsafe(L,z,W);if(!K)throw new Error("point at infinify");return K.assertValidity(),K}hasHighS(){return f(this.s)}normalizeS(){return this.hasHighS()?new m(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return lm(this.toDERHex())}toDERHex(){return Jc.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return lm(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const b={isValidPrivateKey(N){try{return u(N),!0}catch{return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{const N=HG(e.n);return tde(e.randomBytes(N),e.n)},precompute(N=8,S=c.BASE){return S._setWindowSize(N),S.multiply(BigInt(3)),S}};function v(N,S=!0){return c.fromPrivateKey(N).toRawBytes(S)}function E(N){const S=Df(N),P=typeof N=="string",I=(S||P)&&N.length;return S?I===i||I===s:P?I===2*i||I===2*s:N instanceof c}function w(N,S,P=!0){if(E(N))throw new Error("first arg must be private key");if(!E(S))throw new Error("second arg must be public key");return c.fromHex(S).multiply(u(N)).toRawBytes(P)}const C=e.bits2int||function(N){if(N.length>8192)throw new Error("input is too large");const S=Sf(N),P=N.length*8-e.nBitLength;return P>0?S>>BigInt(P):S},y=e.bits2int_modN||function(N){return o(C(N))},_=W9(e.nBitLength);function x(N){return Tf("num < 2^"+e.nBitLength,N,pu,_),dm(N,e.nByteLength)}function A(N,S,P=T){if(["recovered","canonical"].some(ne=>ne in P))throw new Error("sign() legacy options not supported");const{hash:I,randomBytes:B}=e;let{lowS:$,prehash:R,extraEntropy:D}=P;$==null&&($=!0),N=Oo("msgHash",N),hN(P),R&&(N=Oo("prehashed msgHash",I(N)));const L=y(N),U=u(S),z=[x(U),x(L)];if(D!=null&&D!==!1){const ne=D===!0?B(r.BYTES):D;z.push(Oo("extraEntropy",ne))}const W=ey(...z),K=L;function J(ne){const ae=C(ne);if(!d(ae))return;const he=a(ae),ie=c.BASE.multiply(ae).toAffine(),Ee=o(ie.x);if(Ee===pu)return;const pe=o(he*o(K+Ee*U));if(pe===pu)return;let ve=(ie.x===Ee?0:2)|Number(ie.y&_n),je=pe;return $&&f(pe)&&(je=g(pe),ve^=1),new m(Ee,je,ve)}return{seed:W,k2sig:J}}const T={lowS:e.lowS,prehash:!1},O={lowS:e.lowS,prehash:!1};function k(N,S,P=T){const{seed:I,k2sig:B}=A(N,S,P),$=e;return BG($.hash.outputLen,$.nByteLength,$.hmac)(I,B)}c.BASE._setWindowSize(8);function j(N,S,P,I=O){var ve;const B=N;S=Oo("msgHash",S),P=Oo("publicKey",P);const{lowS:$,prehash:R,format:D}=I;if(hN(I),"strict"in I)throw new Error("options.strict was renamed to lowS");if(D!==void 0&&D!=="compact"&&D!=="der")throw new Error("format must be compact or der");const L=typeof B=="string"||Df(B),U=!L&&!D&&typeof B=="object"&&B!==null&&typeof B.r=="bigint"&&typeof B.s=="bigint";if(!L&&!U)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let z,W;try{if(U&&(z=new m(B.r,B.s)),L){try{D!=="compact"&&(z=m.fromDER(B))}catch(je){if(!(je instanceof Jc.Err))throw je}!z&&D!=="der"&&(z=m.fromCompact(B))}W=c.fromHex(P)}catch{return!1}if(!z||$&&z.hasHighS())return!1;R&&(S=e.hash(S));const{r:K,s:J}=z,ne=y(S),ae=a(J),he=o(ne*ae),ie=o(K*ae),Ee=(ve=c.BASE.multiplyAndAddUnsafe(W,he,ie))==null?void 0:ve.toAffine();return Ee?o(Ee.x)===K:!1}return{CURVE:e,getPublicKey:v,getSharedSecret:w,sign:k,verify:j,ProjectivePoint:c,Signature:m,utils:b}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function fde(t){return{hash:t,hmac:(e,...r)=>MG(t,e,hle(...r)),randomBytes:fle}}function pde(t,e){const r=n=>hde({...t,...fde(n)});return{...r(e),create:r}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const VG=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),pN=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),gde=BigInt(1),mI=BigInt(2),gN=(t,e)=>(t+e/mI)/e;function mde(t){const e=VG,r=BigInt(3),n=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),c=BigInt(88),u=t*t*t%e,l=u*u*t%e,d=Fs(l,r,e)*l%e,h=Fs(d,r,e)*l%e,f=Fs(h,mI,e)*u%e,g=Fs(f,i,e)*f%e,p=Fs(g,s,e)*g%e,m=Fs(p,a,e)*p%e,b=Fs(m,c,e)*m%e,v=Fs(b,a,e)*p%e,E=Fs(v,r,e)*l%e,w=Fs(E,o,e)*g%e,C=Fs(w,n,e)*u%e,y=Fs(C,mI,e);if(!wI.eql(wI.sqr(y),t))throw new Error("Cannot find square root");return y}const wI=UG(VG,void 0,void 0,{sqrt:mde}),GG=pde({a:BigInt(0),b:BigInt(7),Fp:wI,n:pN,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=pN,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-gde*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,o=BigInt("0x100000000000000000000000000000000"),a=gN(s*t,e),c=gN(-n*t,e);let u=zi(t-a*r-c*i,e),l=zi(-a*n-c*s,e);const d=u>o,h=l>o;if(d&&(u=e-u),h&&(l=e-l),u>o||l>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:d,k1:u,k2neg:h,k2:l}}}},Ble);BigInt(0);GG.ProjectivePoint;const wde=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:GG},Symbol.toStringTag,{value:"Module"}));function bde(t){if(t.length>=255)throw new TypeError("Alphabet too long");const e=new Uint8Array(256);for(let u=0;u>>0,p=new Uint8Array(g);for(;h!==f;){let v=u[h],E=0;for(let w=g-1;(v!==0||E>>0,p[w]=v%r>>>0,v=v/r>>>0;if(v!==0)throw new Error("Non-zero carry");d=E,h++}let m=g-d;for(;m!==g&&p[m]===0;)m++;let b=n.repeat(l);for(;m>>0,g=new Uint8Array(f);for(;l255)return;let E=e[v];if(E===255)return;let w=0;for(let C=f-1;(E!==0||w>>0,g[C]=E%256>>>0,E=E/256>>>0;if(E!==0)throw new Error("Non-zero carry");h=w,l++}let p=f-h;for(;p!==f&&g[p]===0;)p++;const m=new Uint8Array(d+(f-p));let b=d;for(;p!==f;)m[b++]=g[p++];return m}function c(u){const l=a(u);if(l)return l;throw new Error("Non-base"+r+" character")}return{encode:o,decodeUnsafe:a,decode:c}}var yde="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";const KG=bde(yde);function ZG(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function db(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));const r=ZG(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function vde(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,w=new Uint8Array(E);b!==v;){for(var C=g[b],y=0,_=E-1;(C!==0||y>>0,w[_]=C%a>>>0,C=C/a>>>0;if(C!==0)throw new Error("Non-zero carry");m=y,b++}for(var x=E-m;x!==E&&w[x]===0;)x++;for(var A=c.repeat(p);x>>0,E=new Uint8Array(v);g[p];){var w=r[g.charCodeAt(p)];if(w===255)return;for(var C=0,y=v-1;(w!==0||C>>0,E[y]=w%256>>>0,w=w/256>>>0;if(w!==0)throw new Error("Non-zero carry");b=C,p++}if(g[p]!==" "){for(var _=v-b;_!==v&&E[_]===0;)_++;for(var x=new Uint8Array(m+(v-_)),A=m;_!==v;)x[A++]=E[_++];return x}}}function f(g){var p=h(g);if(p)return p;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:h,decode:f}}var _de=vde,Ede=_de;const Cde=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},Ade=t=>new TextEncoder().encode(t),xde=t=>new TextDecoder().decode(t);class Sde{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class Tde{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return YG(this,e)}}class Ide{constructor(e){this.decoders=e}or(e){return YG(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const YG=(t,e)=>new Ide({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class Pde{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new Sde(e,r,n),this.decoder=new Tde(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Z6=({name:t,prefix:e,encode:r,decode:n})=>new Pde(t,e,r,n),Nv=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=Ede(r,e);return Z6({prefix:t,name:e,encode:n,decode:s=>Cde(i(s))})},Ode=(t,e,r,n)=>{const i={};for(let l=0;l=8&&(a-=8,o[u++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o},Rde=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<Z6({prefix:e,name:t,encode(i){return Rde(i,n,r)},decode(i){return Ode(i,n,r,t)}}),kde=Z6({prefix:"\0",name:"identity",encode:t=>xde(t),decode:t=>Ade(t)}),Nde=Object.freeze(Object.defineProperty({__proto__:null,identity:kde},Symbol.toStringTag,{value:"Module"})),$de=zn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),jde=Object.freeze(Object.defineProperty({__proto__:null,base2:$de},Symbol.toStringTag,{value:"Module"})),Bde=zn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),Dde=Object.freeze(Object.defineProperty({__proto__:null,base8:Bde},Symbol.toStringTag,{value:"Module"})),Mde=Nv({prefix:"9",name:"base10",alphabet:"0123456789"}),Lde=Object.freeze(Object.defineProperty({__proto__:null,base10:Mde},Symbol.toStringTag,{value:"Module"})),Ude=zn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Fde=zn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),Hde=Object.freeze(Object.defineProperty({__proto__:null,base16:Ude,base16upper:Fde},Symbol.toStringTag,{value:"Module"})),qde=zn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),zde=zn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Wde=zn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Vde=zn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Gde=zn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Kde=zn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Zde=zn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Yde=zn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Jde=zn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Qde=Object.freeze(Object.defineProperty({__proto__:null,base32:qde,base32hex:Gde,base32hexpad:Zde,base32hexpadupper:Yde,base32hexupper:Kde,base32pad:Wde,base32padupper:Vde,base32upper:zde,base32z:Jde},Symbol.toStringTag,{value:"Module"})),Xde=Nv({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),ehe=Nv({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),the=Object.freeze(Object.defineProperty({__proto__:null,base36:Xde,base36upper:ehe},Symbol.toStringTag,{value:"Module"})),rhe=Nv({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),nhe=Nv({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),ihe=Object.freeze(Object.defineProperty({__proto__:null,base58btc:rhe,base58flickr:nhe},Symbol.toStringTag,{value:"Module"})),she=zn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),ohe=zn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),ahe=zn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),che=zn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),uhe=Object.freeze(Object.defineProperty({__proto__:null,base64:she,base64pad:ohe,base64url:ahe,base64urlpad:che},Symbol.toStringTag,{value:"Module"})),JG=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),lhe=JG.reduce((t,e,r)=>(t[r]=e,t),[]),dhe=JG.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function hhe(t){return t.reduce((e,r)=>(e+=lhe[r],e),"")}function fhe(t){const e=[];for(const r of t){const n=dhe[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const phe=Z6({prefix:"🚀",name:"base256emoji",encode:hhe,decode:fhe}),ghe=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:phe},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const mN={...Nde,...jde,...Dde,...Lde,...Hde,...Qde,...the,...ihe,...uhe,...ghe};function QG(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const wN=QG("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),j8=QG("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=ZG(t.length);for(let r=0;re in t?yhe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,vN=(t,e)=>{for(var r in e||(e={}))Ehe.call(e,r)&&yN(t,r,e[r]);if(bN)for(var r of bN(e))Che.call(e,r)&&yN(t,r,e[r]);return t},Ahe=(t,e)=>vhe(t,_he(e));const xhe="ReactNative",Cs={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},She="js";function xC(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function jd(){return!Iu.getDocument()&&!!Iu.getNavigator()&&navigator.product===xhe}function The(){return jd()&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"&&(global==null?void 0:global.Platform.OS)==="android"}function Ihe(){return jd()&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"&&(global==null?void 0:global.Platform.OS)==="ios"}function n1(){return!xC()&&!!Iu.getNavigator()&&!!Iu.getDocument()}function $v(){return jd()?Cs.reactNative:xC()?Cs.node:n1()?Cs.browser:Cs.unknown}function _N(){var t;try{return jd()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function Phe(t,e){const r=new URLSearchParams(t);for(const n of Object.keys(e).sort())if(e.hasOwnProperty(n)){const i=e[n];i!==void 0&&r.set(n,i)}return r.toString()}function Ohe(t){var e,r;const n=tK();try{return t!=null&&t.url&&n.url&&new URL(t.url).host!==new URL(n.url).host&&(console.warn(`The configured WalletConnect 'metadata.url':${t.url} differs from the actual page url:${n.url}. This is probably unintended and can lead to issues.`),t.url=n.url),(e=t==null?void 0:t.icons)!=null&&e.length&&t.icons.length>0&&(t.icons=t.icons.filter(i=>i!=="")),Ahe(vN(vN({},n),t),{url:(t==null?void 0:t.url)||n.url,name:(t==null?void 0:t.name)||n.name,description:(t==null?void 0:t.description)||n.description,icons:(r=t==null?void 0:t.icons)!=null&&r.length&&t.icons.length>0?t.icons:n.icons})}catch(i){return console.warn("Error populating app metadata",i),t||n}}function tK(){return Fue.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function Rhe(){if($v()===Cs.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:r,Version:n}=global.Platform;return[r,n].join("-")}const t=$ue();if(t===null)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function khe(){var t;const e=$v();return e===Cs.browser?[e,((t=Iu.getLocation())==null?void 0:t.host)||"unknown"].join(":"):e}function rK(t,e,r){const n=Rhe(),i=khe();return[[t,e].join("-"),[She,r].join("-"),n,i].join("/")}function Nhe({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:a,packageName:c}){const u=r.split("?"),l=rK(t,e,n),d={auth:i,ua:l,projectId:s,useOnCloseEvent:o,packageName:c||void 0,bundleId:a||void 0},h=Phe(u[1]||"",d);return u[0]+"?"+h}function Yh(t,e){return t.filter(r=>e.includes(r)).length===t.length}function bI(t){return Object.fromEntries(t.entries())}function yI(t){return new Map(Object.entries(t))}function jh(t=Be.FIVE_MINUTES,e){const r=Be.toMiliseconds(t||Be.FIVE_MINUTES);let n,i,s,o;return{resolve:a=>{s&&n&&(clearTimeout(s),n(a),o=Promise.resolve(a))},reject:a=>{s&&i&&(clearTimeout(s),i(a))},done:()=>new Promise((a,c)=>{if(o)return a(o);s=setTimeout(()=>{const u=new Error(e);o=Promise.reject(u),c(u)},r),n=a,i=c})}}function id(t,e,r){return new Promise(async(n,i)=>{const s=setTimeout(()=>i(new Error(r)),e);try{const o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function nK(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function $he(t){return nK("topic",t)}function jhe(t){return nK("id",t)}function iK(t){const[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function gn(t,e){return Be.fromMiliseconds(Date.now()+Be.toMiliseconds(t))}function Bl(t){return Date.now()>=Be.toMiliseconds(t)}function Kt(t,e){return`${t}${e?`:${e}`:""}`}function Ka(t=[],e=[]){return[...new Set([...t,...e])]}async function Bhe({id:t,topic:e,wcDeepLink:r}){var n;try{if(!r)return;const i=typeof r=="string"?JSON.parse(r):r,s=i==null?void 0:i.href;if(typeof s!="string")return;const o=Dhe(s,t,e),a=$v();if(a===Cs.browser){if(!((n=Iu.getDocument())!=null&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}Mhe(o)}else a===Cs.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(i){console.error(i)}}function Dhe(t,e,r){const n=`requestId=${e}&sessionTopic=${r}`;t.endsWith("/")&&(t=t.slice(0,-1));let i=`${t}`;if(t.startsWith("https://t.me")){const s=t.includes("?")?"&startapp=":"?startapp=";i=`${i}${s}${Hhe(n,!0)}`}else i=`${i}/wc?${n}`;return i}function Mhe(t){let e="_self";Fhe()?e="_top":(Uhe()||t.startsWith("https://")||t.startsWith("http://"))&&(e="_blank"),window.open(t,e,"noreferrer noopener")}async function Lhe(t,e){let r="";try{if(n1()&&(r=localStorage.getItem(e),r))return r;r=await t.getItem(e)}catch(n){console.error(n)}return r}function EN(t,e){if(!t.includes(e))return null;const r=t.split(/([&,?,=])/),n=r.indexOf(e);return r[n+2]}function CN(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function V9(){return typeof process<"u"&&whe.IS_VITEST==="true"}function Uhe(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function Fhe(){try{return window.self!==window.top}catch{return!1}}function Hhe(t,e=!1){const r=Buffer.from(t).toString("base64");return e?r.replace(/[=]/g,""):r}function sK(t){return Buffer.from(t,"base64").toString("utf-8")}function qhe(t){return new Promise(e=>setTimeout(e,t))}function ty(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function zhe(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function jv(t,...e){if(!zhe(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function G9(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");ty(t.outputLen),ty(t.blockLen)}function hm(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function oK(t,e){jv(t);const r=e.outputLen;if(t.length>AN&a3)}:{h:Number(t>>AN&a3)|0,l:Number(t&a3)|0}}function Vhe(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;it<>>32-r,Khe=(t,e,r)=>e<>>32-r,Zhe=(t,e,r)=>e<>>64-r,Yhe=(t,e,r)=>t<>>64-r,Zp=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function Jhe(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function B8(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function ba(t,e){return t<<32-e|t>>>e}const xN=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Qhe(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function SN(t){for(let e=0;et().update(fm(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function i1(t=32){if(Zp&&typeof Zp.getRandomValues=="function")return Zp.getRandomValues(new Uint8Array(t));if(Zp&&typeof Zp.randomBytes=="function")return Zp.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}const cK=[],uK=[],lK=[],tfe=BigInt(0),F1=BigInt(1),rfe=BigInt(2),nfe=BigInt(7),ife=BigInt(256),sfe=BigInt(113);for(let t=0,e=F1,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],cK.push(2*(5*n+r)),uK.push((t+1)*(t+2)/2%64);let i=tfe;for(let s=0;s<7;s++)e=(e<>nfe)*sfe)%ife,e&rfe&&(i^=F1<<(F1<r>32?Zhe(t,e,r):Ghe(t,e,r),IN=(t,e,r)=>r>32?Yhe(t,e,r):Khe(t,e,r);function cfe(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,u=r[c],l=r[c+1],d=TN(u,l,1)^r[a],h=IN(u,l,1)^r[a+1];for(let f=0;f<50;f+=10)t[o+f]^=d,t[o+f+1]^=h}let i=t[2],s=t[3];for(let o=0;o<24;o++){const a=uK[o],c=TN(i,s,a),u=IN(i,s,a),l=cK[o];i=t[l],s=t[l+1],t[l]=c,t[l+1]=u}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)r[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~r[(a+2)%10]&r[(a+4)%10]}t[0]^=ofe[n],t[1]^=afe[n]}r.fill(0)}let ufe=class dK extends K9{constructor(e,r,n,i=!1,s=24){if(super(),this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,ty(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=Jhe(this.state)}keccak(){xN||SN(this.state32),cfe(this.state32,this.rounds),xN||SN(this.state32),this.posOut=0,this.pos=0}update(e){hm(this);const{blockLen:r,state:n}=this;e=fm(e);const i=e.length;for(let s=0;s=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);e.set(r.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return ty(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(oK(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return e||(e=new dK(r,n,i,o,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=n,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}};const lfe=(t,e,r)=>aK(()=>new ufe(e,t,r)),dfe=lfe(1,136,256/8),hfe="https://rpc.walletconnect.org/v1";function hK(t){const e=`Ethereum Signed Message: ${t.length}`,r=new TextEncoder().encode(e+t);return"0x"+Buffer.from(dfe(r)).toString("hex")}async function ffe(t,e,r,n,i,s){switch(r.t){case"eip191":return await pfe(t,e,r.s);case"eip1271":return await gfe(t,e,r.s,n,i,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}async function pfe(t,e,r){return(await Ple({hash:hK(e),signature:r})).toLowerCase()===t.toLowerCase()}async function gfe(t,e,r,n,i,s){const o=ig(n);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`);try{const a="0x1626ba7e",c="0000000000000000000000000000000000000000000000000000000000000040",u="0000000000000000000000000000000000000000000000000000000000000041",l=r.substring(2),d=hK(e).substring(2),h=a+d+c+u+l,f=await fetch(`${s||hfe}/?chainId=${n}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:mfe(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:h},"latest"]})}),{result:g}=await f.json();return g?g.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function mfe(){return Date.now()+Math.floor(Math.random()*1e3)}function wfe(t){const e=atob(t),r=new Uint8Array(e.length);for(let o=0;oe in t?bfe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Cfe=(t,e)=>{for(var r in e||(e={}))_fe.call(e,r)&&ON(t,r,e[r]);if(PN)for(var r of PN(e))Efe.call(e,r)&&ON(t,r,e[r]);return t},Afe=(t,e)=>yfe(t,vfe(e));const xfe="did:pkh:",Z9=t=>t==null?void 0:t.split(":"),Sfe=t=>{const e=t&&Z9(t);if(e)return t.includes(xfe)?e[3]:e[1]},vI=t=>{const e=t&&Z9(t);if(e)return e[2]+":"+e[3]},SC=t=>{const e=t&&Z9(t);if(e)return e.pop()};async function RN(t){const{cacao:e,projectId:r}=t,{s:n,p:i}=e,s=fK(i,i.iss),o=SC(i.iss);return await ffe(o,s,n,vI(i.iss),r)}const fK=(t,e)=>{const r=`${t.domain} wants you to sign in with your Ethereum account:`,n=SC(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=t.statement||void 0;const s=`URI: ${t.aud||t.uri}`,o=`Version: ${t.version}`,a=`Chain ID: ${Sfe(e)}`,c=`Nonce: ${t.nonce}`,u=`Issued At: ${t.iat}`,l=t.exp?`Expiration Time: ${t.exp}`:void 0,d=t.nbf?`Not Before: ${t.nbf}`:void 0,h=t.requestId?`Request ID: ${t.requestId}`:void 0,f=t.resources?`Resources:${t.resources.map(p=>` - ${p}`).join("")}`:void 0,g=Z4(t.resources);if(g){const p=ry(g);i=jfe(i,p)}return[r,n,"",i,"",s,o,a,c,u,l,d,h,f].filter(p=>p!=null).join(` `)};function Tfe(t){return Buffer.from(JSON.stringify(t)).toString("base64")}function Ife(t){return JSON.parse(Buffer.from(t,"base64").toString("utf-8"))}function Mf(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");const e=Object.keys(t.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(r=>{const n=t.att[r];if(Array.isArray(n))throw new Error(`Resource must be an object: ${r}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${r}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${r}`);Object.keys(n).forEach(i=>{const s=n[i];if(!Array.isArray(s))throw new Error(`Ability limits ${i} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${i} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${i}) must be an array of objects, found: ${o}`)})})})}function Pfe(t,e,r,n={}){return r==null||r.sort((i,s)=>i.localeCompare(s)),{att:{[t]:Ofe(e,r,n)}}}function Ofe(t,e,r={}){e=e==null?void 0:e.sort((i,s)=>i.localeCompare(s));const n=e.map(i=>({[`${t}/${i}`]:[r]}));return Object.assign({},...n)}function pK(t){return Mf(t),`urn:recap:${Tfe(t).replace(/=/g,"")}`}function ry(t){const e=Ife(t.replace("urn:recap:",""));return Mf(e),e}function Rfe(t,e,r){const n=Pfe(t,e,r);return pK(n)}function kfe(t){return t&&t.includes("urn:recap:")}function Nfe(t,e){const r=ry(t),n=ry(e),i=$fe(r,n);return pK(i)}function $fe(t,e){Mf(t),Mf(e);const r=Object.keys(t.att).concat(Object.keys(e.att)).sort((i,s)=>i.localeCompare(s)),n={att:{}};return r.forEach(i=>{var s,o;Object.keys(((s=t.att)==null?void 0:s[i])||{}).concat(Object.keys(((o=e.att)==null?void 0:o[i])||{})).sort((a,c)=>a.localeCompare(c)).forEach(a=>{var c,u;n.att[i]=Afe(Cfe({},n.att[i]),{[a]:((c=t.att[i])==null?void 0:c[a])||((u=e.att[i])==null?void 0:u[a])})})}),n}function jfe(t="",e){Mf(e);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;const n=[];let i=0;Object.keys(e.att).forEach(a=>{const c=Object.keys(e.att[a]).map(d=>({ability:d.split("/")[0],action:d.split("/")[1]}));c.sort((d,h)=>d.action.localeCompare(h.action));const u={};c.forEach(d=>{u[d.ability]||(u[d.ability]=[]),u[d.ability].push(d.action)});const l=Object.keys(u).map(d=>(i++,`(${i}) '${d}': '${u[d].join("', '")}' for '${a}'.`));n.push(l.join(", ").replace(".,","."))});const s=n.join(" "),o=`${r}${s}`;return`${t?t+" ":""}${o}`}function kN(t){var e;const r=ry(t);Mf(r);const n=(e=r.att)==null?void 0:e.eip155;return n?Object.keys(n).map(i=>i.split("/")[1]):[]}function NN(t){const e=ry(t);Mf(e);const r=[];return Object.values(e.att).forEach(n=>{Object.values(n).forEach(i=>{var s;(s=i==null?void 0:i[0])!=null&&s.chains&&r.push(i[0].chains)})}),[...new Set(r.flat())]}function Z4(t){if(!t)return;const e=t==null?void 0:t[t.length-1];return kfe(e)?e:void 0}function D8(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function gK(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function Es(t,...e){if(!gK(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function $N(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function Bfe(t,e){Es(t);const r=e.outputLen;if(t.lengthnew Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),Dfe=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),Mfe=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!Mfe)throw new Error("Non little-endian hardware is not supported");function Lfe(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function _I(t){if(typeof t=="string")t=Lfe(t);else if(gK(t))t=EI(t);else throw new Error("Uint8Array expected, got "+typeof t);return t}function Ufe(t,e){if(e==null||typeof e!="object")throw new Error("options must be defined");return Object.assign(t,e)}function Ffe(t,e){if(t.length!==e.length)return!1;let r=0;for(let n=0;n{function r(n,...i){if(Es(n),t.nonceLength!==void 0){const u=i[0];if(!u)throw new Error("nonce / iv required");t.varSizeNonce?Es(u):Es(u,t.nonceLength)}const s=t.tagLength;s&&i[1]!==void 0&&Es(i[1]);const o=e(n,...i),a=(u,l)=>{if(l!==void 0){if(u!==2)throw new Error("cipher output not supported");Es(l)}};let c=!1;return{encrypt(u,l){if(c)throw new Error("cannot encrypt() twice with same key + nonce");return c=!0,Es(u),a(o.encrypt.length,l),o.encrypt(u,l)},decrypt(u,l){if(Es(u),s&&u.length>i&s),a=Number(r&s);t.setUint32(e+4,o,n),t.setUint32(e+0,a,n)}function qfe(t){return t.byteOffset%4===0}function EI(t){return Uint8Array.from(t)}function pm(...t){for(let e=0;eUint8Array.from(t.split("").map(e=>e.charCodeAt(0))),zfe=mK("expand 16-byte k"),Wfe=mK("expand 32-byte k"),Vfe=ud(zfe),Gfe=ud(Wfe);function Ut(t,e){return t<>>32-e}function CI(t){return t.byteOffset%4===0}const c3=64,Kfe=16,wK=2**32-1,MN=new Uint32Array;function Zfe(t,e,r,n,i,s,o,a){const c=i.length,u=new Uint8Array(c3),l=ud(u),d=CI(i)&&CI(s),h=d?ud(i):MN,f=d?ud(s):MN;for(let g=0;g=wK)throw new Error("arx: counter overflow");const p=Math.min(c3,c-g);if(d&&p===c3){const m=g/4;if(g%4!==0)throw new Error("arx: invalid block position");for(let b=0,v;b{Es(a),Es(c),Es(u);const h=u.length;if(l===void 0&&(l=new Uint8Array(h)),Es(l),D8(d),d<0||d>=wK)throw new Error("arx: counter overflow");if(l.lengtht[e++]&255|(t[e++]&255)<<8;class Jfe{constructor(e){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,e=_I(e),Es(e,32);const r=kn(e,0),n=kn(e,2),i=kn(e,4),s=kn(e,6),o=kn(e,8),a=kn(e,10),c=kn(e,12),u=kn(e,14);this.r[0]=r&8191,this.r[1]=(r>>>13|n<<3)&8191,this.r[2]=(n>>>10|i<<6)&7939,this.r[3]=(i>>>7|s<<9)&8191,this.r[4]=(s>>>4|o<<12)&255,this.r[5]=o>>>1&8190,this.r[6]=(o>>>14|a<<2)&8191,this.r[7]=(a>>>11|c<<5)&8065,this.r[8]=(c>>>8|u<<8)&8191,this.r[9]=u>>>5&127;for(let l=0;l<8;l++)this.pad[l]=kn(e,16+2*l)}process(e,r,n=!1){const i=n?0:2048,{h:s,r:o}=this,a=o[0],c=o[1],u=o[2],l=o[3],d=o[4],h=o[5],f=o[6],g=o[7],p=o[8],m=o[9],b=kn(e,r+0),v=kn(e,r+2),E=kn(e,r+4),w=kn(e,r+6),C=kn(e,r+8),y=kn(e,r+10),_=kn(e,r+12),x=kn(e,r+14);let A=s[0]+(b&8191),T=s[1]+((b>>>13|v<<3)&8191),O=s[2]+((v>>>10|E<<6)&8191),k=s[3]+((E>>>7|w<<9)&8191),j=s[4]+((w>>>4|C<<12)&8191),N=s[5]+(C>>>1&8191),S=s[6]+((C>>>14|y<<2)&8191),P=s[7]+((y>>>11|_<<5)&8191),I=s[8]+((_>>>8|x<<8)&8191),B=s[9]+(x>>>5|i),$=0,R=$+A*a+T*(5*m)+O*(5*p)+k*(5*g)+j*(5*f);$=R>>>13,R&=8191,R+=N*(5*h)+S*(5*d)+P*(5*l)+I*(5*u)+B*(5*c),$+=R>>>13,R&=8191;let D=$+A*c+T*a+O*(5*m)+k*(5*p)+j*(5*g);$=D>>>13,D&=8191,D+=N*(5*f)+S*(5*h)+P*(5*d)+I*(5*l)+B*(5*u),$+=D>>>13,D&=8191;let L=$+A*u+T*c+O*a+k*(5*m)+j*(5*p);$=L>>>13,L&=8191,L+=N*(5*g)+S*(5*f)+P*(5*h)+I*(5*d)+B*(5*l),$+=L>>>13,L&=8191;let U=$+A*l+T*u+O*c+k*a+j*(5*m);$=U>>>13,U&=8191,U+=N*(5*p)+S*(5*g)+P*(5*f)+I*(5*h)+B*(5*d),$+=U>>>13,U&=8191;let z=$+A*d+T*l+O*u+k*c+j*a;$=z>>>13,z&=8191,z+=N*(5*m)+S*(5*p)+P*(5*g)+I*(5*f)+B*(5*h),$+=z>>>13,z&=8191;let W=$+A*h+T*d+O*l+k*u+j*c;$=W>>>13,W&=8191,W+=N*a+S*(5*m)+P*(5*p)+I*(5*g)+B*(5*f),$+=W>>>13,W&=8191;let K=$+A*f+T*h+O*d+k*l+j*u;$=K>>>13,K&=8191,K+=N*c+S*a+P*(5*m)+I*(5*p)+B*(5*g),$+=K>>>13,K&=8191;let J=$+A*g+T*f+O*h+k*d+j*l;$=J>>>13,J&=8191,J+=N*u+S*c+P*a+I*(5*m)+B*(5*p),$+=J>>>13,J&=8191;let ne=$+A*p+T*g+O*f+k*h+j*d;$=ne>>>13,ne&=8191,ne+=N*l+S*u+P*c+I*a+B*(5*m),$+=ne>>>13,ne&=8191;let ae=$+A*m+T*p+O*g+k*f+j*h;$=ae>>>13,ae&=8191,ae+=N*d+S*l+P*u+I*c+B*a,$+=ae>>>13,ae&=8191,$=($<<2)+$|0,$=$+R|0,R=$&8191,$=$>>>13,D+=$,s[0]=R,s[1]=D,s[2]=L,s[3]=U,s[4]=z,s[5]=W,s[6]=K,s[7]=J,s[8]=ne,s[9]=ae}finalize(){const{h:e,pad:r}=this,n=new Uint16Array(10);let i=e[1]>>>13;e[1]&=8191;for(let a=2;a<10;a++)e[a]+=i,i=e[a]>>>13,e[a]&=8191;e[0]+=i*5,i=e[0]>>>13,e[0]&=8191,e[1]+=i,i=e[1]>>>13,e[1]&=8191,e[2]+=i,n[0]=e[0]+5,i=n[0]>>>13,n[0]&=8191;for(let a=1;a<10;a++)n[a]=e[a]+i,i=n[a]>>>13,n[a]&=8191;n[9]-=8192;let s=(i^1)-1;for(let a=0;a<10;a++)n[a]&=s;s=~s;for(let a=0;a<10;a++)e[a]=e[a]&s|n[a];e[0]=(e[0]|e[1]<<13)&65535,e[1]=(e[1]>>>3|e[2]<<10)&65535,e[2]=(e[2]>>>6|e[3]<<7)&65535,e[3]=(e[3]>>>9|e[4]<<4)&65535,e[4]=(e[4]>>>12|e[5]<<1|e[6]<<14)&65535,e[5]=(e[6]>>>2|e[7]<<11)&65535,e[6]=(e[7]>>>5|e[8]<<8)&65535,e[7]=(e[8]>>>8|e[9]<<5)&65535;let o=e[0]+r[0];e[0]=o&65535;for(let a=1;a<8;a++)o=(e[a]+r[a]|0)+(o>>>16)|0,e[a]=o&65535;pm(n)}update(e){$N(this);const{buffer:r,blockLen:n}=this;e=_I(e);const i=e.length;for(let s=0;s>>0,e[s++]=n[o]>>>8;return e}digest(){const{buffer:e,outputLen:r}=this;this.digestInto(e);const n=e.slice(0,r);return this.destroy(),n}}function Qfe(t){const e=(n,i)=>t(i).update(_I(n)).digest(),r=t(new Uint8Array(32));return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}const Xfe=Qfe(t=>new Jfe(t));function epe(t,e,r,n,i,s=20){let o=t[0],a=t[1],c=t[2],u=t[3],l=e[0],d=e[1],h=e[2],f=e[3],g=e[4],p=e[5],m=e[6],b=e[7],v=i,E=r[0],w=r[1],C=r[2],y=o,_=a,x=c,A=u,T=l,O=d,k=h,j=f,N=g,S=p,P=m,I=b,B=v,$=E,R=w,D=C;for(let U=0;U{t.update(e);const r=e.length%16;r&&t.update(rpe.subarray(r))},npe=new Uint8Array(32);function UN(t,e,r,n,i){const s=t(e,r,npe),o=Xfe.create(s);i&&LN(o,i),LN(o,n);const a=new Uint8Array(16),c=Dfe(a);DN(c,0,BigInt(i?i.length:0),!0),DN(c,8,BigInt(n.length),!0),o.update(a);const u=o.digest();return pm(s,a),u}const ipe=t=>(e,r,n)=>({encrypt(i,s){const o=i.length;s=BN(o+16,s,!1),s.set(i);const a=s.subarray(0,-16);t(e,r,a,a,1);const c=UN(t,e,r,a,n);return s.set(c,o),pm(c),s},decrypt(i,s){s=BN(i.length-16,s,!1);const o=i.subarray(0,-16),a=i.subarray(-16),c=UN(t,e,r,o,n);if(!Ffe(a,c))throw new Error("invalid tag");return s.set(i.subarray(0,-16)),t(e,r,s,s,1),pm(c),s}}),bK=Hfe({blockSize:64,nonceLength:12,tagLength:16},ipe(tpe));let yK=class extends K9{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,G9(e);const n=fm(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(n.length>i?e.create().update(n).digest():n);for(let o=0;onew yK(t,e).update(r).digest();Y6.create=(t,e)=>new yK(t,e);function spe(t,e,r){return G9(t),r===void 0&&(r=new Uint8Array(t.outputLen)),Y6(t,fm(r),fm(e))}const M8=new Uint8Array([0]),FN=new Uint8Array;function ope(t,e,r,n=32){if(G9(t),ty(n),n>255*t.outputLen)throw new Error("Length should be <= 255*HashLen");const i=Math.ceil(n/t.outputLen);r===void 0&&(r=FN);const s=new Uint8Array(i*t.outputLen),o=Y6.create(t,e),a=o._cloneInto(),c=new Uint8Array(o.outputLen);for(let u=0;uope(t,spe(t,e,r),n,i);function cpe(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),c=n?4:0,u=n?0:4;t.setUint32(e+c,o,n),t.setUint32(e+u,a,n)}function upe(t,e,r){return t&e^~t&r}function lpe(t,e,r){return t&e^t&r^e&r}let dpe=class extends K9{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=B8(this.buffer)}update(e){hm(this);const{view:r,buffer:n,blockLen:i}=this;e=fm(e);const s=e.length;for(let o=0;oi-o&&(this.process(n,0),o=0);for(let d=o;dl.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d>>3,p=ba(f,17)^ba(f,19)^f>>>10;yl[d]=p+yl[d-7]+g+yl[d-16]|0}let{A:n,B:i,C:s,D:o,E:a,F:c,G:u,H:l}=this;for(let d=0;d<64;d++){const h=ba(a,6)^ba(a,11)^ba(a,25),f=l+h+upe(a,c,u)+hpe[d]+yl[d]|0,g=(ba(n,2)^ba(n,13)^ba(n,22))+lpe(n,i,s)|0;l=u,u=c,c=a,a=o+f|0,o=s,s=i,i=n,n=f+g|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(n,i,s,o,a,c,u,l)}roundClean(){yl.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Bv=aK(()=>new fpe);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const J6=BigInt(0),Q6=BigInt(1),ppe=BigInt(2);function Lf(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function Dv(t){if(!Lf(t))throw new Error("Uint8Array expected")}function gm(t,e){if(typeof e!="boolean")throw new Error(t+" boolean expected, got "+e)}const gpe=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function mm(t){Dv(t);let e="";for(let r=0;r=Cc._0&&t<=Cc._9)return t-Cc._0;if(t>=Cc.A&&t<=Cc.F)return t-(Cc.A-10);if(t>=Cc.a&&t<=Cc.f)return t-(Cc.a-10)}function wm(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length,r=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let i=0,s=0;itypeof t=="bigint"&&J6<=t;function eA(t,e,r){return L8(t)&&L8(e)&&L8(r)&&e<=t&&tJ6;t>>=Q6,e+=1);return e}function ype(t,e){return t>>BigInt(e)&Q6}function vpe(t,e,r){return t|(r?Q6:J6)<(ppe<new Uint8Array(t),qN=t=>Uint8Array.from(t);function _K(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=U8(t),i=U8(t),s=0;const o=()=>{n.fill(1),i.fill(0),s=0},a=(...l)=>r(i,n,...l),c=(l=U8())=>{i=a(qN([0]),l),n=a(),l.length!==0&&(i=a(qN([1]),l),n=a())},u=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let l=0;const d=[];for(;l{o(),c(l);let h;for(;!(h=d(u()));)c();return o(),h}}const _pe={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||Lf(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function s1(t,e,r={}){const n=(i,s,o)=>{const a=_pe[s];if(typeof a!="function")throw new Error("invalid validator function");const c=t[i];if(!(o&&c===void 0)&&!a(c,t))throw new Error("param "+String(i)+" is invalid. Expected "+s+", got "+c)};for(const[i,s]of Object.entries(e))n(i,s,!1);for(const[i,s]of Object.entries(r))n(i,s,!0);return t}const Epe=()=>{throw new Error("not implemented")};function AI(t){const e=new WeakMap;return(r,...n)=>{const i=e.get(r);if(i!==void 0)return i;const s=t(r,...n);return e.set(r,s),s}}var Cpe=Object.freeze({__proto__:null,isBytes:Lf,abytes:Dv,abool:gm,bytesToHex:mm,numberToHexUnpadded:W0,hexToNumber:Y9,hexToBytes:wm,bytesToNumberBE:If,bytesToNumberLE:ny,numberToBytesBE:bm,numberToBytesLE:X6,numberToVarBytesBE:mpe,ensureBytes:vs,concatBytes:iy,equalBytes:wpe,utf8ToBytes:bpe,inRange:eA,aInRange:_u,bitLen:vK,bitGet:ype,bitSet:vpe,bitMask:J9,createHmacDrbg:_K,validateObject:s1,notImplemented:Epe,memoized:AI});const In=BigInt(0),Yr=BigInt(1),Uh=BigInt(2),Ape=BigInt(3),xI=BigInt(4),zN=BigInt(5),WN=BigInt(8);function Wi(t,e){const r=t%e;return r>=In?r:e+r}function EK(t,e,r){if(eIn;)e&Yr&&(n=n*t%r),t=t*t%r,e>>=Yr;return n}function To(t,e,r){let n=t;for(;e-- >In;)n*=n,n%=r;return n}function SI(t,e){if(t===In)throw new Error("invert: expected non-zero number");if(e<=In)throw new Error("invert: expected positive modulus, got "+e);let r=Wi(t,e),n=e,i=In,s=Yr;for(;r!==In;){const o=n/r,a=n%r,c=i-s*o;n=r,r=a,i=s,s=c}if(n!==Yr)throw new Error("invert: does not exist");return Wi(i,e)}function xpe(t){const e=(t-Yr)/Uh;let r,n,i;for(r=t-Yr,n=0;r%Uh===In;r/=Uh,n++);for(i=Uh;i1e3)throw new Error("Cannot find square root: likely non-prime P");if(n===1){const o=(t+Yr)/xI;return function(a,c){const u=a.pow(c,o);if(!a.eql(a.sqr(u),c))throw new Error("Cannot find square root");return u}}const s=(r+Yr)/Uh;return function(o,a){if(o.pow(a,e)===o.neg(o.ONE))throw new Error("Cannot find square root");let c=n,u=o.pow(o.mul(o.ONE,i),r),l=o.pow(a,s),d=o.pow(a,r);for(;!o.eql(d,o.ONE);){if(o.eql(d,o.ZERO))return o.ZERO;let h=1;for(let g=o.sqr(d);h(n[i]="function",n),e);return s1(t,r)}function Ppe(t,e,r){if(rIn;)r&Yr&&(n=t.mul(n,i)),i=t.sqr(i),r>>=Yr;return n}function Ope(t,e){const r=new Array(e.length),n=e.reduce((s,o,a)=>t.is0(o)?s:(r[a]=s,t.mul(s,o)),t.ONE),i=t.inv(n);return e.reduceRight((s,o,a)=>t.is0(o)?s:(r[a]=t.mul(s,r[a]),t.mul(s,o)),i),r}function CK(t,e){const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function AK(t,e,r=!1,n={}){if(t<=In)throw new Error("invalid field: expected ORDER > 0, got "+t);const{nBitLength:i,nByteLength:s}=CK(t,e);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const a=Object.freeze({ORDER:t,isLE:r,BITS:i,BYTES:s,MASK:J9(i),ZERO:In,ONE:Yr,create:c=>Wi(c,t),isValid:c=>{if(typeof c!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof c);return In<=c&&cc===In,isOdd:c=>(c&Yr)===Yr,neg:c=>Wi(-c,t),eql:(c,u)=>c===u,sqr:c=>Wi(c*c,t),add:(c,u)=>Wi(c+u,t),sub:(c,u)=>Wi(c-u,t),mul:(c,u)=>Wi(c*u,t),pow:(c,u)=>Ppe(a,c,u),div:(c,u)=>Wi(c*SI(u,t),t),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>SI(c,t),sqrt:n.sqrt||(c=>(o||(o=Spe(t)),o(a,c))),invertBatch:c=>Ope(a,c),cmov:(c,u,l)=>l?u:c,toBytes:c=>r?X6(c,s):bm(c,s),fromBytes:c=>{if(c.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+c.length);return r?ny(c):If(c)}});return Object.freeze(a)}function xK(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function SK(t){const e=xK(t);return e+Math.ceil(e/2)}function Rpe(t,e,r=!1){const n=t.length,i=xK(e),s=SK(e);if(n<16||n1024)throw new Error("expected "+s+"-1024 bytes of input, got "+n);const o=r?ny(t):If(t),a=Wi(o,e-Yr)+Yr;return r?X6(a,i):bm(a,i)}const VN=BigInt(0),u3=BigInt(1);function F8(t,e){const r=e.negate();return t?r:e}function TK(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function H8(t,e){TK(t,e);const r=Math.ceil(e/t)+1,n=2**(t-1);return{windows:r,windowSize:n}}function kpe(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach((r,n)=>{if(!(r instanceof e))throw new Error("invalid point at index "+n)})}function Npe(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach((r,n)=>{if(!e.isValid(r))throw new Error("invalid scalar at index "+n)})}const q8=new WeakMap,IK=new WeakMap;function z8(t){return IK.get(t)||1}function $pe(t,e){return{constTimeNegate:F8,hasPrecomputes(r){return z8(r)!==1},unsafeLadder(r,n,i=t.ZERO){let s=r;for(;n>VN;)n&u3&&(i=i.add(s)),s=s.double(),n>>=u3;return i},precomputeWindow(r,n){const{windows:i,windowSize:s}=H8(n,e),o=[];let a=r,c=a;for(let u=0;u>=d,g>o&&(g-=l,i+=u3);const p=f,m=f+Math.abs(g)-1,b=h%2!==0,v=g<0;g===0?c=c.add(F8(b,n[p])):a=a.add(F8(v,n[m]))}return{p:a,f:c}},wNAFUnsafe(r,n,i,s=t.ZERO){const{windows:o,windowSize:a}=H8(r,e),c=BigInt(2**r-1),u=2**r,l=BigInt(r);for(let d=0;d>=l,f>a&&(f-=u,i+=u3),f===0)continue;let g=n[h+Math.abs(f)-1];f<0&&(g=g.negate()),s=s.add(g)}return s},getPrecomputes(r,n,i){let s=q8.get(n);return s||(s=this.precomputeWindow(n,r),r!==1&&q8.set(n,i(s))),s},wNAFCached(r,n,i){const s=z8(r);return this.wNAF(s,this.getPrecomputes(s,r,i),n)},wNAFCachedUnsafe(r,n,i,s){const o=z8(r);return o===1?this.unsafeLadder(r,n,s):this.wNAFUnsafe(o,this.getPrecomputes(o,r,i),n,s)},setWindowSize(r,n){TK(n,e),IK.set(r,n),q8.delete(r)}}}function jpe(t,e,r,n){if(kpe(r,t),Npe(n,e),r.length!==n.length)throw new Error("arrays of points and scalars must have equal length");const i=t.ZERO,s=vK(BigInt(r.length)),o=s>12?s-3:s>4?s-2:s?2:1,a=(1<=0;d-=o){c.fill(i);for(let f=0;f>BigInt(d)&BigInt(a));c[p]=c[p].add(r[f])}let h=i;for(let f=c.length-1,g=i;f>0;f--)g=g.add(c[f]),h=h.add(g);if(l=l.add(h),d!==0)for(let f=0;fWi(v,r),i=e.montgomeryBits,s=Math.ceil(i/8),o=e.nByteLength,a=e.adjustScalarBytes||(v=>v),c=e.powPminus2||(v=>EK(v,r-BigInt(2),r));function u(v,E,w){const C=n(v*(E-w));return E=n(E-C),w=n(w+C),[E,w]}const l=(e.a-BigInt(2))/BigInt(4);function d(v,E){_u("u",v,Yp,r),_u("scalar",E,Yp,r);const w=E,C=v;let y=W8,_=Yp,x=v,A=W8,T=Yp,O;for(let j=BigInt(i-1);j>=Yp;j--){const N=w>>j&W8;T^=N,O=u(T,y,x),y=O[0],x=O[1],O=u(T,_,A),_=O[0],A=O[1],T=N;const S=y+_,P=n(S*S),I=y-_,B=n(I*I),$=P-B,R=x+A,D=x-A,L=n(D*S),U=n(R*I),z=L+U,W=L-U;x=n(z*z),A=n(C*n(W*W)),y=n(P*B),_=n($*(P+n(l*$)))}O=u(T,y,x),y=O[0],x=O[1],O=u(T,_,A),_=O[0],A=O[1];const k=c(_);return n(y*k)}function h(v){return X6(n(v),s)}function f(v){const E=vs("u coordinate",v,s);return o===32&&(E[31]&=127),ny(E)}function g(v){const E=vs("scalar",v),w=E.length;if(w!==s&&w!==o){let C=""+s+" or "+o;throw new Error("invalid scalar, expected "+C+" bytes, got "+w)}return ny(a(E))}function p(v,E){const w=f(E),C=g(v),y=d(w,C);if(y===Yp)throw new Error("invalid private or public key received");return h(y)}const m=h(e.Gu);function b(v){return p(v,m)}return{scalarMult:p,scalarMultBase:b,getSharedSecret:(v,E)=>p(v,E),getPublicKey:v=>b(v),utils:{randomPrivateKey:()=>e.randomBytes(e.nByteLength)},GuBytes:m}}const TI=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949");BigInt(0);const Mpe=BigInt(1),GN=BigInt(2),Lpe=BigInt(3),Upe=BigInt(5);BigInt(8);function Fpe(t){const e=BigInt(10),r=BigInt(20),n=BigInt(40),i=BigInt(80),s=TI,o=t*t%s*t%s,a=To(o,GN,s)*o%s,c=To(a,Mpe,s)*t%s,u=To(c,Upe,s)*c%s,l=To(u,e,s)*u%s,d=To(l,r,s)*l%s,h=To(d,n,s)*d%s,f=To(h,i,s)*h%s,g=To(f,i,s)*h%s,p=To(g,e,s)*u%s;return{pow_p_5_8:To(p,GN,s)*t%s,b2:o}}function Hpe(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}const II=Dpe({P:TI,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:t=>{const e=TI,{pow_p_5_8:r,b2:n}=Fpe(t);return Wi(To(r,Lpe,e)*n,e)},adjustScalarBytes:Hpe,randomBytes:i1});function KN(t){t.lowS!==void 0&&gm("lowS",t.lowS),t.prehash!==void 0&&gm("prehash",t.prehash)}function qpe(t){const e=PK(t);s1(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:r,Fp:n,a:i}=e;if(r){if(!n.eql(i,n.ZERO))throw new Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if(typeof r!="object"||typeof r.beta!="bigint"||typeof r.splitScalar!="function")throw new Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...e})}const{bytesToNumberBE:zpe,hexToBytes:Wpe}=Cpe;class Vpe extends Error{constructor(e=""){super(e)}}const Qc={Err:Vpe,_tlv:{encode:(t,e)=>{const{Err:r}=Qc;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length&1)throw new r("tlv.encode: unpadded data");const n=e.length/2,i=W0(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");const s=n>127?W0(i.length/2|128):"";return W0(t)+s+i+e},decode(t,e){const{Err:r}=Qc;let n=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");const i=e[n++],s=!!(i&128);let o=0;if(!s)o=i;else{const c=i&127;if(!c)throw new r("tlv.decode(long): indefinite length not supported");if(c>4)throw new r("tlv.decode(long): byte length is too big");const u=e.subarray(n,n+c);if(u.length!==c)throw new r("tlv.decode: length bytes not complete");if(u[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(const l of u)o=o<<8|l;if(n+=c,o<128)throw new r("tlv.decode(long): not minimal encoding")}const a=e.subarray(n,n+o);if(a.length!==o)throw new r("tlv.decode: wrong value length");return{v:a,l:e.subarray(n+o)}}},_int:{encode(t){const{Err:e}=Qc;if(t{const v=m.toAffine();return iy(Uint8Array.from([4]),r.toBytes(v.x),r.toBytes(v.y))}),s=e.fromBytes||(p=>{const m=p.subarray(1),b=r.fromBytes(m.subarray(0,r.BYTES)),v=r.fromBytes(m.subarray(r.BYTES,2*r.BYTES));return{x:b,y:v}});function o(p){const{a:m,b}=e,v=r.sqr(p),E=r.mul(v,p);return r.add(r.add(E,r.mul(p,m)),b)}if(!r.eql(r.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function a(p){return eA(p,En,e.n)}function c(p){const{allowedPrivateKeyLengths:m,nByteLength:b,wrapPrivateKey:v,n:E}=e;if(m&&typeof p!="bigint"){if(Lf(p)&&(p=mm(p)),typeof p!="string"||!m.includes(p.length))throw new Error("invalid private key");p=p.padStart(b*2,"0")}let w;try{w=typeof p=="bigint"?p:If(vs("private key",p,b))}catch{throw new Error("invalid private key, expected hex or "+b+" bytes, got "+typeof p)}return v&&(w=Wi(w,E)),_u("private key",w,En,E),w}function u(p){if(!(p instanceof h))throw new Error("ProjectivePoint expected")}const l=AI((p,m)=>{const{px:b,py:v,pz:E}=p;if(r.eql(E,r.ONE))return{x:b,y:v};const w=p.is0();m==null&&(m=w?r.ONE:r.inv(E));const C=r.mul(b,m),y=r.mul(v,m),_=r.mul(E,m);if(w)return{x:r.ZERO,y:r.ZERO};if(!r.eql(_,r.ONE))throw new Error("invZ was invalid");return{x:C,y}}),d=AI(p=>{if(p.is0()){if(e.allowInfinityPoint&&!r.is0(p.py))return;throw new Error("bad point: ZERO")}const{x:m,y:b}=p.toAffine();if(!r.isValid(m)||!r.isValid(b))throw new Error("bad point: x or y not FE");const v=r.sqr(b),E=o(m);if(!r.eql(v,E))throw new Error("bad point: equation left != right");if(!p.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class h{constructor(m,b,v){if(this.px=m,this.py=b,this.pz=v,m==null||!r.isValid(m))throw new Error("x required");if(b==null||!r.isValid(b))throw new Error("y required");if(v==null||!r.isValid(v))throw new Error("z required");Object.freeze(this)}static fromAffine(m){const{x:b,y:v}=m||{};if(!m||!r.isValid(b)||!r.isValid(v))throw new Error("invalid affine point");if(m instanceof h)throw new Error("projective point not allowed");const E=w=>r.eql(w,r.ZERO);return E(b)&&E(v)?h.ZERO:new h(b,v,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(m){const b=r.invertBatch(m.map(v=>v.pz));return m.map((v,E)=>v.toAffine(b[E])).map(h.fromAffine)}static fromHex(m){const b=h.fromAffine(s(vs("pointHex",m)));return b.assertValidity(),b}static fromPrivateKey(m){return h.BASE.multiply(c(m))}static msm(m,b){return jpe(h,n,m,b)}_setWindowSize(m){g.setWindowSize(this,m)}assertValidity(){d(this)}hasEvenY(){const{y:m}=this.toAffine();if(r.isOdd)return!r.isOdd(m);throw new Error("Field doesn't support isOdd")}equals(m){u(m);const{px:b,py:v,pz:E}=this,{px:w,py:C,pz:y}=m,_=r.eql(r.mul(b,y),r.mul(w,E)),x=r.eql(r.mul(v,y),r.mul(C,E));return _&&x}negate(){return new h(this.px,r.neg(this.py),this.pz)}double(){const{a:m,b}=e,v=r.mul(b,ZN),{px:E,py:w,pz:C}=this;let y=r.ZERO,_=r.ZERO,x=r.ZERO,A=r.mul(E,E),T=r.mul(w,w),O=r.mul(C,C),k=r.mul(E,w);return k=r.add(k,k),x=r.mul(E,C),x=r.add(x,x),y=r.mul(m,x),_=r.mul(v,O),_=r.add(y,_),y=r.sub(T,_),_=r.add(T,_),_=r.mul(y,_),y=r.mul(k,y),x=r.mul(v,x),O=r.mul(m,O),k=r.sub(A,O),k=r.mul(m,k),k=r.add(k,x),x=r.add(A,A),A=r.add(x,A),A=r.add(A,O),A=r.mul(A,k),_=r.add(_,A),O=r.mul(w,C),O=r.add(O,O),A=r.mul(O,k),y=r.sub(y,A),x=r.mul(O,T),x=r.add(x,x),x=r.add(x,x),new h(y,_,x)}add(m){u(m);const{px:b,py:v,pz:E}=this,{px:w,py:C,pz:y}=m;let _=r.ZERO,x=r.ZERO,A=r.ZERO;const T=e.a,O=r.mul(e.b,ZN);let k=r.mul(b,w),j=r.mul(v,C),N=r.mul(E,y),S=r.add(b,v),P=r.add(w,C);S=r.mul(S,P),P=r.add(k,j),S=r.sub(S,P),P=r.add(b,E);let I=r.add(w,y);return P=r.mul(P,I),I=r.add(k,N),P=r.sub(P,I),I=r.add(v,E),_=r.add(C,y),I=r.mul(I,_),_=r.add(j,N),I=r.sub(I,_),A=r.mul(T,P),_=r.mul(O,N),A=r.add(_,A),_=r.sub(j,A),A=r.add(j,A),x=r.mul(_,A),j=r.add(k,k),j=r.add(j,k),N=r.mul(T,N),P=r.mul(O,P),j=r.add(j,N),N=r.sub(k,N),N=r.mul(T,N),P=r.add(P,N),k=r.mul(j,P),x=r.add(x,k),k=r.mul(I,P),_=r.mul(S,_),_=r.sub(_,k),k=r.mul(S,j),A=r.mul(I,A),A=r.add(A,k),new h(_,x,A)}subtract(m){return this.add(m.negate())}is0(){return this.equals(h.ZERO)}wNAF(m){return g.wNAFCached(this,m,h.normalizeZ)}multiplyUnsafe(m){const{endo:b,n:v}=e;_u("scalar",m,gu,v);const E=h.ZERO;if(m===gu)return E;if(this.is0()||m===En)return this;if(!b||g.hasPrecomputes(this))return g.wNAFCachedUnsafe(this,m,h.normalizeZ);let{k1neg:w,k1:C,k2neg:y,k2:_}=b.splitScalar(m),x=E,A=E,T=this;for(;C>gu||_>gu;)C&En&&(x=x.add(T)),_&En&&(A=A.add(T)),T=T.double(),C>>=En,_>>=En;return w&&(x=x.negate()),y&&(A=A.negate()),A=new h(r.mul(A.px,b.beta),A.py,A.pz),x.add(A)}multiply(m){const{endo:b,n:v}=e;_u("scalar",m,En,v);let E,w;if(b){const{k1neg:C,k1:y,k2neg:_,k2:x}=b.splitScalar(m);let{p:A,f:T}=this.wNAF(y),{p:O,f:k}=this.wNAF(x);A=g.constTimeNegate(C,A),O=g.constTimeNegate(_,O),O=new h(r.mul(O.px,b.beta),O.py,O.pz),E=A.add(O),w=T.add(k)}else{const{p:C,f:y}=this.wNAF(m);E=C,w=y}return h.normalizeZ([E,w])[0]}multiplyAndAddUnsafe(m,b,v){const E=h.BASE,w=(y,_)=>_===gu||_===En||!y.equals(E)?y.multiplyUnsafe(_):y.multiply(_),C=w(this,b).add(w(m,v));return C.is0()?void 0:C}toAffine(m){return l(this,m)}isTorsionFree(){const{h:m,isTorsionFree:b}=e;if(m===En)return!0;if(b)return b(h,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:m,clearCofactor:b}=e;return m===En?this:b?b(h,this):this.multiplyUnsafe(e.h)}toRawBytes(m=!0){return gm("isCompressed",m),this.assertValidity(),i(h,this,m)}toHex(m=!0){return gm("isCompressed",m),mm(this.toRawBytes(m))}}h.BASE=new h(e.Gx,e.Gy,r.ONE),h.ZERO=new h(r.ZERO,r.ONE,r.ZERO);const f=e.nBitLength,g=$pe(h,e.endo?Math.ceil(f/2):f);return{CURVE:e,ProjectivePoint:h,normPrivateKeyToScalar:c,weierstrassEquation:o,isWithinCurveOrder:a}}function Kpe(t){const e=PK(t);return s1(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function Zpe(t){const e=Kpe(t),{Fp:r,n}=e,i=r.BYTES+1,s=2*r.BYTES+1;function o(N){return Wi(N,n)}function a(N){return SI(N,n)}const{ProjectivePoint:c,normPrivateKeyToScalar:u,weierstrassEquation:l,isWithinCurveOrder:d}=Gpe({...e,toBytes(N,S,P){const I=S.toAffine(),B=r.toBytes(I.x),$=iy;return gm("isCompressed",P),P?$(Uint8Array.from([S.hasEvenY()?2:3]),B):$(Uint8Array.from([4]),B,r.toBytes(I.y))},fromBytes(N){const S=N.length,P=N[0],I=N.subarray(1);if(S===i&&(P===2||P===3)){const B=If(I);if(!eA(B,En,r.ORDER))throw new Error("Point is not on curve");const $=l(B);let R;try{R=r.sqrt($)}catch(L){const U=L instanceof Error?": "+L.message:"";throw new Error("Point is not on curve"+U)}const D=(R&En)===En;return(P&1)===1!==D&&(R=r.neg(R)),{x:B,y:R}}else if(S===s&&P===4){const B=r.fromBytes(I.subarray(0,r.BYTES)),$=r.fromBytes(I.subarray(r.BYTES,2*r.BYTES));return{x:B,y:$}}else{const B=i,$=s;throw new Error("invalid Point, expected length of "+B+", or uncompressed "+$+", got "+S)}}}),h=N=>mm(bm(N,e.nByteLength));function f(N){const S=n>>En;return N>S}function g(N){return f(N)?o(-N):N}const p=(N,S,P)=>If(N.slice(S,P));class m{constructor(S,P,I){this.r=S,this.s=P,this.recovery=I,this.assertValidity()}static fromCompact(S){const P=e.nByteLength;return S=vs("compactSignature",S,P*2),new m(p(S,0,P),p(S,P,2*P))}static fromDER(S){const{r:P,s:I}=Qc.toSig(vs("DER",S));return new m(P,I)}assertValidity(){_u("r",this.r,En,n),_u("s",this.s,En,n)}addRecoveryBit(S){return new m(this.r,this.s,S)}recoverPublicKey(S){const{r:P,s:I,recovery:B}=this,$=y(vs("msgHash",S));if(B==null||![0,1,2,3].includes(B))throw new Error("recovery id invalid");const R=B===2||B===3?P+e.n:P;if(R>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const D=(B&1)===0?"02":"03",L=c.fromHex(D+h(R)),U=a(R),z=o(-$*U),W=o(I*U),K=c.BASE.multiplyAndAddUnsafe(L,z,W);if(!K)throw new Error("point at infinify");return K.assertValidity(),K}hasHighS(){return f(this.s)}normalizeS(){return this.hasHighS()?new m(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return wm(this.toDERHex())}toDERHex(){return Qc.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return wm(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const b={isValidPrivateKey(N){try{return u(N),!0}catch{return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{const N=SK(e.n);return Rpe(e.randomBytes(N),e.n)},precompute(N=8,S=c.BASE){return S._setWindowSize(N),S.multiply(BigInt(3)),S}};function v(N,S=!0){return c.fromPrivateKey(N).toRawBytes(S)}function E(N){const S=Lf(N),P=typeof N=="string",I=(S||P)&&N.length;return S?I===i||I===s:P?I===2*i||I===2*s:N instanceof c}function w(N,S,P=!0){if(E(N))throw new Error("first arg must be private key");if(!E(S))throw new Error("second arg must be public key");return c.fromHex(S).multiply(u(N)).toRawBytes(P)}const C=e.bits2int||function(N){if(N.length>8192)throw new Error("input is too large");const S=If(N),P=N.length*8-e.nBitLength;return P>0?S>>BigInt(P):S},y=e.bits2int_modN||function(N){return o(C(N))},_=J9(e.nBitLength);function x(N){return _u("num < 2^"+e.nBitLength,N,gu,_),bm(N,e.nByteLength)}function A(N,S,P=T){if(["recovered","canonical"].some(ne=>ne in P))throw new Error("sign() legacy options not supported");const{hash:I,randomBytes:B}=e;let{lowS:$,prehash:R,extraEntropy:D}=P;$==null&&($=!0),N=vs("msgHash",N),KN(P),R&&(N=vs("prehashed msgHash",I(N)));const L=y(N),U=u(S),z=[x(U),x(L)];if(D!=null&&D!==!1){const ne=D===!0?B(r.BYTES):D;z.push(vs("extraEntropy",ne))}const W=iy(...z),K=L;function J(ne){const ae=C(ne);if(!d(ae))return;const he=a(ae),ie=c.BASE.multiply(ae).toAffine(),Ee=o(ie.x);if(Ee===gu)return;const pe=o(he*o(K+Ee*U));if(pe===gu)return;let ve=(ie.x===Ee?0:2)|Number(ie.y&En),je=pe;return $&&f(pe)&&(je=g(pe),ve^=1),new m(Ee,je,ve)}return{seed:W,k2sig:J}}const T={lowS:e.lowS,prehash:!1},O={lowS:e.lowS,prehash:!1};function k(N,S,P=T){const{seed:I,k2sig:B}=A(N,S,P),$=e;return _K($.hash.outputLen,$.nByteLength,$.hmac)(I,B)}c.BASE._setWindowSize(8);function j(N,S,P,I=O){var pe;const B=N;S=vs("msgHash",S),P=vs("publicKey",P);const{lowS:$,prehash:R,format:D}=I;if(KN(I),"strict"in I)throw new Error("options.strict was renamed to lowS");if(D!==void 0&&D!=="compact"&&D!=="der")throw new Error("format must be compact or der");const L=typeof B=="string"||Lf(B),U=!L&&!D&&typeof B=="object"&&B!==null&&typeof B.r=="bigint"&&typeof B.s=="bigint";if(!L&&!U)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let z,W;try{if(U&&(z=new m(B.r,B.s)),L){try{D!=="compact"&&(z=m.fromDER(B))}catch(ve){if(!(ve instanceof Qc.Err))throw ve}!z&&D!=="der"&&(z=m.fromCompact(B))}W=c.fromHex(P)}catch{return!1}if(!z||$&&z.hasHighS())return!1;R&&(S=e.hash(S));const{r:K,s:J}=z,ne=y(S),ae=a(J),he=o(ne*ae),ie=o(K*ae),Ee=(pe=c.BASE.multiplyAndAddUnsafe(W,he,ie))==null?void 0:pe.toAffine();return Ee?o(Ee.x)===K:!1}return{CURVE:e,getPublicKey:v,getSharedSecret:w,sign:k,verify:j,ProjectivePoint:c,Signature:m,utils:b}}function Ype(t){return{hash:t,hmac:(e,...r)=>Y6(t,e,efe(...r)),randomBytes:i1}}function Jpe(t,e){const r=n=>Zpe({...t,...Ype(n)});return{...r(e),create:r}}const OK=AK(BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff")),Qpe=OK.create(BigInt("-3")),Xpe=BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),e0e=Jpe({a:Qpe,b:Xpe,Fp:OK,n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5"),h:BigInt(1),lowS:!1},Bv),RK="base10",Ei="base16",Lo="base64pad",Ml="base64url",Mv="utf8",kK=0,Eu=1,Lv=2,t0e=0,YN=1,hb=12,Q9=32;function r0e(){const t=II.utils.randomPrivateKey(),e=II.getPublicKey(t);return{privateKey:Ki(t,Ei),publicKey:Ki(e,Ei)}}function PI(){const t=i1(Q9);return Ki(t,Ei)}function n0e(t,e){const r=II.getSharedSecret(ro(t,Ei),ro(e,Ei)),n=ape(Bv,r,void 0,void 0,Q9);return Ki(n,Ei)}function Y4(t){const e=Bv(ro(t,Ei));return Ki(e,Ei)}function La(t){const e=Bv(ro(t,Mv));return Ki(e,Ei)}function NK(t){return ro(`${t}`,RK)}function Uf(t){return Number(Ki(t,RK))}function $K(t){return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function jK(t){const e=t.replace(/-/g,"+").replace(/_/g,"/"),r=(4-e.length%4)%4;return e+"=".repeat(r)}function i0e(t){const e=NK(typeof t.type<"u"?t.type:kK);if(Uf(e)===Eu&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?ro(t.senderPublicKey,Ei):void 0,n=typeof t.iv<"u"?ro(t.iv,Ei):i1(hb),i=ro(t.symKey,Ei),s=bK(i,n).encrypt(ro(t.message,Mv)),o=BK({type:e,sealed:s,iv:n,senderPublicKey:r});return t.encoding===Ml?$K(o):o}function s0e(t){const e=ro(t.symKey,Ei),{sealed:r,iv:n}=sy({encoded:t.encoded,encoding:t.encoding}),i=bK(e,n).decrypt(r);if(i===null)throw new Error("Failed to decrypt");return Ki(i,Mv)}function o0e(t,e){const r=NK(Lv),n=i1(hb),i=ro(t,Mv),s=BK({type:r,sealed:i,iv:n});return e===Ml?$K(s):s}function a0e(t,e){const{sealed:r}=sy({encoded:t,encoding:e});return Ki(r,Mv)}function BK(t){if(Uf(t.type)===Lv)return Ki(db([t.type,t.sealed]),Lo);if(Uf(t.type)===Eu){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Ki(db([t.type,t.senderPublicKey,t.iv,t.sealed]),Lo)}return Ki(db([t.type,t.iv,t.sealed]),Lo)}function sy(t){const e=(t.encoding||Lo)===Ml?jK(t.encoded):t.encoded,r=ro(e,Lo),n=r.slice(t0e,YN),i=YN;if(Uf(n)===Eu){const c=i+Q9,u=c+hb,l=r.slice(i,c),d=r.slice(c,u),h=r.slice(u);return{type:n,sealed:h,iv:d,senderPublicKey:l}}if(Uf(n)===Lv){const c=r.slice(i),u=i1(hb);return{type:n,sealed:c,iv:u}}const s=i+hb,o=r.slice(i,s),a=r.slice(s);return{type:n,sealed:a,iv:o}}function c0e(t,e){const r=sy({encoded:t,encoding:e==null?void 0:e.encoding});return DK({type:Uf(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?Ki(r.senderPublicKey,Ei):void 0,receiverPublicKey:e==null?void 0:e.receiverPublicKey})}function DK(t){const e=(t==null?void 0:t.type)||kK;if(e===Eu){if(typeof(t==null?void 0:t.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(t==null?void 0:t.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t==null?void 0:t.senderPublicKey,receiverPublicKey:t==null?void 0:t.receiverPublicKey}}function JN(t){return t.type===Eu&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}function QN(t){return t.type===Lv}function u0e(t){const e=Buffer.from(t.x,"base64"),r=Buffer.from(t.y,"base64");return db([new Uint8Array([4]),e,r])}function l0e(t,e){const[r,n,i]=t.split("."),s=Buffer.from(jK(i),"base64");if(s.length!==64)throw new Error("Invalid signature length");const o=s.slice(0,32),a=s.slice(32,64),c=`${r}.${n}`,u=Bv(c),l=u0e(e);if(!e0e.verify(db([o,a]),u,l))throw new Error("Invalid signature");return lI(t).payload}const d0e="irn";function TC(t){return(t==null?void 0:t.relay)||{protocol:d0e}}function rb(t){const e=mhe[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}function h0e(t,e="-"){const r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){const s=i.replace(n,""),o=t[i];r[s]=o}}),r}function XN(t){if(!t.includes("wc:")){const u=sK(t);u!=null&&u.includes("wc:")&&(t=u)}t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;const e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=new URLSearchParams(s),a={};o.forEach((u,l)=>{a[l]=u});const c=typeof a.methods=="string"?a.methods.split(","):void 0;return{protocol:n,topic:f0e(i[0]),version:parseInt(i[1],10),symKey:a.symKey,relay:h0e(a),methods:c,expiryTimestamp:a.expiryTimestamp?parseInt(a.expiryTimestamp,10):void 0}}function f0e(t){return t.startsWith("//")?t.substring(2):t}function p0e(t,e="-"){const r="relay",n={};return Object.keys(t).forEach(i=>{const s=i,o=r+e+s;t[s]&&(n[o]=t[s])}),n}function e$(t){const e=new URLSearchParams,r=p0e(t.relay);Object.keys(r).sort().forEach(i=>{e.set(i,r[i])}),e.set("symKey",t.symKey),t.expiryTimestamp&&e.set("expiryTimestamp",t.expiryTimestamp.toString()),t.methods&&e.set("methods",t.methods.join(","));const n=e.toString();return`${t.protocol}:${t.topic}@${t.version}?${n}`}function l3(t,e,r){return`${t}?wc_ev=${r}&topic=${e}`}var g0e=Object.defineProperty,m0e=Object.defineProperties,w0e=Object.getOwnPropertyDescriptors,t$=Object.getOwnPropertySymbols,b0e=Object.prototype.hasOwnProperty,y0e=Object.prototype.propertyIsEnumerable,r$=(t,e,r)=>e in t?g0e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,v0e=(t,e)=>{for(var r in e||(e={}))b0e.call(e,r)&&r$(t,r,e[r]);if(t$)for(var r of t$(e))y0e.call(e,r)&&r$(t,r,e[r]);return t},_0e=(t,e)=>m0e(t,w0e(e));function o1(t){const e=[];return t.forEach(r=>{const[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function E0e(t){const e=[];return Object.values(t).forEach(r=>{e.push(...o1(r.accounts))}),e}function C0e(t,e){const r=[];return Object.values(t).forEach(n=>{o1(n.accounts).includes(e)&&r.push(...n.methods)}),r}function A0e(t,e){const r=[];return Object.values(t).forEach(n=>{o1(n.accounts).includes(e)&&r.push(...n.events)}),r}function tA(t){return t.includes(":")}function V0(t){return tA(t)?t.split(":")[0]:t}function n$(t){var e,r,n;const i={};if(!dd(t))return i;for(const[s,o]of Object.entries(t)){const a=tA(s)?[s]:o.chains,c=o.methods||[],u=o.events||[],l=V0(s);i[l]=_0e(v0e({},i[l]),{chains:Ka(a,(e=i[l])==null?void 0:e.chains),methods:Ka(c,(r=i[l])==null?void 0:r.methods),events:Ka(u,(n=i[l])==null?void 0:n.events)})}return i}function x0e(t){const e={};return t==null||t.forEach(r=>{var n;const[i,s]=r.split(":");e[i]||(e[i]={accounts:[],chains:[],events:[],methods:[]}),e[i].accounts.push(r),(n=e[i].chains)==null||n.push(`${i}:${s}`)}),e}function i$(t,e){e=e.map(n=>n.replace("did:pkh:",""));const r=x0e(e);for(const[n,i]of Object.entries(r))i.methods?i.methods=Ka(i.methods,t):i.methods=t,i.events=["chainChanged","accountsChanged"];return r}function S0e(t,e){var r,n,i,s,o,a;const c=n$(t),u=n$(e),l={},d=Object.keys(c).concat(Object.keys(u));for(const h of d)l[h]={chains:Ka((r=c[h])==null?void 0:r.chains,(n=u[h])==null?void 0:n.chains),methods:Ka((i=c[h])==null?void 0:i.methods,(s=u[h])==null?void 0:s.methods),events:Ka((o=c[h])==null?void 0:o.events,(a=u[h])==null?void 0:a.events)};return l}const T0e={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},I0e={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function De(t,e){const{message:r,code:n}=I0e[t];return{message:e?`${r} ${e}`:r,code:n}}function sr(t,e){const{message:r,code:n}=T0e[t];return{message:e?`${r} ${e}`:r,code:n}}function ld(t,e){return!!Array.isArray(t)}function dd(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function Ln(t){return typeof t>"u"}function cn(t,e){return e&&Ln(t)?!0:typeof t=="string"&&!!t.trim().length}function X9(t,e){return e&&Ln(t)?!0:typeof t=="number"&&!isNaN(t)}function P0e(t,e){const{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r);let s=!0;return Yh(i,n)?(n.forEach(o=>{const{accounts:a,methods:c,events:u}=t.namespaces[o],l=o1(a),d=r[o];(!Yh(eK(o,d),l)||!Yh(d.methods,c)||!Yh(d.events,u))&&(s=!1)}),s):!1}function IC(t){return cn(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function O0e(t){if(cn(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&IC(r)}}return!1}function R0e(t){function e(r){try{return typeof new URL(r)<"u"}catch{return!1}}try{if(cn(t,!1)){if(e(t))return!0;const r=sK(t);return e(r)}}catch{}return!1}function k0e(t){var e;return(e=t==null?void 0:t.proposer)==null?void 0:e.publicKey}function N0e(t){return t==null?void 0:t.topic}function $0e(t,e){let r=null;return cn(t==null?void 0:t.publicKey,!1)||(r=De("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function s$(t){let e=!0;return ld(t)?t.length&&(e=t.every(r=>cn(r,!1))):e=!1,e}function j0e(t,e,r){let n=null;return ld(e)&&e.length?e.forEach(i=>{n||IC(i)||(n=sr("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):IC(t)||(n=sr("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function B0e(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;const o=j0e(i,eK(i,s),`${e} ${r}`);o&&(n=o)}),n}function D0e(t,e){let r=null;return ld(t)?t.forEach(n=>{r||O0e(n)||(r=sr("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=sr("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function M0e(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=D0e(n==null?void 0:n.accounts,`${e} namespace`);i&&(r=i)}),r}function L0e(t,e){let r=null;return s$(t==null?void 0:t.methods)?s$(t==null?void 0:t.events)||(r=sr("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=sr("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function MK(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=L0e(n,`${e}, namespace`);i&&(r=i)}),r}function U0e(t,e,r){let n=null;if(t&&dd(t)){const i=MK(t,e);i&&(n=i);const s=B0e(t,e,r);s&&(n=s)}else n=De("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function V8(t,e){let r=null;if(t&&dd(t)){const n=MK(t,e);n&&(r=n);const i=M0e(t,e);i&&(r=i)}else r=De("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function LK(t){return cn(t.protocol,!0)}function F0e(t,e){let r=!1;return t?t&&ld(t)&&t.length&&t.forEach(n=>{r=LK(n)}):r=!0,r}function H0e(t){return typeof t=="number"}function Fi(t){return typeof t<"u"&&typeof t!==null}function q0e(t){return!(!t||typeof t!="object"||!t.code||!X9(t.code,!1)||!t.message||!cn(t.message,!1))}function z0e(t){return!(Ln(t)||!cn(t.method,!1))}function W0e(t){return!(Ln(t)||Ln(t.result)&&Ln(t.error)||!X9(t.id,!1)||!cn(t.jsonrpc,!1))}function V0e(t){return!(Ln(t)||!cn(t.name,!1))}function o$(t,e){return!(!IC(e)||!E0e(t).includes(e))}function G0e(t,e,r){return cn(r,!1)?C0e(t,e).includes(r):!1}function K0e(t,e,r){return cn(r,!1)?A0e(t,e).includes(r):!1}function a$(t,e,r){let n=null;const i=Z0e(t),s=Y0e(e),o=Object.keys(i),a=Object.keys(s),c=c$(Object.keys(t)),u=c$(Object.keys(e)),l=c.filter(d=>!u.includes(d));return l.length&&(n=De("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. Required: ${l.toString()} Received: ${Object.keys(e).toString()}`)),Yh(o,a)||(n=De("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. Required: ${o.toString()} Approved: ${a.toString()}`)),Object.keys(e).forEach(d=>{if(!d.includes(":")||n)return;const h=o1(e[d].accounts);h.includes(d)||(n=De("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${d} Required: ${d} Approved: ${h.toString()}`))}),o.forEach(d=>{n||(Yh(i[d].methods,s[d].methods)?Yh(i[d].events,s[d].events)||(n=De("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${d}`)):n=De("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${d}`))}),n}function Z0e(t){const e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function c$(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function Y0e(t){const e={};return Object.keys(t).forEach(r=>{if(r.includes(":"))e[r]=t[r];else{const n=o1(t[r].accounts);n==null||n.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}}),e}function J0e(t,e){return X9(t,!1)&&t<=e.max&&t>=e.min}function u$(){const t=$v();return new Promise(e=>{switch(t){case Cs.browser:e(Q0e());break;case Cs.reactNative:e(X0e());break;case Cs.node:e(ege());break;default:e(!0)}})}function Q0e(){return n1()&&(navigator==null?void 0:navigator.onLine)}async function X0e(){if(jd()&&typeof global<"u"&&global!=null&&global.NetInfo){const t=await(global==null?void 0:global.NetInfo.fetch());return t==null?void 0:t.isConnected}return!0}function ege(){return!0}function tge(t){switch($v()){case Cs.browser:rge(t);break;case Cs.reactNative:nge(t);break}}function rge(t){!jd()&&n1()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function nge(t){jd()&&typeof global<"u"&&global!=null&&global.NetInfo&&(global==null||global.NetInfo.addEventListener(e=>t(e==null?void 0:e.isConnected)))}function ige(){var t;return n1()&&Iu.getDocument()?((t=Iu.getDocument())==null?void 0:t.visibilityState)==="visible":!0}const G8={};class H1{static get(e){return G8[e]}static set(e,r){G8[e]=r}static delete(e){delete G8[e]}}const sge="PARSE_ERROR",oge="INVALID_REQUEST",age="METHOD_NOT_FOUND",cge="INVALID_PARAMS",UK="INTERNAL_ERROR",e7="SERVER_ERROR",uge=[-32700,-32600,-32601,-32602,-32603],fb={[sge]:{code:-32700,message:"Parse error"},[oge]:{code:-32600,message:"Invalid Request"},[age]:{code:-32601,message:"Method not found"},[cge]:{code:-32602,message:"Invalid params"},[UK]:{code:-32603,message:"Internal error"},[e7]:{code:-32e3,message:"Server error"}},FK=e7;function lge(t){return uge.includes(t)}function l$(t){return Object.keys(fb).includes(t)?fb[t]:fb[FK]}function dge(t){const e=Object.values(fb).find(r=>r.code===t);return e||fb[FK]}function HK(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var K8={},Ac={},d$;function hge(){if(d$)return Ac;d$=1,Object.defineProperty(Ac,"__esModule",{value:!0}),Ac.isBrowserCryptoAvailable=Ac.getSubtleCrypto=Ac.getBrowerCrypto=void 0;function t(){return(Da==null?void 0:Da.crypto)||(Da==null?void 0:Da.msCrypto)||{}}Ac.getBrowerCrypto=t;function e(){const n=t();return n.subtle||n.webkitSubtle}Ac.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return Ac.isBrowserCryptoAvailable=r,Ac}var xc={},h$;function fge(){if(h$)return xc;h$=1,Object.defineProperty(xc,"__esModule",{value:!0}),xc.isBrowser=xc.isNode=xc.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}xc.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}xc.isNode=e;function r(){return!t()&&!e()}return xc.isBrowser=r,xc}var f$;function pge(){return f$||(f$=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=xv;e.__exportStar(hge(),t),e.__exportStar(fge(),t)}(K8)),K8}var gge=pge();function Ta(t=3){const e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function Jh(t=6){return BigInt(Ta(t))}function sd(t,e,r){return{id:r||Ta(),jsonrpc:"2.0",method:t,params:e}}function rA(t,e){return{id:t,jsonrpc:"2.0",result:e}}function nA(t,e,r){return{id:t,jsonrpc:"2.0",error:mge(e)}}function mge(t,e){return typeof t>"u"?l$(UK):(typeof t=="string"&&(t=Object.assign(Object.assign({},l$(e7)),{message:t})),lge(t.code)&&(t=dge(t.code)),t)}let wge=class{},bge=class extends wge{constructor(){super()}},yge=class extends bge{constructor(e){super()}};const vge="^https?:",_ge="^wss?:";function Ege(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function qK(t,e){const r=Ege(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function p$(t){return qK(t,vge)}function g$(t){return qK(t,_ge)}function Cge(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function zK(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function t7(t){return zK(t)&&"method"in t}function iA(t){return zK(t)&&(Ia(t)||eo(t))}function Ia(t){return"result"in t}function eo(t){return"error"in t}let co=class extends yge{constructor(e){super(e),this.events=new ao.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(sd(e.method,e.params||[],e.id||Jh().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{eo(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),iA(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}};const Age=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),xge=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",m$=t=>t.split("?")[0],w$=10,Sge=Age();let Tge=class{constructor(e){if(this.url=e,this.events=new ao.EventEmitter,this.registering=!1,!g$(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Tu(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!g$(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{const i=gge.isReactNative()?void 0:{rejectUnauthorized:!Cge(e)},s=new Sge(e,[],i);xge()?s.onerror=o=>{const a=o;n(this.emitError(a.error))}:s.on("error",o=>{n(this.emitError(o))}),s.onopen=()=>{this.onOpen(s),r(s)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?jf(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=nA(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return HK(e,m$(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>w$&&this.events.setMaxListeners(w$)}emitError(e){const r=this.parseError(new Error((e==null?void 0:e.message)||`WebSocket connection failed for host: ${m$(this.url)}`));return this.events.emit("register_error",r),r}};var Ige={};const WK="wc",VK=2,OI="core",Ja=`${WK}@2:${OI}:`,Pge={logger:"error"},Oge={database:":memory:"},Rge="crypto",b$="client_ed25519_seed",kge=Be.ONE_DAY,Nge="keychain",$ge="0.3",jge="messages",Bge="0.3",y$=Be.SIX_HOURS,Dge="publisher",GK="irn",Mge="error",KK="wss://relay.walletconnect.org",Lge="relayer",xn={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},Uge="_subscription",Hs={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},Fge=.1,RI="2.21.0",Pr={link_mode:"link_mode",relay:"relay"},J4={inbound:"inbound",outbound:"outbound"},Hge="0.3",qge="WALLETCONNECT_CLIENT_ID",v$="WALLETCONNECT_LINK_MODE_APPS",hs={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},zge="subscription",Wge="0.3",Vge="pairing",Gge="0.3",q1={wc_pairingDelete:{req:{ttl:Be.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:Be.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:Be.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:Be.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:Be.ONE_DAY,prompt:!1,tag:0},res:{ttl:Be.ONE_DAY,prompt:!1,tag:0}}},Fh={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},yo={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},Kge="history",Zge="0.3",Yge="expirer",Gs={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},Jge="0.3",Qge="verify-api",Xge="https://verify.walletconnect.com",ZK="https://verify.walletconnect.org",pb=ZK,eme=`${pb}/v3`,tme=[Xge,ZK],rme="echo",nme="https://echo.walletconnect.com",Sa={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal",subscribing_to_pairing_topic:"subscribing_to_pairing_topic"},Vc={no_wss_connection:"no_wss_connection",no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_expired:"proposal_expired",proposal_listener_not_found:"proposal_listener_not_found"},vo={session_approve_started:"session_approve_started",proposal_not_expired:"proposal_not_expired",session_namespaces_validation_success:"session_namespaces_validation_success",create_session_topic:"create_session_topic",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},lh={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},dh={authenticated_session_approve_started:"authenticated_session_approve_started",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve"},z1={no_internet_connection:"no_internet_connection",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},ime=.1,sme="event-client",ome=86400,ame="https://pulse.walletconnect.org/batch";function cme(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,w=new Uint8Array(E);b!==v;){for(var C=g[b],y=0,_=E-1;(C!==0||y>>0,w[_]=C%a>>>0,C=C/a>>>0;if(C!==0)throw new Error("Non-zero carry");m=y,b++}for(var x=E-m;x!==E&&w[x]===0;)x++;for(var A=c.repeat(p);x>>0,E=new Uint8Array(v);g[p];){var w=r[g.charCodeAt(p)];if(w===255)return;for(var C=0,y=v-1;(w!==0||C>>0,E[y]=w%256>>>0,w=w/256>>>0;if(w!==0)throw new Error("Non-zero carry");b=C,p++}if(g[p]!==" "){for(var _=v-b;_!==v&&E[_]===0;)_++;for(var x=new Uint8Array(m+(v-_)),A=m;_!==v;)x[A++]=E[_++];return x}}}function f(g){var p=h(g);if(p)return p;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:h,decode:f}}var ume=cme,lme=ume;const YK=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},dme=t=>new TextEncoder().encode(t),hme=t=>new TextDecoder().decode(t);class fme{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class pme{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return JK(this,e)}}class gme{constructor(e){this.decoders=e}or(e){return JK(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const JK=(t,e)=>new gme({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class mme{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new fme(e,r,n),this.decoder=new pme(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const sA=({name:t,prefix:e,encode:r,decode:n})=>new mme(t,e,r,n),Uv=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=lme(r,e);return sA({prefix:t,name:e,encode:n,decode:s=>YK(i(s))})},wme=(t,e,r,n)=>{const i={};for(let l=0;l=8&&(a-=8,o[u++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o},bme=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<sA({prefix:e,name:t,encode(i){return bme(i,n,r)},decode(i){return wme(i,n,r,t)}}),yme=sA({prefix:"\0",name:"identity",encode:t=>hme(t),decode:t=>dme(t)});var vme=Object.freeze({__proto__:null,identity:yme});const _me=Wn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Eme=Object.freeze({__proto__:null,base2:_me});const Cme=Wn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Ame=Object.freeze({__proto__:null,base8:Cme});const xme=Uv({prefix:"9",name:"base10",alphabet:"0123456789"});var Sme=Object.freeze({__proto__:null,base10:xme});const Tme=Wn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Ime=Wn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Pme=Object.freeze({__proto__:null,base16:Tme,base16upper:Ime});const Ome=Wn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Rme=Wn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),kme=Wn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Nme=Wn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),$me=Wn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),jme=Wn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Bme=Wn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Dme=Wn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Mme=Wn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Lme=Object.freeze({__proto__:null,base32:Ome,base32upper:Rme,base32pad:kme,base32padupper:Nme,base32hex:$me,base32hexupper:jme,base32hexpad:Bme,base32hexpadupper:Dme,base32z:Mme});const Ume=Uv({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Fme=Uv({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Hme=Object.freeze({__proto__:null,base36:Ume,base36upper:Fme});const qme=Uv({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),zme=Uv({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Wme=Object.freeze({__proto__:null,base58btc:qme,base58flickr:zme});const Vme=Wn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Gme=Wn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Kme=Wn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Zme=Wn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Yme=Object.freeze({__proto__:null,base64:Vme,base64pad:Gme,base64url:Kme,base64urlpad:Zme});const QK=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),Jme=QK.reduce((t,e,r)=>(t[r]=e,t),[]),Qme=QK.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Xme(t){return t.reduce((e,r)=>(e+=Jme[r],e),"")}function e1e(t){const e=[];for(const r of t){const n=Qme[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const t1e=sA({prefix:"🚀",name:"base256emoji",encode:Xme,decode:e1e});var r1e=Object.freeze({__proto__:null,base256emoji:t1e}),n1e=XK,_$=128,i1e=-128,s1e=Math.pow(2,31);function XK(t,e,r){e=e||[],r=r||0;for(var n=r;t>=s1e;)e[r++]=t&255|_$,t/=128;for(;t&i1e;)e[r++]=t&255|_$,t>>>=7;return e[r]=t|0,XK.bytes=r-n+1,e}var o1e=kI,a1e=128,E$=127;function kI(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw kI.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&E$)<=a1e);return kI.bytes=s-n,r}var c1e=Math.pow(2,7),u1e=Math.pow(2,14),l1e=Math.pow(2,21),d1e=Math.pow(2,28),h1e=Math.pow(2,35),f1e=Math.pow(2,42),p1e=Math.pow(2,49),g1e=Math.pow(2,56),m1e=Math.pow(2,63),w1e=function(t){return t(eZ.encode(t,e,r),e),A$=t=>eZ.encodingLength(t),NI=(t,e)=>{const r=e.byteLength,n=A$(t),i=n+A$(r),s=new Uint8Array(i+r);return C$(t,s,0),C$(r,s,n),s.set(e,i),new y1e(t,r,e,s)};class y1e{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const tZ=({name:t,code:e,encode:r})=>new v1e(t,e,r);class v1e{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?NI(this.code,r):r.then(n=>NI(this.code,n))}else throw Error("Unknown type, must be binary type")}}const rZ=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),_1e=tZ({name:"sha2-256",code:18,encode:rZ("SHA-256")}),E1e=tZ({name:"sha2-512",code:19,encode:rZ("SHA-512")});var C1e=Object.freeze({__proto__:null,sha256:_1e,sha512:E1e});const nZ=0,A1e="identity",iZ=YK,x1e=t=>NI(nZ,iZ(t)),S1e={code:nZ,name:A1e,encode:iZ,digest:x1e};var T1e=Object.freeze({__proto__:null,identity:S1e});new TextEncoder,new TextDecoder;const x$={...vme,...Eme,...Ame,...Sme,...Pme,...Lme,...Hme,...Wme,...Yme,...r1e};({...C1e,...T1e});function I1e(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function sZ(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const S$=sZ("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Z8=sZ("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=I1e(t.length);for(let r=0;re in t?R1e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ya=(t,e,r)=>k1e(t,typeof e!="symbol"?e+"":e,r);class N1e{constructor(e,r){this.core=e,this.logger=r,ya(this,"keychain",new Map),ya(this,"name",Nge),ya(this,"version",$ge),ya(this,"initialized",!1),ya(this,"storagePrefix",Ja),ya(this,"init",async()=>{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}}),ya(this,"has",n=>(this.isInitialized(),this.keychain.has(n))),ya(this,"set",async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()}),ya(this,"get",n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:s}=De("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i}),ya(this,"del",async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()}),this.core=e,this.logger=si(r,this.name)}get context(){return es(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,bI(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?yI(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=De("NOT_INITIALIZED",this.name);throw new Error(e)}}}var $1e=Object.defineProperty,j1e=(t,e,r)=>e in t?$1e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Nn=(t,e,r)=>j1e(t,typeof e!="symbol"?e+"":e,r);class B1e{constructor(e,r,n){this.core=e,this.logger=r,Nn(this,"name",Rge),Nn(this,"keychain"),Nn(this,"randomSessionIdentifier",PI()),Nn(this,"initialized",!1),Nn(this,"init",async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)}),Nn(this,"hasKeys",i=>(this.isInitialized(),this.keychain.has(i))),Nn(this,"getClientId",async()=>{this.isInitialized();const i=await this.getClientSeed(),s=Gk(i);return yG(s.publicKey)}),Nn(this,"generateKeyPair",()=>{this.isInitialized();const i=r0e();return this.setPrivateKey(i.publicKey,i.privateKey)}),Nn(this,"signJWT",async i=>{this.isInitialized();const s=await this.getClientSeed(),o=Gk(s),a=this.randomSessionIdentifier;return await xue(a,i,kge,o)}),Nn(this,"generateSharedKey",(i,s,o)=>{this.isInitialized();const a=this.getPrivateKey(i),c=n0e(a,s);return this.setSymKey(c,o)}),Nn(this,"setSymKey",async(i,s)=>{this.isInitialized();const o=s||Y4(i);return await this.keychain.set(o,i),o}),Nn(this,"deleteKeyPair",async i=>{this.isInitialized(),await this.keychain.del(i)}),Nn(this,"deleteSymKey",async i=>{this.isInitialized(),await this.keychain.del(i)}),Nn(this,"encode",async(i,s,o)=>{this.isInitialized();const a=DK(o),c=Tu(s);if(QN(a))return o0e(c,o==null?void 0:o.encoding);if(JN(a)){const h=a.senderPublicKey,f=a.receiverPublicKey;i=await this.generateSharedKey(h,f)}const u=this.getSymKey(i),{type:l,senderPublicKey:d}=a;return i0e({type:l,symKey:u,message:c,senderPublicKey:d,encoding:o==null?void 0:o.encoding})}),Nn(this,"decode",async(i,s,o)=>{this.isInitialized();const a=c0e(s,o);if(QN(a)){const c=a0e(s,o==null?void 0:o.encoding);return jf(c)}if(JN(a)){const c=a.receiverPublicKey,u=a.senderPublicKey;i=await this.generateSharedKey(c,u)}try{const c=this.getSymKey(i),u=s0e({symKey:c,encoded:s,encoding:o==null?void 0:o.encoding});return jf(u)}catch(c){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(c)}}),Nn(this,"getPayloadType",(i,s=Lo)=>{const o=sy({encoded:i,encoding:s});return Uf(o.type)}),Nn(this,"getPayloadSenderPublicKey",(i,s=Lo)=>{const o=sy({encoded:i,encoding:s});return o.senderPublicKey?Ki(o.senderPublicKey,Ei):void 0}),this.core=e,this.logger=si(r,this.name),this.keychain=n||new N1e(this.core,this.logger)}get context(){return es(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(b$)}catch{e=PI(),await this.keychain.set(b$,e)}return O1e(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=De("NOT_INITIALIZED",this.name);throw new Error(e)}}}var D1e=Object.defineProperty,M1e=Object.defineProperties,L1e=Object.getOwnPropertyDescriptors,T$=Object.getOwnPropertySymbols,U1e=Object.prototype.hasOwnProperty,F1e=Object.prototype.propertyIsEnumerable,$I=(t,e,r)=>e in t?D1e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,H1e=(t,e)=>{for(var r in e||(e={}))U1e.call(e,r)&&$I(t,r,e[r]);if(T$)for(var r of T$(e))F1e.call(e,r)&&$I(t,r,e[r]);return t},q1e=(t,e)=>M1e(t,L1e(e)),os=(t,e,r)=>$I(t,typeof e!="symbol"?e+"":e,r);class z1e extends Coe{constructor(e,r){super(e,r),this.logger=e,this.core=r,os(this,"messages",new Map),os(this,"messagesWithoutClientAck",new Map),os(this,"name",jge),os(this,"version",Bge),os(this,"initialized",!1),os(this,"storagePrefix",Ja),os(this,"init",async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n);const i=await this.getRelayerMessagesWithoutClientAck();typeof i<"u"&&(this.messagesWithoutClientAck=i),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}}),os(this,"set",async(n,i,s)=>{this.isInitialized();const o=La(i);let a=this.messages.get(n);if(typeof a>"u"&&(a={}),typeof a[o]<"u")return o;if(a[o]=i,this.messages.set(n,a),s===J4.inbound){const c=this.messagesWithoutClientAck.get(n)||{};this.messagesWithoutClientAck.set(n,q1e(H1e({},c),{[o]:i}))}return await this.persist(),o}),os(this,"get",n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i}),os(this,"getWithoutAck",n=>{this.isInitialized();const i={};for(const s of n){const o=this.messagesWithoutClientAck.get(s)||{};i[s]=Object.values(o)}return i}),os(this,"has",(n,i)=>{this.isInitialized();const s=this.get(n),o=La(i);return typeof s[o]<"u"}),os(this,"ack",async(n,i)=>{this.isInitialized();const s=this.messagesWithoutClientAck.get(n);if(typeof s>"u")return;const o=La(i);delete s[o],Object.keys(s).length===0?this.messagesWithoutClientAck.delete(n):this.messagesWithoutClientAck.set(n,s),await this.persist()}),os(this,"del",async n=>{this.isInitialized(),this.messages.delete(n),this.messagesWithoutClientAck.delete(n),await this.persist()}),this.logger=si(e,this.name),this.core=r}get context(){return es(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get storageKeyWithoutClientAck(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name+"_withoutClientAck"}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,bI(e))}async setRelayerMessagesWithoutClientAck(e){await this.core.storage.setItem(this.storageKeyWithoutClientAck,bI(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?yI(e):void 0}async getRelayerMessagesWithoutClientAck(){const e=await this.core.storage.getItem(this.storageKeyWithoutClientAck);return typeof e<"u"?yI(e):void 0}async persist(){await this.setRelayerMessages(this.messages),await this.setRelayerMessagesWithoutClientAck(this.messagesWithoutClientAck)}isInitialized(){if(!this.initialized){const{message:e}=De("NOT_INITIALIZED",this.name);throw new Error(e)}}}var W1e=Object.defineProperty,V1e=Object.defineProperties,G1e=Object.getOwnPropertyDescriptors,I$=Object.getOwnPropertySymbols,K1e=Object.prototype.hasOwnProperty,Z1e=Object.prototype.propertyIsEnumerable,jI=(t,e,r)=>e in t?W1e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,d3=(t,e)=>{for(var r in e||(e={}))K1e.call(e,r)&&jI(t,r,e[r]);if(I$)for(var r of I$(e))Z1e.call(e,r)&&jI(t,r,e[r]);return t},Y8=(t,e)=>V1e(t,G1e(e)),_o=(t,e,r)=>jI(t,typeof e!="symbol"?e+"":e,r);class Y1e extends Aoe{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,_o(this,"events",new ao.EventEmitter),_o(this,"name",Dge),_o(this,"queue",new Map),_o(this,"publishTimeout",Be.toMiliseconds(Be.ONE_MINUTE)),_o(this,"initialPublishTimeout",Be.toMiliseconds(Be.ONE_SECOND*15)),_o(this,"needsTransportRestart",!1),_o(this,"publish",async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});const a=(s==null?void 0:s.ttl)||y$,c=TC(s),u=(s==null?void 0:s.prompt)||!1,l=(s==null?void 0:s.tag)||0,d=(s==null?void 0:s.id)||Jh().toString(),h={topic:n,message:i,opts:{ttl:a,relay:c,prompt:u,tag:l,id:d,attestation:s==null?void 0:s.attestation,tvf:s==null?void 0:s.tvf}},f=`Failed to publish payload, please try again. id:${d} tag:${l}`;try{const g=new Promise(async p=>{const m=({id:v})=>{h.opts.id===v&&(this.removeRequestFromQueue(v),this.relayer.events.removeListener(xn.publish,m),p(h))};this.relayer.events.on(xn.publish,m);const b=id(new Promise((v,E)=>{this.rpcPublish({topic:n,message:i,ttl:a,prompt:u,tag:l,id:d,attestation:s==null?void 0:s.attestation,tvf:s==null?void 0:s.tvf}).then(v).catch(w=>{this.logger.warn(w,w==null?void 0:w.message),E(w)})}),this.initialPublishTimeout,`Failed initial publish, retrying.... id:${d} tag:${l}`);try{await b,this.events.removeListener(xn.publish,m)}catch(v){this.queue.set(d,Y8(d3({},h),{attempt:1})),this.logger.warn(v,v==null?void 0:v.message)}});this.logger.trace({type:"method",method:"publish",params:{id:d,topic:n,message:i,opts:s}}),await id(g,this.publishTimeout,f)}catch(g){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(g),(o=s==null?void 0:s.internal)!=null&&o.throwOnFailedPublish)throw g}finally{this.queue.delete(d)}}),_o(this,"on",(n,i)=>{this.events.on(n,i)}),_o(this,"once",(n,i)=>{this.events.once(n,i)}),_o(this,"off",(n,i)=>{this.events.off(n,i)}),_o(this,"removeListener",(n,i)=>{this.events.removeListener(n,i)}),this.relayer=e,this.logger=si(r,this.name),this.registerEventListeners()}get context(){return es(this.logger)}async rpcPublish(e){var r,n,i,s;const{topic:o,message:a,ttl:c=y$,prompt:u,tag:l,id:d,attestation:h,tvf:f}=e,g={method:rb(TC().protocol).publish,params:d3({topic:o,message:a,ttl:c,prompt:u,tag:l,attestation:h},f),id:d};Ln((r=g.params)==null?void 0:r.prompt)&&((n=g.params)==null||delete n.prompt),Ln((i=g.params)==null?void 0:i.tag)&&((s=g.params)==null||delete s.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:g});const p=await this.relayer.request(g);return this.relayer.events.emit(xn.publish,e),this.logger.debug("Successfully Published Payload"),p}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async(e,r)=>{const n=e.attempt+1;this.queue.set(r,Y8(d3({},e),{attempt:n}));const{topic:i,message:s,opts:o,attestation:a}=e;this.logger.warn({},`Publisher: queue->publishing: ${e.opts.id}, tag: ${e.opts.tag}, attempt: ${n}`),await this.rpcPublish(Y8(d3({},e),{topic:i,message:s,ttl:o.ttl,prompt:o.prompt,tag:o.tag,id:o.id,attestation:a,tvf:o.tvf})),this.logger.warn({},`Publisher: queue->published: ${e.opts.id}`)})}registerEventListeners(){this.relayer.core.heartbeat.on(vp.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(xn.connection_stalled);return}this.checkQueue()}),this.relayer.on(xn.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}var J1e=Object.defineProperty,Q1e=(t,e,r)=>e in t?J1e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Jp=(t,e,r)=>Q1e(t,typeof e!="symbol"?e+"":e,r);class X1e{constructor(){Jp(this,"map",new Map),Jp(this,"set",(e,r)=>{const n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])}),Jp(this,"get",e=>this.map.get(e)||[]),Jp(this,"exists",(e,r)=>this.get(e).includes(r)),Jp(this,"delete",(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,r))return;const i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)}),Jp(this,"clear",()=>{this.map.clear()})}get topics(){return Array.from(this.map.keys())}}var ewe=Object.defineProperty,twe=Object.defineProperties,rwe=Object.getOwnPropertyDescriptors,P$=Object.getOwnPropertySymbols,nwe=Object.prototype.hasOwnProperty,iwe=Object.prototype.propertyIsEnumerable,BI=(t,e,r)=>e in t?ewe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,W1=(t,e)=>{for(var r in e||(e={}))nwe.call(e,r)&&BI(t,r,e[r]);if(P$)for(var r of P$(e))iwe.call(e,r)&&BI(t,r,e[r]);return t},J8=(t,e)=>twe(t,rwe(e)),gr=(t,e,r)=>BI(t,typeof e!="symbol"?e+"":e,r);class swe extends Toe{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,gr(this,"subscriptions",new Map),gr(this,"topicMap",new X1e),gr(this,"events",new ao.EventEmitter),gr(this,"name",zge),gr(this,"version",Wge),gr(this,"pending",new Map),gr(this,"cached",[]),gr(this,"initialized",!1),gr(this,"storagePrefix",Ja),gr(this,"subscribeTimeout",Be.toMiliseconds(Be.ONE_MINUTE)),gr(this,"initialSubscribeTimeout",Be.toMiliseconds(Be.ONE_SECOND*15)),gr(this,"clientId"),gr(this,"batchSubscribeTopicsLimit",500),gr(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),await this.restore()),this.initialized=!0}),gr(this,"subscribe",async(n,i)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const s=TC(i),o={topic:n,relay:s,transportType:i==null?void 0:i.transportType};this.pending.set(n,o);const a=await this.rpcSubscribe(n,s,i);return typeof a=="string"&&(this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}}),gr(this,"unsubscribe",async(n,i)=>{this.isInitialized(),typeof(i==null?void 0:i.id)<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)}),gr(this,"isSubscribed",n=>new Promise(i=>{i(this.topicMap.topics.includes(n))})),gr(this,"isKnownTopic",n=>new Promise(i=>{i(this.topicMap.topics.includes(n)||this.pending.has(n)||this.cached.some(s=>s.topic===n))})),gr(this,"on",(n,i)=>{this.events.on(n,i)}),gr(this,"once",(n,i)=>{this.events.once(n,i)}),gr(this,"off",(n,i)=>{this.events.off(n,i)}),gr(this,"removeListener",(n,i)=>{this.events.removeListener(n,i)}),gr(this,"start",async()=>{await this.onConnect()}),gr(this,"stop",async()=>{await this.onDisconnect()}),gr(this,"restart",async()=>{await this.restore(),await this.onRestart()}),gr(this,"checkPending",async()=>{if(this.pending.size===0&&(!this.initialized||!this.relayer.connected))return;const n=[];this.pending.forEach(i=>{n.push(i)}),await this.batchSubscribe(n)}),gr(this,"registerEventListeners",()=>{this.relayer.core.heartbeat.on(vp.pulse,async()=>{await this.checkPending()}),this.events.on(hs.created,async n=>{const i=hs.created;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,data:n}),await this.persist()}),this.events.on(hs.deleted,async n=>{const i=hs.deleted;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,data:n}),await this.persist()})}),this.relayer=e,this.logger=si(r,this.name),this.clientId=""}get context(){return es(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}get hasAnyTopics(){return this.topicMap.topics.length>0||this.pending.size>0||this.cached.length>0||this.subscriptions.size>0}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}reset(){this.cached=[],this.initialized=!0}onDisable(){this.values.length>0&&(this.cached=this.values),this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){const n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{const i=TC(n);await this.restartToComplete({topic:e,id:r,relay:i}),await this.rpcUnsubscribe(e,r,i);const s=sr("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r,n){var i;(!n||(n==null?void 0:n.transportType)===Pr.relay)&&await this.restartToComplete({topic:e,id:e,relay:r});const s={method:rb(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s});const o=(i=n==null?void 0:n.internal)==null?void 0:i.throwOnFailedPublish;try{const a=await this.getSubscriptionId(e);if((n==null?void 0:n.transportType)===Pr.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(s).catch(l=>this.logger.warn(l))},Be.toMiliseconds(Be.ONE_SECOND)),a;const c=new Promise(async l=>{const d=h=>{h.topic===e&&(this.events.removeListener(hs.created,d),l(h.id))};this.events.on(hs.created,d);try{const h=await id(new Promise((f,g)=>{this.relayer.request(s).catch(p=>{this.logger.warn(p,p==null?void 0:p.message),g(p)}).then(f)}),this.initialSubscribeTimeout,`Subscribing to ${e} failed, please try again`);this.events.removeListener(hs.created,d),l(h)}catch{}}),u=await id(c,this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!u&&o)throw new Error(`Subscribing to ${e} failed, please try again`);return u?a:null}catch(a){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(xn.connection_stalled),o)throw a}return null}async rpcBatchSubscribe(e){if(!e.length)return;const r=e[0].relay,n={method:rb(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{await await id(new Promise(i=>{this.relayer.request(n).catch(s=>this.logger.warn(s)).then(i)}),this.subscribeTimeout,"rpcBatchSubscribe failed, please try again")}catch{this.relayer.events.emit(xn.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const r=e[0].relay,n={method:rb(r.protocol).batchFetchMessages,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await id(new Promise((s,o)=>{this.relayer.request(n).catch(a=>{this.logger.warn(a),o(a)}).then(s)}),this.subscribeTimeout,"rpcBatchFetchMessages failed, please try again")}catch{this.relayer.events.emit(xn.connection_stalled)}return i}rpcUnsubscribe(e,r,n){const i={method:rb(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,J8(W1({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,W1({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,W1({},r)),this.topicMap.set(r.topic,e),this.events.emit(hs.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const r=this.subscriptions.get(e);if(!r){const{message:n}=De("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(hs.deleted,J8(W1({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(hs.sync)}async onRestart(){if(this.cached.length){const e=[...this.cached],r=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let n=0;n"u"||!e.length)return;if(this.subscriptions.size){const{message:r}=De("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){e.length&&(await this.rpcBatchSubscribe(e),this.onBatchSubscribe(await Promise.all(e.map(async r=>J8(W1({},r),{id:await this.getSubscriptionId(r.topic)})))))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(await qhe(Be.toMiliseconds(Be.ONE_SECOND)),await this.relayer.handleBatchMessageEvents(r.messages))}async onConnect(){await this.restart(),this.reset()}onDisconnect(){this.onDisable()}isInitialized(){if(!this.initialized){const{message:e}=De("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(e){!this.relayer.connected&&!this.relayer.connecting&&(this.cached.push(e),await this.relayer.transportOpen())}async getClientId(){return this.clientId||(this.clientId=await this.relayer.core.crypto.getClientId()),this.clientId}async getSubscriptionId(e){return La(e+await this.getClientId())}}var owe=Object.defineProperty,O$=Object.getOwnPropertySymbols,awe=Object.prototype.hasOwnProperty,cwe=Object.prototype.propertyIsEnumerable,DI=(t,e,r)=>e in t?owe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,R$=(t,e)=>{for(var r in e||(e={}))awe.call(e,r)&&DI(t,r,e[r]);if(O$)for(var r of O$(e))cwe.call(e,r)&&DI(t,r,e[r]);return t},Ft=(t,e,r)=>DI(t,typeof e!="symbol"?e+"":e,r);class uwe extends xoe{constructor(e){super(e),Ft(this,"protocol","wc"),Ft(this,"version",2),Ft(this,"core"),Ft(this,"logger"),Ft(this,"events",new ao.EventEmitter),Ft(this,"provider"),Ft(this,"messages"),Ft(this,"subscriber"),Ft(this,"publisher"),Ft(this,"name",Lge),Ft(this,"transportExplicitlyClosed",!1),Ft(this,"initialized",!1),Ft(this,"connectionAttemptInProgress",!1),Ft(this,"relayUrl"),Ft(this,"projectId"),Ft(this,"packageName"),Ft(this,"bundleId"),Ft(this,"hasExperiencedNetworkDisruption",!1),Ft(this,"pingTimeout"),Ft(this,"heartBeatTimeout",Be.toMiliseconds(Be.THIRTY_SECONDS+Be.FIVE_SECONDS)),Ft(this,"reconnectTimeout"),Ft(this,"connectPromise"),Ft(this,"reconnectInProgress",!1),Ft(this,"requestsInFlight",[]),Ft(this,"connectTimeout",Be.toMiliseconds(Be.ONE_SECOND*15)),Ft(this,"request",async r=>{var n,i;this.logger.debug("Publishing Request Payload");const s=r.id||Jh().toString();await this.toEstablishConnection();try{this.logger.trace({id:s,method:r.method,topic:(n=r.params)==null?void 0:n.topic},"relayer.request - publishing...");const o=`${s}:${((i=r.params)==null?void 0:i.tag)||""}`;this.requestsInFlight.push(o);const a=await this.provider.request(r);return this.requestsInFlight=this.requestsInFlight.filter(c=>c!==o),a}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}}),Ft(this,"resetPingTimeout",()=>{xC()&&(clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,n,i,s;try{this.logger.debug({},"pingTimeout: Connection stalled, terminating..."),(s=(i=(n=(r=this.provider)==null?void 0:r.connection)==null?void 0:n.socket)==null?void 0:i.terminate)==null||s.call(i)}catch(o){this.logger.warn(o,o==null?void 0:o.message)}},this.heartBeatTimeout))}),Ft(this,"onPayloadHandler",r=>{this.onProviderPayload(r),this.resetPingTimeout()}),Ft(this,"onConnectHandler",()=>{this.logger.warn({},"Relayer connected 🛜"),this.startPingTimeout(),this.events.emit(xn.connect)}),Ft(this,"onDisconnectHandler",()=>{this.logger.warn({},"Relayer disconnected 🛑"),this.requestsInFlight=[],this.onProviderDisconnect()}),Ft(this,"onProviderErrorHandler",r=>{this.logger.fatal(`Fatal socket error: ${r.message}`),this.events.emit(xn.error,r),this.logger.fatal("Fatal socket error received, closing transport"),this.transportClose()}),Ft(this,"registerProviderListeners",()=>{this.provider.on(Hs.payload,this.onPayloadHandler),this.provider.on(Hs.connect,this.onConnectHandler),this.provider.on(Hs.disconnect,this.onDisconnectHandler),this.provider.on(Hs.error,this.onProviderErrorHandler)}),this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?si(e.logger,this.name):Tv(Xm({level:e.logger||Mge})),this.messages=new z1e(this.logger,e.core),this.subscriber=new swe(this,this.logger),this.publisher=new Y1e(this,this.logger),this.relayUrl=(e==null?void 0:e.relayUrl)||KK,this.projectId=e.projectId,The()?this.packageName=_N():Ihe()&&(this.bundleId=_N()),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.hasAnyTopics)try{await this.transportOpen()}catch(e){this.logger.warn(e,e==null?void 0:e.message)}}get context(){return es(this.logger)}get connected(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===1||!1}get connecting(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===0||this.connectPromise!==void 0||!1}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now(),transportType:Pr.relay},J4.outbound)}async subscribe(e,r){var n,i,s;this.isInitialized(),(!(r!=null&&r.transportType)||(r==null?void 0:r.transportType)==="relay")&&await this.toEstablishConnection();const o=typeof((n=r==null?void 0:r.internal)==null?void 0:n.throwOnFailedPublish)>"u"?!0:(i=r==null?void 0:r.internal)==null?void 0:i.throwOnFailedPublish;let a=((s=this.subscriber.topicMap.get(e))==null?void 0:s[0])||"",c;const u=l=>{l.topic===e&&(this.subscriber.off(hs.created,u),c())};return await Promise.all([new Promise(l=>{c=l,this.subscriber.on(hs.created,u)}),new Promise(async(l,d)=>{a=await this.subscriber.subscribe(e,R$({internal:{throwOnFailedPublish:o}},r)).catch(h=>{o&&d(h)})||a,l()})]),a}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportDisconnect(){this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await id(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){if(!this.subscriber.hasAnyTopics){this.logger.warn("Starting WS connection skipped because the client has no topics to work with.");return}if(this.connectPromise?(this.logger.debug({},"Waiting for existing connection attempt to resolve..."),await this.connectPromise,this.logger.debug({},"Existing connection attempt resolved")):(this.connectPromise=new Promise(async(r,n)=>{await this.connect(e).then(r).catch(n).finally(()=>{this.connectPromise=void 0})}),await this.connectPromise),!this.connected)throw new Error(`Couldn't establish socket connection to the relay server: ${this.relayUrl}`)}async restartTransport(e){this.logger.debug({},"Restarting transport..."),!this.connectionAttemptInProgress&&(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await u$())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if((e==null?void 0:e.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const r=e.sort((n,i)=>n.publishedAt-i.publishedAt);this.logger.debug(`Batch of ${r.length} message events sorted`);for(const n of r)try{await this.onMessageEvent(n)}catch(i){this.logger.warn(i,"Error while processing batch message event: "+(i==null?void 0:i.message))}this.logger.trace(`Batch of ${r.length} message events processed`)}async onLinkMessageEvent(e,r){const{topic:n}=e;if(!r.sessionExists){const i=gn(Be.FIVE_MINUTES),s={topic:n,expiry:i,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,s)}this.events.emit(xn.message,e),await this.recordMessageEvent(e,J4.inbound)}async connect(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;let r=1;for(;r<6;){try{if(this.transportExplicitlyClosed)break;this.logger.debug({},`Connecting to ${this.relayUrl}, attempt: ${r}...`),await this.createProvider(),await new Promise(async(n,i)=>{const s=()=>{i(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(Hs.disconnect,s),await id(new Promise((o,a)=>{this.provider.connect().then(o).catch(a)}),this.connectTimeout,`Socket stalled when trying to connect to ${this.relayUrl}`).catch(o=>{i(o)}).finally(()=>{this.provider.off(Hs.disconnect,s),clearTimeout(this.reconnectTimeout)}),await new Promise(async(o,a)=>{const c=()=>{a(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(Hs.disconnect,c),await this.subscriber.start().then(o).catch(a).finally(()=>{this.provider.off(Hs.disconnect,c)})}),this.hasExperiencedNetworkDisruption=!1,n()})}catch(n){await this.subscriber.stop();const i=n;this.logger.warn({},i.message),this.hasExperiencedNetworkDisruption=!0}finally{this.connectionAttemptInProgress=!1}if(this.connected){this.logger.debug({},`Connected to ${this.relayUrl} successfully on attempt: ${r}`);break}await new Promise(n=>setTimeout(n,Be.toMiliseconds(r*1))),r++}}startPingTimeout(){var e,r,n,i,s;if(xC())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((s=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||s.on("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o,o==null?void 0:o.message)}}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new co(new Tge(Nhe({sdkVersion:RI,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId,packageName:this.packageName}))),this.registerProviderListeners()}async recordMessageEvent(e,r){const{topic:n,message:i}=e;await this.messages.set(n,i,r)}async shouldIgnoreMessageEvent(e){const{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.warn(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isKnownTopic(r))return this.logger.warn(`Ignoring message for unknown topic ${r}`),!0;const i=this.messages.has(r,n);return i&&this.logger.warn(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),t7(e)){if(!e.method.endsWith(Uge))return;const r=e.params,{topic:n,message:i,publishedAt:s,attestation:o}=r.data,a={topic:n,message:i,publishedAt:s,transportType:Pr.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(R$({type:"event",event:r.id},a)),this.events.emit(r.id,a),await this.acknowledgePayload(e),await this.onMessageEvent(a)}else iA(e)&&this.events.emit(xn.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(await this.recordMessageEvent(e,J4.inbound),this.events.emit(xn.message,e))}async acknowledgePayload(e){const r=rA(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Hs.payload,this.onPayloadHandler),this.provider.off(Hs.connect,this.onConnectHandler),this.provider.off(Hs.disconnect,this.onDisconnectHandler),this.provider.off(Hs.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await u$();tge(async r=>{e!==r&&(e=r,r?await this.transportOpen().catch(n=>this.logger.error(n,n==null?void 0:n.message)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))}),this.core.heartbeat.on(vp.pulse,async()=>{if(!this.transportExplicitlyClosed&&!this.connected&&ige())try{await this.confirmOnlineStateOrThrow(),await this.transportOpen()}catch(r){this.logger.warn(r,r==null?void 0:r.message)}})}async onProviderDisconnect(){clearTimeout(this.pingTimeout),this.events.emit(xn.disconnect),this.connectionAttemptInProgress=!1,!this.reconnectInProgress&&(this.reconnectInProgress=!0,await this.subscriber.stop(),this.subscriber.hasAnyTopics&&(this.transportExplicitlyClosed||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e,e==null?void 0:e.message)),this.reconnectTimeout=void 0,this.reconnectInProgress=!1},Be.toMiliseconds(Fge)))))}isInitialized(){if(!this.initialized){const{message:e}=De("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectPromise){await this.connectPromise;return}await this.connect()}}}function lwe(){}function k$(t){if(!t||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);return e===null||e===Object.prototype||Object.getPrototypeOf(e)===null?Object.prototype.toString.call(t)==="[object Object]":!1}function N$(t){return Object.getOwnPropertySymbols(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}function $$(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const dwe="[object RegExp]",hwe="[object String]",fwe="[object Number]",pwe="[object Boolean]",j$="[object Arguments]",gwe="[object Symbol]",mwe="[object Date]",wwe="[object Map]",bwe="[object Set]",ywe="[object Array]",vwe="[object Function]",_we="[object ArrayBuffer]",Q8="[object Object]",Ewe="[object Error]",Cwe="[object DataView]",Awe="[object Uint8Array]",xwe="[object Uint8ClampedArray]",Swe="[object Uint16Array]",Twe="[object Uint32Array]",Iwe="[object BigUint64Array]",Pwe="[object Int8Array]",Owe="[object Int16Array]",Rwe="[object Int32Array]",kwe="[object BigInt64Array]",Nwe="[object Float32Array]",$we="[object Float64Array]";function jwe(t,e){return t===e||Number.isNaN(t)&&Number.isNaN(e)}function Bwe(t,e,r){return nb(t,e,void 0,void 0,void 0,void 0,r)}function nb(t,e,r,n,i,s,o){const a=o(t,e,r,n,i,s);if(a!==void 0)return a;if(typeof t==typeof e)switch(typeof t){case"bigint":case"string":case"boolean":case"symbol":case"undefined":return t===e;case"number":return t===e||Object.is(t,e);case"function":return t===e;case"object":return gb(t,e,s,o)}return gb(t,e,s,o)}function gb(t,e,r,n){if(Object.is(t,e))return!0;let i=$$(t),s=$$(e);if(i===j$&&(i=Q8),s===j$&&(s=Q8),i!==s)return!1;switch(i){case hwe:return t.toString()===e.toString();case fwe:{const c=t.valueOf(),u=e.valueOf();return jwe(c,u)}case pwe:case mwe:case gwe:return Object.is(t.valueOf(),e.valueOf());case dwe:return t.source===e.source&&t.flags===e.flags;case vwe:return t===e}r=r??new Map;const o=r.get(t),a=r.get(e);if(o!=null&&a!=null)return o===e;r.set(t,e),r.set(e,t);try{switch(i){case wwe:{if(t.size!==e.size)return!1;for(const[c,u]of t.entries())if(!e.has(c)||!nb(u,e.get(c),c,t,e,r,n))return!1;return!0}case bwe:{if(t.size!==e.size)return!1;const c=Array.from(t.values()),u=Array.from(e.values());for(let l=0;lnb(d,f,void 0,t,e,r,n));if(h===-1)return!1;u.splice(h,1)}return!0}case ywe:case Awe:case xwe:case Swe:case Twe:case Iwe:case Pwe:case Owe:case Rwe:case kwe:case Nwe:case $we:{if(typeof Buffer<"u"&&Buffer.isBuffer(t)!==Buffer.isBuffer(e)||t.length!==e.length)return!1;for(let c=0;ce in t?Mwe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,D$=(t,e)=>{for(var r in e||(e={}))Lwe.call(e,r)&&MI(t,r,e[r]);if(B$)for(var r of B$(e))Uwe.call(e,r)&&MI(t,r,e[r]);return t},Di=(t,e,r)=>MI(t,typeof e!="symbol"?e+"":e,r);class Ep extends Soe{constructor(e,r,n,i=Ja,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,Di(this,"map",new Map),Di(this,"version",Hge),Di(this,"cached",[]),Di(this,"initialized",!1),Di(this,"getKey"),Di(this,"storagePrefix",Ja),Di(this,"recentlyDeleted",[]),Di(this,"recentlyDeletedLimit",200),Di(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!Ln(o)?this.map.set(this.getKey(o),o):k0e(o)?this.map.set(o.id,o):N0e(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)}),Di(this,"set",async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())}),Di(this,"get",o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o))),Di(this,"getAll",o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(c=>Dwe(a[c],o[c]))):this.values)),Di(this,"update",async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const c=D$(D$({},this.getData(o)),a);this.map.set(o,c),await this.persist()}),Di(this,"delete",async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())}),this.logger=si(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return es(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){const{message:i}=De("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}const{message:n}=De("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:r}=De("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=De("NOT_INITIALIZED",this.name);throw new Error(e)}}}var Fwe=Object.defineProperty,Hwe=(t,e,r)=>e in t?Fwe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Pt=(t,e,r)=>Hwe(t,typeof e!="symbol"?e+"":e,r);class qwe{constructor(e,r){this.core=e,this.logger=r,Pt(this,"name",Vge),Pt(this,"version",Gge),Pt(this,"events",new R9),Pt(this,"pairings"),Pt(this,"initialized",!1),Pt(this,"storagePrefix",Ja),Pt(this,"ignoredPayloadTypes",[Eu]),Pt(this,"registeredMethods",[]),Pt(this,"init",async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))}),Pt(this,"register",({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]}),Pt(this,"create",async n=>{this.isInitialized();const i=PI(),s=await this.core.crypto.setSymKey(i),o=gn(Be.FIVE_MINUTES),a={protocol:GK},c={topic:s,expiry:o,relay:a,active:!1,methods:n==null?void 0:n.methods},u=e$({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:a,expiryTimestamp:o,methods:n==null?void 0:n.methods});return this.events.emit(Fh.create,c),this.core.expirer.set(s,o),await this.pairings.set(s,c),await this.core.relayer.subscribe(s,{transportType:n==null?void 0:n.transportType}),{topic:s,uri:u}}),Pt(this,"pair",async n=>{this.isInitialized();const i=this.core.eventClient.createEvent({properties:{topic:n==null?void 0:n.uri,trace:[Sa.pairing_started]}});this.isValidPair(n,i);const{topic:s,symKey:o,relay:a,expiryTimestamp:c,methods:u}=XN(n.uri);i.props.properties.topic=s,i.addTrace(Sa.pairing_uri_validation_success),i.addTrace(Sa.pairing_uri_not_expired);let l;if(this.pairings.keys.includes(s)){if(l=this.pairings.get(s),i.addTrace(Sa.existing_pairing),l.active)throw i.setError(Vc.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);i.addTrace(Sa.pairing_not_expired)}const d=c||gn(Be.FIVE_MINUTES),h={topic:s,relay:a,expiry:d,active:!1,methods:u};this.core.expirer.set(s,d),await this.pairings.set(s,h),i.addTrace(Sa.store_new_pairing),n.activatePairing&&await this.activate({topic:s}),this.events.emit(Fh.create,h),i.addTrace(Sa.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),i.addTrace(Sa.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{i.setError(Vc.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:a})}catch(f){throw i.setError(Vc.subscribe_pairing_topic_failure),f}return i.addTrace(Sa.subscribe_pairing_topic_success),h}),Pt(this,"activate",async({topic:n})=>{this.isInitialized();const i=gn(Be.FIVE_MINUTES);this.core.expirer.set(n,i),await this.pairings.update(n,{active:!0,expiry:i})}),Pt(this,"ping",async n=>{this.isInitialized(),await this.isValidPing(n),this.logger.warn("ping() is deprecated and will be removed in the next major release.");const{topic:i}=n;if(this.pairings.keys.includes(i)){const s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:c}=jh();this.events.once(Kt("pairing_ping",s),({error:u})=>{u?c(u):a()}),await o()}}),Pt(this,"updateExpiry",async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})}),Pt(this,"updateMetadata",async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})}),Pt(this,"getPairings",()=>(this.isInitialized(),this.pairings.values)),Pt(this,"disconnect",async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",sr("USER_DISCONNECTED")),await this.deletePairing(i))}),Pt(this,"formatUriFromPairing",n=>{this.isInitialized();const{topic:i,relay:s,expiry:o,methods:a}=n,c=this.core.crypto.keychain.get(i);return e$({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:c,relay:s,expiryTimestamp:o,methods:a})}),Pt(this,"sendRequest",async(n,i,s)=>{const o=sd(i,s),a=await this.core.crypto.encode(n,o),c=q1[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,a,c),o.id}),Pt(this,"sendResult",async(n,i,s)=>{const o=rA(n,s),a=await this.core.crypto.encode(i,o),c=(await this.core.history.get(i,n)).request.method,u=q1[c].res;await this.core.relayer.publish(i,a,u),await this.core.history.resolve(o)}),Pt(this,"sendError",async(n,i,s)=>{const o=nA(n,s),a=await this.core.crypto.encode(i,o),c=(await this.core.history.get(i,n)).request.method,u=q1[c]?q1[c].res:q1.unregistered_method.res;await this.core.relayer.publish(i,a,u),await this.core.history.resolve(o)}),Pt(this,"deletePairing",async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,sr("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])}),Pt(this,"cleanup",async()=>{const n=this.pairings.getAll().filter(i=>Bl(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))}),Pt(this,"onRelayEventRequest",async n=>{const{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return await this.onPairingPingRequest(i,s);case"wc_pairingDelete":return await this.onPairingDeleteRequest(i,s);default:return await this.onUnknownRpcMethodRequest(i,s)}}),Pt(this,"onRelayEventResponse",async n=>{const{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}}),Pt(this,"onPairingPingRequest",async(n,i)=>{const{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(Fh.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}}),Pt(this,"onPairingPingResponse",(n,i)=>{const{id:s}=i;setTimeout(()=>{Ia(i)?this.events.emit(Kt("pairing_ping",s),{}):eo(i)&&this.events.emit(Kt("pairing_ping",s),{error:i.error})},500)}),Pt(this,"onPairingDeleteRequest",async(n,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(Fh.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}}),Pt(this,"onUnknownRpcMethodRequest",async(n,i)=>{const{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;const a=sr("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}}),Pt(this,"onUnknownRpcMethodResponse",n=>{this.registeredMethods.includes(n)||this.logger.error(sr("WC_METHOD_UNSUPPORTED",n))}),Pt(this,"isValidPair",(n,i)=>{var s;if(!Fi(n)){const{message:a}=De("MISSING_OR_INVALID",`pair() params: ${n}`);throw i.setError(Vc.malformed_pairing_uri),new Error(a)}if(!R0e(n.uri)){const{message:a}=De("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw i.setError(Vc.malformed_pairing_uri),new Error(a)}const o=XN(n==null?void 0:n.uri);if(!((s=o==null?void 0:o.relay)!=null&&s.protocol)){const{message:a}=De("MISSING_OR_INVALID","pair() uri#relay-protocol");throw i.setError(Vc.malformed_pairing_uri),new Error(a)}if(!(o!=null&&o.symKey)){const{message:a}=De("MISSING_OR_INVALID","pair() uri#symKey");throw i.setError(Vc.malformed_pairing_uri),new Error(a)}if(o!=null&&o.expiryTimestamp&&Be.toMiliseconds(o==null?void 0:o.expiryTimestamp){if(!Fi(n)){const{message:s}=De("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)}),Pt(this,"isValidDisconnect",async n=>{if(!Fi(n)){const{message:s}=De("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)}),Pt(this,"isValidPairingTopic",async n=>{if(!cn(n,!1)){const{message:i}=De("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=De("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(Bl(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=De("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}}),this.core=e,this.logger=si(r,this.name),this.pairings=new Ep(this.core,this.logger,this.name,this.storagePrefix)}get context(){return es(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=De("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(xn.message,async e=>{const{topic:r,message:n,transportType:i}=e;if(this.pairings.keys.includes(r)&&i!==Pr.link_mode&&!this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))try{const s=await this.core.crypto.decode(r,n);t7(s)?(this.core.history.set(r,s),await this.onRelayEventRequest({topic:r,payload:s})):iA(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:r,payload:s}),this.core.history.delete(r,s.id)),await this.core.relayer.messages.ack(r,n)}catch(s){this.logger.error(s)}})}registerExpirerEvents(){this.core.expirer.on(Gs.expired,async e=>{const{topic:r}=iK(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(Fh.expire,{topic:r}))})}}var zwe=Object.defineProperty,Wwe=(t,e,r)=>e in t?zwe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$n=(t,e,r)=>Wwe(t,typeof e!="symbol"?e+"":e,r);class Vwe extends Eoe{constructor(e,r){super(e,r),this.core=e,this.logger=r,$n(this,"records",new Map),$n(this,"events",new ao.EventEmitter),$n(this,"name",Kge),$n(this,"version",Zge),$n(this,"cached",[]),$n(this,"initialized",!1),$n(this,"storagePrefix",Ja),$n(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),$n(this,"set",(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;const o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:gn(Be.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(yo.created,o)}),$n(this,"resolve",async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=eo(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(yo.updated,i))}),$n(this,"get",async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i))),$n(this,"delete",(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(yo.deleted,s)}}),this.persist()}),$n(this,"exists",async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1)),$n(this,"on",(n,i)=>{this.events.on(n,i)}),$n(this,"once",(n,i)=>{this.events.once(n,i)}),$n(this,"off",(n,i)=>{this.events.off(n,i)}),$n(this,"removeListener",(n,i)=>{this.events.removeListener(n,i)}),this.logger=si(r,this.name)}get context(){return es(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;const n={topic:r.topic,request:sd(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const r=this.records.get(e);if(!r){const{message:n}=De("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(yo.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:r}=De("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(yo.created,e=>{const r=yo.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(yo.updated,e=>{const r=yo.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(yo.deleted,e=>{const r=yo.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on(vp.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{Be.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(yo.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=De("NOT_INITIALIZED",this.name);throw new Error(e)}}}var Gwe=Object.defineProperty,Kwe=(t,e,r)=>e in t?Gwe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Kn=(t,e,r)=>Kwe(t,typeof e!="symbol"?e+"":e,r);class Zwe extends Ioe{constructor(e,r){super(e,r),this.core=e,this.logger=r,Kn(this,"expirations",new Map),Kn(this,"events",new ao.EventEmitter),Kn(this,"name",Yge),Kn(this,"version",Jge),Kn(this,"cached",[]),Kn(this,"initialized",!1),Kn(this,"storagePrefix",Ja),Kn(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),Kn(this,"has",n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}}),Kn(this,"set",(n,i)=>{this.isInitialized();const s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Gs.created,{target:s,expiration:o})}),Kn(this,"get",n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)}),Kn(this,"del",n=>{if(this.isInitialized(),this.has(n)){const i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Gs.deleted,{target:i,expiration:s})}}),Kn(this,"on",(n,i)=>{this.events.on(n,i)}),Kn(this,"once",(n,i)=>{this.events.once(n,i)}),Kn(this,"off",(n,i)=>{this.events.off(n,i)}),Kn(this,"removeListener",(n,i)=>{this.events.removeListener(n,i)}),this.logger=si(r,this.name)}get context(){return es(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return $he(e);if(typeof e=="number")return jhe(e);const{message:r}=De("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Gs.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=De("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const r=this.expirations.get(e);if(!r){const{message:n}=De("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return r}checkExpiry(e,r){const{expiry:n}=r;Be.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Gs.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(vp.pulse,()=>this.checkExpirations()),this.events.on(Gs.created,e=>{const r=Gs.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Gs.expired,e=>{const r=Gs.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Gs.deleted,e=>{const r=Gs.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=De("NOT_INITIALIZED",this.name);throw new Error(e)}}}var Ywe=Object.defineProperty,Jwe=(t,e,r)=>e in t?Ywe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,on=(t,e,r)=>Jwe(t,typeof e!="symbol"?e+"":e,r);class Qwe extends Poe{constructor(e,r,n){super(e,r,n),this.core=e,this.logger=r,this.store=n,on(this,"name",Qge),on(this,"abortController"),on(this,"isDevEnv"),on(this,"verifyUrlV3",eme),on(this,"storagePrefix",Ja),on(this,"version",VK),on(this,"publicKey"),on(this,"fetchPromise"),on(this,"init",async()=>{var i;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&Be.toMiliseconds((i=this.publicKey)==null?void 0:i.expiresAt){if(!n1()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:a}=i,c=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${a}`;try{const u=Iu.getDocument(),l=this.startAbortTimer(Be.ONE_SECOND*5),d=await new Promise((h,f)=>{const g=()=>{window.removeEventListener("message",m),u.body.removeChild(p),f("attestation aborted")};this.abortController.signal.addEventListener("abort",g);const p=u.createElement("iframe");p.src=c,p.style.display="none",p.addEventListener("error",g,{signal:this.abortController.signal});const m=b=>{if(b.data&&typeof b.data=="string")try{const v=JSON.parse(b.data);if(v.type==="verify_attestation"){if(lI(v.attestation).payload.id!==o)return;clearInterval(l),u.body.removeChild(p),this.abortController.signal.removeEventListener("abort",g),window.removeEventListener("message",m),h(v.attestation===null?"":v.attestation)}}catch(v){this.logger.warn(v)}};u.body.appendChild(p),window.addEventListener("message",m,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",d),d}catch(u){this.logger.warn(u)}return""}),on(this,"resolve",async i=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:a}=i;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(lI(s).payload.id!==a)return;const u=await this.isValidJwtAttestation(s);if(u){if(!u.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return u}}if(!o)return;const c=this.getVerifyUrl(i==null?void 0:i.verifyUrl);return this.fetchAttestation(o,c)}),on(this,"fetchAttestation",async(i,s)=>{this.logger.debug(`resolving attestation: ${i} from url: ${s}`);const o=this.startAbortTimer(Be.ONE_SECOND*5),a=await fetch(`${s}/attestation/${i}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),a.status===200?await a.json():void 0}),on(this,"getVerifyUrl",i=>{let s=i||pb;return tme.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${pb}`),s=pb),s}),on(this,"fetchPublicKey",async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const i=this.startAbortTimer(Be.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(i),await s.json()}catch(i){this.logger.warn(i)}}),on(this,"persistPublicKey",async i=>{this.logger.debug("persisting public key to local storage",i),await this.store.setItem(this.storeKey,i),this.publicKey=i}),on(this,"removePublicKey",async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0}),on(this,"isValidJwtAttestation",async i=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(i,s)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(i,o)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}}),on(this,"getPublicKey",async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey()),on(this,"fetchAndPersistPublicKey",async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const i=await this.fetchPromise;return this.fetchPromise=void 0,i}),on(this,"validateAttestation",(i,s)=>{const o=l0e(i,s.publicKey),a={hasExpired:Be.toMiliseconds(o.exp)this.abortController.abort(),Be.toMiliseconds(e))}}var Xwe=Object.defineProperty,ebe=(t,e,r)=>e in t?Xwe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,M$=(t,e,r)=>ebe(t,typeof e!="symbol"?e+"":e,r);class tbe extends Ooe{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,M$(this,"context",rme),M$(this,"registerDeviceToken",async n=>{const{clientId:i,token:s,notificationType:o,enableEncrypted:a=!1}=n,c=`${nme}/${this.projectId}/clients`;await fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:a})})}),this.logger=si(r,this.context)}}var rbe=Object.defineProperty,L$=Object.getOwnPropertySymbols,nbe=Object.prototype.hasOwnProperty,ibe=Object.prototype.propertyIsEnumerable,LI=(t,e,r)=>e in t?rbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,V1=(t,e)=>{for(var r in e||(e={}))nbe.call(e,r)&&LI(t,r,e[r]);if(L$)for(var r of L$(e))ibe.call(e,r)&&LI(t,r,e[r]);return t},wn=(t,e,r)=>LI(t,typeof e!="symbol"?e+"":e,r);class sbe extends Roe{constructor(e,r,n=!0){super(e,r,n),this.core=e,this.logger=r,wn(this,"context",sme),wn(this,"storagePrefix",Ja),wn(this,"storageVersion",ime),wn(this,"events",new Map),wn(this,"shouldPersist",!1),wn(this,"init",async()=>{if(!V9())try{const i={eventId:CN(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:rK(this.core.relayer.protocol,this.core.relayer.version,RI)}}};await this.sendEvent([i])}catch(i){this.logger.warn(i)}}),wn(this,"createEvent",i=>{const{event:s="ERROR",type:o="",properties:{topic:a,trace:c}}=i,u=CN(),l=this.core.projectId||"",d=Date.now(),h=V1({eventId:u,timestamp:d,props:{event:s,type:o,properties:{topic:a,trace:c}},bundleId:l,domain:this.getAppDomain()},this.setMethods(u));return this.telemetryEnabled&&(this.events.set(u,h),this.shouldPersist=!0),h}),wn(this,"getEvent",i=>{const{eventId:s,topic:o}=i;if(s)return this.events.get(s);const a=Array.from(this.events.values()).find(c=>c.props.properties.topic===o);if(a)return V1(V1({},a),this.setMethods(a.eventId))}),wn(this,"deleteEvent",i=>{const{eventId:s}=i;this.events.delete(s),this.shouldPersist=!0}),wn(this,"setEventListeners",()=>{this.core.heartbeat.on(vp.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(i=>{Be.fromMiliseconds(Date.now())-Be.fromMiliseconds(i.timestamp)>ome&&(this.events.delete(i.eventId),this.shouldPersist=!0)})})}),wn(this,"setMethods",i=>({addTrace:s=>this.addTrace(i,s),setError:s=>this.setError(i,s)})),wn(this,"addTrace",(i,s)=>{const o=this.events.get(i);o&&(o.props.properties.trace.push(s),this.events.set(i,o),this.shouldPersist=!0)}),wn(this,"setError",(i,s)=>{const o=this.events.get(i);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(i,o),this.shouldPersist=!0)}),wn(this,"persist",async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1}),wn(this,"restore",async()=>{try{const i=await this.core.storage.getItem(this.storageKey)||[];if(!i.length)return;i.forEach(s=>{this.events.set(s.eventId,V1(V1({},s),this.setMethods(s.eventId)))})}catch(i){this.logger.warn(i)}}),wn(this,"submit",async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const i=[];for(const[s,o]of this.events)o.props.type&&i.push(o);if(i.length!==0)try{if((await this.sendEvent(i)).ok)for(const s of i)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}}),wn(this,"sendEvent",async i=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${ame}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${RI}${s}`,{method:"POST",body:JSON.stringify(i)})}),wn(this,"getAppDomain",()=>tK().url),this.logger=si(r,this.context),this.telemetryEnabled=n,n?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var obe=Object.defineProperty,U$=Object.getOwnPropertySymbols,abe=Object.prototype.hasOwnProperty,cbe=Object.prototype.propertyIsEnumerable,UI=(t,e,r)=>e in t?obe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,F$=(t,e)=>{for(var r in e||(e={}))abe.call(e,r)&&UI(t,r,e[r]);if(U$)for(var r of U$(e))cbe.call(e,r)&&UI(t,r,e[r]);return t},xr=(t,e,r)=>UI(t,typeof e!="symbol"?e+"":e,r);let ube=class oZ extends boe{constructor(e){var r;super(e),xr(this,"protocol",WK),xr(this,"version",VK),xr(this,"name",OI),xr(this,"relayUrl"),xr(this,"projectId"),xr(this,"customStoragePrefix"),xr(this,"events",new ao.EventEmitter),xr(this,"logger"),xr(this,"heartbeat"),xr(this,"relayer"),xr(this,"crypto"),xr(this,"storage"),xr(this,"history"),xr(this,"expirer"),xr(this,"pairing"),xr(this,"verify"),xr(this,"echoClient"),xr(this,"linkModeSupportedApps"),xr(this,"eventClient"),xr(this,"initialized",!1),xr(this,"logChunkController"),xr(this,"on",(a,c)=>this.events.on(a,c)),xr(this,"once",(a,c)=>this.events.once(a,c)),xr(this,"off",(a,c)=>this.events.off(a,c)),xr(this,"removeListener",(a,c)=>this.events.removeListener(a,c)),xr(this,"dispatchEnvelope",({topic:a,message:c,sessionExists:u})=>{if(!a||!c)return;const l={topic:a,message:c,publishedAt:Date.now(),transportType:Pr.link_mode};this.relayer.onLinkMessageEvent(l,{sessionExists:u})});const n=this.getGlobalCore(e==null?void 0:e.customStoragePrefix);if(n)try{return this.customStoragePrefix=n.customStoragePrefix,this.logger=n.logger,this.heartbeat=n.heartbeat,this.crypto=n.crypto,this.history=n.history,this.expirer=n.expirer,this.storage=n.storage,this.relayer=n.relayer,this.pairing=n.pairing,this.verify=n.verify,this.echoClient=n.echoClient,this.linkModeSupportedApps=n.linkModeSupportedApps,this.eventClient=n.eventClient,this.initialized=n.initialized,this.logChunkController=n.logChunkController,n}catch(a){console.warn("Failed to copy global core",a)}this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||KK,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const i=Xm({level:typeof(e==null?void 0:e.logger)=="string"&&e.logger?e.logger:Pge.logger,name:OI}),{logger:s,chunkLoggerController:o}=N9({opts:i,maxSizeInBytes:e==null?void 0:e.maxLogBlobSizeInBytes,loggerOverride:e==null?void 0:e.logger});this.logChunkController=o,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var a,c;(a=this.logChunkController)!=null&&a.downloadLogsBlobInBrowser&&((c=this.logChunkController)==null||c.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=si(s,this.name),this.heartbeat=new wse,this.crypto=new B1e(this,this.logger,e==null?void 0:e.keychain),this.history=new Vwe(this,this.logger),this.expirer=new Zwe(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new Xse(F$(F$({},Oge),e==null?void 0:e.storageOptions)),this.relayer=new uwe({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new qwe(this,this.logger),this.verify=new Qwe(this,this.logger,this.storage),this.echoClient=new tbe(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new sbe(this,this.logger,e==null?void 0:e.telemetryEnabled),this.setGlobalCore(this)}static async init(e){const r=new oZ(e);await r.initialize();const n=await r.crypto.getClientId();return await r.storage.setItem(qge,n),r}get context(){return es(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(v$,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.linkModeSupportedApps=await this.storage.getItem(v$)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}getGlobalCore(e=""){try{if(this.isGlobalCoreDisabled())return;const r=`_walletConnectCore_${e}`,n=`${r}_count`;return globalThis[n]=(globalThis[n]||0)+1,globalThis[n]>1&&console.warn(`WalletConnect Core is already initialized. This is probably a mistake and can lead to unexpected behavior. Init() was called ${globalThis[n]} times.`),globalThis[r]}catch(r){console.warn("Failed to get global WalletConnect core",r);return}}setGlobalCore(e){var r;try{if(this.isGlobalCoreDisabled())return;const n=`_walletConnectCore_${((r=e.opts)==null?void 0:r.customStoragePrefix)||""}`;globalThis[n]=e}catch(n){console.warn("Failed to set global WalletConnect core",n)}}isGlobalCoreDisabled(){try{return typeof process<"u"&&Ige.DISABLE_GLOBAL_CORE==="true"}catch{return!0}}};const lbe=ube,aZ="wc",cZ=2,uZ="client",r7=`${aZ}@${cZ}:${uZ}:`,X8={name:uZ,logger:"error"},H$="WALLETCONNECT_DEEPLINK_CHOICE",dbe="proposal",q$="Proposal expired",hbe="session",Qp=Be.SEVEN_DAYS,fbe="engine",bn={wc_sessionPropose:{req:{ttl:Be.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:Be.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:Be.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:Be.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:Be.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:Be.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:Be.ONE_DAY,prompt:!1,tag:1104},res:{ttl:Be.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:Be.ONE_DAY,prompt:!1,tag:1106},res:{ttl:Be.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:Be.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:Be.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:Be.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:Be.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:Be.ONE_DAY,prompt:!1,tag:1112},res:{ttl:Be.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:Be.ONE_DAY,prompt:!1,tag:1114},res:{ttl:Be.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:Be.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:Be.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:Be.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:Be.FIVE_MINUTES,prompt:!1,tag:1119}}},eS={min:Be.FIVE_MINUTES,max:Be.SEVEN_DAYS},va={idle:"IDLE",active:"ACTIVE"},z$={eth_sendTransaction:{key:""},eth_sendRawTransaction:{key:""},wallet_sendCalls:{key:""},solana_signTransaction:{key:"signature"},solana_signAllTransactions:{key:"transactions"},solana_signAndSendTransaction:{key:"signature"}},pbe="request",gbe=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],mbe="wc",wbe="auth",bbe="authKeys",ybe="pairingTopics",vbe="requests",oA=`${mbe}@${1.5}:${wbe}:`,Q4=`${oA}:PUB_KEY`;var _be=Object.defineProperty,Ebe=Object.defineProperties,Cbe=Object.getOwnPropertyDescriptors,W$=Object.getOwnPropertySymbols,Abe=Object.prototype.hasOwnProperty,xbe=Object.prototype.propertyIsEnumerable,FI=(t,e,r)=>e in t?_be(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,mr=(t,e)=>{for(var r in e||(e={}))Abe.call(e,r)&&FI(t,r,e[r]);if(W$)for(var r of W$(e))xbe.call(e,r)&&FI(t,r,e[r]);return t},ci=(t,e)=>Ebe(t,Cbe(e)),Ie=(t,e,r)=>FI(t,typeof e!="symbol"?e+"":e,r);class Sbe extends joe{constructor(e){super(e),Ie(this,"name",fbe),Ie(this,"events",new R9),Ie(this,"initialized",!1),Ie(this,"requestQueue",{state:va.idle,queue:[]}),Ie(this,"sessionRequestQueue",{state:va.idle,queue:[]}),Ie(this,"requestQueueDelay",Be.ONE_SECOND),Ie(this,"expectedPairingMethodMap",new Map),Ie(this,"recentlyDeletedMap",new Map),Ie(this,"recentlyDeletedLimit",200),Ie(this,"relayMessageCache",[]),Ie(this,"pendingSessions",new Map),Ie(this,"init",async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(bn)}),this.initialized=!0,setTimeout(async()=>{await this.processPendingMessageEvents(),this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},Be.toMiliseconds(this.requestQueueDelay)))}),Ie(this,"connect",async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const n=ci(mr({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n),n.optionalNamespaces=S0e(n.requiredNamespaces,n.optionalNamespaces),n.requiredNamespaces={};const{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,scopedProperties:c,relays:u}=n;let l=i,d,h=!1;try{if(l){const y=this.client.core.pairing.pairings.get(l);this.client.logger.warn("connect() with existing pairing topic is deprecated and will be removed in the next major release."),h=y.active}}catch(y){throw this.client.logger.error(`connect() -> pairing.get(${l}) failed`),y}if(!l||!h){const{topic:y,uri:_}=await this.client.core.pairing.create();l=y,d=_}if(!l){const{message:y}=De("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(y)}const f=await this.client.core.crypto.generateKeyPair(),g=bn.wc_sessionPropose.req.ttl||Be.FIVE_MINUTES,p=gn(g),m=ci(mr(mr({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:GK}],proposer:{publicKey:f,metadata:this.client.metadata},expiryTimestamp:p,pairingTopic:l},a&&{sessionProperties:a}),c&&{scopedProperties:c}),{id:Ta()}),b=Kt("session_connect",m.id),{reject:v,resolve:E,done:w}=jh(g,q$),C=({id:y})=>{y===m.id&&(this.client.events.off("proposal_expire",C),this.pendingSessions.delete(m.id),this.events.emit(b,{error:{message:q$,code:0}}))};return this.client.events.on("proposal_expire",C),this.events.once(b,({error:y,session:_})=>{this.client.events.off("proposal_expire",C),y?v(y):_&&E(_)}),await this.sendRequest({topic:l,method:"wc_sessionPropose",params:m,throwOnFailedPublish:!0,clientRpcId:m.id}),await this.setProposal(m.id,m),{uri:d,approval:w}}),Ie(this,"pair",async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(r)}catch(n){throw this.client.logger.error("pair() failed"),n}}),Ie(this,"approve",async r=>{var n,i,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(n=r==null?void 0:r.id)==null?void 0:n.toString(),trace:[vo.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(A){throw o.setError(lh.no_internet_connection),A}try{await this.isValidProposalId(r==null?void 0:r.id)}catch(A){throw this.client.logger.error(`approve() -> proposal.get(${r==null?void 0:r.id}) failed`),o.setError(lh.proposal_not_found),A}try{await this.isValidApprove(r)}catch(A){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(lh.session_approve_namespace_validation_failure),A}const{id:a,relayProtocol:c,namespaces:u,sessionProperties:l,scopedProperties:d,sessionConfig:h}=r,f=this.client.proposal.get(a);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:g,proposer:p,requiredNamespaces:m,optionalNamespaces:b}=f;let v=(i=this.client.core.eventClient)==null?void 0:i.getEvent({topic:g});v||(v=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:vo.session_approve_started,properties:{topic:g,trace:[vo.session_approve_started,vo.session_namespaces_validation_success]}}));const E=await this.client.core.crypto.generateKeyPair(),w=p.publicKey,C=await this.client.core.crypto.generateSharedKey(E,w),y=mr(mr(mr({relay:{protocol:c??"irn"},namespaces:u,controller:{publicKey:E,metadata:this.client.metadata},expiry:gn(Qp)},l&&{sessionProperties:l}),d&&{scopedProperties:d}),h&&{sessionConfig:h}),_=Pr.relay;v.addTrace(vo.subscribing_session_topic);try{await this.client.core.relayer.subscribe(C,{transportType:_})}catch(A){throw v.setError(lh.subscribe_session_topic_failure),A}v.addTrace(vo.subscribe_session_topic_success);const x=ci(mr({},y),{topic:C,requiredNamespaces:m,optionalNamespaces:b,pairingTopic:g,acknowledged:!1,self:y.controller,peer:{publicKey:p.publicKey,metadata:p.metadata},controller:E,transportType:Pr.relay});await this.client.session.set(C,x),v.addTrace(vo.store_session);try{v.addTrace(vo.publishing_session_settle),await this.sendRequest({topic:C,method:"wc_sessionSettle",params:y,throwOnFailedPublish:!0}).catch(A=>{throw v==null||v.setError(lh.session_settle_publish_failure),A}),v.addTrace(vo.session_settle_publish_success),v.addTrace(vo.publishing_session_approve),await this.sendResult({id:a,topic:g,result:{relay:{protocol:c??"irn"},responderPublicKey:E},throwOnFailedPublish:!0}).catch(A=>{throw v==null||v.setError(lh.session_approve_publish_failure),A}),v.addTrace(vo.session_approve_publish_success)}catch(A){throw this.client.logger.error(A),this.client.session.delete(C,sr("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(C),A}return this.client.core.eventClient.deleteEvent({eventId:v.eventId}),await this.client.core.pairing.updateMetadata({topic:g,metadata:p.metadata}),await this.client.proposal.delete(a,sr("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:g}),await this.setExpiry(C,gn(Qp)),{topic:C,acknowledged:()=>Promise.resolve(this.client.session.get(C))}}),Ie(this,"reject",async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(r)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:n,reason:i}=r;let s;try{s=this.client.proposal.get(n).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),o}s&&(await this.sendError({id:n,topic:s,error:i,rpcOpts:bn.wc_sessionPropose.reject}),await this.client.proposal.delete(n,sr("USER_DISCONNECTED")))}),Ie(this,"update",async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(r)}catch(d){throw this.client.logger.error("update() -> isValidUpdate() failed"),d}const{topic:n,namespaces:i}=r,{done:s,resolve:o,reject:a}=jh(),c=Ta(),u=Jh().toString(),l=this.client.session.get(n).namespaces;return this.events.once(Kt("session_update",c),({error:d})=>{d?a(d):o()}),await this.client.session.update(n,{namespaces:i}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:c,relayRpcId:u}).catch(d=>{this.client.logger.error(d),this.client.session.update(n,{namespaces:l}),a(d)}),{acknowledged:s}}),Ie(this,"extend",async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(r)}catch(c){throw this.client.logger.error("extend() -> isValidExtend() failed"),c}const{topic:n}=r,i=Ta(),{done:s,resolve:o,reject:a}=jh();return this.events.once(Kt("session_extend",i),({error:c})=>{c?a(c):o()}),await this.setExpiry(n,gn(Qp)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(c=>{a(c)}),{acknowledged:s}}),Ie(this,"request",async r=>{this.isInitialized();try{await this.isValidRequest(r)}catch(b){throw this.client.logger.error("request() -> isValidRequest() failed"),b}const{chainId:n,request:i,topic:s,expiry:o=bn.wc_sessionRequest.req.ttl}=r,a=this.client.session.get(s);(a==null?void 0:a.transportType)===Pr.relay&&await this.confirmOnlineStateOrThrow();const c=Ta(),u=Jh().toString(),{done:l,resolve:d,reject:h}=jh(o,"Request expired. Please try again.");this.events.once(Kt("session_request",c),({error:b,result:v})=>{b?h(b):d(v)});const f="wc_sessionRequest",g=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);if(g)return await this.sendRequest({clientRpcId:c,relayRpcId:u,topic:s,method:f,params:{request:ci(mr({},i),{expiryTimestamp:gn(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0,appLink:g}).catch(b=>h(b)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:c}),await l();const p={request:ci(mr({},i),{expiryTimestamp:gn(o)}),chainId:n},m=this.shouldSetTVF(f,p);return await Promise.all([new Promise(async b=>{await this.sendRequest(mr({clientRpcId:c,relayRpcId:u,topic:s,method:f,params:p,expiry:o,throwOnFailedPublish:!0},m&&{tvf:this.getTVFParams(c,p)})).catch(v=>h(v)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:c}),b()}),new Promise(async b=>{var v;if(!((v=a.sessionConfig)!=null&&v.disableDeepLink)){const E=await Lhe(this.client.core.storage,H$);await Bhe({id:c,topic:s,wcDeepLink:E})}b()}),l()]).then(b=>b[2])}),Ie(this,"respond",async r=>{this.isInitialized(),await this.isValidRespond(r);const{topic:n,response:i}=r,{id:s}=i,o=this.client.session.get(n);o.transportType===Pr.relay&&await this.confirmOnlineStateOrThrow();const a=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);Ia(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0,appLink:a}):eo(i)&&await this.sendError({id:s,topic:n,error:i.error,appLink:a}),this.cleanupAfterResponse(r)}),Ie(this,"ping",async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(r)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}const{topic:n}=r;if(this.client.session.keys.includes(n)){const i=Ta(),s=Jh().toString(),{done:o,resolve:a,reject:c}=jh();this.events.once(Kt("session_ping",i),({error:u})=>{u?c(u):a()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(n)&&(this.client.logger.warn("ping() on pairing topic is deprecated and will be removed in the next major release."),await this.client.core.pairing.ping({topic:n}))}),Ie(this,"emit",async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(r);const{topic:n,event:i,chainId:s}=r,o=Jh().toString(),a=Ta();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:o,clientRpcId:a})}),Ie(this,"disconnect",async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(r);const{topic:n}=r;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:sr("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:i}=De("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}}),Ie(this,"find",r=>(this.isInitialized(),this.client.session.getAll().filter(n=>P0e(n,r)))),Ie(this,"getPendingSessionRequests",()=>this.client.pendingRequest.getAll()),Ie(this,"authenticate",async(r,n)=>{var i;this.isInitialized(),this.isValidAuthenticate(r);const s=n&&this.client.core.linkModeSupportedApps.includes(n)&&((i=this.client.metadata.redirect)==null?void 0:i.linkMode),o=s?Pr.link_mode:Pr.relay;o===Pr.relay&&await this.confirmOnlineStateOrThrow();const{chains:a,statement:c="",uri:u,domain:l,nonce:d,type:h,exp:f,nbf:g,methods:p=[],expiry:m}=r,b=[...r.resources||[]],{topic:v,uri:E}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:v,uri:E}});const w=await this.client.core.crypto.generateKeyPair(),C=Y4(w);if(await Promise.all([this.client.auth.authKeys.set(Q4,{responseTopic:C,publicKey:w}),this.client.auth.pairingTopics.set(C,{topic:C,pairingTopic:v})]),await this.client.core.relayer.subscribe(C,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${v}`),p.length>0){const{namespace:$}=ig(a[0]);let R=Rfe($,"request",p);Z4(b)&&(R=Nfe(R,b.pop())),b.push(R)}const y=m&&m>bn.wc_sessionAuthenticate.req.ttl?m:bn.wc_sessionAuthenticate.req.ttl,_={authPayload:{type:h??"caip122",chains:a,statement:c,aud:u,domain:l,version:"1",nonce:d,iat:new Date().toISOString(),exp:f,nbf:g,resources:b},requester:{publicKey:w,metadata:this.client.metadata},expiryTimestamp:gn(y)},x={eip155:{chains:a,methods:[...new Set(["personal_sign",...p])],events:["chainChanged","accountsChanged"]}},A={requiredNamespaces:{},optionalNamespaces:x,relays:[{protocol:"irn"}],pairingTopic:v,proposer:{publicKey:w,metadata:this.client.metadata},expiryTimestamp:gn(bn.wc_sessionPropose.req.ttl),id:Ta()},{done:T,resolve:O,reject:k}=jh(y,"Request expired"),j=Ta(),N=Kt("session_connect",A.id),S=Kt("session_request",j),P=async({error:$,session:R})=>{this.events.off(S,I),$?k($):R&&O({session:R})},I=async $=>{var R,D,L;if(await this.deletePendingAuthRequest(j,{message:"fulfilled",code:0}),$.error){const ae=sr("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return $.error.code===ae.code?void 0:(this.events.off(N,P),k($.error.message))}await this.deleteProposal(A.id),this.events.off(N,P);const{cacaos:U,responder:z}=$.result,W=[],K=[];for(const ae of U){await RN({cacao:ae,projectId:this.client.core.projectId})||(this.client.logger.error(ae,"Signature verification failed"),k(sr("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:he}=ae,ie=Z4(he.resources),Ee=[vI(he.iss)],pe=SC(he.iss);if(ie){const ve=kN(ie),je=NN(ie);W.push(...ve),Ee.push(...je)}for(const ve of Ee)K.push(`${ve}:${pe}`)}const J=await this.client.core.crypto.generateSharedKey(w,z.publicKey);let ne;W.length>0&&(ne={topic:J,acknowledged:!0,self:{publicKey:w,metadata:this.client.metadata},peer:z,controller:z.publicKey,expiry:gn(Qp),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:v,namespaces:i$([...new Set(W)],[...new Set(K)]),transportType:o},await this.client.core.relayer.subscribe(J,{transportType:o}),await this.client.session.set(J,ne),v&&await this.client.core.pairing.updateMetadata({topic:v,metadata:z.metadata}),ne=this.client.session.get(J)),(R=this.client.metadata.redirect)!=null&&R.linkMode&&(D=z.metadata.redirect)!=null&&D.linkMode&&(L=z.metadata.redirect)!=null&&L.universal&&n&&(this.client.core.addLinkModeSupportedApp(z.metadata.redirect.universal),this.client.session.update(J,{transportType:Pr.link_mode})),O({auths:U,session:ne})};this.events.once(N,P),this.events.once(S,I);let B;try{if(s){const $=sd("wc_sessionAuthenticate",_,j);this.client.core.history.set(v,$);const R=await this.client.core.crypto.encode("",$,{type:Lv,encoding:Ml});B=l3(n,v,R)}else await Promise.all([this.sendRequest({topic:v,method:"wc_sessionAuthenticate",params:_,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:j}),this.sendRequest({topic:v,method:"wc_sessionPropose",params:A,expiry:bn.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:A.id})])}catch($){throw this.events.off(N,P),this.events.off(S,I),$}return await this.setProposal(A.id,A),await this.setAuthRequest(j,{request:ci(mr({},_),{verifyContext:{}}),pairingTopic:v,transportType:o}),{uri:B??E,response:T}}),Ie(this,"approveSessionAuthenticate",async r=>{const{id:n,auths:i}=r,s=this.client.core.eventClient.createEvent({properties:{topic:n.toString(),trace:[dh.authenticated_session_approve_started]}});try{this.isInitialized()}catch(m){throw s.setError(z1.no_internet_connection),m}const o=this.getPendingAuthRequest(n);if(!o)throw s.setError(z1.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${n}`);const a=o.transportType||Pr.relay;a===Pr.relay&&await this.confirmOnlineStateOrThrow();const c=o.requester.publicKey,u=await this.client.core.crypto.generateKeyPair(),l=Y4(c),d={type:Eu,receiverPublicKey:c,senderPublicKey:u},h=[],f=[];for(const m of i){if(!await RN({cacao:m,projectId:this.client.core.projectId})){s.setError(z1.invalid_cacao);const C=sr("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:l,error:C,encodeOpts:d}),new Error(C.message)}s.addTrace(dh.cacaos_verified);const{p:b}=m,v=Z4(b.resources),E=[vI(b.iss)],w=SC(b.iss);if(v){const C=kN(v),y=NN(v);h.push(...C),E.push(...y)}for(const C of E)f.push(`${C}:${w}`)}const g=await this.client.core.crypto.generateSharedKey(u,c);s.addTrace(dh.create_authenticated_session_topic);let p;if((h==null?void 0:h.length)>0){p={topic:g,acknowledged:!0,self:{publicKey:u,metadata:this.client.metadata},peer:{publicKey:c,metadata:o.requester.metadata},controller:c,expiry:gn(Qp),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:i$([...new Set(h)],[...new Set(f)]),transportType:a},s.addTrace(dh.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(g,{transportType:a})}catch(m){throw s.setError(z1.subscribe_authenticated_session_topic_failure),m}s.addTrace(dh.subscribe_authenticated_session_topic_success),await this.client.session.set(g,p),s.addTrace(dh.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(dh.publishing_authenticated_session_approve);try{await this.sendResult({topic:l,id:n,result:{cacaos:i,responder:{publicKey:u,metadata:this.client.metadata}},encodeOpts:d,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,a)})}catch(m){throw s.setError(z1.authenticated_session_approve_publish_failure),m}return await this.client.auth.requests.delete(n,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:p}}),Ie(this,"rejectSessionAuthenticate",async r=>{this.isInitialized();const{id:n,reason:i}=r,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);s.transportType===Pr.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),c=Y4(o),u={type:Eu,receiverPublicKey:o,senderPublicKey:a};await this.sendError({id:n,topic:c,error:i,encodeOpts:u,rpcOpts:bn.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.client.proposal.delete(n,sr("USER_DISCONNECTED"))}),Ie(this,"formatAuthMessage",r=>{this.isInitialized();const{request:n,iss:i}=r;return fK(n,i)}),Ie(this,"processRelayMessageCache",()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const r=this.relayMessageCache.shift();r&&await this.onRelayMessage(r)}catch(r){this.client.logger.error(r)}},50)}),Ie(this,"cleanupDuplicatePairings",async r=>{if(r.pairingTopic)try{const n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,a;return((o=s.peerMetadata)==null?void 0:o.url)&&((a=s.peerMetadata)==null?void 0:a.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}}),Ie(this,"deleteSession",async r=>{var n;const{topic:i,expirerHasDeleted:s=!1,emitEvent:o=!0,id:a=0}=r,{self:c}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,sr("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(c.publicKey)&&await this.client.core.crypto.deleteKeyPair(c.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),s||this.client.core.expirer.del(i),this.client.core.storage.removeItem(H$).catch(u=>this.client.logger.warn(u)),this.getPendingSessionRequests().forEach(u=>{u.topic===i&&this.deletePendingSessionRequest(u.id,sr("USER_DISCONNECTED"))}),i===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=va.idle),o&&this.client.events.emit("session_delete",{id:a,topic:i})}),Ie(this,"deleteProposal",async(r,n)=>{if(n)try{const i=this.client.proposal.get(r),s=this.client.core.eventClient.getEvent({topic:i.pairingTopic});s==null||s.setError(lh.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(r,sr("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")}),Ie(this,"deletePendingSessionRequest",async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=va.idle,this.client.events.emit("session_request_expire",{id:r}))}),Ie(this,"deletePendingAuthRequest",async(r,n,i=!1)=>{await Promise.all([this.client.auth.requests.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])}),Ie(this,"setExpiry",async(r,n)=>{this.client.session.keys.includes(r)&&(this.client.core.expirer.set(r,n),await this.client.session.update(r,{expiry:n}))}),Ie(this,"setProposal",async(r,n)=>{this.client.core.expirer.set(r,gn(bn.wc_sessionPropose.req.ttl)),await this.client.proposal.set(r,n)}),Ie(this,"setAuthRequest",async(r,n)=>{const{request:i,pairingTopic:s,transportType:o=Pr.relay}=n;this.client.core.expirer.set(r,i.expiryTimestamp),await this.client.auth.requests.set(r,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:r,pairingTopic:s,verifyContext:i.verifyContext,transportType:o})}),Ie(this,"setPendingSessionRequest",async r=>{const{id:n,topic:i,params:s,verifyContext:o}=r,a=s.request.expiryTimestamp||gn(bn.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,a),await this.client.pendingRequest.set(n,{id:n,topic:i,params:s,verifyContext:o})}),Ie(this,"sendRequest",async r=>{const{topic:n,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:c,throwOnFailedPublish:u,appLink:l,tvf:d}=r,h=sd(i,s,c);let f;const g=!!l;try{const b=g?Ml:Lo;f=await this.client.core.crypto.encode(n,h,{encoding:b})}catch(b){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),b}let p;if(gbe.includes(i)){const b=La(JSON.stringify(h)),v=La(f);p=await this.client.core.verify.register({id:v,decryptedId:b})}const m=bn[i].req;if(m.attestation=p,o&&(m.ttl=o),a&&(m.id=a),this.client.core.history.set(n,h),g){const b=l3(l,n,f);await global.Linking.openURL(b,this.client.name)}else{const b=bn[i].req;o&&(b.ttl=o),a&&(b.id=a),b.tvf=ci(mr({},d),{correlationId:h.id}),u?(b.internal=ci(mr({},b.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,f,b)):this.client.core.relayer.publish(n,f,b).catch(v=>this.client.logger.error(v))}return h.id}),Ie(this,"sendResult",async r=>{const{id:n,topic:i,result:s,throwOnFailedPublish:o,encodeOpts:a,appLink:c}=r,u=rA(n,s);let l;const d=c&&typeof(global==null?void 0:global.Linking)<"u";try{const g=d?Ml:Lo;l=await this.client.core.crypto.encode(i,u,ci(mr({},a||{}),{encoding:g}))}catch(g){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),g}let h,f;try{h=await this.client.core.history.get(i,n);const g=h.request;try{this.shouldSetTVF(g.method,g.params)&&(f=this.getTVFParams(n,g.params,s))}catch(p){this.client.logger.warn("sendResult() -> getTVFParams() failed",p)}}catch(g){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),g}if(d){const g=l3(c,i,l);await global.Linking.openURL(g,this.client.name)}else{const g=h.request.method,p=bn[g].res;p.tvf=ci(mr({},f),{correlationId:n}),o?(p.internal=ci(mr({},p.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,l,p)):this.client.core.relayer.publish(i,l,p).catch(m=>this.client.logger.error(m))}await this.client.core.history.resolve(u)}),Ie(this,"sendError",async r=>{const{id:n,topic:i,error:s,encodeOpts:o,rpcOpts:a,appLink:c}=r,u=nA(n,s);let l;const d=c&&typeof(global==null?void 0:global.Linking)<"u";try{const f=d?Ml:Lo;l=await this.client.core.crypto.encode(i,u,ci(mr({},o||{}),{encoding:f}))}catch(f){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),f}let h;try{h=await this.client.core.history.get(i,n)}catch(f){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),f}if(d){const f=l3(c,i,l);await global.Linking.openURL(f,this.client.name)}else{const f=h.request.method,g=a||bn[f].res;this.client.core.relayer.publish(i,l,g)}await this.client.core.history.resolve(u)}),Ie(this,"cleanup",async()=>{const r=[],n=[];this.client.session.getAll().forEach(i=>{let s=!1;Bl(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{Bl(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])}),Ie(this,"onProviderMessageEvent",async r=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(r):await this.onRelayMessage(r)}),Ie(this,"onRelayEventRequest",async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()}),Ie(this,"processRequestsQueue",async()=>{if(this.requestQueue.state===va.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=va.active;const r=this.requestQueue.queue.shift();if(r)try{await this.processRequest(r)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=va.idle}),Ie(this,"processRequest",async r=>{const{topic:n,payload:i,attestation:s,transportType:o,encryptedId:a}=r,c=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:c}))switch(c){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:n,payload:i,attestation:s,encryptedId:a});case"wc_sessionSettle":return await this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,i);case"wc_sessionPing":return await this.onSessionPingRequest(n,i);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return await this.onSessionRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});default:return this.client.logger.info(`Unsupported request method ${c}`)}}),Ie(this,"onRelayEventResponse",async r=>{const{topic:n,payload:i,transportType:s}=r,o=(await this.client.core.history.get(n,i.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i,s);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${o}`)}}),Ie(this,"onRelayEventUnknownPayload",r=>{const{topic:n}=r,{message:i}=De("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)}),Ie(this,"shouldIgnorePairingRequest",r=>{const{topic:n,requestMethod:i}=r,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)}),Ie(this,"onSessionProposeRequest",async r=>{const{topic:n,payload:i,attestation:s,encryptedId:o}=r,{params:a,id:c}=i;try{const u=this.client.core.eventClient.getEvent({topic:n});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),u==null||u.setError(Vc.proposal_listener_not_found)),this.isValidConnect(mr({},i.params));const l=a.expiryTimestamp||gn(bn.wc_sessionPropose.req.ttl),d=mr({id:c,pairingTopic:n,expiryTimestamp:l},a);await this.setProposal(c,d);const h=await this.getVerifyContext({attestationId:s,hash:La(JSON.stringify(i)),encryptedId:o,metadata:d.proposer.metadata});u==null||u.addTrace(Sa.emit_session_proposal),this.client.events.emit("session_proposal",{id:c,params:d,verifyContext:h})}catch(u){await this.sendError({id:c,topic:n,error:u,rpcOpts:bn.wc_sessionPropose.autoReject}),this.client.logger.error(u)}}),Ie(this,"onSessionProposeResponse",async(r,n,i)=>{const{id:s}=n;if(Ia(n)){const{result:o}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const a=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:a});const c=a.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:c});const u=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:u});const l=await this.client.core.crypto.generateSharedKey(c,u);this.pendingSessions.set(s,{sessionTopic:l,pairingTopic:r,proposalId:s,publicKey:c});const d=await this.client.core.relayer.subscribe(l,{transportType:i});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:d}),await this.client.core.pairing.activate({topic:r})}else if(eo(n)){await this.client.proposal.delete(s,sr("USER_DISCONNECTED"));const o=Kt("session_connect",s);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(o,{error:n.error})}}),Ie(this,"onSessionSettleRequest",async(r,n)=>{const{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:a,expiry:c,namespaces:u,sessionProperties:l,scopedProperties:d,sessionConfig:h}=n.params,f=[...this.pendingSessions.values()].find(m=>m.sessionTopic===r);if(!f)return this.client.logger.error(`Pending session not found for topic ${r}`);const g=this.client.proposal.get(f.proposalId),p=ci(mr(mr(mr({topic:r,relay:o,expiry:c,namespaces:u,acknowledged:!0,pairingTopic:f.pairingTopic,requiredNamespaces:g.requiredNamespaces,optionalNamespaces:g.optionalNamespaces,controller:a.publicKey,self:{publicKey:f.publicKey,metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},l&&{sessionProperties:l}),d&&{scopedProperties:d}),h&&{sessionConfig:h}),{transportType:Pr.relay});await this.client.session.set(p.topic,p),await this.setExpiry(p.topic,p.expiry),await this.client.core.pairing.updateMetadata({topic:f.pairingTopic,metadata:p.peer.metadata}),this.client.events.emit("session_connect",{session:p}),this.events.emit(Kt("session_connect",f.proposalId),{session:p}),this.pendingSessions.delete(f.proposalId),this.deleteProposal(f.proposalId,!1),this.cleanupDuplicatePairings(p),await this.sendResult({id:n.id,topic:r,result:!0,throwOnFailedPublish:!0})}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}}),Ie(this,"onSessionSettleResponse",async(r,n)=>{const{id:i}=n;Ia(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(Kt("session_approve",i),{})):eo(n)&&(await this.client.session.delete(r,sr("USER_DISCONNECTED")),this.events.emit(Kt("session_approve",i),{error:n.error}))}),Ie(this,"onSessionUpdateRequest",async(r,n)=>{const{params:i,id:s}=n;try{const o=`${r}_session_update`,a=H1.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.warn(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:r,error:sr("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(mr({topic:r},i));try{H1.set(o,s),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0,throwOnFailedPublish:!0})}catch(c){throw H1.delete(o),c}this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError({id:s,topic:r,error:o}),this.client.logger.error(o)}}),Ie(this,"isRequestOutOfSync",(r,n)=>n.toString().slice(0,-3){const{id:i}=n,s=Kt("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Ia(n)?this.events.emit(Kt("session_update",i),{}):eo(n)&&this.events.emit(Kt("session_update",i),{error:n.error})}),Ie(this,"onSessionExtendRequest",async(r,n)=>{const{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,gn(Qp)),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}}),Ie(this,"onSessionExtendResponse",(r,n)=>{const{id:i}=n,s=Kt("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Ia(n)?this.events.emit(Kt("session_extend",i),{}):eo(n)&&this.events.emit(Kt("session_extend",i),{error:n.error})}),Ie(this,"onSessionPingRequest",async(r,n)=>{const{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}}),Ie(this,"onSessionPingResponse",(r,n)=>{const{id:i}=n,s=Kt("session_ping",i);setTimeout(()=>{if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners 2176`);Ia(n)?this.events.emit(Kt("session_ping",i),{}):eo(n)&&this.events.emit(Kt("session_ping",i),{error:n.error})},500)}),Ie(this,"onSessionDeleteRequest",async(r,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),Promise.all([new Promise(s=>{this.client.core.relayer.once(xn.publish,async()=>{s(await this.deleteSession({topic:r,id:i}))})}),this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:r,error:sr("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}}),Ie(this,"onSessionRequest",async r=>{var n,i,s;const{topic:o,payload:a,attestation:c,encryptedId:u,transportType:l}=r,{id:d,params:h}=a;try{await this.isValidRequest(mr({topic:o},h));const f=this.client.session.get(o),g=await this.getVerifyContext({attestationId:c,hash:La(JSON.stringify(sd("wc_sessionRequest",h,d))),encryptedId:u,metadata:f.peer.metadata,transportType:l}),p={id:d,topic:o,params:h,verifyContext:g};await this.setPendingSessionRequest(p),l===Pr.link_mode&&(n=f.peer.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp((i=f.peer.metadata.redirect)==null?void 0:i.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(p):(this.addSessionRequestToSessionRequestQueue(p),this.processSessionRequestQueue())}catch(f){await this.sendError({id:d,topic:o,error:f}),this.client.logger.error(f)}}),Ie(this,"onSessionRequestResponse",(r,n)=>{const{id:i}=n,s=Kt("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Ia(n)?this.events.emit(Kt("session_request",i),{result:n.result}):eo(n)&&this.events.emit(Kt("session_request",i),{error:n.error})}),Ie(this,"onSessionEventRequest",async(r,n)=>{const{id:i,params:s}=n;try{const o=`${r}_session_event_${s.event.name}`,a=H1.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(mr({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),H1.set(o,i)}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}}),Ie(this,"onSessionAuthenticateResponse",(r,n)=>{const{id:i}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:n}),Ia(n)?this.events.emit(Kt("session_request",i),{result:n.result}):eo(n)&&this.events.emit(Kt("session_request",i),{error:n.error})}),Ie(this,"onSessionAuthenticateRequest",async r=>{var n;const{topic:i,payload:s,attestation:o,encryptedId:a,transportType:c}=r;try{const{requester:u,authPayload:l,expiryTimestamp:d}=s.params,h=await this.getVerifyContext({attestationId:o,hash:La(JSON.stringify(s)),encryptedId:a,metadata:u.metadata,transportType:c}),f={requester:u,pairingTopic:i,id:s.id,authPayload:l,verifyContext:h,expiryTimestamp:d};await this.setAuthRequest(s.id,{request:f,pairingTopic:i,transportType:c}),c===Pr.link_mode&&(n=u.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp(u.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:i,params:s.params,id:s.id,verifyContext:h})}catch(u){this.client.logger.error(u);const l=s.params.requester.publicKey,d=await this.client.core.crypto.generateKeyPair(),h=this.getAppLinkIfEnabled(s.params.requester.metadata,c),f={type:Eu,receiverPublicKey:l,senderPublicKey:d};await this.sendError({id:s.id,topic:i,error:u,encodeOpts:f,rpcOpts:bn.wc_sessionAuthenticate.autoReject,appLink:h})}}),Ie(this,"addSessionRequestToSessionRequestQueue",r=>{this.sessionRequestQueue.queue.push(r)}),Ie(this,"cleanupAfterResponse",r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=va.idle,this.processSessionRequestQueue()},Be.toMiliseconds(this.requestQueueDelay))}),Ie(this,"cleanupPendingSentRequestsForTopic",({topic:r,error:n})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===r&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,a=Kt("session_request",o);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);this.events.emit(Kt("session_request",s.request.id),{error:n})})}),Ie(this,"processSessionRequestQueue",()=>{if(this.sessionRequestQueue.state===va.active){this.client.logger.info("session request queue is already active.");return}const r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=va.active,this.emitSessionRequest(r)}catch(n){this.client.logger.error(n)}}),Ie(this,"emitSessionRequest",r=>{this.client.events.emit("session_request",r)}),Ie(this,"onPairingCreated",r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;const n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest({topic:r.topic,payload:sd("wc_sessionPropose",ci(mr({},n),{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties,scopedProperties:n.scopedProperties}),n.id)})}),Ie(this,"isValidConnect",async r=>{if(!Fi(r)){const{message:u}=De("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(u)}const{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,scopedProperties:a,relays:c}=r;if(Ln(n)||await this.isValidPairingTopic(n),!F0e(c)){const{message:u}=De("MISSING_OR_INVALID",`connect() relays: ${c}`);throw new Error(u)}if(!Ln(i)&&dd(i)!==0){const u="requiredNamespaces are deprecated and are automatically assigned to optionalNamespaces";["fatal","error","silent"].includes(this.client.logger.level)?console.warn(u):this.client.logger.warn(u),this.validateNamespaces(i,"requiredNamespaces")}if(!Ln(s)&&dd(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),Ln(o)||this.validateSessionProps(o,"sessionProperties"),!Ln(a)){this.validateSessionProps(a,"scopedProperties");const u=Object.keys(i||{}).concat(Object.keys(s||{}));if(!Object.keys(a).every(l=>u.includes(l)))throw new Error(`Scoped properties must be a subset of required/optional namespaces, received: ${JSON.stringify(a)}, required/optional namespaces: ${JSON.stringify(u)}`)}}),Ie(this,"validateNamespaces",(r,n)=>{const i=U0e(r,"connect()",n);if(i)throw new Error(i.message)}),Ie(this,"isValidApprove",async r=>{if(!Fi(r))throw new Error(De("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:n,namespaces:i,relayProtocol:s,sessionProperties:o,scopedProperties:a}=r;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const c=this.client.proposal.get(n),u=V8(i,"approve()");if(u)throw new Error(u.message);const l=a$(c.requiredNamespaces,i,"approve()");if(l)throw new Error(l.message);if(!cn(s,!0)){const{message:d}=De("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(d)}if(Ln(o)||this.validateSessionProps(o,"sessionProperties"),!Ln(a)){this.validateSessionProps(a,"scopedProperties");const d=new Set(Object.keys(i));if(!Object.keys(a).every(h=>d.has(h)))throw new Error(`Scoped properties must be a subset of approved namespaces, received: ${JSON.stringify(a)}, approved namespaces: ${Array.from(d).join(", ")}`)}}),Ie(this,"isValidReject",async r=>{if(!Fi(r)){const{message:s}=De("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}const{id:n,reason:i}=r;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!q0e(i)){const{message:s}=De("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}}),Ie(this,"isValidSessionSettleRequest",r=>{if(!Fi(r)){const{message:u}=De("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(u)}const{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!LK(n)){const{message:u}=De("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(u)}const a=$0e(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);const c=V8(s,"onSessionSettleRequest()");if(c)throw new Error(c.message);if(Bl(o)){const{message:u}=De("EXPIRED","onSessionSettleRequest()");throw new Error(u)}}),Ie(this,"isValidUpdate",async r=>{if(!Fi(r)){const{message:c}=De("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(c)}const{topic:n,namespaces:i}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const s=this.client.session.get(n),o=V8(i,"update()");if(o)throw new Error(o.message);const a=a$(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)}),Ie(this,"isValidExtend",async r=>{if(!Fi(r)){const{message:i}=De("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}const{topic:n}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)}),Ie(this,"isValidRequest",async r=>{if(!Fi(r)){const{message:c}=De("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(c)}const{topic:n,request:i,chainId:s,expiry:o}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:a}=this.client.session.get(n);if(!o$(a,s)){const{message:c}=De("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(c)}if(!z0e(i)){const{message:c}=De("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(c)}if(!G0e(a,s,i.method)){const{message:c}=De("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(c)}if(o&&!J0e(o,eS)){const{message:c}=De("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${eS.min} and ${eS.max}`);throw new Error(c)}}),Ie(this,"isValidRespond",async r=>{var n;if(!Fi(r)){const{message:o}=De("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(o)}const{topic:i,response:s}=r;try{await this.isValidSessionTopic(i)}catch(o){throw(n=r==null?void 0:r.response)!=null&&n.id&&this.cleanupAfterResponse(r),o}if(!W0e(s)){const{message:o}=De("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}}),Ie(this,"isValidPing",async r=>{if(!Fi(r)){const{message:i}=De("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)}),Ie(this,"isValidEmit",async r=>{if(!Fi(r)){const{message:a}=De("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}const{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!o$(o,s)){const{message:a}=De("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!V0e(i)){const{message:a}=De("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!K0e(o,s,i.name)){const{message:a}=De("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}}),Ie(this,"isValidDisconnect",async r=>{if(!Fi(r)){const{message:i}=De("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)}),Ie(this,"isValidAuthenticate",r=>{const{chains:n,uri:i,domain:s,nonce:o}=r;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!cn(i,!1))throw new Error("uri is required parameter");if(!cn(s,!1))throw new Error("domain is required parameter");if(!cn(o,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(c=>ig(c).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:a}=ig(n[0]);if(a!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")}),Ie(this,"getVerifyContext",async r=>{const{attestationId:n,hash:i,encryptedId:s,metadata:o,transportType:a}=r,c={verified:{verifyUrl:o.verifyUrl||pb,validation:"UNKNOWN",origin:o.url||""}};try{if(a===Pr.link_mode){const l=this.getAppLinkIfEnabled(o,a);return c.verified.validation=l&&new URL(l).origin===new URL(o.url).origin?"VALID":"INVALID",c}const u=await this.client.core.verify.resolve({attestationId:n,hash:i,encryptedId:s,verifyUrl:o.verifyUrl});u&&(c.verified.origin=u.origin,c.verified.isScam=u.isScam,c.verified.validation=u.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(u){this.client.logger.warn(u)}return this.client.logger.debug(`Verify context: ${JSON.stringify(c)}`),c}),Ie(this,"validateSessionProps",(r,n)=>{Object.values(r).forEach((i,s)=>{if(i==null){const{message:o}=De("MISSING_OR_INVALID",`${n} must contain an existing value for each key. Received: ${i} for key ${Object.keys(r)[s]}`);throw new Error(o)}})}),Ie(this,"getPendingAuthRequest",r=>{const n=this.client.auth.requests.get(r);return typeof n=="object"?n:void 0}),Ie(this,"addToRecentlyDeleted",(r,n)=>{if(this.recentlyDeletedMap.set(r,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(o)}}}),Ie(this,"checkRecentlyDeleted",r=>{const n=this.recentlyDeletedMap.get(r);if(n){const{message:i}=De("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${r}`);throw new Error(i)}}),Ie(this,"isLinkModeEnabled",(r,n)=>{var i,s,o,a,c,u,l,d,h;return!r||n!==Pr.link_mode?!1:((s=(i=this.client.metadata)==null?void 0:i.redirect)==null?void 0:s.linkMode)===!0&&((a=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:a.universal)!==void 0&&((u=(c=this.client.metadata)==null?void 0:c.redirect)==null?void 0:u.universal)!==""&&((l=r==null?void 0:r.redirect)==null?void 0:l.universal)!==void 0&&((d=r==null?void 0:r.redirect)==null?void 0:d.universal)!==""&&((h=r==null?void 0:r.redirect)==null?void 0:h.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(r.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"}),Ie(this,"getAppLinkIfEnabled",(r,n)=>{var i;return this.isLinkModeEnabled(r,n)?(i=r==null?void 0:r.redirect)==null?void 0:i.universal:void 0}),Ie(this,"handleLinkModeMessage",({url:r})=>{if(!r||!r.includes("wc_ev")||!r.includes("topic"))return;const n=EN(r,"topic")||"",i=decodeURIComponent(EN(r,"wc_ev")||""),s=this.client.session.keys.includes(n);s&&this.client.session.update(n,{transportType:Pr.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:i,sessionExists:s})}),Ie(this,"registerLinkModeListeners",async()=>{var r;if(V9()||jd()&&(r=this.client.metadata.redirect)!=null&&r.linkMode){const n=global==null?void 0:global.Linking;if(typeof n<"u"){n.addEventListener("url",this.handleLinkModeMessage,this.client.name);const i=await n.getInitialURL();i&&setTimeout(()=>{this.handleLinkModeMessage({url:i})},50)}}}),Ie(this,"shouldSetTVF",(r,n)=>{if(!n||r!=="wc_sessionRequest")return!1;const{request:i}=n;return Object.keys(z$).includes(i.method)}),Ie(this,"getTVFParams",(r,n,i)=>{var s,o;try{const a=n.request.method,c=this.extractTxHashesFromResult(a,i);return ci(mr({correlationId:r,rpcMethods:[a],chainId:n.chainId},this.isValidContractData(n.request.params)&&{contractAddresses:[(o=(s=n.request.params)==null?void 0:s[0])==null?void 0:o.to]}),{txHashes:c})}catch(a){this.client.logger.warn("Error getting TVF params",a)}return{}}),Ie(this,"isValidContractData",r=>{var n;if(!r)return!1;try{const i=(r==null?void 0:r.data)||((n=r==null?void 0:r[0])==null?void 0:n.data);if(!i.startsWith("0x"))return!1;const s=i.slice(2);return/^[0-9a-fA-F]*$/.test(s)?s.length%2===0:!1}catch{}return!1}),Ie(this,"extractTxHashesFromResult",(r,n)=>{try{const i=z$[r];if(typeof n=="string")return[n];const s=n[i.key];if(ld(s))return r==="solana_signAllTransactions"?s.map(o=>wfe(o)):s;if(typeof s=="string")return[s]}catch(i){this.client.logger.warn("Error extracting tx hashes from result",i)}return[]})}async processPendingMessageEvents(){try{const e=this.client.session.keys,r=this.client.core.relayer.messages.getWithoutAck(e);for(const[n,i]of Object.entries(r))for(const s of i)try{await this.onProviderMessageEvent({topic:n,message:s,publishedAt:Date.now()})}catch{this.client.logger.warn(`Error processing pending message event for topic: ${n}, message: ${s}`)}}catch(e){this.client.logger.warn("processPendingMessageEvents failed",e)}}isInitialized(){if(!this.initialized){const{message:e}=De("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(xn.message,e=>{this.onProviderMessageEvent(e)})}async onRelayMessage(e){const{topic:r,message:n,attestation:i,transportType:s}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(Q4)?this.client.auth.authKeys.get(Q4):{publicKey:void 0};try{const a=await this.client.core.crypto.decode(r,n,{receiverPublicKey:o,encoding:s===Pr.link_mode?Ml:Lo});t7(a)?(this.client.core.history.set(r,a),await this.onRelayEventRequest({topic:r,payload:a,attestation:i,transportType:s,encryptedId:La(n)})):iA(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:r,payload:a,transportType:s}),this.client.core.history.delete(r,a.id)):await this.onRelayEventUnknownPayload({topic:r,payload:a,transportType:s}),await this.client.core.relayer.messages.ack(r,n)}catch(a){this.client.logger.error(a)}}registerExpirerEvents(){this.client.core.expirer.on(Gs.expired,async e=>{const{topic:r,id:n}=iK(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,De("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,De("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(Fh.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(Fh.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!cn(e,!1)){const{message:r}=De("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:r}=De("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(Bl(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=De("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!cn(e,!1)){const{message:r}=De("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:r}=De("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(Bl(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:r}=De("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){const{message:r}=De("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(cn(e,!1)){const{message:r}=De("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=De("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!H0e(e)){const{message:r}=De("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=De("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(Bl(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:r}=De("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class Tbe extends Ep{constructor(e,r){super(e,r,dbe,r7),this.core=e,this.logger=r}}let Ibe=class extends Ep{constructor(e,r){super(e,r,hbe,r7),this.core=e,this.logger=r}};class Pbe extends Ep{constructor(e,r){super(e,r,pbe,r7,n=>n.id),this.core=e,this.logger=r}}class Obe extends Ep{constructor(e,r){super(e,r,bbe,oA,()=>Q4),this.core=e,this.logger=r}}class Rbe extends Ep{constructor(e,r){super(e,r,ybe,oA),this.core=e,this.logger=r}}class kbe extends Ep{constructor(e,r){super(e,r,vbe,oA,n=>n.id),this.core=e,this.logger=r}}var Nbe=Object.defineProperty,$be=(t,e,r)=>e in t?Nbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,tS=(t,e,r)=>$be(t,typeof e!="symbol"?e+"":e,r);class jbe{constructor(e,r){this.core=e,this.logger=r,tS(this,"authKeys"),tS(this,"pairingTopics"),tS(this,"requests"),this.authKeys=new Obe(this.core,this.logger),this.pairingTopics=new Rbe(this.core,this.logger),this.requests=new kbe(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}var Bbe=Object.defineProperty,Dbe=(t,e,r)=>e in t?Bbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ot=(t,e,r)=>Dbe(t,typeof e!="symbol"?e+"":e,r);let Mbe=class lZ extends $oe{constructor(e){super(e),Ot(this,"protocol",aZ),Ot(this,"version",cZ),Ot(this,"name",X8.name),Ot(this,"metadata"),Ot(this,"core"),Ot(this,"logger"),Ot(this,"events",new ao.EventEmitter),Ot(this,"engine"),Ot(this,"session"),Ot(this,"proposal"),Ot(this,"pendingRequest"),Ot(this,"auth"),Ot(this,"signConfig"),Ot(this,"on",(n,i)=>this.events.on(n,i)),Ot(this,"once",(n,i)=>this.events.once(n,i)),Ot(this,"off",(n,i)=>this.events.off(n,i)),Ot(this,"removeListener",(n,i)=>this.events.removeListener(n,i)),Ot(this,"removeAllListeners",n=>this.events.removeAllListeners(n)),Ot(this,"connect",async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}}),Ot(this,"pair",async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}}),Ot(this,"approve",async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}}),Ot(this,"reject",async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}}),Ot(this,"update",async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}}),Ot(this,"extend",async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}}),Ot(this,"request",async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}}),Ot(this,"respond",async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}}),Ot(this,"ping",async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}}),Ot(this,"emit",async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}}),Ot(this,"disconnect",async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}}),Ot(this,"find",n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}}),Ot(this,"getPendingSessionRequests",()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}}),Ot(this,"authenticate",async(n,i)=>{try{return await this.engine.authenticate(n,i)}catch(s){throw this.logger.error(s.message),s}}),Ot(this,"formatAuthMessage",n=>{try{return this.engine.formatAuthMessage(n)}catch(i){throw this.logger.error(i.message),i}}),Ot(this,"approveSessionAuthenticate",async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}}),Ot(this,"rejectSessionAuthenticate",async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}}),this.name=(e==null?void 0:e.name)||X8.name,this.metadata=Ohe(e==null?void 0:e.metadata),this.signConfig=e==null?void 0:e.signConfig;const r=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Tv(Xm({level:(e==null?void 0:e.logger)||X8.logger}));this.core=(e==null?void 0:e.core)||new lbe(e),this.logger=si(r,this.name),this.session=new Ibe(this.core,this.logger),this.proposal=new Tbe(this.core,this.logger),this.pendingRequest=new Pbe(this.core,this.logger),this.engine=new Sbe(this),this.auth=new jbe(this.core,this.logger)}static async init(e){const r=new lZ(e);return await r.initialize(),r}get context(){return es(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),setTimeout(()=>{this.engine.processRelayMessageCache()},Be.toMiliseconds(Be.ONE_SECOND))}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}};var h3={exports:{}},V$;function Lbe(){return V$||(V$=1,function(t,e){var r=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof Da<"u"&&Da,n=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(o){var a=typeof s<"u"&&s||typeof self<"u"&&self||typeof Da<"u"&&Da||{},c={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function u(S){return S&&DataView.prototype.isPrototypeOf(S)}if(c.arrayBuffer)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(S){return S&&l.indexOf(Object.prototype.toString.call(S))>-1};function h(S){if(typeof S!="string"&&(S=String(S)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(S)||S==="")throw new TypeError('Invalid character in header field name: "'+S+'"');return S.toLowerCase()}function f(S){return typeof S!="string"&&(S=String(S)),S}function g(S){var P={next:function(){var I=S.shift();return{done:I===void 0,value:I}}};return c.iterable&&(P[Symbol.iterator]=function(){return P}),P}function p(S){this.map={},S instanceof p?S.forEach(function(P,I){this.append(I,P)},this):Array.isArray(S)?S.forEach(function(P){if(P.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+P.length);this.append(P[0],P[1])},this):S&&Object.getOwnPropertyNames(S).forEach(function(P){this.append(P,S[P])},this)}p.prototype.append=function(S,P){S=h(S),P=f(P);var I=this.map[S];this.map[S]=I?I+", "+P:P},p.prototype.delete=function(S){delete this.map[h(S)]},p.prototype.get=function(S){return S=h(S),this.has(S)?this.map[S]:null},p.prototype.has=function(S){return this.map.hasOwnProperty(h(S))},p.prototype.set=function(S,P){this.map[h(S)]=f(P)},p.prototype.forEach=function(S,P){for(var I in this.map)this.map.hasOwnProperty(I)&&S.call(P,this.map[I],I,this)},p.prototype.keys=function(){var S=[];return this.forEach(function(P,I){S.push(I)}),g(S)},p.prototype.values=function(){var S=[];return this.forEach(function(P){S.push(P)}),g(S)},p.prototype.entries=function(){var S=[];return this.forEach(function(P,I){S.push([I,P])}),g(S)},c.iterable&&(p.prototype[Symbol.iterator]=p.prototype.entries);function m(S){if(!S._noBody){if(S.bodyUsed)return Promise.reject(new TypeError("Already read"));S.bodyUsed=!0}}function b(S){return new Promise(function(P,I){S.onload=function(){P(S.result)},S.onerror=function(){I(S.error)}})}function v(S){var P=new FileReader,I=b(P);return P.readAsArrayBuffer(S),I}function E(S){var P=new FileReader,I=b(P),B=/charset=([A-Za-z0-9_-]+)/.exec(S.type),$=B?B[1]:"utf-8";return P.readAsText(S,$),I}function w(S){for(var P=new Uint8Array(S),I=new Array(P.length),B=0;B-1?P:S}function A(S,P){if(!(this instanceof A))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');P=P||{};var I=P.body;if(S instanceof A){if(S.bodyUsed)throw new TypeError("Already read");this.url=S.url,this.credentials=S.credentials,P.headers||(this.headers=new p(S.headers)),this.method=S.method,this.mode=S.mode,this.signal=S.signal,!I&&S._bodyInit!=null&&(I=S._bodyInit,S.bodyUsed=!0)}else this.url=String(S);if(this.credentials=P.credentials||this.credentials||"same-origin",(P.headers||!this.headers)&&(this.headers=new p(P.headers)),this.method=x(P.method||this.method||"GET"),this.mode=P.mode||this.mode||null,this.signal=P.signal||this.signal||function(){if("AbortController"in a){var R=new AbortController;return R.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&I)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(I),(this.method==="GET"||this.method==="HEAD")&&(P.cache==="no-store"||P.cache==="no-cache")){var B=/([?&])_=[^&]*/;if(B.test(this.url))this.url=this.url.replace(B,"$1_="+new Date().getTime());else{var $=/\?/;this.url+=($.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}A.prototype.clone=function(){return new A(this,{body:this._bodyInit})};function T(S){var P=new FormData;return S.trim().split("&").forEach(function(I){if(I){var B=I.split("="),$=B.shift().replace(/\+/g," "),R=B.join("=").replace(/\+/g," ");P.append(decodeURIComponent($),decodeURIComponent(R))}}),P}function O(S){var P=new p,I=S.replace(/\r?\n[\t ]+/g," ");return I.split("\r").map(function(B){return B.indexOf(` `)===0?B.substr(1,B.length):B}).forEach(function(B){var $=B.split(":"),R=$.shift().trim();if(R){var D=$.join(":").trim();try{P.append(R,D)}catch(L){console.warn("Response "+L.message)}}}),P}y.call(A.prototype);function k(S,P){if(!(this instanceof k))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(P||(P={}),this.type="default",this.status=P.status===void 0?200:P.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=P.statusText===void 0?"":""+P.statusText,this.headers=new p(P.headers),this.url=P.url||"",this._initBody(S)}y.call(k.prototype),k.prototype.clone=function(){return new k(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},k.error=function(){var S=new k(null,{status:200,statusText:""});return S.ok=!1,S.status=0,S.type="error",S};var j=[301,302,303,307,308];k.redirect=function(S,P){if(j.indexOf(P)===-1)throw new RangeError("Invalid status code");return new k(null,{status:P,headers:{location:S}})},o.DOMException=a.DOMException;try{new o.DOMException}catch{o.DOMException=function(P,I){this.message=P,this.name=I;var B=Error(P);this.stack=B.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function N(S,P){return new Promise(function(I,B){var $=new A(S,P);if($.signal&&$.signal.aborted)return B(new o.DOMException("Aborted","AbortError"));var R=new XMLHttpRequest;function D(){R.abort()}R.onload=function(){var z={statusText:R.statusText,headers:O(R.getAllResponseHeaders()||"")};$.url.indexOf("file://")===0&&(R.status<200||R.status>599)?z.status=200:z.status=R.status,z.url="responseURL"in R?R.responseURL:z.headers.get("X-Request-URL");var W="response"in R?R.response:R.responseText;setTimeout(function(){I(new k(W,z))},0)},R.onerror=function(){setTimeout(function(){B(new TypeError("Network request failed"))},0)},R.ontimeout=function(){setTimeout(function(){B(new TypeError("Network request timed out"))},0)},R.onabort=function(){setTimeout(function(){B(new o.DOMException("Aborted","AbortError"))},0)};function L(z){try{return z===""&&a.location.href?a.location.href:z}catch{return z}}if(R.open($.method,L($.url),!0),$.credentials==="include"?R.withCredentials=!0:$.credentials==="omit"&&(R.withCredentials=!1),"responseType"in R&&(c.blob?R.responseType="blob":c.arrayBuffer&&(R.responseType="arraybuffer")),P&&typeof P.headers=="object"&&!(P.headers instanceof p||a.Headers&&P.headers instanceof a.Headers)){var U=[];Object.getOwnPropertyNames(P.headers).forEach(function(z){U.push(h(z)),R.setRequestHeader(z,f(P.headers[z]))}),$.headers.forEach(function(z,W){U.indexOf(W)===-1&&R.setRequestHeader(W,z)})}else $.headers.forEach(function(z,W){R.setRequestHeader(W,z)});$.signal&&($.signal.addEventListener("abort",D),R.onreadystatechange=function(){R.readyState===4&&$.signal.removeEventListener("abort",D)}),R.send(typeof $._bodyInit>"u"?null:$._bodyInit)})}return N.polyfill=!0,a.fetch||(a.fetch=N,a.Headers=p,a.Request=A,a.Response=k),o.Headers=p,o.Request=A,o.Response=k,o.fetch=N,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=r.fetch?r:n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e}(h3,h3.exports)),h3.exports}var Ube=Lbe();const G$=cc(Ube);var Fbe=Object.defineProperty,Hbe=Object.defineProperties,qbe=Object.getOwnPropertyDescriptors,K$=Object.getOwnPropertySymbols,zbe=Object.prototype.hasOwnProperty,Wbe=Object.prototype.propertyIsEnumerable,Z$=(t,e,r)=>e in t?Fbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Y$=(t,e)=>{for(var r in e||(e={}))zbe.call(e,r)&&Z$(t,r,e[r]);if(K$)for(var r of K$(e))Wbe.call(e,r)&&Z$(t,r,e[r]);return t},J$=(t,e)=>Hbe(t,qbe(e));const Vbe={Accept:"application/json","Content-Type":"application/json"},Gbe="POST",Q$={headers:Vbe,method:Gbe},X$=10;let ta=class{constructor(e,r=!1){if(this.url=e,this.disableProviderPing=r,this.events=new ao.EventEmitter,this.isAvailable=!1,this.registering=!1,!p$(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=r}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const r=Tu(e),n=await(await G$(this.url,J$(Y$({},Q$),{body:r}))).json();this.onPayload({data:n})}catch(r){this.onError(e.id,r)}}async register(e=this.url){if(!p$(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const r=Tu({id:1,jsonrpc:"2.0",method:"test",params:[]});await G$(e,J$(Y$({},Q$),{body:r}))}this.onOpen()}catch(r){const n=this.parseError(r);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?jf(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=nA(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return HK(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>X$&&this.events.setMaxListeners(X$)}};const ej="error",Kbe="wss://relay.walletconnect.org",Zbe="wc",Ybe="universal_provider",f3=`${Zbe}@2:${Ybe}:`,dZ="https://rpc.walletconnect.org/v1/",D0="generic",Jbe=`${dZ}bundler`,uo={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};function Qbe(){}function n7(t){return t==null||typeof t!="object"&&typeof t!="function"}function i7(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Xbe(t){if(n7(t))return t;if(Array.isArray(t)||i7(t)||t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer)return t.slice(0);const e=Object.getPrototypeOf(t),r=e.constructor;if(t instanceof Date||t instanceof Map||t instanceof Set)return new r(t);if(t instanceof RegExp){const n=new r(t);return n.lastIndex=t.lastIndex,n}if(t instanceof DataView)return new r(t.buffer.slice(0));if(t instanceof Error){const n=new r(t.message);return n.stack=t.stack,n.name=t.name,n.cause=t.cause,n}if(typeof File<"u"&&t instanceof File)return new r([t],t.name,{type:t.type,lastModified:t.lastModified});if(typeof t=="object"){const n=Object.create(e);return Object.assign(n,t)}return t}function tj(t){return typeof t=="object"&&t!==null}function hZ(t){return Object.getOwnPropertySymbols(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}function fZ(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const eye="[object RegExp]",pZ="[object String]",gZ="[object Number]",mZ="[object Boolean]",wZ="[object Arguments]",tye="[object Symbol]",rye="[object Date]",nye="[object Map]",iye="[object Set]",sye="[object Array]",oye="[object ArrayBuffer]",aye="[object Object]",cye="[object DataView]",uye="[object Uint8Array]",lye="[object Uint8ClampedArray]",dye="[object Uint16Array]",hye="[object Uint32Array]",fye="[object Int8Array]",pye="[object Int16Array]",gye="[object Int32Array]",mye="[object Float32Array]",wye="[object Float64Array]";function bye(t,e){return G0(t,void 0,t,new Map,e)}function G0(t,e,r,n=new Map,i=void 0){const s=i==null?void 0:i(t,e,r,n);if(s!=null)return s;if(n7(t))return t;if(n.has(t))return n.get(t);if(Array.isArray(t)){const o=new Array(t.length);n.set(t,o);for(let a=0;a{if(typeof t=="object")switch(Object.prototype.toString.call(t)){case gZ:case pZ:case mZ:{const o=new t.constructor(t==null?void 0:t.valueOf());return Hh(o,t),o}case wZ:{const o={};return Hh(o,t),o.length=t.length,o[Symbol.iterator]=t[Symbol.iterator],o}default:return}})}function rj(t){return vye(t)}function nj(t){return t!==null&&typeof t=="object"&&fZ(t)==="[object Arguments]"}function _ye(t){return i7(t)}function Eye(t){var r;if(typeof t!="object"||t==null)return!1;if(Object.getPrototypeOf(t)===null)return!0;if(Object.prototype.toString.call(t)!=="[object Object]"){const n=t[Symbol.toStringTag];return n==null||!((r=Object.getOwnPropertyDescriptor(t,Symbol.toStringTag))!=null&&r.writable)?!1:t.toString()===`[object ${n}]`}let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function Cye(t,...e){const r=e.slice(0,-1),n=e[e.length-1];let i=t;for(let s=0;se in t?xye(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,p3=(t,e)=>{for(var r in e||(e={}))Iye.call(e,r)&&sj(t,r,e[r]);if(ij)for(var r of ij(e))Pye.call(e,r)&&sj(t,r,e[r]);return t},Oye=(t,e)=>Sye(t,Tye(e));function xs(t,e,r){var n;const i=ig(t);return((n=e.rpcMap)==null?void 0:n[i.reference])||`${dZ}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function Cp(t){return t.includes(":")?t.split(":")[1]:t}function bZ(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function Rye(t,e){const r=Object.keys(e.namespaces).filter(i=>i.includes(t));if(!r.length)return[];const n=[];return r.forEach(i=>{const s=e.namespaces[i].accounts;n.push(...s)}),n}function g3(t={},e={}){const r=oj(t),n=oj(e);return Aye(r,n)}function oj(t){var e,r,n,i,s;const o={};if(!dd(t))return o;for(const[a,c]of Object.entries(t)){const u=tA(a)?[a]:c.chains,l=c.methods||[],d=c.events||[],h=c.rpcMap||{},f=V0(a);o[f]=Oye(p3(p3({},o[f]),c),{chains:Ka(u,(e=o[f])==null?void 0:e.chains),methods:Ka(l,(r=o[f])==null?void 0:r.methods),events:Ka(d,(n=o[f])==null?void 0:n.events)}),(dd(h)||dd(((i=o[f])==null?void 0:i.rpcMap)||{}))&&(o[f].rpcMap=p3(p3({},h),(s=o[f])==null?void 0:s.rpcMap))}return o}function aj(t){return t.includes(":")?t.split(":")[2]:t}function cj(t){const e={};for(const[r,n]of Object.entries(t)){const i=n.methods||[],s=n.events||[],o=n.accounts||[],a=tA(r)?[r]:n.chains?n.chains:bZ(n.accounts);e[r]={chains:a,methods:i,events:s,accounts:o}}return e}function rS(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))}const yZ={},zt=t=>yZ[t],nS=(t,e)=>{yZ[t]=e};var kye=Object.defineProperty,Nye=(t,e,r)=>e in t?kye(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Xp=(t,e,r)=>Nye(t,typeof e!="symbol"?e+"":e,r);class $ye{constructor(e){Xp(this,"name","polkadot"),Xp(this,"client"),Xp(this,"httpProviders"),Xp(this,"events"),Xp(this,"namespace"),Xp(this,"chainId"),this.namespace=e.namespace,this.events=zt("events"),this.client=zt("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;const 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(uo.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Cp(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const 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){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||xs(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new co(new ta(n,zt("disableProviderPing")))}}var jye=Object.defineProperty,Bye=Object.defineProperties,Dye=Object.getOwnPropertyDescriptors,uj=Object.getOwnPropertySymbols,Mye=Object.prototype.hasOwnProperty,Lye=Object.prototype.propertyIsEnumerable,qI=(t,e,r)=>e in t?jye(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,lj=(t,e)=>{for(var r in e||(e={}))Mye.call(e,r)&&qI(t,r,e[r]);if(uj)for(var r of uj(e))Lye.call(e,r)&&qI(t,r,e[r]);return t},dj=(t,e)=>Bye(t,Dye(e)),e0=(t,e,r)=>qI(t,typeof e!="symbol"?e+"":e,r);class Uye{constructor(e){e0(this,"name","eip155"),e0(this,"client"),e0(this,"chainId"),e0(this,"namespace"),e0(this,"httpProviders"),e0(this,"events"),this.namespace=e.namespace,this.events=zt("events"),this.client=zt("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());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}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(uo.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;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,r){const n=r||xs(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new co(new ta(n,zt("disableProviderPing")))}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=parseInt(Cp(r));e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const 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,n;let i=e.request.params?(r=e.request.params[0])==null?void 0:r.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const s=parseInt(i,16);if(this.isChainApproved(s))this.setDefaultChain(`${s}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${s}`);else throw new Error(`Failed to switch to chain 'eip155:${s}'. 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}`)}async getCapabilities(e){var r,n,i,s,o;const a=(n=(r=e.request)==null?void 0:r.params)==null?void 0:n[0],c=((s=(i=e.request)==null?void 0:i.params)==null?void 0:s[1])||[],u=`${a}${c.join(",")}`;if(!a)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const l=this.client.session.get(e.topic),d=((o=l==null?void 0:l.sessionProperties)==null?void 0:o.capabilities)||{};if(d!=null&&d[u])return d==null?void 0:d[u];const h=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:dj(lj({},l.sessionProperties||{}),{capabilities:dj(lj({},d||{}),{[u]:h})})})}catch(f){console.warn("Failed to update session with capabilities",f)}return h}async getCallStatus(e){var r,n;const i=this.client.session.get(e.topic),s=(r=i.sessionProperties)==null?void 0:r.bundler_name;if(s){const a=this.getBundlerUrl(e.chainId,s);try{return await this.getUserOperationReceipt(a,e)}catch(c){console.warn("Failed to fetch call status from bundler",c,a)}}const o=(n=i.sessionProperties)==null?void 0:n.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,e)}catch(a){console.warn("Failed to fetch call status from custom bundler",a,o)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,r){var n;const i=new URL(e),s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(sd("eth_getUserOperationReceipt",[(n=r.request.params)==null?void 0:n[0]]))});if(!s.ok)throw new Error(`Failed to fetch user operation receipt - ${s.status}`);return await s.json()}getBundlerUrl(e,r){return`${Jbe}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`}}var Fye=Object.defineProperty,Hye=(t,e,r)=>e in t?Fye(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,t0=(t,e,r)=>Hye(t,typeof e!="symbol"?e+"":e,r);class qye{constructor(e){t0(this,"name","solana"),t0(this,"client"),t0(this,"httpProviders"),t0(this,"events"),t0(this,"namespace"),t0(this,"chainId"),this.namespace=e.namespace,this.events=zt("events"),this.client=zt("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(uo.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Cp(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const 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){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||xs(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new co(new ta(n,zt("disableProviderPing")))}}var zye=Object.defineProperty,Wye=(t,e,r)=>e in t?zye(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,r0=(t,e,r)=>Wye(t,typeof e!="symbol"?e+"":e,r);class Vye{constructor(e){r0(this,"name","cosmos"),r0(this,"client"),r0(this,"httpProviders"),r0(this,"events"),r0(this,"namespace"),r0(this,"chainId"),this.namespace=e.namespace,this.events=zt("events"),this.client=zt("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;const 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(uo.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Cp(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const 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){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||xs(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new co(new ta(n,zt("disableProviderPing")))}}var Gye=Object.defineProperty,Kye=(t,e,r)=>e in t?Gye(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,n0=(t,e,r)=>Kye(t,typeof e!="symbol"?e+"":e,r);class Zye{constructor(e){n0(this,"name","algorand"),n0(this,"client"),n0(this,"httpProviders"),n0(this,"events"),n0(this,"namespace"),n0(this,"chainId"),this.namespace=e.namespace,this.events=zt("events"),this.client=zt("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){if(!this.httpProviders[e]){const n=r||xs(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.chainId=e,this.events.emit(uo.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const 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){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||xs(e,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new co(new ta(n,zt("disableProviderPing")))}}var Yye=Object.defineProperty,Jye=(t,e,r)=>e in t?Yye(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,i0=(t,e,r)=>Jye(t,typeof e!="symbol"?e+"":e,r);class Qye{constructor(e){i0(this,"name","cip34"),i0(this,"client"),i0(this,"httpProviders"),i0(this,"events"),i0(this,"namespace"),i0(this,"chainId"),this.namespace=e.namespace,this.events=zt("events"),this.client=zt("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;const 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(uo.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),i=Cp(r);e[i]=this.createHttpProvider(i,n)}),e}getHttpProvider(){const 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){const r=this.namespace.rpcMap;if(r)return r[e]}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new co(new ta(n,zt("disableProviderPing")))}}var Xye=Object.defineProperty,eve=(t,e,r)=>e in t?Xye(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,s0=(t,e,r)=>eve(t,typeof e!="symbol"?e+"":e,r);class tve{constructor(e){s0(this,"name","elrond"),s0(this,"client"),s0(this,"httpProviders"),s0(this,"events"),s0(this,"namespace"),s0(this,"chainId"),this.namespace=e.namespace,this.events=zt("events"),this.client=zt("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(uo.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Cp(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const 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){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||xs(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new co(new ta(n,zt("disableProviderPing")))}}var rve=Object.defineProperty,nve=(t,e,r)=>e in t?rve(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,o0=(t,e,r)=>nve(t,typeof e!="symbol"?e+"":e,r);class ive{constructor(e){o0(this,"name","multiversx"),o0(this,"client"),o0(this,"httpProviders"),o0(this,"events"),o0(this,"namespace"),o0(this,"chainId"),this.namespace=e.namespace,this.events=zt("events"),this.client=zt("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(uo.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Cp(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const 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){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||xs(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new co(new ta(n,zt("disableProviderPing")))}}var sve=Object.defineProperty,ove=(t,e,r)=>e in t?sve(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,a0=(t,e,r)=>ove(t,typeof e!="symbol"?e+"":e,r);class ave{constructor(e){a0(this,"name","near"),a0(this,"client"),a0(this,"httpProviders"),a0(this,"events"),a0(this,"namespace"),a0(this,"chainId"),this.namespace=e.namespace,this.events=zt("events"),this.client=zt("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;const 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]){const n=r||xs(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(uo.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const 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){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||xs(e,this.namespace);return typeof n>"u"?void 0:new co(new ta(n,zt("disableProviderPing")))}}var cve=Object.defineProperty,uve=(t,e,r)=>e in t?cve(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,c0=(t,e,r)=>uve(t,typeof e!="symbol"?e+"":e,r);class lve{constructor(e){c0(this,"name","tezos"),c0(this,"client"),c0(this,"httpProviders"),c0(this,"events"),c0(this,"namespace"),c0(this,"chainId"),this.namespace=e.namespace,this.events=zt("events"),this.client=zt("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;const 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]){const n=r||xs(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(uo.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{e[r]=this.createHttpProvider(r)}),e}getHttpProvider(){const 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){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||xs(e,this.namespace);return typeof n>"u"?void 0:new co(new ta(n))}}var dve=Object.defineProperty,hve=(t,e,r)=>e in t?dve(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,u0=(t,e,r)=>hve(t,typeof e!="symbol"?e+"":e,r);class fve{constructor(e){u0(this,"name",D0),u0(this,"client"),u0(this,"httpProviders"),u0(this,"events"),u0(this,"namespace"),u0(this,"chainId"),this.namespace=e.namespace,this.events=zt("events"),this.client=zt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(uo.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){var e,r;const n={};return(r=(e=this.namespace)==null?void 0:e.accounts)==null||r.forEach(i=>{const s=ig(i);n[`${s.namespace}:${s.reference}`]=this.createHttpProvider(i)}),n}getHttpProvider(e){const r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||xs(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new co(new ta(n,zt("disableProviderPing")))}}var pve=Object.defineProperty,gve=Object.defineProperties,mve=Object.getOwnPropertyDescriptors,hj=Object.getOwnPropertySymbols,wve=Object.prototype.hasOwnProperty,bve=Object.prototype.propertyIsEnumerable,zI=(t,e,r)=>e in t?pve(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,m3=(t,e)=>{for(var r in e||(e={}))wve.call(e,r)&&zI(t,r,e[r]);if(hj)for(var r of hj(e))bve.call(e,r)&&zI(t,r,e[r]);return t},iS=(t,e)=>gve(t,mve(e)),qs=(t,e,r)=>zI(t,typeof e!="symbol"?e+"":e,r);let yve=class vZ{constructor(e){qs(this,"client"),qs(this,"namespaces"),qs(this,"optionalNamespaces"),qs(this,"sessionProperties"),qs(this,"scopedProperties"),qs(this,"events",new R9),qs(this,"rpcProviders",{}),qs(this,"session"),qs(this,"providerOpts"),qs(this,"logger"),qs(this,"uri"),qs(this,"disableProviderPing",!1),this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Tv(Xm({level:(e==null?void 0:e.logger)||ej})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const r=new vZ(e);return await r.initialize(),r}async request(e,r,n){const[i,s]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:m3({},e),chainId:`${i}:${s}`,topic:this.session.topic,expiry:n})}sendAsync(e,r,n,i){const s=new Date().getTime();this.request(e,n,i).then(o=>r(null,rA(s,o))).catch(o=>r(o,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,scopedProperties:this.scopedProperties}),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:sr("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,r){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:n,response:i}=await this.client.authenticate(e,r);n&&(this.uri=n,this.events.emit("display_uri",n));const s=await i();if(this.session=s.session,this.session){const o=cj(this.session.namespaces);this.namespaces=g3(this.namespaces,o),await this.persist("namespaces",this.namespaces),this.onConnect()}return s}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){const{uri:r,approval:n}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties});r&&(this.uri=r,this.events.emit("display_uri",r));const i=await n();this.session=i;const s=cj(i.namespaces);return this.namespaces=g3(this.namespaces,s),await this.persist("namespaces",this.namespaces),await this.persist("optionalNamespaces",this.optionalNamespaces),this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;const[n,i]=this.validateChain(e),s=this.getProvider(n);s.name===D0?s.setDefaultChain(`${n}:${i}`,r):s.setDefaultChain(i,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(ld(r)){for(const n of r)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.logger.warn("abortPairingAttempt is deprecated. This is now a no-op.")}async checkStorage(){this.namespaces=await this.getFromStore("namespaces")||{},this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.session&&this.createProviders()}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){var e,r;if(this.client=this.providerOpts.client||await Mbe.init({core:this.providerOpts.core,logger:this.providerOpts.logger||ej,relayUrl:this.providerOpts.relayUrl||Kbe,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.providerOpts.session)try{this.session=this.client.session.get(this.providerOpts.session.topic)}catch(n){throw this.logger.error("Failed to get session",n),new Error(`The provided session: ${(r=(e=this.providerOpts)==null?void 0:e.session)==null?void 0:r.topic} doesn't exist in the Sign client`)}else{const n=this.client.session.getAll();this.session=n[0]}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()");const e=[...new Set(Object.keys(this.session.namespaces).map(r=>V0(r)))];nS("client",this.client),nS("events",this.events),nS("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;const n=Rye(r,this.session),i=bZ(n),s=g3(this.namespaces,this.optionalNamespaces),o=iS(m3({},s[r]),{accounts:n,chains:i});switch(r){case"eip155":this.rpcProviders[r]=new Uye({namespace:o});break;case"algorand":this.rpcProviders[r]=new Zye({namespace:o});break;case"solana":this.rpcProviders[r]=new qye({namespace:o});break;case"cosmos":this.rpcProviders[r]=new Vye({namespace:o});break;case"polkadot":this.rpcProviders[r]=new $ye({namespace:o});break;case"cip34":this.rpcProviders[r]=new Qye({namespace:o});break;case"elrond":this.rpcProviders[r]=new tve({namespace:o});break;case"multiversx":this.rpcProviders[r]=new ive({namespace:o});break;case"near":this.rpcProviders[r]=new ave({namespace:o});break;case"tezos":this.rpcProviders[r]=new lve({namespace:o});break;default:this.rpcProviders[D0]?this.rpcProviders[D0].updateNamespace(o):this.rpcProviders[D0]=new fve({namespace:o})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{var r;const{topic:n}=e;n===((r=this.session)==null?void 0:r.topic)&&this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{var r;const{params:n,topic:i}=e;if(i!==((r=this.session)==null?void 0:r.topic))return;const{event:s}=n;if(s.name==="accountsChanged"){const o=s.data;o&&ld(o)&&this.events.emit("accountsChanged",o.map(aj))}else if(s.name==="chainChanged"){const o=n.chainId,a=n.event.data,c=V0(o),u=rS(o)!==rS(a)?`${c}:${rS(a)}`:o;this.onChainChanged(u)}else this.events.emit(s.name,s.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var n,i;if(e!==((n=this.session)==null?void 0:n.topic))return;const{namespaces:s}=r,o=(i=this.client)==null?void 0:i.session.get(e);this.session=iS(m3({},o),{namespaces:s}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{var r;e.topic===((r=this.session)==null?void 0:r.topic)&&(await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",iS(m3({},sr("USER_DISCONNECTED")),{data:e.topic})))}),this.on(uo.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[D0]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){const{namespaces:r={},optionalNamespaces:n={},sessionProperties:i,scopedProperties:s}=e;this.optionalNamespaces=g3(r,n),this.sessionProperties=i,this.scopedProperties=s}validateChain(e){const[r,n]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(o=>V0(o)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&n)return[r,n];const i=V0(Object.keys(this.namespaces)[0]),s=this.rpcProviders[i].getDefaultChain();return[i,s]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}async onChainChanged(e,r=!1){if(!this.namespaces)return;const[n,i]=this.validateChain(e);if(!i)return;this.updateNamespaceChain(n,i),this.events.emit("chainChanged",i);const s=this.getProvider(n).getDefaultChain();r||this.getProvider(n).setDefaultChain(i),this.emitAccountsChangedOnChainChange({namespace:n,previousChainId:s,newChainId:e}),await this.persist("namespaces",this.namespaces)}emitAccountsChangedOnChainChange({namespace:e,previousChainId:r,newChainId:n}){var i,s;try{if(r===n)return;const o=(s=(i=this.session)==null?void 0:i.namespaces[e])==null?void 0:s.accounts;if(!o)return;const a=o.filter(c=>c.includes(`${n}:`)).map(aj);if(!ld(a))return;this.events.emit("accountsChanged",a)}catch(o){this.logger.warn("Failed to emit accountsChanged on chain change",o)}}updateNamespaceChain(e,r){if(!this.namespaces)return;const n=this.namespaces[e]?e:`${e}:${r}`,i={chains:[],methods:[],events:[],defaultChain:r};this.namespaces[n]?this.namespaces[n]&&(this.namespaces[n].defaultChain=r):this.namespaces[n]=i}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,await this.deleteFromStore("namespaces"),await this.deleteFromStore("optionalNamespaces"),await this.deleteFromStore("sessionProperties"),this.session=void 0,await this.cleanupPendingPairings({deletePairings:!0}),await this.cleanupStorage()}async persist(e,r){var n;const i=((n=this.session)==null?void 0:n.topic)||"";await this.client.core.storage.setItem(`${f3}/${e}${i}`,r)}async getFromStore(e){var r;const n=((r=this.session)==null?void 0:r.topic)||"";return await this.client.core.storage.getItem(`${f3}/${e}${n}`)}async deleteFromStore(e){var r;const n=((r=this.session)==null?void 0:r.topic)||"";await this.client.core.storage.removeItem(`${f3}/${e}${n}`)}async cleanupStorage(){var e;try{if(((e=this.client)==null?void 0:e.session.length)>0)return;const r=await this.client.core.storage.getKeys();for(const n of r)n.startsWith(f3)&&await this.client.core.storage.removeItem(n)}catch(r){this.logger.warn("Failed to cleanup storage",r)}}};const Cu={getSIWX(){return oe.state.siwx},async initializeIfEnabled(){var s;const t=oe.state.siwx,e=F.getActiveCaipAddress();if(!(t&&e))return;const[r,n,i]=e.split(":");if(F.checkIfSupportedNetwork(r))try{if((await t.getSessions(`${r}:${n}`,i)).length)return;await We.open({view:"SIWXSignMessage"})}catch(o){console.error("SIWXUtil:initializeIfEnabled",o),Re.sendEvent({type:"track",event:"SIWX_AUTH_ERROR",properties:this.getSIWXEventProperties()}),await((s=xe._getClient())==null?void 0:s.disconnect().catch(console.error)),X.reset("Connect"),Fe.showError("A problem occurred while trying initialize authentication")}},async requestSignMessage(){const t=oe.state.siwx,e=ue.getPlainAddress(F.getActiveCaipAddress()),r=F.getActiveCaipNetwork(),n=xe._getClient();if(!t)throw new Error("SIWX is not enabled");if(!e)throw new Error("No ActiveCaipAddress found");if(!r)throw new Error("No ActiveCaipNetwork or client found");if(!n)throw new Error("No ConnectionController client found");try{const i=await t.createMessage({chainId:r.caipNetworkId,accountAddress:e}),s=i.toString();ge.getConnectorId(r.chainNamespace)===_e.CONNECTOR_ID.AUTH&&X.pushTransactionStack({});const a=await n.signMessage(s);await t.addSession({data:i,message:s,signature:a}),We.close(),Re.sendEvent({type:"track",event:"SIWX_AUTH_SUCCESS",properties:this.getSIWXEventProperties()})}catch(i){const s=this.getSIWXEventProperties();(!We.state.open||X.state.view==="ApproveTransaction")&&await We.open({view:"SIWXSignMessage"}),s.isSmartAccount?Fe.showError("This application might not support Smart Accounts"):Fe.showError("Signature declined"),Re.sendEvent({type:"track",event:"SIWX_AUTH_ERROR",properties:s}),console.error("SWIXUtil:requestSignMessage",i)}},async cancelSignMessage(){var t;try{const e=this.getSIWX();((t=e==null?void 0:e.getRequired)==null?void 0:t.call(e))?await xe.disconnect():We.close(),X.reset("Connect"),Re.sendEvent({event:"CLICK_CANCEL_SIWX",type:"track",properties:this.getSIWXEventProperties()})}catch(e){console.error("SIWXUtil:cancelSignMessage",e)}},async getSessions(){const t=oe.state.siwx,e=ue.getPlainAddress(F.getActiveCaipAddress()),r=F.getActiveCaipNetwork();return t&&e&&r?t.getSessions(r.caipNetworkId,e):[]},async isSIWXCloseDisabled(){var e;const t=this.getSIWX();if(t){const r=X.state.view==="ApproveTransaction",n=X.state.view==="SIWXSignMessage";if(r||n)return((e=t.getRequired)==null?void 0:e.call(t))&&(await this.getSessions()).length===0}return!1},async universalProviderAuthenticate({universalProvider:t,chains:e,methods:r}){var a,c,u;const n=Cu.getSIWX(),i=new Set(e.map(l=>l.split(":")[0]));if(!n||i.size!==1||!i.has("eip155"))return!1;const s=await n.createMessage({chainId:((a=F.getActiveCaipNetwork())==null?void 0:a.caipNetworkId)||"",accountAddress:""}),o=await t.authenticate({nonce:s.nonce,domain:s.domain,uri:s.uri,exp:s.expirationTime,iat:s.issuedAt,nbf:s.notBefore,requestId:s.requestId,version:s.version,resources:s.resources,statement:s.statement,chainId:s.chainId,methods:r,chains:[s.chainId,...e.filter(l=>l!==s.chainId)]});if(Fe.showLoading("Authenticating...",{autoClose:!1}),re.setConnectedWalletInfo({...o.session.peer.metadata,name:o.session.peer.metadata.name,icon:(c=o.session.peer.metadata.icons)==null?void 0:c[0],type:"WALLET_CONNECT"},Array.from(i)[0]),(u=o==null?void 0:o.auths)!=null&&u.length){const l=o.auths.map(d=>{const h=t.client.formatAuthMessage({request:d.p,iss:d.p.iss});return{data:{...d.p,accountAddress:d.p.iss.split(":").slice(-1).join(""),chainId:d.p.iss.split(":").slice(2,4).join(":"),uri:d.p.aud,version:d.p.version||s.version,expirationTime:d.p.exp,issuedAt:d.p.iat,notBefore:d.p.nbf},message:h,signature:d.s.s,cacao:d}});try{await n.setSessions(l),Re.sendEvent({type:"track",event:"SIWX_AUTH_SUCCESS",properties:Cu.getSIWXEventProperties()})}catch(d){throw console.error("SIWX:universalProviderAuth - failed to set sessions",d),Re.sendEvent({type:"track",event:"SIWX_AUTH_ERROR",properties:Cu.getSIWXEventProperties()}),await t.disconnect().catch(console.error),d}finally{Fe.hide()}}return!0},getSIWXEventProperties(){var e,r;const t=F.state.activeChain;return{network:((e=F.state.activeCaipNetwork)==null?void 0:e.caipNetworkId)||"",isSmartAccount:((r=re.state.preferredAccountTypes)==null?void 0:r[t])===bt.ACCOUNT_TYPES.SMART_ACCOUNT}},async clearSessions(){const t=this.getSIWX();t&&await t.setSessions([])}},_Z={isUnsupportedChainView(){return X.state.view==="UnsupportedChain"||X.state.view==="SwitchNetwork"&&X.state.history.includes("UnsupportedChain")},async safeClose(){if(this.isUnsupportedChainView()){We.shake();return}if(await Cu.isSIWXCloseDisabled()){We.shake();return}We.close()}},Xt={METMASK_CONNECTOR_NAME:"MetaMask",TRUST_CONNECTOR_NAME:"Trust Wallet",SOLFLARE_CONNECTOR_NAME:"Solflare",PHANTOM_CONNECTOR_NAME:"Phantom",COIN98_CONNECTOR_NAME:"Coin98",MAGIC_EDEN_CONNECTOR_NAME:"Magic Eden",BACKPACK_CONNECTOR_NAME:"Backpack",BITGET_CONNECTOR_NAME:"Bitget Wallet",FRONTIER_CONNECTOR_NAME:"Frontier",XVERSE_CONNECTOR_NAME:"Xverse Wallet",LEATHER_CONNECTOR_NAME:"Leather",EIP155:"eip155",ADD_CHAIN_METHOD:"wallet_addEthereumChain",EIP6963_ANNOUNCE_EVENT:"eip6963:announceProvider",EIP6963_REQUEST_EVENT:"eip6963:requestProvider",CONNECTOR_RDNS_MAP:{coinbaseWallet:"com.coinbase.wallet",coinbaseWalletSDK:"com.coinbase.wallet"},CONNECTOR_TYPE_EXTERNAL:"EXTERNAL",CONNECTOR_TYPE_WALLET_CONNECT:"WALLET_CONNECT",CONNECTOR_TYPE_INJECTED:"INJECTED",CONNECTOR_TYPE_ANNOUNCED:"ANNOUNCED",CONNECTOR_TYPE_AUTH:"AUTH",CONNECTOR_TYPE_MULTI_CHAIN:"MULTI_CHAIN",CONNECTOR_TYPE_W3M_AUTH:"ID_AUTH"},Ua={ConnectorExplorerIds:{[_e.CONNECTOR_ID.COINBASE]:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",[_e.CONNECTOR_ID.COINBASE_SDK]:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",[_e.CONNECTOR_ID.SAFE]:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",[_e.CONNECTOR_ID.LEDGER]:"19177a98252e07ddfc9af2083ba8e07ef627cb6103467ffebb3f8f4205fd7927",[_e.CONNECTOR_ID.OKX]:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",[Xt.METMASK_CONNECTOR_NAME]:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",[Xt.TRUST_CONNECTOR_NAME]:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",[Xt.SOLFLARE_CONNECTOR_NAME]:"1ca0bdd4747578705b1939af023d120677c64fe6ca76add81fda36e350605e79",[Xt.PHANTOM_CONNECTOR_NAME]:"a797aa35c0fadbfc1a53e7f675162ed5226968b44a19ee3d24385c64d1d3c393",[Xt.COIN98_CONNECTOR_NAME]:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",[Xt.MAGIC_EDEN_CONNECTOR_NAME]:"8b830a2b724a9c3fbab63af6f55ed29c9dfa8a55e732dc88c80a196a2ba136c6",[Xt.BACKPACK_CONNECTOR_NAME]:"2bd8c14e035c2d48f184aaa168559e86b0e3433228d3c4075900a221785019b0",[Xt.BITGET_CONNECTOR_NAME]:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",[Xt.FRONTIER_CONNECTOR_NAME]:"85db431492aa2e8672e93f4ea7acf10c88b97b867b0d373107af63dc4880f041",[Xt.XVERSE_CONNECTOR_NAME]:"2a87d74ae02e10bdd1f51f7ce6c4e1cc53cd5f2c0b6b5ad0d7b3007d2b13de7b",[Xt.LEATHER_CONNECTOR_NAME]:"483afe1df1df63daf313109971ff3ef8356ddf1cc4e45877d205eee0b7893a13"},NetworkImageIds:{1:"ba0ba0cd-17c6-4806-ad93-f9d174f17900",42161:"3bff954d-5cb0-47a0-9a23-d20192e74600",43114:"30c46e53-e989-45fb-4549-be3bd4eb3b00",56:"93564157-2e8e-4ce7-81df-b264dbee9b00",250:"06b26297-fe0c-4733-5d6b-ffa5498aac00",10:"ab9c186a-c52f-464b-2906-ca59d760a400",137:"41d04d42-da3b-4453-8506-668cc0727900",5e3:"e86fae9b-b770-4eea-e520-150e12c81100",295:"6a97d510-cac8-4e58-c7ce-e8681b044c00",11155111:"e909ea0a-f92a-4512-c8fc-748044ea6800",84532:"a18a7ecd-e307-4360-4746-283182228e00",1301:"4eeea7ef-0014-4649-5d1d-07271a80f600",130:"2257980a-3463-48c6-cbac-a42d2a956e00",10143:"0a728e83-bacb-46db-7844-948f05434900",100:"02b53f6a-e3d4-479e-1cb4-21178987d100",9001:"f926ff41-260d-4028-635e-91913fc28e00",324:"b310f07f-4ef7-49f3-7073-2a0a39685800",314:"5a73b3dd-af74-424e-cae0-0de859ee9400",4689:"34e68754-e536-40da-c153-6ef2e7188a00",1088:"3897a66d-40b9-4833-162f-a2c90531c900",1284:"161038da-44ae-4ec7-1208-0ea569454b00",1285:"f1d73bb6-5450-4e18-38f7-fb6484264a00",7777777:"845c60df-d429-4991-e687-91ae45791600",42220:"ab781bbc-ccc6-418d-d32d-789b15da1f00",8453:"7289c336-3981-4081-c5f4-efc26ac64a00",1313161554:"3ff73439-a619-4894-9262-4470c773a100",2020:"b8101fc0-9c19-4b6f-ec65-f6dfff106e00",2021:"b8101fc0-9c19-4b6f-ec65-f6dfff106e00",80094:"e329c2c9-59b0-4a02-83e4-212ff3779900",2741:"fc2427d1-5af9-4a9c-8da5-6f94627cd900","5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp":"a1b58899-f671-4276-6a5e-56ca5bd59700","4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z":"a1b58899-f671-4276-6a5e-56ca5bd59700",EtWTRABZaYq6iMfeYKouRu166VU2xqa1:"a1b58899-f671-4276-6a5e-56ca5bd59700","000000000019d6689c085ae165831e93":"0b4838db-0161-4ffe-022d-532bf03dba00","000000000933ea01ad0ee984209779ba":"39354064-d79b-420b-065d-f980c4b78200"},ConnectorImageIds:{[_e.CONNECTOR_ID.COINBASE]:"0c2840c3-5b04-4c44-9661-fbd4b49e1800",[_e.CONNECTOR_ID.COINBASE_SDK]:"0c2840c3-5b04-4c44-9661-fbd4b49e1800",[_e.CONNECTOR_ID.SAFE]:"461db637-8616-43ce-035a-d89b8a1d5800",[_e.CONNECTOR_ID.LEDGER]:"54a1aa77-d202-4f8d-0fb2-5d2bb6db0300",[_e.CONNECTOR_ID.WALLET_CONNECT]:"ef1a1fcf-7fe8-4d69-bd6d-fda1345b4400",[_e.CONNECTOR_ID.INJECTED]:"07ba87ed-43aa-4adf-4540-9e6a2b9cae00"},ConnectorNamesMap:{[_e.CONNECTOR_ID.INJECTED]:"Browser Wallet",[_e.CONNECTOR_ID.WALLET_CONNECT]:"WalletConnect",[_e.CONNECTOR_ID.COINBASE]:"Coinbase",[_e.CONNECTOR_ID.COINBASE_SDK]:"Coinbase",[_e.CONNECTOR_ID.LEDGER]:"Ledger",[_e.CONNECTOR_ID.SAFE]:"Safe"},ConnectorTypesMap:{[_e.CONNECTOR_ID.INJECTED]:"INJECTED",[_e.CONNECTOR_ID.WALLET_CONNECT]:"WALLET_CONNECT",[_e.CONNECTOR_ID.EIP6963]:"ANNOUNCED",[_e.CONNECTOR_ID.AUTH]:"AUTH"}},aA={getCaipTokens(t){if(!t)return;const e={};return Object.entries(t).forEach(([r,n])=>{e[`${Xt.EIP155}:${r}`]=n}),e},isLowerCaseMatch(t,e){return(t==null?void 0:t.toLowerCase())===(e==null?void 0:e.toLowerCase())}},vve=new AbortController,Do={EmbeddedWalletAbortController:vve,UniversalProviderErrors:{UNAUTHORIZED_DOMAIN_NOT_ALLOWED:{message:"Unauthorized: origin not allowed",alertErrorKey:"INVALID_APP_CONFIGURATION"},JWT_VALIDATION_ERROR:{message:"JWT validation error: JWT Token is not yet valid",alertErrorKey:"JWT_TOKEN_NOT_VALID"},INVALID_KEY:{message:"Unauthorized: invalid key",alertErrorKey:"INVALID_PROJECT_ID"}},ALERT_ERRORS:{SWITCH_NETWORK_NOT_FOUND:{shortMessage:"Network Not Found",longMessage:"Network not found - please make sure it is included in 'networks' array in createAppKit function"},INVALID_APP_CONFIGURATION:{shortMessage:"Invalid App Configuration",longMessage:()=>`Origin ${_ve()?window.origin:"unknown"} not found on Allowlist - update configuration on cloud.reown.com`},IFRAME_LOAD_FAILED:{shortMessage:"Network Error - Could not load embedded wallet",longMessage:()=>"There was an issue loading the embedded wallet. Please try again later."},IFRAME_REQUEST_TIMEOUT:{shortMessage:"Embedded Wallet Request Timed Out",longMessage:()=>"There was an issue doing the request to the embedded wallet. Please try again later."},UNVERIFIED_DOMAIN:{shortMessage:"Invalid App Configuration",longMessage:()=>"There was an issue loading the embedded wallet. Please verify that your domain is allowed at cloud.reown.com"},JWT_TOKEN_NOT_VALID:{shortMessage:"Session Expired",longMessage:"Invalid session found on UniversalProvider - please check your time settings and connect again"},INVALID_PROJECT_ID:{shortMessage:"Invalid App Configuration",longMessage:"Invalid Project ID - update configuration"},PROJECT_ID_NOT_CONFIGURED:{shortMessage:"Project ID Not Configured",longMessage:"Project ID Not Configured - update configuration on cloud.reown.com"}}};function _ve(){return typeof window<"u"}const Eve={createLogger(t,e="error"){const r=Xm({level:e}),{logger:n}=N9({opts:r});return n.error=(...i)=>{for(const s of i)if(s instanceof Error){t(s,...i);return}t(void 0,...i)},n}},Cve="rpc.walletconnect.org";function fj(t,e){const r=new URL("https://rpc.walletconnect.org/v1/");return r.searchParams.set("chainId",t),r.searchParams.set("projectId",e),r.toString()}const sS=["near:mainnet","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","eip155:1101","eip155:56","eip155:42161","eip155:7777777","eip155:59144","eip155:324","solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1","eip155:5000","solana:4sgjmw1sunhzsxgspuhpqldx6wiyjntz","eip155:80084","eip155:5003","eip155:100","eip155:8453","eip155:42220","eip155:1313161555","eip155:17000","eip155:1","eip155:300","eip155:1313161554","eip155:1329","eip155:84532","eip155:421614","eip155:11155111","eip155:8217","eip155:43114","solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z","eip155:999999999","eip155:11155420","eip155:80002","eip155:97","eip155:43113","eip155:137","eip155:10","eip155:1301","bip122:000000000019d6689c085ae165831e93","bip122:000000000933ea01ad0ee984209779ba"],M0={extendRpcUrlWithProjectId(t,e){let r=!1;try{r=new URL(t).host===Cve}catch{r=!1}if(r){const n=new URL(t);return n.searchParams.has("projectId")||n.searchParams.set("projectId",e),n.toString()}return t},isCaipNetwork(t){return"chainNamespace"in t&&"caipNetworkId"in t},getChainNamespace(t){return this.isCaipNetwork(t)?t.chainNamespace:_e.CHAIN.EVM},getCaipNetworkId(t){return this.isCaipNetwork(t)?t.caipNetworkId:`${_e.CHAIN.EVM}:${t.id}`},getDefaultRpcUrl(t,e,r){var i,s,o;const n=(o=(s=(i=t.rpcUrls)==null?void 0:i.default)==null?void 0:s.http)==null?void 0:o[0];return sS.includes(e)?fj(e,r):n||""},extendCaipNetwork(t,{customNetworkImageUrls:e,projectId:r,customRpcUrls:n}){var h,f,g,p,m;const i=this.getChainNamespace(t),s=this.getCaipNetworkId(t),o=(h=t.rpcUrls.default.http)==null?void 0:h[0],a=this.getDefaultRpcUrl(t,s,r),c=((p=(g=(f=t==null?void 0:t.rpcUrls)==null?void 0:f.chainDefault)==null?void 0:g.http)==null?void 0:p[0])||o,u=((m=n==null?void 0:n[s])==null?void 0:m.map(b=>b.url))||[],l=[...u,a],d=[...u];return c&&!d.includes(c)&&d.push(c),{...t,chainNamespace:i,caipNetworkId:s,assets:{imageId:Ua.NetworkImageIds[t.id],imageUrl:e==null?void 0:e[t.id]},rpcUrls:{...t.rpcUrls,default:{http:l},chainDefault:{http:d}}}},extendCaipNetworks(t,{customNetworkImageUrls:e,projectId:r,customRpcUrls:n}){return t.map(i=>M0.extendCaipNetwork(i,{customNetworkImageUrls:e,customRpcUrls:n,projectId:r}))},getViemTransport(t,e,r){var i,s,o;const n=[];return r==null||r.forEach(a=>{n.push(J2(a.url,a.config))}),sS.includes(t.caipNetworkId)&&n.push(J2(fj(t.caipNetworkId,e),{fetchOptions:{headers:{"Content-Type":"text/plain"}}})),(o=(s=(i=t==null?void 0:t.rpcUrls)==null?void 0:i.default)==null?void 0:s.http)==null||o.forEach(a=>{n.push(J2(a))}),rk(n)},extendWagmiTransports(t,e,r){if(sS.includes(t.caipNetworkId)){const n=this.getDefaultRpcUrl(t,t.caipNetworkId,e);return rk([r,J2(n)])}return r},getUnsupportedNetwork(t){return{id:t.split(":")[1],caipNetworkId:t,name:_e.UNSUPPORTED_NETWORK_NAME,chainNamespace:t.split(":")[0],nativeCurrency:{name:"",decimals:0,symbol:""},rpcUrls:{default:{http:[]}}}},getCaipNetworkFromStorage(t){var c;const e=Le.getActiveCaipNetworkId(),r=F.getAllRequestedCaipNetworks(),n=Array.from(((c=F.state.chains)==null?void 0:c.keys())||[]),i=e==null?void 0:e.split(":")[0],s=i?n.includes(i):!1,o=r==null?void 0:r.find(u=>u.caipNetworkId===e);return s&&!o&&e?this.getUnsupportedNetwork(e):o||t||(r==null?void 0:r[0])}},PC={eip155:void 0,solana:void 0,polkadot:void 0,bip122:void 0,cosmos:void 0},Mi=rr({providers:{...PC},providerIds:{...PC}}),kt={state:Mi,subscribeKey(t,e){return dn(Mi,t,e)},subscribe(t){return ln(Mi,()=>{t(Mi)})},subscribeProviders(t){return ln(Mi.providers,()=>t(Mi.providers))},setProvider(t,e){e&&(Mi.providers[t]=Nf(e))},getProvider(t){return Mi.providers[t]},setProviderId(t,e){e&&(Mi.providerIds[t]=e)},getProviderId(t){if(t)return Mi.providerIds[t]},reset(){Mi.providers={...PC},Mi.providerIds={...PC}},resetChain(t){Mi.providers[t]=void 0,Mi.providerIds[t]=void 0}},pj={transactionHash:/^0x(?:[A-Fa-f0-9]{64})$/u,signedMessage:/^0x(?:[a-fA-F0-9]{62,})$/u},Bn={set(t,e){ei.isClient&&localStorage.setItem(`${Ye.STORAGE_KEY}${t}`,e)},get(t){return ei.isClient?localStorage.getItem(`${Ye.STORAGE_KEY}${t}`):null},delete(t,e){ei.isClient&&(e?localStorage.removeItem(t):localStorage.removeItem(`${Ye.STORAGE_KEY}${t}`))}},w3=30*1e3,ei={checkIfAllowedToTriggerEmail(){const t=Bn.get(Ye.LAST_EMAIL_LOGIN_TIME);if(t){const e=Date.now()-Number(t);if(ei;function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{const s={};for(const o of i)s[o]=o;return s},t.getValidEnumValues=i=>{const s=t.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),o={};for(const a of s)o[a]=i[a];return t.objectValues(o)},t.objectValues=i=>t.objectKeys(i).map(function(s){return i[s]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const s=[];for(const o in i)Object.prototype.hasOwnProperty.call(i,o)&&s.push(o);return s},t.find=(i,s)=>{for(const o of i)if(s(o))return o},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function n(i,s=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}t.joinValues=n,t.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(qt||(qt={}));var WI;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(WI||(WI={}));const qe=qt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ll=t=>{switch(typeof t){case"undefined":return qe.undefined;case"string":return qe.string;case"number":return isNaN(t)?qe.nan:qe.number;case"boolean":return qe.boolean;case"function":return qe.function;case"bigint":return qe.bigint;case"symbol":return qe.symbol;case"object":return Array.isArray(t)?qe.array:t===null?qe.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?qe.promise:typeof Map<"u"&&t instanceof Map?qe.map:typeof Set<"u"&&t instanceof Set?qe.set:typeof Date<"u"&&t instanceof Date?qe.date:qe.object;default:return qe.unknown}},$e=qt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Ave=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class Ho extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const r=e||function(s){return s.message},n={_errors:[]},i=s=>{for(const o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)n._errors.push(r(o));else{let a=n,c=0;for(;cr.message){const r={},n=[];for(const i of this.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}Ho.create=t=>new Ho(t);const oy=(t,e)=>{let r;switch(t.code){case $e.invalid_type:t.received===qe.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case $e.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,qt.jsonStringifyReplacer)}`;break;case $e.unrecognized_keys:r=`Unrecognized key(s) in object: ${qt.joinValues(t.keys,", ")}`;break;case $e.invalid_union:r="Invalid input";break;case $e.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${qt.joinValues(t.options)}`;break;case $e.invalid_enum_value:r=`Invalid enum value. Expected ${qt.joinValues(t.options)}, received '${t.received}'`;break;case $e.invalid_arguments:r="Invalid function arguments";break;case $e.invalid_return_type:r="Invalid function return type";break;case $e.invalid_date:r="Invalid date";break;case $e.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:qt.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case $e.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case $e.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case $e.custom:r="Invalid input";break;case $e.invalid_intersection_types:r="Intersection results could not be merged";break;case $e.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case $e.not_finite:r="Number must be finite";break;default:r=e.defaultError,qt.assertNever(t)}return{message:r}};let EZ=oy;function xve(t){EZ=t}function OC(){return EZ}const RC=t=>{const{data:e,path:r,errorMaps:n,issueData:i}=t,s=[...r,...i.path||[]],o={...i,path:s};let a="";const c=n.filter(u=>!!u).slice().reverse();for(const u of c)a=u(o,{data:e,defaultError:a}).message;return{...i,path:s,message:i.message||a}},Sve=[];function Ke(t,e){const r=RC({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,OC(),oy].filter(n=>!!n)});t.common.issues.push(r)}class ni{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const n=[];for(const i of r){if(i.status==="aborted")return gt;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){const n=[];for(const i of r)n.push({key:await i.key,value:await i.value});return ni.mergeObjectSync(e,n)}static mergeObjectSync(e,r){const n={};for(const i of r){const{key:s,value:o}=i;if(s.status==="aborted"||o.status==="aborted")return gt;s.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(n[s.value]=o.value)}return{status:e.value,value:n}}}const gt=Object.freeze({status:"aborted"}),CZ=t=>({status:"dirty",value:t}),Ai=t=>({status:"valid",value:t}),VI=t=>t.status==="aborted",GI=t=>t.status==="dirty",ay=t=>t.status==="valid",kC=t=>typeof Promise<"u"&&t instanceof Promise;var ot;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(ot||(ot={}));class Qa{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const gj=(t,e)=>{if(ay(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new Ho(t.common.issues);return this._error=r,this._error}}};function yt(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(o,a)=>o.code!=="invalid_type"?{message:a.defaultError}:typeof a.data>"u"?{message:n??a.defaultError}:{message:r??a.defaultError},description:i}}class St{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return Ll(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Ll(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ni,ctx:{common:e.parent.common,data:e.data,parsedType:Ll(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(kC(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){var n;const i={common:{issues:[],async:(n=r==null?void 0:r.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ll(e)},s=this._parseSync({data:e,path:i.path,parent:i});return gj(i,s)}async parseAsync(e,r){const n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){const n={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ll(e)},i=this._parse({data:e,path:n.path,parent:n}),s=await(kC(i)?i:Promise.resolve(i));return gj(n,s)}refine(e,r){const n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,s)=>{const o=e(i),a=()=>s.addIssue({code:$e.custom,...n(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new zo({schema:this,typeName:lt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Au.create(this,this._def)}nullable(){return qf.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return qo.create(this,this._def)}promise(){return vm.create(this,this._def)}or(e){return dy.create([this,e],this._def)}and(e){return hy.create(this,e,this._def)}transform(e){return new zo({...yt(this._def),schema:this,typeName:lt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new wy({...yt(this._def),innerType:this,defaultValue:r,typeName:lt.ZodDefault})}brand(){return new xZ({typeName:lt.ZodBranded,type:this,...yt(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new BC({...yt(this._def),innerType:this,catchValue:r,typeName:lt.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Fv.create(this,e)}readonly(){return MC.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Tve=/^c[^\s-]{8,}$/i,Ive=/^[a-z][a-z0-9]*$/,Pve=/^[0-9A-HJKMNP-TV-Z]{26}$/,Ove=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Rve=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,kve="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let oS;const Nve=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,$ve=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,jve=t=>t.precision?t.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}Z$`):t.precision===0?t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function Bve(t,e){return!!((e==="v4"||!e)&&Nve.test(t)||(e==="v6"||!e)&&$ve.test(t))}class Uo extends St{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==qe.string){const s=this._getOrReturnCtx(e);return Ke(s,{code:$e.invalid_type,expected:qe.string,received:s.parsedType}),gt}const n=new ni;let i;for(const s of this._def.checks)if(s.kind==="min")e.data.lengths.value&&(i=this._getOrReturnCtx(e,i),Ke(i,{code:$e.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){const o=e.data.length>s.value,a=e.data.lengthe.test(i),{validation:r,code:$e.invalid_string,...ot.errToObj(n)})}_addCheck(e){return new Uo({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ot.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ot.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ot.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ot.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ot.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ot.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ot.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ot.errToObj(e)})}datetime(e){var r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(r=e==null?void 0:e.offset)!==null&&r!==void 0?r:!1,...ot.errToObj(e==null?void 0:e.message)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...ot.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...ot.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...ot.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...ot.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...ot.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...ot.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...ot.errToObj(r)})}nonempty(e){return this.min(1,ot.errToObj(e))}trim(){return new Uo({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Uo({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Uo({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value{var e;return new Uo({checks:[],typeName:lt.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...yt(t)})};function Dve(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,s=parseInt(t.toFixed(i).replace(".","")),o=parseInt(e.toFixed(i).replace(".",""));return s%o/Math.pow(10,i)}class wd extends St{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==qe.number){const s=this._getOrReturnCtx(e);return Ke(s,{code:$e.invalid_type,expected:qe.number,received:s.parsedType}),gt}let n;const i=new ni;for(const s of this._def.checks)s.kind==="int"?qt.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),Ke(n,{code:$e.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.datas.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),Ke(n,{code:$e.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?Dve(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),Ke(n,{code:$e.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),Ke(n,{code:$e.not_finite,message:s.message}),i.dirty()):qt.assertNever(s);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,ot.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ot.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ot.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ot.toString(r))}setLimit(e,r,n,i){return new wd({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:ot.toString(i)}]})}_addCheck(e){return new wd({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ot.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ot.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ot.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ot.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ot.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ot.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:ot.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ot.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ot.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.valuee.kind==="int"||e.kind==="multipleOf"&&qt.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.valuenew wd({checks:[],typeName:lt.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...yt(t)});class bd extends St{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==qe.bigint){const s=this._getOrReturnCtx(e);return Ke(s,{code:$e.invalid_type,expected:qe.bigint,received:s.parsedType}),gt}let n;const i=new ni;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.datas.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),Ke(n,{code:$e.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),Ke(n,{code:$e.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):qt.assertNever(s);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,ot.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ot.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ot.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ot.toString(r))}setLimit(e,r,n,i){return new bd({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:ot.toString(i)}]})}_addCheck(e){return new bd({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ot.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ot.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ot.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ot.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ot.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value{var e;return new bd({checks:[],typeName:lt.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...yt(t)})};class cy extends St{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==qe.boolean){const n=this._getOrReturnCtx(e);return Ke(n,{code:$e.invalid_type,expected:qe.boolean,received:n.parsedType}),gt}return Ai(e.data)}}cy.create=t=>new cy({typeName:lt.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...yt(t)});class Ff extends St{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==qe.date){const s=this._getOrReturnCtx(e);return Ke(s,{code:$e.invalid_type,expected:qe.date,received:s.parsedType}),gt}if(isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return Ke(s,{code:$e.invalid_date}),gt}const n=new ni;let i;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()s.value&&(i=this._getOrReturnCtx(e,i),Ke(i,{code:$e.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):qt.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Ff({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:ot.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:ot.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew Ff({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:lt.ZodDate,...yt(t)});class NC extends St{_parse(e){if(this._getType(e)!==qe.symbol){const n=this._getOrReturnCtx(e);return Ke(n,{code:$e.invalid_type,expected:qe.symbol,received:n.parsedType}),gt}return Ai(e.data)}}NC.create=t=>new NC({typeName:lt.ZodSymbol,...yt(t)});class uy extends St{_parse(e){if(this._getType(e)!==qe.undefined){const n=this._getOrReturnCtx(e);return Ke(n,{code:$e.invalid_type,expected:qe.undefined,received:n.parsedType}),gt}return Ai(e.data)}}uy.create=t=>new uy({typeName:lt.ZodUndefined,...yt(t)});class ly extends St{_parse(e){if(this._getType(e)!==qe.null){const n=this._getOrReturnCtx(e);return Ke(n,{code:$e.invalid_type,expected:qe.null,received:n.parsedType}),gt}return Ai(e.data)}}ly.create=t=>new ly({typeName:lt.ZodNull,...yt(t)});class ym extends St{constructor(){super(...arguments),this._any=!0}_parse(e){return Ai(e.data)}}ym.create=t=>new ym({typeName:lt.ZodAny,...yt(t)});class Pf extends St{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ai(e.data)}}Pf.create=t=>new Pf({typeName:lt.ZodUnknown,...yt(t)});class Pu extends St{_parse(e){const r=this._getOrReturnCtx(e);return Ke(r,{code:$e.invalid_type,expected:qe.never,received:r.parsedType}),gt}}Pu.create=t=>new Pu({typeName:lt.ZodNever,...yt(t)});class $C extends St{_parse(e){if(this._getType(e)!==qe.undefined){const n=this._getOrReturnCtx(e);return Ke(n,{code:$e.invalid_type,expected:qe.void,received:n.parsedType}),gt}return Ai(e.data)}}$C.create=t=>new $C({typeName:lt.ZodVoid,...yt(t)});class qo extends St{_parse(e){const{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==qe.array)return Ke(r,{code:$e.invalid_type,expected:qe.array,received:r.parsedType}),gt;if(i.exactLength!==null){const o=r.data.length>i.exactLength.value,a=r.data.lengthi.maxLength.value&&(Ke(r,{code:$e.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((o,a)=>i.type._parseAsync(new Qa(r,o,r.path,a)))).then(o=>ni.mergeArray(n,o));const s=[...r.data].map((o,a)=>i.type._parseSync(new Qa(r,o,r.path,a)));return ni.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new qo({...this._def,minLength:{value:e,message:ot.toString(r)}})}max(e,r){return new qo({...this._def,maxLength:{value:e,message:ot.toString(r)}})}length(e,r){return new qo({...this._def,exactLength:{value:e,message:ot.toString(r)}})}nonempty(e){return this.min(1,e)}}qo.create=(t,e)=>new qo({type:t,minLength:null,maxLength:null,exactLength:null,typeName:lt.ZodArray,...yt(e)});function L0(t){if(t instanceof Mr){const e={};for(const r in t.shape){const n=t.shape[r];e[r]=Au.create(L0(n))}return new Mr({...t._def,shape:()=>e})}else return t instanceof qo?new qo({...t._def,type:L0(t.element)}):t instanceof Au?Au.create(L0(t.unwrap())):t instanceof qf?qf.create(L0(t.unwrap())):t instanceof Xa?Xa.create(t.items.map(e=>L0(e))):t}class Mr extends St{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),r=qt.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==qe.object){const u=this._getOrReturnCtx(e);return Ke(u,{code:$e.invalid_type,expected:qe.object,received:u.parsedType}),gt}const{status:n,ctx:i}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Pu&&this._def.unknownKeys==="strip"))for(const u in i.data)o.includes(u)||a.push(u);const c=[];for(const u of o){const l=s[u],d=i.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Qa(i,d,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof Pu){const u=this._def.unknownKeys;if(u==="passthrough")for(const l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:i.data[l]}});else if(u==="strict")a.length>0&&(Ke(i,{code:$e.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const l of a){const d=i.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Qa(i,d,i.path,l)),alwaysSet:l in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const u=[];for(const l of c){const d=await l.key;u.push({key:d,value:await l.value,alwaysSet:l.alwaysSet})}return u}).then(u=>ni.mergeObjectSync(n,u)):ni.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return ot.errToObj,new Mr({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var i,s,o,a;const c=(o=(s=(i=this._def).errorMap)===null||s===void 0?void 0:s.call(i,r,n).message)!==null&&o!==void 0?o:n.defaultError;return r.code==="unrecognized_keys"?{message:(a=ot.errToObj(e).message)!==null&&a!==void 0?a:c}:{message:c}}}:{}})}strip(){return new Mr({...this._def,unknownKeys:"strip"})}passthrough(){return new Mr({...this._def,unknownKeys:"passthrough"})}extend(e){return new Mr({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Mr({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:lt.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new Mr({...this._def,catchall:e})}pick(e){const r={};return qt.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new Mr({...this._def,shape:()=>r})}omit(e){const r={};return qt.objectKeys(this.shape).forEach(n=>{e[n]||(r[n]=this.shape[n])}),new Mr({...this._def,shape:()=>r})}deepPartial(){return L0(this)}partial(e){const r={};return qt.objectKeys(this.shape).forEach(n=>{const i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}),new Mr({...this._def,shape:()=>r})}required(e){const r={};return qt.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof Au;)s=s._def.innerType;r[n]=s}}),new Mr({...this._def,shape:()=>r})}keyof(){return AZ(qt.objectKeys(this.shape))}}Mr.create=(t,e)=>new Mr({shape:()=>t,unknownKeys:"strip",catchall:Pu.create(),typeName:lt.ZodObject,...yt(e)});Mr.strictCreate=(t,e)=>new Mr({shape:()=>t,unknownKeys:"strict",catchall:Pu.create(),typeName:lt.ZodObject,...yt(e)});Mr.lazycreate=(t,e)=>new Mr({shape:t,unknownKeys:"strip",catchall:Pu.create(),typeName:lt.ZodObject,...yt(e)});class dy extends St{_parse(e){const{ctx:r}=this._processInputParams(e),n=this._def.options;function i(s){for(const a of s)if(a.result.status==="valid")return a.result;for(const a of s)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;const o=s.map(a=>new Ho(a.ctx.common.issues));return Ke(r,{code:$e.invalid_union,unionErrors:o}),gt}if(r.common.async)return Promise.all(n.map(async s=>{const o={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(i);{let s;const o=[];for(const c of n){const u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!s&&(s={result:l,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;const a=o.map(c=>new Ho(c));return Ke(r,{code:$e.invalid_union,unionErrors:a}),gt}}get options(){return this._def.options}}dy.create=(t,e)=>new dy({options:t,typeName:lt.ZodUnion,...yt(e)});const X4=t=>t instanceof py?X4(t.schema):t instanceof zo?X4(t.innerType()):t instanceof gy?[t.value]:t instanceof yd?t.options:t instanceof my?Object.keys(t.enum):t instanceof wy?X4(t._def.innerType):t instanceof uy?[void 0]:t instanceof ly?[null]:null;class cA extends St{_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==qe.object)return Ke(r,{code:$e.invalid_type,expected:qe.object,received:r.parsedType}),gt;const n=this.discriminator,i=r.data[n],s=this.optionsMap.get(i);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(Ke(r,{code:$e.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),gt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){const i=new Map;for(const s of r){const o=X4(s.shape[e]);if(!o)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const a of o){if(i.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);i.set(a,s)}}return new cA({typeName:lt.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...yt(n)})}}function KI(t,e){const r=Ll(t),n=Ll(e);if(t===e)return{valid:!0,data:t};if(r===qe.object&&n===qe.object){const i=qt.objectKeys(e),s=qt.objectKeys(t).filter(a=>i.indexOf(a)!==-1),o={...t,...e};for(const a of s){const c=KI(t[a],e[a]);if(!c.valid)return{valid:!1};o[a]=c.data}return{valid:!0,data:o}}else if(r===qe.array&&n===qe.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let s=0;s{if(VI(s)||VI(o))return gt;const a=KI(s.value,o.value);return a.valid?((GI(s)||GI(o))&&r.dirty(),{status:r.value,value:a.data}):(Ke(n,{code:$e.invalid_intersection_types}),gt)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,o])=>i(s,o)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}hy.create=(t,e,r)=>new hy({left:t,right:e,typeName:lt.ZodIntersection,...yt(r)});class Xa extends St{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==qe.array)return Ke(n,{code:$e.invalid_type,expected:qe.array,received:n.parsedType}),gt;if(n.data.lengththis._def.items.length&&(Ke(n,{code:$e.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const s=[...n.data].map((o,a)=>{const c=this._def.items[a]||this._def.rest;return c?c._parse(new Qa(n,o,n.path,a)):null}).filter(o=>!!o);return n.common.async?Promise.all(s).then(o=>ni.mergeArray(r,o)):ni.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new Xa({...this._def,rest:e})}}Xa.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Xa({items:t,typeName:lt.ZodTuple,rest:null,...yt(e)})};class fy extends St{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==qe.object)return Ke(n,{code:$e.invalid_type,expected:qe.object,received:n.parsedType}),gt;const i=[],s=this._def.keyType,o=this._def.valueType;for(const a in n.data)i.push({key:s._parse(new Qa(n,a,n.path,a)),value:o._parse(new Qa(n,n.data[a],n.path,a))});return n.common.async?ni.mergeObjectAsync(r,i):ni.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof St?new fy({keyType:e,valueType:r,typeName:lt.ZodRecord,...yt(n)}):new fy({keyType:Uo.create(),valueType:e,typeName:lt.ZodRecord,...yt(r)})}}class jC extends St{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==qe.map)return Ke(n,{code:$e.invalid_type,expected:qe.map,received:n.parsedType}),gt;const i=this._def.keyType,s=this._def.valueType,o=[...n.data.entries()].map(([a,c],u)=>({key:i._parse(new Qa(n,a,n.path,[u,"key"])),value:s._parse(new Qa(n,c,n.path,[u,"value"]))}));if(n.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const c of o){const u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return gt;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}})}else{const a=new Map;for(const c of o){const u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return gt;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}}jC.create=(t,e,r)=>new jC({valueType:e,keyType:t,typeName:lt.ZodMap,...yt(r)});class Hf extends St{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==qe.set)return Ke(n,{code:$e.invalid_type,expected:qe.set,received:n.parsedType}),gt;const i=this._def;i.minSize!==null&&n.data.sizei.maxSize.value&&(Ke(n,{code:$e.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());const s=this._def.valueType;function o(c){const u=new Set;for(const l of c){if(l.status==="aborted")return gt;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}const a=[...n.data.values()].map((c,u)=>s._parse(new Qa(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>o(c)):o(a)}min(e,r){return new Hf({...this._def,minSize:{value:e,message:ot.toString(r)}})}max(e,r){return new Hf({...this._def,maxSize:{value:e,message:ot.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}Hf.create=(t,e)=>new Hf({valueType:t,minSize:null,maxSize:null,typeName:lt.ZodSet,...yt(e)});class sg extends St{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==qe.function)return Ke(r,{code:$e.invalid_type,expected:qe.function,received:r.parsedType}),gt;function n(a,c){return RC({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,OC(),oy].filter(u=>!!u),issueData:{code:$e.invalid_arguments,argumentsError:c}})}function i(a,c){return RC({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,OC(),oy].filter(u=>!!u),issueData:{code:$e.invalid_return_type,returnTypeError:c}})}const s={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof vm){const a=this;return Ai(async function(...c){const u=new Ho([]),l=await a._def.args.parseAsync(c,s).catch(f=>{throw u.addIssue(n(c,f)),u}),d=await Reflect.apply(o,this,l);return await a._def.returns._def.type.parseAsync(d,s).catch(f=>{throw u.addIssue(i(d,f)),u})})}else{const a=this;return Ai(function(...c){const u=a._def.args.safeParse(c,s);if(!u.success)throw new Ho([n(c,u.error)]);const l=Reflect.apply(o,this,u.data),d=a._def.returns.safeParse(l,s);if(!d.success)throw new Ho([i(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new sg({...this._def,args:Xa.create(e).rest(Pf.create())})}returns(e){return new sg({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new sg({args:e||Xa.create([]).rest(Pf.create()),returns:r||Pf.create(),typeName:lt.ZodFunction,...yt(n)})}}class py extends St{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}py.create=(t,e)=>new py({getter:t,typeName:lt.ZodLazy,...yt(e)});class gy extends St{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return Ke(r,{received:r.data,code:$e.invalid_literal,expected:this._def.value}),gt}return{status:"valid",value:e.data}}get value(){return this._def.value}}gy.create=(t,e)=>new gy({value:t,typeName:lt.ZodLiteral,...yt(e)});function AZ(t,e){return new yd({values:t,typeName:lt.ZodEnum,...yt(e)})}class yd extends St{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),n=this._def.values;return Ke(r,{expected:qt.joinValues(n),received:r.parsedType,code:$e.invalid_type}),gt}if(this._def.values.indexOf(e.data)===-1){const r=this._getOrReturnCtx(e),n=this._def.values;return Ke(r,{received:r.data,code:$e.invalid_enum_value,options:n}),gt}return Ai(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e){return yd.create(e)}exclude(e){return yd.create(this.options.filter(r=>!e.includes(r)))}}yd.create=AZ;class my extends St{_parse(e){const r=qt.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==qe.string&&n.parsedType!==qe.number){const i=qt.objectValues(r);return Ke(n,{expected:qt.joinValues(i),received:n.parsedType,code:$e.invalid_type}),gt}if(r.indexOf(e.data)===-1){const i=qt.objectValues(r);return Ke(n,{received:n.data,code:$e.invalid_enum_value,options:i}),gt}return Ai(e.data)}get enum(){return this._def.values}}my.create=(t,e)=>new my({values:t,typeName:lt.ZodNativeEnum,...yt(e)});class vm extends St{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==qe.promise&&r.common.async===!1)return Ke(r,{code:$e.invalid_type,expected:qe.promise,received:r.parsedType}),gt;const n=r.parsedType===qe.promise?r.data:Promise.resolve(r.data);return Ai(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}}vm.create=(t,e)=>new vm({type:t,typeName:lt.ZodPromise,...yt(e)});class zo extends St{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===lt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:o=>{Ke(n,o),o.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const o=i.transform(n.data,s);return n.common.issues.length?{status:"dirty",value:n.data}:n.common.async?Promise.resolve(o).then(a=>this._def.schema._parseAsync({data:a,path:n.path,parent:n})):this._def.schema._parseSync({data:o,path:n.path,parent:n})}if(i.type==="refinement"){const o=a=>{const c=i.refinement(a,s);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?gt:(a.status==="dirty"&&r.dirty(),o(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?gt:(a.status==="dirty"&&r.dirty(),o(a.value).then(()=>({status:r.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!ay(o))return o;const a=i.transform(o.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>ay(o)?Promise.resolve(i.transform(o.value,s)).then(a=>({status:r.value,value:a})):o);qt.assertNever(i)}}zo.create=(t,e,r)=>new zo({schema:t,typeName:lt.ZodEffects,effect:e,...yt(r)});zo.createWithPreprocess=(t,e,r)=>new zo({schema:e,effect:{type:"preprocess",transform:t},typeName:lt.ZodEffects,...yt(r)});class Au extends St{_parse(e){return this._getType(e)===qe.undefined?Ai(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Au.create=(t,e)=>new Au({innerType:t,typeName:lt.ZodOptional,...yt(e)});class qf extends St{_parse(e){return this._getType(e)===qe.null?Ai(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}qf.create=(t,e)=>new qf({innerType:t,typeName:lt.ZodNullable,...yt(e)});class wy extends St{_parse(e){const{ctx:r}=this._processInputParams(e);let n=r.data;return r.parsedType===qe.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}wy.create=(t,e)=>new wy({innerType:t,typeName:lt.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...yt(e)});class BC extends St{_parse(e){const{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return kC(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ho(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ho(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}BC.create=(t,e)=>new BC({innerType:t,typeName:lt.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...yt(e)});class DC extends St{_parse(e){if(this._getType(e)!==qe.nan){const n=this._getOrReturnCtx(e);return Ke(n,{code:$e.invalid_type,expected:qe.nan,received:n.parsedType}),gt}return{status:"valid",value:e.data}}}DC.create=t=>new DC({typeName:lt.ZodNaN,...yt(t)});const Mve=Symbol("zod_brand");class xZ extends St{_parse(e){const{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class Fv extends St{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?gt:s.status==="dirty"?(r.dirty(),CZ(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{const i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?gt:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new Fv({in:e,out:r,typeName:lt.ZodPipeline})}}class MC extends St{_parse(e){const r=this._def.innerType._parse(e);return ay(r)&&(r.value=Object.freeze(r.value)),r}}MC.create=(t,e)=>new MC({innerType:t,typeName:lt.ZodReadonly,...yt(e)});const SZ=(t,e={},r)=>t?ym.create().superRefine((n,i)=>{var s,o;if(!t(n)){const a=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,c=(o=(s=a.fatal)!==null&&s!==void 0?s:r)!==null&&o!==void 0?o:!0,u=typeof a=="string"?{message:a}:a;i.addIssue({code:"custom",...u,fatal:c})}}):ym.create(),Lve={object:Mr.lazycreate};var lt;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(lt||(lt={}));const Uve=(t,e={message:`Input not instance of ${t.name}`})=>SZ(r=>r instanceof t,e),TZ=Uo.create,IZ=wd.create,Fve=DC.create,Hve=bd.create,PZ=cy.create,qve=Ff.create,zve=NC.create,Wve=uy.create,Vve=ly.create,Gve=ym.create,Kve=Pf.create,Zve=Pu.create,Yve=$C.create,Jve=qo.create,Qve=Mr.create,Xve=Mr.strictCreate,e2e=dy.create,t2e=cA.create,r2e=hy.create,n2e=Xa.create,i2e=fy.create,s2e=jC.create,o2e=Hf.create,a2e=sg.create,c2e=py.create,u2e=gy.create,l2e=yd.create,d2e=my.create,h2e=vm.create,mj=zo.create,f2e=Au.create,p2e=qf.create,g2e=zo.createWithPreprocess,m2e=Fv.create,w2e=()=>TZ().optional(),b2e=()=>IZ().optional(),y2e=()=>PZ().optional(),v2e={string:t=>Uo.create({...t,coerce:!0}),number:t=>wd.create({...t,coerce:!0}),boolean:t=>cy.create({...t,coerce:!0}),bigint:t=>bd.create({...t,coerce:!0}),date:t=>Ff.create({...t,coerce:!0})},_2e=gt;var V=Object.freeze({__proto__:null,defaultErrorMap:oy,setErrorMap:xve,getErrorMap:OC,makeIssue:RC,EMPTY_PATH:Sve,addIssueToContext:Ke,ParseStatus:ni,INVALID:gt,DIRTY:CZ,OK:Ai,isAborted:VI,isDirty:GI,isValid:ay,isAsync:kC,get util(){return qt},get objectUtil(){return WI},ZodParsedType:qe,getParsedType:Ll,ZodType:St,ZodString:Uo,ZodNumber:wd,ZodBigInt:bd,ZodBoolean:cy,ZodDate:Ff,ZodSymbol:NC,ZodUndefined:uy,ZodNull:ly,ZodAny:ym,ZodUnknown:Pf,ZodNever:Pu,ZodVoid:$C,ZodArray:qo,ZodObject:Mr,ZodUnion:dy,ZodDiscriminatedUnion:cA,ZodIntersection:hy,ZodTuple:Xa,ZodRecord:fy,ZodMap:jC,ZodSet:Hf,ZodFunction:sg,ZodLazy:py,ZodLiteral:gy,ZodEnum:yd,ZodNativeEnum:my,ZodPromise:vm,ZodEffects:zo,ZodTransformer:zo,ZodOptional:Au,ZodNullable:qf,ZodDefault:wy,ZodCatch:BC,ZodNaN:DC,BRAND:Mve,ZodBranded:xZ,ZodPipeline:Fv,ZodReadonly:MC,custom:SZ,Schema:St,ZodSchema:St,late:Lve,get ZodFirstPartyTypeKind(){return lt},coerce:v2e,any:Gve,array:Jve,bigint:Hve,boolean:PZ,date:qve,discriminatedUnion:t2e,effect:mj,enum:l2e,function:a2e,instanceof:Uve,intersection:r2e,lazy:c2e,literal:u2e,map:s2e,nan:Fve,nativeEnum:d2e,never:Zve,null:Vve,nullable:p2e,number:IZ,object:Qve,oboolean:y2e,onumber:b2e,optional:f2e,ostring:w2e,pipeline:m2e,preprocess:g2e,promise:h2e,record:i2e,set:o2e,strictObject:Xve,string:TZ,symbol:zve,transformer:mj,tuple:n2e,undefined:Wve,union:e2e,unknown:Kve,void:Yve,NEVER:_2e,ZodIssueCode:$e,quotelessJson:Ave,ZodError:Ho});const Ur=V.object({message:V.string()});function Ve(t){return V.literal(Ye[t])}V.object({accessList:V.array(V.string()),blockHash:V.string().nullable(),blockNumber:V.string().nullable(),chainId:V.string().or(V.number()),from:V.string(),gas:V.string(),hash:V.string(),input:V.string().nullable(),maxFeePerGas:V.string(),maxPriorityFeePerGas:V.string(),nonce:V.string(),r:V.string(),s:V.string(),to:V.string(),transactionIndex:V.string().nullable(),type:V.string(),v:V.string(),value:V.string()});const E2e=V.object({chainId:V.string().or(V.number())}),C2e=V.object({email:V.string().email()}),A2e=V.object({otp:V.string()}),x2e=V.object({uri:V.string(),preferredAccountType:V.optional(V.string()),chainId:V.optional(V.string().or(V.number()))}),S2e=V.object({chainId:V.optional(V.string().or(V.number())),preferredAccountType:V.optional(V.string()),socialUri:V.optional(V.string())}),T2e=V.object({provider:V.enum(["google","github","apple","facebook","x","discord"])}),I2e=V.object({email:V.string().email()}),P2e=V.object({otp:V.string()}),O2e=V.object({otp:V.string()}),R2e=V.object({themeMode:V.optional(V.enum(["light","dark"])),themeVariables:V.optional(V.record(V.string(),V.string().or(V.number()))),w3mThemeVariables:V.optional(V.record(V.string(),V.string()))}),k2e=V.object({metadata:V.object({name:V.string(),description:V.string(),url:V.string(),icons:V.array(V.string())}).optional(),sdkVersion:V.string().optional(),sdkType:V.string().optional(),projectId:V.string()}),N2e=V.object({type:V.string()}),$2e=V.object({action:V.enum(["VERIFY_DEVICE","VERIFY_OTP","CONNECT"])}),j2e=V.object({url:V.string()}),B2e=V.object({userName:V.string()}),D2e=V.object({email:V.string().optional().nullable(),address:V.string(),chainId:V.string().or(V.number()),accounts:V.array(V.object({address:V.string(),type:V.enum([bt.ACCOUNT_TYPES.EOA,bt.ACCOUNT_TYPES.SMART_ACCOUNT])})).optional(),userName:V.string().optional().nullable(),preferredAccountType:V.optional(V.string())}),M2e=V.object({action:V.enum(["VERIFY_PRIMARY_OTP","VERIFY_SECONDARY_OTP"])}),L2e=V.object({email:V.string().email().optional().nullable(),address:V.string(),chainId:V.string().or(V.number()),smartAccountDeployed:V.optional(V.boolean()),accounts:V.array(V.object({address:V.string(),type:V.enum([bt.ACCOUNT_TYPES.EOA,bt.ACCOUNT_TYPES.SMART_ACCOUNT])})).optional(),preferredAccountType:V.optional(V.string())}),U2e=V.object({uri:V.string()}),F2e=V.object({isConnected:V.boolean()}),H2e=V.object({chainId:V.string().or(V.number())}),q2e=V.object({chainId:V.string().or(V.number())}),z2e=V.object({newEmail:V.string().email()}),W2e=V.object({smartAccountEnabledNetworks:V.array(V.number())});V.object({address:V.string(),isDeployed:V.boolean()});const V2e=V.object({version:V.string().optional()}),G2e=V.object({type:V.string(),address:V.string()}),K2e=V.any(),Z2e=V.object({method:V.literal("eth_accounts")}),Y2e=V.object({method:V.literal("eth_blockNumber")}),J2e=V.object({method:V.literal("eth_call"),params:V.array(V.any())}),Q2e=V.object({method:V.literal("eth_chainId")}),X2e=V.object({method:V.literal("eth_estimateGas"),params:V.array(V.any())}),e3e=V.object({method:V.literal("eth_feeHistory"),params:V.array(V.any())}),t3e=V.object({method:V.literal("eth_gasPrice")}),r3e=V.object({method:V.literal("eth_getAccount"),params:V.array(V.any())}),n3e=V.object({method:V.literal("eth_getBalance"),params:V.array(V.any())}),i3e=V.object({method:V.literal("eth_getBlockByHash"),params:V.array(V.any())}),s3e=V.object({method:V.literal("eth_getBlockByNumber"),params:V.array(V.any())}),o3e=V.object({method:V.literal("eth_getBlockReceipts"),params:V.array(V.any())}),a3e=V.object({method:V.literal("eth_getBlockTransactionCountByHash"),params:V.array(V.any())}),c3e=V.object({method:V.literal("eth_getBlockTransactionCountByNumber"),params:V.array(V.any())}),u3e=V.object({method:V.literal("eth_getCode"),params:V.array(V.any())}),l3e=V.object({method:V.literal("eth_getFilterChanges"),params:V.array(V.any())}),d3e=V.object({method:V.literal("eth_getFilterLogs"),params:V.array(V.any())}),h3e=V.object({method:V.literal("eth_getLogs"),params:V.array(V.any())}),f3e=V.object({method:V.literal("eth_getProof"),params:V.array(V.any())}),p3e=V.object({method:V.literal("eth_getStorageAt"),params:V.array(V.any())}),g3e=V.object({method:V.literal("eth_getTransactionByBlockHashAndIndex"),params:V.array(V.any())}),m3e=V.object({method:V.literal("eth_getTransactionByBlockNumberAndIndex"),params:V.array(V.any())}),w3e=V.object({method:V.literal("eth_getTransactionByHash"),params:V.array(V.any())}),b3e=V.object({method:V.literal("eth_getTransactionCount"),params:V.array(V.any())}),y3e=V.object({method:V.literal("eth_getTransactionReceipt"),params:V.array(V.any())}),v3e=V.object({method:V.literal("eth_getUncleCountByBlockHash"),params:V.array(V.any())}),_3e=V.object({method:V.literal("eth_getUncleCountByBlockNumber"),params:V.array(V.any())}),E3e=V.object({method:V.literal("eth_maxPriorityFeePerGas")}),C3e=V.object({method:V.literal("eth_newBlockFilter")}),A3e=V.object({method:V.literal("eth_newFilter"),params:V.array(V.any())}),x3e=V.object({method:V.literal("eth_newPendingTransactionFilter")}),S3e=V.object({method:V.literal("eth_sendRawTransaction"),params:V.array(V.any())}),T3e=V.object({method:V.literal("eth_syncing"),params:V.array(V.any())}),I3e=V.object({method:V.literal("eth_uninstallFilter"),params:V.array(V.any())}),wj=V.object({method:V.literal("personal_sign"),params:V.array(V.any())}),P3e=V.object({method:V.literal("eth_signTypedData_v4"),params:V.array(V.any())}),O3e=V.object({method:V.literal("eth_sendTransaction"),params:V.array(V.any())}),R3e=V.object({method:V.literal("solana_signMessage"),params:V.object({message:V.string(),pubkey:V.string()})}),k3e=V.object({method:V.literal("solana_signTransaction"),params:V.object({transaction:V.string()})}),N3e=V.object({method:V.literal("solana_signAllTransactions"),params:V.object({transactions:V.array(V.string())})}),$3e=V.object({method:V.literal("solana_signAndSendTransaction"),params:V.object({transaction:V.string(),options:V.object({skipPreflight:V.boolean().optional(),preflightCommitment:V.enum(["processed","confirmed","finalized","recent","single","singleGossip","root","max"]).optional(),maxRetries:V.number().optional(),minContextSlot:V.number().optional()}).optional()})}),j3e=V.object({method:V.literal("wallet_sendCalls"),params:V.array(V.object({chainId:V.string().or(V.number()).optional(),from:V.string().optional(),version:V.string().optional(),capabilities:V.any().optional(),calls:V.array(V.object({to:V.string().startsWith("0x"),data:V.string().startsWith("0x").optional(),value:V.string().optional()}))}))}),B3e=V.object({method:V.literal("wallet_getCallsStatus"),params:V.array(V.string())}),D3e=V.object({method:V.literal("wallet_getCapabilities")}),M3e=V.object({method:V.literal("wallet_grantPermissions"),params:V.array(V.any())}),L3e=V.object({method:V.literal("wallet_revokePermissions"),params:V.any()}),U3e=V.object({method:V.literal("wallet_getAssets"),params:V.any()}),bj=V.object({token:V.string()}),Ge=V.object({id:V.string().optional()}),G1={appEvent:Ge.extend({type:Ve("APP_SWITCH_NETWORK"),payload:E2e}).or(Ge.extend({type:Ve("APP_CONNECT_EMAIL"),payload:C2e})).or(Ge.extend({type:Ve("APP_CONNECT_DEVICE")})).or(Ge.extend({type:Ve("APP_CONNECT_OTP"),payload:A2e})).or(Ge.extend({type:Ve("APP_CONNECT_SOCIAL"),payload:x2e})).or(Ge.extend({type:Ve("APP_GET_FARCASTER_URI")})).or(Ge.extend({type:Ve("APP_CONNECT_FARCASTER")})).or(Ge.extend({type:Ve("APP_GET_USER"),payload:V.optional(S2e)})).or(Ge.extend({type:Ve("APP_GET_SOCIAL_REDIRECT_URI"),payload:T2e})).or(Ge.extend({type:Ve("APP_SIGN_OUT")})).or(Ge.extend({type:Ve("APP_IS_CONNECTED"),payload:V.optional(bj)})).or(Ge.extend({type:Ve("APP_GET_CHAIN_ID")})).or(Ge.extend({type:Ve("APP_GET_SMART_ACCOUNT_ENABLED_NETWORKS")})).or(Ge.extend({type:Ve("APP_INIT_SMART_ACCOUNT")})).or(Ge.extend({type:Ve("APP_SET_PREFERRED_ACCOUNT"),payload:N2e})).or(Ge.extend({type:Ve("APP_RPC_REQUEST"),payload:wj.or(U3e).or(Z2e).or(Y2e).or(J2e).or(Q2e).or(X2e).or(e3e).or(t3e).or(r3e).or(n3e).or(i3e).or(s3e).or(o3e).or(a3e).or(c3e).or(u3e).or(l3e).or(d3e).or(h3e).or(f3e).or(p3e).or(g3e).or(m3e).or(w3e).or(b3e).or(y3e).or(v3e).or(_3e).or(E3e).or(C3e).or(A3e).or(x3e).or(S3e).or(T3e).or(I3e).or(wj).or(P3e).or(O3e).or(R3e).or(k3e).or(N3e).or($3e).or(B3e).or(j3e).or(D3e).or(M3e).or(L3e)})).or(Ge.extend({type:Ve("APP_UPDATE_EMAIL"),payload:I2e})).or(Ge.extend({type:Ve("APP_UPDATE_EMAIL_PRIMARY_OTP"),payload:P2e})).or(Ge.extend({type:Ve("APP_UPDATE_EMAIL_SECONDARY_OTP"),payload:O2e})).or(Ge.extend({type:Ve("APP_SYNC_THEME"),payload:R2e})).or(Ge.extend({type:Ve("APP_SYNC_DAPP_DATA"),payload:k2e})).or(Ge.extend({type:Ve("APP_RELOAD")})),frameEvent:Ge.extend({type:Ve("FRAME_SWITCH_NETWORK_ERROR"),payload:Ur}).or(Ge.extend({type:Ve("FRAME_SWITCH_NETWORK_SUCCESS"),payload:q2e})).or(Ge.extend({type:Ve("FRAME_CONNECT_EMAIL_SUCCESS"),payload:$2e})).or(Ge.extend({type:Ve("FRAME_CONNECT_EMAIL_ERROR"),payload:Ur})).or(Ge.extend({type:Ve("FRAME_GET_FARCASTER_URI_SUCCESS"),payload:j2e})).or(Ge.extend({type:Ve("FRAME_GET_FARCASTER_URI_ERROR"),payload:Ur})).or(Ge.extend({type:Ve("FRAME_CONNECT_FARCASTER_SUCCESS"),payload:B2e})).or(Ge.extend({type:Ve("FRAME_CONNECT_FARCASTER_ERROR"),payload:Ur})).or(Ge.extend({type:Ve("FRAME_CONNECT_OTP_ERROR"),payload:Ur})).or(Ge.extend({type:Ve("FRAME_CONNECT_OTP_SUCCESS")})).or(Ge.extend({type:Ve("FRAME_CONNECT_DEVICE_ERROR"),payload:Ur})).or(Ge.extend({type:Ve("FRAME_CONNECT_DEVICE_SUCCESS")})).or(Ge.extend({type:Ve("FRAME_CONNECT_SOCIAL_SUCCESS"),payload:D2e})).or(Ge.extend({type:Ve("FRAME_CONNECT_SOCIAL_ERROR"),payload:Ur})).or(Ge.extend({type:Ve("FRAME_GET_USER_ERROR"),payload:Ur})).or(Ge.extend({type:Ve("FRAME_GET_USER_SUCCESS"),payload:L2e})).or(Ge.extend({type:Ve("FRAME_GET_SOCIAL_REDIRECT_URI_ERROR"),payload:Ur})).or(Ge.extend({type:Ve("FRAME_GET_SOCIAL_REDIRECT_URI_SUCCESS"),payload:U2e})).or(Ge.extend({type:Ve("FRAME_SIGN_OUT_ERROR"),payload:Ur})).or(Ge.extend({type:Ve("FRAME_SIGN_OUT_SUCCESS")})).or(Ge.extend({type:Ve("FRAME_IS_CONNECTED_ERROR"),payload:Ur})).or(Ge.extend({type:Ve("FRAME_IS_CONNECTED_SUCCESS"),payload:F2e})).or(Ge.extend({type:Ve("FRAME_GET_CHAIN_ID_ERROR"),payload:Ur})).or(Ge.extend({type:Ve("FRAME_GET_CHAIN_ID_SUCCESS"),payload:H2e})).or(Ge.extend({type:Ve("FRAME_RPC_REQUEST_ERROR"),payload:Ur})).or(Ge.extend({type:Ve("FRAME_RPC_REQUEST_SUCCESS"),payload:K2e})).or(Ge.extend({type:Ve("FRAME_SESSION_UPDATE"),payload:bj})).or(Ge.extend({type:Ve("FRAME_UPDATE_EMAIL_ERROR"),payload:Ur})).or(Ge.extend({type:Ve("FRAME_UPDATE_EMAIL_SUCCESS"),payload:M2e})).or(Ge.extend({type:Ve("FRAME_UPDATE_EMAIL_PRIMARY_OTP_ERROR"),payload:Ur})).or(Ge.extend({type:Ve("FRAME_UPDATE_EMAIL_PRIMARY_OTP_SUCCESS")})).or(Ge.extend({type:Ve("FRAME_UPDATE_EMAIL_SECONDARY_OTP_ERROR"),payload:Ur})).or(Ge.extend({type:Ve("FRAME_UPDATE_EMAIL_SECONDARY_OTP_SUCCESS"),payload:z2e})).or(Ge.extend({type:Ve("FRAME_SYNC_THEME_ERROR"),payload:Ur})).or(Ge.extend({type:Ve("FRAME_SYNC_THEME_SUCCESS")})).or(Ge.extend({type:Ve("FRAME_SYNC_DAPP_DATA_ERROR"),payload:Ur})).or(Ge.extend({type:Ve("FRAME_SYNC_DAPP_DATA_SUCCESS")})).or(Ge.extend({type:Ve("FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS"),payload:W2e})).or(Ge.extend({type:Ve("FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR"),payload:Ur})).or(Ge.extend({type:Ve("FRAME_INIT_SMART_ACCOUNT_ERROR"),payload:Ur})).or(Ge.extend({type:Ve("FRAME_SET_PREFERRED_ACCOUNT_SUCCESS"),payload:G2e})).or(Ge.extend({type:Ve("FRAME_SET_PREFERRED_ACCOUNT_ERROR"),payload:Ur})).or(Ge.extend({type:Ve("FRAME_READY"),payload:V2e})).or(Ge.extend({type:Ve("FRAME_RELOAD_ERROR"),payload:Ur})).or(Ge.extend({type:Ve("FRAME_RELOAD_SUCCESS")}))};function aS(t,e={}){var r;return typeof(e==null?void 0:e.type)=="string"&&((r=e==null?void 0:e.type)==null?void 0:r.includes(t))}class F3e{constructor({projectId:e,isAppClient:r=!1,chainId:n="eip155:1",enableLogger:i=!0}){if(this.iframe=null,this.iframeIsReady=!1,this.rpcUrl=_e.BLOCKCHAIN_API_RPC_URL,this.initFrame=()=>{const s=document.getElementById("w3m-iframe");this.iframe&&!s&&document.body.appendChild(this.iframe)},this.events={registerFrameEventHandler:(s,o,a)=>{function c({data:u}){if(!aS(Ye.FRAME_EVENT_KEY,u))return;const l=G1.frameEvent.parse(u);l.id===s&&(o(l),window.removeEventListener("message",c))}ei.isClient&&(window.addEventListener("message",c),a.addEventListener("abort",()=>{window.removeEventListener("message",c)}))},onFrameEvent:s=>{ei.isClient&&window.addEventListener("message",({data:o})=>{if(!aS(Ye.FRAME_EVENT_KEY,o))return;const a=G1.frameEvent.parse(o);s(a)})},onAppEvent:s=>{ei.isClient&&window.addEventListener("message",({data:o})=>{if(!aS(Ye.APP_EVENT_KEY,o))return;const a=G1.appEvent.parse(o);s(a)})},postAppEvent:s=>{var o;if(ei.isClient){if(!((o=this.iframe)!=null&&o.contentWindow))throw new Error("W3mFrame: iframe is not set");G1.appEvent.parse(s),this.iframe.contentWindow.postMessage(s,"*")}},postFrameEvent:s=>{if(ei.isClient){if(!parent)throw new Error("W3mFrame: parent is not set");G1.frameEvent.parse(s),parent.postMessage(s,"*")}}},this.projectId=e,this.frameLoadPromise=new Promise((s,o)=>{this.frameLoadPromiseResolver={resolve:s,reject:o}}),r&&(this.frameLoadPromise=new Promise((s,o)=>{this.frameLoadPromiseResolver={resolve:s,reject:o}}),ei.isClient)){const s=document.createElement("iframe");s.id="w3m-iframe",s.src=`${Zne}?projectId=${e}&chainId=${n}&version=${Jne}&enableLogger=${i}`,s.name="w3m-secure-iframe",s.style.position="fixed",s.style.zIndex="999999",s.style.display="none",s.style.border="none",s.style.animationDelay="0s, 50ms",s.style.borderBottomLeftRadius="clamp(0px, var(--wui-border-radius-l), 44px)",s.style.borderBottomRightRadius="clamp(0px, var(--wui-border-radius-l), 44px)",this.iframe=s,this.iframe.onerror=()=>{var o;(o=this.frameLoadPromiseResolver)==null||o.reject("Unable to load email login dependency")},this.events.onFrameEvent(o=>{var a;o.type==="@w3m-frame/READY"&&(this.iframeIsReady=!0,(a=this.frameLoadPromiseResolver)==null||a.resolve(void 0))})}}get networks(){const e=["eip155:1","eip155:5","eip155:11155111","eip155:10","eip155:420","eip155:42161","eip155:421613","eip155:137","eip155:80001","eip155:42220","eip155:1313161554","eip155:1313161555","eip155:56","eip155:97","eip155:43114","eip155:43113","eip155:324","eip155:280","eip155:100","eip155:8453","eip155:84531","eip155:84532","eip155:7777777","eip155:999","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z","solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1"].map(r=>({[r]:{rpcUrl:`${this.rpcUrl}/v1/?chainId=${r}&projectId=${this.projectId}`,chainId:r}}));return Object.assign({},...e)}}class H3e{constructor(e){var s;const r=Xm({level:Yne}),{logger:n,chunkLoggerController:i}=N9({opts:r});this.logger=si(n,this.constructor.name),this.chunkLoggerController=i,typeof window<"u"&&((s=this.chunkLoggerController)!=null&&s.downloadLogsBlobInBrowser)&&(window.downloadAppKitLogsBlob||(window.downloadAppKitLogsBlob={}),window.downloadAppKitLogsBlob.sdk=()=>{var o;(o=this.chunkLoggerController)!=null&&o.downloadLogsBlobInBrowser&&this.chunkLoggerController.downloadLogsBlobInBrowser({projectId:e})})}}class s7{constructor({projectId:e,chainId:r,enableLogger:n=!0,onTimeout:i,abortController:s}){this.openRpcRequests=[],this.isInitialized=!1,n&&(this.w3mLogger=new H3e(e)),this.abortController=s,this.w3mFrame=new F3e({projectId:e,isAppClient:!0,chainId:r,enableLogger:n}),this.onTimeout=i,this.getLoginEmailUsed()&&this.createFrame()}async createFrame(){this.w3mFrame.initFrame(),this.initPromise=new Promise(e=>{this.w3mFrame.events.onFrameEvent(r=>{r.type===Ye.FRAME_READY&&setTimeout(()=>{e()},500)})}),await this.initPromise,this.isInitialized=!0,this.initPromise=void 0}async init(){if(!this.isInitialized){if(this.initPromise){await this.initPromise;return}await this.createFrame()}}getLoginEmailUsed(){return!!Bn.get(Ye.EMAIL_LOGIN_USED_KEY)}getEmail(){return Bn.get(Ye.EMAIL)}getUsername(){return Bn.get(Ye.SOCIAL_USERNAME)}async reload(){var e;try{await this.appEvent({type:Ye.APP_RELOAD})}catch(r){throw(e=this.w3mLogger)==null||e.logger.error({error:r},"Error reloading iframe"),r}}async connectEmail(e){var r;try{ei.checkIfAllowedToTriggerEmail(),await this.init();const n=await this.appEvent({type:Ye.APP_CONNECT_EMAIL,payload:e});return this.setNewLastEmailLoginTime(),n}catch(n){throw(r=this.w3mLogger)==null||r.logger.error({error:n},"Error connecting email"),n}}async connectDevice(){var e;try{return this.appEvent({type:Ye.APP_CONNECT_DEVICE})}catch(r){throw(e=this.w3mLogger)==null||e.logger.error({error:r},"Error connecting device"),r}}async connectOtp(e){var r;try{return this.appEvent({type:Ye.APP_CONNECT_OTP,payload:e})}catch(n){throw(r=this.w3mLogger)==null||r.logger.error({error:n},"Error connecting otp"),n}}async isConnected(){var e;try{if(!this.getLoginEmailUsed())return{isConnected:!1};const r=await this.appEvent({type:Ye.APP_IS_CONNECTED});return r!=null&&r.isConnected||this.deleteAuthLoginCache(),r}catch(r){throw this.deleteAuthLoginCache(),(e=this.w3mLogger)==null||e.logger.error({error:r},"Error checking connection"),r}}async getChainId(){var e;try{const r=await this.appEvent({type:Ye.APP_GET_CHAIN_ID});return this.setLastUsedChainId(r.chainId),r}catch(r){throw(e=this.w3mLogger)==null||e.logger.error({error:r},"Error getting chain id"),r}}async getSocialRedirectUri(e){var r;try{return await this.init(),this.appEvent({type:Ye.APP_GET_SOCIAL_REDIRECT_URI,payload:e})}catch(n){throw(r=this.w3mLogger)==null||r.logger.error({error:n},"Error getting social redirect uri"),n}}async updateEmail(e){var r;try{const n=await this.appEvent({type:Ye.APP_UPDATE_EMAIL,payload:e});return this.setNewLastEmailLoginTime(),n}catch(n){throw(r=this.w3mLogger)==null||r.logger.error({error:n},"Error updating email"),n}}async updateEmailPrimaryOtp(e){var r;try{return this.appEvent({type:Ye.APP_UPDATE_EMAIL_PRIMARY_OTP,payload:e})}catch(n){throw(r=this.w3mLogger)==null||r.logger.error({error:n},"Error updating email primary otp"),n}}async updateEmailSecondaryOtp(e){var r;try{const n=await this.appEvent({type:Ye.APP_UPDATE_EMAIL_SECONDARY_OTP,payload:e});return this.setLoginSuccess(n.newEmail),n}catch(n){throw(r=this.w3mLogger)==null||r.logger.error({error:n},"Error updating email secondary otp"),n}}async syncTheme(e){var r;try{return this.appEvent({type:Ye.APP_SYNC_THEME,payload:e})}catch(n){throw(r=this.w3mLogger)==null||r.logger.error({error:n},"Error syncing theme"),n}}async syncDappData(e){var r;try{return this.appEvent({type:Ye.APP_SYNC_DAPP_DATA,payload:e})}catch(n){throw(r=this.w3mLogger)==null||r.logger.error({error:n},"Error syncing dapp data"),n}}async getSmartAccountEnabledNetworks(){var e;try{const r=await this.appEvent({type:Ye.APP_GET_SMART_ACCOUNT_ENABLED_NETWORKS});return this.persistSmartAccountEnabledNetworks(r.smartAccountEnabledNetworks),r}catch(r){throw this.persistSmartAccountEnabledNetworks([]),(e=this.w3mLogger)==null||e.logger.error({error:r},"Error getting smart account enabled networks"),r}}async setPreferredAccount(e){var r;try{return this.appEvent({type:Ye.APP_SET_PREFERRED_ACCOUNT,payload:{type:e}})}catch(n){throw(r=this.w3mLogger)==null||r.logger.error({error:n},"Error setting preferred account"),n}}async connect(e){var r,n;if(e!=null&&e.socialUri)try{await this.init();const i=await this.appEvent({type:Ye.APP_CONNECT_SOCIAL,payload:{uri:e.socialUri,preferredAccountType:e.preferredAccountType,chainId:e.chainId}});return i.userName&&this.setSocialLoginSuccess(i.userName),this.setLoginSuccess(i.email),this.setLastUsedChainId(i.chainId),this.user=i,i}catch(i){throw(r=this.w3mLogger)==null||r.logger.error({error:i},"Error connecting social"),i}else try{const i=(e==null?void 0:e.chainId)||this.getLastUsedChainId()||1,s=await this.getUser({chainId:i,preferredAccountType:e==null?void 0:e.preferredAccountType});return this.setLoginSuccess(s.email),this.setLastUsedChainId(s.chainId),this.user=s,s}catch(i){throw(n=this.w3mLogger)==null||n.logger.error({error:i},"Error connecting"),i}}async getUser(e){var r;try{await this.init();const n=(e==null?void 0:e.chainId)||this.getLastUsedChainId()||1,i=await this.appEvent({type:Ye.APP_GET_USER,payload:{...e,chainId:n}});return this.user=i,i}catch(n){throw(r=this.w3mLogger)==null||r.logger.error({error:n},"Error connecting"),n}}async connectSocial(e){var r;try{await this.init();const n=await this.appEvent({type:Ye.APP_CONNECT_SOCIAL,payload:{uri:e}});return n.userName&&this.setSocialLoginSuccess(n.userName),n}catch(n){throw(r=this.w3mLogger)==null||r.logger.error({error:n},"Error connecting social"),n}}async getFarcasterUri(){var e;try{return await this.init(),await this.appEvent({type:Ye.APP_GET_FARCASTER_URI})}catch(r){throw(e=this.w3mLogger)==null||e.logger.error({error:r},"Error getting farcaster uri"),r}}async connectFarcaster(){var e;try{const r=await this.appEvent({type:Ye.APP_CONNECT_FARCASTER});return r.userName&&this.setSocialLoginSuccess(r.userName),r}catch(r){throw(e=this.w3mLogger)==null||e.logger.error({error:r},"Error connecting farcaster"),r}}async switchNetwork(e){var r;try{const n=await this.appEvent({type:Ye.APP_SWITCH_NETWORK,payload:{chainId:e}});return this.setLastUsedChainId(n.chainId),n}catch(n){throw(r=this.w3mLogger)==null||r.logger.error({error:n},"Error switching network"),n}}async disconnect(){var e;try{return this.deleteAuthLoginCache(),await new Promise(async n=>{const i=setTimeout(()=>{n()},3e3);await this.appEvent({type:Ye.APP_SIGN_OUT}),clearTimeout(i),n()})}catch(r){throw(e=this.w3mLogger)==null||e.logger.error({error:r},"Error disconnecting"),r}}async request(e){var r,n,i,s;try{if(bt.GET_CHAIN_ID===e.method)return this.getLastUsedChainId();(r=this.rpcRequestHandler)==null||r.call(this,e);const o=await this.appEvent({type:Ye.APP_RPC_REQUEST,payload:e});return(n=this.rpcSuccessHandler)==null||n.call(this,o,e),o}catch(o){throw(i=this.rpcErrorHandler)==null||i.call(this,o,e),(s=this.w3mLogger)==null||s.logger.error({error:o},"Error requesting"),o}}onRpcRequest(e){this.rpcRequestHandler=e}onRpcSuccess(e){this.rpcSuccessHandler=e}onRpcError(e){this.rpcErrorHandler=e}onIsConnected(e){this.w3mFrame.events.onFrameEvent(r=>{r.type===Ye.FRAME_IS_CONNECTED_SUCCESS&&r.payload.isConnected&&e()})}onNotConnected(e){this.w3mFrame.events.onFrameEvent(r=>{r.type===Ye.FRAME_IS_CONNECTED_ERROR&&e(),r.type===Ye.FRAME_IS_CONNECTED_SUCCESS&&!r.payload.isConnected&&e()})}onConnect(e){this.w3mFrame.events.onFrameEvent(r=>{r.type===Ye.FRAME_GET_USER_SUCCESS&&e(r.payload)})}onSocialConnected(e){this.w3mFrame.events.onFrameEvent(r=>{r.type===Ye.FRAME_CONNECT_SOCIAL_SUCCESS&&e(r.payload)})}async getCapabilities(){try{return await this.request({method:"wallet_getCapabilities"})||{}}catch{return{}}}onSetPreferredAccount(e){this.w3mFrame.events.onFrameEvent(r=>{r.type===Ye.FRAME_SET_PREFERRED_ACCOUNT_SUCCESS?e(r.payload):r.type===Ye.FRAME_SET_PREFERRED_ACCOUNT_ERROR&&e({type:bt.ACCOUNT_TYPES.EOA})})}onGetSmartAccountEnabledNetworks(e){this.w3mFrame.events.onFrameEvent(r=>{r.type===Ye.FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS?e(r.payload.smartAccountEnabledNetworks):r.type===Ye.FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR&&e([])})}getAvailableChainIds(){return Object.keys(this.w3mFrame.networks)}rejectRpcRequests(){var e;try{this.openRpcRequests.forEach(({abortController:r,method:n})=>{bt.SAFE_RPC_METHODS.includes(n)||r.abort()}),this.openRpcRequests=[]}catch(r){(e=this.w3mLogger)==null||e.logger.error({error:r},"Error aborting RPC request")}}async appEvent(e){let r,n;function i(c){return c.replace("@w3m-app/","")}const s=[Ye.APP_SYNC_DAPP_DATA,Ye.APP_SYNC_THEME,Ye.APP_SET_PREFERRED_ACCOUNT],o=i(e.type);return!this.w3mFrame.iframeIsReady&&!s.includes(e.type)&&(n=setTimeout(()=>{var c;(c=this.onTimeout)==null||c.call(this,"iframe_load_failed"),this.abortController.abort()},2e4)),await this.w3mFrame.frameLoadPromise,clearTimeout(n),[Ye.APP_CONNECT_EMAIL,Ye.APP_CONNECT_DEVICE,Ye.APP_CONNECT_OTP,Ye.APP_CONNECT_SOCIAL,Ye.APP_GET_SOCIAL_REDIRECT_URI].map(i).includes(o)&&(r=setTimeout(()=>{var c;(c=this.onTimeout)==null||c.call(this,"iframe_request_timeout"),this.abortController.abort()},3e4)),new Promise((c,u)=>{var f,g,p;const l=Math.random().toString(36).substring(7);(p=(f=this.w3mLogger)==null?void 0:(g=f.logger).info)==null||p.call(g,{event:e,id:l},"Sending app event"),this.w3mFrame.events.postAppEvent({...e,id:l});const d=new AbortController;if(o==="RPC_REQUEST"){const m=e;this.openRpcRequests=[...this.openRpcRequests,{...m.payload,abortController:d}]}d.signal.addEventListener("abort",()=>{o==="RPC_REQUEST"?u(new Error("Request was aborted")):o!=="GET_FARCASTER_URI"&&u(new Error("Something went wrong"))});function h(m,b){var v,E,w;m.id===l&&((E=b==null?void 0:(v=b.logger).info)==null||E.call(v,{framEvent:m,id:l},"Received frame response"),m.type===`@w3m-frame/${o}_SUCCESS`?(r&&clearTimeout(r),n&&clearTimeout(n),"payload"in m&&c(m.payload),c(void 0)):m.type===`@w3m-frame/${o}_ERROR`&&(r&&clearTimeout(r),n&&clearTimeout(n),"payload"in m&&u(new Error(((w=m.payload)==null?void 0:w.message)||"An error occurred")),u(new Error("An error occurred"))))}this.w3mFrame.events.registerFrameEventHandler(l,m=>h(m,this.w3mLogger),this.abortController.signal)})}setNewLastEmailLoginTime(){Bn.set(Ye.LAST_EMAIL_LOGIN_TIME,Date.now().toString())}setSocialLoginSuccess(e){Bn.set(Ye.SOCIAL_USERNAME,e)}setLoginSuccess(e){e&&Bn.set(Ye.EMAIL,e),Bn.set(Ye.EMAIL_LOGIN_USED_KEY,"true"),Bn.delete(Ye.LAST_EMAIL_LOGIN_TIME)}deleteAuthLoginCache(){Bn.delete(Ye.EMAIL_LOGIN_USED_KEY),Bn.delete(Ye.EMAIL),Bn.delete(Ye.LAST_USED_CHAIN_KEY),Bn.delete(Ye.SOCIAL_USERNAME)}setLastUsedChainId(e){e&&Bn.set(Ye.LAST_USED_CHAIN_KEY,String(e))}getLastUsedChainId(){const e=Bn.get(Ye.LAST_USED_CHAIN_KEY)??void 0,r=Number(e);return isNaN(r)?e:r}persistSmartAccountEnabledNetworks(e){Bn.set(Ye.SMART_ACCOUNT_ENABLED_NETWORKS,e.join(","))}}class mb{constructor(){}static getInstance({projectId:e,chainId:r,enableLogger:n,onTimeout:i,abortController:s}){return mb.instance||(mb.instance=new s7({projectId:e,chainId:r,enableLogger:n,onTimeout:i,abortController:s})),mb.instance}}function q3e(){try{return ue.returnOpenHref(`${_e.SECURE_SITE_SDK_ORIGIN}/loading`,"popupWindow","width=600,height=800,scrollbars=yes")}catch{throw new Error("Could not open social popup")}}async function z3e(){X.push("ConnectingFarcaster");const t=ge.getAuthConnector();if(t&&!re.state.farcasterUrl)try{const{url:e}=await t.provider.getFarcasterUri();re.setFarcasterUrl(e,F.state.activeChain)}catch(e){X.goBack(),Fe.showError(e)}}async function W3e(t){X.push("ConnectingSocial");const e=ge.getAuthConnector();let r=null;try{const n=setTimeout(()=>{throw new Error("Social login timed out. Please try again.")},45e3);if(e&&t){if(ue.isTelegram()||(r=q3e()),r)re.setSocialWindow(r,F.state.activeChain);else if(!ue.isTelegram())throw new Error("Could not create social popup");const{uri:i}=await e.provider.getSocialRedirectUri({provider:t});if(!i)throw r==null||r.close(),new Error("Could not fetch the social redirect uri");if(r&&(r.location.href=i),ue.isTelegram()){Le.setTelegramSocialProvider(t);const s=ue.formatTelegramSocialLoginUrl(i);ue.openHref(s,"_top")}clearTimeout(n)}}catch(n){r==null||r.close(),Fe.showError(n==null?void 0:n.message)}}async function OZ(t){re.setSocialProvider(t,F.state.activeChain),Re.sendEvent({type:"track",event:"SOCIAL_LOGIN_STARTED",properties:{provider:t}}),t==="farcaster"?await z3e():await W3e(t)}function b3(t,e){return ge.getConnectorId(t)===e}function V3e(t){const e=Array.from(F.state.chains.keys());let r=[];return t?(r.push([t,F.state.chains.get(t)]),b3(t,_e.CONNECTOR_ID.WALLET_CONNECT)?e.forEach(n=>{n!==t&&b3(n,_e.CONNECTOR_ID.WALLET_CONNECT)&&r.push([n,F.state.chains.get(n)])}):b3(t,_e.CONNECTOR_ID.AUTH)&&e.forEach(n=>{n!==t&&b3(n,_e.CONNECTOR_ID.AUTH)&&r.push([n,F.state.chains.get(n)])})):r=Array.from(F.state.chains.entries()),r}var yj={};const Fo={ACCOUNT_TABS:[{label:"Tokens"},{label:"NFTs"},{label:"Activity"}],SECURE_SITE_ORIGIN:(typeof process<"u"&&typeof yj<"u"?yj.NEXT_PUBLIC_SECURE_SITE_ORIGIN:void 0)||"https://secure.walletconnect.org",VIEW_DIRECTION:{Next:"next",Prev:"prev"},DEFAULT_CONNECT_METHOD_ORDER:["email","social","wallet"],ANIMATION_DURATIONS:{HeaderText:120,ModalHeight:150,ViewTransition:150}},Ou={filterOutDuplicatesByRDNS(t){const e=oe.state.enableEIP6963?ge.state.connectors:[],r=Le.getRecentWallets(),n=e.map(a=>{var c;return(c=a.info)==null?void 0:c.rdns}).filter(Boolean),i=r.map(a=>a.rdns).filter(Boolean),s=n.concat(i);if(s.includes("io.metamask.mobile")&&ue.isMobile()){const a=s.indexOf("io.metamask.mobile");s[a]="io.metamask"}return t.filter(a=>!s.includes(String(a==null?void 0:a.rdns)))},filterOutDuplicatesByIds(t){const e=ge.state.connectors.filter(a=>a.type==="ANNOUNCED"||a.type==="INJECTED"),r=Le.getRecentWallets(),n=e.map(a=>a.explorerId),i=r.map(a=>a.id),s=n.concat(i);return t.filter(a=>!s.includes(a==null?void 0:a.id))},filterOutDuplicateWallets(t){const e=this.filterOutDuplicatesByRDNS(t);return this.filterOutDuplicatesByIds(e)},markWalletsAsInstalled(t){const{connectors:e}=ge.state,{featuredWalletIds:r}=oe.state,n=e.filter(o=>o.type==="ANNOUNCED").reduce((o,a)=>{var c;return(c=a.info)!=null&&c.rdns&&(o[a.info.rdns]=!0),o},{});return t.map(o=>({...o,installed:!!o.rdns&&!!n[o.rdns??""]})).sort((o,a)=>{const c=Number(a.installed)-Number(o.installed);if(c!==0)return c;if(r!=null&&r.length){const u=r.indexOf(o.id),l=r.indexOf(a.id);if(u!==-1&&l!==-1)return u-l;if(u!==-1)return-1;if(l!==-1)return 1}return 0})},getConnectOrderMethod(t,e){var c;const r=(t==null?void 0:t.connectMethodsOrder)||((c=oe.state.features)==null?void 0:c.connectMethodsOrder),n=e||ge.state.connectors;if(r)return r;const{injected:i,announced:s}=xu.getConnectorsByType(n,Ne.state.recommended,Ne.state.featured),o=i.filter(xu.showConnector),a=s.filter(xu.showConnector);return o.length||a.length?["wallet","email","social"]:Fo.DEFAULT_CONNECT_METHOD_ORDER},isExcluded(t){const e=!!t.rdns&&Ne.state.excludedWallets.some(n=>n.rdns===t.rdns),r=!!t.name&&Ne.state.excludedWallets.some(n=>aA.isLowerCaseMatch(n.name,t.name));return e||r}},xu={getConnectorsByType(t,e,r){const{customWallets:n}=oe.state,i=Le.getRecentWallets(),s=Ou.filterOutDuplicateWallets(e),o=Ou.filterOutDuplicateWallets(r),a=t.filter(d=>d.type==="MULTI_CHAIN"),c=t.filter(d=>d.type==="ANNOUNCED"),u=t.filter(d=>d.type==="INJECTED"),l=t.filter(d=>d.type==="EXTERNAL");return{custom:n,recent:i,external:l,multiChain:a,announced:c,injected:u,recommended:s,featured:o}},showConnector(t){var i;const e=(i=t.info)==null?void 0:i.rdns,r=!!e&&Ne.state.excludedWallets.some(s=>!!s.rdns&&s.rdns===e),n=!!t.name&&Ne.state.excludedWallets.some(s=>aA.isLowerCaseMatch(s.name,t.name));return!(t.type==="INJECTED"&&(t.name==="Browser Wallet"&&(!ue.isMobile()||ue.isMobile()&&!e&&!xe.checkInstalled())||r||n)||(t.type==="ANNOUNCED"||t.type==="EXTERNAL")&&(r||n))},getIsConnectedWithWC(){return Array.from(F.state.chains.values()).some(r=>ge.getConnectorId(r.namespace)===_e.CONNECTOR_ID.WALLET_CONNECT)},getConnectorTypeOrder({recommended:t,featured:e,custom:r,recent:n,announced:i,injected:s,multiChain:o,external:a,overriddenConnectors:c=(u=>(u=oe.state.features)==null?void 0:u.connectorTypeOrder)()??[]}){const l=xu.getIsConnectedWithWC(),f=[{type:"walletConnect",isEnabled:oe.state.enableWalletConnect&&!l},{type:"recent",isEnabled:n.length>0},{type:"injected",isEnabled:[...s,...i,...o].length>0},{type:"featured",isEnabled:e.length>0},{type:"custom",isEnabled:r&&r.length>0},{type:"external",isEnabled:a.length>0},{type:"recommended",isEnabled:t.length>0}].filter(b=>b.isEnabled),g=new Set(f.map(b=>b.type)),p=c.filter(b=>g.has(b)).map(b=>({type:b,isEnabled:!0})),m=f.filter(({type:b})=>!p.some(({type:E})=>E===b));return Array.from(new Set([...p,...m].map(({type:b})=>b)))}},K0={interpolate(t,e,r){if(t.length!==2||e.length!==2)throw new Error("inputRange and outputRange must be an array of length 2");const n=t[0]||0,i=t[1]||0,s=e[0]||0,o=e[1]||0;return ri?o:(o-s)/(i-n)*(r-n)+s}};/** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const eC=globalThis,o7=eC.ShadowRoot&&(eC.ShadyCSS===void 0||eC.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a7=Symbol(),vj=new WeakMap;let RZ=class{constructor(e,r,n){if(this._$cssResult$=!0,n!==a7)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=r}get styleSheet(){let e=this.o;const r=this.t;if(o7&&e===void 0){const n=r!==void 0&&r.length===1;n&&(e=vj.get(r)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&vj.set(r,e))}return e}toString(){return this.cssText}};const Vs=t=>new RZ(typeof t=="string"?t:t+"",void 0,a7),de=(t,...e)=>{const r=t.length===1?t[0]:e.reduce((n,i,s)=>n+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[s+1],t[0]);return new RZ(r,t,a7)},G3e=(t,e)=>{if(o7)t.adoptedStyleSheets=e.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet);else for(const r of e){const n=document.createElement("style"),i=eC.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=r.cssText,t.appendChild(n)}},_j=o7?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let r="";for(const n of e.cssRules)r+=n.cssText;return Vs(r)})(t):t;/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const{is:K3e,defineProperty:Z3e,getOwnPropertyDescriptor:Y3e,getOwnPropertyNames:J3e,getOwnPropertySymbols:Q3e,getPrototypeOf:X3e}=Object,hd=globalThis,Ej=hd.trustedTypes,e_e=Ej?Ej.emptyScript:"",cS=hd.reactiveElementPolyfillSupport,wb=(t,e)=>t,LC={toAttribute(t,e){switch(e){case Boolean:t=t?e_e:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let r=t;switch(e){case Boolean:r=t!==null;break;case Number:r=t===null?null:Number(t);break;case Object:case Array:try{r=JSON.parse(t)}catch{r=null}}return r}},c7=(t,e)=>!K3e(t,e),Cj={attribute:!0,type:String,converter:LC,reflect:!1,useDefault:!1,hasChanged:c7};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),hd.litPropertyMetadata??(hd.litPropertyMetadata=new WeakMap);let U0=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,r=Cj){if(r.state&&(r.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((r=Object.create(r)).wrapped=!0),this.elementProperties.set(e,r),!r.noAccessor){const n=Symbol(),i=this.getPropertyDescriptor(e,n,r);i!==void 0&&Z3e(this.prototype,e,i)}}static getPropertyDescriptor(e,r,n){const{get:i,set:s}=Y3e(this.prototype,e)??{get(){return this[r]},set(o){this[r]=o}};return{get:i,set(o){const a=i==null?void 0:i.call(this);s==null||s.call(this,o),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Cj}static _$Ei(){if(this.hasOwnProperty(wb("elementProperties")))return;const e=X3e(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(wb("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(wb("properties"))){const r=this.properties,n=[...J3e(r),...Q3e(r)];for(const i of n)this.createProperty(i,r[i])}const e=this[Symbol.metadata];if(e!==null){const r=litPropertyMetadata.get(e);if(r!==void 0)for(const[n,i]of r)this.elementProperties.set(n,i)}this._$Eh=new Map;for(const[r,n]of this.elementProperties){const i=this._$Eu(r,n);i!==void 0&&this._$Eh.set(i,r)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const r=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const i of n)r.unshift(_j(i))}else e!==void 0&&r.push(_j(e));return r}static _$Eu(e,r){const n=r.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(r=>this.enableUpdating=r),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(r=>r(this))}addController(e){var r;(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((r=e.hostConnected)==null||r.call(e))}removeController(e){var r;(r=this._$EO)==null||r.delete(e)}_$E_(){const e=new Map,r=this.constructor.elementProperties;for(const n of r.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return G3e(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(r=>{var n;return(n=r.hostConnected)==null?void 0:n.call(r)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(r=>{var n;return(n=r.hostDisconnected)==null?void 0:n.call(r)})}attributeChangedCallback(e,r,n){this._$AK(e,n)}_$ET(e,r){var s;const n=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,n);if(i!==void 0&&n.reflect===!0){const o=(((s=n.converter)==null?void 0:s.toAttribute)!==void 0?n.converter:LC).toAttribute(r,n.type);this._$Em=e,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(e,r){var s,o;const n=this.constructor,i=n._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const a=n.getPropertyOptions(i),c=typeof a.converter=="function"?{fromAttribute:a.converter}:((s=a.converter)==null?void 0:s.fromAttribute)!==void 0?a.converter:LC;this._$Em=i,this[i]=c.fromAttribute(r,a.type)??((o=this._$Ej)==null?void 0:o.get(i))??null,this._$Em=null}}requestUpdate(e,r,n){var i;if(e!==void 0){const s=this.constructor,o=this[e];if(n??(n=s.getPropertyOptions(e)),!((n.hasChanged??c7)(o,r)||n.useDefault&&n.reflect&&o===((i=this._$Ej)==null?void 0:i.get(e))&&!this.hasAttribute(s._$Eu(e,n))))return;this.C(e,r,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,r,{useDefault:n,reflect:i,wrapped:s},o){n&&!(this._$Ej??(this._$Ej=new Map)).has(e)&&(this._$Ej.set(e,o??r??this[e]),s!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(r=void 0),this._$AL.set(e,r)),i===!0&&this._$Em!==e&&(this._$Eq??(this._$Eq=new Set)).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(r){Promise.reject(r)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var n;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[s,o]of this._$Ep)this[s]=o;this._$Ep=void 0}const i=this.constructor.elementProperties;if(i.size>0)for(const[s,o]of i){const{wrapped:a}=o,c=this[s];a!==!0||this._$AL.has(s)||c===void 0||this.C(s,void 0,o,c)}}let e=!1;const r=this._$AL;try{e=this.shouldUpdate(r),e?(this.willUpdate(r),(n=this._$EO)==null||n.forEach(i=>{var s;return(s=i.hostUpdate)==null?void 0:s.call(i)}),this.update(r)):this._$EM()}catch(i){throw e=!1,this._$EM(),i}e&&this._$AE(r)}willUpdate(e){}_$AE(e){var r;(r=this._$EO)==null||r.forEach(n=>{var i;return(i=n.hostUpdated)==null?void 0:i.call(n)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&(this._$Eq=this._$Eq.forEach(r=>this._$ET(r,this[r]))),this._$EM()}updated(e){}firstUpdated(e){}};U0.elementStyles=[],U0.shadowRootOptions={mode:"open"},U0[wb("elementProperties")]=new Map,U0[wb("finalized")]=new Map,cS==null||cS({ReactiveElement:U0}),(hd.reactiveElementVersions??(hd.reactiveElementVersions=[])).push("2.1.0");/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const bb=globalThis,UC=bb.trustedTypes,Aj=UC?UC.createPolicy("lit-html",{createHTML:t=>t}):void 0,kZ="$lit$",Ul=`lit$${Math.random().toFixed(9).slice(2)}$`,NZ="?"+Ul,t_e=`<${NZ}>`,zf=document,by=()=>zf.createComment(""),yy=t=>t===null||typeof t!="object"&&typeof t!="function",u7=Array.isArray,r_e=t=>u7(t)||typeof(t==null?void 0:t[Symbol.iterator])=="function",uS=`[ \f\r]`,K1=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,xj=/-->/g,Sj=/>/g,hh=RegExp(`>|${uS}(?:([^\\s"'>=/]+)(${uS}*=${uS}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),Tj=/'/g,Ij=/"/g,$Z=/^(?:script|style|textarea|title)$/i,jZ=t=>(e,...r)=>({_$litType$:t,strings:e,values:r}),M=jZ(1),Se=jZ(2),Ru=Symbol.for("lit-noChange"),Jr=Symbol.for("lit-nothing"),Pj=new WeakMap,Qh=zf.createTreeWalker(zf,129);function BZ(t,e){if(!u7(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return Aj!==void 0?Aj.createHTML(e):e}const n_e=(t,e)=>{const r=t.length-1,n=[];let i,s=e===2?"":e===3?"":"",o=K1;for(let a=0;a"?(o=i??K1,d=-1):l[1]===void 0?d=-2:(d=o.lastIndex-l[2].length,u=l[1],o=l[3]===void 0?hh:l[3]==='"'?Ij:Tj):o===Ij||o===Tj?o=hh:o===xj||o===Sj?o=K1:(o=hh,i=void 0);const f=o===hh&&t[a+1].startsWith("/>")?" ":"";s+=o===K1?c+t_e:d>=0?(n.push(u),c.slice(0,d)+kZ+c.slice(d)+Ul+f):c+Ul+(d===-2?a:f)}return[BZ(t,s+(t[r]||"")+(e===2?"":e===3?"":"")),n]};let ZI=class DZ{constructor({strings:e,_$litType$:r},n){let i;this.parts=[];let s=0,o=0;const a=e.length-1,c=this.parts,[u,l]=n_e(e,r);if(this.el=DZ.createElement(u,n),Qh.currentNode=this.el.content,r===2||r===3){const d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(i=Qh.nextNode())!==null&&c.length0){i.textContent=UC?UC.emptyScript:"";for(let f=0;f2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=Jr}_$AI(e,r=this,n,i){const s=this.strings;let o=!1;if(s===void 0)e=_m(this,e,r,0),o=!yy(e)||e!==this._$AH&&e!==Ru,o&&(this._$AH=e);else{const a=e;let c,u;for(e=s[0],c=0;c{const n=(r==null?void 0:r.renderBefore)??e;let i=n._$litPart$;if(i===void 0){const s=(r==null?void 0:r.renderBefore)??null;n._$litPart$=i=new Hv(e.insertBefore(by(),s),s,void 0,r??{})}return i._$AI(t),i};/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const Of=globalThis;let se=class extends U0{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var r;const e=super.createRenderRoot();return(r=this.renderOptions).renderBefore??(r.renderBefore=e.firstChild),e}update(e){const r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=u_e(r,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)==null||e.setConnected(!1)}render(){return Ru}};var GW;se._$litElement$=!0,se.finalized=!0,(GW=Of.litElementHydrateSupport)==null||GW.call(Of,{LitElement:se});const dS=Of.litElementPolyfillSupport;dS==null||dS({LitElement:se});(Of.litElementVersions??(Of.litElementVersions=[])).push("4.2.0");let yb,fd,pd;function l_e(t,e){yb=document.createElement("style"),fd=document.createElement("style"),pd=document.createElement("style"),yb.textContent=og(t).core.cssText,fd.textContent=og(t).dark.cssText,pd.textContent=og(t).light.cssText,document.head.appendChild(yb),document.head.appendChild(fd),document.head.appendChild(pd),MZ(e)}function MZ(t){fd&&pd&&(t==="light"?(fd.removeAttribute("media"),pd.media="enabled"):(pd.removeAttribute("media"),fd.media="enabled"))}function d_e(t){yb&&fd&&pd&&(yb.textContent=og(t).core.cssText,fd.textContent=og(t).dark.cssText,pd.textContent=og(t).light.cssText)}function og(t){return{core:de` @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap'); @keyframes w3m-shake { 0% { transform: scale(1) rotate(0deg); } 20% { transform: scale(1) rotate(-1deg); } 40% { transform: scale(1) rotate(1.5deg); } 60% { transform: scale(1) rotate(-1.5deg); } 80% { transform: scale(1) rotate(1deg); } 100% { transform: scale(1) rotate(0deg); } } @keyframes w3m-iframe-fade-out { 0% { opacity: 1; } 100% { opacity: 0; } } @keyframes w3m-iframe-zoom-in { 0% { transform: translateY(50px); opacity: 0; } 100% { transform: translateY(0px); opacity: 1; } } @keyframes w3m-iframe-zoom-in-mobile { 0% { transform: scale(0.95); opacity: 0; } 100% { transform: scale(1); opacity: 1; } } :root { --w3m-modal-width: 360px; --w3m-color-mix-strength: ${Vs(t!=null&&t["--w3m-color-mix-strength"]?`${t["--w3m-color-mix-strength"]}%`:"0%")}; --w3m-font-family: ${Vs((t==null?void 0:t["--w3m-font-family"])||"Inter, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;")}; --w3m-font-size-master: ${Vs((t==null?void 0:t["--w3m-font-size-master"])||"10px")}; --w3m-border-radius-master: ${Vs((t==null?void 0:t["--w3m-border-radius-master"])||"4px")}; --w3m-z-index: ${Vs((t==null?void 0:t["--w3m-z-index"])||999)}; --wui-font-family: var(--w3m-font-family); --wui-font-size-mini: calc(var(--w3m-font-size-master) * 0.8); --wui-font-size-micro: var(--w3m-font-size-master); --wui-font-size-tiny: calc(var(--w3m-font-size-master) * 1.2); --wui-font-size-small: calc(var(--w3m-font-size-master) * 1.4); --wui-font-size-paragraph: calc(var(--w3m-font-size-master) * 1.6); --wui-font-size-medium: calc(var(--w3m-font-size-master) * 1.8); --wui-font-size-large: calc(var(--w3m-font-size-master) * 2); --wui-font-size-title-6: calc(var(--w3m-font-size-master) * 2.2); --wui-font-size-medium-title: calc(var(--w3m-font-size-master) * 2.4); --wui-font-size-2xl: calc(var(--w3m-font-size-master) * 4); --wui-border-radius-5xs: var(--w3m-border-radius-master); --wui-border-radius-4xs: calc(var(--w3m-border-radius-master) * 1.5); --wui-border-radius-3xs: calc(var(--w3m-border-radius-master) * 2); --wui-border-radius-xxs: calc(var(--w3m-border-radius-master) * 3); --wui-border-radius-xs: calc(var(--w3m-border-radius-master) * 4); --wui-border-radius-s: calc(var(--w3m-border-radius-master) * 5); --wui-border-radius-m: calc(var(--w3m-border-radius-master) * 7); --wui-border-radius-l: calc(var(--w3m-border-radius-master) * 9); --wui-border-radius-3xl: calc(var(--w3m-border-radius-master) * 20); --wui-font-weight-light: 400; --wui-font-weight-regular: 500; --wui-font-weight-medium: 600; --wui-font-weight-bold: 700; --wui-letter-spacing-2xl: -1.6px; --wui-letter-spacing-medium-title: -0.96px; --wui-letter-spacing-title-6: -0.88px; --wui-letter-spacing-large: -0.8px; --wui-letter-spacing-medium: -0.72px; --wui-letter-spacing-paragraph: -0.64px; --wui-letter-spacing-small: -0.56px; --wui-letter-spacing-tiny: -0.48px; --wui-letter-spacing-micro: -0.2px; --wui-letter-spacing-mini: -0.16px; --wui-spacing-0: 0px; --wui-spacing-4xs: 2px; --wui-spacing-3xs: 4px; --wui-spacing-xxs: 6px; --wui-spacing-2xs: 7px; --wui-spacing-xs: 8px; --wui-spacing-1xs: 10px; --wui-spacing-s: 12px; --wui-spacing-m: 14px; --wui-spacing-l: 16px; --wui-spacing-2l: 18px; --wui-spacing-xl: 20px; --wui-spacing-xxl: 24px; --wui-spacing-2xl: 32px; --wui-spacing-3xl: 40px; --wui-spacing-4xl: 90px; --wui-spacing-5xl: 95px; --wui-icon-box-size-xxs: 14px; --wui-icon-box-size-xs: 20px; --wui-icon-box-size-sm: 24px; --wui-icon-box-size-md: 32px; --wui-icon-box-size-mdl: 36px; --wui-icon-box-size-lg: 40px; --wui-icon-box-size-2lg: 48px; --wui-icon-box-size-xl: 64px; --wui-icon-size-inherit: inherit; --wui-icon-size-xxs: 10px; --wui-icon-size-xs: 12px; --wui-icon-size-sm: 14px; --wui-icon-size-md: 16px; --wui-icon-size-mdl: 18px; --wui-icon-size-lg: 20px; --wui-icon-size-xl: 24px; --wui-icon-size-xxl: 28px; --wui-wallet-image-size-inherit: inherit; --wui-wallet-image-size-sm: 40px; --wui-wallet-image-size-md: 56px; --wui-wallet-image-size-lg: 80px; --wui-visual-size-size-inherit: inherit; --wui-visual-size-sm: 40px; --wui-visual-size-md: 55px; --wui-visual-size-lg: 80px; --wui-box-size-md: 100px; --wui-box-size-lg: 120px; --wui-ease-out-power-2: cubic-bezier(0, 0, 0.22, 1); --wui-ease-out-power-1: cubic-bezier(0, 0, 0.55, 1); --wui-ease-in-power-3: cubic-bezier(0.66, 0, 1, 1); --wui-ease-in-power-2: cubic-bezier(0.45, 0, 1, 1); --wui-ease-in-power-1: cubic-bezier(0.3, 0, 1, 1); --wui-ease-inout-power-1: cubic-bezier(0.45, 0, 0.55, 1); --wui-duration-lg: 200ms; --wui-duration-md: 125ms; --wui-duration-sm: 75ms; --wui-path-network-sm: path( 'M15.4 2.1a5.21 5.21 0 0 1 5.2 0l11.61 6.7a5.21 5.21 0 0 1 2.61 4.52v13.4c0 1.87-1 3.59-2.6 4.52l-11.61 6.7c-1.62.93-3.6.93-5.22 0l-11.6-6.7a5.21 5.21 0 0 1-2.61-4.51v-13.4c0-1.87 1-3.6 2.6-4.52L15.4 2.1Z' ); --wui-path-network-md: path( 'M43.4605 10.7248L28.0485 1.61089C25.5438 0.129705 22.4562 0.129705 19.9515 1.61088L4.53951 10.7248C2.03626 12.2051 0.5 14.9365 0.5 17.886V36.1139C0.5 39.0635 2.03626 41.7949 4.53951 43.2752L19.9515 52.3891C22.4562 53.8703 25.5438 53.8703 28.0485 52.3891L43.4605 43.2752C45.9637 41.7949 47.5 39.0635 47.5 36.114V17.8861C47.5 14.9365 45.9637 12.2051 43.4605 10.7248Z' ); --wui-path-network-lg: path( 'M78.3244 18.926L50.1808 2.45078C45.7376 -0.150261 40.2624 -0.150262 35.8192 2.45078L7.6756 18.926C3.23322 21.5266 0.5 26.3301 0.5 31.5248V64.4752C0.5 69.6699 3.23322 74.4734 7.6756 77.074L35.8192 93.5492C40.2624 96.1503 45.7376 96.1503 50.1808 93.5492L78.3244 77.074C82.7668 74.4734 85.5 69.6699 85.5 64.4752V31.5248C85.5 26.3301 82.7668 21.5266 78.3244 18.926Z' ); --wui-width-network-sm: 36px; --wui-width-network-md: 48px; --wui-width-network-lg: 86px; --wui-height-network-sm: 40px; --wui-height-network-md: 54px; --wui-height-network-lg: 96px; --wui-icon-size-network-xs: 12px; --wui-icon-size-network-sm: 16px; --wui-icon-size-network-md: 24px; --wui-icon-size-network-lg: 42px; --wui-color-inherit: inherit; --wui-color-inverse-100: #fff; --wui-color-inverse-000: #000; --wui-cover: rgba(20, 20, 20, 0.8); --wui-color-modal-bg: var(--wui-color-modal-bg-base); --wui-color-accent-100: var(--wui-color-accent-base-100); --wui-color-accent-090: var(--wui-color-accent-base-090); --wui-color-accent-080: var(--wui-color-accent-base-080); --wui-color-success-100: var(--wui-color-success-base-100); --wui-color-success-125: var(--wui-color-success-base-125); --wui-color-warning-100: var(--wui-color-warning-base-100); --wui-color-error-100: var(--wui-color-error-base-100); --wui-color-error-125: var(--wui-color-error-base-125); --wui-color-blue-100: var(--wui-color-blue-base-100); --wui-color-blue-90: var(--wui-color-blue-base-90); --wui-icon-box-bg-error-100: var(--wui-icon-box-bg-error-base-100); --wui-icon-box-bg-blue-100: var(--wui-icon-box-bg-blue-base-100); --wui-icon-box-bg-success-100: var(--wui-icon-box-bg-success-base-100); --wui-icon-box-bg-inverse-100: var(--wui-icon-box-bg-inverse-base-100); --wui-all-wallets-bg-100: var(--wui-all-wallets-bg-100); --wui-avatar-border: var(--wui-avatar-border-base); --wui-thumbnail-border: var(--wui-thumbnail-border-base); --wui-wallet-button-bg: var(--wui-wallet-button-bg-base); --wui-box-shadow-blue: var(--wui-color-accent-glass-020); } @supports (background: color-mix(in srgb, white 50%, black)) { :root { --wui-color-modal-bg: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-modal-bg-base) ); --wui-box-shadow-blue: color-mix(in srgb, var(--wui-color-accent-100) 20%, transparent); --wui-color-accent-100: color-mix( in srgb, var(--wui-color-accent-base-100) 100%, transparent ); --wui-color-accent-090: color-mix( in srgb, var(--wui-color-accent-base-100) 90%, transparent ); --wui-color-accent-080: color-mix( in srgb, var(--wui-color-accent-base-100) 80%, transparent ); --wui-color-accent-glass-090: color-mix( in srgb, var(--wui-color-accent-base-100) 90%, transparent ); --wui-color-accent-glass-080: color-mix( in srgb, var(--wui-color-accent-base-100) 80%, transparent ); --wui-color-accent-glass-020: color-mix( in srgb, var(--wui-color-accent-base-100) 20%, transparent ); --wui-color-accent-glass-015: color-mix( in srgb, var(--wui-color-accent-base-100) 15%, transparent ); --wui-color-accent-glass-010: color-mix( in srgb, var(--wui-color-accent-base-100) 10%, transparent ); --wui-color-accent-glass-005: color-mix( in srgb, var(--wui-color-accent-base-100) 5%, transparent ); --wui-color-accent-002: color-mix( in srgb, var(--wui-color-accent-base-100) 2%, transparent ); --wui-color-fg-100: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-fg-100) ); --wui-color-fg-125: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-fg-125) ); --wui-color-fg-150: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-fg-150) ); --wui-color-fg-175: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-fg-175) ); --wui-color-fg-200: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-fg-200) ); --wui-color-fg-225: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-fg-225) ); --wui-color-fg-250: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-fg-250) ); --wui-color-fg-275: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-fg-275) ); --wui-color-fg-300: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-fg-300) ); --wui-color-fg-325: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-fg-325) ); --wui-color-fg-350: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-fg-350) ); --wui-color-bg-100: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-bg-100) ); --wui-color-bg-125: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-bg-125) ); --wui-color-bg-150: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-bg-150) ); --wui-color-bg-175: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-bg-175) ); --wui-color-bg-200: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-bg-200) ); --wui-color-bg-225: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-bg-225) ); --wui-color-bg-250: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-bg-250) ); --wui-color-bg-275: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-bg-275) ); --wui-color-bg-300: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-bg-300) ); --wui-color-bg-325: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-bg-325) ); --wui-color-bg-350: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-bg-350) ); --wui-color-success-100: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-success-base-100) ); --wui-color-success-125: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-success-base-125) ); --wui-color-warning-100: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-warning-base-100) ); --wui-color-error-100: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-error-base-100) ); --wui-color-blue-100: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-blue-base-100) ); --wui-color-blue-90: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-blue-base-90) ); --wui-color-error-125: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-error-base-125) ); --wui-icon-box-bg-error-100: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-icon-box-bg-error-base-100) ); --wui-icon-box-bg-accent-100: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-icon-box-bg-blue-base-100) ); --wui-icon-box-bg-success-100: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-icon-box-bg-success-base-100) ); --wui-icon-box-bg-inverse-100: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-icon-box-bg-inverse-base-100) ); --wui-all-wallets-bg-100: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-all-wallets-bg-100) ); --wui-avatar-border: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-avatar-border-base) ); --wui-thumbnail-border: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-thumbnail-border-base) ); --wui-wallet-button-bg: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-wallet-button-bg-base) ); } } `,light:de` :root { --w3m-color-mix: ${Vs((t==null?void 0:t["--w3m-color-mix"])||"#fff")}; --w3m-accent: ${Vs(za(t,"dark")["--w3m-accent"])}; --w3m-default: #fff; --wui-color-modal-bg-base: ${Vs(za(t,"dark")["--w3m-background"])}; --wui-color-accent-base-100: var(--w3m-accent); --wui-color-blueberry-100: hsla(230, 100%, 67%, 1); --wui-color-blueberry-090: hsla(231, 76%, 61%, 1); --wui-color-blueberry-080: hsla(230, 59%, 55%, 1); --wui-color-blueberry-050: hsla(231, 100%, 70%, 0.1); --wui-color-fg-100: #e4e7e7; --wui-color-fg-125: #d0d5d5; --wui-color-fg-150: #a8b1b1; --wui-color-fg-175: #a8b0b0; --wui-color-fg-200: #949e9e; --wui-color-fg-225: #868f8f; --wui-color-fg-250: #788080; --wui-color-fg-275: #788181; --wui-color-fg-300: #6e7777; --wui-color-fg-325: #9a9a9a; --wui-color-fg-350: #363636; --wui-color-bg-100: #141414; --wui-color-bg-125: #191a1a; --wui-color-bg-150: #1e1f1f; --wui-color-bg-175: #222525; --wui-color-bg-200: #272a2a; --wui-color-bg-225: #2c3030; --wui-color-bg-250: #313535; --wui-color-bg-275: #363b3b; --wui-color-bg-300: #3b4040; --wui-color-bg-325: #252525; --wui-color-bg-350: #ffffff; --wui-color-success-base-100: #26d962; --wui-color-success-base-125: #30a46b; --wui-color-warning-base-100: #f3a13f; --wui-color-error-base-100: #f25a67; --wui-color-error-base-125: #df4a34; --wui-color-blue-base-100: rgba(102, 125, 255, 1); --wui-color-blue-base-90: rgba(102, 125, 255, 0.9); --wui-color-success-glass-001: rgba(38, 217, 98, 0.01); --wui-color-success-glass-002: rgba(38, 217, 98, 0.02); --wui-color-success-glass-005: rgba(38, 217, 98, 0.05); --wui-color-success-glass-010: rgba(38, 217, 98, 0.1); --wui-color-success-glass-015: rgba(38, 217, 98, 0.15); --wui-color-success-glass-020: rgba(38, 217, 98, 0.2); --wui-color-success-glass-025: rgba(38, 217, 98, 0.25); --wui-color-success-glass-030: rgba(38, 217, 98, 0.3); --wui-color-success-glass-060: rgba(38, 217, 98, 0.6); --wui-color-success-glass-080: rgba(38, 217, 98, 0.8); --wui-color-success-glass-reown-020: rgba(48, 164, 107, 0.2); --wui-color-warning-glass-reown-020: rgba(243, 161, 63, 0.2); --wui-color-error-glass-001: rgba(242, 90, 103, 0.01); --wui-color-error-glass-002: rgba(242, 90, 103, 0.02); --wui-color-error-glass-005: rgba(242, 90, 103, 0.05); --wui-color-error-glass-010: rgba(242, 90, 103, 0.1); --wui-color-error-glass-015: rgba(242, 90, 103, 0.15); --wui-color-error-glass-020: rgba(242, 90, 103, 0.2); --wui-color-error-glass-025: rgba(242, 90, 103, 0.25); --wui-color-error-glass-030: rgba(242, 90, 103, 0.3); --wui-color-error-glass-060: rgba(242, 90, 103, 0.6); --wui-color-error-glass-080: rgba(242, 90, 103, 0.8); --wui-color-error-glass-reown-020: rgba(223, 74, 52, 0.2); --wui-color-gray-glass-001: rgba(255, 255, 255, 0.01); --wui-color-gray-glass-002: rgba(255, 255, 255, 0.02); --wui-color-gray-glass-005: rgba(255, 255, 255, 0.05); --wui-color-gray-glass-010: rgba(255, 255, 255, 0.1); --wui-color-gray-glass-015: rgba(255, 255, 255, 0.15); --wui-color-gray-glass-020: rgba(255, 255, 255, 0.2); --wui-color-gray-glass-025: rgba(255, 255, 255, 0.25); --wui-color-gray-glass-030: rgba(255, 255, 255, 0.3); --wui-color-gray-glass-060: rgba(255, 255, 255, 0.6); --wui-color-gray-glass-080: rgba(255, 255, 255, 0.8); --wui-color-gray-glass-090: rgba(255, 255, 255, 0.9); --wui-color-dark-glass-100: rgba(42, 42, 42, 1); --wui-icon-box-bg-error-base-100: #3c2426; --wui-icon-box-bg-blue-base-100: #20303f; --wui-icon-box-bg-success-base-100: #1f3a28; --wui-icon-box-bg-inverse-base-100: #243240; --wui-all-wallets-bg-100: #222b35; --wui-avatar-border-base: #252525; --wui-thumbnail-border-base: #252525; --wui-wallet-button-bg-base: var(--wui-color-bg-125); --w3m-card-embedded-shadow-color: rgb(17 17 18 / 25%); } `,dark:de` :root { --w3m-color-mix: ${Vs((t==null?void 0:t["--w3m-color-mix"])||"#000")}; --w3m-accent: ${Vs(za(t,"light")["--w3m-accent"])}; --w3m-default: #000; --wui-color-modal-bg-base: ${Vs(za(t,"light")["--w3m-background"])}; --wui-color-accent-base-100: var(--w3m-accent); --wui-color-blueberry-100: hsla(231, 100%, 70%, 1); --wui-color-blueberry-090: hsla(231, 97%, 72%, 1); --wui-color-blueberry-080: hsla(231, 92%, 74%, 1); --wui-color-fg-100: #141414; --wui-color-fg-125: #2d3131; --wui-color-fg-150: #474d4d; --wui-color-fg-175: #636d6d; --wui-color-fg-200: #798686; --wui-color-fg-225: #828f8f; --wui-color-fg-250: #8b9797; --wui-color-fg-275: #95a0a0; --wui-color-fg-300: #9ea9a9; --wui-color-fg-325: #9a9a9a; --wui-color-fg-350: #d0d0d0; --wui-color-bg-100: #ffffff; --wui-color-bg-125: #f5fafa; --wui-color-bg-150: #f3f8f8; --wui-color-bg-175: #eef4f4; --wui-color-bg-200: #eaf1f1; --wui-color-bg-225: #e5eded; --wui-color-bg-250: #e1e9e9; --wui-color-bg-275: #dce7e7; --wui-color-bg-300: #d8e3e3; --wui-color-bg-325: #f3f3f3; --wui-color-bg-350: #202020; --wui-color-success-base-100: #26b562; --wui-color-success-base-125: #30a46b; --wui-color-warning-base-100: #f3a13f; --wui-color-error-base-100: #f05142; --wui-color-error-base-125: #df4a34; --wui-color-blue-base-100: rgba(102, 125, 255, 1); --wui-color-blue-base-90: rgba(102, 125, 255, 0.9); --wui-color-success-glass-001: rgba(38, 181, 98, 0.01); --wui-color-success-glass-002: rgba(38, 181, 98, 0.02); --wui-color-success-glass-005: rgba(38, 181, 98, 0.05); --wui-color-success-glass-010: rgba(38, 181, 98, 0.1); --wui-color-success-glass-015: rgba(38, 181, 98, 0.15); --wui-color-success-glass-020: rgba(38, 181, 98, 0.2); --wui-color-success-glass-025: rgba(38, 181, 98, 0.25); --wui-color-success-glass-030: rgba(38, 181, 98, 0.3); --wui-color-success-glass-060: rgba(38, 181, 98, 0.6); --wui-color-success-glass-080: rgba(38, 181, 98, 0.8); --wui-color-success-glass-reown-020: rgba(48, 164, 107, 0.2); --wui-color-warning-glass-reown-020: rgba(243, 161, 63, 0.2); --wui-color-error-glass-001: rgba(240, 81, 66, 0.01); --wui-color-error-glass-002: rgba(240, 81, 66, 0.02); --wui-color-error-glass-005: rgba(240, 81, 66, 0.05); --wui-color-error-glass-010: rgba(240, 81, 66, 0.1); --wui-color-error-glass-015: rgba(240, 81, 66, 0.15); --wui-color-error-glass-020: rgba(240, 81, 66, 0.2); --wui-color-error-glass-025: rgba(240, 81, 66, 0.25); --wui-color-error-glass-030: rgba(240, 81, 66, 0.3); --wui-color-error-glass-060: rgba(240, 81, 66, 0.6); --wui-color-error-glass-080: rgba(240, 81, 66, 0.8); --wui-color-error-glass-reown-020: rgba(223, 74, 52, 0.2); --wui-icon-box-bg-error-base-100: #f4dfdd; --wui-icon-box-bg-blue-base-100: #d9ecfb; --wui-icon-box-bg-success-base-100: #daf0e4; --wui-icon-box-bg-inverse-base-100: #dcecfc; --wui-all-wallets-bg-100: #e8f1fa; --wui-avatar-border-base: #f3f4f4; --wui-thumbnail-border-base: #eaefef; --wui-wallet-button-bg-base: var(--wui-color-bg-125); --wui-color-gray-glass-001: rgba(0, 0, 0, 0.01); --wui-color-gray-glass-002: rgba(0, 0, 0, 0.02); --wui-color-gray-glass-005: rgba(0, 0, 0, 0.05); --wui-color-gray-glass-010: rgba(0, 0, 0, 0.1); --wui-color-gray-glass-015: rgba(0, 0, 0, 0.15); --wui-color-gray-glass-020: rgba(0, 0, 0, 0.2); --wui-color-gray-glass-025: rgba(0, 0, 0, 0.25); --wui-color-gray-glass-030: rgba(0, 0, 0, 0.3); --wui-color-gray-glass-060: rgba(0, 0, 0, 0.6); --wui-color-gray-glass-080: rgba(0, 0, 0, 0.8); --wui-color-gray-glass-090: rgba(0, 0, 0, 0.9); --wui-color-dark-glass-100: rgba(233, 233, 233, 1); --w3m-card-embedded-shadow-color: rgb(224 225 233 / 25%); } `}}const He=de` *, *::after, *::before, :host { margin: 0; padding: 0; box-sizing: border-box; font-style: normal; text-rendering: optimizeSpeed; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; -webkit-tap-highlight-color: transparent; font-family: var(--wui-font-family); backface-visibility: hidden; } `,vt=de` button, a { cursor: pointer; display: flex; justify-content: center; align-items: center; position: relative; transition: color var(--wui-duration-lg) var(--wui-ease-out-power-1), background-color var(--wui-duration-lg) var(--wui-ease-out-power-1), border var(--wui-duration-lg) var(--wui-ease-out-power-1), border-radius var(--wui-duration-lg) var(--wui-ease-out-power-1), box-shadow var(--wui-duration-lg) var(--wui-ease-out-power-1); will-change: background-color, color, border, box-shadow, border-radius; outline: none; border: none; column-gap: var(--wui-spacing-3xs); background-color: transparent; text-decoration: none; } wui-flex { transition: border-radius var(--wui-duration-lg) var(--wui-ease-out-power-1); will-change: border-radius; } button:disabled > wui-wallet-image, button:disabled > wui-all-wallets-image, button:disabled > wui-network-image, button:disabled > wui-image, button:disabled > wui-transaction-visual, button:disabled > wui-logo { filter: grayscale(1); } @media (hover: hover) and (pointer: fine) { button:hover:enabled { background-color: var(--wui-color-gray-glass-005); } button:active:enabled { background-color: var(--wui-color-gray-glass-010); } } button:disabled > wui-icon-box { opacity: 0.5; } input { border: none; outline: none; appearance: none; } `,qv=de` .wui-color-inherit { color: var(--wui-color-inherit); } .wui-color-accent-100 { color: var(--wui-color-accent-100); } .wui-color-error-100 { color: var(--wui-color-error-100); } .wui-color-blue-100 { color: var(--wui-color-blue-100); } .wui-color-blue-90 { color: var(--wui-color-blue-90); } .wui-color-error-125 { color: var(--wui-color-error-125); } .wui-color-success-100 { color: var(--wui-color-success-100); } .wui-color-success-125 { color: var(--wui-color-success-125); } .wui-color-inverse-100 { color: var(--wui-color-inverse-100); } .wui-color-inverse-000 { color: var(--wui-color-inverse-000); } .wui-color-fg-100 { color: var(--wui-color-fg-100); } .wui-color-fg-200 { color: var(--wui-color-fg-200); } .wui-color-fg-300 { color: var(--wui-color-fg-300); } .wui-color-fg-325 { color: var(--wui-color-fg-325); } .wui-color-fg-350 { color: var(--wui-color-fg-350); } .wui-bg-color-inherit { background-color: var(--wui-color-inherit); } .wui-bg-color-blue-100 { background-color: var(--wui-color-accent-100); } .wui-bg-color-error-100 { background-color: var(--wui-color-error-100); } .wui-bg-color-error-125 { background-color: var(--wui-color-error-125); } .wui-bg-color-success-100 { background-color: var(--wui-color-success-100); } .wui-bg-color-success-125 { background-color: var(--wui-color-success-100); } .wui-bg-color-inverse-100 { background-color: var(--wui-color-inverse-100); } .wui-bg-color-inverse-000 { background-color: var(--wui-color-inverse-000); } .wui-bg-color-fg-100 { background-color: var(--wui-color-fg-100); } .wui-bg-color-fg-200 { background-color: var(--wui-color-fg-200); } .wui-bg-color-fg-300 { background-color: var(--wui-color-fg-300); } .wui-color-fg-325 { background-color: var(--wui-color-fg-325); } .wui-color-fg-350 { background-color: var(--wui-color-fg-350); } `,nt={getSpacingStyles(t,e){if(Array.isArray(t))return t[e]?`var(--wui-spacing-${t[e]})`:void 0;if(typeof t=="string")return`var(--wui-spacing-${t})`},getFormattedDate(t){return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric"}).format(t)},getHostName(t){try{return new URL(t).hostname}catch{return""}},getTruncateString({string:t,charsStart:e,charsEnd:r,truncate:n}){return t.length<=e+r?t:n==="end"?`${t.substring(0,e)}...`:n==="start"?`...${t.substring(t.length-r)}`:`${t.substring(0,Math.floor(e))}...${t.substring(t.length-Math.floor(r))}`},generateAvatarColors(t){const r=t.toLowerCase().replace(/^0x/iu,"").replace(/[^a-f0-9]/gu,"").substring(0,6).padEnd(6,"0"),n=this.hexToRgb(r),i=getComputedStyle(document.documentElement).getPropertyValue("--w3m-border-radius-master"),o=100-3*Number(i==null?void 0:i.replace("px","")),a=`${o}% ${o}% at 65% 40%`,c=[];for(let u=0;u<5;u+=1){const l=this.tintColor(n,.15*u);c.push(`rgb(${l[0]}, ${l[1]}, ${l[2]})`)}return` --local-color-1: ${c[0]}; --local-color-2: ${c[1]}; --local-color-3: ${c[2]}; --local-color-4: ${c[3]}; --local-color-5: ${c[4]}; --local-radial-circle: ${a} `},hexToRgb(t){const e=parseInt(t,16),r=e>>16&255,n=e>>8&255,i=e&255;return[r,n,i]},tintColor(t,e){const[r,n,i]=t,s=Math.round(r+(255-r)*e),o=Math.round(n+(255-n)*e),a=Math.round(i+(255-i)*e);return[s,o,a]},isNumber(t){return{number:/^[0-9]+$/u}.number.test(t)},getColorTheme(t){var e;return t||(typeof window<"u"&&window.matchMedia?(e=window.matchMedia("(prefers-color-scheme: dark)"))!=null&&e.matches?"dark":"light":"dark")},splitBalance(t){const e=t.split(".");return e.length===2?[e[0],e[1]]:["0","00"]},roundNumber(t,e,r){return t.toString().length>=e?Number(t).toFixed(r):t},formatNumberToLocalString(t,e=2){return t===void 0?"0.00":typeof t=="number"?t.toLocaleString("en-US",{maximumFractionDigits:e,minimumFractionDigits:e}):parseFloat(t).toLocaleString("en-US",{maximumFractionDigits:e,minimumFractionDigits:e})}},h_e=3,f_e=["receive","deposit","borrow","claim"],p_e=["withdraw","repay","burn"],Xh={getTransactionGroupTitle(t,e){const r=bC.getYear(),n=bC.getMonthNameByIndex(e);return t===r?n:`${n} ${t}`},getTransactionImages(t){const[e,r]=t,n=!!e&&(t==null?void 0:t.every(o=>!!o.nft_info)),i=(t==null?void 0:t.length)>1;return(t==null?void 0:t.length)===2&&!n?[this.getTransactionImage(e),this.getTransactionImage(r)]:i?t.map(o=>this.getTransactionImage(o)):[this.getTransactionImage(e)]},getTransactionImage(t){return{type:Xh.getTransactionTransferTokenType(t),url:Xh.getTransactionImageURL(t)}},getTransactionImageURL(t){var i,s,o,a,c;let e;const r=!!(t!=null&&t.nft_info),n=!!(t!=null&&t.fungible_info);return t&&r?e=(o=(s=(i=t==null?void 0:t.nft_info)==null?void 0:i.content)==null?void 0:s.preview)==null?void 0:o.url:t&&n&&(e=(c=(a=t==null?void 0:t.fungible_info)==null?void 0:a.icon)==null?void 0:c.url),e},getTransactionTransferTokenType(t){if(t!=null&&t.fungible_info)return"FUNGIBLE";if(t!=null&&t.nft_info)return"NFT"},getTransactionDescriptions(t){var d,h,f;const e=(d=t==null?void 0:t.metadata)==null?void 0:d.operationType,r=t==null?void 0:t.transfers,n=((h=t==null?void 0:t.transfers)==null?void 0:h.length)>0,i=((f=t==null?void 0:t.transfers)==null?void 0:f.length)>1,s=n&&(r==null?void 0:r.every(g=>!!(g!=null&&g.fungible_info))),[o,a]=r;let c=this.getTransferDescription(o),u=this.getTransferDescription(a);if(!n)return(e==="send"||e==="receive")&&s?(c=nt.getTruncateString({string:t==null?void 0:t.metadata.sentFrom,charsStart:4,charsEnd:6,truncate:"middle"}),u=nt.getTruncateString({string:t==null?void 0:t.metadata.sentTo,charsStart:4,charsEnd:6,truncate:"middle"}),[c,u]):[t.metadata.status];if(i)return r.map(g=>this.getTransferDescription(g));let l="";return f_e.includes(e)?l="+":p_e.includes(e)&&(l="-"),c=l.concat(c),[c]},getTransferDescription(t){var r;let e="";return t&&(t!=null&&t.nft_info?e=((r=t==null?void 0:t.nft_info)==null?void 0:r.name)||"-":t!=null&&t.fungible_info&&(e=this.getFungibleTransferDescription(t)||"-")),e},getFungibleTransferDescription(t){var n;return t?[this.getQuantityFixedValue(t==null?void 0:t.quantity.numeric),(n=t==null?void 0:t.fungible_info)==null?void 0:n.symbol].join(" ").trim():null},getQuantityFixedValue(t){return t?parseFloat(t).toFixed(h_e):null}};function g_e(t,e){const{kind:r,elements:n}=e;return{kind:r,elements:n,finisher(i){customElements.get(t)||customElements.define(t,i)}}}function m_e(t,e){return customElements.get(t)||customElements.define(t,e),e}function te(t){return function(r){return typeof r=="function"?m_e(t,r):g_e(t,r)}}const wu={ERROR_CODE_UNRECOGNIZED_CHAIN_ID:4902,ERROR_CODE_DEFAULT:5e3,ERROR_INVALID_CHAIN_ID:32603,DEFAULT_ALLOWED_ANCESTORS:["http://localhost:*","https://*.pages.dev","https://*.vercel.app","https://*.ngrok-free.app","https://secure-mobile.walletconnect.com","https://secure-mobile.walletconnect.org"]},w_e={solana:["solana_signMessage","solana_signTransaction","solana_requestAccounts","solana_getAccounts","solana_signAllTransactions","solana_signAndSendTransaction"],eip155:["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_getCallsStatus","wallet_showCallsStatus","wallet_sendCalls","wallet_getCapabilities","wallet_grantPermissions","wallet_revokePermissions","wallet_getAssets"],bip122:["sendTransfer","signMessage","signPsbt","getAccountAddresses"]},tC={getMethodsByChainNamespace(t){return w_e[t]||[]},createDefaultNamespace(t){return{methods:this.getMethodsByChainNamespace(t),events:["accountsChanged","chainChanged"],chains:[],rpcMap:{}}},applyNamespaceOverrides(t,e){if(!e)return{...t};const r={...t},n=new Set;if(e.methods&&Object.keys(e.methods).forEach(i=>n.add(i)),e.chains&&Object.keys(e.chains).forEach(i=>n.add(i)),e.events&&Object.keys(e.events).forEach(i=>n.add(i)),e.rpcMap&&Object.keys(e.rpcMap).forEach(i=>{const[s]=i.split(":");s&&n.add(s)}),n.forEach(i=>{r[i]||(r[i]=this.createDefaultNamespace(i))}),e.methods&&Object.entries(e.methods).forEach(([i,s])=>{r[i]&&(r[i].methods=s)}),e.chains&&Object.entries(e.chains).forEach(([i,s])=>{r[i]&&(r[i].chains=s)}),e.events&&Object.entries(e.events).forEach(([i,s])=>{r[i]&&(r[i].events=s)}),e.rpcMap){const i=new Set;Object.entries(e.rpcMap).forEach(([s,o])=>{const[a,c]=s.split(":");!a||!c||!r[a]||(r[a].rpcMap||(r[a].rpcMap={}),i.has(a)||(r[a].rpcMap={},i.add(a)),r[a].rpcMap[c]=o)})}return r},createNamespaces(t,e){const r=t.reduce((n,i)=>{const{id:s,chainNamespace:o,rpcUrls:a}=i,c=a.default.http[0];n[o]||(n[o]=this.createDefaultNamespace(o));const u=`${o}:${s}`,l=n[o];switch(l.chains.push(u),u){case UR.caipNetworkId:l.chains.push(UR.deprecatedCaipNetworkId);break;case FR.caipNetworkId:l.chains.push(FR.deprecatedCaipNetworkId);break}return l!=null&&l.rpcMap&&c&&(l.rpcMap[s]=c),n},{});return this.applyNamespaceOverrides(r,e)},resolveReownName:async t=>{var n;const e=await ys.resolveName(t);return((n=(Object.values(e==null?void 0:e.addresses)||[])[0])==null?void 0:n.address)||!1},getChainsFromNamespaces(t={}){return Object.values(t).flatMap(e=>{const r=e.chains||[],n=e.accounts.map(i=>{const[s,o]=i.split(":");return`${s}:${o}`});return Array.from(new Set([...r,...n]))})},isSessionEventData(t){return typeof t=="object"&&t!==null&&"id"in t&&"topic"in t&&"params"in t&&typeof t.params=="object"&&t.params!==null&&"chainId"in t.params&&"event"in t.params&&typeof t.params.event=="object"&&t.params.event!==null},isOriginAllowed(t,e,r){for(const n of[...e,...r])if(n.includes("*")){const s=`^${n.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&").replace(/\\\*/gu,".*")}$`;if(new RegExp(s,"u").test(t))return!0}else try{if(new URL(n).origin===t)return!0}catch{if(n===t)return!0}return!1}};class l7{constructor({provider:e,namespace:r}){this.id=_e.CONNECTOR_ID.WALLET_CONNECT,this.name=Ua.ConnectorNamesMap[_e.CONNECTOR_ID.WALLET_CONNECT],this.type="WALLET_CONNECT",this.imageId=Ua.ConnectorImageIds[_e.CONNECTOR_ID.WALLET_CONNECT],this.getCaipNetworks=F.getCaipNetworks.bind(F),this.caipNetworks=this.getCaipNetworks(),this.provider=e,this.chain=r}get chains(){return this.getCaipNetworks()}async connectWalletConnect(){if(!await this.authenticate()){const r=this.getCaipNetworks(),n=oe.state.universalProviderConfigOverride,i=tC.createNamespaces(r,n);await this.provider.connect({optionalNamespaces:i})}return{clientId:await this.provider.client.core.crypto.getClientId(),session:this.provider.session}}async disconnect(){await this.provider.disconnect()}async authenticate(){const e=this.chains.map(r=>r.caipNetworkId);return Cu.universalProviderAuthenticate({universalProvider:this.provider,chains:e,methods:b_e})}}const b_e=["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_getCallsStatus","wallet_sendCalls","wallet_getCapabilities","wallet_grantPermissions","wallet_revokePermissions","wallet_getAssets"];class LZ{constructor(e){this.availableConnectors=[],this.eventListeners=new Map,this.getCaipNetworks=r=>F.getCaipNetworks(r),e&&this.construct(e)}construct(e){this.projectId=e.projectId,this.namespace=e.namespace,this.adapterType=e.adapterType}get connectors(){return this.availableConnectors}get networks(){return this.getCaipNetworks(this.namespace)}setAuthProvider(e){this.addConnector({id:_e.CONNECTOR_ID.AUTH,type:"AUTH",name:_e.CONNECTOR_NAMES.AUTH,provider:e,imageId:Ua.ConnectorImageIds[_e.CONNECTOR_ID.AUTH],chain:this.namespace,chains:[]})}addConnector(...e){const r=new Set;this.availableConnectors=[...e,...this.availableConnectors].filter(n=>r.has(n.id)?!1:(r.add(n.id),!0)),this.emit("connectors",this.availableConnectors)}setStatus(e,r){re.setStatus(e,r)}on(e,r){var n;this.eventListeners.has(e)||this.eventListeners.set(e,new Set),(n=this.eventListeners.get(e))==null||n.add(r)}off(e,r){const n=this.eventListeners.get(e);n&&n.delete(r)}removeAllEventListeners(){this.eventListeners.forEach(e=>{e.clear()})}emit(e,r){const n=this.eventListeners.get(e);n&&n.forEach(i=>i(r))}async connectWalletConnect(e){return{clientId:(await this.getWalletConnectConnector().connectWalletConnect()).clientId}}async switchNetwork(e){var s;const{caipNetwork:r,providerType:n}=e;if(!e.provider)return;const i="provider"in e.provider?e.provider.provider:e.provider;if(n==="WALLET_CONNECT"){i.setDefaultChain(r.caipNetworkId);return}if(i&&n==="AUTH"){const o=i,a=(s=re.state.preferredAccountTypes)==null?void 0:s[r.chainNamespace];await o.switchNetwork(r.caipNetworkId);const c=await o.getUser({chainId:r.caipNetworkId,preferredAccountType:a});this.emit("switchNetwork",c)}}getWalletConnectConnector(){const e=this.connectors.find(r=>r instanceof l7);if(!e)throw new Error("WalletConnectConnector not found");return e}}class y_e extends LZ{setUniversalProvider(e){this.addConnector(new l7({provider:e,caipNetworks:this.getCaipNetworks(),namespace:this.namespace}))}async connect(e){return Promise.resolve({id:"WALLET_CONNECT",type:"WALLET_CONNECT",chainId:Number(e.chainId),provider:this.provider,address:""})}async disconnect(){try{await this.getWalletConnectConnector().disconnect()}catch(e){console.warn("UniversalAdapter:disconnect - error",e)}}async getAccounts({namespace:e}){var i,s,o,a;const r=this.provider,n=((a=(o=(s=(i=r==null?void 0:r.session)==null?void 0:i.namespaces)==null?void 0:s[e])==null?void 0:o.accounts)==null?void 0:a.map(c=>{const[,,u]=c.split(":");return u}).filter((c,u,l)=>l.indexOf(c)===u))||[];return Promise.resolve({accounts:n.map(c=>ue.createAccount(e,c,e==="bip122"?"payment":"eoa"))})}async syncConnectors(){return Promise.resolve()}async getBalance(e){var s,o,a,c,u;if(!(e.caipNetwork&&ct.BALANCE_SUPPORTED_CHAINS.includes((s=e.caipNetwork)==null?void 0:s.chainNamespace))||(o=e.caipNetwork)!=null&&o.testnet)return{balance:"0.00",symbol:((a=e.caipNetwork)==null?void 0:a.nativeCurrency.symbol)||""};if(re.state.balanceLoading&&e.chainId===((c=F.state.activeCaipNetwork)==null?void 0:c.id))return{balance:re.state.balance||"0.00",symbol:re.state.balanceSymbol||""};const i=(await re.fetchTokenBalance()).find(l=>{var d,h;return l.chainId===`${(d=e.caipNetwork)==null?void 0:d.chainNamespace}:${e.chainId}`&&l.symbol===((h=e.caipNetwork)==null?void 0:h.nativeCurrency.symbol)});return{balance:(i==null?void 0:i.quantity.numeric)||"0.00",symbol:(i==null?void 0:i.symbol)||((u=e.caipNetwork)==null?void 0:u.nativeCurrency.symbol)||""}}async signMessage(e){var o,a,c;const{provider:r,message:n,address:i}=e;if(!r)throw new Error("UniversalAdapter:signMessage - provider is undefined");let s="";return((o=F.state.activeCaipNetwork)==null?void 0:o.chainNamespace)===_e.CHAIN.SOLANA?s=(await r.request({method:"solana_signMessage",params:{message:KG.encode(new TextEncoder().encode(n)),pubkey:i}},(a=F.state.activeCaipNetwork)==null?void 0:a.caipNetworkId)).signature:s=await r.request({method:"personal_sign",params:[n,i]},(c=F.state.activeCaipNetwork)==null?void 0:c.caipNetworkId),{signature:s}}async estimateGas(){return Promise.resolve({gas:BigInt(0)})}async sendTransaction(){return Promise.resolve({hash:""})}walletGetAssets(e){return Promise.resolve({})}async writeContract(){return Promise.resolve({hash:""})}parseUnits(){return 0n}formatUnits(){return"0"}async getCapabilities(){return Promise.resolve({})}async grantPermissions(){return Promise.resolve({})}async revokePermissions(){return Promise.resolve("0x")}async syncConnection(){return Promise.resolve({id:"WALLET_CONNECT",type:"WALLET_CONNECT",chainId:1,provider:this.provider,address:""})}async switchNetwork(e){var i,s,o,a,c,u;const{caipNetwork:r}=e,n=this.getWalletConnectConnector();if(r.chainNamespace===_e.CHAIN.EVM)try{await((i=n.provider)==null?void 0:i.request({method:"wallet_switchEthereumChain",params:[{chainId:Tb(r.id)}]}))}catch(l){if(l.code===wu.ERROR_CODE_UNRECOGNIZED_CHAIN_ID||l.code===wu.ERROR_INVALID_CHAIN_ID||l.code===wu.ERROR_CODE_DEFAULT||((o=(s=l==null?void 0:l.data)==null?void 0:s.originalError)==null?void 0:o.code)===wu.ERROR_CODE_UNRECOGNIZED_CHAIN_ID)try{await((u=n.provider)==null?void 0:u.request({method:"wallet_addEthereumChain",params:[{chainId:Tb(r.id),rpcUrls:[(a=r==null?void 0:r.rpcUrls.chainDefault)==null?void 0:a.http],chainName:r.name,nativeCurrency:r.nativeCurrency,blockExplorerUrls:[(c=r.blockExplorers)==null?void 0:c.default.url]}]}))}catch{throw new Error("Chain is not supported")}}n.provider.setDefaultChain(r.caipNetworkId)}getWalletConnectProvider(){const e=this.connectors.find(n=>n.type==="WALLET_CONNECT");return e==null?void 0:e.provider}}const v_e=["email","socials","swaps","onramp","activity","reownBranding"],y3={email:{apiFeatureName:"social_login",localFeatureName:"email",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:t=>{if(!(t!=null&&t.config))return!1;const e=t.config;return!!t.isEnabled&&e.includes("email")},processFallback:t=>t===void 0?ct.DEFAULT_REMOTE_FEATURES.email:!!t},socials:{apiFeatureName:"social_login",localFeatureName:"socials",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:t=>{if(!(t!=null&&t.config))return!1;const e=t.config;return t.isEnabled&&e.length>0?e.filter(r=>r!=="email"):!1},processFallback:t=>t===void 0?ct.DEFAULT_REMOTE_FEATURES.socials:typeof t=="boolean"?t?ct.DEFAULT_REMOTE_FEATURES.socials:!1:t},swaps:{apiFeatureName:"swap",localFeatureName:"swaps",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:t=>{if(!(t!=null&&t.config))return!1;const e=t.config;return t.isEnabled&&e.length>0?e:!1},processFallback:t=>t===void 0?ct.DEFAULT_REMOTE_FEATURES.swaps:typeof t=="boolean"?t?ct.DEFAULT_REMOTE_FEATURES.swaps:!1:t},onramp:{apiFeatureName:"onramp",localFeatureName:"onramp",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:t=>{if(!(t!=null&&t.config))return!1;const e=t.config;return t.isEnabled&&e.length>0?e:!1},processFallback:t=>t===void 0?ct.DEFAULT_REMOTE_FEATURES.onramp:typeof t=="boolean"?t?ct.DEFAULT_REMOTE_FEATURES.onramp:!1:t},activity:{apiFeatureName:"activity",localFeatureName:"history",returnType:!1,isLegacy:!0,isAvailableOnBasic:!1,processApi:t=>!!t.isEnabled,processFallback:t=>t===void 0?ct.DEFAULT_REMOTE_FEATURES.activity:!!t},reownBranding:{apiFeatureName:"reown_branding",localFeatureName:"reownBranding",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:t=>!!t.isEnabled,processFallback:t=>t===void 0?ct.DEFAULT_REMOTE_FEATURES.reownBranding:!!t}},__e={localSettingsOverridden:new Set,getApiConfig(t,e){return e==null?void 0:e.find(r=>r.id===t)},addWarning(t,e){if(t!==void 0){const r=y3[e],n=r.isLegacy?`"features.${r.localFeatureName}" (now "${e}")`:`"features.${e}"`;this.localSettingsOverridden.add(n)}},processFeature(t,e,r,n,i){const s=y3[t],o=e[s.localFeatureName];if(i&&!s.isAvailableOnBasic)return!1;if(n){const a=this.getApiConfig(s.apiFeatureName,r);return(a==null?void 0:a.config)===null?this.processFallbackFeature(t,o):a!=null&&a.config?(o!==void 0&&this.addWarning(o,t),this.processApiFeature(t,a)):!1}return this.processFallbackFeature(t,o)},processApiFeature(t,e){return y3[t].processApi(e)},processFallbackFeature(t,e){return y3[t].processFallback(e)},async fetchRemoteFeatures(t){const e=t.basic??!1,r=t.features||{};this.localSettingsOverridden.clear();let n=null,i=!1;try{n=await Ne.fetchProjectConfig(),i=n!=null}catch(o){console.warn("[Reown Config] Failed to fetch remote project configuration. Using local/default values.",o)}const s=i&&!e?ct.DEFAULT_REMOTE_FEATURES:ct.DEFAULT_REMOTE_FEATURES_DISABLED;try{for(const o of v_e){const a=this.processFeature(o,r,n,i,e);Object.assign(s,{[o]:a})}}catch(o){return console.warn("[Reown Config] Failed to process the configuration from Cloud. Using default values.",o),ct.DEFAULT_REMOTE_FEATURES}if(i&&this.localSettingsOverridden.size>0){const o=`Your local configuration for ${Array.from(this.localSettingsOverridden).join(", ")} was ignored because a remote configuration was successfully fetched. Please manage these features via your project dashboard on dashboard.reown.com.`;Fn.open({shortMessage:"Local configuration ignored",longMessage:`[Reown Config Notice] ${o}`},"warning")}return s}};class E_e{constructor(e){this.chainNamespaces=[],this.remoteFeatures={},this.reportedAlertErrors={},this.getCaipNetwork=(r,n)=>{var i,s,o,a;if(r){const c=(s=(i=F.getNetworkData(r))==null?void 0:i.requestedCaipNetworks)==null?void 0:s.find(d=>d.id===n);if(c)return c;const u=(o=F.getNetworkData(r))==null?void 0:o.caipNetwork;return u||((a=F.getRequestedCaipNetworks(r).filter(d=>d.chainNamespace===r))==null?void 0:a[0])}return F.state.activeCaipNetwork||this.defaultCaipNetwork},this.getCaipNetworkId=()=>{const r=this.getCaipNetwork();if(r)return r.id},this.getCaipNetworks=r=>F.getCaipNetworks(r),this.getActiveChainNamespace=()=>F.state.activeChain,this.setRequestedCaipNetworks=(r,n)=>{F.setRequestedCaipNetworks(r,n)},this.getApprovedCaipNetworkIds=()=>F.getAllApprovedCaipNetworkIds(),this.getCaipAddress=r=>F.state.activeChain===r||!r?F.state.activeCaipAddress:F.getAccountProp("caipAddress",r),this.setClientId=r=>{Xe.setClientId(r)},this.getProvider=r=>kt.getProvider(r),this.getProviderType=r=>kt.getProviderId(r),this.getPreferredAccountType=r=>{var n;return(n=re.state.preferredAccountTypes)==null?void 0:n[r]},this.setCaipAddress=(r,n)=>{re.setCaipAddress(r,n),r&&oe.state.enableEmbedded&&this.close()},this.setBalance=(r,n,i)=>{re.setBalance(r,n,i)},this.setProfileName=(r,n)=>{re.setProfileName(r,n)},this.setProfileImage=(r,n)=>{re.setProfileImage(r,n)},this.setUser=(r,n)=>{re.setUser(r,n)},this.resetAccount=r=>{re.resetAccount(r)},this.setCaipNetwork=r=>{F.setActiveCaipNetwork(r)},this.setCaipNetworkOfNamespace=(r,n)=>{F.setChainNetworkData(n,{caipNetwork:r})},this.setAllAccounts=(r,n)=>{re.setAllAccounts(r,n),oe.setHasMultipleAddresses((r==null?void 0:r.length)>1)},this.setStatus=(r,n)=>{re.setStatus(r,n),ge.isConnected()?Le.setConnectionStatus("connected"):Le.setConnectionStatus("disconnected")},this.getAddressByChainNamespace=r=>F.getAccountProp("address",r),this.setConnectors=r=>{const n=[...ge.state.allConnectors,...r];ge.setConnectors(n)},this.setConnections=(r,n)=>{xe.setConnections(r,n)},this.fetchIdentity=r=>Xe.fetchIdentity(r),this.getReownName=r=>ys.getNamesForAddress(r),this.getConnectors=()=>ge.getConnectors(),this.getConnectorImage=r=>pt.getConnectorImage(r),this.setConnectedWalletInfo=(r,n)=>{const i=kt.getProviderId(n),s=r?{...r,type:i}:void 0;re.setConnectedWalletInfo(s,n)},this.getIsConnectedState=()=>!!F.state.activeCaipAddress,this.addAddressLabel=(r,n,i)=>{re.addAddressLabel(r,n,i)},this.removeAddressLabel=(r,n)=>{re.removeAddressLabel(r,n)},this.getAddress=r=>F.state.activeChain===r||!r?re.state.address:F.getAccountProp("address",r),this.setApprovedCaipNetworksData=r=>F.setApprovedCaipNetworksData(r),this.resetNetwork=r=>{F.resetNetwork(r)},this.addConnector=r=>{ge.addConnector(r)},this.resetWcConnection=()=>{xe.resetWcConnection()},this.setAddressExplorerUrl=(r,n)=>{re.setAddressExplorerUrl(r,n)},this.setSmartAccountDeployed=(r,n)=>{re.setSmartAccountDeployed(r,n)},this.setSmartAccountEnabledNetworks=(r,n)=>{F.setSmartAccountEnabledNetworks(r,n)},this.setPreferredAccountType=(r,n)=>{re.setPreferredAccountType(r,n)},this.setEIP6963Enabled=r=>{oe.setEIP6963Enabled(r)},this.handleUnsafeRPCRequest=()=>{if(this.isOpen()){if(this.isTransactionStackEmpty())return;this.redirect("ApproveTransaction")}else this.open({view:"ApproveTransaction"})},this.options=e,this.version=e.sdkVersion,this.caipNetworks=this.extendCaipNetworks(e),this.chainNamespaces=this.getChainNamespacesSet(e.adapters,this.caipNetworks),this.defaultCaipNetwork=this.extendDefaultCaipNetwork(e),this.chainAdapters=this.createAdapters(e.adapters),this.readyPromise=this.initialize(e)}getChainNamespacesSet(e,r){const n=e==null?void 0:e.map(s=>s.namespace).filter(s=>!!s);if(n!=null&&n.length)return[...new Set(n)];const i=r==null?void 0:r.map(s=>s.chainNamespace);return[...new Set(i)]}async initialize(e){var r,n,i;this.initializeProjectSettings(e),this.initControllers(e),await this.initChainAdapters(),this.sendInitializeEvent(e),await this.syncExistingConnection(),this.remoteFeatures=await __e.fetchRemoteFeatures(e),oe.setRemoteFeatures(this.remoteFeatures),this.remoteFeatures.onramp&&$t.setOnrampProviders(this.remoteFeatures.onramp),((r=oe.state.remoteFeatures)!=null&&r.email||Array.isArray((n=oe.state.remoteFeatures)==null?void 0:n.socials)&&((i=oe.state.remoteFeatures)==null?void 0:i.socials.length)>0)&&await this.checkAllowedOrigins()}async checkAllowedOrigins(){const e=await Ne.fetchAllowedOrigins();if(e&&ue.isClient()){const r=window.location.origin;tC.isOriginAllowed(r,e,wu.DEFAULT_ALLOWED_ANCESTORS)||Fn.open(Do.ALERT_ERRORS.INVALID_APP_CONFIGURATION,"error")}else Fn.open(Do.ALERT_ERRORS.PROJECT_ID_NOT_CONFIGURED,"error")}sendInitializeEvent(e){var n;const{...r}=e;delete r.adapters,delete r.universalProvider,Re.sendEvent({type:"track",event:"INITIALIZE",properties:{...r,networks:e.networks.map(i=>i.id),siweConfig:{options:((n=e.siweConfig)==null?void 0:n.options)||{}}}})}initControllers(e){this.initializeOptionsController(e),this.initializeChainController(e),this.initializeThemeController(e),this.initializeConnectionController(e),this.initializeConnectorController()}initializeThemeController(e){e.themeMode&&ar.setThemeMode(e.themeMode),e.themeVariables&&ar.setThemeVariables(e.themeVariables)}initializeChainController(e){if(!this.connectionControllerClient||!this.networkControllerClient)throw new Error("ConnectionControllerClient and NetworkControllerClient must be set");F.initialize(e.adapters??[],this.caipNetworks,{connectionControllerClient:this.connectionControllerClient,networkControllerClient:this.networkControllerClient});const r=this.getDefaultNetwork();r&&F.setActiveCaipNetwork(r)}initializeConnectionController(e){xe.setWcBasic(e.basic??!1)}initializeConnectorController(){ge.initialize(this.chainNamespaces)}initializeProjectSettings(e){oe.setProjectId(e.projectId),oe.setSdkVersion(e.sdkVersion)}initializeOptionsController(e){var o;oe.setDebug(e.debug!==!1),oe.setEnableWalletConnect(e.enableWalletConnect!==!1),oe.setEnableWalletGuide(e.enableWalletGuide!==!1),oe.setEnableWallets(e.enableWallets!==!1),oe.setEIP6963Enabled(e.enableEIP6963!==!1),oe.setEnableNetworkSwitch(e.enableNetworkSwitch!==!1),oe.setEnableAuthLogger(e.enableAuthLogger!==!1),oe.setCustomRpcUrls(e.customRpcUrls),oe.setEnableEmbedded(e.enableEmbedded),oe.setAllWallets(e.allWallets),oe.setIncludeWalletIds(e.includeWalletIds),oe.setExcludeWalletIds(e.excludeWalletIds),oe.setFeaturedWalletIds(e.featuredWalletIds),oe.setTokens(e.tokens),oe.setTermsConditionsUrl(e.termsConditionsUrl),oe.setPrivacyPolicyUrl(e.privacyPolicyUrl),oe.setCustomWallets(e.customWallets),oe.setFeatures(e.features),oe.setAllowUnsupportedChain(e.allowUnsupportedChain),oe.setUniversalProviderConfigOverride(e.universalProviderConfigOverride),oe.setPreferUniversalLinks(e.experimental_preferUniversalLinks),oe.setDefaultAccountTypes(e.defaultAccountTypes);const r=Le.getPreferredAccountTypes()||{},n={...oe.state.defaultAccountTypes,...r};re.setPreferredAccountTypes(n);const i=this.getDefaultMetaData();if(!e.metadata&&i&&(e.metadata=i),oe.setMetadata(e.metadata),oe.setDisableAppend(e.disableAppend),oe.setEnableEmbedded(e.enableEmbedded),oe.setSIWX(e.siwx),!e.projectId){Fn.open(Do.ALERT_ERRORS.PROJECT_ID_NOT_CONFIGURED,"error");return}if(((o=e.adapters)==null?void 0:o.find(a=>a.namespace===_e.CHAIN.EVM))&&e.siweConfig){if(e.siwx)throw new Error("Cannot set both `siweConfig` and `siwx` options");oe.setSIWX(e.siweConfig.mapToSIWX())}}getDefaultMetaData(){var e,r,n,i;return ue.isClient()?{name:((r=(e=document.getElementsByTagName("title"))==null?void 0:e[0])==null?void 0:r.textContent)||"",description:((n=document.querySelector('meta[property="og:description"]'))==null?void 0:n.content)||"",url:window.location.origin,icons:[((i=document.querySelector('link[rel~="icon"]'))==null?void 0:i.href)||""]}:null}setUnsupportedNetwork(e){const r=this.getActiveChainNamespace();if(r){const n=M0.getUnsupportedNetwork(`${r}:${e}`);F.setActiveCaipNetwork(n)}}getDefaultNetwork(){return M0.getCaipNetworkFromStorage(this.defaultCaipNetwork)}extendCaipNetwork(e,r){return M0.extendCaipNetwork(e,{customNetworkImageUrls:r.chainImages,projectId:r.projectId})}extendCaipNetworks(e){return M0.extendCaipNetworks(e.networks,{customNetworkImageUrls:e.chainImages,customRpcUrls:e.customRpcUrls,projectId:e.projectId})}extendDefaultCaipNetwork(e){const r=e.networks.find(i=>{var s;return i.id===((s=e.defaultNetwork)==null?void 0:s.id)});return r?M0.extendCaipNetwork(r,{customNetworkImageUrls:e.chainImages,customRpcUrls:e.customRpcUrls,projectId:e.projectId}):void 0}async disconnectNamespace(e){try{const r=this.getAdapter(e),n=kt.getProvider(e),i=kt.getProviderId(e),{caipAddress:s}=F.getAccountData(e)||{};this.setLoading(!0,e),s&&(r!=null&&r.disconnect)&&await r.disconnect({provider:n,providerType:i}),Le.removeConnectedNamespace(e),kt.resetChain(e),this.setUser(void 0,e),this.setStatus("disconnected",e),this.setConnectedWalletInfo(void 0,e),ge.removeConnectorId(e),F.resetAccount(e),F.resetNetwork(e),this.setLoading(!1,e)}catch(r){throw this.setLoading(!1,e),new Error(`Failed to disconnect chain ${e}: ${r.message}`)}}createClients(){this.connectionControllerClient={connectWalletConnect:async()=>{var s;const e=F.state.activeChain,r=this.getAdapter(e),n=(s=this.getCaipNetwork(e))==null?void 0:s.id;if(!r)throw new Error("Adapter not found");const i=await r.connectWalletConnect(n);this.close(),this.setClientId((i==null?void 0:i.clientId)||null),Le.setConnectedNamespaces([...F.state.chains.keys()]),this.chainNamespaces.forEach(o=>{ge.setConnectorId(Xt.CONNECTOR_TYPE_WALLET_CONNECT,o)}),await this.syncWalletConnectAccount()},connectExternal:async({id:e,info:r,type:n,provider:i,chain:s,caipNetwork:o,socialUri:a})=>{var p,m,b,v,E,w;const c=F.state.activeChain,u=s||c,l=this.getAdapter(u);if(s&&s!==c&&!o){const C=this.getCaipNetworks().find(y=>y.chainNamespace===s);C&&this.setCaipNetwork(C)}if(!l)throw new Error("Adapter not found");const d=this.getCaipNetwork(u),h=await l.connect({id:e,info:r,type:n,provider:i,socialUri:a,chainId:(o==null?void 0:o.id)||(d==null?void 0:d.id),rpcUrl:((b=(m=(p=o==null?void 0:o.rpcUrls)==null?void 0:p.default)==null?void 0:m.http)==null?void 0:b[0])||((w=(E=(v=d==null?void 0:d.rpcUrls)==null?void 0:v.default)==null?void 0:E.http)==null?void 0:w[0])});if(!h)return;Le.addConnectedNamespace(u),this.syncProvider({...h,chainNamespace:u});const f=re.state.allAccounts,{accounts:g}=(f==null?void 0:f.length)>0?{accounts:[...f]}:await l.getAccounts({namespace:u,id:e});this.setAllAccounts(g,u),this.setStatus("connected",u),this.syncConnectedWalletInfo(u)},reconnectExternal:async({id:e,info:r,type:n,provider:i})=>{var a;const s=F.state.activeChain,o=this.getAdapter(s);o!=null&&o.reconnect&&(await(o==null?void 0:o.reconnect({id:e,info:r,type:n,provider:i,chainId:(a=this.getCaipNetwork())==null?void 0:a.id})),Le.addConnectedNamespace(s),this.syncConnectedWalletInfo(s))},disconnect:async e=>{const r=V3e(e);try{const n=await Promise.allSettled(r.map(async([s])=>this.disconnectNamespace(s)));Qe.resetSend(),xe.resetWcConnection(),await Cu.clearSessions(),ge.setFilterByNamespace(void 0);const i=n.filter(s=>s.status==="rejected");if(i.length>0)throw new Error(i.map(s=>s.reason.message).join(", "));Le.deleteConnectedSocialProvider(),Re.sendEvent({type:"track",event:"DISCONNECT_SUCCESS",properties:{namespace:e||"all"}})}catch(n){throw new Error(`Failed to disconnect chains: ${n.message}`)}},checkInstalled:e=>e?e.some(r=>{var n;return!!((n=window.ethereum)!=null&&n[String(r)])}):!!window.ethereum,signMessage:async e=>{const r=this.getAdapter(F.state.activeChain),n=await(r==null?void 0:r.signMessage({message:e,address:re.state.address,provider:kt.getProvider(F.state.activeChain)}));return(n==null?void 0:n.signature)||""},sendTransaction:async e=>{const r=e.chainNamespace;if(ct.SEND_SUPPORTED_NAMESPACES.includes(r)){const n=this.getAdapter(F.state.activeChain),i=kt.getProvider(r),s=await(n==null?void 0:n.sendTransaction({...e,caipNetwork:this.getCaipNetwork(),provider:i}));return(s==null?void 0:s.hash)||""}return""},estimateGas:async e=>{if(e.chainNamespace===_e.CHAIN.EVM){const r=this.getAdapter(F.state.activeChain),n=kt.getProvider(F.state.activeChain),i=this.getCaipNetwork();if(!i)throw new Error("CaipNetwork is undefined");const s=await(r==null?void 0:r.estimateGas({...e,provider:n,caipNetwork:i}));return(s==null?void 0:s.gas)||0n}return 0n},getEnsAvatar:async()=>{var e;return await this.syncIdentity({address:re.state.address,chainId:Number((e=this.getCaipNetwork())==null?void 0:e.id),chainNamespace:F.state.activeChain}),re.state.profileImage||!1},getEnsAddress:async e=>await tC.resolveReownName(e),writeContract:async e=>{const r=this.getAdapter(F.state.activeChain),n=this.getCaipNetwork(),i=this.getCaipAddress(),s=kt.getProvider(F.state.activeChain);if(!n||!i)throw new Error("CaipNetwork or CaipAddress is undefined");const o=await(r==null?void 0:r.writeContract({...e,caipNetwork:n,provider:s,caipAddress:i}));return o==null?void 0:o.hash},parseUnits:(e,r)=>{const n=this.getAdapter(F.state.activeChain);return(n==null?void 0:n.parseUnits({value:e,decimals:r}))??0n},formatUnits:(e,r)=>{const n=this.getAdapter(F.state.activeChain);return(n==null?void 0:n.formatUnits({value:e,decimals:r}))??"0"},getCapabilities:async e=>{const r=this.getAdapter(F.state.activeChain);return await(r==null?void 0:r.getCapabilities(e))},grantPermissions:async e=>{const r=this.getAdapter(F.state.activeChain);return await(r==null?void 0:r.grantPermissions(e))},revokePermissions:async e=>{const r=this.getAdapter(F.state.activeChain);return r!=null&&r.revokePermissions?await r.revokePermissions(e):"0x"},walletGetAssets:async e=>{const r=this.getAdapter(F.state.activeChain);return await(r==null?void 0:r.walletGetAssets(e))??{}},updateBalance:e=>{const r=this.getCaipNetwork(e);!r||!re.state.address||this.updateNativeBalance(re.state.address,r==null?void 0:r.id,e)}},this.networkControllerClient={switchCaipNetwork:async e=>await this.switchCaipNetwork(e),getApprovedCaipNetworksData:async()=>this.getApprovedCaipNetworksData()},xe.setClient(this.connectionControllerClient)}getApprovedCaipNetworksData(){var r,n,i,s,o;if(kt.getProviderId(F.state.activeChain)===Xt.CONNECTOR_TYPE_WALLET_CONNECT){const a=(n=(r=this.universalProvider)==null?void 0:r.session)==null?void 0:n.namespaces;return{supportsAllNetworks:((o=(s=(i=this.universalProvider)==null?void 0:i.session)==null?void 0:s.peer)==null?void 0:o.metadata.name)==="MetaMask Wallet",approvedCaipNetworkIds:this.getChainsFromNamespaces(a)}}return{supportsAllNetworks:!0,approvedCaipNetworkIds:[]}}async switchCaipNetwork(e){if(!e)return;const r=e.chainNamespace;if(this.getAddressByChainNamespace(e.chainNamespace)){const i=kt.getProvider(r),s=kt.getProviderId(r);if(e.chainNamespace===F.state.activeChain){const o=this.getAdapter(r);await(o==null?void 0:o.switchNetwork({caipNetwork:e,provider:i,providerType:s}))}else if(this.setCaipNetwork(e),s===Xt.CONNECTOR_TYPE_WALLET_CONNECT)this.syncWalletConnectAccount();else{const o=this.getAddressByChainNamespace(r);o&&this.syncAccount({address:o,chainId:e.id,chainNamespace:r})}}else this.setCaipNetwork(e)}getChainsFromNamespaces(e={}){return Object.values(e).flatMap(r=>{const n=r.chains||[],i=r.accounts.map(s=>{const{chainId:o,chainNamespace:a}=bs.parseCaipAddress(s);return`${a}:${o}`});return Array.from(new Set([...n,...i]))})}createAdapters(e){return this.createClients(),this.chainNamespaces.reduce((r,n)=>{var s;const i=e==null?void 0:e.find(o=>o.namespace===n);return i?(i.construct({namespace:n,projectId:(s=this.options)==null?void 0:s.projectId,networks:this.getCaipNetworks()}),r[n]=i):r[n]=new y_e({namespace:n,networks:this.getCaipNetworks()}),r},{})}async initChainAdapter(e){var r;this.onConnectors(e),this.listenAdapter(e),await((r=this.chainAdapters)==null?void 0:r[e].syncConnectors(this.options,this)),await this.createUniversalProviderForAdapter(e)}async initChainAdapters(){await Promise.all(this.chainNamespaces.map(async e=>{await this.initChainAdapter(e)}))}onConnectors(e){const r=this.getAdapter(e);r==null||r.on("connectors",this.setConnectors.bind(this))}listenAdapter(e){const r=this.getAdapter(e);if(!r)return;const n=Le.getConnectionStatus();n==="connected"?this.setStatus("connecting",e):n==="disconnected"?(Le.clearAddressCache(),this.setStatus(n,e)):this.setStatus(n,e),r.on("switchNetwork",({address:i,chainId:s})=>{const o=this.getCaipNetworks().find(u=>u.id===s||u.caipNetworkId===s),a=F.state.activeChain===e,c=F.getAccountProp("address",e);if(o){const u=a&&i?i:c;u&&this.syncAccount({address:u,chainId:o.id,chainNamespace:e})}else this.setUnsupportedNetwork(s)}),r.on("disconnect",this.disconnect.bind(this,e)),r.on("connections",i=>{this.setConnections(i,e)}),r.on("pendingTransactions",()=>{const i=re.state.address,s=F.state.activeCaipNetwork;!i||!(s!=null&&s.id)||this.updateNativeBalance(i,s.id,s.chainNamespace)}),r.on("accountChanged",({address:i,chainId:s})=>{var a,c;const o=F.state.activeChain===e;o&&s?this.syncAccount({address:i,chainId:s,chainNamespace:e}):o&&((a=F.state.activeCaipNetwork)!=null&&a.id)?this.syncAccount({address:i,chainId:(c=F.state.activeCaipNetwork)==null?void 0:c.id,chainNamespace:e}):this.syncAccountInfo(i,s,e),this.syncAllAccounts(e)})}async createUniversalProviderForAdapter(e){var r,n,i;await this.getUniversalProvider(),this.universalProvider&&((i=(n=(r=this.chainAdapters)==null?void 0:r[e])==null?void 0:n.setUniversalProvider)==null||i.call(n,this.universalProvider))}async syncExistingConnection(){await Promise.allSettled(this.chainNamespaces.map(e=>this.syncNamespaceConnection(e)))}async syncNamespaceConnection(e){try{e===_e.CHAIN.EVM&&ue.isSafeApp()&&ge.setConnectorId(_e.CONNECTOR_ID.SAFE,e);const r=ge.getConnectorId(e);switch(this.setStatus("connecting",e),r){case _e.CONNECTOR_ID.WALLET_CONNECT:await this.syncWalletConnectAccount();break;case _e.CONNECTOR_ID.AUTH:break;default:await this.syncAdapterConnection(e)}}catch(r){console.warn("AppKit couldn't sync existing connection",r),this.setStatus("disconnected",e)}}async syncAdapterConnection(e){var a,c,u;const r=this.getAdapter(e),n=ge.getConnectorId(e),i=this.getCaipNetwork(e),o=ge.getConnectors(e).find(l=>l.id===n);try{if(!r||!o)throw new Error(`Adapter or connector not found for namespace ${e}`);if(!(i!=null&&i.id))throw new Error("CaipNetwork not found");const l=await(r==null?void 0:r.syncConnection({namespace:e,id:o.id,chainId:i.id,rpcUrl:(u=(c=(a=i==null?void 0:i.rpcUrls)==null?void 0:a.default)==null?void 0:c.http)==null?void 0:u[0]}));if(l){const d=await(r==null?void 0:r.getAccounts({namespace:e,id:o.id}));d&&d.accounts.length>0?this.setAllAccounts(d.accounts,e):this.setAllAccounts([ue.createAccount(e,l.address,"eoa")],e),this.syncProvider({...l,chainNamespace:e}),await this.syncAccount({...l,chainNamespace:e}),this.setStatus("connected",e)}else this.setStatus("disconnected",e)}catch{this.setStatus("disconnected",e)}}async syncWalletConnectAccount(){const e=this.chainNamespaces.map(async r=>{var a,c,u,l,d;const n=this.getAdapter(r),i=((l=(u=(c=(a=this.universalProvider)==null?void 0:a.session)==null?void 0:c.namespaces)==null?void 0:u[r])==null?void 0:l.accounts)||[],s=(d=F.state.activeCaipNetwork)==null?void 0:d.id,o=i.find(h=>{const{chainId:f}=bs.parseCaipAddress(h);return f===(s==null?void 0:s.toString())})||i[0];if(o){const h=bs.validateCaipAddress(o),{chainId:f,address:g}=bs.parseCaipAddress(h);if(kt.setProviderId(r,Xt.CONNECTOR_TYPE_WALLET_CONNECT),this.caipNetworks&&F.state.activeCaipNetwork&&(n==null?void 0:n.namespace)!==_e.CHAIN.EVM){const p=n==null?void 0:n.getWalletConnectProvider({caipNetworks:this.getCaipNetworks(),provider:this.universalProvider,activeCaipNetwork:F.state.activeCaipNetwork});kt.setProvider(r,p)}else kt.setProvider(r,this.universalProvider);ge.setConnectorId(_e.CONNECTOR_ID.WALLET_CONNECT,r),Le.addConnectedNamespace(r),this.syncWalletConnectAccounts(r),await this.syncAccount({address:g,chainId:f,chainNamespace:r})}else this.setStatus("disconnected",r);this.syncConnectedWalletInfo(r),await F.setApprovedCaipNetworksData(r)});await Promise.all(e)}syncWalletConnectAccounts(e){var n,i,s,o,a;const r=(a=(o=(s=(i=(n=this.universalProvider)==null?void 0:n.session)==null?void 0:i.namespaces)==null?void 0:s[e])==null?void 0:o.accounts)==null?void 0:a.map(c=>{const{address:u}=bs.parseCaipAddress(c);return u}).filter((c,u,l)=>l.indexOf(c)===u);r&&this.setAllAccounts(r.map(c=>ue.createAccount(e,c,e==="bip122"?"payment":"eoa")),e)}syncProvider({type:e,provider:r,id:n,chainNamespace:i}){kt.setProviderId(i,e),kt.setProvider(i,r),ge.setConnectorId(n,i)}async syncAllAccounts(e){const r=ge.getConnectorId(e);if(!r)return;const n=this.getAdapter(e),i=await(n==null?void 0:n.getAccounts({namespace:e,id:r}));i&&i.accounts.length>0&&this.setAllAccounts(i.accounts,e)}async syncAccount(e){var d,h;const r=e.chainNamespace===F.state.activeChain,n=F.getCaipNetworkByNamespace(e.chainNamespace,e.chainId),{address:i,chainId:s,chainNamespace:o}=e,{chainId:a}=Le.getActiveNetworkProps(),c=s||a,u=((d=F.state.activeCaipNetwork)==null?void 0:d.name)===_e.UNSUPPORTED_NETWORK_NAME,l=F.getNetworkProp("supportsAllNetworks",o);if(this.setStatus("connected",o),!(u&&!l)&&c){let f=this.getCaipNetworks().find(m=>m.id.toString()===c.toString()),g=this.getCaipNetworks().find(m=>m.chainNamespace===o);if(!l&&!f&&!g){const m=this.getApprovedCaipNetworkIds()||[],b=m.find(E=>{var w;return((w=bs.parseCaipNetworkId(E))==null?void 0:w.chainId)===c.toString()}),v=m.find(E=>{var w;return((w=bs.parseCaipNetworkId(E))==null?void 0:w.chainNamespace)===o});f=this.getCaipNetworks().find(E=>E.caipNetworkId===b),g=this.getCaipNetworks().find(E=>E.caipNetworkId===v||"deprecatedCaipNetworkId"in E&&E.deprecatedCaipNetworkId===v)}const p=f||g;(p==null?void 0:p.chainNamespace)===F.state.activeChain?oe.state.enableNetworkSwitch&&!oe.state.allowUnsupportedChain&&((h=F.state.activeCaipNetwork)==null?void 0:h.name)===_e.UNSUPPORTED_NETWORK_NAME?F.showUnsupportedChainUI():this.setCaipNetwork(p):r||n&&this.setCaipNetworkOfNamespace(n,o),this.syncConnectedWalletInfo(o),aA.isLowerCaseMatch(i,re.state.address)||this.syncAccountInfo(i,p==null?void 0:p.id,o),r?await this.syncBalance({address:i,chainId:p==null?void 0:p.id,chainNamespace:o}):await this.syncBalance({address:i,chainId:n==null?void 0:n.id,chainNamespace:o})}}async syncAccountInfo(e,r,n){const i=this.getCaipAddress(n),s=r||(i==null?void 0:i.split(":")[1]);if(!s)return;const o=`${n}:${s}:${e}`;this.setCaipAddress(o,n),await this.syncIdentity({address:e,chainId:s,chainNamespace:n})}async syncReownName(e,r){try{const n=await this.getReownName(e);if(n[0]){const i=n[0];this.setProfileName(i.name,r)}else this.setProfileName(null,r)}catch{this.setProfileName(null,r)}}syncConnectedWalletInfo(e){var i;const r=ge.getConnectorId(e),n=kt.getProviderId(e);if(n===Xt.CONNECTOR_TYPE_ANNOUNCED||n===Xt.CONNECTOR_TYPE_INJECTED){if(r){const s=this.getConnectors().find(o=>o.id===r);if(s){const{info:o,name:a,imageUrl:c}=s,u=c||this.getConnectorImage(s);this.setConnectedWalletInfo({name:a,icon:u,...o},e)}}}else if(n===Xt.CONNECTOR_TYPE_WALLET_CONNECT){const s=kt.getProvider(e);s!=null&&s.session&&this.setConnectedWalletInfo({...s.session.peer.metadata,name:s.session.peer.metadata.name,icon:(i=s.session.peer.metadata.icons)==null?void 0:i[0]},e)}else if(r&&r===_e.CONNECTOR_ID.COINBASE){const s=this.getConnectors().find(o=>o.id===_e.CONNECTOR_ID.COINBASE);this.setConnectedWalletInfo({name:"Coinbase Wallet",icon:this.getConnectorImage(s)},e)}}async syncBalance(e){!AV.getNetworksByNamespace(this.getCaipNetworks(),e.chainNamespace).find(n=>{var i;return n.id.toString()===((i=e.chainId)==null?void 0:i.toString())})||!e.chainId||await this.updateNativeBalance(e.address,e.chainId,e.chainNamespace)}async ready(){await this.readyPromise}async updateNativeBalance(e,r,n){const i=this.getAdapter(n),s=F.getCaipNetworkByNamespace(n,r);if(i){const o=await i.getBalance({address:e,chainId:r,caipNetwork:s,tokens:this.options.tokens});return this.setBalance(o.balance,o.symbol,n),o}}async initializeUniversalAdapter(){var n,i,s,o,a,c,u,l,d,h;const e=Eve.createLogger((f,...g)=>{f&&this.handleAlertError(f),console.error(...g)}),r={projectId:(n=this.options)==null?void 0:n.projectId,metadata:{name:(i=this.options)!=null&&i.metadata?(s=this.options)==null?void 0:s.metadata.name:"",description:(o=this.options)!=null&&o.metadata?(a=this.options)==null?void 0:a.metadata.description:"",url:(c=this.options)!=null&&c.metadata?(u=this.options)==null?void 0:u.metadata.url:"",icons:(l=this.options)!=null&&l.metadata?(d=this.options)==null?void 0:d.metadata.icons:[""]},logger:e};oe.setManualWCControl(!!((h=this.options)!=null&&h.manualWCControl)),this.universalProvider=this.options.universalProvider??await yve.init(r),this.listenWalletConnect()}listenWalletConnect(){this.universalProvider&&(this.universalProvider.on("display_uri",e=>{xe.setUri(e)}),this.universalProvider.on("connect",xe.finalizeWcConnection),this.universalProvider.on("disconnect",()=>{this.chainNamespaces.forEach(e=>{this.resetAccount(e)}),xe.resetWcConnection()}),this.universalProvider.on("chainChanged",e=>{const r=this.getCaipNetworks().find(i=>i.id==e),n=this.getCaipNetwork();if(!r){this.setUnsupportedNetwork(e);return}(n==null?void 0:n.id)!==(r==null?void 0:r.id)&&this.setCaipNetwork(r)}),this.universalProvider.on("session_event",e=>{if(tC.isSessionEventData(e)){const{name:r,data:n}=e.params.event;r==="accountsChanged"&&Array.isArray(n)&&ue.isCaipAddress(n[0])&&this.syncAccount(bs.parseCaipAddress(n[0]))}}))}createUniversalProvider(){var e;return!this.universalProviderInitPromise&&ue.isClient()&&((e=this.options)!=null&&e.projectId)&&(this.universalProviderInitPromise=this.initializeUniversalAdapter()),this.universalProviderInitPromise}async getUniversalProvider(){if(!this.universalProvider)try{await this.createUniversalProvider()}catch(e){Re.sendEvent({type:"error",event:"INTERNAL_SDK_ERROR",properties:{errorType:"UniversalProviderInitError",errorMessage:e instanceof Error?e.message:"Unknown",uncaught:!1}}),console.error("AppKit:getUniversalProvider - Cannot create provider",e)}return this.universalProvider}handleAlertError(e){const r=Object.entries(Do.UniversalProviderErrors).find(([,{message:a}])=>e.message.includes(a)),[n,i]=r??[],{message:s,alertErrorKey:o}=i??{};if(n&&s&&!this.reportedAlertErrors[n]){const a=Do.ALERT_ERRORS[o];a&&(Fn.open(a,"error"),this.reportedAlertErrors[n]=!0)}}getAdapter(e){var r;if(e)return(r=this.chainAdapters)==null?void 0:r[e]}createAdapter(e){var i;if(!e)return;const r=e.namespace;if(!r)return;this.createClients();const n=e;n.namespace=r,n.construct({namespace:r,projectId:(i=this.options)==null?void 0:i.projectId,networks:this.getCaipNetworks()}),this.chainNamespaces.includes(r)||this.chainNamespaces.push(r),this.chainAdapters&&(this.chainAdapters[r]=n)}async open(e){if(await this.injectModalUi(),e!=null&&e.uri&&xe.setUri(e.uri),e!=null&&e.arguments)switch(e==null?void 0:e.view){case"Swap":return We.open({...e,data:{swap:e.arguments}})}return We.open(e)}async close(){await this.injectModalUi(),We.close()}setLoading(e,r){We.setLoading(e,r)}async disconnect(e){await xe.disconnect(e)}getSIWX(){return oe.state.siwx}getError(){return""}getChainId(){var e;return(e=F.state.activeCaipNetwork)==null?void 0:e.id}async switchNetwork(e){const r=this.getCaipNetworks().find(n=>n.id===e.id);if(!r){Fn.open(Do.ALERT_ERRORS.SWITCH_NETWORK_NOT_FOUND,"error");return}await F.switchActiveNetwork(r)}getWalletProvider(){return F.state.activeChain?kt.state.providers[F.state.activeChain]:null}getWalletProviderType(){return kt.getProviderId(F.state.activeChain)}subscribeProviders(e){return kt.subscribeProviders(e)}getThemeMode(){return ar.state.themeMode}getThemeVariables(){return ar.state.themeVariables}setThemeMode(e){ar.setThemeMode(e),MZ(ar.state.themeMode)}setTermsConditionsUrl(e){oe.setTermsConditionsUrl(e)}setPrivacyPolicyUrl(e){oe.setPrivacyPolicyUrl(e)}setThemeVariables(e){ar.setThemeVariables(e),d_e(ar.state.themeVariables)}subscribeTheme(e){return ar.subscribe(e)}getWalletInfo(){return re.state.connectedWalletInfo}getAccount(e){var o;const r=ge.getAuthConnector(e),n=F.getAccountData(e),i=F.state.activeChain,s=Le.getConnectedConnectorId(e||i);if(n)return{allAccounts:n.allAccounts,caipAddress:n.caipAddress,address:ue.getPlainAddress(n.caipAddress),isConnected:!!n.caipAddress,status:n.status,embeddedWalletInfo:r&&s===_e.CONNECTOR_ID.AUTH?{user:n.user?{...n.user,username:Le.getConnectedSocialUsername()}:void 0,authProvider:n.socialProvider||"email",accountType:(o=n.preferredAccountTypes)==null?void 0:o[e||i],isSmartAccountDeployed:!!n.smartAccountDeployed}:void 0}}subscribeAccount(e,r){const n=()=>{const i=this.getAccount(r);i&&e(i)};r?F.subscribeChainProp("accountState",n,r):F.subscribe(n),ge.subscribe(n)}subscribeNetwork(e){return F.subscribe(({activeCaipNetwork:r})=>{e({caipNetwork:r,chainId:r==null?void 0:r.id,caipNetworkId:r==null?void 0:r.caipNetworkId})})}subscribeWalletInfo(e){return re.subscribeKey("connectedWalletInfo",e)}subscribeShouldUpdateToAddress(e){re.subscribeKey("shouldUpdateToAddress",e)}subscribeCaipNetworkChange(e){F.subscribeKey("activeCaipNetwork",e)}getState(){return Ga.state}subscribeState(e){return Ga.subscribe(e)}showErrorMessage(e){Fe.showError(e)}showSuccessMessage(e){Fe.showSuccess(e)}getEvent(){return{...Re.state}}subscribeEvents(e){return Re.subscribe(e)}replace(e){X.replace(e)}redirect(e){X.push(e)}popTransactionStack(e){X.popTransactionStack(e)}isOpen(){return We.state.open}isTransactionStackEmpty(){return X.state.transactionStack.length===0}static getInstance(){return this.instance}updateFeatures(e){oe.setFeatures(e)}updateRemoteFeatures(e){oe.setRemoteFeatures(e)}updateOptions(e){const n={...oe.state||{},...e};oe.setOptions(n)}setConnectMethodsOrder(e){oe.setConnectMethodsOrder(e)}setWalletFeaturesOrder(e){oe.setWalletFeaturesOrder(e)}setCollapseWallets(e){oe.setCollapseWallets(e)}setSocialsOrder(e){oe.setSocialsOrder(e)}getConnectMethodsOrder(){return Ou.getConnectOrderMethod(oe.state.features,ge.getConnectors())}addNetwork(e,r){if(this.chainAdapters&&!this.chainAdapters[e])throw new Error(`Adapter for namespace ${e} doesn't exist`);const n=this.extendCaipNetwork(r,this.options);this.getCaipNetworks().find(i=>i.id===n.id)||F.addNetwork(n)}removeNetwork(e,r){if(this.chainAdapters&&!this.chainAdapters[e])throw new Error(`Adapter for namespace ${e} doesn't exist`);this.getCaipNetworks().find(i=>i.id===r)&&F.removeNetwork(e,r)}}let Oj=!1;class C_e extends E_e{setupAuthConnectorListeners(e){e.onRpcRequest(r=>{ei.checkIfRequestExists(r)?ei.checkIfRequestIsSafe(r)||this.handleUnsafeRPCRequest():(this.open(),console.error(bt.RPC_METHOD_NOT_ALLOWED_MESSAGE,{method:r.method}),setTimeout(()=>{this.showErrorMessage(bt.RPC_METHOD_NOT_ALLOWED_UI_MESSAGE)},300),e.rejectRpcRequests())}),e.onRpcError(()=>{this.isOpen()&&(this.isTransactionStackEmpty()?this.close():this.popTransactionStack("error"))}),e.onRpcSuccess((r,n)=>{const i=ei.checkIfRequestIsSafe(n),s=re.state.address,o=F.state.activeCaipNetwork;i||(s&&(o!=null&&o.id)&&this.updateNativeBalance(s,o.id,o.chainNamespace),this.isTransactionStackEmpty()?this.close():this.popTransactionStack("success"))}),e.onNotConnected(()=>{const r=F.state.activeChain;ge.getConnectorId(r)===_e.CONNECTOR_ID.AUTH&&(this.setCaipAddress(void 0,r),this.setLoading(!1,r))}),e.onConnect(r=>{var u,l;const n=F.state.activeChain,i=n===_e.CHAIN.EVM?`eip155:${r.chainId}:${r.address}`:`${r.chainId}:${r.address}`,s=oe.state.defaultAccountTypes[n],o=(u=re.state.preferredAccountTypes)==null?void 0:u[n],a=r.preferredAccountType||o||s;aA.isLowerCaseMatch(r.address,re.state.address)||this.syncIdentity({address:r.address,chainId:r.chainId,chainNamespace:n}),this.setCaipAddress(i,n),this.setUser({...re.state.user||{},...r},n),this.setSmartAccountDeployed(!!r.smartAccountDeployed,n),this.setPreferredAccountType(a,n);const c=(l=r.accounts)==null?void 0:l.map(d=>ue.createAccount(n,d.address,d.type||o||s));this.setAllAccounts(c||[ue.createAccount(n,r.address,r.preferredAccountType||a)],n),this.setLoading(!1,n)}),e.onSocialConnected(({userName:r})=>{this.setUser({...re.state.user||{},username:r},F.state.activeChain)}),e.onGetSmartAccountEnabledNetworks(r=>{this.setSmartAccountEnabledNetworks(r,F.state.activeChain)}),e.onSetPreferredAccount(({address:r,type:n})=>{r&&this.setPreferredAccountType(n,F.state.activeChain)})}async syncAuthConnector(e,r){var l,d,h,f;const n=_e.AUTH_CONNECTOR_SUPPORTED_CHAINS.includes(r);if(!n)return;this.setLoading(!0,r);const i=e.getLoginEmailUsed();this.setLoading(i,r),i&&this.setStatus("connecting",r);const s=e.getEmail(),o=e.getUsername();this.setUser({...((l=re.state)==null?void 0:l.user)||{},username:o,email:s},r),this.setupAuthConnectorListeners(e);const{isConnected:a}=await e.isConnected(),c=ar.getSnapshot(),u=oe.getSnapshot();await Promise.all([e.syncDappData({metadata:u.metadata,sdkVersion:u.sdkVersion,projectId:u.projectId,sdkType:u.sdkType}),e.syncTheme({themeMode:c.themeMode,themeVariables:c.themeVariables,w3mThemeVariables:za(c.themeVariables,c.themeMode)})]),await e.getSmartAccountEnabledNetworks(),r&&n&&(a&&((d=this.connectionControllerClient)!=null&&d.connectExternal)?(await((f=this.connectionControllerClient)==null?void 0:f.connectExternal({id:_e.CONNECTOR_ID.AUTH,info:{name:_e.CONNECTOR_ID.AUTH},type:Xt.CONNECTOR_TYPE_AUTH,provider:e,chainId:(h=F.state.activeCaipNetwork)==null?void 0:h.id,chain:r})),this.setStatus("connected",r)):ge.getConnectorId(r)===_e.CONNECTOR_ID.AUTH&&(this.setStatus("disconnected",r),Le.removeConnectedNamespace(r))),this.setLoading(!1,r)}async checkExistingTelegramSocialConnection(e){var r;try{if(!ue.isTelegram())return;const n=Le.getTelegramSocialProvider();if(!n||!ue.isClient())return;const s=new URL(window.location.href).searchParams.get("result_uri");if(!s)return;re.setSocialProvider(n,e),await((r=this.authProvider)==null?void 0:r.init());const o=ge.getAuthConnector();n&&o&&(this.setLoading(!0,e),await xe.connectExternal({id:o.id,type:o.type,socialUri:s},o.chain),Le.setConnectedSocialProvider(n),Le.removeTelegramSocialProvider(),Re.sendEvent({type:"track",event:"SOCIAL_LOGIN_SUCCESS",properties:{provider:n}}))}catch(n){this.setLoading(!1,e),console.error("checkExistingSTelegramocialConnection error",n)}try{const n=new URL(window.location.href);n.searchParams.delete("result_uri"),window.history.replaceState({},document.title,n.toString())}catch(n){console.error("tma social login failed",n)}}createAuthProvider(e){var o,a,c,u;if(!_e.AUTH_CONNECTOR_SUPPORTED_CHAINS.includes(e))return;const n=(o=this.remoteFeatures)==null?void 0:o.email,i=Array.isArray((a=this.remoteFeatures)==null?void 0:a.socials)&&this.remoteFeatures.socials.length>0,s=n||i;!this.authProvider&&((c=this.options)!=null&&c.projectId)&&s&&(this.authProvider=mb.getInstance({projectId:this.options.projectId,enableLogger:this.options.enableAuthLogger,chainId:(u=this.getCaipNetwork(e))==null?void 0:u.caipNetworkId,abortController:Do.EmbeddedWalletAbortController,onTimeout:l=>{l==="iframe_load_failed"?Fn.open(Do.ALERT_ERRORS.IFRAME_LOAD_FAILED,"error"):l==="iframe_request_timeout"?Fn.open(Do.ALERT_ERRORS.IFRAME_REQUEST_TIMEOUT,"error"):l==="unverified_domain"&&Fn.open(Do.ALERT_ERRORS.UNVERIFIED_DOMAIN,"error")}}),Ga.subscribeOpen(l=>{var d;!l&&this.isTransactionStackEmpty()&&((d=this.authProvider)==null||d.rejectRpcRequests())}),this.syncAuthConnector(this.authProvider,e),this.checkExistingTelegramSocialConnection(e))}createAuthProviderForAdapter(e){var r,n,i;this.createAuthProvider(e),this.authProvider&&((i=(n=(r=this.chainAdapters)==null?void 0:r[e])==null?void 0:n.setAuthProvider)==null||i.call(n,this.authProvider))}initControllers(e){super.initControllers(e),this.options.excludeWalletIds&&Ne.initializeExcludedWallets({ids:this.options.excludeWalletIds})}async switchCaipNetwork(e){var o,a;if(!e)return;const r=F.state.activeChain,n=e.chainNamespace,i=this.getAddressByChainNamespace(n);if(n===r&&i){const c=this.getAdapter(n),u=kt.getProvider(n),l=kt.getProviderId(n);await(c==null?void 0:c.switchNetwork({caipNetwork:e,provider:u,providerType:l})),this.setCaipNetwork(e)}else{const u=kt.getProviderId(r)===Xt.CONNECTOR_TYPE_AUTH,l=kt.getProviderId(n),d=l===Xt.CONNECTOR_TYPE_AUTH,h=_e.AUTH_CONNECTOR_SUPPORTED_CHAINS.includes(n);if((u&&l===void 0||d)&&h)try{if(F.state.activeChain=e.chainNamespace,i){const f=this.getAdapter(n);await(f==null?void 0:f.switchNetwork({caipNetwork:e,provider:this.authProvider,providerType:l}))}else await((a=(o=this.connectionControllerClient)==null?void 0:o.connectExternal)==null?void 0:a.call(o,{id:_e.CONNECTOR_ID.AUTH,provider:this.authProvider,chain:n,chainId:e.id,type:Xt.CONNECTOR_TYPE_AUTH,caipNetwork:e}));this.setCaipNetwork(e)}catch{const g=this.getAdapter(n);await(g==null?void 0:g.switchNetwork({caipNetwork:e,provider:this.authProvider,providerType:l}))}else l===Xt.CONNECTOR_TYPE_WALLET_CONNECT?(this.setCaipNetwork(e),this.syncWalletConnectAccount()):(this.setCaipNetwork(e),i&&this.syncAccount({address:i,chainId:e.id,chainNamespace:n}))}}async initialize(e){var r;await super.initialize(e),(r=this.chainNamespaces)==null||r.forEach(n=>{this.createAuthProviderForAdapter(n)}),await this.injectModalUi(),Ga.set({initialized:!0})}async syncIdentity({address:e,chainId:r,chainNamespace:n}){var o;const i=`${n}:${r}`,s=(o=this.caipNetworks)==null?void 0:o.find(a=>a.caipNetworkId===i);if(n!==_e.CHAIN.EVM||s!=null&&s.testnet){this.setProfileName(null,n),this.setProfileImage(null,n);return}try{const{name:a,avatar:c}=await this.fetchIdentity({address:e,caipNetworkId:i});this.setProfileName(a,n),this.setProfileImage(c,n)}catch{await this.syncReownName(e,n),r!==1&&this.setProfileImage(null,n)}}syncConnectedWalletInfo(e){const r=kt.getProviderId(e);if(r===Xt.CONNECTOR_TYPE_AUTH){const n=this.authProvider;if(n){const i=Le.getConnectedSocialProvider()??"email",s=n.getEmail()??n.getUsername();this.setConnectedWalletInfo({name:r,identifier:s,social:i},e)}}else super.syncConnectedWalletInfo(e)}async injectModalUi(){if(ue.isClient()&&!Oj)try{const e={...ct.DEFAULT_FEATURES,...this.options.features},r=this.remoteFeatures;if(await this.loadModalComponents(e,r),ue.isClient()&&!document.querySelector("w3m-modal")){const i=document.createElement("w3m-modal");!oe.state.disableAppend&&!oe.state.enableEmbedded&&document.body.insertAdjacentElement("beforeend",i)}Oj=!0}catch(e){console.error("Error injecting modal UI:",e)}}async loadModalComponents(e,r){if(!ue.isClient())return;const n=[];(r.email||r.socials&&r.socials.length>0)&&n.push(ke(()=>Promise.resolve().then(()=>q6e),void 0)),r.email&&n.push(ke(()=>Promise.resolve().then(()=>eAe),void 0)),r.socials&&n.push(ke(()=>Promise.resolve().then(()=>VAe),void 0)),r.swaps&&r.swaps.length>0&&n.push(ke(()=>Promise.resolve().then(()=>sxe),void 0)),e.send&&n.push(ke(()=>Promise.resolve().then(()=>bxe),void 0)),e.receive&&n.push(ke(()=>Promise.resolve().then(()=>Exe),void 0)),r.onramp&&r.onramp.length>0&&n.push(ke(()=>Promise.resolve().then(()=>h8e),void 0)),r.activity&&n.push(ke(()=>Promise.resolve().then(()=>y8e),void 0)),e.pay&&n.push(ke(()=>Promise.resolve().then(()=>G8e),void 0)),await Promise.all([...n,ke(()=>Promise.resolve().then(()=>yTe),void 0),ke(()=>Promise.resolve().then(()=>kTe),void 0)])}}const A_e="1.7.8";function x_e(t){return new C_e({...t,sdkVersion:ue.generateSdkVersion(t.adapters??[],"html",A_e)})}const S_e="6.13.2";function T_e(t,e,r){const n=e.split("|").map(s=>s.trim());for(let s=0;sPromise.resolve(t[n])))).reduce((n,i,s)=>(n[e[s]]=i,n),{})}function ut(t,e,r){for(let n in e){let i=e[n];const s=r?r[n]:null;s&&T_e(i,s,n),Object.defineProperty(t,n,{enumerable:!0,value:i,writable:!1})}}function Z0(t){if(t==null)return"null";if(Array.isArray(t))return"[ "+t.map(Z0).join(", ")+" ]";if(t instanceof Uint8Array){const e="0123456789abcdef";let r="0x";for(let n=0;n>4],r+=e[t[n]&15];return r}if(typeof t=="object"&&typeof t.toJSON=="function")return Z0(t.toJSON());switch(typeof t){case"boolean":case"symbol":return t.toString();case"bigint":return BigInt(t).toString();case"number":return t.toString();case"string":return JSON.stringify(t);case"object":{const e=Object.keys(t);return e.sort(),"{ "+e.map(r=>`${Z0(r)}: ${Z0(t[r])}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function ti(t,e){return t&&t.code===e}function d7(t){return ti(t,"CALL_EXCEPTION")}function Hr(t,e,r){let n=t;{const s=[];if(r){if("message"in r||"code"in r||"name"in r)throw new Error(`value will overwrite populated values: ${Z0(r)}`);for(const o in r){if(o==="shortMessage")continue;const a=r[o];s.push(o+"="+Z0(a))}}s.push(`code=${e}`),s.push(`version=${S_e}`),s.length&&(t+=" ("+s.join(", ")+")")}let i;switch(e){case"INVALID_ARGUMENT":i=new TypeError(t);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":i=new RangeError(t);break;default:i=new Error(t)}return ut(i,{code:e}),r&&Object.assign(i,r),i.shortMessage==null&&ut(i,{shortMessage:n}),i}function Ae(t,e,r,n){if(!t)throw Hr(e,r,n)}function ee(t,e,r,n){Ae(t,e,"INVALID_ARGUMENT",{argument:r,value:n})}function UZ(t,e,r){r==null&&(r=""),r&&(r=": "+r),Ae(t>=e,"missing arguemnt"+r,"MISSING_ARGUMENT",{count:t,expectedCount:e}),Ae(t<=e,"too many arguments"+r,"UNEXPECTED_ARGUMENT",{count:t,expectedCount:e})}["NFD","NFC","NFKD","NFKC"].reduce((t,e)=>{try{if("test".normalize(e)!=="test")throw new Error("bad");if(e==="NFD"&&"é".normalize("NFD")!=="é")throw new Error("broken");t.push(e)}catch{}return t},[]);function zv(t,e,r){if(r==null&&(r=""),t!==e){let n=r,i="new";r&&(n+=".",i+=" "+r),Ae(!1,`private constructor; use ${n}from* methods`,"UNSUPPORTED_OPERATION",{operation:i})}}function FZ(t,e,r){if(t instanceof Uint8Array)return r?new Uint8Array(t):t;if(typeof t=="string"&&t.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){const n=new Uint8Array((t.length-2)/2);let i=2;for(let s=0;s>4]+Rj[i&15]}return r}function en(t){return"0x"+t.map(e=>Je(e).substring(2)).join("")}function ag(t){return vr(t,!0)?(t.length-2)/2:jt(t).length}function qr(t,e,r){const n=jt(t);return r!=null&&r>n.length&&Ae(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:n,length:n.length,offset:r}),Je(n.slice(e??0,r??n.length))}function HZ(t,e,r){const n=jt(t);Ae(e>=n.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(n),length:e,offset:e+1});const i=new Uint8Array(e);return i.fill(0),r?i.set(n,e-n.length):i.set(n,0),Je(i)}function Wf(t,e){return HZ(t,e,!0)}function I_e(t,e){return HZ(t,e,!1)}const lA=BigInt(0),Mo=BigInt(1),Y0=9007199254740991;function FC(t,e){const r=dA(t,"value"),n=BigInt(Et(e,"width"));if(Ae(r>>n===lA,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:t}),r>>n-Mo){const i=(Mo<=-Y0&&t<=Y0,"overflow",e||"value",t),BigInt(t);case"string":try{if(t==="")throw new Error("empty string");return t[0]==="-"&&t[1]!=="-"?-BigInt(t.substring(1)):BigInt(t)}catch(r){ee(!1,`invalid BigNumberish string: ${r.message}`,e||"value",t)}}ee(!1,"invalid BigNumberish value",e||"value",t)}function dA(t,e){const r=et(t,e);return Ae(r>=lA,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:t}),r}const kj="0123456789abcdef";function hA(t){if(t instanceof Uint8Array){let e="0x0";for(const r of t)e+=kj[r>>4],e+=kj[r&15];return BigInt(e)}return et(t)}function Et(t,e){switch(typeof t){case"bigint":return ee(t>=-Y0&&t<=Y0,"overflow",e||"value",t),Number(t);case"number":return ee(Number.isInteger(t),"underflow",e||"value",t),ee(t>=-Y0&&t<=Y0,"overflow",e||"value",t),t;case"string":try{if(t==="")throw new Error("empty string");return Et(BigInt(t),e)}catch(r){ee(!1,`invalid numeric string: ${r.message}`,e||"value",t)}}ee(!1,"invalid numeric value",e||"value",t)}function P_e(t){return Et(hA(t))}function vd(t,e){let n=dA(t,"value").toString(16);if(e==null)n.length%2&&(n="0"+n);else{const i=Et(e,"width");for(Ae(i*2>=n.length,`value exceeds width (${i} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:t});n.length>6===2;o++)s++;return s}return t==="OVERRUN"?r.length-e-1:0}function $_e(t,e,r,n,i){return t==="OVERLONG"?(ee(typeof i=="number","invalid bad code point for replacement","badCodepoint",i),n.push(i),0):(n.push(65533),WZ(t,e,r))}const j_e=Object.freeze({error:N_e,ignore:WZ,replace:$_e});function B_e(t,e){e==null&&(e=j_e.error);const r=jt(t,"bytes"),n=[];let i=0;for(;i>7===0){n.push(s);continue}let o=null,a=null;if((s&224)===192)o=1,a=127;else if((s&240)===224)o=2,a=2047;else if((s&248)===240)o=3,a=65535;else{(s&192)===128?i+=e("UNEXPECTED_CONTINUE",i-1,r,n):i+=e("BAD_PREFIX",i-1,r,n);continue}if(i-1+o>=r.length){i+=e("OVERRUN",i-1,r,n);continue}let c=s&(1<<8-o-1)-1;for(let u=0;u1114111){i+=e("OUT_OF_RANGE",i-1-o,r,n,c);continue}if(c>=55296&&c<=57343){i+=e("UTF16_SURROGATE",i-1-o,r,n,c);continue}if(c<=a){i+=e("OVERLONG",i-1-o,r,n,c);continue}n.push(c)}}return n}function Za(t,e){ee(typeof t=="string","invalid string value","str",t);let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const s=t.charCodeAt(n);ee(n>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return new Uint8Array(r)}function D_e(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function HC(t,e){return D_e(B_e(t,e))}function VZ(t){async function e(r,n){Ae(n==null||!n.cancelled,"request cancelled before sending","CANCELLED");const i=r.url.split(":")[0].toLowerCase();Ae(i==="http"||i==="https",`unsupported protocol ${i}`,"UNSUPPORTED_OPERATION",{info:{protocol:i},operation:"request"}),Ae(i==="https"||!r.credentials||r.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let s=null;const o=new AbortController,a=setTimeout(()=>{s=Hr("request timeout","TIMEOUT"),o.abort()},r.timeout);n&&n.addListener(()=>{s=Hr("request cancelled","CANCELLED"),o.abort()});const c={method:r.method,headers:new Headers(Array.from(r)),body:r.body||void 0,signal:o.signal};let u;try{u=await fetch(r.url,c)}catch(f){throw clearTimeout(a),s||f}clearTimeout(a);const l={};u.headers.forEach((f,g)=>{l[g.toLowerCase()]=f});const d=await u.arrayBuffer(),h=d==null?null:new Uint8Array(d);return{statusCode:u.status,statusMessage:u.statusText,headers:l,body:h}}return e}const M_e=12,L_e=250;let jj=VZ();const U_e=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),F_e=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let hS=!1;async function GZ(t,e){try{const r=t.match(U_e);if(!r)throw new Error("invalid data");return new gd(200,"OK",{"content-type":r[1]||"text/plain"},r[2]?R_e(r[3]):q_e(r[3]))}catch{return new gd(599,"BAD REQUEST (invalid data: URI)",{},null,new ku(t))}}function KZ(t){async function e(r,n){try{const i=r.match(F_e);if(!i)throw new Error("invalid link");return new ku(`${t}${i[2]}`)}catch{return new gd(599,"BAD REQUEST (invalid IPFS URI)",{},null,new ku(r))}}return e}const v3={data:GZ,ipfs:KZ("https://gateway.ipfs.io/ipfs/")},ZZ=new WeakMap;var sf,Fl;class H_e{constructor(e){me(this,sf);me(this,Fl);Z(this,sf,[]),Z(this,Fl,!1),ZZ.set(e,()=>{if(!H(this,Fl)){Z(this,Fl,!0);for(const r of H(this,sf))setTimeout(()=>{r()},0);Z(this,sf,[])}})}addListener(e){Ae(!H(this,Fl),"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"}),H(this,sf).push(e)}get cancelled(){return H(this,Fl)}checkSignal(){Ae(!this.cancelled,"cancelled","CANCELLED",{})}}sf=new WeakMap,Fl=new WeakMap;function _3(t){if(t==null)throw new Error("missing signal; should not happen");return t.checkSignal(),t}var mg,wg,ko,ru,bg,yg,vn,ps,nu,of,af,cf,Pa,No,Hl,uf,ib;const $6=class $6{constructor(e){me(this,uf);me(this,mg);me(this,wg);me(this,ko);me(this,ru);me(this,bg);me(this,yg);me(this,vn);me(this,ps);me(this,nu);me(this,of);me(this,af);me(this,cf);me(this,Pa);me(this,No);me(this,Hl);Z(this,yg,String(e)),Z(this,mg,!1),Z(this,wg,!0),Z(this,ko,{}),Z(this,ru,""),Z(this,bg,3e5),Z(this,No,{slotInterval:L_e,maxAttempts:M_e}),Z(this,Hl,null)}get url(){return H(this,yg)}set url(e){Z(this,yg,String(e))}get body(){return H(this,vn)==null?null:new Uint8Array(H(this,vn))}set body(e){if(e==null)Z(this,vn,void 0),Z(this,ps,void 0);else if(typeof e=="string")Z(this,vn,Za(e)),Z(this,ps,"text/plain");else if(e instanceof Uint8Array)Z(this,vn,e),Z(this,ps,"application/octet-stream");else if(typeof e=="object")Z(this,vn,Za(JSON.stringify(e))),Z(this,ps,"application/json");else throw new Error("invalid body")}hasBody(){return H(this,vn)!=null}get method(){return H(this,ru)?H(this,ru):this.hasBody()?"POST":"GET"}set method(e){e==null&&(e=""),Z(this,ru,String(e).toUpperCase())}get headers(){const e=Object.assign({},H(this,ko));return H(this,nu)&&(e.authorization=`Basic ${k_e(Za(H(this,nu)))}`),this.allowGzip&&(e["accept-encoding"]="gzip"),e["content-type"]==null&&H(this,ps)&&(e["content-type"]=H(this,ps)),this.body&&(e["content-length"]=String(this.body.length)),e}getHeader(e){return this.headers[e.toLowerCase()]}setHeader(e,r){H(this,ko)[String(e).toLowerCase()]=String(r)}clearHeaders(){Z(this,ko,{})}[Symbol.iterator](){const e=this.headers,r=Object.keys(e);let n=0;return{next:()=>{if(n=0,"timeout must be non-zero","timeout",e),Z(this,bg,e)}get preflightFunc(){return H(this,of)||null}set preflightFunc(e){Z(this,of,e)}get processFunc(){return H(this,af)||null}set processFunc(e){Z(this,af,e)}get retryFunc(){return H(this,cf)||null}set retryFunc(e){Z(this,cf,e)}get getUrlFunc(){return H(this,Hl)||jj}set getUrlFunc(e){Z(this,Hl,e)}toString(){return``}setThrottleParams(e){e.slotInterval!=null&&(H(this,No).slotInterval=e.slotInterval),e.maxAttempts!=null&&(H(this,No).maxAttempts=e.maxAttempts)}send(){return Ae(H(this,Pa)==null,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"}),Z(this,Pa,new H_e(this)),Pe(this,uf,ib).call(this,0,Bj()+this.timeout,0,this,new gd(0,"",{},null,this))}cancel(){Ae(H(this,Pa)!=null,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const e=ZZ.get(this);if(!e)throw new Error("missing signal; should not happen");e()}redirect(e){const r=this.url.split(":")[0].toLowerCase(),n=e.split(":")[0].toLowerCase();Ae(this.method==="GET"&&(r!=="https"||n!=="http")&&e.match(/^https?:/),"unsupported redirect","UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(e)})`});const i=new $6(e);return i.method="GET",i.allowGzip=this.allowGzip,i.timeout=this.timeout,Z(i,ko,Object.assign({},H(this,ko))),H(this,vn)&&Z(i,vn,new Uint8Array(H(this,vn))),Z(i,ps,H(this,ps)),i}clone(){const e=new $6(this.url);return Z(e,ru,H(this,ru)),H(this,vn)&&Z(e,vn,H(this,vn)),Z(e,ps,H(this,ps)),Z(e,ko,Object.assign({},H(this,ko))),Z(e,nu,H(this,nu)),this.allowGzip&&(e.allowGzip=!0),e.timeout=this.timeout,this.allowInsecureAuthentication&&(e.allowInsecureAuthentication=!0),Z(e,of,H(this,of)),Z(e,af,H(this,af)),Z(e,cf,H(this,cf)),Z(e,No,Object.assign({},H(this,No))),Z(e,Hl,H(this,Hl)),e}static lockConfig(){hS=!0}static getGateway(e){return v3[e.toLowerCase()]||null}static registerGateway(e,r){if(e=e.toLowerCase(),e==="http"||e==="https")throw new Error(`cannot intercept ${e}; use registerGetUrl`);if(hS)throw new Error("gateways locked");v3[e]=r}static registerGetUrl(e){if(hS)throw new Error("gateways locked");jj=e}static createGetUrlFunc(e){return VZ()}static createDataGateway(){return GZ}static createIpfsGatewayFunc(e){return KZ(e)}};mg=new WeakMap,wg=new WeakMap,ko=new WeakMap,ru=new WeakMap,bg=new WeakMap,yg=new WeakMap,vn=new WeakMap,ps=new WeakMap,nu=new WeakMap,of=new WeakMap,af=new WeakMap,cf=new WeakMap,Pa=new WeakMap,No=new WeakMap,Hl=new WeakMap,uf=new WeakSet,ib=async function(e,r,n,i,s){var l,d,h;if(e>=H(this,No).maxAttempts)return s.makeServerError("exceeded maximum retry limit");Ae(Bj()<=r,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:i}),n>0&&await z_e(n);let o=this.clone();const a=(o.url.split(":")[0]||"").toLowerCase();if(a in v3){const f=await v3[a](o.url,_3(H(i,Pa)));if(f instanceof gd){let g=f;if(this.processFunc){_3(H(i,Pa));try{g=await this.processFunc(o,g)}catch(p){(p.throttle==null||typeof p.stall!="number")&&g.makeServerError("error in post-processing function",p).assertOk()}}return g}o=f}this.preflightFunc&&(o=await this.preflightFunc(o));const c=await this.getUrlFunc(o,_3(H(i,Pa)));let u=new gd(c.statusCode,c.statusMessage,c.headers,c.body,i);if(u.statusCode===301||u.statusCode===302){try{const f=u.headers.location||"";return Pe(l=o.redirect(f),uf,ib).call(l,e+1,r,0,i,u)}catch{}return u}else if(u.statusCode===429&&(this.retryFunc==null||await this.retryFunc(o,u,e))){const f=u.headers["retry-after"];let g=H(this,No).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return typeof f=="string"&&f.match(/^[1-9][0-9]*$/)&&(g=parseInt(f)),Pe(d=o.clone(),uf,ib).call(d,e+1,r,g,i,u)}if(this.processFunc){_3(H(i,Pa));try{u=await this.processFunc(o,u)}catch(f){(f.throttle==null||typeof f.stall!="number")&&u.makeServerError("error in post-processing function",f).assertOk();let g=H(this,No).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return f.stall>=0&&(g=f.stall),Pe(h=o.clone(),uf,ib).call(h,e+1,r,g,i,u)}}return u};let ku=$6;var uv,lv,dv,gs,vg,lf;const _R=class _R{constructor(e,r,n,i,s){me(this,uv);me(this,lv);me(this,dv);me(this,gs);me(this,vg);me(this,lf);Z(this,uv,e),Z(this,lv,r),Z(this,dv,Object.keys(n).reduce((o,a)=>(o[a.toLowerCase()]=String(n[a]),o),{})),Z(this,gs,i==null?null:new Uint8Array(i)),Z(this,vg,s||null),Z(this,lf,{message:""})}toString(){return``}get statusCode(){return H(this,uv)}get statusMessage(){return H(this,lv)}get headers(){return Object.assign({},H(this,dv))}get body(){return H(this,gs)==null?null:new Uint8Array(H(this,gs))}get bodyText(){try{return H(this,gs)==null?"":HC(H(this,gs))}catch{Ae(!1,"response body is not valid UTF-8 data","UNSUPPORTED_OPERATION",{operation:"bodyText",info:{response:this}})}}get bodyJson(){try{return JSON.parse(this.bodyText)}catch{Ae(!1,"response body is not valid JSON","UNSUPPORTED_OPERATION",{operation:"bodyJson",info:{response:this}})}}[Symbol.iterator](){const e=this.headers,r=Object.keys(e);let n=0;return{next:()=>{if(n=0,"invalid stall timeout","stall",r);const n=new Error(e||"throttling requests");throw ut(n,{stall:r,throttle:!0}),n}getHeader(e){return this.headers[e.toLowerCase()]}hasBody(){return H(this,gs)!=null}get request(){return H(this,vg)}ok(){return H(this,lf).message===""&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok())return;let{message:e,error:r}=H(this,lf);e===""&&(e=`server response ${this.statusCode} ${this.statusMessage}`);let n=null;this.request&&(n=this.request.url);let i=null;try{H(this,gs)&&(i=HC(H(this,gs)))}catch{}Ae(!1,e,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:r,info:{requestUrl:n,responseBody:i,responseStatus:`${this.statusCode} ${this.statusMessage}`}})}};uv=new WeakMap,lv=new WeakMap,dv=new WeakMap,gs=new WeakMap,vg=new WeakMap,lf=new WeakMap;let gd=_R;function Bj(){return new Date().getTime()}function q_e(t){return Za(t.replace(/%([0-9a-f][0-9a-f])/gi,(e,r)=>String.fromCharCode(parseInt(r,16))))}function z_e(t){return new Promise(e=>setTimeout(e,t))}const W_e=BigInt(-1),Io=BigInt(0),Q0=BigInt(1),V_e=BigInt(5),l0={};let cg="0000";for(;cg.length<80;)cg+=cg;function fh(t){let e=cg;for(;e.length=-i&&tIo?t=FC(ef(t,n),n):t=-FC(ef(-t,n),n)}else{const i=Q0<=0&&ts[a]==null?u:(ee(typeof s[a]===c,"invalid fixed format ("+a+" not "+c+")","format."+a,s[a]),s[a]);e=o("signed","boolean",e),r=o("width","number",r),n=o("decimals","number",n)}ee(r%8===0,"invalid FixedNumber width (not byte aligned)","format.width",r),ee(n<=80,"invalid FixedNumber decimals (too large)","format.decimals",n);const i=(e?"":"u")+"fixed"+String(r)+"x"+String(n);return{signed:e,width:r,decimals:n,name:i}}function G_e(t,e){let r="";t0?n*=fh(i):i<0&&(r*=fh(-i)),rn?1:0}eq(e){return this.cmp(e)===0}lt(e){return this.cmp(e)<0}lte(e){return this.cmp(e)<=0}gt(e){return this.cmp(e)>0}gte(e){return this.cmp(e)>=0}floor(){let e=H(this,ir);return H(this,ir)Io&&(e+=H(this,pi)-Q0),e=H(this,ir)/H(this,pi)*H(this,pi),Pe(this,Zt,Gc).call(this,e,"ceiling")}round(e){if(e==null&&(e=0),e>=this.decimals)return this;const r=this.decimals-e,n=V_e*fh(r-1);let i=this.value+n;const s=fh(r);return i=i/s*s,Z1(i,H(this,$o),"round"),new Dl(l0,i,H(this,$o))}isZero(){return H(this,ir)===Io}isNegative(){return H(this,ir)0){const c=fh(a);Ae(o%c===Io,"value loses precision for format","NUMERIC_FAULT",{operation:"fromValue",fault:"underflow",value:e}),o/=c}else a<0&&(o*=fh(-a));return Z1(o,s,"fromValue"),new Dl(l0,o,s)}static fromString(e,r){const n=e.match(/^(-?)([0-9]*)\.?([0-9]*)$/);ee(n&&n[2].length+n[3].length>0,"invalid FixedNumber string value","value",e);const i=fS(r);let s=n[2]||"0",o=n[3]||"";for(;o.length{Ae(n<=t.length,"data short segment too short","BUFFER_OVERRUN",{buffer:t,length:t.length,offset:n})};if(t[e]>=248){const n=t[e]-247;r(e+1+n);const i=Dj(t,e+1,n);return r(e+1+n+i),Mj(t,e,e+1+n,n+i)}else if(t[e]>=192){const n=t[e]-192;return r(e+1+n),Mj(t,e,e+1,n)}else if(t[e]>=184){const n=t[e]-183;r(e+1+n);const i=Dj(t,e+1,n);r(e+1+n+i);const s=Je(t.slice(e+1+n,e+1+n+i));return{consumed:1+n+i,result:s}}else if(t[e]>=128){const n=t[e]-128;r(e+1+n);const i=Je(t.slice(e+1,e+1+n));return{consumed:1+n,result:i}}return{consumed:1,result:K_e(t[e])}}function fA(t){const e=jt(t,"data"),r=YZ(e,0);return ee(r.consumed===e.length,"unexpected junk after rlp payload","data",t),r.result}function Lj(t){const e=[];for(;t;)e.unshift(t&255),t>>=8;return e}function JZ(t){if(Array.isArray(t)){let n=[];if(t.forEach(function(s){n=n.concat(JZ(s))}),n.length<=55)return n.unshift(192+n.length),n;const i=Lj(n.length);return i.unshift(247+i.length),i.concat(n)}const e=Array.prototype.slice.call(jt(t,"object"));if(e.length===1&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const r=Lj(e.length);return r.unshift(183+r.length),r.concat(e)}const Uj="0123456789abcdef";function Vf(t){let e="0x";for(const r of JZ(t))e+=Uj[r>>4],e+=Uj[r&15];return e}const QZ=["wei","kwei","mwei","gwei","szabo","finney","ether"];function XZ(t,e){let r=18;if(typeof e=="string"){const n=QZ.indexOf(e);ee(n>=0,"invalid unit","unit",e),r=3*n}else e!=null&&(r=Et(e,"unit"));return qC.fromValue(t,r,{decimals:r,width:512}).toString()}function Z_e(t,e){ee(typeof t=="string","value must be a string","value",t);let r=18;if(typeof e=="string"){const n=QZ.indexOf(e);ee(n>=0,"invalid unit","unit",e),r=3*n}else e!=null&&(r=Et(e,"unit"));return qC.fromString(t,{decimals:r,width:512}).value}function Y_e(t){return XZ(t,18)}const yi=32,eP=new Uint8Array(yi),J_e=["then"],E3={},eY=new WeakMap;function qh(t){return eY.get(t)}function Fj(t,e){eY.set(t,e)}function Y1(t,e){const r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);throw r.error=e,r}function tP(t,e,r){return t.indexOf(null)>=0?e.map((n,i)=>n instanceof Em?tP(qh(n),n,r):n):t.reduce((n,i,s)=>{let o=e.getValue(i);return i in n||(r&&o instanceof Em&&(o=tP(qh(o),o,r)),n[i]=o),n},{})}var _g;const eg=class eg extends Array{constructor(...r){const n=r[0];let i=r[1],s=(r[2]||[]).slice(),o=!0;n!==E3&&(i=r,s=[],o=!1);super(i.length);me(this,_g);i.forEach((u,l)=>{this[l]=u});const a=s.reduce((u,l)=>(typeof l=="string"&&u.set(l,(u.get(l)||0)+1),u),new Map);if(Fj(this,Object.freeze(i.map((u,l)=>{const d=s[l];return d!=null&&a.get(d)===1?d:null}))),Z(this,_g,[]),H(this,_g)==null&&H(this,_g),!o)return;Object.freeze(this);const c=new Proxy(this,{get:(u,l,d)=>{if(typeof l=="string"){if(l.match(/^[0-9]+$/)){const f=Et(l,"%index");if(f<0||f>=this.length)throw new RangeError("out of result range");const g=u[f];return g instanceof Error&&Y1(`index ${f}`,g),g}if(J_e.indexOf(l)>=0)return Reflect.get(u,l,d);const h=u[l];if(h instanceof Function)return function(...f){return h.apply(this===d?u:this,f)};if(!(l in u))return u.getValue.apply(this===d?u:this,[l])}return Reflect.get(u,l,d)}});return Fj(c,qh(this)),c}toArray(r){const n=[];return this.forEach((i,s)=>{i instanceof Error&&Y1(`index ${s}`,i),r&&i instanceof eg&&(i=i.toArray(r)),n.push(i)}),n}toObject(r){const n=qh(this);return n.reduce((i,s,o)=>(Ae(s!=null,`value at index ${o} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),tP(n,this,r)),{})}slice(r,n){r==null&&(r=0),r<0&&(r+=this.length,r<0&&(r=0)),n==null&&(n=this.length),n<0&&(n+=this.length,n<0&&(n=0)),n>this.length&&(n=this.length);const i=qh(this),s=[],o=[];for(let a=r;a{H(this,iu)[e]=Hj(r)}}}iu=new WeakMap,df=new WeakMap,Eg=new WeakSet,rC=function(e){return H(this,iu).push(e),Z(this,df,H(this,df)+e.length),e.length};var Hi,ms,hf,ff,ql,gp,iP,tY;const ER=class ER{constructor(e,r,n){me(this,gp);ce(this,"allowLoose");me(this,Hi);me(this,ms);me(this,hf);me(this,ff);me(this,ql);ut(this,{allowLoose:!!r}),Z(this,Hi,wi(e)),Z(this,hf,0),Z(this,ff,null),Z(this,ql,n??1024),Z(this,ms,0)}get data(){return Je(H(this,Hi))}get dataLength(){return H(this,Hi).length}get consumed(){return H(this,ms)}get bytes(){return new Uint8Array(H(this,Hi))}subReader(e){const r=new ER(H(this,Hi).slice(H(this,ms)+e),this.allowLoose,H(this,ql));return Z(r,ff,this),r}readBytes(e,r){let n=Pe(this,gp,tY).call(this,0,e,!!r);return Pe(this,gp,iP).call(this,e),Z(this,ms,H(this,ms)+n.length),n.slice(0,e)}readValue(){return hA(this.readBytes(yi))}readIndex(){return P_e(this.readBytes(yi))}};Hi=new WeakMap,ms=new WeakMap,hf=new WeakMap,ff=new WeakMap,ql=new WeakMap,gp=new WeakSet,iP=function(e){var r;if(H(this,ff))return Pe(r=H(this,ff),gp,iP).call(r,e);Z(this,hf,H(this,hf)+e),Ae(H(this,ql)<1||H(this,hf)<=H(this,ql)*this.dataLength,`compressed ABI data exceeds inflation ratio of ${H(this,ql)} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:wi(H(this,Hi)),offset:H(this,ms),length:e,info:{bytesRead:H(this,hf),dataLength:this.dataLength}})},tY=function(e,r,n){let i=Math.ceil(r/yi)*yi;return H(this,ms)+i>H(this,Hi).length&&(this.allowLoose&&n&&H(this,ms)+r<=H(this,Hi).length?i=r:Ae(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:wi(H(this,Hi)),length:H(this,Hi).length,offset:H(this,ms)+i})),H(this,Hi).slice(H(this,ms),H(this,ms)+i)};let nP=ER;function zC(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function f7(t,...e){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function Q_e(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");zC(t.outputLen),zC(t.blockLen)}function Cm(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function rY(t,e){f7(t);const r=e.outputLen;if(t.lengtht instanceof Uint8Array,X_e=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),gS=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),_a=(t,e)=>t<<32-e|t>>>e,eEe=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!eEe)throw new Error("Non little-endian hardware is not supported");function tEe(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function pA(t){if(typeof t=="string"&&(t=tEe(t)),!nY(t))throw new Error(`expected Uint8Array, got ${typeof t}`);return t}function rEe(...t){const e=new Uint8Array(t.reduce((n,i)=>n+i.length,0));let r=0;return t.forEach(n=>{if(!nY(n))throw new Error("Uint8Array expected");e.set(n,r),r+=n.length}),e}let p7=class{clone(){return this._cloneInto()}};function g7(t){const e=n=>t().update(pA(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function nEe(t=32){if(pS&&typeof pS.getRandomValues=="function")return pS.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}class iY extends p7{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,Q_e(e);const n=pA(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(n.length>i?e.create().update(n).digest():n);for(let o=0;onew iY(t,e).update(r).digest();sY.create=(t,e)=>new iY(t,e);function iEe(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),c=n?4:0,u=n?0:4;t.setUint32(e+c,o,n),t.setUint32(e+u,a,n)}class oY extends p7{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=gS(this.buffer)}update(e){Cm(this);const{view:r,buffer:n,blockLen:i}=this;e=pA(e);const s=e.length;for(let o=0;oi-o&&(this.process(n,0),o=0);for(let d=o;dl.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;dt&e^~t&r,oEe=(t,e,r)=>t&e^t&r^e&r,aEe=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),vl=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),_l=new Uint32Array(64);class cEe extends oY{constructor(){super(64,32,8,!1),this.A=vl[0]|0,this.B=vl[1]|0,this.C=vl[2]|0,this.D=vl[3]|0,this.E=vl[4]|0,this.F=vl[5]|0,this.G=vl[6]|0,this.H=vl[7]|0}get(){const{A:e,B:r,C:n,D:i,E:s,F:o,G:a,H:c}=this;return[e,r,n,i,s,o,a,c]}set(e,r,n,i,s,o,a,c){this.A=e|0,this.B=r|0,this.C=n|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=a|0,this.H=c|0}process(e,r){for(let d=0;d<16;d++,r+=4)_l[d]=e.getUint32(r,!1);for(let d=16;d<64;d++){const h=_l[d-15],f=_l[d-2],g=_a(h,7)^_a(h,18)^h>>>3,p=_a(f,17)^_a(f,19)^f>>>10;_l[d]=p+_l[d-7]+g+_l[d-16]|0}let{A:n,B:i,C:s,D:o,E:a,F:c,G:u,H:l}=this;for(let d=0;d<64;d++){const h=_a(a,6)^_a(a,11)^_a(a,25),f=l+h+sEe(a,c,u)+aEe[d]+_l[d]|0,p=(_a(n,2)^_a(n,13)^_a(n,22))+oEe(n,i,s)|0;l=u,u=c,c=a,a=o+f|0,o=s,s=i,i=n,n=f+p|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(n,i,s,o,a,c,u,l)}roundClean(){_l.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const aY=g7(()=>new cEe),C3=BigInt(2**32-1),sP=BigInt(32);function cY(t,e=!1){return e?{h:Number(t&C3),l:Number(t>>sP&C3)}:{h:Number(t>>sP&C3)|0,l:Number(t&C3)|0}}function uY(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;iBigInt(t>>>0)<>>0),lEe=(t,e,r)=>t>>>r,dEe=(t,e,r)=>t<<32-r|e>>>r,hEe=(t,e,r)=>t>>>r|e<<32-r,fEe=(t,e,r)=>t<<32-r|e>>>r,pEe=(t,e,r)=>t<<64-r|e>>>r-32,gEe=(t,e,r)=>t>>>r-32|e<<64-r,mEe=(t,e)=>e,wEe=(t,e)=>t,lY=(t,e,r)=>t<>>32-r,dY=(t,e,r)=>e<>>32-r,hY=(t,e,r)=>e<>>64-r,fY=(t,e,r)=>t<>>64-r;function bEe(t,e,r,n){const i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:i|0}}const yEe=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),vEe=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,_Ee=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),EEe=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0,CEe=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0),AEe=(t,e,r,n,i,s)=>e+r+n+i+s+(t/2**32|0)|0,xt={fromBig:cY,split:uY,toBig:uEe,shrSH:lEe,shrSL:dEe,rotrSH:hEe,rotrSL:fEe,rotrBH:pEe,rotrBL:gEe,rotr32H:mEe,rotr32L:wEe,rotlSH:lY,rotlSL:dY,rotlBH:hY,rotlBL:fY,add:bEe,add3L:yEe,add3H:vEe,add4L:_Ee,add4H:EEe,add5H:AEe,add5L:CEe},[xEe,SEe]=xt.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))),El=new Uint32Array(80),Cl=new Uint32Array(80);class TEe extends oY{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:r,Bh:n,Bl:i,Ch:s,Cl:o,Dh:a,Dl:c,Eh:u,El:l,Fh:d,Fl:h,Gh:f,Gl:g,Hh:p,Hl:m}=this;return[e,r,n,i,s,o,a,c,u,l,d,h,f,g,p,m]}set(e,r,n,i,s,o,a,c,u,l,d,h,f,g,p,m){this.Ah=e|0,this.Al=r|0,this.Bh=n|0,this.Bl=i|0,this.Ch=s|0,this.Cl=o|0,this.Dh=a|0,this.Dl=c|0,this.Eh=u|0,this.El=l|0,this.Fh=d|0,this.Fl=h|0,this.Gh=f|0,this.Gl=g|0,this.Hh=p|0,this.Hl=m|0}process(e,r){for(let E=0;E<16;E++,r+=4)El[E]=e.getUint32(r),Cl[E]=e.getUint32(r+=4);for(let E=16;E<80;E++){const w=El[E-15]|0,C=Cl[E-15]|0,y=xt.rotrSH(w,C,1)^xt.rotrSH(w,C,8)^xt.shrSH(w,C,7),_=xt.rotrSL(w,C,1)^xt.rotrSL(w,C,8)^xt.shrSL(w,C,7),x=El[E-2]|0,A=Cl[E-2]|0,T=xt.rotrSH(x,A,19)^xt.rotrBH(x,A,61)^xt.shrSH(x,A,6),O=xt.rotrSL(x,A,19)^xt.rotrBL(x,A,61)^xt.shrSL(x,A,6),k=xt.add4L(_,O,Cl[E-7],Cl[E-16]),j=xt.add4H(k,y,T,El[E-7],El[E-16]);El[E]=j|0,Cl[E]=k|0}let{Ah:n,Al:i,Bh:s,Bl:o,Ch:a,Cl:c,Dh:u,Dl:l,Eh:d,El:h,Fh:f,Fl:g,Gh:p,Gl:m,Hh:b,Hl:v}=this;for(let E=0;E<80;E++){const w=xt.rotrSH(d,h,14)^xt.rotrSH(d,h,18)^xt.rotrBH(d,h,41),C=xt.rotrSL(d,h,14)^xt.rotrSL(d,h,18)^xt.rotrBL(d,h,41),y=d&f^~d&p,_=h&g^~h&m,x=xt.add5L(v,C,_,SEe[E],Cl[E]),A=xt.add5H(x,b,w,y,xEe[E],El[E]),T=x|0,O=xt.rotrSH(n,i,28)^xt.rotrBH(n,i,34)^xt.rotrBH(n,i,39),k=xt.rotrSL(n,i,28)^xt.rotrBL(n,i,34)^xt.rotrBL(n,i,39),j=n&s^n&a^s&a,N=i&o^i&c^o&c;b=p|0,v=m|0,p=f|0,m=g|0,f=d|0,g=h|0,{h:d,l:h}=xt.add(u|0,l|0,A|0,T|0),u=a|0,l=c|0,a=s|0,c=o|0,s=n|0,o=i|0;const S=xt.add3L(T,k,N);n=xt.add3H(S,A,O,j),i=S|0}({h:n,l:i}=xt.add(this.Ah|0,this.Al|0,n|0,i|0)),{h:s,l:o}=xt.add(this.Bh|0,this.Bl|0,s|0,o|0),{h:a,l:c}=xt.add(this.Ch|0,this.Cl|0,a|0,c|0),{h:u,l}=xt.add(this.Dh|0,this.Dl|0,u|0,l|0),{h:d,l:h}=xt.add(this.Eh|0,this.El|0,d|0,h|0),{h:f,l:g}=xt.add(this.Fh|0,this.Fl|0,f|0,g|0),{h:p,l:m}=xt.add(this.Gh|0,this.Gl|0,p|0,m|0),{h:b,l:v}=xt.add(this.Hh|0,this.Hl|0,b|0,v|0),this.set(n,i,s,o,a,c,u,l,d,h,f,g,p,m,b,v)}roundClean(){El.fill(0),Cl.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const IEe=g7(()=>new TEe);function PEe(){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")}const qj=PEe();qj.crypto||qj.msCrypto;function OEe(t){switch(t){case"sha256":return aY.create();case"sha512":return IEe.create()}ee(!1,"invalid hashing algorithm name","algorithm",t)}const[pY,gY,mY]=[[],[],[]],REe=BigInt(0),J1=BigInt(1),kEe=BigInt(2),NEe=BigInt(7),$Ee=BigInt(256),jEe=BigInt(113);for(let t=0,e=J1,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],pY.push(2*(5*n+r)),gY.push((t+1)*(t+2)/2%64);let i=REe;for(let s=0;s<7;s++)e=(e<>NEe)*jEe)%$Ee,e&kEe&&(i^=J1<<(J1<r>32?hY(t,e,r):lY(t,e,r),Wj=(t,e,r)=>r>32?fY(t,e,r):dY(t,e,r);function MEe(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,u=r[c],l=r[c+1],d=zj(u,l,1)^r[a],h=Wj(u,l,1)^r[a+1];for(let f=0;f<50;f+=10)t[o+f]^=d,t[o+f+1]^=h}let i=t[2],s=t[3];for(let o=0;o<24;o++){const a=gY[o],c=zj(i,s,a),u=Wj(i,s,a),l=pY[o];i=t[l],s=t[l+1],t[l]=c,t[l+1]=u}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)r[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~r[(a+2)%10]&r[(a+4)%10]}t[0]^=BEe[n],t[1]^=DEe[n]}r.fill(0)}class m7 extends p7{constructor(e,r,n,i=!1,s=24){if(super(),this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,zC(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=X_e(this.state)}keccak(){MEe(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){Cm(this);const{blockLen:r,state:n}=this;e=pA(e);const i=e.length;for(let s=0;s=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);e.set(r.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return zC(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(rY(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return e||(e=new m7(r,n,i,o,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=n,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}}const LEe=(t,e,r)=>g7(()=>new m7(e,t,r)),UEe=LEe(1,136,256/8);let wY=!1;const bY=function(t){return UEe(t)};let yY=bY;function un(t){const e=jt(t,"data");return Je(yY(e))}un._=bY;un.lock=function(){wY=!0};un.register=function(t){if(wY)throw new TypeError("keccak256 is locked");yY=t};Object.freeze(un);const vY=function(t){return OEe("sha256").update(t).digest()};let _Y=vY,EY=!1;function a1(t){const e=jt(t,"data");return Je(_Y(e))}a1._=vY;a1.lock=function(){EY=!0};a1.register=function(t){if(EY)throw new Error("sha256 is locked");_Y=t};Object.freeze(a1);Object.freeze(a1);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const CY=BigInt(0),gA=BigInt(1),FEe=BigInt(2),mA=t=>t instanceof Uint8Array,HEe=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Am(t){if(!mA(t))throw new Error("Uint8Array expected");let e="";for(let r=0;rn+i.length,0));let r=0;return t.forEach(n=>{if(!mA(n))throw new Error("Uint8Array expected");e.set(n,r),r+=n.length}),e}function zEe(t,e){if(t.length!==e.length)return!1;for(let r=0;rCY;t>>=gA,e+=1);return e}function GEe(t,e){return t>>BigInt(e)&gA}const KEe=(t,e,r)=>t|(r?gA:CY)<(FEe<new Uint8Array(t),Vj=t=>Uint8Array.from(t);function xY(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=mS(t),i=mS(t),s=0;const o=()=>{n.fill(1),i.fill(0),s=0},a=(...d)=>r(i,n,...d),c=(d=mS())=>{i=a(Vj([0]),d),n=a(),d.length!==0&&(i=a(Vj([1]),d),n=a())},u=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let d=0;const h=[];for(;d{o(),c(d);let f;for(;!(f=h(u()));)c();return o(),f}}const ZEe={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||t instanceof Uint8Array,isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function Wv(t,e,r={}){const n=(i,s,o)=>{const a=ZEe[s];if(typeof a!="function")throw new Error(`Invalid validator "${s}", expected function`);const c=t[i];if(!(o&&c===void 0)&&!a(c,t))throw new Error(`Invalid param ${String(i)}=${c} (${typeof c}), expected ${s}`)};for(const[i,s]of Object.entries(e))n(i,s,!1);for(const[i,s]of Object.entries(r))n(i,s,!0);return t}const YEe=Object.freeze(Object.defineProperty({__proto__:null,bitGet:GEe,bitLen:VEe,bitMask:v7,bitSet:KEe,bytesToHex:Am,bytesToNumberBE:Rf,bytesToNumberLE:b7,concatBytes:vy,createHmacDrbg:xY,ensureBytes:Ro,equalBytes:zEe,hexToBytes:xm,hexToNumber:w7,numberToBytesBE:Sm,numberToBytesLE:y7,numberToHexUnpadded:AY,numberToVarBytesBE:qEe,utf8ToBytes:WEe,validateObject:Wv},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Pn=BigInt(0),Qr=BigInt(1),zh=BigInt(2),JEe=BigInt(3),oP=BigInt(4),Gj=BigInt(5),Kj=BigInt(8);BigInt(9);BigInt(16);function Vi(t,e){const r=t%e;return r>=Pn?r:e+r}function QEe(t,e,r){if(r<=Pn||e 0");if(r===Qr)return Pn;let n=Qr;for(;e>Pn;)e&Qr&&(n=n*t%r),t=t*t%r,e>>=Qr;return n}function zs(t,e,r){let n=t;for(;e-- >Pn;)n*=n,n%=r;return n}function aP(t,e){if(t===Pn||e<=Pn)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=Vi(t,e),n=e,i=Pn,s=Qr;for(;r!==Pn;){const a=n/r,c=n%r,u=i-s*a;n=r,r=c,i=s,s=u}if(n!==Qr)throw new Error("invert: does not exist");return Vi(i,e)}function XEe(t){const e=(t-Qr)/zh;let r,n,i;for(r=t-Qr,n=0;r%zh===Pn;r/=zh,n++);for(i=zh;i(n[i]="function",n),e);return Wv(t,r)}function n5e(t,e,r){if(r 0");if(r===Pn)return t.ONE;if(r===Qr)return e;let n=t.ONE,i=e;for(;r>Pn;)r&Qr&&(n=t.mul(n,i)),i=t.sqr(i),r>>=Qr;return n}function i5e(t,e){const r=new Array(e.length),n=e.reduce((s,o,a)=>t.is0(o)?s:(r[a]=s,t.mul(s,o)),t.ONE),i=t.inv(n);return e.reduceRight((s,o,a)=>t.is0(o)?s:(r[a]=t.mul(s,r[a]),t.mul(s,o)),i),r}function SY(t,e){const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function s5e(t,e,r=!1,n={}){if(t<=Pn)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:s}=SY(t,e);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=e5e(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:s,MASK:v7(i),ZERO:Pn,ONE:Qr,create:c=>Vi(c,t),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return Pn<=c&&cc===Pn,isOdd:c=>(c&Qr)===Qr,neg:c=>Vi(-c,t),eql:(c,u)=>c===u,sqr:c=>Vi(c*c,t),add:(c,u)=>Vi(c+u,t),sub:(c,u)=>Vi(c-u,t),mul:(c,u)=>Vi(c*u,t),pow:(c,u)=>n5e(a,c,u),div:(c,u)=>Vi(c*aP(u,t),t),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>aP(c,t),sqrt:n.sqrt||(c=>o(a,c)),invertBatch:c=>i5e(a,c),cmov:(c,u,l)=>l?u:c,toBytes:c=>r?y7(c,s):Sm(c,s),fromBytes:c=>{if(c.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${c.length}`);return r?b7(c):Rf(c)}});return Object.freeze(a)}function TY(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function IY(t){const e=TY(t);return e+Math.ceil(e/2)}function o5e(t,e,r=!1){const n=t.length,i=TY(e),s=IY(e);if(n<16||n1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);const o=r?Rf(t):b7(t),a=Vi(o,e-Qr)+Qr;return r?y7(a,i):Sm(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const a5e=BigInt(0),wS=BigInt(1);function c5e(t,e){const r=(i,s)=>{const o=s.negate();return i?o:s},n=i=>{const s=Math.ceil(e/i)+1,o=2**(i-1);return{windows:s,windowSize:o}};return{constTimeNegate:r,unsafeLadder(i,s){let o=t.ZERO,a=i;for(;s>a5e;)s&wS&&(o=o.add(a)),a=a.double(),s>>=wS;return o},precomputeWindow(i,s){const{windows:o,windowSize:a}=n(s),c=[];let u=i,l=u;for(let d=0;d>=f,m>c&&(m-=h,o+=wS);const b=p,v=p+Math.abs(m)-1,E=g%2!==0,w=m<0;m===0?l=l.add(r(E,s[b])):u=u.add(r(w,s[v]))}return{p:u,f:l}},wNAFCached(i,s,o,a){const c=i._WINDOW_SIZE||1;let u=s.get(i);return u||(u=this.precomputeWindow(i,c),c!==1&&s.set(i,a(u))),this.wNAF(c,u,o)}}}function PY(t){return r5e(t.Fp),Wv(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...SY(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function u5e(t){const e=PY(t);Wv(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:r,Fp:n,a:i}=e;if(r){if(!n.eql(i,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof r!="object"||typeof r.beta!="bigint"||typeof r.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}const{bytesToNumberBE:l5e,hexToBytes:d5e}=YEe,tf={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){const{Err:e}=tf;if(t.length<2||t[0]!==2)throw new e("Invalid signature integer tag");const r=t[1],n=t.subarray(2,r+2);if(!r||n.length!==r)throw new e("Invalid signature integer: wrong length");if(n[0]&128)throw new e("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:l5e(n),l:t.subarray(r+2)}},toSig(t){const{Err:e}=tf,r=typeof t=="string"?d5e(t):t;if(!(r instanceof Uint8Array))throw new Error("ui8a expected");let n=r.length;if(n<2||r[0]!=48)throw new e("Invalid signature tag");if(r[1]!==n-2)throw new e("Invalid signature: incorrect length");const{d:i,l:s}=tf._parseInt(r.subarray(2)),{d:o,l:a}=tf._parseInt(s);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s:o}},hexFromSig(t){const e=u=>Number.parseInt(u[0],16)&8?"00"+u:u,r=u=>{const l=u.toString(16);return l.length&1?`0${l}`:l},n=e(r(t.s)),i=e(r(t.r)),s=n.length/2,o=i.length/2,a=r(s),c=r(o);return`30${r(o+s+4)}02${c}${i}02${a}${n}`}},mu=BigInt(0),to=BigInt(1);BigInt(2);const Zj=BigInt(3);BigInt(4);function h5e(t){const e=u5e(t),{Fp:r}=e,n=e.toBytes||((g,p,m)=>{const b=p.toAffine();return vy(Uint8Array.from([4]),r.toBytes(b.x),r.toBytes(b.y))}),i=e.fromBytes||(g=>{const p=g.subarray(1),m=r.fromBytes(p.subarray(0,r.BYTES)),b=r.fromBytes(p.subarray(r.BYTES,2*r.BYTES));return{x:m,y:b}});function s(g){const{a:p,b:m}=e,b=r.sqr(g),v=r.mul(b,g);return r.add(r.add(v,r.mul(g,p)),m)}if(!r.eql(r.sqr(e.Gy),s(e.Gx)))throw new Error("bad generator point: equation left != right");function o(g){return typeof g=="bigint"&&mur.eql(E,r.ZERO);return v(m)&&v(b)?d.ZERO:new d(m,b,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(p){const m=r.invertBatch(p.map(b=>b.pz));return p.map((b,v)=>b.toAffine(m[v])).map(d.fromAffine)}static fromHex(p){const m=d.fromAffine(i(Ro("pointHex",p)));return m.assertValidity(),m}static fromPrivateKey(p){return d.BASE.multiply(c(p))}_setWindowSize(p){this._WINDOW_SIZE=p,u.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:p,y:m}=this.toAffine();if(!r.isValid(p)||!r.isValid(m))throw new Error("bad point: x or y not FE");const b=r.sqr(m),v=s(p);if(!r.eql(b,v))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:p}=this.toAffine();if(r.isOdd)return!r.isOdd(p);throw new Error("Field doesn't support isOdd")}equals(p){l(p);const{px:m,py:b,pz:v}=this,{px:E,py:w,pz:C}=p,y=r.eql(r.mul(m,C),r.mul(E,v)),_=r.eql(r.mul(b,C),r.mul(w,v));return y&&_}negate(){return new d(this.px,r.neg(this.py),this.pz)}double(){const{a:p,b:m}=e,b=r.mul(m,Zj),{px:v,py:E,pz:w}=this;let C=r.ZERO,y=r.ZERO,_=r.ZERO,x=r.mul(v,v),A=r.mul(E,E),T=r.mul(w,w),O=r.mul(v,E);return O=r.add(O,O),_=r.mul(v,w),_=r.add(_,_),C=r.mul(p,_),y=r.mul(b,T),y=r.add(C,y),C=r.sub(A,y),y=r.add(A,y),y=r.mul(C,y),C=r.mul(O,C),_=r.mul(b,_),T=r.mul(p,T),O=r.sub(x,T),O=r.mul(p,O),O=r.add(O,_),_=r.add(x,x),x=r.add(_,x),x=r.add(x,T),x=r.mul(x,O),y=r.add(y,x),T=r.mul(E,w),T=r.add(T,T),x=r.mul(T,O),C=r.sub(C,x),_=r.mul(T,A),_=r.add(_,_),_=r.add(_,_),new d(C,y,_)}add(p){l(p);const{px:m,py:b,pz:v}=this,{px:E,py:w,pz:C}=p;let y=r.ZERO,_=r.ZERO,x=r.ZERO;const A=e.a,T=r.mul(e.b,Zj);let O=r.mul(m,E),k=r.mul(b,w),j=r.mul(v,C),N=r.add(m,b),S=r.add(E,w);N=r.mul(N,S),S=r.add(O,k),N=r.sub(N,S),S=r.add(m,v);let P=r.add(E,C);return S=r.mul(S,P),P=r.add(O,j),S=r.sub(S,P),P=r.add(b,v),y=r.add(w,C),P=r.mul(P,y),y=r.add(k,j),P=r.sub(P,y),x=r.mul(A,S),y=r.mul(T,j),x=r.add(y,x),y=r.sub(k,x),x=r.add(k,x),_=r.mul(y,x),k=r.add(O,O),k=r.add(k,O),j=r.mul(A,j),S=r.mul(T,S),k=r.add(k,j),j=r.sub(O,j),j=r.mul(A,j),S=r.add(S,j),O=r.mul(k,S),_=r.add(_,O),O=r.mul(P,S),y=r.mul(N,y),y=r.sub(y,O),O=r.mul(N,k),x=r.mul(P,x),x=r.add(x,O),new d(y,_,x)}subtract(p){return this.add(p.negate())}is0(){return this.equals(d.ZERO)}wNAF(p){return f.wNAFCached(this,u,p,m=>{const b=r.invertBatch(m.map(v=>v.pz));return m.map((v,E)=>v.toAffine(b[E])).map(d.fromAffine)})}multiplyUnsafe(p){const m=d.ZERO;if(p===mu)return m;if(a(p),p===to)return this;const{endo:b}=e;if(!b)return f.unsafeLadder(this,p);let{k1neg:v,k1:E,k2neg:w,k2:C}=b.splitScalar(p),y=m,_=m,x=this;for(;E>mu||C>mu;)E&to&&(y=y.add(x)),C&to&&(_=_.add(x)),x=x.double(),E>>=to,C>>=to;return v&&(y=y.negate()),w&&(_=_.negate()),_=new d(r.mul(_.px,b.beta),_.py,_.pz),y.add(_)}multiply(p){a(p);let m=p,b,v;const{endo:E}=e;if(E){const{k1neg:w,k1:C,k2neg:y,k2:_}=E.splitScalar(m);let{p:x,f:A}=this.wNAF(C),{p:T,f:O}=this.wNAF(_);x=f.constTimeNegate(w,x),T=f.constTimeNegate(y,T),T=new d(r.mul(T.px,E.beta),T.py,T.pz),b=x.add(T),v=A.add(O)}else{const{p:w,f:C}=this.wNAF(m);b=w,v=C}return d.normalizeZ([b,v])[0]}multiplyAndAddUnsafe(p,m,b){const v=d.BASE,E=(C,y)=>y===mu||y===to||!C.equals(v)?C.multiplyUnsafe(y):C.multiply(y),w=E(this,m).add(E(p,b));return w.is0()?void 0:w}toAffine(p){const{px:m,py:b,pz:v}=this,E=this.is0();p==null&&(p=E?r.ONE:r.inv(v));const w=r.mul(m,p),C=r.mul(b,p),y=r.mul(v,p);if(E)return{x:r.ZERO,y:r.ZERO};if(!r.eql(y,r.ONE))throw new Error("invZ was invalid");return{x:w,y:C}}isTorsionFree(){const{h:p,isTorsionFree:m}=e;if(p===to)return!0;if(m)return m(d,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:p,clearCofactor:m}=e;return p===to?this:m?m(d,this):this.multiplyUnsafe(e.h)}toRawBytes(p=!0){return this.assertValidity(),n(d,this,p)}toHex(p=!0){return Am(this.toRawBytes(p))}}d.BASE=new d(e.Gx,e.Gy,r.ONE),d.ZERO=new d(r.ZERO,r.ONE,r.ZERO);const h=e.nBitLength,f=c5e(d,e.endo?Math.ceil(h/2):h);return{CURVE:e,ProjectivePoint:d,normPrivateKeyToScalar:c,weierstrassEquation:s,isWithinCurveOrder:o}}function f5e(t){const e=PY(t);return Wv(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function p5e(t){const e=f5e(t),{Fp:r,n}=e,i=r.BYTES+1,s=2*r.BYTES+1;function o(S){return muAm(Sm(S,e.nByteLength));function g(S){const P=n>>to;return S>P}function p(S){return g(S)?a(-S):S}const m=(S,P,I)=>Rf(S.slice(P,I));class b{constructor(P,I,B){this.r=P,this.s=I,this.recovery=B,this.assertValidity()}static fromCompact(P){const I=e.nByteLength;return P=Ro("compactSignature",P,I*2),new b(m(P,0,I),m(P,I,2*I))}static fromDER(P){const{r:I,s:B}=tf.toSig(Ro("DER",P));return new b(I,B)}assertValidity(){if(!h(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!h(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(P){return new b(this.r,this.s,P)}recoverPublicKey(P){const{r:I,s:B,recovery:$}=this,R=_(Ro("msgHash",P));if($==null||![0,1,2,3].includes($))throw new Error("recovery id invalid");const D=$===2||$===3?I+e.n:I;if(D>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const L=($&1)===0?"02":"03",U=u.fromHex(L+f(D)),z=c(D),W=a(-R*z),K=a(B*z),J=u.BASE.multiplyAndAddUnsafe(U,W,K);if(!J)throw new Error("point at infinify");return J.assertValidity(),J}hasHighS(){return g(this.s)}normalizeS(){return this.hasHighS()?new b(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return xm(this.toDERHex())}toDERHex(){return tf.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return xm(this.toCompactHex())}toCompactHex(){return f(this.r)+f(this.s)}}const v={isValidPrivateKey(S){try{return l(S),!0}catch{return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{const S=IY(e.n);return o5e(e.randomBytes(S),e.n)},precompute(S=8,P=u.BASE){return P._setWindowSize(S),P.multiply(BigInt(3)),P}};function E(S,P=!0){return u.fromPrivateKey(S).toRawBytes(P)}function w(S){const P=S instanceof Uint8Array,I=typeof S=="string",B=(P||I)&&S.length;return P?B===i||B===s:I?B===2*i||B===2*s:S instanceof u}function C(S,P,I=!0){if(w(S))throw new Error("first arg must be private key");if(!w(P))throw new Error("second arg must be public key");return u.fromHex(P).multiply(l(S)).toRawBytes(I)}const y=e.bits2int||function(S){const P=Rf(S),I=S.length*8-e.nBitLength;return I>0?P>>BigInt(I):P},_=e.bits2int_modN||function(S){return a(y(S))},x=v7(e.nBitLength);function A(S){if(typeof S!="bigint")throw new Error("bigint expected");if(!(mu<=S&&Sae in I))throw new Error("sign() legacy options not supported");const{hash:B,randomBytes:$}=e;let{lowS:R,prehash:D,extraEntropy:L}=I;R==null&&(R=!0),S=Ro("msgHash",S),D&&(S=Ro("prehashed msgHash",B(S)));const U=_(S),z=l(P),W=[A(z),A(U)];if(L!=null){const ae=L===!0?$(r.BYTES):L;W.push(Ro("extraEntropy",ae))}const K=vy(...W),J=U;function ne(ae){const he=y(ae);if(!h(he))return;const ie=c(he),Ee=u.BASE.multiply(he).toAffine(),pe=a(Ee.x);if(pe===mu)return;const ve=a(ie*a(J+pe*z));if(ve===mu)return;let je=(Ee.x===pe?0:2)|Number(Ee.y&to),rt=ve;return R&&g(ve)&&(rt=p(ve),je^=1),new b(pe,rt,je)}return{seed:K,k2sig:ne}}const O={lowS:e.lowS,prehash:!1},k={lowS:e.lowS,prehash:!1};function j(S,P,I=O){const{seed:B,k2sig:$}=T(S,P,I),R=e;return xY(R.hash.outputLen,R.nByteLength,R.hmac)(B,$)}u.BASE._setWindowSize(8);function N(S,P,I,B=k){var Ee;const $=S;if(P=Ro("msgHash",P),I=Ro("publicKey",I),"strict"in B)throw new Error("options.strict was renamed to lowS");const{lowS:R,prehash:D}=B;let L,U;try{if(typeof $=="string"||$ instanceof Uint8Array)try{L=b.fromDER($)}catch(pe){if(!(pe instanceof tf.Err))throw pe;L=b.fromCompact($)}else if(typeof $=="object"&&typeof $.r=="bigint"&&typeof $.s=="bigint"){const{r:pe,s:ve}=$;L=new b(pe,ve)}else throw new Error("PARSE");U=u.fromHex(I)}catch(pe){if(pe.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(R&&L.hasHighS())return!1;D&&(P=e.hash(P));const{r:z,s:W}=L,K=_(P),J=c(W),ne=a(K*J),ae=a(z*J),he=(Ee=u.BASE.multiplyAndAddUnsafe(U,ne,ae))==null?void 0:Ee.toAffine();return he?a(he.x)===z:!1}return{CURVE:e,getPublicKey:E,getSharedSecret:C,sign:j,verify:N,ProjectivePoint:u,Signature:b,utils:v}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function g5e(t){return{hash:t,hmac:(e,...r)=>sY(t,e,rEe(...r)),randomBytes:nEe}}function m5e(t,e){const r=n=>p5e({...t,...g5e(n)});return Object.freeze({...r(e),create:r})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const OY=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Yj=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),w5e=BigInt(1),cP=BigInt(2),Jj=(t,e)=>(t+e/cP)/e;function b5e(t){const e=OY,r=BigInt(3),n=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),c=BigInt(88),u=t*t*t%e,l=u*u*t%e,d=zs(l,r,e)*l%e,h=zs(d,r,e)*l%e,f=zs(h,cP,e)*u%e,g=zs(f,i,e)*f%e,p=zs(g,s,e)*g%e,m=zs(p,a,e)*p%e,b=zs(m,c,e)*m%e,v=zs(b,a,e)*p%e,E=zs(v,r,e)*l%e,w=zs(E,o,e)*g%e,C=zs(w,n,e)*u%e,y=zs(C,cP,e);if(!uP.eql(uP.sqr(y),t))throw new Error("Cannot find square root");return y}const uP=s5e(OY,void 0,void 0,{sqrt:b5e}),$l=m5e({a:BigInt(0),b:BigInt(7),Fp:uP,n:Yj,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=Yj,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-w5e*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,o=BigInt("0x100000000000000000000000000000000"),a=Jj(s*t,e),c=Jj(-n*t,e);let u=Vi(t-a*r-c*i,e),l=Vi(-a*n-c*s,e);const d=u>o,h=l>o;if(d&&(u=e-u),h&&(l=e-l),u>o||l>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:d,k1:u,k2neg:h,k2:l}}}},aY);BigInt(0);$l.ProjectivePoint;const _y="0x0000000000000000000000000000000000000000",Qj="0x0000000000000000000000000000000000000000000000000000000000000000",Xj=BigInt(0),eB=BigInt(1),tB=BigInt(2),rB=BigInt(27),nB=BigInt(28),A3=BigInt(35),d0={};function iB(t){return Wf(bi(t),32)}var Cg,Ag,xg,pf;const Po=class Po{constructor(e,r,n,i){me(this,Cg);me(this,Ag);me(this,xg);me(this,pf);zv(e,d0,"Signature"),Z(this,Cg,r),Z(this,Ag,n),Z(this,xg,i),Z(this,pf,null)}get r(){return H(this,Cg)}set r(e){ee(ag(e)===32,"invalid r","value",e),Z(this,Cg,Je(e))}get s(){return H(this,Ag)}set s(e){ee(ag(e)===32,"invalid s","value",e);const r=Je(e);ee(parseInt(r.substring(0,3))<8,"non-canonical s","value",r),Z(this,Ag,r)}get v(){return H(this,xg)}set v(e){const r=Et(e,"value");ee(r===27||r===28,"invalid v","v",e),Z(this,xg,r)}get networkV(){return H(this,pf)}get legacyChainId(){const e=this.networkV;return e==null?null:Po.getChainId(e)}get yParity(){return this.v===27?0:1}get yParityAndS(){const e=jt(this.s);return this.yParity&&(e[0]|=128),Je(e)}get compactSerialized(){return en([this.r,this.yParityAndS])}get serialized(){return en([this.r,this.s,this.yParity?"0x1c":"0x1b"])}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){const e=new Po(d0,this.r,this.s,this.v);return this.networkV&&Z(e,pf,this.networkV),e}toJSON(){const e=this.networkV;return{_type:"signature",networkV:e!=null?e.toString():null,r:this.r,s:this.s,v:this.v}}static getChainId(e){const r=et(e,"v");return r==rB||r==nB?Xj:(ee(r>=A3,"invalid EIP-155 v","v",e),(r-A3)/tB)}static getChainIdV(e,r){return et(e)*tB+BigInt(35+r-27)}static getNormalizedV(e){const r=et(e);return r===Xj||r===rB?27:r===eB||r===nB?28:(ee(r>=A3,"invalid v","v",e),r&eB?27:28)}static from(e){function r(u,l){ee(u,l,"signature",e)}if(e==null)return new Po(d0,Qj,Qj,27);if(typeof e=="string"){const u=jt(e,"signature");if(u.length===64){const l=Je(u.slice(0,32)),d=u.slice(32,64),h=d[0]&128?28:27;return d[0]&=127,new Po(d0,l,Je(d),h)}if(u.length===65){const l=Je(u.slice(0,32)),d=u.slice(32,64);r((d[0]&128)===0,"non-canonical s");const h=Po.getNormalizedV(u[64]);return new Po(d0,l,Je(d),h)}r(!1,"invalid raw signature length")}if(e instanceof Po)return e.clone();const n=e.r;r(n!=null,"missing r");const i=iB(n),s=function(u,l){if(u!=null)return iB(u);if(l!=null){r(vr(l,32),"invalid yParityAndS");const d=jt(l);return d[0]&=127,Je(d)}r(!1,"missing s")}(e.s,e.yParityAndS);r((jt(s)[0]&128)==0,"non-canonical s");const{networkV:o,v:a}=function(u,l,d){if(u!=null){const h=et(u);return{networkV:h>=A3?h:void 0,v:Po.getNormalizedV(h)}}if(l!=null)return r(vr(l,32),"invalid yParityAndS"),{v:jt(l)[0]&128?28:27};if(d!=null){switch(Et(d,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}r(!1,"invalid yParity")}r(!1,"missing v")}(e.v,e.yParityAndS,e.yParity),c=new Po(d0,i,s,a);return o&&Z(c,pf,o),r(e.yParity==null||Et(e.yParity,"sig.yParity")===c.yParity,"yParity mismatch"),r(e.yParityAndS==null||e.yParityAndS===c.yParityAndS,"yParityAndS mismatch"),c}};Cg=new WeakMap,Ag=new WeakMap,xg=new WeakMap,pf=new WeakMap;let Wo=Po;var su;const Gh=class Gh{constructor(e){me(this,su);ee(ag(e)===32,"invalid private key","privateKey","[REDACTED]"),Z(this,su,Je(e))}get privateKey(){return H(this,su)}get publicKey(){return Gh.computePublicKey(H(this,su))}get compressedPublicKey(){return Gh.computePublicKey(H(this,su),!0)}sign(e){ee(ag(e)===32,"invalid digest length","digest",e);const r=$l.sign(wi(e),wi(H(this,su)),{lowS:!0});return Wo.from({r:vd(r.r,32),s:vd(r.s,32),v:r.recovery?28:27})}computeSharedSecret(e){const r=Gh.computePublicKey(e);return Je($l.getSharedSecret(wi(H(this,su)),jt(r),!1))}static computePublicKey(e,r){let n=jt(e,"key");if(n.length===32){const s=$l.getPublicKey(n,!!r);return Je(s)}if(n.length===64){const s=new Uint8Array(65);s[0]=4,s.set(n,1),n=s}const i=$l.ProjectivePoint.fromHex(n);return Je(i.toRawBytes(r))}static recoverPublicKey(e,r){ee(ag(e)===32,"invalid digest length","digest",e);const n=Wo.from(r);let i=$l.Signature.fromCompact(wi(en([n.r,n.s])));i=i.addRecoveryBit(n.yParity);const s=i.recoverPublicKey(wi(e));return ee(s!=null,"invalid signautre for digest","signature",r),"0x"+s.toHex(!1)}static addPoints(e,r,n){const i=$l.ProjectivePoint.fromHex(Gh.computePublicKey(e).substring(2)),s=$l.ProjectivePoint.fromHex(Gh.computePublicKey(r).substring(2));return"0x"+i.add(s).toHex(!!n)}};su=new WeakMap;let Ey=Gh;const y5e=BigInt(0),v5e=BigInt(36);function sB(t){t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=jt(un(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const _7={};for(let t=0;t<10;t++)_7[String(t)]=String(t);for(let t=0;t<26;t++)_7[String.fromCharCode(65+t)]=String(10+t);const oB=15;function _5e(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>_7[n]).join("");for(;e.length>=oB;){let n=e.substring(0,oB);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}const E5e=function(){const t={};for(let e=0;e<36;e++){const r="0123456789abcdefghijklmnopqrstuvwxyz"[e];t[r]=BigInt(e)}return t}();function C5e(t){t=t.toLowerCase();let e=y5e;for(let r=0;re.format()).join(",")})`:this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return this.type==="string"}get tupleName(){if(this.type!=="tuple")throw TypeError("not a tuple");return H(this,gf)}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return H(this,gf)===!0?-1:H(this,gf)===!1?this.value.length:null}static from(e,r){return new Zc(Kc,e,r)}static uint8(e){return Ze(e,8)}static uint16(e){return Ze(e,16)}static uint24(e){return Ze(e,24)}static uint32(e){return Ze(e,32)}static uint40(e){return Ze(e,40)}static uint48(e){return Ze(e,48)}static uint56(e){return Ze(e,56)}static uint64(e){return Ze(e,64)}static uint72(e){return Ze(e,72)}static uint80(e){return Ze(e,80)}static uint88(e){return Ze(e,88)}static uint96(e){return Ze(e,96)}static uint104(e){return Ze(e,104)}static uint112(e){return Ze(e,112)}static uint120(e){return Ze(e,120)}static uint128(e){return Ze(e,128)}static uint136(e){return Ze(e,136)}static uint144(e){return Ze(e,144)}static uint152(e){return Ze(e,152)}static uint160(e){return Ze(e,160)}static uint168(e){return Ze(e,168)}static uint176(e){return Ze(e,176)}static uint184(e){return Ze(e,184)}static uint192(e){return Ze(e,192)}static uint200(e){return Ze(e,200)}static uint208(e){return Ze(e,208)}static uint216(e){return Ze(e,216)}static uint224(e){return Ze(e,224)}static uint232(e){return Ze(e,232)}static uint240(e){return Ze(e,240)}static uint248(e){return Ze(e,248)}static uint256(e){return Ze(e,256)}static uint(e){return Ze(e,256)}static int8(e){return Ze(e,-8)}static int16(e){return Ze(e,-16)}static int24(e){return Ze(e,-24)}static int32(e){return Ze(e,-32)}static int40(e){return Ze(e,-40)}static int48(e){return Ze(e,-48)}static int56(e){return Ze(e,-56)}static int64(e){return Ze(e,-64)}static int72(e){return Ze(e,-72)}static int80(e){return Ze(e,-80)}static int88(e){return Ze(e,-88)}static int96(e){return Ze(e,-96)}static int104(e){return Ze(e,-104)}static int112(e){return Ze(e,-112)}static int120(e){return Ze(e,-120)}static int128(e){return Ze(e,-128)}static int136(e){return Ze(e,-136)}static int144(e){return Ze(e,-144)}static int152(e){return Ze(e,-152)}static int160(e){return Ze(e,-160)}static int168(e){return Ze(e,-168)}static int176(e){return Ze(e,-176)}static int184(e){return Ze(e,-184)}static int192(e){return Ze(e,-192)}static int200(e){return Ze(e,-200)}static int208(e){return Ze(e,-208)}static int216(e){return Ze(e,-216)}static int224(e){return Ze(e,-224)}static int232(e){return Ze(e,-232)}static int240(e){return Ze(e,-240)}static int248(e){return Ze(e,-248)}static int256(e){return Ze(e,-256)}static int(e){return Ze(e,-256)}static bytes1(e){return Ht(e,1)}static bytes2(e){return Ht(e,2)}static bytes3(e){return Ht(e,3)}static bytes4(e){return Ht(e,4)}static bytes5(e){return Ht(e,5)}static bytes6(e){return Ht(e,6)}static bytes7(e){return Ht(e,7)}static bytes8(e){return Ht(e,8)}static bytes9(e){return Ht(e,9)}static bytes10(e){return Ht(e,10)}static bytes11(e){return Ht(e,11)}static bytes12(e){return Ht(e,12)}static bytes13(e){return Ht(e,13)}static bytes14(e){return Ht(e,14)}static bytes15(e){return Ht(e,15)}static bytes16(e){return Ht(e,16)}static bytes17(e){return Ht(e,17)}static bytes18(e){return Ht(e,18)}static bytes19(e){return Ht(e,19)}static bytes20(e){return Ht(e,20)}static bytes21(e){return Ht(e,21)}static bytes22(e){return Ht(e,22)}static bytes23(e){return Ht(e,23)}static bytes24(e){return Ht(e,24)}static bytes25(e){return Ht(e,25)}static bytes26(e){return Ht(e,26)}static bytes27(e){return Ht(e,27)}static bytes28(e){return Ht(e,28)}static bytes29(e){return Ht(e,29)}static bytes30(e){return Ht(e,30)}static bytes31(e){return Ht(e,31)}static bytes32(e){return Ht(e,32)}static address(e){return new Zc(Kc,"address",e)}static bool(e){return new Zc(Kc,"bool",!!e)}static bytes(e){return new Zc(Kc,"bytes",e)}static string(e){return new Zc(Kc,"string",e)}static array(e,r){throw new Error("not implemented yet")}static tuple(e,r){throw new Error("not implemented yet")}static overrides(e){return new Zc(Kc,"overrides",Object.assign({},e))}static isTyped(e){return e&&typeof e=="object"&&"_typedSymbol"in e&&e._typedSymbol===aB}static dereference(e,r){if(Zc.isTyped(e)){if(e.type!==r)throw new Error(`invalid type: expecetd ${r}, got ${e.type}`);return e.value}return e}};gf=new WeakMap;let ri=Zc;class x5e extends Gu{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,r){let n=ri.dereference(r,"string");try{n=cr(n)}catch(i){return this._throwError(i.message,r)}return e.writeValue(n)}decode(e){return cr(vd(e.readValue(),20))}}class S5e extends Gu{constructor(r){super(r.name,r.type,"_",r.dynamic);ce(this,"coder");this.coder=r}defaultValue(){return this.coder.defaultValue()}encode(r,n){return this.coder.encode(r,n)}decode(r){return this.coder.decode(r)}}function kY(t,e,r){let n=[];if(Array.isArray(r))n=r;else if(r&&typeof r=="object"){let c={};n=e.map(u=>{const l=u.localName;return Ae(l,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:u},value:r}),Ae(!c[l],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:u},value:r}),c[l]=!0,r[l]})}else ee(!1,"invalid tuple value","tuple",r);ee(e.length===n.length,"types/value length mismatch","tuple",r);let i=new rP,s=new rP,o=[];e.forEach((c,u)=>{let l=n[u];if(c.dynamic){let d=s.length;c.encode(s,l);let h=i.writeUpdatableValue();o.push(f=>{h(f+d)})}else c.encode(i,l)}),o.forEach(c=>{c(i.length)});let a=t.appendWriter(i);return a+=t.appendWriter(s),a}function NY(t,e){let r=[],n=[],i=t.subReader(0);return e.forEach(s=>{let o=null;if(s.dynamic){let a=t.readIndex(),c=i.subReader(a);try{o=s.decode(c)}catch(u){if(ti(u,"BUFFER_OVERRUN"))throw u;o=u,o.baseType=s.name,o.name=s.localName,o.type=s.type}}else try{o=s.decode(t)}catch(a){if(ti(a,"BUFFER_OVERRUN"))throw a;o=a,o.baseType=s.name,o.name=s.localName,o.type=s.type}if(o==null)throw new Error("investigate");r.push(o),n.push(s.localName||null)}),Em.fromItems(r,n)}class T5e extends Gu{constructor(r,n,i){const s=r.type+"["+(n>=0?n:"")+"]",o=n===-1||r.dynamic;super("array",s,i,o);ce(this,"coder");ce(this,"length");ut(this,{coder:r,length:n})}defaultValue(){const r=this.coder.defaultValue(),n=[];for(let i=0;io||i<-(o+$5e))&&this._throwError("value out-of-bounds",n),i=qZ(i,8*yi)}else(ief(s,this.size*8))&&this._throwError("value out-of-bounds",n);return r.writeValue(i)}decode(r){let n=ef(r.readValue(),this.size*8);return this.signed&&(n=FC(n,this.size*8)),n}}class D5e extends $Y{constructor(e){super("string",e)}defaultValue(){return""}encode(e,r){return super.encode(e,Za(ri.dereference(r,"string")))}decode(e){return HC(super.decode(e))}}class x3 extends Gu{constructor(r,n){let i=!1;const s=[];r.forEach(a=>{a.dynamic&&(i=!0),s.push(a.type)});const o="tuple("+s.join(",")+")";super("tuple",o,n,i);ce(this,"coders");ut(this,{coders:Object.freeze(r.slice())})}defaultValue(){const r=[];this.coders.forEach(i=>{r.push(i.defaultValue())});const n=this.coders.reduce((i,s)=>{const o=s.localName;return o&&(i[o]||(i[o]=0),i[o]++),i},{});return this.coders.forEach((i,s)=>{let o=i.localName;!o||n[o]!==1||(o==="length"&&(o="_length"),r[o]==null&&(r[o]=r[s]))}),Object.freeze(r)}encode(r,n){const i=ri.dereference(n,"tuple");return kY(r,this.coders,i)}decode(r){return NY(r,this.coders)}}function Gf(t){return un(Za(t))}var M5e="AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGgAeABMAGAUhBe8BFxREN8sF2wC5AK5HAW8ArQkDzQCuhzc3NzcBP68NEfMABQdHBuw5BV8FYAA9MzkI9r4ZBg7QyQAWA9CeOwLNCjcCjqkChuA/lm+RAsXTAoP6ASfnEQDytQFJAjWVCkeXAOsA6godAB/cwdAUE0WlBCN/AQUCQRjFD/MRBjHxDQSJbw0jBzUAswBxme+tnIcAYwabAysG8QAjAEMMmxcDqgPKQyDXCMMxA7kUQwD3NXOrAKmFIAAfBC0D3x4BJQDBGdUFAhEgVD8JnwmQJiNWYUzrg0oAGwAUAB0AFnNcACkAFgBP9h3gPfsDOWDKneY2ChglX1UDYD30ABsAFAAdABZzIGRAnwDD8wAjAEEMzRbDqgMB2sAFYwXqAtCnAsS4AwpUJKRtFHsadUz9AMMVbwLpABM1NJEX0ZkCgYMBEyMAxRVvAukAEzUBUFAtmUwSAy4DBTER33EftQHfSwB5MxJ/AjkWKQLzL8E/cwBB6QH9LQDPDtO9ASNriQC5DQANAwCK21EFI91zHwCoL9kBqQcHBwcHKzUDowBvAQohPvU3fAQgHwCyAc8CKQMA5zMSezr7ULgFmDp/LzVQBgEGAi8FYQVgt8AFcTtlQhpCWEmfe5tmZ6IAExsDzQ8t+X8rBKtTAltbAn0jsy8Bl6utPWMDTR8Ei2kRANkDBrNHNysDBzECQWUAcwFpJ3kAiyUhAJ0BUb8AL3EfAbfNAz81KUsFWwF3YQZtAm0A+VEfAzEJDQBRSQCzAQBlAHsAM70GD/v3IZWHBwARKQAxALsjTwHZAeMPEzmXgIHwABIAGQA8AEUAQDt3gdvIEGcQZAkGTRFMdEIVEwK0D64L7REdDNkq09PgADSxB/MDWwfzA1sDWwfzB/MDWwfzA1sDWwNbA1scEvAi28gQZw9QBHUFlgWTBN4IiyZREYkHMAjaVBV0JhxPA00BBCMtSSQ7mzMTJUpMFE0LCAQ2SmyvfUADTzGzVP2QqgPTMlc5dAkGHnkSqAAyD3skNb1OhnpPcagKU0+2tYdJak5vAsY6sEAACikJm2/Dd1YGRRAfJ6kQ+ww3AbkBPw3xS9wE9QY/BM0fgRkdD9GVoAipLeEM8SbnLqWAXiP5KocF8Uv4POELUVFsD10LaQnnOmeBUgMlAREijwrhDT0IcRD3Cs1vDekRSQc9A9lJngCpBwULFR05FbkmFGKwCw05ewb/GvoLkyazEy17AAXXGiUGUQEtGwMA0y7rhbRaNVwgT2MGBwspI8sUrFAkDSlAu3hMGh8HGSWtApVDdEqLUToelyH6PEENai4XUYAH+TwJGVMLhTyiRq9FEhHWPpE9TCJNTDAEOYMsMyePCdMPiQy9fHYBXQklCbUMdRM1ERs3yQg9Bx0xlygnGQglRplgngT7owP3E9UDDwVDCUUHFwO5HDETMhUtBRGBKNsC9zbZLrcCk1aEARsFzw8pH+MQVEfkDu0InwJpA4cl7wAxFSUAGyKfCEdnAGOP3FMJLs8Iy2pwI3gDaxTrZRF3B5UOWwerHDcVwxzlcMxeD4YMKKezCV8BeQmdAWME5wgNNV+MpCBFZ1eLXBifIGVBQ14AAjUMaRWjRMGHfAKPD28SHwE5AXcHPQ0FAnsR8RFvEJkI74YINbkz/DopBFMhhyAVCisDU2zSCysm/Qz8bQGnEmYDEDRBd/Jnr2C6KBgBBx0yyUFkIfULlk/RDKAaxRhGVDIZ6AfDA/ca9yfuQVsGAwOnBxc6UTPyBMELbQiPCUMATQ6nGwfbGG4KdYzUATWPAbudA1uVhwJzkwY7Bw8Aaw+LBX3pACECqwinAAkA0wNbAD0CsQehAB0AiUUBQQMrMwEl6QKTA5cINc8BmTMB9y0EH8cMGQD7O25OAsO1AoBuZqYF4VwCkgJNOQFRKQQJUktVA7N15QDfAE8GF+NLARmvTs8e50cB43MvAMsA/wAJOQcJRQHRAfdxALsBYws1Caa3uQFR7S0AhwAZbwHbAo0A4QA5AIP1AVcAUQVd/QXXAlNNARU1HC9bZQG/AyMBNwERAH0Gz5GpzQsjBHEH1wIQHxXlAu8yB7kFAyLjE9FCyQK94lkAMhoKPAqrCqpgX2Q3CjV2PVQAEh+sPss/UgVVO1c7XDtXO1w7VztcO1c7XDtXO1wDm8Pmw+YKcF9JYe8Mqg3YRMw6TRPfYFVgNhPMLbsUxRXSJVoZQRrAJwkl6FUNDwgt12Y0CDA0eRfAAEMpbINFY4oeNApPHOtTlVT8LR8AtUumM7MNsBsZREQFS3XxYi4WEgomAmSFAmJGX1GzAV83JAKh+wJonAJmDQKfiDgfDwJmPwJmKgRyBIMDfxcDfpY5Cjl7GzmGOicnAmwhAjI6OA4CbcsCbbLzjgM3a0kvAWsA4gDlAE4JB5wMkQECD8YAEbkCdzMCdqZDAnlPRwJ4viFg30WyRvcCfEMCeswCfQ0CfPRIBEiBZygALxlJXEpfGRtK0ALRBQLQ0EsrA4hTA4fqRMmRNgLypV0HAwOyS9JMMSkH001QTbMCi0MCitzFHwshR2sJuwKOOwKOYESbhQKO3QKOYHxRuFM5AQ5S2FSJApP/ApMQAO0AIFUiVbNV1AosHymZijLleGpFPz0Cl6MC77ZYJawAXSkClpMCloCgAK1ZsFoNhVEAPwKWuQKWUlxIXNUCmc8CmWhczl0LHQKcnznGOqECnBoCn58CnryOACETNS4TAp31Ap6WALlBYThh8wKe1wKgcgGtAp6jIwKeUqljzGQrKS8CJ7MCJoICoP8CoFDbAqYzAqXSAqgDAIECp/ZogGi1AAdNaiBq1QKs5wKssgKtawKtBgJXIQJV4AKx5dsDH1JsmwKywRECsuwbbORtZ21MYwMl0QK2YD9DbpQDKUkCuGICuUsZArkue3A6cOUCvR0DLbYDMhUCvoxyBgMzdQK+HnMmc1MCw88CwwhzhnRPOUl05AM8qwEDPJ4DPcMCxYACxksCxhSNAshtVQLISALJUwLJMgJkoQLd1nh9ZXiyeSlL1AMYp2cGAmH4GfeVKHsPXpZevxUCz28Cz3AzT1fW9xejAMqxAs93AS3uA04Wfk8JAtwrAtuOAtJTA1JgA1NjAQUDVZCAjUMEzxrxZEl5A4LSg5EC2ssC2eKEFIRNp0ADhqkAMwNkEoZ1Xf0AWQLfaQLevHd7AuIz7RgB8zQrAfSfAfLWiwLr9wLpdH0DAur9AuroAP1LAb0C7o0C66CWrpcHAu5DA4XkmH1w5HGlAvMHAG0DjhqZlwL3FwORcgOSiwL3nAL53QL4apogmq+/O5siA52HAv7+AR8APZ8gAZ+3AwWRA6ZuA6bdANXJAwZuoYyiCQ0DDE0BEwEjB3EGZb1rCQC/BG/DFY8etxEAG3k9ACcDNxJRA42DAWcrJQCM8wAlAOanC6OVCLsGI6fJBgCvBRnDBvElRUYFFoAFcD9GSDNCKUK8X3kZX8QAls0FOgCQVCGbwTsuYDoZutcONxjOGJHJ/gVfBWAFXwVgBWsFYAVfBWAFXwVgBV8FYAVfBWBOHQjfjW8KCgoKbF7xMwTRA7kGN8PDAMMEr8MA70gxFroFTj5xPnhCR0K+X30/X/AAWBkzswCNBsxzzASm70aCRS4rDDMeLz49fnXfcsH5GcoscQFz13Y4HwVnBXLJycnACNdRYwgICAqEXoWTxgA7P4kACxbZBu21Kw0AjMsTAwkVAOVtJUUsJ1JCuULESUArXy9gPi9AKwnJRQYKTD9LPoA+iT54PnkCkULEUUpDX9NWV3JVEjQAc1w3A3IBE3YnX+g7QiMJb6MKaiszRCUuQrNCxDPMCcwEX9EWJzYREBEEBwIHKn6l33JCNVIfybPJtAltydPUCmhBZw/tEKsZAJOVJU1CLRuxbUHOQAo7P0s+eEJHHA8SJVRPdGM0NVrpvBoKhfUlM0JHHGUQUhEWO1xLSj8MO0ucNAqJIzVCRxv9EFsqKyA4OQgNj2nwZgp5ZNFgE2A1K3YHS2AhQQojJmC7DgpzGG1WYFUZCQYHZO9gHWCdYIVgu2BTYJlwFh8GvRbcXbG8YgtDHrMBwzPVyQonHQgkCyYBgQJ0Ajc4nVqIAwGSCsBPIgDsK3SWEtIVBa5N8gGjAo+kVwVIZwD/AEUSCDweX4ITrRQsJ8K3TwBXFDwEAB0TvzVcAtoTS20RIwDgVgZ9BBImYgA5AL4Coi8LFnezOkCnIQFjAY4KBAPh9RcGsgZSBsEAJctdsWIRu2kTkQstRw7DAcMBKgpPBGIGMDAwKCYnKTQaLg4AKRSVAFwCdl+YUZ0JdicFD3lPAdt1F9ZZKCGxuE3yBxkFVGcA/wBFEgiCBwAOLHQSjxOtQDg1z7deFRMAZ8QTAGtKb1ApIiPHADkAvgKiLy1DFtYCmBiDAlDDWNB0eo7fpaMO/aEVRRv0ATEQZBIODyMEAc8JQhCbDRgzFD4TAEMAu9YBCgCsAOkAm5I3ABwAYxvONnR+MhXJAxgKQyxL2+kkJhMbhQKDBMkSsvF0AD9BNQ6uQC7WqSQHwxEAEEIu1hkhAH2z4iQPwyJPHNWpdyYBRSpnJALzoBAEVPPsH20MxA0CCEQKRgAFyAtFAlMNwwjEDUQJRArELtapMg7DDZgJIw+TGukEIwvDFkMAqAtDEMMMBhioe+QAO3MMRAACrgnEBSPY9Q0FDnbSBoMAB8MSYxkSxAEJAPIJAAB8FWMOFtMc/HcXwxhDAC7DAvOowwAewwJdKDKHAAHDAALrFUQVwwAbwyvzpWMWv8wA/ABpAy++bcYDUKPD0KhDCwKmJ1MAAmMA5+UZwxAagwipBRL/eADfw6fDGOMCGsOjk3l6BwOpo4sAEsMOGxMAA5sAbcMOAAvDp0MJGkMDwgipnNIPAwfIqUMGAOGDAAPzABXDAAcDAAnDAGmTABrDAA7DChjDjnEWAwABYwAOcwAuUyYABsMAF8MIKQANUgC6wy4AA8MADqMq8wCyYgAcIwAB8wqpAAXOCx0V4wAHowBCwwEKAGnDAAuDAB3DAAjDCakABdIAbqcZ3QCZCCkABdIAAAFDAAfjAB2jCCkABqIACYMAGzMAbSMA5sOIAAhjAAhDABTDBAkpAAbSAOOTAAlDC6kOzPtnAAdDAG6kQFAATwAKwwwAA0MACbUDPwAHIwAZgwACE6cDAAojAApDAAoDp/MGwwAJIwADEwAQQwgAFEMAEXMAD5MADfMADcMAGRMOFiMAFUMAbqMWuwHDAMIAE0MLAGkzEgDhUwACQwAEWgAXgwUjAAbYABjDBSYBgzBaAEFNALcQBxUMegAwMngBrA0IZgJ0KxQHBREPd1N0ZzKRJwaIHAZqNT4DqQq8BwngAB4DAwt2AX56T1ocKQNXAh1GATQGC3tOxYNagkgAMQA5CQADAQEAWxLjAIOYNAEzAH7tFRk6TglSAF8NAAlYAQ+S1ACAQwQorQBiAN4dAJ1wPyeTANVzuQDX3AIeEMp9eyMgXiUAEdkBkJizKltbVVAaRMqRAAEAhyQ/SDEz6BmfVwB6ATEsOClKIRcDOF0E/832AFNt5AByAnkCRxGCOs94NjXdAwINGBonDBwPALW2AwICAgAAAAAAAAYDBQMDARrUAwAtAAAAAgEGBgYGBgYFBQUFBQUEBQYHCAkEBQUFBQQAAAICAAAAIgCNAJAAlT0A6gC7ANwApEQAwgCyAK0AqADuAKYA2gCjAOcBCAEDAMcAgQBiANIA1AEDAN4A8gCQAKkBMQDqAN8A3AsBCQ8yO9ra2tq8xuLT1tRJOB0BUgFcNU0BWgFpAWgBWwFMUUlLbhMBUxsNEAs6PhMOACcUKy0vMj5AQENDQ0RFFEYGJFdXV1dZWVhZL1pbXVxcI2NnZ2ZoZypsbnZ1eHh4eHh4enp6enp6enp6enp8fH18e2IARPIASQCaAHgAMgBm+ACOAFcAVwA3AnbvAIsABfj4AGQAk/IAnwBPAGIAZP//sACFAIUAaQBWALEAJAC2AIMCQAJDAPwA5wD+AP4A6AD/AOkA6QDoAOYALwJ7AVEBQAE+AVQBPgE+AT4BOQE4ATgBOAEcAVgXADEQCAEAUx8SHgsdHhYAjgCWAKYAUQBqIAIxAHYAbwCXAxUDJzIDIUlGTzEAkQJPAMcCVwKkAMAClgKWApYClgKWApYCiwKWApYClgKWApYClgKVApUCmAKgApcClgKWApQClAKUApQCkgKVAnUB1AKXAp8ClgKWApUeAIETBQD+DQOfAmECOh8BVBg9AuIZEjMbAU4/G1WZAXusRAFpYQEFA0FPAQYAmTEeIJdyADFoAHEANgCRA5zMk/C2jGINwjMWygIZCaXdfDILBCs5dAE7YnQBugDlhoiHhoiGiYqKhouOjIaNkI6Ij4qQipGGkoaThpSSlYaWhpeKmIaZhpqGm4aci52QnoqfhuIC4XTpAt90AIp0LHSoAIsAdHQEQwRABEIERQRDBEkERgRBBEcESQRIBEQERgRJAJ5udACrA490ALxuAQ10ANFZdHQA13QCFHQA/mJ0AP4BIQD+APwA/AD9APwDhGZ03ASMK23HAP4A/AD8AP0A/CR0dACRYnQA/gCRASEA/gCRAvQA/gCRA4RmdNwEjCttxyR0AP9idAEhAP4A/gD8APwA/QD8AP8A/AD8AP0A/AOEZnTcBIwrbcckdHQAkWJ0ASEA/gCRAP4AkQL0AP4AkQOEZnTcBIwrbcckdAJLAT50AlIBQXQCU8l0dAJfdHQDpgL0A6YDpgOnA6cDpwOnA4RmdNwEjCttxyR0dACRYnQBIQOmAJEDpgCRAvQDpgCRA4RmdNwEjCttxyR0BDh0AJEEOQCRDpU5dSgCADR03gV2CwArdAEFAM5iCnR0AF1iAAYcOgp0dACRCnQAXAEIwWZ0CnRmdHQAkWZ0CnRmdEXgAFF03gp0dEY0tlT2u3SOAQTwscwhjZZKrhYcBSfFp9XNbKiVDOD2b+cpe4/Z17mQnbtzzhaeQtE2GGj0IDNTjRUSyTxxw/RPHW/+vS7d1NfRt9z9QPZg4X7QFfhCnkvgNPIItOsC2eV6hPannZNHlZ9xrwZXIMOlu3jSoQSq78WEjwLjw1ELSlF1aBvfzwk5ZX7AUvQzjPQKbDuQ+sm4wNOp4A6AdVuRS0t1y/DZpg4R6m7FNjM9HgvW7Bi88zaMjOo6lM8wtBBdj8LP4ylv3zCXPhebMKJc066o9sF71oFW/8JXu86HJbwDID5lzw5GWLR/LhT0Qqnp2JQxNZNfcbLIzPy+YypqRm/lBmGmex+82+PisxUumSeJkALIT6rJezxMH+CTJmQtt5uwTVbL3ptmjDUQzlSIvWi8Tl7ng1NpuRn1Ng4n14Qc+3Iil7OwkvNWogLSPkn3pihIFytyIGmMhOe3n1tWsuMy9BdKyqF4Z3v2SgggTL9KVvMXPnCbRe+oOuFFP3HejBG/w9gvmfNYvg6JuWia2lcSSN1uIjBktzoIazOHPJZ7kKHPz8mRWVdW3lA8WGF9dQF6Bm673boov3BUWDU2JNcahR23GtfHKLOz/viZ+rYnZFaIznXO67CYEJ1fXuTRpZhYZkKe54xeoagkNGLs+NTZHE0rX45/XvQ2RGADX6vcAvdxIUBV27wxGm2zjZo4X3ILgAlrOFheuZ6wtsvaIj4yLY7qqawlliaIcrz2G+c3vscAnCkCuMzMmZvMfu9lLwTvfX+3cVSyPdN9ZwgDZhfjRgNJcLiJ67b9xx8JHswprbiE3v9UphotAPIgnXVIN5KmMc0piXhc6cChPnN+MRhG9adtdttQTTwSIpl8I4/j//d3sz1326qTBTpPRM/Hgh3kzqEXs8ZAk4ErQhNO8hzrQ0DLkWMA/N+91tn2MdOJnWC2FCZehkQrwzwbKOjhvZsbM95QoeL9skYyMf4srVPVJSgg7pOLUtr/n9eT99oe9nLtFRpjA9okV2Kj8h9k5HaC0oivRD8VyXkJ81tcd4fHNXPCfloIQasxsuO18/46dR2jgul/UIet2G0kRvnyONMKhHs6J26FEoqSqd+rfYjeEGwHWVDpX1fh1jBBcKGMqRepju9Y00mDVHC+Xdij/j44rKfvfjGinNs1jO/0F3jB83XCDINN/HB84axlP+3E/klktRo+vl3U/aiyMJbIodE1XSsDn6UAzIoMtUObY2+k/4gY/l+AkZJ5Sj2vQrkyLm3FoxjhDX+31UXBFf9XrAH31fFqoBmDEZvhvvpnZ87N+oZEu7U9O/nnk+QWj3x8uyoRbEnf+O5UMr9i0nHP38IF5AvzrBW8YWBUR0mIAzIvndQq9N3v/Jto3aPjPXUPl8ASdPPyAp7jENf8bk7VMM9ol9XGmlBmeDMuGqt+WzuL6CXAxXjIhCPM5vACchgMJ/8XBGLO/D1isVvGhwwHHr1DLaI5mn2Jr/b1pUD90uciDaS8cXNDzCWvNmT/PhQe5e8nTnnnkt8Ds/SIjibcum/fqDhKopxAY8AkSrPn+IGDEKOO+U3XOP6djFs2H5N9+orhOahiQk5KnEUWa+CzkVzhp8bMHRbg81qhjjXuIKbHjSLSIBKWqockGtKinY+z4/RdBUF6pcc3JmnlxVcNgrI4SEzKUZSwcD2QCyxzKve+gAmg6ZuSRkpPFa6mfThu7LJNu3H5K42uCpNvPAsoedolKV/LHe/eJ+BbaG5MG0NaSGVPRUmNFMFFSSpXEcXwbVh7UETOZZtoVNRGOIbbkig3McEtR68cG0RZAoJevWYo7Dg/lZ1CQzblWeUvVHmr8fY4Nqd9JJiH/zEX24mJviH60fAyFr0A3c4bC1j3yZU60VgJxXn8JgJXLUIsiBnmKmMYz+7yBQFBvqb2eYnuW59joZBf56/wXvWIR4R8wTmV80i1mZy+S4+BUES+hzjk0uXpC///z/IlqHZ1monzlXp8aCfhGKMti73FI1KbL1q6IKO4fuBuZ59gagjn5xU79muMpHXg6S+e+gDM/U9BKLHbl9l6o8czQKl4RUkJJiqftQG2i3BMg/TQlUYFkJDYBOOvAugYuzYSDnZbDDd/aSd9x0Oe6F+bJcHfl9+gp6L5/TgA+BdFFovbfCrQ40s5vMPw8866pNX8zyFGeFWdxIpPVp9Rg1UPOVFbFZrvaFq/YAzHQgqMWpahMYfqHpmwXfHL1/kpYmGuHFwT55mQu0dylfNuq2Oq0hTMCPwqfxnuBIPLXfci4Y1ANy+1CUipQxld/izVh16WyG2Q0CQQ9NqtAnx1HCHwDj7sYxOSB0wopZSnOzxQOcExmxrVTF2BkOthVpGfuhaGECfCJpJKpjnihY+xOT2QJxN61+9K6QSqtv2Shr82I3jgJrqBg0wELFZPjvHpvzTtaJnLK6Vb97Yn933koO/saN7fsjwNKzp4l2lJVx2orjCGzC/4ZL4zCver6aQYtC5sdoychuFE6ufOiog+VWi5UDkbmvmtah/3aArEBIi39s5ILUnlFLgilcGuz9CQshEY7fw2ouoILAYPVT/gyAIq3TFAIwVsl+ktkRz/qGfnCDGrm5gsl/l9QdvCWGsjPz3dU7XuqKfdUrr/6XIgjp4rey6AJBmCmUJMjITHVdFb5m1p+dLMCL8t55zD42cmftmLEJC0Da04YiRCVUBLLa8D071/N5UBNBXDh0LFsmhV/5B5ExOB4j3WVG/S3lfK5o+V6ELHvy6RR9n4ac+VsK4VE4yphPvV+kG9FegTBH4ZRXL2HytUHCduJazB/KykjfetYxOXTLws267aGOd+I+JhKP//+VnXmS90OD/jvLcVu0asyqcuYN1mSb6XTlCkqv1vigZPIYwNF/zpWcT1GR/6aEIRjkh0yhg4LXJfaGobYJTY4JI58KiAKgmmgAKWdl5nYCeLqavRJGQNuYuZtZFGx+IkI4w4NS2xwbetNMunOjBu/hmKCI/w7tfiiyUd//4rbTeWt4izBY8YvGIN6vyKYmP/8X8wHKCeN+WRcKM70+tXKNGyevU9H2Dg5BsljnTf8YbsJ1TmMs74Ce2XlHisleguhyeg44rQOHZuw/6HTkhnnurK2d62q6yS7210SsAIaR+jXMQA+svkrLpsUY+F30Uw89uOdGAR6vo4FIME0EfVVeHTu6eKicfhSqOeXJhbftcd08sWEnNUL1C9fnprTgd83IMut8onVUF0hvqzZfHduPjbjwEXIcoYmy+P6tcJZHmeOv6VrvEdkHDJecjHuHeWANe79VG662qTjA/HCvumVv3qL+LrOcpqGps2ZGwQdFJ7PU4iuyRlBrwfO+xnPyr47s2cXVbWzAyznDiBGjCM3ksxjjqM62GE9C8f5U38kB3VjtabKp/nRdvMESPGDG90bWRLAt1Qk5DyLuazRR1YzdC1c+hZXvAWV8xA72S4A8B67vjVhbba3MMop293FeEXpe7zItMWrJG/LOH9ByOXmYnNJfjmfuX9KbrpgLOba4nZ+fl8Gbdv/ihv+6wFGKHCYrVwmhFC0J3V2bn2tIB1wCc1CST3d3X2OyxhguXcs4sm679UngzofuSeBewMFJboIQHbUh/m2JhW2hG9DIvG2t7yZIzKBTz9wBtnNC+2pCRYhSIuQ1j8xsz5VvqnyUIthvuoyyu7fNIrg/KQUVmGQaqkqZk/Vx5b33/gsEs8yX7SC1J+NV4icz6bvIE7C5G6McBaI8rVg56q5QBJWxn/87Q1sPK4+sQa8fLU5gXo4paaq4cOcQ4wR0VBHPGjKh+UlPCbA1nLXyEUX45qZ8J7/Ln4FPJE2TdzD0Z8MLSNQiykMMmSyOCiFfy84Rq60emYB2vD09KjYwsoIpeDcBDTElBbXxND72yhd9pC/1CMid/5HUMvAL27OtcIJDzNKpRPNqPOpyt2aPGz9QWIs9hQ9LiX5s8m9hjTUu/f7MyIatjjd+tSfQ3ufZxPpmJhTaBtZtKLUcfOCUqADuO+QoH8B9v6U+P0HV1GLQmtoNFTb3s74ivZgjES0qfK+8RdGgBbcCMSy8eBvh98+et1KIFqSe1KQPyXULBMTsIYnysIwiZBJYdI20vseV+wuJkcqGemehKjaAb9L57xZm3g2zX0bZ2xk/fU+bCo7TlnbW7JuF1YdURo/2Gw7VclDG1W7LOtas2LX4upifZ/23rzpsnY/ALfRgrcWP5hYmV9VxVOQA1fZvp9F2UNU+7d7xRyVm5wiLp3/0dlV7vdw1PMiZrbDAYzIVqEjRY2YU03sJhPnlwIPcZUG5ltL6S8XCxU1eYS5cjr34veBmXAvy7yN4ZjArIG0dfD/5UpBNlX1ZPoxJOwyqRi3wQWtOzd4oNKh0LkoTm8cwqgIfKhqqGOhwo71I+zXnMemTv2B2AUzABWyFztGgGULjDDzWYwJUVBTjKCn5K2QGMK1CQT7SzziOjo+BhAmqBjzuc3xYym2eedGeOIRJVyTwDw37iCMe4g5Vbnsb5ZBdxOAnMT7HU4DHpxWGuQ7GeiY30Cpbvzss55+5Km1YsbD5ea3NI9QNYIXol5apgSu9dZ8f8xS5dtHpido5BclDuLWY4lhik0tbJa07yJhH0BOyEut/GRbYTS6RfiTYWGMCkNpfSHi7HvdiTglEVHKZXaVhezH4kkXiIvKopYAlPusftpE4a5IZwvw1x/eLvoDIh/zpo9FiQInsTb2SAkKHV42XYBjpJDg4374XiVb3ws4qM0s9eSQ5HzsMU4OZJKuopFjBM+dAZEl8RUMx5uU2N486Kr141tVsGQfGjORYMCJAMsxELeNT4RmWjRcpdTGBwcx6XN9drWqPmJzcrGrH4+DRc7+n1w3kPZwu0BkNr6hQrqgo7JTB9A5kdJ/H7P4cWBMwsmuixAzJB3yrQpnGIq90lxAXLzDCdn1LPibsRt7rHNjgQBklRgPZ8vTbjXdgXrTWQsK5MdrXXQVPp0Rinq3frzZKJ0qD6Qhc40VzAraUXlob1gvkhK3vpmHgI6FRlQZNx6eRqkp0zy4AQlX813fAPtL3jMRaitGFFjo0zmErloC+h+YYdVQ6k4F/epxAoF0BmqEoKNTt6j4vQZNQ2BoqF9Vj53TOIoNmDiu9Xp15RkIgQIGcoLpfoIbenzpGUAtqFJp5W+LLnx38jHeECTJ/navKY1NWfN0sY1T8/pB8kIH3DU3DX+u6W3YwpypBMYOhbSxGjq84RZ84fWJow8pyHqn4S/9J15EcCMsXqrfwyd9mhiu3+rEo9pPpoJkdZqHjra4NvzFwuThNKy6hao/SlLw3ZADUcUp3w3SRVfW2rhl80zOgTYnKE0Hs2qp1J6H3xqPqIkvUDRMFDYyRbsFI3M9MEyovPk8rlw7/0a81cDVLmBsR2ze2pBuKb23fbeZC0uXoIvDppfTwIDxk1Oq2dGesGc+oJXWJLGkOha3CX+DUnzgAp9HGH9RsPZN63Hn4RMA5eSVhPHO+9RcRb/IOgtW31V1Q5IPGtoxPjC+MEJbVlIMYADd9aHYWUIQKopuPOHmoqSkubnAKnzgKHqgIOfW5RdAgotN6BN+O2ZYHkuemLnvQ8U9THVrS1RtLmKbcC7PeeDsYznvqzeg6VCNwmr0Yyx1wnLjyT84BZz3EJyCptD3yeueAyDWIs0L2qs/VQ3HUyqfrja0V1LdDzqAikeWuV4sc7RLIB69jEIBjCkyZedoUHqCrOvShVzyd73OdrJW0hPOuQv2qOoHDc9xVb6Yu6uq3Xqp2ZaH46A7lzevbxQEmfrzvAYSJuZ4WDk1Hz3QX1LVdiUK0EvlAGAYlG3Md30r7dcPN63yqBCIj25prpvZP0nI4+EgWoFG95V596CurXpKRBGRjQlHCvy5Ib/iW8nZJWwrET3mgd6mEhfP4KCuaLjopWs7h+MdXFdIv8dHQJgg1xi1eYqB0uDYjxwVmri0Sv5XKut/onqapC+FQiC2C1lvYJ9MVco6yDYsS3AANUfMtvtbYI2hfwZatiSsnoUeMZd34GVjkMMKA+XnjJpXgRW2SHTZplVowPmJsvXy6w3cfO1AK2dvtZEKTkC/TY9LFiKHCG0DnrMQdGm2lzlBHM9iEYynH2UcVMhUEjsc0oDBTgo2ZSQ1gzkAHeWeBXYFjYLuuf8yzTCy7/RFR81WDjXMbq2BOH5dURnxo6oivmxL3cKzKInlZkD31nvpHB9Kk7GfcfE1t+1V64b9LtgeJGlpRFxQCAqWJ5DoY77ski8gsOEOr2uywZaoO/NGa0X0y1pNQHBi3b2SUGNpcZxDT7rLbBf1FSnQ8guxGW3W+36BW0gBje4DOz6Ba6SVk0xiKgt+q2JOFyr4SYfnu+Ic1QZYIuwHBrgzr6UvOcSCzPTOo7D6IC4ISeS7zkl4h+2VoeHpnG/uWR3+ysNgPcOIXQbv0n4mr3BwQcdKJxgPSeyuP/z1Jjg4e9nUvoXegqQVIE30EHx5GHv+FAVUNTowYDJgyFhf5IvlYmEqRif6+WN1MkEJmDcQITx9FX23a4mxy1AQRsOHO/+eImX9l8EMJI3oPWzVXxSOeHU1dUWYr2uAA7AMb+vAEZSbU3qob9ibCyXeypEMpZ6863o6QPqlqGHZkuWABSTVNd4cOh9hv3qEpSx2Zy/DJMP6cItEmiBJ5PFqQnDEIt3NrA3COlOSgz43D7gpNFNJ5MBh4oFzhDPiglC2ypsNU4ISywY2erkyb1NC3Qh/IfWj0eDgZI4/ln8WPfBsT3meTjq1Uqt1E7Zl/qftqkx6aM9KueMCekSnMrcHj1CqTWWzEzPsZGcDe3Ue4Ws+XFYVxNbOFF8ezkvQGR6ZOtOLU2lQEnMBStx47vE6Pb7AYMBRj2OOfZXfisjJnpTfSNjo6sZ6qSvNxZNmDeS7Gk3yYyCk1HtKN2UnhMIjOXUzAqDv90lx9O/q/AT1ZMnit5XQe9wmQxnE/WSH0CqZ9/2Hy+Sfmpeg8RwsHI5Z8kC8H293m/LHVVM/BA7HaTJYg5Enk7M/xWpq0192ACfBai2LA/qrCjCr6Dh1BIMzMXINBmX96MJ5Hn2nxln/RXPFhwHxUmSV0EV2V0jm86/dxxuYSU1W7sVkEbN9EzkG0QFwPhyHKyb3t+Fj5WoUUTErcazE/N6EW6Lvp0d//SDPj7EV9UdJN+Amnf3Wwk3A0SlJ9Z00yvXZ7n3z70G47Hfsow8Wq1JXcfwnA+Yxa5mFsgV464KKP4T31wqIgzFPd3eCe3j5ory5fBF2hgCFyVFrLzI9eetNXvM7oQqyFgDo4CTp/hDV9NMX9JDHQ/nyHTLvZLNLF6ftn2OxjGm8+PqOwhxnPHWipkE/8wbtyri80Sr7pMNkQGMfo4ZYK9OcCC4ESVFFbLMIvlxSoRqWie0wxqnLfcLSXMSpMMQEJYDVObYsXIQNv4TGNwjq1kvT1UOkicTrG3IaBZ3XdScS3u8sgeZPVpOLkbiF940FjbCeNRINNvDbd01EPBrTCPpm12m43ze1bBB59Ia6Ovhnur/Nvx3IxwSWol+3H2qfCJR8df6aQf4v6WiONxkK+IqT4pKQrZK/LplgDI/PJZbOep8dtbV7oCr6CgfpWa8NczOkPx81iSHbsNhVSJBOtrLIMrL31LK9TqHqAbAHe0RLmmV806kRLDLNEhUEJfm9u0sxpkL93Zgd6rw+tqBfTMi59xqXHLXSHwSbSBl0EK0+loECOPtrl+/nsaFe197di4yUgoe4jKoAJDXc6DGDjrQOoFDWZJ9HXwt8xDrQP+7aRwWKWI1GF8s8O4KzxWBBcwnl3vnl1Oez3oh6Ea1vjR7/z7DDTrFtqU2W/KAEzAuXDNZ7MY73MF216dzdSbWmUp4lcm7keJfWaMHgut9x5C9mj66Z0lJ+yhsjVvyiWrfk1lzPOTdhG15Y7gQlXtacvI7qv/XNSscDwqkgwHT/gUsD5yB7LdRRvJxQGYINn9hTpodKFVSTPrtGvyQw+HlRFXIkodErAGu9Iy1YpfSPc3jkFh5CX3lPxv7aqjE/JAfTIpEjGb/H7MO0e2vsViSW1qa/Lmi4/n4DEI3g7lYrcanspDfEpKkdV1OjSLOy0BCUqVoECaB55vs06rXl4jqmLsPsFM/7vYJ0vrBhDCm/00A/H81l1uekJ/6Lml3Hb9+NKiLqATJmDpyzfYZFHumEjC662L0Bwkxi7E9U4cQA0XMVDuMYAIeLMPgQaMVOd8fmt5SflFIfuBoszeAw7ow5gXPE2Y/yBc/7jExARUf/BxIHQBF5Sn3i61w4z5xJdCyO1F1X3+3ax+JSvMeZ7S6QSKp1Fp/sjYz6Z+VgCZzibGeEoujryfMulH7Rai5kAft9ebcW50DyJr2uo2z97mTWIu45YsSnNSMrrNUuG1XsYBtD9TDYzQffKB87vWbkM4EbPAFgoBV4GQS+vtFDUqOFAoi1nTtmIOvg38N4hT2Sn8r8clmBCXspBlMBYTnrqFJGBT3wZOzAyJDre9dHH7+x7qaaKDOB4UQALD5ecS0DE4obubQEiuJZ0EpBVpLuYcce8Aa4PYd/V4DLDAJBYKQPCWTcrEaZ5HYbJi11Gd6hjGom1ii18VHYnG28NKpkz2UKVPxlhYSp8uZr367iOmoy7zsxehW9wzcy2zG0a80PBMCRQMb32hnaHeOR8fnNDzZhaNYhkOdDsBUZ3loDMa1YP0uS0cjUP3b/6DBlqmZOeNABDsLl5BI5QJups8uxAuWJdkUB/pO6Zax6tsg7fN5mjjDgMGngO+DPcKqiHIDbFIGudxtPTIyDi9SFMKBDcfdGQRv41q1AqmxgkVfJMnP8w/Bc7N9/TR6C7mGObFqFkIEom8sKi2xYqJLTCHK7cxzaZvqODo22c3wisBCP4HeAgcRbNPAsBkNRhSmD48dHupdBRw4mIvtS5oeF6zeT1KMCyhMnmhpkFAGWnGscoNkwvQ8ZM5lE/vgTHFYL99OuNxdFBxTEDd5v2qLR8y9WkXsWgG6kZNndFG+pO/UAkOCipqIhL3hq7cRSdrCq7YhUsTocEcnaFa6nVkhnSeRYUA1YO0z5itF9Sly3VlxYDw239TJJH6f3EUfYO5lb7bcFcz8Bp7Oo8QmnsUHOz/fagVUBtKEw1iT88j+aKkv8cscKNkMxjYr8344D1kFoZ7/td1W6LCNYN594301tUGRmFjAzeRg5vyoM1F6+bJZ/Q54jN/k8SFd3DxPTYaAUsivsBfgTn7Mx8H2SpPt4GOdYRnEJOH6jHM2p6SgB0gzIRq6fHxGMmSmqaPCmlfwxiuloaVIitLGN8wie2CDWhkzLoCJcODh7KIOAqbHEvXdUxaS4TTTs07Clzj/6GmVs9kiZDerMxEnhUB6QQPlcfqkG9882RqHoLiHGBoHfQuXIsAG8GTAtao2KVwRnvvam8jo1e312GQAKWEa4sUVEAMG4G6ckcONDwRcg1e2D3+ohXgY4UAWF8wHKQMrSnzCgfFpsxh+aHXMGtPQroQasRY4U6UdG0rz1Vjbka0MekOGRZQEvqQFlxseFor8zWFgHek3v29+WqN6gaK5gZOTOMZzpQIC1201LkMCXild3vWXSc5UX9xcFYfbRPzGFa1FDcPfPB/jUEq/FeGt419CI3YmBlVoHsa4KdcwQP5ZSwHHhFJ7/Ph/Rap/4vmG91eDwPP0lDfCDRCLszTqfzM71xpmiKi2HwS4WlqvGNwtvwF5Dqpn6KTq8ax00UMPkxDcZrEEEsIvHiUXXEphdb4GB4FymlPwBz4Gperqq5pW7TQ6/yNRhW8VT5NhuP0udlxo4gILq5ZxAZk8ZGh3g4CqxJlPKY7AQxupfUcVpWT5VItp1+30UqoyP4wWsRo3olRRgkWZZ2ZN6VC3OZFeXB8NbnUrSdikNptD1QiGuKkr8EmSR/AK9Rw+FF3s5uwuPbvHGiPeFOViltMK7AUaOsq9+x9cndk3iJEE5LKZRlWJbKOZweROzmPNVPkjE3K/TyA57Rs68TkZ3MR8akKpm7cFjnjPd/DdkWjgYoKHSr5Wu5ssoBYU4acRs5g2DHxUmdq8VXOXRbunD8QN0LhgkssgahcdoYsNvuXGUK/KXD/7oFb+VGdhqIn02veuM5bLudJOc2Ky0GMaG4W/xWBxIJcL7yliJOXOpx0AkBqUgzlDczmLT4iILXDxxtRR1oZa2JWFgiAb43obrJnG/TZC2KSK2wqOzRZTXavZZFMb1f3bXvVaNaK828w9TO610gk8JNf3gMfETzXXsbcvRGCG9JWQZ6+cDPqc4466Yo2RcKH+PILeKOqtnlbInR3MmBeGG3FH10yzkybuqEC2HSQwpA0An7d9+73BkDUTm30bZmoP/RGbgFN+GrCOfADgqr0WbI1a1okpFms8iHYw9hm0zUvlEMivBRxModrbJJ+9/p3jUdQQ9BCtQdxnOGrT5dzRUmw0593/mbRSdBg0nRvRZM5/E16m7ZHmDEtWhwvfdZCZ8J8M12W0yRMszXamWfQTwIZ4ayYktrnscQuWr8idp3PjT2eF/jmtdhIfcpMnb+IfZY2FebW6UY/AK3jP4u3Tu4zE4qlnQgLFbM19EBIsNf7KhjdbqQ/D6yiDb+NlEi2SKD+ivXVUK8ib0oBo366gXkR8ZxGjpJIDcEgZPa9TcYe0TIbiPl/rPUQDu3XBJ9X/GNq3FAUsKsll57DzaGMrjcT+gctp+9MLYXCq+sqP81eVQ0r9lt+gcQfZbACRbEjvlMskztZG8gbC8Qn9tt26Q7y7nDrbZq/LEz7kR6Jc6pg3N9rVX8Y5MJrGlML9p9lU4jbTkKqCveeZUJjHB03m2KRKR2TytoFkTXOLg7keU1s1lrPMQJpoOKLuAAC+y1HlJucU6ysB5hsXhvSPPLq5J7JtnqHKZ4vYjC4Vy8153QY+6780xDuGARsGbOs1WqzH0QS765rnSKEbbKlkO8oI/VDwUd0is13tKpqILu1mDJFNy/iJAWcvDgjxvusIT+PGz3ST/J9r9Mtfd0jpaGeiLYIqXc7DiHSS8TcjFVksi66PEkxW1z6ujbLLUGNNYnzOWpH8BZGK4bCK7iR+MbIv8ncDAz1u4StN3vTTzewr9IQjk9wxFxn+6N1ddKs0vffJiS08N3a4G1SVrlZ97Q/M+8G9fe5AP6d9/Qq4WRnORVhofPIKEdCr3llspUfE0oKIIYoByBRPh+bX1HLS3JWGJRhIvE1aW4NTd8ePi4Z+kXb+Z8snYfSNcqijhAgVsx4RCM54cXUiYkjeBmmC4ajOHrChoELscJJC7+9jjMjw5BagZKlgRMiSNYz7h7vvZIoQqbtQmspc0cUk1G/73iXtSpROl5wtLgQi0mW2Ex8i3WULhcggx6E1LMVHUsdc9GHI1PH3U2Ko0PyGdn9KdVOLm7FPBui0i9a0HpA60MsewVE4z8CAt5d401Gv6zXlIT5Ybit1VIA0FCs7wtvYreru1fUyW3oLAZ/+aTnZrOcYRNVA8spoRtlRoWflsRClFcgzkqiHOrf0/SVw+EpVaFlJ0g4Kxq1MMOmiQdpMNpte8lMMQqm6cIFXlnGbfJllysKDi+0JJMotkqgIxOSQgU9dn/lWkeVf8nUm3iwX2Nl3WDw9i6AUK3vBAbZZrcJpDQ/N64AVwjT07Jef30GSSmtNu2WlW7YoyW2FlWfZFQUwk867EdLYKk9VG6JgEnBiBxkY7LMo4YLQJJlAo9l/oTvJkSARDF/XtyAzM8O2t3eT/iXa6wDN3WewNmQHdPfsxChU/KtLG2Mn8i4ZqKdSlIaBZadxJmRzVS/o4yA65RTSViq60oa395Lqw0pzY4SipwE0SXXsKV+GZraGSkr/RW08wPRvqvSUkYBMA9lPx4m24az+IHmCbXA+0faxTRE9wuGeO06DIXa6QlKJ3puIyiuAVfPr736vzo2pBirS+Vxel3TMm3JKhz9o2ZoRvaFVpIkykb0Hcm4oHFBMcNSNj7/4GJt43ogonY2Vg4nsDQIWxAcorpXACzgBqQPjYsE/VUpXpwNManEru4NwMCFPkXvMoqvoeLN3qyu/N1eWEHttMD65v19l/0kH2mR35iv/FI+yjoHJ9gPMz67af3Mq/BoWXqu3rphiWMXVkmnPSEkpGpUI2h1MThideGFEOK6YZHPwYzMBvpNC7+ZHxPb7epfefGyIB4JzO9DTNEYnDLVVHdQyvOEVefrk6Uv5kTQYVYWWdqrdcIl7yljwwIWdfQ/y+2QB3eR/qxYObuYyB4gTbo2in4PzarU1sO9nETkmj9/AoxDA+JM3GMqQtJR4jtduHtnoCLxd1gQUscHRB/MoRYIEsP2pDZ9KvHgtlk1iTbWWbHhohwFEYX7y51fUV2nuUmnoUcqnWIQAAgl9LTVX+Bc0QGNEhChxHR4YjfE51PUdGfsSFE6ck7BL3/hTf9jLq4G1IafINxOLKeAtO7quulYvH5YOBc+zX7CrMgWnW47/jfRsWnJjYYoE7xMfWV2HN2iyIqLI";const cB=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),uB=4;function L5e(t){let e=0;function r(){return t[e++]<<8|t[e++]}let n=r(),i=1,s=[0,1];for(let C=1;C>--c&1}const d=31,h=2**d,f=h>>>1,g=f>>1,p=h-1;let m=0;for(let C=0;C1;){let T=y+_>>>1;C>>1|l(),x=x<<1^f,A=(A^f)<<1|f|1;v=x,E=1+A-x}let w=n-4;return b.map(C=>{switch(C-w){case 3:return w+65792+(t[a++]<<16|t[a++]<<8|t[a++]);case 2:return w+256+(t[a++]<<8|t[a++]);case 1:return w+t[a++];default:return C-1}})}function U5e(t){let e=0;return()=>t[e++]}function jY(t){return U5e(L5e(F5e(t)))}function F5e(t){let e=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((i,s)=>e[i.charCodeAt(0)]=s);let r=t.length,n=new Uint8Array(6*r>>3);for(let i=0,s=0,o=0,a=0;i=8&&(n[s++]=a>>(o-=8));return n}function H5e(t){return t&1?~t>>1:t>>1}function q5e(t,e){let r=Array(t);for(let n=0,i=0;n{let e=Cy(t);if(e.length)return e})}function DY(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(z5e(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(W5e(r,t))}return e.flat()}function Ay(t){let e=[];for(;;){let r=t(e.length);if(!r)break;e.push(r)}return e}function MY(t,e,r){let n=Array(t).fill().map(()=>[]);for(let i=0;in[o].push(s));return n}function z5e(t,e){let r=1+e(),n=e(),i=Ay(e);return MY(i.length,1+t,e).flatMap((o,a)=>{let[c,...u]=o;return Array(i[a]).fill().map((l,d)=>{let h=d*n;return[c+d*r,u.map(f=>f+h)]})})}function W5e(t,e){let r=1+e();return MY(r,1+t,e).map(i=>[i[0],i.slice(1)])}function V5e(t){let e=[],r=Cy(t);return i(n([]),[]),e;function n(s){let o=t(),a=Ay(()=>{let c=Cy(t).map(u=>r[u]);if(c.length)return n(c)});return{S:o,B:a,Q:s}}function i({S:s,B:o},a,c){if(!(s&4&&c===a[a.length-1])){s&2&&(c=a[a.length-1]),s&1&&e.push(a);for(let u of o)for(let l of u.Q)i(u,[...a,l],c)}}}function G5e(t){return t.toString(16).toUpperCase().padStart(2,"0")}function LY(t){return`{${G5e(t)}}`}function K5e(t){let e=[];for(let r=0,n=t.length;r>24&255}function HY(t){return t&16777215}let lP,lB,dP,nC;function r4e(){let t=jY(Y5e);lP=new Map(BY(t).flatMap((e,r)=>e.map(n=>[n,r+1<<24]))),lB=new Set(Cy(t)),dP=new Map,nC=new Map;for(let[e,r]of DY(t)){if(!lB.has(e)&&r.length==2){let[n,i]=r,s=nC.get(n);s||(s=new Map,nC.set(n,s)),s.set(i,e)}dP.set(e,r.reverse())}}function qY(t){return t>=xy&&t=WC&&t=VC&&eGC&&e0&&i(GC+u)}else{let o=dP.get(s);o?r.push(...o):i(s)}if(!r.length)break;s=r.pop()}if(n&&e.length>1){let s=sb(e[0]);for(let o=1;o0&&i>=o)o==0?(e.push(n,...r),r.length=0,n=a):r.push(a),i=o;else{let c=n4e(n,a);c>=0?n=c:i==0&&o==0?(e.push(n),n=a):(r.push(a),i=o)}}return n>=0&&e.push(n,...r),e}function WY(t){return zY(t).map(HY)}function s4e(t){return i4e(zY(t))}const dB=45,VY=".",GY=65039,KY=1,ZC=t=>Array.from(t);function Sy(t,e){return t.P.has(e)||t.Q.has(e)}class o4e extends Array{get is_emoji(){return!0}}let hP,ZY,rf,fP,YY,ug,yS,F0,Dh,hB,pP;function E7(){if(hP)return;let t=jY(M5e);const e=()=>Cy(t),r=()=>new Set(e()),n=(l,d)=>d.forEach(h=>l.add(h));hP=new Map(DY(t)),ZY=r(),rf=e(),fP=new Set(e().map(l=>rf[l])),rf=new Set(rf),YY=r(),r();let i=BY(t),s=t();const o=()=>{let l=new Set;return e().forEach(d=>n(l,i[d])),n(l,e()),l};ug=Ay(l=>{let d=Ay(t).map(h=>h+96);if(d.length){let h=l>=s;d[0]-=32,d=Tm(d),h&&(d=`Restricted[${d}]`);let f=o(),g=o(),p=!t();return{N:d,P:f,Q:g,M:p,R:h}}}),yS=r(),F0=new Map;let a=e().concat(ZC(yS)).sort((l,d)=>l-d);a.forEach((l,d)=>{let h=t(),f=a[d]=h?a[d-h]:{V:[],M:new Map};f.V.push(l),yS.has(l)||F0.set(l,f)});for(let{V:l,M:d}of new Set(F0.values())){let h=[];for(let g of l){let p=ug.filter(b=>Sy(b,g)),m=h.find(({G:b})=>p.some(v=>b.has(v)));m||(m={G:new Set,V:[]},h.push(m)),m.V.push(g),n(m.G,p)}let f=h.flatMap(g=>ZC(g.G));for(let{G:g,V:p}of h){let m=new Set(f.filter(b=>!g.has(b)));for(let b of p)d.set(b,m)}}Dh=new Set;let c=new Set;const u=l=>Dh.has(l)?c.add(l):Dh.add(l);for(let l of ug){for(let d of l.P)u(d);for(let d of l.Q)u(d)}for(let l of Dh)!F0.has(l)&&!c.has(l)&&F0.set(l,KY);n(Dh,WY(Dh)),hB=V5e(t).map(l=>o4e.from(l)).sort(Z5e),pP=new Map;for(let l of hB){let d=[pP];for(let h of l){let f=d.map(g=>{let p=g.get(h);return p||(p=new Map,g.set(h,p)),p});h===GY?d.push(...f):d=f}for(let h of d)h.V=l}}function C7(t){return(JY(t)?"":`${A7(wA([t]))} `)+LY(t)}function A7(t){return`"${t}"‎`}function a4e(t){if(t.length>=4&&t[2]==dB&&t[3]==dB)throw new Error(`invalid label extension: "${Tm(t.slice(0,4))}"`)}function c4e(t){for(let r=t.lastIndexOf(95);r>0;)if(t[--r]!==95)throw new Error("underscore allowed only at start")}function u4e(t){let e=t[0],r=cB.get(e);if(r)throw vb(`leading ${r}`);let n=t.length,i=-1;for(let s=1;se&&(e>>=1,t=[...t.slice(0,e),8230,...t.slice(-e)]);let i=0,s=t.length;for(let o=0;o{let s=K5e(i),o={input:s,offset:n};n+=s.length+1;try{let a=o.tokens=w4e(s,e,r),c=a.length,u;if(!c)throw new Error("empty label");let l=o.output=a.flat();if(c4e(l),!(o.emoji=c>1||a[0].is_emoji)&&l.every(h=>h<128))a4e(l),u="ASCII";else{let h=a.flatMap(f=>f.is_emoji?[]:f);if(!h.length)u="Emoji";else{if(rf.has(l[0]))throw vb("leading combining mark");for(let p=1;po.has(a)):ZC(o),!r.length)return}else n.push(i)}if(r){for(let i of r)if(n.every(s=>Sy(i,s)))throw new Error(`whole-script confusable: ${t.N}/${i.N}`)}}function p4e(t){let e=ug;for(let r of t){let n=e.filter(i=>Sy(i,r));if(!n.length)throw ug.some(i=>Sy(i,r))?XY(e[0],r):QY(r);if(e=n,n.length==1)break}return e}function g4e(t){return t.map(({input:e,error:r,output:n})=>{if(r){let i=r.message;throw new Error(t.length==1?i:`Invalid label ${A7(wA(e,63))}: ${i}`)}return Tm(n)}).join(VY)}function QY(t){return new Error(`disallowed character: ${C7(t)}`)}function XY(t,e){let r=C7(e),n=ug.find(i=>i.P.has(e));return n&&(r=`${n.N} ${r}`),new Error(`illegal mixture: ${t.N} + ${r}`)}function vb(t){return new Error(`illegal placement: ${t}`)}function m4e(t,e){for(let r of e)if(!Sy(t,r))throw XY(t,r);if(t.M){let r=WY(e);for(let n=1,i=r.length;nuB)throw new Error(`excessive non-spacing marks: ${A7(wA(r.slice(n-1,s)))} (${s-n}/${uB})`);n=s}}}function w4e(t,e,r){let n=[],i=[];for(t=t.slice().reverse();t.length;){let s=y4e(t);if(s)i.length&&(n.push(e(i)),i=[]),n.push(r(s));else{let o=t.pop();if(Dh.has(o))i.push(o);else{let a=hP.get(o);if(a)i.push(...a);else if(!ZY.has(o))throw QY(o)}}}return i.length&&n.push(e(i)),n}function b4e(t){return t.filter(e=>e!=GY)}function y4e(t,e){let r=pP,n,i=t.length;for(;i&&(r=r.get(t[--i]),!!r);){let{V:s}=r;s&&(n=s,t.length=i)}return n}const eJ=new Uint8Array(32);eJ.fill(0);function fB(t){return ee(t.length!==0,"invalid ENS name; empty component","comp",t),t}function tJ(t){const e=Za(v4e(t)),r=[];if(t.length===0)return r;let n=0;for(let i=0;i{ee(n.length<=r,`label ${JSON.stringify(t)} exceeds ${r} bytes`,"name",t);const i=new Uint8Array(n.length+1);return i.set(n,1),i[0]=i.length-1,i})))+"00"}function vS(t,e){return{address:cr(t),storageKeys:e.map((r,n)=>(ee(vr(r,32),"invalid slot",`storageKeys[${n}]`,r),r.toLowerCase()))}}function Ap(t){if(Array.isArray(t))return t.map((r,n)=>Array.isArray(r)?(ee(r.length===2,"invalid slot set",`value[${n}]`,r),vS(r[0],r[1])):(ee(r!=null&&typeof r=="object","invalid address-slot set","value",t),vS(r.address,r.storageKeys)));ee(t!=null&&typeof t=="object","invalid access list","value",t);const e=Object.keys(t).map(r=>{const n=t[r].reduce((i,s)=>(i[s]=!0,i),{});return vS(r,Object.keys(n).sort())});return e.sort((r,n)=>r.address.localeCompare(n.address)),e}function E4e(t){let e;return typeof t=="string"?e=Ey.computePublicKey(t,!1):e=t.publicKey,cr(un("0x"+e.substring(4)).substring(26))}function C4e(t,e){return E4e(Ey.recoverPublicKey(t,e))}const An=BigInt(0),A4e=BigInt(2),x4e=BigInt(27),S4e=BigInt(28),T4e=BigInt(35),I4e=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),_S=4096*32;function pB(t,e){let r=t.toString(16);for(;r.length<2;)r="0"+r;return r+=a1(e).substring(4),"0x"+r}function bA(t){return t==="0x"?null:cr(t)}function x7(t,e){try{return Ap(t)}catch(r){ee(!1,r.message,e,t)}}function Vv(t,e){return t==="0x"?0:Et(t,e)}function Xr(t,e){if(t==="0x")return An;const r=et(t,e);return ee(r<=I4e,"value exceeds uint size",e,r),r}function Rr(t,e){const r=et(t,"value"),n=bi(r);return ee(n.length<=32,"value too large",`tx.${e}`,r),n}function S7(t){return Ap(t).map(e=>[e.address,e.storageKeys])}function P4e(t,e){ee(Array.isArray(t),`invalid ${e}`,"value",t);for(let r=0;ri.data),r.map(i=>i.commitment),r.map(i=>i.proof)])]):en(["0x03",Vf(n)])}var Oa,Sg,Tg,Ig,Pg,Og,Rg,kg,Ng,$g,jg,Bg,mf,zl,ou,Wl,Dg,iC;const Yc=class Yc{constructor(){me(this,Dg);me(this,Oa);me(this,Sg);me(this,Tg);me(this,Ig);me(this,Pg);me(this,Og);me(this,Rg);me(this,kg);me(this,Ng);me(this,$g);me(this,jg);me(this,Bg);me(this,mf);me(this,zl);me(this,ou);me(this,Wl);Z(this,Oa,null),Z(this,Sg,null),Z(this,Ig,0),Z(this,Pg,An),Z(this,Og,null),Z(this,Rg,null),Z(this,kg,null),Z(this,Tg,"0x"),Z(this,Ng,An),Z(this,$g,An),Z(this,jg,null),Z(this,Bg,null),Z(this,mf,null),Z(this,zl,null),Z(this,Wl,null),Z(this,ou,null)}get type(){return H(this,Oa)}set type(e){switch(e){case null:Z(this,Oa,null);break;case 0:case"legacy":Z(this,Oa,0);break;case 1:case"berlin":case"eip-2930":Z(this,Oa,1);break;case 2:case"london":case"eip-1559":Z(this,Oa,2);break;case 3:case"cancun":case"eip-4844":Z(this,Oa,3);break;default:ee(!1,"unsupported transaction type","type",e)}}get typeName(){switch(this.type){case 0:return"legacy";case 1:return"eip-2930";case 2:return"eip-1559";case 3:return"eip-4844"}return null}get to(){const e=H(this,Sg);return e==null&&this.type===3?_y:e}set to(e){Z(this,Sg,e==null?null:cr(e))}get nonce(){return H(this,Ig)}set nonce(e){Z(this,Ig,Et(e,"value"))}get gasLimit(){return H(this,Pg)}set gasLimit(e){Z(this,Pg,et(e))}get gasPrice(){const e=H(this,Og);return e==null&&(this.type===0||this.type===1)?An:e}set gasPrice(e){Z(this,Og,e==null?null:et(e,"gasPrice"))}get maxPriorityFeePerGas(){const e=H(this,Rg);return e??(this.type===2||this.type===3?An:null)}set maxPriorityFeePerGas(e){Z(this,Rg,e==null?null:et(e,"maxPriorityFeePerGas"))}get maxFeePerGas(){const e=H(this,kg);return e??(this.type===2||this.type===3?An:null)}set maxFeePerGas(e){Z(this,kg,e==null?null:et(e,"maxFeePerGas"))}get data(){return H(this,Tg)}set data(e){Z(this,Tg,Je(e))}get value(){return H(this,Ng)}set value(e){Z(this,Ng,et(e,"value"))}get chainId(){return H(this,$g)}set chainId(e){Z(this,$g,et(e))}get signature(){return H(this,jg)||null}set signature(e){Z(this,jg,e==null?null:Wo.from(e))}get accessList(){const e=H(this,Bg)||null;return e??(this.type===1||this.type===2||this.type===3?[]:null)}set accessList(e){Z(this,Bg,e==null?null:Ap(e))}get maxFeePerBlobGas(){const e=H(this,mf);return e==null&&this.type===3?An:e}set maxFeePerBlobGas(e){Z(this,mf,e==null?null:et(e,"maxFeePerBlobGas"))}get blobVersionedHashes(){let e=H(this,zl);return e==null&&this.type===3?[]:e}set blobVersionedHashes(e){if(e!=null){ee(Array.isArray(e),"blobVersionedHashes must be an Array","value",e),e=e.slice();for(let r=0;rObject.assign({},e))}set blobs(e){if(e==null){Z(this,Wl,null);return}const r=[],n=[];for(let i=0;i=0?2:e.pop()}inferTypes(){const e=this.gasPrice!=null,r=this.maxFeePerGas!=null||this.maxPriorityFeePerGas!=null,n=this.accessList!=null,i=H(this,mf)!=null||H(this,zl);this.maxFeePerGas!=null&&this.maxPriorityFeePerGas!=null&&Ae(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),Ae(!r||this.type!==0&&this.type!==1,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),Ae(this.type!==0||!n,"legacy transaction cannot have accessList","BAD_DATA",{value:this});const s=[];return this.type!=null?s.push(this.type):r?s.push(2):e?(s.push(1),n||s.push(0)):n?(s.push(1),s.push(2)):(i&&this.to||(s.push(0),s.push(1),s.push(2)),s.push(3)),s.sort(),s}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}clone(){return Yc.from(this)}toJSON(){const e=r=>r==null?null:r.toString();return{type:this.type,to:this.to,data:this.data,nonce:this.nonce,gasLimit:e(this.gasLimit),gasPrice:e(this.gasPrice),maxPriorityFeePerGas:e(this.maxPriorityFeePerGas),maxFeePerGas:e(this.maxFeePerGas),value:e(this.value),chainId:e(this.chainId),sig:this.signature?this.signature.toJSON():null,accessList:this.accessList}}static from(e){if(e==null)return new Yc;if(typeof e=="string"){const n=jt(e);if(n[0]>=127)return Yc.from(O4e(n));switch(n[0]){case 1:return Yc.from($4e(n));case 2:return Yc.from(k4e(n));case 3:return Yc.from(B4e(n))}Ae(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const r=new Yc;return e.type!=null&&(r.type=e.type),e.to!=null&&(r.to=e.to),e.nonce!=null&&(r.nonce=e.nonce),e.gasLimit!=null&&(r.gasLimit=e.gasLimit),e.gasPrice!=null&&(r.gasPrice=e.gasPrice),e.maxPriorityFeePerGas!=null&&(r.maxPriorityFeePerGas=e.maxPriorityFeePerGas),e.maxFeePerGas!=null&&(r.maxFeePerGas=e.maxFeePerGas),e.maxFeePerBlobGas!=null&&(r.maxFeePerBlobGas=e.maxFeePerBlobGas),e.data!=null&&(r.data=e.data),e.value!=null&&(r.value=e.value),e.chainId!=null&&(r.chainId=e.chainId),e.signature!=null&&(r.signature=Wo.from(e.signature)),e.accessList!=null&&(r.accessList=e.accessList),e.blobVersionedHashes!=null&&(r.blobVersionedHashes=e.blobVersionedHashes),e.kzg!=null&&(r.kzg=e.kzg),e.blobs!=null&&(r.blobs=e.blobs),e.hash!=null&&(ee(r.isSigned(),"unsigned transaction cannot define '.hash'","tx",e),ee(r.hash===e.hash,"hash mismatch","tx",e)),e.from!=null&&(ee(r.isSigned(),"unsigned transaction cannot define '.from'","tx",e),ee(r.from.toLowerCase()===(e.from||"").toLowerCase(),"from mismatch","tx",e)),r}};Oa=new WeakMap,Sg=new WeakMap,Tg=new WeakMap,Ig=new WeakMap,Pg=new WeakMap,Og=new WeakMap,Rg=new WeakMap,kg=new WeakMap,Ng=new WeakMap,$g=new WeakMap,jg=new WeakMap,Bg=new WeakMap,mf=new WeakMap,zl=new WeakMap,ou=new WeakMap,Wl=new WeakMap,Dg=new WeakSet,iC=function(e,r){Ae(!e||this.signature!=null,"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized","UNSUPPORTED_OPERATION",{operation:".serialized"});const n=e?this.signature:null;switch(this.inferType()){case 0:return R4e(this,n);case 1:return j4e(this,n);case 2:return N4e(this,n);case 3:return D4e(this,n,r?this.blobs:null)}Ae(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})};let YC=Yc;const rJ=new Uint8Array(32);rJ.fill(0);const M4e=BigInt(-1),nJ=BigInt(0),iJ=BigInt(1),L4e=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function U4e(t){const e=jt(t),r=e.length%32;return r?en([e,rJ.slice(r)]):Je(e)}const F4e=vd(iJ,32),H4e=vd(nJ,32),gB={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},ES=["name","version","chainId","verifyingContract","salt"];function mB(t){return function(e){return ee(typeof e=="string",`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const q4e={name:mB("name"),version:mB("version"),chainId:function(t){const e=et(t,"domain.chainId");return ee(e>=0,"invalid chain ID","domain.chainId",t),Number.isSafeInteger(e)?Number(e):J0(e)},verifyingContract:function(t){try{return cr(t).toLowerCase()}catch{}ee(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){const e=jt(t,"domain.salt");return ee(e.length===32,'invalid domain value "salt"',"domain.salt",t),Je(e)}};function CS(t){{const e=t.match(/^(u?)int(\d+)$/);if(e){const r=e[1]==="",n=parseInt(e[2]);ee(n%8===0&&n!==0&&n<=256&&e[2]===String(n),"invalid numeric width","type",t);const i=ef(L4e,r?n-1:n),s=r?(i+iJ)*M4e:nJ;return function(o){const a=et(o,"value");return ee(a>=s&&a<=i,`value out-of-bounds for ${t}`,"value",a),vd(r?qZ(a,256):a,32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return ee(r!==0&&r<=32&&e[1]===String(r),"invalid bytes width","type",t),function(n){const i=jt(n);return ee(i.length===r,`invalid length for ${t}`,"value",n),U4e(n)}}}switch(t){case"address":return function(e){return Wf(cr(e),32)};case"bool":return function(e){return e?F4e:H4e};case"bytes":return function(e){return un(e)};case"string":return function(e){return Gf(e)}}return null}function wB(t,e){return`${t}(${e.map(({name:r,type:n})=>n+" "+r).join(",")})`}function S3(t){const e=t.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/);return e?{base:e[1],index:e[2]+e[4],array:{base:e[1],prefix:e[1]+e[2],count:e[5]?parseInt(e[5]):-1}}:{base:t}}var hv,au,Mg,j6,sJ;const Ks=class Ks{constructor(e){me(this,j6);ce(this,"primaryType");me(this,hv);me(this,au);me(this,Mg);Z(this,au,new Map),Z(this,Mg,new Map);const r=new Map,n=new Map,i=new Map,s={};Object.keys(e).forEach(c=>{s[c]=e[c].map(({name:u,type:l})=>{let{base:d,index:h}=S3(l);return d==="int"&&!e.int&&(d="int256"),d==="uint"&&!e.uint&&(d="uint256"),{name:u,type:d+(h||"")}}),r.set(c,new Set),n.set(c,[]),i.set(c,new Set)}),Z(this,hv,JSON.stringify(s));for(const c in s){const u=new Set;for(const l of s[c]){ee(!u.has(l.name),`duplicate variable name ${JSON.stringify(l.name)} in ${JSON.stringify(c)}`,"types",e),u.add(l.name);const d=S3(l.type).base;ee(d!==c,`circular type reference to ${JSON.stringify(d)}`,"types",e),!CS(d)&&(ee(n.has(d),`unknown type ${JSON.stringify(d)}`,"types",e),n.get(d).push(c),r.get(c).add(d))}}const o=Array.from(n.keys()).filter(c=>n.get(c).length===0);ee(o.length!==0,"missing primary type","types",e),ee(o.length===1,`ambiguous primary types or unused types: ${o.map(c=>JSON.stringify(c)).join(", ")}`,"types",e),ut(this,{primaryType:o[0]});function a(c,u){ee(!u.has(c),`circular type reference to ${JSON.stringify(c)}`,"types",e),u.add(c);for(const l of r.get(c))if(n.has(l)){a(l,u);for(const d of u)i.get(d).add(l)}u.delete(c)}a(this.primaryType,new Set);for(const[c,u]of i){const l=Array.from(u);l.sort(),H(this,au).set(c,wB(c,s[c])+l.map(d=>wB(d,s[d])).join(""))}}get types(){return JSON.parse(H(this,hv))}getEncoder(e){let r=H(this,Mg).get(e);return r||(r=Pe(this,j6,sJ).call(this,e),H(this,Mg).set(e,r)),r}encodeType(e){const r=H(this,au).get(e);return ee(r,`unknown type: ${JSON.stringify(e)}`,"name",e),r}encodeData(e,r){return this.getEncoder(e)(r)}hashStruct(e,r){return un(this.encodeData(e,r))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,r,n){if(CS(e))return n(e,r);const i=S3(e).array;if(i)return ee(i.count===-1||i.count===r.length,`array length mismatch; expected length ${i.count}`,"value",r),r.map(o=>this._visit(i.prefix,o,n));const s=this.types[e];if(s)return s.reduce((o,{name:a,type:c})=>(o[a]=this._visit(c,r[a],n),o),{});ee(!1,`unknown type: ${e}`,"type",e)}visit(e,r){return this._visit(this.primaryType,e,r)}static from(e){return new Ks(e)}static getPrimaryType(e){return Ks.from(e).primaryType}static hashStruct(e,r,n){return Ks.from(r).hashStruct(e,n)}static hashDomain(e){const r=[];for(const n in e){if(e[n]==null)continue;const i=gB[n];ee(i,`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",e),r.push({name:n,type:i})}return r.sort((n,i)=>ES.indexOf(n.name)-ES.indexOf(i.name)),Ks.hashStruct("EIP712Domain",{EIP712Domain:r},e)}static encode(e,r,n){return en(["0x1901",Ks.hashDomain(e),Ks.from(r).hash(n)])}static hash(e,r,n){return un(Ks.encode(e,r,n))}static async resolveNames(e,r,n,i){e=Object.assign({},e);for(const a in e)e[a]==null&&delete e[a];const s={};e.verifyingContract&&!vr(e.verifyingContract,20)&&(s[e.verifyingContract]="0x");const o=Ks.from(r);o.visit(n,(a,c)=>(a==="address"&&!vr(c,20)&&(s[c]="0x"),c));for(const a in s)s[a]=await i(a);return e.verifyingContract&&s[e.verifyingContract]&&(e.verifyingContract=s[e.verifyingContract]),n=o.visit(n,(a,c)=>a==="address"&&s[c]?s[c]:c),{domain:e,value:n}}static getPayload(e,r,n){Ks.hashDomain(e);const i={},s=[];ES.forEach(c=>{const u=e[c];u!=null&&(i[c]=q4e[c](u),s.push({name:c,type:gB[c]}))});const o=Ks.from(r);r=o.types;const a=Object.assign({},r);return ee(a.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",r),a.EIP712Domain=s,o.encode(n),{types:a,domain:i,primaryType:o.primaryType,message:o.visit(n,(c,u)=>{if(c.match(/^bytes(\d*)/))return Je(jt(u));if(c.match(/^u?int/))return et(u).toString();switch(c){case"address":return u.toLowerCase();case"bool":return!!u;case"string":return ee(typeof u=="string","invalid string","value",u),u}ee(!1,"unsupported type","type",c)})}}};hv=new WeakMap,au=new WeakMap,Mg=new WeakMap,j6=new WeakSet,sJ=function(e){{const i=CS(e);if(i)return i}const r=S3(e).array;if(r){const i=r.prefix,s=this.getEncoder(i);return o=>{ee(r.count===-1||r.count===o.length,`array length mismatch; expected length ${r.count}`,"value",o);let a=o.map(s);return H(this,au).has(i)&&(a=a.map(un)),un(en(a))}}const n=this.types[e];if(n){const i=Gf(H(this,au).get(e));return s=>{const o=n.map(({name:a,type:c})=>{const u=this.getEncoder(c)(s[a]);return H(this,au).has(c)?un(u):u});return o.unshift(i),en(o)}}ee(!1,`unknown type: ${e}`,"type",e)};let JC=Ks;function _i(t){const e=new Set;return t.forEach(r=>e.add(r)),Object.freeze(e)}const z4e="external public payable override",W4e=_i(z4e.split(" ")),oJ="constant external internal payable private public pure view override",V4e=_i(oJ.split(" ")),aJ="constructor error event fallback function receive struct",cJ=_i(aJ.split(" ")),uJ="calldata memory storage payable indexed",G4e=_i(uJ.split(" ")),K4e="tuple returns",Z4e=[aJ,uJ,K4e,oJ].join(" "),Y4e=_i(Z4e.split(" ")),J4e={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},Q4e=new RegExp("^(\\s*)"),X4e=new RegExp("^([0-9]+)"),eCe=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),lJ=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),dJ=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");var Dn,jo,fv,mP;const B6=class B6{constructor(e){me(this,fv);me(this,Dn);me(this,jo);Z(this,Dn,0),Z(this,jo,e.slice())}get offset(){return H(this,Dn)}get length(){return H(this,jo).length-H(this,Dn)}clone(){return new B6(H(this,jo))}reset(){Z(this,Dn,0)}popKeyword(e){const r=this.peek();if(r.type!=="KEYWORD"||!e.has(r.text))throw new Error(`expected keyword ${r.text}`);return this.pop().text}popType(e){if(this.peek().type!==e){const r=this.peek();throw new Error(`expected ${e}; got ${r.type} ${JSON.stringify(r.text)}`)}return this.pop().text}popParen(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const r=Pe(this,fv,mP).call(this,H(this,Dn)+1,e.match+1);return Z(this,Dn,e.match+1),r}popParams(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const r=[];for(;H(this,Dn)=H(this,jo).length)throw new Error("out-of-bounds");return H(this,jo)[H(this,Dn)]}peekKeyword(e){const r=this.peekType("KEYWORD");return r!=null&&e.has(r)?r:null}peekType(e){if(this.length===0)return null;const r=this.peek();return r.type===e?r.text:null}pop(){const e=this.peek();return I1(this,Dn)._++,e}toString(){const e=[];for(let r=H(this,Dn);r`}};Dn=new WeakMap,jo=new WeakMap,fv=new WeakSet,mP=function(e=0,r=0){return new B6(H(this,jo).slice(e,r).map(n=>Object.freeze(Object.assign({},n,{match:n.match-e,linkBack:n.linkBack-e,linkNext:n.linkNext-e}))))};let Vo=B6;function Bd(t){const e=[],r=o=>{const a=s0&&e[e.length-1].type==="NUMBER"){const d=e.pop().text;l=d+l,e[e.length-1].value=Et(d)}if(e.length===0||e[e.length-1].type!=="BRACKET")throw new Error("missing opening bracket");e[e.length-1].text+=l}continue}if(a=o.match(eCe),a){if(c.text=a[1],s+=c.text.length,Y4e.has(c.text)){c.type="KEYWORD";continue}if(c.text.match(dJ)){c.type="TYPE";continue}c.type="ID";continue}if(a=o.match(X4e),a){c.text=a[1],c.type="NUMBER",s+=c.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(o[0])} at position ${s}`)}return new Vo(e.map(o=>Object.freeze(o)))}function bB(t,e){let r=[];for(const n in e.keys())t.has(n)&&r.push(n);if(r.length>1)throw new Error(`conflicting types: ${r.join(", ")}`)}function yA(t,e){if(e.peekKeyword(cJ)){const r=e.pop().text;if(r!==t)throw new Error(`expected ${t}, got ${r}`)}return e.popType("ID")}function Nu(t,e){const r=new Set;for(;;){const n=t.peekType("KEYWORD");if(n==null||e&&!e.has(n))break;if(t.pop(),r.has(n))throw new Error(`duplicate keywords: ${JSON.stringify(n)}`);r.add(n)}return Object.freeze(r)}function hJ(t){let e=Nu(t,V4e);return bB(e,_i("constant payable nonpayable".split(" "))),bB(e,_i("pure view payable nonpayable".split(" "))),e.has("view")?"view":e.has("pure")?"pure":e.has("payable")?"payable":e.has("nonpayable")?"nonpayable":e.has("constant")?"view":"nonpayable"}function Su(t,e){return t.popParams().map(r=>Hn.from(r,e))}function fJ(t){if(t.peekType("AT")){if(t.pop(),t.peekType("NUMBER"))return et(t.pop().text);throw new Error("invalid gas")}return null}function Kf(t){if(t.length)throw new Error(`unexpected tokens at offset ${t.offset}: ${t.toString()}`)}const tCe=new RegExp(/^(.*)\[([0-9]*)\]$/);function yB(t){const e=t.match(dJ);if(ee(e,"invalid type","type",t),t==="uint")return"uint256";if(t==="int")return"int256";if(e[2]){const r=parseInt(e[2]);ee(r!==0&&r<=32,"invalid bytes length","type",t)}else if(e[3]){const r=parseInt(e[3]);ee(r!==0&&r<=256&&r%8===0,"invalid numeric width","type",t)}return t}const Lr={},Zi=Symbol.for("_ethers_internal"),vB="_ParamTypeInternal",_B="_ErrorInternal",EB="_EventInternal",CB="_ConstructorInternal",AB="_FallbackInternal",xB="_FunctionInternal",SB="_StructInternal";var Lg,sC;const Zs=class Zs{constructor(e,r,n,i,s,o,a,c){me(this,Lg);ce(this,"name");ce(this,"type");ce(this,"baseType");ce(this,"indexed");ce(this,"components");ce(this,"arrayLength");ce(this,"arrayChildren");if(zv(e,Lr,"ParamType"),Object.defineProperty(this,Zi,{value:vB}),o&&(o=Object.freeze(o.slice())),i==="array"){if(a==null||c==null)throw new Error("")}else if(a!=null||c!=null)throw new Error("");if(i==="tuple"){if(o==null)throw new Error("")}else if(o!=null)throw new Error("");ut(this,{name:r,type:n,baseType:i,indexed:s,components:o,arrayLength:a,arrayChildren:c})}format(e){if(e==null&&(e="sighash"),e==="json"){const n=this.name||"";if(this.isArray()){const s=JSON.parse(this.arrayChildren.format("json"));return s.name=n,s.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(s)}const i={type:this.baseType==="tuple"?"tuple":this.type,name:n};return typeof this.indexed=="boolean"&&(i.indexed=this.indexed),this.isTuple()&&(i.components=this.components.map(s=>JSON.parse(s.format(e)))),JSON.stringify(i)}let r="";return this.isArray()?(r+=this.arrayChildren.format(e),r+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?r+="("+this.components.map(n=>n.format(e)).join(e==="full"?", ":",")+")":r+=this.type,e!=="sighash"&&(this.indexed===!0&&(r+=" indexed"),e==="full"&&this.name&&(r+=" "+this.name)),r}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(e,r){if(this.isArray()){if(!Array.isArray(e))throw new Error("invalid array value");if(this.arrayLength!==-1&&e.length!==this.arrayLength)throw new Error("array is wrong length");const n=this;return e.map(i=>n.arrayChildren.walk(i,r))}if(this.isTuple()){if(!Array.isArray(e))throw new Error("invalid tuple value");if(e.length!==this.components.length)throw new Error("array is wrong length");const n=this;return e.map((i,s)=>n.components[s].walk(i,r))}return r(this.type,e)}async walkAsync(e,r){const n=[],i=[e];return Pe(this,Lg,sC).call(this,n,e,r,s=>{i[0]=s}),n.length&&await Promise.all(n),i[0]}static from(e,r){if(Zs.isParamType(e))return e;if(typeof e=="string")try{return Zs.from(Bd(e),r)}catch{ee(!1,"invalid param type","obj",e)}else if(e instanceof Vo){let a="",c="",u=null;Nu(e,_i(["tuple"])).has("tuple")||e.peekType("OPEN_PAREN")?(c="tuple",u=e.popParams().map(p=>Zs.from(p)),a=`tuple(${u.map(p=>p.format()).join(",")})`):(a=yB(e.popType("TYPE")),c=a);let l=null,d=null;for(;e.length&&e.peekType("BRACKET");){const p=e.pop();l=new Zs(Lr,"",a,c,null,u,d,l),d=p.value,a+=p.text,c="array",u=null}let h=null;if(Nu(e,G4e).has("indexed")){if(!r)throw new Error("");h=!0}const g=e.peekType("ID")?e.pop().text:"";if(e.length)throw new Error("leftover tokens");return new Zs(Lr,g,a,c,h,u,d,l)}const n=e.name;ee(!n||typeof n=="string"&&n.match(lJ),"invalid name","obj.name",n);let i=e.indexed;i!=null&&(ee(r,"parameter cannot be indexed","obj.indexed",e.indexed),i=!!i);let s=e.type,o=s.match(tCe);if(o){const a=parseInt(o[2]||"-1"),c=Zs.from({type:o[1],components:e.components});return new Zs(Lr,n||"",s,"array",i,null,a,c)}if(s==="tuple"||s.startsWith("tuple(")||s.startsWith("(")){const a=e.components!=null?e.components.map(u=>Zs.from(u)):null;return new Zs(Lr,n||"",s,"tuple",i,a,null,null)}return s=yB(e.type),new Zs(Lr,n||"",s,s,i,null,null,null)}static isParamType(e){return e&&e[Zi]===vB}};Lg=new WeakSet,sC=function(e,r,n,i){if(this.isArray()){if(!Array.isArray(r))throw new Error("invalid array value");if(this.arrayLength!==-1&&r.length!==this.arrayLength)throw new Error("array is wrong length");const o=this.arrayChildren,a=r.slice();a.forEach((c,u)=>{var l;Pe(l=o,Lg,sC).call(l,e,c,n,d=>{a[u]=d})}),i(a);return}if(this.isTuple()){const o=this.components;let a;if(Array.isArray(r))a=r.slice();else{if(r==null||typeof r!="object")throw new Error("invalid tuple value");a=o.map(c=>{if(!c.name)throw new Error("cannot use object value with unnamed components");if(!(c.name in r))throw new Error(`missing value for component ${c.name}`);return r[c.name]})}if(a.length!==this.components.length)throw new Error("array is wrong length");a.forEach((c,u)=>{var l;Pe(l=o[u],Lg,sC).call(l,e,c,n,d=>{a[u]=d})}),i(a);return}const s=n(this.type,r);s.then?e.push(async function(){i(await s)}()):i(s)};let Hn=Zs;class Zf{constructor(e,r,n){ce(this,"type");ce(this,"inputs");zv(e,Lr,"Fragment"),n=Object.freeze(n.slice()),ut(this,{type:r,inputs:n})}static from(e){if(typeof e=="string"){try{Zf.from(JSON.parse(e))}catch{}return Zf.from(Bd(e))}if(e instanceof Vo)switch(e.peekKeyword(cJ)){case"constructor":return bu.from(e);case"error":return Gi.from(e);case"event":return Fa.from(e);case"fallback":case"receive":return Xc.from(e);case"function":return Ha.from(e);case"struct":return kf.from(e)}else if(typeof e=="object"){switch(e.type){case"constructor":return bu.from(e);case"error":return Gi.from(e);case"event":return Fa.from(e);case"fallback":case"receive":return Xc.from(e);case"function":return Ha.from(e);case"struct":return kf.from(e)}Ae(!1,`unsupported type: ${e.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}ee(!1,"unsupported frgament object","obj",e)}static isConstructor(e){return bu.isFragment(e)}static isError(e){return Gi.isFragment(e)}static isEvent(e){return Fa.isFragment(e)}static isFunction(e){return Ha.isFragment(e)}static isStruct(e){return kf.isFragment(e)}}class vA extends Zf{constructor(r,n,i,s){super(r,n,s);ce(this,"name");ee(typeof i=="string"&&i.match(lJ),"invalid identifier","name",i),s=Object.freeze(s.slice()),ut(this,{name:i})}}function Ty(t,e){return"("+e.map(r=>r.format(t)).join(t==="full"?", ":",")+")"}class Gi extends vA{constructor(e,r,n){super(e,"error",r,n),Object.defineProperty(this,Zi,{value:_B})}get selector(){return Gf(this.format("sighash")).substring(0,10)}format(e){if(e==null&&(e="sighash"),e==="json")return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});const r=[];return e!=="sighash"&&r.push("error"),r.push(this.name+Ty(e,this.inputs)),r.join(" ")}static from(e){if(Gi.isFragment(e))return e;if(typeof e=="string")return Gi.from(Bd(e));if(e instanceof Vo){const r=yA("error",e),n=Su(e);return Kf(e),new Gi(Lr,r,n)}return new Gi(Lr,e.name,e.inputs?e.inputs.map(Hn.from):[])}static isFragment(e){return e&&e[Zi]===_B}}class Fa extends vA{constructor(r,n,i,s){super(r,"event",n,i);ce(this,"anonymous");Object.defineProperty(this,Zi,{value:EB}),ut(this,{anonymous:s})}get topicHash(){return Gf(this.format("sighash"))}format(r){if(r==null&&(r="sighash"),r==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(i=>JSON.parse(i.format(r)))});const n=[];return r!=="sighash"&&n.push("event"),n.push(this.name+Ty(r,this.inputs)),r!=="sighash"&&this.anonymous&&n.push("anonymous"),n.join(" ")}static getTopicHash(r,n){return n=(n||[]).map(s=>Hn.from(s)),new Fa(Lr,r,n,!1).topicHash}static from(r){if(Fa.isFragment(r))return r;if(typeof r=="string")try{return Fa.from(Bd(r))}catch{ee(!1,"invalid event fragment","obj",r)}else if(r instanceof Vo){const n=yA("event",r),i=Su(r,!0),s=!!Nu(r,_i(["anonymous"])).has("anonymous");return Kf(r),new Fa(Lr,n,i,s)}return new Fa(Lr,r.name,r.inputs?r.inputs.map(n=>Hn.from(n,!0)):[],!!r.anonymous)}static isFragment(r){return r&&r[Zi]===EB}}class bu extends Zf{constructor(r,n,i,s,o){super(r,n,i);ce(this,"payable");ce(this,"gas");Object.defineProperty(this,Zi,{value:CB}),ut(this,{payable:s,gas:o})}format(r){if(Ae(r!=null&&r!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),r==="json")return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(i=>JSON.parse(i.format(r)))});const n=[`constructor${Ty(r,this.inputs)}`];return this.payable&&n.push("payable"),this.gas!=null&&n.push(`@${this.gas.toString()}`),n.join(" ")}static from(r){if(bu.isFragment(r))return r;if(typeof r=="string")try{return bu.from(Bd(r))}catch{ee(!1,"invalid constuctor fragment","obj",r)}else if(r instanceof Vo){Nu(r,_i(["constructor"]));const n=Su(r),i=!!Nu(r,W4e).has("payable"),s=fJ(r);return Kf(r),new bu(Lr,"constructor",n,i,s)}return new bu(Lr,"constructor",r.inputs?r.inputs.map(Hn.from):[],!!r.payable,r.gas!=null?r.gas:null)}static isFragment(r){return r&&r[Zi]===CB}}class Xc extends Zf{constructor(r,n,i){super(r,"fallback",n);ce(this,"payable");Object.defineProperty(this,Zi,{value:AB}),ut(this,{payable:i})}format(r){const n=this.inputs.length===0?"receive":"fallback";if(r==="json"){const i=this.payable?"payable":"nonpayable";return JSON.stringify({type:n,stateMutability:i})}return`${n}()${this.payable?" payable":""}`}static from(r){if(Xc.isFragment(r))return r;if(typeof r=="string")try{return Xc.from(Bd(r))}catch{ee(!1,"invalid fallback fragment","obj",r)}else if(r instanceof Vo){const n=r.toString(),i=r.peekKeyword(_i(["fallback","receive"]));if(ee(i,"type must be fallback or receive","obj",n),r.popKeyword(_i(["fallback","receive"]))==="receive"){const c=Su(r);return ee(c.length===0,"receive cannot have arguments","obj.inputs",c),Nu(r,_i(["payable"])),Kf(r),new Xc(Lr,[],!0)}let o=Su(r);o.length?ee(o.length===1&&o[0].type==="bytes","invalid fallback inputs","obj.inputs",o.map(c=>c.format("minimal")).join(", ")):o=[Hn.from("bytes")];const a=hJ(r);if(ee(a==="nonpayable"||a==="payable","fallback cannot be constants","obj.stateMutability",a),Nu(r,_i(["returns"])).has("returns")){const c=Su(r);ee(c.length===1&&c[0].type==="bytes","invalid fallback outputs","obj.outputs",c.map(u=>u.format("minimal")).join(", "))}return Kf(r),new Xc(Lr,o,a==="payable")}if(r.type==="receive")return new Xc(Lr,[],!0);if(r.type==="fallback"){const n=[Hn.from("bytes")],i=r.stateMutability==="payable";return new Xc(Lr,n,i)}ee(!1,"invalid fallback description","obj",r)}static isFragment(r){return r&&r[Zi]===AB}}class Ha extends vA{constructor(r,n,i,s,o,a){super(r,"function",n,s);ce(this,"constant");ce(this,"outputs");ce(this,"stateMutability");ce(this,"payable");ce(this,"gas");Object.defineProperty(this,Zi,{value:xB}),o=Object.freeze(o.slice()),ut(this,{constant:i==="view"||i==="pure",gas:a,outputs:o,payable:i==="payable",stateMutability:i})}get selector(){return Gf(this.format("sighash")).substring(0,10)}format(r){if(r==null&&(r="sighash"),r==="json")return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(i=>JSON.parse(i.format(r))),outputs:this.outputs.map(i=>JSON.parse(i.format(r)))});const n=[];return r!=="sighash"&&n.push("function"),n.push(this.name+Ty(r,this.inputs)),r!=="sighash"&&(this.stateMutability!=="nonpayable"&&n.push(this.stateMutability),this.outputs&&this.outputs.length&&(n.push("returns"),n.push(Ty(r,this.outputs))),this.gas!=null&&n.push(`@${this.gas.toString()}`)),n.join(" ")}static getSelector(r,n){return n=(n||[]).map(s=>Hn.from(s)),new Ha(Lr,r,"view",n,[],null).selector}static from(r){if(Ha.isFragment(r))return r;if(typeof r=="string")try{return Ha.from(Bd(r))}catch{ee(!1,"invalid function fragment","obj",r)}else if(r instanceof Vo){const i=yA("function",r),s=Su(r),o=hJ(r);let a=[];Nu(r,_i(["returns"])).has("returns")&&(a=Su(r));const c=fJ(r);return Kf(r),new Ha(Lr,i,o,s,a,c)}let n=r.stateMutability;return n==null&&(n="payable",typeof r.constant=="boolean"?(n="view",r.constant||(n="payable",typeof r.payable=="boolean"&&!r.payable&&(n="nonpayable"))):typeof r.payable=="boolean"&&!r.payable&&(n="nonpayable")),new Ha(Lr,r.name,n,r.inputs?r.inputs.map(Hn.from):[],r.outputs?r.outputs.map(Hn.from):[],r.gas!=null?r.gas:null)}static isFragment(r){return r&&r[Zi]===xB}}class kf extends vA{constructor(e,r,n){super(e,"struct",r,n),Object.defineProperty(this,Zi,{value:SB})}format(){throw new Error("@TODO")}static from(e){if(typeof e=="string")try{return kf.from(Bd(e))}catch{ee(!1,"invalid struct fragment","obj",e)}else if(e instanceof Vo){const r=yA("struct",e),n=Su(e);return Kf(e),new kf(Lr,r,n)}return new kf(Lr,e.name,e.inputs?e.inputs.map(Hn.from):[])}static isFragment(e){return e&&e[Zi]===SB}}const ra=new Map;ra.set(0,"GENERIC_PANIC");ra.set(1,"ASSERT_FALSE");ra.set(17,"OVERFLOW");ra.set(18,"DIVIDE_BY_ZERO");ra.set(33,"ENUM_RANGE_ERROR");ra.set(34,"BAD_STORAGE_DATA");ra.set(49,"STACK_UNDERFLOW");ra.set(50,"ARRAY_RANGE_ERROR");ra.set(65,"OUT_OF_MEMORY");ra.set(81,"UNINITIALIZED_FUNCTION_CALL");const rCe=new RegExp(/^bytes([0-9]*)$/),nCe=new RegExp(/^(u?int)([0-9]*)$/);let AS=null,TB=1024;function iCe(t,e,r,n){let i="missing revert data",s=null;const o=null;let a=null;if(r){i="execution reverted";const u=jt(r);if(r=Je(r),u.length===0)i+=" (no data present; likely require(false) occurred",s="require(false)";else if(u.length%32!==4)i+=" (could not decode reason; invalid data length)";else if(Je(u.slice(0,4))==="0x08c379a0")try{s=n.decode(["string"],u.slice(4))[0],a={signature:"Error(string)",name:"Error",args:[s]},i+=`: ${JSON.stringify(s)}`}catch{i+=" (could not decode reason; invalid string data)"}else if(Je(u.slice(0,4))==="0x4e487b71")try{const l=Number(n.decode(["uint256"],u.slice(4))[0]);a={signature:"Panic(uint256)",name:"Panic",args:[l]},s=`Panic due to ${ra.get(l)||"UNKNOWN"}(${l})`,i+=`: ${s}`}catch{i+=" (could not decode panic code)"}else i+=" (unknown custom error)"}const c={to:e.to?cr(e.to):null,data:e.data||"0x"};return e.from&&(c.from=cr(e.from)),Hr(i,"CALL_EXCEPTION",{action:t,data:r,reason:s,transaction:c,invocation:o,revert:a})}var Vl,H0;const D6=class D6{constructor(){me(this,Vl)}getDefaultValue(e){const r=e.map(i=>Pe(this,Vl,H0).call(this,Hn.from(i)));return new x3(r,"_").defaultValue()}encode(e,r){UZ(r.length,e.length,"types/values length mismatch");const n=e.map(o=>Pe(this,Vl,H0).call(this,Hn.from(o))),i=new x3(n,"_"),s=new rP;return i.encode(s,r),s.data}decode(e,r,n){const i=e.map(o=>Pe(this,Vl,H0).call(this,Hn.from(o)));return new x3(i,"_").decode(new nP(r,n,TB))}static _setDefaultMaxInflation(e){ee(typeof e=="number"&&Number.isInteger(e),"invalid defaultMaxInflation factor","value",e),TB=e}static defaultAbiCoder(){return AS==null&&(AS=new D6),AS}static getBuiltinCallException(e,r,n){return iCe(e,r,n,D6.defaultAbiCoder())}};Vl=new WeakSet,H0=function(e){if(e.isArray())return new T5e(Pe(this,Vl,H0).call(this,e.arrayChildren),e.arrayLength,e.name);if(e.isTuple())return new x3(e.components.map(n=>Pe(this,Vl,H0).call(this,n)),e.name);switch(e.baseType){case"address":return new x5e(e.name);case"bool":return new I5e(e.name);case"string":return new D5e(e.name);case"bytes":return new P5e(e.name);case"":return new k5e(e.name)}let r=e.type.match(nCe);if(r){let n=parseInt(r[2]||"256");return ee(n!==0&&n<=256&&n%8===0,"invalid "+r[1]+" bit length","param",e),new B5e(n/8,r[1]==="int",e.name)}if(r=e.type.match(rCe),r){let n=parseInt(r[1]);return ee(n!==0&&n<=32,"invalid bytes length","param",e),new O5e(n,e.name)}ee(!1,"invalid type","type",e.type)};let Iy=D6;class sCe{constructor(e,r,n){ce(this,"fragment");ce(this,"name");ce(this,"signature");ce(this,"topic");ce(this,"args");const i=e.name,s=e.format();ut(this,{fragment:e,name:i,signature:s,topic:r,args:n})}}class oCe{constructor(e,r,n,i){ce(this,"fragment");ce(this,"name");ce(this,"args");ce(this,"signature");ce(this,"selector");ce(this,"value");const s=e.name,o=e.format();ut(this,{fragment:e,name:s,args:n,signature:o,selector:r,value:i})}}class aCe{constructor(e,r,n){ce(this,"fragment");ce(this,"name");ce(this,"args");ce(this,"signature");ce(this,"selector");const i=e.name,s=e.format();ut(this,{fragment:e,name:i,args:n,signature:s,selector:r})}}class IB{constructor(e){ce(this,"hash");ce(this,"_isIndexed");ut(this,{hash:e,_isIndexed:!0})}static isIndexed(e){return!!(e&&e._isIndexed)}}const PB={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"},OB={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:t=>`reverted with reason string ${JSON.stringify(t)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:t=>{let e="unknown panic code";return t>=0&&t<=255&&PB[t.toString()]&&(e=PB[t.toString()]),`reverted with panic code 0x${t.toString(16)} (${e})`}}};var Ra,ka,Na,Jn,Ya,oC,aC;const Kh=class Kh{constructor(e){me(this,Ya);ce(this,"fragments");ce(this,"deploy");ce(this,"fallback");ce(this,"receive");me(this,Ra);me(this,ka);me(this,Na);me(this,Jn);let r=[];typeof e=="string"?r=JSON.parse(e):r=e,Z(this,Na,new Map),Z(this,Ra,new Map),Z(this,ka,new Map);const n=[];for(const o of r)try{n.push(Zf.from(o))}catch(a){console.log(`[Warning] Invalid Fragment ${JSON.stringify(o)}:`,a.message)}ut(this,{fragments:Object.freeze(n)});let i=null,s=!1;Z(this,Jn,this.getAbiCoder()),this.fragments.forEach((o,a)=>{let c;switch(o.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}ut(this,{deploy:o});return;case"fallback":o.inputs.length===0?s=!0:(ee(!i||o.payable!==i.payable,"conflicting fallback fragments",`fragments[${a}]`,o),i=o,s=i.payable);return;case"function":c=H(this,Na);break;case"event":c=H(this,ka);break;case"error":c=H(this,Ra);break;default:return}const u=o.format();c.has(u)||c.set(u,o)}),this.deploy||ut(this,{deploy:bu.from("constructor()")}),ut(this,{fallback:i,receive:s})}format(e){const r=e?"minimal":"full";return this.fragments.map(i=>i.format(r))}formatJson(){const e=this.fragments.map(r=>r.format("json"));return JSON.stringify(e.map(r=>JSON.parse(r)))}getAbiCoder(){return Iy.defaultAbiCoder()}getFunctionName(e){const r=Pe(this,Ya,oC).call(this,e,null,!1);return ee(r,"no matching function","key",e),r.name}hasFunction(e){return!!Pe(this,Ya,oC).call(this,e,null,!1)}getFunction(e,r){return Pe(this,Ya,oC).call(this,e,r||null,!0)}forEachFunction(e){const r=Array.from(H(this,Na).keys());r.sort((n,i)=>n.localeCompare(i));for(let n=0;nn.localeCompare(i));for(let n=0;n1){const s=i.map(o=>JSON.stringify(o.format())).join(", ");ee(!1,`ambiguous error description (i.e. ${s})`,"name",e)}return i[0]}if(e=Gi.from(e).format(),e==="Error(string)")return Gi.from("error Error(string)");if(e==="Panic(uint256)")return Gi.from("error Panic(uint256)");const n=H(this,Ra).get(e);return n||null}forEachError(e){const r=Array.from(H(this,Ra).keys());r.sort((n,i)=>n.localeCompare(i));for(let n=0;ns.type==="string"?Gf(o):s.type==="bytes"?un(Je(o)):(s.type==="bool"&&typeof o=="boolean"?o=o?"0x01":"0x00":s.type.match(/^u?int/)?o=vd(o):s.type.match(/^bytes/)?o=I_e(o,32):s.type==="address"&&H(this,Jn).encode(["address"],[o]),Wf(Je(o),32));for(r.forEach((s,o)=>{const a=e.inputs[o];if(!a.indexed){ee(s==null,"cannot filter non-indexed parameters; must be null","contract."+a.name,s);return}s==null?n.push(null):a.baseType==="array"||a.baseType==="tuple"?ee(!1,"filtering with tuples or arrays not supported","contract."+a.name,s):Array.isArray(s)?n.push(s.map(c=>i(a,c))):n.push(i(a,s))});n.length&&n[n.length-1]===null;)n.pop();return n}encodeEventLog(e,r){if(typeof e=="string"){const o=this.getEvent(e);ee(o,"unknown event","eventFragment",e),e=o}const n=[],i=[],s=[];return e.anonymous||n.push(e.topicHash),ee(r.length===e.inputs.length,"event arguments/values mismatch","values",r),e.inputs.forEach((o,a)=>{const c=r[a];if(o.indexed)if(o.type==="string")n.push(Gf(c));else if(o.type==="bytes")n.push(un(c));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");n.push(H(this,Jn).encode([o.type],[c]))}else i.push(o),s.push(c)}),{data:H(this,Jn).encode(i,s),topics:n}}decodeEventLog(e,r,n){if(typeof e=="string"){const f=this.getEvent(e);ee(f,"unknown event","eventFragment",e),e=f}if(n!=null&&!e.anonymous){const f=e.topicHash;ee(vr(n[0],32)&&n[0].toLowerCase()===f,"fragment/topic mismatch","topics[0]",n[0]),n=n.slice(1)}const i=[],s=[],o=[];e.inputs.forEach((f,g)=>{f.indexed?f.type==="string"||f.type==="bytes"||f.baseType==="tuple"||f.baseType==="array"?(i.push(Hn.from({type:"bytes32",name:f.name})),o.push(!0)):(i.push(f),o.push(!1)):(s.push(f),o.push(!1))});const a=n!=null?H(this,Jn).decode(i,en(n)):null,c=H(this,Jn).decode(s,r,!0),u=[],l=[];let d=0,h=0;return e.inputs.forEach((f,g)=>{let p=null;if(f.indexed)if(a==null)p=new IB(null);else if(o[g])p=new IB(a[h++]);else try{p=a[h++]}catch(m){p=m}else try{p=c[d++]}catch(m){p=m}u.push(p),l.push(f.name||null)}),Em.fromItems(u,l)}parseTransaction(e){const r=jt(e.data,"tx.data"),n=et(e.value!=null?e.value:0,"tx.value"),i=this.getFunction(Je(r.slice(0,4)));if(!i)return null;const s=H(this,Jn).decode(i.inputs,r.slice(4));return new oCe(i,i.selector,s,n)}parseCallResult(e){throw new Error("@TODO")}parseLog(e){const r=this.getEvent(e.topics[0]);return!r||r.anonymous?null:new sCe(r,r.topicHash,this.decodeEventLog(r,e.data,e.topics))}parseError(e){const r=Je(e),n=this.getError(qr(r,0,4));if(!n)return null;const i=H(this,Jn).decode(n.inputs,qr(r,4));return new aCe(n,n.selector,i)}static from(e){return e instanceof Kh?e:typeof e=="string"?new Kh(JSON.parse(e)):typeof e.formatJson=="function"?new Kh(e.formatJson()):typeof e.format=="function"?new Kh(e.format("json")):new Kh(e)}};Ra=new WeakMap,ka=new WeakMap,Na=new WeakMap,Jn=new WeakMap,Ya=new WeakSet,oC=function(e,r,n){if(vr(e)){const s=e.toLowerCase();for(const o of H(this,Na).values())if(s===o.selector)return o;return null}if(e.indexOf("(")===-1){const s=[];for(const[o,a]of H(this,Na))o.split("(")[0]===e&&s.push(a);if(r){const o=r.length>0?r[r.length-1]:null;let a=r.length,c=!0;ri.isTyped(o)&&o.type==="overrides"&&(c=!1,a--);for(let u=s.length-1;u>=0;u--){const l=s[u].inputs.length;l!==a&&(!c||l!==a-1)&&s.splice(u,1)}for(let u=s.length-1;u>=0;u--){const l=s[u].inputs;for(let d=0;d=l.length){if(r[d].type==="overrides")continue;s.splice(u,1);break}if(r[d].type!==l[d].baseType){s.splice(u,1);break}}}}if(s.length===1&&r&&r.length!==s[0].inputs.length){const o=r[r.length-1];(o==null||Array.isArray(o)||typeof o!="object")&&s.splice(0,1)}if(s.length===0)return null;if(s.length>1&&n){const o=s.map(a=>JSON.stringify(a.format())).join(", ");ee(!1,`ambiguous function description (i.e. matches ${o})`,"key",e)}return s[0]}const i=H(this,Na).get(Ha.from(e).format());return i||null},aC=function(e,r,n){if(vr(e)){const s=e.toLowerCase();for(const o of H(this,ka).values())if(s===o.topicHash)return o;return null}if(e.indexOf("(")===-1){const s=[];for(const[o,a]of H(this,ka))o.split("(")[0]===e&&s.push(a);if(r){for(let o=s.length-1;o>=0;o--)s[o].inputs.length=0;o--){const a=s[o].inputs;for(let c=0;c1&&n){const o=s.map(a=>JSON.stringify(a.format())).join(", ");ee(!1,`ambiguous event description (i.e. matches ${o})`,"key",e)}return s[0]}const i=H(this,ka).get(Fa.from(e).format());return i||null};let wP=Kh;const pJ=BigInt(0);function lg(t){return t??null}function Vr(t){return t==null?null:t.toString()}class RB{constructor(e,r,n){ce(this,"gasPrice");ce(this,"maxFeePerGas");ce(this,"maxPriorityFeePerGas");ut(this,{gasPrice:lg(e),maxFeePerGas:lg(r),maxPriorityFeePerGas:lg(n)})}toJSON(){const{gasPrice:e,maxFeePerGas:r,maxPriorityFeePerGas:n}=this;return{_type:"FeeData",gasPrice:Vr(e),maxFeePerGas:Vr(r),maxPriorityFeePerGas:Vr(n)}}}function QC(t){const e={};t.to&&(e.to=t.to),t.from&&(e.from=t.from),t.data&&(e.data=Je(t.data));const r="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const i of r)!(i in t)||t[i]==null||(e[i]=et(t[i],`request.${i}`));const n="type,nonce".split(/,/);for(const i of n)!(i in t)||t[i]==null||(e[i]=Et(t[i],`request.${i}`));return t.accessList&&(e.accessList=Ap(t.accessList)),"blockTag"in t&&(e.blockTag=t.blockTag),"enableCcipRead"in t&&(e.enableCcipRead=!!t.enableCcipRead),"customData"in t&&(e.customData=t.customData),"blobVersionedHashes"in t&&t.blobVersionedHashes&&(e.blobVersionedHashes=t.blobVersionedHashes.slice()),"kzg"in t&&(e.kzg=t.kzg),"blobs"in t&&t.blobs&&(e.blobs=t.blobs.map(i=>h7(i)?Je(i):Object.assign({},i))),e}var cu;class cCe{constructor(e,r){ce(this,"provider");ce(this,"number");ce(this,"hash");ce(this,"timestamp");ce(this,"parentHash");ce(this,"parentBeaconBlockRoot");ce(this,"nonce");ce(this,"difficulty");ce(this,"gasLimit");ce(this,"gasUsed");ce(this,"stateRoot");ce(this,"receiptsRoot");ce(this,"blobGasUsed");ce(this,"excessBlobGas");ce(this,"miner");ce(this,"prevRandao");ce(this,"extraData");ce(this,"baseFeePerGas");me(this,cu);Z(this,cu,e.transactions.map(n=>typeof n!="string"?new Py(n,r):n)),ut(this,{provider:r,hash:lg(e.hash),number:e.number,timestamp:e.timestamp,parentHash:e.parentHash,parentBeaconBlockRoot:e.parentBeaconBlockRoot,nonce:e.nonce,difficulty:e.difficulty,gasLimit:e.gasLimit,gasUsed:e.gasUsed,blobGasUsed:e.blobGasUsed,excessBlobGas:e.excessBlobGas,miner:e.miner,prevRandao:lg(e.prevRandao),extraData:e.extraData,baseFeePerGas:lg(e.baseFeePerGas),stateRoot:e.stateRoot,receiptsRoot:e.receiptsRoot})}get transactions(){return H(this,cu).map(e=>typeof e=="string"?e:e.hash)}get prefetchedTransactions(){const e=H(this,cu).slice();return e.length===0?[]:(Ae(typeof e[0]=="object","transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"}),e)}toJSON(){const{baseFeePerGas:e,difficulty:r,extraData:n,gasLimit:i,gasUsed:s,hash:o,miner:a,prevRandao:c,nonce:u,number:l,parentHash:d,parentBeaconBlockRoot:h,stateRoot:f,receiptsRoot:g,timestamp:p,transactions:m}=this;return{_type:"Block",baseFeePerGas:Vr(e),difficulty:Vr(r),extraData:n,gasLimit:Vr(i),gasUsed:Vr(s),blobGasUsed:Vr(this.blobGasUsed),excessBlobGas:Vr(this.excessBlobGas),hash:o,miner:a,prevRandao:c,nonce:u,number:l,parentHash:d,timestamp:p,parentBeaconBlockRoot:h,stateRoot:f,receiptsRoot:g,transactions:m}}[Symbol.iterator](){let e=0;const r=this.transactions;return{next:()=>enew Gv(i,r))));let n=pJ;e.effectiveGasPrice!=null?n=e.effectiveGasPrice:e.gasPrice!=null&&(n=e.gasPrice),ut(this,{provider:r,to:e.to,from:e.from,contractAddress:e.contractAddress,hash:e.hash,index:e.index,blockHash:e.blockHash,blockNumber:e.blockNumber,logsBloom:e.logsBloom,gasUsed:e.gasUsed,cumulativeGasUsed:e.cumulativeGasUsed,blobGasUsed:e.blobGasUsed,gasPrice:n,blobGasPrice:e.blobGasPrice,type:e.type,status:e.status,root:e.root})}get logs(){return H(this,pv)}toJSON(){const{to:e,from:r,contractAddress:n,hash:i,index:s,blockHash:o,blockNumber:a,logsBloom:c,logs:u,status:l,root:d}=this;return{_type:"TransactionReceipt",blockHash:o,blockNumber:a,contractAddress:n,cumulativeGasUsed:Vr(this.cumulativeGasUsed),from:r,gasPrice:Vr(this.gasPrice),blobGasUsed:Vr(this.blobGasUsed),blobGasPrice:Vr(this.blobGasPrice),gasUsed:Vr(this.gasUsed),hash:i,index:s,logs:u,logsBloom:c,root:d,status:l,to:e}}get length(){return this.logs.length}[Symbol.iterator](){let e=0;return{next:()=>e{if(a)return null;const{blockNumber:h,nonce:f}=await mi({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(f{if(h==null||h.status!==0)return h;Ae(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:h.to,from:h.from,data:""},receipt:h})},l=await this.provider.getTransactionReceipt(this.hash);if(n===0)return u(l);if(l){if(await l.confirmations()>=n)return u(l)}else if(await c(),n===0)return null;return await new Promise((h,f)=>{const g=[],p=()=>{g.forEach(b=>b())};if(g.push(()=>{a=!0}),i>0){const b=setTimeout(()=>{p(),f(Hr("wait for transaction timeout","TIMEOUT"))},i);g.push(()=>{clearTimeout(b)})}const m=async b=>{if(await b.confirmations()>=n){p();try{h(u(b))}catch(v){f(v)}}};if(g.push(()=>{this.provider.off(this.hash,m)}),this.provider.on(this.hash,m),s>=0){const b=async()=>{try{await c()}catch(v){if(ti(v,"TRANSACTION_REPLACED")){p(),f(v);return}}a||this.provider.once("block",b)};g.push(()=>{this.provider.off("block",b)}),this.provider.once("block",b)}})}isMined(){return this.blockHash!=null}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}removedEvent(){return Ae(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),wJ(this)}reorderedEvent(e){return Ae(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),Ae(!e||e.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),mJ(this,e)}replaceableTransaction(e){ee(Number.isInteger(e)&&e>=0,"invalid startBlock","startBlock",e);const r=new CR(this,this.provider);return Z(r,Gl,e),r}};Gl=new WeakMap;let Py=CR;function uCe(t){return{orphan:"drop-block",hash:t.hash,number:t.number}}function mJ(t,e){return{orphan:"reorder-transaction",tx:t,other:e}}function wJ(t){return{orphan:"drop-transaction",tx:t}}function lCe(t){return{orphan:"drop-log",log:{transactionHash:t.transactionHash,blockHash:t.blockHash,blockNumber:t.blockNumber,address:t.address,data:t.data,topics:Object.freeze(t.topics.slice()),index:t.index}}}class I7 extends Gv{constructor(r,n,i){super(r,r.provider);ce(this,"interface");ce(this,"fragment");ce(this,"args");const s=n.decodeEventLog(i,r.data,r.topics);ut(this,{args:s,fragment:i,interface:n})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class bJ extends Gv{constructor(r,n){super(r,r.provider);ce(this,"error");ut(this,{error:n})}}var Ug;class dCe extends gJ{constructor(r,n,i){super(i,n);me(this,Ug);Z(this,Ug,r)}get logs(){return super.logs.map(r=>{const n=r.topics.length?H(this,Ug).getEvent(r.topics[0]):null;if(n)try{return new I7(r,H(this,Ug),n)}catch(i){return new bJ(r,i)}return r})}}Ug=new WeakMap;var gv;class P7 extends Py{constructor(r,n,i){super(i,n);me(this,gv);Z(this,gv,r)}async wait(r,n){const i=await super.wait(r,n);return i==null?null:new dCe(H(this,gv),this.provider,i)}}gv=new WeakMap;class yJ extends zZ{constructor(r,n,i,s){super(r,n,i);ce(this,"log");ut(this,{log:s})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}}class hCe extends yJ{constructor(e,r,n,i,s){super(e,r,n,new I7(s,e.interface,i));const o=e.interface.decodeEventLog(i,this.log.data,this.log.topics);ut(this,{args:o,fragment:i})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const kB=BigInt(0);function vJ(t){return t&&typeof t.call=="function"}function _J(t){return t&&typeof t.estimateGas=="function"}function _A(t){return t&&typeof t.resolveName=="function"}function EJ(t){return t&&typeof t.sendTransaction=="function"}function CJ(t){if(t!=null){if(_A(t))return t;if(t.provider)return t.provider}}var mv;class fCe{constructor(e,r,n){me(this,mv);ce(this,"fragment");if(ut(this,{fragment:r}),r.inputs.lengthn[c]==null?null:a.walkAsync(n[c],(l,d)=>l==="address"?Array.isArray(d)?Promise.all(d.map(h=>vi(h,s))):vi(d,s):d)));return e.interface.encodeFilterTopics(r,o)}())}getTopicFilter(){return H(this,mv)}}mv=new WeakMap;function Yf(t,e){return t==null?null:typeof t[e]=="function"?t:t.provider&&typeof t.provider[e]=="function"?t.provider:null}function nf(t){return t==null?null:t.provider||null}async function AJ(t,e){const r=ri.dereference(t,"overrides");ee(typeof r=="object","invalid overrides parameter","overrides",t);const n=QC(r);return ee(n.to==null||(e||[]).indexOf("to")>=0,"cannot override to","overrides.to",n.to),ee(n.data==null||(e||[]).indexOf("data")>=0,"cannot override data","overrides.data",n.data),n.from&&(n.from=n.from),n}async function pCe(t,e,r){const n=Yf(t,"resolveName"),i=_A(n)?n:null;return await Promise.all(e.map((s,o)=>s.walkAsync(r[o],(a,c)=>(c=ri.dereference(c,a),a==="address"?vi(c,i):c))))}function gCe(t){const e=async function(o){const a=await AJ(o,["data"]);a.to=await t.getAddress(),a.from&&(a.from=await vi(a.from,CJ(t.runner)));const c=t.interface,u=et(a.value||kB,"overrides.value")===kB,l=(a.data||"0x")==="0x";c.fallback&&!c.fallback.payable&&c.receive&&!l&&!u&&ee(!1,"cannot send data to receive or send value to non-payable fallback","overrides",o),ee(c.fallback||l,"cannot send data to receive-only contract","overrides.data",a.data);const d=c.receive||c.fallback&&c.fallback.payable;return ee(d||u,"cannot send value to non-payable fallback","overrides.value",a.value),ee(c.fallback||l,"cannot send data to receive-only contract","overrides.data",a.data),a},r=async function(o){const a=Yf(t.runner,"call");Ae(vJ(a),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const c=await e(o);try{return await a.call(c)}catch(u){throw d7(u)&&u.data?t.interface.makeError(u.data,c):u}},n=async function(o){const a=t.runner;Ae(EJ(a),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const c=await a.sendTransaction(await e(o)),u=nf(t.runner);return new P7(t.interface,u,c)},i=async function(o){const a=Yf(t.runner,"estimateGas");return Ae(_J(a),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await a.estimateGas(await e(o))},s=async o=>await n(o);return ut(s,{_contract:t,estimateGas:i,populateTransaction:e,send:n,staticCall:r}),s}function mCe(t,e){const r=function(...u){const l=t.interface.getFunction(e,u);return Ae(l,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:u}}),l},n=async function(...u){const l=r(...u);let d={};if(l.inputs.length+1===u.length&&(d=await AJ(u.pop()),d.from&&(d.from=await vi(d.from,CJ(t.runner)))),l.inputs.length!==u.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const h=await pCe(t.runner,l.inputs,u);return Object.assign({},d,await mi({to:t.getAddress(),data:t.interface.encodeFunctionData(l,h)}))},i=async function(...u){const l=await a(...u);return l.length===1?l[0]:l},s=async function(...u){const l=t.runner;Ae(EJ(l),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const d=await l.sendTransaction(await n(...u)),h=nf(t.runner);return new P7(t.interface,h,d)},o=async function(...u){const l=Yf(t.runner,"estimateGas");return Ae(_J(l),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await l.estimateGas(await n(...u))},a=async function(...u){const l=Yf(t.runner,"call");Ae(vJ(l),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const d=await n(...u);let h="0x";try{h=await l.call(d)}catch(g){throw d7(g)&&g.data?t.interface.makeError(g.data,d):g}const f=r(...u);return t.interface.decodeFunctionResult(f,h)},c=async(...u)=>r(...u).constant?await i(...u):await s(...u);return ut(c,{name:t.interface.getFunctionName(e),_contract:t,_key:e,getFragment:r,estimateGas:o,populateTransaction:n,send:s,staticCall:i,staticCallResult:a}),Object.defineProperty(c,"fragment",{configurable:!1,enumerable:!0,get:()=>{const u=t.interface.getFunction(e);return Ae(u,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),u}}),c}function wCe(t,e){const r=function(...i){const s=t.interface.getEvent(e,i);return Ae(s,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:i}}),s},n=function(...i){return new fCe(t,r(...i),i)};return ut(n,{name:t.interface.getEventName(e),_contract:t,_key:e,getFragment:r}),Object.defineProperty(n,"fragment",{configurable:!1,enumerable:!0,get:()=>{const i=t.interface.getEvent(e);return Ae(i,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),i}}),n}const XC=Symbol.for("_ethersInternal_contract"),xJ=new WeakMap;function bCe(t,e){xJ.set(t[XC],e)}function fs(t){return xJ.get(t[XC])}function yCe(t){return t&&typeof t=="object"&&"getTopicFilter"in t&&typeof t.getTopicFilter=="function"&&t.fragment}async function O7(t,e){let r,n=null;if(Array.isArray(e)){const s=function(o){if(vr(o,32))return o;const a=t.interface.getEvent(o);return ee(a,"unknown fragment","name",o),a.topicHash};r=e.map(o=>o==null?null:Array.isArray(o)?o.map(s):s(o))}else e==="*"?r=[null]:typeof e=="string"?vr(e,32)?r=[e]:(n=t.interface.getEvent(e),ee(n,"unknown fragment","event",e),r=[n.topicHash]):yCe(e)?r=await e.getTopicFilter():"fragment"in e?(n=e.fragment,r=[n.topicHash]):ee(!1,"unknown event name","event",e);r=r.map(s=>{if(s==null)return null;if(Array.isArray(s)){const o=Array.from(new Set(s.map(a=>a.toLowerCase())).values());return o.length===1?o[0]:(o.sort(),o)}return s.toLowerCase()});const i=r.map(s=>s==null?"null":Array.isArray(s)?s.join("|"):s).join("&");return{fragment:n,tag:i,topics:r}}async function ob(t,e){const{subs:r}=fs(t);return r.get((await O7(t,e)).tag)||null}async function NB(t,e,r){const n=nf(t.runner);Ae(n,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:e});const{fragment:i,tag:s,topics:o}=await O7(t,r),{addr:a,subs:c}=fs(t);let u=c.get(s);if(!u){const d={address:a||t,topics:o},h=m=>{let b=i;if(b==null)try{b=t.interface.getEvent(m.topics[0])}catch{}if(b){const v=b,E=i?t.interface.decodeEventLog(i,m.data,m.topics):[];yP(t,r,E,w=>new hCe(t,w,r,v,m))}else yP(t,r,[],v=>new yJ(t,v,r,m))};let f=[];u={tag:s,listeners:[],start:()=>{f.length||f.push(n.on(d,h))},stop:async()=>{if(f.length==0)return;let m=f;f=[],await Promise.all(m),n.off(d,h)}},c.set(s,u)}return u}let bP=Promise.resolve();async function vCe(t,e,r,n){await bP;const i=await ob(t,e);if(!i)return!1;const s=i.listeners.length;return i.listeners=i.listeners.filter(({listener:o,once:a})=>{const c=Array.from(r);n&&c.push(n(a?null:o));try{o.call(t,...c)}catch{}return!a}),i.listeners.length===0&&(i.stop(),fs(t).subs.delete(i.tag)),s>0}async function yP(t,e,r,n){try{await bP}catch{}const i=vCe(t,e,r,n);return bP=i,await i}const T3=["then"];var KW;KW=XC;const Sb=class Sb{constructor(e,r,n,i){ce(this,"target");ce(this,"interface");ce(this,"runner");ce(this,"filters");ce(this,KW);ce(this,"fallback");ee(typeof e=="string"||RY(e),"invalid value for Contract target","target",e),n==null&&(n=null);const s=wP.from(r);ut(this,{target:e,runner:n,interface:s}),Object.defineProperty(this,XC,{value:{}});let o,a=null,c=null;if(i){const d=nf(n);c=new P7(this.interface,d,i)}let u=new Map;if(typeof e=="string")if(vr(e))a=e,o=Promise.resolve(e);else{const d=Yf(n,"resolveName");if(!_A(d))throw Hr("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});o=d.resolveName(e).then(h=>{if(h==null)throw Hr("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:e});return fs(this).addr=h,h})}else o=e.getAddress().then(d=>{if(d==null)throw new Error("TODO");return fs(this).addr=d,d});bCe(this,{addrPromise:o,addr:a,deployTx:c,subs:u});const l=new Proxy({},{get:(d,h,f)=>{if(typeof h=="symbol"||T3.indexOf(h)>=0)return Reflect.get(d,h,f);try{return this.getEvent(h)}catch(g){if(!ti(g,"INVALID_ARGUMENT")||g.argument!=="key")throw g}},has:(d,h)=>T3.indexOf(h)>=0?Reflect.has(d,h):Reflect.has(d,h)||this.interface.hasEvent(String(h))});return ut(this,{filters:l}),ut(this,{fallback:s.receive||s.fallback?gCe(this):null}),new Proxy(this,{get:(d,h,f)=>{if(typeof h=="symbol"||h in d||T3.indexOf(h)>=0)return Reflect.get(d,h,f);try{return d.getFunction(h)}catch(g){if(!ti(g,"INVALID_ARGUMENT")||g.argument!=="key")throw g}},has:(d,h)=>typeof h=="symbol"||h in d||T3.indexOf(h)>=0?Reflect.has(d,h):d.interface.hasFunction(h)})}connect(e){return new Sb(this.target,this.interface,e)}attach(e){return new Sb(e,this.interface,this.runner)}async getAddress(){return await fs(this).addrPromise}async getDeployedCode(){const e=nf(this.runner);Ae(e,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const r=await e.getCode(await this.getAddress());return r==="0x"?null:r}async waitForDeployment(){const e=this.deploymentTransaction();if(e)return await e.wait(),this;if(await this.getDeployedCode()!=null)return this;const n=nf(this.runner);return Ae(n!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((i,s)=>{const o=async()=>{try{if(await this.getDeployedCode()!=null)return i(this);n.once("block",o)}catch(a){s(a)}};o()})}deploymentTransaction(){return fs(this).deployTx}getFunction(e){return typeof e!="string"&&(e=e.format()),mCe(this,e)}getEvent(e){return typeof e!="string"&&(e=e.format()),wCe(this,e)}async queryTransaction(e){throw new Error("@TODO")}async queryFilter(e,r,n){r==null&&(r=0),n==null&&(n="latest");const{addr:i,addrPromise:s}=fs(this),o=i||await s,{fragment:a,topics:c}=await O7(this,e),u={address:o,topics:c,fromBlock:r,toBlock:n},l=nf(this.runner);return Ae(l,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await l.getLogs(u)).map(d=>{let h=a;if(h==null)try{h=this.interface.getEvent(d.topics[0])}catch{}if(h)try{return new I7(d,this.interface,h)}catch(f){return new bJ(d,f)}return new Gv(d,l)})}async on(e,r){const n=await NB(this,"on",e);return n.listeners.push({listener:r,once:!1}),n.start(),this}async once(e,r){const n=await NB(this,"once",e);return n.listeners.push({listener:r,once:!0}),n.start(),this}async emit(e,...r){return await yP(this,e,r,null)}async listenerCount(e){if(e){const i=await ob(this,e);return i?i.listeners.length:0}const{subs:r}=fs(this);let n=0;for(const{listeners:i}of r.values())n+=i.length;return n}async listeners(e){if(e){const i=await ob(this,e);return i?i.listeners.map(({listener:s})=>s):[]}const{subs:r}=fs(this);let n=[];for(const{listeners:i}of r.values())n=n.concat(i.map(({listener:s})=>s));return n}async off(e,r){const n=await ob(this,e);if(!n)return this;if(r){const i=n.listeners.map(({listener:s})=>s).indexOf(r);i>=0&&n.listeners.splice(i,1)}return(r==null||n.listeners.length===0)&&(n.stop(),fs(this).subs.delete(n.tag)),this}async removeAllListeners(e){if(e){const r=await ob(this,e);if(!r)return this;r.stop(),fs(this).subs.delete(r.tag)}else{const{subs:r}=fs(this);for(const{tag:n,stop:i}of r.values())i(),r.delete(n)}return this}async addListener(e,r){return await this.on(e,r)}async removeListener(e,r){return await this.off(e,r)}static buildClass(e){class r extends Sb{constructor(i,s=null){super(i,e,s)}}return r}static from(e,r,n){return n==null&&(n=null),new this(e,r,n)}};let vP=Sb;function _Ce(){return vP}class dg extends _Ce(){}function xS(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):ee(!1,"unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}class ECe{constructor(e){ce(this,"name");ut(this,{name:e})}connect(e){return this}supportsCoinType(e){return!1}async encodeAddress(e,r){throw new Error("unsupported coin")}async decodeAddress(e,r){throw new Error("unsupported coin")}}const SJ=new RegExp("^(ipfs)://(.*)$","i"),$B=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),SJ,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];var Kl,wf,Zl,q0,M6,TJ;const tg=class tg{constructor(e,r,n){me(this,Zl);ce(this,"provider");ce(this,"address");ce(this,"name");me(this,Kl);me(this,wf);ut(this,{provider:e,address:r,name:n}),Z(this,Kl,null),Z(this,wf,new dg(r,["function supportsInterface(bytes4) view returns (bool)","function resolve(bytes, bytes) view returns (bytes)","function addr(bytes32) view returns (address)","function addr(bytes32, uint) view returns (bytes)","function text(bytes32, string) view returns (string)","function contenthash(bytes32) view returns (bytes)"],e))}async supportsWildcard(){return H(this,Kl)==null&&Z(this,Kl,(async()=>{try{return await H(this,wf).supportsInterface("0x9061b923")}catch(e){if(ti(e,"CALL_EXCEPTION"))return!1;throw Z(this,Kl,null),e}})()),await H(this,Kl)}async getAddress(e){if(e==null&&(e=60),e===60)try{const s=await Pe(this,Zl,q0).call(this,"addr(bytes32)");return s==null||s===_y?null:s}catch(s){if(ti(s,"CALL_EXCEPTION"))return null;throw s}if(e>=0&&e<2147483648){let s=e+2147483648;const o=await Pe(this,Zl,q0).call(this,"addr(bytes32,uint)",[s]);if(vr(o,20))return cr(o)}let r=null;for(const s of this.provider.plugins)if(s instanceof ECe&&s.supportsCoinType(e)){r=s;break}if(r==null)return null;const n=await Pe(this,Zl,q0).call(this,"addr(bytes32,uint)",[e]);if(n==null||n==="0x")return null;const i=await r.decodeAddress(e,n);if(i!=null)return i;Ae(!1,"invalid coin data","UNSUPPORTED_OPERATION",{operation:`getAddress(${e})`,info:{coinType:e,data:n}})}async getText(e){const r=await Pe(this,Zl,q0).call(this,"text(bytes32,string)",[e]);return r==null||r==="0x"?null:r}async getContentHash(){const e=await Pe(this,Zl,q0).call(this,"contenthash(bytes32)");if(e==null||e==="0x")return null;const r=e.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(r){const i=r[1]==="e3010170"?"ipfs":"ipns",s=parseInt(r[4],16);if(r[5].length===s*2)return`${i}://${O_e("0x"+r[2])}`}const n=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(n&&n[1].length===64)return`bzz://${n[1]}`;Ae(!1,"invalid or unsupported content hash data","UNSUPPORTED_OPERATION",{operation:"getContentHash()",info:{data:e}})}async getAvatar(){return(await this._getAvatar()).url}async _getAvatar(){const e=[{type:"name",value:this.name}];try{const r=await this.getText("avatar");if(r==null)return e.push({type:"!avatar",value:""}),{url:null,linkage:e};e.push({type:"avatar",value:r});for(let n=0;n<$B.length;n++){const i=r.match($B[n]);if(i==null)continue;const s=i[1].toLowerCase();switch(s){case"https":case"data":return e.push({type:"url",value:r}),{linkage:e,url:r};case"ipfs":{const o=xS(r);return e.push({type:"ipfs",value:r}),e.push({type:"url",value:o}),{linkage:e,url:o}}case"erc721":case"erc1155":{const o=s==="erc721"?"tokenURI(uint256)":"uri(uint256)";e.push({type:s,value:r});const a=await this.getAddress();if(a==null)return e.push({type:"!owner",value:""}),{url:null,linkage:e};const c=(i[2]||"").split("/");if(c.length!==2)return e.push({type:`!${s}caip`,value:i[2]||""}),{url:null,linkage:e};const u=c[1],l=new dg(c[0],["function tokenURI(uint) view returns (string)","function ownerOf(uint) view returns (address)","function uri(uint) view returns (string)","function balanceOf(address, uint256) view returns (uint)"],this.provider);if(s==="erc721"){const p=await l.ownerOf(u);if(a!==p)return e.push({type:"!owner",value:p}),{url:null,linkage:e};e.push({type:"owner",value:p})}else if(s==="erc1155"){const p=await l.balanceOf(a,u);if(!p)return e.push({type:"!balance",value:"0"}),{url:null,linkage:e};e.push({type:"balance",value:p.toString()})}let d=await l[o](u);if(d==null||d==="0x")return e.push({type:"!metadata-url",value:""}),{url:null,linkage:e};e.push({type:"metadata-url-base",value:d}),s==="erc1155"&&(d=d.replace("{id}",vd(u,32).substring(2)),e.push({type:"metadata-url-expanded",value:d})),d.match(/^ipfs:/i)&&(d=xS(d)),e.push({type:"metadata-url",value:d});let h={};const f=await new ku(d).send();f.assertOk();try{h=f.bodyJson}catch{try{e.push({type:"!metadata",value:f.bodyText})}catch{const b=f.body;return b&&e.push({type:"!metadata",value:Je(b)}),{url:null,linkage:e}}return{url:null,linkage:e}}if(!h)return e.push({type:"!metadata",value:""}),{url:null,linkage:e};e.push({type:"metadata",value:JSON.stringify(h)});let g=h.image;if(typeof g!="string")return e.push({type:"!imageUrl",value:""}),{url:null,linkage:e};if(!g.match(/^(https:\/\/|data:)/i)){if(g.match(SJ)==null)return e.push({type:"!imageUrl-ipfs",value:g}),{url:null,linkage:e};e.push({type:"imageUrl-ipfs",value:g}),g=xS(g)}return e.push({type:"url",value:g}),{linkage:e,url:g}}}}}catch{}return{linkage:e,url:null}}static async getEnsAddress(e){const r=await e.getNetwork(),n=r.getPlugin("org.ethers.plugins.network.Ens");return Ae(n,"network does not support ENS","UNSUPPORTED_OPERATION",{operation:"getEnsAddress",info:{network:r}}),n.address}static async fromName(e,r){var i;let n=r;for(;;){if(n===""||n==="."||r!=="eth"&&n==="eth")return null;const s=await Pe(i=tg,M6,TJ).call(i,e,n);if(s!=null){const o=new tg(e,s,r);return n!==r&&!await o.supportsWildcard()?null:o}n=n.split(".").slice(1).join(".")}}};Kl=new WeakMap,wf=new WeakMap,Zl=new WeakSet,q0=async function(e,r){r=(r||[]).slice();const n=H(this,wf).interface;r.unshift(gP(this.name));let i=null;await this.supportsWildcard()&&(i=n.getFunction(e),Ae(i,"missing fragment","UNKNOWN_ERROR",{info:{funcName:e}}),r=[_4e(this.name,255),n.encodeFunctionData(i,r)],e="resolve(bytes,bytes)"),r.push({enableCcipRead:!0});try{const s=await H(this,wf)[e](...r);return i?n.decodeFunctionResult(i,s)[0]:s}catch(s){if(!ti(s,"CALL_EXCEPTION"))throw s}return null},M6=new WeakSet,TJ=async function(e,r){const n=await tg.getEnsAddress(e);try{const s=await new dg(n,["function resolver(bytes32) view returns (address)"],e).resolver(gP(r),{enableCcipRead:!0});return s===_y?null:s}catch(i){throw i}return null},me(tg,M6);let e6=tg;const jB=BigInt(0);function Nt(t,e){return function(r){return r==null?e:t(r)}}function EA(t,e){return r=>{if(e&&r==null)return null;if(!Array.isArray(r))throw new Error("not an array");return r.map(n=>t(n))}}function Kv(t,e){return r=>{const n={};for(const i in t){let s=i;if(e&&i in e&&!(s in r)){for(const o of e[i])if(o in r){s=o;break}}try{const o=t[i](r[s]);o!==void 0&&(n[i]=o)}catch(o){const a=o instanceof Error?o.message:"not-an-error";Ae(!1,`invalid value for value.${i} (${a})`,"BAD_DATA",{value:r})}}return n}}function CCe(t){switch(t){case!0:case"true":return!0;case!1:case"false":return!1}ee(!1,`invalid boolean; ${JSON.stringify(t)}`,"value",t)}function Pm(t){return ee(vr(t,!0),"invalid data","value",t),t}function Un(t){return ee(vr(t,32),"invalid hash","value",t),t}const ACe=Kv({address:cr,blockHash:Un,blockNumber:Et,data:Pm,index:Et,removed:Nt(CCe,!1),topics:EA(Un),transactionHash:Un,transactionIndex:Et},{index:["logIndex"]});function xCe(t){return ACe(t)}const SCe=Kv({hash:Nt(Un),parentHash:Un,parentBeaconBlockRoot:Nt(Un,null),number:Et,timestamp:Et,nonce:Nt(Pm),difficulty:et,gasLimit:et,gasUsed:et,stateRoot:Nt(Un,null),receiptsRoot:Nt(Un,null),blobGasUsed:Nt(et,null),excessBlobGas:Nt(et,null),miner:Nt(cr),prevRandao:Nt(Un,null),extraData:Pm,baseFeePerGas:Nt(et)},{prevRandao:["mixHash"]});function TCe(t){const e=SCe(t);return e.transactions=t.transactions.map(r=>typeof r=="string"?r:IJ(r)),e}const ICe=Kv({transactionIndex:Et,blockNumber:Et,transactionHash:Un,address:cr,topics:EA(Un),data:Pm,index:Et,blockHash:Un},{index:["logIndex"]});function PCe(t){return ICe(t)}const OCe=Kv({to:Nt(cr,null),from:Nt(cr,null),contractAddress:Nt(cr,null),index:Et,root:Nt(Je),gasUsed:et,blobGasUsed:Nt(et,null),logsBloom:Nt(Pm),blockHash:Un,hash:Un,logs:EA(PCe),blockNumber:Et,cumulativeGasUsed:et,effectiveGasPrice:Nt(et),blobGasPrice:Nt(et,null),status:Nt(Et),type:Nt(Et,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function RCe(t){return OCe(t)}function IJ(t){t.to&&et(t.to)===jB&&(t.to="0x0000000000000000000000000000000000000000");const e=Kv({hash:Un,index:Nt(Et,void 0),type:r=>r==="0x"||r==null?0:Et(r),accessList:Nt(Ap,null),blobVersionedHashes:Nt(EA(Un,!0),null),blockHash:Nt(Un,null),blockNumber:Nt(Et,null),transactionIndex:Nt(Et,null),from:cr,gasPrice:Nt(et),maxPriorityFeePerGas:Nt(et),maxFeePerGas:Nt(et),maxFeePerBlobGas:Nt(et,null),gasLimit:et,to:Nt(cr,null),value:et,nonce:Et,data:Pm,creates:Nt(cr,null),chainId:Nt(et,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(t);if(e.to==null&&e.creates==null&&(e.creates=A5e(e)),(t.type===1||t.type===2)&&t.accessList==null&&(e.accessList=[]),t.signature?e.signature=Wo.from(t.signature):e.signature=Wo.from(t),e.chainId==null){const r=e.signature.legacyChainId;r!=null&&(e.chainId=r)}return e.blockHash&&et(e.blockHash)===jB&&(e.blockHash=null),e}const kCe="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";class Zv{constructor(e){ce(this,"name");ut(this,{name:e})}clone(){return new Zv(this.name)}}class CA extends Zv{constructor(r,n){r==null&&(r=0);super(`org.ethers.network.plugins.GasCost#${r||0}`);ce(this,"effectiveBlock");ce(this,"txBase");ce(this,"txCreate");ce(this,"txDataZero");ce(this,"txDataNonzero");ce(this,"txAccessListStorageKey");ce(this,"txAccessListAddress");const i={effectiveBlock:r};function s(o,a){let c=(n||{})[o];c==null&&(c=a),ee(typeof c=="number",`invalud value for ${o}`,"costs",n),i[o]=c}s("txBase",21e3),s("txCreate",32e3),s("txDataZero",4),s("txDataNonzero",16),s("txAccessListStorageKey",1900),s("txAccessListAddress",2400),ut(this,i)}clone(){return new CA(this.effectiveBlock,this)}}class AA extends Zv{constructor(r,n){super("org.ethers.plugins.network.Ens");ce(this,"address");ce(this,"targetNetwork");ut(this,{address:r||kCe,targetNetwork:n??1})}clone(){return new AA(this.address,this.targetNetwork)}}var wv,bv;class NCe extends Zv{constructor(r,n){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin");me(this,wv);me(this,bv);Z(this,wv,r),Z(this,bv,n)}get url(){return H(this,wv)}get processFunc(){return H(this,bv)}clone(){return this}}wv=new WeakMap,bv=new WeakMap;const SS=new Map;var Fg,Hg,Yl;const rg=class rg{constructor(e,r){me(this,Fg);me(this,Hg);me(this,Yl);Z(this,Fg,e),Z(this,Hg,et(r)),Z(this,Yl,new Map)}toJSON(){return{name:this.name,chainId:String(this.chainId)}}get name(){return H(this,Fg)}set name(e){Z(this,Fg,e)}get chainId(){return H(this,Hg)}set chainId(e){Z(this,Hg,et(e,"chainId"))}matches(e){if(e==null)return!1;if(typeof e=="string"){try{return this.chainId===et(e)}catch{}return this.name===e}if(typeof e=="number"||typeof e=="bigint"){try{return this.chainId===et(e)}catch{}return!1}if(typeof e=="object"){if(e.chainId!=null){try{return this.chainId===et(e.chainId)}catch{}return!1}return e.name!=null?this.name===e.name:!1}return!1}get plugins(){return Array.from(H(this,Yl).values())}attachPlugin(e){if(H(this,Yl).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return H(this,Yl).set(e.name,e.clone()),this}getPlugin(e){return H(this,Yl).get(e)||null}getPlugins(e){return this.plugins.filter(r=>r.name.split("#")[0]===e)}clone(){const e=new rg(this.name,this.chainId);return this.plugins.forEach(r=>{e.attachPlugin(r.clone())}),e}computeIntrinsicGas(e){const r=this.getPlugin("org.ethers.plugins.network.GasCost")||new CA;let n=r.txBase;if(e.to==null&&(n+=r.txCreate),e.data)for(let i=2;i9){let i=BigInt(n[1].substring(0,9));n[1].substring(9).match(/^0+$/)||i++,n[1]=i.toString()}return BigInt(n[0]+n[1])}function DB(t){return new NCe(t,async(e,r,n)=>{n.setHeader("User-Agent","ethers");let i;try{const[s,o]=await Promise.all([n.send(),e()]);i=s;const a=i.bodyJson.standard;return{gasPrice:o.gasPrice,maxFeePerGas:BB(a.maxFee,9),maxPriorityFeePerGas:BB(a.maxPriorityFee,9)}}catch(s){Ae(!1,`error encountered with polygon gas station (${JSON.stringify(n.url)})`,"SERVER_ERROR",{request:n,response:i,error:s})}})}let MB=!1;function $Ce(){if(MB)return;MB=!0;function t(e,r,n){const i=function(){const s=new Wa(e,r);return n.ensNetwork!=null&&s.attachPlugin(new AA(null,n.ensNetwork)),s.attachPlugin(new CA),(n.plugins||[]).forEach(o=>{s.attachPlugin(o)}),s};Wa.register(e,i),Wa.register(r,i),n.altNames&&n.altNames.forEach(s=>{Wa.register(s,i)})}t("mainnet",1,{ensNetwork:1,altNames:["homestead"]}),t("ropsten",3,{ensNetwork:3}),t("rinkeby",4,{ensNetwork:4}),t("goerli",5,{ensNetwork:5}),t("kovan",42,{ensNetwork:42}),t("sepolia",11155111,{ensNetwork:11155111}),t("holesky",17e3,{ensNetwork:17e3}),t("classic",61,{}),t("classicKotti",6,{}),t("arbitrum",42161,{ensNetwork:1}),t("arbitrum-goerli",421613,{}),t("arbitrum-sepolia",421614,{}),t("base",8453,{ensNetwork:1}),t("base-goerli",84531,{}),t("base-sepolia",84532,{}),t("bnb",56,{ensNetwork:1}),t("bnbt",97,{}),t("linea",59144,{ensNetwork:1}),t("linea-goerli",59140,{}),t("linea-sepolia",59141,{}),t("matic",137,{ensNetwork:1,plugins:[DB("https://gasstation.polygon.technology/v2")]}),t("matic-amoy",80002,{}),t("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[DB("https://gasstation-testnet.polygon.technology/v2")]}),t("optimism",10,{ensNetwork:1,plugins:[]}),t("optimism-goerli",420,{}),t("optimism-sepolia",11155420,{}),t("xdai",100,{ensNetwork:1})}function _P(t){return JSON.parse(JSON.stringify(t))}var uu,Ys,Jl,$a,qg,cC;class jCe{constructor(e){me(this,qg);me(this,uu);me(this,Ys);me(this,Jl);me(this,$a);Z(this,uu,e),Z(this,Ys,null),Z(this,Jl,4e3),Z(this,$a,-2)}get pollingInterval(){return H(this,Jl)}set pollingInterval(e){Z(this,Jl,e)}start(){H(this,Ys)||(Z(this,Ys,H(this,uu)._setTimeout(Pe(this,qg,cC).bind(this),H(this,Jl))),Pe(this,qg,cC).call(this))}stop(){H(this,Ys)&&(H(this,uu)._clearTimeout(H(this,Ys)),Z(this,Ys,null))}pause(e){this.stop(),e&&Z(this,$a,-2)}resume(){this.start()}}uu=new WeakMap,Ys=new WeakMap,Jl=new WeakMap,$a=new WeakMap,qg=new WeakSet,cC=async function(){try{const e=await H(this,uu).getBlockNumber();if(H(this,$a)===-2){Z(this,$a,e);return}if(e!==H(this,$a)){for(let r=H(this,$a)+1;r<=e;r++){if(H(this,Ys)==null)return;await H(this,uu).emit("block",r)}Z(this,$a,e)}}catch{}H(this,Ys)!=null&&Z(this,Ys,H(this,uu)._setTimeout(Pe(this,qg,cC).bind(this),H(this,Jl)))};var bf,yf,Ql;class R7{constructor(e){me(this,bf);me(this,yf);me(this,Ql);Z(this,bf,e),Z(this,Ql,!1),Z(this,yf,r=>{this._poll(r,H(this,bf))})}async _poll(e,r){throw new Error("sub-classes must override this")}start(){H(this,Ql)||(Z(this,Ql,!0),H(this,yf).call(this,-2),H(this,bf).on("block",H(this,yf)))}stop(){H(this,Ql)&&(Z(this,Ql,!1),H(this,bf).off("block",H(this,yf)))}pause(e){this.stop()}resume(){this.start()}}bf=new WeakMap,yf=new WeakMap,Ql=new WeakMap;var zg,lu;class BCe extends R7{constructor(r,n){super(r);me(this,zg);me(this,lu);Z(this,zg,n),Z(this,lu,-2)}pause(r){r&&Z(this,lu,-2),super.pause(r)}async _poll(r,n){const i=await n.getBlock(H(this,zg));i!=null&&(H(this,lu)===-2?Z(this,lu,i.number):i.number>H(this,lu)&&(n.emit(H(this,zg),i.number),Z(this,lu,i.number)))}}zg=new WeakMap,lu=new WeakMap;var L6;class DCe extends R7{constructor(r,n){super(r);me(this,L6);Z(this,L6,_P(n))}async _poll(r,n){throw new Error("@TODO")}}L6=new WeakMap;var Wg;class MCe extends R7{constructor(r,n){super(r);me(this,Wg);Z(this,Wg,n)}async _poll(r,n){const i=await n.getTransactionReceipt(H(this,Wg));i&&n.emit(H(this,Wg),i)}}Wg=new WeakMap;var du,Vg,Gg,Xl,Js,U6,PJ;class k7{constructor(e,r){me(this,U6);me(this,du);me(this,Vg);me(this,Gg);me(this,Xl);me(this,Js);Z(this,du,e),Z(this,Vg,_P(r)),Z(this,Gg,Pe(this,U6,PJ).bind(this)),Z(this,Xl,!1),Z(this,Js,-2)}start(){H(this,Xl)||(Z(this,Xl,!0),H(this,Js)===-2&&H(this,du).getBlockNumber().then(e=>{Z(this,Js,e)}),H(this,du).on("block",H(this,Gg)))}stop(){H(this,Xl)&&(Z(this,Xl,!1),H(this,du).off("block",H(this,Gg)))}pause(e){this.stop(),e&&Z(this,Js,-2)}resume(){this.start()}}du=new WeakMap,Vg=new WeakMap,Gg=new WeakMap,Xl=new WeakMap,Js=new WeakMap,U6=new WeakSet,PJ=async function(e){if(H(this,Js)===-2)return;const r=_P(H(this,Vg));r.fromBlock=H(this,Js)+1,r.toBlock=e;const n=await H(this,du).getLogs(r);if(n.length===0){H(this,Js){if(n==null)return"null";if(typeof n=="bigint")return`bigint:${n.toString()}`;if(typeof n=="string")return n.toLowerCase();if(typeof n=="object"&&!Array.isArray(n)){const i=Object.keys(n);return i.sort(),i.reduce((s,o)=>(s[o]=n[o],s),{})}return n})}class OJ{constructor(e){ce(this,"name");ut(this,{name:e})}start(){}stop(){}pause(e){}resume(){}}function FCe(t){return JSON.parse(JSON.stringify(t))}function EP(t){return t=Array.from(new Set(t).values()),t.sort(),t}async function TS(t,e){if(t==null)throw new Error("invalid event");if(Array.isArray(t)&&(t={topics:t}),typeof t=="string")switch(t){case"block":case"debug":case"error":case"finalized":case"network":case"pending":case"safe":return{type:t,tag:t}}if(vr(t,32)){const r=t.toLowerCase();return{type:"transaction",tag:uC("tx",{hash:r}),hash:r}}if(t.orphan){const r=t;return{type:"orphan",tag:uC("orphan",r),filter:FCe(r)}}if(t.address||t.topics){const r=t,n={topics:(r.topics||[]).map(i=>i==null?null:Array.isArray(i)?EP(i.map(s=>s.toLowerCase())):i.toLowerCase())};if(r.address){const i=[],s=[],o=a=>{vr(a)?i.push(a):s.push((async()=>{i.push(await vi(a,e))})())};Array.isArray(r.address)?r.address.forEach(o):o(r.address),s.length&&await Promise.all(s),n.address=EP(i.map(a=>a.toLowerCase()))}return{filter:n,tag:uC("event",n),type:"event"}}ee(!1,"unknown ProviderEvent","event",t)}function IS(){return new Date().getTime()}const HCe={cacheTimeout:250,pollingInterval:4e3};var Qn,ed,Xn,Kg,ws,vf,td,hu,yv,Qs,Zg,Yg,Tt,ds,CP,AP,ab,xP,cb,lC;class qCe{constructor(e,r){me(this,Tt);me(this,Qn);me(this,ed);me(this,Xn);me(this,Kg);me(this,ws);me(this,vf);me(this,td);me(this,hu);me(this,yv);me(this,Qs);me(this,Zg);me(this,Yg);if(Z(this,Yg,Object.assign({},HCe,r||{})),e==="any")Z(this,vf,!0),Z(this,ws,null);else if(e){const n=Wa.from(e);Z(this,vf,!1),Z(this,ws,Promise.resolve(n)),setTimeout(()=>{this.emit("network",n,null)},0)}else Z(this,vf,!1),Z(this,ws,null);Z(this,hu,-1),Z(this,td,new Map),Z(this,Qn,new Map),Z(this,ed,new Map),Z(this,Xn,null),Z(this,Kg,!1),Z(this,yv,1),Z(this,Qs,new Map),Z(this,Zg,!1)}get pollingInterval(){return H(this,Yg).pollingInterval}get provider(){return this}get plugins(){return Array.from(H(this,ed).values())}attachPlugin(e){if(H(this,ed).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return H(this,ed).set(e.name,e.connect(this)),this}getPlugin(e){return H(this,ed).get(e)||null}get disableCcipRead(){return H(this,Zg)}set disableCcipRead(e){Z(this,Zg,!!e)}async ccipReadFetch(e,r,n){if(this.disableCcipRead||n.length===0||e.to==null)return null;const i=e.to.toLowerCase(),s=r.toLowerCase(),o=[];for(let a=0;a=500,`response not found during CCIP fetch: ${d}`,"OFFCHAIN_FAULT",{reason:"404_MISSING_RESOURCE",transaction:e,info:{url:c,errorMessage:d}}),o.push(d)}Ae(!1,`error encountered during CCIP fetch: ${o.map(a=>JSON.stringify(a)).join(", ")}`,"OFFCHAIN_FAULT",{reason:"500_SERVER_ERROR",transaction:e,info:{urls:n,errorMessages:o}})}_wrapBlock(e,r){return new cCe(TCe(e),this)}_wrapLog(e,r){return new Gv(xCe(e),this)}_wrapTransactionReceipt(e,r){return new gJ(RCe(e),this)}_wrapTransactionResponse(e,r){return new Py(IJ(e),this)}_detectNetwork(){Ae(!1,"sub-classes must implement this","UNSUPPORTED_OPERATION",{operation:"_detectNetwork"})}async _perform(e){Ae(!1,`unsupported method: ${e.method}`,"UNSUPPORTED_OPERATION",{operation:e.method,info:e})}async getBlockNumber(){const e=Et(await Pe(this,Tt,ds).call(this,{method:"getBlockNumber"}),"%response");return H(this,hu)>=0&&Z(this,hu,e),e}_getAddress(e){return vi(e,this)}_getBlockTag(e){if(e==null)return"latest";switch(e){case"earliest":return"0x0";case"finalized":case"latest":case"pending":case"safe":return e}if(vr(e))return vr(e,32)?e:J0(e);if(typeof e=="bigint"&&(e=Et(e,"blockTag")),typeof e=="number")return e>=0?J0(e):H(this,hu)>=0?J0(H(this,hu)+e):this.getBlockNumber().then(r=>J0(r+e));ee(!1,"invalid blockTag","blockTag",e)}_getFilter(e){const r=(e.topics||[]).map(c=>c==null?null:Array.isArray(c)?EP(c.map(u=>u.toLowerCase())):c.toLowerCase()),n="blockHash"in e?e.blockHash:void 0,i=(c,u,l)=>{let d;switch(c.length){case 0:break;case 1:d=c[0];break;default:c.sort(),d=c}if(n&&(u!=null||l!=null))throw new Error("invalid filter");const h={};return d&&(h.address=d),r.length&&(h.topics=r),u&&(h.fromBlock=u),l&&(h.toBlock=l),n&&(h.blockHash=n),h};let s=[];if(e.address)if(Array.isArray(e.address))for(const c of e.address)s.push(this._getAddress(c));else s.push(this._getAddress(e.address));let o;"fromBlock"in e&&(o=this._getBlockTag(e.fromBlock));let a;return"toBlock"in e&&(a=this._getBlockTag(e.toBlock)),s.filter(c=>typeof c!="string").length||o!=null&&typeof o!="string"||a!=null&&typeof a!="string"?Promise.all([Promise.all(s),o,a]).then(c=>i(c[0],c[1],c[2])):i(s,o,a)}_getTransactionRequest(e){const r=QC(e),n=[];if(["to","from"].forEach(i=>{if(r[i]==null)return;const s=vi(r[i],this);I3(s)?n.push(async function(){r[i]=await s}()):r[i]=s}),r.blockTag!=null){const i=this._getBlockTag(r.blockTag);I3(i)?n.push(async function(){r.blockTag=await i}()):r.blockTag=i}return n.length?async function(){return await Promise.all(n),r}():r}async getNetwork(){if(H(this,ws)==null){const i=(async()=>{try{const s=await this._detectNetwork();return this.emit("network",s,null),s}catch(s){throw H(this,ws)===i&&Z(this,ws,null),s}})();return Z(this,ws,i),(await i).clone()}const e=H(this,ws),[r,n]=await Promise.all([e,this._detectNetwork()]);return r.chainId!==n.chainId&&(H(this,vf)?(this.emit("network",n,r),H(this,ws)===e&&Z(this,ws,Promise.resolve(n))):Ae(!1,`network changed: ${r.chainId} => ${n.chainId} `,"NETWORK_ERROR",{event:"changed"})),r.clone()}async getFeeData(){const e=await this.getNetwork(),r=async()=>{const{_block:i,gasPrice:s,priorityFee:o}=await mi({_block:Pe(this,Tt,xP).call(this,"latest",!1),gasPrice:(async()=>{try{const l=await Pe(this,Tt,ds).call(this,{method:"getGasPrice"});return et(l,"%response")}catch{}return null})(),priorityFee:(async()=>{try{const l=await Pe(this,Tt,ds).call(this,{method:"getPriorityFee"});return et(l,"%response")}catch{}return null})()});let a=null,c=null;const u=this._wrapBlock(i,e);return u&&u.baseFeePerGas&&(c=o??BigInt("1000000000"),a=u.baseFeePerGas*LCe+c),new RB(s,a,c)},n=e.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(n){const i=new ku(n.url),s=await n.processFunc(r,this,i);return new RB(s.gasPrice,s.maxFeePerGas,s.maxPriorityFeePerGas)}return await r()}async estimateGas(e){let r=this._getTransactionRequest(e);return I3(r)&&(r=await r),et(await Pe(this,Tt,ds).call(this,{method:"estimateGas",transaction:r}),"%response")}async call(e){const{tx:r,blockTag:n}=await mi({tx:this._getTransactionRequest(e),blockTag:this._getBlockTag(e.blockTag)});return await Pe(this,Tt,AP).call(this,Pe(this,Tt,CP).call(this,r,n,e.enableCcipRead?0:-1))}async getBalance(e,r){return et(await Pe(this,Tt,ab).call(this,{method:"getBalance"},e,r),"%response")}async getTransactionCount(e,r){return Et(await Pe(this,Tt,ab).call(this,{method:"getTransactionCount"},e,r),"%response")}async getCode(e,r){return Je(await Pe(this,Tt,ab).call(this,{method:"getCode"},e,r))}async getStorage(e,r,n){const i=et(r,"position");return Je(await Pe(this,Tt,ab).call(this,{method:"getStorage",position:i},e,n))}async broadcastTransaction(e){const{blockNumber:r,hash:n,network:i}=await mi({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:e}),network:this.getNetwork()}),s=YC.from(e);if(s.hash!==n)throw new Error("@TODO: the returned hash did not match");return this._wrapTransactionResponse(s,i).replaceableTransaction(r)}async getBlock(e,r){const{network:n,params:i}=await mi({network:this.getNetwork(),params:Pe(this,Tt,xP).call(this,e,!!r)});return i==null?null:this._wrapBlock(i,n)}async getTransaction(e){const{network:r,params:n}=await mi({network:this.getNetwork(),params:Pe(this,Tt,ds).call(this,{method:"getTransaction",hash:e})});return n==null?null:this._wrapTransactionResponse(n,r)}async getTransactionReceipt(e){const{network:r,params:n}=await mi({network:this.getNetwork(),params:Pe(this,Tt,ds).call(this,{method:"getTransactionReceipt",hash:e})});if(n==null)return null;if(n.gasPrice==null&&n.effectiveGasPrice==null){const i=await Pe(this,Tt,ds).call(this,{method:"getTransaction",hash:e});if(i==null)throw new Error("report this; could not find tx or effectiveGasPrice");n.effectiveGasPrice=i.gasPrice}return this._wrapTransactionReceipt(n,r)}async getTransactionResult(e){const{result:r}=await mi({network:this.getNetwork(),result:Pe(this,Tt,ds).call(this,{method:"getTransactionResult",hash:e})});return r==null?null:Je(r)}async getLogs(e){let r=this._getFilter(e);I3(r)&&(r=await r);const{network:n,params:i}=await mi({network:this.getNetwork(),params:Pe(this,Tt,ds).call(this,{method:"getLogs",filter:r})});return i.map(s=>this._wrapLog(s,n))}_getProvider(e){Ae(!1,"provider cannot connect to target network","UNSUPPORTED_OPERATION",{operation:"_getProvider()"})}async getResolver(e){return await e6.fromName(this,e)}async getAvatar(e){const r=await this.getResolver(e);return r?await r.getAvatar():null}async resolveName(e){const r=await this.getResolver(e);return r?await r.getAddress():null}async lookupAddress(e){e=cr(e);const r=gP(e.substring(2).toLowerCase()+".addr.reverse");try{const n=await e6.getEnsAddress(this),s=await new dg(n,["function resolver(bytes32) view returns (address)"],this).resolver(r);if(s==null||s===_y)return null;const a=await new dg(s,["function name(bytes32) view returns (string)"],this).name(r);return await this.resolveName(a)!==e?null:a}catch(n){if(ti(n,"BAD_DATA")&&n.value==="0x"||ti(n,"CALL_EXCEPTION"))return null;throw n}return null}async waitForTransaction(e,r,n){const i=r??1;return i===0?this.getTransactionReceipt(e):new Promise(async(s,o)=>{let a=null;const c=async u=>{try{const l=await this.getTransactionReceipt(e);if(l!=null&&u-l.blockNumber+1>=i){s(l),a&&(clearTimeout(a),a=null);return}}catch(l){console.log("EEE",l)}this.once("block",c)};n!=null&&(a=setTimeout(()=>{a!=null&&(a=null,this.off("block",c),o(Hr("timeout","TIMEOUT",{reason:"timeout"})))},n)),c(await this.getBlockNumber())})}async waitForBlock(e){Ae(!1,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(e){const r=H(this,Qs).get(e);r&&(r.timer&&clearTimeout(r.timer),H(this,Qs).delete(e))}_setTimeout(e,r){r==null&&(r=0);const n=I1(this,yv)._++,i=()=>{H(this,Qs).delete(n),e()};if(this.paused)H(this,Qs).set(n,{timer:null,func:i,time:r});else{const s=setTimeout(i,r);H(this,Qs).set(n,{timer:s,func:i,time:IS()})}return n}_forEachSubscriber(e){for(const r of H(this,Qn).values())e(r.subscriber)}_getSubscriber(e){switch(e.type){case"debug":case"error":case"network":return new OJ(e.type);case"block":{const r=new jCe(this);return r.pollingInterval=this.pollingInterval,r}case"safe":case"finalized":return new BCe(this,e.type);case"event":return new k7(this,e.filter);case"transaction":return new MCe(this,e.hash);case"orphan":return new DCe(this,e.filter)}throw new Error(`unsupported event: ${e.type}`)}_recoverSubscriber(e,r){for(const n of H(this,Qn).values())if(n.subscriber===e){n.started&&n.subscriber.stop(),n.subscriber=r,n.started&&r.start(),H(this,Xn)!=null&&r.pause(H(this,Xn));break}}async on(e,r){const n=await Pe(this,Tt,lC).call(this,e);return n.listeners.push({listener:r,once:!1}),n.started||(n.subscriber.start(),n.started=!0,H(this,Xn)!=null&&n.subscriber.pause(H(this,Xn))),this}async once(e,r){const n=await Pe(this,Tt,lC).call(this,e);return n.listeners.push({listener:r,once:!0}),n.started||(n.subscriber.start(),n.started=!0,H(this,Xn)!=null&&n.subscriber.pause(H(this,Xn))),this}async emit(e,...r){const n=await Pe(this,Tt,cb).call(this,e,r);if(!n||n.listeners.length===0)return!1;const i=n.listeners.length;return n.listeners=n.listeners.filter(({listener:s,once:o})=>{const a=new zZ(this,o?null:s,e);try{s.call(this,...r,a)}catch{}return!o}),n.listeners.length===0&&(n.started&&n.subscriber.stop(),H(this,Qn).delete(n.tag)),i>0}async listenerCount(e){if(e){const n=await Pe(this,Tt,cb).call(this,e);return n?n.listeners.length:0}let r=0;for(const{listeners:n}of H(this,Qn).values())r+=n.length;return r}async listeners(e){if(e){const n=await Pe(this,Tt,cb).call(this,e);return n?n.listeners.map(({listener:i})=>i):[]}let r=[];for(const{listeners:n}of H(this,Qn).values())r=r.concat(n.map(({listener:i})=>i));return r}async off(e,r){const n=await Pe(this,Tt,cb).call(this,e);if(!n)return this;if(r){const i=n.listeners.map(({listener:s})=>s).indexOf(r);i>=0&&n.listeners.splice(i,1)}return(!r||n.listeners.length===0)&&(n.started&&n.subscriber.stop(),H(this,Qn).delete(n.tag)),this}async removeAllListeners(e){if(e){const{tag:r,started:n,subscriber:i}=await Pe(this,Tt,lC).call(this,e);n&&i.stop(),H(this,Qn).delete(r)}else for(const[r,{started:n,subscriber:i}]of H(this,Qn))n&&i.stop(),H(this,Qn).delete(r);return this}async addListener(e,r){return await this.on(e,r)}async removeListener(e,r){return this.off(e,r)}get destroyed(){return H(this,Kg)}destroy(){this.removeAllListeners();for(const e of H(this,Qs).keys())this._clearTimeout(e);Z(this,Kg,!0)}get paused(){return H(this,Xn)!=null}set paused(e){!!e!==this.paused&&(this.paused?this.resume():this.pause(!1))}pause(e){if(Z(this,hu,-1),H(this,Xn)!=null){if(H(this,Xn)==!!e)return;Ae(!1,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber(r=>r.pause(e)),Z(this,Xn,!!e);for(const r of H(this,Qs).values())r.timer&&clearTimeout(r.timer),r.time=IS()-r.time}resume(){if(H(this,Xn)!=null){this._forEachSubscriber(e=>e.resume()),Z(this,Xn,null);for(const e of H(this,Qs).values()){let r=e.time;r<0&&(r=0),e.time=IS(),setTimeout(e.func,r)}}}}Qn=new WeakMap,ed=new WeakMap,Xn=new WeakMap,Kg=new WeakMap,ws=new WeakMap,vf=new WeakMap,td=new WeakMap,hu=new WeakMap,yv=new WeakMap,Qs=new WeakMap,Zg=new WeakMap,Yg=new WeakMap,Tt=new WeakSet,ds=async function(e){const r=H(this,Yg).cacheTimeout;if(r<0)return await this._perform(e);const n=uC(e.method,e);let i=H(this,td).get(n);return i||(i=this._perform(e),H(this,td).set(n,i),setTimeout(()=>{H(this,td).get(n)===i&&H(this,td).delete(n)},r)),await i},CP=async function(e,r,n){Ae(n=0&&r==="latest"&&i.to!=null&&qr(s.data,0,4)==="0x556f1830"){const o=s.data,a=await vi(i.to,this);let c;try{c=KCe(qr(s.data,4))}catch(d){Ae(!1,d.message,"OFFCHAIN_FAULT",{reason:"BAD_DATA",transaction:i,info:{data:o}})}Ae(c.sender.toLowerCase()===a.toLowerCase(),"CCIP Read sender mismatch","CALL_EXCEPTION",{action:"call",data:o,reason:"OffchainLookup",transaction:i,invocation:null,revert:{signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",name:"OffchainLookup",args:c.errorArgs}});const u=await this.ccipReadFetch(i,c.calldata,c.urls);Ae(u!=null,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:i,info:{data:s.data,errorArgs:c.errorArgs}});const l={to:a,data:en([c.selector,GCe([u,c.extraData])])};this.emit("debug",{action:"sendCcipReadCall",transaction:l});try{const d=await Pe(this,Tt,CP).call(this,l,r,n+1);return this.emit("debug",{action:"receiveCcipReadCallResult",transaction:Object.assign({},l),result:d}),d}catch(d){throw this.emit("debug",{action:"receiveCcipReadCallError",transaction:Object.assign({},l),error:d}),d}}throw s}},AP=async function(e){const{value:r}=await mi({network:this.getNetwork(),value:e});return r},ab=async function(e,r,n){let i=this._getAddress(r),s=this._getBlockTag(n);return(typeof i!="string"||typeof s!="string")&&([i,s]=await Promise.all([i,s])),await Pe(this,Tt,AP).call(this,Pe(this,Tt,ds).call(this,Object.assign(e,{address:i,blockTag:s})))},xP=async function(e,r){if(vr(e,32))return await Pe(this,Tt,ds).call(this,{method:"getBlock",blockHash:e,includeTransactions:r});let n=this._getBlockTag(e);return typeof n!="string"&&(n=await n),await Pe(this,Tt,ds).call(this,{method:"getBlock",blockTag:n,includeTransactions:r})},cb=async function(e,r){let n=await TS(e,this);return n.type==="event"&&r&&r.length>0&&r[0].removed===!0&&(n=await TS({orphan:"drop-log",log:r[0]},this)),H(this,Qn).get(n.tag)||null},lC=async function(e){const r=await TS(e,this),n=r.tag;let i=H(this,Qn).get(n);return i||(i={subscriber:this._getSubscriber(r),tag:n,addressableMap:new WeakMap,nameMap:new Map,started:!1,listeners:[]},H(this,Qn).set(n,i)),i};function zCe(t,e){try{const r=SP(t,e);if(r)return HC(r)}catch{}return null}function SP(t,e){if(t==="0x")return null;try{const r=Et(qr(t,e,e+32)),n=Et(qr(t,r,r+32));return qr(t,r+32,r+32+n)}catch{}return null}function LB(t){const e=bi(t);if(e.length>32)throw new Error("internal; should not happen");const r=new Uint8Array(32);return r.set(e,32-e.length),r}function WCe(t){if(t.length%32===0)return t;const e=new Uint8Array(Math.ceil(t.length/32)*32);return e.set(t),e}const VCe=new Uint8Array([]);function GCe(t){const e=[];let r=0;for(let n=0;n=5*32,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const r=qr(t,0,32);Ae(qr(r,0,12)===qr(UB,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"}),e.sender=qr(r,12);try{const n=[],i=Et(qr(t,32,64)),s=Et(qr(t,i,i+32)),o=qr(t,i+32);for(let a=0;ae[n]),e}function h0(t,e){if(t.provider)return t.provider;Ae(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:e})}async function FB(t,e){let r=QC(e);if(r.to!=null&&(r.to=vi(r.to,t)),r.from!=null){const n=r.from;r.from=Promise.all([t.getAddress(),vi(n,t)]).then(([i,s])=>(ee(i.toLowerCase()===s.toLowerCase(),"transaction from mismatch","tx.from",s),i))}else r.from=t.getAddress();return await mi(r)}class ZCe{constructor(e){ce(this,"provider");ut(this,{provider:e||null})}async getNonce(e){return h0(this,"getTransactionCount").getTransactionCount(await this.getAddress(),e)}async populateCall(e){return await FB(this,e)}async populateTransaction(e){const r=h0(this,"populateTransaction"),n=await FB(this,e);n.nonce==null&&(n.nonce=await this.getNonce("pending")),n.gasLimit==null&&(n.gasLimit=await this.estimateGas(n));const i=await this.provider.getNetwork();if(n.chainId!=null){const o=et(n.chainId);ee(o===i.chainId,"transaction chainId mismatch","tx.chainId",e.chainId)}else n.chainId=i.chainId;const s=n.maxFeePerGas!=null||n.maxPriorityFeePerGas!=null;if(n.gasPrice!=null&&(n.type===2||s)?ee(!1,"eip-1559 transaction do not support gasPrice","tx",e):(n.type===0||n.type===1)&&s&&ee(!1,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",e),(n.type===2||n.type==null)&&n.maxFeePerGas!=null&&n.maxPriorityFeePerGas!=null)n.type=2;else if(n.type===0||n.type===1){const o=await r.getFeeData();Ae(o.gasPrice!=null,"network does not support gasPrice","UNSUPPORTED_OPERATION",{operation:"getGasPrice"}),n.gasPrice==null&&(n.gasPrice=o.gasPrice)}else{const o=await r.getFeeData();if(n.type==null)if(o.maxFeePerGas!=null&&o.maxPriorityFeePerGas!=null)if(n.type=2,n.gasPrice!=null){const a=n.gasPrice;delete n.gasPrice,n.maxFeePerGas=a,n.maxPriorityFeePerGas=a}else n.maxFeePerGas==null&&(n.maxFeePerGas=o.maxFeePerGas),n.maxPriorityFeePerGas==null&&(n.maxPriorityFeePerGas=o.maxPriorityFeePerGas);else o.gasPrice!=null?(Ae(!s,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),n.gasPrice==null&&(n.gasPrice=o.gasPrice),n.type=0):Ae(!1,"failed to get consistent fee data","UNSUPPORTED_OPERATION",{operation:"signer.getFeeData"});else(n.type===2||n.type===3)&&(n.maxFeePerGas==null&&(n.maxFeePerGas=o.maxFeePerGas),n.maxPriorityFeePerGas==null&&(n.maxPriorityFeePerGas=o.maxPriorityFeePerGas))}return await mi(n)}async estimateGas(e){return h0(this,"estimateGas").estimateGas(await this.populateCall(e))}async call(e){return h0(this,"call").call(await this.populateCall(e))}async resolveName(e){return await h0(this,"resolveName").resolveName(e)}async sendTransaction(e){const r=h0(this,"sendTransaction"),n=await this.populateTransaction(e);delete n.from;const i=YC.from(n);return await r.broadcastTransaction(await this.signTransaction(i))}}function YCe(t){return JSON.parse(JSON.stringify(t))}var gi,ja,_f,rd,Ef,Jg,Nd,TP,IP;class RJ{constructor(e){me(this,Nd);me(this,gi);me(this,ja);me(this,_f);me(this,rd);me(this,Ef);me(this,Jg);Z(this,gi,e),Z(this,ja,null),Z(this,_f,Pe(this,Nd,TP).bind(this)),Z(this,rd,!1),Z(this,Ef,null),Z(this,Jg,!1)}_subscribe(e){throw new Error("subclasses must override this")}_emitResults(e,r){throw new Error("subclasses must override this")}_recover(e){throw new Error("subclasses must override this")}start(){H(this,rd)||(Z(this,rd,!0),Pe(this,Nd,TP).call(this,-2))}stop(){H(this,rd)&&(Z(this,rd,!1),Z(this,Jg,!0),Pe(this,Nd,IP).call(this),H(this,gi).off("block",H(this,_f)))}pause(e){e&&Pe(this,Nd,IP).call(this),H(this,gi).off("block",H(this,_f))}resume(){this.start()}}gi=new WeakMap,ja=new WeakMap,_f=new WeakMap,rd=new WeakMap,Ef=new WeakMap,Jg=new WeakMap,Nd=new WeakSet,TP=async function(e){try{H(this,ja)==null&&Z(this,ja,this._subscribe(H(this,gi)));let r=null;try{r=await H(this,ja)}catch(s){if(!ti(s,"UNSUPPORTED_OPERATION")||s.operation!=="eth_newFilter")throw s}if(r==null){Z(this,ja,null),H(this,gi)._recoverSubscriber(this,this._recover(H(this,gi)));return}const n=await H(this,gi).getNetwork();if(H(this,Ef)||Z(this,Ef,n),H(this,Ef).chainId!==n.chainId)throw new Error("chaid changed");if(H(this,Jg))return;const i=await H(this,gi).send("eth_getFilterChanges",[r]);await this._emitResults(H(this,gi),i)}catch(r){console.log("@TODO",r)}H(this,gi).once("block",H(this,_f))},IP=function(){const e=H(this,ja);e&&(Z(this,ja,null),e.then(r=>{H(this,gi).destroyed||H(this,gi).send("eth_uninstallFilter",[r])}))};var Cf;class JCe extends RJ{constructor(r,n){super(r);me(this,Cf);Z(this,Cf,YCe(n))}_recover(r){return new k7(r,H(this,Cf))}async _subscribe(r){return await r.send("eth_newFilter",[H(this,Cf)])}async _emitResults(r,n){for(const i of n)r.emit(H(this,Cf),r._wrapLog(i,r._network))}}Cf=new WeakMap;class QCe extends RJ{async _subscribe(e){return await e.send("eth_newPendingTransactionFilter",[])}async _emitResults(e,r){for(const n of r)e.emit("pending",n)}}const XCe="bigint,boolean,function,number,string,symbol".split(/,/g);function dC(t){if(t==null||XCe.indexOf(typeof t)>=0||typeof t.getAddress=="function")return t;if(Array.isArray(t))return t.map(dC);if(typeof t=="object")return Object.keys(t).reduce((e,r)=>(e[r]=t[r],e),{});throw new Error(`should not happen: ${t} (${typeof t})`)}function e6e(t){return new Promise(e=>{setTimeout(e,t)})}function f0(t){return t&&t.toLowerCase()}function HB(t){return t&&typeof t.pollingInterval=="number"}const kJ={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class hg extends ZCe{constructor(r,n){super(r);ce(this,"address");n=cr(n),ut(this,{address:n})}connect(r){Ae(!1,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(r){return await this.populateCall(r)}async sendUncheckedTransaction(r){const n=dC(r),i=[];if(n.from){const o=n.from;i.push((async()=>{const a=await vi(o,this.provider);ee(a!=null&&a.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",r),n.from=a})())}else n.from=this.address;if(n.gasLimit==null&&i.push((async()=>{n.gasLimit=await this.provider.estimateGas({...n,from:this.address})})()),n.to!=null){const o=n.to;i.push((async()=>{n.to=await vi(o,this.provider)})())}i.length&&await Promise.all(i);const s=this.provider.getRpcTransaction(n);return this.provider.send("eth_sendTransaction",[s])}async sendTransaction(r){const n=await this.provider.getBlockNumber(),i=await this.sendUncheckedTransaction(r);return await new Promise((s,o)=>{const a=[1e3,100];let c=0;const u=async()=>{try{const l=await this.provider.getTransaction(i);if(l!=null){s(l.replaceableTransaction(n));return}}catch(l){if(ti(l,"CANCELLED")||ti(l,"BAD_DATA")||ti(l,"NETWORK_ERROR")){l.info==null&&(l.info={}),l.info.sendTransactionHash=i,o(l);return}if(ti(l,"INVALID_ARGUMENT")&&(c++,l.info==null&&(l.info={}),l.info.sendTransactionHash=i,c>10)){o(l);return}this.provider.emit("error",Hr("failed to fetch transation after sending (will try again)","UNKNOWN_ERROR",{error:l}))}this.provider._setTimeout(()=>{u()},a.pop()||4e3)};u()})}async signTransaction(r){const n=dC(r);if(n.from){const s=await vi(n.from,this.provider);ee(s!=null&&s.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",r),n.from=s}else n.from=this.address;const i=this.provider.getRpcTransaction(n);return await this.provider.send("eth_signTransaction",[i])}async signMessage(r){const n=typeof r=="string"?Za(r):r;return await this.provider.send("personal_sign",[Je(n),this.address.toLowerCase()])}async signTypedData(r,n,i){const s=dC(i),o=await JC.resolveNames(r,n,s,async a=>{const c=await vi(a);return ee(c!=null,"TypedData does not support null address","value",a),c});return await this.provider.send("eth_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(JC.getPayload(o.domain,n,o.value))])}async unlock(r){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),r,null])}async _legacySignMessage(r){const n=typeof r=="string"?Za(r):r;return await this.provider.send("eth_sign",[this.address.toLowerCase(),Je(n)])}}var Af,Qg,fu,Ba,Bo,Xs,qi,vv,PP;class t6e extends qCe{constructor(r,n){super(r,n);me(this,vv);me(this,Af);me(this,Qg);me(this,fu);me(this,Ba);me(this,Bo);me(this,Xs);me(this,qi);Z(this,Qg,1),Z(this,Af,Object.assign({},kJ,n||{})),Z(this,fu,[]),Z(this,Ba,null),Z(this,Xs,null),Z(this,qi,null);{let s=null;const o=new Promise(a=>{s=a});Z(this,Bo,{promise:o,resolve:s})}const i=this._getOption("staticNetwork");typeof i=="boolean"?(ee(!i||r!=="any","staticNetwork cannot be used on special network 'any'","options",n),i&&r!=null&&Z(this,Xs,Wa.from(r))):i&&(ee(r==null||i.matches(r),"staticNetwork MUST match network object","options",n),Z(this,Xs,i))}_getOption(r){return H(this,Af)[r]}get _network(){return Ae(H(this,Xs),"network is not available yet","NETWORK_ERROR"),H(this,Xs)}async _perform(r){if(r.method==="call"||r.method==="estimateGas"){let i=r.transaction;if(i&&i.type!=null&&et(i.type)&&i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null){const s=await this.getFeeData();s.maxFeePerGas==null&&s.maxPriorityFeePerGas==null&&(r=Object.assign({},r,{transaction:Object.assign({},i,{type:void 0})}))}}const n=this.getRpcRequest(r);return n!=null?await this.send(n.method,n.args):super._perform(r)}async _detectNetwork(){const r=this._getOption("staticNetwork");if(r)if(r===!0){if(H(this,Xs))return H(this,Xs)}else return r;return H(this,qi)?await H(this,qi):this.ready?(Z(this,qi,(async()=>{try{const n=Wa.from(et(await this.send("eth_chainId",[])));return Z(this,qi,null),n}catch(n){throw Z(this,qi,null),n}})()),await H(this,qi)):(Z(this,qi,(async()=>{const n={id:I1(this,Qg)._++,method:"eth_chainId",params:[],jsonrpc:"2.0"};this.emit("debug",{action:"sendRpcPayload",payload:n});let i;try{i=(await this._send(n))[0],Z(this,qi,null)}catch(s){throw Z(this,qi,null),this.emit("debug",{action:"receiveRpcError",error:s}),s}if(this.emit("debug",{action:"receiveRpcResult",result:i}),"result"in i)return Wa.from(et(i.result));throw this.getRpcError(n,i)})()),await H(this,qi))}_start(){H(this,Bo)==null||H(this,Bo).resolve==null||(H(this,Bo).resolve(),Z(this,Bo,null),(async()=>{for(;H(this,Xs)==null&&!this.destroyed;)try{Z(this,Xs,await this._detectNetwork())}catch(r){if(this.destroyed)break;console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"),this.emit("error",Hr("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:r}})),await e6e(1e3)}Pe(this,vv,PP).call(this)})())}async _waitUntilReady(){if(H(this,Bo)!=null)return await H(this,Bo).promise}_getSubscriber(r){return r.type==="pending"?new QCe(this):r.type==="event"?this._getOption("polling")?new k7(this,r.filter):new JCe(this,r.filter):r.type==="orphan"&&r.filter.orphan==="drop-log"?new OJ("orphan"):super._getSubscriber(r)}get ready(){return H(this,Bo)==null}getRpcTransaction(r){const n={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(i=>{if(r[i]==null)return;let s=i;i==="gasLimit"&&(s="gas"),n[s]=J0(et(r[i],`tx.${i}`))}),["from","to","data"].forEach(i=>{r[i]!=null&&(n[i]=Je(r[i]))}),r.accessList&&(n.accessList=Ap(r.accessList)),r.blobVersionedHashes&&(n.blobVersionedHashes=r.blobVersionedHashes.map(i=>i.toLowerCase())),n}getRpcRequest(r){switch(r.method){case"chainId":return{method:"eth_chainId",args:[]};case"getBlockNumber":return{method:"eth_blockNumber",args:[]};case"getGasPrice":return{method:"eth_gasPrice",args:[]};case"getPriorityFee":return{method:"eth_maxPriorityFeePerGas",args:[]};case"getBalance":return{method:"eth_getBalance",args:[f0(r.address),r.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[f0(r.address),r.blockTag]};case"getCode":return{method:"eth_getCode",args:[f0(r.address),r.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[f0(r.address),"0x"+r.position.toString(16),r.blockTag]};case"broadcastTransaction":return{method:"eth_sendRawTransaction",args:[r.signedTransaction]};case"getBlock":if("blockTag"in r)return{method:"eth_getBlockByNumber",args:[r.blockTag,!!r.includeTransactions]};if("blockHash"in r)return{method:"eth_getBlockByHash",args:[r.blockHash,!!r.includeTransactions]};break;case"getTransaction":return{method:"eth_getTransactionByHash",args:[r.hash]};case"getTransactionReceipt":return{method:"eth_getTransactionReceipt",args:[r.hash]};case"call":return{method:"eth_call",args:[this.getRpcTransaction(r.transaction),r.blockTag]};case"estimateGas":return{method:"eth_estimateGas",args:[this.getRpcTransaction(r.transaction)]};case"getLogs":return r.filter&&r.filter.address!=null&&(Array.isArray(r.filter.address)?r.filter.address=r.filter.address.map(f0):r.filter.address=f0(r.filter.address)),{method:"eth_getLogs",args:[r.filter]}}return null}getRpcError(r,n){const{method:i}=r,{error:s}=n;if(i==="eth_estimateGas"&&s.message){const c=s.message;if(!c.match(/revert/i)&&c.match(/insufficient funds/i))return Hr("insufficient funds","INSUFFICIENT_FUNDS",{transaction:r.params[0],info:{payload:r,error:s}})}if(i==="eth_call"||i==="eth_estimateGas"){const c=OP(s),u=Iy.getBuiltinCallException(i==="eth_call"?"call":"estimateGas",r.params[0],c?c.data:null);return u.info={error:s,payload:r},u}const o=JSON.stringify(n6e(s));if(typeof s.message=="string"&&s.message.match(/user denied|ethers-user-denied/i))return Hr("user rejected action","ACTION_REJECTED",{action:{eth_sign:"signMessage",personal_sign:"signMessage",eth_signTypedData_v4:"signTypedData",eth_signTransaction:"signTransaction",eth_sendTransaction:"sendTransaction",eth_requestAccounts:"requestAccess",wallet_requestAccounts:"requestAccess"}[i]||"unknown",reason:"rejected",info:{payload:r,error:s}});if(i==="eth_sendRawTransaction"||i==="eth_sendTransaction"){const c=r.params[0];if(o.match(/insufficient funds|base fee exceeds gas limit/i))return Hr("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:c,info:{error:s}});if(o.match(/nonce/i)&&o.match(/too low/i))return Hr("nonce has already been used","NONCE_EXPIRED",{transaction:c,info:{error:s}});if(o.match(/replacement transaction/i)&&o.match(/underpriced/i))return Hr("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:c,info:{error:s}});if(o.match(/only replay-protected/i))return Hr("legacy pre-eip-155 transactions not supported","UNSUPPORTED_OPERATION",{operation:i,info:{transaction:c,info:{error:s}}})}let a=!!o.match(/the method .* does not exist/i);return a||s&&s.details&&s.details.startsWith("Unauthorized method:")&&(a=!0),a?Hr("unsupported operation","UNSUPPORTED_OPERATION",{operation:r.method,info:{error:s,payload:r}}):Hr("could not coalesce error","UNKNOWN_ERROR",{error:s,payload:r})}send(r,n){if(this.destroyed)return Promise.reject(Hr("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:r}));const i=I1(this,Qg)._++,s=new Promise((o,a)=>{H(this,fu).push({resolve:o,reject:a,payload:{method:r,params:n,id:i,jsonrpc:"2.0"}})});return Pe(this,vv,PP).call(this),s}async getSigner(r){r==null&&(r=0);const n=this.send("eth_accounts",[]);if(typeof r=="number"){const s=await n;if(r>=s.length)throw new Error("no such account");return new hg(this,s[r])}const{accounts:i}=await mi({network:this.getNetwork(),accounts:n});r=cr(r);for(const s of i)if(cr(s)===r)return new hg(this,r);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map(n=>new hg(this,n))}destroy(){H(this,Ba)&&(clearTimeout(H(this,Ba)),Z(this,Ba,null));for(const{payload:r,reject:n}of H(this,fu))n(Hr("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:r.method}));Z(this,fu,[]),super.destroy()}}Af=new WeakMap,Qg=new WeakMap,fu=new WeakMap,Ba=new WeakMap,Bo=new WeakMap,Xs=new WeakMap,qi=new WeakMap,vv=new WeakSet,PP=function(){if(H(this,Ba))return;const r=this._getOption("batchMaxCount")===1?0:this._getOption("batchStallTime");Z(this,Ba,setTimeout(()=>{Z(this,Ba,null);const n=H(this,fu);for(Z(this,fu,[]);n.length;){const i=[n.shift()];for(;n.length&&i.length!==H(this,Af).batchMaxCount;)if(i.push(n.shift()),JSON.stringify(i.map(o=>o.payload)).length>H(this,Af).batchMaxSize){n.unshift(i.pop());break}(async()=>{const s=i.length===1?i[0].payload:i.map(o=>o.payload);this.emit("debug",{action:"sendRpcPayload",payload:s});try{const o=await this._send(s);this.emit("debug",{action:"receiveRpcResult",result:o});for(const{resolve:a,reject:c,payload:u}of i){if(this.destroyed){c(Hr("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:u.method}));continue}const l=o.filter(d=>d.id===u.id)[0];if(l==null){const d=Hr("missing response for request","BAD_DATA",{value:o,info:{payload:u}});this.emit("error",d),c(d);continue}if("error"in l){c(this.getRpcError(u,l));continue}a(l.result)}}catch(o){this.emit("debug",{action:"receiveRpcError",error:o});for(const{reject:a}of i)a(o)}})()}},r))};var nd;class NJ extends t6e{constructor(r,n){super(r,n);me(this,nd);let i=this._getOption("pollingInterval");i==null&&(i=kJ.pollingInterval),Z(this,nd,i)}_getSubscriber(r){const n=super._getSubscriber(r);return HB(n)&&(n.pollingInterval=H(this,nd)),n}get pollingInterval(){return H(this,nd)}set pollingInterval(r){if(!Number.isInteger(r)||r<0)throw new Error("invalid interval");Z(this,nd,r),this._forEachSubscriber(n=>{HB(n)&&(n.pollingInterval=H(this,nd))})}}nd=new WeakMap;var Xg;class r6e extends NJ{constructor(r,n,i){r==null&&(r="http://localhost:8545");super(n,i);me(this,Xg);typeof r=="string"?Z(this,Xg,new ku(r)):Z(this,Xg,r.clone())}_getConnection(){return H(this,Xg).clone()}async send(r,n){return await this._start(),await super.send(r,n)}async _send(r){const n=this._getConnection();n.body=JSON.stringify(r),n.setHeader("content-type","application/json");const i=await n.send();i.assertOk();let s=i.bodyJson;return Array.isArray(s)||(s=[s]),s}}Xg=new WeakMap;function OP(t){if(t==null)return null;if(typeof t.message=="string"&&t.message.match(/revert/i)&&vr(t.data))return{message:t.message,data:t.data};if(typeof t=="object"){for(const e in t){const r=OP(t[e]);if(r)return r}return null}if(typeof t=="string")try{return OP(JSON.parse(t))}catch{}return null}function RP(t,e){if(t!=null){if(typeof t.message=="string"&&e.push(t.message),typeof t=="object")for(const r in t)RP(t[r],e);if(typeof t=="string")try{return RP(JSON.parse(t),e)}catch{}}}function n6e(t){const e=[];return RP(t,e),e}var em;class PS extends NJ{constructor(r,n,i){const s=Object.assign({},i??{},{batchMaxCount:1});ee(r&&r.request,"invalid EIP-1193 provider","ethereum",r);super(n,s);me(this,em);Z(this,em,async(o,a)=>{const c={method:o,params:a};this.emit("debug",{action:"sendEip1193Request",payload:c});try{const u=await r.request(c);return this.emit("debug",{action:"receiveEip1193Result",result:u}),u}catch(u){const l=new Error(u.message);throw l.code=u.code,l.data=u.data,l.payload=c,this.emit("debug",{action:"receiveEip1193Error",error:l}),l}})}async send(r,n){return await this._start(),await super.send(r,n)}async _send(r){ee(!Array.isArray(r),"EIP-1193 does not support batch request","payload",r);try{const n=await H(this,em).call(this,r.method,r.params||[]);return[{id:r.id,result:n}]}catch(n){return[{id:r.id,error:{code:n.code,data:n.data,message:n.message}}]}}getRpcError(r,n){switch(n=JSON.parse(JSON.stringify(n)),n.error.code||-1){case 4001:n.error.message=`ethers-user-denied: ${n.error.message}`;break;case 4200:n.error.message=`ethers-unsupported: ${n.error.message}`;break}return super.getRpcError(r,n)}async hasSigner(r){r==null&&(r=0);const n=await this.send("eth_accounts",[]);return typeof r=="number"?n.length>r:(r=r.toLowerCase(),n.filter(i=>i.toLowerCase()===r).length!==0)}async getSigner(r){if(r==null&&(r=0),!await this.hasSigner(r))try{await H(this,em).call(this,"eth_requestAccounts",[])}catch(n){const i=n.payload;throw this.getRpcError(i,{id:i.id,error:n})}return await super.getSigner(r)}}em=new WeakMap;const fg={hexStringToNumber(t){const e=t.startsWith("0x")?t.slice(2):t;return parseInt(e,16)},numberToHexString(t){return`0x${t.toString(16)}`},async getUserInfo(t){const[e,r]=await Promise.all([fg.getAddresses(t),fg.getChainId(t)]);return{chainId:r,addresses:e}},async getChainId(t){const e=await t.request({method:"eth_chainId"});return Number(e)},async getAddress(t){const[e]=await t.request({method:"eth_accounts"});return e},async getAddresses(t){return await t.request({method:"eth_accounts"})},async addEthereumChain(t,e){var n,i;const r=((n=e.rpcUrls.chainDefault)==null?void 0:n.http)||[];await t.request({method:"wallet_addEthereumChain",params:[{chainId:fg.numberToHexString(e.id),rpcUrls:[...r],chainName:e.name,nativeCurrency:{name:e.nativeCurrency.name,decimals:e.nativeCurrency.decimals,symbol:e.nativeCurrency.symbol},blockExplorerUrls:[(i=e.blockExplorers)==null?void 0:i.default.url],iconUrls:[Ua.NetworkImageIds[e.id]]}]})}},ph={signMessage:async(t,e,r)=>{if(!e)throw new Error("signMessage - provider is undefined");const n=vr(t)?t:Je(Za(t));return await e.request({method:"personal_sign",params:[n,r]})},estimateGas:async(t,e,r,n)=>{if(!e)throw new Error("estimateGas - provider is undefined");if(!r)throw new Error("estimateGas - address is undefined");if(t.chainNamespace&&t.chainNamespace!=="eip155")throw new Error("estimateGas - chainNamespace is not eip155");const i={from:t.address,to:t.to,data:t.data,type:0},s=new PS(e,n);return await new hg(s,r).estimateGas(i)},sendTransaction:async(t,e,r,n)=>{if(!e)throw new Error("sendTransaction - provider is undefined");if(!r)throw new Error("sendTransaction - address is undefined");if(t.chainNamespace&&t.chainNamespace!=="eip155")throw new Error("sendTransaction - chainNamespace is not eip155");const i={to:t.to,value:t.value,gasLimit:t.gas,gasPrice:t.gasPrice,data:t.data,type:0},s=new PS(e,n),c=await(await new hg(s,r).sendTransaction(i)).wait();return(c==null?void 0:c.hash)||null},writeContract:async(t,e,r,n)=>{if(!e)throw new Error("writeContract - provider is undefined");if(!r)throw new Error("writeContract - address is undefined");const i=new PS(e,n),s=new hg(i,r),o=new dg(t.tokenAddress,t.abi,s);if(!o||!t.method)throw new Error("Contract method is undefined");const a=o[t.method];if(a)return await a(...t.args);throw new Error("Contract method is undefined")},parseWalletCapabilities:t=>{try{return JSON.parse(t)}catch{throw new Error("Error parsing wallet capabilities")}},parseUnits:Z_e,formatUnits:XZ};class i6e extends LZ{constructor(){super({adapterType:_e.ADAPTER_TYPES.ETHERS,namespace:_e.CHAIN.EVM}),this.balancePromises={},this.providerHandlers=null}async createEthersConfig(e){if(!e.metadata)return;let r;function n(){if(r)return r;if(!(typeof window>"u")&&window.ethereum)return r=window.ethereum,r}async function i(){const{SafeProvider:a}=await ke(async()=>{const{SafeProvider:h}=await Promise.resolve().then(()=>O9e);return{SafeProvider:h}},void 0),{default:c}=await ke(async()=>{const{default:h}=await Promise.resolve().then(()=>H9e);return{default:h}},void 0),u=new c,l=await u.safe.getInfo(),d=new a(l,u);return await d.connect().catch(h=>{console.info("Failed to auto-connect to Safe:",h)}),d}async function s(){var a,c,u;try{const{createCoinbaseWalletSDK:l}=await ke(async()=>{const{createCoinbaseWalletSDK:h}=await Promise.resolve().then(()=>bOe);return{createCoinbaseWalletSDK:h}},void 0);return typeof window>"u"?void 0:l({appName:(a=e==null?void 0:e.metadata)==null?void 0:a.name,appLogoUrl:(c=e==null?void 0:e.metadata)==null?void 0:c.icons[0],appChainIds:((u=e.networks)==null?void 0:u.map(h=>h.id))||[1,84532],preference:{options:e.coinbasePreference??"all"}}).getProvider()}catch(l){console.error("Failed to import Coinbase Wallet SDK:",l);return}}const o={metadata:e.metadata};if(e.enableInjected!==!1&&(o.injected=n()),e.enableCoinbase!==!1){const a=await s();a&&(o.coinbase=a)}if(ue.isSafeApp()){const a=await i();a&&(o.safe=a)}return o.EIP6963=e.enableEIP6963!==!1,o}async signMessage(e){const{message:r,address:n,provider:i}=e;if(!i)throw new Error("Provider is undefined");try{return{signature:await ph.signMessage(r,i,n)}}catch{throw new Error("EthersAdapter:signMessage - Sign message failed")}}async sendTransaction(e){var n;if(!e.provider)throw new Error("Provider is undefined");return{hash:await ph.sendTransaction({value:Number.isNaN(Number(e.value))?BigInt(0):BigInt(e.value),to:e.to,data:e.data?e.data:"0x",gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,address:re.state.address},e.provider,re.state.address,Number((n=e.caipNetwork)==null?void 0:n.id))}}async writeContract(e){var i;if(!e.provider)throw new Error("Provider is undefined");const{address:r}=bs.parseCaipAddress(e.caipAddress);return{hash:await ph.writeContract(e,e.provider,r,Number((i=e.caipNetwork)==null?void 0:i.id))}}async estimateGas(e){const{provider:r,caipNetwork:n,address:i}=e;if(!r)throw new Error("Provider is undefined");try{return{gas:await ph.estimateGas({data:e.data,to:e.to,address:i},r,i,Number(n==null?void 0:n.id))}}catch{throw new Error("EthersAdapter:estimateGas - Estimate gas failed")}}parseUnits(e){return ph.parseUnits(e.value,e.decimals)}formatUnits(e){return ph.formatUnits(e.value,e.decimals)}async syncConnection(e){const{id:r,chainId:n}=e,i=this.connectors.find(c=>c.id===r),s=i==null?void 0:i.provider;if(!s)throw new Error("Provider not found");const o=await s.request({method:"eth_requestAccounts"}),a=await s.request({method:"eth_chainId"});if(this.listenProviderEvents(s),!o[0])throw new Error("No accounts found");if(!(i!=null&&i.type))throw new Error("Connector type not found");return{address:o[0],chainId:Number(a)||Number(n),provider:s,type:i.type,id:r}}async syncConnectors(e){var n;this.ethersConfig=await this.createEthersConfig(e),(n=this.ethersConfig)!=null&&n.EIP6963&&this.listenInjectedConnector(!0),Object.keys(this.ethersConfig||{}).filter(i=>i!=="metadata"&&i!=="EIP6963").forEach(i=>{var a,c;const s=i==="coinbase"?"coinbaseWalletSDK":i,o=i===_e.CONNECTOR_ID.INJECTED;this.namespace&&this.addConnector({id:s,explorerId:Ua.ConnectorExplorerIds[s],imageUrl:(a=e==null?void 0:e.connectorImages)==null?void 0:a[s],name:Ua.ConnectorNamesMap[s]||"Unknown",imageId:Ua.ConnectorImageIds[s],type:Ua.ConnectorTypesMap[s]??"EXTERNAL",info:o?void 0:{rdns:s},chain:this.namespace,chains:[],provider:(c=this.ethersConfig)==null?void 0:c[i]})})}setUniversalProvider(e){this.addConnector(new l7({provider:e,caipNetworks:this.getCaipNetworks(),namespace:"eip155"}))}eip6963EventHandler(e){var r;if(e.detail){const{info:n,provider:i}=e.detail;if(!((r=this.connectors)==null?void 0:r.find(o=>o.name===(n==null?void 0:n.name)))){const o=Ua.ConnectorTypesMap[_e.CONNECTOR_ID.EIP6963],a=(n==null?void 0:n.rdns)||(n==null?void 0:n.name)||(n==null?void 0:n.uuid);this.namespace&&a&&this.addConnector({id:a,type:o,imageUrl:n==null?void 0:n.icon,name:(n==null?void 0:n.name)||"Unknown",provider:i,info:n,chain:this.namespace,chains:[]})}}}listenInjectedConnector(e){if(typeof window<"u"&&e){const r=this.eip6963EventHandler.bind(this);window.addEventListener(Xt.EIP6963_ANNOUNCE_EVENT,r),window.dispatchEvent(new Event(Xt.EIP6963_REQUEST_EVENT))}}async connect({id:e,type:r,chainId:n,socialUri:i}){var u;const s=this.connectors.find(l=>l.id===e),o=s==null?void 0:s.provider;if(!o)throw new Error("Provider not found");let a=[],c;if(r==="AUTH"){const{address:l}=await o.connect({chainId:n,socialUri:i,preferredAccountType:(u=re.state.preferredAccountTypes)==null?void 0:u.eip155});a=[l],this.emit("accountChanged",{address:a[0],chainId:Number(n)})}else{if(a=await o.request({method:"eth_requestAccounts"}),c=await o.request({method:"eth_chainId"}),c!==n){const l=this.getCaipNetworks().find(d=>d.id===n);if(!l)throw new Error("EthersAdapter:connect - could not find the caipNetwork to switch");try{await this.switchNetwork({caipNetwork:l,provider:o,providerType:r})}catch{throw new Error("EthersAdapter:connect - Switch network failed")}}this.emit("accountChanged",{address:a[0],chainId:Number(n)}),this.listenProviderEvents(o)}return{address:a[0],chainId:Number(n),provider:o,type:r,id:e}}async reconnect(e){var s;const{id:r,chainId:n}=e,i=this.connectors.find(o=>o.id===r);i&&i.type==="AUTH"&&n&&await i.provider.connect({chainId:n,preferredAccountType:(s=re.state.preferredAccountTypes)==null?void 0:s.eip155})}async getAccounts(e){const r=this.connectors.find(s=>s.id===e.id),n=r==null?void 0:r.provider;if(!n||!r)throw new Error("Provider not found");if(e.id===_e.CONNECTOR_ID.AUTH){const s=r.provider;if(!s.user)return{accounts:[]};const{accounts:o,address:a}=s.user;return Promise.resolve({accounts:(o||[{address:a,type:"eoa"}]).map(c=>ue.createAccount("eip155",c.address,c.type))})}return{accounts:(await n.request({method:"eth_requestAccounts"})).map(s=>ue.createAccount("eip155",s,"eoa"))}}async disconnect(e){if(!e.provider||!e.providerType)throw new Error("Provider or providerType not provided");switch(e.providerType){case"WALLET_CONNECT":e.provider.session&&e.provider.disconnect();break;case"AUTH":await e.provider.disconnect();break;case"ANNOUNCED":case"EXTERNAL":await this.revokeProviderPermissions(e.provider);break;default:throw new Error("Unsupported provider type")}}async getBalance(e){const r=e.address,n=this.getCaipNetworks().find(i=>i.id===e.chainId);if(!r)return Promise.resolve({balance:"0.00",symbol:"ETH"});if(n&&n.chainNamespace==="eip155"){const i=`${n.caipNetworkId}:${r}`,s=this.balancePromises[i];if(s)return s;const o=Le.getNativeBalanceCacheForCaipAddress(i);if(o)return{balance:o.balance,symbol:o.symbol};const a=new r6e(n.rpcUrls.default.http[0],{chainId:n.id,name:n.name});if(a)try{return this.balancePromises[i]=new Promise(async c=>{const u=await a.getBalance(r),l=Y_e(u);Le.updateNativeBalanceCache({caipAddress:i,balance:l,symbol:n.nativeCurrency.symbol,timestamp:Date.now()}),c({balance:l,symbol:n.nativeCurrency.symbol})}).finally(()=>{delete this.balancePromises[i]}),this.balancePromises[i]||{balance:"0.00",symbol:"ETH"}}catch{return{balance:"0.00",symbol:"ETH"}}}return{balance:"0.00",symbol:"ETH"}}listenProviderEvents(e){const r=()=>{this.removeProviderListeners(e),this.emit("disconnect")},n=s=>{s.length>0?this.emit("accountChanged",{address:s[0]}):r()},i=s=>{const o=typeof s=="string"?fg.hexStringToNumber(s):Number(s);this.emit("switchNetwork",{chainId:o})};e.on("disconnect",r),e.on("accountsChanged",n),e.on("chainChanged",i),this.providerHandlers={disconnect:r,accountsChanged:n,chainChanged:i}}removeProviderListeners(e){this.providerHandlers&&(e.removeListener("disconnect",this.providerHandlers.disconnect),e.removeListener("accountsChanged",this.providerHandlers.accountsChanged),e.removeListener("chainChanged",this.providerHandlers.chainChanged),this.providerHandlers=null)}async switchNetwork(e){var s,o;const{caipNetwork:r,provider:n,providerType:i}=e;if(i==="AUTH"){await super.switchNetwork(e);return}try{await n.request({method:"wallet_switchEthereumChain",params:[{chainId:fg.numberToHexString(r.id)}]})}catch(a){if(a.code===wu.ERROR_CODE_UNRECOGNIZED_CHAIN_ID||a.code===wu.ERROR_INVALID_CHAIN_ID||a.code===wu.ERROR_CODE_DEFAULT||((o=(s=a==null?void 0:a.data)==null?void 0:s.originalError)==null?void 0:o.code)===wu.ERROR_CODE_UNRECOGNIZED_CHAIN_ID)await fg.addEthereumChain(n,r);else if(i==="ANNOUNCED"||i==="EXTERNAL"||i==="INJECTED")throw new Error("Chain is not supported")}}getWalletConnectProvider(){var e;return(e=this.connectors.find(r=>r.type==="WALLET_CONNECT"))==null?void 0:e.provider}async revokeProviderPermissions(e){try{(await e.request({method:"wallet_getPermissions"})).find(i=>i.parentCapability==="eth_accounts")&&await e.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]})}catch(r){console.info("Could not revoke permissions from wallet. Disconnecting...",r)}}async getCapabilities(e){var i,s;const r=kt.getProvider(_e.CHAIN.EVM);if(!r)throw new Error("Provider is undefined");const n=(s=(i=r.session)==null?void 0:i.sessionProperties)==null?void 0:s.capabilities;if(n){const a=ph.parseWalletCapabilities(n)[e];if(a)return a}return await r.request({method:"wallet_getCapabilities",params:[e]})}async grantPermissions(e){const r=kt.getProvider(_e.CHAIN.EVM);if(!r)throw new Error("Provider is undefined");return await r.request({method:"wallet_grantPermissions",params:e})}async revokePermissions(e){const r=kt.getProvider(_e.CHAIN.EVM);if(!r)throw new Error("Provider is undefined");return await r.request({method:"wallet_revokePermissions",params:[e]})}async walletGetAssets(e){const r=kt.getProvider(_e.CHAIN.EVM);if(!r)throw new Error("Provider is undefined");return await r.request({method:"wallet_getAssets",params:[e]})}}class N7{constructor(){ce(this,"appKit");ce(this,"config");ce(this,"_lastCallTime",0)}LOG(e){var r;(r=this.config)!=null&&r.logOpen&&console.log(e)}static create(e){const r=new N7;return e.projectId=e.projectId||"b56e18d47c72ab683b10814fe9495694",r.init(e),r}init(e){this.config=e;let r=[Gre];if(e.customNetworks)for(let i of e.customNetworks)r.push(Qm(i));let n=x_e({adapters:[new i6e],networks:r,projectId:e.projectId,themeMode:e.themeMode,themeVariables:{"--w3m-accent":"#000000"},features:e.features,allowUnsupportedChain:!0,defaultNetwork:e.defaultNetwork,metadata:e.metadata});this.initEvents(n,e),this.appKit=n}onAccountChange(e,r){this.config.onAccountChange(e,r)}onNetworkChange(e){this.config.onNetworkChange(e)}onProvidersChange(e){this.config.onProvidersChange(e)}initEvents(e){this.appKit=e;let r=this;e.subscribeAccount(r.onAccountChange.bind(r)),e.subscribeNetwork(r.onNetworkChange.bind(r)),e.subscribeProviders(r.onProvidersChange.bind(r))}async open(){await this.appKit.open()}async disconnect(){await this.appKit.disconnect()}async switchNetwork(e){await this.appKit.switchNetwork(e)}}window.PogAdapter=N7;function s6e(){if(typeof WebSocket<"u")return WebSocket;if(typeof global.WebSocket<"u")return global.WebSocket;if(typeof window.WebSocket<"u")return window.WebSocket;if(typeof self.WebSocket<"u")return self.WebSocket;throw new Error("`WebSocket` is not supported in this environment")}const o6e=s6e(),a6e=Object.freeze(Object.defineProperty({__proto__:null,WebSocket:o6e},Symbol.toStringTag,{value:"Module"}));/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const c6e={attribute:!0,type:String,converter:LC,reflect:!1,hasChanged:c7},u6e=(t=c6e,e,r)=>{const{kind:n,metadata:i}=r;let s=globalThis.litPropertyMetadata.get(i);if(s===void 0&&globalThis.litPropertyMetadata.set(i,s=new Map),n==="setter"&&((t=Object.create(t)).wrapped=!0),s.set(r.name,t),n==="accessor"){const{name:o}=r;return{set(a){const c=e.get.call(this);e.set.call(this,a),this.requestUpdate(o,c,t)},init(a){return a!==void 0&&this.C(o,void 0,t,a),a}}}if(n==="setter"){const{name:o}=r;return function(a){const c=this[o];e.call(this,a),this.requestUpdate(o,c,t)}}throw Error("Unsupported decorator location: "+n)};function q(t){return(e,r)=>typeof r=="object"?u6e(t,e,r):((n,i,s)=>{const o=i.hasOwnProperty(s);return i.constructor.createProperty(s,n),o?Object.getOwnPropertyDescriptor(i,s):void 0})(t,e,r)}/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */function G(t){return q({...t,state:!0,attribute:!1})}const l6e=de` div { width: 100%; } [data-ready='false'] { transform: scale(1.05); } @media (max-width: 430px) { [data-ready='false'] { transform: translateY(-50px); } } `;var $J=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};const OS=600,qB=360,d6e=64;let Oy=class extends se{constructor(){super(),this.bodyObserver=void 0,this.unsubscribe=[],this.iframe=document.getElementById("w3m-iframe"),this.ready=!1,this.unsubscribe.push(We.subscribeKey("open",e=>{e||this.onHideIframe()}),We.subscribeKey("shake",e=>{e?this.iframe.style.animation="w3m-shake 500ms var(--wui-ease-out-power-2)":this.iframe.style.animation="none"}))}disconnectedCallback(){var e;this.onHideIframe(),this.unsubscribe.forEach(r=>r()),(e=this.bodyObserver)==null||e.unobserve(window.document.body)}async firstUpdated(){var r;await this.syncTheme(),this.iframe.style.display="block";const e=(r=this==null?void 0:this.renderRoot)==null?void 0:r.querySelector("div");this.bodyObserver=new ResizeObserver(n=>{var o,a;const i=(o=n==null?void 0:n[0])==null?void 0:o.contentBoxSize,s=(a=i==null?void 0:i[0])==null?void 0:a.inlineSize;this.iframe.style.height=`${OS}px`,e.style.height=`${OS}px`,s&&s<=430?(this.iframe.style.width="100%",this.iframe.style.left="0px",this.iframe.style.bottom="0px",this.iframe.style.top="unset"):(this.iframe.style.width=`${qB}px`,this.iframe.style.left=`calc(50% - ${qB/2}px)`,this.iframe.style.top=`calc(50% - ${OS/2}px + ${d6e/2}px)`,this.iframe.style.bottom="unset"),this.ready=!0,this.onShowIframe()}),this.bodyObserver.observe(window.document.body)}render(){return M`
`}onShowIframe(){const e=window.innerWidth<=430;this.iframe.style.animation=e?"w3m-iframe-zoom-in-mobile 200ms var(--wui-ease-out-power-2)":"w3m-iframe-zoom-in 200ms var(--wui-ease-out-power-2)"}onHideIframe(){this.iframe.style.display="none",this.iframe.style.animation="w3m-iframe-fade-out 200ms var(--wui-ease-out-power-2)"}async syncTheme(){const e=ge.getAuthConnector();if(e){const r=ar.getSnapshot().themeMode,n=ar.getSnapshot().themeVariables;await e.provider.syncTheme({themeVariables:n,w3mThemeVariables:za(n,r)})}}};Oy.styles=l6e;$J([G()],Oy.prototype,"ready",void 0);Oy=$J([te("w3m-approve-transaction-view")],Oy);/** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const h6e=t=>t===null||typeof t!="object"&&typeof t!="function",f6e=t=>t.strings===void 0;/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const jJ={ATTRIBUTE:1,CHILD:2},$7=t=>(...e)=>({_$litDirective$:t,values:e});let BJ=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,r,n){this._$Ct=e,this._$AM=r,this._$Ci=n}_$AS(e,r){return this.update(e,r)}update(e,r){return this.render(...r)}};/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const _b=(t,e)=>{var n;const r=t._$AN;if(r===void 0)return!1;for(const i of r)(n=i._$AO)==null||n.call(i,e,!1),_b(i,e);return!0},t6=t=>{let e,r;do{if((e=t._$AM)===void 0)break;r=e._$AN,r.delete(t),t=e}while((r==null?void 0:r.size)===0)},DJ=t=>{for(let e;e=t._$AM;t=e){let r=e._$AN;if(r===void 0)e._$AN=r=new Set;else if(r.has(t))break;r.add(t),m6e(e)}};function p6e(t){this._$AN!==void 0?(t6(this),this._$AM=t,DJ(this)):this._$AM=t}function g6e(t,e=!1,r=0){const n=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(e)if(Array.isArray(n))for(let s=r;s{t.type==jJ.CHILD&&(t._$AP??(t._$AP=g6e),t._$AQ??(t._$AQ=p6e))};let MJ=class extends BJ{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,r,n){super._$AT(e,r,n),DJ(this),this.isConnected=e._$AU}_$AO(e,r=!0){var n,i;e!==this.isConnected&&(this.isConnected=e,e?(n=this.reconnected)==null||n.call(this):(i=this.disconnected)==null||i.call(this)),r&&(_b(this,e),t6(this))}setValue(e){if(f6e(this._$Ct))this._$Ct._$AI(e,this);else{const r=[...this._$Ct._$AH];r[this._$Ci]=e,this._$Ct._$AI(r,this,0)}}disconnected(){}reconnected(){}};/** * @license * Copyright 2021 Google LLC * SPDX-License-Identifier: BSD-3-Clause */let w6e=class{constructor(e){this.G=e}disconnect(){this.G=void 0}reconnect(e){this.G=e}deref(){return this.G}},b6e=class{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){this.Y??(this.Y=new Promise(e=>this.Z=e))}resume(){var e;(e=this.Z)==null||e.call(this),this.Y=this.Z=void 0}};/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const zB=t=>!h6e(t)&&typeof t.then=="function",WB=1073741823;let y6e=class extends MJ{constructor(){super(...arguments),this._$Cwt=WB,this._$Cbt=[],this._$CK=new w6e(this),this._$CX=new b6e}render(...e){return e.find(r=>!zB(r))??Ru}update(e,r){const n=this._$Cbt;let i=n.length;this._$Cbt=r;const s=this._$CK,o=this._$CX;this.isConnected||this.disconnected();for(let a=0;athis._$Cwt);a++){const c=r[a];if(!zB(c))return this._$Cwt=a,c;a{for(;o.get();)await o.get();const l=s.deref();if(l!==void 0){const d=l._$Cbt.indexOf(c);d>-1&&d=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};const VB={add:async()=>(await ke(async()=>{const{addSvg:t}=await Promise.resolve().then(()=>vOe);return{addSvg:t}},void 0)).addSvg,allWallets:async()=>(await ke(async()=>{const{allWalletsSvg:t}=await Promise.resolve().then(()=>EOe);return{allWalletsSvg:t}},void 0)).allWalletsSvg,arrowBottomCircle:async()=>(await ke(async()=>{const{arrowBottomCircleSvg:t}=await Promise.resolve().then(()=>AOe);return{arrowBottomCircleSvg:t}},void 0)).arrowBottomCircleSvg,appStore:async()=>(await ke(async()=>{const{appStoreSvg:t}=await Promise.resolve().then(()=>SOe);return{appStoreSvg:t}},void 0)).appStoreSvg,apple:async()=>(await ke(async()=>{const{appleSvg:t}=await Promise.resolve().then(()=>IOe);return{appleSvg:t}},void 0)).appleSvg,arrowBottom:async()=>(await ke(async()=>{const{arrowBottomSvg:t}=await Promise.resolve().then(()=>OOe);return{arrowBottomSvg:t}},void 0)).arrowBottomSvg,arrowLeft:async()=>(await ke(async()=>{const{arrowLeftSvg:t}=await Promise.resolve().then(()=>kOe);return{arrowLeftSvg:t}},void 0)).arrowLeftSvg,arrowRight:async()=>(await ke(async()=>{const{arrowRightSvg:t}=await Promise.resolve().then(()=>$Oe);return{arrowRightSvg:t}},void 0)).arrowRightSvg,arrowTop:async()=>(await ke(async()=>{const{arrowTopSvg:t}=await Promise.resolve().then(()=>BOe);return{arrowTopSvg:t}},void 0)).arrowTopSvg,bank:async()=>(await ke(async()=>{const{bankSvg:t}=await Promise.resolve().then(()=>MOe);return{bankSvg:t}},void 0)).bankSvg,browser:async()=>(await ke(async()=>{const{browserSvg:t}=await Promise.resolve().then(()=>UOe);return{browserSvg:t}},void 0)).browserSvg,card:async()=>(await ke(async()=>{const{cardSvg:t}=await Promise.resolve().then(()=>HOe);return{cardSvg:t}},void 0)).cardSvg,checkmark:async()=>(await ke(async()=>{const{checkmarkSvg:t}=await Promise.resolve().then(()=>zOe);return{checkmarkSvg:t}},void 0)).checkmarkSvg,checkmarkBold:async()=>(await ke(async()=>{const{checkmarkBoldSvg:t}=await Promise.resolve().then(()=>VOe);return{checkmarkBoldSvg:t}},void 0)).checkmarkBoldSvg,chevronBottom:async()=>(await ke(async()=>{const{chevronBottomSvg:t}=await Promise.resolve().then(()=>KOe);return{chevronBottomSvg:t}},void 0)).chevronBottomSvg,chevronLeft:async()=>(await ke(async()=>{const{chevronLeftSvg:t}=await Promise.resolve().then(()=>YOe);return{chevronLeftSvg:t}},void 0)).chevronLeftSvg,chevronRight:async()=>(await ke(async()=>{const{chevronRightSvg:t}=await Promise.resolve().then(()=>QOe);return{chevronRightSvg:t}},void 0)).chevronRightSvg,chevronTop:async()=>(await ke(async()=>{const{chevronTopSvg:t}=await Promise.resolve().then(()=>eRe);return{chevronTopSvg:t}},void 0)).chevronTopSvg,chromeStore:async()=>(await ke(async()=>{const{chromeStoreSvg:t}=await Promise.resolve().then(()=>rRe);return{chromeStoreSvg:t}},void 0)).chromeStoreSvg,clock:async()=>(await ke(async()=>{const{clockSvg:t}=await Promise.resolve().then(()=>iRe);return{clockSvg:t}},void 0)).clockSvg,close:async()=>(await ke(async()=>{const{closeSvg:t}=await Promise.resolve().then(()=>oRe);return{closeSvg:t}},void 0)).closeSvg,compass:async()=>(await ke(async()=>{const{compassSvg:t}=await Promise.resolve().then(()=>cRe);return{compassSvg:t}},void 0)).compassSvg,coinPlaceholder:async()=>(await ke(async()=>{const{coinPlaceholderSvg:t}=await Promise.resolve().then(()=>lRe);return{coinPlaceholderSvg:t}},void 0)).coinPlaceholderSvg,copy:async()=>(await ke(async()=>{const{copySvg:t}=await Promise.resolve().then(()=>hRe);return{copySvg:t}},void 0)).copySvg,cursor:async()=>(await ke(async()=>{const{cursorSvg:t}=await Promise.resolve().then(()=>pRe);return{cursorSvg:t}},void 0)).cursorSvg,cursorTransparent:async()=>(await ke(async()=>{const{cursorTransparentSvg:t}=await Promise.resolve().then(()=>mRe);return{cursorTransparentSvg:t}},void 0)).cursorTransparentSvg,desktop:async()=>(await ke(async()=>{const{desktopSvg:t}=await Promise.resolve().then(()=>bRe);return{desktopSvg:t}},void 0)).desktopSvg,disconnect:async()=>(await ke(async()=>{const{disconnectSvg:t}=await Promise.resolve().then(()=>vRe);return{disconnectSvg:t}},void 0)).disconnectSvg,discord:async()=>(await ke(async()=>{const{discordSvg:t}=await Promise.resolve().then(()=>ERe);return{discordSvg:t}},void 0)).discordSvg,etherscan:async()=>(await ke(async()=>{const{etherscanSvg:t}=await Promise.resolve().then(()=>ARe);return{etherscanSvg:t}},void 0)).etherscanSvg,extension:async()=>(await ke(async()=>{const{extensionSvg:t}=await Promise.resolve().then(()=>SRe);return{extensionSvg:t}},void 0)).extensionSvg,externalLink:async()=>(await ke(async()=>{const{externalLinkSvg:t}=await Promise.resolve().then(()=>IRe);return{externalLinkSvg:t}},void 0)).externalLinkSvg,facebook:async()=>(await ke(async()=>{const{facebookSvg:t}=await Promise.resolve().then(()=>ORe);return{facebookSvg:t}},void 0)).facebookSvg,farcaster:async()=>(await ke(async()=>{const{farcasterSvg:t}=await Promise.resolve().then(()=>kRe);return{farcasterSvg:t}},void 0)).farcasterSvg,filters:async()=>(await ke(async()=>{const{filtersSvg:t}=await Promise.resolve().then(()=>$Re);return{filtersSvg:t}},void 0)).filtersSvg,github:async()=>(await ke(async()=>{const{githubSvg:t}=await Promise.resolve().then(()=>BRe);return{githubSvg:t}},void 0)).githubSvg,google:async()=>(await ke(async()=>{const{googleSvg:t}=await Promise.resolve().then(()=>MRe);return{googleSvg:t}},void 0)).googleSvg,helpCircle:async()=>(await ke(async()=>{const{helpCircleSvg:t}=await Promise.resolve().then(()=>URe);return{helpCircleSvg:t}},void 0)).helpCircleSvg,image:async()=>(await ke(async()=>{const{imageSvg:t}=await Promise.resolve().then(()=>HRe);return{imageSvg:t}},void 0)).imageSvg,id:async()=>(await ke(async()=>{const{idSvg:t}=await Promise.resolve().then(()=>zRe);return{idSvg:t}},void 0)).idSvg,infoCircle:async()=>(await ke(async()=>{const{infoCircleSvg:t}=await Promise.resolve().then(()=>VRe);return{infoCircleSvg:t}},void 0)).infoCircleSvg,lightbulb:async()=>(await ke(async()=>{const{lightbulbSvg:t}=await Promise.resolve().then(()=>KRe);return{lightbulbSvg:t}},void 0)).lightbulbSvg,mail:async()=>(await ke(async()=>{const{mailSvg:t}=await Promise.resolve().then(()=>YRe);return{mailSvg:t}},void 0)).mailSvg,mobile:async()=>(await ke(async()=>{const{mobileSvg:t}=await Promise.resolve().then(()=>QRe);return{mobileSvg:t}},void 0)).mobileSvg,more:async()=>(await ke(async()=>{const{moreSvg:t}=await Promise.resolve().then(()=>eke);return{moreSvg:t}},void 0)).moreSvg,networkPlaceholder:async()=>(await ke(async()=>{const{networkPlaceholderSvg:t}=await Promise.resolve().then(()=>rke);return{networkPlaceholderSvg:t}},void 0)).networkPlaceholderSvg,nftPlaceholder:async()=>(await ke(async()=>{const{nftPlaceholderSvg:t}=await Promise.resolve().then(()=>ike);return{nftPlaceholderSvg:t}},void 0)).nftPlaceholderSvg,off:async()=>(await ke(async()=>{const{offSvg:t}=await Promise.resolve().then(()=>oke);return{offSvg:t}},void 0)).offSvg,playStore:async()=>(await ke(async()=>{const{playStoreSvg:t}=await Promise.resolve().then(()=>cke);return{playStoreSvg:t}},void 0)).playStoreSvg,plus:async()=>(await ke(async()=>{const{plusSvg:t}=await Promise.resolve().then(()=>lke);return{plusSvg:t}},void 0)).plusSvg,qrCode:async()=>(await ke(async()=>{const{qrCodeIcon:t}=await Promise.resolve().then(()=>hke);return{qrCodeIcon:t}},void 0)).qrCodeIcon,recycleHorizontal:async()=>(await ke(async()=>{const{recycleHorizontalSvg:t}=await Promise.resolve().then(()=>pke);return{recycleHorizontalSvg:t}},void 0)).recycleHorizontalSvg,refresh:async()=>(await ke(async()=>{const{refreshSvg:t}=await Promise.resolve().then(()=>mke);return{refreshSvg:t}},void 0)).refreshSvg,search:async()=>(await ke(async()=>{const{searchSvg:t}=await Promise.resolve().then(()=>bke);return{searchSvg:t}},void 0)).searchSvg,send:async()=>(await ke(async()=>{const{sendSvg:t}=await Promise.resolve().then(()=>vke);return{sendSvg:t}},void 0)).sendSvg,swapHorizontal:async()=>(await ke(async()=>{const{swapHorizontalSvg:t}=await Promise.resolve().then(()=>Eke);return{swapHorizontalSvg:t}},void 0)).swapHorizontalSvg,swapHorizontalMedium:async()=>(await ke(async()=>{const{swapHorizontalMediumSvg:t}=await Promise.resolve().then(()=>Ake);return{swapHorizontalMediumSvg:t}},void 0)).swapHorizontalMediumSvg,swapHorizontalBold:async()=>(await ke(async()=>{const{swapHorizontalBoldSvg:t}=await Promise.resolve().then(()=>Ske);return{swapHorizontalBoldSvg:t}},void 0)).swapHorizontalBoldSvg,swapHorizontalRoundedBold:async()=>(await ke(async()=>{const{swapHorizontalRoundedBoldSvg:t}=await Promise.resolve().then(()=>Ike);return{swapHorizontalRoundedBoldSvg:t}},void 0)).swapHorizontalRoundedBoldSvg,swapVertical:async()=>(await ke(async()=>{const{swapVerticalSvg:t}=await Promise.resolve().then(()=>Oke);return{swapVerticalSvg:t}},void 0)).swapVerticalSvg,telegram:async()=>(await ke(async()=>{const{telegramSvg:t}=await Promise.resolve().then(()=>kke);return{telegramSvg:t}},void 0)).telegramSvg,threeDots:async()=>(await ke(async()=>{const{threeDotsSvg:t}=await Promise.resolve().then(()=>$ke);return{threeDotsSvg:t}},void 0)).threeDotsSvg,twitch:async()=>(await ke(async()=>{const{twitchSvg:t}=await Promise.resolve().then(()=>Bke);return{twitchSvg:t}},void 0)).twitchSvg,twitter:async()=>(await ke(async()=>{const{xSvg:t}=await Promise.resolve().then(()=>VW);return{xSvg:t}},void 0)).xSvg,twitterIcon:async()=>(await ke(async()=>{const{twitterIconSvg:t}=await Promise.resolve().then(()=>Lke);return{twitterIconSvg:t}},void 0)).twitterIconSvg,verify:async()=>(await ke(async()=>{const{verifySvg:t}=await Promise.resolve().then(()=>Fke);return{verifySvg:t}},void 0)).verifySvg,verifyFilled:async()=>(await ke(async()=>{const{verifyFilledSvg:t}=await Promise.resolve().then(()=>qke);return{verifyFilledSvg:t}},void 0)).verifyFilledSvg,wallet:async()=>(await ke(async()=>{const{walletSvg:t}=await Promise.resolve().then(()=>Wke);return{walletSvg:t}},void 0)).walletSvg,walletConnect:async()=>(await ke(async()=>{const{walletConnectSvg:t}=await Promise.resolve().then(()=>VT);return{walletConnectSvg:t}},void 0)).walletConnectSvg,walletConnectLightBrown:async()=>(await ke(async()=>{const{walletConnectLightBrownSvg:t}=await Promise.resolve().then(()=>VT);return{walletConnectLightBrownSvg:t}},void 0)).walletConnectLightBrownSvg,walletConnectBrown:async()=>(await ke(async()=>{const{walletConnectBrownSvg:t}=await Promise.resolve().then(()=>VT);return{walletConnectBrownSvg:t}},void 0)).walletConnectBrownSvg,walletPlaceholder:async()=>(await ke(async()=>{const{walletPlaceholderSvg:t}=await Promise.resolve().then(()=>Yke);return{walletPlaceholderSvg:t}},void 0)).walletPlaceholderSvg,warningCircle:async()=>(await ke(async()=>{const{warningCircleSvg:t}=await Promise.resolve().then(()=>Qke);return{warningCircleSvg:t}},void 0)).warningCircleSvg,x:async()=>(await ke(async()=>{const{xSvg:t}=await Promise.resolve().then(()=>VW);return{xSvg:t}},void 0)).xSvg,info:async()=>(await ke(async()=>{const{infoSvg:t}=await Promise.resolve().then(()=>eNe);return{infoSvg:t}},void 0)).infoSvg,exclamationTriangle:async()=>(await ke(async()=>{const{exclamationTriangleSvg:t}=await Promise.resolve().then(()=>rNe);return{exclamationTriangleSvg:t}},void 0)).exclamationTriangleSvg,reown:async()=>(await ke(async()=>{const{reownSvg:t}=await Promise.resolve().then(()=>iNe);return{reownSvg:t}},void 0)).reownSvg};async function C6e(t){if(RS.has(t))return RS.get(t);const r=(VB[t]??VB.copy)();return RS.set(t,r),r}let Jf=class extends se{constructor(){super(...arguments),this.size="md",this.name="copy",this.color="fg-300",this.aspectRatio="1 / 1"}render(){return this.style.cssText=` --local-color: ${`var(--wui-color-${this.color});`} --local-width: ${`var(--wui-icon-size-${this.size});`} --local-aspect-ratio: ${this.aspectRatio} `,M`${v6e(C6e(this.name),M`
`)}`}};Jf.styles=[He,qv,E6e];Yv([q()],Jf.prototype,"size",void 0);Yv([q()],Jf.prototype,"name",void 0);Yv([q()],Jf.prototype,"color",void 0);Yv([q()],Jf.prototype,"aspectRatio",void 0);Jf=Yv([te("wui-icon")],Jf);const A6e=de` :host { display: block; width: var(--local-width); height: var(--local-height); } img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center center; border-radius: inherit; } `;var xA=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Om=class extends se{constructor(){super(...arguments),this.src="./path/to/image.jpg",this.alt="Image",this.size=void 0}render(){return this.style.cssText=` --local-width: ${this.size?`var(--wui-icon-size-${this.size});`:"100%"}; --local-height: ${this.size?`var(--wui-icon-size-${this.size});`:"100%"}; `,M`${this.alt}`}handleImageError(){this.dispatchEvent(new CustomEvent("onLoadError",{bubbles:!0,composed:!0}))}};Om.styles=[He,qv,A6e];xA([q()],Om.prototype,"src",void 0);xA([q()],Om.prototype,"alt",void 0);xA([q()],Om.prototype,"size",void 0);Om=xA([te("wui-image")],Om);/** * @license * Copyright 2018 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const r6=$7(class extends BJ{constructor(t){var e;if(super(t),t.type!==jJ.ATTRIBUTE||t.name!=="class"||((e=t.strings)==null?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter(e=>t[e]).join(" ")+" "}update(t,[e]){var n,i;if(this.st===void 0){this.st=new Set,t.strings!==void 0&&(this.nt=new Set(t.strings.join(" ").split(/\s/).filter(s=>s!=="")));for(const s in e)e[s]&&!((n=this.nt)!=null&&n.has(s))&&this.st.add(s);return this.render(e)}const r=t.element.classList;for(const s of this.st)s in e||(r.remove(s),this.st.delete(s));for(const s in e){const o=!!e[s];o===this.st.has(s)||(i=this.nt)!=null&&i.has(s)||(o?(r.add(s),this.st.add(s)):(r.remove(s),this.st.delete(s)))}return Ru}}),x6e=de` :host { display: inline-flex !important; } slot { width: 100%; display: inline-block; font-style: normal; font-family: var(--wui-font-family); font-feature-settings: 'tnum' on, 'lnum' on, 'case' on; line-height: 130%; font-weight: var(--wui-font-weight-regular); overflow: inherit; text-overflow: inherit; text-align: var(--local-align); color: var(--local-color); } .wui-line-clamp-1 { overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; } .wui-line-clamp-2 { overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; } .wui-font-medium-400 { font-size: var(--wui-font-size-medium); font-weight: var(--wui-font-weight-light); letter-spacing: var(--wui-letter-spacing-medium); } .wui-font-medium-600 { font-size: var(--wui-font-size-medium); letter-spacing: var(--wui-letter-spacing-medium); } .wui-font-title-600 { font-size: var(--wui-font-size-title); letter-spacing: var(--wui-letter-spacing-title); } .wui-font-title-6-600 { font-size: var(--wui-font-size-title-6); letter-spacing: var(--wui-letter-spacing-title-6); } .wui-font-mini-700 { font-size: var(--wui-font-size-mini); letter-spacing: var(--wui-letter-spacing-mini); text-transform: uppercase; } .wui-font-large-500, .wui-font-large-600, .wui-font-large-700 { font-size: var(--wui-font-size-large); letter-spacing: var(--wui-letter-spacing-large); } .wui-font-2xl-500, .wui-font-2xl-600, .wui-font-2xl-700 { font-size: var(--wui-font-size-2xl); letter-spacing: var(--wui-letter-spacing-2xl); } .wui-font-paragraph-400, .wui-font-paragraph-500, .wui-font-paragraph-600, .wui-font-paragraph-700 { font-size: var(--wui-font-size-paragraph); letter-spacing: var(--wui-letter-spacing-paragraph); } .wui-font-small-400, .wui-font-small-500, .wui-font-small-600 { font-size: var(--wui-font-size-small); letter-spacing: var(--wui-letter-spacing-small); } .wui-font-tiny-400, .wui-font-tiny-500, .wui-font-tiny-600 { font-size: var(--wui-font-size-tiny); letter-spacing: var(--wui-letter-spacing-tiny); } .wui-font-micro-700, .wui-font-micro-600 { font-size: var(--wui-font-size-micro); letter-spacing: var(--wui-letter-spacing-micro); text-transform: uppercase; } .wui-font-tiny-400, .wui-font-small-400, .wui-font-medium-400, .wui-font-paragraph-400 { font-weight: var(--wui-font-weight-light); } .wui-font-large-700, .wui-font-paragraph-700, .wui-font-micro-700, .wui-font-mini-700 { font-weight: var(--wui-font-weight-bold); } .wui-font-medium-600, .wui-font-medium-title-600, .wui-font-title-6-600, .wui-font-large-600, .wui-font-paragraph-600, .wui-font-small-600, .wui-font-tiny-600, .wui-font-micro-600 { font-weight: var(--wui-font-weight-medium); } :host([disabled]) { opacity: 0.4; } `;var Jv=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Qf=class extends se{constructor(){super(...arguments),this.variant="paragraph-500",this.color="fg-300",this.align="left",this.lineClamp=void 0}render(){const e={[`wui-font-${this.variant}`]:!0,[`wui-color-${this.color}`]:!0,[`wui-line-clamp-${this.lineClamp}`]:!!this.lineClamp};return this.style.cssText=` --local-align: ${this.align}; --local-color: var(--wui-color-${this.color}); `,M``}};Qf.styles=[He,x6e];Jv([q()],Qf.prototype,"variant",void 0);Jv([q()],Qf.prototype,"color",void 0);Jv([q()],Qf.prototype,"align",void 0);Jv([q()],Qf.prototype,"lineClamp",void 0);Qf=Jv([te("wui-text")],Qf);const S6e=de` a { border: 1px solid var(--wui-color-gray-glass-010); border-radius: var(--wui-border-radius-3xl); } wui-image { border-radius: var(--wui-border-radius-3xl); overflow: hidden; } a.disabled > wui-icon:not(.image-icon), a.disabled > wui-image { filter: grayscale(1); } a[data-variant='fill'] { color: var(--wui-color-inverse-100); background-color: var(--wui-color-accent-100); } a[data-variant='shade'], a[data-variant='shadeSmall'] { background-color: transparent; background-color: var(--wui-color-gray-glass-010); color: var(--wui-color-fg-200); } a[data-variant='success'] { column-gap: var(--wui-spacing-xxs); border: 1px solid var(--wui-color-success-glass-010); background-color: var(--wui-color-success-glass-010); color: var(--wui-color-success-100); } a[data-variant='error'] { column-gap: var(--wui-spacing-xxs); border: 1px solid var(--wui-color-error-glass-010); background-color: var(--wui-color-error-glass-010); color: var(--wui-color-error-100); } a[data-variant='transparent'] { column-gap: var(--wui-spacing-xxs); background-color: transparent; color: var(--wui-color-fg-150); } a[data-variant='transparent'], a[data-variant='success'], a[data-variant='shadeSmall'], a[data-variant='error'] { padding: 7px var(--wui-spacing-s) 7px 10px; } a[data-variant='transparent']:has(wui-text:first-child), a[data-variant='success']:has(wui-text:first-child), a[data-variant='shadeSmall']:has(wui-text:first-child), a[data-variant='error']:has(wui-text:first-child) { padding: 7px var(--wui-spacing-s); } a[data-variant='fill'], a[data-variant='shade'] { column-gap: var(--wui-spacing-xs); padding: var(--wui-spacing-xxs) var(--wui-spacing-m) var(--wui-spacing-xxs) var(--wui-spacing-xs); } a[data-variant='fill']:has(wui-text:first-child), a[data-variant='shade']:has(wui-text:first-child) { padding: 9px var(--wui-spacing-m) 9px var(--wui-spacing-m); } a[data-variant='fill'] > wui-image, a[data-variant='shade'] > wui-image { width: 24px; height: 24px; } a[data-variant='fill'] > wui-image { box-shadow: inset 0 0 0 1px var(--wui-color-accent-090); } a[data-variant='shade'] > wui-image, a[data-variant='shadeSmall'] > wui-image { box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-010); } a[data-variant='fill'] > wui-icon:not(.image-icon), a[data-variant='shade'] > wui-icon:not(.image-icon) { width: 14px; height: 14px; } a[data-variant='transparent'] > wui-image, a[data-variant='success'] > wui-image, a[data-variant='shadeSmall'] > wui-image, a[data-variant='error'] > wui-image { width: 14px; height: 14px; } a[data-variant='transparent'] > wui-icon:not(.image-icon), a[data-variant='success'] > wui-icon:not(.image-icon), a[data-variant='shadeSmall'] > wui-icon:not(.image-icon), a[data-variant='error'] > wui-icon:not(.image-icon) { width: 12px; height: 12px; } a[data-variant='fill']:focus-visible { background-color: var(--wui-color-accent-090); } a[data-variant='shade']:focus-visible, a[data-variant='shadeSmall']:focus-visible { background-color: var(--wui-color-gray-glass-015); } a[data-variant='transparent']:focus-visible { background-color: var(--wui-color-gray-glass-005); } a[data-variant='success']:focus-visible { background-color: var(--wui-color-success-glass-015); } a[data-variant='error']:focus-visible { background-color: var(--wui-color-error-glass-015); } a.disabled { color: var(--wui-color-gray-glass-015); background-color: var(--wui-color-gray-glass-015); pointer-events: none; } @media (hover: hover) and (pointer: fine) { a[data-variant='fill']:hover { background-color: var(--wui-color-accent-090); } a[data-variant='shade']:hover, a[data-variant='shadeSmall']:hover { background-color: var(--wui-color-gray-glass-015); } a[data-variant='transparent']:hover { background-color: var(--wui-color-gray-glass-005); } a[data-variant='success']:hover { background-color: var(--wui-color-success-glass-015); } a[data-variant='error']:hover { background-color: var(--wui-color-error-glass-015); } } a[data-variant='fill']:active { background-color: var(--wui-color-accent-080); } a[data-variant='shade']:active, a[data-variant='shadeSmall']:active { background-color: var(--wui-color-gray-glass-020); } a[data-variant='transparent']:active { background-color: var(--wui-color-gray-glass-010); } a[data-variant='success']:active { background-color: var(--wui-color-success-glass-020); } a[data-variant='error']:active { background-color: var(--wui-color-error-glass-020); } `;var Ku=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Go=class extends se{constructor(){super(...arguments),this.variant="fill",this.imageSrc=void 0,this.imageIcon=void 0,this.imageIconSize="md",this.disabled=!1,this.icon="externalLink",this.href="",this.text=void 0}render(){const r=this.variant==="success"||this.variant==="transparent"||this.variant==="shadeSmall"?"small-600":"paragraph-600";return M` ${this.imageTemplate()} ${this.title?this.title:nt.getHostName(this.href)} `}imageTemplate(){return this.imageSrc?M``:this.imageIcon?M``:null}};Go.styles=[He,vt,S6e];Ku([q()],Go.prototype,"variant",void 0);Ku([q()],Go.prototype,"imageSrc",void 0);Ku([q()],Go.prototype,"imageIcon",void 0);Ku([q()],Go.prototype,"imageIconSize",void 0);Ku([q({type:Boolean})],Go.prototype,"disabled",void 0);Ku([q()],Go.prototype,"icon",void 0);Ku([q()],Go.prototype,"href",void 0);Ku([q()],Go.prototype,"text",void 0);Go=Ku([te("wui-chip")],Go);const T6e=de` :host { display: flex; width: inherit; height: inherit; } `;var ks=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let xi=class extends se{render(){return this.style.cssText=` flex-direction: ${this.flexDirection}; flex-wrap: ${this.flexWrap}; flex-basis: ${this.flexBasis}; flex-grow: ${this.flexGrow}; flex-shrink: ${this.flexShrink}; align-items: ${this.alignItems}; justify-content: ${this.justifyContent}; column-gap: ${this.columnGap&&`var(--wui-spacing-${this.columnGap})`}; row-gap: ${this.rowGap&&`var(--wui-spacing-${this.rowGap})`}; gap: ${this.gap&&`var(--wui-spacing-${this.gap})`}; padding-top: ${this.padding&&nt.getSpacingStyles(this.padding,0)}; padding-right: ${this.padding&&nt.getSpacingStyles(this.padding,1)}; padding-bottom: ${this.padding&&nt.getSpacingStyles(this.padding,2)}; padding-left: ${this.padding&&nt.getSpacingStyles(this.padding,3)}; margin-top: ${this.margin&&nt.getSpacingStyles(this.margin,0)}; margin-right: ${this.margin&&nt.getSpacingStyles(this.margin,1)}; margin-bottom: ${this.margin&&nt.getSpacingStyles(this.margin,2)}; margin-left: ${this.margin&&nt.getSpacingStyles(this.margin,3)}; `,M``}};xi.styles=[He,T6e];ks([q()],xi.prototype,"flexDirection",void 0);ks([q()],xi.prototype,"flexWrap",void 0);ks([q()],xi.prototype,"flexBasis",void 0);ks([q()],xi.prototype,"flexGrow",void 0);ks([q()],xi.prototype,"flexShrink",void 0);ks([q()],xi.prototype,"alignItems",void 0);ks([q()],xi.prototype,"justifyContent",void 0);ks([q()],xi.prototype,"columnGap",void 0);ks([q()],xi.prototype,"rowGap",void 0);ks([q()],xi.prototype,"gap",void 0);ks([q()],xi.prototype,"padding",void 0);ks([q()],xi.prototype,"margin",void 0);xi=ks([te("wui-flex")],xi);var I6e=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let kP=class extends se{render(){return M` Follow the instructions on You will have to reconnect for security reasons `}};kP=I6e([te("w3m-upgrade-wallet-view")],kP);/** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const ec=()=>new P6e;let P6e=class{};const kS=new WeakMap,tc=$7(class extends MJ{render(t){return Jr}update(t,[e]){var n;const r=e!==this.G;return r&&this.G!==void 0&&this.rt(void 0),(r||this.lt!==this.ct)&&(this.G=e,this.ht=(n=t.options)==null?void 0:n.host,this.rt(this.ct=t.element)),Jr}rt(t){if(this.isConnected||(t=void 0),typeof this.G=="function"){const e=this.ht??globalThis;let r=kS.get(e);r===void 0&&(r=new WeakMap,kS.set(e,r)),r.get(this.G)!==void 0&&this.G.call(this.ht,void 0),r.set(this.G,t),t!==void 0&&this.G.call(this.ht,t)}else this.G.value=t}get lt(){var t,e;return typeof this.G=="function"?(t=kS.get(this.ht??globalThis))==null?void 0:t.get(this.G):(e=this.G)==null?void 0:e.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});/** * @license * Copyright 2018 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const we=t=>t??Jr,O6e=de` :host { display: flex; } :host([data-size='sm']) > svg { width: 12px; height: 12px; } :host([data-size='md']) > svg { width: 16px; height: 16px; } :host([data-size='lg']) > svg { width: 24px; height: 24px; } :host([data-size='xl']) > svg { width: 32px; height: 32px; } svg { animation: rotate 2s linear infinite; } circle { fill: none; stroke: var(--local-color); stroke-width: 4px; stroke-dasharray: 1, 124; stroke-dashoffset: 0; stroke-linecap: round; animation: dash 1.5s ease-in-out infinite; } :host([data-size='md']) > svg > circle { stroke-width: 6px; } :host([data-size='sm']) > svg > circle { stroke-width: 8px; } @keyframes rotate { 100% { transform: rotate(360deg); } } @keyframes dash { 0% { stroke-dasharray: 1, 124; stroke-dashoffset: 0; } 50% { stroke-dasharray: 90, 124; stroke-dashoffset: -35; } 100% { stroke-dashoffset: -125; } } `;var j7=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Ry=class extends se{constructor(){super(...arguments),this.color="accent-100",this.size="lg"}render(){return this.style.cssText=`--local-color: ${this.color==="inherit"?"inherit":`var(--wui-color-${this.color})`}`,this.dataset.size=this.size,M` `}};Ry.styles=[He,O6e];j7([q()],Ry.prototype,"color",void 0);j7([q()],Ry.prototype,"size",void 0);Ry=j7([te("wui-loading-spinner")],Ry);const R6e=de` :host { position: relative; width: 100%; display: inline-block; color: var(--wui-color-fg-275); } input { width: 100%; border-radius: var(--wui-border-radius-xs); box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-002); background: var(--wui-color-gray-glass-002); font-size: var(--wui-font-size-paragraph); letter-spacing: var(--wui-letter-spacing-paragraph); color: var(--wui-color-fg-100); transition: background-color var(--wui-ease-inout-power-1) var(--wui-duration-md), border-color var(--wui-ease-inout-power-1) var(--wui-duration-md), box-shadow var(--wui-ease-inout-power-1) var(--wui-duration-md); will-change: background-color, border-color, box-shadow; caret-color: var(--wui-color-accent-100); } input:disabled { cursor: not-allowed; border: 1px solid var(--wui-color-gray-glass-010); } input:disabled::placeholder, input:disabled + wui-icon { color: var(--wui-color-fg-300); } input::placeholder { color: var(--wui-color-fg-275); } input:focus:enabled { background-color: var(--wui-color-gray-glass-005); -webkit-box-shadow: inset 0 0 0 1px var(--wui-color-accent-100), 0px 0px 0px 4px var(--wui-box-shadow-blue); -moz-box-shadow: inset 0 0 0 1px var(--wui-color-accent-100), 0px 0px 0px 4px var(--wui-box-shadow-blue); box-shadow: inset 0 0 0 1px var(--wui-color-accent-100), 0px 0px 0px 4px var(--wui-box-shadow-blue); } input:hover:enabled { background-color: var(--wui-color-gray-glass-005); } wui-icon { position: absolute; top: 50%; transform: translateY(-50%); pointer-events: none; } .wui-size-sm { padding: 9px var(--wui-spacing-m) 10px var(--wui-spacing-s); } wui-icon + .wui-size-sm { padding: 9px var(--wui-spacing-m) 10px 36px; } wui-icon[data-input='sm'] { left: var(--wui-spacing-s); } .wui-size-md { padding: 15px var(--wui-spacing-m) var(--wui-spacing-l) var(--wui-spacing-m); } wui-icon + .wui-size-md, wui-loading-spinner + .wui-size-md { padding: 10.5px var(--wui-spacing-3xl) 10.5px var(--wui-spacing-3xl); } wui-icon[data-input='md'] { left: var(--wui-spacing-l); } .wui-size-lg { padding: var(--wui-spacing-s) var(--wui-spacing-s) var(--wui-spacing-s) var(--wui-spacing-l); letter-spacing: var(--wui-letter-spacing-medium-title); font-size: var(--wui-font-size-medium-title); font-weight: var(--wui-font-weight-light); line-height: 130%; color: var(--wui-color-fg-100); height: 64px; } .wui-padding-right-xs { padding-right: var(--wui-spacing-xs); } .wui-padding-right-s { padding-right: var(--wui-spacing-s); } .wui-padding-right-m { padding-right: var(--wui-spacing-m); } .wui-padding-right-l { padding-right: var(--wui-spacing-l); } .wui-padding-right-xl { padding-right: var(--wui-spacing-xl); } .wui-padding-right-2xl { padding-right: var(--wui-spacing-2xl); } .wui-padding-right-3xl { padding-right: var(--wui-spacing-3xl); } .wui-padding-right-4xl { padding-right: var(--wui-spacing-4xl); } .wui-padding-right-5xl { padding-right: var(--wui-spacing-5xl); } wui-icon + .wui-size-lg, wui-loading-spinner + .wui-size-lg { padding-left: 50px; } wui-icon[data-input='lg'] { left: var(--wui-spacing-l); } .wui-size-mdl { padding: 17.25px var(--wui-spacing-m) 17.25px var(--wui-spacing-m); } wui-icon + .wui-size-mdl, wui-loading-spinner + .wui-size-mdl { padding: 17.25px var(--wui-spacing-3xl) 17.25px 40px; } wui-icon[data-input='mdl'] { left: var(--wui-spacing-m); } input:placeholder-shown ~ ::slotted(wui-input-element), input:placeholder-shown ~ ::slotted(wui-icon) { opacity: 0; pointer-events: none; } input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; } input[type='number'] { -moz-appearance: textfield; } ::slotted(wui-input-element), ::slotted(wui-icon) { position: absolute; top: 50%; transform: translateY(-50%); } ::slotted(wui-input-element) { right: var(--wui-spacing-m); } ::slotted(wui-icon) { right: 0px; } `;var uc=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let no=class extends se{constructor(){super(...arguments),this.inputElementRef=ec(),this.size="md",this.disabled=!1,this.placeholder="",this.type="text",this.value=""}render(){const e=`wui-padding-right-${this.inputRightPadding}`,n={[`wui-size-${this.size}`]:!0,[e]:!!this.inputRightPadding};return M`${this.templateIcon()} `}templateIcon(){return this.icon?M``:null}dispatchInputChangeEvent(){var e;this.dispatchEvent(new CustomEvent("inputChange",{detail:(e=this.inputElementRef.value)==null?void 0:e.value,bubbles:!0,composed:!0}))}};no.styles=[He,vt,R6e];uc([q()],no.prototype,"size",void 0);uc([q()],no.prototype,"icon",void 0);uc([q({type:Boolean})],no.prototype,"disabled",void 0);uc([q()],no.prototype,"placeholder",void 0);uc([q()],no.prototype,"type",void 0);uc([q()],no.prototype,"keyHint",void 0);uc([q()],no.prototype,"value",void 0);uc([q()],no.prototype,"inputRightPadding",void 0);uc([q()],no.prototype,"tabIdx",void 0);no=uc([te("wui-input-text")],no);const k6e=de` :host { position: relative; width: 100%; display: inline-block; color: var(--wui-color-fg-275); } .error { margin: var(--wui-spacing-xxs) var(--wui-spacing-m) var(--wui-spacing-0) var(--wui-spacing-m); } .base-name { position: absolute; right: 45px; top: 15px; text-align: right; } `;var Qv=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Xf=class extends se{constructor(){super(...arguments),this.disabled=!1,this.loading=!1}render(){return M` ${this.baseNameTemplate()} ${this.errorTemplate()}${this.loadingTemplate()} `}baseNameTemplate(){return M` ${_e.WC_NAME_SUFFIX} `}loadingTemplate(){return this.loading?M``:null}errorTemplate(){return this.errorMessage?M`${this.errorMessage}`:null}};Xf.styles=[He,k6e];Qv([q()],Xf.prototype,"errorMessage",void 0);Qv([q({type:Boolean})],Xf.prototype,"disabled",void 0);Qv([q()],Xf.prototype,"value",void 0);Qv([q({type:Boolean})],Xf.prototype,"loading",void 0);Xf=Qv([te("wui-ens-input")],Xf);const N6e=de` button { border-radius: var(--local-border-radius); color: var(--wui-color-fg-100); padding: var(--local-padding); } @media (max-width: 700px) { button { padding: var(--wui-spacing-s); } } button > wui-icon { pointer-events: none; } button:disabled > wui-icon { color: var(--wui-color-bg-300) !important; } button:disabled { background-color: transparent; } `;var Xv=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let ep=class extends se{constructor(){super(...arguments),this.size="md",this.disabled=!1,this.icon="copy",this.iconColor="inherit"}render(){const e=this.size==="lg"?"--wui-border-radius-xs":"--wui-border-radius-xxs",r=this.size==="lg"?"--wui-spacing-1xs":"--wui-spacing-2xs";return this.style.cssText=` --local-border-radius: var(${e}); --local-padding: var(${r}); `,M` `}};ep.styles=[He,vt,qv,N6e];Xv([q()],ep.prototype,"size",void 0);Xv([q({type:Boolean})],ep.prototype,"disabled",void 0);Xv([q()],ep.prototype,"icon",void 0);Xv([q()],ep.prototype,"iconColor",void 0);ep=Xv([te("wui-icon-link")],ep);const $6e=de` :host { display: flex; justify-content: center; align-items: center; height: var(--wui-spacing-m); padding: 0 var(--wui-spacing-3xs) !important; border-radius: var(--wui-border-radius-5xs); transition: border-radius var(--wui-duration-lg) var(--wui-ease-out-power-1), background-color var(--wui-duration-lg) var(--wui-ease-out-power-1); will-change: border-radius, background-color; } :host > wui-text { transform: translateY(5%); } :host([data-variant='main']) { background-color: var(--wui-color-accent-glass-015); color: var(--wui-color-accent-100); } :host([data-variant='shade']) { background-color: var(--wui-color-gray-glass-010); color: var(--wui-color-fg-200); } :host([data-variant='success']) { background-color: var(--wui-icon-box-bg-success-100); color: var(--wui-color-success-100); } :host([data-variant='error']) { background-color: var(--wui-icon-box-bg-error-100); color: var(--wui-color-error-100); } :host([data-size='lg']) { padding: 11px 5px !important; } :host([data-size='lg']) > wui-text { transform: translateY(2%); } `;var B7=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let ky=class extends se{constructor(){super(...arguments),this.variant="main",this.size="lg"}render(){this.dataset.variant=this.variant,this.dataset.size=this.size;const e=this.size==="md"?"mini-700":"micro-700";return M` `}};ky.styles=[He,$6e];B7([q()],ky.prototype,"variant",void 0);B7([q()],ky.prototype,"size",void 0);ky=B7([te("wui-tag")],ky);const j6e=de` wui-flex { width: 100%; } .suggestion { background: var(--wui-color-gray-glass-002); border-radius: var(--wui-border-radius-xs); } .suggestion:hover { background-color: var(--wui-color-gray-glass-005); cursor: pointer; } .suggested-name { max-width: 75%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } form { width: 100%; } wui-icon-link { position: absolute; right: 20px; transform: translateY(11px); } `;var Dd=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Ko=class extends se{constructor(){super(),this.formRef=ec(),this.usubscribe=[],this.name="",this.error="",this.loading=ys.state.loading,this.suggestions=ys.state.suggestions,this.registered=!1,this.profileName=re.state.profileName,this.onDebouncedNameInputChange=ue.debounce(e=>{ys.validateName(e)?(this.error="",this.name=e,ys.getSuggestions(e),ys.isNameRegistered(e).then(r=>{this.registered=r})):e.length<4?this.error="Name must be at least 4 characters long":this.error="Can only contain letters, numbers and - characters"}),this.usubscribe.push(ys.subscribe(e=>{this.suggestions=e.suggestions,this.loading=e.loading}),re.subscribeKey("profileName",e=>{this.profileName=e,e&&(this.error="You already own a name")}))}firstUpdated(){var e;(e=this.formRef.value)==null||e.addEventListener("keydown",this.onEnterKey.bind(this))}disconnectedCallback(){var e;super.disconnectedCallback(),this.usubscribe.forEach(r=>r()),(e=this.formRef.value)==null||e.removeEventListener("keydown",this.onEnterKey.bind(this))}render(){return M`
${this.submitButtonTemplate()}
${this.templateSuggestions()}
`}submitButtonTemplate(){return this.isAllowedToSubmit()?M` `:null}onSelectSuggestion(e){return()=>{this.name=e,this.registered=!1,this.requestUpdate()}}onNameInputChange(e){this.onDebouncedNameInputChange(e.detail)}nameSuggestionTagTemplate(){return this.loading?M``:this.registered?M`Registered`:M`Available`}templateSuggestions(){if(!this.name||this.name.length<4||this.error)return null;const e=this.registered?this.suggestions.filter(r=>r.name!==this.name):[];return M` ${this.name}${this.nameSuggestionTagTemplate()} ${e.map(r=>this.availableNameTemplate(r.name))} `}availableNameTemplate(e){return M` ${e} Available `}isAllowedToSubmit(){return!this.loading&&!this.registered&&!this.error&&!this.profileName&&ys.validateName(this.name)}async onSubmitName(){var r,n,i;const e=F.state.activeChain;try{if(!this.isAllowedToSubmit())return;const s=`${this.name}${_e.WC_NAME_SUFFIX}`;Re.sendEvent({type:"track",event:"REGISTER_NAME_INITIATED",properties:{isSmartAccount:((r=re.state.preferredAccountTypes)==null?void 0:r[e])===bt.ACCOUNT_TYPES.SMART_ACCOUNT,ensName:s}}),await ys.registerName(s),Re.sendEvent({type:"track",event:"REGISTER_NAME_SUCCESS",properties:{isSmartAccount:((n=re.state.preferredAccountTypes)==null?void 0:n[e])===bt.ACCOUNT_TYPES.SMART_ACCOUNT,ensName:s}})}catch(s){Fe.showError(s.message),Re.sendEvent({type:"track",event:"REGISTER_NAME_ERROR",properties:{isSmartAccount:((i=re.state.preferredAccountTypes)==null?void 0:i[e])===bt.ACCOUNT_TYPES.SMART_ACCOUNT,ensName:`${this.name}${_e.WC_NAME_SUFFIX}`,error:(s==null?void 0:s.message)||"Unknown error"}})}}onEnterKey(e){e.key==="Enter"&&this.isAllowedToSubmit()&&this.onSubmitName()}};Ko.styles=j6e;Dd([q()],Ko.prototype,"errorMessage",void 0);Dd([G()],Ko.prototype,"name",void 0);Dd([G()],Ko.prototype,"error",void 0);Dd([G()],Ko.prototype,"loading",void 0);Dd([G()],Ko.prototype,"suggestions",void 0);Dd([G()],Ko.prototype,"registered",void 0);Dd([G()],Ko.prototype,"profileName",void 0);Ko=Dd([te("w3m-register-account-name-view")],Ko);const B6e=de` :host { width: var(--local-width); position: relative; } button { border: none; border-radius: var(--local-border-radius); width: var(--local-width); white-space: nowrap; } /* -- Sizes --------------------------------------------------- */ button[data-size='md'] { padding: 8.2px var(--wui-spacing-l) 9px var(--wui-spacing-l); height: 36px; } button[data-size='md'][data-icon-left='true'][data-icon-right='false'] { padding: 8.2px var(--wui-spacing-l) 9px var(--wui-spacing-s); } button[data-size='md'][data-icon-right='true'][data-icon-left='false'] { padding: 8.2px var(--wui-spacing-s) 9px var(--wui-spacing-l); } button[data-size='lg'] { padding: var(--wui-spacing-m) var(--wui-spacing-2l); height: 48px; } /* -- Variants --------------------------------------------------------- */ button[data-variant='main'] { background-color: var(--wui-color-accent-100); color: var(--wui-color-inverse-100); border: none; box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-010); } button[data-variant='inverse'] { background-color: var(--wui-color-inverse-100); color: var(--wui-color-inverse-000); border: none; box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-010); } button[data-variant='accent'] { background-color: var(--wui-color-accent-glass-010); color: var(--wui-color-accent-100); border: none; box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-005); } button[data-variant='accent-error'] { background: var(--wui-color-error-glass-015); color: var(--wui-color-error-100); border: none; box-shadow: inset 0 0 0 1px var(--wui-color-error-glass-010); } button[data-variant='accent-success'] { background: var(--wui-color-success-glass-015); color: var(--wui-color-success-100); border: none; box-shadow: inset 0 0 0 1px var(--wui-color-success-glass-010); } button[data-variant='neutral'] { background: transparent; color: var(--wui-color-fg-100); border: none; box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-005); } /* -- Focus states --------------------------------------------------- */ button[data-variant='main']:focus-visible:enabled { background-color: var(--wui-color-accent-090); box-shadow: inset 0 0 0 1px var(--wui-color-accent-100), 0 0 0 4px var(--wui-color-accent-glass-020); } button[data-variant='inverse']:focus-visible:enabled { background-color: var(--wui-color-inverse-100); box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-010), 0 0 0 4px var(--wui-color-accent-glass-020); } button[data-variant='accent']:focus-visible:enabled { background-color: var(--wui-color-accent-glass-010); box-shadow: inset 0 0 0 1px var(--wui-color-accent-100), 0 0 0 4px var(--wui-color-accent-glass-020); } button[data-variant='accent-error']:focus-visible:enabled { background: var(--wui-color-error-glass-015); box-shadow: inset 0 0 0 1px var(--wui-color-error-100), 0 0 0 4px var(--wui-color-error-glass-020); } button[data-variant='accent-success']:focus-visible:enabled { background: var(--wui-color-success-glass-015); box-shadow: inset 0 0 0 1px var(--wui-color-success-100), 0 0 0 4px var(--wui-color-success-glass-020); } button[data-variant='neutral']:focus-visible:enabled { background: var(--wui-color-gray-glass-005); box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-010), 0 0 0 4px var(--wui-color-gray-glass-002); } /* -- Hover & Active states ----------------------------------------------------------- */ @media (hover: hover) and (pointer: fine) { button[data-variant='main']:hover:enabled { background-color: var(--wui-color-accent-090); } button[data-variant='main']:active:enabled { background-color: var(--wui-color-accent-080); } button[data-variant='accent']:hover:enabled { background-color: var(--wui-color-accent-glass-015); } button[data-variant='accent']:active:enabled { background-color: var(--wui-color-accent-glass-020); } button[data-variant='accent-error']:hover:enabled { background: var(--wui-color-error-glass-020); color: var(--wui-color-error-100); } button[data-variant='accent-error']:active:enabled { background: var(--wui-color-error-glass-030); color: var(--wui-color-error-100); } button[data-variant='accent-success']:hover:enabled { background: var(--wui-color-success-glass-020); color: var(--wui-color-success-100); } button[data-variant='accent-success']:active:enabled { background: var(--wui-color-success-glass-030); color: var(--wui-color-success-100); } button[data-variant='neutral']:hover:enabled { background: var(--wui-color-gray-glass-002); } button[data-variant='neutral']:active:enabled { background: var(--wui-color-gray-glass-005); } button[data-size='lg'][data-icon-left='true'][data-icon-right='false'] { padding-left: var(--wui-spacing-m); } button[data-size='lg'][data-icon-right='true'][data-icon-left='false'] { padding-right: var(--wui-spacing-m); } } /* -- Disabled state --------------------------------------------------- */ button:disabled { background-color: var(--wui-color-gray-glass-002); box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-002); color: var(--wui-color-gray-glass-020); cursor: not-allowed; } button > wui-text { transition: opacity var(--wui-ease-out-power-1) var(--wui-duration-md); will-change: opacity; opacity: var(--local-opacity-100); } ::slotted(*) { transition: opacity var(--wui-ease-out-power-1) var(--wui-duration-md); will-change: opacity; opacity: var(--local-opacity-100); } wui-loading-spinner { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); opacity: var(--local-opacity-000); } `;var lc=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};const GB={main:"inverse-100",inverse:"inverse-000",accent:"accent-100","accent-error":"error-100","accent-success":"success-100",neutral:"fg-100",disabled:"gray-glass-020"},D6e={lg:"paragraph-600",md:"small-600"},M6e={lg:"md",md:"md"};let io=class extends se{constructor(){super(...arguments),this.size="lg",this.disabled=!1,this.fullWidth=!1,this.loading=!1,this.variant="main",this.hasIconLeft=!1,this.hasIconRight=!1,this.borderRadius="m"}render(){this.style.cssText=` --local-width: ${this.fullWidth?"100%":"auto"}; --local-opacity-100: ${this.loading?0:1}; --local-opacity-000: ${this.loading?1:0}; --local-border-radius: var(--wui-border-radius-${this.borderRadius}); `;const e=this.textVariant??D6e[this.size];return M` `}handleSlotLeftChange(){this.hasIconLeft=!0}handleSlotRightChange(){this.hasIconRight=!0}loadingTemplate(){if(this.loading){const e=M6e[this.size],r=this.disabled?GB.disabled:GB[this.variant];return M``}return M``}};io.styles=[He,vt,B6e];lc([q()],io.prototype,"size",void 0);lc([q({type:Boolean})],io.prototype,"disabled",void 0);lc([q({type:Boolean})],io.prototype,"fullWidth",void 0);lc([q({type:Boolean})],io.prototype,"loading",void 0);lc([q()],io.prototype,"variant",void 0);lc([q({type:Boolean})],io.prototype,"hasIconLeft",void 0);lc([q({type:Boolean})],io.prototype,"hasIconRight",void 0);lc([q()],io.prototype,"borderRadius",void 0);lc([q()],io.prototype,"textVariant",void 0);io=lc([te("wui-button")],io);const L6e=de` :host { display: inline-flex; justify-content: center; align-items: center; position: relative; overflow: hidden; background-color: var(--wui-color-gray-glass-020); border-radius: var(--local-border-radius); border: var(--local-border); box-sizing: content-box; width: var(--local-size); height: var(--local-size); min-height: var(--local-size); min-width: var(--local-size); } @supports (background: color-mix(in srgb, white 50%, black)) { :host { background-color: color-mix(in srgb, var(--local-bg-value) var(--local-bg-mix), transparent); } } `;var Zu=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Zo=class extends se{constructor(){super(...arguments),this.size="md",this.backgroundColor="accent-100",this.iconColor="accent-100",this.background="transparent",this.border=!1,this.borderColor="wui-color-bg-125",this.icon="copy"}render(){const e=this.iconSize||this.size,r=this.size==="lg",n=this.size==="xl",i=r?"12%":"16%",s=r?"xxs":n?"s":"3xl",o=this.background==="gray",a=this.background==="opaque",c=this.backgroundColor==="accent-100"&&a||this.backgroundColor==="success-100"&&a||this.backgroundColor==="error-100"&&a||this.backgroundColor==="inverse-100"&&a;let u=`var(--wui-color-${this.backgroundColor})`;return c?u=`var(--wui-icon-box-bg-${this.backgroundColor})`:o&&(u=`var(--wui-color-gray-${this.backgroundColor})`),this.style.cssText=` --local-bg-value: ${u}; --local-bg-mix: ${c||o?"100%":i}; --local-border-radius: var(--wui-border-radius-${s}); --local-size: var(--wui-icon-box-size-${this.size}); --local-border: ${this.borderColor==="wui-color-bg-125"?"2px":"1px"} solid ${this.border?`var(--${this.borderColor})`:"transparent"} `,M` `}};Zo.styles=[He,vt,L6e];Zu([q()],Zo.prototype,"size",void 0);Zu([q()],Zo.prototype,"backgroundColor",void 0);Zu([q()],Zo.prototype,"iconColor",void 0);Zu([q()],Zo.prototype,"iconSize",void 0);Zu([q()],Zo.prototype,"background",void 0);Zu([q({type:Boolean})],Zo.prototype,"border",void 0);Zu([q()],Zo.prototype,"borderColor",void 0);Zu([q()],Zo.prototype,"icon",void 0);Zo=Zu([te("wui-icon-box")],Zo);const U6e=de` button { padding: var(--wui-spacing-4xs) var(--wui-spacing-xxs); border-radius: var(--wui-border-radius-3xs); background-color: transparent; color: var(--wui-color-accent-100); } button:disabled { background-color: transparent; color: var(--wui-color-gray-glass-015); } button:hover { background-color: var(--wui-color-gray-glass-005); } `;var SA=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Rm=class extends se{constructor(){super(...arguments),this.tabIdx=void 0,this.disabled=!1,this.color="inherit"}render(){return M` `}};Rm.styles=[He,vt,U6e];SA([q()],Rm.prototype,"tabIdx",void 0);SA([q({type:Boolean})],Rm.prototype,"disabled",void 0);SA([q()],Rm.prototype,"color",void 0);Rm=SA([te("wui-link")],Rm);const F6e=de` .continue-button-container { width: 100%; } `;var H6e=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let n6=class extends se{render(){return M` ${this.onboardingTemplate()} ${this.buttonsTemplate()} {ue.openHref(IV.URLS.FAQ,"_blank")}} > Learn more `}onboardingTemplate(){return M` Account name chosen successfully You can now fund your account and trade crypto `}buttonsTemplate(){return M` Let's Go! `}redirectToAccount(){X.replace("Account")}};n6.styles=F6e;n6=H6e([te("w3m-register-account-name-success-view")],n6);const q6e=Object.freeze(Object.defineProperty({__proto__:null,get W3mApproveTransactionView(){return Oy},get W3mRegisterAccountNameSuccess(){return n6},get W3mRegisterAccountNameView(){return Ko},get W3mUpgradeWalletView(){return kP}},Symbol.toStringTag,{value:"Module"})),z6e=de` :host { position: relative; display: inline-block; } input { width: 50px; height: 50px; background: var(--wui-color-gray-glass-010); border-radius: var(--wui-border-radius-xs); border: 1px solid var(--wui-color-gray-glass-005); font-family: var(--wui-font-family); font-size: var(--wui-font-size-large); font-weight: var(--wui-font-weight-regular); letter-spacing: var(--wui-letter-spacing-large); text-align: center; color: var(--wui-color-fg-100); caret-color: var(--wui-color-accent-100); transition: background-color var(--wui-ease-inout-power-1) var(--wui-duration-md), border-color var(--wui-ease-inout-power-1) var(--wui-duration-md), box-shadow var(--wui-ease-inout-power-1) var(--wui-duration-md); will-change: background-color, border-color, box-shadow; box-sizing: border-box; -webkit-appearance: none; -moz-appearance: textfield; padding: 0px; } input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; } input[type='number'] { -moz-appearance: textfield; } input:disabled { cursor: not-allowed; border: 1px solid var(--wui-color-gray-glass-010); background: var(--wui-color-gray-glass-005); } input:focus:enabled { background-color: var(--wui-color-gray-glass-015); border: 1px solid var(--wui-color-accent-100); -webkit-box-shadow: 0px 0px 0px 4px var(--wui-box-shadow-blue); -moz-box-shadow: 0px 0px 0px 4px var(--wui-box-shadow-blue); box-shadow: 0px 0px 0px 4px var(--wui-box-shadow-blue); } @media (hover: hover) and (pointer: fine) { input:hover:enabled { background-color: var(--wui-color-gray-glass-015); } } `;var D7=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Ny=class extends se{constructor(){super(...arguments),this.disabled=!1,this.value=""}render(){return M` `}};Ny.styles=[He,vt,z6e];D7([q({type:Boolean})],Ny.prototype,"disabled",void 0);D7([q({type:String})],Ny.prototype,"value",void 0);Ny=D7([te("wui-input-numeric")],Ny);const W6e=de` :host { position: relative; display: block; } `;var TA=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let km=class extends se{constructor(){super(...arguments),this.length=6,this.otp="",this.values=Array.from({length:this.length}).map(()=>""),this.numerics=[],this.shouldInputBeEnabled=e=>this.values.slice(0,e).every(n=>n!==""),this.handleKeyDown=(e,r)=>{const n=e.target,i=this.getInputElement(n),s=["ArrowLeft","ArrowRight","Shift","Delete"];if(!i)return;s.includes(e.key)&&e.preventDefault();const o=i.selectionStart;switch(e.key){case"ArrowLeft":o&&i.setSelectionRange(o+1,o+1),this.focusInputField("prev",r);break;case"ArrowRight":this.focusInputField("next",r);break;case"Shift":this.focusInputField("next",r);break;case"Delete":i.value===""?this.focusInputField("prev",r):this.updateInput(i,r,"");break;case"Backspace":i.value===""?this.focusInputField("prev",r):this.updateInput(i,r,"");break}},this.focusInputField=(e,r)=>{if(e==="next"){const n=r+1;if(!this.shouldInputBeEnabled(n))return;const i=this.numerics[n-1?n:r],s=i?this.getInputElement(i):void 0;s&&s.focus()}}}firstUpdated(){var r,n;this.otp&&(this.values=this.otp.split(""));const e=(r=this.shadowRoot)==null?void 0:r.querySelectorAll("wui-input-numeric");e&&(this.numerics=Array.from(e)),(n=this.numerics[0])==null||n.focus()}render(){return M` ${Array.from({length:this.length}).map((e,r)=>M` this.handleInput(n,r)} @click=${n=>this.selectInput(n)} @keydown=${n=>this.handleKeyDown(n,r)} .disabled=${!this.shouldInputBeEnabled(r)} .value=${this.values[r]||""} > `)} `}updateInput(e,r,n){const i=this.numerics[r],s=e||(i?this.getInputElement(i):void 0);s&&(s.value=n,this.values=this.values.map((o,a)=>a===r?n:o))}selectInput(e){const r=e.target;if(r){const n=this.getInputElement(r);n==null||n.select()}}handleInput(e,r){const n=e.target,i=this.getInputElement(n);if(i){const s=i.value;e.inputType==="insertFromPaste"?this.handlePaste(i,s,r):nt.isNumber(s)&&e.data?(this.updateInput(i,r,e.data),this.focusInputField("next",r)):this.updateInput(i,r,"")}this.dispatchInputChangeEvent()}handlePaste(e,r,n){const i=r[0];if(i&&nt.isNumber(i)){this.updateInput(e,n,i);const o=r.substring(1);if(n+1=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};const G6e=6;let $u=class extends se{firstUpdated(){this.startOTPTimeout()}disconnectedCallback(){clearTimeout(this.OTPTimeout)}constructor(){var e;super(),this.loading=!1,this.timeoutTimeLeft=ei.getTimeToNextEmailLogin(),this.error="",this.otp="",this.email=(e=X.state.data)==null?void 0:e.email,this.authConnector=ge.getAuthConnector()}render(){if(!this.email)throw new Error("w3m-email-otp-widget: No email provided");const e=!!this.timeoutTimeLeft,r=this.getFooterLabels(e);return M` The code expires in 20 minutes ${this.loading?M``:M` ${this.error?M` ${this.error}. Try Again `:null} `} ${r.title} ${r.action} `}startOTPTimeout(){this.timeoutTimeLeft=ei.getTimeToNextEmailLogin(),this.OTPTimeout=setInterval(()=>{this.timeoutTimeLeft>0?this.timeoutTimeLeft=ei.getTimeToNextEmailLogin():clearInterval(this.OTPTimeout)},1e3)}async onOtpInputChange(e){var r;try{this.loading||(this.otp=e.detail,this.authConnector&&this.otp.length===G6e&&(this.loading=!0,await((r=this.onOtpSubmit)==null?void 0:r.call(this,this.otp))))}catch(n){this.error=ue.parseError(n),this.loading=!1}}async onResendCode(){try{if(this.onOtpResend){if(!this.loading&&!this.timeoutTimeLeft){if(this.error="",this.otp="",!ge.getAuthConnector()||!this.email)throw new Error("w3m-email-otp-widget: Unable to resend email");this.loading=!0,await this.onOtpResend(this.email),this.startOTPTimeout(),Fe.showSuccess("Code email resent")}}else this.onStartOver&&this.onStartOver()}catch(e){Fe.showError(e)}finally{this.loading=!1}}getFooterLabels(e){return this.onStartOver?{title:"Something wrong?",action:`Try again ${e?`in ${this.timeoutTimeLeft}s`:""}`}:{title:"Didn't receive it?",action:`Resend ${e?`in ${this.timeoutTimeLeft}s`:"Code"}`}}};$u.styles=V6e;IA([G()],$u.prototype,"loading",void 0);IA([G()],$u.prototype,"timeoutTimeLeft",void 0);IA([G()],$u.prototype,"error",void 0);$u=IA([te("w3m-email-otp-widget")],$u);var K6e=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let NP=class extends $u{constructor(){super(...arguments),this.onOtpSubmit=async e=>{try{if(this.authConnector){if(await this.authConnector.provider.connectOtp({otp:e}),Re.sendEvent({type:"track",event:"EMAIL_VERIFICATION_CODE_PASS"}),F.state.activeChain)await xe.connectExternal(this.authConnector,F.state.activeChain);else throw new Error("Active chain is not set on ChainControll");Re.sendEvent({type:"track",event:"CONNECT_SUCCESS",properties:{method:"email",name:this.authConnector.name||"Unknown"}}),oe.state.siwx||We.close()}}catch(r){throw Re.sendEvent({type:"track",event:"EMAIL_VERIFICATION_CODE_FAIL",properties:{message:ue.parseError(r)}}),r}},this.onOtpResend=async e=>{this.authConnector&&(await this.authConnector.provider.connectEmail({email:e}),Re.sendEvent({type:"track",event:"EMAIL_VERIFICATION_CODE_SENT"}))}}};NP=K6e([te("w3m-email-verify-otp-view")],NP);const Z6e=de` wui-icon-box { height: var(--wui-icon-box-size-xl); width: var(--wui-icon-box-size-xl); } `;var LJ=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let $y=class extends se{constructor(){var e;super(),this.email=(e=X.state.data)==null?void 0:e.email,this.authConnector=ge.getAuthConnector(),this.loading=!1,this.listenForDeviceApproval()}render(){if(!this.email)throw new Error("w3m-email-verify-device-view: No email provided");if(!this.authConnector)throw new Error("w3m-email-verify-device-view: No auth connector provided");return M` Approve the login link we sent to ${this.email} The code expires in 20 minutes Didn't receive it? Resend email `}async listenForDeviceApproval(){if(this.authConnector)try{await this.authConnector.provider.connectDevice(),Re.sendEvent({type:"track",event:"DEVICE_REGISTERED_FOR_EMAIL"}),Re.sendEvent({type:"track",event:"EMAIL_VERIFICATION_CODE_SENT"}),X.replace("EmailVerifyOtp",{email:this.email})}catch{X.goBack()}}async onResendCode(){try{if(!this.loading){if(!this.authConnector||!this.email)throw new Error("w3m-email-login-widget: Unable to resend email");this.loading=!0,await this.authConnector.provider.connectEmail({email:this.email}),this.listenForDeviceApproval(),Fe.showSuccess("Code email resent")}}catch(e){Fe.showError(e)}finally{this.loading=!1}}};$y.styles=Z6e;LJ([G()],$y.prototype,"loading",void 0);$y=LJ([te("w3m-email-verify-device-view")],$y);const Y6e=de` :host { position: relative; display: inline-block; } wui-text { margin: var(--wui-spacing-xxs) var(--wui-spacing-m) var(--wui-spacing-0) var(--wui-spacing-m); } `;var e2=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let tp=class extends se{constructor(){super(...arguments),this.disabled=!1}render(){return M` ${this.templateError()} `}templateError(){return this.errorMessage?M`${this.errorMessage}`:null}};tp.styles=[He,Y6e];e2([q()],tp.prototype,"errorMessage",void 0);e2([q({type:Boolean})],tp.prototype,"disabled",void 0);e2([q()],tp.prototype,"value",void 0);e2([q()],tp.prototype,"tabIdx",void 0);tp=e2([te("wui-email-input")],tp);const J6e=de` wui-email-input { width: 100%; } form { width: 100%; display: block; position: relative; } `;var M7=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Nm=class extends se{constructor(){var e,r;super(...arguments),this.formRef=ec(),this.initialEmail=((e=X.state.data)==null?void 0:e.email)??"",this.redirectView=(r=X.state.data)==null?void 0:r.redirectView,this.email="",this.loading=!1}firstUpdated(){var e;(e=this.formRef.value)==null||e.addEventListener("keydown",r=>{r.key==="Enter"&&this.onSubmitEmail(r)})}render(){return M`
${this.buttonsTemplate()}
`}onEmailInputChange(e){this.email=e.detail}async onSubmitEmail(e){try{if(this.loading)return;this.loading=!0,e.preventDefault();const r=ge.getAuthConnector();if(!r)throw new Error("w3m-update-email-wallet: Auth connector not found");const n=await r.provider.updateEmail({email:this.email});Re.sendEvent({type:"track",event:"EMAIL_EDIT"}),n.action==="VERIFY_SECONDARY_OTP"?X.push("UpdateEmailSecondaryOtp",{email:this.initialEmail,newEmail:this.email,redirectView:this.redirectView}):X.push("UpdateEmailPrimaryOtp",{email:this.initialEmail,newEmail:this.email,redirectView:this.redirectView})}catch(r){Fe.showError(r),this.loading=!1}}buttonsTemplate(){const e=!this.loading&&this.email.length>3&&this.email!==this.initialEmail;return this.redirectView?M` Cancel Save `:M` Save `}};Nm.styles=J6e;M7([G()],Nm.prototype,"email",void 0);M7([G()],Nm.prototype,"loading",void 0);Nm=M7([te("w3m-update-email-wallet-view")],Nm);var Q6e=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let $P=class extends $u{constructor(){var e;super(),this.email=(e=X.state.data)==null?void 0:e.email,this.onOtpSubmit=async r=>{try{this.authConnector&&(await this.authConnector.provider.updateEmailPrimaryOtp({otp:r}),Re.sendEvent({type:"track",event:"EMAIL_VERIFICATION_CODE_PASS"}),X.replace("UpdateEmailSecondaryOtp",X.state.data))}catch(n){throw Re.sendEvent({type:"track",event:"EMAIL_VERIFICATION_CODE_FAIL",properties:{message:ue.parseError(n)}}),n}},this.onStartOver=()=>{X.replace("UpdateEmailWallet",X.state.data)}}};$P=Q6e([te("w3m-update-email-primary-otp-view")],$P);var X6e=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let jP=class extends $u{constructor(){var e,r;super(),this.email=(e=X.state.data)==null?void 0:e.newEmail,this.redirectView=(r=X.state.data)==null?void 0:r.redirectView,this.onOtpSubmit=async n=>{try{this.authConnector&&(await this.authConnector.provider.updateEmailSecondaryOtp({otp:n}),Re.sendEvent({type:"track",event:"EMAIL_VERIFICATION_CODE_PASS"}),this.redirectView&&X.reset(this.redirectView))}catch(i){throw Re.sendEvent({type:"track",event:"EMAIL_VERIFICATION_CODE_FAIL",properties:{message:ue.parseError(i)}}),i}},this.onStartOver=()=>{X.replace("UpdateEmailWallet",X.state.data)}}};jP=X6e([te("w3m-update-email-secondary-otp-view")],jP);var UJ=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let i6=class extends se{constructor(){var e;super(),this.authConnector=ge.getAuthConnector(),this.isEmailEnabled=(e=oe.state.remoteFeatures)==null?void 0:e.email,this.isAuthEnabled=this.checkIfAuthEnabled(ge.state.connectors),this.connectors=ge.state.connectors,ge.subscribeKey("connectors",r=>{this.connectors=r,this.isAuthEnabled=this.checkIfAuthEnabled(this.connectors)})}render(){if(!this.isEmailEnabled)throw new Error("w3m-email-login-view: Email is not enabled");if(!this.isAuthEnabled)throw new Error("w3m-email-login-view: No auth connector provided");return M` `}checkIfAuthEnabled(e){const r=e.filter(i=>i.type===Xt.CONNECTOR_TYPE_AUTH).map(i=>i.chain);return _e.AUTH_CONNECTOR_SUPPORTED_CHAINS.some(i=>r.includes(i))}};UJ([G()],i6.prototype,"connectors",void 0);i6=UJ([te("w3m-email-login-view")],i6);const eAe=Object.freeze(Object.defineProperty({__proto__:null,get W3mEmailLoginView(){return i6},get W3mEmailVerifyDeviceView(){return $y},get W3mEmailVerifyOtpView(){return NP},get W3mUpdateEmailPrimaryOtpView(){return $P},get W3mUpdateEmailSecondaryOtpView(){return jP},get W3mUpdateEmailWalletView(){return Nm}},Symbol.toStringTag,{value:"Module"})),tAe=de` label { display: flex; align-items: center; cursor: pointer; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; column-gap: var(--wui-spacing-1xs); } label > input[type='checkbox'] { height: 0; width: 0; opacity: 0; pointer-events: none; position: absolute; } label > span { width: var(--wui-spacing-xl); height: var(--wui-spacing-xl); min-width: var(--wui-spacing-xl); min-height: var(--wui-spacing-xl); border-radius: var(--wui-border-radius-3xs); border-width: 1px; border-style: solid; border-color: var(--wui-color-gray-glass-010); display: flex; align-items: center; justify-content: center; transition: background-color var(--wui-ease-out-power-1) var(--wui-duration-lg); will-change: background-color; } label > span:hover, label > input[type='checkbox']:focus-visible + span { background-color: var(--wui-color-gray-glass-010); } label input[type='checkbox']:checked + span { background-color: var(--wui-color-blue-base-90); } label > span > wui-icon { opacity: 0; transition: opacity var(--wui-ease-out-power-1) var(--wui-duration-lg); will-change: opacity; } label > input[type='checkbox']:checked + span wui-icon { opacity: 1; } `;var FJ=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let s6=class extends se{constructor(){super(...arguments),this.inputElementRef=ec(),this.checked=void 0}render(){return M` `}dispatchChangeEvent(){var e;this.dispatchEvent(new CustomEvent("checkboxChange",{detail:(e=this.inputElementRef.value)==null?void 0:e.checked,bubbles:!0,composed:!0}))}};s6.styles=[He,tAe];FJ([q({type:Boolean})],s6.prototype,"checked",void 0);s6=FJ([te("wui-checkbox")],s6);const rAe=de` :host { display: flex; align-items: center; justify-content: center; } wui-checkbox { padding: var(--wui-spacing-s); } a { text-decoration: none; color: var(--wui-color-fg-150); font-weight: 500; } `;var HJ=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let o6=class extends se{constructor(){super(),this.unsubscribe=[],this.checked=As.state.isLegalCheckboxChecked,this.unsubscribe.push(As.subscribeKey("isLegalCheckboxChecked",e=>{this.checked=e}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){var i;const{termsConditionsUrl:e,privacyPolicyUrl:r}=oe.state,n=(i=oe.state.features)==null?void 0:i.legalCheckbox;return!e&&!r||!n?null:M` I agree to our ${this.termsTemplate()} ${this.andTemplate()} ${this.privacyTemplate()} `}andTemplate(){const{termsConditionsUrl:e,privacyPolicyUrl:r}=oe.state;return e&&r?"and":""}termsTemplate(){const{termsConditionsUrl:e}=oe.state;return e?M`terms of service`:null}privacyTemplate(){const{privacyPolicyUrl:e}=oe.state;return e?M`privacy policy`:null}onCheckboxChange(){As.setIsLegalCheckboxChecked(!this.checked)}};o6.styles=[rAe];HJ([G()],o6.prototype,"checked",void 0);o6=HJ([te("w3m-legal-checkbox")],o6);const nAe=/[.*+?^${}()|[\]\\]/gu,iAe=/[0-9,.]/u,sAe="https://reown.com",oAe=de` .reown-logo { height: var(--wui-spacing-xxl); } a { text-decoration: none; cursor: pointer; } a:hover { opacity: 0.9; } `;var aAe=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let BP=class extends se{render(){return M` UX by `}};BP.styles=[He,vt,oAe];BP=aAe([te("wui-ux-by-reown")],BP);const cAe=de` :host > wui-flex { background-color: var(--wui-color-gray-glass-005); } :host wui-ux-by-reown { padding-top: 0; } :host wui-ux-by-reown.branding-only { padding-top: var(--wui-spacing-m); } a { text-decoration: none; color: var(--wui-color-fg-175); font-weight: 500; } `;var qJ=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let a6=class extends se{constructor(){super(),this.unsubscribe=[],this.remoteFeatures=oe.state.remoteFeatures,this.unsubscribe.push(oe.subscribeKey("remoteFeatures",e=>this.remoteFeatures=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){var s;const{termsConditionsUrl:e,privacyPolicyUrl:r}=oe.state,n=(s=oe.state.features)==null?void 0:s.legalCheckbox;return!e&&!r||n?M` ${this.reownBrandingTemplate(!0)} `:M` By connecting your wallet, you agree to our
${this.termsTemplate()} ${this.andTemplate()} ${this.privacyTemplate()}
${this.reownBrandingTemplate()}
`}andTemplate(){const{termsConditionsUrl:e,privacyPolicyUrl:r}=oe.state;return e&&r?"and":""}termsTemplate(){const{termsConditionsUrl:e}=oe.state;return e?M`Terms of Service`:null}privacyTemplate(){const{privacyPolicyUrl:e}=oe.state;return e?M`Privacy Policy`:null}reownBrandingTemplate(e=!1){var r;return(r=this.remoteFeatures)!=null&&r.reownBranding?e?M``:M``:null}};a6.styles=[cAe];qJ([G()],a6.prototype,"remoteFeatures",void 0);a6=qJ([te("w3m-legal-footer")],a6);const uAe=de` :host { display: flex; justify-content: center; align-items: center; width: 40px; height: 40px; border-radius: var(--wui-border-radius-3xl); border: 1px solid var(--wui-color-gray-glass-005); overflow: hidden; } wui-icon { width: 100%; height: 100%; } `;var zJ=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let c6=class extends se{constructor(){super(...arguments),this.logo="google"}render(){return M` `}};c6.styles=[He,uAe];zJ([q()],c6.prototype,"logo",void 0);c6=zJ([te("wui-logo")],c6);const lAe=de` button { column-gap: var(--wui-spacing-s); padding: 7px var(--wui-spacing-l) 7px var(--wui-spacing-xs); width: 100%; justify-content: flex-start; background-color: var(--wui-color-gray-glass-002); border-radius: var(--wui-border-radius-xs); color: var(--wui-color-fg-100); } wui-text { text-transform: capitalize; } wui-text[data-align='left'] { display: flex; flex: 1; } wui-text[data-align='center'] { display: flex; flex: 1; justify-content: center; } .invisible { opacity: 0; pointer-events: none; } button:disabled { background-color: var(--wui-color-gray-glass-015); color: var(--wui-color-gray-glass-015); } `;var c1=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let _d=class extends se{constructor(){super(...arguments),this.logo="google",this.name="Continue with google",this.align="left",this.disabled=!1}render(){return M` `}templatePlacement(){return this.align==="center"?M` `:null}};_d.styles=[He,vt,lAe];c1([q()],_d.prototype,"logo",void 0);c1([q()],_d.prototype,"name",void 0);c1([q()],_d.prototype,"align",void 0);c1([q()],_d.prototype,"tabIdx",void 0);c1([q({type:Boolean})],_d.prototype,"disabled",void 0);_d=c1([te("wui-list-social")],_d);const dAe=de` :host { margin-top: var(--wui-spacing-3xs); } wui-separator { margin: var(--wui-spacing-m) calc(var(--wui-spacing-m) * -1) var(--wui-spacing-xs) calc(var(--wui-spacing-m) * -1); width: calc(100% + var(--wui-spacing-s) * 2); } `;var u1=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Ed=class extends se{constructor(){super(),this.unsubscribe=[],this.tabIdx=void 0,this.connectors=ge.state.connectors,this.authConnector=this.connectors.find(e=>e.type==="AUTH"),this.remoteFeatures=oe.state.remoteFeatures,this.isPwaLoading=!1,this.unsubscribe.push(ge.subscribeKey("connectors",e=>{this.connectors=e,this.authConnector=this.connectors.find(r=>r.type==="AUTH")}),oe.subscribeKey("remoteFeatures",e=>this.remoteFeatures=e))}connectedCallback(){super.connectedCallback(),this.handlePwaFrameLoad()}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){var s;let e=((s=this.remoteFeatures)==null?void 0:s.socials)||[];const r=!!this.authConnector,n=e==null?void 0:e.length,i=X.state.view==="ConnectSocials";return(!r||!n)&&!i?null:(i&&!n&&(e=ct.DEFAULT_SOCIALS),M` ${e.map(o=>M`{this.onSocialClick(o)}} data-testid=${`social-selector-${o}`} name=${o} logo=${o} ?disabled=${this.isPwaLoading} >`)} `)}async onSocialClick(e){e&&await OZ(e)}async handlePwaFrameLoad(){var e;if(ue.isPWA()){this.isPwaLoading=!0;try{((e=this.authConnector)==null?void 0:e.provider)instanceof s7&&await this.authConnector.provider.init()}catch(r){Fn.open({shortMessage:"Error loading embedded wallet in PWA",longMessage:r.message},"error")}finally{this.isPwaLoading=!1}}}};Ed.styles=dAe;u1([q()],Ed.prototype,"tabIdx",void 0);u1([G()],Ed.prototype,"connectors",void 0);u1([G()],Ed.prototype,"authConnector",void 0);u1([G()],Ed.prototype,"remoteFeatures",void 0);u1([G()],Ed.prototype,"isPwaLoading",void 0);Ed=u1([te("w3m-social-login-list")],Ed);const hAe=de` wui-flex { max-height: clamp(360px, 540px, 80vh); overflow: scroll; scrollbar-width: none; transition: opacity var(--wui-ease-out-power-1) var(--wui-duration-md); will-change: opacity; } wui-flex::-webkit-scrollbar { display: none; } wui-flex.disabled { opacity: 0.3; pointer-events: none; user-select: none; } `;var WJ=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let jy=class extends se{constructor(){super(),this.unsubscribe=[],this.checked=As.state.isLegalCheckboxChecked,this.unsubscribe.push(As.subscribeKey("isLegalCheckboxChecked",e=>{this.checked=e}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){var c;const{termsConditionsUrl:e,privacyPolicyUrl:r}=oe.state,n=(c=oe.state.features)==null?void 0:c.legalCheckbox,s=!!(e||r)&&!!n,o=s&&!this.checked,a=o?-1:void 0;return M` `}};jy.styles=hAe;WJ([G()],jy.prototype,"checked",void 0);jy=WJ([te("w3m-connect-socials-view")],jy);const fAe=de` :host { display: block; width: var(--wui-box-size-md); height: var(--wui-box-size-md); } svg { width: var(--wui-box-size-md); height: var(--wui-box-size-md); } rect { fill: none; stroke: var(--wui-color-accent-100); stroke-width: 4px; stroke-linecap: round; animation: dash 1s linear infinite; } @keyframes dash { to { stroke-dashoffset: 0px; } } `;var VJ=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let u6=class extends se{constructor(){super(...arguments),this.radius=36}render(){return this.svgLoaderTemplate()}svgLoaderTemplate(){const e=this.radius>50?50:this.radius,n=36-e,i=116+n,s=245+n,o=360+n*1.75;return M` `}};u6.styles=[He,fAe];VJ([q({type:Number})],u6.prototype,"radius",void 0);u6=VJ([te("wui-loading-thumbnail")],u6);const pAe=de` wui-logo { width: 80px; height: 80px; border-radius: var(--wui-border-radius-m); } @keyframes shake { 0% { transform: translateX(0); } 25% { transform: translateX(3px); } 50% { transform: translateX(-3px); } 75% { transform: translateX(3px); } 100% { transform: translateX(0); } } wui-flex:first-child:not(:only-child) { position: relative; } wui-loading-thumbnail { position: absolute; } wui-icon-box { position: absolute; right: calc(var(--wui-spacing-3xs) * -1); bottom: calc(var(--wui-spacing-3xs) * -1); opacity: 0; transform: scale(0.5); transition: all var(--wui-ease-out-power-2) var(--wui-duration-lg); } wui-text[align='center'] { width: 100%; padding: 0px var(--wui-spacing-l); } [data-error='true'] wui-icon-box { opacity: 1; transform: scale(1); } [data-error='true'] > wui-flex:first-child { animation: shake 250ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both; } .capitalize { text-transform: capitalize; } `;var l1=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let ju=class extends se{constructor(){super(),this.unsubscribe=[],this.socialProvider=re.state.socialProvider,this.socialWindow=re.state.socialWindow,this.error=!1,this.connecting=!1,this.message="Connect in the provider window",this.authConnector=ge.getAuthConnector(),this.handleSocialConnection=async r=>{var n;if((n=r.data)!=null&&n.resultUri)if(r.origin===Fo.SECURE_SITE_ORIGIN){window.removeEventListener("message",this.handleSocialConnection,!1);try{if(this.authConnector&&!this.connecting){this.socialWindow&&(this.socialWindow.close(),re.setSocialWindow(void 0,F.state.activeChain)),this.connecting=!0,this.updateMessage();const i=r.data.resultUri;this.socialProvider&&Re.sendEvent({type:"track",event:"SOCIAL_LOGIN_REQUEST_USER_DATA",properties:{provider:this.socialProvider}}),await xe.connectExternal({id:this.authConnector.id,type:this.authConnector.type,socialUri:i},this.authConnector.chain),this.socialProvider&&(Le.setConnectedSocialProvider(this.socialProvider),Re.sendEvent({type:"track",event:"SOCIAL_LOGIN_SUCCESS",properties:{provider:this.socialProvider}}))}}catch{this.error=!0,this.updateMessage(),this.socialProvider&&Re.sendEvent({type:"track",event:"SOCIAL_LOGIN_ERROR",properties:{provider:this.socialProvider}})}}else X.goBack(),Fe.showError("Untrusted Origin"),this.socialProvider&&Re.sendEvent({type:"track",event:"SOCIAL_LOGIN_ERROR",properties:{provider:this.socialProvider}})},Do.EmbeddedWalletAbortController.signal.addEventListener("abort",()=>{this.socialWindow&&(this.socialWindow.close(),re.setSocialWindow(void 0,F.state.activeChain))}),this.unsubscribe.push(re.subscribe(r=>{r.socialProvider&&(this.socialProvider=r.socialProvider),r.socialWindow&&(this.socialWindow=r.socialWindow),r.address&&(We.state.open||oe.state.enableEmbedded)&&We.close()})),this.authConnector&&this.connectSocial()}disconnectedCallback(){var e;this.unsubscribe.forEach(r=>r()),window.removeEventListener("message",this.handleSocialConnection,!1),(e=this.socialWindow)==null||e.close(),re.setSocialWindow(void 0,F.state.activeChain)}render(){return M` ${this.error?null:this.loaderTemplate()} Log in with ${this.socialProvider??"Social"} ${this.message} `}loaderTemplate(){const e=ar.state.themeVariables["--w3m-border-radius-master"],r=e?parseInt(e.replace("px",""),10):4;return M``}connectSocial(){const e=setInterval(()=>{var r;(r=this.socialWindow)!=null&&r.closed&&(!this.connecting&&X.state.view==="ConnectingSocial"&&(this.socialProvider&&Re.sendEvent({type:"track",event:"SOCIAL_LOGIN_CANCELED",properties:{provider:this.socialProvider}}),X.goBack()),clearInterval(e))},1e3);window.addEventListener("message",this.handleSocialConnection,!1)}updateMessage(){this.error?this.message="Something went wrong":this.connecting?this.message="Retrieving user data":this.message="Connect in the provider window"}};ju.styles=pAe;l1([G()],ju.prototype,"socialProvider",void 0);l1([G()],ju.prototype,"socialWindow",void 0);l1([G()],ju.prototype,"error",void 0);l1([G()],ju.prototype,"connecting",void 0);l1([G()],ju.prototype,"message",void 0);ju=l1([te("w3m-connecting-social-view")],ju);var p0={},NS,KB;function gAe(){return KB||(KB=1,NS=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),NS}var $S={},Al={},ZB;function xp(){if(ZB)return Al;ZB=1;let t;const e=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return Al.getSymbolSize=function(n){if(!n)throw new Error('"version" cannot be null or undefined');if(n<1||n>40)throw new Error('"version" should be in range from 1 to 40');return n*4+17},Al.getSymbolTotalCodewords=function(n){return e[n]},Al.getBCHDigit=function(r){let n=0;for(;r!==0;)n++,r>>>=1;return n},Al.setToSJISFunction=function(n){if(typeof n!="function")throw new Error('"toSJISFunc" is not a valid function.');t=n},Al.isKanjiModeEnabled=function(){return typeof t<"u"},Al.toSJIS=function(n){return t(n)},Al}var jS={},YB;function L7(){return YB||(YB=1,function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2};function e(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+r)}}t.isValid=function(n){return n&&typeof n.bit<"u"&&n.bit>=0&&n.bit<4},t.from=function(n,i){if(t.isValid(n))return n;try{return e(n)}catch{return i}}}(jS)),jS}var BS,JB;function mAe(){if(JB)return BS;JB=1;function t(){this.buffer=[],this.length=0}return t.prototype={get:function(e){const r=Math.floor(e/8);return(this.buffer[r]>>>7-e%8&1)===1},put:function(e,r){for(let n=0;n>>r-n-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(e){const r=Math.floor(this.length/8);this.buffer.length<=r&&this.buffer.push(0),e&&(this.buffer[r]|=128>>>this.length%8),this.length++}},BS=t,BS}var DS,QB;function wAe(){if(QB)return DS;QB=1;function t(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}return t.prototype.set=function(e,r,n,i){const s=e*this.size+r;this.data[s]=n,i&&(this.reservedBit[s]=!0)},t.prototype.get=function(e,r){return this.data[e*this.size+r]},t.prototype.xor=function(e,r,n){this.data[e*this.size+r]^=n},t.prototype.isReserved=function(e,r){return this.reservedBit[e*this.size+r]},DS=t,DS}var MS={},XB;function bAe(){return XB||(XB=1,function(t){const e=xp().getSymbolSize;t.getRowColCoords=function(n){if(n===1)return[];const i=Math.floor(n/7)+2,s=e(n),o=s===145?26:Math.ceil((s-13)/(2*i-2))*2,a=[s-7];for(let c=1;c=0&&i<=7},t.from=function(i){return t.isValid(i)?parseInt(i,10):void 0},t.getPenaltyN1=function(i){const s=i.size;let o=0,a=0,c=0,u=null,l=null;for(let d=0;d=5&&(o+=e.N1+(a-5)),u=f,a=1),f=i.get(h,d),f===l?c++:(c>=5&&(o+=e.N1+(c-5)),l=f,c=1)}a>=5&&(o+=e.N1+(a-5)),c>=5&&(o+=e.N1+(c-5))}return o},t.getPenaltyN2=function(i){const s=i.size;let o=0;for(let a=0;a=10&&(a===1488||a===93)&&o++,c=c<<1&2047|i.get(l,u),l>=10&&(c===1488||c===93)&&o++}return o*e.N3},t.getPenaltyN4=function(i){let s=0;const o=i.data.length;for(let c=0;c=0;){const o=s[0];for(let c=0;c0){const a=new Uint8Array(this.degree);return a.set(s,o),a}return s},HS=e,HS}var qS={},zS={},WS={},oD;function KJ(){return oD||(oD=1,WS.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}),WS}var Ea={},aD;function ZJ(){if(aD)return Ea;aD=1;const t="[0-9]+",e="[A-Z $%*+\\-./:]+";let r="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";r=r.replace(/u/g,"\\u");const n="(?:(?![A-Z0-9 $%*+\\-./:]|"+r+`)(?:.|[\r ]))+`;Ea.KANJI=new RegExp(r,"g"),Ea.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),Ea.BYTE=new RegExp(n,"g"),Ea.NUMERIC=new RegExp(t,"g"),Ea.ALPHANUMERIC=new RegExp(e,"g");const i=new RegExp("^"+r+"$"),s=new RegExp("^"+t+"$"),o=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return Ea.testKanji=function(c){return i.test(c)},Ea.testNumeric=function(c){return s.test(c)},Ea.testAlphanumeric=function(c){return o.test(c)},Ea}var cD;function Sp(){return cD||(cD=1,function(t){const e=KJ(),r=ZJ();t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(s,o){if(!s.ccBits)throw new Error("Invalid mode: "+s);if(!e.isValid(o))throw new Error("Invalid version: "+o);return o>=1&&o<10?s.ccBits[0]:o<27?s.ccBits[1]:s.ccBits[2]},t.getBestModeForData=function(s){return r.testNumeric(s)?t.NUMERIC:r.testAlphanumeric(s)?t.ALPHANUMERIC:r.testKanji(s)?t.KANJI:t.BYTE},t.toString=function(s){if(s&&s.id)return s.id;throw new Error("Invalid mode")},t.isValid=function(s){return s&&s.bit&&s.ccBits};function n(i){if(typeof i!="string")throw new Error("Param is not a string");switch(i.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+i)}}t.from=function(s,o){if(t.isValid(s))return s;try{return n(s)}catch{return o}}}(zS)),zS}var uD;function AAe(){return uD||(uD=1,function(t){const e=xp(),r=GJ(),n=L7(),i=Sp(),s=KJ(),o=7973,a=e.getBCHDigit(o);function c(h,f,g){for(let p=1;p<=40;p++)if(f<=t.getCapacity(p,g,h))return p}function u(h,f){return i.getCharCountIndicator(h,f)+4}function l(h,f){let g=0;return h.forEach(function(p){const m=u(p.mode,f);g+=m+p.getBitsLength()}),g}function d(h,f){for(let g=1;g<=40;g++)if(l(h,g)<=t.getCapacity(g,f,i.MIXED))return g}t.from=function(f,g){return s.isValid(f)?parseInt(f,10):g},t.getCapacity=function(f,g,p){if(!s.isValid(f))throw new Error("Invalid QR Code version");typeof p>"u"&&(p=i.BYTE);const m=e.getSymbolTotalCodewords(f),b=r.getTotalCodewordsCount(f,g),v=(m-b)*8;if(p===i.MIXED)return v;const E=v-u(p,f);switch(p){case i.NUMERIC:return Math.floor(E/10*3);case i.ALPHANUMERIC:return Math.floor(E/11*2);case i.KANJI:return Math.floor(E/13);case i.BYTE:default:return Math.floor(E/8)}},t.getBestVersionForData=function(f,g){let p;const m=n.from(g,n.M);if(Array.isArray(f)){if(f.length>1)return d(f,m);if(f.length===0)return 1;p=f[0]}else p=f;return c(p.mode,p.getLength(),m)},t.getEncodedBits=function(f){if(!s.isValid(f)||f<7)throw new Error("Invalid QR Code version");let g=f<<12;for(;e.getBCHDigit(g)-a>=0;)g^=o<=0;)c^=e<0&&(s=this.data.substr(i),o=parseInt(s,10),n.put(o,a*3+1))},KS=e,KS}var ZS,hD;function TAe(){if(hD)return ZS;hD=1;const t=Sp(),e=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function r(n){this.mode=t.ALPHANUMERIC,this.data=n}return r.getBitsLength=function(i){return 11*Math.floor(i/2)+6*(i%2)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(i){let s;for(s=0;s+2<=this.data.length;s+=2){let o=e.indexOf(this.data[s])*45;o+=e.indexOf(this.data[s+1]),i.put(o,11)}this.data.length%2&&i.put(e.indexOf(this.data[s]),6)},ZS=r,ZS}var YS,fD;function IAe(){return fD||(fD=1,YS=function(e){for(var r=[],n=e.length,i=0;i=55296&&s<=56319&&n>i+1){var o=e.charCodeAt(i+1);o>=56320&&o<=57343&&(s=(s-55296)*1024+o-56320+65536,i+=1)}if(s<128){r.push(s);continue}if(s<2048){r.push(s>>6|192),r.push(s&63|128);continue}if(s<55296||s>=57344&&s<65536){r.push(s>>12|224),r.push(s>>6&63|128),r.push(s&63|128);continue}if(s>=65536&&s<=1114111){r.push(s>>18|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(s&63|128);continue}r.push(239,191,189)}return new Uint8Array(r).buffer}),YS}var JS,pD;function PAe(){if(pD)return JS;pD=1;const t=IAe(),e=Sp();function r(n){this.mode=e.BYTE,typeof n=="string"&&(n=t(n)),this.data=new Uint8Array(n)}return r.getBitsLength=function(i){return i*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(n){for(let i=0,s=this.data.length;i=33088&&s<=40956)s-=33088;else if(s>=57408&&s<=60351)s-=49472;else throw new Error("Invalid SJIS character: "+this.data[i]+` Make sure your charset is UTF-8`);s=(s>>>8&255)*192+(s&255),n.put(s,13)}},QS=r,QS}var XS={exports:{}},mD;function RAe(){return mD||(mD=1,function(t){var e={single_source_shortest_paths:function(r,n,i){var s={},o={};o[n]=0;var a=e.PriorityQueue.make();a.push(n,0);for(var c,u,l,d,h,f,g,p,m;!a.empty();){c=a.pop(),u=c.value,d=c.cost,h=r[u]||{};for(l in h)h.hasOwnProperty(l)&&(f=h[l],g=d+f,p=o[l],m=typeof o[l]>"u",(m||p>g)&&(o[l]=g,a.push(l,g),s[l]=u))}if(typeof i<"u"&&typeof o[i]>"u"){var b=["Could not find a path from ",n," to ",i,"."].join("");throw new Error(b)}return s},extract_shortest_path_from_predecessor_list:function(r,n){for(var i=[],s=n;s;)i.push(s),r[s],s=r[s];return i.reverse(),i},find_path:function(r,n,i){var s=e.single_source_shortest_paths(r,n,i);return e.extract_shortest_path_from_predecessor_list(s,i)},PriorityQueue:{make:function(r){var n=e.PriorityQueue,i={},s;r=r||{};for(s in n)n.hasOwnProperty(s)&&(i[s]=n[s]);return i.queue=[],i.sorter=r.sorter||n.default_sorter,i},default_sorter:function(r,n){return r.cost-n.cost},push:function(r,n){var i={value:r,cost:n};this.queue.push(i),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t.exports=e}(XS)),XS.exports}var wD;function kAe(){return wD||(wD=1,function(t){const e=Sp(),r=SAe(),n=TAe(),i=PAe(),s=OAe(),o=ZJ(),a=xp(),c=RAe();function u(b){return unescape(encodeURIComponent(b)).length}function l(b,v,E){const w=[];let C;for(;(C=b.exec(E))!==null;)w.push({data:C[0],index:C.index,mode:v,length:C[0].length});return w}function d(b){const v=l(o.NUMERIC,e.NUMERIC,b),E=l(o.ALPHANUMERIC,e.ALPHANUMERIC,b);let w,C;return a.isKanjiModeEnabled()?(w=l(o.BYTE,e.BYTE,b),C=l(o.KANJI,e.KANJI,b)):(w=l(o.BYTE_KANJI,e.BYTE,b),C=[]),v.concat(E,w,C).sort(function(_,x){return _.index-x.index}).map(function(_){return{data:_.data,mode:_.mode,length:_.length}})}function h(b,v){switch(v){case e.NUMERIC:return r.getBitsLength(b);case e.ALPHANUMERIC:return n.getBitsLength(b);case e.KANJI:return s.getBitsLength(b);case e.BYTE:return i.getBitsLength(b)}}function f(b){return b.reduce(function(v,E){const w=v.length-1>=0?v[v.length-1]:null;return w&&w.mode===E.mode?(v[v.length-1].data+=E.data,v):(v.push(E),v)},[])}function g(b){const v=[];for(let E=0;E=0&&j<=6&&(N===0||N===6)||N>=0&&N<=6&&(j===0||j===6)||j>=2&&j<=4&&N>=2&&N<=4?y.set(O+j,k+N,!0,!0):y.set(O+j,k+N,!1,!0))}}function g(y){const _=y.size;for(let x=8;x<_-8;x++){const A=x%2===0;y.set(x,6,A,!0),y.set(6,x,A,!0)}}function p(y,_){const x=i.getPositions(_);for(let A=0;A>j&1)===1,y.set(T,O,k,!0),y.set(O,T,k,!0)}function b(y,_,x){const A=y.size,T=l.getEncodedBits(_,x);let O,k;for(O=0;O<15;O++)k=(T>>O&1)===1,O<6?y.set(O,8,k,!0):O<8?y.set(O+1,8,k,!0):y.set(A-15+O,8,k,!0),O<8?y.set(8,A-O-1,k,!0):O<9?y.set(8,15-O-1+1,k,!0):y.set(8,15-O-1,k,!0);y.set(A-8,8,1,!0)}function v(y,_){const x=y.size;let A=-1,T=x-1,O=7,k=0;for(let j=x-1;j>0;j-=2)for(j===6&&j--;;){for(let N=0;N<2;N++)if(!y.isReserved(T,j-N)){let S=!1;k<_.length&&(S=(_[k]>>>O&1)===1),y.set(T,j-N,S),O--,O===-1&&(k++,O=7)}if(T+=A,T<0||x<=T){T-=A,A=-A;break}}}function E(y,_,x){const A=new r;x.forEach(function(N){A.put(N.mode.bit,4),A.put(N.getLength(),d.getCharCountIndicator(N.mode,y)),N.write(A)});const T=t.getSymbolTotalCodewords(y),O=a.getTotalCodewordsCount(y,_),k=(T-O)*8;for(A.getLengthInBits()+4<=k&&A.put(0,4);A.getLengthInBits()%8!==0;)A.putBit(0);const j=(k-A.getLengthInBits())/8;for(let N=0;N=7&&m(N,_),v(N,k),isNaN(A)&&(A=o.getBestMask(N,b.bind(null,N,x))),o.applyMask(A,N),b(N,x,A),{modules:N,version:_,errorCorrectionLevel:x,maskPattern:A,segments:T}}return $S.create=function(_,x){if(typeof _>"u"||_==="")throw new Error("No input text");let A=e.M,T,O;return typeof x<"u"&&(A=e.from(x.errorCorrectionLevel,e.M),T=u.from(x.version),O=o.from(x.maskPattern),x.toSJISFunc&&t.setToSJISFunction(x.toSJISFunc)),C(_,T,A,O)},$S}var eT={},tT={},yD;function YJ(){return yD||(yD=1,function(t){function e(r){if(typeof r=="number"&&(r=r.toString()),typeof r!="string")throw new Error("Color should be defined as hex string");let n=r.slice().replace("#","").split("");if(n.length<3||n.length===5||n.length>8)throw new Error("Invalid hex color: "+r);(n.length===3||n.length===4)&&(n=Array.prototype.concat.apply([],n.map(function(s){return[s,s]}))),n.length===6&&n.push("F","F");const i=parseInt(n.join(""),16);return{r:i>>24&255,g:i>>16&255,b:i>>8&255,a:i&255,hex:"#"+n.slice(0,6).join("")}}t.getOptions=function(n){n||(n={}),n.color||(n.color={});const i=typeof n.margin>"u"||n.margin===null||n.margin<0?4:n.margin,s=n.width&&n.width>=21?n.width:void 0,o=n.scale||4;return{width:s,scale:s?4:o,margin:i,color:{dark:e(n.color.dark||"#000000ff"),light:e(n.color.light||"#ffffffff")},type:n.type,rendererOpts:n.rendererOpts||{}}},t.getScale=function(n,i){return i.width&&i.width>=n+i.margin*2?i.width/(n+i.margin*2):i.scale},t.getImageWidth=function(n,i){const s=t.getScale(n,i);return Math.floor((n+i.margin*2)*s)},t.qrToImageData=function(n,i,s){const o=i.modules.size,a=i.modules.data,c=t.getScale(o,s),u=Math.floor((o+s.margin*2)*c),l=s.margin*c,d=[s.color.light,s.color.dark];for(let h=0;h=l&&f>=l&&h"u"&&(!o||!o.getContext)&&(c=o,o=void 0),o||(u=n()),c=e.getOptions(c);const l=e.getImageWidth(s.modules.size,c),d=u.getContext("2d"),h=d.createImageData(l,l);return e.qrToImageData(h.data,s,c),r(d,u,l),d.putImageData(h,0,0),u},t.renderToDataURL=function(s,o,a){let c=a;typeof c>"u"&&(!o||!o.getContext)&&(c=o,o=void 0),c||(c={});const u=t.render(s,o,c),l=c.type||"image/png",d=c.rendererOpts||{};return u.toDataURL(l,d.quality)}}(eT)),eT}var rT={},_D;function jAe(){if(_D)return rT;_D=1;const t=YJ();function e(i,s){const o=i.a/255,a=s+'="'+i.hex+'"';return o<1?a+" "+s+'-opacity="'+o.toFixed(2).slice(1)+'"':a}function r(i,s,o){let a=i+s;return typeof o<"u"&&(a+=" "+o),a}function n(i,s,o){let a="",c=0,u=!1,l=0;for(let d=0;d0&&h>0&&i[d-1]||(a+=u?r("M",h+o,.5+f+o):r("m",c,0),c=0,u=!1),h+1':"",f="',g='viewBox="0 0 '+d+" "+d+'"',m=''+h+f+` `;return typeof a=="function"&&a(null,m),m},rT}var ED;function BAe(){if(ED)return p0;ED=1;const t=gAe(),e=NAe(),r=$Ae(),n=jAe();function i(s,o,a,c,u){const l=[].slice.call(arguments,1),d=l.length,h=typeof l[d-1]=="function";if(!h&&!t())throw new Error("Callback required as last argument");if(h){if(d<2)throw new Error("Too few arguments provided");d===2?(u=a,a=o,o=c=void 0):d===3&&(o.getContext&&typeof u>"u"?(u=c,c=void 0):(u=c,c=a,a=o,o=void 0))}else{if(d<1)throw new Error("Too few arguments provided");return d===1?(a=o,o=c=void 0):d===2&&!o.getContext&&(c=a,a=o,o=void 0),new Promise(function(f,g){try{const p=e.create(a,c);f(s(p,o,c))}catch(p){g(p)}})}try{const f=e.create(a,c);u(null,s(f,o,c))}catch(f){u(f)}}return p0.create=e.create,p0.toCanvas=i.bind(null,r.render),p0.toDataURL=i.bind(null,r.renderToDataURL),p0.toString=i.bind(null,function(s,o,a){return n.render(s,a)}),p0}var DAe=BAe();const MAe=cc(DAe),LAe=.1,CD=2.5,Sc=7;function nT(t,e,r){return t===e?!1:(t-e<0?e-t:t-e)<=r+LAe}function UAe(t,e){const r=Array.prototype.slice.call(MAe.create(t,{errorCorrectionLevel:e}).modules.data,0),n=Math.sqrt(r.length);return r.reduce((i,s,o)=>(o%n===0?i.push([s]):i[i.length-1].push(s))&&i,[])}const FAe={generate({uri:t,size:e,logoSize:r,dotColor:n="#141414"}){const i="transparent",o=[],a=UAe(t,"Q"),c=e/a.length,u=[{x:0,y:0},{x:1,y:0},{x:0,y:1}];u.forEach(({x:p,y:m})=>{const b=(a.length-Sc)*c*p,v=(a.length-Sc)*c*m,E=.45;for(let w=0;w `)}});const l=Math.floor((r+25)/c),d=a.length/2-l/2,h=a.length/2+l/2-1,f=[];a.forEach((p,m)=>{p.forEach((b,v)=>{if(a[m][v]&&!(ma.length-(Sc+1)&&va.length-(Sc+1))&&!(m>d&&md&&v{var b;g[p]?(b=g[p])==null||b.push(m):g[p]=[m]}),Object.entries(g).map(([p,m])=>{const b=m.filter(v=>m.every(E=>!nT(v,E,c)));return[Number(p),b]}).forEach(([p,m])=>{m.forEach(b=>{o.push(Se``)})}),Object.entries(g).filter(([p,m])=>m.length>1).map(([p,m])=>{const b=m.filter(v=>m.some(E=>nT(v,E,c)));return[Number(p),b]}).map(([p,m])=>{m.sort((v,E)=>vw.some(C=>nT(v,C,c)));E?E.push(v):b.push([v])}return[p,b.map(v=>[v[0],v[v.length-1]])]}).forEach(([p,m])=>{m.forEach(([b,v])=>{o.push(Se` `)})}),o}},HAe=de` :host { position: relative; user-select: none; display: block; overflow: hidden; aspect-ratio: 1 / 1; width: var(--local-size); } :host([data-theme='dark']) { border-radius: clamp(0px, var(--wui-border-radius-l), 40px); background-color: var(--wui-color-inverse-100); padding: var(--wui-spacing-l); } :host([data-theme='light']) { box-shadow: 0 0 0 1px var(--wui-color-bg-125); background-color: var(--wui-color-bg-125); } :host([data-clear='true']) > wui-icon { display: none; } svg:first-child, wui-image, wui-icon { position: absolute; top: 50%; left: 50%; transform: translateY(-50%) translateX(-50%); } wui-image { width: 25%; height: 25%; border-radius: var(--wui-border-radius-xs); } wui-icon { width: 100%; height: 100%; color: var(--local-icon-color) !important; transform: translateY(-50%) translateX(-50%) scale(0.25); } `;var Yu=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};const qAe="#3396ff";let Yo=class extends se{constructor(){super(...arguments),this.uri="",this.size=0,this.theme="dark",this.imageSrc=void 0,this.alt=void 0,this.arenaClear=void 0,this.farcaster=void 0}render(){return this.dataset.theme=this.theme,this.dataset.clear=String(this.arenaClear),this.style.cssText=` --local-size: ${this.size}px; --local-icon-color: ${this.color??qAe} `,M`${this.templateVisual()} ${this.templateSvg()}`}templateSvg(){const e=this.theme==="light"?this.size:this.size-32;return Se` ${FAe.generate({uri:this.uri,size:e,logoSize:this.arenaClear?0:e/4,dotColor:this.color})} `}templateVisual(){return this.imageSrc?M``:this.farcaster?M``:M``}};Yo.styles=[He,HAe];Yu([q()],Yo.prototype,"uri",void 0);Yu([q({type:Number})],Yo.prototype,"size",void 0);Yu([q()],Yo.prototype,"theme",void 0);Yu([q()],Yo.prototype,"imageSrc",void 0);Yu([q()],Yo.prototype,"alt",void 0);Yu([q()],Yo.prototype,"color",void 0);Yu([q({type:Boolean})],Yo.prototype,"arenaClear",void 0);Yu([q({type:Boolean})],Yo.prototype,"farcaster",void 0);Yo=Yu([te("wui-qr-code")],Yo);const zAe=de` :host { display: block; box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-005); background: linear-gradient( 120deg, var(--wui-color-bg-200) 5%, var(--wui-color-bg-200) 48%, var(--wui-color-bg-300) 55%, var(--wui-color-bg-300) 60%, var(--wui-color-bg-300) calc(60% + 10px), var(--wui-color-bg-200) calc(60% + 12px), var(--wui-color-bg-200) 100% ); background-size: 250%; animation: shimmer 3s linear infinite reverse; } :host([variant='light']) { background: linear-gradient( 120deg, var(--wui-color-bg-150) 5%, var(--wui-color-bg-150) 48%, var(--wui-color-bg-200) 55%, var(--wui-color-bg-200) 60%, var(--wui-color-bg-200) calc(60% + 10px), var(--wui-color-bg-150) calc(60% + 12px), var(--wui-color-bg-150) 100% ); background-size: 250%; } @keyframes shimmer { from { background-position: -250% 0; } to { background-position: 250% 0; } } `;var t2=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let rp=class extends se{constructor(){super(...arguments),this.width="",this.height="",this.borderRadius="m",this.variant="default"}render(){return this.style.cssText=` width: ${this.width}; height: ${this.height}; border-radius: ${`clamp(0px,var(--wui-border-radius-${this.borderRadius}), 40px)`}; `,M``}};rp.styles=[zAe];t2([q()],rp.prototype,"width",void 0);t2([q()],rp.prototype,"height",void 0);t2([q()],rp.prototype,"borderRadius",void 0);t2([q()],rp.prototype,"variant",void 0);rp=t2([te("wui-shimmer")],rp);const WAe=de` @keyframes fadein { from { opacity: 0; } to { opacity: 1; } } wui-shimmer { width: 100%; aspect-ratio: 1 / 1; border-radius: clamp(0px, var(--wui-border-radius-l), 40px) !important; } wui-qr-code { opacity: 0; animation-duration: 200ms; animation-timing-function: ease; animation-name: fadein; animation-fill-mode: forwards; } wui-logo { width: 80px; height: 80px; border-radius: var(--wui-border-radius-m); } wui-flex:first-child:not(:only-child) { position: relative; } wui-loading-thumbnail { position: absolute; } wui-icon-box { position: absolute; right: calc(var(--wui-spacing-3xs) * -1); bottom: calc(var(--wui-spacing-3xs) * -1); opacity: 0; transform: scale(0.5); transition: all var(--wui-ease-out-power-2) var(--wui-duration-lg); } `;var r2=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Cd=class extends se{constructor(){super(),this.unsubscribe=[],this.timeout=void 0,this.socialProvider=re.state.socialProvider,this.uri=re.state.farcasterUrl,this.ready=!1,this.loading=!1,this.authConnector=ge.getAuthConnector(),this.forceUpdate=()=>{this.requestUpdate()},this.unsubscribe.push(re.subscribeKey("farcasterUrl",e=>{e&&(this.uri=e,this.connectFarcaster())}),re.subscribeKey("socialProvider",e=>{e&&(this.socialProvider=e)})),window.addEventListener("resize",this.forceUpdate)}disconnectedCallback(){super.disconnectedCallback(),clearTimeout(this.timeout),window.removeEventListener("resize",this.forceUpdate)}render(){return this.onRenderProxy(),M`${this.platformTemplate()}`}platformTemplate(){return ue.isMobile()?M`${this.mobileTemplate()}`:M`${this.desktopTemplate()}`}desktopTemplate(){return this.loading?M`${this.loadingTemplate()}`:M`${this.qrTemplate()}`}qrTemplate(){return M` ${this.qrCodeTemplate()} Scan this QR Code with your phone ${this.copyTemplate()} `}loadingTemplate(){return M` ${this.loaderTemplate()} Loading user data Please wait a moment while we load your data. `}mobileTemplate(){return M` ${this.loaderTemplate()} Continue in Farcaster Accept connection request in the app ${this.mobileLinkTemplate()} `}loaderTemplate(){const e=ar.state.themeVariables["--w3m-border-radius-master"],r=e?parseInt(e.replace("px",""),10):4;return M``}async connectFarcaster(){var e;if(this.authConnector)try{await((e=this.authConnector)==null?void 0:e.provider.connectFarcaster()),this.socialProvider&&(Le.setConnectedSocialProvider(this.socialProvider),Re.sendEvent({type:"track",event:"SOCIAL_LOGIN_REQUEST_USER_DATA",properties:{provider:this.socialProvider}})),this.loading=!0,await xe.connectExternal(this.authConnector,this.authConnector.chain),this.socialProvider&&Re.sendEvent({type:"track",event:"SOCIAL_LOGIN_SUCCESS",properties:{provider:this.socialProvider}}),this.loading=!1,We.close()}catch(r){this.socialProvider&&Re.sendEvent({type:"track",event:"SOCIAL_LOGIN_ERROR",properties:{provider:this.socialProvider}}),X.goBack(),Fe.showError(r)}}mobileLinkTemplate(){return M`{this.uri&&ue.openHref(this.uri,"_blank")}} > Open farcaster`}onRenderProxy(){!this.ready&&this.uri&&(this.timeout=setTimeout(()=>{this.ready=!0},200))}qrCodeTemplate(){if(!this.uri||!this.ready)return null;const e=this.getBoundingClientRect().width-40;return M` `}copyTemplate(){const e=!this.uri||!this.ready;return M` Copy link `}onCopyUri(){try{this.uri&&(ue.copyToClopboard(this.uri),Fe.showSuccess("Link copied"))}catch{Fe.showError("Failed to copy")}}};Cd.styles=WAe;r2([G()],Cd.prototype,"socialProvider",void 0);r2([G()],Cd.prototype,"uri",void 0);r2([G()],Cd.prototype,"ready",void 0);r2([G()],Cd.prototype,"loading",void 0);Cd=r2([te("w3m-connecting-farcaster-view")],Cd);const VAe=Object.freeze(Object.defineProperty({__proto__:null,get W3mConnectSocialsView(){return jy},get W3mConnectingFarcasterView(){return Cd},get W3mConnectingSocialView(){return ju}},Symbol.toStringTag,{value:"Module"})),GAe=de` :host { width: 100%; display: block; } `;var U7=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let By=class extends se{constructor(){super(),this.unsubscribe=[],this.text="",this.open=_s.state.open,this.unsubscribe.push(X.subscribeKey("view",()=>{_s.hide()}),We.subscribeKey("open",e=>{e||_s.hide()}),_s.subscribeKey("open",e=>{this.open=e}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e()),_s.hide()}render(){return M`
${this.renderChildren()}
`}renderChildren(){return M` `}onMouseEnter(){const e=this.getBoundingClientRect();this.open||_s.showTooltip({message:this.text,triggerRect:{width:e.width,height:e.height,left:e.left,top:e.top},variant:"shade"})}onMouseLeave(e){this.contains(e.relatedTarget)||_s.hide()}};By.styles=[GAe];U7([q()],By.prototype,"text",void 0);U7([G()],By.prototype,"open",void 0);By=U7([te("w3m-tooltip-trigger")],By);const KAe=de` :host { pointer-events: none; } :host > wui-flex { display: var(--w3m-tooltip-display); opacity: var(--w3m-tooltip-opacity); padding: 9px var(--wui-spacing-s) 10px var(--wui-spacing-s); border-radius: var(--wui-border-radius-xxs); color: var(--wui-color-bg-100); position: fixed; top: var(--w3m-tooltip-top); left: var(--w3m-tooltip-left); transform: translate(calc(-50% + var(--w3m-tooltip-parent-width)), calc(-100% - 8px)); max-width: calc(var(--w3m-modal-width) - var(--wui-spacing-xl)); transition: opacity 0.2s var(--wui-ease-out-power-2); will-change: opacity; } :host([data-variant='shade']) > wui-flex { background-color: var(--wui-color-bg-150); border: 1px solid var(--wui-color-gray-glass-005); } :host([data-variant='shade']) > wui-flex > wui-text { color: var(--wui-color-fg-150); } :host([data-variant='fill']) > wui-flex { background-color: var(--wui-color-fg-100); border: none; } wui-icon { position: absolute; width: 12px !important; height: 4px !important; color: var(--wui-color-bg-150); } wui-icon[data-placement='top'] { bottom: 0px; left: 50%; transform: translate(-50%, 95%); } wui-icon[data-placement='bottom'] { top: 0; left: 50%; transform: translate(-50%, -95%) rotate(180deg); } wui-icon[data-placement='right'] { top: 50%; left: 0; transform: translate(-65%, -50%) rotate(90deg); } wui-icon[data-placement='left'] { top: 50%; right: 0%; transform: translate(65%, -50%) rotate(270deg); } `;var n2=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let np=class extends se{constructor(){super(),this.unsubscribe=[],this.open=_s.state.open,this.message=_s.state.message,this.triggerRect=_s.state.triggerRect,this.variant=_s.state.variant,this.unsubscribe.push(_s.subscribe(e=>{this.open=e.open,this.message=e.message,this.triggerRect=e.triggerRect,this.variant=e.variant}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){this.dataset.variant=this.variant;const e=this.triggerRect.top,r=this.triggerRect.left;return this.style.cssText=` --w3m-tooltip-top: ${e}px; --w3m-tooltip-left: ${r}px; --w3m-tooltip-parent-width: ${this.triggerRect.width/2}px; --w3m-tooltip-display: ${this.open?"flex":"none"}; --w3m-tooltip-opacity: ${this.open?1:0}; `,M` ${this.message} `}};np.styles=[KAe];n2([G()],np.prototype,"open",void 0);n2([G()],np.prototype,"message",void 0);n2([G()],np.prototype,"triggerRect",void 0);n2([G()],np.prototype,"variant",void 0);np=n2([te("w3m-tooltip"),te("w3m-tooltip")],np);const ZAe=de` :host { width: 100%; } .details-container > wui-flex { background: var(--wui-color-gray-glass-002); border-radius: var(--wui-border-radius-xxs); width: 100%; } .details-container > wui-flex > button { border: none; background: none; padding: var(--wui-spacing-s); border-radius: var(--wui-border-radius-xxs); cursor: pointer; } .details-content-container { padding: var(--wui-spacing-1xs); padding-top: 0px; display: flex; align-items: center; justify-content: center; } .details-content-container > wui-flex { width: 100%; } .details-row { width: 100%; padding: var(--wui-spacing-s); padding-left: var(--wui-spacing-s); padding-right: var(--wui-spacing-1xs); border-radius: calc(var(--wui-border-radius-5xs) + var(--wui-border-radius-4xs)); background: var(--wui-color-gray-glass-002); } .details-row-title { white-space: nowrap; } .details-row.provider-free-row { padding-right: var(--wui-spacing-xs); } `;var lo=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};const YAe=ct.CONVERT_SLIPPAGE_TOLERANCE;let Yi=class extends se{constructor(){var e;super(),this.unsubscribe=[],this.networkName=(e=F.state.activeCaipNetwork)==null?void 0:e.name,this.detailsOpen=!1,this.sourceToken=ye.state.sourceToken,this.toToken=ye.state.toToken,this.toTokenAmount=ye.state.toTokenAmount,this.sourceTokenPriceInUSD=ye.state.sourceTokenPriceInUSD,this.toTokenPriceInUSD=ye.state.toTokenPriceInUSD,this.priceImpact=ye.state.priceImpact,this.maxSlippage=ye.state.maxSlippage,this.networkTokenSymbol=ye.state.networkTokenSymbol,this.inputError=ye.state.inputError,this.unsubscribe.push(ye.subscribe(r=>{this.sourceToken=r.sourceToken,this.toToken=r.toToken,this.toTokenAmount=r.toTokenAmount,this.priceImpact=r.priceImpact,this.maxSlippage=r.maxSlippage,this.sourceTokenPriceInUSD=r.sourceTokenPriceInUSD,this.toTokenPriceInUSD=r.toTokenPriceInUSD,this.inputError=r.inputError}))}render(){const e=this.toTokenAmount&&this.maxSlippage?Dt.bigNumber(this.toTokenAmount).minus(this.maxSlippage).toString():null;if(!this.sourceToken||!this.toToken||this.inputError)return null;const r=this.sourceTokenPriceInUSD&&this.toTokenPriceInUSD?1/this.toTokenPriceInUSD*this.sourceTokenPriceInUSD:0;return M` ${this.detailsOpen?M` ${this.priceImpact?M` Price impact ${nt.formatNumberToLocalString(this.priceImpact,3)}% `:null} ${this.maxSlippage&&this.sourceToken.symbol?M` Max. slippage ${nt.formatNumberToLocalString(this.maxSlippage,6)} ${this.toToken.symbol} ${YAe}% `:null} Provider fee 0.85% `:null} `}toggleDetails(){this.detailsOpen=!this.detailsOpen}};Yi.styles=[ZAe];lo([G()],Yi.prototype,"networkName",void 0);lo([q()],Yi.prototype,"detailsOpen",void 0);lo([G()],Yi.prototype,"sourceToken",void 0);lo([G()],Yi.prototype,"toToken",void 0);lo([G()],Yi.prototype,"toTokenAmount",void 0);lo([G()],Yi.prototype,"sourceTokenPriceInUSD",void 0);lo([G()],Yi.prototype,"toTokenPriceInUSD",void 0);lo([G()],Yi.prototype,"priceImpact",void 0);lo([G()],Yi.prototype,"maxSlippage",void 0);lo([G()],Yi.prototype,"networkTokenSymbol",void 0);lo([G()],Yi.prototype,"inputError",void 0);Yi=lo([te("w3m-swap-details")],Yi);const JAe=de` :host { width: 100%; } :host > wui-flex { display: flex; flex-direction: row; justify-content: space-between; align-items: center; border-radius: var(--wui-border-radius-s); padding: var(--wui-spacing-xl); padding-right: var(--wui-spacing-s); background-color: var(--wui-color-gray-glass-002); box-shadow: inset 0px 0px 0px 1px var(--wui-color-gray-glass-002); width: 100%; height: 100px; box-sizing: border-box; position: relative; } wui-shimmer.market-value { opacity: 0; } :host > wui-flex > svg.input_mask { position: absolute; inset: 0; z-index: 5; } :host wui-flex .input_mask__border, :host wui-flex .input_mask__background { transition: fill var(--wui-duration-md) var(--wui-ease-out-power-1); will-change: fill; } :host wui-flex .input_mask__border { fill: var(--wui-color-gray-glass-020); } :host wui-flex .input_mask__background { fill: var(--wui-color-gray-glass-002); } `;var JJ=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let l6=class extends se{constructor(){super(...arguments),this.target="sourceToken"}render(){return M` ${this.templateTokenSelectButton()} `}templateTokenSelectButton(){return M` `}};l6.styles=[JAe];JJ([q()],l6.prototype,"target",void 0);l6=JJ([te("w3m-swap-input-skeleton")],l6);const QAe=de` :host { display: block; } :host > button { gap: var(--wui-spacing-xxs); padding: var(--wui-spacing-xs); padding-right: var(--wui-spacing-1xs); height: 40px; border-radius: var(--wui-border-radius-l); background: var(--wui-color-gray-glass-002); border-width: 0px; box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-002); } :host > button wui-image { width: 24px; height: 24px; border-radius: var(--wui-border-radius-s); box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-010); } `;var F7=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Dy=class extends se{constructor(){super(...arguments),this.text=""}render(){return M` `}tokenTemplate(){return this.imageSrc?M``:M` `}};Dy.styles=[He,vt,QAe];F7([q()],Dy.prototype,"imageSrc",void 0);F7([q()],Dy.prototype,"text",void 0);Dy=F7([te("wui-token-button")],Dy);const XAe=de` :host > wui-flex { display: flex; flex-direction: row; justify-content: space-between; align-items: center; border-radius: var(--wui-border-radius-s); background-color: var(--wui-color-gray-glass-002); padding: var(--wui-spacing-xl); padding-right: var(--wui-spacing-s); width: 100%; height: 100px; box-sizing: border-box; box-shadow: inset 0px 0px 0px 1px var(--wui-color-gray-glass-002); position: relative; transition: box-shadow var(--wui-ease-out-power-1) var(--wui-duration-lg); will-change: background-color; } :host wui-flex.focus { box-shadow: inset 0px 0px 0px 1px var(--wui-color-gray-glass-005); } :host > wui-flex .swap-input, :host > wui-flex .swap-token-button { z-index: 10; } :host > wui-flex .swap-input { -webkit-mask-image: linear-gradient( 270deg, transparent 0px, transparent 8px, black 24px, black 25px, black 32px, black 100% ); mask-image: linear-gradient( 270deg, transparent 0px, transparent 8px, black 24px, black 25px, black 32px, black 100% ); } :host > wui-flex .swap-input input { background: none; border: none; height: 42px; width: 100%; font-size: 32px; font-style: normal; font-weight: 400; line-height: 130%; letter-spacing: -1.28px; outline: none; caret-color: var(--wui-color-accent-100); color: var(--wui-color-fg-100); padding: 0px; } :host > wui-flex .swap-input input:focus-visible { outline: none; } :host > wui-flex .swap-input input::-webkit-outer-spin-button, :host > wui-flex .swap-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; } .max-value-button { background-color: transparent; border: none; cursor: pointer; color: var(--wui-color-gray-glass-020); padding-left: 0px; } .market-value { min-height: 18px; } `;var na=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};const exe=5e-5;let Ss=class extends se{constructor(){super(...arguments),this.focused=!1,this.price=0,this.target="sourceToken",this.onSetAmount=null,this.onSetMaxValue=null}render(){const e=this.marketValue||"0",r=Dt.bigNumber(e).gt("0");return M` this.onFocusChange(!0)} @focusout=${()=>this.onFocusChange(!1)} ?disabled=${this.disabled} .value=${this.value} @input=${this.dispatchInputChangeEvent} @keydown=${this.handleKeydown} placeholder="0" type="text" inputmode="decimal" /> ${r?`$${nt.formatNumberToLocalString(this.marketValue,2)}`:null} ${this.templateTokenSelectButton()} `}handleKeydown(e){return xne.numericInputKeyDown(e,this.value,r=>{var n;return(n=this.onSetAmount)==null?void 0:n.call(this,this.target,r)})}dispatchInputChangeEvent(e){if(!this.onSetAmount)return;const r=e.target.value.replace(/[^0-9.]/gu,"");r===","||r==="."?this.onSetAmount(this.target,"0."):r.endsWith(",")?this.onSetAmount(this.target,r.replace(",",".")):this.onSetAmount(this.target,r)}setMaxValueToInput(){var e;(e=this.onSetMaxValue)==null||e.call(this,this.target,this.balance)}templateTokenSelectButton(){return this.token?M` ${this.tokenBalanceTemplate()} `:M` Select token `}tokenBalanceTemplate(){const e=Dt.multiply(this.balance,this.price),r=e?e==null?void 0:e.gt(exe):!1;return M` ${r?M` ${nt.formatNumberToLocalString(this.balance,2)} `:null} ${this.target==="sourceToken"?this.tokenActionButtonTemplate(r):null} `}tokenActionButtonTemplate(e){return e?M` `:M` `}onFocusChange(e){this.focused=e}onSelectToken(){Re.sendEvent({type:"track",event:"CLICK_SELECT_TOKEN_TO_SWAP"}),X.push("SwapSelectToken",{target:this.target})}onBuyToken(){X.push("OnRampProviders")}};Ss.styles=[XAe];na([q()],Ss.prototype,"focused",void 0);na([q()],Ss.prototype,"balance",void 0);na([q()],Ss.prototype,"value",void 0);na([q()],Ss.prototype,"price",void 0);na([q()],Ss.prototype,"marketValue",void 0);na([q()],Ss.prototype,"disabled",void 0);na([q()],Ss.prototype,"target",void 0);na([q()],Ss.prototype,"token",void 0);na([q()],Ss.prototype,"onSetAmount",void 0);na([q()],Ss.prototype,"onSetMaxValue",void 0);Ss=na([te("w3m-swap-input")],Ss);const txe=de` :host > wui-flex:first-child { overflow-y: auto; overflow-x: hidden; scrollbar-width: none; } :host > wui-flex:first-child::-webkit-scrollbar { display: none; } wui-loading-hexagon { position: absolute; } .action-button { width: 100%; border-radius: var(--wui-border-radius-xs); } .action-button:disabled { border-color: 1px solid var(--wui-color-gray-glass-005); } .swap-inputs-container { position: relative; } .replace-tokens-button-container { display: flex; justify-content: center; align-items: center; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); gap: var(--wui-spacing-1xs); border-radius: var(--wui-border-radius-xs); background-color: var(--wui-color-modal-bg-base); padding: var(--wui-spacing-xxs); } .replace-tokens-button-container > button { display: flex; justify-content: center; align-items: center; height: 40px; width: 40px; padding: var(--wui-spacing-xs); border: none; border-radius: var(--wui-border-radius-xxs); background: var(--wui-color-gray-glass-002); transition: background-color var(--wui-duration-md) var(--wui-ease-out-power-1); will-change: background-color; z-index: 20; } .replace-tokens-button-container > button:hover { background: var(--wui-color-gray-glass-005); } .details-container > wui-flex { background: var(--wui-color-gray-glass-002); border-radius: var(--wui-border-radius-xxs); width: 100%; } .details-container > wui-flex > button { border: none; background: none; padding: var(--wui-spacing-s); border-radius: var(--wui-border-radius-xxs); transition: background 0.2s linear; } .details-container > wui-flex > button:hover { background: var(--wui-color-gray-glass-002); } .details-content-container { padding: var(--wui-spacing-1xs); display: flex; align-items: center; justify-content: center; } .details-content-container > wui-flex { width: 100%; } .details-row { width: 100%; padding: var(--wui-spacing-s) var(--wui-spacing-xl); border-radius: var(--wui-border-radius-xxs); background: var(--wui-color-gray-glass-002); } `;var On=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let tn=class extends se{constructor(){var e,r;super(),this.unsubscribe=[],this.initialParams=(e=X.state.data)==null?void 0:e.swap,this.detailsOpen=!1,this.caipAddress=re.state.caipAddress,this.caipNetworkId=(r=F.state.activeCaipNetwork)==null?void 0:r.caipNetworkId,this.initialized=ye.state.initialized,this.loadingQuote=ye.state.loadingQuote,this.loadingPrices=ye.state.loadingPrices,this.loadingTransaction=ye.state.loadingTransaction,this.sourceToken=ye.state.sourceToken,this.sourceTokenAmount=ye.state.sourceTokenAmount,this.sourceTokenPriceInUSD=ye.state.sourceTokenPriceInUSD,this.toToken=ye.state.toToken,this.toTokenAmount=ye.state.toTokenAmount,this.toTokenPriceInUSD=ye.state.toTokenPriceInUSD,this.inputError=ye.state.inputError,this.fetchError=ye.state.fetchError,this.onDebouncedGetSwapCalldata=ue.debounce(async()=>{await ye.swapTokens()},200),F.subscribeKey("activeCaipNetwork",n=>this.onCaipNetworkChange({newCaipNetwork:n,resetSwapState:!0,initializeSwapState:!1})),re.subscribeKey("caipAddress",n=>this.onCaipAddressChange({newCaipAddress:n,resetSwapState:!0,initializeSwapState:!1})),this.unsubscribe.push(F.subscribeKey("activeCaipNetwork",n=>this.onCaipNetworkChange({newCaipNetwork:n,resetSwapState:!1,initializeSwapState:!0})),re.subscribeKey("caipAddress",n=>this.onCaipAddressChange({newCaipAddress:n,resetSwapState:!1,initializeSwapState:!0})),We.subscribeKey("open",n=>{n||ye.resetState()}),X.subscribeKey("view",n=>{n.includes("Swap")||ye.resetValues()}),ye.subscribe(n=>{this.initialized=n.initialized,this.loadingQuote=n.loadingQuote,this.loadingPrices=n.loadingPrices,this.loadingTransaction=n.loadingTransaction,this.sourceToken=n.sourceToken,this.sourceTokenAmount=n.sourceTokenAmount,this.sourceTokenPriceInUSD=n.sourceTokenPriceInUSD,this.toToken=n.toToken,this.toTokenAmount=n.toTokenAmount,this.toTokenPriceInUSD=n.toTokenPriceInUSD,this.inputError=n.inputError,this.fetchError=n.fetchError}))}async firstUpdated(){ye.initializeState(),this.watchTokensAndValues(),await this.handleSwapParameters()}disconnectedCallback(){this.unsubscribe.forEach(e=>e==null?void 0:e()),clearInterval(this.interval)}render(){return M` ${this.initialized?this.templateSwap():this.templateLoading()} `}watchTokensAndValues(){this.interval=setInterval(()=>{ye.getNetworkTokenPrice(),ye.getMyTokensWithBalance(),ye.swapTokens()},1e4)}templateSwap(){return M` ${this.templateTokenInput("sourceToken",this.sourceToken)} ${this.templateTokenInput("toToken",this.toToken)} ${this.templateReplaceTokensButton()} ${this.templateDetails()} ${this.templateActionButton()} `}actionButtonLabel(){return this.fetchError?"Swap":!this.sourceToken||!this.toToken?"Select token":this.sourceTokenAmount?this.inputError?this.inputError:"Review swap":"Enter amount"}templateReplaceTokensButton(){return M` `}templateLoading(){return M` ${this.templateReplaceTokensButton()} ${this.templateActionButton()} `}templateTokenInput(e,r){var a,c;const n=(a=ye.state.myTokensWithBalance)==null?void 0:a.find(u=>(u==null?void 0:u.address)===(r==null?void 0:r.address)),i=e==="toToken"?this.toTokenAmount:this.sourceTokenAmount,s=e==="toToken"?this.toTokenPriceInUSD:this.sourceTokenPriceInUSD,o=Dt.parseLocalStringToNumber(i)*s;return M``}onSetMaxValue(e,r){const n=Dt.bigNumber(r||"0");this.handleChangeAmount(e,n.gt(0)?n.toFixed(20):"0")}templateDetails(){return!this.sourceToken||!this.toToken||this.inputError?null:M``}handleChangeAmount(e,r){ye.clearError(),e==="sourceToken"?ye.setSourceTokenAmount(r):ye.setToTokenAmount(r),this.onDebouncedGetSwapCalldata()}templateActionButton(){const e=!this.toToken||!this.sourceToken,r=!this.sourceTokenAmount,n=this.loadingQuote||this.loadingPrices||this.loadingTransaction,i=n||e||r||this.inputError;return M` ${this.actionButtonLabel()} `}onSwitchTokens(){ye.switchTokens()}async onSwapPreview(){var r,n,i;const e=F.state.activeChain;this.fetchError&&await ye.swapTokens(),Re.sendEvent({type:"track",event:"INITIATE_SWAP",properties:{network:this.caipNetworkId||"",swapFromToken:((r=this.sourceToken)==null?void 0:r.symbol)||"",swapToToken:((n=this.toToken)==null?void 0:n.symbol)||"",swapFromAmount:this.sourceTokenAmount||"",swapToAmount:this.toTokenAmount||"",isSmartAccount:((i=re.state.preferredAccountTypes)==null?void 0:i[e])===bt.ACCOUNT_TYPES.SMART_ACCOUNT}}),X.push("SwapPreview")}async handleSwapParameters(){this.initialParams&&(ye.state.initialized||await new Promise(r=>{const n=ye.subscribeKey("initialized",i=>{i&&(n==null||n(),r())})}),await this.setSwapParameters(this.initialParams))}async setSwapParameters({amount:e,fromToken:r,toToken:n}){(!ye.state.tokens||!ye.state.myTokensWithBalance)&&await new Promise(o=>{const a=ye.subscribeKey("myTokensWithBalance",c=>{c&&c.length>0&&(a==null||a(),o())});setTimeout(()=>{a==null||a(),o()},5e3)});const i=[...ye.state.tokens||[],...ye.state.myTokensWithBalance||[]];if(r){const s=i.find(o=>o.symbol.toLowerCase()===r.toLowerCase());s&&ye.setSourceToken(s)}if(n){const s=i.find(o=>o.symbol.toLowerCase()===n.toLowerCase());s&&ye.setToToken(s)}e&&!isNaN(Number(e))&&ye.setSourceTokenAmount(e)}onCaipAddressChange({newCaipAddress:e,resetSwapState:r,initializeSwapState:n}){this.caipAddress!==e&&(this.caipAddress=e,r&&ye.resetState(),n&&ye.initializeState())}onCaipNetworkChange({newCaipNetwork:e,resetSwapState:r,initializeSwapState:n}){this.caipNetworkId!==(e==null?void 0:e.caipNetworkId)&&(this.caipNetworkId=e==null?void 0:e.caipNetworkId,r&&ye.resetState(),n&&ye.initializeState())}};tn.styles=txe;On([q({type:Object})],tn.prototype,"initialParams",void 0);On([G()],tn.prototype,"interval",void 0);On([G()],tn.prototype,"detailsOpen",void 0);On([G()],tn.prototype,"caipAddress",void 0);On([G()],tn.prototype,"caipNetworkId",void 0);On([G()],tn.prototype,"initialized",void 0);On([G()],tn.prototype,"loadingQuote",void 0);On([G()],tn.prototype,"loadingPrices",void 0);On([G()],tn.prototype,"loadingTransaction",void 0);On([G()],tn.prototype,"sourceToken",void 0);On([G()],tn.prototype,"sourceTokenAmount",void 0);On([G()],tn.prototype,"sourceTokenPriceInUSD",void 0);On([G()],tn.prototype,"toToken",void 0);On([G()],tn.prototype,"toTokenAmount",void 0);On([G()],tn.prototype,"toTokenPriceInUSD",void 0);On([G()],tn.prototype,"inputError",void 0);On([G()],tn.prototype,"fetchError",void 0);tn=On([te("w3m-swap-view")],tn);const rxe=de` :host > wui-flex:first-child { overflow-y: auto; overflow-x: hidden; scrollbar-width: none; } :host > wui-flex:first-child::-webkit-scrollbar { display: none; } .preview-container, .details-container { width: 100%; } .token-image { width: 24px; height: 24px; box-shadow: 0 0 0 2px var(--wui-color-gray-glass-005); border-radius: 12px; } wui-loading-hexagon { position: absolute; } .token-item { display: flex; align-items: center; justify-content: center; gap: var(--wui-spacing-xxs); padding: var(--wui-spacing-xs); height: 40px; border: none; border-radius: 80px; background: var(--wui-color-gray-glass-002); box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-002); cursor: pointer; transition: background 0.2s linear; } .token-item:hover { background: var(--wui-color-gray-glass-005); } .preview-token-details-container { width: 100%; } .details-row { width: 100%; padding: var(--wui-spacing-s) var(--wui-spacing-xl); border-radius: var(--wui-border-radius-xxs); background: var(--wui-color-gray-glass-002); } .action-buttons-container { width: 100%; gap: var(--wui-spacing-xs); } .action-buttons-container > button { display: flex; align-items: center; justify-content: center; background: transparent; height: 48px; border-radius: var(--wui-border-radius-xs); border: none; box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-010); } .action-buttons-container > button:disabled { opacity: 0.8; cursor: not-allowed; } .action-button > wui-loading-spinner { display: inline-block; } .cancel-button:hover, .action-button:hover { cursor: pointer; } .action-buttons-container > wui-button.cancel-button { flex: 2; } .action-buttons-container > wui-button.action-button { flex: 4; } .action-buttons-container > button.action-button > wui-text { color: white; } .details-container > wui-flex { background: var(--wui-color-gray-glass-002); border-radius: var(--wui-border-radius-xxs); width: 100%; } .details-container > wui-flex > button { border: none; background: none; padding: var(--wui-spacing-s); border-radius: var(--wui-border-radius-xxs); transition: background 0.2s linear; } .details-container > wui-flex > button:hover { background: var(--wui-color-gray-glass-002); } .details-content-container { padding: var(--wui-spacing-1xs); display: flex; align-items: center; justify-content: center; } .details-content-container > wui-flex { width: 100%; } .details-row { width: 100%; padding: var(--wui-spacing-s) var(--wui-spacing-xl); border-radius: var(--wui-border-radius-xxs); background: var(--wui-color-gray-glass-002); } `;var Rn=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let rn=class extends se{constructor(){super(),this.unsubscribe=[],this.detailsOpen=!0,this.approvalTransaction=ye.state.approvalTransaction,this.swapTransaction=ye.state.swapTransaction,this.sourceToken=ye.state.sourceToken,this.sourceTokenAmount=ye.state.sourceTokenAmount??"",this.sourceTokenPriceInUSD=ye.state.sourceTokenPriceInUSD,this.toToken=ye.state.toToken,this.toTokenAmount=ye.state.toTokenAmount??"",this.toTokenPriceInUSD=ye.state.toTokenPriceInUSD,this.caipNetwork=F.state.activeCaipNetwork,this.balanceSymbol=re.state.balanceSymbol,this.inputError=ye.state.inputError,this.loadingQuote=ye.state.loadingQuote,this.loadingApprovalTransaction=ye.state.loadingApprovalTransaction,this.loadingBuildTransaction=ye.state.loadingBuildTransaction,this.loadingTransaction=ye.state.loadingTransaction,this.unsubscribe.push(re.subscribeKey("balanceSymbol",e=>{this.balanceSymbol!==e&&X.goBack()}),F.subscribeKey("activeCaipNetwork",e=>{this.caipNetwork!==e&&(this.caipNetwork=e)}),ye.subscribe(e=>{this.approvalTransaction=e.approvalTransaction,this.swapTransaction=e.swapTransaction,this.sourceToken=e.sourceToken,this.toToken=e.toToken,this.toTokenPriceInUSD=e.toTokenPriceInUSD,this.sourceTokenAmount=e.sourceTokenAmount??"",this.toTokenAmount=e.toTokenAmount??"",this.inputError=e.inputError,e.inputError&&X.goBack(),this.loadingQuote=e.loadingQuote,this.loadingApprovalTransaction=e.loadingApprovalTransaction,this.loadingBuildTransaction=e.loadingBuildTransaction,this.loadingTransaction=e.loadingTransaction}))}firstUpdated(){ye.getTransaction(),this.refreshTransaction()}disconnectedCallback(){this.unsubscribe.forEach(e=>e==null?void 0:e()),clearInterval(this.interval)}render(){return M` ${this.templateSwap()} `}refreshTransaction(){this.interval=setInterval(()=>{ye.getApprovalLoadingState()||ye.getTransaction()},1e4)}templateSwap(){var c,u,l,d;const e=`${nt.formatNumberToLocalString(parseFloat(this.sourceTokenAmount))} ${(c=this.sourceToken)==null?void 0:c.symbol}`,r=`${nt.formatNumberToLocalString(parseFloat(this.toTokenAmount))} ${(u=this.toToken)==null?void 0:u.symbol}`,n=parseFloat(this.sourceTokenAmount)*this.sourceTokenPriceInUSD,i=parseFloat(this.toTokenAmount)*this.toTokenPriceInUSD,s=nt.formatNumberToLocalString(n),o=nt.formatNumberToLocalString(i),a=this.loadingQuote||this.loadingBuildTransaction||this.loadingTransaction||this.loadingApprovalTransaction;return M` Send $${s} Receive $${o} ${this.templateDetails()} Review transaction carefully Cancel ${this.actionButtonLabel()} `}templateDetails(){return!this.sourceToken||!this.toToken||this.inputError?null:M``}actionButtonLabel(){return this.loadingApprovalTransaction?"Approving...":this.approvalTransaction?"Approve":"Swap"}onCancelTransaction(){X.goBack()}onSendTransaction(){this.approvalTransaction?ye.sendTransactionForApproval(this.approvalTransaction):ye.sendTransactionForSwap(this.swapTransaction)}};rn.styles=rxe;Rn([G()],rn.prototype,"interval",void 0);Rn([G()],rn.prototype,"detailsOpen",void 0);Rn([G()],rn.prototype,"approvalTransaction",void 0);Rn([G()],rn.prototype,"swapTransaction",void 0);Rn([G()],rn.prototype,"sourceToken",void 0);Rn([G()],rn.prototype,"sourceTokenAmount",void 0);Rn([G()],rn.prototype,"sourceTokenPriceInUSD",void 0);Rn([G()],rn.prototype,"toToken",void 0);Rn([G()],rn.prototype,"toTokenAmount",void 0);Rn([G()],rn.prototype,"toTokenPriceInUSD",void 0);Rn([G()],rn.prototype,"caipNetwork",void 0);Rn([G()],rn.prototype,"balanceSymbol",void 0);Rn([G()],rn.prototype,"inputError",void 0);Rn([G()],rn.prototype,"loadingQuote",void 0);Rn([G()],rn.prototype,"loadingApprovalTransaction",void 0);Rn([G()],rn.prototype,"loadingBuildTransaction",void 0);Rn([G()],rn.prototype,"loadingTransaction",void 0);rn=Rn([te("w3m-swap-preview-view")],rn);const nxe=de` :host { height: 60px; min-height: 60px; } :host > wui-flex { cursor: pointer; height: 100%; display: flex; column-gap: var(--wui-spacing-s); padding: var(--wui-spacing-xs); padding-right: var(--wui-spacing-l); width: 100%; background-color: transparent; border-radius: var(--wui-border-radius-xs); color: var(--wui-color-fg-250); transition: background-color var(--wui-ease-out-power-1) var(--wui-duration-lg), opacity var(--wui-ease-out-power-1) var(--wui-duration-lg); will-change: background-color, opacity; } @media (hover: hover) and (pointer: fine) { :host > wui-flex:hover { background-color: var(--wui-color-gray-glass-002); } :host > wui-flex:active { background-color: var(--wui-color-gray-glass-005); } } :host([disabled]) > wui-flex { opacity: 0.6; } :host([disabled]) > wui-flex:hover { background-color: transparent; } :host > wui-flex > wui-flex { flex: 1; } :host > wui-flex > wui-image, :host > wui-flex > .token-item-image-placeholder { width: 40px; max-width: 40px; height: 40px; border-radius: var(--wui-border-radius-3xl); position: relative; } :host > wui-flex > .token-item-image-placeholder { display: flex; align-items: center; justify-content: center; } :host > wui-flex > wui-image::after, :host > wui-flex > .token-item-image-placeholder::after { position: absolute; content: ''; inset: 0; box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-010); border-radius: var(--wui-border-radius-l); } button > wui-icon-box[data-variant='square-blue'] { border-radius: var(--wui-border-radius-3xs); position: relative; border: none; width: 36px; height: 36px; } `;var Md=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let rc=class extends se{constructor(){super(),this.observer=new IntersectionObserver(()=>{}),this.imageSrc=void 0,this.name=void 0,this.symbol=void 0,this.price=void 0,this.amount=void 0,this.visible=!1,this.imageError=!1,this.observer=new IntersectionObserver(e=>{e.forEach(r=>{r.isIntersecting?this.visible=!0:this.visible=!1})},{threshold:.1})}firstUpdated(){this.observer.observe(this)}disconnectedCallback(){this.observer.disconnect()}render(){var r;if(!this.visible)return null;const e=this.amount&&this.price?(r=Dt.multiply(this.price,this.amount))==null?void 0:r.toFixed(3):null;return M` ${this.visualTemplate()} ${this.name} ${e?M` $${nt.formatNumberToLocalString(e,3)} `:null} ${this.symbol} ${this.amount?M` ${nt.formatNumberToLocalString(this.amount,4)} `:null} `}visualTemplate(){return this.imageError?M` `:this.imageSrc?M``:null}imageLoadError(){this.imageError=!0}};rc.styles=[He,vt,nxe];Md([q()],rc.prototype,"imageSrc",void 0);Md([q()],rc.prototype,"name",void 0);Md([q()],rc.prototype,"symbol",void 0);Md([q()],rc.prototype,"price",void 0);Md([q()],rc.prototype,"amount",void 0);Md([G()],rc.prototype,"visible",void 0);Md([G()],rc.prototype,"imageError",void 0);rc=Md([te("wui-token-list-item")],rc);const ixe=de` :host { --tokens-scroll--top-opacity: 0; --tokens-scroll--bottom-opacity: 1; --suggested-tokens-scroll--left-opacity: 0; --suggested-tokens-scroll--right-opacity: 1; } :host > wui-flex:first-child { overflow-y: hidden; overflow-x: hidden; scrollbar-width: none; scrollbar-height: none; } :host > wui-flex:first-child::-webkit-scrollbar { display: none; } wui-loading-hexagon { position: absolute; } .suggested-tokens-container { overflow-x: auto; mask-image: linear-gradient( to right, rgba(0, 0, 0, calc(1 - var(--suggested-tokens-scroll--left-opacity))) 0px, rgba(200, 200, 200, calc(1 - var(--suggested-tokens-scroll--left-opacity))) 1px, black 50px, black 90px, black calc(100% - 90px), black calc(100% - 50px), rgba(155, 155, 155, calc(1 - var(--suggested-tokens-scroll--right-opacity))) calc(100% - 1px), rgba(0, 0, 0, calc(1 - var(--suggested-tokens-scroll--right-opacity))) 100% ); } .suggested-tokens-container::-webkit-scrollbar { display: none; } .tokens-container { border-top: 1px solid var(--wui-color-gray-glass-005); height: 100%; max-height: 390px; } .tokens { width: 100%; overflow-y: auto; mask-image: linear-gradient( to bottom, rgba(0, 0, 0, calc(1 - var(--tokens-scroll--top-opacity))) 0px, rgba(200, 200, 200, calc(1 - var(--tokens-scroll--top-opacity))) 1px, black 50px, black 90px, black calc(100% - 90px), black calc(100% - 50px), rgba(155, 155, 155, calc(1 - var(--tokens-scroll--bottom-opacity))) calc(100% - 1px), rgba(0, 0, 0, calc(1 - var(--tokens-scroll--bottom-opacity))) 100% ); } .network-search-input, .select-network-button { height: 40px; } .select-network-button { border: none; display: flex; flex-direction: row; align-items: center; justify-content: center; gap: var(--wui-spacing-xs); box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-005); background-color: transparent; border-radius: var(--wui-border-radius-xxs); padding: var(--wui-spacing-xs); align-items: center; transition: background-color 0.2s linear; } .select-network-button:hover { background-color: var(--wui-color-gray-glass-002); } .select-network-button > wui-image { width: 26px; height: 26px; border-radius: var(--wui-border-radius-xs); box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-010); } `;var Ju=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let so=class extends se{constructor(){var e;super(),this.unsubscribe=[],this.targetToken=(e=X.state.data)==null?void 0:e.target,this.sourceToken=ye.state.sourceToken,this.sourceTokenAmount=ye.state.sourceTokenAmount,this.toToken=ye.state.toToken,this.myTokensWithBalance=ye.state.myTokensWithBalance,this.popularTokens=ye.state.popularTokens,this.searchValue="",this.unsubscribe.push(ye.subscribe(r=>{this.sourceToken=r.sourceToken,this.toToken=r.toToken,this.myTokensWithBalance=r.myTokensWithBalance}))}updated(){var n,i;const e=(n=this.renderRoot)==null?void 0:n.querySelector(".suggested-tokens-container");e==null||e.addEventListener("scroll",this.handleSuggestedTokensScroll.bind(this));const r=(i=this.renderRoot)==null?void 0:i.querySelector(".tokens");r==null||r.addEventListener("scroll",this.handleTokenListScroll.bind(this))}disconnectedCallback(){var n,i;super.disconnectedCallback();const e=(n=this.renderRoot)==null?void 0:n.querySelector(".suggested-tokens-container"),r=(i=this.renderRoot)==null?void 0:i.querySelector(".tokens");e==null||e.removeEventListener("scroll",this.handleSuggestedTokensScroll.bind(this)),r==null||r.removeEventListener("scroll",this.handleTokenListScroll.bind(this)),clearInterval(this.interval)}render(){return M` ${this.templateSearchInput()} ${this.templateSuggestedTokens()} ${this.templateTokens()} `}onSelectToken(e){this.targetToken==="sourceToken"?ye.setSourceToken(e):(ye.setToToken(e),this.sourceToken&&this.sourceTokenAmount&&ye.swapTokens()),X.goBack()}templateSearchInput(){return M` `}templateTokens(){const e=this.myTokensWithBalance?Object.values(this.myTokensWithBalance):[],r=this.popularTokens?this.popularTokens:[],n=this.filterTokensWithText(e,this.searchValue),i=this.filterTokensWithText(r,this.searchValue);return M` ${(n==null?void 0:n.length)>0?M` Your tokens ${n.map(s=>{var a,c,u;const o=s.symbol===((a=this.sourceToken)==null?void 0:a.symbol)||s.symbol===((c=this.toToken)==null?void 0:c.symbol);return M` {o||this.onSelectToken(s)}} > `})} `:null} Tokens ${(i==null?void 0:i.length)>0?i.map(s=>M` this.onSelectToken(s)} > `):null} `}templateSuggestedTokens(){const e=ye.state.suggestedTokens?ye.state.suggestedTokens.slice(0,8):null;return e?M` ${e.map(r=>M` this.onSelectToken(r)} > `)} `:null}onSearchInputChange(e){this.searchValue=e.detail}handleSuggestedTokensScroll(){var r;const e=(r=this.renderRoot)==null?void 0:r.querySelector(".suggested-tokens-container");e&&(e.style.setProperty("--suggested-tokens-scroll--left-opacity",K0.interpolate([0,100],[0,1],e.scrollLeft).toString()),e.style.setProperty("--suggested-tokens-scroll--right-opacity",K0.interpolate([0,100],[0,1],e.scrollWidth-e.scrollLeft-e.offsetWidth).toString()))}handleTokenListScroll(){var r;const e=(r=this.renderRoot)==null?void 0:r.querySelector(".tokens");e&&(e.style.setProperty("--tokens-scroll--top-opacity",K0.interpolate([0,100],[0,1],e.scrollTop).toString()),e.style.setProperty("--tokens-scroll--bottom-opacity",K0.interpolate([0,100],[0,1],e.scrollHeight-e.scrollTop-e.offsetHeight).toString()))}filterTokensWithText(e,r){return e.filter(n=>`${n.symbol} ${n.name} ${n.address}`.toLowerCase().includes(r.toLowerCase()))}};so.styles=ixe;Ju([G()],so.prototype,"interval",void 0);Ju([G()],so.prototype,"targetToken",void 0);Ju([G()],so.prototype,"sourceToken",void 0);Ju([G()],so.prototype,"sourceTokenAmount",void 0);Ju([G()],so.prototype,"toToken",void 0);Ju([G()],so.prototype,"myTokensWithBalance",void 0);Ju([G()],so.prototype,"popularTokens",void 0);Ju([G()],so.prototype,"searchValue",void 0);so=Ju([te("w3m-swap-select-token-view")],so);const sxe=Object.freeze(Object.defineProperty({__proto__:null,get W3mSwapPreviewView(){return rn},get W3mSwapSelectTokenView(){return so},get W3mSwapView(){return tn}},Symbol.toStringTag,{value:"Module"})),oxe=de` :host { width: 100%; height: 100px; border-radius: var(--wui-border-radius-s); border: 1px solid var(--wui-color-gray-glass-002); background-color: var(--wui-color-gray-glass-002); transition: background-color var(--wui-ease-out-power-1) var(--wui-duration-lg); will-change: background-color; position: relative; } :host(:hover) { background-color: var(--wui-color-gray-glass-005); } wui-flex { width: 100%; height: fit-content; } wui-button { display: ruby; color: var(--wui-color-fg-100); margin: 0 var(--wui-spacing-xs); } .instruction { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; } .paste { display: inline-flex; } textarea { background: transparent; width: 100%; font-family: var(--w3m-font-family); font-size: var(--wui-font-size-medium); font-style: normal; font-weight: var(--wui-font-weight-light); line-height: 130%; letter-spacing: var(--wui-letter-spacing-medium); color: var(--wui-color-fg-100); caret-color: var(--wui-color-accent-100); box-sizing: border-box; -webkit-appearance: none; -moz-appearance: textfield; padding: 0px; border: none; outline: none; appearance: none; resize: none; overflow: hidden; } `;var PA=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let $m=class extends se{constructor(){super(...arguments),this.inputElementRef=ec(),this.instructionElementRef=ec(),this.instructionHidden=!!this.value,this.pasting=!1,this.onDebouncedSearch=ue.debounce(async e=>{if(!e.length){this.setReceiverAddress("");return}const r=F.state.activeChain;if(ue.isAddress(e,r)){this.setReceiverAddress(e);return}try{const i=await xe.getEnsAddress(e);if(i){Qe.setReceiverProfileName(e),Qe.setReceiverAddress(i);const s=await xe.getEnsAvatar(e);Qe.setReceiverProfileImageUrl(s||void 0)}}catch{this.setReceiverAddress(e)}finally{Qe.setLoading(!1)}})}firstUpdated(){this.value&&(this.instructionHidden=!0),this.checkHidden()}render(){return M` Type or Paste address `}async focusInput(){var e;this.instructionElementRef.value&&(this.instructionHidden=!0,await this.toggleInstructionFocus(!1),this.instructionElementRef.value.style.pointerEvents="none",(e=this.inputElementRef.value)==null||e.focus(),this.inputElementRef.value&&(this.inputElementRef.value.selectionStart=this.inputElementRef.value.selectionEnd=this.inputElementRef.value.value.length))}async focusInstruction(){var e;this.instructionElementRef.value&&(this.instructionHidden=!1,await this.toggleInstructionFocus(!0),this.instructionElementRef.value.style.pointerEvents="auto",(e=this.inputElementRef.value)==null||e.blur())}async toggleInstructionFocus(e){this.instructionElementRef.value&&await this.instructionElementRef.value.animate([{opacity:e?0:1},{opacity:e?1:0}],{duration:100,easing:"ease",fill:"forwards"}).finished}onBoxClick(){!this.value&&!this.instructionHidden&&this.focusInput()}onBlur(){!this.value&&this.instructionHidden&&!this.pasting&&this.focusInstruction()}checkHidden(){this.instructionHidden&&this.focusInput()}async onPasteClick(){this.pasting=!0;const e=await navigator.clipboard.readText();Qe.setReceiverAddress(e),this.focusInput()}onInputChange(e){var n;const r=e.target;this.pasting=!1,this.value=(n=e.target)==null?void 0:n.value,r.value&&!this.instructionHidden&&this.focusInput(),Qe.setLoading(!0),this.onDebouncedSearch(r.value)}setReceiverAddress(e){Qe.setReceiverAddress(e),Qe.setReceiverProfileName(void 0),Qe.setReceiverProfileImageUrl(void 0),Qe.setLoading(!1)}};$m.styles=oxe;PA([q()],$m.prototype,"value",void 0);PA([G()],$m.prototype,"instructionHidden",void 0);PA([G()],$m.prototype,"pasting",void 0);$m=PA([te("w3m-input-address")],$m);const axe=de` :host { position: relative; display: inline-block; } input { background: transparent; width: 100%; height: auto; font-family: var(--wui-font-family); color: var(--wui-color-fg-100); font-feature-settings: 'case' on; font-size: 32px; font-weight: var(--wui-font-weight-light); caret-color: var(--wui-color-accent-100); line-height: 130%; letter-spacing: -1.28px; box-sizing: border-box; -webkit-appearance: none; -moz-appearance: textfield; padding: 0px; } input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; } input::placeholder { color: var(--wui-color-fg-275); } `;var OA=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let jm=class extends se{constructor(){super(...arguments),this.inputElementRef=ec(),this.disabled=!1,this.value="",this.placeholder="0"}render(){var e;return(e=this.inputElementRef)!=null&&e.value&&this.value&&(this.inputElementRef.value.value=this.value),M` `}dispatchInputChangeEvent(e){var n,i;const r=e.data;if(r&&((n=this.inputElementRef)!=null&&n.value))if(r===","){const s=this.inputElementRef.value.value.replace(",",".");this.inputElementRef.value.value=s,this.value=`${this.value}${s}`}else iAe.test(r)||(this.inputElementRef.value.value=this.value.replace(new RegExp(r.replace(nAe,"\\$&"),"gu"),""));this.dispatchEvent(new CustomEvent("inputChange",{detail:(i=this.inputElementRef.value)==null?void 0:i.value,bubbles:!0,composed:!0}))}};jm.styles=[He,vt,axe];OA([q({type:Boolean})],jm.prototype,"disabled",void 0);OA([q({type:String})],jm.prototype,"value",void 0);OA([q({type:String})],jm.prototype,"placeholder",void 0);jm=OA([te("wui-input-amount")],jm);const cxe=de` :host { width: 100%; height: 100px; border-radius: var(--wui-border-radius-s); border: 1px solid var(--wui-color-gray-glass-002); background-color: var(--wui-color-gray-glass-002); transition: background-color var(--wui-ease-out-power-1) var(--wui-duration-lg); will-change: background-color; } :host(:hover) { background-color: var(--wui-color-gray-glass-005); } wui-flex { width: 100%; height: fit-content; } wui-button { width: 100%; display: flex; justify-content: flex-end; } wui-input-amount { mask-image: linear-gradient( 270deg, transparent 0px, transparent 8px, black 24px, black 25px, black 32px, black 100% ); } .totalValue { width: 100%; } `;var H7=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let My=class extends se{render(){return M` ${this.buttonTemplate()} ${this.sendValueTemplate()} ${this.maxAmountTemplate()} ${this.actionTemplate()} `}buttonTemplate(){return this.token?M` `:M`Select token`}handleSelectButtonClick(){X.push("WalletSendSelectToken")}sendValueTemplate(){if(this.token&&this.sendTokenAmount){const r=this.token.price*this.sendTokenAmount;return M`${r?`$${nt.formatNumberToLocalString(r,2)}`:"Incorrect value"}`}return null}maxAmountTemplate(){return this.token?this.sendTokenAmount&&this.sendTokenAmount>Number(this.token.quantity.numeric)?M` ${nt.roundNumber(Number(this.token.quantity.numeric),6,5)} `:M` ${nt.roundNumber(Number(this.token.quantity.numeric),6,5)} `:null}actionTemplate(){return this.token?this.sendTokenAmount&&this.sendTokenAmount>Number(this.token.quantity.numeric)?M`Buy`:M`Max`:null}onInputChange(e){Qe.setTokenAmount(e.detail)}onMaxClick(){if(this.token){const e=Dt.bigNumber(this.token.quantity.numeric);Qe.setTokenAmount(Number(e.toFixed(20)))}}onBuyClick(){X.push("OnRampProviders")}};My.styles=cxe;H7([q({type:Object})],My.prototype,"token",void 0);H7([q({type:Number})],My.prototype,"sendTokenAmount",void 0);My=H7([te("w3m-input-token")],My);const uxe=de` :host { display: block; } wui-flex { position: relative; } wui-icon-box { width: 40px; height: 40px; border-radius: var(--wui-border-radius-xs) !important; border: 5px solid var(--wui-color-bg-125); background: var(--wui-color-bg-175); position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 3; } wui-button { --local-border-radius: var(--wui-border-radius-xs) !important; } .inputContainer { height: fit-content; } `;var Tp=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let nc=class extends se{constructor(){super(),this.unsubscribe=[],this.token=Qe.state.token,this.sendTokenAmount=Qe.state.sendTokenAmount,this.receiverAddress=Qe.state.receiverAddress,this.receiverProfileName=Qe.state.receiverProfileName,this.loading=Qe.state.loading,this.message="Preview Send",this.fetchNetworkPrice(),this.fetchBalances(),this.unsubscribe.push(Qe.subscribe(e=>{this.token=e.token,this.sendTokenAmount=e.sendTokenAmount,this.receiverAddress=e.receiverAddress,this.receiverProfileName=e.receiverProfileName,this.loading=e.loading}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return this.getMessage(),M` ${this.message} `}async fetchBalances(){await Qe.fetchTokenBalance(),Qe.fetchNetworkBalance()}async fetchNetworkPrice(){await ye.getNetworkTokenPrice()}onButtonClick(){X.push("WalletSendPreview")}getMessage(){var e;this.message="Preview Send",this.receiverAddress&&!ue.isAddress(this.receiverAddress,F.state.activeChain)&&(this.message="Invalid Address"),this.receiverAddress||(this.message="Add Address"),this.sendTokenAmount&&this.token&&this.sendTokenAmount>Number(this.token.quantity.numeric)&&(this.message="Insufficient Funds"),this.sendTokenAmount||(this.message="Add Amount"),this.sendTokenAmount&&((e=this.token)!=null&&e.price)&&(this.sendTokenAmount*this.token.price||(this.message="Incorrect Value")),this.token||(this.message="Select Token")}};nc.styles=uxe;Tp([G()],nc.prototype,"token",void 0);Tp([G()],nc.prototype,"sendTokenAmount",void 0);Tp([G()],nc.prototype,"receiverAddress",void 0);Tp([G()],nc.prototype,"receiverProfileName",void 0);Tp([G()],nc.prototype,"loading",void 0);Tp([G()],nc.prototype,"message",void 0);nc=Tp([te("w3m-wallet-send-view")],nc);const lxe=de` button { padding: 6.5px var(--wui-spacing-l) 6.5px var(--wui-spacing-xs); display: flex; justify-content: space-between; width: 100%; border-radius: var(--wui-border-radius-xs); background-color: var(--wui-color-gray-glass-002); } button[data-clickable='false'] { pointer-events: none; background-color: transparent; } wui-image, wui-icon { width: var(--wui-spacing-3xl); height: var(--wui-spacing-3xl); } wui-image { border-radius: var(--wui-border-radius-3xl); } `;var Ip=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Bu=class extends se{constructor(){super(...arguments),this.tokenName="",this.tokenImageUrl="",this.tokenValue=0,this.tokenAmount="0.0",this.tokenCurrency="",this.clickable=!1}render(){return M` `}visualTemplate(){return this.tokenName&&this.tokenImageUrl?M``:M``}};Bu.styles=[He,vt,lxe];Ip([q()],Bu.prototype,"tokenName",void 0);Ip([q()],Bu.prototype,"tokenImageUrl",void 0);Ip([q({type:Number})],Bu.prototype,"tokenValue",void 0);Ip([q()],Bu.prototype,"tokenAmount",void 0);Ip([q()],Bu.prototype,"tokenCurrency",void 0);Ip([q({type:Boolean})],Bu.prototype,"clickable",void 0);Bu=Ip([te("wui-list-token")],Bu);const dxe=de` :host { position: relative; display: flex; width: 100%; height: 1px; background-color: var(--wui-color-gray-glass-005); justify-content: center; align-items: center; } :host > wui-text { position: absolute; padding: 0px 10px; background-color: var(--wui-color-modal-bg); transition: background-color var(--wui-duration-lg) var(--wui-ease-out-power-1); will-change: background-color; } `;var QJ=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let d6=class extends se{constructor(){super(...arguments),this.text=""}render(){return M`${this.template()}`}template(){return this.text?M`${this.text}`:null}};d6.styles=[He,dxe];QJ([q()],d6.prototype,"text",void 0);d6=QJ([te("wui-separator")],d6);const hxe=de` .contentContainer { height: 440px; overflow: scroll; scrollbar-width: none; } .contentContainer::-webkit-scrollbar { display: none; } wui-icon-box { width: 40px; height: 40px; border-radius: var(--wui-border-radius-xxs); } `;var i2=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Ad=class extends se{constructor(){super(),this.unsubscribe=[],this.tokenBalances=Qe.state.tokenBalances,this.search="",this.onDebouncedSearch=ue.debounce(e=>{this.search=e}),this.unsubscribe.push(Qe.subscribe(e=>{this.tokenBalances=e.tokenBalances}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return M` ${this.templateSearchInput()} ${this.templateTokens()} `}templateSearchInput(){return M` `}templateTokens(){var e,r;return this.tokens=(e=this.tokenBalances)==null?void 0:e.filter(n=>{var i;return n.chainId===((i=F.state.activeCaipNetwork)==null?void 0:i.caipNetworkId)}),this.search?this.filteredTokens=(r=this.tokenBalances)==null?void 0:r.filter(n=>n.name.toLowerCase().includes(this.search.toLowerCase())):this.filteredTokens=this.tokens,M` Your tokens ${this.filteredTokens&&this.filteredTokens.length>0?this.filteredTokens.map(n=>M``):M` No tokens found Your tokens will appear here Buy `} `}onBuyClick(){X.push("OnRampProviders")}onInputChange(e){this.onDebouncedSearch(e.detail)}handleTokenClick(e){Qe.setToken(e),Qe.setTokenAmount(void 0),X.goBack()}};Ad.styles=hxe;i2([G()],Ad.prototype,"tokenBalances",void 0);i2([G()],Ad.prototype,"tokens",void 0);i2([G()],Ad.prototype,"filteredTokens",void 0);i2([G()],Ad.prototype,"search",void 0);Ad=i2([te("w3m-wallet-send-select-token-view")],Ad);const fxe=de` :host { display: block; width: var(--local-width); height: var(--local-height); border-radius: var(--wui-border-radius-3xl); box-shadow: 0 0 0 8px var(--wui-color-gray-glass-005); overflow: hidden; position: relative; } :host([data-variant='generated']) { --mixed-local-color-1: var(--local-color-1); --mixed-local-color-2: var(--local-color-2); --mixed-local-color-3: var(--local-color-3); --mixed-local-color-4: var(--local-color-4); --mixed-local-color-5: var(--local-color-5); } @supports (background: color-mix(in srgb, white 50%, black)) { :host([data-variant='generated']) { --mixed-local-color-1: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--local-color-1) ); --mixed-local-color-2: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--local-color-2) ); --mixed-local-color-3: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--local-color-3) ); --mixed-local-color-4: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--local-color-4) ); --mixed-local-color-5: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--local-color-5) ); } } :host([data-variant='generated']) { box-shadow: 0 0 0 8px var(--wui-color-gray-glass-005); background: radial-gradient( var(--local-radial-circle), #fff 0.52%, var(--mixed-local-color-5) 31.25%, var(--mixed-local-color-3) 51.56%, var(--mixed-local-color-2) 65.63%, var(--mixed-local-color-1) 82.29%, var(--mixed-local-color-4) 100% ); } :host([data-variant='default']) { box-shadow: 0 0 0 8px var(--wui-color-gray-glass-005); background: radial-gradient( 75.29% 75.29% at 64.96% 24.36%, #fff 0.52%, #f5ccfc 31.25%, #dba4f5 51.56%, #9a8ee8 65.63%, #6493da 82.29%, #6ebdea 100% ); } `;var s2=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let ip=class extends se{constructor(){super(...arguments),this.imageSrc=void 0,this.alt=void 0,this.address=void 0,this.size="xl"}render(){return this.style.cssText=` --local-width: var(--wui-icon-box-size-${this.size}); --local-height: var(--wui-icon-box-size-${this.size}); `,M`${this.visualTemplate()}`}visualTemplate(){if(this.imageSrc)return this.dataset.variant="image",M``;if(this.address){this.dataset.variant="generated";const e=nt.generateAvatarColors(this.address);return this.style.cssText+=` ${e}`,null}return this.dataset.variant="default",null}};ip.styles=[He,fxe];s2([q()],ip.prototype,"imageSrc",void 0);s2([q()],ip.prototype,"alt",void 0);s2([q()],ip.prototype,"address",void 0);s2([q()],ip.prototype,"size",void 0);ip=s2([te("wui-avatar")],ip);const pxe=de` :host { display: flex; gap: var(--wui-spacing-xs); border-radius: var(--wui-border-radius-3xl); border: 1px solid var(--wui-color-gray-glass-002); background: var(--wui-color-gray-glass-002); padding: var(--wui-spacing-2xs) var(--wui-spacing-xs) var(--wui-spacing-2xs) var(--wui-spacing-s); align-items: center; } wui-avatar, wui-icon, wui-image { width: 32px; height: 32px; border: 1px solid var(--wui-color-gray-glass-002); border-radius: var(--wui-border-radius-3xl); box-shadow: 0 0 0 2px var(--wui-color-gray-glass-002); } `;var o2=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let sp=class extends se{constructor(){super(...arguments),this.text="",this.address="",this.isAddress=!1}render(){return M`${this.text} ${this.imageTemplate()}`}imageTemplate(){return this.isAddress?M``:this.imageSrc?M``:M``}};sp.styles=[He,vt,pxe];o2([q()],sp.prototype,"text",void 0);o2([q()],sp.prototype,"address",void 0);o2([q()],sp.prototype,"imageSrc",void 0);o2([q({type:Boolean})],sp.prototype,"isAddress",void 0);sp=o2([te("wui-preview-item")],sp);const gxe=de` :host { display: flex; column-gap: var(--wui-spacing-s); padding: 17px 18px 17px var(--wui-spacing-m); width: 100%; background-color: var(--wui-color-gray-glass-002); border-radius: var(--wui-border-radius-xs); color: var(--wui-color-fg-250); } wui-image { width: var(--wui-icon-size-lg); height: var(--wui-icon-size-lg); border-radius: var(--wui-border-radius-3xl); } wui-icon { width: var(--wui-icon-size-lg); height: var(--wui-icon-size-lg); } `;var RA=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Bm=class extends se{constructor(){super(...arguments),this.imageSrc=void 0,this.textTitle="",this.textValue=void 0}render(){return M` ${this.textTitle} ${this.templateContent()} `}templateContent(){return this.imageSrc?M``:this.textValue?M` ${this.textValue} `:M``}};Bm.styles=[He,vt,gxe];RA([q()],Bm.prototype,"imageSrc",void 0);RA([q()],Bm.prototype,"textTitle",void 0);RA([q()],Bm.prototype,"textValue",void 0);Bm=RA([te("wui-list-content")],Bm);const mxe=de` :host { display: flex; width: auto; flex-direction: column; gap: var(--wui-border-radius-1xs); border-radius: var(--wui-border-radius-s); background: var(--wui-color-gray-glass-002); padding: var(--wui-spacing-s) var(--wui-spacing-1xs) var(--wui-spacing-1xs) var(--wui-spacing-1xs); } wui-text { padding: 0 var(--wui-spacing-1xs); } wui-flex { margin-top: var(--wui-spacing-1xs); } .network { cursor: pointer; transition: background-color var(--wui-ease-out-power-1) var(--wui-duration-lg); will-change: background-color; } .network:focus-visible { border: 1px solid var(--wui-color-accent-100); background-color: var(--wui-color-gray-glass-005); -webkit-box-shadow: 0px 0px 0px 4px var(--wui-box-shadow-blue); -moz-box-shadow: 0px 0px 0px 4px var(--wui-box-shadow-blue); box-shadow: 0px 0px 0px 4px var(--wui-box-shadow-blue); } .network:hover { background-color: var(--wui-color-gray-glass-005); } .network:active { background-color: var(--wui-color-gray-glass-010); } `;var q7=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Ly=class extends se{render(){return M` Details ${this.networkTemplate()} `}networkTemplate(){var e;return(e=this.caipNetwork)!=null&&e.name?M` this.onNetworkClick(this.caipNetwork)} class="network" textTitle="Network" imageSrc=${we(pt.getNetworkImage(this.caipNetwork))} >`:null}onNetworkClick(e){e&&X.push("Networks",{network:e})}};Ly.styles=mxe;q7([q()],Ly.prototype,"receiverAddress",void 0);q7([q({type:Object})],Ly.prototype,"caipNetwork",void 0);Ly=q7([te("w3m-wallet-send-details")],Ly);const wxe=de` wui-avatar, wui-image { display: ruby; width: 32px; height: 32px; border-radius: var(--wui-border-radius-3xl); } .sendButton { width: 70%; --local-width: 100% !important; --local-border-radius: var(--wui-border-radius-xs) !important; } .cancelButton { width: 30%; --local-width: 100% !important; --local-border-radius: var(--wui-border-radius-xs) !important; } `;var Ld=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Jo=class extends se{constructor(){super(),this.unsubscribe=[],this.token=Qe.state.token,this.sendTokenAmount=Qe.state.sendTokenAmount,this.receiverAddress=Qe.state.receiverAddress,this.receiverProfileName=Qe.state.receiverProfileName,this.receiverProfileImageUrl=Qe.state.receiverProfileImageUrl,this.caipNetwork=F.state.activeCaipNetwork,this.loading=Qe.state.loading,this.unsubscribe.push(Qe.subscribe(e=>{this.token=e.token,this.sendTokenAmount=e.sendTokenAmount,this.receiverAddress=e.receiverAddress,this.receiverProfileName=e.receiverProfileName,this.receiverProfileImageUrl=e.receiverProfileImageUrl,this.loading=e.loading}),F.subscribeKey("activeCaipNetwork",e=>this.caipNetwork=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){var e,r;return M` Send ${this.sendValueTemplate()} To Review transaction carefully Cancel Send `}sendValueTemplate(){if(this.token&&this.sendTokenAmount){const r=this.token.price*this.sendTokenAmount;return M`$${r.toFixed(2)}`}return null}async onSendClick(){var e,r,n;if(!this.sendTokenAmount||!this.receiverAddress){Fe.showError("Please enter a valid amount and receiver address");return}try{await Qe.sendToken(),Fe.showSuccess("Transaction started"),X.replace("Account")}catch(i){Fe.showError("Failed to send transaction. Please try again."),console.error("SendController:sendToken - failed to send transaction",i);const s=F.state.activeChain,o=i instanceof Error?i.message:"Unknown error";Re.sendEvent({type:"track",event:"SEND_ERROR",properties:{message:o,isSmartAccount:((e=re.state.preferredAccountTypes)==null?void 0:e[s])===bt.ACCOUNT_TYPES.SMART_ACCOUNT,token:((r=this.token)==null?void 0:r.symbol)||"",amount:this.sendTokenAmount,network:((n=F.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)||""}})}}onCancelClick(){X.goBack()}};Jo.styles=wxe;Ld([G()],Jo.prototype,"token",void 0);Ld([G()],Jo.prototype,"sendTokenAmount",void 0);Ld([G()],Jo.prototype,"receiverAddress",void 0);Ld([G()],Jo.prototype,"receiverProfileName",void 0);Ld([G()],Jo.prototype,"receiverProfileImageUrl",void 0);Ld([G()],Jo.prototype,"caipNetwork",void 0);Ld([G()],Jo.prototype,"loading",void 0);Jo=Ld([te("w3m-wallet-send-preview-view")],Jo);const bxe=Object.freeze(Object.defineProperty({__proto__:null,get W3mSendSelectTokenView(){return Ad},get W3mWalletSendPreviewView(){return Jo},get W3mWalletSendView(){return nc}},Symbol.toStringTag,{value:"Module"})),yxe=de` button { border: none; border-radius: var(--wui-border-radius-3xl); } button[data-variant='main'] { background-color: var(--wui-color-accent-100); color: var(--wui-color-inverse-100); box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-010); } button[data-variant='accent'] { background-color: var(--wui-color-accent-glass-010); color: var(--wui-color-accent-100); box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-005); } button[data-variant='gray'] { background-color: transparent; color: var(--wui-color-fg-200); box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-010); } button[data-variant='shade'] { background-color: transparent; color: var(--wui-color-accent-100); box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-010); } button[data-size='sm'] { height: 32px; padding: 0 var(--wui-spacing-s); } button[data-size='md'] { height: 40px; padding: 0 var(--wui-spacing-l); } button[data-size='sm'] > wui-image { width: 16px; height: 16px; } button[data-size='md'] > wui-image { width: 24px; height: 24px; } button[data-size='sm'] > wui-icon { width: 12px; height: 12px; } button[data-size='md'] > wui-icon { width: 14px; height: 14px; } wui-image { border-radius: var(--wui-border-radius-3xl); overflow: hidden; } button.disabled > wui-icon, button.disabled > wui-image { filter: grayscale(1); } button[data-variant='main'] > wui-image { box-shadow: inset 0 0 0 1px var(--wui-color-accent-090); } button[data-variant='shade'] > wui-image, button[data-variant='gray'] > wui-image { box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-010); } @media (hover: hover) and (pointer: fine) { button[data-variant='main']:focus-visible { background-color: var(--wui-color-accent-090); } button[data-variant='main']:hover:enabled { background-color: var(--wui-color-accent-090); } button[data-variant='main']:active:enabled { background-color: var(--wui-color-accent-080); } button[data-variant='accent']:hover:enabled { background-color: var(--wui-color-accent-glass-015); } button[data-variant='accent']:active:enabled { background-color: var(--wui-color-accent-glass-020); } button[data-variant='shade']:focus-visible, button[data-variant='gray']:focus-visible, button[data-variant='shade']:hover, button[data-variant='gray']:hover { background-color: var(--wui-color-gray-glass-002); } button[data-variant='gray']:active, button[data-variant='shade']:active { background-color: var(--wui-color-gray-glass-005); } } button.disabled { color: var(--wui-color-gray-glass-020); background-color: var(--wui-color-gray-glass-002); box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-002); pointer-events: none; } `;var Pp=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Du=class extends se{constructor(){super(...arguments),this.variant="accent",this.imageSrc="",this.disabled=!1,this.icon="externalLink",this.size="md",this.text=""}render(){const e=this.size==="sm"?"small-600":"paragraph-600";return M` `}};Du.styles=[He,vt,yxe];Pp([q()],Du.prototype,"variant",void 0);Pp([q()],Du.prototype,"imageSrc",void 0);Pp([q({type:Boolean})],Du.prototype,"disabled",void 0);Pp([q()],Du.prototype,"icon",void 0);Pp([q()],Du.prototype,"size",void 0);Pp([q()],Du.prototype,"text",void 0);Du=Pp([te("wui-chip-button")],Du);const vxe=de` button { display: flex; gap: var(--wui-spacing-xl); width: 100%; background-color: var(--wui-color-gray-glass-002); border-radius: var(--wui-border-radius-xxs); padding: var(--wui-spacing-m) var(--wui-spacing-s); } wui-text { width: 100%; } wui-flex { width: auto; } .network-icon { width: var(--wui-spacing-2l); height: var(--wui-spacing-2l); border-radius: calc(var(--wui-spacing-2l) / 2); overflow: hidden; box-shadow: 0 0 0 3px var(--wui-color-gray-glass-002), 0 0 0 3px var(--wui-color-modal-bg); } `;var z7=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Uy=class extends se{constructor(){super(...arguments),this.networkImages=[""],this.text=""}render(){return M` `}networksTemplate(){const e=this.networkImages.slice(0,5);return M` ${e==null?void 0:e.map(r=>M` `)} `}};Uy.styles=[He,vt,vxe];z7([q({type:Array})],Uy.prototype,"networkImages",void 0);z7([q()],Uy.prototype,"text",void 0);Uy=z7([te("wui-compatible-network")],Uy);const _xe=de` wui-compatible-network { margin-top: var(--wui-spacing-l); } `;var a2=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let xd=class extends se{constructor(){super(),this.unsubscribe=[],this.address=re.state.address,this.profileName=re.state.profileName,this.network=F.state.activeCaipNetwork,this.preferredAccountTypes=re.state.preferredAccountTypes,this.unsubscribe.push(re.subscribe(e=>{e.address?(this.address=e.address,this.profileName=e.profileName,this.preferredAccountTypes=e.preferredAccountTypes):Fe.showError("Account not found")}),F.subscribeKey("activeCaipNetwork",e=>{e!=null&&e.id&&(this.network=e)}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){if(!this.address)throw new Error("w3m-wallet-receive-view: No account provided");const e=pt.getNetworkImage(this.network);return M` Copy your address or scan this QR code ${this.networkTemplate()} `}networkTemplate(){var a,c;const e=F.getAllRequestedCaipNetworks(),r=F.checkIfSmartAccountEnabled(),n=F.state.activeCaipNetwork,i=e.filter(u=>(u==null?void 0:u.chainNamespace)===(n==null?void 0:n.chainNamespace));if(((a=this.preferredAccountTypes)==null?void 0:a[n==null?void 0:n.chainNamespace])===bt.ACCOUNT_TYPES.SMART_ACCOUNT&&r)return n?M``:null;const o=((c=i==null?void 0:i.filter(u=>{var l;return(l=u==null?void 0:u.assets)==null?void 0:l.imageId}))==null?void 0:c.slice(0,5)).map(pt.getNetworkImage).filter(Boolean);return M``}onReceiveClick(){X.push("WalletCompatibleNetworks")}onCopyClick(){try{this.address&&(ue.copyToClopboard(this.address),Fe.showSuccess("Address copied"))}catch{Fe.showError("Failed to copy")}}};xd.styles=_xe;a2([G()],xd.prototype,"address",void 0);a2([G()],xd.prototype,"profileName",void 0);a2([G()],xd.prototype,"network",void 0);a2([G()],xd.prototype,"preferredAccountTypes",void 0);xd=a2([te("w3m-wallet-receive-view")],xd);const Exe=Object.freeze(Object.defineProperty({__proto__:null,get W3mWalletReceiveView(){return xd}},Symbol.toStringTag,{value:"Module"})),Cxe=de` :host > wui-flex:first-child { column-gap: var(--wui-spacing-s); padding: 7px var(--wui-spacing-l) 7px var(--wui-spacing-xs); width: 100%; } wui-flex { display: flex; flex: 1; } `;var Axe=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let DP=class extends se{render(){return M` `}};DP.styles=[He,Cxe];DP=Axe([te("wui-transaction-list-item-loader")],DP);const xxe=de` :host { width: 100%; } :host > wui-flex { width: 100%; padding: var(--wui-spacing-s); border-radius: var(--wui-border-radius-xs); width: 100%; display: flex; align-items: center; justify-content: flex-start; gap: var(--wui-spacing-s); } :host > wui-flex:hover { background-color: var(--wui-color-gray-glass-002); } .purchase-image-container { display: flex; justify-content: center; align-items: center; position: relative; width: var(--wui-icon-box-size-lg); height: var(--wui-icon-box-size-lg); } .purchase-image-container wui-image { width: 100%; height: 100%; position: relative; border-radius: calc(var(--wui-icon-box-size-lg) / 2); } .purchase-image-container wui-image::after { content: ''; display: block; width: 100%; height: 100%; position: absolute; inset: 0; border-radius: calc(var(--wui-icon-box-size-lg) / 2); box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-005); } .purchase-image-container wui-icon-box { position: absolute; right: 0; bottom: 0; transform: translate(20%, 20%); } `;var Ns=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Si=class extends se{constructor(){super(...arguments),this.disabled=!1,this.color="inherit",this.label="Bought",this.purchaseValue="",this.purchaseCurrency="",this.date="",this.completed=!1,this.inProgress=!1,this.failed=!1,this.onClick=null,this.symbol=""}firstUpdated(){this.icon||this.fetchTokenImage()}render(){return M` ${this.imageTemplate()} ${this.statusIconTemplate()} ${this.label} + ${this.purchaseValue} ${this.purchaseCurrency} ${this.inProgress?M``:M`${this.date}`} `}async fetchTokenImage(){await Ne._fetchTokenImage(this.purchaseCurrency)}statusIconTemplate(){return this.inProgress?null:this.completed?this.boughtIconTemplate():this.errorIconTemplate()}errorIconTemplate(){return M``}imageTemplate(){const e=this.icon||`https://avatar.vercel.sh/andrew.svg?size=50&text=${this.symbol}`;return M` `}boughtIconTemplate(){return M``}};Si.styles=[xxe];Ns([q({type:Boolean})],Si.prototype,"disabled",void 0);Ns([q()],Si.prototype,"color",void 0);Ns([q()],Si.prototype,"label",void 0);Ns([q()],Si.prototype,"purchaseValue",void 0);Ns([q()],Si.prototype,"purchaseCurrency",void 0);Ns([q()],Si.prototype,"date",void 0);Ns([q({type:Boolean})],Si.prototype,"completed",void 0);Ns([q({type:Boolean})],Si.prototype,"inProgress",void 0);Ns([q({type:Boolean})],Si.prototype,"failed",void 0);Ns([q()],Si.prototype,"onClick",void 0);Ns([q()],Si.prototype,"symbol",void 0);Ns([q()],Si.prototype,"icon",void 0);Si=Ns([te("w3m-onramp-activity-item")],Si);const Sxe=de` :host > wui-flex { height: 500px; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; padding: var(--wui-spacing-m); box-sizing: border-box; display: flex; align-items: center; justify-content: flex-start; } :host > wui-flex::-webkit-scrollbar { display: none; } :host > wui-flex > wui-flex { width: 100%; } wui-transaction-list-item-loader { width: 100%; } `;var c2=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};const Txe=7;let Sd=class extends se{constructor(){super(),this.unsubscribe=[],this.selectedOnRampProvider=$t.state.selectedProvider,this.loading=!1,this.coinbaseTransactions=Dr.state.coinbaseTransactions,this.tokenImages=er.state.tokenImages,this.unsubscribe.push($t.subscribeKey("selectedProvider",e=>{this.selectedOnRampProvider=e}),er.subscribeKey("tokenImages",e=>this.tokenImages=e),()=>{clearTimeout(this.refetchTimeout)},Dr.subscribe(e=>{this.coinbaseTransactions={...e.coinbaseTransactions}})),Dr.clearCursor(),this.fetchTransactions()}render(){return M` ${this.loading?this.templateLoading():this.templateTransactionsByYear()} `}templateTransactions(e){return e==null?void 0:e.map(r=>{var a,c,u;const n=bC.formatDate((a=r==null?void 0:r.metadata)==null?void 0:a.minedAt),i=r.transfers[0],s=i==null?void 0:i.fungible_info;if(!s)return null;const o=((c=s==null?void 0:s.icon)==null?void 0:c.url)||((u=this.tokenImages)==null?void 0:u[s.symbol||""]);return M` `})}templateTransactionsByYear(){return Object.keys(this.coinbaseTransactions).sort().reverse().map(r=>{const n=parseInt(r,10);return new Array(12).fill(null).map((s,o)=>o).reverse().map(s=>{var c;const o=Xh.getTransactionGroupTitle(n,s),a=(c=this.coinbaseTransactions[n])==null?void 0:c[s];return a?M` ${o} ${this.templateTransactions(a)} `:null})})}async fetchTransactions(){await this.fetchCoinbaseTransactions()}async fetchCoinbaseTransactions(){const e=re.state.address,r=oe.state.projectId;if(!e)throw new Error("No address found");if(!r)throw new Error("No projectId found");this.loading=!0,await Dr.fetchTransactions(e,"coinbase"),this.loading=!1,this.refetchLoadingTransactions()}refetchLoadingTransactions(){var i;const e=new Date;if((((i=this.coinbaseTransactions[e.getFullYear()])==null?void 0:i[e.getMonth()])||[]).filter(s=>s.metadata.status==="ONRAMP_TRANSACTION_STATUS_IN_PROGRESS").length===0){clearTimeout(this.refetchTimeout);return}this.refetchTimeout=setTimeout(async()=>{const s=re.state.address;await Dr.fetchTransactions(s,"coinbase"),this.refetchLoadingTransactions()},3e3)}templateLoading(){return Array(Txe).fill(M` `).map(e=>e)}};Sd.styles=Sxe;c2([G()],Sd.prototype,"selectedOnRampProvider",void 0);c2([G()],Sd.prototype,"loading",void 0);c2([G()],Sd.prototype,"coinbaseTransactions",void 0);c2([G()],Sd.prototype,"tokenImages",void 0);Sd=c2([te("w3m-onramp-activity-view")],Sd);const Ixe=de` button { column-gap: var(--wui-spacing-s); padding: 11px 18px 11px var(--wui-spacing-s); width: 100%; background-color: var(--wui-color-gray-glass-002); border-radius: var(--wui-border-radius-xs); color: var(--wui-color-fg-250); transition: color var(--wui-ease-out-power-1) var(--wui-duration-md), background-color var(--wui-ease-out-power-1) var(--wui-duration-md); will-change: color, background-color; } button[data-iconvariant='square'], button[data-iconvariant='square-blue'] { padding: 6px 18px 6px 9px; } button > wui-flex { flex: 1; } button > wui-image { width: 32px; height: 32px; box-shadow: 0 0 0 2px var(--wui-color-gray-glass-005); border-radius: var(--wui-border-radius-3xl); } button > wui-icon { width: 36px; height: 36px; transition: opacity var(--wui-ease-out-power-1) var(--wui-duration-md); will-change: opacity; } button > wui-icon-box[data-variant='blue'] { box-shadow: 0 0 0 2px var(--wui-color-accent-glass-005); } button > wui-icon-box[data-variant='overlay'] { box-shadow: 0 0 0 2px var(--wui-color-gray-glass-005); } button > wui-icon-box[data-variant='square-blue'] { border-radius: var(--wui-border-radius-3xs); position: relative; border: none; width: 36px; height: 36px; } button > wui-icon-box[data-variant='square-blue']::after { content: ''; position: absolute; top: 0; bottom: 0; left: 0; right: 0; border-radius: inherit; border: 1px solid var(--wui-color-accent-glass-010); pointer-events: none; } button > wui-icon:last-child { width: 14px; height: 14px; } button:disabled { color: var(--wui-color-gray-glass-020); } button[data-loading='true'] > wui-icon { opacity: 0; } wui-loading-spinner { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); } `;var ia=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Ts=class extends se{constructor(){super(...arguments),this.tabIdx=void 0,this.variant="icon",this.disabled=!1,this.imageSrc=void 0,this.alt=void 0,this.chevron=!1,this.loading=!1}render(){return M` `}visualTemplate(){if(this.variant==="image"&&this.imageSrc)return M``;if(this.iconVariant==="square"&&this.icon&&this.variant==="icon")return M``;if(this.variant==="icon"&&this.icon&&this.iconVariant){const e=["blue","square-blue"].includes(this.iconVariant)?"accent-100":"fg-200",r=this.iconVariant==="square-blue"?"mdl":"md",n=this.iconSize?this.iconSize:r;return M` `}return null}loadingTemplate(){return this.loading?M``:M``}chevronTemplate(){return this.chevron?M``:null}};Ts.styles=[He,vt,Ixe];ia([q()],Ts.prototype,"icon",void 0);ia([q()],Ts.prototype,"iconSize",void 0);ia([q()],Ts.prototype,"tabIdx",void 0);ia([q()],Ts.prototype,"variant",void 0);ia([q()],Ts.prototype,"iconVariant",void 0);ia([q({type:Boolean})],Ts.prototype,"disabled",void 0);ia([q()],Ts.prototype,"imageSrc",void 0);ia([q()],Ts.prototype,"alt",void 0);ia([q({type:Boolean})],Ts.prototype,"chevron",void 0);ia([q({type:Boolean})],Ts.prototype,"loading",void 0);Ts=ia([te("wui-list-item")],Ts);const Pxe=de` :host > wui-grid { max-height: 360px; overflow: auto; } wui-flex { transition: opacity var(--wui-ease-out-power-1) var(--wui-duration-md); will-change: opacity; } wui-grid::-webkit-scrollbar { display: none; } wui-flex.disabled { opacity: 0.3; pointer-events: none; user-select: none; } `;var u2=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Td=class extends se{constructor(){super(),this.unsubscribe=[],this.selectedCurrency=$t.state.paymentCurrency,this.currencies=$t.state.paymentCurrencies,this.currencyImages=er.state.currencyImages,this.checked=As.state.isLegalCheckboxChecked,this.unsubscribe.push($t.subscribe(e=>{this.selectedCurrency=e.paymentCurrency,this.currencies=e.paymentCurrencies}),er.subscribeKey("currencyImages",e=>this.currencyImages=e),As.subscribeKey("isLegalCheckboxChecked",e=>{this.checked=e}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){var a;const{termsConditionsUrl:e,privacyPolicyUrl:r}=oe.state,n=(a=oe.state.features)==null?void 0:a.legalCheckbox,o=!!(e||r)&&!!n&&!this.checked;return M` ${this.currenciesTemplate(o)} `}currenciesTemplate(e=!1){return this.currencies.map(r=>{var n;return M` this.selectCurrency(r)} variant="image" tabIdx=${we(e?-1:void 0)} > ${r.id} `})}selectCurrency(e){e&&($t.setPaymentCurrency(e),We.close())}};Td.styles=Pxe;u2([G()],Td.prototype,"selectedCurrency",void 0);u2([G()],Td.prototype,"currencies",void 0);u2([G()],Td.prototype,"currencyImages",void 0);u2([G()],Td.prototype,"checked",void 0);Td=u2([te("w3m-onramp-fiat-select-view")],Td);const Oxe=Se` `,Rxe=Se` `,kxe=Se` `,Nxe=Se` `,$xe=Se` `,jxe=Se` `,Bxe=Se` `,Dxe=Se` `,Mxe=Se` `,Lxe=Se` `,Uxe=Se` `,Fxe=Se` `,Hxe=Se` `,qxe=Se` `,zxe=Se` `,Wxe=Se` `,Vxe=Se` `,Gxe=Se` `,Kxe=Se` `,Zxe=Se` `,Yxe=Se` `,Jxe=Se` `,Qxe=Se` `,Xxe=Se` `,e8e=de` :host { display: block; width: var(--local-size); height: var(--local-size); } :host svg { width: 100%; height: 100%; } `;var W7=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};const t8e={browser:Rxe,dao:Nxe,defi:$xe,defiAlt:jxe,eth:Bxe,layers:Mxe,lock:Uxe,login:Fxe,network:zxe,nft:Wxe,noun:Vxe,profile:Yxe,system:Xxe,coinbase:kxe,meld:Hxe,onrampCard:Gxe,moonpay:qxe,stripe:Qxe,paypal:Kxe,google:Dxe,pencil:Zxe,lightbulb:Lxe,solana:Jxe,bitcoin:Oxe};let Fy=class extends se{constructor(){super(...arguments),this.name="browser",this.size="md"}render(){return this.style.cssText=` --local-size: var(--wui-visual-size-${this.size}); `,M`${t8e[this.name]}`}};Fy.styles=[He,e8e];W7([q()],Fy.prototype,"name",void 0);W7([q()],Fy.prototype,"size",void 0);Fy=W7([te("wui-visual")],Fy);const r8e=de` button { padding: var(--wui-spacing-s); border-radius: var(--wui-border-radius-xs); border: none; outline: none; background-color: var(--wui-color-gray-glass-002); width: 100%; display: flex; align-items: center; justify-content: flex-start; gap: var(--wui-spacing-s); transition: background-color var(--wui-ease-out-power-1) var(--wui-duration-md); will-change: background-color; } button:hover { background-color: var(--wui-color-gray-glass-005); } .provider-image { width: var(--wui-spacing-3xl); min-width: var(--wui-spacing-3xl); height: var(--wui-spacing-3xl); border-radius: calc(var(--wui-border-radius-xs) - calc(var(--wui-spacing-s) / 2)); position: relative; overflow: hidden; } .provider-image::after { content: ''; display: block; width: 100%; height: 100%; position: absolute; inset: 0; border-radius: calc(var(--wui-border-radius-xs) - calc(var(--wui-spacing-s) / 2)); box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-005); } .network-icon { width: var(--wui-spacing-m); height: var(--wui-spacing-m); border-radius: calc(var(--wui-spacing-m) / 2); overflow: hidden; box-shadow: 0 0 0 3px var(--wui-color-gray-glass-002), 0 0 0 3px var(--wui-color-modal-bg); transition: box-shadow var(--wui-ease-out-power-1) var(--wui-duration-md); will-change: box-shadow; } button:hover .network-icon { box-shadow: 0 0 0 3px var(--wui-color-gray-glass-005), 0 0 0 3px var(--wui-color-modal-bg); } `;var Ud=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let ic=class extends se{constructor(){super(...arguments),this.disabled=!1,this.color="inherit",this.label="",this.feeRange="",this.loading=!1,this.onClick=null}render(){return M` `}networksTemplate(){var n;const e=F.getAllRequestedCaipNetworks(),r=(n=e==null?void 0:e.filter(i=>{var s;return(s=i==null?void 0:i.assets)==null?void 0:s.imageId}))==null?void 0:n.slice(0,5);return M` ${r==null?void 0:r.map(i=>M` `)} `}};ic.styles=[r8e];Ud([q({type:Boolean})],ic.prototype,"disabled",void 0);Ud([q()],ic.prototype,"color",void 0);Ud([q()],ic.prototype,"name",void 0);Ud([q()],ic.prototype,"label",void 0);Ud([q()],ic.prototype,"feeRange",void 0);Ud([q({type:Boolean})],ic.prototype,"loading",void 0);Ud([q()],ic.prototype,"onClick",void 0);ic=Ud([te("w3m-onramp-provider-item")],ic);const n8e=de` wui-flex { border-top: 1px solid var(--wui-color-gray-glass-005); } a { text-decoration: none; color: var(--wui-color-fg-175); font-weight: 500; display: flex; align-items: center; justify-content: center; gap: var(--wui-spacing-3xs); } `;var i8e=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let MP=class extends se{render(){const{termsConditionsUrl:e,privacyPolicyUrl:r}=oe.state;return!e&&!r?null:M` We work with the best providers to give you the lowest fees and best support. More options coming soon! ${this.howDoesItWorkTemplate()} `}howDoesItWorkTemplate(){return M` How does it work? `}onWhatIsBuy(){var r;const e=F.state.activeChain;Re.sendEvent({type:"track",event:"SELECT_WHAT_IS_A_BUY",properties:{isSmartAccount:((r=re.state.preferredAccountTypes)==null?void 0:r[e])===bt.ACCOUNT_TYPES.SMART_ACCOUNT}}),X.push("WhatIsABuy")}};MP.styles=[n8e];MP=i8e([te("w3m-onramp-providers-footer")],MP);var XJ=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let h6=class extends se{constructor(){super(),this.unsubscribe=[],this.providers=$t.state.providers,this.unsubscribe.push($t.subscribeKey("providers",e=>{this.providers=e}))}firstUpdated(){const e=this.providers.map(async r=>r.name==="coinbase"?await this.getCoinbaseOnRampURL():Promise.resolve(r==null?void 0:r.url));Promise.all(e).then(r=>{this.providers=this.providers.map((n,i)=>({...n,url:r[i]||""}))})}render(){return M` ${this.onRampProvidersTemplate()} `}onRampProvidersTemplate(){return this.providers.filter(e=>e.supportedChains.includes(F.state.activeChain??"eip155")).map(e=>M` {this.onClickProvider(e)}} ?disabled=${!e.url} data-testid=${`onramp-provider-${e.name}`} > `)}onClickProvider(e){var n;const r=F.state.activeChain;$t.setSelectedProvider(e),X.push("BuyInProgress"),ue.openHref(e.url,"popupWindow","width=600,height=800,scrollbars=yes"),Re.sendEvent({type:"track",event:"SELECT_BUY_PROVIDER",properties:{provider:e.name,isSmartAccount:((n=re.state.preferredAccountTypes)==null?void 0:n[r])===bt.ACCOUNT_TYPES.SMART_ACCOUNT}})}async getCoinbaseOnRampURL(){const e=re.state.address,r=F.state.activeCaipNetwork;if(!e)throw new Error("No address found");if(!(r!=null&&r.name))throw new Error("No network found");const n=ct.WC_COINBASE_PAY_SDK_CHAIN_NAME_MAP[r.name]??ct.WC_COINBASE_PAY_SDK_FALLBACK_CHAIN,i=$t.state.purchaseCurrency,s=i?[i.symbol]:$t.state.purchaseCurrencies.map(o=>o.symbol);return await Xe.generateOnRampURL({defaultNetwork:n,destinationWallets:[{address:e,blockchains:ct.WC_COINBASE_PAY_SDK_CHAINS,assets:s}],partnerUserId:e,purchaseAmount:$t.state.purchaseAmount})}};XJ([G()],h6.prototype,"providers",void 0);h6=XJ([te("w3m-onramp-providers-view")],h6);const s8e=de` :host > wui-grid { max-height: 360px; overflow: auto; } wui-flex { transition: opacity var(--wui-ease-out-power-1) var(--wui-duration-md); will-change: opacity; } wui-grid::-webkit-scrollbar { display: none; } wui-flex.disabled { opacity: 0.3; pointer-events: none; user-select: none; } `;var l2=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Id=class extends se{constructor(){super(),this.unsubscribe=[],this.selectedCurrency=$t.state.purchaseCurrencies,this.tokens=$t.state.purchaseCurrencies,this.tokenImages=er.state.tokenImages,this.checked=As.state.isLegalCheckboxChecked,this.unsubscribe.push($t.subscribe(e=>{this.selectedCurrency=e.purchaseCurrencies,this.tokens=e.purchaseCurrencies}),er.subscribeKey("tokenImages",e=>this.tokenImages=e),As.subscribeKey("isLegalCheckboxChecked",e=>{this.checked=e}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){var a;const{termsConditionsUrl:e,privacyPolicyUrl:r}=oe.state,n=(a=oe.state.features)==null?void 0:a.legalCheckbox,o=!!(e||r)&&!!n&&!this.checked;return M` ${this.currenciesTemplate(o)} `}currenciesTemplate(e=!1){return this.tokens.map(r=>{var n;return M` this.selectToken(r)} variant="image" tabIdx=${we(e?-1:void 0)} > ${r.name} ${r.symbol} `})}selectToken(e){e&&($t.setPurchaseCurrency(e),We.close())}};Id.styles=s8e;l2([G()],Id.prototype,"selectedCurrency",void 0);l2([G()],Id.prototype,"tokens",void 0);l2([G()],Id.prototype,"tokenImages",void 0);l2([G()],Id.prototype,"checked",void 0);Id=l2([te("w3m-onramp-token-select-view")],Id);const o8e=de` @keyframes shake { 0% { transform: translateX(0); } 25% { transform: translateX(3px); } 50% { transform: translateX(-3px); } 75% { transform: translateX(3px); } 100% { transform: translateX(0); } } wui-flex:first-child:not(:only-child) { position: relative; } wui-loading-thumbnail { position: absolute; } wui-visual { width: var(--wui-wallet-image-size-lg); height: var(--wui-wallet-image-size-lg); border-radius: calc(var(--wui-border-radius-5xs) * 9 - var(--wui-border-radius-xxs)); position: relative; overflow: hidden; } wui-visual::after { content: ''; display: block; width: 100%; height: 100%; position: absolute; inset: 0; border-radius: calc(var(--wui-border-radius-5xs) * 9 - var(--wui-border-radius-xxs)); box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-005); } wui-icon-box { position: absolute; right: calc(var(--wui-spacing-3xs) * -1); bottom: calc(var(--wui-spacing-3xs) * -1); opacity: 0; transform: scale(0.5); transition: opacity var(--wui-ease-out-power-2) var(--wui-duration-lg), transform var(--wui-ease-out-power-2) var(--wui-duration-lg); will-change: opacity, transform; } wui-text[align='center'] { width: 100%; padding: 0px var(--wui-spacing-l); } [data-error='true'] wui-icon-box { opacity: 1; transform: scale(1); } [data-error='true'] > wui-flex:first-child { animation: shake 250ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both; } [data-retry='false'] wui-link { display: none; } [data-retry='true'] wui-link { display: block; opacity: 1; } wui-link { padding: var(--wui-spacing-4xs) var(--wui-spacing-xxs); } `;var sa=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Ji=class extends se{constructor(){super(),this.unsubscribe=[],this.selectedOnRampProvider=$t.state.selectedProvider,this.uri=xe.state.wcUri,this.ready=!1,this.showRetry=!1,this.buffering=!1,this.error=!1,this.startTime=null,this.isMobile=!1,this.onRetry=void 0,this.unsubscribe.push($t.subscribeKey("selectedProvider",e=>{this.selectedOnRampProvider=e})),this.watchTransactions()}disconnectedCallback(){this.intervalId&&clearInterval(this.intervalId)}render(){var n,i;let e="Continue in external window";this.error?e="Buy failed":this.selectedOnRampProvider&&(e=`Buy in ${(n=this.selectedOnRampProvider)==null?void 0:n.label}`);const r=this.error?"Buy can be declined from your side or due to and error on the provider app":"We’ll notify you once your Buy is processed";return M` ${this.error?null:this.loaderTemplate()} ${e} ${r} ${this.error?this.tryAgainTemplate():null} Copy link `}watchTransactions(){if(this.selectedOnRampProvider)switch(this.selectedOnRampProvider.name){case"coinbase":this.startTime=Date.now(),this.initializeCoinbaseTransactions();break}}async initializeCoinbaseTransactions(){await this.watchCoinbaseTransactions(),this.intervalId=setInterval(()=>this.watchCoinbaseTransactions(),4e3)}async watchCoinbaseTransactions(){try{const e=re.state.address;if(!e)throw new Error("No address found");(await Xe.fetchTransactions({account:e,onramp:"coinbase"})).data.filter(i=>new Date(i.metadata.minedAt)>new Date(this.startTime)||i.metadata.status==="ONRAMP_TRANSACTION_STATUS_IN_PROGRESS").length?(clearInterval(this.intervalId),X.replace("OnRampActivity")):this.startTime&&Date.now()-this.startTime>=18e4&&(clearInterval(this.intervalId),this.error=!0)}catch(e){Fe.showError(e)}}onTryAgain(){this.selectedOnRampProvider&&(this.error=!1,ue.openHref(this.selectedOnRampProvider.url,"popupWindow","width=600,height=800,scrollbars=yes"))}tryAgainTemplate(){var e;return(e=this.selectedOnRampProvider)!=null&&e.url?M` Try again `:null}loaderTemplate(){const e=ar.state.themeVariables["--w3m-border-radius-master"],r=e?parseInt(e.replace("px",""),10):4;return M``}onCopyUri(){var e;if(!((e=this.selectedOnRampProvider)!=null&&e.url)){Fe.showError("No link found"),X.goBack();return}try{ue.copyToClopboard(this.selectedOnRampProvider.url),Fe.showSuccess("Link copied")}catch{Fe.showError("Failed to copy")}}};Ji.styles=o8e;sa([G()],Ji.prototype,"intervalId",void 0);sa([G()],Ji.prototype,"selectedOnRampProvider",void 0);sa([G()],Ji.prototype,"uri",void 0);sa([G()],Ji.prototype,"ready",void 0);sa([G()],Ji.prototype,"showRetry",void 0);sa([G()],Ji.prototype,"buffering",void 0);sa([G()],Ji.prototype,"error",void 0);sa([G()],Ji.prototype,"startTime",void 0);sa([q({type:Boolean})],Ji.prototype,"isMobile",void 0);sa([q()],Ji.prototype,"onRetry",void 0);Ji=sa([te("w3m-buy-in-progress-view")],Ji);var a8e=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let LP=class extends se{render(){return M` Quickly and easily buy digital assets! Simply select your preferred onramp provider and add digital assets to your account using your credit card or bank transfer Buy `}};LP=a8e([te("w3m-what-is-a-buy-view")],LP);const c8e=de` :host { width: 100%; } wui-loading-spinner { position: absolute; top: 50%; right: 20px; transform: translateY(-50%); } .currency-container { position: absolute; top: 50%; transform: translateY(-50%); right: var(--wui-spacing-1xs); height: 40px; padding: var(--wui-spacing-xs) var(--wui-spacing-1xs) var(--wui-spacing-xs) var(--wui-spacing-xs); min-width: 95px; border-radius: var(--FULL, 1000px); border: 1px solid var(--wui-color-gray-glass-002); background: var(--wui-color-gray-glass-002); cursor: pointer; } .currency-container > wui-image { height: 24px; width: 24px; border-radius: 50%; } `;var Op=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Mu=class extends se{constructor(){var e;super(),this.unsubscribe=[],this.type="Token",this.value=0,this.currencies=[],this.selectedCurrency=(e=this.currencies)==null?void 0:e[0],this.currencyImages=er.state.currencyImages,this.tokenImages=er.state.tokenImages,this.unsubscribe.push($t.subscribeKey("purchaseCurrency",r=>{!r||this.type==="Fiat"||(this.selectedCurrency=this.formatPurchaseCurrency(r))}),$t.subscribeKey("paymentCurrency",r=>{!r||this.type==="Token"||(this.selectedCurrency=this.formatPaymentCurrency(r))}),$t.subscribe(r=>{this.type==="Fiat"?this.currencies=r.purchaseCurrencies.map(this.formatPurchaseCurrency):this.currencies=r.paymentCurrencies.map(this.formatPaymentCurrency)}),er.subscribe(r=>{this.currencyImages={...r.currencyImages},this.tokenImages={...r.tokenImages}}))}firstUpdated(){$t.getAvailableCurrencies()}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){var n;const e=((n=this.selectedCurrency)==null?void 0:n.symbol)||"",r=this.currencyImages[e]||this.tokenImages[e];return M` ${this.selectedCurrency?M` We.open({view:`OnRamp${this.type}Select`})} > ${this.selectedCurrency.symbol} `:M``} `}formatPaymentCurrency(e){return{name:e.id,symbol:e.id}}formatPurchaseCurrency(e){return{name:e.name,symbol:e.symbol}}};Mu.styles=c8e;Op([q({type:String})],Mu.prototype,"type",void 0);Op([q({type:Number})],Mu.prototype,"value",void 0);Op([G()],Mu.prototype,"currencies",void 0);Op([G()],Mu.prototype,"selectedCurrency",void 0);Op([G()],Mu.prototype,"currencyImages",void 0);Op([G()],Mu.prototype,"tokenImages",void 0);Mu=Op([te("w3m-onramp-input")],Mu);const u8e=de` :host > wui-flex { width: 100%; max-width: 360px; } :host > wui-flex > wui-flex { border-radius: var(--wui-border-radius-l); width: 100%; } .amounts-container { width: 100%; } `;var Fd=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};const l8e={USD:"$",EUR:"€",GBP:"£"},d8e=[100,250,500,1e3];let Qo=class extends se{constructor(){super(),this.unsubscribe=[],this.disabled=!1,this.caipAddress=F.state.activeCaipAddress,this.loading=We.state.loading,this.paymentCurrency=$t.state.paymentCurrency,this.paymentAmount=$t.state.paymentAmount,this.purchaseAmount=$t.state.purchaseAmount,this.quoteLoading=$t.state.quotesLoading,this.unsubscribe.push(F.subscribeKey("activeCaipAddress",e=>this.caipAddress=e),We.subscribeKey("loading",e=>{this.loading=e}),$t.subscribe(e=>{this.paymentCurrency=e.paymentCurrency,this.paymentAmount=e.paymentAmount,this.purchaseAmount=e.purchaseAmount,this.quoteLoading=e.quotesLoading}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return M` ${d8e.map(e=>{var r;return M`this.selectPresetAmount(e)} >${`${l8e[((r=this.paymentCurrency)==null?void 0:r.id)||"USD"]} ${e}`}`})} ${this.templateButton()} `}templateButton(){return this.caipAddress?M` Get quotes `:M` Connect wallet `}getQuotes(){this.loading||We.open({view:"OnRampProviders"})}openModal(){We.open({view:"Connect"})}async onPaymentAmountChange(e){$t.setPaymentAmount(Number(e.detail)),await $t.getQuote()}async selectPresetAmount(e){$t.setPaymentAmount(e),await $t.getQuote()}};Qo.styles=u8e;Fd([q({type:Boolean})],Qo.prototype,"disabled",void 0);Fd([G()],Qo.prototype,"caipAddress",void 0);Fd([G()],Qo.prototype,"loading",void 0);Fd([G()],Qo.prototype,"paymentCurrency",void 0);Fd([G()],Qo.prototype,"paymentAmount",void 0);Fd([G()],Qo.prototype,"purchaseAmount",void 0);Fd([G()],Qo.prototype,"quoteLoading",void 0);Qo=Fd([te("w3m-onramp-widget")],Qo);const h8e=Object.freeze(Object.defineProperty({__proto__:null,get W3mBuyInProgressView(){return Ji},get W3mOnRampActivityView(){return Sd},get W3mOnRampProvidersView(){return h6},get W3mOnrampFiatSelectView(){return Td},get W3mOnrampTokensView(){return Id},get W3mOnrampWidget(){return Qo},get W3mWhatIsABuyView(){return LP}},Symbol.toStringTag,{value:"Module"}));var UP;(function(t){t.approve="approved",t.bought="bought",t.borrow="borrowed",t.burn="burnt",t.cancel="canceled",t.claim="claimed",t.deploy="deployed",t.deposit="deposited",t.execute="executed",t.mint="minted",t.receive="received",t.repay="repaid",t.send="sent",t.sell="sold",t.stake="staked",t.trade="swapped",t.unstake="unstaked",t.withdraw="withdrawn"})(UP||(UP={}));const f8e=de` :host > wui-flex { display: flex; justify-content: center; align-items: center; position: relative; width: 40px; height: 40px; box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-005); background-color: var(--wui-color-gray-glass-005); } :host > wui-flex wui-image { display: block; } :host > wui-flex, :host > wui-flex wui-image, .swap-images-container, .swap-images-container.nft, wui-image.nft { border-top-left-radius: var(--local-left-border-radius); border-top-right-radius: var(--local-right-border-radius); border-bottom-left-radius: var(--local-left-border-radius); border-bottom-right-radius: var(--local-right-border-radius); } wui-icon { width: 20px; height: 20px; } wui-icon-box { position: absolute; right: 0; bottom: 0; transform: translate(20%, 20%); } .swap-images-container { position: relative; width: 40px; height: 40px; overflow: hidden; } .swap-images-container wui-image:first-child { position: absolute; width: 40px; height: 40px; top: 0; left: 0%; clip-path: inset(0px calc(50% + 2px) 0px 0%); } .swap-images-container wui-image:last-child { clip-path: inset(0px 0px 0px calc(50% + 2px)); } `;var Rp=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Lu=class extends se{constructor(){super(...arguments),this.images=[],this.secondImage={type:void 0,url:""}}render(){const[e,r]=this.images,n=(e==null?void 0:e.type)==="NFT",i=r!=null&&r.url?r.type==="NFT":n,s=n?"var(--wui-border-radius-xxs)":"var(--wui-border-radius-s)",o=i?"var(--wui-border-radius-xxs)":"var(--wui-border-radius-s)";return this.style.cssText=` --local-left-border-radius: ${s}; --local-right-border-radius: ${o}; `,M` ${this.templateVisual()} ${this.templateIcon()} `}templateVisual(){const[e,r]=this.images,n=e==null?void 0:e.type;return this.images.length===2&&(e!=null&&e.url||r!=null&&r.url)?M`
${e!=null&&e.url?M``:null} ${r!=null&&r.url?M``:null}
`:e!=null&&e.url?M``:n==="NFT"?M``:M``}templateIcon(){let e="accent-100",r;return r=this.getIcon(),this.status&&(e=this.getStatusColor()),r?M` `:null}getDirectionIcon(){switch(this.direction){case"in":return"arrowBottom";case"out":return"arrowTop";default:return}}getIcon(){return this.onlyDirectionIcon?this.getDirectionIcon():this.type==="trade"?"swapHorizontalBold":this.type==="approve"?"checkmark":this.type==="cancel"?"close":this.getDirectionIcon()}getStatusColor(){switch(this.status){case"confirmed":return"success-100";case"failed":return"error-100";case"pending":return"inverse-100";default:return"accent-100"}}};Lu.styles=[f8e];Rp([q()],Lu.prototype,"type",void 0);Rp([q()],Lu.prototype,"status",void 0);Rp([q()],Lu.prototype,"direction",void 0);Rp([q({type:Boolean})],Lu.prototype,"onlyDirectionIcon",void 0);Rp([q({type:Array})],Lu.prototype,"images",void 0);Rp([q({type:Object})],Lu.prototype,"secondImage",void 0);Lu=Rp([te("wui-transaction-visual")],Lu);const p8e=de` :host > wui-flex:first-child { align-items: center; column-gap: var(--wui-spacing-s); padding: 6.5px var(--wui-spacing-xs) 6.5px var(--wui-spacing-xs); width: 100%; } :host > wui-flex:first-child wui-text:nth-child(1) { text-transform: capitalize; } wui-transaction-visual { width: 40px; height: 40px; } wui-flex { flex: 1; } :host wui-flex wui-flex { overflow: hidden; } :host .description-container wui-text span { word-break: break-all; } :host .description-container wui-text { overflow: hidden; } :host .description-separator-icon { margin: 0px 6px; } :host wui-text > span { overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; } `;var oa=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Is=class extends se{constructor(){super(...arguments),this.type="approve",this.onlyDirectionIcon=!1,this.images=[],this.price=[],this.amount=[],this.symbol=[]}render(){return M` ${UP[this.type]||this.type} ${this.templateDescription()} ${this.templateSecondDescription()} ${this.date} `}templateDescription(){var r;const e=(r=this.descriptions)==null?void 0:r[0];return e?M` ${e} `:null}templateSecondDescription(){var r;const e=(r=this.descriptions)==null?void 0:r[1];return e?M` ${e} `:null}};Is.styles=[He,p8e];oa([q()],Is.prototype,"type",void 0);oa([q({type:Array})],Is.prototype,"descriptions",void 0);oa([q()],Is.prototype,"date",void 0);oa([q({type:Boolean})],Is.prototype,"onlyDirectionIcon",void 0);oa([q()],Is.prototype,"status",void 0);oa([q()],Is.prototype,"direction",void 0);oa([q({type:Array})],Is.prototype,"images",void 0);oa([q({type:Array})],Is.prototype,"price",void 0);oa([q({type:Array})],Is.prototype,"amount",void 0);oa([q({type:Array})],Is.prototype,"symbol",void 0);Is=oa([te("wui-transaction-list-item")],Is);const g8e=de` :host { min-height: 100%; } .group-container[last-group='true'] { padding-bottom: var(--wui-spacing-m); } .contentContainer { height: 280px; } .contentContainer > wui-icon-box { width: 40px; height: 40px; border-radius: var(--wui-border-radius-xxs); } .contentContainer > .textContent { width: 65%; } .emptyContainer { height: 100%; } `;var kp=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};const O3="last-transaction",m8e=7;let Uu=class extends se{constructor(){super(),this.unsubscribe=[],this.paginationObserver=void 0,this.page="activity",this.caipAddress=F.state.activeCaipAddress,this.transactionsByYear=Dr.state.transactionsByYear,this.loading=Dr.state.loading,this.empty=Dr.state.empty,this.next=Dr.state.next,Dr.clearCursor(),this.unsubscribe.push(F.subscribeKey("activeCaipAddress",e=>{e&&this.caipAddress!==e&&(Dr.resetTransactions(),Dr.fetchTransactions(e)),this.caipAddress=e}),F.subscribeKey("activeCaipNetwork",()=>{this.updateTransactionView()}),Dr.subscribe(e=>{this.transactionsByYear=e.transactionsByYear,this.loading=e.loading,this.empty=e.empty,this.next=e.next}))}firstUpdated(){this.updateTransactionView(),this.createPaginationObserver()}updated(){this.setPaginationObserver()}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return M` ${this.empty?null:this.templateTransactionsByYear()} ${this.loading?this.templateLoading():null} ${!this.loading&&this.empty?this.templateEmpty():null}`}updateTransactionView(){var n;const e=(n=F.state.activeCaipNetwork)==null?void 0:n.caipNetworkId;Dr.state.lastNetworkInView!==e&&(Dr.resetTransactions(),this.caipAddress&&Dr.fetchTransactions(ue.getPlainAddress(this.caipAddress))),Dr.setLastNetworkInView(e)}templateTransactionsByYear(){return Object.keys(this.transactionsByYear).sort().reverse().map(r=>{const n=parseInt(r,10),i=new Array(12).fill(null).map((s,o)=>{var u;const a=Xh.getTransactionGroupTitle(n,o),c=(u=this.transactionsByYear[n])==null?void 0:u[o];return{groupTitle:a,transactions:c}}).filter(({transactions:s})=>s).reverse();return i.map(({groupTitle:s,transactions:o},a)=>{const c=a===i.length-1;return o?M` ${s} ${this.templateTransactions(o,c)} `:null})})}templateRenderTransaction(e,r){const{date:n,descriptions:i,direction:s,isAllNFT:o,images:a,status:c,transfers:u,type:l}=this.getTransactionListItemProps(e),d=(u==null?void 0:u.length)>1;return(u==null?void 0:u.length)===2&&!o?M` `:d?u.map((f,g)=>{const p=Xh.getTransferDescription(f),m=r&&g===u.length-1;return M` `}):M` `}templateTransactions(e,r){return e.map((n,i)=>{const s=r&&i===e.length-1;return M`${this.templateRenderTransaction(n,s)}`})}emptyStateActivity(){return M` No Transactions yet Start trading on dApps
to grow your wallet!
`}emptyStateAccount(){return M` No activity yet Your next transactions will appear here Trade `}templateEmpty(){return this.page==="account"?M`${this.emptyStateAccount()}`:M`${this.emptyStateActivity()}`}templateLoading(){return this.page==="activity"?Array(m8e).fill(M` `).map(e=>e):null}onReceiveClick(){X.push("WalletReceive")}createPaginationObserver(){const e=F.state.activeChain,{projectId:r}=oe.state;this.paginationObserver=new IntersectionObserver(([n])=>{var i;n!=null&&n.isIntersecting&&!this.loading&&(Dr.fetchTransactions(ue.getPlainAddress(this.caipAddress)),Re.sendEvent({type:"track",event:"LOAD_MORE_TRANSACTIONS",properties:{address:ue.getPlainAddress(this.caipAddress),projectId:r,cursor:this.next,isSmartAccount:((i=re.state.preferredAccountTypes)==null?void 0:i[e])===bt.ACCOUNT_TYPES.SMART_ACCOUNT}}))},{}),this.setPaginationObserver()}setPaginationObserver(){var r,n,i;(r=this.paginationObserver)==null||r.disconnect();const e=(n=this.shadowRoot)==null?void 0:n.querySelector(`#${O3}`);e&&((i=this.paginationObserver)==null||i.observe(e))}getTransactionListItemProps(e){var c,u,l,d,h;const r=bC.formatDate((c=e==null?void 0:e.metadata)==null?void 0:c.minedAt),n=Xh.getTransactionDescriptions(e),i=e==null?void 0:e.transfers,s=(u=e==null?void 0:e.transfers)==null?void 0:u[0],o=!!s&&((l=e==null?void 0:e.transfers)==null?void 0:l.every(f=>!!f.nft_info)),a=Xh.getTransactionImages(i);return{date:r,direction:s==null?void 0:s.direction,descriptions:n,isAllNFT:o,images:a,status:(d=e.metadata)==null?void 0:d.status,transfers:i,type:(h=e.metadata)==null?void 0:h.operationType}}};Uu.styles=g8e;kp([q()],Uu.prototype,"page",void 0);kp([G()],Uu.prototype,"caipAddress",void 0);kp([G()],Uu.prototype,"transactionsByYear",void 0);kp([G()],Uu.prototype,"loading",void 0);kp([G()],Uu.prototype,"empty",void 0);kp([G()],Uu.prototype,"next",void 0);Uu=kp([te("w3m-activity-list")],Uu);const w8e=de` :host > wui-flex:first-child { height: 500px; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; } :host > wui-flex:first-child::-webkit-scrollbar { display: none; } `;var b8e=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let f6=class extends se{render(){return M` `}};f6.styles=w8e;f6=b8e([te("w3m-transactions-view")],f6);const y8e=Object.freeze(Object.defineProperty({__proto__:null,get W3mTransactionsView(){return f6}},Symbol.toStringTag,{value:"Module"})),v8e=de` :host { position: relative; } button { display: flex; justify-content: center; align-items: center; height: 48px; width: 100%; background-color: var(--wui-color-accent-glass-010); border-radius: var(--wui-border-radius-xs); border: 1px solid var(--wui-color-accent-glass-010); transition: background-color var(--wui-ease-out-power-1) var(--wui-duration-md); will-change: background-color; } wui-tooltip { padding: 7px var(--wui-spacing-s) 8px var(--wui-spacing-s); position: absolute; top: -8px; left: 50%; transform: translate(-50%, -100%); opacity: 0; display: none; } @media (hover: hover) and (pointer: fine) { button:hover:enabled { background-color: var(--wui-color-accent-glass-015); } button:active:enabled { background-color: var(--wui-color-accent-glass-020); } } `;var V7=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Hy=class extends se{constructor(){super(...arguments),this.text="",this.icon="card"}render(){return M``}};Hy.styles=[He,vt,v8e];V7([q()],Hy.prototype,"text",void 0);V7([q()],Hy.prototype,"icon",void 0);Hy=V7([te("wui-icon-button")],Hy);const _8e=Se` `,eQ=Se` `,E8e=Se` `,C8e=de` :host { position: relative; border-radius: inherit; display: flex; justify-content: center; align-items: center; width: var(--local-width); height: var(--local-height); } :host([data-round='true']) { background: var(--wui-color-gray-glass-002); border-radius: 100%; outline: 1px solid var(--wui-color-gray-glass-005); } svg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; fill: var(--wui-color-gray-glass-002); } svg > path { stroke: var(--local-stroke); } wui-image { width: 100%; height: 100%; -webkit-clip-path: var(--local-path); clip-path: var(--local-path); background: var(--wui-color-gray-glass-002); } wui-icon { transform: translateY(-5%); width: var(--local-icon-size); height: var(--local-icon-size); } `;var Np=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Fu=class extends se{constructor(){super(...arguments),this.size="md",this.name="uknown",this.networkImagesBySize={sm:E8e,md:eQ,lg:_8e},this.selected=!1,this.round=!1}render(){return this.round?(this.dataset.round="true",this.style.cssText=` --local-width: var(--wui-spacing-3xl); --local-height: var(--wui-spacing-3xl); --local-icon-size: var(--wui-spacing-l); `):this.style.cssText=` --local-path: var(--wui-path-network-${this.size}); --local-width: var(--wui-width-network-${this.size}); --local-height: var(--wui-height-network-${this.size}); --local-icon-size: var(--wui-icon-size-network-${this.size}); `,M`${this.templateVisual()} ${this.svgTemplate()} `}svgTemplate(){return this.round?null:this.networkImagesBySize[this.size]}templateVisual(){return this.imageSrc?M``:M``}};Fu.styles=[He,C8e];Np([q()],Fu.prototype,"size",void 0);Np([q()],Fu.prototype,"name",void 0);Np([q({type:Object})],Fu.prototype,"networkImagesBySize",void 0);Np([q()],Fu.prototype,"imageSrc",void 0);Np([q({type:Boolean})],Fu.prototype,"selected",void 0);Np([q({type:Boolean})],Fu.prototype,"round",void 0);Fu=Np([te("wui-network-image")],Fu);const A8e=de` :host { position: relative; background-color: var(--wui-color-gray-glass-002); display: flex; justify-content: center; align-items: center; width: var(--local-size); height: var(--local-size); border-radius: inherit; border-radius: var(--local-border-radius); } :host > wui-flex { overflow: hidden; border-radius: inherit; border-radius: var(--local-border-radius); } :host::after { content: ''; position: absolute; top: 0; bottom: 0; left: 0; right: 0; border-radius: inherit; border: 1px solid var(--wui-color-gray-glass-010); pointer-events: none; } :host([name='Extension'])::after { border: 1px solid var(--wui-color-accent-glass-010); } :host([data-wallet-icon='allWallets']) { background-color: var(--wui-all-wallets-bg-100); } :host([data-wallet-icon='allWallets'])::after { border: 1px solid var(--wui-color-accent-glass-010); } wui-icon[data-parent-size='inherit'] { width: 75%; height: 75%; align-items: center; } wui-icon[data-parent-size='sm'] { width: 18px; height: 18px; } wui-icon[data-parent-size='md'] { width: 24px; height: 24px; } wui-icon[data-parent-size='lg'] { width: 42px; height: 42px; } wui-icon[data-parent-size='full'] { width: 100%; height: 100%; } :host > wui-icon-box { position: absolute; overflow: hidden; right: -1px; bottom: -2px; z-index: 1; border: 2px solid var(--wui-color-bg-150, #1e1f1f); padding: 1px; } `;var $p=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Hu=class extends se{constructor(){super(...arguments),this.size="md",this.name="",this.installed=!1,this.badgeSize="xs"}render(){let e="xxs";return this.size==="lg"?e="m":this.size==="md"?e="xs":e="xxs",this.style.cssText=` --local-border-radius: var(--wui-border-radius-${e}); --local-size: var(--wui-wallet-image-size-${this.size}); `,this.walletIcon&&(this.dataset.walletIcon=this.walletIcon),M` ${this.templateVisual()} `}templateVisual(){return this.imageSrc?M``:this.walletIcon?M``:M``}};Hu.styles=[vt,He,A8e];$p([q()],Hu.prototype,"size",void 0);$p([q()],Hu.prototype,"name",void 0);$p([q()],Hu.prototype,"imageSrc",void 0);$p([q()],Hu.prototype,"walletIcon",void 0);$p([q({type:Boolean})],Hu.prototype,"installed",void 0);$p([q()],Hu.prototype,"badgeSize",void 0);Hu=$p([te("wui-wallet-image")],Hu);const It={INVALID_PAYMENT_CONFIG:"INVALID_PAYMENT_CONFIG",INVALID_RECIPIENT:"INVALID_RECIPIENT",INVALID_ASSET:"INVALID_ASSET",INVALID_AMOUNT:"INVALID_AMOUNT",UNKNOWN_ERROR:"UNKNOWN_ERROR",UNABLE_TO_INITIATE_PAYMENT:"UNABLE_TO_INITIATE_PAYMENT",INVALID_CHAIN_NAMESPACE:"INVALID_CHAIN_NAMESPACE",GENERIC_PAYMENT_ERROR:"GENERIC_PAYMENT_ERROR",UNABLE_TO_GET_EXCHANGES:"UNABLE_TO_GET_EXCHANGES",ASSET_NOT_SUPPORTED:"ASSET_NOT_SUPPORTED",UNABLE_TO_GET_PAY_URL:"UNABLE_TO_GET_PAY_URL",UNABLE_TO_GET_BUY_STATUS:"UNABLE_TO_GET_BUY_STATUS"},X0={[It.INVALID_PAYMENT_CONFIG]:"Invalid payment configuration",[It.INVALID_RECIPIENT]:"Invalid recipient address",[It.INVALID_ASSET]:"Invalid asset specified",[It.INVALID_AMOUNT]:"Invalid payment amount",[It.UNKNOWN_ERROR]:"Unknown payment error occurred",[It.UNABLE_TO_INITIATE_PAYMENT]:"Unable to initiate payment",[It.INVALID_CHAIN_NAMESPACE]:"Invalid chain namespace",[It.GENERIC_PAYMENT_ERROR]:"Unable to process payment",[It.UNABLE_TO_GET_EXCHANGES]:"Unable to get exchanges",[It.ASSET_NOT_SUPPORTED]:"Asset not supported by the selected exchange",[It.UNABLE_TO_GET_PAY_URL]:"Unable to get payment URL",[It.UNABLE_TO_GET_BUY_STATUS]:"Unable to get buy status"};class Qt extends Error{get message(){return X0[this.code]}constructor(e,r){super(X0[e]),this.name="AppKitPayError",this.code=e,this.details=r,Error.captureStackTrace&&Error.captureStackTrace(this,Qt)}}const x8e="https://rpc.walletconnect.org/v1/json-rpc";class S8e extends Error{}function T8e(){const t=oe.getSnapshot().projectId;return`${x8e}?projectId=${t}`}async function G7(t,e){const r=T8e(),s=await(await fetch(r,{method:"POST",body:JSON.stringify({jsonrpc:"2.0",id:1,method:t,params:e}),headers:{"Content-Type":"application/json"}})).json();if(s.error)throw new S8e(s.error.message);return s}async function AD(t){return(await G7("reown_getExchanges",t)).result}async function I8e(t){return(await G7("reown_getExchangePayUrl",t)).result}async function P8e(t){return(await G7("reown_getExchangeBuyStatus",t)).result}const O8e=["eip155"],R8e={eip155:{native:{assetNamespace:"slip44",assetReference:"60"},defaultTokenNamespace:"erc20"},solana:{native:{assetNamespace:"slip44",assetReference:"501"},defaultTokenNamespace:"token"}};function iT(t,e){const{chainNamespace:r,chainId:n}=bs.parseCaipNetworkId(t),i=R8e[r];if(!i)throw new Error(`Unsupported chain namespace for CAIP-19 formatting: ${r}`);let s=i.native.assetNamespace,o=i.native.assetReference;return e!=="native"&&(s=i.defaultTokenNamespace,o=e),`${`${r}:${n}`}/${s}:${o}`}function k8e(t){const{chainNamespace:e}=bs.parseCaipNetworkId(t);return O8e.includes(e)}async function N8e(t){const{paymentAssetNetwork:e,activeCaipNetwork:r,approvedCaipNetworkIds:n,requestedCaipNetworks:i}=t,o=ue.sortRequestedNetworks(n,i).find(u=>u.caipNetworkId===e);if(!o)throw new Qt(It.INVALID_PAYMENT_CONFIG);if(o.caipNetworkId===r.caipNetworkId)return;const a=F.getNetworkProp("supportsAllNetworks",o.chainNamespace);if(!((n==null?void 0:n.includes(o.caipNetworkId))||a))throw new Qt(It.INVALID_PAYMENT_CONFIG);try{await F.switchActiveNetwork(o)}catch(u){throw new Qt(It.GENERIC_PAYMENT_ERROR,u)}}async function $8e(t,e,r){var a;if(e!==_e.CHAIN.EVM)throw new Qt(It.INVALID_CHAIN_NAMESPACE);if(!r.fromAddress)throw new Qt(It.INVALID_PAYMENT_CONFIG,"fromAddress is required for native EVM payments.");const n=typeof r.amount=="string"?parseFloat(r.amount):r.amount;if(isNaN(n))throw new Qt(It.INVALID_PAYMENT_CONFIG);const i=((a=t.metadata)==null?void 0:a.decimals)??18,s=xe.parseUnits(n.toString(),i);if(typeof s!="bigint")throw new Qt(It.GENERIC_PAYMENT_ERROR);return await xe.sendTransaction({chainNamespace:e,to:r.recipient,address:r.fromAddress,value:s,data:"0x"})??void 0}async function j8e(t,e){if(!e.fromAddress)throw new Qt(It.INVALID_PAYMENT_CONFIG,"fromAddress is required for ERC20 EVM payments.");const r=t.asset,n=e.recipient,i=Number(t.metadata.decimals),s=xe.parseUnits(e.amount.toString(),i);if(s===void 0)throw new Qt(It.GENERIC_PAYMENT_ERROR);return await xe.writeContract({fromAddress:e.fromAddress,tokenAddress:r,args:[n,s],method:"transfer",abi:TV.getERC20Abi(r),chainNamespace:_e.CHAIN.EVM})??void 0}const xD=0,sT="unknown",Oe=rr({paymentAsset:{network:"eip155:1",asset:"0x0",metadata:{name:"0x0",symbol:"0x0",decimals:0}},recipient:"0x0",amount:0,isConfigured:!1,error:null,isPaymentInProgress:!1,exchanges:[],isLoading:!1,openInNewTab:!0,redirectUrl:void 0,payWithExchange:void 0,currentPayment:void 0,analyticsSet:!1,paymentId:void 0}),Or={state:Oe,subscribe(t){return ln(Oe,()=>t(Oe))},subscribeKey(t,e){return dn(Oe,t,e)},async handleOpenPay(t){this.resetState(),this.setPaymentConfig(t),this.subscribeEvents(),this.initializeAnalytics(),Oe.isConfigured=!0,Re.sendEvent({type:"track",event:"PAY_MODAL_OPEN",properties:{exchanges:Oe.exchanges,configuration:{network:Oe.paymentAsset.network,asset:Oe.paymentAsset.asset,recipient:Oe.recipient,amount:Oe.amount}}}),await We.open({view:"Pay"})},resetState(){Oe.paymentAsset={network:"eip155:1",asset:"0x0",metadata:{name:"0x0",symbol:"0x0",decimals:0}},Oe.recipient="0x0",Oe.amount=0,Oe.isConfigured=!1,Oe.error=null,Oe.isPaymentInProgress=!1,Oe.isLoading=!1,Oe.currentPayment=void 0},setPaymentConfig(t){if(!t.paymentAsset)throw new Qt(It.INVALID_PAYMENT_CONFIG);try{Oe.paymentAsset=t.paymentAsset,Oe.recipient=t.recipient,Oe.amount=t.amount,Oe.openInNewTab=t.openInNewTab??!0,Oe.redirectUrl=t.redirectUrl,Oe.payWithExchange=t.payWithExchange,Oe.error=null}catch(e){throw new Qt(It.INVALID_PAYMENT_CONFIG,e.message)}},getPaymentAsset(){return Oe.paymentAsset},getExchanges(){return Oe.exchanges},async fetchExchanges(){try{Oe.isLoading=!0;const t=await AD({page:xD,asset:iT(Oe.paymentAsset.network,Oe.paymentAsset.asset),amount:Oe.amount.toString()});Oe.exchanges=t.exchanges.slice(0,2)}catch{throw Fe.showError(X0.UNABLE_TO_GET_EXCHANGES),new Qt(It.UNABLE_TO_GET_EXCHANGES)}finally{Oe.isLoading=!1}},async getAvailableExchanges(t){var e;try{const r=t!=null&&t.asset&&(t!=null&&t.network)?iT(t.network,t.asset):void 0;return await AD({page:(t==null?void 0:t.page)??xD,asset:r,amount:(e=t==null?void 0:t.amount)==null?void 0:e.toString()})}catch{throw new Qt(It.UNABLE_TO_GET_EXCHANGES)}},async getPayUrl(t,e,r=!1){try{const n=Number(e.amount),i=await I8e({exchangeId:t,asset:iT(e.network,e.asset),amount:n.toString(),recipient:`${e.network}:${e.recipient}`});return Re.sendEvent({type:"track",event:"PAY_EXCHANGE_SELECTED",properties:{exchange:{id:t},configuration:{network:e.network,asset:e.asset,recipient:e.recipient,amount:n},currentPayment:{type:"exchange",exchangeId:t},headless:r}}),r&&(this.initiatePayment(),Re.sendEvent({type:"track",event:"PAY_INITIATED",properties:{paymentId:Oe.paymentId||sT,configuration:{network:e.network,asset:e.asset,recipient:e.recipient,amount:n},currentPayment:{type:"exchange",exchangeId:t}}})),i}catch(n){throw n instanceof Error&&n.message.includes("is not supported")?new Qt(It.ASSET_NOT_SUPPORTED):new Error(n.message)}},async openPayUrl(t,e,r=!1){try{const n=await this.getPayUrl(t.exchangeId,e,r);if(!n)throw new Qt(It.UNABLE_TO_GET_PAY_URL);const s=t.openInNewTab??!0?"_blank":"_self";return ue.openHref(n.url,s),n}catch(n){throw n instanceof Qt?Oe.error=n.message:Oe.error=X0.GENERIC_PAYMENT_ERROR,new Qt(It.UNABLE_TO_GET_PAY_URL)}},subscribeEvents(){Oe.isConfigured||(kt.subscribeProviders(async t=>{const e=F.state.activeChain;kt.getProvider(e)&&await this.handlePayment()}),re.subscribeKey("caipAddress",async t=>{t&&await this.handlePayment()}))},async handlePayment(){Oe.currentPayment={type:"wallet",status:"IN_PROGRESS"};const t=re.state.caipAddress;if(!t)return;const{chainId:e,address:r}=bs.parseCaipAddress(t),n=F.state.activeChain;if(!r||!e||!n||!kt.getProvider(n))return;const s=F.state.activeCaipNetwork;if(s&&!Oe.isPaymentInProgress)try{this.initiatePayment();const o=F.getAllRequestedCaipNetworks(),a=F.getAllApprovedCaipNetworkIds();switch(await N8e({paymentAssetNetwork:Oe.paymentAsset.network,activeCaipNetwork:s,approvedCaipNetworkIds:a,requestedCaipNetworks:o}),await We.open({view:"PayLoading"}),n){case _e.CHAIN.EVM:Oe.paymentAsset.asset==="native"&&(Oe.currentPayment.result=await $8e(Oe.paymentAsset,n,{recipient:Oe.recipient,amount:Oe.amount,fromAddress:r})),Oe.paymentAsset.asset.startsWith("0x")&&(Oe.currentPayment.result=await j8e(Oe.paymentAsset,{recipient:Oe.recipient,amount:Oe.amount,fromAddress:r})),Oe.currentPayment.status="SUCCESS";break;default:throw new Qt(It.INVALID_CHAIN_NAMESPACE)}}catch(o){o instanceof Qt?Oe.error=o.message:Oe.error=X0.GENERIC_PAYMENT_ERROR,Oe.currentPayment.status="FAILED",Fe.showError(Oe.error)}finally{Oe.isPaymentInProgress=!1}},getExchangeById(t){return Oe.exchanges.find(e=>e.id===t)},validatePayConfig(t){const{paymentAsset:e,recipient:r,amount:n}=t;if(!e)throw new Qt(It.INVALID_PAYMENT_CONFIG);if(!r)throw new Qt(It.INVALID_RECIPIENT);if(!e.asset)throw new Qt(It.INVALID_ASSET);if(n==null||n<=0)throw new Qt(It.INVALID_AMOUNT)},handlePayWithWallet(){const t=re.state.caipAddress;if(!t){X.push("Connect");return}const{chainId:e,address:r}=bs.parseCaipAddress(t),n=F.state.activeChain;if(!r||!e||!n){X.push("Connect");return}this.handlePayment()},async handlePayWithExchange(t){try{Oe.currentPayment={type:"exchange",exchangeId:t};const{network:e,asset:r}=Oe.paymentAsset,n={network:e,asset:r,amount:Oe.amount,recipient:Oe.recipient},i=await this.getPayUrl(t,n);if(!i)throw new Qt(It.UNABLE_TO_INITIATE_PAYMENT);return Oe.currentPayment.sessionId=i.sessionId,Oe.currentPayment.status="IN_PROGRESS",Oe.currentPayment.exchangeId=t,this.initiatePayment(),{url:i.url,openInNewTab:Oe.openInNewTab}}catch(e){return e instanceof Qt?Oe.error=e.message:Oe.error=X0.GENERIC_PAYMENT_ERROR,Oe.isPaymentInProgress=!1,Fe.showError(Oe.error),null}},async getBuyStatus(t,e){var r,n;try{const i=await P8e({sessionId:e,exchangeId:t});return(i.status==="SUCCESS"||i.status==="FAILED")&&Re.sendEvent({type:"track",event:i.status==="SUCCESS"?"PAY_SUCCESS":"PAY_ERROR",properties:{paymentId:Oe.paymentId||sT,configuration:{network:Oe.paymentAsset.network,asset:Oe.paymentAsset.asset,recipient:Oe.recipient,amount:Oe.amount},currentPayment:{type:"exchange",exchangeId:(r=Oe.currentPayment)==null?void 0:r.exchangeId,sessionId:(n=Oe.currentPayment)==null?void 0:n.sessionId,result:i.txHash}}}),i}catch{throw new Qt(It.UNABLE_TO_GET_BUY_STATUS)}},async updateBuyStatus(t,e){try{const r=await this.getBuyStatus(t,e);Oe.currentPayment&&(Oe.currentPayment.status=r.status,Oe.currentPayment.result=r.txHash),(r.status==="SUCCESS"||r.status==="FAILED")&&(Oe.isPaymentInProgress=!1)}catch{throw new Qt(It.UNABLE_TO_GET_BUY_STATUS)}},initiatePayment(){Oe.isPaymentInProgress=!0,Oe.paymentId=crypto.randomUUID()},initializeAnalytics(){Oe.analyticsSet||(Oe.analyticsSet=!0,this.subscribeKey("isPaymentInProgress",t=>{var e;if((e=Oe.currentPayment)!=null&&e.status&&Oe.currentPayment.status!=="UNKNOWN"){const r={IN_PROGRESS:"PAY_INITIATED",SUCCESS:"PAY_SUCCESS",FAILED:"PAY_ERROR"}[Oe.currentPayment.status];Re.sendEvent({type:"track",event:r,properties:{paymentId:Oe.paymentId||sT,configuration:{network:Oe.paymentAsset.network,asset:Oe.paymentAsset.asset,recipient:Oe.recipient,amount:Oe.amount},currentPayment:{type:Oe.currentPayment.type,exchangeId:Oe.currentPayment.exchangeId,sessionId:Oe.currentPayment.sessionId,result:Oe.currentPayment.result}}})}}))}},B8e=de` wui-separator { margin: var(--wui-spacing-m) calc(var(--wui-spacing-m) * -1) var(--wui-spacing-xs) calc(var(--wui-spacing-m) * -1); width: calc(100% + var(--wui-spacing-s) * 2); } .token-display { padding: var(--wui-spacing-s) var(--wui-spacing-m); border-radius: var(--wui-border-radius-s); background-color: var(--wui-color-bg-125); margin-top: var(--wui-spacing-s); margin-bottom: var(--wui-spacing-s); } .token-display wui-text { text-transform: none; } wui-loading-spinner { padding: var(--wui-spacing-xs); } `;var Hd=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Xo=class extends se{constructor(){super(),this.unsubscribe=[],this.amount="",this.tokenSymbol="",this.networkName="",this.exchanges=Or.state.exchanges,this.isLoading=Or.state.isLoading,this.loadingExchangeId=null,this.connectedWalletInfo=re.state.connectedWalletInfo,this.initializePaymentDetails(),this.unsubscribe.push(Or.subscribeKey("exchanges",e=>this.exchanges=e)),this.unsubscribe.push(Or.subscribeKey("isLoading",e=>this.isLoading=e)),this.unsubscribe.push(re.subscribe(e=>this.connectedWalletInfo=e.connectedWalletInfo)),Or.fetchExchanges()}get isWalletConnected(){return re.state.status==="connected"}render(){return M` ${this.renderPaymentHeader()} ${this.renderPayWithWallet()} ${this.renderExchangeOptions()} `}initializePaymentDetails(){const e=Or.getPaymentAsset();this.networkName=e.network,this.tokenSymbol=e.metadata.symbol,this.amount=Or.state.amount.toString()}renderPayWithWallet(){return k8e(this.networkName)?M` ${this.isWalletConnected?this.renderConnectedView():this.renderDisconnectedView()} `:M``}renderPaymentHeader(){let e=this.networkName;if(this.networkName){const n=F.getAllRequestedCaipNetworks().find(i=>i.caipNetworkId===this.networkName);n&&(e=n.name)}return M` ${this.amount||"0.0000"} ${this.tokenSymbol||"Unknown Asset"} ${e?M` on ${e} `:""} `}renderConnectedView(){var r,n,i;const e=((r=this.connectedWalletInfo)==null?void 0:r.name)||"connected wallet";return M` Pay with ${e} Disconnect `}renderDisconnectedView(){return M` Pay from wallet `}renderExchangeOptions(){return this.isLoading?M` `:this.exchanges.length===0?M` No exchanges available `:this.exchanges.map(e=>M` this.onExchangePayment(e.id)} data-testid="exchange-option-${e.id}" ?chevron=${!0} ?disabled=${this.loadingExchangeId!==null} > ${this.loadingExchangeId===e.id?M``:M``} Pay with ${e.name} `)}onWalletPayment(){Or.handlePayWithWallet()}async onExchangePayment(e){try{this.loadingExchangeId=e;const r=await Or.handlePayWithExchange(e);r&&(await We.open({view:"PayLoading"}),ue.openHref(r.url,r.openInNewTab?"_blank":"_self"))}catch(r){console.error("Failed to pay with exchange",r),Fe.showError("Failed to pay with exchange")}finally{this.loadingExchangeId=null}}async onDisconnect(e){e.stopPropagation();try{await xe.disconnect(),We.close()}catch{console.error("Failed to disconnect"),Fe.showError("Failed to disconnect")}}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}};Xo.styles=B8e;Hd([G()],Xo.prototype,"amount",void 0);Hd([G()],Xo.prototype,"tokenSymbol",void 0);Hd([G()],Xo.prototype,"networkName",void 0);Hd([G()],Xo.prototype,"exchanges",void 0);Hd([G()],Xo.prototype,"isLoading",void 0);Hd([G()],Xo.prototype,"loadingExchangeId",void 0);Hd([G()],Xo.prototype,"connectedWalletInfo",void 0);Xo=Hd([te("w3m-pay-view")],Xo);const D8e=de` :host { display: block; height: 100%; width: 100%; } `;var kA=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};const M8e=4e3;let op=class extends se{constructor(){super(),this.loadingMessage="",this.subMessage="",this.paymentState="in-progress",this.paymentState=Or.state.isPaymentInProgress?"in-progress":"completed",this.updateMessages(),this.setupSubscription(),this.setupExchangeSubscription()}disconnectedCallback(){clearInterval(this.exchangeSubscription)}render(){return M` ${this.getStateIcon()} ${this.loadingMessage} ${this.subMessage} `}updateMessages(){var e;switch(this.paymentState){case"completed":this.loadingMessage="Payment completed",this.subMessage="Your transaction has been successfully processed";break;case"error":this.loadingMessage="Payment failed",this.subMessage="There was an error processing your transaction";break;case"in-progress":default:((e=Or.state.currentPayment)==null?void 0:e.type)==="exchange"?(this.loadingMessage="Payment initiated",this.subMessage="Please complete the payment on the exchange"):(this.loadingMessage="Awaiting payment confirmation",this.subMessage="Please confirm the payment transaction in your wallet");break}}getStateIcon(){switch(this.paymentState){case"completed":return this.successTemplate();case"error":return this.errorTemplate();case"in-progress":default:return this.loaderTemplate()}}setupExchangeSubscription(){var e;((e=Or.state.currentPayment)==null?void 0:e.type)==="exchange"&&(this.exchangeSubscription=setInterval(async()=>{var i,s,o;const r=(i=Or.state.currentPayment)==null?void 0:i.exchangeId,n=(s=Or.state.currentPayment)==null?void 0:s.sessionId;r&&n&&(await Or.updateBuyStatus(r,n),((o=Or.state.currentPayment)==null?void 0:o.status)==="SUCCESS"&&clearInterval(this.exchangeSubscription))},M8e))}setupSubscription(){Or.subscribeKey("isPaymentInProgress",e=>{var r;!e&&this.paymentState==="in-progress"&&(Or.state.error||!((r=Or.state.currentPayment)!=null&&r.result)?this.paymentState="error":this.paymentState="completed",this.updateMessages(),setTimeout(()=>{xe.state.status!=="disconnected"&&We.close()},3e3))}),Or.subscribeKey("error",e=>{e&&this.paymentState==="in-progress"&&(this.paymentState="error",this.updateMessages())})}loaderTemplate(){const e=ar.state.themeVariables["--w3m-border-radius-master"],r=e?parseInt(e.replace("px",""),10):4;return M``}successTemplate(){return M``}errorTemplate(){return M``}};op.styles=D8e;kA([G()],op.prototype,"loadingMessage",void 0);kA([G()],op.prototype,"subMessage",void 0);kA([G()],op.prototype,"paymentState",void 0);op=kA([te("w3m-pay-loading-view")],op);async function L8e(t){return Or.handleOpenPay(t)}function U8e(){return Or.getExchanges()}function F8e(){var t;return(t=Or.state.currentPayment)==null?void 0:t.result}function H8e(){return Or.state.error}function q8e(){return Or.state.isPaymentInProgress}const z8e={network:"eip155:8453",asset:"native",metadata:{name:"Ethereum",symbol:"ETH",decimals:18}},W8e={network:"eip155:8453",asset:"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",metadata:{name:"USD Coin",symbol:"USDC",decimals:6}},V8e={network:"eip155:84532",asset:"native",metadata:{name:"Ethereum",symbol:"ETH",decimals:18}},G8e=Object.freeze(Object.defineProperty({__proto__:null,get W3mPayLoadingView(){return op},get W3mPayView(){return Xo},baseETH:z8e,baseSepoliaETH:V8e,baseUSDC:W8e,getExchanges:U8e,getIsPaymentInProgress:q8e,getPayError:H8e,getPayResult:F8e,openPay:L8e},Symbol.toStringTag,{value:"Module"})),K8e=de` :host { display: block; } button { border-radius: var(--wui-border-radius-3xl); background: var(--wui-color-gray-glass-002); display: flex; gap: var(--wui-spacing-xs); padding: var(--wui-spacing-3xs) var(--wui-spacing-xs) var(--wui-spacing-3xs) var(--wui-spacing-xs); border: 1px solid var(--wui-color-gray-glass-005); } button:disabled { background: var(--wui-color-gray-glass-015); } button:disabled > wui-text { color: var(--wui-color-gray-glass-015); } button:disabled > wui-flex > wui-text { color: var(--wui-color-gray-glass-015); } button:disabled > wui-image, button:disabled > wui-flex > wui-avatar { filter: grayscale(1); } button:has(wui-image) { padding: var(--wui-spacing-3xs) var(--wui-spacing-3xs) var(--wui-spacing-3xs) var(--wui-spacing-xs); } wui-text { color: var(--wui-color-fg-100); } wui-flex > wui-text { color: var(--wui-color-fg-200); } wui-image, wui-icon-box { border-radius: var(--wui-border-radius-3xl); width: 24px; height: 24px; box-shadow: 0 0 0 2px var(--wui-color-gray-glass-005); } wui-flex { border-radius: var(--wui-border-radius-3xl); border: 1px solid var(--wui-color-gray-glass-005); background: var(--wui-color-gray-glass-005); padding: 4px var(--wui-spacing-m) 4px var(--wui-spacing-xxs); } button.local-no-balance { border-radius: 0px; border: none; background: transparent; } wui-avatar { width: 20px; height: 20px; box-shadow: 0 0 0 2px var(--wui-color-accent-glass-010); } @media (max-width: 500px) { button { gap: 0px; padding: var(--wui-spacing-3xs) var(--wui-spacing-xs) !important; height: 32px; } wui-image, wui-icon-box, button > wui-text { visibility: hidden; width: 0px; height: 0px; } button { border-radius: 0px; border: none; background: transparent; padding: 0px; } } @media (hover: hover) and (pointer: fine) { button:hover:enabled > wui-flex > wui-text { color: var(--wui-color-fg-175); } button:active:enabled > wui-flex > wui-text { color: var(--wui-color-fg-175); } } `;var aa=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Ps=class extends se{constructor(){super(...arguments),this.networkSrc=void 0,this.avatarSrc=void 0,this.balance=void 0,this.isUnsupportedChain=void 0,this.disabled=!1,this.loading=!1,this.address="",this.profileName="",this.charsStart=4,this.charsEnd=6}render(){return M` `}balanceTemplate(){if(this.isUnsupportedChain)return M` Switch Network`;if(this.balance){const e=this.networkSrc?M``:M` `,r=this.loading?M``:M` ${this.balance}`;return M`${e} ${r}`}return null}};Ps.styles=[He,vt,K8e];aa([q()],Ps.prototype,"networkSrc",void 0);aa([q()],Ps.prototype,"avatarSrc",void 0);aa([q()],Ps.prototype,"balance",void 0);aa([q({type:Boolean})],Ps.prototype,"isUnsupportedChain",void 0);aa([q({type:Boolean})],Ps.prototype,"disabled",void 0);aa([q({type:Boolean})],Ps.prototype,"loading",void 0);aa([q()],Ps.prototype,"address",void 0);aa([q()],Ps.prototype,"profileName",void 0);aa([q()],Ps.prototype,"charsStart",void 0);aa([q()],Ps.prototype,"charsEnd",void 0);Ps=aa([te("wui-account-button")],Ps);var Oi=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};class Ri extends se{constructor(){var e,r,n,i,s,o;super(...arguments),this.unsubscribe=[],this.disabled=!1,this.balance="show",this.charsStart=4,this.charsEnd=6,this.namespace=void 0,this.caipAddress=(e=F.getAccountData(this.namespace))==null?void 0:e.caipAddress,this.balanceVal=(r=F.getAccountData(this.namespace))==null?void 0:r.balance,this.balanceSymbol=(n=F.getAccountData(this.namespace))==null?void 0:n.balanceSymbol,this.profileName=(i=F.getAccountData(this.namespace))==null?void 0:i.profileName,this.profileImage=(s=F.getAccountData(this.namespace))==null?void 0:s.profileImage,this.network=(o=F.getNetworkData(this.namespace))==null?void 0:o.caipNetwork,this.networkImage=pt.getNetworkImage(this.network),this.isSupported=oe.state.allowUnsupportedChain?!0:F.state.activeChain?F.checkIfSupportedNetwork(F.state.activeChain):!0}firstUpdated(){const e=this.namespace;e?this.unsubscribe.push(F.subscribeChainProp("accountState",r=>{this.caipAddress=r==null?void 0:r.caipAddress,this.balanceVal=r==null?void 0:r.balance,this.balanceSymbol=r==null?void 0:r.balanceSymbol,this.profileName=r==null?void 0:r.profileName,this.profileImage=r==null?void 0:r.profileImage},e),F.subscribeChainProp("networkState",r=>{this.network=r==null?void 0:r.caipNetwork,this.isSupported=F.checkIfSupportedNetwork(e,r==null?void 0:r.caipNetwork),this.networkImage=pt.getNetworkImage(r==null?void 0:r.caipNetwork)},e)):this.unsubscribe.push(er.subscribeNetworkImages(()=>{this.networkImage=pt.getNetworkImage(this.network)}),F.subscribeKey("activeCaipAddress",r=>{this.caipAddress=r}),re.subscribeKey("balance",r=>this.balanceVal=r),re.subscribeKey("balanceSymbol",r=>this.balanceSymbol=r),re.subscribeKey("profileName",r=>this.profileName=r),re.subscribeKey("profileImage",r=>this.profileImage=r),F.subscribeKey("activeCaipNetwork",r=>{this.network=r,this.networkImage=pt.getNetworkImage(r),this.isSupported=r!=null&&r.chainNamespace?F.checkIfSupportedNetwork(r==null?void 0:r.chainNamespace):!0,this.fetchNetworkImage(r)}))}updated(){this.fetchNetworkImage(this.network)}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){if(!F.state.activeChain)return null;const e=this.balance==="show",r=typeof this.balanceVal!="string";return M` `}onClick(){this.isSupported||oe.state.allowUnsupportedChain?We.open({namespace:this.namespace}):We.open({view:"UnsupportedChain"})}async fetchNetworkImage(e){var r,n;(r=e==null?void 0:e.assets)!=null&&r.imageId&&(this.networkImage=await pt.fetchNetworkImage((n=e==null?void 0:e.assets)==null?void 0:n.imageId))}}Oi([q({type:Boolean})],Ri.prototype,"disabled",void 0);Oi([q()],Ri.prototype,"balance",void 0);Oi([q()],Ri.prototype,"charsStart",void 0);Oi([q()],Ri.prototype,"charsEnd",void 0);Oi([q()],Ri.prototype,"namespace",void 0);Oi([G()],Ri.prototype,"caipAddress",void 0);Oi([G()],Ri.prototype,"balanceVal",void 0);Oi([G()],Ri.prototype,"balanceSymbol",void 0);Oi([G()],Ri.prototype,"profileName",void 0);Oi([G()],Ri.prototype,"profileImage",void 0);Oi([G()],Ri.prototype,"network",void 0);Oi([G()],Ri.prototype,"networkImage",void 0);Oi([G()],Ri.prototype,"isSupported",void 0);let FP=class extends Ri{};FP=Oi([te("w3m-account-button")],FP);let HP=class extends Ri{};HP=Oi([te("appkit-account-button")],HP);const Z8e=de` :host { display: block; width: max-content; } `;var ca=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};class ho extends se{constructor(){super(...arguments),this.unsubscribe=[],this.disabled=!1,this.balance=void 0,this.size=void 0,this.label=void 0,this.loadingLabel=void 0,this.charsStart=4,this.charsEnd=6,this.namespace=void 0,this.caipAddress=F.state.activeCaipAddress}firstUpdated(){this.namespace?this.unsubscribe.push(F.subscribeChainProp("accountState",e=>{this.caipAddress=e==null?void 0:e.caipAddress},this.namespace)):this.unsubscribe.push(F.subscribeKey("activeCaipAddress",e=>this.caipAddress=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return this.caipAddress?M` `:M` `}}ho.styles=Z8e;ca([q({type:Boolean})],ho.prototype,"disabled",void 0);ca([q()],ho.prototype,"balance",void 0);ca([q()],ho.prototype,"size",void 0);ca([q()],ho.prototype,"label",void 0);ca([q()],ho.prototype,"loadingLabel",void 0);ca([q()],ho.prototype,"charsStart",void 0);ca([q()],ho.prototype,"charsEnd",void 0);ca([q()],ho.prototype,"namespace",void 0);ca([G()],ho.prototype,"caipAddress",void 0);let qP=class extends ho{};qP=ca([te("w3m-button")],qP);let zP=class extends ho{};zP=ca([te("appkit-button")],zP);const Y8e=de` :host { position: relative; display: block; } button { background: var(--wui-color-accent-100); border: 1px solid var(--wui-color-gray-glass-010); border-radius: var(--wui-border-radius-m); gap: var(--wui-spacing-xs); } button.loading { background: var(--wui-color-gray-glass-010); border: 1px solid var(--wui-color-gray-glass-010); pointer-events: none; } button:disabled { background-color: var(--wui-color-gray-glass-015); border: 1px solid var(--wui-color-gray-glass-010); } button:disabled > wui-text { color: var(--wui-color-gray-glass-015); } @media (hover: hover) and (pointer: fine) { button:hover:enabled { background-color: var(--wui-color-accent-090); } button:active:enabled { background-color: var(--wui-color-accent-080); } } button:focus-visible { border: 1px solid var(--wui-color-gray-glass-010); background-color: var(--wui-color-accent-090); -webkit-box-shadow: 0px 0px 0px 4px var(--wui-box-shadow-blue); -moz-box-shadow: 0px 0px 0px 4px var(--wui-box-shadow-blue); box-shadow: 0px 0px 0px 4px var(--wui-box-shadow-blue); } button[data-size='sm'] { padding: 6.75px 10px 7.25px; } ::slotted(*) { transition: opacity var(--wui-ease-out-power-1) var(--wui-duration-md); will-change: opacity; opacity: var(--local-opacity-100); } button > wui-text { transition: opacity var(--wui-ease-out-power-1) var(--wui-duration-md); will-change: opacity; opacity: var(--local-opacity-100); color: var(--wui-color-inverse-100); } button[data-size='md'] { padding: 9px var(--wui-spacing-l) 9px var(--wui-spacing-l); } button[data-size='md'] + wui-text { padding-left: var(--wui-spacing-3xs); } @media (max-width: 500px) { button[data-size='md'] { height: 32px; padding: 5px 12px; } button[data-size='md'] > wui-text > slot { font-size: 14px !important; } } wui-loading-spinner { width: 14px; height: 14px; } wui-loading-spinner::slotted(svg) { width: 10px !important; height: 10px !important; } button[data-size='sm'] > wui-loading-spinner { width: 12px; height: 12px; } `;var K7=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let qy=class extends se{constructor(){super(...arguments),this.size="md",this.loading=!1}render(){const e=this.size==="md"?"paragraph-600":"small-600";return M` `}loadingTemplate(){return this.loading?M``:null}};qy.styles=[He,vt,Y8e];K7([q()],qy.prototype,"size",void 0);K7([q({type:Boolean})],qy.prototype,"loading",void 0);qy=K7([te("wui-connect-button")],qy);var qd=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};class zd extends se{constructor(){super(),this.unsubscribe=[],this.size="md",this.label="Connect Wallet",this.loadingLabel="Connecting...",this.open=We.state.open,this.loading=this.namespace?We.state.loadingNamespaceMap.get(this.namespace):We.state.loading,this.unsubscribe.push(We.subscribe(e=>{this.open=e.open,this.loading=this.namespace?e.loadingNamespaceMap.get(this.namespace):e.loading}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return M` ${this.loading?this.loadingLabel:this.label} `}onClick(){this.open?We.close():this.loading||We.open({view:"Connect",namespace:this.namespace})}}qd([q()],zd.prototype,"size",void 0);qd([q()],zd.prototype,"label",void 0);qd([q()],zd.prototype,"loadingLabel",void 0);qd([q()],zd.prototype,"namespace",void 0);qd([G()],zd.prototype,"open",void 0);qd([G()],zd.prototype,"loading",void 0);let WP=class extends zd{};WP=qd([te("w3m-connect-button")],WP);let VP=class extends zd{};VP=qd([te("appkit-connect-button")],VP);const J8e=de` :host { display: block; } button { border-radius: var(--wui-border-radius-3xl); display: flex; gap: var(--wui-spacing-xs); padding: var(--wui-spacing-2xs) var(--wui-spacing-s) var(--wui-spacing-2xs) var(--wui-spacing-xs); border: 1px solid var(--wui-color-gray-glass-010); background-color: var(--wui-color-gray-glass-005); color: var(--wui-color-fg-100); } button:disabled { border: 1px solid var(--wui-color-gray-glass-005); background-color: var(--wui-color-gray-glass-015); color: var(--wui-color-gray-glass-015); } @media (hover: hover) and (pointer: fine) { button:hover:enabled { background-color: var(--wui-color-gray-glass-010); } button:active:enabled { background-color: var(--wui-color-gray-glass-015); } } wui-image, wui-icon-box { border-radius: var(--wui-border-radius-3xl); width: 24px; height: 24px; box-shadow: 0 0 0 2px var(--wui-color-gray-glass-005); } `;var NA=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Dm=class extends se{constructor(){super(...arguments),this.imageSrc=void 0,this.isUnsupportedChain=void 0,this.disabled=!1}render(){return M` `}visualTemplate(){return this.isUnsupportedChain?M` `:this.imageSrc?M``:M` `}};Dm.styles=[He,vt,J8e];NA([q()],Dm.prototype,"imageSrc",void 0);NA([q({type:Boolean})],Dm.prototype,"isUnsupportedChain",void 0);NA([q({type:Boolean})],Dm.prototype,"disabled",void 0);Dm=NA([te("wui-network-button")],Dm);const Q8e=de` :host { display: block; width: max-content; } `;var Qu=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};class dc extends se{constructor(){super(),this.unsubscribe=[],this.disabled=!1,this.network=F.state.activeCaipNetwork,this.networkImage=pt.getNetworkImage(this.network),this.caipAddress=F.state.activeCaipAddress,this.loading=We.state.loading,this.isSupported=oe.state.allowUnsupportedChain?!0:F.state.activeChain?F.checkIfSupportedNetwork(F.state.activeChain):!0,this.unsubscribe.push(er.subscribeNetworkImages(()=>{this.networkImage=pt.getNetworkImage(this.network)}),F.subscribeKey("activeCaipAddress",e=>{this.caipAddress=e}),F.subscribeKey("activeCaipNetwork",e=>{var r;this.network=e,this.networkImage=pt.getNetworkImage(e),this.isSupported=e!=null&&e.chainNamespace?F.checkIfSupportedNetwork(e.chainNamespace):!0,pt.fetchNetworkImage((r=e==null?void 0:e.assets)==null?void 0:r.imageId)}),We.subscribeKey("loading",e=>this.loading=e))}firstUpdated(){var e,r;pt.fetchNetworkImage((r=(e=this.network)==null?void 0:e.assets)==null?void 0:r.imageId)}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){const e=this.network?F.checkIfSupportedNetwork(this.network.chainNamespace):!0;return M` ${this.getLabel()} `}getLabel(){return this.network?!this.isSupported&&!oe.state.allowUnsupportedChain?"Switch Network":this.network.name:this.label?this.label:this.caipAddress?"Unknown Network":"Select Network"}onClick(){this.loading||(Re.sendEvent({type:"track",event:"CLICK_NETWORKS"}),We.open({view:"Networks"}))}}dc.styles=Q8e;Qu([q({type:Boolean})],dc.prototype,"disabled",void 0);Qu([q({type:String})],dc.prototype,"label",void 0);Qu([G()],dc.prototype,"network",void 0);Qu([G()],dc.prototype,"networkImage",void 0);Qu([G()],dc.prototype,"caipAddress",void 0);Qu([G()],dc.prototype,"loading",void 0);Qu([G()],dc.prototype,"isSupported",void 0);let GP=class extends dc{};GP=Qu([te("w3m-network-button")],GP);let KP=class extends dc{};KP=Qu([te("appkit-network-button")],KP);const X8e=de` :host { --prev-height: 0px; --new-height: 0px; display: block; } div.w3m-router-container { transform: translateY(0); opacity: 1; } div.w3m-router-container[view-direction='prev'] { animation: slide-left-out 150ms forwards ease, slide-left-in 150ms forwards ease; animation-delay: 0ms, 200ms; } div.w3m-router-container[view-direction='next'] { animation: slide-right-out 150ms forwards ease, slide-right-in 150ms forwards ease; animation-delay: 0ms, 200ms; } @keyframes slide-left-out { from { transform: translateX(0px); opacity: 1; } to { transform: translateX(10px); opacity: 0; } } @keyframes slide-left-in { from { transform: translateX(-10px); opacity: 0; } to { transform: translateX(0); opacity: 1; } } @keyframes slide-right-out { from { transform: translateX(0px); opacity: 1; } to { transform: translateX(-10px); opacity: 0; } } @keyframes slide-right-in { from { transform: translateX(10px); opacity: 0; } to { transform: translateX(0); opacity: 1; } } `;var Z7=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Mm=class extends se{constructor(){super(),this.resizeObserver=void 0,this.prevHeight="0px",this.prevHistoryLength=1,this.unsubscribe=[],this.view=X.state.view,this.viewDirection="",this.unsubscribe.push(X.subscribeKey("view",e=>this.onViewChange(e)))}firstUpdated(){var e;this.resizeObserver=new ResizeObserver(([r])=>{const n=`${r==null?void 0:r.contentRect.height}px`;this.prevHeight!=="0px"&&(this.style.setProperty("--prev-height",this.prevHeight),this.style.setProperty("--new-height",n),this.style.animation="w3m-view-height 150ms forwards ease",this.style.height="auto"),setTimeout(()=>{this.prevHeight=n,this.style.animation="unset"},Fo.ANIMATION_DURATIONS.ModalHeight)}),(e=this.resizeObserver)==null||e.observe(this.getWrapper())}disconnectedCallback(){var e;(e=this.resizeObserver)==null||e.unobserve(this.getWrapper()),this.unsubscribe.forEach(r=>r())}render(){return M`
${this.viewTemplate()}
`}viewTemplate(){switch(this.view){case"AccountSettings":return M``;case"Account":return M``;case"AllWallets":return M``;case"ApproveTransaction":return M``;case"BuyInProgress":return M``;case"ChooseAccountName":return M``;case"Connect":return M``;case"Create":return M``;case"ConnectingWalletConnect":return M``;case"ConnectingWalletConnectBasic":return M``;case"ConnectingExternal":return M``;case"ConnectingSiwe":return M``;case"ConnectWallets":return M``;case"ConnectSocials":return M``;case"ConnectingSocial":return M``;case"Downloads":return M``;case"EmailLogin":return M``;case"EmailVerifyOtp":return M``;case"EmailVerifyDevice":return M``;case"GetWallet":return M``;case"Networks":return M``;case"SwitchNetwork":return M``;case"Profile":return M``;case"SwitchAddress":return M``;case"Transactions":return M``;case"OnRampProviders":return M``;case"OnRampActivity":return M``;case"OnRampTokenSelect":return M``;case"OnRampFiatSelect":return M``;case"UpgradeEmailWallet":return M``;case"UpdateEmailWallet":return M``;case"UpdateEmailPrimaryOtp":return M``;case"UpdateEmailSecondaryOtp":return M``;case"UnsupportedChain":return M``;case"Swap":return M``;case"SwapSelectToken":return M``;case"SwapPreview":return M``;case"WalletSend":return M``;case"WalletSendSelectToken":return M``;case"WalletSendPreview":return M``;case"WhatIsABuy":return M``;case"WalletReceive":return M``;case"WalletCompatibleNetworks":return M``;case"WhatIsAWallet":return M``;case"ConnectingMultiChain":return M``;case"WhatIsANetwork":return M``;case"ConnectingFarcaster":return M``;case"SwitchActiveChain":return M``;case"RegisterAccountName":return M``;case"RegisterAccountNameSuccess":return M``;case"SmartSessionCreated":return M``;case"SmartSessionList":return M``;case"SIWXSignMessage":return M``;case"Pay":return M``;case"PayLoading":return M``;default:return M``}}onViewChange(e){_s.hide();let r=Fo.VIEW_DIRECTION.Next;const{history:n}=X.state;n.length{this.view=e},Fo.ANIMATION_DURATIONS.ViewTransition)}getWrapper(){var e;return(e=this.shadowRoot)==null?void 0:e.querySelector("div")}};Mm.styles=X8e;Z7([G()],Mm.prototype,"view",void 0);Z7([G()],Mm.prototype,"viewDirection",void 0);Mm=Z7([te("w3m-router")],Mm);const eSe=de` :host { display: block; } button { width: 100%; display: block; padding-top: var(--wui-spacing-l); padding-bottom: var(--wui-spacing-l); padding-left: var(--wui-spacing-s); padding-right: var(--wui-spacing-2l); border-radius: var(--wui-border-radius-s); background-color: var(--wui-color-accent-glass-010); } button:hover { background-color: var(--wui-color-accent-glass-015) !important; } button:active { background-color: var(--wui-color-accent-glass-020) !important; } `;var $A=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Lm=class extends se{constructor(){super(...arguments),this.label="",this.description="",this.icon="wallet"}render(){return M` `}};Lm.styles=[He,vt,eSe];$A([q()],Lm.prototype,"label",void 0);$A([q()],Lm.prototype,"description",void 0);$A([q()],Lm.prototype,"icon",void 0);Lm=$A([te("wui-notice-card")],Lm);var tQ=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let ZP=class extends se{constructor(){super(),this.unsubscribe=[],this.socialProvider=Le.getConnectedSocialProvider(),this.socialUsername=Le.getConnectedSocialUsername(),this.namespace=F.state.activeChain,this.unsubscribe.push(F.subscribeKey("activeChain",e=>{this.namespace=e}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){const e=ge.getConnectorId(this.namespace),r=ge.getAuthConnector();if(!r||e!==_e.CONNECTOR_ID.AUTH)return this.style.cssText="display: none",null;const n=r.provider.getEmail()??"";return!n&&!this.socialUsername?(this.style.cssText="display: none",null):M` {this.onGoToUpdateEmail(n,this.socialProvider)}} > ${this.getAuthName(n)} `}onGoToUpdateEmail(e,r){r||X.push("UpdateEmailWallet",{email:e,redirectView:"Account"})}getAuthName(e){return this.socialUsername?this.socialProvider==="discord"&&this.socialUsername.endsWith("0")?this.socialUsername.slice(0,-1):this.socialUsername:e.length>30?`${e.slice(0,-3)}...`:e}};tQ([G()],ZP.prototype,"namespace",void 0);ZP=tQ([te("w3m-account-auth-button")],ZP);var hc=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let oo=class extends se{constructor(){super(),this.usubscribe=[],this.networkImages=er.state.networkImages,this.address=re.state.address,this.profileImage=re.state.profileImage,this.profileName=re.state.profileName,this.network=F.state.activeCaipNetwork,this.preferredAccountTypes=re.state.preferredAccountTypes,this.disconnecting=!1,this.loading=!1,this.switched=!1,this.text="",this.usubscribe.push(re.subscribe(e=>{e.address&&(this.address=e.address,this.profileImage=e.profileImage,this.profileName=e.profileName,this.preferredAccountTypes=e.preferredAccountTypes)}),re.subscribeKey("preferredAccountTypes",e=>this.preferredAccountTypes=e),F.subscribeKey("activeCaipNetwork",e=>{e!=null&&e.id&&(this.network=e)}))}disconnectedCallback(){this.usubscribe.forEach(e=>e())}render(){var r,n,i;if(!this.address)throw new Error("w3m-account-settings-view: No account provided");const e=this.networkImages[((n=(r=this.network)==null?void 0:r.assets)==null?void 0:n.imageId)??""];return M` ${nt.getTruncateString({string:this.address,charsStart:4,charsEnd:6,truncate:"middle"})} ${this.authCardTemplate()} ${((i=this.network)==null?void 0:i.name)??"Unknown"} ${this.togglePreferredAccountBtnTemplate()} ${this.chooseNameButtonTemplate()} Disconnect `}chooseNameButtonTemplate(){var s;const e=(s=this.network)==null?void 0:s.chainNamespace,r=ge.getConnectorId(e),n=ge.getAuthConnector();return!F.checkIfNamesSupported()||!n||r!==_e.CONNECTOR_ID.AUTH||this.profileName?null:M` Choose account name `}authCardTemplate(){var s;const e=(s=this.network)==null?void 0:s.chainNamespace,r=ge.getConnectorId(e),n=ge.getAuthConnector(),{origin:i}=location;return!n||r!==_e.CONNECTOR_ID.AUTH||i.includes(ct.SECURE_SITE)?null:M` `}isAllowedNetworkSwitch(){const e=F.getAllRequestedCaipNetworks(),r=e?e.length>1:!1,n=e==null?void 0:e.find(({id:i})=>{var s;return i===((s=this.network)==null?void 0:s.id)});return r||!n}onCopyAddress(){try{this.address&&(ue.copyToClopboard(this.address),Fe.showSuccess("Address copied"))}catch{Fe.showError("Failed to copy")}}togglePreferredAccountBtnTemplate(){var s,o;const e=(s=this.network)==null?void 0:s.chainNamespace,r=F.checkIfSmartAccountEnabled(),n=ge.getConnectorId(e);return!ge.getAuthConnector()||n!==_e.CONNECTOR_ID.AUTH||!r?null:(this.switched||(this.text=((o=this.preferredAccountTypes)==null?void 0:o[e])===bt.ACCOUNT_TYPES.SMART_ACCOUNT?"Switch to your EOA":"Switch to your smart account"),M` ${this.text} `)}onChooseName(){X.push("ChooseAccountName")}async changePreferredAccountType(){var s,o;const e=(s=this.network)==null?void 0:s.chainNamespace,r=F.checkIfSmartAccountEnabled(),n=((o=this.preferredAccountTypes)==null?void 0:o[e])===bt.ACCOUNT_TYPES.SMART_ACCOUNT||!r?bt.ACCOUNT_TYPES.EOA:bt.ACCOUNT_TYPES.SMART_ACCOUNT;ge.getAuthConnector()&&(this.loading=!0,await xe.setPreferredAccountType(n,e),this.text=n===bt.ACCOUNT_TYPES.SMART_ACCOUNT?"Switch to your EOA":"Switch to your smart account",this.switched=!0,Qe.resetSend(),this.loading=!1,this.requestUpdate())}onNetworks(){this.isAllowedNetworkSwitch()&&X.push("Networks")}async onDisconnect(){try{this.disconnecting=!0,await xe.disconnect(),We.close()}catch{Re.sendEvent({type:"track",event:"DISCONNECT_ERROR"}),Fe.showError("Failed to disconnect")}finally{this.disconnecting=!1}}onGoToUpgradeView(){Re.sendEvent({type:"track",event:"EMAIL_UPGRADE_FROM_MODAL"}),X.push("UpgradeEmailWallet")}};hc([G()],oo.prototype,"address",void 0);hc([G()],oo.prototype,"profileImage",void 0);hc([G()],oo.prototype,"profileName",void 0);hc([G()],oo.prototype,"network",void 0);hc([G()],oo.prototype,"preferredAccountTypes",void 0);hc([G()],oo.prototype,"disconnecting",void 0);hc([G()],oo.prototype,"loading",void 0);hc([G()],oo.prototype,"switched",void 0);hc([G()],oo.prototype,"text",void 0);oo=hc([te("w3m-account-settings-view")],oo);const tSe=de` button { background-color: var(--wui-color-gray-glass-002); border-radius: var(--wui-border-radius-3xl); border: 1px solid var(--wui-color-gray-glass-002); padding: var(--wui-spacing-xs) var(--wui-spacing-s) var(--wui-spacing-xs) var(--wui-spacing-xs); position: relative; } wui-avatar { width: 32px; height: 32px; box-shadow: 0 0 0 0; outline: 3px solid var(--wui-color-gray-glass-005); } wui-icon-box, wui-image { width: 16px; height: 16px; border-radius: var(--wui-border-radius-3xl); position: absolute; left: 26px; top: 24px; } wui-image { outline: 2px solid var(--wui-color-bg-125); } wui-icon-box { outline: 2px solid var(--wui-color-bg-200); background-color: var(--wui-color-bg-250); } `;var jp=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let qu=class extends se{constructor(){super(...arguments),this.avatarSrc=void 0,this.profileName="",this.address="",this.icon="mail"}render(){const e=F.state.activeChain,n=ge.getConnectorId(e)===_e.CONNECTOR_ID.AUTH;return M``}handleClick(e){var r,n;if(e.target instanceof HTMLElement&&e.target.id==="copy-address"){(r=this.onCopyClick)==null||r.call(this,e);return}(n=this.onProfileClick)==null||n.call(this,e)}getIconTemplate(e){return M` `}};qu.styles=[He,vt,tSe];jp([q()],qu.prototype,"avatarSrc",void 0);jp([q()],qu.prototype,"profileName",void 0);jp([q()],qu.prototype,"address",void 0);jp([q()],qu.prototype,"icon",void 0);jp([q()],qu.prototype,"onProfileClick",void 0);jp([q()],qu.prototype,"onCopyClick",void 0);qu=jp([te("wui-profile-button-v2")],qu);const rSe=de` :host { display: inline-flex; background-color: var(--wui-color-gray-glass-002); border-radius: var(--wui-border-radius-3xl); padding: var(--wui-spacing-3xs); position: relative; height: 36px; min-height: 36px; overflow: hidden; } :host::before { content: ''; position: absolute; pointer-events: none; top: 4px; left: 4px; display: block; width: var(--local-tab-width); height: 28px; border-radius: var(--wui-border-radius-3xl); background-color: var(--wui-color-gray-glass-002); box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-002); transform: translateX(calc(var(--local-tab) * var(--local-tab-width))); transition: transform var(--wui-ease-out-power-1) var(--wui-duration-md); will-change: background-color, opacity; } :host([data-type='flex'])::before { left: 3px; transform: translateX(calc((var(--local-tab) * 34px) + (var(--local-tab) * 4px))); } :host([data-type='flex']) { display: flex; padding: 0px 0px 0px 12px; gap: 4px; } :host([data-type='flex']) > button > wui-text { position: absolute; left: 18px; opacity: 0; } button[data-active='true'] > wui-icon, button[data-active='true'] > wui-text { color: var(--wui-color-fg-100); } button[data-active='false'] > wui-icon, button[data-active='false'] > wui-text { color: var(--wui-color-fg-200); } button[data-active='true']:disabled, button[data-active='false']:disabled { background-color: transparent; opacity: 0.5; cursor: not-allowed; } button[data-active='true']:disabled > wui-text { color: var(--wui-color-fg-200); } button[data-active='false']:disabled > wui-text { color: var(--wui-color-fg-300); } button > wui-icon, button > wui-text { pointer-events: none; transition: color var(--wui-e ase-out-power-1) var(--wui-duration-md); will-change: color; } button { width: var(--local-tab-width); transition: background-color var(--wui-ease-out-power-1) var(--wui-duration-md); will-change: background-color; } :host([data-type='flex']) > button { width: 34px; position: relative; display: flex; justify-content: flex-start; } button:hover:enabled, button:active:enabled { background-color: transparent !important; } button:hover:enabled > wui-icon, button:active:enabled > wui-icon { transition: all var(--wui-ease-out-power-1) var(--wui-duration-lg); color: var(--wui-color-fg-125); } button:hover:enabled > wui-text, button:active:enabled > wui-text { transition: all var(--wui-ease-out-power-1) var(--wui-duration-lg); color: var(--wui-color-fg-125); } button { border-radius: var(--wui-border-radius-3xl); } `;var Wd=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let sc=class extends se{constructor(){super(...arguments),this.tabs=[],this.onTabChange=()=>null,this.buttons=[],this.disabled=!1,this.localTabWidth="100px",this.activeTab=0,this.isDense=!1}render(){return this.isDense=this.tabs.length>3,this.style.cssText=` --local-tab: ${this.activeTab}; --local-tab-width: ${this.localTabWidth}; `,this.dataset.type=this.isDense?"flex":"block",this.tabs.map((e,r)=>{var i;const n=r===this.activeTab;return M` `})}firstUpdated(){this.shadowRoot&&this.isDense&&(this.buttons=[...this.shadowRoot.querySelectorAll("button")],setTimeout(()=>{this.animateTabs(0,!0)},0))}iconTemplate(e){return e.icon?M``:null}onTabClick(e){this.buttons&&this.animateTabs(e,!1),this.activeTab=e,this.onTabChange(e)}animateTabs(e,r){const n=this.buttons[this.activeTab],i=this.buttons[e],s=n==null?void 0:n.querySelector("wui-text"),o=i==null?void 0:i.querySelector("wui-text"),a=i==null?void 0:i.getBoundingClientRect(),c=o==null?void 0:o.getBoundingClientRect();n&&s&&!r&&e!==this.activeTab&&(s.animate([{opacity:0}],{duration:50,easing:"ease",fill:"forwards"}),n.animate([{width:"34px"}],{duration:500,easing:"ease",fill:"forwards"})),i&&a&&c&&o&&(e!==this.activeTab||r)&&(this.localTabWidth=`${Math.round(a.width+c.width)+6}px`,i.animate([{width:`${a.width+c.width}px`}],{duration:r?0:500,fill:"forwards",easing:"ease"}),o.animate([{opacity:1}],{duration:r?0:125,delay:r?0:200,fill:"forwards",easing:"ease"}))}};sc.styles=[He,vt,rSe];Wd([q({type:Array})],sc.prototype,"tabs",void 0);Wd([q()],sc.prototype,"onTabChange",void 0);Wd([q({type:Array})],sc.prototype,"buttons",void 0);Wd([q({type:Boolean})],sc.prototype,"disabled",void 0);Wd([q()],sc.prototype,"localTabWidth",void 0);Wd([G()],sc.prototype,"activeTab",void 0);Wd([G()],sc.prototype,"isDense",void 0);sc=Wd([te("wui-tabs")],sc);const nSe=de` wui-flex { width: 100%; } :host > wui-flex:first-child { transform: translateY(calc(var(--wui-spacing-xxs) * -1)); } wui-icon-link { margin-right: calc(var(--wui-icon-box-size-md) * -1); } wui-notice-card { margin-bottom: var(--wui-spacing-3xs); } wui-list-item > wui-text { flex: 1; } w3m-transactions-view { max-height: 200px; } .tab-content-container { height: 300px; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; } .tab-content-container::-webkit-scrollbar { display: none; } .account-button { width: auto; border: none; display: flex; align-items: center; justify-content: center; gap: var(--wui-spacing-s); height: 48px; padding: var(--wui-spacing-xs); padding-right: var(--wui-spacing-s); box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-002); background-color: var(--wui-color-gray-glass-002); border-radius: 24px; transition: background-color 0.2s linear; } .account-button:hover { background-color: var(--wui-color-gray-glass-005); } .avatar-container { position: relative; } wui-avatar.avatar { width: 32px; height: 32px; box-shadow: 0 0 0 2px var(--wui-color-gray-glass-005); } wui-avatar.network-avatar { width: 16px; height: 16px; position: absolute; left: 100%; top: 100%; transform: translate(-75%, -75%); box-shadow: 0 0 0 2px var(--wui-color-gray-glass-005); } .account-links { display: flex; justify-content: space-between; align-items: center; } .account-links wui-flex { cursor: pointer; display: flex; align-items: center; justify-content: center; flex: 1; background: red; align-items: center; justify-content: center; height: 48px; padding: 10px; flex: 1 0 0; border-radius: var(--XS, 16px); border: 1px solid var(--dark-accent-glass-010, rgba(71, 161, 255, 0.1)); background: var(--dark-accent-glass-010, rgba(71, 161, 255, 0.1)); transition: background-color var(--wui-ease-out-power-1) var(--wui-duration-md), opacity var(--wui-ease-out-power-1) var(--wui-duration-md); will-change: background-color, opacity; } .account-links wui-flex:hover { background: var(--dark-accent-glass-015, rgba(71, 161, 255, 0.15)); } .account-links wui-flex wui-icon { width: var(--S, 20px); height: var(--S, 20px); } .account-links wui-flex wui-icon svg path { stroke: #667dff; } `;var $s=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Ti=class extends se{constructor(){var e;super(),this.unsubscribe=[],this.caipAddress=re.state.caipAddress,this.address=ue.getPlainAddress(re.state.caipAddress),this.allAccounts=re.state.allAccounts,this.profileImage=re.state.profileImage,this.profileName=re.state.profileName,this.disconnecting=!1,this.balance=re.state.balance,this.balanceSymbol=re.state.balanceSymbol,this.features=oe.state.features,this.remoteFeatures=oe.state.remoteFeatures,this.namespace=F.state.activeChain,this.chainId=(e=F.state.activeCaipNetwork)==null?void 0:e.id,this.unsubscribe.push(re.subscribeKey("caipAddress",r=>{this.address=ue.getPlainAddress(r),this.caipAddress=r}),re.subscribeKey("balance",r=>this.balance=r),re.subscribeKey("balanceSymbol",r=>this.balanceSymbol=r),re.subscribeKey("profileName",r=>this.profileName=r),re.subscribeKey("profileImage",r=>this.profileImage=r),oe.subscribeKey("features",r=>this.features=r),oe.subscribeKey("remoteFeatures",r=>this.remoteFeatures=r),re.subscribeKey("allAccounts",r=>{this.allAccounts=r}),oe.subscribeKey("remoteFeatures",r=>this.remoteFeatures=r),F.subscribeKey("activeChain",r=>this.namespace=r),F.subscribeKey("activeCaipNetwork",r=>{var n;if(r){const[i,s]=((n=r==null?void 0:r.caipNetworkId)==null?void 0:n.split(":"))||[];i&&s&&(this.namespace=i,this.chainId=s)}}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){if(!this.caipAddress)return null;const e=F.state.activeChain!==_e.CHAIN.SOLANA&&this.allAccounts.length>1;return M` ${e?this.multiAccountTemplate():this.singleAccountTemplate()} ${ue.formatBalance(this.balance,this.balanceSymbol)} ${this.explorerBtnTemplate()} ${this.authCardTemplate()} ${this.orderedFeaturesTemplate()} ${this.activityTemplate()} Disconnect `}onrampTemplate(){var n;if(!this.namespace)return null;const e=(n=this.remoteFeatures)==null?void 0:n.onramp,r=ct.ONRAMP_SUPPORTED_CHAIN_NAMESPACES.includes(this.namespace);return!e||!r?null:M` Buy crypto `}orderedFeaturesTemplate(){var r;return(((r=this.features)==null?void 0:r.walletFeaturesOrder)||ct.DEFAULT_FEATURES.walletFeaturesOrder).map(n=>{switch(n){case"onramp":return this.onrampTemplate();case"swaps":return this.swapsTemplate();case"send":return this.sendTemplate();default:return null}})}activityTemplate(){var r;return this.namespace&&((r=this.remoteFeatures)==null?void 0:r.activity)&&ct.ACTIVITY_ENABLED_CHAIN_NAMESPACES.includes(this.namespace)?M` Activity `:null}swapsTemplate(){var n;const e=(n=this.remoteFeatures)==null?void 0:n.swaps,r=F.state.activeChain===_e.CHAIN.EVM;return!e||!r?null:M` Swap `}sendTemplate(){var i;const e=(i=this.features)==null?void 0:i.send,r=F.state.activeChain,n=ct.SEND_SUPPORTED_NAMESPACES.includes(r);return!e||!n?null:M` Send `}authCardTemplate(){const e=F.state.activeChain,r=ge.getConnectorId(e),n=ge.getAuthConnector(),{origin:i}=location;return!n||r!==_e.CONNECTOR_ID.AUTH||i.includes(ct.SECURE_SITE)?null:M` `}handleSwitchAccountsView(){X.push("SwitchAddress")}handleClickPay(){X.push("OnRampProviders")}handleClickSwap(){X.push("Swap")}handleClickSend(){X.push("WalletSend")}explorerBtnTemplate(){return re.state.addressExplorerUrl?M` Block Explorer `:null}singleAccountTemplate(){return M` ${this.profileName?nt.getTruncateString({string:this.profileName,charsStart:20,charsEnd:0,truncate:"end"}):nt.getTruncateString({string:this.address||"",charsStart:4,charsEnd:4,truncate:"middle"})} `}multiAccountTemplate(){if(!this.address)throw new Error("w3m-account-view: No account provided");const e=this.allAccounts.find(n=>n.address===this.address),r=re.state.addressLabels.get(this.address);return this.namespace==="bip122"?this.btcAccountsTemplate():M` `}btcAccountsTemplate(){return M` {var r;return re.setCaipAddress(`bip122:${this.chainId}:${((r=this.allAccounts[e])==null?void 0:r.address)||""}`,this.namespace)}} > ${nt.getTruncateString({string:this.profileName||this.address||"",charsStart:this.profileName?18:4,charsEnd:this.profileName?0:4,truncate:this.profileName?"end":"middle"})} `}onCopyAddress(){try{this.address&&(ue.copyToClopboard(this.address),Fe.showSuccess("Address copied"))}catch{Fe.showError("Failed to copy")}}onTransactions(){var r;const e=F.state.activeChain;Re.sendEvent({type:"track",event:"CLICK_TRANSACTIONS",properties:{isSmartAccount:((r=re.state.preferredAccountTypes)==null?void 0:r[e])===bt.ACCOUNT_TYPES.SMART_ACCOUNT}}),X.push("Transactions")}async onDisconnect(){try{this.disconnecting=!0,await xe.disconnect(),We.close()}catch{Re.sendEvent({type:"track",event:"DISCONNECT_ERROR"}),Fe.showError("Failed to disconnect")}finally{this.disconnecting=!1}}onExplorer(){const e=re.state.addressExplorerUrl;e&&ue.openHref(e,"_blank")}onGoToUpgradeView(){Re.sendEvent({type:"track",event:"EMAIL_UPGRADE_FROM_MODAL"}),X.push("UpgradeEmailWallet")}};Ti.styles=nSe;$s([G()],Ti.prototype,"caipAddress",void 0);$s([G()],Ti.prototype,"address",void 0);$s([G()],Ti.prototype,"allAccounts",void 0);$s([G()],Ti.prototype,"profileImage",void 0);$s([G()],Ti.prototype,"profileName",void 0);$s([G()],Ti.prototype,"disconnecting",void 0);$s([G()],Ti.prototype,"balance",void 0);$s([G()],Ti.prototype,"balanceSymbol",void 0);$s([G()],Ti.prototype,"features",void 0);$s([G()],Ti.prototype,"remoteFeatures",void 0);$s([G()],Ti.prototype,"namespace",void 0);$s([G()],Ti.prototype,"chainId",void 0);Ti=$s([te("w3m-account-default-widget")],Ti);const iSe=de` span { font-weight: 500; font-size: 40px; color: var(--wui-color-fg-100); line-height: 130%; /* 52px */ letter-spacing: -1.6px; text-align: center; } .pennies { color: var(--wui-color-fg-200); } `;var Y7=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let zy=class extends se{constructor(){super(...arguments),this.dollars="0",this.pennies="00"}render(){return M`$${this.dollars}.${this.pennies}`}};zy.styles=[He,iSe];Y7([q()],zy.prototype,"dollars",void 0);Y7([q()],zy.prototype,"pennies",void 0);zy=Y7([te("wui-balance")],zy);const sSe=de` button { background-color: var(--wui-color-gray-glass-002); border-radius: var(--wui-border-radius-3xl); border: 1px solid var(--wui-color-gray-glass-002); padding: var(--wui-spacing-xs) var(--wui-spacing-s) var(--wui-spacing-xs) var(--wui-spacing-xs); position: relative; } wui-avatar { width: 32px; height: 32px; box-shadow: 0 0 0 0; outline: 3px solid var(--wui-color-gray-glass-005); } wui-icon-box, wui-image { width: 16px; height: 16px; border-radius: var(--wui-border-radius-3xl); position: absolute; left: 26px; top: 24px; } wui-image { outline: 2px solid var(--wui-color-bg-125); } wui-icon-box { outline: 2px solid var(--wui-color-bg-200); background-color: var(--wui-color-bg-250); } `;var d1=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Pd=class extends se{constructor(){super(...arguments),this.networkSrc=void 0,this.avatarSrc=void 0,this.profileName="",this.address="",this.icon="chevronBottom"}render(){return M``}networkImageTemplate(){return this.networkSrc?M``:M` `}};Pd.styles=[He,vt,sSe];d1([q()],Pd.prototype,"networkSrc",void 0);d1([q()],Pd.prototype,"avatarSrc",void 0);d1([q()],Pd.prototype,"profileName",void 0);d1([q()],Pd.prototype,"address",void 0);d1([q()],Pd.prototype,"icon",void 0);Pd=d1([te("wui-profile-button")],Pd);const oSe=de` :host { display: block; padding: 9px var(--wui-spacing-s) 10px var(--wui-spacing-s); border-radius: var(--wui-border-radius-xxs); color: var(--wui-color-bg-100); position: relative; } :host([data-variant='shade']) { background-color: var(--wui-color-bg-150); border: 1px solid var(--wui-color-gray-glass-005); } :host([data-variant='shade']) > wui-text { color: var(--wui-color-fg-150); } :host([data-variant='fill']) { background-color: var(--wui-color-fg-100); border: none; } wui-icon { position: absolute; width: 12px !important; height: 4px !important; } wui-icon[data-placement='top'] { bottom: 0px; left: 50%; transform: translate(-50%, 95%); } wui-icon[data-placement='bottom'] { top: 0; left: 50%; transform: translate(-50%, -95%) rotate(180deg); } wui-icon[data-placement='right'] { top: 50%; left: 0; transform: translate(-65%, -50%) rotate(90deg); } wui-icon[data-placement='left'] { top: 50%; right: 0%; transform: translate(65%, -50%) rotate(270deg); } `;var jA=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Um=class extends se{constructor(){super(...arguments),this.placement="top",this.variant="fill",this.message=""}render(){return this.dataset.variant=this.variant,M` ${this.message}`}};Um.styles=[He,vt,oSe];jA([q()],Um.prototype,"placement",void 0);jA([q()],Um.prototype,"variant",void 0);jA([q()],Um.prototype,"message",void 0);Um=jA([te("wui-tooltip")],Um);const aSe={getTabsByNamespace(t){var r;return!!t&&t===_e.CHAIN.EVM?((r=oe.state.remoteFeatures)==null?void 0:r.activity)===!1?Fo.ACCOUNT_TABS.filter(n=>n.label!=="Activity"):Fo.ACCOUNT_TABS:[]}},cSe=de` :host { width: 100%; max-height: 280px; overflow: scroll; scrollbar-width: none; } :host::-webkit-scrollbar { display: none; } `;var uSe=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let YP=class extends se{render(){return M``}};YP.styles=cSe;YP=uSe([te("w3m-account-activity-widget")],YP);const lSe=de` .contentContainer { height: 280px; } .contentContainer > wui-icon-box { width: 40px; height: 40px; border-radius: var(--wui-border-radius-xxs); } .contentContainer > .textContent { width: 65%; } `;var dSe=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let JP=class extends se{render(){return M`${this.nftTemplate()}`}nftTemplate(){return M` Coming soon Stay tuned for our upcoming NFT feature Receive funds `}onReceiveClick(){X.push("WalletReceive")}};JP.styles=lSe;JP=dSe([te("w3m-account-nfts-widget")],JP);const hSe=de` button { width: 100%; display: flex; gap: var(--wui-spacing-s); align-items: center; justify-content: flex-start; padding: var(--wui-spacing-s) var(--wui-spacing-m) var(--wui-spacing-s) var(--wui-spacing-s); background-color: var(--wui-color-gray-glass-002); border-radius: var(--wui-border-radius-xs); } wui-icon-box { width: var(--wui-spacing-2xl); height: var(--wui-spacing-2xl); } wui-flex { width: auto; } `;var Vd=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let oc=class extends se{constructor(){super(...arguments),this.icon="card",this.text="",this.description="",this.tag=void 0,this.iconBackgroundColor="accent-100",this.iconColor="accent-100",this.disabled=!1}render(){return M` `}titleTemplate(){return this.tag?M` ${this.text}${this.tag} `:M`${this.text}`}};oc.styles=[He,vt,hSe];Vd([q()],oc.prototype,"icon",void 0);Vd([q()],oc.prototype,"text",void 0);Vd([q()],oc.prototype,"description",void 0);Vd([q()],oc.prototype,"tag",void 0);Vd([q()],oc.prototype,"iconBackgroundColor",void 0);Vd([q()],oc.prototype,"iconColor",void 0);Vd([q({type:Boolean})],oc.prototype,"disabled",void 0);oc=Vd([te("wui-list-description")],oc);const fSe=de` :host { width: 100%; } wui-flex { width: 100%; } .contentContainer { max-height: 280px; overflow: scroll; scrollbar-width: none; } .contentContainer::-webkit-scrollbar { display: none; } `;var J7=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Wy=class extends se{constructor(){super(),this.unsubscribe=[],this.tokenBalance=re.state.tokenBalance,this.remoteFeatures=oe.state.remoteFeatures,this.unsubscribe.push(re.subscribe(e=>{this.tokenBalance=e.tokenBalance}),oe.subscribeKey("remoteFeatures",e=>{this.remoteFeatures=e}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return M`${this.tokenTemplate()}`}tokenTemplate(){var e;return this.tokenBalance&&((e=this.tokenBalance)==null?void 0:e.length)>0?M` ${this.tokenItemTemplate()} `:M` ${this.onRampTemplate()} `}onRampTemplate(){var e;return(e=this.remoteFeatures)!=null&&e.onramp?M``:M``}tokenItemTemplate(){var e;return(e=this.tokenBalance)==null?void 0:e.map(r=>M``)}onReceiveClick(){X.push("WalletReceive")}onBuyClick(){var r;const e=F.state.activeChain;Re.sendEvent({type:"track",event:"SELECT_BUY_CRYPTO",properties:{isSmartAccount:((r=re.state.preferredAccountTypes)==null?void 0:r[e])===bt.ACCOUNT_TYPES.SMART_ACCOUNT}}),X.push("OnRampProviders")}};Wy.styles=fSe;J7([G()],Wy.prototype,"tokenBalance",void 0);J7([G()],Wy.prototype,"remoteFeatures",void 0);Wy=J7([te("w3m-account-tokens-widget")],Wy);const pSe=de` wui-flex { width: 100%; } wui-promo { position: absolute; top: -32px; } wui-profile-button { margin-top: calc(-1 * var(--wui-spacing-2l)); } wui-promo + wui-profile-button { margin-top: var(--wui-spacing-2l); } wui-tabs { width: 100%; } .contentContainer { height: 280px; } .contentContainer > wui-icon-box { width: 40px; height: 40px; border-radius: var(--wui-border-radius-xxs); } .contentContainer > .textContent { width: 65%; } `;var ua=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};const gSe=48,mSe=430;let Os=class extends se{constructor(){super(),this.unsubscribe=[],this.address=re.state.address,this.profileImage=re.state.profileImage,this.profileName=re.state.profileName,this.network=F.state.activeCaipNetwork,this.currentTab=re.state.currentTab,this.tokenBalance=re.state.tokenBalance,this.features=oe.state.features,this.remoteFeatures=oe.state.remoteFeatures,this.networkImage=pt.getNetworkImage(this.network),this.unsubscribe.push(er.subscribeNetworkImages(()=>{this.networkImage=pt.getNetworkImage(this.network)}),re.subscribe(e=>{e.address?(this.address=e.address,this.profileImage=e.profileImage,this.profileName=e.profileName,this.currentTab=e.currentTab,this.tokenBalance=e.tokenBalance):We.close()}),F.subscribeKey("activeCaipNetwork",e=>{this.network=e,this.networkImage=pt.getNetworkImage(this.network)}),oe.subscribeKey("features",e=>this.features=e),oe.subscribeKey("remoteFeatures",e=>this.remoteFeatures=e)),this.watchSwapValues()}disconnectedCallback(){this.unsubscribe.forEach(e=>e()),clearInterval(this.watchTokenBalance)}firstUpdated(){re.fetchTokenBalance()}render(){if(!this.address)throw new Error("w3m-account-view: No account provided");return M` ${this.tokenBalanceTemplate()} ${this.orderedWalletFeatures()} ${this.tabsTemplate()} ${this.listContentTemplate()} `}orderedWalletFeatures(){var n;const e=((n=this.features)==null?void 0:n.walletFeaturesOrder)||ct.DEFAULT_FEATURES.walletFeaturesOrder;return e.every(i=>{var s,o;return i==="send"||i==="receive"?!((s=this.features)!=null&&s[i]):i==="swaps"||i==="onramp"?!((o=this.remoteFeatures)!=null&&o[i]):!0})?null:M` ${e.map(i=>{switch(i){case"onramp":return this.onrampTemplate();case"swaps":return this.swapsTemplate();case"receive":return this.receiveTemplate();case"send":return this.sendTemplate();default:return null}})} `}onrampTemplate(){var r;return((r=this.remoteFeatures)==null?void 0:r.onramp)?M` `:null}swapsTemplate(){var n;const e=(n=this.remoteFeatures)==null?void 0:n.swaps,r=F.state.activeChain===_e.CHAIN.EVM;return!e||!r?null:M` `}receiveTemplate(){var r;return((r=this.features)==null?void 0:r.receive)?M` `:null}sendTemplate(){var i;const e=(i=this.features)==null?void 0:i.send,r=F.state.activeChain,n=ct.SEND_SUPPORTED_NAMESPACES.includes(r);return!e||!n?null:M` `}watchSwapValues(){this.watchTokenBalance=setInterval(()=>re.fetchTokenBalance(e=>this.onTokenBalanceError(e)),1e4)}onTokenBalanceError(e){e instanceof Error&&e.cause instanceof Response&&e.cause.status===_e.HTTP_STATUS_CODES.SERVICE_UNAVAILABLE&&clearInterval(this.watchTokenBalance)}listContentTemplate(){return this.currentTab===0?M``:this.currentTab===1?M``:this.currentTab===2?M``:M``}tokenBalanceTemplate(){var e;if(this.tokenBalance&&((e=this.tokenBalance)==null?void 0:e.length)>=0){const r=ue.calculateBalance(this.tokenBalance),{dollars:n="0",pennies:i="00"}=ue.formatTokenBalance(r);return M``}return M``}tabsTemplate(){const e=aSe.getTabsByNamespace(F.state.activeChain);if(e.length===0)return null;const r=ue.isMobile()&&window.innerWidth`}onTabChange(e){re.setCurrentTab(e)}onProfileButtonClick(){const{allAccounts:e}=re.state;e.length>1?X.push("Profile"):X.push("AccountSettings")}onBuyClick(){X.push("OnRampProviders")}onSwapClick(){var r,n,i,s;const e=F.state.activeChain;(r=this.network)!=null&&r.caipNetworkId&&!ct.SWAP_SUPPORTED_NETWORKS.includes((n=this.network)==null?void 0:n.caipNetworkId)?X.push("UnsupportedChain",{swapUnsupportedChain:!0}):(Re.sendEvent({type:"track",event:"OPEN_SWAP",properties:{network:((i=this.network)==null?void 0:i.caipNetworkId)||"",isSmartAccount:((s=re.state.preferredAccountTypes)==null?void 0:s[e])===bt.ACCOUNT_TYPES.SMART_ACCOUNT}}),X.push("Swap"))}onReceiveClick(){X.push("WalletReceive")}onSendClick(){var r,n;const e=F.state.activeChain;Re.sendEvent({type:"track",event:"OPEN_SEND",properties:{network:((r=this.network)==null?void 0:r.caipNetworkId)||"",isSmartAccount:((n=re.state.preferredAccountTypes)==null?void 0:n[e])===bt.ACCOUNT_TYPES.SMART_ACCOUNT}}),X.push("WalletSend")}};Os.styles=pSe;ua([G()],Os.prototype,"watchTokenBalance",void 0);ua([G()],Os.prototype,"address",void 0);ua([G()],Os.prototype,"profileImage",void 0);ua([G()],Os.prototype,"profileName",void 0);ua([G()],Os.prototype,"network",void 0);ua([G()],Os.prototype,"currentTab",void 0);ua([G()],Os.prototype,"tokenBalance",void 0);ua([G()],Os.prototype,"features",void 0);ua([G()],Os.prototype,"remoteFeatures",void 0);ua([G()],Os.prototype,"networkImage",void 0);Os=ua([te("w3m-account-wallet-features-widget")],Os);var rQ=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let p6=class extends se{constructor(){super(),this.unsubscribe=[],this.namespace=F.state.activeChain,this.unsubscribe.push(F.subscribeKey("activeChain",e=>{this.namespace=e}))}render(){if(!this.namespace)return null;const e=ge.getConnectorId(this.namespace),r=ge.getAuthConnector();return M` ${r&&e===_e.CONNECTOR_ID.AUTH?this.walletFeaturesTemplate():this.defaultTemplate()} `}walletFeaturesTemplate(){return M``}defaultTemplate(){return M``}};rQ([G()],p6.prototype,"namespace",void 0);p6=rQ([te("w3m-account-view")],p6);const wSe=de` button { padding: 6.5px var(--wui-spacing-l) 6.5px var(--wui-spacing-xs); display: flex; justify-content: space-between; width: 100%; border-radius: var(--wui-border-radius-xs); background-color: var(--wui-color-gray-glass-002); } button[data-clickable='false'] { pointer-events: none; background-color: transparent; } wui-image { width: var(--wui-spacing-3xl); height: var(--wui-spacing-3xl); border-radius: var(--wui-border-radius-3xl); } wui-avatar { width: var(--wui-spacing-3xl); height: var(--wui-spacing-3xl); box-shadow: 0 0 0 0; } .address { color: var(--wui-color-fg-base-100); } .address-description { text-transform: capitalize; color: var(--wui-color-fg-base-200); } wui-icon-box { position: relative; right: 15px; top: 15px; border: 2px solid var(--wui-color-bg-150); background-color: var(--wui-color-bg-125); } `;var d2=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let ap=class extends se{constructor(){super(...arguments),this.accountAddress="",this.accountType="",this.labels=re.state.addressLabels,this.caipNetwork=F.state.activeCaipNetwork,this.socialProvider=Le.getConnectedSocialProvider(),this.balance=0,this.fetchingBalance=!0,this.shouldShowIcon=!1,this.selected=!1}connectedCallback(){var e;super.connectedCallback(),Xe.getBalance(this.accountAddress,(e=this.caipNetwork)==null?void 0:e.caipNetworkId).then(r=>{let n=this.balance;r.balances.length>0&&(n=r.balances.reduce((i,s)=>i+((s==null?void 0:s.value)||0),0)),this.balance=n,this.fetchingBalance=!1,this.requestUpdate()}).catch(()=>{this.fetchingBalance=!1,this.requestUpdate()})}render(){const e=this.getLabel(),r=F.state.activeChain,n=ge.getConnectorId(r);return this.shouldShowIcon=n===_e.CONNECTOR_ID.AUTH,M` ${this.shouldShowIcon?M``:M``} ${nt.getTruncateString({string:this.accountAddress,charsStart:4,charsEnd:6,truncate:"middle"})} ${e} ${this.fetchingBalance?M``:M` $${this.balance.toFixed(2)}`} `}getLabel(){var i;let e=(i=this.labels)==null?void 0:i.get(this.accountAddress);const r=F.state.activeChain,n=ge.getConnectorId(r);return!e&&n===_e.CONNECTOR_ID.AUTH?e=`${this.accountType==="eoa"?this.socialProvider??"Email":"Smart"} Account`:e||(e="EOA"),e}};ap.styles=[He,vt,wSe];d2([q()],ap.prototype,"accountAddress",void 0);d2([q()],ap.prototype,"accountType",void 0);d2([q({type:Boolean})],ap.prototype,"selected",void 0);d2([q({type:Function})],ap.prototype,"onSelect",void 0);ap=d2([te("wui-list-account")],ap);const bSe=de` wui-flex { width: 100%; } wui-icon-link { margin-right: calc(var(--wui-icon-box-size-md) * -1); } .account-links { display: flex; justify-content: space-between; align-items: center; } .account-links wui-flex { cursor: pointer; display: flex; align-items: center; justify-content: center; flex: 1; background: red; align-items: center; justify-content: center; height: 48px; padding: 10px; flex: 1 0 0; border-radius: var(--XS, 16px); border: 1px solid var(--dark-accent-glass-010, rgba(71, 161, 255, 0.1)); background: var(--dark-accent-glass-010, rgba(71, 161, 255, 0.1)); transition: background-color var(--wui-ease-out-power-1) var(--wui-duration-md); will-change: background-color; } .account-links wui-flex:hover { background: var(--dark-accent-glass-015, rgba(71, 161, 255, 0.15)); } .account-links wui-flex wui-icon { width: var(--S, 20px); height: var(--S, 20px); } .account-links wui-flex wui-icon svg path { stroke: #47a1ff; } .account-settings-button { padding: calc(var(--wui-spacing-m) - 1px) var(--wui-spacing-2l); height: 40px; border-radius: var(--wui-border-radius-xxs); border: 1px solid var(--wui-color-gray-glass-002); background: var(--wui-color-gray-glass-002); cursor: pointer; } .account-settings-button:hover { background: var(--wui-color-gray-glass-005); } `;var h1=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let zu=class extends se{constructor(){super(),this.usubscribe=[],this.address=re.state.address,this.profileImage=re.state.profileImage,this.profileName=re.state.profileName,this.accounts=re.state.allAccounts,this.loading=!1,this.usubscribe.push(re.subscribeKey("address",e=>{e?this.address=e:We.close()})),this.usubscribe.push(re.subscribeKey("profileImage",e=>{this.profileImage=e})),this.usubscribe.push(re.subscribeKey("profileName",e=>{this.profileName=e}))}disconnectedCallback(){this.usubscribe.forEach(e=>e())}render(){if(!this.address)throw new Error("w3m-profile-view: No account provided");return M` ${this.profileName?nt.getTruncateString({string:this.profileName,charsStart:20,charsEnd:0,truncate:"end"}):nt.getTruncateString({string:this.address,charsStart:4,charsEnd:6,truncate:"middle"})} ${this.accountsTemplate()} `}accountsTemplate(){return M` Your accounts ${this.accounts.map(e=>this.accountTemplate(e))} `}async onSwitchAccount(e){var i;const r=(i=F.state.activeCaipNetwork)==null?void 0:i.chainNamespace;if(this.loading=!0,ge.getAuthConnector()){const s=e.type;await xe.setPreferredAccountType(s,r)}re.setShouldUpdateToAddress(e.address,r),this.loading=!1}accountTemplate(e){return M` ${e.address===this.address?"":M`this.onSwitchAccount(e)} .loading=${this.loading} >Switch`} `}onCopyAddress(){try{this.address&&(ue.copyToClopboard(this.address),Fe.showSuccess("Address copied"))}catch{Fe.showError("Failed to copy")}}};zu.styles=bSe;h1([G()],zu.prototype,"address",void 0);h1([G()],zu.prototype,"profileImage",void 0);h1([G()],zu.prototype,"profileName",void 0);h1([G()],zu.prototype,"accounts",void 0);h1([G()],zu.prototype,"loading",void 0);zu=h1([te("w3m-profile-view")],zu);const ySe=de` wui-flex { width: 100%; background-color: var(--wui-color-gray-glass-005); border-radius: var(--wui-border-radius-m); padding: var(--wui-spacing-1xs) var(--wui-spacing-s) var(--wui-spacing-1xs) var(--wui-spacing-1xs); } `;var BA=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Fm=class extends se{constructor(){super(...arguments),this.imageSrc="",this.text="",this.size=""}render(){return M` ${this.text} `}};Fm.styles=[He,vt,ySe];BA([q()],Fm.prototype,"imageSrc",void 0);BA([q()],Fm.prototype,"text",void 0);BA([q()],Fm.prototype,"size",void 0);Fm=BA([te("wui-banner-img")],Fm);const vSe=de` wui-avatar { width: var(--wui-spacing-3xl); height: var(--wui-spacing-3xl); box-shadow: 0 0 0 0; } wui-icon-box { position: relative; right: 15px; top: 15px; border: 2px solid var(--wui-color-bg-150); background-color: var(--wui-color-bg-125); } `;var Q7=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Hm=class extends se{constructor(){super(),this.metadata=oe.state.metadata,this.allAccounts=re.state.allAccounts||[],this.balances={},this.labels=re.state.addressLabels,this.currentAddress=re.state.address||"",this.caipNetwork=F.state.activeCaipNetwork,re.subscribeKey("allAccounts",e=>{this.allAccounts=e})}connectedCallback(){super.connectedCallback(),this.allAccounts.forEach(e=>{var r;Xe.getBalance(e.address,(r=this.caipNetwork)==null?void 0:r.caipNetworkId).then(n=>{let i=this.balances[e.address]||0;n.balances.length>0&&(i=n.balances.reduce((s,o)=>s+((o==null?void 0:o.value)||0),0)),this.balances[e.address]=i,this.requestUpdate()})})}getAddressIcon(e){return e==="smartAccount"?"lightbulb":"mail"}render(){var e,r;return M` ${this.allAccounts.map((n,i)=>this.getAddressTemplate(n,i))} `}getAddressTemplate(e,r){var a,c,u,l;const n=(a=this.labels)==null?void 0:a.get(e.address),i=F.state.activeChain,o=ge.getConnectorId(i)===_e.CONNECTOR_ID.AUTH;return M` ${o?M``:M``} ${n||nt.getTruncateString({string:e.address,charsStart:4,charsEnd:6,truncate:"middle"})} ${typeof this.balances[e.address]=="number"?`$${(c=this.balances[e.address])==null?void 0:c.toFixed(2)}`:M``} ${((u=e.address)==null?void 0:u.toLowerCase())===((l=this.currentAddress)==null?void 0:l.toLowerCase())?"":M` this.onSwitchAddress(e.address)} >Switch to `} `}onSwitchAddress(e){const r=F.state.activeCaipNetwork,n=r==null?void 0:r.chainNamespace,i=`${n}:${r==null?void 0:r.id}:${e}`;re.setCaipAddress(i,n),We.close()}};Hm.styles=vSe;Q7([G()],Hm.prototype,"allAccounts",void 0);Q7([G()],Hm.prototype,"balances",void 0);Hm=Q7([te("w3m-switch-address-view")],Hm);const _Se=de` :host { display: flex; align-items: center; justify-content: center; } label { position: relative; display: inline-block; width: 32px; height: 22px; } input { width: 0; height: 0; opacity: 0; } span { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--wui-color-blue-100); border-width: 1px; border-style: solid; border-color: var(--wui-color-gray-glass-002); border-radius: 999px; transition: background-color var(--wui-ease-inout-power-1) var(--wui-duration-md), border-color var(--wui-ease-inout-power-1) var(--wui-duration-md); will-change: background-color, border-color; } span:before { position: absolute; content: ''; height: 16px; width: 16px; left: 3px; top: 2px; background-color: var(--wui-color-inverse-100); transition: transform var(--wui-ease-inout-power-1) var(--wui-duration-lg); will-change: transform; border-radius: 50%; } input:checked + span { border-color: var(--wui-color-gray-glass-005); background-color: var(--wui-color-blue-100); } input:not(:checked) + span { background-color: var(--wui-color-gray-glass-010); } input:checked + span:before { transform: translateX(calc(100% - 7px)); } `;var nQ=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let g6=class extends se{constructor(){super(...arguments),this.inputElementRef=ec(),this.checked=void 0}render(){return M` `}dispatchChangeEvent(){var e;this.dispatchEvent(new CustomEvent("switchChange",{detail:(e=this.inputElementRef.value)==null?void 0:e.checked,bubbles:!0,composed:!0}))}};g6.styles=[He,vt,qv,_Se];nQ([q({type:Boolean})],g6.prototype,"checked",void 0);g6=nQ([te("wui-switch")],g6);const ESe=de` :host { height: 100%; } button { display: flex; align-items: center; justify-content: center; column-gap: var(--wui-spacing-1xs); padding: var(--wui-spacing-xs) var(--wui-spacing-s); background-color: var(--wui-color-gray-glass-002); border-radius: var(--wui-border-radius-xs); box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-002); transition: background-color var(--wui-ease-out-power-1) var(--wui-duration-md); will-change: background-color; cursor: pointer; } wui-switch { pointer-events: none; } `;var iQ=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let m6=class extends se{constructor(){super(...arguments),this.checked=void 0}render(){return M` `}};m6.styles=[He,vt,ESe];iQ([q({type:Boolean})],m6.prototype,"checked",void 0);m6=iQ([te("wui-certified-switch")],m6);const CSe=de` button { background-color: var(--wui-color-fg-300); border-radius: var(--wui-border-radius-4xs); width: 16px; height: 16px; } button:disabled { background-color: var(--wui-color-bg-300); } wui-icon { color: var(--wui-color-bg-200) !important; } button:focus-visible { background-color: var(--wui-color-fg-250); border: 1px solid var(--wui-color-accent-100); } @media (hover: hover) and (pointer: fine) { button:hover:enabled { background-color: var(--wui-color-fg-250); } button:active:enabled { background-color: var(--wui-color-fg-225); } } `;var sQ=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let w6=class extends se{constructor(){super(...arguments),this.icon="copy"}render(){return M` `}};w6.styles=[He,vt,CSe];sQ([q()],w6.prototype,"icon",void 0);w6=sQ([te("wui-input-element")],w6);const ASe=de` :host { position: relative; display: inline-block; width: 100%; } `;var xSe=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let QP=class extends se{constructor(){super(...arguments),this.inputComponentRef=ec()}render(){return M` `}clearValue(){const e=this.inputComponentRef.value,r=e==null?void 0:e.inputElementRef.value;r&&(r.value="",r.focus(),r.dispatchEvent(new Event("input")))}};QP.styles=[He,ASe];QP=xSe([te("wui-search-bar")],QP);const SSe=de` :host { display: flex; flex-direction: column; align-items: center; width: 104px; row-gap: var(--wui-spacing-xs); padding: var(--wui-spacing-xs) 10px; background-color: var(--wui-color-gray-glass-002); border-radius: clamp(0px, var(--wui-border-radius-xs), 20px); position: relative; } wui-shimmer[data-type='network'] { border: none; -webkit-clip-path: var(--wui-path-network); clip-path: var(--wui-path-network); } svg { position: absolute; width: 48px; height: 54px; z-index: 1; } svg > path { stroke: var(--wui-color-gray-glass-010); stroke-width: 1px; } @media (max-width: 350px) { :host { width: 100%; } } `;var oQ=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let b6=class extends se{constructor(){super(...arguments),this.type="wallet"}render(){return M` ${this.shimmerTemplate()} `}shimmerTemplate(){return this.type==="network"?M` ${eQ}`:M``}};b6.styles=[He,vt,SSe];oQ([q()],b6.prototype,"type",void 0);b6=oQ([te("wui-card-select-loader")],b6);const TSe=de` :host { display: grid; width: inherit; height: inherit; } `;var fo=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Qi=class extends se{render(){return this.style.cssText=` grid-template-rows: ${this.gridTemplateRows}; grid-template-columns: ${this.gridTemplateColumns}; justify-items: ${this.justifyItems}; align-items: ${this.alignItems}; justify-content: ${this.justifyContent}; align-content: ${this.alignContent}; column-gap: ${this.columnGap&&`var(--wui-spacing-${this.columnGap})`}; row-gap: ${this.rowGap&&`var(--wui-spacing-${this.rowGap})`}; gap: ${this.gap&&`var(--wui-spacing-${this.gap})`}; padding-top: ${this.padding&&nt.getSpacingStyles(this.padding,0)}; padding-right: ${this.padding&&nt.getSpacingStyles(this.padding,1)}; padding-bottom: ${this.padding&&nt.getSpacingStyles(this.padding,2)}; padding-left: ${this.padding&&nt.getSpacingStyles(this.padding,3)}; margin-top: ${this.margin&&nt.getSpacingStyles(this.margin,0)}; margin-right: ${this.margin&&nt.getSpacingStyles(this.margin,1)}; margin-bottom: ${this.margin&&nt.getSpacingStyles(this.margin,2)}; margin-left: ${this.margin&&nt.getSpacingStyles(this.margin,3)}; `,M``}};Qi.styles=[He,TSe];fo([q()],Qi.prototype,"gridTemplateRows",void 0);fo([q()],Qi.prototype,"gridTemplateColumns",void 0);fo([q()],Qi.prototype,"justifyItems",void 0);fo([q()],Qi.prototype,"alignItems",void 0);fo([q()],Qi.prototype,"justifyContent",void 0);fo([q()],Qi.prototype,"alignContent",void 0);fo([q()],Qi.prototype,"columnGap",void 0);fo([q()],Qi.prototype,"rowGap",void 0);fo([q()],Qi.prototype,"gap",void 0);fo([q()],Qi.prototype,"padding",void 0);fo([q()],Qi.prototype,"margin",void 0);Qi=fo([te("wui-grid")],Qi);const ISe=de` button { display: flex; flex-direction: column; justify-content: center; align-items: center; cursor: pointer; width: 104px; row-gap: var(--wui-spacing-xs); padding: var(--wui-spacing-s) var(--wui-spacing-0); background-color: var(--wui-color-gray-glass-002); border-radius: clamp(0px, var(--wui-border-radius-xs), 20px); transition: color var(--wui-duration-lg) var(--wui-ease-out-power-1), background-color var(--wui-duration-lg) var(--wui-ease-out-power-1), border-radius var(--wui-duration-lg) var(--wui-ease-out-power-1); will-change: background-color, color, border-radius; outline: none; border: none; } button > wui-flex > wui-text { color: var(--wui-color-fg-100); max-width: 86px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; justify-content: center; } button > wui-flex > wui-text.certified { max-width: 66px; } button:hover:enabled { background-color: var(--wui-color-gray-glass-005); } button:disabled > wui-flex > wui-text { color: var(--wui-color-gray-glass-015); } [data-selected='true'] { background-color: var(--wui-color-accent-glass-020); } @media (hover: hover) and (pointer: fine) { [data-selected='true']:hover:enabled { background-color: var(--wui-color-accent-glass-015); } } [data-selected='true']:active:enabled { background-color: var(--wui-color-accent-glass-010); } @media (max-width: 350px) { button { width: 100%; } } `;var h2=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let cp=class extends se{constructor(){super(),this.observer=new IntersectionObserver(()=>{}),this.visible=!1,this.imageSrc=void 0,this.imageLoading=!1,this.wallet=void 0,this.observer=new IntersectionObserver(e=>{e.forEach(r=>{r.isIntersecting?(this.visible=!0,this.fetchImageSrc()):this.visible=!1})},{threshold:.01})}firstUpdated(){this.observer.observe(this)}disconnectedCallback(){this.observer.disconnect()}render(){var r,n;const e=((r=this.wallet)==null?void 0:r.badge_type)==="certified";return M` `}imageTemplate(){var e,r;return!this.visible&&!this.imageSrc||this.imageLoading?this.shimmerTemplate():M` `}shimmerTemplate(){return M``}async fetchImageSrc(){this.wallet&&(this.imageSrc=pt.getWalletImage(this.wallet),!this.imageSrc&&(this.imageLoading=!0,this.imageSrc=await pt.fetchWalletImage(this.wallet.image_id),this.imageLoading=!1))}};cp.styles=ISe;h2([G()],cp.prototype,"visible",void 0);h2([G()],cp.prototype,"imageSrc",void 0);h2([G()],cp.prototype,"imageLoading",void 0);h2([q()],cp.prototype,"wallet",void 0);cp=h2([te("w3m-all-wallets-list-item")],cp);const PSe=de` wui-grid { max-height: clamp(360px, 400px, 80vh); overflow: scroll; scrollbar-width: none; grid-auto-rows: min-content; grid-template-columns: repeat(auto-fill, 104px); } @media (max-width: 350px) { wui-grid { grid-template-columns: repeat(2, 1fr); } } wui-grid[data-scroll='false'] { overflow: hidden; } wui-grid::-webkit-scrollbar { display: none; } wui-loading-spinner { padding-top: var(--wui-spacing-l); padding-bottom: var(--wui-spacing-l); justify-content: center; grid-column: 1 / span 4; } `;var f1=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};const SD="local-paginator";let Od=class extends se{constructor(){super(),this.unsubscribe=[],this.paginationObserver=void 0,this.loading=!Ne.state.wallets.length,this.wallets=Ne.state.wallets,this.recommended=Ne.state.recommended,this.featured=Ne.state.featured,this.filteredWallets=Ne.state.filteredWallets,this.unsubscribe.push(Ne.subscribeKey("wallets",e=>this.wallets=e),Ne.subscribeKey("recommended",e=>this.recommended=e),Ne.subscribeKey("featured",e=>this.featured=e),Ne.subscribeKey("filteredWallets",e=>this.filteredWallets=e))}firstUpdated(){this.initialFetch(),this.createPaginationObserver()}disconnectedCallback(){var e;this.unsubscribe.forEach(r=>r()),(e=this.paginationObserver)==null||e.disconnect()}render(){return M` ${this.loading?this.shimmerTemplate(16):this.walletsTemplate()} ${this.paginationLoaderTemplate()} `}async initialFetch(){var r;this.loading=!0;const e=(r=this.shadowRoot)==null?void 0:r.querySelector("wui-grid");e&&(await Ne.fetchWalletsByPage({page:1}),await e.animate([{opacity:1},{opacity:0}],{duration:200,fill:"forwards",easing:"ease"}).finished,this.loading=!1,e.animate([{opacity:0},{opacity:1}],{duration:200,fill:"forwards",easing:"ease"}))}shimmerTemplate(e,r){return[...Array(e)].map(()=>M` `)}walletsTemplate(){var n;const e=((n=this.filteredWallets)==null?void 0:n.length)>0?ue.uniqueBy([...this.featured,...this.recommended,...this.filteredWallets],"id"):ue.uniqueBy([...this.featured,...this.recommended,...this.wallets],"id");return Ou.markWalletsAsInstalled(e).map(i=>M` this.onConnectWallet(i)} .wallet=${i} > `)}paginationLoaderTemplate(){const{wallets:e,recommended:r,featured:n,count:i}=Ne.state,s=window.innerWidth<352?3:4,o=e.length+r.length;let c=Math.ceil(o/s)*s-o+s;return c-=e.length?n.length%s:0,i===0&&n.length>0?null:i===0||[...n,...e,...r].length{if(n!=null&&n.isIntersecting&&!this.loading){const{page:i,count:s,wallets:o}=Ne.state;o.length=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let qm=class extends se{constructor(){super(...arguments),this.prevQuery="",this.prevBadge=void 0,this.loading=!0,this.query=""}render(){return this.onSearch(),this.loading?M``:this.walletsTemplate()}async onSearch(){(this.query.trim()!==this.prevQuery.trim()||this.badge!==this.prevBadge)&&(this.prevQuery=this.query,this.prevBadge=this.badge,this.loading=!0,await Ne.searchWallet({search:this.query,badge:this.badge}),this.loading=!1)}walletsTemplate(){const{search:e}=Ne.state,r=Ou.markWalletsAsInstalled(e);return e.length?M` ${r.map(n=>M` this.onConnectWallet(n)} .wallet=${n} data-testid="wallet-search-item-${n.id}" > `)} `:M` No Wallet found `}onConnectWallet(e){ge.selectWalletConnector(e)}};qm.styles=OSe;DA([G()],qm.prototype,"loading",void 0);DA([q()],qm.prototype,"query",void 0);DA([q()],qm.prototype,"badge",void 0);qm=DA([te("w3m-all-wallets-search")],qm);var X7=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Vy=class extends se{constructor(){super(...arguments),this.search="",this.onDebouncedSearch=ue.debounce(e=>{this.search=e})}render(){const e=this.search.length>=2;return M` ${this.qrButtonTemplate()} ${e||this.badge?M``:M``} `}onInputChange(e){this.onDebouncedSearch(e.detail)}onClick(){if(this.badge==="certified"){this.badge=void 0;return}this.badge="certified",Fe.showSvg("Only WalletConnect certified",{icon:"walletConnectBrown",iconColor:"accent-100"})}qrButtonTemplate(){return ue.isMobile()?M` `:null}onWalletConnectQr(){X.push("ConnectingWalletConnect")}};X7([G()],Vy.prototype,"search",void 0);X7([G()],Vy.prototype,"badge",void 0);Vy=X7([te("w3m-all-wallets-view")],Vy);const RSe=de` button { column-gap: var(--wui-spacing-s); padding: 16.5px var(--wui-spacing-l) 16.5px var(--wui-spacing-xs); width: 100%; background-color: var(--wui-color-gray-glass-002); border-radius: var(--wui-border-radius-xs); color: var(--wui-color-fg-100); justify-content: center; align-items: center; } button:disabled { background-color: var(--wui-color-gray-glass-015); color: var(--wui-color-gray-glass-015); } `;var MA=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let zm=class extends se{constructor(){super(...arguments),this.text="",this.disabled=!1,this.tabIdx=void 0}render(){return M` `}};zm.styles=[He,vt,RSe];MA([q()],zm.prototype,"text",void 0);MA([q({type:Boolean})],zm.prototype,"disabled",void 0);MA([q()],zm.prototype,"tabIdx",void 0);zm=MA([te("wui-list-button")],zm);const kSe=de` wui-separator { margin: var(--wui-spacing-s) calc(var(--wui-spacing-s) * -1); width: calc(100% + var(--wui-spacing-s) * 2); } wui-email-input { width: 100%; } form { width: 100%; display: block; position: relative; } wui-icon-link, wui-loading-spinner { position: absolute; top: 50%; transform: translateY(-50%); } wui-icon-link { right: var(--wui-spacing-xs); } wui-loading-spinner { right: var(--wui-spacing-m); } wui-text { margin: var(--wui-spacing-xxs) var(--wui-spacing-m) var(--wui-spacing-0) var(--wui-spacing-m); } `;var f2=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let up=class extends se{constructor(){super(...arguments),this.unsubscribe=[],this.formRef=ec(),this.email="",this.loading=!1,this.error=""}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}firstUpdated(){var e;(e=this.formRef.value)==null||e.addEventListener("keydown",r=>{r.key==="Enter"&&this.onSubmitEmail(r)})}render(){return M`
${this.submitButtonTemplate()}${this.loadingTemplate()}
${this.templateError()} `}submitButtonTemplate(){return!this.loading&&this.email.length>3?M` `:null}loadingTemplate(){return this.loading?M``:null}templateError(){return this.error?M`${this.error}`:null}onEmailInputChange(e){this.email=e.detail.trim(),this.error=""}async onSubmitEmail(e){if(!_e.AUTH_CONNECTOR_SUPPORTED_CHAINS.find(n=>n===F.state.activeChain)){const n=F.getFirstCaipNetworkSupportsAuthConnector();if(n){X.push("SwitchNetwork",{network:n});return}}try{if(this.loading)return;this.loading=!0,e.preventDefault();const n=ge.getAuthConnector();if(!n)throw new Error("w3m-email-login-widget: Auth connector not found");const{action:i}=await n.provider.connectEmail({email:this.email});Re.sendEvent({type:"track",event:"EMAIL_SUBMITTED"}),i==="VERIFY_OTP"?(Re.sendEvent({type:"track",event:"EMAIL_VERIFICATION_CODE_SENT"}),X.push("EmailVerifyOtp",{email:this.email})):i==="VERIFY_DEVICE"?X.push("EmailVerifyDevice",{email:this.email}):i==="CONNECT"&&(await xe.connectExternal(n,F.state.activeChain),X.replace("Account"))}catch(n){const i=ue.parseError(n);i!=null&&i.includes("Invalid email")?this.error="Invalid email. Try again.":Fe.showError(n)}finally{this.loading=!1}}onFocusEvent(){Re.sendEvent({type:"track",event:"EMAIL_LOGIN_SELECTED"})}};up.styles=kSe;f2([q()],up.prototype,"tabIdx",void 0);f2([G()],up.prototype,"email",void 0);f2([G()],up.prototype,"loading",void 0);f2([G()],up.prototype,"error",void 0);up=f2([te("w3m-email-login-widget")],up);const NSe=de` :host { display: block; width: 100%; } button { width: 100%; height: 56px; background: var(--wui-color-gray-glass-002); border-radius: var(--wui-border-radius-xs); } `;var LA=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Wm=class extends se{constructor(){super(...arguments),this.logo="google",this.disabled=!1,this.tabIdx=void 0}render(){return M` `}};Wm.styles=[He,vt,NSe];LA([q()],Wm.prototype,"logo",void 0);LA([q({type:Boolean})],Wm.prototype,"disabled",void 0);LA([q()],Wm.prototype,"tabIdx",void 0);Wm=LA([te("wui-logo-select")],Wm);const $Se=de` wui-separator { margin: var(--wui-spacing-m) calc(var(--wui-spacing-m) * -1) var(--wui-spacing-m) calc(var(--wui-spacing-m) * -1); width: calc(100% + var(--wui-spacing-s) * 2); } `;var Bp=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};const TD=2,ID=6;let Wu=class extends se{constructor(){super(),this.unsubscribe=[],this.walletGuide="get-started",this.tabIdx=void 0,this.connectors=ge.state.connectors,this.remoteFeatures=oe.state.remoteFeatures,this.authConnector=this.connectors.find(e=>e.type==="AUTH"),this.isPwaLoading=!1,this.unsubscribe.push(ge.subscribeKey("connectors",e=>{this.connectors=e,this.authConnector=this.connectors.find(r=>r.type==="AUTH")}),oe.subscribeKey("remoteFeatures",e=>this.remoteFeatures=e))}connectedCallback(){super.connectedCallback(),this.handlePwaFrameLoad()}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return M` ${this.topViewTemplate()}${this.bottomViewTemplate()} `}topViewTemplate(){var n;const e=this.walletGuide==="explore";let r=(n=this.remoteFeatures)==null?void 0:n.socials;return!r&&e?(r=ct.DEFAULT_SOCIALS,this.renderTopViewContent(r)):r?this.renderTopViewContent(r):null}renderTopViewContent(e){return e.length===2?M` ${e.slice(0,TD).map(r=>M`{this.onSocialClick(r)}} logo=${r} tabIdx=${we(this.tabIdx)} ?disabled=${this.isPwaLoading} >`)} `:M` {this.onSocialClick(e[0])}} logo=${we(e[0])} align="center" name=${`Continue with ${e[0]}`} tabIdx=${we(this.tabIdx)} ?disabled=${this.isPwaLoading} >`}bottomViewTemplate(){var i;let e=(i=this.remoteFeatures)==null?void 0:i.socials;const r=this.walletGuide==="explore";return(!this.authConnector||!e||e.length===0)&&r&&(e=ct.DEFAULT_SOCIALS),!e||e.length<=TD?null:e&&e.length>ID?M` ${e.slice(1,ID-1).map(s=>M`{this.onSocialClick(s)}} logo=${s} tabIdx=${we(this.tabIdx)} ?focusable=${this.tabIdx!==void 0&&this.tabIdx>=0} ?disabled=${this.isPwaLoading} >`)} `:e?M` ${e.slice(1,e.length).map(s=>M`{this.onSocialClick(s)}} logo=${s} tabIdx=${we(this.tabIdx)} ?focusable=${this.tabIdx!==void 0&&this.tabIdx>=0} ?disabled=${this.isPwaLoading} >`)} `:null}onMoreSocialsClick(){X.push("ConnectSocials")}async onSocialClick(e){if(!_e.AUTH_CONNECTOR_SUPPORTED_CHAINS.find(n=>n===F.state.activeChain)){const n=F.getFirstCaipNetworkSupportsAuthConnector();if(n){X.push("SwitchNetwork",{network:n});return}}e&&await OZ(e)}async handlePwaFrameLoad(){var e;if(ue.isPWA()){this.isPwaLoading=!0;try{((e=this.authConnector)==null?void 0:e.provider)instanceof s7&&await this.authConnector.provider.init()}catch(r){Fn.open({shortMessage:"Error loading embedded wallet in PWA",longMessage:r.message},"error")}finally{this.isPwaLoading=!1}}}};Wu.styles=$Se;Bp([q()],Wu.prototype,"walletGuide",void 0);Bp([q()],Wu.prototype,"tabIdx",void 0);Bp([G()],Wu.prototype,"connectors",void 0);Bp([G()],Wu.prototype,"remoteFeatures",void 0);Bp([G()],Wu.prototype,"authConnector",void 0);Bp([G()],Wu.prototype,"isPwaLoading",void 0);Wu=Bp([te("w3m-social-login-widget")],Wu);const jSe=de` wui-flex { width: 100%; } .wallet-guide { width: 100%; } .chip-box { width: fit-content; background-color: var(--wui-color-gray-glass-005); border-radius: var(--wui-border-radius-3xl); } `;var eO=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Gy=class extends se{constructor(){super(...arguments),this.walletGuide="get-started"}render(){return this.walletGuide==="explore"?M` Looking for a self-custody wallet? `:M` Haven't got a wallet? Get started `}onGetStarted(){X.push("Create")}};Gy.styles=jSe;eO([q()],Gy.prototype,"tabIdx",void 0);eO([q()],Gy.prototype,"walletGuide",void 0);Gy=eO([te("w3m-wallet-guide")],Gy);const BSe=de` :host { position: relative; border-radius: var(--wui-border-radius-xxs); width: 40px; height: 40px; overflow: hidden; background: var(--wui-color-gray-glass-002); display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: var(--wui-spacing-4xs); padding: 3.75px !important; } :host::after { content: ''; position: absolute; top: 0; bottom: 0; left: 0; right: 0; border-radius: inherit; border: 1px solid var(--wui-color-gray-glass-010); pointer-events: none; } :host > wui-wallet-image { width: 14px; height: 14px; border-radius: var(--wui-border-radius-5xs); } :host > wui-flex { padding: 2px; position: fixed; overflow: hidden; left: 34px; bottom: 8px; background: var(--dark-background-150, #1e1f1f); border-radius: 50%; z-index: 2; display: flex; } `;var aQ=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};const oT=4;let y6=class extends se{constructor(){super(...arguments),this.walletImages=[]}render(){const e=this.walletImages.lengthM` `)} ${e?[...Array(oT-this.walletImages.length)].map(()=>M` `):null} `}};y6.styles=[He,BSe];aQ([q({type:Array})],y6.prototype,"walletImages",void 0);y6=aQ([te("wui-all-wallets-image")],y6);const DSe=de` button { column-gap: var(--wui-spacing-s); padding: 7px var(--wui-spacing-l) 7px var(--wui-spacing-xs); width: 100%; background-color: var(--wui-color-gray-glass-002); border-radius: var(--wui-border-radius-xs); color: var(--wui-color-fg-100); } button > wui-text:nth-child(2) { display: flex; flex: 1; } button:disabled { background-color: var(--wui-color-gray-glass-015); color: var(--wui-color-gray-glass-015); } button:disabled > wui-tag { background-color: var(--wui-color-gray-glass-010); color: var(--wui-color-fg-300); } wui-icon { color: var(--wui-color-fg-200) !important; } `;var ts=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let ii=class extends se{constructor(){super(...arguments),this.walletImages=[],this.imageSrc="",this.name="",this.tabIdx=void 0,this.installed=!1,this.disabled=!1,this.showAllWallets=!1,this.loading=!1,this.loadingSpinnerColor="accent-100"}render(){return M` `}templateAllWallets(){return this.showAllWallets&&this.imageSrc?M` `:this.showAllWallets&&this.walletIcon?M` `:null}templateWalletImage(){return!this.showAllWallets&&this.imageSrc?M``:!this.showAllWallets&&!this.imageSrc?M``:null}templateStatus(){return this.loading?M``:this.tagLabel&&this.tagVariant?M`${this.tagLabel}`:this.icon?M``:null}};ii.styles=[He,vt,DSe];ts([q({type:Array})],ii.prototype,"walletImages",void 0);ts([q()],ii.prototype,"imageSrc",void 0);ts([q()],ii.prototype,"name",void 0);ts([q()],ii.prototype,"tagLabel",void 0);ts([q()],ii.prototype,"tagVariant",void 0);ts([q()],ii.prototype,"icon",void 0);ts([q()],ii.prototype,"walletIcon",void 0);ts([q()],ii.prototype,"tabIdx",void 0);ts([q({type:Boolean})],ii.prototype,"installed",void 0);ts([q({type:Boolean})],ii.prototype,"disabled",void 0);ts([q({type:Boolean})],ii.prototype,"showAllWallets",void 0);ts([q({type:Boolean})],ii.prototype,"loading",void 0);ts([q({type:String})],ii.prototype,"loadingSpinnerColor",void 0);ii=ts([te("wui-list-wallet")],ii);var p1=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let lp=class extends se{constructor(){super(),this.unsubscribe=[],this.tabIdx=void 0,this.connectors=ge.state.connectors,this.count=Ne.state.count,this.filteredCount=Ne.state.filteredWallets.length,this.isFetchingRecommendedWallets=Ne.state.isFetchingRecommendedWallets,this.unsubscribe.push(ge.subscribeKey("connectors",e=>this.connectors=e),Ne.subscribeKey("count",e=>this.count=e),Ne.subscribeKey("filteredWallets",e=>this.filteredCount=e.length),Ne.subscribeKey("isFetchingRecommendedWallets",e=>this.isFetchingRecommendedWallets=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){const e=this.connectors.find(c=>c.id==="walletConnect"),{allWallets:r}=oe.state;if(!e||r==="HIDE"||r==="ONLY_MOBILE"&&!ue.isMobile())return null;const n=Ne.state.featured.length,i=this.count+n,s=i<10?i:Math.floor(i/10)*10,o=this.filteredCount>0?this.filteredCount:s;let a=`${o}`;return this.filteredCount>0?a=`${this.filteredCount}`:o `}onAllWallets(){Re.sendEvent({type:"track",event:"CLICK_ALL_WALLETS"}),X.push("AllWallets")}};p1([q()],lp.prototype,"tabIdx",void 0);p1([G()],lp.prototype,"connectors",void 0);p1([G()],lp.prototype,"count",void 0);p1([G()],lp.prototype,"filteredCount",void 0);p1([G()],lp.prototype,"isFetchingRecommendedWallets",void 0);lp=p1([te("w3m-all-wallets-widget")],lp);var tO=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let v6=class extends se{constructor(){super(),this.unsubscribe=[],this.tabIdx=void 0,this.connectors=ge.state.connectors,this.unsubscribe.push(ge.subscribeKey("connectors",e=>this.connectors=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){const e=this.connectors.filter(r=>r.type==="ANNOUNCED");return e!=null&&e.length?M` ${e.filter(xu.showConnector).map(r=>M` this.onConnector(r)} tagVariant="success" tagLabel="installed" data-testid=${`wallet-selector-${r.id}`} .installed=${!0} tabIdx=${we(this.tabIdx)} > `)} `:(this.style.cssText="display: none",null)}onConnector(e){e.id==="walletConnect"?ue.isMobile()?X.push("AllWallets"):X.push("ConnectingWalletConnect"):X.push("ConnectingExternal",{connector:e})}};tO([q()],v6.prototype,"tabIdx",void 0);tO([G()],v6.prototype,"connectors",void 0);v6=tO([te("w3m-connect-announced-widget")],v6);var UA=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Ky=class extends se{constructor(){super(),this.unsubscribe=[],this.tabIdx=void 0,this.connectors=ge.state.connectors,this.loading=!1,this.unsubscribe.push(ge.subscribeKey("connectors",e=>this.connectors=e)),ue.isTelegram()&&ue.isIos()&&(this.loading=!xe.state.wcUri,this.unsubscribe.push(xe.subscribeKey("wcUri",e=>this.loading=!e)))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){const{customWallets:e}=oe.state;if(!(e!=null&&e.length))return this.style.cssText="display: none",null;const r=this.filterOutDuplicateWallets(e);return M` ${r.map(n=>M` this.onConnectWallet(n)} data-testid=${`wallet-selector-${n.id}`} tabIdx=${we(this.tabIdx)} ?loading=${this.loading} > `)} `}filterOutDuplicateWallets(e){const r=Le.getRecentWallets(),n=this.connectors.map(a=>{var c;return(c=a.info)==null?void 0:c.rdns}).filter(Boolean),i=r.map(a=>a.rdns).filter(Boolean),s=n.concat(i);if(s.includes("io.metamask.mobile")&&ue.isMobile()){const a=s.indexOf("io.metamask.mobile");s[a]="io.metamask"}return e.filter(a=>!s.includes(String(a==null?void 0:a.rdns)))}onConnectWallet(e){this.loading||X.push("ConnectingWalletConnect",{wallet:e})}};UA([q()],Ky.prototype,"tabIdx",void 0);UA([G()],Ky.prototype,"connectors",void 0);UA([G()],Ky.prototype,"loading",void 0);Ky=UA([te("w3m-connect-custom-widget")],Ky);var rO=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let _6=class extends se{constructor(){super(),this.unsubscribe=[],this.tabIdx=void 0,this.connectors=ge.state.connectors,this.unsubscribe.push(ge.subscribeKey("connectors",e=>this.connectors=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){const n=this.connectors.filter(i=>i.type==="EXTERNAL").filter(xu.showConnector).filter(i=>i.id!==_e.CONNECTOR_ID.COINBASE_SDK);return n!=null&&n.length?M` ${n.map(i=>M` this.onConnector(i)} tabIdx=${we(this.tabIdx)} > `)} `:(this.style.cssText="display: none",null)}onConnector(e){X.push("ConnectingExternal",{connector:e})}};rO([q()],_6.prototype,"tabIdx",void 0);rO([G()],_6.prototype,"connectors",void 0);_6=rO([te("w3m-connect-external-widget")],_6);var nO=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let E6=class extends se{constructor(){super(...arguments),this.tabIdx=void 0,this.wallets=[]}render(){return this.wallets.length?M` ${this.wallets.map(e=>M` this.onConnectWallet(e)} tabIdx=${we(this.tabIdx)} > `)} `:(this.style.cssText="display: none",null)}onConnectWallet(e){ge.selectWalletConnector(e)}};nO([q()],E6.prototype,"tabIdx",void 0);nO([q()],E6.prototype,"wallets",void 0);E6=nO([te("w3m-connect-featured-widget")],E6);var iO=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let C6=class extends se{constructor(){super(...arguments),this.tabIdx=void 0,this.connectors=[]}render(){const e=this.connectors.filter(xu.showConnector);return e.length===0?(this.style.cssText="display: none",null):M` ${e.map(r=>M` this.onConnector(r)} tabIdx=${we(this.tabIdx)} > `)} `}onConnector(e){ge.setActiveConnector(e),X.push("ConnectingExternal",{connector:e})}};iO([q()],C6.prototype,"tabIdx",void 0);iO([q()],C6.prototype,"connectors",void 0);C6=iO([te("w3m-connect-injected-widget")],C6);var sO=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let A6=class extends se{constructor(){super(),this.unsubscribe=[],this.tabIdx=void 0,this.connectors=ge.state.connectors,this.unsubscribe.push(ge.subscribeKey("connectors",e=>this.connectors=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){const e=this.connectors.filter(r=>r.type==="MULTI_CHAIN"&&r.name!=="WalletConnect");return e!=null&&e.length?M` ${e.map(r=>M` this.onConnector(r)} tabIdx=${we(this.tabIdx)} > `)} `:(this.style.cssText="display: none",null)}onConnector(e){ge.setActiveConnector(e),X.push("ConnectingMultiChain")}};sO([q()],A6.prototype,"tabIdx",void 0);sO([G()],A6.prototype,"connectors",void 0);A6=sO([te("w3m-connect-multi-chain-widget")],A6);var FA=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Zy=class extends se{constructor(){super(),this.unsubscribe=[],this.tabIdx=void 0,this.connectors=ge.state.connectors,this.loading=!1,this.unsubscribe.push(ge.subscribeKey("connectors",e=>this.connectors=e)),ue.isTelegram()&&ue.isIos()&&(this.loading=!xe.state.wcUri,this.unsubscribe.push(xe.subscribeKey("wcUri",e=>this.loading=!e)))}render(){const r=Le.getRecentWallets().filter(n=>!Ou.isExcluded(n)).filter(n=>!this.hasWalletConnector(n)).filter(n=>this.isWalletCompatibleWithCurrentChain(n));return r.length?M` ${r.map(n=>M` this.onConnectWallet(n)} tagLabel="recent" tagVariant="shade" tabIdx=${we(this.tabIdx)} ?loading=${this.loading} > `)} `:(this.style.cssText="display: none",null)}onConnectWallet(e){this.loading||ge.selectWalletConnector(e)}hasWalletConnector(e){return this.connectors.some(r=>r.id===e.id||r.name===e.name)}isWalletCompatibleWithCurrentChain(e){const r=F.state.activeChain;return r&&e.chains?e.chains.some(n=>{const i=n.split(":")[0];return r===i}):!0}};FA([q()],Zy.prototype,"tabIdx",void 0);FA([G()],Zy.prototype,"connectors",void 0);FA([G()],Zy.prototype,"loading",void 0);Zy=FA([te("w3m-connect-recent-widget")],Zy);var HA=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Yy=class extends se{constructor(){super(),this.unsubscribe=[],this.tabIdx=void 0,this.wallets=[],this.loading=!1,ue.isTelegram()&&ue.isIos()&&(this.loading=!xe.state.wcUri,this.unsubscribe.push(xe.subscribeKey("wcUri",e=>this.loading=!e)))}render(){const{connectors:e}=ge.state,{customWallets:r,featuredWalletIds:n}=oe.state,i=Le.getRecentWallets(),s=e.find(d=>d.id==="walletConnect"),a=e.filter(d=>d.type==="INJECTED"||d.type==="ANNOUNCED"||d.type==="MULTI_CHAIN").filter(d=>d.name!=="Browser Wallet");if(!s)return null;if(n||r||!this.wallets.length)return this.style.cssText="display: none",null;const c=a.length+i.length,u=Math.max(0,2-c),l=Ou.filterOutDuplicateWallets(this.wallets).slice(0,u);return l.length?M` ${l.map(d=>M` this.onConnectWallet(d)} tabIdx=${we(this.tabIdx)} ?loading=${this.loading} > `)} `:(this.style.cssText="display: none",null)}onConnectWallet(e){if(this.loading)return;const r=ge.getConnector(e.id,e.rdns);r?X.push("ConnectingExternal",{connector:r}):X.push("ConnectingWalletConnect",{wallet:e})}};HA([q()],Yy.prototype,"tabIdx",void 0);HA([q()],Yy.prototype,"wallets",void 0);HA([G()],Yy.prototype,"loading",void 0);Yy=HA([te("w3m-connect-recommended-widget")],Yy);var qA=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Jy=class extends se{constructor(){super(),this.unsubscribe=[],this.tabIdx=void 0,this.connectors=ge.state.connectors,this.connectorImages=er.state.connectorImages,this.unsubscribe.push(ge.subscribeKey("connectors",e=>this.connectors=e),er.subscribeKey("connectorImages",e=>this.connectorImages=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){if(ue.isMobile())return this.style.cssText="display: none",null;const e=this.connectors.find(n=>n.id==="walletConnect");if(!e)return this.style.cssText="display: none",null;const r=e.imageUrl||this.connectorImages[(e==null?void 0:e.imageId)??""];return M` this.onConnector(e)} tagLabel="qr code" tagVariant="main" tabIdx=${we(this.tabIdx)} data-testid="wallet-selector-walletconnect" > `}onConnector(e){ge.setActiveConnector(e),X.push("ConnectingWalletConnect")}};qA([q()],Jy.prototype,"tabIdx",void 0);qA([G()],Jy.prototype,"connectors",void 0);qA([G()],Jy.prototype,"connectorImages",void 0);Jy=qA([te("w3m-connect-walletconnect-widget")],Jy);const MSe=de` :host { margin-top: var(--wui-spacing-3xs); } wui-separator { margin: var(--wui-spacing-m) calc(var(--wui-spacing-m) * -1) var(--wui-spacing-xs) calc(var(--wui-spacing-m) * -1); width: calc(100% + var(--wui-spacing-s) * 2); } `;var p2=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let dp=class extends se{constructor(){super(),this.unsubscribe=[],this.tabIdx=void 0,this.connectors=ge.state.connectors,this.recommended=Ne.state.recommended,this.featured=Ne.state.featured,this.unsubscribe.push(ge.subscribeKey("connectors",e=>this.connectors=e),Ne.subscribeKey("recommended",e=>this.recommended=e),Ne.subscribeKey("featured",e=>this.featured=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return M` ${this.connectorListTemplate()} `}connectorListTemplate(){const{custom:e,recent:r,announced:n,injected:i,multiChain:s,recommended:o,featured:a,external:c}=xu.getConnectorsByType(this.connectors,this.recommended,this.featured);return xu.getConnectorTypeOrder({custom:e,recent:r,announced:n,injected:i,multiChain:s,recommended:o,featured:a,external:c}).map(l=>{switch(l){case"injected":return M` ${s.length?M``:null} ${n.length?M``:null} ${i.length?M``:null} `;case"walletConnect":return M``;case"recent":return M``;case"featured":return M``;case"custom":return M``;case"external":return M``;case"recommended":return M``;default:return console.warn(`Unknown connector type: ${l}`),null}})}};dp.styles=MSe;p2([q()],dp.prototype,"tabIdx",void 0);p2([G()],dp.prototype,"connectors",void 0);p2([G()],dp.prototype,"recommended",void 0);p2([G()],dp.prototype,"featured",void 0);dp=p2([te("w3m-connector-list")],dp);var cQ=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let XP=class extends se{constructor(){super(...arguments),this.tabIdx=void 0}render(){return M` `}};cQ([q()],XP.prototype,"tabIdx",void 0);XP=cQ([te("w3m-wallet-login-list")],XP);const LSe=de` :host { --connect-scroll--top-opacity: 0; --connect-scroll--bottom-opacity: 0; --connect-mask-image: none; } .connect { max-height: clamp(360px, 470px, 80vh); scrollbar-width: none; overflow-y: scroll; overflow-x: hidden; transition: opacity var(--wui-ease-out-power-1) var(--wui-duration-md); will-change: opacity; mask-image: var(--connect-mask-image); } .guide { transition: opacity var(--wui-ease-out-power-1) var(--wui-duration-md); will-change: opacity; } .connect::-webkit-scrollbar { display: none; } .all-wallets { flex-flow: column; } .connect.disabled, .guide.disabled { opacity: 0.3; pointer-events: none; user-select: none; } wui-separator { margin: var(--wui-spacing-s) calc(var(--wui-spacing-s) * -1); width: calc(100% + var(--wui-spacing-s) * 2); } `;var po=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};const USe=470;let Ii=class extends se{constructor(){var e,r;super(),this.unsubscribe=[],this.connectors=ge.state.connectors,this.authConnector=this.connectors.find(n=>n.type==="AUTH"),this.features=oe.state.features,this.remoteFeatures=oe.state.remoteFeatures,this.enableWallets=oe.state.enableWallets,this.noAdapters=F.state.noAdapters,this.walletGuide="get-started",this.checked=As.state.isLegalCheckboxChecked,this.isEmailEnabled=((e=this.remoteFeatures)==null?void 0:e.email)&&!F.state.noAdapters,this.isSocialEnabled=((r=this.remoteFeatures)==null?void 0:r.socials)&&this.remoteFeatures.socials.length>0&&!F.state.noAdapters,this.isAuthEnabled=this.checkIfAuthEnabled(this.connectors),this.unsubscribe.push(ge.subscribeKey("connectors",n=>{this.connectors=n,this.authConnector=this.connectors.find(i=>i.type==="AUTH"),this.isAuthEnabled=this.checkIfAuthEnabled(this.connectors)}),oe.subscribeKey("features",n=>{this.features=n}),oe.subscribeKey("remoteFeatures",n=>{this.remoteFeatures=n,this.setEmailAndSocialEnableCheck(this.noAdapters,this.remoteFeatures)}),oe.subscribeKey("enableWallets",n=>this.enableWallets=n),F.subscribeKey("noAdapters",n=>this.setEmailAndSocialEnableCheck(n,this.remoteFeatures)),As.subscribeKey("isLegalCheckboxChecked",n=>this.checked=n))}disconnectedCallback(){var r,n;this.unsubscribe.forEach(i=>i()),(r=this.resizeObserver)==null||r.disconnect();const e=(n=this.shadowRoot)==null?void 0:n.querySelector(".connect");e==null||e.removeEventListener("scroll",this.handleConnectListScroll.bind(this))}firstUpdated(){var r,n;const e=(r=this.shadowRoot)==null?void 0:r.querySelector(".connect");e&&(requestAnimationFrame(this.handleConnectListScroll.bind(this)),e==null||e.addEventListener("scroll",this.handleConnectListScroll.bind(this)),this.resizeObserver=new ResizeObserver(()=>{this.handleConnectListScroll()}),(n=this.resizeObserver)==null||n.observe(e),this.handleConnectListScroll())}render(){var h;const{termsConditionsUrl:e,privacyPolicyUrl:r}=oe.state,n=(h=oe.state.features)==null?void 0:h.legalCheckbox,o=!!(e||r)&&!!n&&this.walletGuide==="get-started"&&!this.checked,a={connect:!0,disabled:o},c=oe.state.enableWalletGuide,u=this.enableWallets,l=this.isSocialEnabled||this.authConnector,d=o?-1:void 0;return M` ${this.legalCheckboxTemplate()} ${this.renderConnectMethod(d)} ${this.guideTemplate(o)} `}setEmailAndSocialEnableCheck(e,r){this.isEmailEnabled=(r==null?void 0:r.email)&&!e,this.isSocialEnabled=(r==null?void 0:r.socials)&&r.socials.length>0&&!e,this.remoteFeatures=r,this.noAdapters=e}checkIfAuthEnabled(e){const r=e.filter(i=>i.type===Xt.CONNECTOR_TYPE_AUTH).map(i=>i.chain);return _e.AUTH_CONNECTOR_SUPPORTED_CHAINS.some(i=>r.includes(i))}renderConnectMethod(e){const r=Ou.getConnectOrderMethod(this.features,this.connectors);return M`${r.map((n,i)=>{switch(n){case"email":return M`${this.emailTemplate(e)} ${this.separatorTemplate(i,"email")}`;case"social":return M`${this.socialListTemplate(e)} ${this.separatorTemplate(i,"social")}`;case"wallet":return M`${this.walletListTemplate(e)} ${this.separatorTemplate(i,"wallet")}`;default:return null}})}`}checkMethodEnabled(e){switch(e){case"wallet":return this.enableWallets;case"social":return this.isSocialEnabled&&this.isAuthEnabled;case"email":return this.isEmailEnabled&&this.isAuthEnabled;default:return null}}checkIsThereNextMethod(e){const n=Ou.getConnectOrderMethod(this.features,this.connectors)[e+1];return n?this.checkMethodEnabled(n)?n:this.checkIsThereNextMethod(e+1):void 0}separatorTemplate(e,r){const n=this.checkIsThereNextMethod(e),i=this.walletGuide==="explore";switch(r){case"wallet":return this.enableWallets&&n&&!i?M``:null;case"email":{const s=n==="social";return this.isAuthEnabled&&this.isEmailEnabled&&!s&&n?M``:null}case"social":{const s=n==="email";return this.isAuthEnabled&&this.isSocialEnabled&&!s&&n?M``:null}default:return null}}emailTemplate(e){return!this.isEmailEnabled||!this.isAuthEnabled?null:M``}socialListTemplate(e){return!this.isSocialEnabled||!this.isAuthEnabled?null:M``}walletListTemplate(e){var a,c;const r=this.enableWallets,n=((a=this.features)==null?void 0:a.emailShowWallets)===!1,i=(c=this.features)==null?void 0:c.collapseWallets,s=n||i;return!r||(ue.isTelegram()&&(ue.isSafari()||ue.isIos())&&xe.connectWalletConnect().catch(u=>({})),this.walletGuide==="explore")?null:this.isAuthEnabled&&(this.isEmailEnabled||this.isSocialEnabled)&&s?M``:M``}guideTemplate(e=!1){if(!oe.state.enableWalletGuide)return null;const n={guide:!0,disabled:e},i=e?-1:void 0;return!this.authConnector&&!this.isSocialEnabled?null:M` ${this.walletGuide==="explore"&&!F.state.noAdapters?M``:null} `}legalCheckboxTemplate(){return this.walletGuide==="explore"?null:M``}handleConnectListScroll(){var n;const e=(n=this.shadowRoot)==null?void 0:n.querySelector(".connect");if(!e)return;e.scrollHeight>USe?(e.style.setProperty("--connect-mask-image",`linear-gradient( to bottom, rgba(0, 0, 0, calc(1 - var(--connect-scroll--top-opacity))) 0px, rgba(200, 200, 200, calc(1 - var(--connect-scroll--top-opacity))) 1px, black 40px, black calc(100% - 40px), rgba(155, 155, 155, calc(1 - var(--connect-scroll--bottom-opacity))) calc(100% - 1px), rgba(0, 0, 0, calc(1 - var(--connect-scroll--bottom-opacity))) 100% )`),e.style.setProperty("--connect-scroll--top-opacity",K0.interpolate([0,50],[0,1],e.scrollTop).toString()),e.style.setProperty("--connect-scroll--bottom-opacity",K0.interpolate([0,50],[0,1],e.scrollHeight-e.scrollTop-e.offsetHeight).toString())):(e.style.setProperty("--connect-mask-image","none"),e.style.setProperty("--connect-scroll--top-opacity","0"),e.style.setProperty("--connect-scroll--bottom-opacity","0"))}onContinueWalletClick(){X.push("ConnectWallets")}};Ii.styles=LSe;po([G()],Ii.prototype,"connectors",void 0);po([G()],Ii.prototype,"authConnector",void 0);po([G()],Ii.prototype,"features",void 0);po([G()],Ii.prototype,"remoteFeatures",void 0);po([G()],Ii.prototype,"enableWallets",void 0);po([G()],Ii.prototype,"noAdapters",void 0);po([q()],Ii.prototype,"walletGuide",void 0);po([G()],Ii.prototype,"checked",void 0);po([G()],Ii.prototype,"isEmailEnabled",void 0);po([G()],Ii.prototype,"isSocialEnabled",void 0);po([G()],Ii.prototype,"isAuthEnabled",void 0);Ii=po([te("w3m-connect-view")],Ii);const FSe=de` wui-flex { width: 100%; background-color: var(--wui-color-gray-glass-002); border-radius: var(--wui-border-radius-xs); } `;var zA=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Vm=class extends se{constructor(){super(...arguments),this.disabled=!1,this.label="",this.buttonLabel=""}render(){return M` ${this.label} `}};Vm.styles=[He,vt,FSe];zA([q({type:Boolean})],Vm.prototype,"disabled",void 0);zA([q()],Vm.prototype,"label",void 0);zA([q()],Vm.prototype,"buttonLabel",void 0);Vm=zA([te("wui-cta-button")],Vm);const HSe=de` :host { display: block; padding: 0 var(--wui-spacing-xl) var(--wui-spacing-xl); } `;var uQ=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let x6=class extends se{constructor(){super(...arguments),this.wallet=void 0}render(){if(!this.wallet)return this.style.display="none",null;const{name:e,app_store:r,play_store:n,chrome_store:i,homepage:s}=this.wallet,o=ue.isMobile(),a=ue.isIos(),c=ue.isAndroid(),u=[r,n,s,i].filter(Boolean).length>1,l=nt.getTruncateString({string:e,charsStart:12,charsEnd:0,truncate:"end"});return u&&!o?M` X.push("Downloads",{wallet:this.wallet})} > `:!u&&s?M` `:r&&a?M` `:n&&c?M` `:(this.style.display="none",null)}onAppStore(){var e;(e=this.wallet)!=null&&e.app_store&&ue.openHref(this.wallet.app_store,"_blank")}onPlayStore(){var e;(e=this.wallet)!=null&&e.play_store&&ue.openHref(this.wallet.play_store,"_blank")}onHomePage(){var e;(e=this.wallet)!=null&&e.homepage&&ue.openHref(this.wallet.homepage,"_blank")}};x6.styles=[HSe];uQ([q({type:Object})],x6.prototype,"wallet",void 0);x6=uQ([te("w3m-mobile-download-links")],x6);const qSe=de` @keyframes shake { 0% { transform: translateX(0); } 25% { transform: translateX(3px); } 50% { transform: translateX(-3px); } 75% { transform: translateX(3px); } 100% { transform: translateX(0); } } wui-flex:first-child:not(:only-child) { position: relative; } wui-loading-thumbnail { position: absolute; } wui-icon-box { position: absolute; right: calc(var(--wui-spacing-3xs) * -1); bottom: calc(var(--wui-spacing-3xs) * -1); opacity: 0; transform: scale(0.5); transition-property: opacity, transform; transition-duration: var(--wui-duration-lg); transition-timing-function: var(--wui-ease-out-power-2); will-change: opacity, transform; } wui-text[align='center'] { width: 100%; padding: 0px var(--wui-spacing-l); } [data-error='true'] wui-icon-box { opacity: 1; transform: scale(1); } [data-error='true'] > wui-flex:first-child { animation: shake 250ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both; } [data-retry='false'] wui-link { display: none; } [data-retry='true'] wui-link { display: block; opacity: 1; } `;var fc=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};class Vn extends se{constructor(){var e,r,n,i,s;super(),this.wallet=(e=X.state.data)==null?void 0:e.wallet,this.connector=(r=X.state.data)==null?void 0:r.connector,this.timeout=void 0,this.secondaryBtnIcon="refresh",this.onConnect=void 0,this.onRender=void 0,this.onAutoConnect=void 0,this.isWalletConnect=!0,this.unsubscribe=[],this.imageSrc=pt.getWalletImage(this.wallet)??pt.getConnectorImage(this.connector),this.name=((n=this.wallet)==null?void 0:n.name)??((i=this.connector)==null?void 0:i.name)??"Wallet",this.isRetrying=!1,this.uri=xe.state.wcUri,this.error=xe.state.wcError,this.ready=!1,this.showRetry=!1,this.secondaryBtnLabel="Try again",this.secondaryLabel="Accept connection request in the wallet",this.isLoading=!1,this.isMobile=!1,this.onRetry=void 0,this.unsubscribe.push(xe.subscribeKey("wcUri",o=>{var a;this.uri=o,this.isRetrying&&this.onRetry&&(this.isRetrying=!1,(a=this.onConnect)==null||a.call(this))}),xe.subscribeKey("wcError",o=>this.error=o)),(ue.isTelegram()||ue.isSafari())&&ue.isIos()&&xe.state.wcUri&&((s=this.onConnect)==null||s.call(this))}firstUpdated(){var e;(e=this.onAutoConnect)==null||e.call(this),this.showRetry=!this.onAutoConnect}disconnectedCallback(){this.unsubscribe.forEach(e=>e()),xe.setWcError(!1),clearTimeout(this.timeout)}render(){var n;(n=this.onRender)==null||n.call(this),this.onShowRetry();const e=this.error?"Connection can be declined if a previous request is still active":this.secondaryLabel;let r=`Continue in ${this.name}`;return this.error&&(r="Connection declined"),M` ${this.error?null:this.loaderTemplate()} ${r} ${e} ${this.secondaryBtnLabel?M` ${this.secondaryBtnLabel} `:null} ${this.isWalletConnect?M` Copy link `:null} `}onShowRetry(){var e;if(this.error&&!this.showRetry){this.showRetry=!0;const r=(e=this.shadowRoot)==null?void 0:e.querySelector("wui-button");r==null||r.animate([{opacity:0},{opacity:1}],{fill:"forwards",easing:"ease"})}}onTryAgain(){var e,r;xe.setWcError(!1),this.onRetry?(this.isRetrying=!0,(e=this.onRetry)==null||e.call(this)):(r=this.onConnect)==null||r.call(this)}loaderTemplate(){const e=ar.state.themeVariables["--w3m-border-radius-master"],r=e?parseInt(e.replace("px",""),10):4;return M``}onCopyUri(){try{this.uri&&(ue.copyToClopboard(this.uri),Fe.showSuccess("Link copied"))}catch{Fe.showError("Failed to copy")}}}Vn.styles=qSe;fc([G()],Vn.prototype,"isRetrying",void 0);fc([G()],Vn.prototype,"uri",void 0);fc([G()],Vn.prototype,"error",void 0);fc([G()],Vn.prototype,"ready",void 0);fc([G()],Vn.prototype,"showRetry",void 0);fc([G()],Vn.prototype,"secondaryBtnLabel",void 0);fc([G()],Vn.prototype,"secondaryLabel",void 0);fc([G()],Vn.prototype,"isLoading",void 0);fc([q({type:Boolean})],Vn.prototype,"isMobile",void 0);fc([q()],Vn.prototype,"onRetry",void 0);var zSe=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let e9=class extends Vn{constructor(){if(super(),this.externalViewUnsubscribe=[],!this.connector)throw new Error("w3m-connecting-view: No connector provided");Re.sendEvent({type:"track",event:"SELECT_WALLET",properties:{name:this.connector.name??"Unknown",platform:"browser"}}),this.onConnect=this.onConnectProxy.bind(this),this.onAutoConnect=this.onConnectProxy.bind(this),this.isWalletConnect=!1,this.externalViewUnsubscribe.push(F.subscribeKey("activeCaipAddress",e=>{e&&We.close()}))}disconnectedCallback(){this.externalViewUnsubscribe.forEach(e=>e())}async onConnectProxy(){try{this.error=!1,this.connector&&(this.connector.id!==_e.CONNECTOR_ID.COINBASE_SDK||!this.error)&&(await xe.connectExternal(this.connector,this.connector.chain),Re.sendEvent({type:"track",event:"CONNECT_SUCCESS",properties:{method:"browser",name:this.connector.name||"Unknown"}}))}catch(e){Re.sendEvent({type:"track",event:"CONNECT_ERROR",properties:{message:(e==null?void 0:e.message)??"Unknown"}}),this.error=!0}}};e9=zSe([te("w3m-connecting-external-view")],e9);const WSe=de` wui-flex, wui-list-wallet { width: 100%; } `;var lQ=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Qy=class extends se{constructor(){super(),this.unsubscribe=[],this.activeConnector=ge.state.activeConnector,this.unsubscribe.push(ge.subscribeKey("activeConnector",e=>this.activeConnector=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){var e;return M` Select Chain for ${(e=this.activeConnector)==null?void 0:e.name} Select which chain to connect to your multi chain wallet ${this.networksTemplate()} `}networksTemplate(){var e,r;return(r=(e=this.activeConnector)==null?void 0:e.connectors)==null?void 0:r.map(n=>n.name?M` this.onConnector(n)} data-testid="wui-list-chain-${n.chain}" > `:null)}onConnector(e){var n,i;const r=(i=(n=this.activeConnector)==null?void 0:n.connectors)==null?void 0:i.find(s=>s.chain===e.chain);if(!r){Fe.showError("Failed to find connector");return}r.id==="walletConnect"?ue.isMobile()?X.push("AllWallets"):X.push("ConnectingWalletConnect"):X.push("ConnectingExternal",{connector:r})}};Qy.styles=WSe;lQ([G()],Qy.prototype,"activeConnector",void 0);Qy=lQ([te("w3m-connecting-multi-chain-view")],Qy);var oO=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let S6=class extends se{constructor(){super(...arguments),this.platformTabs=[],this.unsubscribe=[],this.platforms=[],this.onSelectPlatfrom=void 0}disconnectCallback(){this.unsubscribe.forEach(e=>e())}render(){const e=this.generateTabs();return M` `}generateTabs(){const e=this.platforms.map(r=>r==="browser"?{label:"Browser",icon:"extension",platform:"browser"}:r==="mobile"?{label:"Mobile",icon:"mobile",platform:"mobile"}:r==="qrcode"?{label:"Mobile",icon:"mobile",platform:"qrcode"}:r==="web"?{label:"Webapp",icon:"browser",platform:"web"}:r==="desktop"?{label:"Desktop",icon:"desktop",platform:"desktop"}:{label:"Browser",icon:"extension",platform:"unsupported"});return this.platformTabs=e.map(({platform:r})=>r),e}onTabChange(e){var n;const r=this.platformTabs[e];r&&((n=this.onSelectPlatfrom)==null||n.call(this,r))}};oO([q({type:Array})],S6.prototype,"platforms",void 0);oO([q()],S6.prototype,"onSelectPlatfrom",void 0);S6=oO([te("w3m-connecting-header")],S6);var VSe=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let PD=class extends Vn{constructor(){if(super(),!this.wallet)throw new Error("w3m-connecting-wc-browser: No wallet provided");this.onConnect=this.onConnectProxy.bind(this),this.onAutoConnect=this.onConnectProxy.bind(this),Re.sendEvent({type:"track",event:"SELECT_WALLET",properties:{name:this.wallet.name,platform:"browser"}})}async onConnectProxy(){var e;try{this.error=!1;const{connectors:r}=ge.state,n=r.find(i=>{var s,o,a;return i.type==="ANNOUNCED"&&((s=i.info)==null?void 0:s.rdns)===((o=this.wallet)==null?void 0:o.rdns)||i.type==="INJECTED"||i.name===((a=this.wallet)==null?void 0:a.name)});if(n)await xe.connectExternal(n,n.chain);else throw new Error("w3m-connecting-wc-browser: No connector found");We.close(),Re.sendEvent({type:"track",event:"CONNECT_SUCCESS",properties:{method:"browser",name:((e=this.wallet)==null?void 0:e.name)||"Unknown"}})}catch(r){Re.sendEvent({type:"track",event:"CONNECT_ERROR",properties:{message:(r==null?void 0:r.message)??"Unknown"}}),this.error=!0}}};PD=VSe([te("w3m-connecting-wc-browser")],PD);var GSe=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let OD=class extends Vn{constructor(){if(super(),!this.wallet)throw new Error("w3m-connecting-wc-desktop: No wallet provided");this.onConnect=this.onConnectProxy.bind(this),this.onRender=this.onRenderProxy.bind(this),Re.sendEvent({type:"track",event:"SELECT_WALLET",properties:{name:this.wallet.name,platform:"desktop"}})}onRenderProxy(){var e;!this.ready&&this.uri&&(this.ready=!0,(e=this.onConnect)==null||e.call(this))}onConnectProxy(){var e;if((e=this.wallet)!=null&&e.desktop_link&&this.uri)try{this.error=!1;const{desktop_link:r,name:n}=this.wallet,{redirect:i,href:s}=ue.formatNativeUrl(r,this.uri);xe.setWcLinking({name:n,href:s}),xe.setRecentWallet(this.wallet),ue.openHref(i,"_blank")}catch{this.error=!0}}};OD=GSe([te("w3m-connecting-wc-desktop")],OD);var g1=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let hp=class extends Vn{constructor(){if(super(),this.btnLabelTimeout=void 0,this.redirectDeeplink=void 0,this.redirectUniversalLink=void 0,this.target=void 0,this.preferUniversalLinks=oe.state.experimental_preferUniversalLinks,this.isLoading=!0,this.onConnect=()=>{var e;if((e=this.wallet)!=null&&e.mobile_link&&this.uri)try{this.error=!1;const{mobile_link:r,link_mode:n,name:i}=this.wallet,{redirect:s,redirectUniversalLink:o,href:a}=ue.formatNativeUrl(r,this.uri,n);this.redirectDeeplink=s,this.redirectUniversalLink=o,this.target=ue.isIframe()?"_top":"_self",xe.setWcLinking({name:i,href:a}),xe.setRecentWallet(this.wallet),this.preferUniversalLinks&&this.redirectUniversalLink?ue.openHref(this.redirectUniversalLink,this.target):ue.openHref(this.redirectDeeplink,this.target)}catch(r){Re.sendEvent({type:"track",event:"CONNECT_PROXY_ERROR",properties:{message:r instanceof Error?r.message:"Error parsing the deeplink",uri:this.uri,mobile_link:this.wallet.mobile_link,name:this.wallet.name}}),this.error=!0}},!this.wallet)throw new Error("w3m-connecting-wc-mobile: No wallet provided");this.secondaryBtnLabel="Open",this.secondaryLabel=ct.CONNECT_LABELS.MOBILE,this.secondaryBtnIcon="externalLink",this.onHandleURI(),this.unsubscribe.push(xe.subscribeKey("wcUri",()=>{this.onHandleURI()})),Re.sendEvent({type:"track",event:"SELECT_WALLET",properties:{name:this.wallet.name,platform:"mobile"}})}disconnectedCallback(){super.disconnectedCallback(),clearTimeout(this.btnLabelTimeout)}onHandleURI(){var e;this.isLoading=!this.uri,!this.ready&&this.uri&&(this.ready=!0,(e=this.onConnect)==null||e.call(this))}onTryAgain(){var e;xe.setWcError(!1),(e=this.onConnect)==null||e.call(this)}};g1([G()],hp.prototype,"redirectDeeplink",void 0);g1([G()],hp.prototype,"redirectUniversalLink",void 0);g1([G()],hp.prototype,"target",void 0);g1([G()],hp.prototype,"preferUniversalLinks",void 0);g1([G()],hp.prototype,"isLoading",void 0);hp=g1([te("w3m-connecting-wc-mobile")],hp);const KSe=de` @keyframes fadein { from { opacity: 0; } to { opacity: 1; } } wui-shimmer { width: 100%; aspect-ratio: 1 / 1; border-radius: clamp(0px, var(--wui-border-radius-l), 40px) !important; } wui-qr-code { opacity: 0; animation-duration: 200ms; animation-timing-function: ease; animation-name: fadein; animation-fill-mode: forwards; } `;var ZSe=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let t9=class extends Vn{constructor(){var e;super(),this.forceUpdate=()=>{this.requestUpdate()},window.addEventListener("resize",this.forceUpdate),Re.sendEvent({type:"track",event:"SELECT_WALLET",properties:{name:((e=this.wallet)==null?void 0:e.name)??"WalletConnect",platform:"qrcode"}})}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this.unsubscribe)==null||e.forEach(r=>r()),window.removeEventListener("resize",this.forceUpdate)}render(){return this.onRenderProxy(),M` ${this.qrCodeTemplate()} Scan this QR Code with your phone ${this.copyTemplate()} `}onRenderProxy(){!this.ready&&this.uri&&(this.timeout=setTimeout(()=>{this.ready=!0},200))}qrCodeTemplate(){if(!this.uri||!this.ready)return null;const e=this.getBoundingClientRect().width-40,r=this.wallet?this.wallet.name:void 0;return xe.setWcLinking(void 0),xe.setRecentWallet(this.wallet),M` `}copyTemplate(){const e=!this.uri||!this.ready;return M` Copy link `}};t9.styles=KSe;t9=ZSe([te("w3m-connecting-wc-qrcode")],t9);var YSe=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let RD=class extends se{constructor(){var e;if(super(),this.wallet=(e=X.state.data)==null?void 0:e.wallet,!this.wallet)throw new Error("w3m-connecting-wc-unsupported: No wallet provided");Re.sendEvent({type:"track",event:"SELECT_WALLET",properties:{name:this.wallet.name,platform:"browser"}})}render(){return M` Not Detected `}};RD=YSe([te("w3m-connecting-wc-unsupported")],RD);var dQ=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let r9=class extends Vn{constructor(){if(super(),this.isLoading=!0,!this.wallet)throw new Error("w3m-connecting-wc-web: No wallet provided");this.onConnect=this.onConnectProxy.bind(this),this.secondaryBtnLabel="Open",this.secondaryLabel=ct.CONNECT_LABELS.MOBILE,this.secondaryBtnIcon="externalLink",this.updateLoadingState(),this.unsubscribe.push(xe.subscribeKey("wcUri",()=>{this.updateLoadingState()})),Re.sendEvent({type:"track",event:"SELECT_WALLET",properties:{name:this.wallet.name,platform:"web"}})}updateLoadingState(){this.isLoading=!this.uri}onConnectProxy(){var e;if((e=this.wallet)!=null&&e.webapp_link&&this.uri)try{this.error=!1;const{webapp_link:r,name:n}=this.wallet,{redirect:i,href:s}=ue.formatUniversalUrl(r,this.uri);xe.setWcLinking({name:n,href:s}),xe.setRecentWallet(this.wallet),ue.openHref(i,"_blank")}catch{this.error=!0}}};dQ([G()],r9.prototype,"isLoading",void 0);r9=dQ([te("w3m-connecting-wc-web")],r9);var g2=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let fp=class extends se{constructor(){var e;super(),this.wallet=(e=X.state.data)==null?void 0:e.wallet,this.unsubscribe=[],this.platform=void 0,this.platforms=[],this.isSiwxEnabled=!!oe.state.siwx,this.remoteFeatures=oe.state.remoteFeatures,this.determinePlatforms(),this.initializeConnection(),this.unsubscribe.push(oe.subscribeKey("remoteFeatures",r=>this.remoteFeatures=r))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return M` ${this.headerTemplate()}
${this.platformTemplate()}
${this.reownBrandingTemplate()} `}reownBrandingTemplate(){var e;return(e=this.remoteFeatures)!=null&&e.reownBranding?M``:null}async initializeConnection(e=!1){if(!(this.platform==="browser"||oe.state.manualWCControl&&!e))try{const{wcPairingExpiry:r,status:n}=xe.state;(e||oe.state.enableEmbedded||ue.isPairingExpired(r)||n==="connecting")&&(await xe.connectWalletConnect(),this.isSiwxEnabled||We.close())}catch(r){Re.sendEvent({type:"track",event:"CONNECT_ERROR",properties:{message:(r==null?void 0:r.message)??"Unknown"}}),xe.setWcError(!0),Fe.showError(r.message??"Connection error"),xe.resetWcConnection(),X.goBack()}}determinePlatforms(){if(!this.wallet){this.platforms.push("qrcode"),this.platform="qrcode";return}if(this.platform)return;const{mobile_link:e,desktop_link:r,webapp_link:n,injected:i,rdns:s}=this.wallet,o=i==null?void 0:i.map(({injected_id:g})=>g).filter(Boolean),a=[...s?[s]:o??[]],c=oe.state.isUniversalProvider?!1:a.length,u=e,l=n,d=xe.checkInstalled(a),h=c&&d,f=r&&!ue.isMobile();h&&!F.state.noAdapters&&this.platforms.push("browser"),u&&this.platforms.push(ue.isMobile()?"mobile":"qrcode"),l&&this.platforms.push("web"),f&&this.platforms.push("desktop"),!h&&c&&!F.state.noAdapters&&this.platforms.push("unsupported"),this.platform=this.platforms[0]}platformTemplate(){switch(this.platform){case"browser":return M``;case"web":return M``;case"desktop":return M` this.initializeConnection(!0)}> `;case"mobile":return M` this.initializeConnection(!0)}> `;case"qrcode":return M``;default:return M``}}headerTemplate(){return this.platforms.length>1?M` `:null}async onSelectPlatform(e){var n;const r=(n=this.shadowRoot)==null?void 0:n.querySelector("div");r&&(await r.animate([{opacity:1},{opacity:0}],{duration:200,fill:"forwards",easing:"ease"}).finished,this.platform=e,r.animate([{opacity:0},{opacity:1}],{duration:200,fill:"forwards",easing:"ease"}))}};g2([G()],fp.prototype,"platform",void 0);g2([G()],fp.prototype,"platforms",void 0);g2([G()],fp.prototype,"isSiwxEnabled",void 0);g2([G()],fp.prototype,"remoteFeatures",void 0);fp=g2([te("w3m-connecting-wc-view")],fp);var hQ=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let T6=class extends se{constructor(){super(...arguments),this.isMobile=ue.isMobile()}render(){if(this.isMobile){const{featured:e,recommended:r}=Ne.state,{customWallets:n}=oe.state,i=Le.getRecentWallets(),s=e.length||r.length||(n==null?void 0:n.length)||i.length;return M` ${s?M``:null} `}return M` `}};hQ([G()],T6.prototype,"isMobile",void 0);T6=hQ([te("w3m-connecting-wc-basic-view")],T6);const JSe=de` .continue-button-container { width: 100%; } `;var fQ=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Xy=class extends se{constructor(){super(...arguments),this.loading=!1}render(){return M` ${this.onboardingTemplate()} ${this.buttonsTemplate()} {ue.openHref(IV.URLS.FAQ,"_blank")}} > Learn more about names `}onboardingTemplate(){return M` Choose your account name Finally say goodbye to 0x addresses, name your account to make it easier to exchange assets `}buttonsTemplate(){return M` Choose name `}handleContinue(){var r;const e=F.state.activeChain;X.push("RegisterAccountName"),Re.sendEvent({type:"track",event:"OPEN_ENS_FLOW",properties:{isSmartAccount:((r=re.state.preferredAccountTypes)==null?void 0:r[e])===bt.ACCOUNT_TYPES.SMART_ACCOUNT}})}};Xy.styles=JSe;fQ([G()],Xy.prototype,"loading",void 0);Xy=fQ([te("w3m-choose-account-name-view")],Xy);var QSe=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let n9=class extends se{constructor(){var e;super(...arguments),this.wallet=(e=X.state.data)==null?void 0:e.wallet}render(){if(!this.wallet)throw new Error("w3m-downloads-view");return M` ${this.chromeTemplate()} ${this.iosTemplate()} ${this.androidTemplate()} ${this.homepageTemplate()} `}chromeTemplate(){var e;return(e=this.wallet)!=null&&e.chrome_store?M` Chrome Extension `:null}iosTemplate(){var e;return(e=this.wallet)!=null&&e.app_store?M` iOS App `:null}androidTemplate(){var e;return(e=this.wallet)!=null&&e.play_store?M` Android App `:null}homepageTemplate(){var e;return(e=this.wallet)!=null&&e.homepage?M` Website `:null}onChromeStore(){var e;(e=this.wallet)!=null&&e.chrome_store&&ue.openHref(this.wallet.chrome_store,"_blank")}onAppStore(){var e;(e=this.wallet)!=null&&e.app_store&&ue.openHref(this.wallet.app_store,"_blank")}onPlayStore(){var e;(e=this.wallet)!=null&&e.play_store&&ue.openHref(this.wallet.play_store,"_blank")}onHomePage(){var e;(e=this.wallet)!=null&&e.homepage&&ue.openHref(this.wallet.homepage,"_blank")}};n9=QSe([te("w3m-downloads-view")],n9);var XSe=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};const eTe="https://walletconnect.com/explorer";let i9=class extends se{render(){return M` ${this.recommendedWalletsTemplate()} {ue.openHref("https://walletconnect.com/explorer?type=wallet","_blank")}} > `}recommendedWalletsTemplate(){const{recommended:e,featured:r}=Ne.state,{customWallets:n}=oe.state;return[...r,...n??[],...e].slice(0,4).map(s=>M` {ue.openHref(s.homepage??eTe,"_blank")}} > `)}};i9=XSe([te("w3m-get-wallet-view")],i9);var pQ=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let s9=class extends se{constructor(){super(...arguments),this.data=[]}render(){return M` ${this.data.map(e=>M` ${e.images.map(r=>M``)} ${e.title} ${e.text} `)} `}};pQ([q({type:Array})],s9.prototype,"data",void 0);s9=pQ([te("w3m-help-widget")],s9);var tTe=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};const rTe=[{images:["login","profile","lock"],title:"One login for all of web3",text:"Log in to any app by connecting your wallet. Say goodbye to countless passwords!"},{images:["defi","nft","eth"],title:"A home for your digital assets",text:"A wallet lets you store, send and receive digital assets like cryptocurrencies and NFTs."},{images:["browser","noun","dao"],title:"Your gateway to a new web",text:"With your wallet, you can explore and interact with DeFi, NFTs, DAOs, and much more."}];let o9=class extends se{render(){return M` Get a wallet `}onGetWallet(){Re.sendEvent({type:"track",event:"CLICK_GET_WALLET"}),X.push("GetWallet")}};o9=tTe([te("w3m-what-is-a-wallet-view")],o9);const nTe=de` wui-flex { max-height: clamp(360px, 540px, 80vh); overflow: scroll; scrollbar-width: none; transition: opacity var(--wui-ease-out-power-1) var(--wui-duration-md); will-change: opacity; } wui-flex::-webkit-scrollbar { display: none; } wui-flex.disabled { opacity: 0.3; pointer-events: none; user-select: none; } `;var gQ=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let ev=class extends se{constructor(){super(),this.unsubscribe=[],this.checked=As.state.isLegalCheckboxChecked,this.unsubscribe.push(As.subscribeKey("isLegalCheckboxChecked",e=>{this.checked=e}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){var c;const{termsConditionsUrl:e,privacyPolicyUrl:r}=oe.state,n=(c=oe.state.features)==null?void 0:c.legalCheckbox,s=!!(e||r)&&!!n,o=s&&!this.checked,a=o?-1:void 0;return M` `}};ev.styles=nTe;gQ([G()],ev.prototype,"checked",void 0);ev=gQ([te("w3m-connect-wallets-view")],ev);const iTe=de` :host { display: block; width: var(--wui-box-size-lg); height: var(--wui-box-size-lg); } svg { width: var(--wui-box-size-lg); height: var(--wui-box-size-lg); fill: none; stroke: transparent; stroke-linecap: round; } use { stroke: var(--wui-color-accent-100); stroke-width: 2px; stroke-dasharray: 54, 118; stroke-dashoffset: 172; animation: dash 1s linear infinite; } @keyframes dash { to { stroke-dashoffset: 0px; } } `;var sTe=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let a9=class extends se{render(){return M` `}};a9.styles=[He,iTe];a9=sTe([te("wui-loading-hexagon")],a9);const oTe=de` @keyframes shake { 0% { transform: translateX(0); } 25% { transform: translateX(3px); } 50% { transform: translateX(-3px); } 75% { transform: translateX(3px); } 100% { transform: translateX(0); } } wui-flex:first-child:not(:only-child) { position: relative; } wui-loading-hexagon { position: absolute; } wui-icon-box { position: absolute; right: 4px; bottom: 0; opacity: 0; transform: scale(0.5); z-index: 1; } wui-button { display: none; } [data-error='true'] wui-icon-box { opacity: 1; transform: scale(1); } [data-error='true'] > wui-flex:first-child { animation: shake 250ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both; } wui-button[data-retry='true'] { display: block; opacity: 1; } `;var aO=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Gm=class extends se{constructor(){var e;super(),this.network=(e=X.state.data)==null?void 0:e.network,this.unsubscribe=[],this.showRetry=!1,this.error=!1}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}firstUpdated(){this.onSwitchNetwork()}render(){if(!this.network)throw new Error("w3m-network-switch-view: No network provided");this.onShowRetry();const e=this.getLabel(),r=this.getSubLabel();return M` ${this.error?null:M``} ${e} ${r} Try again `}getSubLabel(){const e=F.state.activeChain,r=ge.getConnectorId(e);return ge.getAuthConnector()&&r===_e.CONNECTOR_ID.AUTH?"":this.error?"Switch can be declined if chain is not supported by a wallet or previous request is still active":"Accept connection request in your wallet"}getLabel(){var i;const e=F.state.activeChain,r=ge.getConnectorId(e);return ge.getAuthConnector()&&r===_e.CONNECTOR_ID.AUTH?`Switching to ${((i=this.network)==null?void 0:i.name)??"Unknown"} network...`:this.error?"Switch declined":"Approve in wallet"}onShowRetry(){var e;if(this.error&&!this.showRetry){this.showRetry=!0;const r=(e=this.shadowRoot)==null?void 0:e.querySelector("wui-button");r==null||r.animate([{opacity:0},{opacity:1}],{fill:"forwards",easing:"ease"})}}onSwitchNetwork(){var e;try{this.error=!1,F.state.activeChain!==((e=this.network)==null?void 0:e.chainNamespace)&&F.setIsSwitchingNamespace(!0),this.network&&F.switchActiveNetwork(this.network)}catch{this.error=!0}}};Gm.styles=oTe;aO([G()],Gm.prototype,"showRetry",void 0);aO([G()],Gm.prototype,"error",void 0);Gm=aO([te("w3m-network-switch-view")],Gm);const aTe=de` button { column-gap: var(--wui-spacing-s); padding: 7px var(--wui-spacing-l) 7px var(--wui-spacing-xs); width: 100%; transition: all var(--wui-ease-out-power-1) var(--wui-duration-md); border-radius: var(--wui-border-radius-xs); color: var(--wui-color-fg-100); } button > wui-text:nth-child(2) { display: flex; flex: 1; } button[data-transparent='true'] { pointer-events: none; background-color: transparent; } button:hover { background-color: var(--wui-color-gray-glass-002); } button:active { background-color: var(--wui-color-gray-glass-005); } wui-image { width: var(--wui-spacing-3xl); height: var(--wui-spacing-3xl); border-radius: 100%; } button:disabled { background-color: var(--wui-color-gray-glass-002); opacity: 0.5; cursor: not-allowed; } button:disabled > wui-tag { background-color: var(--wui-color-gray-glass-010); color: var(--wui-color-fg-300); } `;var m1=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Rd=class extends se{constructor(){super(...arguments),this.imageSrc="",this.name="",this.disabled=!1,this.selected=!1,this.transparent=!1}render(){return M` `}checkmarkTemplate(){return this.selected?M``:null}templateNetworkImage(){return this.imageSrc?M``:this.imageSrc?null:M``}};Rd.styles=[He,vt,aTe];m1([q()],Rd.prototype,"imageSrc",void 0);m1([q()],Rd.prototype,"name",void 0);m1([q({type:Boolean})],Rd.prototype,"disabled",void 0);m1([q({type:Boolean})],Rd.prototype,"selected",void 0);m1([q({type:Boolean})],Rd.prototype,"transparent",void 0);Rd=m1([te("wui-list-network")],Rd);const cTe=de` .container { max-height: 360px; overflow: auto; } .container::-webkit-scrollbar { display: none; } `;var m2=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let kd=class extends se{constructor(){super(),this.unsubscribe=[],this.network=F.state.activeCaipNetwork,this.requestedCaipNetworks=F.getCaipNetworks(),this.search="",this.onDebouncedSearch=ue.debounce(e=>{this.search=e},100),this.unsubscribe.push(er.subscribeNetworkImages(()=>this.requestUpdate()),F.subscribeKey("activeCaipNetwork",e=>this.network=e),F.subscribe(()=>{this.requestedCaipNetworks=F.getAllRequestedCaipNetworks()}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return M` ${this.templateSearchInput()} ${this.networksTemplate()} Your connected wallet may not support some of the networks available for this dApp What is a network `}templateSearchInput(){return M` `}onInputChange(e){this.onDebouncedSearch(e.detail)}onNetworkHelp(){Re.sendEvent({type:"track",event:"CLICK_NETWORK_HELP"}),X.push("WhatIsANetwork")}networksTemplate(){var n;const e=F.getAllApprovedCaipNetworkIds(),r=ue.sortRequestedNetworks(e,this.requestedCaipNetworks);return this.search?this.filteredNetworks=r==null?void 0:r.filter(i=>{var s;return(s=i==null?void 0:i.name)==null?void 0:s.toLowerCase().includes(this.search.toLowerCase())}):this.filteredNetworks=r,(n=this.filteredNetworks)==null?void 0:n.map(i=>{var s;return M` this.onSwitchNetwork(i)} .disabled=${this.getNetworkDisabled(i)} data-testid=${`w3m-network-switch-${i.name??i.id}`} > `})}getNetworkDisabled(e){const r=e.chainNamespace,n=re.getCaipAddress(r),i=F.getAllApprovedCaipNetworkIds(),s=F.getNetworkProp("supportsAllNetworks",r)!==!1,o=ge.getConnectorId(r),a=ge.getAuthConnector(),c=o===_e.CONNECTOR_ID.AUTH&&a;return!n||s||c?!1:!(i!=null&&i.includes(e.caipNetworkId))}onSwitchNetwork(e){MV.onSwitchNetwork({network:e})}};kd.styles=cTe;m2([G()],kd.prototype,"network",void 0);m2([G()],kd.prototype,"requestedCaipNetworks",void 0);m2([G()],kd.prototype,"filteredNetworks",void 0);m2([G()],kd.prototype,"search",void 0);kd=m2([te("w3m-networks-view")],kd);const uTe=de` @keyframes shake { 0% { transform: translateX(0); } 25% { transform: translateX(3px); } 50% { transform: translateX(-3px); } 75% { transform: translateX(3px); } 100% { transform: translateX(0); } } wui-flex:first-child:not(:only-child) { position: relative; } wui-loading-thumbnail { position: absolute; } wui-visual { width: var(--wui-wallet-image-size-lg); height: var(--wui-wallet-image-size-lg); border-radius: calc(var(--wui-border-radius-5xs) * 9 - var(--wui-border-radius-xxs)); position: relative; overflow: hidden; } wui-visual::after { content: ''; display: block; width: 100%; height: 100%; position: absolute; inset: 0; border-radius: calc(var(--wui-border-radius-5xs) * 9 - var(--wui-border-radius-xxs)); box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-005); } wui-icon-box { position: absolute; right: calc(var(--wui-spacing-3xs) * -1); bottom: calc(var(--wui-spacing-3xs) * -1); opacity: 0; transform: scale(0.5); transition: opacity var(--wui-ease-out-power-2) var(--wui-duration-lg), transform var(--wui-ease-out-power-2) var(--wui-duration-lg); will-change: opacity, transform; } wui-text[align='center'] { width: 100%; padding: 0px var(--wui-spacing-l); } [data-error='true'] wui-icon-box { opacity: 1; transform: scale(1); } [data-error='true'] > wui-flex:first-child { animation: shake 250ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both; } [data-retry='false'] wui-link { display: none; } [data-retry='true'] wui-link { display: block; opacity: 1; } wui-link { padding: var(--wui-spacing-4xs) var(--wui-spacing-xxs); } .capitalize { text-transform: capitalize; } `;var mQ=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};const lTe={eip155:"eth",solana:"solana",bip122:"bitcoin",polkadot:void 0};let tv=class extends se{constructor(){var e,r;super(...arguments),this.unsubscribe=[],this.switchToChain=(e=X.state.data)==null?void 0:e.switchToChain,this.caipNetwork=(r=X.state.data)==null?void 0:r.network,this.activeChain=F.state.activeChain}firstUpdated(){this.unsubscribe.push(F.subscribeKey("activeChain",e=>this.activeChain=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){const e=this.switchToChain?_e.CHAIN_NAME_MAP[this.switchToChain]:"supported";if(!this.switchToChain)return null;const r=_e.CHAIN_NAME_MAP[this.switchToChain];return M` Switch to ${r} Connected wallet doesn't support connecting to ${e} chain. You need to connect with a different wallet. Switch `}async switchActiveChain(){this.switchToChain&&(F.setIsSwitchingNamespace(!0),ge.setFilterByNamespace(this.switchToChain),this.caipNetwork?await F.switchActiveNetwork(this.caipNetwork):F.setActiveNamespace(this.switchToChain),X.reset("Connect"))}};tv.styles=uTe;mQ([q()],tv.prototype,"activeChain",void 0);tv=mQ([te("w3m-switch-active-chain-view")],tv);var dTe=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};const hTe=[{images:["network","layers","system"],title:"The system’s nuts and bolts",text:"A network is what brings the blockchain to life, as this technical infrastructure allows apps to access the ledger and smart contract services."},{images:["noun","defiAlt","dao"],title:"Designed for different uses",text:"Each network is designed differently, and may therefore suit certain apps and experiences."}];let c9=class extends se{render(){return M` {ue.openHref("https://ethereum.org/en/developers/docs/networks/","_blank")}} > Learn more `}};c9=dTe([te("w3m-what-is-a-network-view")],c9);const fTe=de` :host > wui-flex { max-height: clamp(360px, 540px, 80vh); overflow: scroll; scrollbar-width: none; } :host > wui-flex::-webkit-scrollbar { display: none; } `;var wQ=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let rv=class extends se{constructor(){var e;super(),this.swapUnsupportedChain=(e=X.state.data)==null?void 0:e.swapUnsupportedChain,this.unsubscribe=[],this.disconecting=!1,this.unsubscribe.push(er.subscribeNetworkImages(()=>this.requestUpdate()))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return M` ${this.descriptionTemplate()} ${this.networksTemplate()} Disconnect `}descriptionTemplate(){return this.swapUnsupportedChain?M` The swap feature doesn’t support your current network. Switch to an available option to continue. `:M` This app doesn’t support your current network. Switch to an available option to continue. `}networksTemplate(){const e=F.getAllRequestedCaipNetworks(),r=F.getAllApprovedCaipNetworkIds(),n=ue.sortRequestedNetworks(r,e);return(this.swapUnsupportedChain?n.filter(s=>ct.SWAP_SUPPORTED_NETWORKS.includes(s.caipNetworkId)):n).map(s=>M` this.onSwitchNetwork(s)} > `)}async onDisconnect(){try{this.disconecting=!0,await xe.disconnect(),We.close()}catch{Re.sendEvent({type:"track",event:"DISCONNECT_ERROR"}),Fe.showError("Failed to disconnect")}finally{this.disconecting=!1}}async onSwitchNetwork(e){const r=re.state.caipAddress,n=F.getAllApprovedCaipNetworkIds(),i=F.getNetworkProp("supportsAllNetworks",e.chainNamespace),s=X.state.data;r?n!=null&&n.includes(e.caipNetworkId)?await F.switchActiveNetwork(e):i?X.push("SwitchNetwork",{...s,network:e}):X.push("SwitchNetwork",{...s,network:e}):r||(F.setActiveCaipNetwork(e),X.push("Connect"))}};rv.styles=fTe;wQ([G()],rv.prototype,"disconecting",void 0);rv=wQ([te("w3m-unsupported-chain-view")],rv);const pTe=de` wui-flex { width: 100%; background-color: var(--wui-color-gray-glass-005); border-radius: var(--wui-border-radius-s); padding: var(--wui-spacing-1xs) var(--wui-spacing-s) var(--wui-spacing-1xs) var(--wui-spacing-1xs); } `;var cO=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let nv=class extends se{constructor(){super(...arguments),this.icon="externalLink",this.text=""}render(){return M` ${this.text} `}};nv.styles=[He,vt,pTe];cO([q()],nv.prototype,"icon",void 0);cO([q()],nv.prototype,"text",void 0);nv=cO([te("wui-banner")],nv);const gTe=de` :host > wui-flex { max-height: clamp(360px, 540px, 80vh); overflow: scroll; scrollbar-width: none; } :host > wui-flex::-webkit-scrollbar { display: none; } `;var bQ=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let iv=class extends se{constructor(){super(),this.unsubscribe=[],this.preferredAccountTypes=re.state.preferredAccountTypes,this.unsubscribe.push(re.subscribeKey("preferredAccountTypes",e=>{this.preferredAccountTypes=e}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return M` ${this.networkTemplate()} `}networkTemplate(){var a;const e=F.getAllRequestedCaipNetworks(),r=F.getAllApprovedCaipNetworkIds(),n=F.state.activeCaipNetwork,i=F.checkIfSmartAccountEnabled();let s=ue.sortRequestedNetworks(r,e);if(i&&((a=this.preferredAccountTypes)==null?void 0:a[n==null?void 0:n.chainNamespace])===bt.ACCOUNT_TYPES.SMART_ACCOUNT){if(!n)return null;s=[n]}return s.filter(c=>c.chainNamespace===(n==null?void 0:n.chainNamespace)).map(c=>M` `)}};iv.styles=gTe;bQ([G()],iv.prototype,"preferredAccountTypes",void 0);iv=bQ([te("w3m-wallet-compatible-networks-view")],iv);const mTe=de` :host { display: flex; justify-content: center; align-items: center; width: var(--wui-icon-box-size-xl); height: var(--wui-icon-box-size-xl); box-shadow: 0 0 0 8px var(--wui-thumbnail-border); border-radius: var(--local-border-radius); overflow: hidden; } wui-icon { width: 32px; height: 32px; } `;var WA=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Km=class extends se{render(){return this.style.cssText=`--local-border-radius: ${this.borderRadiusFull?"1000px":"20px"}; background-color: var(--wui-color-modal-bg);`,M`${this.templateVisual()}`}templateVisual(){return this.imageSrc?M``:M``}};Km.styles=[He,mTe];WA([q()],Km.prototype,"imageSrc",void 0);WA([q()],Km.prototype,"alt",void 0);WA([q({type:Boolean})],Km.prototype,"borderRadiusFull",void 0);Km=WA([te("wui-visual-thumbnail")],Km);const wTe=de` :host { display: flex; justify-content: center; gap: var(--wui-spacing-2xl); } wui-visual-thumbnail:nth-child(1) { z-index: 1; } `;var bTe=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let u9=class extends se{constructor(){var e,r;super(...arguments),this.dappImageUrl=(e=oe.state.metadata)==null?void 0:e.icons,this.walletImageUrl=(r=re.state.connectedWalletInfo)==null?void 0:r.icon}firstUpdated(){var r;const e=(r=this.shadowRoot)==null?void 0:r.querySelectorAll("wui-visual-thumbnail");e!=null&&e[0]&&this.createAnimation(e[0],"translate(18px)"),e!=null&&e[1]&&this.createAnimation(e[1],"translate(-18px)")}render(){var e;return M` `}createAnimation(e,r){e.animate([{transform:"translateX(0px)"},{transform:r}],{duration:1600,easing:"cubic-bezier(0.56, 0, 0.48, 1)",direction:"alternate",iterations:1/0})}};u9.styles=wTe;u9=bTe([te("w3m-siwx-sign-message-thumbnails")],u9);var uO=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let sv=class extends se{constructor(){var e;super(...arguments),this.dappName=(e=oe.state.metadata)==null?void 0:e.name,this.isCancelling=!1,this.isSigning=!1}render(){return M` ${this.dappName??"Dapp"} needs to connect to your wallet Sign this message to prove you own this wallet and proceed. Canceling will disconnect you. ${this.isCancelling?"Cancelling...":"Cancel"} ${this.isSigning?"Signing...":"Sign"} `}async onSign(){this.isSigning=!0,await Cu.requestSignMessage().finally(()=>this.isSigning=!1)}async onCancel(){this.isCancelling=!0,await Cu.cancelSignMessage().finally(()=>this.isCancelling=!1)}};uO([G()],sv.prototype,"isCancelling",void 0);uO([G()],sv.prototype,"isSigning",void 0);sv=uO([te("w3m-siwx-sign-message-view")],sv);const yTe=Object.freeze(Object.defineProperty({__proto__:null,get AppKitAccountButton(){return HP},get AppKitButton(){return zP},get AppKitConnectButton(){return VP},get AppKitNetworkButton(){return KP},get W3mAccountButton(){return FP},get W3mAccountSettingsView(){return oo},get W3mAccountView(){return p6},get W3mAllWalletsView(){return Vy},get W3mButton(){return qP},get W3mChooseAccountNameView(){return Xy},get W3mConnectButton(){return WP},get W3mConnectView(){return Ii},get W3mConnectWalletsView(){return ev},get W3mConnectingExternalView(){return e9},get W3mConnectingMultiChainView(){return Qy},get W3mConnectingWcBasicView(){return T6},get W3mConnectingWcView(){return fp},get W3mDownloadsView(){return n9},get W3mGetWalletView(){return i9},get W3mNetworkButton(){return GP},get W3mNetworkSwitchView(){return Gm},get W3mNetworksView(){return kd},get W3mProfileView(){return zu},get W3mRouter(){return Mm},get W3mSIWXSignMessageView(){return sv},get W3mSwitchActiveChainView(){return tv},get W3mSwitchAddressView(){return Hm},get W3mUnsupportedChainView(){return rv},get W3mWalletCompatibleNetworksView(){return iv},get W3mWhatIsANetworkView(){return c9},get W3mWhatIsAWalletView(){return o9}},Symbol.toStringTag,{value:"Module"})),vTe=de` :host { display: block; border-radius: clamp(0px, var(--wui-border-radius-l), 44px); box-shadow: 0 0 0 1px var(--wui-color-gray-glass-005); background-color: var(--wui-color-modal-bg); overflow: hidden; } :host([data-embedded='true']) { box-shadow: 0 0 0 1px var(--wui-color-gray-glass-005), 0px 4px 12px 4px var(--w3m-card-embedded-shadow-color); } `;var _Te=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let l9=class extends se{render(){return M``}};l9.styles=[He,vTe];l9=_Te([te("wui-card")],l9);const ETe=de` :host { display: flex; align-items: center; justify-content: center; padding: var(--wui-spacing-s); border-radius: var(--wui-border-radius-s); border: 1px solid var(--wui-color-dark-glass-100); box-sizing: border-box; background-color: var(--wui-color-bg-325); box-shadow: 0px 0px 16px 0px rgba(0, 0, 0, 0.25); } wui-flex { width: 100%; } wui-text { word-break: break-word; flex: 1; } .close { cursor: pointer; } .icon-box { height: 40px; width: 40px; border-radius: var(--wui-border-radius-3xs); background-color: var(--local-icon-bg-value); } `;var w2=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let pp=class extends se{constructor(){super(...arguments),this.message="",this.backgroundColor="accent-100",this.iconColor="accent-100",this.icon="info"}render(){return this.style.cssText=` --local-icon-bg-value: var(--wui-color-${this.backgroundColor}); `,M` ${this.message} `}onClose(){Fn.close()}};pp.styles=[He,ETe];w2([q()],pp.prototype,"message",void 0);w2([q()],pp.prototype,"backgroundColor",void 0);w2([q()],pp.prototype,"iconColor",void 0);w2([q()],pp.prototype,"icon",void 0);pp=w2([te("wui-alertbar")],pp);const CTe=de` :host { display: block; position: absolute; top: var(--wui-spacing-s); left: var(--wui-spacing-l); right: var(--wui-spacing-l); opacity: 0; pointer-events: none; } `;var yQ=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};const ATe={info:{backgroundColor:"fg-350",iconColor:"fg-325",icon:"info"},success:{backgroundColor:"success-glass-reown-020",iconColor:"success-125",icon:"checkmark"},warning:{backgroundColor:"warning-glass-reown-020",iconColor:"warning-100",icon:"warningCircle"},error:{backgroundColor:"error-glass-reown-020",iconColor:"error-125",icon:"exclamationTriangle"}};let I6=class extends se{constructor(){super(),this.unsubscribe=[],this.open=Fn.state.open,this.onOpen(!0),this.unsubscribe.push(Fn.subscribeKey("open",e=>{this.open=e,this.onOpen(!1)}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){const{message:e,variant:r}=Fn.state,n=ATe[r];return M` `}onOpen(e){this.open?(this.animate([{opacity:0,transform:"scale(0.85)"},{opacity:1,transform:"scale(1)"}],{duration:150,fill:"forwards",easing:"ease"}),this.style.cssText="pointer-events: auto"):e||(this.animate([{opacity:1,transform:"scale(1)"},{opacity:0,transform:"scale(0.85)"}],{duration:150,fill:"forwards",easing:"ease"}),this.style.cssText="pointer-events: none")}};I6.styles=CTe;yQ([G()],I6.prototype,"open",void 0);I6=yQ([te("w3m-alertbar")],I6);const xTe=de` button { display: block; display: flex; align-items: center; padding: var(--wui-spacing-xxs); gap: var(--wui-spacing-xxs); transition: all var(--wui-ease-out-power-1) var(--wui-duration-md); border-radius: var(--wui-border-radius-xxs); } wui-image { border-radius: 100%; width: var(--wui-spacing-xl); height: var(--wui-spacing-xl); } wui-icon-box { width: var(--wui-spacing-xl); height: var(--wui-spacing-xl); } button:hover { background-color: var(--wui-color-gray-glass-002); } button:active { background-color: var(--wui-color-gray-glass-005); } `;var vQ=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let P6=class extends se{constructor(){super(...arguments),this.imageSrc=""}render(){return M``}imageTemplate(){return this.imageSrc?M``:M``}};P6.styles=[He,vt,qv,xTe];vQ([q()],P6.prototype,"imageSrc",void 0);P6=vQ([te("wui-select")],P6);const STe=de` :host { height: 64px; } wui-text { text-transform: capitalize; } wui-flex.w3m-header-title { transform: translateY(0); opacity: 1; } wui-flex.w3m-header-title[view-direction='prev'] { animation: slide-down-out 120ms forwards var(--wui-ease-out-power-2), slide-down-in 120ms forwards var(--wui-ease-out-power-2); animation-delay: 0ms, 200ms; } wui-flex.w3m-header-title[view-direction='next'] { animation: slide-up-out 120ms forwards var(--wui-ease-out-power-2), slide-up-in 120ms forwards var(--wui-ease-out-power-2); animation-delay: 0ms, 200ms; } wui-icon-link[data-hidden='true'] { opacity: 0 !important; pointer-events: none; } @keyframes slide-up-out { from { transform: translateY(0px); opacity: 1; } to { transform: translateY(3px); opacity: 0; } } @keyframes slide-up-in { from { transform: translateY(-3px); opacity: 0; } to { transform: translateY(0); opacity: 1; } } @keyframes slide-down-out { from { transform: translateY(0px); opacity: 1; } to { transform: translateY(-3px); opacity: 0; } } @keyframes slide-down-in { from { transform: translateY(3px); opacity: 0; } to { transform: translateY(0); opacity: 1; } } `;var Xu=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};const TTe=["SmartSessionList"];function aT(){var o,a,c,u,l,d,h;const t=(a=(o=X.state.data)==null?void 0:o.connector)==null?void 0:a.name,e=(u=(c=X.state.data)==null?void 0:c.wallet)==null?void 0:u.name,r=(d=(l=X.state.data)==null?void 0:l.network)==null?void 0:d.name,n=e??t,i=ge.getConnectors();return{Connect:`Connect ${i.length===1&&((h=i[0])==null?void 0:h.id)==="w3m-email"?"Email":""} Wallet`,Create:"Create Wallet",ChooseAccountName:void 0,Account:void 0,AccountSettings:void 0,AllWallets:"All Wallets",ApproveTransaction:"Approve Transaction",BuyInProgress:"Buy",ConnectingExternal:n??"Connect Wallet",ConnectingWalletConnect:n??"WalletConnect",ConnectingWalletConnectBasic:"WalletConnect",ConnectingSiwe:"Sign In",Convert:"Convert",ConvertSelectToken:"Select token",ConvertPreview:"Preview convert",Downloads:n?`Get ${n}`:"Downloads",EmailLogin:"Email Login",EmailVerifyOtp:"Confirm Email",EmailVerifyDevice:"Register Device",GetWallet:"Get a wallet",Networks:"Choose Network",OnRampProviders:"Choose Provider",OnRampActivity:"Activity",OnRampTokenSelect:"Select Token",OnRampFiatSelect:"Select Currency",Pay:"How you pay",Profile:void 0,SwitchNetwork:r??"Switch Network",SwitchAddress:"Switch Address",Transactions:"Activity",UnsupportedChain:"Switch Network",UpgradeEmailWallet:"Upgrade your Wallet",UpdateEmailWallet:"Edit Email",UpdateEmailPrimaryOtp:"Confirm Current Email",UpdateEmailSecondaryOtp:"Confirm New Email",WhatIsABuy:"What is Buy?",RegisterAccountName:"Choose name",RegisterAccountNameSuccess:"",WalletReceive:"Receive",WalletCompatibleNetworks:"Compatible Networks",Swap:"Swap",SwapSelectToken:"Select token",SwapPreview:"Preview swap",WalletSend:"Send",WalletSendPreview:"Review send",WalletSendSelectToken:"Select Token",WhatIsANetwork:"What is a network?",WhatIsAWallet:"What is a wallet?",ConnectWallets:"Connect wallet",ConnectSocials:"All socials",ConnectingSocial:re.state.socialProvider?re.state.socialProvider:"Connect Social",ConnectingMultiChain:"Select chain",ConnectingFarcaster:"Farcaster",SwitchActiveChain:"Switch chain",SmartSessionCreated:void 0,SmartSessionList:"Smart Sessions",SIWXSignMessage:"Sign In",PayLoading:"Payment in progress"}}let ea=class extends se{constructor(){super(),this.unsubscribe=[],this.heading=aT()[X.state.view],this.network=F.state.activeCaipNetwork,this.networkImage=pt.getNetworkImage(this.network),this.showBack=!1,this.prevHistoryLength=1,this.view=X.state.view,this.viewDirection="",this.headerText=aT()[X.state.view],this.unsubscribe.push(er.subscribeNetworkImages(()=>{this.networkImage=pt.getNetworkImage(this.network)}),X.subscribeKey("view",e=>{setTimeout(()=>{this.view=e,this.headerText=aT()[e]},Fo.ANIMATION_DURATIONS.HeaderText),this.onViewChange(),this.onHistoryChange()}),F.subscribeKey("activeCaipNetwork",e=>{this.network=e,this.networkImage=pt.getNetworkImage(this.network)}))}disconnectCallback(){this.unsubscribe.forEach(e=>e())}render(){return M` ${this.leftHeaderTemplate()} ${this.titleTemplate()} ${this.rightHeaderTemplate()} `}onWalletHelp(){Re.sendEvent({type:"track",event:"CLICK_WALLET_HELP"}),X.push("WhatIsAWallet")}async onClose(){await _Z.safeClose()}rightHeaderTemplate(){var r,n;const e=(n=(r=oe==null?void 0:oe.state)==null?void 0:r.features)==null?void 0:n.smartSessions;return X.state.view!=="Account"||!e?this.closeButtonTemplate():M` X.push("SmartSessionList")} data-testid="w3m-header-smart-sessions" > ${this.closeButtonTemplate()} `}closeButtonTemplate(){return M` `}titleTemplate(){const e=TTe.includes(this.view);return M` ${this.headerText} ${e?M`Beta`:null} `}leftHeaderTemplate(){var u;const{view:e}=X.state,r=e==="Connect",n=oe.state.enableEmbedded,i=e==="ApproveTransaction",s=e==="ConnectingSiwe",o=e==="Account",a=oe.state.enableNetworkSwitch,c=i||s||r&&n;return o&&a?M``:this.showBack&&!c?M``:M``}onNetworks(){this.isAllowedNetworkSwitch()&&(Re.sendEvent({type:"track",event:"CLICK_NETWORKS"}),X.push("Networks"))}isAllowedNetworkSwitch(){const e=F.getAllRequestedCaipNetworks(),r=e?e.length>1:!1,n=e==null?void 0:e.find(({id:i})=>{var s;return i===((s=this.network)==null?void 0:s.id)});return r||!n}getPadding(){return this.heading?["l","2l","l","2l"]:["0","2l","0","2l"]}onViewChange(){const{history:e}=X.state;let r=Fo.VIEW_DIRECTION.Next;e.length1&&!this.showBack&&r?(await r.animate([{opacity:1},{opacity:0}],{duration:200,fill:"forwards",easing:"ease"}).finished,this.showBack=!0,r.animate([{opacity:0},{opacity:1}],{duration:200,fill:"forwards",easing:"ease"})):e.length<=1&&this.showBack&&r&&(await r.animate([{opacity:1},{opacity:0}],{duration:200,fill:"forwards",easing:"ease"}).finished,this.showBack=!1,r.animate([{opacity:0},{opacity:1}],{duration:200,fill:"forwards",easing:"ease"}))}onGoBack(){X.goBack()}};ea.styles=STe;Xu([G()],ea.prototype,"heading",void 0);Xu([G()],ea.prototype,"network",void 0);Xu([G()],ea.prototype,"networkImage",void 0);Xu([G()],ea.prototype,"showBack",void 0);Xu([G()],ea.prototype,"prevHistoryLength",void 0);Xu([G()],ea.prototype,"view",void 0);Xu([G()],ea.prototype,"viewDirection",void 0);Xu([G()],ea.prototype,"headerText",void 0);ea=Xu([te("w3m-header")],ea);const ITe=de` :host { display: flex; column-gap: var(--wui-spacing-s); align-items: center; padding: var(--wui-spacing-xs) var(--wui-spacing-m) var(--wui-spacing-xs) var(--wui-spacing-xs); border-radius: var(--wui-border-radius-s); border: 1px solid var(--wui-color-gray-glass-005); box-sizing: border-box; background-color: var(--wui-color-bg-175); box-shadow: 0px 14px 64px -4px rgba(0, 0, 0, 0.15), 0px 8px 22px -6px rgba(0, 0, 0, 0.15); max-width: 300px; } :host wui-loading-spinner { margin-left: var(--wui-spacing-3xs); } `;var Dp=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let Vu=class extends se{constructor(){super(...arguments),this.backgroundColor="accent-100",this.iconColor="accent-100",this.icon="checkmark",this.message="",this.loading=!1,this.iconType="default"}render(){return M` ${this.templateIcon()} ${this.message} `}templateIcon(){return this.loading?M``:this.iconType==="default"?M``:M``}};Vu.styles=[He,ITe];Dp([q()],Vu.prototype,"backgroundColor",void 0);Dp([q()],Vu.prototype,"iconColor",void 0);Dp([q()],Vu.prototype,"icon",void 0);Dp([q()],Vu.prototype,"message",void 0);Dp([q()],Vu.prototype,"loading",void 0);Dp([q()],Vu.prototype,"iconType",void 0);Vu=Dp([te("wui-snackbar")],Vu);const PTe=de` :host { display: block; position: absolute; opacity: 0; pointer-events: none; top: 11px; left: 50%; width: max-content; } `;var _Q=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};const OTe={loading:void 0,success:{backgroundColor:"success-100",iconColor:"success-100",icon:"checkmark"},error:{backgroundColor:"error-100",iconColor:"error-100",icon:"close"}};let O6=class extends se{constructor(){super(),this.unsubscribe=[],this.timeout=void 0,this.open=Fe.state.open,this.unsubscribe.push(Fe.subscribeKey("open",e=>{this.open=e,this.onOpen()}))}disconnectedCallback(){clearTimeout(this.timeout),this.unsubscribe.forEach(e=>e())}render(){const{message:e,variant:r,svg:n}=Fe.state,i=OTe[r],{icon:s,iconColor:o}=n??i??{};return M` `}onOpen(){clearTimeout(this.timeout),this.open?(this.animate([{opacity:0,transform:"translateX(-50%) scale(0.85)"},{opacity:1,transform:"translateX(-50%) scale(1)"}],{duration:150,fill:"forwards",easing:"ease"}),this.timeout&&clearTimeout(this.timeout),Fe.state.autoClose&&(this.timeout=setTimeout(()=>Fe.hide(),2500))):this.animate([{opacity:1,transform:"translateX(-50%) scale(1)"},{opacity:0,transform:"translateX(-50%) scale(0.85)"}],{duration:150,fill:"forwards",easing:"ease"})}};O6.styles=PTe;_Q([G()],O6.prototype,"open",void 0);O6=_Q([te("w3m-snackbar")],O6);const RTe=de` :host { z-index: var(--w3m-z-index); display: block; backface-visibility: hidden; will-change: opacity; position: fixed; top: 0; left: 0; right: 0; bottom: 0; pointer-events: none; opacity: 0; background-color: var(--wui-cover); transition: opacity 0.2s var(--wui-ease-out-power-2); will-change: opacity; } :host(.open) { opacity: 1; } :host(.appkit-modal) { position: relative; pointer-events: unset; background: none; width: 100%; opacity: 1; } wui-card { max-width: var(--w3m-modal-width); width: 100%; position: relative; animation: zoom-in 0.2s var(--wui-ease-out-power-2); animation-fill-mode: backwards; outline: none; transition: border-radius var(--wui-duration-lg) var(--wui-ease-out-power-1), background-color var(--wui-duration-lg) var(--wui-ease-out-power-1); will-change: border-radius, background-color; } :host(.appkit-modal) wui-card { max-width: 400px; } wui-card[shake='true'] { animation: zoom-in 0.2s var(--wui-ease-out-power-2), w3m-shake 0.5s var(--wui-ease-out-power-2); } wui-flex { overflow-x: hidden; overflow-y: auto; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; } @media (max-height: 700px) and (min-width: 431px) { wui-flex { align-items: flex-start; } wui-card { margin: var(--wui-spacing-xxl) 0px; } } @media (max-width: 430px) { wui-flex { align-items: flex-end; } wui-card { max-width: 100%; border-bottom-left-radius: var(--local-border-bottom-mobile-radius); border-bottom-right-radius: var(--local-border-bottom-mobile-radius); border-bottom: none; animation: slide-in 0.2s var(--wui-ease-out-power-2); } wui-card[shake='true'] { animation: slide-in 0.2s var(--wui-ease-out-power-2), w3m-shake 0.5s var(--wui-ease-out-power-2); } } @keyframes zoom-in { 0% { transform: scale(0.95) translateY(0); } 100% { transform: scale(1) translateY(0); } } @keyframes slide-in { 0% { transform: scale(1) translateY(50px); } 100% { transform: scale(1) translateY(0); } } @keyframes w3m-shake { 0% { transform: scale(1) rotate(0deg); } 20% { transform: scale(1) rotate(-1deg); } 40% { transform: scale(1) rotate(1.5deg); } 60% { transform: scale(1) rotate(-1.5deg); } 80% { transform: scale(1) rotate(1deg); } 100% { transform: scale(1) rotate(0deg); } } @keyframes w3m-view-height { from { height: var(--prev-height); } to { height: var(--new-height); } } `;var Gd=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};const kD="scroll-lock";class pc extends se{constructor(){super(),this.unsubscribe=[],this.abortController=void 0,this.hasPrefetched=!1,this.enableEmbedded=oe.state.enableEmbedded,this.open=We.state.open,this.caipAddress=F.state.activeCaipAddress,this.caipNetwork=F.state.activeCaipNetwork,this.shake=We.state.shake,this.filterByNamespace=ge.state.filterByNamespace,this.initializeTheming(),Ne.prefetchAnalyticsConfig(),this.unsubscribe.push(We.subscribeKey("open",e=>e?this.onOpen():this.onClose()),We.subscribeKey("shake",e=>this.shake=e),F.subscribeKey("activeCaipNetwork",e=>this.onNewNetwork(e)),F.subscribeKey("activeCaipAddress",e=>this.onNewAddress(e)),oe.subscribeKey("enableEmbedded",e=>this.enableEmbedded=e),ge.subscribeKey("filterByNamespace",e=>{var r;this.filterByNamespace!==e&&!((r=F.getAccountData(e))!=null&&r.caipAddress)&&(Ne.fetchRecommendedWallets(),this.filterByNamespace=e)}))}firstUpdated(){if(this.caipAddress){if(this.enableEmbedded){We.close(),this.prefetch();return}this.onNewAddress(this.caipAddress)}this.open&&this.onOpen(),this.enableEmbedded&&this.prefetch()}disconnectedCallback(){this.unsubscribe.forEach(e=>e()),this.onRemoveKeyboardListener()}render(){return this.style.cssText=` --local-border-bottom-mobile-radius: ${this.enableEmbedded?"clamp(0px, var(--wui-border-radius-l), 44px)":"0px"}; `,this.enableEmbedded?M`${this.contentTemplate()} `:this.open?M` ${this.contentTemplate()} `:null}contentTemplate(){return M` `}async onOverlayClick(e){e.target===e.currentTarget&&await this.handleClose()}async handleClose(){await _Z.safeClose()}initializeTheming(){const{themeVariables:e,themeMode:r}=ar.state,n=nt.getColorTheme(r);l_e(e,n)}onClose(){this.open=!1,this.classList.remove("open"),this.onScrollUnlock(),Fe.hide(),this.onRemoveKeyboardListener()}onOpen(){this.open=!0,this.classList.add("open"),this.onScrollLock(),this.onAddKeyboardListener()}onScrollLock(){const e=document.createElement("style");e.dataset.w3m=kD,e.textContent=` body { touch-action: none; overflow: hidden; overscroll-behavior: contain; } w3m-modal { pointer-events: auto; } `,document.head.appendChild(e)}onScrollUnlock(){const e=document.head.querySelector(`style[data-w3m="${kD}"]`);e&&e.remove()}onAddKeyboardListener(){var r;this.abortController=new AbortController;const e=(r=this.shadowRoot)==null?void 0:r.querySelector("wui-card");e==null||e.focus(),window.addEventListener("keydown",n=>{if(n.key==="Escape")this.handleClose();else if(n.key==="Tab"){const{tagName:i}=n.target;i&&!i.includes("W3M-")&&!i.includes("WUI-")&&(e==null||e.focus())}},this.abortController)}onRemoveKeyboardListener(){var e;(e=this.abortController)==null||e.abort(),this.abortController=void 0}async onNewAddress(e){const r=F.state.isSwitchingNamespace,n=ue.getPlainAddress(e);!n&&!r?We.close():r&&n&&X.goBack(),await Cu.initializeIfEnabled(),this.caipAddress=e,F.setIsSwitchingNamespace(!1)}onNewNetwork(e){var m,b,v;const r=this.caipNetwork,n=(m=r==null?void 0:r.caipNetworkId)==null?void 0:m.toString(),i=r==null?void 0:r.chainNamespace,s=(b=e==null?void 0:e.caipNetworkId)==null?void 0:b.toString(),o=e==null?void 0:e.chainNamespace,a=n!==s,u=a&&!(i!==o),l=(r==null?void 0:r.name)===_e.UNSUPPORTED_NETWORK_NAME,d=X.state.view==="ConnectingExternal",h=!((v=F.getAccountData(e==null?void 0:e.chainNamespace))!=null&&v.caipAddress),f=X.state.view==="UnsupportedChain",g=We.state.open;let p=!1;g&&!d&&(h?a&&(p=!0):(f||u&&!l)&&(p=!0)),p&&X.state.view!=="SIWXSignMessage"&&X.goBack(),this.caipNetwork=e}prefetch(){this.hasPrefetched||(Ne.prefetch(),Ne.fetchWalletsByPage({page:1}),this.hasPrefetched=!0)}}pc.styles=RTe;Gd([q({type:Boolean})],pc.prototype,"enableEmbedded",void 0);Gd([G()],pc.prototype,"open",void 0);Gd([G()],pc.prototype,"caipAddress",void 0);Gd([G()],pc.prototype,"caipNetwork",void 0);Gd([G()],pc.prototype,"shake",void 0);Gd([G()],pc.prototype,"filterByNamespace",void 0);let d9=class extends pc{};d9=Gd([te("w3m-modal")],d9);let h9=class extends pc{};h9=Gd([te("appkit-modal")],h9);const kTe=Object.freeze(Object.defineProperty({__proto__:null,get AppKitModal(){return h9},get W3mModal(){return d9},W3mModalBase:pc},Symbol.toStringTag,{value:"Module"}));var cT={},X1={},Tc={},g0={},gh={},ew={},tw={},ND;function EQ(){if(ND)return tw;ND=1,Object.defineProperty(tw,"__esModule",{value:!0}),tw.getSDKVersion=void 0;const t=()=>"9.1.0";return tw.getSDKVersion=t,tw}var rw={},$D;function NTe(){if($D)return rw;$D=1,Object.defineProperty(rw,"__esModule",{value:!0}),rw.generateRequestId=void 0;const t=n=>n.toString(16).padStart(2,"0"),e=n=>{const i=new Uint8Array(n/2);return window.crypto.getRandomValues(i),Array.from(i,t).join("")},r=()=>typeof window<"u"?e(10):new Date().getTime().toString(36);return rw.generateRequestId=r,rw}var jD;function CQ(){if(jD)return ew;jD=1,Object.defineProperty(ew,"__esModule",{value:!0}),ew.MessageFormatter=void 0;const t=EQ(),e=NTe();class r{}return ew.MessageFormatter=r,r.makeRequest=(n,i)=>({id:(0,e.generateRequestId)(),method:n,params:i,env:{sdkVersion:(0,t.getSDKVersion)()}}),r.makeResponse=(n,i,s)=>({id:n,success:!0,version:s,data:i}),r.makeErrorResponse=(n,i,s)=>({id:n,success:!1,error:i,version:s}),ew}var mh={},BD;function Mp(){if(BD)return mh;BD=1,Object.defineProperty(mh,"__esModule",{value:!0}),mh.RestrictedMethods=mh.Methods=void 0;var t;(function(r){r.sendTransactions="sendTransactions",r.rpcCall="rpcCall",r.getChainInfo="getChainInfo",r.getSafeInfo="getSafeInfo",r.getTxBySafeTxHash="getTxBySafeTxHash",r.getSafeBalances="getSafeBalances",r.signMessage="signMessage",r.signTypedMessage="signTypedMessage",r.getEnvironmentInfo="getEnvironmentInfo",r.getOffChainSignature="getOffChainSignature",r.requestAddressBook="requestAddressBook",r.wallet_getPermissions="wallet_getPermissions",r.wallet_requestPermissions="wallet_requestPermissions"})(t||(mh.Methods=t={}));var e;return function(r){r.requestAddressBook="requestAddressBook"}(e||(mh.RestrictedMethods=e={})),mh}var DD;function $Te(){return DD||(DD=1,function(t){var e=gh&&gh.__createBinding||(Object.create?function(s,o,a,c){c===void 0&&(c=a);var u=Object.getOwnPropertyDescriptor(o,a);(!u||("get"in u?!o.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(s,c,u)}:function(s,o,a,c){c===void 0&&(c=a),s[c]=o[a]}),r=gh&&gh.__exportStar||function(s,o){for(var a in s)a!=="default"&&!Object.prototype.hasOwnProperty.call(o,a)&&e(o,s,a)};Object.defineProperty(t,"__esModule",{value:!0});const n=CQ();class i{constructor(o=null,a=!1){this.allowedOrigins=null,this.callbacks=new Map,this.debugMode=!1,this.isServer=typeof window>"u",this.isValidMessage=({origin:c,data:u,source:l})=>{const d=!u,h=!this.isServer&&l===window.parent,f=typeof u.version<"u"&&parseInt(u.version.split(".")[0]),g=typeof f=="number"&&f>=1;let p=!0;return Array.isArray(this.allowedOrigins)&&(p=this.allowedOrigins.find(m=>m.test(c))!==void 0),!d&&h&&g&&p},this.logIncomingMessage=c=>{console.info(`Safe Apps SDK v1: A message was received from origin ${c.origin}. `,c.data)},this.onParentMessage=c=>{this.isValidMessage(c)&&(this.debugMode&&this.logIncomingMessage(c),this.handleIncomingMessage(c.data))},this.handleIncomingMessage=c=>{const{id:u}=c,l=this.callbacks.get(u);l&&(l(c),this.callbacks.delete(u))},this.send=(c,u)=>{const l=n.MessageFormatter.makeRequest(c,u);if(this.isServer)throw new Error("Window doesn't exist");return window.parent.postMessage(l,"*"),new Promise((d,h)=>{this.callbacks.set(l.id,f=>{if(!f.success){h(new Error(f.error));return}d(f)})})},this.allowedOrigins=o,this.debugMode=a,this.isServer||window.addEventListener("message",this.onParentMessage)}}t.default=i,r(Mp(),t)}(gh)),gh}var nw={},wh={},iw={},MD;function jTe(){if(MD)return iw;MD=1,Object.defineProperty(iw,"__esModule",{value:!0}),iw.isObjectEIP712TypedData=void 0;const t=e=>typeof e=="object"&&e!=null&&"domain"in e&&"types"in e&&"message"in e;return iw.isObjectEIP712TypedData=t,iw}var uT={},LD;function BTe(){return LD||(LD=1,Object.defineProperty(uT,"__esModule",{value:!0})),uT}var lT={},bh={},yh={},Ic={},UD;function DTe(){if(UD)return Ic;UD=1;var t=Ic&&Ic.__awaiter||function(c,u,l,d){function h(f){return f instanceof l?f:new l(function(g){g(f)})}return new(l||(l=Promise))(function(f,g){function p(v){try{b(d.next(v))}catch(E){g(E)}}function m(v){try{b(d.throw(v))}catch(E){g(E)}}function b(v){v.done?f(v.value):h(v.value).then(p,m)}b((d=d.apply(c,u||[])).next())})};Object.defineProperty(Ic,"__esModule",{value:!0}),Ic.insertParams=n,Ic.stringifyQuery=i,Ic.fetchData=o,Ic.getData=a;const e=c=>typeof c=="object"&&c!==null&&("code"in c||"statusCode"in c)&&"message"in c;function r(c,u,l){return c.replace(new RegExp(`\\{${u}\\}`,"g"),l)}function n(c,u){return u?Object.keys(u).reduce((l,d)=>r(l,d,String(u[d])),c):c}function i(c){if(!c)return"";const u=new URLSearchParams;Object.keys(c).forEach(d=>{c[d]!=null&&u.append(d,String(c[d]))});const l=u.toString();return l?`?${l}`:""}function s(c){return t(this,void 0,void 0,function*(){var u;let l;try{l=yield c.json()}catch{l={}}if(!c.ok){const d=e(l)?`CGW error - ${(u=l.code)!==null&&u!==void 0?u:l.statusCode}: ${l.message}`:`CGW error - status ${c.statusText}`;throw new Error(d)}return l})}function o(c,u,l,d,h){return t(this,void 0,void 0,function*(){const f=Object.assign({"Content-Type":"application/json"},d),g={method:u??"POST",headers:f};h&&(g.credentials=h),l!=null&&(g.body=typeof l=="string"?l:JSON.stringify(l));const p=yield fetch(c,g);return s(p)})}function a(c,u,l){return t(this,void 0,void 0,function*(){const d={method:"GET"};u&&(d.headers=Object.assign(Object.assign({},u),{"Content-Type":"application/json"})),l&&(d.credentials=l);const h=yield fetch(c,d);return s(h)})}return Ic}var FD;function MTe(){if(FD)return yh;FD=1,Object.defineProperty(yh,"__esModule",{value:!0}),yh.postEndpoint=r,yh.putEndpoint=n,yh.deleteEndpoint=i,yh.getEndpoint=s;const t=DTe();function e(o,a,c,u){const l=(0,t.insertParams)(a,c),d=(0,t.stringifyQuery)(u);return`${o}${l}${d}`}function r(o,a,c){const u=e(o,a,c==null?void 0:c.path,c==null?void 0:c.query);return(0,t.fetchData)(u,"POST",c==null?void 0:c.body,c==null?void 0:c.headers,c==null?void 0:c.credentials)}function n(o,a,c){const u=e(o,a,c==null?void 0:c.path,c==null?void 0:c.query);return(0,t.fetchData)(u,"PUT",c==null?void 0:c.body,c==null?void 0:c.headers,c==null?void 0:c.credentials)}function i(o,a,c){const u=e(o,a,c==null?void 0:c.path,c==null?void 0:c.query);return(0,t.fetchData)(u,"DELETE",c==null?void 0:c.body,c==null?void 0:c.headers,c==null?void 0:c.credentials)}function s(o,a,c,u){if(u)return(0,t.getData)(u,void 0,c==null?void 0:c.credentials);const l=e(o,a,c==null?void 0:c.path,c==null?void 0:c.query);return(0,t.getData)(l,c==null?void 0:c.headers,c==null?void 0:c.credentials)}return yh}var sw={},HD;function LTe(){return HD||(HD=1,Object.defineProperty(sw,"__esModule",{value:!0}),sw.DEFAULT_BASE_URL=void 0,sw.DEFAULT_BASE_URL="https://safe-client.safe.global"),sw}var ow={},qD;function UTe(){if(qD)return ow;qD=1,Object.defineProperty(ow,"__esModule",{value:!0}),ow.ImplementationVersionState=void 0;var t;return function(e){e.UP_TO_DATE="UP_TO_DATE",e.OUTDATED="OUTDATED",e.UNKNOWN="UNKNOWN"}(t||(ow.ImplementationVersionState=t={})),ow}var Pc={},zD;function FTe(){if(zD)return Pc;zD=1,Object.defineProperty(Pc,"__esModule",{value:!0}),Pc.SafeAppSocialPlatforms=Pc.SafeAppFeatures=Pc.SafeAppAccessPolicyTypes=void 0;var t;(function(n){n.NoRestrictions="NO_RESTRICTIONS",n.DomainAllowlist="DOMAIN_ALLOWLIST"})(t||(Pc.SafeAppAccessPolicyTypes=t={}));var e;(function(n){n.BATCHED_TRANSACTIONS="BATCHED_TRANSACTIONS"})(e||(Pc.SafeAppFeatures=e={}));var r;return function(n){n.TWITTER="TWITTER",n.GITHUB="GITHUB",n.DISCORD="DISCORD",n.TELEGRAM="TELEGRAM"}(r||(Pc.SafeAppSocialPlatforms=r={})),Pc}var wr={},WD;function HTe(){if(WD)return wr;WD=1,Object.defineProperty(wr,"__esModule",{value:!0}),wr.LabelValue=wr.StartTimeValue=wr.DurationType=wr.DetailedExecutionInfoType=wr.TransactionListItemType=wr.ConflictType=wr.TransactionInfoType=wr.SettingsInfoType=wr.TransactionTokenType=wr.TransferDirection=wr.TransactionStatus=wr.Operation=void 0;var t;(function(h){h[h.CALL=0]="CALL",h[h.DELEGATE=1]="DELEGATE"})(t||(wr.Operation=t={}));var e;(function(h){h.AWAITING_CONFIRMATIONS="AWAITING_CONFIRMATIONS",h.AWAITING_EXECUTION="AWAITING_EXECUTION",h.CANCELLED="CANCELLED",h.FAILED="FAILED",h.SUCCESS="SUCCESS"})(e||(wr.TransactionStatus=e={}));var r;(function(h){h.INCOMING="INCOMING",h.OUTGOING="OUTGOING",h.UNKNOWN="UNKNOWN"})(r||(wr.TransferDirection=r={}));var n;(function(h){h.ERC20="ERC20",h.ERC721="ERC721",h.NATIVE_COIN="NATIVE_COIN"})(n||(wr.TransactionTokenType=n={}));var i;(function(h){h.SET_FALLBACK_HANDLER="SET_FALLBACK_HANDLER",h.ADD_OWNER="ADD_OWNER",h.REMOVE_OWNER="REMOVE_OWNER",h.SWAP_OWNER="SWAP_OWNER",h.CHANGE_THRESHOLD="CHANGE_THRESHOLD",h.CHANGE_IMPLEMENTATION="CHANGE_IMPLEMENTATION",h.ENABLE_MODULE="ENABLE_MODULE",h.DISABLE_MODULE="DISABLE_MODULE",h.SET_GUARD="SET_GUARD",h.DELETE_GUARD="DELETE_GUARD"})(i||(wr.SettingsInfoType=i={}));var s;(function(h){h.TRANSFER="Transfer",h.SETTINGS_CHANGE="SettingsChange",h.CUSTOM="Custom",h.CREATION="Creation",h.SWAP_ORDER="SwapOrder",h.TWAP_ORDER="TwapOrder",h.SWAP_TRANSFER="SwapTransfer",h.NATIVE_STAKING_DEPOSIT="NativeStakingDeposit",h.NATIVE_STAKING_VALIDATORS_EXIT="NativeStakingValidatorsExit",h.NATIVE_STAKING_WITHDRAW="NativeStakingWithdraw"})(s||(wr.TransactionInfoType=s={}));var o;(function(h){h.NONE="None",h.HAS_NEXT="HasNext",h.END="End"})(o||(wr.ConflictType=o={}));var a;(function(h){h.TRANSACTION="TRANSACTION",h.LABEL="LABEL",h.CONFLICT_HEADER="CONFLICT_HEADER",h.DATE_LABEL="DATE_LABEL"})(a||(wr.TransactionListItemType=a={}));var c;(function(h){h.MULTISIG="MULTISIG",h.MODULE="MODULE"})(c||(wr.DetailedExecutionInfoType=c={}));var u;(function(h){h.AUTO="AUTO",h.LIMIT_DURATION="LIMIT_DURATION"})(u||(wr.DurationType=u={}));var l;(function(h){h.AT_MINING_TIME="AT_MINING_TIME",h.AT_EPOCH="AT_EPOCH"})(l||(wr.StartTimeValue=l={}));var d;return function(h){h.Queued="Queued",h.Next="Next"}(d||(wr.LabelValue=d={})),wr}var Oc={},VD;function qTe(){if(VD)return Oc;VD=1,Object.defineProperty(Oc,"__esModule",{value:!0}),Oc.FEATURES=Oc.GAS_PRICE_TYPE=Oc.RPC_AUTHENTICATION=void 0;var t;(function(n){n.API_KEY_PATH="API_KEY_PATH",n.NO_AUTHENTICATION="NO_AUTHENTICATION",n.UNKNOWN="UNKNOWN"})(t||(Oc.RPC_AUTHENTICATION=t={}));var e;(function(n){n.ORACLE="ORACLE",n.FIXED="FIXED",n.FIXED_1559="FIXED1559",n.UNKNOWN="UNKNOWN"})(e||(Oc.GAS_PRICE_TYPE=e={}));var r;return function(n){n.ERC721="ERC721",n.SAFE_APPS="SAFE_APPS",n.CONTRACT_INTERACTION="CONTRACT_INTERACTION",n.DOMAIN_LOOKUP="DOMAIN_LOOKUP",n.SPENDING_LIMIT="SPENDING_LIMIT",n.EIP1559="EIP1559",n.SAFE_TX_GAS_OPTIONAL="SAFE_TX_GAS_OPTIONAL",n.TX_SIMULATION="TX_SIMULATION",n.EIP1271="EIP1271"}(r||(Oc.FEATURES=r={})),Oc}var aw={},GD;function zTe(){if(GD)return aw;GD=1,Object.defineProperty(aw,"__esModule",{value:!0}),aw.TokenType=void 0;var t;return function(e){e.ERC20="ERC20",e.ERC721="ERC721",e.NATIVE_TOKEN="NATIVE_TOKEN",e.UNKNOWN="UNKNOWN"}(t||(aw.TokenType=t={})),aw}var dT={},KD;function WTe(){return KD||(KD=1,Object.defineProperty(dT,"__esModule",{value:!0})),dT}var vh={},ZD;function VTe(){if(ZD)return vh;ZD=1,Object.defineProperty(vh,"__esModule",{value:!0}),vh.NativeStakingStatus=vh.ConfirmationViewTypes=void 0;var t;(function(r){r.GENERIC="GENERIC",r.COW_SWAP_ORDER="COW_SWAP_ORDER",r.COW_SWAP_TWAP_ORDER="COW_SWAP_TWAP_ORDER",r.KILN_NATIVE_STAKING_DEPOSIT="KILN_NATIVE_STAKING_DEPOSIT",r.KILN_NATIVE_STAKING_VALIDATORS_EXIT="KILN_NATIVE_STAKING_VALIDATORS_EXIT",r.KILN_NATIVE_STAKING_WITHDRAW="KILN_NATIVE_STAKING_WITHDRAW"})(t||(vh.ConfirmationViewTypes=t={}));var e;return function(r){r.NOT_STAKED="NOT_STAKED",r.ACTIVATING="ACTIVATING",r.DEPOSIT_IN_PROGRESS="DEPOSIT_IN_PROGRESS",r.ACTIVE="ACTIVE",r.EXIT_REQUESTED="EXIT_REQUESTED",r.EXITING="EXITING",r.EXITED="EXITED",r.SLASHED="SLASHED"}(e||(vh.NativeStakingStatus=e={})),vh}var _h={},YD;function GTe(){if(YD)return _h;YD=1,Object.defineProperty(_h,"__esModule",{value:!0}),_h.SafeMessageStatus=_h.SafeMessageListItemType=void 0;var t;(function(r){r.DATE_LABEL="DATE_LABEL",r.MESSAGE="MESSAGE"})(t||(_h.SafeMessageListItemType=t={}));var e;return function(r){r.NEEDS_CONFIRMATION="NEEDS_CONFIRMATION",r.CONFIRMED="CONFIRMED"}(e||(_h.SafeMessageStatus=e={})),_h}var cw={},JD;function KTe(){if(JD)return cw;JD=1,Object.defineProperty(cw,"__esModule",{value:!0}),cw.DeviceType=void 0;var t;return function(e){e.ANDROID="ANDROID",e.IOS="IOS",e.WEB="WEB"}(t||(cw.DeviceType=t={})),cw}var hT={},QD;function ZTe(){return QD||(QD=1,Object.defineProperty(hT,"__esModule",{value:!0})),hT}var XD;function AQ(){return XD||(XD=1,function(t){var e=bh&&bh.__createBinding||(Object.create?function(be,Te,Me,st){st===void 0&&(st=Me);var Cr=Object.getOwnPropertyDescriptor(Te,Me);(!Cr||("get"in Cr?!Te.__esModule:Cr.writable||Cr.configurable))&&(Cr={enumerable:!0,get:function(){return Te[Me]}}),Object.defineProperty(be,st,Cr)}:function(be,Te,Me,st){st===void 0&&(st=Me),be[st]=Te[Me]}),r=bh&&bh.__exportStar||function(be,Te){for(var Me in be)Me!=="default"&&!Object.prototype.hasOwnProperty.call(Te,Me)&&e(Te,be,Me)};Object.defineProperty(t,"__esModule",{value:!0}),t.setBaseUrl=void 0,t.relayTransaction=a,t.getRelayCount=c,t.getSafeInfo=u,t.getIncomingTransfers=l,t.getModuleTransactions=d,t.getMultisigTransactions=h,t.getBalances=f,t.getFiatCurrencies=g,t.getOwnedSafes=p,t.getAllOwnedSafes=m,t.getCollectibles=b,t.getCollectiblesPage=v,t.getTransactionHistory=E,t.getTransactionQueue=w,t.getTransactionDetails=C,t.deleteTransaction=y,t.postSafeGasEstimation=_,t.getNonces=x,t.proposeTransaction=A,t.getConfirmationView=T,t.getTxPreview=O,t.getChainsConfig=k,t.getChainConfig=j,t.getSafeApps=N,t.getMasterCopies=S,t.getDecodedData=P,t.getSafeMessages=I,t.getSafeMessage=B,t.proposeSafeMessage=$,t.confirmSafeMessage=R,t.getDelegates=D,t.registerDevice=L,t.unregisterSafe=U,t.unregisterDevice=z,t.registerEmail=W,t.changeEmail=K,t.resendEmailVerificationCode=J,t.verifyEmail=ne,t.getRegisteredEmail=ae,t.deleteRegisteredEmail=he,t.registerRecoveryModule=ie,t.unsubscribeSingle=Ee,t.unsubscribeAll=pe,t.getSafeOverviews=ve,t.getContract=je,t.getAuthNonce=rt,t.verifyAuth=Ce,t.createAccount=fe,t.getAccount=ft,t.deleteAccount=Wt,t.getAccountDataTypes=lr,t.getAccountDataSettings=dr,t.putAccountDataSettings=hr,t.getIndexingStatus=Er;const n=MTe(),i=LTe();r(UTe(),t),r(FTe(),t),r(HTe(),t),r(qTe(),t),r(zTe(),t),r(WTe(),t),r(VTe(),t),r(GTe(),t),r(KTe(),t),r(ZTe(),t);let s=i.DEFAULT_BASE_URL;const o=be=>{s=be};t.setBaseUrl=o;function a(be,Te){return(0,n.postEndpoint)(s,"/v1/chains/{chainId}/relay",{path:{chainId:be},body:Te})}function c(be,Te){return(0,n.getEndpoint)(s,"/v1/chains/{chainId}/relay/{address}",{path:{chainId:be,address:Te}})}function u(be,Te){return(0,n.getEndpoint)(s,"/v1/chains/{chainId}/safes/{address}",{path:{chainId:be,address:Te}})}function l(be,Te,Me,st){return(0,n.getEndpoint)(s,"/v1/chains/{chainId}/safes/{address}/incoming-transfers/",{path:{chainId:be,address:Te},query:Me},st)}function d(be,Te,Me,st){return(0,n.getEndpoint)(s,"/v1/chains/{chainId}/safes/{address}/module-transactions/",{path:{chainId:be,address:Te},query:Me},st)}function h(be,Te,Me,st){return(0,n.getEndpoint)(s,"/v1/chains/{chainId}/safes/{address}/multisig-transactions/",{path:{chainId:be,address:Te},query:Me},st)}function f(be,Te,Me="usd",st={}){return(0,n.getEndpoint)(s,"/v1/chains/{chainId}/safes/{address}/balances/{currency}",{path:{chainId:be,address:Te,currency:Me},query:st})}function g(){return(0,n.getEndpoint)(s,"/v1/balances/supported-fiat-codes")}function p(be,Te){return(0,n.getEndpoint)(s,"/v1/chains/{chainId}/owners/{address}/safes",{path:{chainId:be,address:Te}})}function m(be){return(0,n.getEndpoint)(s,"/v1/owners/{address}/safes",{path:{address:be}})}function b(be,Te,Me={}){return(0,n.getEndpoint)(s,"/v1/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:be,address:Te},query:Me})}function v(be,Te,Me={},st){return(0,n.getEndpoint)(s,"/v2/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:be,address:Te},query:Me},st)}function E(be,Te,Me={},st){return(0,n.getEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/transactions/history",{path:{chainId:be,safe_address:Te},query:Me},st)}function w(be,Te,Me={},st){return(0,n.getEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/transactions/queued",{path:{chainId:be,safe_address:Te},query:Me},st)}function C(be,Te){return(0,n.getEndpoint)(s,"/v1/chains/{chainId}/transactions/{transactionId}",{path:{chainId:be,transactionId:Te}})}function y(be,Te,Me){return(0,n.deleteEndpoint)(s,"/v1/chains/{chainId}/transactions/{safeTxHash}",{path:{chainId:be,safeTxHash:Te},body:{signature:Me}})}function _(be,Te,Me){return(0,n.postEndpoint)(s,"/v2/chains/{chainId}/safes/{safe_address}/multisig-transactions/estimations",{path:{chainId:be,safe_address:Te},body:Me})}function x(be,Te){return(0,n.getEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/nonces",{path:{chainId:be,safe_address:Te}})}function A(be,Te,Me){return(0,n.postEndpoint)(s,"/v1/chains/{chainId}/transactions/{safe_address}/propose",{path:{chainId:be,safe_address:Te},body:Me})}function T(be,Te,Me,st,Cr,hn){return(0,n.postEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/views/transaction-confirmation",{path:{chainId:be,safe_address:Te},body:{operation:Me,data:st,to:Cr,value:hn}})}function O(be,Te,Me,st,Cr,hn){return(0,n.postEndpoint)(s,"/v1/chains/{chainId}/transactions/{safe_address}/preview",{path:{chainId:be,safe_address:Te},body:{operation:Me,data:st,to:Cr,value:hn}})}function k(be){return(0,n.getEndpoint)(s,"/v1/chains",{query:be})}function j(be){return(0,n.getEndpoint)(s,"/v1/chains/{chainId}",{path:{chainId:be}})}function N(be,Te={}){return(0,n.getEndpoint)(s,"/v1/chains/{chainId}/safe-apps",{path:{chainId:be},query:Te})}function S(be){return(0,n.getEndpoint)(s,"/v1/chains/{chainId}/about/master-copies",{path:{chainId:be}})}function P(be,Te,Me,st){return(0,n.postEndpoint)(s,"/v1/chains/{chainId}/data-decoder",{path:{chainId:be},body:{operation:Te,data:Me,to:st}})}function I(be,Te,Me){return(0,n.getEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:be,safe_address:Te},query:{}},Me)}function B(be,Te){return(0,n.getEndpoint)(s,"/v1/chains/{chainId}/messages/{message_hash}",{path:{chainId:be,message_hash:Te}})}function $(be,Te,Me){return(0,n.postEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:be,safe_address:Te},body:Me})}function R(be,Te,Me){return(0,n.postEndpoint)(s,"/v1/chains/{chainId}/messages/{message_hash}/signatures",{path:{chainId:be,message_hash:Te},body:Me})}function D(be,Te={}){return(0,n.getEndpoint)(s,"/v2/chains/{chainId}/delegates",{path:{chainId:be},query:Te})}function L(be){return(0,n.postEndpoint)(s,"/v1/register/notifications",{body:be})}function U(be,Te,Me){return(0,n.deleteEndpoint)(s,"/v1/chains/{chainId}/notifications/devices/{uuid}/safes/{safe_address}",{path:{chainId:be,safe_address:Te,uuid:Me}})}function z(be,Te){return(0,n.deleteEndpoint)(s,"/v1/chains/{chainId}/notifications/devices/{uuid}",{path:{chainId:be,uuid:Te}})}function W(be,Te,Me,st){return(0,n.postEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/emails",{path:{chainId:be,safe_address:Te},body:Me,headers:st})}function K(be,Te,Me,st,Cr){return(0,n.putEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}",{path:{chainId:be,safe_address:Te,signer:Me},body:st,headers:Cr})}function J(be,Te,Me){return(0,n.postEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}/verify-resend",{path:{chainId:be,safe_address:Te,signer:Me},body:""})}function ne(be,Te,Me,st){return(0,n.putEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}/verify",{path:{chainId:be,safe_address:Te,signer:Me},body:st})}function ae(be,Te,Me,st){return(0,n.getEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}",{path:{chainId:be,safe_address:Te,signer:Me},headers:st})}function he(be,Te,Me,st){return(0,n.deleteEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}",{path:{chainId:be,safe_address:Te,signer:Me},headers:st})}function ie(be,Te,Me){return(0,n.postEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/recovery",{path:{chainId:be,safe_address:Te},body:Me})}function Ee(be){return(0,n.deleteEndpoint)(s,"/v1/subscriptions",{query:be})}function pe(be){return(0,n.deleteEndpoint)(s,"/v1/subscriptions/all",{query:be})}function ve(be,Te){return(0,n.getEndpoint)(s,"/v1/safes",{query:Object.assign(Object.assign({},Te),{safes:be.join(",")})})}function je(be,Te){return(0,n.getEndpoint)(s,"/v1/chains/{chainId}/contracts/{contractAddress}",{path:{chainId:be,contractAddress:Te}})}function rt(){return(0,n.getEndpoint)(s,"/v1/auth/nonce",{credentials:"include"})}function Ce(be){return(0,n.postEndpoint)(s,"/v1/auth/verify",{body:be,credentials:"include"})}function fe(be){return(0,n.postEndpoint)(s,"/v1/accounts",{body:be,credentials:"include"})}function ft(be){return(0,n.getEndpoint)(s,"/v1/accounts/{address}",{path:{address:be},credentials:"include"})}function Wt(be){return(0,n.deleteEndpoint)(s,"/v1/accounts/{address}",{path:{address:be},credentials:"include"})}function lr(){return(0,n.getEndpoint)(s,"/v1/accounts/data-types")}function dr(be){return(0,n.getEndpoint)(s,"/v1/accounts/{address}/data-settings",{path:{address:be},credentials:"include"})}function hr(be,Te){return(0,n.putEndpoint)(s,"/v1/accounts/{address}/data-settings",{path:{address:be},body:Te,credentials:"include"})}function Er(be){return(0,n.getEndpoint)(s,"/v1/chains/{chainId}/about/indexing",{path:{chainId:be}})}}(bh)),bh}var eM;function YTe(){return eM||(eM=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.TransferDirection=t.TransactionStatus=t.TokenType=t.Operation=void 0;var e=AQ();Object.defineProperty(t,"Operation",{enumerable:!0,get:function(){return e.Operation}}),Object.defineProperty(t,"TokenType",{enumerable:!0,get:function(){return e.TokenType}}),Object.defineProperty(t,"TransactionStatus",{enumerable:!0,get:function(){return e.TransactionStatus}}),Object.defineProperty(t,"TransferDirection",{enumerable:!0,get:function(){return e.TransferDirection}})}(lT)),lT}var fT={},tM;function JTe(){return tM||(tM=1,Object.defineProperty(fT,"__esModule",{value:!0}),Mp()),fT}var rM;function lO(){return rM||(rM=1,function(t){var e=wh&&wh.__createBinding||(Object.create?function(n,i,s,o){o===void 0&&(o=s);var a=Object.getOwnPropertyDescriptor(i,s);(!a||("get"in a?!i.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,o,a)}:function(n,i,s,o){o===void 0&&(o=s),n[o]=i[s]}),r=wh&&wh.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,n,s)};Object.defineProperty(t,"__esModule",{value:!0}),r(jTe(),t),r(BTe(),t),r(YTe(),t),r(JTe(),t)}(wh)),wh}var nM;function QTe(){if(nM)return nw;nM=1,Object.defineProperty(nw,"__esModule",{value:!0}),nw.TXs=void 0;const t=Mp(),e=lO();class r{constructor(i){this.communicator=i}async getBySafeTxHash(i){if(!i)throw new Error("Invalid safeTxHash");return(await this.communicator.send(t.Methods.getTxBySafeTxHash,{safeTxHash:i})).data}async signMessage(i){const s={message:i};return(await this.communicator.send(t.Methods.signMessage,s)).data}async signTypedMessage(i){if(!(0,e.isObjectEIP712TypedData)(i))throw new Error("Invalid typed data");return(await this.communicator.send(t.Methods.signTypedMessage,{typedData:i})).data}async send({txs:i,params:s}){if(!i||!i.length)throw new Error("No transactions were passed");const o={txs:i,params:s};return(await this.communicator.send(t.Methods.sendTransactions,o)).data}}return nw.TXs=r,nw}var uw={},lw={},iM;function dO(){return iM||(iM=1,Object.defineProperty(lw,"__esModule",{value:!0}),lw.RPC_CALLS=void 0,lw.RPC_CALLS={eth_call:"eth_call",eth_gasPrice:"eth_gasPrice",eth_getLogs:"eth_getLogs",eth_getBalance:"eth_getBalance",eth_getCode:"eth_getCode",eth_getBlockByHash:"eth_getBlockByHash",eth_getBlockByNumber:"eth_getBlockByNumber",eth_getStorageAt:"eth_getStorageAt",eth_getTransactionByHash:"eth_getTransactionByHash",eth_getTransactionReceipt:"eth_getTransactionReceipt",eth_getTransactionCount:"eth_getTransactionCount",eth_estimateGas:"eth_estimateGas",safe_setSettings:"safe_setSettings"}),lw}var sM;function XTe(){if(sM)return uw;sM=1,Object.defineProperty(uw,"__esModule",{value:!0}),uw.Eth=void 0;const t=dO(),e=Mp(),r={defaultBlockParam:(i="latest")=>i,returnFullTxObjectParam:(i=!1)=>i,blockNumberToHex:i=>Number.isInteger(i)?`0x${i.toString(16)}`:i};class n{constructor(s){this.communicator=s,this.call=this.buildRequest({call:t.RPC_CALLS.eth_call,formatters:[null,r.defaultBlockParam]}),this.getBalance=this.buildRequest({call:t.RPC_CALLS.eth_getBalance,formatters:[null,r.defaultBlockParam]}),this.getCode=this.buildRequest({call:t.RPC_CALLS.eth_getCode,formatters:[null,r.defaultBlockParam]}),this.getStorageAt=this.buildRequest({call:t.RPC_CALLS.eth_getStorageAt,formatters:[null,r.blockNumberToHex,r.defaultBlockParam]}),this.getPastLogs=this.buildRequest({call:t.RPC_CALLS.eth_getLogs}),this.getBlockByHash=this.buildRequest({call:t.RPC_CALLS.eth_getBlockByHash,formatters:[null,r.returnFullTxObjectParam]}),this.getBlockByNumber=this.buildRequest({call:t.RPC_CALLS.eth_getBlockByNumber,formatters:[r.blockNumberToHex,r.returnFullTxObjectParam]}),this.getTransactionByHash=this.buildRequest({call:t.RPC_CALLS.eth_getTransactionByHash}),this.getTransactionReceipt=this.buildRequest({call:t.RPC_CALLS.eth_getTransactionReceipt}),this.getTransactionCount=this.buildRequest({call:t.RPC_CALLS.eth_getTransactionCount,formatters:[null,r.defaultBlockParam]}),this.getGasPrice=this.buildRequest({call:t.RPC_CALLS.eth_gasPrice}),this.getEstimateGas=o=>this.buildRequest({call:t.RPC_CALLS.eth_estimateGas})([o]),this.setSafeSettings=this.buildRequest({call:t.RPC_CALLS.safe_setSettings})}buildRequest(s){const{call:o,formatters:a}=s;return async c=>{a&&Array.isArray(c)&&a.forEach((d,h)=>{d&&(c[h]=d(c[h]))});const u={call:o,params:c||[]};return(await this.communicator.send(e.Methods.rpcCall,u)).data}}}return uw.Eth=n,uw}var Rc={},pT={},Eb={},dw={},hw={},oM;function eIe(){return oM||(oM=1,Object.defineProperty(hw,"__esModule",{value:!0}),hw.version=void 0,hw.version="1.0.8"),hw}var aM;function w1(){if(aM)return dw;aM=1,Object.defineProperty(dw,"__esModule",{value:!0}),dw.BaseError=void 0;const t=eIe();class e extends Error{constructor(n,i={}){var c;const s=i.cause instanceof e?i.cause.details:(c=i.cause)!=null&&c.message?i.cause.message:i.details,o=i.cause instanceof e&&i.cause.docsPath||i.docsPath,a=[n||"An error occurred.","",...i.metaMessages?[...i.metaMessages,""]:[],...o?[`Docs: https://abitype.dev${o}`]:[],...s?[`Details: ${s}`]:[],`Version: abitype@${t.version}`].join(` `);super(a),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),i.cause&&(this.cause=i.cause),this.details=s,this.docsPath=o,this.metaMessages=i.metaMessages,this.shortMessage=n}}return dw.BaseError=e,dw}var R3={},cM;function tIe(){if(cM)return R3;cM=1,Object.defineProperty(R3,"__esModule",{value:!0}),R3.narrow=t;function t(e){return e}return R3}var k3={},N3={},$3={},j3={},Ca={},uM;function VA(){if(uM)return Ca;uM=1,Object.defineProperty(Ca,"__esModule",{value:!0}),Ca.isTupleRegex=Ca.integerRegex=Ca.bytesRegex=void 0,Ca.execTyped=t;function t(e,r){const n=e.exec(r);return n==null?void 0:n.groups}return Ca.bytesRegex=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Ca.integerRegex=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,Ca.isTupleRegex=/^\(.+?\).*?$/,Ca}var lM;function xQ(){if(lM)return j3;lM=1,Object.defineProperty(j3,"__esModule",{value:!0}),j3.formatAbiParameter=r;const t=VA(),e=/^tuple(?(\[(\d*)\])*)$/;function r(n){let i=n.type;if(e.test(n.type)&&"components"in n){i="(";const s=n.components.length;for(let a=0;a[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/;function r(C){return e.test(C)}function n(C){return(0,t.execTyped)(e,C)}const i=/^event (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/;function s(C){return i.test(C)}function o(C){return(0,t.execTyped)(i,C)}const a=/^function (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)(?: (?external|public{1}))?(?: (?pure|view|nonpayable|payable{1}))?(?: returns\s?\((?.*?)\))?$/;function c(C){return a.test(C)}function u(C){return(0,t.execTyped)(a,C)}const l=/^struct (?[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?.*?)\}$/;function d(C){return l.test(C)}function h(C){return(0,t.execTyped)(l,C)}const f=/^constructor\((?.*?)\)(?:\s(?payable{1}))?$/;function g(C){return f.test(C)}function p(C){return(0,t.execTyped)(f,C)}const m=/^fallback\(\) external(?:\s(?payable{1}))?$/;function b(C){return m.test(C)}function v(C){return(0,t.execTyped)(m,C)}const E=/^receive\(\) external payable$/;function w(C){return E.test(C)}return Fr.modifiers=new Set(["memory","indexed","storage","calldata"]),Fr.eventModifiers=new Set(["indexed"]),Fr.functionModifiers=new Set(["calldata","memory","storage"]),Fr}var D3={},kc={},gM;function GA(){if(gM)return kc;gM=1,Object.defineProperty(kc,"__esModule",{value:!0}),kc.UnknownSolidityTypeError=kc.UnknownTypeError=kc.InvalidAbiItemError=void 0;const t=w1();class e extends t.BaseError{constructor({signature:s}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(s,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}kc.InvalidAbiItemError=e;class r extends t.BaseError{constructor({type:s}){super("Unknown type.",{metaMessages:[`Type "${s}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}kc.UnknownTypeError=r;class n extends t.BaseError{constructor({type:s}){super("Unknown type.",{metaMessages:[`Type "${s}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}return kc.UnknownSolidityTypeError=n,kc}var jn={},mM;function b2(){if(mM)return jn;mM=1,Object.defineProperty(jn,"__esModule",{value:!0}),jn.InvalidAbiTypeParameterError=jn.InvalidFunctionModifierError=jn.InvalidModifierError=jn.SolidityProtectedKeywordError=jn.InvalidParameterError=jn.InvalidAbiParametersError=jn.InvalidAbiParameterError=void 0;const t=w1();class e extends t.BaseError{constructor({param:u}){super("Failed to parse ABI parameter.",{details:`parseAbiParameter(${JSON.stringify(u,null,2)})`,docsPath:"/api/human#parseabiparameter-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParameterError"})}}jn.InvalidAbiParameterError=e;class r extends t.BaseError{constructor({params:u}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify(u,null,2)})`,docsPath:"/api/human#parseabiparameters-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}}jn.InvalidAbiParametersError=r;class n extends t.BaseError{constructor({param:u}){super("Invalid ABI parameter.",{details:u}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}jn.InvalidParameterError=n;class i extends t.BaseError{constructor({param:u,name:l}){super("Invalid ABI parameter.",{details:u,metaMessages:[`"${l}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}jn.SolidityProtectedKeywordError=i;class s extends t.BaseError{constructor({param:u,type:l,modifier:d}){super("Invalid ABI parameter.",{details:u,metaMessages:[`Modifier "${d}" not allowed${l?` in "${l}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}jn.InvalidModifierError=s;class o extends t.BaseError{constructor({param:u,type:l,modifier:d}){super("Invalid ABI parameter.",{details:u,metaMessages:[`Modifier "${d}" not allowed${l?` in "${l}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${d}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}jn.InvalidFunctionModifierError=o;class a extends t.BaseError{constructor({abiParameter:u}){super("Invalid ABI parameter.",{details:JSON.stringify(u,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}return jn.InvalidAbiTypeParameterError=a,jn}var Nc={},wM;function hO(){if(wM)return Nc;wM=1,Object.defineProperty(Nc,"__esModule",{value:!0}),Nc.InvalidStructSignatureError=Nc.UnknownSignatureError=Nc.InvalidSignatureError=void 0;const t=w1();class e extends t.BaseError{constructor({signature:s,type:o}){super(`Invalid ${o} signature.`,{details:s}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}Nc.InvalidSignatureError=e;class r extends t.BaseError{constructor({signature:s}){super("Unknown signature.",{details:s}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}Nc.UnknownSignatureError=r;class n extends t.BaseError{constructor({signature:s}){super("Invalid struct signature.",{details:s,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}return Nc.InvalidStructSignatureError=n,Nc}var fw={},bM;function IQ(){if(bM)return fw;bM=1,Object.defineProperty(fw,"__esModule",{value:!0}),fw.CircularReferenceError=void 0;const t=w1();class e extends t.BaseError{constructor({type:n}){super("Circular reference detected.",{metaMessages:[`Struct "${n}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}return fw.CircularReferenceError=e,fw}var Li={},pw={},yM;function PQ(){if(yM)return pw;yM=1,Object.defineProperty(pw,"__esModule",{value:!0}),pw.InvalidParenthesisError=void 0;const t=w1();class e extends t.BaseError{constructor({current:n,depth:i}){super("Unbalanced parentheses.",{metaMessages:[`"${n.trim()}" has too many ${i>0?"opening":"closing"} parentheses.`],details:`Depth "${i}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}return pw.InvalidParenthesisError=e,pw}var m0={},vM;function nIe(){if(vM)return m0;vM=1,Object.defineProperty(m0,"__esModule",{value:!0}),m0.parameterCache=void 0,m0.getParameterCacheKey=t;function t(e,r,n){let i="";if(n)for(const s of Object.entries(n)){if(!s)continue;let o="";for(const a of s[1])o+=`[${a.type}${a.name?`:${a.name}`:""}]`;i+=`(${s[0]}{${o}})`}return r?`${r}:${e}${i}`:e}return m0.parameterCache=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]),m0}var _M;function Zm(){if(_M)return Li;_M=1,Object.defineProperty(Li,"__esModule",{value:!0}),Li.parseSignature=a,Li.parseFunctionSignature=c,Li.parseEventSignature=u,Li.parseErrorSignature=l,Li.parseConstructorSignature=d,Li.parseFallbackSignature=h,Li.parseAbiParameter=m,Li.splitParameters=b,Li.isSolidityType=v,Li.isSolidityKeyword=w,Li.isValidDataLocation=C;const t=VA(),e=GA(),r=b2(),n=hO(),i=PQ(),s=nIe(),o=b1();function a(y,_={}){if((0,o.isFunctionSignature)(y))return c(y,_);if((0,o.isEventSignature)(y))return u(y,_);if((0,o.isErrorSignature)(y))return l(y,_);if((0,o.isConstructorSignature)(y))return d(y,_);if((0,o.isFallbackSignature)(y))return h(y);if((0,o.isReceiveSignature)(y))return{type:"receive",stateMutability:"payable"};throw new n.UnknownSignatureError({signature:y})}function c(y,_={}){const x=(0,o.execFunctionSignature)(y);if(!x)throw new n.InvalidSignatureError({signature:y,type:"function"});const A=b(x.parameters),T=[],O=A.length;for(let j=0;j[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,g=/^\((?.+?)\)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,p=/^u?int$/;function m(y,_){var I,B;const x=(0,s.getParameterCacheKey)(y,_==null?void 0:_.type,_==null?void 0:_.structs);if(s.parameterCache.has(x))return s.parameterCache.get(x);const A=t.isTupleRegex.test(y),T=(0,t.execTyped)(A?g:f,y);if(!T)throw new r.InvalidParameterError({param:y});if(T.name&&w(T.name))throw new r.SolidityProtectedKeywordError({param:y,name:T.name});const O=T.name?{name:T.name}:{},k=T.modifier==="indexed"?{indexed:!0}:{},j=(_==null?void 0:_.structs)??{};let N,S={};if(A){N="tuple";const $=b(T.type),R=[],D=$.length;for(let L=0;L[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?$/;function u(l,d,h=new Set){const f=[],g=l.length;for(let p=0;pr(e,o)}return F3}var H3={},q3={},it={},gw={},PM;function el(){if(PM)return gw;PM=1,Object.defineProperty(gw,"__esModule",{value:!0}),gw.formatAbiItem=e,gw.formatAbiParams=r;const t=$r();function e(i,{includeName:s=!1}={}){if(i.type!=="function"&&i.type!=="event"&&i.type!=="error")throw new t.InvalidDefinitionTypeError(i.type);return`${i.name}(${r(i.inputs,{includeName:s})})`}function r(i,{includeName:s=!1}={}){return i?i.map(o=>n(o,{includeName:s})).join(s?", ":","):""}function n(i,{includeName:s}){return i.type.startsWith("tuple")?`(${r(i.components,{includeName:s})})${i.type.slice(5)}`:i.type+(s&&i.name?` ${i.name}`:"")}return gw}var z3={},W3={},OM;function ki(){if(OM)return W3;OM=1,Object.defineProperty(W3,"__esModule",{value:!0}),W3.isHex=t;function t(e,{strict:r=!0}={}){return!e||typeof e!="string"?!1:r?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}return W3}var RM;function rs(){if(RM)return z3;RM=1,Object.defineProperty(z3,"__esModule",{value:!0}),z3.size=e;const t=ki();function e(r){return(0,t.isHex)(r,{strict:!1})?Math.ceil((r.length-2)/2):r.length}return z3}var b0={},mw={},kM;function cIe(){return kM||(kM=1,Object.defineProperty(mw,"__esModule",{value:!0}),mw.version=void 0,mw.version="2.31.0"),mw}var NM;function _t(){if(NM)return b0;NM=1,Object.defineProperty(b0,"__esModule",{value:!0}),b0.BaseError=void 0,b0.setErrorConfig=r;const t=cIe();let e={getDocsUrl:({docsBaseUrl:s,docsPath:o="",docsSlug:a})=>o?`${s??"https://viem.sh"}${o}${a?`#${a}`:""}`:void 0,version:`viem@${t.version}`};function r(s){e=s}class n extends Error{constructor(o,a={}){var h;const c=(()=>{var f;return a.cause instanceof n?a.cause.details:(f=a.cause)!=null&&f.message?a.cause.message:a.details})(),u=a.cause instanceof n&&a.cause.docsPath||a.docsPath,l=(h=e.getDocsUrl)==null?void 0:h.call(e,{...a,docsPath:u}),d=[o||"An error occurred.","",...a.metaMessages?[...a.metaMessages,""]:[],...l?[`Docs: ${l}`]:[],...c?[`Details: ${c}`]:[],...e.version?[`Version: ${e.version}`]:[]].join(` `);super(d,a.cause?{cause:a.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=c,this.docsPath=u,this.metaMessages=a.metaMessages,this.name=a.name??this.name,this.shortMessage=o,this.version=t.version}walk(o){return i(this,o)}}b0.BaseError=n;function i(s,o){return o!=null&&o(s)?s:s&&typeof s=="object"&&"cause"in s&&s.cause!==void 0?i(s.cause,o):o?null:s}return b0}var $M;function $r(){if($M)return it;$M=1,Object.defineProperty(it,"__esModule",{value:!0}),it.UnsupportedPackedAbiType=it.InvalidDefinitionTypeError=it.InvalidArrayError=it.InvalidAbiDecodingTypeError=it.InvalidAbiEncodingTypeError=it.DecodeLogTopicsMismatch=it.DecodeLogDataMismatch=it.BytesSizeMismatchError=it.AbiItemAmbiguityError=it.AbiFunctionSignatureNotFoundError=it.AbiFunctionOutputsNotFoundError=it.AbiFunctionNotFoundError=it.AbiEventNotFoundError=it.AbiEventSignatureNotFoundError=it.AbiEventSignatureEmptyTopicsError=it.AbiErrorSignatureNotFoundError=it.AbiErrorNotFoundError=it.AbiErrorInputsNotFoundError=it.AbiEncodingLengthMismatchError=it.AbiEncodingBytesSizeMismatchError=it.AbiEncodingArrayLengthMismatchError=it.AbiDecodingZeroDataError=it.AbiDecodingDataSizeTooSmallError=it.AbiDecodingDataSizeInvalidError=it.AbiConstructorParamsNotFoundError=it.AbiConstructorNotFoundError=void 0;const t=el(),e=rs(),r=_t();class n extends r.BaseError{constructor({docsPath:N}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(` `),{docsPath:N,name:"AbiConstructorNotFoundError"})}}it.AbiConstructorNotFoundError=n;class i extends r.BaseError{constructor({docsPath:N}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(` `),{docsPath:N,name:"AbiConstructorParamsNotFoundError"})}}it.AbiConstructorParamsNotFoundError=i;class s extends r.BaseError{constructor({data:N,size:S}){super([`Data size of ${S} bytes is invalid.`,"Size must be in increments of 32 bytes (size % 32 === 0)."].join(` `),{metaMessages:[`Data: ${N} (${S} bytes)`],name:"AbiDecodingDataSizeInvalidError"})}}it.AbiDecodingDataSizeInvalidError=s;class o extends r.BaseError{constructor({data:N,params:S,size:P}){super([`Data size of ${P} bytes is too small for given parameters.`].join(` `),{metaMessages:[`Params: (${(0,t.formatAbiParams)(S,{includeName:!0})})`,`Data: ${N} (${P} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=N,this.params=S,this.size=P}}it.AbiDecodingDataSizeTooSmallError=o;class a extends r.BaseError{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}it.AbiDecodingZeroDataError=a;class c extends r.BaseError{constructor({expectedLength:N,givenLength:S,type:P}){super([`ABI encoding array length mismatch for type ${P}.`,`Expected length: ${N}`,`Given length: ${S}`].join(` `),{name:"AbiEncodingArrayLengthMismatchError"})}}it.AbiEncodingArrayLengthMismatchError=c;class u extends r.BaseError{constructor({expectedSize:N,value:S}){super(`Size of bytes "${S}" (bytes${(0,e.size)(S)}) does not match expected size (bytes${N}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}it.AbiEncodingBytesSizeMismatchError=u;class l extends r.BaseError{constructor({expectedLength:N,givenLength:S}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${N}`,`Given length (values): ${S}`].join(` `),{name:"AbiEncodingLengthMismatchError"})}}it.AbiEncodingLengthMismatchError=l;class d extends r.BaseError{constructor(N,{docsPath:S}){super([`Arguments (\`args\`) were provided to "${N}", but "${N}" on the ABI does not contain any parameters (\`inputs\`).`,"Cannot encode error result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the inputs exist on it."].join(` `),{docsPath:S,name:"AbiErrorInputsNotFoundError"})}}it.AbiErrorInputsNotFoundError=d;class h extends r.BaseError{constructor(N,{docsPath:S}={}){super([`Error ${N?`"${N}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it."].join(` `),{docsPath:S,name:"AbiErrorNotFoundError"})}}it.AbiErrorNotFoundError=h;class f extends r.BaseError{constructor(N,{docsPath:S}){super([`Encoded error signature "${N}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${N}.`].join(` `),{docsPath:S,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=N}}it.AbiErrorSignatureNotFoundError=f;class g extends r.BaseError{constructor({docsPath:N}){super("Cannot extract event signature from empty topics.",{docsPath:N,name:"AbiEventSignatureEmptyTopicsError"})}}it.AbiEventSignatureEmptyTopicsError=g;class p extends r.BaseError{constructor(N,{docsPath:S}){super([`Encoded event signature "${N}" not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${N}.`].join(` `),{docsPath:S,name:"AbiEventSignatureNotFoundError"})}}it.AbiEventSignatureNotFoundError=p;class m extends r.BaseError{constructor(N,{docsPath:S}={}){super([`Event ${N?`"${N}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it."].join(` `),{docsPath:S,name:"AbiEventNotFoundError"})}}it.AbiEventNotFoundError=m;class b extends r.BaseError{constructor(N,{docsPath:S}={}){super([`Function ${N?`"${N}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(` `),{docsPath:S,name:"AbiFunctionNotFoundError"})}}it.AbiFunctionNotFoundError=b;class v extends r.BaseError{constructor(N,{docsPath:S}){super([`Function "${N}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join(` `),{docsPath:S,name:"AbiFunctionOutputsNotFoundError"})}}it.AbiFunctionOutputsNotFoundError=v;class E extends r.BaseError{constructor(N,{docsPath:S}){super([`Encoded function signature "${N}" not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${N}.`].join(` `),{docsPath:S,name:"AbiFunctionSignatureNotFoundError"})}}it.AbiFunctionSignatureNotFoundError=E;class w extends r.BaseError{constructor(N,S){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${N.type}\` in \`${(0,t.formatAbiItem)(N.abiItem)}\`, and`,`\`${S.type}\` in \`${(0,t.formatAbiItem)(S.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}it.AbiItemAmbiguityError=w;class C extends r.BaseError{constructor({expectedSize:N,givenSize:S}){super(`Expected bytes${N}, got bytes${S}.`,{name:"BytesSizeMismatchError"})}}it.BytesSizeMismatchError=C;class y extends r.BaseError{constructor({abiItem:N,data:S,params:P,size:I}){super([`Data size of ${I} bytes is too small for non-indexed event parameters.`].join(` `),{metaMessages:[`Params: (${(0,t.formatAbiParams)(P,{includeName:!0})})`,`Data: ${S} (${I} bytes)`],name:"DecodeLogDataMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=N,this.data=S,this.params=P,this.size=I}}it.DecodeLogDataMismatch=y;class _ extends r.BaseError{constructor({abiItem:N,param:S}){super([`Expected a topic for indexed event parameter${S.name?` "${S.name}"`:""} on event "${(0,t.formatAbiItem)(N,{includeName:!0})}".`].join(` `),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=N}}it.DecodeLogTopicsMismatch=_;class x extends r.BaseError{constructor(N,{docsPath:S}){super([`Type "${N}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(` `),{docsPath:S,name:"InvalidAbiEncodingType"})}}it.InvalidAbiEncodingTypeError=x;class A extends r.BaseError{constructor(N,{docsPath:S}){super([`Type "${N}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(` `),{docsPath:S,name:"InvalidAbiDecodingType"})}}it.InvalidAbiDecodingTypeError=A;class T extends r.BaseError{constructor(N){super([`Value "${N}" is not a valid array.`].join(` `),{name:"InvalidArrayError"})}}it.InvalidArrayError=T;class O extends r.BaseError{constructor(N){super([`"${N}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(` `),{name:"InvalidDefinitionTypeError"})}}it.InvalidDefinitionTypeError=O;class k extends r.BaseError{constructor(N){super(`Type "${N}" is not supported for packed encoding.`,{name:"UnsupportedPackedAbiType"})}}return it.UnsupportedPackedAbiType=k,it}var ww={},jM;function OQ(){if(jM)return ww;jM=1,Object.defineProperty(ww,"__esModule",{value:!0}),ww.FilterTypeNotSupportedError=void 0;const t=_t();class e extends t.BaseError{constructor(n){super(`Filter type "${n}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}return ww.FilterTypeNotSupportedError=e,ww}var xl={},y0={},$c={},BM;function ZA(){if(BM)return $c;BM=1,Object.defineProperty($c,"__esModule",{value:!0}),$c.InvalidBytesLengthError=$c.SizeExceedsPaddingSizeError=$c.SliceOffsetOutOfBoundsError=void 0;const t=_t();class e extends t.BaseError{constructor({offset:s,position:o,size:a}){super(`Slice ${o==="start"?"starting":"ending"} at offset "${s}" is out-of-bounds (size: ${a}).`,{name:"SliceOffsetOutOfBoundsError"})}}$c.SliceOffsetOutOfBoundsError=e;class r extends t.BaseError{constructor({size:s,targetSize:o,type:a}){super(`${a.charAt(0).toUpperCase()}${a.slice(1).toLowerCase()} size (${s}) exceeds padding size (${o}).`,{name:"SizeExceedsPaddingSizeError"})}}$c.SizeExceedsPaddingSizeError=r;class n extends t.BaseError{constructor({size:s,targetSize:o,type:a}){super(`${a.charAt(0).toUpperCase()}${a.slice(1).toLowerCase()} is expected to be ${o} ${a} long, but is ${s} ${a} long.`,{name:"InvalidBytesLengthError"})}}return $c.InvalidBytesLengthError=n,$c}var DM;function Zd(){if(DM)return y0;DM=1,Object.defineProperty(y0,"__esModule",{value:!0}),y0.pad=e,y0.padHex=r,y0.padBytes=n;const t=ZA();function e(i,{dir:s,size:o=32}={}){return typeof i=="string"?r(i,{dir:s,size:o}):n(i,{dir:s,size:o})}function r(i,{dir:s,size:o=32}={}){if(o===null)return i;const a=i.replace("0x","");if(a.length>o*2)throw new t.SizeExceedsPaddingSizeError({size:Math.ceil(a.length/2),targetSize:o,type:"hex"});return`0x${a[s==="right"?"padEnd":"padStart"](o*2,"0")}`}function n(i,{dir:s,size:o=32}={}){if(o===null)return i;if(i.length>o)throw new t.SizeExceedsPaddingSizeError({size:i.length,targetSize:o,type:"bytes"});const a=new Uint8Array(o);for(let c=0;cd)throw new t.SizeOverflowError({givenSize:(0,e.size)(l),maxSize:d})}function s(l,d){const h=typeof d=="string"?{to:d}:d,f=h.to;return f==="number"?c(l,h):f==="bigint"?o(l,h):f==="string"?u(l,h):f==="boolean"?a(l,h):(0,n.hexToBytes)(l,h)}function o(l,d={}){const{signed:h}=d;d.size&&i(l,{size:d.size});const f=BigInt(l);if(!h)return f;const g=(l.length-2)/2,p=(1n<d.toString(16).padStart(2,"0"));function i(l,d={}){return typeof l=="number"||typeof l=="bigint"?a(l,d):typeof l=="string"?u(l,d):typeof l=="boolean"?s(l,d):o(l,d)}function s(l,d={}){const h=`0x${Number(l)}`;return typeof d.size=="number"?((0,r.assertSize)(h,{size:d.size}),(0,e.pad)(h,{size:d.size})):h}function o(l,d={}){let h="";for(let g=0;gp||g=c.zero&&f<=c.nine)return f-c.zero;if(f>=c.A&&f<=c.F)return f-(c.A-10);if(f>=c.a&&f<=c.f)return f-(c.a-10)}function l(f,g={}){let p=f;g.size&&((0,n.assertSize)(p,{size:g.size}),p=(0,r.pad)(p,{dir:"right",size:g.size}));let m=p.slice(2);m.length%2&&(m=`0${m}`);const b=m.length/2,v=new Uint8Array(b);for(let E=0,w=0;E>e&t)}:{h:Number(A>>e&t)|0,l:Number(A&t)|0}}function n(A,T=!1){const O=A.length;let k=new Uint32Array(O),j=new Uint32Array(O);for(let N=0;NBigInt(A>>>0)<>>0);ht.toBig=i;const s=(A,T,O)=>A>>>O;ht.shrSH=s;const o=(A,T,O)=>A<<32-O|T>>>O;ht.shrSL=o;const a=(A,T,O)=>A>>>O|T<<32-O;ht.rotrSH=a;const c=(A,T,O)=>A<<32-O|T>>>O;ht.rotrSL=c;const u=(A,T,O)=>A<<64-O|T>>>O-32;ht.rotrBH=u;const l=(A,T,O)=>A>>>O-32|T<<64-O;ht.rotrBL=l;const d=(A,T)=>T;ht.rotr32H=d;const h=(A,T)=>A;ht.rotr32L=h;const f=(A,T,O)=>A<>>32-O;ht.rotlSH=f;const g=(A,T,O)=>T<>>32-O;ht.rotlSL=g;const p=(A,T,O)=>T<>>64-O;ht.rotlBH=p;const m=(A,T,O)=>A<>>64-O;ht.rotlBL=m;function b(A,T,O,k){const j=(T>>>0)+(k>>>0);return{h:A+O+(j/2**32|0)|0,l:j|0}}const v=(A,T,O)=>(A>>>0)+(T>>>0)+(O>>>0);ht.add3L=v;const E=(A,T,O,k)=>T+O+k+(A/2**32|0)|0;ht.add3H=E;const w=(A,T,O,k)=>(A>>>0)+(T>>>0)+(O>>>0)+(k>>>0);ht.add4L=w;const C=(A,T,O,k,j)=>T+O+k+j+(A/2**32|0)|0;ht.add4H=C;const y=(A,T,O,k,j)=>(A>>>0)+(T>>>0)+(O>>>0)+(k>>>0)+(j>>>0);ht.add5L=y;const _=(A,T,O,k,j,N)=>T+O+k+j+N+(A/2**32|0)|0;ht.add5H=_;const x={fromBig:r,split:n,toBig:i,shrSH:s,shrSL:o,rotrSH:a,rotrSL:c,rotrBH:u,rotrBL:l,rotr32H:d,rotr32L:h,rotlSH:f,rotlSL:g,rotlBH:p,rotlBL:m,add:b,add3L:v,add3H:E,add4L:w,add4H:C,add5H:_,add5L:y};return ht.default=x,ht}var gT={},bw={},zM;function uIe(){return zM||(zM=1,Object.defineProperty(bw,"__esModule",{value:!0}),bw.crypto=void 0,bw.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0),bw}var WM;function Yd(){return WM||(WM=1,function(t){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(t,"__esModule",{value:!0}),t.wrapXOFConstructorWithOpts=t.wrapConstructorWithOpts=t.wrapConstructor=t.Hash=t.nextTick=t.swap32IfBE=t.byteSwapIfBE=t.swap8IfBE=t.isLE=void 0,t.isBytes=r,t.anumber=n,t.abytes=i,t.ahash=s,t.aexists=o,t.aoutput=a,t.u8=c,t.u32=u,t.clean=l,t.createView=d,t.rotr=h,t.rotl=f,t.byteSwap=g,t.byteSwap32=p,t.bytesToHex=v,t.hexToBytes=C,t.asyncLoop=_,t.utf8ToBytes=x,t.bytesToUtf8=A,t.toBytes=T,t.kdfInputToBytes=O,t.concatBytes=k,t.checkOpts=j,t.createHasher=S,t.createOptHasher=P,t.createXOFer=I,t.randomBytes=B;const e=uIe();function r($){return $ instanceof Uint8Array||ArrayBuffer.isView($)&&$.constructor.name==="Uint8Array"}function n($){if(!Number.isSafeInteger($)||$<0)throw new Error("positive integer expected, got "+$)}function i($,...R){if(!r($))throw new Error("Uint8Array expected");if(R.length>0&&!R.includes($.length))throw new Error("Uint8Array expected of length "+R+", got length="+$.length)}function s($){if(typeof $!="function"||typeof $.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");n($.outputLen),n($.blockLen)}function o($,R=!0){if($.destroyed)throw new Error("Hash instance has been destroyed");if(R&&$.finished)throw new Error("Hash#digest() has already been called")}function a($,R){i($);const D=R.outputLen;if($.length>>R}function f($,R){return $<>>32-R>>>0}t.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function g($){return $<<24&4278190080|$<<8&16711680|$>>>8&65280|$>>>24&255}t.swap8IfBE=t.isLE?$=>$:$=>g($),t.byteSwapIfBE=t.swap8IfBE;function p($){for(let R=0;R<$.length;R++)$[R]=g($[R]);return $}t.swap32IfBE=t.isLE?$=>$:p;const m=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",b=Array.from({length:256},($,R)=>R.toString(16).padStart(2,"0"));function v($){if(i($),m)return $.toHex();let R="";for(let D=0;D<$.length;D++)R+=b[$[D]];return R}const E={_0:48,_9:57,A:65,F:70,a:97,f:102};function w($){if($>=E._0&&$<=E._9)return $-E._0;if($>=E.A&&$<=E.F)return $-(E.A-10);if($>=E.a&&$<=E.f)return $-(E.a-10)}function C($){if(typeof $!="string")throw new Error("hex string expected, got "+typeof $);if(m)return Uint8Array.fromHex($);const R=$.length,D=R/2;if(R%2)throw new Error("hex string expected, got unpadded hex of length "+R);const L=new Uint8Array(D);for(let U=0,z=0;U{};t.nextTick=y;async function _($,R,D){let L=Date.now();for(let U=0;U<$;U++){D(U);const z=Date.now()-L;z>=0&&z$().update(T(L)).digest(),D=$();return R.outputLen=D.outputLen,R.blockLen=D.blockLen,R.create=()=>$(),R}function P($){const R=(L,U)=>$(U).update(T(L)).digest(),D=$({});return R.outputLen=D.outputLen,R.blockLen=D.blockLen,R.create=L=>$(L),R}function I($){const R=(L,U)=>$(U).update(T(L)).digest(),D=$({});return R.outputLen=D.outputLen,R.blockLen=D.blockLen,R.create=L=>$(L),R}t.wrapConstructor=S,t.wrapConstructorWithOpts=P,t.wrapXOFConstructorWithOpts=I;function B($=32){if(e.crypto&&typeof e.crypto.getRandomValues=="function")return e.crypto.getRandomValues(new Uint8Array($));if(e.crypto&&typeof e.crypto.randomBytes=="function")return Uint8Array.from(e.crypto.randomBytes($));throw new Error("crypto.getRandomValues must be defined")}}(gT)),gT}var VM;function fO(){if(VM)return Sr;VM=1,Object.defineProperty(Sr,"__esModule",{value:!0}),Sr.shake256=Sr.shake128=Sr.keccak_512=Sr.keccak_384=Sr.keccak_256=Sr.keccak_224=Sr.sha3_512=Sr.sha3_384=Sr.sha3_256=Sr.sha3_224=Sr.Keccak=void 0,Sr.keccakP=m;const t=RQ(),e=Yd(),r=BigInt(0),n=BigInt(1),i=BigInt(2),s=BigInt(7),o=BigInt(256),a=BigInt(113),c=[],u=[],l=[];for(let w=0,C=n,y=1,_=0;w<24;w++){[y,_]=[_,(2*y+3*_)%5],c.push(2*(5*_+y)),u.push((w+1)*(w+2)/2%64);let x=r;for(let A=0;A<7;A++)C=(C<>s)*a)%o,C&i&&(x^=n<<(n<y>32?(0,t.rotlBH)(w,C,y):(0,t.rotlSH)(w,C,y),p=(w,C,y)=>y>32?(0,t.rotlBL)(w,C,y):(0,t.rotlSL)(w,C,y);function m(w,C=24){const y=new Uint32Array(10);for(let _=24-C;_<24;_++){for(let T=0;T<10;T++)y[T]=w[T]^w[T+10]^w[T+20]^w[T+30]^w[T+40];for(let T=0;T<10;T+=2){const O=(T+8)%10,k=(T+2)%10,j=y[k],N=y[k+1],S=g(j,N,1)^y[O],P=p(j,N,1)^y[O+1];for(let I=0;I<50;I+=10)w[T+I]^=S,w[T+I+1]^=P}let x=w[2],A=w[3];for(let T=0;T<24;T++){const O=u[T],k=g(x,A,O),j=p(x,A,O),N=c[T];x=w[N],A=w[N+1],w[N]=k,w[N+1]=j}for(let T=0;T<50;T+=10){for(let O=0;O<10;O++)y[O]=w[T+O];for(let O=0;O<10;O++)w[T+O]^=~y[(O+2)%10]&y[(O+4)%10]}w[0]^=h[_],w[1]^=f[_]}(0,e.clean)(y)}class b extends e.Hash{constructor(C,y,_,x=!1,A=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=C,this.suffix=y,this.outputLen=_,this.enableXOF=x,this.rounds=A,(0,e.anumber)(_),!(0=_&&this.keccak();const T=Math.min(_-this.posOut,A-x);C.set(y.subarray(this.posOut,this.posOut+T),x),this.posOut+=T,x+=T}return C}xofInto(C){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(C)}xof(C){return(0,e.anumber)(C),this.xofInto(new Uint8Array(C))}digestInto(C){if((0,e.aoutput)(C,this),this.finished)throw new Error("digest() was already called");return this.writeInto(C),this.destroy(),C}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,(0,e.clean)(this.state)}_cloneInto(C){const{blockLen:y,suffix:_,outputLen:x,rounds:A,enableXOF:T}=this;return C||(C=new b(y,_,x,T,A)),C.state32.set(this.state32),C.pos=this.pos,C.posOut=this.posOut,C.finished=this.finished,C.rounds=A,C.suffix=_,C.outputLen=x,C.enableXOF=T,C.destroyed=this.destroyed,C}}Sr.Keccak=b;const v=(w,C,y)=>(0,e.createHasher)(()=>new b(C,w,y));Sr.sha3_224=v(6,144,224/8),Sr.sha3_256=v(6,136,256/8),Sr.sha3_384=v(6,104,384/8),Sr.sha3_512=v(6,72,512/8),Sr.keccak_224=v(1,144,224/8),Sr.keccak_256=v(1,136,256/8),Sr.keccak_384=v(1,104,384/8),Sr.keccak_512=v(1,72,512/8);const E=(w,C,y)=>(0,e.createXOFer)((_={})=>new b(C,w,_.dkLen===void 0?y:_.dkLen,!0));return Sr.shake128=E(31,168,128/8),Sr.shake256=E(31,136,256/8),Sr}var GM;function ns(){if(GM)return G3;GM=1,Object.defineProperty(G3,"__esModule",{value:!0}),G3.keccak256=i;const t=fO(),e=ki(),r=Tr(),n=ze();function i(s,o){const a=o||"hex",c=(0,t.keccak_256)((0,e.isHex)(s,{strict:!1})?(0,r.toBytes)(s):s);return a==="bytes"?c:(0,n.toHex)(c)}return G3}var yw={},K3={},Z3={},KM;function lIe(){if(KM)return Z3;KM=1,Object.defineProperty(Z3,"__esModule",{value:!0}),Z3.hashSignature=n;const t=Tr(),e=ns(),r=i=>(0,e.keccak256)((0,t.toBytes)(i));function n(i){return r(i)}return Z3}var vw={},Y3={},ZM;function dIe(){if(ZM)return Y3;ZM=1,Object.defineProperty(Y3,"__esModule",{value:!0}),Y3.normalizeSignature=e;const t=_t();function e(r){let n=!0,i="",s=0,o="",a=!1;for(let c=0;c{const i=typeof n=="string"?n:(0,t.formatAbiItem)(n);return(0,e.normalizeSignature)(i)};return vw.toSignature=r,vw}var JM;function YA(){if(JM)return K3;JM=1,Object.defineProperty(K3,"__esModule",{value:!0}),K3.toSignatureHash=r;const t=lIe(),e=pO();function r(n){return(0,t.hashSignature)((0,e.toSignature)(n))}return K3}var QM;function v1(){if(QM)return yw;QM=1,Object.defineProperty(yw,"__esModule",{value:!0}),yw.toEventSelector=void 0;const t=YA();return yw.toEventSelector=t.toSignatureHash,yw}var _w={},Ew={},XM;function la(){if(XM)return Ew;XM=1,Object.defineProperty(Ew,"__esModule",{value:!0}),Ew.InvalidAddressError=void 0;const t=_t();class e extends t.BaseError{constructor({address:n}){super(`Address "${n}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}return Ew.InvalidAddressError=e,Ew}var mT={},Cw={},eL;function y2(){if(eL)return Cw;eL=1,Object.defineProperty(Cw,"__esModule",{value:!0}),Cw.LruMap=void 0;class t extends Map{constructor(r){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=r}get(r){const n=super.get(r);return super.has(r)&&n!==void 0&&(this.delete(r),super.set(r,n)),n}set(r,n){if(super.set(r,n),this.maxSize&&this.size>this.maxSize){const i=this.keys().next().value;i&&this.delete(i)}return this}}return Cw.LruMap=t,Cw}var Aw={},tL;function js(){if(tL)return Aw;tL=1,Object.defineProperty(Aw,"__esModule",{value:!0}),Aw.checksumAddress=o,Aw.getAddress=a;const t=la(),e=Tr(),r=ns(),n=y2(),i=is(),s=new n.LruMap(8192);function o(c,u){if(s.has(`${c}.${u}`))return s.get(`${c}.${u}`);const l=u?`${u}${c.toLowerCase()}`:c.substring(2).toLowerCase(),d=(0,r.keccak256)((0,e.stringToBytes)(l),"bytes"),h=(u?l.substring(`${u}0x`.length):l).split("");for(let g=0;g<40;g+=2)d[g>>1]>>4>=8&&h[g]&&(h[g]=h[g].toUpperCase()),(d[g>>1]&15)>=8&&h[g+1]&&(h[g+1]=h[g+1].toUpperCase());const f=`0x${h.join("")}`;return s.set(`${c}.${u}`,f),f}function a(c,u){if(!(0,i.isAddress)(c,{strict:!1}))throw new t.InvalidAddressError({address:c});return o(c,u)}return Aw}var rL;function is(){return rL||(rL=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isAddressCache=void 0,t.isAddress=i;const e=y2(),r=js(),n=/^0x[a-fA-F0-9]{40}$/;t.isAddressCache=new e.LruMap(8192);function i(s,o){const{strict:a=!0}=o??{},c=`${s}.${a}`;if(t.isAddressCache.has(c))return t.isAddressCache.get(c);const u=n.test(s)?s.toLowerCase()===s?!0:a?(0,r.checksumAddress)(s)===s:!0:!1;return t.isAddressCache.set(c,u),u}}(mT)),mT}var v0={},nL;function oi(){if(nL)return v0;nL=1,Object.defineProperty(v0,"__esModule",{value:!0}),v0.concat=t,v0.concatBytes=e,v0.concatHex=r;function t(n){return typeof n[0]=="string"?r(n):e(n)}function e(n){let i=0;for(const a of n)i+=a.length;const s=new Uint8Array(i);let o=0;for(const a of n)s.set(a,o),o+=a.length;return s}function r(n){return`0x${n.reduce((i,s)=>i+s.replace("0x",""),"")}`}return v0}var _0={},iL;function go(){if(iL)return _0;iL=1,Object.defineProperty(_0,"__esModule",{value:!0}),_0.slice=n,_0.sliceBytes=o,_0.sliceHex=a;const t=ZA(),e=ki(),r=rs();function n(c,u,l,{strict:d}={}){return(0,e.isHex)(c,{strict:!1})?a(c,u,l,{strict:d}):o(c,u,l,{strict:d})}function i(c,u){if(typeof u=="number"&&u>0&&u>(0,r.size)(c)-1)throw new t.SliceOffsetOutOfBoundsError({offset:u,position:"start",size:(0,r.size)(c)})}function s(c,u,l){if(typeof u=="number"&&typeof l=="number"&&(0,r.size)(c)!==l-u)throw new t.SliceOffsetOutOfBoundsError({offset:l,position:"end",size:(0,r.size)(c)})}function o(c,u,l,{strict:d}={}){i(c,u);const h=c.slice(u,l);return d&&s(h,u,l),h}function a(c,u,l,{strict:d}={}){i(c,u);const h=`0x${c.replace("0x","").slice((u??0)*2,(l??c.length)*2)}`;return d&&s(h,u,l),h}return _0}var Bc={},sL;function JA(){return sL||(sL=1,Object.defineProperty(Bc,"__esModule",{value:!0}),Bc.integerRegex=Bc.bytesRegex=Bc.arrayRegex=void 0,Bc.arrayRegex=/^(.*)\[([0-9]*)\]$/,Bc.bytesRegex=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Bc.integerRegex=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/),Bc}var oL;function da(){if(oL)return _w;oL=1,Object.defineProperty(_w,"__esModule",{value:!0}),_w.encodeAbiParameters=d,_w.getArrayComponents=y;const t=$r(),e=la(),r=_t(),n=y1(),i=is(),s=oi(),o=Zd(),a=rs(),c=go(),u=ze(),l=JA();function d(_,x){if(_.length!==x.length)throw new t.AbiEncodingLengthMismatchError({expectedLength:_.length,givenLength:x.length});const A=h({params:_,values:x}),T=g(A);return T.length===0?"0x":T}function h({params:_,values:x}){const A=[];for(let T=0;T<_.length;T++)A.push(f({param:_[T],value:x[T]}));return A}function f({param:_,value:x}){const A=y(_.type);if(A){const[T,O]=A;return m(x,{length:T,param:{..._,type:O}})}if(_.type==="tuple")return C(x,{param:_});if(_.type==="address")return p(x);if(_.type==="bool")return v(x);if(_.type.startsWith("uint")||_.type.startsWith("int")){const T=_.type.startsWith("int"),[,,O="256"]=l.integerRegex.exec(_.type)??[];return E(x,{signed:T,size:Number(O)})}if(_.type.startsWith("bytes"))return b(x,{param:_});if(_.type==="string")return w(x);throw new t.InvalidAbiEncodingTypeError(_.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function g(_){let x=0;for(let k=0;k<_.length;k++){const{dynamic:j,encoded:N}=_[k];j?x+=32:x+=(0,a.size)(N)}const A=[],T=[];let O=0;for(let k=0;k<_.length;k++){const{dynamic:j,encoded:N}=_[k];j?(A.push((0,u.numberToHex)(x+O,{size:32})),T.push(N),O+=(0,a.size)(N)):A.push(N)}return(0,s.concat)([...A,...T])}function p(_){if(!(0,i.isAddress)(_))throw new e.InvalidAddressError({address:_});return{dynamic:!1,encoded:(0,o.padHex)(_.toLowerCase())}}function m(_,{length:x,param:A}){const T=x===null;if(!Array.isArray(_))throw new t.InvalidArrayError(_);if(!T&&_.length!==x)throw new t.AbiEncodingArrayLengthMismatchError({expectedLength:x,givenLength:_.length,type:`${A.type}[${x}]`});let O=!1;const k=[];for(let j=0;j<_.length;j++){const N=f({param:A,value:_[j]});N.dynamic&&(O=!0),k.push(N)}if(T||O){const j=g(k);if(T){const N=(0,u.numberToHex)(k.length,{size:32});return{dynamic:!0,encoded:k.length>0?(0,s.concat)([N,j]):N}}if(O)return{dynamic:!0,encoded:j}}return{dynamic:!1,encoded:(0,s.concat)(k.map(({encoded:j})=>j))}}function b(_,{param:x}){const[,A]=x.type.split("bytes"),T=(0,a.size)(_);if(!A){let O=_;return T%32!==0&&(O=(0,o.padHex)(O,{dir:"right",size:Math.ceil((_.length-2)/2/32)*32})),{dynamic:!0,encoded:(0,s.concat)([(0,o.padHex)((0,u.numberToHex)(T,{size:32})),O])}}if(T!==Number.parseInt(A))throw new t.AbiEncodingBytesSizeMismatchError({expectedSize:Number.parseInt(A),value:_});return{dynamic:!1,encoded:(0,o.padHex)(_,{dir:"right"})}}function v(_){if(typeof _!="boolean")throw new r.BaseError(`Invalid boolean value: "${_}" (type: ${typeof _}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:(0,o.padHex)((0,u.boolToHex)(_))}}function E(_,{signed:x,size:A=256}){if(typeof A=="number"){const T=2n**(BigInt(A)-(x?1n:0n))-1n,O=x?-T-1n:0n;if(_>T||_O))}}function y(_){const x=_.match(/^(.*)\[(\d+)?\]$/);return x?[x[2]?Number(x[2]):null,x[1]]:void 0}return _w}var E0={},xw={},aL;function Lp(){if(aL)return xw;aL=1,Object.defineProperty(xw,"__esModule",{value:!0}),xw.toFunctionSelector=void 0;const t=go(),e=YA(),r=n=>(0,t.slice)((0,e.toSignatureHash)(n),0,4);return xw.toFunctionSelector=r,xw}var cL;function rl(){if(cL)return E0;cL=1,Object.defineProperty(E0,"__esModule",{value:!0}),E0.getAbiItem=s,E0.isArgOfType=o,E0.getAmbiguousTypes=a;const t=$r(),e=ki(),r=is(),n=v1(),i=Lp();function s(c){const{abi:u,args:l=[],name:d}=c,h=(0,e.isHex)(d,{strict:!1}),f=u.filter(p=>h?p.type==="function"?(0,i.toFunctionSelector)(p)===d:p.type==="event"?(0,n.toEventSelector)(p)===d:!1:"name"in p&&p.name===d);if(f.length===0)return;if(f.length===1)return f[0];let g;for(const p of f){if(!("inputs"in p))continue;if(!l||l.length===0){if(!p.inputs||p.inputs.length===0)return p;continue}if(!p.inputs||p.inputs.length===0||p.inputs.length!==l.length)continue;if(l.every((b,v)=>{const E="inputs"in p&&p.inputs[v];return E?o(b,E):!1})){if(g&&"inputs"in g&&g.inputs){const b=a(p.inputs,g.inputs,l);if(b)throw new t.AbiItemAmbiguityError({abiItem:p,type:b[0]},{abiItem:g,type:b[1]})}g=p}}return g||f[0]}function o(c,u){const l=typeof c,d=u.type;switch(d){case"address":return(0,r.isAddress)(c,{strict:!1});case"bool":return l==="boolean";case"function":return l==="string";case"string":return l==="string";default:return d==="tuple"&&"components"in u?Object.values(u.components).every((h,f)=>o(Object.values(c)[f],h)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(d)?l==="number"||l==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(d)?l==="string"||c instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(d)?Array.isArray(c)&&c.every(h=>o(h,{...u,type:d.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function a(c,u,l){for(const d in c){const h=c[d],f=u[d];if(h.type==="tuple"&&f.type==="tuple"&&"components"in h&&"components"in f)return a(h.components,f.components,l[d]);const g=[h.type,f.type];if(g.includes("address")&&g.includes("bytes20")?!0:g.includes("address")&&g.includes("string")?(0,r.isAddress)(l[d],{strict:!1}):g.includes("address")&&g.includes("bytes")?(0,r.isAddress)(l[d],{strict:!1}):!1)return g}}return E0}var uL;function Up(){if(uL)return q3;uL=1,Object.defineProperty(q3,"__esModule",{value:!0}),q3.encodeEventTopics=u;const t=$r(),e=OQ(),r=Tr(),n=ns(),i=v1(),s=da(),o=el(),a=rl(),c="/docs/contract/encodeEventTopics";function u(d){var E;const{abi:h,eventName:f,args:g}=d;let p=h[0];if(f){const w=(0,a.getAbiItem)({abi:h,name:f});if(!w)throw new t.AbiEventNotFoundError(f,{docsPath:c});p=w}if(p.type!=="event")throw new t.AbiEventNotFoundError(void 0,{docsPath:c});const m=(0,o.formatAbiItem)(p),b=(0,i.toEventSelector)(m);let v=[];if(g&&"inputs"in p){const w=(E=p.inputs)==null?void 0:E.filter(y=>"indexed"in y&&y.indexed),C=Array.isArray(g)?g:Object.values(g).length>0?(w==null?void 0:w.map(y=>g[y.name]))??[]:[];C.length>0&&(v=(w==null?void 0:w.map((y,_)=>Array.isArray(C[_])?C[_].map((x,A)=>l({param:y,value:C[_][A]})):typeof C[_]<"u"&&C[_]!==null?l({param:y,value:C[_]}):null))??[])}return[b,...v]}function l({param:d,value:h}){if(d.type==="string"||d.type==="bytes")return(0,n.keccak256)((0,r.toBytes)(h));if(d.type==="tuple"||d.type.match(/^(.*)\[(\d+)?\]$/))throw new e.FilterTypeNotSupportedError(d.type);return(0,s.encodeAbiParameters)([d],[h])}return q3}var J3={},lL;function QA(){if(lL)return J3;lL=1,Object.defineProperty(J3,"__esModule",{value:!0}),J3.createFilterRequestScope=t;function t(e,{method:r}){var i,s;const n={};return e.transport.type==="fallback"&&((s=(i=e.transport).onResponse)==null||s.call(i,({method:o,response:a,status:c,transport:u})=>{c==="success"&&r===o&&(n[a]=u.request)})),o=>n[o]||e.request}return J3}var dL;function gO(){if(dL)return H3;dL=1,Object.defineProperty(H3,"__esModule",{value:!0}),H3.createContractEventFilter=n;const t=Up(),e=ze(),r=QA();async function n(i,s){const{address:o,abi:a,args:c,eventName:u,fromBlock:l,strict:d,toBlock:h}=s,f=(0,r.createFilterRequestScope)(i,{method:"eth_newFilter"}),g=u?(0,t.encodeEventTopics)({abi:a,args:c,eventName:u}):void 0,p=await i.request({method:"eth_newFilter",params:[{address:o,fromBlock:typeof l=="bigint"?(0,e.numberToHex)(l):l,toBlock:typeof h=="bigint"?(0,e.numberToHex)(h):h,topics:g}]});return{abi:a,args:c,eventName:u,id:p,request:f(p),strict:!!d,type:"event"}}return H3}var Q3={},X3={},hL;function sn(){if(hL)return X3;hL=1,Object.defineProperty(X3,"__esModule",{value:!0}),X3.parseAccount=t;function t(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}return X3}var e_={},t_={},fL;function kQ(){if(fL)return t_;fL=1,Object.defineProperty(t_,"__esModule",{value:!0}),t_.prepareEncodeFunctionData=s;const t=$r(),e=Lp(),r=el(),n=rl(),i="/docs/contract/encodeFunctionData";function s(o){const{abi:a,args:c,functionName:u}=o;let l=a[0];if(u){const d=(0,n.getAbiItem)({abi:a,args:c,name:u});if(!d)throw new t.AbiFunctionNotFoundError(u,{docsPath:i});l=d}if(l.type!=="function")throw new t.AbiFunctionNotFoundError(void 0,{docsPath:i});return{abi:[l],functionName:(0,e.toFunctionSelector)((0,r.formatAbiItem)(l))}}return t_}var pL;function Bs(){if(pL)return e_;pL=1,Object.defineProperty(e_,"__esModule",{value:!0}),e_.encodeFunctionData=n;const t=oi(),e=da(),r=kQ();function n(i){const{args:s}=i,{abi:o,functionName:a}=(()=>{var d;return i.abi.length===1&&((d=i.functionName)!=null&&d.startsWith("0x"))?i:(0,r.prepareEncodeFunctionData)(i)})(),c=o[0],u=a,l="inputs"in c&&c.inputs?(0,e.encodeAbiParameters)(c.inputs,s??[]):void 0;return(0,t.concatHex)([u,l??"0x"])}return e_}var r_={},ui={},Dc={},gL;function XA(){return gL||(gL=1,Object.defineProperty(Dc,"__esModule",{value:!0}),Dc.solidityPanic=Dc.solidityError=Dc.panicReasons=void 0,Dc.panicReasons={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},Dc.solidityError={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},Dc.solidityPanic={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"}),Dc}var n_={},i_={},s_={},Mc={},mL;function NQ(){if(mL)return Mc;mL=1,Object.defineProperty(Mc,"__esModule",{value:!0}),Mc.RecursiveReadLimitExceededError=Mc.PositionOutOfBoundsError=Mc.NegativeOffsetError=void 0;const t=_t();class e extends t.BaseError{constructor({offset:s}){super(`Offset \`${s}\` cannot be negative.`,{name:"NegativeOffsetError"})}}Mc.NegativeOffsetError=e;class r extends t.BaseError{constructor({length:s,position:o}){super(`Position \`${o}\` is out of bounds (\`0 < position < ${s}\`).`,{name:"PositionOutOfBoundsError"})}}Mc.PositionOutOfBoundsError=r;class n extends t.BaseError{constructor({count:s,limit:o}){super(`Recursive read limit of \`${o}\` exceeded (recursive read count: \`${s}\`).`,{name:"RecursiveReadLimitExceededError"})}}return Mc.RecursiveReadLimitExceededError=n,Mc}var wL;function v2(){if(wL)return s_;wL=1,Object.defineProperty(s_,"__esModule",{value:!0}),s_.createCursor=r;const t=NQ(),e={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new t.RecursiveReadLimitExceededError({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(n){if(n<0||n>this.bytes.length-1)throw new t.PositionOutOfBoundsError({length:this.bytes.length,position:n})},decrementPosition(n){if(n<0)throw new t.NegativeOffsetError({offset:n});const i=this.position-n;this.assertPosition(i),this.position=i},getReadCount(n){return this.positionReadCount.get(n||this.position)||0},incrementPosition(n){if(n<0)throw new t.NegativeOffsetError({offset:n});const i=this.position+n;this.assertPosition(i),this.position=i},inspectByte(n){const i=n??this.position;return this.assertPosition(i),this.bytes[i]},inspectBytes(n,i){const s=i??this.position;return this.assertPosition(s+n-1),this.bytes.subarray(s,s+n)},inspectUint8(n){const i=n??this.position;return this.assertPosition(i),this.bytes[i]},inspectUint16(n){const i=n??this.position;return this.assertPosition(i+1),this.dataView.getUint16(i)},inspectUint24(n){const i=n??this.position;return this.assertPosition(i+2),(this.dataView.getUint16(i)<<8)+this.dataView.getUint8(i+2)},inspectUint32(n){const i=n??this.position;return this.assertPosition(i+3),this.dataView.getUint32(i)},pushByte(n){this.assertPosition(this.position),this.bytes[this.position]=n,this.position++},pushBytes(n){this.assertPosition(this.position+n.length-1),this.bytes.set(n,this.position),this.position+=n.length},pushUint8(n){this.assertPosition(this.position),this.bytes[this.position]=n,this.position++},pushUint16(n){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,n),this.position+=2},pushUint24(n){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,n>>8),this.dataView.setUint8(this.position+2,n&255),this.position+=3},pushUint32(n){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,n),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const n=this.inspectByte();return this.position++,n},readBytes(n,i){this.assertReadLimit(),this._touch();const s=this.inspectBytes(n);return this.position+=i??n,s},readUint8(){this.assertReadLimit(),this._touch();const n=this.inspectUint8();return this.position+=1,n},readUint16(){this.assertReadLimit(),this._touch();const n=this.inspectUint16();return this.position+=2,n},readUint24(){this.assertReadLimit(),this._touch();const n=this.inspectUint24();return this.position+=3,n},readUint32(){this.assertReadLimit(),this._touch();const n=this.inspectUint32();return this.position+=4,n},get remaining(){return this.bytes.length-this.position},setPosition(n){const i=this.position;return this.assertPosition(n),this.position=n,()=>this.position=i},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const n=this.getReadCount();this.positionReadCount.set(this.position,n+1),n>0&&this.recursiveReadCount++}};function r(n,{recursiveReadLimit:i=8192}={}){const s=Object.create(e);return s.bytes=n,s.dataView=new DataView(n.buffer,n.byteOffset,n.byteLength),s.positionReadCount=new Map,s.recursiveReadLimit=i,s}return s_}var Tl={},bL;function mO(){if(bL)return Tl;bL=1,Object.defineProperty(Tl,"__esModule",{value:!0}),Tl.fromBytes=i,Tl.bytesToBigInt=s,Tl.bytesToBool=o,Tl.bytesToNumber=a,Tl.bytesToString=c;const t=y1(),e=tl(),r=nn(),n=ze();function i(u,l){const d=typeof l=="string"?{to:l}:l,h=d.to;return h==="number"?a(u,d):h==="bigint"?s(u,d):h==="boolean"?o(u,d):h==="string"?c(u,d):(0,n.bytesToHex)(u,d)}function s(u,l={}){typeof l.size<"u"&&(0,r.assertSize)(u,{size:l.size});const d=(0,n.bytesToHex)(u,l);return(0,r.hexToBigInt)(d,l)}function o(u,l={}){let d=u;if(typeof l.size<"u"&&((0,r.assertSize)(d,{size:l.size}),d=(0,e.trim)(d)),d.length>1||d[0]>1)throw new t.InvalidBytesBooleanError(d);return!!d[0]}function a(u,l={}){typeof l.size<"u"&&(0,r.assertSize)(u,{size:l.size});const d=(0,n.bytesToHex)(u,l);return(0,r.hexToNumber)(d,l)}function c(u,l={}){let d=u;return typeof l.size<"u"&&((0,r.assertSize)(d,{size:l.size}),d=(0,e.trim)(d,{dir:"right"})),new TextDecoder().decode(d)}return Tl}var yL;function Jd(){if(yL)return i_;yL=1,Object.defineProperty(i_,"__esModule",{value:!0}),i_.decodeAbiParameters=l;const t=$r(),e=js(),r=v2(),n=rs(),i=go(),s=tl(),o=mO(),a=Tr(),c=ze(),u=da();function l(y,_){const x=typeof _=="string"?(0,a.hexToBytes)(_):_,A=(0,r.createCursor)(x);if((0,n.size)(x)===0&&y.length>0)throw new t.AbiDecodingZeroDataError;if((0,n.size)(_)&&(0,n.size)(_)<32)throw new t.AbiDecodingDataSizeTooSmallError({data:typeof _=="string"?_:(0,c.bytesToHex)(_),params:y,size:(0,n.size)(_)});let T=0;const O=[];for(let k=0;k48?(0,o.bytesToBigInt)(T,{signed:x}):(0,o.bytesToNumber)(T,{signed:x}),32]}function E(y,_,{staticPosition:x}){const A=_.components.length===0||_.components.some(({name:k})=>!k),T=A?[]:{};let O=0;if(C(_)){const k=(0,o.bytesToNumber)(y.readBytes(f)),j=x+k;for(let N=0;N<_.components.length;++N){const S=_.components[N];y.setPosition(j+O);const[P,I]=d(y,S,{staticPosition:j});O+=I,T[A?N:S==null?void 0:S.name]=P}return y.setPosition(x+32),[T,32]}for(let k=0;k<_.components.length;++k){const j=_.components[k],[N,S]=d(y,j,{staticPosition:x});T[A?k:j==null?void 0:j.name]=N,O+=S}return[T,O]}function w(y,{staticPosition:_}){const x=(0,o.bytesToNumber)(y.readBytes(32)),A=_+x;y.setPosition(A);const T=(0,o.bytesToNumber)(y.readBytes(32));if(T===0)return y.setPosition(_+32),["",32];const O=y.readBytes(T,32),k=(0,o.bytesToString)((0,s.trim)(O));return y.setPosition(_+32),[k,32]}function C(y){var A;const{type:_}=y;if(_==="string"||_==="bytes"||_.endsWith("[]"))return!0;if(_==="tuple")return(A=y.components)==null?void 0:A.some(C);const x=(0,u.getArrayComponents)(y.type);return!!(x&&C({...y,type:x[1]}))}return i_}var vL;function ex(){if(vL)return n_;vL=1,Object.defineProperty(n_,"__esModule",{value:!0}),n_.decodeErrorResult=o;const t=XA(),e=$r(),r=go(),n=Lp(),i=Jd(),s=el();function o(a){const{abi:c,data:u}=a,l=(0,r.slice)(u,0,4);if(l==="0x")throw new e.AbiDecodingZeroDataError;const h=[...c||[],t.solidityError,t.solidityPanic].find(f=>f.type==="error"&&l===(0,n.toFunctionSelector)((0,s.formatAbiItem)(f)));if(!h)throw new e.AbiErrorSignatureNotFoundError(l,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:h,args:"inputs"in h&&h.inputs&&h.inputs.length>0?(0,i.decodeAbiParameters)(h.inputs,(0,r.slice)(u,4)):void 0,errorName:h.name}}return n_}var o_={},Sw={},_L;function Gn(){if(_L)return Sw;_L=1,Object.defineProperty(Sw,"__esModule",{value:!0}),Sw.stringify=void 0;const t=(e,r,n)=>JSON.stringify(e,(i,s)=>{const o=typeof s=="bigint"?s.toString():s;return typeof r=="function"?r(i,o):o},n);return Sw.stringify=t,Sw}var EL;function $Q(){if(EL)return o_;EL=1,Object.defineProperty(o_,"__esModule",{value:!0}),o_.formatAbiItemWithArgs=e;const t=Gn();function e({abiItem:r,args:n,includeFunctionName:i=!0,includeName:s=!1}){if("name"in r&&"inputs"in r&&r.inputs)return`${i?r.name:""}(${r.inputs.map((o,a)=>`${s&&o.name?`${o.name}: `:""}${typeof n[a]=="object"?(0,t.stringify)(n[a]):n[a]}`).join(", ")})`}return o_}var a_={},Lc={},CL;function _2(){return CL||(CL=1,Object.defineProperty(Lc,"__esModule",{value:!0}),Lc.weiUnits=Lc.gweiUnits=Lc.etherUnits=void 0,Lc.etherUnits={gwei:9,wei:18},Lc.gweiUnits={ether:-9,wei:9},Lc.weiUnits={ether:-18,gwei:-9}),Lc}var c_={},AL;function tx(){if(AL)return c_;AL=1,Object.defineProperty(c_,"__esModule",{value:!0}),c_.formatUnits=t;function t(e,r){let n=e.toString();const i=n.startsWith("-");i&&(n=n.slice(1)),n=n.padStart(r,"0");let[s,o]=[n.slice(0,n.length-r),n.slice(n.length-r)];return o=o.replace(/(0+)$/,""),`${i?"-":""}${s||"0"}${o?`.${o}`:""}`}return c_}var xL;function E2(){if(xL)return a_;xL=1,Object.defineProperty(a_,"__esModule",{value:!0}),a_.formatEther=r;const t=_2(),e=tx();function r(n,i="wei"){return(0,e.formatUnits)(n,t.etherUnits[i])}return a_}var u_={},SL;function Fp(){if(SL)return u_;SL=1,Object.defineProperty(u_,"__esModule",{value:!0}),u_.formatGwei=r;const t=_2(),e=tx();function r(n,i="wei"){return(0,e.formatUnits)(n,t.gweiUnits[i])}return u_}var Uc={},TL;function wO(){if(TL)return Uc;TL=1,Object.defineProperty(Uc,"__esModule",{value:!0}),Uc.StateAssignmentConflictError=Uc.AccountStateConflictError=void 0,Uc.prettyStateMapping=n,Uc.prettyStateOverride=i;const t=_t();class e extends t.BaseError{constructor({address:o}){super(`State for account "${o}" is set multiple times.`,{name:"AccountStateConflictError"})}}Uc.AccountStateConflictError=e;class r extends t.BaseError{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}Uc.StateAssignmentConflictError=r;function n(s){return s.reduce((o,{slot:a,value:c})=>`${o} ${a}: ${c} `,"")}function i(s){return s.reduce((o,{address:a,...c})=>{let u=`${o} ${a}: `;return c.nonce&&(u+=` nonce: ${c.nonce} `),c.balance&&(u+=` balance: ${c.balance} `),c.code&&(u+=` code: ${c.code} `),c.state&&(u+=` state: `,u+=n(c.state)),c.stateDiff&&(u+=` stateDiff: `,u+=n(c.stateDiff)),u},` State Override: `).slice(0,-1)}return Uc}var Nr={},IL;function Ds(){if(IL)return Nr;IL=1,Object.defineProperty(Nr,"__esModule",{value:!0}),Nr.WaitForTransactionReceiptTimeoutError=Nr.TransactionReceiptNotFoundError=Nr.TransactionNotFoundError=Nr.TransactionExecutionError=Nr.InvalidStorageKeySizeError=Nr.InvalidSerializedTransactionError=Nr.InvalidSerializedTransactionTypeError=Nr.InvalidSerializableTransactionError=Nr.InvalidLegacyVError=Nr.FeeConflictError=void 0,Nr.prettyPrint=n;const t=E2(),e=Fp(),r=_t();function n(g){const p=Object.entries(g).map(([b,v])=>v===void 0||v===!1?null:[b,v]).filter(Boolean),m=p.reduce((b,[v])=>Math.max(b,v.length),0);return p.map(([b,v])=>` ${`${b}:`.padEnd(m+1)} ${v}`).join(` `)}class i extends r.BaseError{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(` `),{name:"FeeConflictError"})}}Nr.FeeConflictError=i;class s extends r.BaseError{constructor({v:p}){super(`Invalid \`v\` value "${p}". Expected 27 or 28.`,{name:"InvalidLegacyVError"})}}Nr.InvalidLegacyVError=s;class o extends r.BaseError{constructor({transaction:p}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",n(p),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}Nr.InvalidSerializableTransactionError=o;class a extends r.BaseError{constructor({serializedType:p}){super(`Serialized transaction type "${p}" is invalid.`,{name:"InvalidSerializedTransactionType"}),Object.defineProperty(this,"serializedType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.serializedType=p}}Nr.InvalidSerializedTransactionTypeError=a;class c extends r.BaseError{constructor({attributes:p,serializedTransaction:m,type:b}){const v=Object.entries(p).map(([E,w])=>typeof w>"u"?E:void 0).filter(Boolean);super(`Invalid serialized transaction of type "${b}" was provided.`,{metaMessages:[`Serialized Transaction: "${m}"`,v.length>0?`Missing Attributes: ${v.join(", ")}`:""].filter(Boolean),name:"InvalidSerializedTransactionError"}),Object.defineProperty(this,"serializedTransaction",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.serializedTransaction=m,this.type=b}}Nr.InvalidSerializedTransactionError=c;class u extends r.BaseError{constructor({storageKey:p}){super(`Size for storage key "${p}" is invalid. Expected 32 bytes. Got ${Math.floor((p.length-2)/2)} bytes.`,{name:"InvalidStorageKeySizeError"})}}Nr.InvalidStorageKeySizeError=u;class l extends r.BaseError{constructor(p,{account:m,docsPath:b,chain:v,data:E,gas:w,gasPrice:C,maxFeePerGas:y,maxPriorityFeePerGas:_,nonce:x,to:A,value:T}){var k;const O=n({chain:v&&`${v==null?void 0:v.name} (id: ${v==null?void 0:v.id})`,from:m==null?void 0:m.address,to:A,value:typeof T<"u"&&`${(0,t.formatEther)(T)} ${((k=v==null?void 0:v.nativeCurrency)==null?void 0:k.symbol)||"ETH"}`,data:E,gas:w,gasPrice:typeof C<"u"&&`${(0,e.formatGwei)(C)} gwei`,maxFeePerGas:typeof y<"u"&&`${(0,e.formatGwei)(y)} gwei`,maxPriorityFeePerGas:typeof _<"u"&&`${(0,e.formatGwei)(_)} gwei`,nonce:x});super(p.shortMessage,{cause:p,docsPath:b,metaMessages:[...p.metaMessages?[...p.metaMessages," "]:[],"Request Arguments:",O].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=p}}Nr.TransactionExecutionError=l;class d extends r.BaseError{constructor({blockHash:p,blockNumber:m,blockTag:b,hash:v,index:E}){let w="Transaction";b&&E!==void 0&&(w=`Transaction at block time "${b}" at index "${E}"`),p&&E!==void 0&&(w=`Transaction at block hash "${p}" at index "${E}"`),m&&E!==void 0&&(w=`Transaction at block number "${m}" at index "${E}"`),v&&(w=`Transaction with hash "${v}"`),super(`${w} could not be found.`,{name:"TransactionNotFoundError"})}}Nr.TransactionNotFoundError=d;class h extends r.BaseError{constructor({hash:p}){super(`Transaction receipt with hash "${p}" could not be found. The Transaction may not be processed on a block yet.`,{name:"TransactionReceiptNotFoundError"})}}Nr.TransactionReceiptNotFoundError=h;class f extends r.BaseError{constructor({hash:p}){super(`Timed out while waiting for transaction with hash "${p}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}return Nr.WaitForTransactionReceiptTimeoutError=f,Nr}var Eh={},PL;function bO(){if(PL)return Eh;PL=1,Object.defineProperty(Eh,"__esModule",{value:!0}),Eh.getUrl=Eh.getContractAddress=void 0;const t=r=>r;Eh.getContractAddress=t;const e=r=>r;return Eh.getUrl=e,Eh}var OL;function Qd(){if(OL)return ui;OL=1,Object.defineProperty(ui,"__esModule",{value:!0}),ui.RawContractError=ui.CounterfactualDeploymentFailedError=ui.ContractFunctionZeroDataError=ui.ContractFunctionRevertedError=ui.ContractFunctionExecutionError=ui.CallExecutionError=void 0;const t=sn(),e=XA(),r=ex(),n=el(),i=$Q(),s=rl(),o=E2(),a=Fp(),c=$r(),u=_t(),l=wO(),d=Ds(),h=bO();class f extends u.BaseError{constructor(w,{account:C,docsPath:y,chain:_,data:x,gas:A,gasPrice:T,maxFeePerGas:O,maxPriorityFeePerGas:k,nonce:j,to:N,value:S,stateOverride:P}){var $;const I=C?(0,t.parseAccount)(C):void 0;let B=(0,d.prettyPrint)({from:I==null?void 0:I.address,to:N,value:typeof S<"u"&&`${(0,o.formatEther)(S)} ${(($=_==null?void 0:_.nativeCurrency)==null?void 0:$.symbol)||"ETH"}`,data:x,gas:A,gasPrice:typeof T<"u"&&`${(0,a.formatGwei)(T)} gwei`,maxFeePerGas:typeof O<"u"&&`${(0,a.formatGwei)(O)} gwei`,maxPriorityFeePerGas:typeof k<"u"&&`${(0,a.formatGwei)(k)} gwei`,nonce:j});P&&(B+=` ${(0,l.prettyStateOverride)(P)}`),super(w.shortMessage,{cause:w,docsPath:y,metaMessages:[...w.metaMessages?[...w.metaMessages," "]:[],"Raw Call Arguments:",B].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=w}}ui.CallExecutionError=f;class g extends u.BaseError{constructor(w,{abi:C,args:y,contractAddress:_,docsPath:x,functionName:A,sender:T}){const O=(0,s.getAbiItem)({abi:C,args:y,name:A}),k=O?(0,i.formatAbiItemWithArgs)({abiItem:O,args:y,includeFunctionName:!1,includeName:!1}):void 0,j=O?(0,n.formatAbiItem)(O,{includeName:!0}):void 0,N=(0,d.prettyPrint)({address:_&&(0,h.getContractAddress)(_),function:j,args:k&&k!=="()"&&`${[...Array((A==null?void 0:A.length)??0).keys()].map(()=>" ").join("")}${k}`,sender:T});super(w.shortMessage||`An unknown error occurred while executing the contract function "${A}".`,{cause:w,docsPath:x,metaMessages:[...w.metaMessages?[...w.metaMessages," "]:[],N&&"Contract Call:",N].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=C,this.args=y,this.cause=w,this.contractAddress=_,this.functionName=A,this.sender=T}}ui.ContractFunctionExecutionError=g;class p extends u.BaseError{constructor({abi:w,data:C,functionName:y,message:_}){let x,A,T,O;if(C&&C!=="0x")try{A=(0,r.decodeErrorResult)({abi:w,data:C});const{abiItem:j,errorName:N,args:S}=A;if(N==="Error")O=S[0];else if(N==="Panic"){const[P]=S;O=e.panicReasons[P]}else{const P=j?(0,n.formatAbiItem)(j,{includeName:!0}):void 0,I=j&&S?(0,i.formatAbiItemWithArgs)({abiItem:j,args:S,includeFunctionName:!1,includeName:!1}):void 0;T=[P?`Error: ${P}`:"",I&&I!=="()"?` ${[...Array((N==null?void 0:N.length)??0).keys()].map(()=>" ").join("")}${I}`:""]}}catch(j){x=j}else _&&(O=_);let k;x instanceof c.AbiErrorSignatureNotFoundError&&(k=x.signature,T=[`Unable to decode signature "${k}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${k}.`]),super(O&&O!=="execution reverted"||k?[`The contract function "${y}" reverted with the following ${k?"signature":"reason"}:`,O||k].join(` `):`The contract function "${y}" reverted.`,{cause:x,metaMessages:T,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=A,this.raw=C,this.reason=O,this.signature=k}}ui.ContractFunctionRevertedError=p;class m extends u.BaseError{constructor({functionName:w}){super(`The contract function "${w}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${w}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}ui.ContractFunctionZeroDataError=m;class b extends u.BaseError{constructor({factory:w}){super(`Deployment for counterfactual contract call failed${w?` for factory "${w}".`:""}`,{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."],name:"CounterfactualDeploymentFailedError"})}}ui.CounterfactualDeploymentFailedError=b;class v extends u.BaseError{constructor({data:w,message:C}){super(C||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=w}}return ui.RawContractError=v,ui}var cs={},RL;function ha(){if(RL)return cs;RL=1,Object.defineProperty(cs,"__esModule",{value:!0}),cs.TimeoutError=cs.SocketClosedError=cs.RpcRequestError=cs.WebSocketRequestError=cs.HttpRequestError=void 0;const t=Gn(),e=_t(),r=bO();class n extends e.BaseError{constructor({body:u,cause:l,details:d,headers:h,status:f,url:g}){super("HTTP request failed.",{cause:l,details:d,metaMessages:[f&&`Status: ${f}`,`URL: ${(0,r.getUrl)(g)}`,u&&`Request body: ${(0,t.stringify)(u)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=u,this.headers=h,this.status=f,this.url=g}}cs.HttpRequestError=n;class i extends e.BaseError{constructor({body:u,cause:l,details:d,url:h}){super("WebSocket request failed.",{cause:l,details:d,metaMessages:[`URL: ${(0,r.getUrl)(h)}`,u&&`Request body: ${(0,t.stringify)(u)}`].filter(Boolean),name:"WebSocketRequestError"})}}cs.WebSocketRequestError=i;class s extends e.BaseError{constructor({body:u,error:l,url:d}){super("RPC Request failed.",{cause:l,details:l.message,metaMessages:[`URL: ${(0,r.getUrl)(d)}`,`Request body: ${(0,t.stringify)(u)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=l.code,this.data=l.data}}cs.RpcRequestError=s;class o extends e.BaseError{constructor({url:u}={}){super("The socket has been closed.",{metaMessages:[u&&`URL: ${(0,r.getUrl)(u)}`].filter(Boolean),name:"SocketClosedError"})}}cs.SocketClosedError=o;class a extends e.BaseError{constructor({body:u,url:l}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${(0,r.getUrl)(l)}`,`Request body: ${(0,t.stringify)(u)}`],name:"TimeoutError"})}}return cs.TimeoutError=a,cs}var tt={},kL;function Xd(){if(kL)return tt;kL=1,Object.defineProperty(tt,"__esModule",{value:!0}),tt.UnknownRpcError=tt.AtomicityNotSupportedError=tt.AtomicReadyWalletRejectedUpgradeError=tt.BundleTooLargeError=tt.UnknownBundleIdError=tt.DuplicateIdError=tt.UnsupportedChainIdError=tt.UnsupportedNonOptionalCapabilityError=tt.SwitchChainError=tt.ChainDisconnectedError=tt.ProviderDisconnectedError=tt.UnsupportedProviderMethodError=tt.UnauthorizedProviderError=tt.UserRejectedRequestError=tt.JsonRpcVersionUnsupportedError=tt.LimitExceededRpcError=tt.MethodNotSupportedRpcError=tt.TransactionRejectedRpcError=tt.ResourceUnavailableRpcError=tt.ResourceNotFoundRpcError=tt.InvalidInputRpcError=tt.InternalRpcError=tt.InvalidParamsRpcError=tt.MethodNotFoundRpcError=tt.InvalidRequestRpcError=tt.ParseRpcError=tt.ProviderRpcError=tt.RpcError=void 0;const t=_t(),e=ha(),r=-1;class n extends t.BaseError{constructor(P,{code:I,docsPath:B,metaMessages:$,name:R,shortMessage:D}){super(D,{cause:P,docsPath:B,metaMessages:$||(P==null?void 0:P.metaMessages),name:R||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=R||P.name,this.code=P instanceof e.RpcRequestError?P.code:I??r}}tt.RpcError=n;class i extends n{constructor(P,I){super(P,I),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=I.data}}tt.ProviderRpcError=i;class s extends n{constructor(P){super(P,{code:s.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}tt.ParseRpcError=s,Object.defineProperty(s,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class o extends n{constructor(P){super(P,{code:o.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}tt.InvalidRequestRpcError=o,Object.defineProperty(o,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class a extends n{constructor(P,{method:I}={}){super(P,{code:a.code,name:"MethodNotFoundRpcError",shortMessage:`The method${I?` "${I}"`:""} does not exist / is not available.`})}}tt.MethodNotFoundRpcError=a,Object.defineProperty(a,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class c extends n{constructor(P){super(P,{code:c.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(` `)})}}tt.InvalidParamsRpcError=c,Object.defineProperty(c,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class u extends n{constructor(P){super(P,{code:u.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}tt.InternalRpcError=u,Object.defineProperty(u,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class l extends n{constructor(P){super(P,{code:l.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(` `)})}}tt.InvalidInputRpcError=l,Object.defineProperty(l,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class d extends n{constructor(P){super(P,{code:d.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}tt.ResourceNotFoundRpcError=d,Object.defineProperty(d,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class h extends n{constructor(P){super(P,{code:h.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}tt.ResourceUnavailableRpcError=h,Object.defineProperty(h,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class f extends n{constructor(P){super(P,{code:f.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}tt.TransactionRejectedRpcError=f,Object.defineProperty(f,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class g extends n{constructor(P,{method:I}={}){super(P,{code:g.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${I?` "${I}"`:""} is not supported.`})}}tt.MethodNotSupportedRpcError=g,Object.defineProperty(g,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class p extends n{constructor(P){super(P,{code:p.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}tt.LimitExceededRpcError=p,Object.defineProperty(p,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class m extends n{constructor(P){super(P,{code:m.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}tt.JsonRpcVersionUnsupportedError=m,Object.defineProperty(m,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class b extends i{constructor(P){super(P,{code:b.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}tt.UserRejectedRequestError=b,Object.defineProperty(b,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class v extends i{constructor(P){super(P,{code:v.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}tt.UnauthorizedProviderError=v,Object.defineProperty(v,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class E extends i{constructor(P,{method:I}={}){super(P,{code:E.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${I?` " ${I}"`:""}.`})}}tt.UnsupportedProviderMethodError=E,Object.defineProperty(E,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class w extends i{constructor(P){super(P,{code:w.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}tt.ProviderDisconnectedError=w,Object.defineProperty(w,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class C extends i{constructor(P){super(P,{code:C.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}tt.ChainDisconnectedError=C,Object.defineProperty(C,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class y extends i{constructor(P){super(P,{code:y.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}tt.SwitchChainError=y,Object.defineProperty(y,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class _ extends i{constructor(P){super(P,{code:_.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}tt.UnsupportedNonOptionalCapabilityError=_,Object.defineProperty(_,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class x extends i{constructor(P){super(P,{code:x.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}tt.UnsupportedChainIdError=x,Object.defineProperty(x,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class A extends i{constructor(P){super(P,{code:A.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}tt.DuplicateIdError=A,Object.defineProperty(A,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class T extends i{constructor(P){super(P,{code:T.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}tt.UnknownBundleIdError=T,Object.defineProperty(T,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class O extends i{constructor(P){super(P,{code:O.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}tt.BundleTooLargeError=O,Object.defineProperty(O,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class k extends i{constructor(P){super(P,{code:k.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}tt.AtomicReadyWalletRejectedUpgradeError=k,Object.defineProperty(k,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class j extends i{constructor(P){super(P,{code:j.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}tt.AtomicityNotSupportedError=j,Object.defineProperty(j,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class N extends n{constructor(P){super(P,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}return tt.UnknownRpcError=N,tt}var NL;function eh(){if(NL)return r_;NL=1,Object.defineProperty(r_,"__esModule",{value:!0}),r_.getContractError=o;const t=$r(),e=_t(),r=Qd(),n=ha(),i=Xd(),s=3;function o(a,{abi:c,address:u,args:l,docsPath:d,functionName:h,sender:f}){const g=a instanceof r.RawContractError?a:a instanceof e.BaseError?a.walk(C=>"data"in C)||a.walk():{},{code:p,data:m,details:b,message:v,shortMessage:E}=g,w=a instanceof t.AbiDecodingZeroDataError?new r.ContractFunctionZeroDataError({functionName:h}):[s,i.InternalRpcError.code].includes(p)&&(m||b||v||E)?new r.ContractFunctionRevertedError({abi:c,data:typeof m=="object"?m.data:m,functionName:h,message:g instanceof n.RpcRequestError?b:E??v}):a;return new r.ContractFunctionExecutionError(w,{abi:c,args:l,contractAddress:u,docsPath:d,functionName:h,sender:f})}return r_}var l_={},d_={},h_={},f_={},$L;function jQ(){if($L)return f_;$L=1,Object.defineProperty(f_,"__esModule",{value:!0}),f_.publicKeyToAddress=r;const t=js(),e=ns();function r(n){const i=(0,e.keccak256)(`0x${n.substring(4)}`).substring(26);return(0,t.checksumAddress)(`0x${i}`)}return f_}var p_={},wT={},br={},Zn={},jL;function BQ(){if(jL)return Zn;jL=1,Object.defineProperty(Zn,"__esModule",{value:!0}),Zn.SHA512_IV=Zn.SHA384_IV=Zn.SHA224_IV=Zn.SHA256_IV=Zn.HashMD=void 0,Zn.setBigUint64=e,Zn.Chi=r,Zn.Maj=n;const t=Yd();function e(s,o,a,c){if(typeof s.setBigUint64=="function")return s.setBigUint64(o,a,c);const u=BigInt(32),l=BigInt(4294967295),d=Number(a>>u&l),h=Number(a&l),f=c?4:0,g=c?0:4;s.setUint32(o+f,d,c),s.setUint32(o+g,h,c)}function r(s,o,a){return s&o^~s&a}function n(s,o,a){return s&o^s&a^o&a}class i extends t.Hash{constructor(o,a,c,u){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=o,this.outputLen=a,this.padOffset=c,this.isLE=u,this.buffer=new Uint8Array(o),this.view=(0,t.createView)(this.buffer)}update(o){(0,t.aexists)(this),o=(0,t.toBytes)(o),(0,t.abytes)(o);const{view:a,buffer:c,blockLen:u}=this,l=o.length;for(let d=0;du-d&&(this.process(c,0),d=0);for(let m=d;mp.length)throw new Error("_sha2: outputLen bigger than state");for(let m=0;m>>3,I=(0,r.rotr)(S,17)^(0,r.rotr)(S,19)^S>>>10;i[j]=I+i[j-7]+P+i[j-16]|0}let{A:C,B:y,C:_,D:x,E:A,F:T,G:O,H:k}=this;for(let j=0;j<64;j++){const N=(0,r.rotr)(A,6)^(0,r.rotr)(A,11)^(0,r.rotr)(A,25),S=k+N+(0,t.Chi)(A,T,O)+n[j]+i[j]|0,I=((0,r.rotr)(C,2)^(0,r.rotr)(C,13)^(0,r.rotr)(C,22))+(0,t.Maj)(C,y,_)|0;k=O,O=T,T=A,A=x+S|0,x=_,_=y,y=C,C=S+I|0}C=C+this.A|0,y=y+this.B|0,_=_+this.C|0,x=x+this.D|0,A=A+this.E|0,T=T+this.F|0,O=O+this.G|0,k=k+this.H|0,this.set(C,y,_,x,A,T,O,k)}roundClean(){(0,r.clean)(i)}destroy(){this.set(0,0,0,0,0,0,0,0),(0,r.clean)(this.buffer)}}br.SHA256=s;class o extends s{constructor(){super(28),this.A=t.SHA224_IV[0]|0,this.B=t.SHA224_IV[1]|0,this.C=t.SHA224_IV[2]|0,this.D=t.SHA224_IV[3]|0,this.E=t.SHA224_IV[4]|0,this.F=t.SHA224_IV[5]|0,this.G=t.SHA224_IV[6]|0,this.H=t.SHA224_IV[7]|0}}br.SHA224=o;const a=e.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(v=>BigInt(v))),c=a[0],u=a[1],l=new Uint32Array(80),d=new Uint32Array(80);class h extends t.HashMD{constructor(E=64){super(128,E,16,!1),this.Ah=t.SHA512_IV[0]|0,this.Al=t.SHA512_IV[1]|0,this.Bh=t.SHA512_IV[2]|0,this.Bl=t.SHA512_IV[3]|0,this.Ch=t.SHA512_IV[4]|0,this.Cl=t.SHA512_IV[5]|0,this.Dh=t.SHA512_IV[6]|0,this.Dl=t.SHA512_IV[7]|0,this.Eh=t.SHA512_IV[8]|0,this.El=t.SHA512_IV[9]|0,this.Fh=t.SHA512_IV[10]|0,this.Fl=t.SHA512_IV[11]|0,this.Gh=t.SHA512_IV[12]|0,this.Gl=t.SHA512_IV[13]|0,this.Hh=t.SHA512_IV[14]|0,this.Hl=t.SHA512_IV[15]|0}get(){const{Ah:E,Al:w,Bh:C,Bl:y,Ch:_,Cl:x,Dh:A,Dl:T,Eh:O,El:k,Fh:j,Fl:N,Gh:S,Gl:P,Hh:I,Hl:B}=this;return[E,w,C,y,_,x,A,T,O,k,j,N,S,P,I,B]}set(E,w,C,y,_,x,A,T,O,k,j,N,S,P,I,B){this.Ah=E|0,this.Al=w|0,this.Bh=C|0,this.Bl=y|0,this.Ch=_|0,this.Cl=x|0,this.Dh=A|0,this.Dl=T|0,this.Eh=O|0,this.El=k|0,this.Fh=j|0,this.Fl=N|0,this.Gh=S|0,this.Gl=P|0,this.Hh=I|0,this.Hl=B|0}process(E,w){for(let D=0;D<16;D++,w+=4)l[D]=E.getUint32(w),d[D]=E.getUint32(w+=4);for(let D=16;D<80;D++){const L=l[D-15]|0,U=d[D-15]|0,z=e.rotrSH(L,U,1)^e.rotrSH(L,U,8)^e.shrSH(L,U,7),W=e.rotrSL(L,U,1)^e.rotrSL(L,U,8)^e.shrSL(L,U,7),K=l[D-2]|0,J=d[D-2]|0,ne=e.rotrSH(K,J,19)^e.rotrBH(K,J,61)^e.shrSH(K,J,6),ae=e.rotrSL(K,J,19)^e.rotrBL(K,J,61)^e.shrSL(K,J,6),he=e.add4L(W,ae,d[D-7],d[D-16]),ie=e.add4H(he,z,ne,l[D-7],l[D-16]);l[D]=ie|0,d[D]=he|0}let{Ah:C,Al:y,Bh:_,Bl:x,Ch:A,Cl:T,Dh:O,Dl:k,Eh:j,El:N,Fh:S,Fl:P,Gh:I,Gl:B,Hh:$,Hl:R}=this;for(let D=0;D<80;D++){const L=e.rotrSH(j,N,14)^e.rotrSH(j,N,18)^e.rotrBH(j,N,41),U=e.rotrSL(j,N,14)^e.rotrSL(j,N,18)^e.rotrBL(j,N,41),z=j&S^~j&I,W=N&P^~N&B,K=e.add5L(R,U,W,u[D],d[D]),J=e.add5H(K,$,L,z,c[D],l[D]),ne=K|0,ae=e.rotrSH(C,y,28)^e.rotrBH(C,y,34)^e.rotrBH(C,y,39),he=e.rotrSL(C,y,28)^e.rotrBL(C,y,34)^e.rotrBL(C,y,39),ie=C&_^C&A^_&A,Ee=y&x^y&T^x&T;$=I|0,R=B|0,I=S|0,B=P|0,S=j|0,P=N|0,{h:j,l:N}=e.add(O|0,k|0,J|0,ne|0),O=A|0,k=T|0,A=_|0,T=x|0,_=C|0,x=y|0;const pe=e.add3L(ne,he,Ee);C=e.add3H(pe,J,ae,ie),y=pe|0}({h:C,l:y}=e.add(this.Ah|0,this.Al|0,C|0,y|0)),{h:_,l:x}=e.add(this.Bh|0,this.Bl|0,_|0,x|0),{h:A,l:T}=e.add(this.Ch|0,this.Cl|0,A|0,T|0),{h:O,l:k}=e.add(this.Dh|0,this.Dl|0,O|0,k|0),{h:j,l:N}=e.add(this.Eh|0,this.El|0,j|0,N|0),{h:S,l:P}=e.add(this.Fh|0,this.Fl|0,S|0,P|0),{h:I,l:B}=e.add(this.Gh|0,this.Gl|0,I|0,B|0),{h:$,l:R}=e.add(this.Hh|0,this.Hl|0,$|0,R|0),this.set(C,y,_,x,A,T,O,k,j,N,S,P,I,B,$,R)}roundClean(){(0,r.clean)(l,d)}destroy(){(0,r.clean)(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}br.SHA512=h;class f extends h{constructor(){super(48),this.Ah=t.SHA384_IV[0]|0,this.Al=t.SHA384_IV[1]|0,this.Bh=t.SHA384_IV[2]|0,this.Bl=t.SHA384_IV[3]|0,this.Ch=t.SHA384_IV[4]|0,this.Cl=t.SHA384_IV[5]|0,this.Dh=t.SHA384_IV[6]|0,this.Dl=t.SHA384_IV[7]|0,this.Eh=t.SHA384_IV[8]|0,this.El=t.SHA384_IV[9]|0,this.Fh=t.SHA384_IV[10]|0,this.Fl=t.SHA384_IV[11]|0,this.Gh=t.SHA384_IV[12]|0,this.Gl=t.SHA384_IV[13]|0,this.Hh=t.SHA384_IV[14]|0,this.Hl=t.SHA384_IV[15]|0}}br.SHA384=f;const g=Uint32Array.from([2352822216,424955298,1944164710,2312950998,502970286,855612546,1738396948,1479516111,258812777,2077511080,2011393907,79989058,1067287976,1780299464,286451373,2446758561]),p=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class m extends h{constructor(){super(28),this.Ah=g[0]|0,this.Al=g[1]|0,this.Bh=g[2]|0,this.Bl=g[3]|0,this.Ch=g[4]|0,this.Cl=g[5]|0,this.Dh=g[6]|0,this.Dl=g[7]|0,this.Eh=g[8]|0,this.El=g[9]|0,this.Fh=g[10]|0,this.Fl=g[11]|0,this.Gh=g[12]|0,this.Gl=g[13]|0,this.Hh=g[14]|0,this.Hl=g[15]|0}}br.SHA512_224=m;class b extends h{constructor(){super(32),this.Ah=p[0]|0,this.Al=p[1]|0,this.Bh=p[2]|0,this.Bl=p[3]|0,this.Ch=p[4]|0,this.Cl=p[5]|0,this.Dh=p[6]|0,this.Dl=p[7]|0,this.Eh=p[8]|0,this.El=p[9]|0,this.Fh=p[10]|0,this.Fl=p[11]|0,this.Gh=p[12]|0,this.Gl=p[13]|0,this.Hh=p[14]|0,this.Hl=p[15]|0}}return br.SHA512_256=b,br.sha256=(0,r.createHasher)(()=>new s),br.sha224=(0,r.createHasher)(()=>new o),br.sha512=(0,r.createHasher)(()=>new h),br.sha384=(0,r.createHasher)(()=>new f),br.sha512_256=(0,r.createHasher)(()=>new b),br.sha512_224=(0,r.createHasher)(()=>new m),br}var Tw={},bT={},DL;function hIe(){return DL||(DL=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.hmac=t.HMAC=void 0;const e=Yd();class r extends e.Hash{constructor(s,o){super(),this.finished=!1,this.destroyed=!1,(0,e.ahash)(s);const a=(0,e.toBytes)(o);if(this.iHash=s.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const c=this.blockLen,u=new Uint8Array(c);u.set(a.length>c?s.create().update(a).digest():a);for(let l=0;lnew r(i,s).update(o).digest();t.hmac=n,t.hmac.create=(i,s)=>new r(i,s)}(bT)),bT}var yT={},Ch={},Ir={},Vt={},ML;function C2(){if(ML)return Vt;ML=1;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(Vt,"__esModule",{value:!0}),Vt.notImplemented=Vt.bitMask=void 0,Vt.isBytes=r,Vt.abytes=n,Vt.abool=i,Vt.numberToHexUnpadded=s,Vt.hexToNumber=o,Vt.bytesToHex=u,Vt.hexToBytes=h,Vt.bytesToNumberBE=f,Vt.bytesToNumberLE=g,Vt.numberToBytesBE=p,Vt.numberToBytesLE=m,Vt.numberToVarBytesBE=b,Vt.ensureBytes=v,Vt.concatBytes=E,Vt.equalBytes=w,Vt.utf8ToBytes=C,Vt.inRange=_,Vt.aInRange=x,Vt.bitLen=A,Vt.bitGet=T,Vt.bitSet=O,Vt.createHmacDrbg=S,Vt.validateObject=I,Vt.memoized=$;const t=BigInt(0),e=BigInt(1);function r(R){return R instanceof Uint8Array||ArrayBuffer.isView(R)&&R.constructor.name==="Uint8Array"}function n(R){if(!r(R))throw new Error("Uint8Array expected")}function i(R,D){if(typeof D!="boolean")throw new Error(R+" boolean expected, got "+D)}function s(R){const D=R.toString(16);return D.length&1?"0"+D:D}function o(R){if(typeof R!="string")throw new Error("hex string expected, got "+typeof R);return R===""?t:BigInt("0x"+R)}const a=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",c=Array.from({length:256},(R,D)=>D.toString(16).padStart(2,"0"));function u(R){if(n(R),a)return R.toHex();let D="";for(let L=0;L=l._0&&R<=l._9)return R-l._0;if(R>=l.A&&R<=l.F)return R-(l.A-10);if(R>=l.a&&R<=l.f)return R-(l.a-10)}function h(R){if(typeof R!="string")throw new Error("hex string expected, got "+typeof R);if(a)return Uint8Array.fromHex(R);const D=R.length,L=D/2;if(D%2)throw new Error("hex string expected, got unpadded hex of length "+D);const U=new Uint8Array(L);for(let z=0,W=0;ztypeof R=="bigint"&&t<=R;function _(R,D,L){return y(R)&&y(D)&&y(L)&&D<=R&&Rt;R>>=e,D+=1);return D}function T(R,D){return R>>BigInt(D)&e}function O(R,D,L){return R|(L?e:t)<(e<new Uint8Array(R),N=R=>Uint8Array.from(R);function S(R,D,L){if(typeof R!="number"||R<2)throw new Error("hashLen must be a number");if(typeof D!="number"||D<2)throw new Error("qByteLen must be a number");if(typeof L!="function")throw new Error("hmacFn must be a function");let U=j(R),z=j(R),W=0;const K=()=>{U.fill(1),z.fill(0),W=0},J=(...ie)=>L(z,U,...ie),ne=(ie=j(0))=>{z=J(N([0]),ie),U=J(),ie.length!==0&&(z=J(N([1]),ie),U=J())},ae=()=>{if(W++>=1e3)throw new Error("drbg: tried 1000 values");let ie=0;const Ee=[];for(;ie{K(),ne(ie);let pe;for(;!(pe=Ee(ae()));)ne();return K(),pe}}const P={bigint:R=>typeof R=="bigint",function:R=>typeof R=="function",boolean:R=>typeof R=="boolean",string:R=>typeof R=="string",stringOrUint8Array:R=>typeof R=="string"||r(R),isSafeInteger:R=>Number.isSafeInteger(R),array:R=>Array.isArray(R),field:(R,D)=>D.Fp.isValid(R),hash:R=>typeof R=="function"&&Number.isSafeInteger(R.outputLen)};function I(R,D,L={}){const U=(z,W,K)=>{const J=P[W];if(typeof J!="function")throw new Error("invalid validator function");const ne=R[z];if(!(K&&ne===void 0)&&!J(ne,R))throw new Error("param "+String(z)+" is invalid. Expected "+W+", got "+ne)};for(const[z,W]of Object.entries(D))U(z,W,!1);for(const[z,W]of Object.entries(L))U(z,W,!0);return R}const B=()=>{throw new Error("not implemented")};Vt.notImplemented=B;function $(R){const D=new WeakMap;return(L,...U)=>{const z=D.get(L);if(z!==void 0)return z;const W=R(L,...U);return D.set(L,W),W}}return Vt}var LL;function rx(){if(LL)return Ir;LL=1,Object.defineProperty(Ir,"__esModule",{value:!0}),Ir.isNegativeLE=void 0,Ir.mod=u,Ir.pow=l,Ir.pow2=d,Ir.invert=h,Ir.tonelliShanks=p,Ir.FpSqrt=m,Ir.validateField=E,Ir.FpPow=w,Ir.FpInvertBatch=C,Ir.FpDiv=y,Ir.FpLegendre=_,Ir.FpIsSquare=x,Ir.nLength=A,Ir.Field=T,Ir.FpSqrtOdd=O,Ir.FpSqrtEven=k,Ir.hashToPrivateScalar=j,Ir.getFieldBytesLength=N,Ir.getMinHashLength=S,Ir.mapHashToField=P;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const t=Yd(),e=C2(),r=BigInt(0),n=BigInt(1),i=BigInt(2),s=BigInt(3),o=BigInt(4),a=BigInt(5),c=BigInt(8);function u(I,B){const $=I%B;return $>=r?$:B+$}function l(I,B,$){return w(T($),I,B)}function d(I,B,$){let R=I;for(;B-- >r;)R*=R,R%=$;return R}function h(I,B){if(I===r)throw new Error("invert: expected non-zero number");if(B<=r)throw new Error("invert: expected positive modulus, got "+B);let $=u(I,B),R=B,D=r,L=n;for(;$!==r;){const z=R/$,W=R%$,K=D-L*z;R=$,$=W,D=L,L=K}if(R!==n)throw new Error("invert: does not exist");return u(D,B)}function f(I,B){const $=(I.ORDER+n)/o,R=I.pow(B,$);if(!I.eql(I.sqr(R),B))throw new Error("Cannot find square root");return R}function g(I,B){const $=(I.ORDER-a)/c,R=I.mul(B,i),D=I.pow(R,$),L=I.mul(B,D),U=I.mul(I.mul(L,i),D),z=I.mul(L,I.sub(U,I.ONE));if(!I.eql(I.sqr(z),B))throw new Error("Cannot find square root");return z}function p(I){if(I1e3)throw new Error("Cannot find square root: probably non-prime P");if($===1)return f;let L=D.pow(R,B);const U=(B+n)/i;return function(W,K){if(W.is0(K))return K;if(_(W,K)!==1)throw new Error("Cannot find square root");let J=$,ne=W.mul(W.ONE,L),ae=W.pow(K,B),he=W.pow(K,U);for(;!W.eql(ae,W.ONE);){if(W.is0(ae))return W.ZERO;let ie=1,Ee=W.sqr(ae);for(;!W.eql(Ee,W.ONE);)if(ie++,Ee=W.sqr(Ee),ie===J)throw new Error("Cannot find square root");const pe=n<(u(I,B)&n)===n;Ir.isNegativeLE=b;const v=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function E(I){const B={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},$=v.reduce((R,D)=>(R[D]="function",R),B);return(0,e.validateObject)(I,$)}function w(I,B,$){if($r;)$&n&&(R=I.mul(R,D)),D=I.sqr(D),$>>=n;return R}function C(I,B,$=!1){const R=new Array(B.length).fill($?I.ZERO:void 0),D=B.reduce((U,z,W)=>I.is0(z)?U:(R[W]=U,I.mul(U,z)),I.ONE),L=I.inv(D);return B.reduceRight((U,z,W)=>I.is0(z)?U:(R[W]=I.mul(U,R[W]),I.mul(U,z)),L),R}function y(I,B,$){return I.mul(B,typeof $=="bigint"?h($,I.ORDER):I.inv($))}function _(I,B){const $=(I.ORDER-n)/i,R=I.pow(B,$),D=I.eql(R,I.ONE),L=I.eql(R,I.ZERO),U=I.eql(R,I.neg(I.ONE));if(!D&&!L&&!U)throw new Error("invalid Legendre symbol result");return D?1:L?0:-1}function x(I,B){return _(I,B)===1}function A(I,B){B!==void 0&&(0,t.anumber)(B);const $=B!==void 0?B:I.toString(2).length,R=Math.ceil($/8);return{nBitLength:$,nByteLength:R}}function T(I,B,$=!1,R={}){if(I<=r)throw new Error("invalid field: expected ORDER > 0, got "+I);const{nBitLength:D,nByteLength:L}=A(I,B);if(L>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let U;const z=Object.freeze({ORDER:I,isLE:$,BITS:D,BYTES:L,MASK:(0,e.bitMask)(D),ZERO:r,ONE:n,create:W=>u(W,I),isValid:W=>{if(typeof W!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof W);return r<=W&&WW===r,isOdd:W=>(W&n)===n,neg:W=>u(-W,I),eql:(W,K)=>W===K,sqr:W=>u(W*W,I),add:(W,K)=>u(W+K,I),sub:(W,K)=>u(W-K,I),mul:(W,K)=>u(W*K,I),pow:(W,K)=>w(z,W,K),div:(W,K)=>u(W*h(K,I),I),sqrN:W=>W*W,addN:(W,K)=>W+K,subN:(W,K)=>W-K,mulN:(W,K)=>W*K,inv:W=>h(W,I),sqrt:R.sqrt||(W=>(U||(U=m(I)),U(z,W))),toBytes:W=>$?(0,e.numberToBytesLE)(W,L):(0,e.numberToBytesBE)(W,L),fromBytes:W=>{if(W.length!==L)throw new Error("Field.fromBytes: expected "+L+" bytes, got "+W.length);return $?(0,e.bytesToNumberLE)(W):(0,e.bytesToNumberBE)(W)},invertBatch:W=>C(z,W),cmov:(W,K,J)=>J?K:W});return Object.freeze(z)}function O(I,B){if(!I.isOdd)throw new Error("Field doesn't have isOdd");const $=I.sqrt(B);return I.isOdd($)?$:I.neg($)}function k(I,B){if(!I.isOdd)throw new Error("Field doesn't have isOdd");const $=I.sqrt(B);return I.isOdd($)?I.neg($):$}function j(I,B,$=!1){I=(0,e.ensureBytes)("privateHash",I);const R=I.length,D=A(B).nByteLength+8;if(D<24||R1024)throw new Error("hashToPrivateScalar: expected "+D+"-1024 bytes of input, got "+R);const L=$?(0,e.bytesToNumberLE)(I):(0,e.bytesToNumberBE)(I);return u(L,B-n)+n}function N(I){if(typeof I!="bigint")throw new Error("field order must be bigint");const B=I.toString(2).length;return Math.ceil(B/8)}function S(I){const B=N(I);return B+Math.ceil(B/2)}function P(I,B,$=!1){const R=I.length,D=N(B),L=S(B);if(R<16||R1024)throw new Error("expected "+L+"-1024 bytes of input, got "+R);const U=$?(0,e.bytesToNumberLE)(I):(0,e.bytesToNumberBE)(I),z=u(U,B-n)+n;return $?(0,e.numberToBytesLE)(z,D):(0,e.numberToBytesBE)(z,D)}return Ir}var UL;function fIe(){if(UL)return Ch;UL=1,Object.defineProperty(Ch,"__esModule",{value:!0}),Ch.wNAF=f,Ch.pippenger=g,Ch.precomputeMSMUnsafe=p,Ch.validateBasic=m;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const t=rx(),e=C2(),r=BigInt(0),n=BigInt(1);function i(b,v){const E=v.negate();return b?E:v}function s(b,v){if(!Number.isSafeInteger(b)||b<=0||b>v)throw new Error("invalid window size, expected [1.."+v+"], got W="+b)}function o(b,v){s(b,v);const E=Math.ceil(v/b)+1,w=2**(b-1),C=2**b,y=(0,e.bitMask)(b),_=BigInt(b);return{windows:E,windowSize:w,mask:y,maxNumber:C,shiftBy:_}}function a(b,v,E){const{windowSize:w,mask:C,maxNumber:y,shiftBy:_}=E;let x=Number(b&C),A=b>>_;x>w&&(x-=y,A+=n);const T=v*w,O=T+Math.abs(x)-1,k=x===0,j=x<0,N=v%2!==0;return{nextN:A,offset:O,isZero:k,isNeg:j,isNegF:N,offsetF:T}}function c(b,v){if(!Array.isArray(b))throw new Error("array expected");b.forEach((E,w)=>{if(!(E instanceof v))throw new Error("invalid point at index "+w)})}function u(b,v){if(!Array.isArray(b))throw new Error("array of scalars expected");b.forEach((E,w)=>{if(!v.isValid(E))throw new Error("invalid scalar at index "+w)})}const l=new WeakMap,d=new WeakMap;function h(b){return d.get(b)||1}function f(b,v){return{constTimeNegate:i,hasPrecomputes(E){return h(E)!==1},unsafeLadder(E,w,C=b.ZERO){let y=E;for(;w>r;)w&n&&(C=C.add(y)),y=y.double(),w>>=n;return C},precomputeWindow(E,w){const{windows:C,windowSize:y}=o(w,v),_=[];let x=E,A=x;for(let T=0;T12?A=x-3:x>4?A=x-2:x>0&&(A=2);const T=(0,e.bitMask)(A),O=new Array(Number(T)+1).fill(_),k=Math.floor((v.BITS-1)/A)*A;let j=_;for(let N=k;N>=0;N-=A){O.fill(_);for(let P=0;P>BigInt(N)&T);O[B]=O[B].add(E[P])}let S=_;for(let P=O.length-1,I=_;P>0;P--)I=I.add(O[P]),S=S.add(I);if(j=j.add(S),N!==0)for(let P=0;P{const O=[];for(let k=0,j=T;k{if(u(T,v),T.length>E.length)throw new Error("array of scalars must be smaller than array of points");let O=C;for(let k=0;k<_;k++){if(O!==C)for(let N=0;N>j&x);P&&(O=O.add(A[N][P-1]))}}return O}}function m(b){return(0,t.validateField)(b.Fp),(0,e.validateObject)(b,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,t.nLength)(b.n,b.nBitLength),...b,p:b.Fp.ORDER})}return Ch}var FL;function MQ(){return FL||(FL=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.DER=t.DERErr=void 0,t.weierstrassPoints=f,t.weierstrass=p,t.SWUFpSqrtRatio=m,t.mapToCurveSimpleSWU=b;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=fIe(),r=rx(),n=C2();function i(v){v.lowS!==void 0&&(0,n.abool)("lowS",v.lowS),v.prehash!==void 0&&(0,n.abool)("prehash",v.prehash)}function s(v){const E=(0,e.validateBasic)(v);(0,n.validateObject)(E,{a:"field",b:"field"},{allowInfinityPoint:"boolean",allowedPrivateKeyLengths:"array",clearCofactor:"function",fromBytes:"function",isTorsionFree:"function",toBytes:"function",wrapPrivateKey:"boolean"});const{endo:w,Fp:C,a:y}=E;if(w){if(!C.eql(y,C.ZERO))throw new Error("invalid endo: CURVE.a must be 0");if(typeof w!="object"||typeof w.beta!="bigint"||typeof w.splitScalar!="function")throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...E})}class o extends Error{constructor(E=""){super(E)}}t.DERErr=o,t.DER={Err:o,_tlv:{encode:(v,E)=>{const{Err:w}=t.DER;if(v<0||v>256)throw new w("tlv.encode: wrong tag");if(E.length&1)throw new w("tlv.encode: unpadded data");const C=E.length/2,y=(0,n.numberToHexUnpadded)(C);if(y.length/2&128)throw new w("tlv.encode: long form length too big");const _=C>127?(0,n.numberToHexUnpadded)(y.length/2|128):"";return(0,n.numberToHexUnpadded)(v)+_+y+E},decode(v,E){const{Err:w}=t.DER;let C=0;if(v<0||v>256)throw new w("tlv.encode: wrong tag");if(E.length<2||E[C++]!==v)throw new w("tlv.decode: wrong tlv");const y=E[C++],_=!!(y&128);let x=0;if(!_)x=y;else{const T=y&127;if(!T)throw new w("tlv.decode(long): indefinite length not supported");if(T>4)throw new w("tlv.decode(long): byte length is too big");const O=E.subarray(C,C+T);if(O.length!==T)throw new w("tlv.decode: length bytes not complete");if(O[0]===0)throw new w("tlv.decode(long): zero leftmost byte");for(const k of O)x=x<<8|k;if(C+=T,x<128)throw new w("tlv.decode(long): not minimal encoding")}const A=E.subarray(C,C+x);if(A.length!==x)throw new w("tlv.decode: wrong value length");return{v:A,l:E.subarray(C+x)}}},_int:{encode(v){const{Err:E}=t.DER;if(v{const z=L.toAffine();return(0,n.concatBytes)(Uint8Array.from([4]),w.toBytes(z.x),w.toBytes(z.y))}),_=E.fromBytes||(D=>{const L=D.subarray(1),U=w.fromBytes(L.subarray(0,w.BYTES)),z=w.fromBytes(L.subarray(w.BYTES,2*w.BYTES));return{x:U,y:z}});function x(D){const{a:L,b:U}=E,z=w.sqr(D),W=w.mul(z,D);return w.add(w.add(W,w.mul(D,L)),U)}function A(D,L){const U=w.sqr(L),z=x(D);return w.eql(U,z)}if(!A(E.Gx,E.Gy))throw new Error("bad curve params: generator point");const T=w.mul(w.pow(E.a,d),h),O=w.mul(w.sqr(E.b),BigInt(27));if(w.is0(w.add(T,O)))throw new Error("bad curve params: a or b");function k(D){return(0,n.inRange)(D,u,E.n)}function j(D){const{allowedPrivateKeyLengths:L,nByteLength:U,wrapPrivateKey:z,n:W}=E;if(L&&typeof D!="bigint"){if((0,n.isBytes)(D)&&(D=(0,n.bytesToHex)(D)),typeof D!="string"||!L.includes(D.length))throw new Error("invalid private key");D=D.padStart(U*2,"0")}let K;try{K=typeof D=="bigint"?D:(0,n.bytesToNumberBE)((0,n.ensureBytes)("private key",D,U))}catch{throw new Error("invalid private key, expected hex or "+U+" bytes, got "+typeof D)}return z&&(K=(0,r.mod)(K,W)),(0,n.aInRange)("private key",K,u,W),K}function N(D){if(!(D instanceof I))throw new Error("ProjectivePoint expected")}const S=(0,n.memoized)((D,L)=>{const{px:U,py:z,pz:W}=D;if(w.eql(W,w.ONE))return{x:U,y:z};const K=D.is0();L==null&&(L=K?w.ONE:w.inv(W));const J=w.mul(U,L),ne=w.mul(z,L),ae=w.mul(W,L);if(K)return{x:w.ZERO,y:w.ZERO};if(!w.eql(ae,w.ONE))throw new Error("invZ was invalid");return{x:J,y:ne}}),P=(0,n.memoized)(D=>{if(D.is0()){if(E.allowInfinityPoint&&!w.is0(D.py))return;throw new Error("bad point: ZERO")}const{x:L,y:U}=D.toAffine();if(!w.isValid(L)||!w.isValid(U))throw new Error("bad point: x or y not FE");if(!A(L,U))throw new Error("bad point: equation left != right");if(!D.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class I{constructor(L,U,z){if(L==null||!w.isValid(L))throw new Error("x required");if(U==null||!w.isValid(U)||w.is0(U))throw new Error("y required");if(z==null||!w.isValid(z))throw new Error("z required");this.px=L,this.py=U,this.pz=z,Object.freeze(this)}static fromAffine(L){const{x:U,y:z}=L||{};if(!L||!w.isValid(U)||!w.isValid(z))throw new Error("invalid affine point");if(L instanceof I)throw new Error("projective point not allowed");const W=K=>w.eql(K,w.ZERO);return W(U)&&W(z)?I.ZERO:new I(U,z,w.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(L){const U=(0,r.FpInvertBatch)(w,L.map(z=>z.pz));return L.map((z,W)=>z.toAffine(U[W])).map(I.fromAffine)}static fromHex(L){const U=I.fromAffine(_((0,n.ensureBytes)("pointHex",L)));return U.assertValidity(),U}static fromPrivateKey(L){return I.BASE.multiply(j(L))}static msm(L,U){return(0,e.pippenger)(I,C,L,U)}_setWindowSize(L){R.setWindowSize(this,L)}assertValidity(){P(this)}hasEvenY(){const{y:L}=this.toAffine();if(w.isOdd)return!w.isOdd(L);throw new Error("Field doesn't support isOdd")}equals(L){N(L);const{px:U,py:z,pz:W}=this,{px:K,py:J,pz:ne}=L,ae=w.eql(w.mul(U,ne),w.mul(K,W)),he=w.eql(w.mul(z,ne),w.mul(J,W));return ae&&he}negate(){return new I(this.px,w.neg(this.py),this.pz)}double(){const{a:L,b:U}=E,z=w.mul(U,d),{px:W,py:K,pz:J}=this;let ne=w.ZERO,ae=w.ZERO,he=w.ZERO,ie=w.mul(W,W),Ee=w.mul(K,K),pe=w.mul(J,J),ve=w.mul(W,K);return ve=w.add(ve,ve),he=w.mul(W,J),he=w.add(he,he),ne=w.mul(L,he),ae=w.mul(z,pe),ae=w.add(ne,ae),ne=w.sub(Ee,ae),ae=w.add(Ee,ae),ae=w.mul(ne,ae),ne=w.mul(ve,ne),he=w.mul(z,he),pe=w.mul(L,pe),ve=w.sub(ie,pe),ve=w.mul(L,ve),ve=w.add(ve,he),he=w.add(ie,ie),ie=w.add(he,ie),ie=w.add(ie,pe),ie=w.mul(ie,ve),ae=w.add(ae,ie),pe=w.mul(K,J),pe=w.add(pe,pe),ie=w.mul(pe,ve),ne=w.sub(ne,ie),he=w.mul(pe,Ee),he=w.add(he,he),he=w.add(he,he),new I(ne,ae,he)}add(L){N(L);const{px:U,py:z,pz:W}=this,{px:K,py:J,pz:ne}=L;let ae=w.ZERO,he=w.ZERO,ie=w.ZERO;const Ee=E.a,pe=w.mul(E.b,d);let ve=w.mul(U,K),je=w.mul(z,J),rt=w.mul(W,ne),Ce=w.add(U,z),fe=w.add(K,J);Ce=w.mul(Ce,fe),fe=w.add(ve,je),Ce=w.sub(Ce,fe),fe=w.add(U,W);let ft=w.add(K,ne);return fe=w.mul(fe,ft),ft=w.add(ve,rt),fe=w.sub(fe,ft),ft=w.add(z,W),ae=w.add(J,ne),ft=w.mul(ft,ae),ae=w.add(je,rt),ft=w.sub(ft,ae),ie=w.mul(Ee,fe),ae=w.mul(pe,rt),ie=w.add(ae,ie),ae=w.sub(je,ie),ie=w.add(je,ie),he=w.mul(ae,ie),je=w.add(ve,ve),je=w.add(je,ve),rt=w.mul(Ee,rt),fe=w.mul(pe,fe),je=w.add(je,rt),rt=w.sub(ve,rt),rt=w.mul(Ee,rt),fe=w.add(fe,rt),ve=w.mul(je,fe),he=w.add(he,ve),ve=w.mul(ft,fe),ae=w.mul(Ce,ae),ae=w.sub(ae,ve),ve=w.mul(Ce,je),ie=w.mul(ft,ie),ie=w.add(ie,ve),new I(ae,he,ie)}subtract(L){return this.add(L.negate())}is0(){return this.equals(I.ZERO)}wNAF(L){return R.wNAFCached(this,L,I.normalizeZ)}multiplyUnsafe(L){const{endo:U,n:z}=E;(0,n.aInRange)("scalar",L,c,z);const W=I.ZERO;if(L===c)return W;if(this.is0()||L===u)return this;if(!U||R.hasPrecomputes(this))return R.wNAFCachedUnsafe(this,L,I.normalizeZ);let{k1neg:K,k1:J,k2neg:ne,k2:ae}=U.splitScalar(L),he=W,ie=W,Ee=this;for(;J>c||ae>c;)J&u&&(he=he.add(Ee)),ae&u&&(ie=ie.add(Ee)),Ee=Ee.double(),J>>=u,ae>>=u;return K&&(he=he.negate()),ne&&(ie=ie.negate()),ie=new I(w.mul(ie.px,U.beta),ie.py,ie.pz),he.add(ie)}multiply(L){const{endo:U,n:z}=E;(0,n.aInRange)("scalar",L,u,z);let W,K;if(U){const{k1neg:J,k1:ne,k2neg:ae,k2:he}=U.splitScalar(L);let{p:ie,f:Ee}=this.wNAF(ne),{p:pe,f:ve}=this.wNAF(he);ie=R.constTimeNegate(J,ie),pe=R.constTimeNegate(ae,pe),pe=new I(w.mul(pe.px,U.beta),pe.py,pe.pz),W=ie.add(pe),K=Ee.add(ve)}else{const{p:J,f:ne}=this.wNAF(L);W=J,K=ne}return I.normalizeZ([W,K])[0]}multiplyAndAddUnsafe(L,U,z){const W=I.BASE,K=(ne,ae)=>ae===c||ae===u||!ne.equals(W)?ne.multiplyUnsafe(ae):ne.multiply(ae),J=K(this,U).add(K(L,z));return J.is0()?void 0:J}toAffine(L){return S(this,L)}isTorsionFree(){const{h:L,isTorsionFree:U}=E;if(L===u)return!0;if(U)return U(I,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:L,clearCofactor:U}=E;return L===u?this:U?U(I,this):this.multiplyUnsafe(E.h)}toRawBytes(L=!0){return(0,n.abool)("isCompressed",L),this.assertValidity(),y(I,this,L)}toHex(L=!0){return(0,n.abool)("isCompressed",L),(0,n.bytesToHex)(this.toRawBytes(L))}}I.BASE=new I(E.Gx,E.Gy,w.ONE),I.ZERO=new I(w.ZERO,w.ONE,w.ZERO);const{endo:B,nBitLength:$}=E,R=(0,e.wNAF)(I,B?Math.ceil($/2):$);return{CURVE:E,ProjectivePoint:I,normPrivateKeyToScalar:j,weierstrassEquation:x,isWithinCurveOrder:k}}function g(v){const E=(0,e.validateBasic)(v);return(0,n.validateObject)(E,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...E})}function p(v){const E=g(v),{Fp:w,n:C,nByteLength:y,nBitLength:_}=E,x=w.BYTES+1,A=2*w.BYTES+1;function T(pe){return(0,r.mod)(pe,C)}function O(pe){return(0,r.invert)(pe,C)}const{ProjectivePoint:k,normPrivateKeyToScalar:j,weierstrassEquation:N,isWithinCurveOrder:S}=f({...E,toBytes(pe,ve,je){const rt=ve.toAffine(),Ce=w.toBytes(rt.x),fe=n.concatBytes;return(0,n.abool)("isCompressed",je),je?fe(Uint8Array.from([ve.hasEvenY()?2:3]),Ce):fe(Uint8Array.from([4]),Ce,w.toBytes(rt.y))},fromBytes(pe){const ve=pe.length,je=pe[0],rt=pe.subarray(1);if(ve===x&&(je===2||je===3)){const Ce=(0,n.bytesToNumberBE)(rt);if(!(0,n.inRange)(Ce,u,w.ORDER))throw new Error("Point is not on curve");const fe=N(Ce);let ft;try{ft=w.sqrt(fe)}catch(dr){const hr=dr instanceof Error?": "+dr.message:"";throw new Error("Point is not on curve"+hr)}const Wt=(ft&u)===u;return(je&1)===1!==Wt&&(ft=w.neg(ft)),{x:Ce,y:ft}}else if(ve===A&&je===4){const Ce=w.fromBytes(rt.subarray(0,w.BYTES)),fe=w.fromBytes(rt.subarray(w.BYTES,2*w.BYTES));return{x:Ce,y:fe}}else{const Ce=x,fe=A;throw new Error("invalid Point, expected length of "+Ce+", or uncompressed "+fe+", got "+ve)}}});function P(pe){const ve=C>>u;return pe>ve}function I(pe){return P(pe)?T(-pe):pe}const B=(pe,ve,je)=>(0,n.bytesToNumberBE)(pe.slice(ve,je));class ${constructor(ve,je,rt){(0,n.aInRange)("r",ve,u,C),(0,n.aInRange)("s",je,u,C),this.r=ve,this.s=je,rt!=null&&(this.recovery=rt),Object.freeze(this)}static fromCompact(ve){const je=y;return ve=(0,n.ensureBytes)("compactSignature",ve,je*2),new $(B(ve,0,je),B(ve,je,2*je))}static fromDER(ve){const{r:je,s:rt}=t.DER.toSig((0,n.ensureBytes)("DER",ve));return new $(je,rt)}assertValidity(){}addRecoveryBit(ve){return new $(this.r,this.s,ve)}recoverPublicKey(ve){const{r:je,s:rt,recovery:Ce}=this,fe=W((0,n.ensureBytes)("msgHash",ve));if(Ce==null||![0,1,2,3].includes(Ce))throw new Error("recovery id invalid");const ft=Ce===2||Ce===3?je+E.n:je;if(ft>=w.ORDER)throw new Error("recovery id 2 or 3 invalid");const Wt=(Ce&1)===0?"02":"03",lr=k.fromHex(Wt+a(ft,w.BYTES)),dr=O(ft),hr=T(-fe*dr),Er=T(rt*dr),be=k.BASE.multiplyAndAddUnsafe(lr,hr,Er);if(!be)throw new Error("point at infinify");return be.assertValidity(),be}hasHighS(){return P(this.s)}normalizeS(){return this.hasHighS()?new $(this.r,T(-this.s),this.recovery):this}toDERRawBytes(){return(0,n.hexToBytes)(this.toDERHex())}toDERHex(){return t.DER.hexFromSig(this)}toCompactRawBytes(){return(0,n.hexToBytes)(this.toCompactHex())}toCompactHex(){const ve=y;return a(this.r,ve)+a(this.s,ve)}}const R={isValidPrivateKey(pe){try{return j(pe),!0}catch{return!1}},normPrivateKeyToScalar:j,randomPrivateKey:()=>{const pe=(0,r.getMinHashLength)(E.n);return(0,r.mapHashToField)(E.randomBytes(pe),E.n)},precompute(pe=8,ve=k.BASE){return ve._setWindowSize(pe),ve.multiply(BigInt(3)),ve}};function D(pe,ve=!0){return k.fromPrivateKey(pe).toRawBytes(ve)}function L(pe){if(typeof pe=="bigint")return!1;if(pe instanceof k)return!0;const je=(0,n.ensureBytes)("key",pe).length,rt=w.BYTES,Ce=rt+1,fe=2*rt+1;if(!(E.allowedPrivateKeyLengths||y===Ce))return je===Ce||je===fe}function U(pe,ve,je=!0){if(L(pe)===!0)throw new Error("first arg must be private key");if(L(ve)===!1)throw new Error("second arg must be public key");return k.fromHex(ve).multiply(j(pe)).toRawBytes(je)}const z=E.bits2int||function(pe){if(pe.length>8192)throw new Error("input is too large");const ve=(0,n.bytesToNumberBE)(pe),je=pe.length*8-_;return je>0?ve>>BigInt(je):ve},W=E.bits2int_modN||function(pe){return T(z(pe))},K=(0,n.bitMask)(_);function J(pe){return(0,n.aInRange)("num < 2^"+_,pe,c,K),(0,n.numberToBytesBE)(pe,y)}function ne(pe,ve,je=ae){if(["recovered","canonical"].some(Me=>Me in je))throw new Error("sign() legacy options not supported");const{hash:rt,randomBytes:Ce}=E;let{lowS:fe,prehash:ft,extraEntropy:Wt}=je;fe==null&&(fe=!0),pe=(0,n.ensureBytes)("msgHash",pe),i(je),ft&&(pe=(0,n.ensureBytes)("prehashed msgHash",rt(pe)));const lr=W(pe),dr=j(ve),hr=[J(dr),J(lr)];if(Wt!=null&&Wt!==!1){const Me=Wt===!0?Ce(w.BYTES):Wt;hr.push((0,n.ensureBytes)("extraEntropy",Me))}const Er=(0,n.concatBytes)(...hr),be=lr;function Te(Me){const st=z(Me);if(!S(st))return;const Cr=O(st),hn=k.BASE.multiply(st).toAffine(),ai=T(hn.x);if(ai===c)return;const fn=T(Cr*T(be+ai*dr));if(fn===c)return;let Ms=(hn.x===ai?0:2)|Number(hn.y&u),mo=fn;return fe&&P(fn)&&(mo=I(fn),Ms^=1),new $(ai,mo,Ms)}return{seed:Er,k2sig:Te}}const ae={lowS:E.lowS,prehash:!1},he={lowS:E.lowS,prehash:!1};function ie(pe,ve,je=ae){const{seed:rt,k2sig:Ce}=ne(pe,ve,je),fe=E;return(0,n.createHmacDrbg)(fe.hash.outputLen,fe.nByteLength,fe.hmac)(rt,Ce)}k.BASE._setWindowSize(8);function Ee(pe,ve,je,rt=he){var Ms;const Ce=pe;ve=(0,n.ensureBytes)("msgHash",ve),je=(0,n.ensureBytes)("publicKey",je);const{lowS:fe,prehash:ft,format:Wt}=rt;if(i(rt),"strict"in rt)throw new Error("options.strict was renamed to lowS");if(Wt!==void 0&&Wt!=="compact"&&Wt!=="der")throw new Error("format must be compact or der");const lr=typeof Ce=="string"||(0,n.isBytes)(Ce),dr=!lr&&!Wt&&typeof Ce=="object"&&Ce!==null&&typeof Ce.r=="bigint"&&typeof Ce.s=="bigint";if(!lr&&!dr)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let hr,Er;try{if(dr&&(hr=new $(Ce.r,Ce.s)),lr){try{Wt!=="compact"&&(hr=$.fromDER(Ce))}catch(mo){if(!(mo instanceof t.DER.Err))throw mo}!hr&&Wt!=="der"&&(hr=$.fromCompact(Ce))}Er=k.fromHex(je)}catch{return!1}if(!hr||fe&&hr.hasHighS())return!1;ft&&(ve=E.hash(ve));const{r:be,s:Te}=hr,Me=W(ve),st=O(Te),Cr=T(Me*st),hn=T(be*st),ai=(Ms=k.BASE.multiplyAndAddUnsafe(Er,Cr,hn))==null?void 0:Ms.toAffine();return ai?T(ai.x)===be:!1}return{CURVE:E,getPublicKey:D,getSharedSecret:U,sign:ie,verify:Ee,ProjectivePoint:k,Signature:$,utils:R}}function m(v,E){const w=v.ORDER;let C=c;for(let P=w-u;P%l===c;P/=l)C+=u;const y=C,_=l<{let B=j,$=v.pow(I,O),R=v.sqr($);R=v.mul(R,I);let D=v.mul(P,R);D=v.pow(D,T),D=v.mul(D,$),$=v.mul(D,I),R=v.mul(D,P);let L=v.mul(R,$);D=v.pow(L,k);let U=v.eql(D,v.ONE);$=v.mul(R,N),D=v.mul(L,B),R=v.cmov($,R,U),L=v.cmov(D,L,U);for(let z=y;z>u;z--){let W=z-l;W=l<{let R=v.sqr($);const D=v.mul(B,$);R=v.mul(R,D);let L=v.pow(R,P);L=v.mul(L,D);const U=v.mul(L,I),z=v.mul(v.sqr(L),$),W=v.eql(z,B);let K=v.cmov(U,L,W);return{isValid:W,value:K}}}return S}function b(v,E){if((0,r.validateField)(v),!v.isValid(E.A)||!v.isValid(E.B)||!v.isValid(E.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");const w=m(v,E.Z);if(!v.isOdd)throw new Error("Fp.isOdd is not implemented!");return C=>{let y,_,x,A,T,O,k,j;y=v.sqr(C),y=v.mul(y,E.Z),_=v.sqr(y),_=v.add(_,y),x=v.add(_,v.ONE),x=v.mul(x,E.B),A=v.cmov(E.Z,v.neg(_),!v.eql(_,v.ZERO)),A=v.mul(A,E.A),_=v.sqr(x),O=v.sqr(A),T=v.mul(O,E.A),_=v.add(_,T),_=v.mul(_,x),O=v.mul(O,A),T=v.mul(O,E.B),_=v.add(_,T),k=v.mul(y,x);const{isValid:N,value:S}=w(_,O);j=v.mul(y,C),j=v.mul(j,S),k=v.cmov(k,x,N),j=v.cmov(j,S,N);const P=v.isOdd(C)===v.isOdd(j);j=v.cmov(v.neg(j),j,P);const I=(0,r.FpInvertBatch)(v,[A],!0)[0];return k=v.mul(k,I),{x:k,y:j}}}}(yT)),yT}var HL;function pIe(){if(HL)return Tw;HL=1,Object.defineProperty(Tw,"__esModule",{value:!0}),Tw.getHash=n,Tw.createCurve=i;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const t=hIe(),e=Yd(),r=MQ();function n(s){return{hash:s,hmac:(o,...a)=>(0,t.hmac)(s,o,(0,e.concatBytes)(...a)),randomBytes:e.randomBytes}}function i(s,o){const a=c=>(0,r.weierstrass)({...s,...n(c)});return{...a(o),create:a}}return Tw}var Il={},qL;function gIe(){if(qL)return Il;qL=1,Object.defineProperty(Il,"__esModule",{value:!0}),Il.expand_message_xmd=o,Il.expand_message_xof=a,Il.hash_to_field=c,Il.isogenyMap=u,Il.createHasher=l;const t=rx(),e=C2(),r=e.bytesToNumberBE;function n(d,h){if(s(d),s(h),d<0||d>=1<<8*h)throw new Error("invalid I2OSP input: "+d);const f=Array.from({length:h}).fill(0);for(let g=h-1;g>=0;g--)f[g]=d&255,d>>>=8;return new Uint8Array(f)}function i(d,h){const f=new Uint8Array(d.length);for(let g=0;g255&&(h=g((0,e.concatBytes)((0,e.utf8ToBytes)("H2C-OVERSIZE-DST-"),h)));const{outputLen:p,blockLen:m}=g,b=Math.ceil(f/p);if(f>65535||b>255)throw new Error("expand_message_xmd: invalid lenInBytes");const v=(0,e.concatBytes)(h,n(h.length,1)),E=n(0,m),w=n(f,2),C=new Array(b),y=g((0,e.concatBytes)(E,d,w,n(0,1),v));C[0]=g((0,e.concatBytes)(y,n(1,1),v));for(let x=1;x<=b;x++){const A=[i(y,C[x-1]),n(x+1,1),v];C[x]=g((0,e.concatBytes)(...A))}return(0,e.concatBytes)(...C).slice(0,f)}function a(d,h,f,g,p){if((0,e.abytes)(d),(0,e.abytes)(h),s(f),h.length>255){const m=Math.ceil(2*g/8);h=p.create({dkLen:m}).update((0,e.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(h).digest()}if(f>65535||h.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return p.create({dkLen:f}).update(d).update(n(f,2)).update(h).update(n(h.length,1)).digest()}function c(d,h,f){(0,e.validateObject)(f,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});const{p:g,k:p,m,hash:b,expand:v,DST:E}=f;(0,e.abytes)(d),s(h);const w=typeof E=="string"?(0,e.utf8ToBytes)(E):E,C=g.toString(2).length,y=Math.ceil((C+p)/8),_=h*m*y;let x;if(v==="xmd")x=o(d,w,_,b);else if(v==="xof")x=a(d,w,_,p,b);else if(v==="_internal_pass")x=d;else throw new Error('expand must be "xmd" or "xof"');const A=new Array(h);for(let T=0;TArray.from(g).reverse());return(g,p)=>{const[m,b,v,E]=f.map(y=>y.reduce((_,x)=>d.add(d.mul(_,g),x))),[w,C]=(0,t.FpInvertBatch)(d,[b,E],!0);return g=d.mul(m,w),p=d.mul(p,d.mul(v,C)),{x:g,y:p}}}function l(d,h,f){if(typeof h!="function")throw new Error("mapToCurve() must be defined");function g(m){return d.fromAffine(h(m))}function p(m){const b=m.clearCofactor();return b.equals(d.ZERO)?d.ZERO:(b.assertValidity(),b)}return{defaults:f,hashToCurve(m,b){const v=c(m,2,{...f,DST:f.DST,...b}),E=g(v[0]),w=g(v[1]);return p(E.add(w))},encodeToCurve(m,b){const v=c(m,1,{...f,DST:f.encodeDST,...b});return p(g(v[0]))},mapToCurve(m){if(!Array.isArray(m))throw new Error("expected array of bigints");for(const b of m)if(typeof b!="bigint")throw new Error("expected array of bigints");return p(g(m))}}}return Il}var zL;function A2(){return zL||(zL=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.encodeToCurve=t.hashToCurve=t.secp256k1_hasher=t.schnorr=t.secp256k1=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=DQ(),r=Yd(),n=pIe(),i=gIe(),s=rx(),o=C2(),a=MQ(),c=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),u=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),l=BigInt(0),d=BigInt(1),h=BigInt(2),f=(I,B)=>(I+B/h)/B;function g(I){const B=c,$=BigInt(3),R=BigInt(6),D=BigInt(11),L=BigInt(22),U=BigInt(23),z=BigInt(44),W=BigInt(88),K=I*I*I%B,J=K*K*I%B,ne=(0,s.pow2)(J,$,B)*J%B,ae=(0,s.pow2)(ne,$,B)*J%B,he=(0,s.pow2)(ae,h,B)*K%B,ie=(0,s.pow2)(he,D,B)*he%B,Ee=(0,s.pow2)(ie,L,B)*ie%B,pe=(0,s.pow2)(Ee,z,B)*Ee%B,ve=(0,s.pow2)(pe,W,B)*pe%B,je=(0,s.pow2)(ve,z,B)*Ee%B,rt=(0,s.pow2)(je,$,B)*J%B,Ce=(0,s.pow2)(rt,U,B)*ie%B,fe=(0,s.pow2)(Ce,R,B)*K%B,ft=(0,s.pow2)(fe,h,B);if(!p.eql(p.sqr(ft),I))throw new Error("Cannot find square root");return ft}const p=(0,s.Field)(c,void 0,void 0,{sqrt:g});t.secp256k1=(0,n.createCurve)({a:l,b:BigInt(7),Fp:p,n:u,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:I=>{const B=u,$=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),R=-d*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),D=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),L=$,U=BigInt("0x100000000000000000000000000000000"),z=f(L*I,B),W=f(-R*I,B);let K=(0,s.mod)(I-z*$-W*D,B),J=(0,s.mod)(-z*R-W*L,B);const ne=K>U,ae=J>U;if(ne&&(K=B-K),ae&&(J=B-J),K>U||J>U)throw new Error("splitScalar: Endomorphism failed, k="+I);return{k1neg:ne,k1:K,k2neg:ae,k2:J}}}},e.sha256);const m={};function b(I,...B){let $=m[I];if($===void 0){const R=(0,e.sha256)(Uint8Array.from(I,D=>D.charCodeAt(0)));$=(0,o.concatBytes)(R,R),m[I]=$}return(0,e.sha256)((0,o.concatBytes)($,...B))}const v=I=>I.toRawBytes(!0).slice(1),E=I=>(0,o.numberToBytesBE)(I,32),w=I=>(0,s.mod)(I,c),C=I=>(0,s.mod)(I,u),y=t.secp256k1.ProjectivePoint,_=(I,B,$)=>y.BASE.multiplyAndAddUnsafe(I,B,$);function x(I){let B=t.secp256k1.utils.normPrivateKeyToScalar(I),$=y.fromPrivateKey(B);return{scalar:$.hasEvenY()?B:C(-B),bytes:v($)}}function A(I){(0,o.aInRange)("x",I,d,c);const B=w(I*I),$=w(B*I+BigInt(7));let R=g($);R%h!==l&&(R=w(-R));const D=new y(I,R,d);return D.assertValidity(),D}const T=o.bytesToNumberBE;function O(...I){return C(T(b("BIP0340/challenge",...I)))}function k(I){return x(I).bytes}function j(I,B,$=(0,r.randomBytes)(32)){const R=(0,o.ensureBytes)("message",I),{bytes:D,scalar:L}=x(B),U=(0,o.ensureBytes)("auxRand",$,32),z=E(L^T(b("BIP0340/aux",U))),W=b("BIP0340/nonce",z,D,R),K=C(T(W));if(K===l)throw new Error("sign failed: k is zero");const{bytes:J,scalar:ne}=x(K),ae=O(J,D,R),he=new Uint8Array(64);if(he.set(J,0),he.set(E(C(ne+ae*L)),32),!N(he,R,D))throw new Error("sign: Invalid signature produced");return he}function N(I,B,$){const R=(0,o.ensureBytes)("signature",I,64),D=(0,o.ensureBytes)("message",B),L=(0,o.ensureBytes)("publicKey",$,32);try{const U=A(T(L)),z=T(R.subarray(0,32));if(!(0,o.inRange)(z,d,c))return!1;const W=T(R.subarray(32,64));if(!(0,o.inRange)(W,d,u))return!1;const K=O(E(z),v(U),D),J=_(U,W,C(-K));return!(!J||!J.hasEvenY()||J.toAffine().x!==z)}catch{return!1}}t.schnorr={getPublicKey:k,sign:j,verify:N,utils:{randomPrivateKey:t.secp256k1.utils.randomPrivateKey,lift_x:A,pointToBytes:v,numberToBytesBE:o.numberToBytesBE,bytesToNumberBE:o.bytesToNumberBE,taggedHash:b,mod:s.mod}};const S=(0,i.isogenyMap)(p,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(I=>I.map(B=>BigInt(B)))),P=(0,a.mapToCurveSimpleSWU)(p,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:p.create(BigInt("-11"))});t.secp256k1_hasher=(0,i.createHasher)(t.secp256k1.ProjectivePoint,I=>{const{x:B,y:$}=P(p.create(I[0]));return S(B,$)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:p.ORDER,m:1,k:128,expand:"xmd",hash:e.sha256}),t.hashToCurve=t.secp256k1_hasher.hashToCurve,t.encodeToCurve=t.secp256k1_hasher.encodeToCurve}(wT)),wT}var WL;function yO(){if(WL)return p_;WL=1,Object.defineProperty(p_,"__esModule",{value:!0}),p_.recoverPublicKey=i;const t=ki(),e=rs(),r=nn(),n=ze();async function i({hash:o,signature:a}){const c=(0,t.isHex)(o)?o:(0,n.toHex)(o),{secp256k1:u}=await Promise.resolve().then(()=>A2());return`0x${(()=>{if(typeof a=="object"&&"r"in a&&"s"in a){const{r:p,s:m,v:b,yParity:v}=a,E=Number(v??b),w=s(E);return new u.Signature((0,r.hexToBigInt)(p),(0,r.hexToBigInt)(m)).addRecoveryBit(w)}const h=(0,t.isHex)(a)?a:(0,n.toHex)(a);if((0,e.size)(h)!==65)throw new Error("invalid signature length");const f=(0,r.hexToNumber)(`0x${h.slice(130)}`),g=s(f);return u.Signature.fromCompact(h.substring(2,130)).addRecoveryBit(g)})().recoverPublicKey(c.substring(2)).toHex(!1)}`}function s(o){if(o===0||o===1)return o;if(o===27)return 0;if(o===28)return 1;throw new Error("Invalid yParityOrV value")}return p_}var VL;function th(){if(VL)return h_;VL=1,Object.defineProperty(h_,"__esModule",{value:!0}),h_.recoverAddress=r;const t=jQ(),e=yO();async function r({hash:n,signature:i}){return(0,t.publicKeyToAddress)(await(0,e.recoverPublicKey)({hash:n,signature:i}))}return h_}var g_={},C0={},GL;function x2(){if(GL)return C0;GL=1,Object.defineProperty(C0,"__esModule",{value:!0}),C0.toRlp=i,C0.bytesToRlp=s,C0.hexToRlp=o;const t=_t(),e=v2(),r=Tr(),n=ze();function i(d,h="hex"){const f=a(d),g=(0,e.createCursor)(new Uint8Array(f.length));return f.encode(g),h==="hex"?(0,n.bytesToHex)(g.bytes):g.bytes}function s(d,h="bytes"){return i(d,h)}function o(d,h="hex"){return i(d,h)}function a(d){return Array.isArray(d)?c(d.map(h=>a(h))):u(d)}function c(d){const h=d.reduce((p,m)=>p+m.length,0),f=l(h);return{length:h<=55?1+h:1+f+h,encode(p){h<=55?p.pushByte(192+h):(p.pushByte(247+f),f===1?p.pushUint8(h):f===2?p.pushUint16(h):f===3?p.pushUint24(h):p.pushUint32(h));for(const{encode:m}of d)m(p)}}}function u(d){const h=typeof d=="string"?(0,r.hexToBytes)(d):d,f=l(h.length);return{length:h.length===1&&h[0]<128?1:h.length<=55?1+h.length:1+f+h.length,encode(p){h.length===1&&h[0]<128?p.pushBytes(h):h.length<=55?(p.pushByte(128+h.length),p.pushBytes(h)):(p.pushByte(183+f),f===1?p.pushUint8(h.length):f===2?p.pushUint16(h.length):f===3?p.pushUint24(h.length):p.pushUint32(h.length),p.pushBytes(h))}}}function l(d){if(d<2**8)return 1;if(d<2**16)return 2;if(d<2**24)return 3;if(d<2**32)return 4;throw new t.BaseError("Length is too large.")}return C0}var KL;function LQ(){if(KL)return g_;KL=1,Object.defineProperty(g_,"__esModule",{value:!0}),g_.hashAuthorization=s;const t=oi(),e=Tr(),r=ze(),n=x2(),i=ns();function s(o){const{chainId:a,nonce:c,to:u}=o,l=o.contractAddress??o.address,d=(0,i.keccak256)((0,t.concatHex)(["0x05",(0,n.toRlp)([a?(0,r.numberToHex)(a):"0x",l,c?(0,r.numberToHex)(c):"0x"])]));return u==="bytes"?(0,e.hexToBytes)(d):d}return g_}var ZL;function nx(){if(ZL)return d_;ZL=1,Object.defineProperty(d_,"__esModule",{value:!0}),d_.recoverAuthorizationAddress=r;const t=th(),e=LQ();async function r(n){const{authorization:i,signature:s}=n;return(0,t.recoverAddress)({hash:(0,e.hashAuthorization)(i),signature:s??i})}return d_}var m_={},Iw={},YL;function UQ(){if(YL)return Iw;YL=1,Object.defineProperty(Iw,"__esModule",{value:!0}),Iw.EstimateGasExecutionError=void 0;const t=E2(),e=Fp(),r=_t(),n=Ds();class i extends r.BaseError{constructor(o,{account:a,docsPath:c,chain:u,data:l,gas:d,gasPrice:h,maxFeePerGas:f,maxPriorityFeePerGas:g,nonce:p,to:m,value:b}){var E;const v=(0,n.prettyPrint)({from:a==null?void 0:a.address,to:m,value:typeof b<"u"&&`${(0,t.formatEther)(b)} ${((E=u==null?void 0:u.nativeCurrency)==null?void 0:E.symbol)||"ETH"}`,data:l,gas:d,gasPrice:typeof h<"u"&&`${(0,e.formatGwei)(h)} gwei`,maxFeePerGas:typeof f<"u"&&`${(0,e.formatGwei)(f)} gwei`,maxPriorityFeePerGas:typeof g<"u"&&`${(0,e.formatGwei)(g)} gwei`,nonce:p});super(o.shortMessage,{cause:o,docsPath:c,metaMessages:[...o.metaMessages?[...o.metaMessages," "]:[],"Estimate Gas Arguments:",v].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=o}}return Iw.EstimateGasExecutionError=i,Iw}var yr={},JL;function nl(){if(JL)return yr;JL=1,Object.defineProperty(yr,"__esModule",{value:!0}),yr.UnknownNodeError=yr.TipAboveFeeCapError=yr.TransactionTypeNotSupportedError=yr.IntrinsicGasTooLowError=yr.IntrinsicGasTooHighError=yr.InsufficientFundsError=yr.NonceMaxValueError=yr.NonceTooLowError=yr.NonceTooHighError=yr.FeeCapTooLowError=yr.FeeCapTooHighError=yr.ExecutionRevertedError=void 0;const t=Fp(),e=_t();class r extends e.BaseError{constructor({cause:p,message:m}={}){var v;const b=(v=m==null?void 0:m.replace("execution reverted: ",""))==null?void 0:v.replace("execution reverted","");super(`Execution reverted ${b?`with reason: ${b}`:"for an unknown reason"}.`,{cause:p,name:"ExecutionRevertedError"})}}yr.ExecutionRevertedError=r,Object.defineProperty(r,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(r,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class n extends e.BaseError{constructor({cause:p,maxFeePerGas:m}={}){super(`The fee cap (\`maxFeePerGas\`${m?` = ${(0,t.formatGwei)(m)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:p,name:"FeeCapTooHighError"})}}yr.FeeCapTooHighError=n,Object.defineProperty(n,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class i extends e.BaseError{constructor({cause:p,maxFeePerGas:m}={}){super(`The fee cap (\`maxFeePerGas\`${m?` = ${(0,t.formatGwei)(m)}`:""} gwei) cannot be lower than the block base fee.`,{cause:p,name:"FeeCapTooLowError"})}}yr.FeeCapTooLowError=i,Object.defineProperty(i,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class s extends e.BaseError{constructor({cause:p,nonce:m}={}){super(`Nonce provided for the transaction ${m?`(${m}) `:""}is higher than the next one expected.`,{cause:p,name:"NonceTooHighError"})}}yr.NonceTooHighError=s,Object.defineProperty(s,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class o extends e.BaseError{constructor({cause:p,nonce:m}={}){super([`Nonce provided for the transaction ${m?`(${m}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(` `),{cause:p,name:"NonceTooLowError"})}}yr.NonceTooLowError=o,Object.defineProperty(o,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class a extends e.BaseError{constructor({cause:p,nonce:m}={}){super(`Nonce provided for the transaction ${m?`(${m}) `:""}exceeds the maximum allowed nonce.`,{cause:p,name:"NonceMaxValueError"})}}yr.NonceMaxValueError=a,Object.defineProperty(a,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class c extends e.BaseError{constructor({cause:p}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(` `),{cause:p,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}yr.InsufficientFundsError=c,Object.defineProperty(c,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class u extends e.BaseError{constructor({cause:p,gas:m}={}){super(`The amount of gas ${m?`(${m}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:p,name:"IntrinsicGasTooHighError"})}}yr.IntrinsicGasTooHighError=u,Object.defineProperty(u,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class l extends e.BaseError{constructor({cause:p,gas:m}={}){super(`The amount of gas ${m?`(${m}) `:""}provided for the transaction is too low.`,{cause:p,name:"IntrinsicGasTooLowError"})}}yr.IntrinsicGasTooLowError=l,Object.defineProperty(l,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class d extends e.BaseError{constructor({cause:p}){super("The transaction type is not supported for this chain.",{cause:p,name:"TransactionTypeNotSupportedError"})}}yr.TransactionTypeNotSupportedError=d,Object.defineProperty(d,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class h extends e.BaseError{constructor({cause:p,maxPriorityFeePerGas:m,maxFeePerGas:b}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${m?` = ${(0,t.formatGwei)(m)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${b?` = ${(0,t.formatGwei)(b)} gwei`:""}).`].join(` `),{cause:p,name:"TipAboveFeeCapError"})}}yr.TipAboveFeeCapError=h,Object.defineProperty(h,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class f extends e.BaseError{constructor({cause:p}){super(`An error occurred while executing: ${p==null?void 0:p.shortMessage}`,{cause:p,name:"UnknownNodeError"})}}return yr.UnknownNodeError=f,yr}var Pw={},QL;function S2(){if(QL)return Pw;QL=1,Object.defineProperty(Pw,"__esModule",{value:!0}),Pw.containsNodeError=i,Pw.getNodeError=s;const t=_t(),e=nl(),r=ha(),n=Xd();function i(o){return o instanceof n.TransactionRejectedRpcError||o instanceof n.InvalidInputRpcError||o instanceof r.RpcRequestError&&o.code===e.ExecutionRevertedError.code}function s(o,a){const c=(o.details||"").toLowerCase(),u=o instanceof t.BaseError?o.walk(l=>(l==null?void 0:l.code)===e.ExecutionRevertedError.code):o;return u instanceof t.BaseError?new e.ExecutionRevertedError({cause:o,message:u.details}):e.ExecutionRevertedError.nodeMessage.test(c)?new e.ExecutionRevertedError({cause:o,message:o.details}):e.FeeCapTooHighError.nodeMessage.test(c)?new e.FeeCapTooHighError({cause:o,maxFeePerGas:a==null?void 0:a.maxFeePerGas}):e.FeeCapTooLowError.nodeMessage.test(c)?new e.FeeCapTooLowError({cause:o,maxFeePerGas:a==null?void 0:a.maxFeePerGas}):e.NonceTooHighError.nodeMessage.test(c)?new e.NonceTooHighError({cause:o,nonce:a==null?void 0:a.nonce}):e.NonceTooLowError.nodeMessage.test(c)?new e.NonceTooLowError({cause:o,nonce:a==null?void 0:a.nonce}):e.NonceMaxValueError.nodeMessage.test(c)?new e.NonceMaxValueError({cause:o,nonce:a==null?void 0:a.nonce}):e.InsufficientFundsError.nodeMessage.test(c)?new e.InsufficientFundsError({cause:o}):e.IntrinsicGasTooHighError.nodeMessage.test(c)?new e.IntrinsicGasTooHighError({cause:o,gas:a==null?void 0:a.gas}):e.IntrinsicGasTooLowError.nodeMessage.test(c)?new e.IntrinsicGasTooLowError({cause:o,gas:a==null?void 0:a.gas}):e.TransactionTypeNotSupportedError.nodeMessage.test(c)?new e.TransactionTypeNotSupportedError({cause:o}):e.TipAboveFeeCapError.nodeMessage.test(c)?new e.TipAboveFeeCapError({cause:o,maxFeePerGas:a==null?void 0:a.maxFeePerGas,maxPriorityFeePerGas:a==null?void 0:a.maxPriorityFeePerGas}):new e.UnknownNodeError({cause:o})}return Pw}var XL;function FQ(){if(XL)return m_;XL=1,Object.defineProperty(m_,"__esModule",{value:!0}),m_.getEstimateGasError=n;const t=UQ(),e=nl(),r=S2();function n(i,{docsPath:s,...o}){const a=(()=>{const c=(0,r.getNodeError)(i,o);return c instanceof e.UnknownNodeError?i:c})();return new t.EstimateGasExecutionError(a,{docsPath:s,...o})}return m_}var w_={},eU;function _1(){if(eU)return w_;eU=1,Object.defineProperty(w_,"__esModule",{value:!0}),w_.extract=t;function t(e,{format:r}){if(!r)return{};const n={};function i(o){const a=Object.keys(o);for(const c of a)c in e&&(n[c]=e[c]),o[c]&&typeof o[c]=="object"&&!Array.isArray(o[c])&&i(o[c])}const s=r(e||{});return i(s),n}return w_}var vT={},b_={},tU;function T2(){if(tU)return b_;tU=1,Object.defineProperty(b_,"__esModule",{value:!0}),b_.defineFormatter=t;function t(e,r){return({exclude:n,format:i})=>({exclude:n,format:s=>{const o=r(s);if(n)for(const a of n)delete o[a];return{...o,...i(s)}},type:e})}return b_}var rU;function il(){return rU||(rU=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.defineTransactionRequest=t.rpcTransactionType=void 0,t.formatTransactionRequest=n;const e=ze(),r=T2();t.rpcTransactionType={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function n(s){const o={};return typeof s.authorizationList<"u"&&(o.authorizationList=i(s.authorizationList)),typeof s.accessList<"u"&&(o.accessList=s.accessList),typeof s.blobVersionedHashes<"u"&&(o.blobVersionedHashes=s.blobVersionedHashes),typeof s.blobs<"u"&&(typeof s.blobs[0]!="string"?o.blobs=s.blobs.map(a=>(0,e.bytesToHex)(a)):o.blobs=s.blobs),typeof s.data<"u"&&(o.data=s.data),typeof s.from<"u"&&(o.from=s.from),typeof s.gas<"u"&&(o.gas=(0,e.numberToHex)(s.gas)),typeof s.gasPrice<"u"&&(o.gasPrice=(0,e.numberToHex)(s.gasPrice)),typeof s.maxFeePerBlobGas<"u"&&(o.maxFeePerBlobGas=(0,e.numberToHex)(s.maxFeePerBlobGas)),typeof s.maxFeePerGas<"u"&&(o.maxFeePerGas=(0,e.numberToHex)(s.maxFeePerGas)),typeof s.maxPriorityFeePerGas<"u"&&(o.maxPriorityFeePerGas=(0,e.numberToHex)(s.maxPriorityFeePerGas)),typeof s.nonce<"u"&&(o.nonce=(0,e.numberToHex)(s.nonce)),typeof s.to<"u"&&(o.to=s.to),typeof s.type<"u"&&(o.type=t.rpcTransactionType[s.type]),typeof s.value<"u"&&(o.value=(0,e.numberToHex)(s.value)),o}t.defineTransactionRequest=(0,r.defineFormatter)("transactionRequest",n);function i(s){return s.map(o=>({address:o.address,r:o.r?(0,e.numberToHex)(BigInt(o.r)):o.r,s:o.s?(0,e.numberToHex)(BigInt(o.s)):o.s,chainId:(0,e.numberToHex)(o.chainId),nonce:(0,e.numberToHex)(o.nonce),...typeof o.yParity<"u"?{yParity:(0,e.numberToHex)(o.yParity)}:{},...typeof o.v<"u"&&typeof o.yParity>"u"?{v:(0,e.numberToHex)(o.v)}:{}}))}}(vT)),vT}var A0={},nU;function vO(){if(nU)return A0;nU=1,Object.defineProperty(A0,"__esModule",{value:!0}),A0.serializeStateMapping=s,A0.serializeAccountStateOverride=o,A0.serializeStateOverride=a;const t=la(),e=ZA(),r=wO(),n=is(),i=ze();function s(c){if(!(!c||c.length===0))return c.reduce((u,{slot:l,value:d})=>{if(l.length!==66)throw new e.InvalidBytesLengthError({size:l.length,targetSize:66,type:"hex"});if(d.length!==66)throw new e.InvalidBytesLengthError({size:d.length,targetSize:66,type:"hex"});return u[l]=d,u},{})}function o(c){const{balance:u,nonce:l,state:d,stateDiff:h,code:f}=c,g={};if(f!==void 0&&(g.code=f),u!==void 0&&(g.balance=(0,i.numberToHex)(u)),l!==void 0&&(g.nonce=(0,i.numberToHex)(l)),d!==void 0&&(g.state=s(d)),h!==void 0){if(g.state)throw new r.StateAssignmentConflictError;g.stateDiff=s(h)}return g}function a(c){if(!c)return;const u={};for(const{address:l,...d}of c){if(!(0,n.isAddress)(l,{strict:!1}))throw new t.InvalidAddressError({address:l});if(u[l])throw new r.AccountStateConflictError({address:l});u[l]=o(d)}return u}return A0}var y_={},Q={},iU;function _O(){return iU||(iU=1,Object.defineProperty(Q,"__esModule",{value:!0}),Q.minInt144=Q.minInt136=Q.minInt128=Q.minInt120=Q.minInt112=Q.minInt104=Q.minInt96=Q.minInt88=Q.minInt80=Q.minInt72=Q.minInt64=Q.minInt56=Q.minInt48=Q.minInt40=Q.minInt32=Q.minInt24=Q.minInt16=Q.minInt8=Q.maxInt256=Q.maxInt248=Q.maxInt240=Q.maxInt232=Q.maxInt224=Q.maxInt216=Q.maxInt208=Q.maxInt200=Q.maxInt192=Q.maxInt184=Q.maxInt176=Q.maxInt168=Q.maxInt160=Q.maxInt152=Q.maxInt144=Q.maxInt136=Q.maxInt128=Q.maxInt120=Q.maxInt112=Q.maxInt104=Q.maxInt96=Q.maxInt88=Q.maxInt80=Q.maxInt72=Q.maxInt64=Q.maxInt56=Q.maxInt48=Q.maxInt40=Q.maxInt32=Q.maxInt24=Q.maxInt16=Q.maxInt8=void 0,Q.maxUint256=Q.maxUint248=Q.maxUint240=Q.maxUint232=Q.maxUint224=Q.maxUint216=Q.maxUint208=Q.maxUint200=Q.maxUint192=Q.maxUint184=Q.maxUint176=Q.maxUint168=Q.maxUint160=Q.maxUint152=Q.maxUint144=Q.maxUint136=Q.maxUint128=Q.maxUint120=Q.maxUint112=Q.maxUint104=Q.maxUint96=Q.maxUint88=Q.maxUint80=Q.maxUint72=Q.maxUint64=Q.maxUint56=Q.maxUint48=Q.maxUint40=Q.maxUint32=Q.maxUint24=Q.maxUint16=Q.maxUint8=Q.minInt256=Q.minInt248=Q.minInt240=Q.minInt232=Q.minInt224=Q.minInt216=Q.minInt208=Q.minInt200=Q.minInt192=Q.minInt184=Q.minInt176=Q.minInt168=Q.minInt160=Q.minInt152=void 0,Q.maxInt8=2n**(8n-1n)-1n,Q.maxInt16=2n**(16n-1n)-1n,Q.maxInt24=2n**(24n-1n)-1n,Q.maxInt32=2n**(32n-1n)-1n,Q.maxInt40=2n**(40n-1n)-1n,Q.maxInt48=2n**(48n-1n)-1n,Q.maxInt56=2n**(56n-1n)-1n,Q.maxInt64=2n**(64n-1n)-1n,Q.maxInt72=2n**(72n-1n)-1n,Q.maxInt80=2n**(80n-1n)-1n,Q.maxInt88=2n**(88n-1n)-1n,Q.maxInt96=2n**(96n-1n)-1n,Q.maxInt104=2n**(104n-1n)-1n,Q.maxInt112=2n**(112n-1n)-1n,Q.maxInt120=2n**(120n-1n)-1n,Q.maxInt128=2n**(128n-1n)-1n,Q.maxInt136=2n**(136n-1n)-1n,Q.maxInt144=2n**(144n-1n)-1n,Q.maxInt152=2n**(152n-1n)-1n,Q.maxInt160=2n**(160n-1n)-1n,Q.maxInt168=2n**(168n-1n)-1n,Q.maxInt176=2n**(176n-1n)-1n,Q.maxInt184=2n**(184n-1n)-1n,Q.maxInt192=2n**(192n-1n)-1n,Q.maxInt200=2n**(200n-1n)-1n,Q.maxInt208=2n**(208n-1n)-1n,Q.maxInt216=2n**(216n-1n)-1n,Q.maxInt224=2n**(224n-1n)-1n,Q.maxInt232=2n**(232n-1n)-1n,Q.maxInt240=2n**(240n-1n)-1n,Q.maxInt248=2n**(248n-1n)-1n,Q.maxInt256=2n**(256n-1n)-1n,Q.minInt8=-(2n**(8n-1n)),Q.minInt16=-(2n**(16n-1n)),Q.minInt24=-(2n**(24n-1n)),Q.minInt32=-(2n**(32n-1n)),Q.minInt40=-(2n**(40n-1n)),Q.minInt48=-(2n**(48n-1n)),Q.minInt56=-(2n**(56n-1n)),Q.minInt64=-(2n**(64n-1n)),Q.minInt72=-(2n**(72n-1n)),Q.minInt80=-(2n**(80n-1n)),Q.minInt88=-(2n**(88n-1n)),Q.minInt96=-(2n**(96n-1n)),Q.minInt104=-(2n**(104n-1n)),Q.minInt112=-(2n**(112n-1n)),Q.minInt120=-(2n**(120n-1n)),Q.minInt128=-(2n**(128n-1n)),Q.minInt136=-(2n**(136n-1n)),Q.minInt144=-(2n**(144n-1n)),Q.minInt152=-(2n**(152n-1n)),Q.minInt160=-(2n**(160n-1n)),Q.minInt168=-(2n**(168n-1n)),Q.minInt176=-(2n**(176n-1n)),Q.minInt184=-(2n**(184n-1n)),Q.minInt192=-(2n**(192n-1n)),Q.minInt200=-(2n**(200n-1n)),Q.minInt208=-(2n**(208n-1n)),Q.minInt216=-(2n**(216n-1n)),Q.minInt224=-(2n**(224n-1n)),Q.minInt232=-(2n**(232n-1n)),Q.minInt240=-(2n**(240n-1n)),Q.minInt248=-(2n**(248n-1n)),Q.minInt256=-(2n**(256n-1n)),Q.maxUint8=2n**8n-1n,Q.maxUint16=2n**16n-1n,Q.maxUint24=2n**24n-1n,Q.maxUint32=2n**32n-1n,Q.maxUint40=2n**40n-1n,Q.maxUint48=2n**48n-1n,Q.maxUint56=2n**56n-1n,Q.maxUint64=2n**64n-1n,Q.maxUint72=2n**72n-1n,Q.maxUint80=2n**80n-1n,Q.maxUint88=2n**88n-1n,Q.maxUint96=2n**96n-1n,Q.maxUint104=2n**104n-1n,Q.maxUint112=2n**112n-1n,Q.maxUint120=2n**120n-1n,Q.maxUint128=2n**128n-1n,Q.maxUint136=2n**136n-1n,Q.maxUint144=2n**144n-1n,Q.maxUint152=2n**152n-1n,Q.maxUint160=2n**160n-1n,Q.maxUint168=2n**168n-1n,Q.maxUint176=2n**176n-1n,Q.maxUint184=2n**184n-1n,Q.maxUint192=2n**192n-1n,Q.maxUint200=2n**200n-1n,Q.maxUint208=2n**208n-1n,Q.maxUint216=2n**216n-1n,Q.maxUint224=2n**224n-1n,Q.maxUint232=2n**232n-1n,Q.maxUint240=2n**240n-1n,Q.maxUint248=2n**248n-1n,Q.maxUint256=2n**256n-1n),Q}var sU;function sl(){if(sU)return y_;sU=1,Object.defineProperty(y_,"__esModule",{value:!0}),y_.assertRequest=o;const t=sn(),e=_O(),r=la(),n=nl(),i=Ds(),s=is();function o(a){const{account:c,gasPrice:u,maxFeePerGas:l,maxPriorityFeePerGas:d,to:h}=a,f=c?(0,t.parseAccount)(c):void 0;if(f&&!(0,s.isAddress)(f.address))throw new r.InvalidAddressError({address:f.address});if(h&&!(0,s.isAddress)(h))throw new r.InvalidAddressError({address:h});if(typeof u<"u"&&(typeof l<"u"||typeof d<"u"))throw new i.FeeConflictError;if(l&&l>e.maxUint256)throw new n.FeeCapTooHighError({maxFeePerGas:l});if(d&&l&&d>l)throw new n.TipAboveFeeCapError({maxFeePerGas:l,maxPriorityFeePerGas:d})}return y_}var _T={},Ow={},Fc={},oU;function ix(){if(oU)return Fc;oU=1,Object.defineProperty(Fc,"__esModule",{value:!0}),Fc.MaxFeePerGasTooLowError=Fc.Eip1559FeesNotSupportedError=Fc.BaseFeeScalarError=void 0;const t=Fp(),e=_t();class r extends e.BaseError{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}Fc.BaseFeeScalarError=r;class n extends e.BaseError{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}Fc.Eip1559FeesNotSupportedError=n;class i extends e.BaseError{constructor({maxPriorityFeePerGas:o}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${(0,t.formatGwei)(o)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}return Fc.MaxFeePerGasTooLowError=i,Fc}var Rw={},v_={},kw={},aU;function EO(){if(aU)return kw;aU=1,Object.defineProperty(kw,"__esModule",{value:!0}),kw.BlockNotFoundError=void 0;const t=_t();class e extends t.BaseError{constructor({blockHash:n,blockNumber:i}){let s="Block";n&&(s=`Block at hash "${n}"`),i&&(s=`Block at number "${i}"`),super(`${s} could not be found.`,{name:"BlockNotFoundError"})}}return kw.BlockNotFoundError=e,kw}var x0={},ET={},cU;function I2(){return cU||(cU=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.defineTransaction=t.transactionType=void 0,t.formatTransaction=n;const e=nn(),r=T2();t.transactionType={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function n(s){const o={...s,blockHash:s.blockHash?s.blockHash:null,blockNumber:s.blockNumber?BigInt(s.blockNumber):null,chainId:s.chainId?(0,e.hexToNumber)(s.chainId):void 0,gas:s.gas?BigInt(s.gas):void 0,gasPrice:s.gasPrice?BigInt(s.gasPrice):void 0,maxFeePerBlobGas:s.maxFeePerBlobGas?BigInt(s.maxFeePerBlobGas):void 0,maxFeePerGas:s.maxFeePerGas?BigInt(s.maxFeePerGas):void 0,maxPriorityFeePerGas:s.maxPriorityFeePerGas?BigInt(s.maxPriorityFeePerGas):void 0,nonce:s.nonce?(0,e.hexToNumber)(s.nonce):void 0,to:s.to?s.to:null,transactionIndex:s.transactionIndex?Number(s.transactionIndex):null,type:s.type?t.transactionType[s.type]:void 0,typeHex:s.type?s.type:void 0,value:s.value?BigInt(s.value):void 0,v:s.v?BigInt(s.v):void 0};return s.authorizationList&&(o.authorizationList=i(s.authorizationList)),o.yParity=(()=>{if(s.yParity)return Number(s.yParity);if(typeof o.v=="bigint"){if(o.v===0n||o.v===27n)return 0;if(o.v===1n||o.v===28n)return 1;if(o.v>=35n)return o.v%2n===0n?1:0}})(),o.type==="legacy"&&(delete o.accessList,delete o.maxFeePerBlobGas,delete o.maxFeePerGas,delete o.maxPriorityFeePerGas,delete o.yParity),o.type==="eip2930"&&(delete o.maxFeePerBlobGas,delete o.maxFeePerGas,delete o.maxPriorityFeePerGas),o.type==="eip1559"&&delete o.maxFeePerBlobGas,o}t.defineTransaction=(0,r.defineFormatter)("transaction",n);function i(s){return s.map(o=>({address:o.address,chainId:Number(o.chainId),nonce:Number(o.nonce),r:o.r,s:o.s,yParity:Number(o.yParity)}))}}(ET)),ET}var uU;function sx(){if(uU)return x0;uU=1,Object.defineProperty(x0,"__esModule",{value:!0}),x0.defineBlock=void 0,x0.formatBlock=r;const t=T2(),e=I2();function r(n){const i=(n.transactions??[]).map(s=>typeof s=="string"?s:(0,e.formatTransaction)(s));return{...n,baseFeePerGas:n.baseFeePerGas?BigInt(n.baseFeePerGas):null,blobGasUsed:n.blobGasUsed?BigInt(n.blobGasUsed):void 0,difficulty:n.difficulty?BigInt(n.difficulty):void 0,excessBlobGas:n.excessBlobGas?BigInt(n.excessBlobGas):void 0,gasLimit:n.gasLimit?BigInt(n.gasLimit):void 0,gasUsed:n.gasUsed?BigInt(n.gasUsed):void 0,hash:n.hash?n.hash:null,logsBloom:n.logsBloom?n.logsBloom:null,nonce:n.nonce?n.nonce:null,number:n.number?BigInt(n.number):null,size:n.size?BigInt(n.size):void 0,timestamp:n.timestamp?BigInt(n.timestamp):void 0,transactions:i,totalDifficulty:n.totalDifficulty?BigInt(n.totalDifficulty):null}}return x0.defineBlock=(0,t.defineFormatter)("block",r),x0}var lU;function E1(){if(lU)return v_;lU=1,Object.defineProperty(v_,"__esModule",{value:!0}),v_.getBlock=n;const t=EO(),e=ze(),r=sx();async function n(i,{blockHash:s,blockNumber:o,blockTag:a,includeTransactions:c}={}){var g,p,m;const u=a??"latest",l=c??!1,d=o!==void 0?(0,e.numberToHex)(o):void 0;let h=null;if(s?h=await i.request({method:"eth_getBlockByHash",params:[s,l]},{dedupe:!0}):h=await i.request({method:"eth_getBlockByNumber",params:[d||u,l]},{dedupe:!!d}),!h)throw new t.BlockNotFoundError({blockHash:s,blockNumber:o});return(((m=(p=(g=i.chain)==null?void 0:g.formatters)==null?void 0:p.block)==null?void 0:m.format)||r.formatBlock)(h)}return v_}var __={},dU;function CO(){if(dU)return __;dU=1,Object.defineProperty(__,"__esModule",{value:!0}),__.getGasPrice=t;async function t(e){const r=await e.request({method:"eth_gasPrice"});return BigInt(r)}return __}var hU;function HQ(){if(hU)return Rw;hU=1,Object.defineProperty(Rw,"__esModule",{value:!0}),Rw.estimateMaxPriorityFeePerGas=s,Rw.internal_estimateMaxPriorityFeePerGas=o;const t=ix(),e=nn(),r=ur(),n=E1(),i=CO();async function s(a,c){return o(a,c)}async function o(a,c){var h,f;const{block:u,chain:l=a.chain,request:d}=c||{};try{const g=((h=l==null?void 0:l.fees)==null?void 0:h.maxPriorityFeePerGas)??((f=l==null?void 0:l.fees)==null?void 0:f.defaultPriorityFee);if(typeof g=="function"){const m=u||await(0,r.getAction)(a,n.getBlock,"getBlock")({}),b=await g({block:m,client:a,request:d});if(b===null)throw new Error;return b}if(typeof g<"u")return g;const p=await a.request({method:"eth_maxPriorityFeePerGas"});return(0,e.hexToBigInt)(p)}catch{const[g,p]=await Promise.all([u?Promise.resolve(u):(0,r.getAction)(a,n.getBlock,"getBlock")({}),(0,r.getAction)(a,i.getGasPrice,"getGasPrice")({})]);if(typeof g.baseFeePerGas!="bigint")throw new t.Eip1559FeesNotSupportedError;const m=p-g.baseFeePerGas;return m<0n?0n:m}}return Rw}var fU;function qQ(){if(fU)return Ow;fU=1,Object.defineProperty(Ow,"__esModule",{value:!0}),Ow.estimateFeesPerGas=s,Ow.internal_estimateFeesPerGas=o;const t=ix(),e=ur(),r=HQ(),n=E1(),i=CO();async function s(a,c){return o(a,c)}async function o(a,c){var E,w;const{block:u,chain:l=a.chain,request:d,type:h="eip1559"}=c||{},f=await(async()=>{var C,y;return typeof((C=l==null?void 0:l.fees)==null?void 0:C.baseFeeMultiplier)=="function"?l.fees.baseFeeMultiplier({block:u,client:a,request:d}):((y=l==null?void 0:l.fees)==null?void 0:y.baseFeeMultiplier)??1.2})();if(f<1)throw new t.BaseFeeScalarError;const p=10**(((E=f.toString().split(".")[1])==null?void 0:E.length)??0),m=C=>C*BigInt(Math.ceil(f*p))/BigInt(p),b=u||await(0,e.getAction)(a,n.getBlock,"getBlock")({});if(typeof((w=l==null?void 0:l.fees)==null?void 0:w.estimateFeesPerGas)=="function"){const C=await l.fees.estimateFeesPerGas({block:u,client:a,multiply:m,request:d,type:h});if(C!==null)return C}if(h==="eip1559"){if(typeof b.baseFeePerGas!="bigint")throw new t.Eip1559FeesNotSupportedError;const C=typeof(d==null?void 0:d.maxPriorityFeePerGas)=="bigint"?d.maxPriorityFeePerGas:await(0,r.internal_estimateMaxPriorityFeePerGas)(a,{block:b,chain:l,request:d}),y=m(b.baseFeePerGas);return{maxFeePerGas:(d==null?void 0:d.maxFeePerGas)??y+C,maxPriorityFeePerGas:C}}return{gasPrice:(d==null?void 0:d.gasPrice)??m(await(0,e.getAction)(a,i.getGasPrice,"getGasPrice")({}))}}return Ow}var E_={},pU;function ox(){if(pU)return E_;pU=1,Object.defineProperty(E_,"__esModule",{value:!0}),E_.getTransactionCount=r;const t=nn(),e=ze();async function r(n,{address:i,blockTag:s="latest",blockNumber:o}){const a=await n.request({method:"eth_getTransactionCount",params:[i,typeof o=="bigint"?(0,e.numberToHex)(o):s]},{dedupe:!!o});return(0,t.hexToNumber)(a)}return E_}var C_={},gU;function ax(){if(gU)return C_;gU=1,Object.defineProperty(C_,"__esModule",{value:!0}),C_.blobsToCommitments=r;const t=Tr(),e=ze();function r(n){const{kzg:i}=n,s=n.to??(typeof n.blobs[0]=="string"?"hex":"bytes"),o=typeof n.blobs[0]=="string"?n.blobs.map(c=>(0,t.hexToBytes)(c)):n.blobs,a=[];for(const c of o)a.push(Uint8Array.from(i.blobToKzgCommitment(c)));return s==="bytes"?a:a.map(c=>(0,e.bytesToHex)(c))}return C_}var A_={},mU;function cx(){if(mU)return A_;mU=1,Object.defineProperty(A_,"__esModule",{value:!0}),A_.blobsToProofs=r;const t=Tr(),e=ze();function r(n){const{kzg:i}=n,s=n.to??(typeof n.blobs[0]=="string"?"hex":"bytes"),o=typeof n.blobs[0]=="string"?n.blobs.map(u=>(0,t.hexToBytes)(u)):n.blobs,a=typeof n.commitments[0]=="string"?n.commitments.map(u=>(0,t.hexToBytes)(u)):n.commitments,c=[];for(let u=0;u(0,e.bytesToHex)(u))}return A_}var x_={},S_={},T_={},Eo={},wU;function zQ(){if(wU)return Eo;wU=1,Object.defineProperty(Eo,"__esModule",{value:!0}),Eo.sha224=Eo.SHA224=Eo.sha256=Eo.SHA256=void 0;const t=DQ();return Eo.SHA256=t.SHA256,Eo.sha256=t.sha256,Eo.SHA224=t.SHA224,Eo.sha224=t.sha224,Eo}var bU;function AO(){if(bU)return T_;bU=1,Object.defineProperty(T_,"__esModule",{value:!0}),T_.sha256=i;const t=zQ(),e=ki(),r=Tr(),n=ze();function i(s,o){const a=o||"hex",c=(0,t.sha256)((0,e.isHex)(s,{strict:!1})?(0,r.toBytes)(s):s);return a==="bytes"?c:(0,n.toHex)(c)}return T_}var yU;function xO(){if(yU)return S_;yU=1,Object.defineProperty(S_,"__esModule",{value:!0}),S_.commitmentToVersionedHash=r;const t=ze(),e=AO();function r(n){const{commitment:i,version:s=1}=n,o=n.to??(typeof i=="string"?"hex":"bytes"),a=(0,e.sha256)(i,"bytes");return a.set([s],0),o==="bytes"?a:(0,t.bytesToHex)(a)}return S_}var vU;function SO(){if(vU)return x_;vU=1,Object.defineProperty(x_,"__esModule",{value:!0}),x_.commitmentsToVersionedHashes=e;const t=xO();function e(r){const{commitments:n,version:i}=r,s=r.to??(typeof n[0]=="string"?"hex":"bytes"),o=[];for(const a of n)o.push((0,t.commitmentToVersionedHash)({commitment:a,to:s,version:i}));return o}return x_}var I_={},P_={},CT={},_U;function mIe(){return _U||(_U=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.maxBytesPerTransaction=t.bytesPerBlob=t.fieldElementsPerBlob=t.bytesPerFieldElement=void 0;const e=6;t.bytesPerFieldElement=32,t.fieldElementsPerBlob=4096,t.bytesPerBlob=t.bytesPerFieldElement*t.fieldElementsPerBlob,t.maxBytesPerTransaction=t.bytesPerBlob*e-1-1*t.fieldElementsPerBlob*e}(CT)),CT}var Co={},Nw={},EU;function WQ(){return EU||(EU=1,Object.defineProperty(Nw,"__esModule",{value:!0}),Nw.versionedHashVersionKzg=void 0,Nw.versionedHashVersionKzg=1),Nw}var CU;function VQ(){if(CU)return Co;CU=1,Object.defineProperty(Co,"__esModule",{value:!0}),Co.InvalidVersionedHashVersionError=Co.InvalidVersionedHashSizeError=Co.EmptyBlobError=Co.BlobSizeTooLargeError=void 0;const t=WQ(),e=_t();class r extends e.BaseError{constructor({maxSize:a,size:c}){super("Blob size is too large.",{metaMessages:[`Max: ${a} bytes`,`Given: ${c} bytes`],name:"BlobSizeTooLargeError"})}}Co.BlobSizeTooLargeError=r;class n extends e.BaseError{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}Co.EmptyBlobError=n;class i extends e.BaseError{constructor({hash:a,size:c}){super(`Versioned hash "${a}" size is invalid.`,{metaMessages:["Expected: 32",`Received: ${c}`],name:"InvalidVersionedHashSizeError"})}}Co.InvalidVersionedHashSizeError=i;class s extends e.BaseError{constructor({hash:a,version:c}){super(`Versioned hash "${a}" version is invalid.`,{metaMessages:[`Expected: ${t.versionedHashVersionKzg}`,`Received: ${c}`],name:"InvalidVersionedHashVersionError"})}}return Co.InvalidVersionedHashVersionError=s,Co}var AU;function GQ(){if(AU)return P_;AU=1,Object.defineProperty(P_,"__esModule",{value:!0}),P_.toBlobs=o;const t=mIe(),e=VQ(),r=v2(),n=rs(),i=Tr(),s=ze();function o(a){const c=a.to??(typeof a.data=="string"?"hex":"bytes"),u=typeof a.data=="string"?(0,i.hexToBytes)(a.data):a.data,l=(0,n.size)(u);if(!l)throw new e.EmptyBlobError;if(l>t.maxBytesPerTransaction)throw new e.BlobSizeTooLargeError({maxSize:t.maxBytesPerTransaction,size:l});const d=[];let h=!0,f=0;for(;h;){const g=(0,r.createCursor)(new Uint8Array(t.bytesPerBlob));let p=0;for(;pg.bytes):d.map(g=>(0,s.bytesToHex)(g.bytes))}return P_}var xU;function ux(){if(xU)return I_;xU=1,Object.defineProperty(I_,"__esModule",{value:!0}),I_.toBlobSidecars=n;const t=ax(),e=cx(),r=GQ();function n(i){const{data:s,kzg:o,to:a}=i,c=i.blobs??(0,r.toBlobs)({data:s,to:a}),u=i.commitments??(0,t.blobsToCommitments)({blobs:c,kzg:o,to:a}),l=i.proofs??(0,e.blobsToProofs)({blobs:c,commitments:u,kzg:o,to:a}),d=[];for(let h=0;h"u"&&O)if(x){const I=await P();k.nonce=await x.consume({address:O.address,chainId:I,client:m})}else k.nonce=await(0,d.getAction)(m,s.getTransactionCount,"getTransactionCount")({address:O.address,blockTag:"pending"});if((A.includes("blobVersionedHashes")||A.includes("sidecars"))&&E&&y){const I=(0,a.blobsToCommitments)({blobs:E,kzg:y});if(A.includes("blobVersionedHashes")){const B=(0,u.commitmentsToVersionedHashes)({commitments:I,to:"hex"});k.blobVersionedHashes=B}if(A.includes("sidecars")){const B=(0,c.blobsToProofs)({blobs:E,commitments:I,kzg:y}),$=(0,l.toBlobSidecars)({blobs:E,commitments:I,proofs:B,to:"hex"});k.sidecars=$}}if(A.includes("chainId")&&(k.chainId=await P()),(A.includes("fees")||A.includes("type"))&&typeof T>"u")try{k.type=(0,f.getTransactionType)(k)}catch{let I=t.eip1559NetworkCache.get(m.uid);if(typeof I>"u"){const B=await N();I=typeof(B==null?void 0:B.baseFeePerGas)=="bigint",t.eip1559NetworkCache.set(m.uid,I)}k.type=I?"eip1559":"legacy"}if(A.includes("fees"))if(k.type!=="legacy"&&k.type!=="eip2930"){if(typeof k.maxFeePerGas>"u"||typeof k.maxPriorityFeePerGas>"u"){const I=await N(),{maxFeePerGas:B,maxPriorityFeePerGas:$}=await(0,r.internal_estimateFeesPerGas)(m,{block:I,chain:w,request:k});if(typeof b.maxPriorityFeePerGas>"u"&&b.maxFeePerGas&&b.maxFeePerGas<$)throw new o.MaxFeePerGasTooLowError({maxPriorityFeePerGas:$});k.maxPriorityFeePerGas=$,k.maxFeePerGas=B}}else{if(typeof b.maxFeePerGas<"u"||typeof b.maxPriorityFeePerGas<"u")throw new o.Eip1559FeesNotSupportedError;if(typeof b.gasPrice>"u"){const I=await N(),{gasPrice:B}=await(0,r.internal_estimateFeesPerGas)(m,{block:I,chain:w,request:k,type:"legacy"});k.gasPrice=B}}return A.includes("gas")&&typeof C>"u"&&(k.gas=await(0,d.getAction)(m,n.estimateGas,"estimateGas")({...k,account:O&&{address:O.address,type:"json-rpc"}})),(0,h.assertRequest)(k),delete k.parameters,k}}(_T)),_T}var k_={},PU;function KQ(){if(PU)return k_;PU=1,Object.defineProperty(k_,"__esModule",{value:!0}),k_.getBalance=e;const t=ze();async function e(r,{address:n,blockNumber:i,blockTag:s="latest"}){const o=typeof i=="bigint"?(0,t.numberToHex)(i):void 0,a=await r.request({method:"eth_getBalance",params:[n,o||s]});return BigInt(a)}return k_}var OU;function TO(){if(OU)return l_;OU=1,Object.defineProperty(l_,"__esModule",{value:!0}),l_.estimateGas=d;const t=sn(),e=_t(),r=nx(),n=ze(),i=FQ(),s=_1(),o=il(),a=vO(),c=sl(),u=dx(),l=KQ();async function d(h,f){var b,v,E;const{account:g=h.account}=f,p=g?(0,t.parseAccount)(g):void 0;try{let J=function(ae){const{block:he,request:ie,rpcStateOverride:Ee}=ae;return h.request({method:"eth_estimateGas",params:Ee?[ie,he??"latest",Ee]:he?[ie,he]:[ie]})};var m=J;const{accessList:w,authorizationList:C,blobs:y,blobVersionedHashes:_,blockNumber:x,blockTag:A,data:T,gas:O,gasPrice:k,maxFeePerBlobGas:j,maxFeePerGas:N,maxPriorityFeePerGas:S,nonce:P,value:I,stateOverride:B,...$}=await(0,u.prepareTransactionRequest)(h,{...f,parameters:(p==null?void 0:p.type)==="local"?void 0:["blobVersionedHashes"]}),D=(typeof x=="bigint"?(0,n.numberToHex)(x):void 0)||A,L=(0,a.serializeStateOverride)(B),U=await(async()=>{if($.to)return $.to;if(C&&C.length>0)return await(0,r.recoverAuthorizationAddress)({authorization:C[0]}).catch(()=>{throw new e.BaseError("`to` is required. Could not infer from `authorizationList`")})})();(0,c.assertRequest)(f);const z=(E=(v=(b=h.chain)==null?void 0:b.formatters)==null?void 0:v.transactionRequest)==null?void 0:E.format,K=(z||o.formatTransactionRequest)({...(0,s.extract)($,{format:z}),from:p==null?void 0:p.address,accessList:w,authorizationList:C,blobs:y,blobVersionedHashes:_,data:T,gas:O,gasPrice:k,maxFeePerBlobGas:j,maxFeePerGas:N,maxPriorityFeePerGas:S,nonce:P,to:U,value:I});let ne=BigInt(await J({block:D,request:K,rpcStateOverride:L}));if(C){const ae=await(0,l.getBalance)(h,{address:K.from}),he=await Promise.all(C.map(async ie=>{const{address:Ee}=ie,pe=await J({block:D,request:{authorizationList:void 0,data:T,from:p==null?void 0:p.address,to:Ee,value:(0,n.numberToHex)(ae)},rpcStateOverride:L}).catch(()=>100000n);return 2n*BigInt(pe)}));ne+=he.reduce((ie,Ee)=>ie+Ee,0n)}return ne}catch(w){throw(0,i.getEstimateGasError)(w,{...f,account:p,chain:h.chain})}}return l_}var RU;function ZQ(){if(RU)return Q3;RU=1,Object.defineProperty(Q3,"__esModule",{value:!0}),Q3.estimateContractGas=s;const t=sn(),e=Bs(),r=eh(),n=ur(),i=TO();async function s(o,a){const{abi:c,address:u,args:l,functionName:d,dataSuffix:h,...f}=a,g=(0,e.encodeFunctionData)({abi:c,args:l,functionName:d});try{return await(0,n.getAction)(o,i.estimateGas,"estimateGas")({data:`${g}${h?h.replace("0x",""):""}`,to:u,...f})}catch(p){const m=f.account?(0,t.parseAccount)(f.account):void 0;throw(0,r.getContractError)(p,{abi:c,address:u,args:l,docsPath:"/docs/contract/estimateContractGas",functionName:d,sender:m==null?void 0:m.address})}}return Q3}var N_={},$_={},j_={},B_={},kU;function fa(){if(kU)return B_;kU=1,Object.defineProperty(B_,"__esModule",{value:!0}),B_.isAddressEqual=r;const t=la(),e=is();function r(n,i){if(!(0,e.isAddress)(n,{strict:!1}))throw new t.InvalidAddressError({address:n});if(!(0,e.isAddress)(i,{strict:!1}))throw new t.InvalidAddressError({address:i});return n.toLowerCase()===i.toLowerCase()}return B_}var D_={},NU;function P2(){if(NU)return D_;NU=1,Object.defineProperty(D_,"__esModule",{value:!0}),D_.decodeEventLog=a;const t=$r(),e=rs(),r=v1(),n=NQ(),i=Jd(),s=el(),o="/docs/contract/decodeEventLog";function a(u){const{abi:l,data:d,strict:h,topics:f}=u,g=h??!0,[p,...m]=f;if(!p)throw new t.AbiEventSignatureEmptyTopicsError({docsPath:o});const b=l.find(x=>x.type==="event"&&p===(0,r.toEventSelector)((0,s.formatAbiItem)(x)));if(!(b&&"name"in b)||b.type!=="event")throw new t.AbiEventSignatureNotFoundError(p,{docsPath:o});const{name:v,inputs:E}=b,w=E==null?void 0:E.some(x=>!("name"in x&&x.name)),C=w?[]:{},y=E.map((x,A)=>[x,A]).filter(([x])=>"indexed"in x&&x.indexed);for(let x=0;x!("indexed"in x&&x.indexed));if(_.length>0){if(d&&d!=="0x")try{const x=(0,i.decodeAbiParameters)(_,d);if(x)if(w)for(let A=0;A0?C:void 0}}function c({param:u,value:l}){return u.type==="string"||u.type==="bytes"||u.type==="tuple"||u.type.match(/^(.*)\[(\d+)?\]$/)?l:((0,i.decodeAbiParameters)([u],l)||[])[0]}return D_}var $U;function O2(){if($U)return j_;$U=1,Object.defineProperty(j_,"__esModule",{value:!0}),j_.parseEventLogs=o;const t=$r(),e=fa(),r=Tr(),n=ns(),i=v1(),s=P2();function o(c){const{abi:u,args:l,logs:d,strict:h=!0}=c,f=(()=>{if(c.eventName)return Array.isArray(c.eventName)?c.eventName:[c.eventName]})();return d.map(g=>{var p;try{const m=u.find(v=>v.type==="event"&&g.topics[0]===(0,i.toEventSelector)(v));if(!m)return null;const b=(0,s.decodeEventLog)({...g,abi:[m],strict:h});return f&&!f.includes(b.eventName)||!a({args:b.args,inputs:m.inputs,matchArgs:l})?null:{...b,...g}}catch(m){let b,v;if(m instanceof t.AbiEventSignatureNotFoundError)return null;if(m instanceof t.DecodeLogDataMismatch||m instanceof t.DecodeLogTopicsMismatch){if(h)return null;b=m.abiItem.name,v=(p=m.abiItem.inputs)==null?void 0:p.some(E=>!("name"in E&&E.name))}return{...g,args:v?[]:{},eventName:b}}}).filter(Boolean)}function a(c){const{args:u,inputs:l,matchArgs:d}=c;if(!d)return!0;if(!u)return!1;function h(f,g,p){try{return f.type==="address"?(0,e.isAddressEqual)(g,p):f.type==="string"||f.type==="bytes"?(0,n.keccak256)((0,r.toBytes)(g))===p:g===p}catch{return!1}}return Array.isArray(u)&&Array.isArray(d)?d.every((f,g)=>{if(f==null)return!0;const p=l[g];return p?(Array.isArray(f)?f:[f]).some(b=>h(p,b,u[g])):!1}):typeof u=="object"&&!Array.isArray(u)&&typeof d=="object"&&!Array.isArray(d)?Object.entries(d).every(([f,g])=>{if(g==null)return!0;const p=l.find(b=>b.name===f);return p?(Array.isArray(g)?g:[g]).some(b=>h(p,b,u[f])):!1}):!1}return j_}var M_={},jU;function ol(){if(jU)return M_;jU=1,Object.defineProperty(M_,"__esModule",{value:!0}),M_.formatLog=t;function t(e,{args:r,eventName:n}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...n?{args:r,eventName:n}:{}}}return M_}var BU;function IO(){if(BU)return $_;BU=1,Object.defineProperty($_,"__esModule",{value:!0}),$_.getLogs=i;const t=Up(),e=O2(),r=ze(),n=ol();async function i(s,{address:o,blockHash:a,fromBlock:c,toBlock:u,event:l,events:d,args:h,strict:f}={}){const g=f??!1,p=d??(l?[l]:void 0);let m=[];p&&(m=[p.flatMap(w=>(0,t.encodeEventTopics)({abi:[w],eventName:w.name,args:d?void 0:h}))],l&&(m=m[0]));let b;a?b=await s.request({method:"eth_getLogs",params:[{address:o,topics:m,blockHash:a}]}):b=await s.request({method:"eth_getLogs",params:[{address:o,topics:m,fromBlock:typeof c=="bigint"?(0,r.numberToHex)(c):c,toBlock:typeof u=="bigint"?(0,r.numberToHex)(u):u}]});const v=b.map(E=>(0,n.formatLog)(E));return p?(0,e.parseEventLogs)({abi:p,args:h,logs:v,strict:g}):v}return $_}var DU;function PO(){if(DU)return N_;DU=1,Object.defineProperty(N_,"__esModule",{value:!0}),N_.getContractEvents=n;const t=rl(),e=ur(),r=IO();async function n(i,s){const{abi:o,address:a,args:c,blockHash:u,eventName:l,fromBlock:d,toBlock:h,strict:f}=s,g=l?(0,t.getAbiItem)({abi:o,name:l}):void 0,p=g?void 0:o.filter(m=>m.type==="event");return(0,e.getAction)(i,r.getLogs,"getLogs")({address:a,args:c,blockHash:u,event:g,events:p,fromBlock:d,toBlock:h,strict:f})}return N_}var L_={},U_={},MU;function al(){if(MU)return U_;MU=1,Object.defineProperty(U_,"__esModule",{value:!0}),U_.decodeFunctionResult=i;const t=$r(),e=Jd(),r=rl(),n="/docs/contract/decodeFunctionResult";function i(s){const{abi:o,args:a,functionName:c,data:u}=s;let l=o[0];if(c){const h=(0,r.getAbiItem)({abi:o,args:a,name:c});if(!h)throw new t.AbiFunctionNotFoundError(c,{docsPath:n});l=h}if(l.type!=="function")throw new t.AbiFunctionNotFoundError(void 0,{docsPath:n});if(!l.outputs)throw new t.AbiFunctionOutputsNotFoundError(l.name,{docsPath:n});const d=(0,e.decodeAbiParameters)(l.outputs,u);if(d&&d.length>1)return d;if(d&&d.length===1)return d[0]}return U_}var $w={},jw={},Ct={},Gt={},LU;function YQ(){if(LU)return Gt;LU=1;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(Gt,"__esModule",{value:!0}),Gt.notImplemented=Gt.bitMask=void 0,Gt.isBytes=n,Gt.abytes=i,Gt.abool=s,Gt.bytesToHex=a,Gt.numberToHexUnpadded=c,Gt.hexToNumber=u,Gt.hexToBytes=h,Gt.bytesToNumberBE=f,Gt.bytesToNumberLE=g,Gt.numberToBytesBE=p,Gt.numberToBytesLE=m,Gt.numberToVarBytesBE=b,Gt.ensureBytes=v,Gt.concatBytes=E,Gt.equalBytes=w,Gt.utf8ToBytes=C,Gt.inRange=_,Gt.aInRange=x,Gt.bitLen=A,Gt.bitGet=T,Gt.bitSet=O,Gt.createHmacDrbg=S,Gt.validateObject=I,Gt.memoized=$;const t=BigInt(0),e=BigInt(1),r=BigInt(2);function n(R){return R instanceof Uint8Array||ArrayBuffer.isView(R)&&R.constructor.name==="Uint8Array"}function i(R){if(!n(R))throw new Error("Uint8Array expected")}function s(R,D){if(typeof D!="boolean")throw new Error(R+" boolean expected, got "+D)}const o=Array.from({length:256},(R,D)=>D.toString(16).padStart(2,"0"));function a(R){i(R);let D="";for(let L=0;L=l._0&&R<=l._9)return R-l._0;if(R>=l.A&&R<=l.F)return R-(l.A-10);if(R>=l.a&&R<=l.f)return R-(l.a-10)}function h(R){if(typeof R!="string")throw new Error("hex string expected, got "+typeof R);const D=R.length,L=D/2;if(D%2)throw new Error("hex string expected, got unpadded hex of length "+D);const U=new Uint8Array(L);for(let z=0,W=0;ztypeof R=="bigint"&&t<=R;function _(R,D,L){return y(R)&&y(D)&&y(L)&&D<=R&&Rt;R>>=e,D+=1);return D}function T(R,D){return R>>BigInt(D)&e}function O(R,D,L){return R|(L?e:t)<(r<new Uint8Array(R),N=R=>Uint8Array.from(R);function S(R,D,L){if(typeof R!="number"||R<2)throw new Error("hashLen must be a number");if(typeof D!="number"||D<2)throw new Error("qByteLen must be a number");if(typeof L!="function")throw new Error("hmacFn must be a function");let U=j(R),z=j(R),W=0;const K=()=>{U.fill(1),z.fill(0),W=0},J=(...ie)=>L(z,U,...ie),ne=(ie=j())=>{z=J(N([0]),ie),U=J(),ie.length!==0&&(z=J(N([1]),ie),U=J())},ae=()=>{if(W++>=1e3)throw new Error("drbg: tried 1000 values");let ie=0;const Ee=[];for(;ie{K(),ne(ie);let pe;for(;!(pe=Ee(ae()));)ne();return K(),pe}}const P={bigint:R=>typeof R=="bigint",function:R=>typeof R=="function",boolean:R=>typeof R=="boolean",string:R=>typeof R=="string",stringOrUint8Array:R=>typeof R=="string"||n(R),isSafeInteger:R=>Number.isSafeInteger(R),array:R=>Array.isArray(R),field:(R,D)=>D.Fp.isValid(R),hash:R=>typeof R=="function"&&Number.isSafeInteger(R.outputLen)};function I(R,D,L={}){const U=(z,W,K)=>{const J=P[W];if(typeof J!="function")throw new Error("invalid validator function");const ne=R[z];if(!(K&&ne===void 0)&&!J(ne,R))throw new Error("param "+String(z)+" is invalid. Expected "+W+", got "+ne)};for(const[z,W]of Object.entries(D))U(z,W,!1);for(const[z,W]of Object.entries(L))U(z,W,!0);return R}const B=()=>{throw new Error("not implemented")};Gt.notImplemented=B;function $(R){const D=new WeakMap;return(L,...U)=>{const z=D.get(L);if(z!==void 0)return z;const W=R(L,...U);return D.set(L,W),W}}return Gt}var Rt={},Bw={},S0={},Dw={},UU;function wIe(){return UU||(UU=1,Object.defineProperty(Dw,"__esModule",{value:!0}),Dw.version=void 0,Dw.version="0.1.1"),Dw}var FU;function bIe(){if(FU)return S0;FU=1,Object.defineProperty(S0,"__esModule",{value:!0}),S0.getUrl=e,S0.getVersion=r,S0.prettyPrint=n;const t=wIe();function e(i){return i}function r(){return t.version}function n(i){if(!i)return"";const s=Object.entries(i).map(([a,c])=>c===void 0||c===!1?null:[a,c]).filter(Boolean),o=s.reduce((a,[c])=>Math.max(a,c.length),0);return s.map(([a,c])=>` ${`${a}:`.padEnd(o+1)} ${c}`).join(` `)}return S0}var HU;function cl(){if(HU)return Bw;HU=1,Object.defineProperty(Bw,"__esModule",{value:!0}),Bw.BaseError=void 0;const t=bIe();class e extends Error{constructor(i,s={}){const o=(()=>{var d;if(s.cause instanceof e){if(s.cause.details)return s.cause.details;if(s.cause.shortMessage)return s.cause.shortMessage}return s.cause&&"details"in s.cause&&typeof s.cause.details=="string"?s.cause.details:(d=s.cause)!=null&&d.message?s.cause.message:s.details})(),a=s.cause instanceof e&&s.cause.docsPath||s.docsPath,u=`https://oxlib.sh${a??""}`,l=[i||"An error occurred.",...s.metaMessages?["",...s.metaMessages]:[],...o||a?["",o?`Details: ${o}`:void 0,a?`See: ${u}`:void 0]:[]].filter(d=>typeof d=="string").join(` `);super(l,s.cause?{cause:s.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:`ox@${(0,t.getVersion)()}`}),this.cause=s.cause,this.details=o,this.docs=u,this.docsPath=a,this.shortMessage=i}walk(i){return r(this,i)}}Bw.BaseError=e;function r(n,i){return i!=null&&i(n)?n:n&&typeof n=="object"&&"cause"in n&&n.cause?r(n.cause,i):i?null:n}return Bw}var Mw={},qU;function OO(){if(qU)return Mw;qU=1,Object.defineProperty(Mw,"__esModule",{value:!0}),Mw.parse=e,Mw.stringify=r;const t="#__bigint";function e(n,i){return JSON.parse(n,(s,o)=>{const a=o;return typeof a=="string"&&a.endsWith(t)?BigInt(a.slice(0,-t.length)):typeof i=="function"?i(s,a):a})}function r(n,i,s){return JSON.stringify(n,(o,a)=>typeof i=="function"?i(o,a):typeof a=="bigint"?a.toString()+t:a,s)}return Mw}var AT={},zU;function JQ(){return zU||(zU=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.charCodeMap=void 0,t.assertSize=r,t.assertStartOffset=n,t.assertEndOffset=i,t.charCodeToBase16=s,t.pad=o,t.trim=a;const e=Hp();function r(c,u){if(e.size(c)>u)throw new e.SizeOverflowError({givenSize:e.size(c),maxSize:u})}function n(c,u){if(typeof u=="number"&&u>0&&u>e.size(c)-1)throw new e.SliceOffsetOutOfBoundsError({offset:u,position:"start",size:e.size(c)})}function i(c,u,l){if(typeof u=="number"&&typeof l=="number"&&e.size(c)!==l-u)throw new e.SliceOffsetOutOfBoundsError({offset:l,position:"end",size:e.size(c)})}t.charCodeMap={zero:48,nine:57,A:65,F:70,a:97,f:102};function s(c){if(c>=t.charCodeMap.zero&&c<=t.charCodeMap.nine)return c-t.charCodeMap.zero;if(c>=t.charCodeMap.A&&c<=t.charCodeMap.F)return c-(t.charCodeMap.A-10);if(c>=t.charCodeMap.a&&c<=t.charCodeMap.f)return c-(t.charCodeMap.a-10)}function o(c,u={}){const{dir:l,size:d=32}=u;if(d===0)return c;if(c.length>d)throw new e.SizeExceedsPaddingSizeError({size:c.length,targetSize:d,type:"Bytes"});const h=new Uint8Array(d);for(let f=0;fa)throw new t.SizeOverflowError({givenSize:t.size(o),maxSize:a})}function r(o,a){if(typeof a=="number"&&a>0&&a>t.size(o)-1)throw new t.SliceOffsetOutOfBoundsError({offset:a,position:"start",size:t.size(o)})}function n(o,a,c){if(typeof a=="number"&&typeof c=="number"&&t.size(o)!==c-a)throw new t.SliceOffsetOutOfBoundsError({offset:c,position:"end",size:t.size(o)})}function i(o,a={}){const{dir:c,size:u=32}=a;if(u===0)return o;const l=o.replace("0x","");if(l.length>u*2)throw new t.SizeExceedsPaddingSizeError({size:Math.ceil(l.length/2),targetSize:u,type:"Hex"});return`0x${l[c==="right"?"padEnd":"padStart"](u*2,"0")}`}function s(o,a={}){const{dir:c="left"}=a;let u=o.replace("0x",""),l=0;for(let d=0;d1||L[0]>1)throw new N(L);return!!L[0]}function x($,R={}){return r.fromBytes($,R)}function A($,R={}){const{size:D}=R;typeof D<"u"&&i.assertSize($,D);const L=r.fromBytes($,R);return r.toNumber(L,R)}function T($,R={}){const{size:D}=R;let L=$;return typeof D<"u"&&(i.assertSize(L,D),L=k(L)),o.decode(L)}function O($){return i.trim($,{dir:"left"})}function k($){return i.trim($,{dir:"right"})}function j($){try{return c($),!0}catch{return!1}}class N extends e.BaseError{constructor(R){super(`Bytes value \`${R}\` is not a valid boolean.`,{metaMessages:["The bytes array must contain a single byte of either a `0` or `1` value."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesBooleanError"})}}Rt.InvalidBytesBooleanError=N;class S extends e.BaseError{constructor(R){super(`Value \`${typeof R=="object"?n.stringify(R):R}\` of type \`${typeof R}\` is an invalid Bytes value.`,{metaMessages:["Bytes values must be of type `Bytes`."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesTypeError"})}}Rt.InvalidBytesTypeError=S;class P extends e.BaseError{constructor({givenSize:R,maxSize:D}){super(`Size cannot exceed \`${D}\` bytes. Given size: \`${R}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}}Rt.SizeOverflowError=P;class I extends e.BaseError{constructor({offset:R,position:D,size:L}){super(`Slice ${D==="start"?"starting":"ending"} at offset \`${R}\` is out-of-bounds (size: \`${L}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SliceOffsetOutOfBoundsError"})}}Rt.SliceOffsetOutOfBoundsError=I;class B extends e.BaseError{constructor({size:R,targetSize:D,type:L}){super(`${L.charAt(0).toUpperCase()}${L.slice(1).toLowerCase()} size (\`${R}\`) exceeds padding size (\`${D}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeExceedsPaddingSizeError"})}}return Rt.SizeExceedsPaddingSizeError=B,Rt}var GU;function pa(){if(GU)return Ct;GU=1,Object.defineProperty(Ct,"__esModule",{value:!0}),Ct.SizeExceedsPaddingSizeError=Ct.SliceOffsetOutOfBoundsError=Ct.SizeOverflowError=Ct.InvalidLengthError=Ct.InvalidHexValueError=Ct.InvalidHexTypeError=Ct.InvalidHexBooleanError=Ct.IntegerOutOfRangeError=void 0,Ct.assert=c,Ct.concat=u,Ct.from=l,Ct.fromBoolean=d,Ct.fromBytes=h,Ct.fromNumber=f,Ct.fromString=g,Ct.isEqual=p,Ct.padLeft=m,Ct.padRight=b,Ct.random=v,Ct.slice=E,Ct.size=w,Ct.trimLeft=C,Ct.trimRight=y,Ct.toBigInt=_,Ct.toBoolean=x,Ct.toBytes=A,Ct.toNumber=T,Ct.toString=O,Ct.validate=k;const t=YQ(),e=Hp(),r=cl(),n=OO(),i=JQ(),s=QQ(),o=new TextEncoder,a=Array.from({length:256},(D,L)=>L.toString(16).padStart(2,"0"));function c(D,L={}){const{strict:U=!1}=L;if(!D)throw new S(D);if(typeof D!="string")throw new S(D);if(U&&!/^0x[0-9a-fA-F]*$/.test(D))throw new P(D);if(!D.startsWith("0x"))throw new P(D)}function u(...D){return`0x${D.reduce((L,U)=>L+U.replace("0x",""),"")}`}function l(D){return D instanceof Uint8Array?h(D):Array.isArray(D)?h(new Uint8Array(D)):D}function d(D,L={}){const U=`0x${Number(D)}`;return typeof L.size=="number"?(s.assertSize(U,L.size),m(U,L.size)):U}function h(D,L={}){let U="";for(let W=0;WK||W>1n;return z<=J?z:z-K-1n}function x(D,L={}){L.size&&s.assertSize(D,L.size);const U=C(D);if(U==="0x")return!1;if(U==="0x1")return!0;throw new N(D)}function A(D,L={}){return e.fromHex(D,L)}function T(D,L={}){const{signed:U,size:z}=L;return Number(!U&&!z?D:_(D,L))}function O(D,L={}){const{size:U}=L;let z=e.fromHex(D);return U&&(i.assertSize(z,U),z=e.trimRight(z)),new TextDecoder().decode(z)}function k(D,L={}){const{strict:U=!1}=L;try{return c(D,{strict:U}),!0}catch{return!1}}class j extends r.BaseError{constructor({max:L,min:U,signed:z,size:W,value:K}){super(`Number \`${K}\` is not in safe${W?` ${W*8}-bit`:""}${z?" signed":" unsigned"} integer range ${L?`(\`${U}\` to \`${L}\`)`:`(above \`${U}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}}Ct.IntegerOutOfRangeError=j;class N extends r.BaseError{constructor(L){super(`Hex value \`"${L}"\` is not a valid boolean.`,{metaMessages:['The hex value must be `"0x0"` (false) or `"0x1"` (true).']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexBooleanError"})}}Ct.InvalidHexBooleanError=N;class S extends r.BaseError{constructor(L){super(`Value \`${typeof L=="object"?n.stringify(L):L}\` of type \`${typeof L}\` is an invalid hex type.`,{metaMessages:['Hex types must be represented as `"0x${string}"`.']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexTypeError"})}}Ct.InvalidHexTypeError=S;class P extends r.BaseError{constructor(L){super(`Value \`${L}\` is an invalid hex value.`,{metaMessages:['Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexValueError"})}}Ct.InvalidHexValueError=P;class I extends r.BaseError{constructor(L){super(`Hex value \`"${L}"\` is an odd length (${L.length-2} nibbles).`,{metaMessages:["It must be an even length."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidLengthError"})}}Ct.InvalidLengthError=I;class B extends r.BaseError{constructor({givenSize:L,maxSize:U}){super(`Size cannot exceed \`${U}\` bytes. Given size: \`${L}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}}Ct.SizeOverflowError=B;class $ extends r.BaseError{constructor({offset:L,position:U,size:z}){super(`Slice ${U==="start"?"starting":"ending"} at offset \`${L}\` is out-of-bounds (size: \`${z}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SliceOffsetOutOfBoundsError"})}}Ct.SliceOffsetOutOfBoundsError=$;class R extends r.BaseError{constructor({size:L,targetSize:U,type:z}){super(`${z.charAt(0).toUpperCase()}${z.slice(1).toLowerCase()} size (\`${L}\`) exceeds padding size (\`${U}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}}return Ct.SizeExceedsPaddingSizeError=R,Ct}var Lw={},KU;function yIe(){if(KU)return Lw;KU=1,Object.defineProperty(Lw,"__esModule",{value:!0}),Lw.fromRpc=e,Lw.toRpc=r;const t=pa();function e(n){return{...n,amount:BigInt(n.amount),index:Number(n.index),validatorIndex:Number(n.validatorIndex)}}function r(n){return{address:n.address,amount:t.fromNumber(n.amount),index:t.fromNumber(n.index),validatorIndex:t.fromNumber(n.validatorIndex)}}return Lw}var ZU;function XQ(){if(ZU)return jw;ZU=1,Object.defineProperty(jw,"__esModule",{value:!0}),jw.fromRpc=r,jw.toRpc=n;const t=pa(),e=yIe();function r(i){return{...i.baseFeePerGas&&{baseFeePerGas:BigInt(i.baseFeePerGas)},...i.blobBaseFee&&{blobBaseFee:BigInt(i.blobBaseFee)},...i.feeRecipient&&{feeRecipient:i.feeRecipient},...i.gasLimit&&{gasLimit:BigInt(i.gasLimit)},...i.number&&{number:BigInt(i.number)},...i.prevRandao&&{prevRandao:BigInt(i.prevRandao)},...i.time&&{time:BigInt(i.time)},...i.withdrawals&&{withdrawals:i.withdrawals.map(e.fromRpc)}}}function n(i){return{...typeof i.baseFeePerGas=="bigint"&&{baseFeePerGas:t.fromNumber(i.baseFeePerGas)},...typeof i.blobBaseFee=="bigint"&&{blobBaseFee:t.fromNumber(i.blobBaseFee)},...typeof i.feeRecipient=="string"&&{feeRecipient:i.feeRecipient},...typeof i.gasLimit=="bigint"&&{gasLimit:t.fromNumber(i.gasLimit)},...typeof i.number=="bigint"&&{number:t.fromNumber(i.number)},...typeof i.prevRandao=="bigint"&&{prevRandao:t.fromNumber(i.prevRandao)},...typeof i.time=="bigint"&&{time:t.fromNumber(i.time)},...i.withdrawals&&{withdrawals:i.withdrawals.map(e.toRpc)}}}return jw}var Jt={},YU;function rh(){if(YU)return Jt;YU=1,Object.defineProperty(Jt,"__esModule",{value:!0}),Jt.erc4626Abi=Jt.erc721Abi=Jt.erc1155Abi=Jt.erc20Abi_bytes32=Jt.erc20Abi=Jt.universalSignatureValidatorAbi=Jt.smartAccountAbi=Jt.addressResolverAbi=Jt.textResolverAbi=Jt.universalResolverReverseAbi=Jt.universalResolverResolveAbi=Jt.batchGatewayAbi=Jt.multicall3Abi=void 0,Jt.multicall3Abi=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"}],Jt.batchGatewayAbi=[{name:"query",type:"function",stateMutability:"view",inputs:[{type:"tuple[]",name:"queries",components:[{type:"address",name:"sender"},{type:"string[]",name:"urls"},{type:"bytes",name:"data"}]}],outputs:[{type:"bool[]",name:"failures"},{type:"bytes[]",name:"responses"}]},{name:"HttpError",type:"error",inputs:[{type:"uint16",name:"status"},{type:"string",name:"message"}]}];const t=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"},{inputs:[],name:"ResolverNotContract",type:"error"},{inputs:[{name:"returnData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{components:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"errors",type:"tuple[]"}],name:"HttpError",type:"error"}];return Jt.universalResolverResolveAbi=[...t,{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]},{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],Jt.universalResolverReverseAbi=[...t,{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]},{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]}],Jt.textResolverAbi=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],Jt.addressResolverAbi=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],Jt.smartAccountAbi=[{name:"isValidSignature",type:"function",stateMutability:"view",inputs:[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],outputs:[{name:"",type:"bytes4"}]}],Jt.universalSignatureValidatorAbi=[{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function",name:"isValidSig"}],Jt.erc20Abi=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}],Jt.erc20Abi_bytes32=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}],Jt.erc1155Abi=[{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"balance",type:"uint256"},{internalType:"uint256",name:"needed",type:"uint256"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ERC1155InsufficientBalance",type:"error"},{inputs:[{internalType:"address",name:"approver",type:"address"}],name:"ERC1155InvalidApprover",type:"error"},{inputs:[{internalType:"uint256",name:"idsLength",type:"uint256"},{internalType:"uint256",name:"valuesLength",type:"uint256"}],name:"ERC1155InvalidArrayLength",type:"error"},{inputs:[{internalType:"address",name:"operator",type:"address"}],name:"ERC1155InvalidOperator",type:"error"},{inputs:[{internalType:"address",name:"receiver",type:"address"}],name:"ERC1155InvalidReceiver",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"}],name:"ERC1155InvalidSender",type:"error"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"address",name:"owner",type:"address"}],name:"ERC1155MissingApprovalForAll",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256[]",name:"ids",type:"uint256[]"},{indexed:!1,internalType:"uint256[]",name:"values",type:"uint256[]"}],name:"TransferBatch",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"TransferSingle",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"value",type:"string"},{indexed:!0,internalType:"uint256",name:"id",type:"uint256"}],name:"URI",type:"event"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"id",type:"uint256"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address[]",name:"accounts",type:"address[]"},{internalType:"uint256[]",name:"ids",type:"uint256[]"}],name:"balanceOfBatch",outputs:[{internalType:"uint256[]",name:"",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256[]",name:"ids",type:"uint256[]"},{internalType:"uint256[]",name:"values",type:"uint256[]"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeBatchTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"id",type:"uint256"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"uri",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"}],Jt.erc721Abi=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!0,name:"tokenId",type:"uint256"}]},{type:"event",name:"ApprovalForAll",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"operator",type:"address"},{indexed:!1,name:"approved",type:"bool"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!0,name:"tokenId",type:"uint256"}]},{type:"function",name:"approve",stateMutability:"payable",inputs:[{name:"spender",type:"address"},{name:"tokenId",type:"uint256"}],outputs:[]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"getApproved",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{type:"address"}]},{type:"function",name:"isApprovedForAll",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"operator",type:"address"}],outputs:[{type:"bool"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"ownerOf",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"owner",type:"address"}]},{type:"function",name:"safeTransferFrom",stateMutability:"payable",inputs:[{name:"from",type:"address"},{name:"to",type:"address"},{name:"tokenId",type:"uint256"}],outputs:[]},{type:"function",name:"safeTransferFrom",stateMutability:"nonpayable",inputs:[{name:"from",type:"address"},{name:"to",type:"address"},{name:"id",type:"uint256"},{name:"data",type:"bytes"}],outputs:[]},{type:"function",name:"setApprovalForAll",stateMutability:"nonpayable",inputs:[{name:"operator",type:"address"},{name:"approved",type:"bool"}],outputs:[]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"tokenByIndex",stateMutability:"view",inputs:[{name:"index",type:"uint256"}],outputs:[{type:"uint256"}]},{type:"function",name:"tokenByIndex",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"index",type:"uint256"}],outputs:[{name:"tokenId",type:"uint256"}]},{type:"function",name:"tokenURI",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{type:"string"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"transferFrom",stateMutability:"payable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"tokeId",type:"uint256"}],outputs:[]}],Jt.erc4626Abi=[{anonymous:!1,inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"sender",type:"address"},{indexed:!0,name:"receiver",type:"address"},{indexed:!1,name:"assets",type:"uint256"},{indexed:!1,name:"shares",type:"uint256"}],name:"Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"sender",type:"address"},{indexed:!0,name:"receiver",type:"address"},{indexed:!0,name:"owner",type:"address"},{indexed:!1,name:"assets",type:"uint256"},{indexed:!1,name:"shares",type:"uint256"}],name:"Withdraw",type:"event"},{inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],name:"allowance",outputs:[{type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],name:"approve",outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"asset",outputs:[{name:"assetTokenAddress",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{name:"account",type:"address"}],name:"balanceOf",outputs:[{type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"shares",type:"uint256"}],name:"convertToAssets",outputs:[{name:"assets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"assets",type:"uint256"}],name:"convertToShares",outputs:[{name:"shares",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"assets",type:"uint256"},{name:"receiver",type:"address"}],name:"deposit",outputs:[{name:"shares",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"caller",type:"address"}],name:"maxDeposit",outputs:[{name:"maxAssets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"caller",type:"address"}],name:"maxMint",outputs:[{name:"maxShares",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"owner",type:"address"}],name:"maxRedeem",outputs:[{name:"maxShares",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"owner",type:"address"}],name:"maxWithdraw",outputs:[{name:"maxAssets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"shares",type:"uint256"},{name:"receiver",type:"address"}],name:"mint",outputs:[{name:"assets",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"assets",type:"uint256"}],name:"previewDeposit",outputs:[{name:"shares",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"shares",type:"uint256"}],name:"previewMint",outputs:[{name:"assets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"shares",type:"uint256"}],name:"previewRedeem",outputs:[{name:"assets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"assets",type:"uint256"}],name:"previewWithdraw",outputs:[{name:"shares",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"shares",type:"uint256"},{name:"receiver",type:"address"},{name:"owner",type:"address"}],name:"redeem",outputs:[{name:"assets",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"totalAssets",outputs:[{name:"totalManagedAssets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"to",type:"address"},{name:"amount",type:"uint256"}],name:"transfer",outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"from",type:"address"},{name:"to",type:"address"},{name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"assets",type:"uint256"},{name:"receiver",type:"address"},{name:"owner",type:"address"}],name:"withdraw",outputs:[{name:"shares",type:"uint256"}],stateMutability:"nonpayable",type:"function"}],Jt}var Uw={},JU;function vIe(){return JU||(JU=1,Object.defineProperty(Uw,"__esModule",{value:!0}),Uw.aggregate3Signature=void 0,Uw.aggregate3Signature="0x82ad56cb"),Uw}var Hc={},QU;function hx(){return QU||(QU=1,Object.defineProperty(Hc,"__esModule",{value:!0}),Hc.universalSignatureValidatorByteCode=Hc.deploylessCallViaFactoryBytecode=Hc.deploylessCallViaBytecodeBytecode=void 0,Hc.deploylessCallViaBytecodeBytecode="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",Hc.deploylessCallViaFactoryBytecode="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",Hc.universalSignatureValidatorByteCode="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572"),Hc}var us={},XU;function R2(){if(XU)return us;XU=1,Object.defineProperty(us,"__esModule",{value:!0}),us.InvalidChainIdError=us.ClientChainNotConfiguredError=us.ChainNotFoundError=us.ChainMismatchError=us.ChainDoesNotSupportContract=void 0;const t=_t();class e extends t.BaseError{constructor({blockNumber:a,chain:c,contract:u}){super(`Chain "${c.name}" does not support contract "${u.name}".`,{metaMessages:["This could be due to any of the following:",...a&&u.blockCreated&&u.blockCreated>a?[`- The contract "${u.name}" was not deployed until block ${u.blockCreated} (current block ${a}).`]:[`- The chain does not have the contract "${u.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}us.ChainDoesNotSupportContract=e;class r extends t.BaseError{constructor({chain:a,currentChainId:c}){super(`The current chain of the wallet (id: ${c}) does not match the target chain for the transaction (id: ${a.id} – ${a.name}).`,{metaMessages:[`Current Chain ID: ${c}`,`Expected Chain ID: ${a.id} – ${a.name}`],name:"ChainMismatchError"})}}us.ChainMismatchError=r;class n extends t.BaseError{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(` `),{name:"ChainNotFoundError"})}}us.ChainNotFoundError=n;class i extends t.BaseError{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}us.ClientChainNotConfiguredError=i;class s extends t.BaseError{constructor({chainId:a}){super(typeof a=="number"?`Chain ID "${a}" is invalid.`:"Chain ID is invalid.",{name:"InvalidChainIdError"})}}return us.InvalidChainIdError=s,us}var F_={},eF;function k2(){if(eF)return F_;eF=1,Object.defineProperty(F_,"__esModule",{value:!0}),F_.encodeDeployData=i;const t=$r(),e=oi(),r=da(),n="/docs/contract/encodeDeployData";function i(s){const{abi:o,args:a,bytecode:c}=s;if(!a||a.length===0)return c;const u=o.find(d=>"type"in d&&d.type==="constructor");if(!u)throw new t.AbiConstructorNotFoundError({docsPath:n});if(!("inputs"in u))throw new t.AbiConstructorParamsNotFoundError({docsPath:n});if(!u.inputs||u.inputs.length===0)throw new t.AbiConstructorParamsNotFoundError({docsPath:n});const l=(0,r.encodeAbiParameters)(u.inputs,a);return(0,e.concatHex)([c,l])}return F_}var H_={},tF;function nh(){if(tF)return H_;tF=1,Object.defineProperty(H_,"__esModule",{value:!0}),H_.getChainContractAddress=e;const t=R2();function e({blockNumber:r,chain:n,contract:i}){var o;const s=(o=n==null?void 0:n.contracts)==null?void 0:o[i];if(!s)throw new t.ChainDoesNotSupportContract({chain:n,contract:{name:i}});if(r&&s.blockCreated&&s.blockCreated>r)throw new t.ChainDoesNotSupportContract({blockNumber:r,chain:n,contract:{name:i,blockCreated:s.blockCreated}});return s.address}return H_}var q_={},rF;function RO(){if(rF)return q_;rF=1,Object.defineProperty(q_,"__esModule",{value:!0}),q_.getCallError=n;const t=Qd(),e=nl(),r=S2();function n(i,{docsPath:s,...o}){const a=(()=>{const c=(0,r.getNodeError)(i,o);return c instanceof e.UnknownNodeError?i:c})();return new t.CallExecutionError(a,{docsPath:s,...o})}return q_}var z_={},W_={},nF;function kO(){if(nF)return W_;nF=1,Object.defineProperty(W_,"__esModule",{value:!0}),W_.withResolvers=t;function t(){let e=()=>{},r=()=>{};return{promise:new Promise((i,s)=>{e=i,r=s}),resolve:e,reject:r}}return W_}var iF;function NO(){if(iF)return z_;iF=1,Object.defineProperty(z_,"__esModule",{value:!0}),z_.createBatchScheduler=r;const t=kO(),e=new Map;function r({fn:n,id:i,shouldSplitBatch:s,wait:o=0,sort:a}){const c=async()=>{const f=d();u();const g=f.map(({args:p})=>p);g.length!==0&&n(g).then(p=>{a&&Array.isArray(p)&&p.sort(a);for(let m=0;m{for(let m=0;me.delete(i),l=()=>d().map(({args:f})=>f),d=()=>e.get(i)||[],h=f=>e.set(i,[...d(),f]);return{flush:u,async schedule(f){const{promise:g,resolve:p,reject:m}=(0,t.withResolvers)();return(s==null?void 0:s([...l(),f]))&&c(),d().length>0?(h({args:f,resolve:p,reject:m}),g):(h({args:f,resolve:p,reject:m}),setTimeout(c,o),g)}}}return z_}var xT={},qc={},sF;function _Ie(){if(sF)return qc;sF=1,Object.defineProperty(qc,"__esModule",{value:!0}),qc.OffchainLookupSenderMismatchError=qc.OffchainLookupResponseMalformedError=qc.OffchainLookupError=void 0;const t=Gn(),e=_t(),r=bO();class n extends e.BaseError{constructor({callbackSelector:a,cause:c,data:u,extraData:l,sender:d,urls:h}){var f;super(c.shortMessage||"An error occurred while fetching for an offchain result.",{cause:c,metaMessages:[...c.metaMessages||[],(f=c.metaMessages)!=null&&f.length?"":[],"Offchain Gateway Call:",h&&[" Gateway URL(s):",...h.map(g=>` ${(0,r.getUrl)(g)}`)],` Sender: ${d}`,` Data: ${u}`,` Callback selector: ${a}`,` Extra data: ${l}`].flat(),name:"OffchainLookupError"})}}qc.OffchainLookupError=n;class i extends e.BaseError{constructor({result:a,url:c}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${(0,r.getUrl)(c)}`,`Response: ${(0,t.stringify)(a)}`],name:"OffchainLookupResponseMalformedError"})}}qc.OffchainLookupResponseMalformedError=i;class s extends e.BaseError{constructor({sender:a,to:c}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${c}`,`OffchainLookup sender address: ${a}`],name:"OffchainLookupSenderMismatchError"})}}return qc.OffchainLookupSenderMismatchError=s,qc}var T0={},V_={},oF;function $O(){if(oF)return V_;oF=1,Object.defineProperty(V_,"__esModule",{value:!0}),V_.decodeFunctionData=s;const t=$r(),e=go(),r=Lp(),n=Jd(),i=el();function s(o){const{abi:a,data:c}=o,u=(0,e.slice)(c,0,4),l=a.find(d=>d.type==="function"&&u===(0,r.toFunctionSelector)((0,i.formatAbiItem)(d)));if(!l)throw new t.AbiFunctionSignatureNotFoundError(u,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:l.name,args:"inputs"in l&&l.inputs&&l.inputs.length>0?(0,n.decodeAbiParameters)(l.inputs,(0,e.slice)(c,4)):void 0}}return V_}var G_={},aF;function jO(){if(aF)return G_;aF=1,Object.defineProperty(G_,"__esModule",{value:!0}),G_.encodeErrorResult=a;const t=$r(),e=oi(),r=Lp(),n=da(),i=el(),s=rl(),o="/docs/contract/encodeErrorResult";function a(c){const{abi:u,errorName:l,args:d}=c;let h=u[0];if(l){const m=(0,s.getAbiItem)({abi:u,args:d,name:l});if(!m)throw new t.AbiErrorNotFoundError(l,{docsPath:o});h=m}if(h.type!=="error")throw new t.AbiErrorNotFoundError(void 0,{docsPath:o});const f=(0,i.formatAbiItem)(h),g=(0,r.toFunctionSelector)(f);let p="0x";if(d&&d.length>0){if(!h.inputs)throw new t.AbiErrorInputsNotFoundError(h.name,{docsPath:o});p=(0,n.encodeAbiParameters)(h.inputs,d)}return(0,e.concatHex)([g,p])}return G_}var K_={},cF;function BO(){if(cF)return K_;cF=1,Object.defineProperty(K_,"__esModule",{value:!0}),K_.encodeFunctionResult=i;const t=$r(),e=da(),r=rl(),n="/docs/contract/encodeFunctionResult";function i(s){const{abi:o,functionName:a,result:c}=s;let u=o[0];if(a){const d=(0,r.getAbiItem)({abi:o,name:a});if(!d)throw new t.AbiFunctionNotFoundError(a,{docsPath:n});u=d}if(u.type!=="function")throw new t.AbiFunctionNotFoundError(void 0,{docsPath:n});if(!u.outputs)throw new t.AbiFunctionOutputsNotFoundError(u.name,{docsPath:n});const l=(()=>{if(u.outputs.length===0)return[];if(u.outputs.length===1)return[c];if(Array.isArray(c))return c;throw new t.InvalidArrayError(c)})();return(0,e.encodeAbiParameters)(u.outputs,l)}return K_}var uF;function DO(){if(uF)return T0;uF=1,Object.defineProperty(T0,"__esModule",{value:!0}),T0.localBatchGatewayUrl=void 0,T0.localBatchGatewayRequest=s;const t=rh(),e=XA(),r=$O(),n=jO(),i=BO();T0.localBatchGatewayUrl="x-batch-gateway:true";async function s(a){const{data:c,ccipRequest:u}=a,{args:[l]}=(0,r.decodeFunctionData)({abi:t.batchGatewayAbi,data:c}),d=[],h=[];return await Promise.all(l.map(async(f,g)=>{try{h[g]=await u(f),d[g]=!1}catch(p){d[g]=!0,h[g]=o(p)}})),(0,i.encodeFunctionResult)({abi:t.batchGatewayAbi,functionName:"query",result:[d,h]})}function o(a){return a.name==="HttpRequestError"&&a.status?(0,n.encodeErrorResult)({abi:t.batchGatewayAbi,errorName:"HttpError",args:[a.status,a.shortMessage]}):(0,n.encodeErrorResult)({abi:[e.solidityError],errorName:"Error",args:["shortMessage"in a?a.shortMessage:a.message]})}return T0}var lF;function MO(){return lF||(lF=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.offchainLookupAbiItem=t.offchainLookupSignature=void 0,t.offchainLookup=d,t.ccipRequest=h;const e=N2(),r=_Ie(),n=ha(),i=ex(),s=da(),o=fa(),a=oi(),c=ki(),u=DO(),l=Gn();t.offchainLookupSignature="0x556f1830",t.offchainLookupAbiItem={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function d(f,{blockNumber:g,blockTag:p,data:m,to:b}){const{args:v}=(0,i.decodeErrorResult)({data:m,abi:[t.offchainLookupAbiItem]}),[E,w,C,y,_]=v,{ccipRead:x}=f,A=x&&typeof(x==null?void 0:x.request)=="function"?x.request:h;try{if(!(0,o.isAddressEqual)(b,E))throw new r.OffchainLookupSenderMismatchError({sender:E,to:b});const T=w.includes(u.localBatchGatewayUrl)?await(0,u.localBatchGatewayRequest)({data:C,ccipRequest:A}):await A({data:C,sender:E,urls:w}),{data:O}=await(0,e.call)(f,{blockNumber:g,blockTag:p,data:(0,a.concat)([y,(0,s.encodeAbiParameters)([{type:"bytes"},{type:"bytes"}],[T,_])]),to:b});return O}catch(T){throw new r.OffchainLookupError({callbackSelector:y,cause:T,data:m,extraData:_,sender:E,urls:w})}}async function h({data:f,sender:g,urls:p}){var b;let m=new Error("An unknown error occurred.");for(let v=0;v{const fn=[Cr,Er];return Te&&be?[...fn,Te,be]:Te?[...fn,Te]:be?[...fn,{},be]:fn})(),ai=await T.request({method:"eth_call",params:hn});return ai==="0x"?{data:void 0}:{data:ai}}catch(hr){const Er=A(hr),{offchainLookup:be,offchainLookupSignature:Te}=await Promise.resolve().then(()=>MO());if(T.ccipRead!==!1&&(Er==null?void 0:Er.slice(0,10))===Te&&he)return{data:await be(T,{data:Er,to:he})};throw Ce&&(Er==null?void 0:Er.slice(0,10))==="0x101bb98d"?new c.CounterfactualDeploymentFailedError({factory:L}):(0,g.getCallError)(hr,{...O,account:ve,chain:T.chain})}}function C({request:T}){const{data:O,to:k,...j}=T;return!(!O||O.startsWith(i.aggregate3Signature)||!k||Object.values(j).filter(N=>typeof N<"u").length>0)}async function y(T,O){var W;const{batchSize:k=1024,wait:j=0}=typeof((W=T.batch)==null?void 0:W.multicall)=="object"?T.batch.multicall:{},{blockNumber:N,blockTag:S="latest",data:P,multicallAddress:I,to:B}=O;let $=I;if(!$){if(!T.chain)throw new a.ClientChainNotConfiguredError;$=(0,h.getChainContractAddress)({blockNumber:N,chain:T.chain,contract:"multicall3"})}const D=(typeof N=="bigint"?(0,f.numberToHex)(N):void 0)||S,{schedule:L}=(0,b.createBatchScheduler)({id:`${T.uid}.${D}`,wait:j,shouldSplitBatch(K){return K.reduce((ne,{data:ae})=>ne+(ae.length-2),0)>k*2},fn:async K=>{const J=K.map(he=>({allowFailure:!0,callData:he.data,target:he.to})),ne=(0,d.encodeFunctionData)({abi:n.multicall3Abi,args:[J],functionName:"aggregate3"}),ae=await T.request({method:"eth_call",params:[{data:ne,to:$},D]});return(0,u.decodeFunctionResult)({abi:n.multicall3Abi,args:[J],functionName:"aggregate3",data:ae||"0x"})}}),[{returnData:U,success:z}]=await L({data:P,to:B});if(!z)throw new c.RawContractError({data:U});return U==="0x"?{data:void 0}:{data:U}}function _(T){const{code:O,data:k}=T;return(0,l.encodeDeployData)({abi:(0,t.parseAbi)(["constructor(bytes, bytes)"]),bytecode:s.deploylessCallViaBytecodeBytecode,args:[O,k]})}function x(T){const{data:O,factory:k,factoryData:j,to:N}=T;return(0,l.encodeDeployData)({abi:(0,t.parseAbi)(["constructor(address, bytes, address, bytes)"]),bytecode:s.deploylessCallViaFactoryBytecode,args:[N,O,k,j]})}function A(T){var k;if(!(T instanceof o.BaseError))return;const O=T.walk();return typeof(O==null?void 0:O.data)=="object"?(k=O.data)==null?void 0:k.data:O.data}return $w}var hF;function ul(){if(hF)return L_;hF=1,Object.defineProperty(L_,"__esModule",{value:!0}),L_.readContract=s;const t=al(),e=Bs(),r=eh(),n=ur(),i=N2();async function s(o,a){const{abi:c,address:u,args:l,functionName:d,...h}=a,f=(0,e.encodeFunctionData)({abi:c,args:l,functionName:d});try{const{data:g}=await(0,n.getAction)(o,i.call,"call")({...h,data:f,to:u});return(0,t.decodeFunctionResult)({abi:c,args:l,functionName:d,data:g||"0x"})}catch(g){throw(0,r.getContractError)(g,{abi:c,address:u,args:l,docsPath:"/docs/contract/readContract",functionName:d})}}return L_}var Z_={},fF;function eX(){if(fF)return Z_;fF=1,Object.defineProperty(Z_,"__esModule",{value:!0}),Z_.simulateContract=o;const t=sn(),e=al(),r=Bs(),n=eh(),i=ur(),s=N2();async function o(a,c){const{abi:u,address:l,args:d,dataSuffix:h,functionName:f,...g}=c,p=g.account?(0,t.parseAccount)(g.account):a.account,m=(0,r.encodeFunctionData)({abi:u,args:d,functionName:f});try{const{data:b}=await(0,i.getAction)(a,s.call,"call")({batch:!1,data:`${m}${h?h.replace("0x",""):""}`,to:l,...g,account:p}),v=(0,e.decodeFunctionResult)({abi:u,args:d,functionName:f,data:b||"0x"}),E=u.filter(w=>"name"in w&&w.name===c.functionName);return{result:v,request:{abi:E,address:l,args:d,dataSuffix:h,functionName:f,...g,account:p}}}catch(b){throw(0,n.getContractError)(b,{abi:u,address:l,args:d,docsPath:"/docs/contract/simulateContract",functionName:f,sender:p==null?void 0:p.address})}}return Z_}var Y_={},ST={},pF;function qp(){return pF||(pF=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.cleanupCache=t.listenersCache=void 0,t.observe=r,t.listenersCache=new Map,t.cleanupCache=new Map;let e=0;function r(n,i,s){const o=++e,a=()=>t.listenersCache.get(n)||[],c=()=>{const f=a();t.listenersCache.set(n,f.filter(g=>g.id!==o))},u=()=>{const f=a();if(!f.some(p=>p.id===o))return;const g=t.cleanupCache.get(n);f.length===1&&g&&g(),c()},l=a();if(t.listenersCache.set(n,[...l,{id:o,fns:i}]),l&&l.length>0)return u;const d={};for(const f in i)d[f]=(...g)=>{var m,b;const p=a();if(p.length!==0)for(const v of p)(b=(m=v.fns)[f])==null||b.call(m,...g)};const h=s(d);return typeof h=="function"&&t.cleanupCache.set(n,h),u}}(ST)),ST}var J_={},Q_={},gF;function LO(){if(gF)return Q_;gF=1,Object.defineProperty(Q_,"__esModule",{value:!0}),Q_.wait=t;async function t(e){return new Promise(r=>setTimeout(r,e))}return Q_}var mF;function A1(){if(mF)return J_;mF=1,Object.defineProperty(J_,"__esModule",{value:!0}),J_.poll=e;const t=LO();function e(r,{emitOnBegin:n,initialWaitTime:i,interval:s}){let o=!0;const a=()=>o=!1;return(async()=>{let u;n&&(u=await r({unpoll:a}));const l=await(i==null?void 0:i(u))??s;await(0,t.wait)(l);const d=async()=>{o&&(await r({unpoll:a}),await(0,t.wait)(s),d())};d()})(),a}return J_}var Fw={},TT={},wF;function tX(){return wF||(wF=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.responseCache=t.promiseCache=void 0,t.getCache=e,t.withCache=r,t.promiseCache=new Map,t.responseCache=new Map;function e(n){const i=(a,c)=>({clear:()=>c.delete(a),get:()=>c.get(a),set:u=>c.set(a,u)}),s=i(n,t.promiseCache),o=i(n,t.responseCache);return{clear:()=>{s.clear(),o.clear()},promise:s,response:o}}async function r(n,{cacheKey:i,cacheTime:s=Number.POSITIVE_INFINITY}){const o=e(i),a=o.response.get();if(a&&s>0&&new Date().getTime()-a.created.getTime()`blockNumber.${i}`;function r(i){return(0,t.getCache)(e(i))}async function n(i,{cacheTime:s=i.cacheTime}={}){const o=await(0,t.withCache)(()=>i.request({method:"eth_blockNumber"}),{cacheKey:e(i.uid),cacheTime:s});return BigInt(o)}return Fw}var X_={},yF;function fx(){if(yF)return X_;yF=1,Object.defineProperty(X_,"__esModule",{value:!0}),X_.getFilterChanges=r;const t=O2(),e=ol();async function r(n,{filter:i}){const s="strict"in i&&i.strict,o=await i.request({method:"eth_getFilterChanges",params:[i.id]});if(typeof o[0]=="string")return o;const a=o.map(c=>(0,e.formatLog)(c));return!("abi"in i)||!i.abi?a:(0,t.parseEventLogs)({abi:i.abi,logs:a,strict:s})}return X_}var eE={},vF;function px(){if(vF)return eE;vF=1,Object.defineProperty(eE,"__esModule",{value:!0}),eE.uninstallFilter=t;async function t(e,{filter:r}){return r.request({method:"eth_uninstallFilter",params:[r.id]})}return eE}var _F;function rX(){if(_F)return Y_;_F=1,Object.defineProperty(Y_,"__esModule",{value:!0}),Y_.watchContractEvent=g;const t=$r(),e=Xd(),r=P2(),n=Up(),i=ol(),s=ur(),o=qp(),a=A1(),c=Gn(),u=gO(),l=$2(),d=PO(),h=fx(),f=px();function g(p,m){const{abi:b,address:v,args:E,batch:w=!0,eventName:C,fromBlock:y,onError:_,onLogs:x,poll:A,pollingInterval:T=p.pollingInterval,strict:O}=m;return(typeof A<"u"?A:typeof y=="bigint"?!0:!(p.transport.type==="webSocket"||p.transport.type==="fallback"&&p.transport.transports[0].config.type==="webSocket"))?(()=>{const S=O??!1,P=(0,c.stringify)(["watchContractEvent",v,E,w,p.uid,C,T,S,y]);return(0,o.observe)(P,{onLogs:x,onError:_},I=>{let B;y!==void 0&&(B=y-1n);let $,R=!1;const D=(0,a.poll)(async()=>{var L;if(!R){try{$=await(0,s.getAction)(p,u.createContractEventFilter,"createContractEventFilter")({abi:b,address:v,args:E,eventName:C,strict:S,fromBlock:y})}catch{}R=!0;return}try{let U;if($)U=await(0,s.getAction)(p,h.getFilterChanges,"getFilterChanges")({filter:$});else{const z=await(0,s.getAction)(p,l.getBlockNumber,"getBlockNumber")({});B&&B{$&&await(0,s.getAction)(p,f.uninstallFilter,"uninstallFilter")({filter:$}),D()}})})():(()=>{const S=O??!1,P=(0,c.stringify)(["watchContractEvent",v,E,w,p.uid,C,T,S]);let I=!0,B=()=>I=!1;return(0,o.observe)(P,{onLogs:x,onError:_},$=>((async()=>{try{const R=(()=>{if(p.transport.type==="fallback"){const U=p.transport.transports.find(z=>z.config.type==="webSocket");return U?U.value:p.transport}return p.transport})(),D=C?(0,n.encodeEventTopics)({abi:b,eventName:C,args:E}):[],{unsubscribe:L}=await R.subscribe({params:["logs",{address:v,topics:D}],onData(U){var W;if(!I)return;const z=U.result;try{const{eventName:K,args:J}=(0,r.decodeEventLog)({abi:b,data:z.data,topics:z.topics,strict:O}),ne=(0,i.formatLog)(z,{args:J,eventName:K});$.onLogs([ne])}catch(K){let J,ne;if(K instanceof t.DecodeLogDataMismatch||K instanceof t.DecodeLogTopicsMismatch){if(O)return;J=K.abiItem.name,ne=(W=K.abiItem.inputs)==null?void 0:W.some(he=>!("name"in he&&he.name))}const ae=(0,i.formatLog)(z,{args:ne?[]:{},eventName:J});$.onLogs([ae])}},onError(U){var z;(z=$.onError)==null||z.call($,U)}});B=L,I||B()}catch(R){_==null||_(R)}})(),()=>B()))})()}return Y_}var tE={},Ah={},EF;function zp(){if(EF)return Ah;EF=1,Object.defineProperty(Ah,"__esModule",{value:!0}),Ah.AccountTypeNotSupportedError=Ah.AccountNotFoundError=void 0;const t=_t();class e extends t.BaseError{constructor({docsPath:i}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(` `),{docsPath:i,docsSlug:"account",name:"AccountNotFoundError"})}}Ah.AccountNotFoundError=e;class r extends t.BaseError{constructor({docsPath:i,metaMessages:s,type:o}){super(`Account type "${o}" is not supported.`,{docsPath:i,metaMessages:s,name:"AccountTypeNotSupportedError"})}}return Ah.AccountTypeNotSupportedError=r,Ah}var rE={},nE={},CF;function gx(){if(CF)return nE;CF=1,Object.defineProperty(nE,"__esModule",{value:!0}),nE.assertCurrentChain=e;const t=R2();function e({chain:r,currentChainId:n}){if(!r)throw new t.ChainNotFoundError;if(n!==r.id)throw new t.ChainMismatchError({chain:r,currentChainId:n})}return nE}var iE={},AF;function UO(){if(AF)return iE;AF=1,Object.defineProperty(iE,"__esModule",{value:!0}),iE.getTransactionError=n;const t=nl(),e=Ds(),r=S2();function n(i,{docsPath:s,...o}){const a=(()=>{const c=(0,r.getNodeError)(i,o);return c instanceof t.UnknownNodeError?i:c})();return new e.TransactionExecutionError(a,{docsPath:s,...o})}return iE}var sE={},xF;function FO(){if(xF)return sE;xF=1,Object.defineProperty(sE,"__esModule",{value:!0}),sE.sendRawTransaction=t;async function t(e,{serializedTransaction:r}){return e.request({method:"eth_sendRawTransaction",params:[r]},{retryCount:0})}return sE}var SF;function mx(){if(SF)return rE;SF=1,Object.defineProperty(rE,"__esModule",{value:!0}),rE.sendTransaction=p;const t=sn(),e=zp(),r=_t(),n=nx(),i=gx(),s=UO(),o=_1(),a=il(),c=ur(),u=y2(),l=sl(),d=C1(),h=dx(),f=FO(),g=new u.LruMap(128);async function p(m,b){var B,$,R,D;const{account:v=m.account,chain:E=m.chain,accessList:w,authorizationList:C,blobs:y,data:_,gas:x,gasPrice:A,maxFeePerBlobGas:T,maxFeePerGas:O,maxPriorityFeePerGas:k,nonce:j,type:N,value:S,...P}=b;if(typeof v>"u")throw new e.AccountNotFoundError({docsPath:"/docs/actions/wallet/sendTransaction"});const I=v?(0,t.parseAccount)(v):null;try{(0,l.assertRequest)(b);const L=await(async()=>{if(b.to)return b.to;if(b.to!==null&&C&&C.length>0)return await(0,n.recoverAuthorizationAddress)({authorization:C[0]}).catch(()=>{throw new r.BaseError("`to` is required. Could not infer from `authorizationList`.")})})();if((I==null?void 0:I.type)==="json-rpc"||I===null){let U;E!==null&&(U=await(0,c.getAction)(m,d.getChainId,"getChainId")({}),(0,i.assertCurrentChain)({currentChainId:U,chain:E}));const z=(R=($=(B=m.chain)==null?void 0:B.formatters)==null?void 0:$.transactionRequest)==null?void 0:R.format,K=(z||a.formatTransactionRequest)({...(0,o.extract)(P,{format:z}),accessList:w,authorizationList:C,blobs:y,chainId:U,data:_,from:I==null?void 0:I.address,gas:x,gasPrice:A,maxFeePerBlobGas:T,maxFeePerGas:O,maxPriorityFeePerGas:k,nonce:j,to:L,type:N,value:S}),J=g.get(m.uid),ne=J?"wallet_sendTransaction":"eth_sendTransaction";try{return await m.request({method:ne,params:[K]},{retryCount:0})}catch(ae){if(J===!1)throw ae;const he=ae;if(he.name==="InvalidInputRpcError"||he.name==="InvalidParamsRpcError"||he.name==="MethodNotFoundRpcError"||he.name==="MethodNotSupportedRpcError")return await m.request({method:"wallet_sendTransaction",params:[K]},{retryCount:0}).then(ie=>(g.set(m.uid,!0),ie)).catch(ie=>{const Ee=ie;throw Ee.name==="MethodNotFoundRpcError"||Ee.name==="MethodNotSupportedRpcError"?(g.set(m.uid,!1),he):Ee});throw he}}if((I==null?void 0:I.type)==="local"){const U=await(0,c.getAction)(m,h.prepareTransactionRequest,"prepareTransactionRequest")({account:I,accessList:w,authorizationList:C,blobs:y,chain:E,data:_,gas:x,gasPrice:A,maxFeePerBlobGas:T,maxFeePerGas:O,maxPriorityFeePerGas:k,nonce:j,nonceManager:I.nonceManager,parameters:[...h.defaultParameters,"sidecars"],type:N,value:S,...P,to:L}),z=(D=E==null?void 0:E.serializers)==null?void 0:D.transaction,W=await I.signTransaction(U,{serializer:z});return await(0,c.getAction)(m,f.sendRawTransaction,"sendRawTransaction")({serializedTransaction:W})}throw(I==null?void 0:I.type)==="smart"?new e.AccountTypeNotSupportedError({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new e.AccountTypeNotSupportedError({docsPath:"/docs/actions/wallet/sendTransaction",type:I==null?void 0:I.type})}catch(L){throw L instanceof e.AccountTypeNotSupportedError?L:(0,s.getTransactionError)(L,{...b,account:I,chain:b.chain||void 0})}}return rE}var TF;function nX(){if(TF)return tE;TF=1,Object.defineProperty(tE,"__esModule",{value:!0}),tE.writeContract=o;const t=sn(),e=zp(),r=Bs(),n=eh(),i=ur(),s=mx();async function o(a,c){const{abi:u,account:l=a.account,address:d,args:h,dataSuffix:f,functionName:g,...p}=c;if(typeof l>"u")throw new e.AccountNotFoundError({docsPath:"/docs/contract/writeContract"});const m=l?(0,t.parseAccount)(l):null,b=(0,r.encodeFunctionData)({abi:u,args:h,functionName:g});try{return await(0,i.getAction)(a,s.sendTransaction,"sendTransaction")({data:`${b}${f?f.replace("0x",""):""}`,to:d,account:m,...p})}catch(v){throw(0,n.getContractError)(v,{abi:u,address:d,args:h,docsPath:"/docs/contract/writeContract",functionName:g,sender:m==null?void 0:m.address})}}return tE}var IF;function EIe(){if(IF)return w0;IF=1,Object.defineProperty(w0,"__esModule",{value:!0}),w0.getContract=c,w0.getFunctionParameters=u,w0.getEventParameters=l;const t=ur(),e=gO(),r=ZQ(),n=PO(),i=ul(),s=eX(),o=rX(),a=nX();function c({abi:d,address:h,client:f}){const g=f,[p,m]=g?"public"in g&&"wallet"in g?[g.public,g.wallet]:"public"in g?[g.public,void 0]:"wallet"in g?[void 0,g.wallet]:[g,g]:[void 0,void 0],b=p!=null,v=m!=null,E={};let w=!1,C=!1,y=!1;for(const _ of d)if(_.type==="function"?_.stateMutability==="view"||_.stateMutability==="pure"?w=!0:C=!0:_.type==="event"&&(y=!0),w&&C&&y)break;return b&&(w&&(E.read=new Proxy({},{get(_,x){return(...A)=>{const{args:T,options:O}=u(A);return(0,t.getAction)(p,i.readContract,"readContract")({abi:d,address:h,functionName:x,args:T,...O})}}})),C&&(E.simulate=new Proxy({},{get(_,x){return(...A)=>{const{args:T,options:O}=u(A);return(0,t.getAction)(p,s.simulateContract,"simulateContract")({abi:d,address:h,functionName:x,args:T,...O})}}})),y&&(E.createEventFilter=new Proxy({},{get(_,x){return(...A)=>{const T=d.find(j=>j.type==="event"&&j.name===x),{args:O,options:k}=l(A,T);return(0,t.getAction)(p,e.createContractEventFilter,"createContractEventFilter")({abi:d,address:h,eventName:x,args:O,...k})}}}),E.getEvents=new Proxy({},{get(_,x){return(...A)=>{const T=d.find(j=>j.type==="event"&&j.name===x),{args:O,options:k}=l(A,T);return(0,t.getAction)(p,n.getContractEvents,"getContractEvents")({abi:d,address:h,eventName:x,args:O,...k})}}}),E.watchEvent=new Proxy({},{get(_,x){return(...A)=>{const T=d.find(j=>j.type==="event"&&j.name===x),{args:O,options:k}=l(A,T);return(0,t.getAction)(p,o.watchContractEvent,"watchContractEvent")({abi:d,address:h,eventName:x,args:O,...k})}}}))),v&&C&&(E.write=new Proxy({},{get(_,x){return(...A)=>{const{args:T,options:O}=u(A);return(0,t.getAction)(m,a.writeContract,"writeContract")({abi:d,address:h,functionName:x,args:T,...O})}}})),(b||v)&&C&&(E.estimateGas=new Proxy({},{get(_,x){return(...A)=>{const{args:T,options:O}=u(A),k=p??m;return(0,t.getAction)(k,r.estimateContractGas,"estimateContractGas")({abi:d,address:h,functionName:x,args:T,...O,account:O.account??m.account})}}})),E.address=h,E.abi=d,E}function u(d){const h=d.length&&Array.isArray(d[0]),f=h?d[0]:[],g=(h?d[1]:d[0])??{};return{args:f,options:g}}function l(d,h){let f=!1;Array.isArray(d[0])?f=!0:d.length===1?f=h.inputs.some(m=>m.indexed):d.length===2&&(f=!0);const g=f?d[0]:void 0,p=(f?d[1]:d[0])??{};return{args:g,options:p}}return w0}var I0={},oE={},IT={},PF;function wx(){return PF||(PF=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.defineTransactionReceipt=t.receiptStatuses=void 0,t.formatTransactionReceipt=s;const e=nn(),r=T2(),n=ol(),i=I2();t.receiptStatuses={"0x0":"reverted","0x1":"success"};function s(o){const a={...o,blockNumber:o.blockNumber?BigInt(o.blockNumber):null,contractAddress:o.contractAddress?o.contractAddress:null,cumulativeGasUsed:o.cumulativeGasUsed?BigInt(o.cumulativeGasUsed):null,effectiveGasPrice:o.effectiveGasPrice?BigInt(o.effectiveGasPrice):null,gasUsed:o.gasUsed?BigInt(o.gasUsed):null,logs:o.logs?o.logs.map(c=>(0,n.formatLog)(c)):null,to:o.to?o.to:null,transactionIndex:o.transactionIndex?(0,e.hexToNumber)(o.transactionIndex):null,status:o.status?t.receiptStatuses[o.status]:null,type:o.type?i.transactionType[o.type]||o.type:null};return o.blobGasPrice&&(a.blobGasPrice=BigInt(o.blobGasPrice)),o.blobGasUsed&&(a.blobGasUsed=BigInt(o.blobGasUsed)),a}t.defineTransactionReceipt=(0,r.defineFormatter)("transactionReceipt",s)}(IT)),IT}var PT={},OF;function iX(){return OF||(OF=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.fallbackTransactionErrorMagicIdentifier=t.fallbackMagicIdentifier=void 0,t.sendCalls=l;const e=sn(),r=_t(),n=Xd(),i=Bs(),s=oi(),o=nn(),a=ze(),c=UO(),u=mx();t.fallbackMagicIdentifier="0x5792579257925792579257925792579257925792579257925792579257925792",t.fallbackTransactionErrorMagicIdentifier=(0,a.numberToHex)(0,{size:32});async function l(d,h){const{account:f=d.account,capabilities:g,chain:p=d.chain,experimental_fallback:m,experimental_fallbackDelay:b=32,forceAtomic:v=!1,id:E,version:w="2.0.0"}=h,C=f?(0,e.parseAccount)(f):null,y=h.calls.map(_=>{const x=_;return{data:x.abi?(0,i.encodeFunctionData)({abi:x.abi,functionName:x.functionName,args:x.args}):x.data,to:x.to,value:x.value?(0,a.numberToHex)(x.value):void 0}});try{const _=await d.request({method:"wallet_sendCalls",params:[{atomicRequired:v,calls:y,capabilities:g,chainId:(0,a.numberToHex)(p.id),from:C==null?void 0:C.address,id:E,version:w}]},{retryCount:0});return typeof _=="string"?{id:_}:_}catch(_){const x=_;if(m&&(x.name==="MethodNotFoundRpcError"||x.name==="MethodNotSupportedRpcError"||x.details.toLowerCase().includes("does not exist / is not available")||x.details.toLowerCase().includes("missing or invalid. request()")||x.details.toLowerCase().includes("did not match any variant of untagged enum"))){if(g&&Object.values(g).some(j=>!j.optional)){const j="non-optional `capabilities` are not supported on fallback to `eth_sendTransaction`.";throw new n.UnsupportedNonOptionalCapabilityError(new r.BaseError(j,{details:j}))}if(v&&y.length>1){const k="`forceAtomic` is not supported on fallback to `eth_sendTransaction`.";throw new n.AtomicityNotSupportedError(new r.BaseError(k,{details:k}))}const A=[];for(const k of y){const j=(0,u.sendTransaction)(d,{account:C,chain:p,data:k.data,to:k.to,value:k.value?(0,o.hexToBigInt)(k.value):void 0});A.push(j),b>0&&await new Promise(N=>setTimeout(N,b))}const T=await Promise.allSettled(A);if(T.every(k=>k.status==="rejected"))throw T[0].reason;const O=T.map(k=>k.status==="fulfilled"?k.value:t.fallbackTransactionErrorMagicIdentifier);return{id:(0,s.concat)([...O,(0,a.numberToHex)(p.id,{size:32}),t.fallbackMagicIdentifier])}}throw(0,c.getTransactionError)(_,{...h,account:C,chain:h.chain})}}}(PT)),PT}var RF;function sX(){if(RF)return oE;RF=1,Object.defineProperty(oE,"__esModule",{value:!0}),oE.getCallsStatus=s;const t=go(),e=tl(),r=nn(),n=wx(),i=iX();async function s(o,a){async function c(m){if(m.endsWith(i.fallbackMagicIdentifier.slice(2))){const v=(0,e.trim)((0,t.sliceHex)(m,-64,-32)),E=(0,t.sliceHex)(m,0,-64).slice(2).match(/.{1,64}/g),w=await Promise.all(E.map(y=>i.fallbackTransactionErrorMagicIdentifier.slice(2)!==y?o.request({method:"eth_getTransactionReceipt",params:[`0x${y}`]},{dedupe:!0}):void 0)),C=w.some(y=>y===null)?100:w.every(y=>(y==null?void 0:y.status)==="0x1")?200:w.every(y=>(y==null?void 0:y.status)==="0x0")?500:600;return{atomic:!1,chainId:(0,r.hexToNumber)(v),receipts:w.filter(Boolean),status:C,version:"2.0.0"}}return o.request({method:"wallet_getCallsStatus",params:[m]})}const{atomic:u=!1,chainId:l,receipts:d,version:h="2.0.0",...f}=await c(a.id),[g,p]=(()=>{const m=f.status;return m>=100&&m<200?["pending",m]:m>=200&&m<300?["success",m]:m>=300&&m<700?["failure",m]:m==="CONFIRMED"?["success",200]:m==="PENDING"?["pending",100]:[void 0,m]})();return{...f,atomic:u,chainId:l?(0,r.hexToNumber)(l):void 0,receipts:(d==null?void 0:d.map(m=>({...m,blockNumber:(0,r.hexToBigInt)(m.blockNumber),gasUsed:(0,r.hexToBigInt)(m.gasUsed),status:n.receiptStatuses[m.status]})))??[],statusCode:p,status:g,version:h}}return oE}var kF;function oX(){if(kF)return I0;kF=1,Object.defineProperty(I0,"__esModule",{value:!0}),I0.WaitForCallsStatusTimeoutError=void 0,I0.waitForCallsStatus=o;const t=_t(),e=qp(),r=A1(),n=kO(),i=Gn(),s=sX();async function o(c,u){const{id:l,pollingInterval:d=c.pollingInterval,status:h=({statusCode:w})=>w>=200,timeout:f=6e4}=u,g=(0,i.stringify)(["waitForCallsStatus",c.uid,l]),{promise:p,resolve:m,reject:b}=(0,n.withResolvers)();let v;const E=(0,e.observe)(g,{resolve:m,reject:b},w=>{const C=(0,r.poll)(async()=>{const y=_=>{clearTimeout(v),C(),_(),E()};try{const _=await(0,s.getCallsStatus)(c,{id:l});if(!h(_))return;y(()=>w.resolve(_))}catch(_){y(()=>w.reject(_))}},{interval:d,emitOnBegin:!0});return C});return v=f?setTimeout(()=>{E(),clearTimeout(v),b(new a({id:l}))},f):void 0,await p}class a extends t.BaseError{constructor({id:u}){super(`Timed out while waiting for call bundle with id "${u}" to be confirmed.`,{name:"WaitForCallsStatusTimeoutError"})}}return I0.WaitForCallsStatusTimeoutError=a,I0}var Hw={},aE={},NF;function aX(){if(NF)return aE;NF=1,Object.defineProperty(aE,"__esModule",{value:!0}),aE.uid=n;const t=256;let e=t,r;function n(i=11){if(!r||e+i>t*2){r="",e=0;for(let s=0;s{const x=_(y);for(const T in w)delete x[T];const A={...y,...x};return Object.assign(A,{extend:C(A)})}}return Object.assign(w,{extend:C(w)})}function n(){return null}return Hw}var cE={},uE={},qw={},OT={},jF;function CIe(){return jF||(jF=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.promiseCache=void 0,t.withDedupe=r;const e=y2();t.promiseCache=new e.LruMap(8192);function r(n,{enabled:i=!0,id:s}){if(!i||!s)return n();if(t.promiseCache.get(s))return t.promiseCache.get(s);const o=n().finally(()=>t.promiseCache.delete(s));return t.promiseCache.set(s,o),o}}(OT)),OT}var lE={},BF;function HO(){if(BF)return lE;BF=1,Object.defineProperty(lE,"__esModule",{value:!0}),lE.withRetry=e;const t=LO();function e(r,{delay:n=100,retryCount:i=2,shouldRetry:s=()=>!0}={}){return new Promise((o,a)=>{const c=async({count:u=0}={})=>{const l=async({error:d})=>{const h=typeof n=="function"?n({count:u,error:d}):n;h&&await(0,t.wait)(h),c({count:u+1})};try{const d=await r();o(d)}catch(d){if(u{var w;const{dedupe:f=!1,methods:g,retryDelay:p=150,retryCount:m=3,uid:b}={...l,...h},{method:v}=d;if((w=g==null?void 0:g.exclude)!=null&&w.includes(v))throw new r.MethodNotSupportedRpcError(new Error("method not supported"),{method:v});if(g!=null&&g.include&&!g.include.includes(v))throw new r.MethodNotSupportedRpcError(new Error("method not supported"),{method:v});const E=f?(0,n.stringToHex)(`${b}.${(0,o.stringify)(d)}`):void 0;return(0,i.withDedupe)(()=>(0,s.withRetry)(async()=>{try{return await u(d)}catch(C){const y=C;switch(y.code){case r.ParseRpcError.code:throw new r.ParseRpcError(y);case r.InvalidRequestRpcError.code:throw new r.InvalidRequestRpcError(y);case r.MethodNotFoundRpcError.code:throw new r.MethodNotFoundRpcError(y,{method:d.method});case r.InvalidParamsRpcError.code:throw new r.InvalidParamsRpcError(y);case r.InternalRpcError.code:throw new r.InternalRpcError(y);case r.InvalidInputRpcError.code:throw new r.InvalidInputRpcError(y);case r.ResourceNotFoundRpcError.code:throw new r.ResourceNotFoundRpcError(y);case r.ResourceUnavailableRpcError.code:throw new r.ResourceUnavailableRpcError(y);case r.TransactionRejectedRpcError.code:throw new r.TransactionRejectedRpcError(y);case r.MethodNotSupportedRpcError.code:throw new r.MethodNotSupportedRpcError(y,{method:d.method});case r.LimitExceededRpcError.code:throw new r.LimitExceededRpcError(y);case r.JsonRpcVersionUnsupportedError.code:throw new r.JsonRpcVersionUnsupportedError(y);case r.UserRejectedRequestError.code:throw new r.UserRejectedRequestError(y);case r.UnauthorizedProviderError.code:throw new r.UnauthorizedProviderError(y);case r.UnsupportedProviderMethodError.code:throw new r.UnsupportedProviderMethodError(y);case r.ProviderDisconnectedError.code:throw new r.ProviderDisconnectedError(y);case r.ChainDisconnectedError.code:throw new r.ChainDisconnectedError(y);case r.SwitchChainError.code:throw new r.SwitchChainError(y);case r.UnsupportedNonOptionalCapabilityError.code:throw new r.UnsupportedNonOptionalCapabilityError(y);case r.UnsupportedChainIdError.code:throw new r.UnsupportedChainIdError(y);case r.DuplicateIdError.code:throw new r.DuplicateIdError(y);case r.UnknownBundleIdError.code:throw new r.UnknownBundleIdError(y);case r.BundleTooLargeError.code:throw new r.BundleTooLargeError(y);case r.AtomicReadyWalletRejectedUpgradeError.code:throw new r.AtomicReadyWalletRejectedUpgradeError(y);case r.AtomicityNotSupportedError.code:throw new r.AtomicityNotSupportedError(y);case 5e3:throw new r.UserRejectedRequestError(y);default:throw C instanceof t.BaseError?C:new r.UnknownRpcError(y)}}},{delay:({count:C,error:y})=>{var _;if(y&&y instanceof e.HttpRequestError){const x=(_=y==null?void 0:y.headers)==null?void 0:_.get("Retry-After");if(x!=null&&x.match(/\d/))return Number.parseInt(x)*1e3}return~~(1<c(C)}),{enabled:f,id:E})}}function c(u){return"code"in u&&typeof u.code=="number"?u.code===-1||u.code===r.LimitExceededRpcError.code||u.code===r.InternalRpcError.code:u instanceof e.HttpRequestError&&u.status?u.status===403||u.status===408||u.status===413||u.status===429||u.status===500||u.status===502||u.status===503||u.status===504:!0}return qw}var MF;function j2(){if(MF)return uE;MF=1,Object.defineProperty(uE,"__esModule",{value:!0}),uE.createTransport=r;const t=cX(),e=aX();function r({key:n,methods:i,name:s,request:o,retryCount:a=3,retryDelay:c=150,timeout:u,type:l},d){const h=(0,e.uid)();return{config:{key:n,methods:i,name:s,request:o,retryCount:a,retryDelay:c,timeout:u,type:l},request:(0,t.buildRequest)(o,{methods:i,retryCount:a,retryDelay:c,uid:h}),value:d}}return uE}var LF;function AIe(){if(LF)return cE;LF=1,Object.defineProperty(cE,"__esModule",{value:!0}),cE.custom=e;const t=j2();function e(r,n={}){const{key:i="custom",methods:s,name:o="Custom Provider",retryDelay:a}=n;return({retryCount:c})=>(0,t.createTransport)({key:i,methods:s,name:o,request:r.request.bind(r),retryCount:n.retryCount??c,retryDelay:a,type:"custom"})}return cE}var P0={},UF;function xIe(){if(UF)return P0;UF=1,Object.defineProperty(P0,"__esModule",{value:!0}),P0.fallback=i,P0.shouldThrow=s,P0.rankTransports=o;const t=nl(),e=Xd(),r=LO(),n=j2();function i(a,c={}){const{key:u="fallback",name:l="Fallback",rank:d=!1,shouldThrow:h=s,retryCount:f,retryDelay:g}=c;return({chain:p,pollingInterval:m=4e3,timeout:b,...v})=>{let E=a,w=()=>{};const C=(0,n.createTransport)({key:u,name:l,async request({method:y,params:_}){let x;const A=async(T=0)=>{const O=E[T]({...v,chain:p,retryCount:0,timeout:b});try{const k=await O.request({method:y,params:_});return w({method:y,params:_,response:k,transport:O,status:"success"}),k}catch(k){if(w({error:k,method:y,params:_,transport:O,status:"error"}),h(k)||T===E.length-1||(x??(x=E.slice(T+1).some(j=>{const{include:N,exclude:S}=j({chain:p}).config.methods||{};return N?N.includes(y):S?!S.includes(y):!0})),!x))throw k;return A(T+1)}};return A()},retryCount:f,retryDelay:g,type:"fallback"},{onResponse:y=>w=y,transports:E.map(y=>y({chain:p,retryCount:0}))});if(d){const y=typeof d=="object"?d:{};o({chain:p,interval:y.interval??m,onTransports:_=>E=_,ping:y.ping,sampleCount:y.sampleCount,timeout:y.timeout,transports:E,weights:y.weights})}return C}}function s(a){return!!("code"in a&&typeof a.code=="number"&&(a.code===e.TransactionRejectedRpcError.code||a.code===e.UserRejectedRequestError.code||t.ExecutionRevertedError.nodeMessage.test(a.message)||a.code===5e3))}function o({chain:a,interval:c=4e3,onTransports:u,ping:l,sampleCount:d=10,timeout:h=1e3,transports:f,weights:g={}}){const{stability:p=.7,latency:m=.3}=g,b=[],v=async()=>{const E=await Promise.all(f.map(async y=>{const _=y({chain:a,retryCount:0,timeout:h}),x=Date.now();let A,T;try{await(l?l({transport:_}):_.request({method:"net_listening"})),T=1}catch{T=0}finally{A=Date.now()}return{latency:A-x,success:T}}));b.push(E),b.length>d&&b.shift();const w=Math.max(...b.map(y=>Math.max(...y.map(({latency:_})=>_)))),C=f.map((y,_)=>{const x=b.map(j=>j[_].latency),T=1-x.reduce((j,N)=>j+N,0)/x.length/w,O=b.map(j=>j[_].success),k=O.reduce((j,N)=>j+N,0)/O.length;return k===0?[0,_]:[m*T+p*k,_]}).sort((y,_)=>_[0]-y[0]);u(C.map(([,y])=>f[y])),await(0,r.wait)(c),v()};v()}return P0}var dE={},zw={},FF;function qO(){if(FF)return zw;FF=1,Object.defineProperty(zw,"__esModule",{value:!0}),zw.UrlRequiredError=void 0;const t=_t();class e extends t.BaseError{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}return zw.UrlRequiredError=e,zw}var hE={},fE={},HF;function zO(){if(HF)return fE;HF=1,Object.defineProperty(fE,"__esModule",{value:!0}),fE.withTimeout=t;function t(e,{errorInstance:r=new Error("timed out"),timeout:n,signal:i}){return new Promise((s,o)=>{(async()=>{let a;try{const c=new AbortController;n>0&&(a=setTimeout(()=>{i?c.abort():o(r)},n)),s(await e({signal:(c==null?void 0:c.signal)||null}))}catch(c){(c==null?void 0:c.name)==="AbortError"&&o(r),o(c)}finally{clearTimeout(a)}})()})}return fE}var Ww={},qF;function uX(){if(qF)return Ww;qF=1,Object.defineProperty(Ww,"__esModule",{value:!0}),Ww.idCache=void 0;function t(){return{current:0,take(){return this.current++},reset(){this.current=0}}}return Ww.idCache=t(),Ww}var zF;function WO(){if(zF)return hE;zF=1,Object.defineProperty(hE,"__esModule",{value:!0}),hE.getHttpRpcClient=i;const t=ha(),e=zO(),r=Gn(),n=uX();function i(s,o={}){return{async request(a){var m;const{body:c,onRequest:u=o.onRequest,onResponse:l=o.onResponse,timeout:d=o.timeout??1e4}=a,h={...o.fetchOptions??{},...a.fetchOptions??{}},{headers:f,method:g,signal:p}=h;try{const b=await(0,e.withTimeout)(async({signal:E})=>{const w={...h,body:Array.isArray(c)?(0,r.stringify)(c.map(x=>({jsonrpc:"2.0",id:x.id??n.idCache.take(),...x}))):(0,r.stringify)({jsonrpc:"2.0",id:c.id??n.idCache.take(),...c}),headers:{"Content-Type":"application/json",...f},method:g||"POST",signal:p||(d>0?E:null)},C=new Request(s,w),y=await(u==null?void 0:u(C,w))??{...w,url:s};return await fetch(y.url??s,y)},{errorInstance:new t.TimeoutError({body:c,url:s}),timeout:d,signal:!0});l&&await l(b);let v;if((m=b.headers.get("Content-Type"))!=null&&m.startsWith("application/json"))v=await b.json();else{v=await b.text();try{v=JSON.parse(v||"{}")}catch(E){if(b.ok)throw E;v={error:v}}}if(!b.ok)throw new t.HttpRequestError({body:c,details:(0,r.stringify)(v.error)||b.statusText,headers:b.headers,status:b.status,url:s});return v}catch(b){throw b instanceof t.HttpRequestError||b instanceof t.TimeoutError?b:new t.HttpRequestError({body:c,cause:b,url:s})}}}}return hE}var WF;function SIe(){if(WF)return dE;WF=1,Object.defineProperty(dE,"__esModule",{value:!0}),dE.http=s;const t=ha(),e=qO(),r=NO(),n=WO(),i=j2();function s(o,a={}){const{batch:c,fetchOptions:u,key:l="http",methods:d,name:h="HTTP JSON-RPC",onFetchRequest:f,onFetchResponse:g,retryDelay:p,raw:m}=a;return({chain:b,retryCount:v,timeout:E})=>{const{batchSize:w=1e3,wait:C=0}=typeof c=="object"?c:{},y=a.retryCount??v,_=E??a.timeout??1e4,x=o||(b==null?void 0:b.rpcUrls.default.http[0]);if(!x)throw new e.UrlRequiredError;const A=(0,n.getHttpRpcClient)(x,{fetchOptions:u,onRequest:f,onResponse:g,timeout:_});return(0,i.createTransport)({key:l,methods:d,name:h,async request({method:T,params:O}){const k={method:T,params:O},{schedule:j}=(0,r.createBatchScheduler)({id:x,wait:C,shouldSplitBatch(I){return I.length>w},fn:I=>A.request({body:I}),sort:(I,B)=>I.id-B.id}),N=async I=>c?j(I):[await A.request({body:I})],[{error:S,result:P}]=await N(k);if(m)return{error:S,result:P};if(S)throw new t.RpcRequestError({body:k,error:S,url:x});return P},retryCount:y,retryDelay:p,timeout:_,type:"http"},{fetchOptions:u,url:x})}}return dE}var pE={},gE={},mE={},wE={},VF;function VO(){if(VF)return wE;VF=1,Object.defineProperty(wE,"__esModule",{value:!0}),wE.isNullUniversalResolverError=n;const t=XA(),e=_t(),r=Qd();function n(i,s){var a,c,u,l,d,h;if(!(i instanceof e.BaseError))return!1;const o=i.walk(f=>f instanceof r.ContractFunctionRevertedError);return o instanceof r.ContractFunctionRevertedError?!!(((a=o.data)==null?void 0:a.errorName)==="ResolverNotFound"||((c=o.data)==null?void 0:c.errorName)==="ResolverWildcardNotSupported"||((u=o.data)==null?void 0:u.errorName)==="ResolverNotContract"||((l=o.data)==null?void 0:l.errorName)==="ResolverError"||((d=o.data)==null?void 0:d.errorName)==="HttpError"||(h=o.reason)!=null&&h.includes("Wildcard on non-extended resolvers is not supported")||s==="reverse"&&o.reason===t.panicReasons[50]):!1}return wE}var bE={},yE={},GF;function lX(){if(GF)return yE;GF=1,Object.defineProperty(yE,"__esModule",{value:!0}),yE.encodedLabelToLabelhash=e;const t=ki();function e(r){if(r.length!==66||r.indexOf("[")!==0||r.indexOf("]")!==65)return null;const n=`0x${r.slice(1,65)}`;return(0,t.isHex)(n)?n:null}return yE}var KF;function GO(){if(KF)return bE;KF=1,Object.defineProperty(bE,"__esModule",{value:!0}),bE.namehash=s;const t=oi(),e=Tr(),r=ze(),n=ns(),i=lX();function s(o){let a=new Uint8Array(32).fill(0);if(!o)return(0,r.bytesToHex)(a);const c=o.split(".");for(let u=c.length-1;u>=0;u-=1){const l=(0,i.encodedLabelToLabelhash)(c[u]),d=l?(0,e.toBytes)(l):(0,n.keccak256)((0,e.stringToBytes)(c[u]),"bytes");a=(0,n.keccak256)((0,t.concat)([a,d]),"bytes")}return(0,r.bytesToHex)(a)}return bE}var vE={},_E={},ZF;function TIe(){if(ZF)return _E;ZF=1,Object.defineProperty(_E,"__esModule",{value:!0}),_E.encodeLabelhash=t;function t(e){return`[${e.slice(2)}]`}return _E}var EE={},YF;function dX(){if(YF)return EE;YF=1,Object.defineProperty(EE,"__esModule",{value:!0}),EE.labelhash=i;const t=Tr(),e=ze(),r=ns(),n=lX();function i(s){const o=new Uint8Array(32).fill(0);return s?(0,n.encodedLabelToLabelhash)(s)||(0,r.keccak256)((0,t.stringToBytes)(s)):(0,e.bytesToHex)(o)}return EE}var JF;function yx(){if(JF)return vE;JF=1,Object.defineProperty(vE,"__esModule",{value:!0}),vE.packetToBytes=n;const t=Tr(),e=TIe(),r=dX();function n(i){const s=i.replace(/^\.|\.$/gm,"");if(s.length===0)return new Uint8Array(1);const o=new Uint8Array((0,t.stringToBytes)(s).byteLength+2);let a=0;const c=s.split(".");for(let u=0;u255&&(l=(0,t.stringToBytes)((0,e.encodeLabelhash)((0,r.labelhash)(c[u])))),o[a]=l.length,o.set(l,a+1),a+=l.length+1}return o.byteLength!==a+1?o.slice(0,a+1):o}return vE}var QF;function IIe(){if(QF)return mE;QF=1,Object.defineProperty(mE,"__esModule",{value:!0}),mE.getEnsAddress=h;const t=rh(),e=al(),r=Bs(),n=nh(),i=tl(),s=ze(),o=VO(),a=DO(),c=GO(),u=yx(),l=ur(),d=ul();async function h(f,g){const{blockNumber:p,blockTag:m,coinType:b,name:v,gatewayUrls:E,strict:w}=g,{chain:C}=f,y=(()=>{if(g.universalResolverAddress)return g.universalResolverAddress;if(!C)throw new Error("client chain not configured. universalResolverAddress is required.");return(0,n.getChainContractAddress)({blockNumber:p,chain:C,contract:"ensUniversalResolver"})})(),_=C==null?void 0:C.ensTlds;if(_&&!_.some(x=>v.endsWith(x)))return null;try{const x=(0,r.encodeFunctionData)({abi:t.addressResolverAbi,functionName:"addr",...b!=null?{args:[(0,c.namehash)(v),BigInt(b)]}:{args:[(0,c.namehash)(v)]}}),A={address:y,abi:t.universalResolverResolveAbi,functionName:"resolve",args:[(0,s.toHex)((0,u.packetToBytes)(v)),x,E??[a.localBatchGatewayUrl]],blockNumber:p,blockTag:m},O=await(0,l.getAction)(f,d.readContract,"readContract")(A);if(O[0]==="0x")return null;const k=(0,e.decodeFunctionResult)({abi:t.addressResolverAbi,args:b!=null?[(0,c.namehash)(v),BigInt(b)]:void 0,functionName:"addr",data:O[0]});return k==="0x"||(0,i.trim)(k)==="0x00"?null:k}catch(x){if(w)throw x;if((0,o.isNullUniversalResolverError)(x,"resolve"))return null;throw x}}return mE}var CE={},AE={},Ao={},xo={},XF;function hX(){if(XF)return xo;XF=1,Object.defineProperty(xo,"__esModule",{value:!0}),xo.EnsAvatarUnsupportedNamespaceError=xo.EnsAvatarUriResolutionError=xo.EnsAvatarInvalidNftUriError=xo.EnsAvatarInvalidMetadataError=void 0;const t=_t();class e extends t.BaseError{constructor({data:o}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(o)}`],name:"EnsAvatarInvalidMetadataError"})}}xo.EnsAvatarInvalidMetadataError=e;class r extends t.BaseError{constructor({reason:o}){super(`ENS NFT avatar URI is invalid. ${o}`,{name:"EnsAvatarInvalidNftUriError"})}}xo.EnsAvatarInvalidNftUriError=r;class n extends t.BaseError{constructor({uri:o}){super(`Unable to resolve ENS avatar URI "${o}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}xo.EnsAvatarUriResolutionError=n;class i extends t.BaseError{constructor({namespace:o}){super(`ENS NFT avatar namespace "${o}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}return xo.EnsAvatarUnsupportedNamespaceError=i,xo}var eH;function PIe(){if(eH)return Ao;eH=1,Object.defineProperty(Ao,"__esModule",{value:!0}),Ao.isImageUri=o,Ao.getGateway=a,Ao.resolveAvatarUri=c,Ao.getJsonImage=u,Ao.getMetadataAvatarUri=l,Ao.parseAvatarUri=d,Ao.parseNftUri=h,Ao.getNftTokenUri=f;const t=ul(),e=hX(),r=/(?https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?\/)?(?ipfs\/|ipns\/)?(?[\w\-.]+)(?\/.*)?/,n=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?[\w\-.]+))?(?\/.*)?$/,i=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,s=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function o(g){try{const p=await fetch(g,{method:"HEAD"});if(p.status===200){const m=p.headers.get("content-type");return m==null?void 0:m.startsWith("image/")}return!1}catch(p){return typeof p=="object"&&typeof p.response<"u"||!globalThis.hasOwnProperty("Image")?!1:new Promise(m=>{const b=new Image;b.onload=()=>{m(!0)},b.onerror=()=>{m(!1)},b.src=g})}}function a(g,p){return g?g.endsWith("/")?g.slice(0,-1):g:p}function c({uri:g,gatewayUrls:p}){const m=i.test(g);if(m)return{uri:g,isOnChain:!0,isEncoded:m};const b=a(p==null?void 0:p.ipfs,"https://ipfs.io"),v=a(p==null?void 0:p.arweave,"https://arweave.net"),E=g.match(r),{protocol:w,subpath:C,target:y,subtarget:_=""}=(E==null?void 0:E.groups)||{},x=w==="ipns:/"||C==="ipns/",A=w==="ipfs:/"||C==="ipfs/"||n.test(g);if(g.startsWith("http")&&!x&&!A){let O=g;return p!=null&&p.arweave&&(O=g.replace(/https:\/\/arweave.net/g,p==null?void 0:p.arweave)),{uri:O,isOnChain:!1,isEncoded:!1}}if((x||A)&&y)return{uri:`${b}/${x?"ipns":"ipfs"}/${y}${_}`,isOnChain:!1,isEncoded:!1};if(w==="ar:/"&&y)return{uri:`${v}/${y}${_||""}`,isOnChain:!1,isEncoded:!1};let T=g.replace(s,"");if(T.startsWith("v.json());return await d({gatewayUrls:g,uri:u(m)})}catch{throw new e.EnsAvatarUriResolutionError({uri:p})}}async function d({gatewayUrls:g,uri:p}){const{uri:m,isOnChain:b}=c({uri:p,gatewayUrls:g});if(b||await o(m))return m;throw new e.EnsAvatarUriResolutionError({uri:p})}function h(g){let p=g;p.startsWith("did:nft:")&&(p=p.replace("did:nft:","").replace(/_/g,"/"));const[m,b,v]=p.split("/"),[E,w]=m.split(":"),[C,y]=b.split(":");if(!E||E.toLowerCase()!=="eip155")throw new e.EnsAvatarInvalidNftUriError({reason:"Only EIP-155 supported"});if(!w)throw new e.EnsAvatarInvalidNftUriError({reason:"Chain ID not found"});if(!y)throw new e.EnsAvatarInvalidNftUriError({reason:"Contract address not found"});if(!v)throw new e.EnsAvatarInvalidNftUriError({reason:"Token ID not found"});if(!C)throw new e.EnsAvatarInvalidNftUriError({reason:"ERC namespace not found"});return{chainID:Number.parseInt(w),namespace:C.toLowerCase(),contractAddress:y,tokenID:v}}async function f(g,{nft:p}){if(p.namespace==="erc721")return(0,t.readContract)(g,{address:p.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(p.tokenID)]});if(p.namespace==="erc1155")return(0,t.readContract)(g,{address:p.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(p.tokenID)]});throw new e.EnsAvatarUnsupportedNamespaceError({namespace:p.namespace})}return Ao}var tH;function OIe(){if(tH)return AE;tH=1,Object.defineProperty(AE,"__esModule",{value:!0}),AE.parseAvatarRecord=e;const t=PIe();async function e(n,{gatewayUrls:i,record:s}){return/eip155:/i.test(s)?r(n,{gatewayUrls:i,record:s}):(0,t.parseAvatarUri)({uri:s,gatewayUrls:i})}async function r(n,{gatewayUrls:i,record:s}){const o=(0,t.parseNftUri)(s),a=await(0,t.getNftTokenUri)(n,{nft:o}),{uri:c,isOnChain:u,isEncoded:l}=(0,t.resolveAvatarUri)({uri:a,gatewayUrls:i});if(u&&(c.includes("data:application/json;base64,")||c.startsWith("{"))){const h=l?atob(c.replace("data:application/json;base64,","")):c,f=JSON.parse(h);return(0,t.parseAvatarUri)({uri:(0,t.getJsonImage)(f),gatewayUrls:i})}let d=o.tokenID;return o.namespace==="erc1155"&&(d=d.replace("0x","").padStart(64,"0")),(0,t.getMetadataAvatarUri)({gatewayUrls:i,uri:c.replace(/(?:0x)?{id}/,d)})}return AE}var xE={},rH;function fX(){if(rH)return xE;rH=1,Object.defineProperty(xE,"__esModule",{value:!0}),xE.getEnsText=d;const t=rh(),e=al(),r=Bs(),n=nh(),i=ze(),s=VO(),o=DO(),a=GO(),c=yx(),u=ur(),l=ul();async function d(h,f){const{blockNumber:g,blockTag:p,key:m,name:b,gatewayUrls:v,strict:E}=f,{chain:w}=h,C=(()=>{if(f.universalResolverAddress)return f.universalResolverAddress;if(!w)throw new Error("client chain not configured. universalResolverAddress is required.");return(0,n.getChainContractAddress)({blockNumber:g,chain:w,contract:"ensUniversalResolver"})})(),y=w==null?void 0:w.ensTlds;if(y&&!y.some(_=>b.endsWith(_)))return null;try{const _={address:C,abi:t.universalResolverResolveAbi,functionName:"resolve",args:[(0,i.toHex)((0,c.packetToBytes)(b)),(0,r.encodeFunctionData)({abi:t.textResolverAbi,functionName:"text",args:[(0,a.namehash)(b),m]}),v??[o.localBatchGatewayUrl]],blockNumber:g,blockTag:p},A=await(0,u.getAction)(h,l.readContract,"readContract")(_);if(A[0]==="0x")return null;const T=(0,e.decodeFunctionResult)({abi:t.textResolverAbi,functionName:"text",data:A[0]});return T===""?null:T}catch(_){if(E)throw _;if((0,s.isNullUniversalResolverError)(_,"resolve"))return null;throw _}}return xE}var nH;function RIe(){if(nH)return CE;nH=1,Object.defineProperty(CE,"__esModule",{value:!0}),CE.getEnsAvatar=n;const t=OIe(),e=ur(),r=fX();async function n(i,{blockNumber:s,blockTag:o,assetGatewayUrls:a,name:c,gatewayUrls:u,strict:l,universalResolverAddress:d}){const h=await(0,e.getAction)(i,r.getEnsText,"getEnsText")({blockNumber:s,blockTag:o,key:"avatar",name:c,universalResolverAddress:d,gatewayUrls:u,strict:l});if(!h)return null;try{return await(0,t.parseAvatarRecord)(i,{record:h,gatewayUrls:a})}catch{return null}}return CE}var SE={},iH;function kIe(){if(iH)return SE;iH=1,Object.defineProperty(SE,"__esModule",{value:!0}),SE.getEnsName=a;const t=rh(),e=nh(),r=ze(),n=VO(),i=yx(),s=ur(),o=ul();async function a(c,{address:u,blockNumber:l,blockTag:d,gatewayUrls:h,strict:f,universalResolverAddress:g}){let p=g;if(!p){if(!c.chain)throw new Error("client chain not configured. universalResolverAddress is required.");p=(0,e.getChainContractAddress)({blockNumber:l,chain:c.chain,contract:"ensUniversalResolver"})}const m=`${u.toLowerCase().substring(2)}.addr.reverse`;try{const b={address:p,abi:t.universalResolverReverseAbi,functionName:"reverse",args:[(0,r.toHex)((0,i.packetToBytes)(m))],blockNumber:l,blockTag:d},v=(0,s.getAction)(c,o.readContract,"readContract"),[E,w]=h?await v({...b,args:[...b.args,h]}):await v(b);return u.toLowerCase()!==w.toLowerCase()?null:E}catch(b){if(f)throw b;if((0,n.isNullUniversalResolverError)(b,"reverse"))return null;throw b}}return SE}var TE={},sH;function NIe(){if(sH)return TE;sH=1,Object.defineProperty(TE,"__esModule",{value:!0}),TE.getEnsResolver=s;const t=nh(),e=ze(),r=yx(),n=ur(),i=ul();async function s(o,a){const{blockNumber:c,blockTag:u,name:l}=a,{chain:d}=o,h=(()=>{if(a.universalResolverAddress)return a.universalResolverAddress;if(!d)throw new Error("client chain not configured. universalResolverAddress is required.");return(0,t.getChainContractAddress)({blockNumber:c,chain:d,contract:"ensUniversalResolver"})})(),f=d==null?void 0:d.ensTlds;if(f&&!f.some(p=>l.endsWith(p)))throw new Error(`${l} is not a valid ENS TLD (${f==null?void 0:f.join(", ")}) for chain "${d.name}" (id: ${d.id}).`);const[g]=await(0,n.getAction)(o,i.readContract,"readContract")({address:h,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[(0,e.toHex)((0,r.packetToBytes)(l))],blockNumber:c,blockTag:u});return g}return TE}var IE={},oH;function pX(){if(oH)return IE;oH=1,Object.defineProperty(IE,"__esModule",{value:!0}),IE.createAccessList=o;const t=sn(),e=ze(),r=RO(),n=_1(),i=il(),s=sl();async function o(a,c){var _,x,A;const{account:u=a.account,blockNumber:l,blockTag:d="latest",blobs:h,data:f,gas:g,gasPrice:p,maxFeePerBlobGas:m,maxFeePerGas:b,maxPriorityFeePerGas:v,to:E,value:w,...C}=c,y=u?(0,t.parseAccount)(u):void 0;try{(0,s.assertRequest)(c);const O=(typeof l=="bigint"?(0,e.numberToHex)(l):void 0)||d,k=(A=(x=(_=a.chain)==null?void 0:_.formatters)==null?void 0:x.transactionRequest)==null?void 0:A.format,N=(k||i.formatTransactionRequest)({...(0,n.extract)(C,{format:k}),from:y==null?void 0:y.address,blobs:h,data:f,gas:g,gasPrice:p,maxFeePerBlobGas:m,maxFeePerGas:b,maxPriorityFeePerGas:v,to:E,value:w}),S=await a.request({method:"eth_createAccessList",params:[N,O]});return{accessList:S.accessList,gasUsed:BigInt(S.gasUsed)}}catch(T){throw(0,r.getCallError)(T,{...c,account:y,chain:a.chain})}}return IE}var PE={},aH;function $Ie(){if(aH)return PE;aH=1,Object.defineProperty(PE,"__esModule",{value:!0}),PE.createBlockFilter=e;const t=QA();async function e(r){const n=(0,t.createFilterRequestScope)(r,{method:"eth_newBlockFilter"}),i=await r.request({method:"eth_newBlockFilter"});return{id:i,request:n(i),type:"block"}}return PE}var OE={},cH;function gX(){if(cH)return OE;cH=1,Object.defineProperty(OE,"__esModule",{value:!0}),OE.createEventFilter=n;const t=Up(),e=ze(),r=QA();async function n(i,{address:s,args:o,event:a,events:c,fromBlock:u,strict:l,toBlock:d}={}){const h=c??(a?[a]:void 0),f=(0,r.createFilterRequestScope)(i,{method:"eth_newFilter"});let g=[];h&&(g=[h.flatMap(b=>(0,t.encodeEventTopics)({abi:[b],eventName:b.name,args:o}))],a&&(g=g[0]));const p=await i.request({method:"eth_newFilter",params:[{address:s,fromBlock:typeof u=="bigint"?(0,e.numberToHex)(u):u,toBlock:typeof d=="bigint"?(0,e.numberToHex)(d):d,...g.length?{topics:g}:{}}]});return{abi:h,args:o,eventName:a?a.name:void 0,fromBlock:u,id:p,request:f(p),strict:!!l,toBlock:d,type:"event"}}return OE}var RE={},uH;function mX(){if(uH)return RE;uH=1,Object.defineProperty(RE,"__esModule",{value:!0}),RE.createPendingTransactionFilter=e;const t=QA();async function e(r){const n=(0,t.createFilterRequestScope)(r,{method:"eth_newPendingTransactionFilter"}),i=await r.request({method:"eth_newPendingTransactionFilter"});return{id:i,request:n(i),type:"transaction"}}return RE}var kE={},lH;function jIe(){if(lH)return kE;lH=1,Object.defineProperty(kE,"__esModule",{value:!0}),kE.getBlobBaseFee=t;async function t(e){const r=await e.request({method:"eth_blobBaseFee"});return BigInt(r)}return kE}var NE={},dH;function BIe(){if(dH)return NE;dH=1,Object.defineProperty(NE,"__esModule",{value:!0}),NE.getBlockTransactionCount=r;const t=nn(),e=ze();async function r(n,{blockHash:i,blockNumber:s,blockTag:o="latest"}={}){const a=s!==void 0?(0,e.numberToHex)(s):void 0;let c;return i?c=await n.request({method:"eth_getBlockTransactionCountByHash",params:[i]},{dedupe:!0}):c=await n.request({method:"eth_getBlockTransactionCountByNumber",params:[a||o]},{dedupe:!!a}),(0,t.hexToNumber)(c)}return NE}var $E={},hH;function DIe(){if(hH)return $E;hH=1,Object.defineProperty($E,"__esModule",{value:!0}),$E.getCode=e;const t=ze();async function e(r,{address:n,blockNumber:i,blockTag:s="latest"}){const o=i!==void 0?(0,t.numberToHex)(i):void 0,a=await r.request({method:"eth_getCode",params:[n,o||s]},{dedupe:!!o});if(a!=="0x")return a}return $E}var jE={},Vw={},fH;function MIe(){if(fH)return Vw;fH=1,Object.defineProperty(Vw,"__esModule",{value:!0}),Vw.Eip712DomainNotFoundError=void 0;const t=_t();class e extends t.BaseError{constructor({address:n}){super(`No EIP-712 domain found on contract "${n}".`,{metaMessages:["Ensure that:",`- The contract is deployed at the address "${n}".`,"- `eip712Domain()` function exists on the contract.","- `eip712Domain()` function matches signature to ERC-5267 specification."],name:"Eip712DomainNotFoundError"})}}return Vw.Eip712DomainNotFoundError=e,Vw}var pH;function LIe(){if(pH)return jE;pH=1,Object.defineProperty(jE,"__esModule",{value:!0}),jE.getEip712Domain=n;const t=MIe(),e=ur(),r=ul();async function n(s,o){const{address:a,factory:c,factoryData:u}=o;try{const[l,d,h,f,g,p,m]=await(0,e.getAction)(s,r.readContract,"readContract")({abi:i,address:a,functionName:"eip712Domain",factory:c,factoryData:u});return{domain:{name:d,version:h,chainId:Number(f),verifyingContract:g,salt:p},extensions:m,fields:l}}catch(l){const d=l;throw d.name==="ContractFunctionExecutionError"&&d.cause.name==="ContractFunctionZeroDataError"?new t.Eip712DomainNotFoundError({address:a}):d}}const i=[{inputs:[],name:"eip712Domain",outputs:[{name:"fields",type:"bytes1"},{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"},{name:"salt",type:"bytes32"},{name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"}];return jE}var BE={},DE={},gH;function UIe(){if(gH)return DE;gH=1,Object.defineProperty(DE,"__esModule",{value:!0}),DE.formatFeeHistory=t;function t(e){var r;return{baseFeePerGas:e.baseFeePerGas.map(n=>BigInt(n)),gasUsedRatio:e.gasUsedRatio,oldestBlock:BigInt(e.oldestBlock),reward:(r=e.reward)==null?void 0:r.map(n=>n.map(i=>BigInt(i)))}}return DE}var mH;function FIe(){if(mH)return BE;mH=1,Object.defineProperty(BE,"__esModule",{value:!0}),BE.getFeeHistory=r;const t=ze(),e=UIe();async function r(n,{blockCount:i,blockNumber:s,blockTag:o="latest",rewardPercentiles:a}){const c=typeof s=="bigint"?(0,t.numberToHex)(s):void 0,u=await n.request({method:"eth_feeHistory",params:[(0,t.numberToHex)(i),c||o,a]},{dedupe:!!c});return(0,e.formatFeeHistory)(u)}return BE}var ME={},wH;function HIe(){if(wH)return ME;wH=1,Object.defineProperty(ME,"__esModule",{value:!0}),ME.getFilterLogs=r;const t=O2(),e=ol();async function r(n,{filter:i}){const s=i.strict??!1,a=(await i.request({method:"eth_getFilterLogs",params:[i.id]})).map(c=>(0,e.formatLog)(c));return i.abi?(0,t.parseEventLogs)({abi:i.abi,logs:a,strict:s}):a}return ME}var LE={},UE={},RT={},FE={},bH;function wX(){if(bH)return FE;bH=1,Object.defineProperty(FE,"__esModule",{value:!0}),FE.defineChain=t;function t(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}return FE}var HE={},yH;function bX(){if(yH)return HE;yH=1,Object.defineProperty(HE,"__esModule",{value:!0}),HE.extractChain=t;function t({chains:e,id:r}){return e.find(n=>n.id===r)}return HE}var O0={},qE={},kT={},vH;function yX(){return vH||(vH=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.socketClientCache=void 0,t.getSocketRpcClient=s;const e=ha(),r=NO(),n=zO(),i=uX();t.socketClientCache=new Map;async function s(o){const{getSocket:a,keepAlive:c=!0,key:u="socket",reconnect:l=!0,url:d}=o,{interval:h=3e4}=typeof c=="object"?c:{},{attempts:f=5,delay:g=2e3}=typeof l=="object"?l:{};let p=t.socketClientCache.get(`${u}:${d}`);if(p)return p;let m=0;const{schedule:b}=(0,r.createBatchScheduler)({id:`${u}:${d}`,fn:async()=>{const w=new Map,C=new Map;let y,_,x;async function A(){const T=await a({onClose(){var O,k;for(const j of w.values())(O=j.onError)==null||O.call(j,new e.SocketClosedError({url:d}));for(const j of C.values())(k=j.onError)==null||k.call(j,new e.SocketClosedError({url:d}));l&&m{m++,await A().catch(console.error)},g):(w.clear(),C.clear())},onError(O){var k,j;y=O;for(const N of w.values())(k=N.onError)==null||k.call(N,y);for(const N of C.values())(j=N.onError)==null||j.call(N,y);p==null||p.close(),l&&m{m++,await A().catch(console.error)},g):(w.clear(),C.clear())},onOpen(){y=void 0,m=0},onResponse(O){const k=O.method==="eth_subscription",j=k?O.params.subscription:O.id,N=k?C:w,S=N.get(j);S&&S.onResponse(O),k||N.delete(j)}});return _=T,c&&(x&&clearInterval(x),x=setInterval(()=>{var O;return(O=_.ping)==null?void 0:O.call(_)},h)),T}return await A(),y=void 0,p={close(){x&&clearInterval(x),_.close(),t.socketClientCache.delete(`${u}:${d}`)},get socket(){return _},request({body:T,onError:O,onResponse:k}){y&&O&&O(y);const j=T.id??i.idCache.take(),N=S=>{var P;typeof S.id=="number"&&j!==S.id||(T.method==="eth_subscribe"&&typeof S.result=="string"&&C.set(S.result,{onResponse:N,onError:O}),T.method==="eth_unsubscribe"&&C.delete((P=T.params)==null?void 0:P[0]),k(S))};w.set(j,{onResponse:N,onError:O});try{_.request({body:{jsonrpc:"2.0",id:j,...T}})}catch(S){O==null||O(S)}},requestAsync({body:T,timeout:O=1e4}){return(0,n.withTimeout)(()=>new Promise((k,j)=>this.request({body:T,onError:j,onResponse:k})),{errorInstance:new e.TimeoutError({body:T,url:d}),timeout:O})},requests:w,subscriptions:C,url:d},t.socketClientCache.set(`${u}:${d}`,p),[p]}}),[v,[E]]=await b();return E}}(kT)),kT}const qIe=CV(a6e);var _H;function KO(){if(_H)return qE;_H=1,Object.defineProperty(qE,"__esModule",{value:!0}),qE.getWebSocketRpcClient=r;const t=ha(),e=yX();async function r(n,i={}){const{keepAlive:s,reconnect:o}=i;return(0,e.getSocketRpcClient)({async getSocket({onClose:a,onError:c,onOpen:u,onResponse:l}){const d=await Promise.resolve().then(()=>qIe).then(m=>m.WebSocket),h=new d(n);function f(){h.removeEventListener("close",f),h.removeEventListener("message",g),h.removeEventListener("error",c),h.removeEventListener("open",u),a()}function g({data:m}){try{const b=JSON.parse(m);l(b)}catch(b){c(b)}}h.addEventListener("close",f),h.addEventListener("message",g),h.addEventListener("error",c),h.addEventListener("open",u),h.readyState===d.CONNECTING&&await new Promise((m,b)=>{h&&(h.onopen=m,h.onerror=b)});const{close:p}=h;return Object.assign(h,{close(){p.bind(h)(),f()},ping(){try{if(h.readyState===h.CLOSED||h.readyState===h.CLOSING)throw new t.WebSocketRequestError({url:h.url,cause:new t.SocketClosedError({url:h.url})});const m={jsonrpc:"2.0",method:"net_version",params:[]};h.send(JSON.stringify(m))}catch(m){c(m)}},request({body:m}){if(h.readyState===h.CLOSED||h.readyState===h.CLOSING)throw new t.WebSocketRequestError({body:m,url:h.url,cause:new t.SocketClosedError({url:h.url})});return h.send(JSON.stringify(m))}})},keepAlive:s,reconnect:o,url:n})}return qE}var EH;function vX(){if(EH)return O0;EH=1,Object.defineProperty(O0,"__esModule",{value:!0}),O0.rpc=void 0,O0.getSocket=i;const t=WO(),e=KO();function r(s,{body:o,onError:a,onResponse:c}){return s.request({body:o,onError:a,onResponse:c}),s}async function n(s,{body:o,timeout:a=1e4}){return s.requestAsync({body:o,timeout:a})}async function i(s){const o=await(0,e.getWebSocketRpcClient)(s);return Object.assign(o.socket,{requests:o.requests,subscriptions:o.subscriptions})}return O0.rpc={http(s,o){return(0,t.getHttpRpcClient)(s).request(o)},webSocket:r,webSocketAsync:n},O0}var xh={},zc={},CH;function _X(){if(CH)return zc;CH=1,Object.defineProperty(zc,"__esModule",{value:!0}),zc.InvalidStructTypeError=zc.InvalidPrimaryTypeError=zc.InvalidDomainError=void 0;const t=Gn(),e=_t();class r extends e.BaseError{constructor({domain:o}){super(`Invalid domain "${(0,t.stringify)(o)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}zc.InvalidDomainError=r;class n extends e.BaseError{constructor({primaryType:o,types:a}){super(`Invalid primary type \`${o}\` must be one of \`${JSON.stringify(Object.keys(a))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}zc.InvalidPrimaryTypeError=n;class i extends e.BaseError{constructor({type:o}){super(`Struct type "${o}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}return zc.InvalidStructTypeError=i,zc}var Sh={},AH;function B2(){if(AH)return Sh;AH=1,Object.defineProperty(Sh,"__esModule",{value:!0}),Sh.hashTypedData=s,Sh.hashDomain=o,Sh.hashStruct=a,Sh.encodeType=l;const t=da(),e=oi(),r=ze(),n=ns(),i=vx();function s(f){const{domain:g={},message:p,primaryType:m}=f,b={EIP712Domain:(0,i.getTypesForEIP712Domain)({domain:g}),...f.types};(0,i.validateTypedData)({domain:g,message:p,primaryType:m,types:b});const v=["0x1901"];return g&&v.push(o({domain:g,types:b})),m!=="EIP712Domain"&&v.push(a({data:p,primaryType:m,types:b})),(0,n.keccak256)((0,e.concat)(v))}function o({domain:f,types:g}){return a({data:f,primaryType:"EIP712Domain",types:g})}function a({data:f,primaryType:g,types:p}){const m=c({data:f,primaryType:g,types:p});return(0,n.keccak256)(m)}function c({data:f,primaryType:g,types:p}){const m=[{type:"bytes32"}],b=[u({primaryType:g,types:p})];for(const v of p[g]){const[E,w]=h({types:p,name:v.name,type:v.type,value:f[v.name]});m.push(E),b.push(w)}return(0,t.encodeAbiParameters)(m,b)}function u({primaryType:f,types:g}){const p=(0,r.toHex)(l({primaryType:f,types:g}));return(0,n.keccak256)(p)}function l({primaryType:f,types:g}){let p="";const m=d({primaryType:f,types:g});m.delete(f);const b=[f,...Array.from(m).sort()];for(const v of b)p+=`${v}(${g[v].map(({name:E,type:w})=>`${w} ${E}`).join(",")})`;return p}function d({primaryType:f,types:g},p=new Set){const m=f.match(/^\w*/u),b=m==null?void 0:m[0];if(p.has(b)||g[b]===void 0)return p;p.add(b);for(const v of g[b])d({primaryType:v.type,types:g},p);return p}function h({types:f,name:g,type:p,value:m}){if(f[p]!==void 0)return[{type:"bytes32"},(0,n.keccak256)(c({data:m,primaryType:p,types:f}))];if(p==="bytes")return m=`0x${(m.length%2?"0":"")+m.slice(2)}`,[{type:"bytes32"},(0,n.keccak256)(m)];if(p==="string")return[{type:"bytes32"},(0,n.keccak256)((0,r.toHex)(m))];if(p.lastIndexOf("]")===p.length-1){const b=p.slice(0,p.lastIndexOf("[")),v=m.map(E=>h({name:g,type:b,types:f,value:E}));return[{type:"bytes32"},(0,n.keccak256)((0,t.encodeAbiParameters)(v.map(([E])=>E),v.map(([,E])=>E)))]}return[{type:p},m]}return Sh}var xH;function vx(){if(xH)return xh;xH=1,Object.defineProperty(xh,"__esModule",{value:!0}),xh.serializeTypedData=u,xh.validateTypedData=l,xh.getTypesForEIP712Domain=d,xh.domainSeparator=h;const t=$r(),e=la(),r=_X(),n=is(),i=rs(),s=ze(),o=JA(),a=B2(),c=Gn();function u(g){const{domain:p,message:m,primaryType:b,types:v}=g,E=(y,_)=>{const x={..._};for(const A of y){const{name:T,type:O}=A;O==="address"&&(x[T]=x[T].toLowerCase())}return x},w=v.EIP712Domain?p?E(v.EIP712Domain,p):{}:{},C=(()=>{if(b!=="EIP712Domain")return E(v[b],m)})();return(0,c.stringify)({domain:w,message:C,primaryType:b,types:v})}function l(g){const{domain:p,message:m,primaryType:b,types:v}=g,E=(w,C)=>{for(const y of w){const{name:_,type:x}=y,A=C[_],T=x.match(o.integerRegex);if(T&&(typeof A=="number"||typeof A=="bigint")){const[j,N,S]=T;(0,s.numberToHex)(A,{signed:N==="int",size:Number.parseInt(S)/8})}if(x==="address"&&typeof A=="string"&&!(0,n.isAddress)(A))throw new e.InvalidAddressError({address:A});const O=x.match(o.bytesRegex);if(O){const[j,N]=O;if(N&&(0,i.size)(A)!==Number.parseInt(N))throw new t.BytesSizeMismatchError({expectedSize:Number.parseInt(N),givenSize:(0,i.size)(A)})}const k=v[x];k&&(f(x),E(k,A))}};if(v.EIP712Domain&&p){if(typeof p!="object")throw new r.InvalidDomainError({domain:p});E(v.EIP712Domain,p)}if(b!=="EIP712Domain")if(v[b])E(v[b],m);else throw new r.InvalidPrimaryTypeError({primaryType:b,types:v})}function d({domain:g}){return[typeof(g==null?void 0:g.name)=="string"&&{name:"name",type:"string"},(g==null?void 0:g.version)&&{name:"version",type:"string"},(typeof(g==null?void 0:g.chainId)=="number"||typeof(g==null?void 0:g.chainId)=="bigint")&&{name:"chainId",type:"uint256"},(g==null?void 0:g.verifyingContract)&&{name:"verifyingContract",type:"address"},(g==null?void 0:g.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function h({domain:g}){return(0,a.hashDomain)({domain:g,types:{EIP712Domain:d({domain:g})}})}function f(g){if(g==="address"||g==="bool"||g==="string"||g.startsWith("bytes")||g.startsWith("uint")||g.startsWith("int"))throw new r.InvalidStructTypeError({type:g})}return xh}var zE={},SH;function EX(){if(SH)return zE;SH=1,Object.defineProperty(zE,"__esModule",{value:!0}),zE.encodePacked=a;const t=$r(),e=la(),r=is(),n=oi(),i=Zd(),s=ze(),o=JA();function a(u,l){if(u.length!==l.length)throw new t.AbiEncodingLengthMismatchError({expectedLength:u.length,givenLength:l.length});const d=[];for(let h=0;he.maxUint256)throw new o.FeeCapTooHighError({maxFeePerGas:E});if(v&&E&&v>E)throw new o.TipAboveFeeCapError({maxFeePerGas:E,maxPriorityFeePerGas:v})}function g(m){const{chainId:b,maxPriorityFeePerGas:v,gasPrice:E,maxFeePerGas:w,to:C}=m;if(b<=0)throw new s.InvalidChainIdError({chainId:b});if(C&&!(0,a.isAddress)(C))throw new r.InvalidAddressError({address:C});if(v||w)throw new n.BaseError("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(E&&E>e.maxUint256)throw new o.FeeCapTooHighError({maxFeePerGas:E})}function p(m){const{chainId:b,maxPriorityFeePerGas:v,gasPrice:E,maxFeePerGas:w,to:C}=m;if(C&&!(0,a.isAddress)(C))throw new r.InvalidAddressError({address:C});if(typeof b<"u"&&b<=0)throw new s.InvalidChainIdError({chainId:b});if(v||w)throw new n.BaseError("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(E&&E>e.maxUint256)throw new o.FeeCapTooHighError({maxFeePerGas:E})}return Ol}var VE={},IH;function ZO(){if(IH)return VE;IH=1,Object.defineProperty(VE,"__esModule",{value:!0}),VE.serializeAccessList=n;const t=la(),e=Ds(),r=is();function n(i){if(!i||i.length===0)return[];const s=[];for(let o=0;o"u"||typeof I>"u")){const U=typeof w.blobs[0]=="string"?w.blobs:w.blobs.map(K=>(0,c.bytesToHex)(K)),z=w.kzg,W=(0,r.blobsToCommitments)({blobs:U,kzg:z});if(typeof P>"u"&&(P=(0,i.commitmentsToVersionedHashes)({commitments:W})),typeof I>"u"){const K=(0,n.blobsToProofs)({blobs:U,commitments:W,kzg:z});I=(0,s.toBlobSidecars)({blobs:U,commitments:W,proofs:K})}}const B=(0,h.serializeAccessList)(N),$=[(0,c.toHex)(y),x?(0,c.toHex)(x):"0x",j?(0,c.toHex)(j):"0x",k?(0,c.toHex)(k):"0x",_?(0,c.toHex)(_):"0x",A??"0x",T?(0,c.toHex)(T):"0x",S??"0x",B,O?(0,c.toHex)(O):"0x",P??[],...E(w,C)],R=[],D=[],L=[];if(I)for(let U=0;U{if(C.v>=35n)return(C.v-35n)/2n>0?C.v:27n+(C.v===35n?0n:1n);if(y>0)return BigInt(y*2)+BigInt(35n+C.v-27n);const I=27n+(C.v===27n?0n:1n);if(C.v!==I)throw new t.InvalidLegacyVError({v:C.v});return I})(),S=(0,a.trim)(C.r),P=(0,a.trim)(C.s);j=[...j,(0,c.toHex)(N),S==="0x00"?"0x":S,P==="0x00"?"0x":P]}else y>0&&(j=[...j,(0,c.toHex)(y),"0x","0x"]);return(0,u.toRlp)(j)}function E(w,C){const y=C??w,{v:_,yParity:x}=y;if(typeof y.r>"u")return[];if(typeof y.s>"u")return[];if(typeof _>"u"&&typeof x>"u")return[];const A=(0,a.trim)(y.r),T=(0,a.trim)(y.s);return[typeof x=="number"?x?(0,c.toHex)(1):"0x":_===0n?"0x":_===1n?(0,c.toHex)(1):_===27n?"0x":(0,c.toHex)(1),A==="0x00"?"0x":A,T==="0x00"?"0x":T]}return Gw}var OH;function CX(){if(OH)return WE;OH=1,Object.defineProperty(WE,"__esModule",{value:!0}),WE.serializeAuthorizationList=r;const t=ze(),e=Ex();function r(n){if(!n||n.length===0)return[];const i=[];for(const s of n){const{chainId:o,nonce:a,...c}=s,u=s.address;i.push([o?(0,t.toHex)(o):"0x",u,a?(0,t.toHex)(a):"0x",...(0,e.toYParitySignatureArray)({},c)])}return i}return WE}var GE={},RH;function zIe(){if(RH)return GE;RH=1,Object.defineProperty(GE,"__esModule",{value:!0}),GE.verifyAuthorization=n;const t=js(),e=fa(),r=nx();async function n({address:i,authorization:s,signature:o}){return(0,e.isAddressEqual)((0,t.getAddress)(i),await(0,r.recoverAuthorizationAddress)({authorization:s,signature:o}))}return GE}var R0={},KE={},kH;function YO(){if(kH)return KE;kH=1,Object.defineProperty(KE,"__esModule",{value:!0}),KE.isBytes=t;function t(e){return!e||typeof e!="object"||!("BYTES_PER_ELEMENT"in e)?!1:e.BYTES_PER_ELEMENT===1&&e.constructor.name==="Uint8Array"}return KE}var NH;function AX(){if(NH)return R0;NH=1,Object.defineProperty(R0,"__esModule",{value:!0}),R0.getContractAddress=c,R0.getCreateAddress=u,R0.getCreate2Address=l;const t=oi(),e=YO(),r=Zd(),n=go(),i=Tr(),s=x2(),o=ns(),a=js();function c(d){return d.opcode==="CREATE2"?l(d):u(d)}function u(d){const h=(0,i.toBytes)((0,a.getAddress)(d.from));let f=(0,i.toBytes)(d.nonce);return f[0]===0&&(f=new Uint8Array([])),(0,a.getAddress)(`0x${(0,o.keccak256)((0,s.toRlp)([h,f],"bytes")).slice(26)}`)}function l(d){const h=(0,i.toBytes)((0,a.getAddress)(d.from)),f=(0,r.pad)((0,e.isBytes)(d.salt)?d.salt:(0,i.toBytes)(d.salt),{size:32}),g="bytecodeHash"in d?(0,e.isBytes)(d.bytecodeHash)?d.bytecodeHash:(0,i.toBytes)(d.bytecodeHash):(0,o.keccak256)(d.bytecode,"bytes");return(0,a.getAddress)((0,n.slice)((0,o.keccak256)((0,t.concat)([(0,i.toBytes)("0xff"),h,f,g])),12))}return R0}var ZE={},$H;function JO(){if($H)return ZE;$H=1,Object.defineProperty(ZE,"__esModule",{value:!0}),ZE.fromRlp=s;const t=_t(),e=y1(),r=v2(),n=Tr(),i=ze();function s(u,l="hex"){const d=(()=>{if(typeof u=="string"){if(u.length>3&&u.length%2!==0)throw new e.InvalidHexValueError(u);return(0,n.hexToBytes)(u)}return u})(),h=(0,r.createCursor)(d,{recursiveReadLimit:Number.POSITIVE_INFINITY});return o(h,l)}function o(u,l="hex"){if(u.bytes.length===0)return l==="hex"?(0,i.bytesToHex)(u.bytes):u.bytes;const d=u.readByte();if(d<128&&u.decrementPosition(1),d<192){const f=a(u,d,128),g=u.readBytes(f);return l==="hex"?(0,i.bytesToHex)(g):g}const h=a(u,d,192);return c(u,h,l)}function a(u,l,d){if(d===128&&l<128)return 1;if(l<=d+55)return l-d;if(l===d+55+1)return u.readUint8();if(l===d+55+2)return u.readUint16();if(l===d+55+3)return u.readUint24();if(l===d+55+4)return u.readUint32();throw new t.BaseError("Invalid RLP prefix")}function c(u,l,d){const h=u.position,f=[];for(;u.position-hnew i);const s=Math.pow(2,32),o=Array.from({length:64},(x,A)=>Math.floor(s*Math.abs(Math.sin(A+1)))),a=r.slice(0,4),c=new Uint32Array(16);class u extends t.HashMD{constructor(){super(64,16,8,!0),this.A=a[0]|0,this.B=a[1]|0,this.C=a[2]|0,this.D=a[3]|0}get(){const{A,B:T,C:O,D:k}=this;return[A,T,O,k]}set(A,T,O,k){this.A=A|0,this.B=T|0,this.C=O|0,this.D=k|0}process(A,T){for(let S=0;S<16;S++,T+=4)c[S]=A.getUint32(T,!0);let{A:O,B:k,C:j,D:N}=this;for(let S=0;S<64;S++){let P,I,B;S<16?(P=(0,t.Chi)(k,j,N),I=S,B=[7,12,17,22]):S<32?(P=(0,t.Chi)(N,k,j),I=(5*S+1)%16,B=[5,9,14,20]):S<48?(P=k^j^N,I=(3*S+5)%16,B=[4,11,16,23]):(P=j^(k|~N),I=7*S%16,B=[6,10,15,21]),P=P+O+o[S]+c[I],O=N,N=j,j=k,k=k+(0,e.rotl)(P,B[S%4])}O=O+this.A|0,k=k+this.B|0,j=j+this.C|0,N=N+this.D|0,this.set(O,k,j,N)}roundClean(){(0,e.clean)(c)}destroy(){this.set(0,0,0,0),(0,e.clean)(this.buffer)}}li.MD5=u,li.md5=(0,e.createHasher)(()=>new u);const l=Uint8Array.from([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),d=Uint8Array.from(new Array(16).fill(0).map((x,A)=>A)),h=d.map(x=>(9*x+5)%16),f=(()=>{const T=[[d],[h]];for(let O=0;O<4;O++)for(let k of T)k.push(k[O].map(j=>l[j]));return T})(),g=f[0],p=f[1],m=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(x=>Uint8Array.from(x)),b=g.map((x,A)=>x.map(T=>m[A][T])),v=p.map((x,A)=>x.map(T=>m[A][T])),E=Uint32Array.from([0,1518500249,1859775393,2400959708,2840853838]),w=Uint32Array.from([1352829926,1548603684,1836072691,2053994217,0]);function C(x,A,T,O){return x===0?A^T^O:x===1?A&T|~A&O:x===2?(A|~T)^O:x===3?A&O|T&~O:A^(T|~O)}const y=new Uint32Array(16);class _ extends t.HashMD{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:A,h1:T,h2:O,h3:k,h4:j}=this;return[A,T,O,k,j]}set(A,T,O,k,j){this.h0=A|0,this.h1=T|0,this.h2=O|0,this.h3=k|0,this.h4=j|0}process(A,T){for(let D=0;D<16;D++,T+=4)y[D]=A.getUint32(T,!0);let O=this.h0|0,k=O,j=this.h1|0,N=j,S=this.h2|0,P=S,I=this.h3|0,B=I,$=this.h4|0,R=$;for(let D=0;D<5;D++){const L=4-D,U=E[D],z=w[D],W=g[D],K=p[D],J=b[D],ne=v[D];for(let ae=0;ae<16;ae++){const he=(0,e.rotl)(O+C(D,j,S,I)+y[W[ae]]+U,J[ae])+$|0;O=$,$=I,I=(0,e.rotl)(S,10)|0,S=j,j=he}for(let ae=0;ae<16;ae++){const he=(0,e.rotl)(k+C(L,N,P,B)+y[K[ae]]+z,ne[ae])+R|0;k=R,R=B,B=(0,e.rotl)(P,10)|0,P=N,N=he}}this.set(this.h1+S+B|0,this.h2+I+R|0,this.h3+$+k|0,this.h4+O+N|0,this.h0+j+P|0)}roundClean(){(0,e.clean)(y)}destroy(){this.destroyed=!0,(0,e.clean)(this.buffer),this.set(0,0,0,0,0)}}return li.RIPEMD160=_,li.ripemd160=(0,e.createHasher)(()=>new _),li}var FH;function PX(){if(FH)return Th;FH=1,Object.defineProperty(Th,"__esModule",{value:!0}),Th.ripemd160=Th.RIPEMD160=void 0;const t=WIe();return Th.RIPEMD160=t.RIPEMD160,Th.ripemd160=t.ripemd160,Th}var HH;function OX(){if(HH)return JE;HH=1,Object.defineProperty(JE,"__esModule",{value:!0}),JE.ripemd160=i;const t=PX(),e=ki(),r=Tr(),n=ze();function i(s,o){const a=o||"hex",c=(0,t.ripemd160)((0,e.isHex)(s,{strict:!1})?(0,r.toBytes)(s):s);return a==="bytes"?c:(0,n.toHex)(c)}return JE}var QE={},XE={},e5={},Kw={},qH;function RX(){return qH||(qH=1,Object.defineProperty(Kw,"__esModule",{value:!0}),Kw.presignMessagePrefix=void 0,Kw.presignMessagePrefix=`Ethereum Signed Message: `),Kw}var zH;function kX(){if(zH)return e5;zH=1,Object.defineProperty(e5,"__esModule",{value:!0}),e5.toPrefixedMessage=i;const t=RX(),e=oi(),r=rs(),n=ze();function i(s){const o=typeof s=="string"?(0,n.stringToHex)(s):typeof s.raw=="string"?s.raw:(0,n.bytesToHex)(s.raw),a=(0,n.stringToHex)(`${t.presignMessagePrefix}${(0,r.size)(o)}`);return(0,e.concat)([a,o])}return e5}var WH;function D2(){if(WH)return XE;WH=1,Object.defineProperty(XE,"__esModule",{value:!0}),XE.hashMessage=r;const t=ns(),e=kX();function r(n,i){return(0,t.keccak256)((0,e.toPrefixedMessage)(n),i)}return XE}var VH;function XO(){if(VH)return QE;VH=1,Object.defineProperty(QE,"__esModule",{value:!0}),QE.recoverMessageAddress=r;const t=D2(),e=th();async function r({message:n,signature:i}){return(0,e.recoverAddress)({hash:(0,t.hashMessage)(n),signature:i})}return QE}var t5={},GH;function eR(){if(GH)return t5;GH=1,Object.defineProperty(t5,"__esModule",{value:!0}),t5.recoverTypedDataAddress=r;const t=B2(),e=th();async function r(n){const{domain:i,message:s,primaryType:o,signature:a,types:c}=n;return(0,e.recoverAddress)({hash:(0,t.hashTypedData)({domain:i,message:s,primaryType:o,types:c}),signature:a})}return t5}var r5={},KH;function NX(){if(KH)return r5;KH=1,Object.defineProperty(r5,"__esModule",{value:!0}),r5.verifyHash=n;const t=js(),e=fa(),r=th();async function n({address:i,hash:s,signature:o}){return(0,e.isAddressEqual)((0,t.getAddress)(i),await(0,r.recoverAddress)({hash:s,signature:o}))}return r5}var n5={},ZH;function $X(){if(ZH)return n5;ZH=1,Object.defineProperty(n5,"__esModule",{value:!0}),n5.verifyMessage=n;const t=js(),e=fa(),r=XO();async function n({address:i,message:s,signature:o}){return(0,e.isAddressEqual)((0,t.getAddress)(i),await(0,r.recoverMessageAddress)({message:s,signature:o}))}return n5}var i5={},YH;function jX(){if(YH)return i5;YH=1,Object.defineProperty(i5,"__esModule",{value:!0}),i5.verifyTypedData=n;const t=js(),e=fa(),r=eR();async function n(i){const{address:s,domain:o,message:a,primaryType:c,signature:u,types:l}=i;return(0,e.isAddressEqual)((0,t.getAddress)(s),await(0,r.recoverTypedDataAddress)({domain:o,message:a,primaryType:c,signature:u,types:l}))}return i5}var s5={},o5={},Ih={},JH;function tR(){return JH||(JH=1,Object.defineProperty(Ih,"__esModule",{value:!0}),Ih.zeroHash=Ih.erc6492MagicBytes=void 0,Ih.erc6492MagicBytes="0x6492649264926492649264926492649264926492649264926492649264926492",Ih.zeroHash="0x0000000000000000000000000000000000000000000000000000000000000000"),Ih}var QH;function Cx(){if(QH)return o5;QH=1,Object.defineProperty(o5,"__esModule",{value:!0}),o5.isErc6492Signature=r;const t=tR(),e=go();function r(n){return(0,e.sliceHex)(n,-32)===t.erc6492MagicBytes}return o5}var XH;function BX(){if(XH)return s5;XH=1,Object.defineProperty(s5,"__esModule",{value:!0}),s5.parseErc6492Signature=r;const t=Jd(),e=Cx();function r(n){if(!(0,e.isErc6492Signature)(n))return{signature:n};const[i,s,o]=(0,t.decodeAbiParameters)([{type:"address"},{type:"bytes"},{type:"bytes"}],n);return{address:i,data:s,signature:o}}return s5}var a5={},eq;function rR(){if(eq)return a5;eq=1,Object.defineProperty(a5,"__esModule",{value:!0}),a5.serializeErc6492Signature=i;const t=tR(),e=da(),r=oi(),n=Tr();function i(s){const{address:o,data:a,signature:c,to:u="hex"}=s,l=(0,r.concatHex)([(0,e.encodeAbiParameters)([{type:"address"},{type:"bytes"},{type:"bytes"}],[o,a,c]),t.erc6492MagicBytes]);return u==="hex"?l:(0,n.hexToBytes)(l)}return a5}var c5={},tq;function nR(){if(tq)return c5;tq=1,Object.defineProperty(c5,"__esModule",{value:!0}),c5.getSerializedTransactionType=n;const t=Ds(),e=go(),r=nn();function n(i){const s=(0,e.sliceHex)(i,0,1);if(s==="0x04")return"eip7702";if(s==="0x03")return"eip4844";if(s==="0x02")return"eip1559";if(s==="0x01")return"eip2930";if(s!=="0x"&&(0,r.hexToNumber)(s)>=192)return"legacy";throw new t.InvalidSerializedTransactionTypeError({serializedType:s})}return c5}var k0={},rq;function iR(){if(rq)return k0;rq=1,Object.defineProperty(k0,"__esModule",{value:!0}),k0.parseTransaction=h,k0.toTransactionArray=v,k0.parseAccessList=E;const t=la(),e=Ds(),r=is(),n=ux(),i=ki(),s=Zd(),o=tl(),a=nn(),c=JO(),u=QO(),l=_x(),d=nR();function h(y){const _=(0,d.getSerializedTransactionType)(y);return _==="eip1559"?p(y):_==="eip2930"?m(y):_==="eip4844"?g(y):_==="eip7702"?f(y):b(y)}function f(y){const _=v(y),[x,A,T,O,k,j,N,S,P,I,B,$,R]=_;if(_.length!==10&&_.length!==13)throw new e.InvalidSerializedTransactionError({attributes:{chainId:x,nonce:A,maxPriorityFeePerGas:T,maxFeePerGas:O,gas:k,to:j,value:N,data:S,accessList:P,authorizationList:I,..._.length>9?{v:B,r:$,s:R}:{}},serializedTransaction:y,type:"eip7702"});const D={chainId:(0,a.hexToNumber)(x),type:"eip7702"};return(0,i.isHex)(j)&&j!=="0x"&&(D.to=j),(0,i.isHex)(k)&&k!=="0x"&&(D.gas=(0,a.hexToBigInt)(k)),(0,i.isHex)(S)&&S!=="0x"&&(D.data=S),(0,i.isHex)(A)&&(D.nonce=A==="0x"?0:(0,a.hexToNumber)(A)),(0,i.isHex)(N)&&N!=="0x"&&(D.value=(0,a.hexToBigInt)(N)),(0,i.isHex)(O)&&O!=="0x"&&(D.maxFeePerGas=(0,a.hexToBigInt)(O)),(0,i.isHex)(T)&&T!=="0x"&&(D.maxPriorityFeePerGas=(0,a.hexToBigInt)(T)),P.length!==0&&P!=="0x"&&(D.accessList=E(P)),I.length!==0&&I!=="0x"&&(D.authorizationList=w(I)),(0,l.assertTransactionEIP7702)(D),{..._.length===13?C(_):void 0,...D}}function g(y){const _=v(y),x=_.length===4,A=x?_[0]:_,T=x?_.slice(1):[],[O,k,j,N,S,P,I,B,$,R,D,L,U,z]=A,[W,K,J]=T;if(!(A.length===11||A.length===14))throw new e.InvalidSerializedTransactionError({attributes:{chainId:O,nonce:k,maxPriorityFeePerGas:j,maxFeePerGas:N,gas:S,to:P,value:I,data:B,accessList:$,...A.length>9?{v:L,r:U,s:z}:{}},serializedTransaction:y,type:"eip4844"});const ne={blobVersionedHashes:D,chainId:(0,a.hexToNumber)(O),type:"eip4844"};return(0,i.isHex)(P)&&P!=="0x"&&(ne.to=P),(0,i.isHex)(S)&&S!=="0x"&&(ne.gas=(0,a.hexToBigInt)(S)),(0,i.isHex)(B)&&B!=="0x"&&(ne.data=B),(0,i.isHex)(k)&&(ne.nonce=k==="0x"?0:(0,a.hexToNumber)(k)),(0,i.isHex)(I)&&I!=="0x"&&(ne.value=(0,a.hexToBigInt)(I)),(0,i.isHex)(R)&&R!=="0x"&&(ne.maxFeePerBlobGas=(0,a.hexToBigInt)(R)),(0,i.isHex)(N)&&N!=="0x"&&(ne.maxFeePerGas=(0,a.hexToBigInt)(N)),(0,i.isHex)(j)&&j!=="0x"&&(ne.maxPriorityFeePerGas=(0,a.hexToBigInt)(j)),$.length!==0&&$!=="0x"&&(ne.accessList=E($)),W&&K&&J&&(ne.sidecars=(0,n.toBlobSidecars)({blobs:W,commitments:K,proofs:J})),(0,l.assertTransactionEIP4844)(ne),{...A.length===14?C(A):void 0,...ne}}function p(y){const _=v(y),[x,A,T,O,k,j,N,S,P,I,B,$]=_;if(!(_.length===9||_.length===12))throw new e.InvalidSerializedTransactionError({attributes:{chainId:x,nonce:A,maxPriorityFeePerGas:T,maxFeePerGas:O,gas:k,to:j,value:N,data:S,accessList:P,..._.length>9?{v:I,r:B,s:$}:{}},serializedTransaction:y,type:"eip1559"});const R={chainId:(0,a.hexToNumber)(x),type:"eip1559"};return(0,i.isHex)(j)&&j!=="0x"&&(R.to=j),(0,i.isHex)(k)&&k!=="0x"&&(R.gas=(0,a.hexToBigInt)(k)),(0,i.isHex)(S)&&S!=="0x"&&(R.data=S),(0,i.isHex)(A)&&(R.nonce=A==="0x"?0:(0,a.hexToNumber)(A)),(0,i.isHex)(N)&&N!=="0x"&&(R.value=(0,a.hexToBigInt)(N)),(0,i.isHex)(O)&&O!=="0x"&&(R.maxFeePerGas=(0,a.hexToBigInt)(O)),(0,i.isHex)(T)&&T!=="0x"&&(R.maxPriorityFeePerGas=(0,a.hexToBigInt)(T)),P.length!==0&&P!=="0x"&&(R.accessList=E(P)),(0,l.assertTransactionEIP1559)(R),{..._.length===12?C(_):void 0,...R}}function m(y){const _=v(y),[x,A,T,O,k,j,N,S,P,I,B]=_;if(!(_.length===8||_.length===11))throw new e.InvalidSerializedTransactionError({attributes:{chainId:x,nonce:A,gasPrice:T,gas:O,to:k,value:j,data:N,accessList:S,..._.length>8?{v:P,r:I,s:B}:{}},serializedTransaction:y,type:"eip2930"});const $={chainId:(0,a.hexToNumber)(x),type:"eip2930"};return(0,i.isHex)(k)&&k!=="0x"&&($.to=k),(0,i.isHex)(O)&&O!=="0x"&&($.gas=(0,a.hexToBigInt)(O)),(0,i.isHex)(N)&&N!=="0x"&&($.data=N),(0,i.isHex)(A)&&($.nonce=A==="0x"?0:(0,a.hexToNumber)(A)),(0,i.isHex)(j)&&j!=="0x"&&($.value=(0,a.hexToBigInt)(j)),(0,i.isHex)(T)&&T!=="0x"&&($.gasPrice=(0,a.hexToBigInt)(T)),S.length!==0&&S!=="0x"&&($.accessList=E(S)),(0,l.assertTransactionEIP2930)($),{..._.length===11?C(_):void 0,...$}}function b(y){const _=(0,c.fromRlp)(y,"hex"),[x,A,T,O,k,j,N,S,P]=_;if(!(_.length===6||_.length===9))throw new e.InvalidSerializedTransactionError({attributes:{nonce:x,gasPrice:A,gas:T,to:O,value:k,data:j,..._.length>6?{v:N,r:S,s:P}:{}},serializedTransaction:y,type:"legacy"});const I={type:"legacy"};if((0,i.isHex)(O)&&O!=="0x"&&(I.to=O),(0,i.isHex)(T)&&T!=="0x"&&(I.gas=(0,a.hexToBigInt)(T)),(0,i.isHex)(j)&&j!=="0x"&&(I.data=j),(0,i.isHex)(x)&&(I.nonce=x==="0x"?0:(0,a.hexToNumber)(x)),(0,i.isHex)(k)&&k!=="0x"&&(I.value=(0,a.hexToBigInt)(k)),(0,i.isHex)(A)&&A!=="0x"&&(I.gasPrice=(0,a.hexToBigInt)(A)),(0,l.assertTransactionLegacy)(I),_.length===6)return I;const B=(0,i.isHex)(N)&&N!=="0x"?(0,a.hexToBigInt)(N):0n;if(P==="0x"&&S==="0x")return B>0&&(I.chainId=Number(B)),I;const $=B,R=Number(($-35n)/2n);if(R>0)I.chainId=R;else if($!==27n&&$!==28n)throw new e.InvalidLegacyVError({v:$});return I.v=$,I.s=P,I.r=S,I.yParity=$%2n===0n?1:0,I}function v(y){return(0,c.fromRlp)(`0x${y.slice(4)}`,"hex")}function E(y){const _=[];for(let x=0;x(0,u.isHash)(O)?O:(0,o.trim)(O))})}return _}function w(y){const _=[];for(let x=0;xn){const[a,c,u]=[s.slice(0,n-1),s.slice(n-1,n),s.slice(n)],l=Math.round(+`${c}.${u}`);l>9?s=`${BigInt(a)+BigInt(1)}0`.padStart(a.length+1,"0"):s=`${a}${l}`,s.length>n&&(s=s.slice(1),i=`${BigInt(i)+1n}`),s=s.slice(0,n)}else s=s.padEnd(n,"0");return BigInt(`${o?"-":""}${i}${s}`)}return u5}var l5={},sq;function MX(){if(sq)return l5;sq=1,Object.defineProperty(l5,"__esModule",{value:!0}),l5.parseEther=r;const t=_2(),e=Ax();function r(n,i="wei"){return(0,e.parseUnits)(n,t.etherUnits[i])}return l5}var d5={},oq;function LX(){if(oq)return d5;oq=1,Object.defineProperty(d5,"__esModule",{value:!0}),d5.parseGwei=r;const t=_2(),e=Ax();function r(n,i="wei"){return(0,e.parseUnits)(n,t.gweiUnits[i])}return d5}var Ph={},aq;function UX(){if(aq)return Ph;aq=1,Object.defineProperty(Ph,"__esModule",{value:!0}),Ph.nonceManager=void 0,Ph.createNonceManager=r,Ph.jsonRpc=n;const t=ox(),e=y2();function r(i){const{source:s}=i,o=new Map,a=new e.LruMap(8192),c=new Map,u=({address:l,chainId:d})=>`${l}.${d}`;return{async consume({address:l,chainId:d,client:h}){const f=u({address:l,chainId:d}),g=this.get({address:l,chainId:d,client:h});this.increment({address:l,chainId:d});const p=await g;return await s.set({address:l,chainId:d},p),a.set(f,p),p},async increment({address:l,chainId:d}){const h=u({address:l,chainId:d}),f=o.get(h)??0;o.set(h,f+1)},async get({address:l,chainId:d,client:h}){const f=u({address:l,chainId:d});let g=c.get(f);return g||(g=(async()=>{try{const m=await s.get({address:l,chainId:d,client:h}),b=a.get(f)??0;return b>0&&m<=b?b+1:(a.delete(f),m)}finally{this.reset({address:l,chainId:d})}})(),c.set(f,g)),(o.get(f)??0)+await g},reset({address:l,chainId:d}){const h=u({address:l,chainId:d});o.delete(h),c.delete(h)}}}function n(){return{async get(i){const{address:s,client:o}=i;return(0,t.getTransactionCount)(o,{address:s,blockTag:"pending"})},set(){}}}return Ph.nonceManager=r({source:n()}),Ph}var cq;function sR(){return cq||(cq=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getContractAddress=t.publicKeyToAddress=t.parseAccount=t.verifyAuthorization=t.serializeAuthorizationList=t.recoverAuthorizationAddress=t.hashAuthorization=t.formatAbiParams=t.formatAbiItem=t.formatAbiItemWithArgs=t.encodePacked=t.parseAbiParameters=t.parseAbiParameter=t.parseAbiItem=t.parseAbi=t.getAbiItem=t.parseEventLogs=t.encodeFunctionResult=t.encodeFunctionData=t.encodeEventTopics=t.encodeErrorResult=t.encodeDeployData=t.encodeAbiParameters=t.decodeFunctionResult=t.decodeFunctionData=t.decodeEventLog=t.decodeErrorResult=t.decodeAbiParameters=t.validateTypedData=t.serializeTypedData=t.stringify=t.getWebSocketRpcClient=t.socketClientCache=t.getSocketRpcClient=t.getHttpRpcClient=t.rpc=t.getSocket=t.integerRegex=t.bytesRegex=t.arrayRegex=t.getChainContractAddress=t.extractChain=t.defineChain=t.assertCurrentChain=t.offchainLookupSignature=t.offchainLookupAbiItem=t.offchainLookup=t.ccipFetch=t.ccipRequest=t.buildRequest=void 0,t.hexToString=t.hexToNumber=t.hexToBigInt=t.hexToBool=t.fromHex=t.fromBytes=t.bytesToString=t.bytesToNumber=t.bytesToBool=t.bytesToBigint=t.bytesToBigInt=t.stringToHex=t.numberToHex=t.toHex=t.bytesToHex=t.boolToHex=t.stringToBytes=t.numberToBytes=t.hexToBytes=t.toBytes=t.boolToBytes=t.toRlp=t.extract=t.formatTransactionRequest=t.defineTransactionRequest=t.defineTransactionReceipt=t.formatLog=t.transactionType=t.formatTransaction=t.defineTransaction=t.formatBlock=t.defineBlock=t.trim=t.sliceHex=t.sliceBytes=t.slice=t.size=t.padHex=t.padBytes=t.pad=t.isHex=t.isBytes=t.concatHex=t.concatBytes=t.concat=t.isAddressEqual=t.isAddress=t.getAddress=t.getCreate2Address=t.getCreateAddress=void 0,t.parseEther=t.parseUnits=t.formatUnits=t.formatGwei=t.formatEther=t.serializeAccessList=t.serializeTransaction=t.parseTransaction=t.assertTransactionLegacy=t.assertTransactionEIP2930=t.assertTransactionEIP1559=t.assertRequest=t.getTransactionType=t.getSerializedTransactionType=t.serializeErc6492Signature=t.isErc6492Signature=t.parseErc6492Signature=t.hashMessage=t.verifyTypedData=t.verifyMessage=t.verifyHash=t.recoverTypedDataAddress=t.recoverPublicKey=t.recoverMessageAddress=t.recoverAddress=t.hashTypedData=t.hashStruct=t.ripemd160=t.sha256=t.keccak256=t.isHash=t.toFunctionHash=t.toEventHash=t.getFunctionSignature=t.toFunctionSignature=t.getEventSignature=t.toEventSignature=t.getFunctionSelector=t.toFunctionSelector=t.getEventSelector=t.toEventSelector=t.defineFormatter=t.getAction=t.getTransactionError=t.getEstimateGasError=t.getContractError=t.getCallError=t.getNodeError=t.containsNodeError=t.fromRlp=void 0,t.nonceManager=t.createNonceManager=t.parseGwei=void 0;var e=cX();Object.defineProperty(t,"buildRequest",{enumerable:!0,get:function(){return e.buildRequest}});var r=MO();Object.defineProperty(t,"ccipRequest",{enumerable:!0,get:function(){return r.ccipRequest}}),Object.defineProperty(t,"ccipFetch",{enumerable:!0,get:function(){return r.ccipRequest}}),Object.defineProperty(t,"offchainLookup",{enumerable:!0,get:function(){return r.offchainLookup}}),Object.defineProperty(t,"offchainLookupAbiItem",{enumerable:!0,get:function(){return r.offchainLookupAbiItem}}),Object.defineProperty(t,"offchainLookupSignature",{enumerable:!0,get:function(){return r.offchainLookupSignature}});var n=gx();Object.defineProperty(t,"assertCurrentChain",{enumerable:!0,get:function(){return n.assertCurrentChain}});var i=wX();Object.defineProperty(t,"defineChain",{enumerable:!0,get:function(){return i.defineChain}});var s=bX();Object.defineProperty(t,"extractChain",{enumerable:!0,get:function(){return s.extractChain}});var o=nh();Object.defineProperty(t,"getChainContractAddress",{enumerable:!0,get:function(){return o.getChainContractAddress}});var a=JA();Object.defineProperty(t,"arrayRegex",{enumerable:!0,get:function(){return a.arrayRegex}}),Object.defineProperty(t,"bytesRegex",{enumerable:!0,get:function(){return a.bytesRegex}}),Object.defineProperty(t,"integerRegex",{enumerable:!0,get:function(){return a.integerRegex}});var c=vX();Object.defineProperty(t,"getSocket",{enumerable:!0,get:function(){return c.getSocket}}),Object.defineProperty(t,"rpc",{enumerable:!0,get:function(){return c.rpc}});var u=WO();Object.defineProperty(t,"getHttpRpcClient",{enumerable:!0,get:function(){return u.getHttpRpcClient}});var l=yX();Object.defineProperty(t,"getSocketRpcClient",{enumerable:!0,get:function(){return l.getSocketRpcClient}}),Object.defineProperty(t,"socketClientCache",{enumerable:!0,get:function(){return l.socketClientCache}});var d=KO();Object.defineProperty(t,"getWebSocketRpcClient",{enumerable:!0,get:function(){return d.getWebSocketRpcClient}});var h=Gn();Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return h.stringify}});var f=vx();Object.defineProperty(t,"serializeTypedData",{enumerable:!0,get:function(){return f.serializeTypedData}}),Object.defineProperty(t,"validateTypedData",{enumerable:!0,get:function(){return f.validateTypedData}});var g=Jd();Object.defineProperty(t,"decodeAbiParameters",{enumerable:!0,get:function(){return g.decodeAbiParameters}});var p=ex();Object.defineProperty(t,"decodeErrorResult",{enumerable:!0,get:function(){return p.decodeErrorResult}});var m=P2();Object.defineProperty(t,"decodeEventLog",{enumerable:!0,get:function(){return m.decodeEventLog}});var b=$O();Object.defineProperty(t,"decodeFunctionData",{enumerable:!0,get:function(){return b.decodeFunctionData}});var v=al();Object.defineProperty(t,"decodeFunctionResult",{enumerable:!0,get:function(){return v.decodeFunctionResult}});var E=da();Object.defineProperty(t,"encodeAbiParameters",{enumerable:!0,get:function(){return E.encodeAbiParameters}});var w=k2();Object.defineProperty(t,"encodeDeployData",{enumerable:!0,get:function(){return w.encodeDeployData}});var C=jO();Object.defineProperty(t,"encodeErrorResult",{enumerable:!0,get:function(){return C.encodeErrorResult}});var y=Up();Object.defineProperty(t,"encodeEventTopics",{enumerable:!0,get:function(){return y.encodeEventTopics}});var _=Bs();Object.defineProperty(t,"encodeFunctionData",{enumerable:!0,get:function(){return _.encodeFunctionData}});var x=BO();Object.defineProperty(t,"encodeFunctionResult",{enumerable:!0,get:function(){return x.encodeFunctionResult}});var A=O2();Object.defineProperty(t,"parseEventLogs",{enumerable:!0,get:function(){return A.parseEventLogs}});var T=rl();Object.defineProperty(t,"getAbiItem",{enumerable:!0,get:function(){return T.getAbiItem}});var O=Kd();Object.defineProperty(t,"parseAbi",{enumerable:!0,get:function(){return O.parseAbi}}),Object.defineProperty(t,"parseAbiItem",{enumerable:!0,get:function(){return O.parseAbiItem}}),Object.defineProperty(t,"parseAbiParameter",{enumerable:!0,get:function(){return O.parseAbiParameter}}),Object.defineProperty(t,"parseAbiParameters",{enumerable:!0,get:function(){return O.parseAbiParameters}});var k=EX();Object.defineProperty(t,"encodePacked",{enumerable:!0,get:function(){return k.encodePacked}});var j=$Q();Object.defineProperty(t,"formatAbiItemWithArgs",{enumerable:!0,get:function(){return j.formatAbiItemWithArgs}});var N=el();Object.defineProperty(t,"formatAbiItem",{enumerable:!0,get:function(){return N.formatAbiItem}}),Object.defineProperty(t,"formatAbiParams",{enumerable:!0,get:function(){return N.formatAbiParams}});var S=LQ();Object.defineProperty(t,"hashAuthorization",{enumerable:!0,get:function(){return S.hashAuthorization}});var P=nx();Object.defineProperty(t,"recoverAuthorizationAddress",{enumerable:!0,get:function(){return P.recoverAuthorizationAddress}});var I=CX();Object.defineProperty(t,"serializeAuthorizationList",{enumerable:!0,get:function(){return I.serializeAuthorizationList}});var B=zIe();Object.defineProperty(t,"verifyAuthorization",{enumerable:!0,get:function(){return B.verifyAuthorization}});var $=sn();Object.defineProperty(t,"parseAccount",{enumerable:!0,get:function(){return $.parseAccount}});var R=jQ();Object.defineProperty(t,"publicKeyToAddress",{enumerable:!0,get:function(){return R.publicKeyToAddress}});var D=AX();Object.defineProperty(t,"getContractAddress",{enumerable:!0,get:function(){return D.getContractAddress}}),Object.defineProperty(t,"getCreateAddress",{enumerable:!0,get:function(){return D.getCreateAddress}}),Object.defineProperty(t,"getCreate2Address",{enumerable:!0,get:function(){return D.getCreate2Address}});var L=js();Object.defineProperty(t,"getAddress",{enumerable:!0,get:function(){return L.getAddress}});var U=is();Object.defineProperty(t,"isAddress",{enumerable:!0,get:function(){return U.isAddress}});var z=fa();Object.defineProperty(t,"isAddressEqual",{enumerable:!0,get:function(){return z.isAddressEqual}});var W=oi();Object.defineProperty(t,"concat",{enumerable:!0,get:function(){return W.concat}}),Object.defineProperty(t,"concatBytes",{enumerable:!0,get:function(){return W.concatBytes}}),Object.defineProperty(t,"concatHex",{enumerable:!0,get:function(){return W.concatHex}});var K=YO();Object.defineProperty(t,"isBytes",{enumerable:!0,get:function(){return K.isBytes}});var J=ki();Object.defineProperty(t,"isHex",{enumerable:!0,get:function(){return J.isHex}});var ne=Zd();Object.defineProperty(t,"pad",{enumerable:!0,get:function(){return ne.pad}}),Object.defineProperty(t,"padBytes",{enumerable:!0,get:function(){return ne.padBytes}}),Object.defineProperty(t,"padHex",{enumerable:!0,get:function(){return ne.padHex}});var ae=rs();Object.defineProperty(t,"size",{enumerable:!0,get:function(){return ae.size}});var he=go();Object.defineProperty(t,"slice",{enumerable:!0,get:function(){return he.slice}}),Object.defineProperty(t,"sliceBytes",{enumerable:!0,get:function(){return he.sliceBytes}}),Object.defineProperty(t,"sliceHex",{enumerable:!0,get:function(){return he.sliceHex}});var ie=tl();Object.defineProperty(t,"trim",{enumerable:!0,get:function(){return ie.trim}});var Ee=sx();Object.defineProperty(t,"defineBlock",{enumerable:!0,get:function(){return Ee.defineBlock}}),Object.defineProperty(t,"formatBlock",{enumerable:!0,get:function(){return Ee.formatBlock}});var pe=I2();Object.defineProperty(t,"defineTransaction",{enumerable:!0,get:function(){return pe.defineTransaction}}),Object.defineProperty(t,"formatTransaction",{enumerable:!0,get:function(){return pe.formatTransaction}}),Object.defineProperty(t,"transactionType",{enumerable:!0,get:function(){return pe.transactionType}});var ve=ol();Object.defineProperty(t,"formatLog",{enumerable:!0,get:function(){return ve.formatLog}});var je=wx();Object.defineProperty(t,"defineTransactionReceipt",{enumerable:!0,get:function(){return je.defineTransactionReceipt}});var rt=il();Object.defineProperty(t,"defineTransactionRequest",{enumerable:!0,get:function(){return rt.defineTransactionRequest}}),Object.defineProperty(t,"formatTransactionRequest",{enumerable:!0,get:function(){return rt.formatTransactionRequest}});var Ce=_1();Object.defineProperty(t,"extract",{enumerable:!0,get:function(){return Ce.extract}});var fe=x2();Object.defineProperty(t,"toRlp",{enumerable:!0,get:function(){return fe.toRlp}});var ft=Tr();Object.defineProperty(t,"boolToBytes",{enumerable:!0,get:function(){return ft.boolToBytes}}),Object.defineProperty(t,"toBytes",{enumerable:!0,get:function(){return ft.toBytes}}),Object.defineProperty(t,"hexToBytes",{enumerable:!0,get:function(){return ft.hexToBytes}}),Object.defineProperty(t,"numberToBytes",{enumerable:!0,get:function(){return ft.numberToBytes}}),Object.defineProperty(t,"stringToBytes",{enumerable:!0,get:function(){return ft.stringToBytes}});var Wt=ze();Object.defineProperty(t,"boolToHex",{enumerable:!0,get:function(){return Wt.boolToHex}}),Object.defineProperty(t,"bytesToHex",{enumerable:!0,get:function(){return Wt.bytesToHex}}),Object.defineProperty(t,"toHex",{enumerable:!0,get:function(){return Wt.toHex}}),Object.defineProperty(t,"numberToHex",{enumerable:!0,get:function(){return Wt.numberToHex}}),Object.defineProperty(t,"stringToHex",{enumerable:!0,get:function(){return Wt.stringToHex}});var lr=mO();Object.defineProperty(t,"bytesToBigInt",{enumerable:!0,get:function(){return lr.bytesToBigInt}}),Object.defineProperty(t,"bytesToBigint",{enumerable:!0,get:function(){return lr.bytesToBigInt}}),Object.defineProperty(t,"bytesToBool",{enumerable:!0,get:function(){return lr.bytesToBool}}),Object.defineProperty(t,"bytesToNumber",{enumerable:!0,get:function(){return lr.bytesToNumber}}),Object.defineProperty(t,"bytesToString",{enumerable:!0,get:function(){return lr.bytesToString}}),Object.defineProperty(t,"fromBytes",{enumerable:!0,get:function(){return lr.fromBytes}});var dr=nn();Object.defineProperty(t,"fromHex",{enumerable:!0,get:function(){return dr.fromHex}}),Object.defineProperty(t,"hexToBool",{enumerable:!0,get:function(){return dr.hexToBool}}),Object.defineProperty(t,"hexToBigInt",{enumerable:!0,get:function(){return dr.hexToBigInt}}),Object.defineProperty(t,"hexToNumber",{enumerable:!0,get:function(){return dr.hexToNumber}}),Object.defineProperty(t,"hexToString",{enumerable:!0,get:function(){return dr.hexToString}});var hr=JO();Object.defineProperty(t,"fromRlp",{enumerable:!0,get:function(){return hr.fromRlp}});var Er=S2();Object.defineProperty(t,"containsNodeError",{enumerable:!0,get:function(){return Er.containsNodeError}}),Object.defineProperty(t,"getNodeError",{enumerable:!0,get:function(){return Er.getNodeError}});var be=RO();Object.defineProperty(t,"getCallError",{enumerable:!0,get:function(){return be.getCallError}});var Te=eh();Object.defineProperty(t,"getContractError",{enumerable:!0,get:function(){return Te.getContractError}});var Me=FQ();Object.defineProperty(t,"getEstimateGasError",{enumerable:!0,get:function(){return Me.getEstimateGasError}});var st=UO();Object.defineProperty(t,"getTransactionError",{enumerable:!0,get:function(){return st.getTransactionError}});var Cr=ur();Object.defineProperty(t,"getAction",{enumerable:!0,get:function(){return Cr.getAction}});var hn=T2();Object.defineProperty(t,"defineFormatter",{enumerable:!0,get:function(){return hn.defineFormatter}});var ai=v1();Object.defineProperty(t,"toEventSelector",{enumerable:!0,get:function(){return ai.toEventSelector}}),Object.defineProperty(t,"getEventSelector",{enumerable:!0,get:function(){return ai.toEventSelector}});var fn=Lp();Object.defineProperty(t,"toFunctionSelector",{enumerable:!0,get:function(){return fn.toFunctionSelector}}),Object.defineProperty(t,"getFunctionSelector",{enumerable:!0,get:function(){return fn.toFunctionSelector}});var Ms=xX();Object.defineProperty(t,"toEventSignature",{enumerable:!0,get:function(){return Ms.toEventSignature}}),Object.defineProperty(t,"getEventSignature",{enumerable:!0,get:function(){return Ms.toEventSignature}});var mo=SX();Object.defineProperty(t,"toFunctionSignature",{enumerable:!0,get:function(){return mo.toFunctionSignature}}),Object.defineProperty(t,"getFunctionSignature",{enumerable:!0,get:function(){return mo.toFunctionSignature}});var U2=TX();Object.defineProperty(t,"toEventHash",{enumerable:!0,get:function(){return U2.toEventHash}});var F2=IX();Object.defineProperty(t,"toFunctionHash",{enumerable:!0,get:function(){return F2.toFunctionHash}});var Px=QO();Object.defineProperty(t,"isHash",{enumerable:!0,get:function(){return Px.isHash}});var Ox=ns();Object.defineProperty(t,"keccak256",{enumerable:!0,get:function(){return Ox.keccak256}});var Rx=AO();Object.defineProperty(t,"sha256",{enumerable:!0,get:function(){return Rx.sha256}});var kx=OX();Object.defineProperty(t,"ripemd160",{enumerable:!0,get:function(){return kx.ripemd160}});var H2=B2();Object.defineProperty(t,"hashStruct",{enumerable:!0,get:function(){return H2.hashStruct}}),Object.defineProperty(t,"hashTypedData",{enumerable:!0,get:function(){return H2.hashTypedData}});var Nx=th();Object.defineProperty(t,"recoverAddress",{enumerable:!0,get:function(){return Nx.recoverAddress}});var q2=XO();Object.defineProperty(t,"recoverMessageAddress",{enumerable:!0,get:function(){return q2.recoverMessageAddress}});var z2=yO();Object.defineProperty(t,"recoverPublicKey",{enumerable:!0,get:function(){return z2.recoverPublicKey}});var x1=eR();Object.defineProperty(t,"recoverTypedDataAddress",{enumerable:!0,get:function(){return x1.recoverTypedDataAddress}});var $x=NX();Object.defineProperty(t,"verifyHash",{enumerable:!0,get:function(){return $x.verifyHash}});var jx=$X();Object.defineProperty(t,"verifyMessage",{enumerable:!0,get:function(){return jx.verifyMessage}});var Bx=jX();Object.defineProperty(t,"verifyTypedData",{enumerable:!0,get:function(){return Bx.verifyTypedData}});var Dx=D2();Object.defineProperty(t,"hashMessage",{enumerable:!0,get:function(){return Dx.hashMessage}});var Mx=BX();Object.defineProperty(t,"parseErc6492Signature",{enumerable:!0,get:function(){return Mx.parseErc6492Signature}});var Lx=Cx();Object.defineProperty(t,"isErc6492Signature",{enumerable:!0,get:function(){return Lx.isErc6492Signature}});var Ux=rR();Object.defineProperty(t,"serializeErc6492Signature",{enumerable:!0,get:function(){return Ux.serializeErc6492Signature}});var S1=nR();Object.defineProperty(t,"getSerializedTransactionType",{enumerable:!0,get:function(){return S1.getSerializedTransactionType}});var ih=lx();Object.defineProperty(t,"getTransactionType",{enumerable:!0,get:function(){return ih.getTransactionType}});var sh=sl();Object.defineProperty(t,"assertRequest",{enumerable:!0,get:function(){return sh.assertRequest}});var gc=_x();Object.defineProperty(t,"assertTransactionEIP1559",{enumerable:!0,get:function(){return gc.assertTransactionEIP1559}}),Object.defineProperty(t,"assertTransactionEIP2930",{enumerable:!0,get:function(){return gc.assertTransactionEIP2930}}),Object.defineProperty(t,"assertTransactionLegacy",{enumerable:!0,get:function(){return gc.assertTransactionLegacy}});var oh=iR();Object.defineProperty(t,"parseTransaction",{enumerable:!0,get:function(){return oh.parseTransaction}});var Fx=Ex();Object.defineProperty(t,"serializeTransaction",{enumerable:!0,get:function(){return Fx.serializeTransaction}});var Hx=ZO();Object.defineProperty(t,"serializeAccessList",{enumerable:!0,get:function(){return Hx.serializeAccessList}});var qx=E2();Object.defineProperty(t,"formatEther",{enumerable:!0,get:function(){return qx.formatEther}});var zx=Fp();Object.defineProperty(t,"formatGwei",{enumerable:!0,get:function(){return zx.formatGwei}});var Wx=tx();Object.defineProperty(t,"formatUnits",{enumerable:!0,get:function(){return Wx.formatUnits}});var Vx=Ax();Object.defineProperty(t,"parseUnits",{enumerable:!0,get:function(){return Vx.parseUnits}});var Gx=MX();Object.defineProperty(t,"parseEther",{enumerable:!0,get:function(){return Gx.parseEther}});var Kx=LX();Object.defineProperty(t,"parseGwei",{enumerable:!0,get:function(){return Kx.parseGwei}});var W2=UX();Object.defineProperty(t,"createNonceManager",{enumerable:!0,get:function(){return W2.createNonceManager}}),Object.defineProperty(t,"nonceManager",{enumerable:!0,get:function(){return W2.nonceManager}})}(RT)),RT}var uq;function VIe(){if(uq)return UE;uq=1,Object.defineProperty(UE,"__esModule",{value:!0}),UE.formatProof=r;const t=sR();function e(n){return n.map(i=>({...i,value:BigInt(i.value)}))}function r(n){return{...n,balance:n.balance?BigInt(n.balance):void 0,nonce:n.nonce?(0,t.hexToNumber)(n.nonce):void 0,storageProof:n.storageProof?e(n.storageProof):void 0}}return UE}var lq;function GIe(){if(lq)return LE;lq=1,Object.defineProperty(LE,"__esModule",{value:!0}),LE.getProof=r;const t=ze(),e=VIe();async function r(n,{address:i,blockNumber:s,blockTag:o,storageKeys:a}){const c=o??"latest",u=s!==void 0?(0,t.numberToHex)(s):void 0,l=await n.request({method:"eth_getProof",params:[i,a,u||c]});return(0,e.formatProof)(l)}return LE}var h5={},dq;function KIe(){if(dq)return h5;dq=1,Object.defineProperty(h5,"__esModule",{value:!0}),h5.getStorageAt=e;const t=ze();async function e(r,{address:n,blockNumber:i,blockTag:s="latest",slot:o}){const a=i!==void 0?(0,t.numberToHex)(i):void 0;return await r.request({method:"eth_getStorageAt",params:[n,o,a||s]})}return h5}var f5={},hq;function oR(){if(hq)return f5;hq=1,Object.defineProperty(f5,"__esModule",{value:!0}),f5.getTransaction=n;const t=Ds(),e=ze(),r=I2();async function n(i,{blockHash:s,blockNumber:o,blockTag:a,hash:c,index:u}){var g,p,m;const l=a||"latest",d=o!==void 0?(0,e.numberToHex)(o):void 0;let h=null;if(c?h=await i.request({method:"eth_getTransactionByHash",params:[c]},{dedupe:!0}):s?h=await i.request({method:"eth_getTransactionByBlockHashAndIndex",params:[s,(0,e.numberToHex)(u)]},{dedupe:!0}):h=await i.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[d||l,(0,e.numberToHex)(u)]},{dedupe:!!d}),!h)throw new t.TransactionNotFoundError({blockHash:s,blockNumber:o,blockTag:l,hash:c,index:u});return(((m=(p=(g=i.chain)==null?void 0:g.formatters)==null?void 0:p.transaction)==null?void 0:m.format)||r.formatTransaction)(h)}return f5}var p5={},fq;function ZIe(){if(fq)return p5;fq=1,Object.defineProperty(p5,"__esModule",{value:!0}),p5.getTransactionConfirmations=n;const t=ur(),e=$2(),r=oR();async function n(i,{hash:s,transactionReceipt:o}){const[a,c]=await Promise.all([(0,t.getAction)(i,e.getBlockNumber,"getBlockNumber")({}),s?(0,t.getAction)(i,r.getTransaction,"getTransaction")({hash:s}):void 0]),u=(o==null?void 0:o.blockNumber)||(c==null?void 0:c.blockNumber);return u?a-u+1n:0n}return p5}var g5={},pq;function FX(){if(pq)return g5;pq=1,Object.defineProperty(g5,"__esModule",{value:!0}),g5.getTransactionReceipt=r;const t=Ds(),e=wx();async function r(n,{hash:i}){var a,c,u;const s=await n.request({method:"eth_getTransactionReceipt",params:[i]},{dedupe:!0});if(!s)throw new t.TransactionReceiptNotFoundError({hash:i});return(((u=(c=(a=n.chain)==null?void 0:a.formatters)==null?void 0:c.transactionReceipt)==null?void 0:u.format)||e.formatTransactionReceipt)(s)}return g5}var m5={},gq;function YIe(){if(gq)return m5;gq=1,Object.defineProperty(m5,"__esModule",{value:!0}),m5.multicall=l;const t=rh(),e=$r(),r=_t(),n=Qd(),i=al(),s=Bs(),o=nh(),a=eh(),c=ur(),u=ul();async function l(d,h){var k;const{account:f,allowFailure:g=!0,batchSize:p,blockNumber:m,blockTag:b,multicallAddress:v,stateOverride:E}=h,w=h.contracts,C=p??(typeof((k=d.batch)==null?void 0:k.multicall)=="object"&&d.batch.multicall.batchSize||1024);let y=v;if(!y){if(!d.chain)throw new Error("client chain not configured. multicallAddress is required.");y=(0,o.getChainContractAddress)({blockNumber:m,chain:d.chain,contract:"multicall3"})}const _=[[]];let x=0,A=0;for(let j=0;j0&&A>C&&_[x].length>0&&(x++,A=(B.length-2)/2,_[x]=[]),_[x]=[..._[x],{allowFailure:!0,callData:B,target:S}]}catch(B){const $=(0,a.getContractError)(B,{abi:N,address:S,args:P,docsPath:"/docs/contract/multicall",functionName:I,sender:f});if(!g)throw $;_[x]=[..._[x],{allowFailure:!0,callData:"0x",target:S}]}}const T=await Promise.allSettled(_.map(j=>(0,c.getAction)(d,u.readContract,"readContract")({abi:t.multicall3Abi,account:f,address:y,args:[j],blockNumber:m,blockTag:b,functionName:"aggregate3",stateOverride:E}))),O=[];for(let j=0;j{const I=P,B=I.account?(0,e.parseAccount)(I.account):void 0,$={...I,data:I.abi?(0,o.encodeFunctionData)(I):I.data,from:I.from??(B==null?void 0:B.address)};return(0,g.assertRequest)($),(0,h.formatTransactionRequest)($)}),S=k.stateOverrides?(0,f.serializeStateOverride)(k.stateOverrides):void 0;x.push({blockOverrides:j,calls:N,stateOverrides:S})}const T=(typeof v=="bigint"?(0,a.numberToHex)(v):void 0)||E;return(await m.request({method:"eth_simulateV1",params:[{blockStateCalls:x,returnFullTransactions:C,traceTransfers:y,validation:_},T]})).map((k,j)=>({...(0,l.formatBlock)(k),calls:k.calls.map((N,S)=>{var K,J;const{abi:P,args:I,functionName:B,to:$}=w[j].calls[S],R=((K=N.error)==null?void 0:K.data)??N.returnData,D=BigInt(N.gasUsed),L=(J=N.logs)==null?void 0:J.map(ne=>(0,d.formatLog)(ne)),U=N.status==="0x1"?"success":"failure",z=P&&U==="success"&&R!=="0x"?(0,s.decodeFunctionResult)({abi:P,data:R,functionName:B}):null,W=(()=>{var ae;if(U==="success")return;let ne;if(((ae=N.error)==null?void 0:ae.data)==="0x"?ne=new r.AbiDecodingZeroDataError:N.error&&(ne=new n.RawContractError(N.error)),!!ne)return(0,c.getContractError)(ne,{abi:P??[],address:$,args:I,functionName:B??""})})();return{data:R,gasUsed:D,logs:L,status:U,...U==="success"?{result:z}:{error:W}}})}))}catch(x){const A=x,T=(0,u.getNodeError)(A,{});throw T instanceof i.UnknownNodeError?A:T}}return w5}var b5={},Rl={},di={},Oh={},wq;function qX(){if(wq)return Oh;wq=1,Object.defineProperty(Oh,"__esModule",{value:!0}),Oh.keccak256=s,Oh.ripemd160=o,Oh.sha256=a,Oh.validate=c;const t=PX(),e=fO(),r=zQ(),n=Hp(),i=pa();function s(u,l={}){const{as:d=typeof u=="string"?"Hex":"Bytes"}=l,h=(0,e.keccak_256)(n.from(u));return d==="Bytes"?h:i.fromBytes(h)}function o(u,l={}){const{as:d=typeof u=="string"?"Hex":"Bytes"}=l,h=(0,t.ripemd160)(n.from(u));return d==="Bytes"?h:i.fromBytes(h)}function a(u,l={}){const{as:d=typeof u=="string"?"Hex":"Bytes"}=l,h=(0,r.sha256)(n.from(u));return d==="Bytes"?h:i.fromBytes(h)}function c(u){return i.validate(u)&&i.size(u)===32}return Oh}var N0={},hi={},$0={},Yw={},bq;function JIe(){if(bq)return Yw;bq=1,Object.defineProperty(Yw,"__esModule",{value:!0}),Yw.LruMap=void 0;class t extends Map{constructor(r){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=r}get(r){const n=super.get(r);return super.has(r)&&n!==void 0&&(this.delete(r),super.set(r,n)),n}set(r,n){if(super.set(r,n),this.maxSize&&this.size>this.maxSize){const i=this.keys().next().value;i&&this.delete(i)}return this}}return Yw.LruMap=t,Yw}var yq;function QIe(){if(yq)return $0;yq=1,Object.defineProperty($0,"__esModule",{value:!0}),$0.checksum=void 0,$0.clear=r;const t=JIe(),e={checksum:new t.LruMap(8192)};$0.checksum=e.checksum;function r(){for(const n of Object.values(e))n.clear()}return $0}var zr={},vq;function XIe(){if(vq)return zr;vq=1,Object.defineProperty(zr,"__esModule",{value:!0}),zr.InvalidSerializedSizeError=zr.InvalidUncompressedPrefixError=zr.InvalidCompressedPrefixError=zr.InvalidPrefixError=zr.InvalidError=void 0,zr.assert=i,zr.compress=s,zr.from=o,zr.fromBytes=a,zr.fromHex=c,zr.toBytes=u,zr.toHex=l,zr.validate=d;const t=Hp(),e=cl(),r=pa(),n=OO();function i(b,v={}){const{compressed:E}=v,{prefix:w,x:C,y}=b;if(E===!1||typeof C=="bigint"&&typeof y=="bigint"){if(w!==4)throw new f({prefix:w,cause:new p});return}if(E===!0||typeof C=="bigint"&&typeof y>"u"){if(w!==3&&w!==2)throw new f({prefix:w,cause:new g});return}throw new h({publicKey:b})}function s(b){const{x:v,y:E}=b;return{prefix:E%2n===0n?2:3,x:v}}function o(b){const v=(()=>{if(r.validate(b))return c(b);if(t.validate(b))return a(b);const{prefix:E,x:w,y:C}=b;return typeof w=="bigint"&&typeof C=="bigint"?{prefix:E??4,x:w,y:C}:{prefix:E,x:w}})();return i(v),v}function a(b){return c(r.fromBytes(b))}function c(b){if(b.length!==132&&b.length!==130&&b.length!==68)throw new m({publicKey:b});if(b.length===130){const w=BigInt(r.slice(b,0,32)),C=BigInt(r.slice(b,32,64));return{prefix:4,x:w,y:C}}if(b.length===132){const w=Number(r.slice(b,0,1)),C=BigInt(r.slice(b,1,33)),y=BigInt(r.slice(b,33,65));return{prefix:w,x:C,y}}const v=Number(r.slice(b,0,1)),E=BigInt(r.slice(b,1,33));return{prefix:v,x:E}}function u(b,v={}){return t.fromHex(l(b,v))}function l(b,v={}){i(b);const{prefix:E,x:w,y:C}=b,{includePrefix:y=!0}=v;return r.concat(y?r.fromNumber(E,{size:1}):"0x",r.fromNumber(w,{size:32}),typeof C=="bigint"?r.fromNumber(C,{size:32}):"0x")}function d(b,v={}){try{return i(b,v),!0}catch{return!1}}class h extends e.BaseError{constructor({publicKey:v}){super(`Value \`${n.stringify(v)}\` is not a valid public key.`,{metaMessages:["Public key must contain:","- an `x` and `prefix` value (compressed)","- an `x`, `y`, and `prefix` value (uncompressed)"]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidError"})}}zr.InvalidError=h;class f extends e.BaseError{constructor({prefix:v,cause:E}){super(`Prefix "${v}" is invalid.`,{cause:E}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidPrefixError"})}}zr.InvalidPrefixError=f;class g extends e.BaseError{constructor(){super("Prefix must be 2 or 3 for compressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidCompressedPrefixError"})}}zr.InvalidCompressedPrefixError=g;class p extends e.BaseError{constructor(){super("Prefix must be 4 for uncompressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidUncompressedPrefixError"})}}zr.InvalidUncompressedPrefixError=p;class m extends e.BaseError{constructor({publicKey:v}){super(`Value \`${v}\` is an invalid public key size.`,{metaMessages:["Expected: 33 bytes (compressed + prefix), 64 bytes (uncompressed) or 65 bytes (uncompressed + prefix).",`Received ${r.size(r.from(v))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidSerializedSizeError"})}}return zr.InvalidSerializedSizeError=m,zr}var _q;function aR(){if(_q)return hi;_q=1,Object.defineProperty(hi,"__esModule",{value:!0}),hi.InvalidChecksumError=hi.InvalidInputError=hi.InvalidAddressError=void 0,hi.assert=o,hi.checksum=a,hi.from=c,hi.fromPublicKey=u,hi.isEqual=l,hi.validate=d;const t=Hp(),e=QIe(),r=cl(),n=qX(),i=XIe(),s=/^0x[a-fA-F0-9]{40}$/;function o(p,m={}){const{strict:b=!0}=m;if(!s.test(p))throw new h({address:p,cause:new f});if(b){if(p.toLowerCase()===p)return;if(a(p)!==p)throw new h({address:p,cause:new g})}}function a(p){if(e.checksum.has(p))return e.checksum.get(p);o(p,{strict:!1});const m=p.substring(2).toLowerCase(),b=n.keccak256(t.fromString(m),{as:"Bytes"}),v=m.split("");for(let w=0;w<40;w+=2)b[w>>1]>>4>=8&&v[w]&&(v[w]=v[w].toUpperCase()),(b[w>>1]&15)>=8&&v[w+1]&&(v[w+1]=v[w+1].toUpperCase());const E=`0x${v.join("")}`;return e.checksum.set(p,E),E}function c(p,m={}){const{checksum:b=!1}=m;return o(p),b?a(p):p}function u(p,m={}){const b=n.keccak256(`0x${i.toHex(p).slice(4)}`).substring(26);return c(`0x${b}`,m)}function l(p,m){return o(p,{strict:!1}),o(m,{strict:!1}),p.toLowerCase()===m.toLowerCase()}function d(p,m={}){const{strict:b=!0}=m??{};try{return o(p,{strict:b}),!0}catch{return!1}}class h extends r.BaseError{constructor({address:m,cause:b}){super(`Address "${m}" is invalid.`,{cause:b}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidAddressError"})}}hi.InvalidAddressError=h;class f extends r.BaseError{constructor(){super("Address is not a 20 byte (40 hexadecimal character) value."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidInputError"})}}hi.InvalidInputError=f;class g extends r.BaseError{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}return hi.InvalidChecksumError=g,hi}var Eq;function ePe(){if(Eq)return N0;Eq=1,Object.defineProperty(N0,"__esModule",{value:!0}),N0.normalizeSignature=r,N0.isArgOfType=n,N0.getAmbiguousTypes=i;const t=aR(),e=cl();function r(s){let o=!0,a="",c=0,u="",l=!1;for(let d=0;dn(Object.values(s)[l],u)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(c)?a==="number"||a==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(c)?a==="string"||s instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(c)?Array.isArray(s)&&s.every(u=>n(u,{...o,type:c.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function i(s,o,a){for(const c in s){const u=s[c],l=o[c];if(u.type==="tuple"&&l.type==="tuple"&&"components"in u&&"components"in l)return i(u.components,l.components,a[c]);const d=[u.type,l.type];if(d.includes("address")&&d.includes("bytes20")?!0:d.includes("address")&&d.includes("string")?t.validate(a[c],{strict:!1}):d.includes("address")&&d.includes("bytes")?t.validate(a[c],{strict:!1}):!1)return d}}return N0}var Cq;function zX(){if(Cq)return di;Cq=1,Object.defineProperty(di,"__esModule",{value:!0}),di.InvalidSelectorSizeError=di.NotFoundError=di.AmbiguityError=void 0,di.format=s,di.from=o,di.fromAbi=a,di.getSelector=c,di.getSignature=u,di.getSignatureHash=l;const t=Kd(),e=cl(),r=qX(),n=pa(),i=ePe();function s(g){return t.formatAbiItem(g)}function o(g,p={}){const{prepare:m=!0}=p,b=Array.isArray(g)||typeof g=="string"?t.parseAbiItem(g):g;return{...b,...m?{hash:l(b)}:{}}}function a(g,p,m){const{args:b=[],prepare:v=!0}=m??{},E=n.validate(p,{strict:!1}),w=g.filter(_=>E?_.type==="function"||_.type==="error"?c(_)===n.slice(p,0,4):_.type==="event"?l(_)===p:!1:"name"in _&&_.name===p);if(w.length===0)throw new h({name:p});if(w.length===1)return{...w[0],...v?{hash:l(w[0])}:{}};let C;for(const _ of w){if(!("inputs"in _))continue;if(!b||b.length===0){if(!_.inputs||_.inputs.length===0)return{..._,...v?{hash:l(_)}:{}};continue}if(!_.inputs||_.inputs.length===0||_.inputs.length!==b.length)continue;if(b.every((A,T)=>{const O="inputs"in _&&_.inputs[T];return O?i.isArgOfType(A,O):!1})){if(C&&"inputs"in C&&C.inputs){const A=i.getAmbiguousTypes(_.inputs,C.inputs,b);if(A)throw new d({abiItem:_,type:A[0]},{abiItem:C,type:A[1]})}C=_}}const y=(()=>{if(C)return C;const[_,...x]=w;return{..._,overloads:x}})();if(!y)throw new h({name:p});return{...y,...v?{hash:l(y)}:{}}}function c(g){return n.slice(l(g),0,4)}function u(g){const p=typeof g=="string"?g:t.formatAbiItem(g);return i.normalizeSignature(p)}function l(g){return typeof g!="string"&&"hash"in g&&g.hash?g.hash:r.keccak256(n.fromString(u(g)))}class d extends e.BaseError{constructor(p,m){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${p.type}\` in \`${i.normalizeSignature(t.formatAbiItem(p.abiItem))}\`, and`,`\`${m.type}\` in \`${i.normalizeSignature(t.formatAbiItem(m.abiItem))}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.AmbiguityError"})}}di.AmbiguityError=d;class h extends e.BaseError{constructor({name:p,data:m,type:b="item"}){const v=p?` with name "${p}"`:m?` with data "${m}"`:"";super(`ABI ${b}${v} not found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.NotFoundError"})}}di.NotFoundError=h;class f extends e.BaseError{constructor({data:p}){super(`Selector size is invalid. Expected 4 bytes. Received ${n.size(p)} bytes ("${p}").`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.InvalidSelectorSizeError"})}}return di.InvalidSelectorSizeError=f,di}var jr={},Y={},Aq;function WX(){return Aq||(Aq=1,Object.defineProperty(Y,"__esModule",{value:!0}),Y.minInt120=Y.minInt112=Y.minInt104=Y.minInt96=Y.minInt88=Y.minInt80=Y.minInt72=Y.minInt64=Y.minInt56=Y.minInt48=Y.minInt40=Y.minInt32=Y.minInt24=Y.minInt16=Y.minInt8=Y.maxInt256=Y.maxInt248=Y.maxInt240=Y.maxInt232=Y.maxInt224=Y.maxInt216=Y.maxInt208=Y.maxInt200=Y.maxInt192=Y.maxInt184=Y.maxInt176=Y.maxInt168=Y.maxInt160=Y.maxInt152=Y.maxInt144=Y.maxInt136=Y.maxInt128=Y.maxInt120=Y.maxInt112=Y.maxInt104=Y.maxInt96=Y.maxInt88=Y.maxInt80=Y.maxInt72=Y.maxInt64=Y.maxInt56=Y.maxInt48=Y.maxInt40=Y.maxInt32=Y.maxInt24=Y.maxInt16=Y.maxInt8=Y.integerRegex=Y.bytesRegex=Y.arrayRegex=void 0,Y.maxUint256=Y.maxUint248=Y.maxUint240=Y.maxUint232=Y.maxUint224=Y.maxUint216=Y.maxUint208=Y.maxUint200=Y.maxUint192=Y.maxUint184=Y.maxUint176=Y.maxUint168=Y.maxUint160=Y.maxUint152=Y.maxUint144=Y.maxUint136=Y.maxUint128=Y.maxUint120=Y.maxUint112=Y.maxUint104=Y.maxUint96=Y.maxUint88=Y.maxUint80=Y.maxUint72=Y.maxUint64=Y.maxUint56=Y.maxUint48=Y.maxUint40=Y.maxUint32=Y.maxUint24=Y.maxUint16=Y.maxUint8=Y.minInt256=Y.minInt248=Y.minInt240=Y.minInt232=Y.minInt224=Y.minInt216=Y.minInt208=Y.minInt200=Y.minInt192=Y.minInt184=Y.minInt176=Y.minInt168=Y.minInt160=Y.minInt152=Y.minInt144=Y.minInt136=Y.minInt128=void 0,Y.arrayRegex=/^(.*)\[([0-9]*)\]$/,Y.bytesRegex=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Y.integerRegex=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,Y.maxInt8=2n**(8n-1n)-1n,Y.maxInt16=2n**(16n-1n)-1n,Y.maxInt24=2n**(24n-1n)-1n,Y.maxInt32=2n**(32n-1n)-1n,Y.maxInt40=2n**(40n-1n)-1n,Y.maxInt48=2n**(48n-1n)-1n,Y.maxInt56=2n**(56n-1n)-1n,Y.maxInt64=2n**(64n-1n)-1n,Y.maxInt72=2n**(72n-1n)-1n,Y.maxInt80=2n**(80n-1n)-1n,Y.maxInt88=2n**(88n-1n)-1n,Y.maxInt96=2n**(96n-1n)-1n,Y.maxInt104=2n**(104n-1n)-1n,Y.maxInt112=2n**(112n-1n)-1n,Y.maxInt120=2n**(120n-1n)-1n,Y.maxInt128=2n**(128n-1n)-1n,Y.maxInt136=2n**(136n-1n)-1n,Y.maxInt144=2n**(144n-1n)-1n,Y.maxInt152=2n**(152n-1n)-1n,Y.maxInt160=2n**(160n-1n)-1n,Y.maxInt168=2n**(168n-1n)-1n,Y.maxInt176=2n**(176n-1n)-1n,Y.maxInt184=2n**(184n-1n)-1n,Y.maxInt192=2n**(192n-1n)-1n,Y.maxInt200=2n**(200n-1n)-1n,Y.maxInt208=2n**(208n-1n)-1n,Y.maxInt216=2n**(216n-1n)-1n,Y.maxInt224=2n**(224n-1n)-1n,Y.maxInt232=2n**(232n-1n)-1n,Y.maxInt240=2n**(240n-1n)-1n,Y.maxInt248=2n**(248n-1n)-1n,Y.maxInt256=2n**(256n-1n)-1n,Y.minInt8=-(2n**(8n-1n)),Y.minInt16=-(2n**(16n-1n)),Y.minInt24=-(2n**(24n-1n)),Y.minInt32=-(2n**(32n-1n)),Y.minInt40=-(2n**(40n-1n)),Y.minInt48=-(2n**(48n-1n)),Y.minInt56=-(2n**(56n-1n)),Y.minInt64=-(2n**(64n-1n)),Y.minInt72=-(2n**(72n-1n)),Y.minInt80=-(2n**(80n-1n)),Y.minInt88=-(2n**(88n-1n)),Y.minInt96=-(2n**(96n-1n)),Y.minInt104=-(2n**(104n-1n)),Y.minInt112=-(2n**(112n-1n)),Y.minInt120=-(2n**(120n-1n)),Y.minInt128=-(2n**(128n-1n)),Y.minInt136=-(2n**(136n-1n)),Y.minInt144=-(2n**(144n-1n)),Y.minInt152=-(2n**(152n-1n)),Y.minInt160=-(2n**(160n-1n)),Y.minInt168=-(2n**(168n-1n)),Y.minInt176=-(2n**(176n-1n)),Y.minInt184=-(2n**(184n-1n)),Y.minInt192=-(2n**(192n-1n)),Y.minInt200=-(2n**(200n-1n)),Y.minInt208=-(2n**(208n-1n)),Y.minInt216=-(2n**(216n-1n)),Y.minInt224=-(2n**(224n-1n)),Y.minInt232=-(2n**(232n-1n)),Y.minInt240=-(2n**(240n-1n)),Y.minInt248=-(2n**(248n-1n)),Y.minInt256=-(2n**(256n-1n)),Y.maxUint8=2n**8n-1n,Y.maxUint16=2n**16n-1n,Y.maxUint24=2n**24n-1n,Y.maxUint32=2n**32n-1n,Y.maxUint40=2n**40n-1n,Y.maxUint48=2n**48n-1n,Y.maxUint56=2n**56n-1n,Y.maxUint64=2n**64n-1n,Y.maxUint72=2n**72n-1n,Y.maxUint80=2n**80n-1n,Y.maxUint88=2n**88n-1n,Y.maxUint96=2n**96n-1n,Y.maxUint104=2n**104n-1n,Y.maxUint112=2n**112n-1n,Y.maxUint120=2n**120n-1n,Y.maxUint128=2n**128n-1n,Y.maxUint136=2n**136n-1n,Y.maxUint144=2n**144n-1n,Y.maxUint152=2n**152n-1n,Y.maxUint160=2n**160n-1n,Y.maxUint168=2n**168n-1n,Y.maxUint176=2n**176n-1n,Y.maxUint184=2n**184n-1n,Y.maxUint192=2n**192n-1n,Y.maxUint200=2n**200n-1n,Y.maxUint208=2n**208n-1n,Y.maxUint216=2n**216n-1n,Y.maxUint224=2n**224n-1n,Y.maxUint232=2n**232n-1n,Y.maxUint240=2n**240n-1n,Y.maxUint248=2n**248n-1n,Y.maxUint256=2n**256n-1n),Y}var Br={},xq;function tPe(){if(xq)return Br;xq=1,Object.defineProperty(Br,"__esModule",{value:!0}),Br.decodeParameter=o,Br.decodeAddress=u,Br.decodeArray=l,Br.decodeBool=d,Br.decodeBytes=h,Br.decodeNumber=f,Br.decodeTuple=g,Br.decodeString=p,Br.prepareParameters=m,Br.prepareParameter=b,Br.encode=v,Br.encodeAddress=E,Br.encodeArray=w,Br.encodeBytes=C,Br.encodeBoolean=y,Br.encodeNumber=_,Br.encodeString=x,Br.encodeTuple=A,Br.getArrayComponents=T,Br.hasDynamicChild=O;const t=cR(),e=aR(),r=Hp(),n=cl(),i=pa(),s=WX();function o(k,j,N){const{checksumAddress:S,staticPosition:P}=N,I=T(j.type);if(I){const[B,$]=I;return l(k,{...j,type:$},{checksumAddress:S,length:B,staticPosition:P})}if(j.type==="tuple")return g(k,j,{checksumAddress:S,staticPosition:P});if(j.type==="address")return u(k,{checksum:S});if(j.type==="bool")return d(k);if(j.type.startsWith("bytes"))return h(k,j,{staticPosition:P});if(j.type.startsWith("uint")||j.type.startsWith("int"))return f(k,j);if(j.type==="string")return p(k,{staticPosition:P});throw new t.InvalidTypeError(j.type)}const a=32,c=32;function u(k,j={}){const{checksum:N=!1}=j,S=k.readBytes(32);return[(I=>N?e.checksum(I):I)(i.fromBytes(r.slice(S,-20))),32]}function l(k,j,N){const{checksumAddress:S,length:P,staticPosition:I}=N;if(!P){const R=r.toNumber(k.readBytes(c)),D=I+R,L=D+a;k.setPosition(D);const U=r.toNumber(k.readBytes(a)),z=O(j);let W=0;const K=[];for(let J=0;J48?r.toBigInt(P,{signed:N}):r.toNumber(P,{signed:N}),32]}function g(k,j,N){const{checksumAddress:S,staticPosition:P}=N,I=j.components.length===0||j.components.some(({name:R})=>!R),B=I?[]:{};let $=0;if(O(j)){const R=r.toNumber(k.readBytes(c)),D=P+R;for(let L=0;L0?i.concat(D,R):D}}if(B)return{dynamic:!0,encoded:R}}return{dynamic:!1,encoded:i.concat(...$.map(({encoded:R})=>R))}}function C(k,{type:j}){const[,N]=j.split("bytes"),S=i.size(k);if(!N){let P=k;return S%32!==0&&(P=i.padRight(P,Math.ceil((k.length-2)/2/32)*32)),{dynamic:!0,encoded:i.concat(i.padLeft(i.fromNumber(S,{size:32})),P)}}if(S!==Number.parseInt(N))throw new t.BytesSizeMismatchError({expectedSize:Number.parseInt(N),value:k});return{dynamic:!1,encoded:i.padRight(k)}}function y(k){if(typeof k!="boolean")throw new n.BaseError(`Invalid boolean value: "${k}" (type: ${typeof k}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:i.padLeft(i.fromBoolean(k))}}function _(k,{signed:j,size:N}){if(typeof N=="number"){const S=2n**(BigInt(N)-(j?1n:0n))-1n,P=j?-S-1n:0n;if(k>S||kB))}}function T(k){const j=k.match(/^(.*)\[(\d+)?\]$/);return j?[j[2]?Number(j[2]):null,j[1]]:void 0}function O(k){var S;const{type:j}=k;if(j==="string"||j==="bytes"||j.endsWith("[]"))return!0;if(j==="tuple")return(S=k.components)==null?void 0:S.some(O);const N=T(k.type);return!!(N&&O({...k,type:N[1]}))}return Br}var Aa={},Sq;function rPe(){if(Sq)return Aa;Sq=1,Object.defineProperty(Aa,"__esModule",{value:!0}),Aa.RecursiveReadLimitExceededError=Aa.PositionOutOfBoundsError=Aa.NegativeOffsetError=void 0,Aa.create=r;const t=cl(),e={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new s({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(o){if(o<0||o>this.bytes.length-1)throw new i({length:this.bytes.length,position:o})},decrementPosition(o){if(o<0)throw new n({offset:o});const a=this.position-o;this.assertPosition(a),this.position=a},getReadCount(o){return this.positionReadCount.get(o||this.position)||0},incrementPosition(o){if(o<0)throw new n({offset:o});const a=this.position+o;this.assertPosition(a),this.position=a},inspectByte(o){const a=o??this.position;return this.assertPosition(a),this.bytes[a]},inspectBytes(o,a){const c=a??this.position;return this.assertPosition(c+o-1),this.bytes.subarray(c,c+o)},inspectUint8(o){const a=o??this.position;return this.assertPosition(a),this.bytes[a]},inspectUint16(o){const a=o??this.position;return this.assertPosition(a+1),this.dataView.getUint16(a)},inspectUint24(o){const a=o??this.position;return this.assertPosition(a+2),(this.dataView.getUint16(a)<<8)+this.dataView.getUint8(a+2)},inspectUint32(o){const a=o??this.position;return this.assertPosition(a+3),this.dataView.getUint32(a)},pushByte(o){this.assertPosition(this.position),this.bytes[this.position]=o,this.position++},pushBytes(o){this.assertPosition(this.position+o.length-1),this.bytes.set(o,this.position),this.position+=o.length},pushUint8(o){this.assertPosition(this.position),this.bytes[this.position]=o,this.position++},pushUint16(o){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,o),this.position+=2},pushUint24(o){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,o>>8),this.dataView.setUint8(this.position+2,o&255),this.position+=3},pushUint32(o){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,o),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const o=this.inspectByte();return this.position++,o},readBytes(o,a){this.assertReadLimit(),this._touch();const c=this.inspectBytes(o);return this.position+=a??o,c},readUint8(){this.assertReadLimit(),this._touch();const o=this.inspectUint8();return this.position+=1,o},readUint16(){this.assertReadLimit(),this._touch();const o=this.inspectUint16();return this.position+=2,o},readUint24(){this.assertReadLimit(),this._touch();const o=this.inspectUint24();return this.position+=3,o},readUint32(){this.assertReadLimit(),this._touch();const o=this.inspectUint32();return this.position+=4,o},get remaining(){return this.bytes.length-this.position},setPosition(o){const a=this.position;return this.assertPosition(o),this.position=o,()=>this.position=a},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const o=this.getReadCount();this.positionReadCount.set(this.position,o+1),o>0&&this.recursiveReadCount++}};function r(o,{recursiveReadLimit:a=8192}={}){const c=Object.create(e);return c.bytes=o,c.dataView=new DataView(o.buffer,o.byteOffset,o.byteLength),c.positionReadCount=new Map,c.recursiveReadLimit=a,c}class n extends t.BaseError{constructor({offset:a}){super(`Offset \`${a}\` cannot be negative.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.NegativeOffsetError"})}}Aa.NegativeOffsetError=n;class i extends t.BaseError{constructor({length:a,position:c}){super(`Position \`${c}\` is out of bounds (\`0 < position < ${a}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.PositionOutOfBoundsError"})}}Aa.PositionOutOfBoundsError=i;class s extends t.BaseError{constructor({count:a,limit:c}){super(`Recursive read limit of \`${c}\` exceeded (recursive read count: \`${a}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.RecursiveReadLimitExceededError"})}}return Aa.RecursiveReadLimitExceededError=s,Aa}var Tq;function cR(){if(Tq)return jr;Tq=1,Object.defineProperty(jr,"__esModule",{value:!0}),jr.InvalidTypeError=jr.InvalidArrayError=jr.LengthMismatchError=jr.BytesSizeMismatchError=jr.ArrayLengthMismatchError=jr.ZeroDataError=jr.DataSizeTooSmallError=void 0,jr.decode=c,jr.encode=u,jr.encodePacked=l,jr.format=d,jr.from=h;const t=Kd(),e=aR(),r=Hp(),n=cl(),i=pa(),s=WX(),o=tPe(),a=rPe();function c(w,C,y={}){const{as:_="Array",checksumAddress:x=!1}=y,A=typeof C=="string"?r.fromHex(C):C,T=a.create(A);if(r.size(A)===0&&w.length>0)throw new g;if(r.size(A)&&r.size(A)<32)throw new f({data:typeof C=="string"?C:i.fromBytes(C),parameters:w,size:r.size(A)});let O=0;const k=_==="Array"?[]:{};for(let j=0;jd.type==="constructor");if(!l)throw new e.NotFoundError({name:"constructor"});return l}return Rl}var So={},Pq;function iPe(){if(Pq)return So;Pq=1,Object.defineProperty(So,"__esModule",{value:!0}),So.decodeData=i,So.decodeResult=s,So.encodeData=o,So.encodeResult=a,So.format=c,So.from=u,So.fromAbi=l,So.getSelector=d;const t=Kd(),e=zX(),r=cR(),n=pa();function i(h,f){const{overloads:g}=h;if(n.size(f)<4)throw new e.InvalidSelectorSizeError({data:f});if(h.inputs.length===0)return;const p=g?l([h,...g],f):h;if(!(n.size(f)<=4))return r.decode(p.inputs,n.slice(f,4))}function s(h,f,g={}){const p=r.decode(h.outputs,f,g);if(!(p&&Object.keys(p).length===0))return p&&Object.keys(p).length===1?Array.isArray(p)?p[0]:Object.values(p)[0]:p}function o(h,...f){const{overloads:g}=h,p=g?l([h,...g],h.name,{args:f[0]}):h,m=d(p),b=f.length>0?r.encode(p.inputs,f[0]):void 0;return b?n.concat(m,b):m}function a(h,f,g={}){const{as:p="Array"}=g,m=h.outputs.length===1?[f]:Array.isArray(f)?f:p==="Object"?Object.values(f):[f];return r.encode(h.outputs,m)}function c(h){return t.formatAbiItem(h)}function u(h,f={}){return e.from(h,f)}function l(h,f,g){const p=e.fromAbi(h,f,g);if(p.type!=="function")throw new e.NotFoundError({name:f,type:"function"});return p}function d(h){return e.getSelector(h)}return So}var ls={},Oq;function VX(){return Oq||(Oq=1,Object.defineProperty(ls,"__esModule",{value:!0}),ls.zeroAddress=ls.ethAddress=ls.entryPoint08Address=ls.entryPoint07Address=ls.entryPoint06Address=void 0,ls.entryPoint06Address="0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",ls.entryPoint07Address="0x0000000071727De22E5E9d8BAf0edAc6f37da032",ls.entryPoint08Address="0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",ls.ethAddress="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",ls.zeroAddress="0x0000000000000000000000000000000000000000"),ls}var Rq;function sPe(){if(Rq)return b5;Rq=1,Object.defineProperty(b5,"__esModule",{value:!0}),b5.simulateCalls=d;const t=nPe(),e=iPe(),r=sn(),n=VX(),i=hx(),s=_t(),o=Bs(),a=sR(),c=pX(),u=HX(),l="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function d(h,f){const{blockNumber:g,blockTag:p,calls:m,stateOverrides:b,traceAssetChanges:v,traceTransfers:E,validation:w}=f,C=f.account?(0,r.parseAccount)(f.account):void 0;if(v&&!C)throw new s.BaseError("`account` is required when `traceAssetChanges` is true");const y=C?t.encode(t.from("constructor(bytes, bytes)"),{bytecode:i.deploylessCallViaBytecodeBytecode,args:[l,e.encodeData(e.from("function getBalance(address)"),[C.address])]}):void 0,_=v?await Promise.all(f.calls.map(async ie=>{if(!ie.data&&!ie.abi)return;const{accessList:Ee}=await(0,c.createAccessList)(h,{account:C.address,...ie,data:ie.abi?(0,o.encodeFunctionData)(ie):ie.data});return Ee.map(({address:pe,storageKeys:ve})=>ve.length>0?pe:null)})).then(ie=>ie.flat().filter(Boolean)):[],x=b==null?void 0:b.map(ie=>ie.address===(C==null?void 0:C.address)?{...ie,nonce:0}:ie),A=await(0,u.simulateBlocks)(h,{blockNumber:g,blockTag:p,blocks:[...v?[{calls:[{data:y}],stateOverrides:b},{calls:_.map((ie,Ee)=>({abi:[e.from("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[C.address],to:ie,from:n.zeroAddress,nonce:Ee})),stateOverrides:[{address:n.zeroAddress,nonce:0}]}]:[],{calls:[...m,{}].map((ie,Ee)=>({...ie,from:C==null?void 0:C.address,nonce:Ee})),stateOverrides:x},...v?[{calls:[{data:y}]},{calls:_.map((ie,Ee)=>({abi:[e.from("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[C.address],to:ie,from:n.zeroAddress,nonce:Ee})),stateOverrides:[{address:n.zeroAddress,nonce:0}]},{calls:_.map((ie,Ee)=>({to:ie,abi:[e.from("function decimals() returns (uint256)")],functionName:"decimals",from:n.zeroAddress,nonce:Ee})),stateOverrides:[{address:n.zeroAddress,nonce:0}]},{calls:_.map((ie,Ee)=>({to:ie,abi:[e.from("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:n.zeroAddress,nonce:Ee})),stateOverrides:[{address:n.zeroAddress,nonce:0}]},{calls:_.map((ie,Ee)=>({to:ie,abi:[e.from("function symbol() returns (string)")],functionName:"symbol",from:n.zeroAddress,nonce:Ee})),stateOverrides:[{address:n.zeroAddress,nonce:0}]}]:[]],traceTransfers:E,validation:w}),T=v?A[2]:A[0],[O,k,,j,N,S,P,I]=v?A:[],{calls:B,...$}=T,R=B.slice(0,-1)??[],D=(O==null?void 0:O.calls)??[],L=(k==null?void 0:k.calls)??[],U=[...D,...L].map(ie=>ie.status==="success"?(0,a.hexToBigInt)(ie.data):null),z=(j==null?void 0:j.calls)??[],W=(N==null?void 0:N.calls)??[],K=[...z,...W].map(ie=>ie.status==="success"?(0,a.hexToBigInt)(ie.data):null),J=((S==null?void 0:S.calls)??[]).map(ie=>ie.status==="success"?ie.result:null),ne=((I==null?void 0:I.calls)??[]).map(ie=>ie.status==="success"?ie.result:null),ae=((P==null?void 0:P.calls)??[]).map(ie=>ie.status==="success"?ie.result:null),he=[];for(const[ie,Ee]of K.entries()){const pe=U[ie];if(typeof Ee!="bigint"||typeof pe!="bigint")continue;const ve=J[ie-1],je=ne[ie-1],rt=ae[ie-1],Ce=ie===0?{address:n.ethAddress,decimals:18,symbol:"ETH"}:{address:_[ie-1],decimals:rt||ve?Number(ve??1):void 0,symbol:je??void 0};he.some(fe=>fe.token.address===Ce.address)||he.push({token:Ce,value:{pre:pe,post:Ee,diff:Ee-pe}})}return{assetChanges:he,block:$,results:R}}return b5}var y5={},v5={},_5={},kq;function GX(){if(kq)return _5;kq=1,Object.defineProperty(_5,"__esModule",{value:!0}),_5.serializeSignature=n;const t=A2(),e=nn(),r=Tr();function n({r:i,s,to:o="hex",v:a,yParity:c}){const u=(()=>{if(c===0||c===1)return c;if(a&&(a===27n||a===28n||a>=35n))return a%2n===0n?1:0;throw new Error("Invalid `v` or `yParity` value")})(),l=`0x${new t.secp256k1.Signature((0,e.hexToBigInt)(i),(0,e.hexToBigInt)(s)).toCompactHex()}${u===0?"1b":"1c"}`;return o==="hex"?l:(0,r.hexToBytes)(l)}return _5}var Nq;function uR(){if(Nq)return v5;Nq=1,Object.defineProperty(v5,"__esModule",{value:!0}),v5.verifyHash=p;const t=rh(),e=hx(),r=Qd(),n=k2(),i=js(),s=fa(),o=ki(),a=ze(),c=ur(),u=sR(),l=Cx(),d=th(),h=rR(),f=GX(),g=N2();async function p(m,b){var O,k,j;const{address:v,factory:E,factoryData:w,hash:C,signature:y,universalSignatureVerifierAddress:_=(j=(k=(O=m.chain)==null?void 0:O.contracts)==null?void 0:k.universalSignatureVerifier)==null?void 0:j.address,...x}=b,A=(0,o.isHex)(y)?y:typeof y=="object"&&"r"in y&&"s"in y?(0,f.serializeSignature)(y):(0,a.bytesToHex)(y),T=await(async()=>!E&&!w||(0,l.isErc6492Signature)(A)?A:(0,h.serializeErc6492Signature)({address:E,data:w,signature:A}))();try{const N=_?{to:_,data:(0,u.encodeFunctionData)({abi:t.universalSignatureValidatorAbi,functionName:"isValidSig",args:[v,C,T]}),...x}:{data:(0,n.encodeDeployData)({abi:t.universalSignatureValidatorAbi,args:[v,C,T],bytecode:e.universalSignatureValidatorByteCode}),...x},{data:S}=await(0,c.getAction)(m,g.call,"call")(N);return(0,u.hexToBool)(S??"0x0")}catch(N){try{if((0,s.isAddressEqual)((0,i.getAddress)(v),await(0,d.recoverAddress)({hash:C,signature:y})))return!0}catch{}if(N instanceof r.CallExecutionError)return!1;throw N}}return v5}var $q;function oPe(){if($q)return y5;$q=1,Object.defineProperty(y5,"__esModule",{value:!0}),y5.verifyMessage=r;const t=D2(),e=uR();async function r(n,{address:i,message:s,factory:o,factoryData:a,signature:c,...u}){const l=(0,t.hashMessage)(s);return(0,e.verifyHash)(n,{address:i,factory:o,factoryData:a,hash:l,signature:c,...u})}return y5}var E5={},jq;function aPe(){if(jq)return E5;jq=1,Object.defineProperty(E5,"__esModule",{value:!0}),E5.verifyTypedData=r;const t=B2(),e=uR();async function r(n,i){const{address:s,factory:o,factoryData:a,signature:c,message:u,primaryType:l,types:d,domain:h,...f}=i,g=(0,t.hashTypedData)({message:u,primaryType:l,types:d,domain:h});return(0,e.verifyHash)(n,{address:s,factory:o,factoryData:a,hash:g,signature:c,...f})}return E5}var C5={},A5={},Bq;function KX(){if(Bq)return A5;Bq=1,Object.defineProperty(A5,"__esModule",{value:!0}),A5.watchBlockNumber=o;const t=nn(),e=ur(),r=qp(),n=A1(),i=Gn(),s=$2();function o(a,{emitOnBegin:c=!1,emitMissed:u=!1,onBlockNumber:l,onError:d,poll:h,pollingInterval:f=a.pollingInterval}){const g=typeof h<"u"?h:!(a.transport.type==="webSocket"||a.transport.type==="fallback"&&a.transport.transports[0].config.type==="webSocket");let p;return g?(()=>{const v=(0,i.stringify)(["watchBlockNumber",a.uid,c,u,f]);return(0,r.observe)(v,{onBlockNumber:l,onError:d},E=>(0,n.poll)(async()=>{var w;try{const C=await(0,e.getAction)(a,s.getBlockNumber,"getBlockNumber")({cacheTime:0});if(p){if(C===p)return;if(C-p>1&&u)for(let y=p+1n;yp)&&(E.onBlockNumber(C,p),p=C)}catch(C){(w=E.onError)==null||w.call(E,C)}},{emitOnBegin:c,interval:f}))})():(()=>{const v=(0,i.stringify)(["watchBlockNumber",a.uid,c,u]);return(0,r.observe)(v,{onBlockNumber:l,onError:d},E=>{let w=!0,C=()=>w=!1;return(async()=>{try{const y=(()=>{if(a.transport.type==="fallback"){const x=a.transport.transports.find(A=>A.config.type==="webSocket");return x?x.value:a.transport}return a.transport})(),{unsubscribe:_}=await y.subscribe({params:["newHeads"],onData(x){var T;if(!w)return;const A=(0,t.hexToBigInt)((T=x.result)==null?void 0:T.number);E.onBlockNumber(A,p),p=A},onError(x){var A;(A=E.onError)==null||A.call(E,x)}});C=_,w||C()}catch(y){d==null||d(y)}})(),()=>C()})})()}return A5}var Dq;function cPe(){if(Dq)return C5;Dq=1,Object.defineProperty(C5,"__esModule",{value:!0}),C5.waitForTransactionReceipt=d;const t=EO(),e=Ds(),r=ur(),n=qp(),i=kO(),s=HO(),o=Gn(),a=E1(),c=oR(),u=FX(),l=KX();async function d(h,{confirmations:f=1,hash:g,onReplaced:p,pollingInterval:m=h.pollingInterval,retryCount:b=6,retryDelay:v=({count:w})=>~~(1<{T(),A(),j(new e.WaitForTransactionReceiptTimeoutError({hash:g}))},E):void 0;return A=(0,n.observe)(w,{onReplaced:p,resolve:k,reject:j},S=>{T=(0,r.getAction)(h,l.watchBlockNumber,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:m,async onBlockNumber(P){const I=$=>{clearTimeout(N),T(),$(),A()};let B=P;if(!x)try{if(_){if(f>1&&(!_.blockNumber||B-_.blockNumber+1nS.resolve(_));return}if(C||(x=!0,await(0,s.withRetry)(async()=>{C=await(0,r.getAction)(h,c.getTransaction,"getTransaction")({hash:g}),C.blockNumber&&(B=C.blockNumber)},{delay:v,retryCount:b}),x=!1),_=await(0,r.getAction)(h,u.getTransactionReceipt,"getTransactionReceipt")({hash:g}),f>1&&(!_.blockNumber||B-_.blockNumber+1nS.resolve(_))}catch($){if($ instanceof e.TransactionNotFoundError||$ instanceof e.TransactionReceiptNotFoundError){if(!C){x=!1;return}try{y=C,x=!0;const R=await(0,s.withRetry)(()=>(0,r.getAction)(h,a.getBlock,"getBlock")({blockNumber:B,includeTransactions:!0}),{delay:v,retryCount:b,shouldRetry:({error:U})=>U instanceof t.BlockNotFoundError});x=!1;const D=R.transactions.find(({from:U,nonce:z})=>U===y.from&&z===y.nonce);if(!D||(_=await(0,r.getAction)(h,u.getTransactionReceipt,"getTransactionReceipt")({hash:D.hash}),f>1&&(!_.blockNumber||B-_.blockNumber+1n{var U;(U=S.onReplaced)==null||U.call(S,{reason:L,replacedTransaction:y,transaction:D,transactionReceipt:_}),S.resolve(_)})}catch(R){I(()=>S.reject(R))}}else I(()=>S.reject($))}}})}),O}return C5}var x5={},Mq;function uPe(){if(Mq)return x5;Mq=1,Object.defineProperty(x5,"__esModule",{value:!0}),x5.watchBlocks=s;const t=ur(),e=qp(),r=A1(),n=Gn(),i=E1();function s(o,{blockTag:a="latest",emitMissed:c=!1,emitOnBegin:u=!1,onBlock:l,onError:d,includeTransactions:h,poll:f,pollingInterval:g=o.pollingInterval}){const p=typeof f<"u"?f:!(o.transport.type==="webSocket"||o.transport.type==="fallback"&&o.transport.transports[0].config.type==="webSocket"),m=h??!1;let b;return p?(()=>{const w=(0,n.stringify)(["watchBlocks",o.uid,a,c,u,m,g]);return(0,e.observe)(w,{onBlock:l,onError:d},C=>(0,r.poll)(async()=>{var y;try{const _=await(0,t.getAction)(o,i.getBlock,"getBlock")({blockTag:a,includeTransactions:m});if(_.number!==null&&(b==null?void 0:b.number)!=null){if(_.number===b.number)return;if(_.number-b.number>1&&c)for(let x=(b==null?void 0:b.number)+1n;x<_.number;x++){const A=await(0,t.getAction)(o,i.getBlock,"getBlock")({blockNumber:x,includeTransactions:m});C.onBlock(A,b),b=A}}((b==null?void 0:b.number)==null||a==="pending"&&(_==null?void 0:_.number)==null||_.number!==null&&_.number>b.number)&&(C.onBlock(_,b),b=_)}catch(_){(y=C.onError)==null||y.call(C,_)}},{emitOnBegin:u,interval:g}))})():(()=>{let w=!0,C=!0,y=()=>w=!1;return(async()=>{try{u&&(0,t.getAction)(o,i.getBlock,"getBlock")({blockTag:a,includeTransactions:m}).then(A=>{w&&C&&(l(A,void 0),C=!1)}).catch(d);const _=(()=>{if(o.transport.type==="fallback"){const A=o.transport.transports.find(T=>T.config.type==="webSocket");return A?A.value:o.transport}return o.transport})(),{unsubscribe:x}=await _.subscribe({params:["newHeads"],async onData(A){if(!w)return;const T=await(0,t.getAction)(o,i.getBlock,"getBlock")({blockNumber:A.blockNumber,includeTransactions:m}).catch(()=>{});w&&(l(T,b),C=!1,b=T)},onError(A){d==null||d(A)}});y=x,w||y()}catch(_){d==null||d(_)}})(),()=>y()})()}return x5}var S5={},Lq;function lPe(){if(Lq)return S5;Lq=1,Object.defineProperty(S5,"__esModule",{value:!0}),S5.watchEvent=g;const t=Up(),e=qp(),r=A1(),n=Gn(),i=$r(),s=Xd(),o=P2(),a=ol(),c=ur(),u=gX(),l=$2(),d=fx(),h=IO(),f=px();function g(p,{address:m,args:b,batch:v=!0,event:E,events:w,fromBlock:C,onError:y,onLogs:_,poll:x,pollingInterval:A=p.pollingInterval,strict:T}){const O=typeof x<"u"?x:typeof C=="bigint"?!0:!(p.transport.type==="webSocket"||p.transport.type==="fallback"&&p.transport.transports[0].config.type==="webSocket"),k=T??!1;return O?(()=>{const S=(0,n.stringify)(["watchEvent",m,b,v,p.uid,E,A,C]);return(0,e.observe)(S,{onLogs:_,onError:y},P=>{let I;C!==void 0&&(I=C-1n);let B,$=!1;const R=(0,r.poll)(async()=>{var D;if(!$){try{B=await(0,c.getAction)(p,u.createEventFilter,"createEventFilter")({address:m,args:b,event:E,events:w,strict:k,fromBlock:C})}catch{}$=!0;return}try{let L;if(B)L=await(0,c.getAction)(p,d.getFilterChanges,"getFilterChanges")({filter:B});else{const U=await(0,c.getAction)(p,l.getBlockNumber,"getBlockNumber")({});I&&I!==U?L=await(0,c.getAction)(p,h.getLogs,"getLogs")({address:m,args:b,event:E,events:w,fromBlock:I+1n,toBlock:U}):L=[],I=U}if(L.length===0)return;if(v)P.onLogs(L);else for(const U of L)P.onLogs([U])}catch(L){B&&L instanceof s.InvalidInputRpcError&&($=!1),(D=P.onError)==null||D.call(P,L)}},{emitOnBegin:!0,interval:A});return async()=>{B&&await(0,c.getAction)(p,f.uninstallFilter,"uninstallFilter")({filter:B}),R()}})})():(()=>{let S=!0,P=()=>S=!1;return(async()=>{try{const I=(()=>{if(p.transport.type==="fallback"){const D=p.transport.transports.find(L=>L.config.type==="webSocket");return D?D.value:p.transport}return p.transport})(),B=w??(E?[E]:void 0);let $=[];B&&($=[B.flatMap(L=>(0,t.encodeEventTopics)({abi:[L],eventName:L.name,args:b}))],E&&($=$[0]));const{unsubscribe:R}=await I.subscribe({params:["logs",{address:m,topics:$}],onData(D){var U;if(!S)return;const L=D.result;try{const{eventName:z,args:W}=(0,o.decodeEventLog)({abi:B??[],data:L.data,topics:L.topics,strict:k}),K=(0,a.formatLog)(L,{args:W,eventName:z});_([K])}catch(z){let W,K;if(z instanceof i.DecodeLogDataMismatch||z instanceof i.DecodeLogTopicsMismatch){if(T)return;W=z.abiItem.name,K=(U=z.abiItem.inputs)==null?void 0:U.some(ne=>!("name"in ne&&ne.name))}const J=(0,a.formatLog)(L,{args:K?[]:{},eventName:W});_([J])}},onError(D){y==null||y(D)}});P=R,S||P()}catch(I){y==null||y(I)}})(),()=>P()})()}return S5}var T5={},Uq;function dPe(){if(Uq)return T5;Uq=1,Object.defineProperty(T5,"__esModule",{value:!0}),T5.watchPendingTransactions=a;const t=ur(),e=qp(),r=A1(),n=Gn(),i=mX(),s=fx(),o=px();function a(c,{batch:u=!0,onError:l,onTransactions:d,poll:h,pollingInterval:f=c.pollingInterval}){return(typeof h<"u"?h:c.transport.type!=="webSocket")?(()=>{const b=(0,n.stringify)(["watchPendingTransactions",c.uid,u,f]);return(0,e.observe)(b,{onTransactions:d,onError:l},v=>{let E;const w=(0,r.poll)(async()=>{var C;try{if(!E)try{E=await(0,t.getAction)(c,i.createPendingTransactionFilter,"createPendingTransactionFilter")({});return}catch(_){throw w(),_}const y=await(0,t.getAction)(c,s.getFilterChanges,"getFilterChanges")({filter:E});if(y.length===0)return;if(u)v.onTransactions(y);else for(const _ of y)v.onTransactions([_])}catch(y){(C=v.onError)==null||C.call(v,y)}},{emitOnBegin:!0,interval:f});return async()=>{E&&await(0,t.getAction)(c,o.uninstallFilter,"uninstallFilter")({filter:E}),w()}})})():(()=>{let b=!0,v=()=>b=!1;return(async()=>{try{const{unsubscribe:E}=await c.transport.subscribe({params:["newPendingTransactions"],onData(w){if(!b)return;const C=w.result;d([C])},onError(w){l==null||l(w)}});v=E,b||v()}catch(E){l==null||l(E)}})(),()=>v()})()}return T5}var I5={},P5={},Fq;function hPe(){if(Fq)return P5;Fq=1,Object.defineProperty(P5,"__esModule",{value:!0}),P5.parseSiweMessage=t;function t(n){var g,p,m;const{scheme:i,statement:s,...o}=((g=n.match(e))==null?void 0:g.groups)??{},{chainId:a,expirationTime:c,issuedAt:u,notBefore:l,requestId:d,...h}=((p=n.match(r))==null?void 0:p.groups)??{},f=(m=n.split("Resources:")[1])==null?void 0:m.split(` - `).slice(1);return{...o,...h,...a?{chainId:Number(a)}:{},...c?{expirationTime:new Date(c)}:{},...u?{issuedAt:new Date(u)}:{},...l?{notBefore:new Date(l)}:{},...d?{requestId:d}:{},...f?{resources:f}:{},...i?{scheme:i}:{},...s?{statement:s}:{}}}const e=/^(?:(?[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?
0x[a-fA-F0-9]{40})\n\n(?:(?.*)\n\n)?/,r=/(?:URI: (?.+))\n(?:Version: (?.+))\n(?:Chain ID: (?\d+))\n(?:Nonce: (?[a-zA-Z0-9]+))\n(?:Issued At: (?.+))(?:\nExpiration Time: (?.+))?(?:\nNot Before: (?.+))?(?:\nRequest ID: (?.+))?/;return P5}var O5={},Hq;function fPe(){if(Hq)return O5;Hq=1,Object.defineProperty(O5,"__esModule",{value:!0}),O5.validateSiweMessage=r;const t=is(),e=fa();function r(n){const{address:i,domain:s,message:o,nonce:a,scheme:c,time:u=new Date}=n;if(s&&o.domain!==s||a&&o.nonce!==a||c&&o.scheme!==c||o.expirationTime&&u>=o.expirationTime||o.notBefore&&u(0,s.call)(Ce,fe),createAccessList:fe=>(0,o.createAccessList)(Ce,fe),createBlockFilter:()=>(0,a.createBlockFilter)(Ce),createContractEventFilter:fe=>(0,c.createContractEventFilter)(Ce,fe),createEventFilter:fe=>(0,u.createEventFilter)(Ce,fe),createPendingTransactionFilter:()=>(0,l.createPendingTransactionFilter)(Ce),estimateContractGas:fe=>(0,d.estimateContractGas)(Ce,fe),estimateGas:fe=>(0,f.estimateGas)(Ce,fe),getBalance:fe=>(0,p.getBalance)(Ce,fe),getBlobBaseFee:()=>(0,m.getBlobBaseFee)(Ce),getBlock:fe=>(0,b.getBlock)(Ce,fe),getBlockNumber:fe=>(0,v.getBlockNumber)(Ce,fe),getBlockTransactionCount:fe=>(0,E.getBlockTransactionCount)(Ce,fe),getBytecode:fe=>(0,C.getCode)(Ce,fe),getChainId:()=>(0,w.getChainId)(Ce),getCode:fe=>(0,C.getCode)(Ce,fe),getContractEvents:fe=>(0,y.getContractEvents)(Ce,fe),getEip712Domain:fe=>(0,_.getEip712Domain)(Ce,fe),getEnsAddress:fe=>(0,t.getEnsAddress)(Ce,fe),getEnsAvatar:fe=>(0,e.getEnsAvatar)(Ce,fe),getEnsName:fe=>(0,r.getEnsName)(Ce,fe),getEnsResolver:fe=>(0,n.getEnsResolver)(Ce,fe),getEnsText:fe=>(0,i.getEnsText)(Ce,fe),getFeeHistory:fe=>(0,x.getFeeHistory)(Ce,fe),estimateFeesPerGas:fe=>(0,h.estimateFeesPerGas)(Ce,fe),getFilterChanges:fe=>(0,A.getFilterChanges)(Ce,fe),getFilterLogs:fe=>(0,T.getFilterLogs)(Ce,fe),getGasPrice:()=>(0,O.getGasPrice)(Ce),getLogs:fe=>(0,k.getLogs)(Ce,fe),getProof:fe=>(0,j.getProof)(Ce,fe),estimateMaxPriorityFeePerGas:fe=>(0,g.estimateMaxPriorityFeePerGas)(Ce,fe),getStorageAt:fe=>(0,N.getStorageAt)(Ce,fe),getTransaction:fe=>(0,S.getTransaction)(Ce,fe),getTransactionConfirmations:fe=>(0,P.getTransactionConfirmations)(Ce,fe),getTransactionCount:fe=>(0,I.getTransactionCount)(Ce,fe),getTransactionReceipt:fe=>(0,B.getTransactionReceipt)(Ce,fe),multicall:fe=>(0,$.multicall)(Ce,fe),prepareTransactionRequest:fe=>(0,ve.prepareTransactionRequest)(Ce,fe),readContract:fe=>(0,R.readContract)(Ce,fe),sendRawTransaction:fe=>(0,je.sendRawTransaction)(Ce,fe),simulate:fe=>(0,D.simulateBlocks)(Ce,fe),simulateBlocks:fe=>(0,D.simulateBlocks)(Ce,fe),simulateCalls:fe=>(0,L.simulateCalls)(Ce,fe),simulateContract:fe=>(0,U.simulateContract)(Ce,fe),verifyMessage:fe=>(0,W.verifyMessage)(Ce,fe),verifySiweMessage:fe=>(0,pe.verifySiweMessage)(Ce,fe),verifyTypedData:fe=>(0,K.verifyTypedData)(Ce,fe),uninstallFilter:fe=>(0,z.uninstallFilter)(Ce,fe),waitForTransactionReceipt:fe=>(0,J.waitForTransactionReceipt)(Ce,fe),watchBlocks:fe=>(0,ae.watchBlocks)(Ce,fe),watchBlockNumber:fe=>(0,ne.watchBlockNumber)(Ce,fe),watchContractEvent:fe=>(0,he.watchContractEvent)(Ce,fe),watchEvent:fe=>(0,ie.watchEvent)(Ce,fe),watchPendingTransactions:fe=>(0,Ee.watchPendingTransactions)(Ce,fe)}}return gE}var Wq;function gPe(){if(Wq)return pE;Wq=1,Object.defineProperty(pE,"__esModule",{value:!0}),pE.createPublicClient=r;const t=bx(),e=ZX();function r(n){const{key:i="public",name:s="Public Client"}=n;return(0,t.createClient)({...n,key:i,name:s,type:"publicClient"}).extend(e.publicActions)}return pE}var R5={},k5={},N5={},Vq;function mPe(){if(Vq)return N5;Vq=1,Object.defineProperty(N5,"__esModule",{value:!0}),N5.dropTransaction=t;async function t(e,{hash:r}){await e.request({method:`${e.mode}_dropTransaction`,params:[r]})}return N5}var $5={},Gq;function wPe(){if(Gq)return $5;Gq=1,Object.defineProperty($5,"__esModule",{value:!0}),$5.dumpState=t;async function t(e){return e.request({method:`${e.mode}_dumpState`})}return $5}var j5={},Kq;function bPe(){if(Kq)return j5;Kq=1,Object.defineProperty(j5,"__esModule",{value:!0}),j5.getAutomine=t;async function t(e){return e.mode==="ganache"?await e.request({method:"eth_mining"}):await e.request({method:`${e.mode}_getAutomine`})}return j5}var B5={},Zq;function yPe(){if(Zq)return B5;Zq=1,Object.defineProperty(B5,"__esModule",{value:!0}),B5.getTxpoolContent=t;async function t(e){return await e.request({method:"txpool_content"})}return B5}var D5={},Yq;function vPe(){if(Yq)return D5;Yq=1,Object.defineProperty(D5,"__esModule",{value:!0}),D5.getTxpoolStatus=e;const t=nn();async function e(r){const{pending:n,queued:i}=await r.request({method:"txpool_status"});return{pending:(0,t.hexToNumber)(n),queued:(0,t.hexToNumber)(i)}}return D5}var M5={},Jq;function _Pe(){if(Jq)return M5;Jq=1,Object.defineProperty(M5,"__esModule",{value:!0}),M5.impersonateAccount=t;async function t(e,{address:r}){await e.request({method:`${e.mode}_impersonateAccount`,params:[r]})}return M5}var L5={},Qq;function EPe(){if(Qq)return L5;Qq=1,Object.defineProperty(L5,"__esModule",{value:!0}),L5.increaseTime=e;const t=ze();async function e(r,{seconds:n}){return await r.request({method:"evm_increaseTime",params:[(0,t.numberToHex)(n)]})}return L5}var U5={},Xq;function CPe(){if(Xq)return U5;Xq=1,Object.defineProperty(U5,"__esModule",{value:!0}),U5.inspectTxpool=t;async function t(e){return await e.request({method:"txpool_inspect"})}return U5}var F5={},ez;function APe(){if(ez)return F5;ez=1,Object.defineProperty(F5,"__esModule",{value:!0}),F5.loadState=t;async function t(e,{state:r}){await e.request({method:`${e.mode}_loadState`,params:[r]})}return F5}var H5={},tz;function xPe(){if(tz)return H5;tz=1,Object.defineProperty(H5,"__esModule",{value:!0}),H5.mine=e;const t=ze();async function e(r,{blocks:n,interval:i}){r.mode==="ganache"?await r.request({method:"evm_mine",params:[{blocks:(0,t.numberToHex)(n)}]}):await r.request({method:`${r.mode}_mine`,params:[(0,t.numberToHex)(n),(0,t.numberToHex)(i||0)]})}return H5}var q5={},rz;function SPe(){if(rz)return q5;rz=1,Object.defineProperty(q5,"__esModule",{value:!0}),q5.removeBlockTimestampInterval=t;async function t(e){await e.request({method:`${e.mode}_removeBlockTimestampInterval`})}return q5}var z5={},nz;function TPe(){if(nz)return z5;nz=1,Object.defineProperty(z5,"__esModule",{value:!0}),z5.reset=t;async function t(e,{blockNumber:r,jsonRpcUrl:n}={}){await e.request({method:`${e.mode}_reset`,params:[{forking:{blockNumber:Number(r),jsonRpcUrl:n}}]})}return z5}var W5={},iz;function IPe(){if(iz)return W5;iz=1,Object.defineProperty(W5,"__esModule",{value:!0}),W5.revert=t;async function t(e,{id:r}){await e.request({method:"evm_revert",params:[r]})}return W5}var V5={},sz;function PPe(){if(sz)return V5;sz=1,Object.defineProperty(V5,"__esModule",{value:!0}),V5.sendUnsignedTransaction=r;const t=_1(),e=il();async function r(n,i){var w,C,y;const{accessList:s,data:o,from:a,gas:c,gasPrice:u,maxFeePerGas:l,maxPriorityFeePerGas:d,nonce:h,to:f,value:g,...p}=i,m=(y=(C=(w=n.chain)==null?void 0:w.formatters)==null?void 0:C.transactionRequest)==null?void 0:y.format,v=(m||e.formatTransactionRequest)({...(0,t.extract)(p,{format:m}),accessList:s,data:o,from:a,gas:c,gasPrice:u,maxFeePerGas:l,maxPriorityFeePerGas:d,nonce:h,to:f,value:g});return await n.request({method:"eth_sendUnsignedTransaction",params:[v]})}return V5}var G5={},oz;function OPe(){if(oz)return G5;oz=1,Object.defineProperty(G5,"__esModule",{value:!0}),G5.setAutomine=t;async function t(e,r){e.mode==="ganache"?r?await e.request({method:"miner_start"}):await e.request({method:"miner_stop"}):await e.request({method:"evm_setAutomine",params:[r]})}return G5}var K5={},az;function RPe(){if(az)return K5;az=1,Object.defineProperty(K5,"__esModule",{value:!0}),K5.setBalance=e;const t=ze();async function e(r,{address:n,value:i}){r.mode==="ganache"?await r.request({method:"evm_setAccountBalance",params:[n,(0,t.numberToHex)(i)]}):await r.request({method:`${r.mode}_setBalance`,params:[n,(0,t.numberToHex)(i)]})}return K5}var Z5={},cz;function kPe(){if(cz)return Z5;cz=1,Object.defineProperty(Z5,"__esModule",{value:!0}),Z5.setBlockGasLimit=e;const t=ze();async function e(r,{gasLimit:n}){await r.request({method:"evm_setBlockGasLimit",params:[(0,t.numberToHex)(n)]})}return Z5}var Y5={},uz;function NPe(){if(uz)return Y5;uz=1,Object.defineProperty(Y5,"__esModule",{value:!0}),Y5.setBlockTimestampInterval=t;async function t(e,{interval:r}){const n=e.mode==="hardhat"?r*1e3:r;await e.request({method:`${e.mode}_setBlockTimestampInterval`,params:[n]})}return Y5}var J5={},lz;function $Pe(){if(lz)return J5;lz=1,Object.defineProperty(J5,"__esModule",{value:!0}),J5.setCode=t;async function t(e,{address:r,bytecode:n}){e.mode==="ganache"?await e.request({method:"evm_setAccountCode",params:[r,n]}):await e.request({method:`${e.mode}_setCode`,params:[r,n]})}return J5}var Q5={},dz;function jPe(){if(dz)return Q5;dz=1,Object.defineProperty(Q5,"__esModule",{value:!0}),Q5.setCoinbase=t;async function t(e,{address:r}){await e.request({method:`${e.mode}_setCoinbase`,params:[r]})}return Q5}var X5={},hz;function BPe(){if(hz)return X5;hz=1,Object.defineProperty(X5,"__esModule",{value:!0}),X5.setIntervalMining=t;async function t(e,{interval:r}){const n=e.mode==="hardhat"?r*1e3:r;await e.request({method:"evm_setIntervalMining",params:[n]})}return X5}var e4={},fz;function DPe(){if(fz)return e4;fz=1,Object.defineProperty(e4,"__esModule",{value:!0}),e4.setLoggingEnabled=t;async function t(e,r){await e.request({method:`${e.mode}_setLoggingEnabled`,params:[r]})}return e4}var t4={},pz;function MPe(){if(pz)return t4;pz=1,Object.defineProperty(t4,"__esModule",{value:!0}),t4.setMinGasPrice=e;const t=ze();async function e(r,{gasPrice:n}){await r.request({method:`${r.mode}_setMinGasPrice`,params:[(0,t.numberToHex)(n)]})}return t4}var r4={},gz;function LPe(){if(gz)return r4;gz=1,Object.defineProperty(r4,"__esModule",{value:!0}),r4.setNextBlockBaseFeePerGas=e;const t=ze();async function e(r,{baseFeePerGas:n}){await r.request({method:`${r.mode}_setNextBlockBaseFeePerGas`,params:[(0,t.numberToHex)(n)]})}return r4}var n4={},mz;function UPe(){if(mz)return n4;mz=1,Object.defineProperty(n4,"__esModule",{value:!0}),n4.setNextBlockTimestamp=e;const t=ze();async function e(r,{timestamp:n}){await r.request({method:"evm_setNextBlockTimestamp",params:[(0,t.numberToHex)(n)]})}return n4}var i4={},wz;function FPe(){if(wz)return i4;wz=1,Object.defineProperty(i4,"__esModule",{value:!0}),i4.setNonce=e;const t=ze();async function e(r,{address:n,nonce:i}){await r.request({method:`${r.mode}_setNonce`,params:[n,(0,t.numberToHex)(i)]})}return i4}var s4={},bz;function HPe(){if(bz)return s4;bz=1,Object.defineProperty(s4,"__esModule",{value:!0}),s4.setRpcUrl=t;async function t(e,r){await e.request({method:`${e.mode}_setRpcUrl`,params:[r]})}return s4}var o4={},yz;function qPe(){if(yz)return o4;yz=1,Object.defineProperty(o4,"__esModule",{value:!0}),o4.setStorageAt=e;const t=ze();async function e(r,{address:n,index:i,value:s}){await r.request({method:`${r.mode}_setStorageAt`,params:[n,typeof i=="number"?(0,t.numberToHex)(i):i,s]})}return o4}var a4={},vz;function zPe(){if(vz)return a4;vz=1,Object.defineProperty(a4,"__esModule",{value:!0}),a4.snapshot=t;async function t(e){return await e.request({method:"evm_snapshot"})}return a4}var c4={},_z;function WPe(){if(_z)return c4;_z=1,Object.defineProperty(c4,"__esModule",{value:!0}),c4.stopImpersonatingAccount=t;async function t(e,{address:r}){await e.request({method:`${e.mode}_stopImpersonatingAccount`,params:[r]})}return c4}var Ez;function YX(){if(Ez)return k5;Ez=1,Object.defineProperty(k5,"__esModule",{value:!0}),k5.testActions=N;const t=mPe(),e=wPe(),r=bPe(),n=yPe(),i=vPe(),s=_Pe(),o=EPe(),a=CPe(),c=APe(),u=xPe(),l=SPe(),d=TPe(),h=IPe(),f=PPe(),g=OPe(),p=RPe(),m=kPe(),b=NPe(),v=$Pe(),E=jPe(),w=BPe(),C=DPe(),y=MPe(),_=LPe(),x=UPe(),A=FPe(),T=HPe(),O=qPe(),k=zPe(),j=WPe();function N({mode:S}){return P=>{const I=P.extend(()=>({mode:S}));return{dropTransaction:B=>(0,t.dropTransaction)(I,B),dumpState:()=>(0,e.dumpState)(I),getAutomine:()=>(0,r.getAutomine)(I),getTxpoolContent:()=>(0,n.getTxpoolContent)(I),getTxpoolStatus:()=>(0,i.getTxpoolStatus)(I),impersonateAccount:B=>(0,s.impersonateAccount)(I,B),increaseTime:B=>(0,o.increaseTime)(I,B),inspectTxpool:()=>(0,a.inspectTxpool)(I),loadState:B=>(0,c.loadState)(I,B),mine:B=>(0,u.mine)(I,B),removeBlockTimestampInterval:()=>(0,l.removeBlockTimestampInterval)(I),reset:B=>(0,d.reset)(I,B),revert:B=>(0,h.revert)(I,B),sendUnsignedTransaction:B=>(0,f.sendUnsignedTransaction)(I,B),setAutomine:B=>(0,g.setAutomine)(I,B),setBalance:B=>(0,p.setBalance)(I,B),setBlockGasLimit:B=>(0,m.setBlockGasLimit)(I,B),setBlockTimestampInterval:B=>(0,b.setBlockTimestampInterval)(I,B),setCode:B=>(0,v.setCode)(I,B),setCoinbase:B=>(0,E.setCoinbase)(I,B),setIntervalMining:B=>(0,w.setIntervalMining)(I,B),setLoggingEnabled:B=>(0,C.setLoggingEnabled)(I,B),setMinGasPrice:B=>(0,y.setMinGasPrice)(I,B),setNextBlockBaseFeePerGas:B=>(0,_.setNextBlockBaseFeePerGas)(I,B),setNextBlockTimestamp:B=>(0,x.setNextBlockTimestamp)(I,B),setNonce:B=>(0,A.setNonce)(I,B),setRpcUrl:B=>(0,T.setRpcUrl)(I,B),setStorageAt:B=>(0,O.setStorageAt)(I,B),snapshot:()=>(0,k.snapshot)(I),stopImpersonatingAccount:B=>(0,j.stopImpersonatingAccount)(I,B)}}}return k5}var Cz;function VPe(){if(Cz)return R5;Cz=1,Object.defineProperty(R5,"__esModule",{value:!0}),R5.createTestClient=r;const t=bx(),e=YX();function r(n){const{key:i="test",name:s="Test Client",mode:o}=n;return(0,t.createClient)({...n,key:i,name:s,type:"testClient"}).extend(c=>({mode:o,...(0,e.testActions)({mode:o})(c)}))}return R5}var u4={},l4={},Az;function GPe(){if(Az)return l4;Az=1,Object.defineProperty(l4,"__esModule",{value:!0}),l4.addChain=e;const t=ze();async function e(r,{chain:n}){const{id:i,name:s,nativeCurrency:o,rpcUrls:a,blockExplorers:c}=n;await r.request({method:"wallet_addEthereumChain",params:[{chainId:(0,t.numberToHex)(i),chainName:s,nativeCurrency:o,rpcUrls:a.default.http,blockExplorerUrls:c?Object.values(c).map(({url:u})=>u):void 0}]},{dedupe:!0,retryCount:0})}return l4}var d4={},xz;function KPe(){if(xz)return d4;xz=1,Object.defineProperty(d4,"__esModule",{value:!0}),d4.deployContract=r;const t=k2(),e=mx();function r(n,i){const{abi:s,args:o,bytecode:a,...c}=i,u=(0,t.encodeDeployData)({abi:s,args:o,bytecode:a});return(0,e.sendTransaction)(n,{...c,...c.authorizationList?{to:null}:{},data:u})}return d4}var h4={},Sz;function ZPe(){if(Sz)return h4;Sz=1,Object.defineProperty(h4,"__esModule",{value:!0}),h4.getAddresses=e;const t=js();async function e(r){var i;return((i=r.account)==null?void 0:i.type)==="local"?[r.account.address]:(await r.request({method:"eth_accounts"},{dedupe:!0})).map(s=>(0,t.checksumAddress)(s))}return h4}var f4={},Tz;function YPe(){if(Tz)return f4;Tz=1,Object.defineProperty(f4,"__esModule",{value:!0}),f4.getCapabilities=r;const t=sn(),e=ze();async function r(n,i={}){const{account:s=n.account,chainId:o}=i,a=s?(0,t.parseAccount)(s):void 0,c=o?[a==null?void 0:a.address,[(0,e.numberToHex)(o)]]:[a==null?void 0:a.address],u=await n.request({method:"wallet_getCapabilities",params:c}),l={};for(const[d,h]of Object.entries(u)){l[Number(d)]={};for(let[f,g]of Object.entries(h))f==="addSubAccount"&&(f="unstable_addSubAccount"),l[Number(d)][f]=g}return typeof o=="number"?l[o]:l}return f4}var p4={},Iz;function JPe(){if(Iz)return p4;Iz=1,Object.defineProperty(p4,"__esModule",{value:!0}),p4.getPermissions=t;async function t(e){return await e.request({method:"wallet_getPermissions"},{dedupe:!0})}return p4}var g4={},Pz;function JX(){if(Pz)return g4;Pz=1,Object.defineProperty(g4,"__esModule",{value:!0}),g4.prepareAuthorization=o;const t=sn(),e=zp(),r=fa(),n=ur(),i=C1(),s=ox();async function o(a,c){var p;const{account:u=a.account,chainId:l,nonce:d}=c;if(!u)throw new e.AccountNotFoundError({docsPath:"/docs/eip7702/prepareAuthorization"});const h=(0,t.parseAccount)(u),f=(()=>{if(c.executor)return c.executor==="self"?c.executor:(0,t.parseAccount)(c.executor)})(),g={address:c.contractAddress??c.address,chainId:l,nonce:d};return typeof g.chainId>"u"&&(g.chainId=((p=a.chain)==null?void 0:p.id)??await(0,n.getAction)(a,i.getChainId,"getChainId")({})),typeof g.nonce>"u"&&(g.nonce=await(0,n.getAction)(a,s.getTransactionCount,"getTransactionCount")({address:h.address,blockTag:"pending"}),(f==="self"||f!=null&&f.address&&(0,r.isAddressEqual)(f.address,h.address))&&(g.nonce+=1)),g}return g4}var m4={},Oz;function QPe(){if(Oz)return m4;Oz=1,Object.defineProperty(m4,"__esModule",{value:!0}),m4.requestAddresses=e;const t=js();async function e(r){return(await r.request({method:"eth_requestAccounts"},{dedupe:!0,retryCount:0})).map(i=>(0,t.getAddress)(i))}return m4}var w4={},Rz;function XPe(){if(Rz)return w4;Rz=1,Object.defineProperty(w4,"__esModule",{value:!0}),w4.requestPermissions=t;async function t(e,r){return e.request({method:"wallet_requestPermissions",params:[r]},{retryCount:0})}return w4}var b4={},kz;function e9e(){if(kz)return b4;kz=1,Object.defineProperty(b4,"__esModule",{value:!0}),b4.showCallsStatus=t;async function t(e,r){const{id:n}=r;await e.request({method:"wallet_showCallsStatus",params:[n]})}return b4}var y4={},Nz;function t9e(){if(Nz)return y4;Nz=1,Object.defineProperty(y4,"__esModule",{value:!0}),y4.signAuthorization=n;const t=sn(),e=zp(),r=JX();async function n(i,s){const{account:o=i.account}=s;if(!o)throw new e.AccountNotFoundError({docsPath:"/docs/eip7702/signAuthorization"});const a=(0,t.parseAccount)(o);if(!a.signAuthorization)throw new e.AccountTypeNotSupportedError({docsPath:"/docs/eip7702/signAuthorization",metaMessages:["The `signAuthorization` Action does not support JSON-RPC Accounts."],type:a.type});const c=await(0,r.prepareAuthorization)(i,s);return a.signAuthorization(c)}return y4}var v4={},$z;function r9e(){if($z)return v4;$z=1,Object.defineProperty(v4,"__esModule",{value:!0}),v4.signMessage=n;const t=sn(),e=zp(),r=ze();async function n(i,{account:s=i.account,message:o}){if(!s)throw new e.AccountNotFoundError({docsPath:"/docs/actions/wallet/signMessage"});const a=(0,t.parseAccount)(s);if(a.signMessage)return a.signMessage({message:o});const c=typeof o=="string"?(0,r.stringToHex)(o):o.raw instanceof Uint8Array?(0,r.toHex)(o.raw):o.raw;return i.request({method:"personal_sign",params:[c,a.address]},{retryCount:0})}return v4}var _4={},jz;function n9e(){if(jz)return _4;jz=1,Object.defineProperty(_4,"__esModule",{value:!0}),_4.signTransaction=c;const t=sn(),e=zp(),r=gx(),n=ze(),i=il(),s=ur(),o=sl(),a=C1();async function c(u,l){var v,E,w,C;const{account:d=u.account,chain:h=u.chain,...f}=l;if(!d)throw new e.AccountNotFoundError({docsPath:"/docs/actions/wallet/signTransaction"});const g=(0,t.parseAccount)(d);(0,o.assertRequest)({account:g,...l});const p=await(0,s.getAction)(u,a.getChainId,"getChainId")({});h!==null&&(0,r.assertCurrentChain)({currentChainId:p,chain:h});const m=(h==null?void 0:h.formatters)||((v=u.chain)==null?void 0:v.formatters),b=((E=m==null?void 0:m.transactionRequest)==null?void 0:E.format)||i.formatTransactionRequest;return g.signTransaction?g.signTransaction({...f,chainId:p},{serializer:(C=(w=u.chain)==null?void 0:w.serializers)==null?void 0:C.transaction}):await u.request({method:"eth_signTransaction",params:[{...b(f),chainId:(0,n.numberToHex)(p),from:g.address}]},{retryCount:0})}return _4}var E4={},Bz;function i9e(){if(Bz)return E4;Bz=1,Object.defineProperty(E4,"__esModule",{value:!0}),E4.signTypedData=n;const t=sn(),e=zp(),r=vx();async function n(i,s){const{account:o=i.account,domain:a,message:c,primaryType:u}=s;if(!o)throw new e.AccountNotFoundError({docsPath:"/docs/actions/wallet/signTypedData"});const l=(0,t.parseAccount)(o),d={EIP712Domain:(0,r.getTypesForEIP712Domain)({domain:a}),...s.types};if((0,r.validateTypedData)({domain:a,message:c,primaryType:u,types:d}),l.signTypedData)return l.signTypedData({domain:a,message:c,primaryType:u,types:d});const h=(0,r.serializeTypedData)({domain:a,message:c,primaryType:u,types:d});return i.request({method:"eth_signTypedData_v4",params:[l.address,h]},{retryCount:0})}return E4}var C4={},Dz;function s9e(){if(Dz)return C4;Dz=1,Object.defineProperty(C4,"__esModule",{value:!0}),C4.switchChain=e;const t=ze();async function e(r,{id:n}){await r.request({method:"wallet_switchEthereumChain",params:[{chainId:(0,t.numberToHex)(n)}]},{retryCount:0})}return C4}var A4={},Mz;function o9e(){if(Mz)return A4;Mz=1,Object.defineProperty(A4,"__esModule",{value:!0}),A4.watchAsset=t;async function t(e,r){return await e.request({method:"wallet_watchAsset",params:r},{retryCount:0})}return A4}var Lz;function QX(){if(Lz)return u4;Lz=1,Object.defineProperty(u4,"__esModule",{value:!0}),u4.walletActions=_;const t=C1(),e=GPe(),r=KPe(),n=ZPe(),i=sX(),s=YPe(),o=JPe(),a=JX(),c=dx(),u=QPe(),l=XPe(),d=iX(),h=FO(),f=mx(),g=e9e(),p=t9e(),m=r9e(),b=n9e(),v=i9e(),E=s9e(),w=oX(),C=o9e(),y=nX();function _(x){return{addChain:A=>(0,e.addChain)(x,A),deployContract:A=>(0,r.deployContract)(x,A),getAddresses:()=>(0,n.getAddresses)(x),getCallsStatus:A=>(0,i.getCallsStatus)(x,A),getCapabilities:A=>(0,s.getCapabilities)(x,A),getChainId:()=>(0,t.getChainId)(x),getPermissions:()=>(0,o.getPermissions)(x),prepareAuthorization:A=>(0,a.prepareAuthorization)(x,A),prepareTransactionRequest:A=>(0,c.prepareTransactionRequest)(x,A),requestAddresses:()=>(0,u.requestAddresses)(x),requestPermissions:A=>(0,l.requestPermissions)(x,A),sendCalls:A=>(0,d.sendCalls)(x,A),sendRawTransaction:A=>(0,h.sendRawTransaction)(x,A),sendTransaction:A=>(0,f.sendTransaction)(x,A),showCallsStatus:A=>(0,g.showCallsStatus)(x,A),signAuthorization:A=>(0,p.signAuthorization)(x,A),signMessage:A=>(0,m.signMessage)(x,A),signTransaction:A=>(0,b.signTransaction)(x,A),signTypedData:A=>(0,v.signTypedData)(x,A),switchChain:A=>(0,E.switchChain)(x,A),waitForCallsStatus:A=>(0,w.waitForCallsStatus)(x,A),watchAsset:A=>(0,C.watchAsset)(x,A),writeContract:A=>(0,y.writeContract)(x,A)}}return u4}var x4={},Uz;function a9e(){if(Uz)return x4;Uz=1,Object.defineProperty(x4,"__esModule",{value:!0}),x4.createWalletClient=r;const t=bx(),e=QX();function r(n){const{key:i="wallet",name:s="Wallet Client",transport:o}=n;return(0,t.createClient)({...n,key:i,name:s,transport:o,type:"walletClient"}).extend(e.walletActions)}return x4}var S4={},Fz;function c9e(){if(Fz)return S4;Fz=1,Object.defineProperty(S4,"__esModule",{value:!0}),S4.webSocket=s;const t=ha(),e=qO(),r=vX(),n=KO(),i=j2();function s(o,a={}){const{keepAlive:c,key:u="webSocket",methods:l,name:d="WebSocket JSON-RPC",reconnect:h,retryDelay:f}=a;return({chain:g,retryCount:p,timeout:m})=>{var C;const b=a.retryCount??p,v=m??a.timeout??1e4,E=o||((C=g==null?void 0:g.rpcUrls.default.webSocket)==null?void 0:C[0]),w={keepAlive:c,reconnect:h};if(!E)throw new e.UrlRequiredError;return(0,i.createTransport)({key:u,methods:l,name:d,async request({method:y,params:_}){const x={method:y,params:_},A=await(0,n.getWebSocketRpcClient)(E,w),{error:T,result:O}=await A.requestAsync({body:x,timeout:v});if(T)throw new t.RpcRequestError({body:x,error:T,url:E});return O},retryCount:b,retryDelay:f,timeout:v,type:"webSocket"},{getSocket(){return(0,r.getSocket)(E)},getRpcClient(){return(0,n.getWebSocketRpcClient)(E,w)},async subscribe({params:y,onData:_,onError:x}){const A=await(0,n.getWebSocketRpcClient)(E,w),{result:T}=await new Promise((O,k)=>A.request({body:{method:"eth_subscribe",params:y},onError(j){k(j),x==null||x(j)},onResponse(j){if(j.error){k(j.error),x==null||x(j.error);return}if(typeof j.id=="number"){O(j);return}j.method==="eth_subscription"&&_(j.params)}}));return{subscriptionId:T,async unsubscribe(){return new Promise(O=>A.request({body:{method:"eth_unsubscribe",params:[T]},onResponse:O}))}}}})}}return S4}var Jw={},Hz;function u9e(){if(Hz)return Jw;Hz=1,Object.defineProperty(Jw,"__esModule",{value:!0}),Jw.ProviderRpcError=void 0;class t extends Error{constructor(r,n){super(n),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=r,this.details=n}}return Jw.ProviderRpcError=t,Jw}var T4={},qz;function l9e(){if(qz)return T4;qz=1,Object.defineProperty(T4,"__esModule",{value:!0}),T4.decodeDeployData=n;const t=$r(),e=Jd(),r="/docs/contract/decodeDeployData";function n(i){const{abi:s,bytecode:o,data:a}=i;if(a===o)return{bytecode:o};const c=s.find(l=>"type"in l&&l.type==="constructor");if(!c)throw new t.AbiConstructorNotFoundError({docsPath:r});if(!("inputs"in c))throw new t.AbiConstructorParamsNotFoundError({docsPath:r});if(!c.inputs||c.inputs.length===0)throw new t.AbiConstructorParamsNotFoundError({docsPath:r});return{args:(0,e.decodeAbiParameters)(c.inputs,`0x${a.replace(o,"")}`),bytecode:o}}return T4}var I4={},zz;function d9e(){if(zz)return I4;zz=1,Object.defineProperty(I4,"__esModule",{value:!0}),I4.compactSignatureToSignature=r;const t=Tr(),e=ze();function r({r:n,yParityAndS:i}){const s=(0,t.hexToBytes)(i),o=s[0]&128?1:0,a=s;return o===1&&(a[0]&=127),{r:n,s:(0,e.bytesToHex)(a),yParity:o}}return I4}var P4={},Wz;function h9e(){if(Wz)return P4;Wz=1,Object.defineProperty(P4,"__esModule",{value:!0}),P4.parseCompactSignature=r;const t=A2(),e=ze();function r(n){const{r:i,s}=t.secp256k1.Signature.fromCompact(n.slice(2,130));return{r:(0,e.numberToHex)(i,{size:32}),yParityAndS:(0,e.numberToHex)(s,{size:32})}}return P4}var O4={},Vz;function f9e(){if(Vz)return O4;Vz=1,Object.defineProperty(O4,"__esModule",{value:!0}),O4.parseSignature=r;const t=A2(),e=ze();function r(n){const{r:i,s}=t.secp256k1.Signature.fromCompact(n.slice(2,130)),o=+`0x${n.slice(130)}`,[a,c]=(()=>{if(o===0||o===1)return[void 0,o];if(o===27)return[BigInt(o),0];if(o===28)return[BigInt(o),1];throw new Error("Invalid yParityOrV value")})();return typeof a<"u"?{r:(0,e.numberToHex)(i,{size:32}),s:(0,e.numberToHex)(s,{size:32}),v:a,yParity:c}:{r:(0,e.numberToHex)(i,{size:32}),s:(0,e.numberToHex)(s,{size:32}),yParity:c}}return O4}var R4={},Gz;function p9e(){if(Gz)return R4;Gz=1,Object.defineProperty(R4,"__esModule",{value:!0}),R4.recoverTransactionAddress=i;const t=ns(),e=iR(),r=Ex(),n=th();async function i(s){const{serializedTransaction:o,signature:a}=s,c=(0,e.parseTransaction)(o),u=a??{r:c.r,s:c.s,v:c.v,yParity:c.yParity},l=(0,r.serializeTransaction)({...c,r:void 0,s:void 0,v:void 0,yParity:void 0,sidecars:void 0});return await(0,n.recoverAddress)({hash:(0,t.keccak256)(l),signature:u})}return R4}var k4={},Kz;function g9e(){if(Kz)return k4;Kz=1,Object.defineProperty(k4,"__esModule",{value:!0}),k4.signatureToCompactSignature=r;const t=Tr(),e=ze();function r(n){const{r:i,s,v:o,yParity:a}=n,c=Number(a??o-27n);let u=s;if(c===1){const l=(0,t.hexToBytes)(s);l[0]|=128,u=(0,e.bytesToHex)(l)}return{r:i,yParityAndS:u}}return k4}var N4={},Zz;function m9e(){if(Zz)return N4;Zz=1,Object.defineProperty(N4,"__esModule",{value:!0}),N4.serializeCompactSignature=r;const t=A2(),e=nn();function r({r:n,yParityAndS:i}){return`0x${new t.secp256k1.Signature((0,e.hexToBigInt)(n),(0,e.hexToBigInt)(i)).toCompactHex()}`}return N4}var $4={},Yz;function w9e(){if(Yz)return $4;Yz=1,Object.defineProperty($4,"__esModule",{value:!0}),$4.sidecarsToVersionedHashes=e;const t=xO();function e(r){const{sidecars:n,version:i}=r,s=r.to??(typeof n[0].blob=="string"?"hex":"bytes"),o=[];for(const{commitment:a}of n)o.push((0,t.commitmentToVersionedHash)({commitment:a,to:s,version:i}));return o}return $4}var j4={},Jz;function b9e(){if(Jz)return j4;Jz=1,Object.defineProperty(j4,"__esModule",{value:!0}),j4.fromBlobs=n;const t=v2(),e=Tr(),r=ze();function n(i){const s=i.to??(typeof i.blobs[0]=="string"?"hex":"bytes"),o=typeof i.blobs[0]=="string"?i.blobs.map(d=>(0,e.hexToBytes)(d)):i.blobs,a=o.reduce((d,h)=>d+h.length,0),c=(0,t.createCursor)(new Uint8Array(a));let u=!0;for(const d of o){const h=(0,t.createCursor)(d);for(;u&&h.positiontypeof s=="object"?Object.keys(s).every(o=>!!Object.values(t.RestrictedMethods).includes(o)):!1)}}return Qw.Wallet=r,Qw}var iW;function E9e(){if(iW)return M4;iW=1,Object.defineProperty(M4,"__esModule",{value:!0});const t=tee(),e=eee(),r=(i,s)=>s.some(o=>o.parentCapability===i),n=()=>(i,s,o)=>{const a=o.value;return o.value=async function(){const c=new t.Wallet(this.communicator);let u=await c.getPermissions();if(r(s,u)||(u=await c.requestPermissions([{[s]:{}}])),!r(s,u))throw new e.PermissionsError("Permissions rejected",e.PERMISSIONS_REQUEST_REJECTED);return a.apply(this)},o};return M4.default=n,M4}var sW;function C9e(){if(sW)return Rc;sW=1;var t=Rc&&Rc.__decorate||function(u,l,d,h){var f=arguments.length,g=f<3?l:h===null?h=Object.getOwnPropertyDescriptor(l,d):h,p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(u,l,d,h);else for(var m=u.length-1;m>=0;m--)(p=u[m])&&(g=(f<3?p(g):f>3?p(l,d,g):p(l,d))||g);return f>3&&g&&Object.defineProperty(l,d,g),g},e=Rc&&Rc.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(Rc,"__esModule",{value:!0}),Rc.Safe=void 0;const r=v9e(),n=_9e(),i=Mp(),s=dO(),o=lO(),a=e(E9e());class c{constructor(l){this.communicator=l}async getChainInfo(){return(await this.communicator.send(i.Methods.getChainInfo,void 0)).data}async getInfo(){return(await this.communicator.send(i.Methods.getSafeInfo,void 0)).data}async experimental_getBalances({currency:l="usd"}={}){return(await this.communicator.send(i.Methods.getSafeBalances,{currency:l})).data}async check1271Signature(l,d="0x"){const h=await this.getInfo(),f=(0,r.encodeFunctionData)({abi:[{constant:!1,inputs:[{name:"_dataHash",type:"bytes32"},{name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{name:"",type:"bytes4"}],payable:!1,stateMutability:"nonpayable",type:"function"}],functionName:"isValidSignature",args:[l,d]}),g={call:s.RPC_CALLS.eth_call,params:[{to:h.safeAddress,data:f},"latest"]};try{return(await this.communicator.send(i.Methods.rpcCall,g)).data.slice(0,10).toLowerCase()===n.MAGIC_VALUE}catch{return!1}}async check1271SignatureBytes(l,d="0x"){const h=await this.getInfo(),f=(0,r.encodeFunctionData)({abi:[{constant:!1,inputs:[{name:"_data",type:"bytes"},{name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{name:"",type:"bytes4"}],payable:!1,stateMutability:"nonpayable",type:"function"}],functionName:"isValidSignature",args:[l,d]}),g={call:s.RPC_CALLS.eth_call,params:[{to:h.safeAddress,data:f},"latest"]};try{return(await this.communicator.send(i.Methods.rpcCall,g)).data.slice(0,10).toLowerCase()===n.MAGIC_VALUE_BYTES}catch{return!1}}calculateMessageHash(l){return(0,r.hashMessage)(l)}calculateTypedMessageHash(l){const d=typeof l.domain.chainId=="object"?l.domain.chainId.toNumber():Number(l.domain.chainId);let h=l.primaryType;if(!h){const f=Object.values(l.types),g=Object.keys(l.types).filter(p=>f.every(m=>m.every(({type:b})=>b.replace("[","").replace("]","")!==p)));if(g.length===0||g.length>1)throw new Error("Please specify primaryType");h=g[0]}return(0,r.hashTypedData)({message:l.message,domain:{...l.domain,chainId:d,verifyingContract:l.domain.verifyingContract,salt:l.domain.salt},types:l.types,primaryType:h})}async getOffChainSignature(l){return(await this.communicator.send(i.Methods.getOffChainSignature,l)).data}async isMessageSigned(l,d="0x"){let h;if(typeof l=="string"&&(h=async()=>{const f=this.calculateMessageHash(l);return await this.isMessageHashSigned(f,d)}),(0,o.isObjectEIP712TypedData)(l)&&(h=async()=>{const f=this.calculateTypedMessageHash(l);return await this.isMessageHashSigned(f,d)}),h)return await h();throw new Error("Invalid message type")}async isMessageHashSigned(l,d="0x"){const h=[this.check1271Signature.bind(this),this.check1271SignatureBytes.bind(this)];for(const f of h)if(await f(l,d))return!0;return!1}async getEnvironmentInfo(){return(await this.communicator.send(i.Methods.getEnvironmentInfo,void 0)).data}async requestAddressBook(){return(await this.communicator.send(i.Methods.requestAddressBook,void 0)).data}}return Rc.Safe=c,t([(0,a.default)()],c.prototype,"requestAddressBook",null),Rc}var oW;function aW(){if(oW)return g0;oW=1;var t=g0&&g0.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(g0,"__esModule",{value:!0});const e=t($Te()),r=QTe(),n=XTe(),i=C9e(),s=tee();class o{constructor(c={}){const{allowedDomains:u=null,debug:l=!1}=c;this.communicator=new e.default(u,l),this.eth=new n.Eth(this.communicator),this.txs=new r.TXs(this.communicator),this.safe=new i.Safe(this.communicator),this.wallet=new s.Wallet(this.communicator)}}return g0.default=o,g0}var cW;function A9e(){return cW||(cW=1,function(t){var e=Tc&&Tc.__createBinding||(Object.create?function(o,a,c,u){u===void 0&&(u=c);var l=Object.getOwnPropertyDescriptor(a,c);(!l||("get"in l?!a.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return a[c]}}),Object.defineProperty(o,u,l)}:function(o,a,c,u){u===void 0&&(u=c),o[u]=a[c]}),r=Tc&&Tc.__exportStar||function(o,a){for(var c in o)c!=="default"&&!Object.prototype.hasOwnProperty.call(a,c)&&e(a,o,c)},n=Tc&&Tc.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(t,"__esModule",{value:!0}),t.getSDKVersion=void 0;const i=n(aW());t.default=i.default,r(aW(),t),r(lO(),t),r(Mp(),t),r(CQ(),t);var s=EQ();Object.defineProperty(t,"getSDKVersion",{enumerable:!0,get:function(){return s.getSDKVersion}}),r(dO(),t)}(Tc)),Tc}var Nh={},uW;function x9e(){if(uW)return Nh;uW=1,Object.defineProperty(Nh,"__esModule",{value:!0}),Nh.numberToHex=Nh.getLowerCase=void 0;function t(r){return r&&r.toLowerCase()}Nh.getLowerCase=t;function e(r){return`0x${r.toString(16)}`}return Nh.numberToHex=e,Nh}var lW;function S9e(){if(lW)return X1;lW=1,Object.defineProperty(X1,"__esModule",{value:!0}),X1.SafeAppProvider=void 0;const t=A9e(),e=LV(),r=x9e();class n extends e.EventEmitter{constructor(s,o){super(),this.submittedTxs=new Map,this.safe=s,this.sdk=o}async connect(){this.emit("connect",{chainId:this.chainId})}async disconnect(){}get chainId(){return this.safe.chainId}async request(s){var c,u,l,d;const{method:o,params:a=[]}=s;switch(o){case"eth_accounts":return[this.safe.safeAddress];case"net_version":case"eth_chainId":return(0,r.numberToHex)(this.chainId);case"personal_sign":{const[m,b]=a;if(this.safe.safeAddress.toLowerCase()!==b.toLowerCase())throw new Error("The address or message hash is invalid");const v=await this.sdk.txs.signMessage(m);return("signature"in v?v.signature:void 0)||"0x"}case"eth_sign":{const[m,b]=a;if(this.safe.safeAddress.toLowerCase()!==m.toLowerCase()||!b.startsWith("0x"))throw new Error("The address or message hash is invalid");const v=await this.sdk.txs.signMessage(b);return("signature"in v?v.signature:void 0)||"0x"}case"eth_signTypedData":case"eth_signTypedData_v4":{const[m,b]=a,v=typeof b=="string"?JSON.parse(b):b;if(this.safe.safeAddress.toLowerCase()!==m.toLowerCase())throw new Error("The address is invalid");const E=await this.sdk.txs.signTypedMessage(v);return("signature"in E?E.signature:void 0)||"0x"}case"eth_sendTransaction":const h={...a[0],value:a[0].value||"0",data:a[0].data||"0x"};typeof h.gas=="string"&&h.gas.startsWith("0x")&&(h.gas=parseInt(h.gas,16));const f=await this.sdk.txs.send({txs:[h],params:{safeTxGas:h.gas}});return this.submittedTxs.set(f.safeTxHash,{from:this.safe.safeAddress,hash:f.safeTxHash,gas:0,gasPrice:"0x00",nonce:0,input:h.data,value:h.value,to:h.to,blockHash:null,blockNumber:null,transactionIndex:null}),f.safeTxHash;case"eth_blockNumber":return(await this.sdk.eth.getBlockByNumber(["latest"])).number;case"eth_getBalance":return this.sdk.eth.getBalance([(0,r.getLowerCase)(a[0]),a[1]]);case"eth_getCode":return this.sdk.eth.getCode([(0,r.getLowerCase)(a[0]),a[1]]);case"eth_getTransactionCount":return this.sdk.eth.getTransactionCount([(0,r.getLowerCase)(a[0]),a[1]]);case"eth_getStorageAt":return this.sdk.eth.getStorageAt([(0,r.getLowerCase)(a[0]),a[1],a[2]]);case"eth_getBlockByNumber":return this.sdk.eth.getBlockByNumber([a[0],a[1]]);case"eth_getBlockByHash":return this.sdk.eth.getBlockByHash([a[0],a[1]]);case"eth_getTransactionByHash":let p=a[0];try{p=(await this.sdk.txs.getBySafeTxHash(p)).txHash||p}catch{}return this.submittedTxs.has(p)?this.submittedTxs.get(p):this.sdk.eth.getTransactionByHash([p]).then(m=>(m&&(m.hash=a[0]),m));case"eth_getTransactionReceipt":{let m=a[0];try{m=(await this.sdk.txs.getBySafeTxHash(m)).txHash||m}catch{}return this.sdk.eth.getTransactionReceipt([m]).then(b=>(b&&(b.transactionHash=a[0]),b))}case"eth_estimateGas":return this.sdk.eth.getEstimateGas(a[0]);case"eth_call":return this.sdk.eth.call([a[0],a[1]]);case"eth_getLogs":return this.sdk.eth.getPastLogs([a[0]]);case"eth_gasPrice":return this.sdk.eth.getGasPrice();case"wallet_getPermissions":return this.sdk.wallet.getPermissions();case"wallet_requestPermissions":return this.sdk.wallet.requestPermissions(a[0]);case"safe_setSettings":return this.sdk.eth.setSafeSettings([a[0]]);case"wallet_sendCalls":{const{from:m,calls:b,chainId:v}=a[0];if(v!==(0,r.numberToHex)(this.chainId))throw new Error(`Safe is not on chain ${v}`);if(m!==this.safe.safeAddress)throw Error("Invalid from address");const E=b.map((y,_)=>{if(!y.to)throw new Error(`Invalid call #${_}: missing "to" field`);return{to:y.to,data:y.data??"0x",value:y.value??(0,r.numberToHex)(0)}}),{safeTxHash:w}=await this.sdk.txs.send({txs:E});return{id:w}}case"wallet_getCallsStatus":{const m=a[0],b={[t.TransactionStatus.AWAITING_CONFIRMATIONS]:100,[t.TransactionStatus.AWAITING_EXECUTION]:100,[t.TransactionStatus.SUCCESS]:200,[t.TransactionStatus.CANCELLED]:400,[t.TransactionStatus.FAILED]:500},v=await this.sdk.txs.getBySafeTxHash(m),E={version:"1.0",id:m,chainId:(0,r.numberToHex)(this.chainId),status:b[v.txStatus]};if(!v.txHash)return E;const w=await this.sdk.eth.getTransactionReceipt([v.txHash]);if(!w)return E;const C=((u=(c=v.txData)==null?void 0:c.dataDecoded)==null?void 0:u.method)!=="multiSend"?1:((d=(l=v.txData.dataDecoded.parameters)==null?void 0:l[0].valueDecoded)==null?void 0:d.length)??1,y=Number(w.blockNumber),_=Number(w.gasUsed);return E.receipts=Array(C).fill({logs:w.logs,status:(0,r.numberToHex)(v.txStatus===t.TransactionStatus.SUCCESS?1:0),blockHash:w.blockHash,blockNumber:(0,r.numberToHex)(y),gasUsed:(0,r.numberToHex)(_),transactionHash:v.txHash}),E}case"wallet_showCallsStatus":throw new Error(`"${s.method}" not supported`);case"wallet_getCapabilities":return{[(0,r.numberToHex)(this.chainId)]:{atomicBatch:{supported:!0}}};default:throw Error(`"${s.method}" not implemented`)}}send(s,o){s||o("Undefined request"),this.request(s).then(a=>o(null,{jsonrpc:"2.0",id:s.id,result:a})).catch(a=>o(a,null))}}return X1.SafeAppProvider=n,X1}var dW;function T9e(){return dW||(dW=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.SafeAppProvider=void 0;var e=S9e();Object.defineProperty(t,"SafeAppProvider",{enumerable:!0,get:function(){return e.SafeAppProvider}})}(cT)),cT}var I9e=T9e();class P9e extends I9e.SafeAppProvider{request(e){return e.method==="eth_requestAccounts"?this.request({method:"eth_accounts",params:[]}):super.request(e)}}const O9e=Object.freeze(Object.defineProperty({__proto__:null,SafeProvider:P9e},Symbol.toStringTag,{value:"Module"})),ree=()=>"9.1.0",R9e=t=>t.toString(16).padStart(2,"0"),k9e=t=>{const e=new Uint8Array(t/2);return window.crypto.getRandomValues(e),Array.from(e,R9e).join("")},N9e=()=>typeof window<"u"?k9e(10):new Date().getTime().toString(36);class M2{}M2.makeRequest=(t,e)=>({id:N9e(),method:t,params:e,env:{sdkVersion:ree()}});M2.makeResponse=(t,e,r)=>({id:t,success:!0,version:r,data:e});M2.makeErrorResponse=(t,e,r)=>({id:t,success:!1,error:e,version:r});var Cn;(function(t){t.sendTransactions="sendTransactions",t.rpcCall="rpcCall",t.getChainInfo="getChainInfo",t.getSafeInfo="getSafeInfo",t.getTxBySafeTxHash="getTxBySafeTxHash",t.getSafeBalances="getSafeBalances",t.signMessage="signMessage",t.signTypedMessage="signTypedMessage",t.getEnvironmentInfo="getEnvironmentInfo",t.getOffChainSignature="getOffChainSignature",t.requestAddressBook="requestAddressBook",t.wallet_getPermissions="wallet_getPermissions",t.wallet_requestPermissions="wallet_requestPermissions"})(Cn||(Cn={}));var R6;(function(t){t.requestAddressBook="requestAddressBook"})(R6||(R6={}));class $9e{constructor(e=null,r=!1){this.allowedOrigins=null,this.callbacks=new Map,this.debugMode=!1,this.isServer=typeof window>"u",this.isValidMessage=({origin:n,data:i,source:s})=>{const o=!i,a=!this.isServer&&s===window.parent,c=typeof i.version<"u"&&parseInt(i.version.split(".")[0]),u=typeof c=="number"&&c>=1;let l=!0;return Array.isArray(this.allowedOrigins)&&(l=this.allowedOrigins.find(d=>d.test(n))!==void 0),!o&&a&&u&&l},this.logIncomingMessage=n=>{console.info(`Safe Apps SDK v1: A message was received from origin ${n.origin}. `,n.data)},this.onParentMessage=n=>{this.isValidMessage(n)&&(this.debugMode&&this.logIncomingMessage(n),this.handleIncomingMessage(n.data))},this.handleIncomingMessage=n=>{const{id:i}=n,s=this.callbacks.get(i);s&&(s(n),this.callbacks.delete(i))},this.send=(n,i)=>{const s=M2.makeRequest(n,i);if(this.isServer)throw new Error("Window doesn't exist");return window.parent.postMessage(s,"*"),new Promise((o,a)=>{this.callbacks.set(s.id,c=>{if(!c.success){a(new Error(c.error));return}o(c)})})},this.allowedOrigins=e,this.debugMode=r,this.isServer||window.addEventListener("message",this.onParentMessage)}}const lR=t=>typeof t=="object"&&t!=null&&"domain"in t&&"types"in t&&"message"in t;AQ();class j9e{constructor(e){this.communicator=e}async getBySafeTxHash(e){if(!e)throw new Error("Invalid safeTxHash");return(await this.communicator.send(Cn.getTxBySafeTxHash,{safeTxHash:e})).data}async signMessage(e){const r={message:e};return(await this.communicator.send(Cn.signMessage,r)).data}async signTypedMessage(e){if(!lR(e))throw new Error("Invalid typed data");return(await this.communicator.send(Cn.signTypedMessage,{typedData:e})).data}async send({txs:e,params:r}){if(!e||!e.length)throw new Error("No transactions were passed");const n={txs:e,params:r};return(await this.communicator.send(Cn.sendTransactions,n)).data}}const Yn={eth_call:"eth_call",eth_gasPrice:"eth_gasPrice",eth_getLogs:"eth_getLogs",eth_getBalance:"eth_getBalance",eth_getCode:"eth_getCode",eth_getBlockByHash:"eth_getBlockByHash",eth_getBlockByNumber:"eth_getBlockByNumber",eth_getStorageAt:"eth_getStorageAt",eth_getTransactionByHash:"eth_getTransactionByHash",eth_getTransactionReceipt:"eth_getTransactionReceipt",eth_getTransactionCount:"eth_getTransactionCount",eth_estimateGas:"eth_estimateGas",safe_setSettings:"safe_setSettings"},Wc={defaultBlockParam:(t="latest")=>t,returnFullTxObjectParam:(t=!1)=>t,blockNumberToHex:t=>Number.isInteger(t)?`0x${t.toString(16)}`:t};class B9e{constructor(e){this.communicator=e,this.call=this.buildRequest({call:Yn.eth_call,formatters:[null,Wc.defaultBlockParam]}),this.getBalance=this.buildRequest({call:Yn.eth_getBalance,formatters:[null,Wc.defaultBlockParam]}),this.getCode=this.buildRequest({call:Yn.eth_getCode,formatters:[null,Wc.defaultBlockParam]}),this.getStorageAt=this.buildRequest({call:Yn.eth_getStorageAt,formatters:[null,Wc.blockNumberToHex,Wc.defaultBlockParam]}),this.getPastLogs=this.buildRequest({call:Yn.eth_getLogs}),this.getBlockByHash=this.buildRequest({call:Yn.eth_getBlockByHash,formatters:[null,Wc.returnFullTxObjectParam]}),this.getBlockByNumber=this.buildRequest({call:Yn.eth_getBlockByNumber,formatters:[Wc.blockNumberToHex,Wc.returnFullTxObjectParam]}),this.getTransactionByHash=this.buildRequest({call:Yn.eth_getTransactionByHash}),this.getTransactionReceipt=this.buildRequest({call:Yn.eth_getTransactionReceipt}),this.getTransactionCount=this.buildRequest({call:Yn.eth_getTransactionCount,formatters:[null,Wc.defaultBlockParam]}),this.getGasPrice=this.buildRequest({call:Yn.eth_gasPrice}),this.getEstimateGas=r=>this.buildRequest({call:Yn.eth_estimateGas})([r]),this.setSafeSettings=this.buildRequest({call:Yn.safe_setSettings})}buildRequest(e){const{call:r,formatters:n}=e;return async i=>{n&&Array.isArray(i)&&n.forEach((a,c)=>{a&&(i[c]=a(i[c]))});const s={call:r,params:i||[]};return(await this.communicator.send(Cn.rpcCall,s)).data}}}const D9e="0x1626ba7e",M9e="0x20c13b0b",f9=4001;class ov extends Error{constructor(e,r,n){super(e),this.code=r,this.data=n,Object.setPrototypeOf(this,ov.prototype)}}class nee{constructor(e){this.communicator=e}async getPermissions(){return(await this.communicator.send(Cn.wallet_getPermissions,void 0)).data}async requestPermissions(e){if(!this.isPermissionRequestValid(e))throw new ov("Permissions request is invalid",f9);try{return(await this.communicator.send(Cn.wallet_requestPermissions,e)).data}catch{throw new ov("Permissions rejected",f9)}}isPermissionRequestValid(e){return e.every(r=>typeof r=="object"?Object.keys(r).every(n=>!!Object.values(R6).includes(n)):!1)}}const hW=(t,e)=>e.some(r=>r.parentCapability===t),L9e=()=>(t,e,r)=>{const n=r.value;return r.value=async function(){const i=new nee(this.communicator);let s=await i.getPermissions();if(hW(e,s)||(s=await i.requestPermissions([{[e]:{}}])),!hW(e,s))throw new ov("Permissions rejected",f9);return n.apply(this)},r};var U9e=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};class iee{constructor(e){this.communicator=e}async getChainInfo(){return(await this.communicator.send(Cn.getChainInfo,void 0)).data}async getInfo(){return(await this.communicator.send(Cn.getSafeInfo,void 0)).data}async experimental_getBalances({currency:e="usd"}={}){return(await this.communicator.send(Cn.getSafeBalances,{currency:e})).data}async check1271Signature(e,r="0x"){const n=await this.getInfo(),i=ek({abi:[{constant:!1,inputs:[{name:"_dataHash",type:"bytes32"},{name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{name:"",type:"bytes4"}],payable:!1,stateMutability:"nonpayable",type:"function"}],functionName:"isValidSignature",args:[e,r]}),s={call:Yn.eth_call,params:[{to:n.safeAddress,data:i},"latest"]};try{return(await this.communicator.send(Cn.rpcCall,s)).data.slice(0,10).toLowerCase()===D9e}catch{return!1}}async check1271SignatureBytes(e,r="0x"){const n=await this.getInfo(),i=ek({abi:[{constant:!1,inputs:[{name:"_data",type:"bytes"},{name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{name:"",type:"bytes4"}],payable:!1,stateMutability:"nonpayable",type:"function"}],functionName:"isValidSignature",args:[e,r]}),s={call:Yn.eth_call,params:[{to:n.safeAddress,data:i},"latest"]};try{return(await this.communicator.send(Cn.rpcCall,s)).data.slice(0,10).toLowerCase()===M9e}catch{return!1}}calculateMessageHash(e){return Pie(e)}calculateTypedMessageHash(e){const r=typeof e.domain.chainId=="object"?e.domain.chainId.toNumber():Number(e.domain.chainId);let n=e.primaryType;if(!n){const i=Object.values(e.types),s=Object.keys(e.types).filter(o=>i.every(a=>a.every(({type:c})=>c.replace("[","").replace("]","")!==o)));if(s.length===0||s.length>1)throw new Error("Please specify primaryType");n=s[0]}return vie({message:e.message,domain:{...e.domain,chainId:r,verifyingContract:e.domain.verifyingContract,salt:e.domain.salt},types:e.types,primaryType:n})}async getOffChainSignature(e){return(await this.communicator.send(Cn.getOffChainSignature,e)).data}async isMessageSigned(e,r="0x"){let n;if(typeof e=="string"&&(n=async()=>{const i=this.calculateMessageHash(e);return await this.isMessageHashSigned(i,r)}),lR(e)&&(n=async()=>{const i=this.calculateTypedMessageHash(e);return await this.isMessageHashSigned(i,r)}),n)return await n();throw new Error("Invalid message type")}async isMessageHashSigned(e,r="0x"){const n=[this.check1271Signature.bind(this),this.check1271SignatureBytes.bind(this)];for(const i of n)if(await i(e,r))return!0;return!1}async getEnvironmentInfo(){return(await this.communicator.send(Cn.getEnvironmentInfo,void 0)).data}async requestAddressBook(){return(await this.communicator.send(Cn.requestAddressBook,void 0)).data}}U9e([L9e()],iee.prototype,"requestAddressBook",null);class F9e{constructor(e={}){const{allowedDomains:r=null,debug:n=!1}=e;this.communicator=new $9e(r,n),this.eth=new B9e(this.communicator),this.txs=new j9e(this.communicator),this.safe=new iee(this.communicator),this.wallet=new nee(this.communicator)}}const H9e=Object.freeze(Object.defineProperty({__proto__:null,MessageFormatter:M2,get Methods(){return Cn},RPC_CALLS:Yn,get RestrictedMethods(){return R6},default:F9e,getSDKVersion:ree,isObjectEIP712TypedData:lR},Symbol.toStringTag,{value:"Module"}));class ac{constructor(e,r){this.scope=e,this.module=r}storeObject(e,r){this.setItem(e,JSON.stringify(r))}loadObject(e){const r=this.getItem(e);return r?JSON.parse(r):void 0}setItem(e,r){localStorage.setItem(this.scopedKey(e),r)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),r=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new ac("CBWSDK").clear(),new ac("walletlink").clear()}}const Wr={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901,unsupportedChain:4902}},p9={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}},see="Unspecified error message.",q9e="Unspecified server error.";function dR(t,e=see){if(t&&Number.isInteger(t)){const r=t.toString();if(g9(p9,r))return p9[r].message;if(oee(t))return q9e}return e}function z9e(t){if(!Number.isInteger(t))return!1;const e=t.toString();return!!(p9[e]||oee(t))}function W9e(t,{shouldIncludeStack:e=!1}={}){const r={};if(t&&typeof t=="object"&&!Array.isArray(t)&&g9(t,"code")&&z9e(t.code)){const n=t;r.code=n.code,n.message&&typeof n.message=="string"?(r.message=n.message,g9(n,"data")&&(r.data=n.data)):(r.message=dR(r.code),r.data={originalError:fW(t)})}else r.code=Wr.rpc.internal,r.message=pW(t,"message")?t.message:see,r.data={originalError:fW(t)};return e&&(r.stack=pW(t,"stack")?t.stack:void 0),r}function oee(t){return t>=-32099&&t<=-32e3}function fW(t){return t&&typeof t=="object"&&!Array.isArray(t)?Object.assign({},t):t}function g9(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function pW(t,e){return typeof t=="object"&&t!==null&&e in t&&typeof t[e]=="string"}const Mt={rpc:{parse:t=>Ws(Wr.rpc.parse,t),invalidRequest:t=>Ws(Wr.rpc.invalidRequest,t),invalidParams:t=>Ws(Wr.rpc.invalidParams,t),methodNotFound:t=>Ws(Wr.rpc.methodNotFound,t),internal:t=>Ws(Wr.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return Ws(e,t)},invalidInput:t=>Ws(Wr.rpc.invalidInput,t),resourceNotFound:t=>Ws(Wr.rpc.resourceNotFound,t),resourceUnavailable:t=>Ws(Wr.rpc.resourceUnavailable,t),transactionRejected:t=>Ws(Wr.rpc.transactionRejected,t),methodNotSupported:t=>Ws(Wr.rpc.methodNotSupported,t),limitExceeded:t=>Ws(Wr.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>j0(Wr.provider.userRejectedRequest,t),unauthorized:t=>j0(Wr.provider.unauthorized,t),unsupportedMethod:t=>j0(Wr.provider.unsupportedMethod,t),disconnected:t=>j0(Wr.provider.disconnected,t),chainDisconnected:t=>j0(Wr.provider.chainDisconnected,t),unsupportedChain:t=>j0(Wr.provider.unsupportedChain,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:r,data:n}=t;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new uee(e,r,n)}}};function Ws(t,e){const[r,n]=aee(e);return new cee(t,r||dR(t),n)}function j0(t,e){const[r,n]=aee(e);return new uee(t,r||dR(t),n)}function aee(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:r}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,r]}}return[]}class cee extends Error{constructor(e,r,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string.');super(r),this.code=e,n!==void 0&&(this.data=n)}}class uee extends cee{constructor(e,r,n){if(!V9e(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,r,n)}}function V9e(t){return Number.isInteger(t)&&t>=1e3&&t<=4999}function hR(){return t=>t}const av=hR(),G9e=hR(),K9e=hR();function eu(t){return Math.floor(t)}const lee=/^[0-9]*$/,dee=/^[a-f0-9]*$/;function Wh(t){return fR(crypto.getRandomValues(new Uint8Array(t)))}function fR(t){return[...t].map(e=>e.toString(16).padStart(2,"0")).join("")}function hC(t){return new Uint8Array(t.match(/.{1,2}/g).map(e=>Number.parseInt(e,16)))}function Cb(t,e=!1){const r=t.toString("hex");return av(e?`0x${r}`:r)}function DT(t){return Cb(m9(t),!0)}function xa(t){return K9e(t.toString(10))}function od(t){return av(`0x${BigInt(t).toString(16)}`)}function hee(t){return t.startsWith("0x")||t.startsWith("0X")}function pR(t){return hee(t)?t.slice(2):t}function fee(t){return hee(t)?`0x${t.slice(2)}`:`0x${t}`}function xx(t){if(typeof t!="string")return!1;const e=pR(t).toLowerCase();return dee.test(e)}function Z9e(t,e=!1){if(typeof t=="string"){const r=pR(t).toLowerCase();if(dee.test(r))return av(e?`0x${r}`:r)}throw Mt.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`)}function gR(t,e=!1){let r=Z9e(t,!1);return r.length%2===1&&(r=av(`0${r}`)),e?av(`0x${r}`):r}function kl(t){if(typeof t=="string"){const e=pR(t).toLowerCase();if(xx(e)&&e.length===40)return G9e(fee(e))}throw Mt.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`)}function m9(t){if(Buffer.isBuffer(t))return t;if(typeof t=="string"){if(xx(t)){const e=gR(t,!1);return Buffer.from(e,"hex")}return Buffer.from(t,"utf8")}throw Mt.rpc.invalidParams(`Not binary data: ${String(t)}`)}function Ab(t){if(typeof t=="number"&&Number.isInteger(t))return eu(t);if(typeof t=="string"){if(lee.test(t))return eu(Number(t));if(xx(t))return eu(Number(BigInt(gR(t,!0))))}throw Mt.rpc.invalidParams(`Not an integer: ${String(t)}`)}function Xw(t){if(t!==null&&(typeof t=="bigint"||J9e(t)))return BigInt(t.toString(10));if(typeof t=="number")return BigInt(Ab(t));if(typeof t=="string"){if(lee.test(t))return BigInt(t);if(xx(t))return BigInt(gR(t,!0))}throw Mt.rpc.invalidParams(`Not an integer: ${String(t)}`)}function Y9e(t){if(typeof t=="string")return JSON.parse(t);if(typeof t=="object")return t;throw Mt.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`)}function J9e(t){if(t==null||typeof t.constructor!="function")return!1;const{constructor:e}=t;return typeof e.config=="function"&&typeof e.EUCLID=="number"}async function Q9e(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}async function X9e(t,e){return crypto.subtle.deriveKey({name:"ECDH",public:e},t,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function e7e(t,e){const r=crypto.getRandomValues(new Uint8Array(12)),n=await crypto.subtle.encrypt({name:"AES-GCM",iv:r},t,new TextEncoder().encode(e));return{iv:r,cipherText:n}}async function t7e(t,{iv:e,cipherText:r}){const n=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},t,r);return new TextDecoder().decode(n)}function pee(t){switch(t){case"public":return"spki";case"private":return"pkcs8"}}async function gee(t,e){const r=pee(t),n=await crypto.subtle.exportKey(r,e);return fR(new Uint8Array(n))}async function mee(t,e){const r=pee(t),n=hC(e).buffer;return await crypto.subtle.importKey(r,new Uint8Array(n),{name:"ECDH",namedCurve:"P-256"},!0,t==="private"?["deriveKey"]:[])}async function r7e(t,e){const r=JSON.stringify(t,(n,i)=>{if(!(i instanceof Error))return i;const s=i;return Object.assign(Object.assign({},s.code?{code:s.code}:{}),{message:s.message})});return e7e(e,r)}async function n7e(t,e){return JSON.parse(await t7e(e,t))}const MT={storageKey:"ownPrivateKey",keyType:"private"},LT={storageKey:"ownPublicKey",keyType:"public"},UT={storageKey:"peerPublicKey",keyType:"public"};class i7e{constructor(){this.storage=new ac("CBWSDK","SCWKeyManager"),this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(e){this.sharedSecret=null,this.peerPublicKey=e,await this.storeKey(UT,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(LT.storageKey),this.storage.removeItem(MT.storageKey),this.storage.removeItem(UT.storageKey)}async generateKeyPair(){const e=await Q9e();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(MT,e.privateKey),await this.storeKey(LT,e.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(MT)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(LT)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey(UT)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await X9e(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const r=this.storage.getItem(e.storageKey);return r?mee(e.keyType,r):null}async storeKey(e,r){const n=await gee(e.keyType,r);this.storage.setItem(e.storageKey,n)}}const L2="4.3.0",wee="@coinbase/wallet-sdk";async function mR(t,e){const r=Object.assign(Object.assign({},t),{jsonrpc:"2.0",id:crypto.randomUUID()}),n=await window.fetch(e,{method:"POST",body:JSON.stringify(r),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":L2,"X-Cbw-Sdk-Platform":wee}}),{result:i,error:s}=await n.json();if(s)throw s;return i}function s7e(){return globalThis.coinbaseWalletExtension}function o7e(){var t,e;try{const r=globalThis;return(t=r.ethereum)!==null&&t!==void 0?t:(e=r.top)===null||e===void 0?void 0:e.ethereum}catch{return}}function a7e({metadata:t,preference:e}){var r,n;const{appName:i,appLogoUrl:s,appChainIds:o}=t;if(e.options!=="smartWalletOnly"){const c=s7e();if(c)return(r=c.setAppInfo)===null||r===void 0||r.call(c,i,s,o,e),c}const a=o7e();if(a!=null&&a.isCoinbaseBrowser)return(n=a.setAppInfo)===null||n===void 0||n.call(a,i,s,o,e),a}function c7e(t){if(!t||typeof t!="object"||Array.isArray(t))throw Mt.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:t});const{method:e,params:r}=t;if(typeof e!="string"||e.length===0)throw Mt.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:t});if(r!==void 0&&!Array.isArray(r)&&(typeof r!="object"||r===null))throw Mt.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:t});switch(e){case"eth_sign":case"eth_signTypedData_v2":case"eth_subscribe":case"eth_unsubscribe":throw Mt.provider.unsupportedMethod()}}const gW="accounts",mW="activeChain",wW="availableChains",bW="walletCapabilities";class u7e{constructor(e){var r,n,i;this.metadata=e.metadata,this.communicator=e.communicator,this.callback=e.callback,this.keyManager=new i7e,this.storage=new ac("CBWSDK","SCWStateManager"),this.accounts=(r=this.storage.loadObject(gW))!==null&&r!==void 0?r:[],this.chain=this.storage.loadObject(mW)||{id:(i=(n=e.metadata.appChainIds)===null||n===void 0?void 0:n[0])!==null&&i!==void 0?i:1},this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(e){var r,n,i,s;await((n=(r=this.communicator).waitForPopupLoaded)===null||n===void 0?void 0:n.call(r));const o=await this.createRequestMessage({handshake:{method:e.method,params:Object.assign({},this.metadata,(i=e.params)!==null&&i!==void 0?i:{})}}),a=await this.communicator.postRequestAndWaitForResponse(o);if("failure"in a.content)throw a.content.failure;const c=await mee("public",a.sender);await this.keyManager.setPeerPublicKey(c);const l=(await this.decryptResponseMessage(a)).result;if("error"in l)throw l.error;switch(e.method){case"eth_requestAccounts":{const d=l.value;this.accounts=d,this.storage.storeObject(gW,d),(s=this.callback)===null||s===void 0||s.call(this,"accountsChanged",d);break}}}async request(e){var r;if(this.accounts.length===0)switch(e.method){case"wallet_sendCalls":return this.sendRequestToPopup(e);default:throw Mt.provider.unauthorized()}switch(e.method){case"eth_requestAccounts":return(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:od(this.chain.id)}),this.accounts;case"eth_accounts":return this.accounts;case"eth_coinbase":return this.accounts[0];case"net_version":return this.chain.id;case"eth_chainId":return od(this.chain.id);case"wallet_getCapabilities":return this.storage.loadObject(bW);case"wallet_switchEthereumChain":return this.handleSwitchChainRequest(e);case"eth_ecRecover":case"personal_sign":case"wallet_sign":case"personal_ecRecover":case"eth_signTransaction":case"eth_sendTransaction":case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":case"wallet_addEthereumChain":case"wallet_watchAsset":case"wallet_sendCalls":case"wallet_showCallsStatus":case"wallet_grantPermissions":return this.sendRequestToPopup(e);default:if(!this.chain.rpcUrl)throw Mt.rpc.internal("No RPC URL set for chain");return mR(e,this.chain.rpcUrl)}}async sendRequestToPopup(e){var r,n;await((n=(r=this.communicator).waitForPopupLoaded)===null||n===void 0?void 0:n.call(r));const i=await this.sendEncryptedRequest(e),o=(await this.decryptResponseMessage(i)).result;if("error"in o)throw o.error;return o.value}async cleanup(){var e,r;this.storage.clear(),await this.keyManager.clear(),this.accounts=[],this.chain={id:(r=(e=this.metadata.appChainIds)===null||e===void 0?void 0:e[0])!==null&&r!==void 0?r:1}}async handleSwitchChainRequest(e){var r;const n=e.params;if(!n||!(!((r=n[0])===null||r===void 0)&&r.chainId))throw Mt.rpc.invalidParams();const i=Ab(n[0].chainId);if(this.updateChain(i))return null;const o=await this.sendRequestToPopup(e);return o===null&&this.updateChain(i),o}async sendEncryptedRequest(e){const r=await this.keyManager.getSharedSecret();if(!r)throw Mt.provider.unauthorized("No valid session found, try requestAccounts before other methods");const n=await r7e({action:e,chainId:this.chain.id},r),i=await this.createRequestMessage({encrypted:n});return this.communicator.postRequestAndWaitForResponse(i)}async createRequestMessage(e){const r=await gee("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:r,content:e,timestamp:new Date}}async decryptResponseMessage(e){var r,n;const i=e.content;if("failure"in i)throw i.failure;const s=await this.keyManager.getSharedSecret();if(!s)throw Mt.provider.unauthorized("Invalid session");const o=await n7e(i.encrypted,s),a=(r=o.data)===null||r===void 0?void 0:r.chains;if(a){const u=Object.entries(a).map(([l,d])=>({id:Number(l),rpcUrl:d}));this.storage.storeObject(wW,u),this.updateChain(this.chain.id,u)}const c=(n=o.data)===null||n===void 0?void 0:n.capabilities;return c&&this.storage.storeObject(bW,c),o}updateChain(e,r){var n;const i=r??this.storage.loadObject(wW),s=i==null?void 0:i.find(o=>o.id===e);return s?(s!==this.chain&&(this.chain=s,this.storage.storeObject(mW,s),(n=this.callback)===null||n===void 0||n.call(this,"chainChanged",od(s.id))),!0):!1}}var FT,yW;function bee(){if(yW)return FT;yW=1;const{keccak_256:t}=fO();function e(f){return Buffer.allocUnsafe(f).fill(0)}function r(f){return f.toString(2).length}function n(f,g){let p=f.toString(16);p.length%2!==0&&(p="0"+p);const m=p.match(/.{1,2}/g).map(b=>parseInt(b,16));for(;m.length"u")throw new Error("Not an array?");if(g=i(h),g!=="dynamic"&&g!==0&&f.length>g)throw new Error("Elements exceed array size: "+g);m=[],h=h.slice(0,h.lastIndexOf("[")),typeof f=="string"&&(f=JSON.parse(f));for(b in f)m.push(o(h,f[b]));if(g==="dynamic"){var v=o("uint256",f.length);m.unshift(v)}return Buffer.concat(m)}else{if(h==="bytes")return f=new Buffer(f),m=Buffer.concat([o("uint256",f.length),f]),f.length%32!==0&&(m=Buffer.concat([m,t.zeros(32-f.length%32)])),m;if(h.startsWith("bytes")){if(g=r(h),g<1||g>32)throw new Error("Invalid bytes width: "+g);return t.setLengthRight(f,32)}else if(h.startsWith("uint")){if(g=r(h),g%8||g<8||g>256)throw new Error("Invalid uint width: "+g);p=s(f);const E=t.bitLengthFromBigInt(p);if(E>g)throw new Error("Supplied uint exceeds width: "+g+" vs "+E);if(p<0)throw new Error("Supplied uint is negative");return t.bufferBEFromBigInt(p,32)}else if(h.startsWith("int")){if(g=r(h),g%8||g<8||g>256)throw new Error("Invalid int width: "+g);p=s(f);const E=t.bitLengthFromBigInt(p);if(E>g)throw new Error("Supplied int exceeds width: "+g+" vs "+E);const w=t.twosFromBigInt(p,256);return t.bufferBEFromBigInt(w,32)}else if(h.startsWith("ufixed")){if(g=n(h),p=s(f),p<0)throw new Error("Supplied ufixed is negative");return o("uint256",p*BigInt(2)**BigInt(g[1]))}else if(h.startsWith("fixed"))return g=n(h),o("int256",s(f)*BigInt(2)**BigInt(g[1]))}throw new Error("Unsupported or invalid type: "+h)}function a(h){return h==="string"||h==="bytes"||i(h)==="dynamic"}function c(h){return h.lastIndexOf("]")===h.length-1}function u(h,f){var g=[],p=[],m=32*h.length;for(var b in h){var v=e(h[b]),E=f[b],w=o(v,E);a(v)?(g.push(o("uint256",m)),p.push(w),m+=w.length):g.push(w)}return Buffer.concat(g.concat(p))}function l(h,f){if(h.length!==f.length)throw new Error("Number of types are not matching the values");for(var g,p,m=[],b=0;b32)throw new Error("Invalid bytes width: "+g);m.push(t.setLengthRight(E,g))}else if(v.startsWith("uint")){if(g=r(v),g%8||g<8||g>256)throw new Error("Invalid uint width: "+g);p=s(E);const w=t.bitLengthFromBigInt(p);if(w>g)throw new Error("Supplied uint exceeds width: "+g+" vs "+w);m.push(t.bufferBEFromBigInt(p,g/8))}else if(v.startsWith("int")){if(g=r(v),g%8||g<8||g>256)throw new Error("Invalid int width: "+g);p=s(E);const w=t.bitLengthFromBigInt(p);if(w>g)throw new Error("Supplied int exceeds width: "+g+" vs "+w);const C=t.twosFromBigInt(p,g);m.push(t.bufferBEFromBigInt(C,g/8))}else throw new Error("Unsupported or invalid type: "+v)}return Buffer.concat(m)}function d(h,f){return t.keccak(l(h,f))}return HT={rawEncode:u,solidityPack:l,soliditySHA3:d},HT}var qT,_W;function d7e(){if(_W)return qT;_W=1;const t=bee(),e=l7e(),r={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},n={encodeData(s,o,a,c=!0){const u=["bytes32"],l=[this.hashType(s,a)];if(c){const d=(h,f,g)=>{if(a[f]!==void 0)return["bytes32",g==null?"0x0000000000000000000000000000000000000000000000000000000000000000":t.keccak(this.encodeData(f,g,a,c))];if(g===void 0)throw new Error(`missing value for field ${h} of type ${f}`);if(f==="bytes")return["bytes32",t.keccak(g)];if(f==="string")return typeof g=="string"&&(g=Buffer.from(g,"utf8")),["bytes32",t.keccak(g)];if(f.lastIndexOf("]")===f.length-1){const p=f.slice(0,f.lastIndexOf("[")),m=g.map(b=>d(h,p,b));return["bytes32",t.keccak(e.rawEncode(m.map(([b])=>b),m.map(([,b])=>b)))]}return[f,g]};for(const h of a[s]){const[f,g]=d(h.name,h.type,o[h.name]);u.push(f),l.push(g)}}else for(const d of a[s]){let h=o[d.name];if(h!==void 0)if(d.type==="bytes")u.push("bytes32"),h=t.keccak(h),l.push(h);else if(d.type==="string")u.push("bytes32"),typeof h=="string"&&(h=Buffer.from(h,"utf8")),h=t.keccak(h),l.push(h);else if(a[d.type]!==void 0)u.push("bytes32"),h=t.keccak(this.encodeData(d.type,h,a,c)),l.push(h);else{if(d.type.lastIndexOf("]")===d.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");u.push(d.type),l.push(h)}}return e.rawEncode(u,l)},encodeType(s,o){let a="",c=this.findTypeDependencies(s,o).filter(u=>u!==s);c=[s].concat(c.sort());for(const u of c){if(!o[u])throw new Error("No type definition specified: "+u);a+=u+"("+o[u].map(({name:d,type:h})=>h+" "+d).join(",")+")"}return a},findTypeDependencies(s,o,a=[]){if(s=s.match(/^\w*/)[0],a.includes(s)||o[s]===void 0)return a;a.push(s);for(const c of o[s])for(const u of this.findTypeDependencies(c.type,o,a))!a.includes(u)&&a.push(u);return a},hashStruct(s,o,a,c=!0){return t.keccak(this.encodeData(s,o,a,c))},hashType(s,o){return t.keccak(this.encodeType(s,o))},sanitizeData(s){const o={};for(const a in r.properties)s[a]&&(o[a]=s[a]);return o.types&&(o.types=Object.assign({EIP712Domain:[]},o.types)),o},hash(s,o=!0){const a=this.sanitizeData(s),c=[Buffer.from("1901","hex")];return c.push(this.hashStruct("EIP712Domain",a.domain,a.types,o)),a.primaryType!=="EIP712Domain"&&c.push(this.hashStruct(a.primaryType,a.message,a.types,o)),t.keccak(Buffer.concat(c))}};qT={TYPED_MESSAGE_SCHEMA:r,TypedDataUtils:n,hashForSignTypedDataLegacy:function(s){return i(s.data)},hashForSignTypedData_v3:function(s){return n.hash(s.data,!1)},hashForSignTypedData_v4:function(s){return n.hash(s.data)}};function i(s){const o=new Error("Expect argument to be non-empty array");if(typeof s!="object"||!s.length)throw o;const a=s.map(function(l){return l.type==="bytes"?t.toBuffer(l.value):l.value}),c=s.map(function(l){return l.type}),u=s.map(function(l){if(!l.name)throw o;return l.type+" "+l.name});return e.soliditySHA3(["bytes32","bytes32"],[e.soliditySHA3(new Array(s.length).fill("string"),u),e.soliditySHA3(c,a)])}return qT}var h7e=d7e();const L4=cc(h7e),f7e="walletUsername",w9="Addresses",p7e="AppVersion";function Mn(t){return t.errorMessage!==void 0}class g7e{constructor(e){this.secret=e}async encrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",hC(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,o=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,s.encode(e)),a=16,c=o.slice(o.byteLength-a),u=o.slice(0,o.byteLength-a),l=new Uint8Array(c),d=new Uint8Array(u),h=new Uint8Array([...n,...l,...d]);return fR(h)}async decrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");return new Promise((n,i)=>{(async function(){const s=await crypto.subtle.importKey("raw",hC(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),o=hC(e),a=o.slice(0,12),c=o.slice(12,28),u=o.slice(28),l=new Uint8Array([...u,...c]),d={name:"AES-GCM",iv:new Uint8Array(a)};try{const h=await window.crypto.subtle.decrypt(d,s,l),f=new TextDecoder;n(f.decode(h))}catch(h){i(h)}})()})}}class m7e{constructor(e,r,n){this.linkAPIUrl=e,this.sessionId=r;const i=`${r}:${n}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(r=>fetch(`${this.linkAPIUrl}/events/${r.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(r=>console.error("Unabled to mark event as failed:",r))}async fetchUnseenEvents(){var e;const r=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(r.ok){const{events:n,error:i}=await r.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const s=(e=n==null?void 0:n.filter(o=>o.event==="Web3Response").map(o=>({type:"Event",sessionId:this.sessionId,eventId:o.id,event:o.event,data:o.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(s),s}throw new Error(`Check unseen events failed: ${r.status}`)}}var yu;(function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED"})(yu||(yu={}));class w7e{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,r=WebSocket){this.WebSocketClass=r,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((e,r)=>{var n;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(s){r(s);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,yu.CONNECTING),i.onclose=s=>{var o;this.clearWebSocket(),r(new Error(`websocket error ${s.code}: ${s.reason}`)),(o=this.connectionStateListener)===null||o===void 0||o.call(this,yu.DISCONNECTED)},i.onopen=s=>{var o;e(),(o=this.connectionStateListener)===null||o===void 0||o.call(this,yu.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(c=>this.sendData(c)),this.pendingData=[])},i.onmessage=s=>{var o,a;if(s.data==="h")(o=this.incomingDataListener)===null||o===void 0||o.call(this,{type:"Heartbeat"});else try{const c=JSON.parse(s.data);(a=this.incomingDataListener)===null||a===void 0||a.call(this,c)}catch{}}})}disconnect(){var e;const{webSocket:r}=this;if(r){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,yu.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{r.close()}catch{}}}sendData(e){const{webSocket:r}=this;if(!r){this.pendingData.push(e),this.connect();return}r.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}const EW=1e4,b7e=6e4;class y7e{constructor({session:e,linkAPIUrl:r,listener:n}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=eu(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=s=>{if(!s)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",a=>s.JsonRpcUrl&&this.handleChainUpdated(a,s.JsonRpcUrl)]]).forEach((a,c)=>{const u=s[c];u!==void 0&&a(u)})},this.handleDestroyed=s=>{var o;s==="1"&&((o=this.listener)===null||o===void 0||o.resetAndReload())},this.handleAccountUpdated=async s=>{var o;const a=await this.cipher.decrypt(s);(o=this.listener)===null||o===void 0||o.accountUpdated(a)},this.handleMetadataUpdated=async(s,o)=>{var a;const c=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.metadataUpdated(s,c)},this.handleWalletUsernameUpdated=async s=>{this.handleMetadataUpdated(f7e,s)},this.handleAppVersionUpdated=async s=>{this.handleMetadataUpdated(p7e,s)},this.handleChainUpdated=async(s,o)=>{var a;const c=await this.cipher.decrypt(s),u=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.chainUpdated(c,u)},this.session=e,this.cipher=new g7e(e.secret),this.listener=n;const i=new w7e(`${r}/rpc`,WebSocket);i.setConnectionStateListener(async s=>{let o=!1;switch(s){case yu.DISCONNECTED:if(!this.destroyed){const a=async()=>{await new Promise(c=>setTimeout(c,5e3)),this.destroyed||i.connect().catch(()=>{a()})};a()}break;case yu.CONNECTED:o=await this.handleConnected(),this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},EW),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case yu.CONNECTING:break}this.connected!==o&&(this.connected=o)}),i.setIncomingDataListener(s=>{var o;switch(s.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const a=s.type==="IsLinkedOK"?s.linked:void 0;this.linked=a||s.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(s.metadata);break}case"Event":{this.handleIncomingEvent(s);break}}s.id!==void 0&&((o=this.requestResolutions.get(s.id))===null||o===void 0||o(s))}),this.ws=i,this.http=new m7e(r,e.id,e.key)}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}async destroy(){this.destroyed||(await this.makeRequest({type:"SetSessionConfig",id:eu(this.nextReqId++),sessionId:this.session.id,metadata:{__destroyed:"1"}},{timeout:1e3}),this.destroyed=!0,this.ws.disconnect(),this.listener=void 0)}get connected(){return this._connected}set connected(e){this._connected=e}get linked(){return this._linked}set linked(e){var r,n;this._linked=e,e&&((r=this.onceLinked)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(e)}setOnceLinked(e){return new Promise(r=>{this.linked?e().then(r):this.onceLinked=()=>{e().then(r),this.onceLinked=void 0}})}async handleIncomingEvent(e){var r;if(e.type!=="Event"||e.event!=="Web3Response")return;const n=await this.cipher.decrypt(e.data),i=JSON.parse(n);if(i.type!=="WEB3_RESPONSE")return;const{id:s,response:o}=i;(r=this.listener)===null||r===void 0||r.handleWeb3ResponseMessage(s,o)}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(e=>setTimeout(e,250));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(r=>this.handleIncomingEvent(r))}async publishEvent(e,r,n=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},r),{origin:location.origin,location:location.href,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:eu(this.nextReqId++),sessionId:this.session.id,event:e,data:i,callWebhook:n};return this.setOnceLinked(async()=>{const o=await this.makeRequest(s);if(o.type==="Fail")throw new Error(o.error||"failed to publish event");return o.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>EW*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,r={timeout:b7e}){const n=e.id;this.sendData(e);let i;return Promise.race([new Promise((s,o)=>{i=window.setTimeout(()=>{o(new Error(`request ${n} timed out`))},r.timeout)}),new Promise(s=>{this.requestResolutions.set(n,o=>{clearTimeout(i),s(o),this.requestResolutions.delete(n)})})])}async handleConnected(){return(await this.makeRequest({type:"HostSession",id:eu(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key})).type==="Fail"?!1:(this.sendData({type:"IsLinked",id:eu(this.nextReqId++),sessionId:this.session.id}),this.sendData({type:"GetSessionConfig",id:eu(this.nextReqId++),sessionId:this.session.id}),!0)}}class v7e{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,r=fee(e.toString(16));return this.callbacks.get(r)&&this.callbacks.delete(r),e}}const CW="session:id",AW="session:secret",xW="session:linked";class pg{constructor(e,r,n,i=!1){this.storage=e,this.id=r,this.secret=n,this.key=Fte(rre(`${r}, ${n} WalletLink`)),this._linked=!!i}static create(e){const r=Wh(16),n=Wh(32);return new pg(e,r,n).save()}static load(e){const r=e.getItem(CW),n=e.getItem(xW),i=e.getItem(AW);return r&&i?new pg(e,r,i,n==="1"):null}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this.storage.setItem(CW,this.id),this.storage.setItem(AW,this.secret),this.persistLinked(),this}persistLinked(){this.storage.setItem(xW,this._linked?"1":"0")}}function _7e(){try{return window.frameElement!==null}catch{return!1}}function E7e(){try{return _7e()&&window.top?window.top.location:window.location}catch{return window.location}}function C7e(){var t;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t=window==null?void 0:window.navigator)===null||t===void 0?void 0:t.userAgent)}function yee(){var t,e;return(e=(t=window==null?void 0:window.matchMedia)===null||t===void 0?void 0:t.call(window,"(prefers-color-scheme: dark)").matches)!==null&&e!==void 0?e:!1}const A7e='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';function vee(){const t=document.createElement("style");t.type="text/css",t.appendChild(document.createTextNode(A7e)),document.documentElement.appendChild(t)}function _ee(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e2&&(o.children=arguments.length>3?Sx.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(s in t.defaultProps)o[s]===void 0&&(o[s]=t.defaultProps[s]);return fC(t,o,n,i,null)}function fC(t,e,r,n,i){var s={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Eee,__i:-1,__u:0};return i==null&&kr.vnode!=null&&kr.vnode(s),s}function Ix(t){return t.children}function pC(t,e){this.props=t,this.context=e}function Ym(t,e){if(e==null)return t.__?Ym(t.__,t.__i+1):null;for(var r;ea&&Vh.sort(Aee),t=Vh.shift(),a=Vh.length,t.__d&&(r=void 0,i=(n=(e=t).__v).__e,s=[],o=[],e.__P&&((r=vu({},n)).__v=n.__v+1,kr.vnode&&kr.vnode(r),yR(e.__P,r,n,e.__n,e.__P.namespaceURI,32&n.__u?[i]:null,s,i??Ym(n),!!(32&n.__u),o),r.__v=n.__v,r.__.__k[r.__i]=r,Oee(s,r,o),r.__e!=i&&Tee(r)));k6.__r=0}function Iee(t,e,r,n,i,s,o,a,c,u,l){var d,h,f,g,p,m,b=n&&n.__k||See,v=e.length;for(c=S7e(r,e,b,c,v),d=0;d0?fC(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=t,o.__b=t.__b+1,a=null,(u=o.__i=T7e(o,r,c,d))!=-1&&(d--,(a=r[u])&&(a.__u|=2)),a==null||a.__v==null?(u==-1&&(i>l?h--:ic?h--:h++,o.__u|=4))):t.__k[s]=null;if(d)for(s=0;s(c!=null&&(2&c.__u)==0?1:0))for(i=r-1,s=r+1;i>=0||s=0){if((c=e[i])&&(2&c.__u)==0&&o==c.key&&a==c.type)return i;i--}if(s0?t:Tx(t)?t.map(Ree):vu({},t)}function I7e(t,e,r,n,i,s,o,a,c){var u,l,d,h,f,g,p,m=r.props,b=e.props,v=e.type;if(v=="svg"?i="http://www.w3.org/2000/svg":v=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),s!=null){for(u=0;u=r.__.length&&r.__.push({}),r.__[t]}function DW(t){return _9=1,O7e(jee,t)}function O7e(t,e,r){var n=$ee(N6++,2);if(n.t=t,!n.__c&&(n.__=[jee(void 0,e),function(a){var c=n.__N?n.__N[0]:n.__[0],u=n.t(c,a);c!==u&&(n.__N=[u,n.__[1]],n.__c.setState({}))}],n.__c=Gr,!Gr.__f)){var i=function(a,c,u){if(!n.__c.__H)return!0;var l=n.__c.__H.__.filter(function(h){return!!h.__c});if(l.every(function(h){return!h.__N}))return!s||s.call(this,a,c,u);var d=n.__c.props!==a;return l.forEach(function(h){if(h.__N){var f=h.__[0];h.__=h.__N,h.__N=void 0,f!==h.__[0]&&(d=!0)}}),s&&s.call(this,a,c,u)||d};Gr.__f=!0;var s=Gr.shouldComponentUpdate,o=Gr.componentWillUpdate;Gr.componentWillUpdate=function(a,c,u){if(this.__e){var l=s;s=void 0,i(a,c,u),s=l}o&&o.call(this,a,c,u)},Gr.shouldComponentUpdate=i}return n.__N||n.__}function R7e(t,e){var r=$ee(N6++,3);!an.__s&&$7e(r.__H,e)&&(r.__=t,r.u=e,Gr.__H.__h.push(r))}function k7e(){for(var t;t=Nee.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(gC),t.__H.__h.forEach(E9),t.__H.__h=[]}catch(e){t.__H.__h=[],an.__e(e,t.__v)}}an.__b=function(t){Gr=null,RW&&RW(t)},an.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),BW&&BW(t,e)},an.__r=function(t){kW&&kW(t),N6=0;var e=(Gr=t.__c).__H;e&&(zT===Gr?(e.__h=[],Gr.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(e.__h.forEach(gC),e.__h.forEach(E9),e.__h=[],N6=0)),zT=Gr},an.diffed=function(t){NW&&NW(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Nee.push(e)!==1&&OW===an.requestAnimationFrame||((OW=an.requestAnimationFrame)||N7e)(k7e)),e.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),zT=Gr=null},an.__c=function(t,e){e.some(function(r){try{r.__h.forEach(gC),r.__h=r.__h.filter(function(n){return!n.__||E9(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],an.__e(n,r.__v)}}),$W&&$W(t,e)},an.unmount=function(t){jW&&jW(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{gC(n)}catch(i){e=i}}),r.__H=void 0,e&&an.__e(e,r.__v))};var MW=typeof requestAnimationFrame=="function";function N7e(t){var e,r=function(){clearTimeout(n),MW&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,35);MW&&(e=requestAnimationFrame(r))}function gC(t){var e=Gr,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),Gr=e}function E9(t){var e=Gr;t.__c=t.__(),Gr=e}function $7e(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}function jee(t,e){return typeof e=="function"?e(t):e}const j7e=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}",B7e="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",D7e="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class M7e{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=yee()}attach(e){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",e.appendChild(this.root),this.render()}presentItem(e){const r=this.nextItemKey++;return this.items.set(r,e),this.render(),()=>{this.items.delete(r),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&v9(or("div",null,or(Bee,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([e,r])=>or(L7e,Object.assign({},r,{key:e}))))),this.root)}}const Bee=t=>or("div",{class:xb("-cbwsdk-snackbar-container")},or("style",null,j7e),or("div",{class:"-cbwsdk-snackbar"},t.children)),L7e=({autoExpand:t,message:e,menuItems:r})=>{const[n,i]=DW(!0),[s,o]=DW(t??!1);R7e(()=>{const c=[window.setTimeout(()=>{i(!1)},1),window.setTimeout(()=>{o(!0)},1e4)];return()=>{c.forEach(window.clearTimeout)}});const a=()=>{o(!s)};return or("div",{class:xb("-cbwsdk-snackbar-instance",n&&"-cbwsdk-snackbar-instance-hidden",s&&"-cbwsdk-snackbar-instance-expanded")},or("div",{class:"-cbwsdk-snackbar-instance-header",onClick:a},or("img",{src:B7e,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",or("div",{class:"-cbwsdk-snackbar-instance-header-message"},e),or("div",{class:"-gear-container"},!s&&or("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},or("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),or("img",{src:D7e,class:"-gear-icon",title:"Expand"}))),r&&r.length>0&&or("div",{class:"-cbwsdk-snackbar-instance-menu"},r.map((c,u)=>or("div",{class:xb("-cbwsdk-snackbar-instance-menu-item",c.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:c.onClick,key:u},or("svg",{width:c.svgWidth,height:c.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},or("path",{"fill-rule":c.defaultFillRule,"clip-rule":c.defaultClipRule,d:c.path,fill:"#AAAAAA"})),or("span",{class:xb("-cbwsdk-snackbar-instance-menu-item-info",c.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},c.info)))))};class U7e{constructor(){this.attached=!1,this.snackbar=new M7e}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,r=document.createElement("div");r.className="-cbwsdk-css-reset",e.appendChild(r),this.snackbar.attach(r),this.attached=!0,vee()}showConnecting(e){let r;return e.isUnlinkedErrorState?r={autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]}:r={message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:e.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]},this.snackbar.presentItem(r)}}const F7e=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";class H7e{constructor(){this.root=null,this.darkMode=yee()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),vee()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&(v9(null,this.root),e&&v9(or(q7e,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}const q7e=({title:t,buttonText:e,darkMode:r,onButtonClick:n,onDismiss:i})=>{const s=r?"dark":"light";return or(Bee,{darkMode:r},or("div",{class:"-cbwsdk-redirect-dialog"},or("style",null,F7e),or("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),or("div",{class:xb("-cbwsdk-redirect-dialog-box",s)},or("p",null,t),or("button",{onClick:n},e))))},z7e="https://keys.coinbase.com/connect",W7e="http://rpc.wallet.coinbase.com",LW="https://www.walletlink.org",V7e="https://go.cb-w.com/walletlink";class UW{constructor(){this.attached=!1,this.redirectDialog=new H7e}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){const r=new URL(V7e);r.searchParams.append("redirect_url",E7e().href),e&&r.searchParams.append("wl_url",e);const n=document.createElement("a");n.target="cbw-opener",n.href=r.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(e)},99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}}class tu{constructor(e){this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.isMobileWeb=C7e(),this.linkedUpdated=s=>{this.isLinked=s;const o=this.storage.getItem(w9);if(s&&(this._session.linked=s),this.isUnlinkedErrorState=!1,o){const a=o.split(" "),c=this.storage.getItem("IsStandaloneSigning")==="true";a[0]!==""&&!s&&this._session.linked&&!c&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(s,o)=>{this.storage.setItem(s,o)},this.chainUpdated=(s,o)=>{this.chainCallbackParams.chainId===s&&this.chainCallbackParams.jsonRpcUrl===o||(this.chainCallbackParams={chainId:s,jsonRpcUrl:o},this.chainCallback&&this.chainCallback(o,Number.parseInt(s,10)))},this.accountUpdated=s=>{this.accountsCallback&&this.accountsCallback([s]),tu.accountRequestCallbackIds.size>0&&(Array.from(tu.accountRequestCallbackIds.values()).forEach(o=>{this.invokeCallback(o,{method:"requestEthereumAccounts",result:[s]})}),tu.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage,this.metadata=e.metadata,this.accountsCallback=e.accountsCallback,this.chainCallback=e.chainCallback;const{session:r,ui:n,connection:i}=this.subscribe();this._session=r,this.connection=i,this.relayEventManager=new v7e,this.ui=n,this.ui.attach()}subscribe(){const e=pg.load(this.storage)||pg.create(this.storage),{linkAPIUrl:r}=this,n=new y7e({session:e,linkAPIUrl:r,listener:this}),i=this.isMobileWeb?new UW:new U7e;return n.connect(),{session:e,ui:i,connection:n}}resetAndReload(){this.connection.destroy().then(()=>{const e=pg.load(this.storage);(e==null?void 0:e.id)===this._session.id&&ac.clearAll(),document.location.reload()}).catch(e=>{})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:xa(e.weiValue),data:Cb(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?xa(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?xa(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?xa(e.gasPriceInWei):null,gasLimit:e.gasLimit?xa(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:xa(e.weiValue),data:Cb(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?xa(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?xa(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?xa(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?xa(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,r){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:Cb(e,!0),chainId:r}})}getWalletLinkSession(){return this._session}sendRequest(e){let r=null;const n=Wh(8),i=s=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,e.method,s),r==null||r()};return new Promise((s,o)=>{r=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(n,a=>{if(r==null||r(),Mn(a))return o(new Error(a.errorMessage));s(a)}),this.publishWeb3RequestEvent(n,e)})}publishWeb3RequestEvent(e,r){const n={type:"WEB3_REQUEST",id:e,request:r};this.publishEvent("Web3Request",n,!0).then(i=>{}).catch(i=>{this.handleWeb3ResponseMessage(n.id,{method:r.method,errorMessage:i.message})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(r.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof UW)switch(e){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink();break}}publishWeb3RequestCanceledEvent(e){const r={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",r,!1).then()}publishEvent(e,r,n){return this.connection.publishEvent(e,r,n)}handleWeb3ResponseMessage(e,r){if(r.method==="requestEthereumAccounts"){tu.accountRequestCallbackIds.forEach(n=>this.invokeCallback(n,r)),tu.accountRequestCallbackIds.clear();return}this.invokeCallback(e,r)}handleErrorResponse(e,r,n){var i;const s=(i=n==null?void 0:n.message)!==null&&i!==void 0?i:"Unspecified error message.";this.handleWeb3ResponseMessage(e,{method:r,errorMessage:s})}invokeCallback(e,r){const n=this.relayEventManager.callbacks.get(e);n&&(n(r),this.relayEventManager.callbacks.delete(e))}requestEthereumAccounts(){const{appName:e,appLogoUrl:r}=this.metadata,n={method:"requestEthereumAccounts",params:{appName:e,appLogoUrl:r}},i=Wh(8);return new Promise((s,o)=>{this.relayEventManager.callbacks.set(i,a=>{if(Mn(a))return o(new Error(a.errorMessage));s(a)}),tu.accountRequestCallbackIds.add(i),this.publishWeb3RequestEvent(i,n)})}watchAsset(e,r,n,i,s,o){const a={method:"watchAsset",params:{type:e,options:{address:r,symbol:n,decimals:i,image:s},chainId:o}};let c=null;const u=Wh(8),l=d=>{this.publishWeb3RequestCanceledEvent(u),this.handleErrorResponse(u,a.method,d),c==null||c()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:l,onResetConnection:this.resetAndReload}),new Promise((d,h)=>{this.relayEventManager.callbacks.set(u,f=>{if(c==null||c(),Mn(f))return h(new Error(f.errorMessage));d(f)}),this.publishWeb3RequestEvent(u,a)})}addEthereumChain(e,r,n,i,s,o){const a={method:"addEthereumChain",params:{chainId:e,rpcUrls:r,blockExplorerUrls:i,chainName:s,iconUrls:n,nativeCurrency:o}};let c=null;const u=Wh(8),l=d=>{this.publishWeb3RequestCanceledEvent(u),this.handleErrorResponse(u,a.method,d),c==null||c()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:l,onResetConnection:this.resetAndReload}),new Promise((d,h)=>{this.relayEventManager.callbacks.set(u,f=>{if(c==null||c(),Mn(f))return h(new Error(f.errorMessage));d(f)}),this.publishWeb3RequestEvent(u,a)})}switchEthereumChain(e,r){const n={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:r})};let i=null;const s=Wh(8),o=a=>{this.publishWeb3RequestCanceledEvent(s),this.handleErrorResponse(s,n.method,a),i==null||i()};return i=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:o,onResetConnection:this.resetAndReload}),new Promise((a,c)=>{this.relayEventManager.callbacks.set(s,u=>{if(i==null||i(),Mn(u)&&u.errorCode)return c(Mt.provider.custom({code:u.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if(Mn(u))return c(new Error(u.errorMessage));a(u)}),this.publishWeb3RequestEvent(s,n)})}}tu.accountRequestCallbackIds=new Set;const FW="DefaultChainId",HW="DefaultJsonRpcUrl";class Dee{constructor(e){this._relay=null,this._addresses=[],this.metadata=e.metadata,this._storage=new ac("walletlink",LW),this.callback=e.callback||null;const r=this._storage.getItem(w9);if(r){const n=r.split(" ");n[0]!==""&&(this._addresses=n.map(i=>kl(i)))}this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:r,secret:n}=e.getWalletLinkSession();return{id:r,secret:n}}async handshake(){await this._eth_requestAccounts()}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return(e=this._storage.getItem(HW))!==null&&e!==void 0?e:void 0}set jsonRpcUrl(e){this._storage.setItem(HW,e)}updateProviderInfo(e,r){var n;this.jsonRpcUrl=e;const i=this.getChainId();this._storage.setItem(FW,r.toString(10)),Ab(r)!==i&&((n=this.callback)===null||n===void 0||n.call(this,"chainChanged",od(r)))}async watchAsset(e){const r=Array.isArray(e)?e[0]:e;if(!r.type)throw Mt.rpc.invalidParams("Type is required");if((r==null?void 0:r.type)!=="ERC20")throw Mt.rpc.invalidParams(`Asset of type '${r.type}' is not supported`);if(!(r!=null&&r.options))throw Mt.rpc.invalidParams("Options are required");if(!(r!=null&&r.options.address))throw Mt.rpc.invalidParams("Address is required");const n=this.getChainId(),{address:i,symbol:s,image:o,decimals:a}=r.options,u=await this.initializeRelay().watchAsset(r.type,i,s,a,o,n==null?void 0:n.toString());return Mn(u)?!1:!!u.result}async addEthereumChain(e){var r,n;const i=e[0];if(((r=i.rpcUrls)===null||r===void 0?void 0:r.length)===0)throw Mt.rpc.invalidParams("please pass in at least 1 rpcUrl");if(!i.chainName||i.chainName.trim()==="")throw Mt.rpc.invalidParams("chainName is a required field");if(!i.nativeCurrency)throw Mt.rpc.invalidParams("nativeCurrency is a required field");const s=Number.parseInt(i.chainId,16);if(s===this.getChainId())return!1;const o=this.initializeRelay(),{rpcUrls:a=[],blockExplorerUrls:c=[],chainName:u,iconUrls:l=[],nativeCurrency:d}=i,h=await o.addEthereumChain(s.toString(),a,l,c,u,d);if(Mn(h))return!1;if(((n=h.result)===null||n===void 0?void 0:n.isApproved)===!0)return this.updateProviderInfo(a[0],s),null;throw Mt.rpc.internal("unable to add ethereum chain")}async switchEthereumChain(e){const r=e[0],n=Number.parseInt(r.chainId,16),s=await this.initializeRelay().switchEthereumChain(n.toString(10),this.selectedAddress||void 0);if(Mn(s))throw s;const o=s.result;return o.isApproved&&o.rpcUrl.length>0&&this.updateProviderInfo(o.rpcUrl,n),null}async cleanup(){this.callback=null,this._relay&&this._relay.resetAndReload(),this._storage.clear()}_setAddresses(e,r){var n;if(!Array.isArray(e))throw new Error("addresses is not an array");const i=e.map(s=>kl(s));JSON.stringify(i)!==JSON.stringify(this._addresses)&&(this._addresses=i,(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",i),this._storage.setItem(w9,i.join(" ")))}async request(e){const r=e.params||[];switch(e.method){case"eth_accounts":return[...this._addresses];case"eth_coinbase":return this.selectedAddress||null;case"net_version":return this.getChainId().toString(10);case"eth_chainId":return od(this.getChainId());case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_ecRecover":case"personal_ecRecover":return this.ecRecover(e);case"personal_sign":return this.personalSign(e);case"eth_signTransaction":return this._eth_signTransaction(r);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(r);case"eth_sendTransaction":return this._eth_sendTransaction(r);case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":return this.signTypedData(e);case"wallet_addEthereumChain":return this.addEthereumChain(r);case"wallet_switchEthereumChain":return this.switchEthereumChain(r);case"wallet_watchAsset":return this.watchAsset(r);default:if(!this.jsonRpcUrl)throw Mt.rpc.internal("No RPC URL set for chain");return mR(e,this.jsonRpcUrl)}}_ensureKnownAddress(e){const r=kl(e);if(!this._addresses.map(i=>kl(i)).includes(r))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const r=e.from?kl(e.from):this.selectedAddress;if(!r)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(r);const n=e.to?kl(e.to):null,i=e.value!=null?Xw(e.value):BigInt(0),s=e.data?m9(e.data):Buffer.alloc(0),o=e.nonce!=null?Ab(e.nonce):null,a=e.gasPrice!=null?Xw(e.gasPrice):null,c=e.maxFeePerGas!=null?Xw(e.maxFeePerGas):null,u=e.maxPriorityFeePerGas!=null?Xw(e.maxPriorityFeePerGas):null,l=e.gas!=null?Xw(e.gas):null,d=e.chainId?Ab(e.chainId):this.getChainId();return{fromAddress:r,toAddress:n,weiValue:i,data:s,nonce:o,gasPriceInWei:a,maxFeePerGas:c,maxPriorityFeePerGas:u,gasLimit:l,chainId:d}}async ecRecover(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Mt.rpc.invalidParams();const s=await this.initializeRelay().sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:DT(n[0]),signature:DT(n[1]),addPrefix:r==="personal_ecRecover"}});if(Mn(s))throw s;return s.result}getChainId(){var e;return Number.parseInt((e=this._storage.getItem(FW))!==null&&e!==void 0?e:"1",10)}async _eth_requestAccounts(){var e,r;if(this._addresses.length>0)return(e=this.callback)===null||e===void 0||e.call(this,"connect",{chainId:od(this.getChainId())}),this._addresses;const i=await this.initializeRelay().requestEthereumAccounts();if(Mn(i))throw i;if(!i.result)throw new Error("accounts received is empty");return this._setAddresses(i.result),(r=this.callback)===null||r===void 0||r.call(this,"connect",{chainId:od(this.getChainId())}),this._addresses}async personalSign({params:e}){if(!Array.isArray(e))throw Mt.rpc.invalidParams();const r=e[1],n=e[0];this._ensureKnownAddress(r);const s=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:kl(r),message:DT(n),addPrefix:!0,typedDataJson:null}});if(Mn(s))throw s;return s.result}async _eth_signTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signEthereumTransaction(r);if(Mn(i))throw i;return i.result}async _eth_sendRawTransaction(e){const r=m9(e[0]),i=await this.initializeRelay().submitEthereumTransaction(r,this.getChainId());if(Mn(i))throw i;return i.result}async _eth_sendTransaction(e){const r=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signAndSubmitEthereumTransaction(r);if(Mn(i))throw i;return i.result}async signTypedData(e){const{method:r,params:n}=e;if(!Array.isArray(n))throw Mt.rpc.invalidParams();const i=u=>{const l={eth_signTypedData_v1:L4.hashForSignTypedDataLegacy,eth_signTypedData_v3:L4.hashForSignTypedData_v3,eth_signTypedData_v4:L4.hashForSignTypedData_v4,eth_signTypedData:L4.hashForSignTypedData_v4};return Cb(l[r]({data:Y9e(u)}),!0)},s=n[r==="eth_signTypedData_v1"?1:0],o=n[r==="eth_signTypedData_v1"?0:1];this._ensureKnownAddress(s);const c=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:kl(s),message:i(o),typedDataJson:JSON.stringify(o,null,2),addPrefix:!1}});if(Mn(c))throw c;return c.result}initializeRelay(){return this._relay||(this._relay=new tu({linkAPIUrl:LW,storage:this._storage,metadata:this.metadata,accountsCallback:this._setAddresses.bind(this),chainCallback:this.updateProviderInfo.bind(this)})),this._relay}}const Mee="SignerType",Lee=new ac("CBWSDK","SignerConfigurator");function G7e(){return Lee.getItem(Mee)}function K7e(t){Lee.setItem(Mee,t)}async function Z7e(t){const{communicator:e,metadata:r,handshakeRequest:n,callback:i}=t;J7e(e,r,i).catch(()=>{});const s={id:crypto.randomUUID(),event:"selectSignerType",data:Object.assign(Object.assign({},t.preference),{handshakeRequest:n})},{data:o}=await e.postRequestAndWaitForResponse(s);return o}function Y7e(t){const{signerType:e,metadata:r,communicator:n,callback:i}=t;switch(e){case"scw":return new u7e({metadata:r,callback:i,communicator:n});case"walletlink":return new Dee({metadata:r,callback:i})}}async function J7e(t,e,r){await t.onMessage(({event:i})=>i==="WalletLinkSessionRequest");const n=new Dee({metadata:e,callback:r});t.postMessage({event:"WalletLinkUpdate",data:{session:n.getSession()}}),await n.handshake(),t.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}const Q7e=`Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app. Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`,X7e=()=>{let t;return{getCrossOriginOpenerPolicy:()=>t===void 0?"undefined":t,checkCrossOriginOpenerPolicy:async()=>{if(typeof window>"u"){t="non-browser-env";return}try{const e=`${window.location.origin}${window.location.pathname}`,r=await fetch(e,{method:"HEAD"});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);const n=r.headers.get("Cross-Origin-Opener-Policy");t=n??"null",t==="same-origin"&&console.error(Q7e)}catch(e){console.error("Error checking Cross-Origin-Opener-Policy:",e.message),t="error"}}}},{checkCrossOriginOpenerPolicy:eOe,getCrossOriginOpenerPolicy:tOe}=X7e(),qW=420,zW=540;function rOe(t){const e=(window.innerWidth-qW)/2+window.screenX,r=(window.innerHeight-zW)/2+window.screenY;iOe(t);const n=`wallet_${crypto.randomUUID()}`,i=window.open(t,n,`width=${qW}, height=${zW}, left=${e}, top=${r}`);if(i==null||i.focus(),!i)throw Mt.rpc.internal("Pop up window failed to open");return i}function nOe(t){t&&!t.closed&&t.close()}function iOe(t){const e={sdkName:wee,sdkVersion:L2,origin:window.location.origin,coop:tOe()};for(const[r,n]of Object.entries(e))t.searchParams.append(r,n.toString())}class sOe{constructor({url:e=z7e,metadata:r,preference:n}){this.popup=null,this.listeners=new Map,this.postMessage=async i=>{(await this.waitForPopupLoaded()).postMessage(i,this.url.origin)},this.postRequestAndWaitForResponse=async i=>{const s=this.onMessage(({requestId:o})=>o===i.id);return this.postMessage(i),await s},this.onMessage=async i=>new Promise((s,o)=>{const a=c=>{if(c.origin!==this.url.origin)return;const u=c.data;i(u)&&(s(u),window.removeEventListener("message",a),this.listeners.delete(a))};window.addEventListener("message",a),this.listeners.set(a,{reject:o})}),this.disconnect=()=>{nOe(this.popup),this.popup=null,this.listeners.forEach(({reject:i},s)=>{i(Mt.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",s)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(this.popup=rOe(this.url),this.onMessage(({event:i})=>i==="PopupUnload").then(this.disconnect).catch(()=>{}),this.onMessage(({event:i})=>i==="PopupLoaded").then(i=>{this.postMessage({requestId:i.id,data:{version:L2,metadata:this.metadata,preference:this.preference,location:window.location.toString()}})}).then(()=>{if(!this.popup)throw Mt.rpc.internal();return this.popup})),this.url=new URL(e),this.metadata=r,this.preference=n}}function oOe(t){const e=W9e(aOe(t),{shouldIncludeStack:!0}),r=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");return r.searchParams.set("version",L2),r.searchParams.set("code",e.code.toString()),r.searchParams.set("message",e.message),Object.assign(Object.assign({},e),{docUrl:r.href})}function aOe(t){var e;if(typeof t=="string")return{message:t,code:Wr.rpc.internal};if(Mn(t)){const r=t.errorMessage,n=(e=t.errorCode)!==null&&e!==void 0?e:r.match(/(denied|rejected)/i)?Wr.provider.userRejectedRequest:void 0;return Object.assign(Object.assign({},t),{message:r,code:n,data:{method:t.method}})}return t}var WT={exports:{}},WW;function cOe(){return WW||(WW=1,function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(c,u,l){this.fn=c,this.context=u,this.once=l||!1}function s(c,u,l,d,h){if(typeof l!="function")throw new TypeError("The listener must be a function");var f=new i(l,d||c,h),g=r?r+u:u;return c._events[g]?c._events[g].fn?c._events[g]=[c._events[g],f]:c._events[g].push(f):(c._events[g]=f,c._eventsCount++),c}function o(c,u){--c._eventsCount===0?c._events=new n:delete c._events[u]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var u=[],l,d;if(this._eventsCount===0)return u;for(d in l=this._events)e.call(l,d)&&u.push(r?d.slice(1):d);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(l)):u},a.prototype.listeners=function(u){var l=r?r+u:u,d=this._events[l];if(!d)return[];if(d.fn)return[d.fn];for(var h=0,f=d.length,g=new Array(f);h(i||(i=gOe(n)),i)}}const bOe=Object.freeze(Object.defineProperty({__proto__:null,createCoinbaseWalletSDK:wOe},Symbol.toStringTag,{value:"Module"})),yOe=Se` `,vOe=Object.freeze(Object.defineProperty({__proto__:null,addSvg:yOe},Symbol.toStringTag,{value:"Module"})),_Oe=Se` `,EOe=Object.freeze(Object.defineProperty({__proto__:null,allWalletsSvg:_Oe},Symbol.toStringTag,{value:"Module"})),COe=Se` `,AOe=Object.freeze(Object.defineProperty({__proto__:null,arrowBottomCircleSvg:COe},Symbol.toStringTag,{value:"Module"})),xOe=Se` `,SOe=Object.freeze(Object.defineProperty({__proto__:null,appStoreSvg:xOe},Symbol.toStringTag,{value:"Module"})),TOe=Se` `,IOe=Object.freeze(Object.defineProperty({__proto__:null,appleSvg:TOe},Symbol.toStringTag,{value:"Module"})),POe=Se` `,OOe=Object.freeze(Object.defineProperty({__proto__:null,arrowBottomSvg:POe},Symbol.toStringTag,{value:"Module"})),ROe=Se` `,kOe=Object.freeze(Object.defineProperty({__proto__:null,arrowLeftSvg:ROe},Symbol.toStringTag,{value:"Module"})),NOe=Se` `,$Oe=Object.freeze(Object.defineProperty({__proto__:null,arrowRightSvg:NOe},Symbol.toStringTag,{value:"Module"})),jOe=Se` `,BOe=Object.freeze(Object.defineProperty({__proto__:null,arrowTopSvg:jOe},Symbol.toStringTag,{value:"Module"})),DOe=Se` `,MOe=Object.freeze(Object.defineProperty({__proto__:null,bankSvg:DOe},Symbol.toStringTag,{value:"Module"})),LOe=Se` `,UOe=Object.freeze(Object.defineProperty({__proto__:null,browserSvg:LOe},Symbol.toStringTag,{value:"Module"})),FOe=Se` `,HOe=Object.freeze(Object.defineProperty({__proto__:null,cardSvg:FOe},Symbol.toStringTag,{value:"Module"})),qOe=Se` `,zOe=Object.freeze(Object.defineProperty({__proto__:null,checkmarkSvg:qOe},Symbol.toStringTag,{value:"Module"})),WOe=Se` `,VOe=Object.freeze(Object.defineProperty({__proto__:null,checkmarkBoldSvg:WOe},Symbol.toStringTag,{value:"Module"})),GOe=Se` `,KOe=Object.freeze(Object.defineProperty({__proto__:null,chevronBottomSvg:GOe},Symbol.toStringTag,{value:"Module"})),ZOe=Se` `,YOe=Object.freeze(Object.defineProperty({__proto__:null,chevronLeftSvg:ZOe},Symbol.toStringTag,{value:"Module"})),JOe=Se` `,QOe=Object.freeze(Object.defineProperty({__proto__:null,chevronRightSvg:JOe},Symbol.toStringTag,{value:"Module"})),XOe=Se` `,eRe=Object.freeze(Object.defineProperty({__proto__:null,chevronTopSvg:XOe},Symbol.toStringTag,{value:"Module"})),tRe=Se` `,rRe=Object.freeze(Object.defineProperty({__proto__:null,chromeStoreSvg:tRe},Symbol.toStringTag,{value:"Module"})),nRe=Se` `,iRe=Object.freeze(Object.defineProperty({__proto__:null,clockSvg:nRe},Symbol.toStringTag,{value:"Module"})),sRe=Se` `,oRe=Object.freeze(Object.defineProperty({__proto__:null,closeSvg:sRe},Symbol.toStringTag,{value:"Module"})),aRe=Se` `,cRe=Object.freeze(Object.defineProperty({__proto__:null,compassSvg:aRe},Symbol.toStringTag,{value:"Module"})),uRe=Se` `,lRe=Object.freeze(Object.defineProperty({__proto__:null,coinPlaceholderSvg:uRe},Symbol.toStringTag,{value:"Module"})),dRe=Se` `,hRe=Object.freeze(Object.defineProperty({__proto__:null,copySvg:dRe},Symbol.toStringTag,{value:"Module"})),fRe=Se` `,pRe=Object.freeze(Object.defineProperty({__proto__:null,cursorSvg:fRe},Symbol.toStringTag,{value:"Module"})),gRe=Se` `,mRe=Object.freeze(Object.defineProperty({__proto__:null,cursorTransparentSvg:gRe},Symbol.toStringTag,{value:"Module"})),wRe=Se` `,bRe=Object.freeze(Object.defineProperty({__proto__:null,desktopSvg:wRe},Symbol.toStringTag,{value:"Module"})),yRe=Se` `,vRe=Object.freeze(Object.defineProperty({__proto__:null,disconnectSvg:yRe},Symbol.toStringTag,{value:"Module"})),_Re=Se` `,ERe=Object.freeze(Object.defineProperty({__proto__:null,discordSvg:_Re},Symbol.toStringTag,{value:"Module"})),CRe=Se` `,ARe=Object.freeze(Object.defineProperty({__proto__:null,etherscanSvg:CRe},Symbol.toStringTag,{value:"Module"})),xRe=Se` `,SRe=Object.freeze(Object.defineProperty({__proto__:null,extensionSvg:xRe},Symbol.toStringTag,{value:"Module"})),TRe=Se` `,IRe=Object.freeze(Object.defineProperty({__proto__:null,externalLinkSvg:TRe},Symbol.toStringTag,{value:"Module"})),PRe=Se` `,ORe=Object.freeze(Object.defineProperty({__proto__:null,facebookSvg:PRe},Symbol.toStringTag,{value:"Module"})),RRe=Se` `,kRe=Object.freeze(Object.defineProperty({__proto__:null,farcasterSvg:RRe},Symbol.toStringTag,{value:"Module"})),NRe=Se` `,$Re=Object.freeze(Object.defineProperty({__proto__:null,filtersSvg:NRe},Symbol.toStringTag,{value:"Module"})),jRe=Se` `,BRe=Object.freeze(Object.defineProperty({__proto__:null,githubSvg:jRe},Symbol.toStringTag,{value:"Module"})),DRe=Se` `,MRe=Object.freeze(Object.defineProperty({__proto__:null,googleSvg:DRe},Symbol.toStringTag,{value:"Module"})),LRe=Se` `,URe=Object.freeze(Object.defineProperty({__proto__:null,helpCircleSvg:LRe},Symbol.toStringTag,{value:"Module"})),FRe=Se` `,HRe=Object.freeze(Object.defineProperty({__proto__:null,imageSvg:FRe},Symbol.toStringTag,{value:"Module"})),qRe=Se` `,zRe=Object.freeze(Object.defineProperty({__proto__:null,idSvg:qRe},Symbol.toStringTag,{value:"Module"})),WRe=Se` `,VRe=Object.freeze(Object.defineProperty({__proto__:null,infoCircleSvg:WRe},Symbol.toStringTag,{value:"Module"})),GRe=Se` `,KRe=Object.freeze(Object.defineProperty({__proto__:null,lightbulbSvg:GRe},Symbol.toStringTag,{value:"Module"})),ZRe=Se` `,YRe=Object.freeze(Object.defineProperty({__proto__:null,mailSvg:ZRe},Symbol.toStringTag,{value:"Module"})),JRe=Se` `,QRe=Object.freeze(Object.defineProperty({__proto__:null,mobileSvg:JRe},Symbol.toStringTag,{value:"Module"})),XRe=Se` `,eke=Object.freeze(Object.defineProperty({__proto__:null,moreSvg:XRe},Symbol.toStringTag,{value:"Module"})),tke=Se` `,rke=Object.freeze(Object.defineProperty({__proto__:null,networkPlaceholderSvg:tke},Symbol.toStringTag,{value:"Module"})),nke=Se` `,ike=Object.freeze(Object.defineProperty({__proto__:null,nftPlaceholderSvg:nke},Symbol.toStringTag,{value:"Module"})),ske=Se` `,oke=Object.freeze(Object.defineProperty({__proto__:null,offSvg:ske},Symbol.toStringTag,{value:"Module"})),ake=Se` `,cke=Object.freeze(Object.defineProperty({__proto__:null,playStoreSvg:ake},Symbol.toStringTag,{value:"Module"})),uke=Se` `,lke=Object.freeze(Object.defineProperty({__proto__:null,plusSvg:uke},Symbol.toStringTag,{value:"Module"})),dke=Se` `,hke=Object.freeze(Object.defineProperty({__proto__:null,qrCodeIcon:dke},Symbol.toStringTag,{value:"Module"})),fke=Se` `,pke=Object.freeze(Object.defineProperty({__proto__:null,recycleHorizontalSvg:fke},Symbol.toStringTag,{value:"Module"})),gke=Se` `,mke=Object.freeze(Object.defineProperty({__proto__:null,refreshSvg:gke},Symbol.toStringTag,{value:"Module"})),wke=Se` `,bke=Object.freeze(Object.defineProperty({__proto__:null,searchSvg:wke},Symbol.toStringTag,{value:"Module"})),yke=Se` `,vke=Object.freeze(Object.defineProperty({__proto__:null,sendSvg:yke},Symbol.toStringTag,{value:"Module"})),_ke=Se` `,Eke=Object.freeze(Object.defineProperty({__proto__:null,swapHorizontalSvg:_ke},Symbol.toStringTag,{value:"Module"})),Cke=Se` `,Ake=Object.freeze(Object.defineProperty({__proto__:null,swapHorizontalMediumSvg:Cke},Symbol.toStringTag,{value:"Module"})),xke=Se` `,Ske=Object.freeze(Object.defineProperty({__proto__:null,swapHorizontalBoldSvg:xke},Symbol.toStringTag,{value:"Module"})),Tke=Se` `,Ike=Object.freeze(Object.defineProperty({__proto__:null,swapHorizontalRoundedBoldSvg:Tke},Symbol.toStringTag,{value:"Module"})),Pke=Se` `,Oke=Object.freeze(Object.defineProperty({__proto__:null,swapVerticalSvg:Pke},Symbol.toStringTag,{value:"Module"})),Rke=Se` `,kke=Object.freeze(Object.defineProperty({__proto__:null,telegramSvg:Rke},Symbol.toStringTag,{value:"Module"})),Nke=Se` `,$ke=Object.freeze(Object.defineProperty({__proto__:null,threeDotsSvg:Nke},Symbol.toStringTag,{value:"Module"})),jke=Se` `,Bke=Object.freeze(Object.defineProperty({__proto__:null,twitchSvg:jke},Symbol.toStringTag,{value:"Module"})),Dke=Se` `,VW=Object.freeze(Object.defineProperty({__proto__:null,xSvg:Dke},Symbol.toStringTag,{value:"Module"})),Mke=Se` `,Lke=Object.freeze(Object.defineProperty({__proto__:null,twitterIconSvg:Mke},Symbol.toStringTag,{value:"Module"})),Uke=Se` `,Fke=Object.freeze(Object.defineProperty({__proto__:null,verifySvg:Uke},Symbol.toStringTag,{value:"Module"})),Hke=Se` `,qke=Object.freeze(Object.defineProperty({__proto__:null,verifyFilledSvg:Hke},Symbol.toStringTag,{value:"Module"})),zke=Se` `,Wke=Object.freeze(Object.defineProperty({__proto__:null,walletSvg:zke},Symbol.toStringTag,{value:"Module"})),Vke=Se` `,Gke=Se` `,Kke=Se` `,VT=Object.freeze(Object.defineProperty({__proto__:null,walletConnectBrownSvg:Kke,walletConnectLightBrownSvg:Gke,walletConnectSvg:Vke},Symbol.toStringTag,{value:"Module"})),Zke=Se` `,Yke=Object.freeze(Object.defineProperty({__proto__:null,walletPlaceholderSvg:Zke},Symbol.toStringTag,{value:"Module"})),Jke=Se` `,Qke=Object.freeze(Object.defineProperty({__proto__:null,warningCircleSvg:Jke},Symbol.toStringTag,{value:"Module"})),Xke=Se` `,eNe=Object.freeze(Object.defineProperty({__proto__:null,infoSvg:Xke},Symbol.toStringTag,{value:"Module"})),tNe=Se` `,rNe=Object.freeze(Object.defineProperty({__proto__:null,exclamationTriangleSvg:tNe},Symbol.toStringTag,{value:"Module"})),nNe=Se` `,iNe=Object.freeze(Object.defineProperty({__proto__:null,reownSvg:nNe},Symbol.toStringTag,{value:"Module"}))});export default sNe();