@privy-io/react-auth 1.76.2 → 1.76.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var nd=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var vu=(e,t,r)=>(nd(e,t,"read from private field"),r?r.call(e):t.get(e)),fs=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},id=(e,t,r,o)=>(nd(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var Cu=(e,t,r)=>(nd(e,t,"access private method"),r);import{getAddress as Oo}from"@ethersproject/address";import{Web3Provider as cu}from"@ethersproject/providers";import{createStore as i_}from"mipd";import{useEffect as Yr,useMemo as a_,useRef as Xi,useState as st}from"react";import{isAndroid as s_}from"react-device-detect";import{ProviderErrors as l_,calculateTotalGasEstimate as c_,populateTransactionRequest as d_}from"@privy-io/js-sdk-core";import{FetchError as IC}from"ofetch";var et=class extends Error{constructor(r,o,n){super(r);o instanceof Error&&(this.cause=o),this.privyErrorCode=n}toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},Mt=class extends et{constructor(r,o,n,i,a){super(n,i,a);this.type=r;this.status=o}},w=class extends et{constructor(r,o,n){super(r,o,n);this.type="client_error"}},hs=class extends w{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var ce=class extends et{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},le=e=>{if(e instanceof et)return e;if(!(e instanceof IC))return tt(e);if(!e.response)return new Mt("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new Mt(t||"ApiError",e.response.status,r||o,e,n)},tt=e=>e instanceof et?e:e instanceof Error?new w(e.message,e):new w(`Internal error: ${e}`);var bo=class extends w{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},Wt=class extends w{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},ys=class extends w{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var br=class extends w{constructor(t){super("This application is in development mode and must be upgraded to production to log in new users.",t,"max_accounts_reached")}};var gs="/api/v1/sessions",vs="/api/v1/sessions/logout",wu="/api/v1/sessions/fork",Cs="/api/v1/sessions/fork/recover",bu="/api/v1/siwe/init",Eu="/api/v1/siwe/authenticate",Tu="/api/v1/siwe/link",Su="/api/v1/siwe/unlink",_u="/api/v1/farcaster/init",Pu="/api/v1/farcaster/authenticate",Au="/api/v1/farcaster/link",xu="/api/v1/farcaster/status",ku="/api/v1/farcaster/unlink",Ru="/api/v1/passwordless/init",Iu="/api/v1/passwordless/authenticate",Mu="/api/v1/passwordless/link",Wu="/api/v1/passwordless/unlink",Ou="/api/v1/passwordless/update",Lu="/api/v1/passwordless_sms/init",Nu="/api/v1/passwordless_sms/link",Du="/api/v1/passwordless_sms/unlink",Uu="/api/v1/passwordless_sms/authenticate",ws="/api/v1/oauth/init",Fu="/api/v1/oauth/authenticate",bs="/api/v1/oauth/link",Bu="/api/v1/oauth/unlink",Hu="/api/v1/recovery/oauth/init",Gu="/api/v1/recovery/oauth/init_icloud",Vu="/api/v1/recovery/oauth/authenticate",qu="/api/v1/passkeys/link/init",zu="/api/v1/passkeys/authenticate/init",$u="/api/v1/passkeys/link",Ku="/api/v1/passkeys/authenticate",ju="/api/v1/passkeys/unlink",Yu="/api/v1/telegram/authenticate",Zu="/api/v1/telegram/link",Qu="/api/v1/telegram/unlink";var Ju="/api/v1/mfa/passwordless_sms/init",Xu="/api/v1/mfa/passkeys/init",em="/api/v1/users/me/accept_terms",Es="/api/v1/analytics_events",tm="/api/v1/custom_jwt_account/authenticate",rm="/api/v1/plugins/moonpay_on_ramp/sign",om="/api/v1/funding/coinbase_on_ramp/init",nm="/api/v1/funding/coinbase_on_ramp/status";var ei=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");try{let t=await this.api.post(tm,{token:this.meta.token});return{user:t.user,token:t.token,refresh_token:t.refresh_token,identity_token:t.identity_token,is_new_user:t.is_new_user}}catch(t){throw le(t)}}async link(){throw new Error("Unimplemented")}};var Lo=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new w("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(Iu,{email:this.meta.email,code:this.meta.emailCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,identity_token:t.identity_token,is_new_user:t.is_new_user}}catch(t){throw le(t)}}async link(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new w("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(Mu,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw le(t)}}async sendCodeEmail(t,r){if(!this.api)throw new w("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new w("Email must be set when initialzing authentication.");try{return await this.api.post(Ru,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw le(o)}}},Ts=class extends Lo{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new w("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(Ou,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw le(r)}}};import{isMobile as WC,isIOS as OC}from"react-device-detect";var ad=class{constructor(){this._cache={}}get(t){return this._cache[t]}put(t,r){r!==void 0?this._cache[t]=r:this.del(t)}del(t){delete this._cache[t]}getKeys(){return Object.keys(this._cache)}},Ss=class{get(t){let r=localStorage.getItem(t);return r===null?void 0:JSON.parse(r)}put(t,r){r!==void 0?localStorage.setItem(t,JSON.stringify(r)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function sd(){try{let e="privy:__session_storage__test",t="blobby",r=new Ss;return r.put(e,t),r.del(e),!0}catch{return!1}}function MC(){return typeof window<"u"&&window.localStorage?new Ss:new ad}var Q=MC();import{StaticJsonRpcProvider as ta}from"@ethersproject/providers";function im(){let e=window,t=e.ethereum;if(!t)return[];let r=[];if(t.providers?.length)for(let o of t.providers)o&&r.push(o);return r.push(e.ethereum),r}var _s=e=>{if(e.isApexWallet)return"Apex Wallet";if(e.isAvalanche)return"Core Wallet";if(e.isBackpack)return"Backpack";if(e.isBifrost)return"Bifrost Wallet";if(e.isBitKeep)return"BitKeep";if(e.isBitski)return"Bitski";if(e.isBlockWallet)return"BlockWallet";if(e.isBraveWallet)return"Brave Wallet";if(e.isClover)return"Clover";if(e.isCoin98)return"Coin98 Wallet";if(e.isCoinbaseWallet)return"Coinbase Wallet";if(e.isDawn)return"Dawn Wallet";if(e.isDefiant)return"Defiant";if(e.isDesig)return"Desig Wallet";if(e.isEnkrypt)return"Enkrypt";if(e.isExodus)return"Exodus";if(e.isFordefi)return"Fordefi";if(e.isFrame)return"Frame";if(e.isFrontier)return"Frontier Wallet";if(e.isGamestop)return"GameStop Wallet";if(e.isHaqqWallet)return"HAQQ Wallet";if(e.isHyperPay)return"HyperPay Wallet";if(e.isImToken)return"ImToken";if(e.isHaloWallet)return"Halo Wallet";if(e.isKuCoinWallet)return"KuCoin Wallet";if(e.isMathWallet)return"MathWallet";if(e.isNovaWallet)return"Nova Wallet";if(e.isOkxWallet||e.isOKExWallet)return"OKX Wallet";if(e.isOneInchIOSWallet||e.isOneInchAndroidWallet)return"1inch Wallet";if(e.isOneKey)return"OneKey Wallet";if(e.isOpera)return"Opera";if(e.isPhantom)return"Phantom";if(e.isPortal)return"Ripio Portal";if(e.isRabby)return"Rabby Wallet";if(e.isRainbow)return"Rainbow";if(e.isSafePal)return"SafePal Wallet";if(e.isStatus)return"Status";if(e.isSubWallet)return"SubWallet";if(e.isTalisman)return"Talisman";if(e.isTally||e.isTaho)return"Taho";if(e.isTokenPocket)return"TokenPocket";if(e.isTokenary)return"Tokenary";if(e.isTrust||e.isTrustWallet)return"Trust Wallet";if(e.isTTWallet)return"TTWallet";if(e.isXDEFI)return"XDEFI Wallet";if(e.isZeal)return"Zeal";if(e.isZerion)return"Zerion";if(e.isMetaMask)return"MetaMask"};var ld=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||_s(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!ld(r))return!1}return!0},No=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),Ps=()=>{let e=window;if(!e.ethereum)return!1;if(e.ethereum.isCoinbaseWallet)return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(t&&t.isCoinbaseWallet)return!0}return!1};var am=(e,t)=>{let r=[],o=[];for(let[n,i]of e.entries())n<t?r.push(i):o.push(i);return[r,o]},As=e=>!!String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),sm=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},dt=(e,t=3,r=4)=>{if(!e)return"";let o=2,n=3;if(t+r+o+n>=e.length)return e;let i=e.slice(0,o+t),a=e.slice(e.length-r,e.length);return`${i}...${a}`},cd=e=>new Promise(t=>setTimeout(t,e));function lm(e,{interval:t=100,timeout:r=5e3}={}){return new Promise((o,n)=>{let i=0,a,l=()=>{if(i>=r){n("Max attempts reached without result");return}if(a=e(),i+=t,a!=null){o(a);return}setTimeout(l,t)};l()})}var ra=(e,t={})=>{let r=t.delayMs||150,o=t.maxAttempts||270;return new Promise(async(n,i)=>{let a=!1,l=0;for(;!a&&l<o;){if(t.abortSignal?.aborted)return;e().then(s=>{a=!0,n(s)},(...s)=>{a=!0,i(...s)}),l+=1,await cd(r)}a||i(new Error("Exceeded max attempts before resolving function"))})},xs=(e,t,r={},o={})=>{let n=new URL(t,e);for(let[a,l]of Object.entries(r))l!==void 0&&n.searchParams.set(a,l);let i=Object.entries(o);if(i.length>0){let a=new URLSearchParams;for(let[l,s]of i)a.append(l,s);n.hash=a.toString()}return n.href};var cm=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),hn=e=>typeof e=="string"?e:"0x"+e.toString(16);async function dm(e,t,r,o=3e3){let n=!1,i=window;return new Promise(a=>{i.ethereum?l():(window.addEventListener("ethereum#initialized",l,{once:!0}),setTimeout(()=>{l()},o));function l(){if(n)return;n=!0,window.removeEventListener("ethereum#initialized",l);let s=e.getProviders(),c=[];for(let m of s)t.includes("coinbase_wallet")&&m.info.rdns==="com.coinbase.wallet"||c.push({type:m.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:m});for(let m of im()){let f=_s(m);if(!s.some(u=>u.info.name===f)){if(ld(m,!0)&&!c.find(u=>u.type==="metamask")){c.push({type:"metamask",legacyInjectedProvider:m});continue}if(f==="Phantom"&&!c.find(u=>u.type==="phantom")){c.push({type:"phantom",legacyInjectedProvider:m});continue}if(f==="Coinbase Wallet"&&!c.find(u=>u.type==="coinbase_wallet"&&r?.coinbaseWallet?.connectionOptions!=="smartWalletOnly")){c.push({type:"coinbase_wallet",legacyInjectedProvider:m});continue}c.find(u=>u.type==="unknown_browser_extension")||c.push({type:"unknown_browser_extension",legacyInjectedProvider:m})}}a(c)}})}function ti(e){return`eip155:${String(Number(e))}`}var pm=(e,t,r,o)=>{let n=Number(e),i=t.find(a=>a.id===n);if(!i)throw new ce(`Unsupported chainId ${e}`,4901);return dd(i,r,o)},dd=(e,t,r)=>{let o=e.id,n=Number(e.id),i;if(e.rpcUrls.privyWalletOverride&&e.rpcUrls.privyWalletOverride.http[0])i=e.rpcUrls.privyWalletOverride.http[0];else if(t.rpcUrls&&t.rpcUrls[n])i=t.rpcUrls[n];else if(e.rpcUrls.privy?.http[0]){let a=new URL(e.rpcUrls.privy.http[0]);a.searchParams.append("privyAppId",r),i=a.toString()}else e.rpcUrls.public?.http[0]?i=e.rpcUrls.public.http[0]:i=e.rpcUrls.default?.http[0];if(!i)throw new ce(`No RPC url found for ${o}`);return i},um=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new ce(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},Gt=(e,t,r,o)=>{let n=Number(e),i=t.find(l=>l.id===n);if(!i)throw new ce(`Unsupported chainId ${e}`,4901);let a;if(i.rpcUrls.privyWalletOverride&&i.rpcUrls.privyWalletOverride.http[0]?a=new ta(i.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?a=new ta(r.rpcUrls[n]):i.rpcUrls.privy?.http[0]?a=new ta({url:i.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):i.rpcUrls.public?.http[0]?a=new ta(i.rpcUrls.public.http[0]):a=new ta(i.rpcUrls.default?.http[0]),!a)throw new ce(`No RPC url found for ${e}`);return a},oa=e=>{let t={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},r=e.types.EIP712Domain??Object.entries(e.domain).map(([o,n])=>{if(n!=null&&typeof o=="string"&&o in t)return{name:o,type:t[o]}}).filter(o=>o!==void 0);return{...e,types:{...e.types,EIP712Domain:r}}};var ks=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(Rs))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var Rs={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",hostname:"metamask.io",mobile:{native:"metamask://",universal:"https://metamask.app.link"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",hostname:"rainbow.me",mobile:{native:"rainbow://",universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app",native:"uniswap://"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",hostname:"zerion.io",mobile:{native:"zerion://",universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com",native:"dfw://"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}},okx_wallet:{id:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",displayName:"OKX Wallet",hostname:"okx.com",mobile:{native:"okex://main"}},rabby_wallet:{id:"18388be9ac2d02726dbac9777c96efaac06d744b2f6d580fccdd4127a6d01fd1",displayName:"Rabby Wallet",hostname:"rabby.io",mobile:{}}};function mm(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function fm(e,t){let r=mm(t);if(r.deepLink)return wm(r.deepLink,e);if(r.universalLink)return pd(r.universalLink,e);throw new w(`Unsupported wallet ${t.id}`)}function hm(e,t){let r=mm(t);if(r.universalLink)return pd(r.universalLink,e)}var ym="WALLETCONNECT_DEEPLINK_CHOICE";function gm(){try{localStorage.removeItem(ym)}catch{}}function vm({href:e,name:t}){try{localStorage.setItem(ym,JSON.stringify({href:e,name:t}))}catch{}}function Cm(e){return e.startsWith("http://")||e.startsWith("https://")}function wm(e,t){if(Cm(e))return pd(e,t);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function pd(e,t){if(!Cm(e))return wm(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function Is(e,t){window.open(e,t,"noreferrer noopener")}var Le=class{constructor(t){this.promise=null;this.fn=t}execute(t){return this.promise===null&&(this.promise=(async()=>{try{return await this.fn(t)}finally{this.promise=null}})()),this.promise}};var na=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new Le(this._startChannelOnce.bind(this)),this.pollForReady=new Le(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.channelToken)throw new w("Auth flow must be initialized first");try{let t=await this.api.post(Pu,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new w("No response from authentication");return{user:t.user,token:t.token,refresh_token:t.refresh_token,identity_token:t.identity_token,is_new_user:t.is_new_user}}catch(t){throw le(t)}}async link(){if(!this.api)throw new w("Auth flow has no API instance");try{return await this.api.post(Au,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw le(t)}}async _startChannelOnce(){if(!this.api)throw new w("Auth flow has no API instance");let t=await this.api.post(_u,{token:this.captchaToken});WC&&!OC&&t.connect_uri&&Is(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new w("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.channelToken)throw new w("Auth flow must be initialized first");let t=await this.api.get(xu,{headers:{"farcaster-channel-token":this.meta.channelToken}});return t.state==="completed"?(this.message=t.message,this.signature=t.signature,this.fid=t.fid,!0):!1}};var bm="1.76.2";var Em="34357d3c125c2bcf2ce2bc3309d98715",Ms="https://auth.privy.io",Tm=2e4,Ne=1400,Ws=2500,ud=bm;var yn="privy:token",md="privy-token",Os="privy:refresh_token",Sm="privy-refresh-token",fd="privy:id_token",hd="privy-id-token",Ls="privy-session",ia="privy:session_transfer_token",NC="privy:wallet",aa="privy:caid",sa=e=>`privy:cross-app:${e}`,gn="privy:state_code",vn="privy:code_verifier",Cn="privy:headless_oauth",Ns=e=>`${NC}:${e}`,yd="privy:connectors",gd="privy:connections";var wn=12e4,Eo=1,vd="0x1",ri=3e4,_m="https://api.moonpay.com/v1",Pm="https://api.moonpay.com/v1",Am="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",xm="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI";var km="deprecated";import{base64url as Mm}from"jose";async function Rm(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function Im(e){return crypto.getRandomValues(new Uint8Array(e))}var DC="S256",UC="S256";function bn(){return Mm.encode(Im(36))}function oi(){return bn()}async function ni(e,t=DC){if(t==UC){let r=await Rm(e);return Mm.encode(r)}else return e}function Wm(){let e=Q.get(vn);if(!e)throw new w("Authentication error.");return e}function Ds(){return!!Q.get(Cn)}var Jr=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:Ds();this.meta={...t,headless:r}}addCaptchaToken(t){this.meta.captchaToken=t}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new w("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new w("User denied confirmation during OAuth flow");let t=Wm();try{let r=await this.api.post(Fu,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return Q.del(vn),this.meta.headless&&Q.del(Cn),{user:r.user,token:r.token,refresh_token:r.refresh_token,identity_token:r.identity_token,is_new_user:r.is_new_user,oauth_tokens:r.oauth_tokens}}catch(r){let o=le(r);throw o.privyErrorCode?new w(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new w("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new w("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new w("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new w("User denied confirmation during OAuth flow");let t=Q.get(vn);if(!t)throw new w("Authentication error.");try{let r=await this.api.post(bs,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return Q.del(vn),r}catch(r){throw le(r)}}async getAuthorizationUrl(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.provider)throw new w("Provider must be set when initializing OAuth authentication.");let t=bn();Q.put(vn,t);let r=oi();Q.put(gn,r);let o=await ni(t);this.meta.headless&&Q.put(Cn,!0);try{return await this.api.post(ws,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw le(n)}}};function Cd(e){return e.charAt(0).toUpperCase()+e.slice(1)}import{jsx as Om,jsxs as FC}from"react/jsx-runtime";var Us=({style:e,...t})=>FC("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 24 24",style:{height:"24px",...e},...t,children:[Om("path",{d:"M17.0722 11.6888C17.0471 8.90571 19.3263 7.56847 19.429 7.50274C18.1466 5.60938 16.153 5.35154 15.4417 5.3212C13.7461 5.14678 12.1306 6.32982 11.269 6.32982C10.4074 6.32982 9.08004 5.34648 7.67246 5.37429C5.82158 5.40209 4.11595 6.45874 3.16171 8.13218C1.24068 11.4942 2.6708 16.4817 4.54423 19.2143C5.46091 20.549 6.55041 22.0531 7.98554 21.9975C9.36803 21.9419 9.88905 21.095 11.5571 21.095C13.2251 21.095 13.696 21.9975 15.1537 21.9697C16.6389 21.9393 17.5806 20.6046 18.4897 19.2648C19.5392 17.7153 19.9725 16.2137 19.9975 16.1354C19.965 16.1228 17.1022 15.0155 17.0722 11.6888Z",fill:"currentColor"}),Om("path",{d:"M14.3295 3.51373C15.0909 2.58347 15.6043 1.28921 15.4641 0C14.3671 0.0455014 13.0396 0.738135 12.2532 1.66838C11.5494 2.48994 10.9307 3.80695 11.0986 5.07089C12.3183 5.16694 13.5681 4.44145 14.3295 3.51373Z",fill:"currentColor"})]});import{jsx as la,jsxs as BC}from"react/jsx-runtime";var Fs=({style:e,...t})=>BC("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 71 55",style:{height:"24px",...e},...t,children:[la("g",{clipPath:"url(#clip0)",children:la("path",{d:"M60.1045 4.8978C55.5792 2.8214 50.7265 1.2916 45.6527 0.41542C45.5603 0.39851 45.468 0.440769 45.4204 0.525289C44.7963 1.6353 44.105 3.0834 43.6209 4.2216C38.1637 3.4046 32.7345 3.4046 27.3892 4.2216C26.905 3.0581 26.1886 1.6353 25.5617 0.525289C25.5141 0.443589 25.4218 0.40133 25.3294 0.41542C20.2584 1.2888 15.4057 2.8186 10.8776 4.8978C10.8384 4.9147 10.8048 4.9429 10.7825 4.9795C1.57795 18.7309 -0.943561 32.1443 0.293408 45.3914C0.299005 45.4562 0.335386 45.5182 0.385761 45.5576C6.45866 50.0174 12.3413 52.7249 18.1147 54.5195C18.2071 54.5477 18.305 54.5139 18.3638 54.4378C19.7295 52.5728 20.9469 50.6063 21.9907 48.5383C22.0523 48.4172 21.9935 48.2735 21.8676 48.2256C19.9366 47.4931 18.0979 46.6 16.3292 45.5858C16.1893 45.5041 16.1781 45.304 16.3068 45.2082C16.679 44.9293 17.0513 44.6391 17.4067 44.3461C17.471 44.2926 17.5606 44.2813 17.6362 44.3151C29.2558 49.6202 41.8354 49.6202 53.3179 44.3151C53.3935 44.2785 53.4831 44.2898 53.5502 44.3433C53.9057 44.6363 54.2779 44.9293 54.6529 45.2082C54.7816 45.304 54.7732 45.5041 54.6333 45.5858C52.8646 46.6197 51.0259 47.4931 49.0921 48.2228C48.9662 48.2707 48.9102 48.4172 48.9718 48.5383C50.038 50.6034 51.2554 52.5699 52.5959 54.435C52.6519 54.5139 52.7526 54.5477 52.845 54.5195C58.6464 52.7249 64.529 50.0174 70.6019 45.5576C70.6551 45.5182 70.6887 45.459 70.6943 45.3942C72.1747 30.0791 68.2147 16.7757 60.1968 4.9823C60.1772 4.9429 60.1437 4.9147 60.1045 4.8978ZM23.7259 37.3253C20.2276 37.3253 17.3451 34.1136 17.3451 30.1693C17.3451 26.225 20.1717 23.0133 23.7259 23.0133C27.308 23.0133 30.1626 26.2532 30.1066 30.1693C30.1066 34.1136 27.28 37.3253 23.7259 37.3253ZM47.3178 37.3253C43.8196 37.3253 40.9371 34.1136 40.9371 30.1693C40.9371 26.225 43.7636 23.0133 47.3178 23.0133C50.9 23.0133 53.7545 26.2532 53.6986 30.1693C53.6986 34.1136 50.9 37.3253 47.3178 37.3253Z",fill:"#5865F2"})}),la("defs",{children:la("clipPath",{id:"clip0",children:la("rect",{width:"71",height:"55",fill:"white"})})})]});import{jsx as Lm}from"react/jsx-runtime";var Bs=({style:e,...t})=>Lm("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"24",y:"24",viewBox:"0 0 98 96",style:{height:"24px",...e},...t,children:Lm("path",{d:"M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z",fill:"currentColor"})});import{GlobeAltIcon as HC}from"@heroicons/react/24/outline";import{jsx as GC}from"react/jsx-runtime";var Nm=({style:e})=>GC(HC,{style:{color:"var(--privy-color-error)",...e}});import{jsx as Hs,jsxs as VC}from"react/jsx-runtime";var Gs=({style:e,...t})=>VC("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...e},...t,children:[Hs("path",{d:"M22.56 12.25C22.56 11.47 22.49 10.72 22.36 10H12V14.255H17.92C17.665 15.63 16.89 16.795 15.725 17.575V20.335H19.28C21.36 18.42 22.56 15.6 22.56 12.25Z",fill:"#4285F4"}),Hs("path",{d:"M12 23C14.97 23 17.46 22.015 19.28 20.335L15.725 17.575C14.74 18.235 13.48 18.625 12 18.625C9.13504 18.625 6.71004 16.69 5.84504 14.09H2.17004V16.94C3.98004 20.535 7.70004 23 12 23Z",fill:"#34A853"}),Hs("path",{d:"M5.845 14.09C5.625 13.43 5.5 12.725 5.5 12C5.5 11.275 5.625 10.57 5.845 9.91V7.06H2.17C1.4 8.59286 0.999321 10.2846 1 12C1 13.775 1.425 15.455 2.17 16.94L5.845 14.09Z",fill:"#FBBC05"}),Hs("path",{d:"M12 5.375C13.615 5.375 15.065 5.93 16.205 7.02L19.36 3.865C17.455 2.09 14.965 1 12 1C7.70004 1 3.98004 3.465 2.17004 7.06L5.84504 9.91C6.71004 7.31 9.13504 5.375 12 5.375Z",fill:"#EA4335"})]});import{jsx as Er,jsxs as Vs}from"react/jsx-runtime";function qs(e){return Vs("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:26,height:26,viewBox:"0 0 140 140",x:"0px",y:"0px",fill:"none",...e,children:[Vs("defs",{children:[Vs("linearGradient",{id:"b",children:[Er("stop",{offset:"0",stopColor:"#3771c8"}),Er("stop",{stopColor:"#3771c8",offset:".128"}),Er("stop",{offset:"1",stopColor:"#60f",stopOpacity:"0"})]}),Vs("linearGradient",{id:"a",children:[Er("stop",{offset:"0",stopColor:"#fd5"}),Er("stop",{offset:".1",stopColor:"#fd5"}),Er("stop",{offset:".5",stopColor:"#ff543e"}),Er("stop",{offset:"1",stopColor:"#c837ab"})]}),Er("radialGradient",{id:"c",cx:"158.429",cy:"578.088",r:"65",xlinkHref:"#a",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(0 -1.98198 1.8439 0 -1031.402 454.004)",fx:"158.429",fy:"578.088"}),Er("radialGradient",{id:"d",cx:"147.694",cy:"473.455",r:"65",xlinkHref:"#b",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(.17394 .86872 -3.5818 .71718 1648.348 -458.493)",fx:"147.694",fy:"473.455"})]}),Er("path",{fill:"url(#c)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),Er("path",{fill:"url(#d)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),Er("path",{fill:"#fff",d:"M66.004 18c-13.036 0-14.672.057-19.792.29-5.11.234-8.598 1.043-11.65 2.23-3.157 1.226-5.835 2.866-8.503 5.535-2.67 2.668-4.31 5.346-5.54 8.502-1.19 3.053-2 6.542-2.23 11.65C18.06 51.327 18 52.964 18 66s.058 14.667.29 19.787c.235 5.11 1.044 8.598 2.23 11.65 1.227 3.157 2.867 5.835 5.536 8.503 2.667 2.67 5.345 4.314 8.5 5.54 3.054 1.187 6.543 1.996 11.652 2.23 5.12.233 6.755.29 19.79.29 13.037 0 14.668-.057 19.788-.29 5.11-.234 8.602-1.043 11.656-2.23 3.156-1.226 5.83-2.87 8.497-5.54 2.67-2.668 4.31-5.346 5.54-8.502 1.18-3.053 1.99-6.542 2.23-11.65.23-5.12.29-6.752.29-19.788 0-13.036-.06-14.672-.29-19.792-.24-5.11-1.05-8.598-2.23-11.65-1.23-3.157-2.87-5.835-5.54-8.503-2.67-2.67-5.34-4.31-8.5-5.535-3.06-1.187-6.55-1.996-11.66-2.23-5.12-.233-6.75-.29-19.79-.29zm-4.306 8.65c1.278-.002 2.704 0 4.306 0 12.816 0 14.335.046 19.396.276 4.68.214 7.22.996 8.912 1.653 2.24.87 3.837 1.91 5.516 3.59 1.68 1.68 2.72 3.28 3.592 5.52.657 1.69 1.44 4.23 1.653 8.91.23 5.06.28 6.58.28 19.39s-.05 14.33-.28 19.39c-.214 4.68-.996 7.22-1.653 8.91-.87 2.24-1.912 3.835-3.592 5.514-1.68 1.68-3.275 2.72-5.516 3.59-1.69.66-4.232 1.44-8.912 1.654-5.06.23-6.58.28-19.396.28-12.817 0-14.336-.05-19.396-.28-4.68-.216-7.22-.998-8.913-1.655-2.24-.87-3.84-1.91-5.52-3.59-1.68-1.68-2.72-3.276-3.592-5.517-.657-1.69-1.44-4.23-1.653-8.91-.23-5.06-.276-6.58-.276-19.398s.046-14.33.276-19.39c.214-4.68.996-7.22 1.653-8.912.87-2.24 1.912-3.84 3.592-5.52 1.68-1.68 3.28-2.72 5.52-3.592 1.692-.66 4.233-1.44 8.913-1.655 4.428-.2 6.144-.26 15.09-.27zm29.928 7.97c-3.18 0-5.76 2.577-5.76 5.758 0 3.18 2.58 5.76 5.76 5.76 3.18 0 5.76-2.58 5.76-5.76 0-3.18-2.58-5.76-5.76-5.76zm-25.622 6.73c-13.613 0-24.65 11.037-24.65 24.65 0 13.613 11.037 24.645 24.65 24.645C79.617 90.645 90.65 79.613 90.65 66S79.616 41.35 66.003 41.35zm0 8.65c8.836 0 16 7.163 16 16 0 8.836-7.164 16-16 16-8.837 0-16-7.164-16-16 0-8.837 7.163-16 16-16z"})]})}import{jsx as zs}from"react/jsx-runtime";function $s({style:e,...t}){return zs("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0,0,256,256",style:{height:"26px",width:"26px",...e},...t,children:zs("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:zs("g",{transform:"scale(5.12,5.12)",children:zs("path",{d:"M41,4h-32c-2.76,0 -5,2.24 -5,5v32c0,2.76 2.24,5 5,5h32c2.76,0 5,-2.24 5,-5v-32c0,-2.76 -2.24,-5 -5,-5zM17,20v19h-6v-19zM11,14.47c0,-1.4 1.2,-2.47 3,-2.47c1.8,0 2.93,1.07 3,2.47c0,1.4 -1.12,2.53 -3,2.53c-1.8,0 -3,-1.13 -3,-2.53zM39,39h-6c0,0 0,-9.26 0,-10c0,-2 -1,-4 -3.5,-4.04h-0.08c-2.42,0 -3.42,2.06 -3.42,4.04c0,0.91 0,10 0,10h-6v-19h6v2.56c0,0 1.93,-2.56 5.81,-2.56c3.97,0 7.19,2.73 7.19,8.26z"})})})})}import{jsx as Dm,jsxs as qC}from"react/jsx-runtime";function Ks(e){return qC("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[Dm("path",{fill:"#1ed760",d:"M248 8C111.1 8 0 119.1 0 256s111.1 248 248 248 248-111.1 248-248S384.9 8 248 8Z"}),Dm("path",{d:"M406.6 231.1c-5.2 0-8.4-1.3-12.9-3.9-71.2-42.5-198.5-52.7-280.9-29.7-3.6 1-8.1 2.6-12.9 2.6-13.2 0-23.3-10.3-23.3-23.6 0-13.6 8.4-21.3 17.4-23.9 35.2-10.3 74.6-15.2 117.5-15.2 73 0 149.5 15.2 205.4 47.8 7.8 4.5 12.9 10.7 12.9 22.6 0 13.6-11 23.3-23.2 23.3zm-31 76.2c-5.2 0-8.7-2.3-12.3-4.2-62.5-37-155.7-51.9-238.6-29.4-4.8 1.3-7.4 2.6-11.9 2.6-10.7 0-19.4-8.7-19.4-19.4s5.2-17.8 15.5-20.7c27.8-7.8 56.2-13.6 97.8-13.6 64.9 0 127.6 16.1 177 45.5 8.1 4.8 11.3 11 11.3 19.7-.1 10.8-8.5 19.5-19.4 19.5zm-26.9 65.6c-4.2 0-6.8-1.3-10.7-3.6-62.4-37.6-135-39.2-206.7-24.5-3.9 1-9 2.6-11.9 2.6-9.7 0-15.8-7.7-15.8-15.8 0-10.3 6.1-15.2 13.6-16.8 81.9-18.1 165.6-16.5 237 26.2 6.1 3.9 9.7 7.4 9.7 16.5s-7.1 15.4-15.2 15.4z"})]})}import{jsx as wd,jsxs as zC}from"react/jsx-runtime";function js(e){return zC("svg",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 293768 333327",width:24,height:24,...e,children:[wd("path",{fill:"#26f4ee",d:"M204958 0c5369 45832 32829 78170 77253 81022v43471l-287 27V87593c-44424-2850-69965-30183-75333-76015l-47060-1v192819c6791 86790-60835 89368-86703 56462 30342 18977 79608 6642 73766-68039V0h58365zM78515 319644c-26591-5471-50770-21358-64969-44588-34496-56437-3401-148418 96651-157884v54345l-164 27v-40773C17274 145544 7961 245185 33650 286633c9906 15984 26169 27227 44864 33011z"}),wd("path",{fill:"#fb2c53",d:"M218434 11587c3505 29920 15609 55386 35948 70259-27522-10602-43651-34934-47791-70262l11843 3zm63489 82463c3786 804 7734 1348 11844 1611v51530c-25770 2537-48321-5946-74600-21749l4034 88251c0 28460 106 41467-15166 67648-34260 58734-95927 63376-137628 35401 54529 22502 137077-4810 136916-103049v-96320c26279 15803 48830 24286 74600 21748V94050zm-171890 37247c5390-1122 11048-1985 16998-2548v54345c-21666 3569-35427 10222-41862 22528-20267 38754 5827 69491 35017 74111-33931 5638-73721-28750-49999-74111 6434-12304 18180-18959 39846-22528v-51797zm64479-119719h1808-1808z"}),wd("path",{d:"M206590 11578c5369 45832 30910 73164 75333 76015v51528c-25770 2539-48321-5945-74600-21748v96320c206 125717-135035 135283-173673 72939-25688-41449-16376-141089 76383-155862v52323c-21666 3569-33412 10224-39846 22528-39762 76035 98926 121273 89342-1225V11577l47060 1z",fill:"#000000"})]})}import{jsx as Um}from"react/jsx-runtime";var Ys=({style:e,...t})=>Um("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",width:"24px",...e},...t,children:Um("path",{d:"M 14.285156 10.171875 L 23.222656 0 L 21.105469 0 L 13.34375 8.832031 L 7.148438 0 L 0 0 L 9.371094 13.355469 L 0 24.019531 L 2.117188 24.019531 L 10.308594 14.691406 L 16.851562 24.019531 L 24 24.019531 M 2.878906 1.5625 L 6.132812 1.5625 L 21.101562 22.535156 L 17.851562 22.535156",fill:"currentColor"})});var Fm={google:{name:"Google",component:Gs},discord:{name:"Discord",component:Fs},github:{name:"Github",component:Bs},linkedin:{name:"LinkedIn",component:$s},twitter:{name:"Twitter",component:Ys},spotify:{name:"Spotify",component:Ks},instagram:{name:"Instagram",component:qs},tiktok:{name:"Tiktok",component:js},apple:{name:"Apple",component:Us}},ca=e=>e in Fm?Fm[e]:{name:"Unknown",component:Nm};function Bm(e,t){let r={detail:"",retryable:!1},o=Cd(t);if(e?.privyErrorCode==="linked_to_another_user"&&(r.detail="This account has already been linked to another user."),e?.privyErrorCode==="invalid_credentials"&&(r.retryable=!0,r.detail="Something went wrong. Try again."),e.privyErrorCode==="oauth_user_denied"&&(r.detail=`Retry and check ${o} to finish connecting your account.`,r.retryable=!0),e?.privyErrorCode==="too_many_requests"&&(r.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode==="too_many_requests"&&e.message.includes("provider rate limit")){let n=ca(t).name;r.detail=`Request limit reached for ${n}. Please wait a moment and try again.`}if(e?.privyErrorCode==="oauth_account_suspended"){let n=ca(t).name;r.detail=`Your ${n} account is suspended. Please try another login method.`}return e?.privyErrorCode==="cannot_link_more_of_type"&&(r.detail="You cannot authorize more than one account for this user."),e?.privyErrorCode==="oauth_unexpected"&&t.startsWith("privy:")&&(r.detail="Something went wrong. Please try again."),r}function da(){let e=new URLSearchParams(window.location.search),t=e.get("privy_oauth_code"),r=e.get("privy_oauth_state"),o=e.get("privy_oauth_provider");if(!t||!r||!o)return{inProgress:!1};let n=!1;try{n=!!window.opener.location.origin}catch{}return{inProgress:!0,authorizationCode:t,stateCode:r,provider:o,headless:Ds(),popupFlow:window.opener!==null&&n}}function En(){let e=new URL(window.location.href);e.searchParams.delete("privy_oauth_code"),e.searchParams.delete("privy_oauth_provider"),e.searchParams.delete("privy_oauth_state"),Q.del(gn),window.history.replaceState({},"",e)}var Tn=class{constructor(t){this.initAuthenticateOnce=new Le(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new Le(this._initLinkOnce.bind(this)),this.meta={captchaToken:t}}async initAuthenticationFlow(){if(!this.api)throw new w("Auth flow has no API instance");this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute()}async initLinkFlow(){if(!this.api)throw new w("Auth flow has no API instance");this.meta.initLinkResponse=await this.initLinkOnce.execute()}async authenticate(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new w("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new w("WebAuthn is not supported in this browser");this.meta.initAuthenticateResponse||(this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute());try{let r=await t.startAuthentication(this._transformInitAuthenticateOptionsToCamelCase(this.meta.initAuthenticateResponse.options)),o=await this.api.post(Ku,{relying_party:this.meta.initAuthenticateResponse.relying_party,challenge:this.meta.initAuthenticateResponse.options.challenge,authenticator_response:this._transformAuthenticationResponseToSnakeCase(r)});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(r){throw r.name==="NotAllowedError"?new w("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):le(r)}}async link(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new w("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new w("WebAuthn is not supported in this browser");this.meta.initLinkResponse||(this.meta.initLinkResponse=await this.initLinkOnce.execute());try{let r=this.meta.initLinkResponse.options,o=await t.startRegistration(this._transformInitLinkOptionsToCamelCase(r));return await this.api.post($u,{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(o)})}catch(r){throw r.name==="NotAllowedError"?new w("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):le(r)}}async _initAuthenticateOnce(){if(!this.api)throw new w("Auth flow has no API instance");return await this.api.post(zu,{token:this.meta.captchaToken})}async _initLinkOnce(){if(!this.api)throw new w("Auth flow has no API instance");return await this.api.post(qu,{})}_transformInitLinkOptionsToCamelCase(t){return{rp:t.rp,user:{id:t.user.id,name:t.user.name,displayName:t.user.display_name},challenge:t.challenge,pubKeyCredParams:t.pub_key_cred_params.map(r=>({type:r.type,alg:r.alg})),timeout:t.timeout,excludeCredentials:t.exclude_credentials?.map(r=>({id:r.id,type:r.type,transports:r.transports})),authenticatorSelection:{authenticatorAttachment:t.authenticator_selection?.authenticator_attachment,requireResidentKey:t.authenticator_selection?.require_resident_key,residentKey:t.authenticator_selection?.resident_key,userVerification:t.authenticator_selection?.user_verification},attestation:t.attestation,extensions:{appid:t.extensions?.app_id,credProps:t.extensions?.cred_props?.rk,hmacCreateSecret:t.extensions?.hmac_create_secret}}}_transformRegistrationResponseToSnakeCase(t){return{id:t.id,raw_id:t.rawId,response:{client_data_json:t.response.clientDataJSON,attestation_object:t.response.attestationObject,authenticator_data:t.response.authenticatorData},authenticator_attachment:t.authenticatorAttachment,client_extension_results:{app_id:t.clientExtensionResults.appid,cred_props:t.clientExtensionResults.credProps,hmac_create_secret:t.clientExtensionResults.hmacCreateSecret},type:t.type}}_transformInitAuthenticateOptionsToCamelCase(t){return{challenge:t.challenge,allowCredentials:t.allow_credentials?.map(r=>({id:r.id,type:r.type,transports:r.transports}))||[],timeout:t.timeout,extensions:{appid:t.extensions?.app_id,credProps:t.extensions?.cred_props,hmacCreateSecret:t.extensions?.hmac_create_secret},userVerification:t.user_verification}}_transformAuthenticationResponseToSnakeCase(t){return{id:t.id,raw_id:t.rawId,response:{client_data_json:t.response.clientDataJSON,authenticator_data:t.response.authenticatorData,signature:t.response.signature,user_handle:t.response.userHandle},authenticator_attachment:t.authenticatorAttachment,client_extension_results:{app_id:t.clientExtensionResults.appid,cred_props:t.clientExtensionResults.credProps,hmac_create_secret:t.clientExtensionResults.hmacCreateSecret},type:t.type}}};var Zs=({address:e,chainId:t,nonce:r})=>{let o=window.location.host,n=window.location.origin,i="By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",a=new Date().toISOString();return`${o} wants you to sign in with your Ethereum account:
1
+ var ad=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var wu=(e,t,r)=>(ad(e,t,"read from private field"),r?r.call(e):t.get(e)),hs=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},sd=(e,t,r,o)=>(ad(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var bu=(e,t,r)=>(ad(e,t,"access private method"),r);import{getAddress as Oo}from"@ethersproject/address";import{Web3Provider as pu}from"@ethersproject/providers";import{createStore as m_}from"mipd";import{useEffect as Yr,useMemo as f_,useRef as ea,useState as lt}from"react";import{isAndroid as h_}from"react-device-detect";import{ProviderErrors as y_,calculateTotalGasEstimate as g_,populateTransactionRequest as v_}from"@privy-io/js-sdk-core";import{FetchError as NC}from"ofetch";var et=class extends Error{constructor(r,o,n){super(r);o instanceof Error&&(this.cause=o),this.privyErrorCode=n}toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},Mt=class extends et{constructor(r,o,n,i,a){super(n,i,a);this.type=r;this.status=o}},w=class extends et{constructor(r,o,n){super(r,o,n);this.type="client_error"}},ys=class extends w{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var ce=class extends et{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},le=e=>{if(e instanceof et)return e;if(!(e instanceof NC))return tt(e);if(!e.response)return new Mt("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new Mt(t||"ApiError",e.response.status,r||o,e,n)},tt=e=>e instanceof et?e:e instanceof Error?new w(e.message,e):new w(`Internal error: ${e}`);var bo=class extends w{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},Wt=class extends w{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},gs=class extends w{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var Er=class extends w{constructor(t){super("This application is in development mode and must be upgraded to production to log in new users.",t,"max_accounts_reached")}};var vs="/api/v1/sessions",Cs="/api/v1/sessions/logout",Eu="/api/v1/sessions/fork",ws="/api/v1/sessions/fork/recover",Tu="/api/v1/siwe/init",Su="/api/v1/siwe/authenticate",_u="/api/v1/siwe/link",Pu="/api/v1/siwe/unlink",Au="/api/v1/farcaster/init",xu="/api/v1/farcaster/authenticate",ku="/api/v1/farcaster/link",Ru="/api/v1/farcaster/status",Iu="/api/v1/farcaster/unlink",Mu="/api/v1/passwordless/init",Wu="/api/v1/passwordless/authenticate",Ou="/api/v1/passwordless/link",Lu="/api/v1/passwordless/unlink",Nu="/api/v1/passwordless/update",Du="/api/v1/passwordless_sms/init",Uu="/api/v1/passwordless_sms/link",Fu="/api/v1/passwordless_sms/unlink",Bu="/api/v1/passwordless_sms/authenticate",Hu="/api/v1/passwordless_sms/update",bs="/api/v1/oauth/init",Gu="/api/v1/oauth/authenticate",Es="/api/v1/oauth/link",Vu="/api/v1/oauth/unlink",qu="/api/v1/recovery/oauth/init",zu="/api/v1/recovery/oauth/init_icloud",$u="/api/v1/recovery/oauth/authenticate",Ku="/api/v1/passkeys/link/init",ju="/api/v1/passkeys/authenticate/init",Yu="/api/v1/passkeys/link",Zu="/api/v1/passkeys/authenticate",Qu="/api/v1/passkeys/unlink",Ju="/api/v1/telegram/authenticate",Xu="/api/v1/telegram/link",em="/api/v1/telegram/unlink";var tm="/api/v1/mfa/passwordless_sms/init",rm="/api/v1/mfa/passkeys/init",om="/api/v1/users/me/accept_terms",Ts="/api/v1/analytics_events",nm="/api/v1/custom_jwt_account/authenticate",im="/api/v1/plugins/moonpay_on_ramp/sign",am="/api/v1/funding/coinbase_on_ramp/init",sm="/api/v1/funding/coinbase_on_ramp/status";var ri=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");try{let t=await this.api.post(nm,{token:this.meta.token});return{user:t.user,token:t.token,refresh_token:t.refresh_token,identity_token:t.identity_token,is_new_user:t.is_new_user}}catch(t){throw le(t)}}async link(){throw new Error("Unimplemented")}};var Lo=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new w("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(Wu,{email:this.meta.email,code:this.meta.emailCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,identity_token:t.identity_token,is_new_user:t.is_new_user}}catch(t){throw le(t)}}async link(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new w("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(Ou,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw le(t)}}async sendCodeEmail(t,r){if(!this.api)throw new w("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new w("Email must be set when initialzing authentication.");try{return await this.api.post(Mu,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw le(o)}}},Ss=class extends Lo{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new w("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(Nu,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw le(r)}}};import{isMobile as UC,isIOS as FC}from"react-device-detect";var ld=class{constructor(){this._cache={}}get(t){return this._cache[t]}put(t,r){r!==void 0?this._cache[t]=r:this.del(t)}del(t){delete this._cache[t]}getKeys(){return Object.keys(this._cache)}},_s=class{get(t){let r=localStorage.getItem(t);return r===null?void 0:JSON.parse(r)}put(t,r){r!==void 0?localStorage.setItem(t,JSON.stringify(r)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function cd(){try{let e="privy:__session_storage__test",t="blobby",r=new _s;return r.put(e,t),r.del(e),!0}catch{return!1}}function DC(){return typeof window<"u"&&window.localStorage?new _s:new ld}var Q=DC();import{StaticJsonRpcProvider as ra}from"@ethersproject/providers";function lm(){let e=window,t=e.ethereum;if(!t)return[];let r=[];if(t.providers?.length)for(let o of t.providers)o&&r.push(o);return r.push(e.ethereum),r}var Ps=e=>{if(e.isApexWallet)return"Apex Wallet";if(e.isAvalanche)return"Core Wallet";if(e.isBackpack)return"Backpack";if(e.isBifrost)return"Bifrost Wallet";if(e.isBitKeep)return"BitKeep";if(e.isBitski)return"Bitski";if(e.isBlockWallet)return"BlockWallet";if(e.isBraveWallet)return"Brave Wallet";if(e.isClover)return"Clover";if(e.isCoin98)return"Coin98 Wallet";if(e.isCoinbaseWallet)return"Coinbase Wallet";if(e.isDawn)return"Dawn Wallet";if(e.isDefiant)return"Defiant";if(e.isDesig)return"Desig Wallet";if(e.isEnkrypt)return"Enkrypt";if(e.isExodus)return"Exodus";if(e.isFordefi)return"Fordefi";if(e.isFrame)return"Frame";if(e.isFrontier)return"Frontier Wallet";if(e.isGamestop)return"GameStop Wallet";if(e.isHaqqWallet)return"HAQQ Wallet";if(e.isHyperPay)return"HyperPay Wallet";if(e.isImToken)return"ImToken";if(e.isHaloWallet)return"Halo Wallet";if(e.isKuCoinWallet)return"KuCoin Wallet";if(e.isMathWallet)return"MathWallet";if(e.isNovaWallet)return"Nova Wallet";if(e.isOkxWallet||e.isOKExWallet)return"OKX Wallet";if(e.isOneInchIOSWallet||e.isOneInchAndroidWallet)return"1inch Wallet";if(e.isOneKey)return"OneKey Wallet";if(e.isOpera)return"Opera";if(e.isPhantom)return"Phantom";if(e.isPortal)return"Ripio Portal";if(e.isRabby)return"Rabby Wallet";if(e.isRainbow)return"Rainbow";if(e.isSafePal)return"SafePal Wallet";if(e.isStatus)return"Status";if(e.isSubWallet)return"SubWallet";if(e.isTalisman)return"Talisman";if(e.isTally||e.isTaho)return"Taho";if(e.isTokenPocket)return"TokenPocket";if(e.isTokenary)return"Tokenary";if(e.isTrust||e.isTrustWallet)return"Trust Wallet";if(e.isTTWallet)return"TTWallet";if(e.isXDEFI)return"XDEFI Wallet";if(e.isZeal)return"Zeal";if(e.isZerion)return"Zerion";if(e.isMetaMask)return"MetaMask"};var dd=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||Ps(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!dd(r))return!1}return!0},No=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),As=()=>{let e=window;if(!e.ethereum)return!1;if(e.ethereum.isCoinbaseWallet)return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(t&&t.isCoinbaseWallet)return!0}return!1};var cm=(e,t)=>{let r=[],o=[];for(let[n,i]of e.entries())n<t?r.push(i):o.push(i);return[r,o]},xs=e=>!!String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),dm=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},dt=(e,t=3,r=4)=>{if(!e)return"";let o=2,n=3;if(t+r+o+n>=e.length)return e;let i=e.slice(0,o+t),a=e.slice(e.length-r,e.length);return`${i}...${a}`},pd=e=>new Promise(t=>setTimeout(t,e));function pm(e,{interval:t=100,timeout:r=5e3}={}){return new Promise((o,n)=>{let i=0,a,l=()=>{if(i>=r){n("Max attempts reached without result");return}if(a=e(),i+=t,a!=null){o(a);return}setTimeout(l,t)};l()})}var oa=(e,t={})=>{let r=t.delayMs||150,o=t.maxAttempts||270;return new Promise(async(n,i)=>{let a=!1,l=0;for(;!a&&l<o;){if(t.abortSignal?.aborted)return;e().then(s=>{a=!0,n(s)},(...s)=>{a=!0,i(...s)}),l+=1,await pd(r)}a||i(new Error("Exceeded max attempts before resolving function"))})},ks=(e,t,r={},o={})=>{let n=new URL(t,e);for(let[a,l]of Object.entries(r))l!==void 0&&n.searchParams.set(a,l);let i=Object.entries(o);if(i.length>0){let a=new URLSearchParams;for(let[l,s]of i)a.append(l,s);n.hash=a.toString()}return n.href};var um=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),vn=e=>typeof e=="string"?e:"0x"+e.toString(16);async function mm(e,t,r,o=3e3){let n=!1,i=window;return new Promise(a=>{i.ethereum?l():(window.addEventListener("ethereum#initialized",l,{once:!0}),setTimeout(()=>{l()},o));function l(){if(n)return;n=!0,window.removeEventListener("ethereum#initialized",l);let s=e.getProviders(),c=[];for(let m of s)t.includes("coinbase_wallet")&&m.info.rdns==="com.coinbase.wallet"||c.push({type:m.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:m});for(let m of lm()){let f=Ps(m);if(!s.some(u=>u.info.name===f)){if(dd(m,!0)&&!c.find(u=>u.type==="metamask")){c.push({type:"metamask",legacyInjectedProvider:m});continue}if(f==="Phantom"&&!c.find(u=>u.type==="phantom")){c.push({type:"phantom",legacyInjectedProvider:m});continue}if(f==="Coinbase Wallet"&&!c.find(u=>u.type==="coinbase_wallet"&&r?.coinbaseWallet?.connectionOptions!=="smartWalletOnly")){c.push({type:"coinbase_wallet",legacyInjectedProvider:m});continue}c.find(u=>u.type==="unknown_browser_extension")||c.push({type:"unknown_browser_extension",legacyInjectedProvider:m})}}a(c)}})}function oi(e){return`eip155:${String(Number(e))}`}var fm=(e,t,r,o)=>{let n=Number(e),i=t.find(a=>a.id===n);if(!i)throw new ce(`Unsupported chainId ${e}`,4901);return ud(i,r,o)},ud=(e,t,r)=>{let o=e.id,n=Number(e.id),i;if(e.rpcUrls.privyWalletOverride&&e.rpcUrls.privyWalletOverride.http[0])i=e.rpcUrls.privyWalletOverride.http[0];else if(t.rpcUrls&&t.rpcUrls[n])i=t.rpcUrls[n];else if(e.rpcUrls.privy?.http[0]){let a=new URL(e.rpcUrls.privy.http[0]);a.searchParams.append("privyAppId",r),i=a.toString()}else e.rpcUrls.public?.http[0]?i=e.rpcUrls.public.http[0]:i=e.rpcUrls.default?.http[0];if(!i)throw new ce(`No RPC url found for ${o}`);return i},hm=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new ce(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},Gt=(e,t,r,o)=>{let n=Number(e),i=t.find(l=>l.id===n);if(!i)throw new ce(`Unsupported chainId ${e}`,4901);let a;if(i.rpcUrls.privyWalletOverride&&i.rpcUrls.privyWalletOverride.http[0]?a=new ra(i.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?a=new ra(r.rpcUrls[n]):i.rpcUrls.privy?.http[0]?a=new ra({url:i.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):i.rpcUrls.public?.http[0]?a=new ra(i.rpcUrls.public.http[0]):a=new ra(i.rpcUrls.default?.http[0]),!a)throw new ce(`No RPC url found for ${e}`);return a},na=e=>{let t={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},r=e.types.EIP712Domain??Object.entries(e.domain).map(([o,n])=>{if(n!=null&&typeof o=="string"&&o in t)return{name:o,type:t[o]}}).filter(o=>o!==void 0);return{...e,types:{...e.types,EIP712Domain:r}}};var Rs=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(Is))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var Is={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",hostname:"metamask.io",mobile:{native:"metamask://",universal:"https://metamask.app.link"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",hostname:"rainbow.me",mobile:{native:"rainbow://",universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app",native:"uniswap://"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",hostname:"zerion.io",mobile:{native:"zerion://",universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com",native:"dfw://"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}},okx_wallet:{id:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",displayName:"OKX Wallet",hostname:"okx.com",mobile:{native:"okex://main"}},rabby_wallet:{id:"18388be9ac2d02726dbac9777c96efaac06d744b2f6d580fccdd4127a6d01fd1",displayName:"Rabby Wallet",hostname:"rabby.io",mobile:{}}};function ym(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function gm(e,t){let r=ym(t);if(r.deepLink)return Tm(r.deepLink,e);if(r.universalLink)return md(r.universalLink,e);throw new w(`Unsupported wallet ${t.id}`)}function vm(e,t){let r=ym(t);if(r.universalLink)return md(r.universalLink,e)}var Cm="WALLETCONNECT_DEEPLINK_CHOICE";function wm(){try{localStorage.removeItem(Cm)}catch{}}function bm({href:e,name:t}){try{localStorage.setItem(Cm,JSON.stringify({href:e,name:t}))}catch{}}function Em(e){return e.startsWith("http://")||e.startsWith("https://")}function Tm(e,t){if(Em(e))return md(e,t);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function md(e,t){if(!Em(e))return Tm(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function Ms(e,t){window.open(e,t,"noreferrer noopener")}var Le=class{constructor(t){this.promise=null;this.fn=t}execute(t){return this.promise===null&&(this.promise=(async()=>{try{return await this.fn(t)}finally{this.promise=null}})()),this.promise}};var ia=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new Le(this._startChannelOnce.bind(this)),this.pollForReady=new Le(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.channelToken)throw new w("Auth flow must be initialized first");try{let t=await this.api.post(xu,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new w("No response from authentication");return{user:t.user,token:t.token,refresh_token:t.refresh_token,identity_token:t.identity_token,is_new_user:t.is_new_user}}catch(t){throw le(t)}}async link(){if(!this.api)throw new w("Auth flow has no API instance");try{return await this.api.post(ku,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw le(t)}}async _startChannelOnce(){if(!this.api)throw new w("Auth flow has no API instance");let t=await this.api.post(Au,{token:this.captchaToken});UC&&!FC&&t.connect_uri&&Ms(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new w("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.channelToken)throw new w("Auth flow must be initialized first");let t=await this.api.get(Ru,{headers:{"farcaster-channel-token":this.meta.channelToken}});return t.state==="completed"?(this.message=t.message,this.signature=t.signature,this.fid=t.fid,!0):!1}};var Sm="1.76.3";var _m="34357d3c125c2bcf2ce2bc3309d98715",Ws="https://auth.privy.io",Pm=2e4,Ne=1400,Os=2500,fd=Sm;var Cn="privy:token",hd="privy-token",Ls="privy:refresh_token",Am="privy-refresh-token",yd="privy:id_token",gd="privy-id-token",Ns="privy-session",aa="privy:session_transfer_token",HC="privy:wallet",sa="privy:caid",la=e=>`privy:cross-app:${e}`,wn="privy:state_code",bn="privy:code_verifier",En="privy:headless_oauth",Ds=e=>`${HC}:${e}`,vd="privy:connectors",Cd="privy:connections";var Tn=12e4,Eo=1,wd="0x1",ni=3e4,xm="https://api.moonpay.com/v1",km="https://api.moonpay.com/v1",Rm="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",Im="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI";var Mm="deprecated";import{base64url as Lm}from"jose";async function Wm(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function Om(e){return crypto.getRandomValues(new Uint8Array(e))}var GC="S256",VC="S256";function Sn(){return Lm.encode(Om(36))}function ii(){return Sn()}async function ai(e,t=GC){if(t==VC){let r=await Wm(e);return Lm.encode(r)}else return e}function Nm(){let e=Q.get(bn);if(!e)throw new w("Authentication error.");return e}function Us(){return!!Q.get(En)}var Jr=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:Us();this.meta={...t,headless:r}}addCaptchaToken(t){this.meta.captchaToken=t}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new w("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new w("User denied confirmation during OAuth flow");let t=Nm();try{let r=await this.api.post(Gu,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return Q.del(bn),this.meta.headless&&Q.del(En),{user:r.user,token:r.token,refresh_token:r.refresh_token,identity_token:r.identity_token,is_new_user:r.is_new_user,oauth_tokens:r.oauth_tokens}}catch(r){let o=le(r);throw o.privyErrorCode?new w(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new w("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new w("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new w("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new w("User denied confirmation during OAuth flow");let t=Q.get(bn);if(!t)throw new w("Authentication error.");try{let r=await this.api.post(Es,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return Q.del(bn),r}catch(r){throw le(r)}}async getAuthorizationUrl(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.provider)throw new w("Provider must be set when initializing OAuth authentication.");let t=Sn();Q.put(bn,t);let r=ii();Q.put(wn,r);let o=await ai(t);this.meta.headless&&Q.put(En,!0);try{return await this.api.post(bs,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw le(n)}}};function bd(e){return e.charAt(0).toUpperCase()+e.slice(1)}import{jsx as Dm,jsxs as qC}from"react/jsx-runtime";var Fs=({style:e,...t})=>qC("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 24 24",style:{height:"24px",...e},...t,children:[Dm("path",{d:"M17.0722 11.6888C17.0471 8.90571 19.3263 7.56847 19.429 7.50274C18.1466 5.60938 16.153 5.35154 15.4417 5.3212C13.7461 5.14678 12.1306 6.32982 11.269 6.32982C10.4074 6.32982 9.08004 5.34648 7.67246 5.37429C5.82158 5.40209 4.11595 6.45874 3.16171 8.13218C1.24068 11.4942 2.6708 16.4817 4.54423 19.2143C5.46091 20.549 6.55041 22.0531 7.98554 21.9975C9.36803 21.9419 9.88905 21.095 11.5571 21.095C13.2251 21.095 13.696 21.9975 15.1537 21.9697C16.6389 21.9393 17.5806 20.6046 18.4897 19.2648C19.5392 17.7153 19.9725 16.2137 19.9975 16.1354C19.965 16.1228 17.1022 15.0155 17.0722 11.6888Z",fill:"currentColor"}),Dm("path",{d:"M14.3295 3.51373C15.0909 2.58347 15.6043 1.28921 15.4641 0C14.3671 0.0455014 13.0396 0.738135 12.2532 1.66838C11.5494 2.48994 10.9307 3.80695 11.0986 5.07089C12.3183 5.16694 13.5681 4.44145 14.3295 3.51373Z",fill:"currentColor"})]});import{jsx as ca,jsxs as zC}from"react/jsx-runtime";var Bs=({style:e,...t})=>zC("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 71 55",style:{height:"24px",...e},...t,children:[ca("g",{clipPath:"url(#clip0)",children:ca("path",{d:"M60.1045 4.8978C55.5792 2.8214 50.7265 1.2916 45.6527 0.41542C45.5603 0.39851 45.468 0.440769 45.4204 0.525289C44.7963 1.6353 44.105 3.0834 43.6209 4.2216C38.1637 3.4046 32.7345 3.4046 27.3892 4.2216C26.905 3.0581 26.1886 1.6353 25.5617 0.525289C25.5141 0.443589 25.4218 0.40133 25.3294 0.41542C20.2584 1.2888 15.4057 2.8186 10.8776 4.8978C10.8384 4.9147 10.8048 4.9429 10.7825 4.9795C1.57795 18.7309 -0.943561 32.1443 0.293408 45.3914C0.299005 45.4562 0.335386 45.5182 0.385761 45.5576C6.45866 50.0174 12.3413 52.7249 18.1147 54.5195C18.2071 54.5477 18.305 54.5139 18.3638 54.4378C19.7295 52.5728 20.9469 50.6063 21.9907 48.5383C22.0523 48.4172 21.9935 48.2735 21.8676 48.2256C19.9366 47.4931 18.0979 46.6 16.3292 45.5858C16.1893 45.5041 16.1781 45.304 16.3068 45.2082C16.679 44.9293 17.0513 44.6391 17.4067 44.3461C17.471 44.2926 17.5606 44.2813 17.6362 44.3151C29.2558 49.6202 41.8354 49.6202 53.3179 44.3151C53.3935 44.2785 53.4831 44.2898 53.5502 44.3433C53.9057 44.6363 54.2779 44.9293 54.6529 45.2082C54.7816 45.304 54.7732 45.5041 54.6333 45.5858C52.8646 46.6197 51.0259 47.4931 49.0921 48.2228C48.9662 48.2707 48.9102 48.4172 48.9718 48.5383C50.038 50.6034 51.2554 52.5699 52.5959 54.435C52.6519 54.5139 52.7526 54.5477 52.845 54.5195C58.6464 52.7249 64.529 50.0174 70.6019 45.5576C70.6551 45.5182 70.6887 45.459 70.6943 45.3942C72.1747 30.0791 68.2147 16.7757 60.1968 4.9823C60.1772 4.9429 60.1437 4.9147 60.1045 4.8978ZM23.7259 37.3253C20.2276 37.3253 17.3451 34.1136 17.3451 30.1693C17.3451 26.225 20.1717 23.0133 23.7259 23.0133C27.308 23.0133 30.1626 26.2532 30.1066 30.1693C30.1066 34.1136 27.28 37.3253 23.7259 37.3253ZM47.3178 37.3253C43.8196 37.3253 40.9371 34.1136 40.9371 30.1693C40.9371 26.225 43.7636 23.0133 47.3178 23.0133C50.9 23.0133 53.7545 26.2532 53.6986 30.1693C53.6986 34.1136 50.9 37.3253 47.3178 37.3253Z",fill:"#5865F2"})}),ca("defs",{children:ca("clipPath",{id:"clip0",children:ca("rect",{width:"71",height:"55",fill:"white"})})})]});import{jsx as Um}from"react/jsx-runtime";var Hs=({style:e,...t})=>Um("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"24",y:"24",viewBox:"0 0 98 96",style:{height:"24px",...e},...t,children:Um("path",{d:"M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z",fill:"currentColor"})});import{GlobeAltIcon as $C}from"@heroicons/react/24/outline";import{jsx as KC}from"react/jsx-runtime";var Fm=({style:e})=>KC($C,{style:{color:"var(--privy-color-error)",...e}});import{jsx as Gs,jsxs as jC}from"react/jsx-runtime";var Vs=({style:e,...t})=>jC("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...e},...t,children:[Gs("path",{d:"M22.56 12.25C22.56 11.47 22.49 10.72 22.36 10H12V14.255H17.92C17.665 15.63 16.89 16.795 15.725 17.575V20.335H19.28C21.36 18.42 22.56 15.6 22.56 12.25Z",fill:"#4285F4"}),Gs("path",{d:"M12 23C14.97 23 17.46 22.015 19.28 20.335L15.725 17.575C14.74 18.235 13.48 18.625 12 18.625C9.13504 18.625 6.71004 16.69 5.84504 14.09H2.17004V16.94C3.98004 20.535 7.70004 23 12 23Z",fill:"#34A853"}),Gs("path",{d:"M5.845 14.09C5.625 13.43 5.5 12.725 5.5 12C5.5 11.275 5.625 10.57 5.845 9.91V7.06H2.17C1.4 8.59286 0.999321 10.2846 1 12C1 13.775 1.425 15.455 2.17 16.94L5.845 14.09Z",fill:"#FBBC05"}),Gs("path",{d:"M12 5.375C13.615 5.375 15.065 5.93 16.205 7.02L19.36 3.865C17.455 2.09 14.965 1 12 1C7.70004 1 3.98004 3.465 2.17004 7.06L5.84504 9.91C6.71004 7.31 9.13504 5.375 12 5.375Z",fill:"#EA4335"})]});import{jsx as Tr,jsxs as qs}from"react/jsx-runtime";function zs(e){return qs("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:26,height:26,viewBox:"0 0 140 140",x:"0px",y:"0px",fill:"none",...e,children:[qs("defs",{children:[qs("linearGradient",{id:"b",children:[Tr("stop",{offset:"0",stopColor:"#3771c8"}),Tr("stop",{stopColor:"#3771c8",offset:".128"}),Tr("stop",{offset:"1",stopColor:"#60f",stopOpacity:"0"})]}),qs("linearGradient",{id:"a",children:[Tr("stop",{offset:"0",stopColor:"#fd5"}),Tr("stop",{offset:".1",stopColor:"#fd5"}),Tr("stop",{offset:".5",stopColor:"#ff543e"}),Tr("stop",{offset:"1",stopColor:"#c837ab"})]}),Tr("radialGradient",{id:"c",cx:"158.429",cy:"578.088",r:"65",xlinkHref:"#a",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(0 -1.98198 1.8439 0 -1031.402 454.004)",fx:"158.429",fy:"578.088"}),Tr("radialGradient",{id:"d",cx:"147.694",cy:"473.455",r:"65",xlinkHref:"#b",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(.17394 .86872 -3.5818 .71718 1648.348 -458.493)",fx:"147.694",fy:"473.455"})]}),Tr("path",{fill:"url(#c)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),Tr("path",{fill:"url(#d)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),Tr("path",{fill:"#fff",d:"M66.004 18c-13.036 0-14.672.057-19.792.29-5.11.234-8.598 1.043-11.65 2.23-3.157 1.226-5.835 2.866-8.503 5.535-2.67 2.668-4.31 5.346-5.54 8.502-1.19 3.053-2 6.542-2.23 11.65C18.06 51.327 18 52.964 18 66s.058 14.667.29 19.787c.235 5.11 1.044 8.598 2.23 11.65 1.227 3.157 2.867 5.835 5.536 8.503 2.667 2.67 5.345 4.314 8.5 5.54 3.054 1.187 6.543 1.996 11.652 2.23 5.12.233 6.755.29 19.79.29 13.037 0 14.668-.057 19.788-.29 5.11-.234 8.602-1.043 11.656-2.23 3.156-1.226 5.83-2.87 8.497-5.54 2.67-2.668 4.31-5.346 5.54-8.502 1.18-3.053 1.99-6.542 2.23-11.65.23-5.12.29-6.752.29-19.788 0-13.036-.06-14.672-.29-19.792-.24-5.11-1.05-8.598-2.23-11.65-1.23-3.157-2.87-5.835-5.54-8.503-2.67-2.67-5.34-4.31-8.5-5.535-3.06-1.187-6.55-1.996-11.66-2.23-5.12-.233-6.75-.29-19.79-.29zm-4.306 8.65c1.278-.002 2.704 0 4.306 0 12.816 0 14.335.046 19.396.276 4.68.214 7.22.996 8.912 1.653 2.24.87 3.837 1.91 5.516 3.59 1.68 1.68 2.72 3.28 3.592 5.52.657 1.69 1.44 4.23 1.653 8.91.23 5.06.28 6.58.28 19.39s-.05 14.33-.28 19.39c-.214 4.68-.996 7.22-1.653 8.91-.87 2.24-1.912 3.835-3.592 5.514-1.68 1.68-3.275 2.72-5.516 3.59-1.69.66-4.232 1.44-8.912 1.654-5.06.23-6.58.28-19.396.28-12.817 0-14.336-.05-19.396-.28-4.68-.216-7.22-.998-8.913-1.655-2.24-.87-3.84-1.91-5.52-3.59-1.68-1.68-2.72-3.276-3.592-5.517-.657-1.69-1.44-4.23-1.653-8.91-.23-5.06-.276-6.58-.276-19.398s.046-14.33.276-19.39c.214-4.68.996-7.22 1.653-8.912.87-2.24 1.912-3.84 3.592-5.52 1.68-1.68 3.28-2.72 5.52-3.592 1.692-.66 4.233-1.44 8.913-1.655 4.428-.2 6.144-.26 15.09-.27zm29.928 7.97c-3.18 0-5.76 2.577-5.76 5.758 0 3.18 2.58 5.76 5.76 5.76 3.18 0 5.76-2.58 5.76-5.76 0-3.18-2.58-5.76-5.76-5.76zm-25.622 6.73c-13.613 0-24.65 11.037-24.65 24.65 0 13.613 11.037 24.645 24.65 24.645C79.617 90.645 90.65 79.613 90.65 66S79.616 41.35 66.003 41.35zm0 8.65c8.836 0 16 7.163 16 16 0 8.836-7.164 16-16 16-8.837 0-16-7.164-16-16 0-8.837 7.163-16 16-16z"})]})}import{jsx as $s}from"react/jsx-runtime";function Ks({style:e,...t}){return $s("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0,0,256,256",style:{height:"26px",width:"26px",...e},...t,children:$s("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:$s("g",{transform:"scale(5.12,5.12)",children:$s("path",{d:"M41,4h-32c-2.76,0 -5,2.24 -5,5v32c0,2.76 2.24,5 5,5h32c2.76,0 5,-2.24 5,-5v-32c0,-2.76 -2.24,-5 -5,-5zM17,20v19h-6v-19zM11,14.47c0,-1.4 1.2,-2.47 3,-2.47c1.8,0 2.93,1.07 3,2.47c0,1.4 -1.12,2.53 -3,2.53c-1.8,0 -3,-1.13 -3,-2.53zM39,39h-6c0,0 0,-9.26 0,-10c0,-2 -1,-4 -3.5,-4.04h-0.08c-2.42,0 -3.42,2.06 -3.42,4.04c0,0.91 0,10 0,10h-6v-19h6v2.56c0,0 1.93,-2.56 5.81,-2.56c3.97,0 7.19,2.73 7.19,8.26z"})})})})}import{jsx as Bm,jsxs as YC}from"react/jsx-runtime";function js(e){return YC("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[Bm("path",{fill:"#1ed760",d:"M248 8C111.1 8 0 119.1 0 256s111.1 248 248 248 248-111.1 248-248S384.9 8 248 8Z"}),Bm("path",{d:"M406.6 231.1c-5.2 0-8.4-1.3-12.9-3.9-71.2-42.5-198.5-52.7-280.9-29.7-3.6 1-8.1 2.6-12.9 2.6-13.2 0-23.3-10.3-23.3-23.6 0-13.6 8.4-21.3 17.4-23.9 35.2-10.3 74.6-15.2 117.5-15.2 73 0 149.5 15.2 205.4 47.8 7.8 4.5 12.9 10.7 12.9 22.6 0 13.6-11 23.3-23.2 23.3zm-31 76.2c-5.2 0-8.7-2.3-12.3-4.2-62.5-37-155.7-51.9-238.6-29.4-4.8 1.3-7.4 2.6-11.9 2.6-10.7 0-19.4-8.7-19.4-19.4s5.2-17.8 15.5-20.7c27.8-7.8 56.2-13.6 97.8-13.6 64.9 0 127.6 16.1 177 45.5 8.1 4.8 11.3 11 11.3 19.7-.1 10.8-8.5 19.5-19.4 19.5zm-26.9 65.6c-4.2 0-6.8-1.3-10.7-3.6-62.4-37.6-135-39.2-206.7-24.5-3.9 1-9 2.6-11.9 2.6-9.7 0-15.8-7.7-15.8-15.8 0-10.3 6.1-15.2 13.6-16.8 81.9-18.1 165.6-16.5 237 26.2 6.1 3.9 9.7 7.4 9.7 16.5s-7.1 15.4-15.2 15.4z"})]})}import{jsx as Ed,jsxs as ZC}from"react/jsx-runtime";function Ys(e){return ZC("svg",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 293768 333327",width:24,height:24,...e,children:[Ed("path",{fill:"#26f4ee",d:"M204958 0c5369 45832 32829 78170 77253 81022v43471l-287 27V87593c-44424-2850-69965-30183-75333-76015l-47060-1v192819c6791 86790-60835 89368-86703 56462 30342 18977 79608 6642 73766-68039V0h58365zM78515 319644c-26591-5471-50770-21358-64969-44588-34496-56437-3401-148418 96651-157884v54345l-164 27v-40773C17274 145544 7961 245185 33650 286633c9906 15984 26169 27227 44864 33011z"}),Ed("path",{fill:"#fb2c53",d:"M218434 11587c3505 29920 15609 55386 35948 70259-27522-10602-43651-34934-47791-70262l11843 3zm63489 82463c3786 804 7734 1348 11844 1611v51530c-25770 2537-48321-5946-74600-21749l4034 88251c0 28460 106 41467-15166 67648-34260 58734-95927 63376-137628 35401 54529 22502 137077-4810 136916-103049v-96320c26279 15803 48830 24286 74600 21748V94050zm-171890 37247c5390-1122 11048-1985 16998-2548v54345c-21666 3569-35427 10222-41862 22528-20267 38754 5827 69491 35017 74111-33931 5638-73721-28750-49999-74111 6434-12304 18180-18959 39846-22528v-51797zm64479-119719h1808-1808z"}),Ed("path",{d:"M206590 11578c5369 45832 30910 73164 75333 76015v51528c-25770 2539-48321-5945-74600-21748v96320c206 125717-135035 135283-173673 72939-25688-41449-16376-141089 76383-155862v52323c-21666 3569-33412 10224-39846 22528-39762 76035 98926 121273 89342-1225V11577l47060 1z",fill:"#000000"})]})}import{jsx as Hm}from"react/jsx-runtime";var Zs=({style:e,...t})=>Hm("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",width:"24px",...e},...t,children:Hm("path",{d:"M 14.285156 10.171875 L 23.222656 0 L 21.105469 0 L 13.34375 8.832031 L 7.148438 0 L 0 0 L 9.371094 13.355469 L 0 24.019531 L 2.117188 24.019531 L 10.308594 14.691406 L 16.851562 24.019531 L 24 24.019531 M 2.878906 1.5625 L 6.132812 1.5625 L 21.101562 22.535156 L 17.851562 22.535156",fill:"currentColor"})});var Gm={google:{name:"Google",component:Vs},discord:{name:"Discord",component:Bs},github:{name:"Github",component:Hs},linkedin:{name:"LinkedIn",component:Ks},twitter:{name:"Twitter",component:Zs},spotify:{name:"Spotify",component:js},instagram:{name:"Instagram",component:zs},tiktok:{name:"Tiktok",component:Ys},apple:{name:"Apple",component:Fs}},da=e=>e in Gm?Gm[e]:{name:"Unknown",component:Fm};function Vm(e,t){let r={detail:"",retryable:!1},o=bd(t);if(e?.privyErrorCode==="linked_to_another_user"&&(r.detail="This account has already been linked to another user."),e?.privyErrorCode==="invalid_credentials"&&(r.retryable=!0,r.detail="Something went wrong. Try again."),e.privyErrorCode==="oauth_user_denied"&&(r.detail=`Retry and check ${o} to finish connecting your account.`,r.retryable=!0),e?.privyErrorCode==="too_many_requests"&&(r.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode==="too_many_requests"&&e.message.includes("provider rate limit")){let n=da(t).name;r.detail=`Request limit reached for ${n}. Please wait a moment and try again.`}if(e?.privyErrorCode==="oauth_account_suspended"){let n=da(t).name;r.detail=`Your ${n} account is suspended. Please try another login method.`}return e?.privyErrorCode==="cannot_link_more_of_type"&&(r.detail="You cannot authorize more than one account for this user."),e?.privyErrorCode==="oauth_unexpected"&&t.startsWith("privy:")&&(r.detail="Something went wrong. Please try again."),r}function pa(){let e=new URLSearchParams(window.location.search),t=e.get("privy_oauth_code"),r=e.get("privy_oauth_state"),o=e.get("privy_oauth_provider");if(!t||!r||!o)return{inProgress:!1};let n=!1;try{n=!!window.opener.location.origin}catch{}return{inProgress:!0,authorizationCode:t,stateCode:r,provider:o,headless:Us(),popupFlow:window.opener!==null&&n}}function _n(){let e=new URL(window.location.href);e.searchParams.delete("privy_oauth_code"),e.searchParams.delete("privy_oauth_provider"),e.searchParams.delete("privy_oauth_state"),Q.del(wn),window.history.replaceState({},"",e)}var Pn=class{constructor(t){this.initAuthenticateOnce=new Le(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new Le(this._initLinkOnce.bind(this)),this.meta={captchaToken:t}}async initAuthenticationFlow(){if(!this.api)throw new w("Auth flow has no API instance");this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute()}async initLinkFlow(){if(!this.api)throw new w("Auth flow has no API instance");this.meta.initLinkResponse=await this.initLinkOnce.execute()}async authenticate(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new w("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new w("WebAuthn is not supported in this browser");this.meta.initAuthenticateResponse||(this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute());try{let r=await t.startAuthentication(this._transformInitAuthenticateOptionsToCamelCase(this.meta.initAuthenticateResponse.options)),o=await this.api.post(Zu,{relying_party:this.meta.initAuthenticateResponse.relying_party,challenge:this.meta.initAuthenticateResponse.options.challenge,authenticator_response:this._transformAuthenticationResponseToSnakeCase(r)});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(r){throw r.name==="NotAllowedError"?new w("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):le(r)}}async link(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new w("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new w("WebAuthn is not supported in this browser");this.meta.initLinkResponse||(this.meta.initLinkResponse=await this.initLinkOnce.execute());try{let r=this.meta.initLinkResponse.options,o=await t.startRegistration(this._transformInitLinkOptionsToCamelCase(r));return await this.api.post(Yu,{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(o)})}catch(r){throw r.name==="NotAllowedError"?new w("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):le(r)}}async _initAuthenticateOnce(){if(!this.api)throw new w("Auth flow has no API instance");return await this.api.post(ju,{token:this.meta.captchaToken})}async _initLinkOnce(){if(!this.api)throw new w("Auth flow has no API instance");return await this.api.post(Ku,{})}_transformInitLinkOptionsToCamelCase(t){return{rp:t.rp,user:{id:t.user.id,name:t.user.name,displayName:t.user.display_name},challenge:t.challenge,pubKeyCredParams:t.pub_key_cred_params.map(r=>({type:r.type,alg:r.alg})),timeout:t.timeout,excludeCredentials:t.exclude_credentials?.map(r=>({id:r.id,type:r.type,transports:r.transports})),authenticatorSelection:{authenticatorAttachment:t.authenticator_selection?.authenticator_attachment,requireResidentKey:t.authenticator_selection?.require_resident_key,residentKey:t.authenticator_selection?.resident_key,userVerification:t.authenticator_selection?.user_verification},attestation:t.attestation,extensions:{appid:t.extensions?.app_id,credProps:t.extensions?.cred_props?.rk,hmacCreateSecret:t.extensions?.hmac_create_secret}}}_transformRegistrationResponseToSnakeCase(t){return{id:t.id,raw_id:t.rawId,response:{client_data_json:t.response.clientDataJSON,attestation_object:t.response.attestationObject,authenticator_data:t.response.authenticatorData},authenticator_attachment:t.authenticatorAttachment,client_extension_results:{app_id:t.clientExtensionResults.appid,cred_props:t.clientExtensionResults.credProps,hmac_create_secret:t.clientExtensionResults.hmacCreateSecret},type:t.type}}_transformInitAuthenticateOptionsToCamelCase(t){return{challenge:t.challenge,allowCredentials:t.allow_credentials?.map(r=>({id:r.id,type:r.type,transports:r.transports}))||[],timeout:t.timeout,extensions:{appid:t.extensions?.app_id,credProps:t.extensions?.cred_props,hmacCreateSecret:t.extensions?.hmac_create_secret},userVerification:t.user_verification}}_transformAuthenticationResponseToSnakeCase(t){return{id:t.id,raw_id:t.rawId,response:{client_data_json:t.response.clientDataJSON,authenticator_data:t.response.authenticatorData,signature:t.response.signature,user_handle:t.response.userHandle},authenticator_attachment:t.authenticatorAttachment,client_extension_results:{app_id:t.clientExtensionResults.appid,cred_props:t.clientExtensionResults.credProps,hmac_create_secret:t.clientExtensionResults.hmacCreateSecret},type:t.type}}};var Qs=({address:e,chainId:t,nonce:r})=>{let o=window.location.host,n=window.location.origin,i="By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",a=new Date().toISOString();return`${o} wants you to sign in with your Ethereum account:
2
2
  ${e}
3
3
 
4
4
  ${i}
@@ -9,7 +9,7 @@ Chain ID: ${t}
9
9
  Nonce: ${r}
10
10
  Issued At: ${a}
11
11
  Resources:
12
- - https://privy.io`};var To=class{constructor(t,r,o){this.getNonceOnce=new Le(this._getNonceOnce.bind(this)),this.wallet=t,this.captchaToken=o,this.client=r}get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType}}async authenticate(){if(!this.client)throw new w("SiweFlow has no client instance");try{let{message:t,signature:r}=await this.sign(),o=await this.client.authenticateWithSiweInternal({message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType});return{user:o.user,token:o.token,refresh_token:o.refresh_token,identity_token:o.identity_token,is_new_user:o.is_new_user}}catch(t){throw le(t)}}async link(){if(!this.client)throw new w("SiweFlow has no client instance");try{let{message:t,signature:r}=await this.sign();return await this.client.linkWithSiweInternal({message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw le(t)}}async sign(){if(!this.client)throw new w("SiweFlow has no client instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new w("Could not prepare SIWE message");let t=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async _getNonceOnce(){if(!this.client)throw new w("SiweFlow has no client instance");return await this.client.generateSiweNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildSiweMessage(){if(!this.client)throw new w("SiweFlow has no client instance");let t=this.wallet.address,r=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=Zs({address:t,chainId:r,nonce:this.nonce}),this.preparedMessage}};var Sn=class{constructor(t,r){this.meta={phoneNumber:t,captchaToken:r}}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new w("phone number and sms code must be set prior to calling authenticate.");try{let t=await this.api.post(Uu,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,identity_token:t.identity_token,is_new_user:t.is_new_user}}catch(t){throw le(t)}}async link(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new w("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(Nu,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw le(t)}}async sendSmsCode(t,r){if(!this.api)throw new w("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),r&&(this.meta.captchaToken=r),!this.meta.phoneNumber)throw new w("phone nNumber must be set when initialzing authentication.");try{return await this.api.post(Lu,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw le(o)}}};var ii=class{constructor(t){this.meta={captchaToken:t}}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");try{let t=await this.api.post(Yu,{captcha_token:this.meta.captchaToken,telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData});return{user:t.user,token:t.token,refresh_token:t.refresh_token,identity_token:t.identity_token,is_new_user:t.is_new_user}}catch(t){throw le(t)}}async link(){if(!this.api)throw new w("Auth flow has no API instance");try{return await this.api.post(Zu,{telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData})}catch(t){throw le(t)}}};function bd(e){let t={detail:"",retryable:!1};return e?.privyErrorCode==="linked_to_another_user"&&(t.detail="This account has already been linked to another user."),e?.privyErrorCode==="disallowed_login_method"&&(t.detail="Login with Telegram not allowed."),e?.privyErrorCode==="invalid_data"&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode==="cannot_link_more_of_type"&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode==="invalid_credentials"&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode==="too_many_requests"&&(t.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode==="too_many_requests"&&e.message.includes("rate limit")&&(t.detail="Request limit reached for Telegram. Please wait a moment and try again."),t}function Gm(){let e;if(e=$C(),e)return Hm(),{...e,flowType:"login-url"};if(e=KC(),e)return Hm(),{...e,flowType:"web-app"}}function $C(){let e=new URLSearchParams(window.location.search),t=Number(e.get("id")||""),r=e.get("hash"),o=Number(e.get("auth_date")||""),n=e.get("first_name"),i=e.get("last_name")||void 0,a=e.get("username")||void 0,l=e.get("photo_url")||void 0;if(!(!t||!n||!o||!r))return{id:t,first_name:n,last_name:i,username:a,photo_url:l,auth_date:o,hash:r}}function KC(){let e=window.location.hash;if(!e||!e.startsWith("#tgWebAppData"))return;let t=new URLSearchParams(decodeURIComponent(e.replace("#tgWebAppData=",""))),r=t.get("query_id"),o=t.get("user"),n=Number(t.get("auth_date")||""),i=t.get("hash");if(!(!r||!o||!n||!i))return{query_id:r,user:o,auth_date:n,hash:i}}function Hm(){let e=new URL(window.location.href);e.searchParams.delete("id"),e.searchParams.delete("hash"),e.searchParams.delete("auth_date"),e.searchParams.delete("first_name"),e.searchParams.delete("last_name"),e.searchParams.delete("username"),e.searchParams.delete("photo_url"),window.history.replaceState({},"",e)}import{v4 as V3}from"uuid";function ee(e){return e?new Date(e*1e3):null}function jC(e){let t=[];for(let r of e){let o=r.type;switch(r.type){case"wallet":let n={address:r.address,type:r.type,imported:r.imported,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at),chainType:r.chain_type,chainId:r.chain_id,walletClient:r.wallet_client_type==="privy"?"privy":"unknown",walletClientType:r.wallet_client_type,connectorType:r.connector_type,recoveryMethod:r.recovery_method};t.push(n);break;case"cross_app":let i={type:r.type,subject:r.subject,embeddedWallets:r.embedded_wallets,smartWallets:r.smart_wallets,providerApp:{id:r.provider_app_id},verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(i);break;case"email":let a={address:r.address,type:r.type,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(a);break;case"phone":let l={number:r.phoneNumber,type:r.type,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(l);break;case"google_oauth":let s={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(s);break;case"spotify_oauth":let c={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(c);break;case"instagram_oauth":let m={subject:r.subject,username:r.username,type:r.type,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(m);break;case"twitter_oauth":let f={subject:r.subject,username:r.username,name:r.name,type:r.type,profilePictureUrl:r.profile_picture_url,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(f);break;case"discord_oauth":let u={subject:r.subject,username:r.username,email:r.email,type:r.type,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(u);break;case"github_oauth":let C={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(C);break;case"tiktok_oauth":let g={subject:r.subject,username:r.username,name:r.name,type:r.type,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(g);break;case"linkedin_oauth":let y={subject:r.subject,name:r.name,email:r.email,vanityName:r.vanity_name,type:r.type,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(y);break;case"apple_oauth":let b={subject:r.subject,email:r.email,type:r.type,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(b);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)});break;case"farcaster":let E={type:r.type,fid:r.fid,ownerAddress:r.owner_address,displayName:r.display_name,username:r.username,bio:r.bio,pfp:r.profile_picture_url,url:r.homepage_url,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at),signerPublicKey:r.signer_public_key};t.push(E);break;case"passkey":let k={type:r.type,enrolledInMfa:r.enrolled_in_mfa,credentialId:r.credential_id,authenticatorName:r.authenticator_name,createdWithDevice:r.created_with_device,createdWithOs:r.created_with_os,createdWithBrowser:r.created_with_browser,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(k);break;case"telegram":let T={type:r.type,telegramUserId:r.telegram_user_id,firstName:r.first_name,lastName:r.last_name,username:r.username,photoUrl:r.photo_url,verifiedAt:ee(r.first_verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(T);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function Vt(e,t){return e.slice().sort((r,o)=>(o.firstVerifiedAt??o.verifiedAt).getTime()-(r.firstVerifiedAt??r.verifiedAt).getTime()).find(r=>r.type===t)}var ye=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&!t.imported&&t.chainType==="ethereum")||null,_n=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&!t.imported&&t.chainType==="solana")||null,Qs=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&t.imported&&t.chainType==="ethereum")||null,YC=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),qt=(e,t)=>ye(e)||_n(e)?!1:t==="all-users"||t==="users-without-wallets"&&!YC(e)?.length;function zt(e){if(!e)return null;let t=jC(e.linked_accounts),r=Vt(t,"wallet"),o=Vt(t,"email"),n=Vt(t,"phone"),i=Vt(t,"google_oauth"),a=Vt(t,"twitter_oauth"),l=Vt(t,"discord_oauth"),s=Vt(t,"github_oauth"),c=Vt(t,"spotify_oauth"),m=Vt(t,"instagram_oauth"),f=Vt(t,"tiktok_oauth"),u=Vt(t,"linkedin_oauth"),C=Vt(t,"apple_oauth"),g=Vt(t,"farcaster"),y=Vt(t,"telegram"),b=e.mfa_methods.map(({type:k,verified_at:T})=>({type:k,verifiedAt:ee(T)}));return{id:e.id,createdAt:ee(e.created_at),linkedAccounts:t,email:o&&{address:o?.address},phone:n&&{number:n?.number},wallet:r&&{address:r.address,chainType:r.chainType,chainId:r.chainId,walletClient:r.walletClient,walletClientType:r.walletClientType,connectorType:r.connectorType,recoveryMethod:r.recoveryMethod,imported:r.imported},google:i&&{subject:i.subject,email:i.email,name:i.name},twitter:a&&{subject:a.subject,username:a.username,name:a.name,profilePictureUrl:a.profilePictureUrl},discord:l&&{subject:l.subject,username:l.username,email:l.email},github:s&&{subject:s.subject,username:s.username,name:s.name,email:s.email},spotify:c&&{subject:c.subject,email:c.email,name:c.name},instagram:m&&{subject:m.subject,username:m.username},tiktok:f&&{subject:f.subject,username:f.username,name:f.name},linkedin:u&&{subject:u.subject,name:u.name,email:u.email,vanityName:u.vanityName},apple:C&&{subject:C.subject,email:C.email},farcaster:g&&{fid:g.fid,ownerAddress:g.ownerAddress,displayName:g.displayName,username:g.username,bio:g.bio,pfp:g.pfp,url:g.url,signerPublicKey:g.signerPublicKey},telegram:y&&{telegramUserId:y.telegramUserId,firstName:y.firstName,lastName:y.lastName,username:y.username,photoUrl:y.photoUrl},mfaMethods:b.map(k=>k.type),hasAcceptedTerms:e.has_accepted_terms??!1}}import{getAddress as qf}from"@ethersproject/address";import{isHexString as D3}from"@ethersproject/bytes";import U3 from"eventemitter3";import o3 from"@coinbase/wallet-sdk";import{jsx as Vm,jsxs as ZC}from"react/jsx-runtime";var So=({style:e,...t})=>ZC("svg",{width:"1024",height:"1024",viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[Vm("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),Vm("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]});import{getAddress as eo}from"@ethersproject/address";import{Web3Provider as Ym}from"@ethersproject/providers";import{default as t3}from"eventemitter3";import e3 from"eventemitter3";var QC=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],qm=e=>QC.includes(e);import{ErrorCode as JC}from"@ethersproject/logger";import{ProviderErrors as Pn}from"@privy-io/js-sdk-core";var ai=class extends ce{constructor(){super("Wallet timeout");this.type="wallet_error"}},si=class extends ce{constructor(){super("User rejected connection");this.type="wallet_error"}},Lr=e=>{if(e instanceof ce)return e;if(e?.code&&e?.reason){let t=new Ct(e);return e.code===JC.ACTION_REJECTED&&(t.details=Pn.E4001_USER_REJECTED_REQUEST),t}return e?.code?new Ct(e):new ce("Unknown connector error",e)},Tr=class extends et{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},Ct=class extends Tr{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(Pn).find(i=>i.eipCode===o.code);this.details=n||Pn.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=Pn.E32002_CONNECTION_ALREADY_PENDING:this.details=Pn.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=Pn.E32002_WALLET_LOCKED))}},XC={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Wallet request timed out",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_USER_REJECTED_CONNECTION:{message:"You rejected the request",detail:"Please try connecting again.",retryable:!0}},_o={...XC,...Pn};var je=class{constructor(t,r){this.removeListener=(t,r)=>{if(this.walletProvider)try{return this.walletProvider.removeListener(t,r)}catch{console.warn("Unable to remove wallet provider listener")}};this.walletTimeout=(t=new ai,r=this.rpcTimeoutDuration)=>new Promise((o,n)=>setTimeout(()=>{n(t)},r));this.setWalletProvider=t=>{this.walletProvider&&this._subscriptions.forEach(r=>{this.removeListener(r.eventName,r.listener)}),this.walletProvider=t,this._subscriptions.forEach(r=>{this.walletProvider?.on(r.eventName,r.listener)})};this.walletProvider=t,this.rpcTimeoutDuration=r||wn,this._subscriptions=[]}on(t,r){if(this.walletProvider)return this.walletProvider.on(t,r);this._subscriptions.push({eventName:t,listener:r})}async request(t){if(!this.walletProvider)throw new ce(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),this.walletTimeout()]).catch(r=>{throw Lr(r)})}},Do=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},pa=class extends e3{constructor(r,o,n,i,a,l=1){super();this.walletProxy=r,this.address=o,this.chainId=l,this.rpcConfig=n,this.chains=i,this.provider=Gt(l,this.chains,n,{appId:a}),this.rpcTimeoutDuration=li(n,"privy"),this.appId=a}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new Do(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await we()||!this.address)throw new Do("Disconnected",4900);return(await Km(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new Do(`Invalid params for ${r.method}`,4200);let o;if(typeof r.params[0]=="string")o=r.params[0];else if("chainId"in r.params[0]&&typeof r.params[0].chainId=="string")o=r.params[0].chainId;else throw new Do(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=Gt(this.chainId,this.chains,this.rpcConfig,{appId:this.appId}),this.emit("chainChanged",o)}async handlePersonalSign(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for personal_sign");let o=r.params[0],n=r.params[1];return await zm(o,void 0,n)}async handleSignedTypedData(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_signTypedData_v4");let o=typeof r.params[1]=="string"?JSON.parse(r.params[1]):r.params[1];return await $m(oa(o))}async handleEstimateGas(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_estimateGas");delete r.params[0].gasPrice,delete r.params[0].maxFeePerGas,delete r.params[0].maxPriorityFeePerGas;let o={...r.params[0],chainId:hn(this.chainId)};try{return await this.provider.send("eth_estimateGas",[o])}catch(n){console.warn(`Gas estimation failed with error: ${n}. Retrying gas estimation by omitting the 'from' address`);try{return delete o.from,await this.provider.send("eth_estimateGas",[o])}catch(i){throw console.warn(`Gas estimation failed with error: ${i} when omitting the 'from' address`),n}}}async request(r){switch(console.debug("Embedded1193Provider.request() called with args",r),r.method){case"eth_accounts":case"eth_requestAccounts":return this.address?[this.address]:[];case"eth_chainId":return hn(this.chainId);case"eth_estimateGas":return this.handleEstimateGas(r);case"eth_sendTransaction":return this.handleSendTransaction(r);case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(r);case"personal_sign":return this.handlePersonalSign(r);case"eth_signTypedData_v4":return this.handleSignedTypedData(r);default:break}if(qm(r.method)){let o=await we();if(await jm(),!o||!this.address)throw new Do("Disconnected",4900);try{return(await this.walletProxy.rpc({address:this.address,accessToken:o,request:{method:r.method,params:r.params}})).response.data}catch(n){throw console.error(n),new Do("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await we();if(!r||!this.address)return null;try{return(await this.walletProxy.connect({address:this.address,accessToken:r})).address}catch(o){return console.error(o),null}}},Xr=class extends je{constructor(r){super(r,r.rpcTimeoutDuration)}},Uo=class extends je{constructor(t){super(t,t.rpcTimeoutDuration)}sendAsync(t,r){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var r3=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},$t=class extends t3{constructor(r,o,n,i){super();this.onAccountsChanged=r=>{r.length===0?this.onDisconnect():this.syncAccounts(r)};this.onChainChanged=r=>{this.wallets.forEach(o=>{o.chainId=ti(r),this.walletClientType==="privy"&&Q.put(Ns(o.address),r)}),this.emit("walletsUpdated")};this.onDisconnect=()=>{this.connected=!1,this.wallets=[],this.emit("walletsUpdated")};this.onConnect=()=>{this.connected=!0,this.syncAccounts()};this.wallets=[],this.walletClientType=r,this.chains=o,this.defaultChain=n,this.rpcConfig=i,this.rpcTimeoutDuration=li(i,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n,i){let a=async()=>!!this.wallets.find(l=>eo(l.address)===eo(r));return{address:eo(r),chainId:o,meta:n,imported:i,switchChain:async l=>{if(!a)throw new ce("Wallet is not currently connected.");let s=this.wallets.find(C=>eo(C.address)===eo(r))?.chainId;if(!s)throw new ce("Unable to determine current chainId.");let c,m;if(typeof l=="number"?(c=`0x${l.toString(16)}`,m=l):(c=l,m=Number(l)),s===ti(c))return;let f=this.chains.find(C=>C.id===m);if(!f)throw new ce(`Unsupported chainId: ${l}`);let u=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:c}]})};try{return await u()}catch(C){if(r3(C,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:c,chainName:f.name,nativeCurrency:f.nativeCurrency,rpcUrls:[f.rpcUrls.default?.http[0]??""],blockExplorerUrls:[f.blockExplorers?.default.url??""]}]}),u();throw this.walletClientType==="rainbow"&&C.message?.includes("wallet_switchEthereumChain")?new ce(`Rainbow does not support the chainId ${o}`):C}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:a,getEthereumProvider:async()=>{if(!await a())throw new ce("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await a())throw new ce("Wallet is not currently connected.");return new Ym(new Xr(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await a())throw new ce("Wallet is not currently connected.");return new Uo(this.proxyProvider)},sign:async l=>{if(!await a())throw new ce("Wallet is not currently connected.");return await this.sign(l)},disconnect:()=>{this.disconnect()}}}async syncAccounts(r){let o=r;try{if(o===void 0){let c=await ra(()=>this.proxyProvider.request({method:"eth_accounts"}),{maxAttempts:10,delayMs:500});Array.isArray(c)&&(o=c)}}catch(c){console.warn("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.",c)}if(!o||!Array.isArray(o)||o.length<=0||!o[0])return;let n=o[0],i=eo(n),a=[],l;if(this.walletClientType==="privy"){let c=Q.get(Ns(i));this.chains.find(m=>m.id===Number(c))||(Q.del(Ns(i)),c=null),l=c||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:l}]})}catch{console.warn(`Unable to switch embedded wallet to chain ID ${l} on initialization`)}}else try{let c=await ra(()=>this.proxyProvider.request({method:"eth_chainId"}),{maxAttempts:10,delayMs:500});if(typeof c=="string")l=c;else if(typeof c=="number")l=`0x${c.toString(16)}`;else throw new Error("Invalid chainId returned from provider")}catch(c){console.warn(`Failed to get chainId from provider, defaulting to ${vd}`,c),l=vd}let s=ti(l);if(!a.find(c=>eo(c.address)===i)){let c={name:this.walletBranding.name,icon:typeof this.walletBranding.icon=="string"?this.walletBranding.icon:void 0,id:this.walletBranding.id};a.push(this.buildConnectedWallet(eo(n),s,c,this.connectorType==="embedded_imported"))}Js(a,this.wallets)||(this.wallets=a,this.emit("walletsUpdated"))}async getConnectedWallet(){let r=await this.proxyProvider.request({method:"eth_accounts"});return this.wallets.sort((o,n)=>n.connectedAt-o.connectedAt).find(o=>r.find(n=>eo(n)===eo(o.address)))||null}async isConnected(){let r=await this.proxyProvider.request({method:"eth_accounts"});return Array.isArray(r)&&r.length>0}async sign(r){return await this.connect({showPrompt:!1}),new Ym(new Xr(this.proxyProvider)).getSigner().signMessage(r)}subscribeListeners(){this.proxyProvider.on("accountsChanged",this.onAccountsChanged),this.proxyProvider.on("chainChanged",this.onChainChanged),this.proxyProvider.on("disconnect",this.onDisconnect),this.proxyProvider.on("connect",this.onConnect)}unsubscribeListeners(){this.proxyProvider.removeListener("accountsChanged",this.onAccountsChanged),this.proxyProvider.removeListener("chainChanged",this.onChainChanged),this.proxyProvider.removeListener("disconnect",this.onDisconnect),this.proxyProvider.removeListener("connect",this.onConnect)}};var n3=[1,11155111,137,10,8453,84532,42161,7777777,43114,56],i3=(e,t)=>e.makeWeb3Provider({options:t}),Ed,Xs=class extends $t{constructor(r,o,n,i,a,l){super("coinbase_wallet",r,o,n);this.connectorType="coinbase_wallet";this.displayName="Coinbase Wallet";if(this.proxyProvider=new je(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.connectionOptions=i.coinbaseWallet.connectionOptions??"all",this.walletClientType=this.connectionOptions==="smartWalletOnly"?"coinbase_smart_wallet":"coinbase_wallet",this.walletClientType==="coinbase_smart_wallet"&&(this.displayName="Coinbase Smart Wallet"),!Ed){let s=[o.id].concat(r.map(m=>m.id)),c=this.connectionOptions!=="eoaOnly"?s.filter(m=>!n3.includes(m)):[];c.length>0&&console.warn(`The following configured chains are not supported by the Coinbase Smart Wallet: ${c.join(", ")}`),Ed=new o3({appName:a,appLogoUrl:l,appChainIds:s})}this.proxyProvider.setWalletProvider(i3(Ed,this.connectionOptions))}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}disconnect(){this.proxyProvider.walletProvider.disconnect(),this.onDisconnect()}get walletBranding(){return{name:this.displayName,icon:So,id:"com.coinbase.wallet"}}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new ce("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([r[0]])}catch(r){throw Lr(r)}}};import{jsx as Zm}from"react/jsx-runtime";var Fo=({...e})=>Zm("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:Zm("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.37126 11.0323C2.37126 12.696 3.90598 13.4421 5.40654 13.4468C8.91753 13.4468 12.8021 11.2897 12.7819 7.67984C12.7673 5.07728 10.3748 2.86167 7.54357 2.88296C4.8495 2.88296 2.21821 4.6411 2.21803 7.03628C2.21803 7.67951 2.58722 8.30178 3.55231 8.37184C2.74763 9.16826 2.37126 10.1225 2.37126 11.0323ZM7.55283 8.68012C8.11562 8.68012 8.57186 8.13217 8.57186 7.45624C8.57186 6.78032 8.11562 6.23237 7.55283 6.23237C6.99003 6.23237 6.53379 6.78032 6.53379 7.45624C6.53379 8.13217 6.99003 8.68012 7.55283 8.68012ZM10.4747 8.68012C11.0375 8.68012 11.4937 8.13217 11.4937 7.45625C11.4937 6.78032 11.0375 6.23237 10.4747 6.23237C9.91186 6.23237 9.45562 6.78032 9.45562 7.45625C9.45562 8.13217 9.91186 8.68012 10.4747 8.68012Z",fill:e.color||"var(--privy-color-foreground-3)"})});var ua=class extends $t{constructor(r,o,n,i,a=!1){super("privy",o,n,i);this.connectorType="embedded";this.proxyProvider=r,a&&(this.connectorType="embedded_imported"),this.subscribeListeners()}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return await this.isConnected()?(await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[hn(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:Fo,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};import{jsx as Qm}from"react/jsx-runtime";var ci=({style:e,...t})=>Qm("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:Qm("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})});import{jsx as or,jsxs as a3}from"react/jsx-runtime";var di=({style:e,...t})=>a3("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",x:0,y:0,viewBox:"0 0 318.6 318.6",width:"28",height:"28",style:{height:"28px",width:"28px",...e},...t,children:[or("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),or("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),or("path",{d:"m44.4 35.5 98.7 74.6-17.5-44.3zm193.9 171.3-26.5 40.6 56.7 15.6 16.3-55.3zm-204.4.9L50.1 263l56.7-15.6-26.5-40.6z",className:"s1 s2"}),or("path",{d:"m103.6 138.2-15.8 23.9 56.3 2.5-2-60.5zm111.3 0-39-34.8-1.3 61.2 56.2-2.5zM106.8 247.4l33.8-16.5-29.2-22.8zm71.1-16.5 33.9 16.5-4.7-39.3z",className:"s1 s2"}),or("path",{fill:"#d7c1b3",stroke:"#d7c1b3",className:"s1",d:"m211.8 247.4-33.9-16.5 2.7 22.1-.3 9.3zm-105 0 31.5 14.9-.2-9.3 2.5-22.1z"}),or("path",{fill:"#233447",stroke:"#233447",className:"s1",d:"m138.8 193.5-28.2-8.3 19.9-9.1zm40.9 0 8.3-17.4 20 9.1z"}),or("path",{fill:"#cd6116",stroke:"#cd6116",className:"s1",d:"m106.8 247.4 4.8-40.6-31.3.9zM207 206.8l4.8 40.6 26.5-39.7zm23.8-44.7-56.2 2.5 5.2 28.9 8.3-17.4 20 9.1zm-120.2 23.1 20-9.1 8.2 17.4 5.3-28.9-56.3-2.5z"}),or("path",{fill:"#e4751f",stroke:"#e4751f",className:"s1",d:"m87.8 162.1 23.6 46-.8-22.9zm120.3 23.1-1 22.9 23.7-46zm-64-20.6-5.3 28.9 6.6 34.1 1.5-44.9zm30.5 0-2.7 18 1.2 45 6.7-34.1z"}),or("path",{d:"m179.8 193.5-6.7 34.1 4.8 3.3 29.2-22.8 1-22.9zm-69.2-8.3.8 22.9 29.2 22.8 4.8-3.3-6.6-34.1z",className:"s3"}),or("path",{fill:"#c0ad9e",stroke:"#c0ad9e",className:"s1",d:"m180.3 262.3.3-9.3-2.5-2.2h-37.7l-2.3 2.2.2 9.3-31.5-14.9 11 9 22.3 15.5h38.3l22.4-15.5 11-9z"}),or("path",{fill:"#161616",stroke:"#161616",className:"s1",d:"m177.9 230.9-4.8-3.3h-27.7l-4.8 3.3-2.5 22.1 2.3-2.2h37.7l2.5 2.2z"}),or("path",{fill:"#763d16",stroke:"#763d16",className:"s1",d:"m278.3 114.2 8.5-40.8-12.7-37.9-96.2 71.4 37 31.3 52.3 15.3 11.6-13.5-5-3.6 8-7.3-6.2-4.8 8-6.1zM31.8 73.4l8.5 40.8-5.4 4 8 6.1-6.1 4.8 8 7.3-5 3.6 11.5 13.5 52.3-15.3 37-31.3-96.2-71.4z"}),or("path",{d:"m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z",className:"s3"})]});import{jsx as Jm,jsxs as s3}from"react/jsx-runtime";var to=({style:e,...t})=>s3("svg",{xmlns:"http://www.w3.org/2000/svg",width:"108",height:"108",viewBox:"0 0 108 108",fill:"none",style:{height:"28px",width:"28px",...e},...t,children:[Jm("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),Jm("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M46.5267 69.9229C42.0054 76.8509 34.4292 85.6182 24.348 85.6182C19.5824 85.6182 15 83.6563 15 75.1342C15 53.4305 44.6326 19.8327 72.1268 19.8327C87.768 19.8327 94 30.6846 94 43.0079C94 58.8258 83.7355 76.9122 73.5321 76.9122C70.2939 76.9122 68.7053 75.1342 68.7053 72.314C68.7053 71.5783 68.8275 70.7812 69.0719 69.9229C65.5893 75.8699 58.8685 81.3878 52.5754 81.3878C47.993 81.3878 45.6713 78.5063 45.6713 74.4598C45.6713 72.9884 45.9768 71.4556 46.5267 69.9229ZM83.6761 42.5794C83.6761 46.1704 81.5575 47.9658 79.1875 47.9658C76.7816 47.9658 74.6989 46.1704 74.6989 42.5794C74.6989 38.9885 76.7816 37.1931 79.1875 37.1931C81.5575 37.1931 83.6761 38.9885 83.6761 42.5794ZM70.2103 42.5795C70.2103 46.1704 68.0916 47.9658 65.7216 47.9658C63.3157 47.9658 61.233 46.1704 61.233 42.5795C61.233 38.9885 63.3157 37.1931 65.7216 37.1931C68.0916 37.1931 70.2103 38.9885 70.2103 42.5795Z",fill:"#FFFDF8"})]});var ui=class extends $t{constructor(r,o,n,i,a){super(a||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new je(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=i;let l=i.provider;this.proxyProvider.setWalletProvider(l)}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:this.providerDetail.info.name,icon:this.providerDetail.info.icon,id:this.providerDetail.info.rdns}}disconnect(){console.warn(`Programmatic disconnect with ${this.providerDetail.info.name} is not yet supported.`)}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new ce("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw Lr(r)}}},pi,mi=class extends $t{constructor(r,o,n,i,a){super(a??"unknown",r,o,n);this.connectorType="injected";fs(this,pi,void 0);this.proxyProvider=new je(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(i),a==="metamask"?id(this,pi,{name:"MetaMask",icon:di,id:"io.metamask"}):a==="phantom"&&id(this,pi,{name:"Phantom",icon:to,id:"phantom"})}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return vu(this,pi)??{name:"Browser Extension",icon:ci,id:"extension"}}disconnect(){console.warn("Programmatic disconnect with browser wallets is not yet supported.")}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new ce("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw Lr(r)}}};pi=new WeakMap;import{getAddress as Jx}from"@ethersproject/address";import{Web3Provider as ek}from"@ethersproject/providers";import{isMobile as l3}from"react-device-detect";var el=class extends ui{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{l3||await this.proxyProvider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let t=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!t||t.length===0||!t[0])throw new ce("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw Lr(t)}}};var tl=class extends $t{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new je(void 0,wn);this.connectorType=r}get walletBranding(){return{name:"Wallet",id:""}}async initialize(){this.initialized=!0,this.emit("initialized")}async connect(){throw new Error("connect called for an uninstalled wallet via the NullConnector")}disconnect(){throw new Error("disconnect called for an uninstalled wallet via the NullConnector")}promptConnection(r){throw new Error(`promptConnection called for an uninstalled wallet via the NullConnector for ${r}`)}};var rl=class extends tl{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:to,id:"phantom"}}};import{EthereumProvider as W3,OPTIONAL_EVENTS as O3,OPTIONAL_METHODS as L3}from"@walletconnect/ethereum-provider";import{isMobile as N3}from"react-device-detect";import{createContext as _3,useContext as P3,useEffect as Pd,useRef as A3,useState as x3}from"react";import{jsx as c3}from"react/jsx-runtime";function Xm({src:e,...t}){return c3("img",{src:e,...t,style:{display:"none"}})}import{useContext as Ff,useEffect as Uf,useMemo as b3,useState as E3}from"react";import{createContext as T3}from"react";var Ot={appearance:{landingHeader:"Log in or sign up",theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:Em,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},externalWallets:{coinbaseWallet:{connectionOptions:"all"}},captchaEnabled:!1,_render:{standalone:!1},fundingMethodConfig:{moonpay:{useSandbox:!1}}};var ef=({input:e})=>{if(!e||!e.primary[0])return;let t=[e.primary[0]],r=[];e.primary.length>4&&console.warn("You should not specify greater than 4 login methods in `loginMethodsAndOrder.primary`");for(let o of e.primary.slice(1))t.includes(o)?console.warn(`Duplicated login method: ${o}`):t.push(o);for(let o of e.overflow??[])!t.includes(o)&&!r.includes(o)?r.push(o):console.warn(`Duplicated login method: ${o}`);return{primary:t,overflow:r}};var d3=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets","rabby_wallet"]),tf=e=>d3.has(e),rf=(e,t,r)=>r.indexOf(e)===t,of=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(tf).filter(rf):e?e.filter(tf).filter(rf):Ot.appearance.walletList;var nf={id:42161,name:"Arbitrum One",network:"arbitrum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-mainnet.rpc.privy.systems"]},alchemy:{http:["https://arb-mainnet.g.alchemy.com/v2"],webSocket:["wss://arb-mainnet.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-mainnet.infura.io/v3"],webSocket:["wss://arbitrum-mainnet.infura.io/ws/v3"]},default:{http:["https://arb1.arbitrum.io/rpc"]},public:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://arbiscan.io"},default:{name:"Arbiscan",url:"https://arbiscan.io"}}};var af={id:421613,name:"Arbitrum Goerli",network:"arbitrum-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"AGOR",decimals:18},rpcUrls:{default:{http:["https://goerli-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"}},testnet:!0};var sf={id:421614,name:"Arbitrum Sepolia",network:"arbitrum-sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]},public:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-explorer.arbitrum.io"}},testnet:!0};var lf={id:43114,name:"Avalanche",network:"avalanche",nativeCurrency:{decimals:18,name:"Avalanche",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax.network/ext/bc/C/rpc"]},public:{http:["https://api.avax.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://snowtrace.io"},default:{name:"SnowTrace",url:"https://snowtrace.io"}}};var cf={id:43113,name:"Avalanche Fuji",network:"avalanche-fuji",nativeCurrency:{decimals:18,name:"Avalanche Fuji",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax-test.network/ext/bc/C/rpc"]},public:{http:["https://api.avax-test.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://testnet.snowtrace.io"},default:{name:"SnowTrace",url:"https://testnet.snowtrace.io"}},testnet:!0};var df={id:8453,network:"base",name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-mainnet.rpc.privy.systems"]},blast:{http:["https://base-mainnet.blastapi.io"],webSocket:["wss://base-mainnet.blastapi.io"]},default:{http:["https://mainnet.base.org"]},public:{http:["https://mainnet.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://basescan.org"},default:{name:"Basescan",url:"https://basescan.org"}},testnet:!0};var pf={id:84531,network:"base-goerli",name:"Base Goerli Testnet",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://goerli.base.org"]}},blockExplorers:{default:{name:"Basescan",url:"https://goerli.basescan.org"}},testnet:!0};var uf={id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.base.org"]},public:{http:["https://sepolia.base.org"]}},blockExplorers:{default:{name:"Blockscout",url:"https://base-sepolia.blockscout.com"}},testnet:!0};var mf={id:80085,network:"berachain-artio",name:"Berachain Artio",nativeCurrency:{name:"BERA",symbol:"BERA",decimals:18},rpcUrls:{default:{http:["https://berachain-artio.rpc.privy.systems"]},public:{http:["https://berachain-artio.rpc.privy.systems"]}},blockExplorers:{default:{name:"Beratrail",url:"https://artio.beratrail.io"}},testnet:!0};var ff={id:42220,name:"Celo Mainnet",network:"celo",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://forno.celo.org"]},infura:{http:["https://celo-mainnet.infura.io/v3"]},public:{http:["https://forno.celo.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/mainnet"},etherscan:{name:"CeloScan",url:"https://celoscan.io"}},testnet:!1};var hf={id:44787,name:"Celo Alfajores Testnet",network:"celo-alfajores",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://alfajores-forno.celo-testnet.org"]},infura:{http:["https://celo-alfajores.infura.io/v3"]},public:{http:["https://alfajores-forno.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/alfajores"},etherscan:{name:"CeloScan",url:"https://alfajores.celoscan.io/"}},testnet:!0};var yf={id:314,name:"Filecoin - Mainnet",network:"filecoin-mainnet",nativeCurrency:{decimals:18,name:"filecoin",symbol:"FIL"},rpcUrls:{default:{http:["https://api.node.glif.io/rpc/v1"]},public:{http:["https://api.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filfox",url:"https://filfox.info/en"},filscan:{name:"Filscan",url:"https://filscan.io"},filscout:{name:"Filscout",url:"https://filscout.io/en"},glif:{name:"Glif",url:"https://explorer.glif.io"}}};var gf={id:314159,name:"Filecoin - Calibration testnet",network:"filecoin-calibration",nativeCurrency:{decimals:18,name:"testnet filecoin",symbol:"tFIL"},rpcUrls:{default:{http:["https://api.calibration.node.glif.io/rpc/v1"]},public:{http:["https://api.calibration.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filscan",url:"https://calibration.filscan.io"}}};var vf={id:17069,name:"Garnet Holesky",network:"garnet-holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.garnetchain.com"]},public:{http:["https://rpc.garnetchain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.garnetchain.com"}}};var Cf={id:5,network:"goerli",name:"Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.ankr.com/eth_goerli"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.etherscan.io"}},testnet:!0};var wf={id:17e3,name:"Holesky",network:"holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://ethereum-holesky.publicnode.com"]},public:{http:["https://ethereum-holesky.publicnode.com"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://holesky.etherscan.io"},default:{name:"EtherScan",url:"https://holesky.etherscan.io"}}};var bf={id:59144,network:"linea-mainnet",name:"Linea Mainnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]},public:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://lineascan.build"},etherscan:{name:"Etherscan",url:"https://lineascan.build"}},testnet:!1};var Ef={id:59140,network:"linea-testnet",name:"Linea Goerli Testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-goerli.infura.io/v3"],webSocket:["wss://linea-goerli.infura.io/ws/v3"]},default:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]},public:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.lineascan.build"},etherscan:{name:"Etherscan",url:"https://goerli.lineascan.build"}},testnet:!0};var ol={id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://mainnet.rpc.privy.systems"]},alchemy:{http:["https://eth-mainnet.g.alchemy.com/v2"],webSocket:["wss://eth-mainnet.g.alchemy.com/v2"]},infura:{http:["https://mainnet.infura.io/v3"],webSocket:["wss://mainnet.infura.io/ws/v3"]},default:{http:["https://cloudflare-eth.com"]},public:{http:["https://cloudflare-eth.com"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://etherscan.io"},default:{name:"Etherscan",url:"https://etherscan.io"}}};var Tf={id:10,name:"OP Mainnet",network:"optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-mainnet.rpc.privy.systems"]},alchemy:{http:["https://opt-mainnet.g.alchemy.com/v2"],webSocket:["wss://opt-mainnet.g.alchemy.com/v2"]},infura:{http:["https://optimism-mainnet.infura.io/v3"],webSocket:["wss://optimism-mainnet.infura.io/ws/v3"]},default:{http:["https://mainnet.optimism.io"]},public:{http:["https://mainnet.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://optimistic.etherscan.io"},default:{name:"Optimism Explorer",url:"https://explorer.optimism.io"}}};var Sf={id:420,name:"Optimism Goerli Testnet",network:"optimism-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://goerli.optimism.io"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"}},testnet:!0};var _f={id:11155420,name:"Optimism Sepolia",network:"optimism-sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.optimism.io"]},public:{http:["https://sepolia.optimism.io"]},infura:{http:["https://optimism-sepolia.infura.io/v3"]}},blockExplorers:{default:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com"}},testnet:!0};var Pf={id:137,name:"Polygon Mainnet",network:"matic",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{privy:{http:["https://polygon-mainnet.rpc.privy.systems"]},alchemy:{http:["https://polygon-mainnet.g.alchemy.com/v2"],webSocket:["wss://polygon-mainnet.g.alchemy.com/v2"]},infura:{http:["https://polygon-mainnet.infura.io/v3"],webSocket:["wss://polygon-mainnet.infura.io/ws/v3"]},default:{http:["https://polygon-rpc.com"]},public:{http:["https://polygon-rpc.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://polygonscan.com"},default:{name:"PolygonScan",url:"https://polygonscan.com"}}};var Af={id:80001,name:"Mumbai",network:"maticmum",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{default:{http:["https://matic-mumbai.chainstacklabs.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://mumbai.polygonscan.com"}},testnet:!0};var xf={id:690,name:"Redstone",network:"redstone",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.redstonechain.com"]},public:{http:["https://rpc.redstonechain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.redstone.xyz/"}}};var kf={id:17001,name:"Redstone Holesky",network:"redstone-holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.holesky.redstone.xyz"]},public:{http:["https://rpc.holesky.redstone.xyz"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://explorer.holesky.redstone.xyz"},default:{name:"EtherScan",url:"https://explorer.holesky.redstone.xyz"}}};var Rf={id:11155111,network:"sepolia",name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"SEP",decimals:18},rpcUrls:{privy:{http:["https://sepolia.rpc.privy.systems"]},alchemy:{http:["https://eth-sepolia.g.alchemy.com/v2"],webSocket:["wss://eth-sepolia.g.alchemy.com/v2"]},infura:{http:["https://sepolia.infura.io/v3"],webSocket:["wss://sepolia.infura.io/ws/v3"]},default:{http:["https://rpc.sepolia.org"]},public:{http:["https://rpc.sepolia.org"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://sepolia.etherscan.io"},default:{name:"Etherscan",url:"https://sepolia.etherscan.io"}},testnet:!0};var If={id:7777777,name:"Zora",network:"zora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]},public:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.zora.energy"}}};var Mf={id:999999999,name:"Zora Sepolia",network:"zora-sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]},public:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]}},blockExplorers:{default:{name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/"}},testnet:!0};var Wf={id:999,name:"Zora Goerli Testnet",network:"zora-testnet",nativeCurrency:{decimals:18,name:"Zora Goerli",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]},public:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.explorer.zora.energy"}},testnet:!0};var ma=[nf,af,sf,Cf,Rf,ol,Tf,Sf,_f,Pf,Af,ff,hf,yf,gf,df,pf,uf,mf,bf,Ef,lf,cf,If,Wf,Mf,wf,xf,vf,kf],PR=new Set(ma.map(e=>e.id));import An from"tinycolor2";var Of="#FFFFFF",p3="#040217",u3=Of,m3="#1E1E1D";function f3(e){return e<.8&&e>.2&&console.warn("Background color is not light or dark enough, which could lead to accessibility issues."),e>.5?"light":"dark"}function Nr(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return An({...e.toHsl(),l:r})}var h3="#51BA81",y3="#FFB74D",g3="#EC6351",v3=Of,C3=p3;function Lf({backgroundTheme:e,accentHex:t}){let r;switch(e){case"light":r=u3;break;case"dark":r=m3;break;default:r=e;break}let o=An(r),n=An(t),i=An(h3),a=An(y3),l=An(g3),s=f3(o.getLuminance()),c=Nr(o,s==="light"?-.04:.11),m=Nr(o,s==="light"?-.88:.87),f=Nr(o,s==="light"?-.7:.75),u=Nr(o,s==="light"?-.43:.45).desaturate(s==="light"?60:20),C=Nr(o,s==="light"?-.08:.25).desaturate(s==="light"?60:20),g=Nr(n,.15),y=Nr(n,-.06),b=Nr(l,.3),E=Nr(a,.3),k=An(n.getLuminance()>.5?C3:v3),T=Nr(i,-.16),A=Nr(i,.4);return{colorScheme:s,background:o.toHslString(),background2:c.toHslString(),foreground:m.toHslString(),foreground2:f.toHslString(),foreground3:u.toHslString(),foreground4:C.toHslString(),accent:n.toHslString(),accentLight:g.toHslString(),accentDark:y.toHslString(),foregroundAccent:k.toHslString(),success:i.toHslString(),successDark:T.toHslString(),successLight:A.toHslString(),error:l.toHslString(),errorLight:b.toHslString(),warn:a.toHslString(),warnLight:E.toHslString()}}function Td(e,t,r){let o=r?console.warn:()=>{},n,i,a,l,s,c,m,f,u,C,g,y,b,E,k;t?.loginMethods?(n=t.loginMethods.includes("email"),i=t.loginMethods.includes("sms"),l=t.loginMethods.includes("wallet"),s=t.loginMethods.includes("google"),c=t.loginMethods.includes("twitter"),m=t.loginMethods.includes("discord"),u=t.loginMethods.includes("spotify"),C=t.loginMethods.includes("instagram"),f=t.loginMethods.includes("tiktok"),y=t.loginMethods.includes("github"),g=t.loginMethods.includes("linkedin"),b=t.loginMethods.includes("apple"),E=t.loginMethods.includes("farcaster"),k=t.loginMethods.includes("telegram")):(n=e.emailAuth,i=e.smsAuth,l=e.walletAuth,s=e.googleOAuth,c=e.twitterOAuth,m=e.discordOAuth,y=e.githubOAuth,u=e.spotifyOAuth,C=e.instagramOAuth,f=e.tiktokOAuth,g=e.linkedinOAuth,b=e.appleOAuth,E=e.farcasterAuth,k=e.telegramAuth),typeof window<"u"&&typeof window.PublicKeyCredential!="function"?a=!1:e.passkeyAuth&&(a=!0);let T=[n,i].filter(Boolean),A=[s,c,m,y,u,C,f,g,b,E,k].filter(Boolean),R=[l].filter(Boolean);if(T.length+A.length+R.length===0)throw new Error("You must enable at least one login method");let I=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;I&&R.length===0?(o("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),I=!1):!I&&A.length+T.length===0&&(o("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),I=!0);let D=t?.externalWallets?.walletConnect?.enabled??!0;t?.loginMethods&&t.loginMethodsAndOrder&&o("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let H=of({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),K=ef({input:t?.loginMethodsAndOrder}),j=t?.intl?.defaultCountry??"US",{chains:O,defaultChain:U}=w3({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),W=!!t?.defaultChain,Ce=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,Ie,Y=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?Ce?Ie=t?.embeddedWallets?.noPromptOnSignature??!0:Ie=t?.embeddedWallets?.noPromptOnSignature??Y:Ie=Y,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&Ie!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");let{requireUserPasswordOnCreate:X,...te}=t?.embeddedWallets??{};return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,legacyWalletUiConfig:e.legacyWalletUiConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,landingHeader:t?.appearance?.landingHeader??Ot.appearance.landingHeader,loginMessage:typeof t?.appearance?.loginMessage=="string"?t?.appearance?.loginMessage.slice(0,100):t?.appearance?.loginMessage,palette:Lf({backgroundTheme:t?.appearance?.theme??Ot.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??Ot.appearance.accentColor}),loginGroupPriority:I?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:H},loginMethods:{wallet:l,email:n,sms:i,passkey:a,google:s,twitter:c,discord:m,github:y,spotify:u,instagram:C,tiktok:f,linkedin:g,apple:b,farcaster:E,telegram:k},loginMethodsAndOrder:K,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??Ot.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??Ot.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??Ot.rpcConfig.rpcTimeouts},chains:O,defaultChain:U,intl:{defaultCountry:j},shouldEnforceDefaultChainOnConnect:W,captchaEnabled:e.captchaEnabled??Ot.captchaEnabled,captchaSiteKey:e.captchaSiteKey,externalWallets:{coinbaseWallet:{connectionOptions:t?.externalWallets?.coinbaseWallet?.connectionOptions??Ot.externalWallets.coinbaseWallet.connectionOptions},walletConnect:{enabled:D}},embeddedWallets:{...e.embeddedWalletConfig,...typeof X=="boolean"?{requireUserOwnedRecoveryOnCreate:X}:{},...Ce?{createOnLogin:"all-users",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...te,noPromptOnSignature:Ie},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:Ce?{enabled:!0,...t.customAuth}:void 0,loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1,telegramAuthConfiguration:e.telegramAuthConfiguration},headless:!!t?.headless,render:{standalone:t?._render?.standalone??Ot._render.standalone},fundingConfig:e.fundingConfig,fundingMethodConfig:{...t?.fundingMethodConfig??Ot.fundingMethodConfig,moonpay:{...t?.fundingMethodConfig?.moonpay??Ot.fundingMethodConfig.moonpay,useSandbox:t?.fundingMethodConfig?.moonpay.useSandbox??t?.fiatOnRamp?.useSandbox??Ot.fundingMethodConfig.moonpay.useSandbox}}}}function Nf(e,t){if(!e)return{legacyCreateEmbeddedWalletFlag:t};let{appearance:r,additionalChains:o,supportedChains:n,defaultChain:i,...a}=e;return{...a,...o?{additionalChains:o.map(s=>s.id)}:void 0,...n?{supportedChains:n.map(s=>s.id)}:void 0,...i?{defaultChain:i.id}:void 0,legacyCreateEmbeddedWalletFlag:t}}function w3({additionalChains:e,supportedChains:t,defaultChainFromConfig:r,hasRpcConfigDefined:o}){let n;if(e&&t&&console.warn("You should only specify one of `additionalChains` or `supportedChains`. Using `supportedChains`."),t){if(t.length===0)throw new Error("`supportedChains` must contain at least one chain");t.filter(s=>s.rpcUrls.privyWalletOverride).length>0&&o&&console.warn("You have specified at least one `supportedChain` with `privyWalletOverride` but also have `rpcConfig` defined. The `rpcConfig` will be ignored. `rpcConfig` is deprecated and you should use `privyWalletOverride` in a `supportedChain`."),n=t.map(s=>s.rpcUrls.privyWalletOverride?s:ma.find(m=>m.id===s.id)??s)}else n=ma.concat(e??[]);let i=t?n[0]:ol,a=r??i;if(!n.find(l=>l.id===a.id))throw new Error("`defaultChain` must be included in `supportedChains`");return{chains:n,defaultChain:a}}var Df=function(e,t=0){let r=3735928559^t,o=1103547991^t;for(let n=0,i;n<e.length;n++)i=e.charCodeAt(n),r=Math.imul(r^i,2654435761),o=Math.imul(o^i,1597334677);return r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(o^o>>>13,3266489909),o=Math.imul(o^o>>>16,2246822507),o^=Math.imul(r^r>>>13,3266489909),4294967296*(2097151&o)+(r>>>0)};import{jsx as S3}from"react/jsx-runtime";var Bf={showWalletLoginFirst:!0,allowlistConfig:{errorTitle:null,errorDetail:null,errorCtaText:null,errorCtaLink:null},walletAuth:!0,emailAuth:!0,smsAuth:!1,googleOAuth:!1,twitterOAuth:!1,discordOAuth:!1,githubOAuth:!1,linkedinOAuth:!1,appleOAuth:!1,termsAndConditionsUrl:null,privacyPolicyUrl:null,embeddedWalletConfig:{createOnLogin:"off",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]},fiatOnRampEnabled:!1,captchaEnabled:!1,captchaSiteKey:""},Sd=Td(Bf,void 0,!1),_d=T3({appConfig:Sd,isServerConfigLoaded:!1}),Hf=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,i]=E3(null),a=b3(()=>Td(n??Bf,o,!!n),[n,o]);return Uf(()=>{if(!n)return;let l=Nf(o,t),s=Df(JSON.stringify(l)).toString(),c=`privy:sent:${n.id}:${s}`;localStorage.getItem(c)||(r.createAnalyticsEvent({eventName:"sdk_initialize",payload:l}),localStorage.setItem(c,"t"))},[o,t,n]),Uf(()=>{n||(async()=>{try{let s=await r.getServerConfig();s.customApiUrl&&r.updateApiUrl(s.customApiUrl),i(s)}catch(s){console.warn("Error generating app config: ",s)}})()},[]),S3(_d.Provider,{value:{appConfig:a,isServerConfigLoaded:!!n},children:e})},Ve=()=>{let{appConfig:e}=Ff(_d);return e},nl=()=>{let{isServerConfigLoaded:e}=Ff(_d);return e};var S=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import{jsx as R3,jsxs as I3}from"react/jsx-runtime";var Gf=_3({ready:!1,app:Sd,currentScreen:null,lastScreen:null,navigate:S,navigateBack:S,resetNavigation:S,setModalData:S,onUserCloseViaDialogOrKeybindRef:void 0}),k3=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],Vf=e=>{let t=Ve(),r=e.authenticated,[o,n]=x3(e.initialScreen);Pd(()=>{!r&&!k3.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let i=A3(null);Pd(()=>{e.open||(i.current=null)},[e.open]),Pd(()=>{i.current=null},[e.initialScreen]);let a={ready:!!t.id,app:t,data:e.data,setModalData:e.setModalData,currentScreen:e.initialScreen,lastScreen:o,navigate:(l,s=!0)=>{e.setInitialScreen(l),s&&n(e.initialScreen)},navigateBack:()=>{e.setInitialScreen(o)},resetNavigation:()=>{e.setInitialScreen(null),n(null)},onUserCloseViaDialogOrKeybindRef:i};return I3(Gf.Provider,{value:a,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&R3(Xm,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},P=()=>P3(Gf);import{jsx as fi,jsxs as M3}from"react/jsx-runtime";var fa=({style:e,...t})=>{let{app:r}=P();return M3("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[fi("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),fi("g",{clipPath:"url(#clip0_1765_9946)",children:fi("path",{d:"M8.09448 10.3941C11.3558 7.20196 16.6442 7.20196 19.9055 10.3941L20.2982 10.7782C20.3369 10.8157 20.3677 10.8606 20.3887 10.9102C20.4097 10.9599 20.4206 11.0132 20.4206 11.0671C20.4206 11.121 20.4097 11.1744 20.3887 11.224C20.3677 11.2737 20.3369 11.3186 20.2982 11.3561L18.9554 12.6702C18.9158 12.7086 18.8628 12.7301 18.8077 12.7301C18.7526 12.7301 18.6996 12.7086 18.66 12.6702L18.1198 12.1415C15.8448 9.91503 12.1557 9.91503 9.88015 12.1415L9.30167 12.7075C9.26207 12.7459 9.20909 12.7673 9.15395 12.7673C9.0988 12.7673 9.04582 12.7459 9.00622 12.7075L7.66346 11.3934C7.62475 11.3559 7.59397 11.3109 7.57295 11.2613C7.55193 11.2117 7.5411 11.1583 7.5411 11.1044C7.5411 11.0505 7.55193 10.9971 7.57295 10.9475C7.59397 10.8979 7.62475 10.8529 7.66346 10.8154L8.09448 10.3941ZM22.6829 13.1115L23.8776 14.2814C23.9163 14.319 23.9471 14.3639 23.9681 14.4135C23.9892 14.4632 24 14.5165 24 14.5704C24 14.6243 23.9892 14.6777 23.9681 14.7273C23.9471 14.777 23.9163 14.8219 23.8776 14.8594L18.4893 20.1332C18.4102 20.2101 18.3042 20.2531 18.1938 20.2531C18.0835 20.2531 17.9775 20.2101 17.8984 20.1332L14.0743 16.3901C14.0545 16.3708 14.0279 16.36 14.0003 16.36C13.9726 16.36 13.9461 16.3708 13.9263 16.3901L10.1021 20.1332C10.023 20.2101 9.91703 20.2531 9.8067 20.2531C9.69636 20.2531 9.59038 20.2101 9.51124 20.1332L4.12236 14.8594C4.08365 14.8219 4.05287 14.777 4.03185 14.7273C4.01083 14.6777 4 14.6243 4 14.5704C4 14.5165 4.01083 14.4632 4.03185 14.4135C4.05287 14.3639 4.08365 14.319 4.12236 14.2814L5.31767 13.1115C5.39678 13.0348 5.50265 12.9919 5.61285 12.9919C5.72305 12.9919 5.82892 13.0348 5.90803 13.1115L9.73216 16.8546C9.75194 16.874 9.7785 16.8848 9.80616 16.8848C9.83381 16.8848 9.86037 16.874 9.88015 16.8546L13.7043 13.1115C13.7834 13.0346 13.8894 12.9916 13.9997 12.9916C14.1101 12.9916 14.216 13.0346 14.2952 13.1115L18.1198 16.8546C18.1396 16.874 18.1662 16.8848 18.1938 16.8848C18.2215 16.8848 18.2481 16.874 18.2678 16.8546L22.092 13.1115C22.1711 13.0346 22.2771 12.9916 22.3874 12.9916C22.4977 12.9916 22.6037 13.0346 22.6829 13.1115Z",fill:"white"})}),fi("defs",{children:fi("clipPath",{id:"clip0_1765_9946",children:fi("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var Dr=class extends $t{constructor(r,o,n,i,a,l,s,c){super(c||"unknown",n,i,o);this.connectorType="wallet_connect_v2";this.privyAppId=l,this.privyAppName=s,this.walletConnectCloudProjectId=r,this.rpcConfig=o,this.shouldEnforceDefaultChainOnConnect=a,this.proxyProvider=new je(void 0,this.rpcTimeoutDuration),c&&(this.walletEntry=Rs[c],this.walletClientType=c)}async initialize(){let r=await this.createProvider();if(this.provider=r,this.proxyProvider.setWalletProvider(r),this.subscribeListeners(),r.session){if(this.walletProvider?.session?.peer.metadata.url){let n=ks(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=n?.entry,this.walletClientType=n?.walletClientType||"unknown"}this.connected=!0,await this.syncAccounts()}this.initialized=!0,this.emit("initialized");let{WalletConnectModal:o}=await import("@walletconnect/modal");this.modal=new o({projectId:this.walletConnectCloudProjectId,themeVariables:{"--wcm-z-index":"1000000"}}),this.modal.subscribeModal(n=>{!n.open&&!this.walletProvider?.session&&this.onQrModalClosed&&this.onQrModalClosed()})}async connect(r){return r.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return!!this.walletProvider?.connected}get walletBranding(){return this.walletClientType==="metamask"?{name:"MetaMask",icon:di,id:"io.metamask"}:{name:cm(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||fa,id:this.walletProvider?.session?.peer.metadata.name.toLowerCase()||"wallet_connect_v2"}}async resetConnection(r){this.walletProvider&&this.walletProvider.connected&&(await this.walletProvider.disconnect(),this.walletProvider.signer.session=void 0,this.walletEntry=Rs[r],this.walletClientType=r,this.redirectUri=void 0,this.fallbackUniversalRedirectUri=void 0,gm(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new si)};this.onQrModalClosed=n,(async()=>{let a="",l=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(l?.length&&(a=l[0]),!a||a==="")throw new ce("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let s=ks(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=li(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),r()})().catch(a=>{if(a){o(Lr(a));return}o(new ce("Unknown error during connection"))}).finally(()=>this.modal?.closeModal())})}disconnect(){this.walletProvider?.disconnect().then(()=>this.onDisconnect()).catch(()=>console.warn("Unable to disconnect Wallet Connect provider"))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(r){this.proxyProvider.setWalletProvider(r)}async createProvider(){let r={};for(let a of this.chains){let l=pm(a.id,this.chains,this.rpcConfig,this.privyAppId);l&&(r[a.id]=l)}let o=this.shouldEnforceDefaultChainOnConnect?[this.defaultChain.id]:[],n=this.chains.map(a=>a.id),i=await W3.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:O3,optionalMethods:L3,rpcMap:r,showQrModal:!1,metadata:{description:this.privyAppName,name:this.privyAppName,url:window.location.toString(),icons:[]}});return i.on("display_uri",a=>{if(i.signer.abortPairingAttempt(),N3&&this.walletEntry){let{redirect:l,href:s}=fm(a,this.walletEntry);vm({href:s,name:this.walletEntry.displayName}),this.redirectUri=l;let c=hm(a,this.walletEntry);c?.redirect&&(this.fallbackUniversalRedirectUri=c.redirect),Is(l,"_self")}else this.modal?.openModal({uri:a,chains:[this.defaultChain.id]})}),i.on("connect",()=>{if(this.modal?.closeModal(),i.session?.peer.metadata.url){let a=ks(i.session?.peer.metadata.url);this.walletEntry=a?.entry,this.walletClientType=a?.walletClientType||"unknown"}}),i}async enableProvider(){return this.walletProvider?.connected?Promise.resolve(this.walletProvider.accounts):await this.walletProvider?.enable()}};var xd=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses")?.split(" ").filter(o=>D3(o)).map(o=>qf(o));return t?.length?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&t.includes(o.address)).length:!1},li=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||wn:wn,ha=class extends U3{constructor(r,o,n,i,a,l,s,c,m,f,u){super();this.getEthereumProvider=()=>{let r=this.wallets[0],o=this.walletConnectors.find(n=>n.wallets.find(i=>i.address===r?.address));return!r||!o?new je:o.proxyProvider};this.privyAppId=r,this.walletConnectCloudProjectId=o,this.rpcConfig=n,this.chains=i,this.defaultChain=a,this.walletConnectors=[],this.initialized=!1,this.store=l,this.walletList=s,this.shouldEnforceDefaultChainOnConnect=c,this.externalWalletConfig=m,this.privyAppName=f,this.privyAppLogo=u,this.storedConnections=Ad()}get wallets(){let r=new Set,o=this.walletConnectors.flatMap(i=>i.wallets).sort((i,a)=>i.connectedAt&&a.connectedAt?a.connectedAt-i.connectedAt:0).filter(i=>{let a=`${i.address}${i.walletClientType}${i.connectorType}`;return r.has(a)?!1:(r.add(a),!0)}),n=o.findIndex(i=>i.address===(this.activeWallet?this.activeWallet:"unknown"));return n>=0&&o.unshift(o.splice(n,1)[0]),o}async initialize(){if(this.initialized)return;Q.get(yd)&&(Q.getKeys().forEach(o=>{o.startsWith("walletconnect")&&Q.del(o)}),Q.del(yd));let r=dm(this.store,this.walletList,this.externalWalletConfig).then(o=>{o.forEach(({type:n,eip6963InjectedProvider:i,legacyInjectedProvider:a})=>{this.createWalletConnector("injected",n,{eip6963InjectedProvider:i,legacyInjectedProvider:a})})});this.walletList.includes("coinbase_wallet")&&this.createWalletConnector("coinbase_wallet","coinbase_wallet"),!No()&&this.walletList.includes("phantom")&&this.createWalletConnector("phantom","phantom"),this.externalWalletConfig.walletConnect.enabled&&this.createWalletConnector("wallet_connect_v2","unknown"),await r,this.initialized=!0}findWalletConnector(r,o){return r==="wallet_connect_v2"?this.walletConnectors.find(n=>n.connectorType===r)??null:this.walletConnectors.find(n=>n.connectorType===r&&n.walletClientType===o)??null}onInitialized(r){r.wallets.forEach(o=>{let n=this.storedConnections.find(i=>i.address===o.address&&i.connectorType===o.connectorType&&i.walletClientType===o.walletClientType);n&&(o.connectedAt=n.connectedAt)}),this.saveConnectionHistory(),this.emit("walletsUpdated"),this.emit("connectorInitialized")}onWalletsUpdated(r){r.initialized&&(this.saveConnectionHistory(),this.emit("walletsUpdated"))}addEmbeddedWalletConnector(r,o,n,i){let a=this.findWalletConnector("embedded","privy");if(a)a.proxyProvider.walletProxy=r;else{let l=new pa(r,o,this.rpcConfig,this.chains,i,n.id),s=new ua(l,this.chains,n,this.rpcConfig);this.addWalletConnector(s)}}addImportedWalletConnector(r,o,n,i){let a=this.findWalletConnector("embedded_imported","privy");if(a)a.proxyProvider.walletProxy=r;else{let l=new pa(r,o,this.rpcConfig,this.chains,i,n.id),s=!0,c=new ua(l,this.chains,n,this.rpcConfig,s);this.addWalletConnector(c)}}removeEmbeddedWalletConnector(){let r=this.findWalletConnector("embedded","privy");if(r){let o=this.walletConnectors.indexOf(r);this.walletConnectors.splice(o,1),this.saveConnectionHistory(),this.storedConnections=Ad(),this.emit("walletsUpdated")}}removeImportedWalletConnector(){let r=this.findWalletConnector("embedded_imported","privy");if(r){let o=this.walletConnectors.indexOf(r);this.walletConnectors.splice(o,1),this.saveConnectionHistory(),this.storedConnections=Ad(),this.emit("walletsUpdated")}}async createWalletConnector(r,o,n){let i=this.findWalletConnector(r,o);if(i)return i instanceof Dr&&i.resetConnection(o),i;let l=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new el(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new mi(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new mi(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new mi(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new ui(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,o)}else return r==="coinbase_wallet"?new Xs(this.chains,this.defaultChain,this.rpcConfig,this.externalWalletConfig,this.privyAppName,this.privyAppLogo):r==="phantom"?new rl(this.defaultChain):new Dr(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain,this.shouldEnforceDefaultChainOnConnect,this.privyAppId,this.privyAppName,o)})();return l&&this.addWalletConnector(l),l||null}addWalletConnector(r){this.walletConnectors.push(r),r.on("initialized",()=>this.onInitialized(r)),r.on("walletsUpdated",()=>this.onWalletsUpdated(r)),r.initialize().catch(o=>{console.debug("Failed to initialize connector",o)})}saveConnectionHistory(){let r=this.wallets.map(o=>({address:o.address,connectorType:o.connectorType,walletClientType:o.walletClientType,connectedAt:o.connectedAt}));Q.put(gd,r)}async activeWalletSign(r){let o=this.wallets,n=o.length>0?o[0]:null;return n?n.sign(r):null}setActiveWallet(r){this.activeWallet=qf(r),this.emit("walletsUpdated")}};function Js(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){let o=e[r],n=t[r];if(o?.address!==n?.address||o?.chainId!==n?.chainId||o?.connectorType!==n?.connectorType||o?.connectedAt!==n?.connectedAt||o?.walletClientType!==n?.walletClientType||o?.isConnected!==n?.isConnected||o?.linked!==n?.linked)return!1}return!0}var F3=e=>e&&typeof e.address=="string"&&typeof e.connectorType=="string"&&typeof e.walletClientType=="string"&&typeof e.connectedAt=="number",Ad=()=>{let e=Q.get(gd);return e&&Array.isArray(e)&&e.map(o=>F3(o)).every(Boolean)?e:[]};import{ofetch as B3}from"ofetch";var H3=[gs,Cs,vs,Es],il=class{constructor({appId:t,appClientId:r,client:o,defaults:n}){this.appId=t,this.appClientId=r,this.clientAnalyticsId=o.clientAnalyticsId,this.sdkVersion=ud,this.client=o,this.defaults=n,this.fallbackApiUrl=o.fallbackApiUrl,this.baseFetch=B3.create({baseURL:this.defaults.baseURL,timeout:this.defaults.timeout,retry:3,retryDelay:500,retryStatusCodes:[408,409,425,500,502,503,504],credentials:"include",onRequest:async({request:i,options:a})=>{let l=new Headers(a.headers);l.set("privy-app-id",this.appId),this.appClientId&&l.set("privy-client-id",this.appClientId),l.set("privy-ca-id",this.clientAnalyticsId||""),l.set("privy-client",`react-auth:${this.sdkVersion}`);let s=H3.includes(i.toString());if(!l.has("authorization")){let c=await this.client.getAccessToken({disableAutoRefresh:s});c!==null&&l.set("authorization",`Bearer ${c}`)}a.headers=l,a.retryDelay&&(a.retryDelay=a.retryDelay*3)},onRequestError:({error:i})=>{if(i instanceof DOMException&&i.name==="AbortError")throw new hs}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw le(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw le(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw le(o)}}};var zf=e=>({challenge:e.challenge,allowCredentials:e.allow_credentials?.map(t=>({id:t.id,type:t.type,transports:t.transports}))||[],timeout:e.timeout,extensions:{appid:e.extensions?.app_id,credProps:e.extensions?.cred_props,hmacCreateSecret:e.extensions?.hmac_create_secret},userVerification:e.user_verification});import Bo from"js-cookie";function $f(e){return e instanceof Lo?"email":e instanceof Sn?"sms":e instanceof To?"siwe":e instanceof ei?"custom_auth":e instanceof Jr?e.meta.provider:null}import*as Kf from"jose";var Sr=class{static parse(t){try{return new Sr(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Kf.decodeJwt(t)}get subject(){return this._decoded.sub}get expiration(){return this._decoded.exp}get issuer(){return this._decoded.iss}get audience(){return this._decoded.aud}isExpired(t=0){let r=Date.now(),o=(this.expiration-t)*1e3;return r>=o}};var G3=30,al=class{constructor(){this.authenticateOnce=new Le(async t=>this._authenticate(t)),this.linkOnce=new Le(async t=>this._link(t)),this.refreshOnce=new Le(this._refresh.bind(this)),this.destroyOnce=new Le(this._destroy.bind(this)),this.forkSessionOnce=new Le(this._forkSession.bind(this))}get token(){try{let t=Q.get(yn);return typeof t=="string"?new Sr(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=Q.get(Os);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=Q.get(ia);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}getProviderAccessToken(t){try{let r=Q.get(sa(t));if(typeof r=="string"){let o=new Sr(r);return o.isExpired()?(Q.del(sa(t)),null):o.value}else return null}catch(r){return console.error(r),null}}get mightHaveServerCookies(){try{let t=Bo.get(Ls);return t!==void 0&&t.length>0}catch(t){console.error(t)}return!1}hasRefreshCredentials(){return this.mightHaveServerCookies||typeof this.token=="string"&&typeof this.refreshToken=="string"&&this.refreshToken!==km}hasRecoveryCredentials(){return typeof this.forkedToken=="string"}hasActiveToken(){let t=Sr.parse(this.token);return t!==null&&!t.isExpired(G3)}authenticate(t){return this.authenticateOnce.execute(t)}link(t){return this.linkOnce.execute(t)}refresh(){return this.refreshOnce.execute()}forkSession(){return this.forkSessionOnce.execute()}destroy(){return this.destroyOnce.execute()}storeProviderAccessToken(t,r){typeof r=="string"?Q.put(sa(t),r):Q.del(sa(t))}async _authenticate(t){try{let r=await t.authenticate(),{user:o,is_new_user:n,oauth_tokens:i}=r;this.handleTokenResponse(r);let a=i,l=a?{provider:a.provider,accessToken:a.access_token,accessTokenExpiresInSeconds:a.access_token_expires_in_seconds,refreshToken:a.refresh_token,refreshTokenExpiresInSeconds:i.refresh_token_expires_in_seconds,scopes:a.scopes}:void 0,s=$f(t);return s&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate",payload:{method:s,isNewUser:n}}),s==="siwe"&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate_siwe",payload:{connectorType:t.meta.connectorType,walletClientType:t.meta.walletClientType}}),{user:zt(o),isNewUser:n,oAuthTokens:l}}catch(r){throw console.warn("Error authenticating session"),tt(r)}}async _link(t){try{let r=await t.link(),o=r.oauth_tokens,n=o?{provider:o.provider,accessToken:o.access_token,accessTokenExpiresInSeconds:o.access_token_expires_in_seconds,refreshToken:o.refresh_token,refreshTokenExpiresInSeconds:o.refresh_token_expires_in_seconds,scopes:o.scopes}:void 0;return{user:zt(r),oAuthTokens:n}}catch(r){throw console.warn("Error linking account"),tt(r)}}async _refresh(){if(!this.api)throw new w("Session has no API instance");if(!this.client)throw new w("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let t=this.token,r=this.refreshToken,o=this.forkedToken;if(this.client.useServerCookies&&!this.mightHaveServerCookies&&this.token&&window.location.origin===this.client.apiUrl)return this.destroyLocalState(),null;try{let n;if(t&&r||this.mightHaveServerCookies){let i={};t&&(i.authorization=`Bearer ${t}`);let a=r?{refresh_token:r}:{};n=await this.api.post(gs,a,{headers:i}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(Cs,{refresh_token:o}),this.clearForkedToken();else return null;return this.handleTokenResponse(n),zt(n.user)}catch(n){if(n instanceof Mt&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw tt(n)}}handleTokenResponse(t){t.session_update_action?t.session_update_action==="set"?(this.storeRefreshToken(t.refresh_token),this.storeToken(t.token),t.identity_token&&this.storeIdentityToken(t.identity_token)):t.session_update_action==="clear"?this.destroyLocalState():t.session_update_action==="ignore"&&t.token&&(this.storeToken(t.token),t.identity_token&&this.storeIdentityToken(t.identity_token)):(this.storeRefreshToken(t.refresh_token),this.storeToken(t.token),t.identity_token&&this.storeIdentityToken(t.identity_token))}async _destroy(){try{await this.api?.post(vs,{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new w("Session has no API instance");let t=this.refreshToken;try{let r=await this.api.post(wu,{refresh_token:t});return this.storeRefreshToken(r.refresh_token),this.storeToken(r.token),r.new_session_refresh_token}catch(r){throw tt(r)}}destroyLocalState(){this.storeRefreshToken(null),this.storeToken(null),this.clearIdentityToken(),this.clearForkedToken()}storeToken(t){if(typeof t=="string"){let r=Q.get(yn);if(Q.put(yn,t),!this.client?.useServerCookies){let o=Sr.parse(t)?.expiration;Bo.set(md,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}r!==t&&this.client?.onStoreToken?.(t)}else Q.del(yn),Bo.remove(md),this.client?.onDeleteToken?.()}storeRefreshToken(t){typeof t=="string"?(Q.put(Os,t),this.client?.useServerCookies||Bo.set(Ls,"t",{sameSite:"Strict",secure:!0,expires:30})):(Q.del(Os),Bo.remove(Sm),Bo.remove(Ls))}storeIdentityToken(t){if(this.client?.useServerCookies)return;Q.put(fd,t);let r=Sr.parse(t)?.expiration;Bo.set(hd,t,{sameSite:"Strict",secure:!0,expires:r?new Date(r*1e3):void 0})}clearIdentityToken(){Q.del(fd),Bo.remove(hd)}clearForkedToken(){Q.del(ia)}};var kd,sl,jf,ya=class{constructor(t){fs(this,sl);this.apiUrl=t.apiUrl||Ms,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!!t.apiUrl&&t.apiUrl.startsWith("https://privy."),this.timeout=t.timeout||Tm,this.appId=t.appId,this.appClientId=t.appClientId,this.clientAnalyticsId=Cu(this,sl,jf).call(this),kd||(kd=new al),this.session=kd,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager({walletConnectCloudProjectId:t,rpcConfig:r,chains:o,defaultChain:n,store:i,walletList:a,shouldEnforceDefaultChainOnConnect:l,externalWalletConfig:s,appName:c}){this.connectors||(this.connectors=new ha(this.appId,t,r,o,n,i,a,l,s,c))}sessionHasActiveToken(){return this.session.hasActiveToken()}generateApi(){let t=new il({appId:this.appId,appClientId:this.appClientId,client:this,defaults:{baseURL:this.apiUrl,timeout:this.timeout}});return this.session.api=t,t}updateApiUrl(t){this.apiUrl=t||this.fallbackApiUrl,this.api=this.generateApi(),t&&(this.useServerCookies=!0)}authenticate(){if(!this.authFlow)throw new w("No auth flow in progress.");return this.session.authenticate(this.authFlow)}async link(){if(!this.authFlow)throw new w("No auth flow in progress.");let{oAuthTokens:t}=await this.session.link(this.authFlow);return{user:await this.getAuthenticatedUser(),oAuthTokens:t}}storeProviderAccessToken(t,r){this.session.storeProviderAccessToken(t,r)}getProviderAccessToken(t){return this.session.getProviderAccessToken(t)}async logout(){await this.session.destroy(),this.authFlow=void 0}clearProviderAcccessTokens(t){t.linkedAccounts.filter(o=>o.type==="cross_app").forEach(o=>{this.storeProviderAccessToken(o.providerApp.id,null)})}startAuthFlow(t){return t.api=this.api,this.authFlow=t,this.authFlow}async initMfaSmsVerification(){try{await this.api.post(Ju,{action:"verify"})}catch(t){throw le(t)}}async initMfaPasskeyVerification(){try{let t=await this.api.post(Xu,{});return zf(t.options)}catch(t){throw le(t)}}async acceptTerms(){try{let t=await this.api.post(em,{});return zt(t)}catch(t){throw tt(t)}}async unlinkEmail(t){try{let r=await this.api.post(Wu,{address:t});return await this.getAuthenticatedUser()??zt(r)}catch(r){throw tt(r)}}async unlinkPhone(t){try{let r=await this.api.post(Du,{phoneNumber:t});return await this.getAuthenticatedUser()??zt(r)}catch(r){throw tt(r)}}async unlinkWallet(t){try{let r=await this.api.post(Su,{address:t});return await this.getAuthenticatedUser()??zt(r)}catch(r){throw tt(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(Bu,{provider:t,subject:r});return await this.getAuthenticatedUser()??zt(o)}catch(o){throw tt(o)}}async unlinkFarcaster(t){try{let r=await this.api.post(ku,{fid:t});return await this.getAuthenticatedUser()??zt(r)}catch(r){throw tt(r)}}async unlinkTelegram(t){try{let r=await this.api.post(Qu,{telegram_user_id:t});return await this.getAuthenticatedUser()??zt(r)}catch(r){throw tt(r)}}async unlinkPasskey(t){try{let r=await this.api.post(ju,{credential_id:t});return await this.getAuthenticatedUser()??zt(r)}catch(r){throw tt(r)}}async createAnalyticsEvent({eventName:t,payload:r,timestamp:o,options:n}){if(!(typeof window>"u"))try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(Es,{event_name:t,client_id:this.clientAnalyticsId,payload:{...r||{},clientTimestamp:o?o.toISOString():new Date().toISOString()}},{retry:-1,keepalive:n?.keepAlive??!1})}catch{}}async signMoonpayOnRampUrl(t){try{return this.api.post(rm,t)}catch(r){throw tt(r)}}async initCoinbaseOnRamp(t){try{return this.api.post(om,t)}catch(r){throw tt(r)}}async getCoinbaseOnRampStatus({partnerUserId:t}){try{return this.api.get(`${nm}?partnerUserId=${t}`)}catch(r){throw tt(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?Sr.parse(this.session.token)?.audience!==this.appId?(await this.logout(),null):this.session.token:!t?.disableAutoRefresh&&this.session.hasRefreshCredentials()?(await this.session.refresh(),this.session.token):null}async getServerConfig(){try{let t={},r=this.session.token;r&&(t.authorization=`Bearer ${r}`);let o=await this.api.get(`/api/v1/apps/${this.appId}`,{baseURL:this.fallbackApiUrl,headers:t}),n=o.telegram_auth_config?{botId:o.telegram_auth_config.bot_id,botName:o.telegram_auth_config.bot_name,linkEnabled:o.telegram_auth_config.link_enabled,seamlessAuthEnabled:o.telegram_auth_config.seamless_auth_enabled}:void 0,i=o.funding_config?{methods:o.funding_config.methods,defaultRecommendedAmount:o.funding_config.default_recommended_amount,defaultRecommendedCurrency:o.funding_config.default_recommended_currency,promptFundingOnWalletCreation:o.funding_config.prompt_funding_on_wallet_creation}:void 0;return{id:o.id,name:o.name,verificationKey:o.verification_key,logoUrl:o.logo_url||void 0,accentColor:o.accent_color||void 0,showWalletLoginFirst:o.show_wallet_login_first,allowlistConfig:{errorTitle:o.allowlist_config.error_title,errorDetail:o.allowlist_config.error_detail,errorCtaText:o.allowlist_config.cta_text,errorCtaLink:o.allowlist_config.cta_link},walletAuth:o.wallet_auth,emailAuth:o.email_auth,smsAuth:o.sms_auth,googleOAuth:o.google_oauth,twitterOAuth:o.twitter_oauth,discordOAuth:o.discord_oauth,githubOAuth:o.github_oauth,spotifyOAuth:o.spotify_oauth,instagramOAuth:o.instagram_oauth,tiktokOAuth:o.tiktok_oauth,linkedinOAuth:o.linkedin_oauth,appleOAuth:o.apple_oauth,farcasterAuth:o.farcaster_auth,passkeyAuth:o.passkey_auth,telegramAuth:o.telegram_auth,termsAndConditionsUrl:o.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:o.embedded_wallet_config?.create_on_login,userOwnedRecoveryOptions:o.embedded_wallet_config.user_owned_recovery_options,requireUserOwnedRecoveryOnCreate:o.embedded_wallet_config.require_user_owned_recovery_on_create},privacyPolicyUrl:o.privacy_policy_url,requireUsersAcceptTerms:o.require_users_accept_terms,customApiUrl:o.custom_api_url,walletConnectCloudProjectId:o.wallet_connect_cloud_project_id,fiatOnRampEnabled:o.fiat_on_ramp_enabled,captchaEnabled:o.captcha_enabled,captchaSiteKey:o.captcha_site_key,twitterOAuthOnMobileEnabled:o.twitter_oauth_on_mobile_enabled,createdAt:new Date(o.created_at*1e3),updatedAt:new Date(o.updated_at*1e3),mfaMethods:o.mfa_methods,enforceWalletUis:o.enforce_wallet_uis,legacyWalletUiConfig:o.legacy_wallet_ui_config,telegramAuthConfiguration:n,fundingConfig:i}}catch(t){throw tt(t)}}async getUsdTokenPrice(t){try{return(await this.api.get(`/api/v1/token_price?chainId=${t.id}&tokenSymbol=${t.nativeCurrency.symbol}`)).usd}catch{console.error(`Unable to fetch token price for chain with id ${t.id}`);return}}async requestFarcasterSignerStatus(t){try{return await this.api.post("/api/v1/farcaster/signer/status",{ed25519_public_key:t})}catch(r){throw console.error("Unable to fetch Farcaster signer status"),r}}async forkSession(){return await this.session.forkSession()}async generateSiweNonce({address:t,captchaToken:r}){try{return(await this.api.post(bu,{address:t,token:r})).nonce}catch(o){throw tt(o)}}async authenticateWithSiweInternal({message:t,signature:r,chainId:o,walletClientType:n,connectorType:i}){return await this.api.post(Eu,{message:t,signature:r,chainId:o,walletClientType:n,connectorType:i})}async linkWithSiweInternal({message:t,signature:r,chainId:o,walletClientType:n,connectorType:i}){return await this.api.post(Tu,{message:t,signature:r,chainId:o,walletClientType:n,connectorType:i})}async linkWithSiwe({message:t,signature:r,chainId:o,walletClientType:n,connectorType:i}){try{let a=await this.linkWithSiweInternal({message:t,signature:r,chainId:o,walletClientType:n,connectorType:i});return zt(a)}catch(a){throw tt(a)}}};sl=new WeakSet,jf=function(){if(typeof window>"u")return null;try{let r=Q.get(aa);if(typeof r=="string"&&r.length>0)return r}catch{}let t=V3();try{return Q.put(aa,t),t}catch{return t}};import{Turnstile as Y3}from"@marsidev/react-turnstile";import{useEffect as Z3,useMemo as Q3}from"react";import{useMemo as q3,useRef as z3,useContext as $3,useState as Rd,createContext as K3}from"react";import{jsx as j3}from"react/jsx-runtime";var Yf=K3({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:S,setError:S,setExecuting:S,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:S,reset:S,execute:S}),nr=class extends et{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},Zf=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=z3(null),[i,a]=Rd(),[l,s]=Rd(),[c,m]=Rd(!1),f=q3(()=>o?!c&&!i&&!l?{status:"ready"}:c&&!i&&!l?{status:"loading"}:i&&!l?{status:"success",token:i}:l?{status:"error",error:l}:{status:"ready"}:{status:"disabled"},[o,i,l,c]);return j3(Yf.Provider,{value:{...f,ref:n,enabled:o,siteKey:r,appId:t,setToken:a,setError:s,setExecuting:m,remove(){o&&(n.current?.remove(),m(!1),s(void 0),a(void 0))},reset(){o&&(n.current?.reset(),m(!1),s(void 0),a(void 0))},execute(){o&&(m(!0),n.current?.execute())},async waitForResult(){if(!o)return"";try{return await lm(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new nr("Captcha failed",null,"captcha_timeout")}}},children:e})},be=()=>$3(Yf);import{jsx as Qf}from"react/jsx-runtime";var Id=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:i,setExecuting:a,ref:l}=be(),[,s]=Q3(()=>r?.split("t:")||[],[r]);if(Z3(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return Qf("div",{className:"hidden h-0 w-0",children:Qf(Y3,{...e,ref:l,siteKey:s,options:{action:o,size:"invisible",...e.delayedExecution?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{e.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{e.onError?.(),n("Captcha failed"),a(!1)},onSuccess:c=>{e.onSuccess?.(c),i(c),a(!1)},onExpire:()=>{e.onExpire?.();try{l.current?.reset(),n(void 0),i(void 0)}catch{n("expired_and_failed_reset")}}})})};import{useCallback as BS,useEffect as Kv,useRef as HS,useState as GS}from"react";import Zv from"styled-components";import{createContext as J3,useContext as X3}from"react";var Md=J3({isNewUserThisSession:!1,linkingOrConnectingHint:null,walletConnectionStatus:null,connectors:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,appId:"notAdded",nativeTokenSymbolForChainId:S,initializeWalletProxy:S,getAuthMeta:S,getAuthFlow:S,closePrivyModal:S,openPrivyModal:S,connectWallet:S,initLoginWithWallet:S,loginWithWallet:S,initLoginWithFarcaster:S,loginWithFarcaster:S,loginWithCode:S,initLoginWithEmail:S,initLoginWithSms:S,initUpdateEmail:S,resendEmailCode:S,resendSmsCode:S,initLoginWithHeadlessOAuth:S,loginWithHeadlessOAuth:S,crossAppAuthFlow:S,initLoginWithOAuth:S,recoveryOAuthFlow:S,loginWithOAuth:S,initLoginWithPasskey:S,loginWithPasskey:S,initLinkWithPasskey:S,linkWithPasskey:S,refreshUser:S,walletProxy:null,createAnalyticsEvent:S,acceptTerms:S,getUsdTokenPrice:S,recoverEmbeddedEthereumWallet:S,getMoonpaySignedUrl:S,initCoinbaseOnRamp:S,getCoinbaseOnRampStatus:S,updateWallets:S,fundWallet:S,setReadyToTrue:S,requestFarcasterSignerStatus:S,initLoginWithTelegram:S,loginWithTelegram:S,generateSiweMessage:S,linkWithSiwe:S,embeddedSolanaWallet:null,createEmbeddedSolanaWallet:S,recoverEmbeddedSolanaWallet:S,solanaSignMessage:S}),M=()=>X3(Md);import{createContext as e0,useContext as t0}from"react";var Se=e0({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:S,login:S,connectOrCreateWallet:S,linkEmail:S,linkPhone:S,linkFarcaster:S,linkWallet:S,linkCrossAppAccount:S,linkGoogle:S,linkTwitter:S,linkDiscord:S,linkGithub:S,linkSpotify:S,linkInstagram:S,linkTelegram:S,linkTiktok:S,linkLinkedIn:S,linkApple:S,linkPasskey:S,updateEmail:S,logout:S,getAccessToken:S,getEthereumProvider:S,getEthersProvider:S,getWeb3jsProvider:S,unlinkEmail:S,unlinkPhone:S,unlinkWallet:S,unlinkGoogle:S,unlinkTwitter:S,unlinkDiscord:S,unlinkGithub:S,unlinkSpotify:S,unlinkInstagram:S,unlinkTiktok:S,unlinkLinkedIn:S,unlinkApple:S,unlinkCrossAppAccount:S,unlinkFarcaster:S,unlinkTelegram:S,unlinkPasskey:S,setActiveWallet:S,forkSession:S,createWallet:S,importWallet:S,signMessage:S,signTypedData:S,enrollInMfa:S,initEnrollmentWithSms:S,initEnrollmentWithTotp:S,initEnrollmentWithPasskey:S,promptMfa:S,init:S,submitEnrollmentWithSms:S,submitEnrollmentWithTotp:S,submitEnrollmentWithPasskey:S,unenroll:S,submit:S,cancel:S,sendTransaction:S,exportWallet:S,setWalletPassword:S,setWalletRecovery:S,requestFarcasterSignerFromWarpcast:S,getFarcasterSignerPublicKey:S,signFarcasterMessage:S,initLoginWithEmail:S,initLoginWithSms:S,otpState:{status:"initial"},loginWithCode:S,fundWallet:S,initLoginWithHeadlessOAuth:S,loginWithHeadlessOAuth:S,generateSiweMessage:S,linkWithSiwe:S,signMessageWithCrossAppWallet:S,signTypedDataWithCrossAppWallet:S,sendTransactionWithCrossAppWallet:S,isHeadlessOAuthLoading:!1,isModalOpen:!1,mfaMethods:[]}),z=()=>t0(Se);import{useEffect as r0,useState as o0}from"react";var Jf=e=>{let[t,r]=o0("auto");return r0(()=>{let o=new ResizeObserver(n=>{r(n[0]?.contentRect.height??"auto")});return e.current&&o.observe(e.current),()=>{e.current&&o.unobserve(e.current)}},[e.current]),t};import{createContext as n0,useContext as i0,useEffect as a0}from"react";var Xf={login:{onComplete:[],onError:[],onOAuthLoginComplete:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]},linkAccount:{onSuccess:[],onError:[]},configureMfa:{onMfaRequired:[]},setWalletPassword:{onSuccess:[],onError:[]},setWalletRecovery:{onSuccess:[],onError:[]},signMessage:{onSuccess:[],onError:[]},signTypedData:{onSuccess:[],onError:[]},sendTransaction:{onSuccess:[],onError:[]},accessToken:{onAccessTokenGranted:[],onAccessTokenRemoved:[]},oAuthAuthorization:{onOAuthTokenGrant:[]},fundWallet:{onUserExited:[]}},Wd=n0(void 0),eh=()=>i0(Wd);function Ae(e,t){if(!t)return;let o=eh().current[e];return a0(()=>{for(let[n,i]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]?.push(i);return()=>{for(let[n,i]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]=o[n]?.filter(a=>a!==i)}},[t])}function F(e,t,r,...o){for(let n of e.current[t][r])n(...o)}function hi(){let e=eh();return(t,r,...o)=>F(e,t,r,...o)}function Od(e){Ae("configureMfa",e)}import{QuestionMarkCircleIcon as x0}from"@heroicons/react/24/outline";import sh from"styled-components";import xn,{css as th}from"styled-components";import Nd from"styled-components";import{Fragment as l0,jsx as Ld,jsxs as c0}from"react/jsx-runtime";var ot=({success:e,fail:t})=>c0(l0,{children:[Ld(nt,{className:e?"success":t?"fail":""}),Ld(ga,{className:e?"success":t?"fail":""})]}),nt=Nd.span`
12
+ - https://privy.io`};var To=class{constructor(t,r,o){this.getNonceOnce=new Le(this._getNonceOnce.bind(this)),this.wallet=t,this.captchaToken=o,this.client=r}get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType}}async authenticate(){if(!this.client)throw new w("SiweFlow has no client instance");try{let{message:t,signature:r}=await this.sign(),o=await this.client.authenticateWithSiweInternal({message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType});return{user:o.user,token:o.token,refresh_token:o.refresh_token,identity_token:o.identity_token,is_new_user:o.is_new_user}}catch(t){throw le(t)}}async link(){if(!this.client)throw new w("SiweFlow has no client instance");try{let{message:t,signature:r}=await this.sign();return await this.client.linkWithSiweInternal({message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw le(t)}}async sign(){if(!this.client)throw new w("SiweFlow has no client instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new w("Could not prepare SIWE message");let t=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async _getNonceOnce(){if(!this.client)throw new w("SiweFlow has no client instance");return await this.client.generateSiweNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildSiweMessage(){if(!this.client)throw new w("SiweFlow has no client instance");let t=this.wallet.address,r=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=Qs({address:t,chainId:r,nonce:this.nonce}),this.preparedMessage}};var Do=class{constructor(t,r){this.meta={phoneNumber:t,captchaToken:r}}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new w("phone number and sms code must be set prior to calling authenticate.");try{let t=await this.api.post(Bu,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,identity_token:t.identity_token,is_new_user:t.is_new_user}}catch(t){throw le(t)}}async link(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new w("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(Uu,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw le(t)}}async sendSmsCode(t,r){if(!this.api)throw new w("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),r&&(this.meta.captchaToken=r),!this.meta.phoneNumber)throw new w("phone nNumber must be set when initialzing authentication.");try{return await this.api.post(Du,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw le(o)}}},Js=class extends Do{constructor(r,o,n){super(o,n);this.meta={phoneNumber:o,captchaToken:n,oldPhoneNumber:r}}async link(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode||!this.meta.oldPhoneNumber)throw new w("Phone number, sms code, and an old phone number must be set prior to calling update.");try{return await this.api.post(Hu,{oldPhoneNumber:this.meta.oldPhoneNumber,newPhoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(r){throw le(r)}}};var si=class{constructor(t){this.meta={captchaToken:t}}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");try{let t=await this.api.post(Ju,{captcha_token:this.meta.captchaToken,telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData});return{user:t.user,token:t.token,refresh_token:t.refresh_token,identity_token:t.identity_token,is_new_user:t.is_new_user}}catch(t){throw le(t)}}async link(){if(!this.api)throw new w("Auth flow has no API instance");try{return await this.api.post(Xu,{telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData})}catch(t){throw le(t)}}};function Td(e){let t={detail:"",retryable:!1};return e?.privyErrorCode==="linked_to_another_user"&&(t.detail="This account has already been linked to another user."),e?.privyErrorCode==="disallowed_login_method"&&(t.detail="Login with Telegram not allowed."),e?.privyErrorCode==="invalid_data"&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode==="cannot_link_more_of_type"&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode==="invalid_credentials"&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode==="too_many_requests"&&(t.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode==="too_many_requests"&&e.message.includes("rate limit")&&(t.detail="Request limit reached for Telegram. Please wait a moment and try again."),t}function zm(){let e;if(e=QC(),e)return qm(),{...e,flowType:"login-url"};if(e=JC(),e)return qm(),{...e,flowType:"web-app"}}function QC(){let e=new URLSearchParams(window.location.search),t=Number(e.get("id")||""),r=e.get("hash"),o=Number(e.get("auth_date")||""),n=e.get("first_name"),i=e.get("last_name")||void 0,a=e.get("username")||void 0,l=e.get("photo_url")||void 0;if(!(!t||!n||!o||!r))return{id:t,first_name:n,last_name:i,username:a,photo_url:l,auth_date:o,hash:r}}function JC(){let e=window.location.hash;if(!e||!e.startsWith("#tgWebAppData"))return;let t=new URLSearchParams(decodeURIComponent(e.replace("#tgWebAppData=",""))),r=t.get("query_id"),o=t.get("user"),n=Number(t.get("auth_date")||""),i=t.get("hash");if(!(!r||!o||!n||!i))return{query_id:r,user:o,auth_date:n,hash:i}}function qm(){let e=new URL(window.location.href);e.searchParams.delete("id"),e.searchParams.delete("hash"),e.searchParams.delete("auth_date"),e.searchParams.delete("first_name"),e.searchParams.delete("last_name"),e.searchParams.delete("username"),e.searchParams.delete("photo_url"),window.history.replaceState({},"",e)}import{v4 as j3}from"uuid";function ee(e){return e?new Date(e*1e3):null}function XC(e){let t=[];for(let r of e){let o=r.type;switch(r.type){case"wallet":let n={address:r.address,type:r.type,imported:r.imported,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at),chainType:r.chain_type,chainId:r.chain_id,walletClient:r.wallet_client_type==="privy"?"privy":"unknown",walletClientType:r.wallet_client_type,connectorType:r.connector_type,recoveryMethod:r.recovery_method};t.push(n);break;case"cross_app":let i={type:r.type,subject:r.subject,embeddedWallets:r.embedded_wallets,smartWallets:r.smart_wallets,providerApp:{id:r.provider_app_id},verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(i);break;case"email":let a={address:r.address,type:r.type,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(a);break;case"phone":let l={number:r.phoneNumber,type:r.type,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(l);break;case"google_oauth":let s={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(s);break;case"spotify_oauth":let c={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(c);break;case"instagram_oauth":let m={subject:r.subject,username:r.username,type:r.type,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(m);break;case"twitter_oauth":let f={subject:r.subject,username:r.username,name:r.name,type:r.type,profilePictureUrl:r.profile_picture_url,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(f);break;case"discord_oauth":let u={subject:r.subject,username:r.username,email:r.email,type:r.type,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(u);break;case"github_oauth":let C={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(C);break;case"tiktok_oauth":let g={subject:r.subject,username:r.username,name:r.name,type:r.type,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(g);break;case"linkedin_oauth":let y={subject:r.subject,name:r.name,email:r.email,vanityName:r.vanity_name,type:r.type,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(y);break;case"apple_oauth":let b={subject:r.subject,email:r.email,type:r.type,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(b);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)});break;case"farcaster":let T={type:r.type,fid:r.fid,ownerAddress:r.owner_address,displayName:r.display_name,username:r.username,bio:r.bio,pfp:r.profile_picture_url,url:r.homepage_url,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at),signerPublicKey:r.signer_public_key};t.push(T);break;case"passkey":let k={type:r.type,enrolledInMfa:r.enrolled_in_mfa,credentialId:r.credential_id,authenticatorName:r.authenticator_name,createdWithDevice:r.created_with_device,createdWithOs:r.created_with_os,createdWithBrowser:r.created_with_browser,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(k);break;case"telegram":let S={type:r.type,telegramUserId:r.telegram_user_id,firstName:r.first_name,lastName:r.last_name,username:r.username,photoUrl:r.photo_url,verifiedAt:ee(r.first_verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(S);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function Vt(e,t){return e.slice().sort((r,o)=>(o.firstVerifiedAt??o.verifiedAt).getTime()-(r.firstVerifiedAt??r.verifiedAt).getTime()).find(r=>r.type===t)}var ge=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&!t.imported&&t.chainType==="ethereum")||null,An=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&!t.imported&&t.chainType==="solana")||null,Xs=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&t.imported&&t.chainType==="ethereum")||null,e3=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),qt=(e,t)=>ge(e)||An(e)?!1:t==="all-users"||t==="users-without-wallets"&&!e3(e)?.length;function zt(e){if(!e)return null;let t=XC(e.linked_accounts),r=Vt(t,"wallet"),o=Vt(t,"email"),n=Vt(t,"phone"),i=Vt(t,"google_oauth"),a=Vt(t,"twitter_oauth"),l=Vt(t,"discord_oauth"),s=Vt(t,"github_oauth"),c=Vt(t,"spotify_oauth"),m=Vt(t,"instagram_oauth"),f=Vt(t,"tiktok_oauth"),u=Vt(t,"linkedin_oauth"),C=Vt(t,"apple_oauth"),g=Vt(t,"farcaster"),y=Vt(t,"telegram"),b=e.mfa_methods.map(({type:k,verified_at:S})=>({type:k,verifiedAt:ee(S)}));return{id:e.id,createdAt:ee(e.created_at),linkedAccounts:t,email:o&&{address:o?.address},phone:n&&{number:n?.number},wallet:r&&{address:r.address,chainType:r.chainType,chainId:r.chainId,walletClient:r.walletClient,walletClientType:r.walletClientType,connectorType:r.connectorType,recoveryMethod:r.recoveryMethod,imported:r.imported},google:i&&{subject:i.subject,email:i.email,name:i.name},twitter:a&&{subject:a.subject,username:a.username,name:a.name,profilePictureUrl:a.profilePictureUrl},discord:l&&{subject:l.subject,username:l.username,email:l.email},github:s&&{subject:s.subject,username:s.username,name:s.name,email:s.email},spotify:c&&{subject:c.subject,email:c.email,name:c.name},instagram:m&&{subject:m.subject,username:m.username},tiktok:f&&{subject:f.subject,username:f.username,name:f.name},linkedin:u&&{subject:u.subject,name:u.name,email:u.email,vanityName:u.vanityName},apple:C&&{subject:C.subject,email:C.email},farcaster:g&&{fid:g.fid,ownerAddress:g.ownerAddress,displayName:g.displayName,username:g.username,bio:g.bio,pfp:g.pfp,url:g.url,signerPublicKey:g.signerPublicKey},telegram:y&&{telegramUserId:y.telegramUserId,firstName:y.firstName,lastName:y.lastName,username:y.username,photoUrl:y.photoUrl},mfaMethods:b.map(k=>k.type),hasAcceptedTerms:e.has_accepted_terms??!1}}import{getAddress as jf}from"@ethersproject/address";import{isHexString as G3}from"@ethersproject/bytes";import V3 from"eventemitter3";import l3 from"@coinbase/wallet-sdk";import{jsx as $m,jsxs as t3}from"react/jsx-runtime";var So=({style:e,...t})=>t3("svg",{width:"1024",height:"1024",viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[$m("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),$m("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]});import{getAddress as eo}from"@ethersproject/address";import{Web3Provider as Jm}from"@ethersproject/providers";import{default as a3}from"eventemitter3";import i3 from"eventemitter3";var r3=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],Km=e=>r3.includes(e);import{ErrorCode as o3}from"@ethersproject/logger";import{ProviderErrors as xn}from"@privy-io/js-sdk-core";var li=class extends ce{constructor(){super("Wallet timeout");this.type="wallet_error"}},ci=class extends ce{constructor(){super("User rejected connection");this.type="wallet_error"}},Lr=e=>{if(e instanceof ce)return e;if(e?.code&&e?.reason){let t=new Ct(e);return e.code===o3.ACTION_REJECTED&&(t.details=xn.E4001_USER_REJECTED_REQUEST),t}return e?.code?new Ct(e):new ce("Unknown connector error",e)},Sr=class extends et{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},Ct=class extends Sr{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(xn).find(i=>i.eipCode===o.code);this.details=n||xn.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=xn.E32002_CONNECTION_ALREADY_PENDING:this.details=xn.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=xn.E32002_WALLET_LOCKED))}},n3={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Wallet request timed out",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_USER_REJECTED_CONNECTION:{message:"You rejected the request",detail:"Please try connecting again.",retryable:!0}},_o={...n3,...xn};var je=class{constructor(t,r){this.removeListener=(t,r)=>{if(this.walletProvider)try{return this.walletProvider.removeListener(t,r)}catch{console.warn("Unable to remove wallet provider listener")}};this.walletTimeout=(t=new li,r=this.rpcTimeoutDuration)=>new Promise((o,n)=>setTimeout(()=>{n(t)},r));this.setWalletProvider=t=>{this.walletProvider&&this._subscriptions.forEach(r=>{this.removeListener(r.eventName,r.listener)}),this.walletProvider=t,this._subscriptions.forEach(r=>{this.walletProvider?.on(r.eventName,r.listener)})};this.walletProvider=t,this.rpcTimeoutDuration=r||Tn,this._subscriptions=[]}on(t,r){if(this.walletProvider)return this.walletProvider.on(t,r);this._subscriptions.push({eventName:t,listener:r})}async request(t){if(!this.walletProvider)throw new ce(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),this.walletTimeout()]).catch(r=>{throw Lr(r)})}},Uo=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},ua=class extends i3{constructor(r,o,n,i,a,l=1){super();this.walletProxy=r,this.address=o,this.chainId=l,this.rpcConfig=n,this.chains=i,this.provider=Gt(l,this.chains,n,{appId:a}),this.rpcTimeoutDuration=di(n,"privy"),this.appId=a}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new Uo(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await we()||!this.address)throw new Uo("Disconnected",4900);return(await Zm(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new Uo(`Invalid params for ${r.method}`,4200);let o;if(typeof r.params[0]=="string")o=r.params[0];else if("chainId"in r.params[0]&&typeof r.params[0].chainId=="string")o=r.params[0].chainId;else throw new Uo(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=Gt(this.chainId,this.chains,this.rpcConfig,{appId:this.appId}),this.emit("chainChanged",o)}async handlePersonalSign(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for personal_sign");let o=r.params[0],n=r.params[1];return await jm(o,void 0,n)}async handleSignedTypedData(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_signTypedData_v4");let o=typeof r.params[1]=="string"?JSON.parse(r.params[1]):r.params[1];return await Ym(na(o))}async handleEstimateGas(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_estimateGas");delete r.params[0].gasPrice,delete r.params[0].maxFeePerGas,delete r.params[0].maxPriorityFeePerGas;let o={...r.params[0],chainId:vn(this.chainId)};try{return await this.provider.send("eth_estimateGas",[o])}catch(n){console.warn(`Gas estimation failed with error: ${n}. Retrying gas estimation by omitting the 'from' address`);try{return delete o.from,await this.provider.send("eth_estimateGas",[o])}catch(i){throw console.warn(`Gas estimation failed with error: ${i} when omitting the 'from' address`),n}}}async request(r){switch(console.debug("Embedded1193Provider.request() called with args",r),r.method){case"eth_accounts":case"eth_requestAccounts":return this.address?[this.address]:[];case"eth_chainId":return vn(this.chainId);case"eth_estimateGas":return this.handleEstimateGas(r);case"eth_sendTransaction":return this.handleSendTransaction(r);case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(r);case"personal_sign":return this.handlePersonalSign(r);case"eth_signTypedData_v4":return this.handleSignedTypedData(r);default:break}if(Km(r.method)){let o=await we();if(await Qm(),!o||!this.address)throw new Uo("Disconnected",4900);try{return(await this.walletProxy.rpc({address:this.address,accessToken:o,request:{method:r.method,params:r.params}})).response.data}catch(n){throw console.error(n),new Uo("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await we();if(!r||!this.address)return null;try{return(await this.walletProxy.connect({address:this.address,accessToken:r})).address}catch(o){return console.error(o),null}}},Xr=class extends je{constructor(r){super(r,r.rpcTimeoutDuration)}},Fo=class extends je{constructor(t){super(t,t.rpcTimeoutDuration)}sendAsync(t,r){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var s3=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},$t=class extends a3{constructor(r,o,n,i){super();this.onAccountsChanged=r=>{r.length===0?this.onDisconnect():this.syncAccounts(r)};this.onChainChanged=r=>{this.wallets.forEach(o=>{o.chainId=oi(r),this.walletClientType==="privy"&&Q.put(Ds(o.address),r)}),this.emit("walletsUpdated")};this.onDisconnect=()=>{this.connected=!1,this.wallets=[],this.emit("walletsUpdated")};this.onConnect=()=>{this.connected=!0,this.syncAccounts()};this.wallets=[],this.walletClientType=r,this.chains=o,this.defaultChain=n,this.rpcConfig=i,this.rpcTimeoutDuration=di(i,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n,i){let a=async()=>!!this.wallets.find(l=>eo(l.address)===eo(r));return{address:eo(r),chainId:o,meta:n,imported:i,switchChain:async l=>{if(!a)throw new ce("Wallet is not currently connected.");let s=this.wallets.find(C=>eo(C.address)===eo(r))?.chainId;if(!s)throw new ce("Unable to determine current chainId.");let c,m;if(typeof l=="number"?(c=`0x${l.toString(16)}`,m=l):(c=l,m=Number(l)),s===oi(c))return;let f=this.chains.find(C=>C.id===m);if(!f)throw new ce(`Unsupported chainId: ${l}`);let u=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:c}]})};try{return await u()}catch(C){if(s3(C,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:c,chainName:f.name,nativeCurrency:f.nativeCurrency,rpcUrls:[f.rpcUrls.default?.http[0]??""],blockExplorerUrls:[f.blockExplorers?.default.url??""]}]}),u();throw this.walletClientType==="rainbow"&&C.message?.includes("wallet_switchEthereumChain")?new ce(`Rainbow does not support the chainId ${o}`):C}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:a,getEthereumProvider:async()=>{if(!await a())throw new ce("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await a())throw new ce("Wallet is not currently connected.");return new Jm(new Xr(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await a())throw new ce("Wallet is not currently connected.");return new Fo(this.proxyProvider)},sign:async l=>{if(!await a())throw new ce("Wallet is not currently connected.");return await this.sign(l)},disconnect:()=>{this.disconnect()}}}async syncAccounts(r){let o=r;try{if(o===void 0){let c=await oa(()=>this.proxyProvider.request({method:"eth_accounts"}),{maxAttempts:10,delayMs:500});Array.isArray(c)&&(o=c)}}catch(c){console.warn("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.",c)}if(!o||!Array.isArray(o)||o.length<=0||!o[0])return;let n=o[0],i=eo(n),a=[],l;if(this.walletClientType==="privy"){let c=Q.get(Ds(i));this.chains.find(m=>m.id===Number(c))||(Q.del(Ds(i)),c=null),l=c||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:l}]})}catch{console.warn(`Unable to switch embedded wallet to chain ID ${l} on initialization`)}}else try{let c=await oa(()=>this.proxyProvider.request({method:"eth_chainId"}),{maxAttempts:10,delayMs:500});if(typeof c=="string")l=c;else if(typeof c=="number")l=`0x${c.toString(16)}`;else throw new Error("Invalid chainId returned from provider")}catch(c){console.warn(`Failed to get chainId from provider, defaulting to ${wd}`,c),l=wd}let s=oi(l);if(!a.find(c=>eo(c.address)===i)){let c={name:this.walletBranding.name,icon:typeof this.walletBranding.icon=="string"?this.walletBranding.icon:void 0,id:this.walletBranding.id};a.push(this.buildConnectedWallet(eo(n),s,c,this.connectorType==="embedded_imported"))}el(a,this.wallets)||(this.wallets=a,this.emit("walletsUpdated"))}async getConnectedWallet(){let r=await this.proxyProvider.request({method:"eth_accounts"});return this.wallets.sort((o,n)=>n.connectedAt-o.connectedAt).find(o=>r.find(n=>eo(n)===eo(o.address)))||null}async isConnected(){let r=await this.proxyProvider.request({method:"eth_accounts"});return Array.isArray(r)&&r.length>0}async sign(r){return await this.connect({showPrompt:!1}),new Jm(new Xr(this.proxyProvider)).getSigner().signMessage(r)}subscribeListeners(){this.proxyProvider.on("accountsChanged",this.onAccountsChanged),this.proxyProvider.on("chainChanged",this.onChainChanged),this.proxyProvider.on("disconnect",this.onDisconnect),this.proxyProvider.on("connect",this.onConnect)}unsubscribeListeners(){this.proxyProvider.removeListener("accountsChanged",this.onAccountsChanged),this.proxyProvider.removeListener("chainChanged",this.onChainChanged),this.proxyProvider.removeListener("disconnect",this.onDisconnect),this.proxyProvider.removeListener("connect",this.onConnect)}};var c3=[1,11155111,137,10,8453,84532,42161,7777777,43114,56],d3=(e,t)=>e.makeWeb3Provider({options:t}),Sd,tl=class extends $t{constructor(r,o,n,i,a,l){super("coinbase_wallet",r,o,n);this.connectorType="coinbase_wallet";this.displayName="Coinbase Wallet";if(this.proxyProvider=new je(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.connectionOptions=i.coinbaseWallet.connectionOptions??"all",this.walletClientType=this.connectionOptions==="smartWalletOnly"?"coinbase_smart_wallet":"coinbase_wallet",this.walletClientType==="coinbase_smart_wallet"&&(this.displayName="Coinbase Smart Wallet"),!Sd){let s=[o.id].concat(r.map(m=>m.id)),c=this.connectionOptions!=="eoaOnly"?s.filter(m=>!c3.includes(m)):[];c.length>0&&console.warn(`The following configured chains are not supported by the Coinbase Smart Wallet: ${c.join(", ")}`),Sd=new l3({appName:a,appLogoUrl:l,appChainIds:s})}this.proxyProvider.setWalletProvider(d3(Sd,this.connectionOptions))}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}disconnect(){this.proxyProvider.walletProvider.disconnect(),this.onDisconnect()}get walletBranding(){return{name:this.displayName,icon:So,id:"com.coinbase.wallet"}}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new ce("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([r[0]])}catch(r){throw Lr(r)}}};import{jsx as Xm}from"react/jsx-runtime";var Bo=({...e})=>Xm("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:Xm("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.37126 11.0323C2.37126 12.696 3.90598 13.4421 5.40654 13.4468C8.91753 13.4468 12.8021 11.2897 12.7819 7.67984C12.7673 5.07728 10.3748 2.86167 7.54357 2.88296C4.8495 2.88296 2.21821 4.6411 2.21803 7.03628C2.21803 7.67951 2.58722 8.30178 3.55231 8.37184C2.74763 9.16826 2.37126 10.1225 2.37126 11.0323ZM7.55283 8.68012C8.11562 8.68012 8.57186 8.13217 8.57186 7.45624C8.57186 6.78032 8.11562 6.23237 7.55283 6.23237C6.99003 6.23237 6.53379 6.78032 6.53379 7.45624C6.53379 8.13217 6.99003 8.68012 7.55283 8.68012ZM10.4747 8.68012C11.0375 8.68012 11.4937 8.13217 11.4937 7.45625C11.4937 6.78032 11.0375 6.23237 10.4747 6.23237C9.91186 6.23237 9.45562 6.78032 9.45562 7.45625C9.45562 8.13217 9.91186 8.68012 10.4747 8.68012Z",fill:e.color||"var(--privy-color-foreground-3)"})});var ma=class extends $t{constructor(r,o,n,i,a=!1){super("privy",o,n,i);this.connectorType="embedded";this.proxyProvider=r,a&&(this.connectorType="embedded_imported"),this.subscribeListeners()}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return await this.isConnected()?(await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[vn(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:Bo,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};import{jsx as ef}from"react/jsx-runtime";var pi=({style:e,...t})=>ef("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:ef("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})});import{jsx as nr,jsxs as p3}from"react/jsx-runtime";var ui=({style:e,...t})=>p3("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",x:0,y:0,viewBox:"0 0 318.6 318.6",width:"28",height:"28",style:{height:"28px",width:"28px",...e},...t,children:[nr("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),nr("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),nr("path",{d:"m44.4 35.5 98.7 74.6-17.5-44.3zm193.9 171.3-26.5 40.6 56.7 15.6 16.3-55.3zm-204.4.9L50.1 263l56.7-15.6-26.5-40.6z",className:"s1 s2"}),nr("path",{d:"m103.6 138.2-15.8 23.9 56.3 2.5-2-60.5zm111.3 0-39-34.8-1.3 61.2 56.2-2.5zM106.8 247.4l33.8-16.5-29.2-22.8zm71.1-16.5 33.9 16.5-4.7-39.3z",className:"s1 s2"}),nr("path",{fill:"#d7c1b3",stroke:"#d7c1b3",className:"s1",d:"m211.8 247.4-33.9-16.5 2.7 22.1-.3 9.3zm-105 0 31.5 14.9-.2-9.3 2.5-22.1z"}),nr("path",{fill:"#233447",stroke:"#233447",className:"s1",d:"m138.8 193.5-28.2-8.3 19.9-9.1zm40.9 0 8.3-17.4 20 9.1z"}),nr("path",{fill:"#cd6116",stroke:"#cd6116",className:"s1",d:"m106.8 247.4 4.8-40.6-31.3.9zM207 206.8l4.8 40.6 26.5-39.7zm23.8-44.7-56.2 2.5 5.2 28.9 8.3-17.4 20 9.1zm-120.2 23.1 20-9.1 8.2 17.4 5.3-28.9-56.3-2.5z"}),nr("path",{fill:"#e4751f",stroke:"#e4751f",className:"s1",d:"m87.8 162.1 23.6 46-.8-22.9zm120.3 23.1-1 22.9 23.7-46zm-64-20.6-5.3 28.9 6.6 34.1 1.5-44.9zm30.5 0-2.7 18 1.2 45 6.7-34.1z"}),nr("path",{d:"m179.8 193.5-6.7 34.1 4.8 3.3 29.2-22.8 1-22.9zm-69.2-8.3.8 22.9 29.2 22.8 4.8-3.3-6.6-34.1z",className:"s3"}),nr("path",{fill:"#c0ad9e",stroke:"#c0ad9e",className:"s1",d:"m180.3 262.3.3-9.3-2.5-2.2h-37.7l-2.3 2.2.2 9.3-31.5-14.9 11 9 22.3 15.5h38.3l22.4-15.5 11-9z"}),nr("path",{fill:"#161616",stroke:"#161616",className:"s1",d:"m177.9 230.9-4.8-3.3h-27.7l-4.8 3.3-2.5 22.1 2.3-2.2h37.7l2.5 2.2z"}),nr("path",{fill:"#763d16",stroke:"#763d16",className:"s1",d:"m278.3 114.2 8.5-40.8-12.7-37.9-96.2 71.4 37 31.3 52.3 15.3 11.6-13.5-5-3.6 8-7.3-6.2-4.8 8-6.1zM31.8 73.4l8.5 40.8-5.4 4 8 6.1-6.1 4.8 8 7.3-5 3.6 11.5 13.5 52.3-15.3 37-31.3-96.2-71.4z"}),nr("path",{d:"m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z",className:"s3"})]});import{jsx as tf,jsxs as u3}from"react/jsx-runtime";var to=({style:e,...t})=>u3("svg",{xmlns:"http://www.w3.org/2000/svg",width:"108",height:"108",viewBox:"0 0 108 108",fill:"none",style:{height:"28px",width:"28px",...e},...t,children:[tf("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),tf("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M46.5267 69.9229C42.0054 76.8509 34.4292 85.6182 24.348 85.6182C19.5824 85.6182 15 83.6563 15 75.1342C15 53.4305 44.6326 19.8327 72.1268 19.8327C87.768 19.8327 94 30.6846 94 43.0079C94 58.8258 83.7355 76.9122 73.5321 76.9122C70.2939 76.9122 68.7053 75.1342 68.7053 72.314C68.7053 71.5783 68.8275 70.7812 69.0719 69.9229C65.5893 75.8699 58.8685 81.3878 52.5754 81.3878C47.993 81.3878 45.6713 78.5063 45.6713 74.4598C45.6713 72.9884 45.9768 71.4556 46.5267 69.9229ZM83.6761 42.5794C83.6761 46.1704 81.5575 47.9658 79.1875 47.9658C76.7816 47.9658 74.6989 46.1704 74.6989 42.5794C74.6989 38.9885 76.7816 37.1931 79.1875 37.1931C81.5575 37.1931 83.6761 38.9885 83.6761 42.5794ZM70.2103 42.5795C70.2103 46.1704 68.0916 47.9658 65.7216 47.9658C63.3157 47.9658 61.233 46.1704 61.233 42.5795C61.233 38.9885 63.3157 37.1931 65.7216 37.1931C68.0916 37.1931 70.2103 38.9885 70.2103 42.5795Z",fill:"#FFFDF8"})]});var fi=class extends $t{constructor(r,o,n,i,a){super(a||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new je(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=i;let l=i.provider;this.proxyProvider.setWalletProvider(l)}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:this.providerDetail.info.name,icon:this.providerDetail.info.icon,id:this.providerDetail.info.rdns}}disconnect(){console.warn(`Programmatic disconnect with ${this.providerDetail.info.name} is not yet supported.`)}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new ce("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw Lr(r)}}},mi,hi=class extends $t{constructor(r,o,n,i,a){super(a??"unknown",r,o,n);this.connectorType="injected";hs(this,mi,void 0);this.proxyProvider=new je(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(i),a==="metamask"?sd(this,mi,{name:"MetaMask",icon:ui,id:"io.metamask"}):a==="phantom"&&sd(this,mi,{name:"Phantom",icon:to,id:"phantom"})}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return wu(this,mi)??{name:"Browser Extension",icon:pi,id:"extension"}}disconnect(){console.warn("Programmatic disconnect with browser wallets is not yet supported.")}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new ce("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw Lr(r)}}};mi=new WeakMap;import{getAddress as ak}from"@ethersproject/address";import{Web3Provider as lk}from"@ethersproject/providers";import{isMobile as m3}from"react-device-detect";var rl=class extends fi{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{m3||await this.proxyProvider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let t=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!t||t.length===0||!t[0])throw new ce("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw Lr(t)}}};var ol=class extends $t{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new je(void 0,Tn);this.connectorType=r}get walletBranding(){return{name:"Wallet",id:""}}async initialize(){this.initialized=!0,this.emit("initialized")}async connect(){throw new Error("connect called for an uninstalled wallet via the NullConnector")}disconnect(){throw new Error("disconnect called for an uninstalled wallet via the NullConnector")}promptConnection(r){throw new Error(`promptConnection called for an uninstalled wallet via the NullConnector for ${r}`)}};var nl=class extends ol{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:to,id:"phantom"}}};import{EthereumProvider as U3,OPTIONAL_EVENTS as F3,OPTIONAL_METHODS as B3}from"@walletconnect/ethereum-provider";import{isMobile as H3}from"react-device-detect";import{createContext as R3,useContext as I3,useEffect as xd,useRef as M3,useState as W3}from"react";import{jsx as f3}from"react/jsx-runtime";function rf({src:e,...t}){return f3("img",{src:e,...t,style:{display:"none"}})}import{useContext as Vf,useEffect as Gf,useMemo as P3,useState as A3}from"react";import{createContext as x3}from"react";var Ot={appearance:{landingHeader:"Log in or sign up",theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:_m,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},externalWallets:{coinbaseWallet:{connectionOptions:"all"}},captchaEnabled:!1,_render:{standalone:!1},fundingMethodConfig:{moonpay:{useSandbox:!1}}};var of=({input:e})=>{if(!e||!e.primary[0])return;let t=[e.primary[0]],r=[];e.primary.length>4&&console.warn("You should not specify greater than 4 login methods in `loginMethodsAndOrder.primary`");for(let o of e.primary.slice(1))t.includes(o)?console.warn(`Duplicated login method: ${o}`):t.push(o);for(let o of e.overflow??[])!t.includes(o)&&!r.includes(o)?r.push(o):console.warn(`Duplicated login method: ${o}`);return{primary:t,overflow:r}};var h3=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets","rabby_wallet"]),nf=e=>h3.has(e),af=(e,t,r)=>r.indexOf(e)===t,sf=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(nf).filter(af):e?e.filter(nf).filter(af):Ot.appearance.walletList;var lf={id:42161,name:"Arbitrum One",network:"arbitrum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-mainnet.rpc.privy.systems"]},alchemy:{http:["https://arb-mainnet.g.alchemy.com/v2"],webSocket:["wss://arb-mainnet.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-mainnet.infura.io/v3"],webSocket:["wss://arbitrum-mainnet.infura.io/ws/v3"]},default:{http:["https://arb1.arbitrum.io/rpc"]},public:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://arbiscan.io"},default:{name:"Arbiscan",url:"https://arbiscan.io"}}};var cf={id:421613,name:"Arbitrum Goerli",network:"arbitrum-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"AGOR",decimals:18},rpcUrls:{default:{http:["https://goerli-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"}},testnet:!0};var df={id:421614,name:"Arbitrum Sepolia",network:"arbitrum-sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]},public:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-explorer.arbitrum.io"}},testnet:!0};var pf={id:43114,name:"Avalanche",network:"avalanche",nativeCurrency:{decimals:18,name:"Avalanche",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax.network/ext/bc/C/rpc"]},public:{http:["https://api.avax.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://snowtrace.io"},default:{name:"SnowTrace",url:"https://snowtrace.io"}}};var uf={id:43113,name:"Avalanche Fuji",network:"avalanche-fuji",nativeCurrency:{decimals:18,name:"Avalanche Fuji",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax-test.network/ext/bc/C/rpc"]},public:{http:["https://api.avax-test.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://testnet.snowtrace.io"},default:{name:"SnowTrace",url:"https://testnet.snowtrace.io"}},testnet:!0};var mf={id:8453,network:"base",name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-mainnet.rpc.privy.systems"]},blast:{http:["https://base-mainnet.blastapi.io"],webSocket:["wss://base-mainnet.blastapi.io"]},default:{http:["https://mainnet.base.org"]},public:{http:["https://mainnet.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://basescan.org"},default:{name:"Basescan",url:"https://basescan.org"}},testnet:!0};var ff={id:84531,network:"base-goerli",name:"Base Goerli Testnet",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://goerli.base.org"]}},blockExplorers:{default:{name:"Basescan",url:"https://goerli.basescan.org"}},testnet:!0};var hf={id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.base.org"]},public:{http:["https://sepolia.base.org"]}},blockExplorers:{default:{name:"Blockscout",url:"https://base-sepolia.blockscout.com"}},testnet:!0};var yf={id:80085,network:"berachain-artio",name:"Berachain Artio",nativeCurrency:{name:"BERA",symbol:"BERA",decimals:18},rpcUrls:{default:{http:["https://berachain-artio.rpc.privy.systems"]},public:{http:["https://berachain-artio.rpc.privy.systems"]}},blockExplorers:{default:{name:"Beratrail",url:"https://artio.beratrail.io"}},testnet:!0};var gf={id:42220,name:"Celo Mainnet",network:"celo",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://forno.celo.org"]},infura:{http:["https://celo-mainnet.infura.io/v3"]},public:{http:["https://forno.celo.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/mainnet"},etherscan:{name:"CeloScan",url:"https://celoscan.io"}},testnet:!1};var vf={id:44787,name:"Celo Alfajores Testnet",network:"celo-alfajores",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://alfajores-forno.celo-testnet.org"]},infura:{http:["https://celo-alfajores.infura.io/v3"]},public:{http:["https://alfajores-forno.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/alfajores"},etherscan:{name:"CeloScan",url:"https://alfajores.celoscan.io/"}},testnet:!0};var Cf={id:314,name:"Filecoin - Mainnet",network:"filecoin-mainnet",nativeCurrency:{decimals:18,name:"filecoin",symbol:"FIL"},rpcUrls:{default:{http:["https://api.node.glif.io/rpc/v1"]},public:{http:["https://api.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filfox",url:"https://filfox.info/en"},filscan:{name:"Filscan",url:"https://filscan.io"},filscout:{name:"Filscout",url:"https://filscout.io/en"},glif:{name:"Glif",url:"https://explorer.glif.io"}}};var wf={id:314159,name:"Filecoin - Calibration testnet",network:"filecoin-calibration",nativeCurrency:{decimals:18,name:"testnet filecoin",symbol:"tFIL"},rpcUrls:{default:{http:["https://api.calibration.node.glif.io/rpc/v1"]},public:{http:["https://api.calibration.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filscan",url:"https://calibration.filscan.io"}}};var bf={id:17069,name:"Garnet Holesky",network:"garnet-holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.garnetchain.com"]},public:{http:["https://rpc.garnetchain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.garnetchain.com"}}};var Ef={id:5,network:"goerli",name:"Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.ankr.com/eth_goerli"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.etherscan.io"}},testnet:!0};var Tf={id:17e3,name:"Holesky",network:"holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://ethereum-holesky.publicnode.com"]},public:{http:["https://ethereum-holesky.publicnode.com"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://holesky.etherscan.io"},default:{name:"EtherScan",url:"https://holesky.etherscan.io"}}};var Sf={id:59144,network:"linea-mainnet",name:"Linea Mainnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]},public:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://lineascan.build"},etherscan:{name:"Etherscan",url:"https://lineascan.build"}},testnet:!1};var _f={id:59140,network:"linea-testnet",name:"Linea Goerli Testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-goerli.infura.io/v3"],webSocket:["wss://linea-goerli.infura.io/ws/v3"]},default:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]},public:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.lineascan.build"},etherscan:{name:"Etherscan",url:"https://goerli.lineascan.build"}},testnet:!0};var Pf={id:42,network:"lukso",name:"LUKSO",nativeCurrency:{name:"LUKSO",symbol:"LYX",decimals:18},rpcUrls:{default:{http:["https://rpc.mainnet.lukso.network"],webSocket:["wss://ws-rpc.mainnet.lukso.network"]}},blockExplorers:{default:{name:"LUKSO Mainnet Explorer",url:"https://explorer.execution.mainnet.lukso.network"}}};var il={id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://mainnet.rpc.privy.systems"]},alchemy:{http:["https://eth-mainnet.g.alchemy.com/v2"],webSocket:["wss://eth-mainnet.g.alchemy.com/v2"]},infura:{http:["https://mainnet.infura.io/v3"],webSocket:["wss://mainnet.infura.io/ws/v3"]},default:{http:["https://cloudflare-eth.com"]},public:{http:["https://cloudflare-eth.com"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://etherscan.io"},default:{name:"Etherscan",url:"https://etherscan.io"}}};var Af={id:10,name:"OP Mainnet",network:"optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-mainnet.rpc.privy.systems"]},alchemy:{http:["https://opt-mainnet.g.alchemy.com/v2"],webSocket:["wss://opt-mainnet.g.alchemy.com/v2"]},infura:{http:["https://optimism-mainnet.infura.io/v3"],webSocket:["wss://optimism-mainnet.infura.io/ws/v3"]},default:{http:["https://mainnet.optimism.io"]},public:{http:["https://mainnet.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://optimistic.etherscan.io"},default:{name:"Optimism Explorer",url:"https://explorer.optimism.io"}}};var xf={id:420,name:"Optimism Goerli Testnet",network:"optimism-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://goerli.optimism.io"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"}},testnet:!0};var kf={id:11155420,name:"Optimism Sepolia",network:"optimism-sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.optimism.io"]},public:{http:["https://sepolia.optimism.io"]},infura:{http:["https://optimism-sepolia.infura.io/v3"]}},blockExplorers:{default:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com"}},testnet:!0};var Rf={id:137,name:"Polygon Mainnet",network:"matic",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{privy:{http:["https://polygon-mainnet.rpc.privy.systems"]},alchemy:{http:["https://polygon-mainnet.g.alchemy.com/v2"],webSocket:["wss://polygon-mainnet.g.alchemy.com/v2"]},infura:{http:["https://polygon-mainnet.infura.io/v3"],webSocket:["wss://polygon-mainnet.infura.io/ws/v3"]},default:{http:["https://polygon-rpc.com"]},public:{http:["https://polygon-rpc.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://polygonscan.com"},default:{name:"PolygonScan",url:"https://polygonscan.com"}}};var If={id:80001,name:"Mumbai",network:"maticmum",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{default:{http:["https://matic-mumbai.chainstacklabs.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://mumbai.polygonscan.com"}},testnet:!0};var Mf={id:690,name:"Redstone",network:"redstone",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.redstonechain.com"]},public:{http:["https://rpc.redstonechain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.redstone.xyz/"}}};var Wf={id:17001,name:"Redstone Holesky",network:"redstone-holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.holesky.redstone.xyz"]},public:{http:["https://rpc.holesky.redstone.xyz"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://explorer.holesky.redstone.xyz"},default:{name:"EtherScan",url:"https://explorer.holesky.redstone.xyz"}}};var Of={id:11155111,network:"sepolia",name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"SEP",decimals:18},rpcUrls:{privy:{http:["https://sepolia.rpc.privy.systems"]},alchemy:{http:["https://eth-sepolia.g.alchemy.com/v2"],webSocket:["wss://eth-sepolia.g.alchemy.com/v2"]},infura:{http:["https://sepolia.infura.io/v3"],webSocket:["wss://sepolia.infura.io/ws/v3"]},default:{http:["https://rpc.sepolia.org"]},public:{http:["https://rpc.sepolia.org"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://sepolia.etherscan.io"},default:{name:"Etherscan",url:"https://sepolia.etherscan.io"}},testnet:!0};var Lf={id:7777777,name:"Zora",network:"zora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]},public:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.zora.energy"}}};var Nf={id:999999999,name:"Zora Sepolia",network:"zora-sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]},public:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]}},blockExplorers:{default:{name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/"}},testnet:!0};var Df={id:999,name:"Zora Goerli Testnet",network:"zora-testnet",nativeCurrency:{decimals:18,name:"Zora Goerli",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]},public:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.explorer.zora.energy"}},testnet:!0};var fa=[lf,cf,df,Ef,Of,il,Af,xf,kf,Rf,If,gf,vf,Cf,wf,mf,ff,hf,yf,Pf,Sf,_f,pf,uf,Lf,Df,Nf,Tf,Mf,bf,Wf],NR=new Set(fa.map(e=>e.id));import kn from"tinycolor2";var Uf="#FFFFFF",y3="#040217",g3=Uf,v3="#1E1E1D";function C3(e){return e<.8&&e>.2&&console.warn("Background color is not light or dark enough, which could lead to accessibility issues."),e>.5?"light":"dark"}function Nr(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return kn({...e.toHsl(),l:r})}var w3="#51BA81",b3="#FFB74D",E3="#EC6351",T3=Uf,S3=y3;function Ff({backgroundTheme:e,accentHex:t}){let r;switch(e){case"light":r=g3;break;case"dark":r=v3;break;default:r=e;break}let o=kn(r),n=kn(t),i=kn(w3),a=kn(b3),l=kn(E3),s=C3(o.getLuminance()),c=Nr(o,s==="light"?-.04:.11),m=Nr(o,s==="light"?-.88:.87),f=Nr(o,s==="light"?-.7:.75),u=Nr(o,s==="light"?-.43:.45).desaturate(s==="light"?60:20),C=Nr(o,s==="light"?-.08:.25).desaturate(s==="light"?60:20),g=Nr(n,.15),y=Nr(n,-.06),b=Nr(l,.3),T=Nr(a,.3),k=kn(n.getLuminance()>.5?S3:T3),S=Nr(i,-.16),x=Nr(i,.4);return{colorScheme:s,background:o.toHslString(),background2:c.toHslString(),foreground:m.toHslString(),foreground2:f.toHslString(),foreground3:u.toHslString(),foreground4:C.toHslString(),accent:n.toHslString(),accentLight:g.toHslString(),accentDark:y.toHslString(),foregroundAccent:k.toHslString(),success:i.toHslString(),successDark:S.toHslString(),successLight:x.toHslString(),error:l.toHslString(),errorLight:b.toHslString(),warn:a.toHslString(),warnLight:T.toHslString()}}function _d(e,t,r){let o=r?console.warn:()=>{},n,i,a,l,s,c,m,f,u,C,g,y,b,T,k;t?.loginMethods?(n=t.loginMethods.includes("email"),i=t.loginMethods.includes("sms"),l=t.loginMethods.includes("wallet"),s=t.loginMethods.includes("google"),c=t.loginMethods.includes("twitter"),m=t.loginMethods.includes("discord"),u=t.loginMethods.includes("spotify"),C=t.loginMethods.includes("instagram"),f=t.loginMethods.includes("tiktok"),y=t.loginMethods.includes("github"),g=t.loginMethods.includes("linkedin"),b=t.loginMethods.includes("apple"),T=t.loginMethods.includes("farcaster"),k=t.loginMethods.includes("telegram")):(n=e.emailAuth,i=e.smsAuth,l=e.walletAuth,s=e.googleOAuth,c=e.twitterOAuth,m=e.discordOAuth,y=e.githubOAuth,u=e.spotifyOAuth,C=e.instagramOAuth,f=e.tiktokOAuth,g=e.linkedinOAuth,b=e.appleOAuth,T=e.farcasterAuth,k=e.telegramAuth),typeof window<"u"&&typeof window.PublicKeyCredential!="function"?a=!1:e.passkeyAuth&&(a=!0);let S=[n,i].filter(Boolean),x=[s,c,m,y,u,C,f,g,b,T,k].filter(Boolean),R=[l].filter(Boolean);if(S.length+x.length+R.length===0)throw new Error("You must enable at least one login method");let I=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;I&&R.length===0?(o("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),I=!1):!I&&x.length+S.length===0&&(o("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),I=!0);let D=t?.externalWallets?.walletConnect?.enabled??!0;t?.loginMethods&&t.loginMethodsAndOrder&&o("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let H=sf({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),K=of({input:t?.loginMethodsAndOrder}),j=t?.intl?.defaultCountry??"US",{chains:O,defaultChain:U}=_3({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),W=!!t?.defaultChain,Ce=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,Ie,Y=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?Ce?Ie=t?.embeddedWallets?.noPromptOnSignature??!0:Ie=t?.embeddedWallets?.noPromptOnSignature??Y:Ie=Y,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&Ie!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");let{requireUserPasswordOnCreate:X,...te}=t?.embeddedWallets??{};return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,legacyWalletUiConfig:e.legacyWalletUiConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,landingHeader:t?.appearance?.landingHeader??Ot.appearance.landingHeader,loginMessage:typeof t?.appearance?.loginMessage=="string"?t?.appearance?.loginMessage.slice(0,100):t?.appearance?.loginMessage,palette:Ff({backgroundTheme:t?.appearance?.theme??Ot.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??Ot.appearance.accentColor}),loginGroupPriority:I?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:H},loginMethods:{wallet:l,email:n,sms:i,passkey:a,google:s,twitter:c,discord:m,github:y,spotify:u,instagram:C,tiktok:f,linkedin:g,apple:b,farcaster:T,telegram:k},loginMethodsAndOrder:K,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??Ot.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??Ot.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??Ot.rpcConfig.rpcTimeouts},chains:O,defaultChain:U,intl:{defaultCountry:j},shouldEnforceDefaultChainOnConnect:W,captchaEnabled:e.captchaEnabled??Ot.captchaEnabled,captchaSiteKey:e.captchaSiteKey,externalWallets:{coinbaseWallet:{connectionOptions:t?.externalWallets?.coinbaseWallet?.connectionOptions??Ot.externalWallets.coinbaseWallet.connectionOptions},walletConnect:{enabled:D}},embeddedWallets:{...e.embeddedWalletConfig,...typeof X=="boolean"?{requireUserOwnedRecoveryOnCreate:X}:{},...Ce?{createOnLogin:"all-users",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...te,noPromptOnSignature:Ie},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:Ce?{enabled:!0,...t.customAuth}:void 0,loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1,telegramAuthConfiguration:e.telegramAuthConfiguration},headless:!!t?.headless,render:{standalone:t?._render?.standalone??Ot._render.standalone},fundingConfig:e.fundingConfig,fundingMethodConfig:{...t?.fundingMethodConfig??Ot.fundingMethodConfig,moonpay:{...t?.fundingMethodConfig?.moonpay??Ot.fundingMethodConfig.moonpay,useSandbox:t?.fundingMethodConfig?.moonpay.useSandbox??t?.fiatOnRamp?.useSandbox??Ot.fundingMethodConfig.moonpay.useSandbox}}}}function Bf(e,t){if(!e)return{legacyCreateEmbeddedWalletFlag:t};let{appearance:r,additionalChains:o,supportedChains:n,defaultChain:i,...a}=e;return{...a,...o?{additionalChains:o.map(s=>s.id)}:void 0,...n?{supportedChains:n.map(s=>s.id)}:void 0,...i?{defaultChain:i.id}:void 0,legacyCreateEmbeddedWalletFlag:t}}function _3({additionalChains:e,supportedChains:t,defaultChainFromConfig:r,hasRpcConfigDefined:o}){let n;if(e&&t&&console.warn("You should only specify one of `additionalChains` or `supportedChains`. Using `supportedChains`."),t){if(t.length===0)throw new Error("`supportedChains` must contain at least one chain");t.filter(s=>s.rpcUrls.privyWalletOverride).length>0&&o&&console.warn("You have specified at least one `supportedChain` with `privyWalletOverride` but also have `rpcConfig` defined. The `rpcConfig` will be ignored. `rpcConfig` is deprecated and you should use `privyWalletOverride` in a `supportedChain`."),n=t.map(s=>s.rpcUrls.privyWalletOverride?s:fa.find(m=>m.id===s.id)??s)}else n=fa.concat(e??[]);let i=t?n[0]:il,a=r??i;if(!n.find(l=>l.id===a.id))throw new Error("`defaultChain` must be included in `supportedChains`");return{chains:n,defaultChain:a}}var Hf=function(e,t=0){let r=3735928559^t,o=1103547991^t;for(let n=0,i;n<e.length;n++)i=e.charCodeAt(n),r=Math.imul(r^i,2654435761),o=Math.imul(o^i,1597334677);return r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(o^o>>>13,3266489909),o=Math.imul(o^o>>>16,2246822507),o^=Math.imul(r^r>>>13,3266489909),4294967296*(2097151&o)+(r>>>0)};import{jsx as k3}from"react/jsx-runtime";var qf={showWalletLoginFirst:!0,allowlistConfig:{errorTitle:null,errorDetail:null,errorCtaText:null,errorCtaLink:null},walletAuth:!0,emailAuth:!0,smsAuth:!1,googleOAuth:!1,twitterOAuth:!1,discordOAuth:!1,githubOAuth:!1,linkedinOAuth:!1,appleOAuth:!1,termsAndConditionsUrl:null,privacyPolicyUrl:null,embeddedWalletConfig:{createOnLogin:"off",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]},fiatOnRampEnabled:!1,captchaEnabled:!1,captchaSiteKey:""},Pd=_d(qf,void 0,!1),Ad=x3({appConfig:Pd,isServerConfigLoaded:!1}),zf=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,i]=A3(null),a=P3(()=>_d(n??qf,o,!!n),[n,o]);return Gf(()=>{if(!n)return;let l=Bf(o,t),s=Hf(JSON.stringify(l)).toString(),c=`privy:sent:${n.id}:${s}`;localStorage.getItem(c)||(r.createAnalyticsEvent({eventName:"sdk_initialize",payload:l}),localStorage.setItem(c,"t"))},[o,t,n]),Gf(()=>{n||(async()=>{try{let s=await r.getServerConfig();s.customApiUrl&&r.updateApiUrl(s.customApiUrl),i(s)}catch(s){console.warn("Error generating app config: ",s)}})()},[]),k3(Ad.Provider,{value:{appConfig:a,isServerConfigLoaded:!!n},children:e})},Ve=()=>{let{appConfig:e}=Vf(Ad);return e},al=()=>{let{isServerConfigLoaded:e}=Vf(Ad);return e};var E=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import{jsx as L3,jsxs as N3}from"react/jsx-runtime";var $f=R3({ready:!1,app:Pd,currentScreen:null,lastScreen:null,navigate:E,navigateBack:E,resetNavigation:E,setModalData:E,onUserCloseViaDialogOrKeybindRef:void 0}),O3=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],Kf=e=>{let t=Ve(),r=e.authenticated,[o,n]=W3(e.initialScreen);xd(()=>{!r&&!O3.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let i=M3(null);xd(()=>{e.open||(i.current=null)},[e.open]),xd(()=>{i.current=null},[e.initialScreen]);let a={ready:!!t.id,app:t,data:e.data,setModalData:e.setModalData,currentScreen:e.initialScreen,lastScreen:o,navigate:(l,s=!0)=>{e.setInitialScreen(l),s&&n(e.initialScreen)},navigateBack:()=>{e.setInitialScreen(o)},resetNavigation:()=>{e.setInitialScreen(null),n(null)},onUserCloseViaDialogOrKeybindRef:i};return N3($f.Provider,{value:a,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&L3(rf,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},_=()=>I3($f);import{jsx as yi,jsxs as D3}from"react/jsx-runtime";var ha=({style:e,...t})=>{let{app:r}=_();return D3("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[yi("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),yi("g",{clipPath:"url(#clip0_1765_9946)",children:yi("path",{d:"M8.09448 10.3941C11.3558 7.20196 16.6442 7.20196 19.9055 10.3941L20.2982 10.7782C20.3369 10.8157 20.3677 10.8606 20.3887 10.9102C20.4097 10.9599 20.4206 11.0132 20.4206 11.0671C20.4206 11.121 20.4097 11.1744 20.3887 11.224C20.3677 11.2737 20.3369 11.3186 20.2982 11.3561L18.9554 12.6702C18.9158 12.7086 18.8628 12.7301 18.8077 12.7301C18.7526 12.7301 18.6996 12.7086 18.66 12.6702L18.1198 12.1415C15.8448 9.91503 12.1557 9.91503 9.88015 12.1415L9.30167 12.7075C9.26207 12.7459 9.20909 12.7673 9.15395 12.7673C9.0988 12.7673 9.04582 12.7459 9.00622 12.7075L7.66346 11.3934C7.62475 11.3559 7.59397 11.3109 7.57295 11.2613C7.55193 11.2117 7.5411 11.1583 7.5411 11.1044C7.5411 11.0505 7.55193 10.9971 7.57295 10.9475C7.59397 10.8979 7.62475 10.8529 7.66346 10.8154L8.09448 10.3941ZM22.6829 13.1115L23.8776 14.2814C23.9163 14.319 23.9471 14.3639 23.9681 14.4135C23.9892 14.4632 24 14.5165 24 14.5704C24 14.6243 23.9892 14.6777 23.9681 14.7273C23.9471 14.777 23.9163 14.8219 23.8776 14.8594L18.4893 20.1332C18.4102 20.2101 18.3042 20.2531 18.1938 20.2531C18.0835 20.2531 17.9775 20.2101 17.8984 20.1332L14.0743 16.3901C14.0545 16.3708 14.0279 16.36 14.0003 16.36C13.9726 16.36 13.9461 16.3708 13.9263 16.3901L10.1021 20.1332C10.023 20.2101 9.91703 20.2531 9.8067 20.2531C9.69636 20.2531 9.59038 20.2101 9.51124 20.1332L4.12236 14.8594C4.08365 14.8219 4.05287 14.777 4.03185 14.7273C4.01083 14.6777 4 14.6243 4 14.5704C4 14.5165 4.01083 14.4632 4.03185 14.4135C4.05287 14.3639 4.08365 14.319 4.12236 14.2814L5.31767 13.1115C5.39678 13.0348 5.50265 12.9919 5.61285 12.9919C5.72305 12.9919 5.82892 13.0348 5.90803 13.1115L9.73216 16.8546C9.75194 16.874 9.7785 16.8848 9.80616 16.8848C9.83381 16.8848 9.86037 16.874 9.88015 16.8546L13.7043 13.1115C13.7834 13.0346 13.8894 12.9916 13.9997 12.9916C14.1101 12.9916 14.216 13.0346 14.2952 13.1115L18.1198 16.8546C18.1396 16.874 18.1662 16.8848 18.1938 16.8848C18.2215 16.8848 18.2481 16.874 18.2678 16.8546L22.092 13.1115C22.1711 13.0346 22.2771 12.9916 22.3874 12.9916C22.4977 12.9916 22.6037 13.0346 22.6829 13.1115Z",fill:"white"})}),yi("defs",{children:yi("clipPath",{id:"clip0_1765_9946",children:yi("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var Dr=class extends $t{constructor(r,o,n,i,a,l,s,c){super(c||"unknown",n,i,o);this.connectorType="wallet_connect_v2";this.privyAppId=l,this.privyAppName=s,this.walletConnectCloudProjectId=r,this.rpcConfig=o,this.shouldEnforceDefaultChainOnConnect=a,this.proxyProvider=new je(void 0,this.rpcTimeoutDuration),c&&(this.walletEntry=Is[c],this.walletClientType=c)}async initialize(){let r=await this.createProvider();if(this.provider=r,this.proxyProvider.setWalletProvider(r),this.subscribeListeners(),r.session){if(this.walletProvider?.session?.peer.metadata.url){let n=Rs(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=n?.entry,this.walletClientType=n?.walletClientType||"unknown"}this.connected=!0,await this.syncAccounts()}this.initialized=!0,this.emit("initialized");let{WalletConnectModal:o}=await import("@walletconnect/modal");this.modal=new o({projectId:this.walletConnectCloudProjectId,themeVariables:{"--wcm-z-index":"1000000"}}),this.modal.subscribeModal(n=>{!n.open&&!this.walletProvider?.session&&this.onQrModalClosed&&this.onQrModalClosed()})}async connect(r){return r.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return!!this.walletProvider?.connected}get walletBranding(){return this.walletClientType==="metamask"?{name:"MetaMask",icon:ui,id:"io.metamask"}:{name:um(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||ha,id:this.walletProvider?.session?.peer.metadata.name.toLowerCase()||"wallet_connect_v2"}}async resetConnection(r){this.walletProvider&&this.walletProvider.connected&&(await this.walletProvider.disconnect(),this.walletProvider.signer.session=void 0,this.walletEntry=Is[r],this.walletClientType=r,this.redirectUri=void 0,this.fallbackUniversalRedirectUri=void 0,wm(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new ci)};this.onQrModalClosed=n,(async()=>{let a="",l=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(l?.length&&(a=l[0]),!a||a==="")throw new ce("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let s=Rs(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=di(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),r()})().catch(a=>{if(a){o(Lr(a));return}o(new ce("Unknown error during connection"))}).finally(()=>this.modal?.closeModal())})}disconnect(){this.walletProvider?.disconnect().then(()=>this.onDisconnect()).catch(()=>console.warn("Unable to disconnect Wallet Connect provider"))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(r){this.proxyProvider.setWalletProvider(r)}async createProvider(){let r={};for(let a of this.chains){let l=fm(a.id,this.chains,this.rpcConfig,this.privyAppId);l&&(r[a.id]=l)}let o=this.shouldEnforceDefaultChainOnConnect?[this.defaultChain.id]:[],n=this.chains.map(a=>a.id),i=await U3.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:F3,optionalMethods:B3,rpcMap:r,showQrModal:!1,metadata:{description:this.privyAppName,name:this.privyAppName,url:window.location.toString(),icons:[]}});return i.on("display_uri",a=>{if(i.signer.abortPairingAttempt(),H3&&this.walletEntry){let{redirect:l,href:s}=gm(a,this.walletEntry);bm({href:s,name:this.walletEntry.displayName}),this.redirectUri=l;let c=vm(a,this.walletEntry);c?.redirect&&(this.fallbackUniversalRedirectUri=c.redirect),Ms(l,"_self")}else this.modal?.openModal({uri:a,chains:[this.defaultChain.id]})}),i.on("connect",()=>{if(this.modal?.closeModal(),i.session?.peer.metadata.url){let a=Rs(i.session?.peer.metadata.url);this.walletEntry=a?.entry,this.walletClientType=a?.walletClientType||"unknown"}}),i}async enableProvider(){return this.walletProvider?.connected?Promise.resolve(this.walletProvider.accounts):await this.walletProvider?.enable()}};var Rd=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses")?.split(" ").filter(o=>G3(o)).map(o=>jf(o));return t?.length?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&t.includes(o.address)).length:!1},di=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||Tn:Tn,ya=class extends V3{constructor(r,o,n,i,a,l,s,c,m,f,u){super();this.getEthereumProvider=()=>{let r=this.wallets[0],o=this.walletConnectors.find(n=>n.wallets.find(i=>i.address===r?.address));return!r||!o?new je:o.proxyProvider};this.privyAppId=r,this.walletConnectCloudProjectId=o,this.rpcConfig=n,this.chains=i,this.defaultChain=a,this.walletConnectors=[],this.initialized=!1,this.store=l,this.walletList=s,this.shouldEnforceDefaultChainOnConnect=c,this.externalWalletConfig=m,this.privyAppName=f,this.privyAppLogo=u,this.storedConnections=kd()}get wallets(){let r=new Set,o=this.walletConnectors.flatMap(i=>i.wallets).sort((i,a)=>i.connectedAt&&a.connectedAt?a.connectedAt-i.connectedAt:0).filter(i=>{let a=`${i.address}${i.walletClientType}${i.connectorType}`;return r.has(a)?!1:(r.add(a),!0)}),n=o.findIndex(i=>i.address===(this.activeWallet?this.activeWallet:"unknown"));return n>=0&&o.unshift(o.splice(n,1)[0]),o}async initialize(){if(this.initialized)return;Q.get(vd)&&(Q.getKeys().forEach(o=>{o.startsWith("walletconnect")&&Q.del(o)}),Q.del(vd));let r=mm(this.store,this.walletList,this.externalWalletConfig).then(o=>{o.forEach(({type:n,eip6963InjectedProvider:i,legacyInjectedProvider:a})=>{this.createWalletConnector("injected",n,{eip6963InjectedProvider:i,legacyInjectedProvider:a})})});this.walletList.includes("coinbase_wallet")&&this.createWalletConnector("coinbase_wallet","coinbase_wallet"),!No()&&this.walletList.includes("phantom")&&this.createWalletConnector("phantom","phantom"),this.externalWalletConfig.walletConnect.enabled&&this.createWalletConnector("wallet_connect_v2","unknown"),await r,this.initialized=!0}findWalletConnector(r,o){return r==="wallet_connect_v2"?this.walletConnectors.find(n=>n.connectorType===r)??null:this.walletConnectors.find(n=>n.connectorType===r&&n.walletClientType===o)??null}onInitialized(r){r.wallets.forEach(o=>{let n=this.storedConnections.find(i=>i.address===o.address&&i.connectorType===o.connectorType&&i.walletClientType===o.walletClientType);n&&(o.connectedAt=n.connectedAt)}),this.saveConnectionHistory(),this.emit("walletsUpdated"),this.emit("connectorInitialized")}onWalletsUpdated(r){r.initialized&&(this.saveConnectionHistory(),this.emit("walletsUpdated"))}addEmbeddedWalletConnector(r,o,n,i){let a=this.findWalletConnector("embedded","privy");if(a)a.proxyProvider.walletProxy=r;else{let l=new ua(r,o,this.rpcConfig,this.chains,i,n.id),s=new ma(l,this.chains,n,this.rpcConfig);this.addWalletConnector(s)}}addImportedWalletConnector(r,o,n,i){let a=this.findWalletConnector("embedded_imported","privy");if(a)a.proxyProvider.walletProxy=r;else{let l=new ua(r,o,this.rpcConfig,this.chains,i,n.id),s=!0,c=new ma(l,this.chains,n,this.rpcConfig,s);this.addWalletConnector(c)}}removeEmbeddedWalletConnector(){let r=this.findWalletConnector("embedded","privy");if(r){let o=this.walletConnectors.indexOf(r);this.walletConnectors.splice(o,1),this.saveConnectionHistory(),this.storedConnections=kd(),this.emit("walletsUpdated")}}removeImportedWalletConnector(){let r=this.findWalletConnector("embedded_imported","privy");if(r){let o=this.walletConnectors.indexOf(r);this.walletConnectors.splice(o,1),this.saveConnectionHistory(),this.storedConnections=kd(),this.emit("walletsUpdated")}}async createWalletConnector(r,o,n){let i=this.findWalletConnector(r,o);if(i)return i instanceof Dr&&i.resetConnection(o),i;let l=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new rl(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new hi(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new hi(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new hi(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new fi(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,o)}else return r==="coinbase_wallet"?new tl(this.chains,this.defaultChain,this.rpcConfig,this.externalWalletConfig,this.privyAppName,this.privyAppLogo):r==="phantom"?new nl(this.defaultChain):new Dr(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain,this.shouldEnforceDefaultChainOnConnect,this.privyAppId,this.privyAppName,o)})();return l&&this.addWalletConnector(l),l||null}addWalletConnector(r){this.walletConnectors.push(r),r.on("initialized",()=>this.onInitialized(r)),r.on("walletsUpdated",()=>this.onWalletsUpdated(r)),r.initialize().catch(o=>{console.debug("Failed to initialize connector",o)})}saveConnectionHistory(){let r=this.wallets.map(o=>({address:o.address,connectorType:o.connectorType,walletClientType:o.walletClientType,connectedAt:o.connectedAt}));Q.put(Cd,r)}async activeWalletSign(r){let o=this.wallets,n=o.length>0?o[0]:null;return n?n.sign(r):null}setActiveWallet(r){this.activeWallet=jf(r),this.emit("walletsUpdated")}};function el(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){let o=e[r],n=t[r];if(o?.address!==n?.address||o?.chainId!==n?.chainId||o?.connectorType!==n?.connectorType||o?.connectedAt!==n?.connectedAt||o?.walletClientType!==n?.walletClientType||o?.isConnected!==n?.isConnected||o?.linked!==n?.linked)return!1}return!0}var q3=e=>e&&typeof e.address=="string"&&typeof e.connectorType=="string"&&typeof e.walletClientType=="string"&&typeof e.connectedAt=="number",kd=()=>{let e=Q.get(Cd);return e&&Array.isArray(e)&&e.map(o=>q3(o)).every(Boolean)?e:[]};import{ofetch as z3}from"ofetch";var $3=[vs,ws,Cs,Ts],sl=class{constructor({appId:t,appClientId:r,client:o,defaults:n}){this.appId=t,this.appClientId=r,this.clientAnalyticsId=o.clientAnalyticsId,this.sdkVersion=fd,this.client=o,this.defaults=n,this.fallbackApiUrl=o.fallbackApiUrl,this.baseFetch=z3.create({baseURL:this.defaults.baseURL,timeout:this.defaults.timeout,retry:3,retryDelay:500,retryStatusCodes:[408,409,425,500,502,503,504],credentials:"include",onRequest:async({request:i,options:a})=>{let l=new Headers(a.headers);l.set("privy-app-id",this.appId),this.appClientId&&l.set("privy-client-id",this.appClientId),l.set("privy-ca-id",this.clientAnalyticsId||""),l.set("privy-client",`react-auth:${this.sdkVersion}`);let s=$3.includes(i.toString());if(!l.has("authorization")){let c=await this.client.getAccessToken({disableAutoRefresh:s});c!==null&&l.set("authorization",`Bearer ${c}`)}a.headers=l,a.retryDelay&&(a.retryDelay=a.retryDelay*3)},onRequestError:({error:i})=>{if(i instanceof DOMException&&i.name==="AbortError")throw new ys}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw le(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw le(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw le(o)}}};var Yf=e=>({challenge:e.challenge,allowCredentials:e.allow_credentials?.map(t=>({id:t.id,type:t.type,transports:t.transports}))||[],timeout:e.timeout,extensions:{appid:e.extensions?.app_id,credProps:e.extensions?.cred_props,hmacCreateSecret:e.extensions?.hmac_create_secret},userVerification:e.user_verification});import Ho from"js-cookie";function Zf(e){return e instanceof Lo?"email":e instanceof Do?"sms":e instanceof To?"siwe":e instanceof ri?"custom_auth":e instanceof Jr?e.meta.provider:null}import*as Qf from"jose";var _r=class{static parse(t){try{return new _r(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Qf.decodeJwt(t)}get subject(){return this._decoded.sub}get expiration(){return this._decoded.exp}get issuer(){return this._decoded.iss}get audience(){return this._decoded.aud}isExpired(t=0){let r=Date.now(),o=(this.expiration-t)*1e3;return r>=o}};var K3=30,ll=class{constructor(){this.authenticateOnce=new Le(async t=>this._authenticate(t)),this.linkOnce=new Le(async t=>this._link(t)),this.refreshOnce=new Le(this._refresh.bind(this)),this.destroyOnce=new Le(this._destroy.bind(this)),this.forkSessionOnce=new Le(this._forkSession.bind(this))}get token(){try{let t=Q.get(Cn);return typeof t=="string"?new _r(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=Q.get(Ls);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=Q.get(aa);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}getProviderAccessToken(t){try{let r=Q.get(la(t));if(typeof r=="string"){let o=new _r(r);return o.isExpired()?(Q.del(la(t)),null):o.value}else return null}catch(r){return console.error(r),null}}get mightHaveServerCookies(){try{let t=Ho.get(Ns);return t!==void 0&&t.length>0}catch(t){console.error(t)}return!1}hasRefreshCredentials(){return this.mightHaveServerCookies||typeof this.token=="string"&&typeof this.refreshToken=="string"&&this.refreshToken!==Mm}hasRecoveryCredentials(){return typeof this.forkedToken=="string"}hasActiveToken(){let t=_r.parse(this.token);return t!==null&&!t.isExpired(K3)}authenticate(t){return this.authenticateOnce.execute(t)}link(t){return this.linkOnce.execute(t)}refresh(){return this.refreshOnce.execute()}forkSession(){return this.forkSessionOnce.execute()}destroy(){return this.destroyOnce.execute()}storeProviderAccessToken(t,r){typeof r=="string"?Q.put(la(t),r):Q.del(la(t))}async _authenticate(t){try{let r=await t.authenticate(),{user:o,is_new_user:n,oauth_tokens:i}=r;this.handleTokenResponse(r);let a=i,l=a?{provider:a.provider,accessToken:a.access_token,accessTokenExpiresInSeconds:a.access_token_expires_in_seconds,refreshToken:a.refresh_token,refreshTokenExpiresInSeconds:i.refresh_token_expires_in_seconds,scopes:a.scopes}:void 0,s=Zf(t);return s&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate",payload:{method:s,isNewUser:n}}),s==="siwe"&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate_siwe",payload:{connectorType:t.meta.connectorType,walletClientType:t.meta.walletClientType}}),{user:zt(o),isNewUser:n,oAuthTokens:l}}catch(r){throw console.warn("Error authenticating session"),tt(r)}}async _link(t){try{let r=await t.link(),o=r.oauth_tokens,n=o?{provider:o.provider,accessToken:o.access_token,accessTokenExpiresInSeconds:o.access_token_expires_in_seconds,refreshToken:o.refresh_token,refreshTokenExpiresInSeconds:o.refresh_token_expires_in_seconds,scopes:o.scopes}:void 0;return{user:zt(r),oAuthTokens:n}}catch(r){throw console.warn("Error linking account"),tt(r)}}async _refresh(){if(!this.api)throw new w("Session has no API instance");if(!this.client)throw new w("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let t=this.token,r=this.refreshToken,o=this.forkedToken;if(this.client.useServerCookies&&!this.mightHaveServerCookies&&this.token&&window.location.origin===this.client.apiUrl)return this.destroyLocalState(),null;try{let n;if(t&&r||this.mightHaveServerCookies){let i={};t&&(i.authorization=`Bearer ${t}`);let a=r?{refresh_token:r}:{};n=await this.api.post(vs,a,{headers:i}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(ws,{refresh_token:o}),this.clearForkedToken();else return null;return this.handleTokenResponse(n),zt(n.user)}catch(n){if(n instanceof Mt&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw tt(n)}}handleTokenResponse(t){t.session_update_action?t.session_update_action==="set"?(this.storeRefreshToken(t.refresh_token),this.storeToken(t.token),t.identity_token&&this.storeIdentityToken(t.identity_token)):t.session_update_action==="clear"?this.destroyLocalState():t.session_update_action==="ignore"&&t.token&&(this.storeToken(t.token),t.identity_token&&this.storeIdentityToken(t.identity_token)):(this.storeRefreshToken(t.refresh_token),this.storeToken(t.token),t.identity_token&&this.storeIdentityToken(t.identity_token))}async _destroy(){try{await this.api?.post(Cs,{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new w("Session has no API instance");let t=this.refreshToken;try{let r=await this.api.post(Eu,{refresh_token:t});return this.storeRefreshToken(r.refresh_token),this.storeToken(r.token),r.new_session_refresh_token}catch(r){throw tt(r)}}destroyLocalState(){this.storeRefreshToken(null),this.storeToken(null),this.clearIdentityToken(),this.clearForkedToken()}storeToken(t){if(typeof t=="string"){let r=Q.get(Cn);if(Q.put(Cn,t),!this.client?.useServerCookies){let o=_r.parse(t)?.expiration;Ho.set(hd,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}r!==t&&this.client?.onStoreToken?.(t)}else Q.del(Cn),Ho.remove(hd),this.client?.onDeleteToken?.()}storeRefreshToken(t){typeof t=="string"?(Q.put(Ls,t),this.client?.useServerCookies||Ho.set(Ns,"t",{sameSite:"Strict",secure:!0,expires:30})):(Q.del(Ls),Ho.remove(Am),Ho.remove(Ns))}storeIdentityToken(t){if(this.client?.useServerCookies)return;Q.put(yd,t);let r=_r.parse(t)?.expiration;Ho.set(gd,t,{sameSite:"Strict",secure:!0,expires:r?new Date(r*1e3):void 0})}clearIdentityToken(){Q.del(yd),Ho.remove(gd)}clearForkedToken(){Q.del(aa)}};var Id,cl,Jf,ga=class{constructor(t){hs(this,cl);this.apiUrl=t.apiUrl||Ws,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!!t.apiUrl&&t.apiUrl.startsWith("https://privy."),this.timeout=t.timeout||Pm,this.appId=t.appId,this.appClientId=t.appClientId,this.clientAnalyticsId=bu(this,cl,Jf).call(this),Id||(Id=new ll),this.session=Id,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager({walletConnectCloudProjectId:t,rpcConfig:r,chains:o,defaultChain:n,store:i,walletList:a,shouldEnforceDefaultChainOnConnect:l,externalWalletConfig:s,appName:c}){this.connectors||(this.connectors=new ya(this.appId,t,r,o,n,i,a,l,s,c))}sessionHasActiveToken(){return this.session.hasActiveToken()}generateApi(){let t=new sl({appId:this.appId,appClientId:this.appClientId,client:this,defaults:{baseURL:this.apiUrl,timeout:this.timeout}});return this.session.api=t,t}updateApiUrl(t){this.apiUrl=t||this.fallbackApiUrl,this.api=this.generateApi(),t&&(this.useServerCookies=!0)}authenticate(){if(!this.authFlow)throw new w("No auth flow in progress.");return this.session.authenticate(this.authFlow)}async link(){if(!this.authFlow)throw new w("No auth flow in progress.");let{oAuthTokens:t}=await this.session.link(this.authFlow);return{user:await this.getAuthenticatedUser(),oAuthTokens:t}}storeProviderAccessToken(t,r){this.session.storeProviderAccessToken(t,r)}getProviderAccessToken(t){return this.session.getProviderAccessToken(t)}async logout(){await this.session.destroy(),this.authFlow=void 0}clearProviderAcccessTokens(t){t.linkedAccounts.filter(o=>o.type==="cross_app").forEach(o=>{this.storeProviderAccessToken(o.providerApp.id,null)})}startAuthFlow(t){return t.api=this.api,this.authFlow=t,this.authFlow}async initMfaSmsVerification(){try{await this.api.post(tm,{action:"verify"})}catch(t){throw le(t)}}async initMfaPasskeyVerification(){try{let t=await this.api.post(rm,{});return Yf(t.options)}catch(t){throw le(t)}}async acceptTerms(){try{let t=await this.api.post(om,{});return zt(t)}catch(t){throw tt(t)}}async unlinkEmail(t){try{let r=await this.api.post(Lu,{address:t});return await this.getAuthenticatedUser()??zt(r)}catch(r){throw tt(r)}}async unlinkPhone(t){try{let r=await this.api.post(Fu,{phoneNumber:t});return await this.getAuthenticatedUser()??zt(r)}catch(r){throw tt(r)}}async unlinkWallet(t){try{let r=await this.api.post(Pu,{address:t});return await this.getAuthenticatedUser()??zt(r)}catch(r){throw tt(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(Vu,{provider:t,subject:r});return await this.getAuthenticatedUser()??zt(o)}catch(o){throw tt(o)}}async unlinkFarcaster(t){try{let r=await this.api.post(Iu,{fid:t});return await this.getAuthenticatedUser()??zt(r)}catch(r){throw tt(r)}}async unlinkTelegram(t){try{let r=await this.api.post(em,{telegram_user_id:t});return await this.getAuthenticatedUser()??zt(r)}catch(r){throw tt(r)}}async unlinkPasskey(t){try{let r=await this.api.post(Qu,{credential_id:t});return await this.getAuthenticatedUser()??zt(r)}catch(r){throw tt(r)}}async createAnalyticsEvent({eventName:t,payload:r,timestamp:o,options:n}){if(!(typeof window>"u"))try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(Ts,{event_name:t,client_id:this.clientAnalyticsId,payload:{...r||{},clientTimestamp:o?o.toISOString():new Date().toISOString()}},{retry:-1,keepalive:n?.keepAlive??!1})}catch{}}async signMoonpayOnRampUrl(t){try{return this.api.post(im,t)}catch(r){throw tt(r)}}async initCoinbaseOnRamp(t){try{return this.api.post(am,t)}catch(r){throw tt(r)}}async getCoinbaseOnRampStatus({partnerUserId:t}){try{return this.api.get(`${sm}?partnerUserId=${t}`)}catch(r){throw tt(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?_r.parse(this.session.token)?.audience!==this.appId?(await this.logout(),null):this.session.token:!t?.disableAutoRefresh&&this.session.hasRefreshCredentials()?(await this.session.refresh(),this.session.token):null}async getServerConfig(){try{let t={},r=this.session.token;r&&(t.authorization=`Bearer ${r}`);let o=await this.api.get(`/api/v1/apps/${this.appId}`,{baseURL:this.fallbackApiUrl,headers:t}),n=o.telegram_auth_config?{botId:o.telegram_auth_config.bot_id,botName:o.telegram_auth_config.bot_name,linkEnabled:o.telegram_auth_config.link_enabled,seamlessAuthEnabled:o.telegram_auth_config.seamless_auth_enabled}:void 0,i=o.funding_config?{methods:o.funding_config.methods,defaultRecommendedAmount:o.funding_config.default_recommended_amount,defaultRecommendedCurrency:o.funding_config.default_recommended_currency,promptFundingOnWalletCreation:o.funding_config.prompt_funding_on_wallet_creation}:void 0;return{id:o.id,name:o.name,verificationKey:o.verification_key,logoUrl:o.logo_url||void 0,accentColor:o.accent_color||void 0,showWalletLoginFirst:o.show_wallet_login_first,allowlistConfig:{errorTitle:o.allowlist_config.error_title,errorDetail:o.allowlist_config.error_detail,errorCtaText:o.allowlist_config.cta_text,errorCtaLink:o.allowlist_config.cta_link},walletAuth:o.wallet_auth,emailAuth:o.email_auth,smsAuth:o.sms_auth,googleOAuth:o.google_oauth,twitterOAuth:o.twitter_oauth,discordOAuth:o.discord_oauth,githubOAuth:o.github_oauth,spotifyOAuth:o.spotify_oauth,instagramOAuth:o.instagram_oauth,tiktokOAuth:o.tiktok_oauth,linkedinOAuth:o.linkedin_oauth,appleOAuth:o.apple_oauth,farcasterAuth:o.farcaster_auth,passkeyAuth:o.passkey_auth,telegramAuth:o.telegram_auth,termsAndConditionsUrl:o.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:o.embedded_wallet_config?.create_on_login,userOwnedRecoveryOptions:o.embedded_wallet_config.user_owned_recovery_options,requireUserOwnedRecoveryOnCreate:o.embedded_wallet_config.require_user_owned_recovery_on_create},privacyPolicyUrl:o.privacy_policy_url,requireUsersAcceptTerms:o.require_users_accept_terms,customApiUrl:o.custom_api_url,walletConnectCloudProjectId:o.wallet_connect_cloud_project_id,fiatOnRampEnabled:o.fiat_on_ramp_enabled,captchaEnabled:o.captcha_enabled,captchaSiteKey:o.captcha_site_key,twitterOAuthOnMobileEnabled:o.twitter_oauth_on_mobile_enabled,createdAt:new Date(o.created_at*1e3),updatedAt:new Date(o.updated_at*1e3),mfaMethods:o.mfa_methods,enforceWalletUis:o.enforce_wallet_uis,legacyWalletUiConfig:o.legacy_wallet_ui_config,telegramAuthConfiguration:n,fundingConfig:i}}catch(t){throw tt(t)}}async getUsdTokenPrice(t){try{return(await this.api.get(`/api/v1/token_price?chainId=${t.id}&tokenSymbol=${t.nativeCurrency.symbol}`)).usd}catch{console.error(`Unable to fetch token price for chain with id ${t.id}`);return}}async requestFarcasterSignerStatus(t){try{return await this.api.post("/api/v1/farcaster/signer/status",{ed25519_public_key:t})}catch(r){throw console.error("Unable to fetch Farcaster signer status"),r}}async forkSession(){return await this.session.forkSession()}async generateSiweNonce({address:t,captchaToken:r}){try{return(await this.api.post(Tu,{address:t,token:r})).nonce}catch(o){throw tt(o)}}async authenticateWithSiweInternal({message:t,signature:r,chainId:o,walletClientType:n,connectorType:i}){return await this.api.post(Su,{message:t,signature:r,chainId:o,walletClientType:n,connectorType:i})}async linkWithSiweInternal({message:t,signature:r,chainId:o,walletClientType:n,connectorType:i}){return await this.api.post(_u,{message:t,signature:r,chainId:o,walletClientType:n,connectorType:i})}async linkWithSiwe({message:t,signature:r,chainId:o,walletClientType:n,connectorType:i}){try{let a=await this.linkWithSiweInternal({message:t,signature:r,chainId:o,walletClientType:n,connectorType:i});return zt(a)}catch(a){throw tt(a)}}};cl=new WeakSet,Jf=function(){if(typeof window>"u")return null;try{let r=Q.get(sa);if(typeof r=="string"&&r.length>0)return r}catch{}let t=j3();try{return Q.put(sa,t),t}catch{return t}};import{Turnstile as e0}from"@marsidev/react-turnstile";import{useEffect as t0,useMemo as r0}from"react";import{useMemo as Y3,useRef as Z3,useContext as Q3,useState as Md,createContext as J3}from"react";import{jsx as X3}from"react/jsx-runtime";var Xf=J3({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:E,setError:E,setExecuting:E,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:E,reset:E,execute:E}),ir=class extends et{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},eh=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=Z3(null),[i,a]=Md(),[l,s]=Md(),[c,m]=Md(!1),f=Y3(()=>o?!c&&!i&&!l?{status:"ready"}:c&&!i&&!l?{status:"loading"}:i&&!l?{status:"success",token:i}:l?{status:"error",error:l}:{status:"ready"}:{status:"disabled"},[o,i,l,c]);return X3(Xf.Provider,{value:{...f,ref:n,enabled:o,siteKey:r,appId:t,setToken:a,setError:s,setExecuting:m,remove(){o&&(n.current?.remove(),m(!1),s(void 0),a(void 0))},reset(){o&&(n.current?.reset(),m(!1),s(void 0),a(void 0))},execute(){o&&(m(!0),n.current?.execute())},async waitForResult(){if(!o)return"";try{return await pm(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new ir("Captcha failed",null,"captcha_timeout")}}},children:e})},be=()=>Q3(Xf);import{jsx as th}from"react/jsx-runtime";var Wd=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:i,setExecuting:a,ref:l}=be(),[,s]=r0(()=>r?.split("t:")||[],[r]);if(t0(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return th("div",{className:"hidden h-0 w-0",children:th(e0,{...e,ref:l,siteKey:s,options:{action:o,size:"invisible",...e.delayedExecution?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{e.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{e.onError?.(),n("Captcha failed"),a(!1)},onSuccess:c=>{e.onSuccess?.(c),i(c),a(!1)},onExpire:()=>{e.onExpire?.();try{l.current?.reset(),n(void 0),i(void 0)}catch{n("expired_and_failed_reset")}}})})};import{useCallback as jS,useEffect as Jv,useRef as YS,useState as ZS}from"react";import tC from"styled-components";import{createContext as o0,useContext as n0}from"react";var Od=o0({isNewUserThisSession:!1,linkingOrConnectingHint:null,walletConnectionStatus:null,connectors:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,appId:"notAdded",nativeTokenSymbolForChainId:E,initializeWalletProxy:E,getAuthMeta:E,getAuthFlow:E,closePrivyModal:E,openPrivyModal:E,connectWallet:E,initLoginWithWallet:E,loginWithWallet:E,initLoginWithFarcaster:E,loginWithFarcaster:E,loginWithCode:E,initLoginWithEmail:E,initLoginWithSms:E,initUpdateEmail:E,initUpdatePhone:E,resendEmailCode:E,resendSmsCode:E,initLoginWithHeadlessOAuth:E,loginWithHeadlessOAuth:E,crossAppAuthFlow:E,initLoginWithOAuth:E,recoveryOAuthFlow:E,loginWithOAuth:E,initLoginWithPasskey:E,loginWithPasskey:E,initLinkWithPasskey:E,linkWithPasskey:E,refreshUser:E,walletProxy:null,createAnalyticsEvent:E,acceptTerms:E,getUsdTokenPrice:E,recoverEmbeddedEthereumWallet:E,getMoonpaySignedUrl:E,initCoinbaseOnRamp:E,getCoinbaseOnRampStatus:E,updateWallets:E,fundWallet:E,setReadyToTrue:E,requestFarcasterSignerStatus:E,initLoginWithTelegram:E,loginWithTelegram:E,generateSiweMessage:E,linkWithSiwe:E,embeddedSolanaWallet:null,createEmbeddedSolanaWallet:E,recoverEmbeddedSolanaWallet:E,solanaSignMessage:E}),M=()=>n0(Od);import{createContext as i0,useContext as a0}from"react";var Se=i0({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:E,login:E,connectOrCreateWallet:E,linkEmail:E,linkPhone:E,linkFarcaster:E,linkWallet:E,linkCrossAppAccount:E,linkGoogle:E,linkTwitter:E,linkDiscord:E,linkGithub:E,linkSpotify:E,linkInstagram:E,linkTelegram:E,linkTiktok:E,linkLinkedIn:E,linkApple:E,linkPasskey:E,updateEmail:E,updatePhone:E,logout:E,getAccessToken:E,getEthereumProvider:E,getEthersProvider:E,getWeb3jsProvider:E,unlinkEmail:E,unlinkPhone:E,unlinkWallet:E,unlinkGoogle:E,unlinkTwitter:E,unlinkDiscord:E,unlinkGithub:E,unlinkSpotify:E,unlinkInstagram:E,unlinkTiktok:E,unlinkLinkedIn:E,unlinkApple:E,unlinkCrossAppAccount:E,unlinkFarcaster:E,unlinkTelegram:E,unlinkPasskey:E,setActiveWallet:E,forkSession:E,createWallet:E,importWallet:E,signMessage:E,signTypedData:E,enrollInMfa:E,initEnrollmentWithSms:E,initEnrollmentWithTotp:E,initEnrollmentWithPasskey:E,promptMfa:E,init:E,submitEnrollmentWithSms:E,submitEnrollmentWithTotp:E,submitEnrollmentWithPasskey:E,unenroll:E,submit:E,cancel:E,sendTransaction:E,exportWallet:E,setWalletPassword:E,setWalletRecovery:E,requestFarcasterSignerFromWarpcast:E,getFarcasterSignerPublicKey:E,signFarcasterMessage:E,initLoginWithEmail:E,initLoginWithSms:E,otpState:{status:"initial"},loginWithCode:E,fundWallet:E,initLoginWithHeadlessOAuth:E,loginWithHeadlessOAuth:E,generateSiweMessage:E,linkWithSiwe:E,signMessageWithCrossAppWallet:E,signTypedDataWithCrossAppWallet:E,sendTransactionWithCrossAppWallet:E,isHeadlessOAuthLoading:!1,isModalOpen:!1,mfaMethods:[]}),q=()=>a0(Se);import{useEffect as s0,useState as l0}from"react";var rh=e=>{let[t,r]=l0("auto");return s0(()=>{let o=new ResizeObserver(n=>{r(n[0]?.contentRect.height??"auto")});return e.current&&o.observe(e.current),()=>{e.current&&o.unobserve(e.current)}},[e.current]),t};import{createContext as c0,useContext as d0,useEffect as p0}from"react";var oh={login:{onComplete:[],onError:[],onOAuthLoginComplete:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]},linkAccount:{onSuccess:[],onError:[]},configureMfa:{onMfaRequired:[]},setWalletPassword:{onSuccess:[],onError:[]},setWalletRecovery:{onSuccess:[],onError:[]},signMessage:{onSuccess:[],onError:[]},signTypedData:{onSuccess:[],onError:[]},sendTransaction:{onSuccess:[],onError:[]},accessToken:{onAccessTokenGranted:[],onAccessTokenRemoved:[]},oAuthAuthorization:{onOAuthTokenGrant:[]},fundWallet:{onUserExited:[]}},Ld=c0(void 0),nh=()=>d0(Ld);function Ae(e,t){if(!t)return;let o=nh().current[e];return p0(()=>{for(let[n,i]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]?.push(i);return()=>{for(let[n,i]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]=o[n]?.filter(a=>a!==i)}},[t])}function F(e,t,r,...o){for(let n of e.current[t][r])n(...o)}function gi(){let e=nh();return(t,r,...o)=>F(e,t,r,...o)}function Nd(e){Ae("configureMfa",e)}import{QuestionMarkCircleIcon as W0}from"@heroicons/react/24/outline";import ph from"styled-components";import Rn,{css as ih}from"styled-components";import Ud from"styled-components";import{Fragment as m0,jsx as Dd,jsxs as f0}from"react/jsx-runtime";var nt=({success:e,fail:t})=>f0(m0,{children:[Dd(it,{className:e?"success":t?"fail":""}),Dd(va,{className:e?"success":t?"fail":""})]}),it=Ud.span`
13
13
  && {
14
14
  width: 82px;
15
15
  height: 82px;
@@ -42,13 +42,13 @@ Resources:
42
42
  border-color: var(--privy-color-error);
43
43
  border-bottom-color: var(--privy-color-error);
44
44
  }
45
- `,ga=Nd(nt)`
45
+ `,va=Ud(it)`
46
46
  && {
47
47
  border-bottom-color: ${e=>e.color??"var(--privy-color-accent)"};
48
48
  animation: none;
49
49
  opacity: 0.5;
50
50
  }
51
- `,ro=e=>Ld(s0,{color:e.color||"var(--privy-color-foreground-3)"}),s0=Nd(nt)`
51
+ `,ro=e=>Dd(u0,{color:e.color||"var(--privy-color-foreground-3)"}),u0=Ud(it)`
52
52
  && {
53
53
  height: 1rem;
54
54
  width: 1rem;
@@ -58,7 +58,7 @@ Resources:
58
58
  /* Override default Loader to match button transitions */
59
59
  transition: border-color 200ms ease;
60
60
  }
61
- `;import{jsx as Kt,jsxs as dl}from"react/jsx-runtime";var va=xn.button`
61
+ `;import{jsx as Kt,jsxs as ul}from"react/jsx-runtime";var Ca=Rn.button`
62
62
  display: flex;
63
63
  flex-direction: row;
64
64
  align-items: center;
@@ -80,7 +80,7 @@ Resources:
80
80
  && {
81
81
  padding: 12px 16px;
82
82
  }
83
- `,B=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Kt(rh,{disabled:t||r,...n,children:t?dl("span",{children:[Kt(ro,{}),o?Kt("span",{children:o}):null]}):e}),ll=({children:e,loading:t,disabled:r,...o})=>Kt(d0,{disabled:r,...o,children:t?Kt(ro,{color:"var(--privy-color-foreground-accent)"}):e}),d0=xn(va)`
83
+ `,B=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Kt(ah,{disabled:t||r,...n,children:t?ul("span",{children:[Kt(ro,{}),o?Kt("span",{children:o}):null]}):e}),dl=({children:e,loading:t,disabled:r,...o})=>Kt(h0,{disabled:r,...o,children:t?Kt(ro,{color:"var(--privy-color-foreground-accent)"}):e}),h0=Rn(Ca)`
84
84
  position: relative;
85
85
 
86
86
  && {
@@ -106,7 +106,7 @@ Resources:
106
106
  color: var(--privy-color-foreground-accent);
107
107
  background-color: var(--privy-color-accent-dark);
108
108
  }
109
- `,cl=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Kt(rh,{as:"a",disabled:t||r,...n,children:t?dl("span",{children:[Kt(ro,{}),o?Kt("span",{children:o}):null]}):e}),rh=xn(va)`
109
+ `,pl=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Kt(ah,{as:"a",disabled:t||r,...n,children:t?ul("span",{children:[Kt(ro,{}),o?Kt("span",{children:o}):null]}):e}),ah=Rn(Ca)`
110
110
  position: relative;
111
111
 
112
112
  && {
@@ -132,7 +132,7 @@ Resources:
132
132
  }
133
133
 
134
134
  /* If an anchor tag, :disabled isn't a thing, so manually set state */
135
- ${e=>e.disabled?th`
135
+ ${e=>e.disabled?ih`
136
136
  &&&,
137
137
  &&&:hover,
138
138
  &&&:active {
@@ -151,7 +151,7 @@ Resources:
151
151
  opacity: 1;
152
152
  animation: fadein 200ms ease;
153
153
  }
154
- `,Ur=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Kt(p0,{disabled:t||r,...n,children:t?dl("span",{children:[Kt(ro,{}),o?Kt("span",{children:o}):null]}):e}),p0=xn(va)`
154
+ `,Ur=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Kt(y0,{disabled:t||r,...n,children:t?ul("span",{children:[Kt(ro,{}),o?Kt("span",{children:o}):null]}):e}),y0=Rn(Ca)`
155
155
  && {
156
156
  border-width: 1px;
157
157
  border-color: ${e=>e.warn?"var(--privy-color-error)":"var(--privy-color-foreground-4)"};
@@ -180,7 +180,7 @@ Resources:
180
180
  opacity: 1;
181
181
  animation: fadein 200ms ease;
182
182
  }
183
- `,Ho=xn.button`
183
+ `,Go=Rn.button`
184
184
  && {
185
185
  padding: 12px 16px;
186
186
  font-weight: 500;
@@ -193,7 +193,7 @@ Resources:
193
193
  transition: opacity 200ms ease, background-color 200ms ease, color 200ms ease;
194
194
  user-select: none;
195
195
 
196
- ${e=>e.invisible&&th`
196
+ ${e=>e.invisible&&ih`
197
197
  pointer-events: none;
198
198
  `}
199
199
 
@@ -211,10 +211,10 @@ Resources:
211
211
  cursor: not-allowed;
212
212
  }
213
213
  }
214
- `,BM=xn.div`
214
+ `,ZM=Rn.div`
215
215
  /* Set to match height of SoftCtaButton to avoid reflow if conditionally rendered */
216
216
  height: 44px;
217
- `,yi=({children:e,onClick:t,disabled:r,isSubmitting:o,...n})=>dl(u0,{isSubmitting:o,onClick:t,disabled:r,...n,children:[Kt("span",{children:e}),Kt("span",{children:Kt(ro,{})})]}),u0=xn.button`
217
+ `,vi=({children:e,onClick:t,disabled:r,isSubmitting:o,...n})=>ul(g0,{isSubmitting:o,onClick:t,disabled:r,...n,children:[Kt("span",{children:e}),Kt("span",{children:Kt(ro,{})})]}),g0=Rn.button`
218
218
  && {
219
219
  color: var(--privy-color-accent);
220
220
  font-size: 16px;
@@ -256,7 +256,7 @@ Resources:
256
256
  cursor: not-allowed;
257
257
  }
258
258
  }
259
- `;import m0 from"styled-components";var oh=m0.span`
259
+ `;import v0 from"styled-components";var sh=v0.span`
260
260
  && {
261
261
  width: 82px;
262
262
  height: 82px;
@@ -268,7 +268,7 @@ Resources:
268
268
  display: inline-block;
269
269
  box-sizing: border-box;
270
270
  }
271
- `;import f0 from"@heroicons/react/24/outline/ArrowLeftIcon";import h0 from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import y0 from"@heroicons/react/24/outline/XMarkIcon";import gi from"styled-components";import{jsx as jt,jsxs as nh}from"react/jsx-runtime";var g0=({backFn:e})=>jt("div",{children:jt(Dd,{onClick:e,children:jt(f0,{height:"16px",width:"16px",strokeWidth:2})})}),v0=({infoFn:e})=>jt("div",{children:jt(w0,{"aria-label":"info",onClick:e,children:jt(h0,{height:"22px",width:"22px",strokeWidth:2})})}),C0=e=>jt("div",{children:jt(Dd,{"aria-label":"close modal",onClick:e.onClose,children:jt(y0,{height:"16px",width:"16px",strokeWidth:2})})});var x=({backFn:e,infoFn:t,onClose:r,title:o,closeable:n=!0})=>{let{closePrivyModal:i}=M(),a=Ve();return nh(b0,{children:[nh(E0,{children:[e&&jt(g0,{backFn:e}),t&&jt(v0,{infoFn:t})]}),o&&jt(S0,{id:"privy-dialog-title",children:o}),jt(T0,{children:!a.render.standalone&&n&&jt(C0,{onClose:r||(()=>i())})})]})},Dd=gi.button`
271
+ `;import C0 from"@heroicons/react/24/outline/ArrowLeftIcon";import w0 from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import b0 from"@heroicons/react/24/outline/XMarkIcon";import Ci from"styled-components";import{jsx as jt,jsxs as lh}from"react/jsx-runtime";var E0=({backFn:e})=>jt("div",{children:jt(Fd,{onClick:e,children:jt(C0,{height:"16px",width:"16px",strokeWidth:2})})}),T0=({infoFn:e})=>jt("div",{children:jt(_0,{"aria-label":"info",onClick:e,children:jt(w0,{height:"22px",width:"22px",strokeWidth:2})})}),S0=e=>jt("div",{children:jt(Fd,{"aria-label":"close modal",onClick:e.onClose,children:jt(b0,{height:"16px",width:"16px",strokeWidth:2})})});var A=({backFn:e,infoFn:t,onClose:r,title:o,closeable:n=!0})=>{let{closePrivyModal:i}=M(),a=Ve();return lh(P0,{children:[lh(A0,{children:[e&&jt(E0,{backFn:e}),t&&jt(T0,{infoFn:t})]}),o&&jt(k0,{id:"privy-dialog-title",children:o}),jt(x0,{children:!a.render.standalone&&n&&jt(S0,{onClose:r||(()=>i())})})]})},Fd=Ci.button`
272
272
  && {
273
273
  cursor: pointer;
274
274
  display: flex;
@@ -287,11 +287,11 @@ Resources:
287
287
  opacity: 1;
288
288
  }
289
289
  }
290
- `,w0=gi(Dd)`
290
+ `,_0=Ci(Fd)`
291
291
  && {
292
292
  background-color: transparent;
293
293
  }
294
- `,b0=gi.div`
294
+ `,P0=Ci.div`
295
295
  padding: 16px 0;
296
296
  display: flex;
297
297
  align-items: center;
@@ -303,23 +303,23 @@ Resources:
303
303
  font-weight: 600;
304
304
  color: var(--privy-color-foreground);
305
305
  }
306
- `,E0=gi.div`
306
+ `,A0=Ci.div`
307
307
  flex: 1;
308
308
  align-items: center;
309
309
  display: flex;
310
310
  gap: 8px;
311
- `,T0=gi.div`
311
+ `,x0=Ci.div`
312
312
  flex: 1;
313
313
  display: flex;
314
314
  justify-content: flex-end;
315
- `,S0=gi.div`
315
+ `,k0=Ci.div`
316
316
  overflow: hidden;
317
317
  white-space: nowrap;
318
318
  max-width: 100%;
319
319
  text-overflow: ellipsis;
320
320
  text-align: center;
321
321
  color: var(--privy-color-foreground-2);
322
- `;import _0 from"styled-components";var P0=_0.div`
322
+ `;import R0 from"styled-components";var I0=R0.div`
323
323
  display: flex;
324
324
  flex-direction: column;
325
325
  justify-content: center;
@@ -342,15 +342,15 @@ Resources:
342
342
  left: -19px;
343
343
  top: -19px;
344
344
  }
345
- `,Je=P0;import Go,{css as A0}from"styled-components";var oo=Go.div`
345
+ `,Je=I0;import Vo,{css as M0}from"styled-components";var oo=Vo.div`
346
346
  text-align: left;
347
347
  flex-grow: 1;
348
- `,pl=Go.div`
348
+ `,ml=Vo.div`
349
349
  display: flex;
350
350
  flex-direction: column;
351
351
  justify-content: flex-end;
352
352
  flex-grow: 1;
353
- `,Yt=Go.div`
353
+ `,Yt=Vo.div`
354
354
  display: flex;
355
355
  flex-direction: column;
356
356
  gap: 12px;
@@ -365,13 +365,13 @@ Resources:
365
365
  &::-webkit-scrollbar {
366
366
  display: none;
367
367
  }
368
- `,ih=Go(Yt)`
368
+ `,ch=Vo(Yt)`
369
369
  ${e=>{if(e.colorScheme==="light")return"background: linear-gradient(var(--privy-color-background), var(--privy-color-background) 70%) bottom, linear-gradient(rgba(0, 0, 0, 0) 20%, rgba(0, 0, 0, 0.06)) bottom;";if(e.colorScheme==="dark")return"background: linear-gradient(var(--privy-color-background), var(--privy-color-background) 70%) bottom, linear-gradient(rgba(255, 255, 255, 0) 20%, rgba(255, 255, 255, 0.06)) bottom;"}}
370
370
 
371
371
  background-repeat: no-repeat;
372
372
  background-size: 100% 32px, 100% 16px;
373
373
  background-attachment: local, scroll;
374
- `,ah=A0`
374
+ `,dh=M0`
375
375
  && {
376
376
  width: 100%;
377
377
  font-size: 16px;
@@ -408,22 +408,22 @@ Resources:
408
408
  max-width: 24px;
409
409
  }
410
410
  }
411
- `,ul=Go.div`
411
+ `,fl=Vo.div`
412
412
  text-align: center;
413
413
  font-size: 14px;
414
414
  margin-bottom: 24px;
415
- `,Ee=Go.button`
416
- ${ah}
417
- `,Ud=Go.a`
418
- ${ah}
419
- `,Fr=Go.div`
415
+ `,Ee=Vo.button`
416
+ ${dh}
417
+ `,Bd=Vo.a`
418
+ ${dh}
419
+ `,Fr=Vo.div`
420
420
  width: 100%;
421
421
  height: 100%;
422
422
  min-height: inherit;
423
423
  display: flex;
424
424
  flex-direction: column;
425
425
  ${e=>e.if?"display: none;":""}
426
- `;import{Fragment as I0,jsx as kn,jsxs as Ca}from"react/jsx-runtime";var lh=()=>{let{navigate:e,app:t}=P();return Ca(I0,{children:[kn(x,{}),Ca(k0,{children:[kn(Je,{children:Ca("div",{children:[kn(oh,{color:"var(--privy-color-warn-light)"}),kn(x0,{height:38,width:38,strokeWidth:2,stroke:"var(--privy-color-warn)"})]})}),Ca(R0,{children:[kn("h3",{children:"Account not found"}),Ca("p",{children:["Please try logging in again or go to ",t.name," to create an account."]})]}),kn(oo,{}),kn(B,{onClick:()=>e("LANDING"),children:"Try logging in again"})]})]})},k0=sh.div`
426
+ `;import{Fragment as N0,jsx as In,jsxs as wa}from"react/jsx-runtime";var uh=()=>{let{navigate:e,app:t}=_();return wa(N0,{children:[In(A,{}),wa(O0,{children:[In(Je,{children:wa("div",{children:[In(sh,{color:"var(--privy-color-warn-light)"}),In(W0,{height:38,width:38,strokeWidth:2,stroke:"var(--privy-color-warn)"})]})}),wa(L0,{children:[In("h3",{children:"Account not found"}),wa("p",{children:["Please try logging in again or go to ",t.name," to create an account."]})]}),In(oo,{}),In(B,{onClick:()=>e("LANDING"),children:"Try logging in again"})]})]})},O0=ph.div`
427
427
  display: flex;
428
428
  flex-direction: column;
429
429
  align-items: center;
@@ -432,11 +432,11 @@ Resources:
432
432
  width: 100%;
433
433
  padding-bottom: 16px;
434
434
  margin-top: 24px;
435
- `,R0=sh.div`
435
+ `,L0=ph.div`
436
436
  display: flex;
437
437
  flex-direction: column;
438
438
  gap: 8px;
439
- `;import uh from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import M0 from"@heroicons/react/24/solid/DocumentCheckIcon";import W0 from"styled-components";import ch from"styled-components";import{jsx as vi,jsxs as dh}from"react/jsx-runtime";var Fd=ch.div`
439
+ `;import yh from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import D0 from"@heroicons/react/24/solid/DocumentCheckIcon";import U0 from"styled-components";import mh from"styled-components";import{jsx as wi,jsxs as fh}from"react/jsx-runtime";var Hd=mh.div`
440
440
  margin-top: 16px;
441
441
  font-size: 13px;
442
442
  text-align: center;
@@ -445,7 +445,7 @@ Resources:
445
445
  && > a {
446
446
  color: var(--privy-color-accent);
447
447
  }
448
- `;function Ci(e){let{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:r,requireUsersAcceptTerms:o}}=e.app;if(o&&!e.alwaysShowImplicitConsent)return vi(Fd,{});if(!r&&!t)return vi(Fd,{});let n=!!(t&&r);return dh(Fd,{children:["By logging in I agree to the"," ",r&&vi("a",{href:r,target:"_blank",children:n?"Terms":"Terms of Service"}),n&&" & ",t&&vi("a",{href:t,target:"_blank",children:"Privacy Policy"})]})}var $=()=>dh(Z,{children:[vi(Fo,{}),vi("a",{href:"https://www.privy.io/",target:"_blank",children:"Protected by Privy"})]}),Z=ch.div`
448
+ `;function bi(e){let{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:r,requireUsersAcceptTerms:o}}=e.app;if(o&&!e.alwaysShowImplicitConsent)return wi(Hd,{});if(!r&&!t)return wi(Hd,{});let n=!!(t&&r);return fh(Hd,{children:["By logging in I agree to the"," ",r&&wi("a",{href:r,target:"_blank",children:n?"Terms":"Terms of Service"}),n&&" & ",t&&wi("a",{href:t,target:"_blank",children:"Privacy Policy"})]})}var z=()=>fh(Z,{children:[wi(Bo,{}),wi("a",{href:"https://www.privy.io/",target:"_blank",children:"Protected by Privy"})]}),Z=mh.div`
449
449
  display: flex;
450
450
  align-items: center;
451
451
  justify-content: center;
@@ -490,7 +490,7 @@ Resources:
490
490
  font-size: 0.875rem;
491
491
 
492
492
  text-align: center;
493
- `,_r=ft.div`
493
+ `,Pr=ft.div`
494
494
  display: flex;
495
495
  flex-direction: column;
496
496
  align-items: center;
@@ -500,7 +500,7 @@ Resources:
500
500
  @media (max-width: 440px) {
501
501
  padding: 10px 10px 20px;
502
502
  }
503
- `,Rn=ft.div`
503
+ `,Mn=ft.div`
504
504
  display: flex;
505
505
  flex-direction: column;
506
506
  align-items: stretch;
@@ -532,7 +532,7 @@ Resources:
532
532
  flex-direction: column;
533
533
  gap: 10px;
534
534
  padding-top: 20px;
535
- `,ml=ft.div`
535
+ `,hl=ft.div`
536
536
  display: flex;
537
537
  flex-direction: column;
538
538
  align-items: stretch;
@@ -540,11 +540,11 @@ Resources:
540
540
  padding: 1rem 0rem 0rem;
541
541
  flex-grow: 1;
542
542
  width: 100%;
543
- `,fl=ft.div`
543
+ `,yl=ft.div`
544
544
  display: flex;
545
545
  gap: 5px;
546
546
  width: 100%;
547
- `,hl=ft.button`
547
+ `,gl=ft.button`
548
548
  && {
549
549
  background-color: transparent;
550
550
  color: var(--privy-color-foreground-3);
@@ -562,7 +562,7 @@ Resources:
562
562
  &&:hover {
563
563
  color: var(--privy-color-error);
564
564
  }
565
- `,yl=ft.div`
565
+ `,vl=ft.div`
566
566
  display: flex;
567
567
  align-items: center;
568
568
  gap: 0.5rem;
@@ -572,7 +572,7 @@ Resources:
572
572
  height: 20px !important;
573
573
  width: 20px !important;
574
574
  }
575
- `,In=ft.div`
575
+ `,Wn=ft.div`
576
576
  display: flex;
577
577
  align-items: center;
578
578
  gap: 6px;
@@ -586,15 +586,15 @@ Resources:
586
586
  display: flex !important;
587
587
  align-items: flex-end;
588
588
  }
589
- `,gl=ft.div`
589
+ `,Cl=ft.div`
590
590
  width: 100%;
591
591
  display: flex;
592
592
  justify-content: space-between;
593
- `,ph=ft.p`
593
+ `,hh=ft.p`
594
594
  text-align: left;
595
595
  width: 100%;
596
596
  color: var(--privy-color-foreground-3) !important;
597
- `,wa=ft.button`
597
+ `,ba=ft.button`
598
598
  display: flex;
599
599
  flex-direction: row;
600
600
  align-items: center;
@@ -639,12 +639,12 @@ Resources:
639
639
  width: auto !important;
640
640
  color: white;
641
641
  }
642
- `,vl=ft.div`
642
+ `,wl=ft.div`
643
643
  color: var(--privy-color-error);
644
- `;import{Fragment as N0,jsx as no,jsxs as ba}from"react/jsx-runtime";var mh=()=>{let{user:e,logout:t}=z(),{app:r,onUserCloseViaDialogOrKeybindRef:o,setModalData:n,navigate:i}=P(),{acceptTerms:a,closePrivyModal:l,createAnalyticsEvent:s}=M(),c=f=>{f?.preventDefault(),l({shouldCallAuthOnSuccess:!1}),t()};o.current=c;let m=async f=>{f.preventDefault(),await a(),e&&qt(e,r?.embeddedWallets?.createOnLogin)?(n({createWallet:{onSuccess:()=>{},onFailure:u=>{console.error(u),s({eventName:"embedded_wallet_creation_failure_logout",payload:{error:u,screen:"AffirmativeConsentScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")):l()};return no(O0,{termsAndConditionsUrl:r?.legal.termsAndConditionsUrl,privacyPolicyUrl:r?.legal.privacyPolicyUrl,onAccept:m,onDecline:c})},O0=({termsAndConditionsUrl:e,privacyPolicyUrl:t,onAccept:r,onDecline:o})=>ba(N0,{children:[no(x,{closeable:!1}),no(M0,{width:56,height:56,fill:"var(--privy-color-accent)",style:{margin:"auto"}}),no(de,{style:{marginTop:24},children:"One last step"}),no(ue,{children:"By signing up, you agree to our terms and privacy policy."}),ba(Yt,{style:{marginTop:24},children:[e&&ba(Ud,{target:"_blank",href:e,children:["View Terms ",no(uh,{style:{marginLeft:"auto"}})]}),t&&ba(Ud,{target:"_blank",href:t,children:["View Privacy Policy ",no(uh,{style:{marginLeft:"auto"}})]})]}),ba(L0,{style:{marginTop:24},children:[no(Ur,{onClick:o,children:"No thanks"}),no(B,{onClick:r,children:"Accept"})]}),no($,{})]}),L0=W0.div`
644
+ `;import{Fragment as H0,jsx as no,jsxs as Ea}from"react/jsx-runtime";var gh=()=>{let{user:e,logout:t}=q(),{app:r,onUserCloseViaDialogOrKeybindRef:o,setModalData:n,navigate:i}=_(),{acceptTerms:a,closePrivyModal:l,createAnalyticsEvent:s}=M(),c=f=>{f?.preventDefault(),l({shouldCallAuthOnSuccess:!1}),t()};o.current=c;let m=async f=>{f.preventDefault(),await a(),e&&qt(e,r?.embeddedWallets?.createOnLogin)?(n({createWallet:{onSuccess:()=>{},onFailure:u=>{console.error(u),s({eventName:"embedded_wallet_creation_failure_logout",payload:{error:u,screen:"AffirmativeConsentScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")):l()};return no(F0,{termsAndConditionsUrl:r?.legal.termsAndConditionsUrl,privacyPolicyUrl:r?.legal.privacyPolicyUrl,onAccept:m,onDecline:c})},F0=({termsAndConditionsUrl:e,privacyPolicyUrl:t,onAccept:r,onDecline:o})=>Ea(H0,{children:[no(A,{closeable:!1}),no(D0,{width:56,height:56,fill:"var(--privy-color-accent)",style:{margin:"auto"}}),no(de,{style:{marginTop:24},children:"One last step"}),no(ue,{children:"By signing up, you agree to our terms and privacy policy."}),Ea(Yt,{style:{marginTop:24},children:[e&&Ea(Bd,{target:"_blank",href:e,children:["View Terms ",no(yh,{style:{marginLeft:"auto"}})]}),t&&Ea(Bd,{target:"_blank",href:t,children:["View Privacy Policy ",no(yh,{style:{marginLeft:"auto"}})]})]}),Ea(B0,{style:{marginTop:24},children:[no(Ur,{onClick:o,children:"No thanks"}),no(B,{onClick:r,children:"Accept"})]}),no(z,{})]}),B0=U0.div`
645
645
  display: flex;
646
646
  gap: 10px;
647
- `;import hh from"styled-components";import D0 from"styled-components";var Cl=D0.span`
647
+ `;import Ch from"styled-components";import G0 from"styled-components";var bl=G0.span`
648
648
  && {
649
649
  width: 82px;
650
650
  height: 82px;
@@ -659,7 +659,7 @@ Resources:
659
659
  transition: border-color 800ms;
660
660
  border-bottom-color: ${e=>e.color??"var(--privy-color-accent)"};
661
661
  }
662
- `;import{jsx as fh}from"react/jsx-runtime";var wl=({style:e,...t})=>fh("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",style:{height:"1.5rem",width:"1.5rem",...e},...t,children:fh("path",{fillRule:"evenodd",d:"M12 1.5a5.25 5.25 0 00-5.25 5.25v3a3 3 0 00-3 3v6.75a3 3 0 003 3h10.5a3 3 0 003-3v-6.75a3 3 0 00-3-3v-3c0-2.9-2.35-5.25-5.25-5.25zm3.75 8.25v-3a3.75 3.75 0 10-7.5 0v3h7.5z",clipRule:"evenodd"})});import{Fragment as Bd,jsx as io,jsxs as bl}from"react/jsx-runtime";var yh=()=>{let{navigate:e,app:t}=P(),r=t?.allowlistConfig.errorTitle||"You don't have access to this app",o=t?.allowlistConfig.errorDetail||"Have you been invited?",n=t?.allowlistConfig.errorCtaText||"Try another account";return bl(Bd,{children:[io(x,{}),bl(U0,{children:[io(Je,{children:bl("div",{children:[io(Cl,{}),io(wl,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),bl(F0,{children:[typeof r=="string"?io("h3",{children:r}):io(Bd,{children:r}),typeof o=="string"?io("p",{children:o}):io(Bd,{children:o})]}),t?.allowlistConfig.errorCtaLink?io(B,{as:"a",href:t.allowlistConfig.errorCtaLink,children:n}):io(B,{onClick:()=>{e("LANDING")},children:n})]})]})},U0=hh.div`
662
+ `;import{jsx as vh}from"react/jsx-runtime";var El=({style:e,...t})=>vh("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",style:{height:"1.5rem",width:"1.5rem",...e},...t,children:vh("path",{fillRule:"evenodd",d:"M12 1.5a5.25 5.25 0 00-5.25 5.25v3a3 3 0 00-3 3v6.75a3 3 0 003 3h10.5a3 3 0 003-3v-6.75a3 3 0 00-3-3v-3c0-2.9-2.35-5.25-5.25-5.25zm3.75 8.25v-3a3.75 3.75 0 10-7.5 0v3h7.5z",clipRule:"evenodd"})});import{Fragment as Gd,jsx as io,jsxs as Tl}from"react/jsx-runtime";var wh=()=>{let{navigate:e,app:t}=_(),r=t?.allowlistConfig.errorTitle||"You don't have access to this app",o=t?.allowlistConfig.errorDetail||"Have you been invited?",n=t?.allowlistConfig.errorCtaText||"Try another account";return Tl(Gd,{children:[io(A,{}),Tl(V0,{children:[io(Je,{children:Tl("div",{children:[io(bl,{}),io(El,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),Tl(q0,{children:[typeof r=="string"?io("h3",{children:r}):io(Gd,{children:r}),typeof o=="string"?io("p",{children:o}):io(Gd,{children:o})]}),t?.allowlistConfig.errorCtaLink?io(B,{as:"a",href:t.allowlistConfig.errorCtaLink,children:n}):io(B,{onClick:()=>{e("LANDING")},children:n})]})]})},V0=Ch.div`
663
663
  display: flex;
664
664
  flex-direction: column;
665
665
  align-items: center;
@@ -667,11 +667,11 @@ Resources:
667
667
  gap: 24px;
668
668
  width: 100%;
669
669
  padding-bottom: 16px;
670
- `,F0=hh.div`
670
+ `,q0=Ch.div`
671
671
  display: flex;
672
672
  flex-direction: column;
673
673
  gap: 8px;
674
- `;import G0 from"@heroicons/react/20/solid/CheckIcon";import V0 from"@heroicons/react/24/outline/EnvelopeIcon";import q0 from"@heroicons/react/24/outline/PhoneIcon";import{useEffect as Gd,useState as Ta}from"react";import{isMobile as z0}from"react-device-detect";import Wn from"styled-components";import Jt from"styled-components";var Pr=Jt.div`
674
+ `;import K0 from"@heroicons/react/20/solid/CheckIcon";import j0 from"@heroicons/react/24/outline/EnvelopeIcon";import Y0 from"@heroicons/react/24/outline/PhoneIcon";import{useEffect as qd,useState as Sa}from"react";import{isMobile as Z0}from"react-device-detect";import Ln from"styled-components";import Jt from"styled-components";var Xt=Jt.div`
675
675
  display: flex;
676
676
  flex-direction: column;
677
677
  align-items: flex-start;
@@ -686,16 +686,16 @@ Resources:
686
686
  justify-content: center;
687
687
  flex-grow: 1;
688
688
  width: 100%;
689
- `,gh=Jt.div`
689
+ `,bh=Jt.div`
690
690
  display: flex;
691
691
  flex-direction: column;
692
692
  align-items: center;
693
693
  width: 100%;
694
- `,wi=Jt(wt)`
694
+ `,Ei=Jt(wt)`
695
695
  padding: 20px 0;
696
- `,ir=Jt(wt)`
696
+ `,ar=Jt(wt)`
697
697
  gap: 16px;
698
- `,Vo=Jt.div`
698
+ `,qo=Jt.div`
699
699
  display: flex;
700
700
  flex-direction: column;
701
701
  width: 100%;
@@ -703,12 +703,12 @@ Resources:
703
703
  display: flex;
704
704
  flex-direction: column;
705
705
  gap: 8px;
706
- `,KW=Jt.div`
706
+ `,oO=Jt.div`
707
707
  display: flex;
708
708
  flex-direction: column;
709
709
  justify-content: space-between;
710
710
  height: 100%;
711
- `,vh=Jt.div`
711
+ `,Eh=Jt.div`
712
712
  display: flex;
713
713
  flex-direction: column;
714
714
  justify-content: flex-start;
@@ -731,15 +731,15 @@ Resources:
731
731
  color: var(--privy-color-foreground-3);
732
732
  font-size: 14px;
733
733
  }
734
- `,ne=Jt.div`
734
+ `,re=Jt.div`
735
735
  height: 16px;
736
736
  `,ie=Jt.div`
737
737
  height: 12px;
738
- `,Ch=Jt.div`
738
+ `,Th=Jt.div`
739
739
  position: relative;
740
- `,bi=Jt.div`
740
+ `,Ti=Jt.div`
741
741
  height: ${e=>e.height??"12"}px;
742
- `,wh=Jt.div`
742
+ `,Sh=Jt.div`
743
743
  background-color: var(--privy-color-accent);
744
744
  display: flex;
745
745
  justify-content: center;
@@ -747,9 +747,9 @@ Resources:
747
747
  border-radius: 50%;
748
748
  border-color: white;
749
749
  border-width: 2px !important;
750
- `;import Hd from"styled-components";import{Fragment as H0,jsx as Ea,jsxs as Eh}from"react/jsx-runtime";var Mn=({title:e,description:t,children:r,...o})=>Ea(bh,{...o,children:Eh(H0,{children:[Ea("h3",{children:e}),typeof t=="string"?Ea("p",{children:t}):t,r]})}),ao=Hd(Mn)`
750
+ `;import Vd from"styled-components";import{Fragment as $0,jsx as Ta,jsxs as Ph}from"react/jsx-runtime";var On=({title:e,description:t,children:r,...o})=>Ta(_h,{...o,children:Ph($0,{children:[Ta("h3",{children:e}),typeof t=="string"?Ta("p",{children:t}):t,r]})}),ao=Vd(On)`
751
751
  margin-bottom: 24px;
752
- `,ge=({title:e,description:t,icon:r,children:o,...n})=>Eh(B0,{...n,children:[r||null,Ea("h3",{children:e}),t&&typeof t=="string"?Ea("p",{children:t}):t,o]}),bh=Hd.div`
752
+ `,he=({title:e,description:t,icon:r,children:o,...n})=>Ph(z0,{...n,children:[r||null,Ta("h3",{children:e}),t&&typeof t=="string"?Ta("p",{children:t}):t,o]}),_h=Vd.div`
753
753
  display: flex;
754
754
  flex-direction: column;
755
755
  justify-content: flex-start;
@@ -769,7 +769,7 @@ Resources:
769
769
  color: var(--privy-color-foreground-2);
770
770
  font-size: 14px;
771
771
  }
772
- `,B0=Hd(bh)`
772
+ `,z0=Vd(_h)`
773
773
  align-items: center;
774
774
  text-align: center;
775
775
  gap: 16px;
@@ -777,7 +777,7 @@ Resources:
777
777
  h3 {
778
778
  margin-bottom: 24px;
779
779
  }
780
- `;import{Fragment as ew,jsx as Lt,jsxs as Po}from"react/jsx-runtime";var Vd=6,Th=new Array(Vd).fill(""),$0=1400,K0=30;var _h=()=>{let{app:e,navigate:t,lastScreen:r,navigateBack:o,setModalData:n,onUserCloseViaDialogOrKeybindRef:i}=P(),{closePrivyModal:a,resendEmailCode:l,resendSmsCode:s,getAuthMeta:c,loginWithCode:m,updateWallets:f,createAnalyticsEvent:u}=M(),{authenticated:C,logout:g,user:y}=z(),[b,E]=Ta(Th),[k,T]=Ta(!1),[A,R]=Ta(null),[I,D]=Ta(null),[H,K]=Ta(0);i.current=()=>null;let j=c()?.email?0:1,O=Ne,U=O-500;Gd(()=>{if(H){let X=setTimeout(()=>{K(H-1)},1e3);return()=>clearTimeout(X)}},[H]),Gd(()=>{if(C&&k&&y){if(e?.legal.requireUsersAcceptTerms&&!y.hasAcceptedTerms){let te=setTimeout(()=>{t("AFFIRMATIVE_CONSENT_SCREEN")},U);return()=>clearTimeout(te)}if(qt(y,e?.embeddedWallets?.createOnLogin)){let te=setTimeout(()=>{n({createWallet:{onSuccess:()=>{},onFailure:_e=>{console.error(_e),u({eventName:"embedded_wallet_creation_failure_logout",payload:{error:_e,screen:"AwaitingPasswordlessCodeScreen"}}),g()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},U);return()=>clearTimeout(te)}else{f();let te=setTimeout(()=>a({shouldCallAuthOnSuccess:!0,isSuccess:!0}),O);return()=>clearTimeout(te)}}},[C,k,y]),Gd(()=>{if(A&&I===0){let X=setTimeout(()=>{E(Th),R(null),document.querySelector("input[name=code-0]")?.focus()},$0);return()=>clearTimeout(X)}},[A]);let W=X=>{X.preventDefault();let te=X.currentTarget.value.replace(" ","");if(te==="")return;if(isNaN(Number(te))){R("Code should be numeric"),D(1);return}R(null),D(null);let _e=Number(X.currentTarget.name?.charAt(5)),Te=[...te||[""]].slice(0,Vd-_e),Ke=[...b.slice(0,_e),...Te,...b.slice(_e+Te.length)];E(Ke);let Ge=Te.length,mt=Math.min(Math.max(_e+Ge,0),Vd-1);isNaN(Number(X.currentTarget.value))||document.querySelector(`input[name=code-${mt}]`)?.focus(),Ke.every(Fe=>Fe&&!isNaN(+Fe))&&(document.querySelector(`input[name=code-${mt}]`)?.blur(),m(Ke.join("")).then(()=>T(!0)).catch(se=>{if(se?.status===422)R("Invalid or expired verification code");else if(se instanceof Mt&&se.privyErrorCode==="cannot_link_more_of_type")R(se.message);else if(se instanceof Mt&&se.privyErrorCode==="max_accounts_reached"){console.error(new br(se).toString()),t("USER_LIMIT_REACHED_SCREEN");return}else if(se instanceof Mt&&se.privyErrorCode==="user_does_not_exist"){t("ACCOUNT_NOT_FOUND_SCREEN");return}else if(se instanceof Mt&&se.privyErrorCode==="linked_to_another_user"){n({errorModalData:{error:se,previousScreen:r??"AWAITING_PASSWORDLESS_CODE"}}),t("ERROR_SCREEN",!1);return}else R("Issue verifying code");D(0)}))},Ce=X=>{I===1&&(R(null),D(null));let te=[...b.slice(0,X),"",...b.slice(X+1)];E(te),X>0&&document.querySelector(`input[name=code-${X-1}]`)?.focus()},Ie=j==0?Lt(V0,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):Lt(q0,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),Y=j==0?Po("p",{children:["Please check ",Lt(Sh,{children:c()?.email})," for an email from privy.io and enter your code below."]}):Po("p",{children:["Please check ",Lt(Sh,{children:c()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return Po(ew,{children:[Lt(x,{backFn:()=>o()},"header"),Po(j0,{children:[Lt(ge,{title:"Enter confirmation code",description:Y,icon:Ie}),Po(gh,{children:[Po(Y0,{children:[Lt(Z0,{fail:!!A,success:k,children:Lt("span",{children:A||(k?"Success!":"")})}),Lt("div",{children:b.map((X,te)=>Lt("input",{name:`code-${te}`,type:"text",value:b[te],onChange:W,onKeyUp:_e=>{_e.key==="Backspace"&&Ce(te)},inputMode:"numeric",autoFocus:te===0,pattern:"[0-9]",className:`${k?"success":""} ${A?"fail":""}`,autoComplete:z0?"one-time-code":"off"},te))})]}),Po(Q0,{children:[Po("span",{children:["Didn't get ",j==0?"an email":"a message","?"]}),H?Po(X0,{children:[Lt(G0,{color:"var(--privy-color-foreground)",strokeWidth:1.33,height:"12px",width:"12px"}),Lt("span",{children:"Code sent"})]}):Lt(J0,{children:Lt("button",{onClick:async()=>{K(K0),j==0?await l():await s()},children:"Resend code"})})]})]})]}),Lt($,{})]})},j0=Wn.div`
780
+ `;import{Fragment as iw,jsx as Lt,jsxs as Po}from"react/jsx-runtime";var zd=6,Ah=new Array(zd).fill(""),Q0=1400,J0=30;var kh=()=>{let{app:e,navigate:t,lastScreen:r,navigateBack:o,setModalData:n,onUserCloseViaDialogOrKeybindRef:i}=_(),{closePrivyModal:a,resendEmailCode:l,resendSmsCode:s,getAuthMeta:c,loginWithCode:m,updateWallets:f,createAnalyticsEvent:u}=M(),{authenticated:C,logout:g,user:y}=q(),[b,T]=Sa(Ah),[k,S]=Sa(!1),[x,R]=Sa(null),[I,D]=Sa(null),[H,K]=Sa(0);i.current=()=>null;let j=c()?.email?0:1,O=Ne,U=O-500;qd(()=>{if(H){let X=setTimeout(()=>{K(H-1)},1e3);return()=>clearTimeout(X)}},[H]),qd(()=>{if(C&&k&&y){if(e?.legal.requireUsersAcceptTerms&&!y.hasAcceptedTerms){let te=setTimeout(()=>{t("AFFIRMATIVE_CONSENT_SCREEN")},U);return()=>clearTimeout(te)}if(qt(y,e?.embeddedWallets?.createOnLogin)){let te=setTimeout(()=>{n({createWallet:{onSuccess:()=>{},onFailure:_e=>{console.error(_e),u({eventName:"embedded_wallet_creation_failure_logout",payload:{error:_e,screen:"AwaitingPasswordlessCodeScreen"}}),g()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},U);return()=>clearTimeout(te)}else{f();let te=setTimeout(()=>a({shouldCallAuthOnSuccess:!0,isSuccess:!0}),O);return()=>clearTimeout(te)}}},[C,k,y]),qd(()=>{if(x&&I===0){let X=setTimeout(()=>{T(Ah),R(null),document.querySelector("input[name=code-0]")?.focus()},Q0);return()=>clearTimeout(X)}},[x]);let W=X=>{X.preventDefault();let te=X.currentTarget.value.replace(" ","");if(te==="")return;if(isNaN(Number(te))){R("Code should be numeric"),D(1);return}R(null),D(null);let _e=Number(X.currentTarget.name?.charAt(5)),Te=[...te||[""]].slice(0,zd-_e),Ke=[...b.slice(0,_e),...Te,...b.slice(_e+Te.length)];T(Ke);let Ge=Te.length,mt=Math.min(Math.max(_e+Ge,0),zd-1);isNaN(Number(X.currentTarget.value))||document.querySelector(`input[name=code-${mt}]`)?.focus(),Ke.every(Fe=>Fe&&!isNaN(+Fe))&&(document.querySelector(`input[name=code-${mt}]`)?.blur(),m(Ke.join("")).then(()=>S(!0)).catch(se=>{if(se?.status===422)R("Invalid or expired verification code");else if(se instanceof Mt&&se.privyErrorCode==="cannot_link_more_of_type")R(se.message);else if(se instanceof Mt&&se.privyErrorCode==="max_accounts_reached"){console.error(new Er(se).toString()),t("USER_LIMIT_REACHED_SCREEN");return}else if(se instanceof Mt&&se.privyErrorCode==="user_does_not_exist"){t("ACCOUNT_NOT_FOUND_SCREEN");return}else if(se instanceof Mt&&se.privyErrorCode==="linked_to_another_user"){n({errorModalData:{error:se,previousScreen:r??"AWAITING_PASSWORDLESS_CODE"}}),t("ERROR_SCREEN",!1);return}else R("Issue verifying code");D(0)}))},Ce=X=>{I===1&&(R(null),D(null));let te=[...b.slice(0,X),"",...b.slice(X+1)];T(te),X>0&&document.querySelector(`input[name=code-${X-1}]`)?.focus()},Ie=j==0?Lt(j0,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):Lt(Y0,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),Y=j==0?Po("p",{children:["Please check ",Lt(xh,{children:c()?.email})," for an email from privy.io and enter your code below."]}):Po("p",{children:["Please check ",Lt(xh,{children:c()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return Po(iw,{children:[Lt(A,{backFn:()=>o()},"header"),Po(X0,{children:[Lt(he,{title:"Enter confirmation code",description:Y,icon:Ie}),Po(bh,{children:[Po(ew,{children:[Lt(tw,{fail:!!x,success:k,children:Lt("span",{children:x||(k?"Success!":"")})}),Lt("div",{children:b.map((X,te)=>Lt("input",{name:`code-${te}`,type:"text",value:b[te],onChange:W,onKeyUp:_e=>{_e.key==="Backspace"&&Ce(te)},inputMode:"numeric",autoFocus:te===0,pattern:"[0-9]",className:`${k?"success":""} ${x?"fail":""}`,autoComplete:Z0?"one-time-code":"off"},te))})]}),Po(rw,{children:[Po("span",{children:["Didn't get ",j==0?"an email":"a message","?"]}),H?Po(nw,{children:[Lt(K0,{color:"var(--privy-color-foreground)",strokeWidth:1.33,height:"12px",width:"12px"}),Lt("span",{children:"Code sent"})]}):Lt(ow,{children:Lt("button",{onClick:async()=>{K(J0),j==0?await l():await s()},children:"Resend code"})})]})]})]}),Lt(z,{})]})},X0=Ln.div`
781
781
  display: flex;
782
782
  flex-direction: column;
783
783
  align-items: flex-start;
@@ -785,7 +785,7 @@ Resources:
785
785
  margin: auto;
786
786
  gap: 16px;
787
787
  flex-grow: 1;
788
- `,Y0=Wn.div`
788
+ `,ew=Ln.div`
789
789
  display: flex;
790
790
  flex-direction: column;
791
791
  width: 100%;
@@ -842,7 +842,7 @@ Resources:
842
842
  transform: translate(1px, 0px);
843
843
  }
844
844
  }
845
- `,Z0=Wn.div`
845
+ `,tw=Ln.div`
846
846
  line-height: 20px;
847
847
  height: 20px;
848
848
  font-size: 13px;
@@ -850,7 +850,7 @@ Resources:
850
850
  display: flex;
851
851
  justify-content: flex-end;
852
852
  width: 100%;
853
- `,Q0=Wn.div`
853
+ `,rw=Ln.div`
854
854
  font-size: 13px;
855
855
  color: var(--privy-color-foreground);
856
856
  display: flex;
@@ -861,13 +861,13 @@ Resources:
861
861
  // Equal opposing size buffer to account for auto margining when the
862
862
  // success/fail text does not show up
863
863
  padding-bottom: 32px;
864
- `,J0=Wn.div`
864
+ `,ow=Ln.div`
865
865
  color: var(--privy-color-accent);
866
866
  padding: 2px 0;
867
867
  > button {
868
868
  text-decoration: underline;
869
869
  }
870
- `,X0=Wn.div`
870
+ `,nw=Ln.div`
871
871
  display: flex;
872
872
  align-items: center;
873
873
  justify-content: center;
@@ -876,10 +876,10 @@ Resources:
876
876
  gap: 4px;
877
877
  background: var(--privy-color-background-2);
878
878
  color: var(--privy-color-foreground-2);
879
- `,Sh=Wn.span`
879
+ `,xh=Ln.span`
880
880
  font-weight: 500;
881
881
  word-break: break-all;
882
- `;import iw from"@heroicons/react/24/solid/CheckCircleIcon";import aw from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as qd,useRef as sw,useState as Ti}from"react";import lw from"styled-components";import tw from"styled-components";import{Fragment as nw,jsx as Ei,jsxs as ow}from"react/jsx-runtime";var Ph=({icon:e})=>{let t=e;return Ei(nw,{children:Ei(rw,{children:ow("div",{children:[Ei(ot,{}),typeof t=="string"?Ei("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):t?Ei(t,{style:{width:"38px",height:"38px"}}):Ei("span",{})]})})})},rw=tw.div`
882
+ `;import dw from"@heroicons/react/24/solid/CheckCircleIcon";import pw from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as $d,useRef as uw,useState as _i}from"react";import mw from"styled-components";import aw from"styled-components";import{Fragment as cw,jsx as Si,jsxs as lw}from"react/jsx-runtime";var Rh=({icon:e})=>{let t=e;return Si(cw,{children:Si(sw,{children:lw("div",{children:[Si(nt,{}),typeof t=="string"?Si("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):t?Si(t,{style:{width:"38px",height:"38px"}}):Si("span",{})]})})})},sw=aw.div`
883
883
  display: flex;
884
884
  flex-direction: column;
885
885
  justify-content: center;
@@ -902,14 +902,14 @@ Resources:
902
902
  left: -19px;
903
903
  top: -19px;
904
904
  }
905
- `;import{Fragment as dw,jsx as Br,jsxs as zd}from"react/jsx-runtime";var xh=500,Ah=xh*2,kh=()=>{let{lastScreen:e,currentScreen:t,data:r,navigateBack:o,navigate:n,setModalData:i}=P(),{status:a,token:l,waitForResult:s,reset:c,execute:m}=be(),f=sw([]),u=U=>{f.current=[U,...f.current]},[C,g]=Ti(!0);qd(()=>{let U=setTimeout(g,Ah,!1);return u(U),()=>{f.current.forEach(W=>clearTimeout(W)),f.current=[]}},[]);let[y,b]=Ti(""),[E,k]=Ti("Checking that you are a human..."),[T,A]=Ti(Br(B,{onClick:()=>{},disabled:!0,children:"Continue"})),[R,I]=Ti(!1),[D,H]=Ti(3),K=r?.captchaModalData,j=async U=>{try{await K?.callback(U),K?.onSuccessNavigateTo&&n(K?.onSuccessNavigateTo,!1)}catch(W){if(W instanceof nr)return;{let Ce={error:W,previousScreen:e||"LANDING"};i({errorModalData:Ce}),n(K?.onErrorNavigateTo||"ERROR_SCREEN",!1)}}};qd(()=>{if(a==="success"){let U=setTimeout(async()=>{let W=await s();!W||K?.userIntentRequired||j(W)},Ah);u(U)}else if(a==="ready"){let U=setTimeout(()=>{a==="ready"&&m()},xh);u(U)}},[a]),qd(()=>{if(!C)switch(a){case"success":b("Success!"),k("CAPTCHA passed successfully."),A(Br(B,{onClick:()=>{I(!0),j(l)},disabled:!K?.userIntentRequired,loading:R,children:K?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":b(""),k("Checking that you are a human..."),A(Br(B,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":b("Something went wrong"),D<=0?(k("If you use an adblocker or VPN, try disabling and re-attempting."),A(null)):(k("You did not pass CAPTCHA. Please try again."),A(Br(B,{onClick:O,children:"Retry"})));break;case"ready":default:break}},[a,C,R]);let O=async()=>{if(D<=0)return;H(W=>W-1),c(),m();let U=await s();!U||K?.userIntentRequired||j(U)};return zd(dw,{children:[Br(x,{backFn:!e||t===e?void 0:o}),zd(cw,{children:[a==="success"?Br(iw,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):a==="error"?Br(aw,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):Br(Ph,{}),zd(qe,{children:[y?Br("h3",{children:y}):null,Br("p",{children:E})]}),T]}),Br(Z,{})]})},cw=lw.div`
905
+ `;import{Fragment as hw,jsx as Br,jsxs as Kd}from"react/jsx-runtime";var Mh=500,Ih=Mh*2,Wh=()=>{let{lastScreen:e,currentScreen:t,data:r,navigateBack:o,navigate:n,setModalData:i}=_(),{status:a,token:l,waitForResult:s,reset:c,execute:m}=be(),f=uw([]),u=U=>{f.current=[U,...f.current]},[C,g]=_i(!0);$d(()=>{let U=setTimeout(g,Ih,!1);return u(U),()=>{f.current.forEach(W=>clearTimeout(W)),f.current=[]}},[]);let[y,b]=_i(""),[T,k]=_i("Checking that you are a human..."),[S,x]=_i(Br(B,{onClick:()=>{},disabled:!0,children:"Continue"})),[R,I]=_i(!1),[D,H]=_i(3),K=r?.captchaModalData,j=async U=>{try{await K?.callback(U),K?.onSuccessNavigateTo&&n(K?.onSuccessNavigateTo,!1)}catch(W){if(W instanceof ir)return;{let Ce={error:W,previousScreen:e||"LANDING"};i({errorModalData:Ce}),n(K?.onErrorNavigateTo||"ERROR_SCREEN",!1)}}};$d(()=>{if(a==="success"){let U=setTimeout(async()=>{let W=await s();!W||K?.userIntentRequired||j(W)},Ih);u(U)}else if(a==="ready"){let U=setTimeout(()=>{a==="ready"&&m()},Mh);u(U)}},[a]),$d(()=>{if(!C)switch(a){case"success":b("Success!"),k("CAPTCHA passed successfully."),x(Br(B,{onClick:()=>{I(!0),j(l)},disabled:!K?.userIntentRequired,loading:R,children:K?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":b(""),k("Checking that you are a human..."),x(Br(B,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":b("Something went wrong"),D<=0?(k("If you use an adblocker or VPN, try disabling and re-attempting."),x(null)):(k("You did not pass CAPTCHA. Please try again."),x(Br(B,{onClick:O,children:"Retry"})));break;case"ready":default:break}},[a,C,R]);let O=async()=>{if(D<=0)return;H(W=>W-1),c(),m();let U=await s();!U||K?.userIntentRequired||j(U)};return Kd(hw,{children:[Br(A,{backFn:!e||t===e?void 0:o}),Kd(fw,{children:[a==="success"?Br(dw,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):a==="error"?Br(pw,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):Br(Rh,{}),Kd(qe,{children:[y?Br("h3",{children:y}):null,Br("p",{children:T})]}),S]}),Br(Z,{})]})},fw=mw.div`
906
906
  display: flex;
907
907
  flex-direction: column;
908
908
  align-items: center;
909
909
  justify-content: center;
910
910
  gap: 24px;
911
911
  width: 100%;
912
- `;import{isMobile as Kh}from"react-device-detect";import jh from"styled-components";import pw from"@heroicons/react/24/outline/WalletIcon";import{jsx as $d}from"react/jsx-runtime";var El=({icon:e,name:t})=>typeof e=="string"?$d("img",{alt:`${t||"wallet"} logo`,src:e,style:{height:24,width:24,borderRadius:4}}):typeof e===void 0?$d(pw,{}):e?$d(e,{}):null;import fw,{css as Ih,keyframes as hw}from"styled-components";import{keyframes as uw,css as Rh}from"styled-components";var mw=uw`
912
+ `;import{isMobile as Qh}from"react-device-detect";import Jh from"styled-components";import yw from"@heroicons/react/24/outline/WalletIcon";import{jsx as jd}from"react/jsx-runtime";var Sl=({icon:e,name:t})=>typeof e=="string"?jd("img",{alt:`${t||"wallet"} logo`,src:e,style:{height:24,width:24,borderRadius:4}}):typeof e===void 0?jd(yw,{}):e?jd(e,{}):null;import Cw,{css as Lh,keyframes as ww}from"styled-components";import{keyframes as gw,css as Oh}from"styled-components";var vw=gw`
913
913
  from, to {
914
914
  background: var(--privy-color-foreground-4);
915
915
  color: var(--privy-color-foreground-4);
@@ -919,20 +919,20 @@ Resources:
919
919
  background: var(--privy-color-foreground-accent);
920
920
  color: var(--privy-color-foreground-accent);
921
921
  }
922
- `,Tl=Rh`
923
- ${e=>e.$isLoading?Rh`
922
+ `,_l=Oh`
923
+ ${e=>e.$isLoading?Oh`
924
924
  width: 35%;
925
- animation: ${mw} 2s linear infinite;
925
+ animation: ${vw} 2s linear infinite;
926
926
  border-radius: var(--privy-border-radius-sm);
927
927
  `:""}
928
- `;import{jsx as gw}from"react/jsx-runtime";var Xt=({children:e,color:t,isLoading:r,isPulsing:o,className:n})=>gw(yw,{$color:t,$isLoading:r,$isPulsing:o,className:n,children:e}),yw=fw.span`
928
+ `;import{jsx as Ew}from"react/jsx-runtime";var er=({children:e,color:t,isLoading:r,isPulsing:o,className:n})=>Ew(bw,{$color:t,$isLoading:r,$isPulsing:o,className:n,children:e}),bw=Cw.span`
929
929
  padding: 0.125rem 0.5rem;
930
930
  font-size: 0.75rem;
931
931
  font-weight: 500;
932
932
  line-height: 1.125rem; /* 150% */
933
933
  border-radius: var(--privy-border-radius-sm);
934
934
 
935
- ${e=>{let t,r;e.$color==="green"&&(t="var(--privy-color-success-dark)",r="var(--privy-color-success-light)"),e.$color==="red"&&(t="var(--privy-color-error)",r="var(--privy-color-error-light)"),e.$color==="gray"&&(t="var(--privy-color-foreground-2)",r="var(--privy-color-background-2)");let o=hw`
935
+ ${e=>{let t,r;e.$color==="green"&&(t="var(--privy-color-success-dark)",r="var(--privy-color-success-light)"),e.$color==="red"&&(t="var(--privy-color-error)",r="var(--privy-color-error-light)"),e.$color==="gray"&&(t="var(--privy-color-foreground-2)",r="var(--privy-color-background-2)");let o=ww`
936
936
  from, to {
937
937
  background-color: ${r};
938
938
  }
@@ -940,16 +940,16 @@ Resources:
940
940
  50% {
941
941
  background-color: rgba(${r}, 0.8);
942
942
  }
943
- `;return Ih`
943
+ `;return Lh`
944
944
  color: ${t};
945
945
  background-color: ${r};
946
- ${e.$isPulsing&&Ih`
946
+ ${e.$isPulsing&&Lh`
947
947
  animation: ${o} 3s linear infinite;
948
948
  `};
949
949
  `}}
950
950
 
951
- ${Tl}
952
- `;import{GlobeAltIcon as Cw}from"@heroicons/react/24/outline";import{jsx as Hr,jsxs as Mh}from"react/jsx-runtime";var Wh=({...e})=>Mh("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...e,children:[Hr("defs",{children:Mh("linearGradient",{id:"brave-linear-gradient",x1:"-18.79",y1:"359.73",x2:"194.32",y2:"359.73",gradientTransform:"matrix(2.05, 0, 0, -2.05, 38.49, 992.77)",gradientUnits:"userSpaceOnUse",children:[Hr("stop",{offset:"0",stopColor:"#f1562b"}),Hr("stop",{offset:"0.3",stopColor:"#f1542b"}),Hr("stop",{offset:"0.41",stopColor:"#f04d2a"}),Hr("stop",{offset:"0.49",stopColor:"#ef4229"}),Hr("stop",{offset:"0.5",stopColor:"#ef4029"}),Hr("stop",{offset:"0.56",stopColor:"#e83e28"}),Hr("stop",{offset:"0.67",stopColor:"#e13c26"}),Hr("stop",{offset:"1",stopColor:"#df3c26"})]})}),Hr("path",{style:{fill:"url(#brave-linear-gradient)"},d:"M436.49,165.63,420.7,122.75l11-24.6A8.47,8.47,0,0,0,430,88.78L400.11,58.6a48.16,48.16,0,0,0-50.23-11.66l-8.19,2.89L296.09.43,218.25,0,140.4.61,94.85,50.41l-8.11-2.87A48.33,48.33,0,0,0,36.19,59.3L5.62,90.05a6.73,6.73,0,0,0-1.36,7.47l11.47,25.56L0,165.92,56.47,380.64a89.7,89.7,0,0,0,34.7,50.23l111.68,75.69a24.73,24.73,0,0,0,30.89,0l111.62-75.8A88.86,88.86,0,0,0,380,380.53l46.07-176.14Z"}),Hr("path",{style:{fill:"#fff"},d:"M231,317.33a65.61,65.61,0,0,0-9.11-3.3h-5.49a66.08,66.08,0,0,0-9.11,3.3l-13.81,5.74-15.6,7.18-25.4,13.24a4.84,4.84,0,0,0-.62,9l22.06,15.49q7,5,13.55,10.76l6.21,5.35,13,11.37,5.89,5.2a10.15,10.15,0,0,0,12.95,0l25.39-22.18,13.6-10.77,22.06-15.79a4.8,4.8,0,0,0-.68-8.93l-25.36-12.8L244.84,323ZM387.4,175.2l.8-2.3a61.26,61.26,0,0,0-.57-9.18,73.51,73.51,0,0,0-8.19-15.44l-14.35-21.06-10.22-13.88-19.23-24a69.65,69.65,0,0,0-5.7-6.67h-.4L321,84.25l-42.27,8.14a33.49,33.49,0,0,1-12.59-1.84l-23.21-7.5-16.61-4.59a70.52,70.52,0,0,0-14.67,0L195,83.1l-23.21,7.54a33.89,33.89,0,0,1-12.59,1.84l-42.22-8-8.54-1.58h-.4a65.79,65.79,0,0,0-5.7,6.67l-19.2,24Q77.81,120.32,73,127.45L58.61,148.51l-6.78,11.31a51,51,0,0,0-1.94,13.35l.8,2.3A34.51,34.51,0,0,0,52,179.81l11.33,13,50.23,53.39a14.31,14.31,0,0,1,2.55,14.34L107.68,280a25.23,25.23,0,0,0-.39,16l1.64,4.52a43.58,43.58,0,0,0,13.39,18.76l7.89,6.43a15,15,0,0,0,14.35,1.72L172.62,314A70.38,70.38,0,0,0,187,304.52l22.46-20.27a9,9,0,0,0,3-6.36,9.08,9.08,0,0,0-2.5-6.56L159.2,237.18a9.83,9.83,0,0,1-3.09-12.45l19.66-36.95a19.21,19.21,0,0,0,1-14.67A22.37,22.37,0,0,0,165.58,163L103.94,139.8c-4.44-1.6-4.2-3.6.51-3.88l36.2-3.59a55.9,55.9,0,0,1,16.9,1.5l31.5,8.8a9.64,9.64,0,0,1,6.74,10.76L183.42,221a34.72,34.72,0,0,0-.61,11.41c.5,1.61,4.73,3.6,9.36,4.73l19.19,4a46.38,46.38,0,0,0,16.86,0l17.26-4c4.64-1,8.82-3.23,9.35-4.85a34.94,34.94,0,0,0-.63-11.4l-12.45-67.59a9.66,9.66,0,0,1,6.74-10.76l31.5-8.83a55.87,55.87,0,0,1,16.9-1.5l36.2,3.37c4.74.44,5,2.2.54,3.88L272,162.79a22.08,22.08,0,0,0-11.16,10.12,19.3,19.3,0,0,0,1,14.67l19.69,36.95A9.84,9.84,0,0,1,278.45,237l-50.66,34.23a9,9,0,0,0,.32,12.78l.15.14,22.49,20.27a71.46,71.46,0,0,0,14.35,9.47l28.06,13.35a14.89,14.89,0,0,0,14.34-1.76l7.9-6.45a43.53,43.53,0,0,0,13.38-18.8l1.65-4.52a25.27,25.27,0,0,0-.39-16l-8.26-19.49a14.4,14.4,0,0,1,2.55-14.35l50.23-53.45,11.3-13a35.8,35.8,0,0,0,1.54-4.24Z"})]});import{jsx as Oh,jsxs as vw}from"react/jsx-runtime";var Lh=({...e})=>vw("svg",{width:"146",height:"146",viewBox:"0 0 146 146",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[Oh("circle",{cx:"73",cy:"73",r:"73",fill:"#0052FF"}),Oh("path",{d:"M73.323 123.729C101.617 123.729 124.553 100.832 124.553 72.5875C124.553 44.343 101.617 21.4463 73.323 21.4463C46.4795 21.4463 24.4581 42.0558 22.271 68.2887H89.9859V76.8864H22.271C24.4581 103.119 46.4795 123.729 73.323 123.729Z",fill:"white"})]});import{jsx as Gr,jsxs as Sa}from"react/jsx-runtime";var Nh=({style:e,...t})=>Sa("svg",{width:"400",height:"400",viewBox:"0 0 400 400",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[Gr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"}),Gr("mask",{id:"mask0_16909_31415",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"400",height:"400",children:Gr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"})}),Sa("g",{mask:"url(#mask0_16909_31415)",children:[Gr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501Z",fill:"#FEFEFE"}),Gr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501ZM144.359 109.116H254.873L268.197 164.788H131.538L144.359 109.116ZM176.201 204.291L164.148 173.197H235.711L223.913 204.291L227.339 239.028L199.804 239.154H172.522L176.201 204.291ZM211.354 275.892V264.862L236.093 241.414V204.417L268.451 183.607L305.376 211.066L255.119 297.589H235.203L211.354 275.892ZM94.2395 211.066L131.282 183.857L164.021 204.417V241.414L188.76 264.862V275.892L164.913 297.84H144.734L94.2395 211.066Z",fill:"#002D72"}),Gr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M255.12 297.589H235.202L211.355 275.892V264.862L236.094 241.414V204.417L268.45 183.607L305.377 211.066L255.12 297.589ZM199.803 39.8498V109.117H254.872L268.198 164.789H199.803V173.199H235.712L223.914 204.291L227.338 239.028L199.803 239.153V360.296L340.231 280.181V119.957L199.803 39.8498Z",fill:"url(#paint0_linear_16909_31415)",style:{mixBlendMode:"multiply"}}),Gr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M188.761 275.892L164.912 297.84H144.734L94.2389 211.066L131.283 183.858L164.022 204.417V241.414L188.761 264.862V275.892ZM172.522 239.153L176.2 204.291L164.149 173.199H199.803V164.789H131.537L144.36 109.117H199.803V39.8498L59.375 119.957V280.181L199.803 360.296V239.153H172.522Z",fill:"url(#paint1_linear_16909_31415)",style:{mixBlendMode:"multiply"}})]}),Sa("defs",{children:[Sa("linearGradient",{id:"paint0_linear_16909_31415",x1:"325.255",y1:"325.727",x2:"325.255",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[Gr("stop",{stopColor:"#002D72"}),Gr("stop",{offset:"1",stopColor:"#002D72",stopOpacity:"0.01"})]}),Sa("linearGradient",{id:"paint1_linear_16909_31415",x1:"184.827",y1:"325.727",x2:"184.827",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[Gr("stop",{stopColor:"#002D72",stopOpacity:"0.01"}),Gr("stop",{offset:"1",stopColor:"#002D72"})]})]})]});import{jsx as ar,jsxs as Si}from"react/jsx-runtime";var Dh=e=>Si("svg",{width:"52",height:"52",viewBox:"0 0 52 52",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[ar("rect",{width:"52",height:"52",rx:"26",fill:"#7084FF"}),ar("path",{d:"M43.6781 28.2954C45.1053 25.0988 38.0498 16.168 31.3094 12.4472C27.0608 9.56481 22.6337 9.96081 21.737 11.2264C19.7693 14.0039 28.2527 16.3574 33.9263 19.1037C32.7067 19.6348 31.5574 20.5879 30.8816 21.8067C28.7664 19.4915 24.1239 17.4977 18.6765 19.1037C15.0056 20.186 11.9547 22.7374 10.7756 26.5911C10.4891 26.4635 10.1719 26.3925 9.83814 26.3925C8.56192 26.3925 7.52734 27.4298 7.52734 28.7094C7.52734 29.989 8.56192 31.0263 9.83814 31.0263C10.0747 31.0263 10.8143 30.8672 10.8143 30.8672L22.6337 30.953C17.9068 38.4713 14.1713 39.5704 14.1713 40.8729C14.1713 42.1754 17.7455 41.8224 19.0876 41.3369C25.5121 39.0127 32.4123 31.7692 33.5964 29.6841C38.5688 30.3061 42.7476 30.3796 43.6781 28.2954Z",fill:"url(#paint0_linear_81034_11443)"}),ar("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M33.8741 19.076C33.8926 19.084 33.911 19.092 33.9294 19.1001C34.1923 18.9962 34.1498 18.6068 34.0776 18.301C33.9116 17.5981 31.0479 14.7629 28.3588 13.493C24.6934 11.762 21.9946 11.8518 21.5972 12.65C22.3407 14.1849 25.8031 15.6258 29.4193 17.1308C30.9407 17.7639 32.4893 18.4084 33.8741 19.076Z",fill:"url(#paint1_linear_81034_11443)"}),ar("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M29.272 34.5374C28.5323 34.2543 27.697 33.9945 26.7477 33.7587C27.7625 31.9382 27.9754 29.2432 27.0171 27.5392C25.6721 25.1478 23.9838 23.875 20.0605 23.875C17.9027 23.875 12.093 24.6037 11.9899 29.4663C11.9791 29.9743 11.9895 30.44 12.026 30.8685L22.6335 30.9456C21.2017 33.2229 19.8609 34.9113 18.6873 36.1947C20.0979 36.5571 21.2615 36.8612 22.3297 37.1404C23.3394 37.4043 24.2638 37.646 25.2309 37.8934C26.6941 36.8249 28.0698 35.6597 29.272 34.5374Z",fill:"url(#paint2_linear_81034_11443)"}),ar("path",{d:"M10.6324 30.3712C11.0658 34.065 13.1596 35.5127 17.4381 35.9411C21.7166 36.3695 24.1708 36.0821 27.4381 36.3801C30.167 36.6291 32.6036 38.0233 33.5075 37.5415C34.321 37.1079 33.8659 35.5412 32.7774 34.5361C31.3663 33.2333 29.4135 32.3274 25.9773 32.006C26.6621 30.1261 26.4702 27.4903 25.4067 26.0562C23.8689 23.9827 21.0305 23.0453 17.4381 23.4549C13.6848 23.8828 10.0885 25.7354 10.6324 30.3712Z",fill:"url(#paint3_linear_81034_11443)"}),Si("defs",{children:[Si("linearGradient",{id:"paint0_linear_81034_11443",x1:"18.249",y1:"25.4646",x2:"43.3806",y2:"32.5728",gradientUnits:"userSpaceOnUse",children:[ar("stop",{stopColor:"white"}),ar("stop",{offset:"1",stopColor:"white"})]}),Si("linearGradient",{id:"paint1_linear_81034_11443",x1:"39.1432",y1:"24.9813",x2:"20.9691",y2:"6.81008",gradientUnits:"userSpaceOnUse",children:[ar("stop",{stopColor:"#8697FF"}),ar("stop",{offset:"1",stopColor:"#8697FF",stopOpacity:"0"})]}),Si("linearGradient",{id:"paint2_linear_81034_11443",x1:"29.7761",y1:"35.1727",x2:"12.345",y2:"25.1792",gradientUnits:"userSpaceOnUse",children:[ar("stop",{stopColor:"#8697FF"}),ar("stop",{offset:"1",stopColor:"#8697FF",stopOpacity:"0"})]}),Si("linearGradient",{id:"paint3_linear_81034_11443",x1:"19.7472",y1:"25.2716",x2:"31.5549",y2:"40.2352",gradientUnits:"userSpaceOnUse",children:[ar("stop",{stopColor:"white"}),ar("stop",{offset:"0.983895",stopColor:"#D1D8FF"})]})]})]});import{jsx as pe,jsxs as sr}from"react/jsx-runtime";var Uh=({style:e,...t})=>sr("svg",{width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[pe("g",{clipPath:"url(#clip0_5_32)",children:sr("g",{clipPath:"url(#clip1_5_32)",children:[pe("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:pe("path",{d:"M78.163 0H41.837C29.79 0 23.767 0 17.283 2.04999C10.203 4.62701 4.627 10.203 2.05 17.283C0 23.767 0 29.791 0 41.837V78.163C0 90.21 0 96.232 2.05 102.717C4.627 109.797 10.203 115.373 17.283 117.949C23.767 120 29.79 120 41.837 120H78.163C90.21 120 96.232 120 102.717 117.949C109.797 115.373 115.373 109.797 117.95 102.717C120 96.232 120 90.21 120 78.163V41.837C120 29.791 120 23.767 117.95 17.283C115.373 10.203 109.797 4.62701 102.717 2.04999C96.232 0 90.21 0 78.163 0Z",fill:"black"})}),pe("g",{mask:"url(#mask0_5_32)",children:pe("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),pe("path",{d:"M20 38H26C56.9279 38 82 63.0721 82 94V100H94C97.3137 100 100 97.3137 100 94C100 53.1309 66.8691 20 26 20C22.6863 20 20 22.6863 20 26V38Z",fill:"url(#paint1_radial_5_32)"}),pe("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),pe("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),pe("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),pe("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),pe("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),pe("path",{d:"M20 62C20 65.3137 22.6863 68 26 68C40.3594 68 52 79.6406 52 94C52 97.3137 54.6863 100 58 100H68V94C68 70.804 49.196 52 26 52H20V62Z",fill:"url(#paint7_radial_5_32)"}),pe("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),pe("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),sr("defs",{children:[sr("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[pe("stop",{stopColor:"#174299"}),pe("stop",{offset:"1",stopColor:"#001E59"})]}),sr("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[pe("stop",{offset:"0.770277",stopColor:"#FF4000"}),pe("stop",{offset:"1",stopColor:"#8754C9"})]}),sr("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[pe("stop",{stopColor:"#FF4000"}),pe("stop",{offset:"1",stopColor:"#8754C9"})]}),sr("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[pe("stop",{stopColor:"#8754C9"}),pe("stop",{offset:"1",stopColor:"#FF4000"})]}),sr("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[pe("stop",{offset:"0.723929",stopColor:"#FFF700"}),pe("stop",{offset:"1",stopColor:"#FF9901"})]}),sr("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[pe("stop",{stopColor:"#FFF700"}),pe("stop",{offset:"1",stopColor:"#FF9901"})]}),sr("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[pe("stop",{stopColor:"#FFF700"}),pe("stop",{offset:"1",stopColor:"#FF9901"})]}),sr("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[pe("stop",{offset:"0.59513",stopColor:"#00AAFF"}),pe("stop",{offset:"1",stopColor:"#01DA40"})]}),sr("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[pe("stop",{stopColor:"#00AAFF"}),pe("stop",{offset:"1",stopColor:"#01DA40"})]}),sr("radialGradient",{id:"paint9_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(23 69) rotate(-90) scale(17 322.37)",children:[pe("stop",{stopColor:"#00AAFF"}),pe("stop",{offset:"1",stopColor:"#01DA40"})]}),pe("clipPath",{id:"clip0_5_32",children:pe("rect",{width:"120",height:"120",fill:"white"})}),pe("clipPath",{id:"clip1_5_32",children:pe("rect",{width:"120",height:"120",fill:"white"})})]})]});import{jsx as so,jsxs as Fh}from"react/jsx-runtime";var Bh=({style:e,...t})=>Fh("svg",{width:"96",height:"96",viewBox:"0 0 96 96",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[so("rect",{width:"96",height:"96",rx:"18",fill:"#FEF4FF"}),Fh("g",{filter:"url(#filter0_d_12393_20043)",children:[so("path",{d:"M71.9367 18.39C72.0482 16.4526 72.3145 15.1746 72.8497 14.0075C73.0616 13.5456 73.2601 13.1675 73.2907 13.1675C73.3214 13.1675 73.2293 13.5085 73.086 13.9252C72.6969 15.0578 72.633 16.607 72.901 18.4094C73.2413 20.6963 73.4348 21.0263 75.8841 23.4967C77.0329 24.6554 78.3692 26.1168 78.8536 26.7443L79.7343 27.8851L78.8536 27.0698C77.7764 26.0728 75.2992 24.1283 74.7521 23.8503C74.3852 23.6639 74.3306 23.6671 74.1043 23.8894C73.8958 24.0943 73.8519 24.4021 73.8229 25.8572C73.7778 28.125 73.4646 29.5807 72.7087 31.0362C72.2998 31.8234 72.2354 31.6554 72.6053 30.7668C72.8816 30.1034 72.9096 29.8117 72.9076 27.6163C72.9033 23.2052 72.3727 22.1447 69.2607 20.3281C68.4724 19.8678 67.1734 19.2041 66.3742 18.8531C65.575 18.502 64.9401 18.1962 64.9633 18.1734C65.0514 18.0868 68.0863 18.961 69.3077 19.4247C71.1247 20.1145 71.4247 20.2039 71.6454 20.1207C71.7933 20.0649 71.8648 19.6398 71.9367 18.39Z",fill:"#F50DB4"}),so("path",{d:"M33.5466 11.9727C32.4688 11.808 32.4233 11.7887 32.9306 11.7119C33.9026 11.5647 36.1979 11.7653 37.7796 12.1358C41.4722 13.0004 44.8322 15.2153 48.4188 19.1488L49.3717 20.1938L50.7348 19.978C56.4773 19.0689 62.3192 19.7914 67.2054 22.0148C68.5495 22.6265 70.6689 23.8441 70.9337 24.157C71.018 24.2568 71.173 24.8987 71.2779 25.5837C71.6408 27.9534 71.4591 29.7699 70.7234 31.1265C70.3229 31.8648 70.3006 32.0988 70.5698 32.7306C70.7847 33.2348 71.3838 33.608 71.9771 33.6072C73.1913 33.6056 74.4983 31.6721 75.1038 28.9818L75.3443 27.9131L75.8209 28.4448C78.4346 31.3619 80.4876 35.34 80.8403 38.1716L80.9321 38.9099L80.4928 38.2387C79.7366 37.0838 78.9769 36.2976 78.0041 35.6635C76.2504 34.5205 74.3961 34.1315 69.4853 33.8766C65.0501 33.6464 62.5399 33.2732 60.0509 32.4737C55.816 31.1137 53.6812 29.3023 48.6508 22.8012C46.4164 19.9135 45.0354 18.3159 43.6616 17.0293C40.5401 14.1058 37.4729 12.5726 33.5466 11.9727Z",fill:"#F50DB4"}),so("path",{d:"M35.6404 25.9564C33.4522 22.9889 32.0983 18.4391 32.3914 15.0379L32.482 13.9854L32.9801 14.0749C33.9155 14.243 35.5283 14.8343 36.2835 15.2861C38.3559 16.5259 39.253 18.1582 40.1658 22.3496C40.4332 23.5773 40.7839 24.9666 40.9454 25.437C41.2052 26.194 42.1871 27.9624 42.9854 29.1109C43.5605 29.938 43.1785 30.33 41.9074 30.217C39.9662 30.0444 37.3367 28.2568 35.6404 25.9564Z",fill:"#F50DB4"}),so("path",{d:"M69.2799 48.0419C59.0538 43.9862 55.4521 40.4658 55.4521 34.5259C55.4521 33.6517 55.4827 32.9365 55.5199 32.9365C55.5572 32.9365 55.9528 33.225 56.3991 33.5776C58.4728 35.216 60.7949 35.9157 67.2233 36.8395C71.0061 37.3831 73.1349 37.8222 75.0986 38.4637C81.3402 40.5027 85.2018 44.6406 86.1227 50.2766C86.3903 51.9143 86.2334 54.9854 85.7995 56.6039C85.457 57.8824 84.4118 60.1868 84.1346 60.2751C84.0578 60.2996 83.9824 60.0094 83.9626 59.6147C83.8575 57.4983 82.7718 55.438 80.9485 53.8946C78.8754 52.1399 76.0901 50.7428 69.2799 48.0419Z",fill:"#F50DB4"}),so("path",{d:"M62.1008 49.7268C61.9727 48.9758 61.7505 48.0167 61.607 47.5954L61.3461 46.8296L61.8307 47.3655C62.5014 48.107 63.0314 49.0559 63.4806 50.3197C63.8234 51.2843 63.862 51.5711 63.8594 53.1386C63.8568 54.6774 63.814 55 63.4974 55.8682C62.9983 57.2373 62.3788 58.208 61.3392 59.2501C59.4712 61.1228 57.0696 62.1596 53.6039 62.5896C53.0015 62.6643 51.2456 62.7902 49.7019 62.8693C45.8118 63.0686 43.2515 63.4803 40.9508 64.276C40.6201 64.3905 40.3247 64.4601 40.2948 64.4305C40.2017 64.3393 41.768 63.4195 43.0618 62.8056C44.8862 61.94 46.7021 61.4676 50.7709 60.8002C52.7809 60.4704 54.8566 60.0704 55.3837 59.9112C60.3612 58.4079 62.9197 54.5286 62.1008 49.7268Z",fill:"#F50DB4"}),so("path",{d:"M66.7886 57.9275C65.4299 55.0505 65.1179 52.2726 65.8623 49.6821C65.942 49.4053 66.07 49.1787 66.1471 49.1787C66.224 49.1787 66.5447 49.3495 66.8594 49.5581C67.4855 49.9732 68.7412 50.6725 72.0866 52.4692C76.2612 54.7111 78.6414 56.4472 80.2599 58.4306C81.6775 60.1677 82.5547 62.1459 82.9769 64.5583C83.2159 65.9248 83.0759 69.2128 82.7199 70.5889C81.5975 74.9275 78.9889 78.3356 75.2682 80.3242C74.7231 80.6155 74.2337 80.8547 74.1807 80.8558C74.1278 80.8569 74.3264 80.3594 74.6222 79.7503C75.8738 77.173 76.0163 74.6661 75.07 71.8756C74.4906 70.1671 73.3092 68.0823 70.924 64.5588C68.1507 60.4623 67.4708 59.3721 66.7886 57.9275Z",fill:"#F50DB4"}),so("path",{d:"M28.3782 73.4506C32.173 70.2943 36.8948 68.0521 41.1958 67.3639C43.0494 67.0672 46.1372 67.185 47.8537 67.6178C50.605 68.3113 53.0662 69.8648 54.3462 71.7156C55.5971 73.5245 56.1338 75.1008 56.6925 78.6081C56.913 79.9916 57.1527 81.3809 57.2252 81.6954C57.6449 83.5131 58.4614 84.966 59.4733 85.6957C61.0805 86.8544 63.8479 86.9265 66.5704 85.8804C67.0325 85.7028 67.4336 85.5801 67.4618 85.6078C67.5605 85.7044 66.1896 86.6083 65.2225 87.0842C63.9212 87.7245 62.8864 87.972 61.5115 87.972C59.0181 87.972 56.948 86.7226 55.2206 84.175C54.8807 83.6736 54.1167 82.1718 53.5228 80.8378C51.699 76.7403 50.7984 75.4921 48.6809 74.126C46.8381 72.9374 44.4615 72.7245 42.6736 73.588C40.325 74.7223 39.6698 77.6786 41.3518 79.5521C42.0204 80.2967 43.2671 80.939 44.2865 81.0638C46.1936 81.2975 47.8326 79.8684 47.8326 77.9717C47.8326 76.7402 47.352 76.0374 46.1423 75.4996C44.4901 74.7652 42.7141 75.6237 42.7226 77.1526C42.7263 77.8045 43.0145 78.214 43.6779 78.5097C44.1036 78.6994 44.1134 78.7144 43.7664 78.6434C42.2504 78.3337 41.8952 76.5335 43.1141 75.3383C44.5776 73.9036 47.6037 74.5367 48.6428 76.4951C49.0794 77.3177 49.1301 78.956 48.7495 79.9452C47.8976 82.1593 45.4138 83.3237 42.8941 82.6901C41.1787 82.2587 40.4801 81.7915 38.4119 79.6931C34.8179 76.0462 33.4226 75.3396 28.2413 74.5428L27.2484 74.3902L28.3782 73.4506Z",fill:"#F50DB4"}),so("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.5147 8.18128C23.517 22.5305 31.7835 28.4507 32.7022 29.7015C33.4607 30.7343 33.1752 31.6628 31.8758 32.3905C31.1532 32.7951 29.6676 33.205 28.9238 33.205C28.0825 33.205 27.7936 32.8853 27.7936 32.8853C27.3058 32.4296 27.0311 32.5093 24.5261 28.1293C21.0483 22.8137 18.1379 18.4041 18.0585 18.3303C17.8749 18.1596 17.878 18.1653 24.1715 29.2574C25.1883 31.5693 24.3737 32.4179 24.3737 32.7471C24.3737 33.417 24.1882 33.7691 23.3494 34.6907C21.951 36.2274 21.3259 37.954 20.8746 41.5274C20.3687 45.5332 18.9462 48.3629 15.0041 53.2057C12.6965 56.0406 12.3189 56.5602 11.7366 57.7028C11.0032 59.1416 10.8015 59.9475 10.7198 61.7645C10.6334 63.6855 10.8016 64.9265 11.3975 66.7632C11.9191 68.3712 12.4636 69.433 13.8555 71.5567C15.0568 73.3894 15.7484 74.7513 15.7484 75.2841C15.7484 75.708 15.8306 75.7085 17.692 75.2945C22.1466 74.3036 25.7638 72.5609 27.7981 70.4252C29.0571 69.1033 29.3527 68.3733 29.3623 66.5619C29.3686 65.377 29.3263 65.1289 29.0011 64.4473C28.4718 63.3379 27.5083 62.4154 25.3845 60.9853C22.6019 59.1115 21.4133 57.603 21.085 55.5285C20.8157 53.8263 21.1282 52.6253 22.6676 49.4472C24.2609 46.1575 24.6558 44.7557 24.9229 41.4399C25.0954 39.2977 25.3343 38.4528 25.9591 37.7747C26.6108 37.0676 27.1975 36.8281 28.8103 36.611C31.4396 36.2572 33.1139 35.5871 34.4901 34.3379C35.6839 33.2543 36.1835 32.2101 36.2602 30.6382L36.3184 29.4468L35.6512 28.6806C33.2352 25.9057 9.89667 6 9.74799 6C9.71623 6 10.5113 6.98164 11.5147 8.18128ZM17.1047 63.9381C17.6509 62.9852 17.3607 61.7601 16.447 61.1617C15.5836 60.5962 14.2424 60.8625 14.2424 61.5994C14.2424 61.8243 14.3687 61.9879 14.6532 62.1322C15.1322 62.375 15.167 62.648 14.7901 63.2061C14.4084 63.7712 14.4392 64.2681 14.877 64.6057C15.5826 65.15 16.5815 64.8507 17.1047 63.9381Z",fill:"#F50DB4"}),so("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M37.9777 37.236C36.7433 37.6095 35.5435 38.8981 35.172 40.2493C34.9454 41.0736 35.074 42.5196 35.4134 42.9662C35.9617 43.6874 36.492 43.8774 37.9277 43.8675C40.7388 43.8482 43.1825 42.6606 43.4666 41.176C43.6994 39.9591 42.6262 38.2726 41.1478 37.5321C40.385 37.1502 38.7626 36.9987 37.9777 37.236ZM41.2638 39.7671C41.6973 39.1604 41.5076 38.5047 40.7704 38.0611C39.3664 37.2167 37.2432 37.9155 37.2432 39.222C37.2432 39.8724 38.3504 40.5819 39.3653 40.5819C40.0408 40.5819 40.9652 40.1851 41.2638 39.7671Z",fill:"#F50DB4"})]})]});import{jsx as _a,jsxs as Hh}from"react/jsx-runtime";var Gh=({style:e,...t})=>Hh("svg",{width:"176",height:"176",viewBox:"0 0 176 176",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[Hh("g",{clipPath:"url(#clip0_1704_1423)",children:[_a("path",{d:"M126.233 176H49.7672C22.287 176 0 153.723 0 126.233V49.7673C0 22.287 22.2769 0 49.7672 0H126.233C153.713 0 176 22.277 176 49.7673V126.233C176 153.723 153.713 176 126.233 176Z",fill:"#2461ED"}),_a("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M100.667 85.6591C83.4133 76.3353 62.4196 64.2443 46.6192 54.3891C41.9573 51.0306 44.3234 43.9023 49.9578 43.9023H128.138C132.499 43.9023 135.416 48.7648 133.231 52.4442C127.977 61.5174 120.308 73.0368 113.901 82.1702C110.462 87.0727 104.858 87.9149 100.667 85.6591ZM75.5031 88.6867C92.1858 97.5795 115.566 111.104 132.178 121.33C137.311 124.498 135.266 132.098 129.271 132.098C119.46 132.098 103.518 132.1 87.6592 132.103C71.9639 132.105 56.3497 132.108 46.8398 132.108C42.0476 132.108 39.5913 127.135 41.6265 123.666C48.5041 111.946 56.2338 100.116 62.6603 91.2834C65.5176 87.3433 71.3325 86.461 75.5031 88.6867Z",fill:"white"})]}),_a("defs",{children:_a("clipPath",{id:"clip0_1704_1423",children:_a("rect",{width:"176",height:"176",fill:"white"})})})]});import{jsx as Vh}from"react/jsx-runtime";var Ar={coinbase_wallet:{logo:So,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},coinbase_smart_wallet:{logo:So,displayName:"Coinbase Smart Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:di,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:to,displayName:"Phantom"},rainbow:{logo:Uh,displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:fa,displayName:"WalletConnect"},zerion:{logo:Gh,displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:Wh,displayName:"Brave Wallet",rdns:"com.brave.wallet"},cryptocom:{logo:Nh,displayName:"Crypto.com DeFi Wallet",rdns:"com.crypto.wallet"},uniswap:{logo:Bh,displayName:"Uniswap Wallet",rdns:"org.uniswap.app"},okx_wallet:{displayName:"OKX Wallet",rdns:"com.okex.wallet",logo:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJDSURBVHgB7Zq9jtpAEMfHlhEgQLiioXEkoAGECwoKxMcTRHmC5E3IoyRPkPAEkI7unJYmTgEFTYwA8a3NTKScLnCHN6c9r1e3P2llWQy7M/s1Gv1twCP0ej37dDq9x+Zut1t3t9vZjDEHIiSRSPg4ZpDL5fxkMvn1cDh8m0wmfugfO53OoFQq/crn8wxfY9EymQyrVCqMfHvScZx1p9ls3pFxXBy/bKlUipGPrVbLuQqAfsCliq3zl0H84zwtjQrOw4Mt1W63P5LvBm2d+Xz+YzqdgkqUy+WgWCy+Mc/nc282m4FqLBYL+3g8fjDxenq72WxANZbLJeA13zDX67UDioL5ybXwafMYu64Ltn3bdDweQ5R97fd7GyhBQMipx4POeEDHIu2LfDdBIGGz+hJ9CQ1ABjoA2egAZPM6AgiCAEQhsi/C4jHyPA/6/f5NG3Ks2+3CYDC4aTccDrn6ojG54MnEvG00GoVmWLIRNZ7wTCwDHYBsdACy0QHIhiuRETxlICWpMMhGZHmqS8qH6JLyGegAZKMDkI0uKf8X4SWlaZo+Pp1bRrwlJU8ZKLIvUjKh0WiQ3sRUbNVq9c5Ebew7KEo2m/1p4jJ4qAmDaqDQBzj5XyiAT4VCQezJigAU+IDU+z8vJFnGWeC+bKQV/5VZ71FV6L7PA3gg3tXrdQ+DgLhC+75Wq3no69P3MC0NFQpx2lL04Ql9gHK1bRDjsSBIvScBnDTk1WrlGIZBorIDEYJj+rhdgnQ67VmWRe0zlplXl81vcyEt0rSoYDUAAAAASUVORK5CYII="},rabby_wallet:{logo:Dh,displayName:"Rabby Wallet",rdns:"io.rabby.wallet"}},qo=(e,t,r)=>{if(Ar[e]?.displayName)return e==="coinbase_wallet"?Ar[r].displayName:Ar[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},Sl=(e,t,r)=>{if(Ar[e]?.logo)return e==="coinbase_wallet"?Ar[r].logo:Ar[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return fa},_l=(e,t)=>{let r=t?.height||16,o=t?.width||16;switch(e){case 8453:return Vh(Lh,{height:r,width:o});default:return Vh(Cw,{height:r,width:o})}};function _i(e){let t=e.toLowerCase();return!!window?.webkit?.messageHandlers?.ReactNativeWebView||!!window?.ReactNativeWebView||["fbav","fban","instagram","snapchat","linkedinapp"].some(n=>t.includes(n))}import{useContext as ww,useEffect as bw,useState as Ew}from"react";import{createContext as Tw}from"react";import{jsx as Sw}from"react/jsx-runtime";var zh=Tw({}),$h=({children:e})=>{let t=Ve(),[r,o]=Ew({});return Ae("login",{onComplete:(n,i,a,l,s)=>{!s||s.type==="passkey"||s.type==="cross_app"||s.type==="wallet"&&s.walletClientType==="privy"||(Q.put(qh(t.id),s.type),s.type==="wallet"?(Q.put(Kd(t.id),s.walletClientType),o({accountType:s.type,walletClientType:s.walletClientType})):(Q.del(Kd(t.id)),o({accountType:s.type})))}}),bw(()=>{if(!t.id)return;let n=Q.get(qh(t.id)),i=Q.get(Kd(t.id));n&&o(n==="wallet"?{accountType:n,walletClientType:i}:{accountType:n})},[t.id]),Sw(zh.Provider,{value:r,children:e})},qh=e=>`privy:${e}:recent-login-method`,Kd=e=>`privy:${e}:recent-login-wallet-client`,St=()=>ww(zh);import{jsx as Pl,jsxs as Aw}from"react/jsx-runtime";var On=({provider:e,displayName:t,logo:r,connectOnly:o,connector:n})=>{let{navigate:i}=P(),{connectWallet:a}=M(),l=St(),s=n.connectorType==="wallet_connect_v2"?e:n.walletClientType,c=window.matchMedia("(display-mode: standalone)").matches,m;return n.connectorType==="phantom"?m=()=>{No()?(a(n,s),i(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")):i(Kh?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:n.connectorType==="coinbase_wallet"&&n.connectionOptions==="eoaOnly"&&Kh&&!c&&!Ps()?m=()=>{window.location.href=`https://go.cb-w.com/dapp?cb_url=${encodeURI(window.location.href)}`}:m=()=>{_i(window.navigator.userAgent)&&!event?.isTrusted||(a(n,s),i(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION"))},Aw(_w,{onClick:m,children:[Pl(El,{icon:Sl(e,n.connectorType,n.walletClientType)??r,name:n.walletClientType}),Pl("span",{children:qo(e,n.connectorType,n.walletClientType)||t||n.walletClientType}),l?.walletClientType===s?Pl(Pw,{color:"gray",children:"Recent"}):Pl("span",{id:"connect-text",children:"Connect"})]})},_w=jh(Ee)`
951
+ ${_l}
952
+ `;import{GlobeAltIcon as Sw}from"@heroicons/react/24/outline";import{jsx as Hr,jsxs as Nh}from"react/jsx-runtime";var Dh=({...e})=>Nh("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...e,children:[Hr("defs",{children:Nh("linearGradient",{id:"brave-linear-gradient",x1:"-18.79",y1:"359.73",x2:"194.32",y2:"359.73",gradientTransform:"matrix(2.05, 0, 0, -2.05, 38.49, 992.77)",gradientUnits:"userSpaceOnUse",children:[Hr("stop",{offset:"0",stopColor:"#f1562b"}),Hr("stop",{offset:"0.3",stopColor:"#f1542b"}),Hr("stop",{offset:"0.41",stopColor:"#f04d2a"}),Hr("stop",{offset:"0.49",stopColor:"#ef4229"}),Hr("stop",{offset:"0.5",stopColor:"#ef4029"}),Hr("stop",{offset:"0.56",stopColor:"#e83e28"}),Hr("stop",{offset:"0.67",stopColor:"#e13c26"}),Hr("stop",{offset:"1",stopColor:"#df3c26"})]})}),Hr("path",{style:{fill:"url(#brave-linear-gradient)"},d:"M436.49,165.63,420.7,122.75l11-24.6A8.47,8.47,0,0,0,430,88.78L400.11,58.6a48.16,48.16,0,0,0-50.23-11.66l-8.19,2.89L296.09.43,218.25,0,140.4.61,94.85,50.41l-8.11-2.87A48.33,48.33,0,0,0,36.19,59.3L5.62,90.05a6.73,6.73,0,0,0-1.36,7.47l11.47,25.56L0,165.92,56.47,380.64a89.7,89.7,0,0,0,34.7,50.23l111.68,75.69a24.73,24.73,0,0,0,30.89,0l111.62-75.8A88.86,88.86,0,0,0,380,380.53l46.07-176.14Z"}),Hr("path",{style:{fill:"#fff"},d:"M231,317.33a65.61,65.61,0,0,0-9.11-3.3h-5.49a66.08,66.08,0,0,0-9.11,3.3l-13.81,5.74-15.6,7.18-25.4,13.24a4.84,4.84,0,0,0-.62,9l22.06,15.49q7,5,13.55,10.76l6.21,5.35,13,11.37,5.89,5.2a10.15,10.15,0,0,0,12.95,0l25.39-22.18,13.6-10.77,22.06-15.79a4.8,4.8,0,0,0-.68-8.93l-25.36-12.8L244.84,323ZM387.4,175.2l.8-2.3a61.26,61.26,0,0,0-.57-9.18,73.51,73.51,0,0,0-8.19-15.44l-14.35-21.06-10.22-13.88-19.23-24a69.65,69.65,0,0,0-5.7-6.67h-.4L321,84.25l-42.27,8.14a33.49,33.49,0,0,1-12.59-1.84l-23.21-7.5-16.61-4.59a70.52,70.52,0,0,0-14.67,0L195,83.1l-23.21,7.54a33.89,33.89,0,0,1-12.59,1.84l-42.22-8-8.54-1.58h-.4a65.79,65.79,0,0,0-5.7,6.67l-19.2,24Q77.81,120.32,73,127.45L58.61,148.51l-6.78,11.31a51,51,0,0,0-1.94,13.35l.8,2.3A34.51,34.51,0,0,0,52,179.81l11.33,13,50.23,53.39a14.31,14.31,0,0,1,2.55,14.34L107.68,280a25.23,25.23,0,0,0-.39,16l1.64,4.52a43.58,43.58,0,0,0,13.39,18.76l7.89,6.43a15,15,0,0,0,14.35,1.72L172.62,314A70.38,70.38,0,0,0,187,304.52l22.46-20.27a9,9,0,0,0,3-6.36,9.08,9.08,0,0,0-2.5-6.56L159.2,237.18a9.83,9.83,0,0,1-3.09-12.45l19.66-36.95a19.21,19.21,0,0,0,1-14.67A22.37,22.37,0,0,0,165.58,163L103.94,139.8c-4.44-1.6-4.2-3.6.51-3.88l36.2-3.59a55.9,55.9,0,0,1,16.9,1.5l31.5,8.8a9.64,9.64,0,0,1,6.74,10.76L183.42,221a34.72,34.72,0,0,0-.61,11.41c.5,1.61,4.73,3.6,9.36,4.73l19.19,4a46.38,46.38,0,0,0,16.86,0l17.26-4c4.64-1,8.82-3.23,9.35-4.85a34.94,34.94,0,0,0-.63-11.4l-12.45-67.59a9.66,9.66,0,0,1,6.74-10.76l31.5-8.83a55.87,55.87,0,0,1,16.9-1.5l36.2,3.37c4.74.44,5,2.2.54,3.88L272,162.79a22.08,22.08,0,0,0-11.16,10.12,19.3,19.3,0,0,0,1,14.67l19.69,36.95A9.84,9.84,0,0,1,278.45,237l-50.66,34.23a9,9,0,0,0,.32,12.78l.15.14,22.49,20.27a71.46,71.46,0,0,0,14.35,9.47l28.06,13.35a14.89,14.89,0,0,0,14.34-1.76l7.9-6.45a43.53,43.53,0,0,0,13.38-18.8l1.65-4.52a25.27,25.27,0,0,0-.39-16l-8.26-19.49a14.4,14.4,0,0,1,2.55-14.35l50.23-53.45,11.3-13a35.8,35.8,0,0,0,1.54-4.24Z"})]});import{jsx as Uh,jsxs as Tw}from"react/jsx-runtime";var Fh=({...e})=>Tw("svg",{width:"146",height:"146",viewBox:"0 0 146 146",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[Uh("circle",{cx:"73",cy:"73",r:"73",fill:"#0052FF"}),Uh("path",{d:"M73.323 123.729C101.617 123.729 124.553 100.832 124.553 72.5875C124.553 44.343 101.617 21.4463 73.323 21.4463C46.4795 21.4463 24.4581 42.0558 22.271 68.2887H89.9859V76.8864H22.271C24.4581 103.119 46.4795 123.729 73.323 123.729Z",fill:"white"})]});import{jsx as Gr,jsxs as _a}from"react/jsx-runtime";var Bh=({style:e,...t})=>_a("svg",{width:"400",height:"400",viewBox:"0 0 400 400",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[Gr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"}),Gr("mask",{id:"mask0_16909_31415",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"400",height:"400",children:Gr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"})}),_a("g",{mask:"url(#mask0_16909_31415)",children:[Gr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501Z",fill:"#FEFEFE"}),Gr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501ZM144.359 109.116H254.873L268.197 164.788H131.538L144.359 109.116ZM176.201 204.291L164.148 173.197H235.711L223.913 204.291L227.339 239.028L199.804 239.154H172.522L176.201 204.291ZM211.354 275.892V264.862L236.093 241.414V204.417L268.451 183.607L305.376 211.066L255.119 297.589H235.203L211.354 275.892ZM94.2395 211.066L131.282 183.857L164.021 204.417V241.414L188.76 264.862V275.892L164.913 297.84H144.734L94.2395 211.066Z",fill:"#002D72"}),Gr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M255.12 297.589H235.202L211.355 275.892V264.862L236.094 241.414V204.417L268.45 183.607L305.377 211.066L255.12 297.589ZM199.803 39.8498V109.117H254.872L268.198 164.789H199.803V173.199H235.712L223.914 204.291L227.338 239.028L199.803 239.153V360.296L340.231 280.181V119.957L199.803 39.8498Z",fill:"url(#paint0_linear_16909_31415)",style:{mixBlendMode:"multiply"}}),Gr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M188.761 275.892L164.912 297.84H144.734L94.2389 211.066L131.283 183.858L164.022 204.417V241.414L188.761 264.862V275.892ZM172.522 239.153L176.2 204.291L164.149 173.199H199.803V164.789H131.537L144.36 109.117H199.803V39.8498L59.375 119.957V280.181L199.803 360.296V239.153H172.522Z",fill:"url(#paint1_linear_16909_31415)",style:{mixBlendMode:"multiply"}})]}),_a("defs",{children:[_a("linearGradient",{id:"paint0_linear_16909_31415",x1:"325.255",y1:"325.727",x2:"325.255",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[Gr("stop",{stopColor:"#002D72"}),Gr("stop",{offset:"1",stopColor:"#002D72",stopOpacity:"0.01"})]}),_a("linearGradient",{id:"paint1_linear_16909_31415",x1:"184.827",y1:"325.727",x2:"184.827",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[Gr("stop",{stopColor:"#002D72",stopOpacity:"0.01"}),Gr("stop",{offset:"1",stopColor:"#002D72"})]})]})]});import{jsx as sr,jsxs as Pi}from"react/jsx-runtime";var Hh=e=>Pi("svg",{width:"52",height:"52",viewBox:"0 0 52 52",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[sr("rect",{width:"52",height:"52",rx:"26",fill:"#7084FF"}),sr("path",{d:"M43.6781 28.2954C45.1053 25.0988 38.0498 16.168 31.3094 12.4472C27.0608 9.56481 22.6337 9.96081 21.737 11.2264C19.7693 14.0039 28.2527 16.3574 33.9263 19.1037C32.7067 19.6348 31.5574 20.5879 30.8816 21.8067C28.7664 19.4915 24.1239 17.4977 18.6765 19.1037C15.0056 20.186 11.9547 22.7374 10.7756 26.5911C10.4891 26.4635 10.1719 26.3925 9.83814 26.3925C8.56192 26.3925 7.52734 27.4298 7.52734 28.7094C7.52734 29.989 8.56192 31.0263 9.83814 31.0263C10.0747 31.0263 10.8143 30.8672 10.8143 30.8672L22.6337 30.953C17.9068 38.4713 14.1713 39.5704 14.1713 40.8729C14.1713 42.1754 17.7455 41.8224 19.0876 41.3369C25.5121 39.0127 32.4123 31.7692 33.5964 29.6841C38.5688 30.3061 42.7476 30.3796 43.6781 28.2954Z",fill:"url(#paint0_linear_81034_11443)"}),sr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M33.8741 19.076C33.8926 19.084 33.911 19.092 33.9294 19.1001C34.1923 18.9962 34.1498 18.6068 34.0776 18.301C33.9116 17.5981 31.0479 14.7629 28.3588 13.493C24.6934 11.762 21.9946 11.8518 21.5972 12.65C22.3407 14.1849 25.8031 15.6258 29.4193 17.1308C30.9407 17.7639 32.4893 18.4084 33.8741 19.076Z",fill:"url(#paint1_linear_81034_11443)"}),sr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M29.272 34.5374C28.5323 34.2543 27.697 33.9945 26.7477 33.7587C27.7625 31.9382 27.9754 29.2432 27.0171 27.5392C25.6721 25.1478 23.9838 23.875 20.0605 23.875C17.9027 23.875 12.093 24.6037 11.9899 29.4663C11.9791 29.9743 11.9895 30.44 12.026 30.8685L22.6335 30.9456C21.2017 33.2229 19.8609 34.9113 18.6873 36.1947C20.0979 36.5571 21.2615 36.8612 22.3297 37.1404C23.3394 37.4043 24.2638 37.646 25.2309 37.8934C26.6941 36.8249 28.0698 35.6597 29.272 34.5374Z",fill:"url(#paint2_linear_81034_11443)"}),sr("path",{d:"M10.6324 30.3712C11.0658 34.065 13.1596 35.5127 17.4381 35.9411C21.7166 36.3695 24.1708 36.0821 27.4381 36.3801C30.167 36.6291 32.6036 38.0233 33.5075 37.5415C34.321 37.1079 33.8659 35.5412 32.7774 34.5361C31.3663 33.2333 29.4135 32.3274 25.9773 32.006C26.6621 30.1261 26.4702 27.4903 25.4067 26.0562C23.8689 23.9827 21.0305 23.0453 17.4381 23.4549C13.6848 23.8828 10.0885 25.7354 10.6324 30.3712Z",fill:"url(#paint3_linear_81034_11443)"}),Pi("defs",{children:[Pi("linearGradient",{id:"paint0_linear_81034_11443",x1:"18.249",y1:"25.4646",x2:"43.3806",y2:"32.5728",gradientUnits:"userSpaceOnUse",children:[sr("stop",{stopColor:"white"}),sr("stop",{offset:"1",stopColor:"white"})]}),Pi("linearGradient",{id:"paint1_linear_81034_11443",x1:"39.1432",y1:"24.9813",x2:"20.9691",y2:"6.81008",gradientUnits:"userSpaceOnUse",children:[sr("stop",{stopColor:"#8697FF"}),sr("stop",{offset:"1",stopColor:"#8697FF",stopOpacity:"0"})]}),Pi("linearGradient",{id:"paint2_linear_81034_11443",x1:"29.7761",y1:"35.1727",x2:"12.345",y2:"25.1792",gradientUnits:"userSpaceOnUse",children:[sr("stop",{stopColor:"#8697FF"}),sr("stop",{offset:"1",stopColor:"#8697FF",stopOpacity:"0"})]}),Pi("linearGradient",{id:"paint3_linear_81034_11443",x1:"19.7472",y1:"25.2716",x2:"31.5549",y2:"40.2352",gradientUnits:"userSpaceOnUse",children:[sr("stop",{stopColor:"white"}),sr("stop",{offset:"0.983895",stopColor:"#D1D8FF"})]})]})]});import{jsx as pe,jsxs as lr}from"react/jsx-runtime";var Gh=({style:e,...t})=>lr("svg",{width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[pe("g",{clipPath:"url(#clip0_5_32)",children:lr("g",{clipPath:"url(#clip1_5_32)",children:[pe("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:pe("path",{d:"M78.163 0H41.837C29.79 0 23.767 0 17.283 2.04999C10.203 4.62701 4.627 10.203 2.05 17.283C0 23.767 0 29.791 0 41.837V78.163C0 90.21 0 96.232 2.05 102.717C4.627 109.797 10.203 115.373 17.283 117.949C23.767 120 29.79 120 41.837 120H78.163C90.21 120 96.232 120 102.717 117.949C109.797 115.373 115.373 109.797 117.95 102.717C120 96.232 120 90.21 120 78.163V41.837C120 29.791 120 23.767 117.95 17.283C115.373 10.203 109.797 4.62701 102.717 2.04999C96.232 0 90.21 0 78.163 0Z",fill:"black"})}),pe("g",{mask:"url(#mask0_5_32)",children:pe("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),pe("path",{d:"M20 38H26C56.9279 38 82 63.0721 82 94V100H94C97.3137 100 100 97.3137 100 94C100 53.1309 66.8691 20 26 20C22.6863 20 20 22.6863 20 26V38Z",fill:"url(#paint1_radial_5_32)"}),pe("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),pe("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),pe("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),pe("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),pe("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),pe("path",{d:"M20 62C20 65.3137 22.6863 68 26 68C40.3594 68 52 79.6406 52 94C52 97.3137 54.6863 100 58 100H68V94C68 70.804 49.196 52 26 52H20V62Z",fill:"url(#paint7_radial_5_32)"}),pe("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),pe("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),lr("defs",{children:[lr("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[pe("stop",{stopColor:"#174299"}),pe("stop",{offset:"1",stopColor:"#001E59"})]}),lr("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[pe("stop",{offset:"0.770277",stopColor:"#FF4000"}),pe("stop",{offset:"1",stopColor:"#8754C9"})]}),lr("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[pe("stop",{stopColor:"#FF4000"}),pe("stop",{offset:"1",stopColor:"#8754C9"})]}),lr("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[pe("stop",{stopColor:"#8754C9"}),pe("stop",{offset:"1",stopColor:"#FF4000"})]}),lr("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[pe("stop",{offset:"0.723929",stopColor:"#FFF700"}),pe("stop",{offset:"1",stopColor:"#FF9901"})]}),lr("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[pe("stop",{stopColor:"#FFF700"}),pe("stop",{offset:"1",stopColor:"#FF9901"})]}),lr("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[pe("stop",{stopColor:"#FFF700"}),pe("stop",{offset:"1",stopColor:"#FF9901"})]}),lr("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[pe("stop",{offset:"0.59513",stopColor:"#00AAFF"}),pe("stop",{offset:"1",stopColor:"#01DA40"})]}),lr("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[pe("stop",{stopColor:"#00AAFF"}),pe("stop",{offset:"1",stopColor:"#01DA40"})]}),lr("radialGradient",{id:"paint9_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(23 69) rotate(-90) scale(17 322.37)",children:[pe("stop",{stopColor:"#00AAFF"}),pe("stop",{offset:"1",stopColor:"#01DA40"})]}),pe("clipPath",{id:"clip0_5_32",children:pe("rect",{width:"120",height:"120",fill:"white"})}),pe("clipPath",{id:"clip1_5_32",children:pe("rect",{width:"120",height:"120",fill:"white"})})]})]});import{jsx as so,jsxs as Vh}from"react/jsx-runtime";var qh=({style:e,...t})=>Vh("svg",{width:"96",height:"96",viewBox:"0 0 96 96",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[so("rect",{width:"96",height:"96",rx:"18",fill:"#FEF4FF"}),Vh("g",{children:[so("path",{d:"M71.9367 18.39C72.0482 16.4526 72.3145 15.1746 72.8497 14.0075C73.0616 13.5456 73.2601 13.1675 73.2907 13.1675C73.3214 13.1675 73.2293 13.5085 73.086 13.9252C72.6969 15.0578 72.633 16.607 72.901 18.4094C73.2413 20.6963 73.4348 21.0263 75.8841 23.4967C77.0329 24.6554 78.3692 26.1168 78.8536 26.7443L79.7343 27.8851L78.8536 27.0698C77.7764 26.0728 75.2992 24.1283 74.7521 23.8503C74.3852 23.6639 74.3306 23.6671 74.1043 23.8894C73.8958 24.0943 73.8519 24.4021 73.8229 25.8572C73.7778 28.125 73.4646 29.5807 72.7087 31.0362C72.2998 31.8234 72.2354 31.6554 72.6053 30.7668C72.8816 30.1034 72.9096 29.8117 72.9076 27.6163C72.9033 23.2052 72.3727 22.1447 69.2607 20.3281C68.4724 19.8678 67.1734 19.2041 66.3742 18.8531C65.575 18.502 64.9401 18.1962 64.9633 18.1734C65.0514 18.0868 68.0863 18.961 69.3077 19.4247C71.1247 20.1145 71.4247 20.2039 71.6454 20.1207C71.7933 20.0649 71.8648 19.6398 71.9367 18.39Z",fill:"#F50DB4"}),so("path",{d:"M33.5466 11.9727C32.4688 11.808 32.4233 11.7887 32.9306 11.7119C33.9026 11.5647 36.1979 11.7653 37.7796 12.1358C41.4722 13.0004 44.8322 15.2153 48.4188 19.1488L49.3717 20.1938L50.7348 19.978C56.4773 19.0689 62.3192 19.7914 67.2054 22.0148C68.5495 22.6265 70.6689 23.8441 70.9337 24.157C71.018 24.2568 71.173 24.8987 71.2779 25.5837C71.6408 27.9534 71.4591 29.7699 70.7234 31.1265C70.3229 31.8648 70.3006 32.0988 70.5698 32.7306C70.7847 33.2348 71.3838 33.608 71.9771 33.6072C73.1913 33.6056 74.4983 31.6721 75.1038 28.9818L75.3443 27.9131L75.8209 28.4448C78.4346 31.3619 80.4876 35.34 80.8403 38.1716L80.9321 38.9099L80.4928 38.2387C79.7366 37.0838 78.9769 36.2976 78.0041 35.6635C76.2504 34.5205 74.3961 34.1315 69.4853 33.8766C65.0501 33.6464 62.5399 33.2732 60.0509 32.4737C55.816 31.1137 53.6812 29.3023 48.6508 22.8012C46.4164 19.9135 45.0354 18.3159 43.6616 17.0293C40.5401 14.1058 37.4729 12.5726 33.5466 11.9727Z",fill:"#F50DB4"}),so("path",{d:"M35.6404 25.9564C33.4522 22.9889 32.0983 18.4391 32.3914 15.0379L32.482 13.9854L32.9801 14.0749C33.9155 14.243 35.5283 14.8343 36.2835 15.2861C38.3559 16.5259 39.253 18.1582 40.1658 22.3496C40.4332 23.5773 40.7839 24.9666 40.9454 25.437C41.2052 26.194 42.1871 27.9624 42.9854 29.1109C43.5605 29.938 43.1785 30.33 41.9074 30.217C39.9662 30.0444 37.3367 28.2568 35.6404 25.9564Z",fill:"#F50DB4"}),so("path",{d:"M69.2799 48.0419C59.0538 43.9862 55.4521 40.4658 55.4521 34.5259C55.4521 33.6517 55.4827 32.9365 55.5199 32.9365C55.5572 32.9365 55.9528 33.225 56.3991 33.5776C58.4728 35.216 60.7949 35.9157 67.2233 36.8395C71.0061 37.3831 73.1349 37.8222 75.0986 38.4637C81.3402 40.5027 85.2018 44.6406 86.1227 50.2766C86.3903 51.9143 86.2334 54.9854 85.7995 56.6039C85.457 57.8824 84.4118 60.1868 84.1346 60.2751C84.0578 60.2996 83.9824 60.0094 83.9626 59.6147C83.8575 57.4983 82.7718 55.438 80.9485 53.8946C78.8754 52.1399 76.0901 50.7428 69.2799 48.0419Z",fill:"#F50DB4"}),so("path",{d:"M62.1008 49.7268C61.9727 48.9758 61.7505 48.0167 61.607 47.5954L61.3461 46.8296L61.8307 47.3655C62.5014 48.107 63.0314 49.0559 63.4806 50.3197C63.8234 51.2843 63.862 51.5711 63.8594 53.1386C63.8568 54.6774 63.814 55 63.4974 55.8682C62.9983 57.2373 62.3788 58.208 61.3392 59.2501C59.4712 61.1228 57.0696 62.1596 53.6039 62.5896C53.0015 62.6643 51.2456 62.7902 49.7019 62.8693C45.8118 63.0686 43.2515 63.4803 40.9508 64.276C40.6201 64.3905 40.3247 64.4601 40.2948 64.4305C40.2017 64.3393 41.768 63.4195 43.0618 62.8056C44.8862 61.94 46.7021 61.4676 50.7709 60.8002C52.7809 60.4704 54.8566 60.0704 55.3837 59.9112C60.3612 58.4079 62.9197 54.5286 62.1008 49.7268Z",fill:"#F50DB4"}),so("path",{d:"M66.7886 57.9275C65.4299 55.0505 65.1179 52.2726 65.8623 49.6821C65.942 49.4053 66.07 49.1787 66.1471 49.1787C66.224 49.1787 66.5447 49.3495 66.8594 49.5581C67.4855 49.9732 68.7412 50.6725 72.0866 52.4692C76.2612 54.7111 78.6414 56.4472 80.2599 58.4306C81.6775 60.1677 82.5547 62.1459 82.9769 64.5583C83.2159 65.9248 83.0759 69.2128 82.7199 70.5889C81.5975 74.9275 78.9889 78.3356 75.2682 80.3242C74.7231 80.6155 74.2337 80.8547 74.1807 80.8558C74.1278 80.8569 74.3264 80.3594 74.6222 79.7503C75.8738 77.173 76.0163 74.6661 75.07 71.8756C74.4906 70.1671 73.3092 68.0823 70.924 64.5588C68.1507 60.4623 67.4708 59.3721 66.7886 57.9275Z",fill:"#F50DB4"}),so("path",{d:"M28.3782 73.4506C32.173 70.2943 36.8948 68.0521 41.1958 67.3639C43.0494 67.0672 46.1372 67.185 47.8537 67.6178C50.605 68.3113 53.0662 69.8648 54.3462 71.7156C55.5971 73.5245 56.1338 75.1008 56.6925 78.6081C56.913 79.9916 57.1527 81.3809 57.2252 81.6954C57.6449 83.5131 58.4614 84.966 59.4733 85.6957C61.0805 86.8544 63.8479 86.9265 66.5704 85.8804C67.0325 85.7028 67.4336 85.5801 67.4618 85.6078C67.5605 85.7044 66.1896 86.6083 65.2225 87.0842C63.9212 87.7245 62.8864 87.972 61.5115 87.972C59.0181 87.972 56.948 86.7226 55.2206 84.175C54.8807 83.6736 54.1167 82.1718 53.5228 80.8378C51.699 76.7403 50.7984 75.4921 48.6809 74.126C46.8381 72.9374 44.4615 72.7245 42.6736 73.588C40.325 74.7223 39.6698 77.6786 41.3518 79.5521C42.0204 80.2967 43.2671 80.939 44.2865 81.0638C46.1936 81.2975 47.8326 79.8684 47.8326 77.9717C47.8326 76.7402 47.352 76.0374 46.1423 75.4996C44.4901 74.7652 42.7141 75.6237 42.7226 77.1526C42.7263 77.8045 43.0145 78.214 43.6779 78.5097C44.1036 78.6994 44.1134 78.7144 43.7664 78.6434C42.2504 78.3337 41.8952 76.5335 43.1141 75.3383C44.5776 73.9036 47.6037 74.5367 48.6428 76.4951C49.0794 77.3177 49.1301 78.956 48.7495 79.9452C47.8976 82.1593 45.4138 83.3237 42.8941 82.6901C41.1787 82.2587 40.4801 81.7915 38.4119 79.6931C34.8179 76.0462 33.4226 75.3396 28.2413 74.5428L27.2484 74.3902L28.3782 73.4506Z",fill:"#F50DB4"}),so("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.5147 8.18128C23.517 22.5305 31.7835 28.4507 32.7022 29.7015C33.4607 30.7343 33.1752 31.6628 31.8758 32.3905C31.1532 32.7951 29.6676 33.205 28.9238 33.205C28.0825 33.205 27.7936 32.8853 27.7936 32.8853C27.3058 32.4296 27.0311 32.5093 24.5261 28.1293C21.0483 22.8137 18.1379 18.4041 18.0585 18.3303C17.8749 18.1596 17.878 18.1653 24.1715 29.2574C25.1883 31.5693 24.3737 32.4179 24.3737 32.7471C24.3737 33.417 24.1882 33.7691 23.3494 34.6907C21.951 36.2274 21.3259 37.954 20.8746 41.5274C20.3687 45.5332 18.9462 48.3629 15.0041 53.2057C12.6965 56.0406 12.3189 56.5602 11.7366 57.7028C11.0032 59.1416 10.8015 59.9475 10.7198 61.7645C10.6334 63.6855 10.8016 64.9265 11.3975 66.7632C11.9191 68.3712 12.4636 69.433 13.8555 71.5567C15.0568 73.3894 15.7484 74.7513 15.7484 75.2841C15.7484 75.708 15.8306 75.7085 17.692 75.2945C22.1466 74.3036 25.7638 72.5609 27.7981 70.4252C29.0571 69.1033 29.3527 68.3733 29.3623 66.5619C29.3686 65.377 29.3263 65.1289 29.0011 64.4473C28.4718 63.3379 27.5083 62.4154 25.3845 60.9853C22.6019 59.1115 21.4133 57.603 21.085 55.5285C20.8157 53.8263 21.1282 52.6253 22.6676 49.4472C24.2609 46.1575 24.6558 44.7557 24.9229 41.4399C25.0954 39.2977 25.3343 38.4528 25.9591 37.7747C26.6108 37.0676 27.1975 36.8281 28.8103 36.611C31.4396 36.2572 33.1139 35.5871 34.4901 34.3379C35.6839 33.2543 36.1835 32.2101 36.2602 30.6382L36.3184 29.4468L35.6512 28.6806C33.2352 25.9057 9.89667 6 9.74799 6C9.71623 6 10.5113 6.98164 11.5147 8.18128ZM17.1047 63.9381C17.6509 62.9852 17.3607 61.7601 16.447 61.1617C15.5836 60.5962 14.2424 60.8625 14.2424 61.5994C14.2424 61.8243 14.3687 61.9879 14.6532 62.1322C15.1322 62.375 15.167 62.648 14.7901 63.2061C14.4084 63.7712 14.4392 64.2681 14.877 64.6057C15.5826 65.15 16.5815 64.8507 17.1047 63.9381Z",fill:"#F50DB4"}),so("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M37.9777 37.236C36.7433 37.6095 35.5435 38.8981 35.172 40.2493C34.9454 41.0736 35.074 42.5196 35.4134 42.9662C35.9617 43.6874 36.492 43.8774 37.9277 43.8675C40.7388 43.8482 43.1825 42.6606 43.4666 41.176C43.6994 39.9591 42.6262 38.2726 41.1478 37.5321C40.385 37.1502 38.7626 36.9987 37.9777 37.236ZM41.2638 39.7671C41.6973 39.1604 41.5076 38.5047 40.7704 38.0611C39.3664 37.2167 37.2432 37.9155 37.2432 39.222C37.2432 39.8724 38.3504 40.5819 39.3653 40.5819C40.0408 40.5819 40.9652 40.1851 41.2638 39.7671Z",fill:"#F50DB4"})]})]});import{jsx as Pa,jsxs as zh}from"react/jsx-runtime";var $h=({style:e,...t})=>zh("svg",{width:"176",height:"176",viewBox:"0 0 176 176",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[zh("g",{clipPath:"url(#clip0_1704_1423)",children:[Pa("path",{d:"M126.233 176H49.7672C22.287 176 0 153.723 0 126.233V49.7673C0 22.287 22.2769 0 49.7672 0H126.233C153.713 0 176 22.277 176 49.7673V126.233C176 153.723 153.713 176 126.233 176Z",fill:"#2461ED"}),Pa("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M100.667 85.6591C83.4133 76.3353 62.4196 64.2443 46.6192 54.3891C41.9573 51.0306 44.3234 43.9023 49.9578 43.9023H128.138C132.499 43.9023 135.416 48.7648 133.231 52.4442C127.977 61.5174 120.308 73.0368 113.901 82.1702C110.462 87.0727 104.858 87.9149 100.667 85.6591ZM75.5031 88.6867C92.1858 97.5795 115.566 111.104 132.178 121.33C137.311 124.498 135.266 132.098 129.271 132.098C119.46 132.098 103.518 132.1 87.6592 132.103C71.9639 132.105 56.3497 132.108 46.8398 132.108C42.0476 132.108 39.5913 127.135 41.6265 123.666C48.5041 111.946 56.2338 100.116 62.6603 91.2834C65.5176 87.3433 71.3325 86.461 75.5031 88.6867Z",fill:"white"})]}),Pa("defs",{children:Pa("clipPath",{id:"clip0_1704_1423",children:Pa("rect",{width:"176",height:"176",fill:"white"})})})]});import{jsx as Kh}from"react/jsx-runtime";var Ar={coinbase_wallet:{logo:So,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},coinbase_smart_wallet:{logo:So,displayName:"Coinbase Smart Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:ui,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:to,displayName:"Phantom"},rainbow:{logo:Gh,displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:ha,displayName:"WalletConnect"},zerion:{logo:$h,displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:Dh,displayName:"Brave Wallet",rdns:"com.brave.wallet"},cryptocom:{logo:Bh,displayName:"Crypto.com DeFi Wallet",rdns:"com.crypto.wallet"},uniswap:{logo:qh,displayName:"Uniswap Wallet",rdns:"org.uniswap.app"},okx_wallet:{displayName:"OKX Wallet",rdns:"com.okex.wallet",logo:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJDSURBVHgB7Zq9jtpAEMfHlhEgQLiioXEkoAGECwoKxMcTRHmC5E3IoyRPkPAEkI7unJYmTgEFTYwA8a3NTKScLnCHN6c9r1e3P2llWQy7M/s1Gv1twCP0ej37dDq9x+Zut1t3t9vZjDEHIiSRSPg4ZpDL5fxkMvn1cDh8m0wmfugfO53OoFQq/crn8wxfY9EymQyrVCqMfHvScZx1p9ls3pFxXBy/bKlUipGPrVbLuQqAfsCliq3zl0H84zwtjQrOw4Mt1W63P5LvBm2d+Xz+YzqdgkqUy+WgWCy+Mc/nc282m4FqLBYL+3g8fjDxenq72WxANZbLJeA13zDX67UDioL5ybXwafMYu64Ltn3bdDweQ5R97fd7GyhBQMipx4POeEDHIu2LfDdBIGGz+hJ9CQ1ABjoA2egAZPM6AgiCAEQhsi/C4jHyPA/6/f5NG3Ks2+3CYDC4aTccDrn6ojG54MnEvG00GoVmWLIRNZ7wTCwDHYBsdACy0QHIhiuRETxlICWpMMhGZHmqS8qH6JLyGegAZKMDkI0uKf8X4SWlaZo+Pp1bRrwlJU8ZKLIvUjKh0WiQ3sRUbNVq9c5Ebew7KEo2m/1p4jJ4qAmDaqDQBzj5XyiAT4VCQezJigAU+IDU+z8vJFnGWeC+bKQV/5VZ71FV6L7PA3gg3tXrdQ+DgLhC+75Wq3no69P3MC0NFQpx2lL04Ql9gHK1bRDjsSBIvScBnDTk1WrlGIZBorIDEYJj+rhdgnQ67VmWRe0zlplXl81vcyEt0rSoYDUAAAAASUVORK5CYII="},rabby_wallet:{logo:Hh,displayName:"Rabby Wallet",rdns:"io.rabby.wallet"}},zo=(e,t,r)=>{if(Ar[e]?.displayName)return e==="coinbase_wallet"?Ar[r].displayName:Ar[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},Pl=(e,t,r)=>{if(Ar[e]?.logo)return e==="coinbase_wallet"?Ar[r].logo:Ar[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return ha},Al=(e,t)=>{let r=t?.height||16,o=t?.width||16;switch(e){case 8453:return Kh(Fh,{height:r,width:o});default:return Kh(Sw,{height:r,width:o})}};function Ai(e){let t=e.toLowerCase();return!!window?.webkit?.messageHandlers?.ReactNativeWebView||!!window?.ReactNativeWebView||["fbav","fban","instagram","snapchat","linkedinapp"].some(n=>t.includes(n))}import{useContext as _w,useEffect as Pw,useState as Aw}from"react";import{createContext as xw}from"react";import{jsx as kw}from"react/jsx-runtime";var Yh=xw({}),Zh=({children:e})=>{let t=Ve(),[r,o]=Aw({});return Ae("login",{onComplete:(n,i,a,l,s)=>{!s||s.type==="passkey"||s.type==="cross_app"||s.type==="wallet"&&s.walletClientType==="privy"||(Q.put(jh(t.id),s.type),s.type==="wallet"?(Q.put(Yd(t.id),s.walletClientType),o({accountType:s.type,walletClientType:s.walletClientType})):(Q.del(Yd(t.id)),o({accountType:s.type})))}}),Pw(()=>{if(!t.id)return;let n=Q.get(jh(t.id)),i=Q.get(Yd(t.id));n&&o(n==="wallet"?{accountType:n,walletClientType:i}:{accountType:n})},[t.id]),kw(Yh.Provider,{value:r,children:e})},jh=e=>`privy:${e}:recent-login-method`,Yd=e=>`privy:${e}:recent-login-wallet-client`,St=()=>_w(Yh);import{jsx as xl,jsxs as Mw}from"react/jsx-runtime";var Nn=({provider:e,displayName:t,logo:r,connectOnly:o,connector:n})=>{let{navigate:i}=_(),{connectWallet:a}=M(),l=St(),s=n.connectorType==="wallet_connect_v2"?e:n.walletClientType,c=window.matchMedia("(display-mode: standalone)").matches,m;return n.connectorType==="phantom"?m=()=>{No()?(a(n,s),i(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")):i(Qh?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:n.connectorType==="coinbase_wallet"&&n.connectionOptions==="eoaOnly"&&Qh&&!c&&!As()?m=()=>{window.location.href=`https://go.cb-w.com/dapp?cb_url=${encodeURI(window.location.href)}`}:m=()=>{Ai(window.navigator.userAgent)&&!event?.isTrusted||(a(n,s),i(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION"))},Mw(Rw,{onClick:m,children:[xl(Sl,{icon:Pl(e,n.connectorType,n.walletClientType)??r,name:n.walletClientType}),xl("span",{children:zo(e,n.connectorType,n.walletClientType)||t||n.walletClientType}),l?.walletClientType===s?xl(Iw,{color:"gray",children:"Recent"}):xl("span",{id:"connect-text",children:"Connect"})]})},Rw=Jh(Ee)`
953
953
  /* Show "Connect" on hover */
954
954
  > #connect-text {
955
955
  font-weight: 500;
@@ -971,16 +971,16 @@ Resources:
971
971
  display: none;
972
972
  }
973
973
  }
974
- `,Pw=jh(Xt)`
974
+ `,Iw=Jh(er)`
975
975
  margin-left: auto;
976
- `;import{Fragment as Mw,jsx as Pi,jsxs as Ww}from"react/jsx-runtime";var xw=["coinbase_wallet"],kw=["metamask","okx_wallet","rainbow","uniswap","zerion","rabby_wallet","cryptocom"],Rw=[],Iw=["phantom"],Ai=({connectOnly:e})=>{let{connectors:t}=M(),{app:r}=P(),o=zo(r.appearance.walletList,t,e,r.appearance.walletList,r.externalWallets.walletConnect.enabled);return Ww(Mw,{children:[...o]})},zo=(e,t,r,o,n)=>{let i=[],a=[],l=[],s=t.find(c=>c.connectorType==="wallet_connect_v2");for(let c of e)if(c==="detected_wallets"){let m=t.filter(({connectorType:f,walletClientType:u})=>u==="uniswap_wallet_extension"?!o.includes("uniswap"):u==="crypto.com_wallet_extension"?!o.includes("cryptocom"):f==="injected"&&!o.includes(u));for(let f of m){let{walletClientType:u,walletBranding:C}=f;(u==="unknown"?a:i).push(Pi(On,{connectOnly:r,provider:u,logo:C.icon,displayName:C.name,connector:f},`${c}-${u}`))}}else if(Iw.includes(c)){let m=t.find(f=>f.connectorType==="injected"&&f.walletClientType===c||f.connectorType===c);m&&i.push(Pi(On,{connectOnly:r,provider:c,connector:m},c))}else if(kw.includes(c)){let m=t.find(f=>c==="uniswap"?f.walletClientType==="uniswap_wallet_extension":c==="cryptocom"?f.walletClientType==="crypto.com_wallet_extension":f.connectorType==="injected"&&f.walletClientType===c);n&&!m&&(m=s),m&&i.push(Pi(On,{connectOnly:r,provider:c,connector:m},c))}else if(xw.includes(c)){let m=t.find(({connectorType:f})=>f===c);m&&i.push(Pi(On,{connectOnly:r,provider:c,connector:m},c))}else Rw.includes(c)?s&&l.push(Pi(On,{connectOnly:r,provider:c,connector:s},c)):c==="wallet_connect"&&s&&l.push(Pi(On,{connectOnly:r,provider:c,connector:s},c));return[...a,...i,...l]};import{Fragment as Ow,jsx as Pa,jsxs as Lw}from"react/jsx-runtime";var Yh=()=>{let{app:e}=P(),{linkingOrConnectingHint:t}=M(),r=t?`Connect the wallet with address ${dt(t)} ${e?.name?`to ${e.name}.`:"."}`:`Connect a wallet to ${e?.name}`;return Lw(Ow,{children:[Pa(x,{},"header"),Pa(ao,{title:"Connect your wallet",description:r}),Pa(Yt,{children:Pa(Ai,{connectOnly:!0})}),Pa($,{})]})};import{Fragment as Nw,jsx as xi,jsxs as Dw}from"react/jsx-runtime";var Zh=()=>{let{app:e}=P(),{linkingOrConnectingHint:t}=M(),r=t?`Connect the wallet with address ${dt(t)} ${e?.name?`to ${e.name}.`:"."}`:`Connect a wallet to ${e?.name}`;return Dw(Nw,{children:[xi(x,{},"header"),xi(Mn,{title:"Connect your wallet",description:r}),xi(Yt,{children:xi(Ai,{connectOnly:!0})}),e&&xi(Ci,{app:e,alwaysShowImplicitConsent:!0}),xi($,{})]})};import{useEffect as ry,useState as oy}from"react";import{isMobile as zw}from"react-device-detect";import $w from"styled-components";import{useEffect as jd,useState as $o}from"react";import{isMobile as Al}from"react-device-detect";import ey from"styled-components";import{useEffect as Qh,useRef as Uw}from"react";var Fw=(e,t)=>{let r=Uw(()=>{});Qh(()=>{r.current=e}),Qh(()=>{if(t!==null){let o=setInterval(()=>r.current(),t||0);return()=>clearInterval(o)}},[t])},Jh=Fw;import{useState as Bw,useEffect as Hw,useCallback as Gw}from"react";function Xh(){let[e,t]=Bw(!1),r=Gw(()=>{document.hidden&&t(!0)},[]);return Hw(()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}import{Fragment as Zd,jsx as ht,jsxs as ki}from"react/jsx-runtime";var Yd=2,Qd=e=>e?.privyErrorCode==="linked_to_another_user"?_o.ERROR_USER_EXISTS:e instanceof Ct&&!e.details.default?e.details:e instanceof ai?_o.ERROR_TIMED_OUT:e instanceof si?_o.ERROR_USER_REJECTED_CONNECTION:_o.ERROR_WALLET_CONNECTION,ty=()=>{let[e,t]=$o(!1),[r,o]=$o(!1),[n,i]=$o(void 0),{authenticated:a,logout:l}=z(),{app:s,navigate:c,navigateBack:m,lastScreen:f,currentScreen:u,setModalData:C}=P(),{getAuthFlow:g,walletConnectionStatus:y,closePrivyModal:b,initLoginWithWallet:E,loginWithWallet:k,updateWallets:T,createAnalyticsEvent:A}=M(),{walletConnectors:R}=z(),[I,D]=$o(0),{user:H}=z(),[K]=$o(H?.linkedAccounts.length||0),[j,O]=$o(""),[U,W]=$o(""),[Ce,Ie]=$o(!1),{hasTabbedAway:Y}=Xh(),{enabled:X,token:te}=be(),_e=Al&&y?.connector?.connectorType==="wallet_connect_v2"||Al&&y?.connector?.connectorType==="coinbase_wallet"||Al&&y?.connector?.connectorType==="injected"&&y?.connector?.walletClientType==="phantom",Te=y?.status==="connected",Ke=y?.status==="switching_to_supported_chain";jd(()=>{let V=g(),ae=V instanceof To?V:void 0;if(Te&&!ae&&(X&&!te&&!a?(C({captchaModalData:{callback:lt=>E(y.connectedWallet,lt).then(()=>{Ie(!0)}),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN",!1)):E(y.connectedWallet,te).then(()=>{Ie(!0)})),ae&&_e&&Te&&!ae.preparedMessage){ae.buildSiweMessage();return}!ae||_e||!Te||r||(async()=>{o(!0),i(void 0);try{y?.connector?.connectorType==="wallet_connect_v2"&&y?.connector?.walletClientType==="metamask"&&await cd(2500),await mt()}catch(lt){console.warn("Auto-prompted signature failed",lt)}finally{o(!1)}})()},[I,Te,Ce]),jd(()=>{if(H&&e){let ae=Ne-500;if(s?.legal.requireUsersAcceptTerms&&!H.hasAcceptedTerms){let ea=setTimeout(()=>{c("AFFIRMATIVE_CONSENT_SCREEN")},ae);return()=>clearTimeout(ea)}if(qt(H,s?.embeddedWallets?.createOnLogin)){let ea=setTimeout(()=>{C({createWallet:{onSuccess:()=>{},onFailure:cs=>{console.error(cs),A({eventName:"embedded_wallet_creation_failure_logout",payload:{error:cs,screen:"ConnectionStatusScreen"}}),l()},callAuthOnSuccessOnClose:!0}}),c("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},ae);return()=>clearTimeout(ea)}T();let lt=setTimeout(()=>b({shouldCallAuthOnSuccess:!0,isSuccess:!0}),Ne);return()=>clearTimeout(lt)}},[H,e]);let Ge=V=>{if(V?.privyErrorCode==="allowlist_rejected"){c("ALLOWLIST_REJECTION_SCREEN");return}else if(V?.privyErrorCode==="max_accounts_reached"){console.error(new br(V).toString()),c("USER_LIMIT_REACHED_SCREEN");return}else if(V?.privyErrorCode==="user_does_not_exist"){c("ACCOUNT_NOT_FOUND_SCREEN");return}i(Qd(V))};async function mt(){try{await k(),t(!0)}catch(V){Ge(V)}finally{o(!1)}}jd(()=>{y?.connectError&&Ge(y?.connectError)},[y]),Jh(()=>{let V=Fe==="wallet_connect_v2"&&y?.connector instanceof Dr?y.connector.redirectUri:void 0;V&&O(V);let ae=Fe==="wallet_connect_v2"&&y?.connector instanceof Dr?y.connector.fallbackUniversalRedirectUri:void 0;ae&&W(ae)},y?.connector instanceof Dr&&!j?500:null);let Fe=y?.connector?.connectorType||"injected",se=y?.connector?.walletClientType||"unknown",Ft=Ar[se]?.displayName||y?.connector?.walletBranding.name||"Browser Extension",Wr=Ar[se]?.logo||y?.connector?.walletBranding.icon||(V=>ht(ci,{...V})),Zr=Ft==="Browser Extension"?Ft.toLowerCase():Ft,L;e?L=`Successfully connected with ${Zr}`:n?L=n.message:Ke?L="Switching networks":Te?L=r&&_e?"Signing":"Sign to verify":L=`Waiting for ${Zr}`;let rt="Don\u2019t see your wallet? Check your other browser windows.";if(e){let V=H?.linkedAccounts.length||0;K===V?rt="Wallet was already linked.":rt="You\u2019re good to go!"}else I>=Yd&&n?rt="Unable to connect wallet":n?rt=n.detail:Ke?rt="Switch your wallet to the requested network.":Te&&_e?rt="Sign the message in your wallet to verify it belongs to you.":se==="metamask"&&Al?rt="Click continue to open and connect MetaMask.":se==="metamask"?rt="For the best experience, connect only one wallet at a time.":Fe==="wallet_connect"?rt="Open your mobile wallet app to continue":Fe==="coinbase_wallet"&&(Ps()||(xd(H)?rt="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":rt="Open the Coinbase app on your phone to continue."));let Or=R?.walletConnectors?.find(V=>V.walletClientType==="coinbase_wallet"),G=se==="coinbase_wallet"&&(xd(H)||n===_o.ERROR_USER_EXISTS);return ki(Zd,{children:[ht(x,{backFn:!f||u===f?void 0:m}),ki(Vw,{children:[ht(Jd,{walletLogo:Wr,success:e,fail:!!n}),ki(qe,{children:[ht("h3",{children:L}),ht("p",{children:rt}),!Te&&j&&!Y?ki("p",{children:["Still here?"," ",ht("a",{href:j,target:"_blank",style:{textDecoration:"underline"},children:"Try connecting again"}),U&&ki(Zd,{children:[" ","or"," ",ht("a",{href:U,target:"_blank",style:{textDecoration:"underline"},children:"use this different link"})]})]}):null]}),G?ht(B,{onClick:()=>Or&&Or?.disconnect(),disabled:e,children:"Use a different wallet"}):n==_o.ERROR_USER_EXISTS&&u!==f?ht(B,{onClick:m,children:"Use a different wallet"}):Te&&!e&&_e?ht(B,{onClick:()=>{o(!0),mt()},disabled:r,children:r?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&I<Yd?ht(B,{onClick:()=>{D(I+1),i(void 0),Te?(o(!0),mt()):y?.connectRetry()},disabled:!e&&(!n?.retryable||I>=Yd),children:"Retry"}):!e&&!n?ht(B,{onClick:()=>{},disabled:!0,children:"Connecting"}):null]}),ht(Z,{})]})},Vw=ey.div`
976
+ `;import{Fragment as Dw,jsx as xi,jsxs as Uw}from"react/jsx-runtime";var Ww=["coinbase_wallet"],Ow=["metamask","okx_wallet","rainbow","uniswap","zerion","rabby_wallet","cryptocom"],Lw=[],Nw=["phantom"],ki=({connectOnly:e})=>{let{connectors:t}=M(),{app:r}=_(),o=$o(r.appearance.walletList,t,e,r.appearance.walletList,r.externalWallets.walletConnect.enabled);return Uw(Dw,{children:[...o]})},$o=(e,t,r,o,n)=>{let i=[],a=[],l=[],s=t.find(c=>c.connectorType==="wallet_connect_v2");for(let c of e)if(c==="detected_wallets"){let m=t.filter(({connectorType:f,walletClientType:u})=>u==="uniswap_wallet_extension"?!o.includes("uniswap"):u==="crypto.com_wallet_extension"?!o.includes("cryptocom"):f==="injected"&&!o.includes(u));for(let f of m){let{walletClientType:u,walletBranding:C}=f;(u==="unknown"?a:i).push(xi(Nn,{connectOnly:r,provider:u,logo:C.icon,displayName:C.name,connector:f},`${c}-${u}`))}}else if(Nw.includes(c)){let m=t.find(f=>f.connectorType==="injected"&&f.walletClientType===c||f.connectorType===c);m&&i.push(xi(Nn,{connectOnly:r,provider:c,connector:m},c))}else if(Ow.includes(c)){let m=t.find(f=>c==="uniswap"?f.walletClientType==="uniswap_wallet_extension":c==="cryptocom"?f.walletClientType==="crypto.com_wallet_extension":f.connectorType==="injected"&&f.walletClientType===c);n&&!m&&(m=s),m&&i.push(xi(Nn,{connectOnly:r,provider:c,connector:m},c))}else if(Ww.includes(c)){let m=t.find(({connectorType:f})=>f===c);m&&i.push(xi(Nn,{connectOnly:r,provider:c,connector:m},c))}else Lw.includes(c)?s&&l.push(xi(Nn,{connectOnly:r,provider:c,connector:s},c)):c==="wallet_connect"&&s&&l.push(xi(Nn,{connectOnly:r,provider:c,connector:s},c));return[...a,...i,...l]};import{Fragment as Fw,jsx as Aa,jsxs as Bw}from"react/jsx-runtime";var Xh=()=>{let{app:e}=_(),{linkingOrConnectingHint:t}=M(),r=t?`Connect the wallet with address ${dt(t)} ${e?.name?`to ${e.name}.`:"."}`:`Connect a wallet to ${e?.name}`;return Bw(Fw,{children:[Aa(A,{},"header"),Aa(ao,{title:"Connect your wallet",description:r}),Aa(Yt,{children:Aa(ki,{connectOnly:!0})}),Aa(z,{})]})};import{Fragment as Hw,jsx as Ri,jsxs as Gw}from"react/jsx-runtime";var ey=()=>{let{app:e}=_(),{linkingOrConnectingHint:t}=M(),r=t?`Connect the wallet with address ${dt(t)} ${e?.name?`to ${e.name}.`:"."}`:`Connect a wallet to ${e?.name}`;return Gw(Hw,{children:[Ri(A,{},"header"),Ri(On,{title:"Connect your wallet",description:r}),Ri(Yt,{children:Ri(ki,{connectOnly:!0})}),e&&Ri(bi,{app:e,alwaysShowImplicitConsent:!0}),Ri(z,{})]})};import{useEffect as ay,useState as sy}from"react";import{isMobile as Zw}from"react-device-detect";import Qw from"styled-components";import{useEffect as Zd,useState as Ko}from"react";import{isMobile as kl}from"react-device-detect";import ny from"styled-components";import{useEffect as ty,useRef as Vw}from"react";var qw=(e,t)=>{let r=Vw(()=>{});ty(()=>{r.current=e}),ty(()=>{if(t!==null){let o=setInterval(()=>r.current(),t||0);return()=>clearInterval(o)}},[t])},ry=qw;import{useState as zw,useEffect as $w,useCallback as Kw}from"react";function oy(){let[e,t]=zw(!1),r=Kw(()=>{document.hidden&&t(!0)},[]);return $w(()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}import{Fragment as Jd,jsx as ht,jsxs as Ii}from"react/jsx-runtime";var Qd=2,Xd=e=>e?.privyErrorCode==="linked_to_another_user"?_o.ERROR_USER_EXISTS:e instanceof Ct&&!e.details.default?e.details:e instanceof li?_o.ERROR_TIMED_OUT:e instanceof ci?_o.ERROR_USER_REJECTED_CONNECTION:_o.ERROR_WALLET_CONNECTION,iy=()=>{let[e,t]=Ko(!1),[r,o]=Ko(!1),[n,i]=Ko(void 0),{authenticated:a,logout:l}=q(),{app:s,navigate:c,navigateBack:m,lastScreen:f,currentScreen:u,setModalData:C}=_(),{getAuthFlow:g,walletConnectionStatus:y,closePrivyModal:b,initLoginWithWallet:T,loginWithWallet:k,updateWallets:S,createAnalyticsEvent:x}=M(),{walletConnectors:R}=q(),[I,D]=Ko(0),{user:H}=q(),[K]=Ko(H?.linkedAccounts.length||0),[j,O]=Ko(""),[U,W]=Ko(""),[Ce,Ie]=Ko(!1),{hasTabbedAway:Y}=oy(),{enabled:X,token:te}=be(),_e=kl&&y?.connector?.connectorType==="wallet_connect_v2"||kl&&y?.connector?.connectorType==="coinbase_wallet"||kl&&y?.connector?.connectorType==="injected"&&y?.connector?.walletClientType==="phantom",Te=y?.status==="connected",Ke=y?.status==="switching_to_supported_chain";Zd(()=>{let V=g(),ae=V instanceof To?V:void 0;if(Te&&!ae&&(X&&!te&&!a?(C({captchaModalData:{callback:ct=>T(y.connectedWallet,ct).then(()=>{Ie(!0)}),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN",!1)):T(y.connectedWallet,te).then(()=>{Ie(!0)})),ae&&_e&&Te&&!ae.preparedMessage){ae.buildSiweMessage();return}!ae||_e||!Te||r||(async()=>{o(!0),i(void 0);try{y?.connector?.connectorType==="wallet_connect_v2"&&y?.connector?.walletClientType==="metamask"&&await pd(2500),await mt()}catch(ct){console.warn("Auto-prompted signature failed",ct)}finally{o(!1)}})()},[I,Te,Ce]),Zd(()=>{if(H&&e){let ae=Ne-500;if(s?.legal.requireUsersAcceptTerms&&!H.hasAcceptedTerms){let ta=setTimeout(()=>{c("AFFIRMATIVE_CONSENT_SCREEN")},ae);return()=>clearTimeout(ta)}if(qt(H,s?.embeddedWallets?.createOnLogin)){let ta=setTimeout(()=>{C({createWallet:{onSuccess:()=>{},onFailure:ds=>{console.error(ds),x({eventName:"embedded_wallet_creation_failure_logout",payload:{error:ds,screen:"ConnectionStatusScreen"}}),l()},callAuthOnSuccessOnClose:!0}}),c("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},ae);return()=>clearTimeout(ta)}S();let ct=setTimeout(()=>b({shouldCallAuthOnSuccess:!0,isSuccess:!0}),Ne);return()=>clearTimeout(ct)}},[H,e]);let Ge=V=>{if(V?.privyErrorCode==="allowlist_rejected"){c("ALLOWLIST_REJECTION_SCREEN");return}else if(V?.privyErrorCode==="max_accounts_reached"){console.error(new Er(V).toString()),c("USER_LIMIT_REACHED_SCREEN");return}else if(V?.privyErrorCode==="user_does_not_exist"){c("ACCOUNT_NOT_FOUND_SCREEN");return}i(Xd(V))};async function mt(){try{await k(),t(!0)}catch(V){Ge(V)}finally{o(!1)}}Zd(()=>{y?.connectError&&Ge(y?.connectError)},[y]),ry(()=>{let V=Fe==="wallet_connect_v2"&&y?.connector instanceof Dr?y.connector.redirectUri:void 0;V&&O(V);let ae=Fe==="wallet_connect_v2"&&y?.connector instanceof Dr?y.connector.fallbackUniversalRedirectUri:void 0;ae&&W(ae)},y?.connector instanceof Dr&&!j?500:null);let Fe=y?.connector?.connectorType||"injected",se=y?.connector?.walletClientType||"unknown",Ft=Ar[se]?.displayName||y?.connector?.walletBranding.name||"Browser Extension",Wr=Ar[se]?.logo||y?.connector?.walletBranding.icon||(V=>ht(pi,{...V})),Zr=Ft==="Browser Extension"?Ft.toLowerCase():Ft,L;e?L=`Successfully connected with ${Zr}`:n?L=n.message:Ke?L="Switching networks":Te?L=r&&_e?"Signing":"Sign to verify":L=`Waiting for ${Zr}`;let rt="Don\u2019t see your wallet? Check your other browser windows.";if(e){let V=H?.linkedAccounts.length||0;K===V?rt="Wallet was already linked.":rt="You\u2019re good to go!"}else I>=Qd&&n?rt="Unable to connect wallet":n?rt=n.detail:Ke?rt="Switch your wallet to the requested network.":Te&&_e?rt="Sign the message in your wallet to verify it belongs to you.":se==="metamask"&&kl?rt="Click continue to open and connect MetaMask.":se==="metamask"?rt="For the best experience, connect only one wallet at a time.":Fe==="wallet_connect"?rt="Open your mobile wallet app to continue":Fe==="coinbase_wallet"&&(As()||(Rd(H)?rt="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":rt="Open the Coinbase app on your phone to continue."));let Or=R?.walletConnectors?.find(V=>V.walletClientType==="coinbase_wallet"),G=se==="coinbase_wallet"&&(Rd(H)||n===_o.ERROR_USER_EXISTS);return Ii(Jd,{children:[ht(A,{backFn:!f||u===f?void 0:m}),Ii(jw,{children:[ht(ep,{walletLogo:Wr,success:e,fail:!!n}),Ii(qe,{children:[ht("h3",{children:L}),ht("p",{children:rt}),!Te&&j&&!Y?Ii("p",{children:["Still here?"," ",ht("a",{href:j,target:"_blank",style:{textDecoration:"underline"},children:"Try connecting again"}),U&&Ii(Jd,{children:[" ","or"," ",ht("a",{href:U,target:"_blank",style:{textDecoration:"underline"},children:"use this different link"})]})]}):null]}),G?ht(B,{onClick:()=>Or&&Or?.disconnect(),disabled:e,children:"Use a different wallet"}):n==_o.ERROR_USER_EXISTS&&u!==f?ht(B,{onClick:m,children:"Use a different wallet"}):Te&&!e&&_e?ht(B,{onClick:()=>{o(!0),mt()},disabled:r,children:r?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&I<Qd?ht(B,{onClick:()=>{D(I+1),i(void 0),Te?(o(!0),mt()):y?.connectRetry()},disabled:!e&&(!n?.retryable||I>=Qd),children:"Retry"}):!e&&!n?ht(B,{onClick:()=>{},disabled:!0,children:"Connecting"}):null]}),ht(Z,{})]})},jw=ny.div`
977
977
  display: flex;
978
978
  flex-direction: column;
979
979
  align-items: center;
980
980
  justify-content: center;
981
981
  gap: 24px;
982
982
  width: 100%;
983
- `,qw=ey.div`
983
+ `,Yw=ny.div`
984
984
  display: flex;
985
985
  flex-direction: column;
986
986
  justify-content: center;
@@ -1003,14 +1003,14 @@ Resources:
1003
1003
  left: -19px;
1004
1004
  top: -19px;
1005
1005
  }
1006
- `,Jd=e=>{let t=e.walletLogo;return ht(Zd,{children:ht(qw,{children:ki("div",{children:[ht(ot,{success:e.success,fail:e.fail}),typeof t=="string"?ht("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):ht(t,{style:{width:"38px",height:"38px"}})]})})})};import{Fragment as jw,jsx as Ao,jsxs as Xd}from"react/jsx-runtime";var xl=2,ny=()=>{let{navigateBack:e,navigate:t,lastScreen:r,currentScreen:o,data:n}=P(),{walletConnectionStatus:i,closePrivyModal:a}=M(),[l,s]=oy(void 0),[c,m]=oy(0),f=i?.status==="connected",u=i?.status==="switching_to_supported_chain";ry(()=>{if(f){let R;if(n?.externalConnectWallet?.onCompleteNavigateTo){let I=n.externalConnectWallet.onCompleteNavigateTo;R=setTimeout(()=>{t(I)},Ne)}else R=setTimeout(a,Ne);return()=>clearTimeout(R)}},[f]);let C=R=>{s(Qd(R))};ry(()=>{i?.connectError&&C(i?.connectError)},[i]);let g=i?.connector?.connectorType||"injected",y=i?.connector?.walletClientType||"unknown",b=Ar[y]?.displayName||i?.connector?.walletBranding.name||"Browser Extension",E=Ar[y]?.logo||i?.connector?.walletBranding.icon||(R=>Ao(ci,{...R})),k=b==="Browser Extension"?b.toLowerCase():b,T;f?T=`Successfully connected with ${k}`:l?T=l.message:u?T="Switching networks":T=`Waiting for ${k}`;let A="Don\u2019t see your wallet? Check your other browser windows.";return f?A="You\u2019re good to go!":c>=xl&&l?A="Unable to connect wallet":l?A=l.detail:u?A="Switch your wallet to the requested network.":y==="metamask"&&zw?A="Click to continue to open and connect MetaMask.":y==="metamask"?A="For the best experience, connect only one wallet at a time.":g==="wallet_connect_v2"?A="Open your mobile wallet app to continue":g==="coinbase_wallet"&&(A="Open the Coinbase app on your phone to continue."),Xd(jw,{children:[Ao(x,{backFn:o===r?void 0:e}),Xd(Kw,{children:[Ao(Jd,{walletLogo:E,success:f,fail:!!l}),Xd(qe,{children:[Ao("h3",{children:T}),Ao("p",{children:A})]}),l==_o.ERROR_USER_EXISTS?Ao(B,{onClick:e,children:"Use a different wallet"}):!f&&l?.retryable&&c<xl?Ao(B,{onClick:()=>{m(c+1),s(void 0),i?.connectRetry()},disabled:!f&&(!l?.retryable||c>=xl),children:"Retry"}):!f&&l&&c>=xl?Ao(B,{onClick:e,children:"Use a different wallet"}):null]}),Ao(Z,{})]})},Kw=$w.div`
1006
+ `,ep=e=>{let t=e.walletLogo;return ht(Jd,{children:ht(Yw,{children:Ii("div",{children:[ht(nt,{success:e.success,fail:e.fail}),typeof t=="string"?ht("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):ht(t,{style:{width:"38px",height:"38px"}})]})})})};import{Fragment as Xw,jsx as Ao,jsxs as tp}from"react/jsx-runtime";var Rl=2,ly=()=>{let{navigateBack:e,navigate:t,lastScreen:r,currentScreen:o,data:n}=_(),{walletConnectionStatus:i,closePrivyModal:a}=M(),[l,s]=sy(void 0),[c,m]=sy(0),f=i?.status==="connected",u=i?.status==="switching_to_supported_chain";ay(()=>{if(f){let R;if(n?.externalConnectWallet?.onCompleteNavigateTo){let I=n.externalConnectWallet.onCompleteNavigateTo;R=setTimeout(()=>{t(I)},Ne)}else R=setTimeout(a,Ne);return()=>clearTimeout(R)}},[f]);let C=R=>{s(Xd(R))};ay(()=>{i?.connectError&&C(i?.connectError)},[i]);let g=i?.connector?.connectorType||"injected",y=i?.connector?.walletClientType||"unknown",b=Ar[y]?.displayName||i?.connector?.walletBranding.name||"Browser Extension",T=Ar[y]?.logo||i?.connector?.walletBranding.icon||(R=>Ao(pi,{...R})),k=b==="Browser Extension"?b.toLowerCase():b,S;f?S=`Successfully connected with ${k}`:l?S=l.message:u?S="Switching networks":S=`Waiting for ${k}`;let x="Don\u2019t see your wallet? Check your other browser windows.";return f?x="You\u2019re good to go!":c>=Rl&&l?x="Unable to connect wallet":l?x=l.detail:u?x="Switch your wallet to the requested network.":y==="metamask"&&Zw?x="Click to continue to open and connect MetaMask.":y==="metamask"?x="For the best experience, connect only one wallet at a time.":g==="wallet_connect_v2"?x="Open your mobile wallet app to continue":g==="coinbase_wallet"&&(x="Open the Coinbase app on your phone to continue."),tp(Xw,{children:[Ao(A,{backFn:o===r?void 0:e}),tp(Jw,{children:[Ao(ep,{walletLogo:T,success:f,fail:!!l}),tp(qe,{children:[Ao("h3",{children:S}),Ao("p",{children:x})]}),l==_o.ERROR_USER_EXISTS?Ao(B,{onClick:e,children:"Use a different wallet"}):!f&&l?.retryable&&c<Rl?Ao(B,{onClick:()=>{m(c+1),s(void 0),i?.connectRetry()},disabled:!f&&(!l?.retryable||c>=Rl),children:"Retry"}):!f&&l&&c>=Rl?Ao(B,{onClick:e,children:"Use a different wallet"}):null]}),Ao(Z,{})]})},Jw=Qw.div`
1007
1007
  display: flex;
1008
1008
  flex-direction: column;
1009
1009
  align-items: center;
1010
1010
  justify-content: center;
1011
1011
  gap: 24px;
1012
1012
  width: 100%;
1013
- `;import{useEffect as sy,useMemo as Yw,useState as Zw}from"react";import Qw from"styled-components";import{jsx as iy}from"react/jsx-runtime";var ay=({name:e,logoUrl:t})=>{let r=`${e??"Provider app"} logo`;return typeof t=="string"?iy("img",{src:t,alt:r,style:{width:"38px",height:"38px",maxHeight:"90px",maxWidth:"180px",borderRadius:"8px"}}):iy("span",{})};import{Fragment as Xw,jsx as xo,jsxs as kl}from"react/jsx-runtime";var ly=()=>{let{data:e,onUserCloseViaDialogOrKeybindRef:t}=P(),{crossAppAuthFlow:r,updateWallets:o,closePrivyModal:n}=M(),[i,a]=Zw({}),l={id:e?.crossAppAuth?.appId??"",name:e?.crossAppAuth?.name??"app",logoUrl:e?.crossAppAuth?.logoUrl},s=Ne,c=new w(`There was an issue connecting your ${l.name} account. Please try again.`),m=new Le(async g=>{if(!e?.crossAppAuth?.popup){a({error:c});return}try{let y=await r({appId:g,popup:e.crossAppAuth.popup});a({data:y})}catch(y){y instanceof w?a({error:y}):y instanceof Mt?(e?.crossAppAuth?.popup&&e.crossAppAuth.popup.close(),a({error:c})):a({error:c})}}),f=()=>{i.data&&(o(),e?.crossAppAuth?.onSuccess(i.data),n({shouldCallAuthOnSuccess:!0,isSuccess:!0})),e?.crossAppAuth?.onError(i.error??new w("User canceled flow")),n({shouldCallAuthOnSuccess:!1,isSuccess:!1})};t.current=f,sy(()=>{l.id.length&&m.execute(l.id)},[l.id]),sy(()=>{if(!i.data)return;let g=setTimeout(f,s);return()=>clearTimeout(g)},[i.data]);let{title:u,subtitle:C}=Yw(()=>i.data?{title:`Successfully connected with ${l.name}`,subtitle:"You're good to go!"}:i.error?{title:"Authentication failed",subtitle:i.error.message}:{title:`Connecting to ${l.name}`,subtitle:`Please check the pop-up from ${l.name} to continue`},[i,l.name]);return kl(Xw,{children:[xo(x,{onClose:f}),xo(ne,{}),kl(Jw,{children:[xo(Je,{children:kl("div",{children:[xo(ot,{success:!!i.data,fail:!!i.error}),xo(ay,{name:l.name,logoUrl:l.logoUrl})]})}),kl(qe,{children:[xo("h3",{children:u}),xo("p",{children:C})]})]}),xo(ie,{}),xo(Z,{})]})},Jw=Qw.div`
1013
+ `;import{useEffect as py,useMemo as e4,useState as t4}from"react";import r4 from"styled-components";import{jsx as cy}from"react/jsx-runtime";var dy=({name:e,logoUrl:t})=>{let r=`${e??"Provider app"} logo`;return typeof t=="string"?cy("img",{src:t,alt:r,style:{width:"38px",height:"38px",maxHeight:"90px",maxWidth:"180px",borderRadius:"8px"}}):cy("span",{})};import{Fragment as n4,jsx as xo,jsxs as Il}from"react/jsx-runtime";var uy=()=>{let{data:e,onUserCloseViaDialogOrKeybindRef:t}=_(),{crossAppAuthFlow:r,updateWallets:o,closePrivyModal:n}=M(),[i,a]=t4({}),l={id:e?.crossAppAuth?.appId??"",name:e?.crossAppAuth?.name??"app",logoUrl:e?.crossAppAuth?.logoUrl},s=Ne,c=new w(`There was an issue connecting your ${l.name} account. Please try again.`),m=new Le(async g=>{if(!e?.crossAppAuth?.popup){a({error:c});return}try{let y=await r({appId:g,popup:e.crossAppAuth.popup});a({data:y})}catch(y){y instanceof w?a({error:y}):y instanceof Mt?(e?.crossAppAuth?.popup&&e.crossAppAuth.popup.close(),a({error:c})):a({error:c})}}),f=()=>{i.data&&(o(),e?.crossAppAuth?.onSuccess(i.data),n({shouldCallAuthOnSuccess:!0,isSuccess:!0})),e?.crossAppAuth?.onError(i.error??new w("User canceled flow")),n({shouldCallAuthOnSuccess:!1,isSuccess:!1})};t.current=f,py(()=>{l.id.length&&m.execute(l.id)},[l.id]),py(()=>{if(!i.data)return;let g=setTimeout(f,s);return()=>clearTimeout(g)},[i.data]);let{title:u,subtitle:C}=e4(()=>i.data?{title:`Successfully connected with ${l.name}`,subtitle:"You're good to go!"}:i.error?{title:"Authentication failed",subtitle:i.error.message}:{title:`Connecting to ${l.name}`,subtitle:`Please check the pop-up from ${l.name} to continue`},[i,l.name]);return Il(n4,{children:[xo(A,{onClose:f}),xo(re,{}),Il(o4,{children:[xo(Je,{children:Il("div",{children:[xo(nt,{success:!!i.data,fail:!!i.error}),xo(dy,{name:l.name,logoUrl:l.logoUrl})]})}),Il(qe,{children:[xo("h3",{children:u}),xo("p",{children:C})]})]}),xo(ie,{}),xo(Z,{})]})},o4=r4.div`
1014
1014
  display: flex;
1015
1015
  flex-direction: column;
1016
1016
  align-items: center;
@@ -1018,7 +1018,7 @@ Resources:
1018
1018
  margin-left: 27px;
1019
1019
  margin-right: 27px;
1020
1020
  gap: 24px;
1021
- `;import a4 from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as s4,useMemo as l4,useState as c4}from"react";import d4 from"styled-components";import Rl from"styled-components";import{jsx as ep,jsxs as n4}from"react/jsx-runtime";var Il=()=>ep(e4,{children:n4(t4,{children:[ep(r4,{}),ep(o4,{})]})}),e4=Rl.div`
1021
+ `;import p4 from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as u4,useMemo as m4,useState as f4}from"react";import h4 from"styled-components";import Ml from"styled-components";import{jsx as rp,jsxs as c4}from"react/jsx-runtime";var Wl=()=>rp(i4,{children:c4(a4,{children:[rp(s4,{}),rp(l4,{})]})}),i4=Ml.div`
1022
1022
  display: flex;
1023
1023
  justify-content: center;
1024
1024
  align-items: center;
@@ -1030,14 +1030,14 @@ Resources:
1030
1030
  @media all and (display-mode: standalone) {
1031
1031
  margin-bottom: 30px;
1032
1032
  }
1033
- `,t4=Rl.div`
1033
+ `,a4=Ml.div`
1034
1034
  position: relative;
1035
1035
  height: 140px;
1036
1036
  width: 140px;
1037
1037
 
1038
1038
  opacity: 1;
1039
1039
  animation: fadein 200ms ease;
1040
- `,r4=Rl.div`
1040
+ `,s4=Ml.div`
1041
1041
  position: absolute;
1042
1042
  top: 0;
1043
1043
  right: 0;
@@ -1050,7 +1050,7 @@ Resources:
1050
1050
  border: 4px solid var(--privy-color-accent-light);
1051
1051
  border-radius: 50%;
1052
1052
  }
1053
- `,o4=Rl.div`
1053
+ `,l4=Ml.div`
1054
1054
  position: absolute;
1055
1055
  top: 0;
1056
1056
  right: 0;
@@ -1074,20 +1074,20 @@ Resources:
1074
1074
  transform: rotate(360deg);
1075
1075
  }
1076
1076
  }
1077
- `;var cy=["error","invalid_request_arguments","wallet_not_on_device","invalid_recovery_pin","insufficient_funds","missing_or_invalid_mfa","mfa_verification_max_attempts_reached","mfa_timeout","twilio_verification_failed"];var We=class extends Error{constructor(r,o){super(o);this.type=r}};function Ri(e){let t=e.type;return typeof t=="string"&&cy.includes(t)}function i4(e){let t=e.type;return typeof t=="string"&&t==="client_error"}function Ln(e){return Ri(e)&&e.type==="wallet_not_on_device"}function dy(e){return Ri(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function Nn(e){return!!(Ri(e)&&e.type==="mfa_timeout")}function Dn(e){return!!(Ri(e)&&e.type==="missing_or_invalid_mfa")}function tp(e){return!!(Ri(e)&&e.type==="mfa_verification_max_attempts_reached")}function Ml(e){return!!(Ri(e)&&e.message.includes("code 429"))}function Wl(e){return!!(i4(e)&&e.message==="MFA canceled")}function rp({isCreatingWallet:e,skipSplashScreen:t}){return e?"EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN":t?"EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN":"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"}function Ol({walletAction:e,availableRecoveryMethods:t,legacySetWalletPasswordFlow:r=!1,isResettingPassword:o=!1}){return r||t.length===1?rp({isCreatingWallet:e==="create",skipSplashScreen:o}):"EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"}function Ll(e){switch(e){case"user-passcode":return"EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN";case"google-drive":return"EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN";case"icloud":return"EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN";default:throw new Error("Recovery method not supported")}}async function op({api:e,provider:t}){let r=bn(),o=oi(),n=await ni(r);try{return t==="icloud"?{url:(await e.post(Gu,{client_type:"web"})).url}:{url:(await e.post(Hu,{redirect_to:window.location.href,code_challenge:n,state_code:o})).url,codeVerifier:r,stateCode:o,provider:t}}catch(i){throw le(i)}}async function py({api:e,provider:t,stateCode:r,codeVerifier:o,authorizationCode:n}){if(!n||!r)throw new w("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if(n==="undefined")throw new w("User denied confirmation during OAuth flow");try{return(await e.post(Vu,{authorization_code:n,state_code:r,code_verifier:o,provider:t})).access_token}catch(i){let a=le(i);throw a.privyErrorCode?new w(a.message||"Invalid code during OAuth flow.",void 0,a.privyErrorCode):a.message==="User denied confirmation during OAuth flow"?new w("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new w("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}import{Fragment as my,jsx as Ii,jsxs as np}from"react/jsx-runtime";var uy=1,fy=()=>{let{authenticated:e,user:t,getAccessToken:r}=z(),{closePrivyModal:o,createAnalyticsEvent:n,walletProxy:i}=M(),{navigate:a,data:l,setModalData:s,onUserCloseViaDialogOrKeybindRef:c}=P(),m=l4(()=>Date.now(),[]),[f,u]=c4(!1),{onCompleteNavigateTo:C,onFailure:g,shouldForceMFA:y,address:b}=l?.connectWallet,E=T=>{f||(u(!0),g(typeof T=="string"?new Error(T):T))};s4(()=>{let T=b?t?.linkedAccounts.find(I=>I.type==="wallet"&&I.walletClientType==="privy"&&I.address===b):ye(t),A;return!e||!T?E("User must be authenticated and have a Privy wallet before it can be connected"):i?((async()=>{let I=await r();if(!I)return E("User must be authenticated and have a Privy wallet before it can be connected");try{await i.connect({accessToken:I,address:T.address}),y&&await i.verifyMfa({accessToken:I});let D=(Date.now()-m)/1e3;C==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&D<uy?A=setTimeout(()=>{a(C)},(uy-D)*1e3):a(C)}catch(D){if(Ln(D)&&T.recoveryMethod==="privy"){let H=await r();if(!H)return E("User must be authenticated and have a Privy wallet before it can be recovered");try{n({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:T.address}}),(await i?.recover({address:T.address,accessToken:H,recoveryMethod:T.recoveryMethod}))?.address||E(new Error("Unable to recover wallet")),C?a(C):o({shouldCallAuthOnSuccess:!1}),n({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:T.address}}),a(C)}catch{E("An error has occurred, please try again.")}}else if(Ln(D)&&T.recoveryMethod!=="privy"){s({...l,recoverWallet:{privyWallet:T,onCompleteNavigateTo:C,onFailure:g},recoveryOAuthStatus:{provider:T.recoveryMethod,action:"recover",isInAccountCreateFlow:!1}});let H=Ll(T.recoveryMethod);a(H)}else E(D)}})(),()=>clearTimeout(A)):void 0},[e,t,i]);let k=()=>{E("User exited before wallet could be connected"),o({shouldCallAuthOnSuccess:!1})};return c.current=k,np(my,{children:[Ii(x,{onClose:k}),f?np(my,{children:[np(ir,{children:[Ii(a4,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),Ii(ge,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),Ii(B,{onClick:()=>o({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):Ii(Il,{}),Ii(p4,{})]})},p4=d4.div`
1077
+ `;var my=["error","invalid_request_arguments","wallet_not_on_device","invalid_recovery_pin","insufficient_funds","missing_or_invalid_mfa","mfa_verification_max_attempts_reached","mfa_timeout","twilio_verification_failed"];var We=class extends Error{constructor(r,o){super(o);this.type=r}};function Mi(e){let t=e.type;return typeof t=="string"&&my.includes(t)}function d4(e){let t=e.type;return typeof t=="string"&&t==="client_error"}function Dn(e){return Mi(e)&&e.type==="wallet_not_on_device"}function fy(e){return Mi(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function Un(e){return!!(Mi(e)&&e.type==="mfa_timeout")}function Fn(e){return!!(Mi(e)&&e.type==="missing_or_invalid_mfa")}function op(e){return!!(Mi(e)&&e.type==="mfa_verification_max_attempts_reached")}function Ol(e){return!!(Mi(e)&&e.message.includes("code 429"))}function Ll(e){return!!(d4(e)&&e.message==="MFA canceled")}function np({isCreatingWallet:e,skipSplashScreen:t}){return e?"EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN":t?"EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN":"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"}function Nl({walletAction:e,availableRecoveryMethods:t,legacySetWalletPasswordFlow:r=!1,isResettingPassword:o=!1}){return r||t.length===1?np({isCreatingWallet:e==="create",skipSplashScreen:o}):"EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"}function Dl(e){switch(e){case"user-passcode":return"EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN";case"google-drive":return"EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN";case"icloud":return"EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN";default:throw new Error("Recovery method not supported")}}async function ip({api:e,provider:t}){let r=Sn(),o=ii(),n=await ai(r);try{return t==="icloud"?{url:(await e.post(zu,{client_type:"web"})).url}:{url:(await e.post(qu,{redirect_to:window.location.href,code_challenge:n,state_code:o})).url,codeVerifier:r,stateCode:o,provider:t}}catch(i){throw le(i)}}async function hy({api:e,provider:t,stateCode:r,codeVerifier:o,authorizationCode:n}){if(!n||!r)throw new w("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if(n==="undefined")throw new w("User denied confirmation during OAuth flow");try{return(await e.post($u,{authorization_code:n,state_code:r,code_verifier:o,provider:t})).access_token}catch(i){let a=le(i);throw a.privyErrorCode?new w(a.message||"Invalid code during OAuth flow.",void 0,a.privyErrorCode):a.message==="User denied confirmation during OAuth flow"?new w("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new w("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}import{Fragment as gy,jsx as Wi,jsxs as ap}from"react/jsx-runtime";var yy=1,vy=()=>{let{authenticated:e,user:t,getAccessToken:r}=q(),{closePrivyModal:o,createAnalyticsEvent:n,walletProxy:i}=M(),{navigate:a,data:l,setModalData:s,onUserCloseViaDialogOrKeybindRef:c}=_(),m=m4(()=>Date.now(),[]),[f,u]=f4(!1),{onCompleteNavigateTo:C,onFailure:g,shouldForceMFA:y,address:b}=l?.connectWallet,T=S=>{f||(u(!0),g(typeof S=="string"?new Error(S):S))};u4(()=>{let S=b?t?.linkedAccounts.find(I=>I.type==="wallet"&&I.walletClientType==="privy"&&I.address===b):ge(t),x;return!e||!S?T("User must be authenticated and have a Privy wallet before it can be connected"):i?((async()=>{let I=await r();if(!I)return T("User must be authenticated and have a Privy wallet before it can be connected");try{await i.connect({accessToken:I,address:S.address}),y&&await i.verifyMfa({accessToken:I});let D=(Date.now()-m)/1e3;C==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&D<yy?x=setTimeout(()=>{a(C)},(yy-D)*1e3):a(C)}catch(D){if(Dn(D)&&S.recoveryMethod==="privy"){let H=await r();if(!H)return T("User must be authenticated and have a Privy wallet before it can be recovered");try{n({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:S.address}}),(await i?.recover({address:S.address,accessToken:H,recoveryMethod:S.recoveryMethod}))?.address||T(new Error("Unable to recover wallet")),C?a(C):o({shouldCallAuthOnSuccess:!1}),n({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:S.address}}),a(C)}catch{T("An error has occurred, please try again.")}}else if(Dn(D)&&S.recoveryMethod!=="privy"){s({...l,recoverWallet:{privyWallet:S,onCompleteNavigateTo:C,onFailure:g},recoveryOAuthStatus:{provider:S.recoveryMethod,action:"recover",isInAccountCreateFlow:!1}});let H=Dl(S.recoveryMethod);a(H)}else T(D)}})(),()=>clearTimeout(x)):void 0},[e,t,i]);let k=()=>{T("User exited before wallet could be connected"),o({shouldCallAuthOnSuccess:!1})};return c.current=k,ap(gy,{children:[Wi(A,{onClose:k}),f?ap(gy,{children:[ap(ar,{children:[Wi(p4,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),Wi(he,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),Wi(B,{onClick:()=>o({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):Wi(Wl,{}),Wi(y4,{})]})},y4=h4.div`
1078
1078
  height: 44px;
1079
- `;import u4 from"@heroicons/react/24/solid/CheckCircleIcon";import{useEffect as m4}from"react";import{Fragment as f4,jsx as Mi,jsxs as hy}from"react/jsx-runtime";var yy=()=>{let{user:e}=z(),{closePrivyModal:t,isNewUserThisSession:r,updateWallets:o}=M(),{app:n,data:i,onUserCloseViaDialogOrKeybindRef:a}=P(),{onSuccess:l,onFailure:s,callAuthOnSuccessOnClose:c}=i.createWallet,m=()=>{let f=ye(e);f?(o(),l(f)):s(new Error("Failed to create wallet")),t({shouldCallAuthOnSuccess:c})};return m4(()=>{let f=setTimeout(m,Ws);return()=>clearTimeout(f)},[]),a.current=m,hy(f4,{children:[Mi(x,{onClose:m}),Mi(ne,{}),hy(ir,{children:[Mi(u4,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),Mi(ge,{title:r?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:r?"You\u2019ve successfully created an account.":"Your account is secured."})]}),Mi(ie,{}),Mi($,{})]})};import h4 from"@heroicons/react/20/solid/ExclamationTriangleIcon";import y4 from"@heroicons/react/24/outline/ArrowRightOnRectangleIcon";import{useEffect as Cy,useRef as g4,useState as ip}from"react";import Ko from"styled-components";import{Fragment as P4,jsx as pt,jsxs as Vr}from"react/jsx-runtime";var wy=()=>{let[e,t]=ip(null),{authenticated:r,user:o,getAccessToken:n}=z(),{closePrivyModal:i,createAnalyticsEvent:a,clientAnalyticsId:l}=M(),{data:s,onUserCloseViaDialogOrKeybindRef:c}=P(),m=ye(o)?.address,{onFailure:f,onSuccess:u,origin:C,appId:g,appClientId:y}=s.keyExport,b=k=>{i({shouldCallAuthOnSuccess:!1}),f(typeof k=="string"?new Error(k):k)},E=()=>{i({shouldCallAuthOnSuccess:!1}),u(),a({eventName:"embedded_wallet_key_export_completed",payload:{walletAddress:m}})};return Cy(()=>{let k=ye(o);if(!r||!k)return b("User must be authenticated before exporting their wallet");n().then(t,b)},[r,o]),c.current=E,Vr(P4,{children:[pt(x,{onClose:E}),Vr(w4,{children:[Vr(ge,{icon:pt(y4,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),title:"Transfer Wallet",children:[Vr(S4,{children:[pt(C4,{style:{marginRight:6}}),dt(m)]}),pt("p",{children:"You can bring your account with you to another site using an external wallet."})]}),Vr(b4,{children:[Vr(gy,{children:[pt(vy,{children:"1"}),Vr("span",{children:[pt("a",{href:"https://privy-io.notion.site/Transferring-your-account-9dab9e16c6034a7ab1ff7fa479b02828",target:"blank",rel:"noopener noreferrer",children:"Follow the guide"})," ","to transfer your account to your wallet of choice."]})]}),Vr(gy,{children:[pt(vy,{children:"2"}),pt("span",{children:"Copy this key into your other wallet"})]})]}),pt("div",{style:{width:"100%"},children:e&&pt(v4,{origin:C,appId:g,appClientId:y,accessToken:e,clientAnalyticsId:l,address:m,dimensions:{height:"44px"}})}),Vr(_4,{children:[Vr("div",{children:[pt(h4,{viewBox:"0 0 20 18"}),pt("h4",{children:"Warning"})]}),pt("p",{children:"Never share your private key with anyone! It controls your account."})]})]}),pt($,{})]})};function v4(e){let[t,r]=ip(e.dimensions.width),[o,n]=ip(void 0),i=g4(null);return Cy(()=>{if(i.current&&t===void 0){let{width:l}=i.current.getBoundingClientRect();r(l)}let a=getComputedStyle(document.documentElement);n({background2:a.getPropertyValue("--privy-color-background-2"),foreground3:a.getPropertyValue("--privy-color-foreground-3"),foregroundAccent:a.getPropertyValue("--privy-color-foreground-accent"),accent:a.getPropertyValue("--privy-color-accent"),accentDark:a.getPropertyValue("--privy-color-accent-dark"),success:a.getPropertyValue("--privy-color-success")})},[]),pt("div",{ref:i,children:t&&Vr(E4,{children:[pt("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:xs(e.origin,`/apps/${e.appId}/embedded-wallets/export`,{client_id:e.appClientId,address:e.address,width:`${t}px`,caid:e.clientAnalyticsId,...o},{token:e.accessToken})}),pt(T4,{children:"Loading..."})]})})}function C4(e){return pt("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e.style,children:pt("path",{d:"M14 8.81335C14 7.98493 13.3284 7.31335 12.5 7.31335H10C10 8.41792 9.10457 9.31335 8 9.31335C6.89543 9.31335 6 8.41792 6 7.31335H3.5C2.67157 7.31335 2 7.98493 2 8.81335M14 8.81335V12.8134C14 13.6418 13.3284 14.3134 12.5 14.3134H3.5C2.67157 14.3134 2 13.6418 2 12.8134V8.81335M14 8.81335V6.81335M2 8.81335V6.81335M14 6.81335C14 5.98493 13.3284 5.31335 12.5 5.31335H3.5C2.67157 5.31335 2 5.98493 2 6.81335M14 6.81335V4.81335C14 3.98493 13.3284 3.31335 12.5 3.31335H3.5C2.67157 3.31335 2 3.98493 2 4.81335V6.81335",stroke:"var(--privy-color-foreground-3)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}var w4=Ko.div`
1079
+ `;import g4 from"@heroicons/react/24/solid/CheckCircleIcon";import{useEffect as v4}from"react";import{Fragment as C4,jsx as Oi,jsxs as Cy}from"react/jsx-runtime";var wy=()=>{let{user:e}=q(),{closePrivyModal:t,isNewUserThisSession:r,updateWallets:o}=M(),{app:n,data:i,onUserCloseViaDialogOrKeybindRef:a}=_(),{onSuccess:l,onFailure:s,callAuthOnSuccessOnClose:c}=i.createWallet,m=()=>{let f=ge(e);f?(o(),l(f)):s(new Error("Failed to create wallet")),t({shouldCallAuthOnSuccess:c})};return v4(()=>{let f=setTimeout(m,Os);return()=>clearTimeout(f)},[]),a.current=m,Cy(C4,{children:[Oi(A,{onClose:m}),Oi(re,{}),Cy(ar,{children:[Oi(g4,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),Oi(he,{title:r?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:r?"You\u2019ve successfully created an account.":"Your account is secured."})]}),Oi(ie,{}),Oi(z,{})]})};import w4 from"@heroicons/react/20/solid/ExclamationTriangleIcon";import b4 from"@heroicons/react/24/outline/ArrowRightOnRectangleIcon";import{useEffect as Ty,useRef as E4,useState as sp}from"react";import jo from"styled-components";import{Fragment as I4,jsx as pt,jsxs as Vr}from"react/jsx-runtime";var Sy=()=>{let[e,t]=sp(null),{authenticated:r,user:o,getAccessToken:n}=q(),{closePrivyModal:i,createAnalyticsEvent:a,clientAnalyticsId:l}=M(),{data:s,onUserCloseViaDialogOrKeybindRef:c}=_(),m=ge(o)?.address,{onFailure:f,onSuccess:u,origin:C,appId:g,appClientId:y}=s.keyExport,b=k=>{i({shouldCallAuthOnSuccess:!1}),f(typeof k=="string"?new Error(k):k)},T=()=>{i({shouldCallAuthOnSuccess:!1}),u(),a({eventName:"embedded_wallet_key_export_completed",payload:{walletAddress:m}})};return Ty(()=>{let k=ge(o);if(!r||!k)return b("User must be authenticated before exporting their wallet");n().then(t,b)},[r,o]),c.current=T,Vr(I4,{children:[pt(A,{onClose:T}),Vr(_4,{children:[Vr(he,{icon:pt(b4,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),title:"Transfer Wallet",children:[Vr(k4,{children:[pt(S4,{style:{marginRight:6}}),dt(m)]}),pt("p",{children:"You can bring your account with you to another site using an external wallet."})]}),Vr(P4,{children:[Vr(by,{children:[pt(Ey,{children:"1"}),Vr("span",{children:[pt("a",{href:"https://privy-io.notion.site/Transferring-your-account-9dab9e16c6034a7ab1ff7fa479b02828",target:"blank",rel:"noopener noreferrer",children:"Follow the guide"})," ","to transfer your account to your wallet of choice."]})]}),Vr(by,{children:[pt(Ey,{children:"2"}),pt("span",{children:"Copy this key into your other wallet"})]})]}),pt("div",{style:{width:"100%"},children:e&&pt(T4,{origin:C,appId:g,appClientId:y,accessToken:e,clientAnalyticsId:l,address:m,dimensions:{height:"44px"}})}),Vr(R4,{children:[Vr("div",{children:[pt(w4,{viewBox:"0 0 20 18"}),pt("h4",{children:"Warning"})]}),pt("p",{children:"Never share your private key with anyone! It controls your account."})]})]}),pt(z,{})]})};function T4(e){let[t,r]=sp(e.dimensions.width),[o,n]=sp(void 0),i=E4(null);return Ty(()=>{if(i.current&&t===void 0){let{width:l}=i.current.getBoundingClientRect();r(l)}let a=getComputedStyle(document.documentElement);n({background2:a.getPropertyValue("--privy-color-background-2"),foreground3:a.getPropertyValue("--privy-color-foreground-3"),foregroundAccent:a.getPropertyValue("--privy-color-foreground-accent"),accent:a.getPropertyValue("--privy-color-accent"),accentDark:a.getPropertyValue("--privy-color-accent-dark"),success:a.getPropertyValue("--privy-color-success")})},[]),pt("div",{ref:i,children:t&&Vr(A4,{children:[pt("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:ks(e.origin,`/apps/${e.appId}/embedded-wallets/export`,{client_id:e.appClientId,address:e.address,width:`${t}px`,caid:e.clientAnalyticsId,...o},{token:e.accessToken})}),pt(x4,{children:"Loading..."})]})})}function S4(e){return pt("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e.style,children:pt("path",{d:"M14 8.81335C14 7.98493 13.3284 7.31335 12.5 7.31335H10C10 8.41792 9.10457 9.31335 8 9.31335C6.89543 9.31335 6 8.41792 6 7.31335H3.5C2.67157 7.31335 2 7.98493 2 8.81335M14 8.81335V12.8134C14 13.6418 13.3284 14.3134 12.5 14.3134H3.5C2.67157 14.3134 2 13.6418 2 12.8134V8.81335M14 8.81335V6.81335M2 8.81335V6.81335M14 6.81335C14 5.98493 13.3284 5.31335 12.5 5.31335H3.5C2.67157 5.31335 2 5.98493 2 6.81335M14 6.81335V4.81335C14 3.98493 13.3284 3.31335 12.5 3.31335H3.5C2.67157 3.31335 2 3.98493 2 4.81335V6.81335",stroke:"var(--privy-color-foreground-3)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}var _4=jo.div`
1080
1080
  display: flex;
1081
1081
  flex-direction: column;
1082
1082
  text-align: left;
1083
- `,b4=Ko.div`
1083
+ `,P4=jo.div`
1084
1084
  display: flex;
1085
1085
  flex-direction: column;
1086
1086
  gap: 24px;
1087
1087
  padding-bottom: 16px;
1088
1088
  margin-left: 11px;
1089
1089
  border-left: 1px solid var(--privy-color-foreground-4) !important;
1090
- `,gy=Ko.div`
1090
+ `,by=jo.div`
1091
1091
  display: flex;
1092
1092
  align-items: top;
1093
1093
  gap: 8px;
@@ -1096,7 +1096,7 @@ Resources:
1096
1096
  color: var(--privy-color-accent);
1097
1097
  text-decoration: underline;
1098
1098
  }
1099
- `,vy=Ko.div`
1099
+ `,Ey=jo.div`
1100
1100
  display: flex;
1101
1101
  align-items: center;
1102
1102
  justify-content: center;
@@ -1110,11 +1110,11 @@ Resources:
1110
1110
  border-radius: 100%;
1111
1111
  background: var(--privy-color-background);
1112
1112
  color: var(--privy-color-accent);
1113
- `,E4=Ko.div`
1113
+ `,A4=jo.div`
1114
1114
  overflow: visible;
1115
1115
  position: relative;
1116
1116
  height: 44px;
1117
- `,T4=Ko.div`
1117
+ `,x4=jo.div`
1118
1118
  position: absolute;
1119
1119
  display: flex;
1120
1120
  align-items: center;
@@ -1126,7 +1126,7 @@ Resources:
1126
1126
  border-radius: var(--privy-border-radius-md);
1127
1127
  background-color: var(--privy-color-background-2);
1128
1128
  color: var(--privy-color-foreground-3);
1129
- `,S4=Ko.div`
1129
+ `,k4=jo.div`
1130
1130
  display: flex;
1131
1131
  align-items: center;
1132
1132
  padding-top: 1px;
@@ -1139,7 +1139,7 @@ Resources:
1139
1139
  font-size: 12px;
1140
1140
  font-weight: 500;
1141
1141
  margin: auto;
1142
- `,_4=Ko.div`
1142
+ `,R4=jo.div`
1143
1143
  border: 1px solid var(--privy-color-background-2) !important;
1144
1144
  border-radius: var(--privy-border-radius-md);
1145
1145
  padding: 16px;
@@ -1161,9 +1161,9 @@ Resources:
1161
1161
  color: var(--privy-color-error);
1162
1162
  }
1163
1163
  }
1164
- `;import k4 from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as R4,useState as by}from"react";import I4 from"styled-components";import{useCallback as A4,useRef as x4}from"react";function Nl(){let{refreshUser:e,createAnalyticsEvent:t,initializeWalletProxy:r}=M(),o=x4(!1);return{createWallet:A4(async i=>{let a=await we();if(!a)throw t({eventName:"embedded_wallet_creation_failed",payload:{error:"Missing access token for user."}}),new Error("An error has occured, please login again.");try{t({eventName:"embedded_wallet_creation_started"});let l=await r(ri);if(!l)throw new Error("walletProxy does not exist.");let s=2e4,c=new Promise((C,g)=>{setTimeout(()=>{g(new Error("walletProxy.create timed out."))},s)});if(!await Promise.race([l.create({accessToken:a,recoveryPassword:i}),c]))throw new Error("walletProxy.create did not send a response.");let f=await e();if(!f)throw new Error("Failed to refresh user.");let u=ye(f);if(!u)throw new Error("Updated user is missing embedded wallet.");return t({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:u.address}}),o.current=!0,u}catch(l){if(o.current)return;throw t({eventName:"embedded_wallet_creation_failed",payload:{error:l.toString()}}),console.warn(l),l}},[])}}import{Fragment as W4,jsx as Wi,jsxs as Ey}from"react/jsx-runtime";var Ty=()=>{let{app:e,setModalData:t,navigate:r,data:o,onUserCloseViaDialogOrKeybindRef:n}=P(),[i,a]=by(""),{embeddedWallets:l}=Ve(),{authenticated:s}=z(),{closePrivyModal:c}=M(),{onSuccess:m,onFailure:f,callAuthOnSuccessOnClose:u}=o.createWallet,C=e?.embeddedWallets.requireUserOwnedRecoveryOnCreate===!0,{createWallet:g}=Nl(),[y,b]=by(null),E=new Le(async()=>{try{let T=await g();if(!T)return;b(T),r("EMBEDDED_WALLET_CREATED_SCREEN")}catch(T){a(T.message)}});R4(()=>{if(!s){r("LANDING"),f(new Error("User must be authenticated before creating a Privy wallet"));return}if(C){t({...o,recoverySelection:{...o?.recoverySelection,isInAccountCreateFlow:!0}});let T=Ol({walletAction:"create",availableRecoveryMethods:l.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:!1,isResettingPassword:!1});return r(T)}E.execute()},[C,s]);let k=()=>{y?(m(y),c({shouldCallAuthOnSuccess:u})):(f(new Wt("User wallet creation failed")),c({shouldCallAuthOnSuccess:!1}))};return n.current=()=>null,i?Ey(W4,{children:[Wi(x,{closeable:!1}),Ey(ir,{children:[Wi(k4,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),Wi(ge,{title:"Something went wrong",description:i})]}),Wi(B,{onClick:k,children:"Close"}),Wi(M4,{})]}):Wi(Il,{})},M4=I4.div`
1164
+ `;import O4 from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as L4,useState as _y}from"react";import N4 from"styled-components";import{useCallback as M4,useRef as W4}from"react";function Ul(){let{refreshUser:e,createAnalyticsEvent:t,initializeWalletProxy:r}=M(),o=W4(!1);return{createWallet:M4(async i=>{let a=await we();if(!a)throw t({eventName:"embedded_wallet_creation_failed",payload:{error:"Missing access token for user."}}),new Error("An error has occured, please login again.");try{t({eventName:"embedded_wallet_creation_started"});let l=await r(ni);if(!l)throw new Error("walletProxy does not exist.");let s=2e4,c=new Promise((C,g)=>{setTimeout(()=>{g(new Error("walletProxy.create timed out."))},s)});if(!await Promise.race([l.create({accessToken:a,recoveryPassword:i}),c]))throw new Error("walletProxy.create did not send a response.");let f=await e();if(!f)throw new Error("Failed to refresh user.");let u=ge(f);if(!u)throw new Error("Updated user is missing embedded wallet.");return t({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:u.address}}),o.current=!0,u}catch(l){if(o.current)return;throw t({eventName:"embedded_wallet_creation_failed",payload:{error:l.toString()}}),console.warn(l),l}},[])}}import{Fragment as U4,jsx as Li,jsxs as Py}from"react/jsx-runtime";var Ay=()=>{let{app:e,setModalData:t,navigate:r,data:o,onUserCloseViaDialogOrKeybindRef:n}=_(),[i,a]=_y(""),{embeddedWallets:l}=Ve(),{authenticated:s}=q(),{closePrivyModal:c}=M(),{onSuccess:m,onFailure:f,callAuthOnSuccessOnClose:u}=o.createWallet,C=e?.embeddedWallets.requireUserOwnedRecoveryOnCreate===!0,{createWallet:g}=Ul(),[y,b]=_y(null),T=new Le(async()=>{try{let S=await g();if(!S)return;b(S),r("EMBEDDED_WALLET_CREATED_SCREEN")}catch(S){a(S.message)}});L4(()=>{if(!s){r("LANDING"),f(new Error("User must be authenticated before creating a Privy wallet"));return}if(C){t({...o,recoverySelection:{...o?.recoverySelection,isInAccountCreateFlow:!0}});let S=Nl({walletAction:"create",availableRecoveryMethods:l.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:!1,isResettingPassword:!1});return r(S)}T.execute()},[C,s]);let k=()=>{y?(m(y),c({shouldCallAuthOnSuccess:u})):(f(new Wt("User wallet creation failed")),c({shouldCallAuthOnSuccess:!1}))};return n.current=()=>null,i?Py(U4,{children:[Li(A,{closeable:!1}),Py(ar,{children:[Li(O4,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),Li(he,{title:"Something went wrong",description:i})]}),Li(B,{onClick:k,children:"Close"}),Li(D4,{})]}):Li(Wl,{})},D4=N4.div`
1165
1165
  height: 44px;
1166
- `;import{useEffect as P5,useState as Hl}from"react";import{useCallback as up,useEffect as _5}from"react";import U4 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useEffect as F4,useState as lp}from"react";import O4 from"@heroicons/react/24/outline/ArrowPathIcon";import L4 from"@heroicons/react/24/outline/EyeIcon";import N4 from"@heroicons/react/24/outline/EyeSlashIcon";import _t,{css as ap}from"styled-components";var D4=ap`
1166
+ `;import{useEffect as I5,useState as Vl}from"react";import{useCallback as fp,useEffect as R5}from"react";import V4 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useEffect as q4,useState as dp}from"react";import F4 from"@heroicons/react/24/outline/ArrowPathIcon";import B4 from"@heroicons/react/24/outline/EyeIcon";import H4 from"@heroicons/react/24/outline/EyeSlashIcon";import _t,{css as lp}from"styled-components";var G4=lp`
1167
1167
  font-size: 14px;
1168
1168
  font-style: normal;
1169
1169
  font-weight: 400;
@@ -1171,8 +1171,8 @@ Resources:
1171
1171
  letter-spacing: -0.008px;
1172
1172
  text-align: left;
1173
1173
  transition: color 0.1s ease-in;
1174
- `,Dl=_t.span`
1175
- ${D4}
1174
+ `,Fl=_t.span`
1175
+ ${G4}
1176
1176
  transition: color 0.1s ease-in;
1177
1177
  color: ${({error:e})=>e?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
1178
1178
  text-transform: ${({error:e})=>e?"":"capitalize"};
@@ -1180,18 +1180,18 @@ Resources:
1180
1180
  &[aria-hidden='true'] {
1181
1181
  visibility: hidden;
1182
1182
  }
1183
- `,jo=_t.div`
1183
+ `,Yo=_t.div`
1184
1184
  display: flex;
1185
1185
  flex-direction: column;
1186
1186
  justify-content: center;
1187
1187
  flex-grow: 1;
1188
- `,Yo=_t(B)`
1189
- ${e=>e.hideAnimations&&ap`
1188
+ `,Zo=_t(B)`
1189
+ ${e=>e.hideAnimations&&lp`
1190
1190
  && {
1191
1191
  transition: none;
1192
1192
  }
1193
1193
  `}
1194
- `,Sy=ap`
1194
+ `,xy=lp`
1195
1195
  && {
1196
1196
  width: 100%;
1197
1197
  border-width: 1px;
@@ -1206,8 +1206,8 @@ Resources:
1206
1206
  font-weight: 300;
1207
1207
  line-height: 22px; /* 137.5% */
1208
1208
  }
1209
- `,Oi=_t.input`
1210
- ${Sy}
1209
+ `,Ni=_t.input`
1210
+ ${xy}
1211
1211
 
1212
1212
  &::placeholder {
1213
1213
  color: var(--privy-color-foreground-3);
@@ -1218,15 +1218,15 @@ Resources:
1218
1218
  overflow: hidden;
1219
1219
  text-overflow: ellipsis;
1220
1220
  white-space: nowrap;
1221
- `,_y=_t.div`
1222
- ${Sy}
1223
- `,Zo=_t.div`
1221
+ `,ky=_t.div`
1222
+ ${xy}
1223
+ `,Qo=_t.div`
1224
1224
  position: relative;
1225
1225
  width: 100%;
1226
1226
  display: flex;
1227
1227
  align-items: center;
1228
1228
  justify-content: ${({centered:e})=>e?"center":"space-between"};
1229
- `,Qo=_t.div`
1229
+ `,Jo=_t.div`
1230
1230
  display: flex;
1231
1231
  flex-direction: column;
1232
1232
  align-items: center;
@@ -1248,12 +1248,12 @@ Resources:
1248
1248
  font-weight: 400;
1249
1249
  line-height: 20px;
1250
1250
  }
1251
- `,Aa=_t.div`
1251
+ `,xa=_t.div`
1252
1252
  display: flex;
1253
1253
  flex-direction: column;
1254
1254
  gap: 10px;
1255
1255
  padding-bottom: 1rem;
1256
- `,xa=_t.div`
1256
+ `,ka=_t.div`
1257
1257
  display: flex;
1258
1258
  text-align: left;
1259
1259
  align-items: center;
@@ -1273,13 +1273,13 @@ Resources:
1273
1273
  > :first-child {
1274
1274
  min-width: 24px;
1275
1275
  }
1276
- `,jU=_t.div`
1276
+ `,nF=_t.div`
1277
1277
  height: var(--privy-height-modal-full);
1278
1278
 
1279
1279
  @media (max-width: 440px) {
1280
1280
  height: var(--privy-height-modal-compact);
1281
1281
  }
1282
- `,sp=_t(va)`
1282
+ `,cp=_t(Ca)`
1283
1283
  display: flex;
1284
1284
  flex: 1;
1285
1285
  gap: 4px;
@@ -1291,7 +1291,7 @@ Resources:
1291
1291
  border-color: var(--privy-color-foreground-3);
1292
1292
  border-width: 1px;
1293
1293
  }
1294
- `,Li=_t.div`
1294
+ `,Di=_t.div`
1295
1295
  position: absolute;
1296
1296
  right: 0.5rem;
1297
1297
 
@@ -1299,7 +1299,7 @@ Resources:
1299
1299
  flex-direction: row;
1300
1300
  justify-content: space-around;
1301
1301
  align-items: center;
1302
- `,Py=_t(O4)`
1302
+ `,Ry=_t(F4)`
1303
1303
  height: 1.25rem;
1304
1304
  width: 1.25rem;
1305
1305
  stroke: var(--privy-color-accent);
@@ -1308,7 +1308,7 @@ Resources:
1308
1308
  :active {
1309
1309
  stroke: var(--privy-color-accent-light);
1310
1310
  }
1311
- `,Ni=_t(N4)`
1311
+ `,Ui=_t(H4)`
1312
1312
  height: 1.25rem;
1313
1313
  width: 1.25rem;
1314
1314
  stroke: var(--privy-color-accent);
@@ -1317,7 +1317,7 @@ Resources:
1317
1317
  :active {
1318
1318
  stroke: var(--privy-color-accent-light);
1319
1319
  }
1320
- `,Di=_t(L4)`
1320
+ `,Fi=_t(B4)`
1321
1321
  height: 1.25rem;
1322
1322
  width: 1.25rem;
1323
1323
  stroke: var(--privy-color-accent);
@@ -1326,7 +1326,7 @@ Resources:
1326
1326
  :active {
1327
1327
  stroke: var(--privy-color-accent-light);
1328
1328
  }
1329
- `,Ay=_t.progress`
1329
+ `,Iy=_t.progress`
1330
1330
  height: 4px;
1331
1331
  width: 100%;
1332
1332
  margin: 8px 0;
@@ -1342,7 +1342,7 @@ Resources:
1342
1342
  transition: all 0.1s ease-out;
1343
1343
  background: ${({label:e})=>e==="Strong"&&"#78dca6"||e==="Medium"&&"var(--privy-color-warn)"||"var(--privy-color-error)"};
1344
1344
  }
1345
- `;import{Fragment as B4,jsx as lr,jsxs as Ul}from"react/jsx-runtime";var xy=({buttonHideAnimations:e,buttonLoading:t,password:r,onSubmit:o,onBack:n})=>{let[i,a]=lp(!0),[l,s]=lp(!1),[c,m]=lp(""),f=r===c;return F4(()=>{c&&!l&&s(!0)},[c]),Ul(B4,{children:[lr(x,{closeable:!1,backFn:n}),lr(ne,{}),Ul(jo,{children:[Ul(Qo,{children:[lr(U4,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),lr("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),lr("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),Ul(Zo,{children:[lr(Oi,{value:c,onChange:u=>m(u.target.value),onBlur:()=>s(!0),placeholder:"confirm your password",type:i?"password":"text",style:{paddingRight:"2.3rem"}}),lr(Li,{style:{right:"0.75rem"},children:i?lr(Ni,{onClick:()=>a(!1)}):lr(Di,{onClick:()=>a(!0)})})]}),lr(Dl,{"aria-hidden":!l||f,error:!0,children:"Passwords do not match"})]}),lr(Yo,{onClick:o,loading:t,disabled:!f,hideAnimations:e,children:"Continue"}),lr(ie,{}),lr($,{})]})};import q4 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as z4}from"react";import $4 from"styled-components";import Ra from"styled-components";import{jsx as ka,jsxs as V4}from"react/jsx-runtime";var ky=({className:e,checked:t,color:r="var(--privy-color-accent)",...o})=>ka("label",{children:V4(H4,{className:e,children:[ka(Iy,{checked:t,...o}),ka(G4,{color:r,checked:t,children:ka(Ry,{viewBox:"0 0 24 24",children:ka("polyline",{points:"20 6 9 17 4 12"})})})]})});var aF=Ra.label`
1345
+ `;import{Fragment as z4,jsx as cr,jsxs as Bl}from"react/jsx-runtime";var My=({buttonHideAnimations:e,buttonLoading:t,password:r,onSubmit:o,onBack:n})=>{let[i,a]=dp(!0),[l,s]=dp(!1),[c,m]=dp(""),f=r===c;return q4(()=>{c&&!l&&s(!0)},[c]),Bl(z4,{children:[cr(A,{closeable:!1,backFn:n}),cr(re,{}),Bl(Yo,{children:[Bl(Jo,{children:[cr(V4,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),cr("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),cr("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),Bl(Qo,{children:[cr(Ni,{value:c,onChange:u=>m(u.target.value),onBlur:()=>s(!0),placeholder:"confirm your password",type:i?"password":"text",style:{paddingRight:"2.3rem"}}),cr(Di,{style:{right:"0.75rem"},children:i?cr(Ui,{onClick:()=>a(!1)}):cr(Fi,{onClick:()=>a(!0)})})]}),cr(Fl,{"aria-hidden":!l||f,error:!0,children:"Passwords do not match"})]}),cr(Zo,{onClick:o,loading:t,disabled:!f,hideAnimations:e,children:"Continue"}),cr(ie,{}),cr(z,{})]})};import Y4 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as Z4}from"react";import Q4 from"styled-components";import Ia from"styled-components";import{jsx as Ra,jsxs as j4}from"react/jsx-runtime";var Wy=({className:e,checked:t,color:r="var(--privy-color-accent)",...o})=>Ra("label",{children:j4($4,{className:e,children:[Ra(Ly,{checked:t,...o}),Ra(K4,{color:r,checked:t,children:Ra(Oy,{viewBox:"0 0 24 24",children:Ra("polyline",{points:"20 6 9 17 4 12"})})})]})});var yF=Ia.label`
1346
1346
  && {
1347
1347
  cursor: pointer;
1348
1348
  display: flex;
@@ -1354,14 +1354,14 @@ Resources:
1354
1354
  border: 1px solid var(--privy-color-foreground-4);
1355
1355
  width: 100%;
1356
1356
  }
1357
- `,H4=Ra.div`
1357
+ `,$4=Ia.div`
1358
1358
  display: inline-block;
1359
1359
  vertical-align: middle;
1360
- `,Ry=Ra.svg`
1360
+ `,Oy=Ia.svg`
1361
1361
  fill: none;
1362
1362
  stroke: white;
1363
1363
  stroke-width: 3px;
1364
- `,Iy=Ra.input.attrs({type:"checkbox"})`
1364
+ `,Ly=Ia.input.attrs({type:"checkbox"})`
1365
1365
  border: 0;
1366
1366
  clip: rect(0 0 0 0);
1367
1367
  clippath: inset(50%);
@@ -1372,7 +1372,7 @@ Resources:
1372
1372
  position: absolute;
1373
1373
  white-space: nowrap;
1374
1374
  width: 1px;
1375
- `,G4=Ra.div`
1375
+ `,K4=Ia.div`
1376
1376
  display: inline-block;
1377
1377
  width: 18px;
1378
1378
  height: 18px;
@@ -1387,28 +1387,28 @@ Resources:
1387
1387
  border-width: 1px;
1388
1388
  }
1389
1389
 
1390
- ${Iy}:focus + & {
1390
+ ${Ly}:focus + & {
1391
1391
  box-shadow: 0 0 0 1px ${e=>e.color};
1392
1392
  }
1393
1393
 
1394
- ${Ry} {
1394
+ ${Oy} {
1395
1395
  visibility: ${e=>e.checked?"visible":"hidden"};
1396
1396
  }
1397
- `;import{Fragment as My,jsx as xr,jsxs as Ia}from"react/jsx-runtime";var Wy=({buttonHideAnimations:e,buttonLoading:t,onSubmit:r,onBack:o,config:n})=>{let[i,a]=z4(!1);return Ia(My,{children:[xr(x,{closeable:!1,backFn:o}),xr(ne,{}),Ia(jo,{children:[Ia(Qo,{children:[xr(q4,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),xr("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),xr("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),xr(Aa,{children:Ia(xa,{style:{color:"var(--privy-color-error)",cursor:"pointer"},onClick:l=>{l.preventDefault(),a(s=>!s)},children:[xr(ky,{color:"var(--privy-color-error)",readOnly:!0,checked:i}),xr(My,{children:"I understand that if I lose my password and device, I will lose access to my account and my assets."})]})})]}),Ia(K4,{children:[n.initiatedBy==="user"&&xr(Ur,{onClick:n.onCancel,disabled:t,children:"Cancel"}),xr(Yo,{onClick:r,loading:t,hideAnimations:e,disabled:!i,children:"Set Password"})]}),xr(ie,{}),xr($,{})]})},K4=$4.div`
1397
+ `;import{Fragment as Ny,jsx as xr,jsxs as Ma}from"react/jsx-runtime";var Dy=({buttonHideAnimations:e,buttonLoading:t,onSubmit:r,onBack:o,config:n})=>{let[i,a]=Z4(!1);return Ma(Ny,{children:[xr(A,{closeable:!1,backFn:o}),xr(re,{}),Ma(Yo,{children:[Ma(Jo,{children:[xr(Y4,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),xr("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),xr("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),xr(xa,{children:Ma(ka,{style:{color:"var(--privy-color-error)",cursor:"pointer"},onClick:l=>{l.preventDefault(),a(s=>!s)},children:[xr(Wy,{color:"var(--privy-color-error)",readOnly:!0,checked:i}),xr(Ny,{children:"I understand that if I lose my password and device, I will lose access to my account and my assets."})]})})]}),Ma(J4,{children:[n.initiatedBy==="user"&&xr(Ur,{onClick:n.onCancel,disabled:t,children:"Cancel"}),xr(Zo,{onClick:r,loading:t,hideAnimations:e,disabled:!i,children:"Set Password"})]}),xr(ie,{}),xr(z,{})]})},J4=Q4.div`
1398
1398
  display: flex;
1399
1399
  gap: 10px;
1400
- `;import c5 from"@heroicons/react/24/outline/KeyIcon";import By from"@heroicons/react/24/solid/CheckCircleIcon";import{useState as Hy,useMemo as cp,useEffect as d5}from"react";import Gy from"styled-components";import j4 from"fast-password-entropy";import*as Oy from"secure-password-utilities";import{DEFAULT_WORDLIST as Y4}from"secure-password-utilities/wordlists";var Z4=95,Q4=8,J4=3,X4=.3,e5=/[a-z]/,t5=/[A-Z]/,r5=/[0-9]/,o5="a-zA-Z0-9",Ly="!@#$%^&*()\\-_+.",Ny=`${o5}${Ly}`,n5=new RegExp(`[${Ly}]`),i5=new RegExp(`[${Ny}]`),Dy=new RegExp(`^[${Ny}]{6,}$`),Uy=(e="")=>{let t=e.split("").filter(r=>!i5.test(r)).map(r=>r.replace(" ","SPACE"));return[...new Set(t)]},Fl=()=>Oy.generatePassphrase(4,Y4);function a5(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function s5(e){if(e.length<Q4)return 0;let t=0;e5.test(e)&&(t+=1),t5.test(e)&&(t+=1),r5.test(e)&&(t+=1),n5.test(e)&&(t+=1);let r=t/J4;return Math.max(0,Math.min(1,r))}function l5(e=""){let t=s5(e),r=j4(e)/Z4;return(t*X4+r)/2}function Fy(e=""){let t=l5(e);return{value:t,label:a5(t)}}import{Fragment as m5,jsx as Pt,jsxs as lo}from"react/jsx-runtime";var Vy=({buttonHideAnimations:e,buttonLoading:t,password:r="",config:o,isResettingPassword:n,onSubmit:i,onClose:a,onBack:l,onPasswordChange:s,onPasswordGenerate:c})=>{let[m,f]=Hy(!1),[u,C]=Hy(!1);d5(()=>{r&&!u&&C(!0)},[r]);let g=cp(()=>u?(r?.length||0)<6?"Password must be at least 6 characters":Dy.test(r||"")?null:`Invalid characters used ( ${Uy(r).join(" ")} )`:null,[r,u]),y=cp(()=>g?{value:0,label:"Weak"}:Fy(r),[r,g]),b=cp(()=>!!(!r?.length||g),[g,r]);return lo(m5,{children:[Pt(x,{onClose:a,closeable:o.initiatedBy==="user",backFn:l}),Pt(ne,{}),lo(jo,{children:[lo(Qo,{children:[Pt(c5,{height:48,width:48,stroke:"var(--privy-color-accent)"}),lo("h3",{style:{color:"var(--privy-color-foreground)"},children:[n?"Reset":"Set"," your password"]}),Pt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),lo(Zo,{children:[Pt(Oi,{value:r,onChange:E=>s(E.target.value),placeholder:"enter or generate a strong password",type:m?"password":"text",style:{paddingRight:"3.8rem"}}),lo(Li,{style:{width:"3.5rem"},children:[m?Pt(Ni,{onClick:()=>f(!1)}):Pt(Di,{onClick:()=>f(!0)}),Pt(Py,{onClick:c})]})]}),Pt(Ay,{value:y.value===0?.01:y.value,label:y.label}),Pt(Dl,{error:!!g,children:g||`Password Strength: ${u?y.label:"--"}`}),lo(u5,{children:[Pt(p5,{children:lo(Aa,{children:[lo(xa,{children:[Pt(By,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),lo(xa,{children:[Pt(By,{width:24,height:24,fill:"var(--privy-color-accent)"}),"Use it to log in on a new environment, like another browser or device."]})]})}),Pt(Yo,{onClick:i,loading:t,disabled:b,hideAnimations:e,children:"Continue"})]})]}),Pt(ie,{}),Pt($,{})]})},p5=Gy(Aa)`
1400
+ `;import f5 from"@heroicons/react/24/outline/KeyIcon";import qy from"@heroicons/react/24/solid/CheckCircleIcon";import{useState as zy,useMemo as pp,useEffect as h5}from"react";import $y from"styled-components";import X4 from"fast-password-entropy";import*as Uy from"secure-password-utilities";import{DEFAULT_WORDLIST as e5}from"secure-password-utilities/wordlists";var t5=95,r5=8,o5=3,n5=.3,i5=/[a-z]/,a5=/[A-Z]/,s5=/[0-9]/,l5="a-zA-Z0-9",Fy="!@#$%^&*()\\-_+.",By=`${l5}${Fy}`,c5=new RegExp(`[${Fy}]`),d5=new RegExp(`[${By}]`),Hy=new RegExp(`^[${By}]{6,}$`),Gy=(e="")=>{let t=e.split("").filter(r=>!d5.test(r)).map(r=>r.replace(" ","SPACE"));return[...new Set(t)]},Hl=()=>Uy.generatePassphrase(4,e5);function p5(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function u5(e){if(e.length<r5)return 0;let t=0;i5.test(e)&&(t+=1),a5.test(e)&&(t+=1),s5.test(e)&&(t+=1),c5.test(e)&&(t+=1);let r=t/o5;return Math.max(0,Math.min(1,r))}function m5(e=""){let t=u5(e),r=X4(e)/t5;return(t*n5+r)/2}function Vy(e=""){let t=m5(e);return{value:t,label:p5(t)}}import{Fragment as v5,jsx as Pt,jsxs as lo}from"react/jsx-runtime";var Ky=({buttonHideAnimations:e,buttonLoading:t,password:r="",config:o,isResettingPassword:n,onSubmit:i,onClose:a,onBack:l,onPasswordChange:s,onPasswordGenerate:c})=>{let[m,f]=zy(!1),[u,C]=zy(!1);h5(()=>{r&&!u&&C(!0)},[r]);let g=pp(()=>u?(r?.length||0)<6?"Password must be at least 6 characters":Hy.test(r||"")?null:`Invalid characters used ( ${Gy(r).join(" ")} )`:null,[r,u]),y=pp(()=>g?{value:0,label:"Weak"}:Vy(r),[r,g]),b=pp(()=>!!(!r?.length||g),[g,r]);return lo(v5,{children:[Pt(A,{onClose:a,closeable:o.initiatedBy==="user",backFn:l}),Pt(re,{}),lo(Yo,{children:[lo(Jo,{children:[Pt(f5,{height:48,width:48,stroke:"var(--privy-color-accent)"}),lo("h3",{style:{color:"var(--privy-color-foreground)"},children:[n?"Reset":"Set"," your password"]}),Pt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),lo(Qo,{children:[Pt(Ni,{value:r,onChange:T=>s(T.target.value),placeholder:"enter or generate a strong password",type:m?"password":"text",style:{paddingRight:"3.8rem"}}),lo(Di,{style:{width:"3.5rem"},children:[m?Pt(Ui,{onClick:()=>f(!1)}):Pt(Fi,{onClick:()=>f(!0)}),Pt(Ry,{onClick:c})]})]}),Pt(Iy,{value:y.value===0?.01:y.value,label:y.label}),Pt(Fl,{error:!!g,children:g||`Password Strength: ${u?y.label:"--"}`}),lo(g5,{children:[Pt(y5,{children:lo(xa,{children:[lo(ka,{children:[Pt(qy,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),lo(ka,{children:[Pt(qy,{width:24,height:24,fill:"var(--privy-color-accent)"}),"Use it to log in on a new environment, like another browser or device."]})]})}),Pt(Zo,{onClick:i,loading:t,disabled:b,hideAnimations:e,children:"Continue"})]})]}),Pt(ie,{}),Pt(z,{})]})},y5=$y(xa)`
1401
1401
  flex: 1;
1402
1402
  padding-top: 1rem;
1403
- `,u5=Gy.div`
1403
+ `,g5=$y.div`
1404
1404
  display: flex;
1405
1405
  flex-direction: column;
1406
1406
  height: 100%;
1407
- `;import f5 from"@heroicons/react/24/outline/ArrowDownTrayIcon";import h5 from"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import y5 from"@heroicons/react/24/outline/DocumentDuplicateIcon";import g5 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as v5,useCallback as qy}from"react";import{Fragment as dp,jsx as er,jsxs as Un}from"react/jsx-runtime";var zy=({buttonHideAnimations:e,buttonLoading:t,appName:r,password:o,onSubmit:n,onBack:i})=>{let[a,l]=v5(!1),s=qy(()=>{l(!0),o&&navigator.clipboard.writeText(o)},[o]),c=qy(()=>{let m=document.createElement("a"),f=r.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),u=new Blob([C5(r,o)],{type:"text/plain"}),C=URL.createObjectURL(u);m.href=C,m.target="_blank",m.download=`${f}-privy-wallet-recovery.txt`,document.body.appendChild(m),m.click(),setTimeout(()=>{m.remove(),URL.revokeObjectURL(C)},5e3)},[o]);return Un(dp,{children:[er(x,{backFn:i,closeable:!1}),er(ne,{}),Un(jo,{children:[Un(Qo,{children:[er(g5,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),er("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),er("p",{style:{color:"var(--privy-color-foreground-2)"},children:"For your security, this password cannot be reset, so keep it somewhere safe."})]}),er(Zo,{centered:!0,children:er(_y,{children:o})}),Un("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[er(sp,{onClick:s,children:a?Un(dp,{children:[er(h5,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):Un(dp,{children:[er(y5,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),Un(sp,{onClick:c,children:[er(f5,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),er(Yo,{onClick:n,loading:t,hideAnimations:e,children:"Continue"}),er(ie,{}),er($,{})]})},C5=(e,t)=>`Your wallet recovery password for ${e} is
1407
+ `;import C5 from"@heroicons/react/24/outline/ArrowDownTrayIcon";import w5 from"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import b5 from"@heroicons/react/24/outline/DocumentDuplicateIcon";import E5 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as T5,useCallback as jy}from"react";import{Fragment as up,jsx as tr,jsxs as Bn}from"react/jsx-runtime";var Yy=({buttonHideAnimations:e,buttonLoading:t,appName:r,password:o,onSubmit:n,onBack:i})=>{let[a,l]=T5(!1),s=jy(()=>{l(!0),o&&navigator.clipboard.writeText(o)},[o]),c=jy(()=>{let m=document.createElement("a"),f=r.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),u=new Blob([S5(r,o)],{type:"text/plain"}),C=URL.createObjectURL(u);m.href=C,m.target="_blank",m.download=`${f}-privy-wallet-recovery.txt`,document.body.appendChild(m),m.click(),setTimeout(()=>{m.remove(),URL.revokeObjectURL(C)},5e3)},[o]);return Bn(up,{children:[tr(A,{backFn:i,closeable:!1}),tr(re,{}),Bn(Yo,{children:[Bn(Jo,{children:[tr(E5,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),tr("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),tr("p",{style:{color:"var(--privy-color-foreground-2)"},children:"For your security, this password cannot be reset, so keep it somewhere safe."})]}),tr(Qo,{centered:!0,children:tr(ky,{children:o})}),Bn("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[tr(cp,{onClick:s,children:a?Bn(up,{children:[tr(w5,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):Bn(up,{children:[tr(b5,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),Bn(cp,{onClick:c,children:[tr(C5,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),tr(Zo,{onClick:n,loading:t,hideAnimations:e,children:"Continue"}),tr(ie,{}),tr(z,{})]})},S5=(e,t)=>`Your wallet recovery password for ${e} is
1408
1408
 
1409
1409
  ${t}
1410
1410
 
1411
- You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;import w5 from"@heroicons/react/24/solid/CheckCircleIcon";import b5 from"@heroicons/react/24/solid/XCircleIcon";import{Fragment as E5,jsx as ko,jsxs as pp}from"react/jsx-runtime";var $y=({error:e,onClose:t})=>pp(E5,{children:[ko(x,{closeable:!1}),ko(ne,{}),e?pp(ir,{children:[ko(b5,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),ko(ge,{title:"Something went wrong",description:e})]}):pp(ir,{children:[ko(w5,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),ko(ge,{title:"Success"})]}),ko(B,{onClick:t,children:"Close"}),ko(ie,{}),ko($,{})]});import{useReducer as T5}from"react";var S5=(e,t)=>{switch(e){case"creating":return t==="back"?e:"saving";case"saving":return t==="back"?"creating":"confirming";case"confirming":return t==="back"?"saving":"finalizing";case"finalizing":return t==="back"?"confirming":"done";default:return e}},Ky=()=>{let[e,t]=T5(S5,"creating");return{send:t,state:e}};import{jsx as Ma}from"react/jsx-runtime";var Bl=({onSubmit:e,...t})=>{let{lastScreen:r,navigate:o}=P(),{send:n,state:i}=Ky(),a=up(async()=>{i==="finalizing"&&await e(),n("next")},[i,n,e]);_5(()=>{let c;return i==="done"&&t.config.initiatedBy==="automatic"&&(c=setTimeout(()=>t.onClose?.(),Ne)),()=>{c&&clearTimeout(c)}},[i,t.config.initiatedBy,t.onClose]);let l=up(()=>{n("back")},[n]),s=up(()=>{o("EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN")},[r,o]);return i==="creating"?Ma(Vy,{...t,onSubmit:a,onBack:r==="EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"?s:void 0}):i==="saving"?Ma(zy,{...t,onSubmit:a,onBack:l}):i==="confirming"?Ma(xy,{...t,onSubmit:a,onBack:l}):i==="finalizing"?Ma(Wy,{...t,onSubmit:a,onBack:l}):i==="done"?Ma($y,{...t,onSubmit:a}):null};import{jsx as A5}from"react/jsx-runtime";var jy=()=>{let[e,t]=Hl(null),[r,o]=Hl(!1),[n,i]=Hl(null),[a,l]=Hl(""),{authenticated:s,getAccessToken:c,user:m}=z(),{walletProxy:f,refreshUser:u,closePrivyModal:C,createAnalyticsEvent:g}=M(),{app:y,navigate:b,data:E,onUserCloseViaDialogOrKeybindRef:k}=P(),{onSuccess:T,onFailure:A}=E.createWallet,R=ye(m),I=e?.recoveryMethod==="user-passcode",D=R?.recoveryMethod==="user-passcode";P5(()=>{s||(b("LANDING"),A(new ys("User must be authenticated before setting a password on a Privy wallet")))},[s]);let H=()=>{if(n){A(n),C({shouldCallAuthOnSuccess:!1});return}if(!I){A(new Wt("Exited before password was added to wallet")),C({shouldCallAuthOnSuccess:!1});return}T(e),C({shouldCallAuthOnSuccess:!1})};k.current=H;let K=async()=>{let O=await c();if(O&&R?.address&&a&&f)try{if(g({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:R.address,recoveryMethod:"user-passcode",isResettingPassword:D}}),!(await f.setRecovery({accessToken:O,address:R.address,recoveryPassword:a,recoveryMethod:"user-passcode"})).address){i(new Wt("Error setting password on privy wallet")),g({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:R.address,recoveryMethod:"user-passcode",isResettingPassword:D,reason:"error setting password"}});return}let W=await u(),Ce=ye(W);if(!Ce){i(new Wt("Error setting password on privy wallet")),g({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:R.address,recoveryMethod:"user-passcode",isResettingPassword:D,reason:"wallet disconnected"}});return}t(Ce),g({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:R.address,recoveryMethod:"user-passcode",isResettingPassword:D}})}catch(U){console.warn(U),i(U instanceof Error?U:new Error("Error setting password on privy wallet")),g({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:R.address,reason:U}})}},j=async()=>{I?(T(e),C({shouldCallAuthOnSuccess:!1})):(o(!0),i(null),await K(),o(!1))};return A5(Bl,{appName:y?.name||"privy",config:{initiatedBy:"user",onCancel:H},error:n?"An error has occurred, please try again.":void 0,buttonLoading:r,buttonHideAnimations:!1,password:a,isResettingPassword:D,onPasswordGenerate:()=>l(Fl()),onPasswordChange:l,onSubmit:j,onClose:H})};import x5 from"@heroicons/react/24/outline/UserCircleIcon";import k5 from"@heroicons/react/24/solid/LockClosedIcon";import{Fragment as R5,jsx as Ro,jsxs as Gl}from"react/jsx-runtime";var Yy=()=>{let{closePrivyModal:e}=M(),{data:t,setModalData:r,navigate:o,onUserCloseViaDialogOrKeybindRef:n}=P(),{onSuccess:i,onFailure:a}=t.setWalletPassword,l=()=>{a(new Wt("Exited before password was added to wallet")),e({shouldCallAuthOnSuccess:!1})};return n.current=l,Gl(R5,{children:[Ro(x,{onClose:l}),Ro(ne,{}),Gl(ir,{children:[Gl(Ch,{children:[Ro(x5,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),Ro(wh,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:Ro(k5,{width:"12px",height:"12px",fill:"white"})})]}),Gl(ge,{title:"Secure Your Account",children:["Please set a password to secure your account.",Ro("p",{children:"Losing access to this password and this device will make your account inaccessible."})]})]}),Ro(B,{onClick:()=>{r({createWallet:{onFailure:a,onSuccess:i,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),o("EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:"Add password"}),Ro(ie,{}),Ro($,{})]})};import I5 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import M5 from"@heroicons/react/24/outline/PhoneIcon";import Zy from"styled-components";import{Fragment as N5,jsx as kr,jsxs as Vl}from"react/jsx-runtime";var W5=e=>{let t=kr(I5,{height:38,width:38,stroke:"var(--privy-color-error)"});if(e instanceof w)switch(e.privyErrorCode){case"client_request_timeout":return{title:"Timed out",detail:e.message,ctaText:"Try again",icon:t};case"insufficient_balance":return{title:"Insufficient balance",detail:e.message,ctaText:"Try again",icon:t};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else{if(e instanceof We&&e.type==="twilio_verification_failed")return{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:kr(M5,{height:38,width:38,stroke:"var(--privy-color-error)"})};if(e instanceof et)switch(e.privyErrorCode){case"invalid_captcha":return{title:"Something went wrong",detail:"Please try again.",ctaText:"Try again",icon:t};case"disallowed_login_method":return{title:"Not allowed",detail:e.message,ctaText:"Try another method",icon:t};case"allowlist_rejected":return{title:"You don't have access to this app",detail:"Have you been invited?",ctaText:"Try another account",icon:kr(wl,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})};case"captcha_failure":return{title:"Something went wrong",detail:"You did not pass CAPTCHA. Please try again.",ctaText:"Try again",icon:kr("span",{})};case"captcha_timeout":return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:kr("span",{})};case"linked_to_another_user":return{title:"Authentication failed",detail:"This account has already been linked to another user.",ctaText:"Try again",icon:t};case"not_supported":return{title:"This region is not supported",detail:"SMS authentication from this region is not available",ctaText:"Try another method",icon:t};case"too_many_requests":return{title:"Request failed",detail:"Too many attempts.",ctaText:"Try again later",icon:t};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else return e instanceof Mt&&e.status===422?{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:t}:{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}},Qy=()=>{let{navigate:e,navigateBack:t,data:r,lastScreen:o,currentScreen:n}=P(),i=r?.errorModalData?.previousScreen||(o===n?void 0:o);return kr(Fn,{error:r?.errorModalData?.error||new Error,backFn:()=>i?e(i,!1):t(),onClick:()=>e(i||"LANDING",!1)})},Fn=({error:e,backFn:t,onClick:r})=>{let{reset:o}=be(),n=W5(e),i=()=>{e instanceof et&&e.privyErrorCode==="invalid_captcha"&&o(),r?.()};return Vl(N5,{children:[kr(x,{backFn:t}),Vl(O5,{children:[kr(Je,{children:Vl("div",{children:[kr(Cl,{color:"var(--privy-color-error)"}),n.icon]})}),Vl(L5,{children:[kr("h3",{children:n.title}),kr("p",{children:n.detail})]}),kr(B,{color:"var(--privy-color-error)",onClick:i,children:n.ctaText})]})]})},O5=Zy.div`
1411
+ You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;import _5 from"@heroicons/react/24/solid/CheckCircleIcon";import P5 from"@heroicons/react/24/solid/XCircleIcon";import{Fragment as A5,jsx as ko,jsxs as mp}from"react/jsx-runtime";var Zy=({error:e,onClose:t})=>mp(A5,{children:[ko(A,{closeable:!1}),ko(re,{}),e?mp(ar,{children:[ko(P5,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),ko(he,{title:"Something went wrong",description:e})]}):mp(ar,{children:[ko(_5,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),ko(he,{title:"Success"})]}),ko(B,{onClick:t,children:"Close"}),ko(ie,{}),ko(z,{})]});import{useReducer as x5}from"react";var k5=(e,t)=>{switch(e){case"creating":return t==="back"?e:"saving";case"saving":return t==="back"?"creating":"confirming";case"confirming":return t==="back"?"saving":"finalizing";case"finalizing":return t==="back"?"confirming":"done";default:return e}},Qy=()=>{let[e,t]=x5(k5,"creating");return{send:t,state:e}};import{jsx as Wa}from"react/jsx-runtime";var Gl=({onSubmit:e,...t})=>{let{lastScreen:r,navigate:o}=_(),{send:n,state:i}=Qy(),a=fp(async()=>{i==="finalizing"&&await e(),n("next")},[i,n,e]);R5(()=>{let c;return i==="done"&&t.config.initiatedBy==="automatic"&&(c=setTimeout(()=>t.onClose?.(),Ne)),()=>{c&&clearTimeout(c)}},[i,t.config.initiatedBy,t.onClose]);let l=fp(()=>{n("back")},[n]),s=fp(()=>{o("EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN")},[r,o]);return i==="creating"?Wa(Ky,{...t,onSubmit:a,onBack:r==="EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"?s:void 0}):i==="saving"?Wa(Yy,{...t,onSubmit:a,onBack:l}):i==="confirming"?Wa(My,{...t,onSubmit:a,onBack:l}):i==="finalizing"?Wa(Dy,{...t,onSubmit:a,onBack:l}):i==="done"?Wa(Zy,{...t,onSubmit:a}):null};import{jsx as M5}from"react/jsx-runtime";var Jy=()=>{let[e,t]=Vl(null),[r,o]=Vl(!1),[n,i]=Vl(null),[a,l]=Vl(""),{authenticated:s,getAccessToken:c,user:m}=q(),{walletProxy:f,refreshUser:u,closePrivyModal:C,createAnalyticsEvent:g}=M(),{app:y,navigate:b,data:T,onUserCloseViaDialogOrKeybindRef:k}=_(),{onSuccess:S,onFailure:x}=T.createWallet,R=ge(m),I=e?.recoveryMethod==="user-passcode",D=R?.recoveryMethod==="user-passcode";I5(()=>{s||(b("LANDING"),x(new gs("User must be authenticated before setting a password on a Privy wallet")))},[s]);let H=()=>{if(n){x(n),C({shouldCallAuthOnSuccess:!1});return}if(!I){x(new Wt("Exited before password was added to wallet")),C({shouldCallAuthOnSuccess:!1});return}S(e),C({shouldCallAuthOnSuccess:!1})};k.current=H;let K=async()=>{let O=await c();if(O&&R?.address&&a&&f)try{if(g({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:R.address,recoveryMethod:"user-passcode",isResettingPassword:D}}),!(await f.setRecovery({accessToken:O,address:R.address,recoveryPassword:a,recoveryMethod:"user-passcode"})).address){i(new Wt("Error setting password on privy wallet")),g({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:R.address,recoveryMethod:"user-passcode",isResettingPassword:D,reason:"error setting password"}});return}let W=await u(),Ce=ge(W);if(!Ce){i(new Wt("Error setting password on privy wallet")),g({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:R.address,recoveryMethod:"user-passcode",isResettingPassword:D,reason:"wallet disconnected"}});return}t(Ce),g({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:R.address,recoveryMethod:"user-passcode",isResettingPassword:D}})}catch(U){console.warn(U),i(U instanceof Error?U:new Error("Error setting password on privy wallet")),g({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:R.address,reason:U}})}},j=async()=>{I?(S(e),C({shouldCallAuthOnSuccess:!1})):(o(!0),i(null),await K(),o(!1))};return M5(Gl,{appName:y?.name||"privy",config:{initiatedBy:"user",onCancel:H},error:n?"An error has occurred, please try again.":void 0,buttonLoading:r,buttonHideAnimations:!1,password:a,isResettingPassword:D,onPasswordGenerate:()=>l(Hl()),onPasswordChange:l,onSubmit:j,onClose:H})};import W5 from"@heroicons/react/24/outline/UserCircleIcon";import O5 from"@heroicons/react/24/solid/LockClosedIcon";import{Fragment as L5,jsx as Ro,jsxs as ql}from"react/jsx-runtime";var Xy=()=>{let{closePrivyModal:e}=M(),{data:t,setModalData:r,navigate:o,onUserCloseViaDialogOrKeybindRef:n}=_(),{onSuccess:i,onFailure:a}=t.setWalletPassword,l=()=>{a(new Wt("Exited before password was added to wallet")),e({shouldCallAuthOnSuccess:!1})};return n.current=l,ql(L5,{children:[Ro(A,{onClose:l}),Ro(re,{}),ql(ar,{children:[ql(Th,{children:[Ro(W5,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),Ro(Sh,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:Ro(O5,{width:"12px",height:"12px",fill:"white"})})]}),ql(he,{title:"Secure Your Account",children:["Please set a password to secure your account.",Ro("p",{children:"Losing access to this password and this device will make your account inaccessible."})]})]}),Ro(B,{onClick:()=>{r({createWallet:{onFailure:a,onSuccess:i,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),o("EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:"Add password"}),Ro(ie,{}),Ro(z,{})]})};import N5 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import D5 from"@heroicons/react/24/outline/PhoneIcon";import eg from"styled-components";import{Fragment as H5,jsx as kr,jsxs as zl}from"react/jsx-runtime";var U5=e=>{let t=kr(N5,{height:38,width:38,stroke:"var(--privy-color-error)"});if(e instanceof w)switch(e.privyErrorCode){case"client_request_timeout":return{title:"Timed out",detail:e.message,ctaText:"Try again",icon:t};case"insufficient_balance":return{title:"Insufficient balance",detail:e.message,ctaText:"Try again",icon:t};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else{if(e instanceof We&&e.type==="twilio_verification_failed")return{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:kr(D5,{height:38,width:38,stroke:"var(--privy-color-error)"})};if(e instanceof et)switch(e.privyErrorCode){case"invalid_captcha":return{title:"Something went wrong",detail:"Please try again.",ctaText:"Try again",icon:t};case"disallowed_login_method":return{title:"Not allowed",detail:e.message,ctaText:"Try another method",icon:t};case"allowlist_rejected":return{title:"You don't have access to this app",detail:"Have you been invited?",ctaText:"Try another account",icon:kr(El,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})};case"captcha_failure":return{title:"Something went wrong",detail:"You did not pass CAPTCHA. Please try again.",ctaText:"Try again",icon:kr("span",{})};case"captcha_timeout":return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:kr("span",{})};case"linked_to_another_user":return{title:"Authentication failed",detail:"This account has already been linked to another user.",ctaText:"Try again",icon:t};case"not_supported":return{title:"This region is not supported",detail:"SMS authentication from this region is not available",ctaText:"Try another method",icon:t};case"too_many_requests":return{title:"Request failed",detail:"Too many attempts.",ctaText:"Try again later",icon:t};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else return e instanceof Mt&&e.status===422?{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:t}:{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}},tg=()=>{let{navigate:e,navigateBack:t,data:r,lastScreen:o,currentScreen:n}=_(),i=r?.errorModalData?.previousScreen||(o===n?void 0:o);return kr(Hn,{error:r?.errorModalData?.error||new Error,backFn:()=>i?e(i,!1):t(),onClick:()=>e(i||"LANDING",!1)})},Hn=({error:e,backFn:t,onClick:r})=>{let{reset:o}=be(),n=U5(e),i=()=>{e instanceof et&&e.privyErrorCode==="invalid_captcha"&&o(),r?.()};return zl(H5,{children:[kr(A,{backFn:t}),zl(F5,{children:[kr(Je,{children:zl("div",{children:[kr(bl,{color:"var(--privy-color-error)"}),n.icon]})}),zl(B5,{children:[kr("h3",{children:n.title}),kr("p",{children:n.detail})]}),kr(B,{color:"var(--privy-color-error)",onClick:i,children:n.ctaText})]})]})},F5=eg.div`
1412
1412
  display: flex;
1413
1413
  flex-direction: column;
1414
1414
  align-items: center;
@@ -1416,11 +1416,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
1416
1416
  gap: 24px;
1417
1417
  width: 100%;
1418
1418
  padding-bottom: 16px;
1419
- `,L5=Zy.div`
1419
+ `,B5=eg.div`
1420
1420
  display: flex;
1421
1421
  flex-direction: column;
1422
1422
  gap: 8px;
1423
- `;import{useEffect as ng,useRef as r6,useState as hp}from"react";import{isIOS as o6,isMobile as ig}from"react-device-detect";import lg from"styled-components";import{useState as D5}from"react";import U5 from"styled-components";import{jsx as Jy}from"react/jsx-runtime";var Ui=({style:e,color:t,...r})=>Jy("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:t||"currentColor",style:{height:"1.5rem",width:"1.5rem",...e},...r,children:Jy("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});import{jsx as mp}from"react/jsx-runtime";var Xy=({color:e,...t})=>mp("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 115.77 122.88",xmlSpace:"preserve",...t,children:mp("g",{children:mp("path",{fill:e||"currentColor",className:"st0",d:"M89.62,13.96v7.73h12.19h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02v0.02 v73.27v0.01h-0.02c-0.01,3.84-1.57,7.33-4.1,9.86c-2.51,2.5-5.98,4.06-9.82,4.07v0.02h-0.02h-61.7H40.1v-0.02 c-3.84-0.01-7.34-1.57-9.86-4.1c-2.5-2.51-4.06-5.98-4.07-9.82h-0.02v-0.02V92.51H13.96h-0.01v-0.02c-3.84-0.01-7.34-1.57-9.86-4.1 c-2.5-2.51-4.06-5.98-4.07-9.82H0v-0.02V13.96v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07V0h0.02h61.7 h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02V13.96L89.62,13.96z M79.04,21.69v-7.73v-0.02h0.02 c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v64.59v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h12.19V35.65 v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07v-0.02h0.02H79.04L79.04,21.69z M105.18,108.92V35.65v-0.02 h0.02c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v73.27v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h61.7h0.02 v0.02c0.91,0,1.75-0.39,2.37-1.01c0.61-0.61,1-1.46,1-2.37h-0.02V108.92L105.18,108.92z"})})});import{jsx as eg,jsxs as B5}from"react/jsx-runtime";var Jo=e=>{let[t,r]=D5(!1);return B5(F5,{color:e.color,onClick:()=>{r(!0),navigator.clipboard.writeText(e.text),setTimeout(()=>r(!1),1500)},justCopied:t,children:[t?eg(Ui,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):eg(Xy,{style:{height:"14px",width:"14px"}}),t?"Copied":"Copy"," ",e.itemName?e.itemName:"to Clipboard"]})},F5=U5.button`
1423
+ `;import{useEffect as lg,useRef as s6,useState as gp}from"react";import{isIOS as l6,isMobile as cg}from"react-device-detect";import ug from"styled-components";import{useState as G5}from"react";import V5 from"styled-components";import{jsx as rg}from"react/jsx-runtime";var Bi=({style:e,color:t,...r})=>rg("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:t||"currentColor",style:{height:"1.5rem",width:"1.5rem",...e},...r,children:rg("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});import{jsx as hp}from"react/jsx-runtime";var og=({color:e,...t})=>hp("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 115.77 122.88",xmlSpace:"preserve",...t,children:hp("g",{children:hp("path",{fill:e||"currentColor",className:"st0",d:"M89.62,13.96v7.73h12.19h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02v0.02 v73.27v0.01h-0.02c-0.01,3.84-1.57,7.33-4.1,9.86c-2.51,2.5-5.98,4.06-9.82,4.07v0.02h-0.02h-61.7H40.1v-0.02 c-3.84-0.01-7.34-1.57-9.86-4.1c-2.5-2.51-4.06-5.98-4.07-9.82h-0.02v-0.02V92.51H13.96h-0.01v-0.02c-3.84-0.01-7.34-1.57-9.86-4.1 c-2.5-2.51-4.06-5.98-4.07-9.82H0v-0.02V13.96v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07V0h0.02h61.7 h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02V13.96L89.62,13.96z M79.04,21.69v-7.73v-0.02h0.02 c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v64.59v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h12.19V35.65 v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07v-0.02h0.02H79.04L79.04,21.69z M105.18,108.92V35.65v-0.02 h0.02c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v73.27v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h61.7h0.02 v0.02c0.91,0,1.75-0.39,2.37-1.01c0.61-0.61,1-1.46,1-2.37h-0.02V108.92L105.18,108.92z"})})});import{jsx as ng,jsxs as z5}from"react/jsx-runtime";var Xo=e=>{let[t,r]=G5(!1);return z5(q5,{color:e.color,onClick:()=>{r(!0),navigator.clipboard.writeText(e.text),setTimeout(()=>r(!1),1500)},justCopied:t,children:[t?ng(Bi,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):ng(og,{style:{height:"14px",width:"14px"}}),t?"Copied":"Copy"," ",e.itemName?e.itemName:"to Clipboard"]})},q5=V5.button`
1424
1424
  display: flex;
1425
1425
  align-items: center;
1426
1426
  gap: 6px;
@@ -1458,7 +1458,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1458
1458
  width: 14px;
1459
1459
  height: 14px;
1460
1460
  }
1461
- `;import{useState as H5}from"react";import G5 from"styled-components";import{jsx as q5}from"react/jsx-runtime";var ql=e=>{let[t,r]=H5(!1);return q5(V5,{color:e.color,href:e.url,target:"_blank",rel:"noreferrer noopener",onClick:()=>{r(!0),setTimeout(()=>r(!1),1500)},justOpened:t,children:e.text})},V5=G5.a`
1461
+ `;import{useState as $5}from"react";import K5 from"styled-components";import{jsx as Y5}from"react/jsx-runtime";var $l=e=>{let[t,r]=$5(!1);return Y5(j5,{color:e.color,href:e.url,target:"_blank",rel:"noreferrer noopener",onClick:()=>{r(!0),setTimeout(()=>r(!1),1500)},justOpened:t,children:e.text})},j5=K5.a`
1462
1462
  display: flex;
1463
1463
  align-items: center;
1464
1464
  gap: 6px;
@@ -1496,7 +1496,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1496
1496
  width: 14px;
1497
1497
  height: 14px;
1498
1498
  }
1499
- `;import z5 from"qrcode";import $5 from"react";import K5 from"styled-components";import{jsx as tg}from"react/jsx-runtime";var rg=()=>tg("svg",{width:"200",height:"200",viewBox:"-77 -77 200 200",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px"},children:tg("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});import{Fragment as Wa,jsx as Nt,jsxs as og}from"react/jsx-runtime";var cr=7,fp=(e,t,r,o,n)=>{for(let i=t;i<t+o;i++)for(let a=r;a<r+n;a++){let l=e?.[a];l&&l[i]&&(l[i]=0)}return e},j5=e=>{let t=z5.create(e,{errorCorrectionLevel:"high"}).modules,r=sm(Array.from(t.data),t.size);return r=fp(r,0,0,cr,cr),r=fp(r,r.length-cr,0,cr,cr),r=fp(r,0,r.length-cr,cr,cr),r},Y5=({x:e,y:t,cellSize:r,bgColor:o,fgColor:n})=>Nt(Wa,{children:[0,1,2].map(i=>Nt("circle",{r:r*(cr-i*2)/2,cx:e+r*cr/2,cy:t+r*cr/2,fill:i%2!==0?o:n},`finder-${e}-${t}-${i}`))}),Z5=({cellSize:e,matrixSize:t,bgColor:r,fgColor:o})=>{let n=[[0,0],[(t-cr)*e,0],[0,(t-cr)*e]];return Nt(Wa,{children:n.map(([i,a])=>Nt(Y5,{x:i,y:a,cellSize:e,bgColor:r,fgColor:o},`finder-${i}-${a}`))})},Q5=({matrix:e,cellSize:t,color:r})=>Nt(Wa,{children:e.map((i,a)=>i.map((l,s)=>l?Nt("rect",{height:t-.2*2,width:t-.2*2,x:a*t+t*(.2/2),y:s*t+t*(.2/2),rx:t*.5,ry:t*.5,fill:r},`cell-${a}-${s}`):Nt($5.Fragment,{},`circle-${a}-${s}`)))}),J5=({cellSize:e,matrixSize:t,element:r,sizePercentage:o,bgColor:n})=>{if(!r)return Nt(Wa,{});let i=t*(o||.15),a=Math.floor(t/2-i/2),l=Math.floor(t/2+i/2);(l-a)%2!==t%2&&(l+=1);let s=(l-a)*e,c=.1,m=s-s*c*2,f=r,u=a*e;return og(Wa,{children:[Nt("rect",{x:a*e,y:a*e,width:s,height:s,fill:n}),Nt(f,{x:u+s*c,y:u+s*c,height:m,width:m})]})},X5=e=>{let t=e.outputSize,r=j5(e.url),o=t/r.length;return og("svg",{height:e.outputSize,width:e.outputSize,viewBox:`0 0 ${e.outputSize} ${e.outputSize}`,style:{height:"100%",width:"100%"},children:[Nt(Q5,{matrix:r,cellSize:o,color:e.fgColor}),Nt(Z5,{cellSize:o,matrixSize:r.length,fgColor:e.fgColor,bgColor:e.bgColor}),Nt(J5,{cellSize:o,element:e.logo?.element,bgColor:e.bgColor,matrixSize:r.length})]})},e6=K5.div`
1499
+ `;import Z5 from"qrcode";import Q5 from"react";import J5 from"styled-components";import{jsx as ig}from"react/jsx-runtime";var ag=()=>ig("svg",{width:"200",height:"200",viewBox:"-77 -77 200 200",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px"},children:ig("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});import{Fragment as Oa,jsx as Nt,jsxs as sg}from"react/jsx-runtime";var dr=7,yp=(e,t,r,o,n)=>{for(let i=t;i<t+o;i++)for(let a=r;a<r+n;a++){let l=e?.[a];l&&l[i]&&(l[i]=0)}return e},X5=e=>{let t=Z5.create(e,{errorCorrectionLevel:"high"}).modules,r=dm(Array.from(t.data),t.size);return r=yp(r,0,0,dr,dr),r=yp(r,r.length-dr,0,dr,dr),r=yp(r,0,r.length-dr,dr,dr),r},e6=({x:e,y:t,cellSize:r,bgColor:o,fgColor:n})=>Nt(Oa,{children:[0,1,2].map(i=>Nt("circle",{r:r*(dr-i*2)/2,cx:e+r*dr/2,cy:t+r*dr/2,fill:i%2!==0?o:n},`finder-${e}-${t}-${i}`))}),t6=({cellSize:e,matrixSize:t,bgColor:r,fgColor:o})=>{let n=[[0,0],[(t-dr)*e,0],[0,(t-dr)*e]];return Nt(Oa,{children:n.map(([i,a])=>Nt(e6,{x:i,y:a,cellSize:e,bgColor:r,fgColor:o},`finder-${i}-${a}`))})},r6=({matrix:e,cellSize:t,color:r})=>Nt(Oa,{children:e.map((i,a)=>i.map((l,s)=>l?Nt("rect",{height:t-.2*2,width:t-.2*2,x:a*t+t*(.2/2),y:s*t+t*(.2/2),rx:t*.5,ry:t*.5,fill:r},`cell-${a}-${s}`):Nt(Q5.Fragment,{},`circle-${a}-${s}`)))}),o6=({cellSize:e,matrixSize:t,element:r,sizePercentage:o,bgColor:n})=>{if(!r)return Nt(Oa,{});let i=t*(o||.15),a=Math.floor(t/2-i/2),l=Math.floor(t/2+i/2);(l-a)%2!==t%2&&(l+=1);let s=(l-a)*e,c=.1,m=s-s*c*2,f=r,u=a*e;return sg(Oa,{children:[Nt("rect",{x:a*e,y:a*e,width:s,height:s,fill:n}),Nt(f,{x:u+s*c,y:u+s*c,height:m,width:m})]})},n6=e=>{let t=e.outputSize,r=X5(e.url),o=t/r.length;return sg("svg",{height:e.outputSize,width:e.outputSize,viewBox:`0 0 ${e.outputSize} ${e.outputSize}`,style:{height:"100%",width:"100%"},children:[Nt(r6,{matrix:r,cellSize:o,color:e.fgColor}),Nt(t6,{cellSize:o,matrixSize:r.length,fgColor:e.fgColor,bgColor:e.bgColor}),Nt(o6,{cellSize:o,element:e.logo?.element,bgColor:e.bgColor,matrixSize:r.length})]})},i6=J5.div`
1500
1500
  display: flex;
1501
1501
  justify-content: center;
1502
1502
  align-items: center;
@@ -1511,7 +1511,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1511
1511
  border-color: ${e=>e.borderColor};
1512
1512
  border-radius: var(--privy-border-radius-md);
1513
1513
  }
1514
- `,Xo=e=>{let{appearance:t}=Ve(),r=e.bgColor||"#FFFFFF",o=e.fgColor||"#000000",n=e.size||160,i=t.palette.colorScheme==="dark"?r:o;return Nt(e6,{size:n,bgColor:r,fgColor:o,borderColor:i,children:Nt(X5,{url:e.url,logo:{element:e.squareLogoElement??rg},outputSize:n,bgColor:r,fgColor:o})})};import{jsx as zl,jsxs as t6}from"react/jsx-runtime";var co=({style:e,...t})=>t6("svg",{width:"1000",height:"1000",viewBox:"0 0 1000 1000",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",...e},...t,children:[zl("rect",{width:"1000",height:"1000",rx:"200",fill:"#855DCD"}),zl("path",{d:"M257.778 155.556H742.222V844.444H671.111V528.889H670.414C662.554 441.677 589.258 373.333 500 373.333C410.742 373.333 337.446 441.677 329.586 528.889H328.889V844.444H257.778V155.556Z",fill:"white"}),zl("path",{d:"M128.889 253.333L157.778 351.111H182.222V746.667C169.949 746.667 160 756.616 160 768.889V795.556H155.556C143.283 795.556 133.333 805.505 133.333 817.778V844.444H382.222V817.778C382.222 805.505 372.273 795.556 360 795.556H355.556V768.889C355.556 756.616 345.606 746.667 333.333 746.667H306.667V253.333H128.889Z",fill:"white"}),zl("path",{d:"M675.556 746.667C663.283 746.667 653.333 756.616 653.333 768.889V795.556H648.889C636.616 795.556 626.667 805.505 626.667 817.778V844.444H875.556V817.778C875.556 805.505 865.606 795.556 853.333 795.556H848.889V768.889C848.889 756.616 838.94 746.667 826.667 746.667V351.111H851.111L880 253.333H702.222V746.667H675.556Z",fill:"white"})]});import{Fragment as $l,jsx as ke,jsxs as po}from"react/jsx-runtime";var ag="#8a63d2",cg=1e3,n6=cg*2,i6=cg*120,dg=()=>{let{authenticated:e,logout:t,ready:r,user:o}=z(),{lastScreen:n,navigate:i,navigateBack:a,setModalData:l,app:s}=P(),{getAuthFlow:c,loginWithFarcaster:m,closePrivyModal:f,createAnalyticsEvent:u}=M(),[C,g]=hp(void 0),[y,b]=hp(!1),[E,k]=hp(!1),T=r6([]),A=Ne,R=c(),I=R?.meta.connectUri;return ng(()=>{let D=Date.now(),H=setInterval(async()=>{let K=await R.pollForReady.execute(),j=Date.now()-D;if(K){clearInterval(H),b(!0);try{await m(),k(!0)}catch(O){let U={retryable:!1,message:"Authentication failed"};if(O?.privyErrorCode==="allowlist_rejected"){i("ALLOWLIST_REJECTION_SCREEN");return}else if(O?.privyErrorCode==="max_accounts_reached"){console.error(new br(O).toString()),i("USER_LIMIT_REACHED_SCREEN");return}else if(O?.privyErrorCode==="user_does_not_exist"){i("ACCOUNT_NOT_FOUND_SCREEN");return}else O?.privyErrorCode==="linked_to_another_user"?U.detail="This account has already been linked to another user.":O?.privyErrorCode==="invalid_credentials"?(U.retryable=!0,U.detail="Something went wrong. Try again."):O?.privyErrorCode==="too_many_requests"&&(U.detail="Too many requests. Please wait before trying again.");g(U)}}else j>i6&&(clearInterval(H),g({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))},n6);return()=>{clearInterval(H),T.current.forEach(K=>clearTimeout(K))}},[]),ng(()=>{if(r&&e&&E&&o){if(s?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let H=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},A);return()=>clearTimeout(H)}E&&(qt(o,s?.embeddedWallets.createOnLogin)?T.current.push(setTimeout(()=>{l({createWallet:{onSuccess:()=>{},onFailure:H=>{console.error(H),u({eventName:"embedded_wallet_creation_failure_logout",payload:{error:H,screen:"FarcasterConnectStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},A)):T.current.push(setTimeout(()=>f({shouldCallAuthOnSuccess:!0,isSuccess:!0}),A)))}},[E,r,e,o]),ig||y?po($l,{children:[ke(x,{backFn:n?a:void 0,onClose:f},"header"),ke(ne,{}),o6?ke($l,{children:po(a6,{children:[ke(Je,{children:po("div",{children:[ke(ot,{success:E,fail:!!C}),ke(co,{style:{width:"38px",height:"38px"}})]})}),po(qe,{children:[ke(de,{children:C?C.message:"Sign in with Farcaster"}),ke(ue,{children:C?C.detail:"To sign in with Farcaster, please open the Warpcast app."})]}),I&&ke(B,{onClick:D=>{D.preventDefault(),window.location.href=I},children:"Open Warpcast app"})]})}):ke($l,{children:po(sg,{children:[ke(Je,{children:po("div",{children:[ke(ot,{success:E,fail:!!C}),ke(co,{style:{width:"38px",height:"38px"}})]})}),po(qe,{children:[ke(de,{children:C?C.message:"Signing in with Farcaster"}),ke(ue,{children:C?C.detail:"This should only take a moment"}),ke(wt,{children:I&&ig&&ke(ql,{text:"Take me to Warpcast",url:I,color:ag})})]})]})}),ke(Z,{})]}):po($l,{children:[ke(x,{backFn:n?a:void 0,onClose:f},"header"),ke(ne,{}),ke(sg,{children:po("div",{children:[ke(de,{children:"Sign in with Farcaster"}),ke(ue,{children:"Scan with your phone's camera to continue."}),ke(wi,{children:I?ke(Xo,{url:I,size:275,squareLogoElement:co}):ke(nt,{})}),po(wt,{children:[ke(ue,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),I&&ke(Jo,{text:I,itemName:"link",color:ag})]})]})}),ke(Z,{})]})},sg=lg.div`
1514
+ `,en=e=>{let{appearance:t}=Ve(),r=e.bgColor||"#FFFFFF",o=e.fgColor||"#000000",n=e.size||160,i=t.palette.colorScheme==="dark"?r:o;return Nt(i6,{size:n,bgColor:r,fgColor:o,borderColor:i,children:Nt(n6,{url:e.url,logo:{element:e.squareLogoElement??ag},outputSize:n,bgColor:r,fgColor:o})})};import{jsx as Kl,jsxs as a6}from"react/jsx-runtime";var co=({style:e,...t})=>a6("svg",{width:"1000",height:"1000",viewBox:"0 0 1000 1000",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",...e},...t,children:[Kl("rect",{width:"1000",height:"1000",rx:"200",fill:"#855DCD"}),Kl("path",{d:"M257.778 155.556H742.222V844.444H671.111V528.889H670.414C662.554 441.677 589.258 373.333 500 373.333C410.742 373.333 337.446 441.677 329.586 528.889H328.889V844.444H257.778V155.556Z",fill:"white"}),Kl("path",{d:"M128.889 253.333L157.778 351.111H182.222V746.667C169.949 746.667 160 756.616 160 768.889V795.556H155.556C143.283 795.556 133.333 805.505 133.333 817.778V844.444H382.222V817.778C382.222 805.505 372.273 795.556 360 795.556H355.556V768.889C355.556 756.616 345.606 746.667 333.333 746.667H306.667V253.333H128.889Z",fill:"white"}),Kl("path",{d:"M675.556 746.667C663.283 746.667 653.333 756.616 653.333 768.889V795.556H648.889C636.616 795.556 626.667 805.505 626.667 817.778V844.444H875.556V817.778C875.556 805.505 865.606 795.556 853.333 795.556H848.889V768.889C848.889 756.616 838.94 746.667 826.667 746.667V351.111H851.111L880 253.333H702.222V746.667H675.556Z",fill:"white"})]});import{Fragment as jl,jsx as ke,jsxs as po}from"react/jsx-runtime";var dg="#8a63d2",mg=1e3,c6=mg*2,d6=mg*120,fg=()=>{let{authenticated:e,logout:t,ready:r,user:o}=q(),{lastScreen:n,navigate:i,navigateBack:a,setModalData:l,app:s}=_(),{getAuthFlow:c,loginWithFarcaster:m,closePrivyModal:f,createAnalyticsEvent:u}=M(),[C,g]=gp(void 0),[y,b]=gp(!1),[T,k]=gp(!1),S=s6([]),x=Ne,R=c(),I=R?.meta.connectUri;return lg(()=>{let D=Date.now(),H=setInterval(async()=>{let K=await R.pollForReady.execute(),j=Date.now()-D;if(K){clearInterval(H),b(!0);try{await m(),k(!0)}catch(O){let U={retryable:!1,message:"Authentication failed"};if(O?.privyErrorCode==="allowlist_rejected"){i("ALLOWLIST_REJECTION_SCREEN");return}else if(O?.privyErrorCode==="max_accounts_reached"){console.error(new Er(O).toString()),i("USER_LIMIT_REACHED_SCREEN");return}else if(O?.privyErrorCode==="user_does_not_exist"){i("ACCOUNT_NOT_FOUND_SCREEN");return}else O?.privyErrorCode==="linked_to_another_user"?U.detail="This account has already been linked to another user.":O?.privyErrorCode==="invalid_credentials"?(U.retryable=!0,U.detail="Something went wrong. Try again."):O?.privyErrorCode==="too_many_requests"&&(U.detail="Too many requests. Please wait before trying again.");g(U)}}else j>d6&&(clearInterval(H),g({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))},c6);return()=>{clearInterval(H),S.current.forEach(K=>clearTimeout(K))}},[]),lg(()=>{if(r&&e&&T&&o){if(s?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let H=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},x);return()=>clearTimeout(H)}T&&(qt(o,s?.embeddedWallets.createOnLogin)?S.current.push(setTimeout(()=>{l({createWallet:{onSuccess:()=>{},onFailure:H=>{console.error(H),u({eventName:"embedded_wallet_creation_failure_logout",payload:{error:H,screen:"FarcasterConnectStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},x)):S.current.push(setTimeout(()=>f({shouldCallAuthOnSuccess:!0,isSuccess:!0}),x)))}},[T,r,e,o]),cg||y?po(jl,{children:[ke(A,{backFn:n?a:void 0,onClose:f},"header"),ke(re,{}),l6?ke(jl,{children:po(p6,{children:[ke(Je,{children:po("div",{children:[ke(nt,{success:T,fail:!!C}),ke(co,{style:{width:"38px",height:"38px"}})]})}),po(qe,{children:[ke(de,{children:C?C.message:"Sign in with Farcaster"}),ke(ue,{children:C?C.detail:"To sign in with Farcaster, please open the Warpcast app."})]}),I&&ke(B,{onClick:D=>{D.preventDefault(),window.location.href=I},children:"Open Warpcast app"})]})}):ke(jl,{children:po(pg,{children:[ke(Je,{children:po("div",{children:[ke(nt,{success:T,fail:!!C}),ke(co,{style:{width:"38px",height:"38px"}})]})}),po(qe,{children:[ke(de,{children:C?C.message:"Signing in with Farcaster"}),ke(ue,{children:C?C.detail:"This should only take a moment"}),ke(wt,{children:I&&cg&&ke($l,{text:"Take me to Warpcast",url:I,color:dg})})]})]})}),ke(Z,{})]}):po(jl,{children:[ke(A,{backFn:n?a:void 0,onClose:f},"header"),ke(re,{}),ke(pg,{children:po("div",{children:[ke(de,{children:"Sign in with Farcaster"}),ke(ue,{children:"Scan with your phone's camera to continue."}),ke(Ei,{children:I?ke(en,{url:I,size:275,squareLogoElement:co}):ke(it,{})}),po(wt,{children:[ke(ue,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),I&&ke(Xo,{text:I,itemName:"link",color:dg})]})]})}),ke(Z,{})]})},pg=ug.div`
1515
1515
  display: flex;
1516
1516
  flex-direction: column;
1517
1517
  align-items: center;
@@ -1519,14 +1519,14 @@ You will need this password to access your ${e} wallet on a new device. Please k
1519
1519
  margin-left: 27px;
1520
1520
  margin-right: 27px;
1521
1521
  gap: 24px;
1522
- `,a6=lg.div`
1522
+ `,p6=ug.div`
1523
1523
  display: flex;
1524
1524
  flex-direction: column;
1525
1525
  align-items: center;
1526
1526
  justify-content: center;
1527
1527
  gap: 24px;
1528
1528
  width: 100%;
1529
- `;import{useEffect as s6,useRef as l6,useState as yp}from"react";import{isIOS as c6,isMobile as pg}from"react-device-detect";import fg from"styled-components";import{Fragment as Kl,jsx as Re,jsxs as qr}from"react/jsx-runtime";var ug="#8a63d2",hg=1e3,d6=hg*2,p6=hg*300,yg=()=>{let{lastScreen:e,navigateBack:t,data:r,app:o}=P(),{requestFarcasterSignerStatus:n,closePrivyModal:i}=M(),[a,l]=yp(void 0),[s,c]=yp(!1),[m,f]=yp(!1),u=l6([]),C=Ne,g=r?.farcasterSigner;s6(()=>{let b=Date.now(),E=setInterval(async()=>{if(!g?.public_key){clearInterval(E),l({retryable:!0,message:"Connect failed",detail:"Something went wrong. Please try again."});return}g.status==="approved"&&(clearInterval(E),c(!1),f(!0),u.current.push(setTimeout(()=>i({shouldCallAuthOnSuccess:!1,isSuccess:!0}),C)));let k=await n(g?.public_key),T=Date.now()-b;k.status==="approved"?(clearInterval(E),c(!1),f(!0),u.current.push(setTimeout(()=>i({shouldCallAuthOnSuccess:!1,isSuccess:!0}),C))):T>p6?(clearInterval(E),l({retryable:!0,message:"Connect failed",detail:"The request timed out. Try again."})):k.status==="revoked"&&(clearInterval(E),l({retryable:!0,message:"Request rejected",detail:"The request was rejected. Please try again."}))},d6);return()=>{clearInterval(E),u.current.forEach(k=>clearTimeout(k))}},[]);let y=g?.status==="pending_approval"?g.signer_approval_url:void 0;return pg||s?qr(Kl,{children:[Re(x,{backFn:e?t:void 0,onClose:i},"header"),Re(ne,{}),c6?Re(Kl,{children:qr(u6,{children:[Re(Je,{children:qr("div",{children:[Re(ot,{success:m,fail:!!a}),Re(co,{style:{width:"38px",height:"38px"}})]})}),qr(qe,{children:[Re(de,{children:a?a.message:"Add a signer to Farcaster"}),Re(ue,{children:a?a.detail:"This will allow "+o.name+" to add casts, likes, follows, and more on your behalf."})]}),y&&Re(B,{onClick:b=>{b.preventDefault(),window.location.href=y},children:"Open Warpcast app"})]})}):Re(Kl,{children:qr(mg,{children:[Re(Je,{children:qr("div",{children:[Re(ot,{success:m,fail:!!a}),Re(co,{style:{width:"38px",height:"38px"}})]})}),qr(qe,{children:[Re(de,{children:a?a.message:"Requesting signer from Farcaster"}),Re(ue,{children:a?a.detail:"This should only take a moment"}),Re(wt,{children:y&&pg&&Re(ql,{text:"Take me to Warpcast",url:y,color:ug})})]})]})}),Re(Z,{})]}):qr(Kl,{children:[Re(x,{backFn:e?t:void 0,onClose:i},"header"),Re(ne,{}),Re(mg,{children:qr("div",{children:[Re(de,{children:"Add a signer to Farcaster"}),qr(ue,{children:["This will allow ",o.name," to add casts, likes, follows, and more on your behalf."]}),Re(wi,{children:g?.status==="pending_approval"?Re(Xo,{url:g.signer_approval_url,size:275,squareLogoElement:co}):Re(nt,{})}),qr(wt,{children:[Re(ue,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),g?.status==="pending_approval"&&Re(Jo,{text:g.signer_approval_url,itemName:"link",color:ug})]})]})}),Re(Z,{})]})},mg=fg.div`
1529
+ `;import{useEffect as u6,useRef as m6,useState as vp}from"react";import{isIOS as f6,isMobile as hg}from"react-device-detect";import vg from"styled-components";import{Fragment as Yl,jsx as Re,jsxs as qr}from"react/jsx-runtime";var yg="#8a63d2",Cg=1e3,h6=Cg*2,y6=Cg*300,wg=()=>{let{lastScreen:e,navigateBack:t,data:r,app:o}=_(),{requestFarcasterSignerStatus:n,closePrivyModal:i}=M(),[a,l]=vp(void 0),[s,c]=vp(!1),[m,f]=vp(!1),u=m6([]),C=Ne,g=r?.farcasterSigner;u6(()=>{let b=Date.now(),T=setInterval(async()=>{if(!g?.public_key){clearInterval(T),l({retryable:!0,message:"Connect failed",detail:"Something went wrong. Please try again."});return}g.status==="approved"&&(clearInterval(T),c(!1),f(!0),u.current.push(setTimeout(()=>i({shouldCallAuthOnSuccess:!1,isSuccess:!0}),C)));let k=await n(g?.public_key),S=Date.now()-b;k.status==="approved"?(clearInterval(T),c(!1),f(!0),u.current.push(setTimeout(()=>i({shouldCallAuthOnSuccess:!1,isSuccess:!0}),C))):S>y6?(clearInterval(T),l({retryable:!0,message:"Connect failed",detail:"The request timed out. Try again."})):k.status==="revoked"&&(clearInterval(T),l({retryable:!0,message:"Request rejected",detail:"The request was rejected. Please try again."}))},h6);return()=>{clearInterval(T),u.current.forEach(k=>clearTimeout(k))}},[]);let y=g?.status==="pending_approval"?g.signer_approval_url:void 0;return hg||s?qr(Yl,{children:[Re(A,{backFn:e?t:void 0,onClose:i},"header"),Re(re,{}),f6?Re(Yl,{children:qr(g6,{children:[Re(Je,{children:qr("div",{children:[Re(nt,{success:m,fail:!!a}),Re(co,{style:{width:"38px",height:"38px"}})]})}),qr(qe,{children:[Re(de,{children:a?a.message:"Add a signer to Farcaster"}),Re(ue,{children:a?a.detail:"This will allow "+o.name+" to add casts, likes, follows, and more on your behalf."})]}),y&&Re(B,{onClick:b=>{b.preventDefault(),window.location.href=y},children:"Open Warpcast app"})]})}):Re(Yl,{children:qr(gg,{children:[Re(Je,{children:qr("div",{children:[Re(nt,{success:m,fail:!!a}),Re(co,{style:{width:"38px",height:"38px"}})]})}),qr(qe,{children:[Re(de,{children:a?a.message:"Requesting signer from Farcaster"}),Re(ue,{children:a?a.detail:"This should only take a moment"}),Re(wt,{children:y&&hg&&Re($l,{text:"Take me to Warpcast",url:y,color:yg})})]})]})}),Re(Z,{})]}):qr(Yl,{children:[Re(A,{backFn:e?t:void 0,onClose:i},"header"),Re(re,{}),Re(gg,{children:qr("div",{children:[Re(de,{children:"Add a signer to Farcaster"}),qr(ue,{children:["This will allow ",o.name," to add casts, likes, follows, and more on your behalf."]}),Re(Ei,{children:g?.status==="pending_approval"?Re(en,{url:g.signer_approval_url,size:275,squareLogoElement:co}):Re(it,{})}),qr(wt,{children:[Re(ue,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),g?.status==="pending_approval"&&Re(Xo,{text:g.signer_approval_url,itemName:"link",color:yg})]})]})}),Re(Z,{})]})},gg=vg.div`
1530
1530
  display: flex;
1531
1531
  flex-direction: column;
1532
1532
  align-items: center;
@@ -1534,14 +1534,14 @@ You will need this password to access your ${e} wallet on a new device. Please k
1534
1534
  margin-left: 27px;
1535
1535
  margin-right: 27px;
1536
1536
  gap: 24px;
1537
- `,u6=fg.div`
1537
+ `,g6=vg.div`
1538
1538
  display: flex;
1539
1539
  flex-direction: column;
1540
1540
  align-items: center;
1541
1541
  justify-content: center;
1542
1542
  gap: 24px;
1543
1543
  width: 100%;
1544
- `;import{getAddress as bg}from"@ethersproject/address";import{formatUnits as I6,parseUnits as M6}from"@ethersproject/units";import{CheckCircleIcon as W6}from"@heroicons/react/24/outline";import{useEffect as bp,useState as La}from"react";import O6 from"styled-components";import{calculateTotalGasEstimate as L6,populateTransactionRequest as N6}from"@privy-io/js-sdk-core";import{jsx as m6}from"react/jsx-runtime";function dr({title:e}){let{currentScreen:t,navigateBack:r,navigate:o,data:n}=P(),i;return t==="FUNDING_MANUAL_TRANSFER_SCREEN"?i=r:t===n?.funding?.methodScreen?n.funding.comingFromSendTransactionScreen?i=()=>o("EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"):i=void 0:i=n?.funding?.methodScreen?()=>o(n.funding.methodScreen):void 0,m6(x,{title:e,backFn:i})}import jl from"styled-components";import{jsx as gp,jsxs as v6}from"react/jsx-runtime";var vp=()=>gp(f6,{children:v6(h6,{children:[gp(y6,{}),gp(g6,{})]})}),f6=jl.div`
1544
+ `;import{getAddress as _g}from"@ethersproject/address";import{formatUnits as N6,parseUnits as D6}from"@ethersproject/units";import{CheckCircleIcon as U6}from"@heroicons/react/24/outline";import{useEffect as Tp,useState as Na}from"react";import F6 from"styled-components";import{calculateTotalGasEstimate as B6,populateTransactionRequest as H6}from"@privy-io/js-sdk-core";import{jsx as v6}from"react/jsx-runtime";function pr({title:e}){let{currentScreen:t,navigateBack:r,navigate:o,data:n}=_(),i;return t==="FUNDING_MANUAL_TRANSFER_SCREEN"?i=r:t===n?.funding?.methodScreen?n.funding.comingFromSendTransactionScreen?i=()=>o("EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"):i=void 0:i=n?.funding?.methodScreen?()=>o(n.funding.methodScreen):void 0,v6(A,{title:e,backFn:i})}import Zl from"styled-components";import{jsx as Cp,jsxs as T6}from"react/jsx-runtime";var wp=()=>Cp(C6,{children:T6(w6,{children:[Cp(b6,{}),Cp(E6,{})]})}),C6=Zl.div`
1545
1545
  display: flex;
1546
1546
  justify-content: center;
1547
1547
  align-items: center;
@@ -1550,14 +1550,14 @@ You will need this password to access your ${e} wallet on a new device. Please k
1550
1550
  @media all and (display-mode: standalone) {
1551
1551
  margin-bottom: 30px;
1552
1552
  }
1553
- `,h6=jl.div`
1553
+ `,w6=Zl.div`
1554
1554
  position: relative;
1555
1555
  height: 96px;
1556
1556
  width: 96px;
1557
1557
 
1558
1558
  opacity: 1;
1559
1559
  animation: fadein 200ms ease;
1560
- `,y6=jl.div`
1560
+ `,b6=Zl.div`
1561
1561
  position: absolute;
1562
1562
  top: 0;
1563
1563
  right: 0;
@@ -1570,7 +1570,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1570
1570
  border: 4px solid #f1f2f9;
1571
1571
  border-radius: 50%;
1572
1572
  }
1573
- `,g6=jl.div`
1573
+ `,E6=Zl.div`
1574
1574
  position: absolute;
1575
1575
  top: 0;
1576
1576
  right: 0;
@@ -1594,40 +1594,40 @@ You will need this password to access your ${e} wallet on a new device. Please k
1594
1594
  transform: rotate(360deg);
1595
1595
  }
1596
1596
  }
1597
- `;import gg from"styled-components";var Yl=gg.span`
1597
+ `;import bg from"styled-components";var Ql=bg.span`
1598
1598
  display: flex;
1599
1599
  flex-direction: column;
1600
1600
  gap: 0.35rem;
1601
1601
  width: 100%;
1602
- `,pr=gg.span`
1602
+ `,ur=bg.span`
1603
1603
  display: flex;
1604
1604
  width: 100%;
1605
1605
  justify-content: space-between;
1606
- `;import C6 from"styled-components";var ur=C6.span`
1606
+ `;import S6 from"styled-components";var mr=S6.span`
1607
1607
  color: var(--privy-color-foreground-3);
1608
1608
  font-size: 0.875rem;
1609
1609
  font-weight: 400;
1610
1610
  line-height: 1.375rem; /* 157.143% */
1611
- `;import w6 from"styled-components";var mr=w6.span`
1611
+ `;import _6 from"styled-components";var fr=_6.span`
1612
1612
  color: var(--privy-color-foreground);
1613
1613
  font-size: 0.875rem;
1614
1614
  font-weight: 500;
1615
1615
  line-height: 1.375rem; /* 157.143% */
1616
1616
 
1617
- ${Tl}
1618
- `;import{EtherscanProvider as SG}from"@ethersproject/providers";import{QuantityToBigNumber as b6}from"@privy-io/js-sdk-core";async function Zl(e,t,r,o,n,i){o=Object.assign({chainId:Eo},o),E6(o);let l=(await r.rpc({address:t,accessToken:e,requesterAppId:i,request:{method:"eth_signTransaction",params:[o]}})).response.data;return await n.sendTransaction(l)}async function Fi(e,t,r,o){let n=await o.getBalance(e),i=t.value||0,l=!n.sub(b6(i)).sub(r).isNegative();return{balance:n,hasSufficientFunds:l}}function E6(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let r of t){let o=e[r];if(!(typeof o>"u")&&!T6(o))throw new Error(`Transaction request property '${r}' must be a valid number, bigint, or hex string representing a quantity`)}if(typeof e.chainId!="number")throw new Error("Transaction request property 'chainId' must be a number")}function T6(e){let t=typeof e=="number",r=typeof e=="bigint",o=typeof e=="string"&&S6(e);return t||r||o}function S6(e){return/^-?0x[a-f0-9]+$/i.test(e)}function Ql(e){return{to:e.to,from:e.from,contractAddress:e.contractAddress,transactionIndex:e.transactionIndex,root:e.root,logsBloom:e.logsBloom,blockHash:e.blockHash,transactionHash:e.transactionHash,logs:e.logs,blockNumber:e.blockNumber,confirmations:e.confirmations,byzantium:e.byzantium,type:e.type,status:e.status,gasUsed:e.gasUsed.toHexString(),cumulativeGasUsed:e.cumulativeGasUsed.toHexString(),effectiveGasPrice:e.effectiveGasPrice?e.effectiveGasPrice.toHexString():void 0}}import{useState as Cp,useEffect as _6}from"react";var uo=e=>{let{showFiatPrices:t,getUsdTokenPrice:r,chains:o}=M(),[n,i]=Cp(!0),[a,l]=Cp(void 0),[s,c]=Cp(void 0);return _6(()=>{let m=e.chainId||Eo,f=o.find(C=>C.id===Number(m));if(!f)throw new ce(`Unsupported chain: ${m}`);(async()=>{if(!t){i(!1);return}try{i(!0);let C=await r(f);C?c(C):l(new Error(`Unable to fetch token price on chain id ${f.id}`))}catch(C){l(C)}finally{i(!1)}})()},[e.chainId]),{tokenPrice:s,isTokenPriceLoading:n,tokenPriceError:a}};import{createContext as P6,useContext as A6}from"react";var wp=P6(null);function zr(){let e=A6(wp);if(e===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return e}function Bi(e){let r=new RegExp(/^eip155:(?<chainId>\d+)$/gm).exec(e)?.groups?.chainId;if(r)return parseInt(r);throw new Error("Chain ID not compatible with CAIP-2 format.")}import{BigNumber as x6}from"@ethersproject/bignumber";import{formatEther as vg}from"@ethersproject/units";import{QuantityToBigNumber as k6}from"@privy-io/js-sdk-core";var R6=new Intl.NumberFormat(void 0,{style:"currency",currency:"USD",maximumFractionDigits:2}),Cg=e=>R6.format(e),Jl=(e,t)=>{let r=Cg(t*parseFloat(e));return r!=="$0.00"?r:"<$0.01"},mo=(e,t)=>{let r=Cg(t*parseFloat(vg(e)));return r==="$0.00"?"<$0.01":r},fr=(e,t,r=6,o=!1)=>{let i=parseFloat(vg(e)).toFixed(r).replace(/0+$/,"").replace(/\.$/,"");return o?`${i} ${t}`:`${i==="0"?"<0.001":i} ${t}`},Oa=e=>e.map(k6).reduce((t,r)=>t.add(r),x6.from(0)).toHexString(),wg=(e,t)=>{let{chains:r}=M(),o=`https://etherscan.io/address/${t}`,n=`${um(e,r)}/address/${t}`;if(!n)return o;try{new URL(n)}catch{return o}return n};import{Fragment as Xl,jsx as De,jsxs as fo}from"react/jsx-runtime";var Eg=()=>{let{chains:e,rpcConfig:t,appId:r,closePrivyModal:o}=M(),{navigate:n,setModalData:i,app:a,data:l}=P(),[s,c]=La(null),[m,f]=La(null),[u,C]=La(null),[g,y]=La(null),[b,E]=La(!1),k=l?.funding&&M6(l.funding.amount,"ether").toHexString(),T=l?.funding&&l.funding.chain.id,{wallets:A}=zr(),{tokenPrice:R,isTokenPriceLoading:I}=uo({chainId:s?.chainId&&Bi(s.chainId)?Bi(s.chainId):void 0}),D=async Y=>{for(let X of Y)T&&Bi(X.chainId)!==T&&await X.switchChain(T)},H=new Le(async()=>{let Y=A[0];if(!Y){console.error("Connected wallet wasn't found."),n("ERROR_SCREEN",!1);return}c(Y);let X=A.find(Fe=>bg(Fe.address)===bg(l?.funding?.address??""));if(!X){console.error("Connected wallet wasn't found."),n("ERROR_SCREEN",!1);return}if(f(X),!T){console.error(`Chain ID not found for input ${l?.funding?.chain.id}.`),n("ERROR_SCREEN",!1);return}let te=Gt(T,e,t,{appId:r}),_e={from:Y.address,to:X.address,value:k,chainId:T},Te=await N6(Y.address,_e,te),{totalGasEstimate:Ke}=await L6(Te,te),{balance:Ge,hasSufficientFunds:mt}=await Fi(Y.address,Te,Ke,te);if(y({gas:Ke.toHexString(),balance:Ge.toHexString()}),!mt){C(new w(`Wallet ${dt(Y.address)} does not have enough funds.`,void 0,"insufficient_balance"));return}await D([Y,X]);try{let se=await(await Y.getEthersProvider()).getSigner(),{wait:Ft}=await se.sendTransaction(Te);await Ft(1),E(!0)}catch(Fe){C(Fe)}});bp(()=>{H.execute()},[]),bp(()=>{if(!u)return;let Y={error:u,previousScreen:"FUNDING_TRANSFER_FROM_WALLET_SCREEN"};i({funding:l?.funding,sendTransaction:l?.sendTransaction,errorModalData:Y}),n("ERROR_SCREEN",!1)},[u]);let K=s?qo(s.walletClientType,s.connectorType,s.walletClientType)||"wallet":null,j=!s||!g||I||!l?.funding||!k,O=j?void 0:Oa([g.gas,k]),U=O&&R?mo(O,R):void 0,W=O?fr(O,"ETH"):void 0,Ce=g&&R?mo(g.gas,R):void 0,Ie=g?fr(g.gas,"ETH"):void 0;return bp(()=>{if(!b)return;let Y=setTimeout(o,Ws);return()=>clearTimeout(Y)},[b]),j?fo(Xl,{children:[De(dr,{}),De(vp,{}),De("div",{style:{marginTop:"1rem"}}),De($,{})]}):b?fo(Xl,{children:[De(dr,{}),De(ne,{}),fo(ir,{children:[De(W6,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),De(ge,{title:"Success!",description:`You\u2019ve successfully added ${I6(k,"ether")} ETH to your ${a.name} wallet. It may take a minute before the funds are available to use.`})]}),De(ie,{}),De($,{})]}):fo(Xl,{children:[De(dr,{}),De(vp,{}),De(wt,{style:{marginTop:"16px"},children:De(El,{icon:Sl(s.walletClientType,s.connectorType,s.walletClientType),name:s.walletClientType})}),De(ge,{style:{marginTop:"8px",marginBottom:"12px"},title:`Confirming with ${K}`}),g&&De(Xl,{children:fo(Yl,{children:[fo(pr,{children:[De(ur,{children:"Total"}),De(mr,{children:U||W})]}),fo(pr,{children:[De(ur,{children:"To"}),De(mr,{children:dt(m?.address)})]}),fo(pr,{children:[De(ur,{children:"Network"}),De(mr,{children:fo(D6,{children:[_l(l.funding.chain.id)," ",l.funding.chain.name]})})]}),fo(pr,{children:[De(ur,{children:"Estimated fee"}),De(mr,{children:Ce||Ie})]})]})}),De(bi,{height:24}),De($,{})]})},D6=O6.div`
1617
+ ${_l}
1618
+ `;import{EtherscanProvider as OG}from"@ethersproject/providers";import{QuantityToBigNumber as P6}from"@privy-io/js-sdk-core";async function Jl(e,t,r,o,n,i){o=Object.assign({chainId:Eo},o),A6(o);let l=(await r.rpc({address:t,accessToken:e,requesterAppId:i,request:{method:"eth_signTransaction",params:[o]}})).response.data;return await n.sendTransaction(l)}async function Hi(e,t,r,o){let n=await o.getBalance(e),i=t.value||0,l=!n.sub(P6(i)).sub(r).isNegative();return{balance:n,hasSufficientFunds:l}}function A6(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let r of t){let o=e[r];if(!(typeof o>"u")&&!x6(o))throw new Error(`Transaction request property '${r}' must be a valid number, bigint, or hex string representing a quantity`)}if(typeof e.chainId!="number")throw new Error("Transaction request property 'chainId' must be a number")}function x6(e){let t=typeof e=="number",r=typeof e=="bigint",o=typeof e=="string"&&k6(e);return t||r||o}function k6(e){return/^-?0x[a-f0-9]+$/i.test(e)}function Xl(e){return{to:e.to,from:e.from,contractAddress:e.contractAddress,transactionIndex:e.transactionIndex,root:e.root,logsBloom:e.logsBloom,blockHash:e.blockHash,transactionHash:e.transactionHash,logs:e.logs,blockNumber:e.blockNumber,confirmations:e.confirmations,byzantium:e.byzantium,type:e.type,status:e.status,gasUsed:e.gasUsed.toHexString(),cumulativeGasUsed:e.cumulativeGasUsed.toHexString(),effectiveGasPrice:e.effectiveGasPrice?e.effectiveGasPrice.toHexString():void 0}}import{useState as bp,useEffect as R6}from"react";var uo=e=>{let{showFiatPrices:t,getUsdTokenPrice:r,chains:o}=M(),[n,i]=bp(!0),[a,l]=bp(void 0),[s,c]=bp(void 0);return R6(()=>{let m=e.chainId||Eo,f=o.find(C=>C.id===Number(m));if(!f)throw new ce(`Unsupported chain: ${m}`);(async()=>{if(!t){i(!1);return}try{i(!0);let C=await r(f);C?c(C):l(new Error(`Unable to fetch token price on chain id ${f.id}`))}catch(C){l(C)}finally{i(!1)}})()},[e.chainId]),{tokenPrice:s,isTokenPriceLoading:n,tokenPriceError:a}};import{createContext as I6,useContext as M6}from"react";var Ep=I6(null);function zr(){let e=M6(Ep);if(e===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return e}function Gi(e){let r=new RegExp(/^eip155:(?<chainId>\d+)$/gm).exec(e)?.groups?.chainId;if(r)return parseInt(r);throw new Error("Chain ID not compatible with CAIP-2 format.")}import{BigNumber as W6}from"@ethersproject/bignumber";import{formatEther as Eg}from"@ethersproject/units";import{QuantityToBigNumber as O6}from"@privy-io/js-sdk-core";var L6=new Intl.NumberFormat(void 0,{style:"currency",currency:"USD",maximumFractionDigits:2}),Tg=e=>L6.format(e),ec=(e,t)=>{let r=Tg(t*parseFloat(e));return r!=="$0.00"?r:"<$0.01"},mo=(e,t)=>{let r=Tg(t*parseFloat(Eg(e)));return r==="$0.00"?"<$0.01":r},hr=(e,t,r=6,o=!1)=>{let i=parseFloat(Eg(e)).toFixed(r).replace(/0+$/,"").replace(/\.$/,"");return o?`${i} ${t}`:`${i==="0"?"<0.001":i} ${t}`},La=e=>e.map(O6).reduce((t,r)=>t.add(r),W6.from(0)).toHexString(),Sg=(e,t)=>{let{chains:r}=M(),o=`https://etherscan.io/address/${t}`,n=`${hm(e,r)}/address/${t}`;if(!n)return o;try{new URL(n)}catch{return o}return n};import{Fragment as tc,jsx as De,jsxs as fo}from"react/jsx-runtime";var Pg=()=>{let{chains:e,rpcConfig:t,appId:r,closePrivyModal:o}=M(),{navigate:n,setModalData:i,app:a,data:l}=_(),[s,c]=Na(null),[m,f]=Na(null),[u,C]=Na(null),[g,y]=Na(null),[b,T]=Na(!1),k=l?.funding&&D6(l.funding.amount,"ether").toHexString(),S=l?.funding&&l.funding.chain.id,{wallets:x}=zr(),{tokenPrice:R,isTokenPriceLoading:I}=uo({chainId:s?.chainId&&Gi(s.chainId)?Gi(s.chainId):void 0}),D=async Y=>{for(let X of Y)S&&Gi(X.chainId)!==S&&await X.switchChain(S)},H=new Le(async()=>{let Y=x[0];if(!Y){console.error("Connected wallet wasn't found."),n("ERROR_SCREEN",!1);return}c(Y);let X=x.find(Fe=>_g(Fe.address)===_g(l?.funding?.address??""));if(!X){console.error("Connected wallet wasn't found."),n("ERROR_SCREEN",!1);return}if(f(X),!S){console.error(`Chain ID not found for input ${l?.funding?.chain.id}.`),n("ERROR_SCREEN",!1);return}let te=Gt(S,e,t,{appId:r}),_e={from:Y.address,to:X.address,value:k,chainId:S},Te=await H6(Y.address,_e,te),{totalGasEstimate:Ke}=await B6(Te,te),{balance:Ge,hasSufficientFunds:mt}=await Hi(Y.address,Te,Ke,te);if(y({gas:Ke.toHexString(),balance:Ge.toHexString()}),!mt){C(new w(`Wallet ${dt(Y.address)} does not have enough funds.`,void 0,"insufficient_balance"));return}await D([Y,X]);try{let se=await(await Y.getEthersProvider()).getSigner(),{wait:Ft}=await se.sendTransaction(Te);await Ft(1),T(!0)}catch(Fe){C(Fe)}});Tp(()=>{H.execute()},[]),Tp(()=>{if(!u)return;let Y={error:u,previousScreen:"FUNDING_TRANSFER_FROM_WALLET_SCREEN"};i({funding:l?.funding,sendTransaction:l?.sendTransaction,errorModalData:Y}),n("ERROR_SCREEN",!1)},[u]);let K=s?zo(s.walletClientType,s.connectorType,s.walletClientType)||"wallet":null,j=!s||!g||I||!l?.funding||!k,O=j?void 0:La([g.gas,k]),U=O&&R?mo(O,R):void 0,W=O?hr(O,"ETH"):void 0,Ce=g&&R?mo(g.gas,R):void 0,Ie=g?hr(g.gas,"ETH"):void 0;return Tp(()=>{if(!b)return;let Y=setTimeout(o,Os);return()=>clearTimeout(Y)},[b]),j?fo(tc,{children:[De(pr,{}),De(wp,{}),De("div",{style:{marginTop:"1rem"}}),De(z,{})]}):b?fo(tc,{children:[De(pr,{}),De(re,{}),fo(ar,{children:[De(U6,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),De(he,{title:"Success!",description:`You\u2019ve successfully added ${N6(k,"ether")} ETH to your ${a.name} wallet. It may take a minute before the funds are available to use.`})]}),De(ie,{}),De(z,{})]}):fo(tc,{children:[De(pr,{}),De(wp,{}),De(wt,{style:{marginTop:"16px"},children:De(Sl,{icon:Pl(s.walletClientType,s.connectorType,s.walletClientType),name:s.walletClientType})}),De(he,{style:{marginTop:"8px",marginBottom:"12px"},title:`Confirming with ${K}`}),g&&De(tc,{children:fo(Ql,{children:[fo(ur,{children:[De(mr,{children:"Total"}),De(fr,{children:U||W})]}),fo(ur,{children:[De(mr,{children:"To"}),De(fr,{children:dt(m?.address)})]}),fo(ur,{children:[De(mr,{children:"Network"}),De(fr,{children:fo(G6,{children:[Al(l.funding.chain.id)," ",l.funding.chain.name]})})]}),fo(ur,{children:[De(mr,{children:"Estimated fee"}),De(fr,{children:Ce||Ie})]})]})}),De(Ti,{height:24}),De(z,{})]})},G6=F6.div`
1619
1619
  display: flex;
1620
1620
  flex-direction: row;
1621
1621
  align-items: center;
1622
1622
  gap: 4px;
1623
- `;import F6 from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import B6 from"@heroicons/react/24/solid/CheckCircleIcon";import{useEffect as H6,useMemo as G6,useState as kg}from"react";import Rg from"styled-components";async function ec({api:e,requesterAppId:t,providerAppId:r}){let n=(await e.get(`/api/v1/apps/${t}/cross-app/connections`)).connections.find(i=>i.provider_app_id===r);if(!n)throw new w("Invalid connected app");return{name:n.provider_app_name,logoUrl:n.provider_app_icon_url||void 0,apiUrl:n.provider_app_custom_api_url,readOnly:n.read_only}}async function Tg({api:e,appId:t}){let r=bn(),o=oi(),n=await ni(r);try{let{url:i}=await e.post(ws,{provider:`privy:${t}`,redirect_to:window.location.href,code_challenge:n,state_code:o});return{url:i,stateCode:o,codeVerifier:r}}catch(i){throw le(i)}}async function Sg({api:e,appId:t,stateCode:r,codeVerifier:o,authorizationCode:n}){if(!n||!r)throw new w("[Cross-App AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if(n==="undefined")throw new w("User denied confirmation during cross-app auth flow");try{return(await e.post(bs,{authorization_code:n,state_code:r,code_verifier:o,provider:`privy:${t}`})).oauth_tokens?.access_token}catch(i){let a=le(i);throw a.privyErrorCode?new w(a.message||"Invalid code during cross-app auth flow.",void 0,a.privyErrorCode):a.message==="User denied confirmation during cross-app auth flow"?new w("Invalid code during cross-app auth flow.",void 0,"oauth_user_denied"):new w("Invalid code during cross-app auth flow.",void 0,"unknown_auth_error")}}var tc=async({user:e,address:t,client:r,request:o,requesterAppId:n,reconnect:i})=>{r.createAnalyticsEvent({eventName:"cross_app_request_started",payload:{address:t,method:o.method}});let a=e?.linkedAccounts.find(u=>!!(u.type==="cross_app"&&u.embeddedWallets.find(C=>C.address===t)));if(!e||!a)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Cannot request a signature with this wallet address",address:t}}),new w("Cannot request a signature with this wallet address");let l=r.getProviderAccessToken(a.providerApp.id),s=await ec({api:r.api,requesterAppId:n,providerAppId:a.providerApp.id});if(!l){if(s.readOnly)throw console.error("cannot transact against a read-only provider app"),new w("Cannot transact against a read-only provider app");await i({appId:a.providerApp.id})&&(l=r.getProviderAccessToken(a.providerApp.id))}if(!l)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Transactions require a valid token",address:t}}),new w("Transactions require a valid token");let c=window.open(void 0,void 0,Na({w:400,h:680}));if(!c)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Missing token",address:t}}),new w("Failed to initialize signature request");let m=new URL(`${s.apiUrl}/oauth/transact`);return m.searchParams.set("token",l||""),m.searchParams.set("request",U6(o)),c.location=m.href,new Promise((u,C)=>{let y=setTimeout(()=>{k(),C(new w("Request timeout")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Request timeout",address:t}})},12e4),b=setInterval(()=>{c.closed&&(k(),C(new w("User rejected request")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"User rejected request",address:t}}))},300),E=T=>{T.data&&(T.data.token?.action==="set"&&T.data.token?.value!==void 0?r.storeProviderAccessToken(a.providerApp.id,T.data.token.value):T.data.token?.action==="clear"&&r.storeProviderAccessToken(a.providerApp.id,null),T.data.type==="PRIVY_CROSS_APP_ACTION_RESPONSE"&&T.data.result&&(k(),u(T.data.result),r.createAnalyticsEvent({eventName:"cross_app_request_success",payload:{address:t,method:o.method}})),T.data.type==="PRIVY_CROSS_APP_ACTION_ERROR"&&T.data.error&&(k(),C(T.data.error),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:T.data.error,address:t}})))};window.addEventListener("message",E);let k=()=>{c.close(),clearInterval(b),clearTimeout(y),window.removeEventListener("message",E)}})},U6=e=>JSON.stringify({content:{request:{request:e}},timestamp:Date.now(),callbackUrl:window.origin}),Na=({w:e,h:t})=>{let r=window.screenLeft!==void 0?window.screenLeft:window.screenX,o=window.screenTop!==void 0?window.screenTop:window.screenY,n=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,i=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height,a=n/window.screen.availWidth,l=i/window.screen.availHeight,s=(n-e)/2/a+r,c=(i-t)/2/l+o;return`toolbar=0,location=0,menubar=0,height=${t},width=${e},popup=1,left=${s},top=${c}`};var Hi="sdk_fiat_on_ramp_completed_with_status";var _g={1:"ethereum",8453:"base",10:"optimism",137:"polygon",42161:"arbitrum"},Pg=e=>!!_g[e];function Ag(e){let t=_g[e];if(!t)throw new w(`Unsupported chainId: ${e} for Coinbase Onramp`);return t}var xg=({input:e,amount:t,blockchain:r})=>{let o=new URL("https://pay.coinbase.com/buy/select-asset");return o.searchParams.set("appId",e.app_id),o.searchParams.set("sessionToken",e.session_token),o.searchParams.set("defaultExperience","buy"),o.searchParams.set("presetCryptoAmount",t),o.searchParams.set("defaultNetwork",r),o.searchParams.set("partnerUserId",e.partner_user_id),{url:o}};import{Fragment as Wg,jsx as hr,jsxs as Da}from"react/jsx-runtime";var V6=240,Ig=1500,q6=Math.floor(V6*1e3/Ig),Mg=()=>{let{data:e,setModalData:t,navigate:r}=P(),{closePrivyModal:o,createAnalyticsEvent:n,initCoinbaseOnRamp:i,getCoinbaseOnRampStatus:a}=M(),l=e?.funding,[s,c]=kg(!1),[m,f]=kg(!1);return H6(()=>{if(s)return;c(!0);let u=async()=>{try{n({eventName:"sdk_fiat_on_ramp_started",payload:{provider:"coinbase-onramp"}});let g=window.open(void 0,void 0,Na({w:440,h:680})),y=Ag(l.chain.id),b=await i({addresses:[{address:l.address,blockchains:[y]}]}),{url:E}=xg({input:b,amount:l.amount,blockchain:y});if(!g)throw new Error("Unable to initiate Coinbase Onramp flow.");g.location=E.toString();let k=0,T=!1;for(;k<q6;){k++;let{status:A}=await a({partnerUserId:b.partner_user_id});if(A==="success"){T=!0;break}if(A==="failure")throw new Error("There was an error completing Coinbase Onramp flow.");if(g.closed)throw new Error("User exited Coinbase Onramp flow before transaction response.");await new Promise(R=>setTimeout(R,Ig))}if(!T)throw new Error("Timed out waiting for transaction response from Coinbase Onramp.");n({eventName:Hi,payload:{status:"success",provider:"coinbase-onramp"}}),f(!0)}catch(g){console.error(g),n({eventName:Hi,payload:{status:"failure",provider:"coinbase-onramp",error:g.message}}),t({funding:{...l,errorMessage:"Something went wrong adding funds from Coinbase Onramp. Please try again or use another method to fund your wallet."}}),r("FUNDING_METHOD_SELECTION_SCREEN")}finally{c(!1)}},C=setTimeout(()=>void u(),500);return()=>clearTimeout(C)},[]),Da(Wg,{children:[hr(x,{title:"Fund account"},"header"),hr($6,{isSucccess:m,onClickCta:o}),hr($,{})]})},z6=e=>e?{title:"You've funded your account!",body:"It may take a few minutes for the assets to appear.",cta:"Continue"}:{title:"In Progress",body:"Go back to Coinbase Onramp to finish funding your account.",cta:""},$6=({isSucccess:e,onClickCta:t})=>{let{title:r,body:o,cta:n}=G6(()=>z6(e),[e]);return Da(Wg,{children:[Da(Q6,{children:[hr(Y6,{isSucccess:e}),Da(qe,{children:[hr("h3",{children:r}),hr(Z6,{children:o})]})]}),n&&hr(B,{onClick:t,children:n})]})},K6=e=>e?"var(--privy-color-success)":"var(--privy-color-foreground-4)",j6=e=>e?B6:()=>hr(F6,{width:"3rem",height:"3rem",style:{backgroundColor:"var(--privy-color-foreground-4)",color:"var(--privy-color-background)",borderRadius:"100%",padding:"0.5rem",margin:"0.5rem"}}),Y6=({isSucccess:e})=>{if(!e){let o="var(--privy-color-foreground-4)";return Da("div",{style:{position:"relative"},children:[hr(nt,{color:o,style:{position:"absolute"}}),hr(ga,{color:o}),hr(So,{style:{position:"absolute",width:"2.8rem",height:"2.8rem",top:"1.2rem",left:"1.2rem"}})]})}let t=j6(e),r=K6(e);return hr("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&hr(t,{width:"4rem",height:"4rem",color:r})})},Z6=Rg.p`
1623
+ `;import q6 from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import z6 from"@heroicons/react/24/solid/CheckCircleIcon";import{useEffect as $6,useMemo as K6,useState as Wg}from"react";import Og from"styled-components";async function rc({api:e,requesterAppId:t,providerAppId:r}){let n=(await e.get(`/api/v1/apps/${t}/cross-app/connections`)).connections.find(i=>i.provider_app_id===r);if(!n)throw new w("Invalid connected app");return{name:n.provider_app_name,logoUrl:n.provider_app_icon_url||void 0,apiUrl:n.provider_app_custom_api_url,readOnly:n.read_only}}async function Ag({api:e,appId:t}){let r=Sn(),o=ii(),n=await ai(r);try{let{url:i}=await e.post(bs,{provider:`privy:${t}`,redirect_to:window.location.href,code_challenge:n,state_code:o});return{url:i,stateCode:o,codeVerifier:r}}catch(i){throw le(i)}}async function xg({api:e,appId:t,stateCode:r,codeVerifier:o,authorizationCode:n}){if(!n||!r)throw new w("[Cross-App AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if(n==="undefined")throw new w("User denied confirmation during cross-app auth flow");try{return(await e.post(Es,{authorization_code:n,state_code:r,code_verifier:o,provider:`privy:${t}`})).oauth_tokens?.access_token}catch(i){let a=le(i);throw a.privyErrorCode?new w(a.message||"Invalid code during cross-app auth flow.",void 0,a.privyErrorCode):a.message==="User denied confirmation during cross-app auth flow"?new w("Invalid code during cross-app auth flow.",void 0,"oauth_user_denied"):new w("Invalid code during cross-app auth flow.",void 0,"unknown_auth_error")}}var oc=async({user:e,address:t,client:r,request:o,requesterAppId:n,reconnect:i})=>{r.createAnalyticsEvent({eventName:"cross_app_request_started",payload:{address:t,method:o.method}});let a=e?.linkedAccounts.find(u=>!!(u.type==="cross_app"&&u.embeddedWallets.find(C=>C.address===t)));if(!e||!a)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Cannot request a signature with this wallet address",address:t}}),new w("Cannot request a signature with this wallet address");let l=r.getProviderAccessToken(a.providerApp.id),s=await rc({api:r.api,requesterAppId:n,providerAppId:a.providerApp.id});if(!l){if(s.readOnly)throw console.error("cannot transact against a read-only provider app"),new w("Cannot transact against a read-only provider app");await i({appId:a.providerApp.id})&&(l=r.getProviderAccessToken(a.providerApp.id))}if(!l)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Transactions require a valid token",address:t}}),new w("Transactions require a valid token");let c=window.open(void 0,void 0,Da({w:400,h:680}));if(!c)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Missing token",address:t}}),new w("Failed to initialize signature request");let m=new URL(`${s.apiUrl}/oauth/transact`);return m.searchParams.set("token",l||""),m.searchParams.set("request",V6(o)),c.location=m.href,new Promise((u,C)=>{let y=setTimeout(()=>{k(),C(new w("Request timeout")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Request timeout",address:t}})},12e4),b=setInterval(()=>{c.closed&&(k(),C(new w("User rejected request")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"User rejected request",address:t}}))},300),T=S=>{S.data&&(S.data.token?.action==="set"&&S.data.token?.value!==void 0?r.storeProviderAccessToken(a.providerApp.id,S.data.token.value):S.data.token?.action==="clear"&&r.storeProviderAccessToken(a.providerApp.id,null),S.data.type==="PRIVY_CROSS_APP_ACTION_RESPONSE"&&S.data.result&&(k(),u(S.data.result),r.createAnalyticsEvent({eventName:"cross_app_request_success",payload:{address:t,method:o.method}})),S.data.type==="PRIVY_CROSS_APP_ACTION_ERROR"&&S.data.error&&(k(),C(S.data.error),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:S.data.error,address:t}})))};window.addEventListener("message",T);let k=()=>{c.close(),clearInterval(b),clearTimeout(y),window.removeEventListener("message",T)}})},V6=e=>JSON.stringify({content:{request:{request:e}},timestamp:Date.now(),callbackUrl:window.origin}),Da=({w:e,h:t})=>{let r=window.screenLeft!==void 0?window.screenLeft:window.screenX,o=window.screenTop!==void 0?window.screenTop:window.screenY,n=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,i=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height,a=n/window.screen.availWidth,l=i/window.screen.availHeight,s=(n-e)/2/a+r,c=(i-t)/2/l+o;return`toolbar=0,location=0,menubar=0,height=${t},width=${e},popup=1,left=${s},top=${c}`};var Vi="sdk_fiat_on_ramp_completed_with_status";var kg={1:"ethereum",8453:"base",10:"optimism",137:"polygon",42161:"arbitrum"},Rg=e=>!!kg[e];function Ig(e){let t=kg[e];if(!t)throw new w(`Unsupported chainId: ${e} for Coinbase Onramp`);return t}var Mg=({input:e,amount:t,blockchain:r})=>{let o=new URL("https://pay.coinbase.com/buy/select-asset");return o.searchParams.set("appId",e.app_id),o.searchParams.set("sessionToken",e.session_token),o.searchParams.set("defaultExperience","buy"),o.searchParams.set("presetCryptoAmount",t),o.searchParams.set("defaultNetwork",r),o.searchParams.set("partnerUserId",e.partner_user_id),{url:o}};import{Fragment as Dg,jsx as yr,jsxs as Ua}from"react/jsx-runtime";var j6=240,Lg=1500,Y6=Math.floor(j6*1e3/Lg),Ng=()=>{let{data:e,setModalData:t,navigate:r}=_(),{closePrivyModal:o,createAnalyticsEvent:n,initCoinbaseOnRamp:i,getCoinbaseOnRampStatus:a}=M(),l=e?.funding,[s,c]=Wg(!1),[m,f]=Wg(!1);return $6(()=>{if(s)return;c(!0);let u=async()=>{try{n({eventName:"sdk_fiat_on_ramp_started",payload:{provider:"coinbase-onramp"}});let g=window.open(void 0,void 0,Da({w:440,h:680})),y=Ig(l.chain.id),b=await i({addresses:[{address:l.address,blockchains:[y]}]}),{url:T}=Mg({input:b,amount:l.amount,blockchain:y});if(!g)throw new Error("Unable to initiate Coinbase Onramp flow.");g.location=T.toString();let k=0,S=!1;for(;k<Y6;){k++;let{status:x}=await a({partnerUserId:b.partner_user_id});if(x==="success"){S=!0;break}if(x==="failure")throw new Error("There was an error completing Coinbase Onramp flow.");if(g.closed)throw new Error("User exited Coinbase Onramp flow before transaction response.");await new Promise(R=>setTimeout(R,Lg))}if(!S)throw new Error("Timed out waiting for transaction response from Coinbase Onramp.");n({eventName:Vi,payload:{status:"success",provider:"coinbase-onramp"}}),f(!0)}catch(g){console.error(g),n({eventName:Vi,payload:{status:"failure",provider:"coinbase-onramp",error:g.message}}),t({funding:{...l,errorMessage:"Something went wrong adding funds from Coinbase Onramp. Please try again or use another method to fund your wallet."}}),r("FUNDING_METHOD_SELECTION_SCREEN")}finally{c(!1)}},C=setTimeout(()=>void u(),500);return()=>clearTimeout(C)},[]),Ua(Dg,{children:[yr(A,{title:"Fund account"},"header"),yr(Q6,{isSucccess:m,onClickCta:o}),yr(z,{})]})},Z6=e=>e?{title:"You've funded your account!",body:"It may take a few minutes for the assets to appear.",cta:"Continue"}:{title:"In Progress",body:"Go back to Coinbase Onramp to finish funding your account.",cta:""},Q6=({isSucccess:e,onClickCta:t})=>{let{title:r,body:o,cta:n}=K6(()=>Z6(e),[e]);return Ua(Dg,{children:[Ua(rb,{children:[yr(eb,{isSucccess:e}),Ua(qe,{children:[yr("h3",{children:r}),yr(tb,{children:o})]})]}),n&&yr(B,{onClick:t,children:n})]})},J6=e=>e?"var(--privy-color-success)":"var(--privy-color-foreground-4)",X6=e=>e?z6:()=>yr(q6,{width:"3rem",height:"3rem",style:{backgroundColor:"var(--privy-color-foreground-4)",color:"var(--privy-color-background)",borderRadius:"100%",padding:"0.5rem",margin:"0.5rem"}}),eb=({isSucccess:e})=>{if(!e){let o="var(--privy-color-foreground-4)";return Ua("div",{style:{position:"relative"},children:[yr(it,{color:o,style:{position:"absolute"}}),yr(va,{color:o}),yr(So,{style:{position:"absolute",width:"2.8rem",height:"2.8rem",top:"1.2rem",left:"1.2rem"}})]})}let t=X6(e),r=J6(e);return yr("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&yr(t,{width:"4rem",height:"4rem",color:r})})},tb=Og.p`
1624
1624
  font-size: 1rem;
1625
1625
  color: var(--privy-color-foreground-3);
1626
1626
  margin-bottom: 1rem;
1627
1627
  display: flex;
1628
1628
  flex-direction: column;
1629
1629
  gap: 1rem;
1630
- `,Q6=Rg.div`
1630
+ `,rb=Og.div`
1631
1631
  display: flex;
1632
1632
  flex-direction: column;
1633
1633
  align-items: center;
@@ -1635,7 +1635,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1635
1635
  margin-left: 1.75rem;
1636
1636
  margin-right: 1.75rem;
1637
1637
  padding: 2rem 0;
1638
- `;import{getAddress as Yg}from"@ethersproject/address";import{PencilIcon as Tb,WalletIcon as Sb}from"@heroicons/react/24/outline";import{useEffect as _b,useRef as Pb,useState as Ab}from"react";import{ExclamationTriangleIcon as J6}from"@heroicons/react/24/outline";import X6 from"styled-components";import{jsx as tb,jsxs as rb}from"react/jsx-runtime";var Og=({children:e})=>rb(eb,{children:[tb(J6,{width:"3rem",color:"var(--privy-color-error)"}),e]}),eb=X6.div`
1638
+ `;import{getAddress as Xg}from"@ethersproject/address";import{PencilIcon as xb,WalletIcon as kb}from"@heroicons/react/24/outline";import{useEffect as Rb,useRef as Ib,useState as Mb}from"react";import{ExclamationTriangleIcon as ob}from"@heroicons/react/24/outline";import nb from"styled-components";import{jsx as ab,jsxs as sb}from"react/jsx-runtime";var Ug=({children:e})=>sb(ib,{children:[ab(ob,{width:"3rem",color:"var(--privy-color-error)"}),e]}),ib=nb.div`
1639
1639
  display: flex;
1640
1640
  gap: 0.5rem;
1641
1641
  background-color: var(--privy-color-error-light);
@@ -1654,7 +1654,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1654
1654
  border: 1px solid var(--privy-color-error);
1655
1655
  border-radius: var(--privy-border-radius-sm);
1656
1656
  }
1657
- `;import{jsx as Ep,jsxs as ob}from"react/jsx-runtime";var Gi=({size:e=61,...t})=>Ep("svg",{width:e,height:e,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:ob("g",{id:"moonpay_symbol_wht 2",children:[Ep("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),Ep("path",{id:"Vector",d:"M43.8884 23.3258C45.0203 23.3258 46.1268 22.9901 47.068 22.3613C48.0091 21.7324 48.7427 20.8386 49.1759 19.7928C49.6091 18.747 49.7224 17.5962 49.5016 16.4861C49.2807 15.3759 48.7357 14.3561 47.9353 13.5557C47.1349 12.7553 46.1151 12.2102 45.0049 11.9893C43.8947 11.7685 42.7439 11.8819 41.6982 12.3151C40.6524 12.7482 39.7585 13.4818 39.1297 14.423C38.5008 15.3641 38.1651 16.4707 38.1651 17.6026C38.165 18.3542 38.3131 19.0985 38.6007 19.7929C38.8883 20.4873 39.3098 21.1182 39.8413 21.6496C40.3728 22.1811 41.0037 22.6027 41.6981 22.8903C42.3925 23.1778 43.1367 23.3259 43.8884 23.3258ZM26.3395 49.1017C23.5804 49.1017 20.8832 48.2836 18.5891 46.7507C16.295 45.2178 14.5069 43.039 13.4511 40.49C12.3952 37.9409 12.1189 35.1359 12.6572 32.4298C13.1955 29.7237 14.5241 27.238 16.4751 25.287C18.4262 23.336 20.9118 22.0074 23.6179 21.4691C26.324 20.9308 29.129 21.2071 31.6781 22.2629C34.2272 23.3189 36.406 25.1069 37.9389 27.401C39.4717 29.6952 40.2899 32.3923 40.2899 35.1514C40.2899 36.9835 39.9291 38.7975 39.2281 40.49C38.527 42.1826 37.4994 43.7205 36.204 45.0159C34.9086 46.3113 33.3707 47.3389 31.6781 48.04C29.9856 48.741 28.1715 49.1018 26.3395 49.1017Z",fill:"white"})]})});import Ir,{keyframes as bb}from"styled-components";import nb from"@heroicons/react/24/outline/ClockIcon";import ib from"@heroicons/react/24/outline/TrashIcon";import ab from"@heroicons/react/24/solid/CheckBadgeIcon";import sb from"@heroicons/react/24/solid/CheckCircleIcon";import lb from"@heroicons/react/24/solid/LockClosedIcon";import{useEffect as cb,useState as Ua}from"react";import Rr,{css as Fg}from"styled-components";import{jsx as Lg}from"react/jsx-runtime";var Bn=({style:e,...t})=>Lg("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...e},fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:Lg("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.71369 17.5625V10.375C3.71369 6.44625 6.85845 3.25 10.7238 3.25H17.7953C18.6783 3.25 19.3941 2.52244 19.3941 1.625C19.3941 0.727562 18.6783 0 17.7953 0H10.7238C5.09529 0 0.516113 4.65419 0.516113 10.375V17.5625C0.516113 18.4599 1.23194 19.1875 2.1149 19.1875C2.99787 19.1875 3.71369 18.4599 3.71369 17.5625ZM17.7953 60.7501C18.6783 60.7501 19.3941 61.4777 19.3941 62.3751C19.3941 63.2726 18.6783 64.0001 17.7953 64.0001H10.7238C5.09529 64.0001 0.516113 59.3459 0.516113 53.6251V46.4376C0.516113 45.5402 1.23194 44.8126 2.1149 44.8126C2.99787 44.8126 3.71369 45.5402 3.71369 46.4376V53.6251C3.71369 57.5538 6.85845 60.7501 10.7238 60.7501H17.7953ZM63.4839 46.4376V53.6251C63.4839 59.3459 58.9048 64.0001 53.2763 64.0001H46.2047C45.3217 64.0001 44.6059 63.2726 44.6059 62.3751C44.6059 61.4777 45.3217 60.7501 46.2047 60.7501H53.2763C57.1416 60.7501 60.2864 57.5538 60.2864 53.6251V46.4376C60.2864 45.5402 61.0022 44.8126 61.8851 44.8126C62.7681 44.8126 63.4839 45.5402 63.4839 46.4376ZM63.4839 10.375V17.5625C63.4839 18.4599 62.7681 19.1875 61.8851 19.1875C61.0022 19.1875 60.2864 18.4599 60.2864 17.5625V10.375C60.2864 6.44625 57.1416 3.25 53.2763 3.25H46.2047C45.3217 3.25 44.6059 2.52244 44.6059 1.625C44.6059 0.727562 45.3217 0 46.2047 0H53.2763C58.9048 0 63.4839 4.65419 63.4839 10.375ZM43.0331 47.3022C43.7067 46.6698 43.7483 45.6022 43.1262 44.9176C42.5039 44.233 41.4536 44.1906 40.78 44.823C38.3832 47.0732 35.265 48.3125 31.9997 48.3125C28.7344 48.3125 25.6162 47.0732 23.2194 44.823C22.5457 44.1906 21.4955 44.233 20.8732 44.9176C20.251 45.6022 20.2927 46.6698 20.9663 47.3022C23.9784 50.1301 27.8968 51.6875 31.9997 51.6875C36.1026 51.6875 40.021 50.1301 43.0331 47.3022ZM35.3207 24.1249V36.1249C35.3207 38.5029 33.4173 40.4374 31.0777 40.4374H29.7249C28.8079 40.4374 28.0646 39.6819 28.0646 38.7499C28.0646 37.8179 28.8079 37.0624 29.7249 37.0624H31.0777C31.5863 37.0624 32.0001 36.6419 32.0001 36.1249V24.1249C32.0001 23.1929 32.7434 22.4374 33.6604 22.4374C34.5774 22.4374 35.3207 23.1929 35.3207 24.1249ZM46.7581 28.8437V24.0312C46.7581 23.151 46.056 22.4374 45.19 22.4374C44.324 22.4374 43.622 23.151 43.622 24.0312V28.8437C43.622 29.7239 44.324 30.4374 45.19 30.4374C46.056 30.4374 46.7581 29.7239 46.7581 28.8437ZM17.6109 28.8437C17.6109 29.7239 18.313 30.4374 19.1789 30.4374C20.0449 30.4374 20.747 29.7239 20.747 28.8437V24.0312C20.747 23.151 20.0449 22.4374 19.1789 22.4374C18.313 22.4374 17.6109 23.151 17.6109 24.0312V28.8437Z"})});import{jsx as Be,jsxs as Ng}from"react/jsx-runtime";var Hn=({style:e,...t})=>Ng("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...e},xmlns:"http://www.w3.org/2000/svg",...t,children:[Ng("g",{clipPath:"url(#clip0_113_33841)",children:[Be("path",{d:"M39.1193 0.943398C34.636 -0.174912 29.9185 -0.334713 25.328 0.656273C24.9732 0.732859 24.7477 1.08253 24.8243 1.43729C24.9009 1.79205 25.2506 2.01756 25.6053 1.94097C30.0015 0.991934 34.53 1.14842 38.8375 2.22802C49.1385 4.80983 57.7129 12.5548 60.9786 22.6718C62.2416 26.5843 62.7781 30.7505 62.8855 35.1167C62.8945 35.4795 63.1958 35.7664 63.5586 35.7575C63.9215 35.7485 64.2083 35.4472 64.1994 35.0843C64.0905 30.6582 63.5477 26.3849 62.2536 22.3432C58.8621 11.7515 49.9005 3.63265 39.1193 0.943398Z"}),Be("path",{d:"M21.9931 2.93163C22.343 2.83511 22.5484 2.47325 22.4518 2.12339C22.3553 1.77352 21.9935 1.56815 21.6436 1.66466C16.8429 2.98903 10.0898 7.56519 5.91628 13.6786C5.91465 13.681 5.91304 13.6834 5.91145 13.6858C2.24684 19.2083 -0.0503572 26.1484 0.591012 32.8828C0.591623 32.8892 0.592328 32.8956 0.593127 32.902C0.746837 34.1317 1.00488 35.3591 1.26323 36.5879C1.80735 39.1761 2.35282 41.7706 1.92765 44.4064C1.86986 44.7647 2.11347 45.102 2.47177 45.1598C2.83007 45.2176 3.16738 44.974 3.22518 44.6157C3.66961 41.8605 3.11776 39.173 2.56581 36.4851C2.31054 35.2419 2.05525 33.9987 1.89847 32.7486C1.29525 26.3851 3.46802 19.7466 7.00418 14.416C11.0189 8.5373 17.5201 4.16562 21.9931 2.93163Z"}),Be("path",{d:"M30.6166 4.39985C38.8671 3.89603 47.1159 7.26314 52.6556 13.7139C52.8921 13.9893 52.8605 14.4042 52.5852 14.6406C52.3099 14.8771 51.895 14.8455 51.6585 14.5702C46.3904 8.43576 38.541 5.23144 30.6927 5.71195C30.6899 5.71212 30.6871 5.71227 30.6843 5.71241C20.7592 6.19265 11.4643 12.9257 8.04547 22.3603C7.92183 22.7016 7.54498 22.8779 7.20375 22.7543C6.86253 22.6306 6.68616 22.2538 6.80981 21.9126C10.4114 11.9735 20.1717 4.90702 30.6166 4.39985Z"}),Be("path",{d:"M54.6576 16.5848C54.4553 16.2836 54.047 16.2033 53.7457 16.4057C53.4444 16.608 53.3642 17.0163 53.5665 17.3176C56.6376 21.8904 57.9074 26.8665 58.4094 32.7717C58.4401 33.1333 58.7582 33.4016 59.1199 33.3708C59.4815 33.3401 59.7497 33.022 59.719 32.6604C59.206 26.6261 57.8965 21.4076 54.6576 16.5848Z"}),Be("path",{d:"M59.2796 35.4504C59.6419 35.4277 59.9539 35.703 59.9765 36.0653C60.2242 40.0279 60.2265 44.5112 59.7881 47.8243C59.7405 48.1841 59.4102 48.4372 59.0504 48.3896C58.6906 48.342 58.4376 48.0117 58.4852 47.6519C58.9077 44.4586 58.91 40.0704 58.6648 36.1473C58.6421 35.785 58.9174 35.473 59.2796 35.4504Z"}),Be("path",{d:"M7.05311 25.5432C7.13829 25.1904 6.92135 24.8354 6.56855 24.7502C6.21576 24.665 5.86071 24.882 5.77553 25.2348C5.2932 27.2325 5.0428 29.2847 5.03288 31.3388C5.02266 33.4559 5.41742 35.5225 5.81234 37.5899C6.1354 39.2811 6.45855 40.9728 6.5602 42.6932C6.69373 44.9531 6.21839 47.2163 5.39698 49.3703C5.26766 49.7094 5.43774 50.0891 5.77685 50.2184C6.11596 50.3477 6.4957 50.1777 6.62502 49.8386C7.49325 47.5617 8.01954 45.1092 7.87221 42.6157C7.77126 40.9071 7.44813 39.2252 7.12512 37.5439C6.73099 35.4925 6.33704 33.442 6.34716 31.3451C6.35659 29.3933 6.59455 27.4425 7.05311 25.5432Z"}),Be("path",{d:"M24.2964 10.94C24.4317 11.2768 24.2683 11.6595 23.9315 11.7947C17.1187 14.5307 12.0027 20.7047 10.959 27.9852C10.523 31.0269 10.9941 34.0398 11.465 37.052C11.7303 38.7483 11.9954 40.4443 12.0985 42.1451C12.3221 45.833 11.902 49.8839 9.50192 53.5696C9.30387 53.8737 8.89677 53.9597 8.59264 53.7617C8.28851 53.5636 8.20251 53.1565 8.40056 52.8524C10.5873 49.4944 11.0012 45.7644 10.7867 42.2246C10.6821 40.499 10.4185 38.7833 10.1552 37.0686C9.68265 33.9923 9.21067 30.9195 9.65804 27.7987C10.7724 20.025 16.221 13.4748 23.4417 10.5751C23.7785 10.4399 24.1612 10.6032 24.2964 10.94Z"}),Be("path",{d:"M47.3662 14.6814C41.9915 9.64741 34.2017 7.89046 27.122 9.4433C26.7675 9.52105 26.5432 9.87147 26.6209 10.226C26.6987 10.5805 27.0491 10.8048 27.4036 10.7271C34.1075 9.25665 41.4426 10.934 46.4677 15.6406C50.7033 19.6077 53.1628 25.38 53.8066 31.6779C53.8435 32.0389 54.1661 32.3017 54.5272 32.2648C54.8883 32.2279 55.151 31.9053 55.1141 31.5442C54.4456 25.0047 51.8822 18.9111 47.3662 14.6814Z"}),Be("path",{d:"M54.9766 34.6738C55.3376 34.6368 55.6604 34.8994 55.6975 35.2604C56.3216 41.337 56.0526 47.9003 55.1104 54.2496C55.0571 54.6086 54.7229 54.8565 54.3639 54.8032C54.0049 54.7499 53.7571 54.4157 53.8103 54.0567C54.7394 47.7957 55.001 41.3439 54.39 35.3947C54.353 35.0336 54.6156 34.7109 54.9766 34.6738Z"}),Be("path",{d:"M32.0659 13.3553C21.9959 13.3553 13.814 21.3892 13.814 31.3219C13.814 32.3829 13.9081 33.4225 14.0876 34.4334C14.1511 34.7907 14.4922 35.029 14.8495 34.9655C15.2069 34.9021 15.4451 34.561 15.3817 34.2036C15.2155 33.2677 15.1283 32.305 15.1283 31.3219C15.1283 22.1352 22.7014 14.6696 32.0659 14.6696C36.2978 14.6696 40.1642 16.1949 43.1319 18.7152C43.4086 18.9501 43.8233 18.9163 44.0582 18.6396C44.2931 18.363 44.2593 17.9483 43.9827 17.7134C40.7847 14.9975 36.6188 13.3553 32.0659 13.3553Z"}),Be("path",{d:"M45.455 20.1635C45.717 19.9123 46.133 19.921 46.3842 20.183C49.2843 23.2072 50.2126 27.9605 50.8269 31.9494C51.5188 36.4426 51.6244 40.826 51.6244 42.8585C51.6244 43.2214 51.3302 43.5156 50.9673 43.5156C50.6044 43.5156 50.3101 43.2214 50.3101 42.8585C50.3101 40.8589 50.2055 36.5497 49.5279 32.1494C48.9577 28.4462 48.1356 23.9082 45.4356 21.0927C45.1844 20.8307 45.1931 20.4147 45.455 20.1635Z"}),Be("path",{d:"M51.4576 46.6219C51.4864 46.2601 51.2165 45.9435 50.8547 45.9146C50.493 45.8858 50.1763 46.1557 50.1474 46.5175C49.8247 50.5654 49.403 54.6088 48.5474 58.3439C48.4663 58.6977 48.6874 59.0502 49.0412 59.1312C49.3949 59.2123 49.7474 58.9912 49.8285 58.6374C50.7067 54.8039 51.134 50.6806 51.4576 46.6219Z"}),Be("path",{d:"M15.1454 36.852C15.5015 36.7819 15.847 37.0137 15.9171 37.3698C17.3066 44.4257 16.3467 50.8355 12.6672 56.4502C12.4682 56.7537 12.0609 56.8385 11.7573 56.6396C11.4538 56.4407 11.369 56.0333 11.5679 55.7298C15.0299 50.4469 15.9617 44.3985 14.6276 37.6238C14.5575 37.2677 14.7893 36.9221 15.1454 36.852Z"}),Be("path",{d:"M32.0659 17.631C25.5291 17.631 19.1165 22.691 18.462 29.0504C18.1754 31.8345 18.578 34.5769 18.9807 37.3204C19.3323 39.7159 19.684 42.1124 19.5772 44.5381C19.3328 50.0898 17.7039 54.6726 14.905 58.4471C14.6888 58.7386 14.7499 59.1502 15.0414 59.3663C15.333 59.5825 15.7445 59.5214 15.9607 59.2299C18.9293 55.2266 20.6354 50.386 20.8903 44.5959C20.9966 42.1811 20.6438 39.7923 20.2912 37.4051C19.888 34.6752 19.4851 31.9473 19.7694 29.1849C20.3444 23.5983 26.0946 18.9453 32.0659 18.9453C34.851 18.9453 42.057 20.4534 44.3492 27.9205C45.7856 32.5998 46.1774 38.9326 45.8295 45.0849C45.4816 51.2364 44.3994 57.12 42.9442 60.8928C42.8136 61.2314 42.9822 61.6118 43.3208 61.7424C43.6594 61.873 44.0398 61.7044 44.1704 61.3658C45.6929 57.4186 46.7895 51.386 47.1417 45.1591C47.4938 38.9329 47.1068 32.4249 45.6056 27.5348C43.0612 19.2461 35.0851 17.631 32.0659 17.631Z"}),Be("path",{d:"M21.9529 56.4512C22.2569 56.6494 22.3426 57.0566 22.1444 57.3606C21.7369 57.9854 21.3784 58.6391 21.0199 59.2928C20.6614 59.9465 20.3028 60.6004 19.8953 61.2253C19.697 61.5293 19.2898 61.615 18.9858 61.4167C18.6819 61.2184 18.5962 60.8113 18.7944 60.5073C19.2019 59.8825 19.5604 59.2288 19.9189 58.5751C20.2774 57.9213 20.636 57.2675 21.0435 56.6426C21.2418 56.3386 21.649 56.2529 21.9529 56.4512Z"}),Be("path",{d:"M27.5799 24.4525C27.8816 24.2508 27.9625 23.8426 27.7608 23.541C27.559 23.2393 27.1509 23.1583 26.8492 23.3601C24.247 25.1006 22.6505 27.494 22.6505 31.0002C22.6505 33.088 23.0203 34.7946 23.3997 36.5449C23.9674 39.1641 24.3524 41.7777 24.2832 44.468C24.1992 47.7349 23.56 50.7201 22.3313 53.564C22.1873 53.8971 22.3407 54.2839 22.6739 54.4278C23.0071 54.5718 23.3938 54.4184 23.5378 54.0852C24.8369 51.0784 25.509 47.9266 25.5971 44.5018C25.6689 41.7062 25.2732 38.9892 24.6845 36.267C24.3042 34.509 23.9648 32.9394 23.9648 31.0002C23.9648 27.9961 25.2863 25.9866 27.5799 24.4525Z"}),Be("path",{d:"M30.1447 22.1436C32.8717 21.5877 35.8061 22.2746 37.966 24.0228C41.8241 27.1455 42.3372 32.8403 42.753 37.4549L42.7742 37.69C43.3115 43.6385 42.6964 49.4163 41.4575 55.2186C41.3817 55.5736 41.0326 55.7999 40.6776 55.7241C40.3227 55.6483 40.0964 55.2991 40.1722 54.9442C41.3926 49.2288 41.9873 43.5885 41.4652 37.8082C41.4479 37.6169 41.4307 37.4228 41.4133 37.2264L41.4131 37.2235C41.0438 33.0534 40.5812 27.8304 37.1392 25.0444C35.2926 23.5498 32.7599 22.9518 30.4073 23.4314C30.0517 23.5039 29.7046 23.2744 29.6321 22.9188C29.5596 22.5632 29.7891 22.2161 30.1447 22.1436Z"}),Be("path",{d:"M40.5287 58.4885C40.6183 58.1368 40.4057 57.7791 40.054 57.6896C39.7023 57.6 39.3446 57.8126 39.2551 58.1643C38.8578 59.7247 38.2456 61.1333 37.4695 62.4301C37.2831 62.7415 37.3844 63.145 37.6958 63.3314C38.0072 63.5178 38.4108 63.4165 38.5972 63.1051C39.4336 61.7075 40.0977 60.1816 40.5287 58.4885Z"}),Be("path",{d:"M37.3152 48.9521C37.6756 48.9948 37.9332 49.3215 37.8906 49.682C37.2699 54.9267 35.8688 59.6042 33.6205 63.6613C33.4446 63.9787 33.0446 64.0934 32.7272 63.9175C32.4097 63.7416 32.295 63.3417 32.4709 63.0242C34.6226 59.1416 35.9811 54.6339 36.5854 49.5275C36.6281 49.1671 36.9548 48.9095 37.3152 48.9521Z"}),Be("path",{d:"M37.1798 30.6556C36.7242 28.2212 34.6349 26.3591 32.0985 26.3591C28.6638 26.3591 26.254 29.8212 27.1032 33.0422C28.54 38.7279 28.7759 44.2077 27.8032 49.4855L27.8025 49.4893C26.9584 54.228 25.3374 58.4908 23.1263 62.1031C22.9368 62.4127 23.0342 62.8172 23.3437 63.0067C23.6533 63.1962 24.0578 63.0988 24.2473 62.7893C26.5488 59.0292 28.2249 54.6109 29.0961 49.7218C30.106 44.2403 29.8558 38.5684 28.3765 32.7168L28.3748 32.7099C27.7378 30.3005 29.5133 27.6734 32.0985 27.6734C33.9641 27.6734 35.5393 29.0459 35.8871 30.8929C36.8436 36.4411 37.3418 41.5862 36.9871 46.016C36.9581 46.3778 37.2279 46.6945 37.5897 46.7235C37.9515 46.7525 38.2682 46.4827 38.2972 46.1209C38.6649 41.5294 38.1459 36.2576 37.1815 30.6648C37.1809 30.6617 37.1804 30.6586 37.1798 30.6556Z"}),Be("path",{d:"M30.1376 59.1171C30.4604 59.283 30.5876 59.6792 30.4217 60.002L28.6804 63.3906C28.5145 63.7134 28.1184 63.8406 27.7956 63.6747C27.4728 63.5088 27.3456 63.1127 27.5114 62.7899L29.2527 59.4013C29.4186 59.0785 29.8147 58.9513 30.1376 59.1171Z"}),Be("path",{d:"M32.5872 31.2892C32.5042 30.9359 32.1505 30.7168 31.7972 30.7998C31.4439 30.8828 31.2247 31.2365 31.3077 31.5898C33.5238 41.0232 33.2194 49.3066 30.5201 56.363C30.3905 56.702 30.5602 57.0819 30.8991 57.2115C31.2381 57.3412 31.618 57.1715 31.7477 56.8326C34.5622 49.475 34.8483 40.9141 32.5872 31.2892Z"})]}),Be("defs",{children:Be("clipPath",{id:"clip0_113_33841",children:Be("rect",{width:"64",height:"64",fill:"white",transform:"translate(0.483887)"})})})]});import{Fragment as Tp,jsx as he,jsxs as tr}from"react/jsx-runtime";var Dg=({passkeys:e,expanded:t,onUnlink:r,onExpand:o})=>{let[n,i]=Ua([]),a=t?e.length:2,l=c=>c.authenticatorName?c.createdWithBrowser?`${c.authenticatorName} on ${c.createdWithBrowser}`:c.authenticatorName:c.createdWithBrowser?c.createdWithOs?`${c.createdWithBrowser} on ${c.createdWithOs}`:`${c.createdWithBrowser}`:"Unknown device",s=async c=>{i(m=>m.concat([c])),await r(c),i(m=>m.filter(f=>f!==c))};return tr("div",{children:[he(hb,{children:"Your passkeys"}),tr(Hg,{children:[e.slice(0,a).map(c=>tr(vb,{children:[tr("div",{children:[he(yb,{children:l(c)}),tr(gb,{children:["Last used: ",(c.latestVerifiedAt??c.verifiedAt).toLocaleString()]})]}),he(wb,{disabled:n.includes(c.credentialId),onClick:()=>s(c.credentialId),children:n.includes(c.credentialId)?he(ro,{}):he(ib,{height:"1.6em"})})]},c.credentialId)),e.length>2&&!t&&he(Sp,{onClick:o,children:"View all"})]})]})},db=()=>tr(Hg,{children:[tr(Qt,{children:[he(Zt,{children:he(ab,{})}),"Log in with Touch ID, Face ID, or a security key."]}),tr(Qt,{children:[he(Zt,{children:he(lb,{})}),"More secure than a password."]}),tr(Qt,{children:[he(Zt,{children:he(nb,{})}),"Takes seconds to set up and use."]})]}),Bg=()=>{let{user:e,unlinkPasskey:t}=z(),{linkWithPasskey:r,closePrivyModal:o}=M(),n=e?.linkedAccounts.filter(y=>y.type==="passkey"),[i,a]=Ua(!1),[l,s]=Ua(""),[c,m]=Ua(!1),[f,u]=Ua(!1);cb(()=>{n.length===0&&u(!1)},[n.length]);let C=()=>{a(!0),r().then(()=>m(!0)).catch(y=>{if(y instanceof et){if(y.privyErrorCode==="cannot_link_more_of_type"){s("Cannot link more passkeys to account.");return}else if(y.privyErrorCode==="passkey_not_allowed"){s("Passkey request timed out or rejected by user.");return}}s("Unknown error occurred.")}).finally(()=>{a(!1)})},g=async y=>(a(!0),await t(y).then(()=>m(!0)).catch(b=>{if(b instanceof et&&b.privyErrorCode==="missing_or_invalid_mfa"){s("Cannot unlink a passkey enrolled in MFA");return}s("Unknown error occurred.")}).finally(()=>{a(!1)}));return c?tr(Tp,{children:[he(x,{onClose:()=>o()},"header"),he(Me,{children:he(Ye,{status:"success",children:he(sb,{})})}),he(Ug,{children:"Passkey added"}),he(mb,{children:"From now on, you can use your passkey to log in."}),he(Tt,{children:he(B,{onClick:()=>o(),children:"Done"})}),he(Z,{})]}):f?tr(Tp,{children:[he(x,{backFn:()=>u(!1),onClose:()=>o()},"header"),he(Dg,{passkeys:n,expanded:f,onUnlink:g,onExpand:()=>u(!0)}),he(Z,{})]}):tr(Tp,{children:[he(x,{onClose:()=>o()},"header"),he(Me,{children:tr(rc,{children:[he(Bn,{}),he(Hn,{})]})}),he(Ug,{children:"Secure your account with a passkey"}),he(fb,{}),n.length===0?he(db,{}):he(Dg,{passkeys:n,expanded:f,onUnlink:g,onExpand:()=>u(!0)}),tr(Tt,{style:{marginTop:"12px"},children:[l&&he(pb,{fail:!0,children:l}),he(B,{onClick:C,loading:i,children:"Add new passkey"})]}),he(Z,{})]})},rc=Rr.div`
1657
+ `;import{jsx as Sp,jsxs as lb}from"react/jsx-runtime";var qi=({size:e=61,...t})=>Sp("svg",{width:e,height:e,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:lb("g",{id:"moonpay_symbol_wht 2",children:[Sp("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),Sp("path",{id:"Vector",d:"M43.8884 23.3258C45.0203 23.3258 46.1268 22.9901 47.068 22.3613C48.0091 21.7324 48.7427 20.8386 49.1759 19.7928C49.6091 18.747 49.7224 17.5962 49.5016 16.4861C49.2807 15.3759 48.7357 14.3561 47.9353 13.5557C47.1349 12.7553 46.1151 12.2102 45.0049 11.9893C43.8947 11.7685 42.7439 11.8819 41.6982 12.3151C40.6524 12.7482 39.7585 13.4818 39.1297 14.423C38.5008 15.3641 38.1651 16.4707 38.1651 17.6026C38.165 18.3542 38.3131 19.0985 38.6007 19.7929C38.8883 20.4873 39.3098 21.1182 39.8413 21.6496C40.3728 22.1811 41.0037 22.6027 41.6981 22.8903C42.3925 23.1778 43.1367 23.3259 43.8884 23.3258ZM26.3395 49.1017C23.5804 49.1017 20.8832 48.2836 18.5891 46.7507C16.295 45.2178 14.5069 43.039 13.4511 40.49C12.3952 37.9409 12.1189 35.1359 12.6572 32.4298C13.1955 29.7237 14.5241 27.238 16.4751 25.287C18.4262 23.336 20.9118 22.0074 23.6179 21.4691C26.324 20.9308 29.129 21.2071 31.6781 22.2629C34.2272 23.3189 36.406 25.1069 37.9389 27.401C39.4717 29.6952 40.2899 32.3923 40.2899 35.1514C40.2899 36.9835 39.9291 38.7975 39.2281 40.49C38.527 42.1826 37.4994 43.7205 36.204 45.0159C34.9086 46.3113 33.3707 47.3389 31.6781 48.04C29.9856 48.741 28.1715 49.1018 26.3395 49.1017Z",fill:"white"})]})});import Ir,{keyframes as Pb}from"styled-components";import cb from"@heroicons/react/24/outline/ClockIcon";import db from"@heroicons/react/24/outline/TrashIcon";import pb from"@heroicons/react/24/solid/CheckBadgeIcon";import ub from"@heroicons/react/24/solid/CheckCircleIcon";import mb from"@heroicons/react/24/solid/LockClosedIcon";import{useEffect as fb,useState as Fa}from"react";import Rr,{css as Vg}from"styled-components";import{jsx as Fg}from"react/jsx-runtime";var Gn=({style:e,...t})=>Fg("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...e},fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:Fg("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.71369 17.5625V10.375C3.71369 6.44625 6.85845 3.25 10.7238 3.25H17.7953C18.6783 3.25 19.3941 2.52244 19.3941 1.625C19.3941 0.727562 18.6783 0 17.7953 0H10.7238C5.09529 0 0.516113 4.65419 0.516113 10.375V17.5625C0.516113 18.4599 1.23194 19.1875 2.1149 19.1875C2.99787 19.1875 3.71369 18.4599 3.71369 17.5625ZM17.7953 60.7501C18.6783 60.7501 19.3941 61.4777 19.3941 62.3751C19.3941 63.2726 18.6783 64.0001 17.7953 64.0001H10.7238C5.09529 64.0001 0.516113 59.3459 0.516113 53.6251V46.4376C0.516113 45.5402 1.23194 44.8126 2.1149 44.8126C2.99787 44.8126 3.71369 45.5402 3.71369 46.4376V53.6251C3.71369 57.5538 6.85845 60.7501 10.7238 60.7501H17.7953ZM63.4839 46.4376V53.6251C63.4839 59.3459 58.9048 64.0001 53.2763 64.0001H46.2047C45.3217 64.0001 44.6059 63.2726 44.6059 62.3751C44.6059 61.4777 45.3217 60.7501 46.2047 60.7501H53.2763C57.1416 60.7501 60.2864 57.5538 60.2864 53.6251V46.4376C60.2864 45.5402 61.0022 44.8126 61.8851 44.8126C62.7681 44.8126 63.4839 45.5402 63.4839 46.4376ZM63.4839 10.375V17.5625C63.4839 18.4599 62.7681 19.1875 61.8851 19.1875C61.0022 19.1875 60.2864 18.4599 60.2864 17.5625V10.375C60.2864 6.44625 57.1416 3.25 53.2763 3.25H46.2047C45.3217 3.25 44.6059 2.52244 44.6059 1.625C44.6059 0.727562 45.3217 0 46.2047 0H53.2763C58.9048 0 63.4839 4.65419 63.4839 10.375ZM43.0331 47.3022C43.7067 46.6698 43.7483 45.6022 43.1262 44.9176C42.5039 44.233 41.4536 44.1906 40.78 44.823C38.3832 47.0732 35.265 48.3125 31.9997 48.3125C28.7344 48.3125 25.6162 47.0732 23.2194 44.823C22.5457 44.1906 21.4955 44.233 20.8732 44.9176C20.251 45.6022 20.2927 46.6698 20.9663 47.3022C23.9784 50.1301 27.8968 51.6875 31.9997 51.6875C36.1026 51.6875 40.021 50.1301 43.0331 47.3022ZM35.3207 24.1249V36.1249C35.3207 38.5029 33.4173 40.4374 31.0777 40.4374H29.7249C28.8079 40.4374 28.0646 39.6819 28.0646 38.7499C28.0646 37.8179 28.8079 37.0624 29.7249 37.0624H31.0777C31.5863 37.0624 32.0001 36.6419 32.0001 36.1249V24.1249C32.0001 23.1929 32.7434 22.4374 33.6604 22.4374C34.5774 22.4374 35.3207 23.1929 35.3207 24.1249ZM46.7581 28.8437V24.0312C46.7581 23.151 46.056 22.4374 45.19 22.4374C44.324 22.4374 43.622 23.151 43.622 24.0312V28.8437C43.622 29.7239 44.324 30.4374 45.19 30.4374C46.056 30.4374 46.7581 29.7239 46.7581 28.8437ZM17.6109 28.8437C17.6109 29.7239 18.313 30.4374 19.1789 30.4374C20.0449 30.4374 20.747 29.7239 20.747 28.8437V24.0312C20.747 23.151 20.0449 22.4374 19.1789 22.4374C18.313 22.4374 17.6109 23.151 17.6109 24.0312V28.8437Z"})});import{jsx as Be,jsxs as Bg}from"react/jsx-runtime";var Vn=({style:e,...t})=>Bg("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...e},xmlns:"http://www.w3.org/2000/svg",...t,children:[Bg("g",{clipPath:"url(#clip0_113_33841)",children:[Be("path",{d:"M39.1193 0.943398C34.636 -0.174912 29.9185 -0.334713 25.328 0.656273C24.9732 0.732859 24.7477 1.08253 24.8243 1.43729C24.9009 1.79205 25.2506 2.01756 25.6053 1.94097C30.0015 0.991934 34.53 1.14842 38.8375 2.22802C49.1385 4.80983 57.7129 12.5548 60.9786 22.6718C62.2416 26.5843 62.7781 30.7505 62.8855 35.1167C62.8945 35.4795 63.1958 35.7664 63.5586 35.7575C63.9215 35.7485 64.2083 35.4472 64.1994 35.0843C64.0905 30.6582 63.5477 26.3849 62.2536 22.3432C58.8621 11.7515 49.9005 3.63265 39.1193 0.943398Z"}),Be("path",{d:"M21.9931 2.93163C22.343 2.83511 22.5484 2.47325 22.4518 2.12339C22.3553 1.77352 21.9935 1.56815 21.6436 1.66466C16.8429 2.98903 10.0898 7.56519 5.91628 13.6786C5.91465 13.681 5.91304 13.6834 5.91145 13.6858C2.24684 19.2083 -0.0503572 26.1484 0.591012 32.8828C0.591623 32.8892 0.592328 32.8956 0.593127 32.902C0.746837 34.1317 1.00488 35.3591 1.26323 36.5879C1.80735 39.1761 2.35282 41.7706 1.92765 44.4064C1.86986 44.7647 2.11347 45.102 2.47177 45.1598C2.83007 45.2176 3.16738 44.974 3.22518 44.6157C3.66961 41.8605 3.11776 39.173 2.56581 36.4851C2.31054 35.2419 2.05525 33.9987 1.89847 32.7486C1.29525 26.3851 3.46802 19.7466 7.00418 14.416C11.0189 8.5373 17.5201 4.16562 21.9931 2.93163Z"}),Be("path",{d:"M30.6166 4.39985C38.8671 3.89603 47.1159 7.26314 52.6556 13.7139C52.8921 13.9893 52.8605 14.4042 52.5852 14.6406C52.3099 14.8771 51.895 14.8455 51.6585 14.5702C46.3904 8.43576 38.541 5.23144 30.6927 5.71195C30.6899 5.71212 30.6871 5.71227 30.6843 5.71241C20.7592 6.19265 11.4643 12.9257 8.04547 22.3603C7.92183 22.7016 7.54498 22.8779 7.20375 22.7543C6.86253 22.6306 6.68616 22.2538 6.80981 21.9126C10.4114 11.9735 20.1717 4.90702 30.6166 4.39985Z"}),Be("path",{d:"M54.6576 16.5848C54.4553 16.2836 54.047 16.2033 53.7457 16.4057C53.4444 16.608 53.3642 17.0163 53.5665 17.3176C56.6376 21.8904 57.9074 26.8665 58.4094 32.7717C58.4401 33.1333 58.7582 33.4016 59.1199 33.3708C59.4815 33.3401 59.7497 33.022 59.719 32.6604C59.206 26.6261 57.8965 21.4076 54.6576 16.5848Z"}),Be("path",{d:"M59.2796 35.4504C59.6419 35.4277 59.9539 35.703 59.9765 36.0653C60.2242 40.0279 60.2265 44.5112 59.7881 47.8243C59.7405 48.1841 59.4102 48.4372 59.0504 48.3896C58.6906 48.342 58.4376 48.0117 58.4852 47.6519C58.9077 44.4586 58.91 40.0704 58.6648 36.1473C58.6421 35.785 58.9174 35.473 59.2796 35.4504Z"}),Be("path",{d:"M7.05311 25.5432C7.13829 25.1904 6.92135 24.8354 6.56855 24.7502C6.21576 24.665 5.86071 24.882 5.77553 25.2348C5.2932 27.2325 5.0428 29.2847 5.03288 31.3388C5.02266 33.4559 5.41742 35.5225 5.81234 37.5899C6.1354 39.2811 6.45855 40.9728 6.5602 42.6932C6.69373 44.9531 6.21839 47.2163 5.39698 49.3703C5.26766 49.7094 5.43774 50.0891 5.77685 50.2184C6.11596 50.3477 6.4957 50.1777 6.62502 49.8386C7.49325 47.5617 8.01954 45.1092 7.87221 42.6157C7.77126 40.9071 7.44813 39.2252 7.12512 37.5439C6.73099 35.4925 6.33704 33.442 6.34716 31.3451C6.35659 29.3933 6.59455 27.4425 7.05311 25.5432Z"}),Be("path",{d:"M24.2964 10.94C24.4317 11.2768 24.2683 11.6595 23.9315 11.7947C17.1187 14.5307 12.0027 20.7047 10.959 27.9852C10.523 31.0269 10.9941 34.0398 11.465 37.052C11.7303 38.7483 11.9954 40.4443 12.0985 42.1451C12.3221 45.833 11.902 49.8839 9.50192 53.5696C9.30387 53.8737 8.89677 53.9597 8.59264 53.7617C8.28851 53.5636 8.20251 53.1565 8.40056 52.8524C10.5873 49.4944 11.0012 45.7644 10.7867 42.2246C10.6821 40.499 10.4185 38.7833 10.1552 37.0686C9.68265 33.9923 9.21067 30.9195 9.65804 27.7987C10.7724 20.025 16.221 13.4748 23.4417 10.5751C23.7785 10.4399 24.1612 10.6032 24.2964 10.94Z"}),Be("path",{d:"M47.3662 14.6814C41.9915 9.64741 34.2017 7.89046 27.122 9.4433C26.7675 9.52105 26.5432 9.87147 26.6209 10.226C26.6987 10.5805 27.0491 10.8048 27.4036 10.7271C34.1075 9.25665 41.4426 10.934 46.4677 15.6406C50.7033 19.6077 53.1628 25.38 53.8066 31.6779C53.8435 32.0389 54.1661 32.3017 54.5272 32.2648C54.8883 32.2279 55.151 31.9053 55.1141 31.5442C54.4456 25.0047 51.8822 18.9111 47.3662 14.6814Z"}),Be("path",{d:"M54.9766 34.6738C55.3376 34.6368 55.6604 34.8994 55.6975 35.2604C56.3216 41.337 56.0526 47.9003 55.1104 54.2496C55.0571 54.6086 54.7229 54.8565 54.3639 54.8032C54.0049 54.7499 53.7571 54.4157 53.8103 54.0567C54.7394 47.7957 55.001 41.3439 54.39 35.3947C54.353 35.0336 54.6156 34.7109 54.9766 34.6738Z"}),Be("path",{d:"M32.0659 13.3553C21.9959 13.3553 13.814 21.3892 13.814 31.3219C13.814 32.3829 13.9081 33.4225 14.0876 34.4334C14.1511 34.7907 14.4922 35.029 14.8495 34.9655C15.2069 34.9021 15.4451 34.561 15.3817 34.2036C15.2155 33.2677 15.1283 32.305 15.1283 31.3219C15.1283 22.1352 22.7014 14.6696 32.0659 14.6696C36.2978 14.6696 40.1642 16.1949 43.1319 18.7152C43.4086 18.9501 43.8233 18.9163 44.0582 18.6396C44.2931 18.363 44.2593 17.9483 43.9827 17.7134C40.7847 14.9975 36.6188 13.3553 32.0659 13.3553Z"}),Be("path",{d:"M45.455 20.1635C45.717 19.9123 46.133 19.921 46.3842 20.183C49.2843 23.2072 50.2126 27.9605 50.8269 31.9494C51.5188 36.4426 51.6244 40.826 51.6244 42.8585C51.6244 43.2214 51.3302 43.5156 50.9673 43.5156C50.6044 43.5156 50.3101 43.2214 50.3101 42.8585C50.3101 40.8589 50.2055 36.5497 49.5279 32.1494C48.9577 28.4462 48.1356 23.9082 45.4356 21.0927C45.1844 20.8307 45.1931 20.4147 45.455 20.1635Z"}),Be("path",{d:"M51.4576 46.6219C51.4864 46.2601 51.2165 45.9435 50.8547 45.9146C50.493 45.8858 50.1763 46.1557 50.1474 46.5175C49.8247 50.5654 49.403 54.6088 48.5474 58.3439C48.4663 58.6977 48.6874 59.0502 49.0412 59.1312C49.3949 59.2123 49.7474 58.9912 49.8285 58.6374C50.7067 54.8039 51.134 50.6806 51.4576 46.6219Z"}),Be("path",{d:"M15.1454 36.852C15.5015 36.7819 15.847 37.0137 15.9171 37.3698C17.3066 44.4257 16.3467 50.8355 12.6672 56.4502C12.4682 56.7537 12.0609 56.8385 11.7573 56.6396C11.4538 56.4407 11.369 56.0333 11.5679 55.7298C15.0299 50.4469 15.9617 44.3985 14.6276 37.6238C14.5575 37.2677 14.7893 36.9221 15.1454 36.852Z"}),Be("path",{d:"M32.0659 17.631C25.5291 17.631 19.1165 22.691 18.462 29.0504C18.1754 31.8345 18.578 34.5769 18.9807 37.3204C19.3323 39.7159 19.684 42.1124 19.5772 44.5381C19.3328 50.0898 17.7039 54.6726 14.905 58.4471C14.6888 58.7386 14.7499 59.1502 15.0414 59.3663C15.333 59.5825 15.7445 59.5214 15.9607 59.2299C18.9293 55.2266 20.6354 50.386 20.8903 44.5959C20.9966 42.1811 20.6438 39.7923 20.2912 37.4051C19.888 34.6752 19.4851 31.9473 19.7694 29.1849C20.3444 23.5983 26.0946 18.9453 32.0659 18.9453C34.851 18.9453 42.057 20.4534 44.3492 27.9205C45.7856 32.5998 46.1774 38.9326 45.8295 45.0849C45.4816 51.2364 44.3994 57.12 42.9442 60.8928C42.8136 61.2314 42.9822 61.6118 43.3208 61.7424C43.6594 61.873 44.0398 61.7044 44.1704 61.3658C45.6929 57.4186 46.7895 51.386 47.1417 45.1591C47.4938 38.9329 47.1068 32.4249 45.6056 27.5348C43.0612 19.2461 35.0851 17.631 32.0659 17.631Z"}),Be("path",{d:"M21.9529 56.4512C22.2569 56.6494 22.3426 57.0566 22.1444 57.3606C21.7369 57.9854 21.3784 58.6391 21.0199 59.2928C20.6614 59.9465 20.3028 60.6004 19.8953 61.2253C19.697 61.5293 19.2898 61.615 18.9858 61.4167C18.6819 61.2184 18.5962 60.8113 18.7944 60.5073C19.2019 59.8825 19.5604 59.2288 19.9189 58.5751C20.2774 57.9213 20.636 57.2675 21.0435 56.6426C21.2418 56.3386 21.649 56.2529 21.9529 56.4512Z"}),Be("path",{d:"M27.5799 24.4525C27.8816 24.2508 27.9625 23.8426 27.7608 23.541C27.559 23.2393 27.1509 23.1583 26.8492 23.3601C24.247 25.1006 22.6505 27.494 22.6505 31.0002C22.6505 33.088 23.0203 34.7946 23.3997 36.5449C23.9674 39.1641 24.3524 41.7777 24.2832 44.468C24.1992 47.7349 23.56 50.7201 22.3313 53.564C22.1873 53.8971 22.3407 54.2839 22.6739 54.4278C23.0071 54.5718 23.3938 54.4184 23.5378 54.0852C24.8369 51.0784 25.509 47.9266 25.5971 44.5018C25.6689 41.7062 25.2732 38.9892 24.6845 36.267C24.3042 34.509 23.9648 32.9394 23.9648 31.0002C23.9648 27.9961 25.2863 25.9866 27.5799 24.4525Z"}),Be("path",{d:"M30.1447 22.1436C32.8717 21.5877 35.8061 22.2746 37.966 24.0228C41.8241 27.1455 42.3372 32.8403 42.753 37.4549L42.7742 37.69C43.3115 43.6385 42.6964 49.4163 41.4575 55.2186C41.3817 55.5736 41.0326 55.7999 40.6776 55.7241C40.3227 55.6483 40.0964 55.2991 40.1722 54.9442C41.3926 49.2288 41.9873 43.5885 41.4652 37.8082C41.4479 37.6169 41.4307 37.4228 41.4133 37.2264L41.4131 37.2235C41.0438 33.0534 40.5812 27.8304 37.1392 25.0444C35.2926 23.5498 32.7599 22.9518 30.4073 23.4314C30.0517 23.5039 29.7046 23.2744 29.6321 22.9188C29.5596 22.5632 29.7891 22.2161 30.1447 22.1436Z"}),Be("path",{d:"M40.5287 58.4885C40.6183 58.1368 40.4057 57.7791 40.054 57.6896C39.7023 57.6 39.3446 57.8126 39.2551 58.1643C38.8578 59.7247 38.2456 61.1333 37.4695 62.4301C37.2831 62.7415 37.3844 63.145 37.6958 63.3314C38.0072 63.5178 38.4108 63.4165 38.5972 63.1051C39.4336 61.7075 40.0977 60.1816 40.5287 58.4885Z"}),Be("path",{d:"M37.3152 48.9521C37.6756 48.9948 37.9332 49.3215 37.8906 49.682C37.2699 54.9267 35.8688 59.6042 33.6205 63.6613C33.4446 63.9787 33.0446 64.0934 32.7272 63.9175C32.4097 63.7416 32.295 63.3417 32.4709 63.0242C34.6226 59.1416 35.9811 54.6339 36.5854 49.5275C36.6281 49.1671 36.9548 48.9095 37.3152 48.9521Z"}),Be("path",{d:"M37.1798 30.6556C36.7242 28.2212 34.6349 26.3591 32.0985 26.3591C28.6638 26.3591 26.254 29.8212 27.1032 33.0422C28.54 38.7279 28.7759 44.2077 27.8032 49.4855L27.8025 49.4893C26.9584 54.228 25.3374 58.4908 23.1263 62.1031C22.9368 62.4127 23.0342 62.8172 23.3437 63.0067C23.6533 63.1962 24.0578 63.0988 24.2473 62.7893C26.5488 59.0292 28.2249 54.6109 29.0961 49.7218C30.106 44.2403 29.8558 38.5684 28.3765 32.7168L28.3748 32.7099C27.7378 30.3005 29.5133 27.6734 32.0985 27.6734C33.9641 27.6734 35.5393 29.0459 35.8871 30.8929C36.8436 36.4411 37.3418 41.5862 36.9871 46.016C36.9581 46.3778 37.2279 46.6945 37.5897 46.7235C37.9515 46.7525 38.2682 46.4827 38.2972 46.1209C38.6649 41.5294 38.1459 36.2576 37.1815 30.6648C37.1809 30.6617 37.1804 30.6586 37.1798 30.6556Z"}),Be("path",{d:"M30.1376 59.1171C30.4604 59.283 30.5876 59.6792 30.4217 60.002L28.6804 63.3906C28.5145 63.7134 28.1184 63.8406 27.7956 63.6747C27.4728 63.5088 27.3456 63.1127 27.5114 62.7899L29.2527 59.4013C29.4186 59.0785 29.8147 58.9513 30.1376 59.1171Z"}),Be("path",{d:"M32.5872 31.2892C32.5042 30.9359 32.1505 30.7168 31.7972 30.7998C31.4439 30.8828 31.2247 31.2365 31.3077 31.5898C33.5238 41.0232 33.2194 49.3066 30.5201 56.363C30.3905 56.702 30.5602 57.0819 30.8991 57.2115C31.2381 57.3412 31.618 57.1715 31.7477 56.8326C34.5622 49.475 34.8483 40.9141 32.5872 31.2892Z"})]}),Be("defs",{children:Be("clipPath",{id:"clip0_113_33841",children:Be("rect",{width:"64",height:"64",fill:"white",transform:"translate(0.483887)"})})})]});import{Fragment as _p,jsx as ye,jsxs as rr}from"react/jsx-runtime";var Hg=({passkeys:e,expanded:t,onUnlink:r,onExpand:o})=>{let[n,i]=Fa([]),a=t?e.length:2,l=c=>c.authenticatorName?c.createdWithBrowser?`${c.authenticatorName} on ${c.createdWithBrowser}`:c.authenticatorName:c.createdWithBrowser?c.createdWithOs?`${c.createdWithBrowser} on ${c.createdWithOs}`:`${c.createdWithBrowser}`:"Unknown device",s=async c=>{i(m=>m.concat([c])),await r(c),i(m=>m.filter(f=>f!==c))};return rr("div",{children:[ye(wb,{children:"Your passkeys"}),rr(zg,{children:[e.slice(0,a).map(c=>rr(Tb,{children:[rr("div",{children:[ye(bb,{children:l(c)}),rr(Eb,{children:["Last used: ",(c.latestVerifiedAt??c.verifiedAt).toLocaleString()]})]}),ye(_b,{disabled:n.includes(c.credentialId),onClick:()=>s(c.credentialId),children:n.includes(c.credentialId)?ye(ro,{}):ye(db,{height:"1.6em"})})]},c.credentialId)),e.length>2&&!t&&ye(Pp,{onClick:o,children:"View all"})]})]})},hb=()=>rr(zg,{children:[rr(Qt,{children:[ye(Zt,{children:ye(pb,{})}),"Log in with Touch ID, Face ID, or a security key."]}),rr(Qt,{children:[ye(Zt,{children:ye(mb,{})}),"More secure than a password."]}),rr(Qt,{children:[ye(Zt,{children:ye(cb,{})}),"Takes seconds to set up and use."]})]}),qg=()=>{let{user:e,unlinkPasskey:t}=q(),{linkWithPasskey:r,closePrivyModal:o}=M(),n=e?.linkedAccounts.filter(y=>y.type==="passkey"),[i,a]=Fa(!1),[l,s]=Fa(""),[c,m]=Fa(!1),[f,u]=Fa(!1);fb(()=>{n.length===0&&u(!1)},[n.length]);let C=()=>{a(!0),r().then(()=>m(!0)).catch(y=>{if(y instanceof et){if(y.privyErrorCode==="cannot_link_more_of_type"){s("Cannot link more passkeys to account.");return}else if(y.privyErrorCode==="passkey_not_allowed"){s("Passkey request timed out or rejected by user.");return}}s("Unknown error occurred.")}).finally(()=>{a(!1)})},g=async y=>(a(!0),await t(y).then(()=>m(!0)).catch(b=>{if(b instanceof et&&b.privyErrorCode==="missing_or_invalid_mfa"){s("Cannot unlink a passkey enrolled in MFA");return}s("Unknown error occurred.")}).finally(()=>{a(!1)}));return c?rr(_p,{children:[ye(A,{onClose:()=>o()},"header"),ye(Me,{children:ye(Ye,{status:"success",children:ye(ub,{})})}),ye(Gg,{children:"Passkey added"}),ye(vb,{children:"From now on, you can use your passkey to log in."}),ye(Tt,{children:ye(B,{onClick:()=>o(),children:"Done"})}),ye(Z,{})]}):f?rr(_p,{children:[ye(A,{backFn:()=>u(!1),onClose:()=>o()},"header"),ye(Hg,{passkeys:n,expanded:f,onUnlink:g,onExpand:()=>u(!0)}),ye(Z,{})]}):rr(_p,{children:[ye(A,{onClose:()=>o()},"header"),ye(Me,{children:rr(nc,{children:[ye(Gn,{}),ye(Vn,{})]})}),ye(Gg,{children:"Secure your account with a passkey"}),ye(Cb,{}),n.length===0?ye(hb,{}):ye(Hg,{passkeys:n,expanded:f,onUnlink:g,onExpand:()=>u(!0)}),rr(Tt,{style:{marginTop:"12px"},children:[l&&ye(yb,{fail:!0,children:l}),ye(B,{onClick:C,loading:i,children:"Add new passkey"})]}),ye(Z,{})]})},nc=Rr.div`
1658
1658
  display: flex;
1659
1659
  align-items: center;
1660
1660
  justify-content: center;
@@ -1670,7 +1670,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1670
1670
  stroke: var(--privy-color-accent) !important;
1671
1671
  fill: var(--privy-color-accent) !important;
1672
1672
  }
1673
- `,pb=Rr.div`
1673
+ `,yb=Rr.div`
1674
1674
  line-height: 20px;
1675
1675
  height: 20px;
1676
1676
  font-size: 13px;
@@ -1678,7 +1678,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1678
1678
  display: flex;
1679
1679
  justify-content: flex-beginngin;
1680
1680
  width: 100%;
1681
- `,ub=Fg`
1681
+ `,gb=Vg`
1682
1682
  && {
1683
1683
  width: 100%;
1684
1684
  font-size: 0.875rem;
@@ -1703,9 +1703,9 @@ You will need this password to access your ${e} wallet on a new device. Please k
1703
1703
  box-shadow: none;
1704
1704
  }
1705
1705
  }
1706
- `,Sp=Rr.button`
1707
- ${ub}
1708
- `,Hg=Rr.div`
1706
+ `,Pp=Rr.button`
1707
+ ${gb}
1708
+ `,zg=Rr.div`
1709
1709
  display: flex;
1710
1710
  flex-direction: column;
1711
1711
  align-items: stretch;
@@ -1713,18 +1713,18 @@ You will need this password to access your ${e} wallet on a new device. Please k
1713
1713
  padding: 0.5rem 0rem 0rem;
1714
1714
  flex-grow: 1;
1715
1715
  width: 100%;
1716
- `,Ug=Rr.div`
1716
+ `,Gg=Rr.div`
1717
1717
  font-size: 18px;
1718
1718
  line-height: 18px;
1719
1719
  text-align: center;
1720
1720
  font-weight: 600;
1721
- `,mb=Rr.div`
1721
+ `,vb=Rr.div`
1722
1722
  font-size: 0.875rem;
1723
1723
  text-align: center;
1724
1724
  margin-top: 10px;
1725
- `,fb=Rr.div`
1725
+ `,Cb=Rr.div`
1726
1726
  height: 32px;
1727
- `,hb=Rr.div`
1727
+ `,wb=Rr.div`
1728
1728
  line-height: 20px;
1729
1729
  height: 20px;
1730
1730
  font-size: 1em;
@@ -1732,18 +1732,18 @@ You will need this password to access your ${e} wallet on a new device. Please k
1732
1732
  display: flex;
1733
1733
  justify-content: flex-beginning;
1734
1734
  width: 100%;
1735
- `,yb=Rr.div`
1735
+ `,bb=Rr.div`
1736
1736
  font-size: 1em;
1737
1737
  line-height: 1.3em;
1738
1738
  font-weight: 500;
1739
1739
  color: var(--privy-color-foreground-2);
1740
1740
  padding: 0.2em 0;
1741
- `,gb=Rr.div`
1741
+ `,Eb=Rr.div`
1742
1742
  font-size: 0.875rem;
1743
1743
  line-height: 1rem;
1744
1744
  color: #64668b;
1745
1745
  padding: 0.2em 0;
1746
- `,vb=Rr.div`
1746
+ `,Tb=Rr.div`
1747
1747
  display: flex;
1748
1748
  align-items: center;
1749
1749
  justify-content: space-between;
@@ -1756,7 +1756,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1756
1756
  border: 1px solid #e2e3f0 !important;
1757
1757
  width: 100%;
1758
1758
  height: 5em;
1759
- `,Cb=Fg`
1759
+ `,Sb=Vg`
1760
1760
  :focus,
1761
1761
  :hover,
1762
1762
  :active {
@@ -1773,15 +1773,15 @@ You will need this password to access your ${e} wallet on a new device. Please k
1773
1773
  svg:hover {
1774
1774
  color: var(--privy-color-foreground-3);
1775
1775
  }
1776
- `,wb=Rr.button`
1777
- ${Cb}
1778
- `;var Gg=Ir.div`
1776
+ `,_b=Rr.button`
1777
+ ${Sb}
1778
+ `;var $g=Ir.div`
1779
1779
  display: flex;
1780
1780
  flex-direction: column;
1781
1781
  gap: 12px;
1782
1782
  padding-top: 24px;
1783
1783
  padding-bottom: 24px;
1784
- `,oc=Ir.div`
1784
+ `,ic=Ir.div`
1785
1785
  width: 24px;
1786
1786
  height: 24px;
1787
1787
  display: flex;
@@ -1791,19 +1791,19 @@ You will need this password to access your ${e} wallet on a new device. Please k
1791
1791
  svg {
1792
1792
  border-radius: var(--privy-border-radius-sm);
1793
1793
  }
1794
- `,nc=Ir.div`
1794
+ `,ac=Ir.div`
1795
1795
  display: flex;
1796
1796
  flex-direction: column;
1797
1797
  justify-content: center;
1798
1798
  align-items: center;
1799
1799
  gap: 8px;
1800
- `,ic=Ir.div`
1800
+ `,sc=Ir.div`
1801
1801
  display: flex;
1802
1802
  align-items: baseline;
1803
1803
  gap: 4px;
1804
- `,Vg=Ir.div`
1804
+ `,Kg=Ir.div`
1805
1805
  font-size: 42px !important;
1806
- `,qg=Ir.input`
1806
+ `,jg=Ir.input`
1807
1807
  font-size: 42px !important;
1808
1808
  text-align: right;
1809
1809
  background-color: var(--privy-color-background);
@@ -1818,17 +1818,17 @@ You will need this password to access your ${e} wallet on a new device. Please k
1818
1818
  border: none !important;
1819
1819
  box-shadow: none !important;
1820
1820
  }
1821
- `,zg=Ir.div`
1821
+ `,Yg=Ir.div`
1822
1822
  cursor: pointer;
1823
1823
  padding-left: 4px;
1824
- `,ac=Ir.div`
1824
+ `,lc=Ir.div`
1825
1825
  font-size: 18px;
1826
- `,sc=Ir.div`
1826
+ `,cc=Ir.div`
1827
1827
  font-size: 12px;
1828
1828
  color: var(--privy-color-foreground-3);
1829
1829
  // we need this container to maintain a static height if there's no content
1830
1830
  height: 20px;
1831
- `,$g=Ir.div`
1831
+ `,Zg=Ir.div`
1832
1832
  display: flex;
1833
1833
  flex-direction: row;
1834
1834
  line-height: 22px;
@@ -1838,34 +1838,34 @@ You will need this password to access your ${e} wallet on a new device. Please k
1838
1838
  margin-right: 6px;
1839
1839
  margin: auto;
1840
1840
  }
1841
- `,Kg=Ir(Sp)`
1841
+ `,Qg=Ir(Pp)`
1842
1842
  margin-top: 16px;
1843
- `,Eb=bb`
1843
+ `,Ab=Pb`
1844
1844
  from {
1845
1845
  opacity: 0;
1846
1846
  }
1847
1847
  to {
1848
1848
  opacity: 1;
1849
1849
  }
1850
- `,jg=Ir(Ho)`
1850
+ `,Jg=Ir(Go)`
1851
1851
  border-radius: var(--privy-border-radius-md) !important;
1852
- animation: ${Eb} 0.3s ease-in-out;
1853
- `;import{Fragment as xb,jsx as At,jsxs as en}from"react/jsx-runtime";var Zg=()=>{let{wallets:e}=zr(),{app:t,navigate:r,data:o,setModalData:n}=P(),i=o?.funding,a=Pb(null),[l,s]=Ab(!1);_b(()=>{a.current&&a.current.style.setProperty("--funding-input-length",Math.max(i.amount.length,1).toString())},[i.amount]);let c=t.fundingConfig?.methods.slice()??[],{tokenPrice:m}=uo({chainId:i.chain.id}),f=m?Jl(i.amount,m):void 0,u=e.find(b=>Yg(b.address)===Yg(i.address)),C=u&&u.walletClientType!=="privy"?qo(u.walletClientType,u.connectorType,u.walletClientType):t.name,g=parseFloat(i.amount),y=!isNaN(g)&&g>0;return en(xb,{children:[At(dr,{}),en("h3",{children:["Add funds to your"," ",C?.toLowerCase().endsWith("wallet")?C:C+" wallet"]}),At(Vo,{style:{marginTop:"32px"},children:en(nc,{children:[en(ic,{onClick:()=>a.current?.focus(),children:[At(qg,{ref:a,value:i.amount,onFocus:()=>s(!0),onBlur:()=>s(!1),onChange:b=>{let E=b.target.value;/^[0-9.]*$/.test(E)&&E.split(".").length-1<=1&&n({...o,funding:{...i,amount:E}})}}),At(ac,{children:i.chain.nativeCurrency.symbol}),!l&&At(zg,{children:At(Tb,{width:12,height:12})})]}),At(sc,{children:f&&y?f:""})]})}),en(Gg,{children:[i.errorMessage&&At(Og,{children:i.errorMessage}),c.sort().map(b=>{switch(b){case"moonpay":return en(Ee,{disabled:!y,onClick:()=>{r("MOONPAY_PROMPT_SCREEN")},children:[At(oc,{children:At(Gi,{style:{width:24}})}),"Moonpay"]},b);case"coinbase-onramp":return Pg(Number(i.chain.id))?en(Ee,{disabled:!y,onClick:()=>{r("COINBASE_ONRAMP_STATUS_SCREEN")},children:[At(oc,{children:At(So,{style:{width:24}})}),"Coinbase Onramp"]},b):null;case"external":return en(Ee,{disabled:!y,onClick:()=>{r("FUNDING_TRANSFER_FROM_WALLET_SCREEN")},children:[At(oc,{children:At(Sb,{style:{width:24}})}),"Transfer from wallet"]},b)}}),At(Kg,{disabled:!y,onClick:()=>r("FUNDING_MANUAL_TRANSFER_SCREEN"),children:"Send funds manually"})]}),At($,{})]})};import{formatUnits as Fb}from"@ethersproject/units";import{DocumentDuplicateIcon as Bb,InformationCircleIcon as Hb,QrCodeIcon as Gb}from"@heroicons/react/24/outline";import{useEffect as Vb,useMemo as qb,useState as Pp}from"react";import Vi from"styled-components";import Nb from"styled-components";import kb from"styled-components";var Qg=kb.div`
1852
+ animation: ${Ab} 0.3s ease-in-out;
1853
+ `;import{Fragment as Wb,jsx as At,jsxs as tn}from"react/jsx-runtime";var e1=()=>{let{wallets:e}=zr(),{app:t,navigate:r,data:o,setModalData:n}=_(),i=o?.funding,a=Ib(null),[l,s]=Mb(!1);Rb(()=>{a.current&&a.current.style.setProperty("--funding-input-length",Math.max(i.amount.length,1).toString())},[i.amount]);let c=t.fundingConfig?.methods.slice()??[],{tokenPrice:m}=uo({chainId:i.chain.id}),f=m?ec(i.amount,m):void 0,u=e.find(b=>Xg(b.address)===Xg(i.address)),C=u&&u.walletClientType!=="privy"?zo(u.walletClientType,u.connectorType,u.walletClientType):t.name,g=parseFloat(i.amount),y=!isNaN(g)&&g>0;return tn(Wb,{children:[At(pr,{}),tn("h3",{children:["Add funds to your"," ",C?.toLowerCase().endsWith("wallet")?C:C+" wallet"]}),At(qo,{style:{marginTop:"32px"},children:tn(ac,{children:[tn(sc,{onClick:()=>a.current?.focus(),children:[At(jg,{ref:a,value:i.amount,onFocus:()=>s(!0),onBlur:()=>s(!1),onChange:b=>{let T=b.target.value;/^[0-9.]*$/.test(T)&&T.split(".").length-1<=1&&n({...o,funding:{...i,amount:T}})}}),At(lc,{children:i.chain.nativeCurrency.symbol}),!l&&At(Yg,{children:At(xb,{width:12,height:12})})]}),At(cc,{children:f&&y?f:""})]})}),tn($g,{children:[i.errorMessage&&At(Ug,{children:i.errorMessage}),c.sort().map(b=>{switch(b){case"moonpay":return tn(Ee,{disabled:!y,onClick:()=>{r("MOONPAY_PROMPT_SCREEN")},children:[At(ic,{children:At(qi,{style:{width:24}})}),"Moonpay"]},b);case"coinbase-onramp":return Rg(Number(i.chain.id))?tn(Ee,{disabled:!y,onClick:()=>{r("COINBASE_ONRAMP_STATUS_SCREEN")},children:[At(ic,{children:At(So,{style:{width:24}})}),"Coinbase Onramp"]},b):null;case"external":return tn(Ee,{disabled:!y,onClick:()=>{r("FUNDING_TRANSFER_FROM_WALLET_SCREEN")},children:[At(ic,{children:At(kb,{style:{width:24}})}),"Transfer from wallet"]},b)}}),At(Qg,{disabled:!y,onClick:()=>r("FUNDING_MANUAL_TRANSFER_SCREEN"),children:"Send funds manually"})]}),At(z,{})]})};import{formatUnits as qb}from"@ethersproject/units";import{DocumentDuplicateIcon as zb,InformationCircleIcon as $b,QrCodeIcon as Kb}from"@heroicons/react/24/outline";import{useEffect as jb,useMemo as Yb,useState as xp}from"react";import zi from"styled-components";import Hb from"styled-components";import Ob from"styled-components";var t1=Ob.div`
1854
1854
  display: flex;
1855
1855
  flex-direction: column;
1856
- `;import Rb from"styled-components";var Fa=Rb.span`
1856
+ `;import Lb from"styled-components";var Ba=Lb.span`
1857
1857
  text-align: left;
1858
1858
  font-size: 0.75rem;
1859
1859
  font-weight: 500;
1860
1860
  line-height: 1.125rem; /* 150% */
1861
1861
 
1862
1862
  color: var(--privy-color-error);
1863
- `;import Ib from"styled-components";var Jg=Ib.span`
1863
+ `;import Nb from"styled-components";var r1=Nb.span`
1864
1864
  color: var(--privy-color-foreground-3);
1865
1865
  font-size: 0.75rem;
1866
1866
  font-weight: 500;
1867
1867
  line-height: 1.125rem; /* 150% */
1868
- `;import Mb from"@heroicons/react/24/outline/Square2StackIcon";import Wb from"styled-components";import{jsx as Xg,jsxs as Lb}from"react/jsx-runtime";var Ba=({address:e,showCopyIcon:t,url:r,className:o})=>r?Xg("a",{title:e,className:o,href:`${r}/address/${e}`,target:"_blank",children:dt(e)}):Lb("button",{title:e,className:o,onClick:()=>navigator.clipboard.writeText(e).catch(console.error),children:[dt(e),t&&Xg(Ob,{})]}),Ob=Wb(Mb)`
1868
+ `;import Db from"@heroicons/react/24/outline/Square2StackIcon";import Ub from"styled-components";import{jsx as o1,jsxs as Bb}from"react/jsx-runtime";var Ha=({address:e,showCopyIcon:t,url:r,className:o})=>r?o1("a",{title:e,className:o,href:`${r}/address/${e}`,target:"_blank",children:dt(e)}):Bb("button",{title:e,className:o,onClick:()=>navigator.clipboard.writeText(e).catch(console.error),children:[dt(e),t&&o1(Fb,{})]}),Fb=Ub(Db)`
1869
1869
  && {
1870
1870
  display: inline;
1871
1871
  }
@@ -1874,7 +1874,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1874
1874
  width: 0.875rem;
1875
1875
  margin-left: 0.125rem;
1876
1876
  color: var(--privy-color-foreground-3);
1877
- `;import{Fragment as Ub,jsx as lc,jsxs as _p}from"react/jsx-runtime";var cc=({errMsg:e,balance:t,address:r,isLoading:o,className:n,title:i,isPulsing:a,statusColor:l="green"})=>{let s;return l?s=l:e?s="red":s="green",_p(Ub,{children:[_p(Db,{className:n,$state:e?"error":void 0,children:[_p(Qg,{children:[lc(Jg,{children:i||"Pay with"}),lc(Ba,{address:r,showCopyIcon:!!e})]}),lc(Xt,{isLoading:o,isPulsing:a,color:s,children:t})]}),e&&lc(Fa,{style:{marginTop:"0.25rem"},children:e})]})},Db=Nb.div`
1877
+ `;import{Fragment as Vb,jsx as dc,jsxs as Ap}from"react/jsx-runtime";var pc=({errMsg:e,balance:t,address:r,isLoading:o,className:n,title:i,isPulsing:a,statusColor:l="green"})=>{let s;return l?s=l:e?s="red":s="green",Ap(Vb,{children:[Ap(Gb,{className:n,$state:e?"error":void 0,children:[Ap(t1,{children:[dc(r1,{children:i||"Pay with"}),dc(Ha,{address:r,showCopyIcon:!!e})]}),dc(er,{isLoading:o,isPulsing:a,color:s,children:t})]}),e&&dc(Ba,{style:{marginTop:"0.25rem"},children:e})]})},Gb=Hb.div`
1878
1878
  && {
1879
1879
  border-width: 1px;
1880
1880
  }
@@ -1888,11 +1888,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
1888
1888
  align-items: center;
1889
1889
 
1890
1890
  ${e=>e.$state==="error"?"border-color: var(--privy-color-error);":""}
1891
- `;import{Fragment as dc,jsx as ze,jsxs as xt}from"react/jsx-runtime";var zb=2e3,e1=()=>{let{wallets:e}=zr(),{app:t,data:r,setModalData:o,navigate:n,lastScreen:i}=P(),{chains:a,rpcConfig:l,appId:s,closePrivyModal:c}=M(),[m,f]=Pp("default"),[u,C]=Pp(void 0),g=r?.funding,{tokenPrice:y}=uo({chainId:g.chain.id}),b=y?Jl(g.amount,y):void 0,E=e.find(R=>dt(R.address)===dt(g.address)),k=E&&E.walletClientType!=="privy"?qo(E.walletClientType,E.connectorType,E.walletClientType):t.name;if(!g)return o({errorModalData:{error:new Error("Couldn't find funding config"),previousScreen:i||"FUNDING_METHOD_SELECTION_SCREEN"},funding:r?.funding,sendTransaction:r?.sendTransaction}),n("ERROR_SCREEN"),ze(dc,{});Vb(()=>{let R=Gt(g.chain.id,a,l,{appId:s});function I(){R.getBalance(g.address).then(H=>C(parseFloat(Fb(H,"ether")))).catch(()=>C(void 0))}let D=setInterval(I,zb);return I(),()=>clearInterval(D)},[]);let T=qb(()=>u!==void 0?u>=parseFloat(g.amount):!1,[u,g.amount]),A=xt(dc,{children:[ze(cc,{title:"Your wallet",errMsg:void 0,isLoading:!g||u===void 0,isPulsing:!T,balance:`${u!==void 0?u.toPrecision(2):""} ETH`,address:g.address,statusColor:T?"green":"gray"}),T&&ze(jg,{onClick:()=>c(),children:"Close"})]});return m==="qr-code"?xt(dc,{children:[ze(x,{backFn:()=>f("default")}),xt(Vo,{style:{gap:"24px",marginBottom:"24px"},children:[xt("div",{children:[ze(de,{children:"Scan QR code"}),xt(ue,{children:["Scan this code using your mobile wallet to send funds to your ",k," ","wallet."]})]}),ze(Xo,{url:g.address,size:200,squareLogoElement:$b}),A]}),ze($,{})]}):xt(dc,{children:[ze(dr,{}),ze(ge,{title:"Send funds",description:"Send funds directly to your wallet by copying your wallet address or scanning a QR code."}),xt(Vo,{style:{gap:"16px"},children:[xt(Yb,{children:[ze(Hb,{height:"20px",width:"20px",color:"var(--privy-color-accent-light)"}),xt(Zb,{children:["Make sure to send on ",g.chain.name,"."]})]}),xt(Qb,{children:[ze(bi,{height:16}),xt(nc,{children:[xt(ic,{children:[ze(Vg,{children:g.amount}),ze(ac,{children:g.chain.nativeCurrency.symbol})]}),ze(sc,{children:b?`${b} USD`:"..."}),xt($g,{children:[_l(g.chain.id),g.chain.name]})]}),ze(bi,{height:8}),xt(jb,{children:[ze(Kb,{text:g.address}),ze(r1,{onClick:()=>f("qr-code"),children:xt(t1,{children:[ze(Gb,{height:"16px",width:"16px"}),"Scan code"]})})]})]}),A]}),ze(bi,{height:16}),ze($,{})]})},$b=({...e})=>ze(Fo,{color:"black",...e}),Kb=e=>{let[t,r]=Pp(!1);return ze(r1,{onClick:()=>{r(!0),navigator.clipboard.writeText(e.text),setTimeout(()=>r(!1),1500)},children:xt(t1,{children:[t?ze(Ui,{style:{height:"16px",width:"16px"},strokeWidth:"2"}):ze(Bb,{style:{height:"16px",width:"16px"}}),t?"Copied":"Copy address"]})})},jb=Vi.div`
1891
+ `;import{Fragment as uc,jsx as ze,jsxs as xt}from"react/jsx-runtime";var Zb=2e3,n1=()=>{let{wallets:e}=zr(),{app:t,data:r,setModalData:o,navigate:n,lastScreen:i}=_(),{chains:a,rpcConfig:l,appId:s,closePrivyModal:c}=M(),[m,f]=xp("default"),[u,C]=xp(void 0),g=r?.funding,{tokenPrice:y}=uo({chainId:g.chain.id}),b=y?ec(g.amount,y):void 0,T=e.find(R=>dt(R.address)===dt(g.address)),k=T&&T.walletClientType!=="privy"?zo(T.walletClientType,T.connectorType,T.walletClientType):t.name;if(!g)return o({errorModalData:{error:new Error("Couldn't find funding config"),previousScreen:i||"FUNDING_METHOD_SELECTION_SCREEN"},funding:r?.funding,sendTransaction:r?.sendTransaction}),n("ERROR_SCREEN"),ze(uc,{});jb(()=>{let R=Gt(g.chain.id,a,l,{appId:s});function I(){R.getBalance(g.address).then(H=>C(parseFloat(qb(H,"ether")))).catch(()=>C(void 0))}let D=setInterval(I,Zb);return I(),()=>clearInterval(D)},[]);let S=Yb(()=>u!==void 0?u>=parseFloat(g.amount):!1,[u,g.amount]),x=xt(uc,{children:[ze(pc,{title:"Your wallet",errMsg:void 0,isLoading:!g||u===void 0,isPulsing:!S,balance:`${u!==void 0?u.toPrecision(2):""} ETH`,address:g.address,statusColor:S?"green":"gray"}),S&&ze(Jg,{onClick:()=>c(),children:"Close"})]});return m==="qr-code"?xt(uc,{children:[ze(A,{backFn:()=>f("default")}),xt(qo,{style:{gap:"24px",marginBottom:"24px"},children:[xt("div",{children:[ze(de,{children:"Scan QR code"}),xt(ue,{children:["Scan this code using your mobile wallet to send funds to your ",k," ","wallet."]})]}),ze(en,{url:g.address,size:200,squareLogoElement:Qb}),x]}),ze(z,{})]}):xt(uc,{children:[ze(pr,{}),ze(he,{title:"Send funds",description:"Send funds directly to your wallet by copying your wallet address or scanning a QR code."}),xt(qo,{style:{gap:"16px"},children:[xt(eE,{children:[ze($b,{height:"20px",width:"20px",color:"var(--privy-color-accent-light)"}),xt(tE,{children:["Make sure to send on ",g.chain.name,"."]})]}),xt(rE,{children:[ze(Ti,{height:16}),xt(ac,{children:[xt(sc,{children:[ze(Kg,{children:g.amount}),ze(lc,{children:g.chain.nativeCurrency.symbol})]}),ze(cc,{children:b?`${b} USD`:"..."}),xt(Zg,{children:[Al(g.chain.id),g.chain.name]})]}),ze(Ti,{height:8}),xt(Xb,{children:[ze(Jb,{text:g.address}),ze(a1,{onClick:()=>f("qr-code"),children:xt(i1,{children:[ze(Kb,{height:"16px",width:"16px"}),"Scan code"]})})]})]}),x]}),ze(Ti,{height:16}),ze(z,{})]})},Qb=({...e})=>ze(Bo,{color:"black",...e}),Jb=e=>{let[t,r]=xp(!1);return ze(a1,{onClick:()=>{r(!0),navigator.clipboard.writeText(e.text),setTimeout(()=>r(!1),1500)},children:xt(i1,{children:[t?ze(Bi,{style:{height:"16px",width:"16px"},strokeWidth:"2"}):ze(zb,{style:{height:"16px",width:"16px"}}),t?"Copied":"Copy address"]})})},Xb=zi.div`
1892
1892
  display: flex;
1893
1893
  flex-direction: row;
1894
1894
  gap: 8px;
1895
- `,Yb=Vi.div`
1895
+ `,eE=zi.div`
1896
1896
  display: flex;
1897
1897
  flex-direction: row;
1898
1898
  padding: 8px;
@@ -1901,11 +1901,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
1901
1901
  svg {
1902
1902
  margin-right: 12px;
1903
1903
  }
1904
- `,Zb=Vi.div`
1904
+ `,tE=zi.div`
1905
1905
  line-height: 20px;
1906
1906
  font-size: 18px
1907
1907
  text-align: center;
1908
- `,Qb=Vi.div`
1908
+ `,rE=zi.div`
1909
1909
  display: flex;
1910
1910
  flex-direction: column;
1911
1911
  background-color: var(--privy-color-background-2);
@@ -1915,11 +1915,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
1915
1915
  }
1916
1916
  padding: 16px;
1917
1917
  gap: 8px;
1918
- `,t1=Vi.span`
1918
+ `,i1=zi.span`
1919
1919
  display: flex;
1920
1920
  align-items: center;
1921
1921
  margin: auto;
1922
- `,r1=Vi.button`
1922
+ `,a1=zi.button`
1923
1923
  display: flex;
1924
1924
  align-items: center;
1925
1925
  width: 100%;
@@ -1956,7 +1956,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1956
1956
  width: 18px;
1957
1957
  height: 18px;
1958
1958
  }
1959
- `;import{useEffect as yE,useState as gE}from"react";import Jb from"@heroicons/react/24/outline/ClockIcon";import Xb from"@heroicons/react/24/outline/EyeSlashIcon";import eE from"@heroicons/react/24/outline/LinkIcon";import ho from"styled-components";import{Fragment as o1,jsx as Dt,jsxs as Gn}from"react/jsx-runtime";var Ap=({title:e,desc:t,icon:r})=>Gn(aE,{children:[Dt(lE,{children:r}),Gn(sE,{children:[Dt(nE,{children:e}),Dt(iE,{children:t})]})]}),n1=({app:e,signedUrl:t,onContinue:r})=>Gn(o1,{children:[Gn(rE,{children:[Dt(Gi,{size:"3.75rem"}),Gn(oE,{children:[e?.name," uses ",Dt("span",{style:{fontWeight:"bold"},children:"Moonpay"})," to fund your account"]}),Gn(cE,{children:[Dt(Ap,{icon:Dt(eE,{width:"1rem"}),title:"Purchase assets to fund your account",desc:Gn(o1,{children:["Connect a payment method (",Dt("strong",{children:"debit card recommended"}),") to purchase digital assets."]})}),Dt(Ap,{icon:Dt(Jb,{width:"1rem"}),title:"Compliance takes time",desc:"Funding a new account may take a few hours. You'll be good to go thereafter."}),Dt(Ap,{icon:Dt(Xb,{width:"1rem"}),title:"Your data belongs to you",desc:"MoonPay does not sell your data and will only use it with your permission."})]}),Dt(dE,{className:"mobile-only"})]}),Dt(tE,{children:"By clicking continue, you will be taken to MoonPay in a new tab."}),Dt(cl,{disabled:!t,href:t??"#",target:"_blank",rel:"noopener noreferrer",onClick:r,children:"Continue to Moonpay"})]}),tE=ho.span`
1959
+ `;import{useEffect as bE,useState as EE}from"react";import oE from"@heroicons/react/24/outline/ClockIcon";import nE from"@heroicons/react/24/outline/EyeSlashIcon";import iE from"@heroicons/react/24/outline/LinkIcon";import ho from"styled-components";import{Fragment as s1,jsx as Dt,jsxs as qn}from"react/jsx-runtime";var kp=({title:e,desc:t,icon:r})=>qn(pE,{children:[Dt(mE,{children:r}),qn(uE,{children:[Dt(cE,{children:e}),Dt(dE,{children:t})]})]}),l1=({app:e,signedUrl:t,onContinue:r})=>qn(s1,{children:[qn(sE,{children:[Dt(qi,{size:"3.75rem"}),qn(lE,{children:[e?.name," uses ",Dt("span",{style:{fontWeight:"bold"},children:"Moonpay"})," to fund your account"]}),qn(fE,{children:[Dt(kp,{icon:Dt(iE,{width:"1rem"}),title:"Purchase assets to fund your account",desc:qn(s1,{children:["Connect a payment method (",Dt("strong",{children:"debit card recommended"}),") to purchase digital assets."]})}),Dt(kp,{icon:Dt(oE,{width:"1rem"}),title:"Compliance takes time",desc:"Funding a new account may take a few hours. You'll be good to go thereafter."}),Dt(kp,{icon:Dt(nE,{width:"1rem"}),title:"Your data belongs to you",desc:"MoonPay does not sell your data and will only use it with your permission."})]}),Dt(hE,{className:"mobile-only"})]}),Dt(aE,{children:"By clicking continue, you will be taken to MoonPay in a new tab."}),Dt(pl,{disabled:!t,href:t??"#",target:"_blank",rel:"noopener noreferrer",onClick:r,children:"Continue to Moonpay"})]}),aE=ho.span`
1960
1960
  display: inline-block;
1961
1961
  color: var(--privy-color-foreground-3);
1962
1962
  text-align: center;
@@ -1965,13 +1965,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
1965
1965
  font-weight: 400;
1966
1966
  line-height: 140%; /* 0.875rem */
1967
1967
  margin-bottom: 0.25rem;
1968
- `,rE=ho.div`
1968
+ `,sE=ho.div`
1969
1969
  display: flex;
1970
1970
  flex-direction: column;
1971
1971
  align-items: center;
1972
1972
  justify-content: center;
1973
1973
  padding: 1.5rem 0;
1974
- `,oE=ho.span`
1974
+ `,lE=ho.span`
1975
1975
  color: var(--privy-color-foreground);
1976
1976
  text-align: center;
1977
1977
  font-size: 1.125rem;
@@ -1980,46 +1980,46 @@ You will need this password to access your ${e} wallet on a new device. Please k
1980
1980
  margin: 1.5rem 0;
1981
1981
  text-align: center;
1982
1982
  max-width: 19.5rem;
1983
- `,nE=ho.span`
1983
+ `,cE=ho.span`
1984
1984
  color: var(--privy-color-foreground);
1985
1985
  font-size: 0.875rem;
1986
1986
  font-weight: 500;
1987
1987
  line-height: 1.225rem;
1988
1988
  width: 100%;
1989
- `,iE=ho.span`
1989
+ `,dE=ho.span`
1990
1990
  color: var(--privy-color-foreground-2);
1991
1991
  font-size: 0.875rem;
1992
1992
  font-weight: 400;
1993
1993
  line-height: 1.225rem;
1994
- `,aE=ho.div`
1994
+ `,pE=ho.div`
1995
1995
  display: flex;
1996
1996
  align-items: flex-start;
1997
1997
  gap: 0.5rem;
1998
1998
  align-self: stretch;
1999
- `,sE=ho.div`
1999
+ `,uE=ho.div`
2000
2000
  display: flex;
2001
2001
  flex-direction: column;
2002
2002
  gap: 0.25rem;
2003
2003
  align-items: flex-start;
2004
2004
  text-align: left;
2005
2005
  flex: 1 0 0;
2006
- `,lE=ho.div`
2006
+ `,mE=ho.div`
2007
2007
  padding-top: 2px;
2008
- `,cE=ho.div`
2008
+ `,fE=ho.div`
2009
2009
  display: flex;
2010
2010
  flex-direction: column;
2011
2011
  gap: 1.25rem;
2012
2012
  margin: 0 0.5rem;
2013
- `,dE=ho.div`
2013
+ `,hE=ho.div`
2014
2014
  margin: 30px 0;
2015
- `;import{ofetch as pE}from"ofetch";import{useEffect as uE,useRef as mE,useState as fE}from"react";var pc="moonpay";function i1(e){switch(e){case"eip155:42161":return"ETH_ARBITRUM";case"eip155:43114":return"AVAX_CCHAIN";case"eip155:8453":return"ETH_BASE";case"eip155:42220":return"CELO_CELO";case"eip155:137":return"MATIC_POLYGON";case"eip155:1":return"ETH_ETHEREUM";default:return console.warn(`Chain ${e} not supported by Moonpay, defaulting to Ethereum mainnet`),"ETH_ETHEREUM"}}function a1(e){return parseFloat(e)}function s1(e){return!!e&&e.config!==void 0&&e.provider!==void 0}function uc(e){return!!e&&(e.chain!==void 0||e.amount!==void 0)}async function l1(e,t,r,o,n=!1){let i=r.currencyCode?{}:{defaultCurrencyCode:"ETH_ETHEREUM"},a=r.uiConfig||{accentColor:o.accent,theme:o.colorScheme};return e.signMoonpayOnRampUrl({address:t,useSandbox:n,config:{...r,...i,...a}})}async function hE(e,t){let r=t?Pm:_m,o=t?xm:Am;return pE(`${r}/transactions/ext/${e}`,{query:{apiKey:o}})}function c1(e,t=!1){let[r,o]=fE(null),{createAnalyticsEvent:n}=M(),{data:i,navigate:a,setModalData:l}=P(),s=i?.funding,c=mE(0);return uE(()=>{let m=setInterval(async()=>{if(e)try{let[f]=await hE(e,t),u=f.status==="waitingAuthorization"&&f.paymentMethod==="credit_debit_card"?"pending":f.status;if(["failed","completed","awaitingAuthorization"].includes(u)&&(n({eventName:Hi,payload:{status:u,provider:pc,paymentMethod:f.paymentMethod,cardPaymentType:f.cardPaymentType,currency:f.currency?.code,baseCurrencyAmount:f.baseCurrencyAmount,quoteCurrencyAmount:f.quoteCurrencyAmount,feeAmount:f.feeAmount,extraFeeAmount:f.extraFeeAmount,networkFeeAmount:f.networkFeeAmount}}),clearInterval(m)),u==="failed"||u==="serviceFailure"){l({funding:{...s,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."}}),a("FUNDING_METHOD_SELECTION_SCREEN");return}o(u)}catch(f){f.response?.status!==404&&(c.current+=1),c.current>=3&&(n({eventName:Hi,payload:{status:"serviceFailure",provider:pc}}),clearInterval(m),l({funding:{...s,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."}}),a("FUNDING_METHOD_SELECTION_SCREEN"))}},3e3);return()=>clearInterval(m)},[e,c]),r}import{Fragment as vE,jsx as xp,jsxs as CE}from"react/jsx-runtime";var d1=()=>{let{app:e,data:t,navigate:r,setModalData:o}=P(),{createAnalyticsEvent:n,getMoonpaySignedUrl:i}=M(),[a,l]=gE(null),s=t?.funding;return yE(()=>{if(a||!s)return;async function c(){if(!e.fundingConfig)return;let{signedUrl:m,externalTransactionId:f}=await i(s.address,{...e.fundingMethodConfig.moonpay,...s.moonpayConfigOverride,currencyCode:s.moonpayConfigOverride?.currencyCode??i1(`eip155:${s.chain.id}`),quoteCurrencyAmount:s.moonpayConfigOverride?.quoteCurrencyAmount??a1(s.amount)});l(m),o({moonpayStatus:{externalTransactionId:f},funding:t?.funding})}c()},[a,s]),CE(vE,{children:[xp(dr,{}),xp(n1,{app:e,signedUrl:a,onContinue:()=>{n({eventName:"sdk_fiat_on_ramp_started",payload:{provider:pc}}),r("MOONPAY_STATUS_SCREEN")}}),xp($,{})]})};import wE from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import bE from"@heroicons/react/24/solid/CheckCircleIcon";import{useMemo as EE}from"react";import p1 from"styled-components";import{Fragment as m1,jsx as yr,jsxs as Ha}from"react/jsx-runtime";var u1=()=>{let{app:e,data:t}=P(),{closePrivyModal:r}=M(),{externalTransactionId:o}=t?.moonpayStatus,n=c1(o||null,e.fundingMethodConfig.moonpay.useSandbox??!1);return Ha(m1,{children:[yr(x,{title:"Fund account"},"header"),yr(SE,{status:n,onClickCta:r}),yr($,{})]})},TE=e=>{switch(e){case"completed":return{title:"You've funded your account!",body:"It may take a few minutes for the assets to appear.",cta:"Continue"};case"waitingAuthorization":return{title:"Processing payment",body:"This may take up to a few hours. You will receive an email when the purchase is complete.",cta:"Continue"};default:return{title:"In Progress",body:"Go back to MoonPay to finish funding your account.",cta:""}}},SE=({status:e,onClickCta:t})=>{let{title:r,body:o,cta:n}=EE(()=>TE(e),[e]);return Ha(m1,{children:[Ha(kE,{children:[yr(AE,{status:e}),Ha(qe,{children:[yr("h3",{children:r}),yr(xE,{children:o})]})]}),n&&yr(B,{onClick:t,children:n})]})},_E=e=>e?{completed:"var(--privy-color-success)",failed:"var(--privy-color-error)",serviceFailure:"var(--privy-color-error)",waitingAuthorization:"var(--privy-color-accent)",pending:"var(--privy-color-foreground-4)"}[e]:"var(--privy-color-foreground-4)",PE=e=>{switch(e){case"completed":return bE;case"waitingAuthorization":return()=>yr(wE,{width:"3rem",height:"3rem",style:{backgroundColor:"var(--privy-color-foreground-4)",color:"var(--privy-color-background)",borderRadius:"100%",padding:"0.5rem",margin:"0.5rem"}});default:return}},AE=({status:e})=>{if(!e||e==="pending"){let o="var(--privy-color-foreground-4)";return Ha("div",{style:{position:"relative"},children:[yr(nt,{color:o,style:{position:"absolute"}}),yr(ga,{color:o}),yr(Gi,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=PE(e),r=_E(e);return yr("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&yr(t,{width:"4rem",height:"4rem",color:r})})},xE=p1.p`
2015
+ `;import{ofetch as yE}from"ofetch";import{useEffect as gE,useRef as vE,useState as CE}from"react";var mc="moonpay";function c1(e){switch(e){case"eip155:42161":return"ETH_ARBITRUM";case"eip155:43114":return"AVAX_CCHAIN";case"eip155:8453":return"ETH_BASE";case"eip155:42220":return"CELO_CELO";case"eip155:137":return"MATIC_POLYGON";case"eip155:1":return"ETH_ETHEREUM";default:return console.warn(`Chain ${e} not supported by Moonpay, defaulting to Ethereum mainnet`),"ETH_ETHEREUM"}}function d1(e){return parseFloat(e)}function p1(e){return!!e&&e.config!==void 0&&e.provider!==void 0}function fc(e){return!!e&&(e.chain!==void 0||e.amount!==void 0)}async function u1(e,t,r,o,n=!1){let i=r.currencyCode?{}:{defaultCurrencyCode:"ETH_ETHEREUM"},a=r.uiConfig||{accentColor:o.accent,theme:o.colorScheme};return e.signMoonpayOnRampUrl({address:t,useSandbox:n,config:{...r,...i,...a}})}async function wE(e,t){let r=t?km:xm,o=t?Im:Rm;return yE(`${r}/transactions/ext/${e}`,{query:{apiKey:o}})}function m1(e,t=!1){let[r,o]=CE(null),{createAnalyticsEvent:n}=M(),{data:i,navigate:a,setModalData:l}=_(),s=i?.funding,c=vE(0);return gE(()=>{let m=setInterval(async()=>{if(e)try{let[f]=await wE(e,t),u=f.status==="waitingAuthorization"&&f.paymentMethod==="credit_debit_card"?"pending":f.status;if(["failed","completed","awaitingAuthorization"].includes(u)&&(n({eventName:Vi,payload:{status:u,provider:mc,paymentMethod:f.paymentMethod,cardPaymentType:f.cardPaymentType,currency:f.currency?.code,baseCurrencyAmount:f.baseCurrencyAmount,quoteCurrencyAmount:f.quoteCurrencyAmount,feeAmount:f.feeAmount,extraFeeAmount:f.extraFeeAmount,networkFeeAmount:f.networkFeeAmount}}),clearInterval(m)),u==="failed"||u==="serviceFailure"){l({funding:{...s,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."}}),a("FUNDING_METHOD_SELECTION_SCREEN");return}o(u)}catch(f){f.response?.status!==404&&(c.current+=1),c.current>=3&&(n({eventName:Vi,payload:{status:"serviceFailure",provider:mc}}),clearInterval(m),l({funding:{...s,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."}}),a("FUNDING_METHOD_SELECTION_SCREEN"))}},3e3);return()=>clearInterval(m)},[e,c]),r}import{Fragment as TE,jsx as Rp,jsxs as SE}from"react/jsx-runtime";var f1=()=>{let{app:e,data:t,navigate:r,setModalData:o}=_(),{createAnalyticsEvent:n,getMoonpaySignedUrl:i}=M(),[a,l]=EE(null),s=t?.funding;return bE(()=>{if(a||!s)return;async function c(){if(!e.fundingConfig)return;let{signedUrl:m,externalTransactionId:f}=await i(s.address,{...e.fundingMethodConfig.moonpay,...s.moonpayConfigOverride,currencyCode:s.moonpayConfigOverride?.currencyCode??c1(`eip155:${s.chain.id}`),quoteCurrencyAmount:s.moonpayConfigOverride?.quoteCurrencyAmount??d1(s.amount)});l(m),o({moonpayStatus:{externalTransactionId:f},funding:t?.funding})}c()},[a,s]),SE(TE,{children:[Rp(pr,{}),Rp(l1,{app:e,signedUrl:a,onContinue:()=>{n({eventName:"sdk_fiat_on_ramp_started",payload:{provider:mc}}),r("MOONPAY_STATUS_SCREEN")}}),Rp(z,{})]})};import _E from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import PE from"@heroicons/react/24/solid/CheckCircleIcon";import{useMemo as AE}from"react";import h1 from"styled-components";import{Fragment as g1,jsx as gr,jsxs as Ga}from"react/jsx-runtime";var y1=()=>{let{app:e,data:t}=_(),{closePrivyModal:r}=M(),{externalTransactionId:o}=t?.moonpayStatus,n=m1(o||null,e.fundingMethodConfig.moonpay.useSandbox??!1);return Ga(g1,{children:[gr(A,{title:"Fund account"},"header"),gr(kE,{status:n,onClickCta:r}),gr(z,{})]})},xE=e=>{switch(e){case"completed":return{title:"You've funded your account!",body:"It may take a few minutes for the assets to appear.",cta:"Continue"};case"waitingAuthorization":return{title:"Processing payment",body:"This may take up to a few hours. You will receive an email when the purchase is complete.",cta:"Continue"};default:return{title:"In Progress",body:"Go back to MoonPay to finish funding your account.",cta:""}}},kE=({status:e,onClickCta:t})=>{let{title:r,body:o,cta:n}=AE(()=>xE(e),[e]);return Ga(g1,{children:[Ga(OE,{children:[gr(ME,{status:e}),Ga(qe,{children:[gr("h3",{children:r}),gr(WE,{children:o})]})]}),n&&gr(B,{onClick:t,children:n})]})},RE=e=>e?{completed:"var(--privy-color-success)",failed:"var(--privy-color-error)",serviceFailure:"var(--privy-color-error)",waitingAuthorization:"var(--privy-color-accent)",pending:"var(--privy-color-foreground-4)"}[e]:"var(--privy-color-foreground-4)",IE=e=>{switch(e){case"completed":return PE;case"waitingAuthorization":return()=>gr(_E,{width:"3rem",height:"3rem",style:{backgroundColor:"var(--privy-color-foreground-4)",color:"var(--privy-color-background)",borderRadius:"100%",padding:"0.5rem",margin:"0.5rem"}});default:return}},ME=({status:e})=>{if(!e||e==="pending"){let o="var(--privy-color-foreground-4)";return Ga("div",{style:{position:"relative"},children:[gr(it,{color:o,style:{position:"absolute"}}),gr(va,{color:o}),gr(qi,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=IE(e),r=RE(e);return gr("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&gr(t,{width:"4rem",height:"4rem",color:r})})},WE=h1.p`
2016
2016
  font-size: 1rem;
2017
2017
  color: var(--privy-color-foreground-3);
2018
2018
  margin-bottom: 1rem;
2019
2019
  display: flex;
2020
2020
  flex-direction: column;
2021
2021
  gap: 1rem;
2022
- `,kE=p1.div`
2022
+ `,OE=h1.div`
2023
2023
  display: flex;
2024
2024
  flex-direction: column;
2025
2025
  align-items: center;
@@ -2027,7 +2027,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2027
2027
  margin-left: 1.75rem;
2028
2028
  margin-right: 1.75rem;
2029
2029
  padding: 2rem 0;
2030
- `;import{useEffect as UE,useState as FE}from"react";import RE from"styled-components";var qi=RE.span`
2030
+ `;import{useEffect as VE,useState as qE}from"react";import LE from"styled-components";var $i=LE.span`
2031
2031
  margin-top: 4px;
2032
2032
  color: var(--privy-color-foreground);
2033
2033
  text-align: center;
@@ -2035,7 +2035,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2035
2035
  font-size: 0.875rem;
2036
2036
  font-weight: 400;
2037
2037
  line-height: 1.375rem; /* 157.143% */
2038
- `;import IE,{css as ME}from"styled-components";import{jsx as OE}from"react/jsx-runtime";var mc=()=>{let{enabled:e,token:t}=be(),{navigate:r,setModalData:o}=P(),{initLoginWithPasskey:n}=M();return OE(kp,{onClick:async()=>{e&&!t?(o({captchaModalData:{callback:a=>n(a),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSKEY_SYSTEM_DIALOGUE",onErrorNavigateTo:"ERROR_SCREEN"}}),r("CAPTCHA_SCREEN")):(await n(),r("AWAITING_PASSKEY_SYSTEM_DIALOGUE"))},children:"I have a passkey"})},WE=ME`
2038
+ `;import NE,{css as DE}from"styled-components";import{jsx as FE}from"react/jsx-runtime";var hc=()=>{let{enabled:e,token:t}=be(),{navigate:r,setModalData:o}=_(),{initLoginWithPasskey:n}=M();return FE(Ip,{onClick:async()=>{e&&!t?(o({captchaModalData:{callback:a=>n(a),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSKEY_SYSTEM_DIALOGUE",onErrorNavigateTo:"ERROR_SCREEN"}}),r("CAPTCHA_SCREEN")):(await n(),r("AWAITING_PASSKEY_SYSTEM_DIALOGUE"))},children:"I have a passkey"})},UE=DE`
2039
2039
  && {
2040
2040
  width: 100%;
2041
2041
  font-size: 0.875rem;
@@ -2060,9 +2060,9 @@ You will need this password to access your ${e} wallet on a new device. Please k
2060
2060
  box-shadow: none;
2061
2061
  }
2062
2062
  }
2063
- `,kp=IE.button`
2064
- ${WE}
2065
- `;import LE from"@heroicons/react/24/outline/ChevronRightIcon";import NE from"@heroicons/react/24/outline/WalletIcon";import{jsx as Rp,jsxs as DE}from"react/jsx-runtime";var fc=({onClick:e,text:t})=>DE(Ee,{onClick:e,children:[Rp(NE,{}),Rp(oo,{children:t}),Rp(LE,{})]});import{Fragment as f1,jsx as tn,jsxs as hc}from"react/jsx-runtime";var h1=()=>{let{connectors:e}=M(),{app:t,setModalData:r,data:o,navigate:n}=P(),[i,a]=FE("default"),l=zo(t.appearance.walletList,e,!0,t.appearance.walletList,t.externalWallets.walletConnect.enabled),s=tn(fc,{text:"More wallets",onClick:()=>a("overflow")});return UE(()=>{r({...o,externalConnectWallet:{onCompleteNavigateTo:"FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN"}})},[]),i==="overflow"?hc(f1,{children:[tn(x,{backFn:()=>a("default")},"header"),hc(Yt,{children:[tn(qi,{style:{color:"var(--privy-color-foreground-3)",textAlign:"left"},children:"More wallets"}),l]}),tn($,{})]}):hc(f1,{children:[tn(dr,{}),tn(ge,{title:"Transfer from wallet",description:"Connect a wallet to deposit funds or send funds manually to your wallet address."}),hc(Yt,{children:[...l.length>3?l.slice(0,2):l,l.length>3&&s,tn(kp,{onClick:()=>n("FUNDING_MANUAL_TRANSFER_SCREEN"),children:"Send funds manually"})]}),tn($,{})]})};import BE from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import HE from"styled-components";import{Fragment as VE,jsx as rn,jsxs as qE}from"react/jsx-runtime";var y1=()=>{let{closePrivyModal:e}=M();return qE(VE,{children:[rn(x,{},"header"),rn(GE,{children:rn(BE,{style:{width:32,height:32}})}),rn(ao,{title:"Could not log in with provider",description:"It looks like you're using an in-app browser. To log in, please try again using an external browser.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),rn(Pr,{children:rn(B,{onClick:()=>e(),children:"Close"})}),rn(ie,{}),rn($,{})]})},GE=HE.div`
2063
+ `,Ip=NE.button`
2064
+ ${UE}
2065
+ `;import BE from"@heroicons/react/24/outline/ChevronRightIcon";import HE from"@heroicons/react/24/outline/WalletIcon";import{jsx as Mp,jsxs as GE}from"react/jsx-runtime";var yc=({onClick:e,text:t})=>GE(Ee,{onClick:e,children:[Mp(HE,{}),Mp(oo,{children:t}),Mp(BE,{})]});import{Fragment as v1,jsx as rn,jsxs as gc}from"react/jsx-runtime";var C1=()=>{let{connectors:e}=M(),{app:t,setModalData:r,data:o,navigate:n}=_(),[i,a]=qE("default"),l=$o(t.appearance.walletList,e,!0,t.appearance.walletList,t.externalWallets.walletConnect.enabled),s=rn(yc,{text:"More wallets",onClick:()=>a("overflow")});return VE(()=>{r({...o,externalConnectWallet:{onCompleteNavigateTo:"FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN"}})},[]),i==="overflow"?gc(v1,{children:[rn(A,{backFn:()=>a("default")},"header"),gc(Yt,{children:[rn($i,{style:{color:"var(--privy-color-foreground-3)",textAlign:"left"},children:"More wallets"}),l]}),rn(z,{})]}):gc(v1,{children:[rn(pr,{}),rn(he,{title:"Transfer from wallet",description:"Connect a wallet to deposit funds or send funds manually to your wallet address."}),gc(Yt,{children:[...l.length>3?l.slice(0,2):l,l.length>3&&s,rn(Ip,{onClick:()=>n("FUNDING_MANUAL_TRANSFER_SCREEN"),children:"Send funds manually"})]}),rn(z,{})]})};import zE from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import $E from"styled-components";import{Fragment as jE,jsx as on,jsxs as YE}from"react/jsx-runtime";var w1=()=>{let{closePrivyModal:e}=M();return YE(jE,{children:[on(A,{},"header"),on(KE,{children:on(zE,{style:{width:32,height:32}})}),on(ao,{title:"Could not log in with provider",description:"It looks like you're using an in-app browser. To log in, please try again using an external browser.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),on(Xt,{children:on(B,{onClick:()=>e(),children:"Close"})}),on(ie,{}),on(z,{})]})},KE=$E.div`
2066
2066
  border-radius: 50%;
2067
2067
  height: 68px;
2068
2068
  width: 68px;
@@ -2072,18 +2072,18 @@ You will need this password to access your ${e} wallet on a new device. Please k
2072
2072
  background-color: var(--privy-color-accent);
2073
2073
  color: white;
2074
2074
  margin: 0 auto 24px auto;
2075
- `;import*as w1 from"react-device-detect";import jE from"styled-components";import Ip from"styled-components";import{jsx as g1}from"react/jsx-runtime";var v1=({style:e,...t})=>g1("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"17",height:"17",viewBox:"0 0 17 17",style:{height:"1.25rem",width:"1.25rem",...e},...t,children:g1("path",{strokeLinecap:"round",strokeLinejoin:"round",fillRule:"evenodd",clipRule:"evenodd",d:"M16.5 8.67993C16.5 9.82986 15.853 10.8287 14.9032 11.3322C15.2188 12.3599 14.97 13.5237 14.1569 14.3368C13.3437 15.1499 12.18 15.3987 11.1523 15.0831C10.6488 16.0329 9.64993 16.6799 8.5 16.6799C7.35007 16.6799 6.35126 16.0329 5.84771 15.0831C4.82003 15.3987 3.65627 15.1499 2.84314 14.3368C2.03001 13.5237 1.78124 12.3599 2.09681 11.3322C1.14699 10.8287 0.5 9.82986 0.5 8.67993C0.5 7.53 1.14699 6.53119 2.0968 6.02764C1.78125 4.99996 2.03003 3.83621 2.84315 3.02309C3.65627 2.20997 4.82002 1.96119 5.8477 2.27675C6.35125 1.32692 7.35007 0.679932 8.5 0.679932C9.64992 0.679932 10.6487 1.32691 11.1523 2.27672C12.18 1.96115 13.3437 2.20993 14.1569 3.02305C14.97 3.83618 15.2188 4.99996 14.9032 6.02764C15.853 6.53119 16.5 7.53 16.5 8.67993ZM12.2659 6.68856C12.5654 6.40238 12.5761 5.92763 12.29 5.62818C12.0038 5.32873 11.529 5.31797 11.2296 5.60416C9.73022 7.03711 8.40877 8.65489 7.3018 10.4211L5.78033 8.89963C5.48744 8.60673 5.01256 8.60673 4.71967 8.89963C4.42678 9.19252 4.42678 9.66739 4.71967 9.96029L6.92031 12.1609C7.08544 12.3261 7.31807 12.4048 7.54957 12.374C7.78106 12.3432 7.98499 12.2064 8.1012 12.0038C9.23027 10.0356 10.6362 8.24613 12.2659 6.68856Z",fill:"var(--privy-color-accent)"})});import{jsx as $E,jsxs as KE}from"react/jsx-runtime";var C1=Ip.div`
2075
+ `;import*as S1 from"react-device-detect";import XE from"styled-components";import Wp from"styled-components";import{jsx as b1}from"react/jsx-runtime";var E1=({style:e,...t})=>b1("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"17",height:"17",viewBox:"0 0 17 17",style:{height:"1.25rem",width:"1.25rem",...e},...t,children:b1("path",{strokeLinecap:"round",strokeLinejoin:"round",fillRule:"evenodd",clipRule:"evenodd",d:"M16.5 8.67993C16.5 9.82986 15.853 10.8287 14.9032 11.3322C15.2188 12.3599 14.97 13.5237 14.1569 14.3368C13.3437 15.1499 12.18 15.3987 11.1523 15.0831C10.6488 16.0329 9.64993 16.6799 8.5 16.6799C7.35007 16.6799 6.35126 16.0329 5.84771 15.0831C4.82003 15.3987 3.65627 15.1499 2.84314 14.3368C2.03001 13.5237 1.78124 12.3599 2.09681 11.3322C1.14699 10.8287 0.5 9.82986 0.5 8.67993C0.5 7.53 1.14699 6.53119 2.0968 6.02764C1.78125 4.99996 2.03003 3.83621 2.84315 3.02309C3.65627 2.20997 4.82002 1.96119 5.8477 2.27675C6.35125 1.32692 7.35007 0.679932 8.5 0.679932C9.64992 0.679932 10.6487 1.32691 11.1523 2.27672C12.18 1.96115 13.3437 2.20993 14.1569 3.02305C14.97 3.83618 15.2188 4.99996 14.9032 6.02764C15.853 6.53119 16.5 7.53 16.5 8.67993ZM12.2659 6.68856C12.5654 6.40238 12.5761 5.92763 12.29 5.62818C12.0038 5.32873 11.529 5.31797 11.2296 5.60416C9.73022 7.03711 8.40877 8.65489 7.3018 10.4211L5.78033 8.89963C5.48744 8.60673 5.01256 8.60673 4.71967 8.89963C4.42678 9.19252 4.42678 9.66739 4.71967 9.96029L6.92031 12.1609C7.08544 12.3261 7.31807 12.4048 7.54957 12.374C7.78106 12.3432 7.98499 12.2064 8.1012 12.0038C9.23027 10.0356 10.6362 8.24613 12.2659 6.68856Z",fill:"var(--privy-color-accent)"})});import{jsx as QE,jsxs as JE}from"react/jsx-runtime";var T1=Wp.div`
2076
2076
  display: flex;
2077
2077
  flex-direction: column;
2078
2078
  justify-content: flex-start;
2079
2079
  gap: 4px;
2080
- `,Mp=Ip.div`
2080
+ `,Op=Wp.div`
2081
2081
  &&& {
2082
2082
  margin-left: 7px; /* TODO: This is a total hack */
2083
2083
  border-left: 2px solid var(--privy-color-foreground-4);
2084
2084
  height: 12px;
2085
2085
  }
2086
- `,yc=({children:e})=>KE(zE,{children:[$E(v1,{style:{width:"16px",height:"16px"}}),e]}),zE=Ip.div`
2086
+ `,vc=({children:e})=>JE(ZE,{children:[QE(E1,{style:{width:"16px",height:"16px"}}),e]}),ZE=Wp.div`
2087
2087
  display: flex;
2088
2088
  justify-content: flex-start;
2089
2089
  justify-items: center;
@@ -2101,22 +2101,22 @@ You will need this password to access your ${e} wallet on a new device. Please k
2101
2101
  margin-bottom: auto;
2102
2102
  }
2103
2103
  }
2104
- `;import{Fragment as QE,jsx as bt,jsxs as Ga}from"react/jsx-runtime";var YE=()=>Ga(ZE,{children:[bt(Mn,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),bt(wt,{children:bt(to,{style:{width:"152px",height:"152px"}})}),Ga(C1,{children:[bt(yc,{children:Ga("div",{children:[bt("span",{children:"Install the "}),bt("a",{href:w1.isFirefox?"https://addons.mozilla.org/en-US/firefox/addon/phantom-app/":"https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa?hl=en",target:"_blank",children:"Phantom browser extension"})]})}),bt(Mp,{}),bt(yc,{children:"Set up your first wallet"}),bt(Mp,{}),bt(yc,{children:"Store your recovery phrase in a safe place!"})]}),bt(Ho,{onClick:()=>window.location.reload(),children:"Reload the page to use your wallet"})]}),b1=()=>{let{navigateBack:e}=P();return Ga(QE,{children:[bt(x,{backFn:e},"header"),bt(ne,{}),bt(YE,{}),bt(ie,{}),Ga(Z,{children:[bt("span",{children:"Still not sure? "}),bt("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})},ZE=jE(wt)`
2104
+ `;import{Fragment as r7,jsx as bt,jsxs as Va}from"react/jsx-runtime";var e7=()=>Va(t7,{children:[bt(On,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),bt(wt,{children:bt(to,{style:{width:"152px",height:"152px"}})}),Va(T1,{children:[bt(vc,{children:Va("div",{children:[bt("span",{children:"Install the "}),bt("a",{href:S1.isFirefox?"https://addons.mozilla.org/en-US/firefox/addon/phantom-app/":"https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa?hl=en",target:"_blank",children:"Phantom browser extension"})]})}),bt(Op,{}),bt(vc,{children:"Set up your first wallet"}),bt(Op,{}),bt(vc,{children:"Store your recovery phrase in a safe place!"})]}),bt(Go,{onClick:()=>window.location.reload(),children:"Reload the page to use your wallet"})]}),_1=()=>{let{navigateBack:e}=_();return Va(r7,{children:[bt(A,{backFn:e},"header"),bt(re,{}),bt(e7,{}),bt(ie,{}),Va(Z,{children:[bt("span",{children:"Still not sure? "}),bt("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})},t7=XE(wt)`
2105
2105
  gap: 30px;
2106
2106
 
2107
2107
  > :first-child > svg {
2108
2108
  margin-top: 20px;
2109
2109
  }
2110
- `;import H7 from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as G7,useState as D1}from"react";import{isMobile as V7}from"react-device-detect";import q7 from"styled-components";var JE={apple_oauth:"apple",custom_auth:"custom",discord_oauth:"discord",email:"email",farcaster:"farcaster",github_oauth:"github",google_oauth:"google",instagram_oauth:"instagram",linkedin_oauth:"linkedin",passkey:"passkey",phone:"sms",spotify_oauth:"spotify",telegram:"telegram",tiktok_oauth:"tiktok",twitter_oauth:"twitter",wallet:"siwe",cross_app:"privy:"},on=e=>{let t=JE[e];return e==="wallet"||e==="phone"?{displayName:e,loginMethod:t}:{displayName:t,loginMethod:t}};import t7 from"styled-components";import XE from"react";import{jsx as e7}from"react/jsx-runtime";var E1=()=>{let{app:e}=P(),t=e?.appearance?.logo,r=`${e?.name} logo`,o={maxHeight:"90px",maxWidth:"180px"};return t?typeof t=="string"?e7("img",{src:t,alt:r,style:o}):t.type==="svg"||t.type==="img"?XE.cloneElement(t,{alt:r,style:o}):(console.warn("`config.appearance.logo` must be a string, or an SVG / IMG element. Nothing will be rendered."),null):null};import{jsx as T1}from"react/jsx-runtime";var gc=e=>{let{app:t}=P();return t?.appearance.logo?T1(r7,{...e,children:T1(E1,{})}):null},r7=t7.div`
2110
+ `;import $7 from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as K7,useState as H1}from"react";import{isMobile as j7}from"react-device-detect";import Y7 from"styled-components";var o7={apple_oauth:"apple",custom_auth:"custom",discord_oauth:"discord",email:"email",farcaster:"farcaster",github_oauth:"github",google_oauth:"google",instagram_oauth:"instagram",linkedin_oauth:"linkedin",passkey:"passkey",phone:"sms",spotify_oauth:"spotify",telegram:"telegram",tiktok_oauth:"tiktok",twitter_oauth:"twitter",wallet:"siwe",cross_app:"privy:"},nn=e=>{let t=o7[e];return e==="wallet"||e==="phone"?{displayName:e,loginMethod:t}:{displayName:t,loginMethod:t}};import a7 from"styled-components";import n7 from"react";import{jsx as i7}from"react/jsx-runtime";var P1=()=>{let{app:e}=_(),t=e?.appearance?.logo,r=`${e?.name} logo`,o={maxHeight:"90px",maxWidth:"180px"};return t?typeof t=="string"?i7("img",{src:t,alt:r,style:o}):t.type==="svg"||t.type==="img"?n7.cloneElement(t,{alt:r,style:o}):(console.warn("`config.appearance.logo` must be a string, or an SVG / IMG element. Nothing will be rendered."),null):null};import{jsx as A1}from"react/jsx-runtime";var Cc=e=>{let{app:t}=_();return t?.appearance.logo?A1(s7,{...e,children:A1(P1,{})}):null},s7=a7.div`
2111
2111
  display: flex;
2112
2112
  flex-direction: column;
2113
2113
  align-items: center;
2114
2114
  padding: 24px 0;
2115
2115
  flex-grow: 1;
2116
2116
  justify-content: center;
2117
- `;import l7 from"@heroicons/react/24/outline/EnvelopeIcon";import{useRef as c7}from"react";import o7 from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as n7,useState as Wp}from"react";import _1 from"styled-components";import{Fragment as s7,jsx as Vn,jsxs as S1}from"react/jsx-runtime";var vc=n7((e,t)=>{let[r,o]=Wp(""),[n,i]=Wp(!1),{authenticated:a}=z(),{initLoginWithEmail:l}=M(),{navigate:s,setModalData:c,currentScreen:m}=P(),{enabled:f,token:u}=be(),[C,g]=Wp(!1),{accountType:y}=St(),b=As(r),E=n,k=n||!b,T=R=>{i(!0),l(r,R).then(()=>{s("AWAITING_PASSWORDLESS_CODE")}).catch(I=>{c({errorModalData:{error:I,previousScreen:m||"LANDING"}}),s("ERROR_SCREEN")}).finally(()=>{i(!1)})},A=()=>{f&&!u&&!a?(c({captchaModalData:{callback:R=>l(r,R),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),s("CAPTCHA_SCREEN")):T(u)};return S1(s7,{children:[Vn(i7,{children:S1(a7,{stacked:e.stacked,children:[Vn(o7,{}),Vn("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onFocus:()=>g(!0),onChange:R=>o(R.target.value),onKeyUp:R=>{R.key==="Enter"&&A()},value:r,autoComplete:"email"}),y==="email"&&!C?Vn(Xt,{color:"gray",children:"Recent"}):e.stacked?Vn("span",{}):Vn(yi,{isSubmitting:E,onClick:A,disabled:k,children:"Submit"})]})}),e.stacked?Vn(B,{loadingText:null,loading:E,disabled:k,onClick:A,children:"Submit"}):null]})}),i7=_1.div`
2117
+ `;import m7 from"@heroicons/react/24/outline/EnvelopeIcon";import{useRef as f7}from"react";import l7 from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as c7,useState as Lp}from"react";import k1 from"styled-components";import{Fragment as u7,jsx as zn,jsxs as x1}from"react/jsx-runtime";var wc=c7((e,t)=>{let[r,o]=Lp(""),[n,i]=Lp(!1),{authenticated:a}=q(),{initLoginWithEmail:l}=M(),{navigate:s,setModalData:c,currentScreen:m}=_(),{enabled:f,token:u}=be(),[C,g]=Lp(!1),{accountType:y}=St(),b=xs(r),T=n,k=n||!b,S=R=>{i(!0),l(r,R).then(()=>{s("AWAITING_PASSWORDLESS_CODE")}).catch(I=>{c({errorModalData:{error:I,previousScreen:m||"LANDING"}}),s("ERROR_SCREEN")}).finally(()=>{i(!1)})},x=()=>{f&&!u&&!a?(c({captchaModalData:{callback:R=>l(r,R),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),s("CAPTCHA_SCREEN")):S(u)};return x1(u7,{children:[zn(d7,{children:x1(p7,{stacked:e.stacked,children:[zn(l7,{}),zn("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onFocus:()=>g(!0),onChange:R=>o(R.target.value),onKeyUp:R=>{R.key==="Enter"&&x()},value:r,autoComplete:"email"}),y==="email"&&!C?zn(er,{color:"gray",children:"Recent"}):e.stacked?zn("span",{}):zn(vi,{isSubmitting:T,onClick:x,disabled:k,children:"Submit"})]})}),e.stacked?zn(B,{loadingText:null,loading:T,disabled:k,onClick:x,children:"Submit"}):null]})}),d7=k1.div`
2118
2118
  width: 100%;
2119
- `,a7=_1.label`
2119
+ `,p7=k1.label`
2120
2120
  display: block;
2121
2121
  position: relative;
2122
2122
  width: 100%;
@@ -2183,11 +2183,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
2183
2183
  && > input::placeholder {
2184
2184
  color: var(--privy-color-foreground-3);
2185
2185
  }
2186
- `;import{Fragment as d7,jsx as Cc,jsxs as P1}from"react/jsx-runtime";var wc=({isEditable:e,setIsEditable:t})=>{let r=c7(null);return P1(d7,{children:[Cc(Fr,{if:!e,children:Cc(vc,{ref:r})}),Cc(Fr,{if:e,children:P1(Ee,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[Cc(l7,{})," Continue with Email"]})})]})};import{useState as p7}from"react";import u7 from"styled-components";import{jsx as bc,jsxs as f7}from"react/jsx-runtime";var Ec=()=>{let[e,t]=p7(!1),{currentScreen:r,navigate:o,setModalData:n}=P(),{enabled:i,token:a}=be(),{initLoginWithFarcaster:l}=M(),{accountType:s}=St();return f7(Ee,{onClick:async()=>{t(!0);try{i&&!a?(n({captchaModalData:{callback:m=>l(m),userIntentRequired:!0,onSuccessNavigateTo:"AWAITING_FARCASTER_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):(await l(a),o("AWAITING_FARCASTER_CONNECTION"))}catch(m){n({errorModalData:{error:m,previousScreen:r||"LANDING"}}),o("ERROR_SCREEN")}finally{t(!1)}},disabled:!1,children:[bc(co,{})," Farcaster",e&&bc("span",{children:bc(ro,{})}),s==="farcaster"&&bc(m7,{color:"gray",children:"Recent"})]})},m7=u7(Xt)`
2186
+ `;import{Fragment as h7,jsx as bc,jsxs as R1}from"react/jsx-runtime";var Ec=({isEditable:e,setIsEditable:t})=>{let r=f7(null);return R1(h7,{children:[bc(Fr,{if:!e,children:bc(wc,{ref:r})}),bc(Fr,{if:e,children:R1(Ee,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[bc(m7,{})," Continue with Email"]})})]})};import{useState as y7}from"react";import g7 from"styled-components";import{jsx as Tc,jsxs as C7}from"react/jsx-runtime";var Sc=()=>{let[e,t]=y7(!1),{currentScreen:r,navigate:o,setModalData:n}=_(),{enabled:i,token:a}=be(),{initLoginWithFarcaster:l}=M(),{accountType:s}=St();return C7(Ee,{onClick:async()=>{t(!0);try{i&&!a?(n({captchaModalData:{callback:m=>l(m),userIntentRequired:!0,onSuccessNavigateTo:"AWAITING_FARCASTER_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):(await l(a),o("AWAITING_FARCASTER_CONNECTION"))}catch(m){n({errorModalData:{error:m,previousScreen:r||"LANDING"}}),o("ERROR_SCREEN")}finally{t(!1)}},disabled:!1,children:[Tc(co,{})," Farcaster",e&&Tc("span",{children:Tc(ro,{})}),s==="farcaster"&&Tc(v7,{color:"gray",children:"Recent"})]})},v7=g7(er)`
2187
2187
  margin-left: auto;
2188
- `;import A7 from"@heroicons/react/24/outline/PhoneIcon";import{useRef as x7}from"react";import{forwardRef as T7,useState as _c}from"react";import M1 from"styled-components";import h7 from"libphonenumber-js/examples.mobile.json";import{isPossiblePhoneNumber as y7,AsYouType as g7,getCountries as v7,getCountryCallingCode as Tc,getExampleNumber as C7}from"libphonenumber-js/min";import{jsx as E7,jsxs as b7}from"react/jsx-runtime";var Va=(e,t)=>y7(String(e),t),Sc=(e,t)=>`+${Tc(t)} ${e}`,A1=e=>`*${e.replaceAll("-","").slice(-4)}`,x1=e=>new g7(e),w7=v7().map(e=>({code:e,callCode:Tc(e)})),k1=e=>{let t=C7(e,h7)?.formatInternational();return t?.substring(t.indexOf(" ")+1)},R1=({value:e,onChange:t})=>E7("select",{value:e,onChange:t,children:w7.map(r=>b7("option",{value:r.code,children:[r.code," +",r.callCode]},r.code))});import{Fragment as P7,jsx as qn,jsxs as I1}from"react/jsx-runtime";var zi=T7((e,t)=>{let{app:r}=P(),[o,n]=_c(!1),{accountType:i}=St(),[a,l]=_c(""),[s,c]=_c(r?.intl.defaultCountry??"US"),m=Va(a,s),f=x1(s),u=k1(s),C=Tc(s),g=!m,[y,b]=_c(!1),E=C.length,k=R=>{let I=R.target.value;c(I),l(""),e.onChange&&e.onChange({rawPhoneNumber:a,qualifiedPhoneNumber:Sc(a,I),countryCode:I,isValid:Va(a,s)})},T=R=>{try{let I=R.replace(/\D/g,""),D=a.replace(/\D/g,""),H=I===D?R:f.input(R);l(H),e.onChange&&e.onChange({rawPhoneNumber:H,qualifiedPhoneNumber:Sc(R,s),countryCode:s,isValid:Va(R,s)})}catch(I){console.error("Error processing phone number:",I)}},A=()=>{b(!0);let R=Sc(a,s);e.onSubmit({rawPhoneNumber:a,qualifiedPhoneNumber:R,countryCode:s,isValid:Va(a,s)}).finally(()=>b(!1))};return I1(P7,{children:[qn(S7,{children:I1(_7,{callingCodeLength:E,stacked:e.stacked,children:[qn(R1,{value:s,onChange:k}),qn("input",{ref:t,id:"phone-number-input",type:"tel",placeholder:u,onFocus:()=>n(!0),onChange:R=>{T(R.target.value)},onKeyUp:R=>{R.key==="Enter"&&A()},value:a,autoComplete:"tel"}),i==="phone"&&!o?qn(Xt,{color:"gray",children:"Recent"}):!e.stacked&&!e.noIncludeSubmitButton?qn(yi,{isSubmitting:y,onClick:A,disabled:g,children:"Submit"}):qn("span",{})]})}),e.stacked&&!e.noIncludeSubmitButton?qn(B,{loading:y,loadingText:null,onClick:A,disabled:g,children:"Submit"}):null]})}),S7=M1.div`
2188
+ `;import M7 from"@heroicons/react/24/outline/PhoneIcon";import{useRef as W7}from"react";import{forwardRef as x7,useState as Ac}from"react";import N1 from"styled-components";import w7 from"libphonenumber-js/examples.mobile.json";import{isPossiblePhoneNumber as b7,AsYouType as E7,getCountries as T7,getCountryCallingCode as _c,getExampleNumber as S7}from"libphonenumber-js/min";import{jsx as A7,jsxs as P7}from"react/jsx-runtime";var qa=(e,t)=>b7(String(e),t),Pc=(e,t)=>`+${_c(t)} ${e}`,I1=e=>`*${e.replaceAll("-","").slice(-4)}`,M1=e=>new E7(e),_7=T7().map(e=>({code:e,callCode:_c(e)})),W1=e=>{let t=S7(e,w7)?.formatInternational();return t?.substring(t.indexOf(" ")+1)},O1=({value:e,onChange:t})=>A7("select",{value:e,onChange:t,children:_7.map(r=>P7("option",{value:r.code,children:[r.code," +",r.callCode]},r.code))});import{Fragment as I7,jsx as $n,jsxs as L1}from"react/jsx-runtime";var an=x7((e,t)=>{let{app:r}=_(),[o,n]=Ac(!1),{accountType:i}=St(),[a,l]=Ac(""),[s,c]=Ac(r?.intl.defaultCountry??"US"),m=qa(a,s),f=M1(s),u=W1(s),C=_c(s),g=!m,[y,b]=Ac(!1),T=C.length,k=R=>{let I=R.target.value;c(I),l(""),e.onChange&&e.onChange({rawPhoneNumber:a,qualifiedPhoneNumber:Pc(a,I),countryCode:I,isValid:qa(a,s)})},S=R=>{try{let I=R.replace(/\D/g,""),D=a.replace(/\D/g,""),H=I===D?R:f.input(R);l(H),e.onChange&&e.onChange({rawPhoneNumber:H,qualifiedPhoneNumber:Pc(R,s),countryCode:s,isValid:qa(R,s)})}catch(I){console.error("Error processing phone number:",I)}},x=()=>{b(!0);let R=Pc(a,s);e.onSubmit({rawPhoneNumber:a,qualifiedPhoneNumber:R,countryCode:s,isValid:qa(a,s)}).finally(()=>b(!1))};return L1(I7,{children:[$n(k7,{children:L1(R7,{callingCodeLength:T,stacked:e.stacked,children:[$n(O1,{value:s,onChange:k}),$n("input",{ref:t,id:"phone-number-input",type:"tel",placeholder:u,onFocus:()=>n(!0),onChange:R=>{S(R.target.value)},onKeyUp:R=>{R.key==="Enter"&&x()},value:a,autoComplete:"tel"}),i==="phone"&&!o&&!e.hideRecent?$n(er,{color:"gray",children:"Recent"}):!e.stacked&&!e.noIncludeSubmitButton?$n(vi,{isSubmitting:y,onClick:x,disabled:g,children:"Submit"}):$n("span",{})]})}),e.stacked&&!e.noIncludeSubmitButton?$n(B,{loading:y,loadingText:null,onClick:x,disabled:g,children:"Submit"}):null]})}),k7=N1.div`
2189
2189
  width: 100%;
2190
- `,_7=M1.label`
2190
+ `,R7=N1.label`
2191
2191
  --country-code-dropdown-width: calc(54px + calc(12 * ${e=>e.callingCodeLength}px));
2192
2192
  --phone-input-extra-padding-left: calc(12px + calc(3 * ${e=>e.callingCodeLength}px));
2193
2193
  display: block;
@@ -2280,15 +2280,15 @@ You will need this password to access your ${e} wallet on a new device. Please k
2280
2280
  && > input::placeholder {
2281
2281
  color: var(--privy-color-foreground-3);
2282
2282
  }
2283
- `;import{Fragment as k7,jsx as Pc,jsxs as W1}from"react/jsx-runtime";var Ac=({isEditable:e,setIsEditable:t})=>{let r=x7(null),{authenticated:o}=z(),{navigate:n,setModalData:i,currentScreen:a}=P(),{initLoginWithSms:l}=M(),{enabled:s,token:c}=be();async function m({qualifiedPhoneNumber:f}){if(s&&!c&&!o)i({captchaModalData:{callback:u=>l(f,u),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await l(f,c),n("AWAITING_PASSWORDLESS_CODE")}catch(u){i({errorModalData:{error:u,previousScreen:a||"LANDING"}}),n("ERROR_SCREEN")}}return W1(k7,{children:[Pc(Fr,{if:!e,children:Pc(zi,{ref:r,onSubmit:m})}),Pc(Fr,{if:e,children:W1(Ee,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[Pc(A7,{})," Continue with SMS"]})})]})};import{useState as R7}from"react";import I7 from"styled-components";import{jsx as yo,jsxs as O7}from"react/jsx-runtime";var M7={apple:{logo:yo(Us,{}),displayName:"Apple"},discord:{logo:yo(Fs,{}),displayName:"Discord"},github:{logo:yo(Bs,{}),displayName:"GitHub"},google:{logo:yo(Gs,{}),displayName:"Google"},linkedin:{logo:yo($s,{}),displayName:"LinkedIn"},spotify:{logo:yo(Ks,{}),displayName:"Spotify"},instagram:{logo:yo(qs,{}),displayName:"Instagram"},twitter:{logo:yo(Ys,{}),displayName:"Twitter"},tiktok:{logo:yo(js,{}),displayName:"TikTok"}},kt=({provider:e})=>{let{enabled:t,token:r}=be(),{navigate:o,setModalData:n}=P(),[i,a]=R7(!1),{initLoginWithOAuth:l}=M(),{accountType:s}=St(),c=s?on(s):null,{displayName:m,logo:f}=M7[e];return O7(Ee,{onClick:()=>{a(!0),t&&!r?(n({captchaModalData:{callback:C=>l(e,C),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):l(e)},disabled:i,children:[f," ",m,c?.loginMethod===e&&yo(W7,{color:"gray",children:"Recent"})]})},W7=I7(Xt)`
2283
+ `;import{Fragment as O7,jsx as xc,jsxs as D1}from"react/jsx-runtime";var kc=({isEditable:e,setIsEditable:t})=>{let r=W7(null),{authenticated:o}=q(),{navigate:n,setModalData:i,currentScreen:a}=_(),{initLoginWithSms:l}=M(),{enabled:s,token:c}=be();async function m({qualifiedPhoneNumber:f}){if(s&&!c&&!o)i({captchaModalData:{callback:u=>l(f,u),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await l(f,c),n("AWAITING_PASSWORDLESS_CODE")}catch(u){i({errorModalData:{error:u,previousScreen:a||"LANDING"}}),n("ERROR_SCREEN")}}return D1(O7,{children:[xc(Fr,{if:!e,children:xc(an,{ref:r,onSubmit:m})}),xc(Fr,{if:e,children:D1(Ee,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[xc(M7,{})," Continue with SMS"]})})]})};import{useState as L7}from"react";import N7 from"styled-components";import{jsx as yo,jsxs as F7}from"react/jsx-runtime";var D7={apple:{logo:yo(Fs,{}),displayName:"Apple"},discord:{logo:yo(Bs,{}),displayName:"Discord"},github:{logo:yo(Hs,{}),displayName:"GitHub"},google:{logo:yo(Vs,{}),displayName:"Google"},linkedin:{logo:yo(Ks,{}),displayName:"LinkedIn"},spotify:{logo:yo(js,{}),displayName:"Spotify"},instagram:{logo:yo(zs,{}),displayName:"Instagram"},twitter:{logo:yo(Zs,{}),displayName:"Twitter"},tiktok:{logo:yo(Ys,{}),displayName:"TikTok"}},kt=({provider:e})=>{let{enabled:t,token:r}=be(),{navigate:o,setModalData:n}=_(),[i,a]=L7(!1),{initLoginWithOAuth:l}=M(),{accountType:s}=St(),c=s?nn(s):null,{displayName:m,logo:f}=D7[e];return F7(Ee,{onClick:()=>{a(!0),t&&!r?(n({captchaModalData:{callback:C=>l(e,C),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):l(e)},disabled:i,children:[f," ",m,c?.loginMethod===e&&yo(U7,{color:"gray",children:"Recent"})]})},U7=N7(er)`
2284
2284
  margin-left: auto;
2285
- `;import{useState as L7}from"react";import N7 from"styled-components";import{jsx as nn,jsxs as O1}from"react/jsx-runtime";function xc(e){return O1("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 240 240",...e,children:[nn("defs",{children:O1("linearGradient",{x1:"120",y1:"240",x2:"120",gradientUnits:"userSpaceOnUse",id:"telegram-linear-gradient",children:[nn("stop",{offset:"0",stopColor:"#1d93d2"}),nn("stop",{offset:"1",stopColor:"#38b0e3"})]})}),nn("title",{children:"Telegram_logo"}),nn("circle",{cx:"120",cy:"120",r:"120",fill:"url(#telegram-linear-gradient)"}),nn("path",{d:"M81.229,128.772l14.237,39.406s1.78,3.687,3.686,3.687,30.255-29.492,30.255-29.492l31.525-60.89L81.737,118.6Z",fill:"#c8daea"}),nn("path",{d:"M100.106,138.878l-2.733,29.046s-1.144,8.9,7.754,0,17.415-15.763,17.415-15.763",fill:"#a9c6d8"}),nn("path",{d:"M81.486,130.178,52.2,120.636s-3.5-1.42-2.373-4.64c.232-.664.7-1.229,2.1-2.2,6.489-4.523,120.106-45.36,120.106-45.36s3.208-1.081,5.1-.362a2.766,2.766,0,0,1,1.885,2.055,9.357,9.357,0,0,1,.254,2.585c-.009.752-.1,1.449-.169,2.542-.692,11.165-21.4,94.493-21.4,94.493s-1.239,4.876-5.678,5.043A8.13,8.13,0,0,1,146.1,172.5c-8.711-7.493-38.819-27.727-45.472-32.177a1.27,1.27,0,0,1-.546-.9c-.093-.469.417-1.05.417-1.05s52.426-46.6,53.821-51.492c.108-.379-.3-.566-.848-.4-3.482,1.281-63.844,39.4-70.506,43.607A3.21,3.21,0,0,1,81.486,130.178Z",fill:"#fff"})]})}import{jsx as L1,jsxs as U7}from"react/jsx-runtime";var kc=()=>{let{enabled:e,token:t}=be(),{navigate:r,setModalData:o}=P(),[n,i]=L7(!1),{initLoginWithTelegram:a}=M(),{accountType:l}=St();async function s(m){try{await a(m),r("TELEGRAM_AUTH_SCREEN")}catch(f){console.error(f),i(!1)}}async function c(){if(i(!0),e&&!t){o({captchaModalData:{callback:s,userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),r("CAPTCHA_SCREEN");return}await s()}return U7(Ee,{onClick:c,disabled:n,children:[L1(xc,{}),"Telegram",l==="telegram"&&L1(D7,{color:"gray",children:"Recent"})]})},D7=N7(Xt)`
2285
+ `;import{useState as B7}from"react";import H7 from"styled-components";import{jsx as sn,jsxs as U1}from"react/jsx-runtime";function Rc(e){return U1("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 240 240",...e,children:[sn("defs",{children:U1("linearGradient",{x1:"120",y1:"240",x2:"120",gradientUnits:"userSpaceOnUse",id:"telegram-linear-gradient",children:[sn("stop",{offset:"0",stopColor:"#1d93d2"}),sn("stop",{offset:"1",stopColor:"#38b0e3"})]})}),sn("title",{children:"Telegram_logo"}),sn("circle",{cx:"120",cy:"120",r:"120",fill:"url(#telegram-linear-gradient)"}),sn("path",{d:"M81.229,128.772l14.237,39.406s1.78,3.687,3.686,3.687,30.255-29.492,30.255-29.492l31.525-60.89L81.737,118.6Z",fill:"#c8daea"}),sn("path",{d:"M100.106,138.878l-2.733,29.046s-1.144,8.9,7.754,0,17.415-15.763,17.415-15.763",fill:"#a9c6d8"}),sn("path",{d:"M81.486,130.178,52.2,120.636s-3.5-1.42-2.373-4.64c.232-.664.7-1.229,2.1-2.2,6.489-4.523,120.106-45.36,120.106-45.36s3.208-1.081,5.1-.362a2.766,2.766,0,0,1,1.885,2.055,9.357,9.357,0,0,1,.254,2.585c-.009.752-.1,1.449-.169,2.542-.692,11.165-21.4,94.493-21.4,94.493s-1.239,4.876-5.678,5.043A8.13,8.13,0,0,1,146.1,172.5c-8.711-7.493-38.819-27.727-45.472-32.177a1.27,1.27,0,0,1-.546-.9c-.093-.469.417-1.05.417-1.05s52.426-46.6,53.821-51.492c.108-.379-.3-.566-.848-.4-3.482,1.281-63.844,39.4-70.506,43.607A3.21,3.21,0,0,1,81.486,130.178Z",fill:"#fff"})]})}import{jsx as F1,jsxs as V7}from"react/jsx-runtime";var Ic=()=>{let{enabled:e,token:t}=be(),{navigate:r,setModalData:o}=_(),[n,i]=B7(!1),{initLoginWithTelegram:a}=M(),{accountType:l}=St();async function s(m){try{await a(m),r("TELEGRAM_AUTH_SCREEN")}catch(f){console.error(f),i(!1)}}async function c(){if(i(!0),e&&!t){o({captchaModalData:{callback:s,userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),r("CAPTCHA_SCREEN");return}await s()}return V7(Ee,{onClick:c,disabled:n,children:[F1(Rc,{}),"Telegram",l==="telegram"&&F1(G7,{color:"gray",children:"Recent"})]})},G7=H7(er)`
2286
2286
  margin-left: auto;
2287
- `;import F7 from"@heroicons/react/24/outline/ChevronRightIcon";import{jsx as N1,jsxs as B7}from"react/jsx-runtime";var Rc=({onClick:e,text:t,icon:r})=>B7(Ee,{onClick:e,children:[r,N1(oo,{children:t}),N1(F7,{})]});import{Fragment as Op,jsx as it,jsxs as Mc}from"react/jsx-runtime";var Wc=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=M(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=P(),{appearance:{palette:{colorScheme:i}}}=Ve(),{accountType:a,walletClientType:l}=St(),s=a?on(a):null,c=o.loginMethodsAndOrder?.primary??[],m=o.loginMethodsAndOrder?.overflow??[],f=[...c,...m],u=o.loginMethods.passkey,C=[];l&&f.includes(l)?C.push(l):a&&f.includes(s?.loginMethod)&&C.push(s?.loginMethod);let[g,y]=D1("default"),[b,E]=D1(a==="phone"?"sms":"email");G7(()=>{a==="phone"&&E("sms");let U=f.indexOf("sms"),W=f.indexOf("email");U>-1&&U<W&&E("sms")},[a,c,m]);let k=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{y("default")},150)};n.current=k;let T=U=>U==="email"?it(wc,{isEditable:b==="email",setIsEditable:()=>{E("email")}},U):U==="sms"?it(Ac,{isEditable:b==="sms",setIsEditable:()=>{E("sms")}},U):U==="apple"?it(kt,{provider:"apple"},U):U==="discord"?it(kt,{provider:"discord"},U):U==="farcaster"?it(Ec,{},U):U==="github"?it(kt,{provider:"github"},U):U==="google"?it(kt,{provider:"google"},U):U==="linkedin"?it(kt,{provider:"linkedin"},U):U==="tiktok"?it(kt,{provider:"tiktok"},U):U==="twitter"&&(!V7||o?.loginConfig.twitterOAuthOnMobileEnabled)?it(kt,{provider:"twitter"},U):U==="telegram"?it(kc,{},U):zo([U],r,e,f,o.externalWallets.walletConnect.enabled),A=C.flatMap(T),R=c.filter(U=>U!==l&&U!==s?.loginMethod).flatMap(T),I=m.filter(U=>U!==l&&U!==s?.loginMethod).flatMap(T),D=[...A,...R,...I],H=z7({primary:R.length+A.length,overflow:I.length}),[K,j]=am(D,H),O=g==="default"?void 0:()=>{y("default")};return Mc(Op,{children:[it(x,{title:o.appearance.landingHeader,onClose:k,backFn:O}),g==="default"&&it($7,{}),g==="default"&&(typeof o.appearance.loginMessage=="string"?it(ul,{children:o.appearance.loginMessage}):o.appearance.loginMessage),it(pl,{style:{overflow:"hidden"},children:Mc(ih,{colorScheme:i,style:{maxHeight:400,overflowY:"scroll",padding:2},children:[g==="default"&&Mc(Op,{children:[...K,j.length>0&&it(Rc,{text:"More options",icon:it(H7,{}),onClick:()=>y("overflow")})]}),g==="overflow"&&Mc(Op,{children:[...j]}),u&&g==="default"&&it(mc,{})]})}),o&&it(Ci,{app:o}),it($,{})]})},Ic=5,z7=({primary:e,overflow:t})=>e<Ic?e:e===Ic&&t===0?Ic:Ic-1,$7=q7(gc)`
2287
+ `;import q7 from"@heroicons/react/24/outline/ChevronRightIcon";import{jsx as B1,jsxs as z7}from"react/jsx-runtime";var Mc=({onClick:e,text:t,icon:r})=>z7(Ee,{onClick:e,children:[r,B1(oo,{children:t}),B1(q7,{})]});import{Fragment as Np,jsx as at,jsxs as Oc}from"react/jsx-runtime";var Lc=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=M(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=_(),{appearance:{palette:{colorScheme:i}}}=Ve(),{accountType:a,walletClientType:l}=St(),s=a?nn(a):null,c=o.loginMethodsAndOrder?.primary??[],m=o.loginMethodsAndOrder?.overflow??[],f=[...c,...m],u=o.loginMethods.passkey,C=[];l&&f.includes(l)?C.push(l):a&&f.includes(s?.loginMethod)&&C.push(s?.loginMethod);let[g,y]=H1("default"),[b,T]=H1(a==="phone"?"sms":"email");K7(()=>{a==="phone"&&T("sms");let U=f.indexOf("sms"),W=f.indexOf("email");U>-1&&U<W&&T("sms")},[a,c,m]);let k=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{y("default")},150)};n.current=k;let S=U=>U==="email"?at(Ec,{isEditable:b==="email",setIsEditable:()=>{T("email")}},U):U==="sms"?at(kc,{isEditable:b==="sms",setIsEditable:()=>{T("sms")}},U):U==="apple"?at(kt,{provider:"apple"},U):U==="discord"?at(kt,{provider:"discord"},U):U==="farcaster"?at(Sc,{},U):U==="github"?at(kt,{provider:"github"},U):U==="google"?at(kt,{provider:"google"},U):U==="linkedin"?at(kt,{provider:"linkedin"},U):U==="tiktok"?at(kt,{provider:"tiktok"},U):U==="twitter"&&(!j7||o?.loginConfig.twitterOAuthOnMobileEnabled)?at(kt,{provider:"twitter"},U):U==="telegram"?at(Ic,{},U):$o([U],r,e,f,o.externalWallets.walletConnect.enabled),x=C.flatMap(S),R=c.filter(U=>U!==l&&U!==s?.loginMethod).flatMap(S),I=m.filter(U=>U!==l&&U!==s?.loginMethod).flatMap(S),D=[...x,...R,...I],H=Z7({primary:R.length+x.length,overflow:I.length}),[K,j]=cm(D,H),O=g==="default"?void 0:()=>{y("default")};return Oc(Np,{children:[at(A,{title:o.appearance.landingHeader,onClose:k,backFn:O}),g==="default"&&at(Q7,{}),g==="default"&&(typeof o.appearance.loginMessage=="string"?at(fl,{children:o.appearance.loginMessage}):o.appearance.loginMessage),at(ml,{style:{overflow:"hidden"},children:Oc(ch,{colorScheme:i,style:{maxHeight:400,overflowY:"scroll",padding:2},children:[g==="default"&&Oc(Np,{children:[...K,j.length>0&&at(Mc,{text:"More options",icon:at($7,{}),onClick:()=>y("overflow")})]}),g==="overflow"&&Oc(Np,{children:[...j]}),u&&g==="default"&&at(hc,{})]})}),o&&at(bi,{app:o}),at(z,{})]})},Wc=5,Z7=({primary:e,overflow:t})=>e<Wc?e:e===Wc&&t===0?Wc:Wc-1,Q7=Y7(Cc)`
2288
2288
  margin-bottom: 16px;
2289
- `;import K7 from"@heroicons/react/24/outline/EnvelopeIcon";import j7 from"@heroicons/react/24/outline/PhoneIcon";import Y7 from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as Z7,useMemo as B1,useState as H1}from"react";import{isMobile as Q7}from"react-device-detect";import J7 from"styled-components";import{toObjectKeys as X7}from"@privy-io/js-sdk-core";import{jsx as qa,jsxs as U1}from"react/jsx-runtime";var F1=({...e})=>U1("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...e,children:[U1("g",{clipPath:"url(#clip0_2856_1743)",children:[qa("path",{d:"M22.1673 8.24075V16.3642C22.1673 17.3256 21.3421 18.105 20.3241 18.105H17.0028M22.1673 8.24075C22.1673 7.27936 21.3421 6.5 20.3241 6.5H11.5302M22.1673 8.24075V8.42852C22.1673 9.03302 21.8352 9.59423 21.2901 9.91105L15.1463 13.4818C14.5539 13.8261 13.8067 13.8261 13.2143 13.4818L10.1621 11.5401",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),qa("path",{d:"M3.12913 6.64816C0.508085 12.9507 3.49251 20.1847 9.79504 22.8057L11.5068 23.5176C12.4522 23.9108 13.7783 23.2222 14.1714 22.2768L14.6054 21.2333C14.7687 20.8406 14.6438 20.3871 14.3024 20.1334L11.2872 17.8927C10.9878 17.6702 10.5843 17.6488 10.2632 17.8384L9.11575 18.5156C8.78274 18.7121 8.3597 18.6844 8.07552 18.4221C5.94293 16.4542 4.77629 13.6264 4.90096 10.7273C4.91757 10.3409 5.19796 10.023 5.57269 9.92753L6.86381 9.59869C7.22522 9.50664 7.49627 9.20696 7.55169 8.83815L8.10986 5.12321C8.17306 4.70259 7.94188 4.29293 7.54915 4.1296L6.50564 3.69564C5.56026 3.30248 4.23416 3.99103 3.84101 4.9364L3.12913 6.64816Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),qa("defs",{children:qa("clipPath",{id:"clip0_2856_1743",children:qa("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]});import{Fragment as za,jsx as $e,jsxs as $i}from"react/jsx-runtime";var Oc=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=M(),{data:o,onUserCloseViaDialogOrKeybindRef:n}=P(),i=Ve(),{accountType:a,walletClientType:l}=St(),s=a?on(a):null,c=o?.login,m=B1(()=>c?.loginMethods?X7(c.loginMethods,!0):null,[c]),{email:f,sms:u,google:C,twitter:g,discord:y,github:b,spotify:E,instagram:k,tiktok:T,linkedin:A,apple:R,wallet:I,farcaster:D,telegram:H}=m??i.loginMethods,{passkey:K}=i.loginMethods,j=[f&&"email",u&&"sms",C&&"google",g&&"twitter",y&&"discord",b&&"github",E&&"spotify",k&&"instagram",T&&"tiktok",A&&"linkedin",R&&"apple",D&&"farcaster",H&&"telegram"].filter(G=>!!G),O=j.length>0,U=B1(()=>I&&!O?"web3-first":I&&i?.appearance.loginGroupPriority||"web2-first",[I,O,i?.appearance.loginGroupPriority]),W=i?.appearance.hideDirectWeb2Inputs,[Ce,Ie]=H1("default"),[Y,X]=H1(G1({accountType:a,sms:u,email:f}));Z7(()=>{X(G1({accountType:a,sms:u,email:f}))},[f,u,a]);let te=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{Ie("default")},150)};n.current=te;let _e=[];l&&I?_e.push(l):s?.loginMethod&&j.includes(s.loginMethod)&&_e.push(s.loginMethod);let Te=G=>G==="email"?$e(wc,{isEditable:Y==="email",setIsEditable:()=>{X("email")}},G):G==="sms"?$e(Ac,{isEditable:Y==="sms",setIsEditable:()=>{X("sms")}},G):G==="apple"?$e(kt,{provider:"apple"},G):G==="discord"?$e(kt,{provider:"discord"},G):G==="farcaster"?$e(Ec,{},G):G==="github"?$e(kt,{provider:"github"},G):G==="google"?$e(kt,{provider:"google"},G):G==="linkedin"?$e(kt,{provider:"linkedin"},G):G==="tiktok"?$e(kt,{provider:"tiktok"},G):G==="twitter"&&(!Q7||i?.loginConfig.twitterOAuthOnMobileEnabled)?$e(kt,{provider:"twitter"},G):G==="telegram"?$e(kc,{},G):zo([G],r,e,[],i.externalWallets.walletConnect.enabled),Ke=zo(i.appearance.walletList.filter(G=>G!==l),r,e,[...i.appearance.walletList,l],i.externalWallets.walletConnect.enabled),Ge=j.filter(G=>G!==s?.loginMethod).flatMap(Te),mt=_e.flatMap(Te);U==="web3-first"&&Ce==="default"?Ke.unshift(...mt):U==="web2-first"&&Ge.unshift(...mt);let Fe=Ce==="default"?void 0:()=>{Ie("default")},se=j.filter(G=>G!=="email"&&G!=="sms"),Ft=t8({priority:U,email:f,sms:u,social:se}),Wr=r8({priority:U,email:f,sms:u,social:se}),Zr=o8({priority:U}),L=$e(fc,{text:Zr,onClick:()=>Ie("web3-overflow")}),rt=$e(Rc,{text:Ft,icon:Wr,onClick:()=>Ie("web2-overflow")}),Or=W?0:1;return $i(za,{children:[$e(x,{title:i.appearance.landingHeader,onClose:te,backFn:Fe}),Ce==="default"&&$e(e8,{}),Ce==="default"&&(typeof i.appearance.loginMessage=="string"?$e(ul,{children:i.appearance.loginMessage}):i.appearance.loginMessage),$e(pl,{style:{overflow:"hidden",padding:2},children:$i(Yt,{children:[Ce==="default"&&U==="web2-first"&&$i(za,{children:[...Ge.length>4?Ge.slice(0,3):Ge,Ge.length>4&&rt,I&&L]}),Ce==="default"&&U==="web3-first"&&$i(za,{children:[I&&$i(za,{children:[...Ke.length>4?Ke.slice(0,3):Ke,Ke.length>4&&L]}),Ge.length>Or&&rt,Ge.length===Or&&Ge[0]]}),Ce==="web2-overflow"&&$i(za,{children:[...U==="web3-first"?Ge:Ge.slice(3)]}),...Ce==="web3-overflow"?Ke:[],K&&Ce==="default"&&$e(mc,{})]})}),i&&$e(Ci,{app:i}),$e($,{})]})},e8=J7(gc)`
2289
+ `;import J7 from"@heroicons/react/24/outline/EnvelopeIcon";import X7 from"@heroicons/react/24/outline/PhoneIcon";import e8 from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as t8,useMemo as q1,useState as z1}from"react";import{isMobile as r8}from"react-device-detect";import o8 from"styled-components";import{toObjectKeys as n8}from"@privy-io/js-sdk-core";import{jsx as za,jsxs as G1}from"react/jsx-runtime";var V1=({...e})=>G1("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...e,children:[G1("g",{clipPath:"url(#clip0_2856_1743)",children:[za("path",{d:"M22.1673 8.24075V16.3642C22.1673 17.3256 21.3421 18.105 20.3241 18.105H17.0028M22.1673 8.24075C22.1673 7.27936 21.3421 6.5 20.3241 6.5H11.5302M22.1673 8.24075V8.42852C22.1673 9.03302 21.8352 9.59423 21.2901 9.91105L15.1463 13.4818C14.5539 13.8261 13.8067 13.8261 13.2143 13.4818L10.1621 11.5401",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),za("path",{d:"M3.12913 6.64816C0.508085 12.9507 3.49251 20.1847 9.79504 22.8057L11.5068 23.5176C12.4522 23.9108 13.7783 23.2222 14.1714 22.2768L14.6054 21.2333C14.7687 20.8406 14.6438 20.3871 14.3024 20.1334L11.2872 17.8927C10.9878 17.6702 10.5843 17.6488 10.2632 17.8384L9.11575 18.5156C8.78274 18.7121 8.3597 18.6844 8.07552 18.4221C5.94293 16.4542 4.77629 13.6264 4.90096 10.7273C4.91757 10.3409 5.19796 10.023 5.57269 9.92753L6.86381 9.59869C7.22522 9.50664 7.49627 9.20696 7.55169 8.83815L8.10986 5.12321C8.17306 4.70259 7.94188 4.29293 7.54915 4.1296L6.50564 3.69564C5.56026 3.30248 4.23416 3.99103 3.84101 4.9364L3.12913 6.64816Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),za("defs",{children:za("clipPath",{id:"clip0_2856_1743",children:za("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]});import{Fragment as $a,jsx as $e,jsxs as Ki}from"react/jsx-runtime";var Nc=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=M(),{data:o,onUserCloseViaDialogOrKeybindRef:n}=_(),i=Ve(),{accountType:a,walletClientType:l}=St(),s=a?nn(a):null,c=o?.login,m=q1(()=>c?.loginMethods?n8(c.loginMethods,!0):null,[c]),{email:f,sms:u,google:C,twitter:g,discord:y,github:b,spotify:T,instagram:k,tiktok:S,linkedin:x,apple:R,wallet:I,farcaster:D,telegram:H}=m??i.loginMethods,{passkey:K}=i.loginMethods,j=[f&&"email",u&&"sms",C&&"google",g&&"twitter",y&&"discord",b&&"github",T&&"spotify",k&&"instagram",S&&"tiktok",x&&"linkedin",R&&"apple",D&&"farcaster",H&&"telegram"].filter(G=>!!G),O=j.length>0,U=q1(()=>I&&!O?"web3-first":I&&i?.appearance.loginGroupPriority||"web2-first",[I,O,i?.appearance.loginGroupPriority]),W=i?.appearance.hideDirectWeb2Inputs,[Ce,Ie]=z1("default"),[Y,X]=z1($1({accountType:a,sms:u,email:f}));t8(()=>{X($1({accountType:a,sms:u,email:f}))},[f,u,a]);let te=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{Ie("default")},150)};n.current=te;let _e=[];l&&I?_e.push(l):s?.loginMethod&&j.includes(s.loginMethod)&&_e.push(s.loginMethod);let Te=G=>G==="email"?$e(Ec,{isEditable:Y==="email",setIsEditable:()=>{X("email")}},G):G==="sms"?$e(kc,{isEditable:Y==="sms",setIsEditable:()=>{X("sms")}},G):G==="apple"?$e(kt,{provider:"apple"},G):G==="discord"?$e(kt,{provider:"discord"},G):G==="farcaster"?$e(Sc,{},G):G==="github"?$e(kt,{provider:"github"},G):G==="google"?$e(kt,{provider:"google"},G):G==="linkedin"?$e(kt,{provider:"linkedin"},G):G==="tiktok"?$e(kt,{provider:"tiktok"},G):G==="twitter"&&(!r8||i?.loginConfig.twitterOAuthOnMobileEnabled)?$e(kt,{provider:"twitter"},G):G==="telegram"?$e(Ic,{},G):$o([G],r,e,[],i.externalWallets.walletConnect.enabled),Ke=$o(i.appearance.walletList.filter(G=>G!==l),r,e,[...i.appearance.walletList,l],i.externalWallets.walletConnect.enabled),Ge=j.filter(G=>G!==s?.loginMethod).flatMap(Te),mt=_e.flatMap(Te);U==="web3-first"&&Ce==="default"?Ke.unshift(...mt):U==="web2-first"&&Ge.unshift(...mt);let Fe=Ce==="default"?void 0:()=>{Ie("default")},se=j.filter(G=>G!=="email"&&G!=="sms"),Ft=a8({priority:U,email:f,sms:u,social:se}),Wr=s8({priority:U,email:f,sms:u,social:se}),Zr=l8({priority:U}),L=$e(yc,{text:Zr,onClick:()=>Ie("web3-overflow")}),rt=$e(Mc,{text:Ft,icon:Wr,onClick:()=>Ie("web2-overflow")}),Or=W?0:1;return Ki($a,{children:[$e(A,{title:i.appearance.landingHeader,onClose:te,backFn:Fe}),Ce==="default"&&$e(i8,{}),Ce==="default"&&(typeof i.appearance.loginMessage=="string"?$e(fl,{children:i.appearance.loginMessage}):i.appearance.loginMessage),$e(ml,{style:{overflow:"hidden",padding:2},children:Ki(Yt,{children:[Ce==="default"&&U==="web2-first"&&Ki($a,{children:[...Ge.length>4?Ge.slice(0,3):Ge,Ge.length>4&&rt,I&&L]}),Ce==="default"&&U==="web3-first"&&Ki($a,{children:[I&&Ki($a,{children:[...Ke.length>4?Ke.slice(0,3):Ke,Ke.length>4&&L]}),Ge.length>Or&&rt,Ge.length===Or&&Ge[0]]}),Ce==="web2-overflow"&&Ki($a,{children:[...U==="web3-first"?Ge:Ge.slice(3)]}),...Ce==="web3-overflow"?Ke:[],K&&Ce==="default"&&$e(hc,{})]})}),i&&$e(bi,{app:i}),$e(z,{})]})},i8=o8(Cc)`
2290
2290
  margin-bottom: 16px;
2291
- `,t8=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"?"Other socials":t&&r&&o.length>0||t&&o.length>0?"Log in with email or socials":r&&o.length>0?"Log in with sms or socials":t&&r?"Continue with email or sms":t?"Continue with email":r?"Continue with sms":"Log in with a social account",r8=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"||o.length>0?$e(Y7,{}):t&&r?$e(F1,{}):t?$e(K7,{}):r?$e(j7,{}):null,o8=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets",G1=({accountType:e,sms:t,email:r})=>e==="email"&&r?"email":e==="phone"&&t||t&&!r?"sms":"email";import{jsx as V1}from"react/jsx-runtime";var q1=()=>{let{app:e}=P();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?V1(Wc,{connectOnly:!0}):V1(Oc,{connectOnly:!0})};import{jsx as z1}from"react/jsx-runtime";var $1=()=>{let{app:e}=P();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?z1(Wc,{connectOnly:!1}):z1(Oc,{connectOnly:!1})};import n8 from"@heroicons/react/24/outline/EnvelopeIcon";import{Fragment as i8,jsx as an,jsxs as a8}from"react/jsx-runtime";var K1=()=>{let{app:e}=P();return a8(i8,{children:[an(x,{},"header"),an(ne,{}),an(ge,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:an(n8,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),an(Pr,{children:an(vc,{stacked:!0})}),an(ie,{}),an($,{})]})};import s8 from"@heroicons/react/24/outline/PhoneIcon";import{Fragment as l8,jsx as sn,jsxs as c8}from"react/jsx-runtime";var j1=()=>{let{app:e,currentScreen:t,data:r,navigate:o,setModalData:n}=P(),{initLoginWithSms:i}=M();async function a({qualifiedPhoneNumber:l}){try{await i(l),o("AWAITING_PASSWORDLESS_CODE")}catch(s){n({errorModalData:{error:s,previousScreen:r?.errorModalData?.previousScreen||t||"LINK_PHONE_SCREEN"}}),o("ERROR_SCREEN")}}return c8(l8,{children:[sn(x,{},"header"),sn(ne,{}),sn(ge,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:sn(s8,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),sn(Pr,{children:sn(zi,{stacked:!0,onSubmit:a})}),sn(ie,{}),sn($,{})]})};import{Fragment as d8,jsx as $a,jsxs as p8}from"react/jsx-runtime";var Y1=()=>{let{linkingOrConnectingHint:e}=M(),{app:t}=P(),r=e?`Link the wallet with address ${dt(e)} ${t?.name?`to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return p8(d8,{children:[$a(x,{},"header"),$a(ao,{title:"Link your wallet",description:r}),$a(Yt,{children:$a(Ai,{connectOnly:!1})}),$a($,{})]})};import{jsx as Z1,jsxs as u8}from"react/jsx-runtime";var Q1=({style:e,...t})=>u8("svg",{width:"164",height:"164",viewBox:"0 0 164 164",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...e},...t,children:[Z1("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),Z1("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M81.9999 100.788C93.3288 100.788 102.513 91.6043 102.513 80.2754C102.513 68.9465 93.3288 59.7626 81.9999 59.7626C70.671 59.7626 61.4871 68.9465 61.4871 80.2754C61.4871 91.6043 70.671 100.788 81.9999 100.788ZM88.3236 71.8304C88.9093 71.2446 89.8591 71.2446 90.4449 71.8304C91.0307 72.4161 91.0307 73.3659 90.4449 73.9517L84.121 80.2756L90.445 86.5996C91.0308 87.1854 91.0308 88.1351 90.445 88.7209C89.8592 89.3067 88.9095 89.3067 88.3237 88.7209L81.9997 82.3969L75.6756 88.7209C75.0899 89.3067 74.1401 89.3067 73.5543 88.7209C72.9685 88.1351 72.9685 87.1854 73.5543 86.5996L79.8783 80.2756L73.5544 73.9517C72.9686 73.3659 72.9686 72.4161 73.5544 71.8304C74.1402 71.2446 75.09 71.2446 75.6758 71.8304L81.9997 78.1543L88.3236 71.8304Z",fill:"#EC6351"})]});import{Fragment as m8,jsx as ln,jsxs as J1}from"react/jsx-runtime";var X1=()=>{let{closePrivyModal:e}=M(),{navigate:t}=P();return J1(m8,{children:[ln(x,{},"header"),ln(ne,{}),ln(Q1,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),ln(ao,{title:"Could not connect with wallet",description:"Please check that Phantom multichain is enabled and try again.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),J1(Pr,{children:[ln(B,{onClick:()=>t("LANDING"),children:"Try again"}),ln(Ur,{onClick:()=>e(),children:"Cancel"})]}),ln(ie,{}),ln($,{})]})};import Z8 from"@heroicons/react/24/solid/CheckBadgeIcon";import Q8 from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import J8 from"@heroicons/react/24/solid/IdentificationIcon";import X8 from"@heroicons/react/24/solid/PhoneIcon";import eT from"@heroicons/react/24/solid/QuestionMarkCircleIcon";import u2 from"@heroicons/react/24/solid/ShieldCheckIcon";import{useEffect as tT,useState as Ki}from"react";import{useContext as f8}from"react";function Ka(){let{promptMfa:e,init:t,submit:r,cancel:o,mfaMethods:n}=f8(Se);return{promptMfa:e,init:t,submit:r,cancel:o,mfaMethods:n}}import{useContext as h8}from"react";function $r(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:n,submitEnrollmentWithPasskey:i,unenroll:a,enrollInMfa:l}=h8(Se);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:n,submitEnrollmentWithPasskey:i,unenrollWithSms:()=>a("sms"),unenrollWithTotp:()=>a("totp"),unenrollWithPasskey:()=>a("passkey"),showMfaEnrollmentModal:()=>l(!0),closeMfaEnrollmentModal:()=>l(!1)}}import y8 from"styled-components";import{jsx as e2,jsxs as v8}from"react/jsx-runtime";var t2=e=>v8(g8,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...e,children:[e2("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),e2("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M45.2463 20.9106C44.5473 20.2486 43.4527 20.2486 42.7537 20.9106C37.8798 25.5263 31.3034 28.3546 24.0625 28.3546C23.9473 28.3546 23.8323 28.3539 23.7174 28.3525C22.9263 28.3427 22.2202 28.8471 21.9731 29.5987C20.9761 32.6311 20.4375 35.8693 20.4375 39.2297C20.4375 53.5896 30.259 65.651 43.5482 69.0714C43.8446 69.1477 44.1554 69.1477 44.4518 69.0714C57.741 65.651 67.5625 53.5896 67.5625 39.2297C67.5625 35.8693 67.0239 32.6311 66.0269 29.5987C65.7798 28.8471 65.0737 28.3427 64.2826 28.3525C64.1677 28.3539 64.0527 28.3546 63.9375 28.3546C56.6966 28.3546 50.1202 25.5263 45.2463 20.9106ZM52.7249 40.2829C53.3067 39.4683 53.1181 38.3363 52.3035 37.7545C51.4889 37.1726 50.3569 37.3613 49.7751 38.1759L41.9562 49.1223L38.0316 45.1977C37.3238 44.4899 36.1762 44.4899 35.4684 45.1977C34.7605 45.9056 34.7605 47.0532 35.4684 47.761L40.9059 53.1985C41.2826 53.5752 41.806 53.7671 42.337 53.7232C42.868 53.6792 43.3527 53.4039 43.6624 52.9704L52.7249 40.2829Z"})]}),g8=y8.svg`
2291
+ `,a8=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"?"Other socials":t&&r&&o.length>0||t&&o.length>0?"Log in with email or socials":r&&o.length>0?"Log in with sms or socials":t&&r?"Continue with email or sms":t?"Continue with email":r?"Continue with sms":"Log in with a social account",s8=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"||o.length>0?$e(e8,{}):t&&r?$e(V1,{}):t?$e(J7,{}):r?$e(X7,{}):null,l8=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets",$1=({accountType:e,sms:t,email:r})=>e==="email"&&r?"email":e==="phone"&&t||t&&!r?"sms":"email";import{jsx as K1}from"react/jsx-runtime";var j1=()=>{let{app:e}=_();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?K1(Lc,{connectOnly:!0}):K1(Nc,{connectOnly:!0})};import{jsx as Y1}from"react/jsx-runtime";var Z1=()=>{let{app:e}=_();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?Y1(Lc,{connectOnly:!1}):Y1(Nc,{connectOnly:!1})};import c8 from"@heroicons/react/24/outline/EnvelopeIcon";import{Fragment as d8,jsx as ln,jsxs as p8}from"react/jsx-runtime";var Q1=()=>{let{app:e}=_();return p8(d8,{children:[ln(A,{},"header"),ln(re,{}),ln(he,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:ln(c8,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),ln(Xt,{children:ln(wc,{stacked:!0})}),ln(ie,{}),ln(z,{})]})};import u8 from"@heroicons/react/24/outline/PhoneIcon";import{Fragment as m8,jsx as cn,jsxs as f8}from"react/jsx-runtime";var J1=()=>{let{app:e,currentScreen:t,data:r,navigate:o,setModalData:n}=_(),{initLoginWithSms:i}=M();async function a({qualifiedPhoneNumber:l}){try{await i(l),o("AWAITING_PASSWORDLESS_CODE")}catch(s){n({errorModalData:{error:s,previousScreen:r?.errorModalData?.previousScreen||t||"LINK_PHONE_SCREEN"}}),o("ERROR_SCREEN")}}return f8(m8,{children:[cn(A,{},"header"),cn(re,{}),cn(he,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:cn(u8,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),cn(Xt,{children:cn(an,{stacked:!0,onSubmit:a,hideRecent:!0})}),cn(ie,{}),cn(z,{})]})};import{Fragment as h8,jsx as Ka,jsxs as y8}from"react/jsx-runtime";var X1=()=>{let{linkingOrConnectingHint:e}=M(),{app:t}=_(),r=e?`Link the wallet with address ${dt(e)} ${t?.name?`to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return y8(h8,{children:[Ka(A,{},"header"),Ka(ao,{title:"Link your wallet",description:r}),Ka(Yt,{children:Ka(ki,{connectOnly:!1})}),Ka(z,{})]})};import{jsx as e2,jsxs as g8}from"react/jsx-runtime";var t2=({style:e,...t})=>g8("svg",{width:"164",height:"164",viewBox:"0 0 164 164",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...e},...t,children:[e2("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),e2("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M81.9999 100.788C93.3288 100.788 102.513 91.6043 102.513 80.2754C102.513 68.9465 93.3288 59.7626 81.9999 59.7626C70.671 59.7626 61.4871 68.9465 61.4871 80.2754C61.4871 91.6043 70.671 100.788 81.9999 100.788ZM88.3236 71.8304C88.9093 71.2446 89.8591 71.2446 90.4449 71.8304C91.0307 72.4161 91.0307 73.3659 90.4449 73.9517L84.121 80.2756L90.445 86.5996C91.0308 87.1854 91.0308 88.1351 90.445 88.7209C89.8592 89.3067 88.9095 89.3067 88.3237 88.7209L81.9997 82.3969L75.6756 88.7209C75.0899 89.3067 74.1401 89.3067 73.5543 88.7209C72.9685 88.1351 72.9685 87.1854 73.5543 86.5996L79.8783 80.2756L73.5544 73.9517C72.9686 73.3659 72.9686 72.4161 73.5544 71.8304C74.1402 71.2446 75.09 71.2446 75.6758 71.8304L81.9997 78.1543L88.3236 71.8304Z",fill:"#EC6351"})]});import{Fragment as v8,jsx as dn,jsxs as r2}from"react/jsx-runtime";var o2=()=>{let{closePrivyModal:e}=M(),{navigate:t}=_();return r2(v8,{children:[dn(A,{},"header"),dn(re,{}),dn(t2,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),dn(ao,{title:"Could not connect with wallet",description:"Please check that Phantom multichain is enabled and try again.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),r2(Xt,{children:[dn(B,{onClick:()=>t("LANDING"),children:"Try again"}),dn(Ur,{onClick:()=>e(),children:"Cancel"})]}),dn(ie,{}),dn(z,{})]})};import tT from"@heroicons/react/24/solid/CheckBadgeIcon";import rT from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import oT from"@heroicons/react/24/solid/IdentificationIcon";import nT from"@heroicons/react/24/solid/PhoneIcon";import iT from"@heroicons/react/24/solid/QuestionMarkCircleIcon";import y2 from"@heroicons/react/24/solid/ShieldCheckIcon";import{useEffect as aT,useState as ji}from"react";import{useContext as C8}from"react";function ja(){let{promptMfa:e,init:t,submit:r,cancel:o,mfaMethods:n}=C8(Se);return{promptMfa:e,init:t,submit:r,cancel:o,mfaMethods:n}}import{useContext as w8}from"react";function $r(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:n,submitEnrollmentWithPasskey:i,unenroll:a,enrollInMfa:l}=w8(Se);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:n,submitEnrollmentWithPasskey:i,unenrollWithSms:()=>a("sms"),unenrollWithTotp:()=>a("totp"),unenrollWithPasskey:()=>a("passkey"),showMfaEnrollmentModal:()=>l(!0),closeMfaEnrollmentModal:()=>l(!1)}}import b8 from"styled-components";import{jsx as n2,jsxs as T8}from"react/jsx-runtime";var i2=e=>T8(E8,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...e,children:[n2("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),n2("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M45.2463 20.9106C44.5473 20.2486 43.4527 20.2486 42.7537 20.9106C37.8798 25.5263 31.3034 28.3546 24.0625 28.3546C23.9473 28.3546 23.8323 28.3539 23.7174 28.3525C22.9263 28.3427 22.2202 28.8471 21.9731 29.5987C20.9761 32.6311 20.4375 35.8693 20.4375 39.2297C20.4375 53.5896 30.259 65.651 43.5482 69.0714C43.8446 69.1477 44.1554 69.1477 44.4518 69.0714C57.741 65.651 67.5625 53.5896 67.5625 39.2297C67.5625 35.8693 67.0239 32.6311 66.0269 29.5987C65.7798 28.8471 65.0737 28.3427 64.2826 28.3525C64.1677 28.3539 64.0527 28.3546 63.9375 28.3546C56.6966 28.3546 50.1202 25.5263 45.2463 20.9106ZM52.7249 40.2829C53.3067 39.4683 53.1181 38.3363 52.3035 37.7545C51.4889 37.1726 50.3569 37.3613 49.7751 38.1759L41.9562 49.1223L38.0316 45.1977C37.3238 44.4899 36.1762 44.4899 35.4684 45.1977C34.7605 45.9056 34.7605 47.0532 35.4684 47.761L40.9059 53.1985C41.2826 53.5752 41.806 53.7671 42.337 53.7232C42.868 53.6792 43.3527 53.4039 43.6624 52.9704L52.7249 40.2829Z"})]}),E8=b8.svg`
2292
2292
  height: 90px;
2293
2293
  width: 90px;
2294
2294
 
@@ -2299,7 +2299,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2299
2299
  > path {
2300
2300
  fill: white;
2301
2301
  }
2302
- `;import Lp from"@heroicons/react/20/solid/CheckIcon";import C8 from"@heroicons/react/24/outline/ChevronRightIcon";import w8 from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import b8 from"@heroicons/react/24/outline/FingerPrintIcon";import E8 from"@heroicons/react/24/outline/PhoneIcon";import Np from"@heroicons/react/24/outline/TrashIcon";import T8 from"@heroicons/react/24/solid/ShieldCheckIcon";import{Fragment as S8,jsx as xe,jsxs as rr}from"react/jsx-runtime";var r2=({showIntro:e,userMfaMethods:t,appMfaMethods:r,userHasAuthSms:o,isTotpLoading:n,isPasskeyLoading:i,error:a,onClose:l,onBackToIntro:s,handleSelectMethod:c,setRemovingMfaMethod:m})=>{let f=t.reduce((C,g)=>({...C,[g]:!0}),{}),u=r.reduce((C,g)=>({...C,[g]:!0}),{});return rr(S8,{children:[xe(x,{backFn:e?s:void 0,onClose:l},"header"),xe(Me,{children:xe(Ye,{children:xe(T8,{})})}),xe(de,{children:"Choose a verification method"}),t.length>0?xe(ue,{children:"To add or delete verification methods, verification is required."}):xe(ue,{children:"How would you like to verify your identity? You can change this later."}),a&&xe(vl,{style:{marginTop:"1.25rem"},children:a.message}),rr(ml,{children:[(u.totp||f.totp)&&rr(fl,{children:[xe(Ee,{style:{justifyContent:"center"},disabled:f.totp||n,onClick:()=>c("totp"),children:n?xe(nt,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):rr(gl,{children:[rr(yl,{children:[xe(w8,{}),"Authenticator App"]}),f.totp?rr(In,{children:[xe(Lp,{}),"Added"]}):xe(In,{children:"Recommended"})]})}),f.totp&&xe(hl,{onClick:()=>m("totp"),children:xe(Np,{})})]},"totp"),(u.sms||f.sms)&&rr(fl,{children:[xe(Ee,{disabled:f.sms||o,onClick:()=>c("sms"),children:rr(gl,{children:[rr(yl,{children:[xe(E8,{}),"SMS"]}),f.sms&&rr(In,{children:[xe(Lp,{}),"Added"]}),o&&xe(In,{children:"Disabled"})]})}),f.sms&&xe(hl,{onClick:()=>m("sms"),children:xe(Np,{})})]},"sms"),(u.passkey||f.passkey)&&rr(fl,{children:[xe(Ee,{style:{justifyContent:"center"},onClick:()=>c("passkey"),disabled:f.passkey||i,children:i?xe(nt,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):rr(gl,{children:[rr(yl,{children:[xe(b8,{}),"Passkey"]}),f.passkey?rr(In,{children:[xe(Lp,{}),"Added"]}):xe(In,{isAccent:!0,children:xe(C8,{})})]})}),f.passkey&&xe(hl,{onClick:()=>m("passkey"),children:xe(Np,{})})]},"passkey")]}),xe(Z,{})]})};import _8 from"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import P8 from"@heroicons/react/24/outline/ClockIcon";import A8 from"@heroicons/react/24/outline/ShieldCheckIcon";import x8 from"@heroicons/react/24/solid/CheckCircleIcon";import{useMemo as k8,useState as ja}from"react";import Lc from"styled-components";import{Fragment as Dp,jsx as me,jsxs as Mr}from"react/jsx-runtime";var n2=({onComplete:e,onClose:t,onReset:r})=>{let{user:o}=z(),{data:n}=P(),{initLinkWithPasskey:i,linkWithPasskey:a}=M(),{initEnrollmentWithPasskey:l,submitEnrollmentWithPasskey:s}=$r(),[c,m]=ja(!1),[f,u]=ja(!1),[C,g]=ja(!1),[y,b]=ja(null),E=k8(()=>o?.linkedAccounts.filter(R=>R.type==="passkey")??[],[o]),k=()=>{n?.mfaEnrollmentFlow?.onSuccess(),e()},T=async R=>{m(!0);try{await l(),await s({credentialIds:R}),g(!0)}catch(I){b(I)}finally{m(!1)}},A=async()=>{u(!0),b(null);try{await i();let I=(await a())?.linkedAccounts.filter(D=>D.type==="passkey").map(D=>D.credentialId)??[];await T(I)}catch(R){b(R)}finally{u(!1)}};return E.length===0||f?me(R8,{onReset:r,onClose:t,onClick:A,isCreating:f}):C?me(M8,{onClick:k,onClose:k}):y?me(Fn,{error:y,backFn:()=>b(null),onClick:()=>b(null)}):me(I8,{passkeys:E,isSubmitting:c,isCreating:f,onReset:r,onClose:t,onSubmitEnrollment:()=>T(E.map(R=>R.credentialId)),onAddPasskey:A})},R8=({onReset:e,onClose:t,onClick:r,isCreating:o})=>Mr(Dp,{children:[me(x,{backFn:e,onClose:t},"header"),me(Me,{children:Mr(rc,{children:[me(Bn,{}),me(Hn,{})]})}),me(de,{children:"Set up passkey verification"}),Mr(Rn,{children:[Mr(Qt,{children:[me(Zt,{children:me(A8,{})}),"Verify with Touch ID, Face ID, PIN, or hardware key"]}),Mr(Qt,{children:[me(Zt,{children:me(P8,{})}),"Takes seconds to set up and use"]}),Mr(Qt,{children:[me(Zt,{children:me(_8,{})}),"Use your passkey to verify transactions and login to your account"]})]}),me(B,{style:{marginTop:"2.25rem"},onClick:r,loading:o,children:"Add a new passkey"}),me(Z,{})]}),I8=({onReset:e,onClose:t,onAddPasskey:r,onSubmitEnrollment:o,passkeys:n,isSubmitting:i,isCreating:a})=>{let[l,s]=ja(!1),c=l?n.length:n.length>3?2:3;return Mr(Dp,{children:[me(x,{backFn:l?()=>s(!1):e,onClose:t},"header"),!l&&me(Me,{children:Mr(rc,{children:[me(Bn,{}),me(Hn,{})]})}),me(de,{children:"Enable your passkeys for verification"}),Mr(Rn,{children:[n.slice(0,c).map(m=>Mr(W8,{children:[me(O8,{children:N8(m)}),Mr(L8,{children:["Last used: ",m.latestVerifiedAt?.toLocaleString()]})]},m.credentialId)),!l&&n.length>3&&me(o2,{onClick:()=>s(!0),children:"View All"})]}),me(B,{style:{marginTop:"1.5rem"},onClick:o,loading:i,children:"Enable passkeys"}),n.length<5&&me(o2,{style:{marginTop:"0.5rem"},onClick:r,disabled:a,children:a?me(nt,{style:{height:"1rem",width:"1rem",borderWidth:2}}):"Add new passkey"}),me(Z,{})]})},M8=({onClick:e,onClose:t})=>Mr(Dp,{children:[me(x,{onClose:t},"header"),me(Me,{children:me(Ye,{status:"success",children:me(x8,{})})}),me(de,{children:"Passkey verification added"}),me(ue,{children:"From now on, you'll use the passkey whenever you use your Privy wallet."}),me(Tt,{children:me(B,{onClick:e,children:"Done"})}),me(Z,{})]}),W8=Lc.div`
2302
+ `;import Dp from"@heroicons/react/20/solid/CheckIcon";import S8 from"@heroicons/react/24/outline/ChevronRightIcon";import _8 from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import P8 from"@heroicons/react/24/outline/FingerPrintIcon";import A8 from"@heroicons/react/24/outline/PhoneIcon";import Up from"@heroicons/react/24/outline/TrashIcon";import x8 from"@heroicons/react/24/solid/ShieldCheckIcon";import{Fragment as k8,jsx as xe,jsxs as or}from"react/jsx-runtime";var a2=({showIntro:e,userMfaMethods:t,appMfaMethods:r,userHasAuthSms:o,isTotpLoading:n,isPasskeyLoading:i,error:a,onClose:l,onBackToIntro:s,handleSelectMethod:c,setRemovingMfaMethod:m})=>{let f=t.reduce((C,g)=>({...C,[g]:!0}),{}),u=r.reduce((C,g)=>({...C,[g]:!0}),{});return or(k8,{children:[xe(A,{backFn:e?s:void 0,onClose:l},"header"),xe(Me,{children:xe(Ye,{children:xe(x8,{})})}),xe(de,{children:"Choose a verification method"}),t.length>0?xe(ue,{children:"To add or delete verification methods, verification is required."}):xe(ue,{children:"How would you like to verify your identity? You can change this later."}),a&&xe(wl,{style:{marginTop:"1.25rem"},children:a.message}),or(hl,{children:[(u.totp||f.totp)&&or(yl,{children:[xe(Ee,{style:{justifyContent:"center"},disabled:f.totp||n,onClick:()=>c("totp"),children:n?xe(it,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):or(Cl,{children:[or(vl,{children:[xe(_8,{}),"Authenticator App"]}),f.totp?or(Wn,{children:[xe(Dp,{}),"Added"]}):xe(Wn,{children:"Recommended"})]})}),f.totp&&xe(gl,{onClick:()=>m("totp"),children:xe(Up,{})})]},"totp"),(u.sms||f.sms)&&or(yl,{children:[xe(Ee,{disabled:f.sms||o,onClick:()=>c("sms"),children:or(Cl,{children:[or(vl,{children:[xe(A8,{}),"SMS"]}),f.sms&&or(Wn,{children:[xe(Dp,{}),"Added"]}),o&&xe(Wn,{children:"Disabled"})]})}),f.sms&&xe(gl,{onClick:()=>m("sms"),children:xe(Up,{})})]},"sms"),(u.passkey||f.passkey)&&or(yl,{children:[xe(Ee,{style:{justifyContent:"center"},onClick:()=>c("passkey"),disabled:f.passkey||i,children:i?xe(it,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):or(Cl,{children:[or(vl,{children:[xe(P8,{}),"Passkey"]}),f.passkey?or(Wn,{children:[xe(Dp,{}),"Added"]}):xe(Wn,{isAccent:!0,children:xe(S8,{})})]})}),f.passkey&&xe(gl,{onClick:()=>m("passkey"),children:xe(Up,{})})]},"passkey")]}),xe(Z,{})]})};import R8 from"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import I8 from"@heroicons/react/24/outline/ClockIcon";import M8 from"@heroicons/react/24/outline/ShieldCheckIcon";import W8 from"@heroicons/react/24/solid/CheckCircleIcon";import{useMemo as O8,useState as Ya}from"react";import Dc from"styled-components";import{Fragment as Fp,jsx as me,jsxs as Mr}from"react/jsx-runtime";var l2=({onComplete:e,onClose:t,onReset:r})=>{let{user:o}=q(),{data:n}=_(),{initLinkWithPasskey:i,linkWithPasskey:a}=M(),{initEnrollmentWithPasskey:l,submitEnrollmentWithPasskey:s}=$r(),[c,m]=Ya(!1),[f,u]=Ya(!1),[C,g]=Ya(!1),[y,b]=Ya(null),T=O8(()=>o?.linkedAccounts.filter(R=>R.type==="passkey")??[],[o]),k=()=>{n?.mfaEnrollmentFlow?.onSuccess(),e()},S=async R=>{m(!0);try{await l(),await s({credentialIds:R}),g(!0)}catch(I){b(I)}finally{m(!1)}},x=async()=>{u(!0),b(null);try{await i();let I=(await a())?.linkedAccounts.filter(D=>D.type==="passkey").map(D=>D.credentialId)??[];await S(I)}catch(R){b(R)}finally{u(!1)}};return T.length===0||f?me(L8,{onReset:r,onClose:t,onClick:x,isCreating:f}):C?me(D8,{onClick:k,onClose:k}):y?me(Hn,{error:y,backFn:()=>b(null),onClick:()=>b(null)}):me(N8,{passkeys:T,isSubmitting:c,isCreating:f,onReset:r,onClose:t,onSubmitEnrollment:()=>S(T.map(R=>R.credentialId)),onAddPasskey:x})},L8=({onReset:e,onClose:t,onClick:r,isCreating:o})=>Mr(Fp,{children:[me(A,{backFn:e,onClose:t},"header"),me(Me,{children:Mr(nc,{children:[me(Gn,{}),me(Vn,{})]})}),me(de,{children:"Set up passkey verification"}),Mr(Mn,{children:[Mr(Qt,{children:[me(Zt,{children:me(M8,{})}),"Verify with Touch ID, Face ID, PIN, or hardware key"]}),Mr(Qt,{children:[me(Zt,{children:me(I8,{})}),"Takes seconds to set up and use"]}),Mr(Qt,{children:[me(Zt,{children:me(R8,{})}),"Use your passkey to verify transactions and login to your account"]})]}),me(B,{style:{marginTop:"2.25rem"},onClick:r,loading:o,children:"Add a new passkey"}),me(Z,{})]}),N8=({onReset:e,onClose:t,onAddPasskey:r,onSubmitEnrollment:o,passkeys:n,isSubmitting:i,isCreating:a})=>{let[l,s]=Ya(!1),c=l?n.length:n.length>3?2:3;return Mr(Fp,{children:[me(A,{backFn:l?()=>s(!1):e,onClose:t},"header"),!l&&me(Me,{children:Mr(nc,{children:[me(Gn,{}),me(Vn,{})]})}),me(de,{children:"Enable your passkeys for verification"}),Mr(Mn,{children:[n.slice(0,c).map(m=>Mr(U8,{children:[me(F8,{children:H8(m)}),Mr(B8,{children:["Last used: ",m.latestVerifiedAt?.toLocaleString()]})]},m.credentialId)),!l&&n.length>3&&me(s2,{onClick:()=>s(!0),children:"View All"})]}),me(B,{style:{marginTop:"1.5rem"},onClick:o,loading:i,children:"Enable passkeys"}),n.length<5&&me(s2,{style:{marginTop:"0.5rem"},onClick:r,disabled:a,children:a?me(it,{style:{height:"1rem",width:"1rem",borderWidth:2}}):"Add new passkey"}),me(Z,{})]})},D8=({onClick:e,onClose:t})=>Mr(Fp,{children:[me(A,{onClose:t},"header"),me(Me,{children:me(Ye,{status:"success",children:me(W8,{})})}),me(de,{children:"Passkey verification added"}),me(ue,{children:"From now on, you'll use the passkey whenever you use your Privy wallet."}),me(Tt,{children:me(B,{onClick:e,children:"Done"})}),me(Z,{})]}),U8=Dc.div`
2303
2303
  && {
2304
2304
  padding: 0.75rem 1rem;
2305
2305
  text-align: left;
@@ -2307,19 +2307,19 @@ You will need this password to access your ${e} wallet on a new device. Please k
2307
2307
  border: 1px solid var(--privy-color-foreground-4);
2308
2308
  width: 100%;
2309
2309
  }
2310
- `,O8=Lc.div`
2310
+ `,F8=Dc.div`
2311
2311
  font-size: 0.875rem;
2312
2312
  line-height: 1.375rem;
2313
2313
  font-weight: 500;
2314
2314
 
2315
2315
  color: var(--privy-color-foreground-1);
2316
- `,L8=Lc.div`
2316
+ `,B8=Dc.div`
2317
2317
  font-size: 0.75rem;
2318
2318
  font-weight: 400;
2319
2319
  line-height: 1.125rem;
2320
2320
 
2321
2321
  color: var(--privy-color-foreground-2);
2322
- `,N8=e=>e.authenticatorName?e.createdWithBrowser?`${e.authenticatorName} on ${e.createdWithBrowser}`:e.authenticatorName:e.createdWithBrowser?e.createdWithOs?`${e.createdWithBrowser} on ${e.createdWithOs}`:`${e.createdWithBrowser}`:"Unknown device",o2=Lc.button`
2322
+ `,H8=e=>e.authenticatorName?e.createdWithBrowser?`${e.authenticatorName} on ${e.createdWithBrowser}`:e.authenticatorName:e.createdWithBrowser?e.createdWithOs?`${e.createdWithBrowser} on ${e.createdWithOs}`:`${e.createdWithBrowser}`:"Unknown device",s2=Dc.button`
2323
2323
  && {
2324
2324
  width: 100%;
2325
2325
  font-size: 0.875rem;
@@ -2344,7 +2344,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2344
2344
  box-shadow: none;
2345
2345
  }
2346
2346
  }
2347
- `;import z8 from"@heroicons/react/24/solid/CheckCircleIcon";import s2 from"@heroicons/react/24/solid/PhoneIcon";import{useState as Nc}from"react";import{useState as Up}from"react";import{isMobile as D8}from"react-device-detect";import a2 from"styled-components";import{Fragment as q8,jsx as Ya,jsxs as V8}from"react/jsx-runtime";var Za=6,U8=new Array(Za).fill("");function F8(e){return e.replace(/\s+/g,"")}function Fp(e){return/^[0-9]{1}$/.test(e)}function i2(e){return e.length===Za&&e.every(Fp)}function B8(e,t){return e.reduce((r,o)=>r+Number(t(o)),0)}var zn=({onChange:e,disabled:t,errorReasonOverride:r,success:o})=>{let[n,i]=Up(U8),[a,l]=Up(null),[s,c]=Up(null),m=async g=>{g.preventDefault();let y=F8(g.currentTarget.value);if(y==="")return;let b=B8(n,Fp),E=y.split(""),k=!E.every(Fp),T=E.length+b>Za;if(k){l("Passcode can only be numbers"),c(1);return}if(T){l("Passcode must be exactly 6 numbers"),c(1);return}l(null),c(null);let A=Number(g.currentTarget.name?.charAt(4)),R=[...y||[""]].slice(0,Za-A),I=[...n.slice(0,A),...R,...n.slice(A+R.length)];i(I);let D=R.length,H=Math.min(Math.max(A+D,0),Za-1);if(document.querySelector(`input[name=pin-${H}]`)?.focus(),i2(I))try{await e(I.join("")),document.querySelector(`input[name=pin-${H}]`)?.blur()}catch(j){c(1),l(j.message)}else try{await e(null)}catch(j){c(1),l(j.message)}},f=g=>{s===1&&(l(null),c(null));let y=[...n.slice(0,g),"",...n.slice(g+1)];i(y),g>0&&document.querySelector(`input[name=pin-${g-1}]`)?.focus(),i2(y)?e(y.join("")):e(null)},C=o?"success":!!(r||a)?"fail":"";return Ya(q8,{children:V8(H8,{children:[Ya("div",{children:n.map((g,y)=>Ya("input",{name:`pin-${y}`,type:"text",value:n[y],onChange:m,onKeyUp:b=>{b.key==="Backspace"&&f(y)},inputMode:"numeric",autoFocus:y===0,pattern:"[0-9]",className:C,autoComplete:D8?"one-time-code":"off",disabled:t},y))}),Ya("div",{children:Ya(G8,{fail:!!r||!!a,children:r||a})})]})})},H8=a2.div`
2347
+ `;import Z8 from"@heroicons/react/24/solid/CheckCircleIcon";import p2 from"@heroicons/react/24/solid/PhoneIcon";import{useState as Uc}from"react";import{useState as Bp}from"react";import{isMobile as G8}from"react-device-detect";import d2 from"styled-components";import{Fragment as Y8,jsx as Za,jsxs as j8}from"react/jsx-runtime";var Qa=6,V8=new Array(Qa).fill("");function q8(e){return e.replace(/\s+/g,"")}function Hp(e){return/^[0-9]{1}$/.test(e)}function c2(e){return e.length===Qa&&e.every(Hp)}function z8(e,t){return e.reduce((r,o)=>r+Number(t(o)),0)}var Kn=({onChange:e,disabled:t,errorReasonOverride:r,success:o})=>{let[n,i]=Bp(V8),[a,l]=Bp(null),[s,c]=Bp(null),m=async g=>{g.preventDefault();let y=q8(g.currentTarget.value);if(y==="")return;let b=z8(n,Hp),T=y.split(""),k=!T.every(Hp),S=T.length+b>Qa;if(k){l("Passcode can only be numbers"),c(1);return}if(S){l("Passcode must be exactly 6 numbers"),c(1);return}l(null),c(null);let x=Number(g.currentTarget.name?.charAt(4)),R=[...y||[""]].slice(0,Qa-x),I=[...n.slice(0,x),...R,...n.slice(x+R.length)];i(I);let D=R.length,H=Math.min(Math.max(x+D,0),Qa-1);if(document.querySelector(`input[name=pin-${H}]`)?.focus(),c2(I))try{await e(I.join("")),document.querySelector(`input[name=pin-${H}]`)?.blur()}catch(j){c(1),l(j.message)}else try{await e(null)}catch(j){c(1),l(j.message)}},f=g=>{s===1&&(l(null),c(null));let y=[...n.slice(0,g),"",...n.slice(g+1)];i(y),g>0&&document.querySelector(`input[name=pin-${g-1}]`)?.focus(),c2(y)?e(y.join("")):e(null)},C=o?"success":!!(r||a)?"fail":"";return Za(Y8,{children:j8($8,{children:[Za("div",{children:n.map((g,y)=>Za("input",{name:`pin-${y}`,type:"text",value:n[y],onChange:m,onKeyUp:b=>{b.key==="Backspace"&&f(y)},inputMode:"numeric",autoFocus:y===0,pattern:"[0-9]",className:C,autoComplete:G8?"one-time-code":"off",disabled:t},y))}),Za("div",{children:Za(K8,{fail:!!r||!!a,children:r||a})})]})})},$8=d2.div`
2348
2348
  display: flex;
2349
2349
  flex-direction: column;
2350
2350
  width: 100%;
@@ -2412,7 +2412,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2412
2412
  transform: translate(1px, 0px);
2413
2413
  }
2414
2414
  }
2415
- `,G8=a2.div`
2415
+ `,K8=d2.div`
2416
2416
  line-height: 20px;
2417
2417
  font-size: 13px;
2418
2418
  display: flex;
@@ -2420,7 +2420,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2420
2420
  width: 100%;
2421
2421
 
2422
2422
  color: ${e=>e.fail?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
2423
- `;import{Fragment as Bp,jsx as Ue,jsxs as $n}from"react/jsx-runtime";var l2=({onComplete:e,onReset:t,onClose:r})=>{let[o,n]=Nc(""),[i,a]=Nc(!1),[l,s]=Nc(null),[c,m]=Nc("enroll"),{initEnrollmentWithSms:f,submitEnrollmentWithSms:u}=$r(),{app:C,data:g}=P();function y(){g?.mfaEnrollmentFlow?.onSuccess(),e()}async function b({qualifiedPhoneNumber:T}){try{await f({phoneNumber:T}),n(T),m("verify")}catch(A){s(A)}}async function E(T){try{if(!T)return;await u({phoneNumber:o,mfaCode:T}),a(!0)}catch(A){throw Ml(A)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):Dn(A)?new Error("The code you entered is not valid"):Nn(A)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Wl(A)?new Error("Verification canceled"):new Error("Unknown error")}}function k(){c==="verify"?m("enroll"):t()}return l?Ue(Fn,{error:l,backFn:()=>s(null),onClick:()=>s(null)}):c==="enroll"?$n(Bp,{children:[Ue(x,{backFn:t,onClose:r},"header"),Ue(Me,{children:Ue(Ye,{children:Ue(s2,{})})}),Ue(de,{children:"Set up SMS verification"}),Ue(ue,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),$n(_r,{children:[Ue(zi,{onSubmit:b}),$n(ph,{children:["By providing your mobile number, you agree to receive text messages from ",C?.name,". Some carrier charges may apply"]})]}),Ue(Z,{})]}):i?$n(Bp,{children:[Ue(x,{onClose:y},"header"),Ue(Me,{children:Ue(Ye,{status:"success",children:Ue(z8,{})})}),Ue(de,{children:"SMS verification added"}),Ue(ue,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),Ue(Tt,{children:Ue(B,{onClick:y,children:"Done"})}),Ue(Z,{})]}):$n(Bp,{children:[Ue(x,{backFn:k,onClose:r},"header"),Ue(Me,{children:Ue(Ye,{children:Ue(s2,{})})}),Ue(de,{children:"Enter enrollment code"}),$n(_r,{children:[Ue(zn,{onChange:E}),$n(ue,{children:["To continue, enter the 6-digit code sent to ",Ue("strong",{children:A1(o)})]})]}),Ue(Z,{})]})};import j8 from"@heroicons/react/24/solid/CheckCircleIcon";import Y8 from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import{useState as d2}from"react";import $8 from"@heroicons/react/24/solid/ShieldCheckIcon";import{jsx as K8}from"react/jsx-runtime";var c2=({size:e,authUrl:t})=>K8(Xo,{url:t,squareLogoElement:$8,size:e,fgColor:"#1F1F1F"});import{Fragment as Hp,jsx as Oe,jsxs as Qa}from"react/jsx-runtime";var p2=({onComplete:e,onClose:t,onReset:r,totpInfo:o})=>{let[n,i]=d2("enroll"),[a,l]=d2(!1),{submitEnrollmentWithTotp:s}=$r(),{data:c}=P();function m(){c?.mfaEnrollmentFlow?.onSuccess(),e()}function f(){i("verify")}async function u(g){try{if(!g)return;await s({mfaCode:g}),l(!0)}catch(y){throw Ml(y)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):Dn(y)?new Error("The code you entered is not valid"):Nn(y)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Wl(y)?new Error("Verification canceled"):new Error("Unknown error")}}function C(){n==="verify"?i("enroll"):r()}return n==="enroll"?Qa(Hp,{children:[Oe(x,{backFn:r,onClose:t},"header"),Oe(de,{children:"Scan QR code"}),Oe(ue,{children:"Open your authenticator app and scan the QR code to continue."}),Oe(wi,{children:Oe(c2,{authUrl:o.authUrl,size:200})}),Qa(Tt,{children:[Oe(wt,{children:Oe(Jo,{itemName:"secret",text:o.secret})}),Oe(B,{onClick:f,children:"Continue"})]}),Oe(Z,{})]}):a?Qa(Hp,{children:[Oe(x,{onClose:m},"header"),Oe(Me,{children:Oe(Ye,{status:"success",children:Oe(j8,{})})}),Oe(de,{children:"Authenticator app verification added"}),Oe(ue,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),Oe(Tt,{children:Oe(B,{onClick:m,children:"Done"})}),Oe(Z,{})]}):Qa(Hp,{children:[Oe(x,{backFn:C,onClose:t},"header"),Oe(Me,{children:Oe(Ye,{children:Oe(Y8,{})})}),Oe(de,{children:"Enter enrollment code"}),Oe(_r,{children:Oe(zn,{onChange:u})}),Qa(ue,{children:["To continue, enter the 6-digit code generated from your ",Oe("strong",{children:"authenticator app"})]}),Oe(Z,{})]})};import{Fragment as ji,jsx as J,jsxs as gr}from"react/jsx-runtime";var m2=()=>{let{user:e,enrollInMfa:t}=z(),[r,o]=Ki(null),{unenrollWithSms:n,unenrollWithTotp:i,unenrollWithPasskey:a}=$r(),{app:l,ready:s,data:c,onUserCloseViaDialogOrKeybindRef:m}=P(),{closePrivyModal:f}=M(),{promptMfa:u}=Ka(),{initEnrollmentWithTotp:C}=$r(),[g,y]=Ki(!1),[b,E]=Ki(null),[k,T]=Ki(null),A=()=>{f({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{o(null),E(null)},500)},{initEnrollmentWithPasskey:R,submitEnrollmentWithPasskey:I}=$r(),[D,H]=Ki(!1),[K,j]=Ki(null);m.current=A;let O=e?.mfaMethods.includes("sms"),U=!!e?.phone,W=e?.mfaMethods.includes("totp"),Ce=e?.mfaMethods.includes("passkey"),Ie=O||W||Ce,Y=e?.linkedAccounts.filter(se=>se.type==="passkey").map(se=>se.credentialId)??[];tT(()=>{Ie&&y(!0)},[Ie]);function X(){o(null),E(null)}function te(){y(!1)}async function _e(){H(!0);try{await R(),await I({credentialIds:Y})}catch(se){j(se)}finally{H(!1)}}async function Te(se){if(await u().catch(j),se==="totp"){E(se),T(null),C().then(Ft=>{T(Ft)}).catch(()=>{T(null),X()});return}if(se==="passkey"&&Y.length===1)return await _e();E(se)}if(!s||!e||!l)return gr(ji,{children:[J(x,{onClose:A},"header"),J(Me,{children:J(t2,{})}),J(_r,{children:J(nt,{})}),J(Z,{})]});async function Ke(){o(null);try{await n()}catch{o(null)}}async function Ge(){o(null);try{await i()}catch{o(null)}}async function mt(){o(null);try{await u(),await a()}catch{o(null)}}if(r==="sms")return gr(ji,{children:[J(x,{backFn:X,onClose:A},"header"),J(Me,{children:J(Ye,{children:J(X8,{})})}),J(de,{children:"Remove SMS verification?"}),gr(ue,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),J(Tt,{children:J(B,{warn:!0,onClick:Ke,children:"Remove SMS for MFA"})}),J(Z,{})]});if(r==="totp")return gr(ji,{children:[J(x,{backFn:X,onClose:A},"header"),J(Me,{children:J(Ye,{children:J(Q8,{})})}),J(de,{children:"Remove Authenticator App verification?"}),gr(ue,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),J(Tt,{children:J(B,{warn:!0,onClick:Ge,children:"Remove Authenticator App for MFA"})}),J(Z,{})]});if(r==="passkey")return gr(ji,{children:[J(x,{backFn:X,onClose:A},"header"),J(Me,{children:J(Ye,{children:J(eT,{})})}),J(de,{children:"Are you sure you want to remove passkey verification?"}),J(ue,{children:"This will disable any passkeys you have set up for verification. You\u2019ll still be able to login with your passkeys if you\u2019ve set up passkey login."}),J(Tt,{children:J(B,{warn:!0,onClick:mt,children:"Yes, remove"})}),J(Z,{})]});if(c.mfaEnrollmentFlow.mfaMethods.length===0&&!Ie)return gr(ji,{children:[J(x,{onClose:A},"header"),J(Me,{children:J(Ye,{children:J(u2,{})})}),J(de,{children:"Add more security"}),gr(ue,{children:[l?.name," does not have any verification methods enabled."]}),J(Tt,{children:J(B,{onClick:A,children:"Close"})}),J(Z,{})]});let Fe=!Ie&&!g;return Fe?gr(ji,{children:[J(x,{onClose:A},"header"),J(Me,{children:J(Ye,{children:J(u2,{})})}),J(de,{children:"Transaction Protection"}),J(ue,{children:"Set up transaction protection to add an extra layer of security to your account"}),gr(Rn,{children:[gr(Qt,{children:[J(Zt,{children:J(Z8,{})}),"Enable 2-Step verification for your ",l?.name," wallet."]}),gr(Qt,{children:[J(Zt,{children:J(J8,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),gr(Tt,{children:[J(B,{onClick:()=>y(!0),children:"Continue"}),J(Ur,{onClick:A,children:"Not now"})]}),J(Z,{})]}):b==="sms"?J(l2,{onComplete:A,onReset:X,onClose:A}):b==="totp"&&k?J(p2,{onComplete:A,onClose:A,onReset:X,totpInfo:k}):b==="passkey"?J(n2,{onComplete:A,onReset:X,onClose:A}):J(r2,{showIntro:Fe,userMfaMethods:e.mfaMethods,appMfaMethods:l.mfa.methods,userHasAuthSms:U,onBackToIntro:te,handleSelectMethod:Te,isTotpLoading:b==="totp"&&!k,isPasskeyLoading:D,error:K,onClose:A,setRemovingMfaMethod:o})};import OT from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import LT from"@heroicons/react/24/outline/FingerPrintIcon";import NT from"@heroicons/react/24/outline/PhoneIcon";import DT from"@heroicons/react/24/outline/ShieldCheckIcon";import UT from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import FT from"@heroicons/react/24/solid/PhoneIcon";import{useEffect as BT,useState as es}from"react";import{useMemo as _T,useEffect as PT,useState as L2}from"react";import AT from"styled-components";import{calculateTotalGasEstimate as xT,populateTransactionRequest as kT}from"@privy-io/js-sdk-core";import W2 from"styled-components";import h2 from"styled-components";import{jsx as f2,jsxs as nT}from"react/jsx-runtime";var Dc=({label:e,children:t,valueStyles:r})=>nT(rT,{children:[f2("div",{children:e}),f2(oT,{style:{...r},children:t})]}),rT=h2.div`
2423
+ `;import{Fragment as Gp,jsx as Ue,jsxs as jn}from"react/jsx-runtime";var u2=({onComplete:e,onReset:t,onClose:r})=>{let[o,n]=Uc(""),[i,a]=Uc(!1),[l,s]=Uc(null),[c,m]=Uc("enroll"),{initEnrollmentWithSms:f,submitEnrollmentWithSms:u}=$r(),{app:C,data:g}=_();function y(){g?.mfaEnrollmentFlow?.onSuccess(),e()}async function b({qualifiedPhoneNumber:S}){try{await f({phoneNumber:S}),n(S),m("verify")}catch(x){s(x)}}async function T(S){try{if(!S)return;await u({phoneNumber:o,mfaCode:S}),a(!0)}catch(x){throw Ol(x)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):Fn(x)?new Error("The code you entered is not valid"):Un(x)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Ll(x)?new Error("Verification canceled"):new Error("Unknown error")}}function k(){c==="verify"?m("enroll"):t()}return l?Ue(Hn,{error:l,backFn:()=>s(null),onClick:()=>s(null)}):c==="enroll"?jn(Gp,{children:[Ue(A,{backFn:t,onClose:r},"header"),Ue(Me,{children:Ue(Ye,{children:Ue(p2,{})})}),Ue(de,{children:"Set up SMS verification"}),Ue(ue,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),jn(Pr,{children:[Ue(an,{onSubmit:b,hideRecent:!0}),jn(hh,{children:["By providing your mobile number, you agree to receive text messages from ",C?.name,". Some carrier charges may apply"]})]}),Ue(Z,{})]}):i?jn(Gp,{children:[Ue(A,{onClose:y},"header"),Ue(Me,{children:Ue(Ye,{status:"success",children:Ue(Z8,{})})}),Ue(de,{children:"SMS verification added"}),Ue(ue,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),Ue(Tt,{children:Ue(B,{onClick:y,children:"Done"})}),Ue(Z,{})]}):jn(Gp,{children:[Ue(A,{backFn:k,onClose:r},"header"),Ue(Me,{children:Ue(Ye,{children:Ue(p2,{})})}),Ue(de,{children:"Enter enrollment code"}),jn(Pr,{children:[Ue(Kn,{onChange:T}),jn(ue,{children:["To continue, enter the 6-digit code sent to ",Ue("strong",{children:I1(o)})]})]}),Ue(Z,{})]})};import X8 from"@heroicons/react/24/solid/CheckCircleIcon";import eT from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import{useState as f2}from"react";import Q8 from"@heroicons/react/24/solid/ShieldCheckIcon";import{jsx as J8}from"react/jsx-runtime";var m2=({size:e,authUrl:t})=>J8(en,{url:t,squareLogoElement:Q8,size:e,fgColor:"#1F1F1F"});import{Fragment as Vp,jsx as Oe,jsxs as Ja}from"react/jsx-runtime";var h2=({onComplete:e,onClose:t,onReset:r,totpInfo:o})=>{let[n,i]=f2("enroll"),[a,l]=f2(!1),{submitEnrollmentWithTotp:s}=$r(),{data:c}=_();function m(){c?.mfaEnrollmentFlow?.onSuccess(),e()}function f(){i("verify")}async function u(g){try{if(!g)return;await s({mfaCode:g}),l(!0)}catch(y){throw Ol(y)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):Fn(y)?new Error("The code you entered is not valid"):Un(y)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Ll(y)?new Error("Verification canceled"):new Error("Unknown error")}}function C(){n==="verify"?i("enroll"):r()}return n==="enroll"?Ja(Vp,{children:[Oe(A,{backFn:r,onClose:t},"header"),Oe(de,{children:"Scan QR code"}),Oe(ue,{children:"Open your authenticator app and scan the QR code to continue."}),Oe(Ei,{children:Oe(m2,{authUrl:o.authUrl,size:200})}),Ja(Tt,{children:[Oe(wt,{children:Oe(Xo,{itemName:"secret",text:o.secret})}),Oe(B,{onClick:f,children:"Continue"})]}),Oe(Z,{})]}):a?Ja(Vp,{children:[Oe(A,{onClose:m},"header"),Oe(Me,{children:Oe(Ye,{status:"success",children:Oe(X8,{})})}),Oe(de,{children:"Authenticator app verification added"}),Oe(ue,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),Oe(Tt,{children:Oe(B,{onClick:m,children:"Done"})}),Oe(Z,{})]}):Ja(Vp,{children:[Oe(A,{backFn:C,onClose:t},"header"),Oe(Me,{children:Oe(Ye,{children:Oe(eT,{})})}),Oe(de,{children:"Enter enrollment code"}),Oe(Pr,{children:Oe(Kn,{onChange:u})}),Ja(ue,{children:["To continue, enter the 6-digit code generated from your ",Oe("strong",{children:"authenticator app"})]}),Oe(Z,{})]})};import{Fragment as Yi,jsx as J,jsxs as vr}from"react/jsx-runtime";var g2=()=>{let{user:e,enrollInMfa:t}=q(),[r,o]=ji(null),{unenrollWithSms:n,unenrollWithTotp:i,unenrollWithPasskey:a}=$r(),{app:l,ready:s,data:c,onUserCloseViaDialogOrKeybindRef:m}=_(),{closePrivyModal:f}=M(),{promptMfa:u}=ja(),{initEnrollmentWithTotp:C}=$r(),[g,y]=ji(!1),[b,T]=ji(null),[k,S]=ji(null),x=()=>{f({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{o(null),T(null)},500)},{initEnrollmentWithPasskey:R,submitEnrollmentWithPasskey:I}=$r(),[D,H]=ji(!1),[K,j]=ji(null);m.current=x;let O=e?.mfaMethods.includes("sms"),U=!!e?.phone,W=e?.mfaMethods.includes("totp"),Ce=e?.mfaMethods.includes("passkey"),Ie=O||W||Ce,Y=e?.linkedAccounts.filter(se=>se.type==="passkey").map(se=>se.credentialId)??[];aT(()=>{Ie&&y(!0)},[Ie]);function X(){o(null),T(null)}function te(){y(!1)}async function _e(){H(!0);try{await R(),await I({credentialIds:Y})}catch(se){j(se)}finally{H(!1)}}async function Te(se){if(await u().catch(j),se==="totp"){T(se),S(null),C().then(Ft=>{S(Ft)}).catch(()=>{S(null),X()});return}if(se==="passkey"&&Y.length===1)return await _e();T(se)}if(!s||!e||!l)return vr(Yi,{children:[J(A,{onClose:x},"header"),J(Me,{children:J(i2,{})}),J(Pr,{children:J(it,{})}),J(Z,{})]});async function Ke(){o(null);try{await n()}catch{o(null)}}async function Ge(){o(null);try{await i()}catch{o(null)}}async function mt(){o(null);try{await u(),await a()}catch{o(null)}}if(r==="sms")return vr(Yi,{children:[J(A,{backFn:X,onClose:x},"header"),J(Me,{children:J(Ye,{children:J(nT,{})})}),J(de,{children:"Remove SMS verification?"}),vr(ue,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),J(Tt,{children:J(B,{warn:!0,onClick:Ke,children:"Remove SMS for MFA"})}),J(Z,{})]});if(r==="totp")return vr(Yi,{children:[J(A,{backFn:X,onClose:x},"header"),J(Me,{children:J(Ye,{children:J(rT,{})})}),J(de,{children:"Remove Authenticator App verification?"}),vr(ue,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),J(Tt,{children:J(B,{warn:!0,onClick:Ge,children:"Remove Authenticator App for MFA"})}),J(Z,{})]});if(r==="passkey")return vr(Yi,{children:[J(A,{backFn:X,onClose:x},"header"),J(Me,{children:J(Ye,{children:J(iT,{})})}),J(de,{children:"Are you sure you want to remove passkey verification?"}),J(ue,{children:"This will disable any passkeys you have set up for verification. You\u2019ll still be able to login with your passkeys if you\u2019ve set up passkey login."}),J(Tt,{children:J(B,{warn:!0,onClick:mt,children:"Yes, remove"})}),J(Z,{})]});if(c.mfaEnrollmentFlow.mfaMethods.length===0&&!Ie)return vr(Yi,{children:[J(A,{onClose:x},"header"),J(Me,{children:J(Ye,{children:J(y2,{})})}),J(de,{children:"Add more security"}),vr(ue,{children:[l?.name," does not have any verification methods enabled."]}),J(Tt,{children:J(B,{onClick:x,children:"Close"})}),J(Z,{})]});let Fe=!Ie&&!g;return Fe?vr(Yi,{children:[J(A,{onClose:x},"header"),J(Me,{children:J(Ye,{children:J(y2,{})})}),J(de,{children:"Transaction Protection"}),J(ue,{children:"Set up transaction protection to add an extra layer of security to your account"}),vr(Mn,{children:[vr(Qt,{children:[J(Zt,{children:J(tT,{})}),"Enable 2-Step verification for your ",l?.name," wallet."]}),vr(Qt,{children:[J(Zt,{children:J(oT,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),vr(Tt,{children:[J(B,{onClick:()=>y(!0),children:"Continue"}),J(Ur,{onClick:x,children:"Not now"})]}),J(Z,{})]}):b==="sms"?J(u2,{onComplete:x,onReset:X,onClose:x}):b==="totp"&&k?J(h2,{onComplete:x,onClose:x,onReset:X,totpInfo:k}):b==="passkey"?J(l2,{onComplete:x,onReset:X,onClose:x}):J(a2,{showIntro:Fe,userMfaMethods:e.mfaMethods,appMfaMethods:l.mfa.methods,userHasAuthSms:U,onBackToIntro:te,handleSelectMethod:Te,isTotpLoading:b==="totp"&&!k,isPasskeyLoading:D,error:K,onClose:x,setRemovingMfaMethod:o})};import FT from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import BT from"@heroicons/react/24/outline/FingerPrintIcon";import HT from"@heroicons/react/24/outline/PhoneIcon";import GT from"@heroicons/react/24/outline/ShieldCheckIcon";import VT from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import qT from"@heroicons/react/24/solid/PhoneIcon";import{useEffect as zT,useState as ts}from"react";import{useMemo as RT,useEffect as IT,useState as F2}from"react";import MT from"styled-components";import{calculateTotalGasEstimate as WT,populateTransactionRequest as OT}from"@privy-io/js-sdk-core";import D2 from"styled-components";import C2 from"styled-components";import{jsx as v2,jsxs as cT}from"react/jsx-runtime";var Fc=({label:e,children:t,valueStyles:r})=>cT(sT,{children:[v2("div",{children:e}),v2(lT,{style:{...r},children:t})]}),sT=C2.div`
2424
2424
  display: flex;
2425
2425
  align-items: center;
2426
2426
  justify-content: space-between;
@@ -2435,7 +2435,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2435
2435
  color: var(--privy-color-foreground-2);
2436
2436
  text-align: right;
2437
2437
  }
2438
- `,oT=h2.div`
2438
+ `,lT=C2.div`
2439
2439
  font-size: 14px;
2440
2440
  line-height: 100%;
2441
2441
  display: flex;
@@ -2444,28 +2444,28 @@ You will need this password to access your ${e} wallet on a new device. Please k
2444
2444
  border-radius: var(--privy-border-radius-full);
2445
2445
  background-color: var(--privy-color-background-2);
2446
2446
  padding: 4px 8px;
2447
- `;import Fc from"styled-components";import{Fragment as lT,jsx as Uc,jsxs as y2}from"react/jsx-runtime";var g2=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=Oa(e),n=t?mo(o,t):void 0,i=fr(o,r);return Uc(v2,{children:n||i})},Gp=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=Oa(e),n=t?mo(o,t):void 0,i=fr(o,r);return Uc(v2,{children:n?y2(lT,{children:[Uc(iT,{children:"USD"}),n==="<$0.01"?y2(sT,{children:[Uc(aT,{children:"<"}),"$0.01"]}):n]}):i})},v2=Fc.span`
2447
+ `;import Hc from"styled-components";import{Fragment as mT,jsx as Bc,jsxs as w2}from"react/jsx-runtime";var b2=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=La(e),n=t?mo(o,t):void 0,i=hr(o,r);return Bc(E2,{children:n||i})},qp=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=La(e),n=t?mo(o,t):void 0,i=hr(o,r);return Bc(E2,{children:n?w2(mT,{children:[Bc(dT,{children:"USD"}),n==="<$0.01"?w2(uT,{children:[Bc(pT,{children:"<"}),"$0.01"]}):n]}):i})},E2=Hc.span`
2448
2448
  font-size: 14px;
2449
2449
  line-height: 140%;
2450
2450
  display: flex;
2451
2451
  gap: 4px;
2452
2452
  align-items: center;
2453
- `,iT=Fc.span`
2453
+ `,dT=Hc.span`
2454
2454
  font-size: 12px;
2455
2455
  line-height: 12px;
2456
2456
  color: var(--privy-color-foreground-3);
2457
- `,aT=Fc.span`
2457
+ `,pT=Hc.span`
2458
2458
  font-size: 10px;
2459
- `,sT=Fc.span`
2459
+ `,uT=Hc.span`
2460
2460
  display: flex;
2461
2461
  align-items: center;
2462
- `;import Vp from"styled-components";import{QuantityToBigNumber as C2}from"@privy-io/js-sdk-core";import{jsx as cn,jsxs as Bc}from"react/jsx-runtime";var w2=({gas:e,tokenPrice:t,tokenSymbol:r})=>Bc(Vo,{style:{paddingBottom:"12px"},children:[Bc(E2,{children:[cn(S2,{children:"Est. Fees"}),cn("div",{children:cn(Gp,{weiQuantities:[e],tokenPrice:t,tokenSymbol:r})})]}),t&&cn(T2,{children:`${fr(e,r)}`})]}),b2=({transactionData:e,gas:t,tokenPrice:r,tokenSymbol:o})=>{let n=C2(e.value||0).add(C2(t)).toHexString();return Bc(Vo,{children:[Bc(E2,{children:[cn(S2,{children:"Total (including fees)"}),cn("div",{children:cn(Gp,{weiQuantities:[e.value||0,t],tokenPrice:r,tokenSymbol:o})})]}),r&&cn(T2,{children:fr(n,o)})]})},E2=Vp.div`
2462
+ `;import zp from"styled-components";import{QuantityToBigNumber as T2}from"@privy-io/js-sdk-core";import{jsx as pn,jsxs as Gc}from"react/jsx-runtime";var S2=({gas:e,tokenPrice:t,tokenSymbol:r})=>Gc(qo,{style:{paddingBottom:"12px"},children:[Gc(P2,{children:[pn(x2,{children:"Est. Fees"}),pn("div",{children:pn(qp,{weiQuantities:[e],tokenPrice:t,tokenSymbol:r})})]}),t&&pn(A2,{children:`${hr(e,r)}`})]}),_2=({transactionData:e,gas:t,tokenPrice:r,tokenSymbol:o})=>{let n=T2(e.value||0).add(T2(t)).toHexString();return Gc(qo,{children:[Gc(P2,{children:[pn(x2,{children:"Total (including fees)"}),pn("div",{children:pn(qp,{weiQuantities:[e.value||0,t],tokenPrice:r,tokenSymbol:o})})]}),r&&pn(A2,{children:hr(n,o)})]})},P2=zp.div`
2463
2463
  display: flex;
2464
2464
  flex-direction: row;
2465
2465
  justify-content: space-between;
2466
2466
  align-items: center;
2467
2467
  padding-top: 4px;
2468
- `,T2=Vp.div`
2468
+ `,A2=zp.div`
2469
2469
  display: flex;
2470
2470
  flex-direction: row;
2471
2471
  height: 12px;
@@ -2474,23 +2474,23 @@ You will need this password to access your ${e} wallet on a new device. Please k
2474
2474
  line-height: 12px;
2475
2475
  color: var(--privy-color-foreground-3);
2476
2476
  font-weight: 400;
2477
- `,S2=Vp.div`
2477
+ `,x2=zp.div`
2478
2478
  font-size: 14px;
2479
2479
  line-height: 22.4px;
2480
2480
  font-weight: 400;
2481
- `;import cT from"@heroicons/react/24/outline/ChevronDownIcon";import{useContext as Kn,useState as dT}from"react";import dn from"styled-components";import{createContext as _2,useContext as EX}from"react";var Yi=_2(void 0);var Ja=_2(void 0);import{Fragment as vT,jsx as Kr,jsxs as P2}from"react/jsx-runtime";var A2=({defaultValue:e,children:t})=>{let[r,o]=dT(e||null),n=i=>{o(r===i?null:i)};return Kr(Yi.Provider,{value:{activePanel:r,togglePanel:n},children:Kr(pT,{children:t})})},x2=({value:e,children:t})=>{let{activePanel:r,togglePanel:o}=Kn(Yi),n=r===e;return Kr(Ja.Provider,{value:{onToggle:()=>o(e),value:e},children:Kr(hT,{isActive:n,"data-open":n,children:t})})},k2=({children:e})=>{let{activePanel:t}=Kn(Yi),{onToggle:r,value:o}=Kn(Ja),n=t===o;return P2(vT,{children:[P2(uT,{onClick:r,"data-open":n,children:[Kr(fT,{children:e}),Kr(gT,{isactive:n,children:Kr(cT,{height:"16px",width:"16px",strokeWidth:"2"})})]}),Kr(mT,{})]})},R2=({children:e})=>{let{activePanel:t}=Kn(Yi),{value:r}=Kn(Ja);return Kr(yT,{"data-open":t===r,children:Kr(M2,{children:e})})},I2=({children:e})=>{let{activePanel:t}=Kn(Yi),{value:r}=Kn(Ja);return Kr(M2,{children:typeof e=="function"?e({isActive:t===r}):e})},pT=dn.div`
2481
+ `;import fT from"@heroicons/react/24/outline/ChevronDownIcon";import{useContext as Yn,useState as hT}from"react";import un from"styled-components";import{createContext as k2,useContext as MX}from"react";var Zi=k2(void 0);var Xa=k2(void 0);import{Fragment as TT,jsx as Kr,jsxs as R2}from"react/jsx-runtime";var I2=({defaultValue:e,children:t})=>{let[r,o]=hT(e||null),n=i=>{o(r===i?null:i)};return Kr(Zi.Provider,{value:{activePanel:r,togglePanel:n},children:Kr(yT,{children:t})})},M2=({value:e,children:t})=>{let{activePanel:r,togglePanel:o}=Yn(Zi),n=r===e;return Kr(Xa.Provider,{value:{onToggle:()=>o(e),value:e},children:Kr(wT,{isActive:n,"data-open":n,children:t})})},W2=({children:e})=>{let{activePanel:t}=Yn(Zi),{onToggle:r,value:o}=Yn(Xa),n=t===o;return R2(TT,{children:[R2(gT,{onClick:r,"data-open":n,children:[Kr(CT,{children:e}),Kr(ET,{isactive:n,children:Kr(fT,{height:"16px",width:"16px",strokeWidth:"2"})})]}),Kr(vT,{})]})},O2=({children:e})=>{let{activePanel:t}=Yn(Zi),{value:r}=Yn(Xa);return Kr(bT,{"data-open":t===r,children:Kr(N2,{children:e})})},L2=({children:e})=>{let{activePanel:t}=Yn(Zi),{value:r}=Yn(Xa);return Kr(N2,{children:typeof e=="function"?e({isActive:t===r}):e})},yT=un.div`
2482
2482
  display: flex;
2483
2483
  flex-direction: column;
2484
2484
  width: 100%;
2485
2485
  gap: 8px;
2486
- `,uT=dn.div`
2486
+ `,gT=un.div`
2487
2487
  display: flex;
2488
2488
  justify-content: space-between;
2489
2489
  align-items: center;
2490
2490
  width: 100%;
2491
2491
  cursor: pointer;
2492
2492
  padding-bottom: 8px;
2493
- `,mT=dn.div`
2493
+ `,vT=un.div`
2494
2494
  width: 100%;
2495
2495
 
2496
2496
  && {
@@ -2498,13 +2498,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
2498
2498
  border-color: var(--privy-color-foreground-4);
2499
2499
  }
2500
2500
  padding-bottom: 12px;
2501
- `,fT=dn.div`
2501
+ `,CT=un.div`
2502
2502
  font-size: 14px;
2503
2503
  font-weight: 500;
2504
2504
  line-height: 19.6px;
2505
2505
  width: 100%;
2506
2506
  padding-right: 8px;
2507
- `,hT=dn.div`
2507
+ `,wT=un.div`
2508
2508
  display: flex;
2509
2509
  flex-direction: column;
2510
2510
  width: 100%;
@@ -2516,7 +2516,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2516
2516
  border-color: var(--privy-color-foreground-4);
2517
2517
  border-radius: var(--privy-border-radius-md);
2518
2518
  }
2519
- `,yT=dn.div`
2519
+ `,bT=un.div`
2520
2520
  position: relative;
2521
2521
  overflow: hidden;
2522
2522
  transition: max-height 25ms ease-out;
@@ -2528,36 +2528,36 @@ You will need this password to access your ${e} wallet on a new device. Please k
2528
2528
  &[data-open='false'] {
2529
2529
  max-height: 0;
2530
2530
  }
2531
- `,M2=dn.div`
2531
+ `,N2=un.div`
2532
2532
  display: flex;
2533
2533
  flex-direction: column;
2534
2534
  gap: 12px;
2535
2535
  flex: 1 1 auto;
2536
2536
  min-height: 1px;
2537
- `,gT=dn.div`
2537
+ `,ET=un.div`
2538
2538
  transform: ${e=>e.isactive?"rotate(180deg)":"rotate(0deg)"};
2539
- `;import CT from"styled-components";import{jsx as bT}from"react/jsx-runtime";var qp=({walletAddress:e,chainId:t=Eo})=>bT(wT,{href:wg(t,e),target:"_blank",children:dt(e)}),wT=CT.a`
2539
+ `;import ST from"styled-components";import{jsx as PT}from"react/jsx-runtime";var $p=({walletAddress:e,chainId:t=Eo})=>PT(_T,{href:Sg(t,e),target:"_blank",children:dt(e)}),_T=ST.a`
2540
2540
  &:hover {
2541
2541
  text-decoration: underline;
2542
2542
  }
2543
- `;import{jsx as vr,jsxs as zp}from"react/jsx-runtime";var Hc=({from:e,to:t,txn:r,transactionInfo:o,tokenPrice:n,gas:i,tokenSymbol:a})=>{let l=r?.value||0,s=Ve();return vr(A2,{...s.render.standalone?{defaultValue:"details"}:{},children:zp(x2,{value:"details",children:[vr(k2,{children:zp(ET,{children:[vr("div",{children:o?.title||o?.actionDescription||"Details"}),vr(TT,{children:vr(g2,{weiQuantities:[l],tokenPrice:n,tokenSymbol:a})})]})}),zp(R2,{children:[vr(Dc,{label:"From",children:vr(qp,{walletAddress:e,chainId:r.chainId||Eo})}),vr(Dc,{label:"To",children:vr(qp,{walletAddress:t,chainId:r.chainId||Eo})}),o&&o.action&&vr(Dc,{label:"Action",children:o.action}),i&&vr(w2,{transactionData:r,gas:i,tokenPrice:n,tokenSymbol:a})]}),vr(I2,{children:({isActive:c})=>vr(b2,{transactionData:r,displayFee:c,gas:i||"0x0",tokenPrice:n,tokenSymbol:a})})]})})},ET=W2.div`
2543
+ `;import{jsx as Cr,jsxs as Kp}from"react/jsx-runtime";var Vc=({from:e,to:t,txn:r,transactionInfo:o,tokenPrice:n,gas:i,tokenSymbol:a})=>{let l=r?.value||0,s=Ve();return Cr(I2,{...s.render.standalone?{defaultValue:"details"}:{},children:Kp(M2,{value:"details",children:[Cr(W2,{children:Kp(AT,{children:[Cr("div",{children:o?.title||o?.actionDescription||"Details"}),Cr(xT,{children:Cr(b2,{weiQuantities:[l],tokenPrice:n,tokenSymbol:a})})]})}),Kp(O2,{children:[Cr(Fc,{label:"From",children:Cr($p,{walletAddress:e,chainId:r.chainId||Eo})}),Cr(Fc,{label:"To",children:Cr($p,{walletAddress:t,chainId:r.chainId||Eo})}),o&&o.action&&Cr(Fc,{label:"Action",children:o.action}),i&&Cr(S2,{transactionData:r,gas:i,tokenPrice:n,tokenSymbol:a})]}),Cr(L2,{children:({isActive:c})=>Cr(_2,{transactionData:r,displayFee:c,gas:i||"0x0",tokenPrice:n,tokenSymbol:a})})]})})},AT=D2.div`
2544
2544
  display: flex;
2545
2545
  flex-direction: row;
2546
2546
  justify-content: space-between;
2547
- `,TT=W2.div`
2547
+ `,xT=D2.div`
2548
2548
  flex-shrink: 0;
2549
2549
  padding-left: 8px;
2550
- `;import ST from"styled-components";var O2=ST.img`
2550
+ `;import kT from"styled-components";var U2=kT.img`
2551
2551
  && {
2552
2552
  height: ${e=>e.size==="sm"?"65px":"140px"};
2553
2553
  width: ${e=>e.size==="sm"?"65px":"140px"};
2554
2554
  border-radius: 16px;
2555
2555
  margin-bottom: 12px;
2556
2556
  }
2557
- `;import{jsx as N2}from"react/jsx-runtime";var Xa=({pendingTransaction:e})=>{let{getAccessToken:t}=z(),{wallets:r}=zr(),{walletProxy:o,rpcConfig:n,chains:i,appId:a,nativeTokenSymbolForChainId:l}=M(),[s,c]=L2(null),[m,f]=L2(e),{tokenPrice:u}=uo(m),C=l(e.chainId)||"ETH",g=_T(()=>r.find(y=>y.walletClientType==="privy"),[r]);return PT(()=>{async function y(){if(!await t()||!o||!g)return m;let E=Gt(m.chainId,i,n,{appId:a}),k=await kT(g.address,m,E),{totalGasEstimate:T}=await xT(k,E);return c(T.toHexString()),k}y().then(f).catch(console.error)},[o]),g?N2(RT,{children:N2(Hc,{from:g.address,to:m.to,txn:m,gas:s??void 0,tokenPrice:u,tokenSymbol:C})}):null},RT=AT.div`
2557
+ `;import{jsx as B2}from"react/jsx-runtime";var es=({pendingTransaction:e})=>{let{getAccessToken:t}=q(),{wallets:r}=zr(),{walletProxy:o,rpcConfig:n,chains:i,appId:a,nativeTokenSymbolForChainId:l}=M(),[s,c]=F2(null),[m,f]=F2(e),{tokenPrice:u}=uo(m),C=l(e.chainId)||"ETH",g=RT(()=>r.find(y=>y.walletClientType==="privy"),[r]);return IT(()=>{async function y(){if(!await t()||!o||!g)return m;let T=Gt(m.chainId,i,n,{appId:a}),k=await OT(g.address,m,T),{totalGasEstimate:S}=await WT(k,T);return c(S.toHexString()),k}y().then(f).catch(console.error)},[o]),g?B2(LT,{children:B2(Vc,{from:g.address,to:m.to,txn:m,gas:s??void 0,tokenPrice:u,tokenSymbol:C})}):null},LT=MT.div`
2558
2558
  width: 100%;
2559
2559
  padding: 1rem 0;
2560
- `;import IT from"@heroicons/react/24/outline/CalendarIcon";import MT from"@heroicons/react/24/outline/ExclamationTriangleIcon";import WT from"@heroicons/react/24/outline/ShieldCheckIcon";import{Fragment as D2,jsx as Rt,jsxs as Zi}from"react/jsx-runtime";var U2=({hasBlockingError:e,error:t,onClose:r,onBack:o,handleSubmit:n,account:i,submitSuccess:a})=>{let{pendingTransaction:l}=M();return Zi(D2,{children:[Rt(x,{onClose:r},"header"),Rt(Je,{children:Zi("div",{children:[Rt(ot,{success:a,fail:!!t}),t?Rt(MT,{style:{width:"38px",height:"38px"}}):Rt(Bn,{style:{width:"38px",height:"38px"}})]})}),Rt(de,{style:{marginTop:"1rem"},children:"Verifying with passkey"}),Zi(Rn,{children:[Zi(Qt,{children:[Rt(Zt,{children:Rt(WT,{})}),"Approve this action using your touch, face, PIN, or hardware key."]}),Zi(Qt,{children:[Rt(Zt,{children:Rt(IT,{})}),"You last added a passkey on"," ",i?.firstVerifiedAt?.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),"."]})]}),l&&Rt(_r,{children:Rt(Xa,{pendingTransaction:l})}),t&&Zi(D2,{children:[Rt(vl,{style:{marginTop:"1.25rem"},children:t.message}),Rt(B,{disabled:e,onClick:n,style:{marginTop:"1.25rem"},children:"Try again"})]}),o&&Rt(wa,{style:{marginTop:"1rem"},onClick:o,children:"Choose another method"}),Rt(Z,{})]})};import{Fragment as $p,jsx as ve,jsxs as jr}from"react/jsx-runtime";var Kp=({open:e,onClose:t})=>{let{user:r}=z(),[o,n]=es(null),{init:i,cancel:a,submit:l}=Ka(),[s,c]=es(!1),[m,f]=es(!1),[u,C]=es(null),[g,y]=es(null);BT(()=>{e&&r?.mfaMethods&&r.mfaMethods.length>0?k(r.mfaMethods[0]):n(null)},[r?.mfaMethods,e]);let b=R=>tp(R)?(c(!0),new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):Dn(R)?(c(!1),new Error("The code you entered is not valid")):Nn(R)?(c(!0),new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.")):(console.error(R),c(!1),new Error("Something went wrong."));async function E(R){y(null);try{if(!R||!o)return;await l(o,R),f(!0),c(!1),t()}catch(I){throw b(I)}}async function k(R){if(R==="passkey"){try{n(R);let I=await i(R);if(!I)throw new Error("something went wrong");C(I),await l(R,I),f(!0),c(!1),t()}catch(I){y(b(I))}return}try{n(R),await i(R)}catch(I){console.error(I)}}let T=()=>{n(null),y(null),a(),t()},A=()=>{n(null),y(null)};if(!e||!r)return null;if(o==="passkey"){let R=r.linkedAccounts.filter(I=>I.type==="passkey"&&I.enrolledInMfa).sort((I,D)=>D.firstVerifiedAt.valueOf()-I.firstVerifiedAt.valueOf())[0];return ve(U2,{account:R,selectedMethod:o,submitSuccess:m,hasBlockingError:s,error:g,onClose:T,onBack:A,handleSubmit:()=>E(u).catch(y)})}return o?ve(HT,{submitSuccess:m,hasBlockingError:s,handleSubmitCode:E,selectedMethod:o,onClose:T,onBack:r.mfaMethods.length>1?()=>n(null):void 0}):jr($p,{children:[ve(x,{onClose:T},"header"),ve(Me,{children:ve(Ye,{children:ve(DT,{})})}),ve(de,{children:"Verify your identity"}),ve(ue,{children:"Choose a verification method"}),jr(ml,{children:[r.mfaMethods.includes("totp")&&jr(Ee,{onClick:()=>k("totp"),children:[ve(OT,{}),"Authenticator App"]},"totp"),r.mfaMethods.includes("sms")&&jr(Ee,{onClick:()=>k("sms"),children:[ve(NT,{}),"SMS"]},"sms"),r.mfaMethods.includes("passkey")&&jr(Ee,{onClick:()=>k("passkey"),children:[ve(LT,{}),"Passkey"]},"passkey")]}),ve(Z,{})]})},HT=({selectedMethod:e,submitSuccess:t,hasBlockingError:r,onClose:o,onBack:n,handleSubmitCode:i})=>{let{app:a}=P(),{pendingTransaction:l}=M();switch(e){case"sms":return jr($p,{children:[ve(x,{onClose:o},"header"),ve(Me,{children:ve(Ye,{children:ve(FT,{})})}),ve(de,{children:"Enter verification code"}),jr(_r,{children:[ve(zn,{success:t,disabled:r,onChange:i}),jr(ue,{children:["To continue, please enter the 6-digit code sent to your ",ve("strong",{children:"mobile device"})]}),l&&ve(Xa,{pendingTransaction:l})]}),n&&ve(wa,{theme:a?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),ve(Ur,{onClick:o,children:"Not now"}),ve(Z,{})]});case"totp":return jr($p,{children:[ve(x,{onClose:o},"header"),ve(Me,{children:ve(Ye,{children:ve(UT,{})})}),ve(de,{children:"Enter verification code"}),jr(_r,{children:[ve(zn,{success:t,disabled:r,onChange:i}),jr(ue,{children:["To continue, please enter the 6-digit code generated from your"," ",ve("strong",{children:"authenticator app"})]}),l&&ve(Xa,{pendingTransaction:l})]}),n&&ve(wa,{theme:a?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),ve(Ur,{onClick:o,children:"Not now"}),ve(Z,{})]});default:return null}};import{useEffect as F2,useState as B2}from"react";import GT from"styled-components";import{Fragment as qT,jsx as go,jsxs as Gc}from"react/jsx-runtime";var H2=()=>{let{authenticated:e,logout:t,ready:r,user:o}=z(),{app:n,setModalData:i,navigate:a,resetNavigation:l}=P(),{getAuthMeta:s,initLoginWithOAuth:c,loginWithOAuth:m,updateWallets:f,setReadyToTrue:u,closePrivyModal:C,createAnalyticsEvent:g}=M(),[y,b]=B2(!1),[E,k]=B2(void 0),T=s()?.provider||"google",{name:A,component:R}=ca(T),I=hi(),D=Ne;F2(()=>{m(T).then(j=>{b(!0),u(!0),j&&I("login","onOAuthLoginComplete",j)}).catch(j=>{if(u(!1),j?.privyErrorCode==="allowlist_rejected"){k(void 0),l(),a("ALLOWLIST_REJECTION_SCREEN");return}if(j?.privyErrorCode==="max_accounts_reached"){console.error(new br(j).toString()),k(void 0),l(),a("USER_LIMIT_REACHED_SCREEN");return}if(j?.privyErrorCode==="user_does_not_exist"){k(void 0),l(),a("ACCOUNT_NOT_FOUND_SCREEN");return}let{retryable:O,detail:U}=Bm(j,T);k({retryable:O,detail:U,message:"Authentication failed"})}).finally(()=>{En()})},[A,T]),F2(()=>{if(r&&e&&y&&o){if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let O=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},D);return()=>clearTimeout(O)}if(qt(o,n?.embeddedWallets?.createOnLogin)){let O=setTimeout(()=>{i({createWallet:{onSuccess:()=>{},onFailure:U=>{console.error(U),g({eventName:"embedded_wallet_creation_failure_logout",payload:{error:U,provider:T,screen:"OAuthStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},D);return()=>clearTimeout(O)}else{let O=setTimeout(()=>C({shouldCallAuthOnSuccess:!0,isSuccess:!0}),D);return f(),()=>clearTimeout(O)}}},[r,e,y,o]);let H=y?`Successfully connected with ${A}`:E?E.message:`Verifying connection to ${A}`,K="";return y?K="You\u2019re good to go!":E?K=E.detail:K="Just a few moments more",Gc(qT,{children:[go(x,{}),go(ne,{}),Gc(VT,{children:[go(Je,{children:Gc("div",{children:[go(ot,{success:y,fail:!!E}),go(R,{style:{width:"38px",height:"38px"}})]})}),Gc(qe,{children:[go("h3",{children:H}),go("p",{children:K})]}),E&&E?.retryable?go(Ho,{onClick:()=>{En(),c(T),k(void 0)},disabled:!y&&!E?.retryable,children:"Retry"}):null]}),go(ie,{}),go(Z,{})]})},VT=GT.div`
2560
+ `;import NT from"@heroicons/react/24/outline/CalendarIcon";import DT from"@heroicons/react/24/outline/ExclamationTriangleIcon";import UT from"@heroicons/react/24/outline/ShieldCheckIcon";import{Fragment as H2,jsx as Rt,jsxs as Qi}from"react/jsx-runtime";var G2=({hasBlockingError:e,error:t,onClose:r,onBack:o,handleSubmit:n,account:i,submitSuccess:a})=>{let{pendingTransaction:l}=M();return Qi(H2,{children:[Rt(A,{onClose:r},"header"),Rt(Je,{children:Qi("div",{children:[Rt(nt,{success:a,fail:!!t}),t?Rt(DT,{style:{width:"38px",height:"38px"}}):Rt(Gn,{style:{width:"38px",height:"38px"}})]})}),Rt(de,{style:{marginTop:"1rem"},children:"Verifying with passkey"}),Qi(Mn,{children:[Qi(Qt,{children:[Rt(Zt,{children:Rt(UT,{})}),"Approve this action using your touch, face, PIN, or hardware key."]}),Qi(Qt,{children:[Rt(Zt,{children:Rt(NT,{})}),"You last added a passkey on"," ",i?.firstVerifiedAt?.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),"."]})]}),l&&Rt(Pr,{children:Rt(es,{pendingTransaction:l})}),t&&Qi(H2,{children:[Rt(wl,{style:{marginTop:"1.25rem"},children:t.message}),Rt(B,{disabled:e,onClick:n,style:{marginTop:"1.25rem"},children:"Try again"})]}),o&&Rt(ba,{style:{marginTop:"1rem"},onClick:o,children:"Choose another method"}),Rt(Z,{})]})};import{Fragment as jp,jsx as ve,jsxs as jr}from"react/jsx-runtime";var Yp=({open:e,onClose:t})=>{let{user:r}=q(),[o,n]=ts(null),{init:i,cancel:a,submit:l}=ja(),[s,c]=ts(!1),[m,f]=ts(!1),[u,C]=ts(null),[g,y]=ts(null);zT(()=>{e&&r?.mfaMethods&&r.mfaMethods.length>0?k(r.mfaMethods[0]):n(null)},[r?.mfaMethods,e]);let b=R=>op(R)?(c(!0),new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):Fn(R)?(c(!1),new Error("The code you entered is not valid")):Un(R)?(c(!0),new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.")):(console.error(R),c(!1),new Error("Something went wrong."));async function T(R){y(null);try{if(!R||!o)return;await l(o,R),f(!0),c(!1),t()}catch(I){throw b(I)}}async function k(R){if(R==="passkey"){try{n(R);let I=await i(R);if(!I)throw new Error("something went wrong");C(I),await l(R,I),f(!0),c(!1),t()}catch(I){y(b(I))}return}try{n(R),await i(R)}catch(I){console.error(I)}}let S=()=>{n(null),y(null),a(),t()},x=()=>{n(null),y(null)};if(!e||!r)return null;if(o==="passkey"){let R=r.linkedAccounts.filter(I=>I.type==="passkey"&&I.enrolledInMfa).sort((I,D)=>D.firstVerifiedAt.valueOf()-I.firstVerifiedAt.valueOf())[0];return ve(G2,{account:R,selectedMethod:o,submitSuccess:m,hasBlockingError:s,error:g,onClose:S,onBack:x,handleSubmit:()=>T(u).catch(y)})}return o?ve($T,{submitSuccess:m,hasBlockingError:s,handleSubmitCode:T,selectedMethod:o,onClose:S,onBack:r.mfaMethods.length>1?()=>n(null):void 0}):jr(jp,{children:[ve(A,{onClose:S},"header"),ve(Me,{children:ve(Ye,{children:ve(GT,{})})}),ve(de,{children:"Verify your identity"}),ve(ue,{children:"Choose a verification method"}),jr(hl,{children:[r.mfaMethods.includes("totp")&&jr(Ee,{onClick:()=>k("totp"),children:[ve(FT,{}),"Authenticator App"]},"totp"),r.mfaMethods.includes("sms")&&jr(Ee,{onClick:()=>k("sms"),children:[ve(HT,{}),"SMS"]},"sms"),r.mfaMethods.includes("passkey")&&jr(Ee,{onClick:()=>k("passkey"),children:[ve(BT,{}),"Passkey"]},"passkey")]}),ve(Z,{})]})},$T=({selectedMethod:e,submitSuccess:t,hasBlockingError:r,onClose:o,onBack:n,handleSubmitCode:i})=>{let{app:a}=_(),{pendingTransaction:l}=M();switch(e){case"sms":return jr(jp,{children:[ve(A,{onClose:o},"header"),ve(Me,{children:ve(Ye,{children:ve(qT,{})})}),ve(de,{children:"Enter verification code"}),jr(Pr,{children:[ve(Kn,{success:t,disabled:r,onChange:i}),jr(ue,{children:["To continue, please enter the 6-digit code sent to your ",ve("strong",{children:"mobile device"})]}),l&&ve(es,{pendingTransaction:l})]}),n&&ve(ba,{theme:a?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),ve(Ur,{onClick:o,children:"Not now"}),ve(Z,{})]});case"totp":return jr(jp,{children:[ve(A,{onClose:o},"header"),ve(Me,{children:ve(Ye,{children:ve(VT,{})})}),ve(de,{children:"Enter verification code"}),jr(Pr,{children:[ve(Kn,{success:t,disabled:r,onChange:i}),jr(ue,{children:["To continue, please enter the 6-digit code generated from your"," ",ve("strong",{children:"authenticator app"})]}),l&&ve(es,{pendingTransaction:l})]}),n&&ve(ba,{theme:a?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),ve(Ur,{onClick:o,children:"Not now"}),ve(Z,{})]});default:return null}};import{useEffect as V2,useState as q2}from"react";import KT from"styled-components";import{Fragment as YT,jsx as go,jsxs as qc}from"react/jsx-runtime";var z2=()=>{let{authenticated:e,logout:t,ready:r,user:o}=q(),{app:n,setModalData:i,navigate:a,resetNavigation:l}=_(),{getAuthMeta:s,initLoginWithOAuth:c,loginWithOAuth:m,updateWallets:f,setReadyToTrue:u,closePrivyModal:C,createAnalyticsEvent:g}=M(),[y,b]=q2(!1),[T,k]=q2(void 0),S=s()?.provider||"google",{name:x,component:R}=da(S),I=gi(),D=Ne;V2(()=>{m(S).then(j=>{b(!0),u(!0),j&&I("login","onOAuthLoginComplete",j)}).catch(j=>{if(u(!1),j?.privyErrorCode==="allowlist_rejected"){k(void 0),l(),a("ALLOWLIST_REJECTION_SCREEN");return}if(j?.privyErrorCode==="max_accounts_reached"){console.error(new Er(j).toString()),k(void 0),l(),a("USER_LIMIT_REACHED_SCREEN");return}if(j?.privyErrorCode==="user_does_not_exist"){k(void 0),l(),a("ACCOUNT_NOT_FOUND_SCREEN");return}let{retryable:O,detail:U}=Vm(j,S);k({retryable:O,detail:U,message:"Authentication failed"})}).finally(()=>{_n()})},[x,S]),V2(()=>{if(r&&e&&y&&o){if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let O=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},D);return()=>clearTimeout(O)}if(qt(o,n?.embeddedWallets?.createOnLogin)){let O=setTimeout(()=>{i({createWallet:{onSuccess:()=>{},onFailure:U=>{console.error(U),g({eventName:"embedded_wallet_creation_failure_logout",payload:{error:U,provider:S,screen:"OAuthStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},D);return()=>clearTimeout(O)}else{let O=setTimeout(()=>C({shouldCallAuthOnSuccess:!0,isSuccess:!0}),D);return f(),()=>clearTimeout(O)}}},[r,e,y,o]);let H=y?`Successfully connected with ${x}`:T?T.message:`Verifying connection to ${x}`,K="";return y?K="You\u2019re good to go!":T?K=T.detail:K="Just a few moments more",qc(YT,{children:[go(A,{}),go(re,{}),qc(jT,{children:[go(Je,{children:qc("div",{children:[go(nt,{success:y,fail:!!T}),go(R,{style:{width:"38px",height:"38px"}})]})}),qc(qe,{children:[go("h3",{children:H}),go("p",{children:K})]}),T&&T?.retryable?go(Go,{onClick:()=>{_n(),c(S),k(void 0)},disabled:!y&&!T?.retryable,children:"Retry"}):null]}),go(ie,{}),go(Z,{})]})},jT=KT.div`
2561
2561
  display: flex;
2562
2562
  flex-direction: column;
2563
2563
  align-items: center;
@@ -2565,17 +2565,17 @@ You will need this password to access your ${e} wallet on a new device. Please k
2565
2565
  margin-left: 27px;
2566
2566
  margin-right: 27px;
2567
2567
  gap: 24px;
2568
- `;import{useEffect as jp,useRef as zT,useState as G2}from"react";import V2 from"styled-components";import{Fragment as KT,jsx as Io,jsxs as Vc}from"react/jsx-runtime";var q2=()=>{let{lastScreen:e,currentScreen:t,navigateBack:r}=P(),{loginWithPasskey:o,closePrivyModal:n}=M(),i=Ne,[a,l]=G2("loading"),[s,c]=G2(null),m=zT([]),f=b=>{m.current=[b,...m.current]};jp(()=>()=>{m.current.forEach(b=>clearTimeout(b)),m.current=[]},[]);let u=()=>{switch(a){case"loading":return"Waiting for passkey";case"success":return"Success";case"error":return"Something went wrong"}},C=()=>{switch(a){case"loading":return`Please follow prompts to verify your passkey.
2568
+ `;import{useEffect as Zp,useRef as ZT,useState as $2}from"react";import K2 from"styled-components";import{Fragment as JT,jsx as Io,jsxs as zc}from"react/jsx-runtime";var j2=()=>{let{lastScreen:e,currentScreen:t,navigateBack:r}=_(),{loginWithPasskey:o,closePrivyModal:n}=M(),i=Ne,[a,l]=$2("loading"),[s,c]=$2(null),m=ZT([]),f=b=>{m.current=[b,...m.current]};Zp(()=>()=>{m.current.forEach(b=>clearTimeout(b)),m.current=[]},[]);let u=()=>{switch(a){case"loading":return"Waiting for passkey";case"success":return"Success";case"error":return"Something went wrong"}},C=()=>{switch(a){case"loading":return`Please follow prompts to verify your passkey.
2569
2569
  You will have to sign up with another method first to register a passkey for your account.`;case"success":return"You've successfully logged in with your passkey.";case"error":if(s instanceof et){if(s.privyErrorCode==="cannot_link_more_of_type")return"Cannot link more passkeys to account.";if(s.privyErrorCode==="passkey_not_allowed")return`Passkey request timed out or rejected by user.
2570
2570
  You will have to sign up with another method first to register a passkey for your account.`}return`An unknown error occurred.
2571
- You will have to sign up with another method first to register a passkey for your account.`}},g=()=>{switch(a){case"loading":case"success":return Io(B,{onClick:()=>{},disabled:!0,children:"Continue"});case"error":return Io(B,{onClick:y,disabled:!1,children:"Retry"})}},y=async()=>{l("loading");try{await o(),l("success")}catch(b){c(b),l("error")}};return jp(()=>{a==="success"&&f(setTimeout(()=>{n({shouldCallAuthOnSuccess:!0,isSuccess:!0})},i))},[a]),jp(()=>{y()},[]),Vc(KT,{children:[Io(x,{backFn:!e||t===e?void 0:r}),Vc($T,{children:[Io(Je,{children:Vc("div",{children:[Io(ot,{success:a==="success",fail:a==="error"}),Io(Hn,{style:{width:"38px",height:"38px"}})]})}),Vc(qe,{children:[Io("h3",{children:u()}),Io("p",{style:{whiteSpace:"pre-wrap"},children:C()})]}),g()]}),Io(Z,{})]})},$T=V2.div`
2571
+ You will have to sign up with another method first to register a passkey for your account.`}},g=()=>{switch(a){case"loading":case"success":return Io(B,{onClick:()=>{},disabled:!0,children:"Continue"});case"error":return Io(B,{onClick:y,disabled:!1,children:"Retry"})}},y=async()=>{l("loading");try{await o(),l("success")}catch(b){c(b),l("error")}};return Zp(()=>{a==="success"&&f(setTimeout(()=>{n({shouldCallAuthOnSuccess:!0,isSuccess:!0})},i))},[a]),Zp(()=>{y()},[]),zc(JT,{children:[Io(A,{backFn:!e||t===e?void 0:r}),zc(QT,{children:[Io(Je,{children:zc("div",{children:[Io(nt,{success:a==="success",fail:a==="error"}),Io(Vn,{style:{width:"38px",height:"38px"}})]})}),zc(qe,{children:[Io("h3",{children:u()}),Io("p",{style:{whiteSpace:"pre-wrap"},children:C()})]}),g()]}),Io(Z,{})]})},QT=K2.div`
2572
2572
  display: flex;
2573
2573
  flex-direction: column;
2574
2574
  align-items: center;
2575
2575
  justify-content: center;
2576
2576
  gap: 24px;
2577
2577
  width: 100%;
2578
- `,Cte=V2.div`
2578
+ `,kte=K2.div`
2579
2579
  display: flex;
2580
2580
  align-items: center;
2581
2581
  justify-content: center;
@@ -2591,9 +2591,9 @@ You will have to sign up with another method first to register a passkey for you
2591
2591
  stroke: var(--privy-color-accent) !important;
2592
2592
  fill: var(--privy-color-accent) !important;
2593
2593
  }
2594
- `;import{useEffect as YT,useState as $2}from"react";import ZT from"styled-components";import{isMobile as jT}from"react-device-detect";var z2=(e,t)=>{let r=new URL(window.location.href),o=encodeURIComponent(r.href.replace(/\/$/g,"")+`?privy_token=${e}&privy_connector=injected&privy_wallet_client=phantom`);if(!No()&&jT)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${o}?ref=${o}`};import{Fragment as JT,jsx as Mo,jsxs as K2}from"react/jsx-runtime";var j2=()=>{let{forkSession:e,ready:t,authenticated:r}=z(),[o,n]=$2(""),[i,a]=$2(!1);YT(()=>{t&&r&&e().then(n)},[t,r]);let l=z2(o,!i),s={title:"Redirecting to Phantom Mobile Wallet",description:"We'll take you to the Phantom Mobile Wallet app to continue your login experience.",footnote:""};return t&&(s.description="For the best experience, we'll automatically log you into the Phantom Mobile Wallet in-app browser.",s.footnote="Once you're done, you can always return here and refresh to view your updated account."),i&&(s.title="Still here?",s.description="You may need to install the Phantom mobile app.",s.footnote="Once you're done, you can return here or connect via Phantom's in-app browser."),K2(JT,{children:[Mo(x,{},"header"),Mo(ne,{}),Mo(ao,{title:s.title,description:s.description}),K2(Pr,{children:[Mo(QT,{children:Mo(to,{style:{width:"72px",height:"72px"}})}),Mo(cl,{href:l,onClick:()=>{setTimeout(()=>a(!0),1e3)},loading:t&&!l,children:i?"Go to App Store":"Continue"}),s.footnote?Mo("p",{children:s.footnote}):null]}),Mo(ie,{}),Mo($,{})]})},QT=ZT(wt)`
2594
+ `;import{useEffect as e9,useState as Z2}from"react";import t9 from"styled-components";import{isMobile as XT}from"react-device-detect";var Y2=(e,t)=>{let r=new URL(window.location.href),o=encodeURIComponent(r.href.replace(/\/$/g,"")+`?privy_token=${e}&privy_connector=injected&privy_wallet_client=phantom`);if(!No()&&XT)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${o}?ref=${o}`};import{Fragment as o9,jsx as Mo,jsxs as Q2}from"react/jsx-runtime";var J2=()=>{let{forkSession:e,ready:t,authenticated:r}=q(),[o,n]=Z2(""),[i,a]=Z2(!1);e9(()=>{t&&r&&e().then(n)},[t,r]);let l=Y2(o,!i),s={title:"Redirecting to Phantom Mobile Wallet",description:"We'll take you to the Phantom Mobile Wallet app to continue your login experience.",footnote:""};return t&&(s.description="For the best experience, we'll automatically log you into the Phantom Mobile Wallet in-app browser.",s.footnote="Once you're done, you can always return here and refresh to view your updated account."),i&&(s.title="Still here?",s.description="You may need to install the Phantom mobile app.",s.footnote="Once you're done, you can return here or connect via Phantom's in-app browser."),Q2(o9,{children:[Mo(A,{},"header"),Mo(re,{}),Mo(ao,{title:s.title,description:s.description}),Q2(Xt,{children:[Mo(r9,{children:Mo(to,{style:{width:"72px",height:"72px"}})}),Mo(pl,{href:l,onClick:()=>{setTimeout(()=>a(!0),1e3)},loading:t&&!l,children:i?"Go to App Store":"Continue"}),s.footnote?Mo("p",{children:s.footnote}):null]}),Mo(ie,{}),Mo(z,{})]})},r9=t9(wt)`
2595
2595
  margin: 16px auto;
2596
- `;import XT from"@heroicons/react/24/outline/ShieldCheckIcon";import{useEffect as e9,useState as qc}from"react";import zc,{css as t9}from"styled-components";import{Fragment as a9,jsx as Ut,jsxs as jn}from"react/jsx-runtime";var Y2=()=>{let[e,t]=qc(!0),{authenticated:r,getAccessToken:o}=z(),{walletProxy:n,closePrivyModal:i,createAnalyticsEvent:a}=M(),{navigate:l,data:s,onUserCloseViaDialogOrKeybindRef:c}=P(),[m,f]=qc(void 0),[u,C]=qc(""),[g,y]=qc(!1),{privyWallet:b,onCompleteNavigateTo:E,onSuccess:k,onFailure:T}=s.recoverWallet,A=(D="User exited before their wallet could be recovered")=>{i({shouldCallAuthOnSuccess:!1}),T(typeof D=="string"?new Wt(D):D)};c.current=A,e9(()=>{if(!r||!b)return A("User must be authenticated and have a Privy wallet before it can be recovered")},[r]);let R=D=>{D&&f(D)};return jn(a9,{children:[Ut(x,{onClose:A}),Ut(ne,{}),jn(o9,{children:[jn(r9,{children:[Ut(XT,{height:48,width:48,stroke:"var(--privy-color-accent)"}),Ut("h3",{style:{color:"var(--privy-color-foreground)"},children:"Enter your password"}),Ut("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),jn("div",{children:[jn(Zo,{children:[Ut(Oi,{type:e?"password":"text",onChange:D=>R(D.target.value),disabled:g,style:{paddingRight:"2.3rem"}}),Ut(Li,{style:{right:"0.75rem"},children:e?Ut(Ni,{onClick:()=>t(!1)}):Ut(Di,{onClick:()=>t(!0)})})]}),!!u&&Ut(n9,{children:u})]}),jn("div",{children:[jn(vh,{children:[Ut("h4",{children:"Why is this necessary?"}),Ut("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),Ut(i9,{loading:g||!n,disabled:!m,onClick:async()=>{y(!0);let D=await o();if(D&&b&&m!==null)try{a({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:b.address}}),await n?.recover({address:b.address,accessToken:D,recoveryPin:m,recoveryMethod:b.recoveryMethod}),C(""),E?l(E):i({shouldCallAuthOnSuccess:!1}),k?.(b),a({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:b.address}})}catch(H){dy(H)?C("Invalid recovery password, please try again."):C("An error has occurred, please try again.")}finally{y(!1)}else return A("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!b&&g,children:"Recover your account"})]})]}),Ut(ie,{}),Ut($,{})]})},r9=zc.div`
2596
+ `;import n9 from"@heroicons/react/24/outline/ShieldCheckIcon";import{useEffect as i9,useState as $c}from"react";import Kc,{css as a9}from"styled-components";import{Fragment as p9,jsx as Ut,jsxs as Zn}from"react/jsx-runtime";var X2=()=>{let[e,t]=$c(!0),{authenticated:r,getAccessToken:o}=q(),{walletProxy:n,closePrivyModal:i,createAnalyticsEvent:a}=M(),{navigate:l,data:s,onUserCloseViaDialogOrKeybindRef:c}=_(),[m,f]=$c(void 0),[u,C]=$c(""),[g,y]=$c(!1),{privyWallet:b,onCompleteNavigateTo:T,onSuccess:k,onFailure:S}=s.recoverWallet,x=(D="User exited before their wallet could be recovered")=>{i({shouldCallAuthOnSuccess:!1}),S(typeof D=="string"?new Wt(D):D)};c.current=x,i9(()=>{if(!r||!b)return x("User must be authenticated and have a Privy wallet before it can be recovered")},[r]);let R=D=>{D&&f(D)};return Zn(p9,{children:[Ut(A,{onClose:x}),Ut(re,{}),Zn(l9,{children:[Zn(s9,{children:[Ut(n9,{height:48,width:48,stroke:"var(--privy-color-accent)"}),Ut("h3",{style:{color:"var(--privy-color-foreground)"},children:"Enter your password"}),Ut("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),Zn("div",{children:[Zn(Qo,{children:[Ut(Ni,{type:e?"password":"text",onChange:D=>R(D.target.value),disabled:g,style:{paddingRight:"2.3rem"}}),Ut(Di,{style:{right:"0.75rem"},children:e?Ut(Ui,{onClick:()=>t(!1)}):Ut(Fi,{onClick:()=>t(!0)})})]}),!!u&&Ut(c9,{children:u})]}),Zn("div",{children:[Zn(Eh,{children:[Ut("h4",{children:"Why is this necessary?"}),Ut("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),Ut(d9,{loading:g||!n,disabled:!m,onClick:async()=>{y(!0);let D=await o();if(D&&b&&m!==null)try{a({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:b.address}}),await n?.recover({address:b.address,accessToken:D,recoveryPin:m,recoveryMethod:b.recoveryMethod}),C(""),T?l(T):i({shouldCallAuthOnSuccess:!1}),k?.(b),a({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:b.address}})}catch(H){fy(H)?C("Invalid recovery password, please try again."):C("An error has occurred, please try again.")}finally{y(!1)}else return x("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!b&&g,children:"Recover your account"})]})]}),Ut(ie,{}),Ut(z,{})]})},s9=Kc.div`
2597
2597
  display: flex;
2598
2598
  flex-direction: column;
2599
2599
  align-items: center;
@@ -2615,48 +2615,48 @@ You will have to sign up with another method first to register a passkey for you
2615
2615
  font-weight: 400;
2616
2616
  line-height: 20px;
2617
2617
  }
2618
- `,o9=zc.div`
2618
+ `,l9=Kc.div`
2619
2619
  display: flex;
2620
2620
  flex-direction: column;
2621
2621
  justify-content: space-between;
2622
- `,n9=zc.div`
2622
+ `,c9=Kc.div`
2623
2623
  line-height: 20px;
2624
2624
  height: 20px;
2625
2625
  font-size: 13px;
2626
2626
  color: var(--privy-color-error);
2627
2627
  text-align: left;
2628
2628
  margin-top: 0.5rem;
2629
- `,i9=zc(B)`
2630
- ${e=>e.hideAnimations&&t9`
2629
+ `,d9=Kc(B)`
2630
+ ${e=>e.hideAnimations&&a9`
2631
2631
  && {
2632
2632
  // Remove animations because the recoverWallet task on the iframe partially
2633
2633
  // blocks the renderer, so the animation stutters and doesn't look good
2634
2634
  transition: none;
2635
2635
  }
2636
2636
  `}
2637
- `;import{useCallback as s9,useEffect as ev,useState as Yp}from"react";import{jsx as $c,jsxs as Z2}from"react/jsx-runtime";var Kc=e=>Z2("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 21 20",...e,children:[$c("path",{fill:"url(#icloud-gradient)",d:"M12.34 7.315a4.26 4.26 0 0 0-3.707 2.18 2.336 2.336 0 0 0-1.02-.236 2.336 2.336 0 0 0-2.3 1.963 3.217 3.217 0 0 0 1.244 6.181c.135-.001.27-.01.404-.029h8.943c.047.004.094.006.141.007.045-.001.09-.004.135-.007h.214v-.016a2.99 2.99 0 0 0 1.887-.988c.487-.55.757-1.261.757-1.998v-.006a3.017 3.017 0 0 0-.69-1.915 2.992 2.992 0 0 0-1.748-1.034 4.26 4.26 0 0 0-4.26-4.102Z"}),$c("defs",{children:Z2("linearGradient",{id:"icloud-gradient",x1:19.086,x2:3.333,y1:14.38,y2:14.163,gradientUnits:"userSpaceOnUse",children:[$c("stop",{stopColor:"#3E82F4"}),$c("stop",{offset:1,stopColor:"#93DCF7"})]})})]});import{jsx as Wo,jsxs as Q2}from"react/jsx-runtime";var jc=({style:e,...t})=>Q2("svg",{width:"16",height:"14",style:e,viewBox:"0 0 16 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[Q2("g",{clipPath:"url(#clip0_2115_829)",children:[Wo("path",{d:"M2.34709 12.9404L2.3471 12.9404L2.34565 12.938L1.64031 11.7448L1.64004 11.7444L0.651257 10.0677C0.640723 10.0496 0.630746 10.0314 0.621325 10.0129H4.16461L2.39424 13.0139C2.3775 12.9901 2.36178 12.9656 2.34709 12.9404Z",fill:"#0066DA",stroke:"#6366F1"}),Wo("path",{d:"M8 4.48713L5.47995 0.215332C5.23253 0.358922 5.02176 0.556358 4.87514 0.80764L0.219931 8.70508C0.076007 8.95094 0.000191627 9.22937 0 9.51277H5.04009L8 4.48713Z",fill:"#00AC47"}),Wo("path",{d:"M13.48 13.7847C13.7274 13.6411 13.9382 13.4437 14.0848 13.1924L14.3781 12.6988L15.7801 10.3206C15.9267 10.0693 16.0001 9.79114 16.0001 9.51294H10.9596L12.0321 11.577L13.48 13.7847Z",fill:"#EA4335"}),Wo("path",{d:"M8.00003 4.48718L10.5201 0.215385C10.2726 0.0717949 9.98857 0 9.69533 0H6.30472C6.01148 0 5.7274 0.0807692 5.47998 0.215385L8.00003 4.48718Z",fill:"#00832D"}),Wo("path",{d:"M10.9599 9.51294H5.04007L2.52002 13.7847C2.76744 13.9283 3.05152 14.0001 3.34476 14.0001H12.6552C12.9484 14.0001 13.2325 13.9194 13.4799 13.7847L10.9599 9.51294Z",fill:"#2684FC"}),Wo("path",{d:"M13.4525 4.75636L11.1249 0.80764C10.9782 0.556358 10.7675 0.358922 10.52 0.215332L8 4.48713L10.9599 9.51277H15.9908C15.9908 9.23456 15.9175 8.95636 15.7709 8.70508L13.4525 4.75636Z",fill:"#FFBA00"})]}),Wo("defs",{children:Wo("clipPath",{id:"clip0_2115_829",children:Wo("rect",{width:"16",height:"14",fill:"white"})})})]});import J2 from"styled-components";var ts=J2.div`
2637
+ `;import{useCallback as u9,useEffect as nv,useState as Qp}from"react";import{jsx as jc,jsxs as ev}from"react/jsx-runtime";var Yc=e=>ev("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 21 20",...e,children:[jc("path",{fill:"url(#icloud-gradient)",d:"M12.34 7.315a4.26 4.26 0 0 0-3.707 2.18 2.336 2.336 0 0 0-1.02-.236 2.336 2.336 0 0 0-2.3 1.963 3.217 3.217 0 0 0 1.244 6.181c.135-.001.27-.01.404-.029h8.943c.047.004.094.006.141.007.045-.001.09-.004.135-.007h.214v-.016a2.99 2.99 0 0 0 1.887-.988c.487-.55.757-1.261.757-1.998v-.006a3.017 3.017 0 0 0-.69-1.915 2.992 2.992 0 0 0-1.748-1.034 4.26 4.26 0 0 0-4.26-4.102Z"}),jc("defs",{children:ev("linearGradient",{id:"icloud-gradient",x1:19.086,x2:3.333,y1:14.38,y2:14.163,gradientUnits:"userSpaceOnUse",children:[jc("stop",{stopColor:"#3E82F4"}),jc("stop",{offset:1,stopColor:"#93DCF7"})]})})]});import{jsx as Wo,jsxs as tv}from"react/jsx-runtime";var Zc=({style:e,...t})=>tv("svg",{width:"16",height:"14",style:e,viewBox:"0 0 16 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[tv("g",{clipPath:"url(#clip0_2115_829)",children:[Wo("path",{d:"M2.34709 12.9404L2.3471 12.9404L2.34565 12.938L1.64031 11.7448L1.64004 11.7444L0.651257 10.0677C0.640723 10.0496 0.630746 10.0314 0.621325 10.0129H4.16461L2.39424 13.0139C2.3775 12.9901 2.36178 12.9656 2.34709 12.9404Z",fill:"#0066DA",stroke:"#6366F1"}),Wo("path",{d:"M8 4.48713L5.47995 0.215332C5.23253 0.358922 5.02176 0.556358 4.87514 0.80764L0.219931 8.70508C0.076007 8.95094 0.000191627 9.22937 0 9.51277H5.04009L8 4.48713Z",fill:"#00AC47"}),Wo("path",{d:"M13.48 13.7847C13.7274 13.6411 13.9382 13.4437 14.0848 13.1924L14.3781 12.6988L15.7801 10.3206C15.9267 10.0693 16.0001 9.79114 16.0001 9.51294H10.9596L12.0321 11.577L13.48 13.7847Z",fill:"#EA4335"}),Wo("path",{d:"M8.00003 4.48718L10.5201 0.215385C10.2726 0.0717949 9.98857 0 9.69533 0H6.30472C6.01148 0 5.7274 0.0807692 5.47998 0.215385L8.00003 4.48718Z",fill:"#00832D"}),Wo("path",{d:"M10.9599 9.51294H5.04007L2.52002 13.7847C2.76744 13.9283 3.05152 14.0001 3.34476 14.0001H12.6552C12.9484 14.0001 13.2325 13.9194 13.4799 13.7847L10.9599 9.51294Z",fill:"#2684FC"}),Wo("path",{d:"M13.4525 4.75636L11.1249 0.80764C10.9782 0.556358 10.7675 0.358922 10.52 0.215332L8 4.48713L10.9599 9.51277H15.9908C15.9908 9.23456 15.9175 8.95636 15.7709 8.70508L13.4525 4.75636Z",fill:"#FFBA00"})]}),Wo("defs",{children:Wo("clipPath",{id:"clip0_2115_829",children:Wo("rect",{width:"16",height:"14",fill:"white"})})})]});import rv from"styled-components";var rs=rv.div`
2638
2638
  display: flex;
2639
2639
  flex-direction: column;
2640
2640
  gap: 12px;
2641
2641
  padding-top: 24px;
2642
2642
  padding-bottom: 24px;
2643
- `,X2=J2.div`
2643
+ `,ov=rv.div`
2644
2644
  padding-bottom: 24px;
2645
- `;import{Fragment as rv,jsx as pn,jsxs as Yc}from"react/jsx-runtime";var tv={"google-drive":{name:"Google Drive",component:jc},icloud:{name:"iCloud",component:Kc}},ov=()=>{let{logout:e}=z(),{navigate:t,setModalData:r,data:o}=P(),{recoveryOAuthFlow:n,closePrivyModal:i,createAnalyticsEvent:a}=M(),[l,s]=Yp(!1),{provider:c,action:m,isInAccountCreateFlow:f}=o?.recoveryOAuthStatus,[u,C]=Yp(void 0),[g,y]=Yp(m==="create-wallet");if(c==="user-passcode")throw new Error("RecoveryOAuthScreen should never be called with a wallet that specifies recoveryMethod: `user-passcode`");let b=tv[c].name,E=tv[c].component,k=o?.recoverWallet?.onCompleteNavigateTo,T=new Le(async(j="create-wallet")=>(y(!0),new Promise((O,U)=>{setTimeout(async()=>{try{let W=window.open();await n(c,j,W),s(!0),O()}catch{C({message:`${j==="recover"?"Recovery":"Back up"} with ${b} unsuccessful`,detail:m==="recover"?`Please verify that you are selecting the ${b} account associated with your backup.`:"",retryable:!0}),U()}},0)})));ev(()=>{m!=="recover"&&T.execute(f?"create-wallet":"set-recovery")},[]),ev(()=>{if(!l)return;let j=setTimeout(()=>{f?(r({createWallet:{onSuccess:()=>{},onFailure:O=>{a({eventName:"embedded_wallet_creation_failure_logout",payload:{error:O,screen:"RecoveryOAuthScreen"}}),e()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_CREATED_SCREEN")):i({shouldCallAuthOnSuccess:!1})},Ne);return()=>clearTimeout(j)},[l]);let A=s9(async()=>{await T.execute("recover"),k?t(k):s(!0)},[]),R=c==="google-drive"?"Google Drive":"Apple iCloud",I=m==="recover"?"recovered":"backed up",D=m==="recover"?"Recovering":"Backing up",H=l&&`Successfully ${I} with ${R}.`||u&&u.message||`${D} with ${R}...`,K=u?u.detail:"";return Yc(rv,{children:[pn(x,{}),g?pn(rv,{children:Yc(ts,{children:[pn(ge,{title:H,icon:pn(E,{style:{width:"38px",height:"38px"}}),description:K}),u&&u?.retryable?pn(B,{onClick:()=>{En(),C(void 0),m==="create-wallet"?T.execute("create-wallet"):A()},disabled:!l&&!u?.retryable,children:"Try again"}):null]})}):Yc(ts,{children:[pn(ge,{title:"Confirm it's really you",icon:pn(E,{style:{height:42,width:48}}),description:`To confirm your identity, please log in to ${R} where your account is backed up.`}),Yc(B,{onClick:A,children:["Confirm with ",R]})]}),pn($,{})]})};import{useEffect as nv,useState as rs}from"react";import{jsx as l9}from"react/jsx-runtime";var iv=()=>{let{app:e,navigate:t,data:r,onUserCloseViaDialogOrKeybindRef:o}=P(),[n,i]=rs(""),[a,l]=rs(!1),[s,c]=rs(),[m,f]=rs(null),{authenticated:u}=z(),{closePrivyModal:C,isNewUserThisSession:g,initializeWalletProxy:y}=M(),{onSuccess:b,onFailure:E,callAuthOnSuccessOnClose:k}=r.createWallet,{createWallet:T}=Nl(),[A,R]=rs(null),I=new Le(async()=>{try{let K=await T(s);if(!K)return;R(K),g?t("EMBEDDED_WALLET_CREATED_SCREEN"):(b(K),C({shouldCallAuthOnSuccess:k}))}catch(K){i(K.message)}});nv(()=>{m||y(3e4).then(K=>f(K))},[m]),nv(()=>{if(!u){t("LANDING"),E(new Error("User must be authenticated before creating a Privy wallet"));return}},[u]);let D=()=>{A&&A?.recoveryMethod!=="user-passcode"?(E(new Wt("User created a wallet but failed to set a password for it")),C({shouldCallAuthOnSuccess:!1})):A?(b(A),C({shouldCallAuthOnSuccess:k})):(E(new Wt("User wallet creation failed")),C({shouldCallAuthOnSuccess:!1}))};o.current=()=>null;let H=async()=>{l(!0);let K=250;return I.execute().then(()=>new Promise(j=>setTimeout(j,K))).finally(()=>l(!1))};return l9(Bl,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:!m,buttonLoading:a,buttonHideAnimations:!A&&a,isResettingPassword:!1,error:n,password:s||"",onClose:D,onPasswordChange:c,onPasswordGenerate:()=>c(Fl()),onSubmit:H})};import c9 from"@heroicons/react/24/outline/LockClosedIcon";import d9 from"@heroicons/react/24/outline/PencilSquareIcon";import p9 from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import{useState as u9}from"react";import m9 from"styled-components";import{Fragment as Qp,jsx as yt,jsxs as un}from"react/jsx-runtime";var Zp=m9.div`
2645
+ `;import{Fragment as av,jsx as mn,jsxs as Qc}from"react/jsx-runtime";var iv={"google-drive":{name:"Google Drive",component:Zc},icloud:{name:"iCloud",component:Yc}},sv=()=>{let{logout:e}=q(),{navigate:t,setModalData:r,data:o}=_(),{recoveryOAuthFlow:n,closePrivyModal:i,createAnalyticsEvent:a}=M(),[l,s]=Qp(!1),{provider:c,action:m,isInAccountCreateFlow:f}=o?.recoveryOAuthStatus,[u,C]=Qp(void 0),[g,y]=Qp(m==="create-wallet");if(c==="user-passcode")throw new Error("RecoveryOAuthScreen should never be called with a wallet that specifies recoveryMethod: `user-passcode`");let b=iv[c].name,T=iv[c].component,k=o?.recoverWallet?.onCompleteNavigateTo,S=new Le(async(j="create-wallet")=>(y(!0),new Promise((O,U)=>{setTimeout(async()=>{try{let W=window.open();await n(c,j,W),s(!0),O()}catch{C({message:`${j==="recover"?"Recovery":"Back up"} with ${b} unsuccessful`,detail:m==="recover"?`Please verify that you are selecting the ${b} account associated with your backup.`:"",retryable:!0}),U()}},0)})));nv(()=>{m!=="recover"&&S.execute(f?"create-wallet":"set-recovery")},[]),nv(()=>{if(!l)return;let j=setTimeout(()=>{f?(r({createWallet:{onSuccess:()=>{},onFailure:O=>{a({eventName:"embedded_wallet_creation_failure_logout",payload:{error:O,screen:"RecoveryOAuthScreen"}}),e()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_CREATED_SCREEN")):i({shouldCallAuthOnSuccess:!1})},Ne);return()=>clearTimeout(j)},[l]);let x=u9(async()=>{await S.execute("recover"),k?t(k):s(!0)},[]),R=c==="google-drive"?"Google Drive":"Apple iCloud",I=m==="recover"?"recovered":"backed up",D=m==="recover"?"Recovering":"Backing up",H=l&&`Successfully ${I} with ${R}.`||u&&u.message||`${D} with ${R}...`,K=u?u.detail:"";return Qc(av,{children:[mn(A,{}),g?mn(av,{children:Qc(rs,{children:[mn(he,{title:H,icon:mn(T,{style:{width:"38px",height:"38px"}}),description:K}),u&&u?.retryable?mn(B,{onClick:()=>{_n(),C(void 0),m==="create-wallet"?S.execute("create-wallet"):x()},disabled:!l&&!u?.retryable,children:"Try again"}):null]})}):Qc(rs,{children:[mn(he,{title:"Confirm it's really you",icon:mn(T,{style:{height:42,width:48}}),description:`To confirm your identity, please log in to ${R} where your account is backed up.`}),Qc(B,{onClick:x,children:["Confirm with ",R]})]}),mn(z,{})]})};import{useEffect as lv,useState as os}from"react";import{jsx as m9}from"react/jsx-runtime";var cv=()=>{let{app:e,navigate:t,data:r,onUserCloseViaDialogOrKeybindRef:o}=_(),[n,i]=os(""),[a,l]=os(!1),[s,c]=os(),[m,f]=os(null),{authenticated:u}=q(),{closePrivyModal:C,isNewUserThisSession:g,initializeWalletProxy:y}=M(),{onSuccess:b,onFailure:T,callAuthOnSuccessOnClose:k}=r.createWallet,{createWallet:S}=Ul(),[x,R]=os(null),I=new Le(async()=>{try{let K=await S(s);if(!K)return;R(K),g?t("EMBEDDED_WALLET_CREATED_SCREEN"):(b(K),C({shouldCallAuthOnSuccess:k}))}catch(K){i(K.message)}});lv(()=>{m||y(3e4).then(K=>f(K))},[m]),lv(()=>{if(!u){t("LANDING"),T(new Error("User must be authenticated before creating a Privy wallet"));return}},[u]);let D=()=>{x&&x?.recoveryMethod!=="user-passcode"?(T(new Wt("User created a wallet but failed to set a password for it")),C({shouldCallAuthOnSuccess:!1})):x?(b(x),C({shouldCallAuthOnSuccess:k})):(T(new Wt("User wallet creation failed")),C({shouldCallAuthOnSuccess:!1}))};o.current=()=>null;let H=async()=>{l(!0);let K=250;return I.execute().then(()=>new Promise(j=>setTimeout(j,K))).finally(()=>l(!1))};return m9(Gl,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:!m,buttonLoading:a,buttonHideAnimations:!x&&a,isResettingPassword:!1,error:n,password:s||"",onClose:D,onPasswordChange:c,onPasswordGenerate:()=>c(Hl()),onSubmit:H})};import f9 from"@heroicons/react/24/outline/LockClosedIcon";import h9 from"@heroicons/react/24/outline/PencilSquareIcon";import y9 from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import{useState as g9}from"react";import v9 from"styled-components";import{Fragment as Xp,jsx as yt,jsxs as fn}from"react/jsx-runtime";var Jp=v9.div`
2646
2646
  width: 24px;
2647
2647
  height: 24px;
2648
2648
  display: flex;
2649
2649
  justify-content: center;
2650
2650
  align-items: center;
2651
- `,f9={"google-drive":"Google Drive",icloud:"iCloud","user-passcode":"password",privy:"Privy"},h9=({onClose:e})=>un(X2,{children:[yt(ge,{title:"Why do I need to secure my account?",icon:yt(p9,{width:48}),description:un(Qp,{children:[yt("p",{children:"Your app uses cryptography to secure your account. App secrets are split and encrypted so only you can access them."}),yt("p",{children:"To use this app on new devices, secure account secrets using a password, your Google or your Apple account. It\u2019s important you don\u2019t lose access to the method you choose."})]})}),yt(B,{onClick:e,children:"Select backup method"})]}),av=()=>{let[e,t]=u9(!1),{navigate:r,setModalData:o,data:n}=P(),{user:i}=z(),{embeddedWallets:a}=Ve(),l=ye(i),s=l===null,{isInAccountCreateFlow:c,isResettingPassword:m}=n.recoverySelection,f=l?.recoveryMethod!=="privy",u=f?"Update backup method":"Secure your account",C=f?un("span",{children:["Your account is currently secured using"," ",yt("strong",{children:f9[l?.recoveryMethod||"user-passcode"]}),"."]}):"Select a method for logging in on new devices and recovering your account.";function g(y){o({recoveryOAuthStatus:{provider:y,action:s?"create-wallet":"set-recovery",isInAccountCreateFlow:c}}),r("EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN")}return un(Qp,{children:[yt(x,{backFn:e?()=>t(!1):void 0,infoFn:e?void 0:()=>t(!0)},"header"),e?yt(h9,{onClose:()=>t(!1)}):un(Qp,{children:[yt(ge,{title:u,icon:yt(c9,{width:48}),description:C}),yt(ts,{children:a.userOwnedRecoveryOptions.filter(y=>["icloud","google-drive"].includes(l?.recoveryMethod||"")?y!==l?.recoveryMethod:!0).sort().map(y=>{switch(y){case"google-drive":return un(Ee,{onClick:()=>g("google-drive"),children:[yt(Zp,{children:yt(jc,{style:{width:18}})}),"Back up to Google Drive"]},y);case"icloud":return un(Ee,{onClick:()=>g("icloud"),children:[yt(Zp,{children:yt(Kc,{style:{width:24}})}),"Back up to Apple iCloud"]},y);case"user-passcode":return un(Ee,{onClick:()=>{let b=rp({isCreatingWallet:s,skipSplashScreen:!0});r(b)},children:[yt(Zp,{children:yt(d9,{style:{width:18}})}),m?"Reset your":"Set a"," password"]},y);default:return null}})})]}),yt($,{})]})};import{getAddress as Tv}from"@ethersproject/address";import{useEffect as iS,useMemo as Xc,useState as os}from"react";import{ProviderErrors as Pv,QuantityToBigNumber as Sv}from"@privy-io/js-sdk-core";var sv=["FUNDING_METHOD_SELECTION_SCREEN","FUNDING_TRANSFER_FROM_WALLET_SCREEN","FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN","FUNDING_MANUAL_TRANSFER_SCREEN","MOONPAY_PROMPT_SCREEN","MOONPAY_STATUS_SCREEN"],lv={["FUNDING_METHOD_SELECTION_SCREEN"]:null,["FUNDING_TRANSFER_FROM_WALLET_SCREEN"]:"external",["FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN"]:"external",["FUNDING_MANUAL_TRANSFER_SCREEN"]:"manual",["MOONPAY_PROMPT_SCREEN"]:"moonpay",["MOONPAY_STATUS_SCREEN"]:"moonpay"},y9={moonpay:"MOONPAY_PROMPT_SCREEN","coinbase-onramp":"COINBASE_ONRAMP_STATUS_SCREEN",external:"FUNDING_TRANSFER_FROM_WALLET_SCREEN"};function Zc({fundingMethods:e}){if(e.length===0)throw new Error("Wallet funding is not enabled");return e.length===1?y9[e[0]]:"FUNDING_METHOD_SELECTION_SCREEN"}import cv from"styled-components";import g9 from"styled-components";var Qc=g9.span`
2651
+ `,C9={"google-drive":"Google Drive",icloud:"iCloud","user-passcode":"password",privy:"Privy"},w9=({onClose:e})=>fn(ov,{children:[yt(he,{title:"Why do I need to secure my account?",icon:yt(y9,{width:48}),description:fn(Xp,{children:[yt("p",{children:"Your app uses cryptography to secure your account. App secrets are split and encrypted so only you can access them."}),yt("p",{children:"To use this app on new devices, secure account secrets using a password, your Google or your Apple account. It\u2019s important you don\u2019t lose access to the method you choose."})]})}),yt(B,{onClick:e,children:"Select backup method"})]}),dv=()=>{let[e,t]=g9(!1),{navigate:r,setModalData:o,data:n}=_(),{user:i}=q(),{embeddedWallets:a}=Ve(),l=ge(i),s=l===null,{isInAccountCreateFlow:c,isResettingPassword:m}=n.recoverySelection,f=l?.recoveryMethod!=="privy",u=f?"Update backup method":"Secure your account",C=f?fn("span",{children:["Your account is currently secured using"," ",yt("strong",{children:C9[l?.recoveryMethod||"user-passcode"]}),"."]}):"Select a method for logging in on new devices and recovering your account.";function g(y){o({recoveryOAuthStatus:{provider:y,action:s?"create-wallet":"set-recovery",isInAccountCreateFlow:c}}),r("EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN")}return fn(Xp,{children:[yt(A,{backFn:e?()=>t(!1):void 0,infoFn:e?void 0:()=>t(!0)},"header"),e?yt(w9,{onClose:()=>t(!1)}):fn(Xp,{children:[yt(he,{title:u,icon:yt(f9,{width:48}),description:C}),yt(rs,{children:a.userOwnedRecoveryOptions.filter(y=>["icloud","google-drive"].includes(l?.recoveryMethod||"")?y!==l?.recoveryMethod:!0).sort().map(y=>{switch(y){case"google-drive":return fn(Ee,{onClick:()=>g("google-drive"),children:[yt(Jp,{children:yt(Zc,{style:{width:18}})}),"Back up to Google Drive"]},y);case"icloud":return fn(Ee,{onClick:()=>g("icloud"),children:[yt(Jp,{children:yt(Yc,{style:{width:24}})}),"Back up to Apple iCloud"]},y);case"user-passcode":return fn(Ee,{onClick:()=>{let b=np({isCreatingWallet:s,skipSplashScreen:!0});r(b)},children:[yt(Jp,{children:yt(h9,{style:{width:18}})}),m?"Reset your":"Set a"," password"]},y);default:return null}})})]}),yt(z,{})]})};import{getAddress as Av}from"@ethersproject/address";import{useEffect as dS,useMemo as td,useState as ns}from"react";import{ProviderErrors as Rv,QuantityToBigNumber as xv}from"@privy-io/js-sdk-core";var pv=["FUNDING_METHOD_SELECTION_SCREEN","FUNDING_TRANSFER_FROM_WALLET_SCREEN","FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN","FUNDING_MANUAL_TRANSFER_SCREEN","MOONPAY_PROMPT_SCREEN","MOONPAY_STATUS_SCREEN"],uv={["FUNDING_METHOD_SELECTION_SCREEN"]:null,["FUNDING_TRANSFER_FROM_WALLET_SCREEN"]:"external",["FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN"]:"external",["FUNDING_MANUAL_TRANSFER_SCREEN"]:"manual",["MOONPAY_PROMPT_SCREEN"]:"moonpay",["MOONPAY_STATUS_SCREEN"]:"moonpay"},b9={moonpay:"MOONPAY_PROMPT_SCREEN","coinbase-onramp":"COINBASE_ONRAMP_STATUS_SCREEN",external:"FUNDING_TRANSFER_FROM_WALLET_SCREEN"};function Jc({fundingMethods:e}){if(e.length===0)throw new Error("Wallet funding is not enabled");return e.length===1?b9[e[0]]:"FUNDING_METHOD_SELECTION_SCREEN"}import mv from"styled-components";import E9 from"styled-components";var Xc=E9.span`
2652
2652
  color: var(--privy-color-foreground);
2653
2653
  font-size: 1.125rem;
2654
2654
  font-weight: 600;
2655
2655
  line-height: 1.875rem; /* 166.667% */
2656
2656
  text-align: center;
2657
- `;import{Fragment as E9,jsx as He,jsxs as vo}from"react/jsx-runtime";var dv=({img:e,submitError:t,prepareError:r,onClose:o,action:n,amount:i,title:a,subtitle:l,total:s,to:c,network:m,hasFunds:f,fee:u,from:C,cta:g,chain:y,isSubmitting:b,isPreparing:E,isTokenPriceLoading:k,isTokenContractInfoLoading:T,symbol:A,balance:R,onClick:I,spender:D})=>vo(E9,{children:[He(x,{onClose:o}),e&&He(b9,{children:e}),He(Qc,{style:{marginTop:e?"1.5rem":0},children:a}),He(qi,{children:l}),vo(Yl,{style:{marginTop:"2rem"},children:[s&&vo(pr,{children:[He(ur,{children:"Total"}),He(mr,{$isLoading:E||k,children:s})]}),n&&n!=="transaction"&&vo(pr,{children:[He(ur,{children:"Action"}),He(mr,{children:n})]}),i?vo(pr,{children:[He(ur,{children:"Amount"}),vo(mr,{$isLoading:T,children:[w9(i)," ",A]})]}):null,D?vo(pr,{children:[He(ur,{children:"Spender"}),He(mr,{children:He(Ba,{address:D,url:y?.blockExplorers?.default?.url,showCopyIcon:!1})})]}):null,c&&vo(pr,{children:[He(ur,{children:"To"}),He(mr,{children:He(Ba,{address:c,url:y?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),vo(pr,{children:[He(ur,{children:"Network"}),He(mr,{children:m})]}),vo(pr,{children:[He(ur,{children:"Estimated fee"}),He(mr,{$isLoading:E||k,children:u})]})]}),He(oo,{}),t?He(Fa,{style:{marginTop:"2rem"},children:t.message}):r?He(Fa,{style:{marginTop:"2rem"},children:C9}):null,He(v9,{$useSmallMargins:!!(r||t),address:C,balance:R,isLoading:E||k,errMsg:!E&&!r&&!t&&!f?`Add funds on ${y?.name} to complete transaction.`:void 0}),He(ll,{style:{marginTop:"1rem"},loading:b,onClick:I,children:g}),He($,{})]}),v9=cv(cc)`
2657
+ `;import{Fragment as A9,jsx as He,jsxs as vo}from"react/jsx-runtime";var fv=({img:e,submitError:t,prepareError:r,onClose:o,action:n,amount:i,title:a,subtitle:l,total:s,to:c,network:m,hasFunds:f,fee:u,from:C,cta:g,chain:y,isSubmitting:b,isPreparing:T,isTokenPriceLoading:k,isTokenContractInfoLoading:S,symbol:x,balance:R,onClick:I,spender:D})=>vo(A9,{children:[He(A,{onClose:o}),e&&He(P9,{children:e}),He(Xc,{style:{marginTop:e?"1.5rem":0},children:a}),He($i,{children:l}),vo(Ql,{style:{marginTop:"2rem"},children:[s&&vo(ur,{children:[He(mr,{children:"Total"}),He(fr,{$isLoading:T||k,children:s})]}),n&&n!=="transaction"&&vo(ur,{children:[He(mr,{children:"Action"}),He(fr,{children:n})]}),i?vo(ur,{children:[He(mr,{children:"Amount"}),vo(fr,{$isLoading:S,children:[_9(i)," ",x]})]}):null,D?vo(ur,{children:[He(mr,{children:"Spender"}),He(fr,{children:He(Ha,{address:D,url:y?.blockExplorers?.default?.url,showCopyIcon:!1})})]}):null,c&&vo(ur,{children:[He(mr,{children:"To"}),He(fr,{children:He(Ha,{address:c,url:y?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),vo(ur,{children:[He(mr,{children:"Network"}),He(fr,{children:m})]}),vo(ur,{children:[He(mr,{children:"Estimated fee"}),He(fr,{$isLoading:T||k,children:u})]})]}),He(oo,{}),t?He(Ba,{style:{marginTop:"2rem"},children:t.message}):r?He(Ba,{style:{marginTop:"2rem"},children:S9}):null,He(T9,{$useSmallMargins:!!(r||t),address:C,balance:R,isLoading:T||k,errMsg:!T&&!r&&!t&&!f?`Add funds on ${y?.name} to complete transaction.`:void 0}),He(dl,{style:{marginTop:"1rem"},loading:b,onClick:I,children:g}),He(z,{})]}),T9=mv(pc)`
2658
2658
  ${e=>e.$useSmallMargins?"margin-top: 0.5rem;":"margin-top: 2rem;"}
2659
- `,C9="There was an error preparing your transaction. Your transaction request will likely fail.",w9=e=>e.toLocaleString(),b9=cv.div`
2659
+ `,S9="There was an error preparing your transaction. Your transaction request will likely fail.",_9=e=>e.toLocaleString(),P9=mv.div`
2660
2660
  display: flex;
2661
2661
  width: 100%;
2662
2662
  justify-content: center;
@@ -2666,12 +2666,12 @@ You will have to sign up with another method first to register a passkey for you
2666
2666
  object-fit: contain;
2667
2667
  border-radius: var(--privy-border-radius-sm);
2668
2668
  }
2669
- `;import{ExclamationCircleIcon as S9,ClipboardDocumentIcon as _9,ClipboardDocumentCheckIcon as P9}from"@heroicons/react/24/outline";import{useState as A9}from"react";import Cr from"styled-components";import{ErrorCode as Jc}from"@ethersproject/logger";var T9=new Set([Jc.CALL_EXCEPTION,Jc.NONCE_EXPIRED,Jc.REPLACEMENT_UNDERPRICED,Jc.TRANSACTION_REPLACED]),pv=e=>{let t;return e.code&&e.code!==-32e3&&T9.has(e.code)&&(t=e.transactionHash),t},uv=e=>e.code==="SERVER_ERROR"?e.error?.message??e.reason??e.message??"unknown error":e.error?.code==="SERVER_ERROR"?e.error?.error?.message??e.reason??e.message??"unknown error":e.reason??e.message??"unknown error";import{Fragment as H9,jsx as It,jsxs as Yn}from"react/jsx-runtime";var x9=e=>{let t=e.code?e.code?.toString().charAt(0)+e.code?.toString().slice(1).replace("_"," ").toLowerCase():"Something went wrong.",r=pv(e),o=uv(e);return{errorCode:t,transactionHash:r,errorMessage:o}},k9=()=>Yn(W9,{children:[It(L9,{}),It(O9,{})]}),yv=({transactionError:e,chainId:t,onClose:r,onRetry:o})=>{let{chains:n}=M(),[i,a]=A9(!1),{errorCode:l,transactionHash:s,errorMessage:c}=x9(e),m=n.find(f=>f.id===t)?.blockExplorers?.default.url??"https://etherscan.io";return Yn(H9,{children:[It(x,{onClose:r}),Yn(R9,{children:[It(k9,{}),It(I9,{children:l}),It(M9,{children:"Please try again."}),Yn(fv,{children:[It(mv,{children:"Error message"}),It(hv,{clickable:!1,children:c})]}),s&&Yn(fv,{children:[It(mv,{children:"Transaction hash"}),Yn(D9,{children:["Copy this hash to view details about the transaction on a"," ",It("u",{children:It("a",{href:m,children:"block explorer"})}),"."]}),Yn(hv,{clickable:!0,onClick:async()=>{await navigator.clipboard.writeText(s),a(!0)},children:[s,It(B9,{clicked:i})]})]}),It(N9,{onClick:()=>o({resetNonce:!!s}),children:"Retry transaction"})]}),It(Z,{})]})},R9=Cr.div`
2669
+ `;import{ExclamationCircleIcon as k9,ClipboardDocumentIcon as R9,ClipboardDocumentCheckIcon as I9}from"@heroicons/react/24/outline";import{useState as M9}from"react";import wr from"styled-components";import{ErrorCode as ed}from"@ethersproject/logger";var x9=new Set([ed.CALL_EXCEPTION,ed.NONCE_EXPIRED,ed.REPLACEMENT_UNDERPRICED,ed.TRANSACTION_REPLACED]),hv=e=>{let t;return e.code&&e.code!==-32e3&&x9.has(e.code)&&(t=e.transactionHash),t},yv=e=>e.code==="SERVER_ERROR"?e.error?.message??e.reason??e.message??"unknown error":e.error?.code==="SERVER_ERROR"?e.error?.error?.message??e.reason??e.message??"unknown error":e.reason??e.message??"unknown error";import{Fragment as $9,jsx as It,jsxs as Qn}from"react/jsx-runtime";var W9=e=>{let t=e.code?e.code?.toString().charAt(0)+e.code?.toString().slice(1).replace("_"," ").toLowerCase():"Something went wrong.",r=hv(e),o=yv(e);return{errorCode:t,transactionHash:r,errorMessage:o}},O9=()=>Qn(U9,{children:[It(B9,{}),It(F9,{})]}),wv=({transactionError:e,chainId:t,onClose:r,onRetry:o})=>{let{chains:n}=M(),[i,a]=M9(!1),{errorCode:l,transactionHash:s,errorMessage:c}=W9(e),m=n.find(f=>f.id===t)?.blockExplorers?.default.url??"https://etherscan.io";return Qn($9,{children:[It(A,{onClose:r}),Qn(L9,{children:[It(O9,{}),It(N9,{children:l}),It(D9,{children:"Please try again."}),Qn(vv,{children:[It(gv,{children:"Error message"}),It(Cv,{clickable:!1,children:c})]}),s&&Qn(vv,{children:[It(gv,{children:"Transaction hash"}),Qn(G9,{children:["Copy this hash to view details about the transaction on a"," ",It("u",{children:It("a",{href:m,children:"block explorer"})}),"."]}),Qn(Cv,{clickable:!0,onClick:async()=>{await navigator.clipboard.writeText(s),a(!0)},children:[s,It(z9,{clicked:i})]})]}),It(H9,{onClick:()=>o({resetNonce:!!s}),children:"Retry transaction"})]}),It(Z,{})]})},L9=wr.div`
2670
2670
  display: flex;
2671
2671
  flex-direction: column;
2672
2672
  align-items: center;
2673
2673
  justify-content: center;
2674
- `,I9=Cr.span`
2674
+ `,N9=wr.span`
2675
2675
  color: var(--privy-color-foreground);
2676
2676
  text-align: center;
2677
2677
  font-size: 1.125rem;
@@ -2679,7 +2679,7 @@ You will have to sign up with another method first to register a passkey for you
2679
2679
  line-height: 1.25rem; /* 111.111% */
2680
2680
  text-align: center;
2681
2681
  margin: 10px;
2682
- `,M9=Cr.span`
2682
+ `,D9=wr.span`
2683
2683
  margin-top: 4px;
2684
2684
  margin-bottom: 10px;
2685
2685
  color: var(--privy-color-foreground-3);
@@ -2690,7 +2690,7 @@ You will have to sign up with another method first to register a passkey for you
2690
2690
  font-weight: 400;
2691
2691
  line-height: 20px; /* 142.857% */
2692
2692
  letter-spacing: -0.008px;
2693
- `,W9=Cr.div`
2693
+ `,U9=wr.div`
2694
2694
  position: relative;
2695
2695
  width: 60px;
2696
2696
  height: 60px;
@@ -2698,37 +2698,37 @@ You will have to sign up with another method first to register a passkey for you
2698
2698
  display: flex;
2699
2699
  justify-content: center;
2700
2700
  align-items: center;
2701
- `,O9=Cr(S9)`
2701
+ `,F9=wr(k9)`
2702
2702
  position: absolute;
2703
2703
  width: 35px;
2704
2704
  height: 35px;
2705
2705
  color: var(--privy-color-error);
2706
- `,L9=Cr.div`
2706
+ `,B9=wr.div`
2707
2707
  position: absolute;
2708
2708
  width: 60px;
2709
2709
  height: 60px;
2710
2710
  border-radius: 50%;
2711
2711
  background-color: var(--privy-color-error);
2712
2712
  opacity: 0.1;
2713
- `,N9=Cr(B)`
2713
+ `,H9=wr(B)`
2714
2714
  && {
2715
2715
  margin-top: 24px;
2716
2716
  }
2717
2717
  transition: color 350ms ease, background-color 350ms ease;
2718
- `,mv=Cr.span`
2718
+ `,gv=wr.span`
2719
2719
  width: 100%;
2720
2720
  text-align: left;
2721
2721
  font-size: 0.825rem;
2722
2722
  color: var(--privy-color-foreground);
2723
2723
  padding: 4px;
2724
- `,fv=Cr.div`
2724
+ `,vv=wr.div`
2725
2725
  width: 100%;
2726
2726
  margin: 5px;
2727
2727
  display: flex;
2728
2728
  flex-direction: column;
2729
2729
  justify-content: center;
2730
2730
  align-items: center;
2731
- `,D9=Cr.text`
2731
+ `,G9=wr.text`
2732
2732
  position: relative;
2733
2733
  width: 100%;
2734
2734
  padding: 5px;
@@ -2736,7 +2736,7 @@ You will have to sign up with another method first to register a passkey for you
2736
2736
  color: var(--privy-color-foreground-3);
2737
2737
  text-align: left;
2738
2738
  word-wrap: break-word;
2739
- `,hv=Cr.span`
2739
+ `,Cv=wr.span`
2740
2740
  position: relative;
2741
2741
  width: 100%;
2742
2742
  background-color: var(--privy-color-background-2);
@@ -2754,24 +2754,24 @@ You will have to sign up with another method first to register a passkey for you
2754
2754
  &:hover {
2755
2755
  background-color: var(--privy-color-foreground-4);
2756
2756
  }`}
2757
- `,U9=Cr(_9)`
2757
+ `,V9=wr(R9)`
2758
2758
  position: absolute;
2759
2759
  top: 13px;
2760
2760
  right: 13px;
2761
2761
  width: 24px;
2762
2762
  height: 24px;
2763
- `,F9=Cr(P9)`
2763
+ `,q9=wr(I9)`
2764
2764
  position: absolute;
2765
2765
  top: 13px;
2766
2766
  right: 13px;
2767
2767
  width: 24px;
2768
2768
  height: 24px;
2769
- `,B9=({clicked:e})=>e?It(F9,{}):It(U9,{});import{BigNumber as Jp}from"@ethersproject/bignumber";import G9 from"styled-components";import{Fragment as z9,jsx as Zn,jsxs as $9}from"react/jsx-runtime";var V9=(e,t)=>{if(e.gasUsed&&e.effectiveGasPrice)try{let r=Jp.from(e.gasUsed),o=Jp.from(e.effectiveGasPrice),n=r.mul(o);if(t){let i=Jp.from(t);n=n.add(i)}return n.toString()}catch{return}else return},gv=({txn:e,receipt:t,transactionInfo:r,onClose:o,tokenPrice:n,tokenSymbol:i,l1GasEstimate:a,receiptHeader:l,receiptDescription:s})=>$9(z9,{children:[Zn(x,{onClose:o}),Zn(Mn,{title:l??"Transaction complete!",description:s??"You're all set."}),Zn(Hc,{tokenPrice:n,from:t.from,to:t.to,gas:V9(t,a),txn:e,transactionInfo:r,tokenSymbol:i}),Zn(oo,{}),Zn(q9,{loading:!1,onClick:o,children:"All Done"}),Zn(ie,{}),Zn($,{})]}),q9=G9(B)`
2769
+ `,z9=({clicked:e})=>e?It(q9,{}):It(V9,{});import{BigNumber as eu}from"@ethersproject/bignumber";import K9 from"styled-components";import{Fragment as Z9,jsx as Jn,jsxs as Q9}from"react/jsx-runtime";var j9=(e,t)=>{if(e.gasUsed&&e.effectiveGasPrice)try{let r=eu.from(e.gasUsed),o=eu.from(e.effectiveGasPrice),n=r.mul(o);if(t){let i=eu.from(t);n=n.add(i)}return n.toString()}catch{return}else return},bv=({txn:e,receipt:t,transactionInfo:r,onClose:o,tokenPrice:n,tokenSymbol:i,l1GasEstimate:a,receiptHeader:l,receiptDescription:s})=>Q9(Z9,{children:[Jn(A,{onClose:o}),Jn(On,{title:l??"Transaction complete!",description:s??"You're all set."}),Jn(Vc,{tokenPrice:n,from:t.from,to:t.to,gas:j9(t,a),txn:e,transactionInfo:r,tokenSymbol:i}),Jn(oo,{}),Jn(Y9,{loading:!1,onClick:o,children:"All Done"}),Jn(ie,{}),Jn(z,{})]}),Y9=K9(B)`
2770
2770
  && {
2771
2771
  margin-top: 24px;
2772
2772
  }
2773
2773
  transition: color 350ms ease, background-color 350ms ease;
2774
- `;import{createPublicClient as K9,http as j9}from"viem";var Y9=(e,t)=>Intl.NumberFormat(void 0,{maximumFractionDigits:t}).format(e/Math.pow(10,t)),vv=[{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"}],Cv=async({address:e,chain:t,amount:r,rpcConfig:o,privyAppId:n})=>{if(!r)return{value:"",symbol:""};try{let i=K9({chain:t,transport:j9(dd(t,o,n))}),[a,l]=await Promise.all([i.readContract({abi:vv,address:e,functionName:"symbol"}),i.readContract({abi:vv,address:e,functionName:"decimals"})]);return{value:Y9(parseFloat(r.toString()),l),symbol:a}}catch(i){return console.log(i),{value:r.toString(),symbol:""}}};import{decodeFunctionData as wv}from"viem";var bv=e=>{let t=Q9(e);if(t)return{action:"approve",isErc20Ish:!0,functionName:t.functionName,spender:t.args[0],amount:t.args[1]};let r=X9(e);return r?{action:"transfer",isErc20Ish:!0,functionName:r.functionName,amount:r.args[1]}:{action:"transaction",isErc20Ish:!1}},Z9=[{constant:!1,inputs:[{name:"spender",type:"address"},{name:"value",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],Q9=e=>{try{return wv({abi:Z9,data:e})}catch{return null}},J9=[{constant:!1,inputs:[{name:"to",type:"address"},{name:"value",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],X9=e=>{try{return wv({abi:J9,data:e})}catch{return null}};import{BigNumber as eS}from"@ethersproject/bignumber";import{useEffect as tS,useState as rS}from"react";import{calculateTotalGasEstimate as oS,populateTransactionRequest as nS}from"@privy-io/js-sdk-core";var Ev=(e,t)=>{let[r,o]=rS(null),{getAccessToken:n,user:i}=z(),{walletProxy:a}=M(),l=ye(i),s=async()=>{if(!await n()||!a||!l)return null;let m=[],f=await nS(l.address,e,t).catch(b=>(m.push(b),e)),{totalGasEstimate:u,l1ExecutionFeeEstimate:C}=await oS(f,t).catch(b=>(m.push(b),{totalGasEstimate:null,l1ExecutionFeeEstimate:null})),{balance:g,hasSufficientFunds:y}=await Fi(l.address,f,u??eS.from(0),t).catch(b=>(m.push(b),{balance:null,hasSufficientFunds:!1}));return{tx:f,totalGasEstimate:u,l1ExecutionFeeEstimate:C,balance:g,hasFunds:y,errors:m}};return tS(()=>{r&&o(null),s().then(o)},[e]),r};import{jsx as ns}from"react/jsx-runtime";var _v=new Ct(new Tr("There was an issue preparing your transaction",Pv.E32603_DEFAULT_INTERNAL_ERROR.eipCode)),Av=()=>{let{data:e,onUserCloseViaDialogOrKeybindRef:t,setModalData:r,navigate:o}=P(),{rpcConfig:n,chains:i,closePrivyModal:a,walletProxy:l}=M(),{getAccessToken:s,user:c}=z(),{wallets:m}=zr(),f=Ve(),[u,C]=os(e?.sendTransaction?.transactionRequest),[g,y]=os(null),[b,E]=os(!1),[k,T]=os(null),[A,R]=os(null);if(!u||!e?.sendTransaction)return ns(Fn,{error:new Error("Invalid transaction request"),onClick:()=>{e?.sendTransaction?.onFailure(_v),a({shouldCallAuthOnSuccess:!1})}});let I=Xc(()=>u.from?m.find(V=>Tv(V.address)===Tv(u.from)):ye(c),[u.from]),D=Xc(()=>i.find(V=>Number(V.id)===Number(u.chainId)),[u.chainId]),H=D?.nativeCurrency.symbol??"ETH",{action:K,amount:j,spender:O,isErc20Ish:U}=Xc(()=>bv(u.data),[u.data]);iS(()=>{u.to&&D&&U&&Cv({amount:j,address:u.to,chain:D,rpcConfig:f.rpcConfig,privyAppId:f.id}).then(y).catch(console.error)},[u.to,j,D]);let{tokenPrice:W,isTokenPriceLoading:Ce}=uo(u),Ie=Xc(()=>Gt(Number(u.chainId),i,n,{appId:f.id}),[u.chainId,n]),Y=Ev(u,Ie),X=()=>{if(!b)return k?(e?.sendTransaction?.onSuccess(k.response),a({shouldCallAuthOnSuccess:!1})):!A&&!Y?.errors[0]?(e?.sendTransaction?.onFailure(new Ct(new Tr("The user rejected the request",Pv.E4001_USER_REJECTED_REQUEST.eipCode))),a({shouldCallAuthOnSuccess:!1})):(e?.sendTransaction?.onFailure(A??Y?.errors[0]??_v),a({shouldCallAuthOnSuccess:!1}))};t.current=X;let te=async()=>{E(!0);try{let V=await s();if(b||!V||!I||!l)return;let ae=await Zl(V,I.address,l,Y?.tx??u,Ie,e.sendTransaction?.requesterAppId),lt=await ae.wait();T({receipt:Ql(lt),response:ae})}catch(V){console.warn({transaction:Y?.tx??u,error:V}),R(V)}finally{E(!1)}},_e=async()=>{if(!ye(c))return;if(!f.fundingConfig||f.fundingConfig.methods.length===0||!e.funding)throw new Error("Funding wallet is not enabled");let ae=Zc({fundingMethods:f.fundingConfig?.methods});r({...e,funding:{...e?.funding,methodScreen:ae}}),o(ae)},Te=f.embeddedWallets.priceDisplay.primary==="fiat-currency",Ke=Sv(Y?.tx.value??0).add(Sv(Y?.totalGasEstimate?.toBigInt()??0)).toHexString(),Ge=fr(Ke,H),mt=Te&&W?mo(Ke,W):void 0,Fe=fr(Y?.totalGasEstimate?.toString()??0,H),se=Te&&W?mo(Y?.totalGasEstimate?.toString()??0,W):void 0,Ft=fr(Y?.balance?.toString()??0,H,void 0,!0),Wr=Te&&W?mo(Y?.balance?.toString()??0,W):void 0,Zr=e.sendTransaction?.uiOptions?.transactionInfo?.title||(K==="approve"?"Confirm address":`Approve ${K}`),L=e.sendTransaction?.uiOptions?.description||`${f.name} wants your permission to approve the following transaction.`,rt=e.sendTransaction?.uiOptions?.transactionInfo?.contractInfo?.imgUrl?ns("img",{src:e.sendTransaction.uiOptions.transactionInfo.contractInfo.imgUrl,alt:e.sendTransaction.uiOptions.transactionInfo.contractInfo.imgAltText}):null,Or=Y&&!Y.errors[0]&&!Y.hasFunds&&f.fundingConfig&&f.fundingConfig.methods.length>0,G=Or?"Add funds":e.sendTransaction?.uiOptions?.buttonText||"Approve";return k?.receipt?ns(gv,{txn:Y?.tx??u,onClose:X,receipt:k.receipt,transactionInfo:e.sendTransaction?.uiOptions.transactionInfo,tokenPrice:W,tokenSymbol:H,l1GasEstimate:Y?.l1ExecutionFeeEstimate?.toString(),receiptHeader:e.sendTransaction?.uiOptions.successHeader,receiptDescription:e.sendTransaction?.uiOptions.successDescription}):A?ns(yv,{transactionError:A,chainId:Y?.tx.chainId??u.chainId,onClose:X,onRetry:({resetNonce:V})=>{R(null);let ae={...Y?.tx??u};V&&(ae.nonce=void 0),C(ae)}}):ns(dv,{isSubmitting:b,submitError:A,isPreparing:!Y,isTokenPriceLoading:Ce,isTokenContractInfoLoading:!g,prepareError:Y?.errors[0],symbol:g?.symbol,chain:D,img:rt,title:Zr,subtitle:L,spender:O,total:u.value?mt??Ge:void 0,fee:se??Fe,to:u.to,network:f.chains.find(V=>V.id===u.chainId)?.name??"",from:I?.address??"",cta:G,hasFunds:Y?.hasFunds,action:K,balance:Wr??Ft,amount:g?.value??j,onClose:X,onClick:Or?_e:te})};import{isHexString as aS}from"@ethersproject/bytes";import{toUtf8String as sS}from"@ethersproject/strings";import{useEffect as xv,useState as is}from"react";import Qi from"styled-components";import{ProviderErrors as Xp}from"@privy-io/js-sdk-core";import{Fragment as Rv,jsx as Xe,jsxs as as}from"react/jsx-runtime";var lS=e=>{if(!aS(e))return e;try{return sS(e)}catch{return e}},cS=e=>JSON.stringify(e,null,2),dS=({data:e})=>{let t=r=>typeof r=="object"&&r!==null?Xe(uS,{children:Object.entries(r).map(([o,n])=>as("li",{children:[as("strong",{children:[o,":"]})," ",t(n)]},o))}):Xe("span",{children:String(r)});return Xe("div",{children:t(e)})},pS=e=>{let{types:t,primaryType:r,...o}=e.typedData;return as(Rv,{children:[Xe(eu,{children:Xe(dS,{data:o})}),Xe(Jo,{text:cS(e.typedData),itemName:"full payload to clipboard"})," "]})},kv=()=>{let{authenticated:e}=z(),{initializeWalletProxy:t,closePrivyModal:r}=M(),{navigate:o,data:n,onUserCloseViaDialogOrKeybindRef:i}=P(),[a,l]=is(!0),[s,c]=is(""),[m,f]=is(),[u,C]=is(null),[g,y]=is(!1),b=u!==null;xv(()=>{e||o("LANDING")},[e]),xv(()=>{t(ri).then(K=>{l(!1),K||(c("An error has occurred, please try again."),f(new Ct(new Tr(s,Xp.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))})},[]);let{method:E,data:k,confirmAndSign:T,onSuccess:A,onFailure:R,uiOptions:I}=n.signMessage,D={title:I.title||"Sign message",description:I.description||"Signing this message will not cost you any fees.",buttonText:I.buttonText||"Sign and continue"},H=K=>{K?A(K):R(m||new Ct(new Tr("The user rejected the request.",Xp.E4001_USER_REJECTED_REQUEST.eipCode))),r({shouldCallAuthOnSuccess:!1}),setTimeout(()=>{C(null),c(""),f(void 0)},200)};return i.current=()=>{H(u)},as(Rv,{children:[Xe(x,{onClose:()=>H(u)}),Xe(ne,{}),I.iconUrl&&typeof I.iconUrl=="string"?Xe(hS,{children:Xe(O2,{size:"sm",src:I.iconUrl,alt:"app image"})}):null,Xe(Qc,{children:D.title}),Xe(qi,{children:D.description}),E==="personal_sign"&&Xe(eu,{children:lS(k)}),E==="eth_signTypedData_v4"&&Xe(pS,{typedData:k}),E==="solana_signMessage"&&Xe(eu,{children:k}),Xe(yS,{}),Xe(mS,{fail:!0,children:s}),Xe(ll,{disabled:g||b||a,loading:g,onClick:async()=>{y(!0),c("");try{let K=await T();C(K),y(!1),setTimeout(()=>{H(K)},Ne)}catch(K){console.error(K),c("An error has occurred, please try again."),f(new Ct(new Tr(s,Xp.E32603_DEFAULT_INTERNAL_ERROR.eipCode))),y(!1)}},children:g?"Signing...":b?as(fS,{children:[Xe(Ui,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",Xe("span",{children:"Success"})]}):D.buttonText}),Xe(ie,{}),Xe($,{})]})},eu=Qi.div`
2774
+ `;import{createPublicClient as J9,http as X9}from"viem";var eS=(e,t)=>Intl.NumberFormat(void 0,{maximumFractionDigits:t}).format(e/Math.pow(10,t)),Ev=[{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"}],Tv=async({address:e,chain:t,amount:r,rpcConfig:o,privyAppId:n})=>{if(!r)return{value:"",symbol:""};try{let i=J9({chain:t,transport:X9(ud(t,o,n))}),[a,l]=await Promise.all([i.readContract({abi:Ev,address:e,functionName:"symbol"}),i.readContract({abi:Ev,address:e,functionName:"decimals"})]);return{value:eS(parseFloat(r.toString()),l),symbol:a}}catch(i){return console.log(i),{value:r.toString(),symbol:""}}};import{decodeFunctionData as Sv}from"viem";var _v=e=>{let t=rS(e);if(t)return{action:"approve",isErc20Ish:!0,functionName:t.functionName,spender:t.args[0],amount:t.args[1]};let r=nS(e);return r?{action:"transfer",isErc20Ish:!0,functionName:r.functionName,amount:r.args[1]}:{action:"transaction",isErc20Ish:!1}},tS=[{constant:!1,inputs:[{name:"spender",type:"address"},{name:"value",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],rS=e=>{try{return Sv({abi:tS,data:e})}catch{return null}},oS=[{constant:!1,inputs:[{name:"to",type:"address"},{name:"value",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],nS=e=>{try{return Sv({abi:oS,data:e})}catch{return null}};import{BigNumber as iS}from"@ethersproject/bignumber";import{useEffect as aS,useState as sS}from"react";import{calculateTotalGasEstimate as lS,populateTransactionRequest as cS}from"@privy-io/js-sdk-core";var Pv=(e,t)=>{let[r,o]=sS(null),{getAccessToken:n,user:i}=q(),{walletProxy:a}=M(),l=ge(i),s=async()=>{if(!await n()||!a||!l)return null;let m=[],f=await cS(l.address,e,t).catch(b=>(m.push(b),e)),{totalGasEstimate:u,l1ExecutionFeeEstimate:C}=await lS(f,t).catch(b=>(m.push(b),{totalGasEstimate:null,l1ExecutionFeeEstimate:null})),{balance:g,hasSufficientFunds:y}=await Hi(l.address,f,u??iS.from(0),t).catch(b=>(m.push(b),{balance:null,hasSufficientFunds:!1}));return{tx:f,totalGasEstimate:u,l1ExecutionFeeEstimate:C,balance:g,hasFunds:y,errors:m}};return aS(()=>{r&&o(null),s().then(o)},[e]),r};import{jsx as is}from"react/jsx-runtime";var kv=new Ct(new Sr("There was an issue preparing your transaction",Rv.E32603_DEFAULT_INTERNAL_ERROR.eipCode)),Iv=()=>{let{data:e,onUserCloseViaDialogOrKeybindRef:t,setModalData:r,navigate:o}=_(),{rpcConfig:n,chains:i,closePrivyModal:a,walletProxy:l}=M(),{getAccessToken:s,user:c}=q(),{wallets:m}=zr(),f=Ve(),[u,C]=ns(e?.sendTransaction?.transactionRequest),[g,y]=ns(null),[b,T]=ns(!1),[k,S]=ns(null),[x,R]=ns(null);if(!u||!e?.sendTransaction)return is(Hn,{error:new Error("Invalid transaction request"),onClick:()=>{e?.sendTransaction?.onFailure(kv),a({shouldCallAuthOnSuccess:!1})}});let I=td(()=>u.from?m.find(V=>Av(V.address)===Av(u.from)):ge(c),[u.from]),D=td(()=>i.find(V=>Number(V.id)===Number(u.chainId)),[u.chainId]),H=D?.nativeCurrency.symbol??"ETH",{action:K,amount:j,spender:O,isErc20Ish:U}=td(()=>_v(u.data),[u.data]);dS(()=>{u.to&&D&&U&&Tv({amount:j,address:u.to,chain:D,rpcConfig:f.rpcConfig,privyAppId:f.id}).then(y).catch(console.error)},[u.to,j,D]);let{tokenPrice:W,isTokenPriceLoading:Ce}=uo(u),Ie=td(()=>Gt(Number(u.chainId),i,n,{appId:f.id}),[u.chainId,n]),Y=Pv(u,Ie),X=()=>{if(!b)return k?(e?.sendTransaction?.onSuccess(k.response),a({shouldCallAuthOnSuccess:!1})):!x&&!Y?.errors[0]?(e?.sendTransaction?.onFailure(new Ct(new Sr("The user rejected the request",Rv.E4001_USER_REJECTED_REQUEST.eipCode))),a({shouldCallAuthOnSuccess:!1})):(e?.sendTransaction?.onFailure(x??Y?.errors[0]??kv),a({shouldCallAuthOnSuccess:!1}))};t.current=X;let te=async()=>{T(!0);try{let V=await s();if(b||!V||!I||!l)return;let ae=await Jl(V,I.address,l,Y?.tx??u,Ie,e.sendTransaction?.requesterAppId),ct=await ae.wait();S({receipt:Xl(ct),response:ae})}catch(V){console.warn({transaction:Y?.tx??u,error:V}),R(V)}finally{T(!1)}},_e=async()=>{if(!ge(c))return;if(!f.fundingConfig||f.fundingConfig.methods.length===0||!e.funding)throw new Error("Funding wallet is not enabled");let ae=Jc({fundingMethods:f.fundingConfig?.methods});r({...e,funding:{...e?.funding,methodScreen:ae}}),o(ae)},Te=f.embeddedWallets.priceDisplay.primary==="fiat-currency",Ke=xv(Y?.tx.value??0).add(xv(Y?.totalGasEstimate?.toBigInt()??0)).toHexString(),Ge=hr(Ke,H),mt=Te&&W?mo(Ke,W):void 0,Fe=hr(Y?.totalGasEstimate?.toString()??0,H),se=Te&&W?mo(Y?.totalGasEstimate?.toString()??0,W):void 0,Ft=hr(Y?.balance?.toString()??0,H,void 0,!0),Wr=Te&&W?mo(Y?.balance?.toString()??0,W):void 0,Zr=e.sendTransaction?.uiOptions?.transactionInfo?.title||(K==="approve"?"Confirm address":`Approve ${K}`),L=e.sendTransaction?.uiOptions?.description||`${f.name} wants your permission to approve the following transaction.`,rt=e.sendTransaction?.uiOptions?.transactionInfo?.contractInfo?.imgUrl?is("img",{src:e.sendTransaction.uiOptions.transactionInfo.contractInfo.imgUrl,alt:e.sendTransaction.uiOptions.transactionInfo.contractInfo.imgAltText}):null,Or=Y&&!Y.errors[0]&&!Y.hasFunds&&f.fundingConfig&&f.fundingConfig.methods.length>0,G=Or?"Add funds":e.sendTransaction?.uiOptions?.buttonText||"Approve";return k?.receipt?is(bv,{txn:Y?.tx??u,onClose:X,receipt:k.receipt,transactionInfo:e.sendTransaction?.uiOptions.transactionInfo,tokenPrice:W,tokenSymbol:H,l1GasEstimate:Y?.l1ExecutionFeeEstimate?.toString(),receiptHeader:e.sendTransaction?.uiOptions.successHeader,receiptDescription:e.sendTransaction?.uiOptions.successDescription}):x?is(wv,{transactionError:x,chainId:Y?.tx.chainId??u.chainId,onClose:X,onRetry:({resetNonce:V})=>{R(null);let ae={...Y?.tx??u};V&&(ae.nonce=void 0),C(ae)}}):is(fv,{isSubmitting:b,submitError:x,isPreparing:!Y,isTokenPriceLoading:Ce,isTokenContractInfoLoading:!g,prepareError:Y?.errors[0],symbol:g?.symbol,chain:D,img:rt,title:Zr,subtitle:L,spender:O,total:u.value?mt??Ge:void 0,fee:se??Fe,to:u.to,network:f.chains.find(V=>V.id===u.chainId)?.name??"",from:I?.address??"",cta:G,hasFunds:Y?.hasFunds,action:K,balance:Wr??Ft,amount:g?.value??j,onClose:X,onClick:Or?_e:te})};import{isHexString as pS}from"@ethersproject/bytes";import{toUtf8String as uS}from"@ethersproject/strings";import{useEffect as Mv,useState as as}from"react";import Ji from"styled-components";import{ProviderErrors as tu}from"@privy-io/js-sdk-core";import{Fragment as Ov,jsx as Xe,jsxs as ss}from"react/jsx-runtime";var mS=e=>{if(!pS(e))return e;try{return uS(e)}catch{return e}},fS=e=>JSON.stringify(e,null,2),hS=({data:e})=>{let t=r=>typeof r=="object"&&r!==null?Xe(gS,{children:Object.entries(r).map(([o,n])=>ss("li",{children:[ss("strong",{children:[o,":"]})," ",t(n)]},o))}):Xe("span",{children:String(r)});return Xe("div",{children:t(e)})},yS=e=>{let{types:t,primaryType:r,...o}=e.typedData;return ss(Ov,{children:[Xe(ru,{children:Xe(hS,{data:o})}),Xe(Xo,{text:fS(e.typedData),itemName:"full payload to clipboard"})," "]})},Wv=()=>{let{authenticated:e}=q(),{initializeWalletProxy:t,closePrivyModal:r}=M(),{navigate:o,data:n,onUserCloseViaDialogOrKeybindRef:i}=_(),[a,l]=as(!0),[s,c]=as(""),[m,f]=as(),[u,C]=as(null),[g,y]=as(!1),b=u!==null;Mv(()=>{e||o("LANDING")},[e]),Mv(()=>{t(ni).then(K=>{l(!1),K||(c("An error has occurred, please try again."),f(new Ct(new Sr(s,tu.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))})},[]);let{method:T,data:k,confirmAndSign:S,onSuccess:x,onFailure:R,uiOptions:I}=n.signMessage,D={title:I.title||"Sign message",description:I.description||"Signing this message will not cost you any fees.",buttonText:I.buttonText||"Sign and continue"},H=K=>{K?x(K):R(m||new Ct(new Sr("The user rejected the request.",tu.E4001_USER_REJECTED_REQUEST.eipCode))),r({shouldCallAuthOnSuccess:!1}),setTimeout(()=>{C(null),c(""),f(void 0)},200)};return i.current=()=>{H(u)},ss(Ov,{children:[Xe(A,{onClose:()=>H(u)}),Xe(re,{}),I.iconUrl&&typeof I.iconUrl=="string"?Xe(wS,{children:Xe(U2,{size:"sm",src:I.iconUrl,alt:"app image"})}):null,Xe(Xc,{children:D.title}),Xe($i,{children:D.description}),T==="personal_sign"&&Xe(ru,{children:mS(k)}),T==="eth_signTypedData_v4"&&Xe(yS,{typedData:k}),T==="solana_signMessage"&&Xe(ru,{children:k}),Xe(bS,{}),Xe(vS,{fail:!0,children:s}),Xe(dl,{disabled:g||b||a,loading:g,onClick:async()=>{y(!0),c("");try{let K=await S();C(K),y(!1),setTimeout(()=>{H(K)},Ne)}catch(K){console.error(K),c("An error has occurred, please try again."),f(new Ct(new Sr(s,tu.E32603_DEFAULT_INTERNAL_ERROR.eipCode))),y(!1)}},children:g?"Signing...":b?ss(CS,{children:[Xe(Bi,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",Xe("span",{children:"Success"})]}):D.buttonText}),Xe(ie,{}),Xe(z,{})]})},ru=Ji.div`
2775
2775
  margin-top: 1.5rem;
2776
2776
  background-color: var(--privy-color-background-2);
2777
2777
  border-radius: var(--privy-border-radius-md);
@@ -2790,7 +2790,7 @@ You will have to sign up with another method first to register a passkey for you
2790
2790
  display: none; /* Safari and Chrome */
2791
2791
  }
2792
2792
  }
2793
- `,uS=Qi.ul`
2793
+ `,gS=Ji.ul`
2794
2794
  margin-left: 12px !important;
2795
2795
  white-space: nowrap;
2796
2796
 
@@ -2802,7 +2802,7 @@ You will have to sign up with another method first to register a passkey for you
2802
2802
  font-weight: 500 !important;
2803
2803
  }
2804
2804
  }
2805
- `,mS=Qi.div`
2805
+ `,vS=Ji.div`
2806
2806
  line-height: 20px;
2807
2807
  height: 20px;
2808
2808
  font-size: 13px;
@@ -2812,20 +2812,20 @@ You will have to sign up with another method first to register a passkey for you
2812
2812
  width: 100%;
2813
2813
  margin-top: 16px;
2814
2814
  margin-bottom: 4px;
2815
- `,fS=Qi.span`
2815
+ `,CS=Ji.span`
2816
2816
  display: flex;
2817
2817
  align-items: center;
2818
2818
  gap: 8px;
2819
- `,hS=Qi.div`
2819
+ `,wS=Ji.div`
2820
2820
  display: flex;
2821
2821
  flex-direction: column;
2822
2822
  justify-content: center;
2823
2823
  align-items: center;
2824
2824
  width: 100%;
2825
2825
  height: 82px;
2826
- `,yS=Qi.div`
2826
+ `,bS=Ji.div`
2827
2827
  flex-grow: 1;
2828
- `;import{useEffect as Iv,useState as Mv}from"react";import gS from"styled-components";import{Fragment as CS,jsx as Co,jsxs as ed}from"react/jsx-runtime";var Wv=()=>{let{authenticated:e,logout:t,ready:r,user:o}=z(),{app:n,setModalData:i,navigate:a,resetNavigation:l}=P(),{initLoginWithTelegram:s,loginWithTelegram:c,updateWallets:m,setReadyToTrue:f,closePrivyModal:u,createAnalyticsEvent:C}=M(),[g,y]=Mv(!1),[b,E]=Mv(void 0),k=Ne;async function T(){try{await c(),y(!0),f(!0)}catch(I){if(I?.privyErrorCode==="allowlist_rejected"){E(void 0),l(),a("ALLOWLIST_REJECTION_SCREEN");return}if(I?.privyErrorCode==="max_accounts_reached"){console.error(new br(I).toString()),E(void 0),l(),a("USER_LIMIT_REACHED_SCREEN");return}if(I?.privyErrorCode==="user_does_not_exist"){E(void 0),l(),a("ACCOUNT_NOT_FOUND_SCREEN");return}let{retryable:D,detail:H}=bd(I);E({retryable:D,detail:H,message:"Authentication failed"})}}Iv(()=>{T()},[]),Iv(()=>{if(!(r&&e&&g&&o))return;if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let H=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},k);return()=>clearTimeout(H)}if(qt(o,n?.embeddedWallets?.createOnLogin)){let H=setTimeout(()=>{i({createWallet:{onSuccess:()=>{},onFailure:K=>{console.error(K),C({eventName:"embedded_wallet_creation_failure_logout",payload:{error:K,provider:"telegram",screen:"TelegramAuthScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},k);return()=>clearTimeout(H)}m();let D=setTimeout(()=>u({shouldCallAuthOnSuccess:!0,isSuccess:!0}),k);return()=>clearTimeout(D)},[r,e,g,o]);let A=g?"Successfully connected with Telegram":b?b.message:"Verifying connection to Telegram",R="";return g?R="You\u2019re good to go!":b?R=b.detail:R="Just a few moments more",ed(CS,{children:[Co(x,{}),Co(ne,{}),ed(vS,{children:[Co(Je,{children:ed("div",{children:[Co(ot,{success:g,fail:!!b}),Co(xc,{style:{width:"38px",height:"38px"}})]})}),ed(qe,{children:[Co("h3",{children:A}),Co("p",{children:R})]}),b&&b?.retryable?Co(Ho,{onClick:()=>{s().then(async()=>T()).catch(I=>{let{retryable:D,detail:H}=bd(I);E({retryable:D,detail:H,message:"Authentication failed"})}),E(void 0)},disabled:!g&&!b?.retryable,children:"Retry"}):null]}),Co(ie,{}),Co(Z,{})]})},vS=gS.div`
2828
+ `;import{useEffect as Lv,useState as Nv}from"react";import ES from"styled-components";import{Fragment as SS,jsx as Co,jsxs as rd}from"react/jsx-runtime";var Dv=()=>{let{authenticated:e,logout:t,ready:r,user:o}=q(),{app:n,setModalData:i,navigate:a,resetNavigation:l}=_(),{initLoginWithTelegram:s,loginWithTelegram:c,updateWallets:m,setReadyToTrue:f,closePrivyModal:u,createAnalyticsEvent:C}=M(),[g,y]=Nv(!1),[b,T]=Nv(void 0),k=Ne;async function S(){try{await c(),y(!0),f(!0)}catch(I){if(I?.privyErrorCode==="allowlist_rejected"){T(void 0),l(),a("ALLOWLIST_REJECTION_SCREEN");return}if(I?.privyErrorCode==="max_accounts_reached"){console.error(new Er(I).toString()),T(void 0),l(),a("USER_LIMIT_REACHED_SCREEN");return}if(I?.privyErrorCode==="user_does_not_exist"){T(void 0),l(),a("ACCOUNT_NOT_FOUND_SCREEN");return}let{retryable:D,detail:H}=Td(I);T({retryable:D,detail:H,message:"Authentication failed"})}}Lv(()=>{S()},[]),Lv(()=>{if(!(r&&e&&g&&o))return;if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let H=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},k);return()=>clearTimeout(H)}if(qt(o,n?.embeddedWallets?.createOnLogin)){let H=setTimeout(()=>{i({createWallet:{onSuccess:()=>{},onFailure:K=>{console.error(K),C({eventName:"embedded_wallet_creation_failure_logout",payload:{error:K,provider:"telegram",screen:"TelegramAuthScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},k);return()=>clearTimeout(H)}m();let D=setTimeout(()=>u({shouldCallAuthOnSuccess:!0,isSuccess:!0}),k);return()=>clearTimeout(D)},[r,e,g,o]);let x=g?"Successfully connected with Telegram":b?b.message:"Verifying connection to Telegram",R="";return g?R="You\u2019re good to go!":b?R=b.detail:R="Just a few moments more",rd(SS,{children:[Co(A,{}),Co(re,{}),rd(TS,{children:[Co(Je,{children:rd("div",{children:[Co(nt,{success:g,fail:!!b}),Co(Rc,{style:{width:"38px",height:"38px"}})]})}),rd(qe,{children:[Co("h3",{children:x}),Co("p",{children:R})]}),b&&b?.retryable?Co(Go,{onClick:()=>{s().then(async()=>S()).catch(I=>{let{retryable:D,detail:H}=Td(I);T({retryable:D,detail:H,message:"Authentication failed"})}),T(void 0)},disabled:!g&&!b?.retryable,children:"Retry"}):null]}),Co(ie,{}),Co(Z,{})]})},TS=ES.div`
2829
2829
  display: flex;
2830
2830
  flex-direction: column;
2831
2831
  align-items: center;
@@ -2833,9 +2833,9 @@ You will have to sign up with another method first to register a passkey for you
2833
2833
  margin-left: 27px;
2834
2834
  margin-right: 27px;
2835
2835
  gap: 24px;
2836
- `;import _S from"@heroicons/react/24/outline/EnvelopeIcon";import wS from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as bS,useState as Ov}from"react";import Nv from"styled-components";import{Fragment as SS,jsx as ss,jsxs as Lv}from"react/jsx-runtime";var Dv=bS((e,t)=>{let[r,o]=Ov(""),[n,i]=Ov(!1),{authenticated:a,user:l}=z(),{initUpdateEmail:s}=M(),{navigate:c,setModalData:m,currentScreen:f}=P(),{enabled:u,token:C}=be(),g=As(r),y=n,b=n||!g,E=async T=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");i(!0);try{await s(l.email.address,r,T),c("AWAITING_PASSWORDLESS_CODE")}catch(A){m({errorModalData:{error:A,previousScreen:f||"LANDING"}})}i(!1)},k=()=>{u&&!C&&!a?(m({captchaModalData:{callback:T=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");return s(l.email.address,r,T)},userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN")):E(C)};return Lv(SS,{children:[ss(ES,{children:Lv(TS,{children:[ss(wS,{}),ss("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:T=>o(T.target.value),onKeyUp:T=>{T.key==="Enter"&&k()},value:r,autoComplete:"email"}),e.stacked?null:ss(yi,{isSubmitting:y,onClick:k,disabled:b,children:"Submit"})]})}),e.stacked?ss(B,{loadingText:null,loading:y,disabled:b,onClick:k,children:"Submit"}):null]})}),ES=Nv.div`
2836
+ `;import RS from"@heroicons/react/24/outline/EnvelopeIcon";import _S from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as PS,useState as Uv}from"react";import Bv from"styled-components";import{Fragment as kS,jsx as ls,jsxs as Fv}from"react/jsx-runtime";var Hv=PS((e,t)=>{let[r,o]=Uv(""),[n,i]=Uv(!1),{authenticated:a,user:l}=q(),{initUpdateEmail:s}=M(),{navigate:c,setModalData:m,currentScreen:f}=_(),{enabled:u,token:C}=be(),g=xs(r),y=n,b=n||!g,T=async S=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");i(!0);try{await s(l.email.address,r,S),c("AWAITING_PASSWORDLESS_CODE")}catch(x){m({errorModalData:{error:x,previousScreen:f||"LANDING"}})}i(!1)},k=()=>{u&&!C&&!a?(m({captchaModalData:{callback:S=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");return s(l.email.address,r,S)},userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN")):T(C)};return Fv(kS,{children:[ls(AS,{children:Fv(xS,{children:[ls(_S,{}),ls("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:S=>o(S.target.value),onKeyUp:S=>{S.key==="Enter"&&k()},value:r,autoComplete:"email"}),e.stacked?null:ls(vi,{isSubmitting:y,onClick:k,disabled:b,children:"Submit"})]})}),e.stacked?ls(B,{loadingText:null,loading:y,disabled:b,onClick:k,children:"Submit"}):null]})}),AS=Bv.div`
2837
2837
  width: 100%;
2838
- `,TS=Nv.label`
2838
+ `,xS=Bv.label`
2839
2839
  display: block;
2840
2840
  position: relative;
2841
2841
  width: 100%;
@@ -2893,7 +2893,7 @@ You will have to sign up with another method first to register a passkey for you
2893
2893
  && > input::placeholder {
2894
2894
  color: var(--privy-color-foreground-3);
2895
2895
  }
2896
- `;import{Fragment as PS,jsx as mn,jsxs as AS}from"react/jsx-runtime";var Uv=()=>AS(PS,{children:[mn(x,{},"header"),mn(ne,{}),mn(ge,{title:"Update your email",description:"Add the email address you'd like to use going forward. We'll send you a confirmation code",icon:mn(_S,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),mn(Pr,{children:mn(Dv,{stacked:!0})}),mn(ie,{}),mn($,{})]});import ru from"styled-components";import{jsx as Fv}from"react/jsx-runtime";var Bv=({style:e,...t})=>Fv("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"38px",width:"38px",...e},...t,children:Fv("path",{d:"M20 13.6V20M20 26.4H20.016M36 20C36 28.8365 28.8366 36 20 36C11.1635 36 4.00001 28.8365 4.00001 20C4.00001 11.1634 11.1635 3.99999 20 3.99999C28.8366 3.99999 36 11.1634 36 20Z",stroke:"currentColor",strokeWidth:"3.2",strokeLinecap:"round",strokeLinejoin:"round"})});import{Fragment as IS,jsx as Qn,jsxs as tu}from"react/jsx-runtime";var Hv=()=>{let{navigate:e}=P();return tu(IS,{children:[Qn(x,{}),tu(xS,{children:[Qn(kS,{children:Qn(Bv,{})}),tu(RS,{children:[Qn("h3",{children:"Unable to sign in"}),Qn("p",{children:"This application has reached its user limit and cannot sign in new users."})]}),Qn(B,{onClick:()=>{e("LANDING")},children:"Go back"})]}),Qn($,{})]})},xS=ru.div`
2896
+ `;import{Fragment as IS,jsx as hn,jsxs as MS}from"react/jsx-runtime";var Gv=()=>MS(IS,{children:[hn(A,{},"header"),hn(re,{}),hn(he,{title:"Update your email",description:"Add the email address you'd like to use going forward. We'll send you a confirmation code",icon:hn(RS,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),hn(Xt,{children:hn(Hv,{stacked:!0})}),hn(ie,{}),hn(z,{})]});import WS from"@heroicons/react/24/outline/PhoneIcon";import{Fragment as OS,jsx as yn,jsxs as LS}from"react/jsx-runtime";var Vv=()=>{let{currentScreen:e,data:t,navigate:r,setModalData:o}=_(),{user:n}=q(),{initUpdatePhone:i}=M();async function a({qualifiedPhoneNumber:l}){try{if(!n?.phone?.number)throw new Error("User is required to have an phone number to update it.");await i(n?.phone?.number,l),r("AWAITING_PASSWORDLESS_CODE")}catch(s){o({errorModalData:{error:s,previousScreen:t?.errorModalData?.previousScreen||e||"LINK_PHONE_SCREEN"}}),r("ERROR_SCREEN")}}return LS(OS,{children:[yn(A,{},"header"),yn(re,{}),yn(he,{title:"Update your phone number",description:"Add the phone number you'd like to use going forward. We'll send you a confirmation code",icon:yn(WS,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),yn(Xt,{children:yn(an,{stacked:!0,onSubmit:a,hideRecent:!0})}),yn(ie,{}),yn(z,{})]})};import nu from"styled-components";import{jsx as qv}from"react/jsx-runtime";var zv=({style:e,...t})=>qv("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"38px",width:"38px",...e},...t,children:qv("path",{d:"M20 13.6V20M20 26.4H20.016M36 20C36 28.8365 28.8366 36 20 36C11.1635 36 4.00001 28.8365 4.00001 20C4.00001 11.1634 11.1635 3.99999 20 3.99999C28.8366 3.99999 36 11.1634 36 20Z",stroke:"currentColor",strokeWidth:"3.2",strokeLinecap:"round",strokeLinejoin:"round"})});import{Fragment as FS,jsx as Xn,jsxs as ou}from"react/jsx-runtime";var $v=()=>{let{navigate:e}=_();return ou(FS,{children:[Xn(A,{}),ou(NS,{children:[Xn(DS,{children:Xn(zv,{})}),ou(US,{children:[Xn("h3",{children:"Unable to sign in"}),Xn("p",{children:"This application has reached its user limit and cannot sign in new users."})]}),Xn(B,{onClick:()=>{e("LANDING")},children:"Go back"})]}),Xn(z,{})]})},NS=nu.div`
2897
2897
  display: flex;
2898
2898
  flex-direction: column;
2899
2899
  align-items: center;
@@ -2902,7 +2902,7 @@ You will have to sign up with another method first to register a passkey for you
2902
2902
  width: 100%;
2903
2903
  padding-top: 8px;
2904
2904
  padding-bottom: 32px;
2905
- `,kS=ru.div`
2905
+ `,DS=nu.div`
2906
2906
  display: flex;
2907
2907
  align-items: center;
2908
2908
  justify-content: center;
@@ -2911,11 +2911,11 @@ You will have to sign up with another method first to register a passkey for you
2911
2911
  color: var(--privy-color-error);
2912
2912
  background-color: var(--privy-color-error-light);
2913
2913
  border-radius: 50%;
2914
- `,RS=ru.div`
2914
+ `,US=nu.div`
2915
2915
  display: flex;
2916
2916
  flex-direction: column;
2917
2917
  gap: 8px;
2918
- `;import WS,{createGlobalStyle as OS}from"styled-components";var MS=`
2918
+ `;import HS,{createGlobalStyle as GS}from"styled-components";var BS=`
2919
2919
  *,
2920
2920
  ::before,
2921
2921
  ::after {
@@ -3145,7 +3145,7 @@ You will have to sign up with another method first to register a passkey for you
3145
3145
  [hidden] {
3146
3146
  display: none;
3147
3147
  }
3148
- `,Gv=MS;var Vv=OS`
3148
+ `,Kv=BS;var jv=GS`
3149
3149
  :root {
3150
3150
  // Borders
3151
3151
  --privy-border-radius-sm: 6px;
@@ -3180,10 +3180,10 @@ You will have to sign up with another method first to register a passkey for you
3180
3180
  --privy-height-modal-full: 620px;
3181
3181
  --privy-height-modal-compact: 480px;
3182
3182
  };
3183
- `,ou=WS.div`
3183
+ `,iu=HS.div`
3184
3184
  // css normalize only the privy application to avoid conflicts
3185
3185
  // with consuming application
3186
- ${Gv}
3186
+ ${Kv}
3187
3187
 
3188
3188
  // Privy styles
3189
3189
  color: var(--privy-color-foreground-2);
@@ -3234,7 +3234,7 @@ You will have to sign up with another method first to register a passkey for you
3234
3234
  opacity: 1;
3235
3235
  }
3236
3236
  }
3237
- `;import{Dialog as qv,Transition as nu}from"@headlessui/react";import iu from"react";import ls from"styled-components";import{jsx as Ji,jsxs as FS}from"react/jsx-runtime";var zv=({children:e,open:t,onClick:r,...o})=>Ji(nu,{show:t,as:iu.Fragment,children:FS(qv,{onClose:r,...o,as:NS,children:[Ji(nu.Child,{as:iu.Fragment,enterFrom:"entering",leaveTo:"leaving",children:Ji(LS,{id:"privy-dialog-backdrop","aria-hidden":"true"})}),Ji(DS,{children:Ji(nu.Child,{as:iu.Fragment,enterFrom:"entering",leaveTo:"leaving",children:Ji(qv.Panel,{as:US,children:e})})})]})}),LS=ls.div`
3237
+ `;import{Dialog as Yv,Transition as au}from"@headlessui/react";import su from"react";import cs from"styled-components";import{jsx as Xi,jsxs as KS}from"react/jsx-runtime";var Zv=({children:e,open:t,onClick:r,...o})=>Xi(au,{show:t,as:su.Fragment,children:KS(Yv,{onClose:r,...o,as:qS,children:[Xi(au.Child,{as:su.Fragment,enterFrom:"entering",leaveTo:"leaving",children:Xi(VS,{id:"privy-dialog-backdrop","aria-hidden":"true"})}),Xi(zS,{children:Xi(au.Child,{as:su.Fragment,enterFrom:"entering",leaveTo:"leaving",children:Xi(Yv.Panel,{as:$S,children:e})})})]})}),VS=cs.div`
3238
3238
  position: fixed;
3239
3239
  inset: 0;
3240
3240
 
@@ -3247,10 +3247,10 @@ You will have to sign up with another method first to register a passkey for you
3247
3247
  backdrop-filter: unset;
3248
3248
  -webkit-backdrop-filter: unset;
3249
3249
  }
3250
- `,NS=ls.div`
3250
+ `,qS=cs.div`
3251
3251
  position: relative;
3252
3252
  z-index: 999999;
3253
- `,DS=ls.div`
3253
+ `,zS=cs.div`
3254
3254
  position: fixed;
3255
3255
  inset: 0;
3256
3256
  display: flex;
@@ -3258,7 +3258,7 @@ You will have to sign up with another method first to register a passkey for you
3258
3258
  justify-content: center;
3259
3259
  width: 100vw;
3260
3260
  min-height: 100vh;
3261
- `,US=ls.div`
3261
+ `,$S=cs.div`
3262
3262
  // reset some default dialog styles
3263
3263
  padding: 0;
3264
3264
  background: transparent;
@@ -3305,13 +3305,13 @@ You will have to sign up with another method first to register a passkey for you
3305
3305
  box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
3306
3306
  border-radius: var(--privy-border-radius-lg);
3307
3307
  }
3308
- `,$v=ls.div`
3308
+ `,Qv=cs.div`
3309
3309
  display: flex;
3310
3310
  flex-direction: column;
3311
3311
  align-items: center;
3312
3312
  justify-content: center;
3313
3313
  height: 100%;
3314
- `;import{Fragment as jv,jsx as at,jsxs as Yv}from"react/jsx-runtime";var VS={["LANDING"]:$1,["CONNECT_OR_CREATE"]:q1,["AWAITING_PASSWORDLESS_CODE"]:_h,["AWAITING_CONNECTION"]:ty,["AWAITING_CONNECT_ONLY_CONNECTION"]:ny,["AWAITING_FARCASTER_CONNECTION"]:dg,["AWAITING_FARCASTER_SIGNER"]:yg,["AWAITING_PASSKEY_SYSTEM_DIALOGUE"]:q2,["PHANTOM_INTERSTITIAL_SCREEN"]:j2,["LOGIN_FAILED_SCREEN"]:X1,["AWAITING_OAUTH_SCREEN"]:H2,["CROSS_APP_AUTH_SCREEN"]:ly,["ALLOWLIST_REJECTION_SCREEN"]:yh,["ACCOUNT_NOT_FOUND_SCREEN"]:lh,["USER_LIMIT_REACHED_SCREEN"]:Hv,["INSTALL_PHANTOM_SCREEN"]:b1,["LINK_EMAIL_SCREEN"]:K1,["LINK_PHONE_SCREEN"]:j1,["LINK_WALLET_SCREEN"]:Y1,["LINK_PASSKEY_SCREEN"]:Bg,["UPDATE_EMAIL_SCREEN"]:Uv,["CONNECT_ONLY_LANDING_SCREEN"]:Zh,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:Yh,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:Ty,["EMBEDDED_WALLET_CREATED_SCREEN"]:yy,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:fy,["EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN"]:Y2,["EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"]:av,["EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN"]:ov,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:wy,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:kv,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:Av,["FUNDING_METHOD_SELECTION_SCREEN"]:Zg,["MOONPAY_PROMPT_SCREEN"]:d1,["MOONPAY_STATUS_SCREEN"]:u1,["COINBASE_ONRAMP_STATUS_SCREEN"]:Mg,["FUNDING_TRANSFER_FROM_WALLET_SCREEN"]:h1,["FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN"]:Eg,["FUNDING_MANUAL_TRANSFER_SCREEN"]:e1,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:Yy,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:jy,["EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN"]:iv,["MFA_ENROLLMENT_FLOW_SCREEN"]:m2,["CAPTCHA_SCREEN"]:kh,["ERROR_SCREEN"]:Qy,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:y1,["AFFIRMATIVE_CONSENT_SCREEN"]:mh,["TELEGRAM_AUTH_SCREEN"]:Wv},qS=["LANDING","AWAITING_CONNECTION"],Qv=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:r,isModalOpen:o}=z(),{headless:n}=Ve(),{ready:i,currentScreen:a}=P(),{status:l,execute:s,reset:c,enabled:m}=be(),f=o&&a&&qS.includes(a)&&!n&&l==="ready";if(Kv(()=>{f&&s()},[f]),Kv(()=>{!o&&m&&c()},[o,m]),(!r||!i)&&a!=="AWAITING_OAUTH_SCREEN"&&a!=="CROSS_APP_AUTH_SCREEN"&&a!=="TELEGRAM_AUTH_SCREEN")return Yv(jv,{children:[at(x,{}),at(ne,{}),at($v,{children:at(nt,{})}),at(ie,{}),at(Z,{})]});if(!a&&e)return at(Kp,{open:e,onClose:t});if(!a)return null;let u=VS[a];return Yv(jv,{children:[at(Fr,{if:!!e,children:at(u,{})}),at(Fr,{if:!e,children:at(Kp,{open:e,onClose:t})})]})},zS=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let r=HS(null),o=Jf(r);return at(KS,{style:{height:o},id:"privy-modal-content",children:at("div",{ref:r,children:at(Qv,{isMfaVerifying:e,onMfaVerificationComplete:t})})})},$S=()=>{let{closePrivyModal:e}=M(),{onUserCloseViaDialogOrKeybindRef:t}=P();return{gracefulClosePrivyModal:BS(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},au=({open:e})=>{let{app:t}=P(),{gracefulClosePrivyModal:r}=$S(),[o,n]=GS(!1);Od({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let i=e||o;return t.render.standalone?at(ou,{children:at(Jv,{id:"privy-modal-content",children:at(Qv,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})})}):at(zv,{open:i,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>r(),children:at(ou,{children:at(zS,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})})})},Jv=Zv.div`
3314
+ `;import{Fragment as Xv,jsx as st,jsxs as eC}from"react/jsx-runtime";var QS={["LANDING"]:Z1,["CONNECT_OR_CREATE"]:j1,["AWAITING_PASSWORDLESS_CODE"]:kh,["AWAITING_CONNECTION"]:iy,["AWAITING_CONNECT_ONLY_CONNECTION"]:ly,["AWAITING_FARCASTER_CONNECTION"]:fg,["AWAITING_FARCASTER_SIGNER"]:wg,["AWAITING_PASSKEY_SYSTEM_DIALOGUE"]:j2,["PHANTOM_INTERSTITIAL_SCREEN"]:J2,["LOGIN_FAILED_SCREEN"]:o2,["AWAITING_OAUTH_SCREEN"]:z2,["CROSS_APP_AUTH_SCREEN"]:uy,["ALLOWLIST_REJECTION_SCREEN"]:wh,["ACCOUNT_NOT_FOUND_SCREEN"]:uh,["USER_LIMIT_REACHED_SCREEN"]:$v,["INSTALL_PHANTOM_SCREEN"]:_1,["LINK_EMAIL_SCREEN"]:Q1,["LINK_PHONE_SCREEN"]:J1,["LINK_WALLET_SCREEN"]:X1,["LINK_PASSKEY_SCREEN"]:qg,["UPDATE_EMAIL_SCREEN"]:Gv,["UPDATE_PHONE_SCREEN"]:Vv,["CONNECT_ONLY_LANDING_SCREEN"]:ey,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:Xh,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:Ay,["EMBEDDED_WALLET_CREATED_SCREEN"]:wy,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:vy,["EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN"]:X2,["EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"]:dv,["EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN"]:sv,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:Sy,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:Wv,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:Iv,["FUNDING_METHOD_SELECTION_SCREEN"]:e1,["MOONPAY_PROMPT_SCREEN"]:f1,["MOONPAY_STATUS_SCREEN"]:y1,["COINBASE_ONRAMP_STATUS_SCREEN"]:Ng,["FUNDING_TRANSFER_FROM_WALLET_SCREEN"]:C1,["FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN"]:Pg,["FUNDING_MANUAL_TRANSFER_SCREEN"]:n1,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:Xy,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:Jy,["EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN"]:cv,["MFA_ENROLLMENT_FLOW_SCREEN"]:g2,["CAPTCHA_SCREEN"]:Wh,["ERROR_SCREEN"]:tg,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:w1,["AFFIRMATIVE_CONSENT_SCREEN"]:gh,["TELEGRAM_AUTH_SCREEN"]:Dv},JS=["LANDING","AWAITING_CONNECTION"],rC=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:r,isModalOpen:o}=q(),{headless:n}=Ve(),{ready:i,currentScreen:a}=_(),{status:l,execute:s,reset:c,enabled:m}=be(),f=o&&a&&JS.includes(a)&&!n&&l==="ready";if(Jv(()=>{f&&s()},[f]),Jv(()=>{!o&&m&&c()},[o,m]),(!r||!i)&&a!=="AWAITING_OAUTH_SCREEN"&&a!=="CROSS_APP_AUTH_SCREEN"&&a!=="TELEGRAM_AUTH_SCREEN")return eC(Xv,{children:[st(A,{}),st(re,{}),st(Qv,{children:st(it,{})}),st(ie,{}),st(Z,{})]});if(!a&&e)return st(Yp,{open:e,onClose:t});if(!a)return null;let u=QS[a];return eC(Xv,{children:[st(Fr,{if:!!e,children:st(u,{})}),st(Fr,{if:!e,children:st(Yp,{open:e,onClose:t})})]})},XS=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let r=YS(null),o=rh(r);return st(t_,{style:{height:o},id:"privy-modal-content",children:st("div",{ref:r,children:st(rC,{isMfaVerifying:e,onMfaVerificationComplete:t})})})},e_=()=>{let{closePrivyModal:e}=M(),{onUserCloseViaDialogOrKeybindRef:t}=_();return{gracefulClosePrivyModal:jS(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},lu=({open:e})=>{let{app:t}=_(),{gracefulClosePrivyModal:r}=e_(),[o,n]=ZS(!1);Nd({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let i=e||o;return t.render.standalone?st(iu,{children:st(oC,{id:"privy-modal-content",children:st(rC,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})})}):st(Zv,{open:i,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>r(),children:st(iu,{children:st(XS,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})})})},oC=tC.div`
3315
3315
  display: flex;
3316
3316
  flex-direction: column;
3317
3317
  text-align: center;
@@ -3320,7 +3320,7 @@ You will have to sign up with another method first to register a passkey for you
3320
3320
  width: 100%;
3321
3321
  background: var(--privy-color-background);
3322
3322
  padding: 0 16px;
3323
- `,KS=Zv(Jv)`
3323
+ `,t_=tC(oC)`
3324
3324
  transition: height 150ms ease-out;
3325
3325
  overflow: hidden;
3326
3326
 
@@ -3334,4 +3334,4 @@ You will have to sign up with another method first to register a passkey for you
3334
3334
  box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
3335
3335
  border-radius: var(--privy-border-radius-lg);
3336
3336
  }
3337
- `;import{useRef as Xv,useEffect as jS}from"react";import{jsx as ZS}from"react/jsx-runtime";function YS({botUsername:e,scriptHost:t}){let r=document.createElement("script"),{origin:o}=new URL(t);return r.async=!0,r.src=`${o}/js/telegram-login.js`,r.setAttribute("data-telegram-login",e),r.setAttribute("data-request-access","write"),r.setAttribute("data-lang","en"),r}function eC(e){let t=Xv(null),r=Xv();return jS(()=>{r.current?.remove(),r.current=YS(e),t.current?.after(r.current)},[e]),ZS("div",{ref:t,hidden:!0})}import{useState as QS}from"react";import{useEffect as tC,useRef as rC}from"react";var td=class{constructor(){this.callbacks={}}enqueue(t,r){this.callbacks[t]=r}dequeue(t,r){let o=this.callbacks[r];if(!o)throw new Error(`cannot dequeue ${t} event: no event found for id ${r}`);switch(delete this.callbacks[r],t){case"privy:iframe:ready":return o;case"privy:wallet:create":return o;case"privy:wallet:import":return o;case"privy:wallet:connect":return o;case"privy:wallet:recover":return o;case"privy:wallet:rpc":return o;case"privy:wallet:set-recovery":return o;case"privy:mfa:verify":return o;case"privy:mfa:init-enrollment":return o;case"privy:mfa:submit-enrollment":return o;case"privy:mfa:unenroll":return o;case"privy:mfa:clear":return o;case"privy:farcaster:init-signer":return o;case"privy:farcaster:sign":return o;case"privy:solana-wallet:create":return o;case"privy:solana-wallet:connect":return o;case"privy:solana-wallet:recover":return o;case"privy:solana-wallet:rpc":return o;default:throw new Error(`invalid wallet event type ${t}`)}}};async function fn(e,t,r,o,n,i=!1){let a=i,l=async m=>{if(a&&t&&t.length>0){m===(i?0:1)?n("configureMfa","onMfaRequired",t):o.current?.reject(new We("missing_or_invalid_mfa","MFA verification failed, retry."));let f=await new Promise((u,C)=>{r.current={resolve:u,reject:C};let g=1e3*60*5;setTimeout(()=>{let y=new We("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(y),C(y)},g)});return await e(f)}return await e()},s=4,c=null;for(let m=0;m<s;m++)try{c=await l(m),o.current?.resolve(void 0);break}catch(f){if(f.type==="missing_or_invalid_mfa")a=!0;else throw o.current?.resolve(void 0),f}if(c===null){let m=new We("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(m),m}return c}import{jsx as o_}from"react/jsx-runtime";var JS=function(e){return()=>`id-${e++}`}(0);function XS(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function gt(e){return e.error!==void 0}var ut=new td,su=new Map,e_=(e,t)=>typeof t=="bigint"?t.toString():t,t_=(e,t)=>`${e}${JSON.stringify(t,e_)}`;function vt(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let i=t_(e,t);if(e==="privy:wallet:create"){let l=su.get(i);if(l)return l}let a=new Promise((l,s)=>{let c=JS();ut.enqueue(c,{resolve:l,reject:s}),n.postMessage({id:c,event:e,data:t},o)}).finally(()=>{su.delete(i)});return su.set(i,a),a}function r_(e){switch(e.event){case"privy:iframe:ready":let t=ut.dequeue(e.event,e.id);return gt(e)?t.reject(new We(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=ut.dequeue(e.event,e.id);return gt(e)?r.reject(new We(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:import":let o=ut.dequeue(e.event,e.id);return gt(e)?o.reject(new We(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:connect":let n=ut.dequeue(e.event,e.id);return gt(e)?n.reject(new We(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:recover":let i=ut.dequeue(e.event,e.id);return gt(e)?i.reject(new We(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:rpc":let a=ut.dequeue(e.event,e.id);return gt(e)?a.reject(new We(e.error.type,e.error.message)):a.resolve(e.data);case"privy:wallet:set-recovery":let l=ut.dequeue(e.event,e.id);return gt(e)?l.reject(new We(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:verify":let s=ut.dequeue(e.event,e.id);return gt(e)?s.reject(new We(e.error.type,e.error.message)):s.resolve(e.data);case"privy:mfa:init-enrollment":{let u=ut.dequeue(e.event,e.id);return gt(e)?u.reject(new We(e.error.type,e.error.message)):u.resolve(e.data)}case"privy:mfa:submit-enrollment":{let u=ut.dequeue(e.event,e.id);return gt(e)?u.reject(new We(e.error.type,e.error.message)):u.resolve(e.data)}case"privy:mfa:unenroll":{let u=ut.dequeue(e.event,e.id);return gt(e)?u.reject(new We(e.error.type,e.error.message)):u.resolve(e.data)}case"privy:mfa:clear":{let u=ut.dequeue(e.event,e.id);return gt(e)?u.reject(new We(e.error.type,e.error.message)):u.resolve(e.data)}case"privy:farcaster:init-signer":{let u=ut.dequeue(e.event,e.id);return gt(e)?u.reject(new We(e.error.type,e.error.message)):u.resolve(e.data)}case"privy:farcaster:sign":{let u=ut.dequeue(e.event,e.id);return gt(e)?u.reject(new We(e.error.type,e.error.message)):u.resolve(e.data)}case"privy:solana-wallet:create":let c=ut.dequeue(e.event,e.id);return gt(e)?c.reject(new We(e.error.type,e.error.message)):c.resolve(e.data);case"privy:solana-wallet:connect":let m=ut.dequeue(e.event,e.id);return gt(e)?m.reject(new We(e.error.type,e.error.message)):m.resolve(e.data);case"privy:solana-wallet:recover":let f=ut.dequeue(e.event,e.id);return gt(e)?f.reject(new We(e.error.type,e.error.message)):f.resolve(e.data);case"privy:solana-wallet:rpc":{let u=ut.dequeue(e.event,e.id);return gt(e)?u.reject(new We(e.error.type,e.error.message)):u.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function oC(e){let t=rC(null),r=rC(e.mfaMethods),o=hi(),[n,i]=QS(!1);return tC(()=>{r.current=e.mfaMethods},[e.mfaMethods]),tC(()=>{if(!n)return;let a=t.current;if(!a)return;function l(u){u&&u.origin===e.origin&&XS(u.data)&&r_(u.data)}let s={create(u){return vt("privy:wallet:create",u,a,e.origin)},import(u){return vt("privy:wallet:import",u,a,e.origin)},connect(u){return vt("privy:wallet:connect",u,a,e.origin)},recover(u){return fn(C=>vt("privy:wallet:recover",{...u,...C},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!u.recoveryMethod||u.recoveryMethod==="privy")},rpc(u){return fn(C=>vt("privy:wallet:rpc",{...u,...C},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},createSolana(u){return vt("privy:solana-wallet:create",u,a,e.origin)},connectSolana(u){return vt("privy:solana-wallet:connect",u,a,e.origin)},recoverSolana(u){return vt("privy:solana-wallet:recover",u,a,e.origin)},rpcSolana(u){return vt("privy:solana-wallet:rpc",u,a,e.origin)},setRecovery(u){return fn(C=>vt("privy:wallet:set-recovery",{...u,...C},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(u){return fn(C=>vt("privy:mfa:verify",{...u,...C},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(u){return fn(C=>vt("privy:mfa:init-enrollment",{...u,...C},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(u){return fn(C=>vt("privy:mfa:submit-enrollment",{...u,...C},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},unenrollMfa(u){return fn(C=>vt("privy:mfa:unenroll",{...u,...C},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},clearMfa(u){return vt("privy:mfa:clear",u,a,e.origin)},initFarcasterSigner(u){return vt("privy:farcaster:init-signer",u,a,e.origin)},signFarcasterMessage(u){return vt("privy:farcaster:sign",u,a,e.origin)}};window.addEventListener("message",l);let c=()=>e.onLoad(s),m=(...u)=>{console.warn("Privy iframe failed to load: ",...u),e.onLoadFailed()},f=new AbortController;return ra(()=>vt("privy:iframe:ready",{},a,e.origin),{abortSignal:f.signal}).then(c,m),()=>{window.removeEventListener("message",l),f.abort()}},[n]),o_("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>i(!0),src:xs(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId,client_id:e.appClientId})})}var rd=class{constructor(t,r){this.walletProxy=t,this.address=r}async handleSignMessage(t){if(!t.params||typeof t.params.message!="string")throw new Error("Message must be provided as a string for Solana signMessage RPC");return await iC({message:t.params.message})}async request(t){if(console.debug("EmbeddedSolanaProvider.request() called with args",t),!await we())throw new Error("User must be authenticated to use embedded Solana wallet");if(!await nC())throw new w("Unable to connect to Solana embedded wallet");switch(t.method){case"signMessage":return await this.handleSignMessage(t);default:throw new Error("Embedded Solana provider does not yet support this RPC method.")}}};async function aC({url:e,popup:t}){return t.location=e,new Promise((o,n)=>{let a=setTimeout(()=>{n(new w("Authorization request timed out after 2 minutes.")),l()},12e4);function l(){t?.close(),window.removeEventListener("message",m)}let s,c=setInterval(()=>{t?.closed&&!s&&(l(),clearInterval(c),clearTimeout(a),n(new w("User rejected request")))},300);function m(f){f.data&&(f.data.type==="PRIVY_OAUTH_RESPONSE"&&f.data.stateCode&&f.data.authorizationCode&&(clearTimeout(a),o(f.data),l()),f.data.type==="PRIVY_OAUTH_ERROR"&&(clearTimeout(a),n(new w(f.data.error)),l()),f.data.type==="PRIVY_OAUTH_USE_BROADCAST_CHANNEL"&&(s=new BroadcastChannel("popup-privy-oauth"),s.onmessage=m))}window.addEventListener("message",m)})}var n_="https://cdn.apple-cloudkit.com";async function lu({url:e,popup:t,provider:r}){return t.location=e,new Promise((n,i)=>{function a(){t?.close(),window.removeEventListener("message",l)}function l(s){s.data&&(s.data.type==="PRIVY_OAUTH_RESPONSE"&&s.data.stateCode&&s.data.authorizationCode&&(n(s.data),a()),s.origin===n_&&s.data.ckSession&&(n({type:"PRIVY_OAUTH_RESPONSE",ckWebAuthToken:s.data.ckSession}),a()),s.data.type==="PRIVY_OAUTH_ERROR"&&(i(s.data.error),a()))}window.addEventListener("message",l)})}var sC=e=>({id:e.id,raw_id:e.rawId,response:{client_data_json:e.response.clientDataJSON,authenticator_data:e.response.authenticatorData,signature:e.response.signature,user_handle:e.response.userHandle},authenticator_attachment:e.authenticatorAttachment,client_extension_results:{app_id:e.clientExtensionResults.appid,cred_props:e.clientExtensionResults.credProps,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret},type:e.type});import{jsx as wr,jsxs as lC}from"react/jsx-runtime";var wo;function p_(e){return typeof e=="string"&&e.length===25}function we(){if(!wo){let e=Q.get(yn);return Promise.resolve(e||null)}return wo.getAccessToken()}var cC,zm=(e,t,r)=>cC(e,t,r),dC,$m=(e,t)=>dC(e,t),pC,Km=(e,t)=>pC(e,t),uC,jm=()=>uC(),mC,nC=()=>mC(),fC,iC=({message:e})=>fC({message:e}),u_=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;Q.put(ia,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},m_=({config:e,...t})=>{if(!p_(t.appId))throw new w("Cannot initialize the Privy provider with an invalid Privy app ID");wo||(wo=new ya({appId:t.appId,appClientId:t.clientId,apiUrl:t.apiUrl}));let r=Object.assign({},e);return t.createPrivyWalletOnLogin!==void 0&&r.embeddedWallets?.createOnLogin===void 0&&(r.embeddedWallets||(r.embeddedWallets={}),r.embeddedWallets.createOnLogin=t.createPrivyWalletOnLogin?"users-without-wallets":"off"),t.createPrivyWalletOnLogin!==void 0&&e?.embeddedWallets?.createOnLogin&&console.warn("Both `createPrivyWalletOnLogin` and `config.embeddedWallets.createOnLogin` are set. `createPrivyWalletOnLogin` is deprecated and should be removed."),wr(Hf,{client:wo,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:wr(f_,{...t,client:wo})})},f_=e=>{let t=e.client,[r,o]=st(!1),[n,i]=st(!1),[a,l]=st(!1),[s,c]=st(null),[m,f]=st([]),[u,C]=st(null),g=Xi(m),[y,b]=st(!1),[E,k]=st(null),[T,A]=st(!1),[R,I]=st({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:S}),[D,H]=st({status:"initial"}),[K,j]=st(null),[O,U]=st(null),W=Ve(),Ce=nl(),[Ie,Y]=st(!0),[X,te]=st({}),[_e,Te]=st(null),[Ke,Ge]=st(null),[mt,Fe]=st(!1),[se,Ft]=st(!1),Wr=Xi(null),Zr=Xi(null),L=Xi(Xf),[rt,Or]=st(!1);t.onStoreToken=d=>{d&&F(L,"accessToken","onAccessTokenGranted",d)},t.onDeleteToken=()=>{c(null),l(!1),F(L,"accessToken","onAccessTokenRemoved")};let G=Xi(null),V=Xi(null),ae=d=>{k(d),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent({eventName:"modal_open",payload:{initialScreen:d}})},lt=d=>{W.embeddedWallets.createOnLogin!=="off"&&Y(!0),ae(d)};Yr(()=>{let d=_n(s);if(!d||!O)return;let p={address:d.address,connectedAt:Date.now(),walletClientType:"privy",connectorType:"embedded",meta:{name:"Privy Wallet",icon:Fo,id:"io.privy.solana.wallet"},getProvider:async()=>new rd(O,d.address)};C(p)},[O,s]),Yr(()=>{if(!s){t.connectors?.removeEmbeddedWalletConnector();return}let d=ye(s),p=Qs(s);if(d||t.connectors?.removeEmbeddedWalletConnector(),p||t.connectors?.removeImportedWalletConnector(),!t.connectors){console.debug("Failed to add embedded wallet connector: Client connectors not initialized");return}if(!O){console.debug("Failed to add embedded wallet connector: Wallet proxy not initialized");return}d&&t.connectors.addEmbeddedWalletConnector(O,d.address,W.defaultChain,e.appId),p&&t.connectors.addImportedWalletConnector(O,p.address,W.defaultChain,e.appId)},[O,s]),Yr(()=>{O&&Ke?.(O)},[O]),Yr(()=>{(async()=>{if(!W.customAuth?.enabled)return;Y(!0);let{getCustomAccessToken:p,isLoading:h}=W.customAuth;if(!(!n||h))try{let v=await p();if(!v&&a){await Jn.logout();return}if(!v||a)return;t.startAuthFlow(new ei(v));let{user:_,isNewUser:N}=await t.authenticate();if(!_){await Jn.logout();return}c(_||null),b(N||!1),l(!0),Ft(!0)}catch(v){console.warn(v),a&&await Jn.logout()}})()},[W.customAuth?.enabled,W.customAuth?.getCustomAccessToken,W.customAuth?.isLoading,n,a]),Yr(()=>{se&&O&&s&&qt(s,W.embeddedWallets.createOnLogin)&&(Ft(!1),pu(s,ri).catch(console.error))},[se&&O&&s]),Yr(()=>{async function d(){let p=ea(),h=cs();u_();let v=i_();t.initializeConnectorManager({walletConnectCloudProjectId:W.walletConnectCloudProjectId,rpcConfig:W.rpcConfig,chains:W.chains,defaultChain:W.defaultChain,store:v,walletList:W.appearance.walletList,shouldEnforceDefaultChainOnConnect:W.shouldEnforceDefaultChainOnConnect,externalWalletConfig:W.externalWallets,appName:W.name??"Privy"});let _;t.connectors?.on("connectorInitialized",()=>{_&&clearTimeout(_);let fe=t.connectors.walletConnectors.length,re=t.connectors.walletConnectors.reduce((Ze,Pe)=>Ze+(Pe.initialized?1:0),0);re===fe?Or(!0):_=setTimeout(()=>{console.debug({message:"Unable to initialize all expected connectors before timeout",initialized:re,expected:fe}),Or(!0)},1500)}),t.connectors?.initialize().then(()=>{bC()});let N=await t.getAuthenticatedUser(),q=!!N;if(W.customAuth?.enabled||(l(!!N),N&&F(L,"login","onComplete",N,!1,!0,null,null),c(N)),p){V.current=q?"link":"login";return}if(h&&!q){V.current="login",lt("TELEGRAM_AUTH_SCREEN");return}oe.setReadyToTrue(!!N)}!n&&Ce&&d()},[t,_e,n,Ce]),Yr(()=>{if(!n)return;if(!s){Fe(!0);return}if(!!!s.linkedAccounts.find(h=>h.type==="wallet"&&h.walletClientType==="privy")){Fe(!0);return}let p=!!m.find(h=>h.walletClientType==="privy");Fe(p)},[n,s,m]);let ea=()=>{let d=da();if(d.inProgress&&d.popupFlow){if(window.opener.location.origin!==window.location.origin){window.opener.postMessage({type:"PRIVY_OAUTH_ERROR",error:"Origins between parent and child windows do not match."});return}if(d.authorizationCode==="error"){window.opener.postMessage({type:"PRIVY_OAUTH_ERROR",error:"Something went wrong. Try again."});return}window.opener.postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:d.stateCode,authorizationCode:d.authorizationCode});return}let p="privy:";function h(v){return v.startsWith(p)}return d.inProgress&&h(d.provider)&&!d.popupFlow&&(new BroadcastChannel("popup-privy-oauth").postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:d.stateCode,authorizationCode:d.authorizationCode}),window.close()),!d.inProgress||d.headless?!1:(t.startAuthFlow(new Jr(d)),lt("AWAITING_OAUTH_SCREEN"),!0)},cs=()=>{let d=Gm();if(!d||!W.loginMethods.telegram||!W.loginConfig.telegramAuthConfiguration?.seamlessAuthEnabled)return;let p=new ii;return t.startAuthFlow(p),d.flowType==="login-url"&&(p.meta.telegramWebAppData=void 0,p.meta.telegramAuthResult={id:d.id,first_name:d.first_name,last_name:d.last_name,auth_date:d.auth_date,username:d.username,photo_url:d.photo_url,hash:d.hash}),d.flowType==="web-app"&&(p.meta.telegramAuthResult=void 0,p.meta.telegramWebAppData={query_id:d.query_id,user:d.user,auth_date:d.auth_date,hash:d.hash}),!0},wC=async(d,p,h,v)=>{let _=await t.connectors?.createWalletConnector(d,p)||null;od(_,p,h,v)};async function od(d,p,h,v){if(d)I({status:"disconnected",connectedWallet:null,connectError:null,connector:d,connectRetry:S});else return I({status:"disconnected",connectedWallet:null,connectError:new ce("Unable to connect to wallet."),connector:null,connectRetry:S}),v?.(null,h);d instanceof Dr&&p&&await d.resetConnection(p),I({connector:d,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>od(d,p,h,v)});try{let _=await d.connect({showPrompt:!0});if(W.shouldEnforceDefaultChainOnConnect&&!W.chains.find(N=>N.id===Number(_?.chainId.replace("eip155:","")))&&!(_?.connectorType==="wallet_connect_v2"&&_?.walletClientType==="metamask")){I(N=>({...N,connector:d,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:S}));try{await _?.switchChain(W.defaultChain.id),_&&(_.chainId=ti(hn(W.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${W.defaultChain.id}`)}}return I(N=>({...N,status:"connected",connectedWallet:_,connectError:null,connectRetry:S})),_&&F(L,"connectWallet","onSuccess",_),v?.(_,h)}catch(_){return _ instanceof et?(console.warn(_.cause?_.cause:_.message),F(L,"connectWallet","onError",_.privyErrorCode||"generic_connect_wallet_error")):(console.warn(_),F(L,"connectWallet","onError","unknown_connect_wallet_error")),I(N=>({...N,status:"disconnected",connectedWallet:null,connectError:_})),v?.(null,h)}}let ds=async(d,p)=>{if(d===null)return;let h=new To(d,t,p);t.startAuthFlow(h)},bC=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_connector"),h=d.get("privy_wallet_client");if(!p||!h)return;if(h==="phantom"&&!No()&&lt("LOGIN_FAILED_SCREEN"),!t.connectors)throw new w("Connector not initialized");ae("AWAITING_CONNECTION");let v=new URL(window.location.href);v.searchParams.delete("privy_connector"),v.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",v),wC(p,h,void 0,ds)};Yr(()=>{n&&a&&s===null&&t.getAuthenticatedUser().then(c)},[n,a,s,t]);let ct=d=>{if(!a)throw F(L,"linkAccount","onError","must_be_authenticated",{linkMethod:d}),new w("User must be authenticated before linking an account.")},du=()=>{ct("siwe"),G.current="siwe",V.current="link",ae("LINK_WALLET_SCREEN")},EC=d=>{if(!a||!s)return!1;if(d.walletClientType==="privy")return!0;for(let p of s.linkedAccounts)if(p.type==="wallet"&&p.address===d.address&&p.walletClientType!=="privy")return!0;return!1},TC=async d=>{if(!t.connectors)throw new w("Connector not initialized");let p=t.connectors.findWalletConnector(d.connectorType,d.walletClientType)||null;if(I(h=>({...h,connector:p,status:"connected",connectedWallet:d,connectError:null,connectRetry:S})),W.captchaEnabled&&!a){let h={callback:v=>ds(d,v),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};te({captchaModalData:h}),lt("CAPTCHA_SCREEN")}else await ds(d),lt("AWAITING_CONNECTION")},SC=async(d,p)=>{let{signedUrl:h,externalTransactionId:v}=await l1(t,d,p??{},W.appearance.palette,W.fundingMethodConfig?.moonpay.useSandbox??!1);return{signedUrl:h,externalTransactionId:v}},ps=()=>{f(d=>{let p=t.connectors?.wallets.map(h=>({...h,linked:EC(h),loginOrLink:async()=>{if(!await h.isConnected())throw new w("Wallet is not connected");if(h.connectorType==="embedded"&&h.walletClientType==="privy")throw new w("Cannot link or login with embedded wallet");TC(h)},fund:async v=>{await oe.fundWallet(h.address,v)},unlink:async()=>{if(!a)throw new w("User is not authenticated.");if(h.connectorType==="embedded"&&h.walletClientType==="privy")throw new w("Cannot unlink an embedded wallet");let v=await t.unlinkWallet(h.address);c(v)}}))||[];return Js(d,p)?d:p})};Yr(()=>{ps()},[s?.linkedAccounts,a,n]),Yr(()=>{if(n){if(!t.connectors)throw new w("Connector not initialized");ps(),t.connectors.on("walletsUpdated",ps)}},[n]);let _C=d=>{if(d&&"suggestedAddress"in d&&d.suggestedAddress){let p=Oo(d.suggestedAddress);j(p)}ae(a?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};Yr(()=>{if(!m[0])return;let d=m[0],p=g.current.find(v=>v.address===d.address),h;if(d.walletClientType==="privy"?h=s?.linkedAccounts.find(v=>v.type==="wallet"&&v.address===d.address&&v.walletClientType==="privy"):h=s?.linkedAccounts.find(v=>v.type==="wallet"&&v.address===d.address&&v.walletClientType!=="privy"),!p&&h){let v=Object.assign({},s);v.wallet=h&&{address:h.address,chainType:h.chainType,chainId:h.chainId,walletClient:h.walletClient,walletClientType:h.walletClientType,connectorType:h.connectorType,imported:h.imported},c(v)}g.current=m},[m]);let pu=async(d,p)=>{if(ye(d))throw F(L,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[v,_]=await Promise.all([oe.initializeWalletProxy(p),we()]);if(!v&&W.customAuth?.enabled)throw F(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!v||!_||W.embeddedWallets?.requireUserOwnedRecoveryOnCreate)return new Promise((N,q)=>{Y(!0),te({createWallet:{onSuccess:re=>{F(L,"createWallet","onSuccess",re),N(re)},onFailure:re=>{F(L,"createWallet","onError","unknown_embedded_wallet_error"),q(re)},callAuthOnSuccessOnClose:!1}}),ae("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await v.create({accessToken:_});let N=await oe.refreshUser(),q=ye(N);if(!q)throw F(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return F(L,"createWallet","onSuccess",q),q}},PC=d=>{if(!W.chains.map(p=>p.id).includes(d))throw new ce(`Chain ID ${d} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},uu=(d,p,h)=>new Promise(async(v,_)=>{let{requesterAppId:N}=p||{};if(!a||!s){F(L,"sendTransaction","onError","must_be_authenticated"),_(new Error("User must be authenticated before signing with a Privy wallet"));return}let q=d.from,fe=q?s?.linkedAccounts.find(Qe=>Qe.type==="wallet"&&Qe.walletClientType==="privy"&&Oo(Qe.address)===Oo(q)):ye(s);if(!fe){F(L,"sendTransaction","onError","embedded_wallet_not_found"),_(new Error("Must have a Privy wallet before signing"));return}Y(!0);let re=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,Ze=d.chainId?Number(d.chainId):re.chainId;PC(Ze);let Pe=Object.assign({},d,{chainId:Ze}),Ht=async()=>{let Qe=await we();if(!Qe||!O){F(L,"sendTransaction","onError","embedded_wallet_not_found"),_(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await oe.recoverEmbeddedEthereumWallet()){F(L,"sendTransaction","onError","unknown_connect_wallet_error"),_(new Error("Unable to connect to wallet"));return}let Xn=Gt(Pe.chainId,W.chains,W.rpcConfig,{appId:e.appId}),Qr=await d_(fe.address,Pe,Xn);if(W.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:kC}=await c_(Qr,Xn),{hasSufficientFunds:RC}=await Fi(fe.address,Qr,kC,Xn);if(!RC)throw new Ct(new Tr("Wallet has insufficient funds for this transaction.",l_.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let gu=await Zl(Qe,fe.address,O,Qr,Xn,N);F(L,"sendTransaction","onSuccess",gu),v(gu)}catch(ms){F(L,"sendTransaction","onError","transaction_failure"),_(ms)}};if(W.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),Ht();else{let Qe={transactionRequest:Pe,onSuccess:Qr=>{F(L,"sendTransaction","onSuccess",Qr),v(Qr)},onFailure:Qr=>{F(L,"sendTransaction","onError","transaction_failure"),_(Qr)},uiOptions:p||{},fundWalletConfig:h,requesterAppId:N},ms={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:Qr=>{F(L,"sendTransaction","onError","unknown_connect_wallet_error"),_(Qr)}},Xn=hu({address:fe.address,fundWalletConfig:h,chainIdOverride:Pe.chainId,comingFromSendTransactionScreen:!0});te({connectWallet:ms,sendTransaction:Qe,funding:Xn}),ae("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function mu(){return new Promise(async(d,p)=>{let h=await we();if(!h||!O)throw new Error("Must have valid access token to enroll in MFA");try{await O.verifyMfa({accessToken:h}),d()}catch(v){p(v)}})}let fu=d=>d?.linkedAccounts.filter(p=>p.latestVerifiedAt!==null&&!(p.type==="wallet"&&p.walletClientType==="privy")).sort((p,h)=>h.latestVerifiedAt.getTime()-p.latestVerifiedAt.getTime())[0],Bt=d=>{let p=s?.linkedAccounts.filter(_=>_.type===d).length??0,{displayName:h,loginMethod:v}=on(d);if(d==="passkey"&&p>=5||d!=="passkey"&&p>=1)throw F(L,"linkAccount","onError","cannot_link_more_of_type",{linkMethod:v}),new w(`User already has an account of type ${h} linked.`)},AC=()=>{if(!W.loginConfig.telegramAuthConfiguration?.linkEnabled)throw F(L,"linkAccount","onError","cannot_link_more_of_type",{linkMethod:"telegram"}),new w("User can't link an account because Telegram linking is disabled.")},hu=({address:d,fundWalletConfig:p,methodScreen:h,chainIdOverride:v=null,comingFromSendTransactionScreen:_=!1})=>{if(!W.fundingConfig||W.fundingConfig.methods.length===0)return;let N=uc(p)&&p.amount?p.amount:W.fundingConfig.defaultRecommendedAmount,q=uc(p)&&p.chain?p.chain.id:Bi(W.fundingConfig.defaultRecommendedCurrency.chain),fe=uc(p)&&p.chain?p.chain:W.chains.find(re=>re.id===q);if(v&&W.chains.find(re=>re.id===v)&&(fe=W.chains.find(re=>re.id===v)),!fe)throw new w("Funding chain is not in PrivyProvider chains list");return{address:d,amount:N,chain:fe,methodScreen:h,comingFromSendTransactionScreen:_,...s1(p)?{moonpayConfigOverride:p.config}:{}}};async function yu({legacySetWalletPasswordFlow:d=!1}){k(null);let p=d?"setWalletPassword":"setWalletRecovery";if(!a||!s)throw F(L,p,"onError","must_be_authenticated"),new Error("User must be authenticated before adding recovery method to Privy wallet");let h=ye(s);if(!h||!O)throw F(L,p,"onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a recovery method");if(_n(s))throw new Error("Cannot set user-controlled recovery for user with Solana.");try{await mu()}catch(_){throw F(L,p,"onError","missing_or_invalid_mfa"),_}return new Promise((_,N)=>{Y(!0);let q={onSuccess:Pe=>{F(L,p,"onSuccess","user-passcode",Pe),_(Pe)},onFailure:Pe=>{F(L,p,"onError","user_exited_set_password_flow"),N(Pe)},callAuthOnSuccessOnClose:!1},fe=h.recoveryMethod==="user-passcode",Ze={onCompleteNavigateTo:Ol({walletAction:"update",availableRecoveryMethods:W.embeddedWallets.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:d,isResettingPassword:fe}),shouldForceMFA:!1,onFailure:Pe=>{F(L,p,"onError","unknown_connect_wallet_error"),N(Pe)}};te({setWalletPassword:q,createWallet:q,connectWallet:Ze,recoverySelection:{isInAccountCreateFlow:!1,isResettingPassword:fe}}),ae("EMBEDDED_WALLET_CONNECTING_SCREEN")})}async function us({appId:d}){ct(`privy:${d}`),G.current=`privy:${d}`,V.current="link";let p=window.open(void 0,void 0,Na({w:440,h:680}));return t.createAnalyticsEvent({eventName:"cross_app_auth_started",payload:{appId:d}}),new Promise(async(h,v)=>{let{name:_,logoUrl:N}=await ec({api:t.api,providerAppId:d,requesterAppId:W.id});te({crossAppAuth:{appId:d,name:_,logoUrl:N,popup:p,onSuccess:h,onError:v}}),lt("CROSS_APP_AUTH_SCREEN")})}let Jn={ready:n,authenticated:a,user:s,walletConnectors:t.connectors||null,connectWallet:_C,importWallet:async({privateKey:d})=>{ct("siwe");let[p,h]=await Promise.all([oe.initializeWalletProxy(15e3),we()]);if(p&&h){await p.import({privateKey:d,accessToken:h});let v=await oe.refreshUser(),_=Qs(v);if(!_)throw F(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to import wallet");return F(L,"createWallet","onSuccess",_),_}else throw new w("User is not authenticated")},linkWallet:du,linkCrossAppAccount:us,linkEmail:()=>{ct("email"),Bt("email"),G.current="email",V.current="link",ae("LINK_EMAIL_SCREEN")},linkPhone:()=>{ct("sms"),Bt("phone"),G.current="sms",V.current="link",ae("LINK_PHONE_SCREEN")},linkGoogle:async()=>{ct("google"),Bt("google_oauth"),V.current="link",await oe.initLoginWithOAuth("google")},linkTwitter:async()=>{ct("twitter"),Bt("twitter_oauth"),V.current="link",await oe.initLoginWithOAuth("twitter")},linkDiscord:async()=>{ct("discord"),Bt("discord_oauth"),V.current="link",await oe.initLoginWithOAuth("discord")},linkGithub:async()=>{ct("github"),Bt("github_oauth"),V.current="link",await oe.initLoginWithOAuth("github")},linkSpotify:async()=>{ct("spotify"),Bt("spotify_oauth"),V.current="link",await oe.initLoginWithOAuth("spotify")},linkInstagram:async()=>{ct("instagram"),Bt("instagram_oauth"),V.current="link",await oe.initLoginWithOAuth("instagram")},linkTiktok:async()=>{ct("tiktok"),Bt("tiktok_oauth"),V.current="link",await oe.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{ct("linkedin"),Bt("linkedin_oauth"),V.current="link",await oe.initLoginWithOAuth("linkedin")},linkApple:async()=>{ct("apple"),Bt("apple_oauth"),V.current="link",await oe.initLoginWithOAuth("apple")},linkPasskey:async()=>{ct("passkey"),Bt("passkey"),await oe.initLinkWithPasskey(),ae("LINK_PASSKEY_SCREEN")},linkTelegram:async()=>{ct("telegram"),Bt("telegram"),AC(),V.current="link",G.current="telegram",await oe.initLoginWithTelegram(),ae("TELEGRAM_AUTH_SCREEN")},linkFarcaster:async()=>{ct("farcaster"),Bt("farcaster"),await oe.initLoginWithFarcaster(),V.current="link",G.current="farcaster",ae("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(ct("email"),!s?.email)throw new w("User does not have an email linked to their account.");V.current="link",G.current="email",ae("UPDATE_EMAIL_SCREEN")},login:async d=>{d&&"target"in d&&d&&(d=void 0);let p="Attempted to log in, but user is already logged in. Use a `link` helper instead.";if(!n){let h=await new Promise(v=>{Te(_=>v.bind(_))});if(Te(null),h){console.warn(p);return}}if(a){console.warn(p);return}V.current="login",te({login:d}),lt("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(d=>{Te(()=>d)}),Te(null)),a){console.warn("User must be unauthenticated to `connectOrCreateWallet`");return}if(m[0]){console.warn("User must have no connected wallets to `connectOrCreateWallet`");return}lt("CONNECT_OR_CREATE")},logout:async()=>{if(s&&t.clearProviderAcccessTokens(s),k(null),await t.logout(),s&&O)try{await O.clearMfa({userId:s.id})}catch{}c(null),l(!1),F(L,"logout","onSuccess"),V.current=null,G.current=null,o(!1),Q.del(aa)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new je;let d=m.find(h=>s.wallet&&h.address===s.wallet.address),p=t.connectors?.walletConnectors.find(h=>h.wallets.find(v=>v.address===d?.address));return!d||!p?new je:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new cu(new Xr(new je));let d=m.find(h=>s.wallet&&h.address===s.wallet.address),p=t.connectors?.walletConnectors.find(h=>h.wallets.find(v=>v.address===d?.address));return!d||!p?new cu(new Xr(new je)):new cu(new Xr(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new Uo(new je);let d=m.find(h=>s.wallet&&h.address===s.wallet.address),p=t.connectors?.walletConnectors.find(h=>h.wallets.find(v=>v.address===d?.address));return!d||!p?new Uo(new je):new Uo(p.proxyProvider)},unlinkWallet:async d=>{let p=await t.unlinkWallet(d);return c(p),p},unlinkEmail:async d=>{let p=await t.unlinkEmail(d);return c(p),p},unlinkPhone:async d=>{let p=await t.unlinkPhone(d);return c(p),p},unlinkGoogle:async d=>{let p=await t.unlinkOAuth("google",d);return c(p),p},unlinkTwitter:async d=>{let p=await t.unlinkOAuth("twitter",d);return c(p),p},unlinkDiscord:async d=>{let p=await t.unlinkOAuth("discord",d);return c(p),p},unlinkGithub:async d=>{let p=await t.unlinkOAuth("github",d);return c(p),p},unlinkSpotify:async d=>{let p=await t.unlinkOAuth("spotify",d);return c(p),p},unlinkInstagram:async d=>{let p=await t.unlinkOAuth("instagram",d);return c(p),p},unlinkTiktok:async d=>{let p=await t.unlinkOAuth("tiktok",d);return c(p),p},unlinkLinkedIn:async d=>{let p=await t.unlinkOAuth("linkedin",d);return c(p),p},unlinkApple:async d=>{let p=await t.unlinkOAuth("apple",d);return c(p),p},unlinkFarcaster:async d=>{let p=await t.unlinkFarcaster(d);return c(p),p},unlinkTelegram:async d=>{let p=await t.unlinkTelegram(d);return c(p),p},unlinkPasskey:async d=>{let p=await t.unlinkPasskey(d);return c(p),p},unlinkCrossAppAccount:async({subject:d})=>{let p=s?.linkedAccounts.find(v=>v.type==="cross_app"&&v.subject===d)?.providerApp;if(!p)throw new w("Invalid subject");t.storeProviderAccessToken(p.id,null);let h=await t.unlinkOAuth(`privy:${p.id}`,d);return c(h),h},setActiveWallet:async d=>{let p=m.find(v=>Oo(v.address)===Oo(d)),h=s?.linkedAccounts.find(v=>v.type==="wallet"&&Oo(v.address)===Oo(d));if(!p||!await p.isConnected())j(d),du();else if(!p.linked)p.loginOrLink();else{let v=Object.assign({},s);v.wallet=h&&{address:h.address,chainType:h.chainType,chainId:h.chainId,walletClient:h.walletClient,walletClientType:h.walletClientType,connectorType:h.connectorType,imported:h.imported},c(v)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!a||!s)throw F(L,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return pu(s,15e3)},setWalletRecovery:async()=>yu({legacySetWalletPasswordFlow:!1}),setWalletPassword:async()=>yu({legacySetWalletPasswordFlow:!0}),signMessage:(d,p,h)=>new Promise(async(v,_)=>{let{requesterAppId:N}=p||{};if(!a||!s){F(L,"signMessage","onError","must_be_authenticated"),_(new Error("User must be authenticated before signing with a Privy wallet"));return}let q=h?s?.linkedAccounts.find(re=>re.type==="wallet"&&re.walletClientType==="privy"&&Oo(re.address)===Oo(h)):ye(s);if(!q){F(L,"signMessage","onError","embedded_wallet_not_found"),_(new Error("Must have a Privy wallet before signing"));return}if(typeof d!="string"||d.length<1){F(L,"signMessage","onError","invalid_message"),_(new Error("Message must be a non-empty string"));return}Y(!0);let fe=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let re=await we();if(!O||!re)throw new Error("Unable to connect to wallet");if(!await oe.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_started",payload:{walletAddress:q.address,requesterAppId:N}});let{response:Pe}=await O.rpc({accessToken:re,address:q.address,requesterAppId:N,request:{method:"personal_sign",params:[d,q.address]}}),Ht=Pe.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_completed",payload:{walletAddress:q.address,requesterAppId:N}}),Ht};if(W.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let re=await fe();F(L,"signMessage","onSuccess",re),v(re)}catch(re){F(L,"signMessage","onError","unable_to_sign"),_(re??new Ct("Unable to sign message"))}}else{let Pe={method:"personal_sign",data:d,confirmAndSign:fe,onSuccess:Qe=>{F(L,"signMessage","onSuccess",Qe),v(Qe)},onFailure:Qe=>{F(L,"signMessage","onError","unable_to_sign"),_(Qe)},uiOptions:p||{}},Ht={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Qe=>{F(L,"signMessage","onError","unknown_connect_wallet_error"),_(Qe)},address:q.address};te({signMessage:Pe,connectWallet:Ht}),ae("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(d,p)=>new Promise(async(h,v)=>{let{requesterAppId:_}=p||{};if(!a||!s){F(L,"signTypedData","onError","must_be_authenticated"),v(new Error("User must be authenticated before signing with a Privy wallet"));return}let N=ye(s);if(!N){F(L,"signTypedData","onError","embedded_wallet_not_found"),v(new Error("Must have a Privy wallet before signing"));return}Y(!0);let q=oa(d),fe=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let re=await we();if(!O||!re)throw new Error("Unable to connect to wallet");if(!await oe.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_started",payload:{walletAddress:N.address,requesterAppId:_}});let{response:Pe}=await O.rpc({accessToken:re,address:N.address,requesterAppId:_,request:{method:"eth_signTypedData_v4",params:[N.address,q]}}),Ht=Pe.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_completed",payload:{walletAddress:N.address,requesterAppId:_}}),Ht};if(W.embeddedWallets.noPromptOnSignature||(W.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let re=await fe();F(L,"signTypedData","onSuccess",re),h(re)}catch(re){F(L,"signTypedData","onError","unable_to_sign"),v(re??new Ct("Unable to sign message"))}}else{let Pe={method:"eth_signTypedData_v4",data:q,confirmAndSign:fe,onSuccess:Qe=>{F(L,"signTypedData","onSuccess",Qe),h(Qe)},onFailure:Qe=>{F(L,"signTypedData","onError","unable_to_sign"),v(Qe)},uiOptions:p||{}},Ht={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Qe=>{F(L,"signMessage","onError","unknown_connect_wallet_error"),v(Qe)}};te({signMessage:Pe,connectWallet:Ht}),ae("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(d,p,h)=>{let _=await(await uu(d,p,h)).wait();return Ql(_)},exportWallet:()=>new Promise(async(d,p)=>{if(!a||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}if(!ye(s)){p(new Error("Must have a Privy wallet before exporting"));return}Y(!0);let v={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p,shouldForceMFA:!0};if(te(X),!await we()||!O){p(new Error("Must have valid access token to enroll in MFA"));return}if(!O){p(new Error("Must have a Privy wallet before exporting"));return}let N={appId:e.appId,appClientId:e.clientId,origin:t.apiUrl,onSuccess:d,onFailure:p};te({keyExport:N,connectWallet:v}),ae("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:mu,async init(d){switch(d){case"sms":await t.initMfaSmsVerification();return;case"passkey":return await t.initMfaPasskeyVerification();case"totp":return;default:throw new Error(`Unsupported MFA method: ${d}`)}},async submit(d,p){switch(d){case"totp":case"sms":if(typeof p!="string")throw new w("Invalid MFA code");Wr.current?.resolve({mfaMethod:d,mfaCode:p,relyingParty:window.origin}),await new Promise((N,q)=>{Zr.current={resolve:N,reject:q}});break;case"passkey":if(typeof p=="string")throw new w("Invalid authenticator response");let v=await(await import("@simplewebauthn/browser")).startAuthentication(p),_=sC(v);Wr.current?.resolve({mfaMethod:d,mfaCode:_,relyingParty:window.origin}),await new Promise((N,q)=>{Zr.current={resolve:N,reject:q}});break;default:throw Wr.current?.reject(new w("Unsupported MFA method")),new w(`Unsupported MFA method: ${d}`)}},cancel(){Wr.current?.reject(new w("MFA canceled"))},async initEnrollmentWithSms(d){let p=await we();if(!p||!O)throw new Error("Must have valid access token to enroll in MFA");await O.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber})},enrollInMfa(d){return new Promise((p,h)=>{if(!d){oe.closePrivyModal(),p();return}W.mfa.noPromptOnMfaRequired&&console.warn("[Privy Warning] Triggering the 'showMfaEnrollmentModal' function when 'noPromptOnMfaRequired' is set to true is unexpected. If this is intentional, ensure that you are building custom UIs for MFA verification."),te({mfaEnrollmentFlow:{mfaMethods:W.mfa.methods,onSuccess:p,onFailure:h}}),ae("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let d=await we();if(!d||!O)throw new Error("Must have valid access token to enroll in MFA");let p=await O.initEnrollMfa({method:"totp",accessToken:d});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(d){let p=await we();if(!p||!O)throw new Error("Must have valid access token to enroll in MFA");await O.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber,code:d.mfaCode});let h=await t.getAuthenticatedUser();c(h)},async submitEnrollmentWithTotp(d){let p=await we();if(!p||!O)throw new Error("Must have valid access token to enroll in MFA");await O.submitEnrollMfa({method:"totp",accessToken:p,code:d.mfaCode});let h=await t.getAuthenticatedUser();c(h)},async initEnrollmentWithPasskey(){},async submitEnrollmentWithPasskey({credentialIds:d}){let p=await we();if(!p||!O)throw new Error("Must have valid access token to enroll in MFA");await O.submitEnrollMfa({method:"passkey",accessToken:p,credentialIds:d});let h=await t.getAuthenticatedUser();c(h)},async unenroll(d){let p=await we();if(!p||!O)throw new Error("Must have valid access token to remove MFA");d==="passkey"?await O.submitEnrollMfa({method:"passkey",accessToken:p,credentialIds:[]}):await O.unenrollMfa({method:d,accessToken:p});let h=await t.getAuthenticatedUser();c(h)},requestFarcasterSignerFromWarpcast:async()=>{let d=await we(),p=s?.linkedAccounts.find(_=>_.type==="wallet"&&_.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!O||!p)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await oe.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");let v=await O.initFarcasterSigner({address:p.address,hdWalletIndex:null,accessToken:d,mfaCode:null,mfaMethod:null,relyingParty:window.origin});if(v.status==="approved"){let _=await t.getAuthenticatedUser();c(_||s||null)}te({farcasterSigner:v}),ae("AWAITING_FARCASTER_SIGNER")},getFarcasterSignerPublicKey:async()=>{let d=await we(),p=s?.linkedAccounts.find(_=>_.type==="wallet"&&_.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!O||!p)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await oe.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");if(!s.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster signer public key to sign");return(_=>Uint8Array.from(_.match(/.{1,2}/g).map(N=>parseInt(N,16))))(s.farcaster.signerPublicKey.slice(2))},signFarcasterMessage:async d=>{let p=await we(),h=s?.linkedAccounts.find(q=>q.type==="wallet"&&q.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!O||!h)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await oe.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");if(!s.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster signer public key to sign");let _=await import("@simplewebauthn/browser"),N=await O.signFarcasterMessage({address:h.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{hash:_.bufferToBase64URLString(d)},fid:BigInt(s.farcaster.fid),relyingParty:window.origin});return new Uint8Array(_.base64URLStringToBuffer(N.signature))},isHeadlessOAuthLoading:T,loginWithCode(d){return oe.loginWithCode(d)},initLoginWithEmail(d){return oe.initLoginWithEmail(d)},initLoginWithSms(d){return oe.initLoginWithSms(d)},otpState:D,fundWallet(d,p){return oe.fundWallet(d,p)},initLoginWithHeadlessOAuth(d,p){return oe.initLoginWithHeadlessOAuth(d,p)},loginWithHeadlessOAuth(d){return oe.loginWithHeadlessOAuth(d)},generateSiweMessage({address:d,chainId:p}){return oe.generateSiweMessage({address:d,chainId:p})},linkWithSiwe({message:d,signature:p,chainId:h,walletClientType:v,connectorType:_}){return ct("siwe"),oe.linkWithSiwe({message:d,signature:p,chainId:h,walletClientType:v,connectorType:_})},signMessageWithCrossAppWallet(d,{address:p}){return tc({user:s,client:t,address:p,requesterAppId:W.id,request:{method:"personal_sign",params:[d,p]},reconnect:us})},signTypedDataWithCrossAppWallet(d,{address:p}){let h=oa(d);return tc({user:s,client:t,address:p,requesterAppId:W.id,request:{method:"eth_signTypedData_v4",params:[p,h]},reconnect:us})},sendTransactionWithCrossAppWallet(d,{address:p}){return tc({user:s,client:t,address:p,requesterAppId:W.id,request:{method:"eth_sendTransaction",params:[d]},reconnect:us})},isModalOpen:r,mfaMethods:W.mfa.methods};cC=Jn.signMessage,dC=Jn.signTypedData,pC=async(...d)=>{let p=await uu(...d);return W.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let oe=(()=>({isNewUserThisSession:y,linkingOrConnectingHint:K,pendingTransaction:null,walletConnectionStatus:R,connectors:t.connectors?.walletConnectors??[],rpcConfig:W.rpcConfig,chains:W.chains,appId:e.appId,showFiatPrices:W.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:d=>W.chains.find(p=>p.id===Number(d))?.nativeCurrency.symbol,initializeWalletProxy:async d=>{if(O)return O;let p=new Promise(_=>{Ge(()=>N=>_(N))}),h=new Promise(_=>setTimeout(()=>_(null),d)),v=await Promise.race([p,h]);return Ge(null),v},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:async(d={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let p=n&&a&&s,h;if(p&&G.current&&(h=fu(s)),V.current==="login"?d.shouldCallAuthOnSuccess&&p&&G.current?(F(L,"login","onComplete",s,y,!1,G.current,h??null),e.onSuccess?.(s,y)):F(L,"login","onError","exited_auth_flow"):V.current==="link"&&h&&(d.isSuccess&&p&&G.current?F(L,"linkAccount","onSuccess",s,G.current,h):G.current&&F(L,"linkAccount","onError","exited_link_flow",{linkMethod:G.current})),E&&sv.includes(E)&&X.funding){let v=lv[E]??null,_=Gt(X.funding.chain.id,W.chains,W.rpcConfig,{appId:e.appId}),N;try{N=(await _.getBalance(X.funding.address)).toBigInt()}catch{console.error("Unable to pull wallet balance")}F(L,"fundWallet","onUserExited",{address:X.funding.address,chain:X.funding.chain,fundingMethod:v,balance:N})}j(null),V.current=null,G.current=null,b(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent({eventName:"modal_closed"})},solanaSignMessage:async({message:d})=>new Promise(async(p,h)=>{let v=async()=>{let _=await t.getAccessToken();if(!_)throw new Error("User must be authenticated to use their embedded wallet.");if(!u)throw new Error("User must have an embedded Solana wallet to sign messages for Solana.");let N=oe.walletProxy??await oe.initializeWalletProxy(15e3);if(!N)throw new Error("Failed to initialize embedded wallet proxy.");let{response:q}=await N.rpcSolana({accessToken:_,publicKey:u.address,request:{method:"signMessage",params:{message:d}}});return q.data.signature};if(W.embeddedWallets.noPromptOnSignature)try{let _=await v();p({signature:_})}catch(_){h(_)}else te({signMessage:{method:"solana_signMessage",data:d,confirmAndSign:v,onSuccess:fe=>{p({signature:fe})},onFailure:fe=>{h(fe)},uiOptions:{}}}),lt("EMBEDDED_WALLET_SIGN_REQUEST_SCREEN")}),openPrivyModal:ae,connectWallet:od,initLoginWithWallet:async(d,p)=>{G.current="siwe",ds(d,p)},loginWithWallet:async()=>{if(!n)throw new bo;if(!(t.authFlow instanceof To))throw new w("Must initialize SIWE flow first.");let d,p;if(a)try{({user:d}=await t.link()),G.current="siwe"}catch(h){throw F(L,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account",{linkMethod:"siwe"}),h}else try{({user:d,isNewUser:p}=await t.authenticate()),G.current="siwe"}catch(h){throw F(L,"login","onError",h.privyErrorCode||"generic_connect_wallet_error"),h}c(d||s||null),b(p||!1),l(!0)},initLoginWithFarcaster:async d=>{let p=new na(d);t.startAuthFlow(p);try{G.current="farcaster",await p.initializeFarcasterConnect()}catch(h){throw V.current==="login"?F(L,"login","onError",h.privyErrorCode||"unknown_auth_error"):V.current==="link"&&F(L,"linkAccount","onError",h.privyErrorCode||"unknown_auth_error",{linkMethod:"farcaster"}),h}},loginWithFarcaster:async()=>{if(!n)throw new bo;if(!(t.authFlow instanceof na))throw new w("Must initialize Farcaster flow first.");let d,p;if(a)try{({user:d}=await t.link()),G.current="farcaster"}catch(h){throw F(L,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account",{linkMethod:"farcaster"}),h}else try{({user:d,isNewUser:p}=await t.authenticate()),G.current="farcaster"}catch(h){throw F(L,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}c(d||null),b(p||!1),l(!0)},async crossAppAuthFlow({appId:d,popup:p}){let h=`privy:${d}`;G.current=h;let{url:v,stateCode:_,codeVerifier:N}=await Tg({api:t.api,appId:d});if(!v)throw t.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:"Unable to open cross-app auth popup",appId:d}}),new w("No authorization URL returned for cross-app auth.");try{let q=await aC({url:v,popup:p,provider:h}),fe=q.stateCode,re=q.authorizationCode;if(fe!==_)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:h,storedStateCode:_??"",returnedStateCode:fe??""}}),new w("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected");let Ze=await Sg({api:wo.api,appId:d,codeVerifier:N,stateCode:fe,authorizationCode:re});Ze&&t.storeProviderAccessToken(d,Ze);let Pe=await oe.refreshUser();if(!Pe)throw new w("Unable to update user");return t.createAnalyticsEvent({eventName:"cross_app_auth_completed",payload:{appId:d}}),Pe}catch(q){throw t.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:q.toString(),provider:h}}),q}},async initLoginWithOAuth(d,p){if(G.current=d,sd()){if(d==="google"&&_i(window.navigator.userAgent)){lt("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{lt("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}d==="twitter"&&window.opener&&window.opener.postMessage({type:"PRIVY_OAUTH_USE_BROADCAST_CHANNEL"},"*"),Q.del(Cn);let h=new Jr({provider:d});p&&h.addCaptchaToken(p),t.startAuthFlow(h);let v=await t.authFlow.getAuthorizationUrl();v&&v.url&&(d==="twitter"&&s_&&(v.url=v.url.replace("x.com","twitter.com")),window.location.assign(v.url))},async initLoginWithTelegram(d){if(!n)throw new bo;G.current="telegram";let p=new ii(d);t.startAuthFlow(p),p.meta.telegramWebAppData=void 0,p.meta.telegramAuthResult=await new Promise((h,v)=>{if(!W.loginConfig.telegramAuthConfiguration)return v(new w("Telegram Auth configuration is not loaded"));if(!window.Telegram)return v(new w("Telegram was not initialized"));window.Telegram.Login.auth({bot_id:W.loginConfig.telegramAuthConfiguration.botId,request_access:!0},_=>_?h(_):v(new w("Telegram auth failed or was canceled by the client")))})},async loginWithTelegram(){if(!(t.authFlow instanceof ii))throw new w("Must initialize Telegram flow before calling loginWithTelegram");let d,p;if(a)try{({user:d}=await t.link()),G.current="telegram"}catch(h){throw F(L,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account",{linkMethod:"telegram"}),h}else try{let h=await t.authenticate();d=h.user,p=h.isNewUser,G.current="telegram"}catch(h){throw V.current==="login"?F(L,"login","onError",h.privyErrorCode||"unknown_auth_error"):V.current==="link"&&F(L,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account",{linkMethod:"telegram"}),h}c(d),b(p||!1),l(!0)},async recoveryOAuthFlow(d,p,h){let v,_;function N(q){if(!q)throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:"Unable to open recovery OAuth popup",provider:d}}),new w("Recovery OAuth failed")}switch(d){case"google-drive":{let{url:q,codeVerifier:fe,stateCode:re}=await op({api:wo.api,provider:d});N(q);let Ze,Pe;try{let Ht=await lu({url:q,popup:h,provider:d});if(Ze=Ht.stateCode,Pe=Ht.authorizationCode,Ze!==re)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d,storedStateCode:re??"",returnedStateCode:Ze??""}}),new w("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected")}catch(Ht){throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:Ht.toString(),provider:d}}),new w("Recovery OAuth failed")}[v,_]=await Promise.all([we(),py({api:wo.api,provider:d,codeVerifier:fe,stateCode:Ze,authorizationCode:Pe})]);break}case"icloud":{let{url:q}=await op({api:wo.api,provider:d});N(q);let{ckWebAuthToken:fe}=await lu({url:q,popup:h,provider:d});_=fe,v=await we();break}}if(!O)throw new w("Cannot connect to wallet proxy");if(!v)throw new w("Unable to authorize user");switch(p){case"recover":let q=X.recoverWallet?.privyWallet?.address;if(!q)throw new w("Recovery OAuth failed");t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:q,recoveryMethod:d}}),await O.recover({address:q,accessToken:v,recoveryAccessToken:_,recoveryMethod:d}),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:q,recoveryMethod:d}});break;case"create-wallet":t.createAnalyticsEvent({eventName:"embedded_wallet_creation_started"}),await O.create({accessToken:v,recoveryAccessToken:_,recoveryMethod:d});let fe=await oe.refreshUser(),re=ye(fe);if(!re)throw F(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:re.address}}),F(L,"createWallet","onSuccess",re);break;case"set-recovery":let Ze=ye(s);if(!Ze)throw F(L,"setWalletRecovery","onError","embedded_wallet_not_found"),new Error("Embedded wallet not found");t.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_started",payload:{recoveryMethod:d}}),await O.setRecovery({address:Ze.address,accessToken:v,recoveryAccessToken:_,recoveryMethod:d});let Pe=ye(await oe.refreshUser());if(!Pe)throw F(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to set recovery on wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:Ze.address,recoveryMethod:d}}),F(L,"setWalletRecovery","onSuccess",d,Pe);break;default:throw new w("Unsupported recovery action")}},async loginWithOAuth(d){if(!(t.authFlow instanceof Jr))throw new w("Must initialize OAuth flow before calling loginWithOAuth");let p=Q.get(gn),h=t.authFlow.meta.stateCode;if(p!==h)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d,storedStateCode:p??"",returnedStateCode:h??""}}),new w("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected");let v,_,N;if(a)try{let q=await t.link();v=q.user,N=q.oAuthTokens,G.current=d}catch(q){throw F(L,"linkAccount","onError",q.privyErrorCode||"failed_to_link_account",{linkMethod:d}),q}else try{let q=await t.authenticate();v=q.user,_=q.isNewUser,N=q.oAuthTokens,G.current=d}catch(q){throw V.current==="login"?F(L,"login","onError",q.privyErrorCode||"unknown_auth_error"):V.current==="link"&&F(L,"linkAccount","onError",q.privyErrorCode||"failed_to_link_account",{linkMethod:d}),q}return c(v),b(_||!1),l(!0),N&&v&&F(L,"oAuthAuthorization","onOAuthTokenGrant",N,{user:v}),N},async initLoginWithPasskey(d){let p=new Tn(d);t.startAuthFlow(p),V.current="login";try{G.current="passkey",await p.initAuthenticationFlow()}catch(h){throw F(L,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}},async loginWithPasskey(){if(!n)throw new bo;if(!(t.authFlow instanceof Tn))throw new w("Must initialize Passkey flow first.");if(G.current!=="passkey")throw new w("Must init login with Passkey flow first.");let d,p;try{G.current="passkey",{user:d,isNewUser:p}=await t.authenticate()}catch(h){throw F(L,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}c(d),b(p||!1),l(!0)},async initLinkWithPasskey(d){let p=new Tn(d);t.startAuthFlow(p),V.current="link",G.current="passkey";try{await p.initLinkFlow()}catch(h){throw F(L,"linkAccount","onError",h.privyErrorCode||"unknown_auth_error",{linkMethod:"passkey"}),h}},async linkWithPasskey(){if(!n)throw new bo;if(!(t.authFlow instanceof Tn))throw new w("Must initialize Passkey flow first.");if(G.current!=="passkey")throw new w("Must init login with Passkey flow first.");let d;try{G.current="passkey",{user:d}=await t.link()}catch(p){throw F(L,"linkAccount","onError",p.privyErrorCode||"failed_to_link_account",{linkMethod:"passkey"}),p}return c(d||s||null),d},async initLoginWithHeadlessOAuth(d,p){if(sd()){if(d==="google"&&_i(window.navigator.userAgent))throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.")}else throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.");let h=new Jr({provider:d,headless:!0});p&&h.addCaptchaToken(p);let v=await t.startAuthFlow(h).getAuthorizationUrl();v?.url&&window.location.assign(v.url)},async loginWithHeadlessOAuth(d){A(!0),t.startAuthFlow(new Jr(d));let p=Q.get(gn),h=d.stateCode;if(p!==h)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d.provider,storedStateCode:p??"",returnedStateCode:h??""}}),A(!1),new w("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected");let v,_;if(a)try{({user:v}=await t.link()),G.current=d.provider}catch(N){throw F(L,"linkAccount","onError",N.privyErrorCode||"failed_to_link_account",{linkMethod:d.provider}),N}else try{({user:v,isNewUser:_}=await t.authenticate()),G.current=d.provider}catch(N){throw V.current==="login"?F(L,"login","onError",N.privyErrorCode||"unknown_auth_error"):V.current==="link"&&F(L,"linkAccount","onError",N.privyErrorCode||"failed_to_link_account",{linkMethod:d.provider}),N}return c(v),b(_||!1),l(!0),A(!1),v??void 0},initLoginWithEmail:async(d,p)=>{let h=new Lo(d,p);t.startAuthFlow(h);try{G.current="email",await h.sendCodeEmail()}catch(v){throw V.current==="login"?F(L,"login","onError",v.privyErrorCode||"unknown_auth_error"):V.current==="link"&&F(L,"linkAccount","onError",v.privyErrorCode||"failed_to_link_account",{linkMethod:"email"}),v}},initUpdateEmail:async(d,p,h)=>{let v=new Ts(d,p,h);t.startAuthFlow(v),await v.sendCodeEmail()},initLoginWithSms:async(d,p)=>{H({status:"sending-code"});let h=new Sn(d,p);t.startAuthFlow(h);try{G.current="sms",await h.sendSmsCode(),H({status:"awaiting-code-input"})}catch(v){throw H({status:"error",error:v}),V.current==="login"?F(L,"login","onError",v.privyErrorCode||"unknown_auth_error"):V.current==="link"&&F(L,"linkAccount","onError",v.privyErrorCode||"failed_to_link_account",{linkMethod:"sms"}),v}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async d=>{if(H({status:"submitting-code"}),!n){let v=new bo;throw H({status:"error",error:v}),v}if(t.authFlow instanceof Lo)t.authFlow.meta.emailCode=d.trim();else if(t.authFlow instanceof Sn)t.authFlow.meta.smsCode=d.trim();else{let v=new w("Must initialize a passwordless code flow first");throw H({status:"error",error:v}),v}await we();let p,h;if(V.current==="link")try{({user:p}=await t.link())}catch(v){throw H({status:"error",error:v}),F(L,"linkAccount","onError",v.privyErrorCode||"failed_to_link_account",{linkMethod:G.current}),v}else try{({user:p,isNewUser:h}=await t.authenticate())}catch(v){throw H({status:"error",error:v}),F(L,"login","onError",v.privyErrorCode||"unknown_auth_error"),v}c(p||s||null),b(h||!1),l(!0),H({status:"done"})},generateSiweMessage:async({address:d,chainId:p,captchaToken:h})=>{V.current="link",G.current="siwe";let v=await t.generateSiweNonce({address:d,captchaToken:h}),_=p.replace("eip155:","");return Zs({address:d,chainId:_,nonce:v})},linkWithSiwe:async({message:d,signature:p,chainId:h,walletClientType:v,connectorType:_})=>{let N;try{if(V.current!=="link"||G.current!=="siwe")throw new w("Must ensure no other auth flow is in progress other than the SIWE signature flow.");N=await t.linkWithSiwe({message:d,signature:p,chainId:h,walletClientType:v,connectorType:_}),N=await oe.refreshUser()??N;let q=fu(N);q&&F(L,"linkAccount","onSuccess",N,"siwe",q)}catch(q){throw F(L,"linkAccount","onError",q.privyErrorCode||"failed_to_link_account",{linkMethod:"siwe"}),V.current=null,G.current=null,q}c(N||s||null),V.current=null,G.current=null},refreshUser:async()=>{let d=await t.getAuthenticatedUser();return c(d),d},walletProxy:O,createAnalyticsEvent:({eventName:d,payload:p,timestamp:h})=>t.createAnalyticsEvent({eventName:d,payload:p,timestamp:h}),acceptTerms:async()=>{let d=await t.acceptTerms();return c(d),d},getUsdTokenPrice:d=>t.getUsdTokenPrice(d),recoverEmbeddedEthereumWallet:async()=>new Promise(async(d,p)=>{let h=ye(s)||Qs(s),v=await we();if(!v||!O||!h){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}Y(!0);try{await O.connect({accessToken:v,address:h.address}),d(!0)}catch(_){if(Ln(_)&&h.recoveryMethod==="privy")t.createAnalyticsEvent({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:h.address}}),(await O.recover({address:h.address,accessToken:v,recoveryMethod:h.recoveryMethod})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:h.address}}),d(!0);else if(Ln(_)&&h.recoveryMethod!=="privy"){te({recoverWallet:{privyWallet:h,onFailure:p,onSuccess:()=>d(!0)},recoveryOAuthStatus:{provider:h.recoveryMethod,action:"recover"}});let N=Ll(h.recoveryMethod);ae(N)}else p(_)}}),embeddedSolanaWallet:u,createEmbeddedSolanaWallet:async()=>{Y(!0);let d=await we(),p=_n(s),h=ye(s);if(!s||!d)throw new w("User must be logged in to create a Solana wallet");if(p)throw new w("User already has an embedded Solana wallet.");if(h)if(h.recoveryMethod==="privy")await oe.recoverEmbeddedEthereumWallet();else throw new w("Cannot create an embedded Solana wallet for a user with an existing Ethereum wallet with user-controlled recovery.");let v=await oe.initializeWalletProxy(15e3);if(!v)throw new w("Unable to initialize wallet proxy");t.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_started"});try{await v.createSolana({accessToken:d,ethereumAddress:h?.address});let _=await oe.refreshUser(),N=_n(_);if(!N)throw new w("Could not get Solana wallet for user");return t.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_completed",payload:{walletAddress:N.address}}),N}catch(_){throw t.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_failed"}),new w("Failed to create Solana embedded wallet with error ",_)}},recoverEmbeddedSolanaWallet:async()=>new Promise(async(d,p)=>{let h=_n(s),v=await we();if(!v||!O||!h){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}Y(!0);try{await O.connectSolana({accessToken:v,publicKey:h.address}),d(!0)}catch(_){Ln(_)&&h.recoveryMethod==="privy"?(t.createAnalyticsEvent({eventName:"embedded_solana_wallet_pinless_recovery_started",payload:{walletAddress:h.address}}),(await O.recoverSolana({publicKey:h.address,accessToken:v})).publicKey||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent({eventName:"embedded_solana_wallet_recovery_completed",payload:{walletAddress:h.address}}),d(!0)):p(_)}}),getMoonpaySignedUrl:SC,initCoinbaseOnRamp:t.initCoinbaseOnRamp.bind(t),getCoinbaseOnRampStatus:t.getCoinbaseOnRampStatus.bind(t),setReadyToTrue:d=>{i(!0),_e?.(d)},updateWallets:()=>ps(),fundWallet:async(d,p)=>{if(!W.fundingConfig||W.fundingConfig.methods.length===0)throw new Error("Wallet funding is not enabled");let h=Zc({fundingMethods:W.fundingConfig.methods});te({funding:hu({address:d,fundWalletConfig:p,methodScreen:h})}),ae(h)},requestFarcasterSignerStatus:async d=>{let p=await we(),h=s?.linkedAccounts.find(_=>_.type==="wallet"&&_.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!O||!h)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");let v=await t.requestFarcasterSignerStatus(d);if(v.status==="approved"){let _=await t.getAuthenticatedUser();c(_||s||null)}return v}}))();uC=oe.recoverEmbeddedEthereumWallet,mC=oe.recoverEmbeddedSolanaWallet,fC=oe.solanaSignMessage;let xC=a_(()=>({wallets:m,ready:mt&&rt}),[m,mt,rt]);return wr(Se.Provider,{value:Jn,children:wr(Wd.Provider,{value:L,children:wr(wp.Provider,{value:xC,children:wr(Zf,{...W,children:lC(Md.Provider,{value:oe,children:[wr($h,{children:lC(Vf,{data:X,setModalData:te,setInitialScreen:k,initialScreen:E,authenticated:a,open:r,children:[e.children,!W.headless&&W.captchaEnabled&&n&&!a&&wr(Id,{delayedExecution:!1}),wr(Vv,{theme:{...W.appearance.palette||{}}}),!W.render.standalone&&wr(au,{open:r})]})}),Ie&&Ce?wr(oC,{appId:e.appId,appClientId:e.clientId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:Wr,mfaSubmitPromise:Zr,onLoad:U,onLoadFailed:()=>null}):null,W.loginMethods.telegram&&W.loginConfig.telegramAuthConfiguration&&wr(Fr,{if:!0,children:wr(eC,{scriptHost:e.apiUrl||Ms,botUsername:W.loginConfig.telegramAuthConfiguration.botName})})]})})})})})};import{useContext as h_}from"react";function y_(e){let{login:t}=h_(Se);return Ae("login",e),{login:t}}import{useContext as g_}from"react";function v_(e){let{logout:t}=g_(Se);return Ae("logout",e),{logout:t}}import{useCallback as hC,useEffect as C_}from"react";function w_(){let e=be(),t=nl(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:i,user:a}=z(),l=hC(async c=>{if(e.enabled&&e.status!=="success")throw new nr(e.error,null,"captcha_failure");return r(c.provider,e.token)},[r,e]),s=hC(async()=>{let c=da();if(a)return console.warn("Cannot login with OAuth when already logged in"),a;if(!c.inProgress)throw new Error("Cannot login with OAuth because no OAuth flow is in progress");if(!c.popupFlow)try{return await o(c)}catch(m){throw m}finally{En()}},[o]);return C_(()=>{let c=da();i&&t&&c.inProgress&&c.headless&&!c.popupFlow&&s()},[i,t]),{initOAuth:l,loginWithOAuth:s,loading:n}}import{useCallback as yC}from"react";var b_=()=>{let e=be(),{initLoginWithEmail:t,loginWithCode:r}=z(),o=yC(async({email:i})=>{if(!i)throw new Error("Email required to send OTP code");return t(i)},[t]),n=yC(async({code:i})=>{if(e.enabled&&e.status==="error")throw new nr(e.error,null,"captcha_failure");return r(i)},[r,e.status]);return{sendCode:o,loginWithCode:n}};import{useCallback as gC}from"react";var E_=()=>{let e=be(),{initLoginWithSms:t,loginWithCode:r,otpState:o}=z(),n=gC(async({phoneNumber:a})=>{if(!a)throw new Error("SMS required to send OTP code");return t(a)},[t]),i=gC(async({code:a})=>{if(e.enabled&&e.status!=="success")throw new nr(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:n,loginWithCode:i,state:o}};import{useCallback as vC}from"react";var T_=()=>{let e=be(),{generateSiweMessage:t,linkWithSiwe:r}=z(),o=vC(async({address:i,chainId:a})=>{if(!i||!a)throw new Error("wallet address and chainId required to generate nonce");return t({address:i,chainId:a}).then(l=>l)},[t]),n=vC(async({signature:i,message:a,chainId:l,walletClientType:s,connectorType:c})=>{if(e.enabled&&e.status!=="success")throw new nr(e.error,null,"captcha_failure");return r({message:a,signature:i,chainId:l,walletClientType:s,connectorType:c})},[r,e.status]);return{generateSiweMessage:o,linkWithSiwe:n}};import{useContext as S_}from"react";function __(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:a,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:m,linkSpotify:f,linkInstagram:u,linkTelegram:C,linkFarcaster:g}=S_(Se);return Ae("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:a,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:m,linkSpotify:f,linkInstagram:u,linkFarcaster:g,linkTelegram:C}}import{useContext as P_}from"react";function A_(e){let{connectWallet:t}=P_(Se);return Ae("connectWallet",e),{connectWallet:t}}import{useContext as x_}from"react";function k_(e){let{createWallet:t}=x_(Se);return Ae("createWallet",e),{createWallet:t}}var R_=e=>{Ae("fundWallet",e);let{fundWallet:t}=z();return{fundWallet:t}};var I_=()=>{let{embeddedSolanaWallet:e,createEmbeddedSolanaWallet:t}=M();return{createWallet:t,wallets:e?[e]:[]}};var M_=()=>{let{linkCrossAppAccount:e,unlinkCrossAppAccount:t,signMessageWithCrossAppWallet:r,signTypedDataWithCrossAppWallet:o,sendTransactionWithCrossAppWallet:n}=z();return{linkCrossAppAccount:e,unlinkCrossAppAccount:t,signMessage:r,signTypedData:o,sendTransaction:n}};import{useContext as W_}from"react";function O_(e){let{sendTransaction:t}=W_(Se);return Ae("sendTransaction",e),{sendTransaction:t}}import{useContext as L_}from"react";function N_(e){let{setWalletPassword:t}=L_(Se);return Ae("setWalletPassword",e),{setWalletPassword:t}}import{useContext as D_}from"react";function U_(e){let{setWalletRecovery:t}=D_(Se);return Ae("setWalletRecovery",e),{setWalletRecovery:t}}import{useContext as F_}from"react";function B_(e){let{signMessage:t}=F_(Se);return Ae("signMessage",e),{signMessage:t}}import{useContext as H_}from"react";function G_(e){let{signTypedData:t}=H_(Se);return Ae("signTypedData",e),{signTypedData:t}}import{useContext as V_}from"react";var q_=()=>{let{isModalOpen:e}=V_(Se);return{isOpen:e}};import{useContext as z_}from"react";function $_(e){let{getAccessToken:t}=z_(Se);return Ae("accessToken",e),{getAccessToken:t}}function K_(e){let{authenticated:t,user:r}=z(),{initLoginWithOAuth:o}=M(),n=hi();return Ae("oAuthAuthorization",e),{reauthorize:i=>j_(t,r,o,n,i.provider)}}var j_=async(e,t,r,o,n)=>{if(!e)throw o("linkAccount","onError","must_be_authenticated",{linkMethod:n}),new w("User must be authenticated before linking an account.");if(!t?.linkedAccounts.some(a=>a.type.includes(n)))throw new w(`OAuth account of type ${n} not linked to the account.`);await r(n)};var Y_=CC;function CC(){let{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}=z();return{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}}function Z_(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}function Q_(e){return e.find(r=>r.walletClientType==="privy"&&r.connectorType==="embedded"&&!r.imported)??null}export{Xr as AsExternalProvider,Id as Captcha,ha as ConnectorManager,au as LoginModal,ya as PrivyClient,m_ as PrivyProvider,je as PrivyProxyProvider,ma as SUPPORTED_CHAINS,ud as VERSION,$t as WalletConnector,Z_ as addRpcUrlOverrideToChain,tp as errorIndicatesMaxMfaRetries,Nn as errorIndicatesMfaTimeout,Dn as errorIndicatesMfaVerificationFailed,we as getAccessToken,Q_ as getEmbeddedConnectedWallet,A_ as useConnectWallet,k_ as useCreateWallet,M_ as useCrossAppAccounts,Y_ as useExperimentalFarcasterSigner,CC as useFarcasterSigner,R_ as useFundWallet,__ as useLinkAccount,T_ as useLinkWithSiwe,y_ as useLogin,b_ as useLoginWithEmail,w_ as useLoginWithOAuth,E_ as useLoginWithSms,v_ as useLogout,Ka as useMfa,$r as useMfaEnrollment,q_ as useModalStatus,K_ as useOAuthTokens,z as usePrivy,Od as useRegisterMfaListener,O_ as useSendTransaction,N_ as useSetWalletPassword,U_ as useSetWalletRecovery,B_ as useSignMessage,G_ as useSignTypedData,I_ as useSolanaWallets,$_ as useToken,zr as useWallets};
3337
+ `;import{useRef as nC,useEffect as r_}from"react";import{jsx as n_}from"react/jsx-runtime";function o_({botUsername:e,scriptHost:t}){let r=document.createElement("script"),{origin:o}=new URL(t);return r.async=!0,r.src=`${o}/js/telegram-login.js`,r.setAttribute("data-telegram-login",e),r.setAttribute("data-request-access","write"),r.setAttribute("data-lang","en"),r}function iC(e){let t=nC(null),r=nC();return r_(()=>{r.current?.remove(),r.current=o_(e),t.current?.after(r.current)},[e]),n_("div",{ref:t,hidden:!0})}import{useState as i_}from"react";import{useEffect as aC,useRef as sC}from"react";var od=class{constructor(){this.callbacks={}}enqueue(t,r){this.callbacks[t]=r}dequeue(t,r){let o=this.callbacks[r];if(!o)throw new Error(`cannot dequeue ${t} event: no event found for id ${r}`);switch(delete this.callbacks[r],t){case"privy:iframe:ready":return o;case"privy:wallet:create":return o;case"privy:wallet:import":return o;case"privy:wallet:connect":return o;case"privy:wallet:recover":return o;case"privy:wallet:rpc":return o;case"privy:wallet:set-recovery":return o;case"privy:mfa:verify":return o;case"privy:mfa:init-enrollment":return o;case"privy:mfa:submit-enrollment":return o;case"privy:mfa:unenroll":return o;case"privy:mfa:clear":return o;case"privy:farcaster:init-signer":return o;case"privy:farcaster:sign":return o;case"privy:solana-wallet:create":return o;case"privy:solana-wallet:connect":return o;case"privy:solana-wallet:recover":return o;case"privy:solana-wallet:rpc":return o;default:throw new Error(`invalid wallet event type ${t}`)}}};async function gn(e,t,r,o,n,i=!1){let a=i,l=async m=>{if(a&&t&&t.length>0){m===(i?0:1)?n("configureMfa","onMfaRequired",t):o.current?.reject(new We("missing_or_invalid_mfa","MFA verification failed, retry."));let f=await new Promise((u,C)=>{r.current={resolve:u,reject:C};let g=1e3*60*5;setTimeout(()=>{let y=new We("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(y),C(y)},g)});return await e(f)}return await e()},s=4,c=null;for(let m=0;m<s;m++)try{c=await l(m),o.current?.resolve(void 0);break}catch(f){if(f.type==="missing_or_invalid_mfa")a=!0;else throw o.current?.resolve(void 0),f}if(c===null){let m=new We("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(m),m}return c}import{jsx as p_}from"react/jsx-runtime";var a_=function(e){return()=>`id-${e++}`}(0);function s_(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function gt(e){return e.error!==void 0}var ut=new od,cu=new Map,l_=(e,t)=>typeof t=="bigint"?t.toString():t,c_=(e,t)=>`${e}${JSON.stringify(t,l_)}`;function vt(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let i=c_(e,t);if(e==="privy:wallet:create"){let l=cu.get(i);if(l)return l}let a=new Promise((l,s)=>{let c=a_();ut.enqueue(c,{resolve:l,reject:s}),n.postMessage({id:c,event:e,data:t},o)}).finally(()=>{cu.delete(i)});return cu.set(i,a),a}function d_(e){switch(e.event){case"privy:iframe:ready":let t=ut.dequeue(e.event,e.id);return gt(e)?t.reject(new We(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=ut.dequeue(e.event,e.id);return gt(e)?r.reject(new We(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:import":let o=ut.dequeue(e.event,e.id);return gt(e)?o.reject(new We(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:connect":let n=ut.dequeue(e.event,e.id);return gt(e)?n.reject(new We(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:recover":let i=ut.dequeue(e.event,e.id);return gt(e)?i.reject(new We(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:rpc":let a=ut.dequeue(e.event,e.id);return gt(e)?a.reject(new We(e.error.type,e.error.message)):a.resolve(e.data);case"privy:wallet:set-recovery":let l=ut.dequeue(e.event,e.id);return gt(e)?l.reject(new We(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:verify":let s=ut.dequeue(e.event,e.id);return gt(e)?s.reject(new We(e.error.type,e.error.message)):s.resolve(e.data);case"privy:mfa:init-enrollment":{let u=ut.dequeue(e.event,e.id);return gt(e)?u.reject(new We(e.error.type,e.error.message)):u.resolve(e.data)}case"privy:mfa:submit-enrollment":{let u=ut.dequeue(e.event,e.id);return gt(e)?u.reject(new We(e.error.type,e.error.message)):u.resolve(e.data)}case"privy:mfa:unenroll":{let u=ut.dequeue(e.event,e.id);return gt(e)?u.reject(new We(e.error.type,e.error.message)):u.resolve(e.data)}case"privy:mfa:clear":{let u=ut.dequeue(e.event,e.id);return gt(e)?u.reject(new We(e.error.type,e.error.message)):u.resolve(e.data)}case"privy:farcaster:init-signer":{let u=ut.dequeue(e.event,e.id);return gt(e)?u.reject(new We(e.error.type,e.error.message)):u.resolve(e.data)}case"privy:farcaster:sign":{let u=ut.dequeue(e.event,e.id);return gt(e)?u.reject(new We(e.error.type,e.error.message)):u.resolve(e.data)}case"privy:solana-wallet:create":let c=ut.dequeue(e.event,e.id);return gt(e)?c.reject(new We(e.error.type,e.error.message)):c.resolve(e.data);case"privy:solana-wallet:connect":let m=ut.dequeue(e.event,e.id);return gt(e)?m.reject(new We(e.error.type,e.error.message)):m.resolve(e.data);case"privy:solana-wallet:recover":let f=ut.dequeue(e.event,e.id);return gt(e)?f.reject(new We(e.error.type,e.error.message)):f.resolve(e.data);case"privy:solana-wallet:rpc":{let u=ut.dequeue(e.event,e.id);return gt(e)?u.reject(new We(e.error.type,e.error.message)):u.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function lC(e){let t=sC(null),r=sC(e.mfaMethods),o=gi(),[n,i]=i_(!1);return aC(()=>{r.current=e.mfaMethods},[e.mfaMethods]),aC(()=>{if(!n)return;let a=t.current;if(!a)return;function l(u){u&&u.origin===e.origin&&s_(u.data)&&d_(u.data)}let s={create(u){return vt("privy:wallet:create",u,a,e.origin)},import(u){return vt("privy:wallet:import",u,a,e.origin)},connect(u){return vt("privy:wallet:connect",u,a,e.origin)},recover(u){return gn(C=>vt("privy:wallet:recover",{...u,...C},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!u.recoveryMethod||u.recoveryMethod==="privy")},rpc(u){return gn(C=>vt("privy:wallet:rpc",{...u,...C},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},createSolana(u){return vt("privy:solana-wallet:create",u,a,e.origin)},connectSolana(u){return vt("privy:solana-wallet:connect",u,a,e.origin)},recoverSolana(u){return vt("privy:solana-wallet:recover",u,a,e.origin)},rpcSolana(u){return vt("privy:solana-wallet:rpc",u,a,e.origin)},setRecovery(u){return gn(C=>vt("privy:wallet:set-recovery",{...u,...C},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(u){return gn(C=>vt("privy:mfa:verify",{...u,...C},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(u){return gn(C=>vt("privy:mfa:init-enrollment",{...u,...C},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(u){return gn(C=>vt("privy:mfa:submit-enrollment",{...u,...C},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},unenrollMfa(u){return gn(C=>vt("privy:mfa:unenroll",{...u,...C},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},clearMfa(u){return vt("privy:mfa:clear",u,a,e.origin)},initFarcasterSigner(u){return vt("privy:farcaster:init-signer",u,a,e.origin)},signFarcasterMessage(u){return vt("privy:farcaster:sign",u,a,e.origin)}};window.addEventListener("message",l);let c=()=>e.onLoad(s),m=(...u)=>{console.warn("Privy iframe failed to load: ",...u),e.onLoadFailed()},f=new AbortController;return oa(()=>vt("privy:iframe:ready",{},a,e.origin),{abortSignal:f.signal}).then(c,m),()=>{window.removeEventListener("message",l),f.abort()}},[n]),p_("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>i(!0),src:ks(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId,client_id:e.appClientId})})}var nd=class{constructor(t,r){this.walletProxy=t,this.address=r}async handleSignMessage(t){if(!t.params||typeof t.params.message!="string")throw new Error("Message must be provided as a string for Solana signMessage RPC");return await dC({message:t.params.message})}async request(t){if(console.debug("EmbeddedSolanaProvider.request() called with args",t),!await we())throw new Error("User must be authenticated to use embedded Solana wallet");if(!await cC())throw new w("Unable to connect to Solana embedded wallet");switch(t.method){case"signMessage":return await this.handleSignMessage(t);default:throw new Error("Embedded Solana provider does not yet support this RPC method.")}}};async function pC({url:e,popup:t}){return t.location=e,new Promise((o,n)=>{let a=setTimeout(()=>{n(new w("Authorization request timed out after 2 minutes.")),l()},12e4);function l(){t?.close(),window.removeEventListener("message",m)}let s,c=setInterval(()=>{t?.closed&&!s&&(l(),clearInterval(c),clearTimeout(a),n(new w("User rejected request")))},300);function m(f){f.data&&(f.data.type==="PRIVY_OAUTH_RESPONSE"&&f.data.stateCode&&f.data.authorizationCode&&(clearTimeout(a),o(f.data),l()),f.data.type==="PRIVY_OAUTH_ERROR"&&(clearTimeout(a),n(new w(f.data.error)),l()),f.data.type==="PRIVY_OAUTH_USE_BROADCAST_CHANNEL"&&(s=new BroadcastChannel("popup-privy-oauth"),s.onmessage=m))}window.addEventListener("message",m)})}var u_="https://cdn.apple-cloudkit.com";async function du({url:e,popup:t,provider:r}){return t.location=e,new Promise((n,i)=>{function a(){t?.close(),window.removeEventListener("message",l)}function l(s){s.data&&(s.data.type==="PRIVY_OAUTH_RESPONSE"&&s.data.stateCode&&s.data.authorizationCode&&(n(s.data),a()),s.origin===u_&&s.data.ckSession&&(n({type:"PRIVY_OAUTH_RESPONSE",ckWebAuthToken:s.data.ckSession}),a()),s.data.type==="PRIVY_OAUTH_ERROR"&&(i(s.data.error),a()))}window.addEventListener("message",l)})}var uC=e=>({id:e.id,raw_id:e.rawId,response:{client_data_json:e.response.clientDataJSON,authenticator_data:e.response.authenticatorData,signature:e.response.signature,user_handle:e.response.userHandle},authenticator_attachment:e.authenticatorAttachment,client_extension_results:{app_id:e.clientExtensionResults.appid,cred_props:e.clientExtensionResults.credProps,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret},type:e.type});import{jsx as br,jsxs as mC}from"react/jsx-runtime";var wo;function C_(e){return typeof e=="string"&&e.length===25}function we(){if(!wo){let e=Q.get(Cn);return Promise.resolve(e||null)}return wo.getAccessToken()}var fC,jm=(e,t,r)=>fC(e,t,r),hC,Ym=(e,t)=>hC(e,t),yC,Zm=(e,t)=>yC(e,t),gC,Qm=()=>gC(),vC,cC=()=>vC(),CC,dC=({message:e})=>CC({message:e}),w_=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;Q.put(aa,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},b_=({config:e,...t})=>{if(!C_(t.appId))throw new w("Cannot initialize the Privy provider with an invalid Privy app ID");wo||(wo=new ga({appId:t.appId,appClientId:t.clientId,apiUrl:t.apiUrl}));let r=Object.assign({},e);return t.createPrivyWalletOnLogin!==void 0&&r.embeddedWallets?.createOnLogin===void 0&&(r.embeddedWallets||(r.embeddedWallets={}),r.embeddedWallets.createOnLogin=t.createPrivyWalletOnLogin?"users-without-wallets":"off"),t.createPrivyWalletOnLogin!==void 0&&e?.embeddedWallets?.createOnLogin&&console.warn("Both `createPrivyWalletOnLogin` and `config.embeddedWallets.createOnLogin` are set. `createPrivyWalletOnLogin` is deprecated and should be removed."),br(zf,{client:wo,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:br(E_,{...t,client:wo})})},E_=e=>{let t=e.client,[r,o]=lt(!1),[n,i]=lt(!1),[a,l]=lt(!1),[s,c]=lt(null),[m,f]=lt([]),[u,C]=lt(null),g=ea(m),[y,b]=lt(!1),[T,k]=lt(null),[S,x]=lt(!1),[R,I]=lt({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:E}),[D,H]=lt({status:"initial"}),[K,j]=lt(null),[O,U]=lt(null),W=Ve(),Ce=al(),[Ie,Y]=lt(!0),[X,te]=lt({}),[_e,Te]=lt(null),[Ke,Ge]=lt(null),[mt,Fe]=lt(!1),[se,Ft]=lt(!1),Wr=ea(null),Zr=ea(null),L=ea(oh),[rt,Or]=lt(!1);t.onStoreToken=d=>{d&&F(L,"accessToken","onAccessTokenGranted",d)},t.onDeleteToken=()=>{c(null),l(!1),F(L,"accessToken","onAccessTokenRemoved")};let G=ea(null),V=ea(null),ae=d=>{k(d),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent({eventName:"modal_open",payload:{initialScreen:d}})},ct=d=>{W.embeddedWallets.createOnLogin!=="off"&&Y(!0),ae(d)};Yr(()=>{let d=An(s);if(!d||!O)return;let p={address:d.address,connectedAt:Date.now(),walletClientType:"privy",connectorType:"embedded",meta:{name:"Privy Wallet",icon:Bo,id:"io.privy.solana.wallet"},getProvider:async()=>new nd(O,d.address)};C(p)},[O,s]),Yr(()=>{if(!s){t.connectors?.removeEmbeddedWalletConnector();return}let d=ge(s),p=Xs(s);if(d||t.connectors?.removeEmbeddedWalletConnector(),p||t.connectors?.removeImportedWalletConnector(),!t.connectors){console.debug("Failed to add embedded wallet connector: Client connectors not initialized");return}if(!O){console.debug("Failed to add embedded wallet connector: Wallet proxy not initialized");return}d&&t.connectors.addEmbeddedWalletConnector(O,d.address,W.defaultChain,e.appId),p&&t.connectors.addImportedWalletConnector(O,p.address,W.defaultChain,e.appId)},[O,s]),Yr(()=>{O&&Ke?.(O)},[O]),Yr(()=>{(async()=>{if(!W.customAuth?.enabled)return;Y(!0);let{getCustomAccessToken:p,isLoading:h}=W.customAuth;if(!(!n||h))try{let v=await p();if(!v&&a){await ei.logout();return}if(!v||a)return;t.startAuthFlow(new ri(v));let{user:P,isNewUser:N}=await t.authenticate();if(!P){await ei.logout();return}c(P||null),b(N||!1),l(!0),Ft(!0)}catch(v){console.warn(v),a&&await ei.logout()}})()},[W.customAuth?.enabled,W.customAuth?.getCustomAccessToken,W.customAuth?.isLoading,n,a]),Yr(()=>{se&&O&&s&&qt(s,W.embeddedWallets.createOnLogin)&&(Ft(!1),mu(s,ni).catch(console.error))},[se&&O&&s]),Yr(()=>{async function d(){let p=ta(),h=ds();w_();let v=m_();t.initializeConnectorManager({walletConnectCloudProjectId:W.walletConnectCloudProjectId,rpcConfig:W.rpcConfig,chains:W.chains,defaultChain:W.defaultChain,store:v,walletList:W.appearance.walletList,shouldEnforceDefaultChainOnConnect:W.shouldEnforceDefaultChainOnConnect,externalWalletConfig:W.externalWallets,appName:W.name??"Privy"});let P;t.connectors?.on("connectorInitialized",()=>{P&&clearTimeout(P);let fe=t.connectors.walletConnectors.length,oe=t.connectors.walletConnectors.reduce((Ze,Pe)=>Ze+(Pe.initialized?1:0),0);oe===fe?Or(!0):P=setTimeout(()=>{console.debug({message:"Unable to initialize all expected connectors before timeout",initialized:oe,expected:fe}),Or(!0)},1500)}),t.connectors?.initialize().then(()=>{PC()});let N=await t.getAuthenticatedUser(),$=!!N;if(W.customAuth?.enabled||(l(!!N),N&&F(L,"login","onComplete",N,!1,!0,null,null),c(N)),p){V.current=$?"link":"login";return}if(h&&!$){V.current="login",ct("TELEGRAM_AUTH_SCREEN");return}ne.setReadyToTrue(!!N)}!n&&Ce&&d()},[t,_e,n,Ce]),Yr(()=>{if(!n)return;if(!s){Fe(!0);return}if(!!!s.linkedAccounts.find(h=>h.type==="wallet"&&h.walletClientType==="privy")){Fe(!0);return}let p=!!m.find(h=>h.walletClientType==="privy");Fe(p)},[n,s,m]);let ta=()=>{let d=pa();if(d.inProgress&&d.popupFlow){if(window.opener.location.origin!==window.location.origin){window.opener.postMessage({type:"PRIVY_OAUTH_ERROR",error:"Origins between parent and child windows do not match."});return}if(d.authorizationCode==="error"){window.opener.postMessage({type:"PRIVY_OAUTH_ERROR",error:"Something went wrong. Try again."});return}window.opener.postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:d.stateCode,authorizationCode:d.authorizationCode});return}let p="privy:";function h(v){return v.startsWith(p)}return d.inProgress&&h(d.provider)&&!d.popupFlow&&(new BroadcastChannel("popup-privy-oauth").postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:d.stateCode,authorizationCode:d.authorizationCode}),window.close()),!d.inProgress||d.headless?!1:(t.startAuthFlow(new Jr(d)),ct("AWAITING_OAUTH_SCREEN"),!0)},ds=()=>{let d=zm();if(!d||!W.loginMethods.telegram||!W.loginConfig.telegramAuthConfiguration?.seamlessAuthEnabled)return;let p=new si;return t.startAuthFlow(p),d.flowType==="login-url"&&(p.meta.telegramWebAppData=void 0,p.meta.telegramAuthResult={id:d.id,first_name:d.first_name,last_name:d.last_name,auth_date:d.auth_date,username:d.username,photo_url:d.photo_url,hash:d.hash}),d.flowType==="web-app"&&(p.meta.telegramAuthResult=void 0,p.meta.telegramWebAppData={query_id:d.query_id,user:d.user,auth_date:d.auth_date,hash:d.hash}),!0},_C=async(d,p,h,v)=>{let P=await t.connectors?.createWalletConnector(d,p)||null;id(P,p,h,v)};async function id(d,p,h,v){if(d)I({status:"disconnected",connectedWallet:null,connectError:null,connector:d,connectRetry:E});else return I({status:"disconnected",connectedWallet:null,connectError:new ce("Unable to connect to wallet."),connector:null,connectRetry:E}),v?.(null,h);d instanceof Dr&&p&&await d.resetConnection(p),I({connector:d,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>id(d,p,h,v)});try{let P=await d.connect({showPrompt:!0});if(W.shouldEnforceDefaultChainOnConnect&&!W.chains.find(N=>N.id===Number(P?.chainId.replace("eip155:","")))&&!(P?.connectorType==="wallet_connect_v2"&&P?.walletClientType==="metamask")){I(N=>({...N,connector:d,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:E}));try{await P?.switchChain(W.defaultChain.id),P&&(P.chainId=oi(vn(W.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${W.defaultChain.id}`)}}return I(N=>({...N,status:"connected",connectedWallet:P,connectError:null,connectRetry:E})),P&&F(L,"connectWallet","onSuccess",P),v?.(P,h)}catch(P){return P instanceof et?(console.warn(P.cause?P.cause:P.message),F(L,"connectWallet","onError",P.privyErrorCode||"generic_connect_wallet_error")):(console.warn(P),F(L,"connectWallet","onError","unknown_connect_wallet_error")),I(N=>({...N,status:"disconnected",connectedWallet:null,connectError:P})),v?.(null,h)}}let ps=async(d,p)=>{if(d===null)return;let h=new To(d,t,p);t.startAuthFlow(h)},PC=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_connector"),h=d.get("privy_wallet_client");if(!p||!h)return;if(h==="phantom"&&!No()&&ct("LOGIN_FAILED_SCREEN"),!t.connectors)throw new w("Connector not initialized");ae("AWAITING_CONNECTION");let v=new URL(window.location.href);v.searchParams.delete("privy_connector"),v.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",v),_C(p,h,void 0,ps)};Yr(()=>{n&&a&&s===null&&t.getAuthenticatedUser().then(c)},[n,a,s,t]);let ot=d=>{if(!a)throw F(L,"linkAccount","onError","must_be_authenticated",{linkMethod:d}),new w("User must be authenticated before linking an account.")},uu=()=>{ot("siwe"),G.current="siwe",V.current="link",ae("LINK_WALLET_SCREEN")},AC=d=>{if(!a||!s)return!1;if(d.walletClientType==="privy")return!0;for(let p of s.linkedAccounts)if(p.type==="wallet"&&p.address===d.address&&p.walletClientType!=="privy")return!0;return!1},xC=async d=>{if(!t.connectors)throw new w("Connector not initialized");let p=t.connectors.findWalletConnector(d.connectorType,d.walletClientType)||null;if(I(h=>({...h,connector:p,status:"connected",connectedWallet:d,connectError:null,connectRetry:E})),W.captchaEnabled&&!a){let h={callback:v=>ps(d,v),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};te({captchaModalData:h}),ct("CAPTCHA_SCREEN")}else await ps(d),ct("AWAITING_CONNECTION")},kC=async(d,p)=>{let{signedUrl:h,externalTransactionId:v}=await u1(t,d,p??{},W.appearance.palette,W.fundingMethodConfig?.moonpay.useSandbox??!1);return{signedUrl:h,externalTransactionId:v}},us=()=>{f(d=>{let p=t.connectors?.wallets.map(h=>({...h,linked:AC(h),loginOrLink:async()=>{if(!await h.isConnected())throw new w("Wallet is not connected");if(h.connectorType==="embedded"&&h.walletClientType==="privy")throw new w("Cannot link or login with embedded wallet");xC(h)},fund:async v=>{await ne.fundWallet(h.address,v)},unlink:async()=>{if(!a)throw new w("User is not authenticated.");if(h.connectorType==="embedded"&&h.walletClientType==="privy")throw new w("Cannot unlink an embedded wallet");let v=await t.unlinkWallet(h.address);c(v)}}))||[];return el(d,p)?d:p})};Yr(()=>{us()},[s?.linkedAccounts,a,n]),Yr(()=>{if(n){if(!t.connectors)throw new w("Connector not initialized");us(),t.connectors.on("walletsUpdated",us)}},[n]);let RC=d=>{if(d&&"suggestedAddress"in d&&d.suggestedAddress){let p=Oo(d.suggestedAddress);j(p)}ae(a?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};Yr(()=>{if(!m[0])return;let d=m[0],p=g.current.find(v=>v.address===d.address),h;if(d.walletClientType==="privy"?h=s?.linkedAccounts.find(v=>v.type==="wallet"&&v.address===d.address&&v.walletClientType==="privy"):h=s?.linkedAccounts.find(v=>v.type==="wallet"&&v.address===d.address&&v.walletClientType!=="privy"),!p&&h){let v=Object.assign({},s);v.wallet=h&&{address:h.address,chainType:h.chainType,chainId:h.chainId,walletClient:h.walletClient,walletClientType:h.walletClientType,connectorType:h.connectorType,imported:h.imported},c(v)}g.current=m},[m]);let mu=async(d,p)=>{if(ge(d))throw F(L,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[v,P]=await Promise.all([ne.initializeWalletProxy(p),we()]);if(!v&&W.customAuth?.enabled)throw F(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!v||!P||W.embeddedWallets?.requireUserOwnedRecoveryOnCreate)return new Promise((N,$)=>{Y(!0),te({createWallet:{onSuccess:oe=>{F(L,"createWallet","onSuccess",oe),N(oe)},onFailure:oe=>{F(L,"createWallet","onError","unknown_embedded_wallet_error"),$(oe)},callAuthOnSuccessOnClose:!1}}),ae("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await v.create({accessToken:P});let N=await ne.refreshUser(),$=ge(N);if(!$)throw F(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return F(L,"createWallet","onSuccess",$),$}},IC=d=>{if(!W.chains.map(p=>p.id).includes(d))throw new ce(`Chain ID ${d} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},fu=(d,p,h)=>new Promise(async(v,P)=>{let{requesterAppId:N}=p||{};if(!a||!s){F(L,"sendTransaction","onError","must_be_authenticated"),P(new Error("User must be authenticated before signing with a Privy wallet"));return}let $=d.from,fe=$?s?.linkedAccounts.find(Qe=>Qe.type==="wallet"&&Qe.walletClientType==="privy"&&Oo(Qe.address)===Oo($)):ge(s);if(!fe){F(L,"sendTransaction","onError","embedded_wallet_not_found"),P(new Error("Must have a Privy wallet before signing"));return}Y(!0);let oe=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,Ze=d.chainId?Number(d.chainId):oe.chainId;IC(Ze);let Pe=Object.assign({},d,{chainId:Ze}),Ht=async()=>{let Qe=await we();if(!Qe||!O){F(L,"sendTransaction","onError","embedded_wallet_not_found"),P(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await ne.recoverEmbeddedEthereumWallet()){F(L,"sendTransaction","onError","unknown_connect_wallet_error"),P(new Error("Unable to connect to wallet"));return}let ti=Gt(Pe.chainId,W.chains,W.rpcConfig,{appId:e.appId}),Qr=await v_(fe.address,Pe,ti);if(W.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:OC}=await g_(Qr,ti),{hasSufficientFunds:LC}=await Hi(fe.address,Qr,OC,ti);if(!LC)throw new Ct(new Sr("Wallet has insufficient funds for this transaction.",y_.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let Cu=await Jl(Qe,fe.address,O,Qr,ti,N);F(L,"sendTransaction","onSuccess",Cu),v(Cu)}catch(fs){F(L,"sendTransaction","onError","transaction_failure"),P(fs)}};if(W.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),Ht();else{let Qe={transactionRequest:Pe,onSuccess:Qr=>{F(L,"sendTransaction","onSuccess",Qr),v(Qr)},onFailure:Qr=>{F(L,"sendTransaction","onError","transaction_failure"),P(Qr)},uiOptions:p||{},fundWalletConfig:h,requesterAppId:N},fs={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:Qr=>{F(L,"sendTransaction","onError","unknown_connect_wallet_error"),P(Qr)}},ti=gu({address:fe.address,fundWalletConfig:h,chainIdOverride:Pe.chainId,comingFromSendTransactionScreen:!0});te({connectWallet:fs,sendTransaction:Qe,funding:ti}),ae("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function hu(){return new Promise(async(d,p)=>{let h=await we();if(!h||!O)throw new Error("Must have valid access token to enroll in MFA");try{await O.verifyMfa({accessToken:h}),d()}catch(v){p(v)}})}let yu=d=>d?.linkedAccounts.filter(p=>p.latestVerifiedAt!==null&&!(p.type==="wallet"&&p.walletClientType==="privy")).sort((p,h)=>h.latestVerifiedAt.getTime()-p.latestVerifiedAt.getTime())[0],Bt=d=>{let p=s?.linkedAccounts.filter(P=>P.type===d).length??0,{displayName:h,loginMethod:v}=nn(d);if(d==="passkey"&&p>=5||d!=="passkey"&&p>=1)throw F(L,"linkAccount","onError","cannot_link_more_of_type",{linkMethod:v}),new w(`User already has an account of type ${h} linked.`)},MC=()=>{if(!W.loginConfig.telegramAuthConfiguration?.linkEnabled)throw F(L,"linkAccount","onError","cannot_link_more_of_type",{linkMethod:"telegram"}),new w("User can't link an account because Telegram linking is disabled.")},gu=({address:d,fundWalletConfig:p,methodScreen:h,chainIdOverride:v=null,comingFromSendTransactionScreen:P=!1})=>{if(!W.fundingConfig||W.fundingConfig.methods.length===0)return;let N=fc(p)&&p.amount?p.amount:W.fundingConfig.defaultRecommendedAmount,$=fc(p)&&p.chain?p.chain.id:Gi(W.fundingConfig.defaultRecommendedCurrency.chain),fe=fc(p)&&p.chain?p.chain:W.chains.find(oe=>oe.id===$);if(v&&W.chains.find(oe=>oe.id===v)&&(fe=W.chains.find(oe=>oe.id===v)),!fe)throw new w("Funding chain is not in PrivyProvider chains list");return{address:d,amount:N,chain:fe,methodScreen:h,comingFromSendTransactionScreen:P,...p1(p)?{moonpayConfigOverride:p.config}:{}}};async function vu({legacySetWalletPasswordFlow:d=!1}){k(null);let p=d?"setWalletPassword":"setWalletRecovery";if(!a||!s)throw F(L,p,"onError","must_be_authenticated"),new Error("User must be authenticated before adding recovery method to Privy wallet");let h=ge(s);if(!h||!O)throw F(L,p,"onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a recovery method");if(An(s))throw new Error("Cannot set user-controlled recovery for user with Solana.");try{await hu()}catch(P){throw F(L,p,"onError","missing_or_invalid_mfa"),P}return new Promise((P,N)=>{Y(!0);let $={onSuccess:Pe=>{F(L,p,"onSuccess","user-passcode",Pe),P(Pe)},onFailure:Pe=>{F(L,p,"onError","user_exited_set_password_flow"),N(Pe)},callAuthOnSuccessOnClose:!1},fe=h.recoveryMethod==="user-passcode",Ze={onCompleteNavigateTo:Nl({walletAction:"update",availableRecoveryMethods:W.embeddedWallets.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:d,isResettingPassword:fe}),shouldForceMFA:!1,onFailure:Pe=>{F(L,p,"onError","unknown_connect_wallet_error"),N(Pe)}};te({setWalletPassword:$,createWallet:$,connectWallet:Ze,recoverySelection:{isInAccountCreateFlow:!1,isResettingPassword:fe}}),ae("EMBEDDED_WALLET_CONNECTING_SCREEN")})}async function ms({appId:d}){ot(`privy:${d}`),G.current=`privy:${d}`,V.current="link";let p=window.open(void 0,void 0,Da({w:440,h:680}));return t.createAnalyticsEvent({eventName:"cross_app_auth_started",payload:{appId:d}}),new Promise(async(h,v)=>{let{name:P,logoUrl:N}=await rc({api:t.api,providerAppId:d,requesterAppId:W.id});te({crossAppAuth:{appId:d,name:P,logoUrl:N,popup:p,onSuccess:h,onError:v}}),ct("CROSS_APP_AUTH_SCREEN")})}let ei={ready:n,authenticated:a,user:s,walletConnectors:t.connectors||null,connectWallet:RC,importWallet:async({privateKey:d})=>{ot("siwe");let[p,h]=await Promise.all([ne.initializeWalletProxy(15e3),we()]);if(p&&h){await p.import({privateKey:d,accessToken:h});let v=await ne.refreshUser(),P=Xs(v);if(!P)throw F(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to import wallet");return F(L,"createWallet","onSuccess",P),P}else throw new w("User is not authenticated")},linkWallet:uu,linkCrossAppAccount:ms,linkEmail:()=>{ot("email"),Bt("email"),G.current="email",V.current="link",ae("LINK_EMAIL_SCREEN")},linkPhone:()=>{ot("sms"),Bt("phone"),G.current="sms",V.current="link",ae("LINK_PHONE_SCREEN")},linkGoogle:async()=>{ot("google"),Bt("google_oauth"),V.current="link",await ne.initLoginWithOAuth("google")},linkTwitter:async()=>{ot("twitter"),Bt("twitter_oauth"),V.current="link",await ne.initLoginWithOAuth("twitter")},linkDiscord:async()=>{ot("discord"),Bt("discord_oauth"),V.current="link",await ne.initLoginWithOAuth("discord")},linkGithub:async()=>{ot("github"),Bt("github_oauth"),V.current="link",await ne.initLoginWithOAuth("github")},linkSpotify:async()=>{ot("spotify"),Bt("spotify_oauth"),V.current="link",await ne.initLoginWithOAuth("spotify")},linkInstagram:async()=>{ot("instagram"),Bt("instagram_oauth"),V.current="link",await ne.initLoginWithOAuth("instagram")},linkTiktok:async()=>{ot("tiktok"),Bt("tiktok_oauth"),V.current="link",await ne.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{ot("linkedin"),Bt("linkedin_oauth"),V.current="link",await ne.initLoginWithOAuth("linkedin")},linkApple:async()=>{ot("apple"),Bt("apple_oauth"),V.current="link",await ne.initLoginWithOAuth("apple")},linkPasskey:async()=>{ot("passkey"),Bt("passkey"),await ne.initLinkWithPasskey(),ae("LINK_PASSKEY_SCREEN")},linkTelegram:async()=>{ot("telegram"),Bt("telegram"),MC(),V.current="link",G.current="telegram",await ne.initLoginWithTelegram(),ae("TELEGRAM_AUTH_SCREEN")},linkFarcaster:async()=>{ot("farcaster"),Bt("farcaster"),await ne.initLoginWithFarcaster(),V.current="link",G.current="farcaster",ae("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(ot("email"),!s?.email)throw new w("User does not have an email linked to their account.");V.current="link",G.current="email",ae("UPDATE_EMAIL_SCREEN")},updatePhone:()=>{if(ot("sms"),!s?.phone)throw new w("User does not have a phone number linked to their account.");V.current="link",G.current="sms",ae("UPDATE_PHONE_SCREEN")},login:async d=>{d&&"target"in d&&d&&(d=void 0);let p="Attempted to log in, but user is already logged in. Use a `link` helper instead.";if(!n){let h=await new Promise(v=>{Te(P=>v.bind(P))});if(Te(null),h){console.warn(p);return}}if(a){console.warn(p);return}V.current="login",te({login:d}),ct("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(d=>{Te(()=>d)}),Te(null)),a){console.warn("User must be unauthenticated to `connectOrCreateWallet`");return}if(m[0]){console.warn("User must have no connected wallets to `connectOrCreateWallet`");return}ct("CONNECT_OR_CREATE")},logout:async()=>{if(s&&t.clearProviderAcccessTokens(s),k(null),await t.logout(),s&&O)try{await O.clearMfa({userId:s.id})}catch{}c(null),l(!1),F(L,"logout","onSuccess"),V.current=null,G.current=null,o(!1),Q.del(sa)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new je;let d=m.find(h=>s.wallet&&h.address===s.wallet.address),p=t.connectors?.walletConnectors.find(h=>h.wallets.find(v=>v.address===d?.address));return!d||!p?new je:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new pu(new Xr(new je));let d=m.find(h=>s.wallet&&h.address===s.wallet.address),p=t.connectors?.walletConnectors.find(h=>h.wallets.find(v=>v.address===d?.address));return!d||!p?new pu(new Xr(new je)):new pu(new Xr(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new Fo(new je);let d=m.find(h=>s.wallet&&h.address===s.wallet.address),p=t.connectors?.walletConnectors.find(h=>h.wallets.find(v=>v.address===d?.address));return!d||!p?new Fo(new je):new Fo(p.proxyProvider)},unlinkWallet:async d=>{let p=await t.unlinkWallet(d);return c(p),p},unlinkEmail:async d=>{let p=await t.unlinkEmail(d);return c(p),p},unlinkPhone:async d=>{let p=await t.unlinkPhone(d);return c(p),p},unlinkGoogle:async d=>{let p=await t.unlinkOAuth("google",d);return c(p),p},unlinkTwitter:async d=>{let p=await t.unlinkOAuth("twitter",d);return c(p),p},unlinkDiscord:async d=>{let p=await t.unlinkOAuth("discord",d);return c(p),p},unlinkGithub:async d=>{let p=await t.unlinkOAuth("github",d);return c(p),p},unlinkSpotify:async d=>{let p=await t.unlinkOAuth("spotify",d);return c(p),p},unlinkInstagram:async d=>{let p=await t.unlinkOAuth("instagram",d);return c(p),p},unlinkTiktok:async d=>{let p=await t.unlinkOAuth("tiktok",d);return c(p),p},unlinkLinkedIn:async d=>{let p=await t.unlinkOAuth("linkedin",d);return c(p),p},unlinkApple:async d=>{let p=await t.unlinkOAuth("apple",d);return c(p),p},unlinkFarcaster:async d=>{let p=await t.unlinkFarcaster(d);return c(p),p},unlinkTelegram:async d=>{let p=await t.unlinkTelegram(d);return c(p),p},unlinkPasskey:async d=>{let p=await t.unlinkPasskey(d);return c(p),p},unlinkCrossAppAccount:async({subject:d})=>{let p=s?.linkedAccounts.find(v=>v.type==="cross_app"&&v.subject===d)?.providerApp;if(!p)throw new w("Invalid subject");t.storeProviderAccessToken(p.id,null);let h=await t.unlinkOAuth(`privy:${p.id}`,d);return c(h),h},setActiveWallet:async d=>{let p=m.find(v=>Oo(v.address)===Oo(d)),h=s?.linkedAccounts.find(v=>v.type==="wallet"&&Oo(v.address)===Oo(d));if(!p||!await p.isConnected())j(d),uu();else if(!p.linked)p.loginOrLink();else{let v=Object.assign({},s);v.wallet=h&&{address:h.address,chainType:h.chainType,chainId:h.chainId,walletClient:h.walletClient,walletClientType:h.walletClientType,connectorType:h.connectorType,imported:h.imported},c(v)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!a||!s)throw F(L,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return mu(s,15e3)},setWalletRecovery:async()=>vu({legacySetWalletPasswordFlow:!1}),setWalletPassword:async()=>vu({legacySetWalletPasswordFlow:!0}),signMessage:(d,p,h)=>new Promise(async(v,P)=>{let{requesterAppId:N}=p||{};if(!a||!s){F(L,"signMessage","onError","must_be_authenticated"),P(new Error("User must be authenticated before signing with a Privy wallet"));return}let $=h?s?.linkedAccounts.find(oe=>oe.type==="wallet"&&oe.walletClientType==="privy"&&Oo(oe.address)===Oo(h)):ge(s);if(!$){F(L,"signMessage","onError","embedded_wallet_not_found"),P(new Error("Must have a Privy wallet before signing"));return}if(typeof d!="string"||d.length<1){F(L,"signMessage","onError","invalid_message"),P(new Error("Message must be a non-empty string"));return}Y(!0);let fe=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let oe=await we();if(!O||!oe)throw new Error("Unable to connect to wallet");if(!await ne.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_started",payload:{walletAddress:$.address,requesterAppId:N}});let{response:Pe}=await O.rpc({accessToken:oe,address:$.address,requesterAppId:N,request:{method:"personal_sign",params:[d,$.address]}}),Ht=Pe.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_completed",payload:{walletAddress:$.address,requesterAppId:N}}),Ht};if(W.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let oe=await fe();F(L,"signMessage","onSuccess",oe),v(oe)}catch(oe){F(L,"signMessage","onError","unable_to_sign"),P(oe??new Ct("Unable to sign message"))}}else{let Pe={method:"personal_sign",data:d,confirmAndSign:fe,onSuccess:Qe=>{F(L,"signMessage","onSuccess",Qe),v(Qe)},onFailure:Qe=>{F(L,"signMessage","onError","unable_to_sign"),P(Qe)},uiOptions:p||{}},Ht={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Qe=>{F(L,"signMessage","onError","unknown_connect_wallet_error"),P(Qe)},address:$.address};te({signMessage:Pe,connectWallet:Ht}),ae("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(d,p)=>new Promise(async(h,v)=>{let{requesterAppId:P}=p||{};if(!a||!s){F(L,"signTypedData","onError","must_be_authenticated"),v(new Error("User must be authenticated before signing with a Privy wallet"));return}let N=ge(s);if(!N){F(L,"signTypedData","onError","embedded_wallet_not_found"),v(new Error("Must have a Privy wallet before signing"));return}Y(!0);let $=na(d),fe=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let oe=await we();if(!O||!oe)throw new Error("Unable to connect to wallet");if(!await ne.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_started",payload:{walletAddress:N.address,requesterAppId:P}});let{response:Pe}=await O.rpc({accessToken:oe,address:N.address,requesterAppId:P,request:{method:"eth_signTypedData_v4",params:[N.address,$]}}),Ht=Pe.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_completed",payload:{walletAddress:N.address,requesterAppId:P}}),Ht};if(W.embeddedWallets.noPromptOnSignature||(W.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let oe=await fe();F(L,"signTypedData","onSuccess",oe),h(oe)}catch(oe){F(L,"signTypedData","onError","unable_to_sign"),v(oe??new Ct("Unable to sign message"))}}else{let Pe={method:"eth_signTypedData_v4",data:$,confirmAndSign:fe,onSuccess:Qe=>{F(L,"signTypedData","onSuccess",Qe),h(Qe)},onFailure:Qe=>{F(L,"signTypedData","onError","unable_to_sign"),v(Qe)},uiOptions:p||{}},Ht={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Qe=>{F(L,"signMessage","onError","unknown_connect_wallet_error"),v(Qe)}};te({signMessage:Pe,connectWallet:Ht}),ae("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(d,p,h)=>{let P=await(await fu(d,p,h)).wait();return Xl(P)},exportWallet:()=>new Promise(async(d,p)=>{if(!a||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}if(!ge(s)){p(new Error("Must have a Privy wallet before exporting"));return}Y(!0);let v={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p,shouldForceMFA:!0};if(te(X),!await we()||!O){p(new Error("Must have valid access token to enroll in MFA"));return}if(!O){p(new Error("Must have a Privy wallet before exporting"));return}let N={appId:e.appId,appClientId:e.clientId,origin:t.apiUrl,onSuccess:d,onFailure:p};te({keyExport:N,connectWallet:v}),ae("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:hu,async init(d){switch(d){case"sms":await t.initMfaSmsVerification();return;case"passkey":return await t.initMfaPasskeyVerification();case"totp":return;default:throw new Error(`Unsupported MFA method: ${d}`)}},async submit(d,p){switch(d){case"totp":case"sms":if(typeof p!="string")throw new w("Invalid MFA code");Wr.current?.resolve({mfaMethod:d,mfaCode:p,relyingParty:window.origin}),await new Promise((N,$)=>{Zr.current={resolve:N,reject:$}});break;case"passkey":if(typeof p=="string")throw new w("Invalid authenticator response");let v=await(await import("@simplewebauthn/browser")).startAuthentication(p),P=uC(v);Wr.current?.resolve({mfaMethod:d,mfaCode:P,relyingParty:window.origin}),await new Promise((N,$)=>{Zr.current={resolve:N,reject:$}});break;default:throw Wr.current?.reject(new w("Unsupported MFA method")),new w(`Unsupported MFA method: ${d}`)}},cancel(){Wr.current?.reject(new w("MFA canceled"))},async initEnrollmentWithSms(d){let p=await we();if(!p||!O)throw new Error("Must have valid access token to enroll in MFA");await O.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber})},enrollInMfa(d){return new Promise((p,h)=>{if(!d){ne.closePrivyModal(),p();return}W.mfa.noPromptOnMfaRequired&&console.warn("[Privy Warning] Triggering the 'showMfaEnrollmentModal' function when 'noPromptOnMfaRequired' is set to true is unexpected. If this is intentional, ensure that you are building custom UIs for MFA verification."),te({mfaEnrollmentFlow:{mfaMethods:W.mfa.methods,onSuccess:p,onFailure:h}}),ae("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let d=await we();if(!d||!O)throw new Error("Must have valid access token to enroll in MFA");let p=await O.initEnrollMfa({method:"totp",accessToken:d});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(d){let p=await we();if(!p||!O)throw new Error("Must have valid access token to enroll in MFA");await O.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber,code:d.mfaCode});let h=await t.getAuthenticatedUser();c(h)},async submitEnrollmentWithTotp(d){let p=await we();if(!p||!O)throw new Error("Must have valid access token to enroll in MFA");await O.submitEnrollMfa({method:"totp",accessToken:p,code:d.mfaCode});let h=await t.getAuthenticatedUser();c(h)},async initEnrollmentWithPasskey(){},async submitEnrollmentWithPasskey({credentialIds:d}){let p=await we();if(!p||!O)throw new Error("Must have valid access token to enroll in MFA");await O.submitEnrollMfa({method:"passkey",accessToken:p,credentialIds:d});let h=await t.getAuthenticatedUser();c(h)},async unenroll(d){let p=await we();if(!p||!O)throw new Error("Must have valid access token to remove MFA");d==="passkey"?await O.submitEnrollMfa({method:"passkey",accessToken:p,credentialIds:[]}):await O.unenrollMfa({method:d,accessToken:p});let h=await t.getAuthenticatedUser();c(h)},requestFarcasterSignerFromWarpcast:async()=>{let d=await we(),p=s?.linkedAccounts.find(P=>P.type==="wallet"&&P.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!O||!p)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await ne.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");let v=await O.initFarcasterSigner({address:p.address,hdWalletIndex:null,accessToken:d,mfaCode:null,mfaMethod:null,relyingParty:window.origin});if(v.status==="approved"){let P=await t.getAuthenticatedUser();c(P||s||null)}te({farcasterSigner:v}),ae("AWAITING_FARCASTER_SIGNER")},getFarcasterSignerPublicKey:async()=>{let d=await we(),p=s?.linkedAccounts.find(P=>P.type==="wallet"&&P.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!O||!p)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await ne.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");if(!s.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster signer public key to sign");return(P=>Uint8Array.from(P.match(/.{1,2}/g).map(N=>parseInt(N,16))))(s.farcaster.signerPublicKey.slice(2))},signFarcasterMessage:async d=>{let p=await we(),h=s?.linkedAccounts.find($=>$.type==="wallet"&&$.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!O||!h)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await ne.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");if(!s.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster signer public key to sign");let P=await import("@simplewebauthn/browser"),N=await O.signFarcasterMessage({address:h.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{hash:P.bufferToBase64URLString(d)},fid:BigInt(s.farcaster.fid),relyingParty:window.origin});return new Uint8Array(P.base64URLStringToBuffer(N.signature))},isHeadlessOAuthLoading:S,loginWithCode(d){return ne.loginWithCode(d)},initLoginWithEmail(d){return ne.initLoginWithEmail(d)},initLoginWithSms(d){return ne.initLoginWithSms(d)},otpState:D,fundWallet(d,p){return ne.fundWallet(d,p)},initLoginWithHeadlessOAuth(d,p){return ne.initLoginWithHeadlessOAuth(d,p)},loginWithHeadlessOAuth(d){return ne.loginWithHeadlessOAuth(d)},generateSiweMessage({address:d,chainId:p}){return ne.generateSiweMessage({address:d,chainId:p})},linkWithSiwe({message:d,signature:p,chainId:h,walletClientType:v,connectorType:P}){return ot("siwe"),ne.linkWithSiwe({message:d,signature:p,chainId:h,walletClientType:v,connectorType:P})},signMessageWithCrossAppWallet(d,{address:p}){return oc({user:s,client:t,address:p,requesterAppId:W.id,request:{method:"personal_sign",params:[d,p]},reconnect:ms})},signTypedDataWithCrossAppWallet(d,{address:p}){let h=na(d);return oc({user:s,client:t,address:p,requesterAppId:W.id,request:{method:"eth_signTypedData_v4",params:[p,h]},reconnect:ms})},sendTransactionWithCrossAppWallet(d,{address:p}){return oc({user:s,client:t,address:p,requesterAppId:W.id,request:{method:"eth_sendTransaction",params:[d]},reconnect:ms})},isModalOpen:r,mfaMethods:W.mfa.methods};fC=ei.signMessage,hC=ei.signTypedData,yC=async(...d)=>{let p=await fu(...d);return W.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let ne=(()=>({isNewUserThisSession:y,linkingOrConnectingHint:K,pendingTransaction:null,walletConnectionStatus:R,connectors:t.connectors?.walletConnectors??[],rpcConfig:W.rpcConfig,chains:W.chains,appId:e.appId,showFiatPrices:W.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:d=>W.chains.find(p=>p.id===Number(d))?.nativeCurrency.symbol,initializeWalletProxy:async d=>{if(O)return O;let p=new Promise(P=>{Ge(()=>N=>P(N))}),h=new Promise(P=>setTimeout(()=>P(null),d)),v=await Promise.race([p,h]);return Ge(null),v},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:async(d={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let p=n&&a&&s,h;if(p&&G.current&&(h=yu(s)),V.current==="login"?d.shouldCallAuthOnSuccess&&p&&G.current?(F(L,"login","onComplete",s,y,!1,G.current,h??null),e.onSuccess?.(s,y)):F(L,"login","onError","exited_auth_flow"):V.current==="link"&&h&&(d.isSuccess&&p&&G.current?F(L,"linkAccount","onSuccess",s,G.current,h):G.current&&F(L,"linkAccount","onError","exited_link_flow",{linkMethod:G.current})),T&&pv.includes(T)&&X.funding){let v=uv[T]??null,P=Gt(X.funding.chain.id,W.chains,W.rpcConfig,{appId:e.appId}),N;try{N=(await P.getBalance(X.funding.address)).toBigInt()}catch{console.error("Unable to pull wallet balance")}F(L,"fundWallet","onUserExited",{address:X.funding.address,chain:X.funding.chain,fundingMethod:v,balance:N})}j(null),V.current=null,G.current=null,b(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent({eventName:"modal_closed"})},solanaSignMessage:async({message:d})=>new Promise(async(p,h)=>{let v=async()=>{let P=await t.getAccessToken();if(!P)throw new Error("User must be authenticated to use their embedded wallet.");if(!u)throw new Error("User must have an embedded Solana wallet to sign messages for Solana.");let N=ne.walletProxy??await ne.initializeWalletProxy(15e3);if(!N)throw new Error("Failed to initialize embedded wallet proxy.");let{response:$}=await N.rpcSolana({accessToken:P,publicKey:u.address,request:{method:"signMessage",params:{message:d}}});return $.data.signature};if(W.embeddedWallets.noPromptOnSignature)try{let P=await v();p({signature:P})}catch(P){h(P)}else te({signMessage:{method:"solana_signMessage",data:d,confirmAndSign:v,onSuccess:fe=>{p({signature:fe})},onFailure:fe=>{h(fe)},uiOptions:{}}}),ct("EMBEDDED_WALLET_SIGN_REQUEST_SCREEN")}),openPrivyModal:ae,connectWallet:id,initLoginWithWallet:async(d,p)=>{G.current="siwe",ps(d,p)},loginWithWallet:async()=>{if(!n)throw new bo;if(!(t.authFlow instanceof To))throw new w("Must initialize SIWE flow first.");let d,p;if(a)try{({user:d}=await t.link()),G.current="siwe"}catch(h){throw F(L,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account",{linkMethod:"siwe"}),h}else try{({user:d,isNewUser:p}=await t.authenticate()),G.current="siwe"}catch(h){throw F(L,"login","onError",h.privyErrorCode||"generic_connect_wallet_error"),h}c(d||s||null),b(p||!1),l(!0)},initLoginWithFarcaster:async d=>{let p=new ia(d);t.startAuthFlow(p);try{G.current="farcaster",await p.initializeFarcasterConnect()}catch(h){throw V.current==="login"?F(L,"login","onError",h.privyErrorCode||"unknown_auth_error"):V.current==="link"&&F(L,"linkAccount","onError",h.privyErrorCode||"unknown_auth_error",{linkMethod:"farcaster"}),h}},loginWithFarcaster:async()=>{if(!n)throw new bo;if(!(t.authFlow instanceof ia))throw new w("Must initialize Farcaster flow first.");let d,p;if(a)try{({user:d}=await t.link()),G.current="farcaster"}catch(h){throw F(L,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account",{linkMethod:"farcaster"}),h}else try{({user:d,isNewUser:p}=await t.authenticate()),G.current="farcaster"}catch(h){throw F(L,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}c(d||null),b(p||!1),l(!0)},async crossAppAuthFlow({appId:d,popup:p}){let h=`privy:${d}`;G.current=h;let{url:v,stateCode:P,codeVerifier:N}=await Ag({api:t.api,appId:d});if(!v)throw t.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:"Unable to open cross-app auth popup",appId:d}}),new w("No authorization URL returned for cross-app auth.");try{let $=await pC({url:v,popup:p,provider:h}),fe=$.stateCode,oe=$.authorizationCode;if(fe!==P)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:h,storedStateCode:P??"",returnedStateCode:fe??""}}),new w("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected");let Ze=await xg({api:wo.api,appId:d,codeVerifier:N,stateCode:fe,authorizationCode:oe});Ze&&t.storeProviderAccessToken(d,Ze);let Pe=await ne.refreshUser();if(!Pe)throw new w("Unable to update user");return t.createAnalyticsEvent({eventName:"cross_app_auth_completed",payload:{appId:d}}),Pe}catch($){throw t.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:$.toString(),provider:h}}),$}},async initLoginWithOAuth(d,p){if(G.current=d,cd()){if(d==="google"&&Ai(window.navigator.userAgent)){ct("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{ct("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}d==="twitter"&&window.opener&&window.opener.postMessage({type:"PRIVY_OAUTH_USE_BROADCAST_CHANNEL"},"*"),Q.del(En);let h=new Jr({provider:d});p&&h.addCaptchaToken(p),t.startAuthFlow(h);let v=await t.authFlow.getAuthorizationUrl();v&&v.url&&(d==="twitter"&&h_&&(v.url=v.url.replace("x.com","twitter.com")),window.location.assign(v.url))},async initLoginWithTelegram(d){if(!n)throw new bo;G.current="telegram";let p=new si(d);t.startAuthFlow(p),p.meta.telegramWebAppData=void 0,p.meta.telegramAuthResult=await new Promise((h,v)=>{if(!W.loginConfig.telegramAuthConfiguration)return v(new w("Telegram Auth configuration is not loaded"));if(!window.Telegram)return v(new w("Telegram was not initialized"));window.Telegram.Login.auth({bot_id:W.loginConfig.telegramAuthConfiguration.botId,request_access:!0},P=>P?h(P):v(new w("Telegram auth failed or was canceled by the client")))})},async loginWithTelegram(){if(!(t.authFlow instanceof si))throw new w("Must initialize Telegram flow before calling loginWithTelegram");let d,p;if(a)try{({user:d}=await t.link()),G.current="telegram"}catch(h){throw F(L,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account",{linkMethod:"telegram"}),h}else try{let h=await t.authenticate();d=h.user,p=h.isNewUser,G.current="telegram"}catch(h){throw V.current==="login"?F(L,"login","onError",h.privyErrorCode||"unknown_auth_error"):V.current==="link"&&F(L,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account",{linkMethod:"telegram"}),h}c(d),b(p||!1),l(!0)},async recoveryOAuthFlow(d,p,h){let v,P;function N($){if(!$)throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:"Unable to open recovery OAuth popup",provider:d}}),new w("Recovery OAuth failed")}switch(d){case"google-drive":{let{url:$,codeVerifier:fe,stateCode:oe}=await ip({api:wo.api,provider:d});N($);let Ze,Pe;try{let Ht=await du({url:$,popup:h,provider:d});if(Ze=Ht.stateCode,Pe=Ht.authorizationCode,Ze!==oe)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d,storedStateCode:oe??"",returnedStateCode:Ze??""}}),new w("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected")}catch(Ht){throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:Ht.toString(),provider:d}}),new w("Recovery OAuth failed")}[v,P]=await Promise.all([we(),hy({api:wo.api,provider:d,codeVerifier:fe,stateCode:Ze,authorizationCode:Pe})]);break}case"icloud":{let{url:$}=await ip({api:wo.api,provider:d});N($);let{ckWebAuthToken:fe}=await du({url:$,popup:h,provider:d});P=fe,v=await we();break}}if(!O)throw new w("Cannot connect to wallet proxy");if(!v)throw new w("Unable to authorize user");switch(p){case"recover":let $=X.recoverWallet?.privyWallet?.address;if(!$)throw new w("Recovery OAuth failed");t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:$,recoveryMethod:d}}),await O.recover({address:$,accessToken:v,recoveryAccessToken:P,recoveryMethod:d}),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:$,recoveryMethod:d}});break;case"create-wallet":t.createAnalyticsEvent({eventName:"embedded_wallet_creation_started"}),await O.create({accessToken:v,recoveryAccessToken:P,recoveryMethod:d});let fe=await ne.refreshUser(),oe=ge(fe);if(!oe)throw F(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:oe.address}}),F(L,"createWallet","onSuccess",oe);break;case"set-recovery":let Ze=ge(s);if(!Ze)throw F(L,"setWalletRecovery","onError","embedded_wallet_not_found"),new Error("Embedded wallet not found");t.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_started",payload:{recoveryMethod:d}}),await O.setRecovery({address:Ze.address,accessToken:v,recoveryAccessToken:P,recoveryMethod:d});let Pe=ge(await ne.refreshUser());if(!Pe)throw F(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to set recovery on wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:Ze.address,recoveryMethod:d}}),F(L,"setWalletRecovery","onSuccess",d,Pe);break;default:throw new w("Unsupported recovery action")}},async loginWithOAuth(d){if(!(t.authFlow instanceof Jr))throw new w("Must initialize OAuth flow before calling loginWithOAuth");let p=Q.get(wn),h=t.authFlow.meta.stateCode;if(p!==h)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d,storedStateCode:p??"",returnedStateCode:h??""}}),new w("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected");let v,P,N;if(a)try{let $=await t.link();v=$.user,N=$.oAuthTokens,G.current=d}catch($){throw F(L,"linkAccount","onError",$.privyErrorCode||"failed_to_link_account",{linkMethod:d}),$}else try{let $=await t.authenticate();v=$.user,P=$.isNewUser,N=$.oAuthTokens,G.current=d}catch($){throw V.current==="login"?F(L,"login","onError",$.privyErrorCode||"unknown_auth_error"):V.current==="link"&&F(L,"linkAccount","onError",$.privyErrorCode||"failed_to_link_account",{linkMethod:d}),$}return c(v),b(P||!1),l(!0),N&&v&&F(L,"oAuthAuthorization","onOAuthTokenGrant",N,{user:v}),N},async initLoginWithPasskey(d){let p=new Pn(d);t.startAuthFlow(p),V.current="login";try{G.current="passkey",await p.initAuthenticationFlow()}catch(h){throw F(L,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}},async loginWithPasskey(){if(!n)throw new bo;if(!(t.authFlow instanceof Pn))throw new w("Must initialize Passkey flow first.");if(G.current!=="passkey")throw new w("Must init login with Passkey flow first.");let d,p;try{G.current="passkey",{user:d,isNewUser:p}=await t.authenticate()}catch(h){throw F(L,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}c(d),b(p||!1),l(!0)},async initLinkWithPasskey(d){let p=new Pn(d);t.startAuthFlow(p),V.current="link",G.current="passkey";try{await p.initLinkFlow()}catch(h){throw F(L,"linkAccount","onError",h.privyErrorCode||"unknown_auth_error",{linkMethod:"passkey"}),h}},async linkWithPasskey(){if(!n)throw new bo;if(!(t.authFlow instanceof Pn))throw new w("Must initialize Passkey flow first.");if(G.current!=="passkey")throw new w("Must init login with Passkey flow first.");let d;try{G.current="passkey",{user:d}=await t.link()}catch(p){throw F(L,"linkAccount","onError",p.privyErrorCode||"failed_to_link_account",{linkMethod:"passkey"}),p}return c(d||s||null),d},async initLoginWithHeadlessOAuth(d,p){if(cd()){if(d==="google"&&Ai(window.navigator.userAgent))throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.")}else throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.");let h=new Jr({provider:d,headless:!0});p&&h.addCaptchaToken(p);let v=await t.startAuthFlow(h).getAuthorizationUrl();v?.url&&window.location.assign(v.url)},async loginWithHeadlessOAuth(d){x(!0),t.startAuthFlow(new Jr(d));let p=Q.get(wn),h=d.stateCode;if(p!==h)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d.provider,storedStateCode:p??"",returnedStateCode:h??""}}),x(!1),new w("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected");let v,P;if(a)try{({user:v}=await t.link()),G.current=d.provider}catch(N){throw F(L,"linkAccount","onError",N.privyErrorCode||"failed_to_link_account",{linkMethod:d.provider}),N}else try{({user:v,isNewUser:P}=await t.authenticate()),G.current=d.provider}catch(N){throw V.current==="login"?F(L,"login","onError",N.privyErrorCode||"unknown_auth_error"):V.current==="link"&&F(L,"linkAccount","onError",N.privyErrorCode||"failed_to_link_account",{linkMethod:d.provider}),N}return c(v),b(P||!1),l(!0),x(!1),v??void 0},initLoginWithEmail:async(d,p)=>{let h=new Lo(d,p);t.startAuthFlow(h);try{G.current="email",await h.sendCodeEmail()}catch(v){throw V.current==="login"?F(L,"login","onError",v.privyErrorCode||"unknown_auth_error"):V.current==="link"&&F(L,"linkAccount","onError",v.privyErrorCode||"failed_to_link_account",{linkMethod:"email"}),v}},initUpdateEmail:async(d,p,h)=>{let v=new Ss(d,p,h);t.startAuthFlow(v),await v.sendCodeEmail()},initUpdatePhone:async(d,p,h)=>{let v=new Js(d,p,h);t.startAuthFlow(v),await v.sendSmsCode()},initLoginWithSms:async(d,p)=>{H({status:"sending-code"});let h=new Do(d,p);t.startAuthFlow(h);try{G.current="sms",await h.sendSmsCode(),H({status:"awaiting-code-input"})}catch(v){throw H({status:"error",error:v}),V.current==="login"?F(L,"login","onError",v.privyErrorCode||"unknown_auth_error"):V.current==="link"&&F(L,"linkAccount","onError",v.privyErrorCode||"failed_to_link_account",{linkMethod:"sms"}),v}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async d=>{if(H({status:"submitting-code"}),!n){let v=new bo;throw H({status:"error",error:v}),v}if(t.authFlow instanceof Lo)t.authFlow.meta.emailCode=d.trim();else if(t.authFlow instanceof Do)t.authFlow.meta.smsCode=d.trim();else{let v=new w("Must initialize a passwordless code flow first");throw H({status:"error",error:v}),v}await we();let p,h;if(V.current==="link")try{({user:p}=await t.link())}catch(v){throw H({status:"error",error:v}),F(L,"linkAccount","onError",v.privyErrorCode||"failed_to_link_account",{linkMethod:G.current}),v}else try{({user:p,isNewUser:h}=await t.authenticate())}catch(v){throw H({status:"error",error:v}),F(L,"login","onError",v.privyErrorCode||"unknown_auth_error"),v}c(p||s||null),b(h||!1),l(!0),H({status:"done"})},generateSiweMessage:async({address:d,chainId:p,captchaToken:h})=>{V.current="link",G.current="siwe";let v=await t.generateSiweNonce({address:d,captchaToken:h}),P=p.replace("eip155:","");return Qs({address:d,chainId:P,nonce:v})},linkWithSiwe:async({message:d,signature:p,chainId:h,walletClientType:v,connectorType:P})=>{let N;try{if(V.current!=="link"||G.current!=="siwe")throw new w("Must ensure no other auth flow is in progress other than the SIWE signature flow.");N=await t.linkWithSiwe({message:d,signature:p,chainId:h,walletClientType:v,connectorType:P}),N=await ne.refreshUser()??N;let $=yu(N);$&&F(L,"linkAccount","onSuccess",N,"siwe",$)}catch($){throw F(L,"linkAccount","onError",$.privyErrorCode||"failed_to_link_account",{linkMethod:"siwe"}),V.current=null,G.current=null,$}c(N||s||null),V.current=null,G.current=null},refreshUser:async()=>{let d=await t.getAuthenticatedUser();return c(d),d},walletProxy:O,createAnalyticsEvent:({eventName:d,payload:p,timestamp:h})=>t.createAnalyticsEvent({eventName:d,payload:p,timestamp:h}),acceptTerms:async()=>{let d=await t.acceptTerms();return c(d),d},getUsdTokenPrice:d=>t.getUsdTokenPrice(d),recoverEmbeddedEthereumWallet:async()=>new Promise(async(d,p)=>{let h=ge(s)||Xs(s),v=await we();if(!v||!O||!h){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}Y(!0);try{await O.connect({accessToken:v,address:h.address}),d(!0)}catch(P){if(Dn(P)&&h.recoveryMethod==="privy")t.createAnalyticsEvent({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:h.address}}),(await O.recover({address:h.address,accessToken:v,recoveryMethod:h.recoveryMethod})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:h.address}}),d(!0);else if(Dn(P)&&h.recoveryMethod!=="privy"){te({recoverWallet:{privyWallet:h,onFailure:p,onSuccess:()=>d(!0)},recoveryOAuthStatus:{provider:h.recoveryMethod,action:"recover"}});let N=Dl(h.recoveryMethod);ae(N)}else p(P)}}),embeddedSolanaWallet:u,createEmbeddedSolanaWallet:async()=>{Y(!0);let d=await we(),p=An(s),h=ge(s);if(!s||!d)throw new w("User must be logged in to create a Solana wallet");if(p)throw new w("User already has an embedded Solana wallet.");if(h)if(h.recoveryMethod==="privy")await ne.recoverEmbeddedEthereumWallet();else throw new w("Cannot create an embedded Solana wallet for a user with an existing Ethereum wallet with user-controlled recovery.");let v=await ne.initializeWalletProxy(15e3);if(!v)throw new w("Unable to initialize wallet proxy");t.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_started"});try{await v.createSolana({accessToken:d,ethereumAddress:h?.address});let P=await ne.refreshUser(),N=An(P);if(!N)throw new w("Could not get Solana wallet for user");return t.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_completed",payload:{walletAddress:N.address}}),N}catch(P){throw t.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_failed"}),new w("Failed to create Solana embedded wallet with error ",P)}},recoverEmbeddedSolanaWallet:async()=>new Promise(async(d,p)=>{let h=An(s),v=await we();if(!v||!O||!h){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}Y(!0);try{await O.connectSolana({accessToken:v,publicKey:h.address}),d(!0)}catch(P){Dn(P)&&h.recoveryMethod==="privy"?(t.createAnalyticsEvent({eventName:"embedded_solana_wallet_pinless_recovery_started",payload:{walletAddress:h.address}}),(await O.recoverSolana({publicKey:h.address,accessToken:v})).publicKey||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent({eventName:"embedded_solana_wallet_recovery_completed",payload:{walletAddress:h.address}}),d(!0)):p(P)}}),getMoonpaySignedUrl:kC,initCoinbaseOnRamp:t.initCoinbaseOnRamp.bind(t),getCoinbaseOnRampStatus:t.getCoinbaseOnRampStatus.bind(t),setReadyToTrue:d=>{i(!0),_e?.(d)},updateWallets:()=>us(),fundWallet:async(d,p)=>{if(!W.fundingConfig||W.fundingConfig.methods.length===0)throw new Error("Wallet funding is not enabled");let h=Jc({fundingMethods:W.fundingConfig.methods});te({funding:gu({address:d,fundWalletConfig:p,methodScreen:h})}),ae(h)},requestFarcasterSignerStatus:async d=>{let p=await we(),h=s?.linkedAccounts.find(P=>P.type==="wallet"&&P.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!O||!h)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");let v=await t.requestFarcasterSignerStatus(d);if(v.status==="approved"){let P=await t.getAuthenticatedUser();c(P||s||null)}return v}}))();gC=ne.recoverEmbeddedEthereumWallet,vC=ne.recoverEmbeddedSolanaWallet,CC=ne.solanaSignMessage;let WC=f_(()=>({wallets:m,ready:mt&&rt}),[m,mt,rt]);return br(Se.Provider,{value:ei,children:br(Ld.Provider,{value:L,children:br(Ep.Provider,{value:WC,children:br(eh,{...W,children:mC(Od.Provider,{value:ne,children:[br(Zh,{children:mC(Kf,{data:X,setModalData:te,setInitialScreen:k,initialScreen:T,authenticated:a,open:r,children:[e.children,!W.headless&&W.captchaEnabled&&n&&!a&&br(Wd,{delayedExecution:!1}),br(jv,{theme:{...W.appearance.palette||{}}}),!W.render.standalone&&br(lu,{open:r})]})}),Ie&&Ce?br(lC,{appId:e.appId,appClientId:e.clientId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:Wr,mfaSubmitPromise:Zr,onLoad:U,onLoadFailed:()=>null}):null,W.loginMethods.telegram&&W.loginConfig.telegramAuthConfiguration&&br(Fr,{if:!0,children:br(iC,{scriptHost:e.apiUrl||Ws,botUsername:W.loginConfig.telegramAuthConfiguration.botName})})]})})})})})};import{useContext as T_}from"react";function S_(e){let{login:t}=T_(Se);return Ae("login",e),{login:t}}import{useContext as __}from"react";function P_(e){let{logout:t}=__(Se);return Ae("logout",e),{logout:t}}import{useCallback as wC,useEffect as A_}from"react";function x_(){let e=be(),t=al(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:i,user:a}=q(),l=wC(async c=>{if(e.enabled&&e.status!=="success")throw new ir(e.error,null,"captcha_failure");return r(c.provider,e.token)},[r,e]),s=wC(async()=>{let c=pa();if(a)return console.warn("Cannot login with OAuth when already logged in"),a;if(!c.inProgress)throw new Error("Cannot login with OAuth because no OAuth flow is in progress");if(!c.popupFlow)try{return await o(c)}catch(m){throw m}finally{_n()}},[o]);return A_(()=>{let c=pa();i&&t&&c.inProgress&&c.headless&&!c.popupFlow&&s()},[i,t]),{initOAuth:l,loginWithOAuth:s,loading:n}}import{useCallback as bC}from"react";var k_=()=>{let e=be(),{initLoginWithEmail:t,loginWithCode:r}=q(),o=bC(async({email:i})=>{if(!i)throw new Error("Email required to send OTP code");return t(i)},[t]),n=bC(async({code:i})=>{if(e.enabled&&e.status==="error")throw new ir(e.error,null,"captcha_failure");return r(i)},[r,e.status]);return{sendCode:o,loginWithCode:n}};import{useCallback as EC}from"react";var R_=()=>{let e=be(),{initLoginWithSms:t,loginWithCode:r,otpState:o}=q(),n=EC(async({phoneNumber:a})=>{if(!a)throw new Error("SMS required to send OTP code");return t(a)},[t]),i=EC(async({code:a})=>{if(e.enabled&&e.status!=="success")throw new ir(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:n,loginWithCode:i,state:o}};import{useCallback as TC}from"react";var I_=()=>{let e=be(),{generateSiweMessage:t,linkWithSiwe:r}=q(),o=TC(async({address:i,chainId:a})=>{if(!i||!a)throw new Error("wallet address and chainId required to generate nonce");return t({address:i,chainId:a}).then(l=>l)},[t]),n=TC(async({signature:i,message:a,chainId:l,walletClientType:s,connectorType:c})=>{if(e.enabled&&e.status!=="success")throw new ir(e.error,null,"captcha_failure");return r({message:a,signature:i,chainId:l,walletClientType:s,connectorType:c})},[r,e.status]);return{generateSiweMessage:o,linkWithSiwe:n}};import{useContext as M_}from"react";function W_(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:a,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:m,linkSpotify:f,linkInstagram:u,linkTelegram:C,linkFarcaster:g}=M_(Se);return Ae("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:a,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:m,linkSpotify:f,linkInstagram:u,linkFarcaster:g,linkTelegram:C}}import{useContext as O_}from"react";function L_(e){let{connectWallet:t}=O_(Se);return Ae("connectWallet",e),{connectWallet:t}}import{useContext as N_}from"react";function D_(e){let{createWallet:t}=N_(Se);return Ae("createWallet",e),{createWallet:t}}var U_=e=>{Ae("fundWallet",e);let{fundWallet:t}=q();return{fundWallet:t}};var F_=()=>{let{embeddedSolanaWallet:e,createEmbeddedSolanaWallet:t}=M();return{createWallet:t,wallets:e?[e]:[]}};var B_=()=>{let{linkCrossAppAccount:e,unlinkCrossAppAccount:t,signMessageWithCrossAppWallet:r,signTypedDataWithCrossAppWallet:o,sendTransactionWithCrossAppWallet:n}=q();return{linkCrossAppAccount:e,unlinkCrossAppAccount:t,signMessage:r,signTypedData:o,sendTransaction:n}};import{useContext as H_}from"react";function G_(e){let{sendTransaction:t}=H_(Se);return Ae("sendTransaction",e),{sendTransaction:t}}import{useContext as V_}from"react";function q_(e){let{setWalletPassword:t}=V_(Se);return Ae("setWalletPassword",e),{setWalletPassword:t}}import{useContext as z_}from"react";function $_(e){let{setWalletRecovery:t}=z_(Se);return Ae("setWalletRecovery",e),{setWalletRecovery:t}}import{useContext as K_}from"react";function j_(e){let{signMessage:t}=K_(Se);return Ae("signMessage",e),{signMessage:t}}import{useContext as Y_}from"react";function Z_(e){let{signTypedData:t}=Y_(Se);return Ae("signTypedData",e),{signTypedData:t}}import{useContext as Q_}from"react";var J_=()=>{let{isModalOpen:e}=Q_(Se);return{isOpen:e}};import{useContext as X_}from"react";function eP(e){let{getAccessToken:t}=X_(Se);return Ae("accessToken",e),{getAccessToken:t}}function tP(e){let{authenticated:t,user:r}=q(),{initLoginWithOAuth:o}=M(),n=gi();return Ae("oAuthAuthorization",e),{reauthorize:i=>rP(t,r,o,n,i.provider)}}var rP=async(e,t,r,o,n)=>{if(!e)throw o("linkAccount","onError","must_be_authenticated",{linkMethod:n}),new w("User must be authenticated before linking an account.");if(!t?.linkedAccounts.some(a=>a.type.includes(n)))throw new w(`OAuth account of type ${n} not linked to the account.`);await r(n)};var oP=SC;function SC(){let{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}=q();return{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}}function nP(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}function iP(e){return e.find(r=>r.walletClientType==="privy"&&r.connectorType==="embedded"&&!r.imported)??null}export{Xr as AsExternalProvider,Wd as Captcha,ya as ConnectorManager,lu as LoginModal,ga as PrivyClient,b_ as PrivyProvider,je as PrivyProxyProvider,fa as SUPPORTED_CHAINS,fd as VERSION,$t as WalletConnector,nP as addRpcUrlOverrideToChain,op as errorIndicatesMaxMfaRetries,Un as errorIndicatesMfaTimeout,Fn as errorIndicatesMfaVerificationFailed,we as getAccessToken,iP as getEmbeddedConnectedWallet,L_ as useConnectWallet,D_ as useCreateWallet,B_ as useCrossAppAccounts,oP as useExperimentalFarcasterSigner,SC as useFarcasterSigner,U_ as useFundWallet,W_ as useLinkAccount,I_ as useLinkWithSiwe,S_ as useLogin,k_ as useLoginWithEmail,x_ as useLoginWithOAuth,R_ as useLoginWithSms,P_ as useLogout,ja as useMfa,$r as useMfaEnrollment,J_ as useModalStatus,tP as useOAuthTokens,q as usePrivy,Nd as useRegisterMfaListener,G_ as useSendTransaction,q_ as useSetWalletPassword,$_ as useSetWalletRecovery,j_ as useSignMessage,Z_ as useSignTypedData,F_ as useSolanaWallets,eP as useToken,zr as useWallets};