browser-rpc 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -18
- package/dist/index.js +49 -3
- package/package.json +1 -1
- package/web-dist/assets/{add-Bt6ug9as.js → add-CSurud0_.js} +1 -1
- package/web-dist/assets/{all-wallets-ClkSG7YV.js → all-wallets-CuPxktej.js} +1 -1
- package/web-dist/assets/{app-store-BnzgCmML.js → app-store-Bh7SMjK6.js} +1 -1
- package/web-dist/assets/{apple-D3CNMHuT.js → apple-C4EgoShq.js} +1 -1
- package/web-dist/assets/{arrow-bottom-BrYwqDZR.js → arrow-bottom-CzdtCJaR.js} +1 -1
- package/web-dist/assets/{arrow-bottom-circle-CBoHFkqN.js → arrow-bottom-circle-CzKcAzTC.js} +1 -1
- package/web-dist/assets/{arrow-left-CHVgplmz.js → arrow-left-DCA-23-P.js} +1 -1
- package/web-dist/assets/{arrow-right-Do5EdrXQ.js → arrow-right-DjWMZCbU.js} +1 -1
- package/web-dist/assets/{arrow-top-BOPLd2d5.js → arrow-top-DdmR7t9T.js} +1 -1
- package/web-dist/assets/{bank-DafdJl1O.js → bank-C_5L-YDS.js} +1 -1
- package/web-dist/assets/{basic-CLeG2Fx1.js → basic-CqHaUvPy.js} +1 -1
- package/web-dist/assets/{browser-DRuHXezx.js → browser-DrecPVgr.js} +1 -1
- package/web-dist/assets/{card-YgaTGJnf.js → card-B8Kpmq0P.js} +1 -1
- package/web-dist/assets/{ccip-ConwrR6S.js → ccip-DULOFBuD.js} +1 -1
- package/web-dist/assets/{ccip-B4x4TU0w.js → ccip-JXkAn6l_.js} +1 -1
- package/web-dist/assets/{checkmark-bold-b4BEKMa-.js → checkmark-bold-C5CQv-Aa.js} +1 -1
- package/web-dist/assets/{checkmark-Dgr_oUfC.js → checkmark-pd5FsFzg.js} +1 -1
- package/web-dist/assets/{chevron-bottom-BlzLXicX.js → chevron-bottom-BLvDr8vF.js} +1 -1
- package/web-dist/assets/{chevron-left-DWsjEedN.js → chevron-left-Bn5fXcit.js} +1 -1
- package/web-dist/assets/{chevron-right-B-GnUH_e.js → chevron-right-Bp7Npo8k.js} +1 -1
- package/web-dist/assets/{chevron-top-lK6t2THp.js → chevron-top-DC_l4mwZ.js} +1 -1
- package/web-dist/assets/{chrome-store-CbBGk8YS.js → chrome-store-B0wZ3pqA.js} +1 -1
- package/web-dist/assets/{clock-ByEA0e_s.js → clock-l4cNQcqu.js} +1 -1
- package/web-dist/assets/{close-BxDaavrr.js → close-DGUe_y81.js} +1 -1
- package/web-dist/assets/{coinPlaceholder-B9aaOU5j.js → coinPlaceholder-BP01UQKP.js} +1 -1
- package/web-dist/assets/{compass-CBP6oSW9.js → compass-o-R_PR5i.js} +1 -1
- package/web-dist/assets/{copy-Dp304nbr.js → copy-BAr81PLi.js} +1 -1
- package/web-dist/assets/{core-Bf6VrE6v.js → core-D7szIsgf.js} +4 -4
- package/web-dist/assets/{cursor-WUohjLCE.js → cursor-D3GZTRrk.js} +1 -1
- package/web-dist/assets/{cursor-transparent-CutfCQQz.js → cursor-transparent-DljOOQBY.js} +1 -1
- package/web-dist/assets/{desktop-kZiy9C-p.js → desktop-jiAHOLvJ.js} +1 -1
- package/web-dist/assets/{disconnect-CG5TDY_m.js → disconnect-CS8uxHay.js} +1 -1
- package/web-dist/assets/{discord-JyHSI7q0.js → discord-DHnKyemy.js} +1 -1
- package/web-dist/assets/{etherscan-CyB1NBm9.js → etherscan-CVkxPkFS.js} +1 -1
- package/web-dist/assets/{exclamation-triangle-7y5nglSL.js → exclamation-triangle-CS4ruWfK.js} +1 -1
- package/web-dist/assets/{extension-BjB3--xE.js → extension-DnLfOwO6.js} +1 -1
- package/web-dist/assets/{external-link-BW0O7z6_.js → external-link-D-P_33dB.js} +1 -1
- package/web-dist/assets/{facebook-682BXGmP.js → facebook-jLzamRKN.js} +1 -1
- package/web-dist/assets/{farcaster-BOaaCMAh.js → farcaster-B4A0ZZeM.js} +1 -1
- package/web-dist/assets/{filters-DFWbfLJh.js → filters-2IeJyFyu.js} +1 -1
- package/web-dist/assets/{github-DpRqYyal.js → github-CYDpN-_e.js} +1 -1
- package/web-dist/assets/{google-CgUt7hYq.js → google-BZkNEgmj.js} +1 -1
- package/web-dist/assets/{help-circle-DwVgKpjs.js → help-circle-DMZ8-Cna.js} +1 -1
- package/web-dist/assets/{id-BaTvs6Gs.js → id-38gfBvri.js} +1 -1
- package/web-dist/assets/{image-BieDxoY2.js → image-C9_OStLn.js} +1 -1
- package/web-dist/assets/{index-C4Lbscxg.js → index--LSQjR_2.js} +66 -66
- package/web-dist/assets/{index-GJH9xypQ.css → index-CCSv1eAh.css} +1 -1
- package/web-dist/assets/{index-CteTNahN.js → index-Ccy1t-C4.js} +4 -4
- package/web-dist/assets/{index-aVimijSo.js → index-Cg8hiVbn.js} +3 -3
- package/web-dist/assets/{index-C5m0fBnu.js → index-CiTEL--Y.js} +1 -1
- package/web-dist/assets/{index-DgKl8WD4.js → index-QgYpnbyq.js} +1 -1
- package/web-dist/assets/{index-Burh8TwV.js → index-dCn6axXg.js} +1 -1
- package/web-dist/assets/{index.es-Me6_HSoS.js → index.es-C1H8G2CD.js} +4 -4
- package/web-dist/assets/{info-circle-Dgdf-_kY.js → info-circle-BTNeoxa6.js} +1 -1
- package/web-dist/assets/{info-CaUhPhOk.js → info-n2qoFrAe.js} +1 -1
- package/web-dist/assets/{lightbulb-h5NbP99t.js → lightbulb-Clk-Jmgu.js} +1 -1
- package/web-dist/assets/{mail-DUTW6gdU.js → mail-Cds1jWOG.js} +1 -1
- package/web-dist/assets/{mobile-BFFFlSgH.js → mobile-3m8bvDwV.js} +1 -1
- package/web-dist/assets/{more-s9g8TvGr.js → more-D4wapBmR.js} +1 -1
- package/web-dist/assets/{network-placeholder-DBVOULy6.js → network-placeholder-Byofvks3.js} +1 -1
- package/web-dist/assets/{nftPlaceholder-D8q6GiE5.js → nftPlaceholder-CZSQO35I.js} +1 -1
- package/web-dist/assets/{off-7mG5bayL.js → off-BwFiGI61.js} +1 -1
- package/web-dist/assets/{play-store-BFa605Jk.js → play-store-BGBmqVQP.js} +1 -1
- package/web-dist/assets/{plus-BgZ-WP7A.js → plus-CuD4QENc.js} +1 -1
- package/web-dist/assets/{qr-code-B_1WHzPs.js → qr-code-CmkeyQ3q.js} +1 -1
- package/web-dist/assets/{recycle-horizontal-CuuA7YIy.js → recycle-horizontal-Bro_qysx.js} +1 -1
- package/web-dist/assets/{refresh-CSXbxAuT.js → refresh-Edry900n.js} +1 -1
- package/web-dist/assets/{reown-logo-OK1pdOfH.js → reown-logo-BMZ4Cq9x.js} +1 -1
- package/web-dist/assets/{search-b77MGgNN.js → search-AVAp5Fyx.js} +1 -1
- package/web-dist/assets/{secp256k1-CqlnLpBV.js → secp256k1-BgQIr3rN.js} +1 -1
- package/web-dist/assets/{secp256k1-xC50DJGj.js → secp256k1-DekXzlV8.js} +1 -1
- package/web-dist/assets/{send-DlJtxaMX.js → send-4MYVLgeW.js} +1 -1
- package/web-dist/assets/{swapHorizontal-BmG4i-CJ.js → swapHorizontal-cVSOFLpi.js} +1 -1
- package/web-dist/assets/{swapHorizontalBold-CrnzAaq6.js → swapHorizontalBold-Bw-7VNbr.js} +1 -1
- package/web-dist/assets/{swapHorizontalMedium-DuPE93B2.js → swapHorizontalMedium-mcrKCBp-.js} +1 -1
- package/web-dist/assets/{swapHorizontalRoundedBold-clkEaP-W.js → swapHorizontalRoundedBold-BDxAi3q4.js} +1 -1
- package/web-dist/assets/{swapVertical-DXvCmf9g.js → swapVertical-BcwB3ulc.js} +1 -1
- package/web-dist/assets/{telegram-uHX2mx77.js → telegram-DuHUM8tr.js} +1 -1
- package/web-dist/assets/{three-dots-BoFVtYRM.js → three-dots-Aq6TxP_i.js} +1 -1
- package/web-dist/assets/{twitch-BbZVXa-k.js → twitch-C3_nAU2s.js} +1 -1
- package/web-dist/assets/{twitterIcon-DTDEnPwP.js → twitterIcon-xVvhgLtz.js} +1 -1
- package/web-dist/assets/{verify-DSwt0ow9.js → verify-Bk6Q4N8f.js} +1 -1
- package/web-dist/assets/{verify-filled-Dd2saJZ0.js → verify-filled-P4SRtWaq.js} +1 -1
- package/web-dist/assets/{w3m-modal-Dkca-GXY.js → w3m-modal-BV8xYuAk.js} +1 -1
- package/web-dist/assets/{wallet-DFQUKIzv.js → wallet-Cwos8iS9.js} +1 -1
- package/web-dist/assets/{wallet-placeholder-DBESmMOJ.js → wallet-placeholder-DZOZgWPG.js} +1 -1
- package/web-dist/assets/{walletconnect-Byk_h0ya.js → walletconnect-BEXWbbOU.js} +1 -1
- package/web-dist/assets/{warning-circle-BjOhgUMO.js → warning-circle-BjUwobMn.js} +1 -1
- package/web-dist/assets/{x-qhswnC92.js → x-CwzeXSXa.js} +1 -1
- package/web-dist/index.html +2 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/secp256k1-
|
|
2
|
-
import{_ as Yo}from"./index-C4Lbscxg.js";import{I as Yr,h as $h,i as Ot,j as ut,k as L,l as ls,C as Rh,m as Uh,n as vi,s as Xo,o as Pu,p as tr,q as cn,A as Ou,E as st,u as Dh,v as Lh,y as vt,x as zs,z as Xr,O as Da,B as kt,D as Mh,F as La,G as Ma,J as to,N as ja,P as ac,Q as jh,K as Bh,L as qh,M as cc,R as Or,S as ku,T as rs,U as Ht,V as ds,W as jt}from"./index.es-Me6_HSoS.js";var lc={};const H={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 lc<"u"?lc.NEXT_PUBLIC_SECURE_SITE_ORIGIN:void 0)||"https://secure.walletconnect.org"},Tu={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?.filter(s=>s.chainNamespace===e)||[]},getFirstNetworkByNamespace(t,e){return this.getNetworksByNamespace(t,e)[0]},getNetworkNameByCaipNetworkId(t,e){if(!e)return;const s=t.find(i=>i.caipNetworkId===e);if(s)return s.name;const[r]=e.split(":");return H.CHAIN_NAME_MAP?.[r]||void 0}};var zh=20,Fh=1,Js=1e6,uc=1e6,Wh=-7,Hh=21,Vh=!1,ln="[big.js] ",sr=ln+"Invalid ",so=sr+"decimal places",Kh=sr+"rounding mode",xu=ln+"Division by zero",ge={},Gt=void 0,Gh=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function $u(){function t(e){var s=this;if(!(s instanceof t))return e===Gt?$u():new t(e);if(e instanceof t)s.s=e.s,s.e=e.e,s.c=e.c.slice();else{if(typeof e!="string"){if(t.strict===!0&&typeof e!="bigint")throw TypeError(sr+"value");e=e===0&&1/e<0?"-0":String(e)}Jh(s,e)}s.constructor=t}return t.prototype=ge,t.DP=zh,t.RM=Fh,t.NE=Wh,t.PE=Hh,t.strict=Vh,t.roundDown=0,t.roundHalfUp=1,t.roundHalfEven=2,t.roundUp=3,t}function Jh(t,e){var s,r,i;if(!Gh.test(e))throw Error(sr+"number");for(t.s=e.charAt(0)=="-"?(e=e.slice(1),-1):1,(s=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(s<0&&(s=r),s+=+e.slice(r+1),e=e.substring(0,r)):s<0&&(s=e.length),i=e.length,r=0;r<i&&e.charAt(r)=="0";)++r;if(r==i)t.c=[t.e=0];else{for(;i>0&&e.charAt(--i)=="0";);for(t.e=s-r-1,t.c=[],s=0;r<=i;)t.c[s++]=+e.charAt(r++)}return t}function rr(t,e,s,r){var i=t.c;if(s===Gt&&(s=t.constructor.RM),s!==0&&s!==1&&s!==2&&s!==3)throw Error(Kh);if(e<1)r=s===3&&(r||!!i[0])||e===0&&(s===1&&i[0]>=5||s===2&&(i[0]>5||i[0]===5&&(r||i[1]!==Gt))),i.length=1,r?(t.e=t.e-e+1,i[0]=1):i[0]=t.e=0;else if(e<i.length){if(r=s===1&&i[e]>=5||s===2&&(i[e]>5||i[e]===5&&(r||i[e+1]!==Gt||i[e-1]&1))||s===3&&(r||!!i[0]),i.length=e,r){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 ir(t,e,s){var r=t.e,i=t.c.join(""),n=i.length;if(e)i=i.charAt(0)+(n>1?"."+i.slice(1):"")+(r<0?"e":"e+")+r;else if(r<0){for(;++r;)i="0"+i;i="0."+i}else if(r>0)if(++r>n)for(r-=n;r--;)i+="0";else r<n&&(i=i.slice(0,r)+"."+i.slice(r));else n>1&&(i=i.charAt(0)+"."+i.slice(1));return t.s<0&&s?"-"+i:i}ge.abs=function(){var t=new this.constructor(this);return t.s=1,t};ge.cmp=function(t){var e,s=this,r=s.c,i=(t=new s.constructor(t)).c,n=s.s,o=t.s,a=s.e,c=t.e;if(!r[0]||!i[0])return r[0]?n:i[0]?-o:0;if(n!=o)return n;if(e=n<0,a!=c)return a>c^e?1:-1;for(o=(a=r.length)<(c=i.length)?a:c,n=-1;++n<o;)if(r[n]!=i[n])return r[n]>i[n]^e?1:-1;return a==c?0:a>c^e?1:-1};ge.div=function(t){var e=this,s=e.constructor,r=e.c,i=(t=new s(t)).c,n=e.s==t.s?1:-1,o=s.DP;if(o!==~~o||o<0||o>Js)throw Error(so);if(!i[0])throw Error(xu);if(!r[0])return t.s=n,t.c=[t.e=0],t;var a,c,l,u,d,h=i.slice(),f=a=i.length,w=r.length,m=r.slice(0,a),g=m.length,y=t,b=y.c=[],E=0,_=o+(y.e=e.e-t.e)+1;for(y.s=n,n=_<0?0:_,h.unshift(0);g++<a;)m.push(0);do{for(l=0;l<10;l++){if(a!=(g=m.length))u=a>g?1:-1;else for(d=-1,u=0;++d<a;)if(i[d]!=m[d]){u=i[d]>m[d]?1:-1;break}if(u<0){for(c=g==a?i:h;g;){if(m[--g]<c[g]){for(d=g;d&&!m[--d];)m[d]=9;--m[d],m[g]+=10}m[g]-=c[g]}for(;!m[0];)m.shift()}else break}b[E++]=u?l:++l,m[0]&&u?m[g]=r[f]||0:m=[r[f]]}while((f++<w||m[0]!==Gt)&&n--);return!b[0]&&E!=1&&(b.shift(),y.e--,_--),E>_&&rr(y,_,s.RM,m[0]!==Gt),y};ge.eq=function(t){return this.cmp(t)===0};ge.gt=function(t){return this.cmp(t)>0};ge.gte=function(t){return this.cmp(t)>-1};ge.lt=function(t){return this.cmp(t)<0};ge.lte=function(t){return this.cmp(t)<1};ge.minus=ge.sub=function(t){var e,s,r,i,n=this,o=n.constructor,a=n.s,c=(t=new o(t)).s;if(a!=c)return t.s=-c,n.plus(t);var l=n.c.slice(),u=n.e,d=t.c,h=t.e;if(!l[0]||!d[0])return d[0]?t.s=-c:l[0]?t=new o(n):t.s=1,t;if(a=u-h){for((i=a<0)?(a=-a,r=l):(h=u,r=d),r.reverse(),c=a;c--;)r.push(0);r.reverse()}else for(s=((i=l.length<d.length)?l:d).length,a=c=0;c<s;c++)if(l[c]!=d[c]){i=l[c]<d[c];break}if(i&&(r=l,l=d,d=r,t.s=-t.s),(c=(s=d.length)-(e=l.length))>0)for(;c--;)l[e++]=0;for(c=e;s>a;){if(l[--s]<d[s]){for(e=s;e&&!l[--e];)l[e]=9;--l[e],l[s]+=10}l[s]-=d[s]}for(;l[--c]===0;)l.pop();for(;l[0]===0;)l.shift(),--h;return l[0]||(t.s=1,l=[h=0]),t.c=l,t.e=h,t};ge.mod=function(t){var e,s=this,r=s.constructor,i=s.s,n=(t=new r(t)).s;if(!t.c[0])throw Error(xu);return s.s=t.s=1,e=t.cmp(s)==1,s.s=i,t.s=n,e?new r(s):(i=r.DP,n=r.RM,r.DP=r.RM=0,s=s.div(t),r.DP=i,r.RM=n,this.minus(s.times(t)))};ge.neg=function(){var t=new this.constructor(this);return t.s=-t.s,t};ge.plus=ge.add=function(t){var e,s,r,i=this,n=i.constructor;if(t=new n(t),i.s!=t.s)return t.s=-t.s,i.minus(t);var o=i.e,a=i.c,c=t.e,l=t.c;if(!a[0]||!l[0])return l[0]||(a[0]?t=new n(i):t.s=i.s),t;if(a=a.slice(),e=o-c){for(e>0?(c=o,r=l):(e=-e,r=a),r.reverse();e--;)r.push(0);r.reverse()}for(a.length-l.length<0&&(r=l,l=a,a=r),e=l.length,s=0;e;a[e]%=10)s=(a[--e]=a[e]+l[e]+s)/10|0;for(s&&(a.unshift(s),++c),e=a.length;a[--e]===0;)a.pop();return t.c=a,t.e=c,t};ge.pow=function(t){var e=this,s=new e.constructor("1"),r=s,i=t<0;if(t!==~~t||t<-uc||t>uc)throw Error(sr+"exponent");for(i&&(t=-t);t&1&&(r=r.times(e)),t>>=1,!!t;)e=e.times(e);return i?s.div(r):r};ge.prec=function(t,e){if(t!==~~t||t<1||t>Js)throw Error(sr+"precision");return rr(new this.constructor(this),t,e)};ge.round=function(t,e){if(t===Gt)t=0;else if(t!==~~t||t<-Js||t>Js)throw Error(so);return rr(new this.constructor(this),t+this.e+1,e)};ge.sqrt=function(){var t,e,s,r=this,i=r.constructor,n=r.s,o=r.e,a=new i("0.5");if(!r.c[0])return new i(r);if(n<0)throw Error(ln+"No square root");n=Math.sqrt(+ir(r,!0,!0)),n===0||n===1/0?(e=r.c.join(""),e.length+o&1||(e+="0"),n=Math.sqrt(e),o=((o+1)/2|0)-(o<0||o&1),t=new i((n==1/0?"5e":(n=n.toExponential()).slice(0,n.indexOf("e")+1))+o)):t=new i(n+""),o=t.e+(i.DP+=4);do s=t,t=a.times(s.plus(r.div(s)));while(s.c.slice(0,o).join("")!==t.c.slice(0,o).join(""));return rr(t,(i.DP-=4)+t.e+1,i.RM)};ge.times=ge.mul=function(t){var e,s=this,r=s.constructor,i=s.c,n=(t=new r(t)).c,o=i.length,a=n.length,c=s.e,l=t.e;if(t.s=s.s==t.s?1:-1,!i[0]||!n[0])return t.c=[t.e=0],t;for(t.e=c+l,o<a&&(e=i,i=n,n=e,l=o,o=a,a=l),e=new Array(l=o+a);l--;)e[l]=0;for(c=a;c--;){for(a=0,l=o+c;l>c;)a=e[l]+n[c]*i[l-c-1]+a,e[l--]=a%10,a=a/10|0;e[l]=a}for(a?++t.e:e.shift(),c=e.length;!e[--c];)e.pop();return t.c=e,t};ge.toExponential=function(t,e){var s=this,r=s.c[0];if(t!==Gt){if(t!==~~t||t<0||t>Js)throw Error(so);for(s=rr(new s.constructor(s),++t,e);s.c.length<t;)s.c.push(0)}return ir(s,!0,!!r)};ge.toFixed=function(t,e){var s=this,r=s.c[0];if(t!==Gt){if(t!==~~t||t<0||t>Js)throw Error(so);for(s=rr(new s.constructor(s),t+s.e+1,e),t=t+s.e+1;s.c.length<t;)s.c.push(0)}return ir(s,!1,!!r)};ge[Symbol.for("nodejs.util.inspect.custom")]=ge.toJSON=ge.toString=function(){var t=this,e=t.constructor;return ir(t,t.e<=e.NE||t.e>=e.PE,!!t.c[0])};ge.toNumber=function(){var t=+ir(this,!0,!0);if(this.constructor.strict===!0&&!this.eq(t.toString()))throw Error(ln+"Imprecise conversion");return t};ge.toPrecision=function(t,e){var s=this,r=s.constructor,i=s.c[0];if(t!==Gt){if(t!==~~t||t<1||t>Js)throw Error(sr+"precision");for(s=rr(new r(s),t,e);s.c.length<t;)s.c.push(0)}return ir(s,t<=s.e||s.e<=r.NE||s.e>=r.PE,!!i)};ge.valueOf=function(){var t=this,e=t.constructor;if(e.strict===!0)throw Error(ln+"valueOf disallowed");return ir(t,t.e<=e.NE||t.e>=e.PE,!0)};var ii=$u();const Yh={bigNumber(t){return t?new ii(t):new ii(0)},multiply(t,e){if(t===void 0||e===void 0)return new ii(0);const s=new ii(t),r=new ii(e);return s.times(r)},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,""))}},Xh=[{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"}]}],Zh=[{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}],Qh=[{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"}]}],ep={getERC20Abi:t=>H.USDT_CONTRACT_ADDRESSES.includes(t)?Qh:Xh,getSwapAbi:()=>Zh},hs={validateCaipAddress(t){if(t.split(":")?.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[s,r,i]=e;if(!s||!r||!i)throw new Error(`Invalid CAIP-10 address: ${t}`);return{chainNamespace:s,chainId:r,address:i}},parseCaipNetworkId(t){const e=t.split(":");if(e.length!==2)throw new Error(`Invalid CAIP-2 network id: ${t}`);const[s,r]=e;if(!s||!r)throw new Error(`Invalid CAIP-2 network id: ${t}`);return{chainNamespace:s,chainId:r}}},ee={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 mo(t){if(!t)throw new Error("Namespace is required for CONNECTED_CONNECTOR_ID");return`@appkit/${t}:connected_connector_id`}const Z={setItem(t,e){fi()&&e!==void 0&&localStorage.setItem(t,e)},getItem(t){if(fi())return localStorage.getItem(t)||void 0},removeItem(t){fi()&&localStorage.removeItem(t)},clear(){fi()&&localStorage.clear()}};function fi(){return typeof window<"u"&&typeof localStorage<"u"}function Cs(t,e){return e==="light"?{"--w3m-accent":t?.["--w3m-accent"]||"hsla(231, 100%, 70%, 1)","--w3m-background":"#fff"}:{"--w3m-accent":t?.["--w3m-accent"]||"hsla(230, 100%, 67%, 1)","--w3m-background":"#121313"}}const tp=Symbol(),dc=Object.getPrototypeOf,Zo=new WeakMap,sp=t=>t&&(Zo.has(t)?Zo.get(t):dc(t)===Object.prototype||dc(t)===Array.prototype),rp=t=>sp(t)&&t[tp]||null,hc=(t,e=!0)=>{Zo.set(t,e)},Vn={},wo=t=>typeof t=="object"&&t!==null,ys=new WeakMap,gi=new WeakSet,ip=(t=Object.is,e=(l,u)=>new Proxy(l,u),s=l=>wo(l)&&!gi.has(l)&&(Array.isArray(l)||!(Symbol.iterator in l))&&!(l instanceof WeakMap)&&!(l instanceof WeakSet)&&!(l instanceof Error)&&!(l instanceof Number)&&!(l instanceof Date)&&!(l instanceof String)&&!(l instanceof RegExp)&&!(l instanceof ArrayBuffer),r=l=>{switch(l.status){case"fulfilled":return l.value;case"rejected":throw l.reason;default:throw l}},i=new WeakMap,n=(l,u,d=r)=>{const h=i.get(l);if(h?.[0]===u)return h[1];const f=Array.isArray(l)?[]:Object.create(Object.getPrototypeOf(l));return hc(f,!0),i.set(l,[u,f]),Reflect.ownKeys(l).forEach(w=>{if(Object.getOwnPropertyDescriptor(f,w))return;const m=Reflect.get(l,w),{enumerable:g}=Reflect.getOwnPropertyDescriptor(l,w),y={value:m,enumerable:g,configurable:!0};if(gi.has(m))hc(m,!1);else if(m instanceof Promise)delete y.value,y.get=()=>d(m);else if(ys.has(m)){const[b,E]=ys.get(m);y.value=n(b,E(),d)}Object.defineProperty(f,w,y)}),Object.preventExtensions(f)},o=new WeakMap,a=[1,1],c=l=>{if(!wo(l))throw new Error("object required");const u=o.get(l);if(u)return u;let d=a[0];const h=new Set,f=(v,$=++a[0])=>{d!==$&&(d=$,h.forEach(C=>C(v,$)))};let w=a[1];const m=(v=++a[1])=>(w!==v&&!h.size&&(w=v,y.forEach(([$])=>{const C=$[1](v);C>d&&(d=C)})),d),g=v=>($,C)=>{const R=[...$];R[1]=[v,...R[1]],f(R,C)},y=new Map,b=(v,$)=>{if((Vn?"production":void 0)!=="production"&&y.has(v))throw new Error("prop listener already exists");if(h.size){const C=$[3](g(v));y.set(v,[$,C])}else y.set(v,[$])},E=v=>{var $;const C=y.get(v);C&&(y.delete(v),($=C[1])==null||$.call(C))},_=v=>(h.add(v),h.size===1&&y.forEach(([C,R],W)=>{if((Vn?"production":void 0)!=="production"&&R)throw new Error("remove already exists");const N=C[3](g(W));y.set(W,[C,N])}),()=>{h.delete(v),h.size===0&&y.forEach(([C,R],W)=>{R&&(R(),y.set(W,[C]))})}),O=Array.isArray(l)?[]:Object.create(Object.getPrototypeOf(l)),I=e(O,{deleteProperty(v,$){const C=Reflect.get(v,$);E($);const R=Reflect.deleteProperty(v,$);return R&&f(["delete",[$],C]),R},set(v,$,C,R){const W=Reflect.has(v,$),N=Reflect.get(v,$,R);if(W&&(t(N,C)||o.has(C)&&t(N,o.get(C))))return!0;E($),wo(C)&&(C=rp(C)||C);let T=C;if(C instanceof Promise)C.then(P=>{C.status="fulfilled",C.value=P,f(["resolve",[$],P])}).catch(P=>{C.status="rejected",C.reason=P,f(["reject",[$],P])});else{!ys.has(C)&&s(C)&&(T=c(C));const P=!gi.has(T)&&ys.get(T);P&&b($,P)}return Reflect.set(v,$,T,R),f(["set",[$],C,N]),!0}});o.set(l,I);const U=[O,m,n,_];return ys.set(I,U),Reflect.ownKeys(l).forEach(v=>{const $=Object.getOwnPropertyDescriptor(l,v);"value"in $&&(I[v]=l[v],delete $.value,delete $.writable),Object.defineProperty(O,v,$)}),I})=>[c,ys,gi,t,e,s,r,i,n,o,a],[np]=ip();function _e(t={}){return np(t)}function Ze(t,e,s){const r=ys.get(t);(Vn?"production":void 0)!=="production"&&!r&&console.warn("Please use proxy object");let i;const n=[],o=r[3];let a=!1;const l=o(u=>{n.push(u),i||(i=Promise.resolve().then(()=>{i=void 0,a&&e(n.splice(0))}))});return a=!0,()=>{a=!1,l()}}function Ti(t,e){const s=ys.get(t);(Vn?"production":void 0)!=="production"&&!s&&console.warn("Please use proxy object");const[r,i,n]=s;return n(r,i(),e)}function Ys(t){return gi.add(t),t}function Qe(t,e,s,r){let i=t[e];return Ze(t,()=>{const n=t[e];Object.is(i,n)||s(i=n)})}function op(t){const e=_e({data:Array.from([]),has(s){return this.data.some(r=>r[0]===s)},set(s,r){const i=this.data.find(n=>n[0]===s);return i?i[1]=r:this.data.push([s,r]),this},get(s){var r;return(r=this.data.find(i=>i[0]===s))==null?void 0:r[1]},delete(s){const r=this.data.findIndex(i=>i[0]===s);return r===-1?!1:(this.data.splice(r,1),!0)},clear(){this.data.splice(0)},get size(){return this.data.length},toJSON(){return new Map(this.data)},forEach(s){this.data.forEach(r=>{s(r[1],r[0],this)})},keys(){return this.data.map(s=>s[0]).values()},values(){return this.data.map(s=>s[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}const Ru=[{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"]}],ap="WXETMuFUQmqqybHuRkSgxv:25B8LJHSfpG6LVjR2ytU5Cwh7Z4Sch2ocoU",ve={FOUR_MINUTES_MS:24e4,TEN_SEC_MS:1e4,ONE_SEC_MS:1e3,BALANCE_SUPPORTED_CHAINS:["eip155","solana"],NAMES_SUPPORTED_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"},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_ACCOUNT_TYPES:{bip122:"payment",eip155:"smartAccount",polkadot:"eoa",solana:"eoa"},ADAPTER_TYPES:{UNIVERSAL:"universal"}},z={cacheExpiry:{portfolio:3e4,nativeBalance:3e4,ens:3e5,identity:3e5},isCacheExpired(t,e){return Date.now()-t>e},getActiveNetworkProps(){const t=z.getActiveNamespace(),e=z.getActiveCaipNetworkId(),s=e?e.split(":")[1]:void 0,r=s?isNaN(Number(s))?s:Number(s):void 0;return{namespace:t,caipNetworkId:e,chainId:r}},setWalletConnectDeepLink({name:t,href:e}){try{Z.setItem(ee.DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},getWalletConnectDeepLink(){try{const t=Z.getItem(ee.DEEPLINK_CHOICE);if(t)return JSON.parse(t)}catch{console.info("Unable to get WalletConnect deep link")}},deleteWalletConnectDeepLink(){try{Z.removeItem(ee.DEEPLINK_CHOICE)}catch{console.info("Unable to delete WalletConnect deep link")}},setActiveNamespace(t){try{Z.setItem(ee.ACTIVE_NAMESPACE,t)}catch{console.info("Unable to set active namespace")}},setActiveCaipNetworkId(t){try{Z.setItem(ee.ACTIVE_CAIP_NETWORK_ID,t),z.setActiveNamespace(t.split(":")[0])}catch{console.info("Unable to set active caip network id")}},getActiveCaipNetworkId(){try{return Z.getItem(ee.ACTIVE_CAIP_NETWORK_ID)}catch{console.info("Unable to get active caip network id");return}},deleteActiveCaipNetworkId(){try{Z.removeItem(ee.ACTIVE_CAIP_NETWORK_ID)}catch{console.info("Unable to delete active caip network id")}},deleteConnectedConnectorId(t){try{const e=mo(t);Z.removeItem(e)}catch{console.info("Unable to delete connected connector id")}},setAppKitRecent(t){try{const e=z.getRecentWallets();e.find(r=>r.id===t.id)||(e.unshift(t),e.length>2&&e.pop(),Z.setItem(ee.RECENT_WALLETS,JSON.stringify(e)))}catch{console.info("Unable to set AppKit recent")}},getRecentWallets(){try{const t=Z.getItem(ee.RECENT_WALLETS);return t?JSON.parse(t):[]}catch{console.info("Unable to get AppKit recent")}return[]},setConnectedConnectorId(t,e){try{const s=mo(t);Z.setItem(s,e)}catch{console.info("Unable to set Connected Connector Id")}},getActiveNamespace(){try{return Z.getItem(ee.ACTIVE_NAMESPACE)}catch{console.info("Unable to get active namespace")}},getConnectedConnectorId(t){if(t)try{const e=mo(t);return Z.getItem(e)}catch{console.info("Unable to get connected connector id in namespace ",t)}},setConnectedSocialProvider(t){try{Z.setItem(ee.CONNECTED_SOCIAL,t)}catch{console.info("Unable to set connected social provider")}},getConnectedSocialProvider(){try{return Z.getItem(ee.CONNECTED_SOCIAL)}catch{console.info("Unable to get connected social provider")}},deleteConnectedSocialProvider(){try{Z.removeItem(ee.CONNECTED_SOCIAL)}catch{console.info("Unable to delete connected social provider")}},getConnectedSocialUsername(){try{return Z.getItem(ee.CONNECTED_SOCIAL_USERNAME)}catch{console.info("Unable to get connected social username")}},getStoredActiveCaipNetworkId(){return Z.getItem(ee.ACTIVE_CAIP_NETWORK_ID)?.split(":")?.[1]},setConnectionStatus(t){try{Z.setItem(ee.CONNECTION_STATUS,t)}catch{console.info("Unable to set connection status")}},getConnectionStatus(){try{return Z.getItem(ee.CONNECTION_STATUS)}catch{return}},getConnectedNamespaces(){try{const t=Z.getItem(ee.CONNECTED_NAMESPACES);return t?.length?t.split(","):[]}catch{return[]}},setConnectedNamespaces(t){try{const e=Array.from(new Set(t));Z.setItem(ee.CONNECTED_NAMESPACES,e.join(","))}catch{console.info("Unable to set namespaces in storage")}},addConnectedNamespace(t){try{const e=z.getConnectedNamespaces();e.includes(t)||(e.push(t),z.setConnectedNamespaces(e))}catch{console.info("Unable to add connected namespace")}},removeConnectedNamespace(t){try{const e=z.getConnectedNamespaces(),s=e.indexOf(t);s>-1&&(e.splice(s,1),z.setConnectedNamespaces(e))}catch{console.info("Unable to remove connected namespace")}},getTelegramSocialProvider(){try{return Z.getItem(ee.TELEGRAM_SOCIAL_PROVIDER)}catch{return console.info("Unable to get telegram social provider"),null}},setTelegramSocialProvider(t){try{Z.setItem(ee.TELEGRAM_SOCIAL_PROVIDER,t)}catch{console.info("Unable to set telegram social provider")}},removeTelegramSocialProvider(){try{Z.removeItem(ee.TELEGRAM_SOCIAL_PROVIDER)}catch{console.info("Unable to remove telegram social provider")}},getBalanceCache(){let t={};try{const e=Z.getItem(ee.PORTFOLIO_CACHE);t=e?JSON.parse(e):{}}catch{console.info("Unable to get balance cache")}return t},removeAddressFromBalanceCache(t){try{const e=z.getBalanceCache();Z.setItem(ee.PORTFOLIO_CACHE,JSON.stringify({...e,[t]:void 0}))}catch{console.info("Unable to remove address from balance cache",t)}},getBalanceCacheForCaipAddress(t){try{const s=z.getBalanceCache()[t];if(s&&!this.isCacheExpired(s.timestamp,this.cacheExpiry.portfolio))return s.balance;z.removeAddressFromBalanceCache(t)}catch{console.info("Unable to get balance cache for address",t)}},updateBalanceCache(t){try{const e=z.getBalanceCache();e[t.caipAddress]=t,Z.setItem(ee.PORTFOLIO_CACHE,JSON.stringify(e))}catch{console.info("Unable to update balance cache",t)}},getNativeBalanceCache(){let t={};try{const e=Z.getItem(ee.NATIVE_BALANCE_CACHE);t=e?JSON.parse(e):{}}catch{console.info("Unable to get balance cache")}return t},removeAddressFromNativeBalanceCache(t){try{const e=z.getBalanceCache();Z.setItem(ee.NATIVE_BALANCE_CACHE,JSON.stringify({...e,[t]:void 0}))}catch{console.info("Unable to remove address from balance cache",t)}},getNativeBalanceCacheForCaipAddress(t){try{const s=z.getNativeBalanceCache()[t];if(s&&!this.isCacheExpired(s.timestamp,this.cacheExpiry.nativeBalance))return s;console.info("Discarding cache for address",t),z.removeAddressFromBalanceCache(t)}catch{console.info("Unable to get balance cache for address",t)}},updateNativeBalanceCache(t){try{const e=z.getNativeBalanceCache();e[t.caipAddress]=t,Z.setItem(ee.NATIVE_BALANCE_CACHE,JSON.stringify(e))}catch{console.info("Unable to update balance cache",t)}},getEnsCache(){let t={};try{const e=Z.getItem(ee.ENS_CACHE);t=e?JSON.parse(e):{}}catch{console.info("Unable to get ens name cache")}return t},getEnsFromCacheForAddress(t){try{const s=z.getEnsCache()[t];if(s&&!this.isCacheExpired(s.timestamp,this.cacheExpiry.ens))return s.ens;z.removeEnsFromCache(t)}catch{console.info("Unable to get ens name from cache",t)}},updateEnsCache(t){try{const e=z.getEnsCache();e[t.address]=t,Z.setItem(ee.ENS_CACHE,JSON.stringify(e))}catch{console.info("Unable to update ens name cache",t)}},removeEnsFromCache(t){try{const e=z.getEnsCache();Z.setItem(ee.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=Z.getItem(ee.IDENTITY_CACHE);t=e?JSON.parse(e):{}}catch{console.info("Unable to get identity cache")}return t},getIdentityFromCacheForAddress(t){try{const s=z.getIdentityCache()[t];if(s&&!this.isCacheExpired(s.timestamp,this.cacheExpiry.identity))return s.identity;z.removeIdentityFromCache(t)}catch{console.info("Unable to get identity from cache",t)}},updateIdentityCache(t){try{const e=z.getIdentityCache();e[t.address]={identity:t.identity,timestamp:t.timestamp},Z.setItem(ee.IDENTITY_CACHE,JSON.stringify(e))}catch{console.info("Unable to update identity cache",t)}},removeIdentityFromCache(t){try{const e=z.getIdentityCache();Z.setItem(ee.IDENTITY_CACHE,JSON.stringify({...e,[t]:void 0}))}catch{console.info("Unable to remove identity from cache",t)}},clearAddressCache(){try{Z.removeItem(ee.PORTFOLIO_CACHE),Z.removeItem(ee.NATIVE_BALANCE_CACHE),Z.removeItem(ee.ENS_CACHE),Z.removeItem(ee.IDENTITY_CACHE)}catch{console.info("Unable to clear address cache")}},setPreferredAccountTypes(t){try{Z.setItem(ee.PREFERRED_ACCOUNT_TYPES,JSON.stringify(t))}catch{console.info("Unable to set preferred account types",t)}},getPreferredAccountTypes(){try{const t=Z.getItem(ee.PREFERRED_ACCOUNT_TYPES);return t?JSON.parse(t):{}}catch{console.info("Unable to get preferred account types")}return{}},setConnections(t,e){try{const s={...z.getConnections(),[e]:t};Z.setItem(ee.CONNECTIONS,JSON.stringify(s))}catch(s){console.error("Unable to sync connections to storage",s)}},getConnections(){try{const t=Z.getItem(ee.CONNECTIONS);return t?JSON.parse(t):{}}catch(t){return console.error("Unable to get connections from storage",t),{}}}},X={isMobile(){return this.isClient()?!!(typeof window?.matchMedia=="function"&&window?.matchMedia("(pointer:coarse)")?.matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},checkCaipNetwork(t,e=""){return t?.caipNetworkId.toLocaleLowerCase().includes(e.toLowerCase())},isAndroid(){if(!this.isMobile())return!1;const t=window?.navigator.userAgent.toLowerCase();return X.isMobile()&&t.includes("android")},isIos(){if(!this.isMobile())return!1;const t=window?.navigator.userAgent.toLowerCase();return t.includes("iphone")||t.includes("ipad")},isSafari(){return this.isClient()?(window?.navigator.userAgent.toLowerCase()).includes("safari"):!1},isClient(){return typeof window<"u"},isPairingExpired(t){return t?t-Date.now()<=ve.TEN_SEC_MS:!0},isAllowedRetry(t,e=ve.ONE_SEC_MS){return Date.now()-t>=e},copyToClopboard(t){navigator.clipboard.writeText(t)},isIframe(){try{return window?.self!==window?.top}catch{return!1}},isSafeApp(){if(X.isClient()&&window.self!==window.top)try{const t=window?.location?.ancestorOrigins?.[0],e="https://app.safe.global";if(t){const s=new URL(t),r=new URL(e);return s.hostname===r.hostname}}catch{return!1}return!1},getPairingExpiry(){return Date.now()+ve.FOUR_MINUTES_MS},getNetworkId(t){return t?.split(":")[1]},getPlainAddress(t){return t?.split(":")[2]},async wait(t){return new Promise(e=>{setTimeout(e,t)})},debounce(t,e=500){let s;return(...r)=>{function i(){t(...r)}s&&clearTimeout(s),s=setTimeout(i,e)}},isHttpUrl(t){return t.startsWith("http://")||t.startsWith("https://")},formatNativeUrl(t,e,s=null){if(X.isHttpUrl(t))return this.formatUniversalUrl(t,e);let r=t,i=s;r.includes("://")||(r=t.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),i&&!i?.endsWith("/")&&(i=`${i}/`),this.isTelegram()&&this.isAndroid()&&(e=encodeURIComponent(e));const n=encodeURIComponent(e);return{redirect:`${r}wc?uri=${n}`,redirectUniversalLink:i?`${i}wc?uri=${n}`:void 0,href:r}},formatUniversalUrl(t,e){if(!X.isHttpUrl(t))return this.formatNativeUrl(t,e);let s=t;s.endsWith("/")||(s=`${s}/`);const r=encodeURIComponent(e);return{redirect:`${s}wc?uri=${r}`,href:s}},getOpenTargetForPlatform(t){return t==="popupWindow"?t:this.isTelegram()?z.getTelegramSocialProvider()?"_top":"_blank":t},openHref(t,e,s){window?.open(t,this.getOpenTargetForPlatform(e),s||"noreferrer noopener")},returnOpenHref(t,e,s){return window?.open(t,this.getOpenTargetForPlatform(e),s||"noreferrer noopener")},isTelegram(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)},isPWA(){if(typeof window>"u")return!1;const t=window.matchMedia?.("(display-mode: standalone)")?.matches,e=window?.navigator?.standalone;return!!(t||e)},async preloadImage(t){const e=new Promise((s,r)=>{const i=new Image;i.onload=s,i.onerror=r,i.crossOrigin="anonymous",i.src=t});return Promise.race([e,X.wait(2e3)])},formatBalance(t,e){let s="0.000";if(typeof t=="string"){const r=Number(t);if(r){const i=Math.floor(r*1e3)/1e3;i&&(s=i.toString())}}return`${s}${e?` ${e}`:""}`},formatBalance2(t,e){let s;if(t==="0")s="0";else if(typeof t=="string"){const r=Number(t);r&&(s=r.toString().match(/^-?\d+(?:\.\d{0,3})?/u)?.[0])}return{value:s??"0",rest:s==="0"?"000":"",symbol:e}},getApiUrl(){return H.W3M_API_URL},getBlockchainApiUrl(){return H.BLOCKCHAIN_API_RPC_URL},getAnalyticsUrl(){return H.PULSE_API_URL},getUUID(){return 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){return typeof t=="string"?t:typeof t?.issues?.[0]?.message=="string"?t.issues[0].message:t instanceof Error?t.message:"Unknown error"},sortRequestedNetworks(t,e=[]){const s={};return e&&t&&(t.forEach((r,i)=>{s[r]=i}),e.sort((r,i)=>{const n=s[r.id],o=s[i.id];return n!==void 0&&o!==void 0?n-o:n!==void 0?-1:o!==void 0?1:0})),e},calculateBalance(t){let e=0;for(const s of t)e+=s.value??0;return e},formatTokenBalance(t){const e=t.toFixed(2),[s,r]=e.split(".");return{dollars:s,pennies:r}},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 s=new Set;return t.filter(r=>{const i=r[e];return s.has(i)?!1:(s.add(i),!0)})},generateSdkVersion(t,e,s){const i=t.length===0?ve.ADAPTER_TYPES.UNIVERSAL:t.map(n=>n.adapterType).join(",");return`${e}-${i}-${s}`},createAccount(t,e,s,r,i){return{namespace:t,address:e,type:s,publicKey:r,path:i}},isCaipAddress(t){if(typeof t!="string")return!1;const e=t.split(":"),s=e[0];return e.filter(Boolean).length===3&&s in H.CHAIN_NAME_MAP},isMac(){const t=window?.navigator.userAgent.toLowerCase();return t.includes("macintosh")&&!t.includes("safari")},formatTelegramSocialLoginUrl(t){const e=`--${encodeURIComponent(window?.location.href)}`,s="state=";if(new URL(t).host==="auth.magic.link"){const i="provider_authorization_url=",n=t.substring(t.indexOf(i)+i.length),o=this.injectIntoUrl(decodeURIComponent(n),s,e);return t.replace(n,encodeURIComponent(o))}return this.injectIntoUrl(t,s,e)},injectIntoUrl(t,e,s){const r=t.indexOf(e);if(r===-1)throw new Error(`${e} parameter not found in the URL: ${t}`);const i=t.indexOf("&",r),n=e.length,o=i!==-1?i:t.length,a=t.substring(0,r+n),c=t.substring(r+n,o),l=t.substring(i),u=c+s;return a+u+l}};async function ni(...t){const e=await fetch(...t);if(!e.ok)throw new Error(`HTTP status code: ${e.status}`,{cause:e});return e}class un{constructor({baseUrl:e,clientId:s}){this.baseUrl=e,this.clientId=s}async get({headers:e,signal:s,cache:r,...i}){const n=this.createUrl(i);return(await ni(n,{method:"GET",headers:e,signal:s,cache:r})).json()}async getBlob({headers:e,signal:s,...r}){const i=this.createUrl(r);return(await ni(i,{method:"GET",headers:e,signal:s})).blob()}async post({body:e,headers:s,signal:r,...i}){const n=this.createUrl(i);return(await ni(n,{method:"POST",headers:s,body:e?JSON.stringify(e):void 0,signal:r})).json()}async put({body:e,headers:s,signal:r,...i}){const n=this.createUrl(i);return(await ni(n,{method:"PUT",headers:s,body:e?JSON.stringify(e):void 0,signal:r})).json()}async delete({body:e,headers:s,signal:r,...i}){const n=this.createUrl(i);return(await ni(n,{method:"DELETE",headers:s,body:e?JSON.stringify(e):void 0,signal:r})).json()}createUrl({path:e,params:s}){const r=new URL(e,this.baseUrl);return s&&Object.entries(s).forEach(([i,n])=>{n&&r.searchParams.append(i,n)}),this.clientId&&r.searchParams.append("clientId",this.clientId),r}}const cp={getFeatureValue(t,e){const s=e?.[t];return s===void 0?ve.DEFAULT_FEATURES[t]:s},filterSocialsByPlatform(t){if(!t||!t.length)return t;if(X.isTelegram()){if(X.isIos())return t.filter(e=>e!=="google");if(X.isMac())return t.filter(e=>e!=="x");if(X.isAndroid())return t.filter(e=>!["facebook","x"].includes(e))}return t}},K=_e({features:ve.DEFAULT_FEATURES,projectId:"",sdkType:"appkit",sdkVersion:"html-wagmi-undefined",defaultAccountTypes:ve.DEFAULT_ACCOUNT_TYPES,enableNetworkSwitch:!0,experimental_preferUniversalLinks:!1,remoteFeatures:{}}),k={state:K,subscribeKey(t,e){return Qe(K,t,e)},setOptions(t){Object.assign(K,t)},setRemoteFeatures(t){if(!t)return;const e={...K.remoteFeatures,...t};K.remoteFeatures=e,K.remoteFeatures?.socials&&(K.remoteFeatures.socials=cp.filterSocialsByPlatform(K.remoteFeatures.socials))},setFeatures(t){if(!t)return;K.features||(K.features=ve.DEFAULT_FEATURES);const e={...K.features,...t};K.features=e},setProjectId(t){K.projectId=t},setCustomRpcUrls(t){K.customRpcUrls=t},setAllWallets(t){K.allWallets=t},setIncludeWalletIds(t){K.includeWalletIds=t},setExcludeWalletIds(t){K.excludeWalletIds=t},setFeaturedWalletIds(t){K.featuredWalletIds=t},setTokens(t){K.tokens=t},setTermsConditionsUrl(t){K.termsConditionsUrl=t},setPrivacyPolicyUrl(t){K.privacyPolicyUrl=t},setCustomWallets(t){K.customWallets=t},setIsSiweEnabled(t){K.isSiweEnabled=t},setIsUniversalProvider(t){K.isUniversalProvider=t},setSdkVersion(t){K.sdkVersion=t},setMetadata(t){K.metadata=t},setDisableAppend(t){K.disableAppend=t},setEIP6963Enabled(t){K.enableEIP6963=t},setDebug(t){K.debug=t},setEnableWalletConnect(t){K.enableWalletConnect=t},setEnableWalletGuide(t){K.enableWalletGuide=t},setEnableAuthLogger(t){K.enableAuthLogger=t},setEnableWallets(t){K.enableWallets=t},setPreferUniversalLinks(t){K.experimental_preferUniversalLinks=t},setHasMultipleAddresses(t){K.hasMultipleAddresses=t},setSIWX(t){K.siwx=t},setConnectMethodsOrder(t){K.features={...K.features,connectMethodsOrder:t}},setWalletFeaturesOrder(t){K.features={...K.features,walletFeaturesOrder:t}},setSocialsOrder(t){K.remoteFeatures={...K.remoteFeatures,socials:t}},setCollapseWallets(t){K.features={...K.features,collapseWallets:t}},setEnableEmbedded(t){K.enableEmbedded=t},setAllowUnsupportedChain(t){K.allowUnsupportedChain=t},setManualWCControl(t){K.manualWCControl=t},setEnableNetworkSwitch(t){K.enableNetworkSwitch=t},setDefaultAccountTypes(t={}){Object.entries(t).forEach(([e,s])=>{s&&(K.defaultAccountTypes[e]=s)})},setUniversalProviderConfigOverride(t){K.universalProviderConfigOverride=t},getUniversalProviderConfigOverride(){return K.universalProviderConfigOverride},getSnapshot(){return Ti(K)}},lp=Object.freeze({enabled:!0,events:[]}),up=new un({baseUrl:X.getAnalyticsUrl(),clientId:null}),dp=5,hp=60*1e3,ps=_e({...lp}),pp={state:ps,subscribeKey(t,e){return Qe(ps,t,e)},async sendError(t,e){if(!ps.enabled)return;const s=Date.now();if(ps.events.filter(n=>{const o=new Date(n.properties.timestamp||"").getTime();return s-o<hp}).length>=dp)return;const i={type:"error",event:e,properties:{errorType:t.name,errorMessage:t.message,stackTrace:t.stack,timestamp:new Date().toISOString()}};ps.events.push(i);try{if(typeof window>"u")return;const{projectId:n,sdkType:o,sdkVersion:a}=k.state;await up.post({path:"/e",params:{projectId:n,st:o,sv:a||"html-wagmi-4.2.2"},body:{eventId:X.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(){ps.enabled=!0},disable(){ps.enabled=!1},clearEvents(){ps.events=[]}};class Dr extends Error{constructor(e,s,r){super(e),this.name="AppKitError",this.category=s,this.originalError=r,Object.setPrototypeOf(this,Dr.prototype);let i=!1;if(r instanceof Error&&typeof r.stack=="string"&&r.stack){const n=r.stack,o=n.indexOf(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/secp256k1-DekXzlV8.js","assets/index--LSQjR_2.js","assets/index-CCSv1eAh.css","assets/index.es-C1H8G2CD.js","assets/events-DQ172AOg.js","assets/basic-CqHaUvPy.js","assets/index-Cg8hiVbn.js","assets/w3m-modal-BV8xYuAk.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as Yo}from"./index--LSQjR_2.js";import{I as Yr,h as $h,i as Ot,j as ut,k as L,l as ls,C as Rh,m as Uh,n as vi,s as Xo,o as Pu,p as tr,q as cn,A as Ou,E as st,u as Dh,v as Lh,y as vt,x as zs,z as Xr,O as Da,B as kt,D as Mh,F as La,G as Ma,J as to,N as ja,P as ac,Q as jh,K as Bh,L as qh,M as cc,R as Or,S as ku,T as rs,U as Ht,V as ds,W as jt}from"./index.es-C1H8G2CD.js";var lc={};const H={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 lc<"u"?lc.NEXT_PUBLIC_SECURE_SITE_ORIGIN:void 0)||"https://secure.walletconnect.org"},Tu={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?.filter(s=>s.chainNamespace===e)||[]},getFirstNetworkByNamespace(t,e){return this.getNetworksByNamespace(t,e)[0]},getNetworkNameByCaipNetworkId(t,e){if(!e)return;const s=t.find(i=>i.caipNetworkId===e);if(s)return s.name;const[r]=e.split(":");return H.CHAIN_NAME_MAP?.[r]||void 0}};var zh=20,Fh=1,Js=1e6,uc=1e6,Wh=-7,Hh=21,Vh=!1,ln="[big.js] ",sr=ln+"Invalid ",so=sr+"decimal places",Kh=sr+"rounding mode",xu=ln+"Division by zero",ge={},Gt=void 0,Gh=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function $u(){function t(e){var s=this;if(!(s instanceof t))return e===Gt?$u():new t(e);if(e instanceof t)s.s=e.s,s.e=e.e,s.c=e.c.slice();else{if(typeof e!="string"){if(t.strict===!0&&typeof e!="bigint")throw TypeError(sr+"value");e=e===0&&1/e<0?"-0":String(e)}Jh(s,e)}s.constructor=t}return t.prototype=ge,t.DP=zh,t.RM=Fh,t.NE=Wh,t.PE=Hh,t.strict=Vh,t.roundDown=0,t.roundHalfUp=1,t.roundHalfEven=2,t.roundUp=3,t}function Jh(t,e){var s,r,i;if(!Gh.test(e))throw Error(sr+"number");for(t.s=e.charAt(0)=="-"?(e=e.slice(1),-1):1,(s=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(s<0&&(s=r),s+=+e.slice(r+1),e=e.substring(0,r)):s<0&&(s=e.length),i=e.length,r=0;r<i&&e.charAt(r)=="0";)++r;if(r==i)t.c=[t.e=0];else{for(;i>0&&e.charAt(--i)=="0";);for(t.e=s-r-1,t.c=[],s=0;r<=i;)t.c[s++]=+e.charAt(r++)}return t}function rr(t,e,s,r){var i=t.c;if(s===Gt&&(s=t.constructor.RM),s!==0&&s!==1&&s!==2&&s!==3)throw Error(Kh);if(e<1)r=s===3&&(r||!!i[0])||e===0&&(s===1&&i[0]>=5||s===2&&(i[0]>5||i[0]===5&&(r||i[1]!==Gt))),i.length=1,r?(t.e=t.e-e+1,i[0]=1):i[0]=t.e=0;else if(e<i.length){if(r=s===1&&i[e]>=5||s===2&&(i[e]>5||i[e]===5&&(r||i[e+1]!==Gt||i[e-1]&1))||s===3&&(r||!!i[0]),i.length=e,r){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 ir(t,e,s){var r=t.e,i=t.c.join(""),n=i.length;if(e)i=i.charAt(0)+(n>1?"."+i.slice(1):"")+(r<0?"e":"e+")+r;else if(r<0){for(;++r;)i="0"+i;i="0."+i}else if(r>0)if(++r>n)for(r-=n;r--;)i+="0";else r<n&&(i=i.slice(0,r)+"."+i.slice(r));else n>1&&(i=i.charAt(0)+"."+i.slice(1));return t.s<0&&s?"-"+i:i}ge.abs=function(){var t=new this.constructor(this);return t.s=1,t};ge.cmp=function(t){var e,s=this,r=s.c,i=(t=new s.constructor(t)).c,n=s.s,o=t.s,a=s.e,c=t.e;if(!r[0]||!i[0])return r[0]?n:i[0]?-o:0;if(n!=o)return n;if(e=n<0,a!=c)return a>c^e?1:-1;for(o=(a=r.length)<(c=i.length)?a:c,n=-1;++n<o;)if(r[n]!=i[n])return r[n]>i[n]^e?1:-1;return a==c?0:a>c^e?1:-1};ge.div=function(t){var e=this,s=e.constructor,r=e.c,i=(t=new s(t)).c,n=e.s==t.s?1:-1,o=s.DP;if(o!==~~o||o<0||o>Js)throw Error(so);if(!i[0])throw Error(xu);if(!r[0])return t.s=n,t.c=[t.e=0],t;var a,c,l,u,d,h=i.slice(),f=a=i.length,w=r.length,m=r.slice(0,a),g=m.length,y=t,b=y.c=[],E=0,_=o+(y.e=e.e-t.e)+1;for(y.s=n,n=_<0?0:_,h.unshift(0);g++<a;)m.push(0);do{for(l=0;l<10;l++){if(a!=(g=m.length))u=a>g?1:-1;else for(d=-1,u=0;++d<a;)if(i[d]!=m[d]){u=i[d]>m[d]?1:-1;break}if(u<0){for(c=g==a?i:h;g;){if(m[--g]<c[g]){for(d=g;d&&!m[--d];)m[d]=9;--m[d],m[g]+=10}m[g]-=c[g]}for(;!m[0];)m.shift()}else break}b[E++]=u?l:++l,m[0]&&u?m[g]=r[f]||0:m=[r[f]]}while((f++<w||m[0]!==Gt)&&n--);return!b[0]&&E!=1&&(b.shift(),y.e--,_--),E>_&&rr(y,_,s.RM,m[0]!==Gt),y};ge.eq=function(t){return this.cmp(t)===0};ge.gt=function(t){return this.cmp(t)>0};ge.gte=function(t){return this.cmp(t)>-1};ge.lt=function(t){return this.cmp(t)<0};ge.lte=function(t){return this.cmp(t)<1};ge.minus=ge.sub=function(t){var e,s,r,i,n=this,o=n.constructor,a=n.s,c=(t=new o(t)).s;if(a!=c)return t.s=-c,n.plus(t);var l=n.c.slice(),u=n.e,d=t.c,h=t.e;if(!l[0]||!d[0])return d[0]?t.s=-c:l[0]?t=new o(n):t.s=1,t;if(a=u-h){for((i=a<0)?(a=-a,r=l):(h=u,r=d),r.reverse(),c=a;c--;)r.push(0);r.reverse()}else for(s=((i=l.length<d.length)?l:d).length,a=c=0;c<s;c++)if(l[c]!=d[c]){i=l[c]<d[c];break}if(i&&(r=l,l=d,d=r,t.s=-t.s),(c=(s=d.length)-(e=l.length))>0)for(;c--;)l[e++]=0;for(c=e;s>a;){if(l[--s]<d[s]){for(e=s;e&&!l[--e];)l[e]=9;--l[e],l[s]+=10}l[s]-=d[s]}for(;l[--c]===0;)l.pop();for(;l[0]===0;)l.shift(),--h;return l[0]||(t.s=1,l=[h=0]),t.c=l,t.e=h,t};ge.mod=function(t){var e,s=this,r=s.constructor,i=s.s,n=(t=new r(t)).s;if(!t.c[0])throw Error(xu);return s.s=t.s=1,e=t.cmp(s)==1,s.s=i,t.s=n,e?new r(s):(i=r.DP,n=r.RM,r.DP=r.RM=0,s=s.div(t),r.DP=i,r.RM=n,this.minus(s.times(t)))};ge.neg=function(){var t=new this.constructor(this);return t.s=-t.s,t};ge.plus=ge.add=function(t){var e,s,r,i=this,n=i.constructor;if(t=new n(t),i.s!=t.s)return t.s=-t.s,i.minus(t);var o=i.e,a=i.c,c=t.e,l=t.c;if(!a[0]||!l[0])return l[0]||(a[0]?t=new n(i):t.s=i.s),t;if(a=a.slice(),e=o-c){for(e>0?(c=o,r=l):(e=-e,r=a),r.reverse();e--;)r.push(0);r.reverse()}for(a.length-l.length<0&&(r=l,l=a,a=r),e=l.length,s=0;e;a[e]%=10)s=(a[--e]=a[e]+l[e]+s)/10|0;for(s&&(a.unshift(s),++c),e=a.length;a[--e]===0;)a.pop();return t.c=a,t.e=c,t};ge.pow=function(t){var e=this,s=new e.constructor("1"),r=s,i=t<0;if(t!==~~t||t<-uc||t>uc)throw Error(sr+"exponent");for(i&&(t=-t);t&1&&(r=r.times(e)),t>>=1,!!t;)e=e.times(e);return i?s.div(r):r};ge.prec=function(t,e){if(t!==~~t||t<1||t>Js)throw Error(sr+"precision");return rr(new this.constructor(this),t,e)};ge.round=function(t,e){if(t===Gt)t=0;else if(t!==~~t||t<-Js||t>Js)throw Error(so);return rr(new this.constructor(this),t+this.e+1,e)};ge.sqrt=function(){var t,e,s,r=this,i=r.constructor,n=r.s,o=r.e,a=new i("0.5");if(!r.c[0])return new i(r);if(n<0)throw Error(ln+"No square root");n=Math.sqrt(+ir(r,!0,!0)),n===0||n===1/0?(e=r.c.join(""),e.length+o&1||(e+="0"),n=Math.sqrt(e),o=((o+1)/2|0)-(o<0||o&1),t=new i((n==1/0?"5e":(n=n.toExponential()).slice(0,n.indexOf("e")+1))+o)):t=new i(n+""),o=t.e+(i.DP+=4);do s=t,t=a.times(s.plus(r.div(s)));while(s.c.slice(0,o).join("")!==t.c.slice(0,o).join(""));return rr(t,(i.DP-=4)+t.e+1,i.RM)};ge.times=ge.mul=function(t){var e,s=this,r=s.constructor,i=s.c,n=(t=new r(t)).c,o=i.length,a=n.length,c=s.e,l=t.e;if(t.s=s.s==t.s?1:-1,!i[0]||!n[0])return t.c=[t.e=0],t;for(t.e=c+l,o<a&&(e=i,i=n,n=e,l=o,o=a,a=l),e=new Array(l=o+a);l--;)e[l]=0;for(c=a;c--;){for(a=0,l=o+c;l>c;)a=e[l]+n[c]*i[l-c-1]+a,e[l--]=a%10,a=a/10|0;e[l]=a}for(a?++t.e:e.shift(),c=e.length;!e[--c];)e.pop();return t.c=e,t};ge.toExponential=function(t,e){var s=this,r=s.c[0];if(t!==Gt){if(t!==~~t||t<0||t>Js)throw Error(so);for(s=rr(new s.constructor(s),++t,e);s.c.length<t;)s.c.push(0)}return ir(s,!0,!!r)};ge.toFixed=function(t,e){var s=this,r=s.c[0];if(t!==Gt){if(t!==~~t||t<0||t>Js)throw Error(so);for(s=rr(new s.constructor(s),t+s.e+1,e),t=t+s.e+1;s.c.length<t;)s.c.push(0)}return ir(s,!1,!!r)};ge[Symbol.for("nodejs.util.inspect.custom")]=ge.toJSON=ge.toString=function(){var t=this,e=t.constructor;return ir(t,t.e<=e.NE||t.e>=e.PE,!!t.c[0])};ge.toNumber=function(){var t=+ir(this,!0,!0);if(this.constructor.strict===!0&&!this.eq(t.toString()))throw Error(ln+"Imprecise conversion");return t};ge.toPrecision=function(t,e){var s=this,r=s.constructor,i=s.c[0];if(t!==Gt){if(t!==~~t||t<1||t>Js)throw Error(sr+"precision");for(s=rr(new r(s),t,e);s.c.length<t;)s.c.push(0)}return ir(s,t<=s.e||s.e<=r.NE||s.e>=r.PE,!!i)};ge.valueOf=function(){var t=this,e=t.constructor;if(e.strict===!0)throw Error(ln+"valueOf disallowed");return ir(t,t.e<=e.NE||t.e>=e.PE,!0)};var ii=$u();const Yh={bigNumber(t){return t?new ii(t):new ii(0)},multiply(t,e){if(t===void 0||e===void 0)return new ii(0);const s=new ii(t),r=new ii(e);return s.times(r)},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,""))}},Xh=[{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"}]}],Zh=[{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}],Qh=[{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"}]}],ep={getERC20Abi:t=>H.USDT_CONTRACT_ADDRESSES.includes(t)?Qh:Xh,getSwapAbi:()=>Zh},hs={validateCaipAddress(t){if(t.split(":")?.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[s,r,i]=e;if(!s||!r||!i)throw new Error(`Invalid CAIP-10 address: ${t}`);return{chainNamespace:s,chainId:r,address:i}},parseCaipNetworkId(t){const e=t.split(":");if(e.length!==2)throw new Error(`Invalid CAIP-2 network id: ${t}`);const[s,r]=e;if(!s||!r)throw new Error(`Invalid CAIP-2 network id: ${t}`);return{chainNamespace:s,chainId:r}}},ee={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 mo(t){if(!t)throw new Error("Namespace is required for CONNECTED_CONNECTOR_ID");return`@appkit/${t}:connected_connector_id`}const Z={setItem(t,e){fi()&&e!==void 0&&localStorage.setItem(t,e)},getItem(t){if(fi())return localStorage.getItem(t)||void 0},removeItem(t){fi()&&localStorage.removeItem(t)},clear(){fi()&&localStorage.clear()}};function fi(){return typeof window<"u"&&typeof localStorage<"u"}function Cs(t,e){return e==="light"?{"--w3m-accent":t?.["--w3m-accent"]||"hsla(231, 100%, 70%, 1)","--w3m-background":"#fff"}:{"--w3m-accent":t?.["--w3m-accent"]||"hsla(230, 100%, 67%, 1)","--w3m-background":"#121313"}}const tp=Symbol(),dc=Object.getPrototypeOf,Zo=new WeakMap,sp=t=>t&&(Zo.has(t)?Zo.get(t):dc(t)===Object.prototype||dc(t)===Array.prototype),rp=t=>sp(t)&&t[tp]||null,hc=(t,e=!0)=>{Zo.set(t,e)},Vn={},wo=t=>typeof t=="object"&&t!==null,ys=new WeakMap,gi=new WeakSet,ip=(t=Object.is,e=(l,u)=>new Proxy(l,u),s=l=>wo(l)&&!gi.has(l)&&(Array.isArray(l)||!(Symbol.iterator in l))&&!(l instanceof WeakMap)&&!(l instanceof WeakSet)&&!(l instanceof Error)&&!(l instanceof Number)&&!(l instanceof Date)&&!(l instanceof String)&&!(l instanceof RegExp)&&!(l instanceof ArrayBuffer),r=l=>{switch(l.status){case"fulfilled":return l.value;case"rejected":throw l.reason;default:throw l}},i=new WeakMap,n=(l,u,d=r)=>{const h=i.get(l);if(h?.[0]===u)return h[1];const f=Array.isArray(l)?[]:Object.create(Object.getPrototypeOf(l));return hc(f,!0),i.set(l,[u,f]),Reflect.ownKeys(l).forEach(w=>{if(Object.getOwnPropertyDescriptor(f,w))return;const m=Reflect.get(l,w),{enumerable:g}=Reflect.getOwnPropertyDescriptor(l,w),y={value:m,enumerable:g,configurable:!0};if(gi.has(m))hc(m,!1);else if(m instanceof Promise)delete y.value,y.get=()=>d(m);else if(ys.has(m)){const[b,E]=ys.get(m);y.value=n(b,E(),d)}Object.defineProperty(f,w,y)}),Object.preventExtensions(f)},o=new WeakMap,a=[1,1],c=l=>{if(!wo(l))throw new Error("object required");const u=o.get(l);if(u)return u;let d=a[0];const h=new Set,f=(v,$=++a[0])=>{d!==$&&(d=$,h.forEach(C=>C(v,$)))};let w=a[1];const m=(v=++a[1])=>(w!==v&&!h.size&&(w=v,y.forEach(([$])=>{const C=$[1](v);C>d&&(d=C)})),d),g=v=>($,C)=>{const R=[...$];R[1]=[v,...R[1]],f(R,C)},y=new Map,b=(v,$)=>{if((Vn?"production":void 0)!=="production"&&y.has(v))throw new Error("prop listener already exists");if(h.size){const C=$[3](g(v));y.set(v,[$,C])}else y.set(v,[$])},E=v=>{var $;const C=y.get(v);C&&(y.delete(v),($=C[1])==null||$.call(C))},_=v=>(h.add(v),h.size===1&&y.forEach(([C,R],W)=>{if((Vn?"production":void 0)!=="production"&&R)throw new Error("remove already exists");const N=C[3](g(W));y.set(W,[C,N])}),()=>{h.delete(v),h.size===0&&y.forEach(([C,R],W)=>{R&&(R(),y.set(W,[C]))})}),O=Array.isArray(l)?[]:Object.create(Object.getPrototypeOf(l)),I=e(O,{deleteProperty(v,$){const C=Reflect.get(v,$);E($);const R=Reflect.deleteProperty(v,$);return R&&f(["delete",[$],C]),R},set(v,$,C,R){const W=Reflect.has(v,$),N=Reflect.get(v,$,R);if(W&&(t(N,C)||o.has(C)&&t(N,o.get(C))))return!0;E($),wo(C)&&(C=rp(C)||C);let T=C;if(C instanceof Promise)C.then(P=>{C.status="fulfilled",C.value=P,f(["resolve",[$],P])}).catch(P=>{C.status="rejected",C.reason=P,f(["reject",[$],P])});else{!ys.has(C)&&s(C)&&(T=c(C));const P=!gi.has(T)&&ys.get(T);P&&b($,P)}return Reflect.set(v,$,T,R),f(["set",[$],C,N]),!0}});o.set(l,I);const U=[O,m,n,_];return ys.set(I,U),Reflect.ownKeys(l).forEach(v=>{const $=Object.getOwnPropertyDescriptor(l,v);"value"in $&&(I[v]=l[v],delete $.value,delete $.writable),Object.defineProperty(O,v,$)}),I})=>[c,ys,gi,t,e,s,r,i,n,o,a],[np]=ip();function _e(t={}){return np(t)}function Ze(t,e,s){const r=ys.get(t);(Vn?"production":void 0)!=="production"&&!r&&console.warn("Please use proxy object");let i;const n=[],o=r[3];let a=!1;const l=o(u=>{n.push(u),i||(i=Promise.resolve().then(()=>{i=void 0,a&&e(n.splice(0))}))});return a=!0,()=>{a=!1,l()}}function Ti(t,e){const s=ys.get(t);(Vn?"production":void 0)!=="production"&&!s&&console.warn("Please use proxy object");const[r,i,n]=s;return n(r,i(),e)}function Ys(t){return gi.add(t),t}function Qe(t,e,s,r){let i=t[e];return Ze(t,()=>{const n=t[e];Object.is(i,n)||s(i=n)})}function op(t){const e=_e({data:Array.from([]),has(s){return this.data.some(r=>r[0]===s)},set(s,r){const i=this.data.find(n=>n[0]===s);return i?i[1]=r:this.data.push([s,r]),this},get(s){var r;return(r=this.data.find(i=>i[0]===s))==null?void 0:r[1]},delete(s){const r=this.data.findIndex(i=>i[0]===s);return r===-1?!1:(this.data.splice(r,1),!0)},clear(){this.data.splice(0)},get size(){return this.data.length},toJSON(){return new Map(this.data)},forEach(s){this.data.forEach(r=>{s(r[1],r[0],this)})},keys(){return this.data.map(s=>s[0]).values()},values(){return this.data.map(s=>s[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}const Ru=[{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"]}],ap="WXETMuFUQmqqybHuRkSgxv:25B8LJHSfpG6LVjR2ytU5Cwh7Z4Sch2ocoU",ve={FOUR_MINUTES_MS:24e4,TEN_SEC_MS:1e4,ONE_SEC_MS:1e3,BALANCE_SUPPORTED_CHAINS:["eip155","solana"],NAMES_SUPPORTED_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"},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_ACCOUNT_TYPES:{bip122:"payment",eip155:"smartAccount",polkadot:"eoa",solana:"eoa"},ADAPTER_TYPES:{UNIVERSAL:"universal"}},z={cacheExpiry:{portfolio:3e4,nativeBalance:3e4,ens:3e5,identity:3e5},isCacheExpired(t,e){return Date.now()-t>e},getActiveNetworkProps(){const t=z.getActiveNamespace(),e=z.getActiveCaipNetworkId(),s=e?e.split(":")[1]:void 0,r=s?isNaN(Number(s))?s:Number(s):void 0;return{namespace:t,caipNetworkId:e,chainId:r}},setWalletConnectDeepLink({name:t,href:e}){try{Z.setItem(ee.DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},getWalletConnectDeepLink(){try{const t=Z.getItem(ee.DEEPLINK_CHOICE);if(t)return JSON.parse(t)}catch{console.info("Unable to get WalletConnect deep link")}},deleteWalletConnectDeepLink(){try{Z.removeItem(ee.DEEPLINK_CHOICE)}catch{console.info("Unable to delete WalletConnect deep link")}},setActiveNamespace(t){try{Z.setItem(ee.ACTIVE_NAMESPACE,t)}catch{console.info("Unable to set active namespace")}},setActiveCaipNetworkId(t){try{Z.setItem(ee.ACTIVE_CAIP_NETWORK_ID,t),z.setActiveNamespace(t.split(":")[0])}catch{console.info("Unable to set active caip network id")}},getActiveCaipNetworkId(){try{return Z.getItem(ee.ACTIVE_CAIP_NETWORK_ID)}catch{console.info("Unable to get active caip network id");return}},deleteActiveCaipNetworkId(){try{Z.removeItem(ee.ACTIVE_CAIP_NETWORK_ID)}catch{console.info("Unable to delete active caip network id")}},deleteConnectedConnectorId(t){try{const e=mo(t);Z.removeItem(e)}catch{console.info("Unable to delete connected connector id")}},setAppKitRecent(t){try{const e=z.getRecentWallets();e.find(r=>r.id===t.id)||(e.unshift(t),e.length>2&&e.pop(),Z.setItem(ee.RECENT_WALLETS,JSON.stringify(e)))}catch{console.info("Unable to set AppKit recent")}},getRecentWallets(){try{const t=Z.getItem(ee.RECENT_WALLETS);return t?JSON.parse(t):[]}catch{console.info("Unable to get AppKit recent")}return[]},setConnectedConnectorId(t,e){try{const s=mo(t);Z.setItem(s,e)}catch{console.info("Unable to set Connected Connector Id")}},getActiveNamespace(){try{return Z.getItem(ee.ACTIVE_NAMESPACE)}catch{console.info("Unable to get active namespace")}},getConnectedConnectorId(t){if(t)try{const e=mo(t);return Z.getItem(e)}catch{console.info("Unable to get connected connector id in namespace ",t)}},setConnectedSocialProvider(t){try{Z.setItem(ee.CONNECTED_SOCIAL,t)}catch{console.info("Unable to set connected social provider")}},getConnectedSocialProvider(){try{return Z.getItem(ee.CONNECTED_SOCIAL)}catch{console.info("Unable to get connected social provider")}},deleteConnectedSocialProvider(){try{Z.removeItem(ee.CONNECTED_SOCIAL)}catch{console.info("Unable to delete connected social provider")}},getConnectedSocialUsername(){try{return Z.getItem(ee.CONNECTED_SOCIAL_USERNAME)}catch{console.info("Unable to get connected social username")}},getStoredActiveCaipNetworkId(){return Z.getItem(ee.ACTIVE_CAIP_NETWORK_ID)?.split(":")?.[1]},setConnectionStatus(t){try{Z.setItem(ee.CONNECTION_STATUS,t)}catch{console.info("Unable to set connection status")}},getConnectionStatus(){try{return Z.getItem(ee.CONNECTION_STATUS)}catch{return}},getConnectedNamespaces(){try{const t=Z.getItem(ee.CONNECTED_NAMESPACES);return t?.length?t.split(","):[]}catch{return[]}},setConnectedNamespaces(t){try{const e=Array.from(new Set(t));Z.setItem(ee.CONNECTED_NAMESPACES,e.join(","))}catch{console.info("Unable to set namespaces in storage")}},addConnectedNamespace(t){try{const e=z.getConnectedNamespaces();e.includes(t)||(e.push(t),z.setConnectedNamespaces(e))}catch{console.info("Unable to add connected namespace")}},removeConnectedNamespace(t){try{const e=z.getConnectedNamespaces(),s=e.indexOf(t);s>-1&&(e.splice(s,1),z.setConnectedNamespaces(e))}catch{console.info("Unable to remove connected namespace")}},getTelegramSocialProvider(){try{return Z.getItem(ee.TELEGRAM_SOCIAL_PROVIDER)}catch{return console.info("Unable to get telegram social provider"),null}},setTelegramSocialProvider(t){try{Z.setItem(ee.TELEGRAM_SOCIAL_PROVIDER,t)}catch{console.info("Unable to set telegram social provider")}},removeTelegramSocialProvider(){try{Z.removeItem(ee.TELEGRAM_SOCIAL_PROVIDER)}catch{console.info("Unable to remove telegram social provider")}},getBalanceCache(){let t={};try{const e=Z.getItem(ee.PORTFOLIO_CACHE);t=e?JSON.parse(e):{}}catch{console.info("Unable to get balance cache")}return t},removeAddressFromBalanceCache(t){try{const e=z.getBalanceCache();Z.setItem(ee.PORTFOLIO_CACHE,JSON.stringify({...e,[t]:void 0}))}catch{console.info("Unable to remove address from balance cache",t)}},getBalanceCacheForCaipAddress(t){try{const s=z.getBalanceCache()[t];if(s&&!this.isCacheExpired(s.timestamp,this.cacheExpiry.portfolio))return s.balance;z.removeAddressFromBalanceCache(t)}catch{console.info("Unable to get balance cache for address",t)}},updateBalanceCache(t){try{const e=z.getBalanceCache();e[t.caipAddress]=t,Z.setItem(ee.PORTFOLIO_CACHE,JSON.stringify(e))}catch{console.info("Unable to update balance cache",t)}},getNativeBalanceCache(){let t={};try{const e=Z.getItem(ee.NATIVE_BALANCE_CACHE);t=e?JSON.parse(e):{}}catch{console.info("Unable to get balance cache")}return t},removeAddressFromNativeBalanceCache(t){try{const e=z.getBalanceCache();Z.setItem(ee.NATIVE_BALANCE_CACHE,JSON.stringify({...e,[t]:void 0}))}catch{console.info("Unable to remove address from balance cache",t)}},getNativeBalanceCacheForCaipAddress(t){try{const s=z.getNativeBalanceCache()[t];if(s&&!this.isCacheExpired(s.timestamp,this.cacheExpiry.nativeBalance))return s;console.info("Discarding cache for address",t),z.removeAddressFromBalanceCache(t)}catch{console.info("Unable to get balance cache for address",t)}},updateNativeBalanceCache(t){try{const e=z.getNativeBalanceCache();e[t.caipAddress]=t,Z.setItem(ee.NATIVE_BALANCE_CACHE,JSON.stringify(e))}catch{console.info("Unable to update balance cache",t)}},getEnsCache(){let t={};try{const e=Z.getItem(ee.ENS_CACHE);t=e?JSON.parse(e):{}}catch{console.info("Unable to get ens name cache")}return t},getEnsFromCacheForAddress(t){try{const s=z.getEnsCache()[t];if(s&&!this.isCacheExpired(s.timestamp,this.cacheExpiry.ens))return s.ens;z.removeEnsFromCache(t)}catch{console.info("Unable to get ens name from cache",t)}},updateEnsCache(t){try{const e=z.getEnsCache();e[t.address]=t,Z.setItem(ee.ENS_CACHE,JSON.stringify(e))}catch{console.info("Unable to update ens name cache",t)}},removeEnsFromCache(t){try{const e=z.getEnsCache();Z.setItem(ee.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=Z.getItem(ee.IDENTITY_CACHE);t=e?JSON.parse(e):{}}catch{console.info("Unable to get identity cache")}return t},getIdentityFromCacheForAddress(t){try{const s=z.getIdentityCache()[t];if(s&&!this.isCacheExpired(s.timestamp,this.cacheExpiry.identity))return s.identity;z.removeIdentityFromCache(t)}catch{console.info("Unable to get identity from cache",t)}},updateIdentityCache(t){try{const e=z.getIdentityCache();e[t.address]={identity:t.identity,timestamp:t.timestamp},Z.setItem(ee.IDENTITY_CACHE,JSON.stringify(e))}catch{console.info("Unable to update identity cache",t)}},removeIdentityFromCache(t){try{const e=z.getIdentityCache();Z.setItem(ee.IDENTITY_CACHE,JSON.stringify({...e,[t]:void 0}))}catch{console.info("Unable to remove identity from cache",t)}},clearAddressCache(){try{Z.removeItem(ee.PORTFOLIO_CACHE),Z.removeItem(ee.NATIVE_BALANCE_CACHE),Z.removeItem(ee.ENS_CACHE),Z.removeItem(ee.IDENTITY_CACHE)}catch{console.info("Unable to clear address cache")}},setPreferredAccountTypes(t){try{Z.setItem(ee.PREFERRED_ACCOUNT_TYPES,JSON.stringify(t))}catch{console.info("Unable to set preferred account types",t)}},getPreferredAccountTypes(){try{const t=Z.getItem(ee.PREFERRED_ACCOUNT_TYPES);return t?JSON.parse(t):{}}catch{console.info("Unable to get preferred account types")}return{}},setConnections(t,e){try{const s={...z.getConnections(),[e]:t};Z.setItem(ee.CONNECTIONS,JSON.stringify(s))}catch(s){console.error("Unable to sync connections to storage",s)}},getConnections(){try{const t=Z.getItem(ee.CONNECTIONS);return t?JSON.parse(t):{}}catch(t){return console.error("Unable to get connections from storage",t),{}}}},X={isMobile(){return this.isClient()?!!(typeof window?.matchMedia=="function"&&window?.matchMedia("(pointer:coarse)")?.matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},checkCaipNetwork(t,e=""){return t?.caipNetworkId.toLocaleLowerCase().includes(e.toLowerCase())},isAndroid(){if(!this.isMobile())return!1;const t=window?.navigator.userAgent.toLowerCase();return X.isMobile()&&t.includes("android")},isIos(){if(!this.isMobile())return!1;const t=window?.navigator.userAgent.toLowerCase();return t.includes("iphone")||t.includes("ipad")},isSafari(){return this.isClient()?(window?.navigator.userAgent.toLowerCase()).includes("safari"):!1},isClient(){return typeof window<"u"},isPairingExpired(t){return t?t-Date.now()<=ve.TEN_SEC_MS:!0},isAllowedRetry(t,e=ve.ONE_SEC_MS){return Date.now()-t>=e},copyToClopboard(t){navigator.clipboard.writeText(t)},isIframe(){try{return window?.self!==window?.top}catch{return!1}},isSafeApp(){if(X.isClient()&&window.self!==window.top)try{const t=window?.location?.ancestorOrigins?.[0],e="https://app.safe.global";if(t){const s=new URL(t),r=new URL(e);return s.hostname===r.hostname}}catch{return!1}return!1},getPairingExpiry(){return Date.now()+ve.FOUR_MINUTES_MS},getNetworkId(t){return t?.split(":")[1]},getPlainAddress(t){return t?.split(":")[2]},async wait(t){return new Promise(e=>{setTimeout(e,t)})},debounce(t,e=500){let s;return(...r)=>{function i(){t(...r)}s&&clearTimeout(s),s=setTimeout(i,e)}},isHttpUrl(t){return t.startsWith("http://")||t.startsWith("https://")},formatNativeUrl(t,e,s=null){if(X.isHttpUrl(t))return this.formatUniversalUrl(t,e);let r=t,i=s;r.includes("://")||(r=t.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),i&&!i?.endsWith("/")&&(i=`${i}/`),this.isTelegram()&&this.isAndroid()&&(e=encodeURIComponent(e));const n=encodeURIComponent(e);return{redirect:`${r}wc?uri=${n}`,redirectUniversalLink:i?`${i}wc?uri=${n}`:void 0,href:r}},formatUniversalUrl(t,e){if(!X.isHttpUrl(t))return this.formatNativeUrl(t,e);let s=t;s.endsWith("/")||(s=`${s}/`);const r=encodeURIComponent(e);return{redirect:`${s}wc?uri=${r}`,href:s}},getOpenTargetForPlatform(t){return t==="popupWindow"?t:this.isTelegram()?z.getTelegramSocialProvider()?"_top":"_blank":t},openHref(t,e,s){window?.open(t,this.getOpenTargetForPlatform(e),s||"noreferrer noopener")},returnOpenHref(t,e,s){return window?.open(t,this.getOpenTargetForPlatform(e),s||"noreferrer noopener")},isTelegram(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)},isPWA(){if(typeof window>"u")return!1;const t=window.matchMedia?.("(display-mode: standalone)")?.matches,e=window?.navigator?.standalone;return!!(t||e)},async preloadImage(t){const e=new Promise((s,r)=>{const i=new Image;i.onload=s,i.onerror=r,i.crossOrigin="anonymous",i.src=t});return Promise.race([e,X.wait(2e3)])},formatBalance(t,e){let s="0.000";if(typeof t=="string"){const r=Number(t);if(r){const i=Math.floor(r*1e3)/1e3;i&&(s=i.toString())}}return`${s}${e?` ${e}`:""}`},formatBalance2(t,e){let s;if(t==="0")s="0";else if(typeof t=="string"){const r=Number(t);r&&(s=r.toString().match(/^-?\d+(?:\.\d{0,3})?/u)?.[0])}return{value:s??"0",rest:s==="0"?"000":"",symbol:e}},getApiUrl(){return H.W3M_API_URL},getBlockchainApiUrl(){return H.BLOCKCHAIN_API_RPC_URL},getAnalyticsUrl(){return H.PULSE_API_URL},getUUID(){return 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){return typeof t=="string"?t:typeof t?.issues?.[0]?.message=="string"?t.issues[0].message:t instanceof Error?t.message:"Unknown error"},sortRequestedNetworks(t,e=[]){const s={};return e&&t&&(t.forEach((r,i)=>{s[r]=i}),e.sort((r,i)=>{const n=s[r.id],o=s[i.id];return n!==void 0&&o!==void 0?n-o:n!==void 0?-1:o!==void 0?1:0})),e},calculateBalance(t){let e=0;for(const s of t)e+=s.value??0;return e},formatTokenBalance(t){const e=t.toFixed(2),[s,r]=e.split(".");return{dollars:s,pennies:r}},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 s=new Set;return t.filter(r=>{const i=r[e];return s.has(i)?!1:(s.add(i),!0)})},generateSdkVersion(t,e,s){const i=t.length===0?ve.ADAPTER_TYPES.UNIVERSAL:t.map(n=>n.adapterType).join(",");return`${e}-${i}-${s}`},createAccount(t,e,s,r,i){return{namespace:t,address:e,type:s,publicKey:r,path:i}},isCaipAddress(t){if(typeof t!="string")return!1;const e=t.split(":"),s=e[0];return e.filter(Boolean).length===3&&s in H.CHAIN_NAME_MAP},isMac(){const t=window?.navigator.userAgent.toLowerCase();return t.includes("macintosh")&&!t.includes("safari")},formatTelegramSocialLoginUrl(t){const e=`--${encodeURIComponent(window?.location.href)}`,s="state=";if(new URL(t).host==="auth.magic.link"){const i="provider_authorization_url=",n=t.substring(t.indexOf(i)+i.length),o=this.injectIntoUrl(decodeURIComponent(n),s,e);return t.replace(n,encodeURIComponent(o))}return this.injectIntoUrl(t,s,e)},injectIntoUrl(t,e,s){const r=t.indexOf(e);if(r===-1)throw new Error(`${e} parameter not found in the URL: ${t}`);const i=t.indexOf("&",r),n=e.length,o=i!==-1?i:t.length,a=t.substring(0,r+n),c=t.substring(r+n,o),l=t.substring(i),u=c+s;return a+u+l}};async function ni(...t){const e=await fetch(...t);if(!e.ok)throw new Error(`HTTP status code: ${e.status}`,{cause:e});return e}class un{constructor({baseUrl:e,clientId:s}){this.baseUrl=e,this.clientId=s}async get({headers:e,signal:s,cache:r,...i}){const n=this.createUrl(i);return(await ni(n,{method:"GET",headers:e,signal:s,cache:r})).json()}async getBlob({headers:e,signal:s,...r}){const i=this.createUrl(r);return(await ni(i,{method:"GET",headers:e,signal:s})).blob()}async post({body:e,headers:s,signal:r,...i}){const n=this.createUrl(i);return(await ni(n,{method:"POST",headers:s,body:e?JSON.stringify(e):void 0,signal:r})).json()}async put({body:e,headers:s,signal:r,...i}){const n=this.createUrl(i);return(await ni(n,{method:"PUT",headers:s,body:e?JSON.stringify(e):void 0,signal:r})).json()}async delete({body:e,headers:s,signal:r,...i}){const n=this.createUrl(i);return(await ni(n,{method:"DELETE",headers:s,body:e?JSON.stringify(e):void 0,signal:r})).json()}createUrl({path:e,params:s}){const r=new URL(e,this.baseUrl);return s&&Object.entries(s).forEach(([i,n])=>{n&&r.searchParams.append(i,n)}),this.clientId&&r.searchParams.append("clientId",this.clientId),r}}const cp={getFeatureValue(t,e){const s=e?.[t];return s===void 0?ve.DEFAULT_FEATURES[t]:s},filterSocialsByPlatform(t){if(!t||!t.length)return t;if(X.isTelegram()){if(X.isIos())return t.filter(e=>e!=="google");if(X.isMac())return t.filter(e=>e!=="x");if(X.isAndroid())return t.filter(e=>!["facebook","x"].includes(e))}return t}},K=_e({features:ve.DEFAULT_FEATURES,projectId:"",sdkType:"appkit",sdkVersion:"html-wagmi-undefined",defaultAccountTypes:ve.DEFAULT_ACCOUNT_TYPES,enableNetworkSwitch:!0,experimental_preferUniversalLinks:!1,remoteFeatures:{}}),k={state:K,subscribeKey(t,e){return Qe(K,t,e)},setOptions(t){Object.assign(K,t)},setRemoteFeatures(t){if(!t)return;const e={...K.remoteFeatures,...t};K.remoteFeatures=e,K.remoteFeatures?.socials&&(K.remoteFeatures.socials=cp.filterSocialsByPlatform(K.remoteFeatures.socials))},setFeatures(t){if(!t)return;K.features||(K.features=ve.DEFAULT_FEATURES);const e={...K.features,...t};K.features=e},setProjectId(t){K.projectId=t},setCustomRpcUrls(t){K.customRpcUrls=t},setAllWallets(t){K.allWallets=t},setIncludeWalletIds(t){K.includeWalletIds=t},setExcludeWalletIds(t){K.excludeWalletIds=t},setFeaturedWalletIds(t){K.featuredWalletIds=t},setTokens(t){K.tokens=t},setTermsConditionsUrl(t){K.termsConditionsUrl=t},setPrivacyPolicyUrl(t){K.privacyPolicyUrl=t},setCustomWallets(t){K.customWallets=t},setIsSiweEnabled(t){K.isSiweEnabled=t},setIsUniversalProvider(t){K.isUniversalProvider=t},setSdkVersion(t){K.sdkVersion=t},setMetadata(t){K.metadata=t},setDisableAppend(t){K.disableAppend=t},setEIP6963Enabled(t){K.enableEIP6963=t},setDebug(t){K.debug=t},setEnableWalletConnect(t){K.enableWalletConnect=t},setEnableWalletGuide(t){K.enableWalletGuide=t},setEnableAuthLogger(t){K.enableAuthLogger=t},setEnableWallets(t){K.enableWallets=t},setPreferUniversalLinks(t){K.experimental_preferUniversalLinks=t},setHasMultipleAddresses(t){K.hasMultipleAddresses=t},setSIWX(t){K.siwx=t},setConnectMethodsOrder(t){K.features={...K.features,connectMethodsOrder:t}},setWalletFeaturesOrder(t){K.features={...K.features,walletFeaturesOrder:t}},setSocialsOrder(t){K.remoteFeatures={...K.remoteFeatures,socials:t}},setCollapseWallets(t){K.features={...K.features,collapseWallets:t}},setEnableEmbedded(t){K.enableEmbedded=t},setAllowUnsupportedChain(t){K.allowUnsupportedChain=t},setManualWCControl(t){K.manualWCControl=t},setEnableNetworkSwitch(t){K.enableNetworkSwitch=t},setDefaultAccountTypes(t={}){Object.entries(t).forEach(([e,s])=>{s&&(K.defaultAccountTypes[e]=s)})},setUniversalProviderConfigOverride(t){K.universalProviderConfigOverride=t},getUniversalProviderConfigOverride(){return K.universalProviderConfigOverride},getSnapshot(){return Ti(K)}},lp=Object.freeze({enabled:!0,events:[]}),up=new un({baseUrl:X.getAnalyticsUrl(),clientId:null}),dp=5,hp=60*1e3,ps=_e({...lp}),pp={state:ps,subscribeKey(t,e){return Qe(ps,t,e)},async sendError(t,e){if(!ps.enabled)return;const s=Date.now();if(ps.events.filter(n=>{const o=new Date(n.properties.timestamp||"").getTime();return s-o<hp}).length>=dp)return;const i={type:"error",event:e,properties:{errorType:t.name,errorMessage:t.message,stackTrace:t.stack,timestamp:new Date().toISOString()}};ps.events.push(i);try{if(typeof window>"u")return;const{projectId:n,sdkType:o,sdkVersion:a}=k.state;await up.post({path:"/e",params:{projectId:n,st:o,sv:a||"html-wagmi-4.2.2"},body:{eventId:X.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(){ps.enabled=!0},disable(){ps.enabled=!1},clearEvents(){ps.events=[]}};class Dr extends Error{constructor(e,s,r){super(e),this.name="AppKitError",this.category=s,this.originalError=r,Object.setPrototypeOf(this,Dr.prototype);let i=!1;if(r instanceof Error&&typeof r.stack=="string"&&r.stack){const n=r.stack,o=n.indexOf(`
|
|
3
3
|
`);if(o>-1){const a=n.substring(o+1);this.stack=`${this.name}: ${this.message}
|
|
4
4
|
${a}`,i=!0}}i||(Error.captureStackTrace?Error.captureStackTrace(this,Dr):this.stack||(this.stack=`${this.name}: ${this.message}`))}}function pc(t,e){const s=t instanceof Dr?t:new Dr(t instanceof Error?t.message:String(t),e,t);throw pp.sendError(s,s.category),s}function Et(t,e="INTERNAL_SDK_ERROR"){const s={};return Object.keys(t).forEach(r=>{const i=t[r];if(typeof i=="function"){let n=i;i.constructor.name==="AsyncFunction"?n=async(...o)=>{try{return await i(...o)}catch(a){return pc(a,e)}}:n=(...o)=>{try{return i(...o)}catch(a){return pc(a,e)}},s[r]=n}else s[r]=i}),s}const Vt={PHANTOM:{id:"a797aa35c0fadbfc1a53e7f675162ed5226968b44a19ee3d24385c64d1d3c393",url:"https://phantom.app"},SOLFLARE:{id:"1ca0bdd4747578705b1939af023d120677c64fe6ca76add81fda36e350605e79",url:"https://solflare.com"},COINBASE:{id:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",url:"https://go.cb-w.com"}},fp={handleMobileDeeplinkRedirect(t,e){const s=window.location.href,r=encodeURIComponent(s);if(t===Vt.PHANTOM.id&&!("phantom"in window)){const i=s.startsWith("https")?"https":"http",n=s.split("/")[2],o=encodeURIComponent(`${i}://${n}`);window.location.href=`${Vt.PHANTOM.url}/ul/browse/${r}?ref=${o}`}t===Vt.SOLFLARE.id&&!("solflare"in window)&&(window.location.href=`${Vt.SOLFLARE.url}/ul/v1/browse/${r}?ref=${r}`),e===H.CHAIN.SOLANA&&t===Vt.COINBASE.id&&!("coinbaseSolana"in window)&&(window.location.href=`${Vt.COINBASE.url}/dapp?cb_url=${r}`)}},ht=_e({walletImages:{},networkImages:{},chainImages:{},connectorImages:{},tokenImages:{},currencyImages:{}}),gp={state:ht,subscribeNetworkImages(t){return Ze(ht.networkImages,()=>t(ht.networkImages))},subscribeKey(t,e){return Qe(ht,t,e)},subscribe(t){return Ze(ht,()=>t(ht))},setWalletImage(t,e){ht.walletImages[t]=e},setNetworkImage(t,e){ht.networkImages[t]=e},setChainImage(t,e){ht.chainImages[t]=e},setConnectorImage(t,e){ht.connectorImages={...ht.connectorImages,[t]:e}},setTokenImage(t,e){ht.tokenImages[t]=e},setCurrencyImage(t,e){ht.currencyImages[t]=e}},Dt=Et(gp),mp={eip155:"ba0ba0cd-17c6-4806-ad93-f9d174f17900",solana:"a1b58899-f671-4276-6a5e-56ca5bd59700",polkadot:"",bip122:"0b4838db-0161-4ffe-022d-532bf03dba00",cosmos:""},yo=_e({networkImagePromises:{}}),Uu={async fetchWalletImage(t){if(t)return await V._fetchWalletImage(t),this.getWalletImageById(t)},async fetchNetworkImage(t){if(!t)return;const e=this.getNetworkImageById(t);return e||(yo.networkImagePromises[t]||(yo.networkImagePromises[t]=V._fetchNetworkImage(t)),await yo.networkImagePromises[t],this.getNetworkImageById(t))},getWalletImageById(t){if(t)return Dt.state.walletImages[t]},getWalletImage(t){if(t?.image_url)return t?.image_url;if(t?.image_id)return Dt.state.walletImages[t.image_id]},getNetworkImage(t){if(t?.assets?.imageUrl)return t?.assets?.imageUrl;if(t?.assets?.imageId)return Dt.state.networkImages[t.assets.imageId]},getNetworkImageById(t){if(t)return Dt.state.networkImages[t]},getConnectorImage(t){if(t?.imageUrl)return t.imageUrl;if(t?.imageId)return Dt.state.connectorImages[t.imageId]},getChainImage(t){return Dt.state.networkImages[mp[t]]}},fs=_e({message:"",variant:"info",open:!1}),wp={state:fs,subscribeKey(t,e){return Qe(fs,t,e)},open(t,e){const{debug:s}=k.state,{shortMessage:r,longMessage:i}=t;s&&(fs.message=r,fs.variant=e,fs.open=!0),i&&console.error(typeof i=="function"?i():i)},close(){fs.open=!1,fs.message="",fs.variant="info"}},Ms=Et(wp),yp=X.getAnalyticsUrl(),bp=new un({baseUrl:yp,clientId:null}),vp=["MODAL_CREATED"],Qt=_e({timestamp:Date.now(),reportedErrors:{},data:{type:"track",event:"MODAL_CREATED"}}),Pe={state:Qt,subscribe(t){return Ze(Qt,()=>t(Qt))},getSdkProperties(){const{projectId:t,sdkType:e,sdkVersion:s}=k.state;return{projectId:t,st:e,sv:s||"html-wagmi-4.2.2"}},async _sendAnalyticsEvent(t){try{const e=F.state.address;if(vp.includes(t.data.event)||typeof window>"u")return;await bp.post({path:"/e",params:Pe.getSdkProperties(),body:{eventId:X.getUUID(),url:window.location.href,domain:window.location.hostname,timestamp:t.timestamp,props:{...t.data,address:e}}}),Qt.reportedErrors.FORBIDDEN=!1}catch(e){e instanceof Error&&e.cause instanceof Response&&e.cause.status===H.HTTP_STATUS_CODES.FORBIDDEN&&!Qt.reportedErrors.FORBIDDEN&&(Ms.open({shortMessage:"Invalid App Configuration",longMessage:`Origin ${fi()?window.origin:"uknown"} not found on Allowlist - update configuration on cloud.reown.com`},"error"),Qt.reportedErrors.FORBIDDEN=!0)}},sendEvent(t){Qt.timestamp=Date.now(),Qt.data=t,k.state.features?.analytics&&Pe._sendAnalyticsEvent(Qt)}},Ep=X.getApiUrl(),rt=new un({baseUrl:Ep,clientId:null}),Cp=40,fc=4,Ip=20,te=_e({promises:{},page:1,count:0,featured:[],allFeatured:[],recommended:[],allRecommended:[],wallets:[],filteredWallets:[],search:[],isAnalyticsEnabled:!1,excludedWallets:[],isFetchingRecommendedWallets:!1}),V={state:te,subscribeKey(t,e){return Qe(te,t,e)},_getSdkProperties(){const{projectId:t,sdkType:e,sdkVersion:s}=k.state;return{projectId:t,st:e||"appkit",sv:s||"html-wagmi-4.2.2"}},_filterOutExtensions(t){return k.state.isUniversalProvider?t.filter(e=>!!(e.mobile_link||e.desktop_link||e.webapp_link)):t},async _fetchWalletImage(t){const e=`${rt.baseUrl}/getWalletImage/${t}`,s=await rt.getBlob({path:e,params:V._getSdkProperties()});Dt.setWalletImage(t,URL.createObjectURL(s))},async _fetchNetworkImage(t){const e=`${rt.baseUrl}/public/getAssetImage/${t}`,s=await rt.getBlob({path:e,params:V._getSdkProperties()});Dt.setNetworkImage(t,URL.createObjectURL(s))},async _fetchConnectorImage(t){const e=`${rt.baseUrl}/public/getAssetImage/${t}`,s=await rt.getBlob({path:e,params:V._getSdkProperties()});Dt.setConnectorImage(t,URL.createObjectURL(s))},async _fetchCurrencyImage(t){const e=`${rt.baseUrl}/public/getCurrencyImage/${t}`,s=await rt.getBlob({path:e,params:V._getSdkProperties()});Dt.setCurrencyImage(t,URL.createObjectURL(s))},async _fetchTokenImage(t){const e=`${rt.baseUrl}/public/getTokenImage/${t}`,s=await rt.getBlob({path:e,params:V._getSdkProperties()});Dt.setTokenImage(t,URL.createObjectURL(s))},_filterWalletsByPlatform(t){return X.isMobile()?t?.filter(s=>s.mobile_link||s.id===Vt.COINBASE.id?!0:p.state.activeChain==="solana"&&(s.id===Vt.SOLFLARE.id||s.id===Vt.PHANTOM.id)):t},async fetchProjectConfig(){return(await rt.get({path:"/appkit/v1/config",params:V._getSdkProperties()})).features},async fetchAllowedOrigins(){try{const{allowedOrigins:t}=await rt.get({path:"/projects/v1/origins",params:V._getSdkProperties()});return t}catch{return[]}},async fetchNetworkImages(){const e=p.getAllRequestedCaipNetworks()?.map(({assets:s})=>s?.imageId).filter(Boolean).filter(s=>!Uu.getNetworkImageById(s));e&&await Promise.allSettled(e.map(s=>V._fetchNetworkImage(s)))},async fetchConnectorImages(){const{connectors:t}=B.state,e=t.map(({imageId:s})=>s).filter(Boolean);await Promise.allSettled(e.map(s=>V._fetchConnectorImage(s)))},async fetchCurrencyImages(t=[]){await Promise.allSettled(t.map(e=>V._fetchCurrencyImage(e)))},async fetchTokenImages(t=[]){await Promise.allSettled(t.map(e=>V._fetchTokenImage(e)))},async fetchWallets(t){const e=t.exclude??[];V._getSdkProperties().sv.startsWith("html-core-")&&e.push(...Object.values(Vt).map(n=>n.id));const r=await rt.get({path:"/getWallets",params:{...V._getSdkProperties(),...t,page:String(t.page),entries:String(t.entries),include:t.include?.join(","),exclude:e.join(",")}});return{data:V._filterWalletsByPlatform(r?.data)||[],count:r?.count}},async fetchFeaturedWallets(){const{featuredWalletIds:t}=k.state;if(t?.length){const e={...V._getSdkProperties(),page:1,entries:t?.length??fc,include:t},{data:s}=await V.fetchWallets(e),r=[...s].sort((n,o)=>t.indexOf(n.id)-t.indexOf(o.id)),i=r.map(n=>n.image_id).filter(Boolean);await Promise.allSettled(i.map(n=>V._fetchWalletImage(n))),te.featured=r,te.allFeatured=r}},async fetchRecommendedWallets(){try{te.isFetchingRecommendedWallets=!0;const{includeWalletIds:t,excludeWalletIds:e,featuredWalletIds:s}=k.state,r=[...e??[],...s??[]].filter(Boolean),i=p.getRequestedCaipNetworkIds().join(","),n={page:1,entries:fc,include:t,exclude:r,chains:i},{data:o,count:a}=await V.fetchWallets(n),c=z.getRecentWallets(),l=o.map(d=>d.image_id).filter(Boolean),u=c.map(d=>d.image_id).filter(Boolean);await Promise.allSettled([...l,...u].map(d=>V._fetchWalletImage(d))),te.recommended=o,te.allRecommended=o,te.count=a??0}catch{}finally{te.isFetchingRecommendedWallets=!1}},async fetchWalletsByPage({page:t}){const{includeWalletIds:e,excludeWalletIds:s,featuredWalletIds:r}=k.state,i=p.getRequestedCaipNetworkIds().join(","),n=[...te.recommended.map(({id:u})=>u),...s??[],...r??[]].filter(Boolean),o={page:t,entries:Cp,include:e,exclude:n,chains:i},{data:a,count:c}=await V.fetchWallets(o),l=a.slice(0,Ip).map(u=>u.image_id).filter(Boolean);await Promise.allSettled(l.map(u=>V._fetchWalletImage(u))),te.wallets=X.uniqueBy([...te.wallets,...V._filterOutExtensions(a)],"id").filter(u=>u.chains?.some(d=>i.includes(d))),te.count=c>te.count?c:te.count,te.page=t},async initializeExcludedWallets({ids:t}){const e={page:1,entries:t.length,include:t},{data:s}=await V.fetchWallets(e);s&&s.forEach(r=>{te.excludedWallets.push({rdns:r.rdns,name:r.name})})},async searchWallet({search:t,badge:e}){const{includeWalletIds:s,excludeWalletIds:r}=k.state,i=p.getRequestedCaipNetworkIds().join(",");te.search=[];const n={page:1,entries:100,search:t?.trim(),badge_type:e,include:s,exclude:r,chains:i},{data:o}=await V.fetchWallets(n);Pe.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=>V._fetchWalletImage(c)),X.wait(300)]),te.search=V._filterOutExtensions(o)},initPromise(t,e){const s=te.promises[t];return s||(te.promises[t]=e())},prefetch({fetchConnectorImages:t=!0,fetchFeaturedWallets:e=!0,fetchRecommendedWallets:s=!0,fetchNetworkImages:r=!0}={}){const i=[t&&V.initPromise("connectorImages",V.fetchConnectorImages),e&&V.initPromise("featuredWallets",V.fetchFeaturedWallets),s&&V.initPromise("recommendedWallets",V.fetchRecommendedWallets),r&&V.initPromise("networkImages",V.fetchNetworkImages)].filter(Boolean);return Promise.allSettled(i)},prefetchAnalyticsConfig(){k.state.features?.analytics&&V.fetchAnalyticsConfig()},async fetchAnalyticsConfig(){try{const{isAnalyticsEnabled:t}=await rt.get({path:"/getAnalyticsConfig",params:V._getSdkProperties()});k.setFeatures({analytics:t})}catch{k.setFeatures({analytics:!1})}},filterByNamespaces(t){if(!t?.length){te.featured=te.allFeatured,te.recommended=te.allRecommended;return}const e=p.getRequestedCaipNetworkIds().join(",");te.featured=te.allFeatured.filter(s=>s.chains?.some(r=>e.includes(r))),te.recommended=te.allRecommended.filter(s=>s.chains?.some(r=>e.includes(r))),te.filteredWallets=te.wallets.filter(s=>s.chains?.some(r=>e.includes(r)))},clearFilterByNamespaces(){te.filteredWallets=[]},setFilterByNamespace(t){if(!t){te.featured=te.allFeatured,te.recommended=te.allRecommended;return}const e=p.getRequestedCaipNetworkIds().join(",");te.featured=te.allFeatured.filter(s=>s.chains?.some(r=>e.includes(r))),te.recommended=te.allRecommended.filter(s=>s.chains?.some(r=>e.includes(r))),te.filteredWallets=te.wallets.filter(s=>s.chains?.some(r=>e.includes(r)))}},me=_e({view:"Connect",history:["Connect"],transactionStack:[]}),Ap={state:me,subscribeKey(t,e){return Qe(me,t,e)},pushTransactionStack(t){me.transactionStack.push(t)},popTransactionStack(t){const e=me.transactionStack.pop();if(!e)return;const{onSuccess:s,onError:r,onCancel:i}=e;switch(t){case"success":s?.();break;case"error":r?.(),re.goBack();break;case"cancel":i?.(),re.goBack();break}},push(t,e){t!==me.view&&(me.view=t,me.history.push(t),me.data=e)},reset(t,e){me.view=t,me.history=[t],me.data=e},replace(t,e){me.history.at(-1)===t||(me.view=t,me.history[me.history.length-1]=t,me.data=e)},goBack(){const t=p.state.activeCaipAddress,e=re.state.view==="ConnectingFarcaster",s=!t&&e;if(me.history.length>1){me.history.pop();const[r]=me.history.slice(-1);r&&(t&&r==="Connect"?me.view="Account":me.view=r)}else Fe.close();me.data?.wallet&&(me.data.wallet=void 0),setTimeout(()=>{if(s){F.setFarcasterUrl(void 0,p.state.activeChain);const r=B.getAuthConnector();r?.provider?.reload();const i=Ti(k.state);r?.provider?.syncDappData?.({metadata:i.metadata,sdkVersion:i.sdkVersion,projectId:i.projectId,sdkType:i.sdkType})}},100)},goBackToIndex(t){if(me.history.length>1){me.history=me.history.slice(0,t+1);const[e]=me.history.slice(-1);e&&(me.view=e)}},goBackOrCloseModal(){re.state.history.length>1?re.goBack():Fe.close()}},re=Et(Ap),es=_e({themeMode:"dark",themeVariables:{},w3mThemeVariables:void 0}),Qo={state:es,subscribe(t){return Ze(es,()=>t(es))},setThemeMode(t){es.themeMode=t;try{const e=B.getAuthConnector();if(e){const s=Qo.getSnapshot().themeVariables;e.provider.syncTheme({themeMode:t,themeVariables:s,w3mThemeVariables:Cs(s,t)})}}catch{console.info("Unable to sync theme to auth connector")}},setThemeVariables(t){es.themeVariables={...es.themeVariables,...t};try{const e=B.getAuthConnector();if(e){const s=Qo.getSnapshot().themeVariables;e.provider.syncTheme({themeVariables:s,w3mThemeVariables:Cs(es.themeVariables,es.themeMode)})}}catch{console.info("Unable to sync theme to auth connector")}},getSnapshot(){return Ti(es)}},gt=Et(Qo),Du={eip155:void 0,solana:void 0,polkadot:void 0,bip122:void 0,cosmos:void 0},ae=_e({allConnectors:[],connectors:[],activeConnector:void 0,filterByNamespace:void 0,activeConnectorIds:{...Du},filterByNamespaceMap:{eip155:!0,solana:!0,polkadot:!0,bip122:!0,cosmos:!0}}),Np={state:ae,subscribe(t){return Ze(ae,()=>{t(ae)})},subscribeKey(t,e){return Qe(ae,t,e)},initialize(t){t.forEach(e=>{const s=z.getConnectedConnectorId(e);s&&B.setConnectorId(s,e)})},setActiveConnector(t){t&&(ae.activeConnector=Ys(t))},setConnectors(t){t.filter(i=>!ae.allConnectors.some(n=>n.id===i.id&&B.getConnectorName(n.name)===B.getConnectorName(i.name)&&n.chain===i.chain)).forEach(i=>{i.type!=="MULTI_CHAIN"&&ae.allConnectors.push(Ys(i))});const s=B.getEnabledNamespaces(),r=B.getEnabledConnectors(s);ae.connectors=B.mergeMultiChainConnectors(r)},filterByNamespaces(t){Object.keys(ae.filterByNamespaceMap).forEach(e=>{ae.filterByNamespaceMap[e]=!1}),t.forEach(e=>{ae.filterByNamespaceMap[e]=!0}),B.updateConnectorsForEnabledNamespaces()},filterByNamespace(t,e){ae.filterByNamespaceMap[t]=e,B.updateConnectorsForEnabledNamespaces()},updateConnectorsForEnabledNamespaces(){const t=B.getEnabledNamespaces(),e=B.getEnabledConnectors(t),s=B.areAllNamespacesEnabled();ae.connectors=B.mergeMultiChainConnectors(e),s?V.clearFilterByNamespaces():V.filterByNamespaces(t)},getEnabledNamespaces(){return Object.entries(ae.filterByNamespaceMap).filter(([t,e])=>e).map(([t])=>t)},getEnabledConnectors(t){return ae.allConnectors.filter(e=>t.includes(e.chain))},areAllNamespacesEnabled(){return Object.values(ae.filterByNamespaceMap).every(t=>t)},mergeMultiChainConnectors(t){const e=B.generateConnectorMapByName(t),s=[];return e.forEach(r=>{const i=r[0],n=i?.id===H.CONNECTOR_ID.AUTH;r.length>1&&i?s.push({name:i.name,imageUrl:i.imageUrl,imageId:i.imageId,connectors:[...r],type:n?"AUTH":"MULTI_CHAIN",chain:"eip155",id:i?.id||""}):i&&s.push(i)}),s},generateConnectorMapByName(t){const e=new Map;return t.forEach(s=>{const{name:r}=s,i=B.getConnectorName(r);if(!i)return;const n=e.get(i)||[];n.find(a=>a.chain===s.chain)||n.push(s),e.set(i,n)}),e},getConnectorName(t){return t&&({"Trust Wallet":"Trust"}[t]||t)},getUniqueConnectorsByName(t){const e=[];return t.forEach(s=>{e.find(r=>r.chain===s.chain)||e.push(s)}),e},addConnector(t){if(t.id===H.CONNECTOR_ID.AUTH){const e=t,s=Ti(k.state),r=gt.getSnapshot().themeMode,i=gt.getSnapshot().themeVariables;e?.provider?.syncDappData?.({metadata:s.metadata,sdkVersion:s.sdkVersion,projectId:s.projectId,sdkType:s.sdkType}),e?.provider?.syncTheme({themeMode:r,themeVariables:i,w3mThemeVariables:Cs(i,r)}),B.setConnectors([t])}else B.setConnectors([t])},getAuthConnector(t){const e=t||p.state.activeChain,s=ae.connectors.find(r=>r.id===H.CONNECTOR_ID.AUTH);if(s)return s?.connectors?.length?s.connectors.find(i=>i.chain===e):s},getAnnouncedConnectorRdns(){return ae.connectors.filter(t=>t.type==="ANNOUNCED").map(t=>t.info?.rdns)},getConnectorById(t){return ae.allConnectors.find(e=>e.id===t)},getConnector(t,e){return ae.allConnectors.filter(r=>r.chain===p.state.activeChain).find(r=>r.explorerId===t||r.info?.rdns===e)},syncIfAuthConnector(t){if(t.id!=="ID_AUTH")return;const e=t,s=Ti(k.state),r=gt.getSnapshot().themeMode,i=gt.getSnapshot().themeVariables;e?.provider?.syncDappData?.({metadata:s.metadata,sdkVersion:s.sdkVersion,sdkType:s.sdkType,projectId:s.projectId}),e.provider.syncTheme({themeMode:r,themeVariables:i,w3mThemeVariables:Cs(i,r)})},getConnectorsByNamespace(t){const e=ae.allConnectors.filter(s=>s.chain===t);return B.mergeMultiChainConnectors(e)},selectWalletConnector(t){const e=B.getConnector(t.id,t.rdns),s=p.state.activeChain;fp.handleMobileDeeplinkRedirect(e?.explorerId||t.id,s),e?re.push("ConnectingExternal",{connector:e}):re.push("ConnectingWalletConnect",{wallet:t})},getConnectors(t){return t?B.getConnectorsByNamespace(t):B.mergeMultiChainConnectors(ae.allConnectors)},setFilterByNamespace(t){ae.filterByNamespace=t,ae.connectors=B.getConnectors(t),V.setFilterByNamespace(t)},setConnectorId(t,e){t&&(ae.activeConnectorIds={...ae.activeConnectorIds,[e]:t},z.setConnectedConnectorId(e,t))},removeConnectorId(t){ae.activeConnectorIds={...ae.activeConnectorIds,[t]:void 0},z.deleteConnectedConnectorId(t)},getConnectorId(t){if(t)return ae.activeConnectorIds[t]},isConnected(t){return t?!!ae.activeConnectorIds[t]:Object.values(ae.activeConnectorIds).some(e=>!!e)},resetConnectorIds(){ae.activeConnectorIds={...Du}}},B=Et(Np),Ei={ACCOUNT_TYPES:{SMART_ACCOUNT:"smartAccount"}},Ds=Object.freeze({message:"",variant:"success",svg:void 0,open:!1,autoClose:!0}),Ue=_e({...Ds}),_p={state:Ue,subscribeKey(t,e){return Qe(Ue,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=X.parseError(t);this._showMessage({message:e,variant:"error"})},hide(){Ue.message=Ds.message,Ue.variant=Ds.variant,Ue.svg=Ds.svg,Ue.open=Ds.open,Ue.autoClose=Ds.autoClose},_showMessage({message:t,svg:e,variant:s="success",autoClose:r=Ds.autoClose}){Ue.open?(Ue.open=!1,setTimeout(()=>{Ue.message=t,Ue.variant=s,Ue.svg=e,Ue.open=!0,Ue.autoClose=r},150)):(Ue.message=t,Ue.variant=s,Ue.svg=e,Ue.open=!0,Ue.autoClose=r)}},Lt=_p,Ce=_e({transactions:[],coinbaseTransactions:{},transactionsByYear:{},lastNetworkInView:void 0,loading:!1,empty:!1,next:void 0}),Sp={state:Ce,subscribe(t){return Ze(Ce,()=>t(Ce))},setLastNetworkInView(t){Ce.lastNetworkInView=t},async fetchTransactions(t,e){if(!t)throw new Error("Transactions can't be fetched without an accountAddress");Ce.loading=!0;try{const s=await J.fetchTransactions({account:t,cursor:Ce.next,onramp:e,cache:e==="coinbase"?"no-cache":void 0,chainId:p.state.activeCaipNetwork?.caipNetworkId}),r=mi.filterSpamTransactions(s.data),i=mi.filterByConnectedChain(r),n=[...Ce.transactions,...i];Ce.loading=!1,e==="coinbase"?Ce.coinbaseTransactions=mi.groupTransactionsByYearAndMonth(Ce.coinbaseTransactions,s.data):(Ce.transactions=n,Ce.transactionsByYear=mi.groupTransactionsByYearAndMonth(Ce.transactionsByYear,i)),Ce.empty=n.length===0,Ce.next=s.next?s.next:void 0}catch{const r=p.state.activeChain;Pe.sendEvent({type:"track",event:"ERROR_FETCH_TRANSACTIONS",properties:{address:t,projectId:k.state.projectId,cursor:Ce.next,isSmartAccount:F.state.preferredAccountTypes?.[r]===Ei.ACCOUNT_TYPES.SMART_ACCOUNT}}),Lt.showError("Failed to fetch transactions"),Ce.loading=!1,Ce.empty=!0,Ce.next=void 0}},groupTransactionsByYearAndMonth(t={},e=[]){const s=t;return e.forEach(r=>{const i=new Date(r.metadata.minedAt).getFullYear(),n=new Date(r.metadata.minedAt).getMonth(),o=s[i]??{},c=(o[n]??[]).filter(l=>l.id!==r.id);s[i]={...o,[n]:[...c,r].sort((l,u)=>new Date(u.metadata.minedAt).getTime()-new Date(l.metadata.minedAt).getTime())}}),s},filterSpamTransactions(t){return t.filter(e=>!e.transfers.every(r=>r.nft_info?.flags.is_spam===!0))},filterByConnectedChain(t){const e=p.state.activeCaipNetwork?.caipNetworkId;return t.filter(r=>r.metadata.chain===e)},clearCursor(){Ce.next=void 0},resetTransactions(){Ce.transactions=[],Ce.transactionsByYear={},Ce.lastNetworkInView=void 0,Ce.loading=!1,Ce.empty=!1,Ce.next=void 0}},mi=Et(Sp,"API_ERROR"),Ae=_e({connections:new Map,wcError:!1,buffering:!1,status:"disconnected"});let xs;const Pp={state:Ae,subscribeKey(t,e){return Qe(Ae,t,e)},_getClient(){return Ae._client},setClient(t){Ae._client=Ys(t)},async connectWalletConnect(){if(X.isTelegram()||X.isSafari()&&X.isIos()){if(xs){await xs,xs=void 0;return}if(!X.isPairingExpired(Ae?.wcPairingExpiry)){const t=Ae.wcUri;Ae.wcUri=t;return}xs=Y._getClient()?.connectWalletConnect?.().catch(()=>{}),Y.state.status="connecting",await xs,xs=void 0,Ae.wcPairingExpiry=void 0,Y.state.status="connected"}else await Y._getClient()?.connectWalletConnect?.()},async connectExternal(t,e,s=!0){await Y._getClient()?.connectExternal?.(t),s&&p.setActiveNamespace(e)},async reconnectExternal(t){await Y._getClient()?.reconnectExternal?.(t);const e=t.chain||p.state.activeChain;e&&B.setConnectorId(t.id,e)},async setPreferredAccountType(t,e){Fe.setLoading(!0,p.state.activeChain);const s=B.getAuthConnector();s&&(F.setPreferredAccountType(t,e),await s.provider.setPreferredAccount(t),z.setPreferredAccountTypes(F.state.preferredAccountTypes??{[e]:t}),await Y.reconnectExternal(s),Fe.setLoading(!1,p.state.activeChain),Pe.sendEvent({type:"track",event:"SET_PREFERRED_ACCOUNT_TYPE",properties:{accountType:t,network:p.state.activeCaipNetwork?.caipNetworkId||""}}))},async signMessage(t){return Y._getClient()?.signMessage(t)},parseUnits(t,e){return Y._getClient()?.parseUnits(t,e)},formatUnits(t,e){return Y._getClient()?.formatUnits(t,e)},async sendTransaction(t){return Y._getClient()?.sendTransaction(t)},async getCapabilities(t){return Y._getClient()?.getCapabilities(t)},async grantPermissions(t){return Y._getClient()?.grantPermissions(t)},async walletGetAssets(t){return Y._getClient()?.walletGetAssets(t)??{}},async estimateGas(t){return Y._getClient()?.estimateGas(t)},async writeContract(t){return Y._getClient()?.writeContract(t)},async getEnsAddress(t){return Y._getClient()?.getEnsAddress(t)},async getEnsAvatar(t){return Y._getClient()?.getEnsAvatar(t)},checkInstalled(t){return Y._getClient()?.checkInstalled?.(t)||!1},resetWcConnection(){Ae.wcUri=void 0,Ae.wcPairingExpiry=void 0,Ae.wcLinking=void 0,Ae.recentWallet=void 0,Ae.status="disconnected",mi.resetTransactions(),z.deleteWalletConnectDeepLink()},resetUri(){Ae.wcUri=void 0,Ae.wcPairingExpiry=void 0,xs=void 0},finalizeWcConnection(){const{wcLinking:t,recentWallet:e}=Y.state;t&&z.setWalletConnectDeepLink(t),e&&z.setAppKitRecent(e),Pe.sendEvent({type:"track",event:"CONNECT_SUCCESS",properties:{method:t?"mobile":"qrcode",name:re.state.data?.wallet?.name||"Unknown"}})},setWcBasic(t){Ae.wcBasic=t},setUri(t){Ae.wcUri=t,Ae.wcPairingExpiry=X.getPairingExpiry()},setWcLinking(t){Ae.wcLinking=t},setWcError(t){Ae.wcError=t,Ae.buffering=!1},setRecentWallet(t){Ae.recentWallet=t},setBuffering(t){Ae.buffering=t},setStatus(t){Ae.status=t},async disconnect(t){try{await Y._getClient()?.disconnect(t)}catch(e){throw new Dr("Failed to disconnect","INTERNAL_SDK_ERROR",e)}},setConnections(t,e){Ae.connections.set(e,t)},switchAccount({connection:t,address:e,namespace:s}){if(B.state.activeConnectorIds[s]===t.connectorId){const n=p.state.activeCaipNetwork;if(n){const o=`${s}:${n.id}:${e}`;F.setCaipAddress(o,s)}else console.warn(`No current network found for namespace "${s}"`)}else{const n=B.getConnector(t.connectorId);n?Y.connectExternal(n,s):console.warn(`No connector found for namespace "${s}"`)}}},Y=Et(Pp),cr=_e({loading:!1,open:!1,selectedNetworkId:void 0,activeChain:void 0,initialized:!1}),As={state:cr,subscribe(t){return Ze(cr,()=>t(cr))},subscribeOpen(t){return Qe(cr,"open",t)},set(t){Object.assign(cr,{...cr,...t})}};function Op(t,e){let s=t.toString();const r=s.startsWith("-");r&&(s=s.slice(1)),s=s.padStart(e,"0");let[i,n]=[s.slice(0,s.length-e),s.slice(s.length-e)];return n=n.replace(/(0+)$/,""),`${r?"-":""}${i||"0"}${n?`.${n}`:""}`}const bo={createBalance(t,e){const s={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:s.name,symbol:s.symbol,chainId:e,address:t.address==="native"?void 0:this.convertAddressToCAIP10Address(t.address,e),value:s.value,price:s.price,quantity:{decimals:s.decimals.toString(),numeric:this.convertHexToBalance({hex:t.balance,decimals:s.decimals})},iconUrl:s.iconUrl}},convertHexToBalance({hex:t,decimals:e}){return Op(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 s=e[1],r=parseInt(s,10);return isNaN(r)?"0x0":`0x${r.toString(16)}`},isWalletGetAssetsResponse(t){return typeof t!="object"||t===null?!1:Object.values(t).every(e=>Array.isArray(e)&&e.every(s=>this.isValidAsset(s)))},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"}},gc={async getMyTokensWithBalance(t){const e=F.state.address,s=p.state.activeCaipNetwork;if(!e||!s)return[];if(s.chainNamespace==="eip155"){const i=await this.getEIP155Balances(e,s);if(i)return this.filterLowQualityTokens(i)}const r=await J.getBalance(e,s.caipNetworkId,t);return this.filterLowQualityTokens(r.balances)},async getEIP155Balances(t,e){try{const s=bo.getChainIdHexFromCAIP2ChainId(e.caipNetworkId);if(!(await Y.getCapabilities(t))?.[s]?.assetDiscovery?.supported)return null;const i=await Y.walletGetAssets({account:t,chainFilter:[s]});return bo.isWalletGetAssetsResponse(i)?(i[s]||[]).map(o=>bo.createBalance(o,e.caipNetworkId)):null}catch{return null}},filterLowQualityTokens(t){return t.filter(e=>e.quantity.decimals!=="0")},mapBalancesToSwapTokens(t){return t?.map(e=>({...e,address:e?.address?e.address:p.getActiveNetworkTokenAddress(),decimals:parseInt(e.quantity.decimals,10),logoUri:e.iconUrl,eip2612:!1}))||[]}},fe=_e({tokenBalances:[],loading:!1}),kp={state:fe,subscribe(t){return Ze(fe,()=>t(fe))},subscribeKey(t,e){return Qe(fe,t,e)},setToken(t){t&&(fe.token=Ys(t))},setTokenAmount(t){fe.sendTokenAmount=t},setReceiverAddress(t){fe.receiverAddress=t},setReceiverProfileImageUrl(t){fe.receiverProfileImageUrl=t},setReceiverProfileName(t){fe.receiverProfileName=t},setNetworkBalanceInUsd(t){fe.networkBalanceInUSD=t},setLoading(t){fe.loading=t},async sendToken(){try{switch(de.setLoading(!0),p.state.activeCaipNetwork?.chainNamespace){case"eip155":await de.sendEvmToken();return;case"solana":await de.sendSolanaToken();return;default:throw new Error("Unsupported chain")}}finally{de.setLoading(!1)}},async sendEvmToken(){const t=p.state.activeChain,e=F.state.preferredAccountTypes?.[t];if(!de.state.sendTokenAmount||!de.state.receiverAddress)throw new Error("An amount and receiver address are required");if(!de.state.token)throw new Error("A token is required");de.state.token?.address?(Pe.sendEvent({type:"track",event:"SEND_INITIATED",properties:{isSmartAccount:e===Ei.ACCOUNT_TYPES.SMART_ACCOUNT,token:de.state.token.address,amount:de.state.sendTokenAmount,network:p.state.activeCaipNetwork?.caipNetworkId||""}}),await de.sendERC20Token({receiverAddress:de.state.receiverAddress,tokenAddress:de.state.token.address,sendTokenAmount:de.state.sendTokenAmount,decimals:de.state.token.quantity.decimals})):(Pe.sendEvent({type:"track",event:"SEND_INITIATED",properties:{isSmartAccount:e===Ei.ACCOUNT_TYPES.SMART_ACCOUNT,token:de.state.token.symbol||"",amount:de.state.sendTokenAmount,network:p.state.activeCaipNetwork?.caipNetworkId||""}}),await de.sendNativeToken({receiverAddress:de.state.receiverAddress,sendTokenAmount:de.state.sendTokenAmount,decimals:de.state.token.quantity.decimals}))},async fetchTokenBalance(t){fe.loading=!0;const e=p.state.activeCaipNetwork?.caipNetworkId,s=p.state.activeCaipNetwork?.chainNamespace,r=p.state.activeCaipAddress,i=r?X.getPlainAddress(r):void 0;if(fe.lastRetry&&!X.isAllowedRetry(fe.lastRetry,30*ve.ONE_SEC_MS))return fe.loading=!1,[];try{if(i&&e&&s){const n=await gc.getMyTokensWithBalance();return fe.tokenBalances=n,fe.lastRetry=void 0,n}}catch(n){fe.lastRetry=Date.now(),t?.(n),Lt.showError("Token Balance Unavailable")}finally{fe.loading=!1}return[]},fetchNetworkBalance(){if(fe.tokenBalances.length===0)return;const t=gc.mapBalancesToSwapTokens(fe.tokenBalances);if(!t)return;const e=t.find(s=>s.address===p.getActiveNetworkTokenAddress());e&&(fe.networkBalanceInUSD=e?Yh.multiply(e.quantity.numeric,e.price).toString():"0")},async sendNativeToken(t){re.pushTransactionStack({});const e=t.receiverAddress,s=F.state.address,r=Y.parseUnits(t.sendTokenAmount.toString(),Number(t.decimals));await Y.sendTransaction({chainNamespace:"eip155",to:e,address:s,data:"0x",value:r??BigInt(0)}),Pe.sendEvent({type:"track",event:"SEND_SUCCESS",properties:{isSmartAccount:F.state.preferredAccountTypes?.eip155===Ei.ACCOUNT_TYPES.SMART_ACCOUNT,token:de.state.token?.symbol||"",amount:t.sendTokenAmount,network:p.state.activeCaipNetwork?.caipNetworkId||""}}),Y._getClient()?.updateBalance("eip155"),de.resetSend()},async sendERC20Token(t){re.pushTransactionStack({onSuccess(){re.replace("Account")}});const e=Y.parseUnits(t.sendTokenAmount.toString(),Number(t.decimals));if(F.state.address&&t.sendTokenAmount&&t.receiverAddress&&t.tokenAddress){const s=X.getPlainAddress(t.tokenAddress);await Y.writeContract({fromAddress:F.state.address,tokenAddress:s,args:[t.receiverAddress,e??BigInt(0)],method:"transfer",abi:ep.getERC20Abi(s),chainNamespace:"eip155"}),de.resetSend()}},async sendSolanaToken(){if(!de.state.sendTokenAmount||!de.state.receiverAddress)throw new Error("An amount and receiver address are required");re.pushTransactionStack({onSuccess(){re.replace("Account")}}),await Y.sendTransaction({chainNamespace:"solana",to:de.state.receiverAddress,value:de.state.sendTokenAmount}),Y._getClient()?.updateBalance("solana"),de.resetSend()},resetSend(){fe.token=void 0,fe.sendTokenAmount=void 0,fe.receiverAddress=void 0,fe.receiverProfileImageUrl=void 0,fe.receiverProfileName=void 0,fe.loading=!1,fe.tokenBalances=[]}},de=Et(kp),vo={currentTab:0,tokenBalance:[],smartAccountDeployed:!1,addressLabels:new Map,allAccounts:[],user:void 0},En={caipNetwork:void 0,supportsAllNetworks:!0,smartAccountEnabledNetworks:[]},M=_e({chains:op(),activeCaipAddress:void 0,activeChain:void 0,activeCaipNetwork:void 0,noAdapters:!1,universalAdapter:{networkControllerClient:void 0,connectionControllerClient:void 0},isSwitchingNamespace:!1}),Tp={state:M,subscribe(t){return Ze(M,()=>{t(M)})},subscribeKey(t,e){return Qe(M,t,e)},subscribeChainProp(t,e,s){let r;return Ze(M.chains,()=>{const i=s||M.activeChain;if(i){const n=M.chains.get(i)?.[t];r!==n&&(r=n,e(n))}})},initialize(t,e,s){const{chainId:r,namespace:i}=z.getActiveNetworkProps(),n=e?.find(u=>u.id.toString()===r?.toString()),a=t.find(u=>u?.namespace===i)||t?.[0],c=t.map(u=>u.namespace).filter(u=>u!==void 0),l=k.state.enableEmbedded?new Set([...c]):new Set([...e?.map(u=>u.chainNamespace)??[]]);(t?.length===0||!a)&&(M.noAdapters=!0),M.noAdapters||(M.activeChain=a?.namespace,M.activeCaipNetwork=n,p.setChainNetworkData(a?.namespace,{caipNetwork:n}),M.activeChain&&As.set({activeChain:a?.namespace})),l.forEach(u=>{const d=e?.filter(h=>h.chainNamespace===u);p.state.chains.set(u,{namespace:u,networkState:_e({...En,caipNetwork:d?.[0]}),accountState:_e(vo),caipNetworks:d??[],...s}),p.setRequestedCaipNetworks(d??[],u)})},removeAdapter(t){if(M.activeChain===t){const e=Array.from(M.chains.entries()).find(([s])=>s!==t);if(e){const s=e[1]?.caipNetworks?.[0];s&&p.setActiveCaipNetwork(s)}}M.chains.delete(t)},addAdapter(t,{networkControllerClient:e,connectionControllerClient:s},r){M.chains.set(t.namespace,{namespace:t.namespace,networkState:{...En,caipNetwork:r[0]},accountState:vo,caipNetworks:r,connectionControllerClient:s,networkControllerClient:e}),p.setRequestedCaipNetworks(r?.filter(i=>i.chainNamespace===t.namespace)??[],t.namespace)},addNetwork(t){const e=M.chains.get(t.chainNamespace);if(e){const s=[...e.caipNetworks||[]];e.caipNetworks?.find(r=>r.id===t.id)||s.push(t),M.chains.set(t.chainNamespace,{...e,caipNetworks:s}),p.setRequestedCaipNetworks(s,t.chainNamespace),B.filterByNamespace(t.chainNamespace,!0)}},removeNetwork(t,e){const s=M.chains.get(t);if(s){const r=M.activeCaipNetwork?.id===e,i=[...s.caipNetworks?.filter(n=>n.id!==e)||[]];r&&s?.caipNetworks?.[0]&&p.setActiveCaipNetwork(s.caipNetworks[0]),M.chains.set(t,{...s,caipNetworks:i}),p.setRequestedCaipNetworks(i||[],t),i.length===0&&B.filterByNamespace(t,!1)}},setAdapterNetworkState(t,e){const s=M.chains.get(t);s&&(s.networkState={...s.networkState||En,...e},M.chains.set(t,s))},setChainAccountData(t,e,s=!0){if(!t)throw new Error("Chain is required to update chain account data");const r=M.chains.get(t);if(r){const i={...r.accountState||vo,...e};M.chains.set(t,{...r,accountState:i}),(M.chains.size===1||M.activeChain===t)&&(e.caipAddress&&(M.activeCaipAddress=e.caipAddress),F.replaceState(i))}},setChainNetworkData(t,e){if(!t)return;const s=M.chains.get(t);if(s){const r={...s.networkState||En,...e};M.chains.set(t,{...s,networkState:r})}},setAccountProp(t,e,s,r=!0){p.setChainAccountData(s,{[t]:e},r),t==="status"&&e==="disconnected"&&s&&B.removeConnectorId(s)},setActiveNamespace(t){M.activeChain=t;const e=t?M.chains.get(t):void 0,s=e?.networkState?.caipNetwork;s?.id&&t&&(M.activeCaipAddress=e?.accountState?.caipAddress,M.activeCaipNetwork=s,p.setChainNetworkData(t,{caipNetwork:s}),z.setActiveCaipNetworkId(s?.caipNetworkId),As.set({activeChain:t,selectedNetworkId:s?.caipNetworkId}))},setActiveCaipNetwork(t){if(!t)return;M.activeChain!==t.chainNamespace&&p.setIsSwitchingNamespace(!0);const e=M.chains.get(t.chainNamespace);M.activeChain=t.chainNamespace,M.activeCaipNetwork=t,p.setChainNetworkData(t.chainNamespace,{caipNetwork:t}),e?.accountState?.address?M.activeCaipAddress=`${t.chainNamespace}:${t.id}:${e?.accountState?.address}`:M.activeCaipAddress=void 0,p.setAccountProp("caipAddress",M.activeCaipAddress,t.chainNamespace),e&&F.replaceState(e.accountState),de.resetSend(),As.set({activeChain:M.activeChain,selectedNetworkId:M.activeCaipNetwork?.caipNetworkId}),z.setActiveCaipNetworkId(t.caipNetworkId),!p.checkIfSupportedNetwork(t.chainNamespace)&&k.state.enableNetworkSwitch&&!k.state.allowUnsupportedChain&&!Y.state.wcBasic&&p.showUnsupportedChainUI()},addCaipNetwork(t){if(!t)return;const e=M.chains.get(t.chainNamespace);e&&e?.caipNetworks?.push(t)},async switchActiveNamespace(t){if(!t)return;const e=t!==p.state.activeChain,s=p.getNetworkData(t)?.caipNetwork,r=p.getCaipNetworkByNamespace(t,s?.id);e&&r&&await p.switchActiveNetwork(r)},async switchActiveNetwork(t){const s=!p.state.chains.get(p.state.activeChain)?.caipNetworks?.some(i=>i.id===M.activeCaipNetwork?.id),r=p.getNetworkControllerClient(t.chainNamespace);if(r){try{await r.switchCaipNetwork(t),s&&Fe.close()}catch{re.goBack()}Pe.sendEvent({type:"track",event:"SWITCH_NETWORK",properties:{network:t.caipNetworkId}})}},getNetworkControllerClient(t){const e=t||M.activeChain,s=M.chains.get(e);if(!s)throw new Error("Chain adapter not found");if(!s.networkControllerClient)throw new Error("NetworkController client not set");return s.networkControllerClient},getConnectionControllerClient(t){const e=t||M.activeChain;if(!e)throw new Error("Chain is required to get connection controller client");const s=M.chains.get(e);if(!s?.connectionControllerClient)throw new Error("ConnectionController client not set");return s.connectionControllerClient},getAccountProp(t,e){let s=M.activeChain;if(e&&(s=e),!s)return;const r=M.chains.get(s)?.accountState;if(r)return r[t]},getNetworkProp(t,e){const s=M.chains.get(e)?.networkState;if(s)return s[t]},getRequestedCaipNetworks(t){const e=M.chains.get(t),{approvedCaipNetworkIds:s=[],requestedCaipNetworks:r=[]}=e?.networkState||{};return X.sortRequestedNetworks(s,r)},getAllRequestedCaipNetworks(){const t=[];return M.chains.forEach(e=>{const s=p.getRequestedCaipNetworks(e.namespace);t.push(...s)}),t},setRequestedCaipNetworks(t,e){p.setAdapterNetworkState(e,{requestedCaipNetworks:t});const r=p.getAllRequestedCaipNetworks().map(n=>n.chainNamespace),i=Array.from(new Set(r));B.filterByNamespaces(i)},getAllApprovedCaipNetworkIds(){const t=[];return M.chains.forEach(e=>{const s=p.getApprovedCaipNetworkIds(e.namespace);t.push(...s)}),t},getActiveCaipNetwork(){return M.activeCaipNetwork},getActiveCaipAddress(){return M.activeCaipAddress},getApprovedCaipNetworkIds(t){return M.chains.get(t)?.networkState?.approvedCaipNetworkIds||[]},async setApprovedCaipNetworksData(t){const s=await p.getNetworkControllerClient()?.getApprovedCaipNetworksData();p.setAdapterNetworkState(t,{approvedCaipNetworkIds:s?.approvedCaipNetworkIds,supportsAllNetworks:s?.supportsAllNetworks})},checkIfSupportedNetwork(t,e){const s=e||M.activeCaipNetwork,r=p.getRequestedCaipNetworks(t);return r.length?r?.some(i=>i.id===s?.id):!0},checkIfSupportedChainId(t){return M.activeChain?p.getRequestedCaipNetworks(M.activeChain)?.some(s=>s.id===t):!0},setSmartAccountEnabledNetworks(t,e){p.setAdapterNetworkState(e,{smartAccountEnabledNetworks:t})},checkIfSmartAccountEnabled(){const t=Tu.caipNetworkIdToNumber(M.activeCaipNetwork?.caipNetworkId),e=M.activeChain;return!e||!t?!1:!!p.getNetworkProp("smartAccountEnabledNetworks",e)?.includes(Number(t))},getActiveNetworkTokenAddress(){const t=M.activeCaipNetwork?.chainNamespace||"eip155",e=M.activeCaipNetwork?.id||1,s=ve.NATIVE_TOKEN_ADDRESS[t];return`${t}:${e}:${s}`},showUnsupportedChainUI(){Fe.open({view:"UnsupportedChain"})},checkIfNamesSupported(){const t=M.activeCaipNetwork;return!!(t?.chainNamespace&&ve.NAMES_SUPPORTED_CHAIN_NAMESPACES.includes(t.chainNamespace))},resetNetwork(t){p.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");M.activeCaipAddress=void 0,p.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"}),B.removeConnectorId(e)},setIsSwitchingNamespace(t){M.isSwitchingNamespace=t},getFirstCaipNetworkSupportsAuthConnector(){const t=[];let e;if(M.chains.forEach(s=>{H.AUTH_CONNECTOR_SUPPORTED_CHAINS.find(r=>r===s.namespace)&&s.namespace&&t.push(s.namespace)}),t.length>0){const s=t[0];return e=s?M.chains.get(s)?.caipNetworks?.[0]:void 0,e}},getAccountData(t){return t?p.state.chains.get(t)?.accountState:F.state},getNetworkData(t){const e=t||M.activeChain;if(e)return p.state.chains.get(e)?.networkState},getCaipNetworkByNamespace(t,e){if(!t)return;const s=p.state.chains.get(t),r=s?.caipNetworks?.find(i=>i.id===e);return r||s?.networkState?.caipNetwork||s?.caipNetworks?.[0]},getRequestedCaipNetworkIds(){const t=B.state.filterByNamespace;return(t?[M.chains.get(t)]:Array.from(M.chains.values())).flatMap(s=>s?.caipNetworks||[]).map(s=>s.caipNetworkId)},getCaipNetworks(t){return t?p.getRequestedCaipNetworks(t):p.getAllRequestedCaipNetworks()}},p=Et(Tp),xp={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"}]}]},Lu=X.getBlockchainApiUrl(),it=_e({clientId:null,api:new un({baseUrl:Lu,clientId:null}),supportedChains:{http:[],ws:[]}}),J={state:it,async get(t){const{st:e,sv:s}=J.getSdkProperties(),r=k.state.projectId,i={...t.params||{},st:e,sv:s,projectId:r};return it.api.get({...t,params:i})},getSdkProperties(){const{sdkType:t,sdkVersion:e}=k.state;return{st:t||"unknown",sv:e||"unknown"}},async isNetworkSupported(t){if(!t)return!1;try{it.supportedChains.http.length||await J.getSupportedNetworks()}catch{return!1}return it.supportedChains.http.includes(t)},async getSupportedNetworks(){try{const t=await J.get({path:"v1/supported-chains"});return it.supportedChains=t,t}catch{return it.supportedChains}},async fetchIdentity({address:t,caipNetworkId:e}){if(!await J.isNetworkSupported(e))return{avatar:"",name:""};const r=z.getIdentityFromCacheForAddress(t);if(r)return r;const i=await J.get({path:`/v1/identity/${t}`,params:{sender:p.state.activeCaipAddress?X.getPlainAddress(p.state.activeCaipAddress):void 0}});return z.updateIdentityCache({address:t,identity:i,timestamp:Date.now()}),i},async fetchTransactions({account:t,cursor:e,onramp:s,signal:r,cache:i,chainId:n}){return await J.isNetworkSupported(p.state.activeCaipNetwork?.caipNetworkId)?J.get({path:`/v1/account/${t}/history`,params:{cursor:e,onramp:s,chainId:n},signal:r,cache:i}):{data:[],next:void 0}},async fetchSwapQuote({amount:t,userAddress:e,from:s,to:r,gasPrice:i}){return await J.isNetworkSupported(p.state.activeCaipNetwork?.caipNetworkId)?J.get({path:"/v1/convert/quotes",headers:{"Content-Type":"application/json"},params:{amount:t,userAddress:e,from:s,to:r,gasPrice:i}}):{quotes:[]}},async fetchSwapTokens({chainId:t}){return await J.isNetworkSupported(p.state.activeCaipNetwork?.caipNetworkId)?J.get({path:"/v1/convert/tokens",params:{chainId:t}}):{tokens:[]}},async fetchTokenPrice({addresses:t}){return await J.isNetworkSupported(p.state.activeCaipNetwork?.caipNetworkId)?it.api.post({path:"/v1/fungible/price",body:{currency:"usd",addresses:t,projectId:k.state.projectId},headers:{"Content-Type":"application/json"}}):{fungibles:[]}},async fetchSwapAllowance({tokenAddress:t,userAddress:e}){return await J.isNetworkSupported(p.state.activeCaipNetwork?.caipNetworkId)?J.get({path:"/v1/convert/allowance",params:{tokenAddress:t,userAddress:e},headers:{"Content-Type":"application/json"}}):{allowance:"0"}},async fetchGasPrice({chainId:t}){const{st:e,sv:s}=J.getSdkProperties();if(!await J.isNetworkSupported(p.state.activeCaipNetwork?.caipNetworkId))throw new Error("Network not supported for Gas Price");return J.get({path:"/v1/convert/gas-price",headers:{"Content-Type":"application/json"},params:{chainId:t,st:e,sv:s}})},async generateSwapCalldata({amount:t,from:e,to:s,userAddress:r,disableEstimate:i}){if(!await J.isNetworkSupported(p.state.activeCaipNetwork?.caipNetworkId))throw new Error("Network not supported for Swaps");return it.api.post({path:"/v1/convert/build-transaction",headers:{"Content-Type":"application/json"},body:{amount:t,eip155:{slippage:ve.CONVERT_SLIPPAGE_TOLERANCE},projectId:k.state.projectId,from:e,to:s,userAddress:r,disableEstimate:i}})},async generateApproveCalldata({from:t,to:e,userAddress:s}){const{st:r,sv:i}=J.getSdkProperties();if(!await J.isNetworkSupported(p.state.activeCaipNetwork?.caipNetworkId))throw new Error("Network not supported for Swaps");return J.get({path:"/v1/convert/build-approve",headers:{"Content-Type":"application/json"},params:{userAddress:s,from:t,to:e,st:r,sv:i}})},async getBalance(t,e,s){const{st:r,sv:i}=J.getSdkProperties();if(!await J.isNetworkSupported(p.state.activeCaipNetwork?.caipNetworkId))return Lt.showError("Token Balance Unavailable"),{balances:[]};const o=`${e}:${t}`,a=z.getBalanceCacheForCaipAddress(o);if(a)return a;const c=await J.get({path:`/v1/account/${t}/balance`,params:{currency:"usd",chainId:e,forceUpdate:s,st:r,sv:i}});return z.updateBalanceCache({caipAddress:o,balance:c,timestamp:Date.now()}),c},async lookupEnsName(t){return await J.isNetworkSupported(p.state.activeCaipNetwork?.caipNetworkId)?J.get({path:`/v1/profile/account/${t}`,params:{apiVersion:"2"}}):{addresses:{},attributes:[]}},async reverseLookupEnsName({address:t}){return await J.isNetworkSupported(p.state.activeCaipNetwork?.caipNetworkId)?J.get({path:`/v1/profile/reverse/${t}`,params:{sender:F.state.address,apiVersion:"2"}}):[]},async getEnsNameSuggestions(t){return await J.isNetworkSupported(p.state.activeCaipNetwork?.caipNetworkId)?J.get({path:`/v1/profile/suggestions/${t}`,params:{zone:"reown.id"}}):{suggestions:[]}},async registerEnsName({coinType:t,address:e,message:s,signature:r}){return await J.isNetworkSupported(p.state.activeCaipNetwork?.caipNetworkId)?it.api.post({path:"/v1/profile/account",body:{coin_type:t,address:e,message:s,signature:r},headers:{"Content-Type":"application/json"}}):{success:!1}},async generateOnRampURL({destinationWallets:t,partnerUserId:e,defaultNetwork:s,purchaseAmount:r,paymentAmount:i}){return await J.isNetworkSupported(p.state.activeCaipNetwork?.caipNetworkId)?(await it.api.post({path:"/v1/generators/onrampurl",params:{projectId:k.state.projectId},body:{destinationWallets:t,defaultNetwork:s,partnerUserId:e,defaultExperience:"buy",presetCryptoAmount:r,presetFiatAmount:i}})).url:""},async getOnrampOptions(){if(!await J.isNetworkSupported(p.state.activeCaipNetwork?.caipNetworkId))return{paymentCurrencies:[],purchaseCurrencies:[]};try{return await J.get({path:"/v1/onramp/options"})}catch{return xp}},async getOnrampQuote({purchaseCurrency:t,paymentCurrency:e,amount:s,network:r}){try{return await J.isNetworkSupported(p.state.activeCaipNetwork?.caipNetworkId)?await it.api.post({path:"/v1/onramp/quote",params:{projectId:k.state.projectId},body:{purchaseCurrency:t,paymentCurrency:e,amount:s,network:r}}):null}catch{return{coinbaseFee:{amount:s,currency:e.id},networkFee:{amount:s,currency:e.id},paymentSubtotal:{amount:s,currency:e.id},paymentTotal:{amount:s,currency:e.id},purchaseAmount:{amount:s,currency:e.id},quoteId:"mocked-quote-id"}}},async getSmartSessions(t){return await J.isNetworkSupported(p.state.activeCaipNetwork?.caipNetworkId)?J.get({path:`/v1/sessions/${t}`}):[]},async revokeSmartSession(t,e,s){return await J.isNetworkSupported(p.state.activeCaipNetwork?.caipNetworkId)?it.api.post({path:`/v1/sessions/${t}/revoke`,params:{projectId:k.state.projectId},body:{pci:e,signature:s}}):{success:!1}},setClientId(t){it.clientId=t,it.api=new un({baseUrl:Lu,clientId:t})}},It=_e({currentTab:0,tokenBalance:[],smartAccountDeployed:!1,addressLabels:new Map,allAccounts:[]}),$p={state:It,replaceState(t){t&&Object.assign(It,Ys(t))},subscribe(t){return p.subscribeChainProp("accountState",e=>{if(e)return t(e)})},subscribeKey(t,e,s){let r;return p.subscribeChainProp("accountState",i=>{if(i){const n=i[t];r!==n&&(r=n,e(n))}},s)},setStatus(t,e){p.setAccountProp("status",t,e)},getCaipAddress(t){return p.getAccountProp("caipAddress",t)},setCaipAddress(t,e){const s=t?X.getPlainAddress(t):void 0;e===p.state.activeChain&&(p.state.activeCaipAddress=t),p.setAccountProp("caipAddress",t,e),p.setAccountProp("address",s,e)},setBalance(t,e,s){p.setAccountProp("balance",t,s),p.setAccountProp("balanceSymbol",e,s)},setProfileName(t,e){p.setAccountProp("profileName",t,e)},setProfileImage(t,e){p.setAccountProp("profileImage",t,e)},setUser(t,e){p.setAccountProp("user",t,e)},setAddressExplorerUrl(t,e){p.setAccountProp("addressExplorerUrl",t,e)},setSmartAccountDeployed(t,e){p.setAccountProp("smartAccountDeployed",t,e)},setCurrentTab(t){p.setAccountProp("currentTab",t,p.state.activeChain)},setTokenBalance(t,e){t&&p.setAccountProp("tokenBalance",t,e)},setShouldUpdateToAddress(t,e){p.setAccountProp("shouldUpdateToAddress",t,e)},setAllAccounts(t,e){p.setAccountProp("allAccounts",t,e)},addAddressLabel(t,e,s){const r=p.getAccountProp("addressLabels",s)||new Map;r.set(t,e),p.setAccountProp("addressLabels",r,s)},removeAddressLabel(t,e){const s=p.getAccountProp("addressLabels",e)||new Map;s.delete(t),p.setAccountProp("addressLabels",s,e)},setConnectedWalletInfo(t,e){p.setAccountProp("connectedWalletInfo",t,e,!1)},setPreferredAccountType(t,e){p.setAccountProp("preferredAccountTypes",{...It.preferredAccountTypes,[e]:t},e)},setPreferredAccountTypes(t){It.preferredAccountTypes=t},setSocialProvider(t,e){t&&p.setAccountProp("socialProvider",t,e)},setSocialWindow(t,e){p.setAccountProp("socialWindow",t?Ys(t):void 0,e)},setFarcasterUrl(t,e){p.setAccountProp("farcasterUrl",t,e)},async fetchTokenBalance(t){It.balanceLoading=!0;const e=p.state.activeCaipNetwork?.caipNetworkId,s=p.state.activeCaipNetwork?.chainNamespace,r=p.state.activeCaipAddress,i=r?X.getPlainAddress(r):void 0;if(It.lastRetry&&!X.isAllowedRetry(It.lastRetry,30*ve.ONE_SEC_MS))return It.balanceLoading=!1,[];try{if(i&&e&&s){const o=(await J.getBalance(i,e)).balances.filter(a=>a.quantity.decimals!=="0");return F.setTokenBalance(o,s),It.lastRetry=void 0,It.balanceLoading=!1,o}}catch(n){It.lastRetry=Date.now(),t?.(n),Lt.showError("Token Balance Unavailable")}finally{It.balanceLoading=!1}return[]},resetAccount(t){p.resetAccount(t)}},F=Et($p),Rp={onSwitchNetwork({network:t,ignoreSwitchConfirmation:e=!1}){const s=p.state.activeCaipNetwork,r=re.state.data;if(t.id===s?.id)return;const n=F.getCaipAddress(p.state.activeChain),o=t.chainNamespace!==p.state.activeChain,a=F.getCaipAddress(t.chainNamespace),l=B.getConnectorId(p.state.activeChain)===H.CONNECTOR_ID.AUTH,u=H.AUTH_CONNECTOR_SUPPORTED_CHAINS.find(d=>d===t.chainNamespace);e||l&&u?re.push("SwitchNetwork",{...r,network:t}):n&&o&&!a?re.push("SwitchActiveChain",{switchToChain:t.chainNamespace,navigateTo:"Connect",navigateWithReplace:!0,network:t}):re.push("SwitchNetwork",{...r,network:t})}},nt=_e({loading:!1,loadingNamespaceMap:new Map,open:!1,shake:!1,namespace:void 0}),Up={state:nt,subscribe(t){return Ze(nt,()=>t(nt))},subscribeKey(t,e){return Qe(nt,t,e)},async open(t){const e=F.state.status==="connected",s=t?.namespace,r=p.state.activeChain,i=s&&s!==r,n=p.getAccountData(t?.namespace)?.caipAddress;if(Y.state.wcBasic?V.prefetch({fetchNetworkImages:!1,fetchConnectorImages:!1}):await V.prefetch({fetchConnectorImages:!e,fetchFeaturedWallets:!e,fetchRecommendedWallets:!e}),B.setFilterByNamespace(t?.namespace),Fe.setLoading(!0,s),s&&i){const o=p.getNetworkData(s)?.caipNetwork||p.getRequestedCaipNetworks(s)[0];o&&Rp.onSwitchNetwork({network:o,ignoreSwitchConfirmation:!0})}else{const o=p.state.noAdapters;k.state.manualWCControl||o&&!n?X.isMobile()?re.reset("AllWallets"):re.reset("ConnectingWalletConnectBasic"):t?.view?re.reset(t.view,t.data):n?re.reset("Account"):re.reset("Connect")}nt.open=!0,As.set({open:!0}),Pe.sendEvent({type:"track",event:"MODAL_OPEN",properties:{connected:!!n}})},close(){const t=k.state.enableEmbedded,e=!!p.state.activeCaipAddress;nt.open&&Pe.sendEvent({type:"track",event:"MODAL_CLOSE",properties:{connected:e}}),nt.open=!1,re.reset("Connect"),Fe.clearLoading(),t?e?re.replace("Account"):re.push("Connect"):As.set({open:!1}),Y.resetUri()},setLoading(t,e){e&&nt.loadingNamespaceMap.set(e,t),nt.loading=t,As.set({loading:t})},clearLoading(){nt.loadingNamespaceMap.clear(),nt.loading=!1},shake(){nt.shake||(nt.shake=!0,setTimeout(()=>{nt.shake=!1},500))}},Fe=Et(Up),Ci={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"}]},ea={id:"USD",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]},Dp={providers:Ru,selectedProvider:null,error:null,purchaseCurrency:Ci,paymentCurrency:ea,purchaseCurrencies:[Ci],paymentCurrencies:[],quotesLoading:!1},oe=_e(Dp),Lp={state:oe,subscribe(t){return Ze(oe,()=>t(oe))},subscribeKey(t,e){return Qe(oe,t,e)},setSelectedProvider(t){if(t&&t.name==="meld"){const e=p.state.activeChain===H.CHAIN.SOLANA?"SOL":"USDC",s=F.state.address??"",r=new URL(t.url);r.searchParams.append("publicKey",ap),r.searchParams.append("destinationCurrencyCode",e),r.searchParams.append("walletAddress",s),r.searchParams.append("externalCustomerId",k.state.projectId),oe.selectedProvider={...t,url:r.toString()}}else oe.selectedProvider=t},setOnrampProviders(t){if(Array.isArray(t)&&t.every(e=>typeof e=="string")){const e=t,s=Ru.filter(r=>e.includes(r.name));oe.providers=s}else oe.providers=[]},setPurchaseCurrency(t){oe.purchaseCurrency=t},setPaymentCurrency(t){oe.paymentCurrency=t},setPurchaseAmount(t){ta.state.purchaseAmount=t},setPaymentAmount(t){ta.state.paymentAmount=t},async getAvailableCurrencies(){const t=await J.getOnrampOptions();oe.purchaseCurrencies=t.purchaseCurrencies,oe.paymentCurrencies=t.paymentCurrencies,oe.paymentCurrency=t.paymentCurrencies[0]||ea,oe.purchaseCurrency=t.purchaseCurrencies[0]||Ci,await V.fetchCurrencyImages(t.paymentCurrencies.map(e=>e.id)),await V.fetchTokenImages(t.purchaseCurrencies.map(e=>e.symbol))},async getQuote(){oe.quotesLoading=!0;try{const t=await J.getOnrampQuote({purchaseCurrency:oe.purchaseCurrency,paymentCurrency:oe.paymentCurrency,amount:oe.paymentAmount?.toString()||"0",network:oe.purchaseCurrency?.symbol});return oe.quotesLoading=!1,oe.purchaseAmount=Number(t?.purchaseAmount.amount),t}catch(t){return oe.error=t.message,oe.quotesLoading=!1,null}finally{oe.quotesLoading=!1}},resetState(){oe.selectedProvider=null,oe.error=null,oe.purchaseCurrency=Ci,oe.paymentCurrency=ea,oe.purchaseCurrencies=[Ci],oe.paymentCurrencies=[],oe.paymentAmount=void 0,oe.purchaseAmount=void 0,oe.quotesLoading=!1}},ta=Et(Lp),mc=2147483648,Mp={convertEVMChainIdToCoinType(t){if(t>=mc)throw new Error("Invalid chainId");return(mc|t)>>>0}},At=_e({suggestions:[],loading:!1}),jp={state:At,subscribe(t){return Ze(At,()=>t(At))},subscribeKey(t,e){return Qe(At,t,e)},async resolveName(t){try{return await J.lookupEnsName(t)}catch(e){const s=e;throw new Error(s?.reasons?.[0]?.description||"Error resolving name")}},async isNameRegistered(t){try{return await J.lookupEnsName(t),!0}catch{return!1}},async getSuggestions(t){try{At.loading=!0,At.suggestions=[];const e=await J.getEnsNameSuggestions(t);return At.suggestions=e.suggestions.map(s=>({...s,name:s.name}))||[],At.suggestions}catch(e){const s=Ii.parseEnsApiError(e,"Error fetching name suggestions");throw new Error(s)}finally{At.loading=!1}},async getNamesForAddress(t){try{if(!p.state.activeCaipNetwork)return[];const s=z.getEnsFromCacheForAddress(t);if(s)return s;const r=await J.reverseLookupEnsName({address:t});return z.updateEnsCache({address:t,ens:r,timestamp:Date.now()}),r}catch(e){const s=Ii.parseEnsApiError(e,"Error fetching names for address");throw new Error(s)}},async registerName(t){const e=p.state.activeCaipNetwork;if(!e)throw new Error("Network not found");const s=F.state.address,r=B.getAuthConnector();if(!s||!r)throw new Error("Address or auth connector not found");At.loading=!0;try{const i=JSON.stringify({name:t,attributes:{},timestamp:Math.floor(Date.now()/1e3)});re.pushTransactionStack({onCancel(){re.replace("RegisterAccountName")}});const n=await Y.signMessage(i);At.loading=!1;const o=e.id;if(!o)throw new Error("Network not found");const a=Mp.convertEVMChainIdToCoinType(Number(o));await J.registerEnsName({coinType:a,address:s,signature:n,message:i}),F.setProfileName(t,e.chainNamespace),re.replace("RegisterAccountNameSuccess")}catch(i){const n=Ii.parseEnsApiError(i,`Error registering name ${t}`);throw re.replace("RegisterAccountName"),new Error(n)}finally{At.loading=!1}},validateName(t){return/^[a-zA-Z0-9-]{4,}$/u.test(t)},parseEnsApiError(t,e){return t?.reasons?.[0]?.description||e}},Ii=Et(jp),Ai={getSIWX(){return k.state.siwx},async initializeIfEnabled(){const t=k.state.siwx,e=p.getActiveCaipAddress();if(!(t&&e))return;const[s,r,i]=e.split(":");if(p.checkIfSupportedNetwork(s))try{if((await t.getSessions(`${s}:${r}`,i)).length)return;await Fe.open({view:"SIWXSignMessage"})}catch(n){console.error("SIWXUtil:initializeIfEnabled",n),Pe.sendEvent({type:"track",event:"SIWX_AUTH_ERROR",properties:this.getSIWXEventProperties()}),await Y._getClient()?.disconnect().catch(console.error),re.reset("Connect"),Lt.showError("A problem occurred while trying initialize authentication")}},async requestSignMessage(){const t=k.state.siwx,e=X.getPlainAddress(p.getActiveCaipAddress()),s=p.getActiveCaipNetwork(),r=Y._getClient();if(!t)throw new Error("SIWX is not enabled");if(!e)throw new Error("No ActiveCaipAddress found");if(!s)throw new Error("No ActiveCaipNetwork or client found");if(!r)throw new Error("No ConnectionController client found");try{const i=await t.createMessage({chainId:s.caipNetworkId,accountAddress:e}),n=i.toString();B.getConnectorId(s.chainNamespace)===H.CONNECTOR_ID.AUTH&&re.pushTransactionStack({});const a=await r.signMessage(n);await t.addSession({data:i,message:n,signature:a}),Fe.close(),Pe.sendEvent({type:"track",event:"SIWX_AUTH_SUCCESS",properties:this.getSIWXEventProperties()})}catch(i){const n=this.getSIWXEventProperties();(!Fe.state.open||re.state.view==="ApproveTransaction")&&await Fe.open({view:"SIWXSignMessage"}),n.isSmartAccount?Lt.showError("This application might not support Smart Accounts"):Lt.showError("Signature declined"),Pe.sendEvent({type:"track",event:"SIWX_AUTH_ERROR",properties:n}),console.error("SWIXUtil:requestSignMessage",i)}},async cancelSignMessage(){try{this.getSIWX()?.getRequired?.()?await Y.disconnect():Fe.close(),re.reset("Connect"),Pe.sendEvent({event:"CLICK_CANCEL_SIWX",type:"track",properties:this.getSIWXEventProperties()})}catch(t){console.error("SIWXUtil:cancelSignMessage",t)}},async getSessions(){const t=k.state.siwx,e=X.getPlainAddress(p.getActiveCaipAddress()),s=p.getActiveCaipNetwork();return t&&e&&s?t.getSessions(s.caipNetworkId,e):[]},async isSIWXCloseDisabled(){const t=this.getSIWX();if(t){const e=re.state.view==="ApproveTransaction",s=re.state.view==="SIWXSignMessage";if(e||s)return t.getRequired?.()&&(await this.getSessions()).length===0}return!1},async universalProviderAuthenticate({universalProvider:t,chains:e,methods:s}){const r=Ai.getSIWX(),i=new Set(e.map(a=>a.split(":")[0]));if(!r||i.size!==1||!i.has("eip155"))return!1;const n=await r.createMessage({chainId:p.getActiveCaipNetwork()?.caipNetworkId||"",accountAddress:""}),o=await t.authenticate({nonce:n.nonce,domain:n.domain,uri:n.uri,exp:n.expirationTime,iat:n.issuedAt,nbf:n.notBefore,requestId:n.requestId,version:n.version,resources:n.resources,statement:n.statement,chainId:n.chainId,methods:s,chains:[n.chainId,...e.filter(a=>a!==n.chainId)]});if(Lt.showLoading("Authenticating...",{autoClose:!1}),F.setConnectedWalletInfo({...o.session.peer.metadata,name:o.session.peer.metadata.name,icon:o.session.peer.metadata.icons?.[0],type:"WALLET_CONNECT"},Array.from(i)[0]),o?.auths?.length){const a=o.auths.map(c=>{const l=t.client.formatAuthMessage({request:c.p,iss:c.p.iss});return{data:{...c.p,accountAddress:c.p.iss.split(":").slice(-1).join(""),chainId:c.p.iss.split(":").slice(2,4).join(":"),uri:c.p.aud,version:c.p.version||n.version,expirationTime:c.p.exp,issuedAt:c.p.iat,notBefore:c.p.nbf},message:l,signature:c.s.s,cacao:c}});try{await r.setSessions(a),Pe.sendEvent({type:"track",event:"SIWX_AUTH_SUCCESS",properties:Ai.getSIWXEventProperties()})}catch(c){throw console.error("SIWX:universalProviderAuth - failed to set sessions",c),Pe.sendEvent({type:"track",event:"SIWX_AUTH_ERROR",properties:Ai.getSIWXEventProperties()}),await t.disconnect().catch(console.error),c}finally{Lt.hide()}}return!0},getSIWXEventProperties(){const t=p.state.activeChain;return{network:p.state.activeCaipNetwork?.caipNetworkId||"",isSmartAccount:F.state.preferredAccountTypes?.[t]===Ei.ACCOUNT_TYPES.SMART_ACCOUNT}},async clearSessions(){const t=this.getSIWX();t&&await t.setSessions([])}};var Bp=Object.defineProperty,qp=(t,e,s)=>e in t?Bp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,wc=(t,e,s)=>qp(t,typeof e!="symbol"?e+"":e,s);let zp=class extends Yr{constructor(e){super(),this.opts=e,wc(this,"protocol","wc"),wc(this,"version",2)}};var Fp=Object.defineProperty,Wp=(t,e,s)=>e in t?Fp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,Hp=(t,e,s)=>Wp(t,e+"",s);let Vp=class extends Yr{constructor(e,s){super(),this.core=e,this.logger=s,Hp(this,"records",new Map)}},Kp=class{constructor(e,s){this.logger=e,this.core=s}},Gp=class extends Yr{constructor(e,s){super(),this.relayer=e,this.logger=s}},Jp=class extends Yr{constructor(e){super()}},Yp=class{constructor(e,s,r,i){this.core=e,this.logger=s,this.name=r}},Xp=class extends Yr{constructor(e,s){super(),this.relayer=e,this.logger=s}},Zp=class extends Yr{constructor(e,s){super(),this.core=e,this.logger=s}},Qp=class{constructor(e,s,r){this.core=e,this.logger=s,this.store=r}},ef=class{constructor(e,s){this.projectId=e,this.logger=s}},tf=class{constructor(e,s,r){this.core=e,this.logger=s,this.telemetryEnabled=r}};var sf=Object.defineProperty,rf=(t,e,s)=>e in t?sf(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,yc=(t,e,s)=>rf(t,typeof e!="symbol"?e+"":e,s);let nf=class{constructor(e){this.opts=e,yc(this,"protocol","wc"),yc(this,"version",2)}},of=class{constructor(e){this.client=e}};function xi(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function bc(t){return xi(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}const Mu="2.23.2";let Eo={getDocsUrl:({docsBaseUrl:t,docsPath:e="",docsSlug:s})=>e?`${t??"https://viem.sh"}${e}${s?`#${s}`:""}`:void 0,version:`viem@${Mu}`},ro=class sa extends Error{constructor(e,s={}){const r=s.cause instanceof sa?s.cause.details:s.cause?.message?s.cause.message:s.details,i=s.cause instanceof sa&&s.cause.docsPath||s.docsPath,n=Eo.getDocsUrl?.({...s,docsPath:i}),o=[e||"An error occurred.","",...s.metaMessages?[...s.metaMessages,""]:[],...n?[`Docs: ${n}`]:[],...r?[`Details: ${r}`]:[],...Eo.version?[`Version: ${Eo.version}`]:[]].join(`
|
|
5
|
-
`);super(o,s.cause?{cause:s.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=r,this.docsPath=i,this.metaMessages=s.metaMessages,this.name=s.name??this.name,this.shortMessage=e,this.version=Mu}walk(e){return ju(this,e)}};function ju(t,e){return e?.(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?ju(t.cause,e):e?null:t}let Bu=class extends ro{constructor({size:e,targetSize:s,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${e}) exceeds padding size (${s}).`,{name:"SizeExceedsPaddingSizeError"})}};function Zr(t,{dir:e,size:s=32}={}){return typeof t=="string"?af(t,{dir:e,size:s}):cf(t,{dir:e,size:s})}function af(t,{dir:e,size:s=32}={}){if(s===null)return t;const r=t.replace("0x","");if(r.length>s*2)throw new Bu({size:Math.ceil(r.length/2),targetSize:s,type:"hex"});return`0x${r[e==="right"?"padEnd":"padStart"](s*2,"0")}`}function cf(t,{dir:e,size:s=32}={}){if(s===null)return t;if(t.length>s)throw new Bu({size:t.length,targetSize:s,type:"bytes"});const r=new Uint8Array(s);for(let i=0;i<s;i++){const n=e==="right";r[n?i:s-i-1]=t[n?i:t.length-i-1]}return r}let lf=class extends ro{constructor({max:e,min:s,signed:r,size:i,value:n}){super(`Number "${n}" is not in safe ${i?`${i*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${e?`(${s} to ${e})`:`(above ${s})`}`,{name:"IntegerOutOfRangeError"})}},uf=class extends ro{constructor({givenSize:e,maxSize:s}){super(`Size cannot exceed ${s} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}};function Qr(t,{size:e}){if(bc(t)>e)throw new uf({givenSize:bc(t),maxSize:e})}function ra(t,e={}){const{signed:s}=e;e.size&&Qr(t,{size:e.size});const r=BigInt(t);if(!s)return r;const i=(t.length-2)/2,n=(1n<<BigInt(i)*8n-1n)-1n;return r<=n?r:r-BigInt(`0x${"f".padStart(i*2,"f")}`)-1n}function df(t,e={}){return Number(ra(t,e))}const hf=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function ia(t,e={}){return typeof t=="number"||typeof t=="bigint"?zu(t,e):typeof t=="string"?gf(t,e):typeof t=="boolean"?pf(t,e):qu(t,e)}function pf(t,e={}){const s=`0x${Number(t)}`;return typeof e.size=="number"?(Qr(s,{size:e.size}),Zr(s,{size:e.size})):s}function qu(t,e={}){let s="";for(let i=0;i<t.length;i++)s+=hf[t[i]];const r=`0x${s}`;return typeof e.size=="number"?(Qr(r,{size:e.size}),Zr(r,{dir:"right",size:e.size})):r}function zu(t,e={}){const{signed:s,size:r}=e,i=BigInt(t);let n;r?s?n=(1n<<BigInt(r)*8n-1n)-1n:n=2n**(BigInt(r)*8n)-1n:typeof t=="number"&&(n=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof n=="bigint"&&s?-n-1n:0;if(n&&i>n||i<o){const c=typeof t=="bigint"?"n":"";throw new lf({max:n?`${n}${c}`:void 0,min:`${o}${c}`,signed:s,size:r,value:`${t}${c}`})}const a=`0x${(s&&i<0?(1n<<BigInt(r*8))+BigInt(i):i).toString(16)}`;return r?Zr(a,{size:r}):a}const ff=new TextEncoder;function gf(t,e={}){const s=ff.encode(t);return qu(s,e)}const mf=new TextEncoder;function wf(t,e={}){return typeof t=="number"||typeof t=="bigint"?bf(t,e):typeof t=="boolean"?yf(t,e):xi(t)?Fu(t,e):Wu(t,e)}function yf(t,e={}){const s=new Uint8Array(1);return s[0]=Number(t),typeof e.size=="number"?(Qr(s,{size:e.size}),Zr(s,{size:e.size})):s}const ts={zero:48,nine:57,A:65,F:70,a:97,f:102};function vc(t){if(t>=ts.zero&&t<=ts.nine)return t-ts.zero;if(t>=ts.A&&t<=ts.F)return t-(ts.A-10);if(t>=ts.a&&t<=ts.f)return t-(ts.a-10)}function Fu(t,e={}){let s=t;e.size&&(Qr(s,{size:e.size}),s=Zr(s,{dir:"right",size:e.size}));let r=s.slice(2);r.length%2&&(r=`0${r}`);const i=r.length/2,n=new Uint8Array(i);for(let o=0,a=0;o<i;o++){const c=vc(r.charCodeAt(a++)),l=vc(r.charCodeAt(a++));if(c===void 0||l===void 0)throw new ro(`Invalid byte sequence ("${r[a-2]}${r[a-1]}" in "${r}").`);n[o]=c*16+l}return n}function bf(t,e){const s=zu(t,e);return Fu(s)}function Wu(t,e={}){const s=mf.encode(t);return typeof e.size=="number"?(Qr(s,{size:e.size}),Zr(s,{dir:"right",size:e.size})):s}function Kn(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function vf(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function io(t,...e){if(!vf(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 eA(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Kn(t.outputLen),Kn(t.blockLen)}function Ec(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 Ef(t,e){io(t);const s=e.outputLen;if(t.length<s)throw new Error("digestInto() expects output buffer of length at least "+s)}const Cn=BigInt(2**32-1),Cc=BigInt(32);function Cf(t,e=!1){return e?{h:Number(t&Cn),l:Number(t>>Cc&Cn)}:{h:Number(t>>Cc&Cn)|0,l:Number(t&Cn)|0}}function If(t,e=!1){let s=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let i=0;i<t.length;i++){const{h:n,l:o}=Cf(t[i],e);[s[i],r[i]]=[n,o]}return[s,r]}const Af=(t,e,s)=>t<<s|e>>>32-s,Nf=(t,e,s)=>e<<s|t>>>32-s,_f=(t,e,s)=>e<<s-32|t>>>64-s,Sf=(t,e,s)=>t<<s-32|e>>>64-s,lr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function Pf(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function tA(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function sA(t,e){return t<<32-e|t>>>e}const Ic=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Of(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function Ac(t){for(let e=0;e<t.length;e++)t[e]=Of(t[e])}function kf(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))}function Hu(t){return typeof t=="string"&&(t=kf(t)),io(t),t}function rA(...t){let e=0;for(let r=0;r<t.length;r++){const i=t[r];io(i),e+=i.length}const s=new Uint8Array(e);for(let r=0,i=0;r<t.length;r++){const n=t[r];s.set(n,i),i+=n.length}return s}class Tf{clone(){return this._cloneInto()}}function xf(t){const e=r=>t().update(Hu(r)).digest(),s=t();return e.outputLen=s.outputLen,e.blockLen=s.blockLen,e.create=()=>t(),e}function iA(t=32){if(lr&&typeof lr.getRandomValues=="function")return lr.getRandomValues(new Uint8Array(t));if(lr&&typeof lr.randomBytes=="function")return lr.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}const Vu=[],Ku=[],Gu=[],$f=BigInt(0),oi=BigInt(1),Rf=BigInt(2),Uf=BigInt(7),Df=BigInt(256),Lf=BigInt(113);for(let t=0,e=oi,s=1,r=0;t<24;t++){[s,r]=[r,(2*s+3*r)%5],Vu.push(2*(5*r+s)),Ku.push((t+1)*(t+2)/2%64);let i=$f;for(let n=0;n<7;n++)e=(e<<oi^(e>>Uf)*Lf)%Df,e&Rf&&(i^=oi<<(oi<<BigInt(n))-oi);Gu.push(i)}const[Mf,jf]=If(Gu,!0),Nc=(t,e,s)=>s>32?_f(t,e,s):Af(t,e,s),_c=(t,e,s)=>s>32?Sf(t,e,s):Nf(t,e,s);function Bf(t,e=24){const s=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let o=0;o<10;o++)s[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,l=s[c],u=s[c+1],d=Nc(l,u,1)^s[a],h=_c(l,u,1)^s[a+1];for(let f=0;f<50;f+=10)t[o+f]^=d,t[o+f+1]^=h}let i=t[2],n=t[3];for(let o=0;o<24;o++){const a=Ku[o],c=Nc(i,n,a),l=_c(i,n,a),u=Vu[o];i=t[u],n=t[u+1],t[u]=c,t[u+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)s[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~s[(a+2)%10]&s[(a+4)%10]}t[0]^=Mf[r],t[1]^=jf[r]}s.fill(0)}class Ba extends Tf{constructor(e,s,r,i=!1,n=24){if(super(),this.blockLen=e,this.suffix=s,this.outputLen=r,this.enableXOF=i,this.rounds=n,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Kn(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=Pf(this.state)}keccak(){Ic||Ac(this.state32),Bf(this.state32,this.rounds),Ic||Ac(this.state32),this.posOut=0,this.pos=0}update(e){Ec(this);const{blockLen:s,state:r}=this;e=Hu(e);const i=e.length;for(let n=0;n<i;){const o=Math.min(s-this.pos,i-n);for(let a=0;a<o;a++)r[this.pos++]^=e[n++];this.pos===s&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:s,pos:r,blockLen:i}=this;e[r]^=s,(s&128)!==0&&r===i-1&&this.keccak(),e[i-1]^=128,this.keccak()}writeInto(e){Ec(this,!1),io(e),this.finish();const s=this.state,{blockLen:r}=this;for(let i=0,n=e.length;i<n;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,n-i);e.set(s.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 Kn(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(Ef(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:s,suffix:r,outputLen:i,rounds:n,enableXOF:o}=this;return e||(e=new Ba(s,r,i,o,n)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=n,e.suffix=r,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}}const qf=(t,e,s)=>xf(()=>new Ba(e,t,s)),zf=qf(1,136,256/8);function Ju(t,e){const s=e||"hex",r=zf(xi(t,{strict:!1})?wf(t):t);return s==="bytes"?r:ia(r)}let Ff=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 s=super.get(e);return super.has(e)&&s!==void 0&&(this.delete(e),super.set(e,s)),s}set(e,s){if(super.set(e,s),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}};const Co=new Ff(8192);function Wf(t,e){if(Co.has(`${t}.${e}`))return Co.get(`${t}.${e}`);const s=t.substring(2).toLowerCase(),r=Ju(Wu(s),"bytes"),i=s.split("");for(let o=0;o<40;o+=2)r[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(r[o>>1]&15)>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const n=`0x${i.join("")}`;return Co.set(`${t}.${e}`,n),n}function Hf(t){const e=Ju(`0x${t.substring(4)}`).substring(26);return Wf(`0x${e}`)}async function Vf({hash:t,signature:e}){const s=xi(t)?t:ia(t),{secp256k1:r}=await Yo(async()=>{const{secp256k1:o}=await import("./secp256k1-xC50DJGj.js");return{secp256k1:o}},__vite__mapDeps([0,1,2,3,4]));return`0x${(()=>{if(typeof e=="object"&&"r"in e&&"s"in e){const{r:l,s:u,v:d,yParity:h}=e,f=Number(h??d),w=Sc(f);return new r.Signature(ra(l),ra(u)).addRecoveryBit(w)}const o=xi(e)?e:ia(e),a=df(`0x${o.slice(130)}`),c=Sc(a);return r.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(c)})().recoverPublicKey(s.substring(2)).toHex(!1)}`}function Sc(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 Kf({hash:t,signature:e}){return Hf(await Vf({hash:t,signature:e}))}var Gf={};const Jf=":";function $r(t){const[e,s]=t.split(Jf);return{namespace:e,reference:s}}function Yu(t,e){return t.includes(":")?[t]:e.chains||[]}var Yf=Object.defineProperty,Xf=Object.defineProperties,Zf=Object.getOwnPropertyDescriptors,Pc=Object.getOwnPropertySymbols,Qf=Object.prototype.hasOwnProperty,eg=Object.prototype.propertyIsEnumerable,Oc=(t,e,s)=>e in t?Yf(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,kc=(t,e)=>{for(var s in e||(e={}))Qf.call(e,s)&&Oc(t,s,e[s]);if(Pc)for(var s of Pc(e))eg.call(e,s)&&Oc(t,s,e[s]);return t},tg=(t,e)=>Xf(t,Zf(e));const sg="ReactNative",yt={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},rg="js";function Gn(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function ks(){return!ls.getDocument()&&!!ls.getNavigator()&&navigator.product===sg}function ig(){return ks()&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"&&(global==null?void 0:global.Platform.OS)==="android"}function ng(){return ks()&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"&&(global==null?void 0:global.Platform.OS)==="ios"}function ei(){return!Gn()&&!!ls.getNavigator()&&!!ls.getDocument()}function dn(){return ks()?yt.reactNative:Gn()?yt.node:ei()?yt.browser:yt.unknown}function Tc(){var t;try{return ks()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function og(t,e){const s=new URLSearchParams(t);for(const r of Object.keys(e).sort())if(e.hasOwnProperty(r)){const i=e[r];i!==void 0&&s.set(r,i)}return s.toString()}function ag(t){var e,s;const r=Xu();try{return t!=null&&t.url&&r.url&&new URL(t.url).host!==new URL(r.url).host&&(console.warn(`The configured WalletConnect 'metadata.url':${t.url} differs from the actual page url:${r.url}. This is probably unintended and can lead to issues.`),t.url=r.url),(e=t?.icons)!=null&&e.length&&t.icons.length>0&&(t.icons=t.icons.filter(i=>i!=="")),tg(kc(kc({},r),t),{url:t?.url||r.url,name:t?.name||r.name,description:t?.description||r.description,icons:(s=t?.icons)!=null&&s.length&&t.icons.length>0?t.icons:r.icons})}catch(i){return console.warn("Error populating app metadata",i),t||r}}function Xu(){return $h.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function cg(){if(dn()===yt.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:s,Version:r}=global.Platform;return[s,r].join("-")}const t=Uh();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 lg(){var t;const e=dn();return e===yt.browser?[e,((t=ls.getLocation())==null?void 0:t.host)||"unknown"].join(":"):e}function Zu(t,e,s){const r=cg(),i=lg();return[[t,e].join("-"),[rg,s].join("-"),r,i].join("/")}function ug({protocol:t,version:e,relayUrl:s,sdkVersion:r,auth:i,projectId:n,useOnCloseEvent:o,bundleId:a,packageName:c}){const l=s.split("?"),u=Zu(t,e,r),d={auth:i,ua:u,projectId:n,useOnCloseEvent:o,packageName:c||void 0,bundleId:a||void 0},h=og(l[1]||"",d);return l[0]+"?"+h}function Fs(t,e){return t.filter(s=>e.includes(s)).length===t.length}function na(t){return Object.fromEntries(t.entries())}function oa(t){return new Map(Object.entries(t))}function Ls(t=L.FIVE_MINUTES,e){const s=L.toMiliseconds(t||L.FIVE_MINUTES);let r,i,n,o;return{resolve:a=>{n&&r&&(clearTimeout(n),r(a),o=Promise.resolve(a))},reject:a=>{n&&i&&(clearTimeout(n),i(a))},done:()=>new Promise((a,c)=>{if(o)return a(o);n=setTimeout(()=>{const l=new Error(e);o=Promise.reject(l),c(l)},s),r=a,i=c})}}function Is(t,e,s){return new Promise(async(r,i)=>{const n=setTimeout(()=>i(new Error(s)),e);try{const o=await t;r(o)}catch(o){i(o)}clearTimeout(n)})}function Qu(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 dg(t){return Qu("topic",t)}function hg(t){return Qu("id",t)}function ed(t){const[e,s]=t.split(":"),r={id:void 0,topic:void 0};if(e==="topic"&&typeof s=="string")r.topic=s;else if(e==="id"&&Number.isInteger(Number(s)))r.id=Number(s);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${s}`);return r}function De(t,e){return L.fromMiliseconds(Date.now()+L.toMiliseconds(t))}function bs(t){return Date.now()>=L.toMiliseconds(t)}function pe(t,e){return`${t}${e?`:${e}`:""}`}function Jt(t=[],e=[]){return[...new Set([...t,...e])]}async function pg({id:t,topic:e,wcDeepLink:s}){var r;try{if(!s)return;const i=typeof s=="string"?JSON.parse(s):s,n=i?.href;if(typeof n!="string")return;const o=fg(n,t,e),a=dn();if(a===yt.browser){if(!((r=ls.getDocument())!=null&&r.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}gg(o)}else a===yt.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(i){console.error(i)}}function fg(t,e,s){const r=`requestId=${e}&sessionTopic=${s}`;t.endsWith("/")&&(t=t.slice(0,-1));let i=`${t}`;if(t.startsWith("https://t.me")){const n=t.includes("?")?"&startapp=":"?startapp=";i=`${i}${n}${bg(r,!0)}`}else i=`${i}/wc?${r}`;return i}function gg(t){let e="_self";yg()?e="_top":(wg()||t.startsWith("https://")||t.startsWith("http://"))&&(e="_blank"),window.open(t,e,"noreferrer noopener")}async function mg(t,e){let s="";try{if(ei()&&(s=localStorage.getItem(e),s))return s;s=await t.getItem(e)}catch(r){console.error(r)}return s}function xc(t,e){if(!t.includes(e))return null;const s=t.split(/([&,?,=])/),r=s.indexOf(e);return s[r+2]}function $c(){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 qa(){return typeof process<"u"&&Gf.IS_VITEST==="true"}function wg(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function yg(){try{return window.self!==window.top}catch{return!1}}function bg(t,e=!1){const s=Buffer.from(t).toString("base64");return e?s.replace(/[=]/g,""):s}function td(t){return Buffer.from(t,"base64").toString("utf-8")}function vg(t){return new Promise(e=>setTimeout(e,t))}function $i(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function Eg(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function hn(t,...e){if(!Eg(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 za(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");$i(t.outputLen),$i(t.blockLen)}function Lr(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 sd(t,e){hn(t);const s=e.outputLen;if(t.length<s)throw new Error("digestInto() expects output buffer of length at least "+s)}const In=BigInt(2**32-1),Rc=BigInt(32);function Cg(t,e=!1){return e?{h:Number(t&In),l:Number(t>>Rc&In)}:{h:Number(t>>Rc&In)|0,l:Number(t&In)|0}}function Ig(t,e=!1){let s=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let i=0;i<t.length;i++){const{h:n,l:o}=Cg(t[i],e);[s[i],r[i]]=[n,o]}return[s,r]}const Ag=(t,e,s)=>t<<s|e>>>32-s,Ng=(t,e,s)=>e<<s|t>>>32-s,_g=(t,e,s)=>e<<s-32|t>>>64-s,Sg=(t,e,s)=>t<<s-32|e>>>64-s,ur=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function Pg(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function Io(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function qt(t,e){return t<<32-e|t>>>e}const Uc=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Og(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function Dc(t){for(let e=0;e<t.length;e++)t[e]=Og(t[e])}function kg(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))}function Mr(t){return typeof t=="string"&&(t=kg(t)),hn(t),t}function Tg(...t){let e=0;for(let r=0;r<t.length;r++){const i=t[r];hn(i),e+=i.length}const s=new Uint8Array(e);for(let r=0,i=0;r<t.length;r++){const n=t[r];s.set(n,i),i+=n.length}return s}let Fa=class{clone(){return this._cloneInto()}};function rd(t){const e=r=>t().update(Mr(r)).digest(),s=t();return e.outputLen=s.outputLen,e.blockLen=s.blockLen,e.create=()=>t(),e}function ti(t=32){if(ur&&typeof ur.getRandomValues=="function")return ur.getRandomValues(new Uint8Array(t));if(ur&&typeof ur.randomBytes=="function")return ur.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}const id=[],nd=[],od=[],xg=BigInt(0),ai=BigInt(1),$g=BigInt(2),Rg=BigInt(7),Ug=BigInt(256),Dg=BigInt(113);for(let t=0,e=ai,s=1,r=0;t<24;t++){[s,r]=[r,(2*s+3*r)%5],id.push(2*(5*r+s)),nd.push((t+1)*(t+2)/2%64);let i=xg;for(let n=0;n<7;n++)e=(e<<ai^(e>>Rg)*Dg)%Ug,e&$g&&(i^=ai<<(ai<<BigInt(n))-ai);od.push(i)}const[Lg,Mg]=Ig(od,!0),Lc=(t,e,s)=>s>32?_g(t,e,s):Ag(t,e,s),Mc=(t,e,s)=>s>32?Sg(t,e,s):Ng(t,e,s);function jg(t,e=24){const s=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let o=0;o<10;o++)s[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,l=s[c],u=s[c+1],d=Lc(l,u,1)^s[a],h=Mc(l,u,1)^s[a+1];for(let f=0;f<50;f+=10)t[o+f]^=d,t[o+f+1]^=h}let i=t[2],n=t[3];for(let o=0;o<24;o++){const a=nd[o],c=Lc(i,n,a),l=Mc(i,n,a),u=id[o];i=t[u],n=t[u+1],t[u]=c,t[u+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)s[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~s[(a+2)%10]&s[(a+4)%10]}t[0]^=Lg[r],t[1]^=Mg[r]}s.fill(0)}let Bg=class ad extends Fa{constructor(e,s,r,i=!1,n=24){if(super(),this.blockLen=e,this.suffix=s,this.outputLen=r,this.enableXOF=i,this.rounds=n,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,$i(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=Pg(this.state)}keccak(){Uc||Dc(this.state32),jg(this.state32,this.rounds),Uc||Dc(this.state32),this.posOut=0,this.pos=0}update(e){Lr(this);const{blockLen:s,state:r}=this;e=Mr(e);const i=e.length;for(let n=0;n<i;){const o=Math.min(s-this.pos,i-n);for(let a=0;a<o;a++)r[this.pos++]^=e[n++];this.pos===s&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:s,pos:r,blockLen:i}=this;e[r]^=s,(s&128)!==0&&r===i-1&&this.keccak(),e[i-1]^=128,this.keccak()}writeInto(e){Lr(this,!1),hn(e),this.finish();const s=this.state,{blockLen:r}=this;for(let i=0,n=e.length;i<n;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,n-i);e.set(s.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 $i(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(sd(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:s,suffix:r,outputLen:i,rounds:n,enableXOF:o}=this;return e||(e=new ad(s,r,i,o,n)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=n,e.suffix=r,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}};const qg=(t,e,s)=>rd(()=>new Bg(e,t,s)),zg=qg(1,136,256/8),Fg="https://rpc.walletconnect.org/v1";function cd(t){const e=`Ethereum Signed Message:
|
|
5
|
+
`);super(o,s.cause?{cause:s.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=r,this.docsPath=i,this.metaMessages=s.metaMessages,this.name=s.name??this.name,this.shortMessage=e,this.version=Mu}walk(e){return ju(this,e)}};function ju(t,e){return e?.(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?ju(t.cause,e):e?null:t}let Bu=class extends ro{constructor({size:e,targetSize:s,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${e}) exceeds padding size (${s}).`,{name:"SizeExceedsPaddingSizeError"})}};function Zr(t,{dir:e,size:s=32}={}){return typeof t=="string"?af(t,{dir:e,size:s}):cf(t,{dir:e,size:s})}function af(t,{dir:e,size:s=32}={}){if(s===null)return t;const r=t.replace("0x","");if(r.length>s*2)throw new Bu({size:Math.ceil(r.length/2),targetSize:s,type:"hex"});return`0x${r[e==="right"?"padEnd":"padStart"](s*2,"0")}`}function cf(t,{dir:e,size:s=32}={}){if(s===null)return t;if(t.length>s)throw new Bu({size:t.length,targetSize:s,type:"bytes"});const r=new Uint8Array(s);for(let i=0;i<s;i++){const n=e==="right";r[n?i:s-i-1]=t[n?i:t.length-i-1]}return r}let lf=class extends ro{constructor({max:e,min:s,signed:r,size:i,value:n}){super(`Number "${n}" is not in safe ${i?`${i*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${e?`(${s} to ${e})`:`(above ${s})`}`,{name:"IntegerOutOfRangeError"})}},uf=class extends ro{constructor({givenSize:e,maxSize:s}){super(`Size cannot exceed ${s} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}};function Qr(t,{size:e}){if(bc(t)>e)throw new uf({givenSize:bc(t),maxSize:e})}function ra(t,e={}){const{signed:s}=e;e.size&&Qr(t,{size:e.size});const r=BigInt(t);if(!s)return r;const i=(t.length-2)/2,n=(1n<<BigInt(i)*8n-1n)-1n;return r<=n?r:r-BigInt(`0x${"f".padStart(i*2,"f")}`)-1n}function df(t,e={}){return Number(ra(t,e))}const hf=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function ia(t,e={}){return typeof t=="number"||typeof t=="bigint"?zu(t,e):typeof t=="string"?gf(t,e):typeof t=="boolean"?pf(t,e):qu(t,e)}function pf(t,e={}){const s=`0x${Number(t)}`;return typeof e.size=="number"?(Qr(s,{size:e.size}),Zr(s,{size:e.size})):s}function qu(t,e={}){let s="";for(let i=0;i<t.length;i++)s+=hf[t[i]];const r=`0x${s}`;return typeof e.size=="number"?(Qr(r,{size:e.size}),Zr(r,{dir:"right",size:e.size})):r}function zu(t,e={}){const{signed:s,size:r}=e,i=BigInt(t);let n;r?s?n=(1n<<BigInt(r)*8n-1n)-1n:n=2n**(BigInt(r)*8n)-1n:typeof t=="number"&&(n=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof n=="bigint"&&s?-n-1n:0;if(n&&i>n||i<o){const c=typeof t=="bigint"?"n":"";throw new lf({max:n?`${n}${c}`:void 0,min:`${o}${c}`,signed:s,size:r,value:`${t}${c}`})}const a=`0x${(s&&i<0?(1n<<BigInt(r*8))+BigInt(i):i).toString(16)}`;return r?Zr(a,{size:r}):a}const ff=new TextEncoder;function gf(t,e={}){const s=ff.encode(t);return qu(s,e)}const mf=new TextEncoder;function wf(t,e={}){return typeof t=="number"||typeof t=="bigint"?bf(t,e):typeof t=="boolean"?yf(t,e):xi(t)?Fu(t,e):Wu(t,e)}function yf(t,e={}){const s=new Uint8Array(1);return s[0]=Number(t),typeof e.size=="number"?(Qr(s,{size:e.size}),Zr(s,{size:e.size})):s}const ts={zero:48,nine:57,A:65,F:70,a:97,f:102};function vc(t){if(t>=ts.zero&&t<=ts.nine)return t-ts.zero;if(t>=ts.A&&t<=ts.F)return t-(ts.A-10);if(t>=ts.a&&t<=ts.f)return t-(ts.a-10)}function Fu(t,e={}){let s=t;e.size&&(Qr(s,{size:e.size}),s=Zr(s,{dir:"right",size:e.size}));let r=s.slice(2);r.length%2&&(r=`0${r}`);const i=r.length/2,n=new Uint8Array(i);for(let o=0,a=0;o<i;o++){const c=vc(r.charCodeAt(a++)),l=vc(r.charCodeAt(a++));if(c===void 0||l===void 0)throw new ro(`Invalid byte sequence ("${r[a-2]}${r[a-1]}" in "${r}").`);n[o]=c*16+l}return n}function bf(t,e){const s=zu(t,e);return Fu(s)}function Wu(t,e={}){const s=mf.encode(t);return typeof e.size=="number"?(Qr(s,{size:e.size}),Zr(s,{dir:"right",size:e.size})):s}function Kn(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function vf(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function io(t,...e){if(!vf(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 eA(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Kn(t.outputLen),Kn(t.blockLen)}function Ec(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 Ef(t,e){io(t);const s=e.outputLen;if(t.length<s)throw new Error("digestInto() expects output buffer of length at least "+s)}const Cn=BigInt(2**32-1),Cc=BigInt(32);function Cf(t,e=!1){return e?{h:Number(t&Cn),l:Number(t>>Cc&Cn)}:{h:Number(t>>Cc&Cn)|0,l:Number(t&Cn)|0}}function If(t,e=!1){let s=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let i=0;i<t.length;i++){const{h:n,l:o}=Cf(t[i],e);[s[i],r[i]]=[n,o]}return[s,r]}const Af=(t,e,s)=>t<<s|e>>>32-s,Nf=(t,e,s)=>e<<s|t>>>32-s,_f=(t,e,s)=>e<<s-32|t>>>64-s,Sf=(t,e,s)=>t<<s-32|e>>>64-s,lr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function Pf(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function tA(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function sA(t,e){return t<<32-e|t>>>e}const Ic=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Of(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function Ac(t){for(let e=0;e<t.length;e++)t[e]=Of(t[e])}function kf(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))}function Hu(t){return typeof t=="string"&&(t=kf(t)),io(t),t}function rA(...t){let e=0;for(let r=0;r<t.length;r++){const i=t[r];io(i),e+=i.length}const s=new Uint8Array(e);for(let r=0,i=0;r<t.length;r++){const n=t[r];s.set(n,i),i+=n.length}return s}class Tf{clone(){return this._cloneInto()}}function xf(t){const e=r=>t().update(Hu(r)).digest(),s=t();return e.outputLen=s.outputLen,e.blockLen=s.blockLen,e.create=()=>t(),e}function iA(t=32){if(lr&&typeof lr.getRandomValues=="function")return lr.getRandomValues(new Uint8Array(t));if(lr&&typeof lr.randomBytes=="function")return lr.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}const Vu=[],Ku=[],Gu=[],$f=BigInt(0),oi=BigInt(1),Rf=BigInt(2),Uf=BigInt(7),Df=BigInt(256),Lf=BigInt(113);for(let t=0,e=oi,s=1,r=0;t<24;t++){[s,r]=[r,(2*s+3*r)%5],Vu.push(2*(5*r+s)),Ku.push((t+1)*(t+2)/2%64);let i=$f;for(let n=0;n<7;n++)e=(e<<oi^(e>>Uf)*Lf)%Df,e&Rf&&(i^=oi<<(oi<<BigInt(n))-oi);Gu.push(i)}const[Mf,jf]=If(Gu,!0),Nc=(t,e,s)=>s>32?_f(t,e,s):Af(t,e,s),_c=(t,e,s)=>s>32?Sf(t,e,s):Nf(t,e,s);function Bf(t,e=24){const s=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let o=0;o<10;o++)s[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,l=s[c],u=s[c+1],d=Nc(l,u,1)^s[a],h=_c(l,u,1)^s[a+1];for(let f=0;f<50;f+=10)t[o+f]^=d,t[o+f+1]^=h}let i=t[2],n=t[3];for(let o=0;o<24;o++){const a=Ku[o],c=Nc(i,n,a),l=_c(i,n,a),u=Vu[o];i=t[u],n=t[u+1],t[u]=c,t[u+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)s[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~s[(a+2)%10]&s[(a+4)%10]}t[0]^=Mf[r],t[1]^=jf[r]}s.fill(0)}class Ba extends Tf{constructor(e,s,r,i=!1,n=24){if(super(),this.blockLen=e,this.suffix=s,this.outputLen=r,this.enableXOF=i,this.rounds=n,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Kn(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=Pf(this.state)}keccak(){Ic||Ac(this.state32),Bf(this.state32,this.rounds),Ic||Ac(this.state32),this.posOut=0,this.pos=0}update(e){Ec(this);const{blockLen:s,state:r}=this;e=Hu(e);const i=e.length;for(let n=0;n<i;){const o=Math.min(s-this.pos,i-n);for(let a=0;a<o;a++)r[this.pos++]^=e[n++];this.pos===s&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:s,pos:r,blockLen:i}=this;e[r]^=s,(s&128)!==0&&r===i-1&&this.keccak(),e[i-1]^=128,this.keccak()}writeInto(e){Ec(this,!1),io(e),this.finish();const s=this.state,{blockLen:r}=this;for(let i=0,n=e.length;i<n;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,n-i);e.set(s.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 Kn(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(Ef(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:s,suffix:r,outputLen:i,rounds:n,enableXOF:o}=this;return e||(e=new Ba(s,r,i,o,n)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=n,e.suffix=r,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}}const qf=(t,e,s)=>xf(()=>new Ba(e,t,s)),zf=qf(1,136,256/8);function Ju(t,e){const s=e||"hex",r=zf(xi(t,{strict:!1})?wf(t):t);return s==="bytes"?r:ia(r)}let Ff=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 s=super.get(e);return super.has(e)&&s!==void 0&&(this.delete(e),super.set(e,s)),s}set(e,s){if(super.set(e,s),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}};const Co=new Ff(8192);function Wf(t,e){if(Co.has(`${t}.${e}`))return Co.get(`${t}.${e}`);const s=t.substring(2).toLowerCase(),r=Ju(Wu(s),"bytes"),i=s.split("");for(let o=0;o<40;o+=2)r[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(r[o>>1]&15)>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const n=`0x${i.join("")}`;return Co.set(`${t}.${e}`,n),n}function Hf(t){const e=Ju(`0x${t.substring(4)}`).substring(26);return Wf(`0x${e}`)}async function Vf({hash:t,signature:e}){const s=xi(t)?t:ia(t),{secp256k1:r}=await Yo(async()=>{const{secp256k1:o}=await import("./secp256k1-DekXzlV8.js");return{secp256k1:o}},__vite__mapDeps([0,1,2,3,4]));return`0x${(()=>{if(typeof e=="object"&&"r"in e&&"s"in e){const{r:l,s:u,v:d,yParity:h}=e,f=Number(h??d),w=Sc(f);return new r.Signature(ra(l),ra(u)).addRecoveryBit(w)}const o=xi(e)?e:ia(e),a=df(`0x${o.slice(130)}`),c=Sc(a);return r.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(c)})().recoverPublicKey(s.substring(2)).toHex(!1)}`}function Sc(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 Kf({hash:t,signature:e}){return Hf(await Vf({hash:t,signature:e}))}var Gf={};const Jf=":";function $r(t){const[e,s]=t.split(Jf);return{namespace:e,reference:s}}function Yu(t,e){return t.includes(":")?[t]:e.chains||[]}var Yf=Object.defineProperty,Xf=Object.defineProperties,Zf=Object.getOwnPropertyDescriptors,Pc=Object.getOwnPropertySymbols,Qf=Object.prototype.hasOwnProperty,eg=Object.prototype.propertyIsEnumerable,Oc=(t,e,s)=>e in t?Yf(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,kc=(t,e)=>{for(var s in e||(e={}))Qf.call(e,s)&&Oc(t,s,e[s]);if(Pc)for(var s of Pc(e))eg.call(e,s)&&Oc(t,s,e[s]);return t},tg=(t,e)=>Xf(t,Zf(e));const sg="ReactNative",yt={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},rg="js";function Gn(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function ks(){return!ls.getDocument()&&!!ls.getNavigator()&&navigator.product===sg}function ig(){return ks()&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"&&(global==null?void 0:global.Platform.OS)==="android"}function ng(){return ks()&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"&&(global==null?void 0:global.Platform.OS)==="ios"}function ei(){return!Gn()&&!!ls.getNavigator()&&!!ls.getDocument()}function dn(){return ks()?yt.reactNative:Gn()?yt.node:ei()?yt.browser:yt.unknown}function Tc(){var t;try{return ks()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function og(t,e){const s=new URLSearchParams(t);for(const r of Object.keys(e).sort())if(e.hasOwnProperty(r)){const i=e[r];i!==void 0&&s.set(r,i)}return s.toString()}function ag(t){var e,s;const r=Xu();try{return t!=null&&t.url&&r.url&&new URL(t.url).host!==new URL(r.url).host&&(console.warn(`The configured WalletConnect 'metadata.url':${t.url} differs from the actual page url:${r.url}. This is probably unintended and can lead to issues.`),t.url=r.url),(e=t?.icons)!=null&&e.length&&t.icons.length>0&&(t.icons=t.icons.filter(i=>i!=="")),tg(kc(kc({},r),t),{url:t?.url||r.url,name:t?.name||r.name,description:t?.description||r.description,icons:(s=t?.icons)!=null&&s.length&&t.icons.length>0?t.icons:r.icons})}catch(i){return console.warn("Error populating app metadata",i),t||r}}function Xu(){return $h.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function cg(){if(dn()===yt.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:s,Version:r}=global.Platform;return[s,r].join("-")}const t=Uh();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 lg(){var t;const e=dn();return e===yt.browser?[e,((t=ls.getLocation())==null?void 0:t.host)||"unknown"].join(":"):e}function Zu(t,e,s){const r=cg(),i=lg();return[[t,e].join("-"),[rg,s].join("-"),r,i].join("/")}function ug({protocol:t,version:e,relayUrl:s,sdkVersion:r,auth:i,projectId:n,useOnCloseEvent:o,bundleId:a,packageName:c}){const l=s.split("?"),u=Zu(t,e,r),d={auth:i,ua:u,projectId:n,useOnCloseEvent:o,packageName:c||void 0,bundleId:a||void 0},h=og(l[1]||"",d);return l[0]+"?"+h}function Fs(t,e){return t.filter(s=>e.includes(s)).length===t.length}function na(t){return Object.fromEntries(t.entries())}function oa(t){return new Map(Object.entries(t))}function Ls(t=L.FIVE_MINUTES,e){const s=L.toMiliseconds(t||L.FIVE_MINUTES);let r,i,n,o;return{resolve:a=>{n&&r&&(clearTimeout(n),r(a),o=Promise.resolve(a))},reject:a=>{n&&i&&(clearTimeout(n),i(a))},done:()=>new Promise((a,c)=>{if(o)return a(o);n=setTimeout(()=>{const l=new Error(e);o=Promise.reject(l),c(l)},s),r=a,i=c})}}function Is(t,e,s){return new Promise(async(r,i)=>{const n=setTimeout(()=>i(new Error(s)),e);try{const o=await t;r(o)}catch(o){i(o)}clearTimeout(n)})}function Qu(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 dg(t){return Qu("topic",t)}function hg(t){return Qu("id",t)}function ed(t){const[e,s]=t.split(":"),r={id:void 0,topic:void 0};if(e==="topic"&&typeof s=="string")r.topic=s;else if(e==="id"&&Number.isInteger(Number(s)))r.id=Number(s);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${s}`);return r}function De(t,e){return L.fromMiliseconds(Date.now()+L.toMiliseconds(t))}function bs(t){return Date.now()>=L.toMiliseconds(t)}function pe(t,e){return`${t}${e?`:${e}`:""}`}function Jt(t=[],e=[]){return[...new Set([...t,...e])]}async function pg({id:t,topic:e,wcDeepLink:s}){var r;try{if(!s)return;const i=typeof s=="string"?JSON.parse(s):s,n=i?.href;if(typeof n!="string")return;const o=fg(n,t,e),a=dn();if(a===yt.browser){if(!((r=ls.getDocument())!=null&&r.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}gg(o)}else a===yt.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(i){console.error(i)}}function fg(t,e,s){const r=`requestId=${e}&sessionTopic=${s}`;t.endsWith("/")&&(t=t.slice(0,-1));let i=`${t}`;if(t.startsWith("https://t.me")){const n=t.includes("?")?"&startapp=":"?startapp=";i=`${i}${n}${bg(r,!0)}`}else i=`${i}/wc?${r}`;return i}function gg(t){let e="_self";yg()?e="_top":(wg()||t.startsWith("https://")||t.startsWith("http://"))&&(e="_blank"),window.open(t,e,"noreferrer noopener")}async function mg(t,e){let s="";try{if(ei()&&(s=localStorage.getItem(e),s))return s;s=await t.getItem(e)}catch(r){console.error(r)}return s}function xc(t,e){if(!t.includes(e))return null;const s=t.split(/([&,?,=])/),r=s.indexOf(e);return s[r+2]}function $c(){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 qa(){return typeof process<"u"&&Gf.IS_VITEST==="true"}function wg(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function yg(){try{return window.self!==window.top}catch{return!1}}function bg(t,e=!1){const s=Buffer.from(t).toString("base64");return e?s.replace(/[=]/g,""):s}function td(t){return Buffer.from(t,"base64").toString("utf-8")}function vg(t){return new Promise(e=>setTimeout(e,t))}function $i(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function Eg(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function hn(t,...e){if(!Eg(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 za(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");$i(t.outputLen),$i(t.blockLen)}function Lr(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 sd(t,e){hn(t);const s=e.outputLen;if(t.length<s)throw new Error("digestInto() expects output buffer of length at least "+s)}const In=BigInt(2**32-1),Rc=BigInt(32);function Cg(t,e=!1){return e?{h:Number(t&In),l:Number(t>>Rc&In)}:{h:Number(t>>Rc&In)|0,l:Number(t&In)|0}}function Ig(t,e=!1){let s=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let i=0;i<t.length;i++){const{h:n,l:o}=Cg(t[i],e);[s[i],r[i]]=[n,o]}return[s,r]}const Ag=(t,e,s)=>t<<s|e>>>32-s,Ng=(t,e,s)=>e<<s|t>>>32-s,_g=(t,e,s)=>e<<s-32|t>>>64-s,Sg=(t,e,s)=>t<<s-32|e>>>64-s,ur=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function Pg(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function Io(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function qt(t,e){return t<<32-e|t>>>e}const Uc=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Og(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function Dc(t){for(let e=0;e<t.length;e++)t[e]=Og(t[e])}function kg(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))}function Mr(t){return typeof t=="string"&&(t=kg(t)),hn(t),t}function Tg(...t){let e=0;for(let r=0;r<t.length;r++){const i=t[r];hn(i),e+=i.length}const s=new Uint8Array(e);for(let r=0,i=0;r<t.length;r++){const n=t[r];s.set(n,i),i+=n.length}return s}let Fa=class{clone(){return this._cloneInto()}};function rd(t){const e=r=>t().update(Mr(r)).digest(),s=t();return e.outputLen=s.outputLen,e.blockLen=s.blockLen,e.create=()=>t(),e}function ti(t=32){if(ur&&typeof ur.getRandomValues=="function")return ur.getRandomValues(new Uint8Array(t));if(ur&&typeof ur.randomBytes=="function")return ur.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}const id=[],nd=[],od=[],xg=BigInt(0),ai=BigInt(1),$g=BigInt(2),Rg=BigInt(7),Ug=BigInt(256),Dg=BigInt(113);for(let t=0,e=ai,s=1,r=0;t<24;t++){[s,r]=[r,(2*s+3*r)%5],id.push(2*(5*r+s)),nd.push((t+1)*(t+2)/2%64);let i=xg;for(let n=0;n<7;n++)e=(e<<ai^(e>>Rg)*Dg)%Ug,e&$g&&(i^=ai<<(ai<<BigInt(n))-ai);od.push(i)}const[Lg,Mg]=Ig(od,!0),Lc=(t,e,s)=>s>32?_g(t,e,s):Ag(t,e,s),Mc=(t,e,s)=>s>32?Sg(t,e,s):Ng(t,e,s);function jg(t,e=24){const s=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let o=0;o<10;o++)s[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,l=s[c],u=s[c+1],d=Lc(l,u,1)^s[a],h=Mc(l,u,1)^s[a+1];for(let f=0;f<50;f+=10)t[o+f]^=d,t[o+f+1]^=h}let i=t[2],n=t[3];for(let o=0;o<24;o++){const a=nd[o],c=Lc(i,n,a),l=Mc(i,n,a),u=id[o];i=t[u],n=t[u+1],t[u]=c,t[u+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)s[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~s[(a+2)%10]&s[(a+4)%10]}t[0]^=Lg[r],t[1]^=Mg[r]}s.fill(0)}let Bg=class ad extends Fa{constructor(e,s,r,i=!1,n=24){if(super(),this.blockLen=e,this.suffix=s,this.outputLen=r,this.enableXOF=i,this.rounds=n,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,$i(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=Pg(this.state)}keccak(){Uc||Dc(this.state32),jg(this.state32,this.rounds),Uc||Dc(this.state32),this.posOut=0,this.pos=0}update(e){Lr(this);const{blockLen:s,state:r}=this;e=Mr(e);const i=e.length;for(let n=0;n<i;){const o=Math.min(s-this.pos,i-n);for(let a=0;a<o;a++)r[this.pos++]^=e[n++];this.pos===s&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:s,pos:r,blockLen:i}=this;e[r]^=s,(s&128)!==0&&r===i-1&&this.keccak(),e[i-1]^=128,this.keccak()}writeInto(e){Lr(this,!1),hn(e),this.finish();const s=this.state,{blockLen:r}=this;for(let i=0,n=e.length;i<n;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,n-i);e.set(s.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 $i(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(sd(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:s,suffix:r,outputLen:i,rounds:n,enableXOF:o}=this;return e||(e=new ad(s,r,i,o,n)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=n,e.suffix=r,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}};const qg=(t,e,s)=>rd(()=>new Bg(e,t,s)),zg=qg(1,136,256/8),Fg="https://rpc.walletconnect.org/v1";function cd(t){const e=`Ethereum Signed Message:
|
|
6
6
|
${t.length}`,s=new TextEncoder().encode(e+t);return"0x"+Buffer.from(zg(s)).toString("hex")}async function Wg(t,e,s,r,i,n){switch(s.t){case"eip191":return await Hg(t,e,s.s);case"eip1271":return await Vg(t,e,s.s,r,i,n);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${s.t}`)}}async function Hg(t,e,s){return(await Kf({hash:cd(e),signature:s})).toLowerCase()===t.toLowerCase()}async function Vg(t,e,s,r,i,n){const o=$r(r);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${r}`);try{const a="0x1626ba7e",c="0000000000000000000000000000000000000000000000000000000000000040",l="0000000000000000000000000000000000000000000000000000000000000041",u=s.substring(2),d=cd(e).substring(2),h=a+d+c+l+u,f=await fetch(`${n||Fg}/?chainId=${r}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:Kg(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:h},"latest"]})}),{result:w}=await f.json();return w?w.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function Kg(){return Date.now()+Math.floor(Math.random()*1e3)}function Gg(t){const e=atob(t),s=new Uint8Array(e.length);for(let o=0;o<e.length;o++)s[o]=e.charCodeAt(o);const r=s[0];if(r===0)throw new Error("No signatures found");const i=1+r*64;if(s.length<i)throw new Error("Transaction data too short for claimed signature count");if(s.length<100)throw new Error("Transaction too short");const n=Buffer.from(t,"base64").slice(1,65);return Pu.encode(n)}var Jg=Object.defineProperty,Yg=Object.defineProperties,Xg=Object.getOwnPropertyDescriptors,jc=Object.getOwnPropertySymbols,Zg=Object.prototype.hasOwnProperty,Qg=Object.prototype.propertyIsEnumerable,Bc=(t,e,s)=>e in t?Jg(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,em=(t,e)=>{for(var s in e||(e={}))Zg.call(e,s)&&Bc(t,s,e[s]);if(jc)for(var s of jc(e))Qg.call(e,s)&&Bc(t,s,e[s]);return t},tm=(t,e)=>Yg(t,Xg(e));const sm="did:pkh:",Wa=t=>t?.split(":"),rm=t=>{const e=t&&Wa(t);if(e)return t.includes(sm)?e[3]:e[1]},aa=t=>{const e=t&&Wa(t);if(e)return e[2]+":"+e[3]},Jn=t=>{const e=t&&Wa(t);if(e)return e.pop()};async function qc(t){const{cacao:e,projectId:s}=t,{s:r,p:i}=e,n=ld(i,i.iss),o=Jn(i.iss);return await Wg(o,n,r,aa(i.iss),s)}const ld=(t,e)=>{const s=`${t.domain} wants you to sign in with your Ethereum account:`,r=Jn(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 n=`URI: ${t.aud||t.uri}`,o=`Version: ${t.version}`,a=`Chain ID: ${rm(e)}`,c=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,u=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(m=>`
|
|
7
7
|
- ${m}`).join("")}`:void 0,w=Mn(t.resources);if(w){const m=Ri(w);i=hm(i,m)}return[s,r,"",i,"",n,o,a,c,l,u,d,h,f].filter(m=>m!=null).join(`
|
|
8
8
|
`)};function im(t){return Buffer.from(JSON.stringify(t)).toString("base64")}function nm(t){return JSON.parse(Buffer.from(t,"base64").toString("utf-8"))}function Xs(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(s=>{const r=t.att[s];if(Array.isArray(r))throw new Error(`Resource must be an object: ${s}`);if(typeof r!="object")throw new Error(`Resource must be an object: ${s}`);if(!Object.keys(r).length)throw new Error(`Resource object is empty: ${s}`);Object.keys(r).forEach(i=>{const n=r[i];if(!Array.isArray(n))throw new Error(`Ability limits ${i} must be an array of objects, found: ${n}`);if(!n.length)throw new Error(`Value of ${i} is empty array, must be an array with objects`);n.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${i}) must be an array of objects, found: ${o}`)})})})}function om(t,e,s,r={}){return s?.sort((i,n)=>i.localeCompare(n)),{att:{[t]:am(e,s,r)}}}function am(t,e,s={}){e=e?.sort((i,n)=>i.localeCompare(n));const r=e.map(i=>({[`${t}/${i}`]:[s]}));return Object.assign({},...r)}function ud(t){return Xs(t),`urn:recap:${im(t).replace(/=/g,"")}`}function Ri(t){const e=nm(t.replace("urn:recap:",""));return Xs(e),e}function cm(t,e,s){const r=om(t,e,s);return ud(r)}function lm(t){return t&&t.includes("urn:recap:")}function um(t,e){const s=Ri(t),r=Ri(e),i=dm(s,r);return ud(i)}function dm(t,e){Xs(t),Xs(e);const s=Object.keys(t.att).concat(Object.keys(e.att)).sort((i,n)=>i.localeCompare(n)),r={att:{}};return s.forEach(i=>{var n,o;Object.keys(((n=t.att)==null?void 0:n[i])||{}).concat(Object.keys(((o=e.att)==null?void 0:o[i])||{})).sort((a,c)=>a.localeCompare(c)).forEach(a=>{var c,l;r.att[i]=tm(em({},r.att[i]),{[a]:((c=t.att[i])==null?void 0:c[a])||((l=e.att[i])==null?void 0:l[a])})})}),r}function hm(t="",e){Xs(e);const s="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(s))return t;const r=[];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 l={};c.forEach(d=>{l[d.ability]||(l[d.ability]=[]),l[d.ability].push(d.action)});const u=Object.keys(l).map(d=>(i++,`(${i}) '${d}': '${l[d].join("', '")}' for '${a}'.`));r.push(u.join(", ").replace(".,","."))});const n=r.join(" "),o=`${s}${n}`;return`${t?t+" ":""}${o}`}function zc(t){var e;const s=Ri(t);Xs(s);const r=(e=s.att)==null?void 0:e.eip155;return r?Object.keys(r).map(i=>i.split("/")[1]):[]}function Fc(t){const e=Ri(t);Xs(e);const s=[];return Object.values(e.att).forEach(r=>{Object.values(r).forEach(i=>{var n;(n=i?.[0])!=null&&n.chains&&s.push(i[0].chains)})}),[...new Set(s.flat())]}function Mn(t){if(!t)return;const e=t?.[t.length-1];return lm(e)?e:void 0}function Ao(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function dd(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function wt(t,...e){if(!dd(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 Wc(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 pm(t,e){wt(t);const s=e.outputLen;if(t.length<s)throw new Error("digestInto() expects output buffer of length at least "+s)}function Hc(t){if(typeof t!="boolean")throw new Error(`boolean expected, not ${t}`)}const Ns=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),fm=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),gm=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!gm)throw new Error("Non little-endian hardware is not supported");function mm(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function ca(t){if(typeof t=="string")t=mm(t);else if(dd(t))t=la(t);else throw new Error("Uint8Array expected, got "+typeof t);return t}function wm(t,e){if(e==null||typeof e!="object")throw new Error("options must be defined");return Object.assign(t,e)}function ym(t,e){if(t.length!==e.length)return!1;let s=0;for(let r=0;r<t.length;r++)s|=t[r]^e[r];return s===0}const bm=(t,e)=>{function s(r,...i){if(wt(r),t.nonceLength!==void 0){const l=i[0];if(!l)throw new Error("nonce / iv required");t.varSizeNonce?wt(l):wt(l,t.nonceLength)}const n=t.tagLength;n&&i[1]!==void 0&&wt(i[1]);const o=e(r,...i),a=(l,u)=>{if(u!==void 0){if(l!==2)throw new Error("cipher output not supported");wt(u)}};let c=!1;return{encrypt(l,u){if(c)throw new Error("cannot encrypt() twice with same key + nonce");return c=!0,wt(l),a(o.encrypt.length,u),o.encrypt(l,u)},decrypt(l,u){if(wt(l),n&&l.length<n)throw new Error("invalid ciphertext length: smaller than tagLength="+n);return a(o.decrypt.length,u),o.decrypt(l,u)}}}return Object.assign(s,t),s};function Vc(t,e,s=!0){if(e===void 0)return new Uint8Array(t);if(e.length!==t)throw new Error("invalid output length, expected "+t+", got: "+e.length);if(s&&!vm(e))throw new Error("invalid output, must be aligned");return e}function Kc(t,e,s,r){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,s,r);const i=BigInt(32),n=BigInt(4294967295),o=Number(s>>i&n),a=Number(s&n);t.setUint32(e+4,o,r),t.setUint32(e+0,a,r)}function vm(t){return t.byteOffset%4===0}function la(t){return Uint8Array.from(t)}function jr(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}const hd=t=>Uint8Array.from(t.split("").map(e=>e.charCodeAt(0))),Em=hd("expand 16-byte k"),Cm=hd("expand 32-byte k"),Im=Ns(Em),Am=Ns(Cm);function ce(t,e){return t<<e|t>>>32-e}function ua(t){return t.byteOffset%4===0}const An=64,Nm=16,pd=2**32-1,Gc=new Uint32Array;function _m(t,e,s,r,i,n,o,a){const c=i.length,l=new Uint8Array(An),u=Ns(l),d=ua(i)&&ua(n),h=d?Ns(i):Gc,f=d?Ns(n):Gc;for(let w=0;w<c;o++){if(t(e,s,r,u,o,a),o>=pd)throw new Error("arx: counter overflow");const m=Math.min(An,c-w);if(d&&m===An){const g=w/4;if(w%4!==0)throw new Error("arx: invalid block position");for(let y=0,b;y<Nm;y++)b=g+y,f[b]=h[b]^u[y];w+=An;continue}for(let g=0,y;g<m;g++)y=w+g,n[y]=i[y]^l[g];w+=m}}function Sm(t,e){const{allowShortKeys:s,extendNonceFn:r,counterLength:i,counterRight:n,rounds:o}=wm({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},e);if(typeof t!="function")throw new Error("core must be a function");return Ao(i),Ao(o),Hc(n),Hc(s),(a,c,l,u,d=0)=>{wt(a),wt(c),wt(l);const h=l.length;if(u===void 0&&(u=new Uint8Array(h)),wt(u),Ao(d),d<0||d>=pd)throw new Error("arx: counter overflow");if(u.length<h)throw new Error(`arx: output (${u.length}) is shorter than data (${h})`);const f=[];let w=a.length,m,g;if(w===32)f.push(m=la(a)),g=Am;else if(w===16&&s)m=new Uint8Array(32),m.set(a),m.set(a,16),g=Im,f.push(m);else throw new Error(`arx: invalid 32-byte key, got length=${w}`);ua(c)||f.push(c=la(c));const y=Ns(m);if(r){if(c.length!==24)throw new Error("arx: extended nonce must be 24 bytes");r(g,y,Ns(c.subarray(0,16)),y),c=c.subarray(16)}const b=16-i;if(b!==c.length)throw new Error(`arx: nonce must be ${b} or 16 bytes`);if(b!==12){const _=new Uint8Array(12);_.set(c,n?0:12-c.length),c=_,f.push(c)}const E=Ns(c);return _m(t,g,y,E,l,u,d,o),jr(...f),u}}const He=(t,e)=>t[e++]&255|(t[e++]&255)<<8;class Pm{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=ca(e),wt(e,32);const s=He(e,0),r=He(e,2),i=He(e,4),n=He(e,6),o=He(e,8),a=He(e,10),c=He(e,12),l=He(e,14);this.r[0]=s&8191,this.r[1]=(s>>>13|r<<3)&8191,this.r[2]=(r>>>10|i<<6)&7939,this.r[3]=(i>>>7|n<<9)&8191,this.r[4]=(n>>>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|l<<8)&8191,this.r[9]=l>>>5&127;for(let u=0;u<8;u++)this.pad[u]=He(e,16+2*u)}process(e,s,r=!1){const i=r?0:2048,{h:n,r:o}=this,a=o[0],c=o[1],l=o[2],u=o[3],d=o[4],h=o[5],f=o[6],w=o[7],m=o[8],g=o[9],y=He(e,s+0),b=He(e,s+2),E=He(e,s+4),_=He(e,s+6),O=He(e,s+8),A=He(e,s+10),I=He(e,s+12),U=He(e,s+14);let v=n[0]+(y&8191),$=n[1]+((y>>>13|b<<3)&8191),C=n[2]+((b>>>10|E<<6)&8191),R=n[3]+((E>>>7|_<<9)&8191),W=n[4]+((_>>>4|O<<12)&8191),N=n[5]+(O>>>1&8191),T=n[6]+((O>>>14|A<<2)&8191),P=n[7]+((A>>>11|I<<5)&8191),j=n[8]+((I>>>8|U<<8)&8191),q=n[9]+(U>>>5|i),x=0,G=x+v*a+$*(5*g)+C*(5*m)+R*(5*w)+W*(5*f);x=G>>>13,G&=8191,G+=N*(5*h)+T*(5*d)+P*(5*u)+j*(5*l)+q*(5*c),x+=G>>>13,G&=8191;let Q=x+v*c+$*a+C*(5*g)+R*(5*m)+W*(5*w);x=Q>>>13,Q&=8191,Q+=N*(5*f)+T*(5*h)+P*(5*d)+j*(5*u)+q*(5*l),x+=Q>>>13,Q&=8191;let se=x+v*l+$*c+C*a+R*(5*g)+W*(5*m);x=se>>>13,se&=8191,se+=N*(5*w)+T*(5*f)+P*(5*h)+j*(5*d)+q*(5*u),x+=se>>>13,se&=8191;let Ee=x+v*u+$*l+C*c+R*a+W*(5*g);x=Ee>>>13,Ee&=8191,Ee+=N*(5*m)+T*(5*w)+P*(5*f)+j*(5*h)+q*(5*d),x+=Ee>>>13,Ee&=8191;let he=x+v*d+$*u+C*l+R*c+W*a;x=he>>>13,he&=8191,he+=N*(5*g)+T*(5*m)+P*(5*w)+j*(5*f)+q*(5*h),x+=he>>>13,he&=8191;let ke=x+v*h+$*d+C*u+R*l+W*c;x=ke>>>13,ke&=8191,ke+=N*a+T*(5*g)+P*(5*m)+j*(5*w)+q*(5*f),x+=ke>>>13,ke&=8191;let Le=x+v*f+$*h+C*d+R*u+W*l;x=Le>>>13,Le&=8191,Le+=N*c+T*a+P*(5*g)+j*(5*m)+q*(5*w),x+=Le>>>13,Le&=8191;let Ye=x+v*w+$*f+C*h+R*d+W*u;x=Ye>>>13,Ye&=8191,Ye+=N*l+T*c+P*a+j*(5*g)+q*(5*m),x+=Ye>>>13,Ye&=8191;let $e=x+v*m+$*w+C*f+R*h+W*d;x=$e>>>13,$e&=8191,$e+=N*u+T*l+P*c+j*a+q*(5*g),x+=$e>>>13,$e&=8191;let Re=x+v*g+$*m+C*w+R*f+W*h;x=Re>>>13,Re&=8191,Re+=N*d+T*u+P*l+j*c+q*a,x+=Re>>>13,Re&=8191,x=(x<<2)+x|0,x=x+G|0,G=x&8191,x=x>>>13,Q+=x,n[0]=G,n[1]=Q,n[2]=se,n[3]=Ee,n[4]=he,n[5]=ke,n[6]=Le,n[7]=Ye,n[8]=$e,n[9]=Re}finalize(){const{h:e,pad:s}=this,r=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,r[0]=e[0]+5,i=r[0]>>>13,r[0]&=8191;for(let a=1;a<10;a++)r[a]=e[a]+i,i=r[a]>>>13,r[a]&=8191;r[9]-=8192;let n=(i^1)-1;for(let a=0;a<10;a++)r[a]&=n;n=~n;for(let a=0;a<10;a++)e[a]=e[a]&n|r[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]+s[0];e[0]=o&65535;for(let a=1;a<8;a++)o=(e[a]+s[a]|0)+(o>>>16)|0,e[a]=o&65535;jr(r)}update(e){Wc(this);const{buffer:s,blockLen:r}=this;e=ca(e);const i=e.length;for(let n=0;n<i;){const o=Math.min(r-this.pos,i-n);if(o===r){for(;r<=i-n;n+=r)this.process(e,n);continue}s.set(e.subarray(n,n+o),this.pos),this.pos+=o,n+=o,this.pos===r&&(this.process(s,0,!1),this.pos=0)}return this}destroy(){jr(this.h,this.r,this.buffer,this.pad)}digestInto(e){Wc(this),pm(e,this),this.finished=!0;const{buffer:s,h:r}=this;let{pos:i}=this;if(i){for(s[i++]=1;i<16;i++)s[i]=0;this.process(s,0,!0)}this.finalize();let n=0;for(let o=0;o<8;o++)e[n++]=r[o]>>>0,e[n++]=r[o]>>>8;return e}digest(){const{buffer:e,outputLen:s}=this;this.digestInto(e);const r=e.slice(0,s);return this.destroy(),r}}function Om(t){const e=(r,i)=>t(i).update(ca(r)).digest(),s=t(new Uint8Array(32));return e.outputLen=s.outputLen,e.blockLen=s.blockLen,e.create=r=>t(r),e}const km=Om(t=>new Pm(t));function Tm(t,e,s,r,i,n=20){let o=t[0],a=t[1],c=t[2],l=t[3],u=e[0],d=e[1],h=e[2],f=e[3],w=e[4],m=e[5],g=e[6],y=e[7],b=i,E=s[0],_=s[1],O=s[2],A=o,I=a,U=c,v=l,$=u,C=d,R=h,W=f,N=w,T=m,P=g,j=y,q=b,x=E,G=_,Q=O;for(let Ee=0;Ee<n;Ee+=2)A=A+$|0,q=ce(q^A,16),N=N+q|0,$=ce($^N,12),A=A+$|0,q=ce(q^A,8),N=N+q|0,$=ce($^N,7),I=I+C|0,x=ce(x^I,16),T=T+x|0,C=ce(C^T,12),I=I+C|0,x=ce(x^I,8),T=T+x|0,C=ce(C^T,7),U=U+R|0,G=ce(G^U,16),P=P+G|0,R=ce(R^P,12),U=U+R|0,G=ce(G^U,8),P=P+G|0,R=ce(R^P,7),v=v+W|0,Q=ce(Q^v,16),j=j+Q|0,W=ce(W^j,12),v=v+W|0,Q=ce(Q^v,8),j=j+Q|0,W=ce(W^j,7),A=A+C|0,Q=ce(Q^A,16),P=P+Q|0,C=ce(C^P,12),A=A+C|0,Q=ce(Q^A,8),P=P+Q|0,C=ce(C^P,7),I=I+R|0,q=ce(q^I,16),j=j+q|0,R=ce(R^j,12),I=I+R|0,q=ce(q^I,8),j=j+q|0,R=ce(R^j,7),U=U+W|0,x=ce(x^U,16),N=N+x|0,W=ce(W^N,12),U=U+W|0,x=ce(x^U,8),N=N+x|0,W=ce(W^N,7),v=v+$|0,G=ce(G^v,16),T=T+G|0,$=ce($^T,12),v=v+$|0,G=ce(G^v,8),T=T+G|0,$=ce($^T,7);let se=0;r[se++]=o+A|0,r[se++]=a+I|0,r[se++]=c+U|0,r[se++]=l+v|0,r[se++]=u+$|0,r[se++]=d+C|0,r[se++]=h+R|0,r[se++]=f+W|0,r[se++]=w+N|0,r[se++]=m+T|0,r[se++]=g+P|0,r[se++]=y+j|0,r[se++]=b+q|0,r[se++]=E+x|0,r[se++]=_+G|0,r[se++]=O+Q|0}const xm=Sm(Tm,{counterRight:!1,counterLength:4,allowShortKeys:!1}),$m=new Uint8Array(16),Jc=(t,e)=>{t.update(e);const s=e.length%16;s&&t.update($m.subarray(s))},Rm=new Uint8Array(32);function Yc(t,e,s,r,i){const n=t(e,s,Rm),o=km.create(n);i&&Jc(o,i),Jc(o,r);const a=new Uint8Array(16),c=fm(a);Kc(c,0,BigInt(i?i.length:0),!0),Kc(c,8,BigInt(r.length),!0),o.update(a);const l=o.digest();return jr(n,a),l}const Um=t=>(e,s,r)=>({encrypt(i,n){const o=i.length;n=Vc(o+16,n,!1),n.set(i);const a=n.subarray(0,-16);t(e,s,a,a,1);const c=Yc(t,e,s,a,r);return n.set(c,o),jr(c),n},decrypt(i,n){n=Vc(i.length-16,n,!1);const o=i.subarray(0,-16),a=i.subarray(-16),c=Yc(t,e,s,o,r);if(!ym(a,c))throw new Error("invalid tag");return n.set(i.subarray(0,-16)),t(e,s,n,n,1),jr(c),n}}),fd=bm({blockSize:64,nonceLength:12,tagLength:16},Um(xm));let gd=class extends Fa{constructor(e,s){super(),this.finished=!1,this.destroyed=!1,za(e);const r=Mr(s);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,n=new Uint8Array(i);n.set(r.length>i?e.create().update(r).digest():r);for(let o=0;o<n.length;o++)n[o]^=54;this.iHash.update(n),this.oHash=e.create();for(let o=0;o<n.length;o++)n[o]^=106;this.oHash.update(n),n.fill(0)}update(e){return Lr(this),this.iHash.update(e),this}digestInto(e){Lr(this),hn(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:s,iHash:r,finished:i,destroyed:n,blockLen:o,outputLen:a}=this;return e=e,e.finished=i,e.destroyed=n,e.blockLen=o,e.outputLen=a,e.oHash=s._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const no=(t,e,s)=>new gd(t,e).update(s).digest();no.create=(t,e)=>new gd(t,e);function Dm(t,e,s){return za(t),s===void 0&&(s=new Uint8Array(t.outputLen)),no(t,Mr(s),Mr(e))}const No=new Uint8Array([0]),Xc=new Uint8Array;function Lm(t,e,s,r=32){if(za(t),$i(r),r>255*t.outputLen)throw new Error("Length should be <= 255*HashLen");const i=Math.ceil(r/t.outputLen);s===void 0&&(s=Xc);const n=new Uint8Array(i*t.outputLen),o=no.create(t,e),a=o._cloneInto(),c=new Uint8Array(o.outputLen);for(let l=0;l<i;l++)No[0]=l+1,a.update(l===0?Xc:c).update(s).update(No).digestInto(c),n.set(c,t.outputLen*l),o._cloneInto(a);return o.destroy(),a.destroy(),c.fill(0),No.fill(0),n.slice(0,r)}const Mm=(t,e,s,r,i)=>Lm(t,Dm(t,e,s),r,i);function jm(t,e,s,r){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,s,r);const i=BigInt(32),n=BigInt(4294967295),o=Number(s>>i&n),a=Number(s&n),c=r?4:0,l=r?0:4;t.setUint32(e+c,o,r),t.setUint32(e+l,a,r)}function Bm(t,e,s){return t&e^~t&s}function qm(t,e,s){return t&e^t&s^e&s}let zm=class extends Fa{constructor(e,s,r,i){super(),this.blockLen=e,this.outputLen=s,this.padOffset=r,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Io(this.buffer)}update(e){Lr(this);const{view:s,buffer:r,blockLen:i}=this;e=Mr(e);const n=e.length;for(let o=0;o<n;){const a=Math.min(i-this.pos,n-o);if(a===i){const c=Io(e);for(;i<=n-o;o+=i)this.process(c,o);continue}r.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===i&&(this.process(s,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Lr(this),sd(e,this),this.finished=!0;const{buffer:s,view:r,blockLen:i,isLE:n}=this;let{pos:o}=this;s[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>i-o&&(this.process(r,0),o=0);for(let d=o;d<i;d++)s[d]=0;jm(r,i-8,BigInt(this.length*8),n),this.process(r,0);const a=Io(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=c/4,u=this.get();if(l>u.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<l;d++)a.setUint32(4*d,u[d],n)}digest(){const{buffer:e,outputLen:s}=this;this.digestInto(e);const r=e.slice(0,s);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:s,buffer:r,length:i,finished:n,destroyed:o,pos:a}=this;return e.length=i,e.pos=a,e.finished=n,e.destroyed=o,i%s&&e.buffer.set(r),e}};const Fm=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]),gs=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ms=new Uint32Array(64);class Wm extends zm{constructor(){super(64,32,8,!1),this.A=gs[0]|0,this.B=gs[1]|0,this.C=gs[2]|0,this.D=gs[3]|0,this.E=gs[4]|0,this.F=gs[5]|0,this.G=gs[6]|0,this.H=gs[7]|0}get(){const{A:e,B:s,C:r,D:i,E:n,F:o,G:a,H:c}=this;return[e,s,r,i,n,o,a,c]}set(e,s,r,i,n,o,a,c){this.A=e|0,this.B=s|0,this.C=r|0,this.D=i|0,this.E=n|0,this.F=o|0,this.G=a|0,this.H=c|0}process(e,s){for(let d=0;d<16;d++,s+=4)ms[d]=e.getUint32(s,!1);for(let d=16;d<64;d++){const h=ms[d-15],f=ms[d-2],w=qt(h,7)^qt(h,18)^h>>>3,m=qt(f,17)^qt(f,19)^f>>>10;ms[d]=m+ms[d-7]+w+ms[d-16]|0}let{A:r,B:i,C:n,D:o,E:a,F:c,G:l,H:u}=this;for(let d=0;d<64;d++){const h=qt(a,6)^qt(a,11)^qt(a,25),f=u+h+Bm(a,c,l)+Fm[d]+ms[d]|0,w=(qt(r,2)^qt(r,13)^qt(r,22))+qm(r,i,n)|0;u=l,l=c,c=a,a=o+f|0,o=n,n=i,i=r,r=f+w|0}r=r+this.A|0,i=i+this.B|0,n=n+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,l=l+this.G|0,u=u+this.H|0,this.set(r,i,n,o,a,c,l,u)}roundClean(){ms.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const pn=rd(()=>new Wm);const oo=BigInt(0),ao=BigInt(1),Hm=BigInt(2);function Zs(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function fn(t){if(!Zs(t))throw new Error("Uint8Array expected")}function Br(t,e){if(typeof e!="boolean")throw new Error(t+" boolean expected, got "+e)}const Vm=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function qr(t){fn(t);let e="";for(let s=0;s<t.length;s++)e+=Vm[t[s]];return e}function kr(t){const e=t.toString(16);return e.length&1?"0"+e:e}function Ha(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return t===""?oo:BigInt("0x"+t)}const ss={_0:48,_9:57,A:65,F:70,a:97,f:102};function Zc(t){if(t>=ss._0&&t<=ss._9)return t-ss._0;if(t>=ss.A&&t<=ss.F)return t-(ss.A-10);if(t>=ss.a&&t<=ss.f)return t-(ss.a-10)}function zr(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length,s=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(s);for(let i=0,n=0;i<s;i++,n+=2){const o=Zc(t.charCodeAt(n)),a=Zc(t.charCodeAt(n+1));if(o===void 0||a===void 0){const c=t[n]+t[n+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+n)}r[i]=o*16+a}return r}function Vs(t){return Ha(qr(t))}function Ui(t){return fn(t),Ha(qr(Uint8Array.from(t).reverse()))}function Fr(t,e){return zr(t.toString(16).padStart(e*2,"0"))}function co(t,e){return Fr(t,e).reverse()}function Km(t){return zr(kr(t))}function mt(t,e,s){let r;if(typeof e=="string")try{r=zr(e)}catch(n){throw new Error(t+" must be hex string or Uint8Array, cause: "+n)}else if(Zs(e))r=Uint8Array.from(e);else throw new Error(t+" must be hex string or Uint8Array");const i=r.length;if(typeof s=="number"&&i!==s)throw new Error(t+" of length "+s+" expected, got "+i);return r}function Di(...t){let e=0;for(let r=0;r<t.length;r++){const i=t[r];fn(i),e+=i.length}const s=new Uint8Array(e);for(let r=0,i=0;r<t.length;r++){const n=t[r];s.set(n,i),i+=n.length}return s}function Gm(t,e){if(t.length!==e.length)return!1;let s=0;for(let r=0;r<t.length;r++)s|=t[r]^e[r];return s===0}function Jm(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}const _o=t=>typeof t=="bigint"&&oo<=t;function lo(t,e,s){return _o(t)&&_o(e)&&_o(s)&&e<=t&&t<s}function as(t,e,s,r){if(!lo(e,s,r))throw new Error("expected valid "+t+": "+s+" <= n < "+r+", got "+e)}function md(t){let e;for(e=0;t>oo;t>>=ao,e+=1);return e}function Ym(t,e){return t>>BigInt(e)&ao}function Xm(t,e,s){return t|(s?ao:oo)<<BigInt(e)}const Va=t=>(Hm<<BigInt(t-1))-ao,So=t=>new Uint8Array(t),Qc=t=>Uint8Array.from(t);function wd(t,e,s){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 s!="function")throw new Error("hmacFn must be a function");let r=So(t),i=So(t),n=0;const o=()=>{r.fill(1),i.fill(0),n=0},a=(...u)=>s(i,r,...u),c=(u=So())=>{i=a(Qc([0]),u),r=a(),u.length!==0&&(i=a(Qc([1]),u),r=a())},l=()=>{if(n++>=1e3)throw new Error("drbg: tried 1000 values");let u=0;const d=[];for(;u<e;){r=a();const h=r.slice();d.push(h),u+=r.length}return Di(...d)};return(u,d)=>{o(),c(u);let h;for(;!(h=d(l()));)c();return o(),h}}const Zm={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"||Zs(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 si(t,e,s={}){const r=(i,n,o)=>{const a=Zm[n];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 "+n+", got "+c)};for(const[i,n]of Object.entries(e))r(i,n,!1);for(const[i,n]of Object.entries(s))r(i,n,!0);return t}const Qm=()=>{throw new Error("not implemented")};function da(t){const e=new WeakMap;return(s,...r)=>{const i=e.get(s);if(i!==void 0)return i;const n=t(s,...r);return e.set(s,n),n}}var ew=Object.freeze({__proto__:null,isBytes:Zs,abytes:fn,abool:Br,bytesToHex:qr,numberToHexUnpadded:kr,hexToNumber:Ha,hexToBytes:zr,bytesToNumberBE:Vs,bytesToNumberLE:Ui,numberToBytesBE:Fr,numberToBytesLE:co,numberToVarBytesBE:Km,ensureBytes:mt,concatBytes:Di,equalBytes:Gm,utf8ToBytes:Jm,inRange:lo,aInRange:as,bitLen:md,bitGet:Ym,bitSet:Xm,bitMask:Va,createHmacDrbg:wd,validateObject:si,notImplemented:Qm,memoized:da});const We=BigInt(0),Oe=BigInt(1),js=BigInt(2),tw=BigInt(3),ha=BigInt(4),el=BigInt(5),tl=BigInt(8);function lt(t,e){const s=t%e;return s>=We?s:e+s}function yd(t,e,s){if(e<We)throw new Error("invalid exponent, negatives unsupported");if(s<=We)throw new Error("invalid modulus");if(s===Oe)return We;let r=Oe;for(;e>We;)e&Oe&&(r=r*t%s),t=t*t%s,e>>=Oe;return r}function Ut(t,e,s){let r=t;for(;e-- >We;)r*=r,r%=s;return r}function pa(t,e){if(t===We)throw new Error("invert: expected non-zero number");if(e<=We)throw new Error("invert: expected positive modulus, got "+e);let s=lt(t,e),r=e,i=We,n=Oe;for(;s!==We;){const o=r/s,a=r%s,c=i-n*o;r=s,s=a,i=n,n=c}if(r!==Oe)throw new Error("invert: does not exist");return lt(i,e)}function sw(t){const e=(t-Oe)/js;let s,r,i;for(s=t-Oe,r=0;s%js===We;s/=js,r++);for(i=js;i<t&&yd(i,e,t)!==t-Oe;i++)if(i>1e3)throw new Error("Cannot find square root: likely non-prime P");if(r===1){const o=(t+Oe)/ha;return function(a,c){const l=a.pow(c,o);if(!a.eql(a.sqr(l),c))throw new Error("Cannot find square root");return l}}const n=(s+Oe)/js;return function(o,a){if(o.pow(a,e)===o.neg(o.ONE))throw new Error("Cannot find square root");let c=r,l=o.pow(o.mul(o.ONE,i),s),u=o.pow(a,n),d=o.pow(a,s);for(;!o.eql(d,o.ONE);){if(o.eql(d,o.ZERO))return o.ZERO;let h=1;for(let w=o.sqr(d);h<c&&!o.eql(w,o.ONE);h++)w=o.sqr(w);const f=o.pow(l,Oe<<BigInt(c-h-1));l=o.sqr(f),u=o.mul(u,f),d=o.mul(d,l),c=h}return u}}function rw(t){if(t%ha===tw){const e=(t+Oe)/ha;return function(s,r){const i=s.pow(r,e);if(!s.eql(s.sqr(i),r))throw new Error("Cannot find square root");return i}}if(t%tl===el){const e=(t-el)/tl;return function(s,r){const i=s.mul(r,js),n=s.pow(i,e),o=s.mul(r,n),a=s.mul(s.mul(o,js),n),c=s.mul(o,s.sub(a,s.ONE));if(!s.eql(s.sqr(c),r))throw new Error("Cannot find square root");return c}}return sw(t)}const iw=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function nw(t){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},s=iw.reduce((r,i)=>(r[i]="function",r),e);return si(t,s)}function ow(t,e,s){if(s<We)throw new Error("invalid exponent, negatives unsupported");if(s===We)return t.ONE;if(s===Oe)return e;let r=t.ONE,i=e;for(;s>We;)s&Oe&&(r=t.mul(r,i)),i=t.sqr(i),s>>=Oe;return r}function aw(t,e){const s=new Array(e.length),r=e.reduce((n,o,a)=>t.is0(o)?n:(s[a]=n,t.mul(n,o)),t.ONE),i=t.inv(r);return e.reduceRight((n,o,a)=>t.is0(o)?n:(s[a]=t.mul(n,s[a]),t.mul(n,o)),i),s}function bd(t,e){const s=e!==void 0?e:t.toString(2).length,r=Math.ceil(s/8);return{nBitLength:s,nByteLength:r}}function vd(t,e,s=!1,r={}){if(t<=We)throw new Error("invalid field: expected ORDER > 0, got "+t);const{nBitLength:i,nByteLength:n}=bd(t,e);if(n>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const a=Object.freeze({ORDER:t,isLE:s,BITS:i,BYTES:n,MASK:Va(i),ZERO:We,ONE:Oe,create:c=>lt(c,t),isValid:c=>{if(typeof c!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof c);return We<=c&&c<t},is0:c=>c===We,isOdd:c=>(c&Oe)===Oe,neg:c=>lt(-c,t),eql:(c,l)=>c===l,sqr:c=>lt(c*c,t),add:(c,l)=>lt(c+l,t),sub:(c,l)=>lt(c-l,t),mul:(c,l)=>lt(c*l,t),pow:(c,l)=>ow(a,c,l),div:(c,l)=>lt(c*pa(l,t),t),sqrN:c=>c*c,addN:(c,l)=>c+l,subN:(c,l)=>c-l,mulN:(c,l)=>c*l,inv:c=>pa(c,t),sqrt:r.sqrt||(c=>(o||(o=rw(t)),o(a,c))),invertBatch:c=>aw(a,c),cmov:(c,l,u)=>u?l:c,toBytes:c=>s?co(c,n):Fr(c,n),fromBytes:c=>{if(c.length!==n)throw new Error("Field.fromBytes: expected "+n+" bytes, got "+c.length);return s?Ui(c):Vs(c)}});return Object.freeze(a)}function Ed(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 Cd(t){const e=Ed(t);return e+Math.ceil(e/2)}function cw(t,e,s=!1){const r=t.length,i=Ed(e),n=Cd(e);if(r<16||r<n||r>1024)throw new Error("expected "+n+"-1024 bytes of input, got "+r);const o=s?Ui(t):Vs(t),a=lt(o,e-Oe)+Oe;return s?co(a,i):Fr(a,i)}const sl=BigInt(0),Nn=BigInt(1);function Po(t,e){const s=e.negate();return t?s:e}function Id(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function Oo(t,e){Id(t,e);const s=Math.ceil(e/t)+1,r=2**(t-1);return{windows:s,windowSize:r}}function lw(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach((s,r)=>{if(!(s instanceof e))throw new Error("invalid point at index "+r)})}function uw(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach((s,r)=>{if(!e.isValid(s))throw new Error("invalid scalar at index "+r)})}const ko=new WeakMap,Ad=new WeakMap;function To(t){return Ad.get(t)||1}function dw(t,e){return{constTimeNegate:Po,hasPrecomputes(s){return To(s)!==1},unsafeLadder(s,r,i=t.ZERO){let n=s;for(;r>sl;)r&Nn&&(i=i.add(n)),n=n.double(),r>>=Nn;return i},precomputeWindow(s,r){const{windows:i,windowSize:n}=Oo(r,e),o=[];let a=s,c=a;for(let l=0;l<i;l++){c=a,o.push(c);for(let u=1;u<n;u++)c=c.add(a),o.push(c);a=c.double()}return o},wNAF(s,r,i){const{windows:n,windowSize:o}=Oo(s,e);let a=t.ZERO,c=t.BASE;const l=BigInt(2**s-1),u=2**s,d=BigInt(s);for(let h=0;h<n;h++){const f=h*o;let w=Number(i&l);i>>=d,w>o&&(w-=u,i+=Nn);const m=f,g=f+Math.abs(w)-1,y=h%2!==0,b=w<0;w===0?c=c.add(Po(y,r[m])):a=a.add(Po(b,r[g]))}return{p:a,f:c}},wNAFUnsafe(s,r,i,n=t.ZERO){const{windows:o,windowSize:a}=Oo(s,e),c=BigInt(2**s-1),l=2**s,u=BigInt(s);for(let d=0;d<o;d++){const h=d*a;if(i===sl)break;let f=Number(i&c);if(i>>=u,f>a&&(f-=l,i+=Nn),f===0)continue;let w=r[h+Math.abs(f)-1];f<0&&(w=w.negate()),n=n.add(w)}return n},getPrecomputes(s,r,i){let n=ko.get(r);return n||(n=this.precomputeWindow(r,s),s!==1&&ko.set(r,i(n))),n},wNAFCached(s,r,i){const n=To(s);return this.wNAF(n,this.getPrecomputes(n,s,i),r)},wNAFCachedUnsafe(s,r,i,n){const o=To(s);return o===1?this.unsafeLadder(s,r,n):this.wNAFUnsafe(o,this.getPrecomputes(o,s,i),r,n)},setWindowSize(s,r){Id(r,e),Ad.set(s,r),ko.delete(s)}}}function hw(t,e,s,r){if(lw(s,t),uw(r,e),s.length!==r.length)throw new Error("arrays of points and scalars must have equal length");const i=t.ZERO,n=md(BigInt(s.length)),o=n>12?n-3:n>4?n-2:n?2:1,a=(1<<o)-1,c=new Array(a+1).fill(i),l=Math.floor((e.BITS-1)/o)*o;let u=i;for(let d=l;d>=0;d-=o){c.fill(i);for(let f=0;f<r.length;f++){const w=r[f],m=Number(w>>BigInt(d)&BigInt(a));c[m]=c[m].add(s[f])}let h=i;for(let f=c.length-1,w=i;f>0;f--)w=w.add(c[f]),h=h.add(w);if(u=u.add(h),d!==0)for(let f=0;f<o;f++)u=u.double()}return u}function Nd(t){return nw(t.Fp),si(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...bd(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}BigInt(0),BigInt(1),BigInt(2),BigInt(8);const dr=BigInt(0),xo=BigInt(1);function pw(t){return si(t,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...t})}function fw(t){const e=pw(t),{P:s}=e,r=b=>lt(b,s),i=e.montgomeryBits,n=Math.ceil(i/8),o=e.nByteLength,a=e.adjustScalarBytes||(b=>b),c=e.powPminus2||(b=>yd(b,s-BigInt(2),s));function l(b,E,_){const O=r(b*(E-_));return E=r(E-O),_=r(_+O),[E,_]}const u=(e.a-BigInt(2))/BigInt(4);function d(b,E){as("u",b,dr,s),as("scalar",E,dr,s);const _=E,O=b;let A=xo,I=dr,U=b,v=xo,$=dr,C;for(let W=BigInt(i-1);W>=dr;W--){const N=_>>W&xo;$^=N,C=l($,A,U),A=C[0],U=C[1],C=l($,I,v),I=C[0],v=C[1],$=N;const T=A+I,P=r(T*T),j=A-I,q=r(j*j),x=P-q,G=U+v,Q=U-v,se=r(Q*T),Ee=r(G*j),he=se+Ee,ke=se-Ee;U=r(he*he),v=r(O*r(ke*ke)),A=r(P*q),I=r(x*(P+r(u*x)))}C=l($,A,U),A=C[0],U=C[1],C=l($,I,v),I=C[0],v=C[1];const R=c(I);return r(A*R)}function h(b){return co(r(b),n)}function f(b){const E=mt("u coordinate",b,n);return o===32&&(E[31]&=127),Ui(E)}function w(b){const E=mt("scalar",b),_=E.length;if(_!==n&&_!==o){let O=""+n+" or "+o;throw new Error("invalid scalar, expected "+O+" bytes, got "+_)}return Ui(a(E))}function m(b,E){const _=f(E),O=w(b),A=d(_,O);if(A===dr)throw new Error("invalid private or public key received");return h(A)}const g=h(e.Gu);function y(b){return m(b,g)}return{scalarMult:m,scalarMultBase:y,getSharedSecret:(b,E)=>m(b,E),getPublicKey:b=>y(b),utils:{randomPrivateKey:()=>e.randomBytes(e.nByteLength)},GuBytes:g}}const fa=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949");BigInt(0);const gw=BigInt(1),rl=BigInt(2),mw=BigInt(3),ww=BigInt(5);BigInt(8);function yw(t){const e=BigInt(10),s=BigInt(20),r=BigInt(40),i=BigInt(80),n=fa,o=t*t%n*t%n,a=Ut(o,rl,n)*o%n,c=Ut(a,gw,n)*t%n,l=Ut(c,ww,n)*c%n,u=Ut(l,e,n)*l%n,d=Ut(u,s,n)*u%n,h=Ut(d,r,n)*d%n,f=Ut(h,i,n)*h%n,w=Ut(f,i,n)*h%n,m=Ut(w,e,n)*l%n;return{pow_p_5_8:Ut(m,rl,n)*t%n,b2:o}}function bw(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}const ga=fw({P:fa,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:t=>{const e=fa,{pow_p_5_8:s,b2:r}=yw(t);return lt(Ut(s,mw,e)*r,e)},adjustScalarBytes:bw,randomBytes:ti});function il(t){t.lowS!==void 0&&Br("lowS",t.lowS),t.prehash!==void 0&&Br("prehash",t.prehash)}function vw(t){const e=Nd(t);si(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:s,Fp:r,a:i}=e;if(s){if(!r.eql(i,r.ZERO))throw new Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if(typeof s!="object"||typeof s.beta!="bigint"||typeof s.splitScalar!="function")throw new Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...e})}const{bytesToNumberBE:Ew,hexToBytes:Cw}=ew;class Iw extends Error{constructor(e=""){super(e)}}const ns={Err:Iw,_tlv:{encode:(t,e)=>{const{Err:s}=ns;if(t<0||t>256)throw new s("tlv.encode: wrong tag");if(e.length&1)throw new s("tlv.encode: unpadded data");const r=e.length/2,i=kr(r);if(i.length/2&128)throw new s("tlv.encode: long form length too big");const n=r>127?kr(i.length/2|128):"";return kr(t)+n+i+e},decode(t,e){const{Err:s}=ns;let r=0;if(t<0||t>256)throw new s("tlv.encode: wrong tag");if(e.length<2||e[r++]!==t)throw new s("tlv.decode: wrong tlv");const i=e[r++],n=!!(i&128);let o=0;if(!n)o=i;else{const c=i&127;if(!c)throw new s("tlv.decode(long): indefinite length not supported");if(c>4)throw new s("tlv.decode(long): byte length is too big");const l=e.subarray(r,r+c);if(l.length!==c)throw new s("tlv.decode: length bytes not complete");if(l[0]===0)throw new s("tlv.decode(long): zero leftmost byte");for(const u of l)o=o<<8|u;if(r+=c,o<128)throw new s("tlv.decode(long): not minimal encoding")}const a=e.subarray(r,r+o);if(a.length!==o)throw new s("tlv.decode: wrong value length");return{v:a,l:e.subarray(r+o)}}},_int:{encode(t){const{Err:e}=ns;if(t<os)throw new e("integer: negative integers are not allowed");let s=kr(t);if(Number.parseInt(s[0],16)&8&&(s="00"+s),s.length&1)throw new e("unexpected DER parsing assertion: unpadded hex");return s},decode(t){const{Err:e}=ns;if(t[0]&128)throw new e("invalid signature integer: negative");if(t[0]===0&&!(t[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return Ew(t)}},toSig(t){const{Err:e,_int:s,_tlv:r}=ns,i=typeof t=="string"?Cw(t):t;fn(i);const{v:n,l:o}=r.decode(48,i);if(o.length)throw new e("invalid signature: left bytes after parsing");const{v:a,l:c}=r.decode(2,n),{v:l,l:u}=r.decode(2,c);if(u.length)throw new e("invalid signature: left bytes after parsing");return{r:s.decode(a),s:s.decode(l)}},hexFromSig(t){const{_tlv:e,_int:s}=ns,r=e.encode(2,s.encode(t.r)),i=e.encode(2,s.encode(t.s)),n=r+i;return e.encode(48,n)}},os=BigInt(0),Be=BigInt(1);BigInt(2);const nl=BigInt(3);BigInt(4);function Aw(t){const e=vw(t),{Fp:s}=e,r=vd(e.n,e.nBitLength),i=e.toBytes||((m,g,y)=>{const b=g.toAffine();return Di(Uint8Array.from([4]),s.toBytes(b.x),s.toBytes(b.y))}),n=e.fromBytes||(m=>{const g=m.subarray(1),y=s.fromBytes(g.subarray(0,s.BYTES)),b=s.fromBytes(g.subarray(s.BYTES,2*s.BYTES));return{x:y,y:b}});function o(m){const{a:g,b:y}=e,b=s.sqr(m),E=s.mul(b,m);return s.add(s.add(E,s.mul(m,g)),y)}if(!s.eql(s.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function a(m){return lo(m,Be,e.n)}function c(m){const{allowedPrivateKeyLengths:g,nByteLength:y,wrapPrivateKey:b,n:E}=e;if(g&&typeof m!="bigint"){if(Zs(m)&&(m=qr(m)),typeof m!="string"||!g.includes(m.length))throw new Error("invalid private key");m=m.padStart(y*2,"0")}let _;try{_=typeof m=="bigint"?m:Vs(mt("private key",m,y))}catch{throw new Error("invalid private key, expected hex or "+y+" bytes, got "+typeof m)}return b&&(_=lt(_,E)),as("private key",_,Be,E),_}function l(m){if(!(m instanceof h))throw new Error("ProjectivePoint expected")}const u=da((m,g)=>{const{px:y,py:b,pz:E}=m;if(s.eql(E,s.ONE))return{x:y,y:b};const _=m.is0();g==null&&(g=_?s.ONE:s.inv(E));const O=s.mul(y,g),A=s.mul(b,g),I=s.mul(E,g);if(_)return{x:s.ZERO,y:s.ZERO};if(!s.eql(I,s.ONE))throw new Error("invZ was invalid");return{x:O,y:A}}),d=da(m=>{if(m.is0()){if(e.allowInfinityPoint&&!s.is0(m.py))return;throw new Error("bad point: ZERO")}const{x:g,y}=m.toAffine();if(!s.isValid(g)||!s.isValid(y))throw new Error("bad point: x or y not FE");const b=s.sqr(y),E=o(g);if(!s.eql(b,E))throw new Error("bad point: equation left != right");if(!m.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class h{constructor(g,y,b){if(this.px=g,this.py=y,this.pz=b,g==null||!s.isValid(g))throw new Error("x required");if(y==null||!s.isValid(y))throw new Error("y required");if(b==null||!s.isValid(b))throw new Error("z required");Object.freeze(this)}static fromAffine(g){const{x:y,y:b}=g||{};if(!g||!s.isValid(y)||!s.isValid(b))throw new Error("invalid affine point");if(g instanceof h)throw new Error("projective point not allowed");const E=_=>s.eql(_,s.ZERO);return E(y)&&E(b)?h.ZERO:new h(y,b,s.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(g){const y=s.invertBatch(g.map(b=>b.pz));return g.map((b,E)=>b.toAffine(y[E])).map(h.fromAffine)}static fromHex(g){const y=h.fromAffine(n(mt("pointHex",g)));return y.assertValidity(),y}static fromPrivateKey(g){return h.BASE.multiply(c(g))}static msm(g,y){return hw(h,r,g,y)}_setWindowSize(g){w.setWindowSize(this,g)}assertValidity(){d(this)}hasEvenY(){const{y:g}=this.toAffine();if(s.isOdd)return!s.isOdd(g);throw new Error("Field doesn't support isOdd")}equals(g){l(g);const{px:y,py:b,pz:E}=this,{px:_,py:O,pz:A}=g,I=s.eql(s.mul(y,A),s.mul(_,E)),U=s.eql(s.mul(b,A),s.mul(O,E));return I&&U}negate(){return new h(this.px,s.neg(this.py),this.pz)}double(){const{a:g,b:y}=e,b=s.mul(y,nl),{px:E,py:_,pz:O}=this;let A=s.ZERO,I=s.ZERO,U=s.ZERO,v=s.mul(E,E),$=s.mul(_,_),C=s.mul(O,O),R=s.mul(E,_);return R=s.add(R,R),U=s.mul(E,O),U=s.add(U,U),A=s.mul(g,U),I=s.mul(b,C),I=s.add(A,I),A=s.sub($,I),I=s.add($,I),I=s.mul(A,I),A=s.mul(R,A),U=s.mul(b,U),C=s.mul(g,C),R=s.sub(v,C),R=s.mul(g,R),R=s.add(R,U),U=s.add(v,v),v=s.add(U,v),v=s.add(v,C),v=s.mul(v,R),I=s.add(I,v),C=s.mul(_,O),C=s.add(C,C),v=s.mul(C,R),A=s.sub(A,v),U=s.mul(C,$),U=s.add(U,U),U=s.add(U,U),new h(A,I,U)}add(g){l(g);const{px:y,py:b,pz:E}=this,{px:_,py:O,pz:A}=g;let I=s.ZERO,U=s.ZERO,v=s.ZERO;const $=e.a,C=s.mul(e.b,nl);let R=s.mul(y,_),W=s.mul(b,O),N=s.mul(E,A),T=s.add(y,b),P=s.add(_,O);T=s.mul(T,P),P=s.add(R,W),T=s.sub(T,P),P=s.add(y,E);let j=s.add(_,A);return P=s.mul(P,j),j=s.add(R,N),P=s.sub(P,j),j=s.add(b,E),I=s.add(O,A),j=s.mul(j,I),I=s.add(W,N),j=s.sub(j,I),v=s.mul($,P),I=s.mul(C,N),v=s.add(I,v),I=s.sub(W,v),v=s.add(W,v),U=s.mul(I,v),W=s.add(R,R),W=s.add(W,R),N=s.mul($,N),P=s.mul(C,P),W=s.add(W,N),N=s.sub(R,N),N=s.mul($,N),P=s.add(P,N),R=s.mul(W,P),U=s.add(U,R),R=s.mul(j,P),I=s.mul(T,I),I=s.sub(I,R),R=s.mul(T,W),v=s.mul(j,v),v=s.add(v,R),new h(I,U,v)}subtract(g){return this.add(g.negate())}is0(){return this.equals(h.ZERO)}wNAF(g){return w.wNAFCached(this,g,h.normalizeZ)}multiplyUnsafe(g){const{endo:y,n:b}=e;as("scalar",g,os,b);const E=h.ZERO;if(g===os)return E;if(this.is0()||g===Be)return this;if(!y||w.hasPrecomputes(this))return w.wNAFCachedUnsafe(this,g,h.normalizeZ);let{k1neg:_,k1:O,k2neg:A,k2:I}=y.splitScalar(g),U=E,v=E,$=this;for(;O>os||I>os;)O&Be&&(U=U.add($)),I&Be&&(v=v.add($)),$=$.double(),O>>=Be,I>>=Be;return _&&(U=U.negate()),A&&(v=v.negate()),v=new h(s.mul(v.px,y.beta),v.py,v.pz),U.add(v)}multiply(g){const{endo:y,n:b}=e;as("scalar",g,Be,b);let E,_;if(y){const{k1neg:O,k1:A,k2neg:I,k2:U}=y.splitScalar(g);let{p:v,f:$}=this.wNAF(A),{p:C,f:R}=this.wNAF(U);v=w.constTimeNegate(O,v),C=w.constTimeNegate(I,C),C=new h(s.mul(C.px,y.beta),C.py,C.pz),E=v.add(C),_=$.add(R)}else{const{p:O,f:A}=this.wNAF(g);E=O,_=A}return h.normalizeZ([E,_])[0]}multiplyAndAddUnsafe(g,y,b){const E=h.BASE,_=(A,I)=>I===os||I===Be||!A.equals(E)?A.multiplyUnsafe(I):A.multiply(I),O=_(this,y).add(_(g,b));return O.is0()?void 0:O}toAffine(g){return u(this,g)}isTorsionFree(){const{h:g,isTorsionFree:y}=e;if(g===Be)return!0;if(y)return y(h,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:g,clearCofactor:y}=e;return g===Be?this:y?y(h,this):this.multiplyUnsafe(e.h)}toRawBytes(g=!0){return Br("isCompressed",g),this.assertValidity(),i(h,this,g)}toHex(g=!0){return Br("isCompressed",g),qr(this.toRawBytes(g))}}h.BASE=new h(e.Gx,e.Gy,s.ONE),h.ZERO=new h(s.ZERO,s.ONE,s.ZERO);const f=e.nBitLength,w=dw(h,e.endo?Math.ceil(f/2):f);return{CURVE:e,ProjectivePoint:h,normPrivateKeyToScalar:c,weierstrassEquation:o,isWithinCurveOrder:a}}function Nw(t){const e=Nd(t);return si(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function _w(t){const e=Nw(t),{Fp:s,n:r}=e,i=s.BYTES+1,n=2*s.BYTES+1;function o(N){return lt(N,r)}function a(N){return pa(N,r)}const{ProjectivePoint:c,normPrivateKeyToScalar:l,weierstrassEquation:u,isWithinCurveOrder:d}=Aw({...e,toBytes(N,T,P){const j=T.toAffine(),q=s.toBytes(j.x),x=Di;return Br("isCompressed",P),P?x(Uint8Array.from([T.hasEvenY()?2:3]),q):x(Uint8Array.from([4]),q,s.toBytes(j.y))},fromBytes(N){const T=N.length,P=N[0],j=N.subarray(1);if(T===i&&(P===2||P===3)){const q=Vs(j);if(!lo(q,Be,s.ORDER))throw new Error("Point is not on curve");const x=u(q);let G;try{G=s.sqrt(x)}catch(se){const Ee=se instanceof Error?": "+se.message:"";throw new Error("Point is not on curve"+Ee)}const Q=(G&Be)===Be;return(P&1)===1!==Q&&(G=s.neg(G)),{x:q,y:G}}else if(T===n&&P===4){const q=s.fromBytes(j.subarray(0,s.BYTES)),x=s.fromBytes(j.subarray(s.BYTES,2*s.BYTES));return{x:q,y:x}}else{const q=i,x=n;throw new Error("invalid Point, expected length of "+q+", or uncompressed "+x+", got "+T)}}}),h=N=>qr(Fr(N,e.nByteLength));function f(N){const T=r>>Be;return N>T}function w(N){return f(N)?o(-N):N}const m=(N,T,P)=>Vs(N.slice(T,P));class g{constructor(T,P,j){this.r=T,this.s=P,this.recovery=j,this.assertValidity()}static fromCompact(T){const P=e.nByteLength;return T=mt("compactSignature",T,P*2),new g(m(T,0,P),m(T,P,2*P))}static fromDER(T){const{r:P,s:j}=ns.toSig(mt("DER",T));return new g(P,j)}assertValidity(){as("r",this.r,Be,r),as("s",this.s,Be,r)}addRecoveryBit(T){return new g(this.r,this.s,T)}recoverPublicKey(T){const{r:P,s:j,recovery:q}=this,x=A(mt("msgHash",T));if(q==null||![0,1,2,3].includes(q))throw new Error("recovery id invalid");const G=q===2||q===3?P+e.n:P;if(G>=s.ORDER)throw new Error("recovery id 2 or 3 invalid");const Q=(q&1)===0?"02":"03",se=c.fromHex(Q+h(G)),Ee=a(G),he=o(-x*Ee),ke=o(j*Ee),Le=c.BASE.multiplyAndAddUnsafe(se,he,ke);if(!Le)throw new Error("point at infinify");return Le.assertValidity(),Le}hasHighS(){return f(this.s)}normalizeS(){return this.hasHighS()?new g(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return zr(this.toDERHex())}toDERHex(){return ns.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return zr(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const y={isValidPrivateKey(N){try{return l(N),!0}catch{return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{const N=Cd(e.n);return cw(e.randomBytes(N),e.n)},precompute(N=8,T=c.BASE){return T._setWindowSize(N),T.multiply(BigInt(3)),T}};function b(N,T=!0){return c.fromPrivateKey(N).toRawBytes(T)}function E(N){const T=Zs(N),P=typeof N=="string",j=(T||P)&&N.length;return T?j===i||j===n:P?j===2*i||j===2*n:N instanceof c}function _(N,T,P=!0){if(E(N))throw new Error("first arg must be private key");if(!E(T))throw new Error("second arg must be public key");return c.fromHex(T).multiply(l(N)).toRawBytes(P)}const O=e.bits2int||function(N){if(N.length>8192)throw new Error("input is too large");const T=Vs(N),P=N.length*8-e.nBitLength;return P>0?T>>BigInt(P):T},A=e.bits2int_modN||function(N){return o(O(N))},I=Va(e.nBitLength);function U(N){return as("num < 2^"+e.nBitLength,N,os,I),Fr(N,e.nByteLength)}function v(N,T,P=$){if(["recovered","canonical"].some($e=>$e in P))throw new Error("sign() legacy options not supported");const{hash:j,randomBytes:q}=e;let{lowS:x,prehash:G,extraEntropy:Q}=P;x==null&&(x=!0),N=mt("msgHash",N),il(P),G&&(N=mt("prehashed msgHash",j(N)));const se=A(N),Ee=l(T),he=[U(Ee),U(se)];if(Q!=null&&Q!==!1){const $e=Q===!0?q(s.BYTES):Q;he.push(mt("extraEntropy",$e))}const ke=Di(...he),Le=se;function Ye($e){const Re=O($e);if(!d(Re))return;const Ts=a(Re),Xt=c.BASE.multiply(Re).toAffine(),Bt=o(Xt.x);if(Bt===os)return;const Zt=o(Ts*o(Le+Bt*Ee));if(Zt===os)return;let ar=(Xt.x===Bt?0:2)|Number(Xt.y&Be),vn=Zt;return x&&f(Zt)&&(vn=w(Zt),ar^=1),new g(Bt,vn,ar)}return{seed:ke,k2sig:Ye}}const $={lowS:e.lowS,prehash:!1},C={lowS:e.lowS,prehash:!1};function R(N,T,P=$){const{seed:j,k2sig:q}=v(N,T,P),x=e;return wd(x.hash.outputLen,x.nByteLength,x.hmac)(j,q)}c.BASE._setWindowSize(8);function W(N,T,P,j=C){const q=N;T=mt("msgHash",T),P=mt("publicKey",P);const{lowS:x,prehash:G,format:Q}=j;if(il(j),"strict"in j)throw new Error("options.strict was renamed to lowS");if(Q!==void 0&&Q!=="compact"&&Q!=="der")throw new Error("format must be compact or der");const se=typeof q=="string"||Zs(q),Ee=!se&&!Q&&typeof q=="object"&&q!==null&&typeof q.r=="bigint"&&typeof q.s=="bigint";if(!se&&!Ee)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let he,ke;try{if(Ee&&(he=new g(q.r,q.s)),se){try{Q!=="compact"&&(he=g.fromDER(q))}catch(Zt){if(!(Zt instanceof ns.Err))throw Zt}!he&&Q!=="der"&&(he=g.fromCompact(q))}ke=c.fromHex(P)}catch{return!1}if(!he||x&&he.hasHighS())return!1;G&&(T=e.hash(T));const{r:Le,s:Ye}=he,$e=A(T),Re=a(Ye),Ts=o($e*Re),Xt=o(Le*Re),Bt=c.BASE.multiplyAndAddUnsafe(ke,Ts,Xt)?.toAffine();return Bt?o(Bt.x)===Le:!1}return{CURVE:e,getPublicKey:b,getSharedSecret:_,sign:R,verify:W,ProjectivePoint:c,Signature:g,utils:y}}function Sw(t){return{hash:t,hmac:(e,...s)=>no(t,e,Tg(...s)),randomBytes:ti}}function Pw(t,e){const s=r=>_w({...t,...Sw(r)});return{...s(e),create:s}}const _d=vd(BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff")),Ow=_d.create(BigInt("-3")),kw=BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Tw=Pw({a:Ow,b:kw,Fp:_d,n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5"),h:BigInt(1),lowS:!1},pn),Sd="base10",tt="base16",Mt="base64pad",vs="base64url",gn="utf8",Pd=0,cs=1,mn=2,xw=0,ol=1,Ni=12,Ka=32;function $w(){const t=ga.utils.randomPrivateKey(),e=ga.getPublicKey(t);return{privateKey:ut(t,tt),publicKey:ut(e,tt)}}function ma(){const t=ti(Ka);return ut(t,tt)}function Rw(t,e){const s=ga.getSharedSecret(Ot(t,tt),Ot(e,tt)),r=Mm(pn,s,void 0,void 0,Ka);return ut(r,tt)}function jn(t){const e=pn(Ot(t,tt));return ut(e,tt)}function Kt(t){const e=pn(Ot(t,gn));return ut(e,tt)}function Od(t){return Ot(`${t}`,Sd)}function Qs(t){return Number(ut(t,Sd))}function kd(t){return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Td(t){const e=t.replace(/-/g,"+").replace(/_/g,"/"),s=(4-e.length%4)%4;return e+"=".repeat(s)}function Uw(t){const e=Od(typeof t.type<"u"?t.type:Pd);if(Qs(e)===cs&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const s=typeof t.senderPublicKey<"u"?Ot(t.senderPublicKey,tt):void 0,r=typeof t.iv<"u"?Ot(t.iv,tt):ti(Ni),i=Ot(t.symKey,tt),n=fd(i,r).encrypt(Ot(t.message,gn)),o=xd({type:e,sealed:n,iv:r,senderPublicKey:s});return t.encoding===vs?kd(o):o}function Dw(t){const e=Ot(t.symKey,tt),{sealed:s,iv:r}=Li({encoded:t.encoded,encoding:t.encoding}),i=fd(e,r).decrypt(s);if(i===null)throw new Error("Failed to decrypt");return ut(i,gn)}function Lw(t,e){const s=Od(mn),r=ti(Ni),i=Ot(t,gn),n=xd({type:s,sealed:i,iv:r});return e===vs?kd(n):n}function Mw(t,e){const{sealed:s}=Li({encoded:t,encoding:e});return ut(s,gn)}function xd(t){if(Qs(t.type)===mn)return ut(vi([t.type,t.sealed]),Mt);if(Qs(t.type)===cs){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return ut(vi([t.type,t.senderPublicKey,t.iv,t.sealed]),Mt)}return ut(vi([t.type,t.iv,t.sealed]),Mt)}function Li(t){const e=(t.encoding||Mt)===vs?Td(t.encoded):t.encoded,s=Ot(e,Mt),r=s.slice(xw,ol),i=ol;if(Qs(r)===cs){const c=i+Ka,l=c+Ni,u=s.slice(i,c),d=s.slice(c,l),h=s.slice(l);return{type:r,sealed:h,iv:d,senderPublicKey:u}}if(Qs(r)===mn){const c=s.slice(i),l=ti(Ni);return{type:r,sealed:c,iv:l}}const n=i+Ni,o=s.slice(i,n),a=s.slice(n);return{type:r,sealed:a,iv:o}}function jw(t,e){const s=Li({encoded:t,encoding:e?.encoding});return $d({type:Qs(s.type),senderPublicKey:typeof s.senderPublicKey<"u"?ut(s.senderPublicKey,tt):void 0,receiverPublicKey:e?.receiverPublicKey})}function $d(t){const e=t?.type||Pd;if(e===cs){if(typeof t?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof t?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t?.senderPublicKey,receiverPublicKey:t?.receiverPublicKey}}function al(t){return t.type===cs&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}function cl(t){return t.type===mn}function Bw(t){const e=Buffer.from(t.x,"base64"),s=Buffer.from(t.y,"base64");return vi([new Uint8Array([4]),e,s])}function qw(t,e){const[s,r,i]=t.split("."),n=Buffer.from(Td(i),"base64");if(n.length!==64)throw new Error("Invalid signature length");const o=n.slice(0,32),a=n.slice(32,64),c=`${s}.${r}`,l=pn(c),u=Bw(e);if(!Tw.verify(vi([o,a]),l,u))throw new Error("Invalid signature");return Xo(t).payload}const zw="irn";function Yn(t){return t?.relay||{protocol:zw}}function wi(t){const e=Rh[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}function Fw(t,e="-"){const s={},r="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(r)){const n=i.replace(r,""),o=t[i];s[n]=o}}),s}function ll(t){if(!t.includes("wc:")){const l=td(t);l!=null&&l.includes("wc:")&&(t=l)}t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;const e=t.indexOf(":"),s=t.indexOf("?")!==-1?t.indexOf("?"):void 0,r=t.substring(0,e),i=t.substring(e+1,s).split("@"),n=typeof s<"u"?t.substring(s):"",o=new URLSearchParams(n),a={};o.forEach((l,u)=>{a[u]=l});const c=typeof a.methods=="string"?a.methods.split(","):void 0;return{protocol:r,topic:Ww(i[0]),version:parseInt(i[1],10),symKey:a.symKey,relay:Fw(a),methods:c,expiryTimestamp:a.expiryTimestamp?parseInt(a.expiryTimestamp,10):void 0}}function Ww(t){return t.startsWith("//")?t.substring(2):t}function Hw(t,e="-"){const s="relay",r={};return Object.keys(t).forEach(i=>{const n=i,o=s+e+n;t[n]&&(r[o]=t[n])}),r}function ul(t){const e=new URLSearchParams,s=Hw(t.relay);Object.keys(s).sort().forEach(i=>{e.set(i,s[i])}),e.set("symKey",t.symKey),t.expiryTimestamp&&e.set("expiryTimestamp",t.expiryTimestamp.toString()),t.methods&&e.set("methods",t.methods.join(","));const r=e.toString();return`${t.protocol}:${t.topic}@${t.version}?${r}`}function _n(t,e,s){return`${t}?wc_ev=${s}&topic=${e}`}var Vw=Object.defineProperty,Kw=Object.defineProperties,Gw=Object.getOwnPropertyDescriptors,dl=Object.getOwnPropertySymbols,Jw=Object.prototype.hasOwnProperty,Yw=Object.prototype.propertyIsEnumerable,hl=(t,e,s)=>e in t?Vw(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,Xw=(t,e)=>{for(var s in e||(e={}))Jw.call(e,s)&&hl(t,s,e[s]);if(dl)for(var s of dl(e))Yw.call(e,s)&&hl(t,s,e[s]);return t},Zw=(t,e)=>Kw(t,Gw(e));function ri(t){const e=[];return t.forEach(s=>{const[r,i]=s.split(":");e.push(`${r}:${i}`)}),e}function Qw(t){const e=[];return Object.values(t).forEach(s=>{e.push(...ri(s.accounts))}),e}function ey(t,e){const s=[];return Object.values(t).forEach(r=>{ri(r.accounts).includes(e)&&s.push(...r.methods)}),s}function ty(t,e){const s=[];return Object.values(t).forEach(r=>{ri(r.accounts).includes(e)&&s.push(...r.events)}),s}function uo(t){return t.includes(":")}function Tr(t){return uo(t)?t.split(":")[0]:t}function pl(t){var e,s,r;const i={};if(!Ss(t))return i;for(const[n,o]of Object.entries(t)){const a=uo(n)?[n]:o.chains,c=o.methods||[],l=o.events||[],u=Tr(n);i[u]=Zw(Xw({},i[u]),{chains:Jt(a,(e=i[u])==null?void 0:e.chains),methods:Jt(c,(s=i[u])==null?void 0:s.methods),events:Jt(l,(r=i[u])==null?void 0:r.events)})}return i}function sy(t){const e={};return t?.forEach(s=>{var r;const[i,n]=s.split(":");e[i]||(e[i]={accounts:[],chains:[],events:[],methods:[]}),e[i].accounts.push(s),(r=e[i].chains)==null||r.push(`${i}:${n}`)}),e}function fl(t,e){e=e.map(r=>r.replace("did:pkh:",""));const s=sy(e);for(const[r,i]of Object.entries(s))i.methods?i.methods=Jt(i.methods,t):i.methods=t,i.events=["chainChanged","accountsChanged"];return s}function ry(t,e){var s,r,i,n,o,a;const c=pl(t),l=pl(e),u={},d=Object.keys(c).concat(Object.keys(l));for(const h of d)u[h]={chains:Jt((s=c[h])==null?void 0:s.chains,(r=l[h])==null?void 0:r.chains),methods:Jt((i=c[h])==null?void 0:i.methods,(n=l[h])==null?void 0:n.methods),events:Jt((o=c[h])==null?void 0:o.events,(a=l[h])==null?void 0:a.events)};return u}const iy={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}},ny={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 D(t,e){const{message:s,code:r}=ny[t];return{message:e?`${s} ${e}`:s,code:r}}function we(t,e){const{message:s,code:r}=iy[t];return{message:e?`${s} ${e}`:s,code:r}}function _s(t,e){return!!Array.isArray(t)}function Ss(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function Ge(t){return typeof t>"u"}function xe(t,e){return e&&Ge(t)?!0:typeof t=="string"&&!!t.trim().length}function Ga(t,e){return e&&Ge(t)?!0:typeof t=="number"&&!isNaN(t)}function oy(t,e){const{requiredNamespaces:s}=e,r=Object.keys(t.namespaces),i=Object.keys(s);let n=!0;return Fs(i,r)?(r.forEach(o=>{const{accounts:a,methods:c,events:l}=t.namespaces[o],u=ri(a),d=s[o];(!Fs(Yu(o,d),u)||!Fs(d.methods,c)||!Fs(d.events,l))&&(n=!1)}),n):!1}function Xn(t){return xe(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function ay(t){if(xe(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const s=e[0]+":"+e[1];return!!e[2]&&Xn(s)}}return!1}function cy(t){function e(s){try{return typeof new URL(s)<"u"}catch{return!1}}try{if(xe(t,!1)){if(e(t))return!0;const s=td(t);return e(s)}}catch{}return!1}function ly(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function uy(t){return t?.topic}function dy(t,e){let s=null;return xe(t?.publicKey,!1)||(s=D("MISSING_OR_INVALID",`${e} controller public key should be a string`)),s}function gl(t){let e=!0;return _s(t)?t.length&&(e=t.every(s=>xe(s,!1))):e=!1,e}function hy(t,e,s){let r=null;return _s(e)&&e.length?e.forEach(i=>{r||Xn(i)||(r=we("UNSUPPORTED_CHAINS",`${s}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):Xn(t)||(r=we("UNSUPPORTED_CHAINS",`${s}, 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"] }`)),r}function py(t,e,s){let r=null;return Object.entries(t).forEach(([i,n])=>{if(r)return;const o=hy(i,Yu(i,n),`${e} ${s}`);o&&(r=o)}),r}function fy(t,e){let s=null;return _s(t)?t.forEach(r=>{s||ay(r)||(s=we("UNSUPPORTED_ACCOUNTS",`${e}, account ${r} should be a string and conform to "namespace:chainId:address" format`))}):s=we("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),s}function gy(t,e){let s=null;return Object.values(t).forEach(r=>{if(s)return;const i=fy(r?.accounts,`${e} namespace`);i&&(s=i)}),s}function my(t,e){let s=null;return gl(t?.methods)?gl(t?.events)||(s=we("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):s=we("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),s}function Rd(t,e){let s=null;return Object.values(t).forEach(r=>{if(s)return;const i=my(r,`${e}, namespace`);i&&(s=i)}),s}function wy(t,e,s){let r=null;if(t&&Ss(t)){const i=Rd(t,e);i&&(r=i);const n=py(t,e,s);n&&(r=n)}else r=D("MISSING_OR_INVALID",`${e}, ${s} should be an object with data`);return r}function $o(t,e){let s=null;if(t&&Ss(t)){const r=Rd(t,e);r&&(s=r);const i=gy(t,e);i&&(s=i)}else s=D("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return s}function Ud(t){return xe(t.protocol,!0)}function yy(t,e){let s=!1;return t?t&&_s(t)&&t.length&&t.forEach(r=>{s=Ud(r)}):s=!0,s}function by(t){return typeof t=="number"}function ct(t){return typeof t<"u"&&typeof t!==null}function vy(t){return!(!t||typeof t!="object"||!t.code||!Ga(t.code,!1)||!t.message||!xe(t.message,!1))}function Ey(t){return!(Ge(t)||!xe(t.method,!1))}function Cy(t){return!(Ge(t)||Ge(t.result)&&Ge(t.error)||!Ga(t.id,!1)||!xe(t.jsonrpc,!1))}function Iy(t){return!(Ge(t)||!xe(t.name,!1))}function ml(t,e){return!(!Xn(e)||!Qw(t).includes(e))}function Ay(t,e,s){return xe(s,!1)?ey(t,e).includes(s):!1}function Ny(t,e,s){return xe(s,!1)?ty(t,e).includes(s):!1}function wl(t,e,s){let r=null;const i=_y(t),n=Sy(e),o=Object.keys(i),a=Object.keys(n),c=yl(Object.keys(t)),l=yl(Object.keys(e)),u=c.filter(d=>!l.includes(d));return u.length&&(r=D("NON_CONFORMING_NAMESPACES",`${s} namespaces keys don't satisfy requiredNamespaces.
|
|
@@ -893,4 +893,4 @@ ${t.length}`,s=new TextEncoder().encode(e+t);return"0x"+Buffer.from(zg(s)).toStr
|
|
|
893
893
|
background-color: var(--wui-color-fg-350);
|
|
894
894
|
}
|
|
895
895
|
`;function wI(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function Iu(t){return wI(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}const _h="2.44.1";let Jo={getDocsUrl:({docsBaseUrl:t,docsPath:e="",docsSlug:s})=>e?`${t??"https://viem.sh"}${e}${s?`#${s}`:""}`:void 0,version:`viem@${_h}`};class Jr extends Error{constructor(e,s={}){const r=s.cause instanceof Jr?s.cause.details:s.cause?.message?s.cause.message:s.details,i=s.cause instanceof Jr&&s.cause.docsPath||s.docsPath,n=Jo.getDocsUrl?.({...s,docsPath:i}),o=[e||"An error occurred.","",...s.metaMessages?[...s.metaMessages,""]:[],...n?[`Docs: ${n}`]:[],...r?[`Details: ${r}`]:[],...Jo.version?[`Version: ${Jo.version}`]:[]].join(`
|
|
896
|
-
`);super(o,s.cause?{cause:s.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=r,this.docsPath=i,this.metaMessages=s.metaMessages,this.name=s.name??this.name,this.shortMessage=e,this.version=_h}walk(e){return Sh(this,e)}}function Sh(t,e){return e?.(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?Sh(t.cause,e):e?null:t}class Ph extends Jr{constructor({size:e,targetSize:s,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${e}) exceeds padding size (${s}).`,{name:"SizeExceedsPaddingSizeError"})}}function oc(t,{dir:e,size:s=32}={}){return typeof t=="string"?yI(t,{dir:e,size:s}):bI(t,{dir:e,size:s})}function yI(t,{dir:e,size:s=32}={}){if(s===null)return t;const r=t.replace("0x","");if(r.length>s*2)throw new Ph({size:Math.ceil(r.length/2),targetSize:s,type:"hex"});return`0x${r[e==="right"?"padEnd":"padStart"](s*2,"0")}`}function bI(t,{dir:e,size:s=32}={}){if(s===null)return t;if(t.length>s)throw new Ph({size:t.length,targetSize:s,type:"bytes"});const r=new Uint8Array(s);for(let i=0;i<s;i++){const n=e==="right";r[n?i:s-i-1]=t[n?i:t.length-i-1]}return r}class vI extends Jr{constructor({max:e,min:s,signed:r,size:i,value:n}){super(`Number "${n}" is not in safe ${i?`${i*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${e?`(${s} to ${e})`:`(above ${s})`}`,{name:"IntegerOutOfRangeError"})}}class EI extends Jr{constructor({givenSize:e,maxSize:s}){super(`Size cannot exceed ${s} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}function Oh(t,{size:e}){if(Iu(t)>e)throw new EI({givenSize:Iu(t),maxSize:e})}const CI=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Au(t,e={}){return typeof t=="number"||typeof t=="bigint"?AI(t,e):typeof t=="string"?_I(t,e):typeof t=="boolean"?II(t,e):kh(t,e)}function II(t,e={}){const s=`0x${Number(t)}`;return typeof e.size=="number"?(Oh(s,{size:e.size}),oc(s,{size:e.size})):s}function kh(t,e={}){let s="";for(let i=0;i<t.length;i++)s+=CI[t[i]];const r=`0x${s}`;return typeof e.size=="number"?(Oh(r,{size:e.size}),oc(r,{dir:"right",size:e.size})):r}function AI(t,e={}){const{signed:s,size:r}=e,i=BigInt(t);let n;r?s?n=(1n<<BigInt(r)*8n-1n)-1n:n=2n**(BigInt(r)*8n)-1n:typeof t=="number"&&(n=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof n=="bigint"&&s?-n-1n:0;if(n&&i>n||i<o){const c=typeof t=="bigint"?"n":"";throw new vI({max:n?`${n}${c}`:void 0,min:`${o}${c}`,signed:s,size:r,value:`${t}${c}`})}const a=`0x${(s&&i<0?(1n<<BigInt(r*8))+BigInt(i):i).toString(16)}`;return r?oc(a,{size:r}):a}const NI=new TextEncoder;function _I(t,e={}){const s=NI.encode(t);return kh(s,e)}const bi={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"]};function bn(t){return{formatters:void 0,fees:void 0,serializers:void 0,...t}}const Nu=bn({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"}),_u=bn({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"});bn({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"});bn({id:"000000000019d6689c085ae165831e93",caipNetworkId:"bip122:000000000019d6689c085ae165831e93",chainNamespace:"bip122",name:"Bitcoin",nativeCurrency:{name:"Bitcoin",symbol:"BTC",decimals:8},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}}});bn({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 SI={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"]},Hn={getMethodsByChainNamespace(t){return SI[t]||[]},createDefaultNamespace(t){return{methods:this.getMethodsByChainNamespace(t),events:["accountsChanged","chainChanged"],chains:[],rpcMap:{}}},applyNamespaceOverrides(t,e){if(!e)return{...t};const s={...t},r=new Set;if(e.methods&&Object.keys(e.methods).forEach(i=>r.add(i)),e.chains&&Object.keys(e.chains).forEach(i=>r.add(i)),e.events&&Object.keys(e.events).forEach(i=>r.add(i)),e.rpcMap&&Object.keys(e.rpcMap).forEach(i=>{const[n]=i.split(":");n&&r.add(n)}),r.forEach(i=>{s[i]||(s[i]=this.createDefaultNamespace(i))}),e.methods&&Object.entries(e.methods).forEach(([i,n])=>{s[i]&&(s[i].methods=n)}),e.chains&&Object.entries(e.chains).forEach(([i,n])=>{s[i]&&(s[i].chains=n)}),e.events&&Object.entries(e.events).forEach(([i,n])=>{s[i]&&(s[i].events=n)}),e.rpcMap){const i=new Set;Object.entries(e.rpcMap).forEach(([n,o])=>{const[a,c]=n.split(":");!a||!c||!s[a]||(s[a].rpcMap||(s[a].rpcMap={}),i.has(a)||(s[a].rpcMap={},i.add(a)),s[a].rpcMap[c]=o)})}return s},createNamespaces(t,e){const s=t.reduce((r,i)=>{const{id:n,chainNamespace:o,rpcUrls:a}=i,c=a.default.http[0];r[o]||(r[o]=this.createDefaultNamespace(o));const l=`${o}:${n}`,u=r[o];switch(u.chains.push(l),l){case Nu.caipNetworkId:u.chains.push(Nu.deprecatedCaipNetworkId);break;case _u.caipNetworkId:u.chains.push(_u.deprecatedCaipNetworkId);break}return u?.rpcMap&&c&&(u.rpcMap[n]=c),r},{});return this.applyNamespaceOverrides(s,e)},resolveReownName:async t=>{const e=await Ii.resolveName(t);return(Object.values(e?.addresses)||[])[0]?.address||!1},getChainsFromNamespaces(t={}){return Object.values(t).flatMap(e=>{const s=e.chains||[],r=e.accounts.map(i=>{const[n,o]=i.split(":");return`${n}:${o}`});return Array.from(new Set([...s,...r]))})},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,s){for(const r of[...e,...s])if(r.includes("*")){const n=`^${r.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&").replace(/\\\*/gu,".*")}$`;if(new RegExp(n,"u").test(t))return!0}else try{if(new URL(r).origin===t)return!0}catch{if(r===t)return!0}return!1}};class Th{constructor({provider:e,namespace:s}){this.id=H.CONNECTOR_ID.WALLET_CONNECT,this.name=Zn.ConnectorNamesMap[H.CONNECTOR_ID.WALLET_CONNECT],this.type="WALLET_CONNECT",this.imageId=Zn.ConnectorImageIds[H.CONNECTOR_ID.WALLET_CONNECT],this.getCaipNetworks=p.getCaipNetworks.bind(p),this.caipNetworks=this.getCaipNetworks(),this.provider=e,this.chain=s}get chains(){return this.getCaipNetworks()}async connectWalletConnect(){if(!await this.authenticate()){const s=this.getCaipNetworks(),r=k.state.universalProviderConfigOverride,i=Hn.createNamespaces(s,r);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(s=>s.caipNetworkId);return Ai.universalProviderAuthenticate({universalProvider:this.provider,chains:e,methods:PI})}}const PI=["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 OI{constructor(e){this.availableConnectors=[],this.eventListeners=new Map,this.getCaipNetworks=s=>p.getCaipNetworks(s),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:H.CONNECTOR_ID.AUTH,type:"AUTH",name:H.CONNECTOR_NAMES.AUTH,provider:e,imageId:Zn.ConnectorImageIds[H.CONNECTOR_ID.AUTH],chain:this.namespace,chains:[]})}addConnector(...e){const s=new Set;this.availableConnectors=[...e,...this.availableConnectors].filter(r=>s.has(r.id)?!1:(s.add(r.id),!0)),this.emit("connectors",this.availableConnectors)}setStatus(e,s){F.setStatus(e,s)}on(e,s){this.eventListeners.has(e)||this.eventListeners.set(e,new Set),this.eventListeners.get(e)?.add(s)}off(e,s){const r=this.eventListeners.get(e);r&&r.delete(s)}removeAllEventListeners(){this.eventListeners.forEach(e=>{e.clear()})}emit(e,s){const r=this.eventListeners.get(e);r&&r.forEach(i=>i(s))}async connectWalletConnect(e){return{clientId:(await this.getWalletConnectConnector().connectWalletConnect()).clientId}}async switchNetwork(e){const{caipNetwork:s,providerType:r}=e;if(!e.provider)return;const i="provider"in e.provider?e.provider.provider:e.provider;if(r==="WALLET_CONNECT"){i.setDefaultChain(s.caipNetworkId);return}if(i&&r==="AUTH"){const n=i,o=F.state.preferredAccountTypes?.[s.chainNamespace];await n.switchNetwork(s.caipNetworkId);const a=await n.getUser({chainId:s.caipNetworkId,preferredAccountType:o});this.emit("switchNetwork",a)}}getWalletConnectConnector(){const e=this.connectors.find(s=>s instanceof Th);if(!e)throw new Error("WalletConnectConnector not found");return e}}class kI extends OI{setUniversalProvider(e){this.addConnector(new Th({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}){const r=this.provider?.session?.namespaces?.[e]?.accounts?.map(i=>{const[,,n]=i.split(":");return n}).filter((i,n,o)=>o.indexOf(i)===n)||[];return Promise.resolve({accounts:r.map(i=>X.createAccount(e,i,e==="bip122"?"payment":"eoa"))})}async syncConnectors(){return Promise.resolve()}async getBalance(e){if(!(e.caipNetwork&&ve.BALANCE_SUPPORTED_CHAINS.includes(e.caipNetwork?.chainNamespace))||e.caipNetwork?.testnet)return{balance:"0.00",symbol:e.caipNetwork?.nativeCurrency.symbol||""};if(F.state.balanceLoading&&e.chainId===p.state.activeCaipNetwork?.id)return{balance:F.state.balance||"0.00",symbol:F.state.balanceSymbol||""};const i=(await F.fetchTokenBalance()).find(n=>n.chainId===`${e.caipNetwork?.chainNamespace}:${e.chainId}`&&n.symbol===e.caipNetwork?.nativeCurrency.symbol);return{balance:i?.quantity.numeric||"0.00",symbol:i?.symbol||e.caipNetwork?.nativeCurrency.symbol||""}}async signMessage(e){const{provider:s,message:r,address:i}=e;if(!s)throw new Error("UniversalAdapter:signMessage - provider is undefined");let n="";return p.state.activeCaipNetwork?.chainNamespace===H.CHAIN.SOLANA?n=(await s.request({method:"solana_signMessage",params:{message:Pu.encode(new TextEncoder().encode(r)),pubkey:i}},p.state.activeCaipNetwork?.caipNetworkId)).signature:n=await s.request({method:"personal_sign",params:[r,i]},p.state.activeCaipNetwork?.caipNetworkId),{signature:n}}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){const{caipNetwork:s}=e,r=this.getWalletConnectConnector();if(s.chainNamespace===H.CHAIN.EVM)try{await r.provider?.request({method:"wallet_switchEthereumChain",params:[{chainId:Au(s.id)}]})}catch(i){if(i.code===bi.ERROR_CODE_UNRECOGNIZED_CHAIN_ID||i.code===bi.ERROR_INVALID_CHAIN_ID||i.code===bi.ERROR_CODE_DEFAULT||i?.data?.originalError?.code===bi.ERROR_CODE_UNRECOGNIZED_CHAIN_ID)try{await r.provider?.request({method:"wallet_addEthereumChain",params:[{chainId:Au(s.id),rpcUrls:[s?.rpcUrls.chainDefault?.http],chainName:s.name,nativeCurrency:s.nativeCurrency,blockExplorerUrls:[s.blockExplorers?.default.url]}]})}catch{throw new Error("Chain is not supported")}}r.provider.setDefaultChain(s.caipNetworkId)}getWalletConnectProvider(){return this.connectors.find(r=>r.type==="WALLET_CONNECT")?.provider}}const TI=["email","socials","swaps","onramp","activity","reownBranding"],Ln={email:{apiFeatureName:"social_login",localFeatureName:"email",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:t=>{if(!t?.config)return!1;const e=t.config;return!!t.isEnabled&&e.includes("email")},processFallback:t=>t===void 0?ve.DEFAULT_REMOTE_FEATURES.email:!!t},socials:{apiFeatureName:"social_login",localFeatureName:"socials",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:t=>{if(!t?.config)return!1;const e=t.config;return t.isEnabled&&e.length>0?e.filter(s=>s!=="email"):!1},processFallback:t=>t===void 0?ve.DEFAULT_REMOTE_FEATURES.socials:typeof t=="boolean"?t?ve.DEFAULT_REMOTE_FEATURES.socials:!1:t},swaps:{apiFeatureName:"swap",localFeatureName:"swaps",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:t=>{if(!t?.config)return!1;const e=t.config;return t.isEnabled&&e.length>0?e:!1},processFallback:t=>t===void 0?ve.DEFAULT_REMOTE_FEATURES.swaps:typeof t=="boolean"?t?ve.DEFAULT_REMOTE_FEATURES.swaps:!1:t},onramp:{apiFeatureName:"onramp",localFeatureName:"onramp",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:t=>{if(!t?.config)return!1;const e=t.config;return t.isEnabled&&e.length>0?e:!1},processFallback:t=>t===void 0?ve.DEFAULT_REMOTE_FEATURES.onramp:typeof t=="boolean"?t?ve.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?ve.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?ve.DEFAULT_REMOTE_FEATURES.reownBranding:!!t}},xI={localSettingsOverridden:new Set,getApiConfig(t,e){return e?.find(s=>s.id===t)},addWarning(t,e){if(t!==void 0){const s=Ln[e],r=s.isLegacy?`"features.${s.localFeatureName}" (now "${e}")`:`"features.${e}"`;this.localSettingsOverridden.add(r)}},processFeature(t,e,s,r,i){const n=Ln[t],o=e[n.localFeatureName];if(i&&!n.isAvailableOnBasic)return!1;if(r){const a=this.getApiConfig(n.apiFeatureName,s);return a?.config===null?this.processFallbackFeature(t,o):a?.config?(o!==void 0&&this.addWarning(o,t),this.processApiFeature(t,a)):!1}return this.processFallbackFeature(t,o)},processApiFeature(t,e){return Ln[t].processApi(e)},processFallbackFeature(t,e){return Ln[t].processFallback(e)},async fetchRemoteFeatures(t){const e=t.basic??!1,s=t.features||{};this.localSettingsOverridden.clear();let r=null,i=!1;try{r=await V.fetchProjectConfig(),i=r!=null}catch(o){console.warn("[Reown Config] Failed to fetch remote project configuration. Using local/default values.",o)}const n=i&&!e?ve.DEFAULT_REMOTE_FEATURES:ve.DEFAULT_REMOTE_FEATURES_DISABLED;try{for(const o of TI){const a=this.processFeature(o,s,r,i,e);Object.assign(n,{[o]:a})}}catch(o){return console.warn("[Reown Config] Failed to process the configuration from Cloud. Using default values.",o),ve.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.`;Ms.open({shortMessage:"Local configuration ignored",longMessage:`[Reown Config Notice] ${o}`},"warning")}return n}};class $I{constructor(e){this.chainNamespaces=[],this.remoteFeatures={},this.reportedAlertErrors={},this.getCaipNetwork=(s,r)=>{if(s){const i=p.getNetworkData(s)?.requestedCaipNetworks?.find(a=>a.id===r);if(i)return i;const n=p.getNetworkData(s)?.caipNetwork;return n||p.getRequestedCaipNetworks(s).filter(a=>a.chainNamespace===s)?.[0]}return p.state.activeCaipNetwork||this.defaultCaipNetwork},this.getCaipNetworkId=()=>{const s=this.getCaipNetwork();if(s)return s.id},this.getCaipNetworks=s=>p.getCaipNetworks(s),this.getActiveChainNamespace=()=>p.state.activeChain,this.setRequestedCaipNetworks=(s,r)=>{p.setRequestedCaipNetworks(s,r)},this.getApprovedCaipNetworkIds=()=>p.getAllApprovedCaipNetworkIds(),this.getCaipAddress=s=>p.state.activeChain===s||!s?p.state.activeCaipAddress:p.getAccountProp("caipAddress",s),this.setClientId=s=>{J.setClientId(s)},this.getProvider=s=>Se.getProvider(s),this.getProviderType=s=>Se.getProviderId(s),this.getPreferredAccountType=s=>F.state.preferredAccountTypes?.[s],this.setCaipAddress=(s,r)=>{F.setCaipAddress(s,r),s&&k.state.enableEmbedded&&this.close()},this.setBalance=(s,r,i)=>{F.setBalance(s,r,i)},this.setProfileName=(s,r)=>{F.setProfileName(s,r)},this.setProfileImage=(s,r)=>{F.setProfileImage(s,r)},this.setUser=(s,r)=>{F.setUser(s,r)},this.resetAccount=s=>{F.resetAccount(s)},this.setCaipNetwork=s=>{p.setActiveCaipNetwork(s)},this.setCaipNetworkOfNamespace=(s,r)=>{p.setChainNetworkData(r,{caipNetwork:s})},this.setAllAccounts=(s,r)=>{F.setAllAccounts(s,r),k.setHasMultipleAddresses(s?.length>1)},this.setStatus=(s,r)=>{F.setStatus(s,r),B.isConnected()?z.setConnectionStatus("connected"):z.setConnectionStatus("disconnected")},this.getAddressByChainNamespace=s=>p.getAccountProp("address",s),this.setConnectors=s=>{const r=[...B.state.allConnectors,...s];B.setConnectors(r)},this.setConnections=(s,r)=>{Y.setConnections(s,r)},this.fetchIdentity=s=>J.fetchIdentity(s),this.getReownName=s=>Ii.getNamesForAddress(s),this.getConnectors=()=>B.getConnectors(),this.getConnectorImage=s=>Uu.getConnectorImage(s),this.setConnectedWalletInfo=(s,r)=>{const i=Se.getProviderId(r),n=s?{...s,type:i}:void 0;F.setConnectedWalletInfo(n,r)},this.getIsConnectedState=()=>!!p.state.activeCaipAddress,this.addAddressLabel=(s,r,i)=>{F.addAddressLabel(s,r,i)},this.removeAddressLabel=(s,r)=>{F.removeAddressLabel(s,r)},this.getAddress=s=>p.state.activeChain===s||!s?F.state.address:p.getAccountProp("address",s),this.setApprovedCaipNetworksData=s=>p.setApprovedCaipNetworksData(s),this.resetNetwork=s=>{p.resetNetwork(s)},this.addConnector=s=>{B.addConnector(s)},this.resetWcConnection=()=>{Y.resetWcConnection()},this.setAddressExplorerUrl=(s,r)=>{F.setAddressExplorerUrl(s,r)},this.setSmartAccountDeployed=(s,r)=>{F.setSmartAccountDeployed(s,r)},this.setSmartAccountEnabledNetworks=(s,r)=>{p.setSmartAccountEnabledNetworks(s,r)},this.setPreferredAccountType=(s,r)=>{F.setPreferredAccountType(s,r)},this.setEIP6963Enabled=s=>{k.setEIP6963Enabled(s)},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,s){const r=e?.map(n=>n.namespace).filter(n=>!!n);if(r?.length)return[...new Set(r)];const i=s?.map(n=>n.chainNamespace);return[...new Set(i)]}async initialize(e){this.initializeProjectSettings(e),this.initControllers(e),await this.initChainAdapters(),this.sendInitializeEvent(e),await this.syncExistingConnection(),this.remoteFeatures=await xI.fetchRemoteFeatures(e),k.setRemoteFeatures(this.remoteFeatures),this.remoteFeatures.onramp&&ta.setOnrampProviders(this.remoteFeatures.onramp),(k.state.remoteFeatures?.email||Array.isArray(k.state.remoteFeatures?.socials)&&k.state.remoteFeatures?.socials.length>0)&&await this.checkAllowedOrigins()}async checkAllowedOrigins(){const e=await V.fetchAllowedOrigins();if(e&&X.isClient()){const s=window.location.origin;Hn.isOriginAllowed(s,e,bi.DEFAULT_ALLOWED_ANCESTORS)||Ms.open(Nr.ALERT_ERRORS.INVALID_APP_CONFIGURATION,"error")}else Ms.open(Nr.ALERT_ERRORS.PROJECT_ID_NOT_CONFIGURED,"error")}sendInitializeEvent(e){const{...s}=e;delete s.adapters,delete s.universalProvider,Pe.sendEvent({type:"track",event:"INITIALIZE",properties:{...s,networks:e.networks.map(r=>r.id),siweConfig:{options:e.siweConfig?.options||{}}}})}initControllers(e){this.initializeOptionsController(e),this.initializeChainController(e),this.initializeThemeController(e),this.initializeConnectionController(e),this.initializeConnectorController()}initializeThemeController(e){e.themeMode&>.setThemeMode(e.themeMode),e.themeVariables&>.setThemeVariables(e.themeVariables)}initializeChainController(e){if(!this.connectionControllerClient||!this.networkControllerClient)throw new Error("ConnectionControllerClient and NetworkControllerClient must be set");p.initialize(e.adapters??[],this.caipNetworks,{connectionControllerClient:this.connectionControllerClient,networkControllerClient:this.networkControllerClient});const s=this.getDefaultNetwork();s&&p.setActiveCaipNetwork(s)}initializeConnectionController(e){Y.setWcBasic(e.basic??!1)}initializeConnectorController(){B.initialize(this.chainNamespaces)}initializeProjectSettings(e){k.setProjectId(e.projectId),k.setSdkVersion(e.sdkVersion)}initializeOptionsController(e){k.setDebug(e.debug!==!1),k.setEnableWalletConnect(e.enableWalletConnect!==!1),k.setEnableWalletGuide(e.enableWalletGuide!==!1),k.setEnableWallets(e.enableWallets!==!1),k.setEIP6963Enabled(e.enableEIP6963!==!1),k.setEnableNetworkSwitch(e.enableNetworkSwitch!==!1),k.setEnableAuthLogger(e.enableAuthLogger!==!1),k.setCustomRpcUrls(e.customRpcUrls),k.setEnableEmbedded(e.enableEmbedded),k.setAllWallets(e.allWallets),k.setIncludeWalletIds(e.includeWalletIds),k.setExcludeWalletIds(e.excludeWalletIds),k.setFeaturedWalletIds(e.featuredWalletIds),k.setTokens(e.tokens),k.setTermsConditionsUrl(e.termsConditionsUrl),k.setPrivacyPolicyUrl(e.privacyPolicyUrl),k.setCustomWallets(e.customWallets),k.setFeatures(e.features),k.setAllowUnsupportedChain(e.allowUnsupportedChain),k.setUniversalProviderConfigOverride(e.universalProviderConfigOverride),k.setPreferUniversalLinks(e.experimental_preferUniversalLinks),k.setDefaultAccountTypes(e.defaultAccountTypes);const s=z.getPreferredAccountTypes()||{},r={...k.state.defaultAccountTypes,...s};F.setPreferredAccountTypes(r);const i=this.getDefaultMetaData();if(!e.metadata&&i&&(e.metadata=i),k.setMetadata(e.metadata),k.setDisableAppend(e.disableAppend),k.setEnableEmbedded(e.enableEmbedded),k.setSIWX(e.siwx),!e.projectId){Ms.open(Nr.ALERT_ERRORS.PROJECT_ID_NOT_CONFIGURED,"error");return}if(e.adapters?.find(o=>o.namespace===H.CHAIN.EVM)&&e.siweConfig){if(e.siwx)throw new Error("Cannot set both `siweConfig` and `siwx` options");k.setSIWX(e.siweConfig.mapToSIWX())}}getDefaultMetaData(){return X.isClient()?{name:document.getElementsByTagName("title")?.[0]?.textContent||"",description:document.querySelector('meta[property="og:description"]')?.content||"",url:window.location.origin,icons:[document.querySelector('link[rel~="icon"]')?.href||""]}:null}setUnsupportedNetwork(e){const s=this.getActiveChainNamespace();if(s){const r=Sr.getUnsupportedNetwork(`${s}:${e}`);p.setActiveCaipNetwork(r)}}getDefaultNetwork(){return Sr.getCaipNetworkFromStorage(this.defaultCaipNetwork)}extendCaipNetwork(e,s){return Sr.extendCaipNetwork(e,{customNetworkImageUrls:s.chainImages,projectId:s.projectId})}extendCaipNetworks(e){return Sr.extendCaipNetworks(e.networks,{customNetworkImageUrls:e.chainImages,customRpcUrls:e.customRpcUrls,projectId:e.projectId})}extendDefaultCaipNetwork(e){const s=e.networks.find(i=>i.id===e.defaultNetwork?.id);return s?Sr.extendCaipNetwork(s,{customNetworkImageUrls:e.chainImages,customRpcUrls:e.customRpcUrls,projectId:e.projectId}):void 0}async disconnectNamespace(e){try{const s=this.getAdapter(e),r=Se.getProvider(e),i=Se.getProviderId(e),{caipAddress:n}=p.getAccountData(e)||{};this.setLoading(!0,e),n&&s?.disconnect&&await s.disconnect({provider:r,providerType:i}),z.removeConnectedNamespace(e),Se.resetChain(e),this.setUser(void 0,e),this.setStatus("disconnected",e),this.setConnectedWalletInfo(void 0,e),B.removeConnectorId(e),p.resetAccount(e),p.resetNetwork(e),this.setLoading(!1,e)}catch(s){throw this.setLoading(!1,e),new Error(`Failed to disconnect chain ${e}: ${s.message}`)}}createClients(){this.connectionControllerClient={connectWalletConnect:async()=>{const e=p.state.activeChain,s=this.getAdapter(e),r=this.getCaipNetwork(e)?.id;if(!s)throw new Error("Adapter not found");const i=await s.connectWalletConnect(r);this.close(),this.setClientId(i?.clientId||null),z.setConnectedNamespaces([...p.state.chains.keys()]),this.chainNamespaces.forEach(n=>{B.setConnectorId(ws.CONNECTOR_TYPE_WALLET_CONNECT,n)}),await this.syncWalletConnectAccount()},connectExternal:async({id:e,info:s,type:r,provider:i,chain:n,caipNetwork:o,socialUri:a})=>{const c=p.state.activeChain,l=n||c,u=this.getAdapter(l);if(n&&n!==c&&!o){const m=this.getCaipNetworks().find(g=>g.chainNamespace===n);m&&this.setCaipNetwork(m)}if(!u)throw new Error("Adapter not found");const d=this.getCaipNetwork(l),h=await u.connect({id:e,info:s,type:r,provider:i,socialUri:a,chainId:o?.id||d?.id,rpcUrl:o?.rpcUrls?.default?.http?.[0]||d?.rpcUrls?.default?.http?.[0]});if(!h)return;z.addConnectedNamespace(l),this.syncProvider({...h,chainNamespace:l});const f=F.state.allAccounts,{accounts:w}=f?.length>0?{accounts:[...f]}:await u.getAccounts({namespace:l,id:e});this.setAllAccounts(w,l),this.setStatus("connected",l),this.syncConnectedWalletInfo(l)},reconnectExternal:async({id:e,info:s,type:r,provider:i})=>{const n=p.state.activeChain,o=this.getAdapter(n);o?.reconnect&&(await o?.reconnect({id:e,info:s,type:r,provider:i,chainId:this.getCaipNetwork()?.id}),z.addConnectedNamespace(n),this.syncConnectedWalletInfo(n))},disconnect:async e=>{const s=b1(e);try{const r=await Promise.allSettled(s.map(async([n])=>this.disconnectNamespace(n)));de.resetSend(),Y.resetWcConnection(),await Ai.clearSessions(),B.setFilterByNamespace(void 0);const i=r.filter(n=>n.status==="rejected");if(i.length>0)throw new Error(i.map(n=>n.reason.message).join(", "));z.deleteConnectedSocialProvider(),Pe.sendEvent({type:"track",event:"DISCONNECT_SUCCESS",properties:{namespace:e||"all"}})}catch(r){throw new Error(`Failed to disconnect chains: ${r.message}`)}},checkInstalled:e=>e?e.some(s=>!!window.ethereum?.[String(s)]):!!window.ethereum,signMessage:async e=>(await this.getAdapter(p.state.activeChain)?.signMessage({message:e,address:F.state.address,provider:Se.getProvider(p.state.activeChain)}))?.signature||"",sendTransaction:async e=>{const s=e.chainNamespace;if(ve.SEND_SUPPORTED_NAMESPACES.includes(s)){const r=this.getAdapter(p.state.activeChain),i=Se.getProvider(s);return(await r?.sendTransaction({...e,caipNetwork:this.getCaipNetwork(),provider:i}))?.hash||""}return""},estimateGas:async e=>{if(e.chainNamespace===H.CHAIN.EVM){const s=this.getAdapter(p.state.activeChain),r=Se.getProvider(p.state.activeChain),i=this.getCaipNetwork();if(!i)throw new Error("CaipNetwork is undefined");return(await s?.estimateGas({...e,provider:r,caipNetwork:i}))?.gas||0n}return 0n},getEnsAvatar:async()=>(await this.syncIdentity({address:F.state.address,chainId:Number(this.getCaipNetwork()?.id),chainNamespace:p.state.activeChain}),F.state.profileImage||!1),getEnsAddress:async e=>await Hn.resolveReownName(e),writeContract:async e=>{const s=this.getAdapter(p.state.activeChain),r=this.getCaipNetwork(),i=this.getCaipAddress(),n=Se.getProvider(p.state.activeChain);if(!r||!i)throw new Error("CaipNetwork or CaipAddress is undefined");return(await s?.writeContract({...e,caipNetwork:r,provider:n,caipAddress:i}))?.hash},parseUnits:(e,s)=>this.getAdapter(p.state.activeChain)?.parseUnits({value:e,decimals:s})??0n,formatUnits:(e,s)=>this.getAdapter(p.state.activeChain)?.formatUnits({value:e,decimals:s})??"0",getCapabilities:async e=>await this.getAdapter(p.state.activeChain)?.getCapabilities(e),grantPermissions:async e=>await this.getAdapter(p.state.activeChain)?.grantPermissions(e),revokePermissions:async e=>{const s=this.getAdapter(p.state.activeChain);return s?.revokePermissions?await s.revokePermissions(e):"0x"},walletGetAssets:async e=>await this.getAdapter(p.state.activeChain)?.walletGetAssets(e)??{},updateBalance:e=>{const s=this.getCaipNetwork(e);!s||!F.state.address||this.updateNativeBalance(F.state.address,s?.id,e)}},this.networkControllerClient={switchCaipNetwork:async e=>await this.switchCaipNetwork(e),getApprovedCaipNetworksData:async()=>this.getApprovedCaipNetworksData()},Y.setClient(this.connectionControllerClient)}getApprovedCaipNetworksData(){if(Se.getProviderId(p.state.activeChain)===ws.CONNECTOR_TYPE_WALLET_CONNECT){const s=this.universalProvider?.session?.namespaces;return{supportsAllNetworks:this.universalProvider?.session?.peer?.metadata.name==="MetaMask Wallet",approvedCaipNetworkIds:this.getChainsFromNamespaces(s)}}return{supportsAllNetworks:!0,approvedCaipNetworkIds:[]}}async switchCaipNetwork(e){if(!e)return;const s=e.chainNamespace;if(this.getAddressByChainNamespace(e.chainNamespace)){const i=Se.getProvider(s),n=Se.getProviderId(s);if(e.chainNamespace===p.state.activeChain)await this.getAdapter(s)?.switchNetwork({caipNetwork:e,provider:i,providerType:n});else if(this.setCaipNetwork(e),n===ws.CONNECTOR_TYPE_WALLET_CONNECT)this.syncWalletConnectAccount();else{const o=this.getAddressByChainNamespace(s);o&&this.syncAccount({address:o,chainId:e.id,chainNamespace:s})}}else this.setCaipNetwork(e)}getChainsFromNamespaces(e={}){return Object.values(e).flatMap(s=>{const r=s.chains||[],i=s.accounts.map(n=>{const{chainId:o,chainNamespace:a}=hs.parseCaipAddress(n);return`${a}:${o}`});return Array.from(new Set([...r,...i]))})}createAdapters(e){return this.createClients(),this.chainNamespaces.reduce((s,r)=>{const i=e?.find(n=>n.namespace===r);return i?(i.construct({namespace:r,projectId:this.options?.projectId,networks:this.getCaipNetworks()}),s[r]=i):s[r]=new kI({namespace:r,networks:this.getCaipNetworks()}),s},{})}async initChainAdapter(e){this.onConnectors(e),this.listenAdapter(e),await this.chainAdapters?.[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){this.getAdapter(e)?.on("connectors",this.setConnectors.bind(this))}listenAdapter(e){const s=this.getAdapter(e);if(!s)return;const r=z.getConnectionStatus();r==="connected"?this.setStatus("connecting",e):r==="disconnected"?(z.clearAddressCache(),this.setStatus(r,e)):this.setStatus(r,e),s.on("switchNetwork",({address:i,chainId:n})=>{const o=this.getCaipNetworks().find(l=>l.id===n||l.caipNetworkId===n),a=p.state.activeChain===e,c=p.getAccountProp("address",e);if(o){const l=a&&i?i:c;l&&this.syncAccount({address:l,chainId:o.id,chainNamespace:e})}else this.setUnsupportedNetwork(n)}),s.on("disconnect",this.disconnect.bind(this,e)),s.on("connections",i=>{this.setConnections(i,e)}),s.on("pendingTransactions",()=>{const i=F.state.address,n=p.state.activeCaipNetwork;!i||!n?.id||this.updateNativeBalance(i,n.id,n.chainNamespace)}),s.on("accountChanged",({address:i,chainId:n})=>{const o=p.state.activeChain===e;o&&n?this.syncAccount({address:i,chainId:n,chainNamespace:e}):o&&p.state.activeCaipNetwork?.id?this.syncAccount({address:i,chainId:p.state.activeCaipNetwork?.id,chainNamespace:e}):this.syncAccountInfo(i,n,e),this.syncAllAccounts(e)})}async createUniversalProviderForAdapter(e){await this.getUniversalProvider(),this.universalProvider&&this.chainAdapters?.[e]?.setUniversalProvider?.(this.universalProvider)}async syncExistingConnection(){await Promise.allSettled(this.chainNamespaces.map(e=>this.syncNamespaceConnection(e)))}async syncNamespaceConnection(e){try{e===H.CHAIN.EVM&&X.isSafeApp()&&B.setConnectorId(H.CONNECTOR_ID.SAFE,e);const s=B.getConnectorId(e);switch(this.setStatus("connecting",e),s){case H.CONNECTOR_ID.WALLET_CONNECT:await this.syncWalletConnectAccount();break;case H.CONNECTOR_ID.AUTH:break;default:await this.syncAdapterConnection(e)}}catch(s){console.warn("AppKit couldn't sync existing connection",s),this.setStatus("disconnected",e)}}async syncAdapterConnection(e){const s=this.getAdapter(e),r=B.getConnectorId(e),i=this.getCaipNetwork(e),o=B.getConnectors(e).find(a=>a.id===r);try{if(!s||!o)throw new Error(`Adapter or connector not found for namespace ${e}`);if(!i?.id)throw new Error("CaipNetwork not found");const a=await s?.syncConnection({namespace:e,id:o.id,chainId:i.id,rpcUrl:i?.rpcUrls?.default?.http?.[0]});if(a){const c=await s?.getAccounts({namespace:e,id:o.id});c&&c.accounts.length>0?this.setAllAccounts(c.accounts,e):this.setAllAccounts([X.createAccount(e,a.address,"eoa")],e),this.syncProvider({...a,chainNamespace:e}),await this.syncAccount({...a,chainNamespace:e}),this.setStatus("connected",e)}else this.setStatus("disconnected",e)}catch{this.setStatus("disconnected",e)}}async syncWalletConnectAccount(){const e=this.chainNamespaces.map(async s=>{const r=this.getAdapter(s),i=this.universalProvider?.session?.namespaces?.[s]?.accounts||[],n=p.state.activeCaipNetwork?.id,o=i.find(a=>{const{chainId:c}=hs.parseCaipAddress(a);return c===n?.toString()})||i[0];if(o){const a=hs.validateCaipAddress(o),{chainId:c,address:l}=hs.parseCaipAddress(a);if(Se.setProviderId(s,ws.CONNECTOR_TYPE_WALLET_CONNECT),this.caipNetworks&&p.state.activeCaipNetwork&&r?.namespace!==H.CHAIN.EVM){const u=r?.getWalletConnectProvider({caipNetworks:this.getCaipNetworks(),provider:this.universalProvider,activeCaipNetwork:p.state.activeCaipNetwork});Se.setProvider(s,u)}else Se.setProvider(s,this.universalProvider);B.setConnectorId(H.CONNECTOR_ID.WALLET_CONNECT,s),z.addConnectedNamespace(s),this.syncWalletConnectAccounts(s),await this.syncAccount({address:l,chainId:c,chainNamespace:s})}else this.setStatus("disconnected",s);this.syncConnectedWalletInfo(s),await p.setApprovedCaipNetworksData(s)});await Promise.all(e)}syncWalletConnectAccounts(e){const s=this.universalProvider?.session?.namespaces?.[e]?.accounts?.map(r=>{const{address:i}=hs.parseCaipAddress(r);return i}).filter((r,i,n)=>n.indexOf(r)===i);s&&this.setAllAccounts(s.map(r=>X.createAccount(e,r,e==="bip122"?"payment":"eoa")),e)}syncProvider({type:e,provider:s,id:r,chainNamespace:i}){Se.setProviderId(i,e),Se.setProvider(i,s),B.setConnectorId(r,i)}async syncAllAccounts(e){const s=B.getConnectorId(e);if(!s)return;const i=await this.getAdapter(e)?.getAccounts({namespace:e,id:s});i&&i.accounts.length>0&&this.setAllAccounts(i.accounts,e)}async syncAccount(e){const s=e.chainNamespace===p.state.activeChain,r=p.getCaipNetworkByNamespace(e.chainNamespace,e.chainId),{address:i,chainId:n,chainNamespace:o}=e,{chainId:a}=z.getActiveNetworkProps(),c=n||a,l=p.state.activeCaipNetwork?.name===H.UNSUPPORTED_NETWORK_NAME,u=p.getNetworkProp("supportsAllNetworks",o);if(this.setStatus("connected",o),!(l&&!u)&&c){let d=this.getCaipNetworks().find(w=>w.id.toString()===c.toString()),h=this.getCaipNetworks().find(w=>w.chainNamespace===o);if(!u&&!d&&!h){const w=this.getApprovedCaipNetworkIds()||[],m=w.find(y=>hs.parseCaipNetworkId(y)?.chainId===c.toString()),g=w.find(y=>hs.parseCaipNetworkId(y)?.chainNamespace===o);d=this.getCaipNetworks().find(y=>y.caipNetworkId===m),h=this.getCaipNetworks().find(y=>y.caipNetworkId===g||"deprecatedCaipNetworkId"in y&&y.deprecatedCaipNetworkId===g)}const f=d||h;f?.chainNamespace===p.state.activeChain?k.state.enableNetworkSwitch&&!k.state.allowUnsupportedChain&&p.state.activeCaipNetwork?.name===H.UNSUPPORTED_NETWORK_NAME?p.showUnsupportedChainUI():this.setCaipNetwork(f):s||r&&this.setCaipNetworkOfNamespace(r,o),this.syncConnectedWalletInfo(o),Za.isLowerCaseMatch(i,F.state.address)||this.syncAccountInfo(i,f?.id,o),s?await this.syncBalance({address:i,chainId:f?.id,chainNamespace:o}):await this.syncBalance({address:i,chainId:r?.id,chainNamespace:o})}}async syncAccountInfo(e,s,r){const i=this.getCaipAddress(r),n=s||i?.split(":")[1];if(!n)return;const o=`${r}:${n}:${e}`;this.setCaipAddress(o,r),await this.syncIdentity({address:e,chainId:n,chainNamespace:r})}async syncReownName(e,s){try{const r=await this.getReownName(e);if(r[0]){const i=r[0];this.setProfileName(i.name,s)}else this.setProfileName(null,s)}catch{this.setProfileName(null,s)}}syncConnectedWalletInfo(e){const s=B.getConnectorId(e),r=Se.getProviderId(e);if(r===ws.CONNECTOR_TYPE_ANNOUNCED||r===ws.CONNECTOR_TYPE_INJECTED){if(s){const i=this.getConnectors().find(n=>n.id===s);if(i){const{info:n,name:o,imageUrl:a}=i,c=a||this.getConnectorImage(i);this.setConnectedWalletInfo({name:o,icon:c,...n},e)}}}else if(r===ws.CONNECTOR_TYPE_WALLET_CONNECT){const i=Se.getProvider(e);i?.session&&this.setConnectedWalletInfo({...i.session.peer.metadata,name:i.session.peer.metadata.name,icon:i.session.peer.metadata.icons?.[0]},e)}else if(s&&s===H.CONNECTOR_ID.COINBASE){const i=this.getConnectors().find(n=>n.id===H.CONNECTOR_ID.COINBASE);this.setConnectedWalletInfo({name:"Coinbase Wallet",icon:this.getConnectorImage(i)},e)}}async syncBalance(e){!Tu.getNetworksByNamespace(this.getCaipNetworks(),e.chainNamespace).find(r=>r.id.toString()===e.chainId?.toString())||!e.chainId||await this.updateNativeBalance(e.address,e.chainId,e.chainNamespace)}async ready(){await this.readyPromise}async updateNativeBalance(e,s,r){const i=this.getAdapter(r),n=p.getCaipNetworkByNamespace(r,s);if(i){const o=await i.getBalance({address:e,chainId:s,caipNetwork:n,tokens:this.options.tokens});return this.setBalance(o.balance,o.symbol,r),o}}async initializeUniversalAdapter(){const e=E1.createLogger((r,...i)=>{r&&this.handleAlertError(r),console.error(...i)}),s={projectId:this.options?.projectId,metadata:{name:this.options?.metadata?this.options?.metadata.name:"",description:this.options?.metadata?this.options?.metadata.description:"",url:this.options?.metadata?this.options?.metadata.url:"",icons:this.options?.metadata?this.options?.metadata.icons:[""]},logger:e};k.setManualWCControl(!!this.options?.manualWCControl),this.universalProvider=this.options.universalProvider??await y1.init(s),this.listenWalletConnect()}listenWalletConnect(){this.universalProvider&&(this.universalProvider.on("display_uri",e=>{Y.setUri(e)}),this.universalProvider.on("connect",Y.finalizeWcConnection),this.universalProvider.on("disconnect",()=>{this.chainNamespaces.forEach(e=>{this.resetAccount(e)}),Y.resetWcConnection()}),this.universalProvider.on("chainChanged",e=>{const s=this.getCaipNetworks().find(i=>i.id==e),r=this.getCaipNetwork();if(!s){this.setUnsupportedNetwork(e);return}r?.id!==s?.id&&this.setCaipNetwork(s)}),this.universalProvider.on("session_event",e=>{if(Hn.isSessionEventData(e)){const{name:s,data:r}=e.params.event;s==="accountsChanged"&&Array.isArray(r)&&X.isCaipAddress(r[0])&&this.syncAccount(hs.parseCaipAddress(r[0]))}}))}createUniversalProvider(){return!this.universalProviderInitPromise&&X.isClient()&&this.options?.projectId&&(this.universalProviderInitPromise=this.initializeUniversalAdapter()),this.universalProviderInitPromise}async getUniversalProvider(){if(!this.universalProvider)try{await this.createUniversalProvider()}catch(e){Pe.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 s=Object.entries(Nr.UniversalProviderErrors).find(([,{message:a}])=>e.message.includes(a)),[r,i]=s??[],{message:n,alertErrorKey:o}=i??{};if(r&&n&&!this.reportedAlertErrors[r]){const a=Nr.ALERT_ERRORS[o];a&&(Ms.open(a,"error"),this.reportedAlertErrors[r]=!0)}}getAdapter(e){if(e)return this.chainAdapters?.[e]}createAdapter(e){if(!e)return;const s=e.namespace;if(!s)return;this.createClients();const r=e;r.namespace=s,r.construct({namespace:s,projectId:this.options?.projectId,networks:this.getCaipNetworks()}),this.chainNamespaces.includes(s)||this.chainNamespaces.push(s),this.chainAdapters&&(this.chainAdapters[s]=r)}async open(e){return await this.injectModalUi(),e?.uri&&Y.setUri(e.uri),e?.arguments&&e?.view==="Swap"?Fe.open({...e,data:{swap:e.arguments}}):Fe.open(e)}async close(){await this.injectModalUi(),Fe.close()}setLoading(e,s){Fe.setLoading(e,s)}async disconnect(e){await Y.disconnect(e)}getSIWX(){return k.state.siwx}getError(){return""}getChainId(){return p.state.activeCaipNetwork?.id}async switchNetwork(e){const s=this.getCaipNetworks().find(r=>r.id===e.id);if(!s){Ms.open(Nr.ALERT_ERRORS.SWITCH_NETWORK_NOT_FOUND,"error");return}await p.switchActiveNetwork(s)}getWalletProvider(){return p.state.activeChain?Se.state.providers[p.state.activeChain]:null}getWalletProviderType(){return Se.getProviderId(p.state.activeChain)}subscribeProviders(e){return Se.subscribeProviders(e)}getThemeMode(){return gt.state.themeMode}getThemeVariables(){return gt.state.themeVariables}setThemeMode(e){gt.setThemeMode(e),Nh(gt.state.themeMode)}setTermsConditionsUrl(e){k.setTermsConditionsUrl(e)}setPrivacyPolicyUrl(e){k.setPrivacyPolicyUrl(e)}setThemeVariables(e){gt.setThemeVariables(e),mI(gt.state.themeVariables)}subscribeTheme(e){return gt.subscribe(e)}getWalletInfo(){return F.state.connectedWalletInfo}getAccount(e){const s=B.getAuthConnector(e),r=p.getAccountData(e),i=p.state.activeChain,n=z.getConnectedConnectorId(e||i);if(r)return{allAccounts:r.allAccounts,caipAddress:r.caipAddress,address:X.getPlainAddress(r.caipAddress),isConnected:!!r.caipAddress,status:r.status,embeddedWalletInfo:s&&n===H.CONNECTOR_ID.AUTH?{user:r.user?{...r.user,username:z.getConnectedSocialUsername()}:void 0,authProvider:r.socialProvider||"email",accountType:r.preferredAccountTypes?.[e||i],isSmartAccountDeployed:!!r.smartAccountDeployed}:void 0}}subscribeAccount(e,s){const r=()=>{const i=this.getAccount(s);i&&e(i)};s?p.subscribeChainProp("accountState",r,s):p.subscribe(r),B.subscribe(r)}subscribeNetwork(e){return p.subscribe(({activeCaipNetwork:s})=>{e({caipNetwork:s,chainId:s?.id,caipNetworkId:s?.caipNetworkId})})}subscribeWalletInfo(e){return F.subscribeKey("connectedWalletInfo",e)}subscribeShouldUpdateToAddress(e){F.subscribeKey("shouldUpdateToAddress",e)}subscribeCaipNetworkChange(e){p.subscribeKey("activeCaipNetwork",e)}getState(){return As.state}subscribeState(e){return As.subscribe(e)}showErrorMessage(e){Lt.showError(e)}showSuccessMessage(e){Lt.showSuccess(e)}getEvent(){return{...Pe.state}}subscribeEvents(e){return Pe.subscribe(e)}replace(e){re.replace(e)}redirect(e){re.push(e)}popTransactionStack(e){re.popTransactionStack(e)}isOpen(){return Fe.state.open}isTransactionStackEmpty(){return re.state.transactionStack.length===0}static getInstance(){return this.instance}updateFeatures(e){k.setFeatures(e)}updateRemoteFeatures(e){k.setRemoteFeatures(e)}updateOptions(e){const r={...k.state||{},...e};k.setOptions(r)}setConnectMethodsOrder(e){k.setConnectMethodsOrder(e)}setWalletFeaturesOrder(e){k.setWalletFeaturesOrder(e)}setCollapseWallets(e){k.setCollapseWallets(e)}setSocialsOrder(e){k.setSocialsOrder(e)}getConnectMethodsOrder(){return Ra.getConnectOrderMethod(k.state.features,B.getConnectors())}addNetwork(e,s){if(this.chainAdapters&&!this.chainAdapters[e])throw new Error(`Adapter for namespace ${e} doesn't exist`);const r=this.extendCaipNetwork(s,this.options);this.getCaipNetworks().find(i=>i.id===r.id)||p.addNetwork(r)}removeNetwork(e,s){if(this.chainAdapters&&!this.chainAdapters[e])throw new Error(`Adapter for namespace ${e} doesn't exist`);this.getCaipNetworks().find(i=>i.id===s)&&p.removeNetwork(e,s)}}let Su=!1;class xh extends $I{async open(e){B.isConnected()||await super.open(e)}async close(){await super.close(),this.options.manualWCControl&&Y.finalizeWcConnection()}async syncIdentity(e){return Promise.resolve()}async syncBalance(e){return Promise.resolve()}async injectModalUi(){if(!Su&&X.isClient()){if(await Yo(()=>import("./basic-CLeG2Fx1.js"),__vite__mapDeps([5,6,1,2,3,4])),await Yo(()=>import("./w3m-modal-Dkca-GXY.js"),__vite__mapDeps([7,6,1,2,3,4])),!document.querySelector("w3m-modal")){const s=document.createElement("w3m-modal");!k.state.disableAppend&&!k.state.enableEmbedded&&document.body.insertAdjacentElement("beforeend",s)}Su=!0}}}const RI="1.7.8";function UI(t){return new xh({...t,basic:!0,sdkVersion:`html-core-${RI}`})}const vA=Object.freeze(Object.defineProperty({__proto__:null,AppKit:xh,createAppKit:UI},Symbol.toStringTag,{value:"Module"}));export{Ms as A,Lt as B,p as C,V as D,Pe as E,mA as F,X as G,Tf as H,H as I,bh as J,Ua as K,ze as L,Fe as M,Kr as N,k as O,zn as P,Y as Q,re as R,Ai as S,gt as T,z as U,ve as V,Ra as W,vA as X,Ec as a,Ef as b,tA as c,xf as d,eA as e,io as f,iA as g,rA as h,Et as i,Ze as j,Rr as k,wA as l,Wn as m,fA as n,yA as o,_e as p,bA as q,sA as r,Qe as s,Hu as t,Uu as u,Dt as v,gA as w,J1 as x,B as y,F as z};
|
|
896
|
+
`);super(o,s.cause?{cause:s.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=r,this.docsPath=i,this.metaMessages=s.metaMessages,this.name=s.name??this.name,this.shortMessage=e,this.version=_h}walk(e){return Sh(this,e)}}function Sh(t,e){return e?.(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?Sh(t.cause,e):e?null:t}class Ph extends Jr{constructor({size:e,targetSize:s,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${e}) exceeds padding size (${s}).`,{name:"SizeExceedsPaddingSizeError"})}}function oc(t,{dir:e,size:s=32}={}){return typeof t=="string"?yI(t,{dir:e,size:s}):bI(t,{dir:e,size:s})}function yI(t,{dir:e,size:s=32}={}){if(s===null)return t;const r=t.replace("0x","");if(r.length>s*2)throw new Ph({size:Math.ceil(r.length/2),targetSize:s,type:"hex"});return`0x${r[e==="right"?"padEnd":"padStart"](s*2,"0")}`}function bI(t,{dir:e,size:s=32}={}){if(s===null)return t;if(t.length>s)throw new Ph({size:t.length,targetSize:s,type:"bytes"});const r=new Uint8Array(s);for(let i=0;i<s;i++){const n=e==="right";r[n?i:s-i-1]=t[n?i:t.length-i-1]}return r}class vI extends Jr{constructor({max:e,min:s,signed:r,size:i,value:n}){super(`Number "${n}" is not in safe ${i?`${i*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${e?`(${s} to ${e})`:`(above ${s})`}`,{name:"IntegerOutOfRangeError"})}}class EI extends Jr{constructor({givenSize:e,maxSize:s}){super(`Size cannot exceed ${s} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}function Oh(t,{size:e}){if(Iu(t)>e)throw new EI({givenSize:Iu(t),maxSize:e})}const CI=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Au(t,e={}){return typeof t=="number"||typeof t=="bigint"?AI(t,e):typeof t=="string"?_I(t,e):typeof t=="boolean"?II(t,e):kh(t,e)}function II(t,e={}){const s=`0x${Number(t)}`;return typeof e.size=="number"?(Oh(s,{size:e.size}),oc(s,{size:e.size})):s}function kh(t,e={}){let s="";for(let i=0;i<t.length;i++)s+=CI[t[i]];const r=`0x${s}`;return typeof e.size=="number"?(Oh(r,{size:e.size}),oc(r,{dir:"right",size:e.size})):r}function AI(t,e={}){const{signed:s,size:r}=e,i=BigInt(t);let n;r?s?n=(1n<<BigInt(r)*8n-1n)-1n:n=2n**(BigInt(r)*8n)-1n:typeof t=="number"&&(n=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof n=="bigint"&&s?-n-1n:0;if(n&&i>n||i<o){const c=typeof t=="bigint"?"n":"";throw new vI({max:n?`${n}${c}`:void 0,min:`${o}${c}`,signed:s,size:r,value:`${t}${c}`})}const a=`0x${(s&&i<0?(1n<<BigInt(r*8))+BigInt(i):i).toString(16)}`;return r?oc(a,{size:r}):a}const NI=new TextEncoder;function _I(t,e={}){const s=NI.encode(t);return kh(s,e)}const bi={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"]};function bn(t){return{formatters:void 0,fees:void 0,serializers:void 0,...t}}const Nu=bn({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"}),_u=bn({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"});bn({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"});bn({id:"000000000019d6689c085ae165831e93",caipNetworkId:"bip122:000000000019d6689c085ae165831e93",chainNamespace:"bip122",name:"Bitcoin",nativeCurrency:{name:"Bitcoin",symbol:"BTC",decimals:8},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}}});bn({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 SI={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"]},Hn={getMethodsByChainNamespace(t){return SI[t]||[]},createDefaultNamespace(t){return{methods:this.getMethodsByChainNamespace(t),events:["accountsChanged","chainChanged"],chains:[],rpcMap:{}}},applyNamespaceOverrides(t,e){if(!e)return{...t};const s={...t},r=new Set;if(e.methods&&Object.keys(e.methods).forEach(i=>r.add(i)),e.chains&&Object.keys(e.chains).forEach(i=>r.add(i)),e.events&&Object.keys(e.events).forEach(i=>r.add(i)),e.rpcMap&&Object.keys(e.rpcMap).forEach(i=>{const[n]=i.split(":");n&&r.add(n)}),r.forEach(i=>{s[i]||(s[i]=this.createDefaultNamespace(i))}),e.methods&&Object.entries(e.methods).forEach(([i,n])=>{s[i]&&(s[i].methods=n)}),e.chains&&Object.entries(e.chains).forEach(([i,n])=>{s[i]&&(s[i].chains=n)}),e.events&&Object.entries(e.events).forEach(([i,n])=>{s[i]&&(s[i].events=n)}),e.rpcMap){const i=new Set;Object.entries(e.rpcMap).forEach(([n,o])=>{const[a,c]=n.split(":");!a||!c||!s[a]||(s[a].rpcMap||(s[a].rpcMap={}),i.has(a)||(s[a].rpcMap={},i.add(a)),s[a].rpcMap[c]=o)})}return s},createNamespaces(t,e){const s=t.reduce((r,i)=>{const{id:n,chainNamespace:o,rpcUrls:a}=i,c=a.default.http[0];r[o]||(r[o]=this.createDefaultNamespace(o));const l=`${o}:${n}`,u=r[o];switch(u.chains.push(l),l){case Nu.caipNetworkId:u.chains.push(Nu.deprecatedCaipNetworkId);break;case _u.caipNetworkId:u.chains.push(_u.deprecatedCaipNetworkId);break}return u?.rpcMap&&c&&(u.rpcMap[n]=c),r},{});return this.applyNamespaceOverrides(s,e)},resolveReownName:async t=>{const e=await Ii.resolveName(t);return(Object.values(e?.addresses)||[])[0]?.address||!1},getChainsFromNamespaces(t={}){return Object.values(t).flatMap(e=>{const s=e.chains||[],r=e.accounts.map(i=>{const[n,o]=i.split(":");return`${n}:${o}`});return Array.from(new Set([...s,...r]))})},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,s){for(const r of[...e,...s])if(r.includes("*")){const n=`^${r.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&").replace(/\\\*/gu,".*")}$`;if(new RegExp(n,"u").test(t))return!0}else try{if(new URL(r).origin===t)return!0}catch{if(r===t)return!0}return!1}};class Th{constructor({provider:e,namespace:s}){this.id=H.CONNECTOR_ID.WALLET_CONNECT,this.name=Zn.ConnectorNamesMap[H.CONNECTOR_ID.WALLET_CONNECT],this.type="WALLET_CONNECT",this.imageId=Zn.ConnectorImageIds[H.CONNECTOR_ID.WALLET_CONNECT],this.getCaipNetworks=p.getCaipNetworks.bind(p),this.caipNetworks=this.getCaipNetworks(),this.provider=e,this.chain=s}get chains(){return this.getCaipNetworks()}async connectWalletConnect(){if(!await this.authenticate()){const s=this.getCaipNetworks(),r=k.state.universalProviderConfigOverride,i=Hn.createNamespaces(s,r);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(s=>s.caipNetworkId);return Ai.universalProviderAuthenticate({universalProvider:this.provider,chains:e,methods:PI})}}const PI=["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 OI{constructor(e){this.availableConnectors=[],this.eventListeners=new Map,this.getCaipNetworks=s=>p.getCaipNetworks(s),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:H.CONNECTOR_ID.AUTH,type:"AUTH",name:H.CONNECTOR_NAMES.AUTH,provider:e,imageId:Zn.ConnectorImageIds[H.CONNECTOR_ID.AUTH],chain:this.namespace,chains:[]})}addConnector(...e){const s=new Set;this.availableConnectors=[...e,...this.availableConnectors].filter(r=>s.has(r.id)?!1:(s.add(r.id),!0)),this.emit("connectors",this.availableConnectors)}setStatus(e,s){F.setStatus(e,s)}on(e,s){this.eventListeners.has(e)||this.eventListeners.set(e,new Set),this.eventListeners.get(e)?.add(s)}off(e,s){const r=this.eventListeners.get(e);r&&r.delete(s)}removeAllEventListeners(){this.eventListeners.forEach(e=>{e.clear()})}emit(e,s){const r=this.eventListeners.get(e);r&&r.forEach(i=>i(s))}async connectWalletConnect(e){return{clientId:(await this.getWalletConnectConnector().connectWalletConnect()).clientId}}async switchNetwork(e){const{caipNetwork:s,providerType:r}=e;if(!e.provider)return;const i="provider"in e.provider?e.provider.provider:e.provider;if(r==="WALLET_CONNECT"){i.setDefaultChain(s.caipNetworkId);return}if(i&&r==="AUTH"){const n=i,o=F.state.preferredAccountTypes?.[s.chainNamespace];await n.switchNetwork(s.caipNetworkId);const a=await n.getUser({chainId:s.caipNetworkId,preferredAccountType:o});this.emit("switchNetwork",a)}}getWalletConnectConnector(){const e=this.connectors.find(s=>s instanceof Th);if(!e)throw new Error("WalletConnectConnector not found");return e}}class kI extends OI{setUniversalProvider(e){this.addConnector(new Th({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}){const r=this.provider?.session?.namespaces?.[e]?.accounts?.map(i=>{const[,,n]=i.split(":");return n}).filter((i,n,o)=>o.indexOf(i)===n)||[];return Promise.resolve({accounts:r.map(i=>X.createAccount(e,i,e==="bip122"?"payment":"eoa"))})}async syncConnectors(){return Promise.resolve()}async getBalance(e){if(!(e.caipNetwork&&ve.BALANCE_SUPPORTED_CHAINS.includes(e.caipNetwork?.chainNamespace))||e.caipNetwork?.testnet)return{balance:"0.00",symbol:e.caipNetwork?.nativeCurrency.symbol||""};if(F.state.balanceLoading&&e.chainId===p.state.activeCaipNetwork?.id)return{balance:F.state.balance||"0.00",symbol:F.state.balanceSymbol||""};const i=(await F.fetchTokenBalance()).find(n=>n.chainId===`${e.caipNetwork?.chainNamespace}:${e.chainId}`&&n.symbol===e.caipNetwork?.nativeCurrency.symbol);return{balance:i?.quantity.numeric||"0.00",symbol:i?.symbol||e.caipNetwork?.nativeCurrency.symbol||""}}async signMessage(e){const{provider:s,message:r,address:i}=e;if(!s)throw new Error("UniversalAdapter:signMessage - provider is undefined");let n="";return p.state.activeCaipNetwork?.chainNamespace===H.CHAIN.SOLANA?n=(await s.request({method:"solana_signMessage",params:{message:Pu.encode(new TextEncoder().encode(r)),pubkey:i}},p.state.activeCaipNetwork?.caipNetworkId)).signature:n=await s.request({method:"personal_sign",params:[r,i]},p.state.activeCaipNetwork?.caipNetworkId),{signature:n}}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){const{caipNetwork:s}=e,r=this.getWalletConnectConnector();if(s.chainNamespace===H.CHAIN.EVM)try{await r.provider?.request({method:"wallet_switchEthereumChain",params:[{chainId:Au(s.id)}]})}catch(i){if(i.code===bi.ERROR_CODE_UNRECOGNIZED_CHAIN_ID||i.code===bi.ERROR_INVALID_CHAIN_ID||i.code===bi.ERROR_CODE_DEFAULT||i?.data?.originalError?.code===bi.ERROR_CODE_UNRECOGNIZED_CHAIN_ID)try{await r.provider?.request({method:"wallet_addEthereumChain",params:[{chainId:Au(s.id),rpcUrls:[s?.rpcUrls.chainDefault?.http],chainName:s.name,nativeCurrency:s.nativeCurrency,blockExplorerUrls:[s.blockExplorers?.default.url]}]})}catch{throw new Error("Chain is not supported")}}r.provider.setDefaultChain(s.caipNetworkId)}getWalletConnectProvider(){return this.connectors.find(r=>r.type==="WALLET_CONNECT")?.provider}}const TI=["email","socials","swaps","onramp","activity","reownBranding"],Ln={email:{apiFeatureName:"social_login",localFeatureName:"email",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:t=>{if(!t?.config)return!1;const e=t.config;return!!t.isEnabled&&e.includes("email")},processFallback:t=>t===void 0?ve.DEFAULT_REMOTE_FEATURES.email:!!t},socials:{apiFeatureName:"social_login",localFeatureName:"socials",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:t=>{if(!t?.config)return!1;const e=t.config;return t.isEnabled&&e.length>0?e.filter(s=>s!=="email"):!1},processFallback:t=>t===void 0?ve.DEFAULT_REMOTE_FEATURES.socials:typeof t=="boolean"?t?ve.DEFAULT_REMOTE_FEATURES.socials:!1:t},swaps:{apiFeatureName:"swap",localFeatureName:"swaps",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:t=>{if(!t?.config)return!1;const e=t.config;return t.isEnabled&&e.length>0?e:!1},processFallback:t=>t===void 0?ve.DEFAULT_REMOTE_FEATURES.swaps:typeof t=="boolean"?t?ve.DEFAULT_REMOTE_FEATURES.swaps:!1:t},onramp:{apiFeatureName:"onramp",localFeatureName:"onramp",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:t=>{if(!t?.config)return!1;const e=t.config;return t.isEnabled&&e.length>0?e:!1},processFallback:t=>t===void 0?ve.DEFAULT_REMOTE_FEATURES.onramp:typeof t=="boolean"?t?ve.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?ve.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?ve.DEFAULT_REMOTE_FEATURES.reownBranding:!!t}},xI={localSettingsOverridden:new Set,getApiConfig(t,e){return e?.find(s=>s.id===t)},addWarning(t,e){if(t!==void 0){const s=Ln[e],r=s.isLegacy?`"features.${s.localFeatureName}" (now "${e}")`:`"features.${e}"`;this.localSettingsOverridden.add(r)}},processFeature(t,e,s,r,i){const n=Ln[t],o=e[n.localFeatureName];if(i&&!n.isAvailableOnBasic)return!1;if(r){const a=this.getApiConfig(n.apiFeatureName,s);return a?.config===null?this.processFallbackFeature(t,o):a?.config?(o!==void 0&&this.addWarning(o,t),this.processApiFeature(t,a)):!1}return this.processFallbackFeature(t,o)},processApiFeature(t,e){return Ln[t].processApi(e)},processFallbackFeature(t,e){return Ln[t].processFallback(e)},async fetchRemoteFeatures(t){const e=t.basic??!1,s=t.features||{};this.localSettingsOverridden.clear();let r=null,i=!1;try{r=await V.fetchProjectConfig(),i=r!=null}catch(o){console.warn("[Reown Config] Failed to fetch remote project configuration. Using local/default values.",o)}const n=i&&!e?ve.DEFAULT_REMOTE_FEATURES:ve.DEFAULT_REMOTE_FEATURES_DISABLED;try{for(const o of TI){const a=this.processFeature(o,s,r,i,e);Object.assign(n,{[o]:a})}}catch(o){return console.warn("[Reown Config] Failed to process the configuration from Cloud. Using default values.",o),ve.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.`;Ms.open({shortMessage:"Local configuration ignored",longMessage:`[Reown Config Notice] ${o}`},"warning")}return n}};class $I{constructor(e){this.chainNamespaces=[],this.remoteFeatures={},this.reportedAlertErrors={},this.getCaipNetwork=(s,r)=>{if(s){const i=p.getNetworkData(s)?.requestedCaipNetworks?.find(a=>a.id===r);if(i)return i;const n=p.getNetworkData(s)?.caipNetwork;return n||p.getRequestedCaipNetworks(s).filter(a=>a.chainNamespace===s)?.[0]}return p.state.activeCaipNetwork||this.defaultCaipNetwork},this.getCaipNetworkId=()=>{const s=this.getCaipNetwork();if(s)return s.id},this.getCaipNetworks=s=>p.getCaipNetworks(s),this.getActiveChainNamespace=()=>p.state.activeChain,this.setRequestedCaipNetworks=(s,r)=>{p.setRequestedCaipNetworks(s,r)},this.getApprovedCaipNetworkIds=()=>p.getAllApprovedCaipNetworkIds(),this.getCaipAddress=s=>p.state.activeChain===s||!s?p.state.activeCaipAddress:p.getAccountProp("caipAddress",s),this.setClientId=s=>{J.setClientId(s)},this.getProvider=s=>Se.getProvider(s),this.getProviderType=s=>Se.getProviderId(s),this.getPreferredAccountType=s=>F.state.preferredAccountTypes?.[s],this.setCaipAddress=(s,r)=>{F.setCaipAddress(s,r),s&&k.state.enableEmbedded&&this.close()},this.setBalance=(s,r,i)=>{F.setBalance(s,r,i)},this.setProfileName=(s,r)=>{F.setProfileName(s,r)},this.setProfileImage=(s,r)=>{F.setProfileImage(s,r)},this.setUser=(s,r)=>{F.setUser(s,r)},this.resetAccount=s=>{F.resetAccount(s)},this.setCaipNetwork=s=>{p.setActiveCaipNetwork(s)},this.setCaipNetworkOfNamespace=(s,r)=>{p.setChainNetworkData(r,{caipNetwork:s})},this.setAllAccounts=(s,r)=>{F.setAllAccounts(s,r),k.setHasMultipleAddresses(s?.length>1)},this.setStatus=(s,r)=>{F.setStatus(s,r),B.isConnected()?z.setConnectionStatus("connected"):z.setConnectionStatus("disconnected")},this.getAddressByChainNamespace=s=>p.getAccountProp("address",s),this.setConnectors=s=>{const r=[...B.state.allConnectors,...s];B.setConnectors(r)},this.setConnections=(s,r)=>{Y.setConnections(s,r)},this.fetchIdentity=s=>J.fetchIdentity(s),this.getReownName=s=>Ii.getNamesForAddress(s),this.getConnectors=()=>B.getConnectors(),this.getConnectorImage=s=>Uu.getConnectorImage(s),this.setConnectedWalletInfo=(s,r)=>{const i=Se.getProviderId(r),n=s?{...s,type:i}:void 0;F.setConnectedWalletInfo(n,r)},this.getIsConnectedState=()=>!!p.state.activeCaipAddress,this.addAddressLabel=(s,r,i)=>{F.addAddressLabel(s,r,i)},this.removeAddressLabel=(s,r)=>{F.removeAddressLabel(s,r)},this.getAddress=s=>p.state.activeChain===s||!s?F.state.address:p.getAccountProp("address",s),this.setApprovedCaipNetworksData=s=>p.setApprovedCaipNetworksData(s),this.resetNetwork=s=>{p.resetNetwork(s)},this.addConnector=s=>{B.addConnector(s)},this.resetWcConnection=()=>{Y.resetWcConnection()},this.setAddressExplorerUrl=(s,r)=>{F.setAddressExplorerUrl(s,r)},this.setSmartAccountDeployed=(s,r)=>{F.setSmartAccountDeployed(s,r)},this.setSmartAccountEnabledNetworks=(s,r)=>{p.setSmartAccountEnabledNetworks(s,r)},this.setPreferredAccountType=(s,r)=>{F.setPreferredAccountType(s,r)},this.setEIP6963Enabled=s=>{k.setEIP6963Enabled(s)},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,s){const r=e?.map(n=>n.namespace).filter(n=>!!n);if(r?.length)return[...new Set(r)];const i=s?.map(n=>n.chainNamespace);return[...new Set(i)]}async initialize(e){this.initializeProjectSettings(e),this.initControllers(e),await this.initChainAdapters(),this.sendInitializeEvent(e),await this.syncExistingConnection(),this.remoteFeatures=await xI.fetchRemoteFeatures(e),k.setRemoteFeatures(this.remoteFeatures),this.remoteFeatures.onramp&&ta.setOnrampProviders(this.remoteFeatures.onramp),(k.state.remoteFeatures?.email||Array.isArray(k.state.remoteFeatures?.socials)&&k.state.remoteFeatures?.socials.length>0)&&await this.checkAllowedOrigins()}async checkAllowedOrigins(){const e=await V.fetchAllowedOrigins();if(e&&X.isClient()){const s=window.location.origin;Hn.isOriginAllowed(s,e,bi.DEFAULT_ALLOWED_ANCESTORS)||Ms.open(Nr.ALERT_ERRORS.INVALID_APP_CONFIGURATION,"error")}else Ms.open(Nr.ALERT_ERRORS.PROJECT_ID_NOT_CONFIGURED,"error")}sendInitializeEvent(e){const{...s}=e;delete s.adapters,delete s.universalProvider,Pe.sendEvent({type:"track",event:"INITIALIZE",properties:{...s,networks:e.networks.map(r=>r.id),siweConfig:{options:e.siweConfig?.options||{}}}})}initControllers(e){this.initializeOptionsController(e),this.initializeChainController(e),this.initializeThemeController(e),this.initializeConnectionController(e),this.initializeConnectorController()}initializeThemeController(e){e.themeMode&>.setThemeMode(e.themeMode),e.themeVariables&>.setThemeVariables(e.themeVariables)}initializeChainController(e){if(!this.connectionControllerClient||!this.networkControllerClient)throw new Error("ConnectionControllerClient and NetworkControllerClient must be set");p.initialize(e.adapters??[],this.caipNetworks,{connectionControllerClient:this.connectionControllerClient,networkControllerClient:this.networkControllerClient});const s=this.getDefaultNetwork();s&&p.setActiveCaipNetwork(s)}initializeConnectionController(e){Y.setWcBasic(e.basic??!1)}initializeConnectorController(){B.initialize(this.chainNamespaces)}initializeProjectSettings(e){k.setProjectId(e.projectId),k.setSdkVersion(e.sdkVersion)}initializeOptionsController(e){k.setDebug(e.debug!==!1),k.setEnableWalletConnect(e.enableWalletConnect!==!1),k.setEnableWalletGuide(e.enableWalletGuide!==!1),k.setEnableWallets(e.enableWallets!==!1),k.setEIP6963Enabled(e.enableEIP6963!==!1),k.setEnableNetworkSwitch(e.enableNetworkSwitch!==!1),k.setEnableAuthLogger(e.enableAuthLogger!==!1),k.setCustomRpcUrls(e.customRpcUrls),k.setEnableEmbedded(e.enableEmbedded),k.setAllWallets(e.allWallets),k.setIncludeWalletIds(e.includeWalletIds),k.setExcludeWalletIds(e.excludeWalletIds),k.setFeaturedWalletIds(e.featuredWalletIds),k.setTokens(e.tokens),k.setTermsConditionsUrl(e.termsConditionsUrl),k.setPrivacyPolicyUrl(e.privacyPolicyUrl),k.setCustomWallets(e.customWallets),k.setFeatures(e.features),k.setAllowUnsupportedChain(e.allowUnsupportedChain),k.setUniversalProviderConfigOverride(e.universalProviderConfigOverride),k.setPreferUniversalLinks(e.experimental_preferUniversalLinks),k.setDefaultAccountTypes(e.defaultAccountTypes);const s=z.getPreferredAccountTypes()||{},r={...k.state.defaultAccountTypes,...s};F.setPreferredAccountTypes(r);const i=this.getDefaultMetaData();if(!e.metadata&&i&&(e.metadata=i),k.setMetadata(e.metadata),k.setDisableAppend(e.disableAppend),k.setEnableEmbedded(e.enableEmbedded),k.setSIWX(e.siwx),!e.projectId){Ms.open(Nr.ALERT_ERRORS.PROJECT_ID_NOT_CONFIGURED,"error");return}if(e.adapters?.find(o=>o.namespace===H.CHAIN.EVM)&&e.siweConfig){if(e.siwx)throw new Error("Cannot set both `siweConfig` and `siwx` options");k.setSIWX(e.siweConfig.mapToSIWX())}}getDefaultMetaData(){return X.isClient()?{name:document.getElementsByTagName("title")?.[0]?.textContent||"",description:document.querySelector('meta[property="og:description"]')?.content||"",url:window.location.origin,icons:[document.querySelector('link[rel~="icon"]')?.href||""]}:null}setUnsupportedNetwork(e){const s=this.getActiveChainNamespace();if(s){const r=Sr.getUnsupportedNetwork(`${s}:${e}`);p.setActiveCaipNetwork(r)}}getDefaultNetwork(){return Sr.getCaipNetworkFromStorage(this.defaultCaipNetwork)}extendCaipNetwork(e,s){return Sr.extendCaipNetwork(e,{customNetworkImageUrls:s.chainImages,projectId:s.projectId})}extendCaipNetworks(e){return Sr.extendCaipNetworks(e.networks,{customNetworkImageUrls:e.chainImages,customRpcUrls:e.customRpcUrls,projectId:e.projectId})}extendDefaultCaipNetwork(e){const s=e.networks.find(i=>i.id===e.defaultNetwork?.id);return s?Sr.extendCaipNetwork(s,{customNetworkImageUrls:e.chainImages,customRpcUrls:e.customRpcUrls,projectId:e.projectId}):void 0}async disconnectNamespace(e){try{const s=this.getAdapter(e),r=Se.getProvider(e),i=Se.getProviderId(e),{caipAddress:n}=p.getAccountData(e)||{};this.setLoading(!0,e),n&&s?.disconnect&&await s.disconnect({provider:r,providerType:i}),z.removeConnectedNamespace(e),Se.resetChain(e),this.setUser(void 0,e),this.setStatus("disconnected",e),this.setConnectedWalletInfo(void 0,e),B.removeConnectorId(e),p.resetAccount(e),p.resetNetwork(e),this.setLoading(!1,e)}catch(s){throw this.setLoading(!1,e),new Error(`Failed to disconnect chain ${e}: ${s.message}`)}}createClients(){this.connectionControllerClient={connectWalletConnect:async()=>{const e=p.state.activeChain,s=this.getAdapter(e),r=this.getCaipNetwork(e)?.id;if(!s)throw new Error("Adapter not found");const i=await s.connectWalletConnect(r);this.close(),this.setClientId(i?.clientId||null),z.setConnectedNamespaces([...p.state.chains.keys()]),this.chainNamespaces.forEach(n=>{B.setConnectorId(ws.CONNECTOR_TYPE_WALLET_CONNECT,n)}),await this.syncWalletConnectAccount()},connectExternal:async({id:e,info:s,type:r,provider:i,chain:n,caipNetwork:o,socialUri:a})=>{const c=p.state.activeChain,l=n||c,u=this.getAdapter(l);if(n&&n!==c&&!o){const m=this.getCaipNetworks().find(g=>g.chainNamespace===n);m&&this.setCaipNetwork(m)}if(!u)throw new Error("Adapter not found");const d=this.getCaipNetwork(l),h=await u.connect({id:e,info:s,type:r,provider:i,socialUri:a,chainId:o?.id||d?.id,rpcUrl:o?.rpcUrls?.default?.http?.[0]||d?.rpcUrls?.default?.http?.[0]});if(!h)return;z.addConnectedNamespace(l),this.syncProvider({...h,chainNamespace:l});const f=F.state.allAccounts,{accounts:w}=f?.length>0?{accounts:[...f]}:await u.getAccounts({namespace:l,id:e});this.setAllAccounts(w,l),this.setStatus("connected",l),this.syncConnectedWalletInfo(l)},reconnectExternal:async({id:e,info:s,type:r,provider:i})=>{const n=p.state.activeChain,o=this.getAdapter(n);o?.reconnect&&(await o?.reconnect({id:e,info:s,type:r,provider:i,chainId:this.getCaipNetwork()?.id}),z.addConnectedNamespace(n),this.syncConnectedWalletInfo(n))},disconnect:async e=>{const s=b1(e);try{const r=await Promise.allSettled(s.map(async([n])=>this.disconnectNamespace(n)));de.resetSend(),Y.resetWcConnection(),await Ai.clearSessions(),B.setFilterByNamespace(void 0);const i=r.filter(n=>n.status==="rejected");if(i.length>0)throw new Error(i.map(n=>n.reason.message).join(", "));z.deleteConnectedSocialProvider(),Pe.sendEvent({type:"track",event:"DISCONNECT_SUCCESS",properties:{namespace:e||"all"}})}catch(r){throw new Error(`Failed to disconnect chains: ${r.message}`)}},checkInstalled:e=>e?e.some(s=>!!window.ethereum?.[String(s)]):!!window.ethereum,signMessage:async e=>(await this.getAdapter(p.state.activeChain)?.signMessage({message:e,address:F.state.address,provider:Se.getProvider(p.state.activeChain)}))?.signature||"",sendTransaction:async e=>{const s=e.chainNamespace;if(ve.SEND_SUPPORTED_NAMESPACES.includes(s)){const r=this.getAdapter(p.state.activeChain),i=Se.getProvider(s);return(await r?.sendTransaction({...e,caipNetwork:this.getCaipNetwork(),provider:i}))?.hash||""}return""},estimateGas:async e=>{if(e.chainNamespace===H.CHAIN.EVM){const s=this.getAdapter(p.state.activeChain),r=Se.getProvider(p.state.activeChain),i=this.getCaipNetwork();if(!i)throw new Error("CaipNetwork is undefined");return(await s?.estimateGas({...e,provider:r,caipNetwork:i}))?.gas||0n}return 0n},getEnsAvatar:async()=>(await this.syncIdentity({address:F.state.address,chainId:Number(this.getCaipNetwork()?.id),chainNamespace:p.state.activeChain}),F.state.profileImage||!1),getEnsAddress:async e=>await Hn.resolveReownName(e),writeContract:async e=>{const s=this.getAdapter(p.state.activeChain),r=this.getCaipNetwork(),i=this.getCaipAddress(),n=Se.getProvider(p.state.activeChain);if(!r||!i)throw new Error("CaipNetwork or CaipAddress is undefined");return(await s?.writeContract({...e,caipNetwork:r,provider:n,caipAddress:i}))?.hash},parseUnits:(e,s)=>this.getAdapter(p.state.activeChain)?.parseUnits({value:e,decimals:s})??0n,formatUnits:(e,s)=>this.getAdapter(p.state.activeChain)?.formatUnits({value:e,decimals:s})??"0",getCapabilities:async e=>await this.getAdapter(p.state.activeChain)?.getCapabilities(e),grantPermissions:async e=>await this.getAdapter(p.state.activeChain)?.grantPermissions(e),revokePermissions:async e=>{const s=this.getAdapter(p.state.activeChain);return s?.revokePermissions?await s.revokePermissions(e):"0x"},walletGetAssets:async e=>await this.getAdapter(p.state.activeChain)?.walletGetAssets(e)??{},updateBalance:e=>{const s=this.getCaipNetwork(e);!s||!F.state.address||this.updateNativeBalance(F.state.address,s?.id,e)}},this.networkControllerClient={switchCaipNetwork:async e=>await this.switchCaipNetwork(e),getApprovedCaipNetworksData:async()=>this.getApprovedCaipNetworksData()},Y.setClient(this.connectionControllerClient)}getApprovedCaipNetworksData(){if(Se.getProviderId(p.state.activeChain)===ws.CONNECTOR_TYPE_WALLET_CONNECT){const s=this.universalProvider?.session?.namespaces;return{supportsAllNetworks:this.universalProvider?.session?.peer?.metadata.name==="MetaMask Wallet",approvedCaipNetworkIds:this.getChainsFromNamespaces(s)}}return{supportsAllNetworks:!0,approvedCaipNetworkIds:[]}}async switchCaipNetwork(e){if(!e)return;const s=e.chainNamespace;if(this.getAddressByChainNamespace(e.chainNamespace)){const i=Se.getProvider(s),n=Se.getProviderId(s);if(e.chainNamespace===p.state.activeChain)await this.getAdapter(s)?.switchNetwork({caipNetwork:e,provider:i,providerType:n});else if(this.setCaipNetwork(e),n===ws.CONNECTOR_TYPE_WALLET_CONNECT)this.syncWalletConnectAccount();else{const o=this.getAddressByChainNamespace(s);o&&this.syncAccount({address:o,chainId:e.id,chainNamespace:s})}}else this.setCaipNetwork(e)}getChainsFromNamespaces(e={}){return Object.values(e).flatMap(s=>{const r=s.chains||[],i=s.accounts.map(n=>{const{chainId:o,chainNamespace:a}=hs.parseCaipAddress(n);return`${a}:${o}`});return Array.from(new Set([...r,...i]))})}createAdapters(e){return this.createClients(),this.chainNamespaces.reduce((s,r)=>{const i=e?.find(n=>n.namespace===r);return i?(i.construct({namespace:r,projectId:this.options?.projectId,networks:this.getCaipNetworks()}),s[r]=i):s[r]=new kI({namespace:r,networks:this.getCaipNetworks()}),s},{})}async initChainAdapter(e){this.onConnectors(e),this.listenAdapter(e),await this.chainAdapters?.[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){this.getAdapter(e)?.on("connectors",this.setConnectors.bind(this))}listenAdapter(e){const s=this.getAdapter(e);if(!s)return;const r=z.getConnectionStatus();r==="connected"?this.setStatus("connecting",e):r==="disconnected"?(z.clearAddressCache(),this.setStatus(r,e)):this.setStatus(r,e),s.on("switchNetwork",({address:i,chainId:n})=>{const o=this.getCaipNetworks().find(l=>l.id===n||l.caipNetworkId===n),a=p.state.activeChain===e,c=p.getAccountProp("address",e);if(o){const l=a&&i?i:c;l&&this.syncAccount({address:l,chainId:o.id,chainNamespace:e})}else this.setUnsupportedNetwork(n)}),s.on("disconnect",this.disconnect.bind(this,e)),s.on("connections",i=>{this.setConnections(i,e)}),s.on("pendingTransactions",()=>{const i=F.state.address,n=p.state.activeCaipNetwork;!i||!n?.id||this.updateNativeBalance(i,n.id,n.chainNamespace)}),s.on("accountChanged",({address:i,chainId:n})=>{const o=p.state.activeChain===e;o&&n?this.syncAccount({address:i,chainId:n,chainNamespace:e}):o&&p.state.activeCaipNetwork?.id?this.syncAccount({address:i,chainId:p.state.activeCaipNetwork?.id,chainNamespace:e}):this.syncAccountInfo(i,n,e),this.syncAllAccounts(e)})}async createUniversalProviderForAdapter(e){await this.getUniversalProvider(),this.universalProvider&&this.chainAdapters?.[e]?.setUniversalProvider?.(this.universalProvider)}async syncExistingConnection(){await Promise.allSettled(this.chainNamespaces.map(e=>this.syncNamespaceConnection(e)))}async syncNamespaceConnection(e){try{e===H.CHAIN.EVM&&X.isSafeApp()&&B.setConnectorId(H.CONNECTOR_ID.SAFE,e);const s=B.getConnectorId(e);switch(this.setStatus("connecting",e),s){case H.CONNECTOR_ID.WALLET_CONNECT:await this.syncWalletConnectAccount();break;case H.CONNECTOR_ID.AUTH:break;default:await this.syncAdapterConnection(e)}}catch(s){console.warn("AppKit couldn't sync existing connection",s),this.setStatus("disconnected",e)}}async syncAdapterConnection(e){const s=this.getAdapter(e),r=B.getConnectorId(e),i=this.getCaipNetwork(e),o=B.getConnectors(e).find(a=>a.id===r);try{if(!s||!o)throw new Error(`Adapter or connector not found for namespace ${e}`);if(!i?.id)throw new Error("CaipNetwork not found");const a=await s?.syncConnection({namespace:e,id:o.id,chainId:i.id,rpcUrl:i?.rpcUrls?.default?.http?.[0]});if(a){const c=await s?.getAccounts({namespace:e,id:o.id});c&&c.accounts.length>0?this.setAllAccounts(c.accounts,e):this.setAllAccounts([X.createAccount(e,a.address,"eoa")],e),this.syncProvider({...a,chainNamespace:e}),await this.syncAccount({...a,chainNamespace:e}),this.setStatus("connected",e)}else this.setStatus("disconnected",e)}catch{this.setStatus("disconnected",e)}}async syncWalletConnectAccount(){const e=this.chainNamespaces.map(async s=>{const r=this.getAdapter(s),i=this.universalProvider?.session?.namespaces?.[s]?.accounts||[],n=p.state.activeCaipNetwork?.id,o=i.find(a=>{const{chainId:c}=hs.parseCaipAddress(a);return c===n?.toString()})||i[0];if(o){const a=hs.validateCaipAddress(o),{chainId:c,address:l}=hs.parseCaipAddress(a);if(Se.setProviderId(s,ws.CONNECTOR_TYPE_WALLET_CONNECT),this.caipNetworks&&p.state.activeCaipNetwork&&r?.namespace!==H.CHAIN.EVM){const u=r?.getWalletConnectProvider({caipNetworks:this.getCaipNetworks(),provider:this.universalProvider,activeCaipNetwork:p.state.activeCaipNetwork});Se.setProvider(s,u)}else Se.setProvider(s,this.universalProvider);B.setConnectorId(H.CONNECTOR_ID.WALLET_CONNECT,s),z.addConnectedNamespace(s),this.syncWalletConnectAccounts(s),await this.syncAccount({address:l,chainId:c,chainNamespace:s})}else this.setStatus("disconnected",s);this.syncConnectedWalletInfo(s),await p.setApprovedCaipNetworksData(s)});await Promise.all(e)}syncWalletConnectAccounts(e){const s=this.universalProvider?.session?.namespaces?.[e]?.accounts?.map(r=>{const{address:i}=hs.parseCaipAddress(r);return i}).filter((r,i,n)=>n.indexOf(r)===i);s&&this.setAllAccounts(s.map(r=>X.createAccount(e,r,e==="bip122"?"payment":"eoa")),e)}syncProvider({type:e,provider:s,id:r,chainNamespace:i}){Se.setProviderId(i,e),Se.setProvider(i,s),B.setConnectorId(r,i)}async syncAllAccounts(e){const s=B.getConnectorId(e);if(!s)return;const i=await this.getAdapter(e)?.getAccounts({namespace:e,id:s});i&&i.accounts.length>0&&this.setAllAccounts(i.accounts,e)}async syncAccount(e){const s=e.chainNamespace===p.state.activeChain,r=p.getCaipNetworkByNamespace(e.chainNamespace,e.chainId),{address:i,chainId:n,chainNamespace:o}=e,{chainId:a}=z.getActiveNetworkProps(),c=n||a,l=p.state.activeCaipNetwork?.name===H.UNSUPPORTED_NETWORK_NAME,u=p.getNetworkProp("supportsAllNetworks",o);if(this.setStatus("connected",o),!(l&&!u)&&c){let d=this.getCaipNetworks().find(w=>w.id.toString()===c.toString()),h=this.getCaipNetworks().find(w=>w.chainNamespace===o);if(!u&&!d&&!h){const w=this.getApprovedCaipNetworkIds()||[],m=w.find(y=>hs.parseCaipNetworkId(y)?.chainId===c.toString()),g=w.find(y=>hs.parseCaipNetworkId(y)?.chainNamespace===o);d=this.getCaipNetworks().find(y=>y.caipNetworkId===m),h=this.getCaipNetworks().find(y=>y.caipNetworkId===g||"deprecatedCaipNetworkId"in y&&y.deprecatedCaipNetworkId===g)}const f=d||h;f?.chainNamespace===p.state.activeChain?k.state.enableNetworkSwitch&&!k.state.allowUnsupportedChain&&p.state.activeCaipNetwork?.name===H.UNSUPPORTED_NETWORK_NAME?p.showUnsupportedChainUI():this.setCaipNetwork(f):s||r&&this.setCaipNetworkOfNamespace(r,o),this.syncConnectedWalletInfo(o),Za.isLowerCaseMatch(i,F.state.address)||this.syncAccountInfo(i,f?.id,o),s?await this.syncBalance({address:i,chainId:f?.id,chainNamespace:o}):await this.syncBalance({address:i,chainId:r?.id,chainNamespace:o})}}async syncAccountInfo(e,s,r){const i=this.getCaipAddress(r),n=s||i?.split(":")[1];if(!n)return;const o=`${r}:${n}:${e}`;this.setCaipAddress(o,r),await this.syncIdentity({address:e,chainId:n,chainNamespace:r})}async syncReownName(e,s){try{const r=await this.getReownName(e);if(r[0]){const i=r[0];this.setProfileName(i.name,s)}else this.setProfileName(null,s)}catch{this.setProfileName(null,s)}}syncConnectedWalletInfo(e){const s=B.getConnectorId(e),r=Se.getProviderId(e);if(r===ws.CONNECTOR_TYPE_ANNOUNCED||r===ws.CONNECTOR_TYPE_INJECTED){if(s){const i=this.getConnectors().find(n=>n.id===s);if(i){const{info:n,name:o,imageUrl:a}=i,c=a||this.getConnectorImage(i);this.setConnectedWalletInfo({name:o,icon:c,...n},e)}}}else if(r===ws.CONNECTOR_TYPE_WALLET_CONNECT){const i=Se.getProvider(e);i?.session&&this.setConnectedWalletInfo({...i.session.peer.metadata,name:i.session.peer.metadata.name,icon:i.session.peer.metadata.icons?.[0]},e)}else if(s&&s===H.CONNECTOR_ID.COINBASE){const i=this.getConnectors().find(n=>n.id===H.CONNECTOR_ID.COINBASE);this.setConnectedWalletInfo({name:"Coinbase Wallet",icon:this.getConnectorImage(i)},e)}}async syncBalance(e){!Tu.getNetworksByNamespace(this.getCaipNetworks(),e.chainNamespace).find(r=>r.id.toString()===e.chainId?.toString())||!e.chainId||await this.updateNativeBalance(e.address,e.chainId,e.chainNamespace)}async ready(){await this.readyPromise}async updateNativeBalance(e,s,r){const i=this.getAdapter(r),n=p.getCaipNetworkByNamespace(r,s);if(i){const o=await i.getBalance({address:e,chainId:s,caipNetwork:n,tokens:this.options.tokens});return this.setBalance(o.balance,o.symbol,r),o}}async initializeUniversalAdapter(){const e=E1.createLogger((r,...i)=>{r&&this.handleAlertError(r),console.error(...i)}),s={projectId:this.options?.projectId,metadata:{name:this.options?.metadata?this.options?.metadata.name:"",description:this.options?.metadata?this.options?.metadata.description:"",url:this.options?.metadata?this.options?.metadata.url:"",icons:this.options?.metadata?this.options?.metadata.icons:[""]},logger:e};k.setManualWCControl(!!this.options?.manualWCControl),this.universalProvider=this.options.universalProvider??await y1.init(s),this.listenWalletConnect()}listenWalletConnect(){this.universalProvider&&(this.universalProvider.on("display_uri",e=>{Y.setUri(e)}),this.universalProvider.on("connect",Y.finalizeWcConnection),this.universalProvider.on("disconnect",()=>{this.chainNamespaces.forEach(e=>{this.resetAccount(e)}),Y.resetWcConnection()}),this.universalProvider.on("chainChanged",e=>{const s=this.getCaipNetworks().find(i=>i.id==e),r=this.getCaipNetwork();if(!s){this.setUnsupportedNetwork(e);return}r?.id!==s?.id&&this.setCaipNetwork(s)}),this.universalProvider.on("session_event",e=>{if(Hn.isSessionEventData(e)){const{name:s,data:r}=e.params.event;s==="accountsChanged"&&Array.isArray(r)&&X.isCaipAddress(r[0])&&this.syncAccount(hs.parseCaipAddress(r[0]))}}))}createUniversalProvider(){return!this.universalProviderInitPromise&&X.isClient()&&this.options?.projectId&&(this.universalProviderInitPromise=this.initializeUniversalAdapter()),this.universalProviderInitPromise}async getUniversalProvider(){if(!this.universalProvider)try{await this.createUniversalProvider()}catch(e){Pe.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 s=Object.entries(Nr.UniversalProviderErrors).find(([,{message:a}])=>e.message.includes(a)),[r,i]=s??[],{message:n,alertErrorKey:o}=i??{};if(r&&n&&!this.reportedAlertErrors[r]){const a=Nr.ALERT_ERRORS[o];a&&(Ms.open(a,"error"),this.reportedAlertErrors[r]=!0)}}getAdapter(e){if(e)return this.chainAdapters?.[e]}createAdapter(e){if(!e)return;const s=e.namespace;if(!s)return;this.createClients();const r=e;r.namespace=s,r.construct({namespace:s,projectId:this.options?.projectId,networks:this.getCaipNetworks()}),this.chainNamespaces.includes(s)||this.chainNamespaces.push(s),this.chainAdapters&&(this.chainAdapters[s]=r)}async open(e){return await this.injectModalUi(),e?.uri&&Y.setUri(e.uri),e?.arguments&&e?.view==="Swap"?Fe.open({...e,data:{swap:e.arguments}}):Fe.open(e)}async close(){await this.injectModalUi(),Fe.close()}setLoading(e,s){Fe.setLoading(e,s)}async disconnect(e){await Y.disconnect(e)}getSIWX(){return k.state.siwx}getError(){return""}getChainId(){return p.state.activeCaipNetwork?.id}async switchNetwork(e){const s=this.getCaipNetworks().find(r=>r.id===e.id);if(!s){Ms.open(Nr.ALERT_ERRORS.SWITCH_NETWORK_NOT_FOUND,"error");return}await p.switchActiveNetwork(s)}getWalletProvider(){return p.state.activeChain?Se.state.providers[p.state.activeChain]:null}getWalletProviderType(){return Se.getProviderId(p.state.activeChain)}subscribeProviders(e){return Se.subscribeProviders(e)}getThemeMode(){return gt.state.themeMode}getThemeVariables(){return gt.state.themeVariables}setThemeMode(e){gt.setThemeMode(e),Nh(gt.state.themeMode)}setTermsConditionsUrl(e){k.setTermsConditionsUrl(e)}setPrivacyPolicyUrl(e){k.setPrivacyPolicyUrl(e)}setThemeVariables(e){gt.setThemeVariables(e),mI(gt.state.themeVariables)}subscribeTheme(e){return gt.subscribe(e)}getWalletInfo(){return F.state.connectedWalletInfo}getAccount(e){const s=B.getAuthConnector(e),r=p.getAccountData(e),i=p.state.activeChain,n=z.getConnectedConnectorId(e||i);if(r)return{allAccounts:r.allAccounts,caipAddress:r.caipAddress,address:X.getPlainAddress(r.caipAddress),isConnected:!!r.caipAddress,status:r.status,embeddedWalletInfo:s&&n===H.CONNECTOR_ID.AUTH?{user:r.user?{...r.user,username:z.getConnectedSocialUsername()}:void 0,authProvider:r.socialProvider||"email",accountType:r.preferredAccountTypes?.[e||i],isSmartAccountDeployed:!!r.smartAccountDeployed}:void 0}}subscribeAccount(e,s){const r=()=>{const i=this.getAccount(s);i&&e(i)};s?p.subscribeChainProp("accountState",r,s):p.subscribe(r),B.subscribe(r)}subscribeNetwork(e){return p.subscribe(({activeCaipNetwork:s})=>{e({caipNetwork:s,chainId:s?.id,caipNetworkId:s?.caipNetworkId})})}subscribeWalletInfo(e){return F.subscribeKey("connectedWalletInfo",e)}subscribeShouldUpdateToAddress(e){F.subscribeKey("shouldUpdateToAddress",e)}subscribeCaipNetworkChange(e){p.subscribeKey("activeCaipNetwork",e)}getState(){return As.state}subscribeState(e){return As.subscribe(e)}showErrorMessage(e){Lt.showError(e)}showSuccessMessage(e){Lt.showSuccess(e)}getEvent(){return{...Pe.state}}subscribeEvents(e){return Pe.subscribe(e)}replace(e){re.replace(e)}redirect(e){re.push(e)}popTransactionStack(e){re.popTransactionStack(e)}isOpen(){return Fe.state.open}isTransactionStackEmpty(){return re.state.transactionStack.length===0}static getInstance(){return this.instance}updateFeatures(e){k.setFeatures(e)}updateRemoteFeatures(e){k.setRemoteFeatures(e)}updateOptions(e){const r={...k.state||{},...e};k.setOptions(r)}setConnectMethodsOrder(e){k.setConnectMethodsOrder(e)}setWalletFeaturesOrder(e){k.setWalletFeaturesOrder(e)}setCollapseWallets(e){k.setCollapseWallets(e)}setSocialsOrder(e){k.setSocialsOrder(e)}getConnectMethodsOrder(){return Ra.getConnectOrderMethod(k.state.features,B.getConnectors())}addNetwork(e,s){if(this.chainAdapters&&!this.chainAdapters[e])throw new Error(`Adapter for namespace ${e} doesn't exist`);const r=this.extendCaipNetwork(s,this.options);this.getCaipNetworks().find(i=>i.id===r.id)||p.addNetwork(r)}removeNetwork(e,s){if(this.chainAdapters&&!this.chainAdapters[e])throw new Error(`Adapter for namespace ${e} doesn't exist`);this.getCaipNetworks().find(i=>i.id===s)&&p.removeNetwork(e,s)}}let Su=!1;class xh extends $I{async open(e){B.isConnected()||await super.open(e)}async close(){await super.close(),this.options.manualWCControl&&Y.finalizeWcConnection()}async syncIdentity(e){return Promise.resolve()}async syncBalance(e){return Promise.resolve()}async injectModalUi(){if(!Su&&X.isClient()){if(await Yo(()=>import("./basic-CqHaUvPy.js"),__vite__mapDeps([5,6,1,2,3,4])),await Yo(()=>import("./w3m-modal-BV8xYuAk.js"),__vite__mapDeps([7,6,1,2,3,4])),!document.querySelector("w3m-modal")){const s=document.createElement("w3m-modal");!k.state.disableAppend&&!k.state.enableEmbedded&&document.body.insertAdjacentElement("beforeend",s)}Su=!0}}}const RI="1.7.8";function UI(t){return new xh({...t,basic:!0,sdkVersion:`html-core-${RI}`})}const vA=Object.freeze(Object.defineProperty({__proto__:null,AppKit:xh,createAppKit:UI},Symbol.toStringTag,{value:"Module"}));export{Ms as A,Lt as B,p as C,V as D,Pe as E,mA as F,X as G,Tf as H,H as I,bh as J,Ua as K,ze as L,Fe as M,Kr as N,k as O,zn as P,Y as Q,re as R,Ai as S,gt as T,z as U,ve as V,Ra as W,vA as X,Ec as a,Ef as b,tA as c,xf as d,eA as e,io as f,iA as g,rA as h,Et as i,Ze as j,Rr as k,wA as l,Wn as m,fA as n,yA as o,_e as p,bA as q,sA as r,Qe as s,Hu as t,Uu as u,Dt as v,gA as w,J1 as x,B as y,F as z};
|