import{p as r,w as c}from"./main-2rA8bEUg.js";const d=r({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),p={state:d},n={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return n.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return n.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},isArray(e){return Array.isArray(e)&&e.length>0},isTelegram(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)},formatNativeUrl(e,o,a){if(n.isHttpUrl(e))return this.formatUniversalUrl(e,o,a);let t=e;t.includes("://")||(t=e.replaceAll("/","").replaceAll(":",""),t=`${t}://`),t.endsWith("/")||(t=`${t}/`),this.setWalletConnectDeepLink(t,a);const i=encodeURIComponent(o);return`${t}wc?uri=${i}`},formatUniversalUrl(e,o,a){if(!n.isHttpUrl(e))return this.formatNativeUrl(e,o,a);let t=e;if(t.startsWith("https://t.me")){const s=c.from(o).toString("base64").replace(/[=]/g,"");t.endsWith("/")&&(t=t.slice(0,-1)),this.setWalletConnectDeepLink(t,a);const l=new URL(t);return l.searchParams.set("startapp",s),l.toString()}t.endsWith("/")||(t=`${t}/`),this.setWalletConnectDeepLink(t,a);const i=encodeURIComponent(o);return`${t}wc?uri=${i}`},async wait(e){return new Promise(o=>{setTimeout(o,e)})},openHref(e,o){const a=this.isTelegram()?"_blank":o;window.open(e,a,"noreferrer noopener")},setWalletConnectDeepLink(e,o){try{localStorage.setItem(n.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:o}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[o]=e.split("?");localStorage.setItem(n.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:o,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(n.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(n.WCM_VERSION,"2.7.0")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const o=(e=p.state.data)==null?void 0:e.Wallet;if(!o)throw new Error('Missing "Wallet" view data');return o}},m=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https"));r({enabled:m,userSessionId:"",events:[],connectedWalletId:void 0});r({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1});r({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0});n.isMobile();r({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]});r({open:!1});function h(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}r({themeMode:h()?"dark":"light"});r({open:!1,message:"",variant:"success"});export{n as C,p as R};
