@dcl/auth-site 4.12.1-23257944198.commit-ff61dae → 4.12.1-23265207440.commit-a5ffaee
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/assets/{ConstantsUtil-CsWrbhBj.js → ConstantsUtil-M5yW8-jA.js} +1 -1
- package/assets/{ContentfulRichText-CfVQKsN1.js → ContentfulRichText-D5a4a3rf.js} +1 -1
- package/assets/{ExchangeController-XmAY8XeL.js → ExchangeController-K4dWpzlN.js} +1 -1
- package/assets/{HelpersUtil-Cj2yf5QP.js → HelpersUtil-DlAzAF4O.js} +1 -1
- package/assets/{NetworkUtil-DBeijgfn.js → NetworkUtil-BrV4QYNW.js} +1 -1
- package/assets/{SwapController-CT0UN224.js → SwapController-BhabUlNi.js} +1 -1
- package/assets/{biconomy-BjfscVZe.js → biconomy-DOWm-w-n.js} +1 -1
- package/assets/{browser-B4XJQjXm.js → browser-Bd7g5QP2.js} +1 -1
- package/assets/{ccip-vcVyGlxX.js → ccip-eVPQhOKi.js} +1 -1
- package/assets/{chains-Ci2vHbpf.js → chains-176Xw5JH.js} +1 -1
- package/assets/{common-wq8TIhvK.js → common-Cqs2IA5v.js} +1 -1
- package/assets/{controller-DG3kSk97.js → controller-DyfP9sLB.js} +2 -2
- package/assets/{data-capture-He_-je8j.js → data-capture-D5_2fLso.js} +1 -1
- package/assets/{email-CAoZJRn0.js → email-DnEShvFk.js} +1 -1
- package/assets/{embedded-wallet-BO_DoCme.js → embedded-wallet-DYXscQ66.js} +1 -1
- package/assets/{engine-rzi1TOwn.js → engine-C-Yz7eXx.js} +1 -1
- package/assets/{estimate-l1-fee-BQQ9aJff.js → estimate-l1-fee-XdVvOFs7.js} +1 -1
- package/assets/{ethereum-CnR6Yg67.js → ethereum-CEHvWqGp.js} +1 -1
- package/assets/{extractIPFS-C1ch1qy6.js → extractIPFS-D__CSQqh.js} +1 -1
- package/assets/{features-C_D_atNW.js → features-CZxuFnoj.js} +1 -1
- package/assets/{fetchTokenMetadata-CgDTzKKE.js → fetchTokenMetadata-CG79NU3-.js} +1 -1
- package/assets/{fortmatic-usCFzoU7.js → fortmatic-DKEABnlX.js} +1 -1
- package/assets/{get-ecosystem-wallet-info-L6ZulwYb.js → get-ecosystem-wallet-info-3-CvIBpv.js} +1 -1
- package/assets/{getBalance-CFOYyEyS.js → getBalance-C-HFrUIb.js} +1 -1
- package/assets/{getInstalledModules-DCtBaHQK.js → getInstalledModules-B-y2-Apy.js} +1 -1
- package/assets/{getNFT-DCQOaiup.js → getNFT-Cyqa8Plr.js} +1 -1
- package/assets/{getNFT-cgys5jzo.js → getNFT-D-SQ3bNw.js} +2 -2
- package/assets/{if-defined-Czd_haVH.js → if-defined-CT5YX5TG.js} +1 -1
- package/assets/{in-app-wallet-calls-Bcq34XJb.js → in-app-wallet-calls-C6XORNPV.js} +1 -1
- package/assets/index-13DXQnYT.js +175 -0
- package/assets/{index-C6UybIW-.js → index-BBNzpLJg.js} +1 -1
- package/assets/{index-C1AfkeMm.js → index-BJsIuSQS.js} +4 -4
- package/assets/{index-CNP9Lp1F.js → index-BWLGPCDE.js} +2 -2
- package/assets/{index-DI6gJ2v4.js → index-BaqR43pB.js} +1 -1
- package/assets/{index-CT5nzidz.js → index-Bc2QoNvn.js} +1 -1
- package/assets/{index-Z-14hzsn.js → index-BcQ2gsv4.js} +1 -1
- package/assets/{index-LdlmJTcM.js → index-BgyBq7wF.js} +1 -1
- package/assets/{index-Bjl_PxkS.js → index-BjAWPWu_.js} +1 -1
- package/assets/{index-U79AZIOz.js → index-BkIL5Y4C.js} +1 -1
- package/assets/{index-q4olpBIa.css → index-BltYrK2m.css} +1 -1
- package/assets/{index-p0uSUt9a.js → index-BsGGLSPc.js} +1 -1
- package/assets/{index-DgQP3jhF.js → index-Bs_xOXhp.js} +1 -1
- package/assets/{index-CukJXVRG.js → index-BxsND-28.js} +1 -1
- package/assets/{index-BdwBWVSo.js → index-C2ZT7n-h.js} +1 -1
- package/assets/{index-CeC6OH9Y.js → index-CHDNpoUG.js} +1 -1
- package/assets/{index-Bddp-UDg.js → index-CL_MAWLe.js} +1 -1
- package/assets/{index-C3Goz62A.js → index-CSo98Cv8.js} +1 -1
- package/assets/{index-DwfYRkB-.js → index-CUIi0dE5.js} +1 -1
- package/assets/{index-BnFIH3po.js → index-Cbm6EVpv.js} +1 -1
- package/assets/{index-DQyN7x8A.js → index-CgB_tpN6.js} +1 -1
- package/assets/{index-a40oMP56.js → index-Cve5bLpP.js} +1 -1
- package/assets/{index-5j-fDX9M.js → index-CxU3SPMY.js} +1 -1
- package/assets/{index-LEvK9BU-.js → index-Cy4E4P8Q.js} +1 -1
- package/assets/{index-CYy5MW9v.js → index-D-y6nvNL.js} +1 -1
- package/assets/{index-BwF7u4So.js → index-DBXc8GaK.js} +1 -1
- package/assets/{index-DTA8Yh0D.js → index-DF9L3XKL.js} +1 -1
- package/assets/{index-B6yBNEp8.js → index-DZqmV02G.js} +1 -1
- package/assets/{index-DpV5R5CA.js → index-D_BjQmbB.js} +1 -1
- package/assets/{index-Zx8zCmRJ.js → index-DgZlGZQe.js} +1 -1
- package/assets/{index-BcHqr8Zw.js → index-Dl7pBYho.js} +1 -1
- package/assets/{index-BAZrfb76.js → index-Dp6mOny_.js} +1 -1
- package/assets/{index-CrKjhXqn.js → index-Dpk5wJEj.js} +1 -1
- package/assets/{index-BL0oG1py.js → index-DqcaeYJj.js} +1 -1
- package/assets/{index-CAl5bUL4.js → index-Dr-J0hnN.js} +1 -1
- package/assets/{index-D856ImgP.js → index-I2dplyKh.js} +1 -1
- package/assets/{index-BJJ7T0Wq.js → index-MpTKcH0D.js} +1 -1
- package/assets/{index-KgfieA6a.js → index-NFJCpBUZ.js} +1 -1
- package/assets/{index-hdFvl29W.js → index-S7FdaTA_.js} +1 -1
- package/assets/{index-BsYdSbfc.js → index-YohvwMrd.js} +1 -1
- package/assets/{index-DCqkhW2t.js → index-_vzAsYiN.js} +1 -1
- package/assets/{index-jADOhOQL.js → index-b_vLmZ-7.js} +1 -1
- package/assets/{index-DwEKubQW.js → index-iqDoByK8.js} +1 -1
- package/assets/{index-CpOo0L9a.js → index-rFu5MCqn.js} +1 -1
- package/assets/{index.es-D4T1maSz.js → index.es--3fyxn8y.js} +1 -1
- package/assets/{index.es-2HttMq4T.js → index.es-dkT2ml83.js} +1 -1
- package/assets/{index.es-CnrfOh3G.js → index.es-xpQlHN7l.js} +1 -1
- package/assets/{native-BB396vM9.js → native-DFOEqv-a.js} +1 -1
- package/assets/{networks-CojxvI0C.js → networks-BwFuUvvC.js} +1 -1
- package/assets/{onramp-BtUd5Jsr.js → onramp-D13xKkds.js} +1 -1
- package/assets/{openzeppelin-y3ywJ5E_.js → openzeppelin-DrUGNPMN.js} +1 -1
- package/assets/{ownerOf-CRJjHjfh.js → ownerOf-DgwIkt-E.js} +1 -1
- package/assets/{parseNft-DZ0pXt7e.js → parseNft-C0KgiGJ8.js} +2 -2
- package/assets/{pay-with-exchange-DgS0cZtf.js → pay-with-exchange-BUoAg3fJ.js} +1 -1
- package/assets/{qr-overlay-DXCE8ST0.js → qr-overlay-JoNyL3_J.js} +3 -3
- package/assets/{receive-hUZItkSJ.js → receive-BgOG4IS6.js} +1 -1
- package/assets/{ref-kZaE5B0T.js → ref-Bbbt4Rvo.js} +1 -1
- package/assets/{resolveImplementation-Bn5mPN3x.js → resolveImplementation-HLsp9dy1.js} +1 -1
- package/assets/{secp256k1-BUIg71XZ.js → secp256k1-xSyt8XU9.js} +1 -1
- package/assets/{send-BT_IdOS0.js → send-CX8J2Bf6.js} +1 -1
- package/assets/{send-eip712-transaction-D9Do4PFb.js → send-eip712-transaction-C88HGddx.js} +1 -1
- package/assets/{send-gasless-transaction-CqOFvAWj.js → send-gasless-transaction-CG-T45-r.js} +2 -2
- package/assets/{session-proposal-BhxOm69W.js → session-proposal-C0kfr8bU.js} +1 -1
- package/assets/{session-request-B2kobJ26.js → session-request-Bl3tqUKv.js} +2 -2
- package/assets/{socials-DSc4GDDT.js → socials-Be-AypbT.js} +1 -1
- package/assets/{swaps-BLvsC89P.js → swaps-D_E6Q8ug.js} +1 -1
- package/assets/{thirdweb-BIaoCVl0.js → thirdweb-B4uPXbkw.js} +5 -5
- package/assets/{totalSupply-kVUutRUL.js → totalSupply-BttU0uj3.js} +1 -1
- package/assets/{transactions-Vj_6nEoQ.js → transactions-BYQTZN1L.js} +1 -1
- package/assets/{ui-BdRidUCc.js → ui-CSTbCQwk.js} +5 -5
- package/assets/{vendor-BgApJLuV.js → vendor-DahexbvH.js} +1 -1
- package/assets/{w3m-modal-D6SyVt6p.js → w3m-modal-BoUklqWf.js} +1 -1
- package/assets/{wallets-CN-4x-BR.js → wallets-CZg5vQWs.js} +5 -5
- package/assets/{web-connector-CH10dfXt.js → web-connector-DB6vmoMW.js} +3 -3
- package/index.html +5 -5
- package/package.json +3 -3
- package/assets/index-BDxBylVB.js +0 -175
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/get-ecosystem-wallet-info-
|
|
2
|
-
import{bD as Fu,bE as en,bF as wc,bG as ir,ac as Ve,Q as po,R as Wu,n as De,f as Q,F as Un,p as zt,bH as gc,_ as a,bI as cr,b as ge,aG as Ts,s as we,bJ as Ec,bK as vc,bL as bc,j as Ps,u as Os,t as Rs,Y as Ic,as as Yn,ak as Hu,x as Ls,al as Gu,a5 as Ju,b5 as Zu,h as Qu,v as Yu,i as Xu,bM as Ac,bN as ed,bO as td,aq as rd,ar as nd,bP as id,bQ as sd,l as Xn,bR as od,bS as Bi,an as Tc,bT as ad,bU as cd,bV as Ds,bW as Pc,bX as ld,N as Vs,bY as Oc,bZ as ud,b_ as _o,b$ as dd,P as hd,c0 as fo,c1 as pd,c2 as _d,c3 as fd,c4 as md,a1 as yd,g as wd,c5 as gd,c6 as mo,d as Ed,c7 as Rc,a9 as Lc,ab as dn,aa as Dc,c8 as vd,aT as bd,c9 as Id,ca as Gt,cb as Ad,a2 as Td,o as Pd,y as Od,J as Rd,cc as Ld,cd as Dd,ce as Vd}from"./thirdweb-BIaoCVl0.js";import{B as ee,g as K}from"./ui-BdRidUCc.js";import{d6 as lr,d0 as Vc}from"./index-BDxBylVB.js";import{j as gn,b as qn,s as tn,d as Sd,k as xd,l as Cd,g as $d,e as kd,h as yo,r as Nd,I as Ar,m as Ud,n as et,t as ze,q,u as Ot,C as qd,v as Md,w as Hr,x as ji,y as hn,z as Bd,A as jd,B as zd,D as Kd,a as Nt,E as Tr,o as Fd,F as Wd,G as Ss,H as xs,f as Mn,P as wo,Q as Hd,J as Gd,K as Yt,c as Sc,L as vt,M as pt,N as Lt}from"./index.es-CnrfOh3G.js";import{e as Jd}from"./ethereum-CnR6Yg67.js";async function Be(r){const{client:t,ecosystem:e,walletType:n,walletAddress:i,chainId:s}=r;return Fu({client:t,data:{action:"connect",chainId:s,source:"connectWallet",walletAddress:i,walletType:n},ecosystem:e})}function Cs(r){const t=r.domain;return(t==null?void 0:t.chainId)!==void 0&&en(t.chainId)&&(r.domain={...r.domain,chainId:wc(r.domain.chainId)}),r}const Zd={"0x0":"reverted","0x1":"success"};function $s(r){var n;const[t,e]=(()=>{const i=r.status;return i>=100&&i<200?["pending",i]:i>=200&&i<300?["success",i]:i>=300&&i<700?["failure",i]:i==="CONFIRMED"?["success",200]:i==="PENDING"?["pending",100]:[void 0,i]})();return{...r,atomic:r.atomic,chainId:r.chainId?ir(r.chainId):void 0,receipts:((n=r.receipts)==null?void 0:n.map(i=>({...i,blockNumber:Ve(i.blockNumber),gasUsed:Ve(i.gasUsed),status:Zd[i.status]})))??[],status:t,statusCode:e,version:r.version}}function ks(r,t){const e={};for(const[n,i]of Object.entries(r)){e[Number(n)]={};const s={};for(const[o,c]of Object.entries(i))s[o]=c;e[Number(n)]=s}return typeof t=="number"?{[t]:e[t]}:e}async function Ns(r,t){const e=r.calls[0];if(!e)throw new Error("No calls to send");const{calls:n,capabilities:i,version:s="2.0.0",chain:o=e.chain}=r,c=await Promise.all(n.map(async u=>{const{to:d,value:h}=u;if(d===void 0&&u.data===void 0)throw new Error("Cannot send call, `to` or `data` must be provided.");const[p,_,f]=await Promise.all([po(d),Wu(u),po(h)]);return p?{data:_,to:Q(p),value:typeof f=="bigint"||typeof f=="number"?De(f):void 0}:{data:_,to:void 0,value:void 0}}));return{callParams:[{atomicRequired:r.atomicRequired??!1,calls:c,capabilities:i,chainId:De(o.id),from:Q(t.address),version:s}],chain:o}}function Us(r){return Qd(r).map(t=>{try{const e=new URL(t);return e.hostname.endsWith(".thirdweb.com")&&(e.pathname="",e.search=""),e.toString()}catch{return t}})}function Qd(r,t,e="http"){const n=[];for(const i of r.rpc)e==="http"&&!i.startsWith("http")||e==="ws"&&!i.startsWith("ws")||(i.includes("${THIRDWEB_API_KEY}")?n.push(i.replace("${THIRDWEB_API_KEY}","")):i.includes("${")||n.push(i));if(n.length===0)throw new Error(`No RPC available for chainId "${r.chainId}" with mode ${e}`);return n}function ct(r){return typeof r=="number"?r:Un(r)?ir(r):typeof r=="bigint"?Number(r):Number.parseInt(r,10)}function Yd(r){if(typeof window>"u")return;const t=e=>r(e.detail);return window.addEventListener("eip6963:announceProvider",t),window.dispatchEvent(new CustomEvent("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",t)}function Xd(){const r=new Set;let t=[];const e=()=>Yd(i=>{t.some(({info:s})=>s.uuid===i.info.uuid)||(t=[...t,i],r.forEach(s=>s(t,{added:[i]})))});let n=e();return{_listeners(){return r},clear(){r.forEach(i=>i([],{removed:[...t]})),t=[]},destroy(){this.clear(),r.clear(),n==null||n()},findProvider({rdns:i}){return t.find(s=>s.info.rdns===i)},getProviders(){return t},reset(){this.clear(),n==null||n(),n=e()},subscribe(i,{emitImmediately:s}={}){return r.add(i),s&&i(t,{added:t}),()=>r.delete(i)}}}function eh(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}function th(){return typeof zt<"u"&&typeof zt.versions<"u"&&typeof zt.versions.node<"u"}function xc(){return!eh()&&!th()}const _t="com.coinbase.wallet",Tt="org.base.account",Cc="io.metamask",rh="me.rainbow",nh="io.zerion.wallet",Bn={async getItem(r){try{if(typeof window<"u"&&window.localStorage)return localStorage.getItem(r)}catch{}return null},async removeItem(r){typeof window<"u"&&window.localStorage&&localStorage.removeItem(r)},async setItem(r,t){try{typeof window<"u"&&window.localStorage&&localStorage.setItem(r,t)}catch{}}};function qs(r){return r.startsWith("http://")||r.startsWith("https://")}function $c(r,t){if(!qs(r))return kc(r,t);let e=r;e.endsWith("/")||(e=`${e}/`);const n=encodeURIComponent(t);return{href:e,redirect:`${e}wc?uri=${n}`}}function kc(r,t){if(qs(r))return $c(r,t);let e=r;e.includes("://")||(e=r.replaceAll("/","").replaceAll(":",""),e=`${e}://`),e.endsWith("/")||(e=`${e}/`);const n=encodeURIComponent(t);return{href:e,redirect:`${e}wc?uri=${n}`}}function ih(r,t){return qs(r)?$c(r,t):kc(r,t)}function sh(){if(typeof navigator>"u")return!1;const r=gc(navigator.userAgent);return r?r.toLowerCase().includes("android"):!1}function oh(){if(typeof navigator>"u")return!1;const r=gc(navigator.userAgent);return r?r.toLowerCase().includes("ios")||r.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}function ah(){return typeof window>"u"||typeof navigator>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}function ch(){return typeof window>"u"?!1:"orientation"in window||"onorientationchange"in window}function go(){return!!(sh()||oh()||ah()&&ch()||typeof window<"u"&&window.innerWidth<640)}function hi(r){if(window!==window.top)window.open(r);else if(r.startsWith("http")){const e=document.createElement("a");e.href=r,e.target="_blank",e.rel="noreferrer noopener",e.click()}else window.location.href=r}function Pr(r){return typeof r=="string"?r.startsWith("ecosystem."):r.id.startsWith("ecosystem.")}async function Nc(r,t){if(Pr(r)){const{getEcosystemWalletInfo:e}=await a(async()=>{const{getEcosystemWalletInfo:n}=await import("./get-ecosystem-wallet-info-L6ZulwYb.js");return{getEcosystemWalletInfo:n}},__vite__mapDeps([0,1,2,3,4,5,6,7]));return t?e(r).then(n=>n.image_id):e(r)}switch(r){case"smart":return t?a(()=>import("./image-BnYtBA0B.js"),[]).then(e=>e.default):a(()=>import("./index-BuSavAVK.js"),[]).then(e=>e.wallet);case"inApp":return t?a(()=>import("./image-YhquT9-B.js"),[]).then(e=>e.default):a(()=>import("./index-B6yqoFuC.js"),[]).then(e=>e.wallet);case"walletConnect":return t?a(()=>import("./image-B3sWXgWp.js"),[]).then(e=>e.default):a(()=>import("./index-B21BIk0D.js"),[]).then(e=>e.wallet);case"embedded":return t?a(()=>import("./image-CE6B5igp.js"),[]).then(e=>e.default):a(()=>import("./index-CZfaBXw3.js"),[]).then(e=>e.wallet);case"adapter":return t?a(()=>import("./image-CaoCxndE.js"),[]).then(e=>e.default):a(()=>import("./index-DkPRLpmE.js"),[]).then(e=>e.wallet);case"io.1inch.wallet":return t?a(()=>import("./image-DcM8byf5.js"),[]).then(e=>e.default):a(()=>import("./index-B8SH8PS4.js"),[]).then(e=>e.wallet);case"com.binance.wallet":return t?a(()=>import("./image-B6woX8-F.js"),[]).then(e=>e.default):a(()=>import("./index-D1Wt1Kx7.js"),[]).then(e=>e.wallet);case"com.ledger":return t?a(()=>import("./image-CGobRsqC.js"),[]).then(e=>e.default):a(()=>import("./index-C63hJ0G0.js"),[]).then(e=>e.wallet);case"com.bitpay":return t?a(()=>import("./image-oGFA7lCe.js"),[]).then(e=>e.default):a(()=>import("./index-Bl6ScMn3.js"),[]).then(e=>e.wallet);case"com.bestwallet":return t?a(()=>import("./image-YzdSnFCd.js"),[]).then(e=>e.default):a(()=>import("./index-C_fnrq8t.js"),[]).then(e=>e.wallet);case"io.metamask":return t?a(()=>import("./image-rAE1A9js.js"),[]).then(e=>e.default):a(()=>import("./index-DaZnaClT.js"),[]).then(e=>e.wallet);case"com.trustwallet.app":return t?a(()=>import("./image-DhOOZChF.js"),[]).then(e=>e.default):a(()=>import("./index-9552Tb-C.js"),[]).then(e=>e.wallet);case"com.fireblocks":return t?a(()=>import("./image-C_rXI8lY.js"),[]).then(e=>e.default):a(()=>import("./index-fm1oF4Rd.js"),[]).then(e=>e.wallet);case"com.bitget.web3":return t?a(()=>import("./image-Cyu_SKNX.js"),[]).then(e=>e.default):a(()=>import("./index-7Xw6Dozy.js"),[]).then(e=>e.wallet);case"pro.tokenpocket":return t?a(()=>import("./image--EMjkbyZ.js"),[]).then(e=>e.default):a(()=>import("./index-C6d9DLRH.js"),[]).then(e=>e.wallet);case"com.safepal":return t?a(()=>import("./image-CPrfOTN2.js"),[]).then(e=>e.default):a(()=>import("./index-BKoDPf_i.js"),[]).then(e=>e.wallet);case"org.uniswap":return t?a(()=>import("./image-DzLDqqsm.js"),[]).then(e=>e.default):a(()=>import("./index-j8mIFeCA.js"),[]).then(e=>e.wallet);case"io.zerion.wallet":return t?a(()=>import("./image-CXpsLPxr.js"),[]).then(e=>e.default):a(()=>import("./index-CAYpPiIA.js"),[]).then(e=>e.wallet);case"com.elrond.maiar.wallet":return t?a(()=>import("./image-Zh059TUR.js"),[]).then(e=>e.default):a(()=>import("./index-CN99OAiz.js"),[]).then(e=>e.wallet);case"com.crypto.wallet":return t?a(()=>import("./image-BbeMBRJP.js"),[]).then(e=>e.default):a(()=>import("./index-DoeeKGAI.js"),[]).then(e=>e.wallet);case"com.bitcoin":return t?a(()=>import("./image-CIhcwJo_.js"),[]).then(e=>e.default):a(()=>import("./index-COFjg0BY.js"),[]).then(e=>e.wallet);case"com.bifrostwallet":return t?a(()=>import("./image-BJbq9ykO.js"),[]).then(e=>e.default):a(()=>import("./index-Cw9NGSPc.js"),[]).then(e=>e.wallet);case"jp.co.rakuten-wallet":return t?a(()=>import("./image-CkSdZpFq.js"),[]).then(e=>e.default):a(()=>import("./index-CU6dgzkA.js"),[]).then(e=>e.wallet);case"com.bybit":return t?a(()=>import("./image-CVPmP4Bl.js"),[]).then(e=>e.default):a(()=>import("./index-m0YDsCpu.js"),[]).then(e=>e.wallet);case"com.blockchain.login":return t?a(()=>import("./image-BvEJhPGs.js"),[]).then(e=>e.default):a(()=>import("./index-C8VMxu1Z.js"),[]).then(e=>e.wallet);case"io.trezor":return t?a(()=>import("./image-BQXnGJhx.js"),[]).then(e=>e.default):a(()=>import("./index-CDqfDzT6.js"),[]).then(e=>e.wallet);case"im.token":return t?a(()=>import("./image-ChDeiuh7.js"),[]).then(e=>e.default):a(()=>import("./index-iJWzlNVI.js"),[]).then(e=>e.wallet);case"global.safe":return t?a(()=>import("./image-B6ncW7rJ.js"),[]).then(e=>e.default):a(()=>import("./index-HPp1Id1p.js"),[]).then(e=>e.wallet);case"xyz.ctrl":return t?a(()=>import("./image-DsOpF0U0.js"),[]).then(e=>e.default):a(()=>import("./index-CW6lKp1A.js"),[]).then(e=>e.wallet);case"co.arculus":return t?a(()=>import("./image-CYFfk7g3.js"),[]).then(e=>e.default):a(()=>import("./index-s6ugJH3L.js"),[]).then(e=>e.wallet);case"com.roninchain.wallet":return t?a(()=>import("./image-BMgLTkFN.js"),[]).then(e=>e.default):a(()=>import("./index-caEr82M6.js"),[]).then(e=>e.wallet);case"com.okex.wallet":return t?a(()=>import("./image-Ck2fht2U.js"),[]).then(e=>e.default):a(()=>import("./index-CbEIEIEo.js"),[]).then(e=>e.wallet);case"com.wemixplay":return t?a(()=>import("./image-Dfhapk7_.js"),[]).then(e=>e.default):a(()=>import("./index-C8AQSvJD.js"),[]).then(e=>e.wallet);case"com.tangem":return t?a(()=>import("./image-xMsS8TDb.js"),[]).then(e=>e.default):a(()=>import("./index-CKXDw-uc.js"),[]).then(e=>e.wallet);case"com.exodus":return t?a(()=>import("./image-BULUy74S.js"),[]).then(e=>e.default):a(()=>import("./index-DszThTMl.js"),[]).then(e=>e.wallet);case"com.hashpack.wallet":return t?a(()=>import("./image-BFzDP99B.js"),[]).then(e=>e.default):a(()=>import("./index-wBbkQCZY.js"),[]).then(e=>e.wallet);case"id.co.pintu":return t?a(()=>import("./image-CsH_NRy-.js"),[]).then(e=>e.default):a(()=>import("./index-DHDm_YtM.js"),[]).then(e=>e.wallet);case"network.blackfort":return t?a(()=>import("./image-CTLwieHz.js"),[]).then(e=>e.default):a(()=>import("./index-DZRVQyzq.js"),[]).then(e=>e.wallet);case"com.wigwam.wallet":return t?a(()=>import("./image-xaEWk6k8.js"),[]).then(e=>e.default):a(()=>import("./index-BA0Hn6eE.js"),[]).then(e=>e.wallet);case"app.backpack":return t?a(()=>import("./image-YbQrvLSP.js"),[]).then(e=>e.default):a(()=>import("./index-B8BWAl26.js"),[]).then(e=>e.wallet);case"app.subwallet":return t?a(()=>import("./image-BdqmMP8T.js"),[]).then(e=>e.default):a(()=>import("./index-7C_yDnI4.js"),[]).then(e=>e.wallet);case"cc.avacus":return t?a(()=>import("./image-uGs9mRWl.js"),[]).then(e=>e.default):a(()=>import("./index-BFZxo6Jc.js"),[]).then(e=>e.wallet);case"me.rainbow":return t?a(()=>import("./image-DSGxNIm1.js"),[]).then(e=>e.default):a(()=>import("./index-3d3uK5Ax.js"),[]).then(e=>e.wallet);case"so.onekey.app.wallet":return t?a(()=>import("./image-CwaGmiHI.js"),[]).then(e=>e.default):a(()=>import("./index-CUEmD5dS.js"),[]).then(e=>e.wallet);case"me.haha":return t?a(()=>import("./image-Npe5Xkhl.js"),[]).then(e=>e.default):a(()=>import("./index-B7GQyWAF.js"),[]).then(e=>e.wallet);case"com.bee":return t?a(()=>import("./image-Sy6X7CtO.js"),[]).then(e=>e.default):a(()=>import("./index-CQ3aQg5G.js"),[]).then(e=>e.wallet);case"ag.jup":return t?a(()=>import("./image-BuqgjEJD.js"),[]).then(e=>e.default):a(()=>import("./index-D30RfPa1.js"),[]).then(e=>e.wallet);case"app.keplr":return t?a(()=>import("./image-DpeCw-px.js"),[]).then(e=>e.default):a(()=>import("./index-BnsE1W-S.js"),[]).then(e=>e.wallet);case"org.hot-labs":return t?a(()=>import("./image-DFf3lDA_.js"),[]).then(e=>e.default):a(()=>import("./index-DDwu-IMz.js"),[]).then(e=>e.wallet);case"com.dcentwallet":return t?a(()=>import("./image-CUPOo6zK.js"),[]).then(e=>e.default):a(()=>import("./index-Bm92iZMY.js"),[]).then(e=>e.wallet);case"com.kraken":return t?a(()=>import("./image-BP17CoHz.js"),[]).then(e=>e.default):a(()=>import("./index-BFGXqrJS.js"),[]).then(e=>e.wallet);case"com.kucoin":return t?a(()=>import("./image-JIl7mHMQ.js"),[]).then(e=>e.default):a(()=>import("./index-DRVDpxj6.js"),[]).then(e=>e.wallet);case"io.magiceden.wallet":return t?a(()=>import("./image-B7QIFAir.js"),[]).then(e=>e.default):a(()=>import("./index-DMTU8hfu.js"),[]).then(e=>e.wallet);case"com.tomi":return t?a(()=>import("./image-COwCE3RO.js"),[]).then(e=>e.default):a(()=>import("./index-C7njqxXR.js"),[]).then(e=>e.wallet);case"io.ibvm":return t?a(()=>import("./image-CVBI4BwD.js"),[]).then(e=>e.default):a(()=>import("./index-HzSvsrak.js"),[]).then(e=>e.wallet);case"com.mewwallet":return t?a(()=>import("./image-Dx4ya6_y.js"),[]).then(e=>e.default):a(()=>import("./index-DEzKWTBJ.js"),[]).then(e=>e.wallet);case"com.socios.app":return t?a(()=>import("./image-COKP1J8V.js"),[]).then(e=>e.default):a(()=>import("./index-D06ftJGd.js"),[]).then(e=>e.wallet);case"xyz.argent":return t?a(()=>import("./image-5mReG_-1.js"),[]).then(e=>e.default):a(()=>import("./index-CQPZVLgk.js"),[]).then(e=>e.wallet);case"org.thorwallet":return t?a(()=>import("./image-Dmp2jTO0.js"),[]).then(e=>e.default):a(()=>import("./index-NO3dCFlG.js"),[]).then(e=>e.wallet);case"io.internetmoney":return t?a(()=>import("./image-D4PYvYqY.js"),[]).then(e=>e.default):a(()=>import("./index-BZwq4W5O.js"),[]).then(e=>e.wallet);case"org.mathwallet":return t?a(()=>import("./image-mMy4SSmg.js"),[]).then(e=>e.default):a(()=>import("./index-lGNYNhMi.js"),[]).then(e=>e.wallet);case"io.cypherhq":return t?a(()=>import("./image-B14TCFf5.js"),[]).then(e=>e.default):a(()=>import("./index-yURkkC3L.js"),[]).then(e=>e.wallet);case"io.novawallet":return t?a(()=>import("./image-DDso8kuB.js"),[]).then(e=>e.default):a(()=>import("./index-C91aPf2g.js"),[]).then(e=>e.wallet);case"io.yowallet":return t?a(()=>import("./image-Bx8buncY.js"),[]).then(e=>e.default):a(()=>import("./index-B062fuzr.js"),[]).then(e=>e.wallet);case"com.flowfoundation.wallet":return t?a(()=>import("./image-Da2xkAVi.js"),[]).then(e=>e.default):a(()=>import("./index-CBVJzm96.js"),[]).then(e=>e.wallet);case"app.kabila":return t?a(()=>import("./image-B-l20wIO.js"),[]).then(e=>e.default):a(()=>import("./index-cTRIo3rN.js"),[]).then(e=>e.wallet);case"com.opera":return t?a(()=>import("./image-sDrIF89f.js"),[]).then(e=>e.default):a(()=>import("./index-lIOVfT2m.js"),[]).then(e=>e.wallet);case"com.valoraapp":return t?a(()=>import("./image-5QXPaavh.js"),[]).then(e=>e.default):a(()=>import("./index-C6baQHax.js"),[]).then(e=>e.wallet);case"com.robinhood.wallet":return t?a(()=>import("./image-DBehogZh.js"),[]).then(e=>e.default):a(()=>import("./index-bzH6W7xo.js"),[]).then(e=>e.wallet);case"com.chain":return t?a(()=>import("./image-qsAyF5Oj.js"),[]).then(e=>e.default):a(()=>import("./index-npRlG_V2.js"),[]).then(e=>e.wallet);case"io.huddln":return t?a(()=>import("./image-CQm90J-d.js"),[]).then(e=>e.default):a(()=>import("./index-DILut-jL.js"),[]).then(e=>e.wallet);case"app.core.extension":return t?a(()=>import("./image-De2xpum1.js"),[]).then(e=>e.default):a(()=>import("./index-BtfbjCVr.js"),[]).then(e=>e.wallet);case"world.freedom":return t?a(()=>import("./image-COnY36UD.js"),[]).then(e=>e.default):a(()=>import("./index-BZUSQkq9.js"),[]).then(e=>e.wallet);case"money.unstoppable":return t?a(()=>import("./image-Bvw8wNRu.js"),[]).then(e=>e.default):a(()=>import("./index-CW8D5Pv5.js"),[]).then(e=>e.wallet);case"pk.modular":return t?a(()=>import("./image-CaHdVXd1.js"),[]).then(e=>e.default):a(()=>import("./index-1CA6ps09.js"),[]).then(e=>e.wallet);case"app.wombat":return t?a(()=>import("./image-ExeF69qZ.js"),[]).then(e=>e.default):a(()=>import("./index-D9Jrno_D.js"),[]).then(e=>e.wallet);case"com.klipwallet":return t?a(()=>import("./image-8vXf4Xjy.js"),[]).then(e=>e.default):a(()=>import("./index-CcNQ53IV.js"),[]).then(e=>e.wallet);case"com.gemwallet":return t?a(()=>import("./image-M7TV7WaH.js"),[]).then(e=>e.default):a(()=>import("./index-BtZsXMJj.js"),[]).then(e=>e.wallet);case"com.sabay.wallet":return t?a(()=>import("./image-CsNgSbbt.js"),[]).then(e=>e.default):a(()=>import("./index-BVAmxcaa.js"),[]).then(e=>e.wallet);case"com.zengo":return t?a(()=>import("./image-DNtaIeSw.js"),[]).then(e=>e.default):a(()=>import("./index-DDk7D3eE.js"),[]).then(e=>e.wallet);case"xyz.joeywallet":return t?a(()=>import("./image-CTsHGgDx.js"),[]).then(e=>e.default):a(()=>import("./index-Im6F3t68.js"),[]).then(e=>e.wallet);case"io.tokoin":return t?a(()=>import("./image-DQzzFCs2.js"),[]).then(e=>e.default):a(()=>import("./index-Bwjy4Jw7.js"),[]).then(e=>e.wallet);case"io.alpha-u.wallet.web":return t?a(()=>import("./image-DLiMUWBI.js"),[]).then(e=>e.default):a(()=>import("./index-DFt1vT8N.js"),[]).then(e=>e.wallet);case"network.cvl":return t?a(()=>import("./image-CtZg2vKX.js"),[]).then(e=>e.default):a(()=>import("./index-D2vPh3Mc.js"),[]).then(e=>e.wallet);case"io.leapwallet":return t?a(()=>import("./image-DHnnMCFG.js"),[]).then(e=>e.default):a(()=>import("./index-BdkJrfxl.js"),[]).then(e=>e.wallet);case"io.xenea":return t?a(()=>import("./image-B5ZxW0VG.js"),[]).then(e=>e.default):a(()=>import("./index-C8mAROh2.js"),[]).then(e=>e.wallet);case"com.oasys-wallet":return t?a(()=>import("./image-W7SfqKZe.js"),[]).then(e=>e.default):a(()=>import("./index-gQ8zpnGO.js"),[]).then(e=>e.wallet);case"com.bitso":return t?a(()=>import("./image-LfonVSeq.js"),[]).then(e=>e.default):a(()=>import("./index-YcqLCtWD.js"),[]).then(e=>e.wallet);case"io.enjin":return t?a(()=>import("./image-BnXzDKuV.js"),[]).then(e=>e.default):a(()=>import("./index-Jmrm9oUu.js"),[]).then(e=>e.wallet);case"com.coldwallet":return t?a(()=>import("./image-CVrpZdwi.js"),[]).then(e=>e.default):a(()=>import("./index-CkqupmC6.js"),[]).then(e=>e.wallet);case"org.creditcoin.app":return t?a(()=>import("./image-CzL8n4ZU.js"),[]).then(e=>e.default):a(()=>import("./index-B94SpzOt.js"),[]).then(e=>e.wallet);case"app.everspace":return t?a(()=>import("./image-ripXpF5P.js"),[]).then(e=>e.default):a(()=>import("./index-COlGaDkw.js"),[]).then(e=>e.wallet);case"app.zeal":return t?a(()=>import("./image-hO8Jv2oh.js"),[]).then(e=>e.default):a(()=>import("./index-B6n-vVE0.js"),[]).then(e=>e.wallet);case"app.whitewallet":return t?a(()=>import("./image-D7wXb0Un.js"),[]).then(e=>e.default):a(()=>import("./index-SCBLsVUL.js"),[]).then(e=>e.wallet);case"ai.purewallet":return t?a(()=>import("./image-K1HoU8Qi.js"),[]).then(e=>e.default):a(()=>import("./index-DZ2hd5eC.js"),[]).then(e=>e.wallet);case"com.fastex.wallet":return t?a(()=>import("./image-lBIlUHFP.js"),[]).then(e=>e.default):a(()=>import("./index-CMzQk3O6.js"),[]).then(e=>e.wallet);case"io.kriptomat":return t?a(()=>import("./image-6ouyxZRt.js"),[]).then(e=>e.default):a(()=>import("./index-wk2CJ7i5.js"),[]).then(e=>e.wallet);case"com.ullapay":return t?a(()=>import("./image-Bn2sAgXJ.js"),[]).then(e=>e.default):a(()=>import("./index-D_d6gemZ.js"),[]).then(e=>e.wallet);case"io.atomicwallet":return t?a(()=>import("./image-D55LvXjp.js"),[]).then(e=>e.default):a(()=>import("./index-DEV4egrN.js"),[]).then(e=>e.wallet);case"com.pionewallet":return t?a(()=>import("./image-B_0Cqkss.js"),[]).then(e=>e.default):a(()=>import("./index-BogX5ITG.js"),[]).then(e=>e.wallet);case"io.oxalus":return t?a(()=>import("./image-DTa4RXUa.js"),[]).then(e=>e.default):a(()=>import("./index-CuQBw1y6.js"),[]).then(e=>e.wallet);case"xyz.uniultra.wallet":return t?a(()=>import("./image-BSLjXnNe.js"),[]).then(e=>e.default):a(()=>import("./index-CJYo3Znz.js"),[]).then(e=>e.wallet);case"xyz.frontier.wallet":return t?a(()=>import("./image-Bdtwdp85.js"),[]).then(e=>e.default):a(()=>import("./index--YTVamH2.js"),[]).then(e=>e.wallet);case"com.coolbitx.cwsapp":return t?a(()=>import("./image-DWR067hG.js"),[]).then(e=>e.default):a(()=>import("./index-tkvX3w1X.js"),[]).then(e=>e.wallet);case"org.gooddollar":return t?a(()=>import("./image-y3eCNAT6.js"),[]).then(e=>e.default):a(()=>import("./index-C7N44kNF.js"),[]).then(e=>e.wallet);case"com.cakewallet":return t?a(()=>import("./image-BqQffU2u.js"),[]).then(e=>e.default):a(()=>import("./index-DPCPDLBT.js"),[]).then(e=>e.wallet);case"com.ellipal":return t?a(()=>import("./image-vuuCn07N.js"),[]).then(e=>e.default):a(()=>import("./index-jTpsrMvb.js"),[]).then(e=>e.wallet);case"app.krystal":return t?a(()=>import("./image-C2QANSRr.js"),[]).then(e=>e.default):a(()=>import("./index-B7dAHFam.js"),[]).then(e=>e.wallet);case"com.monarchwallet":return t?a(()=>import("./image-BNA4BP9T.js"),[]).then(e=>e.default):a(()=>import("./index-C7WD5W_Z.js"),[]).then(e=>e.wallet);case"com.burritowallet":return t?a(()=>import("./image-BI-5Z38o.js"),[]).then(e=>e.default):a(()=>import("./index-DpRqa1iX.js"),[]).then(e=>e.wallet);case"co.family.wallet":return t?a(()=>import("./image-CECsJh3H.js"),[]).then(e=>e.default):a(()=>import("./index-DrzmRQ9S.js"),[]).then(e=>e.wallet);case"com.mtpelerin":return t?a(()=>import("./image-BDOqiI6p.js"),[]).then(e=>e.default):a(()=>import("./index-bQArImNA.js"),[]).then(e=>e.wallet);case"app.keyring":return t?a(()=>import("./image-BH6pi8gb.js"),[]).then(e=>e.default):a(()=>import("./index-DLGneTkB.js"),[]).then(e=>e.wallet);case"cc.localtrade.lab":return t?a(()=>import("./image-DRqNpoe6.js"),[]).then(e=>e.default):a(()=>import("./index-D-qw7id5.js"),[]).then(e=>e.wallet);case"tech.okto":return t?a(()=>import("./image-uk4MysVY.js"),[]).then(e=>e.default):a(()=>import("./index-C5ZfEOey.js"),[]).then(e=>e.wallet);case"com.xcapit":return t?a(()=>import("./image-BjFjHCOg.js"),[]).then(e=>e.default):a(()=>import("./index-DbAxetvE.js"),[]).then(e=>e.wallet);case"com.gayawallet":return t?a(()=>import("./image-DC9Wj56E.js"),[]).then(e=>e.default):a(()=>import("./index-D4VnhuTS.js"),[]).then(e=>e.wallet);case"app.nightly":return t?a(()=>import("./image-Bv8VGwx8.js"),[]).then(e=>e.default):a(()=>import("./index-uM5GtqSd.js"),[]).then(e=>e.wallet);case"com.coin98":return t?a(()=>import("./image-Co9P7WAh.js"),[]).then(e=>e.default):a(()=>import("./index-CxBkKx5Q.js"),[]).then(e=>e.wallet);case"xyz.coca":return t?a(()=>import("./image-DaxrbegS.js"),[]).then(e=>e.default):a(()=>import("./index-CAfHv9Ye.js"),[]).then(e=>e.wallet);case"app.linen":return t?a(()=>import("./image-CljvD_on.js"),[]).then(e=>e.default):a(()=>import("./index-DTPO88lj.js"),[]).then(e=>e.wallet);case"dev.auroracloud":return t?a(()=>import("./image-BbwfB3J_.js"),[]).then(e=>e.default):a(()=>import("./index-DqYjD_64.js"),[]).then(e=>e.wallet);case"com.coinomi":return t?a(()=>import("./image-CyezMyAx.js"),[]).then(e=>e.default):a(()=>import("./index-B-oXIR8J.js"),[]).then(e=>e.wallet);case"my.mone":return t?a(()=>import("./image-B7h27Vsd.js"),[]).then(e=>e.default):a(()=>import("./index-3jJtZlGN.js"),[]).then(e=>e.wallet);case"org.alephium":return t?a(()=>import("./image-DDUR5y02.js"),[]).then(e=>e.default):a(()=>import("./index-CRTSSeuy.js"),[]).then(e=>e.wallet);case"com.alicebob":return t?a(()=>import("./image-BKjOwOZU.js"),[]).then(e=>e.default):a(()=>import("./index-DYiL0IsZ.js"),[]).then(e=>e.wallet);case"io.koalawallet":return t?a(()=>import("./image-CTAbQz5j.js"),[]).then(e=>e.default):a(()=>import("./index-DPXkoJXK.js"),[]).then(e=>e.wallet);case"com.veworld":return t?a(()=>import("./image-DKBlkqWK.js"),[]).then(e=>e.default):a(()=>import("./index-DV2Q2KhC.js"),[]).then(e=>e.wallet);case"com.withpaper":return t?a(()=>import("./image-DbBiNCFK.js"),[]).then(e=>e.default):a(()=>import("./index-CExunyqd.js"),[]).then(e=>e.wallet);case"io.noone":return t?a(()=>import("./image-CwDXHpUj.js"),[]).then(e=>e.default):a(()=>import("./index-BEFk-36A.js"),[]).then(e=>e.wallet);case"network.haqq":return t?a(()=>import("./image-BaRuJqy0.js"),[]).then(e=>e.default):a(()=>import("./index--t3K2suC.js"),[]).then(e=>e.wallet);case"io.ricewallet":return t?a(()=>import("./image-CmVMIVLM.js"),[]).then(e=>e.default):a(()=>import("./index-C_j7AjFr.js"),[]).then(e=>e.wallet);case"me.iopay":return t?a(()=>import("./image-CMJsc-Ir.js"),[]).then(e=>e.default):a(()=>import("./index-bsKYZmcs.js"),[]).then(e=>e.wallet);case"app.walletnow":return t?a(()=>import("./image-CmkiYZaU.js"),[]).then(e=>e.default):a(()=>import("./index-C_C9JdoE.js"),[]).then(e=>e.wallet);case"io.okse":return t?a(()=>import("./image-CZ9z1ucT.js"),[]).then(e=>e.default):a(()=>import("./index-_a8zNWKv.js"),[]).then(e=>e.wallet);case"network.over":return t?a(()=>import("./image-Cq54pcgl.js"),[]).then(e=>e.default):a(()=>import("./index-BDifUsn3.js"),[]).then(e=>e.wallet);case"com.aktionariat":return t?a(()=>import("./image-Cc6jyxLi.js"),[]).then(e=>e.default):a(()=>import("./index-Pw2thZ4h.js"),[]).then(e=>e.wallet);case"com.paybolt":return t?a(()=>import("./image-cwzgrAkh.js"),[]).then(e=>e.default):a(()=>import("./index-BxqRct_I.js"),[]).then(e=>e.wallet);case"com.plasma-wallet":return t?a(()=>import("./image-BVO9IT_6.js"),[]).then(e=>e.default):a(()=>import("./index-fiGpKN6W.js"),[]).then(e=>e.wallet);case"org.bytebank":return t?a(()=>import("./image-BP2Ox9Qn.js"),[]).then(e=>e.default):a(()=>import("./index-S5s6rAc3.js"),[]).then(e=>e.wallet);case"io.ethermail":return t?a(()=>import("./image-Duck5tqn.js"),[]).then(e=>e.default):a(()=>import("./index-BoCHG1VO.js"),[]).then(e=>e.wallet);case"com.optowallet":return t?a(()=>import("./image-W-Y_Nm-s.js"),[]).then(e=>e.default):a(()=>import("./index-BP-yDgcx.js"),[]).then(e=>e.wallet);case"finance.openwallet":return t?a(()=>import("./image-M_AWRaKs.js"),[]).then(e=>e.default):a(()=>import("./index-Cv59xn6_.js"),[]).then(e=>e.wallet);case"xyz.sequence":return t?a(()=>import("./image-o3pjQDbu.js"),[]).then(e=>e.default):a(()=>import("./index-D7Gl-ZGb.js"),[]).then(e=>e.wallet);case"com.foxwallet":return t?a(()=>import("./image-DcX8AUYd.js"),[]).then(e=>e.default):a(()=>import("./index-BARF52iT.js"),[]).then(e=>e.wallet);case"app.hbwallet":return t?a(()=>import("./image-BlogSp8o.js"),[]).then(e=>e.default):a(()=>import("./index-CW58bOV7.js"),[]).then(e=>e.wallet);case"it.airgap":return t?a(()=>import("./image-5CGX_QL3.js"),[]).then(e=>e.default):a(()=>import("./index-YDG1R00C.js"),[]).then(e=>e.wallet);case"com.holdstation":return t?a(()=>import("./image-BcNLqzB4.js"),[]).then(e=>e.default):a(()=>import("./index-9Ml23qSY.js"),[]).then(e=>e.wallet);case"io.universaleverything":return t?a(()=>import("./image-D3z3GjMO.js"),[]).then(e=>e.default):a(()=>import("./index-qmNRbp6W.js"),[]).then(e=>e.wallet);case"com.abra":return t?a(()=>import("./image-CCgX-pcz.js"),[]).then(e=>e.default):a(()=>import("./index-_36_A-pH.js"),[]).then(e=>e.wallet);case"org.thepulsewallet":return t?a(()=>import("./image-BxfO9qDl.js"),[]).then(e=>e.default):a(()=>import("./index-DgNvhZ_M.js"),[]).then(e=>e.wallet);case"com.premanft":return t?a(()=>import("./image-pKZ5ApxC.js"),[]).then(e=>e.default):a(()=>import("./index-CbGJyo5C.js"),[]).then(e=>e.wallet);case"xyz.timelesswallet":return t?a(()=>import("./image-DUs_WIFe.js"),[]).then(e=>e.default):a(()=>import("./index-WXvxLSve.js"),[]).then(e=>e.wallet);case"org.bitizen":return t?a(()=>import("./image-TQ3Nh_VF.js"),[]).then(e=>e.default):a(()=>import("./index-Db_DlPJs.js"),[]).then(e=>e.wallet);case"app.ultimate":return t?a(()=>import("./image-ClyvBbEv.js"),[]).then(e=>e.default):a(()=>import("./index-D2Z8_AUU.js"),[]).then(e=>e.wallet);case"io.compasswallet":return t?a(()=>import("./image-D6x5dtDG.js"),[]).then(e=>e.default):a(()=>import("./index-2qmxPQhP.js"),[]).then(e=>e.wallet);case"app.fizzwallet":return t?a(()=>import("./image-E3PT44xu.js"),[]).then(e=>e.default):a(()=>import("./index-DAYuEFQ-.js"),[]).then(e=>e.wallet);case"com.xovawallet":return t?a(()=>import("./image-B02ECgsY.js"),[]).then(e=>e.default):a(()=>import("./index-Bap5Lkty.js"),[]).then(e=>e.wallet);case"app.nicegram":return t?a(()=>import("./image-DH5ootHk.js"),[]).then(e=>e.default):a(()=>import("./index-BEXV42kp.js"),[]).then(e=>e.wallet);case"io.zelcore":return t?a(()=>import("./image-CLUlwzEU.js"),[]).then(e=>e.default):a(()=>import("./index-BLO6pY9b.js"),[]).then(e=>e.wallet);case"app.freighter":return t?a(()=>import("./image-BanazMP9.js"),[]).then(e=>e.default):a(()=>import("./index-CcdGs50g.js"),[]).then(e=>e.wallet);case"app.stickey":return t?a(()=>import("./image-_t2-K1ZP.js"),[]).then(e=>e.default):a(()=>import("./index-Cu2rQjR7.js"),[]).then(e=>e.wallet);case"app.coinstats":return t?a(()=>import("./image-BlZLdRma.js"),[]).then(e=>e.default):a(()=>import("./index-j8xu_BhO.js"),[]).then(e=>e.wallet);case"io.harti":return t?a(()=>import("./image-Xfz-LkLu.js"),[]).then(e=>e.default):a(()=>import("./index-DPhI9JUn.js"),[]).then(e=>e.wallet);case"io.dttd":return t?a(()=>import("./image-pEGSGt6h.js"),[]).then(e=>e.default):a(()=>import("./index-CXYI0OjH.js"),[]).then(e=>e.wallet);case"com.tellaw":return t?a(()=>import("./image-sm-_D7TO.js"),[]).then(e=>e.default):a(()=>import("./index-Ddqy22qU.js"),[]).then(e=>e.wallet);case"io.klever":return t?a(()=>import("./image-BBFbQZtc.js"),[]).then(e=>e.default):a(()=>import("./index-BJAcAgB9.js"),[]).then(e=>e.wallet);case"com.unstoppabledomains":return t?a(()=>import("./image-EUVXQieb.js"),[]).then(e=>e.default):a(()=>import("./index-B1XrJIPH.js"),[]).then(e=>e.wallet);case"is.callback":return t?a(()=>import("./image-Mf3UQvEC.js"),[]).then(e=>e.default):a(()=>import("./index-DTtDhdi2.js"),[]).then(e=>e.wallet);case"ai.pundi":return t?a(()=>import("./image-9BTuaiXb.js"),[]).then(e=>e.default):a(()=>import("./index-Ca7jbqnT.js"),[]).then(e=>e.wallet);case"io.summonersarena":return t?a(()=>import("./image-3-p5LJAk.js"),[]).then(e=>e.default):a(()=>import("./index-ovz39Egy.js"),[]).then(e=>e.wallet);case"io.fizen":return t?a(()=>import("./image-CZLdphQJ.js"),[]).then(e=>e.default):a(()=>import("./index-WwjGYjHa.js"),[]).then(e=>e.wallet);case"fi.pillar":return t?a(()=>import("./image-CVAbhfmI.js"),[]).then(e=>e.default):a(()=>import("./index-BFJUkm8C.js"),[]).then(e=>e.wallet);case"world.ixo":return t?a(()=>import("./image-CsTNl20e.js"),[]).then(e=>e.default):a(()=>import("./index-C-A1j44m.js"),[]).then(e=>e.wallet);case"org.thetatoken":return t?a(()=>import("./image-BstOz2Sd.js"),[]).then(e=>e.default):a(()=>import("./index-BlU4B6pe.js"),[]).then(e=>e.wallet);case"net.gateweb3":return t?a(()=>import("./image-CypdirPa.js"),[]).then(e=>e.default):a(()=>import("./index-BkM7PWkU.js"),[]).then(e=>e.wallet);case"app.ammer":return t?a(()=>import("./image-BfGkQCHU.js"),[]).then(e=>e.default):a(()=>import("./index-C0HCn7GN.js"),[]).then(e=>e.wallet);case"us.binance":return t?a(()=>import("./image-DgkgLcDL.js"),[]).then(e=>e.default):a(()=>import("./index-BuhGQjsZ.js"),[]).then(e=>e.wallet);case"io.yusetoken":return t?a(()=>import("./image-CSAN5rKt.js"),[]).then(e=>e.default):a(()=>import("./index-DQ8_v09O.js"),[]).then(e=>e.wallet);case"co.muza":return t?a(()=>import("./image-CRsMfPT0.js"),[]).then(e=>e.default):a(()=>import("./index-5IpGHzAv.js"),[]).then(e=>e.wallet);case"io.hyperpay":return t?a(()=>import("./image-D8scG8aP.js"),[]).then(e=>e.default):a(()=>import("./index-BXZiXU-9.js"),[]).then(e=>e.wallet);case"io.cosmostation":return t?a(()=>import("./image-BYUgGshq.js"),[]).then(e=>e.default):a(()=>import("./index-RiIluuCN.js"),[]).then(e=>e.wallet);case"app.ryipay":return t?a(()=>import("./image-oKct0i27.js"),[]).then(e=>e.default):a(()=>import("./index-CdvxolxE.js"),[]).then(e=>e.wallet);case"io.wallet3":return t?a(()=>import("./image-DJLc6AlW.js"),[]).then(e=>e.default):a(()=>import("./index-C_5dy4gh.js"),[]).then(e=>e.wallet);case"org.dota168":return t?a(()=>import("./image-D3VAu6BC.js"),[]).then(e=>e.default):a(()=>import("./index-BP76iXI2.js"),[]).then(e=>e.wallet);case"com.bitpie":return t?a(()=>import("./image-BUsH-M52.js"),[]).then(e=>e.default):a(()=>import("./index-BKN05ia6.js"),[]).then(e=>e.wallet);case"com.coininn":return t?a(()=>import("./image-B_AAvjJY.js"),[]).then(e=>e.default):a(()=>import("./index-l2eJJ7mG.js"),[]).then(e=>e.wallet);case"me.easy":return t?a(()=>import("./image-BjKXKIhU.js"),[]).then(e=>e.default):a(()=>import("./index-4WvPsM5O.js"),[]).then(e=>e.wallet);case"io.shido":return t?a(()=>import("./image-BGZ2pFmO.js"),[]).then(e=>e.default):a(()=>import("./index-SaOy8OjI.js"),[]).then(e=>e.wallet);case"com.neonwallet":return t?a(()=>import("./image-D2051qUc.js"),[]).then(e=>e.default):a(()=>import("./index-CUJUgO36.js"),[]).then(e=>e.wallet);case"com.secuxtech":return t?a(()=>import("./image-DHHZDLK-.js"),[]).then(e=>e.default):a(()=>import("./index-D1G_5OyD.js"),[]).then(e=>e.wallet);case"com.unitywallet":return t?a(()=>import("./image-BqmT5urK.js"),[]).then(e=>e.default):a(()=>import("./index-BqxSKkSq.js"),[]).then(e=>e.wallet);case"io.miraiapp":return t?a(()=>import("./image-Bi1elmSL.js"),[]).then(e=>e.default):a(()=>import("./index-D0rQT1_1.js"),[]).then(e=>e.wallet);case"com.beexo":return t?a(()=>import("./image-MGwelZJS.js"),[]).then(e=>e.default):a(()=>import("./index-Bbv-4GNB.js"),[]).then(e=>e.wallet);case"social.halo":return t?a(()=>import("./image-CbnSXqJS.js"),[]).then(e=>e.default):a(()=>import("./index-KpPak-wu.js"),[]).then(e=>e.wallet);case"com.gemspocket":return t?a(()=>import("./image-DpGIEKrK.js"),[]).then(e=>e.default):a(()=>import("./index-RpXAvNRL.js"),[]).then(e=>e.wallet);case"app.status":return t?a(()=>import("./image-9509MPsE.js"),[]).then(e=>e.default):a(()=>import("./index-DLMSD3H_.js"),[]).then(e=>e.wallet);case"com.midoin":return t?a(()=>import("./image-BocNs9ze.js"),[]).then(e=>e.default):a(()=>import("./index-CrBWjlui.js"),[]).then(e=>e.wallet);case"id.competence":return t?a(()=>import("./image-CaqftHzf.js"),[]).then(e=>e.default):a(()=>import("./index-CGMXxK_x.js"),[]).then(e=>e.wallet);case"com.safemoon":return t?a(()=>import("./image-BcfiUDv-.js"),[]).then(e=>e.default):a(()=>import("./index-BgECKCj8.js"),[]).then(e=>e.wallet);case"llc.besc":return t?a(()=>import("./image-DLwHWQ4l.js"),[]).then(e=>e.default):a(()=>import("./index-CbMeskkV.js"),[]).then(e=>e.wallet);case"baby.smart":return t?a(()=>import("./image-VxDqDj0T.js"),[]).then(e=>e.default):a(()=>import("./index-BmKJ1abQ.js"),[]).then(e=>e.wallet);case"app.onto":return t?a(()=>import("./image-BCXqBewH.js"),[]).then(e=>e.default):a(()=>import("./index-BPFXH4g9.js"),[]).then(e=>e.wallet);case"com.ivirse":return t?a(()=>import("./image-8DkN4eFx.js"),[]).then(e=>e.default):a(()=>import("./index-CqWFxNbG.js"),[]).then(e=>e.wallet);case"one.mixin.messenger":return t?a(()=>import("./image-DecSbpNG.js"),[]).then(e=>e.default):a(()=>import("./index-PjYIiHEb.js"),[]).then(e=>e.wallet);case"cash.abpay":return t?a(()=>import("./image-Bb4ZLG-2.js"),[]).then(e=>e.default):a(()=>import("./index-BrvgJVgh.js"),[]).then(e=>e.wallet);case"ch.dssecurity":return t?a(()=>import("./image-ddsU9gPS.js"),[]).then(e=>e.default):a(()=>import("./index-DDdoZFD-.js"),[]).then(e=>e.wallet);case"com.concordium.wallet":return t?a(()=>import("./image-W5rUOVDT.js"),[]).then(e=>e.default):a(()=>import("./index-B5BAsv-B.js"),[]).then(e=>e.wallet);case"io.zkape":return t?a(()=>import("./image-Bm-o9RF3.js"),[]).then(e=>e.default):a(()=>import("./index-yLatYZZK.js"),[]).then(e=>e.wallet);case"com.paliwallet":return t?a(()=>import("./image-DqH_Lyo9.js"),[]).then(e=>e.default):a(()=>import("./index-C93NlSEw.js"),[]).then(e=>e.wallet);case"io.pitaka":return t?a(()=>import("./image-Bo8CHmCG.js"),[]).then(e=>e.default):a(()=>import("./index-DeQey0SH.js"),[]).then(e=>e.wallet);case"com.saitamatoken":return t?a(()=>import("./image-AlOoIjkb.js"),[]).then(e=>e.default):a(()=>import("./index-CNkg8_tm.js"),[]).then(e=>e.wallet);case"org.mugambo":return t?a(()=>import("./image-vXNBwFvw.js"),[]).then(e=>e.default):a(()=>import("./index-CqJjpCD5.js"),[]).then(e=>e.wallet);case"fi.stablez":return t?a(()=>import("./image-CruMo9Ar.js"),[]).then(e=>e.default):a(()=>import("./index-Wz7obrZB.js"),[]).then(e=>e.wallet);case"io.legacynetwork":return t?a(()=>import("./image-Dgb3Vdrr.js"),[]).then(e=>e.default):a(()=>import("./index-DLHjxUiX.js"),[]).then(e=>e.wallet);case"com.meld.app":return t?a(()=>import("./image-DrobCWF2.js"),[]).then(e=>e.default):a(()=>import("./index-BqLb859N.js"),[]).then(e=>e.wallet);case"io.bladewallet":return t?a(()=>import("./image-nqueMEws.js"),[]).then(e=>e.default):a(()=>import("./index-C0I75rp3.js"),[]).then(e=>e.wallet);case"com.authentrend":return t?a(()=>import("./image-CmzmxiTz.js"),[]).then(e=>e.default):a(()=>import("./index-0qRtNAQn.js"),[]).then(e=>e.wallet);case"com.webauth":return t?a(()=>import("./image-EyKsXf_1.js"),[]).then(e=>e.default):a(()=>import("./index-BXnDDK-y.js"),[]).then(e=>e.wallet);case"xyz.tucop":return t?a(()=>import("./image-8r04P3UP.js"),[]).then(e=>e.default):a(()=>import("./index-Bbznecif.js"),[]).then(e=>e.wallet);case"pro.fintoken":return t?a(()=>import("./image-BBez6ov1.js"),[]).then(e=>e.default):a(()=>import("./index-CP3DQPwx.js"),[]).then(e=>e.wallet);case"io.nash":return t?a(()=>import("./image--fcqsYch.js"),[]).then(e=>e.default):a(()=>import("./index-Bx9srovK.js"),[]).then(e=>e.wallet);case"vc.uincubator.api":return t?a(()=>import("./image-CyLv-qKv.js"),[]).then(e=>e.default):a(()=>import("./index-B5AZ3O3C.js"),[]).then(e=>e.wallet);case"io.unagi.unawallet":return t?a(()=>import("./image-C6ewnpHo.js"),[]).then(e=>e.default):a(()=>import("./index-CD7cY8HX.js"),[]).then(e=>e.wallet);case"io.nonbank":return t?a(()=>import("./image-TA_PkYBz.js"),[]).then(e=>e.default):a(()=>import("./index-DSWhMtMn.js"),[]).then(e=>e.wallet);case"io.armana.portal":return t?a(()=>import("./image-CI3i53ES.js"),[]).then(e=>e.default):a(()=>import("./index-DuTQzi4Z.js"),[]).then(e=>e.wallet);case"com.x9wallet":return t?a(()=>import("./image-BnT6IaIq.js"),[]).then(e=>e.default):a(()=>import("./index-K7y9yqJI.js"),[]).then(e=>e.wallet);case"io.kigo":return t?a(()=>import("./image-D9i7y0RW.js"),[]).then(e=>e.default):a(()=>import("./index-BIFgx20V.js"),[]).then(e=>e.wallet);case"com.alphawallet":return t?a(()=>import("./image-xJO47ptb.js"),[]).then(e=>e.default):a(()=>import("./index-B78E3fcT.js"),[]).then(e=>e.wallet);case"com.getcogni":return t?a(()=>import("./image-CwsKp0mM.js"),[]).then(e=>e.default):a(()=>import("./index-BNlDhEDg.js"),[]).then(e=>e.wallet);case"app.sinum":return t?a(()=>import("./image-DTy0DgOV.js"),[]).then(e=>e.default):a(()=>import("./index-D5GVUjIM.js"),[]).then(e=>e.wallet);case"finance.soulswap.app":return t?a(()=>import("./image-BI8lK7Gl.js"),[]).then(e=>e.default):a(()=>import("./index-CB_NguTF.js"),[]).then(e=>e.wallet);case"io.loopring.wallet":return t?a(()=>import("./image-BdLvgjKp.js"),[]).then(e=>e.default):a(()=>import("./index-DpoJvg5R.js"),[]).then(e=>e.wallet);case"com.shapeshift":return t?a(()=>import("./image-T2oAotCg.js"),[]).then(e=>e.default):a(()=>import("./index-CdMxme0L.js"),[]).then(e=>e.wallet);case"io.trinity-tech":return t?a(()=>import("./image-bHVCC2t9.js"),[]).then(e=>e.default):a(()=>import("./index-JNZoio_2.js"),[]).then(e=>e.wallet);case"money.keychain":return t?a(()=>import("./image-CHotlokX.js"),[]).then(e=>e.default):a(()=>import("./index-C2CZkwuV.js"),[]).then(e=>e.wallet);case"com.superhero.cordova":return t?a(()=>import("./image-CsmwtAjX.js"),[]).then(e=>e.default):a(()=>import("./index-C5X26G0P.js"),[]).then(e=>e.wallet);case"com.bettatrade":return t?a(()=>import("./image-B4MULACL.js"),[]).then(e=>e.default):a(()=>import("./index-qNIXx6_B.js"),[]).then(e=>e.wallet);case"online.puzzle":return t?a(()=>import("./image-C4hEqt6v.js"),[]).then(e=>e.default):a(()=>import("./index-D2-ySoTs.js"),[]).then(e=>e.wallet);case"gg.indi":return t?a(()=>import("./image-DdicXBNF.js"),[]).then(e=>e.default):a(()=>import("./index-BTkNDmCP.js"),[]).then(e=>e.wallet);case"io.tradestrike":return t?a(()=>import("./image-Bsv1aEQB.js"),[]).then(e=>e.default):a(()=>import("./index-CLtv9-lU.js"),[]).then(e=>e.wallet);case"xyz.echooo":return t?a(()=>import("./image-C7H4CQ65.js"),[]).then(e=>e.default):a(()=>import("./index-B-UTLjBc.js"),[]).then(e=>e.wallet);case"com.kryptogo":return t?a(()=>import("./image-D3ALeCj7.js"),[]).then(e=>e.default):a(()=>import("./index-BtBx3hi1.js"),[]).then(e=>e.wallet);case"io.trustasset":return t?a(()=>import("./image-BfmBx3-B.js"),[]).then(e=>e.default):a(()=>import("./index-MECmwSvw.js"),[]).then(e=>e.wallet);case"app.utorg":return t?a(()=>import("./image-CyF2UJbG.js"),[]).then(e=>e.default):a(()=>import("./index-DK-e_E51.js"),[]).then(e=>e.wallet);case"app.dfinnwallet":return t?a(()=>import("./image-DGLcwgsS.js"),[]).then(e=>e.default):a(()=>import("./index-DR-ujXcj.js"),[]).then(e=>e.wallet);case"org.rezor":return t?a(()=>import("./image-D_0i3ZH4.js"),[]).then(e=>e.default):a(()=>import("./index-DlKNOIdN.js"),[]).then(e=>e.wallet);case"io.legionnetwork":return t?a(()=>import("./image-BszqTwo7.js"),[]).then(e=>e.default):a(()=>import("./index-DMyHg26L.js"),[]).then(e=>e.wallet);case"cc.maxwallet":return t?a(()=>import("./image-CxvWjDXv.js"),[]).then(e=>e.default):a(()=>import("./index-Dy45c3qF.js"),[]).then(e=>e.wallet);case"com.ripio":return t?a(()=>import("./image-DZpGtN5l.js"),[]).then(e=>e.default):a(()=>import("./index-BoC-cn90.js"),[]).then(e=>e.wallet);case"com.fxwallet":return t?a(()=>import("./image-Bkj-ZRbS.js"),[]).then(e=>e.default):a(()=>import("./index-D8dYcFAn.js"),[]).then(e=>e.wallet);case"inc.tomo":return t?a(()=>import("./image-rw28GAIu.js"),[]).then(e=>e.default):a(()=>import("./index-Bh8eOJMM.js"),[]).then(e=>e.wallet);case"me.komet.app":return t?a(()=>import("./image-29vwsAfI.js"),[]).then(e=>e.default):a(()=>import("./index-CapnWgEl.js"),[]).then(e=>e.wallet);case"io.guardiianwallet":return t?a(()=>import("./image-DIDeRhKH.js"),[]).then(e=>e.default):a(()=>import("./index-CWTqaiN6.js"),[]).then(e=>e.wallet);case"io.hacken.hai":return t?a(()=>import("./image-Fq457JJn.js"),[]).then(e=>e.default):a(()=>import("./index-BH1-nK1j.js"),[]).then(e=>e.wallet);case"com.zypto":return t?a(()=>import("./image-D9OC6Qfy.js"),[]).then(e=>e.default):a(()=>import("./index-5U2ZJeh5.js"),[]).then(e=>e.wallet);case"io.nabox":return t?a(()=>import("./image-CJb0NNxX.js"),[]).then(e=>e.default):a(()=>import("./index-Cl87iGjg.js"),[]).then(e=>e.wallet);case"com.tastycrypto":return t?a(()=>import("./image-IpgDqPq2.js"),[]).then(e=>e.default):a(()=>import("./index-CXgqt45P.js"),[]).then(e=>e.wallet);case"com.ballet":return t?a(()=>import("./image-DNyYhMNV.js"),[]).then(e=>e.default):a(()=>import("./index-DhFHq_nZ.js"),[]).then(e=>e.wallet);case"io.talken":return t?a(()=>import("./image-DjXN5hvv.js"),[]).then(e=>e.default):a(()=>import("./index-CuJtvtqs.js"),[]).then(e=>e.wallet);case"io.wallacy":return t?a(()=>import("./image-CdGvq_lV.js"),[]).then(e=>e.default):a(()=>import("./index-DcUozftP.js"),[]).then(e=>e.wallet);case"network.mrhb":return t?a(()=>import("./image-CaBQfcNB.js"),[]).then(e=>e.default):a(()=>import("./index-BpspMk9l.js"),[]).then(e=>e.wallet);case"io.pockie":return t?a(()=>import("./image-D13kcv8b.js"),[]).then(e=>e.default):a(()=>import("./index-Bd7BhrCK.js"),[]).then(e=>e.wallet);case"me.astrox":return t?a(()=>import("./image-BGSprUxs.js"),[]).then(e=>e.default):a(()=>import("./index-BM9GzZ_o.js"),[]).then(e=>e.wallet);case"com.thirdweb":return t?a(()=>import("./image--O11VYbP.js"),[]).then(e=>e.default):a(()=>import("./index-VZmM-6RJ.js"),[]).then(e=>e.wallet);case"com.poolsmobility.wallet":return t?a(()=>import("./image-CUFBkGzy.js"),[]).then(e=>e.default):a(()=>import("./index-DMyDV-OH.js"),[]).then(e=>e.wallet);case"xyz.roam.wallet":return t?a(()=>import("./image-BBk5bBxJ.js"),[]).then(e=>e.default):a(()=>import("./index-DACt8hFb.js"),[]).then(e=>e.wallet);case"app.gamic":return t?a(()=>import("./image-CbmAI5Wi.js"),[]).then(e=>e.default):a(()=>import("./index-D09WfuKj.js"),[]).then(e=>e.wallet);case"app.m1nty":return t?a(()=>import("./image-8Zz6I0OH.js"),[]).then(e=>e.default):a(()=>import("./index-CU6cpe0O.js"),[]).then(e=>e.wallet);case"network.trustkeys":return t?a(()=>import("./image-BJAlBW3-.js"),[]).then(e=>e.default):a(()=>import("./index-BSA2BPZ9.js"),[]).then(e=>e.wallet);case"com.caesiumlab":return t?a(()=>import("./image-DLtkWmCC.js"),[]).then(e=>e.default):a(()=>import("./index-CZNdz8B6.js"),[]).then(e=>e.wallet);case"app.catecoin":return t?a(()=>import("./image-BIIaxSfC.js"),[]).then(e=>e.default):a(()=>import("./index-DNynPGua.js"),[]).then(e=>e.wallet);case"com.hootark":return t?a(()=>import("./image-BQTKy54v.js"),[]).then(e=>e.default):a(()=>import("./index-DhlaSoR4.js"),[]).then(e=>e.wallet);case"com.crossmint":return t?a(()=>import("./image-DrH3Wn2w.js"),[]).then(e=>e.default):a(()=>import("./index-Czf-i91G.js"),[]).then(e=>e.wallet);case"com.coincircle":return t?a(()=>import("./image-DOcz3CQ4.js"),[]).then(e=>e.default):a(()=>import("./index-Crs9jVrm.js"),[]).then(e=>e.wallet);case"io.bharatbox":return t?a(()=>import("./image-D1eN-vq9.js"),[]).then(e=>e.default):a(()=>import("./index-CdYRC4Ux.js"),[]).then(e=>e.wallet);case"nl.greenhood.wallet":return t?a(()=>import("./image-Cyy1KupU.js"),[]).then(e=>e.default):a(()=>import("./index-BPgl8Hhp.js"),[]).then(e=>e.wallet);case"co.swopme":return t?a(()=>import("./image-B6SAWLjq.js"),[]).then(e=>e.default):a(()=>import("./index-DMAP8qTI.js"),[]).then(e=>e.wallet);case"com.kresus":return t?a(()=>import("./image-DesBMjvP.js"),[]).then(e=>e.default):a(()=>import("./index-oEcArN4B.js"),[]).then(e=>e.wallet);case"com.dolletwallet":return t?a(()=>import("./image-fjbgiffe.js"),[]).then(e=>e.default):a(()=>import("./index-CCIAeA2T.js"),[]).then(e=>e.wallet);case"net.shinobi-wallet":return t?a(()=>import("./image-WbOd8jAJ.js"),[]).then(e=>e.default):a(()=>import("./index-CZmLnawh.js"),[]).then(e=>e.wallet);case"com.azcoiner":return t?a(()=>import("./image-BQcTbEVl.js"),[]).then(e=>e.default):a(()=>import("./index-t6B_NULY.js"),[]).then(e=>e.wallet);case"com.passwallet.app":return t?a(()=>import("./image-DJYKaoNi.js"),[]).then(e=>e.default):a(()=>import("./index-Ct6AYfZ-.js"),[]).then(e=>e.wallet);case"app.qubic.wallet":return t?a(()=>import("./image-BBZFtk5k.js"),[]).then(e=>e.default):a(()=>import("./index-DoKwRUhz.js"),[]).then(e=>e.wallet);case"com.coinex.wallet":return t?a(()=>import("./image-CfglWSsQ.js"),[]).then(e=>e.default):a(()=>import("./index-DMEV07wA.js"),[]).then(e=>e.wallet);case"app.xverse":return t?a(()=>import("./image-DETlLb_v.js"),[]).then(e=>e.default):a(()=>import("./index-DAlw00ee.js"),[]).then(e=>e.wallet);case"com.flash-wallet":return t?a(()=>import("./image-BzGwleUn.js"),[]).then(e=>e.default):a(()=>import("./index-7BdGIDy3.js"),[]).then(e=>e.wallet);case"com.vgxfoundation":return t?a(()=>import("./image-C6NJnfCW.js"),[]).then(e=>e.default):a(()=>import("./index-CsAX4sL-.js"),[]).then(e=>e.wallet);case"org.arianee":return t?a(()=>import("./image-B6VmDbM6.js"),[]).then(e=>e.default):a(()=>import("./index-Cx8lAzRu.js"),[]).then(e=>e.wallet);case"io.myabcwallet":return t?a(()=>import("./image-jv6wUF7a.js"),[]).then(e=>e.default):a(()=>import("./index-3an-fsOm.js"),[]).then(e=>e.wallet);case"io.owallet":return t?a(()=>import("./image-DGhNZ1rS.js"),[]).then(e=>e.default):a(()=>import("./index-D2_d10WC.js"),[]).then(e=>e.wallet);case"io.zelus":return t?a(()=>import("./image-1epPqHV4.js"),[]).then(e=>e.default):a(()=>import("./index-hUldZ-v8.js"),[]).then(e=>e.wallet);case"net.myrenegade":return t?a(()=>import("./image-SJHuomz2.js"),[]).then(e=>e.default):a(()=>import("./index-C5gBqe1B.js"),[]).then(e=>e.wallet);case"io.clingon":return t?a(()=>import("./image-2s8lIjLJ.js"),[]).then(e=>e.default):a(()=>import("./index-Dk8LF9Yk.js"),[]).then(e=>e.wallet);case"com.icewal":return t?a(()=>import("./image-rdvu9IOp.js"),[]).then(e=>e.default):a(()=>import("./index-Cd5Dye5X.js"),[]).then(e=>e.wallet);case"io.streakk":return t?a(()=>import("./image-CcPbeTXv.js"),[]).then(e=>e.default):a(()=>import("./index-CrGDBMbK.js"),[]).then(e=>e.wallet);case"com.dokwallet":return t?a(()=>import("./image-BRPzDWpX.js"),[]).then(e=>e.default):a(()=>import("./index-xEbiF_Me.js"),[]).then(e=>e.wallet);case"finance.porta":return t?a(()=>import("./image-BNvlqRxs.js"),[]).then(e=>e.default):a(()=>import("./index-DSL1LhIu.js"),[]).then(e=>e.wallet);case"io.prettygood.x":return t?a(()=>import("./image-BhmKXBqm.js"),[]).then(e=>e.default):a(()=>import("./index-DfafaK4Q.js"),[]).then(e=>e.wallet);case"io.earthwallet":return t?a(()=>import("./image-BOJcifnx.js"),[]).then(e=>e.default):a(()=>import("./index-BmwlJTQ-.js"),[]).then(e=>e.wallet);case"net.spatium.wallet":return t?a(()=>import("./image-CmrOpLf4.js"),[]).then(e=>e.default):a(()=>import("./index-Fd858RJQ.js"),[]).then(e=>e.wallet);case"live.superex":return t?a(()=>import("./image-ByHnaba8.js"),[]).then(e=>e.default):a(()=>import("./index-DqVvpGRi.js"),[]).then(e=>e.wallet);case"com.adftechnology":return t?a(()=>import("./image-C6LRjQzh.js"),[]).then(e=>e.default):a(()=>import("./index-C-b1qpM9.js"),[]).then(e=>e.wallet);case"com.bscecowallet":return t?a(()=>import("./image-8u03hBEl.js"),[]).then(e=>e.default):a(()=>import("./index-Dn2svNQz.js"),[]).then(e=>e.wallet);case"io.wallypto":return t?a(()=>import("./image-CRU88082.js"),[]).then(e=>e.default):a(()=>import("./index-j06jujv2.js"),[]).then(e=>e.wallet);case"com.reown":return t?a(()=>import("./image-D3tLM-DF.js"),[]).then(e=>e.default):a(()=>import("./index-DibwKtF2.js"),[]).then(e=>e.wallet);case"finance.voltage":return t?a(()=>import("./image-ZVoqlWXW.js"),[]).then(e=>e.default):a(()=>import("./index-XRQW1mUN.js"),[]).then(e=>e.wallet);case"com.walletconnect":return t?a(()=>import("./image-BAS5CqSz.js"),[]).then(e=>e.default):a(()=>import("./index-B-BftUxa.js"),[]).then(e=>e.wallet);case"io.passpay":return t?a(()=>import("./image-Ci0UFTFy.js"),[]).then(e=>e.default):a(()=>import("./index-CP_9UNXA.js"),[]).then(e=>e.wallet);case"technology.obvious":return t?a(()=>import("./image-ZLtraAGN.js"),[]).then(e=>e.default):a(()=>import("./index-BzNpkHfI.js"),[]).then(e=>e.wallet);case"io.plutope":return t?a(()=>import("./image-Bz03or90.js"),[]).then(e=>e.default):a(()=>import("./index-CszQa87W.js"),[]).then(e=>e.wallet);case"io.buzz-up":return t?a(()=>import("./image-BsQYdoXP.js"),[]).then(e=>e.default):a(()=>import("./index-BoJGVmma.js"),[]).then(e=>e.wallet);case"co.xellar":return t?a(()=>import("./image-D2QL-j27.js"),[]).then(e=>e.default):a(()=>import("./index-cdlur5jM.js"),[]).then(e=>e.wallet);case"com.kaxaa":return t?a(()=>import("./image-DPzEe6a_.js"),[]).then(e=>e.default):a(()=>import("./index-DFSGuScS.js"),[]).then(e=>e.wallet);case"org.shefi":return t?a(()=>import("./image-DwUGDFj5.js"),[]).then(e=>e.default):a(()=>import("./index-Dtavj5eK.js"),[]).then(e=>e.wallet);case"xyz.orion":return t?a(()=>import("./image-CCDmsN6r.js"),[]).then(e=>e.default):a(()=>import("./index-Ba2OoCBH.js"),[]).then(e=>e.wallet);case"world.dosi.vault":return t?a(()=>import("./image-Cy0vmJls.js"),[]).then(e=>e.default):a(()=>import("./index-eujSyrnd.js"),[]).then(e=>e.wallet);case"network.gridlock":return t?a(()=>import("./image-CxyHP7w7.js"),[]).then(e=>e.default):a(()=>import("./index-Ce98wt2N.js"),[]).then(e=>e.wallet);case"finance.plena":return t?a(()=>import("./image-Cwg1QVuh.js"),[]).then(e=>e.default):a(()=>import("./index-BG1ZQeCA.js"),[]).then(e=>e.wallet);case"cc.dropp":return t?a(()=>import("./image-CAIffJi4.js"),[]).then(e=>e.default):a(()=>import("./index-HFnaQWCU.js"),[]).then(e=>e.wallet);case"io.scramberry":return t?a(()=>import("./image-D8ARN-Gu.js"),[]).then(e=>e.default):a(()=>import("./index-BIcsFldg.js"),[]).then(e=>e.wallet);case"xyz.bonuz":return t?a(()=>import("./image-HcidEyjv.js"),[]).then(e=>e.default):a(()=>import("./index-BZhX-e71.js"),[]).then(e=>e.wallet);case"com.bmawallet":return t?a(()=>import("./image-kZBIIBVa.js"),[]).then(e=>e.default):a(()=>import("./index-BM8c6qO-.js"),[]).then(e=>e.wallet);case"co.lifedefi":return t?a(()=>import("./image-DRpXk5be.js"),[]).then(e=>e.default):a(()=>import("./index-otRo5H2H.js"),[]).then(e=>e.wallet);case"com.get-verso":return t?a(()=>import("./image-CgzMLfDa.js"),[]).then(e=>e.default):a(()=>import("./index-DAEFTu29.js"),[]).then(e=>e.wallet);case"io.blocto":return t?a(()=>import("./image-FnAIuX7S.js"),[]).then(e=>e.default):a(()=>import("./index-ZITrt5Fi.js"),[]).then(e=>e.wallet);case"com.pandoshi":return t?a(()=>import("./image-PWpnYSKI.js"),[]).then(e=>e.default):a(()=>import("./index-BmXd0pys.js"),[]).then(e=>e.wallet);case"io.getclave":return t?a(()=>import("./image-rvsWf8U_.js"),[]).then(e=>e.default):a(()=>import("./index--rITGawC.js"),[]).then(e=>e.wallet);case"technology.jambo":return t?a(()=>import("./image-Bx8ULApC.js"),[]).then(e=>e.default):a(()=>import("./index-C2KnoZm4.js"),[]).then(e=>e.wallet);case"app.edge":return t?a(()=>import("./image-1-dOu4Yt.js"),[]).then(e=>e.default):a(()=>import("./index-stFagoJS.js"),[]).then(e=>e.wallet);case"io.banksocial":return t?a(()=>import("./image-OrIz0o8m.js"),[]).then(e=>e.default):a(()=>import("./index-Ia3LffGn.js"),[]).then(e=>e.wallet);case"io.konio":return t?a(()=>import("./image-C2Wl7RAy.js"),[]).then(e=>e.default):a(()=>import("./index-B-kI7R4f.js"),[]).then(e=>e.wallet);case"com.qubetics":return t?a(()=>import("./image-DLvMDcgw.js"),[]).then(e=>e.default):a(()=>import("./index-C_j5E1ow.js"),[]).then(e=>e.wallet);case"app.imem":return t?a(()=>import("./image-Atwyf6cQ.js"),[]).then(e=>e.default):a(()=>import("./index-KXLAu1y1.js"),[]).then(e=>e.wallet);case"com.purechain":return t?a(()=>import("./image-DgU8tR58.js"),[]).then(e=>e.default):a(()=>import("./index-G-h-xM0C.js"),[]).then(e=>e.wallet);case"io.ethos":return t?a(()=>import("./image-DmNOl1OW.js"),[]).then(e=>e.default):a(()=>import("./index-DmLPMpkA.js"),[]).then(e=>e.wallet);case"io.didwallet":return t?a(()=>import("./image-CzKmxeZp.js"),[]).then(e=>e.default):a(()=>import("./index-QGSP4PI8.js"),[]).then(e=>e.wallet);case"com.dextrade":return t?a(()=>import("./image-B_ozWfd0.js"),[]).then(e=>e.default):a(()=>import("./index-CdOxXIip.js"),[]).then(e=>e.wallet);case"org.kelp":return t?a(()=>import("./image-CcKS-8-S.js"),[]).then(e=>e.default):a(()=>import("./index-DUBZIaC-.js"),[]).then(e=>e.wallet);case"xyz.nestwallet":return t?a(()=>import("./image-Bq1UxveY.js"),[]).then(e=>e.default):a(()=>import("./index-uKvrIGe-.js"),[]).then(e=>e.wallet);case"com.cryptnox":return t?a(()=>import("./image-UFnS_pK0.js"),[]).then(e=>e.default):a(()=>import("./index-ComRbnem.js"),[]).then(e=>e.wallet);case"land.liker":return t?a(()=>import("./image-C_JPqQZj.js"),[]).then(e=>e.default):a(()=>import("./index-CId5PD0X.js"),[]).then(e=>e.wallet);case"io.hippowallet":return t?a(()=>import("./image-BdJA4XzW.js"),[]).then(e=>e.default):a(()=>import("./index-BTzbgIH6.js"),[]).then(e=>e.wallet);case"io.certhis":return t?a(()=>import("./image-bSOL4gQb.js"),[]).then(e=>e.default):a(()=>import("./index-BxtNhRvf.js"),[]).then(e=>e.wallet);case"io.safecryptowallet":return t?a(()=>import("./image-DFF2Z6Pk.js"),[]).then(e=>e.default):a(()=>import("./index-CWdL5XwO.js"),[]).then(e=>e.wallet);case"com.saify":return t?a(()=>import("./image-DOwBqPVS.js"),[]).then(e=>e.default):a(()=>import("./index-De1eZyIJ.js"),[]).then(e=>e.wallet);case"com.tiduswallet":return t?a(()=>import("./image-DzJAqGfB.js"),[]).then(e=>e.default):a(()=>import("./index-BMPGw_D6.js"),[]).then(e=>e.wallet);case"io.uptn.dapp-web":return t?a(()=>import("./image-C4ELurjg.js"),[]).then(e=>e.default):a(()=>import("./index-jsmqr-24.js"),[]).then(e=>e.wallet);case"com.it.onewallet":return t?a(()=>import("./image-CWCOKSln.js"),[]).then(e=>e.default):a(()=>import("./index-DHNwai-Z.js"),[]).then(e=>e.wallet);case"com.rktechworks":return t?a(()=>import("./image-BhECDi_9.js"),[]).then(e=>e.default):a(()=>import("./index-D6xvjdG0.js"),[]).then(e=>e.wallet);case"com.revelator.wallet":return t?a(()=>import("./image-nW5JvdXC.js"),[]).then(e=>e.default):a(()=>import("./index-CNl69Nv0.js"),[]).then(e=>e.wallet);case"com.sinohope":return t?a(()=>import("./image-D7P0qSfx.js"),[]).then(e=>e.default):a(()=>import("./index-DKzyJcIY.js"),[]).then(e=>e.wallet);case"network.dgg":return t?a(()=>import("./image-DrraBYJZ.js"),[]).then(e=>e.default):a(()=>import("./index-DnUUaSfF.js"),[]).then(e=>e.wallet);case"io.up":return t?a(()=>import("./image-DbpOM2LD.js"),[]).then(e=>e.default):a(()=>import("./index-BuWGQyCe.js"),[]).then(e=>e.wallet);case"com.lif3":return t?a(()=>import("./image-DC2DOoz2.js"),[]).then(e=>e.default):a(()=>import("./index-BKkJhanY.js"),[]).then(e=>e.wallet);case"io.bimwallet":return t?a(()=>import("./image-BKSQyIc5.js"),[]).then(e=>e.default):a(()=>import("./index-3DerMn1X.js"),[]).then(e=>e.wallet);case"pub.dg":return t?a(()=>import("./image-C4KoLZ1v.js"),[]).then(e=>e.default):a(()=>import("./index-D6d2Y6jv.js"),[]).then(e=>e.wallet);case"com.wemix":return t?a(()=>import("./image-CawBnBIo.js"),[]).then(e=>e.default):a(()=>import("./index-18L0wZ74.js"),[]).then(e=>e.wallet);case"com.pierwallet":return t?a(()=>import("./image-DA8Sg5HZ.js"),[]).then(e=>e.default):a(()=>import("./index-mJTgSazQ.js"),[]).then(e=>e.wallet);case"net.stasis":return t?a(()=>import("./image-CyE6Mi3e.js"),[]).then(e=>e.default):a(()=>import("./index-CJ8I9s4o.js"),[]).then(e=>e.wallet);case"com.peakdefi":return t?a(()=>import("./image-DUcJQ0b3.js"),[]).then(e=>e.default):a(()=>import("./index-DEMIRENu.js"),[]).then(e=>e.wallet);case"com.3swallet":return t?a(()=>import("./image-CD3he1Tj.js"),[]).then(e=>e.default):a(()=>import("./index-DVGcX2HE.js"),[]).then(e=>e.wallet);case"com.example.subdomain":return t?a(()=>import("./image-Cs2bevZt.js"),[]).then(e=>e.default):a(()=>import("./index-CJt068xh.js"),[]).then(e=>e.wallet);case"com.reown.appkit-lab":return t?a(()=>import("./image-CnDG0aor.js"),[]).then(e=>e.default):a(()=>import("./index-BzfyCotn.js"),[]).then(e=>e.wallet);case"com.opz":return t?a(()=>import("./image-D1qvgd7h.js"),[]).then(e=>e.default):a(()=>import("./index-CMGByxdA.js"),[]).then(e=>e.wallet);case"ai.spotonchain.platform":return t?a(()=>import("./image-C6QSWUy4.js"),[]).then(e=>e.default):a(()=>import("./index-Ba7PpD6d.js"),[]).then(e=>e.wallet);case"org.dailychain.wallet":return t?a(()=>import("./image-BJ_lqI1X.js"),[]).then(e=>e.default):a(()=>import("./index-DQa9pNJd.js"),[]).then(e=>e.wallet);case"app.omni":return t?a(()=>import("./image-CqLwuE__.js"),[]).then(e=>e.default):a(()=>import("./index-D_7wDcMK.js"),[]).then(e=>e.wallet);case"id.plumaa":return t?a(()=>import("./image-BvJKCSpY.js"),[]).then(e=>e.default):a(()=>import("./index-D45a0k-1.js"),[]).then(e=>e.wallet);case"io.ttmwallet":return t?a(()=>import("./image-Chg2WzE1.js"),[]).then(e=>e.default):a(()=>import("./index-CLikIjn_.js"),[]).then(e=>e.wallet);case"io.kgen":return t?a(()=>import("./image-DFYGQEwh.js"),[]).then(e=>e.default):a(()=>import("./index-BQWXi0by.js"),[]).then(e=>e.wallet);case"com.nufinetes":return t?a(()=>import("./image-CpFHTO_m.js"),[]).then(e=>e.default):a(()=>import("./index-B8De2hoC.js"),[]).then(e=>e.wallet);case"com.squirrelwallet":return t?a(()=>import("./image-bHJO6btW.js"),[]).then(e=>e.default):a(()=>import("./index-DyaPXLoO.js"),[]).then(e=>e.wallet);case"eu.trusteeglobal":return t?a(()=>import("./image-cDoShVvl.js"),[]).then(e=>e.default):a(()=>import("./index-B51294pb.js"),[]).then(e=>e.wallet);case"com.daffione":return t?a(()=>import("./image-Dtc98pdf.js"),[]).then(e=>e.default):a(()=>import("./index-BIXqJF5y.js"),[]).then(e=>e.wallet);case"com.saakuru.app":return t?a(()=>import("./image-TQLBEOIW.js"),[]).then(e=>e.default):a(()=>import("./index-CjVYDT09.js"),[]).then(e=>e.wallet);case"io.r0ar":return t?a(()=>import("./image-4bx5chOJ.js"),[]).then(e=>e.default):a(()=>import("./index-CfCXSq_b.js"),[]).then(e=>e.wallet);case"com.nodle":return t?a(()=>import("./image-tiHbZ1Vk.js"),[]).then(e=>e.default):a(()=>import("./index-BwL47YsA.js"),[]).then(e=>e.wallet);case"app.tofee":return t?a(()=>import("./image-DpHbdMp9.js"),[]).then(e=>e.default):a(()=>import("./index-Bk-uZV0j.js"),[]).then(e=>e.wallet);case"io.pltwallet":return t?a(()=>import("./image-BIDqxk8w.js"),[]).then(e=>e.default):a(()=>import("./index-eiEAIzdd.js"),[]).then(e=>e.wallet);case"org.talkapp":return t?a(()=>import("./image-BkKo9DtA.js"),[]).then(e=>e.default):a(()=>import("./index-BGGk2Hck.js"),[]).then(e=>e.wallet);case"io.ready":return t?a(()=>import("./image-BwjeUYie.js"),[]).then(e=>e.default):a(()=>import("./index-BQwDdmmS.js"),[]).then(e=>e.wallet);case"app.w3wallet":return t?a(()=>import("./image-Covp72ND.js"),[]).then(e=>e.default):a(()=>import("./index-Cb41eDDJ.js"),[]).then(e=>e.wallet);case"pro.ds.app":return t?a(()=>import("./image-Bktw-NJ-.js"),[]).then(e=>e.default):a(()=>import("./index-b5ABnFKj.js"),[]).then(e=>e.wallet);case"com.reown.docs":return t?a(()=>import("./image-V4qYiUxw.js"),[]).then(e=>e.default):a(()=>import("./index-DsgD7D-8.js"),[]).then(e=>e.wallet);case"com.apollox":return t?a(()=>import("./image-ss2LFlQu.js"),[]).then(e=>e.default):a(()=>import("./index-BLMjeGJ-.js"),[]).then(e=>e.wallet);case"com.ipmb":return t?a(()=>import("./image-CirJIT7l.js"),[]).then(e=>e.default):a(()=>import("./index-DP0utIbV.js"),[]).then(e=>e.wallet);case"com.payperless":return t?a(()=>import("./image-q4XfUN6v.js"),[]).then(e=>e.default):a(()=>import("./index-szNElS1a.js"),[]).then(e=>e.wallet);case"com.obliowallet":return t?a(()=>import("./image-BGxqJH7c.js"),[]).then(e=>e.default):a(()=>import("./index-JuvDLDuk.js"),[]).then(e=>e.wallet);case"app.keeper-wallet":return t?a(()=>import("./image-Dpgf4dcg.js"),[]).then(e=>e.default):a(()=>import("./index-DlfGjmz4.js"),[]).then(e=>e.wallet);case"io.paraswap":return t?a(()=>import("./image-CQKjvlto.js"),[]).then(e=>e.default):a(()=>import("./index-DjLE3t9q.js"),[]).then(e=>e.wallet);case"org.ecoinwallet":return t?a(()=>import("./image-C3Va51zP.js"),[]).then(e=>e.default):a(()=>import("./index-DFZNHq44.js"),[]).then(e=>e.wallet);case"fi.dropmate":return t?a(()=>import("./image-5xiz28Wo.js"),[]).then(e=>e.default):a(()=>import("./index-p0ATWoVh.js"),[]).then(e=>e.wallet);case"com.cryptokara":return t?a(()=>import("./image-Dqbrewdt.js"),[]).then(e=>e.default):a(()=>import("./index-Cfzzcvgo.js"),[]).then(e=>e.wallet);case"co.cyber.wallet":return t?a(()=>import("./image-BvkSxpXq.js"),[]).then(e=>e.default):a(()=>import("./index-e_qeQmc1.js"),[]).then(e=>e.wallet);case"com.kriptonio":return t?a(()=>import("./image-D_cIj1db.js"),[]).then(e=>e.default):a(()=>import("./index-Dxm6Y7eO.js"),[]).then(e=>e.wallet);case"digital.minerva":return t?a(()=>import("./image-D5wxf47e.js"),[]).then(e=>e.default):a(()=>import("./index-HnCuhDYJ.js"),[]).then(e=>e.wallet);case"com.mpcvault.broswerplugin":return t?a(()=>import("./image-BN4ovMrn.js"),[]).then(e=>e.default):a(()=>import("./index-BXY5tnuK.js"),[]).then(e=>e.wallet);case"com.liberawallet":return t?a(()=>import("./image-DyrMImIL.js"),[]).then(e=>e.default):a(()=>import("./index-Dqyfi4dm.js"),[]).then(e=>e.wallet);case"io.helixid":return t?a(()=>import("./image-Dkp4M1ik.js"),[]).then(e=>e.default):a(()=>import("./index-RJhc6LnM.js"),[]).then(e=>e.wallet);case"com.broearn":return t?a(()=>import("./image-JyGUnQ_N.js"),[]).then(e=>e.default):a(()=>import("./index-WsH2ZGfO.js"),[]).then(e=>e.wallet);case"io.altme":return t?a(()=>import("./image-MQbcgW7z.js"),[]).then(e=>e.default):a(()=>import("./index-CpMkh5pZ.js"),[]).then(e=>e.wallet);case"app.herewallet":return t?a(()=>import("./image-gnC_p3Da.js"),[]).then(e=>e.default):a(()=>import("./index-CecEswCv.js"),[]).then(e=>e.wallet);case"com.coinsdo":return t?a(()=>import("./image-DrHhCSDD.js"),[]).then(e=>e.default):a(()=>import("./index-DJYG2Vtc.js"),[]).then(e=>e.wallet);case"trade.flooz.wallet":return t?a(()=>import("./image-DaaIjpQJ.js"),[]).then(e=>e.default):a(()=>import("./index-C6EDKfcJ.js"),[]).then(e=>e.wallet);case"com.tapwallet":return t?a(()=>import("./image-BxeDPEwg.js"),[]).then(e=>e.default):a(()=>import("./index-BwCUvEoQ.js"),[]).then(e=>e.wallet);case"fun.tobi":return t?a(()=>import("./image-DmhgJWq-.js"),[]).then(e=>e.default):a(()=>import("./index-C1adBKyv.js"),[]).then(e=>e.wallet);case"com.bitnovo":return t?a(()=>import("./image-BTZyVpoA.js"),[]).then(e=>e.default):a(()=>import("./index-CaZIFXyW.js"),[]).then(e=>e.wallet);case"io.xucre":return t?a(()=>import("./image-DZ-B-aVa.js"),[]).then(e=>e.default):a(()=>import("./index-BBDAdmKp.js"),[]).then(e=>e.wallet);case"app.girin":return t?a(()=>import("./image-CkQb0YUH.js"),[]).then(e=>e.default):a(()=>import("./index-CpJZxSfI.js"),[]).then(e=>e.wallet);case"finance.panaroma":return t?a(()=>import("./image-Z9k3mhsb.js"),[]).then(e=>e.default):a(()=>import("./index-BIeLm-x3.js"),[]).then(e=>e.wallet);case"app.clot":return t?a(()=>import("./image-DZplWZyD.js"),[]).then(e=>e.default):a(()=>import("./index-BVQeUBdj.js"),[]).then(e=>e.wallet);case"io.transi":return t?a(()=>import("./image-Dc5zhKf6.js"),[]).then(e=>e.default):a(()=>import("./index-DDggnqr4.js"),[]).then(e=>e.wallet);case"world.qoin":return t?a(()=>import("./image-BPAkEl8k.js"),[]).then(e=>e.default):a(()=>import("./index-C9taR4Do.js"),[]).then(e=>e.wallet);case"com.greengloryglobal":return t?a(()=>import("./image-lOdcUtWG.js"),[]).then(e=>e.default):a(()=>import("./index-C-OT0KJG.js"),[]).then(e=>e.wallet);case"com.amazewallet":return t?a(()=>import("./image-2wmDBIB6.js"),[]).then(e=>e.default):a(()=>import("./index-DvXpQOkv.js"),[]).then(e=>e.wallet);case"zone.bitverse":return t?a(()=>import("./image-C6aZzydG.js"),[]).then(e=>e.default):a(()=>import("./index-CN6XdMAo.js"),[]).then(e=>e.wallet);case"social.gm2":return t?a(()=>import("./image-BqtrMo-7.js"),[]).then(e=>e.default):a(()=>import("./index-Coq7--sH.js"),[]).then(e=>e.wallet);case"io.ozonewallet":return t?a(()=>import("./image-BtnrRGhZ.js"),[]).then(e=>e.default):a(()=>import("./index-DFc7lZHb.js"),[]).then(e=>e.wallet);case"io.ukiss":return t?a(()=>import("./image-DFYwzuHA.js"),[]).then(e=>e.default):a(()=>import("./index-CE9n_StB.js"),[]).then(e=>e.wallet);case"finance.islamicoin":return t?a(()=>import("./image-CWG4tRzZ.js"),[]).then(e=>e.default):a(()=>import("./index-pcLdliEp.js"),[]).then(e=>e.wallet);case"io.copiosa":return t?a(()=>import("./image-DuQoo_kR.js"),[]).then(e=>e.default):a(()=>import("./index-CWmGdvBR.js"),[]).then(e=>e.wallet);case"world.fncy":return t?a(()=>import("./image-B5M2ftPa.js"),[]).then(e=>e.default):a(()=>import("./index-Ba45jQBJ.js"),[]).then(e=>e.wallet);case"io.moonstake":return t?a(()=>import("./image-zsArRLIF.js"),[]).then(e=>e.default):a(()=>import("./index-C7HuhgLE.js"),[]).then(e=>e.wallet);case"com.trusteeglobal":return t?a(()=>import("./image-iR_slvRo.js"),[]).then(e=>e.default):a(()=>import("./index-CNLH4wrU.js"),[]).then(e=>e.wallet);case"net.spatium":return t?a(()=>import("./image-DBFrM6tr.js"),[]).then(e=>e.default):a(()=>import("./index-BJBC3bLU.js"),[]).then(e=>e.wallet);case"co.filwallet":return t?a(()=>import("./image-Do8rO3zE.js"),[]).then(e=>e.default):a(()=>import("./index-D7FslwZl.js"),[]).then(e=>e.wallet);case"money.snowball":return t?a(()=>import("./image-3Q7PfsJG.js"),[]).then(e=>e.default):a(()=>import("./index-yOwMLl2f.js"),[]).then(e=>e.wallet);case"com.ennowallet":return t?a(()=>import("./image-Ccx8wDSE.js"),[]).then(e=>e.default):a(()=>import("./index-BRIQuVzg.js"),[]).then(e=>e.wallet);case"io.safematrix":return t?a(()=>import("./image-BX4sAPzh.js"),[]).then(e=>e.default):a(()=>import("./index-Yk_iQY25.js"),[]).then(e=>e.wallet);case"pro.assure":return t?a(()=>import("./image-DMTT8AeN.js"),[]).then(e=>e.default):a(()=>import("./index-BfYVYwh5.js"),[]).then(e=>e.wallet);case"com.neftipedia":return t?a(()=>import("./image-vrSaD0K9.js"),[]).then(e=>e.default):a(()=>import("./index-BHZDuU0I.js"),[]).then(e=>e.wallet);case"io.goldbit":return t?a(()=>import("./image-CtiFcEL8.js"),[]).then(e=>e.default):a(()=>import("./index-DFrKYv4g.js"),[]).then(e=>e.wallet);case"com.coingrig":return t?a(()=>import("./image-NsVKBwxZ.js"),[]).then(e=>e.default):a(()=>import("./index-DcyXtFTG.js"),[]).then(e=>e.wallet);case"io.xfun":return t?a(()=>import("./image-CPMDxql6.js"),[]).then(e=>e.default):a(()=>import("./index-B05algAv.js"),[]).then(e=>e.wallet);case"com.antiersolutions":return t?a(()=>import("./image-BMh4HSr7.js"),[]).then(e=>e.default):a(()=>import("./index-DufOfQ90.js"),[]).then(e=>e.wallet);case"com.itoken":return t?a(()=>import("./image-BwBO8BTi.js"),[]).then(e=>e.default):a(()=>import("./index-BftqI1FU.js"),[]).then(e=>e.wallet);case"com.cardstack":return t?a(()=>import("./image-D7Sd6W8U.js"),[]).then(e=>e.default):a(()=>import("./index-BiHhxeDt.js"),[]).then(e=>e.wallet);case"io.slavi":return t?a(()=>import("./image-BQUnnXTb.js"),[]).then(e=>e.default):a(()=>import("./index-Kt6GlPCW.js"),[]).then(e=>e.wallet);case"tech.defiantapp":return t?a(()=>import("./image-D4-YMi52.js"),[]).then(e=>e.default):a(()=>import("./index-DPic1oJg.js"),[]).then(e=>e.wallet);case"com.dexari":return t?a(()=>import("./image-BoANtDMS.js"),[]).then(e=>e.default):a(()=>import("./index-DPFoWmV6.js"),[]).then(e=>e.wallet);case"io.cfcx":return t?a(()=>import("./image-139plIjh.js"),[]).then(e=>e.default):a(()=>import("./index-Cws1zSAX.js"),[]).then(e=>e.wallet);case"com.socjsc":return t?a(()=>import("./image-Crp2YP47.js"),[]).then(e=>e.default):a(()=>import("./index-C_XOoDbk.js"),[]).then(e=>e.wallet);case"com.tokenb":return t?a(()=>import("./image-8LnJ1bNt.js"),[]).then(e=>e.default):a(()=>import("./index-DcwbqEHj.js"),[]).then(e=>e.wallet);case"org.onyx":return t?a(()=>import("./image-DKcWaLtu.js"),[]).then(e=>e.default):a(()=>import("./index-C5NL4PoV.js"),[]).then(e=>e.wallet);case"io.gk8":return t?a(()=>import("./image-ZwibGfzR.js"),[]).then(e=>e.default):a(()=>import("./index-CLxj2t1J.js"),[]).then(e=>e.wallet);case"com.anchorage":return t?a(()=>import("./image-OT0Fb2Nb.js"),[]).then(e=>e.default):a(()=>import("./index-aoLVKFG1.js"),[]).then(e=>e.wallet);case"com.hashport.wallet":return t?a(()=>import("./image-DooF_Vfs.js"),[]).then(e=>e.default):a(()=>import("./index-DICTy0sa.js"),[]).then(e=>e.wallet);case"io.billionwallet":return t?a(()=>import("./image-DDBzbPSl.js"),[]).then(e=>e.default):a(()=>import("./index-CmCRou09.js"),[]).then(e=>e.wallet);case"com.dlicom":return t?a(()=>import("./image-lXBTHYnD.js"),[]).then(e=>e.default):a(()=>import("./index-l8DhIVZW.js"),[]).then(e=>e.wallet);case"com.tychiwallet":return t?a(()=>import("./image-pcyfaNhf.js"),[]).then(e=>e.default):a(()=>import("./index-B3vR_dtk.js"),[]).then(e=>e.wallet);case"at.swe":return t?a(()=>import("./image-C8_9fy1e.js"),[]).then(e=>e.default):a(()=>import("./index-ficai7Ce.js"),[]).then(e=>e.wallet);case"network.wali":return t?a(()=>import("./image-CSyxcTwp.js"),[]).then(e=>e.default):a(()=>import("./index-Dzkop1Gk.js"),[]).then(e=>e.wallet);case"io.diamante":return t?a(()=>import("./image-Dh9w9A8z.js"),[]).then(e=>e.default):a(()=>import("./index-C1a5oPtZ.js"),[]).then(e=>e.wallet);case"ai.interlinklabs":return t?a(()=>import("./image-Dz82Zyfj.js"),[]).then(e=>e.default):a(()=>import("./index-BTqXeJHf.js"),[]).then(e=>e.wallet);case"com.walllet":return t?a(()=>import("./image-VFWT6oS6.js"),[]).then(e=>e.default):a(()=>import("./index-DPgWRg9-.js"),[]).then(e=>e.wallet);case"org.lunascape":return t?a(()=>import("./image-D4nkyGrg.js"),[]).then(e=>e.default):a(()=>import("./index-4Nmn8ium.js"),[]).then(e=>e.wallet);case"com.nvxowallet":return t?a(()=>import("./image-BoS2kgXC.js"),[]).then(e=>e.default):a(()=>import("./index-CRRdY0XA.js"),[]).then(e=>e.wallet);case"today.paywithcrypto.wallet":return t?a(()=>import("./image-CsUCYFyx.js"),[]).then(e=>e.default):a(()=>import("./index-CFUSXkKo.js"),[]).then(e=>e.wallet);case"ai.iluminary":return t?a(()=>import("./image-CEuSmI3b.js"),[]).then(e=>e.default):a(()=>import("./index-D1j-SvoJ.js"),[]).then(e=>e.wallet);case"io.reactwallet":return t?a(()=>import("./image-B3lDLhwe.js"),[]).then(e=>e.default):a(()=>import("./index-CTs1t6rA.js"),[]).then(e=>e.wallet);case"com.rewardywallet":return t?a(()=>import("./image-DVyDRAAO.js"),[]).then(e=>e.default):a(()=>import("./index-cF_6KJvb.js"),[]).then(e=>e.wallet);case"io.walletv":return t?a(()=>import("./image-CTBdimeM.js"),[]).then(e=>e.default):a(()=>import("./index-He5kaR9n.js"),[]).then(e=>e.wallet);case"app.outlawgames":return t?a(()=>import("./image-BPqXYngz.js"),[]).then(e=>e.default):a(()=>import("./index-D2hPph8l.js"),[]).then(e=>e.wallet);case"io.ironwallet":return t?a(()=>import("./image-BKNtkg6s.js"),[]).then(e=>e.default):a(()=>import("./index-B1-qcL-p.js"),[]).then(e=>e.wallet);case"com.mecowallet":return t?a(()=>import("./image-m7IlStdm.js"),[]).then(e=>e.default):a(()=>import("./index-BdgyG9Qa.js"),[]).then(e=>e.wallet);case"com.onlybulls":return t?a(()=>import("./image-qLUwfjzV.js"),[]).then(e=>e.default):a(()=>import("./index-DPPIbXj8.js"),[]).then(e=>e.wallet);case"me.qiewallet":return t?a(()=>import("./image-BHJFFIIN.js"),[]).then(e=>e.default):a(()=>import("./index-D6zAueb_.js"),[]).then(e=>e.wallet);case"fund.lflabs":return t?a(()=>import("./image-dO78_uyn.js"),[]).then(e=>e.default):a(()=>import("./index-BBkeSt5m.js"),[]).then(e=>e.wallet);case"io.walletverse":return t?a(()=>import("./image-DUk3AUBd.js"),[]).then(e=>e.default):a(()=>import("./index-CfO_m3oL.js"),[]).then(e=>e.wallet);case"com.berasig":return t?a(()=>import("./image-CisWvLpc.js"),[]).then(e=>e.default):a(()=>import("./index-Cg1E5HxJ.js"),[]).then(e=>e.wallet);case"app.phantom":return t?a(()=>import("./image-6levnvAC.js"),[]).then(e=>e.default):a(()=>import("./index-IBUgXgOa.js"),[]).then(e=>e.wallet);case"com.coinbase.wallet":return t?a(()=>import("./image-C6EsuPXB.js"),[]).then(e=>e.default):a(()=>import("./index-BILUwmJ9.js"),[]).then(e=>e.wallet);case"io.rabby":return t?a(()=>import("./image-CZ2qSHpt.js"),[]).then(e=>e.default):a(()=>import("./index-Bprjmfje.js"),[]).then(e=>e.wallet);case"com.brave.wallet":return t?a(()=>import("./image-9Jtg22X3.js"),[]).then(e=>e.default):a(()=>import("./index-DKbx-y78.js"),[]).then(e=>e.wallet);case"fi.nu":return t?a(()=>import("./image-BAl5qyeX.js"),[]).then(e=>e.default):a(()=>import("./index-BXi61TZ5.js"),[]).then(e=>e.wallet);case"pro.hinkal.walletconnect":return t?a(()=>import("./image-d8n8A6si.js"),[]).then(e=>e.default):a(()=>import("./index-CujrNB-Q.js"),[]).then(e=>e.wallet);case"com.moongate.one":return t?a(()=>import("./image-DZc2BYzk.js"),[]).then(e=>e.default):a(()=>import("./index-B2WV7sR7.js"),[]).then(e=>e.wallet);case"tech.levain":return t?a(()=>import("./image-DcIu3U38.js"),[]).then(e=>e.default):a(()=>import("./index-CEpc_g8h.js"),[]).then(e=>e.wallet);case"com.enkrypt":return t?a(()=>import("./image-DvpdMMzF.js"),[]).then(e=>e.default):a(()=>import("./index-Cc4uopde.js"),[]).then(e=>e.wallet);case"com.scramble":return t?a(()=>import("./image-DT5Fvf2s.js"),[]).then(e=>e.default):a(()=>import("./index-D4Sgj1mL.js"),[]).then(e=>e.wallet);case"io.finoa":return t?a(()=>import("./image-D_i0o0Nv.js"),[]).then(e=>e.default):a(()=>import("./index-DFghxfjK.js"),[]).then(e=>e.wallet);case"com.blazpay.wallet":return t?a(()=>import("./image-CgHABHdL.js"),[]).then(e=>e.default):a(()=>import("./index-B_OXuBhF.js"),[]).then(e=>e.wallet);case"io.getjoin.prd":return t?a(()=>import("./image-CmWdSXJI.js"),[]).then(e=>e.default):a(()=>import("./index-QvBzJwgv.js"),[]).then(e=>e.wallet);case"xyz.talisman":return t?a(()=>import("./image-VlTaWJmy.js"),[]).then(e=>e.default):a(()=>import("./index-BgbYZOnC.js"),[]).then(e=>e.wallet);case"eu.flashsoft.clear-wallet":return t?a(()=>import("./image-gxCVLutB.js"),[]).then(e=>e.default):a(()=>import("./index-BBiL2lyk.js"),[]).then(e=>e.wallet);case"app.berasig":return t?a(()=>import("./image-BjTMD2k8.js"),[]).then(e=>e.default):a(()=>import("./index-DkcP2fCc.js"),[]).then(e=>e.wallet);case"com.wallet.reown":return t?a(()=>import("./image-CC2_AL18.js"),[]).then(e=>e.default):a(()=>import("./index-BEx6ckei.js"),[]).then(e=>e.wallet);case"io.runonflux.sspwallet":return t?a(()=>import("./image-DfzpWAED.js"),[]).then(e=>e.default):a(()=>import("./index-CrUcAJK0.js"),[]).then(e=>e.wallet);case"com.blanqlabs.wallet":return t?a(()=>import("./image-wR942Jk6.js"),[]).then(e=>e.default):a(()=>import("./index-DBst6Hla.js"),[]).then(e=>e.wallet);case"io.hero.wallet":return t?a(()=>import("./image-BbH7e9pw.js"),[]).then(e=>e.default):a(()=>import("./index-BBANTdk4.js"),[]).then(e=>e.wallet);case"network.verified.custody":return t?a(()=>import("./image-DpjDzWCs.js"),[]).then(e=>e.default):a(()=>import("./index-CyhgnW_d.js"),[]).then(e=>e.wallet);case"console.utila.io":return t?a(()=>import("./image-C7tHBnQp.js"),[]).then(e=>e.default):a(()=>import("./index-BrOCsLbf.js"),[]).then(e=>e.wallet);case"com.micet.wallet":return t?a(()=>import("./image-On2ij4Ix.js"),[]).then(e=>e.default):a(()=>import("./index-JAAqCLcG.js"),[]).then(e=>e.wallet);case"world.dolphinode.chain":return t?a(()=>import("./image-BXzPnbc4.js"),[]).then(e=>e.default):a(()=>import("./index-CiwBOkla.js"),[]).then(e=>e.wallet);case"com.lootrush":return t?a(()=>import("./image-t4jvKgpV.js"),[]).then(e=>e.default):a(()=>import("./index-BLsnOBhg.js"),[]).then(e=>e.wallet);case"xyz.dawnwallet":return t?a(()=>import("./image-bpacFMFT.js"),[]).then(e=>e.default):a(()=>import("./index-BqK7Phb6.js"),[]).then(e=>e.wallet);case"xyz.abs":return t?a(()=>import("./image-DFo7XMVJ.js"),[]).then(e=>e.default):a(()=>import("./index-8Ff6vDUD.js"),[]).then(e=>e.wallet);case"sh.frame":return t?a(()=>import("./image-C1w2WpL5.js"),[]).then(e=>e.default):a(()=>import("./index-cAvSYrmF.js"),[]).then(e=>e.wallet);case"io.useglyph":return t?a(()=>import("./image-C46yxCl4.js"),[]).then(e=>e.default):a(()=>import("./index-DE_8irSD.js"),[]).then(e=>e.wallet);case"org.base.account":return t?a(()=>import("./image-Ds78yECl.js"),[]).then(e=>e.default):a(()=>import("./index-kNZGxYSe.js"),[]).then(e=>e.wallet);default:throw new Error(`Wallet with id ${r} not found`)}}function lh(){const r=new Map;return{emit(t,e){const n=r.get(t);if(n)for(const i of n)i(e)},subscribe(t,e){var n;return r.has(t)?(n=r.get(t))==null||n.add(e):r.set(t,new Set([e])),()=>{const i=r.get(t);i&&i.delete(e)}}}}function ur(){return lh()}function uh(r){const{createOptions:t}=r,e=ur();let n,i;function s(){n=void 0,i=void 0}let o=async()=>{},c=async d=>{i=d};const l=e.subscribe("chainChanged",d=>{i=d}),u=e.subscribe("disconnect",()=>{s(),l(),u()});return e.subscribe("accountChanged",d=>{n=d}),{autoConnect:async d=>{const{autoConnectBaseAccountSDK:h}=await a(async()=>{const{autoConnectBaseAccountSDK:b}=await Promise.resolve().then(()=>vo);return{autoConnectBaseAccountSDK:b}},void 0),p=await r.providerFactory(),[_,f,m,y]=await h(d,e,p);return n=_,i=f,o=m,c=y,Be({chainId:i.id,client:d.client,walletAddress:n.address,walletType:Tt}),n},connect:async d=>{const{connectBaseAccountSDK:h}=await a(async()=>{const{connectBaseAccountSDK:b}=await Promise.resolve().then(()=>vo);return{connectBaseAccountSDK:b}},void 0),p=await r.providerFactory(),[_,f,m,y]=await h(d,e,p);return n=_,i=f,o=m,c=y,Be({chainId:i.id,client:d.client,walletAddress:n.address,walletType:Tt}),n},disconnect:async()=>{s(),await o()},getAccount:()=>n,getChain(){if(i)return i=cr(i.id)||i,i},getConfig:()=>t,id:Tt,subscribe:e.subscribe,switchChain:async d=>{await c(d)}}}function jn(){if(!xc())return{description:"thirdweb powered dApp",logoUrl:"https://thirdweb.com/favicon.ico",name:"thirdweb powered dApp",url:"https://thirdweb.com"};const{protocol:r,hostname:t,port:e}=window.location;let n=`${r}//${t}`;e&&e!=="80"&&e!=="443"&&(n+=`:${e}`);const i=`${n}/favicon.ico`;return{description:window.document.title||"thirdweb powered dApp",logoUrl:i,name:window.document.title||"thirdweb powered dApp",url:n}}let pi,En;async function Uc(r){var s,o,c,l,u,d,h;if(pi){if(r&&En){const p=((s=En.chains)==null?void 0:s.map(y=>y.id))||[],_=((o=r.chains)==null?void 0:o.map(y=>y.id))||[],f=p.length===_.length&&p.every((y,b)=>y===_[b]),m=((c=r.appMetadata)==null?void 0:c.name)===((l=En.appMetadata)==null?void 0:l.name);(!f||!m)&&console.warn("[Base Account SDK] Provider already initialized with different options. The Base Account SDK uses a singleton provider - subsequent configurations are ignored. Create only one Base Account wallet instance per application.")}return pi}const{createBaseAccountSDK:t}=await a(async()=>{const{createBaseAccountSDK:p}=await import("./index-CeC6OH9Y.js");return{createBaseAccountSDK:p}},__vite__mapDeps([8,9,10,1,2,3,6,4,5])),e=jn(),i=t({appName:((u=r==null?void 0:r.appMetadata)==null?void 0:u.name)||e.name||"thirdweb powered dApp",appLogoUrl:((d=r==null?void 0:r.appMetadata)==null?void 0:d.logoUrl)||e.logoUrl||null,appChainIds:((h=r==null?void 0:r.chains)==null?void 0:h.map(p=>p.id))||[]}).getProvider();return pi=i,En=r,i}function qc(r){return r.id===Tt}function Eo({provider:r,address:t,client:e}){const n={address:Q(t),async sendTransaction(i){const s=await r.request({method:"eth_sendTransaction",params:[{accessList:i.accessList,data:i.data,from:Q(t),gas:i.gas?De(i.gas):void 0,to:i.to,value:i.value?De(i.value):void 0}]});return Rs({chainId:i.chainId,client:e,contractAddress:i.to??void 0,gasPrice:i.gasPrice,transactionHash:s,walletAddress:Q(t),walletType:Tt}),{transactionHash:s}},async signMessage({message:i}){if(!n.address)throw new Error("Provider not setup");const s=typeof i=="string"?Ps(i):i.raw instanceof Uint8Array?Os(i.raw):i.raw,o=await r.request({method:"personal_sign",params:[s,n.address]});if(!en(o))throw new Error("Invalid signature returned");return o},async signTypedData(i){if(!n.address)throw new Error("Provider not setup");const{domain:s,message:o,primaryType:c}=Cs(i),l={EIP712Domain:Ec(s),...i.types};vc({domain:s,message:o,primaryType:c,types:l});const u=bc({domain:s??{},message:o,primaryType:c,types:l}),d=await r.request({method:"eth_signTypedData_v4",params:[n.address,u]});if(!en(d))throw new Error("Invalid signed payload returned");return d},sendCalls:async i=>{try{const{callParams:s,chain:o}=await Ns(i,n),c=await r.request({method:"wallet_sendCalls",params:s});return c&&typeof c=="object"&&"id"in c?{chain:o,client:e,id:c.id}:{chain:o,client:e,id:c}}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${Tt} errored calling wallet_sendCalls, with error: ${s instanceof Error?s.message:we(s)}`):s}},async getCallsStatus(i){try{const s=await r.request({method:"wallet_getCallsStatus",params:[i.id]});return $s(s)}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${Tt} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):s}},async getCapabilities(i){const s=i.chainId;try{const o=await r.request({method:"wallet_getCapabilities",params:[Q(n.address)]});return ks(o,s)}catch(o){if(/unsupport|not support|not available/i.test(o.message))return{message:`${Tt} does not support wallet_getCapabilities, reach out to them directly to request EIP-5792 support.`};throw o}}};return n}function Mc(r,t,e,n,i){const s=Eo({address:r,client:i,provider:e});async function o(){e.off("accountsChanged",l),e.off("chainChanged",u),e.off("disconnect",c),await e.disconnect()}async function c(){o(),n.emit("disconnect",void 0)}function l(d){if(d[0]){const h=Eo({address:Q(d[0]),client:i,provider:e});n.emit("accountChanged",h),n.emit("accountsChanged",d)}else c()}function u(d){const h=ge(ct(d));n.emit("chainChanged",h)}return e.on("accountsChanged",l),e.on("chainChanged",u),e.on("disconnect",c),[s,t,c,d=>Bc(e,d)]}async function dh(r,t,e){const n=await e.request({method:"eth_requestAccounts"});if(!n[0])throw new Error("No accounts found");const i=Q(n[0]),s=await e.request({method:"eth_chainId"}),o=ct(s);let c=r.chain&&r.chain.id===o?r.chain:ge(o);return o&&(r!=null&&r.chain)&&o!==(r==null?void 0:r.chain.id)&&(await Bc(e,r.chain),c=r.chain),Mc(i,c,e,t,r.client)}async function hh(r,t,e){const i=(await e.request({method:"eth_accounts"}))[0];if(!i)throw new Error("No accounts found");const s=await e.request({method:"eth_chainId"}),o=ct(s),c=r.chain&&r.chain.id===o?r.chain:ge(o);return Mc(i,c,e,t,r.client)}async function Bc(r,t){var s;const e=await r.request({method:"eth_chainId"}),n=ge(ct(e));if((n==null?void 0:n.id)===t.id)return;const i=De(t.id);try{await r.request({method:"wallet_switchEthereumChain",params:[{chainId:i}]})}catch(o){const c=await Ts(t);(o==null?void 0:o.code)===4902&&await r.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:((s=c.explorers)==null?void 0:s.map(l=>l.url))||[],chainId:i,chainName:c.name,nativeCurrency:c.nativeCurrency,rpcUrls:Us(c)}]})}}const vo=Object.freeze(Object.defineProperty({__proto__:null,autoConnectBaseAccountSDK:hh,connectBaseAccountSDK:dh,getBaseAccountWebProvider:Uc,isBaseAccountSDKWallet:qc},Symbol.toStringTag,{value:"Module"}));function ph(r){const{createOptions:t}=r,e=ur();let n,i;function s(){n=void 0,i=void 0}let o=async()=>{},c=async d=>{i=d};const l=e.subscribe("chainChanged",d=>{i=d}),u=e.subscribe("disconnect",()=>{s(),l(),u()});return e.subscribe("accountChanged",d=>{n=d}),{autoConnect:async d=>{const{autoConnectCoinbaseWalletSDK:h}=await a(async()=>{const{autoConnectCoinbaseWalletSDK:b}=await Promise.resolve().then(()=>Io);return{autoConnectCoinbaseWalletSDK:b}},void 0),p=await r.providerFactory(),[_,f,m,y]=await h(d,e,p);return n=_,i=f,o=m,c=y,Be({chainId:i.id,client:d.client,walletAddress:n.address,walletType:_t}),n},connect:async d=>{const{connectCoinbaseWalletSDK:h}=await a(async()=>{const{connectCoinbaseWalletSDK:b}=await Promise.resolve().then(()=>Io);return{connectCoinbaseWalletSDK:b}},void 0),p=await r.providerFactory(),[_,f,m,y]=await h(d,e,p);return n=_,i=f,o=m,c=y,Be({chainId:i.id,client:d.client,walletAddress:n.address,walletType:_t}),n},disconnect:async()=>{s(),await o()},getAccount:()=>n,getChain(){if(i)return i=cr(i.id)||i,i},getConfig:()=>t,id:_t,onConnectRequested:async()=>{var d;if(r.onConnectRequested){const h=await r.providerFactory();return(d=r.onConnectRequested)==null?void 0:d.call(r,h)}},subscribe:e.subscribe,switchChain:async d=>{await c(d)}}}async function jc(r){var t,e;await((e=(t=r==null?void 0:r.communicator)==null?void 0:t.waitForPopupLoaded)==null?void 0:e.call(t))}const _h=Object.freeze(Object.defineProperty({__proto__:null,showCoinbasePopup:jc},Symbol.toStringTag,{value:"Module"}));let _i;async function zc(r){var t,e;if(!_i){let n=(await a(()=>import("./index-DwEKubQW.js"),__vite__mapDeps([11,2,3,1,10,9]))).default;typeof n!="function"&&typeof n.default=="function"&&(n=n.default);const s=new n({appChainIds:r!=null&&r.chains?r.chains.map(o=>o.id):void 0,appLogoUrl:((t=r==null?void 0:r.appMetadata)==null?void 0:t.logoUrl)||jn().logoUrl,appName:((e=r==null?void 0:r.appMetadata)==null?void 0:e.name)||jn().name}).makeWeb3Provider(r==null?void 0:r.walletConfig);return _i=s,s}return _i}function bo({provider:r,address:t,client:e}){const n={address:Q(t),onTransactionRequested:async()=>{window.localStorage&&window.localStorage.getItem("-CBWSDK:SignerConfigurator:SignerType")==="scw"&&await jc(r)},async sendTransaction(i){const s=await r.request({method:"eth_sendTransaction",params:[{accessList:i.accessList,data:i.data,from:Q(t),gas:i.gas?De(i.gas):void 0,to:i.to,value:i.value?De(i.value):void 0}]});return Rs({chainId:i.chainId,client:e,contractAddress:i.to??void 0,gasPrice:i.gasPrice,transactionHash:s,walletAddress:Q(t),walletType:_t}),{transactionHash:s}},async signMessage({message:i}){if(!n.address)throw new Error("Provider not setup");const s=typeof i=="string"?Ps(i):i.raw instanceof Uint8Array?Os(i.raw):i.raw,o=await r.request({method:"personal_sign",params:[s,n.address]});if(!en(o))throw new Error("Invalid signature returned");return o},async signTypedData(i){if(!n.address)throw new Error("Provider not setup");const{domain:s,message:o,primaryType:c}=Cs(i),l={EIP712Domain:Ec(s),...i.types};vc({domain:s,message:o,primaryType:c,types:l});const u=bc({domain:s??{},message:o,primaryType:c,types:l}),d=await r.request({method:"eth_signTypedData_v4",params:[n.address,u]});if(!en(d))throw new Error("Invalid signed payload returned");return d},sendCalls:async i=>{try{const{callParams:s,chain:o}=await Ns(i,n),c=await r.request({method:"wallet_sendCalls",params:s});return c&&typeof c=="object"&&"id"in c?{chain:o,client:e,id:c.id}:{chain:o,client:e,id:c}}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${_t} errored calling wallet_sendCalls, with error: ${s instanceof Error?s.message:we(s)}`):s}},async getCallsStatus(i){try{const s=await r.request({method:"wallet_getCallsStatus",params:[i.id]});return $s(s)}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${_t} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):s}},async getCallsStatusRaw(i){try{return await r.request({method:"wallet_getCallsStatus",params:[i.id]})}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${_t} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):s}},async getCapabilities(i){const s=i.chainId;try{const o=await r.request({method:"wallet_getCapabilities",params:[Q(n.address)]});return ks(o,s)}catch(o){if(/unsupport|not support|not available/i.test(o.message))return{message:`${_t} does not support wallet_getCapabilities, reach out to them directly to request EIP-5792 support.`};throw o}}};return n}function Kc(r,t,e,n,i){const s=bo({address:r,client:i,provider:e});async function o(){e.removeListener("accountsChanged",l),e.removeListener("chainChanged",u),e.removeListener("disconnect",c),await e.disconnect()}async function c(){o(),n.emit("disconnect",void 0)}function l(d){if(d[0]){const h=bo({address:Q(d[0]),client:i,provider:e});n.emit("accountChanged",h),n.emit("accountsChanged",d)}else c()}function u(d){const h=ge(ct(d));n.emit("chainChanged",h)}return e.on("accountsChanged",l),e.on("chainChanged",u),e.on("disconnect",c),[s,t,c,d=>Fc(e,d)]}async function fh(r,t,e){const n=await e.request({method:"eth_requestAccounts"});if(!n[0])throw new Error("No accounts found");const i=Q(n[0]),s=await e.request({method:"eth_chainId"}),o=ct(s);let c=r.chain&&r.chain.id===o?r.chain:ge(o);return o&&(r!=null&&r.chain)&&o!==(r==null?void 0:r.chain.id)&&(await Fc(e,r.chain),c=r.chain),Kc(i,c,e,t,r.client)}async function mh(r,t,e){const i=(await e.request({method:"eth_accounts"}))[0];if(!i)throw new Error("No accounts found");const s=await e.request({method:"eth_chainId"}),o=ct(s),c=r.chain&&r.chain.id===o?r.chain:ge(o);return Kc(i,c,e,t,r.client)}async function Fc(r,t){var s;const e=await r.request({method:"eth_chainId"}),n=ge(ct(e));if((n==null?void 0:n.id)===t.id)return;const i=De(t.id);try{await r.request({method:"wallet_switchEthereumChain",params:[{chainId:i}]})}catch(o){const c=await Ts(t);(o==null?void 0:o.code)===4902&&await r.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:((s=c.explorers)==null?void 0:s.map(l=>l.url))||[],chainId:i,chainName:c.name,nativeCurrency:c.nativeCurrency,rpcUrls:Us(c)}]})}}const Io=Object.freeze(Object.defineProperty({__proto__:null,autoConnectCoinbaseWalletSDK:mh,connectCoinbaseWalletSDK:fh,getCoinbaseWebProvider:zc},Symbol.toStringTag,{value:"Module"}));async function yh(r){return Ic(async()=>{var n;const e=await(await fetch(`${Yn("inAppWallet")}/api/2024-05-05/ecosystem-wallet`,{headers:{"x-ecosystem-id":r}})).json();if(!e||e.code==="UNAUTHORIZED")throw new Error(e.message||`Could not find ecosystem wallet with id ${r}, please check your ecosystem wallet configuration.`);return(n=e.authOptions)!=null&&n.includes("siwe")&&(e.authOptions=e.authOptions.filter(i=>i!=="siwe"),e.authOptions.push("wallet")),e},{cacheKey:`ecosystem-wallet-options-${r}`,cacheTime:1e3*60*5})}const fi=new Map;async function zr(r,t,e){var s;const n=we({clientId:r.clientId,ecosystem:e,partialSecretKey:(s=r.secretKey)==null?void 0:s.slice(0,5)});if(fi.has(n))return fi.get(n);const i=await t(r);return fi.set(n,i),i}function Wc(r){const{createOptions:t,connectorFactory:e,ecosystem:n}=r,i=n?n.id:"inApp",s=ur();let o=t,c,l,u,d,h=null;const p=async _=>{if(n){const f=await yh(n.id),m=f==null?void 0:f.smartAccountOptions;if(m)if(f.smartAccountOptions.executionMode==="EIP7702")o={...o,executionMode:{mode:"EIP7702",sponsorGas:m.sponsorGas}};else{const{defaultChainId:b}=f.smartAccountOptions,R=(_==null?void 0:_.chain)??(b?ge(b):void 0);if(!R)throw new Error("A chain must be provided either via 'chain' in connect options or 'defaultChainId' in ecosystem configuration. Please pass it via connect() or update the ecosystem configuration.");o={...o,smartAccount:{chain:R,factoryAddress:m.accountFactoryAddress,sponsorGas:m.sponsorGas}}}}};return{autoConnect:async _=>{const{autoConnectInAppWallet:f}=await a(async()=>{const{autoConnectInAppWallet:v}=await Promise.resolve().then(()=>qi);return{autoConnectInAppWallet:v}},void 0),m=await zr(_.client,e,n);await p();const{account:y,chain:b,adminAccount:R}=await f(_,o,m);d=_.client,c=y,l=R,u=b;try{h=await m.storage.getAuthCookie()}catch(v){console.error("Failed to retrieve auth token:",v),h=null}return Be({chainId:u.id,client:_.client,ecosystem:n,walletAddress:c.address,walletType:i}),c},connect:async _=>{const{connectInAppWallet:f}=await a(async()=>{const{connectInAppWallet:v}=await Promise.resolve().then(()=>qi);return{connectInAppWallet:v}},void 0),m=await zr(_.client,e,n);await p();const{account:y,chain:b,adminAccount:R}=await f(_,o,m);d=_.client,c=y,l=R,u=b;try{h=await m.storage.getAuthCookie()}catch(v){console.error("Failed to retrieve auth token:",v),h=null}return Be({chainId:u.id,client:_.client,ecosystem:n,walletAddress:c.address,walletType:i}),c},disconnect:async()=>{if(d&&!(await(await zr(d,e,n)).logout()).success)throw new Error("Failed to logout");c=void 0,l=void 0,u=void 0,h=null,s.emit("disconnect",void 0)},getAccount:()=>c,getAdminAccount:()=>l,getAuthToken:()=>h,getChain(){if(u)return u=cr(u.id)||u,u},getConfig:()=>o,id:i,subscribe:s.subscribe,switchChain:async _=>{var f;if((o!=null&&o.smartAccount||((f=o==null?void 0:o.executionMode)==null?void 0:f.mode)==="EIP4337")&&d&&c){const{autoConnectInAppWallet:m}=await a(async()=>{const{autoConnectInAppWallet:P}=await Promise.resolve().then(()=>qi);return{autoConnectInAppWallet:P}},void 0),y=await zr(d,e,n);await p({chain:_});const{account:b,chain:R,adminAccount:v}=await m({chain:_,client:d},o,y);l=v,c=b,u=R}else u=_;s.emit("chainChanged",_)}}}function Hc(...r){const[t,e]=r,n={id:t,partnerId:e==null?void 0:e.partnerId};return Wc({connectorFactory:async i=>{const{InAppWebConnector:s}=await a(async()=>{const{InAppWebConnector:o}=await import("./web-connector-CH10dfXt.js");return{InAppWebConnector:o}},__vite__mapDeps([12,1,2,3,4,5,6,7]));return new s({client:i,ecosystem:n,storage:e==null?void 0:e.storage})},createOptions:{auth:{...e==null?void 0:e.auth,options:[]},partnerId:n.partnerId},ecosystem:n})}function zi(r){return Wc({connectorFactory:async t=>{var n;const{InAppWebConnector:e}=await a(async()=>{const{InAppWebConnector:i}=await import("./web-connector-CH10dfXt.js");return{InAppWebConnector:i}},__vite__mapDeps([12,1,2,3,4,5,6,7]));return new e({client:t,passkeyDomain:(n=r==null?void 0:r.auth)==null?void 0:n.passkeyDomain,storage:r==null?void 0:r.storage})},createOptions:r})}function Ms(r){const t=ur();let e,n,i,s;return{autoConnect:async o=>{const{connectSmartAccount:c}=await a(async()=>{const{connectSmartAccount:d}=await import("./index-CNP9Lp1F.js");return{connectSmartAccount:d}},__vite__mapDeps([13,1,14,2,3,4,5,6,7])),[l,u]=await c(o,r);return s=o,e=l,i=u,Be({chainId:i.id,client:o.client,walletAddress:e.address,walletType:"smart"}),e},connect:async o=>{const{connectSmartAccount:c}=await a(async()=>{const{connectSmartAccount:d}=await import("./index-CNP9Lp1F.js");return{connectSmartAccount:d}},__vite__mapDeps([13,1,14,2,3,4,5,6,7])),[l,u]=await c(o,r);return n=o.personalAccount,s=o,e=l,i=u,Be({chainId:i.id,client:o.client,walletAddress:e.address,walletType:"smart"}),t.emit("accountChanged",e),e},disconnect:async()=>{if(e){const{disconnectSmartAccount:o}=await a(async()=>{const{disconnectSmartAccount:c}=await import("./index-CNP9Lp1F.js");return{disconnectSmartAccount:c}},__vite__mapDeps([13,1,14,2,3,4,5,6,7]));await o(e)}e=void 0,n=void 0,i=void 0,t.emit("disconnect",void 0)},getAccount:()=>e,getAdminAccount:()=>n,getChain(){if(i)return i=cr(i.id)||i,i},getConfig:()=>r,id:"smart",subscribe:t.subscribe,switchChain:async o=>{var h;if(!s)throw new Error("Cannot switch chain without a previous connection");if(!await Hu(o)){const p=Ls({address:r.factoryAddress||Gu((h=r.overrides)==null?void 0:h.entrypointAddress),chain:o,client:s.client});if(!await Ju(p))throw new Error(`Factory contract not deployed on chain: ${o.id}`)}const{connectSmartAccount:l}=await a(async()=>{const{connectSmartAccount:p}=await import("./index-CNP9Lp1F.js");return{connectSmartAccount:p}},__vite__mapDeps([13,1,14,2,3,4,5,6,7])),[u,d]=await l({...s,chain:o},{...r,chain:o});e=u,i=d,t.emit("accountChanged",u),t.emit("chainChanged",d)}}}function ot(...r){const[t,e]=r;switch(!0){case t==="smart":return Ms(e);case(t==="embedded"||t==="inApp"):return zi(e);case Pr(t):return Hc(...r);case t===_t:{const n=e;return ph({createOptions:n,onConnectRequested:async i=>{const{showCoinbasePopup:s}=await a(async()=>{const{showCoinbasePopup:o}=await Promise.resolve().then(()=>_h);return{showCoinbasePopup:o}},void 0);return s(i)},providerFactory:()=>zc(n)})}case t===Tt:{const n=e;return uh({createOptions:n,providerFactory:()=>Uc(n)})}default:{let c=function(){i=void 0,s=void 0};const n=ur();let i,s,o,l=async()=>{};const u=n.subscribe("disconnect",()=>{c(),o==null||o(),u()});n.subscribe("accountChanged",_=>{i=_});let d=async()=>{throw new Error("Not implemented yet")};const h=go()?_=>hi(_):void 0,p={autoConnect:async _=>{const{injectedProvider:f}=await a(async()=>{const{injectedProvider:m}=await Promise.resolve().then(()=>To);return{injectedProvider:m}},void 0);if(t!=="walletConnect"&&f(t)){const{autoConnectEip1193Wallet:m}=await a(async()=>{const{autoConnectEip1193Wallet:P}=await Promise.resolve().then(()=>Oo);return{autoConnectEip1193Wallet:P}},void 0),[y,b,R,v]=await m({chain:_.chain,client:_.client,emitter:n,id:t,provider:Ki(t)});return i=y,s=b,l=R,d=v,o=n.subscribe("chainChanged",P=>{s=P}),Be({chainId:s.id,client:_.client,walletAddress:i.address,walletType:t}),i}if(_&&"client"in _){const{autoConnectWC:m}=await a(async()=>{const{autoConnectWC:P}=await import("./controller-DG3kSk97.js");return{autoConnectWC:P}},__vite__mapDeps([15,1,2,3,4,5,6,7])),[y,b,R,v]=await m(_,n,p.id,Bn,h);return i=y,s=b,l=R,d=v,Be({chainId:s.id,client:_.client,walletAddress:i.address,walletType:t}),i}throw new Error("Failed to auto connect")},connect:async _=>{async function f(b){var P;const{connectWC:R}=await a(async()=>{const{connectWC:T}=await import("./controller-DG3kSk97.js");return{connectWC:T}},__vite__mapDeps([15,1,2,3,4,5,6,7]));let v;try{const[T,g,D,L]=await R({...b,walletConnect:{...b.walletConnect,onDisplayUri:((P=b.walletConnect)==null?void 0:P.onDisplayUri)||(async w=>{var E,I;if(typeof window<"u"&&typeof document<"u")if(go()){const A=await Nc(t),V=A.mobile.native||A.mobile.universal;hi(V?ih(V,w).redirect:w);return}else try{const{createQROverlay:A}=await a(async()=>{const{createQROverlay:V}=await import("./qr-overlay-DXCE8ST0.js");return{createQROverlay:V}},__vite__mapDeps([16,1]));v&&v.destroy(),v=A(w,{theme:((I=(E=b.walletConnect)==null?void 0:E.qrModalOptions)==null?void 0:I.themeMode)??"dark",qrSize:280,showCloseButton:!0,onCancel:()=>{var V,O;(O=(V=b.walletConnect)==null?void 0:V.onCancel)==null||O.call(V)}})}catch(A){console.error("Failed to create QR overlay:",A)}})}},n,p.id,Bn,h);return v&&(v.destroy(),v=void 0),i=T,s=g,l=D,d=L,Be({chainId:s.id,client:b.client,walletAddress:i.address,walletType:t}),i}catch(T){throw v&&(v.destroy(),v=void 0),T}}if(t==="walletConnect"){const{client:b,chain:R,...v}=_;return f({chain:R,client:b,walletConnect:{...v}})}const m=_&&"walletConnect"in _,{injectedProvider:y}=await a(async()=>{const{injectedProvider:b}=await Promise.resolve().then(()=>To);return{injectedProvider:b}},void 0);if(y(t)&&!m){const{connectEip1193Wallet:b}=await a(async()=>{const{connectEip1193Wallet:g}=await Promise.resolve().then(()=>Oo);return{connectEip1193Wallet:g}},void 0),[R,v,P,T]=await b({chain:_.chain,client:_.client,emitter:n,id:t,provider:Ki(t)});return i=R,s=v,l=P,d=T,o=n.subscribe("chainChanged",g=>{s=g}),Be({chainId:s.id,client:_.client,walletAddress:i.address,walletType:t}),i}if(_&&"client"in _)return f(_);throw new Error("Failed to connect")},disconnect:async()=>{c(),await l()},getAccount:()=>i,getChain(){if(s)return s=cr(s.id)||s,s},getConfig:()=>r[1],id:t,subscribe:n.subscribe,switchChain:async _=>{try{await d(_),s=_}catch(f){console.error("Error switching chain",f)}}};return p}}}function wh(){return ot("walletConnect")}const Ao=xc()?Xd():void 0;function Bs(r){const t=js().find(e=>e.info.rdns===r);return t==null?void 0:t.provider}function Gc(){return js().map(e=>e.info.rdns).map(e=>ot(e))}function gh(){if(Ao)return Ao}function js(){var t;const r=((t=gh())==null?void 0:t.getProviders())||[];for(const e of r)if(e.info.rdns==="io.metamask.mobile"){e.info.rdns=Cc;break}return r}const To=Object.freeze(Object.defineProperty({__proto__:null,getInstalledWalletProviders:js,getInstalledWallets:Gc,injectedProvider:Bs},Symbol.toStringTag,{value:"Module"}));function Ki(r){const t=Bs(r);if(!t)throw new Error(`No injected provider found for wallet: "${r}"`);return t}async function Jc({id:r,provider:t,emitter:e,client:n,chain:i}){var p,_;let s,c=0;for(;!(s!=null&&s[0])&&c<3;){try{s=await t.request({method:"eth_requestAccounts"})}catch(f){if(console.error(f),(_=(p=Eh(f))==null?void 0:p.toLowerCase())!=null&&_.includes("rejected"))throw f;await new Promise(m=>setTimeout(m,500))}c++}const l=s==null?void 0:s[0];if(!l)throw new Error("Failed to connect to wallet, no accounts available");const u=Q(l),d=await t.request({method:"eth_chainId"}).then(ct).catch(f=>{throw new Error("Error reading chainId from provider",f)});let h=i&&i.id===d?i:ge(d);try{i&&typeof i.id<"u"&&i.id!==d&&(await Yc(t,i),h=i)}catch{console.warn(`Error switching to chain ${i==null?void 0:i.id} - defaulting to wallet chain (${d})`)}return Qc({address:u,chain:h,client:n,emitter:e,id:r,provider:t})}async function Zc({id:r,provider:t,emitter:e,client:n,chain:i}){const o=(await t.request({method:"eth_accounts"}))[0];if(!o)throw new Error("Failed to connect to wallet, no accounts available");const c=Q(o),l=await t.request({method:"eth_chainId"}).then(ct),u=i&&i.id===l?i:ge(l);return Qc({address:c,chain:u,client:n,emitter:e,id:r,provider:t})}function Po({provider:r,address:t,client:e,id:n}){const i={address:Q(t),async sendTransaction(s){const c=[{...s.gasPrice?{gasPrice:De(s.gasPrice)}:{maxFeePerGas:s.maxFeePerGas?De(s.maxFeePerGas):void 0,maxPriorityFeePerGas:s.maxPriorityFeePerGas?De(s.maxPriorityFeePerGas):void 0},from:this.address,gas:s.gas?De(s.gas):void 0,nonce:s.nonce?De(s.nonce):void 0,to:s.to?Q(s.to):void 0,data:s.data,value:s.value?De(s.value):void 0,authorizationList:s.authorizationList?td(s.authorizationList):void 0,accessList:s.accessList,...s.eip712}];try{const l=await r.request({method:"eth_sendTransaction",params:c});return Rs({chainId:s.chainId,client:e,contractAddress:s.to??void 0,gasPrice:s.gasPrice,transactionHash:l,walletAddress:Q(t),walletType:n}),{transactionHash:l}}catch(l){throw rd(l)&&nd({chainId:s.chainId,client:e,contractAddress:s.to||void 0,error:l,transactionValue:s.value,walletAddress:Q(t)}),l}},async signMessage({message:s}){if(!i.address)throw new Error("Provider not setup");const o=typeof s=="string"?Ps(s):s.raw instanceof Uint8Array?Os(s.raw):s.raw;return await r.request({method:"personal_sign",params:[o,Q(i.address)]})},async signAuthorization(s){const o=Ac(s);let c;try{c=await r.request({method:"eth_sign",params:[Q(i.address),o]})}catch{c=await r.request({method:"secp256k1_sign",params:[o]})}if(!c)throw new Error("Failed to sign authorization");const l=ed(c);return{...s,...l}},async signTypedData(s){if(!r||!i.address)throw new Error("Provider not setup");const o=Cs(s),{domain:c,message:l,primaryType:u}=o,d={EIP712Domain:Qu({domain:c}),...o.types};Yu({domain:c,message:l,primaryType:u,types:d});const h=Xu({domain:c??{},message:l,primaryType:u,types:d});return await r.request({method:"eth_signTypedData_v4",params:[Q(i.address),h]})},async watchAsset(s){return await r.request({method:"wallet_watchAsset",params:s},{retryCount:0})},async sendCalls(s){try{const{callParams:o,chain:c}=await Ns(s,i),l=await r.request({method:"wallet_sendCalls",params:o});return l&&typeof l=="object"&&"id"in l?{chain:c,client:e,id:l.id}:{chain:c,client:e,id:l}}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${n} errored calling wallet_sendCalls, with error: ${o instanceof Error?o.message:Zu(o)}`):o}},async getCallsStatus(s){try{const o=await r.request({method:"wallet_getCallsStatus",params:[s.id]});return $s(o)}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${n} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):o}},async getCallsStatusRaw(s){try{return await r.request({method:"wallet_getCallsStatus",params:[s.id]})}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${n} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):o}},async getCapabilities(s){const o=s.chainId;try{const c=await r.request({method:"wallet_getCapabilities",params:[Q(i.address),o?[De(o)]:void 0]});return ks(c,o)}catch(c){if(/unsupport|not support|not available/i.test(c.message))return{message:`${n} does not support wallet_getCapabilities, reach out to them directly to request EIP-5792 support.`};throw c}}};return i}async function Qc({provider:r,address:t,chain:e,emitter:n,client:i,id:s}){const o=Po({address:t,client:i,id:s,provider:r});async function c(){r.removeListener("accountsChanged",u),r.removeListener("chainChanged",d),r.removeListener("disconnect",l);try{await id(()=>r.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}}async function l(){c(),n.emit("disconnect",void 0)}function u(h){if(h[0]){const p=Po({address:Q(h[0]),client:i,id:s,provider:r});n.emit("accountChanged",p),n.emit("accountsChanged",h)}else l()}function d(h){const p=ge(ct(h));n.emit("chainChanged",p)}return r.on&&(r.on("accountsChanged",u),r.on("chainChanged",d),r.on("disconnect",l)),[o,e,l,h=>Yc(r,h)]}async function Yc(r,t){var n;const e=De(t.id);try{await r.request({method:"wallet_switchEthereumChain",params:[{chainId:e}]})}catch{const i=await Ts(t);await r.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:(n=i.explorers)==null?void 0:n.map(s=>s.url),chainId:e,chainName:i.name,nativeCurrency:i.nativeCurrency,rpcUrls:Us(i)}]})}}function Eh(r){return r instanceof Error?r.message:typeof r=="string"?r:typeof r=="object"&&r!==null?JSON.stringify(r):String(r)}const Oo=Object.freeze(Object.defineProperty({__proto__:null,autoConnectEip1193Wallet:Zc,connectEip1193Wallet:Jc,getInjectedProvider:Ki},Symbol.toStringTag,{value:"Module"}));function vh(r){const t=r.walletId??"adapter",e=ur();let n,i,s;const o=async p=>(s=typeof r.provider=="function"?await r.provider(p):r.provider,s),c=e.subscribe("chainChanged",p=>{i=p});function l(){n=void 0,i=void 0}let u=async()=>{};const d=e.subscribe("disconnect",()=>{l(),c(),d()});e.subscribe("accountChanged",p=>{n=p});let h=async p=>{await(s==null?void 0:s.request({method:"wallet_switchEthereumChain",params:[{chainId:sd(p.id)}]}))};return{autoConnect:async p=>{var b;const[_,f,m,y]=await Zc({chain:p.chain,client:p.client,emitter:e,id:t,provider:await o({chainId:(b=p.chain)==null?void 0:b.id})});return n=_,i=f,u=m,h=y,e.emit("onConnect",p),Be({client:p.client,walletAddress:n.address,walletType:t}),n},connect:async p=>{var b;const[_,f,m,y]=await Jc({chain:p.chain,client:p.client,emitter:e,id:t,provider:await o({chainId:(b=p.chain)==null?void 0:b.id})});return n=_,i=f,u=m,h=y,e.emit("onConnect",p),Be({client:p.client,walletAddress:n.address,walletType:t}),n},disconnect:async()=>{l(),await u(),e.emit("disconnect",void 0)},getAccount:()=>n,getChain(){if(i)return i=cr(i.id)||i,i},getConfig:()=>{},id:t,subscribe:e.subscribe,switchChain:async p=>{await h(p),e.emit("chainChanged",p)}}}function bh(r){const{chain:t,client:e,wallet:n,connectOverride:i}=r,s=Xn({chain:t,client:e});return{on:n.subscribe,removeListener:()=>{},request:async o=>{switch(o.method){case"eth_sendTransaction":{const c=n.getAccount();if(!c)throw new Error("Account not connected");return(await Tc({account:c,transaction:Bi({...o.params[0],chain:t,client:e})})).transactionHash}case"eth_estimateGas":{const c=n.getAccount();if(!c)throw new Error("Account not connected");return od({account:c,transaction:Bi({...o.params[0],chain:t,client:e})})}case"personal_sign":{const c=n.getAccount();if(!c)throw new Error("Account not connected");return c.signMessage({message:{raw:o.params[0]}})}case"eth_signTypedData_v4":{const c=n.getAccount();if(!c)throw new Error("Account not connected");const l=JSON.parse(o.params[1]);return c.signTypedData(l)}case"eth_accounts":{const c=n.getAccount();return c?[c.address]:[]}case"eth_requestAccounts":{const c=n.getAccount();if(c)return[c.address];const l=i?await i(n):await n.connect({client:e}).catch(u=>(console.error("Error connecting wallet",u),null));if(!l)throw new Error("Unable to connect wallet - try passing a connectOverride function");return[l.address]}case"wallet_switchEthereumChain":case"wallet_addEthereumChain":{const l=o.params[0].chainId;if(!l)throw new Error("Chain ID is required");const u=Un(l)?ir(l):l,d=ge(u);return n.switchChain(d)}case"wallet_getCapabilities":{const c=n.getAccount();if(!c)throw new Error("Account not connected");if(!c.getCapabilities)throw new Error("Wallet does not support EIP-5792");const l=o.params[1];if(l&&Array.isArray(l)){const u=l[0],d=Un(u)?ir(u):Number(u);return c.getCapabilities(d?{chainId:d}:{})}return c.getCapabilities({})}case"wallet_sendCalls":{const c=n.getAccount();if(!c)throw new Error("Account not connected");if(!c.sendCalls)throw new Error("Wallet does not support EIP-5792");return c.sendCalls({...o.params[0],chain:t})}case"wallet_getCallsStatus":{const c=n.getAccount();if(!c)throw new Error("Account not connected");if(!c.getCallsStatusRaw)throw new Error("Wallet does not support EIP-5792");return await c.getCallsStatusRaw({id:o.params[0],chain:t,client:e})}default:return s(o)}}}}const Ih=Object.freeze(Object.defineProperty({__proto__:null,fromProvider:vh,toProvider:bh},Symbol.toStringTag,{value:"Module"}));function Ah(r){const t=ur();let e=r.chain;return{autoConnect:async()=>(t.emit("onConnect",r),r.adaptedAccount),connect:async()=>(t.emit("onConnect",r),r.adaptedAccount),disconnect:async()=>{await r.onDisconnect(),t.emit("disconnect",void 0)},getAccount(){return r.adaptedAccount},getChain(){return e=cr(e.id)||e,e},getConfig(){return r},id:"adapter",subscribe:t.subscribe,switchChain:async n=>{await r.switchChain(n),e=n,t.emit("chainChanged",n)}}}async function Th(){return(await a(async()=>{const{default:r}=await import("./wallet-infos-BHI_w6r-.js");return{default:r}},[])).default}async function dr(r,t){return zr(r,async e=>{const{InAppWebConnector:n}=await a(async()=>{const{InAppWebConnector:i}=await import("./web-connector-CH10dfXt.js");return{InAppWebConnector:i}},__vite__mapDeps([12,1,2,3,4,5,6,7]));return new n({client:e,ecosystem:t})},t)}async function Xc(r){const{client:t,ecosystem:e}=r,i=await(await dr(t,e)).getUser();switch(i.status){case"Logged In, Wallet Initialized":return i}}async function Ph(r){const t=await Xc(r);if(t&&"email"in t.authDetails)return t.authDetails.email}async function Oh(r){const t=await Xc(r);if(t&&"phoneNumber"in t.authDetails)return t.authDetails.phoneNumber}async function Rh(r){return(await dr(r.client,r.ecosystem)).preAuthenticate(r)}async function Lh(r){return(await dr(r.client,r.ecosystem)).authenticate(r)}async function Dh(r){const t=await dr(r.client,r.ecosystem);if(!t.authenticateWithRedirect)throw new Error("authenticateWithRedirect is not supported on this platform");return t.authenticateWithRedirect(r.strategy,r.mode,r.redirectUrl)}async function Vh(r){return await(await dr(r.client,r.ecosystem)).linkProfile(r)}async function Sh(r){return await(await dr(r.client,r.ecosystem)).unlinkProfile(r.profileToUnlink,r.allowAccountDeletion)}async function xh(r){return(await dr(r.client,r.ecosystem)).getProfiles()}function Ch(r){if("privateKey"in r){const t=ad(typeof r.message=="object"?r.message.raw:cd(r.message)),e=Ds({payload:t,privateKey:r.privateKey});return Pc(e)}if("account"in r){const{message:t,account:e}=r;return e.signMessage({message:t})}throw new Error("Either privateKey or account is required")}function $h(r){var s;const{privateKey:t,...e}=r;typeof((s=e.domain)==null?void 0:s.chainId)=="string"&&(e.domain.chainId=wc(e.domain.chainId));const n=ld(e),i=Ds({payload:n,privateKey:t});return Pc(i)}function Fi(r){const{client:t}=r,e=`0x${r.privateKey.replace(/^0x/,"")}`,n=Vs(Oc.getPublicKey(e.slice(2),!1)),i=ud(n);return{address:Q(i),sendTransaction:async o=>{const c=Xn({chain:ge(o.chainId),client:t}),l=_o({privateKey:e,transaction:o});return{transactionHash:await hd(c,l)}},signAuthorization:async o=>{const c=Ds({payload:Ac(o),privateKey:e});return dd(o,{signature:c})},signMessage:async({message:o})=>Ch({message:o,privateKey:e}),signTransaction:async o=>_o({privateKey:e,transaction:o}),signTypedData:async o=>$h({...o,privateKey:e})}}async function kh(r){const t=Vs(Oc.utils.randomPrivateKey());return Fi({client:r.client,privateKey:t})}async function Nh(r){const{address:t,client:e,chain:n}=r,i=r.tokenAddress||(n.id===42429?"0x20c0000000000000000000000000000000000000":void 0);if(i&&Q(i)!==Q(fo)){const{getBalance:d}=await a(async()=>{const{getBalance:h}=await import("./getBalance-CFOYyEyS.js");return{getBalance:h}},__vite__mapDeps([17,1]));return d({address:t,contract:Ls({address:i,chain:n,client:e})})}const s=Xn({chain:n,client:e}),[o,c,l,u]=await Promise.all([pd(n),_d(n),fd(n),md(s,{address:t})]);return{chainId:n.id,decimals:c,displayValue:yd(u,c),name:l,symbol:o,tokenAddress:i??fo,value:u}}function Uh(r){return!r||typeof r.then!="function"?Promise.resolve(r):r}function ye(r,...t){try{return Uh(r(...t))}catch(e){return Promise.reject(e)}}function qh(r){const t=typeof r;return r===null||t!=="object"&&t!=="function"}function Mh(r){const t=Object.getPrototypeOf(r);return!t||t.isPrototypeOf(Object)}function Dn(r){if(qh(r))return String(r);if(Mh(r)||Array.isArray(r))return JSON.stringify(r);if(typeof r.toJSON=="function")return Dn(r.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const Wi="base64:";function Bh(r){return typeof r=="string"?r:Wi+Kh(r)}function jh(r){return typeof r!="string"||!r.startsWith(Wi)?r:zh(r.slice(Wi.length))}function zh(r){return globalThis.Buffer?ee.from(r,"base64"):Uint8Array.from(globalThis.atob(r),t=>t.codePointAt(0))}function Kh(r){return globalThis.Buffer?ee.from(r).toString("base64"):globalThis.btoa(String.fromCodePoint(...r))}function ke(r){var t;return r&&((t=r.split("?")[0])==null?void 0:t.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""))||""}function Fh(...r){return ke(r.join(":"))}function vn(r){return r=ke(r),r?r+":":""}function Wh(r,t){if(t===void 0)return!0;let e=0,n=r.indexOf(":");for(;n>-1;)e++,n=r.indexOf(":",n+1);return e<=t}function Hh(r,t){return t?r.startsWith(t)&&r[r.length-1]!=="$":r[r.length-1]!=="$"}const Gh="memory",Jh=()=>{const r=new Map;return{name:Gh,getInstance:()=>r,hasItem(t){return r.has(t)},getItem(t){return r.get(t)??null},getItemRaw(t){return r.get(t)??null},setItem(t,e){r.set(t,e)},setItemRaw(t,e){r.set(t,e)},removeItem(t){r.delete(t)},getKeys(){return[...r.keys()]},clear(){r.clear()},dispose(){r.clear()}}};function Zh(r={}){const t={mounts:{"":r.driver||Jh()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},e=u=>{for(const d of t.mountpoints)if(u.startsWith(d))return{base:d,relativeKey:u.slice(d.length),driver:t.mounts[d]};return{base:"",relativeKey:u,driver:t.mounts[""]}},n=(u,d)=>t.mountpoints.filter(h=>h.startsWith(u)||d&&u.startsWith(h)).map(h=>({relativeBase:u.length>h.length?u.slice(h.length):void 0,mountpoint:h,driver:t.mounts[h]})),i=(u,d)=>{if(t.watching){d=ke(d);for(const h of t.watchListeners)h(u,d)}},s=async()=>{if(!t.watching){t.watching=!0;for(const u in t.mounts)t.unwatch[u]=await Ro(t.mounts[u],i,u)}},o=async()=>{if(t.watching){for(const u in t.unwatch)await t.unwatch[u]();t.unwatch={},t.watching=!1}},c=(u,d,h)=>{const p=new Map,_=f=>{let m=p.get(f.base);return m||(m={driver:f.driver,base:f.base,items:[]},p.set(f.base,m)),m};for(const f of u){const m=typeof f=="string",y=ke(m?f:f.key),b=m?void 0:f.value,R=m||!f.options?d:{...d,...f.options},v=e(y);_(v).items.push({key:y,value:b,relativeKey:v.relativeKey,options:R})}return Promise.all([...p.values()].map(f=>h(f))).then(f=>f.flat())},l={hasItem(u,d={}){u=ke(u);const{relativeKey:h,driver:p}=e(u);return ye(p.hasItem,h,d)},getItem(u,d={}){u=ke(u);const{relativeKey:h,driver:p}=e(u);return ye(p.getItem,h,d).then(_=>gn(_))},getItems(u,d={}){return c(u,d,h=>h.driver.getItems?ye(h.driver.getItems,h.items.map(p=>({key:p.relativeKey,options:p.options})),d).then(p=>p.map(_=>({key:Fh(h.base,_.key),value:gn(_.value)}))):Promise.all(h.items.map(p=>ye(h.driver.getItem,p.relativeKey,p.options).then(_=>({key:p.key,value:gn(_)})))))},getItemRaw(u,d={}){u=ke(u);const{relativeKey:h,driver:p}=e(u);return p.getItemRaw?ye(p.getItemRaw,h,d):ye(p.getItem,h,d).then(_=>jh(_))},async setItem(u,d,h={}){if(d===void 0)return l.removeItem(u);u=ke(u);const{relativeKey:p,driver:_}=e(u);_.setItem&&(await ye(_.setItem,p,Dn(d),h),_.watch||i("update",u))},async setItems(u,d){await c(u,d,async h=>{if(h.driver.setItems)return ye(h.driver.setItems,h.items.map(p=>({key:p.relativeKey,value:Dn(p.value),options:p.options})),d);h.driver.setItem&&await Promise.all(h.items.map(p=>ye(h.driver.setItem,p.relativeKey,Dn(p.value),p.options)))})},async setItemRaw(u,d,h={}){if(d===void 0)return l.removeItem(u,h);u=ke(u);const{relativeKey:p,driver:_}=e(u);if(_.setItemRaw)await ye(_.setItemRaw,p,d,h);else if(_.setItem)await ye(_.setItem,p,Bh(d),h);else return;_.watch||i("update",u)},async removeItem(u,d={}){typeof d=="boolean"&&(d={removeMeta:d}),u=ke(u);const{relativeKey:h,driver:p}=e(u);p.removeItem&&(await ye(p.removeItem,h,d),(d.removeMeta||d.removeMata)&&await ye(p.removeItem,h+"$",d),p.watch||i("remove",u))},async getMeta(u,d={}){typeof d=="boolean"&&(d={nativeOnly:d}),u=ke(u);const{relativeKey:h,driver:p}=e(u),_=Object.create(null);if(p.getMeta&&Object.assign(_,await ye(p.getMeta,h,d)),!d.nativeOnly){const f=await ye(p.getItem,h+"$",d).then(m=>gn(m));f&&typeof f=="object"&&(typeof f.atime=="string"&&(f.atime=new Date(f.atime)),typeof f.mtime=="string"&&(f.mtime=new Date(f.mtime)),Object.assign(_,f))}return _},setMeta(u,d,h={}){return this.setItem(u+"$",d,h)},removeMeta(u,d={}){return this.removeItem(u+"$",d)},async getKeys(u,d={}){var y;u=vn(u);const h=n(u,!0);let p=[];const _=[];let f=!0;for(const b of h){(y=b.driver.flags)!=null&&y.maxDepth||(f=!1);const R=await ye(b.driver.getKeys,b.relativeBase,d);for(const v of R){const P=b.mountpoint+ke(v);p.some(T=>P.startsWith(T))||_.push(P)}p=[b.mountpoint,...p.filter(v=>!v.startsWith(b.mountpoint))]}const m=d.maxDepth!==void 0&&!f;return _.filter(b=>(!m||Wh(b,d.maxDepth))&&Hh(b,u))},async clear(u,d={}){u=vn(u),await Promise.all(n(u,!1).map(async h=>{if(h.driver.clear)return ye(h.driver.clear,h.relativeBase,d);if(h.driver.removeItem){const p=await h.driver.getKeys(h.relativeBase||"",d);return Promise.all(p.map(_=>h.driver.removeItem(_,d)))}}))},async dispose(){await Promise.all(Object.values(t.mounts).map(u=>Lo(u)))},async watch(u){return await s(),t.watchListeners.push(u),async()=>{t.watchListeners=t.watchListeners.filter(d=>d!==u),t.watchListeners.length===0&&await o()}},async unwatch(){t.watchListeners=[],await o()},mount(u,d){if(u=vn(u),u&&t.mounts[u])throw new Error(`already mounted at ${u}`);return u&&(t.mountpoints.push(u),t.mountpoints.sort((h,p)=>p.length-h.length)),t.mounts[u]=d,t.watching&&Promise.resolve(Ro(d,i,u)).then(h=>{t.unwatch[u]=h}).catch(console.error),l},async unmount(u,d=!0){var h,p;u=vn(u),!(!u||!t.mounts[u])&&(t.watching&&u in t.unwatch&&((p=(h=t.unwatch)[u])==null||p.call(h),delete t.unwatch[u]),d&&await Lo(t.mounts[u]),t.mountpoints=t.mountpoints.filter(_=>_!==u),delete t.mounts[u])},getMount(u=""){u=ke(u)+":";const d=e(u);return{driver:d.driver,base:d.base}},getMounts(u="",d={}){return u=ke(u),n(u,d.parents).map(p=>({driver:p.driver,base:p.mountpoint}))},keys:(u,d={})=>l.getKeys(u,d),get:(u,d={})=>l.getItem(u,d),set:(u,d,h={})=>l.setItem(u,d,h),has:(u,d={})=>l.hasItem(u,d),del:(u,d={})=>l.removeItem(u,d),remove:(u,d={})=>l.removeItem(u,d)};return l}function Ro(r,t,e){return r.watch?r.watch((n,i)=>t(n,e+i)):()=>{}}async function Lo(r){typeof r.dispose=="function"&&await ye(r.dispose)}const Qh="idb-keyval";var Yh=(r={})=>{const t=r.base&&r.base.length>0?`${r.base}:`:"",e=i=>t+i;let n;return r.dbName&&r.storeName&&(n=Sd(r.dbName,r.storeName)),{name:Qh,options:r,async hasItem(i){return!(typeof await yo(e(i),n)>"u")},async getItem(i){return await yo(e(i),n)??null},setItem(i,s){return kd(e(i),s,n)},removeItem(i){return $d(e(i),n)},getKeys(){return Cd(n)},clear(){return xd(n)}}};const Xh="WALLET_CONNECT_V2_INDEXED_DB",ep="keyvaluestorage";let tp=class{constructor(){this.indexedDb=Zh({driver:Yh({dbName:Xh,storeName:ep})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(t=>[t.key,t.value])}async getItem(t){const e=await this.indexedDb.getItem(t);if(e!==null)return e}async setItem(t,e){await this.indexedDb.setItem(t,tn(e))}async removeItem(t){await this.indexedDb.removeItem(t)}};var mi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof K<"u"?K:typeof self<"u"?self:{},Vn={exports:{}};(function(){let r;function t(){}r=t,r.prototype.getItem=function(e){return this.hasOwnProperty(e)?String(this[e]):null},r.prototype.setItem=function(e,n){this[e]=String(n)},r.prototype.removeItem=function(e){delete this[e]},r.prototype.clear=function(){const e=this;Object.keys(e).forEach(function(n){e[n]=void 0,delete e[n]})},r.prototype.key=function(e){return e=e||0,Object.keys(this)[e]},r.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof mi<"u"&&mi.localStorage?Vn.exports=mi.localStorage:typeof window<"u"&&window.localStorage?Vn.exports=window.localStorage:Vn.exports=new t})();function rp(r){var t;return[r[0],qn((t=r[1])!=null?t:"")]}let np=class{constructor(){this.localStorage=Vn.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(rp)}async getItem(t){const e=this.localStorage.getItem(t);if(e!==null)return qn(e)}async setItem(t,e){this.localStorage.setItem(t,tn(e))}async removeItem(t){this.localStorage.removeItem(t)}};const ip="wc_storage_version",Do=1,sp=async(r,t,e)=>{const n=ip,i=await t.getItem(n);if(i&&i>=Do){e(t);return}const s=await r.getKeys();if(!s.length){e(t);return}const o=[];for(;s.length;){const c=s.shift();if(!c)continue;const l=c.toLowerCase();if(l.includes("wc@")||l.includes("walletconnect")||l.includes("wc_")||l.includes("wallet_connect")){const u=await r.getItem(c);await t.setItem(c,u),o.push(c)}}await t.setItem(n,Do),e(t),op(r,o)},op=async(r,t)=>{t.length&&t.forEach(async e=>{await r.removeItem(e)})};let ap=class{constructor(){this.initialized=!1,this.setInitialized=e=>{this.storage=e,this.initialized=!0};const t=new np;this.storage=t;try{const e=new tp;sp(t,e,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(t){return await this.initialize(),this.storage.getItem(t)}async setItem(t,e){return await this.initialize(),this.storage.setItem(t,e)}async removeItem(t){return await this.initialize(),this.storage.removeItem(t)}async initialize(){this.initialized||await new Promise(t=>{const e=setInterval(()=>{this.initialized&&(clearInterval(e),t())},20)})}};var yi,Vo;function cp(){if(Vo)return yi;Vo=1;const r=Nd();yi=i;const t=T().console||{},e={mapHttpRequest:f,mapHttpResponse:f,wrapRequestSerializer:m,wrapResponseSerializer:m,wrapErrorSerializer:m,req:f,res:f,err:p};function n(g,D){return Array.isArray(g)?g.filter(function(w){return w!=="!stdSerializers.err"}):g===!0?Object.keys(D):!1}function i(g){g=g||{},g.browser=g.browser||{};const D=g.browser.transmit;if(D&&typeof D.send!="function")throw Error("pino: transmit option must have a send function");const L=g.browser.write||t;g.browser.write&&(g.browser.asObject=!0);const w=g.serializers||{},E=n(g.browser.serialize,w);let I=g.browser.serialize;Array.isArray(g.browser.serialize)&&g.browser.serialize.indexOf("!stdSerializers.err")>-1&&(I=!1);const A=["error","fatal","warn","info","debug","trace"];typeof L=="function"&&(L.error=L.fatal=L.warn=L.info=L.debug=L.trace=L),g.enabled===!1&&(g.level="silent");const V=g.level||"info",O=Object.create(L);O.log||(O.log=y),Object.defineProperty(O,"levelVal",{get:$}),Object.defineProperty(O,"level",{get:k,set:M});const S={transmit:D,serialize:E,asObject:g.browser.asObject,levels:A,timestamp:_(g)};O.levels=i.levels,O.level=V,O.setMaxListeners=O.getMaxListeners=O.emit=O.addListener=O.on=O.prependListener=O.once=O.prependOnceListener=O.removeListener=O.removeAllListeners=O.listeners=O.listenerCount=O.eventNames=O.write=O.flush=y,O.serializers=w,O._serialize=E,O._stdErrSerialize=I,O.child=C,D&&(O._logEvent=h());function $(){return this.level==="silent"?1/0:this.levels.values[this.level]}function k(){return this._level}function M(N){if(N!=="silent"&&!this.levels.values[N])throw Error("unknown level "+N);this._level=N,s(S,O,"error","log"),s(S,O,"fatal","error"),s(S,O,"warn","error"),s(S,O,"info","log"),s(S,O,"debug","log"),s(S,O,"trace","log")}function C(N,j){if(!N)throw new Error("missing bindings for child Pino");j=j||{},E&&N.serializers&&(j.serializers=N.serializers);const z=j.serializers;if(E&&z){var F=Object.assign({},w,z),W=g.browser.serialize===!0?Object.keys(F):E;delete N.serializers,l([N],W,F,this._stdErrSerialize)}function H(G){this._childLevel=(G._childLevel|0)+1,this.error=u(G,N,"error"),this.fatal=u(G,N,"fatal"),this.warn=u(G,N,"warn"),this.info=u(G,N,"info"),this.debug=u(G,N,"debug"),this.trace=u(G,N,"trace"),F&&(this.serializers=F,this._serialize=W),D&&(this._logEvent=h([].concat(G._logEvent.bindings,N)))}return H.prototype=this,new H(this)}return O}i.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},i.stdSerializers=e,i.stdTimeFunctions=Object.assign({},{nullTime:b,epochTime:R,unixTime:v,isoTime:P});function s(g,D,L,w){const E=Object.getPrototypeOf(D);D[L]=D.levelVal>D.levels.values[L]?y:E[L]?E[L]:t[L]||t[w]||y,o(g,D,L)}function o(g,D,L){!g.transmit&&D[L]===y||(D[L]=function(w){return function(){const I=g.timestamp(),A=new Array(arguments.length),V=Object.getPrototypeOf&&Object.getPrototypeOf(this)===t?t:this;for(var O=0;O<A.length;O++)A[O]=arguments[O];if(g.serialize&&!g.asObject&&l(A,this._serialize,this.serializers,this._stdErrSerialize),g.asObject?w.call(V,c(this,L,A,I)):w.apply(V,A),g.transmit){const S=g.transmit.level||D.level,$=i.levels.values[S],k=i.levels.values[L];if(k<$)return;d(this,{ts:I,methodLevel:L,methodValue:k,transmitValue:i.levels.values[g.transmit.level||D.level],send:g.transmit.send,val:D.levelVal},A)}}}(D[L]))}function c(g,D,L,w){g._serialize&&l(L,g._serialize,g.serializers,g._stdErrSerialize);const E=L.slice();let I=E[0];const A={};w&&(A.time=w),A.level=i.levels.values[D];let V=(g._childLevel|0)+1;if(V<1&&(V=1),I!==null&&typeof I=="object"){for(;V--&&typeof E[0]=="object";)Object.assign(A,E.shift());I=E.length?r(E.shift(),E):void 0}else typeof I=="string"&&(I=r(E.shift(),E));return I!==void 0&&(A.msg=I),A}function l(g,D,L,w){for(const E in g)if(w&&g[E]instanceof Error)g[E]=i.stdSerializers.err(g[E]);else if(typeof g[E]=="object"&&!Array.isArray(g[E]))for(const I in g[E])D&&D.indexOf(I)>-1&&I in L&&(g[E][I]=L[I](g[E][I]))}function u(g,D,L){return function(){const w=new Array(1+arguments.length);w[0]=D;for(var E=1;E<w.length;E++)w[E]=arguments[E-1];return g[L].apply(this,w)}}function d(g,D,L){const w=D.send,E=D.ts,I=D.methodLevel,A=D.methodValue,V=D.val,O=g._logEvent.bindings;l(L,g._serialize||Object.keys(g.serializers),g.serializers,g._stdErrSerialize===void 0?!0:g._stdErrSerialize),g._logEvent.ts=E,g._logEvent.messages=L.filter(function(S){return O.indexOf(S)===-1}),g._logEvent.level.label=I,g._logEvent.level.value=A,w(I,g._logEvent,V),g._logEvent=h(O)}function h(g){return{ts:0,messages:[],bindings:g||[],level:{label:"",value:0}}}function p(g){const D={type:g.constructor.name,msg:g.message,stack:g.stack};for(const L in g)D[L]===void 0&&(D[L]=g[L]);return D}function _(g){return typeof g.timestamp=="function"?g.timestamp:g.timestamp===!1?b:R}function f(){return{}}function m(g){return g}function y(){}function b(){return!1}function R(){return Date.now()}function v(){return Math.round(Date.now()/1e3)}function P(){return new Date(Date.now()).toISOString()}function T(){function g(D){return typeof D<"u"&&D}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return g(self)||g(window)||g(this)||{}}}return yi}var gr=cp();const ei=wd(gr),lp={level:"info"},pn="custom_context",zs=1e3*1024;let up=class{constructor(t){this.nodeValue=t,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}},So=class{constructor(t){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=t,this.sizeInBytes=0}append(t){const e=new up(t);if(e.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${t} with size ${e.size}`);for(;this.size+e.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=e),this.tail=e):(this.head=e,this.tail=e),this.lengthInNodes++,this.sizeInBytes+=e.size}shift(){if(!this.head)return;const t=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=t.size}toArray(){const t=[];let e=this.head;for(;e!==null;)t.push(e.value),e=e.next;return t}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let t=this.head;return{next:()=>{if(!t)return{done:!0,value:null};const e=t.value;return t=t.next,{done:!1,value:e}}}}};class el{constructor(t,e=zs){this.level=t??"error",this.levelValue=gr.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=e,this.logs=new So(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(t,e){e===gr.levels.values.error?console.error(t):e===gr.levels.values.warn?console.warn(t):e===gr.levels.values.debug?console.debug(t):e===gr.levels.values.trace?console.trace(t):console.log(t)}appendToLogs(t){this.logs.append(tn({timestamp:new Date().toISOString(),log:t}));const e=typeof t=="string"?JSON.parse(t).level:t.level;e>=this.levelValue&&this.forwardToConsole(t,e)}getLogs(){return this.logs}clearLogs(){this.logs=new So(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(t){const e=this.getLogArray();return e.push(tn({extraMetadata:t})),new Blob(e,{type:"application/json"})}}let dp=class{constructor(t,e=zs){this.baseChunkLogger=new el(t,e)}write(t){this.baseChunkLogger.appendToLogs(t)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}downloadLogsBlobInBrowser(t){const e=URL.createObjectURL(this.logsToBlob(t)),n=document.createElement("a");n.href=e,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(e)}},hp=class{constructor(t,e=zs){this.baseChunkLogger=new el(t,e)}write(t){this.baseChunkLogger.appendToLogs(t)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}};var pp=Object.defineProperty,_p=Object.defineProperties,fp=Object.getOwnPropertyDescriptors,xo=Object.getOwnPropertySymbols,mp=Object.prototype.hasOwnProperty,yp=Object.prototype.propertyIsEnumerable,Co=(r,t,e)=>t in r?pp(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,zn=(r,t)=>{for(var e in t||(t={}))mp.call(t,e)&&Co(r,e,t[e]);if(xo)for(var e of xo(t))yp.call(t,e)&&Co(r,e,t[e]);return r},Kn=(r,t)=>_p(r,fp(t));function Ks(r){return Kn(zn({},r),{level:(r==null?void 0:r.level)||lp.level})}function wp(r,t=pn){return r[t]||""}function gp(r,t,e=pn){return r[e]=t,r}function Ke(r,t=pn){let e="";return typeof r.bindings>"u"?e=wp(r,t):e=r.bindings().context||"",e}function Ep(r,t,e=pn){const n=Ke(r,e);return n.trim()?`${n}/${t}`:t}function Ce(r,t,e=pn){const n=Ep(r,t,e),i=r.child({context:n});return gp(i,n,e)}function vp(r){var t,e;const n=new dp((t=r.opts)==null?void 0:t.level,r.maxSizeInBytes);return{logger:ei(Kn(zn({},r.opts),{level:"trace",browser:Kn(zn({},(e=r.opts)==null?void 0:e.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function bp(r){var t;const e=new hp((t=r.opts)==null?void 0:t.level,r.maxSizeInBytes);return{logger:ei(Kn(zn({},r.opts),{level:"trace"}),e),chunkLoggerController:e}}function Ip(r){return typeof r.loggerOverride<"u"&&typeof r.loggerOverride!="string"?{logger:r.loggerOverride,chunkLoggerController:null}:typeof window<"u"?vp(r):bp(r)}var Ap=Object.defineProperty,Tp=(r,t,e)=>t in r?Ap(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,$o=(r,t,e)=>Tp(r,typeof t!="symbol"?t+"":t,e);class Pp extends Ar{constructor(t){super(),this.opts=t,$o(this,"protocol","wc"),$o(this,"version",2)}}var Op=Object.defineProperty,Rp=(r,t,e)=>t in r?Op(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Lp=(r,t,e)=>Rp(r,t+"",e);class Dp extends Ar{constructor(t,e){super(),this.core=t,this.logger=e,Lp(this,"records",new Map)}}class Vp{constructor(t,e){this.logger=t,this.core=e}}class Sp extends Ar{constructor(t,e){super(),this.relayer=t,this.logger=e}}let xp=class extends Ar{constructor(t){super()}},Cp=class{constructor(t,e,n,i){this.core=t,this.logger=e,this.name=n}},$p=class extends Ar{constructor(t,e){super(),this.relayer=t,this.logger=e}};class kp extends Ar{constructor(t,e){super(),this.core=t,this.logger=e}}let Np=class{constructor(t,e,n){this.core=t,this.logger=e,this.store=n}},Up=class{constructor(t,e){this.projectId=t,this.logger=e}},qp=class{constructor(t,e,n){this.core=t,this.logger=e,this.telemetryEnabled=n}};var Mp=Object.defineProperty,Bp=(r,t,e)=>t in r?Mp(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ko=(r,t,e)=>Bp(r,typeof t!="symbol"?t+"":t,e);let jp=class{constructor(t){this.opts=t,ko(this,"protocol","wc"),ko(this,"version",2)}},zp=class{constructor(t){this.client=t}};function rn(r,{strict:t=!0}={}){return!r||typeof r!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(r):r.startsWith("0x")}function Hi(r){return rn(r,{strict:!1})?Math.ceil((r.length-2)/2):r.length}const tl="2.31.0";let xr={getDocsUrl:({docsBaseUrl:r,docsPath:t="",docsSlug:e})=>t?`${r??"https://viem.sh"}${t}${e?`#${e}`:""}`:void 0,version:`viem@${tl}`};class sr extends Error{constructor(t,e={}){var c;const n=(()=>{var l;return e.cause instanceof sr?e.cause.details:(l=e.cause)!=null&&l.message?e.cause.message:e.details})(),i=e.cause instanceof sr&&e.cause.docsPath||e.docsPath,s=(c=xr.getDocsUrl)==null?void 0:c.call(xr,{...e,docsPath:i}),o=[t||"An error occurred.","",...e.metaMessages?[...e.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...n?[`Details: ${n}`]:[],...xr.version?[`Version: ${xr.version}`]:[]].join(`
|
|
3
|
-
`);super(o,e.cause?{cause:e.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=i,this.metaMessages=e.metaMessages,this.name=e.name??this.name,this.shortMessage=t,this.version=tl}walk(t){return rl(this,t)}}function rl(r,t){return t!=null&&t(r)?r:r&&typeof r=="object"&&"cause"in r&&r.cause!==void 0?rl(r.cause,t):t?null:r}class nl extends sr{constructor({size:t,targetSize:e,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${t}) exceeds padding size (${e}).`,{name:"SizeExceedsPaddingSizeError"})}}function Or(r,{dir:t,size:e=32}={}){return typeof r=="string"?Kp(r,{dir:t,size:e}):Fp(r,{dir:t,size:e})}function Kp(r,{dir:t,size:e=32}={}){if(e===null)return r;const n=r.replace("0x","");if(n.length>e*2)throw new nl({size:Math.ceil(n.length/2),targetSize:e,type:"hex"});return`0x${n[t==="right"?"padEnd":"padStart"](e*2,"0")}`}function Fp(r,{dir:t,size:e=32}={}){if(e===null)return r;if(r.length>e)throw new nl({size:r.length,targetSize:e,type:"bytes"});const n=new Uint8Array(e);for(let i=0;i<e;i++){const s=t==="right";n[s?i:e-i-1]=r[s?i:r.length-i-1]}return n}class Wp extends sr{constructor({max:t,min:e,signed:n,size:i,value:s}){super(`Number "${s}" is not in safe ${i?`${i*8}-bit ${n?"signed":"unsigned"} `:""}integer range ${t?`(${e} to ${t})`:`(above ${e})`}`,{name:"IntegerOutOfRangeError"})}}class Hp extends sr{constructor({givenSize:t,maxSize:e}){super(`Size cannot exceed ${e} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}function Rr(r,{size:t}){if(Hi(r)>t)throw new Hp({givenSize:Hi(r),maxSize:t})}function Gi(r,t={}){const{signed:e}=t;t.size&&Rr(r,{size:t.size});const n=BigInt(r);if(!e)return n;const i=(r.length-2)/2,s=(1n<<BigInt(i)*8n-1n)-1n;return n<=s?n:n-BigInt(`0x${"f".padStart(i*2,"f")}`)-1n}function Gp(r,t={}){return Number(Gi(r,t))}const Jp=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function Ji(r,t={}){return typeof r=="number"||typeof r=="bigint"?sl(r,t):typeof r=="string"?Yp(r,t):typeof r=="boolean"?Zp(r,t):il(r,t)}function Zp(r,t={}){const e=`0x${Number(r)}`;return typeof t.size=="number"?(Rr(e,{size:t.size}),Or(e,{size:t.size})):e}function il(r,t={}){let e="";for(let i=0;i<r.length;i++)e+=Jp[r[i]];const n=`0x${e}`;return typeof t.size=="number"?(Rr(n,{size:t.size}),Or(n,{dir:"right",size:t.size})):n}function sl(r,t={}){const{signed:e,size:n}=t,i=BigInt(r);let s;n?e?s=(1n<<BigInt(n)*8n-1n)-1n:s=2n**(BigInt(n)*8n)-1n:typeof r=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof s=="bigint"&&e?-s-1n:0;if(s&&i>s||i<o){const l=typeof r=="bigint"?"n":"";throw new Wp({max:s?`${s}${l}`:void 0,min:`${o}${l}`,signed:e,size:n,value:`${r}${l}`})}const c=`0x${(e&&i<0?(1n<<BigInt(n*8))+BigInt(i):i).toString(16)}`;return n?Or(c,{size:n}):c}const Qp=new TextEncoder;function Yp(r,t={}){const e=Qp.encode(r);return il(e,t)}const Xp=new TextEncoder;function e_(r,t={}){return typeof r=="number"||typeof r=="bigint"?r_(r,t):typeof r=="boolean"?t_(r,t):rn(r)?ol(r,t):al(r,t)}function t_(r,t={}){const e=new Uint8Array(1);return e[0]=Number(r),typeof t.size=="number"?(Rr(e,{size:t.size}),Or(e,{size:t.size})):e}const gt={zero:48,nine:57,A:65,F:70,a:97,f:102};function No(r){if(r>=gt.zero&&r<=gt.nine)return r-gt.zero;if(r>=gt.A&&r<=gt.F)return r-(gt.A-10);if(r>=gt.a&&r<=gt.f)return r-(gt.a-10)}function ol(r,t={}){let e=r;t.size&&(Rr(e,{size:t.size}),e=Or(e,{dir:"right",size:t.size}));let n=e.slice(2);n.length%2&&(n=`0${n}`);const i=n.length/2,s=new Uint8Array(i);for(let o=0,c=0;o<i;o++){const l=No(n.charCodeAt(c++)),u=No(n.charCodeAt(c++));if(l===void 0||u===void 0)throw new sr(`Invalid byte sequence ("${n[c-2]}${n[c-1]}" in "${n}").`);s[o]=l*16+u}return s}function r_(r,t){const e=sl(r,t);return ol(e)}function al(r,t={}){const e=Xp.encode(r);return typeof t.size=="number"?(Rr(e,{size:t.size}),Or(e,{dir:"right",size:t.size})):e}const bn=BigInt(2**32-1),Uo=BigInt(32);function n_(r,t=!1){return t?{h:Number(r&bn),l:Number(r>>Uo&bn)}:{h:Number(r>>Uo&bn)|0,l:Number(r&bn)|0}}function i_(r,t=!1){const e=r.length;let n=new Uint32Array(e),i=new Uint32Array(e);for(let s=0;s<e;s++){const{h:o,l:c}=n_(r[s],t);[n[s],i[s]]=[o,c]}return[n,i]}const s_=(r,t,e)=>r<<e|t>>>32-e,o_=(r,t,e)=>t<<e|r>>>32-e,a_=(r,t,e)=>t<<e-32|r>>>64-e,c_=(r,t,e)=>r<<e-32|t>>>64-e,pr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function l_(r){return r instanceof Uint8Array||ArrayBuffer.isView(r)&&r.constructor.name==="Uint8Array"}function Fn(r){if(!Number.isSafeInteger(r)||r<0)throw new Error("positive integer expected, got "+r)}function nn(r,...t){if(!l_(r))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(r.length))throw new Error("Uint8Array expected of length "+t+", got length="+r.length)}function bI(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Fn(r.outputLen),Fn(r.blockLen)}function qo(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function u_(r,t){nn(r);const e=t.outputLen;if(r.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function d_(r){return new Uint32Array(r.buffer,r.byteOffset,Math.floor(r.byteLength/4))}function cl(...r){for(let t=0;t<r.length;t++)r[t].fill(0)}function II(r){return new DataView(r.buffer,r.byteOffset,r.byteLength)}function AI(r,t){return r<<32-t|r>>>t}const h_=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function p_(r){return r<<24&4278190080|r<<8&16711680|r>>>8&65280|r>>>24&255}function __(r){for(let t=0;t<r.length;t++)r[t]=p_(r[t]);return r}const Mo=h_?r=>r:__;function f_(r){if(typeof r!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(r))}function ll(r){return typeof r=="string"&&(r=f_(r)),nn(r),r}function TI(...r){let t=0;for(let n=0;n<r.length;n++){const i=r[n];nn(i),t+=i.length}const e=new Uint8Array(t);for(let n=0,i=0;n<r.length;n++){const s=r[n];e.set(s,i),i+=s.length}return e}class m_{}function y_(r){const t=n=>r().update(ll(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function PI(r=32){if(pr&&typeof pr.getRandomValues=="function")return pr.getRandomValues(new Uint8Array(r));if(pr&&typeof pr.randomBytes=="function")return Uint8Array.from(pr.randomBytes(r));throw new Error("crypto.getRandomValues must be defined")}const w_=BigInt(0),Cr=BigInt(1),g_=BigInt(2),E_=BigInt(7),v_=BigInt(256),b_=BigInt(113),ul=[],dl=[],hl=[];for(let r=0,t=Cr,e=1,n=0;r<24;r++){[e,n]=[n,(2*e+3*n)%5],ul.push(2*(5*n+e)),dl.push((r+1)*(r+2)/2%64);let i=w_;for(let s=0;s<7;s++)t=(t<<Cr^(t>>E_)*b_)%v_,t&g_&&(i^=Cr<<(Cr<<BigInt(s))-Cr);hl.push(i)}const pl=i_(hl,!0),I_=pl[0],A_=pl[1],Bo=(r,t,e)=>e>32?a_(r,t,e):s_(r,t,e),jo=(r,t,e)=>e>32?c_(r,t,e):o_(r,t,e);function T_(r,t=24){const e=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let o=0;o<10;o++)e[o]=r[o]^r[o+10]^r[o+20]^r[o+30]^r[o+40];for(let o=0;o<10;o+=2){const c=(o+8)%10,l=(o+2)%10,u=e[l],d=e[l+1],h=Bo(u,d,1)^e[c],p=jo(u,d,1)^e[c+1];for(let _=0;_<50;_+=10)r[o+_]^=h,r[o+_+1]^=p}let i=r[2],s=r[3];for(let o=0;o<24;o++){const c=dl[o],l=Bo(i,s,c),u=jo(i,s,c),d=ul[o];i=r[d],s=r[d+1],r[d]=l,r[d+1]=u}for(let o=0;o<50;o+=10){for(let c=0;c<10;c++)e[c]=r[o+c];for(let c=0;c<10;c++)r[o+c]^=~e[(c+2)%10]&e[(c+4)%10]}r[0]^=I_[n],r[1]^=A_[n]}cl(e)}class Fs extends m_{constructor(t,e,n,i=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=i,this.rounds=s,Fn(n),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=d_(this.state)}clone(){return this._cloneInto()}keccak(){Mo(this.state32),T_(this.state32,this.rounds),Mo(this.state32),this.posOut=0,this.pos=0}update(t){qo(this),t=ll(t),nn(t);const{blockLen:e,state:n}=this,i=t.length;for(let s=0;s<i;){const o=Math.min(e-this.pos,i-s);for(let c=0;c<o;c++)n[this.pos++]^=t[s++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:e,pos:n,blockLen:i}=this;t[n]^=e,e&128&&n===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){qo(this,!1),nn(t),this.finish();const e=this.state,{blockLen:n}=this;for(let i=0,s=t.length;i<s;){this.posOut>=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);t.set(e.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Fn(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(u_(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,cl(this.state)}_cloneInto(t){const{blockLen:e,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return t||(t=new Fs(e,n,i,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=n,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}}const P_=(r,t,e)=>y_(()=>new Fs(t,r,e)),O_=P_(1,136,256/8);function _l(r,t){const e=t||"hex",n=O_(rn(r,{strict:!1})?e_(r):r);return e==="bytes"?n:Ji(n)}class R_ extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const e=super.get(t);return super.has(t)&&e!==void 0&&(this.delete(t),super.set(t,e)),e}set(t,e){if(super.set(t,e),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}const wi=new R_(8192);function L_(r,t){if(wi.has(`${r}.${t}`))return wi.get(`${r}.${t}`);const e=r.substring(2).toLowerCase(),n=_l(al(e),"bytes"),i=e.split("");for(let o=0;o<40;o+=2)n[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(n[o>>1]&15)>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const s=`0x${i.join("")}`;return wi.set(`${r}.${t}`,s),s}function D_(r){const t=_l(`0x${r.substring(4)}`).substring(26);return L_(`0x${t}`)}async function V_({hash:r,signature:t}){const e=rn(r)?r:Ji(r),{secp256k1:n}=await a(async()=>{const{secp256k1:o}=await import("./secp256k1-BUIg71XZ.js");return{secp256k1:o}},__vite__mapDeps([18,1,2,3,4,5,6,7]));return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:u,s:d,v:h,yParity:p}=t,_=Number(p??h),f=zo(_);return new n.Signature(Gi(u),Gi(d)).addRecoveryBit(f)}const o=rn(t)?t:Ji(t);if(Hi(o)!==65)throw new Error("invalid signature length");const c=Gp(`0x${o.slice(130)}`),l=zo(c);return n.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(l)})().recoverPublicKey(e.substring(2)).toHex(!1)}`}function zo(r){if(r===0||r===1)return r;if(r===27)return 0;if(r===28)return 1;throw new Error("Invalid yParityOrV value")}async function S_({hash:r,signature:t}){return D_(await V_({hash:r,signature:t}))}var x_={};const C_=":";function Sn(r){const[t,e]=r.split(C_);return{namespace:t,reference:e}}function fl(r,t){return r.includes(":")?[r]:t.chains||[]}var $_=Object.defineProperty,k_=Object.defineProperties,N_=Object.getOwnPropertyDescriptors,Ko=Object.getOwnPropertySymbols,U_=Object.prototype.hasOwnProperty,q_=Object.prototype.propertyIsEnumerable,Zi=(r,t,e)=>t in r?$_(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Fo=(r,t)=>{for(var e in t||(t={}))U_.call(t,e)&&Zi(r,e,t[e]);if(Ko)for(var e of Ko(t))q_.call(t,e)&&Zi(r,e,t[e]);return r},M_=(r,t)=>k_(r,N_(t)),Wo=(r,t,e)=>Zi(r,typeof t!="symbol"?t+"":t,e);const B_="ReactNative",He={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},j_="js";function Wn(){return typeof zt<"u"&&typeof zt.versions<"u"&&typeof zt.versions.node<"u"}function Wt(){return!Ot.getDocument()&&!!Ot.getNavigator()&&navigator.product===B_}function z_(){return Wt()&&typeof K<"u"&&typeof(K==null?void 0:K.Platform)<"u"&&(K==null?void 0:K.Platform.OS)==="android"}function K_(){return Wt()&&typeof K<"u"&&typeof(K==null?void 0:K.Platform)<"u"&&(K==null?void 0:K.Platform.OS)==="ios"}function Lr(){return!Wn()&&!!Ot.getNavigator()&&!!Ot.getDocument()}function _n(){return Wt()?He.reactNative:Wn()?He.node:Lr()?He.browser:He.unknown}function Ho(){var r;try{return Wt()&&typeof K<"u"&&typeof(K==null?void 0:K.Application)<"u"?(r=K.Application)==null?void 0:r.applicationId:void 0}catch{return}}function F_(r,t){const e=new URLSearchParams(r);for(const n of Object.keys(t).sort())if(t.hasOwnProperty(n)){const i=t[n];i!==void 0&&e.set(n,i)}return e.toString()}function W_(r){var t,e;const n=ml();try{return r!=null&&r.url&&n.url&&new URL(r.url).host!==new URL(n.url).host&&(console.warn(`The configured WalletConnect 'metadata.url':${r.url} differs from the actual page url:${n.url}. This is probably unintended and can lead to issues.`),r.url=n.url),(t=r==null?void 0:r.icons)!=null&&t.length&&r.icons.length>0&&(r.icons=r.icons.filter(i=>i!=="")),M_(Fo(Fo({},n),r),{url:(r==null?void 0:r.url)||n.url,name:(r==null?void 0:r.name)||n.name,description:(r==null?void 0:r.description)||n.description,icons:(e=r==null?void 0:r.icons)!=null&&e.length&&r.icons.length>0?r.icons:n.icons})}catch(i){return console.warn("Error populating app metadata",i),r||n}}function ml(){return Ud.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function H_(){if(_n()===He.reactNative&&typeof K<"u"&&typeof(K==null?void 0:K.Platform)<"u"){const{OS:e,Version:n}=K.Platform;return[e,n].join("-")}const r=Md();if(r===null)return"unknown";const t=r.os?r.os.replace(" ","").toLowerCase():"unknown";return r.type==="browser"?[t,r.name,r.version].join("-"):[t,r.version].join("-")}function G_(){var r;const t=_n();return t===He.browser?[t,((r=Ot.getLocation())==null?void 0:r.host)||"unknown"].join(":"):t}function yl(r,t,e){const n=H_(),i=G_();return[[r,t].join("-"),[j_,e].join("-"),n,i].join("/")}function J_({protocol:r,version:t,relayUrl:e,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:c,packageName:l}){const u=e.split("?"),d=yl(r,t,n),h={auth:i,ua:d,projectId:s,useOnCloseEvent:o,packageName:l||void 0,bundleId:c||void 0},p=F_(u[1]||"",h);return u[0]+"?"+p}function Xt(r,t){return r.filter(e=>t.includes(e)).length===r.length}function Qi(r){return Object.fromEntries(r.entries())}function Yi(r){return new Map(Object.entries(r))}function Zt(r=q.FIVE_MINUTES,t){const e=q.toMiliseconds(r||q.FIVE_MINUTES);let n,i,s,o;return{resolve:c=>{s&&n&&(clearTimeout(s),n(c),o=Promise.resolve(c))},reject:c=>{s&&i&&(clearTimeout(s),i(c))},done:()=>new Promise((c,l)=>{if(o)return c(o);s=setTimeout(()=>{const u=new Error(t);o=Promise.reject(u),l(u)},e),n=c,i=l})}}function ft(r,t,e){return new Promise(async(n,i)=>{const s=setTimeout(()=>i(new Error(e)),t);try{const o=await r;n(o)}catch(o){i(o)}clearTimeout(s)})}function wl(r,t){if(typeof t=="string"&&t.startsWith(`${r}:`))return t;if(r.toLowerCase()==="topic"){if(typeof t!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}else if(r.toLowerCase()==="id"){if(typeof t!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw new Error(`Unknown expirer target type: ${r}`)}function Z_(r){return wl("topic",r)}function Q_(r){return wl("id",r)}function gl(r){const[t,e]=r.split(":"),n={id:void 0,topic:void 0};if(t==="topic"&&typeof e=="string")n.topic=e;else if(t==="id"&&Number.isInteger(Number(e)))n.id=Number(e);else throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${e}`);return n}function _e(r,t){return q.fromMiliseconds(Date.now()+q.toMiliseconds(r))}function Ut(r){return Date.now()>=q.toMiliseconds(r)}function te(r,t){return`${r}${t?`:${t}`:""}`}function nr(r=[],t=[]){return[...new Set([...r,...t])]}async function Y_({id:r,topic:t,wcDeepLink:e}){var n;try{if(!e)return;const i=typeof e=="string"?JSON.parse(e):e,s=i==null?void 0:i.href;if(typeof s!="string")return;const o=X_(s,r,t),c=_n();if(c===He.browser){if(!((n=Ot.getDocument())!=null&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}ef(o)}else c===He.reactNative&&typeof(K==null?void 0:K.Linking)<"u"&&await K.Linking.openURL(o)}catch(i){console.error(i)}}function X_(r,t,e){const n=`requestId=${t}&sessionTopic=${e}`;r.endsWith("/")&&(r=r.slice(0,-1));let i=`${r}`;if(r.startsWith("https://t.me")){const s=r.includes("?")?"&startapp=":"?startapp=";i=`${i}${s}${sf(n,!0)}`}else i=`${i}/wc?${n}`;return i}function ef(r){let t="_self";nf()?t="_top":(rf()||r.startsWith("https://")||r.startsWith("http://"))&&(t="_blank"),window.open(r,t,"noreferrer noopener")}async function tf(r,t){let e="";try{if(Lr()&&(e=localStorage.getItem(t),e))return e;e=await r.getItem(t)}catch(n){console.error(n)}return e}function Go(r,t){if(!r.includes(t))return null;const e=r.split(/([&,?,=])/),n=e.indexOf(t);return e[n+2]}function Jo(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,r=>{const t=Math.random()*16|0;return(r==="x"?t:t&3|8).toString(16)})}function Ws(){return typeof zt<"u"&&x_.IS_VITEST==="true"}function rf(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function nf(){try{return window.self!==window.top}catch{return!1}}function sf(r,t=!1){const e=ee.from(r).toString("base64");return t?e.replace(/[=]/g,""):e}function El(r){return ee.from(r,"base64").toString("utf-8")}function of(r){return new Promise(t=>setTimeout(t,r))}let af=class{constructor({limit:t}){Wo(this,"limit"),Wo(this,"set"),this.limit=t,this.set=new Set}add(t){if(!this.set.has(t)){if(this.set.size>=this.limit){const e=this.set.values().next().value;e&&this.set.delete(e)}this.set.add(t)}}has(t){return this.set.has(t)}};const In=BigInt(2**32-1),Zo=BigInt(32);function vl(r,t=!1){return t?{h:Number(r&In),l:Number(r>>Zo&In)}:{h:Number(r>>Zo&In)|0,l:Number(r&In)|0}}function bl(r,t=!1){const e=r.length;let n=new Uint32Array(e),i=new Uint32Array(e);for(let s=0;s<e;s++){const{h:o,l:c}=vl(r[s],t);[n[s],i[s]]=[o,c]}return[n,i]}const Qo=(r,t,e)=>r>>>e,Yo=(r,t,e)=>r<<32-e|t>>>e,qt=(r,t,e)=>r>>>e|t<<32-e,Mt=(r,t,e)=>r<<32-e|t>>>e,Kr=(r,t,e)=>r<<64-e|t>>>e-32,Fr=(r,t,e)=>r>>>e-32|t<<64-e,cf=(r,t)=>t,lf=(r,t)=>r,uf=(r,t,e)=>r<<e|t>>>32-e,df=(r,t,e)=>t<<e|r>>>32-e,hf=(r,t,e)=>t<<e-32|r>>>64-e,pf=(r,t,e)=>r<<e-32|t>>>64-e;function st(r,t,e,n){const i=(t>>>0)+(n>>>0);return{h:r+e+(i/2**32|0)|0,l:i|0}}const Hs=(r,t,e)=>(r>>>0)+(t>>>0)+(e>>>0),Gs=(r,t,e,n)=>t+e+n+(r/2**32|0)|0,_f=(r,t,e,n)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0),ff=(r,t,e,n,i)=>t+e+n+i+(r/2**32|0)|0,mf=(r,t,e,n,i)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(i>>>0),yf=(r,t,e,n,i,s)=>t+e+n+i+s+(r/2**32|0)|0,_r=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function Js(r){return r instanceof Uint8Array||ArrayBuffer.isView(r)&&r.constructor.name==="Uint8Array"}function Rt(r){if(!Number.isSafeInteger(r)||r<0)throw new Error("positive integer expected, got "+r)}function tt(r,...t){if(!Js(r))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(r.length))throw new Error("Uint8Array expected of length "+t+", got length="+r.length)}function Zs(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Rt(r.outputLen),Rt(r.blockLen)}function Ft(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function Qs(r,t){tt(r);const e=t.outputLen;if(r.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function sn(r){return new Uint32Array(r.buffer,r.byteOffset,Math.floor(r.byteLength/4))}function rt(...r){for(let t=0;t<r.length;t++)r[t].fill(0)}function gi(r){return new DataView(r.buffer,r.byteOffset,r.byteLength)}function lt(r,t){return r<<32-t|r>>>t}const Il=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Al(r){return r<<24&4278190080|r<<8&16711680|r>>>8&65280|r>>>24&255}const bt=Il?r=>r:r=>Al(r);function wf(r){for(let t=0;t<r.length;t++)r[t]=Al(r[t]);return r}const Bt=Il?r=>r:wf,Tl=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",gf=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function on(r){if(tt(r),Tl)return r.toHex();let t="";for(let e=0;e<r.length;e++)t+=gf[r[e]];return t}const Et={_0:48,_9:57,A:65,F:70,a:97,f:102};function Xo(r){if(r>=Et._0&&r<=Et._9)return r-Et._0;if(r>=Et.A&&r<=Et.F)return r-(Et.A-10);if(r>=Et.a&&r<=Et.f)return r-(Et.a-10)}function Ys(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);if(Tl)return Uint8Array.fromHex(r);const t=r.length,e=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(e);for(let i=0,s=0;i<e;i++,s+=2){const o=Xo(r.charCodeAt(s)),c=Xo(r.charCodeAt(s+1));if(o===void 0||c===void 0){const l=r[s]+r[s+1];throw new Error('hex string expected, got non-hex character "'+l+'" at index '+s)}n[i]=o*16+c}return n}function Ef(r){if(typeof r!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(r))}function at(r){return typeof r=="string"&&(r=Ef(r)),tt(r),r}function er(...r){let t=0;for(let n=0;n<r.length;n++){const i=r[n];tt(i),t+=i.length}const e=new Uint8Array(t);for(let n=0,i=0;n<r.length;n++){const s=r[n];e.set(s,i),i+=s.length}return e}class ti{}function fn(r){const t=n=>r().update(at(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function vf(r){const t=(n,i)=>r(i).update(at(n)).digest(),e=r({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=n=>r(n),t}function Dr(r=32){if(_r&&typeof _r.getRandomValues=="function")return _r.getRandomValues(new Uint8Array(r));if(_r&&typeof _r.randomBytes=="function")return Uint8Array.from(_r.randomBytes(r));throw new Error("crypto.getRandomValues must be defined")}const bf=BigInt(0),$r=BigInt(1),If=BigInt(2),Af=BigInt(7),Tf=BigInt(256),Pf=BigInt(113),Pl=[],Ol=[],Rl=[];for(let r=0,t=$r,e=1,n=0;r<24;r++){[e,n]=[n,(2*e+3*n)%5],Pl.push(2*(5*n+e)),Ol.push((r+1)*(r+2)/2%64);let i=bf;for(let s=0;s<7;s++)t=(t<<$r^(t>>Af)*Pf)%Tf,t&If&&(i^=$r<<($r<<BigInt(s))-$r);Rl.push(i)}const Ll=bl(Rl,!0),Of=Ll[0],Rf=Ll[1],ea=(r,t,e)=>e>32?hf(r,t,e):uf(r,t,e),ta=(r,t,e)=>e>32?pf(r,t,e):df(r,t,e);function Lf(r,t=24){const e=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let o=0;o<10;o++)e[o]=r[o]^r[o+10]^r[o+20]^r[o+30]^r[o+40];for(let o=0;o<10;o+=2){const c=(o+8)%10,l=(o+2)%10,u=e[l],d=e[l+1],h=ea(u,d,1)^e[c],p=ta(u,d,1)^e[c+1];for(let _=0;_<50;_+=10)r[o+_]^=h,r[o+_+1]^=p}let i=r[2],s=r[3];for(let o=0;o<24;o++){const c=Ol[o],l=ea(i,s,c),u=ta(i,s,c),d=Pl[o];i=r[d],s=r[d+1],r[d]=l,r[d+1]=u}for(let o=0;o<50;o+=10){for(let c=0;c<10;c++)e[c]=r[o+c];for(let c=0;c<10;c++)r[o+c]^=~e[(c+2)%10]&e[(c+4)%10]}r[0]^=Of[n],r[1]^=Rf[n]}rt(e)}let Df=class Dl extends ti{constructor(t,e,n,i=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=i,this.rounds=s,Rt(n),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=sn(this.state)}clone(){return this._cloneInto()}keccak(){Bt(this.state32),Lf(this.state32,this.rounds),Bt(this.state32),this.posOut=0,this.pos=0}update(t){Ft(this),t=at(t),tt(t);const{blockLen:e,state:n}=this,i=t.length;for(let s=0;s<i;){const o=Math.min(e-this.pos,i-s);for(let c=0;c<o;c++)n[this.pos++]^=t[s++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:e,pos:n,blockLen:i}=this;t[n]^=e,e&128&&n===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){Ft(this,!1),tt(t),this.finish();const e=this.state,{blockLen:n}=this;for(let i=0,s=t.length;i<s;){this.posOut>=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);t.set(e.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Rt(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Qs(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,rt(this.state)}_cloneInto(t){const{blockLen:e,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return t||(t=new Dl(e,n,i,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=n,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}};const Vf=(r,t,e)=>fn(()=>new Df(t,r,e)),Sf=Vf(1,136,256/8);function xf(r,t,e,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(t,e,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(e>>i&s),c=Number(e&s),l=n?4:0,u=n?0:4;r.setUint32(t+l,o,n),r.setUint32(t+u,c,n)}function Cf(r,t,e){return r&t^~r&e}function $f(r,t,e){return r&t^r&e^t&e}let Vl=class extends ti{constructor(t,e,n,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=i,this.buffer=new Uint8Array(t),this.view=gi(this.buffer)}update(t){Ft(this),t=at(t),tt(t);const{view:e,buffer:n,blockLen:i}=this,s=t.length;for(let o=0;o<s;){const c=Math.min(i-this.pos,s-o);if(c===i){const l=gi(t);for(;i<=s-o;o+=i)this.process(l,o);continue}n.set(t.subarray(o,o+c),this.pos),this.pos+=c,o+=c,this.pos===i&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Ft(this),Qs(t,this),this.finished=!0;const{buffer:e,view:n,blockLen:i,isLE:s}=this;let{pos:o}=this;e[o++]=128,rt(this.buffer.subarray(o)),this.padOffset>i-o&&(this.process(n,0),o=0);for(let h=o;h<i;h++)e[h]=0;xf(n,i-8,BigInt(this.length*8),s),this.process(n,0);const c=gi(t),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=l/4,d=this.get();if(u>d.length)throw new Error("_sha2: outputLen bigger than state");for(let h=0;h<u;h++)c.setUint32(4*h,d[h],s)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:n,length:i,finished:s,destroyed:o,pos:c}=this;return t.destroyed=o,t.finished=s,t.length=i,t.pos=c,i%e&&t.buffer.set(n),t}clone(){return this._cloneInto()}};const Dt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Te=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),Pe=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),kf=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Vt=new Uint32Array(64);let Nf=class extends Vl{constructor(t=32){super(64,t,8,!1),this.A=Dt[0]|0,this.B=Dt[1]|0,this.C=Dt[2]|0,this.D=Dt[3]|0,this.E=Dt[4]|0,this.F=Dt[5]|0,this.G=Dt[6]|0,this.H=Dt[7]|0}get(){const{A:t,B:e,C:n,D:i,E:s,F:o,G:c,H:l}=this;return[t,e,n,i,s,o,c,l]}set(t,e,n,i,s,o,c,l){this.A=t|0,this.B=e|0,this.C=n|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=c|0,this.H=l|0}process(t,e){for(let h=0;h<16;h++,e+=4)Vt[h]=t.getUint32(e,!1);for(let h=16;h<64;h++){const p=Vt[h-15],_=Vt[h-2],f=lt(p,7)^lt(p,18)^p>>>3,m=lt(_,17)^lt(_,19)^_>>>10;Vt[h]=m+Vt[h-7]+f+Vt[h-16]|0}let{A:n,B:i,C:s,D:o,E:c,F:l,G:u,H:d}=this;for(let h=0;h<64;h++){const p=lt(c,6)^lt(c,11)^lt(c,25),_=d+p+Cf(c,l,u)+kf[h]+Vt[h]|0,f=(lt(n,2)^lt(n,13)^lt(n,22))+$f(n,i,s)|0;d=u,u=l,l=c,c=o+_|0,o=s,s=i,i=n,n=_+f|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,c=c+this.E|0,l=l+this.F|0,u=u+this.G|0,d=d+this.H|0,this.set(n,i,s,o,c,l,u,d)}roundClean(){rt(Vt)}destroy(){this.set(0,0,0,0,0,0,0,0),rt(this.buffer)}};const Sl=bl(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(r=>BigInt(r))),Uf=Sl[0],qf=Sl[1],St=new Uint32Array(80),xt=new Uint32Array(80);let Xs=class extends Vl{constructor(t=64){super(128,t,16,!1),this.Ah=Pe[0]|0,this.Al=Pe[1]|0,this.Bh=Pe[2]|0,this.Bl=Pe[3]|0,this.Ch=Pe[4]|0,this.Cl=Pe[5]|0,this.Dh=Pe[6]|0,this.Dl=Pe[7]|0,this.Eh=Pe[8]|0,this.El=Pe[9]|0,this.Fh=Pe[10]|0,this.Fl=Pe[11]|0,this.Gh=Pe[12]|0,this.Gl=Pe[13]|0,this.Hh=Pe[14]|0,this.Hl=Pe[15]|0}get(){const{Ah:t,Al:e,Bh:n,Bl:i,Ch:s,Cl:o,Dh:c,Dl:l,Eh:u,El:d,Fh:h,Fl:p,Gh:_,Gl:f,Hh:m,Hl:y}=this;return[t,e,n,i,s,o,c,l,u,d,h,p,_,f,m,y]}set(t,e,n,i,s,o,c,l,u,d,h,p,_,f,m,y){this.Ah=t|0,this.Al=e|0,this.Bh=n|0,this.Bl=i|0,this.Ch=s|0,this.Cl=o|0,this.Dh=c|0,this.Dl=l|0,this.Eh=u|0,this.El=d|0,this.Fh=h|0,this.Fl=p|0,this.Gh=_|0,this.Gl=f|0,this.Hh=m|0,this.Hl=y|0}process(t,e){for(let v=0;v<16;v++,e+=4)St[v]=t.getUint32(e),xt[v]=t.getUint32(e+=4);for(let v=16;v<80;v++){const P=St[v-15]|0,T=xt[v-15]|0,g=qt(P,T,1)^qt(P,T,8)^Qo(P,T,7),D=Mt(P,T,1)^Mt(P,T,8)^Yo(P,T,7),L=St[v-2]|0,w=xt[v-2]|0,E=qt(L,w,19)^Kr(L,w,61)^Qo(L,w,6),I=Mt(L,w,19)^Fr(L,w,61)^Yo(L,w,6),A=_f(D,I,xt[v-7],xt[v-16]),V=ff(A,g,E,St[v-7],St[v-16]);St[v]=V|0,xt[v]=A|0}let{Ah:n,Al:i,Bh:s,Bl:o,Ch:c,Cl:l,Dh:u,Dl:d,Eh:h,El:p,Fh:_,Fl:f,Gh:m,Gl:y,Hh:b,Hl:R}=this;for(let v=0;v<80;v++){const P=qt(h,p,14)^qt(h,p,18)^Kr(h,p,41),T=Mt(h,p,14)^Mt(h,p,18)^Fr(h,p,41),g=h&_^~h&m,D=p&f^~p&y,L=mf(R,T,D,qf[v],xt[v]),w=yf(L,b,P,g,Uf[v],St[v]),E=L|0,I=qt(n,i,28)^Kr(n,i,34)^Kr(n,i,39),A=Mt(n,i,28)^Fr(n,i,34)^Fr(n,i,39),V=n&s^n&c^s&c,O=i&o^i&l^o&l;b=m|0,R=y|0,m=_|0,y=f|0,_=h|0,f=p|0,{h,l:p}=st(u|0,d|0,w|0,E|0),u=c|0,d=l|0,c=s|0,l=o|0,s=n|0,o=i|0;const S=Hs(E,A,O);n=Gs(S,w,I,V),i=S|0}({h:n,l:i}=st(this.Ah|0,this.Al|0,n|0,i|0)),{h:s,l:o}=st(this.Bh|0,this.Bl|0,s|0,o|0),{h:c,l}=st(this.Ch|0,this.Cl|0,c|0,l|0),{h:u,l:d}=st(this.Dh|0,this.Dl|0,u|0,d|0),{h,l:p}=st(this.Eh|0,this.El|0,h|0,p|0),{h:_,l:f}=st(this.Fh|0,this.Fl|0,_|0,f|0),{h:m,l:y}=st(this.Gh|0,this.Gl|0,m|0,y|0),{h:b,l:R}=st(this.Hh|0,this.Hl|0,b|0,R|0),this.set(n,i,s,o,c,l,u,d,h,p,_,f,m,y,b,R)}roundClean(){rt(St,xt)}destroy(){rt(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},Mf=class extends Xs{constructor(){super(48),this.Ah=Te[0]|0,this.Al=Te[1]|0,this.Bh=Te[2]|0,this.Bl=Te[3]|0,this.Ch=Te[4]|0,this.Cl=Te[5]|0,this.Dh=Te[6]|0,this.Dl=Te[7]|0,this.Eh=Te[8]|0,this.El=Te[9]|0,this.Fh=Te[10]|0,this.Fl=Te[11]|0,this.Gh=Te[12]|0,this.Gl=Te[13]|0,this.Hh=Te[14]|0,this.Hl=Te[15]|0}};const Oe=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class Bf extends Xs{constructor(){super(32),this.Ah=Oe[0]|0,this.Al=Oe[1]|0,this.Bh=Oe[2]|0,this.Bl=Oe[3]|0,this.Ch=Oe[4]|0,this.Cl=Oe[5]|0,this.Dh=Oe[6]|0,this.Dl=Oe[7]|0,this.Eh=Oe[8]|0,this.El=Oe[9]|0,this.Fh=Oe[10]|0,this.Fl=Oe[11]|0,this.Gh=Oe[12]|0,this.Gl=Oe[13]|0,this.Hh=Oe[14]|0,this.Hl=Oe[15]|0}}const ri=fn(()=>new Nf),jf=fn(()=>new Xs),zf=fn(()=>new Mf),Kf=fn(()=>new Bf),Ff=Uint8Array.from([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9]),pe=Uint32Array.from([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),B=new Uint32Array(32);function Ct(r,t,e,n,i,s){const o=i[s],c=i[s+1];let l=B[2*r],u=B[2*r+1],d=B[2*t],h=B[2*t+1],p=B[2*e],_=B[2*e+1],f=B[2*n],m=B[2*n+1],y=Hs(l,d,o);u=Gs(y,u,h,c),l=y|0,{Dh:m,Dl:f}={Dh:m^u,Dl:f^l},{Dh:m,Dl:f}={Dh:cf(m,f),Dl:lf(m)},{h:_,l:p}=st(_,p,m,f),{Bh:h,Bl:d}={Bh:h^_,Bl:d^p},{Bh:h,Bl:d}={Bh:qt(h,d,24),Bl:Mt(h,d,24)},B[2*r]=l,B[2*r+1]=u,B[2*t]=d,B[2*t+1]=h,B[2*e]=p,B[2*e+1]=_,B[2*n]=f,B[2*n+1]=m}function $t(r,t,e,n,i,s){const o=i[s],c=i[s+1];let l=B[2*r],u=B[2*r+1],d=B[2*t],h=B[2*t+1],p=B[2*e],_=B[2*e+1],f=B[2*n],m=B[2*n+1],y=Hs(l,d,o);u=Gs(y,u,h,c),l=y|0,{Dh:m,Dl:f}={Dh:m^u,Dl:f^l},{Dh:m,Dl:f}={Dh:qt(m,f,16),Dl:Mt(m,f,16)},{h:_,l:p}=st(_,p,m,f),{Bh:h,Bl:d}={Bh:h^_,Bl:d^p},{Bh:h,Bl:d}={Bh:Kr(h,d,63),Bl:Fr(h,d,63)},B[2*r]=l,B[2*r+1]=u,B[2*t]=d,B[2*t+1]=h,B[2*e]=p,B[2*e+1]=_,B[2*n]=f,B[2*n+1]=m}function Wf(r,t={},e,n,i){if(Rt(e),r<0||r>e)throw new Error("outputLen bigger than keyLen");const{key:s,salt:o,personalization:c}=t;if(s!==void 0&&(s.length<1||s.length>e))throw new Error("key length must be undefined or 1.."+e);if(o!==void 0&&o.length!==n)throw new Error("salt must be undefined or "+n);if(c!==void 0&&c.length!==i)throw new Error("personalization must be undefined or "+i)}class Hf extends ti{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,this.length=0,this.pos=0,Rt(t),Rt(e),this.blockLen=t,this.outputLen=e,this.buffer=new Uint8Array(t),this.buffer32=sn(this.buffer)}update(t){Ft(this),t=at(t),tt(t);const{blockLen:e,buffer:n,buffer32:i}=this,s=t.length,o=t.byteOffset,c=t.buffer;for(let l=0;l<s;){this.pos===e&&(Bt(i),this.compress(i,0,!1),Bt(i),this.pos=0);const u=Math.min(e-this.pos,s-l),d=o+l;if(u===e&&!(d%4)&&l+u<s){const h=new Uint32Array(c,d,Math.floor((s-l)/4));Bt(h);for(let p=0;l+e<s;p+=i.length,l+=e)this.length+=e,this.compress(h,p,!1);Bt(h);continue}n.set(t.subarray(l,l+u),this.pos),this.pos+=u,this.length+=u,l+=u}return this}digestInto(t){Ft(this),Qs(t,this);const{pos:e,buffer32:n}=this;this.finished=!0,rt(this.buffer.subarray(e)),Bt(n),this.compress(n,0,!0),Bt(n);const i=sn(t);this.get().forEach((s,o)=>i[o]=bt(s))}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){const{buffer:e,length:n,finished:i,destroyed:s,outputLen:o,pos:c}=this;return t||(t=new this.constructor({dkLen:o})),t.set(...this.get()),t.buffer.set(e),t.destroyed=s,t.finished=i,t.length=n,t.pos=c,t.outputLen=o,t}clone(){return this._cloneInto()}}class Gf extends Hf{constructor(t={}){const e=t.dkLen===void 0?64:t.dkLen;super(128,e),this.v0l=pe[0]|0,this.v0h=pe[1]|0,this.v1l=pe[2]|0,this.v1h=pe[3]|0,this.v2l=pe[4]|0,this.v2h=pe[5]|0,this.v3l=pe[6]|0,this.v3h=pe[7]|0,this.v4l=pe[8]|0,this.v4h=pe[9]|0,this.v5l=pe[10]|0,this.v5h=pe[11]|0,this.v6l=pe[12]|0,this.v6h=pe[13]|0,this.v7l=pe[14]|0,this.v7h=pe[15]|0,Wf(e,t,64,16,16);let{key:n,personalization:i,salt:s}=t,o=0;if(n!==void 0&&(n=at(n),o=n.length),this.v0l^=this.outputLen|o<<8|65536|1<<24,s!==void 0){s=at(s);const c=sn(s);this.v4l^=bt(c[0]),this.v4h^=bt(c[1]),this.v5l^=bt(c[2]),this.v5h^=bt(c[3])}if(i!==void 0){i=at(i);const c=sn(i);this.v6l^=bt(c[0]),this.v6h^=bt(c[1]),this.v7l^=bt(c[2]),this.v7h^=bt(c[3])}if(n!==void 0){const c=new Uint8Array(this.blockLen);c.set(n),this.update(c)}}get(){let{v0l:t,v0h:e,v1l:n,v1h:i,v2l:s,v2h:o,v3l:c,v3h:l,v4l:u,v4h:d,v5l:h,v5h:p,v6l:_,v6h:f,v7l:m,v7h:y}=this;return[t,e,n,i,s,o,c,l,u,d,h,p,_,f,m,y]}set(t,e,n,i,s,o,c,l,u,d,h,p,_,f,m,y){this.v0l=t|0,this.v0h=e|0,this.v1l=n|0,this.v1h=i|0,this.v2l=s|0,this.v2h=o|0,this.v3l=c|0,this.v3h=l|0,this.v4l=u|0,this.v4h=d|0,this.v5l=h|0,this.v5h=p|0,this.v6l=_|0,this.v6h=f|0,this.v7l=m|0,this.v7h=y|0}compress(t,e,n){this.get().forEach((l,u)=>B[u]=l),B.set(pe,16);let{h:i,l:s}=vl(BigInt(this.length));B[24]=pe[8]^s,B[25]=pe[9]^i,n&&(B[28]=~B[28],B[29]=~B[29]);let o=0;const c=Ff;for(let l=0;l<12;l++)Ct(0,4,8,12,t,e+2*c[o++]),$t(0,4,8,12,t,e+2*c[o++]),Ct(1,5,9,13,t,e+2*c[o++]),$t(1,5,9,13,t,e+2*c[o++]),Ct(2,6,10,14,t,e+2*c[o++]),$t(2,6,10,14,t,e+2*c[o++]),Ct(3,7,11,15,t,e+2*c[o++]),$t(3,7,11,15,t,e+2*c[o++]),Ct(0,5,10,15,t,e+2*c[o++]),$t(0,5,10,15,t,e+2*c[o++]),Ct(1,6,11,12,t,e+2*c[o++]),$t(1,6,11,12,t,e+2*c[o++]),Ct(2,7,8,13,t,e+2*c[o++]),$t(2,7,8,13,t,e+2*c[o++]),Ct(3,4,9,14,t,e+2*c[o++]),$t(3,4,9,14,t,e+2*c[o++]);this.v0l^=B[0]^B[16],this.v0h^=B[1]^B[17],this.v1l^=B[2]^B[18],this.v1h^=B[3]^B[19],this.v2l^=B[4]^B[20],this.v2h^=B[5]^B[21],this.v3l^=B[6]^B[22],this.v3h^=B[7]^B[23],this.v4l^=B[8]^B[24],this.v4h^=B[9]^B[25],this.v5l^=B[10]^B[26],this.v5h^=B[11]^B[27],this.v6l^=B[12]^B[28],this.v6h^=B[13]^B[29],this.v7l^=B[14]^B[30],this.v7h^=B[15]^B[31],rt(B)}destroy(){this.destroyed=!0,rt(this.buffer32),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Jf=vf(r=>new Gf(r)),Zf="https://rpc.walletconnect.org/v1";function xl(r){const t=`Ethereum Signed Message:
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/get-ecosystem-wallet-info-3-CvIBpv.js","assets/thirdweb-B4uPXbkw.js","assets/ui-CSTbCQwk.js","assets/vendor-DahexbvH.js","assets/index-13DXQnYT.js","assets/index-BltYrK2m.css","assets/index.es-xpQlHN7l.js","assets/ethereum-CEHvWqGp.js","assets/index-CHDNpoUG.js","assets/hooks.module-MHgUT2ti.js","assets/clsx.m-DHulAg21.js","assets/index-iqDoByK8.js","assets/web-connector-DB6vmoMW.js","assets/index-BWLGPCDE.js","assets/send-eip712-transaction-C88HGddx.js","assets/controller-DyfP9sLB.js","assets/qr-overlay-JoNyL3_J.js","assets/getBalance-C-HFrUIb.js","assets/secp256k1-xSyt8XU9.js","assets/session-proposal-C0kfr8bU.js","assets/session-request-Bl3tqUKv.js","assets/in-app-wallet-calls-C6XORNPV.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{bD as Fu,bE as en,bF as wc,bG as ir,ac as Ve,Q as po,R as Wu,n as De,f as Q,F as Un,p as zt,bH as gc,_ as a,bI as cr,b as ge,aG as Ts,s as we,bJ as Ec,bK as vc,bL as bc,j as Ps,u as Os,t as Rs,Y as Ic,as as Yn,ak as Hu,x as Ls,al as Gu,a5 as Ju,b5 as Zu,h as Qu,v as Yu,i as Xu,bM as Ac,bN as ed,bO as td,aq as rd,ar as nd,bP as id,bQ as sd,l as Xn,bR as od,bS as Bi,an as Tc,bT as ad,bU as cd,bV as Ds,bW as Pc,bX as ld,N as Vs,bY as Oc,bZ as ud,b_ as _o,b$ as dd,P as hd,c0 as fo,c1 as pd,c2 as _d,c3 as fd,c4 as md,a1 as yd,g as wd,c5 as gd,c6 as mo,d as Ed,c7 as Rc,a9 as Lc,ab as dn,aa as Dc,c8 as vd,aT as bd,c9 as Id,ca as Gt,cb as Ad,a2 as Td,o as Pd,y as Od,J as Rd,cc as Ld,cd as Dd,ce as Vd}from"./thirdweb-B4uPXbkw.js";import{B as ee,g as K}from"./ui-CSTbCQwk.js";import{d6 as lr,d0 as Vc}from"./index-13DXQnYT.js";import{j as gn,b as qn,s as tn,d as Sd,k as xd,l as Cd,g as $d,e as kd,h as yo,r as Nd,I as Ar,m as Ud,n as et,t as ze,q,u as Ot,C as qd,v as Md,w as Hr,x as ji,y as hn,z as Bd,A as jd,B as zd,D as Kd,a as Nt,E as Tr,o as Fd,F as Wd,G as Ss,H as xs,f as Mn,P as wo,Q as Hd,J as Gd,K as Yt,c as Sc,L as vt,M as pt,N as Lt}from"./index.es-xpQlHN7l.js";import{e as Jd}from"./ethereum-CEHvWqGp.js";async function Be(r){const{client:t,ecosystem:e,walletType:n,walletAddress:i,chainId:s}=r;return Fu({client:t,data:{action:"connect",chainId:s,source:"connectWallet",walletAddress:i,walletType:n},ecosystem:e})}function Cs(r){const t=r.domain;return(t==null?void 0:t.chainId)!==void 0&&en(t.chainId)&&(r.domain={...r.domain,chainId:wc(r.domain.chainId)}),r}const Zd={"0x0":"reverted","0x1":"success"};function $s(r){var n;const[t,e]=(()=>{const i=r.status;return i>=100&&i<200?["pending",i]:i>=200&&i<300?["success",i]:i>=300&&i<700?["failure",i]:i==="CONFIRMED"?["success",200]:i==="PENDING"?["pending",100]:[void 0,i]})();return{...r,atomic:r.atomic,chainId:r.chainId?ir(r.chainId):void 0,receipts:((n=r.receipts)==null?void 0:n.map(i=>({...i,blockNumber:Ve(i.blockNumber),gasUsed:Ve(i.gasUsed),status:Zd[i.status]})))??[],status:t,statusCode:e,version:r.version}}function ks(r,t){const e={};for(const[n,i]of Object.entries(r)){e[Number(n)]={};const s={};for(const[o,c]of Object.entries(i))s[o]=c;e[Number(n)]=s}return typeof t=="number"?{[t]:e[t]}:e}async function Ns(r,t){const e=r.calls[0];if(!e)throw new Error("No calls to send");const{calls:n,capabilities:i,version:s="2.0.0",chain:o=e.chain}=r,c=await Promise.all(n.map(async u=>{const{to:d,value:h}=u;if(d===void 0&&u.data===void 0)throw new Error("Cannot send call, `to` or `data` must be provided.");const[p,_,f]=await Promise.all([po(d),Wu(u),po(h)]);return p?{data:_,to:Q(p),value:typeof f=="bigint"||typeof f=="number"?De(f):void 0}:{data:_,to:void 0,value:void 0}}));return{callParams:[{atomicRequired:r.atomicRequired??!1,calls:c,capabilities:i,chainId:De(o.id),from:Q(t.address),version:s}],chain:o}}function Us(r){return Qd(r).map(t=>{try{const e=new URL(t);return e.hostname.endsWith(".thirdweb.com")&&(e.pathname="",e.search=""),e.toString()}catch{return t}})}function Qd(r,t,e="http"){const n=[];for(const i of r.rpc)e==="http"&&!i.startsWith("http")||e==="ws"&&!i.startsWith("ws")||(i.includes("${THIRDWEB_API_KEY}")?n.push(i.replace("${THIRDWEB_API_KEY}","")):i.includes("${")||n.push(i));if(n.length===0)throw new Error(`No RPC available for chainId "${r.chainId}" with mode ${e}`);return n}function ct(r){return typeof r=="number"?r:Un(r)?ir(r):typeof r=="bigint"?Number(r):Number.parseInt(r,10)}function Yd(r){if(typeof window>"u")return;const t=e=>r(e.detail);return window.addEventListener("eip6963:announceProvider",t),window.dispatchEvent(new CustomEvent("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",t)}function Xd(){const r=new Set;let t=[];const e=()=>Yd(i=>{t.some(({info:s})=>s.uuid===i.info.uuid)||(t=[...t,i],r.forEach(s=>s(t,{added:[i]})))});let n=e();return{_listeners(){return r},clear(){r.forEach(i=>i([],{removed:[...t]})),t=[]},destroy(){this.clear(),r.clear(),n==null||n()},findProvider({rdns:i}){return t.find(s=>s.info.rdns===i)},getProviders(){return t},reset(){this.clear(),n==null||n(),n=e()},subscribe(i,{emitImmediately:s}={}){return r.add(i),s&&i(t,{added:t}),()=>r.delete(i)}}}function eh(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}function th(){return typeof zt<"u"&&typeof zt.versions<"u"&&typeof zt.versions.node<"u"}function xc(){return!eh()&&!th()}const _t="com.coinbase.wallet",Tt="org.base.account",Cc="io.metamask",rh="me.rainbow",nh="io.zerion.wallet",Bn={async getItem(r){try{if(typeof window<"u"&&window.localStorage)return localStorage.getItem(r)}catch{}return null},async removeItem(r){typeof window<"u"&&window.localStorage&&localStorage.removeItem(r)},async setItem(r,t){try{typeof window<"u"&&window.localStorage&&localStorage.setItem(r,t)}catch{}}};function qs(r){return r.startsWith("http://")||r.startsWith("https://")}function $c(r,t){if(!qs(r))return kc(r,t);let e=r;e.endsWith("/")||(e=`${e}/`);const n=encodeURIComponent(t);return{href:e,redirect:`${e}wc?uri=${n}`}}function kc(r,t){if(qs(r))return $c(r,t);let e=r;e.includes("://")||(e=r.replaceAll("/","").replaceAll(":",""),e=`${e}://`),e.endsWith("/")||(e=`${e}/`);const n=encodeURIComponent(t);return{href:e,redirect:`${e}wc?uri=${n}`}}function ih(r,t){return qs(r)?$c(r,t):kc(r,t)}function sh(){if(typeof navigator>"u")return!1;const r=gc(navigator.userAgent);return r?r.toLowerCase().includes("android"):!1}function oh(){if(typeof navigator>"u")return!1;const r=gc(navigator.userAgent);return r?r.toLowerCase().includes("ios")||r.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}function ah(){return typeof window>"u"||typeof navigator>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}function ch(){return typeof window>"u"?!1:"orientation"in window||"onorientationchange"in window}function go(){return!!(sh()||oh()||ah()&&ch()||typeof window<"u"&&window.innerWidth<640)}function hi(r){if(window!==window.top)window.open(r);else if(r.startsWith("http")){const e=document.createElement("a");e.href=r,e.target="_blank",e.rel="noreferrer noopener",e.click()}else window.location.href=r}function Pr(r){return typeof r=="string"?r.startsWith("ecosystem."):r.id.startsWith("ecosystem.")}async function Nc(r,t){if(Pr(r)){const{getEcosystemWalletInfo:e}=await a(async()=>{const{getEcosystemWalletInfo:n}=await import("./get-ecosystem-wallet-info-3-CvIBpv.js");return{getEcosystemWalletInfo:n}},__vite__mapDeps([0,1,2,3,4,5,6,7]));return t?e(r).then(n=>n.image_id):e(r)}switch(r){case"smart":return t?a(()=>import("./image-BnYtBA0B.js"),[]).then(e=>e.default):a(()=>import("./index-BuSavAVK.js"),[]).then(e=>e.wallet);case"inApp":return t?a(()=>import("./image-YhquT9-B.js"),[]).then(e=>e.default):a(()=>import("./index-B6yqoFuC.js"),[]).then(e=>e.wallet);case"walletConnect":return t?a(()=>import("./image-B3sWXgWp.js"),[]).then(e=>e.default):a(()=>import("./index-B21BIk0D.js"),[]).then(e=>e.wallet);case"embedded":return t?a(()=>import("./image-CE6B5igp.js"),[]).then(e=>e.default):a(()=>import("./index-CZfaBXw3.js"),[]).then(e=>e.wallet);case"adapter":return t?a(()=>import("./image-CaoCxndE.js"),[]).then(e=>e.default):a(()=>import("./index-DkPRLpmE.js"),[]).then(e=>e.wallet);case"io.1inch.wallet":return t?a(()=>import("./image-DcM8byf5.js"),[]).then(e=>e.default):a(()=>import("./index-B8SH8PS4.js"),[]).then(e=>e.wallet);case"com.binance.wallet":return t?a(()=>import("./image-B6woX8-F.js"),[]).then(e=>e.default):a(()=>import("./index-D1Wt1Kx7.js"),[]).then(e=>e.wallet);case"com.ledger":return t?a(()=>import("./image-CGobRsqC.js"),[]).then(e=>e.default):a(()=>import("./index-C63hJ0G0.js"),[]).then(e=>e.wallet);case"com.bitpay":return t?a(()=>import("./image-oGFA7lCe.js"),[]).then(e=>e.default):a(()=>import("./index-Bl6ScMn3.js"),[]).then(e=>e.wallet);case"com.bestwallet":return t?a(()=>import("./image-YzdSnFCd.js"),[]).then(e=>e.default):a(()=>import("./index-C_fnrq8t.js"),[]).then(e=>e.wallet);case"io.metamask":return t?a(()=>import("./image-rAE1A9js.js"),[]).then(e=>e.default):a(()=>import("./index-DaZnaClT.js"),[]).then(e=>e.wallet);case"com.trustwallet.app":return t?a(()=>import("./image-DhOOZChF.js"),[]).then(e=>e.default):a(()=>import("./index-9552Tb-C.js"),[]).then(e=>e.wallet);case"com.fireblocks":return t?a(()=>import("./image-C_rXI8lY.js"),[]).then(e=>e.default):a(()=>import("./index-fm1oF4Rd.js"),[]).then(e=>e.wallet);case"com.bitget.web3":return t?a(()=>import("./image-Cyu_SKNX.js"),[]).then(e=>e.default):a(()=>import("./index-7Xw6Dozy.js"),[]).then(e=>e.wallet);case"pro.tokenpocket":return t?a(()=>import("./image--EMjkbyZ.js"),[]).then(e=>e.default):a(()=>import("./index-C6d9DLRH.js"),[]).then(e=>e.wallet);case"com.safepal":return t?a(()=>import("./image-CPrfOTN2.js"),[]).then(e=>e.default):a(()=>import("./index-BKoDPf_i.js"),[]).then(e=>e.wallet);case"org.uniswap":return t?a(()=>import("./image-DzLDqqsm.js"),[]).then(e=>e.default):a(()=>import("./index-j8mIFeCA.js"),[]).then(e=>e.wallet);case"io.zerion.wallet":return t?a(()=>import("./image-CXpsLPxr.js"),[]).then(e=>e.default):a(()=>import("./index-CAYpPiIA.js"),[]).then(e=>e.wallet);case"com.elrond.maiar.wallet":return t?a(()=>import("./image-Zh059TUR.js"),[]).then(e=>e.default):a(()=>import("./index-CN99OAiz.js"),[]).then(e=>e.wallet);case"com.crypto.wallet":return t?a(()=>import("./image-BbeMBRJP.js"),[]).then(e=>e.default):a(()=>import("./index-DoeeKGAI.js"),[]).then(e=>e.wallet);case"com.bitcoin":return t?a(()=>import("./image-CIhcwJo_.js"),[]).then(e=>e.default):a(()=>import("./index-COFjg0BY.js"),[]).then(e=>e.wallet);case"com.bifrostwallet":return t?a(()=>import("./image-BJbq9ykO.js"),[]).then(e=>e.default):a(()=>import("./index-Cw9NGSPc.js"),[]).then(e=>e.wallet);case"jp.co.rakuten-wallet":return t?a(()=>import("./image-CkSdZpFq.js"),[]).then(e=>e.default):a(()=>import("./index-CU6dgzkA.js"),[]).then(e=>e.wallet);case"com.bybit":return t?a(()=>import("./image-CVPmP4Bl.js"),[]).then(e=>e.default):a(()=>import("./index-m0YDsCpu.js"),[]).then(e=>e.wallet);case"com.blockchain.login":return t?a(()=>import("./image-BvEJhPGs.js"),[]).then(e=>e.default):a(()=>import("./index-C8VMxu1Z.js"),[]).then(e=>e.wallet);case"io.trezor":return t?a(()=>import("./image-BQXnGJhx.js"),[]).then(e=>e.default):a(()=>import("./index-CDqfDzT6.js"),[]).then(e=>e.wallet);case"im.token":return t?a(()=>import("./image-ChDeiuh7.js"),[]).then(e=>e.default):a(()=>import("./index-iJWzlNVI.js"),[]).then(e=>e.wallet);case"global.safe":return t?a(()=>import("./image-B6ncW7rJ.js"),[]).then(e=>e.default):a(()=>import("./index-HPp1Id1p.js"),[]).then(e=>e.wallet);case"xyz.ctrl":return t?a(()=>import("./image-DsOpF0U0.js"),[]).then(e=>e.default):a(()=>import("./index-CW6lKp1A.js"),[]).then(e=>e.wallet);case"co.arculus":return t?a(()=>import("./image-CYFfk7g3.js"),[]).then(e=>e.default):a(()=>import("./index-s6ugJH3L.js"),[]).then(e=>e.wallet);case"com.roninchain.wallet":return t?a(()=>import("./image-BMgLTkFN.js"),[]).then(e=>e.default):a(()=>import("./index-caEr82M6.js"),[]).then(e=>e.wallet);case"com.okex.wallet":return t?a(()=>import("./image-Ck2fht2U.js"),[]).then(e=>e.default):a(()=>import("./index-CbEIEIEo.js"),[]).then(e=>e.wallet);case"com.wemixplay":return t?a(()=>import("./image-Dfhapk7_.js"),[]).then(e=>e.default):a(()=>import("./index-C8AQSvJD.js"),[]).then(e=>e.wallet);case"com.tangem":return t?a(()=>import("./image-xMsS8TDb.js"),[]).then(e=>e.default):a(()=>import("./index-CKXDw-uc.js"),[]).then(e=>e.wallet);case"com.exodus":return t?a(()=>import("./image-BULUy74S.js"),[]).then(e=>e.default):a(()=>import("./index-DszThTMl.js"),[]).then(e=>e.wallet);case"com.hashpack.wallet":return t?a(()=>import("./image-BFzDP99B.js"),[]).then(e=>e.default):a(()=>import("./index-wBbkQCZY.js"),[]).then(e=>e.wallet);case"id.co.pintu":return t?a(()=>import("./image-CsH_NRy-.js"),[]).then(e=>e.default):a(()=>import("./index-DHDm_YtM.js"),[]).then(e=>e.wallet);case"network.blackfort":return t?a(()=>import("./image-CTLwieHz.js"),[]).then(e=>e.default):a(()=>import("./index-DZRVQyzq.js"),[]).then(e=>e.wallet);case"com.wigwam.wallet":return t?a(()=>import("./image-xaEWk6k8.js"),[]).then(e=>e.default):a(()=>import("./index-BA0Hn6eE.js"),[]).then(e=>e.wallet);case"app.backpack":return t?a(()=>import("./image-YbQrvLSP.js"),[]).then(e=>e.default):a(()=>import("./index-B8BWAl26.js"),[]).then(e=>e.wallet);case"app.subwallet":return t?a(()=>import("./image-BdqmMP8T.js"),[]).then(e=>e.default):a(()=>import("./index-7C_yDnI4.js"),[]).then(e=>e.wallet);case"cc.avacus":return t?a(()=>import("./image-uGs9mRWl.js"),[]).then(e=>e.default):a(()=>import("./index-BFZxo6Jc.js"),[]).then(e=>e.wallet);case"me.rainbow":return t?a(()=>import("./image-DSGxNIm1.js"),[]).then(e=>e.default):a(()=>import("./index-3d3uK5Ax.js"),[]).then(e=>e.wallet);case"so.onekey.app.wallet":return t?a(()=>import("./image-CwaGmiHI.js"),[]).then(e=>e.default):a(()=>import("./index-CUEmD5dS.js"),[]).then(e=>e.wallet);case"me.haha":return t?a(()=>import("./image-Npe5Xkhl.js"),[]).then(e=>e.default):a(()=>import("./index-B7GQyWAF.js"),[]).then(e=>e.wallet);case"com.bee":return t?a(()=>import("./image-Sy6X7CtO.js"),[]).then(e=>e.default):a(()=>import("./index-CQ3aQg5G.js"),[]).then(e=>e.wallet);case"ag.jup":return t?a(()=>import("./image-BuqgjEJD.js"),[]).then(e=>e.default):a(()=>import("./index-D30RfPa1.js"),[]).then(e=>e.wallet);case"app.keplr":return t?a(()=>import("./image-DpeCw-px.js"),[]).then(e=>e.default):a(()=>import("./index-BnsE1W-S.js"),[]).then(e=>e.wallet);case"org.hot-labs":return t?a(()=>import("./image-DFf3lDA_.js"),[]).then(e=>e.default):a(()=>import("./index-DDwu-IMz.js"),[]).then(e=>e.wallet);case"com.dcentwallet":return t?a(()=>import("./image-CUPOo6zK.js"),[]).then(e=>e.default):a(()=>import("./index-Bm92iZMY.js"),[]).then(e=>e.wallet);case"com.kraken":return t?a(()=>import("./image-BP17CoHz.js"),[]).then(e=>e.default):a(()=>import("./index-BFGXqrJS.js"),[]).then(e=>e.wallet);case"com.kucoin":return t?a(()=>import("./image-JIl7mHMQ.js"),[]).then(e=>e.default):a(()=>import("./index-DRVDpxj6.js"),[]).then(e=>e.wallet);case"io.magiceden.wallet":return t?a(()=>import("./image-B7QIFAir.js"),[]).then(e=>e.default):a(()=>import("./index-DMTU8hfu.js"),[]).then(e=>e.wallet);case"com.tomi":return t?a(()=>import("./image-COwCE3RO.js"),[]).then(e=>e.default):a(()=>import("./index-C7njqxXR.js"),[]).then(e=>e.wallet);case"io.ibvm":return t?a(()=>import("./image-CVBI4BwD.js"),[]).then(e=>e.default):a(()=>import("./index-HzSvsrak.js"),[]).then(e=>e.wallet);case"com.mewwallet":return t?a(()=>import("./image-Dx4ya6_y.js"),[]).then(e=>e.default):a(()=>import("./index-DEzKWTBJ.js"),[]).then(e=>e.wallet);case"com.socios.app":return t?a(()=>import("./image-COKP1J8V.js"),[]).then(e=>e.default):a(()=>import("./index-D06ftJGd.js"),[]).then(e=>e.wallet);case"xyz.argent":return t?a(()=>import("./image-5mReG_-1.js"),[]).then(e=>e.default):a(()=>import("./index-CQPZVLgk.js"),[]).then(e=>e.wallet);case"org.thorwallet":return t?a(()=>import("./image-Dmp2jTO0.js"),[]).then(e=>e.default):a(()=>import("./index-NO3dCFlG.js"),[]).then(e=>e.wallet);case"io.internetmoney":return t?a(()=>import("./image-D4PYvYqY.js"),[]).then(e=>e.default):a(()=>import("./index-BZwq4W5O.js"),[]).then(e=>e.wallet);case"org.mathwallet":return t?a(()=>import("./image-mMy4SSmg.js"),[]).then(e=>e.default):a(()=>import("./index-lGNYNhMi.js"),[]).then(e=>e.wallet);case"io.cypherhq":return t?a(()=>import("./image-B14TCFf5.js"),[]).then(e=>e.default):a(()=>import("./index-yURkkC3L.js"),[]).then(e=>e.wallet);case"io.novawallet":return t?a(()=>import("./image-DDso8kuB.js"),[]).then(e=>e.default):a(()=>import("./index-C91aPf2g.js"),[]).then(e=>e.wallet);case"io.yowallet":return t?a(()=>import("./image-Bx8buncY.js"),[]).then(e=>e.default):a(()=>import("./index-B062fuzr.js"),[]).then(e=>e.wallet);case"com.flowfoundation.wallet":return t?a(()=>import("./image-Da2xkAVi.js"),[]).then(e=>e.default):a(()=>import("./index-CBVJzm96.js"),[]).then(e=>e.wallet);case"app.kabila":return t?a(()=>import("./image-B-l20wIO.js"),[]).then(e=>e.default):a(()=>import("./index-cTRIo3rN.js"),[]).then(e=>e.wallet);case"com.opera":return t?a(()=>import("./image-sDrIF89f.js"),[]).then(e=>e.default):a(()=>import("./index-lIOVfT2m.js"),[]).then(e=>e.wallet);case"com.valoraapp":return t?a(()=>import("./image-5QXPaavh.js"),[]).then(e=>e.default):a(()=>import("./index-C6baQHax.js"),[]).then(e=>e.wallet);case"com.robinhood.wallet":return t?a(()=>import("./image-DBehogZh.js"),[]).then(e=>e.default):a(()=>import("./index-bzH6W7xo.js"),[]).then(e=>e.wallet);case"com.chain":return t?a(()=>import("./image-qsAyF5Oj.js"),[]).then(e=>e.default):a(()=>import("./index-npRlG_V2.js"),[]).then(e=>e.wallet);case"io.huddln":return t?a(()=>import("./image-CQm90J-d.js"),[]).then(e=>e.default):a(()=>import("./index-DILut-jL.js"),[]).then(e=>e.wallet);case"app.core.extension":return t?a(()=>import("./image-De2xpum1.js"),[]).then(e=>e.default):a(()=>import("./index-BtfbjCVr.js"),[]).then(e=>e.wallet);case"world.freedom":return t?a(()=>import("./image-COnY36UD.js"),[]).then(e=>e.default):a(()=>import("./index-BZUSQkq9.js"),[]).then(e=>e.wallet);case"money.unstoppable":return t?a(()=>import("./image-Bvw8wNRu.js"),[]).then(e=>e.default):a(()=>import("./index-CW8D5Pv5.js"),[]).then(e=>e.wallet);case"pk.modular":return t?a(()=>import("./image-CaHdVXd1.js"),[]).then(e=>e.default):a(()=>import("./index-1CA6ps09.js"),[]).then(e=>e.wallet);case"app.wombat":return t?a(()=>import("./image-ExeF69qZ.js"),[]).then(e=>e.default):a(()=>import("./index-D9Jrno_D.js"),[]).then(e=>e.wallet);case"com.klipwallet":return t?a(()=>import("./image-8vXf4Xjy.js"),[]).then(e=>e.default):a(()=>import("./index-CcNQ53IV.js"),[]).then(e=>e.wallet);case"com.gemwallet":return t?a(()=>import("./image-M7TV7WaH.js"),[]).then(e=>e.default):a(()=>import("./index-BtZsXMJj.js"),[]).then(e=>e.wallet);case"com.sabay.wallet":return t?a(()=>import("./image-CsNgSbbt.js"),[]).then(e=>e.default):a(()=>import("./index-BVAmxcaa.js"),[]).then(e=>e.wallet);case"com.zengo":return t?a(()=>import("./image-DNtaIeSw.js"),[]).then(e=>e.default):a(()=>import("./index-DDk7D3eE.js"),[]).then(e=>e.wallet);case"xyz.joeywallet":return t?a(()=>import("./image-CTsHGgDx.js"),[]).then(e=>e.default):a(()=>import("./index-Im6F3t68.js"),[]).then(e=>e.wallet);case"io.tokoin":return t?a(()=>import("./image-DQzzFCs2.js"),[]).then(e=>e.default):a(()=>import("./index-Bwjy4Jw7.js"),[]).then(e=>e.wallet);case"io.alpha-u.wallet.web":return t?a(()=>import("./image-DLiMUWBI.js"),[]).then(e=>e.default):a(()=>import("./index-DFt1vT8N.js"),[]).then(e=>e.wallet);case"network.cvl":return t?a(()=>import("./image-CtZg2vKX.js"),[]).then(e=>e.default):a(()=>import("./index-D2vPh3Mc.js"),[]).then(e=>e.wallet);case"io.leapwallet":return t?a(()=>import("./image-DHnnMCFG.js"),[]).then(e=>e.default):a(()=>import("./index-BdkJrfxl.js"),[]).then(e=>e.wallet);case"io.xenea":return t?a(()=>import("./image-B5ZxW0VG.js"),[]).then(e=>e.default):a(()=>import("./index-C8mAROh2.js"),[]).then(e=>e.wallet);case"com.oasys-wallet":return t?a(()=>import("./image-W7SfqKZe.js"),[]).then(e=>e.default):a(()=>import("./index-gQ8zpnGO.js"),[]).then(e=>e.wallet);case"com.bitso":return t?a(()=>import("./image-LfonVSeq.js"),[]).then(e=>e.default):a(()=>import("./index-YcqLCtWD.js"),[]).then(e=>e.wallet);case"io.enjin":return t?a(()=>import("./image-BnXzDKuV.js"),[]).then(e=>e.default):a(()=>import("./index-Jmrm9oUu.js"),[]).then(e=>e.wallet);case"com.coldwallet":return t?a(()=>import("./image-CVrpZdwi.js"),[]).then(e=>e.default):a(()=>import("./index-CkqupmC6.js"),[]).then(e=>e.wallet);case"org.creditcoin.app":return t?a(()=>import("./image-CzL8n4ZU.js"),[]).then(e=>e.default):a(()=>import("./index-B94SpzOt.js"),[]).then(e=>e.wallet);case"app.everspace":return t?a(()=>import("./image-ripXpF5P.js"),[]).then(e=>e.default):a(()=>import("./index-COlGaDkw.js"),[]).then(e=>e.wallet);case"app.zeal":return t?a(()=>import("./image-hO8Jv2oh.js"),[]).then(e=>e.default):a(()=>import("./index-B6n-vVE0.js"),[]).then(e=>e.wallet);case"app.whitewallet":return t?a(()=>import("./image-D7wXb0Un.js"),[]).then(e=>e.default):a(()=>import("./index-SCBLsVUL.js"),[]).then(e=>e.wallet);case"ai.purewallet":return t?a(()=>import("./image-K1HoU8Qi.js"),[]).then(e=>e.default):a(()=>import("./index-DZ2hd5eC.js"),[]).then(e=>e.wallet);case"com.fastex.wallet":return t?a(()=>import("./image-lBIlUHFP.js"),[]).then(e=>e.default):a(()=>import("./index-CMzQk3O6.js"),[]).then(e=>e.wallet);case"io.kriptomat":return t?a(()=>import("./image-6ouyxZRt.js"),[]).then(e=>e.default):a(()=>import("./index-wk2CJ7i5.js"),[]).then(e=>e.wallet);case"com.ullapay":return t?a(()=>import("./image-Bn2sAgXJ.js"),[]).then(e=>e.default):a(()=>import("./index-D_d6gemZ.js"),[]).then(e=>e.wallet);case"io.atomicwallet":return t?a(()=>import("./image-D55LvXjp.js"),[]).then(e=>e.default):a(()=>import("./index-DEV4egrN.js"),[]).then(e=>e.wallet);case"com.pionewallet":return t?a(()=>import("./image-B_0Cqkss.js"),[]).then(e=>e.default):a(()=>import("./index-BogX5ITG.js"),[]).then(e=>e.wallet);case"io.oxalus":return t?a(()=>import("./image-DTa4RXUa.js"),[]).then(e=>e.default):a(()=>import("./index-CuQBw1y6.js"),[]).then(e=>e.wallet);case"xyz.uniultra.wallet":return t?a(()=>import("./image-BSLjXnNe.js"),[]).then(e=>e.default):a(()=>import("./index-CJYo3Znz.js"),[]).then(e=>e.wallet);case"xyz.frontier.wallet":return t?a(()=>import("./image-Bdtwdp85.js"),[]).then(e=>e.default):a(()=>import("./index--YTVamH2.js"),[]).then(e=>e.wallet);case"com.coolbitx.cwsapp":return t?a(()=>import("./image-DWR067hG.js"),[]).then(e=>e.default):a(()=>import("./index-tkvX3w1X.js"),[]).then(e=>e.wallet);case"org.gooddollar":return t?a(()=>import("./image-y3eCNAT6.js"),[]).then(e=>e.default):a(()=>import("./index-C7N44kNF.js"),[]).then(e=>e.wallet);case"com.cakewallet":return t?a(()=>import("./image-BqQffU2u.js"),[]).then(e=>e.default):a(()=>import("./index-DPCPDLBT.js"),[]).then(e=>e.wallet);case"com.ellipal":return t?a(()=>import("./image-vuuCn07N.js"),[]).then(e=>e.default):a(()=>import("./index-jTpsrMvb.js"),[]).then(e=>e.wallet);case"app.krystal":return t?a(()=>import("./image-C2QANSRr.js"),[]).then(e=>e.default):a(()=>import("./index-B7dAHFam.js"),[]).then(e=>e.wallet);case"com.monarchwallet":return t?a(()=>import("./image-BNA4BP9T.js"),[]).then(e=>e.default):a(()=>import("./index-C7WD5W_Z.js"),[]).then(e=>e.wallet);case"com.burritowallet":return t?a(()=>import("./image-BI-5Z38o.js"),[]).then(e=>e.default):a(()=>import("./index-DpRqa1iX.js"),[]).then(e=>e.wallet);case"co.family.wallet":return t?a(()=>import("./image-CECsJh3H.js"),[]).then(e=>e.default):a(()=>import("./index-DrzmRQ9S.js"),[]).then(e=>e.wallet);case"com.mtpelerin":return t?a(()=>import("./image-BDOqiI6p.js"),[]).then(e=>e.default):a(()=>import("./index-bQArImNA.js"),[]).then(e=>e.wallet);case"app.keyring":return t?a(()=>import("./image-BH6pi8gb.js"),[]).then(e=>e.default):a(()=>import("./index-DLGneTkB.js"),[]).then(e=>e.wallet);case"cc.localtrade.lab":return t?a(()=>import("./image-DRqNpoe6.js"),[]).then(e=>e.default):a(()=>import("./index-D-qw7id5.js"),[]).then(e=>e.wallet);case"tech.okto":return t?a(()=>import("./image-uk4MysVY.js"),[]).then(e=>e.default):a(()=>import("./index-C5ZfEOey.js"),[]).then(e=>e.wallet);case"com.xcapit":return t?a(()=>import("./image-BjFjHCOg.js"),[]).then(e=>e.default):a(()=>import("./index-DbAxetvE.js"),[]).then(e=>e.wallet);case"com.gayawallet":return t?a(()=>import("./image-DC9Wj56E.js"),[]).then(e=>e.default):a(()=>import("./index-D4VnhuTS.js"),[]).then(e=>e.wallet);case"app.nightly":return t?a(()=>import("./image-Bv8VGwx8.js"),[]).then(e=>e.default):a(()=>import("./index-uM5GtqSd.js"),[]).then(e=>e.wallet);case"com.coin98":return t?a(()=>import("./image-Co9P7WAh.js"),[]).then(e=>e.default):a(()=>import("./index-CxBkKx5Q.js"),[]).then(e=>e.wallet);case"xyz.coca":return t?a(()=>import("./image-DaxrbegS.js"),[]).then(e=>e.default):a(()=>import("./index-CAfHv9Ye.js"),[]).then(e=>e.wallet);case"app.linen":return t?a(()=>import("./image-CljvD_on.js"),[]).then(e=>e.default):a(()=>import("./index-DTPO88lj.js"),[]).then(e=>e.wallet);case"dev.auroracloud":return t?a(()=>import("./image-BbwfB3J_.js"),[]).then(e=>e.default):a(()=>import("./index-DqYjD_64.js"),[]).then(e=>e.wallet);case"com.coinomi":return t?a(()=>import("./image-CyezMyAx.js"),[]).then(e=>e.default):a(()=>import("./index-B-oXIR8J.js"),[]).then(e=>e.wallet);case"my.mone":return t?a(()=>import("./image-B7h27Vsd.js"),[]).then(e=>e.default):a(()=>import("./index-3jJtZlGN.js"),[]).then(e=>e.wallet);case"org.alephium":return t?a(()=>import("./image-DDUR5y02.js"),[]).then(e=>e.default):a(()=>import("./index-CRTSSeuy.js"),[]).then(e=>e.wallet);case"com.alicebob":return t?a(()=>import("./image-BKjOwOZU.js"),[]).then(e=>e.default):a(()=>import("./index-DYiL0IsZ.js"),[]).then(e=>e.wallet);case"io.koalawallet":return t?a(()=>import("./image-CTAbQz5j.js"),[]).then(e=>e.default):a(()=>import("./index-DPXkoJXK.js"),[]).then(e=>e.wallet);case"com.veworld":return t?a(()=>import("./image-DKBlkqWK.js"),[]).then(e=>e.default):a(()=>import("./index-DV2Q2KhC.js"),[]).then(e=>e.wallet);case"com.withpaper":return t?a(()=>import("./image-DbBiNCFK.js"),[]).then(e=>e.default):a(()=>import("./index-CExunyqd.js"),[]).then(e=>e.wallet);case"io.noone":return t?a(()=>import("./image-CwDXHpUj.js"),[]).then(e=>e.default):a(()=>import("./index-BEFk-36A.js"),[]).then(e=>e.wallet);case"network.haqq":return t?a(()=>import("./image-BaRuJqy0.js"),[]).then(e=>e.default):a(()=>import("./index--t3K2suC.js"),[]).then(e=>e.wallet);case"io.ricewallet":return t?a(()=>import("./image-CmVMIVLM.js"),[]).then(e=>e.default):a(()=>import("./index-C_j7AjFr.js"),[]).then(e=>e.wallet);case"me.iopay":return t?a(()=>import("./image-CMJsc-Ir.js"),[]).then(e=>e.default):a(()=>import("./index-bsKYZmcs.js"),[]).then(e=>e.wallet);case"app.walletnow":return t?a(()=>import("./image-CmkiYZaU.js"),[]).then(e=>e.default):a(()=>import("./index-C_C9JdoE.js"),[]).then(e=>e.wallet);case"io.okse":return t?a(()=>import("./image-CZ9z1ucT.js"),[]).then(e=>e.default):a(()=>import("./index-_a8zNWKv.js"),[]).then(e=>e.wallet);case"network.over":return t?a(()=>import("./image-Cq54pcgl.js"),[]).then(e=>e.default):a(()=>import("./index-BDifUsn3.js"),[]).then(e=>e.wallet);case"com.aktionariat":return t?a(()=>import("./image-Cc6jyxLi.js"),[]).then(e=>e.default):a(()=>import("./index-Pw2thZ4h.js"),[]).then(e=>e.wallet);case"com.paybolt":return t?a(()=>import("./image-cwzgrAkh.js"),[]).then(e=>e.default):a(()=>import("./index-BxqRct_I.js"),[]).then(e=>e.wallet);case"com.plasma-wallet":return t?a(()=>import("./image-BVO9IT_6.js"),[]).then(e=>e.default):a(()=>import("./index-fiGpKN6W.js"),[]).then(e=>e.wallet);case"org.bytebank":return t?a(()=>import("./image-BP2Ox9Qn.js"),[]).then(e=>e.default):a(()=>import("./index-S5s6rAc3.js"),[]).then(e=>e.wallet);case"io.ethermail":return t?a(()=>import("./image-Duck5tqn.js"),[]).then(e=>e.default):a(()=>import("./index-BoCHG1VO.js"),[]).then(e=>e.wallet);case"com.optowallet":return t?a(()=>import("./image-W-Y_Nm-s.js"),[]).then(e=>e.default):a(()=>import("./index-BP-yDgcx.js"),[]).then(e=>e.wallet);case"finance.openwallet":return t?a(()=>import("./image-M_AWRaKs.js"),[]).then(e=>e.default):a(()=>import("./index-Cv59xn6_.js"),[]).then(e=>e.wallet);case"xyz.sequence":return t?a(()=>import("./image-o3pjQDbu.js"),[]).then(e=>e.default):a(()=>import("./index-D7Gl-ZGb.js"),[]).then(e=>e.wallet);case"com.foxwallet":return t?a(()=>import("./image-DcX8AUYd.js"),[]).then(e=>e.default):a(()=>import("./index-BARF52iT.js"),[]).then(e=>e.wallet);case"app.hbwallet":return t?a(()=>import("./image-BlogSp8o.js"),[]).then(e=>e.default):a(()=>import("./index-CW58bOV7.js"),[]).then(e=>e.wallet);case"it.airgap":return t?a(()=>import("./image-5CGX_QL3.js"),[]).then(e=>e.default):a(()=>import("./index-YDG1R00C.js"),[]).then(e=>e.wallet);case"com.holdstation":return t?a(()=>import("./image-BcNLqzB4.js"),[]).then(e=>e.default):a(()=>import("./index-9Ml23qSY.js"),[]).then(e=>e.wallet);case"io.universaleverything":return t?a(()=>import("./image-D3z3GjMO.js"),[]).then(e=>e.default):a(()=>import("./index-qmNRbp6W.js"),[]).then(e=>e.wallet);case"com.abra":return t?a(()=>import("./image-CCgX-pcz.js"),[]).then(e=>e.default):a(()=>import("./index-_36_A-pH.js"),[]).then(e=>e.wallet);case"org.thepulsewallet":return t?a(()=>import("./image-BxfO9qDl.js"),[]).then(e=>e.default):a(()=>import("./index-DgNvhZ_M.js"),[]).then(e=>e.wallet);case"com.premanft":return t?a(()=>import("./image-pKZ5ApxC.js"),[]).then(e=>e.default):a(()=>import("./index-CbGJyo5C.js"),[]).then(e=>e.wallet);case"xyz.timelesswallet":return t?a(()=>import("./image-DUs_WIFe.js"),[]).then(e=>e.default):a(()=>import("./index-WXvxLSve.js"),[]).then(e=>e.wallet);case"org.bitizen":return t?a(()=>import("./image-TQ3Nh_VF.js"),[]).then(e=>e.default):a(()=>import("./index-Db_DlPJs.js"),[]).then(e=>e.wallet);case"app.ultimate":return t?a(()=>import("./image-ClyvBbEv.js"),[]).then(e=>e.default):a(()=>import("./index-D2Z8_AUU.js"),[]).then(e=>e.wallet);case"io.compasswallet":return t?a(()=>import("./image-D6x5dtDG.js"),[]).then(e=>e.default):a(()=>import("./index-2qmxPQhP.js"),[]).then(e=>e.wallet);case"app.fizzwallet":return t?a(()=>import("./image-E3PT44xu.js"),[]).then(e=>e.default):a(()=>import("./index-DAYuEFQ-.js"),[]).then(e=>e.wallet);case"com.xovawallet":return t?a(()=>import("./image-B02ECgsY.js"),[]).then(e=>e.default):a(()=>import("./index-Bap5Lkty.js"),[]).then(e=>e.wallet);case"app.nicegram":return t?a(()=>import("./image-DH5ootHk.js"),[]).then(e=>e.default):a(()=>import("./index-BEXV42kp.js"),[]).then(e=>e.wallet);case"io.zelcore":return t?a(()=>import("./image-CLUlwzEU.js"),[]).then(e=>e.default):a(()=>import("./index-BLO6pY9b.js"),[]).then(e=>e.wallet);case"app.freighter":return t?a(()=>import("./image-BanazMP9.js"),[]).then(e=>e.default):a(()=>import("./index-CcdGs50g.js"),[]).then(e=>e.wallet);case"app.stickey":return t?a(()=>import("./image-_t2-K1ZP.js"),[]).then(e=>e.default):a(()=>import("./index-Cu2rQjR7.js"),[]).then(e=>e.wallet);case"app.coinstats":return t?a(()=>import("./image-BlZLdRma.js"),[]).then(e=>e.default):a(()=>import("./index-j8xu_BhO.js"),[]).then(e=>e.wallet);case"io.harti":return t?a(()=>import("./image-Xfz-LkLu.js"),[]).then(e=>e.default):a(()=>import("./index-DPhI9JUn.js"),[]).then(e=>e.wallet);case"io.dttd":return t?a(()=>import("./image-pEGSGt6h.js"),[]).then(e=>e.default):a(()=>import("./index-CXYI0OjH.js"),[]).then(e=>e.wallet);case"com.tellaw":return t?a(()=>import("./image-sm-_D7TO.js"),[]).then(e=>e.default):a(()=>import("./index-Ddqy22qU.js"),[]).then(e=>e.wallet);case"io.klever":return t?a(()=>import("./image-BBFbQZtc.js"),[]).then(e=>e.default):a(()=>import("./index-BJAcAgB9.js"),[]).then(e=>e.wallet);case"com.unstoppabledomains":return t?a(()=>import("./image-EUVXQieb.js"),[]).then(e=>e.default):a(()=>import("./index-B1XrJIPH.js"),[]).then(e=>e.wallet);case"is.callback":return t?a(()=>import("./image-Mf3UQvEC.js"),[]).then(e=>e.default):a(()=>import("./index-DTtDhdi2.js"),[]).then(e=>e.wallet);case"ai.pundi":return t?a(()=>import("./image-9BTuaiXb.js"),[]).then(e=>e.default):a(()=>import("./index-Ca7jbqnT.js"),[]).then(e=>e.wallet);case"io.summonersarena":return t?a(()=>import("./image-3-p5LJAk.js"),[]).then(e=>e.default):a(()=>import("./index-ovz39Egy.js"),[]).then(e=>e.wallet);case"io.fizen":return t?a(()=>import("./image-CZLdphQJ.js"),[]).then(e=>e.default):a(()=>import("./index-WwjGYjHa.js"),[]).then(e=>e.wallet);case"fi.pillar":return t?a(()=>import("./image-CVAbhfmI.js"),[]).then(e=>e.default):a(()=>import("./index-BFJUkm8C.js"),[]).then(e=>e.wallet);case"world.ixo":return t?a(()=>import("./image-CsTNl20e.js"),[]).then(e=>e.default):a(()=>import("./index-C-A1j44m.js"),[]).then(e=>e.wallet);case"org.thetatoken":return t?a(()=>import("./image-BstOz2Sd.js"),[]).then(e=>e.default):a(()=>import("./index-BlU4B6pe.js"),[]).then(e=>e.wallet);case"net.gateweb3":return t?a(()=>import("./image-CypdirPa.js"),[]).then(e=>e.default):a(()=>import("./index-BkM7PWkU.js"),[]).then(e=>e.wallet);case"app.ammer":return t?a(()=>import("./image-BfGkQCHU.js"),[]).then(e=>e.default):a(()=>import("./index-C0HCn7GN.js"),[]).then(e=>e.wallet);case"us.binance":return t?a(()=>import("./image-DgkgLcDL.js"),[]).then(e=>e.default):a(()=>import("./index-BuhGQjsZ.js"),[]).then(e=>e.wallet);case"io.yusetoken":return t?a(()=>import("./image-CSAN5rKt.js"),[]).then(e=>e.default):a(()=>import("./index-DQ8_v09O.js"),[]).then(e=>e.wallet);case"co.muza":return t?a(()=>import("./image-CRsMfPT0.js"),[]).then(e=>e.default):a(()=>import("./index-5IpGHzAv.js"),[]).then(e=>e.wallet);case"io.hyperpay":return t?a(()=>import("./image-D8scG8aP.js"),[]).then(e=>e.default):a(()=>import("./index-BXZiXU-9.js"),[]).then(e=>e.wallet);case"io.cosmostation":return t?a(()=>import("./image-BYUgGshq.js"),[]).then(e=>e.default):a(()=>import("./index-RiIluuCN.js"),[]).then(e=>e.wallet);case"app.ryipay":return t?a(()=>import("./image-oKct0i27.js"),[]).then(e=>e.default):a(()=>import("./index-CdvxolxE.js"),[]).then(e=>e.wallet);case"io.wallet3":return t?a(()=>import("./image-DJLc6AlW.js"),[]).then(e=>e.default):a(()=>import("./index-C_5dy4gh.js"),[]).then(e=>e.wallet);case"org.dota168":return t?a(()=>import("./image-D3VAu6BC.js"),[]).then(e=>e.default):a(()=>import("./index-BP76iXI2.js"),[]).then(e=>e.wallet);case"com.bitpie":return t?a(()=>import("./image-BUsH-M52.js"),[]).then(e=>e.default):a(()=>import("./index-BKN05ia6.js"),[]).then(e=>e.wallet);case"com.coininn":return t?a(()=>import("./image-B_AAvjJY.js"),[]).then(e=>e.default):a(()=>import("./index-l2eJJ7mG.js"),[]).then(e=>e.wallet);case"me.easy":return t?a(()=>import("./image-BjKXKIhU.js"),[]).then(e=>e.default):a(()=>import("./index-4WvPsM5O.js"),[]).then(e=>e.wallet);case"io.shido":return t?a(()=>import("./image-BGZ2pFmO.js"),[]).then(e=>e.default):a(()=>import("./index-SaOy8OjI.js"),[]).then(e=>e.wallet);case"com.neonwallet":return t?a(()=>import("./image-D2051qUc.js"),[]).then(e=>e.default):a(()=>import("./index-CUJUgO36.js"),[]).then(e=>e.wallet);case"com.secuxtech":return t?a(()=>import("./image-DHHZDLK-.js"),[]).then(e=>e.default):a(()=>import("./index-D1G_5OyD.js"),[]).then(e=>e.wallet);case"com.unitywallet":return t?a(()=>import("./image-BqmT5urK.js"),[]).then(e=>e.default):a(()=>import("./index-BqxSKkSq.js"),[]).then(e=>e.wallet);case"io.miraiapp":return t?a(()=>import("./image-Bi1elmSL.js"),[]).then(e=>e.default):a(()=>import("./index-D0rQT1_1.js"),[]).then(e=>e.wallet);case"com.beexo":return t?a(()=>import("./image-MGwelZJS.js"),[]).then(e=>e.default):a(()=>import("./index-Bbv-4GNB.js"),[]).then(e=>e.wallet);case"social.halo":return t?a(()=>import("./image-CbnSXqJS.js"),[]).then(e=>e.default):a(()=>import("./index-KpPak-wu.js"),[]).then(e=>e.wallet);case"com.gemspocket":return t?a(()=>import("./image-DpGIEKrK.js"),[]).then(e=>e.default):a(()=>import("./index-RpXAvNRL.js"),[]).then(e=>e.wallet);case"app.status":return t?a(()=>import("./image-9509MPsE.js"),[]).then(e=>e.default):a(()=>import("./index-DLMSD3H_.js"),[]).then(e=>e.wallet);case"com.midoin":return t?a(()=>import("./image-BocNs9ze.js"),[]).then(e=>e.default):a(()=>import("./index-CrBWjlui.js"),[]).then(e=>e.wallet);case"id.competence":return t?a(()=>import("./image-CaqftHzf.js"),[]).then(e=>e.default):a(()=>import("./index-CGMXxK_x.js"),[]).then(e=>e.wallet);case"com.safemoon":return t?a(()=>import("./image-BcfiUDv-.js"),[]).then(e=>e.default):a(()=>import("./index-BgECKCj8.js"),[]).then(e=>e.wallet);case"llc.besc":return t?a(()=>import("./image-DLwHWQ4l.js"),[]).then(e=>e.default):a(()=>import("./index-CbMeskkV.js"),[]).then(e=>e.wallet);case"baby.smart":return t?a(()=>import("./image-VxDqDj0T.js"),[]).then(e=>e.default):a(()=>import("./index-BmKJ1abQ.js"),[]).then(e=>e.wallet);case"app.onto":return t?a(()=>import("./image-BCXqBewH.js"),[]).then(e=>e.default):a(()=>import("./index-BPFXH4g9.js"),[]).then(e=>e.wallet);case"com.ivirse":return t?a(()=>import("./image-8DkN4eFx.js"),[]).then(e=>e.default):a(()=>import("./index-CqWFxNbG.js"),[]).then(e=>e.wallet);case"one.mixin.messenger":return t?a(()=>import("./image-DecSbpNG.js"),[]).then(e=>e.default):a(()=>import("./index-PjYIiHEb.js"),[]).then(e=>e.wallet);case"cash.abpay":return t?a(()=>import("./image-Bb4ZLG-2.js"),[]).then(e=>e.default):a(()=>import("./index-BrvgJVgh.js"),[]).then(e=>e.wallet);case"ch.dssecurity":return t?a(()=>import("./image-ddsU9gPS.js"),[]).then(e=>e.default):a(()=>import("./index-DDdoZFD-.js"),[]).then(e=>e.wallet);case"com.concordium.wallet":return t?a(()=>import("./image-W5rUOVDT.js"),[]).then(e=>e.default):a(()=>import("./index-B5BAsv-B.js"),[]).then(e=>e.wallet);case"io.zkape":return t?a(()=>import("./image-Bm-o9RF3.js"),[]).then(e=>e.default):a(()=>import("./index-yLatYZZK.js"),[]).then(e=>e.wallet);case"com.paliwallet":return t?a(()=>import("./image-DqH_Lyo9.js"),[]).then(e=>e.default):a(()=>import("./index-C93NlSEw.js"),[]).then(e=>e.wallet);case"io.pitaka":return t?a(()=>import("./image-Bo8CHmCG.js"),[]).then(e=>e.default):a(()=>import("./index-DeQey0SH.js"),[]).then(e=>e.wallet);case"com.saitamatoken":return t?a(()=>import("./image-AlOoIjkb.js"),[]).then(e=>e.default):a(()=>import("./index-CNkg8_tm.js"),[]).then(e=>e.wallet);case"org.mugambo":return t?a(()=>import("./image-vXNBwFvw.js"),[]).then(e=>e.default):a(()=>import("./index-CqJjpCD5.js"),[]).then(e=>e.wallet);case"fi.stablez":return t?a(()=>import("./image-CruMo9Ar.js"),[]).then(e=>e.default):a(()=>import("./index-Wz7obrZB.js"),[]).then(e=>e.wallet);case"io.legacynetwork":return t?a(()=>import("./image-Dgb3Vdrr.js"),[]).then(e=>e.default):a(()=>import("./index-DLHjxUiX.js"),[]).then(e=>e.wallet);case"com.meld.app":return t?a(()=>import("./image-DrobCWF2.js"),[]).then(e=>e.default):a(()=>import("./index-BqLb859N.js"),[]).then(e=>e.wallet);case"io.bladewallet":return t?a(()=>import("./image-nqueMEws.js"),[]).then(e=>e.default):a(()=>import("./index-C0I75rp3.js"),[]).then(e=>e.wallet);case"com.authentrend":return t?a(()=>import("./image-CmzmxiTz.js"),[]).then(e=>e.default):a(()=>import("./index-0qRtNAQn.js"),[]).then(e=>e.wallet);case"com.webauth":return t?a(()=>import("./image-EyKsXf_1.js"),[]).then(e=>e.default):a(()=>import("./index-BXnDDK-y.js"),[]).then(e=>e.wallet);case"xyz.tucop":return t?a(()=>import("./image-8r04P3UP.js"),[]).then(e=>e.default):a(()=>import("./index-Bbznecif.js"),[]).then(e=>e.wallet);case"pro.fintoken":return t?a(()=>import("./image-BBez6ov1.js"),[]).then(e=>e.default):a(()=>import("./index-CP3DQPwx.js"),[]).then(e=>e.wallet);case"io.nash":return t?a(()=>import("./image--fcqsYch.js"),[]).then(e=>e.default):a(()=>import("./index-Bx9srovK.js"),[]).then(e=>e.wallet);case"vc.uincubator.api":return t?a(()=>import("./image-CyLv-qKv.js"),[]).then(e=>e.default):a(()=>import("./index-B5AZ3O3C.js"),[]).then(e=>e.wallet);case"io.unagi.unawallet":return t?a(()=>import("./image-C6ewnpHo.js"),[]).then(e=>e.default):a(()=>import("./index-CD7cY8HX.js"),[]).then(e=>e.wallet);case"io.nonbank":return t?a(()=>import("./image-TA_PkYBz.js"),[]).then(e=>e.default):a(()=>import("./index-DSWhMtMn.js"),[]).then(e=>e.wallet);case"io.armana.portal":return t?a(()=>import("./image-CI3i53ES.js"),[]).then(e=>e.default):a(()=>import("./index-DuTQzi4Z.js"),[]).then(e=>e.wallet);case"com.x9wallet":return t?a(()=>import("./image-BnT6IaIq.js"),[]).then(e=>e.default):a(()=>import("./index-K7y9yqJI.js"),[]).then(e=>e.wallet);case"io.kigo":return t?a(()=>import("./image-D9i7y0RW.js"),[]).then(e=>e.default):a(()=>import("./index-BIFgx20V.js"),[]).then(e=>e.wallet);case"com.alphawallet":return t?a(()=>import("./image-xJO47ptb.js"),[]).then(e=>e.default):a(()=>import("./index-B78E3fcT.js"),[]).then(e=>e.wallet);case"com.getcogni":return t?a(()=>import("./image-CwsKp0mM.js"),[]).then(e=>e.default):a(()=>import("./index-BNlDhEDg.js"),[]).then(e=>e.wallet);case"app.sinum":return t?a(()=>import("./image-DTy0DgOV.js"),[]).then(e=>e.default):a(()=>import("./index-D5GVUjIM.js"),[]).then(e=>e.wallet);case"finance.soulswap.app":return t?a(()=>import("./image-BI8lK7Gl.js"),[]).then(e=>e.default):a(()=>import("./index-CB_NguTF.js"),[]).then(e=>e.wallet);case"io.loopring.wallet":return t?a(()=>import("./image-BdLvgjKp.js"),[]).then(e=>e.default):a(()=>import("./index-DpoJvg5R.js"),[]).then(e=>e.wallet);case"com.shapeshift":return t?a(()=>import("./image-T2oAotCg.js"),[]).then(e=>e.default):a(()=>import("./index-CdMxme0L.js"),[]).then(e=>e.wallet);case"io.trinity-tech":return t?a(()=>import("./image-bHVCC2t9.js"),[]).then(e=>e.default):a(()=>import("./index-JNZoio_2.js"),[]).then(e=>e.wallet);case"money.keychain":return t?a(()=>import("./image-CHotlokX.js"),[]).then(e=>e.default):a(()=>import("./index-C2CZkwuV.js"),[]).then(e=>e.wallet);case"com.superhero.cordova":return t?a(()=>import("./image-CsmwtAjX.js"),[]).then(e=>e.default):a(()=>import("./index-C5X26G0P.js"),[]).then(e=>e.wallet);case"com.bettatrade":return t?a(()=>import("./image-B4MULACL.js"),[]).then(e=>e.default):a(()=>import("./index-qNIXx6_B.js"),[]).then(e=>e.wallet);case"online.puzzle":return t?a(()=>import("./image-C4hEqt6v.js"),[]).then(e=>e.default):a(()=>import("./index-D2-ySoTs.js"),[]).then(e=>e.wallet);case"gg.indi":return t?a(()=>import("./image-DdicXBNF.js"),[]).then(e=>e.default):a(()=>import("./index-BTkNDmCP.js"),[]).then(e=>e.wallet);case"io.tradestrike":return t?a(()=>import("./image-Bsv1aEQB.js"),[]).then(e=>e.default):a(()=>import("./index-CLtv9-lU.js"),[]).then(e=>e.wallet);case"xyz.echooo":return t?a(()=>import("./image-C7H4CQ65.js"),[]).then(e=>e.default):a(()=>import("./index-B-UTLjBc.js"),[]).then(e=>e.wallet);case"com.kryptogo":return t?a(()=>import("./image-D3ALeCj7.js"),[]).then(e=>e.default):a(()=>import("./index-BtBx3hi1.js"),[]).then(e=>e.wallet);case"io.trustasset":return t?a(()=>import("./image-BfmBx3-B.js"),[]).then(e=>e.default):a(()=>import("./index-MECmwSvw.js"),[]).then(e=>e.wallet);case"app.utorg":return t?a(()=>import("./image-CyF2UJbG.js"),[]).then(e=>e.default):a(()=>import("./index-DK-e_E51.js"),[]).then(e=>e.wallet);case"app.dfinnwallet":return t?a(()=>import("./image-DGLcwgsS.js"),[]).then(e=>e.default):a(()=>import("./index-DR-ujXcj.js"),[]).then(e=>e.wallet);case"org.rezor":return t?a(()=>import("./image-D_0i3ZH4.js"),[]).then(e=>e.default):a(()=>import("./index-DlKNOIdN.js"),[]).then(e=>e.wallet);case"io.legionnetwork":return t?a(()=>import("./image-BszqTwo7.js"),[]).then(e=>e.default):a(()=>import("./index-DMyHg26L.js"),[]).then(e=>e.wallet);case"cc.maxwallet":return t?a(()=>import("./image-CxvWjDXv.js"),[]).then(e=>e.default):a(()=>import("./index-Dy45c3qF.js"),[]).then(e=>e.wallet);case"com.ripio":return t?a(()=>import("./image-DZpGtN5l.js"),[]).then(e=>e.default):a(()=>import("./index-BoC-cn90.js"),[]).then(e=>e.wallet);case"com.fxwallet":return t?a(()=>import("./image-Bkj-ZRbS.js"),[]).then(e=>e.default):a(()=>import("./index-D8dYcFAn.js"),[]).then(e=>e.wallet);case"inc.tomo":return t?a(()=>import("./image-rw28GAIu.js"),[]).then(e=>e.default):a(()=>import("./index-Bh8eOJMM.js"),[]).then(e=>e.wallet);case"me.komet.app":return t?a(()=>import("./image-29vwsAfI.js"),[]).then(e=>e.default):a(()=>import("./index-CapnWgEl.js"),[]).then(e=>e.wallet);case"io.guardiianwallet":return t?a(()=>import("./image-DIDeRhKH.js"),[]).then(e=>e.default):a(()=>import("./index-CWTqaiN6.js"),[]).then(e=>e.wallet);case"io.hacken.hai":return t?a(()=>import("./image-Fq457JJn.js"),[]).then(e=>e.default):a(()=>import("./index-BH1-nK1j.js"),[]).then(e=>e.wallet);case"com.zypto":return t?a(()=>import("./image-D9OC6Qfy.js"),[]).then(e=>e.default):a(()=>import("./index-5U2ZJeh5.js"),[]).then(e=>e.wallet);case"io.nabox":return t?a(()=>import("./image-CJb0NNxX.js"),[]).then(e=>e.default):a(()=>import("./index-Cl87iGjg.js"),[]).then(e=>e.wallet);case"com.tastycrypto":return t?a(()=>import("./image-IpgDqPq2.js"),[]).then(e=>e.default):a(()=>import("./index-CXgqt45P.js"),[]).then(e=>e.wallet);case"com.ballet":return t?a(()=>import("./image-DNyYhMNV.js"),[]).then(e=>e.default):a(()=>import("./index-DhFHq_nZ.js"),[]).then(e=>e.wallet);case"io.talken":return t?a(()=>import("./image-DjXN5hvv.js"),[]).then(e=>e.default):a(()=>import("./index-CuJtvtqs.js"),[]).then(e=>e.wallet);case"io.wallacy":return t?a(()=>import("./image-CdGvq_lV.js"),[]).then(e=>e.default):a(()=>import("./index-DcUozftP.js"),[]).then(e=>e.wallet);case"network.mrhb":return t?a(()=>import("./image-CaBQfcNB.js"),[]).then(e=>e.default):a(()=>import("./index-BpspMk9l.js"),[]).then(e=>e.wallet);case"io.pockie":return t?a(()=>import("./image-D13kcv8b.js"),[]).then(e=>e.default):a(()=>import("./index-Bd7BhrCK.js"),[]).then(e=>e.wallet);case"me.astrox":return t?a(()=>import("./image-BGSprUxs.js"),[]).then(e=>e.default):a(()=>import("./index-BM9GzZ_o.js"),[]).then(e=>e.wallet);case"com.thirdweb":return t?a(()=>import("./image--O11VYbP.js"),[]).then(e=>e.default):a(()=>import("./index-VZmM-6RJ.js"),[]).then(e=>e.wallet);case"com.poolsmobility.wallet":return t?a(()=>import("./image-CUFBkGzy.js"),[]).then(e=>e.default):a(()=>import("./index-DMyDV-OH.js"),[]).then(e=>e.wallet);case"xyz.roam.wallet":return t?a(()=>import("./image-BBk5bBxJ.js"),[]).then(e=>e.default):a(()=>import("./index-DACt8hFb.js"),[]).then(e=>e.wallet);case"app.gamic":return t?a(()=>import("./image-CbmAI5Wi.js"),[]).then(e=>e.default):a(()=>import("./index-D09WfuKj.js"),[]).then(e=>e.wallet);case"app.m1nty":return t?a(()=>import("./image-8Zz6I0OH.js"),[]).then(e=>e.default):a(()=>import("./index-CU6cpe0O.js"),[]).then(e=>e.wallet);case"network.trustkeys":return t?a(()=>import("./image-BJAlBW3-.js"),[]).then(e=>e.default):a(()=>import("./index-BSA2BPZ9.js"),[]).then(e=>e.wallet);case"com.caesiumlab":return t?a(()=>import("./image-DLtkWmCC.js"),[]).then(e=>e.default):a(()=>import("./index-CZNdz8B6.js"),[]).then(e=>e.wallet);case"app.catecoin":return t?a(()=>import("./image-BIIaxSfC.js"),[]).then(e=>e.default):a(()=>import("./index-DNynPGua.js"),[]).then(e=>e.wallet);case"com.hootark":return t?a(()=>import("./image-BQTKy54v.js"),[]).then(e=>e.default):a(()=>import("./index-DhlaSoR4.js"),[]).then(e=>e.wallet);case"com.crossmint":return t?a(()=>import("./image-DrH3Wn2w.js"),[]).then(e=>e.default):a(()=>import("./index-Czf-i91G.js"),[]).then(e=>e.wallet);case"com.coincircle":return t?a(()=>import("./image-DOcz3CQ4.js"),[]).then(e=>e.default):a(()=>import("./index-Crs9jVrm.js"),[]).then(e=>e.wallet);case"io.bharatbox":return t?a(()=>import("./image-D1eN-vq9.js"),[]).then(e=>e.default):a(()=>import("./index-CdYRC4Ux.js"),[]).then(e=>e.wallet);case"nl.greenhood.wallet":return t?a(()=>import("./image-Cyy1KupU.js"),[]).then(e=>e.default):a(()=>import("./index-BPgl8Hhp.js"),[]).then(e=>e.wallet);case"co.swopme":return t?a(()=>import("./image-B6SAWLjq.js"),[]).then(e=>e.default):a(()=>import("./index-DMAP8qTI.js"),[]).then(e=>e.wallet);case"com.kresus":return t?a(()=>import("./image-DesBMjvP.js"),[]).then(e=>e.default):a(()=>import("./index-oEcArN4B.js"),[]).then(e=>e.wallet);case"com.dolletwallet":return t?a(()=>import("./image-fjbgiffe.js"),[]).then(e=>e.default):a(()=>import("./index-CCIAeA2T.js"),[]).then(e=>e.wallet);case"net.shinobi-wallet":return t?a(()=>import("./image-WbOd8jAJ.js"),[]).then(e=>e.default):a(()=>import("./index-CZmLnawh.js"),[]).then(e=>e.wallet);case"com.azcoiner":return t?a(()=>import("./image-BQcTbEVl.js"),[]).then(e=>e.default):a(()=>import("./index-t6B_NULY.js"),[]).then(e=>e.wallet);case"com.passwallet.app":return t?a(()=>import("./image-DJYKaoNi.js"),[]).then(e=>e.default):a(()=>import("./index-Ct6AYfZ-.js"),[]).then(e=>e.wallet);case"app.qubic.wallet":return t?a(()=>import("./image-BBZFtk5k.js"),[]).then(e=>e.default):a(()=>import("./index-DoKwRUhz.js"),[]).then(e=>e.wallet);case"com.coinex.wallet":return t?a(()=>import("./image-CfglWSsQ.js"),[]).then(e=>e.default):a(()=>import("./index-DMEV07wA.js"),[]).then(e=>e.wallet);case"app.xverse":return t?a(()=>import("./image-DETlLb_v.js"),[]).then(e=>e.default):a(()=>import("./index-DAlw00ee.js"),[]).then(e=>e.wallet);case"com.flash-wallet":return t?a(()=>import("./image-BzGwleUn.js"),[]).then(e=>e.default):a(()=>import("./index-7BdGIDy3.js"),[]).then(e=>e.wallet);case"com.vgxfoundation":return t?a(()=>import("./image-C6NJnfCW.js"),[]).then(e=>e.default):a(()=>import("./index-CsAX4sL-.js"),[]).then(e=>e.wallet);case"org.arianee":return t?a(()=>import("./image-B6VmDbM6.js"),[]).then(e=>e.default):a(()=>import("./index-Cx8lAzRu.js"),[]).then(e=>e.wallet);case"io.myabcwallet":return t?a(()=>import("./image-jv6wUF7a.js"),[]).then(e=>e.default):a(()=>import("./index-3an-fsOm.js"),[]).then(e=>e.wallet);case"io.owallet":return t?a(()=>import("./image-DGhNZ1rS.js"),[]).then(e=>e.default):a(()=>import("./index-D2_d10WC.js"),[]).then(e=>e.wallet);case"io.zelus":return t?a(()=>import("./image-1epPqHV4.js"),[]).then(e=>e.default):a(()=>import("./index-hUldZ-v8.js"),[]).then(e=>e.wallet);case"net.myrenegade":return t?a(()=>import("./image-SJHuomz2.js"),[]).then(e=>e.default):a(()=>import("./index-C5gBqe1B.js"),[]).then(e=>e.wallet);case"io.clingon":return t?a(()=>import("./image-2s8lIjLJ.js"),[]).then(e=>e.default):a(()=>import("./index-Dk8LF9Yk.js"),[]).then(e=>e.wallet);case"com.icewal":return t?a(()=>import("./image-rdvu9IOp.js"),[]).then(e=>e.default):a(()=>import("./index-Cd5Dye5X.js"),[]).then(e=>e.wallet);case"io.streakk":return t?a(()=>import("./image-CcPbeTXv.js"),[]).then(e=>e.default):a(()=>import("./index-CrGDBMbK.js"),[]).then(e=>e.wallet);case"com.dokwallet":return t?a(()=>import("./image-BRPzDWpX.js"),[]).then(e=>e.default):a(()=>import("./index-xEbiF_Me.js"),[]).then(e=>e.wallet);case"finance.porta":return t?a(()=>import("./image-BNvlqRxs.js"),[]).then(e=>e.default):a(()=>import("./index-DSL1LhIu.js"),[]).then(e=>e.wallet);case"io.prettygood.x":return t?a(()=>import("./image-BhmKXBqm.js"),[]).then(e=>e.default):a(()=>import("./index-DfafaK4Q.js"),[]).then(e=>e.wallet);case"io.earthwallet":return t?a(()=>import("./image-BOJcifnx.js"),[]).then(e=>e.default):a(()=>import("./index-BmwlJTQ-.js"),[]).then(e=>e.wallet);case"net.spatium.wallet":return t?a(()=>import("./image-CmrOpLf4.js"),[]).then(e=>e.default):a(()=>import("./index-Fd858RJQ.js"),[]).then(e=>e.wallet);case"live.superex":return t?a(()=>import("./image-ByHnaba8.js"),[]).then(e=>e.default):a(()=>import("./index-DqVvpGRi.js"),[]).then(e=>e.wallet);case"com.adftechnology":return t?a(()=>import("./image-C6LRjQzh.js"),[]).then(e=>e.default):a(()=>import("./index-C-b1qpM9.js"),[]).then(e=>e.wallet);case"com.bscecowallet":return t?a(()=>import("./image-8u03hBEl.js"),[]).then(e=>e.default):a(()=>import("./index-Dn2svNQz.js"),[]).then(e=>e.wallet);case"io.wallypto":return t?a(()=>import("./image-CRU88082.js"),[]).then(e=>e.default):a(()=>import("./index-j06jujv2.js"),[]).then(e=>e.wallet);case"com.reown":return t?a(()=>import("./image-D3tLM-DF.js"),[]).then(e=>e.default):a(()=>import("./index-DibwKtF2.js"),[]).then(e=>e.wallet);case"finance.voltage":return t?a(()=>import("./image-ZVoqlWXW.js"),[]).then(e=>e.default):a(()=>import("./index-XRQW1mUN.js"),[]).then(e=>e.wallet);case"com.walletconnect":return t?a(()=>import("./image-BAS5CqSz.js"),[]).then(e=>e.default):a(()=>import("./index-B-BftUxa.js"),[]).then(e=>e.wallet);case"io.passpay":return t?a(()=>import("./image-Ci0UFTFy.js"),[]).then(e=>e.default):a(()=>import("./index-CP_9UNXA.js"),[]).then(e=>e.wallet);case"technology.obvious":return t?a(()=>import("./image-ZLtraAGN.js"),[]).then(e=>e.default):a(()=>import("./index-BzNpkHfI.js"),[]).then(e=>e.wallet);case"io.plutope":return t?a(()=>import("./image-Bz03or90.js"),[]).then(e=>e.default):a(()=>import("./index-CszQa87W.js"),[]).then(e=>e.wallet);case"io.buzz-up":return t?a(()=>import("./image-BsQYdoXP.js"),[]).then(e=>e.default):a(()=>import("./index-BoJGVmma.js"),[]).then(e=>e.wallet);case"co.xellar":return t?a(()=>import("./image-D2QL-j27.js"),[]).then(e=>e.default):a(()=>import("./index-cdlur5jM.js"),[]).then(e=>e.wallet);case"com.kaxaa":return t?a(()=>import("./image-DPzEe6a_.js"),[]).then(e=>e.default):a(()=>import("./index-DFSGuScS.js"),[]).then(e=>e.wallet);case"org.shefi":return t?a(()=>import("./image-DwUGDFj5.js"),[]).then(e=>e.default):a(()=>import("./index-Dtavj5eK.js"),[]).then(e=>e.wallet);case"xyz.orion":return t?a(()=>import("./image-CCDmsN6r.js"),[]).then(e=>e.default):a(()=>import("./index-Ba2OoCBH.js"),[]).then(e=>e.wallet);case"world.dosi.vault":return t?a(()=>import("./image-Cy0vmJls.js"),[]).then(e=>e.default):a(()=>import("./index-eujSyrnd.js"),[]).then(e=>e.wallet);case"network.gridlock":return t?a(()=>import("./image-CxyHP7w7.js"),[]).then(e=>e.default):a(()=>import("./index-Ce98wt2N.js"),[]).then(e=>e.wallet);case"finance.plena":return t?a(()=>import("./image-Cwg1QVuh.js"),[]).then(e=>e.default):a(()=>import("./index-BG1ZQeCA.js"),[]).then(e=>e.wallet);case"cc.dropp":return t?a(()=>import("./image-CAIffJi4.js"),[]).then(e=>e.default):a(()=>import("./index-HFnaQWCU.js"),[]).then(e=>e.wallet);case"io.scramberry":return t?a(()=>import("./image-D8ARN-Gu.js"),[]).then(e=>e.default):a(()=>import("./index-BIcsFldg.js"),[]).then(e=>e.wallet);case"xyz.bonuz":return t?a(()=>import("./image-HcidEyjv.js"),[]).then(e=>e.default):a(()=>import("./index-BZhX-e71.js"),[]).then(e=>e.wallet);case"com.bmawallet":return t?a(()=>import("./image-kZBIIBVa.js"),[]).then(e=>e.default):a(()=>import("./index-BM8c6qO-.js"),[]).then(e=>e.wallet);case"co.lifedefi":return t?a(()=>import("./image-DRpXk5be.js"),[]).then(e=>e.default):a(()=>import("./index-otRo5H2H.js"),[]).then(e=>e.wallet);case"com.get-verso":return t?a(()=>import("./image-CgzMLfDa.js"),[]).then(e=>e.default):a(()=>import("./index-DAEFTu29.js"),[]).then(e=>e.wallet);case"io.blocto":return t?a(()=>import("./image-FnAIuX7S.js"),[]).then(e=>e.default):a(()=>import("./index-ZITrt5Fi.js"),[]).then(e=>e.wallet);case"com.pandoshi":return t?a(()=>import("./image-PWpnYSKI.js"),[]).then(e=>e.default):a(()=>import("./index-BmXd0pys.js"),[]).then(e=>e.wallet);case"io.getclave":return t?a(()=>import("./image-rvsWf8U_.js"),[]).then(e=>e.default):a(()=>import("./index--rITGawC.js"),[]).then(e=>e.wallet);case"technology.jambo":return t?a(()=>import("./image-Bx8ULApC.js"),[]).then(e=>e.default):a(()=>import("./index-C2KnoZm4.js"),[]).then(e=>e.wallet);case"app.edge":return t?a(()=>import("./image-1-dOu4Yt.js"),[]).then(e=>e.default):a(()=>import("./index-stFagoJS.js"),[]).then(e=>e.wallet);case"io.banksocial":return t?a(()=>import("./image-OrIz0o8m.js"),[]).then(e=>e.default):a(()=>import("./index-Ia3LffGn.js"),[]).then(e=>e.wallet);case"io.konio":return t?a(()=>import("./image-C2Wl7RAy.js"),[]).then(e=>e.default):a(()=>import("./index-B-kI7R4f.js"),[]).then(e=>e.wallet);case"com.qubetics":return t?a(()=>import("./image-DLvMDcgw.js"),[]).then(e=>e.default):a(()=>import("./index-C_j5E1ow.js"),[]).then(e=>e.wallet);case"app.imem":return t?a(()=>import("./image-Atwyf6cQ.js"),[]).then(e=>e.default):a(()=>import("./index-KXLAu1y1.js"),[]).then(e=>e.wallet);case"com.purechain":return t?a(()=>import("./image-DgU8tR58.js"),[]).then(e=>e.default):a(()=>import("./index-G-h-xM0C.js"),[]).then(e=>e.wallet);case"io.ethos":return t?a(()=>import("./image-DmNOl1OW.js"),[]).then(e=>e.default):a(()=>import("./index-DmLPMpkA.js"),[]).then(e=>e.wallet);case"io.didwallet":return t?a(()=>import("./image-CzKmxeZp.js"),[]).then(e=>e.default):a(()=>import("./index-QGSP4PI8.js"),[]).then(e=>e.wallet);case"com.dextrade":return t?a(()=>import("./image-B_ozWfd0.js"),[]).then(e=>e.default):a(()=>import("./index-CdOxXIip.js"),[]).then(e=>e.wallet);case"org.kelp":return t?a(()=>import("./image-CcKS-8-S.js"),[]).then(e=>e.default):a(()=>import("./index-DUBZIaC-.js"),[]).then(e=>e.wallet);case"xyz.nestwallet":return t?a(()=>import("./image-Bq1UxveY.js"),[]).then(e=>e.default):a(()=>import("./index-uKvrIGe-.js"),[]).then(e=>e.wallet);case"com.cryptnox":return t?a(()=>import("./image-UFnS_pK0.js"),[]).then(e=>e.default):a(()=>import("./index-ComRbnem.js"),[]).then(e=>e.wallet);case"land.liker":return t?a(()=>import("./image-C_JPqQZj.js"),[]).then(e=>e.default):a(()=>import("./index-CId5PD0X.js"),[]).then(e=>e.wallet);case"io.hippowallet":return t?a(()=>import("./image-BdJA4XzW.js"),[]).then(e=>e.default):a(()=>import("./index-BTzbgIH6.js"),[]).then(e=>e.wallet);case"io.certhis":return t?a(()=>import("./image-bSOL4gQb.js"),[]).then(e=>e.default):a(()=>import("./index-BxtNhRvf.js"),[]).then(e=>e.wallet);case"io.safecryptowallet":return t?a(()=>import("./image-DFF2Z6Pk.js"),[]).then(e=>e.default):a(()=>import("./index-CWdL5XwO.js"),[]).then(e=>e.wallet);case"com.saify":return t?a(()=>import("./image-DOwBqPVS.js"),[]).then(e=>e.default):a(()=>import("./index-De1eZyIJ.js"),[]).then(e=>e.wallet);case"com.tiduswallet":return t?a(()=>import("./image-DzJAqGfB.js"),[]).then(e=>e.default):a(()=>import("./index-BMPGw_D6.js"),[]).then(e=>e.wallet);case"io.uptn.dapp-web":return t?a(()=>import("./image-C4ELurjg.js"),[]).then(e=>e.default):a(()=>import("./index-jsmqr-24.js"),[]).then(e=>e.wallet);case"com.it.onewallet":return t?a(()=>import("./image-CWCOKSln.js"),[]).then(e=>e.default):a(()=>import("./index-DHNwai-Z.js"),[]).then(e=>e.wallet);case"com.rktechworks":return t?a(()=>import("./image-BhECDi_9.js"),[]).then(e=>e.default):a(()=>import("./index-D6xvjdG0.js"),[]).then(e=>e.wallet);case"com.revelator.wallet":return t?a(()=>import("./image-nW5JvdXC.js"),[]).then(e=>e.default):a(()=>import("./index-CNl69Nv0.js"),[]).then(e=>e.wallet);case"com.sinohope":return t?a(()=>import("./image-D7P0qSfx.js"),[]).then(e=>e.default):a(()=>import("./index-DKzyJcIY.js"),[]).then(e=>e.wallet);case"network.dgg":return t?a(()=>import("./image-DrraBYJZ.js"),[]).then(e=>e.default):a(()=>import("./index-DnUUaSfF.js"),[]).then(e=>e.wallet);case"io.up":return t?a(()=>import("./image-DbpOM2LD.js"),[]).then(e=>e.default):a(()=>import("./index-BuWGQyCe.js"),[]).then(e=>e.wallet);case"com.lif3":return t?a(()=>import("./image-DC2DOoz2.js"),[]).then(e=>e.default):a(()=>import("./index-BKkJhanY.js"),[]).then(e=>e.wallet);case"io.bimwallet":return t?a(()=>import("./image-BKSQyIc5.js"),[]).then(e=>e.default):a(()=>import("./index-3DerMn1X.js"),[]).then(e=>e.wallet);case"pub.dg":return t?a(()=>import("./image-C4KoLZ1v.js"),[]).then(e=>e.default):a(()=>import("./index-D6d2Y6jv.js"),[]).then(e=>e.wallet);case"com.wemix":return t?a(()=>import("./image-CawBnBIo.js"),[]).then(e=>e.default):a(()=>import("./index-18L0wZ74.js"),[]).then(e=>e.wallet);case"com.pierwallet":return t?a(()=>import("./image-DA8Sg5HZ.js"),[]).then(e=>e.default):a(()=>import("./index-mJTgSazQ.js"),[]).then(e=>e.wallet);case"net.stasis":return t?a(()=>import("./image-CyE6Mi3e.js"),[]).then(e=>e.default):a(()=>import("./index-CJ8I9s4o.js"),[]).then(e=>e.wallet);case"com.peakdefi":return t?a(()=>import("./image-DUcJQ0b3.js"),[]).then(e=>e.default):a(()=>import("./index-DEMIRENu.js"),[]).then(e=>e.wallet);case"com.3swallet":return t?a(()=>import("./image-CD3he1Tj.js"),[]).then(e=>e.default):a(()=>import("./index-DVGcX2HE.js"),[]).then(e=>e.wallet);case"com.example.subdomain":return t?a(()=>import("./image-Cs2bevZt.js"),[]).then(e=>e.default):a(()=>import("./index-CJt068xh.js"),[]).then(e=>e.wallet);case"com.reown.appkit-lab":return t?a(()=>import("./image-CnDG0aor.js"),[]).then(e=>e.default):a(()=>import("./index-BzfyCotn.js"),[]).then(e=>e.wallet);case"com.opz":return t?a(()=>import("./image-D1qvgd7h.js"),[]).then(e=>e.default):a(()=>import("./index-CMGByxdA.js"),[]).then(e=>e.wallet);case"ai.spotonchain.platform":return t?a(()=>import("./image-C6QSWUy4.js"),[]).then(e=>e.default):a(()=>import("./index-Ba7PpD6d.js"),[]).then(e=>e.wallet);case"org.dailychain.wallet":return t?a(()=>import("./image-BJ_lqI1X.js"),[]).then(e=>e.default):a(()=>import("./index-DQa9pNJd.js"),[]).then(e=>e.wallet);case"app.omni":return t?a(()=>import("./image-CqLwuE__.js"),[]).then(e=>e.default):a(()=>import("./index-D_7wDcMK.js"),[]).then(e=>e.wallet);case"id.plumaa":return t?a(()=>import("./image-BvJKCSpY.js"),[]).then(e=>e.default):a(()=>import("./index-D45a0k-1.js"),[]).then(e=>e.wallet);case"io.ttmwallet":return t?a(()=>import("./image-Chg2WzE1.js"),[]).then(e=>e.default):a(()=>import("./index-CLikIjn_.js"),[]).then(e=>e.wallet);case"io.kgen":return t?a(()=>import("./image-DFYGQEwh.js"),[]).then(e=>e.default):a(()=>import("./index-BQWXi0by.js"),[]).then(e=>e.wallet);case"com.nufinetes":return t?a(()=>import("./image-CpFHTO_m.js"),[]).then(e=>e.default):a(()=>import("./index-B8De2hoC.js"),[]).then(e=>e.wallet);case"com.squirrelwallet":return t?a(()=>import("./image-bHJO6btW.js"),[]).then(e=>e.default):a(()=>import("./index-DyaPXLoO.js"),[]).then(e=>e.wallet);case"eu.trusteeglobal":return t?a(()=>import("./image-cDoShVvl.js"),[]).then(e=>e.default):a(()=>import("./index-B51294pb.js"),[]).then(e=>e.wallet);case"com.daffione":return t?a(()=>import("./image-Dtc98pdf.js"),[]).then(e=>e.default):a(()=>import("./index-BIXqJF5y.js"),[]).then(e=>e.wallet);case"com.saakuru.app":return t?a(()=>import("./image-TQLBEOIW.js"),[]).then(e=>e.default):a(()=>import("./index-CjVYDT09.js"),[]).then(e=>e.wallet);case"io.r0ar":return t?a(()=>import("./image-4bx5chOJ.js"),[]).then(e=>e.default):a(()=>import("./index-CfCXSq_b.js"),[]).then(e=>e.wallet);case"com.nodle":return t?a(()=>import("./image-tiHbZ1Vk.js"),[]).then(e=>e.default):a(()=>import("./index-BwL47YsA.js"),[]).then(e=>e.wallet);case"app.tofee":return t?a(()=>import("./image-DpHbdMp9.js"),[]).then(e=>e.default):a(()=>import("./index-Bk-uZV0j.js"),[]).then(e=>e.wallet);case"io.pltwallet":return t?a(()=>import("./image-BIDqxk8w.js"),[]).then(e=>e.default):a(()=>import("./index-eiEAIzdd.js"),[]).then(e=>e.wallet);case"org.talkapp":return t?a(()=>import("./image-BkKo9DtA.js"),[]).then(e=>e.default):a(()=>import("./index-BGGk2Hck.js"),[]).then(e=>e.wallet);case"io.ready":return t?a(()=>import("./image-BwjeUYie.js"),[]).then(e=>e.default):a(()=>import("./index-BQwDdmmS.js"),[]).then(e=>e.wallet);case"app.w3wallet":return t?a(()=>import("./image-Covp72ND.js"),[]).then(e=>e.default):a(()=>import("./index-Cb41eDDJ.js"),[]).then(e=>e.wallet);case"pro.ds.app":return t?a(()=>import("./image-Bktw-NJ-.js"),[]).then(e=>e.default):a(()=>import("./index-b5ABnFKj.js"),[]).then(e=>e.wallet);case"com.reown.docs":return t?a(()=>import("./image-V4qYiUxw.js"),[]).then(e=>e.default):a(()=>import("./index-DsgD7D-8.js"),[]).then(e=>e.wallet);case"com.apollox":return t?a(()=>import("./image-ss2LFlQu.js"),[]).then(e=>e.default):a(()=>import("./index-BLMjeGJ-.js"),[]).then(e=>e.wallet);case"com.ipmb":return t?a(()=>import("./image-CirJIT7l.js"),[]).then(e=>e.default):a(()=>import("./index-DP0utIbV.js"),[]).then(e=>e.wallet);case"com.payperless":return t?a(()=>import("./image-q4XfUN6v.js"),[]).then(e=>e.default):a(()=>import("./index-szNElS1a.js"),[]).then(e=>e.wallet);case"com.obliowallet":return t?a(()=>import("./image-BGxqJH7c.js"),[]).then(e=>e.default):a(()=>import("./index-JuvDLDuk.js"),[]).then(e=>e.wallet);case"app.keeper-wallet":return t?a(()=>import("./image-Dpgf4dcg.js"),[]).then(e=>e.default):a(()=>import("./index-DlfGjmz4.js"),[]).then(e=>e.wallet);case"io.paraswap":return t?a(()=>import("./image-CQKjvlto.js"),[]).then(e=>e.default):a(()=>import("./index-DjLE3t9q.js"),[]).then(e=>e.wallet);case"org.ecoinwallet":return t?a(()=>import("./image-C3Va51zP.js"),[]).then(e=>e.default):a(()=>import("./index-DFZNHq44.js"),[]).then(e=>e.wallet);case"fi.dropmate":return t?a(()=>import("./image-5xiz28Wo.js"),[]).then(e=>e.default):a(()=>import("./index-p0ATWoVh.js"),[]).then(e=>e.wallet);case"com.cryptokara":return t?a(()=>import("./image-Dqbrewdt.js"),[]).then(e=>e.default):a(()=>import("./index-Cfzzcvgo.js"),[]).then(e=>e.wallet);case"co.cyber.wallet":return t?a(()=>import("./image-BvkSxpXq.js"),[]).then(e=>e.default):a(()=>import("./index-e_qeQmc1.js"),[]).then(e=>e.wallet);case"com.kriptonio":return t?a(()=>import("./image-D_cIj1db.js"),[]).then(e=>e.default):a(()=>import("./index-Dxm6Y7eO.js"),[]).then(e=>e.wallet);case"digital.minerva":return t?a(()=>import("./image-D5wxf47e.js"),[]).then(e=>e.default):a(()=>import("./index-HnCuhDYJ.js"),[]).then(e=>e.wallet);case"com.mpcvault.broswerplugin":return t?a(()=>import("./image-BN4ovMrn.js"),[]).then(e=>e.default):a(()=>import("./index-BXY5tnuK.js"),[]).then(e=>e.wallet);case"com.liberawallet":return t?a(()=>import("./image-DyrMImIL.js"),[]).then(e=>e.default):a(()=>import("./index-Dqyfi4dm.js"),[]).then(e=>e.wallet);case"io.helixid":return t?a(()=>import("./image-Dkp4M1ik.js"),[]).then(e=>e.default):a(()=>import("./index-RJhc6LnM.js"),[]).then(e=>e.wallet);case"com.broearn":return t?a(()=>import("./image-JyGUnQ_N.js"),[]).then(e=>e.default):a(()=>import("./index-WsH2ZGfO.js"),[]).then(e=>e.wallet);case"io.altme":return t?a(()=>import("./image-MQbcgW7z.js"),[]).then(e=>e.default):a(()=>import("./index-CpMkh5pZ.js"),[]).then(e=>e.wallet);case"app.herewallet":return t?a(()=>import("./image-gnC_p3Da.js"),[]).then(e=>e.default):a(()=>import("./index-CecEswCv.js"),[]).then(e=>e.wallet);case"com.coinsdo":return t?a(()=>import("./image-DrHhCSDD.js"),[]).then(e=>e.default):a(()=>import("./index-DJYG2Vtc.js"),[]).then(e=>e.wallet);case"trade.flooz.wallet":return t?a(()=>import("./image-DaaIjpQJ.js"),[]).then(e=>e.default):a(()=>import("./index-C6EDKfcJ.js"),[]).then(e=>e.wallet);case"com.tapwallet":return t?a(()=>import("./image-BxeDPEwg.js"),[]).then(e=>e.default):a(()=>import("./index-BwCUvEoQ.js"),[]).then(e=>e.wallet);case"fun.tobi":return t?a(()=>import("./image-DmhgJWq-.js"),[]).then(e=>e.default):a(()=>import("./index-C1adBKyv.js"),[]).then(e=>e.wallet);case"com.bitnovo":return t?a(()=>import("./image-BTZyVpoA.js"),[]).then(e=>e.default):a(()=>import("./index-CaZIFXyW.js"),[]).then(e=>e.wallet);case"io.xucre":return t?a(()=>import("./image-DZ-B-aVa.js"),[]).then(e=>e.default):a(()=>import("./index-BBDAdmKp.js"),[]).then(e=>e.wallet);case"app.girin":return t?a(()=>import("./image-CkQb0YUH.js"),[]).then(e=>e.default):a(()=>import("./index-CpJZxSfI.js"),[]).then(e=>e.wallet);case"finance.panaroma":return t?a(()=>import("./image-Z9k3mhsb.js"),[]).then(e=>e.default):a(()=>import("./index-BIeLm-x3.js"),[]).then(e=>e.wallet);case"app.clot":return t?a(()=>import("./image-DZplWZyD.js"),[]).then(e=>e.default):a(()=>import("./index-BVQeUBdj.js"),[]).then(e=>e.wallet);case"io.transi":return t?a(()=>import("./image-Dc5zhKf6.js"),[]).then(e=>e.default):a(()=>import("./index-DDggnqr4.js"),[]).then(e=>e.wallet);case"world.qoin":return t?a(()=>import("./image-BPAkEl8k.js"),[]).then(e=>e.default):a(()=>import("./index-C9taR4Do.js"),[]).then(e=>e.wallet);case"com.greengloryglobal":return t?a(()=>import("./image-lOdcUtWG.js"),[]).then(e=>e.default):a(()=>import("./index-C-OT0KJG.js"),[]).then(e=>e.wallet);case"com.amazewallet":return t?a(()=>import("./image-2wmDBIB6.js"),[]).then(e=>e.default):a(()=>import("./index-DvXpQOkv.js"),[]).then(e=>e.wallet);case"zone.bitverse":return t?a(()=>import("./image-C6aZzydG.js"),[]).then(e=>e.default):a(()=>import("./index-CN6XdMAo.js"),[]).then(e=>e.wallet);case"social.gm2":return t?a(()=>import("./image-BqtrMo-7.js"),[]).then(e=>e.default):a(()=>import("./index-Coq7--sH.js"),[]).then(e=>e.wallet);case"io.ozonewallet":return t?a(()=>import("./image-BtnrRGhZ.js"),[]).then(e=>e.default):a(()=>import("./index-DFc7lZHb.js"),[]).then(e=>e.wallet);case"io.ukiss":return t?a(()=>import("./image-DFYwzuHA.js"),[]).then(e=>e.default):a(()=>import("./index-CE9n_StB.js"),[]).then(e=>e.wallet);case"finance.islamicoin":return t?a(()=>import("./image-CWG4tRzZ.js"),[]).then(e=>e.default):a(()=>import("./index-pcLdliEp.js"),[]).then(e=>e.wallet);case"io.copiosa":return t?a(()=>import("./image-DuQoo_kR.js"),[]).then(e=>e.default):a(()=>import("./index-CWmGdvBR.js"),[]).then(e=>e.wallet);case"world.fncy":return t?a(()=>import("./image-B5M2ftPa.js"),[]).then(e=>e.default):a(()=>import("./index-Ba45jQBJ.js"),[]).then(e=>e.wallet);case"io.moonstake":return t?a(()=>import("./image-zsArRLIF.js"),[]).then(e=>e.default):a(()=>import("./index-C7HuhgLE.js"),[]).then(e=>e.wallet);case"com.trusteeglobal":return t?a(()=>import("./image-iR_slvRo.js"),[]).then(e=>e.default):a(()=>import("./index-CNLH4wrU.js"),[]).then(e=>e.wallet);case"net.spatium":return t?a(()=>import("./image-DBFrM6tr.js"),[]).then(e=>e.default):a(()=>import("./index-BJBC3bLU.js"),[]).then(e=>e.wallet);case"co.filwallet":return t?a(()=>import("./image-Do8rO3zE.js"),[]).then(e=>e.default):a(()=>import("./index-D7FslwZl.js"),[]).then(e=>e.wallet);case"money.snowball":return t?a(()=>import("./image-3Q7PfsJG.js"),[]).then(e=>e.default):a(()=>import("./index-yOwMLl2f.js"),[]).then(e=>e.wallet);case"com.ennowallet":return t?a(()=>import("./image-Ccx8wDSE.js"),[]).then(e=>e.default):a(()=>import("./index-BRIQuVzg.js"),[]).then(e=>e.wallet);case"io.safematrix":return t?a(()=>import("./image-BX4sAPzh.js"),[]).then(e=>e.default):a(()=>import("./index-Yk_iQY25.js"),[]).then(e=>e.wallet);case"pro.assure":return t?a(()=>import("./image-DMTT8AeN.js"),[]).then(e=>e.default):a(()=>import("./index-BfYVYwh5.js"),[]).then(e=>e.wallet);case"com.neftipedia":return t?a(()=>import("./image-vrSaD0K9.js"),[]).then(e=>e.default):a(()=>import("./index-BHZDuU0I.js"),[]).then(e=>e.wallet);case"io.goldbit":return t?a(()=>import("./image-CtiFcEL8.js"),[]).then(e=>e.default):a(()=>import("./index-DFrKYv4g.js"),[]).then(e=>e.wallet);case"com.coingrig":return t?a(()=>import("./image-NsVKBwxZ.js"),[]).then(e=>e.default):a(()=>import("./index-DcyXtFTG.js"),[]).then(e=>e.wallet);case"io.xfun":return t?a(()=>import("./image-CPMDxql6.js"),[]).then(e=>e.default):a(()=>import("./index-B05algAv.js"),[]).then(e=>e.wallet);case"com.antiersolutions":return t?a(()=>import("./image-BMh4HSr7.js"),[]).then(e=>e.default):a(()=>import("./index-DufOfQ90.js"),[]).then(e=>e.wallet);case"com.itoken":return t?a(()=>import("./image-BwBO8BTi.js"),[]).then(e=>e.default):a(()=>import("./index-BftqI1FU.js"),[]).then(e=>e.wallet);case"com.cardstack":return t?a(()=>import("./image-D7Sd6W8U.js"),[]).then(e=>e.default):a(()=>import("./index-BiHhxeDt.js"),[]).then(e=>e.wallet);case"io.slavi":return t?a(()=>import("./image-BQUnnXTb.js"),[]).then(e=>e.default):a(()=>import("./index-Kt6GlPCW.js"),[]).then(e=>e.wallet);case"tech.defiantapp":return t?a(()=>import("./image-D4-YMi52.js"),[]).then(e=>e.default):a(()=>import("./index-DPic1oJg.js"),[]).then(e=>e.wallet);case"com.dexari":return t?a(()=>import("./image-BoANtDMS.js"),[]).then(e=>e.default):a(()=>import("./index-DPFoWmV6.js"),[]).then(e=>e.wallet);case"io.cfcx":return t?a(()=>import("./image-139plIjh.js"),[]).then(e=>e.default):a(()=>import("./index-Cws1zSAX.js"),[]).then(e=>e.wallet);case"com.socjsc":return t?a(()=>import("./image-Crp2YP47.js"),[]).then(e=>e.default):a(()=>import("./index-C_XOoDbk.js"),[]).then(e=>e.wallet);case"com.tokenb":return t?a(()=>import("./image-8LnJ1bNt.js"),[]).then(e=>e.default):a(()=>import("./index-DcwbqEHj.js"),[]).then(e=>e.wallet);case"org.onyx":return t?a(()=>import("./image-DKcWaLtu.js"),[]).then(e=>e.default):a(()=>import("./index-C5NL4PoV.js"),[]).then(e=>e.wallet);case"io.gk8":return t?a(()=>import("./image-ZwibGfzR.js"),[]).then(e=>e.default):a(()=>import("./index-CLxj2t1J.js"),[]).then(e=>e.wallet);case"com.anchorage":return t?a(()=>import("./image-OT0Fb2Nb.js"),[]).then(e=>e.default):a(()=>import("./index-aoLVKFG1.js"),[]).then(e=>e.wallet);case"com.hashport.wallet":return t?a(()=>import("./image-DooF_Vfs.js"),[]).then(e=>e.default):a(()=>import("./index-DICTy0sa.js"),[]).then(e=>e.wallet);case"io.billionwallet":return t?a(()=>import("./image-DDBzbPSl.js"),[]).then(e=>e.default):a(()=>import("./index-CmCRou09.js"),[]).then(e=>e.wallet);case"com.dlicom":return t?a(()=>import("./image-lXBTHYnD.js"),[]).then(e=>e.default):a(()=>import("./index-l8DhIVZW.js"),[]).then(e=>e.wallet);case"com.tychiwallet":return t?a(()=>import("./image-pcyfaNhf.js"),[]).then(e=>e.default):a(()=>import("./index-B3vR_dtk.js"),[]).then(e=>e.wallet);case"at.swe":return t?a(()=>import("./image-C8_9fy1e.js"),[]).then(e=>e.default):a(()=>import("./index-ficai7Ce.js"),[]).then(e=>e.wallet);case"network.wali":return t?a(()=>import("./image-CSyxcTwp.js"),[]).then(e=>e.default):a(()=>import("./index-Dzkop1Gk.js"),[]).then(e=>e.wallet);case"io.diamante":return t?a(()=>import("./image-Dh9w9A8z.js"),[]).then(e=>e.default):a(()=>import("./index-C1a5oPtZ.js"),[]).then(e=>e.wallet);case"ai.interlinklabs":return t?a(()=>import("./image-Dz82Zyfj.js"),[]).then(e=>e.default):a(()=>import("./index-BTqXeJHf.js"),[]).then(e=>e.wallet);case"com.walllet":return t?a(()=>import("./image-VFWT6oS6.js"),[]).then(e=>e.default):a(()=>import("./index-DPgWRg9-.js"),[]).then(e=>e.wallet);case"org.lunascape":return t?a(()=>import("./image-D4nkyGrg.js"),[]).then(e=>e.default):a(()=>import("./index-4Nmn8ium.js"),[]).then(e=>e.wallet);case"com.nvxowallet":return t?a(()=>import("./image-BoS2kgXC.js"),[]).then(e=>e.default):a(()=>import("./index-CRRdY0XA.js"),[]).then(e=>e.wallet);case"today.paywithcrypto.wallet":return t?a(()=>import("./image-CsUCYFyx.js"),[]).then(e=>e.default):a(()=>import("./index-CFUSXkKo.js"),[]).then(e=>e.wallet);case"ai.iluminary":return t?a(()=>import("./image-CEuSmI3b.js"),[]).then(e=>e.default):a(()=>import("./index-D1j-SvoJ.js"),[]).then(e=>e.wallet);case"io.reactwallet":return t?a(()=>import("./image-B3lDLhwe.js"),[]).then(e=>e.default):a(()=>import("./index-CTs1t6rA.js"),[]).then(e=>e.wallet);case"com.rewardywallet":return t?a(()=>import("./image-DVyDRAAO.js"),[]).then(e=>e.default):a(()=>import("./index-cF_6KJvb.js"),[]).then(e=>e.wallet);case"io.walletv":return t?a(()=>import("./image-CTBdimeM.js"),[]).then(e=>e.default):a(()=>import("./index-He5kaR9n.js"),[]).then(e=>e.wallet);case"app.outlawgames":return t?a(()=>import("./image-BPqXYngz.js"),[]).then(e=>e.default):a(()=>import("./index-D2hPph8l.js"),[]).then(e=>e.wallet);case"io.ironwallet":return t?a(()=>import("./image-BKNtkg6s.js"),[]).then(e=>e.default):a(()=>import("./index-B1-qcL-p.js"),[]).then(e=>e.wallet);case"com.mecowallet":return t?a(()=>import("./image-m7IlStdm.js"),[]).then(e=>e.default):a(()=>import("./index-BdgyG9Qa.js"),[]).then(e=>e.wallet);case"com.onlybulls":return t?a(()=>import("./image-qLUwfjzV.js"),[]).then(e=>e.default):a(()=>import("./index-DPPIbXj8.js"),[]).then(e=>e.wallet);case"me.qiewallet":return t?a(()=>import("./image-BHJFFIIN.js"),[]).then(e=>e.default):a(()=>import("./index-D6zAueb_.js"),[]).then(e=>e.wallet);case"fund.lflabs":return t?a(()=>import("./image-dO78_uyn.js"),[]).then(e=>e.default):a(()=>import("./index-BBkeSt5m.js"),[]).then(e=>e.wallet);case"io.walletverse":return t?a(()=>import("./image-DUk3AUBd.js"),[]).then(e=>e.default):a(()=>import("./index-CfO_m3oL.js"),[]).then(e=>e.wallet);case"com.berasig":return t?a(()=>import("./image-CisWvLpc.js"),[]).then(e=>e.default):a(()=>import("./index-Cg1E5HxJ.js"),[]).then(e=>e.wallet);case"app.phantom":return t?a(()=>import("./image-6levnvAC.js"),[]).then(e=>e.default):a(()=>import("./index-IBUgXgOa.js"),[]).then(e=>e.wallet);case"com.coinbase.wallet":return t?a(()=>import("./image-C6EsuPXB.js"),[]).then(e=>e.default):a(()=>import("./index-BILUwmJ9.js"),[]).then(e=>e.wallet);case"io.rabby":return t?a(()=>import("./image-CZ2qSHpt.js"),[]).then(e=>e.default):a(()=>import("./index-Bprjmfje.js"),[]).then(e=>e.wallet);case"com.brave.wallet":return t?a(()=>import("./image-9Jtg22X3.js"),[]).then(e=>e.default):a(()=>import("./index-DKbx-y78.js"),[]).then(e=>e.wallet);case"fi.nu":return t?a(()=>import("./image-BAl5qyeX.js"),[]).then(e=>e.default):a(()=>import("./index-BXi61TZ5.js"),[]).then(e=>e.wallet);case"pro.hinkal.walletconnect":return t?a(()=>import("./image-d8n8A6si.js"),[]).then(e=>e.default):a(()=>import("./index-CujrNB-Q.js"),[]).then(e=>e.wallet);case"com.moongate.one":return t?a(()=>import("./image-DZc2BYzk.js"),[]).then(e=>e.default):a(()=>import("./index-B2WV7sR7.js"),[]).then(e=>e.wallet);case"tech.levain":return t?a(()=>import("./image-DcIu3U38.js"),[]).then(e=>e.default):a(()=>import("./index-CEpc_g8h.js"),[]).then(e=>e.wallet);case"com.enkrypt":return t?a(()=>import("./image-DvpdMMzF.js"),[]).then(e=>e.default):a(()=>import("./index-Cc4uopde.js"),[]).then(e=>e.wallet);case"com.scramble":return t?a(()=>import("./image-DT5Fvf2s.js"),[]).then(e=>e.default):a(()=>import("./index-D4Sgj1mL.js"),[]).then(e=>e.wallet);case"io.finoa":return t?a(()=>import("./image-D_i0o0Nv.js"),[]).then(e=>e.default):a(()=>import("./index-DFghxfjK.js"),[]).then(e=>e.wallet);case"com.blazpay.wallet":return t?a(()=>import("./image-CgHABHdL.js"),[]).then(e=>e.default):a(()=>import("./index-B_OXuBhF.js"),[]).then(e=>e.wallet);case"io.getjoin.prd":return t?a(()=>import("./image-CmWdSXJI.js"),[]).then(e=>e.default):a(()=>import("./index-QvBzJwgv.js"),[]).then(e=>e.wallet);case"xyz.talisman":return t?a(()=>import("./image-VlTaWJmy.js"),[]).then(e=>e.default):a(()=>import("./index-BgbYZOnC.js"),[]).then(e=>e.wallet);case"eu.flashsoft.clear-wallet":return t?a(()=>import("./image-gxCVLutB.js"),[]).then(e=>e.default):a(()=>import("./index-BBiL2lyk.js"),[]).then(e=>e.wallet);case"app.berasig":return t?a(()=>import("./image-BjTMD2k8.js"),[]).then(e=>e.default):a(()=>import("./index-DkcP2fCc.js"),[]).then(e=>e.wallet);case"com.wallet.reown":return t?a(()=>import("./image-CC2_AL18.js"),[]).then(e=>e.default):a(()=>import("./index-BEx6ckei.js"),[]).then(e=>e.wallet);case"io.runonflux.sspwallet":return t?a(()=>import("./image-DfzpWAED.js"),[]).then(e=>e.default):a(()=>import("./index-CrUcAJK0.js"),[]).then(e=>e.wallet);case"com.blanqlabs.wallet":return t?a(()=>import("./image-wR942Jk6.js"),[]).then(e=>e.default):a(()=>import("./index-DBst6Hla.js"),[]).then(e=>e.wallet);case"io.hero.wallet":return t?a(()=>import("./image-BbH7e9pw.js"),[]).then(e=>e.default):a(()=>import("./index-BBANTdk4.js"),[]).then(e=>e.wallet);case"network.verified.custody":return t?a(()=>import("./image-DpjDzWCs.js"),[]).then(e=>e.default):a(()=>import("./index-CyhgnW_d.js"),[]).then(e=>e.wallet);case"console.utila.io":return t?a(()=>import("./image-C7tHBnQp.js"),[]).then(e=>e.default):a(()=>import("./index-BrOCsLbf.js"),[]).then(e=>e.wallet);case"com.micet.wallet":return t?a(()=>import("./image-On2ij4Ix.js"),[]).then(e=>e.default):a(()=>import("./index-JAAqCLcG.js"),[]).then(e=>e.wallet);case"world.dolphinode.chain":return t?a(()=>import("./image-BXzPnbc4.js"),[]).then(e=>e.default):a(()=>import("./index-CiwBOkla.js"),[]).then(e=>e.wallet);case"com.lootrush":return t?a(()=>import("./image-t4jvKgpV.js"),[]).then(e=>e.default):a(()=>import("./index-BLsnOBhg.js"),[]).then(e=>e.wallet);case"xyz.dawnwallet":return t?a(()=>import("./image-bpacFMFT.js"),[]).then(e=>e.default):a(()=>import("./index-BqK7Phb6.js"),[]).then(e=>e.wallet);case"xyz.abs":return t?a(()=>import("./image-DFo7XMVJ.js"),[]).then(e=>e.default):a(()=>import("./index-8Ff6vDUD.js"),[]).then(e=>e.wallet);case"sh.frame":return t?a(()=>import("./image-C1w2WpL5.js"),[]).then(e=>e.default):a(()=>import("./index-cAvSYrmF.js"),[]).then(e=>e.wallet);case"io.useglyph":return t?a(()=>import("./image-C46yxCl4.js"),[]).then(e=>e.default):a(()=>import("./index-DE_8irSD.js"),[]).then(e=>e.wallet);case"org.base.account":return t?a(()=>import("./image-Ds78yECl.js"),[]).then(e=>e.default):a(()=>import("./index-kNZGxYSe.js"),[]).then(e=>e.wallet);default:throw new Error(`Wallet with id ${r} not found`)}}function lh(){const r=new Map;return{emit(t,e){const n=r.get(t);if(n)for(const i of n)i(e)},subscribe(t,e){var n;return r.has(t)?(n=r.get(t))==null||n.add(e):r.set(t,new Set([e])),()=>{const i=r.get(t);i&&i.delete(e)}}}}function ur(){return lh()}function uh(r){const{createOptions:t}=r,e=ur();let n,i;function s(){n=void 0,i=void 0}let o=async()=>{},c=async d=>{i=d};const l=e.subscribe("chainChanged",d=>{i=d}),u=e.subscribe("disconnect",()=>{s(),l(),u()});return e.subscribe("accountChanged",d=>{n=d}),{autoConnect:async d=>{const{autoConnectBaseAccountSDK:h}=await a(async()=>{const{autoConnectBaseAccountSDK:b}=await Promise.resolve().then(()=>vo);return{autoConnectBaseAccountSDK:b}},void 0),p=await r.providerFactory(),[_,f,m,y]=await h(d,e,p);return n=_,i=f,o=m,c=y,Be({chainId:i.id,client:d.client,walletAddress:n.address,walletType:Tt}),n},connect:async d=>{const{connectBaseAccountSDK:h}=await a(async()=>{const{connectBaseAccountSDK:b}=await Promise.resolve().then(()=>vo);return{connectBaseAccountSDK:b}},void 0),p=await r.providerFactory(),[_,f,m,y]=await h(d,e,p);return n=_,i=f,o=m,c=y,Be({chainId:i.id,client:d.client,walletAddress:n.address,walletType:Tt}),n},disconnect:async()=>{s(),await o()},getAccount:()=>n,getChain(){if(i)return i=cr(i.id)||i,i},getConfig:()=>t,id:Tt,subscribe:e.subscribe,switchChain:async d=>{await c(d)}}}function jn(){if(!xc())return{description:"thirdweb powered dApp",logoUrl:"https://thirdweb.com/favicon.ico",name:"thirdweb powered dApp",url:"https://thirdweb.com"};const{protocol:r,hostname:t,port:e}=window.location;let n=`${r}//${t}`;e&&e!=="80"&&e!=="443"&&(n+=`:${e}`);const i=`${n}/favicon.ico`;return{description:window.document.title||"thirdweb powered dApp",logoUrl:i,name:window.document.title||"thirdweb powered dApp",url:n}}let pi,En;async function Uc(r){var s,o,c,l,u,d,h;if(pi){if(r&&En){const p=((s=En.chains)==null?void 0:s.map(y=>y.id))||[],_=((o=r.chains)==null?void 0:o.map(y=>y.id))||[],f=p.length===_.length&&p.every((y,b)=>y===_[b]),m=((c=r.appMetadata)==null?void 0:c.name)===((l=En.appMetadata)==null?void 0:l.name);(!f||!m)&&console.warn("[Base Account SDK] Provider already initialized with different options. The Base Account SDK uses a singleton provider - subsequent configurations are ignored. Create only one Base Account wallet instance per application.")}return pi}const{createBaseAccountSDK:t}=await a(async()=>{const{createBaseAccountSDK:p}=await import("./index-CHDNpoUG.js");return{createBaseAccountSDK:p}},__vite__mapDeps([8,9,10,1,2,3,6,4,5])),e=jn(),i=t({appName:((u=r==null?void 0:r.appMetadata)==null?void 0:u.name)||e.name||"thirdweb powered dApp",appLogoUrl:((d=r==null?void 0:r.appMetadata)==null?void 0:d.logoUrl)||e.logoUrl||null,appChainIds:((h=r==null?void 0:r.chains)==null?void 0:h.map(p=>p.id))||[]}).getProvider();return pi=i,En=r,i}function qc(r){return r.id===Tt}function Eo({provider:r,address:t,client:e}){const n={address:Q(t),async sendTransaction(i){const s=await r.request({method:"eth_sendTransaction",params:[{accessList:i.accessList,data:i.data,from:Q(t),gas:i.gas?De(i.gas):void 0,to:i.to,value:i.value?De(i.value):void 0}]});return Rs({chainId:i.chainId,client:e,contractAddress:i.to??void 0,gasPrice:i.gasPrice,transactionHash:s,walletAddress:Q(t),walletType:Tt}),{transactionHash:s}},async signMessage({message:i}){if(!n.address)throw new Error("Provider not setup");const s=typeof i=="string"?Ps(i):i.raw instanceof Uint8Array?Os(i.raw):i.raw,o=await r.request({method:"personal_sign",params:[s,n.address]});if(!en(o))throw new Error("Invalid signature returned");return o},async signTypedData(i){if(!n.address)throw new Error("Provider not setup");const{domain:s,message:o,primaryType:c}=Cs(i),l={EIP712Domain:Ec(s),...i.types};vc({domain:s,message:o,primaryType:c,types:l});const u=bc({domain:s??{},message:o,primaryType:c,types:l}),d=await r.request({method:"eth_signTypedData_v4",params:[n.address,u]});if(!en(d))throw new Error("Invalid signed payload returned");return d},sendCalls:async i=>{try{const{callParams:s,chain:o}=await Ns(i,n),c=await r.request({method:"wallet_sendCalls",params:s});return c&&typeof c=="object"&&"id"in c?{chain:o,client:e,id:c.id}:{chain:o,client:e,id:c}}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${Tt} errored calling wallet_sendCalls, with error: ${s instanceof Error?s.message:we(s)}`):s}},async getCallsStatus(i){try{const s=await r.request({method:"wallet_getCallsStatus",params:[i.id]});return $s(s)}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${Tt} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):s}},async getCapabilities(i){const s=i.chainId;try{const o=await r.request({method:"wallet_getCapabilities",params:[Q(n.address)]});return ks(o,s)}catch(o){if(/unsupport|not support|not available/i.test(o.message))return{message:`${Tt} does not support wallet_getCapabilities, reach out to them directly to request EIP-5792 support.`};throw o}}};return n}function Mc(r,t,e,n,i){const s=Eo({address:r,client:i,provider:e});async function o(){e.off("accountsChanged",l),e.off("chainChanged",u),e.off("disconnect",c),await e.disconnect()}async function c(){o(),n.emit("disconnect",void 0)}function l(d){if(d[0]){const h=Eo({address:Q(d[0]),client:i,provider:e});n.emit("accountChanged",h),n.emit("accountsChanged",d)}else c()}function u(d){const h=ge(ct(d));n.emit("chainChanged",h)}return e.on("accountsChanged",l),e.on("chainChanged",u),e.on("disconnect",c),[s,t,c,d=>Bc(e,d)]}async function dh(r,t,e){const n=await e.request({method:"eth_requestAccounts"});if(!n[0])throw new Error("No accounts found");const i=Q(n[0]),s=await e.request({method:"eth_chainId"}),o=ct(s);let c=r.chain&&r.chain.id===o?r.chain:ge(o);return o&&(r!=null&&r.chain)&&o!==(r==null?void 0:r.chain.id)&&(await Bc(e,r.chain),c=r.chain),Mc(i,c,e,t,r.client)}async function hh(r,t,e){const i=(await e.request({method:"eth_accounts"}))[0];if(!i)throw new Error("No accounts found");const s=await e.request({method:"eth_chainId"}),o=ct(s),c=r.chain&&r.chain.id===o?r.chain:ge(o);return Mc(i,c,e,t,r.client)}async function Bc(r,t){var s;const e=await r.request({method:"eth_chainId"}),n=ge(ct(e));if((n==null?void 0:n.id)===t.id)return;const i=De(t.id);try{await r.request({method:"wallet_switchEthereumChain",params:[{chainId:i}]})}catch(o){const c=await Ts(t);(o==null?void 0:o.code)===4902&&await r.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:((s=c.explorers)==null?void 0:s.map(l=>l.url))||[],chainId:i,chainName:c.name,nativeCurrency:c.nativeCurrency,rpcUrls:Us(c)}]})}}const vo=Object.freeze(Object.defineProperty({__proto__:null,autoConnectBaseAccountSDK:hh,connectBaseAccountSDK:dh,getBaseAccountWebProvider:Uc,isBaseAccountSDKWallet:qc},Symbol.toStringTag,{value:"Module"}));function ph(r){const{createOptions:t}=r,e=ur();let n,i;function s(){n=void 0,i=void 0}let o=async()=>{},c=async d=>{i=d};const l=e.subscribe("chainChanged",d=>{i=d}),u=e.subscribe("disconnect",()=>{s(),l(),u()});return e.subscribe("accountChanged",d=>{n=d}),{autoConnect:async d=>{const{autoConnectCoinbaseWalletSDK:h}=await a(async()=>{const{autoConnectCoinbaseWalletSDK:b}=await Promise.resolve().then(()=>Io);return{autoConnectCoinbaseWalletSDK:b}},void 0),p=await r.providerFactory(),[_,f,m,y]=await h(d,e,p);return n=_,i=f,o=m,c=y,Be({chainId:i.id,client:d.client,walletAddress:n.address,walletType:_t}),n},connect:async d=>{const{connectCoinbaseWalletSDK:h}=await a(async()=>{const{connectCoinbaseWalletSDK:b}=await Promise.resolve().then(()=>Io);return{connectCoinbaseWalletSDK:b}},void 0),p=await r.providerFactory(),[_,f,m,y]=await h(d,e,p);return n=_,i=f,o=m,c=y,Be({chainId:i.id,client:d.client,walletAddress:n.address,walletType:_t}),n},disconnect:async()=>{s(),await o()},getAccount:()=>n,getChain(){if(i)return i=cr(i.id)||i,i},getConfig:()=>t,id:_t,onConnectRequested:async()=>{var d;if(r.onConnectRequested){const h=await r.providerFactory();return(d=r.onConnectRequested)==null?void 0:d.call(r,h)}},subscribe:e.subscribe,switchChain:async d=>{await c(d)}}}async function jc(r){var t,e;await((e=(t=r==null?void 0:r.communicator)==null?void 0:t.waitForPopupLoaded)==null?void 0:e.call(t))}const _h=Object.freeze(Object.defineProperty({__proto__:null,showCoinbasePopup:jc},Symbol.toStringTag,{value:"Module"}));let _i;async function zc(r){var t,e;if(!_i){let n=(await a(()=>import("./index-iqDoByK8.js"),__vite__mapDeps([11,2,3,1,10,9]))).default;typeof n!="function"&&typeof n.default=="function"&&(n=n.default);const s=new n({appChainIds:r!=null&&r.chains?r.chains.map(o=>o.id):void 0,appLogoUrl:((t=r==null?void 0:r.appMetadata)==null?void 0:t.logoUrl)||jn().logoUrl,appName:((e=r==null?void 0:r.appMetadata)==null?void 0:e.name)||jn().name}).makeWeb3Provider(r==null?void 0:r.walletConfig);return _i=s,s}return _i}function bo({provider:r,address:t,client:e}){const n={address:Q(t),onTransactionRequested:async()=>{window.localStorage&&window.localStorage.getItem("-CBWSDK:SignerConfigurator:SignerType")==="scw"&&await jc(r)},async sendTransaction(i){const s=await r.request({method:"eth_sendTransaction",params:[{accessList:i.accessList,data:i.data,from:Q(t),gas:i.gas?De(i.gas):void 0,to:i.to,value:i.value?De(i.value):void 0}]});return Rs({chainId:i.chainId,client:e,contractAddress:i.to??void 0,gasPrice:i.gasPrice,transactionHash:s,walletAddress:Q(t),walletType:_t}),{transactionHash:s}},async signMessage({message:i}){if(!n.address)throw new Error("Provider not setup");const s=typeof i=="string"?Ps(i):i.raw instanceof Uint8Array?Os(i.raw):i.raw,o=await r.request({method:"personal_sign",params:[s,n.address]});if(!en(o))throw new Error("Invalid signature returned");return o},async signTypedData(i){if(!n.address)throw new Error("Provider not setup");const{domain:s,message:o,primaryType:c}=Cs(i),l={EIP712Domain:Ec(s),...i.types};vc({domain:s,message:o,primaryType:c,types:l});const u=bc({domain:s??{},message:o,primaryType:c,types:l}),d=await r.request({method:"eth_signTypedData_v4",params:[n.address,u]});if(!en(d))throw new Error("Invalid signed payload returned");return d},sendCalls:async i=>{try{const{callParams:s,chain:o}=await Ns(i,n),c=await r.request({method:"wallet_sendCalls",params:s});return c&&typeof c=="object"&&"id"in c?{chain:o,client:e,id:c.id}:{chain:o,client:e,id:c}}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${_t} errored calling wallet_sendCalls, with error: ${s instanceof Error?s.message:we(s)}`):s}},async getCallsStatus(i){try{const s=await r.request({method:"wallet_getCallsStatus",params:[i.id]});return $s(s)}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${_t} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):s}},async getCallsStatusRaw(i){try{return await r.request({method:"wallet_getCallsStatus",params:[i.id]})}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${_t} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):s}},async getCapabilities(i){const s=i.chainId;try{const o=await r.request({method:"wallet_getCapabilities",params:[Q(n.address)]});return ks(o,s)}catch(o){if(/unsupport|not support|not available/i.test(o.message))return{message:`${_t} does not support wallet_getCapabilities, reach out to them directly to request EIP-5792 support.`};throw o}}};return n}function Kc(r,t,e,n,i){const s=bo({address:r,client:i,provider:e});async function o(){e.removeListener("accountsChanged",l),e.removeListener("chainChanged",u),e.removeListener("disconnect",c),await e.disconnect()}async function c(){o(),n.emit("disconnect",void 0)}function l(d){if(d[0]){const h=bo({address:Q(d[0]),client:i,provider:e});n.emit("accountChanged",h),n.emit("accountsChanged",d)}else c()}function u(d){const h=ge(ct(d));n.emit("chainChanged",h)}return e.on("accountsChanged",l),e.on("chainChanged",u),e.on("disconnect",c),[s,t,c,d=>Fc(e,d)]}async function fh(r,t,e){const n=await e.request({method:"eth_requestAccounts"});if(!n[0])throw new Error("No accounts found");const i=Q(n[0]),s=await e.request({method:"eth_chainId"}),o=ct(s);let c=r.chain&&r.chain.id===o?r.chain:ge(o);return o&&(r!=null&&r.chain)&&o!==(r==null?void 0:r.chain.id)&&(await Fc(e,r.chain),c=r.chain),Kc(i,c,e,t,r.client)}async function mh(r,t,e){const i=(await e.request({method:"eth_accounts"}))[0];if(!i)throw new Error("No accounts found");const s=await e.request({method:"eth_chainId"}),o=ct(s),c=r.chain&&r.chain.id===o?r.chain:ge(o);return Kc(i,c,e,t,r.client)}async function Fc(r,t){var s;const e=await r.request({method:"eth_chainId"}),n=ge(ct(e));if((n==null?void 0:n.id)===t.id)return;const i=De(t.id);try{await r.request({method:"wallet_switchEthereumChain",params:[{chainId:i}]})}catch(o){const c=await Ts(t);(o==null?void 0:o.code)===4902&&await r.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:((s=c.explorers)==null?void 0:s.map(l=>l.url))||[],chainId:i,chainName:c.name,nativeCurrency:c.nativeCurrency,rpcUrls:Us(c)}]})}}const Io=Object.freeze(Object.defineProperty({__proto__:null,autoConnectCoinbaseWalletSDK:mh,connectCoinbaseWalletSDK:fh,getCoinbaseWebProvider:zc},Symbol.toStringTag,{value:"Module"}));async function yh(r){return Ic(async()=>{var n;const e=await(await fetch(`${Yn("inAppWallet")}/api/2024-05-05/ecosystem-wallet`,{headers:{"x-ecosystem-id":r}})).json();if(!e||e.code==="UNAUTHORIZED")throw new Error(e.message||`Could not find ecosystem wallet with id ${r}, please check your ecosystem wallet configuration.`);return(n=e.authOptions)!=null&&n.includes("siwe")&&(e.authOptions=e.authOptions.filter(i=>i!=="siwe"),e.authOptions.push("wallet")),e},{cacheKey:`ecosystem-wallet-options-${r}`,cacheTime:1e3*60*5})}const fi=new Map;async function zr(r,t,e){var s;const n=we({clientId:r.clientId,ecosystem:e,partialSecretKey:(s=r.secretKey)==null?void 0:s.slice(0,5)});if(fi.has(n))return fi.get(n);const i=await t(r);return fi.set(n,i),i}function Wc(r){const{createOptions:t,connectorFactory:e,ecosystem:n}=r,i=n?n.id:"inApp",s=ur();let o=t,c,l,u,d,h=null;const p=async _=>{if(n){const f=await yh(n.id),m=f==null?void 0:f.smartAccountOptions;if(m)if(f.smartAccountOptions.executionMode==="EIP7702")o={...o,executionMode:{mode:"EIP7702",sponsorGas:m.sponsorGas}};else{const{defaultChainId:b}=f.smartAccountOptions,R=(_==null?void 0:_.chain)??(b?ge(b):void 0);if(!R)throw new Error("A chain must be provided either via 'chain' in connect options or 'defaultChainId' in ecosystem configuration. Please pass it via connect() or update the ecosystem configuration.");o={...o,smartAccount:{chain:R,factoryAddress:m.accountFactoryAddress,sponsorGas:m.sponsorGas}}}}};return{autoConnect:async _=>{const{autoConnectInAppWallet:f}=await a(async()=>{const{autoConnectInAppWallet:v}=await Promise.resolve().then(()=>qi);return{autoConnectInAppWallet:v}},void 0),m=await zr(_.client,e,n);await p();const{account:y,chain:b,adminAccount:R}=await f(_,o,m);d=_.client,c=y,l=R,u=b;try{h=await m.storage.getAuthCookie()}catch(v){console.error("Failed to retrieve auth token:",v),h=null}return Be({chainId:u.id,client:_.client,ecosystem:n,walletAddress:c.address,walletType:i}),c},connect:async _=>{const{connectInAppWallet:f}=await a(async()=>{const{connectInAppWallet:v}=await Promise.resolve().then(()=>qi);return{connectInAppWallet:v}},void 0),m=await zr(_.client,e,n);await p();const{account:y,chain:b,adminAccount:R}=await f(_,o,m);d=_.client,c=y,l=R,u=b;try{h=await m.storage.getAuthCookie()}catch(v){console.error("Failed to retrieve auth token:",v),h=null}return Be({chainId:u.id,client:_.client,ecosystem:n,walletAddress:c.address,walletType:i}),c},disconnect:async()=>{if(d&&!(await(await zr(d,e,n)).logout()).success)throw new Error("Failed to logout");c=void 0,l=void 0,u=void 0,h=null,s.emit("disconnect",void 0)},getAccount:()=>c,getAdminAccount:()=>l,getAuthToken:()=>h,getChain(){if(u)return u=cr(u.id)||u,u},getConfig:()=>o,id:i,subscribe:s.subscribe,switchChain:async _=>{var f;if((o!=null&&o.smartAccount||((f=o==null?void 0:o.executionMode)==null?void 0:f.mode)==="EIP4337")&&d&&c){const{autoConnectInAppWallet:m}=await a(async()=>{const{autoConnectInAppWallet:P}=await Promise.resolve().then(()=>qi);return{autoConnectInAppWallet:P}},void 0),y=await zr(d,e,n);await p({chain:_});const{account:b,chain:R,adminAccount:v}=await m({chain:_,client:d},o,y);l=v,c=b,u=R}else u=_;s.emit("chainChanged",_)}}}function Hc(...r){const[t,e]=r,n={id:t,partnerId:e==null?void 0:e.partnerId};return Wc({connectorFactory:async i=>{const{InAppWebConnector:s}=await a(async()=>{const{InAppWebConnector:o}=await import("./web-connector-DB6vmoMW.js");return{InAppWebConnector:o}},__vite__mapDeps([12,1,2,3,4,5,6,7]));return new s({client:i,ecosystem:n,storage:e==null?void 0:e.storage})},createOptions:{auth:{...e==null?void 0:e.auth,options:[]},partnerId:n.partnerId},ecosystem:n})}function zi(r){return Wc({connectorFactory:async t=>{var n;const{InAppWebConnector:e}=await a(async()=>{const{InAppWebConnector:i}=await import("./web-connector-DB6vmoMW.js");return{InAppWebConnector:i}},__vite__mapDeps([12,1,2,3,4,5,6,7]));return new e({client:t,passkeyDomain:(n=r==null?void 0:r.auth)==null?void 0:n.passkeyDomain,storage:r==null?void 0:r.storage})},createOptions:r})}function Ms(r){const t=ur();let e,n,i,s;return{autoConnect:async o=>{const{connectSmartAccount:c}=await a(async()=>{const{connectSmartAccount:d}=await import("./index-BWLGPCDE.js");return{connectSmartAccount:d}},__vite__mapDeps([13,1,14,2,3,4,5,6,7])),[l,u]=await c(o,r);return s=o,e=l,i=u,Be({chainId:i.id,client:o.client,walletAddress:e.address,walletType:"smart"}),e},connect:async o=>{const{connectSmartAccount:c}=await a(async()=>{const{connectSmartAccount:d}=await import("./index-BWLGPCDE.js");return{connectSmartAccount:d}},__vite__mapDeps([13,1,14,2,3,4,5,6,7])),[l,u]=await c(o,r);return n=o.personalAccount,s=o,e=l,i=u,Be({chainId:i.id,client:o.client,walletAddress:e.address,walletType:"smart"}),t.emit("accountChanged",e),e},disconnect:async()=>{if(e){const{disconnectSmartAccount:o}=await a(async()=>{const{disconnectSmartAccount:c}=await import("./index-BWLGPCDE.js");return{disconnectSmartAccount:c}},__vite__mapDeps([13,1,14,2,3,4,5,6,7]));await o(e)}e=void 0,n=void 0,i=void 0,t.emit("disconnect",void 0)},getAccount:()=>e,getAdminAccount:()=>n,getChain(){if(i)return i=cr(i.id)||i,i},getConfig:()=>r,id:"smart",subscribe:t.subscribe,switchChain:async o=>{var h;if(!s)throw new Error("Cannot switch chain without a previous connection");if(!await Hu(o)){const p=Ls({address:r.factoryAddress||Gu((h=r.overrides)==null?void 0:h.entrypointAddress),chain:o,client:s.client});if(!await Ju(p))throw new Error(`Factory contract not deployed on chain: ${o.id}`)}const{connectSmartAccount:l}=await a(async()=>{const{connectSmartAccount:p}=await import("./index-BWLGPCDE.js");return{connectSmartAccount:p}},__vite__mapDeps([13,1,14,2,3,4,5,6,7])),[u,d]=await l({...s,chain:o},{...r,chain:o});e=u,i=d,t.emit("accountChanged",u),t.emit("chainChanged",d)}}}function ot(...r){const[t,e]=r;switch(!0){case t==="smart":return Ms(e);case(t==="embedded"||t==="inApp"):return zi(e);case Pr(t):return Hc(...r);case t===_t:{const n=e;return ph({createOptions:n,onConnectRequested:async i=>{const{showCoinbasePopup:s}=await a(async()=>{const{showCoinbasePopup:o}=await Promise.resolve().then(()=>_h);return{showCoinbasePopup:o}},void 0);return s(i)},providerFactory:()=>zc(n)})}case t===Tt:{const n=e;return uh({createOptions:n,providerFactory:()=>Uc(n)})}default:{let c=function(){i=void 0,s=void 0};const n=ur();let i,s,o,l=async()=>{};const u=n.subscribe("disconnect",()=>{c(),o==null||o(),u()});n.subscribe("accountChanged",_=>{i=_});let d=async()=>{throw new Error("Not implemented yet")};const h=go()?_=>hi(_):void 0,p={autoConnect:async _=>{const{injectedProvider:f}=await a(async()=>{const{injectedProvider:m}=await Promise.resolve().then(()=>To);return{injectedProvider:m}},void 0);if(t!=="walletConnect"&&f(t)){const{autoConnectEip1193Wallet:m}=await a(async()=>{const{autoConnectEip1193Wallet:P}=await Promise.resolve().then(()=>Oo);return{autoConnectEip1193Wallet:P}},void 0),[y,b,R,v]=await m({chain:_.chain,client:_.client,emitter:n,id:t,provider:Ki(t)});return i=y,s=b,l=R,d=v,o=n.subscribe("chainChanged",P=>{s=P}),Be({chainId:s.id,client:_.client,walletAddress:i.address,walletType:t}),i}if(_&&"client"in _){const{autoConnectWC:m}=await a(async()=>{const{autoConnectWC:P}=await import("./controller-DyfP9sLB.js");return{autoConnectWC:P}},__vite__mapDeps([15,1,2,3,4,5,6,7])),[y,b,R,v]=await m(_,n,p.id,Bn,h);return i=y,s=b,l=R,d=v,Be({chainId:s.id,client:_.client,walletAddress:i.address,walletType:t}),i}throw new Error("Failed to auto connect")},connect:async _=>{async function f(b){var P;const{connectWC:R}=await a(async()=>{const{connectWC:T}=await import("./controller-DyfP9sLB.js");return{connectWC:T}},__vite__mapDeps([15,1,2,3,4,5,6,7]));let v;try{const[T,g,D,L]=await R({...b,walletConnect:{...b.walletConnect,onDisplayUri:((P=b.walletConnect)==null?void 0:P.onDisplayUri)||(async w=>{var E,I;if(typeof window<"u"&&typeof document<"u")if(go()){const A=await Nc(t),V=A.mobile.native||A.mobile.universal;hi(V?ih(V,w).redirect:w);return}else try{const{createQROverlay:A}=await a(async()=>{const{createQROverlay:V}=await import("./qr-overlay-JoNyL3_J.js");return{createQROverlay:V}},__vite__mapDeps([16,1]));v&&v.destroy(),v=A(w,{theme:((I=(E=b.walletConnect)==null?void 0:E.qrModalOptions)==null?void 0:I.themeMode)??"dark",qrSize:280,showCloseButton:!0,onCancel:()=>{var V,O;(O=(V=b.walletConnect)==null?void 0:V.onCancel)==null||O.call(V)}})}catch(A){console.error("Failed to create QR overlay:",A)}})}},n,p.id,Bn,h);return v&&(v.destroy(),v=void 0),i=T,s=g,l=D,d=L,Be({chainId:s.id,client:b.client,walletAddress:i.address,walletType:t}),i}catch(T){throw v&&(v.destroy(),v=void 0),T}}if(t==="walletConnect"){const{client:b,chain:R,...v}=_;return f({chain:R,client:b,walletConnect:{...v}})}const m=_&&"walletConnect"in _,{injectedProvider:y}=await a(async()=>{const{injectedProvider:b}=await Promise.resolve().then(()=>To);return{injectedProvider:b}},void 0);if(y(t)&&!m){const{connectEip1193Wallet:b}=await a(async()=>{const{connectEip1193Wallet:g}=await Promise.resolve().then(()=>Oo);return{connectEip1193Wallet:g}},void 0),[R,v,P,T]=await b({chain:_.chain,client:_.client,emitter:n,id:t,provider:Ki(t)});return i=R,s=v,l=P,d=T,o=n.subscribe("chainChanged",g=>{s=g}),Be({chainId:s.id,client:_.client,walletAddress:i.address,walletType:t}),i}if(_&&"client"in _)return f(_);throw new Error("Failed to connect")},disconnect:async()=>{c(),await l()},getAccount:()=>i,getChain(){if(s)return s=cr(s.id)||s,s},getConfig:()=>r[1],id:t,subscribe:n.subscribe,switchChain:async _=>{try{await d(_),s=_}catch(f){console.error("Error switching chain",f)}}};return p}}}function wh(){return ot("walletConnect")}const Ao=xc()?Xd():void 0;function Bs(r){const t=js().find(e=>e.info.rdns===r);return t==null?void 0:t.provider}function Gc(){return js().map(e=>e.info.rdns).map(e=>ot(e))}function gh(){if(Ao)return Ao}function js(){var t;const r=((t=gh())==null?void 0:t.getProviders())||[];for(const e of r)if(e.info.rdns==="io.metamask.mobile"){e.info.rdns=Cc;break}return r}const To=Object.freeze(Object.defineProperty({__proto__:null,getInstalledWalletProviders:js,getInstalledWallets:Gc,injectedProvider:Bs},Symbol.toStringTag,{value:"Module"}));function Ki(r){const t=Bs(r);if(!t)throw new Error(`No injected provider found for wallet: "${r}"`);return t}async function Jc({id:r,provider:t,emitter:e,client:n,chain:i}){var p,_;let s,c=0;for(;!(s!=null&&s[0])&&c<3;){try{s=await t.request({method:"eth_requestAccounts"})}catch(f){if(console.error(f),(_=(p=Eh(f))==null?void 0:p.toLowerCase())!=null&&_.includes("rejected"))throw f;await new Promise(m=>setTimeout(m,500))}c++}const l=s==null?void 0:s[0];if(!l)throw new Error("Failed to connect to wallet, no accounts available");const u=Q(l),d=await t.request({method:"eth_chainId"}).then(ct).catch(f=>{throw new Error("Error reading chainId from provider",f)});let h=i&&i.id===d?i:ge(d);try{i&&typeof i.id<"u"&&i.id!==d&&(await Yc(t,i),h=i)}catch{console.warn(`Error switching to chain ${i==null?void 0:i.id} - defaulting to wallet chain (${d})`)}return Qc({address:u,chain:h,client:n,emitter:e,id:r,provider:t})}async function Zc({id:r,provider:t,emitter:e,client:n,chain:i}){const o=(await t.request({method:"eth_accounts"}))[0];if(!o)throw new Error("Failed to connect to wallet, no accounts available");const c=Q(o),l=await t.request({method:"eth_chainId"}).then(ct),u=i&&i.id===l?i:ge(l);return Qc({address:c,chain:u,client:n,emitter:e,id:r,provider:t})}function Po({provider:r,address:t,client:e,id:n}){const i={address:Q(t),async sendTransaction(s){const c=[{...s.gasPrice?{gasPrice:De(s.gasPrice)}:{maxFeePerGas:s.maxFeePerGas?De(s.maxFeePerGas):void 0,maxPriorityFeePerGas:s.maxPriorityFeePerGas?De(s.maxPriorityFeePerGas):void 0},from:this.address,gas:s.gas?De(s.gas):void 0,nonce:s.nonce?De(s.nonce):void 0,to:s.to?Q(s.to):void 0,data:s.data,value:s.value?De(s.value):void 0,authorizationList:s.authorizationList?td(s.authorizationList):void 0,accessList:s.accessList,...s.eip712}];try{const l=await r.request({method:"eth_sendTransaction",params:c});return Rs({chainId:s.chainId,client:e,contractAddress:s.to??void 0,gasPrice:s.gasPrice,transactionHash:l,walletAddress:Q(t),walletType:n}),{transactionHash:l}}catch(l){throw rd(l)&&nd({chainId:s.chainId,client:e,contractAddress:s.to||void 0,error:l,transactionValue:s.value,walletAddress:Q(t)}),l}},async signMessage({message:s}){if(!i.address)throw new Error("Provider not setup");const o=typeof s=="string"?Ps(s):s.raw instanceof Uint8Array?Os(s.raw):s.raw;return await r.request({method:"personal_sign",params:[o,Q(i.address)]})},async signAuthorization(s){const o=Ac(s);let c;try{c=await r.request({method:"eth_sign",params:[Q(i.address),o]})}catch{c=await r.request({method:"secp256k1_sign",params:[o]})}if(!c)throw new Error("Failed to sign authorization");const l=ed(c);return{...s,...l}},async signTypedData(s){if(!r||!i.address)throw new Error("Provider not setup");const o=Cs(s),{domain:c,message:l,primaryType:u}=o,d={EIP712Domain:Qu({domain:c}),...o.types};Yu({domain:c,message:l,primaryType:u,types:d});const h=Xu({domain:c??{},message:l,primaryType:u,types:d});return await r.request({method:"eth_signTypedData_v4",params:[Q(i.address),h]})},async watchAsset(s){return await r.request({method:"wallet_watchAsset",params:s},{retryCount:0})},async sendCalls(s){try{const{callParams:o,chain:c}=await Ns(s,i),l=await r.request({method:"wallet_sendCalls",params:o});return l&&typeof l=="object"&&"id"in l?{chain:c,client:e,id:l.id}:{chain:c,client:e,id:l}}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${n} errored calling wallet_sendCalls, with error: ${o instanceof Error?o.message:Zu(o)}`):o}},async getCallsStatus(s){try{const o=await r.request({method:"wallet_getCallsStatus",params:[s.id]});return $s(o)}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${n} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):o}},async getCallsStatusRaw(s){try{return await r.request({method:"wallet_getCallsStatus",params:[s.id]})}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${n} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):o}},async getCapabilities(s){const o=s.chainId;try{const c=await r.request({method:"wallet_getCapabilities",params:[Q(i.address),o?[De(o)]:void 0]});return ks(c,o)}catch(c){if(/unsupport|not support|not available/i.test(c.message))return{message:`${n} does not support wallet_getCapabilities, reach out to them directly to request EIP-5792 support.`};throw c}}};return i}async function Qc({provider:r,address:t,chain:e,emitter:n,client:i,id:s}){const o=Po({address:t,client:i,id:s,provider:r});async function c(){r.removeListener("accountsChanged",u),r.removeListener("chainChanged",d),r.removeListener("disconnect",l);try{await id(()=>r.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}}async function l(){c(),n.emit("disconnect",void 0)}function u(h){if(h[0]){const p=Po({address:Q(h[0]),client:i,id:s,provider:r});n.emit("accountChanged",p),n.emit("accountsChanged",h)}else l()}function d(h){const p=ge(ct(h));n.emit("chainChanged",p)}return r.on&&(r.on("accountsChanged",u),r.on("chainChanged",d),r.on("disconnect",l)),[o,e,l,h=>Yc(r,h)]}async function Yc(r,t){var n;const e=De(t.id);try{await r.request({method:"wallet_switchEthereumChain",params:[{chainId:e}]})}catch{const i=await Ts(t);await r.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:(n=i.explorers)==null?void 0:n.map(s=>s.url),chainId:e,chainName:i.name,nativeCurrency:i.nativeCurrency,rpcUrls:Us(i)}]})}}function Eh(r){return r instanceof Error?r.message:typeof r=="string"?r:typeof r=="object"&&r!==null?JSON.stringify(r):String(r)}const Oo=Object.freeze(Object.defineProperty({__proto__:null,autoConnectEip1193Wallet:Zc,connectEip1193Wallet:Jc,getInjectedProvider:Ki},Symbol.toStringTag,{value:"Module"}));function vh(r){const t=r.walletId??"adapter",e=ur();let n,i,s;const o=async p=>(s=typeof r.provider=="function"?await r.provider(p):r.provider,s),c=e.subscribe("chainChanged",p=>{i=p});function l(){n=void 0,i=void 0}let u=async()=>{};const d=e.subscribe("disconnect",()=>{l(),c(),d()});e.subscribe("accountChanged",p=>{n=p});let h=async p=>{await(s==null?void 0:s.request({method:"wallet_switchEthereumChain",params:[{chainId:sd(p.id)}]}))};return{autoConnect:async p=>{var b;const[_,f,m,y]=await Zc({chain:p.chain,client:p.client,emitter:e,id:t,provider:await o({chainId:(b=p.chain)==null?void 0:b.id})});return n=_,i=f,u=m,h=y,e.emit("onConnect",p),Be({client:p.client,walletAddress:n.address,walletType:t}),n},connect:async p=>{var b;const[_,f,m,y]=await Jc({chain:p.chain,client:p.client,emitter:e,id:t,provider:await o({chainId:(b=p.chain)==null?void 0:b.id})});return n=_,i=f,u=m,h=y,e.emit("onConnect",p),Be({client:p.client,walletAddress:n.address,walletType:t}),n},disconnect:async()=>{l(),await u(),e.emit("disconnect",void 0)},getAccount:()=>n,getChain(){if(i)return i=cr(i.id)||i,i},getConfig:()=>{},id:t,subscribe:e.subscribe,switchChain:async p=>{await h(p),e.emit("chainChanged",p)}}}function bh(r){const{chain:t,client:e,wallet:n,connectOverride:i}=r,s=Xn({chain:t,client:e});return{on:n.subscribe,removeListener:()=>{},request:async o=>{switch(o.method){case"eth_sendTransaction":{const c=n.getAccount();if(!c)throw new Error("Account not connected");return(await Tc({account:c,transaction:Bi({...o.params[0],chain:t,client:e})})).transactionHash}case"eth_estimateGas":{const c=n.getAccount();if(!c)throw new Error("Account not connected");return od({account:c,transaction:Bi({...o.params[0],chain:t,client:e})})}case"personal_sign":{const c=n.getAccount();if(!c)throw new Error("Account not connected");return c.signMessage({message:{raw:o.params[0]}})}case"eth_signTypedData_v4":{const c=n.getAccount();if(!c)throw new Error("Account not connected");const l=JSON.parse(o.params[1]);return c.signTypedData(l)}case"eth_accounts":{const c=n.getAccount();return c?[c.address]:[]}case"eth_requestAccounts":{const c=n.getAccount();if(c)return[c.address];const l=i?await i(n):await n.connect({client:e}).catch(u=>(console.error("Error connecting wallet",u),null));if(!l)throw new Error("Unable to connect wallet - try passing a connectOverride function");return[l.address]}case"wallet_switchEthereumChain":case"wallet_addEthereumChain":{const l=o.params[0].chainId;if(!l)throw new Error("Chain ID is required");const u=Un(l)?ir(l):l,d=ge(u);return n.switchChain(d)}case"wallet_getCapabilities":{const c=n.getAccount();if(!c)throw new Error("Account not connected");if(!c.getCapabilities)throw new Error("Wallet does not support EIP-5792");const l=o.params[1];if(l&&Array.isArray(l)){const u=l[0],d=Un(u)?ir(u):Number(u);return c.getCapabilities(d?{chainId:d}:{})}return c.getCapabilities({})}case"wallet_sendCalls":{const c=n.getAccount();if(!c)throw new Error("Account not connected");if(!c.sendCalls)throw new Error("Wallet does not support EIP-5792");return c.sendCalls({...o.params[0],chain:t})}case"wallet_getCallsStatus":{const c=n.getAccount();if(!c)throw new Error("Account not connected");if(!c.getCallsStatusRaw)throw new Error("Wallet does not support EIP-5792");return await c.getCallsStatusRaw({id:o.params[0],chain:t,client:e})}default:return s(o)}}}}const Ih=Object.freeze(Object.defineProperty({__proto__:null,fromProvider:vh,toProvider:bh},Symbol.toStringTag,{value:"Module"}));function Ah(r){const t=ur();let e=r.chain;return{autoConnect:async()=>(t.emit("onConnect",r),r.adaptedAccount),connect:async()=>(t.emit("onConnect",r),r.adaptedAccount),disconnect:async()=>{await r.onDisconnect(),t.emit("disconnect",void 0)},getAccount(){return r.adaptedAccount},getChain(){return e=cr(e.id)||e,e},getConfig(){return r},id:"adapter",subscribe:t.subscribe,switchChain:async n=>{await r.switchChain(n),e=n,t.emit("chainChanged",n)}}}async function Th(){return(await a(async()=>{const{default:r}=await import("./wallet-infos-BHI_w6r-.js");return{default:r}},[])).default}async function dr(r,t){return zr(r,async e=>{const{InAppWebConnector:n}=await a(async()=>{const{InAppWebConnector:i}=await import("./web-connector-DB6vmoMW.js");return{InAppWebConnector:i}},__vite__mapDeps([12,1,2,3,4,5,6,7]));return new n({client:e,ecosystem:t})},t)}async function Xc(r){const{client:t,ecosystem:e}=r,i=await(await dr(t,e)).getUser();switch(i.status){case"Logged In, Wallet Initialized":return i}}async function Ph(r){const t=await Xc(r);if(t&&"email"in t.authDetails)return t.authDetails.email}async function Oh(r){const t=await Xc(r);if(t&&"phoneNumber"in t.authDetails)return t.authDetails.phoneNumber}async function Rh(r){return(await dr(r.client,r.ecosystem)).preAuthenticate(r)}async function Lh(r){return(await dr(r.client,r.ecosystem)).authenticate(r)}async function Dh(r){const t=await dr(r.client,r.ecosystem);if(!t.authenticateWithRedirect)throw new Error("authenticateWithRedirect is not supported on this platform");return t.authenticateWithRedirect(r.strategy,r.mode,r.redirectUrl)}async function Vh(r){return await(await dr(r.client,r.ecosystem)).linkProfile(r)}async function Sh(r){return await(await dr(r.client,r.ecosystem)).unlinkProfile(r.profileToUnlink,r.allowAccountDeletion)}async function xh(r){return(await dr(r.client,r.ecosystem)).getProfiles()}function Ch(r){if("privateKey"in r){const t=ad(typeof r.message=="object"?r.message.raw:cd(r.message)),e=Ds({payload:t,privateKey:r.privateKey});return Pc(e)}if("account"in r){const{message:t,account:e}=r;return e.signMessage({message:t})}throw new Error("Either privateKey or account is required")}function $h(r){var s;const{privateKey:t,...e}=r;typeof((s=e.domain)==null?void 0:s.chainId)=="string"&&(e.domain.chainId=wc(e.domain.chainId));const n=ld(e),i=Ds({payload:n,privateKey:t});return Pc(i)}function Fi(r){const{client:t}=r,e=`0x${r.privateKey.replace(/^0x/,"")}`,n=Vs(Oc.getPublicKey(e.slice(2),!1)),i=ud(n);return{address:Q(i),sendTransaction:async o=>{const c=Xn({chain:ge(o.chainId),client:t}),l=_o({privateKey:e,transaction:o});return{transactionHash:await hd(c,l)}},signAuthorization:async o=>{const c=Ds({payload:Ac(o),privateKey:e});return dd(o,{signature:c})},signMessage:async({message:o})=>Ch({message:o,privateKey:e}),signTransaction:async o=>_o({privateKey:e,transaction:o}),signTypedData:async o=>$h({...o,privateKey:e})}}async function kh(r){const t=Vs(Oc.utils.randomPrivateKey());return Fi({client:r.client,privateKey:t})}async function Nh(r){const{address:t,client:e,chain:n}=r,i=r.tokenAddress||(n.id===42429?"0x20c0000000000000000000000000000000000000":void 0);if(i&&Q(i)!==Q(fo)){const{getBalance:d}=await a(async()=>{const{getBalance:h}=await import("./getBalance-C-HFrUIb.js");return{getBalance:h}},__vite__mapDeps([17,1]));return d({address:t,contract:Ls({address:i,chain:n,client:e})})}const s=Xn({chain:n,client:e}),[o,c,l,u]=await Promise.all([pd(n),_d(n),fd(n),md(s,{address:t})]);return{chainId:n.id,decimals:c,displayValue:yd(u,c),name:l,symbol:o,tokenAddress:i??fo,value:u}}function Uh(r){return!r||typeof r.then!="function"?Promise.resolve(r):r}function ye(r,...t){try{return Uh(r(...t))}catch(e){return Promise.reject(e)}}function qh(r){const t=typeof r;return r===null||t!=="object"&&t!=="function"}function Mh(r){const t=Object.getPrototypeOf(r);return!t||t.isPrototypeOf(Object)}function Dn(r){if(qh(r))return String(r);if(Mh(r)||Array.isArray(r))return JSON.stringify(r);if(typeof r.toJSON=="function")return Dn(r.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const Wi="base64:";function Bh(r){return typeof r=="string"?r:Wi+Kh(r)}function jh(r){return typeof r!="string"||!r.startsWith(Wi)?r:zh(r.slice(Wi.length))}function zh(r){return globalThis.Buffer?ee.from(r,"base64"):Uint8Array.from(globalThis.atob(r),t=>t.codePointAt(0))}function Kh(r){return globalThis.Buffer?ee.from(r).toString("base64"):globalThis.btoa(String.fromCodePoint(...r))}function ke(r){var t;return r&&((t=r.split("?")[0])==null?void 0:t.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""))||""}function Fh(...r){return ke(r.join(":"))}function vn(r){return r=ke(r),r?r+":":""}function Wh(r,t){if(t===void 0)return!0;let e=0,n=r.indexOf(":");for(;n>-1;)e++,n=r.indexOf(":",n+1);return e<=t}function Hh(r,t){return t?r.startsWith(t)&&r[r.length-1]!=="$":r[r.length-1]!=="$"}const Gh="memory",Jh=()=>{const r=new Map;return{name:Gh,getInstance:()=>r,hasItem(t){return r.has(t)},getItem(t){return r.get(t)??null},getItemRaw(t){return r.get(t)??null},setItem(t,e){r.set(t,e)},setItemRaw(t,e){r.set(t,e)},removeItem(t){r.delete(t)},getKeys(){return[...r.keys()]},clear(){r.clear()},dispose(){r.clear()}}};function Zh(r={}){const t={mounts:{"":r.driver||Jh()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},e=u=>{for(const d of t.mountpoints)if(u.startsWith(d))return{base:d,relativeKey:u.slice(d.length),driver:t.mounts[d]};return{base:"",relativeKey:u,driver:t.mounts[""]}},n=(u,d)=>t.mountpoints.filter(h=>h.startsWith(u)||d&&u.startsWith(h)).map(h=>({relativeBase:u.length>h.length?u.slice(h.length):void 0,mountpoint:h,driver:t.mounts[h]})),i=(u,d)=>{if(t.watching){d=ke(d);for(const h of t.watchListeners)h(u,d)}},s=async()=>{if(!t.watching){t.watching=!0;for(const u in t.mounts)t.unwatch[u]=await Ro(t.mounts[u],i,u)}},o=async()=>{if(t.watching){for(const u in t.unwatch)await t.unwatch[u]();t.unwatch={},t.watching=!1}},c=(u,d,h)=>{const p=new Map,_=f=>{let m=p.get(f.base);return m||(m={driver:f.driver,base:f.base,items:[]},p.set(f.base,m)),m};for(const f of u){const m=typeof f=="string",y=ke(m?f:f.key),b=m?void 0:f.value,R=m||!f.options?d:{...d,...f.options},v=e(y);_(v).items.push({key:y,value:b,relativeKey:v.relativeKey,options:R})}return Promise.all([...p.values()].map(f=>h(f))).then(f=>f.flat())},l={hasItem(u,d={}){u=ke(u);const{relativeKey:h,driver:p}=e(u);return ye(p.hasItem,h,d)},getItem(u,d={}){u=ke(u);const{relativeKey:h,driver:p}=e(u);return ye(p.getItem,h,d).then(_=>gn(_))},getItems(u,d={}){return c(u,d,h=>h.driver.getItems?ye(h.driver.getItems,h.items.map(p=>({key:p.relativeKey,options:p.options})),d).then(p=>p.map(_=>({key:Fh(h.base,_.key),value:gn(_.value)}))):Promise.all(h.items.map(p=>ye(h.driver.getItem,p.relativeKey,p.options).then(_=>({key:p.key,value:gn(_)})))))},getItemRaw(u,d={}){u=ke(u);const{relativeKey:h,driver:p}=e(u);return p.getItemRaw?ye(p.getItemRaw,h,d):ye(p.getItem,h,d).then(_=>jh(_))},async setItem(u,d,h={}){if(d===void 0)return l.removeItem(u);u=ke(u);const{relativeKey:p,driver:_}=e(u);_.setItem&&(await ye(_.setItem,p,Dn(d),h),_.watch||i("update",u))},async setItems(u,d){await c(u,d,async h=>{if(h.driver.setItems)return ye(h.driver.setItems,h.items.map(p=>({key:p.relativeKey,value:Dn(p.value),options:p.options})),d);h.driver.setItem&&await Promise.all(h.items.map(p=>ye(h.driver.setItem,p.relativeKey,Dn(p.value),p.options)))})},async setItemRaw(u,d,h={}){if(d===void 0)return l.removeItem(u,h);u=ke(u);const{relativeKey:p,driver:_}=e(u);if(_.setItemRaw)await ye(_.setItemRaw,p,d,h);else if(_.setItem)await ye(_.setItem,p,Bh(d),h);else return;_.watch||i("update",u)},async removeItem(u,d={}){typeof d=="boolean"&&(d={removeMeta:d}),u=ke(u);const{relativeKey:h,driver:p}=e(u);p.removeItem&&(await ye(p.removeItem,h,d),(d.removeMeta||d.removeMata)&&await ye(p.removeItem,h+"$",d),p.watch||i("remove",u))},async getMeta(u,d={}){typeof d=="boolean"&&(d={nativeOnly:d}),u=ke(u);const{relativeKey:h,driver:p}=e(u),_=Object.create(null);if(p.getMeta&&Object.assign(_,await ye(p.getMeta,h,d)),!d.nativeOnly){const f=await ye(p.getItem,h+"$",d).then(m=>gn(m));f&&typeof f=="object"&&(typeof f.atime=="string"&&(f.atime=new Date(f.atime)),typeof f.mtime=="string"&&(f.mtime=new Date(f.mtime)),Object.assign(_,f))}return _},setMeta(u,d,h={}){return this.setItem(u+"$",d,h)},removeMeta(u,d={}){return this.removeItem(u+"$",d)},async getKeys(u,d={}){var y;u=vn(u);const h=n(u,!0);let p=[];const _=[];let f=!0;for(const b of h){(y=b.driver.flags)!=null&&y.maxDepth||(f=!1);const R=await ye(b.driver.getKeys,b.relativeBase,d);for(const v of R){const P=b.mountpoint+ke(v);p.some(T=>P.startsWith(T))||_.push(P)}p=[b.mountpoint,...p.filter(v=>!v.startsWith(b.mountpoint))]}const m=d.maxDepth!==void 0&&!f;return _.filter(b=>(!m||Wh(b,d.maxDepth))&&Hh(b,u))},async clear(u,d={}){u=vn(u),await Promise.all(n(u,!1).map(async h=>{if(h.driver.clear)return ye(h.driver.clear,h.relativeBase,d);if(h.driver.removeItem){const p=await h.driver.getKeys(h.relativeBase||"",d);return Promise.all(p.map(_=>h.driver.removeItem(_,d)))}}))},async dispose(){await Promise.all(Object.values(t.mounts).map(u=>Lo(u)))},async watch(u){return await s(),t.watchListeners.push(u),async()=>{t.watchListeners=t.watchListeners.filter(d=>d!==u),t.watchListeners.length===0&&await o()}},async unwatch(){t.watchListeners=[],await o()},mount(u,d){if(u=vn(u),u&&t.mounts[u])throw new Error(`already mounted at ${u}`);return u&&(t.mountpoints.push(u),t.mountpoints.sort((h,p)=>p.length-h.length)),t.mounts[u]=d,t.watching&&Promise.resolve(Ro(d,i,u)).then(h=>{t.unwatch[u]=h}).catch(console.error),l},async unmount(u,d=!0){var h,p;u=vn(u),!(!u||!t.mounts[u])&&(t.watching&&u in t.unwatch&&((p=(h=t.unwatch)[u])==null||p.call(h),delete t.unwatch[u]),d&&await Lo(t.mounts[u]),t.mountpoints=t.mountpoints.filter(_=>_!==u),delete t.mounts[u])},getMount(u=""){u=ke(u)+":";const d=e(u);return{driver:d.driver,base:d.base}},getMounts(u="",d={}){return u=ke(u),n(u,d.parents).map(p=>({driver:p.driver,base:p.mountpoint}))},keys:(u,d={})=>l.getKeys(u,d),get:(u,d={})=>l.getItem(u,d),set:(u,d,h={})=>l.setItem(u,d,h),has:(u,d={})=>l.hasItem(u,d),del:(u,d={})=>l.removeItem(u,d),remove:(u,d={})=>l.removeItem(u,d)};return l}function Ro(r,t,e){return r.watch?r.watch((n,i)=>t(n,e+i)):()=>{}}async function Lo(r){typeof r.dispose=="function"&&await ye(r.dispose)}const Qh="idb-keyval";var Yh=(r={})=>{const t=r.base&&r.base.length>0?`${r.base}:`:"",e=i=>t+i;let n;return r.dbName&&r.storeName&&(n=Sd(r.dbName,r.storeName)),{name:Qh,options:r,async hasItem(i){return!(typeof await yo(e(i),n)>"u")},async getItem(i){return await yo(e(i),n)??null},setItem(i,s){return kd(e(i),s,n)},removeItem(i){return $d(e(i),n)},getKeys(){return Cd(n)},clear(){return xd(n)}}};const Xh="WALLET_CONNECT_V2_INDEXED_DB",ep="keyvaluestorage";let tp=class{constructor(){this.indexedDb=Zh({driver:Yh({dbName:Xh,storeName:ep})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(t=>[t.key,t.value])}async getItem(t){const e=await this.indexedDb.getItem(t);if(e!==null)return e}async setItem(t,e){await this.indexedDb.setItem(t,tn(e))}async removeItem(t){await this.indexedDb.removeItem(t)}};var mi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof K<"u"?K:typeof self<"u"?self:{},Vn={exports:{}};(function(){let r;function t(){}r=t,r.prototype.getItem=function(e){return this.hasOwnProperty(e)?String(this[e]):null},r.prototype.setItem=function(e,n){this[e]=String(n)},r.prototype.removeItem=function(e){delete this[e]},r.prototype.clear=function(){const e=this;Object.keys(e).forEach(function(n){e[n]=void 0,delete e[n]})},r.prototype.key=function(e){return e=e||0,Object.keys(this)[e]},r.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof mi<"u"&&mi.localStorage?Vn.exports=mi.localStorage:typeof window<"u"&&window.localStorage?Vn.exports=window.localStorage:Vn.exports=new t})();function rp(r){var t;return[r[0],qn((t=r[1])!=null?t:"")]}let np=class{constructor(){this.localStorage=Vn.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(rp)}async getItem(t){const e=this.localStorage.getItem(t);if(e!==null)return qn(e)}async setItem(t,e){this.localStorage.setItem(t,tn(e))}async removeItem(t){this.localStorage.removeItem(t)}};const ip="wc_storage_version",Do=1,sp=async(r,t,e)=>{const n=ip,i=await t.getItem(n);if(i&&i>=Do){e(t);return}const s=await r.getKeys();if(!s.length){e(t);return}const o=[];for(;s.length;){const c=s.shift();if(!c)continue;const l=c.toLowerCase();if(l.includes("wc@")||l.includes("walletconnect")||l.includes("wc_")||l.includes("wallet_connect")){const u=await r.getItem(c);await t.setItem(c,u),o.push(c)}}await t.setItem(n,Do),e(t),op(r,o)},op=async(r,t)=>{t.length&&t.forEach(async e=>{await r.removeItem(e)})};let ap=class{constructor(){this.initialized=!1,this.setInitialized=e=>{this.storage=e,this.initialized=!0};const t=new np;this.storage=t;try{const e=new tp;sp(t,e,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(t){return await this.initialize(),this.storage.getItem(t)}async setItem(t,e){return await this.initialize(),this.storage.setItem(t,e)}async removeItem(t){return await this.initialize(),this.storage.removeItem(t)}async initialize(){this.initialized||await new Promise(t=>{const e=setInterval(()=>{this.initialized&&(clearInterval(e),t())},20)})}};var yi,Vo;function cp(){if(Vo)return yi;Vo=1;const r=Nd();yi=i;const t=T().console||{},e={mapHttpRequest:f,mapHttpResponse:f,wrapRequestSerializer:m,wrapResponseSerializer:m,wrapErrorSerializer:m,req:f,res:f,err:p};function n(g,D){return Array.isArray(g)?g.filter(function(w){return w!=="!stdSerializers.err"}):g===!0?Object.keys(D):!1}function i(g){g=g||{},g.browser=g.browser||{};const D=g.browser.transmit;if(D&&typeof D.send!="function")throw Error("pino: transmit option must have a send function");const L=g.browser.write||t;g.browser.write&&(g.browser.asObject=!0);const w=g.serializers||{},E=n(g.browser.serialize,w);let I=g.browser.serialize;Array.isArray(g.browser.serialize)&&g.browser.serialize.indexOf("!stdSerializers.err")>-1&&(I=!1);const A=["error","fatal","warn","info","debug","trace"];typeof L=="function"&&(L.error=L.fatal=L.warn=L.info=L.debug=L.trace=L),g.enabled===!1&&(g.level="silent");const V=g.level||"info",O=Object.create(L);O.log||(O.log=y),Object.defineProperty(O,"levelVal",{get:$}),Object.defineProperty(O,"level",{get:k,set:M});const S={transmit:D,serialize:E,asObject:g.browser.asObject,levels:A,timestamp:_(g)};O.levels=i.levels,O.level=V,O.setMaxListeners=O.getMaxListeners=O.emit=O.addListener=O.on=O.prependListener=O.once=O.prependOnceListener=O.removeListener=O.removeAllListeners=O.listeners=O.listenerCount=O.eventNames=O.write=O.flush=y,O.serializers=w,O._serialize=E,O._stdErrSerialize=I,O.child=C,D&&(O._logEvent=h());function $(){return this.level==="silent"?1/0:this.levels.values[this.level]}function k(){return this._level}function M(N){if(N!=="silent"&&!this.levels.values[N])throw Error("unknown level "+N);this._level=N,s(S,O,"error","log"),s(S,O,"fatal","error"),s(S,O,"warn","error"),s(S,O,"info","log"),s(S,O,"debug","log"),s(S,O,"trace","log")}function C(N,j){if(!N)throw new Error("missing bindings for child Pino");j=j||{},E&&N.serializers&&(j.serializers=N.serializers);const z=j.serializers;if(E&&z){var F=Object.assign({},w,z),W=g.browser.serialize===!0?Object.keys(F):E;delete N.serializers,l([N],W,F,this._stdErrSerialize)}function H(G){this._childLevel=(G._childLevel|0)+1,this.error=u(G,N,"error"),this.fatal=u(G,N,"fatal"),this.warn=u(G,N,"warn"),this.info=u(G,N,"info"),this.debug=u(G,N,"debug"),this.trace=u(G,N,"trace"),F&&(this.serializers=F,this._serialize=W),D&&(this._logEvent=h([].concat(G._logEvent.bindings,N)))}return H.prototype=this,new H(this)}return O}i.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},i.stdSerializers=e,i.stdTimeFunctions=Object.assign({},{nullTime:b,epochTime:R,unixTime:v,isoTime:P});function s(g,D,L,w){const E=Object.getPrototypeOf(D);D[L]=D.levelVal>D.levels.values[L]?y:E[L]?E[L]:t[L]||t[w]||y,o(g,D,L)}function o(g,D,L){!g.transmit&&D[L]===y||(D[L]=function(w){return function(){const I=g.timestamp(),A=new Array(arguments.length),V=Object.getPrototypeOf&&Object.getPrototypeOf(this)===t?t:this;for(var O=0;O<A.length;O++)A[O]=arguments[O];if(g.serialize&&!g.asObject&&l(A,this._serialize,this.serializers,this._stdErrSerialize),g.asObject?w.call(V,c(this,L,A,I)):w.apply(V,A),g.transmit){const S=g.transmit.level||D.level,$=i.levels.values[S],k=i.levels.values[L];if(k<$)return;d(this,{ts:I,methodLevel:L,methodValue:k,transmitValue:i.levels.values[g.transmit.level||D.level],send:g.transmit.send,val:D.levelVal},A)}}}(D[L]))}function c(g,D,L,w){g._serialize&&l(L,g._serialize,g.serializers,g._stdErrSerialize);const E=L.slice();let I=E[0];const A={};w&&(A.time=w),A.level=i.levels.values[D];let V=(g._childLevel|0)+1;if(V<1&&(V=1),I!==null&&typeof I=="object"){for(;V--&&typeof E[0]=="object";)Object.assign(A,E.shift());I=E.length?r(E.shift(),E):void 0}else typeof I=="string"&&(I=r(E.shift(),E));return I!==void 0&&(A.msg=I),A}function l(g,D,L,w){for(const E in g)if(w&&g[E]instanceof Error)g[E]=i.stdSerializers.err(g[E]);else if(typeof g[E]=="object"&&!Array.isArray(g[E]))for(const I in g[E])D&&D.indexOf(I)>-1&&I in L&&(g[E][I]=L[I](g[E][I]))}function u(g,D,L){return function(){const w=new Array(1+arguments.length);w[0]=D;for(var E=1;E<w.length;E++)w[E]=arguments[E-1];return g[L].apply(this,w)}}function d(g,D,L){const w=D.send,E=D.ts,I=D.methodLevel,A=D.methodValue,V=D.val,O=g._logEvent.bindings;l(L,g._serialize||Object.keys(g.serializers),g.serializers,g._stdErrSerialize===void 0?!0:g._stdErrSerialize),g._logEvent.ts=E,g._logEvent.messages=L.filter(function(S){return O.indexOf(S)===-1}),g._logEvent.level.label=I,g._logEvent.level.value=A,w(I,g._logEvent,V),g._logEvent=h(O)}function h(g){return{ts:0,messages:[],bindings:g||[],level:{label:"",value:0}}}function p(g){const D={type:g.constructor.name,msg:g.message,stack:g.stack};for(const L in g)D[L]===void 0&&(D[L]=g[L]);return D}function _(g){return typeof g.timestamp=="function"?g.timestamp:g.timestamp===!1?b:R}function f(){return{}}function m(g){return g}function y(){}function b(){return!1}function R(){return Date.now()}function v(){return Math.round(Date.now()/1e3)}function P(){return new Date(Date.now()).toISOString()}function T(){function g(D){return typeof D<"u"&&D}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return g(self)||g(window)||g(this)||{}}}return yi}var gr=cp();const ei=wd(gr),lp={level:"info"},pn="custom_context",zs=1e3*1024;let up=class{constructor(t){this.nodeValue=t,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}},So=class{constructor(t){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=t,this.sizeInBytes=0}append(t){const e=new up(t);if(e.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${t} with size ${e.size}`);for(;this.size+e.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=e),this.tail=e):(this.head=e,this.tail=e),this.lengthInNodes++,this.sizeInBytes+=e.size}shift(){if(!this.head)return;const t=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=t.size}toArray(){const t=[];let e=this.head;for(;e!==null;)t.push(e.value),e=e.next;return t}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let t=this.head;return{next:()=>{if(!t)return{done:!0,value:null};const e=t.value;return t=t.next,{done:!1,value:e}}}}};class el{constructor(t,e=zs){this.level=t??"error",this.levelValue=gr.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=e,this.logs=new So(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(t,e){e===gr.levels.values.error?console.error(t):e===gr.levels.values.warn?console.warn(t):e===gr.levels.values.debug?console.debug(t):e===gr.levels.values.trace?console.trace(t):console.log(t)}appendToLogs(t){this.logs.append(tn({timestamp:new Date().toISOString(),log:t}));const e=typeof t=="string"?JSON.parse(t).level:t.level;e>=this.levelValue&&this.forwardToConsole(t,e)}getLogs(){return this.logs}clearLogs(){this.logs=new So(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(t){const e=this.getLogArray();return e.push(tn({extraMetadata:t})),new Blob(e,{type:"application/json"})}}let dp=class{constructor(t,e=zs){this.baseChunkLogger=new el(t,e)}write(t){this.baseChunkLogger.appendToLogs(t)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}downloadLogsBlobInBrowser(t){const e=URL.createObjectURL(this.logsToBlob(t)),n=document.createElement("a");n.href=e,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(e)}},hp=class{constructor(t,e=zs){this.baseChunkLogger=new el(t,e)}write(t){this.baseChunkLogger.appendToLogs(t)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}};var pp=Object.defineProperty,_p=Object.defineProperties,fp=Object.getOwnPropertyDescriptors,xo=Object.getOwnPropertySymbols,mp=Object.prototype.hasOwnProperty,yp=Object.prototype.propertyIsEnumerable,Co=(r,t,e)=>t in r?pp(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,zn=(r,t)=>{for(var e in t||(t={}))mp.call(t,e)&&Co(r,e,t[e]);if(xo)for(var e of xo(t))yp.call(t,e)&&Co(r,e,t[e]);return r},Kn=(r,t)=>_p(r,fp(t));function Ks(r){return Kn(zn({},r),{level:(r==null?void 0:r.level)||lp.level})}function wp(r,t=pn){return r[t]||""}function gp(r,t,e=pn){return r[e]=t,r}function Ke(r,t=pn){let e="";return typeof r.bindings>"u"?e=wp(r,t):e=r.bindings().context||"",e}function Ep(r,t,e=pn){const n=Ke(r,e);return n.trim()?`${n}/${t}`:t}function Ce(r,t,e=pn){const n=Ep(r,t,e),i=r.child({context:n});return gp(i,n,e)}function vp(r){var t,e;const n=new dp((t=r.opts)==null?void 0:t.level,r.maxSizeInBytes);return{logger:ei(Kn(zn({},r.opts),{level:"trace",browser:Kn(zn({},(e=r.opts)==null?void 0:e.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function bp(r){var t;const e=new hp((t=r.opts)==null?void 0:t.level,r.maxSizeInBytes);return{logger:ei(Kn(zn({},r.opts),{level:"trace"}),e),chunkLoggerController:e}}function Ip(r){return typeof r.loggerOverride<"u"&&typeof r.loggerOverride!="string"?{logger:r.loggerOverride,chunkLoggerController:null}:typeof window<"u"?vp(r):bp(r)}var Ap=Object.defineProperty,Tp=(r,t,e)=>t in r?Ap(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,$o=(r,t,e)=>Tp(r,typeof t!="symbol"?t+"":t,e);class Pp extends Ar{constructor(t){super(),this.opts=t,$o(this,"protocol","wc"),$o(this,"version",2)}}var Op=Object.defineProperty,Rp=(r,t,e)=>t in r?Op(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Lp=(r,t,e)=>Rp(r,t+"",e);class Dp extends Ar{constructor(t,e){super(),this.core=t,this.logger=e,Lp(this,"records",new Map)}}class Vp{constructor(t,e){this.logger=t,this.core=e}}class Sp extends Ar{constructor(t,e){super(),this.relayer=t,this.logger=e}}let xp=class extends Ar{constructor(t){super()}},Cp=class{constructor(t,e,n,i){this.core=t,this.logger=e,this.name=n}},$p=class extends Ar{constructor(t,e){super(),this.relayer=t,this.logger=e}};class kp extends Ar{constructor(t,e){super(),this.core=t,this.logger=e}}let Np=class{constructor(t,e,n){this.core=t,this.logger=e,this.store=n}},Up=class{constructor(t,e){this.projectId=t,this.logger=e}},qp=class{constructor(t,e,n){this.core=t,this.logger=e,this.telemetryEnabled=n}};var Mp=Object.defineProperty,Bp=(r,t,e)=>t in r?Mp(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ko=(r,t,e)=>Bp(r,typeof t!="symbol"?t+"":t,e);let jp=class{constructor(t){this.opts=t,ko(this,"protocol","wc"),ko(this,"version",2)}},zp=class{constructor(t){this.client=t}};function rn(r,{strict:t=!0}={}){return!r||typeof r!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(r):r.startsWith("0x")}function Hi(r){return rn(r,{strict:!1})?Math.ceil((r.length-2)/2):r.length}const tl="2.31.0";let xr={getDocsUrl:({docsBaseUrl:r,docsPath:t="",docsSlug:e})=>t?`${r??"https://viem.sh"}${t}${e?`#${e}`:""}`:void 0,version:`viem@${tl}`};class sr extends Error{constructor(t,e={}){var c;const n=(()=>{var l;return e.cause instanceof sr?e.cause.details:(l=e.cause)!=null&&l.message?e.cause.message:e.details})(),i=e.cause instanceof sr&&e.cause.docsPath||e.docsPath,s=(c=xr.getDocsUrl)==null?void 0:c.call(xr,{...e,docsPath:i}),o=[t||"An error occurred.","",...e.metaMessages?[...e.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...n?[`Details: ${n}`]:[],...xr.version?[`Version: ${xr.version}`]:[]].join(`
|
|
3
|
+
`);super(o,e.cause?{cause:e.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=i,this.metaMessages=e.metaMessages,this.name=e.name??this.name,this.shortMessage=t,this.version=tl}walk(t){return rl(this,t)}}function rl(r,t){return t!=null&&t(r)?r:r&&typeof r=="object"&&"cause"in r&&r.cause!==void 0?rl(r.cause,t):t?null:r}class nl extends sr{constructor({size:t,targetSize:e,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${t}) exceeds padding size (${e}).`,{name:"SizeExceedsPaddingSizeError"})}}function Or(r,{dir:t,size:e=32}={}){return typeof r=="string"?Kp(r,{dir:t,size:e}):Fp(r,{dir:t,size:e})}function Kp(r,{dir:t,size:e=32}={}){if(e===null)return r;const n=r.replace("0x","");if(n.length>e*2)throw new nl({size:Math.ceil(n.length/2),targetSize:e,type:"hex"});return`0x${n[t==="right"?"padEnd":"padStart"](e*2,"0")}`}function Fp(r,{dir:t,size:e=32}={}){if(e===null)return r;if(r.length>e)throw new nl({size:r.length,targetSize:e,type:"bytes"});const n=new Uint8Array(e);for(let i=0;i<e;i++){const s=t==="right";n[s?i:e-i-1]=r[s?i:r.length-i-1]}return n}class Wp extends sr{constructor({max:t,min:e,signed:n,size:i,value:s}){super(`Number "${s}" is not in safe ${i?`${i*8}-bit ${n?"signed":"unsigned"} `:""}integer range ${t?`(${e} to ${t})`:`(above ${e})`}`,{name:"IntegerOutOfRangeError"})}}class Hp extends sr{constructor({givenSize:t,maxSize:e}){super(`Size cannot exceed ${e} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}function Rr(r,{size:t}){if(Hi(r)>t)throw new Hp({givenSize:Hi(r),maxSize:t})}function Gi(r,t={}){const{signed:e}=t;t.size&&Rr(r,{size:t.size});const n=BigInt(r);if(!e)return n;const i=(r.length-2)/2,s=(1n<<BigInt(i)*8n-1n)-1n;return n<=s?n:n-BigInt(`0x${"f".padStart(i*2,"f")}`)-1n}function Gp(r,t={}){return Number(Gi(r,t))}const Jp=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function Ji(r,t={}){return typeof r=="number"||typeof r=="bigint"?sl(r,t):typeof r=="string"?Yp(r,t):typeof r=="boolean"?Zp(r,t):il(r,t)}function Zp(r,t={}){const e=`0x${Number(r)}`;return typeof t.size=="number"?(Rr(e,{size:t.size}),Or(e,{size:t.size})):e}function il(r,t={}){let e="";for(let i=0;i<r.length;i++)e+=Jp[r[i]];const n=`0x${e}`;return typeof t.size=="number"?(Rr(n,{size:t.size}),Or(n,{dir:"right",size:t.size})):n}function sl(r,t={}){const{signed:e,size:n}=t,i=BigInt(r);let s;n?e?s=(1n<<BigInt(n)*8n-1n)-1n:s=2n**(BigInt(n)*8n)-1n:typeof r=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof s=="bigint"&&e?-s-1n:0;if(s&&i>s||i<o){const l=typeof r=="bigint"?"n":"";throw new Wp({max:s?`${s}${l}`:void 0,min:`${o}${l}`,signed:e,size:n,value:`${r}${l}`})}const c=`0x${(e&&i<0?(1n<<BigInt(n*8))+BigInt(i):i).toString(16)}`;return n?Or(c,{size:n}):c}const Qp=new TextEncoder;function Yp(r,t={}){const e=Qp.encode(r);return il(e,t)}const Xp=new TextEncoder;function e_(r,t={}){return typeof r=="number"||typeof r=="bigint"?r_(r,t):typeof r=="boolean"?t_(r,t):rn(r)?ol(r,t):al(r,t)}function t_(r,t={}){const e=new Uint8Array(1);return e[0]=Number(r),typeof t.size=="number"?(Rr(e,{size:t.size}),Or(e,{size:t.size})):e}const gt={zero:48,nine:57,A:65,F:70,a:97,f:102};function No(r){if(r>=gt.zero&&r<=gt.nine)return r-gt.zero;if(r>=gt.A&&r<=gt.F)return r-(gt.A-10);if(r>=gt.a&&r<=gt.f)return r-(gt.a-10)}function ol(r,t={}){let e=r;t.size&&(Rr(e,{size:t.size}),e=Or(e,{dir:"right",size:t.size}));let n=e.slice(2);n.length%2&&(n=`0${n}`);const i=n.length/2,s=new Uint8Array(i);for(let o=0,c=0;o<i;o++){const l=No(n.charCodeAt(c++)),u=No(n.charCodeAt(c++));if(l===void 0||u===void 0)throw new sr(`Invalid byte sequence ("${n[c-2]}${n[c-1]}" in "${n}").`);s[o]=l*16+u}return s}function r_(r,t){const e=sl(r,t);return ol(e)}function al(r,t={}){const e=Xp.encode(r);return typeof t.size=="number"?(Rr(e,{size:t.size}),Or(e,{dir:"right",size:t.size})):e}const bn=BigInt(2**32-1),Uo=BigInt(32);function n_(r,t=!1){return t?{h:Number(r&bn),l:Number(r>>Uo&bn)}:{h:Number(r>>Uo&bn)|0,l:Number(r&bn)|0}}function i_(r,t=!1){const e=r.length;let n=new Uint32Array(e),i=new Uint32Array(e);for(let s=0;s<e;s++){const{h:o,l:c}=n_(r[s],t);[n[s],i[s]]=[o,c]}return[n,i]}const s_=(r,t,e)=>r<<e|t>>>32-e,o_=(r,t,e)=>t<<e|r>>>32-e,a_=(r,t,e)=>t<<e-32|r>>>64-e,c_=(r,t,e)=>r<<e-32|t>>>64-e,pr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function l_(r){return r instanceof Uint8Array||ArrayBuffer.isView(r)&&r.constructor.name==="Uint8Array"}function Fn(r){if(!Number.isSafeInteger(r)||r<0)throw new Error("positive integer expected, got "+r)}function nn(r,...t){if(!l_(r))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(r.length))throw new Error("Uint8Array expected of length "+t+", got length="+r.length)}function bI(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Fn(r.outputLen),Fn(r.blockLen)}function qo(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function u_(r,t){nn(r);const e=t.outputLen;if(r.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function d_(r){return new Uint32Array(r.buffer,r.byteOffset,Math.floor(r.byteLength/4))}function cl(...r){for(let t=0;t<r.length;t++)r[t].fill(0)}function II(r){return new DataView(r.buffer,r.byteOffset,r.byteLength)}function AI(r,t){return r<<32-t|r>>>t}const h_=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function p_(r){return r<<24&4278190080|r<<8&16711680|r>>>8&65280|r>>>24&255}function __(r){for(let t=0;t<r.length;t++)r[t]=p_(r[t]);return r}const Mo=h_?r=>r:__;function f_(r){if(typeof r!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(r))}function ll(r){return typeof r=="string"&&(r=f_(r)),nn(r),r}function TI(...r){let t=0;for(let n=0;n<r.length;n++){const i=r[n];nn(i),t+=i.length}const e=new Uint8Array(t);for(let n=0,i=0;n<r.length;n++){const s=r[n];e.set(s,i),i+=s.length}return e}class m_{}function y_(r){const t=n=>r().update(ll(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function PI(r=32){if(pr&&typeof pr.getRandomValues=="function")return pr.getRandomValues(new Uint8Array(r));if(pr&&typeof pr.randomBytes=="function")return Uint8Array.from(pr.randomBytes(r));throw new Error("crypto.getRandomValues must be defined")}const w_=BigInt(0),Cr=BigInt(1),g_=BigInt(2),E_=BigInt(7),v_=BigInt(256),b_=BigInt(113),ul=[],dl=[],hl=[];for(let r=0,t=Cr,e=1,n=0;r<24;r++){[e,n]=[n,(2*e+3*n)%5],ul.push(2*(5*n+e)),dl.push((r+1)*(r+2)/2%64);let i=w_;for(let s=0;s<7;s++)t=(t<<Cr^(t>>E_)*b_)%v_,t&g_&&(i^=Cr<<(Cr<<BigInt(s))-Cr);hl.push(i)}const pl=i_(hl,!0),I_=pl[0],A_=pl[1],Bo=(r,t,e)=>e>32?a_(r,t,e):s_(r,t,e),jo=(r,t,e)=>e>32?c_(r,t,e):o_(r,t,e);function T_(r,t=24){const e=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let o=0;o<10;o++)e[o]=r[o]^r[o+10]^r[o+20]^r[o+30]^r[o+40];for(let o=0;o<10;o+=2){const c=(o+8)%10,l=(o+2)%10,u=e[l],d=e[l+1],h=Bo(u,d,1)^e[c],p=jo(u,d,1)^e[c+1];for(let _=0;_<50;_+=10)r[o+_]^=h,r[o+_+1]^=p}let i=r[2],s=r[3];for(let o=0;o<24;o++){const c=dl[o],l=Bo(i,s,c),u=jo(i,s,c),d=ul[o];i=r[d],s=r[d+1],r[d]=l,r[d+1]=u}for(let o=0;o<50;o+=10){for(let c=0;c<10;c++)e[c]=r[o+c];for(let c=0;c<10;c++)r[o+c]^=~e[(c+2)%10]&e[(c+4)%10]}r[0]^=I_[n],r[1]^=A_[n]}cl(e)}class Fs extends m_{constructor(t,e,n,i=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=i,this.rounds=s,Fn(n),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=d_(this.state)}clone(){return this._cloneInto()}keccak(){Mo(this.state32),T_(this.state32,this.rounds),Mo(this.state32),this.posOut=0,this.pos=0}update(t){qo(this),t=ll(t),nn(t);const{blockLen:e,state:n}=this,i=t.length;for(let s=0;s<i;){const o=Math.min(e-this.pos,i-s);for(let c=0;c<o;c++)n[this.pos++]^=t[s++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:e,pos:n,blockLen:i}=this;t[n]^=e,e&128&&n===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){qo(this,!1),nn(t),this.finish();const e=this.state,{blockLen:n}=this;for(let i=0,s=t.length;i<s;){this.posOut>=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);t.set(e.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Fn(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(u_(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,cl(this.state)}_cloneInto(t){const{blockLen:e,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return t||(t=new Fs(e,n,i,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=n,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}}const P_=(r,t,e)=>y_(()=>new Fs(t,r,e)),O_=P_(1,136,256/8);function _l(r,t){const e=t||"hex",n=O_(rn(r,{strict:!1})?e_(r):r);return e==="bytes"?n:Ji(n)}class R_ extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const e=super.get(t);return super.has(t)&&e!==void 0&&(this.delete(t),super.set(t,e)),e}set(t,e){if(super.set(t,e),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}const wi=new R_(8192);function L_(r,t){if(wi.has(`${r}.${t}`))return wi.get(`${r}.${t}`);const e=r.substring(2).toLowerCase(),n=_l(al(e),"bytes"),i=e.split("");for(let o=0;o<40;o+=2)n[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(n[o>>1]&15)>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const s=`0x${i.join("")}`;return wi.set(`${r}.${t}`,s),s}function D_(r){const t=_l(`0x${r.substring(4)}`).substring(26);return L_(`0x${t}`)}async function V_({hash:r,signature:t}){const e=rn(r)?r:Ji(r),{secp256k1:n}=await a(async()=>{const{secp256k1:o}=await import("./secp256k1-xSyt8XU9.js");return{secp256k1:o}},__vite__mapDeps([18,1,2,3,4,5,6,7]));return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:u,s:d,v:h,yParity:p}=t,_=Number(p??h),f=zo(_);return new n.Signature(Gi(u),Gi(d)).addRecoveryBit(f)}const o=rn(t)?t:Ji(t);if(Hi(o)!==65)throw new Error("invalid signature length");const c=Gp(`0x${o.slice(130)}`),l=zo(c);return n.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(l)})().recoverPublicKey(e.substring(2)).toHex(!1)}`}function zo(r){if(r===0||r===1)return r;if(r===27)return 0;if(r===28)return 1;throw new Error("Invalid yParityOrV value")}async function S_({hash:r,signature:t}){return D_(await V_({hash:r,signature:t}))}var x_={};const C_=":";function Sn(r){const[t,e]=r.split(C_);return{namespace:t,reference:e}}function fl(r,t){return r.includes(":")?[r]:t.chains||[]}var $_=Object.defineProperty,k_=Object.defineProperties,N_=Object.getOwnPropertyDescriptors,Ko=Object.getOwnPropertySymbols,U_=Object.prototype.hasOwnProperty,q_=Object.prototype.propertyIsEnumerable,Zi=(r,t,e)=>t in r?$_(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Fo=(r,t)=>{for(var e in t||(t={}))U_.call(t,e)&&Zi(r,e,t[e]);if(Ko)for(var e of Ko(t))q_.call(t,e)&&Zi(r,e,t[e]);return r},M_=(r,t)=>k_(r,N_(t)),Wo=(r,t,e)=>Zi(r,typeof t!="symbol"?t+"":t,e);const B_="ReactNative",He={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},j_="js";function Wn(){return typeof zt<"u"&&typeof zt.versions<"u"&&typeof zt.versions.node<"u"}function Wt(){return!Ot.getDocument()&&!!Ot.getNavigator()&&navigator.product===B_}function z_(){return Wt()&&typeof K<"u"&&typeof(K==null?void 0:K.Platform)<"u"&&(K==null?void 0:K.Platform.OS)==="android"}function K_(){return Wt()&&typeof K<"u"&&typeof(K==null?void 0:K.Platform)<"u"&&(K==null?void 0:K.Platform.OS)==="ios"}function Lr(){return!Wn()&&!!Ot.getNavigator()&&!!Ot.getDocument()}function _n(){return Wt()?He.reactNative:Wn()?He.node:Lr()?He.browser:He.unknown}function Ho(){var r;try{return Wt()&&typeof K<"u"&&typeof(K==null?void 0:K.Application)<"u"?(r=K.Application)==null?void 0:r.applicationId:void 0}catch{return}}function F_(r,t){const e=new URLSearchParams(r);for(const n of Object.keys(t).sort())if(t.hasOwnProperty(n)){const i=t[n];i!==void 0&&e.set(n,i)}return e.toString()}function W_(r){var t,e;const n=ml();try{return r!=null&&r.url&&n.url&&new URL(r.url).host!==new URL(n.url).host&&(console.warn(`The configured WalletConnect 'metadata.url':${r.url} differs from the actual page url:${n.url}. This is probably unintended and can lead to issues.`),r.url=n.url),(t=r==null?void 0:r.icons)!=null&&t.length&&r.icons.length>0&&(r.icons=r.icons.filter(i=>i!=="")),M_(Fo(Fo({},n),r),{url:(r==null?void 0:r.url)||n.url,name:(r==null?void 0:r.name)||n.name,description:(r==null?void 0:r.description)||n.description,icons:(e=r==null?void 0:r.icons)!=null&&e.length&&r.icons.length>0?r.icons:n.icons})}catch(i){return console.warn("Error populating app metadata",i),r||n}}function ml(){return Ud.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function H_(){if(_n()===He.reactNative&&typeof K<"u"&&typeof(K==null?void 0:K.Platform)<"u"){const{OS:e,Version:n}=K.Platform;return[e,n].join("-")}const r=Md();if(r===null)return"unknown";const t=r.os?r.os.replace(" ","").toLowerCase():"unknown";return r.type==="browser"?[t,r.name,r.version].join("-"):[t,r.version].join("-")}function G_(){var r;const t=_n();return t===He.browser?[t,((r=Ot.getLocation())==null?void 0:r.host)||"unknown"].join(":"):t}function yl(r,t,e){const n=H_(),i=G_();return[[r,t].join("-"),[j_,e].join("-"),n,i].join("/")}function J_({protocol:r,version:t,relayUrl:e,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:c,packageName:l}){const u=e.split("?"),d=yl(r,t,n),h={auth:i,ua:d,projectId:s,useOnCloseEvent:o,packageName:l||void 0,bundleId:c||void 0},p=F_(u[1]||"",h);return u[0]+"?"+p}function Xt(r,t){return r.filter(e=>t.includes(e)).length===r.length}function Qi(r){return Object.fromEntries(r.entries())}function Yi(r){return new Map(Object.entries(r))}function Zt(r=q.FIVE_MINUTES,t){const e=q.toMiliseconds(r||q.FIVE_MINUTES);let n,i,s,o;return{resolve:c=>{s&&n&&(clearTimeout(s),n(c),o=Promise.resolve(c))},reject:c=>{s&&i&&(clearTimeout(s),i(c))},done:()=>new Promise((c,l)=>{if(o)return c(o);s=setTimeout(()=>{const u=new Error(t);o=Promise.reject(u),l(u)},e),n=c,i=l})}}function ft(r,t,e){return new Promise(async(n,i)=>{const s=setTimeout(()=>i(new Error(e)),t);try{const o=await r;n(o)}catch(o){i(o)}clearTimeout(s)})}function wl(r,t){if(typeof t=="string"&&t.startsWith(`${r}:`))return t;if(r.toLowerCase()==="topic"){if(typeof t!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}else if(r.toLowerCase()==="id"){if(typeof t!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw new Error(`Unknown expirer target type: ${r}`)}function Z_(r){return wl("topic",r)}function Q_(r){return wl("id",r)}function gl(r){const[t,e]=r.split(":"),n={id:void 0,topic:void 0};if(t==="topic"&&typeof e=="string")n.topic=e;else if(t==="id"&&Number.isInteger(Number(e)))n.id=Number(e);else throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${e}`);return n}function _e(r,t){return q.fromMiliseconds(Date.now()+q.toMiliseconds(r))}function Ut(r){return Date.now()>=q.toMiliseconds(r)}function te(r,t){return`${r}${t?`:${t}`:""}`}function nr(r=[],t=[]){return[...new Set([...r,...t])]}async function Y_({id:r,topic:t,wcDeepLink:e}){var n;try{if(!e)return;const i=typeof e=="string"?JSON.parse(e):e,s=i==null?void 0:i.href;if(typeof s!="string")return;const o=X_(s,r,t),c=_n();if(c===He.browser){if(!((n=Ot.getDocument())!=null&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}ef(o)}else c===He.reactNative&&typeof(K==null?void 0:K.Linking)<"u"&&await K.Linking.openURL(o)}catch(i){console.error(i)}}function X_(r,t,e){const n=`requestId=${t}&sessionTopic=${e}`;r.endsWith("/")&&(r=r.slice(0,-1));let i=`${r}`;if(r.startsWith("https://t.me")){const s=r.includes("?")?"&startapp=":"?startapp=";i=`${i}${s}${sf(n,!0)}`}else i=`${i}/wc?${n}`;return i}function ef(r){let t="_self";nf()?t="_top":(rf()||r.startsWith("https://")||r.startsWith("http://"))&&(t="_blank"),window.open(r,t,"noreferrer noopener")}async function tf(r,t){let e="";try{if(Lr()&&(e=localStorage.getItem(t),e))return e;e=await r.getItem(t)}catch(n){console.error(n)}return e}function Go(r,t){if(!r.includes(t))return null;const e=r.split(/([&,?,=])/),n=e.indexOf(t);return e[n+2]}function Jo(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,r=>{const t=Math.random()*16|0;return(r==="x"?t:t&3|8).toString(16)})}function Ws(){return typeof zt<"u"&&x_.IS_VITEST==="true"}function rf(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function nf(){try{return window.self!==window.top}catch{return!1}}function sf(r,t=!1){const e=ee.from(r).toString("base64");return t?e.replace(/[=]/g,""):e}function El(r){return ee.from(r,"base64").toString("utf-8")}function of(r){return new Promise(t=>setTimeout(t,r))}let af=class{constructor({limit:t}){Wo(this,"limit"),Wo(this,"set"),this.limit=t,this.set=new Set}add(t){if(!this.set.has(t)){if(this.set.size>=this.limit){const e=this.set.values().next().value;e&&this.set.delete(e)}this.set.add(t)}}has(t){return this.set.has(t)}};const In=BigInt(2**32-1),Zo=BigInt(32);function vl(r,t=!1){return t?{h:Number(r&In),l:Number(r>>Zo&In)}:{h:Number(r>>Zo&In)|0,l:Number(r&In)|0}}function bl(r,t=!1){const e=r.length;let n=new Uint32Array(e),i=new Uint32Array(e);for(let s=0;s<e;s++){const{h:o,l:c}=vl(r[s],t);[n[s],i[s]]=[o,c]}return[n,i]}const Qo=(r,t,e)=>r>>>e,Yo=(r,t,e)=>r<<32-e|t>>>e,qt=(r,t,e)=>r>>>e|t<<32-e,Mt=(r,t,e)=>r<<32-e|t>>>e,Kr=(r,t,e)=>r<<64-e|t>>>e-32,Fr=(r,t,e)=>r>>>e-32|t<<64-e,cf=(r,t)=>t,lf=(r,t)=>r,uf=(r,t,e)=>r<<e|t>>>32-e,df=(r,t,e)=>t<<e|r>>>32-e,hf=(r,t,e)=>t<<e-32|r>>>64-e,pf=(r,t,e)=>r<<e-32|t>>>64-e;function st(r,t,e,n){const i=(t>>>0)+(n>>>0);return{h:r+e+(i/2**32|0)|0,l:i|0}}const Hs=(r,t,e)=>(r>>>0)+(t>>>0)+(e>>>0),Gs=(r,t,e,n)=>t+e+n+(r/2**32|0)|0,_f=(r,t,e,n)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0),ff=(r,t,e,n,i)=>t+e+n+i+(r/2**32|0)|0,mf=(r,t,e,n,i)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(i>>>0),yf=(r,t,e,n,i,s)=>t+e+n+i+s+(r/2**32|0)|0,_r=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function Js(r){return r instanceof Uint8Array||ArrayBuffer.isView(r)&&r.constructor.name==="Uint8Array"}function Rt(r){if(!Number.isSafeInteger(r)||r<0)throw new Error("positive integer expected, got "+r)}function tt(r,...t){if(!Js(r))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(r.length))throw new Error("Uint8Array expected of length "+t+", got length="+r.length)}function Zs(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Rt(r.outputLen),Rt(r.blockLen)}function Ft(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function Qs(r,t){tt(r);const e=t.outputLen;if(r.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function sn(r){return new Uint32Array(r.buffer,r.byteOffset,Math.floor(r.byteLength/4))}function rt(...r){for(let t=0;t<r.length;t++)r[t].fill(0)}function gi(r){return new DataView(r.buffer,r.byteOffset,r.byteLength)}function lt(r,t){return r<<32-t|r>>>t}const Il=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Al(r){return r<<24&4278190080|r<<8&16711680|r>>>8&65280|r>>>24&255}const bt=Il?r=>r:r=>Al(r);function wf(r){for(let t=0;t<r.length;t++)r[t]=Al(r[t]);return r}const Bt=Il?r=>r:wf,Tl=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",gf=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function on(r){if(tt(r),Tl)return r.toHex();let t="";for(let e=0;e<r.length;e++)t+=gf[r[e]];return t}const Et={_0:48,_9:57,A:65,F:70,a:97,f:102};function Xo(r){if(r>=Et._0&&r<=Et._9)return r-Et._0;if(r>=Et.A&&r<=Et.F)return r-(Et.A-10);if(r>=Et.a&&r<=Et.f)return r-(Et.a-10)}function Ys(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);if(Tl)return Uint8Array.fromHex(r);const t=r.length,e=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(e);for(let i=0,s=0;i<e;i++,s+=2){const o=Xo(r.charCodeAt(s)),c=Xo(r.charCodeAt(s+1));if(o===void 0||c===void 0){const l=r[s]+r[s+1];throw new Error('hex string expected, got non-hex character "'+l+'" at index '+s)}n[i]=o*16+c}return n}function Ef(r){if(typeof r!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(r))}function at(r){return typeof r=="string"&&(r=Ef(r)),tt(r),r}function er(...r){let t=0;for(let n=0;n<r.length;n++){const i=r[n];tt(i),t+=i.length}const e=new Uint8Array(t);for(let n=0,i=0;n<r.length;n++){const s=r[n];e.set(s,i),i+=s.length}return e}class ti{}function fn(r){const t=n=>r().update(at(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function vf(r){const t=(n,i)=>r(i).update(at(n)).digest(),e=r({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=n=>r(n),t}function Dr(r=32){if(_r&&typeof _r.getRandomValues=="function")return _r.getRandomValues(new Uint8Array(r));if(_r&&typeof _r.randomBytes=="function")return Uint8Array.from(_r.randomBytes(r));throw new Error("crypto.getRandomValues must be defined")}const bf=BigInt(0),$r=BigInt(1),If=BigInt(2),Af=BigInt(7),Tf=BigInt(256),Pf=BigInt(113),Pl=[],Ol=[],Rl=[];for(let r=0,t=$r,e=1,n=0;r<24;r++){[e,n]=[n,(2*e+3*n)%5],Pl.push(2*(5*n+e)),Ol.push((r+1)*(r+2)/2%64);let i=bf;for(let s=0;s<7;s++)t=(t<<$r^(t>>Af)*Pf)%Tf,t&If&&(i^=$r<<($r<<BigInt(s))-$r);Rl.push(i)}const Ll=bl(Rl,!0),Of=Ll[0],Rf=Ll[1],ea=(r,t,e)=>e>32?hf(r,t,e):uf(r,t,e),ta=(r,t,e)=>e>32?pf(r,t,e):df(r,t,e);function Lf(r,t=24){const e=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let o=0;o<10;o++)e[o]=r[o]^r[o+10]^r[o+20]^r[o+30]^r[o+40];for(let o=0;o<10;o+=2){const c=(o+8)%10,l=(o+2)%10,u=e[l],d=e[l+1],h=ea(u,d,1)^e[c],p=ta(u,d,1)^e[c+1];for(let _=0;_<50;_+=10)r[o+_]^=h,r[o+_+1]^=p}let i=r[2],s=r[3];for(let o=0;o<24;o++){const c=Ol[o],l=ea(i,s,c),u=ta(i,s,c),d=Pl[o];i=r[d],s=r[d+1],r[d]=l,r[d+1]=u}for(let o=0;o<50;o+=10){for(let c=0;c<10;c++)e[c]=r[o+c];for(let c=0;c<10;c++)r[o+c]^=~e[(c+2)%10]&e[(c+4)%10]}r[0]^=Of[n],r[1]^=Rf[n]}rt(e)}let Df=class Dl extends ti{constructor(t,e,n,i=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=i,this.rounds=s,Rt(n),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=sn(this.state)}clone(){return this._cloneInto()}keccak(){Bt(this.state32),Lf(this.state32,this.rounds),Bt(this.state32),this.posOut=0,this.pos=0}update(t){Ft(this),t=at(t),tt(t);const{blockLen:e,state:n}=this,i=t.length;for(let s=0;s<i;){const o=Math.min(e-this.pos,i-s);for(let c=0;c<o;c++)n[this.pos++]^=t[s++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:e,pos:n,blockLen:i}=this;t[n]^=e,e&128&&n===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){Ft(this,!1),tt(t),this.finish();const e=this.state,{blockLen:n}=this;for(let i=0,s=t.length;i<s;){this.posOut>=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);t.set(e.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Rt(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Qs(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,rt(this.state)}_cloneInto(t){const{blockLen:e,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return t||(t=new Dl(e,n,i,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=n,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}};const Vf=(r,t,e)=>fn(()=>new Df(t,r,e)),Sf=Vf(1,136,256/8);function xf(r,t,e,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(t,e,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(e>>i&s),c=Number(e&s),l=n?4:0,u=n?0:4;r.setUint32(t+l,o,n),r.setUint32(t+u,c,n)}function Cf(r,t,e){return r&t^~r&e}function $f(r,t,e){return r&t^r&e^t&e}let Vl=class extends ti{constructor(t,e,n,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=i,this.buffer=new Uint8Array(t),this.view=gi(this.buffer)}update(t){Ft(this),t=at(t),tt(t);const{view:e,buffer:n,blockLen:i}=this,s=t.length;for(let o=0;o<s;){const c=Math.min(i-this.pos,s-o);if(c===i){const l=gi(t);for(;i<=s-o;o+=i)this.process(l,o);continue}n.set(t.subarray(o,o+c),this.pos),this.pos+=c,o+=c,this.pos===i&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Ft(this),Qs(t,this),this.finished=!0;const{buffer:e,view:n,blockLen:i,isLE:s}=this;let{pos:o}=this;e[o++]=128,rt(this.buffer.subarray(o)),this.padOffset>i-o&&(this.process(n,0),o=0);for(let h=o;h<i;h++)e[h]=0;xf(n,i-8,BigInt(this.length*8),s),this.process(n,0);const c=gi(t),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=l/4,d=this.get();if(u>d.length)throw new Error("_sha2: outputLen bigger than state");for(let h=0;h<u;h++)c.setUint32(4*h,d[h],s)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:n,length:i,finished:s,destroyed:o,pos:c}=this;return t.destroyed=o,t.finished=s,t.length=i,t.pos=c,i%e&&t.buffer.set(n),t}clone(){return this._cloneInto()}};const Dt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Te=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),Pe=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),kf=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Vt=new Uint32Array(64);let Nf=class extends Vl{constructor(t=32){super(64,t,8,!1),this.A=Dt[0]|0,this.B=Dt[1]|0,this.C=Dt[2]|0,this.D=Dt[3]|0,this.E=Dt[4]|0,this.F=Dt[5]|0,this.G=Dt[6]|0,this.H=Dt[7]|0}get(){const{A:t,B:e,C:n,D:i,E:s,F:o,G:c,H:l}=this;return[t,e,n,i,s,o,c,l]}set(t,e,n,i,s,o,c,l){this.A=t|0,this.B=e|0,this.C=n|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=c|0,this.H=l|0}process(t,e){for(let h=0;h<16;h++,e+=4)Vt[h]=t.getUint32(e,!1);for(let h=16;h<64;h++){const p=Vt[h-15],_=Vt[h-2],f=lt(p,7)^lt(p,18)^p>>>3,m=lt(_,17)^lt(_,19)^_>>>10;Vt[h]=m+Vt[h-7]+f+Vt[h-16]|0}let{A:n,B:i,C:s,D:o,E:c,F:l,G:u,H:d}=this;for(let h=0;h<64;h++){const p=lt(c,6)^lt(c,11)^lt(c,25),_=d+p+Cf(c,l,u)+kf[h]+Vt[h]|0,f=(lt(n,2)^lt(n,13)^lt(n,22))+$f(n,i,s)|0;d=u,u=l,l=c,c=o+_|0,o=s,s=i,i=n,n=_+f|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,c=c+this.E|0,l=l+this.F|0,u=u+this.G|0,d=d+this.H|0,this.set(n,i,s,o,c,l,u,d)}roundClean(){rt(Vt)}destroy(){this.set(0,0,0,0,0,0,0,0),rt(this.buffer)}};const Sl=bl(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(r=>BigInt(r))),Uf=Sl[0],qf=Sl[1],St=new Uint32Array(80),xt=new Uint32Array(80);let Xs=class extends Vl{constructor(t=64){super(128,t,16,!1),this.Ah=Pe[0]|0,this.Al=Pe[1]|0,this.Bh=Pe[2]|0,this.Bl=Pe[3]|0,this.Ch=Pe[4]|0,this.Cl=Pe[5]|0,this.Dh=Pe[6]|0,this.Dl=Pe[7]|0,this.Eh=Pe[8]|0,this.El=Pe[9]|0,this.Fh=Pe[10]|0,this.Fl=Pe[11]|0,this.Gh=Pe[12]|0,this.Gl=Pe[13]|0,this.Hh=Pe[14]|0,this.Hl=Pe[15]|0}get(){const{Ah:t,Al:e,Bh:n,Bl:i,Ch:s,Cl:o,Dh:c,Dl:l,Eh:u,El:d,Fh:h,Fl:p,Gh:_,Gl:f,Hh:m,Hl:y}=this;return[t,e,n,i,s,o,c,l,u,d,h,p,_,f,m,y]}set(t,e,n,i,s,o,c,l,u,d,h,p,_,f,m,y){this.Ah=t|0,this.Al=e|0,this.Bh=n|0,this.Bl=i|0,this.Ch=s|0,this.Cl=o|0,this.Dh=c|0,this.Dl=l|0,this.Eh=u|0,this.El=d|0,this.Fh=h|0,this.Fl=p|0,this.Gh=_|0,this.Gl=f|0,this.Hh=m|0,this.Hl=y|0}process(t,e){for(let v=0;v<16;v++,e+=4)St[v]=t.getUint32(e),xt[v]=t.getUint32(e+=4);for(let v=16;v<80;v++){const P=St[v-15]|0,T=xt[v-15]|0,g=qt(P,T,1)^qt(P,T,8)^Qo(P,T,7),D=Mt(P,T,1)^Mt(P,T,8)^Yo(P,T,7),L=St[v-2]|0,w=xt[v-2]|0,E=qt(L,w,19)^Kr(L,w,61)^Qo(L,w,6),I=Mt(L,w,19)^Fr(L,w,61)^Yo(L,w,6),A=_f(D,I,xt[v-7],xt[v-16]),V=ff(A,g,E,St[v-7],St[v-16]);St[v]=V|0,xt[v]=A|0}let{Ah:n,Al:i,Bh:s,Bl:o,Ch:c,Cl:l,Dh:u,Dl:d,Eh:h,El:p,Fh:_,Fl:f,Gh:m,Gl:y,Hh:b,Hl:R}=this;for(let v=0;v<80;v++){const P=qt(h,p,14)^qt(h,p,18)^Kr(h,p,41),T=Mt(h,p,14)^Mt(h,p,18)^Fr(h,p,41),g=h&_^~h&m,D=p&f^~p&y,L=mf(R,T,D,qf[v],xt[v]),w=yf(L,b,P,g,Uf[v],St[v]),E=L|0,I=qt(n,i,28)^Kr(n,i,34)^Kr(n,i,39),A=Mt(n,i,28)^Fr(n,i,34)^Fr(n,i,39),V=n&s^n&c^s&c,O=i&o^i&l^o&l;b=m|0,R=y|0,m=_|0,y=f|0,_=h|0,f=p|0,{h,l:p}=st(u|0,d|0,w|0,E|0),u=c|0,d=l|0,c=s|0,l=o|0,s=n|0,o=i|0;const S=Hs(E,A,O);n=Gs(S,w,I,V),i=S|0}({h:n,l:i}=st(this.Ah|0,this.Al|0,n|0,i|0)),{h:s,l:o}=st(this.Bh|0,this.Bl|0,s|0,o|0),{h:c,l}=st(this.Ch|0,this.Cl|0,c|0,l|0),{h:u,l:d}=st(this.Dh|0,this.Dl|0,u|0,d|0),{h,l:p}=st(this.Eh|0,this.El|0,h|0,p|0),{h:_,l:f}=st(this.Fh|0,this.Fl|0,_|0,f|0),{h:m,l:y}=st(this.Gh|0,this.Gl|0,m|0,y|0),{h:b,l:R}=st(this.Hh|0,this.Hl|0,b|0,R|0),this.set(n,i,s,o,c,l,u,d,h,p,_,f,m,y,b,R)}roundClean(){rt(St,xt)}destroy(){rt(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},Mf=class extends Xs{constructor(){super(48),this.Ah=Te[0]|0,this.Al=Te[1]|0,this.Bh=Te[2]|0,this.Bl=Te[3]|0,this.Ch=Te[4]|0,this.Cl=Te[5]|0,this.Dh=Te[6]|0,this.Dl=Te[7]|0,this.Eh=Te[8]|0,this.El=Te[9]|0,this.Fh=Te[10]|0,this.Fl=Te[11]|0,this.Gh=Te[12]|0,this.Gl=Te[13]|0,this.Hh=Te[14]|0,this.Hl=Te[15]|0}};const Oe=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class Bf extends Xs{constructor(){super(32),this.Ah=Oe[0]|0,this.Al=Oe[1]|0,this.Bh=Oe[2]|0,this.Bl=Oe[3]|0,this.Ch=Oe[4]|0,this.Cl=Oe[5]|0,this.Dh=Oe[6]|0,this.Dl=Oe[7]|0,this.Eh=Oe[8]|0,this.El=Oe[9]|0,this.Fh=Oe[10]|0,this.Fl=Oe[11]|0,this.Gh=Oe[12]|0,this.Gl=Oe[13]|0,this.Hh=Oe[14]|0,this.Hl=Oe[15]|0}}const ri=fn(()=>new Nf),jf=fn(()=>new Xs),zf=fn(()=>new Mf),Kf=fn(()=>new Bf),Ff=Uint8Array.from([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9]),pe=Uint32Array.from([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),B=new Uint32Array(32);function Ct(r,t,e,n,i,s){const o=i[s],c=i[s+1];let l=B[2*r],u=B[2*r+1],d=B[2*t],h=B[2*t+1],p=B[2*e],_=B[2*e+1],f=B[2*n],m=B[2*n+1],y=Hs(l,d,o);u=Gs(y,u,h,c),l=y|0,{Dh:m,Dl:f}={Dh:m^u,Dl:f^l},{Dh:m,Dl:f}={Dh:cf(m,f),Dl:lf(m)},{h:_,l:p}=st(_,p,m,f),{Bh:h,Bl:d}={Bh:h^_,Bl:d^p},{Bh:h,Bl:d}={Bh:qt(h,d,24),Bl:Mt(h,d,24)},B[2*r]=l,B[2*r+1]=u,B[2*t]=d,B[2*t+1]=h,B[2*e]=p,B[2*e+1]=_,B[2*n]=f,B[2*n+1]=m}function $t(r,t,e,n,i,s){const o=i[s],c=i[s+1];let l=B[2*r],u=B[2*r+1],d=B[2*t],h=B[2*t+1],p=B[2*e],_=B[2*e+1],f=B[2*n],m=B[2*n+1],y=Hs(l,d,o);u=Gs(y,u,h,c),l=y|0,{Dh:m,Dl:f}={Dh:m^u,Dl:f^l},{Dh:m,Dl:f}={Dh:qt(m,f,16),Dl:Mt(m,f,16)},{h:_,l:p}=st(_,p,m,f),{Bh:h,Bl:d}={Bh:h^_,Bl:d^p},{Bh:h,Bl:d}={Bh:Kr(h,d,63),Bl:Fr(h,d,63)},B[2*r]=l,B[2*r+1]=u,B[2*t]=d,B[2*t+1]=h,B[2*e]=p,B[2*e+1]=_,B[2*n]=f,B[2*n+1]=m}function Wf(r,t={},e,n,i){if(Rt(e),r<0||r>e)throw new Error("outputLen bigger than keyLen");const{key:s,salt:o,personalization:c}=t;if(s!==void 0&&(s.length<1||s.length>e))throw new Error("key length must be undefined or 1.."+e);if(o!==void 0&&o.length!==n)throw new Error("salt must be undefined or "+n);if(c!==void 0&&c.length!==i)throw new Error("personalization must be undefined or "+i)}class Hf extends ti{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,this.length=0,this.pos=0,Rt(t),Rt(e),this.blockLen=t,this.outputLen=e,this.buffer=new Uint8Array(t),this.buffer32=sn(this.buffer)}update(t){Ft(this),t=at(t),tt(t);const{blockLen:e,buffer:n,buffer32:i}=this,s=t.length,o=t.byteOffset,c=t.buffer;for(let l=0;l<s;){this.pos===e&&(Bt(i),this.compress(i,0,!1),Bt(i),this.pos=0);const u=Math.min(e-this.pos,s-l),d=o+l;if(u===e&&!(d%4)&&l+u<s){const h=new Uint32Array(c,d,Math.floor((s-l)/4));Bt(h);for(let p=0;l+e<s;p+=i.length,l+=e)this.length+=e,this.compress(h,p,!1);Bt(h);continue}n.set(t.subarray(l,l+u),this.pos),this.pos+=u,this.length+=u,l+=u}return this}digestInto(t){Ft(this),Qs(t,this);const{pos:e,buffer32:n}=this;this.finished=!0,rt(this.buffer.subarray(e)),Bt(n),this.compress(n,0,!0),Bt(n);const i=sn(t);this.get().forEach((s,o)=>i[o]=bt(s))}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){const{buffer:e,length:n,finished:i,destroyed:s,outputLen:o,pos:c}=this;return t||(t=new this.constructor({dkLen:o})),t.set(...this.get()),t.buffer.set(e),t.destroyed=s,t.finished=i,t.length=n,t.pos=c,t.outputLen=o,t}clone(){return this._cloneInto()}}class Gf extends Hf{constructor(t={}){const e=t.dkLen===void 0?64:t.dkLen;super(128,e),this.v0l=pe[0]|0,this.v0h=pe[1]|0,this.v1l=pe[2]|0,this.v1h=pe[3]|0,this.v2l=pe[4]|0,this.v2h=pe[5]|0,this.v3l=pe[6]|0,this.v3h=pe[7]|0,this.v4l=pe[8]|0,this.v4h=pe[9]|0,this.v5l=pe[10]|0,this.v5h=pe[11]|0,this.v6l=pe[12]|0,this.v6h=pe[13]|0,this.v7l=pe[14]|0,this.v7h=pe[15]|0,Wf(e,t,64,16,16);let{key:n,personalization:i,salt:s}=t,o=0;if(n!==void 0&&(n=at(n),o=n.length),this.v0l^=this.outputLen|o<<8|65536|1<<24,s!==void 0){s=at(s);const c=sn(s);this.v4l^=bt(c[0]),this.v4h^=bt(c[1]),this.v5l^=bt(c[2]),this.v5h^=bt(c[3])}if(i!==void 0){i=at(i);const c=sn(i);this.v6l^=bt(c[0]),this.v6h^=bt(c[1]),this.v7l^=bt(c[2]),this.v7h^=bt(c[3])}if(n!==void 0){const c=new Uint8Array(this.blockLen);c.set(n),this.update(c)}}get(){let{v0l:t,v0h:e,v1l:n,v1h:i,v2l:s,v2h:o,v3l:c,v3h:l,v4l:u,v4h:d,v5l:h,v5h:p,v6l:_,v6h:f,v7l:m,v7h:y}=this;return[t,e,n,i,s,o,c,l,u,d,h,p,_,f,m,y]}set(t,e,n,i,s,o,c,l,u,d,h,p,_,f,m,y){this.v0l=t|0,this.v0h=e|0,this.v1l=n|0,this.v1h=i|0,this.v2l=s|0,this.v2h=o|0,this.v3l=c|0,this.v3h=l|0,this.v4l=u|0,this.v4h=d|0,this.v5l=h|0,this.v5h=p|0,this.v6l=_|0,this.v6h=f|0,this.v7l=m|0,this.v7h=y|0}compress(t,e,n){this.get().forEach((l,u)=>B[u]=l),B.set(pe,16);let{h:i,l:s}=vl(BigInt(this.length));B[24]=pe[8]^s,B[25]=pe[9]^i,n&&(B[28]=~B[28],B[29]=~B[29]);let o=0;const c=Ff;for(let l=0;l<12;l++)Ct(0,4,8,12,t,e+2*c[o++]),$t(0,4,8,12,t,e+2*c[o++]),Ct(1,5,9,13,t,e+2*c[o++]),$t(1,5,9,13,t,e+2*c[o++]),Ct(2,6,10,14,t,e+2*c[o++]),$t(2,6,10,14,t,e+2*c[o++]),Ct(3,7,11,15,t,e+2*c[o++]),$t(3,7,11,15,t,e+2*c[o++]),Ct(0,5,10,15,t,e+2*c[o++]),$t(0,5,10,15,t,e+2*c[o++]),Ct(1,6,11,12,t,e+2*c[o++]),$t(1,6,11,12,t,e+2*c[o++]),Ct(2,7,8,13,t,e+2*c[o++]),$t(2,7,8,13,t,e+2*c[o++]),Ct(3,4,9,14,t,e+2*c[o++]),$t(3,4,9,14,t,e+2*c[o++]);this.v0l^=B[0]^B[16],this.v0h^=B[1]^B[17],this.v1l^=B[2]^B[18],this.v1h^=B[3]^B[19],this.v2l^=B[4]^B[20],this.v2h^=B[5]^B[21],this.v3l^=B[6]^B[22],this.v3h^=B[7]^B[23],this.v4l^=B[8]^B[24],this.v4h^=B[9]^B[25],this.v5l^=B[10]^B[26],this.v5h^=B[11]^B[27],this.v6l^=B[12]^B[28],this.v6h^=B[13]^B[29],this.v7l^=B[14]^B[30],this.v7h^=B[15]^B[31],rt(B)}destroy(){this.destroyed=!0,rt(this.buffer32),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Jf=vf(r=>new Gf(r)),Zf="https://rpc.walletconnect.org/v1";function xl(r){const t=`Ethereum Signed Message:
|
|
4
4
|
${r.length}`,e=new TextEncoder().encode(t+r);return"0x"+ee.from(Sf(e)).toString("hex")}async function Qf(r,t,e,n,i,s){switch(e.t){case"eip191":return await Yf(r,t,e.s);case"eip1271":return await Xf(r,t,e.s,n,i,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${e.t}`)}}async function Yf(r,t,e){return(await S_({hash:xl(t),signature:e})).toLowerCase()===r.toLowerCase()}async function Xf(r,t,e,n,i,s){const o=Sn(n);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`);try{const c="0x1626ba7e",l="0000000000000000000000000000000000000000000000000000000000000040",u=e.substring(2),d=(u.length/2).toString(16).padStart(64,"0"),h=(t.startsWith("0x")?t:xl(t)).substring(2),p=c+h+l+d+u,_=await fetch(`${s||Zf}/?chainId=${n}&projectId=${i}`,{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify({id:em(),jsonrpc:"2.0",method:"eth_call",params:[{to:r,data:p},"latest"]})}),{result:f}=await _.json();return f?f.slice(0,c.length).toLowerCase()===c.toLowerCase():!1}catch(c){return console.error("isValidEip1271Signature: ",c),!1}}function em(){return Date.now()+Math.floor(Math.random()*1e3)}function tm(r){const t=atob(r),e=new Uint8Array(t.length);for(let o=0;o<t.length;o++)e[o]=t.charCodeAt(o);const n=e[0];if(n===0)throw new Error("No signatures found");const i=1+n*64;if(e.length<i)throw new Error("Transaction data too short for claimed signature count");if(e.length<100)throw new Error("Transaction too short");const s=ee.from(r,"base64").slice(1,65);return hn.encode(s)}function rm(r){const t=new Uint8Array(ee.from(r,"base64")),e=Array.from("TransactionData::").map(s=>s.charCodeAt(0)),n=new Uint8Array(e.length+t.length);n.set(e),n.set(t,e.length);const i=Jf(n,{dkLen:32});return hn.encode(i)}function ra(r){const t=new Uint8Array(ri(nm(r)));return hn.encode(t)}function nm(r){if(r instanceof Uint8Array)return r;if(Array.isArray(r))return new Uint8Array(r);if(typeof r=="object"&&r!=null&&r.data)return new Uint8Array(Object.values(r.data));if(typeof r=="object"&&r)return new Uint8Array(Object.values(r));throw new Error("getNearUint8ArrayFromBytes: Unexpected result type from bytes array")}function na(r){const t=ee.from(r,"base64"),e=Bd(t).txn;if(!e)throw new Error("Invalid signed transaction: missing 'txn' field");const n=jd(e),i=ee.from("TX"),s=ee.concat([i,ee.from(n)]),o=Kf(s);return gd.encode(o).replace(/=+$/,"")}function Ei(r){const t=[];let e=BigInt(r);for(;e>=BigInt(128);)t.push(Number(e&BigInt(127)|BigInt(128))),e>>=BigInt(7);return t.push(Number(e)),ee.from(t)}function im(r){const t=ee.from(r.signed.bodyBytes,"base64"),e=ee.from(r.signed.authInfoBytes,"base64"),n=ee.from(r.signature.signature,"base64"),i=[];i.push(ee.from([10])),i.push(Ei(t.length)),i.push(t),i.push(ee.from([18])),i.push(Ei(e.length)),i.push(e),i.push(ee.from([26])),i.push(Ei(n.length)),i.push(n);const s=ee.concat(i),o=ri(s);return ee.from(o).toString("hex").toUpperCase()}var sm=Object.defineProperty,om=Object.defineProperties,am=Object.getOwnPropertyDescriptors,ia=Object.getOwnPropertySymbols,cm=Object.prototype.hasOwnProperty,lm=Object.prototype.propertyIsEnumerable,sa=(r,t,e)=>t in r?sm(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,um=(r,t)=>{for(var e in t||(t={}))cm.call(t,e)&&sa(r,e,t[e]);if(ia)for(var e of ia(t))lm.call(t,e)&&sa(r,e,t[e]);return r},dm=(r,t)=>om(r,am(t));const hm="did:pkh:",eo=r=>r==null?void 0:r.split(":"),pm=r=>{const t=r&&eo(r);if(t)return r.includes(hm)?t[3]:t[1]},Xi=r=>{const t=r&&eo(r);if(t)return t[2]+":"+t[3]},Hn=r=>{const t=r&&eo(r);if(t)return t.pop()};async function oa(r){const{cacao:t,projectId:e}=r,{s:n,p:i}=t,s=Cl(i,i.iss),o=Hn(i.iss);return await Qf(o,s,n,Xi(i.iss),e)}const Cl=(r,t)=>{const e=`${r.domain} wants you to sign in with your Ethereum account:`,n=Hn(t);if(!r.aud&&!r.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=r.statement||void 0;const s=`URI: ${r.aud||r.uri}`,o=`Version: ${r.version}`,c=`Chain ID: ${pm(t)}`,l=`Nonce: ${r.nonce}`,u=`Issued At: ${r.iat}`,d=r.exp?`Expiration Time: ${r.exp}`:void 0,h=r.nbf?`Not Before: ${r.nbf}`:void 0,p=r.requestId?`Request ID: ${r.requestId}`:void 0,_=r.resources?`Resources:${r.resources.map(m=>`
|
|
5
5
|
- ${m}`).join("")}`:void 0,f=xn(r.resources);if(f){const m=an(f);i=bm(i,m)}return[e,n,"",i,"",s,o,c,l,u,d,h,p,_].filter(m=>m!=null).join(`
|
|
6
6
|
`)};function _m(r){return ee.from(JSON.stringify(r)).toString("base64")}function fm(r){return JSON.parse(ee.from(r,"base64").toString("utf-8"))}function or(r){if(!r)throw new Error("No recap provided, value is undefined");if(!r.att)throw new Error("No `att` property found");const t=Object.keys(r.att);if(!(t!=null&&t.length))throw new Error("No resources found in `att` property");t.forEach(e=>{const n=r.att[e];if(Array.isArray(n))throw new Error(`Resource must be an object: ${e}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${e}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${e}`);Object.keys(n).forEach(i=>{const s=n[i];if(!Array.isArray(s))throw new Error(`Ability limits ${i} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${i} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${i}) must be an array of objects, found: ${o}`)})})})}function mm(r,t,e,n={}){return e==null||e.sort((i,s)=>i.localeCompare(s)),{att:{[r]:ym(t,e,n)}}}function ym(r,t,e={}){t=t==null?void 0:t.sort((i,s)=>i.localeCompare(s));const n=t.map(i=>({[`${r}/${i}`]:[e]}));return Object.assign({},...n)}function $l(r){return or(r),`urn:recap:${_m(r).replace(/=/g,"")}`}function an(r){const t=fm(r.replace("urn:recap:",""));return or(t),t}function wm(r,t,e){const n=mm(r,t,e);return $l(n)}function gm(r){return r&&r.includes("urn:recap:")}function Em(r,t){const e=an(r),n=an(t),i=vm(e,n);return $l(i)}function vm(r,t){or(r),or(t);const e=Object.keys(r.att).concat(Object.keys(t.att)).sort((i,s)=>i.localeCompare(s)),n={att:{}};return e.forEach(i=>{var s,o;Object.keys(((s=r.att)==null?void 0:s[i])||{}).concat(Object.keys(((o=t.att)==null?void 0:o[i])||{})).sort((c,l)=>c.localeCompare(l)).forEach(c=>{var l,u;n.att[i]=dm(um({},n.att[i]),{[c]:((l=r.att[i])==null?void 0:l[c])||((u=t.att[i])==null?void 0:u[c])})})}),n}function bm(r="",t){or(t);const e="I further authorize the stated URI to perform the following actions on my behalf: ";if(r.includes(e))return r;const n=[];let i=0;Object.keys(t.att).forEach(c=>{const l=Object.keys(t.att[c]).map(h=>({ability:h.split("/")[0],action:h.split("/")[1]}));l.sort((h,p)=>h.action.localeCompare(p.action));const u={};l.forEach(h=>{u[h.ability]||(u[h.ability]=[]),u[h.ability].push(h.action)});const d=Object.keys(u).map(h=>(i++,`(${i}) '${h}': '${u[h].join("', '")}' for '${c}'.`));n.push(d.join(", ").replace(".,","."))});const s=n.join(" "),o=`${e}${s}`;return`${r?r+" ":""}${o}`}function aa(r){var t;const e=an(r);or(e);const n=(t=e.att)==null?void 0:t.eip155;return n?Object.keys(n).map(i=>i.split("/")[1]):[]}function ca(r){const t=an(r);or(t);const e=[];return Object.values(t.att).forEach(n=>{Object.values(n).forEach(i=>{var s;(s=i==null?void 0:i[0])!=null&&s.chains&&e.push(i[0].chains)})}),[...new Set(e.flat())]}function xn(r){if(!r)return;const t=r==null?void 0:r[r.length-1];return gm(t)?t:void 0}/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */function kl(r){return r instanceof Uint8Array||ArrayBuffer.isView(r)&&r.constructor.name==="Uint8Array"}function es(r){if(typeof r!="boolean")throw new Error(`boolean expected, not ${r}`)}function vi(r){if(!Number.isSafeInteger(r)||r<0)throw new Error("positive integer expected, got "+r)}function qe(r,...t){if(!kl(r))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(r.length))throw new Error("Uint8Array expected of length "+t+", got length="+r.length)}function la(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function Im(r,t){qe(r);const e=t.outputLen;if(r.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function Kt(r){return new Uint32Array(r.buffer,r.byteOffset,Math.floor(r.byteLength/4))}function vr(...r){for(let t=0;t<r.length;t++)r[t].fill(0)}function Am(r){return new DataView(r.buffer,r.byteOffset,r.byteLength)}const Tm=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Pm(r){if(typeof r!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(r))}function ts(r){if(typeof r=="string")r=Pm(r);else if(kl(r))r=rs(r);else throw new Error("Uint8Array expected, got "+typeof r);return r}function Om(r,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(r,t)}function Rm(r,t){if(r.length!==t.length)return!1;let e=0;for(let n=0;n<r.length;n++)e|=r[n]^t[n];return e===0}const Lm=(r,t)=>{function e(n,...i){if(qe(n),!Tm)throw new Error("Non little-endian hardware is not yet supported");if(r.nonceLength!==void 0){const u=i[0];if(!u)throw new Error("nonce / iv required");r.varSizeNonce?qe(u):qe(u,r.nonceLength)}const s=r.tagLength;s&&i[1]!==void 0&&qe(i[1]);const o=t(n,...i),c=(u,d)=>{if(d!==void 0){if(u!==2)throw new Error("cipher output not supported");qe(d)}};let l=!1;return{encrypt(u,d){if(l)throw new Error("cannot encrypt() twice with same key + nonce");return l=!0,qe(u),c(o.encrypt.length,d),o.encrypt(u,d)},decrypt(u,d){if(qe(u),s&&u.length<s)throw new Error("invalid ciphertext length: smaller than tagLength="+s);return c(o.decrypt.length,d),o.decrypt(u,d)}}}return Object.assign(e,r),e};function ua(r,t,e=!0){if(t===void 0)return new Uint8Array(r);if(t.length!==r)throw new Error("invalid output length, expected "+r+", got: "+t.length);if(e&&!Vm(t))throw new Error("invalid output, must be aligned");return t}function da(r,t,e,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(t,e,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(e>>i&s),c=Number(e&s);r.setUint32(t+4,o,n),r.setUint32(t+0,c,n)}function Dm(r,t,e){es(e);const n=new Uint8Array(16),i=Am(n);return da(i,0,BigInt(t),e),da(i,8,BigInt(r),e),n}function Vm(r){return r.byteOffset%4===0}function rs(r){return Uint8Array.from(r)}const Nl=r=>Uint8Array.from(r.split("").map(t=>t.charCodeAt(0))),Sm=Nl("expand 16-byte k"),xm=Nl("expand 32-byte k"),Cm=Kt(Sm),$m=Kt(xm);function Y(r,t){return r<<t|r>>>32-t}function ns(r){return r.byteOffset%4===0}const An=64,km=16,Ul=2**32-1,ha=new Uint32Array;function Nm(r,t,e,n,i,s,o,c){const l=i.length,u=new Uint8Array(An),d=Kt(u),h=ns(i)&&ns(s),p=h?Kt(i):ha,_=h?Kt(s):ha;for(let f=0;f<l;o++){if(r(t,e,n,d,o,c),o>=Ul)throw new Error("arx: counter overflow");const m=Math.min(An,l-f);if(h&&m===An){const y=f/4;if(f%4!==0)throw new Error("arx: invalid block position");for(let b=0,R;b<km;b++)R=y+b,_[R]=p[R]^d[b];f+=An;continue}for(let y=0,b;y<m;y++)b=f+y,s[b]=i[b]^u[y];f+=m}}function Um(r,t){const{allowShortKeys:e,extendNonceFn:n,counterLength:i,counterRight:s,rounds:o}=Om({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof r!="function")throw new Error("core must be a function");return vi(i),vi(o),es(s),es(e),(c,l,u,d,h=0)=>{qe(c),qe(l),qe(u);const p=u.length;if(d===void 0&&(d=new Uint8Array(p)),qe(d),vi(h),h<0||h>=Ul)throw new Error("arx: counter overflow");if(d.length<p)throw new Error(`arx: output (${d.length}) is shorter than data (${p})`);const _=[];let f=c.length,m,y;if(f===32)_.push(m=rs(c)),y=$m;else if(f===16&&e)m=new Uint8Array(32),m.set(c),m.set(c,16),y=Cm,_.push(m);else throw new Error(`arx: invalid 32-byte key, got length=${f}`);ns(l)||_.push(l=rs(l));const b=Kt(m);if(n){if(l.length!==24)throw new Error("arx: extended nonce must be 24 bytes");n(y,b,Kt(l.subarray(0,16)),b),l=l.subarray(16)}const R=16-i;if(R!==l.length)throw new Error(`arx: nonce must be ${R} or 16 bytes`);if(R!==12){const P=new Uint8Array(12);P.set(l,s?0:12-l.length),l=P,_.push(l)}const v=Kt(l);return Nm(r,y,b,v,u,d,h,o),vr(..._),d}}const Ee=(r,t)=>r[t++]&255|(r[t++]&255)<<8;class qm{constructor(t){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,t=ts(t),qe(t,32);const e=Ee(t,0),n=Ee(t,2),i=Ee(t,4),s=Ee(t,6),o=Ee(t,8),c=Ee(t,10),l=Ee(t,12),u=Ee(t,14);this.r[0]=e&8191,this.r[1]=(e>>>13|n<<3)&8191,this.r[2]=(n>>>10|i<<6)&7939,this.r[3]=(i>>>7|s<<9)&8191,this.r[4]=(s>>>4|o<<12)&255,this.r[5]=o>>>1&8190,this.r[6]=(o>>>14|c<<2)&8191,this.r[7]=(c>>>11|l<<5)&8065,this.r[8]=(l>>>8|u<<8)&8191,this.r[9]=u>>>5&127;for(let d=0;d<8;d++)this.pad[d]=Ee(t,16+2*d)}process(t,e,n=!1){const i=n?0:2048,{h:s,r:o}=this,c=o[0],l=o[1],u=o[2],d=o[3],h=o[4],p=o[5],_=o[6],f=o[7],m=o[8],y=o[9],b=Ee(t,e+0),R=Ee(t,e+2),v=Ee(t,e+4),P=Ee(t,e+6),T=Ee(t,e+8),g=Ee(t,e+10),D=Ee(t,e+12),L=Ee(t,e+14);let w=s[0]+(b&8191),E=s[1]+((b>>>13|R<<3)&8191),I=s[2]+((R>>>10|v<<6)&8191),A=s[3]+((v>>>7|P<<9)&8191),V=s[4]+((P>>>4|T<<12)&8191),O=s[5]+(T>>>1&8191),S=s[6]+((T>>>14|g<<2)&8191),$=s[7]+((g>>>11|D<<5)&8191),k=s[8]+((D>>>8|L<<8)&8191),M=s[9]+(L>>>5|i),C=0,N=C+w*c+E*(5*y)+I*(5*m)+A*(5*f)+V*(5*_);C=N>>>13,N&=8191,N+=O*(5*p)+S*(5*h)+$*(5*d)+k*(5*u)+M*(5*l),C+=N>>>13,N&=8191;let j=C+w*l+E*c+I*(5*y)+A*(5*m)+V*(5*f);C=j>>>13,j&=8191,j+=O*(5*_)+S*(5*p)+$*(5*h)+k*(5*d)+M*(5*u),C+=j>>>13,j&=8191;let z=C+w*u+E*l+I*c+A*(5*y)+V*(5*m);C=z>>>13,z&=8191,z+=O*(5*f)+S*(5*_)+$*(5*p)+k*(5*h)+M*(5*d),C+=z>>>13,z&=8191;let F=C+w*d+E*u+I*l+A*c+V*(5*y);C=F>>>13,F&=8191,F+=O*(5*m)+S*(5*f)+$*(5*_)+k*(5*p)+M*(5*h),C+=F>>>13,F&=8191;let W=C+w*h+E*d+I*u+A*l+V*c;C=W>>>13,W&=8191,W+=O*(5*y)+S*(5*m)+$*(5*f)+k*(5*_)+M*(5*p),C+=W>>>13,W&=8191;let H=C+w*p+E*h+I*d+A*u+V*l;C=H>>>13,H&=8191,H+=O*c+S*(5*y)+$*(5*m)+k*(5*f)+M*(5*_),C+=H>>>13,H&=8191;let G=C+w*_+E*p+I*h+A*d+V*u;C=G>>>13,G&=8191,G+=O*l+S*c+$*(5*y)+k*(5*m)+M*(5*f),C+=G>>>13,G&=8191;let ue=C+w*f+E*_+I*p+A*h+V*d;C=ue>>>13,ue&=8191,ue+=O*u+S*l+$*c+k*(5*y)+M*(5*m),C+=ue>>>13,ue&=8191;let ce=C+w*m+E*f+I*_+A*p+V*h;C=ce>>>13,ce&=8191,ce+=O*d+S*u+$*l+k*c+M*(5*y),C+=ce>>>13,ce&=8191;let oe=C+w*y+E*m+I*f+A*_+V*p;C=oe>>>13,oe&=8191,oe+=O*h+S*d+$*u+k*l+M*c,C+=oe>>>13,oe&=8191,C=(C<<2)+C|0,C=C+N|0,N=C&8191,C=C>>>13,j+=C,s[0]=N,s[1]=j,s[2]=z,s[3]=F,s[4]=W,s[5]=H,s[6]=G,s[7]=ue,s[8]=ce,s[9]=oe}finalize(){const{h:t,pad:e}=this,n=new Uint16Array(10);let i=t[1]>>>13;t[1]&=8191;for(let c=2;c<10;c++)t[c]+=i,i=t[c]>>>13,t[c]&=8191;t[0]+=i*5,i=t[0]>>>13,t[0]&=8191,t[1]+=i,i=t[1]>>>13,t[1]&=8191,t[2]+=i,n[0]=t[0]+5,i=n[0]>>>13,n[0]&=8191;for(let c=1;c<10;c++)n[c]=t[c]+i,i=n[c]>>>13,n[c]&=8191;n[9]-=8192;let s=(i^1)-1;for(let c=0;c<10;c++)n[c]&=s;s=~s;for(let c=0;c<10;c++)t[c]=t[c]&s|n[c];t[0]=(t[0]|t[1]<<13)&65535,t[1]=(t[1]>>>3|t[2]<<10)&65535,t[2]=(t[2]>>>6|t[3]<<7)&65535,t[3]=(t[3]>>>9|t[4]<<4)&65535,t[4]=(t[4]>>>12|t[5]<<1|t[6]<<14)&65535,t[5]=(t[6]>>>2|t[7]<<11)&65535,t[6]=(t[7]>>>5|t[8]<<8)&65535,t[7]=(t[8]>>>8|t[9]<<5)&65535;let o=t[0]+e[0];t[0]=o&65535;for(let c=1;c<8;c++)o=(t[c]+e[c]|0)+(o>>>16)|0,t[c]=o&65535;vr(n)}update(t){la(this),t=ts(t),qe(t);const{buffer:e,blockLen:n}=this,i=t.length;for(let s=0;s<i;){const o=Math.min(n-this.pos,i-s);if(o===n){for(;n<=i-s;s+=n)this.process(t,s);continue}e.set(t.subarray(s,s+o),this.pos),this.pos+=o,s+=o,this.pos===n&&(this.process(e,0,!1),this.pos=0)}return this}destroy(){vr(this.h,this.r,this.buffer,this.pad)}digestInto(t){la(this),Im(t,this),this.finished=!0;const{buffer:e,h:n}=this;let{pos:i}=this;if(i){for(e[i++]=1;i<16;i++)e[i]=0;this.process(e,0,!0)}this.finalize();let s=0;for(let o=0;o<8;o++)t[s++]=n[o]>>>0,t[s++]=n[o]>>>8;return t}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const n=t.slice(0,e);return this.destroy(),n}}function Mm(r){const t=(n,i)=>r(i).update(ts(n)).digest(),e=r(new Uint8Array(32));return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=n=>r(n),t}const Bm=Mm(r=>new qm(r));function jm(r,t,e,n,i,s=20){let o=r[0],c=r[1],l=r[2],u=r[3],d=t[0],h=t[1],p=t[2],_=t[3],f=t[4],m=t[5],y=t[6],b=t[7],R=i,v=e[0],P=e[1],T=e[2],g=o,D=c,L=l,w=u,E=d,I=h,A=p,V=_,O=f,S=m,$=y,k=b,M=R,C=v,N=P,j=T;for(let F=0;F<s;F+=2)g=g+E|0,M=Y(M^g,16),O=O+M|0,E=Y(E^O,12),g=g+E|0,M=Y(M^g,8),O=O+M|0,E=Y(E^O,7),D=D+I|0,C=Y(C^D,16),S=S+C|0,I=Y(I^S,12),D=D+I|0,C=Y(C^D,8),S=S+C|0,I=Y(I^S,7),L=L+A|0,N=Y(N^L,16),$=$+N|0,A=Y(A^$,12),L=L+A|0,N=Y(N^L,8),$=$+N|0,A=Y(A^$,7),w=w+V|0,j=Y(j^w,16),k=k+j|0,V=Y(V^k,12),w=w+V|0,j=Y(j^w,8),k=k+j|0,V=Y(V^k,7),g=g+I|0,j=Y(j^g,16),$=$+j|0,I=Y(I^$,12),g=g+I|0,j=Y(j^g,8),$=$+j|0,I=Y(I^$,7),D=D+A|0,M=Y(M^D,16),k=k+M|0,A=Y(A^k,12),D=D+A|0,M=Y(M^D,8),k=k+M|0,A=Y(A^k,7),L=L+V|0,C=Y(C^L,16),O=O+C|0,V=Y(V^O,12),L=L+V|0,C=Y(C^L,8),O=O+C|0,V=Y(V^O,7),w=w+E|0,N=Y(N^w,16),S=S+N|0,E=Y(E^S,12),w=w+E|0,N=Y(N^w,8),S=S+N|0,E=Y(E^S,7);let z=0;n[z++]=o+g|0,n[z++]=c+D|0,n[z++]=l+L|0,n[z++]=u+w|0,n[z++]=d+E|0,n[z++]=h+I|0,n[z++]=p+A|0,n[z++]=_+V|0,n[z++]=f+O|0,n[z++]=m+S|0,n[z++]=y+$|0,n[z++]=b+k|0,n[z++]=R+M|0,n[z++]=v+C|0,n[z++]=P+N|0,n[z++]=T+j|0}const zm=Um(jm,{counterRight:!1,counterLength:4,allowShortKeys:!1}),Km=new Uint8Array(16),pa=(r,t)=>{r.update(t);const e=t.length%16;e&&r.update(Km.subarray(e))},Fm=new Uint8Array(32);function _a(r,t,e,n,i){const s=r(t,e,Fm),o=Bm.create(s);i&&pa(o,i),pa(o,n);const c=Dm(n.length,i?i.length:0,!0);o.update(c);const l=o.digest();return vr(s,c),l}const Wm=r=>(t,e,n)=>({encrypt(i,s){const o=i.length;s=ua(o+16,s,!1),s.set(i);const c=s.subarray(0,-16);r(t,e,c,c,1);const l=_a(r,t,e,c,n);return s.set(l,o),vr(l),s},decrypt(i,s){s=ua(i.length-16,s,!1);const o=i.subarray(0,-16),c=i.subarray(-16),l=_a(r,t,e,o,n);if(!Rm(c,l))throw new Error("invalid tag");return s.set(i.subarray(0,-16)),r(t,e,s,s,1),vr(l),s}}),ql=Lm({blockSize:64,nonceLength:12,tagLength:16},Wm(zm));let Ml=class extends ti{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,Zs(t);const n=at(e);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(n.length>i?t.create().update(n).digest():n);for(let o=0;o<s.length;o++)s[o]^=54;this.iHash.update(s),this.oHash=t.create();for(let o=0;o<s.length;o++)s[o]^=106;this.oHash.update(s),rt(s)}update(t){return Ft(this),this.iHash.update(t),this}digestInto(t){Ft(this),tt(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:e,iHash:n,finished:i,destroyed:s,blockLen:o,outputLen:c}=this;return t=t,t.finished=i,t.destroyed=s,t.blockLen=o,t.outputLen=c,t.oHash=e._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const ni=(r,t,e)=>new Ml(r,t).update(e).digest();ni.create=(r,t)=>new Ml(r,t);function Hm(r,t,e){return Zs(r),e===void 0&&(e=new Uint8Array(r.outputLen)),ni(r,at(e),at(t))}const bi=Uint8Array.from([0]),fa=Uint8Array.of();function Gm(r,t,e,n=32){Zs(r),Rt(n);const i=r.outputLen;if(n>255*i)throw new Error("Length should be <= 255*HashLen");const s=Math.ceil(n/i);e===void 0&&(e=fa);const o=new Uint8Array(s*i),c=ni.create(r,t),l=c._cloneInto(),u=new Uint8Array(c.outputLen);for(let d=0;d<s;d++)bi[0]=d+1,l.update(d===0?fa:u).update(e).update(bi).digestInto(u),o.set(u,i*d),c._cloneInto(l);return c.destroy(),l.destroy(),rt(u,bi),o.slice(0,n)}const Jm=(r,t,e,n,i)=>Gm(r,Hm(r,t,e),n,i),ii=ri,to=BigInt(0),is=BigInt(1);function Gn(r,t){if(typeof t!="boolean")throw new Error(r+" boolean expected, got "+t)}function Tn(r){const t=r.toString(16);return t.length&1?"0"+t:t}function Bl(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);return r===""?to:BigInt("0x"+r)}function si(r){return Bl(on(r))}function Jn(r){return tt(r),Bl(on(Uint8Array.from(r).reverse()))}function ro(r,t){return Ys(r.toString(16).padStart(t*2,"0"))}function no(r,t){return ro(r,t).reverse()}function Ue(r,t,e){let n;if(typeof t=="string")try{n=Ys(t)}catch(s){throw new Error(r+" must be hex string or Uint8Array, cause: "+s)}else if(Js(t))n=Uint8Array.from(t);else throw new Error(r+" must be hex string or Uint8Array");const i=n.length;if(typeof e=="number"&&i!==e)throw new Error(r+" of length "+e+" expected, got "+i);return n}const Ii=r=>typeof r=="bigint"&&to<=r;function Zm(r,t,e){return Ii(r)&&Ii(t)&&Ii(e)&&t<=r&&r<e}function ss(r,t,e,n){if(!Zm(t,e,n))throw new Error("expected valid "+r+": "+e+" <= n < "+n+", got "+t)}function Qm(r){let t;for(t=0;r>to;r>>=is,t+=1);return t}const oi=r=>(is<<BigInt(r))-is;function Ym(r,t,e){if(typeof r!="number"||r<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof e!="function")throw new Error("hmacFn must be a function");const n=p=>new Uint8Array(p),i=p=>Uint8Array.of(p);let s=n(r),o=n(r),c=0;const l=()=>{s.fill(1),o.fill(0),c=0},u=(...p)=>e(o,s,...p),d=(p=n(0))=>{o=u(i(0),p),s=u(),p.length!==0&&(o=u(i(1),p),s=u())},h=()=>{if(c++>=1e3)throw new Error("drbg: tried 1000 values");let p=0;const _=[];for(;p<t;){s=u();const f=s.slice();_.push(f),p+=s.length}return er(..._)};return(p,_)=>{l(),d(p);let f;for(;!(f=_(h()));)d();return l(),f}}function ai(r,t,e={}){if(!r||typeof r!="object")throw new Error("expected valid options object");function n(i,s,o){const c=r[i];if(o&&c===void 0)return;const l=typeof c;if(l!==s||c===null)throw new Error(`param "${i}" is invalid: expected ${s}, got ${l}`)}Object.entries(t).forEach(([i,s])=>n(i,s,!1)),Object.entries(e).forEach(([i,s])=>n(i,s,!0))}function ma(r){const t=new WeakMap;return(e,...n)=>{const i=t.get(e);if(i!==void 0)return i;const s=r(e,...n);return t.set(e,s),s}}const je=BigInt(0),Se=BigInt(1),tr=BigInt(2),Xm=BigInt(3),jl=BigInt(4),zl=BigInt(5),Kl=BigInt(8);function Xe(r,t){const e=r%t;return e>=je?e:t+e}function it(r,t,e){let n=r;for(;t-- >je;)n*=n,n%=e;return n}function ya(r,t){if(r===je)throw new Error("invert: expected non-zero number");if(t<=je)throw new Error("invert: expected positive modulus, got "+t);let e=Xe(r,t),n=t,i=je,s=Se;for(;e!==je;){const o=n/e,c=n%e,l=i-s*o;n=e,e=c,i=s,s=l}if(n!==Se)throw new Error("invert: does not exist");return Xe(i,t)}function Fl(r,t){const e=(r.ORDER+Se)/jl,n=r.pow(t,e);if(!r.eql(r.sqr(n),t))throw new Error("Cannot find square root");return n}function ey(r,t){const e=(r.ORDER-zl)/Kl,n=r.mul(t,tr),i=r.pow(n,e),s=r.mul(t,i),o=r.mul(r.mul(s,tr),i),c=r.mul(s,r.sub(o,r.ONE));if(!r.eql(r.sqr(c),t))throw new Error("Cannot find square root");return c}function ty(r){if(r<BigInt(3))throw new Error("sqrt is not defined for small field");let t=r-Se,e=0;for(;t%tr===je;)t/=tr,e++;let n=tr;const i=Vr(r);for(;wa(i,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(e===1)return Fl;let s=i.pow(n,t);const o=(t+Se)/tr;return function(c,l){if(c.is0(l))return l;if(wa(c,l)!==1)throw new Error("Cannot find square root");let u=e,d=c.mul(c.ONE,s),h=c.pow(l,t),p=c.pow(l,o);for(;!c.eql(h,c.ONE);){if(c.is0(h))return c.ZERO;let _=1,f=c.sqr(h);for(;!c.eql(f,c.ONE);)if(_++,f=c.sqr(f),_===u)throw new Error("Cannot find square root");const m=Se<<BigInt(u-_-1),y=c.pow(d,m);u=_,d=c.sqr(y),h=c.mul(h,d),p=c.mul(p,y)}return p}}function ry(r){return r%jl===Xm?Fl:r%Kl===zl?ey:ty(r)}const ny=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function iy(r){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},e=ny.reduce((n,i)=>(n[i]="function",n),t);return ai(r,e),r}function sy(r,t,e){if(e<je)throw new Error("invalid exponent, negatives unsupported");if(e===je)return r.ONE;if(e===Se)return t;let n=r.ONE,i=t;for(;e>je;)e&Se&&(n=r.mul(n,i)),i=r.sqr(i),e>>=Se;return n}function Wl(r,t,e=!1){const n=new Array(t.length).fill(e?r.ZERO:void 0),i=t.reduce((o,c,l)=>r.is0(c)?o:(n[l]=o,r.mul(o,c)),r.ONE),s=r.inv(i);return t.reduceRight((o,c,l)=>r.is0(c)?o:(n[l]=r.mul(o,n[l]),r.mul(o,c)),s),n}function wa(r,t){const e=(r.ORDER-Se)/tr,n=r.pow(t,e),i=r.eql(n,r.ONE),s=r.eql(n,r.ZERO),o=r.eql(n,r.neg(r.ONE));if(!i&&!s&&!o)throw new Error("invalid Legendre symbol result");return i?1:s?0:-1}function oy(r,t){t!==void 0&&Rt(t);const e=t!==void 0?t:r.toString(2).length,n=Math.ceil(e/8);return{nBitLength:e,nByteLength:n}}function Vr(r,t,e=!1,n={}){if(r<=je)throw new Error("invalid field: expected ORDER > 0, got "+r);let i,s;if(typeof t=="object"&&t!=null){if(n.sqrt||e)throw new Error("cannot specify opts in two arguments");const d=t;d.BITS&&(i=d.BITS),d.sqrt&&(s=d.sqrt),typeof d.isLE=="boolean"&&(e=d.isLE)}else typeof t=="number"&&(i=t),n.sqrt&&(s=n.sqrt);const{nBitLength:o,nByteLength:c}=oy(r,i);if(c>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let l;const u=Object.freeze({ORDER:r,isLE:e,BITS:o,BYTES:c,MASK:oi(o),ZERO:je,ONE:Se,create:d=>Xe(d,r),isValid:d=>{if(typeof d!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof d);return je<=d&&d<r},is0:d=>d===je,isValidNot0:d=>!u.is0(d)&&u.isValid(d),isOdd:d=>(d&Se)===Se,neg:d=>Xe(-d,r),eql:(d,h)=>d===h,sqr:d=>Xe(d*d,r),add:(d,h)=>Xe(d+h,r),sub:(d,h)=>Xe(d-h,r),mul:(d,h)=>Xe(d*h,r),pow:(d,h)=>sy(u,d,h),div:(d,h)=>Xe(d*ya(h,r),r),sqrN:d=>d*d,addN:(d,h)=>d+h,subN:(d,h)=>d-h,mulN:(d,h)=>d*h,inv:d=>ya(d,r),sqrt:s||(d=>(l||(l=ry(r)),l(u,d))),toBytes:d=>e?no(d,c):ro(d,c),fromBytes:d=>{if(d.length!==c)throw new Error("Field.fromBytes: expected "+c+" bytes, got "+d.length);return e?Jn(d):si(d)},invertBatch:d=>Wl(u,d),cmov:(d,h,p)=>p?h:d});return Object.freeze(u)}function Hl(r){if(typeof r!="bigint")throw new Error("field order must be bigint");const t=r.toString(2).length;return Math.ceil(t/8)}function Gl(r){const t=Hl(r);return t+Math.ceil(t/2)}function ay(r,t,e=!1){const n=r.length,i=Hl(t),s=Gl(t);if(n<16||n<s||n>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+n);const o=e?Jn(r):si(r),c=Xe(o,t-Se)+Se;return e?no(c,i):ro(c,i)}const br=BigInt(0),rr=BigInt(1);function Gr(r,t){const e=t.negate();return r?e:t}function cy(r,t,e){const n=s=>s.pz,i=Wl(r.Fp,e.map(n));return e.map((s,o)=>s.toAffine(i[o])).map(r.fromAffine)}function Jl(r,t){if(!Number.isSafeInteger(r)||r<=0||r>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+r)}function Ai(r,t){Jl(r,t);const e=Math.ceil(t/r)+1,n=2**(r-1),i=2**r,s=oi(r),o=BigInt(r);return{windows:e,windowSize:n,mask:s,maxNumber:i,shiftBy:o}}function ga(r,t,e){const{windowSize:n,mask:i,maxNumber:s,shiftBy:o}=e;let c=Number(r&i),l=r>>o;c>n&&(c-=s,l+=rr);const u=t*n,d=u+Math.abs(c)-1,h=c===0,p=c<0,_=t%2!==0;return{nextN:l,offset:d,isZero:h,isNeg:p,isNegF:_,offsetF:u}}function ly(r,t){if(!Array.isArray(r))throw new Error("array expected");r.forEach((e,n)=>{if(!(e instanceof t))throw new Error("invalid point at index "+n)})}function uy(r,t){if(!Array.isArray(r))throw new Error("array of scalars expected");r.forEach((e,n)=>{if(!t.isValid(e))throw new Error("invalid scalar at index "+n)})}const Ti=new WeakMap,Zl=new WeakMap;function Pi(r){return Zl.get(r)||1}function Ea(r){if(r!==br)throw new Error("invalid wNAF")}function dy(r,t){return{constTimeNegate:Gr,hasPrecomputes(e){return Pi(e)!==1},unsafeLadder(e,n,i=r.ZERO){let s=e;for(;n>br;)n&rr&&(i=i.add(s)),s=s.double(),n>>=rr;return i},precomputeWindow(e,n){const{windows:i,windowSize:s}=Ai(n,t),o=[];let c=e,l=c;for(let u=0;u<i;u++){l=c,o.push(l);for(let d=1;d<s;d++)l=l.add(c),o.push(l);c=l.double()}return o},wNAF(e,n,i){let s=r.ZERO,o=r.BASE;const c=Ai(e,t);for(let l=0;l<c.windows;l++){const{nextN:u,offset:d,isZero:h,isNeg:p,isNegF:_,offsetF:f}=ga(i,l,c);i=u,h?o=o.add(Gr(_,n[f])):s=s.add(Gr(p,n[d]))}return Ea(i),{p:s,f:o}},wNAFUnsafe(e,n,i,s=r.ZERO){const o=Ai(e,t);for(let c=0;c<o.windows&&i!==br;c++){const{nextN:l,offset:u,isZero:d,isNeg:h}=ga(i,c,o);if(i=l,!d){const p=n[u];s=s.add(h?p.negate():p)}}return Ea(i),s},getPrecomputes(e,n,i){let s=Ti.get(n);return s||(s=this.precomputeWindow(n,e),e!==1&&(typeof i=="function"&&(s=i(s)),Ti.set(n,s))),s},wNAFCached(e,n,i){const s=Pi(e);return this.wNAF(s,this.getPrecomputes(s,e,i),n)},wNAFCachedUnsafe(e,n,i,s){const o=Pi(e);return o===1?this.unsafeLadder(e,n,s):this.wNAFUnsafe(o,this.getPrecomputes(o,e,i),n,s)},setWindowSize(e,n){Jl(n,t),Zl.set(e,n),Ti.delete(e)}}}function hy(r,t,e,n){let i=t,s=r.ZERO,o=r.ZERO;for(;e>br||n>br;)e&rr&&(s=s.add(i)),n&rr&&(o=o.add(i)),i=i.double(),e>>=rr,n>>=rr;return{p1:s,p2:o}}function py(r,t,e,n){ly(e,r),uy(n,t);const i=e.length,s=n.length;if(i!==s)throw new Error("arrays of points and scalars must have equal length");const o=r.ZERO,c=Qm(BigInt(i));let l=1;c>12?l=c-3:c>4?l=c-2:c>0&&(l=2);const u=oi(l),d=new Array(Number(u)+1).fill(o),h=Math.floor((t.BITS-1)/l)*l;let p=o;for(let _=h;_>=0;_-=l){d.fill(o);for(let m=0;m<s;m++){const y=n[m],b=Number(y>>BigInt(_)&u);d[b]=d[b].add(e[m])}let f=o;for(let m=d.length-1,y=o;m>0;m--)y=y.add(d[m]),f=f.add(y);if(p=p.add(f),_!==0)for(let m=0;m<l;m++)p=p.double()}return p}function va(r,t){if(t){if(t.ORDER!==r)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return iy(t),t}else return Vr(r)}function _y(r,t,e={}){if(!t||typeof t!="object")throw new Error(`expected valid ${r} CURVE object`);for(const o of["p","n","h"]){const c=t[o];if(!(typeof c=="bigint"&&c>br))throw new Error(`CURVE.${o} must be positive bigint`)}const n=va(t.p,e.Fp),i=va(t.n,e.Fn),s=["Gx","Gy","a","b"];for(const o of s)if(!n.isValid(t[o]))throw new Error(`CURVE.${o} must be valid field element of CURVE.Fp`);return{Fp:n,Fn:i}}BigInt(0),BigInt(1),BigInt(2),BigInt(8);const kr=BigInt(0),fr=BigInt(1),Pn=BigInt(2);function fy(r){return ai(r,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...r})}function my(r){const t=fy(r),{P:e,type:n,adjustScalarBytes:i,powPminus2:s,randomBytes:o}=t,c=n==="x25519";if(!c&&n!=="x448")throw new Error("invalid type");const l=o||Dr,u=c?255:448,d=c?32:56,h=BigInt(c?9:5),p=BigInt(c?121665:39081),_=c?Pn**BigInt(254):Pn**BigInt(447),f=c?BigInt(8)*Pn**BigInt(251)-fr:BigInt(4)*Pn**BigInt(445)-fr,m=_+f+fr,y=w=>Xe(w,e),b=R(h);function R(w){return no(y(w),d)}function v(w){const E=Ue("u coordinate",w,d);return c&&(E[31]&=127),y(Jn(E))}function P(w){return Jn(i(Ue("scalar",w,d)))}function T(w,E){const I=L(v(E),P(w));if(I===kr)throw new Error("invalid private or public key received");return R(I)}function g(w){return T(w,b)}function D(w,E,I){const A=y(w*(E-I));return E=y(E-A),I=y(I+A),{x_2:E,x_3:I}}function L(w,E){ss("u",w,kr,e),ss("scalar",E,_,m);const I=E,A=w;let V=fr,O=kr,S=w,$=fr,k=kr;for(let C=BigInt(u-1);C>=kr;C--){const N=I>>C&fr;k^=N,{x_2:V,x_3:S}=D(k,V,S),{x_2:O,x_3:$}=D(k,O,$),k=N;const j=V+O,z=y(j*j),F=V-O,W=y(F*F),H=z-W,G=S+$,ue=S-$,ce=y(ue*j),oe=y(G*F),Ge=ce+oe,wt=ce-oe;S=y(Ge*Ge),$=y(A*y(wt*wt)),V=y(z*W),O=y(H*(z+y(p*H)))}({x_2:V,x_3:S}=D(k,V,S)),{x_2:O,x_3:$}=D(k,O,$);const M=s(O);return y(V*M)}return{scalarMult:T,scalarMultBase:g,getSharedSecret:(w,E)=>T(w,E),getPublicKey:w=>g(w),utils:{randomPrivateKey:()=>l(d)},GuBytes:b.slice()}}BigInt(0);const yy=BigInt(1),ba=BigInt(2),wy=BigInt(3),gy=BigInt(5);BigInt(8);const Ql={p:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function Ey(r){const t=BigInt(10),e=BigInt(20),n=BigInt(40),i=BigInt(80),s=Ql.p,o=r*r%s*r%s,c=it(o,ba,s)*o%s,l=it(c,yy,s)*r%s,u=it(l,gy,s)*l%s,d=it(u,t,s)*u%s,h=it(d,e,s)*d%s,p=it(h,n,s)*h%s,_=it(p,i,s)*p%s,f=it(_,i,s)*p%s,m=it(f,t,s)*u%s;return{pow_p_5_8:it(m,ba,s)*r%s,b2:o}}function vy(r){return r[0]&=248,r[31]&=127,r[31]|=64,r}const os=(()=>{const r=Ql.p;return my({P:r,type:"x25519",powPminus2:t=>{const{pow_p_5_8:e,b2:n}=Ey(t);return Xe(it(e,wy,r)*n,r)},adjustScalarBytes:vy})})();function Ia(r){r.lowS!==void 0&&Gn("lowS",r.lowS),r.prehash!==void 0&&Gn("prehash",r.prehash)}class by extends Error{constructor(t=""){super(t)}}const At={Err:by,_tlv:{encode:(r,t)=>{const{Err:e}=At;if(r<0||r>256)throw new e("tlv.encode: wrong tag");if(t.length&1)throw new e("tlv.encode: unpadded data");const n=t.length/2,i=Tn(n);if(i.length/2&128)throw new e("tlv.encode: long form length too big");const s=n>127?Tn(i.length/2|128):"";return Tn(r)+s+i+t},decode(r,t){const{Err:e}=At;let n=0;if(r<0||r>256)throw new e("tlv.encode: wrong tag");if(t.length<2||t[n++]!==r)throw new e("tlv.decode: wrong tlv");const i=t[n++],s=!!(i&128);let o=0;if(!s)o=i;else{const l=i&127;if(!l)throw new e("tlv.decode(long): indefinite length not supported");if(l>4)throw new e("tlv.decode(long): byte length is too big");const u=t.subarray(n,n+l);if(u.length!==l)throw new e("tlv.decode: length bytes not complete");if(u[0]===0)throw new e("tlv.decode(long): zero leftmost byte");for(const d of u)o=o<<8|d;if(n+=l,o<128)throw new e("tlv.decode(long): not minimal encoding")}const c=t.subarray(n,n+o);if(c.length!==o)throw new e("tlv.decode: wrong value length");return{v:c,l:t.subarray(n+o)}}},_int:{encode(r){const{Err:t}=At;if(r<Jr)throw new t("integer: negative integers are not allowed");let e=Tn(r);if(Number.parseInt(e[0],16)&8&&(e="00"+e),e.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return e},decode(r){const{Err:t}=At;if(r[0]&128)throw new t("invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return si(r)}},toSig(r){const{Err:t,_int:e,_tlv:n}=At,i=Ue("signature",r),{v:s,l:o}=n.decode(48,i);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:c,l}=n.decode(2,s),{v:u,l:d}=n.decode(2,l);if(d.length)throw new t("invalid signature: left bytes after parsing");return{r:e.decode(c),s:e.decode(u)}},hexFromSig(r){const{_tlv:t,_int:e}=At,n=t.encode(2,e.encode(r.r)),i=t.encode(2,e.encode(r.s)),s=n+i;return t.encode(48,s)}},Jr=BigInt(0),Zr=BigInt(1),Iy=BigInt(2),On=BigInt(3),Ay=BigInt(4);function Ty(r,t,e){function n(i){const s=r.sqr(i),o=r.mul(s,i);return r.add(r.add(o,r.mul(i,t)),e)}return n}function Yl(r,t,e){const{BYTES:n}=r;function i(s){let o;if(typeof s=="bigint")o=s;else{let c=Ue("private key",s);if(t){if(!t.includes(c.length*2))throw new Error("invalid private key");const l=new Uint8Array(n);l.set(c,l.length-c.length),c=l}try{o=r.fromBytes(c)}catch{throw new Error(`invalid private key: expected ui8a of size ${n}, got ${typeof s}`)}}if(e&&(o=r.create(o)),!r.isValidNot0(o))throw new Error("invalid private key: out of range [1..N-1]");return o}return i}function Py(r,t={}){const{Fp:e,Fn:n}=_y("weierstrass",r,t),{h:i,n:s}=r;ai(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:o}=t;if(o&&(!e.is0(r.a)||typeof o.beta!="bigint"||typeof o.splitScalar!="function"))throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function');function c(){if(!e.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function l(L,w,E){const{x:I,y:A}=w.toAffine(),V=e.toBytes(I);if(Gn("isCompressed",E),E){c();const O=!e.isOdd(A);return er(Xl(O),V)}else return er(Uint8Array.of(4),V,e.toBytes(A))}function u(L){tt(L);const w=e.BYTES,E=w+1,I=2*w+1,A=L.length,V=L[0],O=L.subarray(1);if(A===E&&(V===2||V===3)){const S=e.fromBytes(O);if(!e.isValid(S))throw new Error("bad point: is not on curve, wrong x");const $=p(S);let k;try{k=e.sqrt($)}catch(C){const N=C instanceof Error?": "+C.message:"";throw new Error("bad point: is not on curve, sqrt error"+N)}c();const M=e.isOdd(k);return(V&1)===1!==M&&(k=e.neg(k)),{x:S,y:k}}else if(A===I&&V===4){const S=e.fromBytes(O.subarray(w*0,w*1)),$=e.fromBytes(O.subarray(w*1,w*2));if(!_(S,$))throw new Error("bad point: is not on curve");return{x:S,y:$}}else throw new Error(`bad point: got length ${A}, expected compressed=${E} or uncompressed=${I}`)}const d=t.toBytes||l,h=t.fromBytes||u,p=Ty(e,r.a,r.b);function _(L,w){const E=e.sqr(w),I=p(L);return e.eql(E,I)}if(!_(r.Gx,r.Gy))throw new Error("bad curve params: generator point");const f=e.mul(e.pow(r.a,On),Ay),m=e.mul(e.sqr(r.b),BigInt(27));if(e.is0(e.add(f,m)))throw new Error("bad curve params: a or b");function y(L,w,E=!1){if(!e.isValid(w)||E&&e.is0(w))throw new Error(`bad point coordinate ${L}`);return w}function b(L){if(!(L instanceof T))throw new Error("ProjectivePoint expected")}const R=ma((L,w)=>{const{px:E,py:I,pz:A}=L;if(e.eql(A,e.ONE))return{x:E,y:I};const V=L.is0();w==null&&(w=V?e.ONE:e.inv(A));const O=e.mul(E,w),S=e.mul(I,w),$=e.mul(A,w);if(V)return{x:e.ZERO,y:e.ZERO};if(!e.eql($,e.ONE))throw new Error("invZ was invalid");return{x:O,y:S}}),v=ma(L=>{if(L.is0()){if(t.allowInfinityPoint&&!e.is0(L.py))return;throw new Error("bad point: ZERO")}const{x:w,y:E}=L.toAffine();if(!e.isValid(w)||!e.isValid(E))throw new Error("bad point: x or y not field elements");if(!_(w,E))throw new Error("bad point: equation left != right");if(!L.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function P(L,w,E,I,A){return E=new T(e.mul(E.px,L),E.py,E.pz),w=Gr(I,w),E=Gr(A,E),w.add(E)}class T{constructor(w,E,I){this.px=y("x",w),this.py=y("y",E,!0),this.pz=y("z",I),Object.freeze(this)}static fromAffine(w){const{x:E,y:I}=w||{};if(!w||!e.isValid(E)||!e.isValid(I))throw new Error("invalid affine point");if(w instanceof T)throw new Error("projective point not allowed");return e.is0(E)&&e.is0(I)?T.ZERO:new T(E,I,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(w){return cy(T,"pz",w)}static fromBytes(w){return tt(w),T.fromHex(w)}static fromHex(w){const E=T.fromAffine(h(Ue("pointHex",w)));return E.assertValidity(),E}static fromPrivateKey(w){const E=Yl(n,t.allowedPrivateKeyLengths,t.wrapPrivateKey);return T.BASE.multiply(E(w))}static msm(w,E){return py(T,n,w,E)}precompute(w=8,E=!0){return D.setWindowSize(this,w),E||this.multiply(On),this}_setWindowSize(w){this.precompute(w)}assertValidity(){v(this)}hasEvenY(){const{y:w}=this.toAffine();if(!e.isOdd)throw new Error("Field doesn't support isOdd");return!e.isOdd(w)}equals(w){b(w);const{px:E,py:I,pz:A}=this,{px:V,py:O,pz:S}=w,$=e.eql(e.mul(E,S),e.mul(V,A)),k=e.eql(e.mul(I,S),e.mul(O,A));return $&&k}negate(){return new T(this.px,e.neg(this.py),this.pz)}double(){const{a:w,b:E}=r,I=e.mul(E,On),{px:A,py:V,pz:O}=this;let S=e.ZERO,$=e.ZERO,k=e.ZERO,M=e.mul(A,A),C=e.mul(V,V),N=e.mul(O,O),j=e.mul(A,V);return j=e.add(j,j),k=e.mul(A,O),k=e.add(k,k),S=e.mul(w,k),$=e.mul(I,N),$=e.add(S,$),S=e.sub(C,$),$=e.add(C,$),$=e.mul(S,$),S=e.mul(j,S),k=e.mul(I,k),N=e.mul(w,N),j=e.sub(M,N),j=e.mul(w,j),j=e.add(j,k),k=e.add(M,M),M=e.add(k,M),M=e.add(M,N),M=e.mul(M,j),$=e.add($,M),N=e.mul(V,O),N=e.add(N,N),M=e.mul(N,j),S=e.sub(S,M),k=e.mul(N,C),k=e.add(k,k),k=e.add(k,k),new T(S,$,k)}add(w){b(w);const{px:E,py:I,pz:A}=this,{px:V,py:O,pz:S}=w;let $=e.ZERO,k=e.ZERO,M=e.ZERO;const C=r.a,N=e.mul(r.b,On);let j=e.mul(E,V),z=e.mul(I,O),F=e.mul(A,S),W=e.add(E,I),H=e.add(V,O);W=e.mul(W,H),H=e.add(j,z),W=e.sub(W,H),H=e.add(E,A);let G=e.add(V,S);return H=e.mul(H,G),G=e.add(j,F),H=e.sub(H,G),G=e.add(I,A),$=e.add(O,S),G=e.mul(G,$),$=e.add(z,F),G=e.sub(G,$),M=e.mul(C,H),$=e.mul(N,F),M=e.add($,M),$=e.sub(z,M),M=e.add(z,M),k=e.mul($,M),z=e.add(j,j),z=e.add(z,j),F=e.mul(C,F),H=e.mul(N,H),z=e.add(z,F),F=e.sub(j,F),F=e.mul(C,F),H=e.add(H,F),j=e.mul(z,H),k=e.add(k,j),j=e.mul(G,H),$=e.mul(W,$),$=e.sub($,j),j=e.mul(W,z),M=e.mul(G,M),M=e.add(M,j),new T($,k,M)}subtract(w){return this.add(w.negate())}is0(){return this.equals(T.ZERO)}multiply(w){const{endo:E}=t;if(!n.isValidNot0(w))throw new Error("invalid scalar: out of range");let I,A;const V=O=>D.wNAFCached(this,O,T.normalizeZ);if(E){const{k1neg:O,k1:S,k2neg:$,k2:k}=E.splitScalar(w),{p:M,f:C}=V(S),{p:N,f:j}=V(k);A=C.add(j),I=P(E.beta,M,N,O,$)}else{const{p:O,f:S}=V(w);I=O,A=S}return T.normalizeZ([I,A])[0]}multiplyUnsafe(w){const{endo:E}=t,I=this;if(!n.isValid(w))throw new Error("invalid scalar: out of range");if(w===Jr||I.is0())return T.ZERO;if(w===Zr)return I;if(D.hasPrecomputes(this))return this.multiply(w);if(E){const{k1neg:A,k1:V,k2neg:O,k2:S}=E.splitScalar(w),{p1:$,p2:k}=hy(T,I,V,S);return P(E.beta,$,k,A,O)}else return D.wNAFCachedUnsafe(I,w)}multiplyAndAddUnsafe(w,E,I){const A=this.multiplyUnsafe(E).add(w.multiplyUnsafe(I));return A.is0()?void 0:A}toAffine(w){return R(this,w)}isTorsionFree(){const{isTorsionFree:w}=t;return i===Zr?!0:w?w(T,this):D.wNAFCachedUnsafe(this,s).is0()}clearCofactor(){const{clearCofactor:w}=t;return i===Zr?this:w?w(T,this):this.multiplyUnsafe(i)}toBytes(w=!0){return Gn("isCompressed",w),this.assertValidity(),d(T,this,w)}toRawBytes(w=!0){return this.toBytes(w)}toHex(w=!0){return on(this.toBytes(w))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}T.BASE=new T(r.Gx,r.Gy,e.ONE),T.ZERO=new T(e.ZERO,e.ONE,e.ZERO),T.Fp=e,T.Fn=n;const g=n.BITS,D=dy(T,t.endo?Math.ceil(g/2):g);return T}function Xl(r){return Uint8Array.of(r?2:3)}function Oy(r,t,e={}){ai(t,{hash:"function"},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const n=t.randomBytes||Dr,i=t.hmac||((I,...A)=>ni(t.hash,I,er(...A))),{Fp:s,Fn:o}=r,{ORDER:c,BITS:l}=o;function u(I){const A=c>>Zr;return I>A}function d(I){return u(I)?o.neg(I):I}function h(I,A){if(!o.isValidNot0(A))throw new Error(`invalid signature ${I}: out of range 1..CURVE.n`)}class p{constructor(A,V,O){h("r",A),h("s",V),this.r=A,this.s=V,O!=null&&(this.recovery=O),Object.freeze(this)}static fromCompact(A){const V=o.BYTES,O=Ue("compactSignature",A,V*2);return new p(o.fromBytes(O.subarray(0,V)),o.fromBytes(O.subarray(V,V*2)))}static fromDER(A){const{r:V,s:O}=At.toSig(Ue("DER",A));return new p(V,O)}assertValidity(){}addRecoveryBit(A){return new p(this.r,this.s,A)}recoverPublicKey(A){const V=s.ORDER,{r:O,s:S,recovery:$}=this;if($==null||![0,1,2,3].includes($))throw new Error("recovery id invalid");if(c*Iy<V&&$>1)throw new Error("recovery id is ambiguous for h>1 curve");const k=$===2||$===3?O+c:O;if(!s.isValid(k))throw new Error("recovery id 2 or 3 invalid");const M=s.toBytes(k),C=r.fromHex(er(Xl(($&1)===0),M)),N=o.inv(k),j=v(Ue("msgHash",A)),z=o.create(-j*N),F=o.create(S*N),W=r.BASE.multiplyUnsafe(z).add(C.multiplyUnsafe(F));if(W.is0())throw new Error("point at infinify");return W.assertValidity(),W}hasHighS(){return u(this.s)}normalizeS(){return this.hasHighS()?new p(this.r,o.neg(this.s),this.recovery):this}toBytes(A){if(A==="compact")return er(o.toBytes(this.r),o.toBytes(this.s));if(A==="der")return Ys(At.hexFromSig(this));throw new Error("invalid format")}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return on(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return on(this.toBytes("compact"))}}const _=Yl(o,e.allowedPrivateKeyLengths,e.wrapPrivateKey),f={isValidPrivateKey(I){try{return _(I),!0}catch{return!1}},normPrivateKeyToScalar:_,randomPrivateKey:()=>{const I=c;return ay(n(Gl(I)),I)},precompute(I=8,A=r.BASE){return A.precompute(I,!1)}};function m(I,A=!0){return r.fromPrivateKey(I).toBytes(A)}function y(I){if(typeof I=="bigint")return!1;if(I instanceof r)return!0;const A=Ue("key",I).length,V=s.BYTES,O=V+1,S=2*V+1;if(!(e.allowedPrivateKeyLengths||o.BYTES===O))return A===O||A===S}function b(I,A,V=!0){if(y(I)===!0)throw new Error("first arg must be private key");if(y(A)===!1)throw new Error("second arg must be public key");return r.fromHex(A).multiply(_(I)).toBytes(V)}const R=t.bits2int||function(I){if(I.length>8192)throw new Error("input is too large");const A=si(I),V=I.length*8-l;return V>0?A>>BigInt(V):A},v=t.bits2int_modN||function(I){return o.create(R(I))},P=oi(l);function T(I){return ss("num < 2^"+l,I,Jr,P),o.toBytes(I)}function g(I,A,V=D){if(["recovered","canonical"].some(W=>W in V))throw new Error("sign() legacy options not supported");const{hash:O}=t;let{lowS:S,prehash:$,extraEntropy:k}=V;S==null&&(S=!0),I=Ue("msgHash",I),Ia(V),$&&(I=Ue("prehashed msgHash",O(I)));const M=v(I),C=_(A),N=[T(C),T(M)];if(k!=null&&k!==!1){const W=k===!0?n(s.BYTES):k;N.push(Ue("extraEntropy",W))}const j=er(...N),z=M;function F(W){const H=R(W);if(!o.isValidNot0(H))return;const G=o.inv(H),ue=r.BASE.multiply(H).toAffine(),ce=o.create(ue.x);if(ce===Jr)return;const oe=o.create(G*o.create(z+ce*C));if(oe===Jr)return;let Ge=(ue.x===ce?0:2)|Number(ue.y&Zr),wt=oe;return S&&u(oe)&&(wt=d(oe),Ge^=1),new p(ce,wt,Ge)}return{seed:j,k2sig:F}}const D={lowS:t.lowS,prehash:!1},L={lowS:t.lowS,prehash:!1};function w(I,A,V=D){const{seed:O,k2sig:S}=g(I,A,V);return Ym(t.hash.outputLen,o.BYTES,i)(O,S)}r.BASE.precompute(8);function E(I,A,V,O=L){const S=I;A=Ue("msgHash",A),V=Ue("publicKey",V),Ia(O);const{lowS:$,prehash:k,format:M}=O;if("strict"in O)throw new Error("options.strict was renamed to lowS");if(M!==void 0&&!["compact","der","js"].includes(M))throw new Error('format must be "compact", "der" or "js"');const C=typeof S=="string"||Js(S),N=!C&&!M&&typeof S=="object"&&S!==null&&typeof S.r=="bigint"&&typeof S.s=="bigint";if(!C&&!N)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let j,z;try{if(N)if(M===void 0||M==="js")j=new p(S.r,S.s);else throw new Error("invalid format");if(C){try{M!=="compact"&&(j=p.fromDER(S))}catch(Ge){if(!(Ge instanceof At.Err))throw Ge}!j&&M!=="der"&&(j=p.fromCompact(S))}z=r.fromHex(V)}catch{return!1}if(!j||$&&j.hasHighS())return!1;k&&(A=t.hash(A));const{r:F,s:W}=j,H=v(A),G=o.inv(W),ue=o.create(H*G),ce=o.create(F*G),oe=r.BASE.multiplyUnsafe(ue).add(z.multiplyUnsafe(ce));return oe.is0()?!1:o.create(oe.x)===F}return Object.freeze({getPublicKey:m,getSharedSecret:b,sign:w,verify:E,utils:f,Point:r,Signature:p})}function Ry(r){const t={a:r.a,b:r.b,p:r.Fp.ORDER,n:r.n,h:r.h,Gx:r.Gx,Gy:r.Gy},e=r.Fp,n=Vr(t.n,r.nBitLength),i={Fp:e,Fn:n,allowedPrivateKeyLengths:r.allowedPrivateKeyLengths,allowInfinityPoint:r.allowInfinityPoint,endo:r.endo,wrapPrivateKey:r.wrapPrivateKey,isTorsionFree:r.isTorsionFree,clearCofactor:r.clearCofactor,fromBytes:r.fromBytes,toBytes:r.toBytes};return{CURVE:t,curveOpts:i}}function Ly(r){const{CURVE:t,curveOpts:e}=Ry(r),n={hash:r.hash,hmac:r.hmac,randomBytes:r.randomBytes,lowS:r.lowS,bits2int:r.bits2int,bits2int_modN:r.bits2int_modN};return{CURVE:t,curveOpts:e,ecdsaOpts:n}}function Dy(r,t){return Object.assign({},t,{ProjectivePoint:t.Point,CURVE:r})}function Vy(r){const{CURVE:t,curveOpts:e,ecdsaOpts:n}=Ly(r),i=Py(t,e),s=Oy(i,n,e);return Dy(r,s)}function as(r,t){const e=n=>Vy({...r,hash:n});return{...e(t),create:e}}const eu={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},tu={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff"),n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),h:BigInt(1),a:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc"),b:BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f")},ru={p:BigInt("0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),n:BigInt("0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409"),h:BigInt(1),a:BigInt("0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc"),b:BigInt("0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00"),Gx:BigInt("0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66"),Gy:BigInt("0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650")},Sy=Vr(eu.p),xy=Vr(tu.p),Cy=Vr(ru.p),$y=as({...eu,Fp:Sy,lowS:!1},ri);as({...tu,Fp:xy,lowS:!1},zf),as({...ru,Fp:Cy,lowS:!1,allowedPrivateKeyLengths:[130,131,132]},jf);const ky=$y,nu="base10",xe="base16",Me="base64pad",jt="base64url",mn="utf8",iu=0,Pt=1,yn=2,Ny=0,Aa=1,Qr=12,io=32;function Uy(){const r=os.utils.randomPrivateKey(),t=os.getPublicKey(r);return{privateKey:ze(r,xe),publicKey:ze(t,xe)}}function cs(){const r=Dr(io);return ze(r,xe)}function qy(r,t){const e=os.getSharedSecret(et(r,xe),et(t,xe)),n=Jm(ii,e,void 0,void 0,io);return ze(n,xe)}function Cn(r){const t=ii(et(r,xe));return ze(t,xe)}function Ye(r){const t=ii(et(r,mn));return ze(t,xe)}function su(r){return et(`${r}`,nu)}function ar(r){return Number(ze(r,nu))}function ou(r){return r.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function au(r){const t=r.replace(/-/g,"+").replace(/_/g,"/"),e=(4-t.length%4)%4;return t+"=".repeat(e)}function My(r){const t=su(typeof r.type<"u"?r.type:iu);if(ar(t)===Pt&&typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const e=typeof r.senderPublicKey<"u"?et(r.senderPublicKey,xe):void 0,n=typeof r.iv<"u"?et(r.iv,xe):Dr(Qr),i=et(r.symKey,xe),s=ql(i,n).encrypt(et(r.message,mn)),o=cu({type:t,sealed:s,iv:n,senderPublicKey:e});return r.encoding===jt?ou(o):o}function By(r){const t=et(r.symKey,xe),{sealed:e,iv:n}=cn({encoded:r.encoded,encoding:r.encoding}),i=ql(t,n).decrypt(e);if(i===null)throw new Error("Failed to decrypt");return ze(i,mn)}function jy(r,t){const e=su(yn),n=Dr(Qr),i=et(r,mn),s=cu({type:e,sealed:i,iv:n});return t===jt?ou(s):s}function zy(r,t){const{sealed:e}=cn({encoded:r,encoding:t});return ze(e,mn)}function cu(r){if(ar(r.type)===yn)return ze(Hr([r.type,r.sealed]),Me);if(ar(r.type)===Pt){if(typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return ze(Hr([r.type,r.senderPublicKey,r.iv,r.sealed]),Me)}return ze(Hr([r.type,r.iv,r.sealed]),Me)}function cn(r){const t=(r.encoding||Me)===jt?au(r.encoded):r.encoded,e=et(t,Me),n=e.slice(Ny,Aa),i=Aa;if(ar(n)===Pt){const l=i+io,u=l+Qr,d=e.slice(i,l),h=e.slice(l,u),p=e.slice(u);return{type:n,sealed:p,iv:h,senderPublicKey:d}}if(ar(n)===yn){const l=e.slice(i),u=Dr(Qr);return{type:n,sealed:l,iv:u}}const s=i+Qr,o=e.slice(i,s),c=e.slice(s);return{type:n,sealed:c,iv:o}}function Ky(r,t){const e=cn({encoded:r,encoding:t==null?void 0:t.encoding});return lu({type:ar(e.type),senderPublicKey:typeof e.senderPublicKey<"u"?ze(e.senderPublicKey,xe):void 0,receiverPublicKey:t==null?void 0:t.receiverPublicKey})}function lu(r){const t=(r==null?void 0:r.type)||iu;if(t===Pt){if(typeof(r==null?void 0:r.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(r==null?void 0:r.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:t,senderPublicKey:r==null?void 0:r.senderPublicKey,receiverPublicKey:r==null?void 0:r.receiverPublicKey}}function Ta(r){return r.type===Pt&&typeof r.senderPublicKey=="string"&&typeof r.receiverPublicKey=="string"}function Pa(r){return r.type===yn}function Fy(r){const t=ee.from(r.x,"base64"),e=ee.from(r.y,"base64");return Hr([new Uint8Array([4]),t,e])}function Wy(r,t){const[e,n,i]=r.split("."),s=ee.from(au(i),"base64");if(s.length!==64)throw new Error("Invalid signature length");const o=s.slice(0,32),c=s.slice(32,64),l=`${e}.${n}`,u=ii(l),d=Fy(t);if(!ky.verify(Hr([o,c]),u,d))throw new Error("Invalid signature");return ji(r).payload}const Hy="irn";function Zn(r){return(r==null?void 0:r.relay)||{protocol:Hy}}function Er(r){const t=qd[r];if(typeof t>"u")throw new Error(`Relay Protocol not supported: ${r}`);return t}function Gy(r,t="-"){const e={},n="relay"+t;return Object.keys(r).forEach(i=>{if(i.startsWith(n)){const s=i.replace(n,""),o=r[i];e[s]=o}}),e}function Oa(r){if(!r.includes("wc:")){const u=El(r);u!=null&&u.includes("wc:")&&(r=u)}r=r.includes("wc://")?r.replace("wc://",""):r,r=r.includes("wc:")?r.replace("wc:",""):r;const t=r.indexOf(":"),e=r.indexOf("?")!==-1?r.indexOf("?"):void 0,n=r.substring(0,t),i=r.substring(t+1,e).split("@"),s=typeof e<"u"?r.substring(e):"",o=new URLSearchParams(s),c={};o.forEach((u,d)=>{c[d]=u});const l=typeof c.methods=="string"?c.methods.split(","):void 0;return{protocol:n,topic:Jy(i[0]),version:parseInt(i[1],10),symKey:c.symKey,relay:Gy(c),methods:l,expiryTimestamp:c.expiryTimestamp?parseInt(c.expiryTimestamp,10):void 0}}function Jy(r){return r.startsWith("//")?r.substring(2):r}function Zy(r,t="-"){const e="relay",n={};return Object.keys(r).forEach(i=>{const s=i,o=e+t+s;r[s]&&(n[o]=r[s])}),n}function Ra(r){const t=new URLSearchParams,e=Zy(r.relay);Object.keys(e).sort().forEach(i=>{t.set(i,e[i])}),t.set("symKey",r.symKey),r.expiryTimestamp&&t.set("expiryTimestamp",r.expiryTimestamp.toString()),r.methods&&t.set("methods",r.methods.join(","));const n=t.toString();return`${r.protocol}:${r.topic}@${r.version}?${n}`}function Rn(r,t,e){return`${r}?wc_ev=${e}&topic=${t}`}var Qy=Object.defineProperty,Yy=Object.defineProperties,Xy=Object.getOwnPropertyDescriptors,La=Object.getOwnPropertySymbols,ew=Object.prototype.hasOwnProperty,tw=Object.prototype.propertyIsEnumerable,Da=(r,t,e)=>t in r?Qy(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,rw=(r,t)=>{for(var e in t||(t={}))ew.call(t,e)&&Da(r,e,t[e]);if(La)for(var e of La(t))tw.call(t,e)&&Da(r,e,t[e]);return r},nw=(r,t)=>Yy(r,Xy(t));function Sr(r){const t=[];return r.forEach(e=>{const[n,i]=e.split(":");t.push(`${n}:${i}`)}),t}function iw(r){const t=[];return Object.values(r).forEach(e=>{t.push(...Sr(e.accounts))}),t}function sw(r,t){const e=[];return Object.values(r).forEach(n=>{Sr(n.accounts).includes(t)&&e.push(...n.methods)}),e}function ow(r,t){const e=[];return Object.values(r).forEach(n=>{Sr(n.accounts).includes(t)&&e.push(...n.events)}),e}function uu(r){return r.includes(":")}function aw(r){return uu(r)?r.split(":")[0]:r}function Va(r){var t,e,n;const i={};if(!ln(r))return i;for(const[s,o]of Object.entries(r)){const c=uu(s)?[s]:o.chains,l=o.methods||[],u=o.events||[],d=aw(s);i[d]=nw(rw({},i[d]),{chains:nr(c,(t=i[d])==null?void 0:t.chains),methods:nr(l,(e=i[d])==null?void 0:e.methods),events:nr(u,(n=i[d])==null?void 0:n.events)})}return i}function cw(r){const t={};return r==null||r.forEach(e=>{var n;const[i,s]=e.split(":");t[i]||(t[i]={accounts:[],chains:[],events:[],methods:[]}),t[i].accounts.push(e),(n=t[i].chains)==null||n.push(`${i}:${s}`)}),t}function Sa(r,t){t=t.map(n=>n.replace("did:pkh:",""));const e=cw(t);for(const[n,i]of Object.entries(e))i.methods?i.methods=nr(i.methods,r):i.methods=r,i.events=["chainChanged","accountsChanged"];return e}function lw(r,t){var e,n,i,s,o,c;const l=Va(r),u=Va(t),d={},h=Object.keys(l).concat(Object.keys(u));for(const p of h)d[p]={chains:nr((e=l[p])==null?void 0:e.chains,(n=u[p])==null?void 0:n.chains),methods:nr((i=l[p])==null?void 0:i.methods,(s=u[p])==null?void 0:s.methods),events:nr((o=l[p])==null?void 0:o.events,(c=u[p])==null?void 0:c.events)};return d}const uw={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}},dw={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 U(r,t){const{message:e,code:n}=dw[r];return{message:t?`${e} ${t}`:e,code:n}}function ae(r,t){const{message:e,code:n}=uw[r];return{message:t?`${e} ${t}`:e,code:n}}function Ir(r,t){return Array.isArray(r)?typeof t<"u"&&r.length?r.every(t):!0:!1}function ln(r){return Object.getPrototypeOf(r)===Object.prototype&&Object.keys(r).length}function fe(r){return typeof r>"u"}function he(r,t){return t&&fe(r)?!0:typeof r=="string"&&!!r.trim().length}function so(r,t){return t&&fe(r)?!0:typeof r=="number"&&!isNaN(r)}function hw(r,t){const{requiredNamespaces:e}=t,n=Object.keys(r.namespaces),i=Object.keys(e);let s=!0;return Xt(i,n)?(n.forEach(o=>{const{accounts:c,methods:l,events:u}=r.namespaces[o],d=Sr(c),h=e[o];(!Xt(fl(o,h),d)||!Xt(h.methods,l)||!Xt(h.events,u))&&(s=!1)}),s):!1}function Qn(r){return he(r,!1)&&r.includes(":")?r.split(":").length===2:!1}function pw(r){if(he(r,!1)&&r.includes(":")){const t=r.split(":");if(t.length===3){const e=t[0]+":"+t[1];return!!t[2]&&Qn(e)}}return!1}function _w(r){function t(e){try{return typeof new URL(e)<"u"}catch{return!1}}try{if(he(r,!1)){if(t(r))return!0;const e=El(r);return t(e)}}catch{}return!1}function fw(r){var t;return(t=r==null?void 0:r.proposer)==null?void 0:t.publicKey}function mw(r){return r==null?void 0:r.topic}function yw(r,t){let e=null;return he(r==null?void 0:r.publicKey,!1)||(e=U("MISSING_OR_INVALID",`${t} controller public key should be a string`)),e}function xa(r){let t=!0;return Ir(r)?r.length&&(t=r.every(e=>he(e,!1))):t=!1,t}function ww(r,t,e){let n=null;return Ir(t)&&t.length?t.forEach(i=>{n||Qn(i)||(n=ae("UNSUPPORTED_CHAINS",`${e}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):Qn(r)||(n=ae("UNSUPPORTED_CHAINS",`${e}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function gw(r,t,e){let n=null;return Object.entries(r).forEach(([i,s])=>{if(n)return;const o=ww(i,fl(i,s),`${t} ${e}`);o&&(n=o)}),n}function Ew(r,t){let e=null;return Ir(r)?r.forEach(n=>{e||pw(n)||(e=ae("UNSUPPORTED_ACCOUNTS",`${t}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):e=ae("UNSUPPORTED_ACCOUNTS",`${t}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),e}function vw(r,t){let e=null;return Object.values(r).forEach(n=>{if(e)return;const i=Ew(n==null?void 0:n.accounts,`${t} namespace`);i&&(e=i)}),e}function bw(r,t){let e=null;return xa(r==null?void 0:r.methods)?xa(r==null?void 0:r.events)||(e=ae("UNSUPPORTED_EVENTS",`${t}, events should be an array of strings or empty array for no events`)):e=ae("UNSUPPORTED_METHODS",`${t}, methods should be an array of strings or empty array for no methods`),e}function du(r,t){let e=null;return Object.values(r).forEach(n=>{if(e)return;const i=bw(n,`${t}, namespace`);i&&(e=i)}),e}function Iw(r,t,e){let n=null;if(r&&ln(r)){const i=du(r,t);i&&(n=i);const s=gw(r,t,e);s&&(n=s)}else n=U("MISSING_OR_INVALID",`${t}, ${e} should be an object with data`);return n}function Oi(r,t){let e=null;if(r&&ln(r)){const n=du(r,t);n&&(e=n);const i=vw(r,t);i&&(e=i)}else e=U("MISSING_OR_INVALID",`${t}, namespaces should be an object with data`);return e}function hu(r){return he(r.protocol,!0)}function Aw(r,t){let e=!1;return r?r&&Ir(r)&&r.length&&r.forEach(n=>{e=hu(n)}):e=!0,e}function Tw(r){return typeof r=="number"}function Ne(r){return typeof r<"u"&&typeof r!==null}function Pw(r){return!(!r||typeof r!="object"||!r.code||!so(r.code,!1)||!r.message||!he(r.message,!1))}function Ow(r){return!(fe(r)||!he(r.method,!1))}function Rw(r){return!(fe(r)||fe(r.result)&&fe(r.error)||!so(r.id,!1)||!he(r.jsonrpc,!1))}function Lw(r){return!(fe(r)||!he(r.name,!1))}function Ca(r,t){return!(!Qn(t)||!iw(r).includes(t))}function Dw(r,t,e){return he(e,!1)?sw(r,t).includes(e):!1}function Vw(r,t,e){return he(e,!1)?ow(r,t).includes(e):!1}function $a(r,t,e){let n=null;const i=Sw(r),s=xw(t),o=Object.keys(i),c=Object.keys(s),l=ka(Object.keys(r)),u=ka(Object.keys(t)),d=l.filter(h=>!u.includes(h));return d.length&&(n=U("NON_CONFORMING_NAMESPACES",`${e} namespaces keys don't satisfy requiredNamespaces.
|
|
@@ -9,6 +9,6 @@ ${r.length}`,e=new TextEncoder().encode(t+r);return"0x"+ee.from(Sf(e)).toString(
|
|
|
9
9
|
Required: ${o.toString()}
|
|
10
10
|
Approved: ${c.toString()}`)),Object.keys(t).forEach(h=>{if(!h.includes(":")||n)return;const p=Sr(t[h].accounts);p.includes(h)||(n=U("NON_CONFORMING_NAMESPACES",`${e} namespaces accounts don't satisfy namespace accounts for ${h}
|
|
11
11
|
Required: ${h}
|
|
12
|
-
Approved: ${p.toString()}`))}),o.forEach(h=>{n||(Xt(i[h].methods,s[h].methods)?Xt(i[h].events,s[h].events)||(n=U("NON_CONFORMING_NAMESPACES",`${e} namespaces events don't satisfy namespace events for ${h}`)):n=U("NON_CONFORMING_NAMESPACES",`${e} namespaces methods don't satisfy namespace methods for ${h}`))}),n}function Sw(r){const t={};return Object.keys(r).forEach(e=>{var n;e.includes(":")?t[e]=r[e]:(n=r[e].chains)==null||n.forEach(i=>{t[i]={methods:r[e].methods,events:r[e].events}})}),t}function ka(r){return[...new Set(r.map(t=>t.includes(":")?t.split(":")[0]:t))]}function xw(r){const t={};return Object.keys(r).forEach(e=>{if(e.includes(":"))t[e]=r[e];else{const n=Sr(r[e].accounts);n==null||n.forEach(i=>{t[i]={accounts:r[e].accounts.filter(s=>s.includes(`${i}:`)),methods:r[e].methods,events:r[e].events}})}}),t}function Cw(r,t){return so(r,!1)&&r<=t.max&&r>=t.min}function Na(){const r=_n();return new Promise(t=>{switch(r){case He.browser:t($w());break;case He.reactNative:t(kw());break;case He.node:t(Nw());break;default:t(!0)}})}function $w(){return Lr()&&(navigator==null?void 0:navigator.onLine)}async function kw(){if(Wt()&&typeof K<"u"&&K!=null&&K.NetInfo){const r=await(K==null?void 0:K.NetInfo.fetch());return r==null?void 0:r.isConnected}return!0}function Nw(){return!0}function Uw(r){switch(_n()){case He.browser:qw(r);break;case He.reactNative:Mw(r);break}}function qw(r){!Wt()&&Lr()&&(window.addEventListener("online",()=>r(!0)),window.addEventListener("offline",()=>r(!1)))}function Mw(r){var t;Wt()&&typeof K<"u"&&K!=null&&K.NetInfo&&((t=K)==null||t.NetInfo.addEventListener(e=>r(e==null?void 0:e.isConnected)))}function Bw(){var r;return Lr()&&Ot.getDocument()?((r=Ot.getDocument())==null?void 0:r.visibilityState)==="visible":!0}const Ri={};class Nr{static get(t){return Ri[t]}static set(t,e){Ri[t]=e}static delete(t){delete Ri[t]}}function jw(r){const t=hn.decode(r);if(t.length<33)throw new Error("Too short to contain a public key");return t.slice(1,33)}function zw({publicKey:r,signature:t,payload:e}){var n;const i=ls(e.method),s=128|parseInt(((n=e.version)==null?void 0:n.toString())||"4"),o=Ww(e.address),c=e.era==="00"?new Uint8Array([0]):ls(e.era);if(c.length!==1&&c.length!==2)throw new Error("Invalid era length");const l=parseInt(e.nonce,16),u=new Uint8Array([l&255,l>>8&255]),d=BigInt(`0x${Fw(e.tip)}`),h=Gw(d),p=new Uint8Array([0,...r,o,...t,...c,...u,...h,...i]),_=Hw(p.length+1);return new Uint8Array([..._,s,...p])}function Kw(r){const t=ls(r),e=zd.blake2b(t,void 0,32);return"0x"+ee.from(e).toString("hex")}function ls(r){return new Uint8Array(r.replace(/^0x/,"").match(/.{1,2}/g).map(t=>parseInt(t,16)))}function Fw(r){return r.startsWith("0x")?r.slice(2):r}function Ww(r){const t=hn.decode(r)[0];return t===42?0:t===60?2:1}function Hw(r){if(r<64)return new Uint8Array([r<<2]);if(r<16384){const t=r<<2|1;return new Uint8Array([t&255,t>>8&255])}else if(r<1<<30){const t=r<<2|2;return new Uint8Array([t&255,t>>8&255,t>>16&255,t>>24&255])}else throw new Error("Compact encoding > 2^30 not supported")}function Gw(r){if(r<BigInt(1)<<BigInt(6))return new Uint8Array([Number(r<<BigInt(2))]);if(r<BigInt(1)<<BigInt(14)){const t=r<<BigInt(2)|BigInt(1);return new Uint8Array([Number(t&BigInt(255)),Number(t>>BigInt(8)&BigInt(255))])}else if(r<BigInt(1)<<BigInt(30)){const t=r<<BigInt(2)|BigInt(2);return new Uint8Array([Number(t&BigInt(255)),Number(t>>BigInt(8)&BigInt(255)),Number(t>>BigInt(16)&BigInt(255)),Number(t>>BigInt(24)&BigInt(255))])}else throw new Error("BigInt compact encoding not supported > 2^30")}function Jw(r){const t=Uint8Array.from(ee.from(r.signature,"hex")),e=jw(r.transaction.address),n=zw({publicKey:e,signature:t,payload:r.transaction}),i=ee.from(n).toString("hex");return Kw(i)}var Zw={};const pu="wc",_u=2,us="core",yt=`${pu}@2:${us}:`,Qw={logger:"error"},Yw={database:":memory:"},Xw="crypto",Ua="client_ed25519_seed",eg=q.ONE_DAY,tg="keychain",rg="0.3",ng="messages",ig="0.3",sg=q.SIX_HOURS,og="publisher",fu="irn",ag="error",mu="wss://relay.walletconnect.org",cg="relayer",le={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},lg="_subscription",Je={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},ug=.1,ds="2.21.8",se={link_mode:"link_mode",relay:"relay"},$n={inbound:"inbound",outbound:"outbound"},dg="0.3",hg="WALLETCONNECT_CLIENT_ID",qa="WALLETCONNECT_LINK_MODE_APPS",We={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},pg="subscription",_g="0.3",fg="pairing",mg="0.3",Ur={wc_pairingDelete:{req:{ttl:q.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:q.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:q.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:q.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:q.ONE_DAY,prompt:!1,tag:0},res:{ttl:q.ONE_DAY,prompt:!1,tag:0}}},Qt={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},nt={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},yg="history",wg="0.3",gg="expirer",Qe={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},Eg="0.3",vg="verify-api",bg="https://verify.walletconnect.com",yu="https://verify.walletconnect.org",Yr=yu,Ig=`${Yr}/v3`,Ag=[bg,yu],Tg="echo",Pg="https://echo.walletconnect.com",ht={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal",subscribing_to_pairing_topic:"subscribing_to_pairing_topic"},It={no_wss_connection:"no_wss_connection",no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_expired:"proposal_expired",proposal_listener_not_found:"proposal_listener_not_found"},kt={session_approve_started:"session_approve_started",proposal_not_expired:"proposal_not_expired",session_namespaces_validation_success:"session_namespaces_validation_success",create_session_topic:"create_session_topic",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},qr={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},Jt={authenticated_session_approve_started:"authenticated_session_approve_started",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve"},Mr={no_internet_connection:"no_internet_connection",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},Og=.1,Rg="event-client",Lg=86400,Dg="https://pulse.walletconnect.org/batch";function Vg(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var i=0;i<r.length;i++){var s=r.charAt(i),o=s.charCodeAt(0);if(e[o]!==255)throw new TypeError(s+" is ambiguous");e[o]=i}var c=r.length,l=r.charAt(0),u=Math.log(c)/Math.log(256),d=Math.log(256)/Math.log(c);function h(f){if(f instanceof Uint8Array||(ArrayBuffer.isView(f)?f=new Uint8Array(f.buffer,f.byteOffset,f.byteLength):Array.isArray(f)&&(f=Uint8Array.from(f))),!(f instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(f.length===0)return"";for(var m=0,y=0,b=0,R=f.length;b!==R&&f[b]===0;)b++,m++;for(var v=(R-b)*d+1>>>0,P=new Uint8Array(v);b!==R;){for(var T=f[b],g=0,D=v-1;(T!==0||g<y)&&D!==-1;D--,g++)T+=256*P[D]>>>0,P[D]=T%c>>>0,T=T/c>>>0;if(T!==0)throw new Error("Non-zero carry");y=g,b++}for(var L=v-y;L!==v&&P[L]===0;)L++;for(var w=l.repeat(m);L<v;++L)w+=r.charAt(P[L]);return w}function p(f){if(typeof f!="string")throw new TypeError("Expected String");if(f.length===0)return new Uint8Array;var m=0;if(f[m]!==" "){for(var y=0,b=0;f[m]===l;)y++,m++;for(var R=(f.length-m)*u+1>>>0,v=new Uint8Array(R);f[m];){var P=e[f.charCodeAt(m)];if(P===255)return;for(var T=0,g=R-1;(P!==0||T<b)&&g!==-1;g--,T++)P+=c*v[g]>>>0,v[g]=P%256>>>0,P=P/256>>>0;if(P!==0)throw new Error("Non-zero carry");b=T,m++}if(f[m]!==" "){for(var D=R-b;D!==R&&v[D]===0;)D++;for(var L=new Uint8Array(y+(R-D)),w=y;D!==R;)L[w++]=v[D++];return L}}}function _(f){var m=p(f);if(m)return m;throw new Error(`Non-${t} character`)}return{encode:h,decodeUnsafe:p,decode:_}}var Sg=Vg,xg=Sg;const wu=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},Cg=r=>new TextEncoder().encode(r),$g=r=>new TextDecoder().decode(r);class kg{constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}}class Ng{constructor(t,e,n){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return gu(this,t)}}class Ug{constructor(t){this.decoders=t}or(t){return gu(this,t)}decode(t){const e=t[0],n=this.decoders[e];if(n)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const gu=(r,t)=>new Ug({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}});class qg{constructor(t,e,n,i){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=i,this.encoder=new kg(t,e,n),this.decoder=new Ng(t,e,i)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}}const ci=({name:r,prefix:t,encode:e,decode:n})=>new qg(r,t,e,n),wn=({prefix:r,name:t,alphabet:e})=>{const{encode:n,decode:i}=xg(e,t);return ci({prefix:r,name:t,encode:n,decode:s=>wu(i(s))})},Mg=(r,t,e,n)=>{const i={};for(let d=0;d<t.length;++d)i[t[d]]=d;let s=r.length;for(;r[s-1]==="=";)--s;const o=new Uint8Array(s*e/8|0);let c=0,l=0,u=0;for(let d=0;d<s;++d){const h=i[r[d]];if(h===void 0)throw new SyntaxError(`Non-${n} character`);l=l<<e|h,c+=e,c>=8&&(c-=8,o[u++]=255&l>>c)}if(c>=e||255&l<<8-c)throw new SyntaxError("Unexpected end of data");return o},Bg=(r,t,e)=>{const n=t[t.length-1]==="=",i=(1<<e)-1;let s="",o=0,c=0;for(let l=0;l<r.length;++l)for(c=c<<8|r[l],o+=8;o>e;)o-=e,s+=t[i&c>>o];if(o&&(s+=t[i&c<<e-o]),n)for(;s.length*e&7;)s+="=";return s},Ae=({name:r,prefix:t,bitsPerChar:e,alphabet:n})=>ci({prefix:t,name:r,encode(i){return Bg(i,n,e)},decode(i){return Mg(i,n,e,r)}}),jg=ci({prefix:"\0",name:"identity",encode:r=>$g(r),decode:r=>Cg(r)});var zg=Object.freeze({__proto__:null,identity:jg});const Kg=Ae({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Fg=Object.freeze({__proto__:null,base2:Kg});const Wg=Ae({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Hg=Object.freeze({__proto__:null,base8:Wg});const Gg=wn({prefix:"9",name:"base10",alphabet:"0123456789"});var Jg=Object.freeze({__proto__:null,base10:Gg});const Zg=Ae({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Qg=Ae({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Yg=Object.freeze({__proto__:null,base16:Zg,base16upper:Qg});const Xg=Ae({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),eE=Ae({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),tE=Ae({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),rE=Ae({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),nE=Ae({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),iE=Ae({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),sE=Ae({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),oE=Ae({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),aE=Ae({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var cE=Object.freeze({__proto__:null,base32:Xg,base32upper:eE,base32pad:tE,base32padupper:rE,base32hex:nE,base32hexupper:iE,base32hexpad:sE,base32hexpadupper:oE,base32z:aE});const lE=wn({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),uE=wn({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var dE=Object.freeze({__proto__:null,base36:lE,base36upper:uE});const hE=wn({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),pE=wn({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var _E=Object.freeze({__proto__:null,base58btc:hE,base58flickr:pE});const fE=Ae({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),mE=Ae({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),yE=Ae({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),wE=Ae({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var gE=Object.freeze({__proto__:null,base64:fE,base64pad:mE,base64url:yE,base64urlpad:wE});const Eu=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),EE=Eu.reduce((r,t,e)=>(r[e]=t,r),[]),vE=Eu.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function bE(r){return r.reduce((t,e)=>(t+=EE[e],t),"")}function IE(r){const t=[];for(const e of r){const n=vE[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}const AE=ci({prefix:"🚀",name:"base256emoji",encode:bE,decode:IE});var TE=Object.freeze({__proto__:null,base256emoji:AE}),PE=vu,Ma=128,OE=-128,RE=Math.pow(2,31);function vu(r,t,e){t=t||[],e=e||0;for(var n=e;r>=RE;)t[e++]=r&255|Ma,r/=128;for(;r&OE;)t[e++]=r&255|Ma,r>>>=7;return t[e]=r|0,vu.bytes=e-n+1,t}var LE=hs,DE=128,Ba=127;function hs(r,n){var e=0,n=n||0,i=0,s=n,o,c=r.length;do{if(s>=c)throw hs.bytes=0,new RangeError("Could not decode varint");o=r[s++],e+=i<28?(o&Ba)<<i:(o&Ba)*Math.pow(2,i),i+=7}while(o>=DE);return hs.bytes=s-n,e}var VE=Math.pow(2,7),SE=Math.pow(2,14),xE=Math.pow(2,21),CE=Math.pow(2,28),$E=Math.pow(2,35),kE=Math.pow(2,42),NE=Math.pow(2,49),UE=Math.pow(2,56),qE=Math.pow(2,63),ME=function(r){return r<VE?1:r<SE?2:r<xE?3:r<CE?4:r<$E?5:r<kE?6:r<NE?7:r<UE?8:r<qE?9:10},BE={encode:PE,decode:LE,encodingLength:ME},bu=BE;const ja=(r,t,e=0)=>(bu.encode(r,t,e),t),za=r=>bu.encodingLength(r),ps=(r,t)=>{const e=t.byteLength,n=za(r),i=n+za(e),s=new Uint8Array(i+e);return ja(r,s,0),ja(e,s,n),s.set(t,i),new jE(r,e,t,s)};class jE{constructor(t,e,n,i){this.code=t,this.size=e,this.digest=n,this.bytes=i}}const Iu=({name:r,code:t,encode:e})=>new zE(r,t,e);class zE{constructor(t,e,n){this.name=t,this.code=e,this.encode=n}digest(t){if(t instanceof Uint8Array){const e=this.encode(t);return e instanceof Uint8Array?ps(this.code,e):e.then(n=>ps(this.code,n))}else throw Error("Unknown type, must be binary type")}}const Au=r=>async t=>new Uint8Array(await crypto.subtle.digest(r,t)),KE=Iu({name:"sha2-256",code:18,encode:Au("SHA-256")}),FE=Iu({name:"sha2-512",code:19,encode:Au("SHA-512")});var WE=Object.freeze({__proto__:null,sha256:KE,sha512:FE});const Tu=0,HE="identity",Pu=wu,GE=r=>ps(Tu,Pu(r)),JE={code:Tu,name:HE,encode:Pu,digest:GE};var ZE=Object.freeze({__proto__:null,identity:JE});new TextEncoder,new TextDecoder;const Ka={...zg,...Fg,...Hg,...Jg,...Yg,...cE,...dE,..._E,...gE,...TE};({...WE,...ZE});function Ou(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function QE(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Ou(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Ru(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}const Fa=Ru("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Li=Ru("ascii","a",r=>{let t="a";for(let e=0;e<r.length;e++)t+=String.fromCharCode(r[e]);return t},r=>{r=r.substring(1);const t=QE(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),YE={utf8:Fa,"utf-8":Fa,hex:Ka.base16,latin1:Li,ascii:Li,binary:Li,...Ka};function XE(r,t="utf8"){const e=YE[t];if(!e)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Ou(globalThis.Buffer.from(r,"utf-8")):e.decoder.decode(`${e.prefix}${r}`)}var e0=Object.defineProperty,t0=(r,t,e)=>t in r?e0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ut=(r,t,e)=>t0(r,typeof t!="symbol"?t+"":t,e);class r0{constructor(t,e){this.core=t,this.logger=e,ut(this,"keychain",new Map),ut(this,"name",tg),ut(this,"version",rg),ut(this,"initialized",!1),ut(this,"storagePrefix",yt),ut(this,"init",async()=>{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}}),ut(this,"has",n=>(this.isInitialized(),this.keychain.has(n))),ut(this,"set",async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()}),ut(this,"get",n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:s}=U("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i}),ut(this,"del",async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()}),this.core=t,this.logger=Ce(e,this.name)}get context(){return Ke(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(t){await this.core.storage.setItem(this.storageKey,Qi(t))}async getKeyChain(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?Yi(t):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}}var n0=Object.defineProperty,i0=(r,t,e)=>t in r?n0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ve=(r,t,e)=>i0(r,typeof t!="symbol"?t+"":t,e);class s0{constructor(t,e,n){this.core=t,this.logger=e,ve(this,"name",Xw),ve(this,"keychain"),ve(this,"randomSessionIdentifier",cs()),ve(this,"initialized",!1),ve(this,"init",async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)}),ve(this,"hasKeys",i=>(this.isInitialized(),this.keychain.has(i))),ve(this,"getClientId",async()=>{this.isInitialized();const i=await this.getClientSeed(),s=wo(i);return Hd(s.publicKey)}),ve(this,"generateKeyPair",()=>{this.isInitialized();const i=Uy();return this.setPrivateKey(i.publicKey,i.privateKey)}),ve(this,"signJWT",async i=>{this.isInitialized();const s=await this.getClientSeed(),o=wo(s),c=this.randomSessionIdentifier;return await Gd(c,i,eg,o)}),ve(this,"generateSharedKey",(i,s,o)=>{this.isInitialized();const c=this.getPrivateKey(i),l=qy(c,s);return this.setSymKey(l,o)}),ve(this,"setSymKey",async(i,s)=>{this.isInitialized();const o=s||Cn(i);return await this.keychain.set(o,i),o}),ve(this,"deleteKeyPair",async i=>{this.isInitialized(),await this.keychain.del(i)}),ve(this,"deleteSymKey",async i=>{this.isInitialized(),await this.keychain.del(i)}),ve(this,"encode",async(i,s,o)=>{this.isInitialized();const c=lu(o),l=tn(s);if(Pa(c))return jy(l,o==null?void 0:o.encoding);if(Ta(c)){const p=c.senderPublicKey,_=c.receiverPublicKey;i=await this.generateSharedKey(p,_)}const u=this.getSymKey(i),{type:d,senderPublicKey:h}=c;return My({type:d,symKey:u,message:l,senderPublicKey:h,encoding:o==null?void 0:o.encoding})}),ve(this,"decode",async(i,s,o)=>{this.isInitialized();const c=Ky(s,o);if(Pa(c)){const l=zy(s,o==null?void 0:o.encoding);return qn(l)}if(Ta(c)){const l=c.receiverPublicKey,u=c.senderPublicKey;i=await this.generateSharedKey(l,u)}try{const l=this.getSymKey(i),u=By({symKey:l,encoded:s,encoding:o==null?void 0:o.encoding});return qn(u)}catch(l){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(l)}}),ve(this,"getPayloadType",(i,s=Me)=>{const o=cn({encoded:i,encoding:s});return ar(o.type)}),ve(this,"getPayloadSenderPublicKey",(i,s=Me)=>{const o=cn({encoded:i,encoding:s});return o.senderPublicKey?ze(o.senderPublicKey,xe):void 0}),this.core=t,this.logger=Ce(e,this.name),this.keychain=n||new r0(this.core,this.logger)}get context(){return Ke(this.logger)}async setPrivateKey(t,e){return await this.keychain.set(t,e),t}getPrivateKey(t){return this.keychain.get(t)}async getClientSeed(){let t="";try{t=this.keychain.get(Ua)}catch{t=cs(),await this.keychain.set(Ua,t)}return XE(t,"base16")}getSymKey(t){return this.keychain.get(t)}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}}var o0=Object.defineProperty,a0=Object.defineProperties,c0=Object.getOwnPropertyDescriptors,Wa=Object.getOwnPropertySymbols,l0=Object.prototype.hasOwnProperty,u0=Object.prototype.propertyIsEnumerable,_s=(r,t,e)=>t in r?o0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,d0=(r,t)=>{for(var e in t||(t={}))l0.call(t,e)&&_s(r,e,t[e]);if(Wa)for(var e of Wa(t))u0.call(t,e)&&_s(r,e,t[e]);return r},h0=(r,t)=>a0(r,c0(t)),Fe=(r,t,e)=>_s(r,typeof t!="symbol"?t+"":t,e);class p0 extends Vp{constructor(t,e){super(t,e),this.logger=t,this.core=e,Fe(this,"messages",new Map),Fe(this,"messagesWithoutClientAck",new Map),Fe(this,"name",ng),Fe(this,"version",ig),Fe(this,"initialized",!1),Fe(this,"storagePrefix",yt),Fe(this,"init",async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n);const i=await this.getRelayerMessagesWithoutClientAck();typeof i<"u"&&(this.messagesWithoutClientAck=i),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}}),Fe(this,"set",async(n,i,s)=>{this.isInitialized();const o=Ye(i);let c=this.messages.get(n);if(typeof c>"u"&&(c={}),typeof c[o]<"u")return o;if(c[o]=i,this.messages.set(n,c),s===$n.inbound){const l=this.messagesWithoutClientAck.get(n)||{};this.messagesWithoutClientAck.set(n,h0(d0({},l),{[o]:i}))}return await this.persist(),o}),Fe(this,"get",n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i}),Fe(this,"getWithoutAck",n=>{this.isInitialized();const i={};for(const s of n){const o=this.messagesWithoutClientAck.get(s)||{};i[s]=Object.values(o)}return i}),Fe(this,"has",(n,i)=>{this.isInitialized();const s=this.get(n),o=Ye(i);return typeof s[o]<"u"}),Fe(this,"ack",async(n,i)=>{this.isInitialized();const s=this.messagesWithoutClientAck.get(n);if(typeof s>"u")return;const o=Ye(i);delete s[o],Object.keys(s).length===0?this.messagesWithoutClientAck.delete(n):this.messagesWithoutClientAck.set(n,s),await this.persist()}),Fe(this,"del",async n=>{this.isInitialized(),this.messages.delete(n),this.messagesWithoutClientAck.delete(n),await this.persist()}),this.logger=Ce(t,this.name),this.core=e}get context(){return Ke(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get storageKeyWithoutClientAck(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name+"_withoutClientAck"}async setRelayerMessages(t){await this.core.storage.setItem(this.storageKey,Qi(t))}async setRelayerMessagesWithoutClientAck(t){await this.core.storage.setItem(this.storageKeyWithoutClientAck,Qi(t))}async getRelayerMessages(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?Yi(t):void 0}async getRelayerMessagesWithoutClientAck(){const t=await this.core.storage.getItem(this.storageKeyWithoutClientAck);return typeof t<"u"?Yi(t):void 0}async persist(){await this.setRelayerMessages(this.messages),await this.setRelayerMessagesWithoutClientAck(this.messagesWithoutClientAck)}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}}var _0=Object.defineProperty,f0=Object.defineProperties,m0=Object.getOwnPropertyDescriptors,Ha=Object.getOwnPropertySymbols,y0=Object.prototype.hasOwnProperty,w0=Object.prototype.propertyIsEnumerable,fs=(r,t,e)=>t in r?_0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,mr=(r,t)=>{for(var e in t||(t={}))y0.call(t,e)&&fs(r,e,t[e]);if(Ha)for(var e of Ha(t))w0.call(t,e)&&fs(r,e,t[e]);return r},Ga=(r,t)=>f0(r,m0(t)),Ze=(r,t,e)=>fs(r,typeof t!="symbol"?t+"":t,e);class g0 extends Sp{constructor(t,e){super(t,e),this.relayer=t,this.logger=e,Ze(this,"events",new lr.EventEmitter),Ze(this,"name",og),Ze(this,"queue",new Map),Ze(this,"publishTimeout",q.toMiliseconds(q.ONE_MINUTE)),Ze(this,"initialPublishTimeout",q.toMiliseconds(q.ONE_SECOND*15)),Ze(this,"needsTransportRestart",!1),Ze(this,"publish",async(n,i,s)=>{var o,c,l,u,d;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});const h=(s==null?void 0:s.ttl)||sg,p=(s==null?void 0:s.prompt)||!1,_=(s==null?void 0:s.tag)||0,f=(s==null?void 0:s.id)||Yt().toString(),m=Er(Zn().protocol),y={id:f,method:(s==null?void 0:s.publishMethod)||m.publish,params:mr({topic:n,message:i,ttl:h,prompt:p,tag:_,attestation:s==null?void 0:s.attestation},(s==null?void 0:s.tvf)&&{tvf:s.tvf})},b=`Failed to publish payload, please try again. id:${f} tag:${_}`;try{fe((o=y.params)==null?void 0:o.prompt)&&((c=y.params)==null||delete c.prompt),fe((l=y.params)==null?void 0:l.tag)&&((u=y.params)==null||delete u.tag);const R=new Promise(async v=>{const P=({id:g})=>{var D;((D=y.id)==null?void 0:D.toString())===g.toString()&&(this.removeRequestFromQueue(g),this.relayer.events.removeListener(le.publish,P),v())};this.relayer.events.on(le.publish,P);const T=ft(new Promise((g,D)=>{this.rpcPublish(y,s).then(g).catch(L=>{this.logger.warn(L,L==null?void 0:L.message),D(L)})}),this.initialPublishTimeout,`Failed initial publish, retrying.... id:${f} tag:${_}`);try{await T,this.events.removeListener(le.publish,P)}catch(g){this.queue.set(f,{request:y,opts:s,attempt:1}),this.logger.warn(g,g==null?void 0:g.message)}});this.logger.trace({type:"method",method:"publish",params:{id:f,topic:n,message:i,opts:s}}),await ft(R,this.publishTimeout,b)}catch(R){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(R),(d=s==null?void 0:s.internal)!=null&&d.throwOnFailedPublish)throw R}finally{this.queue.delete(f)}}),Ze(this,"publishCustom",async n=>{var i,s,o,c,l;this.logger.debug("Publishing custom payload"),this.logger.trace({type:"method",method:"publishCustom",params:n});const{payload:u,opts:d={}}=n,{attestation:h,tvf:p,publishMethod:_,prompt:f,tag:m,ttl:y=q.FIVE_MINUTES}=d,b=d.id||Yt().toString(),R=Er(Zn().protocol),v=_||R.publish,P={id:b,method:v,params:mr(Ga(mr({},u),{ttl:y,prompt:f,tag:m,attestation:h}),p)},T=`Failed to publish custom payload, please try again. id:${b} tag:${m}`;try{fe((i=P.params)==null?void 0:i.prompt)&&((s=P.params)==null||delete s.prompt),fe((o=P.params)==null?void 0:o.tag)&&((c=P.params)==null||delete c.tag);const g=new Promise(async D=>{const L=({id:E})=>{var I;((I=P.id)==null?void 0:I.toString())===E.toString()&&(this.removeRequestFromQueue(E),this.relayer.events.removeListener(le.publish,L),D())};this.relayer.events.on(le.publish,L);const w=ft(new Promise((E,I)=>{this.rpcPublish(P,d).then(E).catch(A=>{this.logger.warn(A,A==null?void 0:A.message),I(A)})}),this.initialPublishTimeout,`Failed initial custom payload publish, retrying.... method:${v} id:${b} tag:${m}`);try{await w,this.events.removeListener(le.publish,L)}catch(E){this.queue.set(b,{request:P,opts:d,attempt:1}),this.logger.warn(E,E==null?void 0:E.message)}});this.logger.trace({type:"method",method:"publish",params:{id:b,payload:u,opts:d}}),await ft(g,this.publishTimeout,T)}catch(g){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(g),(l=d==null?void 0:d.internal)!=null&&l.throwOnFailedPublish)throw g}finally{this.queue.delete(b)}}),Ze(this,"on",(n,i)=>{this.events.on(n,i)}),Ze(this,"once",(n,i)=>{this.events.once(n,i)}),Ze(this,"off",(n,i)=>{this.events.off(n,i)}),Ze(this,"removeListener",(n,i)=>{this.events.removeListener(n,i)}),this.relayer=t,this.logger=Ce(e,this.name),this.registerEventListeners()}get context(){return Ke(this.logger)}async rpcPublish(t,e){this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:t});const n=await this.relayer.request(t);return this.relayer.events.emit(le.publish,mr(mr({},t),e)),this.logger.debug("Successfully Published Payload"),n}removeRequestFromQueue(t){this.queue.delete(t)}checkQueue(){this.queue.forEach(async(t,e)=>{var n;const i=t.attempt+1;this.queue.set(e,Ga(mr({},t),{attempt:i})),this.logger.warn({},`Publisher: queue->publishing: ${t.request.id}, tag: ${(n=t.request.params)==null?void 0:n.tag}, attempt: ${i}`),await this.rpcPublish(t.request,t.opts),this.logger.warn({},`Publisher: queue->published: ${t.request.id}`)})}registerEventListeners(){this.relayer.core.heartbeat.on(Tr.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(le.connection_stalled);return}this.checkQueue()}),this.relayer.on(le.message_ack,t=>{this.removeRequestFromQueue(t.id.toString())})}}var E0=Object.defineProperty,v0=(r,t,e)=>t in r?E0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,yr=(r,t,e)=>v0(r,typeof t!="symbol"?t+"":t,e);class b0{constructor(){yr(this,"map",new Map),yr(this,"set",(t,e)=>{const n=this.get(t);this.exists(t,e)||this.map.set(t,[...n,e])}),yr(this,"get",t=>this.map.get(t)||[]),yr(this,"exists",(t,e)=>this.get(t).includes(e)),yr(this,"delete",(t,e)=>{if(typeof e>"u"){this.map.delete(t);return}if(!this.map.has(t))return;const n=this.get(t);if(!this.exists(t,e))return;const i=n.filter(s=>s!==e);if(!i.length){this.map.delete(t);return}this.map.set(t,i)}),yr(this,"clear",()=>{this.map.clear()})}get topics(){return Array.from(this.map.keys())}}var I0=Object.defineProperty,A0=Object.defineProperties,T0=Object.getOwnPropertyDescriptors,Ja=Object.getOwnPropertySymbols,P0=Object.prototype.hasOwnProperty,O0=Object.prototype.propertyIsEnumerable,ms=(r,t,e)=>t in r?I0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Br=(r,t)=>{for(var e in t||(t={}))P0.call(t,e)&&ms(r,e,t[e]);if(Ja)for(var e of Ja(t))O0.call(t,e)&&ms(r,e,t[e]);return r},Di=(r,t)=>A0(r,T0(t)),ne=(r,t,e)=>ms(r,typeof t!="symbol"?t+"":t,e);class R0 extends $p{constructor(t,e){super(t,e),this.relayer=t,this.logger=e,ne(this,"subscriptions",new Map),ne(this,"topicMap",new b0),ne(this,"events",new lr.EventEmitter),ne(this,"name",pg),ne(this,"version",_g),ne(this,"pending",new Map),ne(this,"cached",[]),ne(this,"initialized",!1),ne(this,"storagePrefix",yt),ne(this,"subscribeTimeout",q.toMiliseconds(q.ONE_MINUTE)),ne(this,"initialSubscribeTimeout",q.toMiliseconds(q.ONE_SECOND*15)),ne(this,"clientId"),ne(this,"batchSubscribeTopicsLimit",500),ne(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),await this.restore()),this.initialized=!0}),ne(this,"subscribe",async(n,i)=>{var s;this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const o=Zn(i),c={topic:n,relay:o,transportType:i==null?void 0:i.transportType};(s=i==null?void 0:i.internal)!=null&&s.skipSubscribe||this.pending.set(n,c);const l=await this.rpcSubscribe(n,o,i);return typeof l=="string"&&(this.onSubscribe(l,c),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),l}catch(o){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(o),o}}),ne(this,"unsubscribe",async(n,i)=>{this.isInitialized(),typeof(i==null?void 0:i.id)<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)}),ne(this,"isSubscribed",n=>new Promise(i=>{i(this.topicMap.topics.includes(n))})),ne(this,"isKnownTopic",n=>new Promise(i=>{i(this.topicMap.topics.includes(n)||this.pending.has(n)||this.cached.some(s=>s.topic===n))})),ne(this,"on",(n,i)=>{this.events.on(n,i)}),ne(this,"once",(n,i)=>{this.events.once(n,i)}),ne(this,"off",(n,i)=>{this.events.off(n,i)}),ne(this,"removeListener",(n,i)=>{this.events.removeListener(n,i)}),ne(this,"start",async()=>{await this.onConnect()}),ne(this,"stop",async()=>{await this.onDisconnect()}),ne(this,"restart",async()=>{await this.restore(),await this.onRestart()}),ne(this,"checkPending",async()=>{if(this.pending.size===0&&(!this.initialized||!this.relayer.connected))return;const n=[];this.pending.forEach(i=>{n.push(i)}),await this.batchSubscribe(n)}),ne(this,"registerEventListeners",()=>{this.relayer.core.heartbeat.on(Tr.pulse,async()=>{await this.checkPending()}),this.events.on(We.created,async n=>{const i=We.created;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,data:n}),await this.persist()}),this.events.on(We.deleted,async n=>{const i=We.deleted;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,data:n}),await this.persist()})}),this.relayer=t,this.logger=Ce(e,this.name),this.clientId=""}get context(){return Ke(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}get hasAnyTopics(){return this.topicMap.topics.length>0||this.pending.size>0||this.cached.length>0||this.subscriptions.size>0}hasSubscription(t,e){let n=!1;try{n=this.getSubscription(t).topic===e}catch{}return n}reset(){this.cached=[],this.initialized=!0}onDisable(){this.values.length>0&&(this.cached=this.values),this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(t,e){const n=this.topicMap.get(t);await Promise.all(n.map(async i=>await this.unsubscribeById(t,i,e)))}async unsubscribeById(t,e,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:e,opts:n}});try{const i=Zn(n);await this.restartToComplete({topic:t,id:e,relay:i}),await this.rpcUnsubscribe(t,e,i);const s=ae("USER_DISCONNECTED",`${this.name}, ${t}`);await this.onUnsubscribe(t,e,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:e,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(t,e,n){var i,s;const o=await this.getSubscriptionId(t);if((i=n==null?void 0:n.internal)!=null&&i.skipSubscribe)return o;(!n||(n==null?void 0:n.transportType)===se.relay)&&await this.restartToComplete({topic:t,id:t,relay:e});const c={method:Er(e.protocol).subscribe,params:{topic:t}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:c});const l=(s=n==null?void 0:n.internal)==null?void 0:s.throwOnFailedPublish;try{if((n==null?void 0:n.transportType)===se.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(c).catch(h=>this.logger.warn(h))},q.toMiliseconds(q.ONE_SECOND)),o;const u=new Promise(async h=>{const p=_=>{_.topic===t&&(this.events.removeListener(We.created,p),h(_.id))};this.events.on(We.created,p);try{const _=await ft(new Promise((f,m)=>{this.relayer.request(c).catch(y=>{this.logger.warn(y,y==null?void 0:y.message),m(y)}).then(f)}),this.initialSubscribeTimeout,`Subscribing to ${t} failed, please try again`);this.events.removeListener(We.created,p),h(_)}catch{}}),d=await ft(u,this.subscribeTimeout,`Subscribing to ${t} failed, please try again`);if(!d&&l)throw new Error(`Subscribing to ${t} failed, please try again`);return d?o:null}catch(u){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(le.connection_stalled),l)throw u}return null}async rpcBatchSubscribe(t){if(!t.length)return;const e=t[0].relay,n={method:Er(e.protocol).batchSubscribe,params:{topics:t.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{await await ft(new Promise(i=>{this.relayer.request(n).catch(s=>this.logger.warn(s)).then(i)}),this.subscribeTimeout,"rpcBatchSubscribe failed, please try again")}catch{this.relayer.events.emit(le.connection_stalled)}}async rpcBatchFetchMessages(t){if(!t.length)return;const e=t[0].relay,n={method:Er(e.protocol).batchFetchMessages,params:{topics:t.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await ft(new Promise((s,o)=>{this.relayer.request(n).catch(c=>{this.logger.warn(c),o(c)}).then(s)}),this.subscribeTimeout,"rpcBatchFetchMessages failed, please try again")}catch{this.relayer.events.emit(le.connection_stalled)}return i}rpcUnsubscribe(t,e,n){const i={method:Er(n.protocol).unsubscribe,params:{topic:t,id:e}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(t,e){this.setSubscription(t,Di(Br({},e),{id:t})),this.pending.delete(e.topic)}onBatchSubscribe(t){t.length&&t.forEach(e=>{this.setSubscription(e.id,Br({},e)),this.pending.delete(e.topic)})}async onUnsubscribe(t,e,n){this.events.removeAllListeners(e),this.hasSubscription(e,t)&&this.deleteSubscription(e,n),await this.relayer.messages.del(t)}async setRelayerSubscriptions(t){await this.relayer.core.storage.setItem(this.storageKey,t)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(t,e){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:t,subscription:e}),this.addSubscription(t,e)}addSubscription(t,e){this.subscriptions.set(t,Br({},e)),this.topicMap.set(e.topic,t),this.events.emit(We.created,e)}getSubscription(t){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:t});const e=this.subscriptions.get(t);if(!e){const{message:n}=U("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(n)}return e}deleteSubscription(t,e){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:t,reason:e});const n=this.getSubscription(t);this.subscriptions.delete(t),this.topicMap.delete(n.topic,t),this.events.emit(We.deleted,Di(Br({},n),{reason:e}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(We.sync)}async onRestart(){if(this.cached.length){const t=[...this.cached],e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let n=0;n<e;n++){const i=t.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(i)}}this.events.emit(We.resubscribed)}async restore(){try{const t=await this.getRelayerSubscriptions();if(typeof t>"u"||!t.length)return;if(this.subscriptions.size&&!t.every(e=>{var n;return e.topic===((n=this.subscriptions.get(e.id))==null?void 0:n.topic)})){const{message:e}=U("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(t){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(t)}}async batchSubscribe(t){t.length&&(await this.rpcBatchSubscribe(t),this.onBatchSubscribe(await Promise.all(t.map(async e=>Di(Br({},e),{id:await this.getSubscriptionId(e.topic)})))))}async batchFetchMessages(t){if(!t.length)return;this.logger.trace(`Fetching batch messages for ${t.length} subscriptions`);const e=await this.rpcBatchFetchMessages(t);e&&e.messages&&(await of(q.toMiliseconds(q.ONE_SECOND)),await this.relayer.handleBatchMessageEvents(e.messages))}async onConnect(){await this.restart(),this.reset()}onDisconnect(){this.onDisable()}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}async restartToComplete(t){!this.relayer.connected&&!this.relayer.connecting&&(this.cached.push(t),await this.relayer.transportOpen())}async getClientId(){return this.clientId||(this.clientId=await this.relayer.core.crypto.getClientId()),this.clientId}async getSubscriptionId(t){return Ye(t+await this.getClientId())}}var L0=Object.defineProperty,Za=Object.getOwnPropertySymbols,D0=Object.prototype.hasOwnProperty,V0=Object.prototype.propertyIsEnumerable,ys=(r,t,e)=>t in r?L0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Qa=(r,t)=>{for(var e in t||(t={}))D0.call(t,e)&&ys(r,e,t[e]);if(Za)for(var e of Za(t))V0.call(t,e)&&ys(r,e,t[e]);return r},X=(r,t,e)=>ys(r,typeof t!="symbol"?t+"":t,e);class S0 extends xp{constructor(t){super(t),X(this,"protocol","wc"),X(this,"version",2),X(this,"core"),X(this,"logger"),X(this,"events",new lr.EventEmitter),X(this,"provider"),X(this,"messages"),X(this,"subscriber"),X(this,"publisher"),X(this,"name",cg),X(this,"transportExplicitlyClosed",!1),X(this,"initialized",!1),X(this,"connectionAttemptInProgress",!1),X(this,"relayUrl"),X(this,"projectId"),X(this,"packageName"),X(this,"bundleId"),X(this,"hasExperiencedNetworkDisruption",!1),X(this,"pingTimeout"),X(this,"heartBeatTimeout",q.toMiliseconds(q.THIRTY_SECONDS+q.FIVE_SECONDS)),X(this,"reconnectTimeout"),X(this,"connectPromise"),X(this,"reconnectInProgress",!1),X(this,"requestsInFlight",[]),X(this,"connectTimeout",q.toMiliseconds(q.ONE_SECOND*15)),X(this,"request",async e=>{var n,i;this.logger.debug("Publishing Request Payload");const s=e.id||Yt().toString();await this.toEstablishConnection();try{this.logger.trace({id:s,method:e.method,topic:(n=e.params)==null?void 0:n.topic},"relayer.request - publishing...");const o=`${s}:${((i=e.params)==null?void 0:i.tag)||""}`;this.requestsInFlight.push(o);const c=await this.provider.request(e);return this.requestsInFlight=this.requestsInFlight.filter(l=>l!==o),c}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}}),X(this,"resetPingTimeout",()=>{Wn()&&(clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var e,n,i,s;try{this.logger.debug({},"pingTimeout: Connection stalled, terminating..."),(s=(i=(n=(e=this.provider)==null?void 0:e.connection)==null?void 0:n.socket)==null?void 0:i.terminate)==null||s.call(i)}catch(o){this.logger.warn(o,o==null?void 0:o.message)}},this.heartBeatTimeout))}),X(this,"onPayloadHandler",e=>{this.onProviderPayload(e),this.resetPingTimeout()}),X(this,"onConnectHandler",()=>{this.logger.warn({},"Relayer connected 🛜"),this.startPingTimeout(),this.events.emit(le.connect)}),X(this,"onDisconnectHandler",()=>{this.logger.warn({},"Relayer disconnected 🛑"),this.requestsInFlight=[],this.onProviderDisconnect()}),X(this,"onProviderErrorHandler",e=>{this.logger.fatal(`Fatal socket error: ${e.message}`),this.events.emit(le.error,e),this.logger.fatal("Fatal socket error received, closing transport"),this.transportClose()}),X(this,"registerProviderListeners",()=>{this.provider.on(Je.payload,this.onPayloadHandler),this.provider.on(Je.connect,this.onConnectHandler),this.provider.on(Je.disconnect,this.onDisconnectHandler),this.provider.on(Je.error,this.onProviderErrorHandler)}),this.core=t.core,this.logger=typeof t.logger<"u"&&typeof t.logger!="string"?Ce(t.logger,this.name):ei(Ks({level:t.logger||ag})),this.messages=new p0(this.logger,t.core),this.subscriber=new R0(this,this.logger),this.publisher=new g0(this,this.logger),this.projectId=t==null?void 0:t.projectId,this.relayUrl=(t==null?void 0:t.relayUrl)||mu,z_()?this.packageName=Ho():K_()&&(this.bundleId=Ho()),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.transportOpen().catch(t=>this.logger.warn(t,t==null?void 0:t.message))}get context(){return Ke(this.logger)}get connected(){var t,e,n;return((n=(e=(t=this.provider)==null?void 0:t.connection)==null?void 0:e.socket)==null?void 0:n.readyState)===1||!1}get connecting(){var t,e,n;return((n=(e=(t=this.provider)==null?void 0:t.connection)==null?void 0:e.socket)==null?void 0:n.readyState)===0||this.connectPromise!==void 0||!1}async publish(t,e,n){this.isInitialized(),await this.publisher.publish(t,e,n),await this.recordMessageEvent({topic:t,message:e,publishedAt:Date.now(),transportType:se.relay},$n.outbound)}async publishCustom(t){this.isInitialized(),await this.publisher.publishCustom(t)}async subscribe(t,e){var n,i,s;this.isInitialized(),(!(e!=null&&e.transportType)||(e==null?void 0:e.transportType)==="relay")&&await this.toEstablishConnection();const o=typeof((n=e==null?void 0:e.internal)==null?void 0:n.throwOnFailedPublish)>"u"?!0:(i=e==null?void 0:e.internal)==null?void 0:i.throwOnFailedPublish;let c=((s=this.subscriber.topicMap.get(t))==null?void 0:s[0])||"",l;const u=d=>{d.topic===t&&(this.subscriber.off(We.created,u),l())};return await Promise.all([new Promise(d=>{l=d,this.subscriber.on(We.created,u)}),new Promise(async(d,h)=>{c=await this.subscriber.subscribe(t,Qa({internal:{throwOnFailedPublish:o}},e)).catch(p=>{o&&h(p)})||c,d()})]),c}async unsubscribe(t,e){this.isInitialized(),await this.subscriber.unsubscribe(t,e)}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}off(t,e){this.events.off(t,e)}removeListener(t,e){this.events.removeListener(t,e)}async transportDisconnect(){this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await ft(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(t){if(!this.subscriber.hasAnyTopics){this.logger.info("Starting WS connection skipped because the client has no topics to work with.");return}if(this.connectPromise?(this.logger.debug({},"Waiting for existing connection attempt to resolve..."),await this.connectPromise,this.logger.debug({},"Existing connection attempt resolved")):(this.connectPromise=new Promise(async(e,n)=>{await this.connect(t).then(e).catch(n).finally(()=>{this.connectPromise=void 0})}),await this.connectPromise),!this.connected)throw new Error(`Couldn't establish socket connection to the relay server: ${this.relayUrl}`)}async restartTransport(t){this.logger.debug({},"Restarting transport..."),!this.connectionAttemptInProgress&&(this.relayUrl=t||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await Na())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(t){if((t==null?void 0:t.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const e=t.sort((n,i)=>n.publishedAt-i.publishedAt);this.logger.debug(`Batch of ${e.length} message events sorted`);for(const n of e)try{await this.onMessageEvent(n)}catch(i){this.logger.warn(i,"Error while processing batch message event: "+(i==null?void 0:i.message))}this.logger.trace(`Batch of ${e.length} message events processed`)}async onLinkMessageEvent(t,e){const{topic:n}=t;if(!e.sessionExists){const i=_e(q.FIVE_MINUTES),s={topic:n,expiry:i,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,s)}this.events.emit(le.message,t),await this.recordMessageEvent(t,$n.inbound)}async connect(t){await this.confirmOnlineStateOrThrow(),t&&t!==this.relayUrl&&(this.relayUrl=t,await this.transportDisconnect()),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;let e=1;for(;e<6;){try{if(this.transportExplicitlyClosed)break;this.logger.debug({},`Connecting to ${this.relayUrl}, attempt: ${e}...`),await this.createProvider(),await new Promise(async(n,i)=>{const s=()=>{i(new Error("Connection interrupted while trying to connect"))};this.provider.once(Je.disconnect,s),await ft(new Promise((o,c)=>{this.provider.connect().then(o).catch(c)}),this.connectTimeout,`Socket stalled when trying to connect to ${this.relayUrl}`).catch(o=>{i(o)}).finally(()=>{this.provider.off(Je.disconnect,s),clearTimeout(this.reconnectTimeout)}),await new Promise(async(o,c)=>{const l=()=>{i(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(Je.disconnect,l),await this.subscriber.start().then(o).catch(c).finally(()=>{this.provider.off(Je.disconnect,l)})}),this.hasExperiencedNetworkDisruption=!1,n()})}catch(n){await this.subscriber.stop();const i=n;this.logger.warn({},i.message),this.hasExperiencedNetworkDisruption=!0}finally{this.connectionAttemptInProgress=!1}if(this.connected){this.logger.debug({},`Connected to ${this.relayUrl} successfully on attempt: ${e}`);break}await new Promise(n=>setTimeout(n,q.toMiliseconds(e*1))),e++}}startPingTimeout(){var t,e,n,i,s;if(Wn())try{(e=(t=this.provider)==null?void 0:t.connection)!=null&&e.socket&&((s=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||s.on("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o,o==null?void 0:o.message)}}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const t=await this.core.crypto.signJWT(this.relayUrl);this.provider=new Fd(new Wd(J_({sdkVersion:ds,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:t,useOnCloseEvent:!0,bundleId:this.bundleId,packageName:this.packageName}))),this.registerProviderListeners()}async recordMessageEvent(t,e){const{topic:n,message:i}=t;await this.messages.set(n,i,e)}async shouldIgnoreMessageEvent(t){const{topic:e,message:n}=t;if(!n||n.length===0)return this.logger.warn(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isKnownTopic(e))return this.logger.warn(`Ignoring message for unknown topic ${e}`),!0;const i=this.messages.has(e,n);return i&&this.logger.warn(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(t){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:t}),Ss(t)){if(!t.method.endsWith(lg))return;const e=t.params,{topic:n,message:i,publishedAt:s,attestation:o}=e.data,c={topic:n,message:i,publishedAt:s,transportType:se.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(Qa({type:"event",event:e.id},c)),this.events.emit(e.id,c),await this.acknowledgePayload(t),await this.onMessageEvent(c)}else xs(t)&&this.events.emit(le.message_ack,t)}async onMessageEvent(t){await this.shouldIgnoreMessageEvent(t)||(await this.recordMessageEvent(t,$n.inbound),this.events.emit(le.message,t))}async acknowledgePayload(t){const e=Mn(t.id,!0);await this.provider.connection.send(e)}unregisterProviderListeners(){this.provider.off(Je.payload,this.onPayloadHandler),this.provider.off(Je.connect,this.onConnectHandler),this.provider.off(Je.disconnect,this.onDisconnectHandler),this.provider.off(Je.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let t=await Na();Uw(async e=>{t!==e&&(t=e,e?await this.transportOpen().catch(n=>this.logger.error(n,n==null?void 0:n.message)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))}),this.core.heartbeat.on(Tr.pulse,async()=>{if(!this.transportExplicitlyClosed&&!this.connected&&Bw())try{await this.confirmOnlineStateOrThrow(),await this.transportOpen()}catch(e){this.logger.warn(e,e==null?void 0:e.message)}})}async onProviderDisconnect(){clearTimeout(this.pingTimeout),this.events.emit(le.disconnect),this.connectionAttemptInProgress=!1,!this.reconnectInProgress&&(this.reconnectInProgress=!0,await this.subscriber.stop(),this.subscriber.hasAnyTopics&&(this.transportExplicitlyClosed||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(t=>this.logger.error(t,t==null?void 0:t.message)),this.reconnectTimeout=void 0,this.reconnectInProgress=!1},q.toMiliseconds(ug)))))}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectPromise){await this.connectPromise;return}await this.connect()}}}function x0(r,t){return r===t||Number.isNaN(r)&&Number.isNaN(t)}function Ya(r){return Object.getOwnPropertySymbols(r).filter(t=>Object.prototype.propertyIsEnumerable.call(r,t))}function Xa(r){return r==null?r===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(r)}const C0="[object RegExp]",$0="[object String]",k0="[object Number]",N0="[object Boolean]",ec="[object Arguments]",U0="[object Symbol]",q0="[object Date]",M0="[object Map]",B0="[object Set]",j0="[object Array]",z0="[object Function]",K0="[object ArrayBuffer]",Vi="[object Object]",F0="[object Error]",W0="[object DataView]",H0="[object Uint8Array]",G0="[object Uint8ClampedArray]",J0="[object Uint16Array]",Z0="[object Uint32Array]",Q0="[object BigUint64Array]",Y0="[object Int8Array]",X0="[object Int16Array]",ev="[object Int32Array]",tv="[object BigInt64Array]",rv="[object Float32Array]",nv="[object Float64Array]";function iv(){}function tc(r){if(!r||typeof r!="object")return!1;const t=Object.getPrototypeOf(r);return t===null||t===Object.prototype||Object.getPrototypeOf(t)===null?Object.prototype.toString.call(r)==="[object Object]":!1}function sv(r,t,e){return Wr(r,t,void 0,void 0,void 0,void 0,e)}function Wr(r,t,e,n,i,s,o){const c=o(r,t,e,n,i,s);if(c!==void 0)return c;if(typeof r==typeof t)switch(typeof r){case"bigint":case"string":case"boolean":case"symbol":case"undefined":return r===t;case"number":return r===t||Object.is(r,t);case"function":return r===t;case"object":return Xr(r,t,s,o)}return Xr(r,t,s,o)}function Xr(r,t,e,n){if(Object.is(r,t))return!0;let i=Xa(r),s=Xa(t);if(i===ec&&(i=Vi),s===ec&&(s=Vi),i!==s)return!1;switch(i){case $0:return r.toString()===t.toString();case k0:{const l=r.valueOf(),u=t.valueOf();return x0(l,u)}case N0:case q0:case U0:return Object.is(r.valueOf(),t.valueOf());case C0:return r.source===t.source&&r.flags===t.flags;case z0:return r===t}e=e??new Map;const o=e.get(r),c=e.get(t);if(o!=null&&c!=null)return o===t;e.set(r,t),e.set(t,r);try{switch(i){case M0:{if(r.size!==t.size)return!1;for(const[l,u]of r.entries())if(!t.has(l)||!Wr(u,t.get(l),l,r,t,e,n))return!1;return!0}case B0:{if(r.size!==t.size)return!1;const l=Array.from(r.values()),u=Array.from(t.values());for(let d=0;d<l.length;d++){const h=l[d],p=u.findIndex(_=>Wr(h,_,void 0,r,t,e,n));if(p===-1)return!1;u.splice(p,1)}return!0}case j0:case H0:case G0:case J0:case Z0:case Q0:case Y0:case X0:case ev:case tv:case rv:case nv:{if(typeof ee<"u"&&ee.isBuffer(r)!==ee.isBuffer(t)||r.length!==t.length)return!1;for(let l=0;l<r.length;l++)if(!Wr(r[l],t[l],l,r,t,e,n))return!1;return!0}case K0:return r.byteLength!==t.byteLength?!1:Xr(new Uint8Array(r),new Uint8Array(t),e,n);case W0:return r.byteLength!==t.byteLength||r.byteOffset!==t.byteOffset?!1:Xr(new Uint8Array(r),new Uint8Array(t),e,n);case F0:return r.name===t.name&&r.message===t.message;case Vi:{if(!(Xr(r.constructor,t.constructor,e,n)||tc(r)&&tc(t)))return!1;const l=[...Object.keys(r),...Ya(r)],u=[...Object.keys(t),...Ya(t)];if(l.length!==u.length)return!1;for(let d=0;d<l.length;d++){const h=l[d],p=r[h];if(!Object.hasOwn(t,h))return!1;const _=t[h];if(!Wr(p,_,h,r,t,e,n))return!1}return!0}default:return!1}}finally{e.delete(r),e.delete(t)}}function ov(r,t){return sv(r,t,iv)}var av=Object.defineProperty,rc=Object.getOwnPropertySymbols,cv=Object.prototype.hasOwnProperty,lv=Object.prototype.propertyIsEnumerable,ws=(r,t,e)=>t in r?av(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,nc=(r,t)=>{for(var e in t||(t={}))cv.call(t,e)&&ws(r,e,t[e]);if(rc)for(var e of rc(t))lv.call(t,e)&&ws(r,e,t[e]);return r},$e=(r,t,e)=>ws(r,typeof t!="symbol"?t+"":t,e);class hr extends Cp{constructor(t,e,n,i=yt,s=void 0){super(t,e,n,i),this.core=t,this.logger=e,this.name=n,$e(this,"map",new Map),$e(this,"version",dg),$e(this,"cached",[]),$e(this,"initialized",!1),$e(this,"getKey"),$e(this,"storagePrefix",yt),$e(this,"recentlyDeleted",[]),$e(this,"recentlyDeletedLimit",200),$e(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!fe(o)?this.map.set(this.getKey(o),o):fw(o)?this.map.set(o.id,o):mw(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)}),$e(this,"set",async(o,c)=>{this.isInitialized(),this.map.has(o)?await this.update(o,c):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:c}),this.map.set(o,c),await this.persist())}),$e(this,"get",o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o))),$e(this,"getAll",o=>(this.isInitialized(),o?this.values.filter(c=>Object.keys(o).every(l=>ov(c[l],o[l]))):this.values)),$e(this,"update",async(o,c)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:c});const l=nc(nc({},this.getData(o)),c);this.map.set(o,l),await this.persist()}),$e(this,"delete",async(o,c)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:c}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())}),this.logger=Ce(e,this.name),this.storagePrefix=i,this.getKey=s}get context(){return Ke(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(t){this.recentlyDeleted.push(t),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(t){await this.core.storage.setItem(this.storageKey,t)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(t){const e=this.map.get(t);if(!e){if(this.recentlyDeleted.includes(t)){const{message:i}=U("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${t}`);throw this.logger.error(i),new Error(i)}const{message:n}=U("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.error(n),new Error(n)}return e}async persist(){await this.setDataStore(this.values)}async restore(){try{const t=await this.getDataStore();if(typeof t>"u"||!t.length)return;if(this.map.size){const{message:e}=U("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(t){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(t)}}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}}var uv=Object.defineProperty,dv=(r,t,e)=>t in r?uv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,J=(r,t,e)=>dv(r,typeof t!="symbol"?t+"":t,e);class hv{constructor(t,e){this.core=t,this.logger=e,J(this,"name",fg),J(this,"version",mg),J(this,"events",new Vc),J(this,"pairings"),J(this,"initialized",!1),J(this,"storagePrefix",yt),J(this,"ignoredPayloadTypes",[Pt]),J(this,"registeredMethods",[]),J(this,"init",async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))}),J(this,"register",({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]}),J(this,"create",async n=>{this.isInitialized();const i=cs(),s=await this.core.crypto.setSymKey(i),o=_e(q.FIVE_MINUTES),c={protocol:fu},l={topic:s,expiry:o,relay:c,active:!1,methods:n==null?void 0:n.methods},u=Ra({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:c,expiryTimestamp:o,methods:n==null?void 0:n.methods});return this.events.emit(Qt.create,l),this.core.expirer.set(s,o),await this.pairings.set(s,l),await this.core.relayer.subscribe(s,{transportType:n==null?void 0:n.transportType,internal:n==null?void 0:n.internal}),{topic:s,uri:u}}),J(this,"pair",async n=>{this.isInitialized();const i=this.core.eventClient.createEvent({properties:{topic:n==null?void 0:n.uri,trace:[ht.pairing_started]}});this.isValidPair(n,i);const{topic:s,symKey:o,relay:c,expiryTimestamp:l,methods:u}=Oa(n.uri);i.props.properties.topic=s,i.addTrace(ht.pairing_uri_validation_success),i.addTrace(ht.pairing_uri_not_expired);let d;if(this.pairings.keys.includes(s)){if(d=this.pairings.get(s),i.addTrace(ht.existing_pairing),d.active)throw i.setError(It.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);i.addTrace(ht.pairing_not_expired)}const h=l||_e(q.FIVE_MINUTES),p={topic:s,relay:c,expiry:h,active:!1,methods:u};this.core.expirer.set(s,h),await this.pairings.set(s,p),i.addTrace(ht.store_new_pairing),n.activatePairing&&await this.activate({topic:s}),this.events.emit(Qt.create,p),i.addTrace(ht.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),i.addTrace(ht.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{i.setError(It.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:c})}catch(_){throw i.setError(It.subscribe_pairing_topic_failure),_}return i.addTrace(ht.subscribe_pairing_topic_success),p}),J(this,"activate",async({topic:n})=>{this.isInitialized();const i=_e(q.FIVE_MINUTES);this.core.expirer.set(n,i),await this.pairings.update(n,{active:!0,expiry:i})}),J(this,"ping",async n=>{this.isInitialized(),await this.isValidPing(n),this.logger.warn("ping() is deprecated and will be removed in the next major release.");const{topic:i}=n;if(this.pairings.keys.includes(i)){const s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:c,reject:l}=Zt();this.events.once(te("pairing_ping",s),({error:u})=>{u?l(u):c()}),await o()}}),J(this,"updateExpiry",async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})}),J(this,"updateMetadata",async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})}),J(this,"getPairings",()=>(this.isInitialized(),this.pairings.values)),J(this,"disconnect",async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",ae("USER_DISCONNECTED")),await this.deletePairing(i))}),J(this,"formatUriFromPairing",n=>{this.isInitialized();const{topic:i,relay:s,expiry:o,methods:c}=n,l=this.core.crypto.keychain.get(i);return Ra({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:l,relay:s,expiryTimestamp:o,methods:c})}),J(this,"sendRequest",async(n,i,s)=>{const o=Nt(i,s),c=await this.core.crypto.encode(n,o),l=Ur[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,c,l),o.id}),J(this,"sendResult",async(n,i,s)=>{const o=Mn(n,s),c=await this.core.crypto.encode(i,o),l=(await this.core.history.get(i,n)).request.method,u=Ur[l].res;await this.core.relayer.publish(i,c,u),await this.core.history.resolve(o)}),J(this,"sendError",async(n,i,s)=>{const o=Sc(n,s),c=await this.core.crypto.encode(i,o),l=(await this.core.history.get(i,n)).request.method,u=Ur[l]?Ur[l].res:Ur.unregistered_method.res;await this.core.relayer.publish(i,c,u),await this.core.history.resolve(o)}),J(this,"deletePairing",async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,ae("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])}),J(this,"cleanup",async()=>{const n=this.pairings.getAll().filter(i=>Ut(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))}),J(this,"onRelayEventRequest",async n=>{const{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return await this.onPairingPingRequest(i,s);case"wc_pairingDelete":return await this.onPairingDeleteRequest(i,s);default:return await this.onUnknownRpcMethodRequest(i,s)}}),J(this,"onRelayEventResponse",async n=>{const{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}}),J(this,"onPairingPingRequest",async(n,i)=>{const{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(Qt.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}}),J(this,"onPairingPingResponse",(n,i)=>{const{id:s}=i;setTimeout(()=>{vt(i)?this.events.emit(te("pairing_ping",s),{}):pt(i)&&this.events.emit(te("pairing_ping",s),{error:i.error})},500)}),J(this,"onPairingDeleteRequest",async(n,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(Qt.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}}),J(this,"onUnknownRpcMethodRequest",async(n,i)=>{const{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;const c=ae("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,c),this.logger.error(c)}catch(c){await this.sendError(s,n,c),this.logger.error(c)}}),J(this,"onUnknownRpcMethodResponse",n=>{this.registeredMethods.includes(n)||this.logger.error(ae("WC_METHOD_UNSUPPORTED",n))}),J(this,"isValidPair",(n,i)=>{var s;if(!Ne(n)){const{message:c}=U("MISSING_OR_INVALID",`pair() params: ${n}`);throw i.setError(It.malformed_pairing_uri),new Error(c)}if(!_w(n.uri)){const{message:c}=U("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw i.setError(It.malformed_pairing_uri),new Error(c)}const o=Oa(n==null?void 0:n.uri);if(!((s=o==null?void 0:o.relay)!=null&&s.protocol)){const{message:c}=U("MISSING_OR_INVALID","pair() uri#relay-protocol");throw i.setError(It.malformed_pairing_uri),new Error(c)}if(!(o!=null&&o.symKey)){const{message:c}=U("MISSING_OR_INVALID","pair() uri#symKey");throw i.setError(It.malformed_pairing_uri),new Error(c)}if(o!=null&&o.expiryTimestamp&&q.toMiliseconds(o==null?void 0:o.expiryTimestamp)<Date.now()){i.setError(It.pairing_expired);const{message:c}=U("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(c)}}),J(this,"isValidPing",async n=>{if(!Ne(n)){const{message:s}=U("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)}),J(this,"isValidDisconnect",async n=>{if(!Ne(n)){const{message:s}=U("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)}),J(this,"isValidPairingTopic",async n=>{if(!he(n,!1)){const{message:i}=U("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=U("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(Ut(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=U("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}}),this.core=t,this.logger=Ce(e,this.name),this.pairings=new hr(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Ke(this.logger)}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}registerRelayerEvents(){this.core.relayer.on(le.message,async t=>{const{topic:e,message:n,transportType:i}=t;if(this.pairings.keys.includes(e)&&i!==se.link_mode&&!this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))try{const s=await this.core.crypto.decode(e,n);Ss(s)?(this.core.history.set(e,s),await this.onRelayEventRequest({topic:e,payload:s})):xs(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:e,payload:s}),this.core.history.delete(e,s.id)),await this.core.relayer.messages.ack(e,n)}catch(s){this.logger.error(s)}})}registerExpirerEvents(){this.core.expirer.on(Qe.expired,async t=>{const{topic:e}=gl(t.target);e&&this.pairings.keys.includes(e)&&(await this.deletePairing(e,!0),this.events.emit(Qt.expire,{topic:e}))})}}var pv=Object.defineProperty,_v=(r,t,e)=>t in r?pv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,be=(r,t,e)=>_v(r,typeof t!="symbol"?t+"":t,e);class fv extends Dp{constructor(t,e){super(t,e),this.core=t,this.logger=e,be(this,"records",new Map),be(this,"events",new lr.EventEmitter),be(this,"name",yg),be(this,"version",wg),be(this,"cached",[]),be(this,"initialized",!1),be(this,"storagePrefix",yt),be(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),be(this,"set",(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;const o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:_e(q.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(nt.created,o)}),be(this,"resolve",async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=pt(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(nt.updated,i))}),be(this,"get",async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i))),be(this,"delete",(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(nt.deleted,s)}}),this.persist()}),be(this,"exists",async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1)),be(this,"on",(n,i)=>{this.events.on(n,i)}),be(this,"once",(n,i)=>{this.events.once(n,i)}),be(this,"off",(n,i)=>{this.events.off(n,i)}),be(this,"removeListener",(n,i)=>{this.events.removeListener(n,i)}),this.logger=Ce(e,this.name)}get context(){return Ke(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const t=[];return this.values.forEach(e=>{if(typeof e.response<"u")return;const n={topic:e.topic,request:Nt(e.request.method,e.request.params,e.id),chainId:e.chainId};return t.push(n)}),t}async setJsonRpcRecords(t){await this.core.storage.setItem(this.storageKey,t)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(t){this.isInitialized();const e=this.records.get(t);if(!e){const{message:n}=U("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(n)}return e}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(nt.sync)}async restore(){try{const t=await this.getJsonRpcRecords();if(typeof t>"u"||!t.length)return;if(this.records.size){const{message:e}=U("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(t){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(t)}}registerEventListeners(){this.events.on(nt.created,t=>{const e=nt.created;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.events.on(nt.updated,t=>{const e=nt.updated;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.events.on(nt.deleted,t=>{const e=nt.deleted;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.core.heartbeat.on(Tr.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let t=!1;this.records.forEach(e=>{q.toMiliseconds(e.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${e.id}`),this.records.delete(e.id),this.events.emit(nt.deleted,e,!1),t=!0)}),t&&this.persist()}catch(t){this.logger.warn(t)}}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}}var mv=Object.defineProperty,yv=(r,t,e)=>t in r?mv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Re=(r,t,e)=>yv(r,typeof t!="symbol"?t+"":t,e);class wv extends kp{constructor(t,e){super(t,e),this.core=t,this.logger=e,Re(this,"expirations",new Map),Re(this,"events",new lr.EventEmitter),Re(this,"name",gg),Re(this,"version",Eg),Re(this,"cached",[]),Re(this,"initialized",!1),Re(this,"storagePrefix",yt),Re(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),Re(this,"has",n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}}),Re(this,"set",(n,i)=>{this.isInitialized();const s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Qe.created,{target:s,expiration:o})}),Re(this,"get",n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)}),Re(this,"del",n=>{if(this.isInitialized(),this.has(n)){const i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Qe.deleted,{target:i,expiration:s})}}),Re(this,"on",(n,i)=>{this.events.on(n,i)}),Re(this,"once",(n,i)=>{this.events.once(n,i)}),Re(this,"off",(n,i)=>{this.events.off(n,i)}),Re(this,"removeListener",(n,i)=>{this.events.removeListener(n,i)}),this.logger=Ce(e,this.name)}get context(){return Ke(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(t){if(typeof t=="string")return Z_(t);if(typeof t=="number")return Q_(t);const{message:e}=U("UNKNOWN_TYPE",`Target type: ${typeof t}`);throw new Error(e)}async setExpirations(t){await this.core.storage.setItem(this.storageKey,t)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Qe.sync)}async restore(){try{const t=await this.getExpirations();if(typeof t>"u"||!t.length)return;if(this.expirations.size){const{message:e}=U("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(t){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(t)}}getExpiration(t){const e=this.expirations.get(t);if(!e){const{message:n}=U("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.warn(n),new Error(n)}return e}checkExpiry(t,e){const{expiry:n}=e;q.toMiliseconds(n)-Date.now()<=0&&this.expire(t,e)}expire(t,e){this.expirations.delete(t),this.events.emit(Qe.expired,{target:t,expiration:e})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((t,e)=>this.checkExpiry(e,t))}registerEventListeners(){this.core.heartbeat.on(Tr.pulse,()=>this.checkExpirations()),this.events.on(Qe.created,t=>{const e=Qe.created;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()}),this.events.on(Qe.expired,t=>{const e=Qe.expired;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()}),this.events.on(Qe.deleted,t=>{const e=Qe.deleted;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()})}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}}var gv=Object.defineProperty,Ev=(r,t,e)=>t in r?gv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,de=(r,t,e)=>Ev(r,typeof t!="symbol"?t+"":t,e);class vv extends Np{constructor(t,e,n){super(t,e,n),this.core=t,this.logger=e,this.store=n,de(this,"name",vg),de(this,"abortController"),de(this,"isDevEnv"),de(this,"verifyUrlV3",Ig),de(this,"storagePrefix",yt),de(this,"version",_u),de(this,"publicKey"),de(this,"fetchPromise"),de(this,"init",async()=>{var i;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&q.toMiliseconds((i=this.publicKey)==null?void 0:i.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))}),de(this,"register",async i=>{if(!Lr()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:c}=i,l=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${c}`;try{const u=Ot.getDocument(),d=this.startAbortTimer(q.ONE_SECOND*5),h=await new Promise((p,_)=>{const f=()=>{window.removeEventListener("message",y),u.body.removeChild(m),_("attestation aborted")};this.abortController.signal.addEventListener("abort",f);const m=u.createElement("iframe");m.src=l,m.style.display="none",m.addEventListener("error",f,{signal:this.abortController.signal});const y=b=>{if(b.data&&typeof b.data=="string")try{const R=JSON.parse(b.data);if(R.type==="verify_attestation"){if(ji(R.attestation).payload.id!==o)return;clearInterval(d),u.body.removeChild(m),this.abortController.signal.removeEventListener("abort",f),window.removeEventListener("message",y),p(R.attestation===null?"":R.attestation)}}catch(R){this.logger.warn(R)}};u.body.appendChild(m),window.addEventListener("message",y,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",h),h}catch(u){this.logger.warn(u)}return""}),de(this,"resolve",async i=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:c}=i;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(ji(s).payload.id!==c)return;const u=await this.isValidJwtAttestation(s);if(u){if(!u.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return u}}if(!o)return;const l=this.getVerifyUrl(i==null?void 0:i.verifyUrl);return this.fetchAttestation(o,l)}),de(this,"fetchAttestation",async(i,s)=>{this.logger.debug(`resolving attestation: ${i} from url: ${s}`);const o=this.startAbortTimer(q.ONE_SECOND*5),c=await fetch(`${s}/attestation/${i}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),c.status===200?await c.json():void 0}),de(this,"getVerifyUrl",i=>{let s=i||Yr;return Ag.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Yr}`),s=Yr),s}),de(this,"fetchPublicKey",async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const i=this.startAbortTimer(q.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(i),await s.json()}catch(i){this.logger.warn(i)}}),de(this,"persistPublicKey",async i=>{this.logger.debug("persisting public key to local storage",i),await this.store.setItem(this.storeKey,i),this.publicKey=i}),de(this,"removePublicKey",async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0}),de(this,"isValidJwtAttestation",async i=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(i,s)}catch(c){this.logger.error(c),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(i,o)}catch(c){this.logger.error(c),this.logger.warn("error validating attestation")}}),de(this,"getPublicKey",async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey()),de(this,"fetchAndPersistPublicKey",async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const i=await this.fetchPromise;return this.fetchPromise=void 0,i}),de(this,"validateAttestation",(i,s)=>{const o=Wy(i,s.publicKey),c={hasExpired:q.toMiliseconds(o.exp)<Date.now(),payload:o};if(c.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:c.payload.origin,isScam:c.payload.isScam,isVerified:c.payload.isVerified}}),this.logger=Ce(e,this.name),this.abortController=new AbortController,this.isDevEnv=Ws(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return Ke(this.logger)}startAbortTimer(t){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),q.toMiliseconds(t))}}var bv=Object.defineProperty,Iv=(r,t,e)=>t in r?bv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ic=(r,t,e)=>Iv(r,typeof t!="symbol"?t+"":t,e);class Av extends Up{constructor(t,e){super(t,e),this.projectId=t,this.logger=e,ic(this,"context",Tg),ic(this,"registerDeviceToken",async n=>{const{clientId:i,token:s,notificationType:o,enableEncrypted:c=!1}=n,l=`${Pg}/${this.projectId}/clients`;await fetch(l,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:c})})}),this.logger=Ce(e,this.context)}}var Tv=Object.defineProperty,sc=Object.getOwnPropertySymbols,Pv=Object.prototype.hasOwnProperty,Ov=Object.prototype.propertyIsEnumerable,gs=(r,t,e)=>t in r?Tv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,jr=(r,t)=>{for(var e in t||(t={}))Pv.call(t,e)&&gs(r,e,t[e]);if(sc)for(var e of sc(t))Ov.call(t,e)&&gs(r,e,t[e]);return r},me=(r,t,e)=>gs(r,typeof t!="symbol"?t+"":t,e);class Rv extends qp{constructor(t,e,n=!0){super(t,e,n),this.core=t,this.logger=e,me(this,"context",Rg),me(this,"storagePrefix",yt),me(this,"storageVersion",Og),me(this,"events",new Map),me(this,"shouldPersist",!1),me(this,"init",async()=>{if(!Ws())try{const i={eventId:Jo(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:yl(this.core.relayer.protocol,this.core.relayer.version,ds)}}};await this.sendEvent([i])}catch(i){this.logger.warn(i)}}),me(this,"createEvent",i=>{const{event:s="ERROR",type:o="",properties:{topic:c,trace:l}}=i,u=Jo(),d=this.core.projectId||"",h=Date.now(),p=jr({eventId:u,timestamp:h,props:{event:s,type:o,properties:{topic:c,trace:l}},bundleId:d,domain:this.getAppDomain()},this.setMethods(u));return this.telemetryEnabled&&(this.events.set(u,p),this.shouldPersist=!0),p}),me(this,"getEvent",i=>{const{eventId:s,topic:o}=i;if(s)return this.events.get(s);const c=Array.from(this.events.values()).find(l=>l.props.properties.topic===o);if(c)return jr(jr({},c),this.setMethods(c.eventId))}),me(this,"deleteEvent",i=>{const{eventId:s}=i;this.events.delete(s),this.shouldPersist=!0}),me(this,"setEventListeners",()=>{this.core.heartbeat.on(Tr.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(i=>{q.fromMiliseconds(Date.now())-q.fromMiliseconds(i.timestamp)>Lg&&(this.events.delete(i.eventId),this.shouldPersist=!0)})})}),me(this,"setMethods",i=>({addTrace:s=>this.addTrace(i,s),setError:s=>this.setError(i,s)})),me(this,"addTrace",(i,s)=>{const o=this.events.get(i);o&&(o.props.properties.trace.push(s),this.events.set(i,o),this.shouldPersist=!0)}),me(this,"setError",(i,s)=>{const o=this.events.get(i);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(i,o),this.shouldPersist=!0)}),me(this,"persist",async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1}),me(this,"restore",async()=>{try{const i=await this.core.storage.getItem(this.storageKey)||[];if(!i.length)return;i.forEach(s=>{this.events.set(s.eventId,jr(jr({},s),this.setMethods(s.eventId)))})}catch(i){this.logger.warn(i)}}),me(this,"submit",async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const i=[];for(const[s,o]of this.events)o.props.type&&i.push(o);if(i.length!==0)try{if((await this.sendEvent(i)).ok)for(const s of i)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}}),me(this,"sendEvent",async i=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${Dg}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${ds}${s}`,{method:"POST",body:JSON.stringify(i)})}),me(this,"getAppDomain",()=>ml().url),this.logger=Ce(e,this.context),this.telemetryEnabled=n,n?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var Lv=Object.defineProperty,oc=Object.getOwnPropertySymbols,Dv=Object.prototype.hasOwnProperty,Vv=Object.prototype.propertyIsEnumerable,Es=(r,t,e)=>t in r?Lv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ac=(r,t)=>{for(var e in t||(t={}))Dv.call(t,e)&&Es(r,e,t[e]);if(oc)for(var e of oc(t))Vv.call(t,e)&&Es(r,e,t[e]);return r},ie=(r,t,e)=>Es(r,typeof t!="symbol"?t+"":t,e);class oo extends Pp{constructor(t){var e;super(t),ie(this,"protocol",pu),ie(this,"version",_u),ie(this,"name",us),ie(this,"relayUrl"),ie(this,"projectId"),ie(this,"customStoragePrefix"),ie(this,"events",new lr.EventEmitter),ie(this,"logger"),ie(this,"heartbeat"),ie(this,"relayer"),ie(this,"crypto"),ie(this,"storage"),ie(this,"history"),ie(this,"expirer"),ie(this,"pairing"),ie(this,"verify"),ie(this,"echoClient"),ie(this,"linkModeSupportedApps"),ie(this,"eventClient"),ie(this,"initialized",!1),ie(this,"logChunkController"),ie(this,"on",(c,l)=>this.events.on(c,l)),ie(this,"once",(c,l)=>this.events.once(c,l)),ie(this,"off",(c,l)=>this.events.off(c,l)),ie(this,"removeListener",(c,l)=>this.events.removeListener(c,l)),ie(this,"dispatchEnvelope",({topic:c,message:l,sessionExists:u})=>{if(!c||!l)return;const d={topic:c,message:l,publishedAt:Date.now(),transportType:se.link_mode};this.relayer.onLinkMessageEvent(d,{sessionExists:u})});const n=this.getGlobalCore(t==null?void 0:t.customStoragePrefix);if(n)try{return this.customStoragePrefix=n.customStoragePrefix,this.logger=n.logger,this.heartbeat=n.heartbeat,this.crypto=n.crypto,this.history=n.history,this.expirer=n.expirer,this.storage=n.storage,this.relayer=n.relayer,this.pairing=n.pairing,this.verify=n.verify,this.echoClient=n.echoClient,this.linkModeSupportedApps=n.linkModeSupportedApps,this.eventClient=n.eventClient,this.initialized=n.initialized,this.logChunkController=n.logChunkController,n}catch(c){console.warn("Failed to copy global core",c)}this.projectId=t==null?void 0:t.projectId,this.relayUrl=(t==null?void 0:t.relayUrl)||mu,this.customStoragePrefix=t!=null&&t.customStoragePrefix?`:${t.customStoragePrefix}`:"";const i=Ks({level:typeof(t==null?void 0:t.logger)=="string"&&t.logger?t.logger:Qw.logger,name:us}),{logger:s,chunkLoggerController:o}=Ip({opts:i,maxSizeInBytes:t==null?void 0:t.maxLogBlobSizeInBytes,loggerOverride:t==null?void 0:t.logger});this.logChunkController=o,(e=this.logChunkController)!=null&&e.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var c,l;(c=this.logChunkController)!=null&&c.downloadLogsBlobInBrowser&&((l=this.logChunkController)==null||l.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=Ce(s,this.name),this.heartbeat=new Kd,this.crypto=new s0(this,this.logger,t==null?void 0:t.keychain),this.history=new fv(this,this.logger),this.expirer=new wv(this,this.logger),this.storage=t!=null&&t.storage?t.storage:new ap(ac(ac({},Yw),t==null?void 0:t.storageOptions)),this.relayer=new S0({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new hv(this,this.logger),this.verify=new vv(this,this.logger,this.storage),this.echoClient=new Av(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new Rv(this,this.logger,t==null?void 0:t.telemetryEnabled),this.setGlobalCore(this)}static async init(t){const e=new oo(t);await e.initialize();const n=await e.crypto.getClientId();return await e.storage.setItem(hg,n),e}get context(){return Ke(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var t;return(t=this.logChunkController)==null?void 0:t.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(t){this.linkModeSupportedApps.includes(t)||(this.linkModeSupportedApps.push(t),await this.storage.setItem(qa,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.linkModeSupportedApps=await this.storage.getItem(qa)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(t){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,t),this.logger.error(t.message),t}}getGlobalCore(t=""){try{if(this.isGlobalCoreDisabled())return;const e=`_walletConnectCore_${t}`,n=`${e}_count`;return globalThis[n]=(globalThis[n]||0)+1,globalThis[n]>1&&console.warn(`WalletConnect Core is already initialized. This is probably a mistake and can lead to unexpected behavior. Init() was called ${globalThis[n]} times.`),globalThis[e]}catch(e){console.warn("Failed to get global WalletConnect core",e);return}}setGlobalCore(t){var e;try{if(this.isGlobalCoreDisabled())return;const n=`_walletConnectCore_${((e=t.opts)==null?void 0:e.customStoragePrefix)||""}`;globalThis[n]=t}catch(n){console.warn("Failed to set global WalletConnect core",n)}}isGlobalCoreDisabled(){try{return typeof zt<"u"&&Zw.DISABLE_GLOBAL_CORE==="true"}catch{return!0}}}const Sv=oo,Lu="wc",Du=2,Vu="client",ao=`${Lu}@${Du}:${Vu}:`,Si={name:Vu,logger:"error"},cc="WALLETCONNECT_DEEPLINK_CHOICE",xv="proposal",lc="Proposal expired",Cv="session",wr=q.SEVEN_DAYS,$v="engine",Ie={wc_sessionPropose:{req:{ttl:q.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:q.ONE_DAY,prompt:!1,tag:1104},res:{ttl:q.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:q.ONE_DAY,prompt:!1,tag:1106},res:{ttl:q.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:q.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:q.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:q.ONE_DAY,prompt:!1,tag:1112},res:{ttl:q.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:q.ONE_DAY,prompt:!1,tag:1114},res:{ttl:q.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:q.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:q.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1119}}},xi={min:q.FIVE_MINUTES,max:q.SEVEN_DAYS},dt={idle:"IDLE",active:"ACTIVE"},kv={eth_sendTransaction:{key:""},eth_sendRawTransaction:{key:""},wallet_sendCalls:{key:""},solana_signTransaction:{key:"signature"},solana_signAllTransactions:{key:"transactions"},solana_signAndSendTransaction:{key:"signature"},sui_signAndExecuteTransaction:{key:"digest"},sui_signTransaction:{key:""},hedera_signAndExecuteTransaction:{key:"transactionId"},hedera_executeTransaction:{key:"transactionId"},near_signTransaction:{key:""},near_signTransactions:{key:""},tron_signTransaction:{key:"txID"},xrpl_signTransaction:{key:""},xrpl_signTransactionFor:{key:""},algo_signTxn:{key:""},sendTransfer:{key:"txid"},stacks_stxTransfer:{key:"txId"},polkadot_signTransaction:{key:""},cosmos_signDirect:{key:""}},Nv="request",Uv=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],qv="wc",Mv="auth",Bv="authKeys",jv="pairingTopics",zv="requests",li=`${qv}@${1.5}:${Mv}:`,kn=`${li}:PUB_KEY`;var Kv=Object.defineProperty,Fv=Object.defineProperties,Wv=Object.getOwnPropertyDescriptors,uc=Object.getOwnPropertySymbols,Hv=Object.prototype.hasOwnProperty,Gv=Object.prototype.propertyIsEnumerable,vs=(r,t,e)=>t in r?Kv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,re=(r,t)=>{for(var e in t||(t={}))Hv.call(t,e)&&vs(r,e,t[e]);if(uc)for(var e of uc(t))Gv.call(t,e)&&vs(r,e,t[e]);return r},Le=(r,t)=>Fv(r,Wv(t)),x=(r,t,e)=>vs(r,typeof t!="symbol"?t+"":t,e);class Jv extends zp{constructor(t){super(t),x(this,"name",$v),x(this,"events",new Vc),x(this,"initialized",!1),x(this,"requestQueue",{state:dt.idle,queue:[]}),x(this,"sessionRequestQueue",{state:dt.idle,queue:[]}),x(this,"emittedSessionRequests",new af({limit:500})),x(this,"requestQueueDelay",q.ONE_SECOND),x(this,"expectedPairingMethodMap",new Map),x(this,"recentlyDeletedMap",new Map),x(this,"recentlyDeletedLimit",200),x(this,"relayMessageCache",[]),x(this,"pendingSessions",new Map),x(this,"init",async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(Ie)}),this.initialized=!0,setTimeout(async()=>{await this.processPendingMessageEvents(),this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},q.toMiliseconds(this.requestQueueDelay)))}),x(this,"connect",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const n=Le(re({},e),{requiredNamespaces:e.requiredNamespaces||{},optionalNamespaces:e.optionalNamespaces||{}});await this.isValidConnect(n),n.optionalNamespaces=lw(n.requiredNamespaces,n.optionalNamespaces),n.requiredNamespaces={};const{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:c,scopedProperties:l,relays:u}=n;let d=i,h,p=!1;try{if(d){const g=this.client.core.pairing.pairings.get(d);this.client.logger.warn("connect() with existing pairing topic is deprecated and will be removed in the next major release."),p=g.active}}catch(g){throw this.client.logger.error(`connect() -> pairing.get(${d}) failed`),g}if(!d||!p){const{topic:g,uri:D}=await this.client.core.pairing.create({internal:{skipSubscribe:!0}});d=g,h=D}if(!d){const{message:g}=U("NO_MATCHING_KEY",`connect() pairing topic: ${d}`);throw new Error(g)}const _=await this.client.core.crypto.generateKeyPair(),f=Ie.wc_sessionPropose.req.ttl||q.FIVE_MINUTES,m=_e(f),y=Le(re(re({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:fu}],proposer:{publicKey:_,metadata:this.client.metadata},expiryTimestamp:m,pairingTopic:d},c&&{sessionProperties:c}),l&&{scopedProperties:l}),{id:Lt()}),b=te("session_connect",y.id),{reject:R,resolve:v,done:P}=Zt(f,lc),T=({id:g})=>{g===y.id&&(this.client.events.off("proposal_expire",T),this.pendingSessions.delete(y.id),this.events.emit(b,{error:{message:lc,code:0}}))};return this.client.events.on("proposal_expire",T),this.events.once(b,({error:g,session:D})=>{this.client.events.off("proposal_expire",T),g?R(g):D&&v(D)}),await this.sendProposeSession({proposal:y,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:y.id}}}),await this.setProposal(y.id,y),{uri:h,approval:P}}),x(this,"pair",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(e)}catch(n){throw this.client.logger.error("pair() failed"),n}}),x(this,"approve",async e=>{var n,i,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(n=e==null?void 0:e.id)==null?void 0:n.toString(),trace:[kt.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(w){throw o.setError(qr.no_internet_connection),w}try{await this.isValidProposalId(e==null?void 0:e.id)}catch(w){throw this.client.logger.error(`approve() -> proposal.get(${e==null?void 0:e.id}) failed`),o.setError(qr.proposal_not_found),w}try{await this.isValidApprove(e)}catch(w){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(qr.session_approve_namespace_validation_failure),w}const{id:c,relayProtocol:l,namespaces:u,sessionProperties:d,scopedProperties:h,sessionConfig:p}=e,_=this.client.proposal.get(c);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:f,proposer:m,requiredNamespaces:y,optionalNamespaces:b}=_;let R=(i=this.client.core.eventClient)==null?void 0:i.getEvent({topic:f});R||(R=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:kt.session_approve_started,properties:{topic:f,trace:[kt.session_approve_started,kt.session_namespaces_validation_success]}}));const v=await this.client.core.crypto.generateKeyPair(),P=m.publicKey,T=await this.client.core.crypto.generateSharedKey(v,P),g=re(re(re({relay:{protocol:l??"irn"},namespaces:u,controller:{publicKey:v,metadata:this.client.metadata},expiry:_e(wr)},d&&{sessionProperties:d}),h&&{scopedProperties:h}),p&&{sessionConfig:p}),D=se.relay;R.addTrace(kt.subscribing_session_topic);try{await this.client.core.relayer.subscribe(T,{transportType:D,internal:{skipSubscribe:!0}})}catch(w){throw R.setError(qr.subscribe_session_topic_failure),w}R.addTrace(kt.subscribe_session_topic_success);const L=Le(re({},g),{topic:T,requiredNamespaces:y,optionalNamespaces:b,pairingTopic:f,acknowledged:!1,self:g.controller,peer:{publicKey:m.publicKey,metadata:m.metadata},controller:v,transportType:se.relay});await this.client.session.set(T,L),R.addTrace(kt.store_session);try{await this.sendApproveSession({sessionTopic:T,proposal:_,pairingProposalResponse:{relay:{protocol:l??"irn"},responderPublicKey:v},sessionSettleRequest:g,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:c}}}),R.addTrace(kt.session_approve_publish_success)}catch(w){throw this.client.logger.error(w),this.client.session.delete(T,ae("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(T),w}return this.client.core.eventClient.deleteEvent({eventId:R.eventId}),await this.client.core.pairing.updateMetadata({topic:f,metadata:m.metadata}),await this.deleteProposal(c),await this.client.core.pairing.activate({topic:f}),await this.setExpiry(T,_e(wr)),{topic:T,acknowledged:()=>Promise.resolve(this.client.session.get(T))}}),x(this,"reject",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(e)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:n,reason:i}=e;let s;try{s=this.client.proposal.get(n).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),o}s&&await this.sendError({id:n,topic:s,error:i,rpcOpts:Ie.wc_sessionPropose.reject}),await this.deleteProposal(n)}),x(this,"update",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(e)}catch(h){throw this.client.logger.error("update() -> isValidUpdate() failed"),h}const{topic:n,namespaces:i}=e,{done:s,resolve:o,reject:c}=Zt(),l=Lt(),u=Yt().toString(),d=this.client.session.get(n).namespaces;return this.events.once(te("session_update",l),({error:h})=>{h?c(h):o()}),await this.client.session.update(n,{namespaces:i}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:l,relayRpcId:u}).catch(h=>{this.client.logger.error(h),this.client.session.update(n,{namespaces:d}),c(h)}),{acknowledged:s}}),x(this,"extend",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(e)}catch(l){throw this.client.logger.error("extend() -> isValidExtend() failed"),l}const{topic:n}=e,i=Lt(),{done:s,resolve:o,reject:c}=Zt();return this.events.once(te("session_extend",i),({error:l})=>{l?c(l):o()}),await this.setExpiry(n,_e(wr)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(l=>{c(l)}),{acknowledged:s}}),x(this,"request",async e=>{this.isInitialized();try{await this.isValidRequest(e)}catch(y){throw this.client.logger.error("request() -> isValidRequest() failed"),y}const{chainId:n,request:i,topic:s,expiry:o=Ie.wc_sessionRequest.req.ttl}=e,c=this.client.session.get(s);(c==null?void 0:c.transportType)===se.relay&&await this.confirmOnlineStateOrThrow();const l=Lt(),u=Yt().toString(),{done:d,resolve:h,reject:p}=Zt(o,"Request expired. Please try again.");this.events.once(te("session_request",l),({error:y,result:b})=>{y?p(y):h(b)});const _="wc_sessionRequest",f=this.getAppLinkIfEnabled(c.peer.metadata,c.transportType);if(f)return await this.sendRequest({clientRpcId:l,relayRpcId:u,topic:s,method:_,params:{request:Le(re({},i),{expiryTimestamp:_e(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0,appLink:f}).catch(y=>p(y)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:l}),await d();const m={request:Le(re({},i),{expiryTimestamp:_e(o)}),chainId:n};return await Promise.all([new Promise(async y=>{await this.sendRequest({clientRpcId:l,relayRpcId:u,topic:s,method:_,params:m,expiry:o,throwOnFailedPublish:!0,tvf:this.getTVFParams(l,m)}).catch(b=>p(b)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:l}),y()}),new Promise(async y=>{var b;if(!((b=c.sessionConfig)!=null&&b.disableDeepLink)){const R=await tf(this.client.core.storage,cc);await Y_({id:l,topic:s,wcDeepLink:R})}y()}),d()]).then(y=>y[2])}),x(this,"respond",async e=>{this.isInitialized(),await this.isValidRespond(e);const{topic:n,response:i}=e,{id:s}=i,o=this.client.session.get(n);o.transportType===se.relay&&await this.confirmOnlineStateOrThrow();const c=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);vt(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0,appLink:c}):pt(i)&&await this.sendError({id:s,topic:n,error:i.error,appLink:c}),this.cleanupAfterResponse(e)}),x(this,"ping",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(e)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}const{topic:n}=e;if(this.client.session.keys.includes(n)){const i=Lt(),s=Yt().toString(),{done:o,resolve:c,reject:l}=Zt();this.events.once(te("session_ping",i),({error:u})=>{u?l(u):c()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(n)&&(this.client.logger.warn("ping() on pairing topic is deprecated and will be removed in the next major release."),await this.client.core.pairing.ping({topic:n}))}),x(this,"emit",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(e);const{topic:n,event:i,chainId:s}=e,o=Yt().toString(),c=Lt();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:o,clientRpcId:c})}),x(this,"disconnect",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(e);const{topic:n}=e;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:ae("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:i}=U("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}}),x(this,"find",e=>(this.isInitialized(),this.client.session.getAll().filter(n=>hw(n,e)))),x(this,"getPendingSessionRequests",()=>this.client.pendingRequest.getAll()),x(this,"authenticate",async(e,n)=>{var i;this.isInitialized(),this.isValidAuthenticate(e);const s=n&&this.client.core.linkModeSupportedApps.includes(n)&&((i=this.client.metadata.redirect)==null?void 0:i.linkMode),o=s?se.link_mode:se.relay;o===se.relay&&await this.confirmOnlineStateOrThrow();const{chains:c,statement:l="",uri:u,domain:d,nonce:h,type:p,exp:_,nbf:f,methods:m=[],expiry:y}=e,b=[...e.resources||[]],{topic:R,uri:v}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:R,uri:v}});const P=await this.client.core.crypto.generateKeyPair(),T=Cn(P);if(await Promise.all([this.client.auth.authKeys.set(kn,{responseTopic:T,publicKey:P}),this.client.auth.pairingTopics.set(T,{topic:T,pairingTopic:R})]),await this.client.core.relayer.subscribe(T,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${R}`),m.length>0){const{namespace:C}=Sn(c[0]);let N=wm(C,"request",m);xn(b)&&(N=Em(N,b.pop())),b.push(N)}const g=y&&y>Ie.wc_sessionAuthenticate.req.ttl?y:Ie.wc_sessionAuthenticate.req.ttl,D={authPayload:{type:p??"caip122",chains:c,statement:l,aud:u,domain:d,version:"1",nonce:h,iat:new Date().toISOString(),exp:_,nbf:f,resources:b},requester:{publicKey:P,metadata:this.client.metadata},expiryTimestamp:_e(g)},L={eip155:{chains:c,methods:[...new Set(["personal_sign",...m])],events:["chainChanged","accountsChanged"]}},w={requiredNamespaces:{},optionalNamespaces:L,relays:[{protocol:"irn"}],pairingTopic:R,proposer:{publicKey:P,metadata:this.client.metadata},expiryTimestamp:_e(Ie.wc_sessionPropose.req.ttl),id:Lt()},{done:E,resolve:I,reject:A}=Zt(g,"Request expired"),V=Lt(),O=te("session_connect",w.id),S=te("session_request",V),$=async({error:C,session:N})=>{this.events.off(S,k),C?A(C):N&&I({session:N})},k=async C=>{var N,j,z;if(await this.deletePendingAuthRequest(V,{message:"fulfilled",code:0}),C.error){const oe=ae("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return C.error.code===oe.code?void 0:(this.events.off(O,$),A(C.error.message))}await this.deleteProposal(w.id),this.events.off(O,$);const{cacaos:F,responder:W}=C.result,H=[],G=[];for(const oe of F){await oa({cacao:oe,projectId:this.client.core.projectId})||(this.client.logger.error(oe,"Signature verification failed"),A(ae("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:Ge}=oe,wt=xn(Ge.resources),ho=[Xi(Ge.iss)],zu=Hn(Ge.iss);if(wt){const di=aa(wt),Ku=ca(wt);H.push(...di),ho.push(...Ku)}for(const di of ho)G.push(`${di}:${zu}`)}const ue=await this.client.core.crypto.generateSharedKey(P,W.publicKey);let ce;H.length>0&&(ce={topic:ue,acknowledged:!0,self:{publicKey:P,metadata:this.client.metadata},peer:W,controller:W.publicKey,expiry:_e(wr),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:R,namespaces:Sa([...new Set(H)],[...new Set(G)]),transportType:o},await this.client.core.relayer.subscribe(ue,{transportType:o}),await this.client.session.set(ue,ce),R&&await this.client.core.pairing.updateMetadata({topic:R,metadata:W.metadata}),ce=this.client.session.get(ue)),(N=this.client.metadata.redirect)!=null&&N.linkMode&&(j=W.metadata.redirect)!=null&&j.linkMode&&(z=W.metadata.redirect)!=null&&z.universal&&n&&(this.client.core.addLinkModeSupportedApp(W.metadata.redirect.universal),this.client.session.update(ue,{transportType:se.link_mode})),I({auths:F,session:ce})};this.events.once(O,$),this.events.once(S,k);let M;try{if(s){const C=Nt("wc_sessionAuthenticate",D,V);this.client.core.history.set(R,C);const N=await this.client.core.crypto.encode("",C,{type:yn,encoding:jt});M=Rn(n,R,N)}else await Promise.all([this.sendRequest({topic:R,method:"wc_sessionAuthenticate",params:D,expiry:e.expiry,throwOnFailedPublish:!0,clientRpcId:V}),this.sendRequest({topic:R,method:"wc_sessionPropose",params:w,expiry:Ie.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:w.id})])}catch(C){throw this.events.off(O,$),this.events.off(S,k),C}return await this.setProposal(w.id,w),await this.setAuthRequest(V,{request:Le(re({},D),{verifyContext:{}}),pairingTopic:R,transportType:o}),{uri:M??v,response:E}}),x(this,"approveSessionAuthenticate",async e=>{const{id:n,auths:i}=e,s=this.client.core.eventClient.createEvent({properties:{topic:n.toString(),trace:[Jt.authenticated_session_approve_started]}});try{this.isInitialized()}catch(y){throw s.setError(Mr.no_internet_connection),y}const o=this.getPendingAuthRequest(n);if(!o)throw s.setError(Mr.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${n}`);const c=o.transportType||se.relay;c===se.relay&&await this.confirmOnlineStateOrThrow();const l=o.requester.publicKey,u=await this.client.core.crypto.generateKeyPair(),d=Cn(l),h={type:Pt,receiverPublicKey:l,senderPublicKey:u},p=[],_=[];for(const y of i){if(!await oa({cacao:y,projectId:this.client.core.projectId})){s.setError(Mr.invalid_cacao);const T=ae("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:d,error:T,encodeOpts:h}),new Error(T.message)}s.addTrace(Jt.cacaos_verified);const{p:b}=y,R=xn(b.resources),v=[Xi(b.iss)],P=Hn(b.iss);if(R){const T=aa(R),g=ca(R);p.push(...T),v.push(...g)}for(const T of v)_.push(`${T}:${P}`)}const f=await this.client.core.crypto.generateSharedKey(u,l);s.addTrace(Jt.create_authenticated_session_topic);let m;if((p==null?void 0:p.length)>0){m={topic:f,acknowledged:!0,self:{publicKey:u,metadata:this.client.metadata},peer:{publicKey:l,metadata:o.requester.metadata},controller:l,expiry:_e(wr),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:Sa([...new Set(p)],[...new Set(_)]),transportType:c},s.addTrace(Jt.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(f,{transportType:c})}catch(y){throw s.setError(Mr.subscribe_authenticated_session_topic_failure),y}s.addTrace(Jt.subscribe_authenticated_session_topic_success),await this.client.session.set(f,m),s.addTrace(Jt.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(Jt.publishing_authenticated_session_approve);try{await this.sendResult({topic:d,id:n,result:{cacaos:i,responder:{publicKey:u,metadata:this.client.metadata}},encodeOpts:h,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,c)})}catch(y){throw s.setError(Mr.authenticated_session_approve_publish_failure),y}return await this.client.auth.requests.delete(n,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:m}}),x(this,"rejectSessionAuthenticate",async e=>{this.isInitialized();const{id:n,reason:i}=e,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);s.transportType===se.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,c=await this.client.core.crypto.generateKeyPair(),l=Cn(o),u={type:Pt,receiverPublicKey:o,senderPublicKey:c};await this.sendError({id:n,topic:l,error:i,encodeOpts:u,rpcOpts:Ie.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.deleteProposal(n)}),x(this,"formatAuthMessage",e=>{this.isInitialized();const{request:n,iss:i}=e;return Cl(n,i)}),x(this,"processRelayMessageCache",()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const e=this.relayMessageCache.shift();e&&await this.onRelayMessage(e)}catch(e){this.client.logger.error(e)}},50)}),x(this,"cleanupDuplicatePairings",async e=>{if(e.pairingTopic)try{const n=this.client.core.pairing.pairings.get(e.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,c;return((o=s.peerMetadata)==null?void 0:o.url)&&((c=s.peerMetadata)==null?void 0:c.url)===e.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}}),x(this,"deleteSession",async e=>{var n;const{topic:i,expirerHasDeleted:s=!1,emitEvent:o=!0,id:c=0}=e,{self:l}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,ae("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(l.publicKey)&&await this.client.core.crypto.deleteKeyPair(l.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),s||this.client.core.expirer.del(i),this.client.core.storage.removeItem(cc).catch(u=>this.client.logger.warn(u)),this.getPendingSessionRequests().forEach(u=>{u.topic===i&&this.deletePendingSessionRequest(u.id,ae("USER_DISCONNECTED"))}),i===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=dt.idle),o&&this.client.events.emit("session_delete",{id:c,topic:i})}),x(this,"deleteProposal",async(e,n)=>{if(n)try{const i=this.client.proposal.get(e),s=this.client.core.eventClient.getEvent({topic:i.pairingTopic});s==null||s.setError(qr.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(e,ae("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"proposal")}),x(this,"deletePendingSessionRequest",async(e,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(e,n),i?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==e),i&&(this.sessionRequestQueue.state=dt.idle,this.client.events.emit("session_request_expire",{id:e}))}),x(this,"deletePendingAuthRequest",async(e,n,i=!1)=>{await Promise.all([this.client.auth.requests.delete(e,n),i?Promise.resolve():this.client.core.expirer.del(e)])}),x(this,"setExpiry",async(e,n)=>{this.client.session.keys.includes(e)&&(this.client.core.expirer.set(e,n),await this.client.session.update(e,{expiry:n}))}),x(this,"setProposal",async(e,n)=>{this.client.core.expirer.set(e,_e(Ie.wc_sessionPropose.req.ttl)),await this.client.proposal.set(e,n)}),x(this,"setAuthRequest",async(e,n)=>{const{request:i,pairingTopic:s,transportType:o=se.relay}=n;this.client.core.expirer.set(e,i.expiryTimestamp),await this.client.auth.requests.set(e,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:e,pairingTopic:s,verifyContext:i.verifyContext,transportType:o})}),x(this,"setPendingSessionRequest",async e=>{const{id:n,topic:i,params:s,verifyContext:o}=e,c=s.request.expiryTimestamp||_e(Ie.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,c),await this.client.pendingRequest.set(n,{id:n,topic:i,params:s,verifyContext:o})}),x(this,"sendRequest",async e=>{const{topic:n,method:i,params:s,expiry:o,relayRpcId:c,clientRpcId:l,throwOnFailedPublish:u,appLink:d,tvf:h,publishOpts:p={}}=e,_=Nt(i,s,l);let f;const m=!!d;try{const R=m?jt:Me;f=await this.client.core.crypto.encode(n,_,{encoding:R})}catch(R){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),R}let y;if(Uv.includes(i)){const R=Ye(JSON.stringify(_)),v=Ye(f);y=await this.client.core.verify.register({id:v,decryptedId:R})}const b=re(re({},Ie[i].req),p);if(b.attestation=y,o&&(b.ttl=o),c&&(b.id=c),this.client.core.history.set(n,_),m){const R=Rn(d,n,f);await K.Linking.openURL(R,this.client.name)}else b.tvf=Le(re({},h),{correlationId:_.id}),u?(b.internal=Le(re({},b.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,f,b)):this.client.core.relayer.publish(n,f,b).catch(R=>this.client.logger.error(R));return _.id}),x(this,"sendProposeSession",async e=>{const{proposal:n,publishOpts:i}=e,s=Nt("wc_sessionPropose",n,n.id);this.client.core.history.set(n.pairingTopic,s);const o=await this.client.core.crypto.encode(n.pairingTopic,s,{encoding:Me}),c=Ye(JSON.stringify(s)),l=Ye(o),u=await this.client.core.verify.register({id:l,decryptedId:c});await this.client.core.relayer.publishCustom({payload:{pairingTopic:n.pairingTopic,sessionProposal:o},opts:Le(re({},i),{publishMethod:"wc_proposeSession",attestation:u})})}),x(this,"sendApproveSession",async e=>{const{sessionTopic:n,pairingProposalResponse:i,proposal:s,sessionSettleRequest:o,publishOpts:c}=e,l=Mn(s.id,i),u=await this.client.core.crypto.encode(s.pairingTopic,l,{encoding:Me}),d=Nt("wc_sessionSettle",o,c==null?void 0:c.id),h=await this.client.core.crypto.encode(n,d,{encoding:Me});this.client.core.history.set(n,d),await this.client.core.relayer.publishCustom({payload:{sessionTopic:n,pairingTopic:s.pairingTopic,sessionProposalResponse:u,sessionSettlementRequest:h},opts:Le(re({},c),{publishMethod:"wc_approveSession"})})}),x(this,"sendResult",async e=>{const{id:n,topic:i,result:s,throwOnFailedPublish:o,encodeOpts:c,appLink:l}=e,u=Mn(n,s);let d;const h=l&&typeof(K==null?void 0:K.Linking)<"u";try{const f=h?jt:Me;d=await this.client.core.crypto.encode(i,u,Le(re({},c||{}),{encoding:f}))}catch(f){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),f}let p,_;try{p=await this.client.core.history.get(i,n);const f=p.request;try{_=this.getTVFParams(n,f.params,s)}catch(m){this.client.logger.warn(`sendResult() -> getTVFParams() failed: ${m==null?void 0:m.message}`)}}catch(f){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),f}if(h){const f=Rn(l,i,d);await K.Linking.openURL(f,this.client.name)}else{const f=p.request.method,m=Ie[f].res;m.tvf=Le(re({},_),{correlationId:n}),o?(m.internal=Le(re({},m.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,d,m)):this.client.core.relayer.publish(i,d,m).catch(y=>this.client.logger.error(y))}await this.client.core.history.resolve(u)}),x(this,"sendError",async e=>{const{id:n,topic:i,error:s,encodeOpts:o,rpcOpts:c,appLink:l}=e,u=Sc(n,s);let d;const h=l&&typeof(K==null?void 0:K.Linking)<"u";try{const _=h?jt:Me;d=await this.client.core.crypto.encode(i,u,Le(re({},o||{}),{encoding:_}))}catch(_){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),_}let p;try{p=await this.client.core.history.get(i,n)}catch(_){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),_}if(h){const _=Rn(l,i,d);await K.Linking.openURL(_,this.client.name)}else{const _=p.request.method,f=c||Ie[_].res;this.client.core.relayer.publish(i,d,f)}await this.client.core.history.resolve(u)}),x(this,"cleanup",async()=>{const e=[],n=[];this.client.session.getAll().forEach(i=>{let s=!1;Ut(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&e.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{Ut(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...e.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])}),x(this,"onProviderMessageEvent",async e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):await this.onRelayMessage(e)}),x(this,"onRelayEventRequest",async e=>{this.requestQueue.queue.push(e),await this.processRequestsQueue()}),x(this,"processRequestsQueue",async()=>{if(this.requestQueue.state===dt.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=dt.active;const e=this.requestQueue.queue.shift();if(e)try{await this.processRequest(e)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=dt.idle}),x(this,"processRequest",async e=>{const{topic:n,payload:i,attestation:s,transportType:o,encryptedId:c}=e,l=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:l}))switch(l){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:n,payload:i,attestation:s,encryptedId:c});case"wc_sessionSettle":return await this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,i);case"wc_sessionPing":return await this.onSessionPingRequest(n,i);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return await this.onSessionRequest({topic:n,payload:i,attestation:s,encryptedId:c,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:n,payload:i,attestation:s,encryptedId:c,transportType:o});default:return this.client.logger.info(`Unsupported request method ${l}`)}}),x(this,"onRelayEventResponse",async e=>{const{topic:n,payload:i,transportType:s}=e,o=(await this.client.core.history.get(n,i.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i,s);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${o}`)}}),x(this,"onRelayEventUnknownPayload",e=>{const{topic:n}=e,{message:i}=U("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)}),x(this,"shouldIgnorePairingRequest",e=>{const{topic:n,requestMethod:i}=e,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)}),x(this,"onSessionProposeRequest",async e=>{const{topic:n,payload:i,attestation:s,encryptedId:o}=e,{params:c,id:l}=i;try{const u=this.client.core.eventClient.getEvent({topic:n});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),u==null||u.setError(It.proposal_listener_not_found)),this.isValidConnect(re({},i.params));const d=c.expiryTimestamp||_e(Ie.wc_sessionPropose.req.ttl),h=re({id:l,pairingTopic:n,expiryTimestamp:d,attestation:s,encryptedId:o},c);await this.setProposal(l,h);const p=await this.getVerifyContext({attestationId:s,hash:Ye(JSON.stringify(i)),encryptedId:o,metadata:h.proposer.metadata});u==null||u.addTrace(ht.emit_session_proposal),this.client.events.emit("session_proposal",{id:l,params:h,verifyContext:p})}catch(u){await this.sendError({id:l,topic:n,error:u,rpcOpts:Ie.wc_sessionPropose.autoReject}),this.client.logger.error(u)}}),x(this,"onSessionProposeResponse",async(e,n,i)=>{const{id:s}=n;if(vt(n)){const{result:o}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const c=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:c});const l=c.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:l});const u=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:u});const d=await this.client.core.crypto.generateSharedKey(l,u);this.pendingSessions.set(s,{sessionTopic:d,pairingTopic:e,proposalId:s,publicKey:l});const h=await this.client.core.relayer.subscribe(d,{transportType:i});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:h}),await this.client.core.pairing.activate({topic:e})}else if(pt(n)){await this.deleteProposal(s);const o=te("session_connect",s);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(o,{error:n.error})}}),x(this,"onSessionSettleRequest",async(e,n)=>{const{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:c,expiry:l,namespaces:u,sessionProperties:d,scopedProperties:h,sessionConfig:p}=n.params,_=[...this.pendingSessions.values()].find(y=>y.sessionTopic===e);if(!_)return this.client.logger.error(`Pending session not found for topic ${e}`);const f=this.client.proposal.get(_.proposalId),m=Le(re(re(re({topic:e,relay:o,expiry:l,namespaces:u,acknowledged:!0,pairingTopic:_.pairingTopic,requiredNamespaces:f.requiredNamespaces,optionalNamespaces:f.optionalNamespaces,controller:c.publicKey,self:{publicKey:_.publicKey,metadata:this.client.metadata},peer:{publicKey:c.publicKey,metadata:c.metadata}},d&&{sessionProperties:d}),h&&{scopedProperties:h}),p&&{sessionConfig:p}),{transportType:se.relay});await this.client.session.set(m.topic,m),await this.setExpiry(m.topic,m.expiry),await this.client.core.pairing.updateMetadata({topic:_.pairingTopic,metadata:m.peer.metadata}),this.client.events.emit("session_connect",{session:m}),this.events.emit(te("session_connect",_.proposalId),{session:m}),this.pendingSessions.delete(_.proposalId),this.deleteProposal(_.proposalId,!1),this.cleanupDuplicatePairings(m),await this.sendResult({id:n.id,topic:e,result:!0})}catch(o){await this.sendError({id:i,topic:e,error:o}),this.client.logger.error(o)}}),x(this,"onSessionSettleResponse",async(e,n)=>{const{id:i}=n;vt(n)?(await this.client.session.update(e,{acknowledged:!0}),this.events.emit(te("session_approve",i),{})):pt(n)&&(await this.client.session.delete(e,ae("USER_DISCONNECTED")),this.events.emit(te("session_approve",i),{error:n.error}))}),x(this,"onSessionUpdateRequest",async(e,n)=>{const{params:i,id:s}=n;try{const o=`${e}_session_update`,c=Nr.get(o);if(c&&this.isRequestOutOfSync(c,s)){this.client.logger.warn(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:e,error:ae("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(re({topic:e},i));try{Nr.set(o,s),await this.client.session.update(e,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:e,result:!0})}catch(l){throw Nr.delete(o),l}this.client.events.emit("session_update",{id:s,topic:e,params:i})}catch(o){await this.sendError({id:s,topic:e,error:o}),this.client.logger.error(o)}}),x(this,"isRequestOutOfSync",(e,n)=>n.toString().slice(0,-3)<e.toString().slice(0,-3)),x(this,"onSessionUpdateResponse",(e,n)=>{const{id:i}=n,s=te("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);vt(n)?this.events.emit(te("session_update",i),{}):pt(n)&&this.events.emit(te("session_update",i),{error:n.error})}),x(this,"onSessionExtendRequest",async(e,n)=>{const{id:i}=n;try{this.isValidExtend({topic:e}),await this.setExpiry(e,_e(wr)),await this.sendResult({id:i,topic:e,result:!0}),this.client.events.emit("session_extend",{id:i,topic:e})}catch(s){await this.sendError({id:i,topic:e,error:s}),this.client.logger.error(s)}}),x(this,"onSessionExtendResponse",(e,n)=>{const{id:i}=n,s=te("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);vt(n)?this.events.emit(te("session_extend",i),{}):pt(n)&&this.events.emit(te("session_extend",i),{error:n.error})}),x(this,"onSessionPingRequest",async(e,n)=>{const{id:i}=n;try{this.isValidPing({topic:e}),await this.sendResult({id:i,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:e})}catch(s){await this.sendError({id:i,topic:e,error:s}),this.client.logger.error(s)}}),x(this,"onSessionPingResponse",(e,n)=>{const{id:i}=n,s=te("session_ping",i);setTimeout(()=>{if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners 2176`);vt(n)?this.events.emit(te("session_ping",i),{}):pt(n)&&this.events.emit(te("session_ping",i),{error:n.error})},500)}),x(this,"onSessionDeleteRequest",async(e,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:e,reason:n.params}),await Promise.all([new Promise(s=>{this.client.core.relayer.once(le.publish,async()=>{s(await this.deleteSession({topic:e,id:i}))})}),this.sendResult({id:i,topic:e,result:!0}),this.cleanupPendingSentRequestsForTopic({topic:e,error:ae("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}}),x(this,"onSessionRequest",async e=>{var n,i,s;const{topic:o,payload:c,attestation:l,encryptedId:u,transportType:d}=e,{id:h,params:p}=c;try{await this.isValidRequest(re({topic:o},p));const _=this.client.session.get(o),f=await this.getVerifyContext({attestationId:l,hash:Ye(JSON.stringify(Nt("wc_sessionRequest",p,h))),encryptedId:u,metadata:_.peer.metadata,transportType:d}),m={id:h,topic:o,params:p,verifyContext:f};await this.setPendingSessionRequest(m),d===se.link_mode&&(n=_.peer.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp((i=_.peer.metadata.redirect)==null?void 0:i.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(m):(this.addSessionRequestToSessionRequestQueue(m),this.processSessionRequestQueue())}catch(_){await this.sendError({id:h,topic:o,error:_}),this.client.logger.error(_)}}),x(this,"onSessionRequestResponse",(e,n)=>{const{id:i}=n,s=te("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);vt(n)?this.events.emit(te("session_request",i),{result:n.result}):pt(n)&&this.events.emit(te("session_request",i),{error:n.error})}),x(this,"onSessionEventRequest",async(e,n)=>{const{id:i,params:s}=n;try{const o=`${e}_session_event_${s.event.name}`,c=Nr.get(o);if(c&&this.isRequestOutOfSync(c,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(re({topic:e},s)),this.client.events.emit("session_event",{id:i,topic:e,params:s}),Nr.set(o,i)}catch(o){await this.sendError({id:i,topic:e,error:o}),this.client.logger.error(o)}}),x(this,"onSessionAuthenticateResponse",(e,n)=>{const{id:i}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:e,payload:n}),vt(n)?this.events.emit(te("session_request",i),{result:n.result}):pt(n)&&this.events.emit(te("session_request",i),{error:n.error})}),x(this,"onSessionAuthenticateRequest",async e=>{var n;const{topic:i,payload:s,attestation:o,encryptedId:c,transportType:l}=e;try{const{requester:u,authPayload:d,expiryTimestamp:h}=s.params,p=await this.getVerifyContext({attestationId:o,hash:Ye(JSON.stringify(s)),encryptedId:c,metadata:u.metadata,transportType:l}),_={requester:u,pairingTopic:i,id:s.id,authPayload:d,verifyContext:p,expiryTimestamp:h};await this.setAuthRequest(s.id,{request:_,pairingTopic:i,transportType:l}),l===se.link_mode&&(n=u.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp(u.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:i,params:s.params,id:s.id,verifyContext:p})}catch(u){this.client.logger.error(u);const d=s.params.requester.publicKey,h=await this.client.core.crypto.generateKeyPair(),p=this.getAppLinkIfEnabled(s.params.requester.metadata,l),_={type:Pt,receiverPublicKey:d,senderPublicKey:h};await this.sendError({id:s.id,topic:i,error:u,encodeOpts:_,rpcOpts:Ie.wc_sessionAuthenticate.autoReject,appLink:p})}}),x(this,"addSessionRequestToSessionRequestQueue",e=>{this.sessionRequestQueue.queue.push(e)}),x(this,"cleanupAfterResponse",e=>{this.deletePendingSessionRequest(e.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=dt.idle,this.processSessionRequestQueue()},q.toMiliseconds(this.requestQueueDelay))}),x(this,"cleanupPendingSentRequestsForTopic",({topic:e,error:n})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===e&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,c=te("session_request",o);if(this.events.listenerCount(c)===0)throw new Error(`emitting ${c} without any listeners`);this.events.emit(te("session_request",s.request.id),{error:n})})}),x(this,"processSessionRequestQueue",()=>{if(this.sessionRequestQueue.state===dt.active){this.client.logger.info("session request queue is already active.");return}const e=this.sessionRequestQueue.queue[0];if(!e){this.client.logger.info("session request queue is empty.");return}try{this.emitSessionRequest(e)}catch(n){this.client.logger.error(n)}}),x(this,"emitSessionRequest",e=>{if(this.emittedSessionRequests.has(e.id)){this.client.logger.warn({id:e.id},`Skipping emitting \`session_request\` event for duplicate request. id: ${e.id}`);return}this.sessionRequestQueue.state=dt.active,this.emittedSessionRequests.add(e.id),this.client.events.emit("session_request",e)}),x(this,"onPairingCreated",e=>{if(e.methods&&this.expectedPairingMethodMap.set(e.topic,e.methods),e.active)return;const n=this.client.proposal.getAll().find(i=>i.pairingTopic===e.topic);n&&this.onSessionProposeRequest({topic:e.topic,payload:Nt("wc_sessionPropose",Le(re({},n),{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties,scopedProperties:n.scopedProperties}),n.id),attestation:n.attestation,encryptedId:n.encryptedId})}),x(this,"isValidConnect",async e=>{if(!Ne(e)){const{message:u}=U("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(e)}`);throw new Error(u)}const{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,scopedProperties:c,relays:l}=e;if(fe(n)||await this.isValidPairingTopic(n),!Aw(l)){const{message:u}=U("MISSING_OR_INVALID",`connect() relays: ${l}`);throw new Error(u)}if(!fe(i)&&ln(i)!==0){const u="requiredNamespaces are deprecated and are automatically assigned to optionalNamespaces";["fatal","error","silent"].includes(this.client.logger.level)?console.warn(u):this.client.logger.warn(u),this.validateNamespaces(i,"requiredNamespaces")}if(!fe(s)&&ln(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),fe(o)||this.validateSessionProps(o,"sessionProperties"),!fe(c)){this.validateSessionProps(c,"scopedProperties");const u=Object.keys(i||{}).concat(Object.keys(s||{}));if(!Object.keys(c).every(d=>u.includes(d.split(":")[0])))throw new Error(`Scoped properties must be a subset of required/optional namespaces, received: ${JSON.stringify(c)}, required/optional namespaces: ${JSON.stringify(u)}`)}}),x(this,"validateNamespaces",(e,n)=>{const i=Iw(e,"connect()",n);if(i)throw new Error(i.message)}),x(this,"isValidApprove",async e=>{if(!Ne(e))throw new Error(U("MISSING_OR_INVALID",`approve() params: ${e}`).message);const{id:n,namespaces:i,relayProtocol:s,sessionProperties:o,scopedProperties:c}=e;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const l=this.client.proposal.get(n),u=Oi(i,"approve()");if(u)throw new Error(u.message);const d=$a(l.requiredNamespaces,i,"approve()");if(d)throw new Error(d.message);if(!he(s,!0)){const{message:h}=U("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(h)}if(fe(o)||this.validateSessionProps(o,"sessionProperties"),!fe(c)){this.validateSessionProps(c,"scopedProperties");const h=new Set(Object.keys(i));if(!Object.keys(c).every(p=>h.has(p.split(":")[0])))throw new Error(`Scoped properties must be a subset of approved namespaces, received: ${JSON.stringify(c)}, approved namespaces: ${Array.from(h).join(", ")}`)}}),x(this,"isValidReject",async e=>{if(!Ne(e)){const{message:s}=U("MISSING_OR_INVALID",`reject() params: ${e}`);throw new Error(s)}const{id:n,reason:i}=e;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!Pw(i)){const{message:s}=U("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}}),x(this,"isValidSessionSettleRequest",e=>{if(!Ne(e)){const{message:u}=U("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${e}`);throw new Error(u)}const{relay:n,controller:i,namespaces:s,expiry:o}=e;if(!hu(n)){const{message:u}=U("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(u)}const c=yw(i,"onSessionSettleRequest()");if(c)throw new Error(c.message);const l=Oi(s,"onSessionSettleRequest()");if(l)throw new Error(l.message);if(Ut(o)){const{message:u}=U("EXPIRED","onSessionSettleRequest()");throw new Error(u)}}),x(this,"isValidUpdate",async e=>{if(!Ne(e)){const{message:l}=U("MISSING_OR_INVALID",`update() params: ${e}`);throw new Error(l)}const{topic:n,namespaces:i}=e;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const s=this.client.session.get(n),o=Oi(i,"update()");if(o)throw new Error(o.message);const c=$a(s.requiredNamespaces,i,"update()");if(c)throw new Error(c.message)}),x(this,"isValidExtend",async e=>{if(!Ne(e)){const{message:i}=U("MISSING_OR_INVALID",`extend() params: ${e}`);throw new Error(i)}const{topic:n}=e;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)}),x(this,"isValidRequest",async e=>{if(!Ne(e)){const{message:l}=U("MISSING_OR_INVALID",`request() params: ${e}`);throw new Error(l)}const{topic:n,request:i,chainId:s,expiry:o}=e;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:c}=this.client.session.get(n);if(!Ca(c,s)){const{message:l}=U("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(l)}if(!Ow(i)){const{message:l}=U("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(l)}if(!Dw(c,s,i.method)){const{message:l}=U("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(l)}if(o&&!Cw(o,xi)){const{message:l}=U("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${xi.min} and ${xi.max}`);throw new Error(l)}}),x(this,"isValidRespond",async e=>{var n;if(!Ne(e)){const{message:o}=U("MISSING_OR_INVALID",`respond() params: ${e}`);throw new Error(o)}const{topic:i,response:s}=e;try{await this.isValidSessionTopic(i)}catch(o){throw(n=e==null?void 0:e.response)!=null&&n.id&&this.cleanupAfterResponse(e),o}if(!Rw(s)){const{message:o}=U("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}}),x(this,"isValidPing",async e=>{if(!Ne(e)){const{message:i}=U("MISSING_OR_INVALID",`ping() params: ${e}`);throw new Error(i)}const{topic:n}=e;await this.isValidSessionOrPairingTopic(n)}),x(this,"isValidEmit",async e=>{if(!Ne(e)){const{message:c}=U("MISSING_OR_INVALID",`emit() params: ${e}`);throw new Error(c)}const{topic:n,event:i,chainId:s}=e;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!Ca(o,s)){const{message:c}=U("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(c)}if(!Lw(i)){const{message:c}=U("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(c)}if(!Vw(o,s,i.name)){const{message:c}=U("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(c)}}),x(this,"isValidDisconnect",async e=>{if(!Ne(e)){const{message:i}=U("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw new Error(i)}const{topic:n}=e;await this.isValidSessionOrPairingTopic(n)}),x(this,"isValidAuthenticate",e=>{const{chains:n,uri:i,domain:s,nonce:o}=e;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!he(i,!1))throw new Error("uri is required parameter");if(!he(s,!1))throw new Error("domain is required parameter");if(!he(o,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(l=>Sn(l).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:c}=Sn(n[0]);if(c!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")}),x(this,"getVerifyContext",async e=>{const{attestationId:n,hash:i,encryptedId:s,metadata:o,transportType:c}=e,l={verified:{verifyUrl:o.verifyUrl||Yr,validation:"UNKNOWN",origin:o.url||""}};try{if(c===se.link_mode){const d=this.getAppLinkIfEnabled(o,c);return l.verified.validation=d&&new URL(d).origin===new URL(o.url).origin?"VALID":"INVALID",l}const u=await this.client.core.verify.resolve({attestationId:n,hash:i,encryptedId:s,verifyUrl:o.verifyUrl});u&&(l.verified.origin=u.origin,l.verified.isScam=u.isScam,l.verified.validation=u.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(u){this.client.logger.warn(u)}return this.client.logger.debug(`Verify context: ${JSON.stringify(l)}`),l}),x(this,"validateSessionProps",(e,n)=>{Object.values(e).forEach((i,s)=>{if(i==null){const{message:o}=U("MISSING_OR_INVALID",`${n} must contain an existing value for each key. Received: ${i} for key ${Object.keys(e)[s]}`);throw new Error(o)}})}),x(this,"getPendingAuthRequest",e=>{const n=this.client.auth.requests.get(e);return typeof n=="object"?n:void 0}),x(this,"addToRecentlyDeleted",(e,n)=>{if(this.recentlyDeletedMap.set(e,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(o)}}}),x(this,"checkRecentlyDeleted",e=>{const n=this.recentlyDeletedMap.get(e);if(n){const{message:i}=U("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${e}`);throw new Error(i)}}),x(this,"isLinkModeEnabled",(e,n)=>{var i,s,o,c,l,u,d,h,p;return!e||n!==se.link_mode?!1:((s=(i=this.client.metadata)==null?void 0:i.redirect)==null?void 0:s.linkMode)===!0&&((c=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:c.universal)!==void 0&&((u=(l=this.client.metadata)==null?void 0:l.redirect)==null?void 0:u.universal)!==""&&((d=e==null?void 0:e.redirect)==null?void 0:d.universal)!==void 0&&((h=e==null?void 0:e.redirect)==null?void 0:h.universal)!==""&&((p=e==null?void 0:e.redirect)==null?void 0:p.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(e.redirect.universal)&&typeof(K==null?void 0:K.Linking)<"u"}),x(this,"getAppLinkIfEnabled",(e,n)=>{var i;return this.isLinkModeEnabled(e,n)?(i=e==null?void 0:e.redirect)==null?void 0:i.universal:void 0}),x(this,"handleLinkModeMessage",({url:e})=>{if(!e||!e.includes("wc_ev")||!e.includes("topic"))return;const n=Go(e,"topic")||"",i=decodeURIComponent(Go(e,"wc_ev")||""),s=this.client.session.keys.includes(n);s&&this.client.session.update(n,{transportType:se.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:i,sessionExists:s})}),x(this,"registerLinkModeListeners",async()=>{var e;if(Ws()||Wt()&&(e=this.client.metadata.redirect)!=null&&e.linkMode){const n=K==null?void 0:K.Linking;if(typeof n<"u"){n.addEventListener("url",this.handleLinkModeMessage,this.client.name);const i=await n.getInitialURL();i&&setTimeout(()=>{this.handleLinkModeMessage({url:i})},50)}}}),x(this,"getTVFParams",(e,n,i)=>{var s,o,c;if(!((s=n.request)!=null&&s.method))return{};const l={correlationId:e,rpcMethods:[n.request.method],chainId:n.chainId};try{const u=this.extractTxHashesFromResult(n.request,i);l.txHashes=u,l.contractAddresses=this.isValidContractData(n.request.params)?[(c=(o=n.request.params)==null?void 0:o[0])==null?void 0:c.to]:[]}catch(u){this.client.logger.warn("Error getting TVF params",u)}return l}),x(this,"isValidContractData",e=>{var n;if(!e)return!1;try{const i=(e==null?void 0:e.data)||((n=e==null?void 0:e[0])==null?void 0:n.data);if(!i.startsWith("0x"))return!1;const s=i.slice(2);return/^[0-9a-fA-F]*$/.test(s)?s.length%2===0:!1}catch{}return!1}),x(this,"extractTxHashesFromResult",(e,n)=>{var i;try{if(!n)return[];const s=e.method,o=kv[s];if(s==="sui_signTransaction")return[rm(n.transactionBytes)];if(s==="near_signTransaction")return[ra(n)];if(s==="near_signTransactions")return n.map(l=>ra(l));if(s==="xrpl_signTransactionFor"||s==="xrpl_signTransaction")return[(i=n.tx_json)==null?void 0:i.hash];if(s==="polkadot_signTransaction")return[Jw({transaction:e.params.transactionPayload,signature:n.signature})];if(s==="algo_signTxn")return Ir(n)?n.map(l=>na(l)):[na(n)];if(s==="cosmos_signDirect")return[im(n)];if(typeof n=="string")return[n];const c=n[o.key];if(Ir(c))return s==="solana_signAllTransactions"?c.map(l=>tm(l)):c;if(typeof c=="string")return[c]}catch(s){this.client.logger.warn("Error extracting tx hashes from result",s)}return[]})}async processPendingMessageEvents(){try{const t=this.client.session.keys,e=this.client.core.relayer.messages.getWithoutAck(t);for(const[n,i]of Object.entries(e))for(const s of i)try{await this.onProviderMessageEvent({topic:n,message:s,publishedAt:Date.now()})}catch{this.client.logger.warn(`Error processing pending message event for topic: ${n}, message: ${s}`)}}catch(t){this.client.logger.warn("processPendingMessageEvents failed",t)}}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(le.message,t=>{this.onProviderMessageEvent(t)})}async onRelayMessage(t){const{topic:e,message:n,attestation:i,transportType:s}=t,{publicKey:o}=this.client.auth.authKeys.keys.includes(kn)?this.client.auth.authKeys.get(kn):{publicKey:void 0};try{const c=await this.client.core.crypto.decode(e,n,{receiverPublicKey:o,encoding:s===se.link_mode?jt:Me});Ss(c)?(this.client.core.history.set(e,c),await this.onRelayEventRequest({topic:e,payload:c,attestation:i,transportType:s,encryptedId:Ye(n)})):xs(c)?(await this.client.core.history.resolve(c),await this.onRelayEventResponse({topic:e,payload:c,transportType:s}),this.client.core.history.delete(e,c.id)):await this.onRelayEventUnknownPayload({topic:e,payload:c,transportType:s}),await this.client.core.relayer.messages.ack(e,n)}catch(c){this.client.logger.error(c)}}registerExpirerEvents(){this.client.core.expirer.on(Qe.expired,async t=>{const{topic:e,id:n}=gl(t.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,U("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,U("EXPIRED"),!0);e?this.client.session.keys.includes(e)&&(await this.deleteSession({topic:e,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:e})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(Qt.create,t=>this.onPairingCreated(t)),this.client.core.pairing.events.on(Qt.delete,t=>{this.addToRecentlyDeleted(t.topic,"pairing")})}isValidPairingTopic(t){if(!he(t,!1)){const{message:e}=U("MISSING_OR_INVALID",`pairing topic should be a string: ${t}`);throw new Error(e)}if(!this.client.core.pairing.pairings.keys.includes(t)){const{message:e}=U("NO_MATCHING_KEY",`pairing topic doesn't exist: ${t}`);throw new Error(e)}if(Ut(this.client.core.pairing.pairings.get(t).expiry)){const{message:e}=U("EXPIRED",`pairing topic: ${t}`);throw new Error(e)}}async isValidSessionTopic(t){if(!he(t,!1)){const{message:e}=U("MISSING_OR_INVALID",`session topic should be a string: ${t}`);throw new Error(e)}if(this.checkRecentlyDeleted(t),!this.client.session.keys.includes(t)){const{message:e}=U("NO_MATCHING_KEY",`session topic doesn't exist: ${t}`);throw new Error(e)}if(Ut(this.client.session.get(t).expiry)){await this.deleteSession({topic:t});const{message:e}=U("EXPIRED",`session topic: ${t}`);throw new Error(e)}if(!this.client.core.crypto.keychain.has(t)){const{message:e}=U("MISSING_OR_INVALID",`session topic does not exist in keychain: ${t}`);throw await this.deleteSession({topic:t}),new Error(e)}}async isValidSessionOrPairingTopic(t){if(this.checkRecentlyDeleted(t),this.client.session.keys.includes(t))await this.isValidSessionTopic(t);else if(this.client.core.pairing.pairings.keys.includes(t))this.isValidPairingTopic(t);else if(he(t,!1)){const{message:e}=U("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${t}`);throw new Error(e)}else{const{message:e}=U("MISSING_OR_INVALID",`session or pairing topic should be a string: ${t}`);throw new Error(e)}}async isValidProposalId(t){if(!Tw(t)){const{message:e}=U("MISSING_OR_INVALID",`proposal id should be a number: ${t}`);throw new Error(e)}if(!this.client.proposal.keys.includes(t)){const{message:e}=U("NO_MATCHING_KEY",`proposal id doesn't exist: ${t}`);throw new Error(e)}if(Ut(this.client.proposal.get(t).expiryTimestamp)){await this.deleteProposal(t);const{message:e}=U("EXPIRED",`proposal id: ${t}`);throw new Error(e)}}}class Zv extends hr{constructor(t,e){super(t,e,xv,ao),this.core=t,this.logger=e}}class Qv extends hr{constructor(t,e){super(t,e,Cv,ao),this.core=t,this.logger=e}}class Yv extends hr{constructor(t,e){super(t,e,Nv,ao,n=>n.id),this.core=t,this.logger=e}}class Xv extends hr{constructor(t,e){super(t,e,Bv,li,()=>kn),this.core=t,this.logger=e}}class eb extends hr{constructor(t,e){super(t,e,jv,li),this.core=t,this.logger=e}}class tb extends hr{constructor(t,e){super(t,e,zv,li,n=>n.id),this.core=t,this.logger=e}}var rb=Object.defineProperty,nb=(r,t,e)=>t in r?rb(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ci=(r,t,e)=>nb(r,typeof t!="symbol"?t+"":t,e);class ib{constructor(t,e){this.core=t,this.logger=e,Ci(this,"authKeys"),Ci(this,"pairingTopics"),Ci(this,"requests"),this.authKeys=new Xv(this.core,this.logger),this.pairingTopics=new eb(this.core,this.logger),this.requests=new tb(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}var sb=Object.defineProperty,ob=(r,t,e)=>t in r?sb(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Z=(r,t,e)=>ob(r,typeof t!="symbol"?t+"":t,e);class co extends jp{constructor(t){super(t),Z(this,"protocol",Lu),Z(this,"version",Du),Z(this,"name",Si.name),Z(this,"metadata"),Z(this,"core"),Z(this,"logger"),Z(this,"events",new lr.EventEmitter),Z(this,"engine"),Z(this,"session"),Z(this,"proposal"),Z(this,"pendingRequest"),Z(this,"auth"),Z(this,"signConfig"),Z(this,"on",(n,i)=>this.events.on(n,i)),Z(this,"once",(n,i)=>this.events.once(n,i)),Z(this,"off",(n,i)=>this.events.off(n,i)),Z(this,"removeListener",(n,i)=>this.events.removeListener(n,i)),Z(this,"removeAllListeners",n=>this.events.removeAllListeners(n)),Z(this,"connect",async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}}),Z(this,"pair",async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}}),Z(this,"approve",async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}}),Z(this,"reject",async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}}),Z(this,"update",async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}}),Z(this,"extend",async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}}),Z(this,"request",async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}}),Z(this,"respond",async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}}),Z(this,"ping",async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}}),Z(this,"emit",async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}}),Z(this,"disconnect",async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}}),Z(this,"find",n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}}),Z(this,"getPendingSessionRequests",()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}}),Z(this,"authenticate",async(n,i)=>{try{return await this.engine.authenticate(n,i)}catch(s){throw this.logger.error(s.message),s}}),Z(this,"formatAuthMessage",n=>{try{return this.engine.formatAuthMessage(n)}catch(i){throw this.logger.error(i.message),i}}),Z(this,"approveSessionAuthenticate",async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}}),Z(this,"rejectSessionAuthenticate",async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}}),this.name=(t==null?void 0:t.name)||Si.name,this.metadata=W_(t==null?void 0:t.metadata),this.signConfig=t==null?void 0:t.signConfig;const e=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:ei(Ks({level:(t==null?void 0:t.logger)||Si.logger}));this.core=(t==null?void 0:t.core)||new Sv(t),this.logger=Ce(e,this.name),this.session=new Qv(this.core,this.logger),this.proposal=new Zv(this.core,this.logger),this.pendingRequest=new Yv(this.core,this.logger),this.engine=new Jv(this),this.auth=new ib(this.core,this.logger)}static async init(t){const e=new co(t);return await e.initialize(),e}get context(){return Ke(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success")}catch(t){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(t.message),t}}}const ab=co,cb="08c4b07e3ad25f1a27c14a4e8cecb6f0",xI="eip155";async function lb(r){const{account:t,chainId:e,params:[n]}=r;if(!t.sendRawTransaction)throw new Error("The current account does not support sending raw transactions");return(await t.sendRawTransaction({chainId:e,rawTransaction:n})).transactionHash}function ui(r,t){if(mo(r.address)!==mo(t))throw new Error(`Failed to validate account address (${r.address}), differs from ${t}`)}function CI(r){const t=r.split(":"),e=Number.parseInt(t[1]??"0");if(t.length!==2||t[0]!=="eip155"||e===0||!e)throw new Error(`Invalid chainId ${r}, should have the format 'eip155:1'`);return e}async function ub(r){const{account:t,chainId:e,thirdwebClient:n,params:[i]}=r;i.from!==void 0&&ui(t,i.from);const s=Bi({chain:ge(e),client:n,data:i.data,gas:i.gas?Ve(i.gas):void 0,gasPrice:i.gasPrice?Ve(i.gasPrice):void 0,to:i.to,value:i.value?Ve(i.value):void 0});return(await Tc({account:t,transaction:s})).transactionHash}async function dc(r){const{account:t,params:e}=r;return ui(t,e[1]),t.signMessage({message:{raw:e[0]}})}async function db(r){const{account:t,params:[e]}=r;if(!t.signTransaction)throw new Error("The current account does not support signing transactions");return e.from!==void 0&&ui(t,e.from),t.signTransaction({data:e.data,gas:e.gas?Ve(e.gas):void 0,gasPrice:e.gasPrice?Ve(e.gasPrice):void 0,nonce:e.nonce?ir(e.nonce):void 0,to:e.to,value:e.value?Ve(e.value):void 0})}async function hc(r){const{account:t,params:e}=r;return ui(t,e[0]),t.signTypedData(typeof e[1]=="string"?JSON.parse(e[1]):e[1])}async function Su(r){var n;const{wallet:t,params:e}=r;return((n=t.getChain())==null?void 0:n.id)===ir(e[0].chainId)||await t.switchChain(Ed(ir(e[0].chainId))),"0x1"}const $I=Object.freeze(Object.defineProperty({__proto__:null,handleSwitchChain:Su},Symbol.toStringTag,{value:"Module"})),kI="/sdk/2022-08-12/embedded-wallet",$i=r=>`thirdwebEwsWalletUserId-${r}`,hb="walletToken",ki=r=>`${hb}-${r}`,pc=r=>`passkey-credential-id-${r}`,pb="a",Ni=(r,t)=>`${pb}-${r}-${t}`,_c=r=>`walletConnectSessions-${r}`,fc=r=>`thirdweb_guest_session_id_${r}`,mc=new Map;class lo{constructor({storage:t,clientId:e,ecosystem:n}){Object.defineProperty(this,"key",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"storage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.storage=t,this.key=_b(e,n==null?void 0:n.id),this.ecosystem=n}async getItem(t){return this.storage?this.storage.getItem(t):mc.get(t)??null}async setItem(t,e){if(this.storage)return this.storage.setItem(t,e);mc.set(t,e)}async removeItem(t){const e=await this.getItem(t);return this.storage&&e?(this.storage.removeItem(t),!0):!1}async getWalletConnectSessions(){return this.getItem(_c(this.key))}async saveWalletConnectSessions(t){await this.setItem(_c(this.key),t)}async savePasskeyCredentialId(t){await this.setItem(pc(this.key),t)}async getPasskeyCredentialId(){return this.getItem(pc(this.key))}async saveAuthCookie(t){await this.setItem(ki(this.key),t)}async getAuthCookie(){return this.getItem(ki(this.key))}async removeAuthCookie(){return this.removeItem(ki(this.key))}async saveDeviceShare(t,e){await this.saveWalletUserId(e),await this.setItem(Ni(this.key,e),t)}async getDeviceShare(){const t=await this.getWalletUserId();return t?this.getItem(Ni(this.key,t)):null}async removeDeviceShare(){const t=await this.getWalletUserId();return t?this.removeItem(Ni(this.key,t)):!1}async getWalletUserId(){return this.getItem($i(this.key))}async saveWalletUserId(t){await this.setItem($i(this.key),t)}async removeWalletUserId(){return this.removeItem($i(this.key))}async getGuestSessionId(){return this.getItem(fc(this.key))}async saveGuestSessionId(t){await this.setItem(fc(this.key),t)}}const _b=(r,t)=>`${r}${t?`-${t}`:""}`;let mt;async function xu(){if(!mt)return[];const r=await mt.getWalletConnectSessions();return JSON.parse(r??"[]")}function fb(r){mt||(mt=new lo({clientId:r.clientId,storage:null}))}async function NI(r){if(!mt)return;const t=await mt.getWalletConnectSessions(),e=JSON.parse(t??"[]");e.push(r),await mt.saveWalletConnectSessions(we(e))}async function mb(r){if(!mt)return;const t=await mt.getWalletConnectSessions(),n=JSON.parse(t??"[]").filter(i=>i.topic!==r.topic);await mt.saveWalletConnectSessions(we(n))}let Ui=new WeakMap;const yb={eth_sendRawTransaction:lb,eth_sendTransaction:ub,eth_sign:dc,eth_signTransaction:db,eth_signTypedData:hc,eth_signTypedData_v4:hc,personal_sign:dc,wallet_addEthereumChain:r=>{throw new Error("Unsupported request method: wallet_addEthereumChain")},wallet_switchEthereumChain:Su};async function wb(r){var d,h,p,_;const{wallet:t,requestHandlers:e,onConnect:n,onDisconnect:i,client:s}=r,o=r.chains&&r.chains.length>10?(console.warn("WalletConnect: Can specify no more than 10 chains, truncating to the first 10 provided chains..."),r.chains.slice(0,10)):r.chains;if(Ui.has(s))return Ui.get(s);fb({clientId:r.client.clientId});const c=jn(),l=await ab.init({metadata:{description:((d=r.appMetadata)==null?void 0:d.description)??c.description,icons:[((h=r.appMetadata)==null?void 0:h.logoUrl)??c.logoUrl],name:((p=r.appMetadata)==null?void 0:p.name)??c.name,url:((_=r.appMetadata)==null?void 0:_.url)??c.url},projectId:r.projectId??cb});l.on("session_proposal",async f=>{const{onSessionProposal:m}=await a(async()=>{const{onSessionProposal:y}=await import("./session-proposal-BhxOm69W.js");return{onSessionProposal:y}},__vite__mapDeps([19,1,2,3,4,5,6,7]));await m({chains:o,event:f,onConnect:n,wallet:t,walletConnectClient:l}).catch(y=>{if(r.onError)r.onError(y);else throw y})}),l.on("session_request",async f=>{const{fulfillRequest:m}=await a(async()=>{const{fulfillRequest:y}=await import("./session-request-B2kobJ26.js");return{fulfillRequest:y}},__vite__mapDeps([20,1,2,3,4,5,6,7]));await m({event:f,handlers:e,thirdwebClient:s,wallet:t,walletConnectClient:l}).catch(y=>{if(r.onError)r.onError(y);else throw y})}),l.on("session_event",async f=>{}),l.on("session_ping",f=>{}),l.on("session_delete",async f=>{await Cu({session:{topic:f.topic},walletConnectClient:l}).catch(m=>{if(r.onError)r.onError(m);else throw m})});const u=l.disconnect;return l.disconnect=async f=>{const m=await u(f).catch(()=>{});return i&&vb({onDisconnect:i,topic:f.topic}),m},Ui.set(r.client,l),l}function gb(r){const{uri:t,walletConnectClient:e}=r;e.core.pairing.pair({uri:t})}async function Eb(){return xu()}async function Cu(r){mb(r.session);try{await r.walletConnectClient.disconnect({reason:{code:6e3,message:"Disconnected"},topic:r.session.topic})}catch{}}async function vb(r){const{topic:t,onDisconnect:e}=r,n=await xu();e(n.find(i=>i.topic===t)??{topic:t})}function bb(r){return[ot("inApp",{executionMode:r==null?void 0:r.executionMode}),ot(Cc),ot(_t,{appMetadata:r==null?void 0:r.appMetadata,chains:r==null?void 0:r.chains}),ot(rh),ot("io.rabby"),ot(nh),ot("com.okex.wallet")]}function Ib(r,t){const e=new Set;let n=r();const i=()=>{for(const o of e)o()},s=o=>{n=o,i()};for(const o of t)o.subscribe(()=>{s(r())});return{getValue(){return n},subscribe(o){return e.add(o),()=>{e.delete(o)}}}}function Ln(r,t,e=!0){e&&r();const n=t.map(i=>i.subscribe(()=>{r()}));return()=>{for(const i of n)i()}}const un="tw:connected-wallet-params";async function UI(r,t,e){if(!Tb(e))throw new Error("given params are not stringifiable");const n=await r.getItem(un);let i;if(n){try{i=JSON.parse(n)}catch{i={}}i[t]=e}else i={[t]:e};r.setItem(un,we(i))}async function Ab(r,t){const e=await r.getItem(un);let n;if(e){try{n=JSON.parse(e)}catch{n={}}delete n[t],r.setItem(un,we(n))}}async function qI(r,t){const e=await r.getItem(un);if(!e)return null;try{const n=JSON.parse(e);return n!=null&&n[t]?n[t]:null}catch{return null}}function Tb(r){try{return we(r),!0}catch{return!1}}function Pb(r){let t;return()=>(t||(t=r()),t)}function Ob(r={}){return Rc({filters:r,signature:"event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason)"})}function Rb(r={}){return Rc({filters:r,signature:"event PostOpRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason)"})}function Lb(r){const{receipt:t}=r,e={...t,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,contractAddress:t.contractAddress?t.contractAddress:null,cumulativeGasUsed:t.cumulativeGasUsed?BigInt(t.cumulativeGasUsed):null,effectiveGasPrice:t.effectiveGasPrice?BigInt(t.effectiveGasPrice):null,gasUsed:t.gasUsed?BigInt(t.gasUsed):null,logs:t.logs,status:t.status,to:t.to?t.to:null,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex,type:t.type};return t.blobGasPrice&&(e.blobGasPrice=BigInt(t.blobGasPrice)),t.blobGasUsed&&(e.blobGasUsed=BigInt(t.blobGasUsed)),{...r,actualGasCost:BigInt(r.actualGasCost),actualGasUsed:BigInt(r.actualGasUsed),nonce:BigInt(r.nonce),receipt:e,userOpHash:r.userOpHash}}const MI=()=>{const r=BigInt(Math.floor(Math.random()*4294967296)),t=BigInt(Math.floor(Math.random()*4294967296)),e=BigInt(Math.floor(Math.random()*4294967296)),n=BigInt(Math.floor(Math.random()*4294967296)),i=BigInt(Math.floor(Math.random()*4294967296)),s=BigInt(Math.floor(Math.random()*4294967296));return r<<BigInt(160)|t<<BigInt(128)|e<<BigInt(96)|n<<BigInt(64)|i<<BigInt(32)|s};function $u(r){return Object.fromEntries(Object.entries(r).map(([t,e])=>[t,e==null||Un(e)?e:Vs(e)]))}async function BI(r){return Ht({...r,operation:"eth_sendUserOperation",params:[$u(r.userOp),r.options.entrypointAddress??Dc]})}async function jI(r,t){const e=await Ht({...r,operation:"eth_estimateUserOperationGas",params:[$u(r.userOp),r.options.entrypointAddress??Dc,t??{}]});return{callGasLimit:Ve(e.callGasLimit)+Id,paymasterPostOpGasLimit:e.paymasterPostOpGasLimit!==void 0?Ve(e.paymasterPostOpGasLimit):void 0,paymasterVerificationGasLimit:e.paymasterVerificationGasLimit!==void 0?Ve(e.paymasterVerificationGasLimit):void 0,preVerificationGas:Ve(e.preVerificationGas),verificationGas:e.verificationGas!==void 0?Ve(e.verificationGas):void 0,verificationGasLimit:Ve(e.verificationGasLimit)}}async function zI(r){const t=await Ht({...r,operation:"thirdweb_getUserOperationGasPrice",params:[]});return{maxFeePerGas:Ve(t.maxFeePerGas),maxPriorityFeePerGas:Ve(t.maxPriorityFeePerGas)}}async function KI(r){var e,n;const t=await Db(r);if(t){if(t.success===!1){const s=(n=(e=vd({events:[Ob(),Rb()],logs:t.logs})[0])==null?void 0:e.args)==null?void 0:n.revertReason;if(!s)throw new Error(`UserOp failed at txHash: ${t.receipt.transactionHash}`);const o=bd({data:s});throw new Error(`UserOp failed with reason: '${o.args.join(",")}' at txHash: ${t.receipt.transactionHash}`)}return t.receipt}}async function Db(r){const t=await Ht({operation:"eth_getUserOperationReceipt",options:r,params:[r.userOpHash]});if(t)return Lb(t)}async function FI(r){const t=await Ht({operation:"zk_paymasterData",options:r.options,params:[r.transaction]});return{paymaster:t.paymaster,paymasterInput:t.paymasterInput}}async function Vb(r){const t=await Ht({...r,operation:"tw_execute",params:[r.eoaAddress,r.wrappedCalls,r.signature,r.authorization]});if(!t.queueId)throw new Error(`Error executing 7702 transaction: ${we(t)}`);return{transactionId:t.queueId}}async function Sb(r){return{transactionHash:(await Ht({...r,operation:"tw_getTransactionHash",params:[r.transactionId]})).transactionHash}}async function WI(r){return{transactionHash:(await Ht({operation:"zk_broadcastTransaction",options:r.options,params:[{...r.transaction,signedTransaction:r.signedTransaction}]})).transactionHash}}async function Ht(r){const{options:t,operation:e,params:n}=r,i=t.bundlerUrl??Lc(t.chain),o=await dn(t.client)(i,{useAuthToken:!0,body:we({id:1,jsonrpc:"2.0",method:e,params:n}),headers:{"Content-Type":"application/json"},method:"POST"}),c=await o.json();if(!o.ok||c.error){let l=c.error||o.statusText;typeof l=="object"&&(l=we(l));const u=c.code||"UNKNOWN";throw new Error(`${e} error: ${l}
|
|
12
|
+
Approved: ${p.toString()}`))}),o.forEach(h=>{n||(Xt(i[h].methods,s[h].methods)?Xt(i[h].events,s[h].events)||(n=U("NON_CONFORMING_NAMESPACES",`${e} namespaces events don't satisfy namespace events for ${h}`)):n=U("NON_CONFORMING_NAMESPACES",`${e} namespaces methods don't satisfy namespace methods for ${h}`))}),n}function Sw(r){const t={};return Object.keys(r).forEach(e=>{var n;e.includes(":")?t[e]=r[e]:(n=r[e].chains)==null||n.forEach(i=>{t[i]={methods:r[e].methods,events:r[e].events}})}),t}function ka(r){return[...new Set(r.map(t=>t.includes(":")?t.split(":")[0]:t))]}function xw(r){const t={};return Object.keys(r).forEach(e=>{if(e.includes(":"))t[e]=r[e];else{const n=Sr(r[e].accounts);n==null||n.forEach(i=>{t[i]={accounts:r[e].accounts.filter(s=>s.includes(`${i}:`)),methods:r[e].methods,events:r[e].events}})}}),t}function Cw(r,t){return so(r,!1)&&r<=t.max&&r>=t.min}function Na(){const r=_n();return new Promise(t=>{switch(r){case He.browser:t($w());break;case He.reactNative:t(kw());break;case He.node:t(Nw());break;default:t(!0)}})}function $w(){return Lr()&&(navigator==null?void 0:navigator.onLine)}async function kw(){if(Wt()&&typeof K<"u"&&K!=null&&K.NetInfo){const r=await(K==null?void 0:K.NetInfo.fetch());return r==null?void 0:r.isConnected}return!0}function Nw(){return!0}function Uw(r){switch(_n()){case He.browser:qw(r);break;case He.reactNative:Mw(r);break}}function qw(r){!Wt()&&Lr()&&(window.addEventListener("online",()=>r(!0)),window.addEventListener("offline",()=>r(!1)))}function Mw(r){var t;Wt()&&typeof K<"u"&&K!=null&&K.NetInfo&&((t=K)==null||t.NetInfo.addEventListener(e=>r(e==null?void 0:e.isConnected)))}function Bw(){var r;return Lr()&&Ot.getDocument()?((r=Ot.getDocument())==null?void 0:r.visibilityState)==="visible":!0}const Ri={};class Nr{static get(t){return Ri[t]}static set(t,e){Ri[t]=e}static delete(t){delete Ri[t]}}function jw(r){const t=hn.decode(r);if(t.length<33)throw new Error("Too short to contain a public key");return t.slice(1,33)}function zw({publicKey:r,signature:t,payload:e}){var n;const i=ls(e.method),s=128|parseInt(((n=e.version)==null?void 0:n.toString())||"4"),o=Ww(e.address),c=e.era==="00"?new Uint8Array([0]):ls(e.era);if(c.length!==1&&c.length!==2)throw new Error("Invalid era length");const l=parseInt(e.nonce,16),u=new Uint8Array([l&255,l>>8&255]),d=BigInt(`0x${Fw(e.tip)}`),h=Gw(d),p=new Uint8Array([0,...r,o,...t,...c,...u,...h,...i]),_=Hw(p.length+1);return new Uint8Array([..._,s,...p])}function Kw(r){const t=ls(r),e=zd.blake2b(t,void 0,32);return"0x"+ee.from(e).toString("hex")}function ls(r){return new Uint8Array(r.replace(/^0x/,"").match(/.{1,2}/g).map(t=>parseInt(t,16)))}function Fw(r){return r.startsWith("0x")?r.slice(2):r}function Ww(r){const t=hn.decode(r)[0];return t===42?0:t===60?2:1}function Hw(r){if(r<64)return new Uint8Array([r<<2]);if(r<16384){const t=r<<2|1;return new Uint8Array([t&255,t>>8&255])}else if(r<1<<30){const t=r<<2|2;return new Uint8Array([t&255,t>>8&255,t>>16&255,t>>24&255])}else throw new Error("Compact encoding > 2^30 not supported")}function Gw(r){if(r<BigInt(1)<<BigInt(6))return new Uint8Array([Number(r<<BigInt(2))]);if(r<BigInt(1)<<BigInt(14)){const t=r<<BigInt(2)|BigInt(1);return new Uint8Array([Number(t&BigInt(255)),Number(t>>BigInt(8)&BigInt(255))])}else if(r<BigInt(1)<<BigInt(30)){const t=r<<BigInt(2)|BigInt(2);return new Uint8Array([Number(t&BigInt(255)),Number(t>>BigInt(8)&BigInt(255)),Number(t>>BigInt(16)&BigInt(255)),Number(t>>BigInt(24)&BigInt(255))])}else throw new Error("BigInt compact encoding not supported > 2^30")}function Jw(r){const t=Uint8Array.from(ee.from(r.signature,"hex")),e=jw(r.transaction.address),n=zw({publicKey:e,signature:t,payload:r.transaction}),i=ee.from(n).toString("hex");return Kw(i)}var Zw={};const pu="wc",_u=2,us="core",yt=`${pu}@2:${us}:`,Qw={logger:"error"},Yw={database:":memory:"},Xw="crypto",Ua="client_ed25519_seed",eg=q.ONE_DAY,tg="keychain",rg="0.3",ng="messages",ig="0.3",sg=q.SIX_HOURS,og="publisher",fu="irn",ag="error",mu="wss://relay.walletconnect.org",cg="relayer",le={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},lg="_subscription",Je={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},ug=.1,ds="2.21.8",se={link_mode:"link_mode",relay:"relay"},$n={inbound:"inbound",outbound:"outbound"},dg="0.3",hg="WALLETCONNECT_CLIENT_ID",qa="WALLETCONNECT_LINK_MODE_APPS",We={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},pg="subscription",_g="0.3",fg="pairing",mg="0.3",Ur={wc_pairingDelete:{req:{ttl:q.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:q.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:q.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:q.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:q.ONE_DAY,prompt:!1,tag:0},res:{ttl:q.ONE_DAY,prompt:!1,tag:0}}},Qt={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},nt={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},yg="history",wg="0.3",gg="expirer",Qe={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},Eg="0.3",vg="verify-api",bg="https://verify.walletconnect.com",yu="https://verify.walletconnect.org",Yr=yu,Ig=`${Yr}/v3`,Ag=[bg,yu],Tg="echo",Pg="https://echo.walletconnect.com",ht={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal",subscribing_to_pairing_topic:"subscribing_to_pairing_topic"},It={no_wss_connection:"no_wss_connection",no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_expired:"proposal_expired",proposal_listener_not_found:"proposal_listener_not_found"},kt={session_approve_started:"session_approve_started",proposal_not_expired:"proposal_not_expired",session_namespaces_validation_success:"session_namespaces_validation_success",create_session_topic:"create_session_topic",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},qr={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},Jt={authenticated_session_approve_started:"authenticated_session_approve_started",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve"},Mr={no_internet_connection:"no_internet_connection",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},Og=.1,Rg="event-client",Lg=86400,Dg="https://pulse.walletconnect.org/batch";function Vg(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var i=0;i<r.length;i++){var s=r.charAt(i),o=s.charCodeAt(0);if(e[o]!==255)throw new TypeError(s+" is ambiguous");e[o]=i}var c=r.length,l=r.charAt(0),u=Math.log(c)/Math.log(256),d=Math.log(256)/Math.log(c);function h(f){if(f instanceof Uint8Array||(ArrayBuffer.isView(f)?f=new Uint8Array(f.buffer,f.byteOffset,f.byteLength):Array.isArray(f)&&(f=Uint8Array.from(f))),!(f instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(f.length===0)return"";for(var m=0,y=0,b=0,R=f.length;b!==R&&f[b]===0;)b++,m++;for(var v=(R-b)*d+1>>>0,P=new Uint8Array(v);b!==R;){for(var T=f[b],g=0,D=v-1;(T!==0||g<y)&&D!==-1;D--,g++)T+=256*P[D]>>>0,P[D]=T%c>>>0,T=T/c>>>0;if(T!==0)throw new Error("Non-zero carry");y=g,b++}for(var L=v-y;L!==v&&P[L]===0;)L++;for(var w=l.repeat(m);L<v;++L)w+=r.charAt(P[L]);return w}function p(f){if(typeof f!="string")throw new TypeError("Expected String");if(f.length===0)return new Uint8Array;var m=0;if(f[m]!==" "){for(var y=0,b=0;f[m]===l;)y++,m++;for(var R=(f.length-m)*u+1>>>0,v=new Uint8Array(R);f[m];){var P=e[f.charCodeAt(m)];if(P===255)return;for(var T=0,g=R-1;(P!==0||T<b)&&g!==-1;g--,T++)P+=c*v[g]>>>0,v[g]=P%256>>>0,P=P/256>>>0;if(P!==0)throw new Error("Non-zero carry");b=T,m++}if(f[m]!==" "){for(var D=R-b;D!==R&&v[D]===0;)D++;for(var L=new Uint8Array(y+(R-D)),w=y;D!==R;)L[w++]=v[D++];return L}}}function _(f){var m=p(f);if(m)return m;throw new Error(`Non-${t} character`)}return{encode:h,decodeUnsafe:p,decode:_}}var Sg=Vg,xg=Sg;const wu=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},Cg=r=>new TextEncoder().encode(r),$g=r=>new TextDecoder().decode(r);class kg{constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}}class Ng{constructor(t,e,n){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return gu(this,t)}}class Ug{constructor(t){this.decoders=t}or(t){return gu(this,t)}decode(t){const e=t[0],n=this.decoders[e];if(n)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const gu=(r,t)=>new Ug({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}});class qg{constructor(t,e,n,i){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=i,this.encoder=new kg(t,e,n),this.decoder=new Ng(t,e,i)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}}const ci=({name:r,prefix:t,encode:e,decode:n})=>new qg(r,t,e,n),wn=({prefix:r,name:t,alphabet:e})=>{const{encode:n,decode:i}=xg(e,t);return ci({prefix:r,name:t,encode:n,decode:s=>wu(i(s))})},Mg=(r,t,e,n)=>{const i={};for(let d=0;d<t.length;++d)i[t[d]]=d;let s=r.length;for(;r[s-1]==="=";)--s;const o=new Uint8Array(s*e/8|0);let c=0,l=0,u=0;for(let d=0;d<s;++d){const h=i[r[d]];if(h===void 0)throw new SyntaxError(`Non-${n} character`);l=l<<e|h,c+=e,c>=8&&(c-=8,o[u++]=255&l>>c)}if(c>=e||255&l<<8-c)throw new SyntaxError("Unexpected end of data");return o},Bg=(r,t,e)=>{const n=t[t.length-1]==="=",i=(1<<e)-1;let s="",o=0,c=0;for(let l=0;l<r.length;++l)for(c=c<<8|r[l],o+=8;o>e;)o-=e,s+=t[i&c>>o];if(o&&(s+=t[i&c<<e-o]),n)for(;s.length*e&7;)s+="=";return s},Ae=({name:r,prefix:t,bitsPerChar:e,alphabet:n})=>ci({prefix:t,name:r,encode(i){return Bg(i,n,e)},decode(i){return Mg(i,n,e,r)}}),jg=ci({prefix:"\0",name:"identity",encode:r=>$g(r),decode:r=>Cg(r)});var zg=Object.freeze({__proto__:null,identity:jg});const Kg=Ae({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Fg=Object.freeze({__proto__:null,base2:Kg});const Wg=Ae({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Hg=Object.freeze({__proto__:null,base8:Wg});const Gg=wn({prefix:"9",name:"base10",alphabet:"0123456789"});var Jg=Object.freeze({__proto__:null,base10:Gg});const Zg=Ae({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Qg=Ae({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Yg=Object.freeze({__proto__:null,base16:Zg,base16upper:Qg});const Xg=Ae({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),eE=Ae({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),tE=Ae({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),rE=Ae({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),nE=Ae({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),iE=Ae({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),sE=Ae({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),oE=Ae({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),aE=Ae({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var cE=Object.freeze({__proto__:null,base32:Xg,base32upper:eE,base32pad:tE,base32padupper:rE,base32hex:nE,base32hexupper:iE,base32hexpad:sE,base32hexpadupper:oE,base32z:aE});const lE=wn({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),uE=wn({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var dE=Object.freeze({__proto__:null,base36:lE,base36upper:uE});const hE=wn({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),pE=wn({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var _E=Object.freeze({__proto__:null,base58btc:hE,base58flickr:pE});const fE=Ae({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),mE=Ae({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),yE=Ae({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),wE=Ae({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var gE=Object.freeze({__proto__:null,base64:fE,base64pad:mE,base64url:yE,base64urlpad:wE});const Eu=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),EE=Eu.reduce((r,t,e)=>(r[e]=t,r),[]),vE=Eu.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function bE(r){return r.reduce((t,e)=>(t+=EE[e],t),"")}function IE(r){const t=[];for(const e of r){const n=vE[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}const AE=ci({prefix:"🚀",name:"base256emoji",encode:bE,decode:IE});var TE=Object.freeze({__proto__:null,base256emoji:AE}),PE=vu,Ma=128,OE=-128,RE=Math.pow(2,31);function vu(r,t,e){t=t||[],e=e||0;for(var n=e;r>=RE;)t[e++]=r&255|Ma,r/=128;for(;r&OE;)t[e++]=r&255|Ma,r>>>=7;return t[e]=r|0,vu.bytes=e-n+1,t}var LE=hs,DE=128,Ba=127;function hs(r,n){var e=0,n=n||0,i=0,s=n,o,c=r.length;do{if(s>=c)throw hs.bytes=0,new RangeError("Could not decode varint");o=r[s++],e+=i<28?(o&Ba)<<i:(o&Ba)*Math.pow(2,i),i+=7}while(o>=DE);return hs.bytes=s-n,e}var VE=Math.pow(2,7),SE=Math.pow(2,14),xE=Math.pow(2,21),CE=Math.pow(2,28),$E=Math.pow(2,35),kE=Math.pow(2,42),NE=Math.pow(2,49),UE=Math.pow(2,56),qE=Math.pow(2,63),ME=function(r){return r<VE?1:r<SE?2:r<xE?3:r<CE?4:r<$E?5:r<kE?6:r<NE?7:r<UE?8:r<qE?9:10},BE={encode:PE,decode:LE,encodingLength:ME},bu=BE;const ja=(r,t,e=0)=>(bu.encode(r,t,e),t),za=r=>bu.encodingLength(r),ps=(r,t)=>{const e=t.byteLength,n=za(r),i=n+za(e),s=new Uint8Array(i+e);return ja(r,s,0),ja(e,s,n),s.set(t,i),new jE(r,e,t,s)};class jE{constructor(t,e,n,i){this.code=t,this.size=e,this.digest=n,this.bytes=i}}const Iu=({name:r,code:t,encode:e})=>new zE(r,t,e);class zE{constructor(t,e,n){this.name=t,this.code=e,this.encode=n}digest(t){if(t instanceof Uint8Array){const e=this.encode(t);return e instanceof Uint8Array?ps(this.code,e):e.then(n=>ps(this.code,n))}else throw Error("Unknown type, must be binary type")}}const Au=r=>async t=>new Uint8Array(await crypto.subtle.digest(r,t)),KE=Iu({name:"sha2-256",code:18,encode:Au("SHA-256")}),FE=Iu({name:"sha2-512",code:19,encode:Au("SHA-512")});var WE=Object.freeze({__proto__:null,sha256:KE,sha512:FE});const Tu=0,HE="identity",Pu=wu,GE=r=>ps(Tu,Pu(r)),JE={code:Tu,name:HE,encode:Pu,digest:GE};var ZE=Object.freeze({__proto__:null,identity:JE});new TextEncoder,new TextDecoder;const Ka={...zg,...Fg,...Hg,...Jg,...Yg,...cE,...dE,..._E,...gE,...TE};({...WE,...ZE});function Ou(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function QE(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Ou(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Ru(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}const Fa=Ru("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Li=Ru("ascii","a",r=>{let t="a";for(let e=0;e<r.length;e++)t+=String.fromCharCode(r[e]);return t},r=>{r=r.substring(1);const t=QE(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),YE={utf8:Fa,"utf-8":Fa,hex:Ka.base16,latin1:Li,ascii:Li,binary:Li,...Ka};function XE(r,t="utf8"){const e=YE[t];if(!e)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Ou(globalThis.Buffer.from(r,"utf-8")):e.decoder.decode(`${e.prefix}${r}`)}var e0=Object.defineProperty,t0=(r,t,e)=>t in r?e0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ut=(r,t,e)=>t0(r,typeof t!="symbol"?t+"":t,e);class r0{constructor(t,e){this.core=t,this.logger=e,ut(this,"keychain",new Map),ut(this,"name",tg),ut(this,"version",rg),ut(this,"initialized",!1),ut(this,"storagePrefix",yt),ut(this,"init",async()=>{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}}),ut(this,"has",n=>(this.isInitialized(),this.keychain.has(n))),ut(this,"set",async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()}),ut(this,"get",n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:s}=U("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i}),ut(this,"del",async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()}),this.core=t,this.logger=Ce(e,this.name)}get context(){return Ke(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(t){await this.core.storage.setItem(this.storageKey,Qi(t))}async getKeyChain(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?Yi(t):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}}var n0=Object.defineProperty,i0=(r,t,e)=>t in r?n0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ve=(r,t,e)=>i0(r,typeof t!="symbol"?t+"":t,e);class s0{constructor(t,e,n){this.core=t,this.logger=e,ve(this,"name",Xw),ve(this,"keychain"),ve(this,"randomSessionIdentifier",cs()),ve(this,"initialized",!1),ve(this,"init",async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)}),ve(this,"hasKeys",i=>(this.isInitialized(),this.keychain.has(i))),ve(this,"getClientId",async()=>{this.isInitialized();const i=await this.getClientSeed(),s=wo(i);return Hd(s.publicKey)}),ve(this,"generateKeyPair",()=>{this.isInitialized();const i=Uy();return this.setPrivateKey(i.publicKey,i.privateKey)}),ve(this,"signJWT",async i=>{this.isInitialized();const s=await this.getClientSeed(),o=wo(s),c=this.randomSessionIdentifier;return await Gd(c,i,eg,o)}),ve(this,"generateSharedKey",(i,s,o)=>{this.isInitialized();const c=this.getPrivateKey(i),l=qy(c,s);return this.setSymKey(l,o)}),ve(this,"setSymKey",async(i,s)=>{this.isInitialized();const o=s||Cn(i);return await this.keychain.set(o,i),o}),ve(this,"deleteKeyPair",async i=>{this.isInitialized(),await this.keychain.del(i)}),ve(this,"deleteSymKey",async i=>{this.isInitialized(),await this.keychain.del(i)}),ve(this,"encode",async(i,s,o)=>{this.isInitialized();const c=lu(o),l=tn(s);if(Pa(c))return jy(l,o==null?void 0:o.encoding);if(Ta(c)){const p=c.senderPublicKey,_=c.receiverPublicKey;i=await this.generateSharedKey(p,_)}const u=this.getSymKey(i),{type:d,senderPublicKey:h}=c;return My({type:d,symKey:u,message:l,senderPublicKey:h,encoding:o==null?void 0:o.encoding})}),ve(this,"decode",async(i,s,o)=>{this.isInitialized();const c=Ky(s,o);if(Pa(c)){const l=zy(s,o==null?void 0:o.encoding);return qn(l)}if(Ta(c)){const l=c.receiverPublicKey,u=c.senderPublicKey;i=await this.generateSharedKey(l,u)}try{const l=this.getSymKey(i),u=By({symKey:l,encoded:s,encoding:o==null?void 0:o.encoding});return qn(u)}catch(l){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(l)}}),ve(this,"getPayloadType",(i,s=Me)=>{const o=cn({encoded:i,encoding:s});return ar(o.type)}),ve(this,"getPayloadSenderPublicKey",(i,s=Me)=>{const o=cn({encoded:i,encoding:s});return o.senderPublicKey?ze(o.senderPublicKey,xe):void 0}),this.core=t,this.logger=Ce(e,this.name),this.keychain=n||new r0(this.core,this.logger)}get context(){return Ke(this.logger)}async setPrivateKey(t,e){return await this.keychain.set(t,e),t}getPrivateKey(t){return this.keychain.get(t)}async getClientSeed(){let t="";try{t=this.keychain.get(Ua)}catch{t=cs(),await this.keychain.set(Ua,t)}return XE(t,"base16")}getSymKey(t){return this.keychain.get(t)}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}}var o0=Object.defineProperty,a0=Object.defineProperties,c0=Object.getOwnPropertyDescriptors,Wa=Object.getOwnPropertySymbols,l0=Object.prototype.hasOwnProperty,u0=Object.prototype.propertyIsEnumerable,_s=(r,t,e)=>t in r?o0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,d0=(r,t)=>{for(var e in t||(t={}))l0.call(t,e)&&_s(r,e,t[e]);if(Wa)for(var e of Wa(t))u0.call(t,e)&&_s(r,e,t[e]);return r},h0=(r,t)=>a0(r,c0(t)),Fe=(r,t,e)=>_s(r,typeof t!="symbol"?t+"":t,e);class p0 extends Vp{constructor(t,e){super(t,e),this.logger=t,this.core=e,Fe(this,"messages",new Map),Fe(this,"messagesWithoutClientAck",new Map),Fe(this,"name",ng),Fe(this,"version",ig),Fe(this,"initialized",!1),Fe(this,"storagePrefix",yt),Fe(this,"init",async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n);const i=await this.getRelayerMessagesWithoutClientAck();typeof i<"u"&&(this.messagesWithoutClientAck=i),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}}),Fe(this,"set",async(n,i,s)=>{this.isInitialized();const o=Ye(i);let c=this.messages.get(n);if(typeof c>"u"&&(c={}),typeof c[o]<"u")return o;if(c[o]=i,this.messages.set(n,c),s===$n.inbound){const l=this.messagesWithoutClientAck.get(n)||{};this.messagesWithoutClientAck.set(n,h0(d0({},l),{[o]:i}))}return await this.persist(),o}),Fe(this,"get",n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i}),Fe(this,"getWithoutAck",n=>{this.isInitialized();const i={};for(const s of n){const o=this.messagesWithoutClientAck.get(s)||{};i[s]=Object.values(o)}return i}),Fe(this,"has",(n,i)=>{this.isInitialized();const s=this.get(n),o=Ye(i);return typeof s[o]<"u"}),Fe(this,"ack",async(n,i)=>{this.isInitialized();const s=this.messagesWithoutClientAck.get(n);if(typeof s>"u")return;const o=Ye(i);delete s[o],Object.keys(s).length===0?this.messagesWithoutClientAck.delete(n):this.messagesWithoutClientAck.set(n,s),await this.persist()}),Fe(this,"del",async n=>{this.isInitialized(),this.messages.delete(n),this.messagesWithoutClientAck.delete(n),await this.persist()}),this.logger=Ce(t,this.name),this.core=e}get context(){return Ke(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get storageKeyWithoutClientAck(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name+"_withoutClientAck"}async setRelayerMessages(t){await this.core.storage.setItem(this.storageKey,Qi(t))}async setRelayerMessagesWithoutClientAck(t){await this.core.storage.setItem(this.storageKeyWithoutClientAck,Qi(t))}async getRelayerMessages(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?Yi(t):void 0}async getRelayerMessagesWithoutClientAck(){const t=await this.core.storage.getItem(this.storageKeyWithoutClientAck);return typeof t<"u"?Yi(t):void 0}async persist(){await this.setRelayerMessages(this.messages),await this.setRelayerMessagesWithoutClientAck(this.messagesWithoutClientAck)}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}}var _0=Object.defineProperty,f0=Object.defineProperties,m0=Object.getOwnPropertyDescriptors,Ha=Object.getOwnPropertySymbols,y0=Object.prototype.hasOwnProperty,w0=Object.prototype.propertyIsEnumerable,fs=(r,t,e)=>t in r?_0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,mr=(r,t)=>{for(var e in t||(t={}))y0.call(t,e)&&fs(r,e,t[e]);if(Ha)for(var e of Ha(t))w0.call(t,e)&&fs(r,e,t[e]);return r},Ga=(r,t)=>f0(r,m0(t)),Ze=(r,t,e)=>fs(r,typeof t!="symbol"?t+"":t,e);class g0 extends Sp{constructor(t,e){super(t,e),this.relayer=t,this.logger=e,Ze(this,"events",new lr.EventEmitter),Ze(this,"name",og),Ze(this,"queue",new Map),Ze(this,"publishTimeout",q.toMiliseconds(q.ONE_MINUTE)),Ze(this,"initialPublishTimeout",q.toMiliseconds(q.ONE_SECOND*15)),Ze(this,"needsTransportRestart",!1),Ze(this,"publish",async(n,i,s)=>{var o,c,l,u,d;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});const h=(s==null?void 0:s.ttl)||sg,p=(s==null?void 0:s.prompt)||!1,_=(s==null?void 0:s.tag)||0,f=(s==null?void 0:s.id)||Yt().toString(),m=Er(Zn().protocol),y={id:f,method:(s==null?void 0:s.publishMethod)||m.publish,params:mr({topic:n,message:i,ttl:h,prompt:p,tag:_,attestation:s==null?void 0:s.attestation},(s==null?void 0:s.tvf)&&{tvf:s.tvf})},b=`Failed to publish payload, please try again. id:${f} tag:${_}`;try{fe((o=y.params)==null?void 0:o.prompt)&&((c=y.params)==null||delete c.prompt),fe((l=y.params)==null?void 0:l.tag)&&((u=y.params)==null||delete u.tag);const R=new Promise(async v=>{const P=({id:g})=>{var D;((D=y.id)==null?void 0:D.toString())===g.toString()&&(this.removeRequestFromQueue(g),this.relayer.events.removeListener(le.publish,P),v())};this.relayer.events.on(le.publish,P);const T=ft(new Promise((g,D)=>{this.rpcPublish(y,s).then(g).catch(L=>{this.logger.warn(L,L==null?void 0:L.message),D(L)})}),this.initialPublishTimeout,`Failed initial publish, retrying.... id:${f} tag:${_}`);try{await T,this.events.removeListener(le.publish,P)}catch(g){this.queue.set(f,{request:y,opts:s,attempt:1}),this.logger.warn(g,g==null?void 0:g.message)}});this.logger.trace({type:"method",method:"publish",params:{id:f,topic:n,message:i,opts:s}}),await ft(R,this.publishTimeout,b)}catch(R){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(R),(d=s==null?void 0:s.internal)!=null&&d.throwOnFailedPublish)throw R}finally{this.queue.delete(f)}}),Ze(this,"publishCustom",async n=>{var i,s,o,c,l;this.logger.debug("Publishing custom payload"),this.logger.trace({type:"method",method:"publishCustom",params:n});const{payload:u,opts:d={}}=n,{attestation:h,tvf:p,publishMethod:_,prompt:f,tag:m,ttl:y=q.FIVE_MINUTES}=d,b=d.id||Yt().toString(),R=Er(Zn().protocol),v=_||R.publish,P={id:b,method:v,params:mr(Ga(mr({},u),{ttl:y,prompt:f,tag:m,attestation:h}),p)},T=`Failed to publish custom payload, please try again. id:${b} tag:${m}`;try{fe((i=P.params)==null?void 0:i.prompt)&&((s=P.params)==null||delete s.prompt),fe((o=P.params)==null?void 0:o.tag)&&((c=P.params)==null||delete c.tag);const g=new Promise(async D=>{const L=({id:E})=>{var I;((I=P.id)==null?void 0:I.toString())===E.toString()&&(this.removeRequestFromQueue(E),this.relayer.events.removeListener(le.publish,L),D())};this.relayer.events.on(le.publish,L);const w=ft(new Promise((E,I)=>{this.rpcPublish(P,d).then(E).catch(A=>{this.logger.warn(A,A==null?void 0:A.message),I(A)})}),this.initialPublishTimeout,`Failed initial custom payload publish, retrying.... method:${v} id:${b} tag:${m}`);try{await w,this.events.removeListener(le.publish,L)}catch(E){this.queue.set(b,{request:P,opts:d,attempt:1}),this.logger.warn(E,E==null?void 0:E.message)}});this.logger.trace({type:"method",method:"publish",params:{id:b,payload:u,opts:d}}),await ft(g,this.publishTimeout,T)}catch(g){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(g),(l=d==null?void 0:d.internal)!=null&&l.throwOnFailedPublish)throw g}finally{this.queue.delete(b)}}),Ze(this,"on",(n,i)=>{this.events.on(n,i)}),Ze(this,"once",(n,i)=>{this.events.once(n,i)}),Ze(this,"off",(n,i)=>{this.events.off(n,i)}),Ze(this,"removeListener",(n,i)=>{this.events.removeListener(n,i)}),this.relayer=t,this.logger=Ce(e,this.name),this.registerEventListeners()}get context(){return Ke(this.logger)}async rpcPublish(t,e){this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:t});const n=await this.relayer.request(t);return this.relayer.events.emit(le.publish,mr(mr({},t),e)),this.logger.debug("Successfully Published Payload"),n}removeRequestFromQueue(t){this.queue.delete(t)}checkQueue(){this.queue.forEach(async(t,e)=>{var n;const i=t.attempt+1;this.queue.set(e,Ga(mr({},t),{attempt:i})),this.logger.warn({},`Publisher: queue->publishing: ${t.request.id}, tag: ${(n=t.request.params)==null?void 0:n.tag}, attempt: ${i}`),await this.rpcPublish(t.request,t.opts),this.logger.warn({},`Publisher: queue->published: ${t.request.id}`)})}registerEventListeners(){this.relayer.core.heartbeat.on(Tr.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(le.connection_stalled);return}this.checkQueue()}),this.relayer.on(le.message_ack,t=>{this.removeRequestFromQueue(t.id.toString())})}}var E0=Object.defineProperty,v0=(r,t,e)=>t in r?E0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,yr=(r,t,e)=>v0(r,typeof t!="symbol"?t+"":t,e);class b0{constructor(){yr(this,"map",new Map),yr(this,"set",(t,e)=>{const n=this.get(t);this.exists(t,e)||this.map.set(t,[...n,e])}),yr(this,"get",t=>this.map.get(t)||[]),yr(this,"exists",(t,e)=>this.get(t).includes(e)),yr(this,"delete",(t,e)=>{if(typeof e>"u"){this.map.delete(t);return}if(!this.map.has(t))return;const n=this.get(t);if(!this.exists(t,e))return;const i=n.filter(s=>s!==e);if(!i.length){this.map.delete(t);return}this.map.set(t,i)}),yr(this,"clear",()=>{this.map.clear()})}get topics(){return Array.from(this.map.keys())}}var I0=Object.defineProperty,A0=Object.defineProperties,T0=Object.getOwnPropertyDescriptors,Ja=Object.getOwnPropertySymbols,P0=Object.prototype.hasOwnProperty,O0=Object.prototype.propertyIsEnumerable,ms=(r,t,e)=>t in r?I0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Br=(r,t)=>{for(var e in t||(t={}))P0.call(t,e)&&ms(r,e,t[e]);if(Ja)for(var e of Ja(t))O0.call(t,e)&&ms(r,e,t[e]);return r},Di=(r,t)=>A0(r,T0(t)),ne=(r,t,e)=>ms(r,typeof t!="symbol"?t+"":t,e);class R0 extends $p{constructor(t,e){super(t,e),this.relayer=t,this.logger=e,ne(this,"subscriptions",new Map),ne(this,"topicMap",new b0),ne(this,"events",new lr.EventEmitter),ne(this,"name",pg),ne(this,"version",_g),ne(this,"pending",new Map),ne(this,"cached",[]),ne(this,"initialized",!1),ne(this,"storagePrefix",yt),ne(this,"subscribeTimeout",q.toMiliseconds(q.ONE_MINUTE)),ne(this,"initialSubscribeTimeout",q.toMiliseconds(q.ONE_SECOND*15)),ne(this,"clientId"),ne(this,"batchSubscribeTopicsLimit",500),ne(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),await this.restore()),this.initialized=!0}),ne(this,"subscribe",async(n,i)=>{var s;this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const o=Zn(i),c={topic:n,relay:o,transportType:i==null?void 0:i.transportType};(s=i==null?void 0:i.internal)!=null&&s.skipSubscribe||this.pending.set(n,c);const l=await this.rpcSubscribe(n,o,i);return typeof l=="string"&&(this.onSubscribe(l,c),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),l}catch(o){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(o),o}}),ne(this,"unsubscribe",async(n,i)=>{this.isInitialized(),typeof(i==null?void 0:i.id)<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)}),ne(this,"isSubscribed",n=>new Promise(i=>{i(this.topicMap.topics.includes(n))})),ne(this,"isKnownTopic",n=>new Promise(i=>{i(this.topicMap.topics.includes(n)||this.pending.has(n)||this.cached.some(s=>s.topic===n))})),ne(this,"on",(n,i)=>{this.events.on(n,i)}),ne(this,"once",(n,i)=>{this.events.once(n,i)}),ne(this,"off",(n,i)=>{this.events.off(n,i)}),ne(this,"removeListener",(n,i)=>{this.events.removeListener(n,i)}),ne(this,"start",async()=>{await this.onConnect()}),ne(this,"stop",async()=>{await this.onDisconnect()}),ne(this,"restart",async()=>{await this.restore(),await this.onRestart()}),ne(this,"checkPending",async()=>{if(this.pending.size===0&&(!this.initialized||!this.relayer.connected))return;const n=[];this.pending.forEach(i=>{n.push(i)}),await this.batchSubscribe(n)}),ne(this,"registerEventListeners",()=>{this.relayer.core.heartbeat.on(Tr.pulse,async()=>{await this.checkPending()}),this.events.on(We.created,async n=>{const i=We.created;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,data:n}),await this.persist()}),this.events.on(We.deleted,async n=>{const i=We.deleted;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,data:n}),await this.persist()})}),this.relayer=t,this.logger=Ce(e,this.name),this.clientId=""}get context(){return Ke(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}get hasAnyTopics(){return this.topicMap.topics.length>0||this.pending.size>0||this.cached.length>0||this.subscriptions.size>0}hasSubscription(t,e){let n=!1;try{n=this.getSubscription(t).topic===e}catch{}return n}reset(){this.cached=[],this.initialized=!0}onDisable(){this.values.length>0&&(this.cached=this.values),this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(t,e){const n=this.topicMap.get(t);await Promise.all(n.map(async i=>await this.unsubscribeById(t,i,e)))}async unsubscribeById(t,e,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:e,opts:n}});try{const i=Zn(n);await this.restartToComplete({topic:t,id:e,relay:i}),await this.rpcUnsubscribe(t,e,i);const s=ae("USER_DISCONNECTED",`${this.name}, ${t}`);await this.onUnsubscribe(t,e,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:e,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(t,e,n){var i,s;const o=await this.getSubscriptionId(t);if((i=n==null?void 0:n.internal)!=null&&i.skipSubscribe)return o;(!n||(n==null?void 0:n.transportType)===se.relay)&&await this.restartToComplete({topic:t,id:t,relay:e});const c={method:Er(e.protocol).subscribe,params:{topic:t}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:c});const l=(s=n==null?void 0:n.internal)==null?void 0:s.throwOnFailedPublish;try{if((n==null?void 0:n.transportType)===se.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(c).catch(h=>this.logger.warn(h))},q.toMiliseconds(q.ONE_SECOND)),o;const u=new Promise(async h=>{const p=_=>{_.topic===t&&(this.events.removeListener(We.created,p),h(_.id))};this.events.on(We.created,p);try{const _=await ft(new Promise((f,m)=>{this.relayer.request(c).catch(y=>{this.logger.warn(y,y==null?void 0:y.message),m(y)}).then(f)}),this.initialSubscribeTimeout,`Subscribing to ${t} failed, please try again`);this.events.removeListener(We.created,p),h(_)}catch{}}),d=await ft(u,this.subscribeTimeout,`Subscribing to ${t} failed, please try again`);if(!d&&l)throw new Error(`Subscribing to ${t} failed, please try again`);return d?o:null}catch(u){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(le.connection_stalled),l)throw u}return null}async rpcBatchSubscribe(t){if(!t.length)return;const e=t[0].relay,n={method:Er(e.protocol).batchSubscribe,params:{topics:t.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{await await ft(new Promise(i=>{this.relayer.request(n).catch(s=>this.logger.warn(s)).then(i)}),this.subscribeTimeout,"rpcBatchSubscribe failed, please try again")}catch{this.relayer.events.emit(le.connection_stalled)}}async rpcBatchFetchMessages(t){if(!t.length)return;const e=t[0].relay,n={method:Er(e.protocol).batchFetchMessages,params:{topics:t.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await ft(new Promise((s,o)=>{this.relayer.request(n).catch(c=>{this.logger.warn(c),o(c)}).then(s)}),this.subscribeTimeout,"rpcBatchFetchMessages failed, please try again")}catch{this.relayer.events.emit(le.connection_stalled)}return i}rpcUnsubscribe(t,e,n){const i={method:Er(n.protocol).unsubscribe,params:{topic:t,id:e}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(t,e){this.setSubscription(t,Di(Br({},e),{id:t})),this.pending.delete(e.topic)}onBatchSubscribe(t){t.length&&t.forEach(e=>{this.setSubscription(e.id,Br({},e)),this.pending.delete(e.topic)})}async onUnsubscribe(t,e,n){this.events.removeAllListeners(e),this.hasSubscription(e,t)&&this.deleteSubscription(e,n),await this.relayer.messages.del(t)}async setRelayerSubscriptions(t){await this.relayer.core.storage.setItem(this.storageKey,t)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(t,e){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:t,subscription:e}),this.addSubscription(t,e)}addSubscription(t,e){this.subscriptions.set(t,Br({},e)),this.topicMap.set(e.topic,t),this.events.emit(We.created,e)}getSubscription(t){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:t});const e=this.subscriptions.get(t);if(!e){const{message:n}=U("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(n)}return e}deleteSubscription(t,e){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:t,reason:e});const n=this.getSubscription(t);this.subscriptions.delete(t),this.topicMap.delete(n.topic,t),this.events.emit(We.deleted,Di(Br({},n),{reason:e}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(We.sync)}async onRestart(){if(this.cached.length){const t=[...this.cached],e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let n=0;n<e;n++){const i=t.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(i)}}this.events.emit(We.resubscribed)}async restore(){try{const t=await this.getRelayerSubscriptions();if(typeof t>"u"||!t.length)return;if(this.subscriptions.size&&!t.every(e=>{var n;return e.topic===((n=this.subscriptions.get(e.id))==null?void 0:n.topic)})){const{message:e}=U("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(t){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(t)}}async batchSubscribe(t){t.length&&(await this.rpcBatchSubscribe(t),this.onBatchSubscribe(await Promise.all(t.map(async e=>Di(Br({},e),{id:await this.getSubscriptionId(e.topic)})))))}async batchFetchMessages(t){if(!t.length)return;this.logger.trace(`Fetching batch messages for ${t.length} subscriptions`);const e=await this.rpcBatchFetchMessages(t);e&&e.messages&&(await of(q.toMiliseconds(q.ONE_SECOND)),await this.relayer.handleBatchMessageEvents(e.messages))}async onConnect(){await this.restart(),this.reset()}onDisconnect(){this.onDisable()}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}async restartToComplete(t){!this.relayer.connected&&!this.relayer.connecting&&(this.cached.push(t),await this.relayer.transportOpen())}async getClientId(){return this.clientId||(this.clientId=await this.relayer.core.crypto.getClientId()),this.clientId}async getSubscriptionId(t){return Ye(t+await this.getClientId())}}var L0=Object.defineProperty,Za=Object.getOwnPropertySymbols,D0=Object.prototype.hasOwnProperty,V0=Object.prototype.propertyIsEnumerable,ys=(r,t,e)=>t in r?L0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Qa=(r,t)=>{for(var e in t||(t={}))D0.call(t,e)&&ys(r,e,t[e]);if(Za)for(var e of Za(t))V0.call(t,e)&&ys(r,e,t[e]);return r},X=(r,t,e)=>ys(r,typeof t!="symbol"?t+"":t,e);class S0 extends xp{constructor(t){super(t),X(this,"protocol","wc"),X(this,"version",2),X(this,"core"),X(this,"logger"),X(this,"events",new lr.EventEmitter),X(this,"provider"),X(this,"messages"),X(this,"subscriber"),X(this,"publisher"),X(this,"name",cg),X(this,"transportExplicitlyClosed",!1),X(this,"initialized",!1),X(this,"connectionAttemptInProgress",!1),X(this,"relayUrl"),X(this,"projectId"),X(this,"packageName"),X(this,"bundleId"),X(this,"hasExperiencedNetworkDisruption",!1),X(this,"pingTimeout"),X(this,"heartBeatTimeout",q.toMiliseconds(q.THIRTY_SECONDS+q.FIVE_SECONDS)),X(this,"reconnectTimeout"),X(this,"connectPromise"),X(this,"reconnectInProgress",!1),X(this,"requestsInFlight",[]),X(this,"connectTimeout",q.toMiliseconds(q.ONE_SECOND*15)),X(this,"request",async e=>{var n,i;this.logger.debug("Publishing Request Payload");const s=e.id||Yt().toString();await this.toEstablishConnection();try{this.logger.trace({id:s,method:e.method,topic:(n=e.params)==null?void 0:n.topic},"relayer.request - publishing...");const o=`${s}:${((i=e.params)==null?void 0:i.tag)||""}`;this.requestsInFlight.push(o);const c=await this.provider.request(e);return this.requestsInFlight=this.requestsInFlight.filter(l=>l!==o),c}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}}),X(this,"resetPingTimeout",()=>{Wn()&&(clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var e,n,i,s;try{this.logger.debug({},"pingTimeout: Connection stalled, terminating..."),(s=(i=(n=(e=this.provider)==null?void 0:e.connection)==null?void 0:n.socket)==null?void 0:i.terminate)==null||s.call(i)}catch(o){this.logger.warn(o,o==null?void 0:o.message)}},this.heartBeatTimeout))}),X(this,"onPayloadHandler",e=>{this.onProviderPayload(e),this.resetPingTimeout()}),X(this,"onConnectHandler",()=>{this.logger.warn({},"Relayer connected 🛜"),this.startPingTimeout(),this.events.emit(le.connect)}),X(this,"onDisconnectHandler",()=>{this.logger.warn({},"Relayer disconnected 🛑"),this.requestsInFlight=[],this.onProviderDisconnect()}),X(this,"onProviderErrorHandler",e=>{this.logger.fatal(`Fatal socket error: ${e.message}`),this.events.emit(le.error,e),this.logger.fatal("Fatal socket error received, closing transport"),this.transportClose()}),X(this,"registerProviderListeners",()=>{this.provider.on(Je.payload,this.onPayloadHandler),this.provider.on(Je.connect,this.onConnectHandler),this.provider.on(Je.disconnect,this.onDisconnectHandler),this.provider.on(Je.error,this.onProviderErrorHandler)}),this.core=t.core,this.logger=typeof t.logger<"u"&&typeof t.logger!="string"?Ce(t.logger,this.name):ei(Ks({level:t.logger||ag})),this.messages=new p0(this.logger,t.core),this.subscriber=new R0(this,this.logger),this.publisher=new g0(this,this.logger),this.projectId=t==null?void 0:t.projectId,this.relayUrl=(t==null?void 0:t.relayUrl)||mu,z_()?this.packageName=Ho():K_()&&(this.bundleId=Ho()),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.transportOpen().catch(t=>this.logger.warn(t,t==null?void 0:t.message))}get context(){return Ke(this.logger)}get connected(){var t,e,n;return((n=(e=(t=this.provider)==null?void 0:t.connection)==null?void 0:e.socket)==null?void 0:n.readyState)===1||!1}get connecting(){var t,e,n;return((n=(e=(t=this.provider)==null?void 0:t.connection)==null?void 0:e.socket)==null?void 0:n.readyState)===0||this.connectPromise!==void 0||!1}async publish(t,e,n){this.isInitialized(),await this.publisher.publish(t,e,n),await this.recordMessageEvent({topic:t,message:e,publishedAt:Date.now(),transportType:se.relay},$n.outbound)}async publishCustom(t){this.isInitialized(),await this.publisher.publishCustom(t)}async subscribe(t,e){var n,i,s;this.isInitialized(),(!(e!=null&&e.transportType)||(e==null?void 0:e.transportType)==="relay")&&await this.toEstablishConnection();const o=typeof((n=e==null?void 0:e.internal)==null?void 0:n.throwOnFailedPublish)>"u"?!0:(i=e==null?void 0:e.internal)==null?void 0:i.throwOnFailedPublish;let c=((s=this.subscriber.topicMap.get(t))==null?void 0:s[0])||"",l;const u=d=>{d.topic===t&&(this.subscriber.off(We.created,u),l())};return await Promise.all([new Promise(d=>{l=d,this.subscriber.on(We.created,u)}),new Promise(async(d,h)=>{c=await this.subscriber.subscribe(t,Qa({internal:{throwOnFailedPublish:o}},e)).catch(p=>{o&&h(p)})||c,d()})]),c}async unsubscribe(t,e){this.isInitialized(),await this.subscriber.unsubscribe(t,e)}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}off(t,e){this.events.off(t,e)}removeListener(t,e){this.events.removeListener(t,e)}async transportDisconnect(){this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await ft(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(t){if(!this.subscriber.hasAnyTopics){this.logger.info("Starting WS connection skipped because the client has no topics to work with.");return}if(this.connectPromise?(this.logger.debug({},"Waiting for existing connection attempt to resolve..."),await this.connectPromise,this.logger.debug({},"Existing connection attempt resolved")):(this.connectPromise=new Promise(async(e,n)=>{await this.connect(t).then(e).catch(n).finally(()=>{this.connectPromise=void 0})}),await this.connectPromise),!this.connected)throw new Error(`Couldn't establish socket connection to the relay server: ${this.relayUrl}`)}async restartTransport(t){this.logger.debug({},"Restarting transport..."),!this.connectionAttemptInProgress&&(this.relayUrl=t||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await Na())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(t){if((t==null?void 0:t.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const e=t.sort((n,i)=>n.publishedAt-i.publishedAt);this.logger.debug(`Batch of ${e.length} message events sorted`);for(const n of e)try{await this.onMessageEvent(n)}catch(i){this.logger.warn(i,"Error while processing batch message event: "+(i==null?void 0:i.message))}this.logger.trace(`Batch of ${e.length} message events processed`)}async onLinkMessageEvent(t,e){const{topic:n}=t;if(!e.sessionExists){const i=_e(q.FIVE_MINUTES),s={topic:n,expiry:i,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,s)}this.events.emit(le.message,t),await this.recordMessageEvent(t,$n.inbound)}async connect(t){await this.confirmOnlineStateOrThrow(),t&&t!==this.relayUrl&&(this.relayUrl=t,await this.transportDisconnect()),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;let e=1;for(;e<6;){try{if(this.transportExplicitlyClosed)break;this.logger.debug({},`Connecting to ${this.relayUrl}, attempt: ${e}...`),await this.createProvider(),await new Promise(async(n,i)=>{const s=()=>{i(new Error("Connection interrupted while trying to connect"))};this.provider.once(Je.disconnect,s),await ft(new Promise((o,c)=>{this.provider.connect().then(o).catch(c)}),this.connectTimeout,`Socket stalled when trying to connect to ${this.relayUrl}`).catch(o=>{i(o)}).finally(()=>{this.provider.off(Je.disconnect,s),clearTimeout(this.reconnectTimeout)}),await new Promise(async(o,c)=>{const l=()=>{i(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(Je.disconnect,l),await this.subscriber.start().then(o).catch(c).finally(()=>{this.provider.off(Je.disconnect,l)})}),this.hasExperiencedNetworkDisruption=!1,n()})}catch(n){await this.subscriber.stop();const i=n;this.logger.warn({},i.message),this.hasExperiencedNetworkDisruption=!0}finally{this.connectionAttemptInProgress=!1}if(this.connected){this.logger.debug({},`Connected to ${this.relayUrl} successfully on attempt: ${e}`);break}await new Promise(n=>setTimeout(n,q.toMiliseconds(e*1))),e++}}startPingTimeout(){var t,e,n,i,s;if(Wn())try{(e=(t=this.provider)==null?void 0:t.connection)!=null&&e.socket&&((s=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||s.on("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o,o==null?void 0:o.message)}}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const t=await this.core.crypto.signJWT(this.relayUrl);this.provider=new Fd(new Wd(J_({sdkVersion:ds,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:t,useOnCloseEvent:!0,bundleId:this.bundleId,packageName:this.packageName}))),this.registerProviderListeners()}async recordMessageEvent(t,e){const{topic:n,message:i}=t;await this.messages.set(n,i,e)}async shouldIgnoreMessageEvent(t){const{topic:e,message:n}=t;if(!n||n.length===0)return this.logger.warn(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isKnownTopic(e))return this.logger.warn(`Ignoring message for unknown topic ${e}`),!0;const i=this.messages.has(e,n);return i&&this.logger.warn(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(t){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:t}),Ss(t)){if(!t.method.endsWith(lg))return;const e=t.params,{topic:n,message:i,publishedAt:s,attestation:o}=e.data,c={topic:n,message:i,publishedAt:s,transportType:se.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(Qa({type:"event",event:e.id},c)),this.events.emit(e.id,c),await this.acknowledgePayload(t),await this.onMessageEvent(c)}else xs(t)&&this.events.emit(le.message_ack,t)}async onMessageEvent(t){await this.shouldIgnoreMessageEvent(t)||(await this.recordMessageEvent(t,$n.inbound),this.events.emit(le.message,t))}async acknowledgePayload(t){const e=Mn(t.id,!0);await this.provider.connection.send(e)}unregisterProviderListeners(){this.provider.off(Je.payload,this.onPayloadHandler),this.provider.off(Je.connect,this.onConnectHandler),this.provider.off(Je.disconnect,this.onDisconnectHandler),this.provider.off(Je.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let t=await Na();Uw(async e=>{t!==e&&(t=e,e?await this.transportOpen().catch(n=>this.logger.error(n,n==null?void 0:n.message)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))}),this.core.heartbeat.on(Tr.pulse,async()=>{if(!this.transportExplicitlyClosed&&!this.connected&&Bw())try{await this.confirmOnlineStateOrThrow(),await this.transportOpen()}catch(e){this.logger.warn(e,e==null?void 0:e.message)}})}async onProviderDisconnect(){clearTimeout(this.pingTimeout),this.events.emit(le.disconnect),this.connectionAttemptInProgress=!1,!this.reconnectInProgress&&(this.reconnectInProgress=!0,await this.subscriber.stop(),this.subscriber.hasAnyTopics&&(this.transportExplicitlyClosed||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(t=>this.logger.error(t,t==null?void 0:t.message)),this.reconnectTimeout=void 0,this.reconnectInProgress=!1},q.toMiliseconds(ug)))))}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectPromise){await this.connectPromise;return}await this.connect()}}}function x0(r,t){return r===t||Number.isNaN(r)&&Number.isNaN(t)}function Ya(r){return Object.getOwnPropertySymbols(r).filter(t=>Object.prototype.propertyIsEnumerable.call(r,t))}function Xa(r){return r==null?r===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(r)}const C0="[object RegExp]",$0="[object String]",k0="[object Number]",N0="[object Boolean]",ec="[object Arguments]",U0="[object Symbol]",q0="[object Date]",M0="[object Map]",B0="[object Set]",j0="[object Array]",z0="[object Function]",K0="[object ArrayBuffer]",Vi="[object Object]",F0="[object Error]",W0="[object DataView]",H0="[object Uint8Array]",G0="[object Uint8ClampedArray]",J0="[object Uint16Array]",Z0="[object Uint32Array]",Q0="[object BigUint64Array]",Y0="[object Int8Array]",X0="[object Int16Array]",ev="[object Int32Array]",tv="[object BigInt64Array]",rv="[object Float32Array]",nv="[object Float64Array]";function iv(){}function tc(r){if(!r||typeof r!="object")return!1;const t=Object.getPrototypeOf(r);return t===null||t===Object.prototype||Object.getPrototypeOf(t)===null?Object.prototype.toString.call(r)==="[object Object]":!1}function sv(r,t,e){return Wr(r,t,void 0,void 0,void 0,void 0,e)}function Wr(r,t,e,n,i,s,o){const c=o(r,t,e,n,i,s);if(c!==void 0)return c;if(typeof r==typeof t)switch(typeof r){case"bigint":case"string":case"boolean":case"symbol":case"undefined":return r===t;case"number":return r===t||Object.is(r,t);case"function":return r===t;case"object":return Xr(r,t,s,o)}return Xr(r,t,s,o)}function Xr(r,t,e,n){if(Object.is(r,t))return!0;let i=Xa(r),s=Xa(t);if(i===ec&&(i=Vi),s===ec&&(s=Vi),i!==s)return!1;switch(i){case $0:return r.toString()===t.toString();case k0:{const l=r.valueOf(),u=t.valueOf();return x0(l,u)}case N0:case q0:case U0:return Object.is(r.valueOf(),t.valueOf());case C0:return r.source===t.source&&r.flags===t.flags;case z0:return r===t}e=e??new Map;const o=e.get(r),c=e.get(t);if(o!=null&&c!=null)return o===t;e.set(r,t),e.set(t,r);try{switch(i){case M0:{if(r.size!==t.size)return!1;for(const[l,u]of r.entries())if(!t.has(l)||!Wr(u,t.get(l),l,r,t,e,n))return!1;return!0}case B0:{if(r.size!==t.size)return!1;const l=Array.from(r.values()),u=Array.from(t.values());for(let d=0;d<l.length;d++){const h=l[d],p=u.findIndex(_=>Wr(h,_,void 0,r,t,e,n));if(p===-1)return!1;u.splice(p,1)}return!0}case j0:case H0:case G0:case J0:case Z0:case Q0:case Y0:case X0:case ev:case tv:case rv:case nv:{if(typeof ee<"u"&&ee.isBuffer(r)!==ee.isBuffer(t)||r.length!==t.length)return!1;for(let l=0;l<r.length;l++)if(!Wr(r[l],t[l],l,r,t,e,n))return!1;return!0}case K0:return r.byteLength!==t.byteLength?!1:Xr(new Uint8Array(r),new Uint8Array(t),e,n);case W0:return r.byteLength!==t.byteLength||r.byteOffset!==t.byteOffset?!1:Xr(new Uint8Array(r),new Uint8Array(t),e,n);case F0:return r.name===t.name&&r.message===t.message;case Vi:{if(!(Xr(r.constructor,t.constructor,e,n)||tc(r)&&tc(t)))return!1;const l=[...Object.keys(r),...Ya(r)],u=[...Object.keys(t),...Ya(t)];if(l.length!==u.length)return!1;for(let d=0;d<l.length;d++){const h=l[d],p=r[h];if(!Object.hasOwn(t,h))return!1;const _=t[h];if(!Wr(p,_,h,r,t,e,n))return!1}return!0}default:return!1}}finally{e.delete(r),e.delete(t)}}function ov(r,t){return sv(r,t,iv)}var av=Object.defineProperty,rc=Object.getOwnPropertySymbols,cv=Object.prototype.hasOwnProperty,lv=Object.prototype.propertyIsEnumerable,ws=(r,t,e)=>t in r?av(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,nc=(r,t)=>{for(var e in t||(t={}))cv.call(t,e)&&ws(r,e,t[e]);if(rc)for(var e of rc(t))lv.call(t,e)&&ws(r,e,t[e]);return r},$e=(r,t,e)=>ws(r,typeof t!="symbol"?t+"":t,e);class hr extends Cp{constructor(t,e,n,i=yt,s=void 0){super(t,e,n,i),this.core=t,this.logger=e,this.name=n,$e(this,"map",new Map),$e(this,"version",dg),$e(this,"cached",[]),$e(this,"initialized",!1),$e(this,"getKey"),$e(this,"storagePrefix",yt),$e(this,"recentlyDeleted",[]),$e(this,"recentlyDeletedLimit",200),$e(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!fe(o)?this.map.set(this.getKey(o),o):fw(o)?this.map.set(o.id,o):mw(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)}),$e(this,"set",async(o,c)=>{this.isInitialized(),this.map.has(o)?await this.update(o,c):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:c}),this.map.set(o,c),await this.persist())}),$e(this,"get",o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o))),$e(this,"getAll",o=>(this.isInitialized(),o?this.values.filter(c=>Object.keys(o).every(l=>ov(c[l],o[l]))):this.values)),$e(this,"update",async(o,c)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:c});const l=nc(nc({},this.getData(o)),c);this.map.set(o,l),await this.persist()}),$e(this,"delete",async(o,c)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:c}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())}),this.logger=Ce(e,this.name),this.storagePrefix=i,this.getKey=s}get context(){return Ke(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(t){this.recentlyDeleted.push(t),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(t){await this.core.storage.setItem(this.storageKey,t)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(t){const e=this.map.get(t);if(!e){if(this.recentlyDeleted.includes(t)){const{message:i}=U("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${t}`);throw this.logger.error(i),new Error(i)}const{message:n}=U("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.error(n),new Error(n)}return e}async persist(){await this.setDataStore(this.values)}async restore(){try{const t=await this.getDataStore();if(typeof t>"u"||!t.length)return;if(this.map.size){const{message:e}=U("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(t){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(t)}}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}}var uv=Object.defineProperty,dv=(r,t,e)=>t in r?uv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,J=(r,t,e)=>dv(r,typeof t!="symbol"?t+"":t,e);class hv{constructor(t,e){this.core=t,this.logger=e,J(this,"name",fg),J(this,"version",mg),J(this,"events",new Vc),J(this,"pairings"),J(this,"initialized",!1),J(this,"storagePrefix",yt),J(this,"ignoredPayloadTypes",[Pt]),J(this,"registeredMethods",[]),J(this,"init",async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))}),J(this,"register",({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]}),J(this,"create",async n=>{this.isInitialized();const i=cs(),s=await this.core.crypto.setSymKey(i),o=_e(q.FIVE_MINUTES),c={protocol:fu},l={topic:s,expiry:o,relay:c,active:!1,methods:n==null?void 0:n.methods},u=Ra({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:c,expiryTimestamp:o,methods:n==null?void 0:n.methods});return this.events.emit(Qt.create,l),this.core.expirer.set(s,o),await this.pairings.set(s,l),await this.core.relayer.subscribe(s,{transportType:n==null?void 0:n.transportType,internal:n==null?void 0:n.internal}),{topic:s,uri:u}}),J(this,"pair",async n=>{this.isInitialized();const i=this.core.eventClient.createEvent({properties:{topic:n==null?void 0:n.uri,trace:[ht.pairing_started]}});this.isValidPair(n,i);const{topic:s,symKey:o,relay:c,expiryTimestamp:l,methods:u}=Oa(n.uri);i.props.properties.topic=s,i.addTrace(ht.pairing_uri_validation_success),i.addTrace(ht.pairing_uri_not_expired);let d;if(this.pairings.keys.includes(s)){if(d=this.pairings.get(s),i.addTrace(ht.existing_pairing),d.active)throw i.setError(It.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);i.addTrace(ht.pairing_not_expired)}const h=l||_e(q.FIVE_MINUTES),p={topic:s,relay:c,expiry:h,active:!1,methods:u};this.core.expirer.set(s,h),await this.pairings.set(s,p),i.addTrace(ht.store_new_pairing),n.activatePairing&&await this.activate({topic:s}),this.events.emit(Qt.create,p),i.addTrace(ht.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),i.addTrace(ht.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{i.setError(It.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:c})}catch(_){throw i.setError(It.subscribe_pairing_topic_failure),_}return i.addTrace(ht.subscribe_pairing_topic_success),p}),J(this,"activate",async({topic:n})=>{this.isInitialized();const i=_e(q.FIVE_MINUTES);this.core.expirer.set(n,i),await this.pairings.update(n,{active:!0,expiry:i})}),J(this,"ping",async n=>{this.isInitialized(),await this.isValidPing(n),this.logger.warn("ping() is deprecated and will be removed in the next major release.");const{topic:i}=n;if(this.pairings.keys.includes(i)){const s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:c,reject:l}=Zt();this.events.once(te("pairing_ping",s),({error:u})=>{u?l(u):c()}),await o()}}),J(this,"updateExpiry",async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})}),J(this,"updateMetadata",async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})}),J(this,"getPairings",()=>(this.isInitialized(),this.pairings.values)),J(this,"disconnect",async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",ae("USER_DISCONNECTED")),await this.deletePairing(i))}),J(this,"formatUriFromPairing",n=>{this.isInitialized();const{topic:i,relay:s,expiry:o,methods:c}=n,l=this.core.crypto.keychain.get(i);return Ra({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:l,relay:s,expiryTimestamp:o,methods:c})}),J(this,"sendRequest",async(n,i,s)=>{const o=Nt(i,s),c=await this.core.crypto.encode(n,o),l=Ur[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,c,l),o.id}),J(this,"sendResult",async(n,i,s)=>{const o=Mn(n,s),c=await this.core.crypto.encode(i,o),l=(await this.core.history.get(i,n)).request.method,u=Ur[l].res;await this.core.relayer.publish(i,c,u),await this.core.history.resolve(o)}),J(this,"sendError",async(n,i,s)=>{const o=Sc(n,s),c=await this.core.crypto.encode(i,o),l=(await this.core.history.get(i,n)).request.method,u=Ur[l]?Ur[l].res:Ur.unregistered_method.res;await this.core.relayer.publish(i,c,u),await this.core.history.resolve(o)}),J(this,"deletePairing",async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,ae("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])}),J(this,"cleanup",async()=>{const n=this.pairings.getAll().filter(i=>Ut(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))}),J(this,"onRelayEventRequest",async n=>{const{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return await this.onPairingPingRequest(i,s);case"wc_pairingDelete":return await this.onPairingDeleteRequest(i,s);default:return await this.onUnknownRpcMethodRequest(i,s)}}),J(this,"onRelayEventResponse",async n=>{const{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}}),J(this,"onPairingPingRequest",async(n,i)=>{const{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(Qt.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}}),J(this,"onPairingPingResponse",(n,i)=>{const{id:s}=i;setTimeout(()=>{vt(i)?this.events.emit(te("pairing_ping",s),{}):pt(i)&&this.events.emit(te("pairing_ping",s),{error:i.error})},500)}),J(this,"onPairingDeleteRequest",async(n,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(Qt.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}}),J(this,"onUnknownRpcMethodRequest",async(n,i)=>{const{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;const c=ae("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,c),this.logger.error(c)}catch(c){await this.sendError(s,n,c),this.logger.error(c)}}),J(this,"onUnknownRpcMethodResponse",n=>{this.registeredMethods.includes(n)||this.logger.error(ae("WC_METHOD_UNSUPPORTED",n))}),J(this,"isValidPair",(n,i)=>{var s;if(!Ne(n)){const{message:c}=U("MISSING_OR_INVALID",`pair() params: ${n}`);throw i.setError(It.malformed_pairing_uri),new Error(c)}if(!_w(n.uri)){const{message:c}=U("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw i.setError(It.malformed_pairing_uri),new Error(c)}const o=Oa(n==null?void 0:n.uri);if(!((s=o==null?void 0:o.relay)!=null&&s.protocol)){const{message:c}=U("MISSING_OR_INVALID","pair() uri#relay-protocol");throw i.setError(It.malformed_pairing_uri),new Error(c)}if(!(o!=null&&o.symKey)){const{message:c}=U("MISSING_OR_INVALID","pair() uri#symKey");throw i.setError(It.malformed_pairing_uri),new Error(c)}if(o!=null&&o.expiryTimestamp&&q.toMiliseconds(o==null?void 0:o.expiryTimestamp)<Date.now()){i.setError(It.pairing_expired);const{message:c}=U("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(c)}}),J(this,"isValidPing",async n=>{if(!Ne(n)){const{message:s}=U("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)}),J(this,"isValidDisconnect",async n=>{if(!Ne(n)){const{message:s}=U("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)}),J(this,"isValidPairingTopic",async n=>{if(!he(n,!1)){const{message:i}=U("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=U("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(Ut(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=U("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}}),this.core=t,this.logger=Ce(e,this.name),this.pairings=new hr(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Ke(this.logger)}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}registerRelayerEvents(){this.core.relayer.on(le.message,async t=>{const{topic:e,message:n,transportType:i}=t;if(this.pairings.keys.includes(e)&&i!==se.link_mode&&!this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))try{const s=await this.core.crypto.decode(e,n);Ss(s)?(this.core.history.set(e,s),await this.onRelayEventRequest({topic:e,payload:s})):xs(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:e,payload:s}),this.core.history.delete(e,s.id)),await this.core.relayer.messages.ack(e,n)}catch(s){this.logger.error(s)}})}registerExpirerEvents(){this.core.expirer.on(Qe.expired,async t=>{const{topic:e}=gl(t.target);e&&this.pairings.keys.includes(e)&&(await this.deletePairing(e,!0),this.events.emit(Qt.expire,{topic:e}))})}}var pv=Object.defineProperty,_v=(r,t,e)=>t in r?pv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,be=(r,t,e)=>_v(r,typeof t!="symbol"?t+"":t,e);class fv extends Dp{constructor(t,e){super(t,e),this.core=t,this.logger=e,be(this,"records",new Map),be(this,"events",new lr.EventEmitter),be(this,"name",yg),be(this,"version",wg),be(this,"cached",[]),be(this,"initialized",!1),be(this,"storagePrefix",yt),be(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),be(this,"set",(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;const o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:_e(q.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(nt.created,o)}),be(this,"resolve",async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=pt(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(nt.updated,i))}),be(this,"get",async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i))),be(this,"delete",(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(nt.deleted,s)}}),this.persist()}),be(this,"exists",async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1)),be(this,"on",(n,i)=>{this.events.on(n,i)}),be(this,"once",(n,i)=>{this.events.once(n,i)}),be(this,"off",(n,i)=>{this.events.off(n,i)}),be(this,"removeListener",(n,i)=>{this.events.removeListener(n,i)}),this.logger=Ce(e,this.name)}get context(){return Ke(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const t=[];return this.values.forEach(e=>{if(typeof e.response<"u")return;const n={topic:e.topic,request:Nt(e.request.method,e.request.params,e.id),chainId:e.chainId};return t.push(n)}),t}async setJsonRpcRecords(t){await this.core.storage.setItem(this.storageKey,t)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(t){this.isInitialized();const e=this.records.get(t);if(!e){const{message:n}=U("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(n)}return e}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(nt.sync)}async restore(){try{const t=await this.getJsonRpcRecords();if(typeof t>"u"||!t.length)return;if(this.records.size){const{message:e}=U("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(t){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(t)}}registerEventListeners(){this.events.on(nt.created,t=>{const e=nt.created;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.events.on(nt.updated,t=>{const e=nt.updated;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.events.on(nt.deleted,t=>{const e=nt.deleted;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.core.heartbeat.on(Tr.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let t=!1;this.records.forEach(e=>{q.toMiliseconds(e.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${e.id}`),this.records.delete(e.id),this.events.emit(nt.deleted,e,!1),t=!0)}),t&&this.persist()}catch(t){this.logger.warn(t)}}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}}var mv=Object.defineProperty,yv=(r,t,e)=>t in r?mv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Re=(r,t,e)=>yv(r,typeof t!="symbol"?t+"":t,e);class wv extends kp{constructor(t,e){super(t,e),this.core=t,this.logger=e,Re(this,"expirations",new Map),Re(this,"events",new lr.EventEmitter),Re(this,"name",gg),Re(this,"version",Eg),Re(this,"cached",[]),Re(this,"initialized",!1),Re(this,"storagePrefix",yt),Re(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),Re(this,"has",n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}}),Re(this,"set",(n,i)=>{this.isInitialized();const s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Qe.created,{target:s,expiration:o})}),Re(this,"get",n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)}),Re(this,"del",n=>{if(this.isInitialized(),this.has(n)){const i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Qe.deleted,{target:i,expiration:s})}}),Re(this,"on",(n,i)=>{this.events.on(n,i)}),Re(this,"once",(n,i)=>{this.events.once(n,i)}),Re(this,"off",(n,i)=>{this.events.off(n,i)}),Re(this,"removeListener",(n,i)=>{this.events.removeListener(n,i)}),this.logger=Ce(e,this.name)}get context(){return Ke(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(t){if(typeof t=="string")return Z_(t);if(typeof t=="number")return Q_(t);const{message:e}=U("UNKNOWN_TYPE",`Target type: ${typeof t}`);throw new Error(e)}async setExpirations(t){await this.core.storage.setItem(this.storageKey,t)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Qe.sync)}async restore(){try{const t=await this.getExpirations();if(typeof t>"u"||!t.length)return;if(this.expirations.size){const{message:e}=U("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(t){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(t)}}getExpiration(t){const e=this.expirations.get(t);if(!e){const{message:n}=U("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.warn(n),new Error(n)}return e}checkExpiry(t,e){const{expiry:n}=e;q.toMiliseconds(n)-Date.now()<=0&&this.expire(t,e)}expire(t,e){this.expirations.delete(t),this.events.emit(Qe.expired,{target:t,expiration:e})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((t,e)=>this.checkExpiry(e,t))}registerEventListeners(){this.core.heartbeat.on(Tr.pulse,()=>this.checkExpirations()),this.events.on(Qe.created,t=>{const e=Qe.created;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()}),this.events.on(Qe.expired,t=>{const e=Qe.expired;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()}),this.events.on(Qe.deleted,t=>{const e=Qe.deleted;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()})}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}}var gv=Object.defineProperty,Ev=(r,t,e)=>t in r?gv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,de=(r,t,e)=>Ev(r,typeof t!="symbol"?t+"":t,e);class vv extends Np{constructor(t,e,n){super(t,e,n),this.core=t,this.logger=e,this.store=n,de(this,"name",vg),de(this,"abortController"),de(this,"isDevEnv"),de(this,"verifyUrlV3",Ig),de(this,"storagePrefix",yt),de(this,"version",_u),de(this,"publicKey"),de(this,"fetchPromise"),de(this,"init",async()=>{var i;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&q.toMiliseconds((i=this.publicKey)==null?void 0:i.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))}),de(this,"register",async i=>{if(!Lr()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:c}=i,l=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${c}`;try{const u=Ot.getDocument(),d=this.startAbortTimer(q.ONE_SECOND*5),h=await new Promise((p,_)=>{const f=()=>{window.removeEventListener("message",y),u.body.removeChild(m),_("attestation aborted")};this.abortController.signal.addEventListener("abort",f);const m=u.createElement("iframe");m.src=l,m.style.display="none",m.addEventListener("error",f,{signal:this.abortController.signal});const y=b=>{if(b.data&&typeof b.data=="string")try{const R=JSON.parse(b.data);if(R.type==="verify_attestation"){if(ji(R.attestation).payload.id!==o)return;clearInterval(d),u.body.removeChild(m),this.abortController.signal.removeEventListener("abort",f),window.removeEventListener("message",y),p(R.attestation===null?"":R.attestation)}}catch(R){this.logger.warn(R)}};u.body.appendChild(m),window.addEventListener("message",y,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",h),h}catch(u){this.logger.warn(u)}return""}),de(this,"resolve",async i=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:c}=i;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(ji(s).payload.id!==c)return;const u=await this.isValidJwtAttestation(s);if(u){if(!u.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return u}}if(!o)return;const l=this.getVerifyUrl(i==null?void 0:i.verifyUrl);return this.fetchAttestation(o,l)}),de(this,"fetchAttestation",async(i,s)=>{this.logger.debug(`resolving attestation: ${i} from url: ${s}`);const o=this.startAbortTimer(q.ONE_SECOND*5),c=await fetch(`${s}/attestation/${i}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),c.status===200?await c.json():void 0}),de(this,"getVerifyUrl",i=>{let s=i||Yr;return Ag.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Yr}`),s=Yr),s}),de(this,"fetchPublicKey",async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const i=this.startAbortTimer(q.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(i),await s.json()}catch(i){this.logger.warn(i)}}),de(this,"persistPublicKey",async i=>{this.logger.debug("persisting public key to local storage",i),await this.store.setItem(this.storeKey,i),this.publicKey=i}),de(this,"removePublicKey",async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0}),de(this,"isValidJwtAttestation",async i=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(i,s)}catch(c){this.logger.error(c),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(i,o)}catch(c){this.logger.error(c),this.logger.warn("error validating attestation")}}),de(this,"getPublicKey",async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey()),de(this,"fetchAndPersistPublicKey",async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const i=await this.fetchPromise;return this.fetchPromise=void 0,i}),de(this,"validateAttestation",(i,s)=>{const o=Wy(i,s.publicKey),c={hasExpired:q.toMiliseconds(o.exp)<Date.now(),payload:o};if(c.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:c.payload.origin,isScam:c.payload.isScam,isVerified:c.payload.isVerified}}),this.logger=Ce(e,this.name),this.abortController=new AbortController,this.isDevEnv=Ws(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return Ke(this.logger)}startAbortTimer(t){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),q.toMiliseconds(t))}}var bv=Object.defineProperty,Iv=(r,t,e)=>t in r?bv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ic=(r,t,e)=>Iv(r,typeof t!="symbol"?t+"":t,e);class Av extends Up{constructor(t,e){super(t,e),this.projectId=t,this.logger=e,ic(this,"context",Tg),ic(this,"registerDeviceToken",async n=>{const{clientId:i,token:s,notificationType:o,enableEncrypted:c=!1}=n,l=`${Pg}/${this.projectId}/clients`;await fetch(l,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:c})})}),this.logger=Ce(e,this.context)}}var Tv=Object.defineProperty,sc=Object.getOwnPropertySymbols,Pv=Object.prototype.hasOwnProperty,Ov=Object.prototype.propertyIsEnumerable,gs=(r,t,e)=>t in r?Tv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,jr=(r,t)=>{for(var e in t||(t={}))Pv.call(t,e)&&gs(r,e,t[e]);if(sc)for(var e of sc(t))Ov.call(t,e)&&gs(r,e,t[e]);return r},me=(r,t,e)=>gs(r,typeof t!="symbol"?t+"":t,e);class Rv extends qp{constructor(t,e,n=!0){super(t,e,n),this.core=t,this.logger=e,me(this,"context",Rg),me(this,"storagePrefix",yt),me(this,"storageVersion",Og),me(this,"events",new Map),me(this,"shouldPersist",!1),me(this,"init",async()=>{if(!Ws())try{const i={eventId:Jo(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:yl(this.core.relayer.protocol,this.core.relayer.version,ds)}}};await this.sendEvent([i])}catch(i){this.logger.warn(i)}}),me(this,"createEvent",i=>{const{event:s="ERROR",type:o="",properties:{topic:c,trace:l}}=i,u=Jo(),d=this.core.projectId||"",h=Date.now(),p=jr({eventId:u,timestamp:h,props:{event:s,type:o,properties:{topic:c,trace:l}},bundleId:d,domain:this.getAppDomain()},this.setMethods(u));return this.telemetryEnabled&&(this.events.set(u,p),this.shouldPersist=!0),p}),me(this,"getEvent",i=>{const{eventId:s,topic:o}=i;if(s)return this.events.get(s);const c=Array.from(this.events.values()).find(l=>l.props.properties.topic===o);if(c)return jr(jr({},c),this.setMethods(c.eventId))}),me(this,"deleteEvent",i=>{const{eventId:s}=i;this.events.delete(s),this.shouldPersist=!0}),me(this,"setEventListeners",()=>{this.core.heartbeat.on(Tr.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(i=>{q.fromMiliseconds(Date.now())-q.fromMiliseconds(i.timestamp)>Lg&&(this.events.delete(i.eventId),this.shouldPersist=!0)})})}),me(this,"setMethods",i=>({addTrace:s=>this.addTrace(i,s),setError:s=>this.setError(i,s)})),me(this,"addTrace",(i,s)=>{const o=this.events.get(i);o&&(o.props.properties.trace.push(s),this.events.set(i,o),this.shouldPersist=!0)}),me(this,"setError",(i,s)=>{const o=this.events.get(i);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(i,o),this.shouldPersist=!0)}),me(this,"persist",async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1}),me(this,"restore",async()=>{try{const i=await this.core.storage.getItem(this.storageKey)||[];if(!i.length)return;i.forEach(s=>{this.events.set(s.eventId,jr(jr({},s),this.setMethods(s.eventId)))})}catch(i){this.logger.warn(i)}}),me(this,"submit",async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const i=[];for(const[s,o]of this.events)o.props.type&&i.push(o);if(i.length!==0)try{if((await this.sendEvent(i)).ok)for(const s of i)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}}),me(this,"sendEvent",async i=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${Dg}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${ds}${s}`,{method:"POST",body:JSON.stringify(i)})}),me(this,"getAppDomain",()=>ml().url),this.logger=Ce(e,this.context),this.telemetryEnabled=n,n?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var Lv=Object.defineProperty,oc=Object.getOwnPropertySymbols,Dv=Object.prototype.hasOwnProperty,Vv=Object.prototype.propertyIsEnumerable,Es=(r,t,e)=>t in r?Lv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ac=(r,t)=>{for(var e in t||(t={}))Dv.call(t,e)&&Es(r,e,t[e]);if(oc)for(var e of oc(t))Vv.call(t,e)&&Es(r,e,t[e]);return r},ie=(r,t,e)=>Es(r,typeof t!="symbol"?t+"":t,e);class oo extends Pp{constructor(t){var e;super(t),ie(this,"protocol",pu),ie(this,"version",_u),ie(this,"name",us),ie(this,"relayUrl"),ie(this,"projectId"),ie(this,"customStoragePrefix"),ie(this,"events",new lr.EventEmitter),ie(this,"logger"),ie(this,"heartbeat"),ie(this,"relayer"),ie(this,"crypto"),ie(this,"storage"),ie(this,"history"),ie(this,"expirer"),ie(this,"pairing"),ie(this,"verify"),ie(this,"echoClient"),ie(this,"linkModeSupportedApps"),ie(this,"eventClient"),ie(this,"initialized",!1),ie(this,"logChunkController"),ie(this,"on",(c,l)=>this.events.on(c,l)),ie(this,"once",(c,l)=>this.events.once(c,l)),ie(this,"off",(c,l)=>this.events.off(c,l)),ie(this,"removeListener",(c,l)=>this.events.removeListener(c,l)),ie(this,"dispatchEnvelope",({topic:c,message:l,sessionExists:u})=>{if(!c||!l)return;const d={topic:c,message:l,publishedAt:Date.now(),transportType:se.link_mode};this.relayer.onLinkMessageEvent(d,{sessionExists:u})});const n=this.getGlobalCore(t==null?void 0:t.customStoragePrefix);if(n)try{return this.customStoragePrefix=n.customStoragePrefix,this.logger=n.logger,this.heartbeat=n.heartbeat,this.crypto=n.crypto,this.history=n.history,this.expirer=n.expirer,this.storage=n.storage,this.relayer=n.relayer,this.pairing=n.pairing,this.verify=n.verify,this.echoClient=n.echoClient,this.linkModeSupportedApps=n.linkModeSupportedApps,this.eventClient=n.eventClient,this.initialized=n.initialized,this.logChunkController=n.logChunkController,n}catch(c){console.warn("Failed to copy global core",c)}this.projectId=t==null?void 0:t.projectId,this.relayUrl=(t==null?void 0:t.relayUrl)||mu,this.customStoragePrefix=t!=null&&t.customStoragePrefix?`:${t.customStoragePrefix}`:"";const i=Ks({level:typeof(t==null?void 0:t.logger)=="string"&&t.logger?t.logger:Qw.logger,name:us}),{logger:s,chunkLoggerController:o}=Ip({opts:i,maxSizeInBytes:t==null?void 0:t.maxLogBlobSizeInBytes,loggerOverride:t==null?void 0:t.logger});this.logChunkController=o,(e=this.logChunkController)!=null&&e.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var c,l;(c=this.logChunkController)!=null&&c.downloadLogsBlobInBrowser&&((l=this.logChunkController)==null||l.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=Ce(s,this.name),this.heartbeat=new Kd,this.crypto=new s0(this,this.logger,t==null?void 0:t.keychain),this.history=new fv(this,this.logger),this.expirer=new wv(this,this.logger),this.storage=t!=null&&t.storage?t.storage:new ap(ac(ac({},Yw),t==null?void 0:t.storageOptions)),this.relayer=new S0({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new hv(this,this.logger),this.verify=new vv(this,this.logger,this.storage),this.echoClient=new Av(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new Rv(this,this.logger,t==null?void 0:t.telemetryEnabled),this.setGlobalCore(this)}static async init(t){const e=new oo(t);await e.initialize();const n=await e.crypto.getClientId();return await e.storage.setItem(hg,n),e}get context(){return Ke(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var t;return(t=this.logChunkController)==null?void 0:t.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(t){this.linkModeSupportedApps.includes(t)||(this.linkModeSupportedApps.push(t),await this.storage.setItem(qa,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.linkModeSupportedApps=await this.storage.getItem(qa)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(t){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,t),this.logger.error(t.message),t}}getGlobalCore(t=""){try{if(this.isGlobalCoreDisabled())return;const e=`_walletConnectCore_${t}`,n=`${e}_count`;return globalThis[n]=(globalThis[n]||0)+1,globalThis[n]>1&&console.warn(`WalletConnect Core is already initialized. This is probably a mistake and can lead to unexpected behavior. Init() was called ${globalThis[n]} times.`),globalThis[e]}catch(e){console.warn("Failed to get global WalletConnect core",e);return}}setGlobalCore(t){var e;try{if(this.isGlobalCoreDisabled())return;const n=`_walletConnectCore_${((e=t.opts)==null?void 0:e.customStoragePrefix)||""}`;globalThis[n]=t}catch(n){console.warn("Failed to set global WalletConnect core",n)}}isGlobalCoreDisabled(){try{return typeof zt<"u"&&Zw.DISABLE_GLOBAL_CORE==="true"}catch{return!0}}}const Sv=oo,Lu="wc",Du=2,Vu="client",ao=`${Lu}@${Du}:${Vu}:`,Si={name:Vu,logger:"error"},cc="WALLETCONNECT_DEEPLINK_CHOICE",xv="proposal",lc="Proposal expired",Cv="session",wr=q.SEVEN_DAYS,$v="engine",Ie={wc_sessionPropose:{req:{ttl:q.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:q.ONE_DAY,prompt:!1,tag:1104},res:{ttl:q.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:q.ONE_DAY,prompt:!1,tag:1106},res:{ttl:q.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:q.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:q.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:q.ONE_DAY,prompt:!1,tag:1112},res:{ttl:q.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:q.ONE_DAY,prompt:!1,tag:1114},res:{ttl:q.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:q.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:q.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1119}}},xi={min:q.FIVE_MINUTES,max:q.SEVEN_DAYS},dt={idle:"IDLE",active:"ACTIVE"},kv={eth_sendTransaction:{key:""},eth_sendRawTransaction:{key:""},wallet_sendCalls:{key:""},solana_signTransaction:{key:"signature"},solana_signAllTransactions:{key:"transactions"},solana_signAndSendTransaction:{key:"signature"},sui_signAndExecuteTransaction:{key:"digest"},sui_signTransaction:{key:""},hedera_signAndExecuteTransaction:{key:"transactionId"},hedera_executeTransaction:{key:"transactionId"},near_signTransaction:{key:""},near_signTransactions:{key:""},tron_signTransaction:{key:"txID"},xrpl_signTransaction:{key:""},xrpl_signTransactionFor:{key:""},algo_signTxn:{key:""},sendTransfer:{key:"txid"},stacks_stxTransfer:{key:"txId"},polkadot_signTransaction:{key:""},cosmos_signDirect:{key:""}},Nv="request",Uv=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],qv="wc",Mv="auth",Bv="authKeys",jv="pairingTopics",zv="requests",li=`${qv}@${1.5}:${Mv}:`,kn=`${li}:PUB_KEY`;var Kv=Object.defineProperty,Fv=Object.defineProperties,Wv=Object.getOwnPropertyDescriptors,uc=Object.getOwnPropertySymbols,Hv=Object.prototype.hasOwnProperty,Gv=Object.prototype.propertyIsEnumerable,vs=(r,t,e)=>t in r?Kv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,re=(r,t)=>{for(var e in t||(t={}))Hv.call(t,e)&&vs(r,e,t[e]);if(uc)for(var e of uc(t))Gv.call(t,e)&&vs(r,e,t[e]);return r},Le=(r,t)=>Fv(r,Wv(t)),x=(r,t,e)=>vs(r,typeof t!="symbol"?t+"":t,e);class Jv extends zp{constructor(t){super(t),x(this,"name",$v),x(this,"events",new Vc),x(this,"initialized",!1),x(this,"requestQueue",{state:dt.idle,queue:[]}),x(this,"sessionRequestQueue",{state:dt.idle,queue:[]}),x(this,"emittedSessionRequests",new af({limit:500})),x(this,"requestQueueDelay",q.ONE_SECOND),x(this,"expectedPairingMethodMap",new Map),x(this,"recentlyDeletedMap",new Map),x(this,"recentlyDeletedLimit",200),x(this,"relayMessageCache",[]),x(this,"pendingSessions",new Map),x(this,"init",async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(Ie)}),this.initialized=!0,setTimeout(async()=>{await this.processPendingMessageEvents(),this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},q.toMiliseconds(this.requestQueueDelay)))}),x(this,"connect",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const n=Le(re({},e),{requiredNamespaces:e.requiredNamespaces||{},optionalNamespaces:e.optionalNamespaces||{}});await this.isValidConnect(n),n.optionalNamespaces=lw(n.requiredNamespaces,n.optionalNamespaces),n.requiredNamespaces={};const{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:c,scopedProperties:l,relays:u}=n;let d=i,h,p=!1;try{if(d){const g=this.client.core.pairing.pairings.get(d);this.client.logger.warn("connect() with existing pairing topic is deprecated and will be removed in the next major release."),p=g.active}}catch(g){throw this.client.logger.error(`connect() -> pairing.get(${d}) failed`),g}if(!d||!p){const{topic:g,uri:D}=await this.client.core.pairing.create({internal:{skipSubscribe:!0}});d=g,h=D}if(!d){const{message:g}=U("NO_MATCHING_KEY",`connect() pairing topic: ${d}`);throw new Error(g)}const _=await this.client.core.crypto.generateKeyPair(),f=Ie.wc_sessionPropose.req.ttl||q.FIVE_MINUTES,m=_e(f),y=Le(re(re({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:fu}],proposer:{publicKey:_,metadata:this.client.metadata},expiryTimestamp:m,pairingTopic:d},c&&{sessionProperties:c}),l&&{scopedProperties:l}),{id:Lt()}),b=te("session_connect",y.id),{reject:R,resolve:v,done:P}=Zt(f,lc),T=({id:g})=>{g===y.id&&(this.client.events.off("proposal_expire",T),this.pendingSessions.delete(y.id),this.events.emit(b,{error:{message:lc,code:0}}))};return this.client.events.on("proposal_expire",T),this.events.once(b,({error:g,session:D})=>{this.client.events.off("proposal_expire",T),g?R(g):D&&v(D)}),await this.sendProposeSession({proposal:y,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:y.id}}}),await this.setProposal(y.id,y),{uri:h,approval:P}}),x(this,"pair",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(e)}catch(n){throw this.client.logger.error("pair() failed"),n}}),x(this,"approve",async e=>{var n,i,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(n=e==null?void 0:e.id)==null?void 0:n.toString(),trace:[kt.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(w){throw o.setError(qr.no_internet_connection),w}try{await this.isValidProposalId(e==null?void 0:e.id)}catch(w){throw this.client.logger.error(`approve() -> proposal.get(${e==null?void 0:e.id}) failed`),o.setError(qr.proposal_not_found),w}try{await this.isValidApprove(e)}catch(w){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(qr.session_approve_namespace_validation_failure),w}const{id:c,relayProtocol:l,namespaces:u,sessionProperties:d,scopedProperties:h,sessionConfig:p}=e,_=this.client.proposal.get(c);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:f,proposer:m,requiredNamespaces:y,optionalNamespaces:b}=_;let R=(i=this.client.core.eventClient)==null?void 0:i.getEvent({topic:f});R||(R=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:kt.session_approve_started,properties:{topic:f,trace:[kt.session_approve_started,kt.session_namespaces_validation_success]}}));const v=await this.client.core.crypto.generateKeyPair(),P=m.publicKey,T=await this.client.core.crypto.generateSharedKey(v,P),g=re(re(re({relay:{protocol:l??"irn"},namespaces:u,controller:{publicKey:v,metadata:this.client.metadata},expiry:_e(wr)},d&&{sessionProperties:d}),h&&{scopedProperties:h}),p&&{sessionConfig:p}),D=se.relay;R.addTrace(kt.subscribing_session_topic);try{await this.client.core.relayer.subscribe(T,{transportType:D,internal:{skipSubscribe:!0}})}catch(w){throw R.setError(qr.subscribe_session_topic_failure),w}R.addTrace(kt.subscribe_session_topic_success);const L=Le(re({},g),{topic:T,requiredNamespaces:y,optionalNamespaces:b,pairingTopic:f,acknowledged:!1,self:g.controller,peer:{publicKey:m.publicKey,metadata:m.metadata},controller:v,transportType:se.relay});await this.client.session.set(T,L),R.addTrace(kt.store_session);try{await this.sendApproveSession({sessionTopic:T,proposal:_,pairingProposalResponse:{relay:{protocol:l??"irn"},responderPublicKey:v},sessionSettleRequest:g,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:c}}}),R.addTrace(kt.session_approve_publish_success)}catch(w){throw this.client.logger.error(w),this.client.session.delete(T,ae("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(T),w}return this.client.core.eventClient.deleteEvent({eventId:R.eventId}),await this.client.core.pairing.updateMetadata({topic:f,metadata:m.metadata}),await this.deleteProposal(c),await this.client.core.pairing.activate({topic:f}),await this.setExpiry(T,_e(wr)),{topic:T,acknowledged:()=>Promise.resolve(this.client.session.get(T))}}),x(this,"reject",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(e)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:n,reason:i}=e;let s;try{s=this.client.proposal.get(n).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),o}s&&await this.sendError({id:n,topic:s,error:i,rpcOpts:Ie.wc_sessionPropose.reject}),await this.deleteProposal(n)}),x(this,"update",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(e)}catch(h){throw this.client.logger.error("update() -> isValidUpdate() failed"),h}const{topic:n,namespaces:i}=e,{done:s,resolve:o,reject:c}=Zt(),l=Lt(),u=Yt().toString(),d=this.client.session.get(n).namespaces;return this.events.once(te("session_update",l),({error:h})=>{h?c(h):o()}),await this.client.session.update(n,{namespaces:i}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:l,relayRpcId:u}).catch(h=>{this.client.logger.error(h),this.client.session.update(n,{namespaces:d}),c(h)}),{acknowledged:s}}),x(this,"extend",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(e)}catch(l){throw this.client.logger.error("extend() -> isValidExtend() failed"),l}const{topic:n}=e,i=Lt(),{done:s,resolve:o,reject:c}=Zt();return this.events.once(te("session_extend",i),({error:l})=>{l?c(l):o()}),await this.setExpiry(n,_e(wr)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(l=>{c(l)}),{acknowledged:s}}),x(this,"request",async e=>{this.isInitialized();try{await this.isValidRequest(e)}catch(y){throw this.client.logger.error("request() -> isValidRequest() failed"),y}const{chainId:n,request:i,topic:s,expiry:o=Ie.wc_sessionRequest.req.ttl}=e,c=this.client.session.get(s);(c==null?void 0:c.transportType)===se.relay&&await this.confirmOnlineStateOrThrow();const l=Lt(),u=Yt().toString(),{done:d,resolve:h,reject:p}=Zt(o,"Request expired. Please try again.");this.events.once(te("session_request",l),({error:y,result:b})=>{y?p(y):h(b)});const _="wc_sessionRequest",f=this.getAppLinkIfEnabled(c.peer.metadata,c.transportType);if(f)return await this.sendRequest({clientRpcId:l,relayRpcId:u,topic:s,method:_,params:{request:Le(re({},i),{expiryTimestamp:_e(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0,appLink:f}).catch(y=>p(y)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:l}),await d();const m={request:Le(re({},i),{expiryTimestamp:_e(o)}),chainId:n};return await Promise.all([new Promise(async y=>{await this.sendRequest({clientRpcId:l,relayRpcId:u,topic:s,method:_,params:m,expiry:o,throwOnFailedPublish:!0,tvf:this.getTVFParams(l,m)}).catch(b=>p(b)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:l}),y()}),new Promise(async y=>{var b;if(!((b=c.sessionConfig)!=null&&b.disableDeepLink)){const R=await tf(this.client.core.storage,cc);await Y_({id:l,topic:s,wcDeepLink:R})}y()}),d()]).then(y=>y[2])}),x(this,"respond",async e=>{this.isInitialized(),await this.isValidRespond(e);const{topic:n,response:i}=e,{id:s}=i,o=this.client.session.get(n);o.transportType===se.relay&&await this.confirmOnlineStateOrThrow();const c=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);vt(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0,appLink:c}):pt(i)&&await this.sendError({id:s,topic:n,error:i.error,appLink:c}),this.cleanupAfterResponse(e)}),x(this,"ping",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(e)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}const{topic:n}=e;if(this.client.session.keys.includes(n)){const i=Lt(),s=Yt().toString(),{done:o,resolve:c,reject:l}=Zt();this.events.once(te("session_ping",i),({error:u})=>{u?l(u):c()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(n)&&(this.client.logger.warn("ping() on pairing topic is deprecated and will be removed in the next major release."),await this.client.core.pairing.ping({topic:n}))}),x(this,"emit",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(e);const{topic:n,event:i,chainId:s}=e,o=Yt().toString(),c=Lt();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:o,clientRpcId:c})}),x(this,"disconnect",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(e);const{topic:n}=e;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:ae("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:i}=U("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}}),x(this,"find",e=>(this.isInitialized(),this.client.session.getAll().filter(n=>hw(n,e)))),x(this,"getPendingSessionRequests",()=>this.client.pendingRequest.getAll()),x(this,"authenticate",async(e,n)=>{var i;this.isInitialized(),this.isValidAuthenticate(e);const s=n&&this.client.core.linkModeSupportedApps.includes(n)&&((i=this.client.metadata.redirect)==null?void 0:i.linkMode),o=s?se.link_mode:se.relay;o===se.relay&&await this.confirmOnlineStateOrThrow();const{chains:c,statement:l="",uri:u,domain:d,nonce:h,type:p,exp:_,nbf:f,methods:m=[],expiry:y}=e,b=[...e.resources||[]],{topic:R,uri:v}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:R,uri:v}});const P=await this.client.core.crypto.generateKeyPair(),T=Cn(P);if(await Promise.all([this.client.auth.authKeys.set(kn,{responseTopic:T,publicKey:P}),this.client.auth.pairingTopics.set(T,{topic:T,pairingTopic:R})]),await this.client.core.relayer.subscribe(T,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${R}`),m.length>0){const{namespace:C}=Sn(c[0]);let N=wm(C,"request",m);xn(b)&&(N=Em(N,b.pop())),b.push(N)}const g=y&&y>Ie.wc_sessionAuthenticate.req.ttl?y:Ie.wc_sessionAuthenticate.req.ttl,D={authPayload:{type:p??"caip122",chains:c,statement:l,aud:u,domain:d,version:"1",nonce:h,iat:new Date().toISOString(),exp:_,nbf:f,resources:b},requester:{publicKey:P,metadata:this.client.metadata},expiryTimestamp:_e(g)},L={eip155:{chains:c,methods:[...new Set(["personal_sign",...m])],events:["chainChanged","accountsChanged"]}},w={requiredNamespaces:{},optionalNamespaces:L,relays:[{protocol:"irn"}],pairingTopic:R,proposer:{publicKey:P,metadata:this.client.metadata},expiryTimestamp:_e(Ie.wc_sessionPropose.req.ttl),id:Lt()},{done:E,resolve:I,reject:A}=Zt(g,"Request expired"),V=Lt(),O=te("session_connect",w.id),S=te("session_request",V),$=async({error:C,session:N})=>{this.events.off(S,k),C?A(C):N&&I({session:N})},k=async C=>{var N,j,z;if(await this.deletePendingAuthRequest(V,{message:"fulfilled",code:0}),C.error){const oe=ae("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return C.error.code===oe.code?void 0:(this.events.off(O,$),A(C.error.message))}await this.deleteProposal(w.id),this.events.off(O,$);const{cacaos:F,responder:W}=C.result,H=[],G=[];for(const oe of F){await oa({cacao:oe,projectId:this.client.core.projectId})||(this.client.logger.error(oe,"Signature verification failed"),A(ae("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:Ge}=oe,wt=xn(Ge.resources),ho=[Xi(Ge.iss)],zu=Hn(Ge.iss);if(wt){const di=aa(wt),Ku=ca(wt);H.push(...di),ho.push(...Ku)}for(const di of ho)G.push(`${di}:${zu}`)}const ue=await this.client.core.crypto.generateSharedKey(P,W.publicKey);let ce;H.length>0&&(ce={topic:ue,acknowledged:!0,self:{publicKey:P,metadata:this.client.metadata},peer:W,controller:W.publicKey,expiry:_e(wr),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:R,namespaces:Sa([...new Set(H)],[...new Set(G)]),transportType:o},await this.client.core.relayer.subscribe(ue,{transportType:o}),await this.client.session.set(ue,ce),R&&await this.client.core.pairing.updateMetadata({topic:R,metadata:W.metadata}),ce=this.client.session.get(ue)),(N=this.client.metadata.redirect)!=null&&N.linkMode&&(j=W.metadata.redirect)!=null&&j.linkMode&&(z=W.metadata.redirect)!=null&&z.universal&&n&&(this.client.core.addLinkModeSupportedApp(W.metadata.redirect.universal),this.client.session.update(ue,{transportType:se.link_mode})),I({auths:F,session:ce})};this.events.once(O,$),this.events.once(S,k);let M;try{if(s){const C=Nt("wc_sessionAuthenticate",D,V);this.client.core.history.set(R,C);const N=await this.client.core.crypto.encode("",C,{type:yn,encoding:jt});M=Rn(n,R,N)}else await Promise.all([this.sendRequest({topic:R,method:"wc_sessionAuthenticate",params:D,expiry:e.expiry,throwOnFailedPublish:!0,clientRpcId:V}),this.sendRequest({topic:R,method:"wc_sessionPropose",params:w,expiry:Ie.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:w.id})])}catch(C){throw this.events.off(O,$),this.events.off(S,k),C}return await this.setProposal(w.id,w),await this.setAuthRequest(V,{request:Le(re({},D),{verifyContext:{}}),pairingTopic:R,transportType:o}),{uri:M??v,response:E}}),x(this,"approveSessionAuthenticate",async e=>{const{id:n,auths:i}=e,s=this.client.core.eventClient.createEvent({properties:{topic:n.toString(),trace:[Jt.authenticated_session_approve_started]}});try{this.isInitialized()}catch(y){throw s.setError(Mr.no_internet_connection),y}const o=this.getPendingAuthRequest(n);if(!o)throw s.setError(Mr.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${n}`);const c=o.transportType||se.relay;c===se.relay&&await this.confirmOnlineStateOrThrow();const l=o.requester.publicKey,u=await this.client.core.crypto.generateKeyPair(),d=Cn(l),h={type:Pt,receiverPublicKey:l,senderPublicKey:u},p=[],_=[];for(const y of i){if(!await oa({cacao:y,projectId:this.client.core.projectId})){s.setError(Mr.invalid_cacao);const T=ae("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:d,error:T,encodeOpts:h}),new Error(T.message)}s.addTrace(Jt.cacaos_verified);const{p:b}=y,R=xn(b.resources),v=[Xi(b.iss)],P=Hn(b.iss);if(R){const T=aa(R),g=ca(R);p.push(...T),v.push(...g)}for(const T of v)_.push(`${T}:${P}`)}const f=await this.client.core.crypto.generateSharedKey(u,l);s.addTrace(Jt.create_authenticated_session_topic);let m;if((p==null?void 0:p.length)>0){m={topic:f,acknowledged:!0,self:{publicKey:u,metadata:this.client.metadata},peer:{publicKey:l,metadata:o.requester.metadata},controller:l,expiry:_e(wr),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:Sa([...new Set(p)],[...new Set(_)]),transportType:c},s.addTrace(Jt.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(f,{transportType:c})}catch(y){throw s.setError(Mr.subscribe_authenticated_session_topic_failure),y}s.addTrace(Jt.subscribe_authenticated_session_topic_success),await this.client.session.set(f,m),s.addTrace(Jt.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(Jt.publishing_authenticated_session_approve);try{await this.sendResult({topic:d,id:n,result:{cacaos:i,responder:{publicKey:u,metadata:this.client.metadata}},encodeOpts:h,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,c)})}catch(y){throw s.setError(Mr.authenticated_session_approve_publish_failure),y}return await this.client.auth.requests.delete(n,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:m}}),x(this,"rejectSessionAuthenticate",async e=>{this.isInitialized();const{id:n,reason:i}=e,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);s.transportType===se.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,c=await this.client.core.crypto.generateKeyPair(),l=Cn(o),u={type:Pt,receiverPublicKey:o,senderPublicKey:c};await this.sendError({id:n,topic:l,error:i,encodeOpts:u,rpcOpts:Ie.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.deleteProposal(n)}),x(this,"formatAuthMessage",e=>{this.isInitialized();const{request:n,iss:i}=e;return Cl(n,i)}),x(this,"processRelayMessageCache",()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const e=this.relayMessageCache.shift();e&&await this.onRelayMessage(e)}catch(e){this.client.logger.error(e)}},50)}),x(this,"cleanupDuplicatePairings",async e=>{if(e.pairingTopic)try{const n=this.client.core.pairing.pairings.get(e.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,c;return((o=s.peerMetadata)==null?void 0:o.url)&&((c=s.peerMetadata)==null?void 0:c.url)===e.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}}),x(this,"deleteSession",async e=>{var n;const{topic:i,expirerHasDeleted:s=!1,emitEvent:o=!0,id:c=0}=e,{self:l}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,ae("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(l.publicKey)&&await this.client.core.crypto.deleteKeyPair(l.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),s||this.client.core.expirer.del(i),this.client.core.storage.removeItem(cc).catch(u=>this.client.logger.warn(u)),this.getPendingSessionRequests().forEach(u=>{u.topic===i&&this.deletePendingSessionRequest(u.id,ae("USER_DISCONNECTED"))}),i===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=dt.idle),o&&this.client.events.emit("session_delete",{id:c,topic:i})}),x(this,"deleteProposal",async(e,n)=>{if(n)try{const i=this.client.proposal.get(e),s=this.client.core.eventClient.getEvent({topic:i.pairingTopic});s==null||s.setError(qr.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(e,ae("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"proposal")}),x(this,"deletePendingSessionRequest",async(e,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(e,n),i?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==e),i&&(this.sessionRequestQueue.state=dt.idle,this.client.events.emit("session_request_expire",{id:e}))}),x(this,"deletePendingAuthRequest",async(e,n,i=!1)=>{await Promise.all([this.client.auth.requests.delete(e,n),i?Promise.resolve():this.client.core.expirer.del(e)])}),x(this,"setExpiry",async(e,n)=>{this.client.session.keys.includes(e)&&(this.client.core.expirer.set(e,n),await this.client.session.update(e,{expiry:n}))}),x(this,"setProposal",async(e,n)=>{this.client.core.expirer.set(e,_e(Ie.wc_sessionPropose.req.ttl)),await this.client.proposal.set(e,n)}),x(this,"setAuthRequest",async(e,n)=>{const{request:i,pairingTopic:s,transportType:o=se.relay}=n;this.client.core.expirer.set(e,i.expiryTimestamp),await this.client.auth.requests.set(e,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:e,pairingTopic:s,verifyContext:i.verifyContext,transportType:o})}),x(this,"setPendingSessionRequest",async e=>{const{id:n,topic:i,params:s,verifyContext:o}=e,c=s.request.expiryTimestamp||_e(Ie.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,c),await this.client.pendingRequest.set(n,{id:n,topic:i,params:s,verifyContext:o})}),x(this,"sendRequest",async e=>{const{topic:n,method:i,params:s,expiry:o,relayRpcId:c,clientRpcId:l,throwOnFailedPublish:u,appLink:d,tvf:h,publishOpts:p={}}=e,_=Nt(i,s,l);let f;const m=!!d;try{const R=m?jt:Me;f=await this.client.core.crypto.encode(n,_,{encoding:R})}catch(R){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),R}let y;if(Uv.includes(i)){const R=Ye(JSON.stringify(_)),v=Ye(f);y=await this.client.core.verify.register({id:v,decryptedId:R})}const b=re(re({},Ie[i].req),p);if(b.attestation=y,o&&(b.ttl=o),c&&(b.id=c),this.client.core.history.set(n,_),m){const R=Rn(d,n,f);await K.Linking.openURL(R,this.client.name)}else b.tvf=Le(re({},h),{correlationId:_.id}),u?(b.internal=Le(re({},b.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,f,b)):this.client.core.relayer.publish(n,f,b).catch(R=>this.client.logger.error(R));return _.id}),x(this,"sendProposeSession",async e=>{const{proposal:n,publishOpts:i}=e,s=Nt("wc_sessionPropose",n,n.id);this.client.core.history.set(n.pairingTopic,s);const o=await this.client.core.crypto.encode(n.pairingTopic,s,{encoding:Me}),c=Ye(JSON.stringify(s)),l=Ye(o),u=await this.client.core.verify.register({id:l,decryptedId:c});await this.client.core.relayer.publishCustom({payload:{pairingTopic:n.pairingTopic,sessionProposal:o},opts:Le(re({},i),{publishMethod:"wc_proposeSession",attestation:u})})}),x(this,"sendApproveSession",async e=>{const{sessionTopic:n,pairingProposalResponse:i,proposal:s,sessionSettleRequest:o,publishOpts:c}=e,l=Mn(s.id,i),u=await this.client.core.crypto.encode(s.pairingTopic,l,{encoding:Me}),d=Nt("wc_sessionSettle",o,c==null?void 0:c.id),h=await this.client.core.crypto.encode(n,d,{encoding:Me});this.client.core.history.set(n,d),await this.client.core.relayer.publishCustom({payload:{sessionTopic:n,pairingTopic:s.pairingTopic,sessionProposalResponse:u,sessionSettlementRequest:h},opts:Le(re({},c),{publishMethod:"wc_approveSession"})})}),x(this,"sendResult",async e=>{const{id:n,topic:i,result:s,throwOnFailedPublish:o,encodeOpts:c,appLink:l}=e,u=Mn(n,s);let d;const h=l&&typeof(K==null?void 0:K.Linking)<"u";try{const f=h?jt:Me;d=await this.client.core.crypto.encode(i,u,Le(re({},c||{}),{encoding:f}))}catch(f){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),f}let p,_;try{p=await this.client.core.history.get(i,n);const f=p.request;try{_=this.getTVFParams(n,f.params,s)}catch(m){this.client.logger.warn(`sendResult() -> getTVFParams() failed: ${m==null?void 0:m.message}`)}}catch(f){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),f}if(h){const f=Rn(l,i,d);await K.Linking.openURL(f,this.client.name)}else{const f=p.request.method,m=Ie[f].res;m.tvf=Le(re({},_),{correlationId:n}),o?(m.internal=Le(re({},m.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,d,m)):this.client.core.relayer.publish(i,d,m).catch(y=>this.client.logger.error(y))}await this.client.core.history.resolve(u)}),x(this,"sendError",async e=>{const{id:n,topic:i,error:s,encodeOpts:o,rpcOpts:c,appLink:l}=e,u=Sc(n,s);let d;const h=l&&typeof(K==null?void 0:K.Linking)<"u";try{const _=h?jt:Me;d=await this.client.core.crypto.encode(i,u,Le(re({},o||{}),{encoding:_}))}catch(_){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),_}let p;try{p=await this.client.core.history.get(i,n)}catch(_){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),_}if(h){const _=Rn(l,i,d);await K.Linking.openURL(_,this.client.name)}else{const _=p.request.method,f=c||Ie[_].res;this.client.core.relayer.publish(i,d,f)}await this.client.core.history.resolve(u)}),x(this,"cleanup",async()=>{const e=[],n=[];this.client.session.getAll().forEach(i=>{let s=!1;Ut(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&e.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{Ut(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...e.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])}),x(this,"onProviderMessageEvent",async e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):await this.onRelayMessage(e)}),x(this,"onRelayEventRequest",async e=>{this.requestQueue.queue.push(e),await this.processRequestsQueue()}),x(this,"processRequestsQueue",async()=>{if(this.requestQueue.state===dt.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=dt.active;const e=this.requestQueue.queue.shift();if(e)try{await this.processRequest(e)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=dt.idle}),x(this,"processRequest",async e=>{const{topic:n,payload:i,attestation:s,transportType:o,encryptedId:c}=e,l=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:l}))switch(l){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:n,payload:i,attestation:s,encryptedId:c});case"wc_sessionSettle":return await this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,i);case"wc_sessionPing":return await this.onSessionPingRequest(n,i);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return await this.onSessionRequest({topic:n,payload:i,attestation:s,encryptedId:c,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:n,payload:i,attestation:s,encryptedId:c,transportType:o});default:return this.client.logger.info(`Unsupported request method ${l}`)}}),x(this,"onRelayEventResponse",async e=>{const{topic:n,payload:i,transportType:s}=e,o=(await this.client.core.history.get(n,i.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i,s);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${o}`)}}),x(this,"onRelayEventUnknownPayload",e=>{const{topic:n}=e,{message:i}=U("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)}),x(this,"shouldIgnorePairingRequest",e=>{const{topic:n,requestMethod:i}=e,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)}),x(this,"onSessionProposeRequest",async e=>{const{topic:n,payload:i,attestation:s,encryptedId:o}=e,{params:c,id:l}=i;try{const u=this.client.core.eventClient.getEvent({topic:n});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),u==null||u.setError(It.proposal_listener_not_found)),this.isValidConnect(re({},i.params));const d=c.expiryTimestamp||_e(Ie.wc_sessionPropose.req.ttl),h=re({id:l,pairingTopic:n,expiryTimestamp:d,attestation:s,encryptedId:o},c);await this.setProposal(l,h);const p=await this.getVerifyContext({attestationId:s,hash:Ye(JSON.stringify(i)),encryptedId:o,metadata:h.proposer.metadata});u==null||u.addTrace(ht.emit_session_proposal),this.client.events.emit("session_proposal",{id:l,params:h,verifyContext:p})}catch(u){await this.sendError({id:l,topic:n,error:u,rpcOpts:Ie.wc_sessionPropose.autoReject}),this.client.logger.error(u)}}),x(this,"onSessionProposeResponse",async(e,n,i)=>{const{id:s}=n;if(vt(n)){const{result:o}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const c=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:c});const l=c.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:l});const u=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:u});const d=await this.client.core.crypto.generateSharedKey(l,u);this.pendingSessions.set(s,{sessionTopic:d,pairingTopic:e,proposalId:s,publicKey:l});const h=await this.client.core.relayer.subscribe(d,{transportType:i});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:h}),await this.client.core.pairing.activate({topic:e})}else if(pt(n)){await this.deleteProposal(s);const o=te("session_connect",s);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(o,{error:n.error})}}),x(this,"onSessionSettleRequest",async(e,n)=>{const{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:c,expiry:l,namespaces:u,sessionProperties:d,scopedProperties:h,sessionConfig:p}=n.params,_=[...this.pendingSessions.values()].find(y=>y.sessionTopic===e);if(!_)return this.client.logger.error(`Pending session not found for topic ${e}`);const f=this.client.proposal.get(_.proposalId),m=Le(re(re(re({topic:e,relay:o,expiry:l,namespaces:u,acknowledged:!0,pairingTopic:_.pairingTopic,requiredNamespaces:f.requiredNamespaces,optionalNamespaces:f.optionalNamespaces,controller:c.publicKey,self:{publicKey:_.publicKey,metadata:this.client.metadata},peer:{publicKey:c.publicKey,metadata:c.metadata}},d&&{sessionProperties:d}),h&&{scopedProperties:h}),p&&{sessionConfig:p}),{transportType:se.relay});await this.client.session.set(m.topic,m),await this.setExpiry(m.topic,m.expiry),await this.client.core.pairing.updateMetadata({topic:_.pairingTopic,metadata:m.peer.metadata}),this.client.events.emit("session_connect",{session:m}),this.events.emit(te("session_connect",_.proposalId),{session:m}),this.pendingSessions.delete(_.proposalId),this.deleteProposal(_.proposalId,!1),this.cleanupDuplicatePairings(m),await this.sendResult({id:n.id,topic:e,result:!0})}catch(o){await this.sendError({id:i,topic:e,error:o}),this.client.logger.error(o)}}),x(this,"onSessionSettleResponse",async(e,n)=>{const{id:i}=n;vt(n)?(await this.client.session.update(e,{acknowledged:!0}),this.events.emit(te("session_approve",i),{})):pt(n)&&(await this.client.session.delete(e,ae("USER_DISCONNECTED")),this.events.emit(te("session_approve",i),{error:n.error}))}),x(this,"onSessionUpdateRequest",async(e,n)=>{const{params:i,id:s}=n;try{const o=`${e}_session_update`,c=Nr.get(o);if(c&&this.isRequestOutOfSync(c,s)){this.client.logger.warn(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:e,error:ae("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(re({topic:e},i));try{Nr.set(o,s),await this.client.session.update(e,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:e,result:!0})}catch(l){throw Nr.delete(o),l}this.client.events.emit("session_update",{id:s,topic:e,params:i})}catch(o){await this.sendError({id:s,topic:e,error:o}),this.client.logger.error(o)}}),x(this,"isRequestOutOfSync",(e,n)=>n.toString().slice(0,-3)<e.toString().slice(0,-3)),x(this,"onSessionUpdateResponse",(e,n)=>{const{id:i}=n,s=te("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);vt(n)?this.events.emit(te("session_update",i),{}):pt(n)&&this.events.emit(te("session_update",i),{error:n.error})}),x(this,"onSessionExtendRequest",async(e,n)=>{const{id:i}=n;try{this.isValidExtend({topic:e}),await this.setExpiry(e,_e(wr)),await this.sendResult({id:i,topic:e,result:!0}),this.client.events.emit("session_extend",{id:i,topic:e})}catch(s){await this.sendError({id:i,topic:e,error:s}),this.client.logger.error(s)}}),x(this,"onSessionExtendResponse",(e,n)=>{const{id:i}=n,s=te("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);vt(n)?this.events.emit(te("session_extend",i),{}):pt(n)&&this.events.emit(te("session_extend",i),{error:n.error})}),x(this,"onSessionPingRequest",async(e,n)=>{const{id:i}=n;try{this.isValidPing({topic:e}),await this.sendResult({id:i,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:e})}catch(s){await this.sendError({id:i,topic:e,error:s}),this.client.logger.error(s)}}),x(this,"onSessionPingResponse",(e,n)=>{const{id:i}=n,s=te("session_ping",i);setTimeout(()=>{if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners 2176`);vt(n)?this.events.emit(te("session_ping",i),{}):pt(n)&&this.events.emit(te("session_ping",i),{error:n.error})},500)}),x(this,"onSessionDeleteRequest",async(e,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:e,reason:n.params}),await Promise.all([new Promise(s=>{this.client.core.relayer.once(le.publish,async()=>{s(await this.deleteSession({topic:e,id:i}))})}),this.sendResult({id:i,topic:e,result:!0}),this.cleanupPendingSentRequestsForTopic({topic:e,error:ae("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}}),x(this,"onSessionRequest",async e=>{var n,i,s;const{topic:o,payload:c,attestation:l,encryptedId:u,transportType:d}=e,{id:h,params:p}=c;try{await this.isValidRequest(re({topic:o},p));const _=this.client.session.get(o),f=await this.getVerifyContext({attestationId:l,hash:Ye(JSON.stringify(Nt("wc_sessionRequest",p,h))),encryptedId:u,metadata:_.peer.metadata,transportType:d}),m={id:h,topic:o,params:p,verifyContext:f};await this.setPendingSessionRequest(m),d===se.link_mode&&(n=_.peer.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp((i=_.peer.metadata.redirect)==null?void 0:i.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(m):(this.addSessionRequestToSessionRequestQueue(m),this.processSessionRequestQueue())}catch(_){await this.sendError({id:h,topic:o,error:_}),this.client.logger.error(_)}}),x(this,"onSessionRequestResponse",(e,n)=>{const{id:i}=n,s=te("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);vt(n)?this.events.emit(te("session_request",i),{result:n.result}):pt(n)&&this.events.emit(te("session_request",i),{error:n.error})}),x(this,"onSessionEventRequest",async(e,n)=>{const{id:i,params:s}=n;try{const o=`${e}_session_event_${s.event.name}`,c=Nr.get(o);if(c&&this.isRequestOutOfSync(c,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(re({topic:e},s)),this.client.events.emit("session_event",{id:i,topic:e,params:s}),Nr.set(o,i)}catch(o){await this.sendError({id:i,topic:e,error:o}),this.client.logger.error(o)}}),x(this,"onSessionAuthenticateResponse",(e,n)=>{const{id:i}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:e,payload:n}),vt(n)?this.events.emit(te("session_request",i),{result:n.result}):pt(n)&&this.events.emit(te("session_request",i),{error:n.error})}),x(this,"onSessionAuthenticateRequest",async e=>{var n;const{topic:i,payload:s,attestation:o,encryptedId:c,transportType:l}=e;try{const{requester:u,authPayload:d,expiryTimestamp:h}=s.params,p=await this.getVerifyContext({attestationId:o,hash:Ye(JSON.stringify(s)),encryptedId:c,metadata:u.metadata,transportType:l}),_={requester:u,pairingTopic:i,id:s.id,authPayload:d,verifyContext:p,expiryTimestamp:h};await this.setAuthRequest(s.id,{request:_,pairingTopic:i,transportType:l}),l===se.link_mode&&(n=u.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp(u.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:i,params:s.params,id:s.id,verifyContext:p})}catch(u){this.client.logger.error(u);const d=s.params.requester.publicKey,h=await this.client.core.crypto.generateKeyPair(),p=this.getAppLinkIfEnabled(s.params.requester.metadata,l),_={type:Pt,receiverPublicKey:d,senderPublicKey:h};await this.sendError({id:s.id,topic:i,error:u,encodeOpts:_,rpcOpts:Ie.wc_sessionAuthenticate.autoReject,appLink:p})}}),x(this,"addSessionRequestToSessionRequestQueue",e=>{this.sessionRequestQueue.queue.push(e)}),x(this,"cleanupAfterResponse",e=>{this.deletePendingSessionRequest(e.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=dt.idle,this.processSessionRequestQueue()},q.toMiliseconds(this.requestQueueDelay))}),x(this,"cleanupPendingSentRequestsForTopic",({topic:e,error:n})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===e&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,c=te("session_request",o);if(this.events.listenerCount(c)===0)throw new Error(`emitting ${c} without any listeners`);this.events.emit(te("session_request",s.request.id),{error:n})})}),x(this,"processSessionRequestQueue",()=>{if(this.sessionRequestQueue.state===dt.active){this.client.logger.info("session request queue is already active.");return}const e=this.sessionRequestQueue.queue[0];if(!e){this.client.logger.info("session request queue is empty.");return}try{this.emitSessionRequest(e)}catch(n){this.client.logger.error(n)}}),x(this,"emitSessionRequest",e=>{if(this.emittedSessionRequests.has(e.id)){this.client.logger.warn({id:e.id},`Skipping emitting \`session_request\` event for duplicate request. id: ${e.id}`);return}this.sessionRequestQueue.state=dt.active,this.emittedSessionRequests.add(e.id),this.client.events.emit("session_request",e)}),x(this,"onPairingCreated",e=>{if(e.methods&&this.expectedPairingMethodMap.set(e.topic,e.methods),e.active)return;const n=this.client.proposal.getAll().find(i=>i.pairingTopic===e.topic);n&&this.onSessionProposeRequest({topic:e.topic,payload:Nt("wc_sessionPropose",Le(re({},n),{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties,scopedProperties:n.scopedProperties}),n.id),attestation:n.attestation,encryptedId:n.encryptedId})}),x(this,"isValidConnect",async e=>{if(!Ne(e)){const{message:u}=U("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(e)}`);throw new Error(u)}const{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,scopedProperties:c,relays:l}=e;if(fe(n)||await this.isValidPairingTopic(n),!Aw(l)){const{message:u}=U("MISSING_OR_INVALID",`connect() relays: ${l}`);throw new Error(u)}if(!fe(i)&&ln(i)!==0){const u="requiredNamespaces are deprecated and are automatically assigned to optionalNamespaces";["fatal","error","silent"].includes(this.client.logger.level)?console.warn(u):this.client.logger.warn(u),this.validateNamespaces(i,"requiredNamespaces")}if(!fe(s)&&ln(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),fe(o)||this.validateSessionProps(o,"sessionProperties"),!fe(c)){this.validateSessionProps(c,"scopedProperties");const u=Object.keys(i||{}).concat(Object.keys(s||{}));if(!Object.keys(c).every(d=>u.includes(d.split(":")[0])))throw new Error(`Scoped properties must be a subset of required/optional namespaces, received: ${JSON.stringify(c)}, required/optional namespaces: ${JSON.stringify(u)}`)}}),x(this,"validateNamespaces",(e,n)=>{const i=Iw(e,"connect()",n);if(i)throw new Error(i.message)}),x(this,"isValidApprove",async e=>{if(!Ne(e))throw new Error(U("MISSING_OR_INVALID",`approve() params: ${e}`).message);const{id:n,namespaces:i,relayProtocol:s,sessionProperties:o,scopedProperties:c}=e;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const l=this.client.proposal.get(n),u=Oi(i,"approve()");if(u)throw new Error(u.message);const d=$a(l.requiredNamespaces,i,"approve()");if(d)throw new Error(d.message);if(!he(s,!0)){const{message:h}=U("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(h)}if(fe(o)||this.validateSessionProps(o,"sessionProperties"),!fe(c)){this.validateSessionProps(c,"scopedProperties");const h=new Set(Object.keys(i));if(!Object.keys(c).every(p=>h.has(p.split(":")[0])))throw new Error(`Scoped properties must be a subset of approved namespaces, received: ${JSON.stringify(c)}, approved namespaces: ${Array.from(h).join(", ")}`)}}),x(this,"isValidReject",async e=>{if(!Ne(e)){const{message:s}=U("MISSING_OR_INVALID",`reject() params: ${e}`);throw new Error(s)}const{id:n,reason:i}=e;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!Pw(i)){const{message:s}=U("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}}),x(this,"isValidSessionSettleRequest",e=>{if(!Ne(e)){const{message:u}=U("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${e}`);throw new Error(u)}const{relay:n,controller:i,namespaces:s,expiry:o}=e;if(!hu(n)){const{message:u}=U("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(u)}const c=yw(i,"onSessionSettleRequest()");if(c)throw new Error(c.message);const l=Oi(s,"onSessionSettleRequest()");if(l)throw new Error(l.message);if(Ut(o)){const{message:u}=U("EXPIRED","onSessionSettleRequest()");throw new Error(u)}}),x(this,"isValidUpdate",async e=>{if(!Ne(e)){const{message:l}=U("MISSING_OR_INVALID",`update() params: ${e}`);throw new Error(l)}const{topic:n,namespaces:i}=e;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const s=this.client.session.get(n),o=Oi(i,"update()");if(o)throw new Error(o.message);const c=$a(s.requiredNamespaces,i,"update()");if(c)throw new Error(c.message)}),x(this,"isValidExtend",async e=>{if(!Ne(e)){const{message:i}=U("MISSING_OR_INVALID",`extend() params: ${e}`);throw new Error(i)}const{topic:n}=e;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)}),x(this,"isValidRequest",async e=>{if(!Ne(e)){const{message:l}=U("MISSING_OR_INVALID",`request() params: ${e}`);throw new Error(l)}const{topic:n,request:i,chainId:s,expiry:o}=e;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:c}=this.client.session.get(n);if(!Ca(c,s)){const{message:l}=U("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(l)}if(!Ow(i)){const{message:l}=U("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(l)}if(!Dw(c,s,i.method)){const{message:l}=U("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(l)}if(o&&!Cw(o,xi)){const{message:l}=U("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${xi.min} and ${xi.max}`);throw new Error(l)}}),x(this,"isValidRespond",async e=>{var n;if(!Ne(e)){const{message:o}=U("MISSING_OR_INVALID",`respond() params: ${e}`);throw new Error(o)}const{topic:i,response:s}=e;try{await this.isValidSessionTopic(i)}catch(o){throw(n=e==null?void 0:e.response)!=null&&n.id&&this.cleanupAfterResponse(e),o}if(!Rw(s)){const{message:o}=U("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}}),x(this,"isValidPing",async e=>{if(!Ne(e)){const{message:i}=U("MISSING_OR_INVALID",`ping() params: ${e}`);throw new Error(i)}const{topic:n}=e;await this.isValidSessionOrPairingTopic(n)}),x(this,"isValidEmit",async e=>{if(!Ne(e)){const{message:c}=U("MISSING_OR_INVALID",`emit() params: ${e}`);throw new Error(c)}const{topic:n,event:i,chainId:s}=e;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!Ca(o,s)){const{message:c}=U("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(c)}if(!Lw(i)){const{message:c}=U("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(c)}if(!Vw(o,s,i.name)){const{message:c}=U("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(c)}}),x(this,"isValidDisconnect",async e=>{if(!Ne(e)){const{message:i}=U("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw new Error(i)}const{topic:n}=e;await this.isValidSessionOrPairingTopic(n)}),x(this,"isValidAuthenticate",e=>{const{chains:n,uri:i,domain:s,nonce:o}=e;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!he(i,!1))throw new Error("uri is required parameter");if(!he(s,!1))throw new Error("domain is required parameter");if(!he(o,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(l=>Sn(l).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:c}=Sn(n[0]);if(c!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")}),x(this,"getVerifyContext",async e=>{const{attestationId:n,hash:i,encryptedId:s,metadata:o,transportType:c}=e,l={verified:{verifyUrl:o.verifyUrl||Yr,validation:"UNKNOWN",origin:o.url||""}};try{if(c===se.link_mode){const d=this.getAppLinkIfEnabled(o,c);return l.verified.validation=d&&new URL(d).origin===new URL(o.url).origin?"VALID":"INVALID",l}const u=await this.client.core.verify.resolve({attestationId:n,hash:i,encryptedId:s,verifyUrl:o.verifyUrl});u&&(l.verified.origin=u.origin,l.verified.isScam=u.isScam,l.verified.validation=u.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(u){this.client.logger.warn(u)}return this.client.logger.debug(`Verify context: ${JSON.stringify(l)}`),l}),x(this,"validateSessionProps",(e,n)=>{Object.values(e).forEach((i,s)=>{if(i==null){const{message:o}=U("MISSING_OR_INVALID",`${n} must contain an existing value for each key. Received: ${i} for key ${Object.keys(e)[s]}`);throw new Error(o)}})}),x(this,"getPendingAuthRequest",e=>{const n=this.client.auth.requests.get(e);return typeof n=="object"?n:void 0}),x(this,"addToRecentlyDeleted",(e,n)=>{if(this.recentlyDeletedMap.set(e,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(o)}}}),x(this,"checkRecentlyDeleted",e=>{const n=this.recentlyDeletedMap.get(e);if(n){const{message:i}=U("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${e}`);throw new Error(i)}}),x(this,"isLinkModeEnabled",(e,n)=>{var i,s,o,c,l,u,d,h,p;return!e||n!==se.link_mode?!1:((s=(i=this.client.metadata)==null?void 0:i.redirect)==null?void 0:s.linkMode)===!0&&((c=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:c.universal)!==void 0&&((u=(l=this.client.metadata)==null?void 0:l.redirect)==null?void 0:u.universal)!==""&&((d=e==null?void 0:e.redirect)==null?void 0:d.universal)!==void 0&&((h=e==null?void 0:e.redirect)==null?void 0:h.universal)!==""&&((p=e==null?void 0:e.redirect)==null?void 0:p.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(e.redirect.universal)&&typeof(K==null?void 0:K.Linking)<"u"}),x(this,"getAppLinkIfEnabled",(e,n)=>{var i;return this.isLinkModeEnabled(e,n)?(i=e==null?void 0:e.redirect)==null?void 0:i.universal:void 0}),x(this,"handleLinkModeMessage",({url:e})=>{if(!e||!e.includes("wc_ev")||!e.includes("topic"))return;const n=Go(e,"topic")||"",i=decodeURIComponent(Go(e,"wc_ev")||""),s=this.client.session.keys.includes(n);s&&this.client.session.update(n,{transportType:se.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:i,sessionExists:s})}),x(this,"registerLinkModeListeners",async()=>{var e;if(Ws()||Wt()&&(e=this.client.metadata.redirect)!=null&&e.linkMode){const n=K==null?void 0:K.Linking;if(typeof n<"u"){n.addEventListener("url",this.handleLinkModeMessage,this.client.name);const i=await n.getInitialURL();i&&setTimeout(()=>{this.handleLinkModeMessage({url:i})},50)}}}),x(this,"getTVFParams",(e,n,i)=>{var s,o,c;if(!((s=n.request)!=null&&s.method))return{};const l={correlationId:e,rpcMethods:[n.request.method],chainId:n.chainId};try{const u=this.extractTxHashesFromResult(n.request,i);l.txHashes=u,l.contractAddresses=this.isValidContractData(n.request.params)?[(c=(o=n.request.params)==null?void 0:o[0])==null?void 0:c.to]:[]}catch(u){this.client.logger.warn("Error getting TVF params",u)}return l}),x(this,"isValidContractData",e=>{var n;if(!e)return!1;try{const i=(e==null?void 0:e.data)||((n=e==null?void 0:e[0])==null?void 0:n.data);if(!i.startsWith("0x"))return!1;const s=i.slice(2);return/^[0-9a-fA-F]*$/.test(s)?s.length%2===0:!1}catch{}return!1}),x(this,"extractTxHashesFromResult",(e,n)=>{var i;try{if(!n)return[];const s=e.method,o=kv[s];if(s==="sui_signTransaction")return[rm(n.transactionBytes)];if(s==="near_signTransaction")return[ra(n)];if(s==="near_signTransactions")return n.map(l=>ra(l));if(s==="xrpl_signTransactionFor"||s==="xrpl_signTransaction")return[(i=n.tx_json)==null?void 0:i.hash];if(s==="polkadot_signTransaction")return[Jw({transaction:e.params.transactionPayload,signature:n.signature})];if(s==="algo_signTxn")return Ir(n)?n.map(l=>na(l)):[na(n)];if(s==="cosmos_signDirect")return[im(n)];if(typeof n=="string")return[n];const c=n[o.key];if(Ir(c))return s==="solana_signAllTransactions"?c.map(l=>tm(l)):c;if(typeof c=="string")return[c]}catch(s){this.client.logger.warn("Error extracting tx hashes from result",s)}return[]})}async processPendingMessageEvents(){try{const t=this.client.session.keys,e=this.client.core.relayer.messages.getWithoutAck(t);for(const[n,i]of Object.entries(e))for(const s of i)try{await this.onProviderMessageEvent({topic:n,message:s,publishedAt:Date.now()})}catch{this.client.logger.warn(`Error processing pending message event for topic: ${n}, message: ${s}`)}}catch(t){this.client.logger.warn("processPendingMessageEvents failed",t)}}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(le.message,t=>{this.onProviderMessageEvent(t)})}async onRelayMessage(t){const{topic:e,message:n,attestation:i,transportType:s}=t,{publicKey:o}=this.client.auth.authKeys.keys.includes(kn)?this.client.auth.authKeys.get(kn):{publicKey:void 0};try{const c=await this.client.core.crypto.decode(e,n,{receiverPublicKey:o,encoding:s===se.link_mode?jt:Me});Ss(c)?(this.client.core.history.set(e,c),await this.onRelayEventRequest({topic:e,payload:c,attestation:i,transportType:s,encryptedId:Ye(n)})):xs(c)?(await this.client.core.history.resolve(c),await this.onRelayEventResponse({topic:e,payload:c,transportType:s}),this.client.core.history.delete(e,c.id)):await this.onRelayEventUnknownPayload({topic:e,payload:c,transportType:s}),await this.client.core.relayer.messages.ack(e,n)}catch(c){this.client.logger.error(c)}}registerExpirerEvents(){this.client.core.expirer.on(Qe.expired,async t=>{const{topic:e,id:n}=gl(t.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,U("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,U("EXPIRED"),!0);e?this.client.session.keys.includes(e)&&(await this.deleteSession({topic:e,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:e})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(Qt.create,t=>this.onPairingCreated(t)),this.client.core.pairing.events.on(Qt.delete,t=>{this.addToRecentlyDeleted(t.topic,"pairing")})}isValidPairingTopic(t){if(!he(t,!1)){const{message:e}=U("MISSING_OR_INVALID",`pairing topic should be a string: ${t}`);throw new Error(e)}if(!this.client.core.pairing.pairings.keys.includes(t)){const{message:e}=U("NO_MATCHING_KEY",`pairing topic doesn't exist: ${t}`);throw new Error(e)}if(Ut(this.client.core.pairing.pairings.get(t).expiry)){const{message:e}=U("EXPIRED",`pairing topic: ${t}`);throw new Error(e)}}async isValidSessionTopic(t){if(!he(t,!1)){const{message:e}=U("MISSING_OR_INVALID",`session topic should be a string: ${t}`);throw new Error(e)}if(this.checkRecentlyDeleted(t),!this.client.session.keys.includes(t)){const{message:e}=U("NO_MATCHING_KEY",`session topic doesn't exist: ${t}`);throw new Error(e)}if(Ut(this.client.session.get(t).expiry)){await this.deleteSession({topic:t});const{message:e}=U("EXPIRED",`session topic: ${t}`);throw new Error(e)}if(!this.client.core.crypto.keychain.has(t)){const{message:e}=U("MISSING_OR_INVALID",`session topic does not exist in keychain: ${t}`);throw await this.deleteSession({topic:t}),new Error(e)}}async isValidSessionOrPairingTopic(t){if(this.checkRecentlyDeleted(t),this.client.session.keys.includes(t))await this.isValidSessionTopic(t);else if(this.client.core.pairing.pairings.keys.includes(t))this.isValidPairingTopic(t);else if(he(t,!1)){const{message:e}=U("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${t}`);throw new Error(e)}else{const{message:e}=U("MISSING_OR_INVALID",`session or pairing topic should be a string: ${t}`);throw new Error(e)}}async isValidProposalId(t){if(!Tw(t)){const{message:e}=U("MISSING_OR_INVALID",`proposal id should be a number: ${t}`);throw new Error(e)}if(!this.client.proposal.keys.includes(t)){const{message:e}=U("NO_MATCHING_KEY",`proposal id doesn't exist: ${t}`);throw new Error(e)}if(Ut(this.client.proposal.get(t).expiryTimestamp)){await this.deleteProposal(t);const{message:e}=U("EXPIRED",`proposal id: ${t}`);throw new Error(e)}}}class Zv extends hr{constructor(t,e){super(t,e,xv,ao),this.core=t,this.logger=e}}class Qv extends hr{constructor(t,e){super(t,e,Cv,ao),this.core=t,this.logger=e}}class Yv extends hr{constructor(t,e){super(t,e,Nv,ao,n=>n.id),this.core=t,this.logger=e}}class Xv extends hr{constructor(t,e){super(t,e,Bv,li,()=>kn),this.core=t,this.logger=e}}class eb extends hr{constructor(t,e){super(t,e,jv,li),this.core=t,this.logger=e}}class tb extends hr{constructor(t,e){super(t,e,zv,li,n=>n.id),this.core=t,this.logger=e}}var rb=Object.defineProperty,nb=(r,t,e)=>t in r?rb(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ci=(r,t,e)=>nb(r,typeof t!="symbol"?t+"":t,e);class ib{constructor(t,e){this.core=t,this.logger=e,Ci(this,"authKeys"),Ci(this,"pairingTopics"),Ci(this,"requests"),this.authKeys=new Xv(this.core,this.logger),this.pairingTopics=new eb(this.core,this.logger),this.requests=new tb(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}var sb=Object.defineProperty,ob=(r,t,e)=>t in r?sb(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Z=(r,t,e)=>ob(r,typeof t!="symbol"?t+"":t,e);class co extends jp{constructor(t){super(t),Z(this,"protocol",Lu),Z(this,"version",Du),Z(this,"name",Si.name),Z(this,"metadata"),Z(this,"core"),Z(this,"logger"),Z(this,"events",new lr.EventEmitter),Z(this,"engine"),Z(this,"session"),Z(this,"proposal"),Z(this,"pendingRequest"),Z(this,"auth"),Z(this,"signConfig"),Z(this,"on",(n,i)=>this.events.on(n,i)),Z(this,"once",(n,i)=>this.events.once(n,i)),Z(this,"off",(n,i)=>this.events.off(n,i)),Z(this,"removeListener",(n,i)=>this.events.removeListener(n,i)),Z(this,"removeAllListeners",n=>this.events.removeAllListeners(n)),Z(this,"connect",async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}}),Z(this,"pair",async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}}),Z(this,"approve",async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}}),Z(this,"reject",async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}}),Z(this,"update",async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}}),Z(this,"extend",async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}}),Z(this,"request",async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}}),Z(this,"respond",async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}}),Z(this,"ping",async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}}),Z(this,"emit",async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}}),Z(this,"disconnect",async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}}),Z(this,"find",n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}}),Z(this,"getPendingSessionRequests",()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}}),Z(this,"authenticate",async(n,i)=>{try{return await this.engine.authenticate(n,i)}catch(s){throw this.logger.error(s.message),s}}),Z(this,"formatAuthMessage",n=>{try{return this.engine.formatAuthMessage(n)}catch(i){throw this.logger.error(i.message),i}}),Z(this,"approveSessionAuthenticate",async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}}),Z(this,"rejectSessionAuthenticate",async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}}),this.name=(t==null?void 0:t.name)||Si.name,this.metadata=W_(t==null?void 0:t.metadata),this.signConfig=t==null?void 0:t.signConfig;const e=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:ei(Ks({level:(t==null?void 0:t.logger)||Si.logger}));this.core=(t==null?void 0:t.core)||new Sv(t),this.logger=Ce(e,this.name),this.session=new Qv(this.core,this.logger),this.proposal=new Zv(this.core,this.logger),this.pendingRequest=new Yv(this.core,this.logger),this.engine=new Jv(this),this.auth=new ib(this.core,this.logger)}static async init(t){const e=new co(t);return await e.initialize(),e}get context(){return Ke(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success")}catch(t){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(t.message),t}}}const ab=co,cb="08c4b07e3ad25f1a27c14a4e8cecb6f0",xI="eip155";async function lb(r){const{account:t,chainId:e,params:[n]}=r;if(!t.sendRawTransaction)throw new Error("The current account does not support sending raw transactions");return(await t.sendRawTransaction({chainId:e,rawTransaction:n})).transactionHash}function ui(r,t){if(mo(r.address)!==mo(t))throw new Error(`Failed to validate account address (${r.address}), differs from ${t}`)}function CI(r){const t=r.split(":"),e=Number.parseInt(t[1]??"0");if(t.length!==2||t[0]!=="eip155"||e===0||!e)throw new Error(`Invalid chainId ${r}, should have the format 'eip155:1'`);return e}async function ub(r){const{account:t,chainId:e,thirdwebClient:n,params:[i]}=r;i.from!==void 0&&ui(t,i.from);const s=Bi({chain:ge(e),client:n,data:i.data,gas:i.gas?Ve(i.gas):void 0,gasPrice:i.gasPrice?Ve(i.gasPrice):void 0,to:i.to,value:i.value?Ve(i.value):void 0});return(await Tc({account:t,transaction:s})).transactionHash}async function dc(r){const{account:t,params:e}=r;return ui(t,e[1]),t.signMessage({message:{raw:e[0]}})}async function db(r){const{account:t,params:[e]}=r;if(!t.signTransaction)throw new Error("The current account does not support signing transactions");return e.from!==void 0&&ui(t,e.from),t.signTransaction({data:e.data,gas:e.gas?Ve(e.gas):void 0,gasPrice:e.gasPrice?Ve(e.gasPrice):void 0,nonce:e.nonce?ir(e.nonce):void 0,to:e.to,value:e.value?Ve(e.value):void 0})}async function hc(r){const{account:t,params:e}=r;return ui(t,e[0]),t.signTypedData(typeof e[1]=="string"?JSON.parse(e[1]):e[1])}async function Su(r){var n;const{wallet:t,params:e}=r;return((n=t.getChain())==null?void 0:n.id)===ir(e[0].chainId)||await t.switchChain(Ed(ir(e[0].chainId))),"0x1"}const $I=Object.freeze(Object.defineProperty({__proto__:null,handleSwitchChain:Su},Symbol.toStringTag,{value:"Module"})),kI="/sdk/2022-08-12/embedded-wallet",$i=r=>`thirdwebEwsWalletUserId-${r}`,hb="walletToken",ki=r=>`${hb}-${r}`,pc=r=>`passkey-credential-id-${r}`,pb="a",Ni=(r,t)=>`${pb}-${r}-${t}`,_c=r=>`walletConnectSessions-${r}`,fc=r=>`thirdweb_guest_session_id_${r}`,mc=new Map;class lo{constructor({storage:t,clientId:e,ecosystem:n}){Object.defineProperty(this,"key",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"storage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.storage=t,this.key=_b(e,n==null?void 0:n.id),this.ecosystem=n}async getItem(t){return this.storage?this.storage.getItem(t):mc.get(t)??null}async setItem(t,e){if(this.storage)return this.storage.setItem(t,e);mc.set(t,e)}async removeItem(t){const e=await this.getItem(t);return this.storage&&e?(this.storage.removeItem(t),!0):!1}async getWalletConnectSessions(){return this.getItem(_c(this.key))}async saveWalletConnectSessions(t){await this.setItem(_c(this.key),t)}async savePasskeyCredentialId(t){await this.setItem(pc(this.key),t)}async getPasskeyCredentialId(){return this.getItem(pc(this.key))}async saveAuthCookie(t){await this.setItem(ki(this.key),t)}async getAuthCookie(){return this.getItem(ki(this.key))}async removeAuthCookie(){return this.removeItem(ki(this.key))}async saveDeviceShare(t,e){await this.saveWalletUserId(e),await this.setItem(Ni(this.key,e),t)}async getDeviceShare(){const t=await this.getWalletUserId();return t?this.getItem(Ni(this.key,t)):null}async removeDeviceShare(){const t=await this.getWalletUserId();return t?this.removeItem(Ni(this.key,t)):!1}async getWalletUserId(){return this.getItem($i(this.key))}async saveWalletUserId(t){await this.setItem($i(this.key),t)}async removeWalletUserId(){return this.removeItem($i(this.key))}async getGuestSessionId(){return this.getItem(fc(this.key))}async saveGuestSessionId(t){await this.setItem(fc(this.key),t)}}const _b=(r,t)=>`${r}${t?`-${t}`:""}`;let mt;async function xu(){if(!mt)return[];const r=await mt.getWalletConnectSessions();return JSON.parse(r??"[]")}function fb(r){mt||(mt=new lo({clientId:r.clientId,storage:null}))}async function NI(r){if(!mt)return;const t=await mt.getWalletConnectSessions(),e=JSON.parse(t??"[]");e.push(r),await mt.saveWalletConnectSessions(we(e))}async function mb(r){if(!mt)return;const t=await mt.getWalletConnectSessions(),n=JSON.parse(t??"[]").filter(i=>i.topic!==r.topic);await mt.saveWalletConnectSessions(we(n))}let Ui=new WeakMap;const yb={eth_sendRawTransaction:lb,eth_sendTransaction:ub,eth_sign:dc,eth_signTransaction:db,eth_signTypedData:hc,eth_signTypedData_v4:hc,personal_sign:dc,wallet_addEthereumChain:r=>{throw new Error("Unsupported request method: wallet_addEthereumChain")},wallet_switchEthereumChain:Su};async function wb(r){var d,h,p,_;const{wallet:t,requestHandlers:e,onConnect:n,onDisconnect:i,client:s}=r,o=r.chains&&r.chains.length>10?(console.warn("WalletConnect: Can specify no more than 10 chains, truncating to the first 10 provided chains..."),r.chains.slice(0,10)):r.chains;if(Ui.has(s))return Ui.get(s);fb({clientId:r.client.clientId});const c=jn(),l=await ab.init({metadata:{description:((d=r.appMetadata)==null?void 0:d.description)??c.description,icons:[((h=r.appMetadata)==null?void 0:h.logoUrl)??c.logoUrl],name:((p=r.appMetadata)==null?void 0:p.name)??c.name,url:((_=r.appMetadata)==null?void 0:_.url)??c.url},projectId:r.projectId??cb});l.on("session_proposal",async f=>{const{onSessionProposal:m}=await a(async()=>{const{onSessionProposal:y}=await import("./session-proposal-C0kfr8bU.js");return{onSessionProposal:y}},__vite__mapDeps([19,1,2,3,4,5,6,7]));await m({chains:o,event:f,onConnect:n,wallet:t,walletConnectClient:l}).catch(y=>{if(r.onError)r.onError(y);else throw y})}),l.on("session_request",async f=>{const{fulfillRequest:m}=await a(async()=>{const{fulfillRequest:y}=await import("./session-request-Bl3tqUKv.js");return{fulfillRequest:y}},__vite__mapDeps([20,1,2,3,4,5,6,7]));await m({event:f,handlers:e,thirdwebClient:s,wallet:t,walletConnectClient:l}).catch(y=>{if(r.onError)r.onError(y);else throw y})}),l.on("session_event",async f=>{}),l.on("session_ping",f=>{}),l.on("session_delete",async f=>{await Cu({session:{topic:f.topic},walletConnectClient:l}).catch(m=>{if(r.onError)r.onError(m);else throw m})});const u=l.disconnect;return l.disconnect=async f=>{const m=await u(f).catch(()=>{});return i&&vb({onDisconnect:i,topic:f.topic}),m},Ui.set(r.client,l),l}function gb(r){const{uri:t,walletConnectClient:e}=r;e.core.pairing.pair({uri:t})}async function Eb(){return xu()}async function Cu(r){mb(r.session);try{await r.walletConnectClient.disconnect({reason:{code:6e3,message:"Disconnected"},topic:r.session.topic})}catch{}}async function vb(r){const{topic:t,onDisconnect:e}=r,n=await xu();e(n.find(i=>i.topic===t)??{topic:t})}function bb(r){return[ot("inApp",{executionMode:r==null?void 0:r.executionMode}),ot(Cc),ot(_t,{appMetadata:r==null?void 0:r.appMetadata,chains:r==null?void 0:r.chains}),ot(rh),ot("io.rabby"),ot(nh),ot("com.okex.wallet")]}function Ib(r,t){const e=new Set;let n=r();const i=()=>{for(const o of e)o()},s=o=>{n=o,i()};for(const o of t)o.subscribe(()=>{s(r())});return{getValue(){return n},subscribe(o){return e.add(o),()=>{e.delete(o)}}}}function Ln(r,t,e=!0){e&&r();const n=t.map(i=>i.subscribe(()=>{r()}));return()=>{for(const i of n)i()}}const un="tw:connected-wallet-params";async function UI(r,t,e){if(!Tb(e))throw new Error("given params are not stringifiable");const n=await r.getItem(un);let i;if(n){try{i=JSON.parse(n)}catch{i={}}i[t]=e}else i={[t]:e};r.setItem(un,we(i))}async function Ab(r,t){const e=await r.getItem(un);let n;if(e){try{n=JSON.parse(e)}catch{n={}}delete n[t],r.setItem(un,we(n))}}async function qI(r,t){const e=await r.getItem(un);if(!e)return null;try{const n=JSON.parse(e);return n!=null&&n[t]?n[t]:null}catch{return null}}function Tb(r){try{return we(r),!0}catch{return!1}}function Pb(r){let t;return()=>(t||(t=r()),t)}function Ob(r={}){return Rc({filters:r,signature:"event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason)"})}function Rb(r={}){return Rc({filters:r,signature:"event PostOpRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason)"})}function Lb(r){const{receipt:t}=r,e={...t,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,contractAddress:t.contractAddress?t.contractAddress:null,cumulativeGasUsed:t.cumulativeGasUsed?BigInt(t.cumulativeGasUsed):null,effectiveGasPrice:t.effectiveGasPrice?BigInt(t.effectiveGasPrice):null,gasUsed:t.gasUsed?BigInt(t.gasUsed):null,logs:t.logs,status:t.status,to:t.to?t.to:null,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex,type:t.type};return t.blobGasPrice&&(e.blobGasPrice=BigInt(t.blobGasPrice)),t.blobGasUsed&&(e.blobGasUsed=BigInt(t.blobGasUsed)),{...r,actualGasCost:BigInt(r.actualGasCost),actualGasUsed:BigInt(r.actualGasUsed),nonce:BigInt(r.nonce),receipt:e,userOpHash:r.userOpHash}}const MI=()=>{const r=BigInt(Math.floor(Math.random()*4294967296)),t=BigInt(Math.floor(Math.random()*4294967296)),e=BigInt(Math.floor(Math.random()*4294967296)),n=BigInt(Math.floor(Math.random()*4294967296)),i=BigInt(Math.floor(Math.random()*4294967296)),s=BigInt(Math.floor(Math.random()*4294967296));return r<<BigInt(160)|t<<BigInt(128)|e<<BigInt(96)|n<<BigInt(64)|i<<BigInt(32)|s};function $u(r){return Object.fromEntries(Object.entries(r).map(([t,e])=>[t,e==null||Un(e)?e:Vs(e)]))}async function BI(r){return Ht({...r,operation:"eth_sendUserOperation",params:[$u(r.userOp),r.options.entrypointAddress??Dc]})}async function jI(r,t){const e=await Ht({...r,operation:"eth_estimateUserOperationGas",params:[$u(r.userOp),r.options.entrypointAddress??Dc,t??{}]});return{callGasLimit:Ve(e.callGasLimit)+Id,paymasterPostOpGasLimit:e.paymasterPostOpGasLimit!==void 0?Ve(e.paymasterPostOpGasLimit):void 0,paymasterVerificationGasLimit:e.paymasterVerificationGasLimit!==void 0?Ve(e.paymasterVerificationGasLimit):void 0,preVerificationGas:Ve(e.preVerificationGas),verificationGas:e.verificationGas!==void 0?Ve(e.verificationGas):void 0,verificationGasLimit:Ve(e.verificationGasLimit)}}async function zI(r){const t=await Ht({...r,operation:"thirdweb_getUserOperationGasPrice",params:[]});return{maxFeePerGas:Ve(t.maxFeePerGas),maxPriorityFeePerGas:Ve(t.maxPriorityFeePerGas)}}async function KI(r){var e,n;const t=await Db(r);if(t){if(t.success===!1){const s=(n=(e=vd({events:[Ob(),Rb()],logs:t.logs})[0])==null?void 0:e.args)==null?void 0:n.revertReason;if(!s)throw new Error(`UserOp failed at txHash: ${t.receipt.transactionHash}`);const o=bd({data:s});throw new Error(`UserOp failed with reason: '${o.args.join(",")}' at txHash: ${t.receipt.transactionHash}`)}return t.receipt}}async function Db(r){const t=await Ht({operation:"eth_getUserOperationReceipt",options:r,params:[r.userOpHash]});if(t)return Lb(t)}async function FI(r){const t=await Ht({operation:"zk_paymasterData",options:r.options,params:[r.transaction]});return{paymaster:t.paymaster,paymasterInput:t.paymasterInput}}async function Vb(r){const t=await Ht({...r,operation:"tw_execute",params:[r.eoaAddress,r.wrappedCalls,r.signature,r.authorization]});if(!t.queueId)throw new Error(`Error executing 7702 transaction: ${we(t)}`);return{transactionId:t.queueId}}async function Sb(r){return{transactionHash:(await Ht({...r,operation:"tw_getTransactionHash",params:[r.transactionId]})).transactionHash}}async function WI(r){return{transactionHash:(await Ht({operation:"zk_broadcastTransaction",options:r.options,params:[{...r.transaction,signedTransaction:r.signedTransaction}]})).transactionHash}}async function Ht(r){const{options:t,operation:e,params:n}=r,i=t.bundlerUrl??Lc(t.chain),o=await dn(t.client)(i,{useAuthToken:!0,body:we({id:1,jsonrpc:"2.0",method:e,params:n}),headers:{"Content-Type":"application/json"},method:"POST"}),c=await o.json();if(!o.ok||c.error){let l=c.error||o.statusText;typeof l=="object"&&(l=we(l));const u=c.code||"UNKNOWN";throw new Error(`${e} error: ${l}
|
|
13
13
|
Status: ${o.status}
|
|
14
|
-
Code: ${u}`)}return c.result}function bs(r){if(!r)return!1;if(r.id==="smart")return!0;if(r.id==="inApp"||Pr(r)){const t=r.getConfig();if(t&&"smartAccount"in t&&t.smartAccount)return!0;if(t!=null&&t.executionMode){const e=t.executionMode;return e.mode==="EIP4337"||e.mode==="EIP7702"}}return!1}const ku="thirdweb:connected-wallet-ids",Nn="thirdweb:active-wallet-id",Is="thirdweb:active-chain",yc="thirdweb:last-used-wallet-id";function xb(r){const t=Gt(void 0),e=Gt(void 0),n=Gt(void 0),i=Gt("unknown"),s=Gt(new Map);Ln(()=>{Ad([...s.getValue().values()])},[s]),Ln(()=>{const v=n.getValue();if(!v)return;const P=s.getValue().get(v.id);!P||P===v||n.setValue(P)},[s,n]);const o=Gt(new Map),c=Gt(!1),l=Ib(()=>Array.from(o.getValue().values()),[o]),u=v=>{const P=o.getValue();if(P.has(v.id))return;const T=new Map(P);T.set(v.id,v),o.setValue(T)},d=v=>{const P=o.getValue(),T=new Map(P);T.delete(v.id),o.setValue(T)},h=v=>{Ab(r,v.id),d(v),t.getValue()===v&&(r.removeItem(Nn),e.setValue(void 0),n.setValue(void 0),t.setValue(void 0),i.setValue("disconnected"))},p=v=>{h(v),v.disconnect()},_=async(v,P)=>{if(!v.getAccount())throw new Error("Cannot set a wallet without an account as active");const g=await(async()=>P!=null&&P.accountAbstraction&&!bs(v)?await Cb(v,P.client,P.accountAbstraction,h):v)();return await r.setItem(Nn,v.id),await r.setItem(yc,v.id),u(v),(P==null?void 0:P.setWalletAsActive)!==!1&&m(g),v.subscribe("accountChanged",async()=>{var L;const D=await _(v,P);(L=P==null?void 0:P.onConnect)==null||L.call(P,D,l.getValue())}),g},f=async(v,P)=>{var g;const T=await _(v,P);return(g=P==null?void 0:P.onConnect)==null||g.call(P,T,l.getValue()),T},m=v=>{const P=v.getAccount();if(!P)throw new Error("Cannot set a wallet without an account as active");u(v),t.setValue(v),e.setValue(P),n.setValue(v.getChain()),i.setValue("connected");const T=E=>{e.setValue(E)},g=v.subscribe("accountChanged",T),D=v.subscribe("chainChanged",E=>n.setValue(E)),L=v.subscribe("disconnect",()=>{w()}),w=()=>{h(v),g(),D(),L()}},y=async v=>{m(v),v.id!=="smart"&&(await r.setItem(Nn,v.id),await r.setItem(yc,v.id))};Ln(()=>{const v=n.getValue();v?r.setItem(Is,we(v)):r.removeItem(Is)},[n],!1),Ln(async()=>{const P=l.getValue().map(T=>T==null?void 0:T.id).filter(T=>!!T);r.setItem(ku,we(Array.from(new Set([...P]))))},[l],!1);const b=async v=>{const P=t.getValue();if(!P)throw new Error("No active wallet found");if(!P.switchChain)throw new Error("Wallet does not support switching chains");if(bs(P)){const T=await uo(r);if(T){const g=l.getValue().find(D=>D.id===T);if(g){await g.switchChain(v),await P.switchChain(v),m(P);return}}await P.switchChain(v),m(P)}else await P.switchChain(v);n.setValue(P.getChain())};function R(v){const P=s.getValue();if(v.every(D=>{const L=P.get(D.id);return we(L)===we(D)}))return;const g=new Map(P);for(const D of v)g.set(D.id,D);s.setValue(g)}return{activeAccountStore:e,activeWalletChainStore:n,activeWalletConnectionStatusStore:i,activeWalletStore:t,addConnectedWallet:u,connect:f,connectedWallets:l,defineChains:R,disconnectWallet:p,handleConnection:_,isAutoConnecting:c,removeConnectedWallet:d,setActiveWallet:y,switchActiveWalletChain:b}}async function Nu(r){try{const t=await r.getItem(ku);return t?JSON.parse(t):[]}catch{return[]}}async function uo(r){try{const t=await r.getItem(Nn);if(t)return t}catch{}return null}async function Uu(r){try{const t=await r.getItem(Is);if(t)return JSON.parse(t)}catch{}return null}const Cb=async(r,t,e,n)=>{const i=r.getAccount();if(!i)throw new Error("Cannot set a wallet without an account as active");const s=Ms(e);await s.connect({chain:e.chain,client:t,personalAccount:i});const o=r.subscribe("disconnect",()=>{c()}),c=()=>{o(),n(s)};return s};function qu(r,t){return new Promise((e,n)=>{const i=setTimeout(()=>{n(new Error(t.message))},t.ms);r.then(s=>{clearTimeout(i),e(s)},s=>{clearTimeout(i),n(s)})})}async function $b({client:r,ecosystem:t,tokenToLink:e,storage:n}){const i=dn(r,t),s=Yn("inAppWallet"),o=await n.getAuthCookie();if(!o)throw new Error("Failed to link account, no user logged in");const c={Authorization:`Bearer iaw-auth-token:${o}`,"Content-Type":"application/json"},l=await i(`${s}/api/2024-05-05/account/connect`,{body:we({accountAuthTokenToConnect:e}),headers:c,method:"POST"});if(!l.ok){const d=await l.json();throw new Error(d.message||"Failed to link account.")}const{linkedAccounts:u}=await l.json();return u??[]}async function HI({client:r,ecosystem:t,profileToUnlink:e,allowAccountDeletion:n=!1,storage:i}){const s=dn(r,t),o=Yn("inAppWallet"),c=await i.getAuthCookie();if(!c)throw new Error("Failed to unlink account, no user logged in");const l={Authorization:`Bearer iaw-auth-token:${c}`,"Content-Type":"application/json"},u=await s(`${o}/api/2024-05-05/account/disconnect`,{body:we({allowAccountDeletion:n,details:e.details,type:e.type}),headers:l,method:"POST"});if(!u.ok){const h=await u.json();throw new Error(h.message||"Failed to unlink account.")}const{linkedAccounts:d}=await u.json();return d??[]}async function GI({client:r,ecosystem:t,storage:e}){const n=dn(r,t),i=Yn("inAppWallet"),s=await e.getAuthCookie();if(!s)throw new Error("Failed to get linked accounts, no user logged in");const o={Authorization:`Bearer iaw-auth-token:${s}`,"Content-Type":"application/json"},c=await n(`${i}/api/2024-05-05/accounts`,{headers:o,method:"GET"});if(!c.ok){const u=await c.json();throw new Error(u.message||"Failed to get linked accounts.")}const{linkedAccounts:l}=await c.json();return l??[]}const Mu=["google","apple","facebook","discord","line","x","tiktok","epic","coinbase","farcaster","telegram","github","twitch","steam"],JI=[...Mu,"guest","backend","email","phone","passkey","wallet"],kb="0x3f707e6b",Nb=[{type:"tuple[]",name:"calls",components:[{type:"address",name:"target"},{type:"uint256",name:"value"},{type:"bytes",name:"data"}]}],Ub=[];function qb(r){const t=Pb(async()=>"asyncParams"in r?await r.asyncParams():r);return Td({contract:r.contract,method:[kb,Nb,Ub],params:async()=>[(await t()).calls],value:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.value},accessList:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.accessList},gas:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.gas},gasPrice:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.gasPrice},maxFeePerGas:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.maxFeePerGas},maxPriorityFeePerGas:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.maxPriorityFeePerGas},nonce:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.nonce},extraGas:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.extraGas},erc20Value:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.erc20Value},authorizationList:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.authorizationList}})}async function Mb(r){const{client:t,chain:e,bundlerUrl:n}=r,i=n??Lc(e),s=`delegation-contract:${i}`;return Ic(async()=>{var u;const c=await dn(t)(i,{useAuthToken:!0,body:we({id:1,jsonrpc:"2.0",method:"tw_getDelegationContract",params:[]}),headers:{"Content-Type":"application/json"},method:"POST"});if(!c.ok)throw new Error(`Failed to fetch delegation contract: ${c.status} ${c.statusText}`);const l=await c.json();if(l.error)throw new Error(`Delegation contract RPC error: ${JSON.stringify(l.error)}`);if(!((u=l.result)!=null&&u.delegationContract))throw new Error("Invalid response: missing delegationContract in result");return l.result.delegationContract},{cacheKey:s,cacheTime:24*60*60*1e3})}const Bb=r=>{const{client:t,adminAccount:e,sponsorGas:n}=r,i=async o=>{var f,m,y;const c=o[0];if(!c)throw new Error("No transactions provided");const l=ge(c.chainId),u=Ls({address:e.address,chain:l,client:t,abi:Fb});let d=(f=c.authorizationList)==null?void 0:f[0];const h=await Mb({client:t,chain:l});if(d&&((m=d.address)==null?void 0:m.toLowerCase())!==h.toLowerCase())throw new Error(`Authorization address does not match expected delegation contract address. Expected ${h} but got ${d.address}`);if(!d&&!await zb(u,h)){let R=c.nonce?BigInt(c.nonce):BigInt(await jb({client:t,address:e.address,chain:l}));R+=n?0n:1n;const v=await((y=e.signAuthorization)==null?void 0:y.call(e,{address:Q(h),chainId:c.chainId,nonce:R}));if(!v)throw new Error("Failed to sign authorization");d=v}if(n){const b={calls:o.map(T=>({data:T.data??"0x",target:Q(T.to??""),value:T.value??0n})),uid:Pd()},R=await e.signTypedData({domain:{chainId:c.chainId,name:"MinimalAccount",verifyingContract:u.address,version:"1"},message:b,primaryType:"WrappedCalls",types:{Call:[{name:"target",type:"address"},{name:"value",type:"uint256"},{name:"data",type:"bytes"}],WrappedCalls:[{name:"calls",type:"Call[]"},{name:"uid",type:"bytes32"}]}}),v=await Vb({authorization:d,eoaAddress:Q(e.address),options:{chain:ge(c.chainId),client:t},signature:R,wrappedCalls:b});return{transactionHash:await Kb({options:{chain:ge(c.chainId),client:t},transactionId:v.transactionId})}}const p=qb({calls:o.map(b=>({data:b.data??"0x",target:Q(b.to??""),value:b.value??0n})),contract:u,overrides:{authorizationList:d?[d]:void 0,value:o.reduce((b,R)=>b+(R.value??0n),0n)}}),_=await Od({from:e.address,transaction:p});return e.sendTransaction(_)},s={address:e.address,sendBatchTransaction:async o=>i(o),sendTransaction:async o=>i([o]),signMessage:({message:o,originalMessage:c,chainId:l})=>e.signMessage({chainId:l,message:o,originalMessage:c}),signTypedData:o=>e.signTypedData(o),sendCalls:async o=>{const{inAppWalletSendCalls:c}=await a(async()=>{const{inAppWalletSendCalls:p}=await import("./in-app-wallet-calls-Bcq34XJb.js");return{inAppWalletSendCalls:p}},__vite__mapDeps([21,1])),l=o.calls[0];if(!l)throw new Error("No calls to send");const u=l.client,d=l.chain||o.chain,h=await c({account:s,calls:o.calls,chain:d});return{chain:d,client:u,id:h}},getCallsStatus:async o=>{const{inAppWalletGetCallsStatus:c}=await a(async()=>{const{inAppWalletGetCallsStatus:l}=await import("./in-app-wallet-calls-Bcq34XJb.js");return{inAppWalletGetCallsStatus:l}},__vite__mapDeps([21,1]));return c(o)},getCallsStatusRaw:async o=>{const{inAppWalletGetCallsStatusRaw:c}=await a(async()=>{const{inAppWalletGetCallsStatusRaw:l}=await import("./in-app-wallet-calls-Bcq34XJb.js");return{inAppWalletGetCallsStatusRaw:l}},__vite__mapDeps([21,1]));return c(o)},getCapabilities:async o=>({[o.chainId??1]:{atomic:{status:"supported"},paymasterService:{supported:n??!1}}})};return s};async function jb(r){const{client:t,address:e,chain:n}=r,i=Xn({chain:n,client:t});return await a(async()=>{const{eth_getTransactionCount:o}=await import("./thirdweb-BIaoCVl0.js").then(c=>c.ck);return{eth_getTransactionCount:o}},[]).then(({eth_getTransactionCount:o})=>o(i,{address:Q(e),blockTag:"pending"}))}async function zb(r,t){const e=await Rd(r),n=e.length>0&&e.startsWith("0xef0100"),i=`0x${e.slice(8,48)}`;return n&&i.toLowerCase()===t.toLowerCase()}async function Kb(r){const t=r.timeoutMs||3e5,e=r.intervalMs||1e3,n=Date.now()+t;for(;Date.now()<n;){const i=await Sb({options:r.options,transactionId:r.transactionId});if(i.transactionHash)return i.transactionHash;await new Promise(s=>setTimeout(s,e))}throw new Error(`Timeout waiting for transaction to be mined on chain ${r.options.chain.id} with transactionId: ${r.transactionId}`)}const Fb=[{type:"receive",stateMutability:"payable"},{type:"function",name:"createSessionWithSig",inputs:[{name:"sessionSpec",type:"tuple",internalType:"struct SessionLib.SessionSpec",components:[{name:"signer",type:"address",internalType:"address"},{name:"isWildcard",type:"bool",internalType:"bool"},{name:"expiresAt",type:"uint256",internalType:"uint256"},{name:"callPolicies",type:"tuple[]",internalType:"struct SessionLib.CallSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]},{name:"constraints",type:"tuple[]",internalType:"struct SessionLib.Constraint[]",components:[{name:"condition",type:"uint8",internalType:"enum SessionLib.Condition"},{name:"index",type:"uint64",internalType:"uint64"},{name:"refValue",type:"bytes32",internalType:"bytes32"},{name:"limit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]}]},{name:"transferPolicies",type:"tuple[]",internalType:"struct SessionLib.TransferSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]},{name:"uid",type:"bytes32",internalType:"bytes32"}]},{name:"signature",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"eip712Domain",inputs:[],outputs:[{name:"fields",type:"bytes1",internalType:"bytes1"},{name:"name",type:"string",internalType:"string"},{name:"version",type:"string",internalType:"string"},{name:"chainId",type:"uint256",internalType:"uint256"},{name:"verifyingContract",type:"address",internalType:"address"},{name:"salt",type:"bytes32",internalType:"bytes32"},{name:"extensions",type:"uint256[]",internalType:"uint256[]"}],stateMutability:"view"},{type:"function",name:"execute",inputs:[{name:"calls",type:"tuple[]",internalType:"struct Call[]",components:[{name:"target",type:"address",internalType:"address"},{name:"value",type:"uint256",internalType:"uint256"},{name:"data",type:"bytes",internalType:"bytes"}]}],outputs:[],stateMutability:"payable"},{type:"function",name:"executeWithSig",inputs:[{name:"wrappedCalls",type:"tuple",internalType:"struct WrappedCalls",components:[{name:"calls",type:"tuple[]",internalType:"struct Call[]",components:[{name:"target",type:"address",internalType:"address"},{name:"value",type:"uint256",internalType:"uint256"},{name:"data",type:"bytes",internalType:"bytes"}]},{name:"uid",type:"bytes32",internalType:"bytes32"}]},{name:"signature",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"function",name:"getCallPoliciesForSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"tuple[]",internalType:"struct SessionLib.CallSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]},{name:"constraints",type:"tuple[]",internalType:"struct SessionLib.Constraint[]",components:[{name:"condition",type:"uint8",internalType:"enum SessionLib.Condition"},{name:"index",type:"uint64",internalType:"uint64"},{name:"refValue",type:"bytes32",internalType:"bytes32"},{name:"limit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]}]}],stateMutability:"view"},{type:"function",name:"getSessionExpirationForSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"getSessionStateForSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"tuple",internalType:"struct SessionLib.SessionState",components:[{name:"transferValue",type:"tuple[]",internalType:"struct SessionLib.LimitState[]",components:[{name:"remaining",type:"uint256",internalType:"uint256"},{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"index",type:"uint256",internalType:"uint256"}]},{name:"callValue",type:"tuple[]",internalType:"struct SessionLib.LimitState[]",components:[{name:"remaining",type:"uint256",internalType:"uint256"},{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"index",type:"uint256",internalType:"uint256"}]},{name:"callParams",type:"tuple[]",internalType:"struct SessionLib.LimitState[]",components:[{name:"remaining",type:"uint256",internalType:"uint256"},{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"index",type:"uint256",internalType:"uint256"}]}]}],stateMutability:"view"},{type:"function",name:"getTransferPoliciesForSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"tuple[]",internalType:"struct SessionLib.TransferSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]}],stateMutability:"view"},{type:"function",name:"isWildcardSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"onERC1155BatchReceived",inputs:[{name:"",type:"address",internalType:"address"},{name:"",type:"address",internalType:"address"},{name:"",type:"uint256[]",internalType:"uint256[]"},{name:"",type:"uint256[]",internalType:"uint256[]"},{name:"",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"nonpayable"},{type:"function",name:"onERC1155Received",inputs:[{name:"",type:"address",internalType:"address"},{name:"",type:"address",internalType:"address"},{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"nonpayable"},{type:"function",name:"onERC721Received",inputs:[{name:"",type:"address",internalType:"address"},{name:"",type:"address",internalType:"address"},{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"nonpayable"},{type:"function",name:"supportsInterface",inputs:[{name:"interfaceId",type:"bytes4",internalType:"bytes4"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"event",name:"Executed",inputs:[{name:"to",type:"address",indexed:!0,internalType:"address"},{name:"value",type:"uint256",indexed:!1,internalType:"uint256"},{name:"data",type:"bytes",indexed:!1,internalType:"bytes"}],anonymous:!1},{type:"event",name:"SessionCreated",inputs:[{name:"signer",type:"address",indexed:!0,internalType:"address"},{name:"sessionSpec",type:"tuple",indexed:!1,internalType:"struct SessionLib.SessionSpec",components:[{name:"signer",type:"address",internalType:"address"},{name:"isWildcard",type:"bool",internalType:"bool"},{name:"expiresAt",type:"uint256",internalType:"uint256"},{name:"callPolicies",type:"tuple[]",internalType:"struct SessionLib.CallSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]},{name:"constraints",type:"tuple[]",internalType:"struct SessionLib.Constraint[]",components:[{name:"condition",type:"uint8",internalType:"enum SessionLib.Condition"},{name:"index",type:"uint64",internalType:"uint64"},{name:"refValue",type:"bytes32",internalType:"bytes32"},{name:"limit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]}]},{name:"transferPolicies",type:"tuple[]",internalType:"struct SessionLib.TransferSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]},{name:"uid",type:"bytes32",internalType:"bytes32"}]}],anonymous:!1},{type:"event",name:"ValueReceived",inputs:[{name:"from",type:"address",indexed:!0,internalType:"address"},{name:"value",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"error",name:"AllowanceExceeded",inputs:[{name:"allowanceUsage",type:"uint256",internalType:"uint256"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint64",internalType:"uint64"}]},{type:"error",name:"CallPolicyViolated",inputs:[{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"}]},{type:"error",name:"CallReverted",inputs:[]},{type:"error",name:"ConditionFailed",inputs:[{name:"param",type:"bytes32",internalType:"bytes32"},{name:"refValue",type:"bytes32",internalType:"bytes32"},{name:"condition",type:"uint8",internalType:"uint8"}]},{type:"error",name:"InvalidDataLength",inputs:[{name:"actualLength",type:"uint256",internalType:"uint256"},{name:"expectedLength",type:"uint256",internalType:"uint256"}]},{type:"error",name:"InvalidSignature",inputs:[{name:"msgSender",type:"address",internalType:"address"},{name:"thisAddress",type:"address",internalType:"address"}]},{type:"error",name:"LifetimeUsageExceeded",inputs:[{name:"lifetimeUsage",type:"uint256",internalType:"uint256"},{name:"limit",type:"uint256",internalType:"uint256"}]},{type:"error",name:"MaxValueExceeded",inputs:[{name:"value",type:"uint256",internalType:"uint256"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"}]},{type:"error",name:"NoCallsToExecute",inputs:[]},{type:"error",name:"SessionExpired",inputs:[]},{type:"error",name:"SessionExpiresTooSoon",inputs:[]},{type:"error",name:"SessionZeroSigner",inputs:[]},{type:"error",name:"TransferPolicyViolated",inputs:[{name:"target",type:"address",internalType:"address"}]},{type:"error",name:"UIDAlreadyProcessed",inputs:[]}];function Bu(r){return r.id==="inApp"||r.id==="embedded"}async function Wb(r,t,e){var s,o,c,l;if(((s=t==null?void 0:t.auth)==null?void 0:s.mode)!=="popup"&&((o=t==null?void 0:t.auth)==null?void 0:o.mode)!==void 0&&e.authenticateWithRedirect){const u=r.strategy;Mu.includes(u)&&await e.authenticateWithRedirect(u,(c=t==null?void 0:t.auth)==null?void 0:c.mode,(l=t==null?void 0:t.auth)==null?void 0:l.redirectUrl)}const i=(await e.connect(r)).user.account;return ju({authAccount:i,client:r.client,createOptions:t,desiredChain:r.chain})}async function Hb(r,t,e){r.authResult&&e.loginWithAuthToken&&await e.loginWithAuthToken(r.authResult);const n=await Jb(e);if(!n)throw new Error("Failed to authenticate user.");const i=n.account;return ju({authAccount:i,client:r.client,createOptions:t,desiredChain:r.chain})}async function Gb(r){const{connectSmartAccount:t}=await a(async()=>{const{connectSmartAccount:e}=await import("./index-CNP9Lp1F.js");return{connectSmartAccount:e}},__vite__mapDeps([13,1,14,2,3,4,5,6,7]));return t({chain:r.chain,client:r.client,personalAccount:r.authAccount},r.smartAccountOptions)}async function Jb(r){const t=await r.getUser();switch(t.status){case"Logged In, Wallet Initialized":return t}}async function ju(r){const{createOptions:t,authAccount:e,desiredChain:n,client:i}=r;let s,o;const c=t&&"executionMode"in t?t.executionMode:void 0;if(c&&(c.mode==="EIP4337"?s=c.smartAccount:c.mode==="EIP7702"&&(o=c)),t&&"smartAccount"in t&&(t!=null&&t.smartAccount)&&(s=t.smartAccount),s){const[l,u]=await Gb({authAccount:e,chain:n,client:i,smartAccountOptions:s});return{account:l,adminAccount:e,chain:u}}if(o){const l=n;if(!l)throw new Error("Chain is required for EIP-7702 execution, pass a chain when connecting the inAppWallet.");return{account:Bb({adminAccount:e,client:i,sponsorGas:o.sponsorGas}),adminAccount:e,chain:l}}return{account:e,chain:n||Jd}}const qi=Object.freeze(Object.defineProperty({__proto__:null,autoConnectInAppWallet:Hb,connectInAppWallet:Wb,isInAppWallet:Bu},Symbol.toStringTag,{value:"Module"}));function Zb(r){const t=n=>Bu(n)||Pr(n),e=bs(r.wallet)&&r.connectedWallets.some(n=>{var i,s,o,c,l,u;return t(n)&&((s=(i=n.getAccount())==null?void 0:i.address)==null?void 0:s.toLowerCase())===((u=(l=(c=(o=r.wallet).getAdminAccount)==null?void 0:c.call(o))==null?void 0:l.address)==null?void 0:u.toLowerCase())});return t(r.wallet)||e}function Qb(){if(typeof document>"u")return;const r=new URLSearchParams(window.location.search);let t;const e=window.location.hash||"";let n=e;const i=e.indexOf("?");i!==-1&&(t=new URLSearchParams(e.substring(i)),n=e.substring(0,i));const s=r.get("walletId")??(t==null?void 0:t.get("walletId"))??void 0,o=r.get("authResult")??(t==null?void 0:t.get("authResult"))??void 0,c=r.get("authProvider")??(t==null?void 0:t.get("authProvider"))??void 0,l=r.get("authCookie")??(t==null?void 0:t.get("authCookie"))??void 0,u=r.get("authFlow")??(t==null?void 0:t.get("authFlow"))??void 0;if((l||o)&&s){const d=(()=>{if(o)return r.delete("authResult"),t==null||t.delete("authResult"),JSON.parse(decodeURIComponent(o))})();r.delete("walletId"),r.delete("authProvider"),r.delete("authCookie"),r.delete("authFlow"),t==null||t.delete("walletId"),t==null||t.delete("authProvider"),t==null||t.delete("authCookie"),t==null||t.delete("authFlow");const h=r.toString(),p=h?`?${h}`:"";let _=n;if(t){const f=t.toString();f&&(_=`${n}?${f}`)}return window.history.pushState({},"",`${window.location.pathname}${p}${_}`),{authCookie:l,authFlow:u,authProvider:c,authResult:d,walletId:s}}}let Mi;const Yb=async r=>{if(Mi&&!r.force&&await Mi)return!0;const t=Xb(r);return Mi=t,t},Xb=async({storage:r,props:t,createWalletFn:e,manager:n,connectOverride:i,setLastAuthProvider:s})=>{var T,g,D,L,w;const{wallets:o,onConnect:c}=t,l=t.timeout??15e3;let u=!1;n.isAutoConnecting.setValue(!0);let[d,h]=await Promise.all([Nu(r),uo(r)]);const p=Qb();if((p==null?void 0:p.authFlow)==="link"&&p.authResult)return await eI({client:t.client,connectOverride:i,createWalletFn:e,manager:n,onConnect:c,props:t,setLastAuthProvider:s,storage:r,timeout:l,urlToken:p,wallets:o});const _=o.find(E=>E.id===(p==null?void 0:p.walletId));if(p!=null&&p.authCookie&&_&&await new lo({clientId:t.client.clientId,ecosystem:Pr(_)?{id:_.id,partnerId:(T=_.getConfig())==null?void 0:T.partnerId}:void 0,storage:r}).saveAuthCookie(p.authCookie),p!=null&&p.walletId&&(h=p.walletId,d=d!=null&&d.includes(p.walletId)?d:[p.walletId,...d||[]]),p!=null&&p.authProvider&&await(s==null?void 0:s(p.authProvider,r)),!d)return u;const f=await Uu(r)||t.chain,m=d.map(E=>{const I=o.find(A=>A.id===E);return I||e(E)}),y=h&&(m.find(E=>E.id===h)||e(h));if(y){n.activeWalletConnectionStatusStore.setValue("connecting"),await qu(As({authResult:p==null?void 0:p.authResult,client:t.client,lastConnectedChain:f,wallet:y}),{message:`AutoConnect timeout: ${l}ms limit exceeded.`,ms:l}).catch(E=>{console.warn(E.message),t.onTimeout&&t.onTimeout()});try{await(i?i(y):n.connect(y,{accountAbstraction:t.accountAbstraction,client:t.client}))}catch(E){E instanceof Error&&console.warn("Error auto connecting wallet:",E.message),n.activeWalletConnectionStatusStore.setValue("disconnected")}}else n.activeWalletConnectionStatusStore.setValue("disconnected");const b=m.filter(E=>E.id!==h&&d.includes(E.id));for(const E of b)try{await As({authResult:p==null?void 0:p.authResult,client:t.client,lastConnectedChain:f,wallet:E}),n.addConnectedWallet(E)}catch{}y&&Zb({connectedWallets:y?[y,...b]:b,wallet:y})&&((g=t.siweAuth)!=null&&g.requiresAuth)&&!((D=t.siweAuth)!=null&&D.isLoggedIn)&&!((L=t.siweAuth)!=null&&L.isLoggingIn)&&await((w=t.siweAuth)==null?void 0:w.doLogin().catch(E=>{console.warn("Error signing in with SIWE:",E.message)})),n.isAutoConnecting.setValue(!1);const v=n.activeWalletStore.getValue(),P=n.connectedWallets.getValue();if(v){u=!0;try{c==null||c(v,P)}catch(E){console.error("Error calling onConnect callback:",E)}}else n.activeWalletConnectionStatusStore.setValue("disconnected");return u};async function eI(r){var P;const{client:t,connectOverride:e,createWalletFn:n,manager:i,onConnect:s,props:o,setLastAuthProvider:c,storage:l,timeout:u,urlToken:d,wallets:h}=r,[p,_]=await Promise.all([Nu(l),uo(l)]),f=await Uu(l)||o.chain;if(!_||!p)return console.warn("No stored wallet found for linking flow"),i.isAutoConnecting.setValue(!1),!1;d.authProvider&&await(c==null?void 0:c(d.authProvider,l));const m=h.find(T=>T.id===_)||n(_);i.activeWalletConnectionStatusStore.setValue("connecting");try{await qu(As({authResult:void 0,client:t,lastConnectedChain:f,wallet:m}),{message:`AutoConnect timeout: ${u}ms limit exceeded.`,ms:u}),await(e?e(m):i.connect(m,{accountAbstraction:o.accountAbstraction,client:t}))}catch(T){return console.warn("Failed to auto-connect for linking:",T),i.activeWalletConnectionStatusStore.setValue("disconnected"),i.isAutoConnecting.setValue(!1),!1}const y=Pr(m)?{id:m.id,partnerId:(P=m.getConfig())==null?void 0:P.partnerId}:void 0,b=new lo({clientId:t.clientId,ecosystem:y,storage:l});try{await $b({client:t,ecosystem:y,storage:b,tokenToLink:d.authResult.storedToken.cookieString})}catch(T){console.error("Failed to link profile after redirect:",T)}i.isAutoConnecting.setValue(!1);const R=i.activeWalletStore.getValue(),v=i.connectedWallets.getValue();if(R){try{s==null||s(R,v)}catch(T){console.error("Error calling onConnect callback:",T)}return!0}return!1}async function As(r){return r.wallet.autoConnect({authResult:r.authResult,chain:r.lastConnectedChain,client:r.client})}async function tI(r){const t=r.wallets||bb(r),e=xb(Bn);return await Yb({createWalletFn:ot,manager:e,props:{...r,wallets:t},storage:Bn})}const ZI=Object.freeze(Object.defineProperty({__proto__:null,DefaultWalletConnectRequestHandlers:yb,EIP1193:Ih,authenticate:Lh,authenticateWithRedirect:Dh,autoConnect:tI,createWallet:ot,createWalletAdapter:Ah,createWalletConnectClient:wb,createWalletConnectSession:gb,deploySmartAccount:Vd,disconnectWalletConnectSession:Cu,ecosystemWallet:Hc,embeddedWallet:zi,generateAccount:kh,getActiveWalletConnectSessions:Eb,getAllWalletsList:Th,getInstalledWallets:Gc,getProfiles:xh,getUser:Dd,getUserEmail:Ph,getUserPhoneNumber:Oh,getWalletBalance:Nh,getWalletInfo:Nc,inAppWallet:zi,injectedProvider:Bs,isBaseAccountSDKWallet:qc,linkProfile:Vh,preAuthenticate:Rh,privateKeyAccount:Fi,privateKeyToAccount:Fi,randomPrivateKey:Ld,smartWallet:Ms,unlinkProfile:Sh,walletConnect:wh},Symbol.toStringTag,{value:"Module"}));export{bs as $,nn as A,ei as B,u_ as C,cb as D,cl as E,Sn as F,y_ as G,m_ as H,AI as I,bI as J,ae as K,Fn as L,PI as M,xI as N,TI as O,uu as P,Pb as Q,$u as R,KI as S,zI as T,MI as U,ln as V,jI as W,FI as X,aw as Y,WI as Z,BI as _,qI as a,JI as a0,lo as a1,Bn as a2,kI as a3,Mu as a4,$b as a5,HI as a6,GI as a7,$I as a8,ZI as a9,Nc as b,jn as c,NI as d,Cu as e,ih as f,yh as g,xu as h,CI as i,lb as j,ub as k,db as l,hc as m,ct as n,dc as o,Cs as p,Ks as q,Ir as r,UI as s,co as t,nr as u,Ut as v,_e as w,II as x,qo as y,ll as z};
|
|
14
|
+
Code: ${u}`)}return c.result}function bs(r){if(!r)return!1;if(r.id==="smart")return!0;if(r.id==="inApp"||Pr(r)){const t=r.getConfig();if(t&&"smartAccount"in t&&t.smartAccount)return!0;if(t!=null&&t.executionMode){const e=t.executionMode;return e.mode==="EIP4337"||e.mode==="EIP7702"}}return!1}const ku="thirdweb:connected-wallet-ids",Nn="thirdweb:active-wallet-id",Is="thirdweb:active-chain",yc="thirdweb:last-used-wallet-id";function xb(r){const t=Gt(void 0),e=Gt(void 0),n=Gt(void 0),i=Gt("unknown"),s=Gt(new Map);Ln(()=>{Ad([...s.getValue().values()])},[s]),Ln(()=>{const v=n.getValue();if(!v)return;const P=s.getValue().get(v.id);!P||P===v||n.setValue(P)},[s,n]);const o=Gt(new Map),c=Gt(!1),l=Ib(()=>Array.from(o.getValue().values()),[o]),u=v=>{const P=o.getValue();if(P.has(v.id))return;const T=new Map(P);T.set(v.id,v),o.setValue(T)},d=v=>{const P=o.getValue(),T=new Map(P);T.delete(v.id),o.setValue(T)},h=v=>{Ab(r,v.id),d(v),t.getValue()===v&&(r.removeItem(Nn),e.setValue(void 0),n.setValue(void 0),t.setValue(void 0),i.setValue("disconnected"))},p=v=>{h(v),v.disconnect()},_=async(v,P)=>{if(!v.getAccount())throw new Error("Cannot set a wallet without an account as active");const g=await(async()=>P!=null&&P.accountAbstraction&&!bs(v)?await Cb(v,P.client,P.accountAbstraction,h):v)();return await r.setItem(Nn,v.id),await r.setItem(yc,v.id),u(v),(P==null?void 0:P.setWalletAsActive)!==!1&&m(g),v.subscribe("accountChanged",async()=>{var L;const D=await _(v,P);(L=P==null?void 0:P.onConnect)==null||L.call(P,D,l.getValue())}),g},f=async(v,P)=>{var g;const T=await _(v,P);return(g=P==null?void 0:P.onConnect)==null||g.call(P,T,l.getValue()),T},m=v=>{const P=v.getAccount();if(!P)throw new Error("Cannot set a wallet without an account as active");u(v),t.setValue(v),e.setValue(P),n.setValue(v.getChain()),i.setValue("connected");const T=E=>{e.setValue(E)},g=v.subscribe("accountChanged",T),D=v.subscribe("chainChanged",E=>n.setValue(E)),L=v.subscribe("disconnect",()=>{w()}),w=()=>{h(v),g(),D(),L()}},y=async v=>{m(v),v.id!=="smart"&&(await r.setItem(Nn,v.id),await r.setItem(yc,v.id))};Ln(()=>{const v=n.getValue();v?r.setItem(Is,we(v)):r.removeItem(Is)},[n],!1),Ln(async()=>{const P=l.getValue().map(T=>T==null?void 0:T.id).filter(T=>!!T);r.setItem(ku,we(Array.from(new Set([...P]))))},[l],!1);const b=async v=>{const P=t.getValue();if(!P)throw new Error("No active wallet found");if(!P.switchChain)throw new Error("Wallet does not support switching chains");if(bs(P)){const T=await uo(r);if(T){const g=l.getValue().find(D=>D.id===T);if(g){await g.switchChain(v),await P.switchChain(v),m(P);return}}await P.switchChain(v),m(P)}else await P.switchChain(v);n.setValue(P.getChain())};function R(v){const P=s.getValue();if(v.every(D=>{const L=P.get(D.id);return we(L)===we(D)}))return;const g=new Map(P);for(const D of v)g.set(D.id,D);s.setValue(g)}return{activeAccountStore:e,activeWalletChainStore:n,activeWalletConnectionStatusStore:i,activeWalletStore:t,addConnectedWallet:u,connect:f,connectedWallets:l,defineChains:R,disconnectWallet:p,handleConnection:_,isAutoConnecting:c,removeConnectedWallet:d,setActiveWallet:y,switchActiveWalletChain:b}}async function Nu(r){try{const t=await r.getItem(ku);return t?JSON.parse(t):[]}catch{return[]}}async function uo(r){try{const t=await r.getItem(Nn);if(t)return t}catch{}return null}async function Uu(r){try{const t=await r.getItem(Is);if(t)return JSON.parse(t)}catch{}return null}const Cb=async(r,t,e,n)=>{const i=r.getAccount();if(!i)throw new Error("Cannot set a wallet without an account as active");const s=Ms(e);await s.connect({chain:e.chain,client:t,personalAccount:i});const o=r.subscribe("disconnect",()=>{c()}),c=()=>{o(),n(s)};return s};function qu(r,t){return new Promise((e,n)=>{const i=setTimeout(()=>{n(new Error(t.message))},t.ms);r.then(s=>{clearTimeout(i),e(s)},s=>{clearTimeout(i),n(s)})})}async function $b({client:r,ecosystem:t,tokenToLink:e,storage:n}){const i=dn(r,t),s=Yn("inAppWallet"),o=await n.getAuthCookie();if(!o)throw new Error("Failed to link account, no user logged in");const c={Authorization:`Bearer iaw-auth-token:${o}`,"Content-Type":"application/json"},l=await i(`${s}/api/2024-05-05/account/connect`,{body:we({accountAuthTokenToConnect:e}),headers:c,method:"POST"});if(!l.ok){const d=await l.json();throw new Error(d.message||"Failed to link account.")}const{linkedAccounts:u}=await l.json();return u??[]}async function HI({client:r,ecosystem:t,profileToUnlink:e,allowAccountDeletion:n=!1,storage:i}){const s=dn(r,t),o=Yn("inAppWallet"),c=await i.getAuthCookie();if(!c)throw new Error("Failed to unlink account, no user logged in");const l={Authorization:`Bearer iaw-auth-token:${c}`,"Content-Type":"application/json"},u=await s(`${o}/api/2024-05-05/account/disconnect`,{body:we({allowAccountDeletion:n,details:e.details,type:e.type}),headers:l,method:"POST"});if(!u.ok){const h=await u.json();throw new Error(h.message||"Failed to unlink account.")}const{linkedAccounts:d}=await u.json();return d??[]}async function GI({client:r,ecosystem:t,storage:e}){const n=dn(r,t),i=Yn("inAppWallet"),s=await e.getAuthCookie();if(!s)throw new Error("Failed to get linked accounts, no user logged in");const o={Authorization:`Bearer iaw-auth-token:${s}`,"Content-Type":"application/json"},c=await n(`${i}/api/2024-05-05/accounts`,{headers:o,method:"GET"});if(!c.ok){const u=await c.json();throw new Error(u.message||"Failed to get linked accounts.")}const{linkedAccounts:l}=await c.json();return l??[]}const Mu=["google","apple","facebook","discord","line","x","tiktok","epic","coinbase","farcaster","telegram","github","twitch","steam"],JI=[...Mu,"guest","backend","email","phone","passkey","wallet"],kb="0x3f707e6b",Nb=[{type:"tuple[]",name:"calls",components:[{type:"address",name:"target"},{type:"uint256",name:"value"},{type:"bytes",name:"data"}]}],Ub=[];function qb(r){const t=Pb(async()=>"asyncParams"in r?await r.asyncParams():r);return Td({contract:r.contract,method:[kb,Nb,Ub],params:async()=>[(await t()).calls],value:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.value},accessList:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.accessList},gas:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.gas},gasPrice:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.gasPrice},maxFeePerGas:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.maxFeePerGas},maxPriorityFeePerGas:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.maxPriorityFeePerGas},nonce:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.nonce},extraGas:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.extraGas},erc20Value:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.erc20Value},authorizationList:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.authorizationList}})}async function Mb(r){const{client:t,chain:e,bundlerUrl:n}=r,i=n??Lc(e),s=`delegation-contract:${i}`;return Ic(async()=>{var u;const c=await dn(t)(i,{useAuthToken:!0,body:we({id:1,jsonrpc:"2.0",method:"tw_getDelegationContract",params:[]}),headers:{"Content-Type":"application/json"},method:"POST"});if(!c.ok)throw new Error(`Failed to fetch delegation contract: ${c.status} ${c.statusText}`);const l=await c.json();if(l.error)throw new Error(`Delegation contract RPC error: ${JSON.stringify(l.error)}`);if(!((u=l.result)!=null&&u.delegationContract))throw new Error("Invalid response: missing delegationContract in result");return l.result.delegationContract},{cacheKey:s,cacheTime:24*60*60*1e3})}const Bb=r=>{const{client:t,adminAccount:e,sponsorGas:n}=r,i=async o=>{var f,m,y;const c=o[0];if(!c)throw new Error("No transactions provided");const l=ge(c.chainId),u=Ls({address:e.address,chain:l,client:t,abi:Fb});let d=(f=c.authorizationList)==null?void 0:f[0];const h=await Mb({client:t,chain:l});if(d&&((m=d.address)==null?void 0:m.toLowerCase())!==h.toLowerCase())throw new Error(`Authorization address does not match expected delegation contract address. Expected ${h} but got ${d.address}`);if(!d&&!await zb(u,h)){let R=c.nonce?BigInt(c.nonce):BigInt(await jb({client:t,address:e.address,chain:l}));R+=n?0n:1n;const v=await((y=e.signAuthorization)==null?void 0:y.call(e,{address:Q(h),chainId:c.chainId,nonce:R}));if(!v)throw new Error("Failed to sign authorization");d=v}if(n){const b={calls:o.map(T=>({data:T.data??"0x",target:Q(T.to??""),value:T.value??0n})),uid:Pd()},R=await e.signTypedData({domain:{chainId:c.chainId,name:"MinimalAccount",verifyingContract:u.address,version:"1"},message:b,primaryType:"WrappedCalls",types:{Call:[{name:"target",type:"address"},{name:"value",type:"uint256"},{name:"data",type:"bytes"}],WrappedCalls:[{name:"calls",type:"Call[]"},{name:"uid",type:"bytes32"}]}}),v=await Vb({authorization:d,eoaAddress:Q(e.address),options:{chain:ge(c.chainId),client:t},signature:R,wrappedCalls:b});return{transactionHash:await Kb({options:{chain:ge(c.chainId),client:t},transactionId:v.transactionId})}}const p=qb({calls:o.map(b=>({data:b.data??"0x",target:Q(b.to??""),value:b.value??0n})),contract:u,overrides:{authorizationList:d?[d]:void 0,value:o.reduce((b,R)=>b+(R.value??0n),0n)}}),_=await Od({from:e.address,transaction:p});return e.sendTransaction(_)},s={address:e.address,sendBatchTransaction:async o=>i(o),sendTransaction:async o=>i([o]),signMessage:({message:o,originalMessage:c,chainId:l})=>e.signMessage({chainId:l,message:o,originalMessage:c}),signTypedData:o=>e.signTypedData(o),sendCalls:async o=>{const{inAppWalletSendCalls:c}=await a(async()=>{const{inAppWalletSendCalls:p}=await import("./in-app-wallet-calls-C6XORNPV.js");return{inAppWalletSendCalls:p}},__vite__mapDeps([21,1])),l=o.calls[0];if(!l)throw new Error("No calls to send");const u=l.client,d=l.chain||o.chain,h=await c({account:s,calls:o.calls,chain:d});return{chain:d,client:u,id:h}},getCallsStatus:async o=>{const{inAppWalletGetCallsStatus:c}=await a(async()=>{const{inAppWalletGetCallsStatus:l}=await import("./in-app-wallet-calls-C6XORNPV.js");return{inAppWalletGetCallsStatus:l}},__vite__mapDeps([21,1]));return c(o)},getCallsStatusRaw:async o=>{const{inAppWalletGetCallsStatusRaw:c}=await a(async()=>{const{inAppWalletGetCallsStatusRaw:l}=await import("./in-app-wallet-calls-C6XORNPV.js");return{inAppWalletGetCallsStatusRaw:l}},__vite__mapDeps([21,1]));return c(o)},getCapabilities:async o=>({[o.chainId??1]:{atomic:{status:"supported"},paymasterService:{supported:n??!1}}})};return s};async function jb(r){const{client:t,address:e,chain:n}=r,i=Xn({chain:n,client:t});return await a(async()=>{const{eth_getTransactionCount:o}=await import("./thirdweb-B4uPXbkw.js").then(c=>c.ck);return{eth_getTransactionCount:o}},[]).then(({eth_getTransactionCount:o})=>o(i,{address:Q(e),blockTag:"pending"}))}async function zb(r,t){const e=await Rd(r),n=e.length>0&&e.startsWith("0xef0100"),i=`0x${e.slice(8,48)}`;return n&&i.toLowerCase()===t.toLowerCase()}async function Kb(r){const t=r.timeoutMs||3e5,e=r.intervalMs||1e3,n=Date.now()+t;for(;Date.now()<n;){const i=await Sb({options:r.options,transactionId:r.transactionId});if(i.transactionHash)return i.transactionHash;await new Promise(s=>setTimeout(s,e))}throw new Error(`Timeout waiting for transaction to be mined on chain ${r.options.chain.id} with transactionId: ${r.transactionId}`)}const Fb=[{type:"receive",stateMutability:"payable"},{type:"function",name:"createSessionWithSig",inputs:[{name:"sessionSpec",type:"tuple",internalType:"struct SessionLib.SessionSpec",components:[{name:"signer",type:"address",internalType:"address"},{name:"isWildcard",type:"bool",internalType:"bool"},{name:"expiresAt",type:"uint256",internalType:"uint256"},{name:"callPolicies",type:"tuple[]",internalType:"struct SessionLib.CallSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]},{name:"constraints",type:"tuple[]",internalType:"struct SessionLib.Constraint[]",components:[{name:"condition",type:"uint8",internalType:"enum SessionLib.Condition"},{name:"index",type:"uint64",internalType:"uint64"},{name:"refValue",type:"bytes32",internalType:"bytes32"},{name:"limit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]}]},{name:"transferPolicies",type:"tuple[]",internalType:"struct SessionLib.TransferSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]},{name:"uid",type:"bytes32",internalType:"bytes32"}]},{name:"signature",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"eip712Domain",inputs:[],outputs:[{name:"fields",type:"bytes1",internalType:"bytes1"},{name:"name",type:"string",internalType:"string"},{name:"version",type:"string",internalType:"string"},{name:"chainId",type:"uint256",internalType:"uint256"},{name:"verifyingContract",type:"address",internalType:"address"},{name:"salt",type:"bytes32",internalType:"bytes32"},{name:"extensions",type:"uint256[]",internalType:"uint256[]"}],stateMutability:"view"},{type:"function",name:"execute",inputs:[{name:"calls",type:"tuple[]",internalType:"struct Call[]",components:[{name:"target",type:"address",internalType:"address"},{name:"value",type:"uint256",internalType:"uint256"},{name:"data",type:"bytes",internalType:"bytes"}]}],outputs:[],stateMutability:"payable"},{type:"function",name:"executeWithSig",inputs:[{name:"wrappedCalls",type:"tuple",internalType:"struct WrappedCalls",components:[{name:"calls",type:"tuple[]",internalType:"struct Call[]",components:[{name:"target",type:"address",internalType:"address"},{name:"value",type:"uint256",internalType:"uint256"},{name:"data",type:"bytes",internalType:"bytes"}]},{name:"uid",type:"bytes32",internalType:"bytes32"}]},{name:"signature",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"function",name:"getCallPoliciesForSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"tuple[]",internalType:"struct SessionLib.CallSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]},{name:"constraints",type:"tuple[]",internalType:"struct SessionLib.Constraint[]",components:[{name:"condition",type:"uint8",internalType:"enum SessionLib.Condition"},{name:"index",type:"uint64",internalType:"uint64"},{name:"refValue",type:"bytes32",internalType:"bytes32"},{name:"limit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]}]}],stateMutability:"view"},{type:"function",name:"getSessionExpirationForSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"getSessionStateForSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"tuple",internalType:"struct SessionLib.SessionState",components:[{name:"transferValue",type:"tuple[]",internalType:"struct SessionLib.LimitState[]",components:[{name:"remaining",type:"uint256",internalType:"uint256"},{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"index",type:"uint256",internalType:"uint256"}]},{name:"callValue",type:"tuple[]",internalType:"struct SessionLib.LimitState[]",components:[{name:"remaining",type:"uint256",internalType:"uint256"},{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"index",type:"uint256",internalType:"uint256"}]},{name:"callParams",type:"tuple[]",internalType:"struct SessionLib.LimitState[]",components:[{name:"remaining",type:"uint256",internalType:"uint256"},{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"index",type:"uint256",internalType:"uint256"}]}]}],stateMutability:"view"},{type:"function",name:"getTransferPoliciesForSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"tuple[]",internalType:"struct SessionLib.TransferSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]}],stateMutability:"view"},{type:"function",name:"isWildcardSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"onERC1155BatchReceived",inputs:[{name:"",type:"address",internalType:"address"},{name:"",type:"address",internalType:"address"},{name:"",type:"uint256[]",internalType:"uint256[]"},{name:"",type:"uint256[]",internalType:"uint256[]"},{name:"",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"nonpayable"},{type:"function",name:"onERC1155Received",inputs:[{name:"",type:"address",internalType:"address"},{name:"",type:"address",internalType:"address"},{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"nonpayable"},{type:"function",name:"onERC721Received",inputs:[{name:"",type:"address",internalType:"address"},{name:"",type:"address",internalType:"address"},{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"nonpayable"},{type:"function",name:"supportsInterface",inputs:[{name:"interfaceId",type:"bytes4",internalType:"bytes4"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"event",name:"Executed",inputs:[{name:"to",type:"address",indexed:!0,internalType:"address"},{name:"value",type:"uint256",indexed:!1,internalType:"uint256"},{name:"data",type:"bytes",indexed:!1,internalType:"bytes"}],anonymous:!1},{type:"event",name:"SessionCreated",inputs:[{name:"signer",type:"address",indexed:!0,internalType:"address"},{name:"sessionSpec",type:"tuple",indexed:!1,internalType:"struct SessionLib.SessionSpec",components:[{name:"signer",type:"address",internalType:"address"},{name:"isWildcard",type:"bool",internalType:"bool"},{name:"expiresAt",type:"uint256",internalType:"uint256"},{name:"callPolicies",type:"tuple[]",internalType:"struct SessionLib.CallSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]},{name:"constraints",type:"tuple[]",internalType:"struct SessionLib.Constraint[]",components:[{name:"condition",type:"uint8",internalType:"enum SessionLib.Condition"},{name:"index",type:"uint64",internalType:"uint64"},{name:"refValue",type:"bytes32",internalType:"bytes32"},{name:"limit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]}]},{name:"transferPolicies",type:"tuple[]",internalType:"struct SessionLib.TransferSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]},{name:"uid",type:"bytes32",internalType:"bytes32"}]}],anonymous:!1},{type:"event",name:"ValueReceived",inputs:[{name:"from",type:"address",indexed:!0,internalType:"address"},{name:"value",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"error",name:"AllowanceExceeded",inputs:[{name:"allowanceUsage",type:"uint256",internalType:"uint256"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint64",internalType:"uint64"}]},{type:"error",name:"CallPolicyViolated",inputs:[{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"}]},{type:"error",name:"CallReverted",inputs:[]},{type:"error",name:"ConditionFailed",inputs:[{name:"param",type:"bytes32",internalType:"bytes32"},{name:"refValue",type:"bytes32",internalType:"bytes32"},{name:"condition",type:"uint8",internalType:"uint8"}]},{type:"error",name:"InvalidDataLength",inputs:[{name:"actualLength",type:"uint256",internalType:"uint256"},{name:"expectedLength",type:"uint256",internalType:"uint256"}]},{type:"error",name:"InvalidSignature",inputs:[{name:"msgSender",type:"address",internalType:"address"},{name:"thisAddress",type:"address",internalType:"address"}]},{type:"error",name:"LifetimeUsageExceeded",inputs:[{name:"lifetimeUsage",type:"uint256",internalType:"uint256"},{name:"limit",type:"uint256",internalType:"uint256"}]},{type:"error",name:"MaxValueExceeded",inputs:[{name:"value",type:"uint256",internalType:"uint256"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"}]},{type:"error",name:"NoCallsToExecute",inputs:[]},{type:"error",name:"SessionExpired",inputs:[]},{type:"error",name:"SessionExpiresTooSoon",inputs:[]},{type:"error",name:"SessionZeroSigner",inputs:[]},{type:"error",name:"TransferPolicyViolated",inputs:[{name:"target",type:"address",internalType:"address"}]},{type:"error",name:"UIDAlreadyProcessed",inputs:[]}];function Bu(r){return r.id==="inApp"||r.id==="embedded"}async function Wb(r,t,e){var s,o,c,l;if(((s=t==null?void 0:t.auth)==null?void 0:s.mode)!=="popup"&&((o=t==null?void 0:t.auth)==null?void 0:o.mode)!==void 0&&e.authenticateWithRedirect){const u=r.strategy;Mu.includes(u)&&await e.authenticateWithRedirect(u,(c=t==null?void 0:t.auth)==null?void 0:c.mode,(l=t==null?void 0:t.auth)==null?void 0:l.redirectUrl)}const i=(await e.connect(r)).user.account;return ju({authAccount:i,client:r.client,createOptions:t,desiredChain:r.chain})}async function Hb(r,t,e){r.authResult&&e.loginWithAuthToken&&await e.loginWithAuthToken(r.authResult);const n=await Jb(e);if(!n)throw new Error("Failed to authenticate user.");const i=n.account;return ju({authAccount:i,client:r.client,createOptions:t,desiredChain:r.chain})}async function Gb(r){const{connectSmartAccount:t}=await a(async()=>{const{connectSmartAccount:e}=await import("./index-BWLGPCDE.js");return{connectSmartAccount:e}},__vite__mapDeps([13,1,14,2,3,4,5,6,7]));return t({chain:r.chain,client:r.client,personalAccount:r.authAccount},r.smartAccountOptions)}async function Jb(r){const t=await r.getUser();switch(t.status){case"Logged In, Wallet Initialized":return t}}async function ju(r){const{createOptions:t,authAccount:e,desiredChain:n,client:i}=r;let s,o;const c=t&&"executionMode"in t?t.executionMode:void 0;if(c&&(c.mode==="EIP4337"?s=c.smartAccount:c.mode==="EIP7702"&&(o=c)),t&&"smartAccount"in t&&(t!=null&&t.smartAccount)&&(s=t.smartAccount),s){const[l,u]=await Gb({authAccount:e,chain:n,client:i,smartAccountOptions:s});return{account:l,adminAccount:e,chain:u}}if(o){const l=n;if(!l)throw new Error("Chain is required for EIP-7702 execution, pass a chain when connecting the inAppWallet.");return{account:Bb({adminAccount:e,client:i,sponsorGas:o.sponsorGas}),adminAccount:e,chain:l}}return{account:e,chain:n||Jd}}const qi=Object.freeze(Object.defineProperty({__proto__:null,autoConnectInAppWallet:Hb,connectInAppWallet:Wb,isInAppWallet:Bu},Symbol.toStringTag,{value:"Module"}));function Zb(r){const t=n=>Bu(n)||Pr(n),e=bs(r.wallet)&&r.connectedWallets.some(n=>{var i,s,o,c,l,u;return t(n)&&((s=(i=n.getAccount())==null?void 0:i.address)==null?void 0:s.toLowerCase())===((u=(l=(c=(o=r.wallet).getAdminAccount)==null?void 0:c.call(o))==null?void 0:l.address)==null?void 0:u.toLowerCase())});return t(r.wallet)||e}function Qb(){if(typeof document>"u")return;const r=new URLSearchParams(window.location.search);let t;const e=window.location.hash||"";let n=e;const i=e.indexOf("?");i!==-1&&(t=new URLSearchParams(e.substring(i)),n=e.substring(0,i));const s=r.get("walletId")??(t==null?void 0:t.get("walletId"))??void 0,o=r.get("authResult")??(t==null?void 0:t.get("authResult"))??void 0,c=r.get("authProvider")??(t==null?void 0:t.get("authProvider"))??void 0,l=r.get("authCookie")??(t==null?void 0:t.get("authCookie"))??void 0,u=r.get("authFlow")??(t==null?void 0:t.get("authFlow"))??void 0;if((l||o)&&s){const d=(()=>{if(o)return r.delete("authResult"),t==null||t.delete("authResult"),JSON.parse(decodeURIComponent(o))})();r.delete("walletId"),r.delete("authProvider"),r.delete("authCookie"),r.delete("authFlow"),t==null||t.delete("walletId"),t==null||t.delete("authProvider"),t==null||t.delete("authCookie"),t==null||t.delete("authFlow");const h=r.toString(),p=h?`?${h}`:"";let _=n;if(t){const f=t.toString();f&&(_=`${n}?${f}`)}return window.history.pushState({},"",`${window.location.pathname}${p}${_}`),{authCookie:l,authFlow:u,authProvider:c,authResult:d,walletId:s}}}let Mi;const Yb=async r=>{if(Mi&&!r.force&&await Mi)return!0;const t=Xb(r);return Mi=t,t},Xb=async({storage:r,props:t,createWalletFn:e,manager:n,connectOverride:i,setLastAuthProvider:s})=>{var T,g,D,L,w;const{wallets:o,onConnect:c}=t,l=t.timeout??15e3;let u=!1;n.isAutoConnecting.setValue(!0);let[d,h]=await Promise.all([Nu(r),uo(r)]);const p=Qb();if((p==null?void 0:p.authFlow)==="link"&&p.authResult)return await eI({client:t.client,connectOverride:i,createWalletFn:e,manager:n,onConnect:c,props:t,setLastAuthProvider:s,storage:r,timeout:l,urlToken:p,wallets:o});const _=o.find(E=>E.id===(p==null?void 0:p.walletId));if(p!=null&&p.authCookie&&_&&await new lo({clientId:t.client.clientId,ecosystem:Pr(_)?{id:_.id,partnerId:(T=_.getConfig())==null?void 0:T.partnerId}:void 0,storage:r}).saveAuthCookie(p.authCookie),p!=null&&p.walletId&&(h=p.walletId,d=d!=null&&d.includes(p.walletId)?d:[p.walletId,...d||[]]),p!=null&&p.authProvider&&await(s==null?void 0:s(p.authProvider,r)),!d)return u;const f=await Uu(r)||t.chain,m=d.map(E=>{const I=o.find(A=>A.id===E);return I||e(E)}),y=h&&(m.find(E=>E.id===h)||e(h));if(y){n.activeWalletConnectionStatusStore.setValue("connecting"),await qu(As({authResult:p==null?void 0:p.authResult,client:t.client,lastConnectedChain:f,wallet:y}),{message:`AutoConnect timeout: ${l}ms limit exceeded.`,ms:l}).catch(E=>{console.warn(E.message),t.onTimeout&&t.onTimeout()});try{await(i?i(y):n.connect(y,{accountAbstraction:t.accountAbstraction,client:t.client}))}catch(E){E instanceof Error&&console.warn("Error auto connecting wallet:",E.message),n.activeWalletConnectionStatusStore.setValue("disconnected")}}else n.activeWalletConnectionStatusStore.setValue("disconnected");const b=m.filter(E=>E.id!==h&&d.includes(E.id));for(const E of b)try{await As({authResult:p==null?void 0:p.authResult,client:t.client,lastConnectedChain:f,wallet:E}),n.addConnectedWallet(E)}catch{}y&&Zb({connectedWallets:y?[y,...b]:b,wallet:y})&&((g=t.siweAuth)!=null&&g.requiresAuth)&&!((D=t.siweAuth)!=null&&D.isLoggedIn)&&!((L=t.siweAuth)!=null&&L.isLoggingIn)&&await((w=t.siweAuth)==null?void 0:w.doLogin().catch(E=>{console.warn("Error signing in with SIWE:",E.message)})),n.isAutoConnecting.setValue(!1);const v=n.activeWalletStore.getValue(),P=n.connectedWallets.getValue();if(v){u=!0;try{c==null||c(v,P)}catch(E){console.error("Error calling onConnect callback:",E)}}else n.activeWalletConnectionStatusStore.setValue("disconnected");return u};async function eI(r){var P;const{client:t,connectOverride:e,createWalletFn:n,manager:i,onConnect:s,props:o,setLastAuthProvider:c,storage:l,timeout:u,urlToken:d,wallets:h}=r,[p,_]=await Promise.all([Nu(l),uo(l)]),f=await Uu(l)||o.chain;if(!_||!p)return console.warn("No stored wallet found for linking flow"),i.isAutoConnecting.setValue(!1),!1;d.authProvider&&await(c==null?void 0:c(d.authProvider,l));const m=h.find(T=>T.id===_)||n(_);i.activeWalletConnectionStatusStore.setValue("connecting");try{await qu(As({authResult:void 0,client:t,lastConnectedChain:f,wallet:m}),{message:`AutoConnect timeout: ${u}ms limit exceeded.`,ms:u}),await(e?e(m):i.connect(m,{accountAbstraction:o.accountAbstraction,client:t}))}catch(T){return console.warn("Failed to auto-connect for linking:",T),i.activeWalletConnectionStatusStore.setValue("disconnected"),i.isAutoConnecting.setValue(!1),!1}const y=Pr(m)?{id:m.id,partnerId:(P=m.getConfig())==null?void 0:P.partnerId}:void 0,b=new lo({clientId:t.clientId,ecosystem:y,storage:l});try{await $b({client:t,ecosystem:y,storage:b,tokenToLink:d.authResult.storedToken.cookieString})}catch(T){console.error("Failed to link profile after redirect:",T)}i.isAutoConnecting.setValue(!1);const R=i.activeWalletStore.getValue(),v=i.connectedWallets.getValue();if(R){try{s==null||s(R,v)}catch(T){console.error("Error calling onConnect callback:",T)}return!0}return!1}async function As(r){return r.wallet.autoConnect({authResult:r.authResult,chain:r.lastConnectedChain,client:r.client})}async function tI(r){const t=r.wallets||bb(r),e=xb(Bn);return await Yb({createWalletFn:ot,manager:e,props:{...r,wallets:t},storage:Bn})}const ZI=Object.freeze(Object.defineProperty({__proto__:null,DefaultWalletConnectRequestHandlers:yb,EIP1193:Ih,authenticate:Lh,authenticateWithRedirect:Dh,autoConnect:tI,createWallet:ot,createWalletAdapter:Ah,createWalletConnectClient:wb,createWalletConnectSession:gb,deploySmartAccount:Vd,disconnectWalletConnectSession:Cu,ecosystemWallet:Hc,embeddedWallet:zi,generateAccount:kh,getActiveWalletConnectSessions:Eb,getAllWalletsList:Th,getInstalledWallets:Gc,getProfiles:xh,getUser:Dd,getUserEmail:Ph,getUserPhoneNumber:Oh,getWalletBalance:Nh,getWalletInfo:Nc,inAppWallet:zi,injectedProvider:Bs,isBaseAccountSDKWallet:qc,linkProfile:Vh,preAuthenticate:Rh,privateKeyAccount:Fi,privateKeyToAccount:Fi,randomPrivateKey:Ld,smartWallet:Ms,unlinkProfile:Sh,walletConnect:wh},Symbol.toStringTag,{value:"Module"}));export{bs as $,nn as A,ei as B,u_ as C,cb as D,cl as E,Sn as F,y_ as G,m_ as H,AI as I,bI as J,ae as K,Fn as L,PI as M,xI as N,TI as O,uu as P,Pb as Q,$u as R,KI as S,zI as T,MI as U,ln as V,jI as W,FI as X,aw as Y,WI as Z,BI as _,qI as a,JI as a0,lo as a1,Bn as a2,kI as a3,Mu as a4,$b as a5,HI as a6,GI as a7,$I as a8,ZI as a9,Nc as b,jn as c,NI as d,Cu as e,ih as f,yh as g,xu as h,CI as i,lb as j,ub as k,db as l,hc as m,ct as n,dc as o,Cs as p,Ks as q,Ir as r,UI as s,co as t,nr as u,Ut as v,_e as w,II as x,qo as y,ll as z};
|