@privy-io/react-auth 1.70.0 → 1.71.0-beta-20240611222124

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,7 +1,7 @@
1
- var wc=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var Mp=(e,t,r)=>(wc(e,t,"read from private field"),r?r.call(e):t.get(e)),Ba=(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)},bc=(e,t,r,o)=>(wc(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var Wp=(e,t,r)=>(wc(e,t,"access private method"),r);import{getAddress as Pi}from"@ethersproject/address";import{Web3Provider as xp}from"@ethersproject/providers";import{createStore as pE}from"mipd";import{useEffect as Or,useMemo as uE,useRef as Si,useState as Xe}from"react";import{isAndroid as mE}from"react-device-detect";import{FetchError as x2}from"ofetch";var $e=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}]`:""}`}},wr=class extends $e{constructor(r,o,n,i,a){super(n,i,a);this.type=r;this.status=o}},b=class extends $e{constructor(r,o,n){super(r,o,n);this.type="client_error"}},Ha=class extends b{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var te=class extends $e{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},ne=e=>{if(e instanceof $e)return e;if(!(e instanceof x2))return pt(e);if(!e.response)return new wr("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new wr(t||"ApiError",e.response.status,r||o,e,n)},pt=e=>e instanceof $e?e:e instanceof Error?new b(e.message,e):new b(`Internal error: ${e}`);var eo=class extends b{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},St=class extends b{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},Ga=class extends b{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var lr=class extends b{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 Va="/api/v1/sessions",za="/api/v1/sessions/logout",Lp="/api/v1/sessions/fork",qa="/api/v1/sessions/fork/recover",Op="/api/v1/siwe/init",Np="/api/v1/siwe/authenticate",Dp="/api/v1/siwe/link",Up="/api/v1/siwe/unlink",Fp="/api/v1/farcaster/init",Bp="/api/v1/farcaster/authenticate",Hp="/api/v1/farcaster/link",Gp="/api/v1/farcaster/status",Vp="/api/v1/farcaster/unlink",zp="/api/v1/passwordless/init",qp="/api/v1/passwordless/authenticate",$p="/api/v1/passwordless/link",Kp="/api/v1/passwordless/unlink",jp="/api/v1/passwordless/update",Yp="/api/v1/passwordless_sms/init",Zp="/api/v1/passwordless_sms/link",Jp="/api/v1/passwordless_sms/unlink",Qp="/api/v1/passwordless_sms/authenticate",Xp="/api/v1/oauth/init",eu="/api/v1/oauth/authenticate",tu="/api/v1/oauth/link",ru="/api/v1/oauth/unlink",ou="/api/v1/recovery/oauth/init",nu="/api/v1/recovery/oauth/init_icloud",iu="/api/v1/recovery/oauth/authenticate",au="/api/v1/passkeys/link/init",su="/api/v1/passkeys/authenticate/init",lu="/api/v1/passkeys/link",cu="/api/v1/passkeys/authenticate",du="/api/v1/passkeys/unlink",pu="/api/v1/telegram/authenticate",uu="/api/v1/telegram/link",mu="/api/v1/telegram/unlink";var fu="/api/v1/mfa/passwordless_sms/init",hu="/api/v1/mfa/passkeys/init",yu="/api/v1/users/me/accept_terms",$a="/api/v1/analytics_events",gu="/api/v1/plugins/moonpay_on_ramp/sign",vu="/api/v1/custom_jwt_account/authenticate";var Sn=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new b("Auth flow has no API instance");try{let t=await this.api.post(vu,{token:this.meta.token});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw ne(t)}}async link(){throw new Error("Unimplemented")}};var ho=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new b("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new b("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(qp,{email:this.meta.email,code:this.meta.emailCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw ne(t)}}async link(){if(!this.api)throw new b("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new b("Email and email code must be set prior to calling authenticate.");try{return await this.api.post($p,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw ne(t)}}async sendCodeEmail(t,r){if(!this.api)throw new b("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new b("Email must be set when initialzing authentication.");try{return await this.api.post(zp,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw ne(o)}}},Ka=class extends ho{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new b("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new b("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(jp,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw ne(r)}}};import{isMobile as R2,isIOS as I2}from"react-device-detect";var Ec=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)}},ja=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 Tc(){try{let e="privy:__session_storage__test",t="blobby",r=new ja;return r.put(e,t),r.del(e),!0}catch{return!1}}function A2(){return typeof window<"u"&&window.localStorage?new ja:new Ec}var Z=A2();import{StaticJsonRpcProvider as xi}from"@ethersproject/providers";function Cu(){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 Ya=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 Pc=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||Ya(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!Pc(r))return!1}return!0},yo=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),Za=()=>{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 wu=(e,t)=>{let r=[],o=[];for(let[n,i]of e.entries())n<t?r.push(i):o.push(i);return[r,o]},Ja=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,}))$/),bu=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},go=(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}`},Sc=e=>new Promise(t=>setTimeout(t,e));function Eu(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 Ai=(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 Sc(r)}a||i(new Error("Exceeded max attempts before resolving function"))})},Qa=(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 Tu=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),zo=e=>typeof e=="string"?e:"0x"+e.toString(16);async function Pu(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 u of s)t.includes("coinbase_wallet")&&u.info.rdns==="com.coinbase.wallet"||c.push({type:u.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:u});for(let u of Cu()){let h=Ya(u);if(!s.some(f=>f.info.name===h)){if(Pc(u,!0)&&!c.find(f=>f.type==="metamask")){c.push({type:"metamask",legacyInjectedProvider:u});continue}if(h==="Phantom"&&!c.find(f=>f.type==="phantom")){c.push({type:"phantom",legacyInjectedProvider:u});continue}if(h==="Coinbase Wallet"&&!c.find(f=>f.type==="coinbase_wallet"&&r?.coinbaseWallet?.connectionOptions!=="smartWalletOnly")){c.push({type:"coinbase_wallet",legacyInjectedProvider:u});continue}c.find(f=>f.type==="unknown_browser_extension")||c.push({type:"unknown_browser_extension",legacyInjectedProvider:u})}}a(c)}})}function _n(e){return`eip155:${String(Number(e))}`}var Su=(e,t,r,o)=>{let n=Number(e),i=t.find(l=>l.id===n);if(!i)throw new te(`Unsupported chainId ${e}`,4901);let a;if(i.rpcUrls.privyWalletOverride&&i.rpcUrls.privyWalletOverride.http[0])a=i.rpcUrls.privyWalletOverride.http[0];else if(r.rpcUrls&&r.rpcUrls[n])a=r.rpcUrls[n];else if(i.rpcUrls.privy?.http[0]){let l=new URL(i.rpcUrls.privy.http[0]);l.searchParams.append("privyAppId",o),a=l.toString()}else i.rpcUrls.public?.http[0]?a=i.rpcUrls.public.http[0]:a=i.rpcUrls.default?.http[0];if(!a)throw new te(`No RPC url found for ${e}`);return a},_u=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new te(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},to=(e,t,r,o)=>{let n=Number(e),i=t.find(l=>l.id===n);if(!i)throw new te(`Unsupported chainId ${e}`,4901);let a;if(i.rpcUrls.privyWalletOverride&&i.rpcUrls.privyWalletOverride.http[0]?a=new xi(i.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?a=new xi(r.rpcUrls[n]):i.rpcUrls.privy?.http[0]?a=new xi({url:i.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):i.rpcUrls.public?.http[0]?a=new xi(i.rpcUrls.public.http[0]):a=new xi(i.rpcUrls.default?.http[0]),!a)throw new te(`No RPC url found for ${e}`);return a},Xa=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 es=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(ts))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var ts={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 k2(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function xu(e,t){let r=k2(t);if(r.deepLink)return Mu(r.deepLink,e);if(r.universalLink)return Wu(r.universalLink,e);throw new b(`Unsupported wallet ${t.id}`)}var Au="WALLETCONNECT_DEEPLINK_CHOICE";function ku(){try{localStorage.removeItem(Au)}catch{}}function Ru({href:e,name:t}){try{localStorage.setItem(Au,JSON.stringify({href:e,name:t}))}catch{}}function Iu(e){return e.startsWith("http://")||e.startsWith("https://")}function Mu(e,t){if(Iu(e))return Wu(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 Wu(e,t){if(!Iu(e))return Mu(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function rs(e,t){window.open(e,t,"noreferrer noopener")}var Ve=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 ki=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new Ve(this._startChannelOnce.bind(this)),this.pollForReady=new Ve(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new b("Auth flow has no API instance");if(!this.meta.channelToken)throw new b("Auth flow must be initialized first");try{let t=await this.api.post(Bp,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new b("No response from authentication");return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw ne(t)}}async link(){if(!this.api)throw new b("Auth flow has no API instance");try{return await this.api.post(Hp,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw ne(t)}}async _startChannelOnce(){if(!this.api)throw new b("Auth flow has no API instance");let t=await this.api.post(Fp,{token:this.captchaToken});R2&&!I2&&t.connect_uri&&rs(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new b("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new b("Auth flow has no API instance");if(!this.meta.channelToken)throw new b("Auth flow must be initialized first");let t=await this.api.get(Gp,{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 Lu="1.70.0";var Ou="34357d3c125c2bcf2ce2bc3309d98715",Ri="https://auth.privy.io",Nu=2e4,Fe=1400,Du=2500,_c=Lu;var qo="privy:token",xc="privy-token",os="privy:refresh_token",Uu="privy-refresh-token",ns="privy-session",Ii="privy:session_transfer_token",W2="privy:wallet",Mi="privy:caid",$o="privy:state_code",Ko="privy:code_verifier",jo="privy:headless_oauth",is=e=>`${W2}:${e}`,Ac="privy:connectors",kc="privy:connections";var Yo=12e4,ro=1,Rc="0x1",xn=3e4,Fu="https://api.moonpay.com/v1",Bu="https://api.moonpay.com/v1",Hu="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",Gu="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",Vu="0x420000000000000000000000000000000000000F",zu=["function getL1Fee(bytes memory _data) external view returns (uint256)"],qu="deprecated";import{base64url as ju}from"jose";async function $u(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function Ku(e){return crypto.getRandomValues(new Uint8Array(e))}var L2="S256",O2="S256";function Wi(){return ju.encode(Ku(36))}function as(){return Wi()}async function ss(e,t=L2){if(t==O2){let r=await $u(e);return ju.encode(r)}else return e}function Yu(){let e=Z.get(Ko);if(!e)throw new b("Authentication error.");return e}function ls(){return!!Z.get(jo)}var Nr=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:ls();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 b("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new b("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new b("User denied confirmation during OAuth flow");let t=Yu();try{let r=await this.api.post(eu,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return Z.del(Ko),this.meta.headless&&Z.del(jo),{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user,oauth_provider_tokens:r.oauth_provider_tokens}}catch(r){let o=ne(r);throw o.privyErrorCode?new b(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new b("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new b("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new b("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new b("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new b("User denied confirmation during OAuth flow");let t=Z.get(Ko);if(!t)throw new b("Authentication error.");try{let r=await this.api.post(tu,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return Z.del(Ko),r}catch(r){throw ne(r)}}async getAuthorizationUrl(){if(!this.api)throw new b("Auth flow has no API instance");if(!this.meta.provider)throw new b("Provider must be set when initializing OAuth authentication.");let t=Wi();Z.put(Ko,t);let r=as();Z.put($o,r);let o=await ss(t);this.meta.headless&&Z.put(jo,!0);try{return await this.api.post(Xp,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw ne(n)}}};function Ic(e){return e.charAt(0).toUpperCase()+e.slice(1)}import{jsx as Zu,jsxs as N2}from"react/jsx-runtime";var cs=({style:e,...t})=>N2("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:[Zu("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"}),Zu("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 Li,jsxs as D2}from"react/jsx-runtime";var ds=({style:e,...t})=>D2("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:[Li("g",{clipPath:"url(#clip0)",children:Li("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"})}),Li("defs",{children:Li("clipPath",{id:"clip0",children:Li("rect",{width:"71",height:"55",fill:"white"})})})]});import{jsx as Ju}from"react/jsx-runtime";var ps=({style:e,...t})=>Ju("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:Ju("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{jsx as us,jsxs as U2}from"react/jsx-runtime";var ms=({style:e,...t})=>U2("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:[us("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"}),us("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"}),us("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"}),us("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 cr,jsxs as fs}from"react/jsx-runtime";function hs(e){return fs("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:[fs("defs",{children:[fs("linearGradient",{id:"b",children:[cr("stop",{offset:"0",stopColor:"#3771c8"}),cr("stop",{stopColor:"#3771c8",offset:".128"}),cr("stop",{offset:"1",stopColor:"#60f",stopOpacity:"0"})]}),fs("linearGradient",{id:"a",children:[cr("stop",{offset:"0",stopColor:"#fd5"}),cr("stop",{offset:".1",stopColor:"#fd5"}),cr("stop",{offset:".5",stopColor:"#ff543e"}),cr("stop",{offset:"1",stopColor:"#c837ab"})]}),cr("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"}),cr("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"})]}),cr("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)"}),cr("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)"}),cr("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 ys}from"react/jsx-runtime";function gs({style:e,...t}){return ys("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:ys("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:ys("g",{transform:"scale(5.12,5.12)",children:ys("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 Qu,jsxs as F2}from"react/jsx-runtime";function vs(e){return F2("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[Qu("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"}),Qu("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 Mc,jsxs as B2}from"react/jsx-runtime";function Cs(e){return B2("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:[Mc("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"}),Mc("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"}),Mc("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 Xu}from"react/jsx-runtime";var ws=({style:e,...t})=>Xu("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:Xu("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 H2={google:{name:"Google",component:ms},discord:{name:"Discord",component:ds},github:{name:"Github",component:ps},linkedin:{name:"LinkedIn",component:gs},twitter:{name:"Twitter",component:ws},spotify:{name:"Spotify",component:vs},instagram:{name:"Instagram",component:hs},tiktok:{name:"Tiktok",component:Cs},apple:{name:"Apple",component:cs}},Oi=e=>H2[e];function em(e,t){let r={detail:"",retryable:!1},o=Ic(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=Oi(t).name;r.detail=`Request limit reached for ${n}. Please wait a moment and try again.`}if(e?.privyErrorCode==="oauth_account_suspended"){let n=Oi(t).name;r.detail=`Your ${n} account is suspended. Please try another login method.`}return r}function Ni(){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");return!t||!r||!o?{inProgress:!1}:{inProgress:!0,authorizationCode:t,stateCode:r,provider:o,headless:ls(),popupFlow:window.opener!==null}}function Zo(){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"),Z.del($o),window.history.replaceState({},"",e)}var Jo=class{constructor(t){this.initAuthenticateOnce=new Ve(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new Ve(this._initLinkOnce.bind(this)),this.meta={captchaToken:t}}async initAuthenticationFlow(){if(!this.api)throw new b("Auth flow has no API instance");this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute()}async initLinkFlow(){if(!this.api)throw new b("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 b("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new b("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(cu,{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 b("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):ne(r)}}async link(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new b("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new b("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(lu,{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(o)})}catch(r){throw r.name==="NotAllowedError"?new b("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):ne(r)}}async _initAuthenticateOnce(){if(!this.api)throw new b("Auth flow has no API instance");return await this.api.post(su,{token:this.meta.captchaToken})}async _initLinkOnce(){if(!this.api)throw new b("Auth flow has no API instance");return await this.api.post(au,{})}_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 Qo=class{constructor(t,r){this.createSiweMessage=(t,r,o,n,i,a,l)=>`${o} wants you to sign in with your Ethereum account:
1
+ var Ac=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var Fp=(e,t,r)=>(Ac(e,t,"read from private field"),r?r.call(e):t.get(e)),Ka=(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)},xc=(e,t,r,o)=>(Ac(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var Bp=(e,t,r)=>(Ac(e,t,"access private method"),r);import{getAddress as xi}from"@ethersproject/address";import{Web3Provider as Lp}from"@ethersproject/providers";import{createStore as kE}from"mipd";import{useEffect as Nr,useMemo as RE,useRef as ki,useState as tt}from"react";import{isAndroid as IE}from"react-device-detect";import{FetchError as G2}from"ofetch";var Ke=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}]`:""}`}},wr=class extends Ke{constructor(r,o,n,i,a){super(n,i,a);this.type=r;this.status=o}},w=class extends Ke{constructor(r,o,n){super(r,o,n);this.type="client_error"}},ja=class extends w{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var ne=class extends Ke{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},te=e=>{if(e instanceof Ke)return e;if(!(e instanceof G2))return ut(e);if(!e.response)return new wr("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new wr(t||"ApiError",e.response.status,r||o,e,n)},ut=e=>e instanceof Ke?e:e instanceof Error?new w(e.message,e):new w(`Internal error: ${e}`);var ro=class extends w{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},_t=class extends w{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},Ya=class extends w{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var cr=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 Za="/api/v1/sessions",Ja="/api/v1/sessions/logout",Hp="/api/v1/sessions/fork",Qa="/api/v1/sessions/fork/recover",Gp="/api/v1/siwe/init",Vp="/api/v1/siwe/authenticate",zp="/api/v1/siwe/link",qp="/api/v1/siwe/unlink",$p="/api/v1/farcaster/init",Kp="/api/v1/farcaster/authenticate",jp="/api/v1/farcaster/link",Yp="/api/v1/farcaster/status",Zp="/api/v1/farcaster/unlink",Jp="/api/v1/passwordless/init",Qp="/api/v1/passwordless/authenticate",Xp="/api/v1/passwordless/link",eu="/api/v1/passwordless/unlink",tu="/api/v1/passwordless/update",ru="/api/v1/passwordless_sms/init",ou="/api/v1/passwordless_sms/link",nu="/api/v1/passwordless_sms/unlink",iu="/api/v1/passwordless_sms/authenticate",Xa="/api/v1/oauth/init",au="/api/v1/oauth/authenticate",es="/api/v1/oauth/link",su="/api/v1/oauth/unlink",lu="/api/v1/recovery/oauth/init",cu="/api/v1/recovery/oauth/init_icloud",du="/api/v1/recovery/oauth/authenticate",pu="/api/v1/passkeys/link/init",uu="/api/v1/passkeys/authenticate/init",mu="/api/v1/passkeys/link",fu="/api/v1/passkeys/authenticate",hu="/api/v1/passkeys/unlink",yu="/api/v1/telegram/authenticate",gu="/api/v1/telegram/link",vu="/api/v1/telegram/unlink";var Cu="/api/v1/mfa/passwordless_sms/init",wu="/api/v1/mfa/passkeys/init",bu="/api/v1/users/me/accept_terms",ts="/api/v1/analytics_events",Eu="/api/v1/plugins/moonpay_on_ramp/sign",Tu="/api/v1/custom_jwt_account/authenticate";var An=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(Tu,{token:this.meta.token});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw te(t)}}async link(){throw new Error("Unimplemented")}};var yo=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(Qp,{email:this.meta.email,code:this.meta.emailCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw te(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(Xp,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw te(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(Jp,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw te(o)}}},rs=class extends yo{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(tu,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw te(r)}}};import{isMobile as q2,isIOS as $2}from"react-device-detect";var kc=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)}},os=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 Rc(){try{let e="privy:__session_storage__test",t="blobby",r=new os;return r.put(e,t),r.del(e),!0}catch{return!1}}function V2(){return typeof window<"u"&&window.localStorage?new os:new kc}var Y=V2();import{StaticJsonRpcProvider as Ii}from"@ethersproject/providers";function Pu(){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 ns=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 Ic=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||ns(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!Ic(r))return!1}return!0},go=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),is=()=>{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 _u=(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,}))$/),Su=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},vo=(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}`},Mc=e=>new Promise(t=>setTimeout(t,e));function Au(e,{interval:t=100,timeout:r=5e3}={}){return new Promise((o,n)=>{let i=0,a,s=()=>{if(i>=r){n("Max attempts reached without result");return}if(a=e(),i+=t,a!=null){o(a);return}setTimeout(s,t)};s()})}var Mi=(e,t={})=>{let r=t.delayMs||150,o=t.maxAttempts||270;return new Promise(async(n,i)=>{let a=!1,s=0;for(;!a&&s<o;){if(t.abortSignal?.aborted)return;e().then(l=>{a=!0,n(l)},(...l)=>{a=!0,i(...l)}),s+=1,await Mc(r)}a||i(new Error("Exceeded max attempts before resolving function"))})},ss=(e,t,r={},o={})=>{let n=new URL(t,e);for(let[a,s]of Object.entries(r))s!==void 0&&n.searchParams.set(a,s);let i=Object.entries(o);if(i.length>0){let a=new URLSearchParams;for(let[s,l]of i)a.append(s,l);n.hash=a.toString()}return n.href};var xu=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),Vo=e=>typeof e=="string"?e:"0x"+e.toString(16);async function ku(e,t,r,o=3e3){let n=!1,i=window;return new Promise(a=>{i.ethereum?s():(window.addEventListener("ethereum#initialized",s,{once:!0}),setTimeout(()=>{s()},o));function s(){if(n)return;n=!0,window.removeEventListener("ethereum#initialized",s);let l=e.getProviders(),c=[];for(let u of l)t.includes("coinbase_wallet")&&u.info.rdns==="com.coinbase.wallet"||c.push({type:u.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:u});for(let u of Pu()){let f=ns(u);if(!l.some(h=>h.info.name===f)){if(Ic(u,!0)&&!c.find(h=>h.type==="metamask")){c.push({type:"metamask",legacyInjectedProvider:u});continue}if(f==="Phantom"&&!c.find(h=>h.type==="phantom")){c.push({type:"phantom",legacyInjectedProvider:u});continue}if(f==="Coinbase Wallet"&&!c.find(h=>h.type==="coinbase_wallet"&&r?.coinbaseWallet?.connectionOptions!=="smartWalletOnly")){c.push({type:"coinbase_wallet",legacyInjectedProvider:u});continue}c.find(h=>h.type==="unknown_browser_extension")||c.push({type:"unknown_browser_extension",legacyInjectedProvider:u})}}a(c)}})}function xn(e){return`eip155:${String(Number(e))}`}var Ru=(e,t,r,o)=>{let n=Number(e),i=t.find(s=>s.id===n);if(!i)throw new ne(`Unsupported chainId ${e}`,4901);let a;if(i.rpcUrls.privyWalletOverride&&i.rpcUrls.privyWalletOverride.http[0])a=i.rpcUrls.privyWalletOverride.http[0];else if(r.rpcUrls&&r.rpcUrls[n])a=r.rpcUrls[n];else if(i.rpcUrls.privy?.http[0]){let s=new URL(i.rpcUrls.privy.http[0]);s.searchParams.append("privyAppId",o),a=s.toString()}else i.rpcUrls.public?.http[0]?a=i.rpcUrls.public.http[0]:a=i.rpcUrls.default?.http[0];if(!a)throw new ne(`No RPC url found for ${e}`);return a},Iu=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new ne(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},oo=(e,t,r,o)=>{let n=Number(e),i=t.find(s=>s.id===n);if(!i)throw new ne(`Unsupported chainId ${e}`,4901);let a;if(i.rpcUrls.privyWalletOverride&&i.rpcUrls.privyWalletOverride.http[0]?a=new Ii(i.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?a=new Ii(r.rpcUrls[n]):i.rpcUrls.privy?.http[0]?a=new Ii({url:i.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):i.rpcUrls.public?.http[0]?a=new Ii(i.rpcUrls.public.http[0]):a=new Ii(i.rpcUrls.default?.http[0]),!a)throw new ne(`No RPC url found for ${e}`);return a},Wi=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 ls=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(cs))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var cs={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 z2(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function Mu(e,t){let r=z2(t);if(r.deepLink)return Du(r.deepLink,e);if(r.universalLink)return Uu(r.universalLink,e);throw new w(`Unsupported wallet ${t.id}`)}var Wu="WALLETCONNECT_DEEPLINK_CHOICE";function Lu(){try{localStorage.removeItem(Wu)}catch{}}function Ou({href:e,name:t}){try{localStorage.setItem(Wu,JSON.stringify({href:e,name:t}))}catch{}}function Nu(e){return e.startsWith("http://")||e.startsWith("https://")}function Du(e,t){if(Nu(e))return Uu(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 Uu(e,t){if(!Nu(e))return Du(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function ds(e,t){window.open(e,t,"noreferrer noopener")}var Fe=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 Li=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new Fe(this._startChannelOnce.bind(this)),this.pollForReady=new Fe(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(Kp,{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,is_new_user:t.is_new_user}}catch(t){throw te(t)}}async link(){if(!this.api)throw new w("Auth flow has no API instance");try{return await this.api.post(jp,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw te(t)}}async _startChannelOnce(){if(!this.api)throw new w("Auth flow has no API instance");let t=await this.api.post($p,{token:this.captchaToken});q2&&!$2&&t.connect_uri&&ds(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(Yp,{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 Fu="1.71.0-beta-20240611222124";var Bu="34357d3c125c2bcf2ce2bc3309d98715",Oi="https://auth.privy.io",Hu=2e4,Oe=1400,Gu=2500,Wc=Fu;var zo="privy:token",Lc="privy-token",ps="privy:refresh_token",Vu="privy-refresh-token",us="privy-session",Ni="privy:session_transfer_token",j2="privy:wallet",Di="privy:caid",Ui=e=>`privy:cross-app:${e}`,qo="privy:state_code",$o="privy:code_verifier",Ko="privy:headless_oauth",ms=e=>`${j2}:${e}`,Oc="privy:connectors",Nc="privy:connections";var jo=12e4,no=1,Dc="0x1",kn=3e4,zu="https://api.moonpay.com/v1",qu="https://api.moonpay.com/v1",$u="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",Ku="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",ju="0x420000000000000000000000000000000000000F",Yu=["function getL1Fee(bytes memory _data) external view returns (uint256)"],Zu="deprecated";import{base64url as Xu}from"jose";async function Ju(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function Qu(e){return crypto.getRandomValues(new Uint8Array(e))}var Y2="S256",Z2="S256";function Yo(){return Xu.encode(Qu(36))}function Rn(){return Yo()}async function In(e,t=Y2){if(t==Z2){let r=await Ju(e);return Xu.encode(r)}else return e}function em(){let e=Y.get($o);if(!e)throw new w("Authentication error.");return e}function fs(){return!!Y.get(Ko)}var Dr=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:fs();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=em();try{let r=await this.api.post(au,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return Y.del($o),this.meta.headless&&Y.del(Ko),{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user,oauth_provider_tokens:r.oauth_provider_tokens}}catch(r){let o=te(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=Y.get($o);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 Y.del($o),r}catch(r){throw te(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=Yo();Y.put($o,t);let r=Rn();Y.put(qo,r);let o=await In(t);this.meta.headless&&Y.put(Ko,!0);try{return await this.api.post(Xa,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw te(n)}}};function Uc(e){return e.charAt(0).toUpperCase()+e.slice(1)}import{jsx as tm,jsxs as J2}from"react/jsx-runtime";var hs=({style:e,...t})=>J2("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:[tm("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"}),tm("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 Fi,jsxs as Q2}from"react/jsx-runtime";var ys=({style:e,...t})=>Q2("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:[Fi("g",{clipPath:"url(#clip0)",children:Fi("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"})}),Fi("defs",{children:Fi("clipPath",{id:"clip0",children:Fi("rect",{width:"71",height:"55",fill:"white"})})})]});import{jsx as rm}from"react/jsx-runtime";var gs=({style:e,...t})=>rm("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:rm("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{jsx as vs,jsxs as X2}from"react/jsx-runtime";var Cs=({style:e,...t})=>X2("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:[vs("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"}),vs("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"}),vs("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"}),vs("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 dr,jsxs as ws}from"react/jsx-runtime";function bs(e){return ws("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:[ws("defs",{children:[ws("linearGradient",{id:"b",children:[dr("stop",{offset:"0",stopColor:"#3771c8"}),dr("stop",{stopColor:"#3771c8",offset:".128"}),dr("stop",{offset:"1",stopColor:"#60f",stopOpacity:"0"})]}),ws("linearGradient",{id:"a",children:[dr("stop",{offset:"0",stopColor:"#fd5"}),dr("stop",{offset:".1",stopColor:"#fd5"}),dr("stop",{offset:".5",stopColor:"#ff543e"}),dr("stop",{offset:"1",stopColor:"#c837ab"})]}),dr("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"}),dr("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"})]}),dr("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)"}),dr("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)"}),dr("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 Es}from"react/jsx-runtime";function Ts({style:e,...t}){return Es("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:Es("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:Es("g",{transform:"scale(5.12,5.12)",children:Es("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 om,jsxs as e3}from"react/jsx-runtime";function Ps(e){return e3("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[om("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"}),om("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 Fc,jsxs as t3}from"react/jsx-runtime";function _s(e){return t3("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:[Fc("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"}),Fc("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"}),Fc("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 nm}from"react/jsx-runtime";var Ss=({style:e,...t})=>nm("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:nm("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 r3={google:{name:"Google",component:Cs},discord:{name:"Discord",component:ys},github:{name:"Github",component:gs},linkedin:{name:"LinkedIn",component:Ts},twitter:{name:"Twitter",component:Ss},spotify:{name:"Spotify",component:Ps},instagram:{name:"Instagram",component:bs},tiktok:{name:"Tiktok",component:_s},apple:{name:"Apple",component:hs}},Bi=e=>r3[e];function im(e,t){let r={detail:"",retryable:!1},o=Uc(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=Bi(t).name;r.detail=`Request limit reached for ${n}. Please wait a moment and try again.`}if(e?.privyErrorCode==="oauth_account_suspended"){let n=Bi(t).name;r.detail=`Your ${n} account is suspended. Please try another login method.`}return r}function Hi(){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:fs(),popupFlow:window.opener!==null&&n}}function Zo(){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"),Y.del(qo),window.history.replaceState({},"",e)}var Jo=class{constructor(t){this.initAuthenticateOnce=new Fe(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new Fe(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(fu,{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"):te(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(mu,{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"):te(r)}}async _initAuthenticateOnce(){if(!this.api)throw new w("Auth flow has no API instance");return await this.api.post(uu,{token:this.meta.captchaToken})}async _initLinkOnce(){if(!this.api)throw new w("Auth flow has no API instance");return await this.api.post(pu,{})}_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 Qo=class{constructor(t,r){this.createSiweMessage=(t,r,o,n,i,a,s)=>`${o} wants you to sign in with your Ethereum account:
2
2
  ${r}
3
3
 
4
- ${l}
4
+ ${s}
5
5
 
6
6
  URI: ${n}
7
7
  Version: 1
@@ -9,7 +9,7 @@ Chain ID: ${t}
9
9
  Nonce: ${a}
10
10
  Issued At: ${i}
11
11
  Resources:
12
- - https://privy.io`;this.getNonceOnce=new Ve(this._getNonceOnce.bind(this)),this.wallet=t,this.captchaToken=r}get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType}}async authenticate(){if(!this.api)throw new b("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign(),o=await this.api.post(Np,{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,is_new_user:o.is_new_user}}catch(t){throw ne(t)}}async link(){if(!this.api)throw new b("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign();return await this.api.post(Dp,{message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw ne(t)}}async sign(){if(!this.api)throw new b("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new b("Could not prepare SIWE message");let t=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async _getNonceOnce(){if(!this.api)throw new b("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(Op,{address:t,token:this.captchaToken})).nonce}async buildSiweMessage(){if(!this.api)throw new b("Auth flow has no API instance");let t=this.wallet.address,r=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=this.prepareMessage(r,t,this.nonce),this.preparedMessage}prepareMessage(t,r,o){let n=window.location.host,i=window.location.origin,a="By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",l=new Date().toISOString();return this.createSiweMessage(t,r,n,i,l,o,a)}};var Xo=class{constructor(t,r){this.meta={phoneNumber:t,captchaToken:r}}async authenticate(){if(!this.api)throw new b("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new b("phone number and sms code must be set prior to calling authenticate.");try{let t=await this.api.post(Qp,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw ne(t)}}async link(){if(!this.api)throw new b("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new b("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(Zp,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw ne(t)}}async sendSmsCode(t,r){if(!this.api)throw new b("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),r&&(this.meta.captchaToken=r),!this.meta.phoneNumber)throw new b("phone nNumber must be set when initialzing authentication.");try{return await this.api.post(Yp,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw ne(o)}}};var An=class{constructor(t){this.meta={captchaToken:t}}async authenticate(){if(!this.api)throw new b("Auth flow has no API instance");try{let t=await this.api.post(pu,{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,is_new_user:t.is_new_user}}catch(t){throw ne(t)}}async link(){if(!this.api)throw new b("Auth flow has no API instance");try{return await this.api.post(uu,{telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData})}catch(t){throw ne(t)}}};function Lc(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 tm(){let e;if(e=G2(),e)return Wc(),{...e,flowType:"login-url"};if(e=V2(),e)return Wc(),{...e,flowType:"web-app"};Wc()}function G2(){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 V2(){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 Wc(){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 N3}from"uuid";function j(e){return e?new Date(e*1e3):null}function z2(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:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at),chainType:"ethereum",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"email":let i={address:r.address,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(i);break;case"phone":let a={number:r.phoneNumber,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(a);break;case"google_oauth":let l={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(l);break;case"spotify_oauth":let s={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(s);break;case"instagram_oauth":let c={subject:r.subject,username:r.username,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(c);break;case"twitter_oauth":let u={subject:r.subject,username:r.username,name:r.name,type:r.type,profilePictureUrl:r.profile_picture_url,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(u);break;case"discord_oauth":let h={subject:r.subject,username:r.username,email:r.email,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(h);break;case"github_oauth":let f={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(f);break;case"tiktok_oauth":let g={subject:r.subject,username:r.username,name:r.name,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(g);break;case"linkedin_oauth":let v={subject:r.subject,name:r.name,email:r.email,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(v);break;case"apple_oauth":let y={subject:r.subject,email:r.email,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(y);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)});break;case"farcaster":let S={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:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at),signerPublicKey:r.signer_public_key};t.push(S);break;case"passkey":let _={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:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(_);break;case"telegram":let w={type:r.type,telegramUserId:r.telegram_user_id,firstName:r.first_name,lastName:r.last_name,username:r.username,photoUrl:r.photo_url,verifiedAt:j(r.first_verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(w);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function Ot(e,t){return e.slice().sort((r,o)=>(o.firstVerifiedAt??o.verifiedAt).getTime()-(r.firstVerifiedAt??r.verifiedAt).getTime()).find(r=>r.type===t)}var xe=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&!t.imported)||null,Oc=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&t.imported)||null,q2=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),Nt=(e,t)=>t==="all-users"&&!xe(e)||t==="users-without-wallets"&&!q2(e)?.length;function Kt(e){if(!e)return null;let t=z2(e.linked_accounts),r=Ot(t,"wallet"),o=Ot(t,"email"),n=Ot(t,"phone"),i=Ot(t,"google_oauth"),a=Ot(t,"twitter_oauth"),l=Ot(t,"discord_oauth"),s=Ot(t,"github_oauth"),c=Ot(t,"spotify_oauth"),u=Ot(t,"instagram_oauth"),h=Ot(t,"tiktok_oauth"),f=Ot(t,"linkedin_oauth"),g=Ot(t,"apple_oauth"),v=Ot(t,"farcaster"),y=Ot(t,"telegram"),S=e.mfa_methods.map(({type:w,verified_at:x})=>({type:w,verifiedAt:j(x)}));return{id:e.id,createdAt:j(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:u&&{subject:u.subject,username:u.username},tiktok:h&&{subject:h.subject,username:h.username,name:h.name},linkedin:f&&{subject:f.subject,name:f.name,email:f.email},apple:g&&{subject:g.subject,email:g.email},farcaster:v&&{fid:v.fid,ownerAddress:v.ownerAddress,displayName:v.displayName,username:v.username,bio:v.bio,pfp:v.pfp,url:v.url,signerPublicKey:v.signerPublicKey},telegram:y&&{telegramUserId:y.telegramUserId,firstName:y.firstName,lastName:y.lastName,username:y.username,photoUrl:y.photoUrl},mfaMethods:S.map(w=>w.type),hasAcceptedTerms:e.has_accepted_terms??!1}}import{getAddress as Hm}from"@ethersproject/address";import{isHexString as R3}from"@ethersproject/bytes";import I3 from"eventemitter3";import t3 from"@coinbase/wallet-sdk";import{jsx as rm,jsxs as $2}from"react/jsx-runtime";var Di=({style:e,...t})=>$2("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:[rm("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),rm("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 Ur}from"@ethersproject/address";import{Web3Provider as lm}from"@ethersproject/providers";import{default as X2}from"eventemitter3";import Q2 from"eventemitter3";var K2=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],om=e=>K2.includes(e);import{ErrorCode as j2}from"@ethersproject/logger";var kn=class extends te{constructor(){super("Wallet timeout");this.type="wallet_error"}},Rn=class extends te{constructor(){super("User rejected connection");this.type="wallet_error"}},br=e=>{if(e instanceof te)return e;if(e?.code&&e?.reason){let t=new ze(e);return e.code===j2.ACTION_REJECTED&&(t.details=ut.E4001_USER_REJECTED_REQUEST),t}return e?.code?new ze(e):new te("Unknown connector error",e)},jt=class extends $e{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},ze=class extends jt{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(ut).find(i=>i.eipCode===o.code);this.details=n||ut.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=ut.E32002_CONNECTION_ALREADY_PENDING:this.details=ut.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=ut.E32002_WALLET_LOCKED))}},Y2={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}},Z2={E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}},J2={E4001_DEFAULT_USER_REJECTED_REQUEST:{eipCode:4001,message:"User Rejected Request",detail:"The user rejected the request.",default:!0,retryable:!0},E4100_DEFAULT_UNAUTHORIZED:{eipCode:4100,message:"Unauthorized",detail:"The requested method and/or account has not been authorized by the user.",default:!0,retryable:!1},E4200_DEFAULT_UNSUPPORTED_METHOD:{eipCode:4200,message:"Unsupported Method",detail:"The Provider does not support the requested method.",default:!0,retryable:!1},E4900_DEFAULT_DISCONNECTED:{eipCode:4900,message:"Disconnected",detail:"The Provider is disconnected from all chains.",default:!0,retryable:!0},E4901_DEFAULT_CHAIN_DISCONNECTED:{eipCode:4901,message:"Chain Disconnected",detail:"The Provider is not connected to the requested chain.",default:!0,retryable:!0},E32700_DEFAULT_PARSE_ERROR:{eipCode:-32700,message:"Parse error",detail:"Invalid JSON",default:!0,retryable:!1},E32600_DEFAULT_INVALID_REQUEST:{eipCode:-32600,message:"Invalid request",detail:"JSON is not a valid request object",default:!0,retryable:!1},E32601_DEFAULT_METHOD_NOT_FOUND:{eipCode:-32601,message:"Method not found",detail:"Method does not exist",default:!0,retryable:!1},E32602_DEFAULT_INVALID_PARAMS:{eipCode:-32602,message:"Invalid params",detail:"Invalid method parameters",default:!0,retryable:!1},E32603_DEFAULT_INTERNAL_ERROR:{eipCode:-32603,message:"Internal error",detail:"Internal JSON-RPC error",default:!0,retryable:!0},E32000_DEFAULT_INVALID_INPUT:{eipCode:-32e3,message:"Invalid input",detail:"Missing or invalid parameters",default:!0,retryable:!1},E32001_DEFAULT_RESOURCE_NOT_FOUND:{eipCode:-32001,message:"Resource not found",detail:"Requested resource not found",default:!0,retryable:!1},E32002_DEFAULT_RESOURCE_UNAVAILABLE:{eipCode:-32002,message:"Resource unavailable",detail:"Requested resource not available",default:!0,retryable:!0},E32003_DEFAULT_TRANSACTION_REJECTED:{eipCode:-32003,message:"Transaction rejected",detail:"Transaction creation failed",default:!0,retryable:!0},E32004_DEFAULT_METHOD_NOT_SUPPORTED:{eipCode:-32004,message:"Method not supported",detail:"Method is not implemented",default:!0,retryable:!1},E32005_DEFAULT_LIMIT_EXCEEDED:{eipCode:-32005,message:"Limit exceeded",detail:"Request exceeds defined limit",default:!0,retryable:!1},E32006_DEFAULT_JSON_RPC_VERSION_NOT_SUPPORTED:{eipCode:-32006,message:"JSON-RPC version not supported",detail:"Version of JSON-RPC protocol is not supported",default:!0,retryable:!1}},ut={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...J2,...Z2},oo={...Y2,...ut};var Be=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 kn,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||Yo,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 te(`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 br(r)})}},vo=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},Ui=class extends Q2{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=to(l,this.chains,n,{appId:a}),this.rpcTimeoutDuration=In(n,"privy"),this.appId=a}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new vo(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await Ee()||!this.address)throw new vo("Disconnected",4900);return(await am(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new vo(`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 vo(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=to(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 nm(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 im(Xa(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:zo(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 zo(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(om(r.method)){let o=await Ee();if(await sm(),!o||!this.address)throw new vo("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 vo("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await Ee();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}}},Dr=class extends Be{constructor(r){super(r,r.rpcTimeoutDuration)}},Co=class extends Be{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 e3=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},Dt=class extends X2{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=_n(r),this.walletClientType==="privy"&&Z.put(is(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=In(i,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n,i){let a=async()=>!!this.wallets.find(l=>Ur(l.address)===Ur(r));return{address:Ur(r),chainId:o,meta:n,imported:i,switchChain:async l=>{if(!a)throw new te("Wallet is not currently connected.");let s=this.wallets.find(g=>Ur(g.address)===Ur(r))?.chainId;if(!s)throw new te("Unable to determine current chainId.");let c,u;if(typeof l=="number"?(c=`0x${l.toString(16)}`,u=l):(c=l,u=Number(l)),s===_n(c))return;let h=this.chains.find(g=>g.id===u);if(!h)throw new te(`Unsupported chainId: ${l}`);let f=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:c}]})};try{return await f()}catch(g){if(e3(g,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:c,chainName:h.name,nativeCurrency:h.nativeCurrency,rpcUrls:[h.rpcUrls.default?.http[0]??""],blockExplorerUrls:[h.blockExplorers?.default.url??""]}]}),f();throw this.walletClientType==="rainbow"&&g.message?.includes("wallet_switchEthereumChain")?new te(`Rainbow does not support the chainId ${o}`):g}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:a,getEthereumProvider:async()=>{if(!await a())throw new te("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await a())throw new te("Wallet is not currently connected.");return new lm(new Dr(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await a())throw new te("Wallet is not currently connected.");return new Co(this.proxyProvider)},sign:async l=>{if(!await a())throw new te("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 Ai(()=>this.proxyProvider.request({method:"eth_accounts"}),{maxAttempts:10,delayMs:500});Array.isArray(c)&&(o=c)}}catch{console.warn("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.")}if(!o||!Array.isArray(o)||o.length<=0||!o[0])return;let n=o[0],i=Ur(n),a=[],l;if(this.walletClientType==="privy"){let c=Z.get(is(i));this.chains.find(u=>u.id===Number(c))||(Z.del(is(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 Ai(()=>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 ${Rc}`,c),l=Rc}let s=_n(l);if(!a.find(c=>Ur(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(Ur(n),s,c,this.connectorType==="embedded_imported"))}bs(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=>Ur(n)===Ur(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 lm(new Dr(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 r3=[1,11155111,137,10,8453,84532,42161,7777777,43114,56],o3=(e,t)=>e.makeWeb3Provider({options:t}),Nc,Es=class extends Dt{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 Be(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.connectionOptions=i.coinbaseWallet.connectionOptions??"eoaOnly",this.walletClientType=this.connectionOptions==="smartWalletOnly"?"coinbase_smart_wallet":"coinbase_wallet",this.walletClientType==="coinbase_smart_wallet"&&(this.displayName="Coinbase Smart Wallet"),!Nc){let s=[o.id].concat(r.map(u=>u.id)),c=this.connectionOptions!=="eoaOnly"?s.filter(u=>!r3.includes(u)):[];c.length>0&&console.warn(`The following configured chains are not supported by the Coinbase Smart Wallet: ${c.join(", ")}`),Nc=new t3({appName:a,appLogoUrl:l,appChainIds:s})}this.proxyProvider.setWalletProvider(o3(Nc,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:Di,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 te("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([r[0]])}catch(r){throw br(r)}}};import{jsx as cm}from"react/jsx-runtime";var Ts=({...e})=>cm("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:cm("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 Fi=class extends Dt{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:[zo(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:Ts,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};import{jsx as dm}from"react/jsx-runtime";var Mn=({style:e,...t})=>dm("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:dm("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 Yt,jsxs as n3}from"react/jsx-runtime";var Wn=({style:e,...t})=>n3("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:[Yt("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),Yt("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),Yt("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"}),Yt("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"}),Yt("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"}),Yt("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"}),Yt("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"}),Yt("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"}),Yt("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"}),Yt("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"}),Yt("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"}),Yt("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"}),Yt("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 pm,jsxs as i3}from"react/jsx-runtime";var Fr=({style:e,...t})=>i3("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:[pm("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),pm("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 On=class extends Dt{constructor(r,o,n,i,a){super(a||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new Be(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 te("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw br(r)}}},Ln,Nn=class extends Dt{constructor(r,o,n,i,a){super(a??"unknown",r,o,n);this.connectorType="injected";Ba(this,Ln,void 0);this.proxyProvider=new Be(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(i),a==="metamask"?bc(this,Ln,{name:"MetaMask",icon:Wn,id:"io.metamask"}):a==="phantom"&&bc(this,Ln,{name:"Phantom",icon:Fr,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 Mp(this,Ln)??{name:"Browser Extension",icon:Mn,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 te("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw br(r)}}};Ln=new WeakMap;import{getAddress as zP}from"@ethersproject/address";import{Web3Provider as $P}from"@ethersproject/providers";import{isMobile as a3}from"react-device-detect";var Ps=class extends On{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{a3||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 te("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw br(t)}}};var Ss=class extends Dt{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new Be(void 0,Yo);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 _s=class extends Ss{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:Fr,id:"phantom"}}};import{EthereumProvider as _3,OPTIONAL_EVENTS as x3,OPTIONAL_METHODS as A3}from"@walletconnect/ethereum-provider";import{isMobile as k3}from"react-device-detect";import{createContext as v3,useContext as C3,useEffect as Bc,useRef as w3,useState as b3}from"react";import{jsx as s3}from"react/jsx-runtime";function xs({src:e,...t}){return s3("img",{src:e,...t,style:{display:"none"}})}import{useContext as Nm,useEffect as Om,useMemo as f3,useState as h3}from"react";import{createContext as y3}from"react";var Zt={appearance:{landingHeader:"Log in or sign up",theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:Ou,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},externalWallets:{coinbaseWallet:{connectionOptions:"eoaOnly"}},captchaEnabled:!1,_render:{standalone:!1},fiatOnRamp:{useSandbox:!1}};var um=({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 l3=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets","rabby_wallet"]),mm=e=>l3.has(e),fm=(e,t,r)=>r.indexOf(e)===t,hm=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(mm).filter(fm):e?e.filter(mm).filter(fm):Zt.appearance.walletList;var As={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 ks={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 Rs={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 ym={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 gm={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 Is={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 Ms={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 Ws={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 vm={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 Cm={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 wm={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 bm={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 Em={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 Tm={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 Pm={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 Sm={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 _m={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 xm={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 Ls={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 Os={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 Ns={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 Ds={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 Bi={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 Hi={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 Am={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 km={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 Rm={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 Us={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 Fs={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 Bs={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 Gi=[As,ks,Rs,Pm,Rm,Ls,Os,Ns,Ds,Bi,Hi,Cm,wm,bm,Em,Is,Ms,Ws,vm,_m,xm,ym,gm,Us,Bs,Fs,Sm,Am,Tm,km],v_=new Set(Gi.map(e=>e.id));import en from"tinycolor2";var Im="#FFFFFF",c3="#000000",d3=Im,p3="#1E1E1D";function u3(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 no(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return en({...e.toHsl(),l:r})}function Mm({backgroundTheme:e,accentHex:t,successHex:r="#51BA81",warnHex:o="#FFB74D",errorHex:n="#EC6351",whiteHex:i=Im,blackHex:a=c3}){let l;switch(e){case"light":l=d3;break;case"dark":l=p3;break;default:l=e;break}let s=en(l),c=en(t),u=en(r),h=en(o),f=en(n),g=u3(s.getLuminance()),v=no(s,g==="light"?-.04:.11),y=no(s,g==="light"?-.88:.87),S=no(s,g==="light"?-.77:.75),_=no(s,g==="light"?-.43:.45).desaturate(g==="light"?60:20),w=no(s,g==="light"?-.08:.25).desaturate(g==="light"?60:20),x=no(c,.15),k=no(c,-.06),D=no(f,.3),I=en(c.getLuminance()>.5?a:i),R=no(u,-.16);return{colorScheme:g,background:s.toHslString(),background2:v.toHslString(),foreground:y.toHslString(),foreground2:S.toHslString(),foreground3:_.toHslString(),foreground4:w.toHslString(),accent:c.toHslString(),accentLight:x.toHslString(),accentDark:k.toHslString(),foregroundAccent:I.toHslString(),success:u.toHslString(),successDark:R.toHslString(),error:f.toHslString(),errorLight:D.toHslString(),warn:h.toHslString()}}function Dc(e,t,r){let o=r?console.warn:()=>{},n,i,a,l,s,c,u,h,f,g,v,y,S,_,w;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"),u=t.loginMethods.includes("discord"),f=t.loginMethods.includes("spotify"),g=t.loginMethods.includes("instagram"),h=t.loginMethods.includes("tiktok"),y=t.loginMethods.includes("github"),v=t.loginMethods.includes("linkedin"),S=t.loginMethods.includes("apple"),_=t.loginMethods.includes("farcaster"),w=t.loginMethods.includes("telegram")):(n=e.emailAuth,i=e.smsAuth,l=e.walletAuth,s=e.googleOAuth,c=e.twitterOAuth,u=e.discordOAuth,y=e.githubOAuth,f=e.spotifyOAuth,g=e.instagramOAuth,h=e.tiktokOAuth,v=e.linkedinOAuth,S=e.appleOAuth,_=e.farcasterAuth,w=e.telegramAuth),typeof window<"u"&&typeof window.PublicKeyCredential!="function"?a=!1:e.passkeyAuth&&(a=!0);let x=[n,i].filter(Boolean),k=[s,c,u,y,f,g,h,v,S,_,w].filter(Boolean),D=[l].filter(Boolean);if(x.length+k.length+D.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&&D.length===0?(o("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),I=!1):!I&&k.length+x.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),t?.loginMethods&&t.loginMethodsAndOrder&&o("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let R=hm({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),H=um({input:t?.loginMethodsAndOrder}),K=t?.intl?.defaultCountry??"US",{chains:Y,defaultChain:W}=m3({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),G=!!t?.defaultChain,L=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,ae,pe=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?L?ae=t?.embeddedWallets?.noPromptOnSignature??!0:ae=t?.embeddedWallets?.noPromptOnSignature??pe:ae=pe,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&ae!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");let{requireUserPasswordOnCreate:ue,...be}=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??Zt.appearance.landingHeader,loginMessage:typeof t?.appearance?.loginMessage=="string"?t?.appearance?.loginMessage.slice(0,100):t?.appearance?.loginMessage,palette:Mm({backgroundTheme:t?.appearance?.theme??Zt.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??Zt.appearance.accentColor}),loginGroupPriority:I?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:R},loginMethods:{wallet:l,email:n,sms:i,passkey:a,google:s,twitter:c,discord:u,github:y,spotify:f,instagram:g,tiktok:h,linkedin:v,apple:S,farcaster:_,telegram:w},loginMethodsAndOrder:H,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??Zt.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??Zt.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??Zt.rpcConfig.rpcTimeouts},chains:Y,defaultChain:W,intl:{defaultCountry:K},shouldEnforceDefaultChainOnConnect:G,captchaEnabled:e.captchaEnabled??Zt.captchaEnabled,captchaSiteKey:e.captchaSiteKey,externalWallets:{coinbaseWallet:{connectionOptions:t?.externalWallets?.coinbaseWallet?.connectionOptions??Zt.externalWallets.coinbaseWallet.connectionOptions}},embeddedWallets:{...e.embeddedWalletConfig,...typeof ue=="boolean"?{requireUserOwnedRecoveryOnCreate:ue}:{},...L?{createOnLogin:"all-users",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...be,noPromptOnSignature:ae},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:L?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??Zt.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1,telegramAuthConfiguration:e.telegramAuthConfiguration},headless:!!t?.headless,render:{standalone:t?._render?.standalone??Zt._render.standalone}}}function Wm(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 m3({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:Gi.find(u=>u.id===s.id)??s)}else n=Gi.concat(e??[]);let i=t?n[0]:Ls,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 Lm=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 g3}from"react/jsx-runtime";var Dm={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:""},Uc=Dc(Dm,void 0,!1),Fc=y3({appConfig:Uc,isServerConfigLoaded:!1}),Um=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,i]=h3(null),a=f3(()=>Dc(n??Dm,o,!!n),[n,o]);return Om(()=>{if(!n)return;let l=Wm(o,t),s=Lm(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]),Om(()=>{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)}})()},[]),g3(Fc.Provider,{value:{appConfig:a,isServerConfigLoaded:!!n},children:e})},yt=()=>{let{appConfig:e}=Nm(Fc);return e},Hs=()=>{let{isServerConfigLoaded:e}=Nm(Fc);return e};var E=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import{jsx as T3,jsxs as P3}from"react/jsx-runtime";var Fm=v3({ready:!1,app:Uc,currentScreen:null,lastScreen:null,navigate:E,navigateBack:E,resetNavigation:E,setModalData:E,onUserCloseViaDialogOrKeybindRef:void 0}),E3=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],Bm=e=>{let t=yt(),r=e.authenticated,[o,n]=b3(e.initialScreen);Bc(()=>{!r&&!E3.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let i=w3(null);Bc(()=>{e.open||(i.current=null)},[e.open]),Bc(()=>{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 P3(Fm.Provider,{value:a,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&T3(xs,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},A=()=>C3(Fm);import{jsx as Dn,jsxs as S3}from"react/jsx-runtime";var Vi=({style:e,...t})=>{let{app:r}=A();return S3("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:[Dn("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),Dn("g",{clipPath:"url(#clip0_1765_9946)",children:Dn("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"})}),Dn("defs",{children:Dn("clipPath",{id:"clip0_1765_9946",children:Dn("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var Br=class extends Dt{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 Be(void 0,this.rpcTimeoutDuration),c&&(this.walletEntry=ts[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=es(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:Wn,id:"io.metamask"}:{name:Tu(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||Vi,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=ts[r],this.walletClientType=r,this.redirectUri=void 0,ku(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new Rn)};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 te("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let s=es(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=In(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),r()})().catch(a=>{if(a){o(br(a));return}o(new te("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=Su(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 _3.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:x3,optionalMethods:A3,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(),k3&&this.walletEntry){let{redirect:l,href:s}=xu(a,this.walletEntry);Ru({href:s,name:this.walletEntry.displayName}),this.redirectUri=l,rs(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=es(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 Gc=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses")?.split(" ").filter(o=>R3(o)).map(o=>Hm(o));return t?.length?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&t.includes(o.address)).length:!1},In=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||Yo:Yo,zi=class extends I3{constructor(r,o,n,i,a,l,s,c,u,h,f){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 Be: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=u,this.privyAppName=h,this.privyAppLogo=f,this.storedConnections=Hc()}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;Z.get(Ac)&&(Z.getKeys().forEach(o=>{o.startsWith("walletconnect")&&Z.del(o)}),Z.del(Ac));let r=Pu(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"),!yo()&&this.walletList.includes("phantom")&&this.createWalletConnector("phantom","phantom"),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 Ui(r,o,this.rpcConfig,this.chains,i,n.id),s=new Fi(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 Ui(r,o,this.rpcConfig,this.chains,i,n.id),s=!0,c=new Fi(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=Hc(),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=Hc(),this.emit("walletsUpdated")}}async createWalletConnector(r,o,n){let i=this.findWalletConnector(r,o);if(i)return i instanceof Br&&i.resetConnection(o),i;let l=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new Ps(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new Nn(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new Nn(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new Nn(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new On(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,o)}else return r==="coinbase_wallet"?new Es(this.chains,this.defaultChain,this.rpcConfig,this.externalWalletConfig,this.privyAppName,this.privyAppLogo):r==="phantom"?new _s(this.defaultChain):new Br(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}));Z.put(kc,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=Hm(r),this.emit("walletsUpdated")}};function bs(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 M3=e=>e&&typeof e.address=="string"&&typeof e.connectorType=="string"&&typeof e.walletClientType=="string"&&typeof e.connectedAt=="number",Hc=()=>{let e=Z.get(kc);return e&&Array.isArray(e)&&e.map(o=>M3(o)).every(Boolean)?e:[]};import{ofetch as W3}from"ofetch";var L3=[Va,qa,za,$a],Gs=class{constructor({appId:t,appClientId:r,client:o,defaults:n}){this.appId=t,this.appClientId=r,this.clientAnalyticsId=o.clientAnalyticsId,this.sdkVersion=_c,this.client=o,this.defaults=n,this.fallbackApiUrl=o.fallbackApiUrl,this.baseFetch=W3.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=L3.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 Ha}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw ne(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw ne(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw ne(o)}}};var Gm=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 Un from"js-cookie";function Vm(e){return e instanceof ho?"email":e instanceof Xo?"sms":e instanceof Qo?"siwe":e instanceof Sn?"custom_auth":e instanceof Nr?e.meta.provider:null}import*as zm from"jose";var Hr=class{static parse(t){try{return new Hr(t)}catch{return null}}constructor(t){this.value=t,this._decoded=zm.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 O3=30,Vs=class{constructor(){this.authenticateOnce=new Ve(async t=>this._authenticate(t)),this.linkOnce=new Ve(async t=>this._link(t)),this.refreshOnce=new Ve(this._refresh.bind(this)),this.destroyOnce=new Ve(this._destroy.bind(this)),this.forkSessionOnce=new Ve(this._forkSession.bind(this))}get token(){try{let t=Z.get(qo);return typeof t=="string"?new Hr(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=Z.get(os);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=Z.get(Ii);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=Un.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!==qu}hasRecoveryCredentials(){return typeof this.forkedToken=="string"}hasActiveToken(){let t=Hr.parse(this.token);return t!==null&&!t.isExpired(O3)}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()}async _authenticate(t){try{let r=await t.authenticate(),{user:o,is_new_user:n,oauth_provider_tokens:i}=r;this.handleTokenResponse(r);let a=i?{provider:i.provider,accessToken:i.access_token,accessTokenExpiresInSeconds:i.access_token_expires_in_seconds,refreshToken:i.refresh_token,scopes:i.scopes}:void 0,l=Vm(t);return l&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate",payload:{method:l,isNewUser:n}}),l==="siwe"&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate_siwe",payload:{connectorType:t.meta.connectorType,walletClientType:t.meta.walletClientType}}),{user:Kt(o),isNewUser:n,oAuthProviderTokens:a}}catch(r){throw console.warn("Error authenticating session"),pt(r)}}async _link(t){try{let r=await t.link(),o=r.oauth_provider_tokens,n=o?{provider:o.provider,accessToken:o.access_token,accessTokenExpiresInSeconds:o.access_token_expires_in_seconds,refreshToken:o.refresh_token,scopes:o.scopes}:void 0;return{user:Kt(r),oAuthProviderTokens:n}}catch(r){throw console.warn("Error linking account"),pt(r)}}async _refresh(){if(!this.api)throw new b("Session has no API instance");if(!this.client)throw new b("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let t=this.token,r=this.refreshToken,o=this.forkedToken;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(Va,a,{headers:i}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(qa,{refresh_token:o}),this.clearForkedToken();else return null;return this.handleTokenResponse(n),Kt(n.user)}catch(n){if(n instanceof wr&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw pt(n)}}handleTokenResponse(t){t.session_update_action?t.session_update_action==="set"?(this.storeRefreshToken(t.refresh_token),this.storeToken(t.token)):t.session_update_action==="clear"?this.destroyLocalState():t.session_update_action==="ignore"&&t.token&&this.storeToken(t.token):(this.storeRefreshToken(t.refresh_token),this.storeToken(t.token))}async _destroy(){try{await this.api?.post(za,{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new b("Session has no API instance");let t=this.refreshToken;try{let r=await this.api.post(Lp,{refresh_token:t});return this.storeRefreshToken(r.refresh_token),this.storeToken(r.token),r.new_session_refresh_token}catch(r){throw pt(r)}}destroyLocalState(){this.storeRefreshToken(null),this.storeToken(null),this.clearForkedToken()}storeToken(t){if(typeof t=="string"){let r=Z.get(qo);if(Z.put(qo,t),!this.client?.useServerCookies){let o=Hr.parse(t)?.expiration;Un.set(xc,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}r!==t&&this.client?.onStoreToken?.(t)}else Z.del(qo),Un.remove(xc),this.client?.onDeleteToken?.()}storeRefreshToken(t){typeof t=="string"?(Z.put(os,t),this.client?.useServerCookies||Un.set(ns,"t",{sameSite:"Strict",secure:!0,expires:30})):(Z.del(os),Un.remove(Uu),Un.remove(ns))}clearForkedToken(){Z.del(Ii)}};var Vc,zs,qm,qi=class{constructor(t){Ba(this,zs);this.apiUrl=t.apiUrl||Ri,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||Nu,this.appId=t.appId,this.appClientId=t.appClientId,this.clientAnalyticsId=Wp(this,zs,qm).call(this),Vc||(Vc=new Vs),this.session=Vc,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 zi(this.appId,t,r,o,n,i,a,l,s,c))}sessionHasActiveToken(){return this.session.hasActiveToken()}generateApi(){let t=new Gs({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 b("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new b("No auth flow in progress.");return this.session.link(this.authFlow)}async logout(){await this.session.destroy(),this.authFlow=void 0}startAuthFlow(t){return t.api=this.api,this.authFlow=t,this.authFlow}async initMfaSmsVerification(){try{await this.api.post(fu,{action:"verify"})}catch(t){throw ne(t)}}async initMfaPasskeyVerification(){try{let t=await this.api.post(hu,{});return Gm(t.options)}catch(t){throw ne(t)}}async unlinkEmail(t){try{let r=await this.api.post(Kp,{address:t});return Kt(r)}catch(r){throw pt(r)}}async acceptTerms(){try{let t=await this.api.post(yu,{});return Kt(t)}catch(t){throw pt(t)}}async unlinkPhone(t){try{let r=await this.api.post(Jp,{phoneNumber:t});return Kt(r)}catch(r){throw pt(r)}}async unlinkWallet(t){try{let r=await this.api.post(Up,{address:t});return Kt(r)}catch(r){throw pt(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(ru,{provider:t,subject:r});return Kt(o)}catch(o){throw pt(o)}}async unlinkFarcaster(t){try{let r=await this.api.post(Vp,{fid:t});return Kt(r)}catch(r){throw pt(r)}}async unlinkTelegram(t){try{let r=await this.api.post(mu,{telegram_user_id:t});return Kt(r)}catch(r){throw pt(r)}}async unlinkPasskey(t){try{let r=await this.api.post(du,{credential_id:t});return Kt(r)}catch(r){throw pt(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($a,{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(gu,t)}catch(r){throw pt(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?Hr.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;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}}catch(t){throw pt(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()}};zs=new WeakSet,qm=function(){if(typeof window>"u")return null;try{let r=Z.get(Mi);if(typeof r=="string"&&r.length>0)return r}catch{}let t=N3();try{return Z.put(Mi,t),t}catch{return t}};import{Turnstile as G3}from"@marsidev/react-turnstile";import{useEffect as V3,useMemo as z3}from"react";import{useMemo as D3,useRef as U3,useContext as F3,useState as zc,createContext as B3}from"react";import{jsx as H3}from"react/jsx-runtime";var $m=B3({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}),Er=class extends $e{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},Km=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=U3(null),[i,a]=zc(),[l,s]=zc(),[c,u]=zc(!1),h=D3(()=>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 H3($m.Provider,{value:{...h,ref:n,enabled:o,siteKey:r,appId:t,setToken:a,setError:s,setExecuting:u,remove(){o&&(n.current?.remove(),u(!1),s(void 0),a(void 0))},reset(){o&&(n.current?.reset(),u(!1),s(void 0),a(void 0))},execute(){o&&(u(!0),n.current?.execute())},async waitForResult(){if(!o)return"";try{return await Eu(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new Er("Captcha failed",null,"captcha_timeout")}}},children:e})},ye=()=>F3($m);import{jsx as jm}from"react/jsx-runtime";var qc=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:i,setExecuting:a,ref:l}=ye(),[,s]=z3(()=>r?.split("t:")||[],[r]);if(V3(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return jm("div",{className:"hidden h-0 w-0",children:jm(G3,{...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 $8,useEffect as r2,useRef as K8,useState as j8}from"react";import i2 from"styled-components";import{createContext as q3,useContext as $3}from"react";var $c=q3({isNewUserThisSession:!1,linkingHint:null,walletConnectionStatus:null,mipdStore: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,resendEmailCode:E,resendSmsCode:E,initLoginWithHeadlessOAuth:E,loginWithHeadlessOAuth: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,recoverEmbeddedWallet:E,getFiatOnRampConfig:E,updateWallets:E,fundWallet:E,setReadyToTrue:E,requestFarcasterSignerStatus:E,initLoginWithTelegram:E,loginWithTelegram:E}),M=()=>$3($c);import{createContext as K3,useContext as j3}from"react";var he=K3({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:E,login:E,connectOrCreateWallet:E,linkEmail:E,linkPhone:E,linkFarcaster:E,linkWallet: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,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,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,isHeadlessOAuthLoading:!1,isModalOpen:!1,mfaMethods:[]}),B=()=>j3(he);import{useEffect as Y3,useState as Z3}from"react";var Ym=e=>{let[t,r]=Z3("auto");return Y3(()=>{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 J3,useContext as Q3,useEffect as X3}from"react";var Zm={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:[]}},Kc=J3(void 0),Jm=()=>Q3(Kc);function Oe(e,t){if(!t)return;let o=Jm().current[e];return X3(()=>{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 U(e,t,r,...o){for(let n of e.current[t][r])n(...o)}function qs(){let e=Jm();return(t,r,...o)=>U(e,t,r,...o)}function jc(e){Oe("configureMfa",e)}import af from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import v0 from"@heroicons/react/24/solid/DocumentCheckIcon";import C0 from"styled-components";import tn,{css as Qc}from"styled-components";import Zc from"styled-components";import{Fragment as t0,jsx as Yc,jsxs as r0}from"react/jsx-runtime";var ot=({success:e,fail:t})=>r0(t0,{children:[Yc(nt,{className:e?"success":t?"fail":""}),Yc(Jc,{className:e?"success":t?"fail":""})]}),nt=Zc.span`
12
+ - https://privy.io`;this.getNonceOnce=new Fe(this._getNonceOnce.bind(this)),this.wallet=t,this.captchaToken=r}get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType}}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign(),o=await this.api.post(Vp,{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,is_new_user:o.is_new_user}}catch(t){throw te(t)}}async link(){if(!this.api)throw new w("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign();return await this.api.post(zp,{message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw te(t)}}async sign(){if(!this.api)throw new w("Auth flow has no API 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.api)throw new w("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(Gp,{address:t,token:this.captchaToken})).nonce}async buildSiweMessage(){if(!this.api)throw new w("Auth flow has no API instance");let t=this.wallet.address,r=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=this.prepareMessage(r,t,this.nonce),this.preparedMessage}prepareMessage(t,r,o){let n=window.location.host,i=window.location.origin,a="By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",s=new Date().toISOString();return this.createSiweMessage(t,r,n,i,s,o,a)}};var Xo=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(iu,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw te(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(ou,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw te(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(ru,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw te(o)}}};var Mn=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,is_new_user:t.is_new_user}}catch(t){throw te(t)}}async link(){if(!this.api)throw new w("Auth flow has no API instance");try{return await this.api.post(gu,{telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData})}catch(t){throw te(t)}}};function Hc(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 am(){let e;if(e=o3(),e)return Bc(),{...e,flowType:"login-url"};if(e=n3(),e)return Bc(),{...e,flowType:"web-app"};Bc()}function o3(){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,s=e.get("photo_url")||void 0;if(!(!t||!n||!o||!r))return{id:t,first_name:n,last_name:i,username:a,photo_url:s,auth_date:o,hash:r}}function n3(){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 Bc(){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 j(e){return e?new Date(e*1e3):null}function i3(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:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at),chainType:"ethereum",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,embeddedWallets:r.embedded_wallets,providerApp:{id:r.provider_app_id},verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(i);break;case"email":let a={address:r.address,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(a);break;case"phone":let s={number:r.phoneNumber,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(s);break;case"google_oauth":let l={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(l);break;case"spotify_oauth":let c={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(c);break;case"instagram_oauth":let u={subject:r.subject,username:r.username,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(u);break;case"twitter_oauth":let f={subject:r.subject,username:r.username,name:r.name,type:r.type,profilePictureUrl:r.profile_picture_url,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(f);break;case"discord_oauth":let h={subject:r.subject,username:r.username,email:r.email,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(h);break;case"github_oauth":let g={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(g);break;case"tiktok_oauth":let v={subject:r.subject,username:r.username,name:r.name,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(v);break;case"linkedin_oauth":let y={subject:r.subject,name:r.name,email:r.email,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(y);break;case"apple_oauth":let T={subject:r.subject,email:r.email,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(T);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)});break;case"farcaster":let _={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:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at),signerPublicKey:r.signer_public_key};t.push(_);break;case"passkey":let b={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:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(b);break;case"telegram":let A={type:r.type,telegramUserId:r.telegram_user_id,firstName:r.first_name,lastName:r.last_name,username:r.username,photoUrl:r.photo_url,verifiedAt:j(r.first_verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(A);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function Nt(e,t){return e.slice().sort((r,o)=>(o.firstVerifiedAt??o.verifiedAt).getTime()-(r.firstVerifiedAt??r.verifiedAt).getTime()).find(r=>r.type===t)}var Ae=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&!t.imported)||null,Gc=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&t.imported)||null,a3=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),Dt=(e,t)=>t==="all-users"&&!Ae(e)||t==="users-without-wallets"&&!a3(e)?.length;function jt(e){if(!e)return null;let t=i3(e.linked_accounts),r=Nt(t,"wallet"),o=Nt(t,"email"),n=Nt(t,"phone"),i=Nt(t,"google_oauth"),a=Nt(t,"twitter_oauth"),s=Nt(t,"discord_oauth"),l=Nt(t,"github_oauth"),c=Nt(t,"spotify_oauth"),u=Nt(t,"instagram_oauth"),f=Nt(t,"tiktok_oauth"),h=Nt(t,"linkedin_oauth"),g=Nt(t,"apple_oauth"),v=Nt(t,"farcaster"),y=Nt(t,"telegram"),T=e.mfa_methods.map(({type:b,verified_at:A})=>({type:b,verifiedAt:j(A)}));return{id:e.id,createdAt:j(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:s&&{subject:s.subject,username:s.username,email:s.email},github:l&&{subject:l.subject,username:l.username,name:l.name,email:l.email},spotify:c&&{subject:c.subject,email:c.email,name:c.name},instagram:u&&{subject:u.subject,username:u.username},tiktok:f&&{subject:f.subject,username:f.username,name:f.name},linkedin:h&&{subject:h.subject,name:h.name,email:h.email},apple:g&&{subject:g.subject,email:g.email},farcaster:v&&{fid:v.fid,ownerAddress:v.ownerAddress,displayName:v.displayName,username:v.username,bio:v.bio,pfp:v.pfp,url:v.url,signerPublicKey:v.signerPublicKey},telegram:y&&{telegramUserId:y.telegramUserId,firstName:y.firstName,lastName:y.lastName,username:y.username,photoUrl:y.photoUrl},mfaMethods:T.map(b=>b.type),hasAcceptedTerms:e.has_accepted_terms??!1}}import{getAddress as $m}from"@ethersproject/address";import{isHexString as q3}from"@ethersproject/bytes";import $3 from"eventemitter3";import y3 from"@coinbase/wallet-sdk";import{jsx as sm,jsxs as s3}from"react/jsx-runtime";var Gi=({style:e,...t})=>s3("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:[sm("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),sm("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 Fr}from"@ethersproject/address";import{Web3Provider as mm}from"@ethersproject/providers";import{default as f3}from"eventemitter3";import m3 from"eventemitter3";var l3=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],lm=e=>l3.includes(e);import{ErrorCode as c3}from"@ethersproject/logger";var Wn=class extends ne{constructor(){super("Wallet timeout");this.type="wallet_error"}},Ln=class extends ne{constructor(){super("User rejected connection");this.type="wallet_error"}},br=e=>{if(e instanceof ne)return e;if(e?.code&&e?.reason){let t=new ze(e);return e.code===c3.ACTION_REJECTED&&(t.details=mt.E4001_USER_REJECTED_REQUEST),t}return e?.code?new ze(e):new ne("Unknown connector error",e)},Yt=class extends Ke{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},ze=class extends Yt{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(mt).find(i=>i.eipCode===o.code);this.details=n||mt.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=mt.E32002_CONNECTION_ALREADY_PENDING:this.details=mt.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=mt.E32002_WALLET_LOCKED))}},d3={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}},p3={E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}},u3={E4001_DEFAULT_USER_REJECTED_REQUEST:{eipCode:4001,message:"User Rejected Request",detail:"The user rejected the request.",default:!0,retryable:!0},E4100_DEFAULT_UNAUTHORIZED:{eipCode:4100,message:"Unauthorized",detail:"The requested method and/or account has not been authorized by the user.",default:!0,retryable:!1},E4200_DEFAULT_UNSUPPORTED_METHOD:{eipCode:4200,message:"Unsupported Method",detail:"The Provider does not support the requested method.",default:!0,retryable:!1},E4900_DEFAULT_DISCONNECTED:{eipCode:4900,message:"Disconnected",detail:"The Provider is disconnected from all chains.",default:!0,retryable:!0},E4901_DEFAULT_CHAIN_DISCONNECTED:{eipCode:4901,message:"Chain Disconnected",detail:"The Provider is not connected to the requested chain.",default:!0,retryable:!0},E32700_DEFAULT_PARSE_ERROR:{eipCode:-32700,message:"Parse error",detail:"Invalid JSON",default:!0,retryable:!1},E32600_DEFAULT_INVALID_REQUEST:{eipCode:-32600,message:"Invalid request",detail:"JSON is not a valid request object",default:!0,retryable:!1},E32601_DEFAULT_METHOD_NOT_FOUND:{eipCode:-32601,message:"Method not found",detail:"Method does not exist",default:!0,retryable:!1},E32602_DEFAULT_INVALID_PARAMS:{eipCode:-32602,message:"Invalid params",detail:"Invalid method parameters",default:!0,retryable:!1},E32603_DEFAULT_INTERNAL_ERROR:{eipCode:-32603,message:"Internal error",detail:"Internal JSON-RPC error",default:!0,retryable:!0},E32000_DEFAULT_INVALID_INPUT:{eipCode:-32e3,message:"Invalid input",detail:"Missing or invalid parameters",default:!0,retryable:!1},E32001_DEFAULT_RESOURCE_NOT_FOUND:{eipCode:-32001,message:"Resource not found",detail:"Requested resource not found",default:!0,retryable:!1},E32002_DEFAULT_RESOURCE_UNAVAILABLE:{eipCode:-32002,message:"Resource unavailable",detail:"Requested resource not available",default:!0,retryable:!0},E32003_DEFAULT_TRANSACTION_REJECTED:{eipCode:-32003,message:"Transaction rejected",detail:"Transaction creation failed",default:!0,retryable:!0},E32004_DEFAULT_METHOD_NOT_SUPPORTED:{eipCode:-32004,message:"Method not supported",detail:"Method is not implemented",default:!0,retryable:!1},E32005_DEFAULT_LIMIT_EXCEEDED:{eipCode:-32005,message:"Limit exceeded",detail:"Request exceeds defined limit",default:!0,retryable:!1},E32006_DEFAULT_JSON_RPC_VERSION_NOT_SUPPORTED:{eipCode:-32006,message:"JSON-RPC version not supported",detail:"Version of JSON-RPC protocol is not supported",default:!0,retryable:!1}},mt={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...u3,...p3},io={...d3,...mt};var He=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 Wn,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||jo,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 ne(`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 br(r)})}},Co=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},Vi=class extends m3{constructor(r,o,n,i,a,s=1){super();this.walletProxy=r,this.address=o,this.chainId=s,this.rpcConfig=n,this.chains=i,this.provider=oo(s,this.chains,n,{appId:a}),this.rpcTimeoutDuration=On(n,"privy"),this.appId=a}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new Co(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await Ee()||!this.address)throw new Co("Disconnected",4900);return(await pm(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new Co(`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 Co(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=oo(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 cm(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 dm(Wi(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:Vo(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 Vo(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(lm(r.method)){let o=await Ee();if(await um(),!o||!this.address)throw new Co("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 Co("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await Ee();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}}},Ur=class extends He{constructor(r){super(r,r.rpcTimeoutDuration)}},wo=class extends He{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 h3=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},Ut=class extends f3{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=xn(r),this.walletClientType==="privy"&&Y.put(ms(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=On(i,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n,i){let a=async()=>!!this.wallets.find(s=>Fr(s.address)===Fr(r));return{address:Fr(r),chainId:o,meta:n,imported:i,switchChain:async s=>{if(!a)throw new ne("Wallet is not currently connected.");let l=this.wallets.find(g=>Fr(g.address)===Fr(r))?.chainId;if(!l)throw new ne("Unable to determine current chainId.");let c,u;if(typeof s=="number"?(c=`0x${s.toString(16)}`,u=s):(c=s,u=Number(s)),l===xn(c))return;let f=this.chains.find(g=>g.id===u);if(!f)throw new ne(`Unsupported chainId: ${s}`);let h=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:c}]})};try{return await h()}catch(g){if(h3(g,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??""]}]}),h();throw this.walletClientType==="rainbow"&&g.message?.includes("wallet_switchEthereumChain")?new ne(`Rainbow does not support the chainId ${o}`):g}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:a,getEthereumProvider:async()=>{if(!await a())throw new ne("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await a())throw new ne("Wallet is not currently connected.");return new mm(new Ur(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await a())throw new ne("Wallet is not currently connected.");return new wo(this.proxyProvider)},sign:async s=>{if(!await a())throw new ne("Wallet is not currently connected.");return await this.sign(s)},disconnect:()=>{this.disconnect()}}}async syncAccounts(r){let o=r;try{if(o===void 0){let c=await Mi(()=>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=Fr(n),a=[],s;if(this.walletClientType==="privy"){let c=Y.get(ms(i));this.chains.find(u=>u.id===Number(c))||(Y.del(ms(i)),c=null),s=c||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:s}]})}catch{console.warn(`Unable to switch embedded wallet to chain ID ${s} on initialization`)}}else try{let c=await Mi(()=>this.proxyProvider.request({method:"eth_chainId"}),{maxAttempts:10,delayMs:500});if(typeof c=="string")s=c;else if(typeof c=="number")s=`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 ${Dc}`,c),s=Dc}let l=xn(s);if(!a.find(c=>Fr(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(Fr(n),l,c,this.connectorType==="embedded_imported"))}As(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=>Fr(n)===Fr(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 mm(new Ur(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 g3=[1,11155111,137,10,8453,84532,42161,7777777,43114,56],v3=(e,t)=>e.makeWeb3Provider({options:t}),Vc,xs=class extends Ut{constructor(r,o,n,i,a,s){super("coinbase_wallet",r,o,n);this.connectorType="coinbase_wallet";this.displayName="Coinbase Wallet";if(this.proxyProvider=new He(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.connectionOptions=i.coinbaseWallet.connectionOptions??"eoaOnly",this.walletClientType=this.connectionOptions==="smartWalletOnly"?"coinbase_smart_wallet":"coinbase_wallet",this.walletClientType==="coinbase_smart_wallet"&&(this.displayName="Coinbase Smart Wallet"),!Vc){let l=[o.id].concat(r.map(u=>u.id)),c=this.connectionOptions!=="eoaOnly"?l.filter(u=>!g3.includes(u)):[];c.length>0&&console.warn(`The following configured chains are not supported by the Coinbase Smart Wallet: ${c.join(", ")}`),Vc=new y3({appName:a,appLogoUrl:s,appChainIds:l})}this.proxyProvider.setWalletProvider(v3(Vc,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:Gi,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 ne("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([r[0]])}catch(r){throw br(r)}}};import{jsx as fm}from"react/jsx-runtime";var ks=({...e})=>fm("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:fm("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 zi=class extends Ut{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:[Vo(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:ks,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};import{jsx as hm}from"react/jsx-runtime";var Nn=({style:e,...t})=>hm("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:hm("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 Zt,jsxs as C3}from"react/jsx-runtime";var Dn=({style:e,...t})=>C3("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:[Zt("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),Zt("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),Zt("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"}),Zt("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"}),Zt("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"}),Zt("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"}),Zt("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"}),Zt("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"}),Zt("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"}),Zt("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"}),Zt("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"}),Zt("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"}),Zt("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 ym,jsxs as w3}from"react/jsx-runtime";var Br=({style:e,...t})=>w3("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:[ym("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),ym("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 Fn=class extends Ut{constructor(r,o,n,i,a){super(a||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new He(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=i;let s=i.provider;this.proxyProvider.setWalletProvider(s)}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 ne("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw br(r)}}},Un,Bn=class extends Ut{constructor(r,o,n,i,a){super(a??"unknown",r,o,n);this.connectorType="injected";Ka(this,Un,void 0);this.proxyProvider=new He(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(i),a==="metamask"?xc(this,Un,{name:"MetaMask",icon:Dn,id:"io.metamask"}):a==="phantom"&&xc(this,Un,{name:"Phantom",icon:Br,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 Fp(this,Un)??{name:"Browser Extension",icon:Nn,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 ne("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw br(r)}}};Un=new WeakMap;import{getAddress as c_}from"@ethersproject/address";import{Web3Provider as p_}from"@ethersproject/providers";import{isMobile as b3}from"react-device-detect";var Rs=class extends Fn{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{b3||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 ne("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw br(t)}}};var Is=class extends Ut{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new He(void 0,jo);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 Ms=class extends Is{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:Br,id:"phantom"}}};import{EthereumProvider as H3,OPTIONAL_EVENTS as G3,OPTIONAL_METHODS as V3}from"@walletconnect/ethereum-provider";import{isMobile as z3}from"react-device-detect";import{createContext as W3,useContext as L3,useEffect as Kc,useRef as O3,useState as N3}from"react";import{jsx as E3}from"react/jsx-runtime";function Ws({src:e,...t}){return E3("img",{src:e,...t,style:{display:"none"}})}import{useContext as Hm,useEffect as Bm,useMemo as k3,useState as R3}from"react";import{createContext as I3}from"react";var Jt={appearance:{landingHeader:"Log in or sign up",theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:Bu,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},externalWallets:{coinbaseWallet:{connectionOptions:"eoaOnly"}},captchaEnabled:!1,_render:{standalone:!1},fiatOnRamp:{useSandbox:!1}};var gm=({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 T3=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets","rabby_wallet"]),vm=e=>T3.has(e),Cm=(e,t,r)=>r.indexOf(e)===t,wm=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(vm).filter(Cm):e?e.filter(vm).filter(Cm):Jt.appearance.walletList;var Ls={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 Os={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 Ns={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 bm={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 Em={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 Ds={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 Us={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 Fs={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 Tm={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 Pm={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 _m={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 Sm={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 Am={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 xm={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 km={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 Rm={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 Im={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 Mm={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 Bs={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 Hs={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 Gs={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 Vs={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 qi={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 $i={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 Wm={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 Lm={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 Om={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 zs={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 qs={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 $s={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 Ki=[Ls,Os,Ns,km,Om,Bs,Hs,Gs,Vs,qi,$i,Pm,_m,Sm,Am,Ds,Us,Fs,Tm,Im,Mm,bm,Em,zs,$s,qs,Rm,Wm,xm,Lm],DS=new Set(Ki.map(e=>e.id));import en from"tinycolor2";var Nm="#FFFFFF",P3="#000000",_3=Nm,S3="#1E1E1D";function A3(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 ao(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return en({...e.toHsl(),l:r})}function Dm({backgroundTheme:e,accentHex:t,successHex:r="#51BA81",warnHex:o="#FFB74D",errorHex:n="#EC6351",whiteHex:i=Nm,blackHex:a=P3}){let s;switch(e){case"light":s=_3;break;case"dark":s=S3;break;default:s=e;break}let l=en(s),c=en(t),u=en(r),f=en(o),h=en(n),g=A3(l.getLuminance()),v=ao(l,g==="light"?-.04:.11),y=ao(l,g==="light"?-.88:.87),T=ao(l,g==="light"?-.77:.75),_=ao(l,g==="light"?-.43:.45).desaturate(g==="light"?60:20),b=ao(l,g==="light"?-.08:.25).desaturate(g==="light"?60:20),A=ao(c,.15),k=ao(c,-.06),N=ao(h,.3),R=en(c.getLuminance()>.5?a:i),I=ao(u,-.16);return{colorScheme:g,background:l.toHslString(),background2:v.toHslString(),foreground:y.toHslString(),foreground2:T.toHslString(),foreground3:_.toHslString(),foreground4:b.toHslString(),accent:c.toHslString(),accentLight:A.toHslString(),accentDark:k.toHslString(),foregroundAccent:R.toHslString(),success:u.toHslString(),successDark:I.toHslString(),error:h.toHslString(),errorLight:N.toHslString(),warn:f.toHslString()}}function zc(e,t,r){let o=r?console.warn:()=>{},n,i,a,s,l,c,u,f,h,g,v,y,T,_,b;t?.loginMethods?(n=t.loginMethods.includes("email"),i=t.loginMethods.includes("sms"),s=t.loginMethods.includes("wallet"),l=t.loginMethods.includes("google"),c=t.loginMethods.includes("twitter"),u=t.loginMethods.includes("discord"),h=t.loginMethods.includes("spotify"),g=t.loginMethods.includes("instagram"),f=t.loginMethods.includes("tiktok"),y=t.loginMethods.includes("github"),v=t.loginMethods.includes("linkedin"),T=t.loginMethods.includes("apple"),_=t.loginMethods.includes("farcaster"),b=t.loginMethods.includes("telegram")):(n=e.emailAuth,i=e.smsAuth,s=e.walletAuth,l=e.googleOAuth,c=e.twitterOAuth,u=e.discordOAuth,y=e.githubOAuth,h=e.spotifyOAuth,g=e.instagramOAuth,f=e.tiktokOAuth,v=e.linkedinOAuth,T=e.appleOAuth,_=e.farcasterAuth,b=e.telegramAuth),typeof window<"u"&&typeof window.PublicKeyCredential!="function"?a=!1:e.passkeyAuth&&(a=!0);let A=[n,i].filter(Boolean),k=[l,c,u,y,h,g,f,v,T,_,b].filter(Boolean),N=[s].filter(Boolean);if(A.length+k.length+N.length===0)throw new Error("You must enable at least one login method");let R=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;R&&N.length===0?(o("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),R=!1):!R&&k.length+A.length===0&&(o("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),R=!0),t?.loginMethods&&t.loginMethodsAndOrder&&o("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let I=wm({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),H=gm({input:t?.loginMethodsAndOrder}),G=t?.intl?.defaultCountry??"US",{chains:Z,defaultChain:W}=x3({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),q=!!t?.defaultChain,L=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,se,ue=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?L?se=t?.embeddedWallets?.noPromptOnSignature??!0:se=t?.embeddedWallets?.noPromptOnSignature??ue:se=ue,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&se!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");let{requireUserPasswordOnCreate:me,...be}=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??Jt.appearance.landingHeader,loginMessage:typeof t?.appearance?.loginMessage=="string"?t?.appearance?.loginMessage.slice(0,100):t?.appearance?.loginMessage,palette:Dm({backgroundTheme:t?.appearance?.theme??Jt.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??Jt.appearance.accentColor}),loginGroupPriority:R?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:I},loginMethods:{wallet:s,email:n,sms:i,passkey:a,google:l,twitter:c,discord:u,github:y,spotify:h,instagram:g,tiktok:f,linkedin:v,apple:T,farcaster:_,telegram:b},loginMethodsAndOrder:H,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??Jt.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??Jt.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??Jt.rpcConfig.rpcTimeouts},chains:Z,defaultChain:W,intl:{defaultCountry:G},shouldEnforceDefaultChainOnConnect:q,captchaEnabled:e.captchaEnabled??Jt.captchaEnabled,captchaSiteKey:e.captchaSiteKey,externalWallets:{coinbaseWallet:{connectionOptions:t?.externalWallets?.coinbaseWallet?.connectionOptions??Jt.externalWallets.coinbaseWallet.connectionOptions}},embeddedWallets:{...e.embeddedWalletConfig,...typeof me=="boolean"?{requireUserOwnedRecoveryOnCreate:me}:{},...L?{createOnLogin:"all-users",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...be,noPromptOnSignature:se},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:L?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??Jt.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1,telegramAuthConfiguration:e.telegramAuthConfiguration},headless:!!t?.headless,render:{standalone:t?._render?.standalone??Jt._render.standalone}}}function Um(e,t){if(!e)return{legacyCreateEmbeddedWalletFlag:t};let{appearance:r,additionalChains:o,supportedChains:n,defaultChain:i,...a}=e;return{...a,...o?{additionalChains:o.map(l=>l.id)}:void 0,...n?{supportedChains:n.map(l=>l.id)}:void 0,...i?{defaultChain:i.id}:void 0,legacyCreateEmbeddedWalletFlag:t}}function x3({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(l=>l.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(l=>l.rpcUrls.privyWalletOverride?l:Ki.find(u=>u.id===l.id)??l)}else n=Ki.concat(e??[]);let i=t?n[0]:Bs,a=r??i;if(!n.find(s=>s.id===a.id))throw new Error("`defaultChain` must be included in `supportedChains`");return{chains:n,defaultChain:a}}var Fm=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 M3}from"react/jsx-runtime";var Gm={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:""},qc=zc(Gm,void 0,!1),$c=I3({appConfig:qc,isServerConfigLoaded:!1}),Vm=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,i]=R3(null),a=k3(()=>zc(n??Gm,o,!!n),[n,o]);return Bm(()=>{if(!n)return;let s=Um(o,t),l=Fm(JSON.stringify(s)).toString(),c=`privy:sent:${n.id}:${l}`;localStorage.getItem(c)||(r.createAnalyticsEvent({eventName:"sdk_initialize",payload:s}),localStorage.setItem(c,"t"))},[o,t,n]),Bm(()=>{n||(async()=>{try{let l=await r.getServerConfig();l.customApiUrl&&r.updateApiUrl(l.customApiUrl),i(l)}catch(l){console.warn("Error generating app config: ",l)}})()},[]),M3($c.Provider,{value:{appConfig:a,isServerConfigLoaded:!!n},children:e})},it=()=>{let{appConfig:e}=Hm($c);return e},Ks=()=>{let{isServerConfigLoaded:e}=Hm($c);return e};var E=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import{jsx as U3,jsxs as F3}from"react/jsx-runtime";var zm=W3({ready:!1,app:qc,currentScreen:null,lastScreen:null,navigate:E,navigateBack:E,resetNavigation:E,setModalData:E,onUserCloseViaDialogOrKeybindRef:void 0}),D3=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],qm=e=>{let t=it(),r=e.authenticated,[o,n]=N3(e.initialScreen);Kc(()=>{!r&&!D3.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let i=O3(null);Kc(()=>{e.open||(i.current=null)},[e.open]),Kc(()=>{i.current=null},[e.initialScreen]);let a={ready:!!t.id,app:t,data:e.data,setModalData:e.setModalData,currentScreen:e.initialScreen,lastScreen:o,navigate:(s,l=!0)=>{e.setInitialScreen(s),l&&n(e.initialScreen)},navigateBack:()=>{e.setInitialScreen(o)},resetNavigation:()=>{e.setInitialScreen(null),n(null)},onUserCloseViaDialogOrKeybindRef:i};return F3(zm.Provider,{value:a,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&U3(Ws,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},x=()=>L3(zm);import{jsx as Hn,jsxs as B3}from"react/jsx-runtime";var ji=({style:e,...t})=>{let{app:r}=x();return B3("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:[Hn("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),Hn("g",{clipPath:"url(#clip0_1765_9946)",children:Hn("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"})}),Hn("defs",{children:Hn("clipPath",{id:"clip0_1765_9946",children:Hn("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var Hr=class extends Ut{constructor(r,o,n,i,a,s,l,c){super(c||"unknown",n,i,o);this.connectorType="wallet_connect_v2";this.privyAppId=s,this.privyAppName=l,this.walletConnectCloudProjectId=r,this.rpcConfig=o,this.shouldEnforceDefaultChainOnConnect=a,this.proxyProvider=new He(void 0,this.rpcTimeoutDuration),c&&(this.walletEntry=cs[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=ls(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:Dn,id:"io.metamask"}:{name:xu(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||ji,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=cs[r],this.walletClientType=r,this.redirectUri=void 0,Lu(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new Ln)};this.onQrModalClosed=n,(async()=>{let a="",s=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(s?.length&&(a=s[0]),!a||a==="")throw new ne("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let l=ls(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=l?.entry,this.walletClientType=l?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=On(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(s),r()})().catch(a=>{if(a){o(br(a));return}o(new ne("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 s=Ru(a.id,this.chains,this.rpcConfig,this.privyAppId);s&&(r[a.id]=s)}let o=this.shouldEnforceDefaultChainOnConnect?[this.defaultChain.id]:[],n=this.chains.map(a=>a.id),i=await H3.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:G3,optionalMethods:V3,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(),z3&&this.walletEntry){let{redirect:s,href:l}=Mu(a,this.walletEntry);Ou({href:l,name:this.walletEntry.displayName}),this.redirectUri=s,ds(s,"_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=ls(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 Yc=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses")?.split(" ").filter(o=>q3(o)).map(o=>$m(o));return t?.length?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&t.includes(o.address)).length:!1},On=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||jo:jo,Yi=class extends $3{constructor(r,o,n,i,a,s,l,c,u,f,h){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 He:o.proxyProvider};this.privyAppId=r,this.walletConnectCloudProjectId=o,this.rpcConfig=n,this.chains=i,this.defaultChain=a,this.walletConnectors=[],this.initialized=!1,this.store=s,this.walletList=l,this.shouldEnforceDefaultChainOnConnect=c,this.externalWalletConfig=u,this.privyAppName=f,this.privyAppLogo=h,this.storedConnections=jc()}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;Y.get(Oc)&&(Y.getKeys().forEach(o=>{o.startsWith("walletconnect")&&Y.del(o)}),Y.del(Oc));let r=ku(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"),!go()&&this.walletList.includes("phantom")&&this.createWalletConnector("phantom","phantom"),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 s=new Vi(r,o,this.rpcConfig,this.chains,i,n.id),l=new zi(s,this.chains,n,this.rpcConfig);this.addWalletConnector(l)}}addImportedWalletConnector(r,o,n,i){let a=this.findWalletConnector("embedded_imported","privy");if(a)a.proxyProvider.walletProxy=r;else{let s=new Vi(r,o,this.rpcConfig,this.chains,i,n.id),l=!0,c=new zi(s,this.chains,n,this.rpcConfig,l);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=jc(),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=jc(),this.emit("walletsUpdated")}}async createWalletConnector(r,o,n){let i=this.findWalletConnector(r,o);if(i)return i instanceof Hr&&i.resetConnection(o),i;let s=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new Rs(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new Bn(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new Bn(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new Bn(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new Fn(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 Ms(this.defaultChain):new Hr(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain,this.shouldEnforceDefaultChainOnConnect,this.privyAppId,this.privyAppName,o)})();return s&&this.addWalletConnector(s),s||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}));Y.put(Nc,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=$m(r),this.emit("walletsUpdated")}};function As(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 K3=e=>e&&typeof e.address=="string"&&typeof e.connectorType=="string"&&typeof e.walletClientType=="string"&&typeof e.connectedAt=="number",jc=()=>{let e=Y.get(Nc);return e&&Array.isArray(e)&&e.map(o=>K3(o)).every(Boolean)?e:[]};import{ofetch as j3}from"ofetch";var Y3=[Za,Qa,Ja,ts],js=class{constructor({appId:t,appClientId:r,client:o,defaults:n}){this.appId=t,this.appClientId=r,this.clientAnalyticsId=o.clientAnalyticsId,this.sdkVersion=Wc,this.client=o,this.defaults=n,this.fallbackApiUrl=o.fallbackApiUrl,this.baseFetch=j3.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 s=new Headers(a.headers);s.set("privy-app-id",this.appId),this.appClientId&&s.set("privy-client-id",this.appClientId),s.set("privy-ca-id",this.clientAnalyticsId||""),s.set("privy-client",`react-auth:${this.sdkVersion}`);let l=Y3.includes(i.toString());if(!s.has("authorization")){let c=await this.client.getAccessToken({disableAutoRefresh:l});c!==null&&s.set("authorization",`Bearer ${c}`)}a.headers=s,a.retryDelay&&(a.retryDelay=a.retryDelay*3)},onRequestError:({error:i})=>{if(i instanceof DOMException&&i.name==="AbortError")throw new ja}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw te(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw te(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw te(o)}}};var Km=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 Gn from"js-cookie";function jm(e){return e instanceof yo?"email":e instanceof Xo?"sms":e instanceof Qo?"siwe":e instanceof An?"custom_auth":e instanceof Dr?e.meta.provider:null}import*as Ym from"jose";var Er=class{static parse(t){try{return new Er(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Ym.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 Z3=30,Ys=class{constructor(){this.authenticateOnce=new Fe(async t=>this._authenticate(t)),this.linkOnce=new Fe(async t=>this._link(t)),this.refreshOnce=new Fe(this._refresh.bind(this)),this.destroyOnce=new Fe(this._destroy.bind(this)),this.forkSessionOnce=new Fe(this._forkSession.bind(this))}get token(){try{let t=Y.get(zo);return typeof t=="string"?new Er(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=Y.get(ps);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=Y.get(Ni);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}getProviderAccessToken(t){try{let r=Y.get(Ui(t));if(typeof r=="string"){let o=new Er(r);return o.isExpired()?(Y.del(Ui(t)),null):o.value}else return null}catch(r){return console.error(r),null}}get mightHaveServerCookies(){try{let t=Gn.get(us);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!==Zu}hasRecoveryCredentials(){return typeof this.forkedToken=="string"}hasActiveToken(){let t=Er.parse(this.token);return t!==null&&!t.isExpired(Z3)}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"?Y.put(Ui(t),r):Y.del(Ui(t))}async _authenticate(t){try{let r=await t.authenticate(),{user:o,is_new_user:n,oauth_provider_tokens:i}=r;this.handleTokenResponse(r);let a=i?{provider:i.provider,accessToken:i.access_token,accessTokenExpiresInSeconds:i.access_token_expires_in_seconds,refreshToken:i.refresh_token,scopes:i.scopes}:void 0,s=jm(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:jt(o),isNewUser:n,oAuthProviderTokens:a}}catch(r){throw console.warn("Error authenticating session"),ut(r)}}async _link(t){try{let r=await t.link(),o=r.oauth_provider_tokens,n=o?{provider:o.provider,accessToken:o.access_token,accessTokenExpiresInSeconds:o.access_token_expires_in_seconds,refreshToken:o.refresh_token,scopes:o.scopes}:void 0;return{user:jt(r),oAuthProviderTokens:n}}catch(r){throw console.warn("Error linking account"),ut(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;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(Za,a,{headers:i}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(Qa,{refresh_token:o}),this.clearForkedToken();else return null;return this.handleTokenResponse(n),jt(n.user)}catch(n){if(n instanceof wr&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw ut(n)}}handleTokenResponse(t){t.session_update_action?t.session_update_action==="set"?(this.storeRefreshToken(t.refresh_token),this.storeToken(t.token)):t.session_update_action==="clear"?this.destroyLocalState():t.session_update_action==="ignore"&&t.token&&this.storeToken(t.token):(this.storeRefreshToken(t.refresh_token),this.storeToken(t.token))}async _destroy(){try{await this.api?.post(Ja,{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(Hp,{refresh_token:t});return this.storeRefreshToken(r.refresh_token),this.storeToken(r.token),r.new_session_refresh_token}catch(r){throw ut(r)}}destroyLocalState(){this.storeRefreshToken(null),this.storeToken(null),this.clearForkedToken()}storeToken(t){if(typeof t=="string"){let r=Y.get(zo);if(Y.put(zo,t),!this.client?.useServerCookies){let o=Er.parse(t)?.expiration;Gn.set(Lc,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}r!==t&&this.client?.onStoreToken?.(t)}else Y.del(zo),Gn.remove(Lc),this.client?.onDeleteToken?.()}storeRefreshToken(t){typeof t=="string"?(Y.put(ps,t),this.client?.useServerCookies||Gn.set(us,"t",{sameSite:"Strict",secure:!0,expires:30})):(Y.del(ps),Gn.remove(Vu),Gn.remove(us))}clearForkedToken(){Y.del(Ni)}};var Zc,Zs,Zm,Zi=class{constructor(t){Ka(this,Zs);this.apiUrl=t.apiUrl||Oi,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||Hu,this.appId=t.appId,this.appClientId=t.appClientId,this.clientAnalyticsId=Bp(this,Zs,Zm).call(this),Zc||(Zc=new Ys),this.session=Zc,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager({walletConnectCloudProjectId:t,rpcConfig:r,chains:o,defaultChain:n,store:i,walletList:a,shouldEnforceDefaultChainOnConnect:s,externalWalletConfig:l,appName:c}){this.connectors||(this.connectors=new Yi(this.appId,t,r,o,n,i,a,s,l,c))}sessionHasActiveToken(){return this.session.hasActiveToken()}generateApi(){let t=new js({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)}link(){if(!this.authFlow)throw new w("No auth flow in progress.");return this.session.link(this.authFlow)}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}startAuthFlow(t){return t.api=this.api,this.authFlow=t,this.authFlow}async initMfaSmsVerification(){try{await this.api.post(Cu,{action:"verify"})}catch(t){throw te(t)}}async initMfaPasskeyVerification(){try{let t=await this.api.post(wu,{});return Km(t.options)}catch(t){throw te(t)}}async unlinkEmail(t){try{let r=await this.api.post(eu,{address:t});return jt(r)}catch(r){throw ut(r)}}async acceptTerms(){try{let t=await this.api.post(bu,{});return jt(t)}catch(t){throw ut(t)}}async unlinkPhone(t){try{let r=await this.api.post(nu,{phoneNumber:t});return jt(r)}catch(r){throw ut(r)}}async unlinkWallet(t){try{let r=await this.api.post(qp,{address:t});return jt(r)}catch(r){throw ut(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(su,{provider:t,subject:r});return jt(o)}catch(o){throw ut(o)}}async unlinkFarcaster(t){try{let r=await this.api.post(Zp,{fid:t});return jt(r)}catch(r){throw ut(r)}}async unlinkTelegram(t){try{let r=await this.api.post(vu,{telegram_user_id:t});return jt(r)}catch(r){throw ut(r)}}async unlinkPasskey(t){try{let r=await this.api.post(hu,{credential_id:t});return jt(r)}catch(r){throw ut(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(Eu,t)}catch(r){throw ut(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?Er.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;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}}catch(t){throw ut(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()}};Zs=new WeakSet,Zm=function(){if(typeof window>"u")return null;try{let r=Y.get(Di);if(typeof r=="string"&&r.length>0)return r}catch{}let t=J3();try{return Y.put(Di,t),t}catch{return t}};import{Turnstile as o0}from"@marsidev/react-turnstile";import{useEffect as n0,useMemo as i0}from"react";import{useMemo as Q3,useRef as X3,useContext as e0,useState as Jc,createContext as t0}from"react";import{jsx as r0}from"react/jsx-runtime";var Jm=t0({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}),Tr=class extends Ke{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},Qm=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=X3(null),[i,a]=Jc(),[s,l]=Jc(),[c,u]=Jc(!1),f=Q3(()=>o?!c&&!i&&!s?{status:"ready"}:c&&!i&&!s?{status:"loading"}:i&&!s?{status:"success",token:i}:s?{status:"error",error:s}:{status:"ready"}:{status:"disabled"},[o,i,s,c]);return r0(Jm.Provider,{value:{...f,ref:n,enabled:o,siteKey:r,appId:t,setToken:a,setError:l,setExecuting:u,remove(){o&&(n.current?.remove(),u(!1),l(void 0),a(void 0))},reset(){o&&(n.current?.reset(),u(!1),l(void 0),a(void 0))},execute(){o&&(u(!0),n.current?.execute())},async waitForResult(){if(!o)return"";try{return await Au(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new Tr("Captcha failed",null,"captcha_timeout")}}},children:e})},ge=()=>e0(Jm);import{jsx as Xm}from"react/jsx-runtime";var Qc=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:i,setExecuting:a,ref:s}=ge(),[,l]=i0(()=>r?.split("t:")||[],[r]);if(n0(()=>s.current?.remove,[]),!t)return null;if(!l)throw new Error("Unsupported captcha site key");return Xm("div",{className:"hidden h-0 w-0",children:Xm(o0,{...e,ref:s,siteKey:l,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{s.current?.reset(),n(void 0),i(void 0)}catch{n("expired_and_failed_reset")}}})})};import{useCallback as cE,useEffect as f2,useRef as dE,useState as pE}from"react";import g2 from"styled-components";import{createContext as a0,useContext as s0}from"react";var Xc=a0({isNewUserThisSession:!1,linkingHint:null,walletConnectionStatus:null,mipdStore: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,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,recoverEmbeddedWallet:E,getFiatOnRampConfig:E,updateWallets:E,fundWallet:E,setReadyToTrue:E,requestFarcasterSignerStatus:E,initLoginWithTelegram:E,loginWithTelegram:E}),M=()=>s0(Xc);import{createContext as l0,useContext as c0}from"react";var ye=l0({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,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,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,signMessageWithCrossAppWallet:E,signTypedDataWithCrossAppWallet:E,sendTransactionWithCrossAppWallet:E,isHeadlessOAuthLoading:!1,isModalOpen:!1,mfaMethods:[]}),F=()=>c0(ye);import{useEffect as d0,useState as p0}from"react";var ef=e=>{let[t,r]=p0("auto");return d0(()=>{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 u0,useContext as m0,useEffect as f0}from"react";var tf={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:[]}},ed=u0(void 0),rf=()=>m0(ed);function Be(e,t){if(!t)return;let o=rf().current[e];return f0(()=>{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 U(e,t,r,...o){for(let n of e.current[t][r])n(...o)}function Js(){let e=rf();return(t,r,...o)=>U(e,t,r,...o)}function td(e){Be("configureMfa",e)}import mf from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import L0 from"@heroicons/react/24/solid/DocumentCheckIcon";import O0 from"styled-components";import tn,{css as of}from"styled-components";import od from"styled-components";import{Fragment as y0,jsx as rd,jsxs as g0}from"react/jsx-runtime";var Je=({success:e,fail:t})=>g0(y0,{children:[rd(at,{className:e?"success":t?"fail":""}),rd(nd,{className:e?"success":t?"fail":""})]}),at=od.span`
13
13
  && {
14
14
  width: 82px;
15
15
  height: 82px;
@@ -42,22 +42,23 @@ Resources:
42
42
  border-color: var(--privy-color-error);
43
43
  border-bottom-color: var(--privy-color-error);
44
44
  }
45
- `,Jc=Zc(nt)`
45
+ `,nd=od(at)`
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
- `,io=e=>Yc(e0,{color:e.color||"var(--privy-color-foreground-3)"}),e0=Zc(nt)`
51
+ `,Gr=e=>rd(h0,{color:e.color||"var(--privy-color-foreground-3)"}),h0=od(at)`
52
52
  && {
53
- height: 0.9rem;
54
- width: 0.9rem;
53
+ height: 1rem;
54
+ width: 1rem;
55
+ margin: 2px 0;
55
56
  border-width: 1.5px;
56
57
 
57
58
  /* Override default Loader to match button transitions */
58
59
  transition: border-color 200ms ease;
59
60
  }
60
- `;import{jsx as dr,jsxs as js}from"react/jsx-runtime";var $s=tn.button`
61
+ `;import{jsx as Ft,jsxs as Xs}from"react/jsx-runtime";var Ji=tn.button`
61
62
  display: flex;
62
63
  flex-direction: row;
63
64
  align-items: center;
@@ -69,7 +70,7 @@ Resources:
69
70
  cursor: pointer;
70
71
  border-radius: var(--privy-border-radius-md);
71
72
 
72
- font-size: 16px;
73
+ font-size: 1rem;
73
74
  font-style: normal;
74
75
  font-weight: 500;
75
76
  line-height: 22px; /* 137.5% */
@@ -79,19 +80,33 @@ Resources:
79
80
  && {
80
81
  padding: 12px 16px;
81
82
  }
83
+ `,D=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Ft(af,{disabled:t||r,...n,children:t?Xs("span",{children:[Ft(Gr,{}),o?Ft("span",{children:o}):null]}):e}),nf=({children:e,loading:t,disabled:r,...o})=>Ft(v0,{disabled:r,...o,children:t?Ft(Gr,{color:"var(--privy-color-foreground-accent)"}):e}),v0=tn(Ji)`
84
+ position: relative;
82
85
 
83
- &&:disabled {
84
- background-color: var(--privy-color-background-2);
85
- color: var(--privy-color-foreground-3);
86
+ && {
87
+ background-color: var(--privy-color-accent);
88
+ color: var(--privy-color-foreground-accent);
89
+
90
+ transition: background-color 200ms ease;
91
+ }
92
+
93
+ &:hover {
94
+ background-color: var(--privy-color-accent-dark);
95
+ }
96
+
97
+ &:active {
98
+ background-color: var(--privy-color-accent-dark);
99
+ }
100
+
101
+ &:disabled,
102
+ &:hover:disabled,
103
+ &:active:disabled {
86
104
  cursor: not-allowed;
105
+ pointer-events: none;
106
+ color: var(--privy-color-foreground-accent);
107
+ background-color: var(--privy-color-accent-dark);
87
108
  }
88
- `,N=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>dr(Qm,{disabled:t||r,...n,children:t?js("span",{children:[dr(io,{}),o?dr("span",{children:o}):null]}):e}),MA=tn(N)`
89
- ${e=>e.hideAnimations&&Qc`
90
- && {
91
- transition: none;
92
- }
93
- `}
94
- `,Ks=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>dr(Qm,{as:"a",disabled:t||r,...n,children:t?js("span",{children:[dr(io,{}),o?dr("span",{children:o}):null]}):e}),Qm=tn($s)`
109
+ `,Qs=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Ft(af,{as:"a",disabled:t||r,...n,children:t?Xs("span",{children:[Ft(Gr,{}),o?Ft("span",{children:o}):null]}):e}),af=tn(Ji)`
95
110
  position: relative;
96
111
 
97
112
  && {
@@ -117,7 +132,7 @@ Resources:
117
132
  }
118
133
 
119
134
  /* If an anchor tag, :disabled isn't a thing, so manually set state */
120
- ${e=>e.disabled?Qc`
135
+ ${e=>e.disabled?of`
121
136
  &&&,
122
137
  &&&:hover,
123
138
  &&&:active {
@@ -136,7 +151,7 @@ Resources:
136
151
  opacity: 1;
137
152
  animation: fadein 200ms ease;
138
153
  }
139
- `,Tr=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>dr(o0,{disabled:t||r,...n,children:t?js("span",{children:[dr(io,{}),o?dr("span",{children:o}):null]}):e}),o0=tn($s)`
154
+ `,Pr=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Ft(C0,{disabled:t||r,...n,children:t?Xs("span",{children:[Ft(Gr,{}),o?Ft("span",{children:o}):null]}):e}),C0=tn(Ji)`
140
155
  && {
141
156
  border-width: 1px;
142
157
  border-color: ${e=>e.warn?"var(--privy-color-error)":"var(--privy-color-foreground-4)"};
@@ -165,7 +180,7 @@ Resources:
165
180
  opacity: 1;
166
181
  animation: fadein 200ms ease;
167
182
  }
168
- `,Fn=tn.button`
183
+ `,Vn=tn.button`
169
184
  && {
170
185
  padding: 12px 16px;
171
186
  font-weight: 500;
@@ -178,7 +193,7 @@ Resources:
178
193
  transition: opacity 200ms ease, background-color 200ms ease, color 200ms ease;
179
194
  user-select: none;
180
195
 
181
- ${e=>e.invisible&&Qc`
196
+ ${e=>e.invisible&&of`
182
197
  pointer-events: none;
183
198
  `}
184
199
 
@@ -196,10 +211,10 @@ Resources:
196
211
  cursor: not-allowed;
197
212
  }
198
213
  }
199
- `,WA=tn.div`
214
+ `,Jx=tn.div`
200
215
  /* Set to match height of SoftCtaButton to avoid reflow if conditionally rendered */
201
216
  height: 44px;
202
- `,Bn=({children:e,onClick:t,disabled:r,isSubmitting:o,...n})=>js(n0,{isSubmitting:o,onClick:t,disabled:r,...n,children:[dr("span",{children:e}),dr("span",{children:dr(io,{})})]}),n0=tn.button`
217
+ `,zn=({children:e,onClick:t,disabled:r,isSubmitting:o,...n})=>Xs(w0,{isSubmitting:o,onClick:t,disabled:r,...n,children:[Ft("span",{children:e}),Ft("span",{children:Ft(Gr,{})})]}),w0=tn.button`
203
218
  && {
204
219
  color: var(--privy-color-accent);
205
220
  font-size: 16px;
@@ -241,7 +256,7 @@ Resources:
241
256
  cursor: not-allowed;
242
257
  }
243
258
  }
244
- `;import Xm from"styled-components";import{Fragment as i0,jsx as wo,jsxs as ef}from"react/jsx-runtime";var Xc=Xm.div`
259
+ `;import sf from"styled-components";import{Fragment as b0,jsx as rn,jsxs as lf}from"react/jsx-runtime";var id=sf.div`
245
260
  margin-top: 16px;
246
261
  font-size: 13px;
247
262
  text-align: center;
@@ -250,7 +265,7 @@ Resources:
250
265
  && > a {
251
266
  color: var(--privy-color-accent);
252
267
  }
253
- `;function Hn(e){let{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:r,requireUsersAcceptTerms:o}}=e.app;if(o&&!e.alwaysShowImplicitConsent)return wo(Xc,{});if(!r&&!t)return wo(Xc,{});let n=!!(t&&r);return ef(Xc,{children:["By logging in I agree to the"," ",r&&wo("a",{href:r,target:"_blank",children:n?"Terms":"Terms of Service"}),n&&" & ",t&&wo("a",{href:t,target:"_blank",children:"Privacy Policy"})]})}var q=({protectedByPrivy:e})=>wo(V,{children:e?ef(i0,{children:[wo(Ts,{className:"hide-on-mobile"}),wo("span",{className:"hide-on-mobile",children:wo("a",{href:"https://www.privy.io/",target:"_blank",children:"Protected by Privy"})})]}):null}),V=Xm.div`
268
+ `;function qn(e){let{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:r,requireUsersAcceptTerms:o}}=e.app;if(o&&!e.alwaysShowImplicitConsent)return rn(id,{});if(!r&&!t)return rn(id,{});let n=!!(t&&r);return lf(id,{children:["By logging in I agree to the"," ",r&&rn("a",{href:r,target:"_blank",children:n?"Terms":"Terms of Service"}),n&&" & ",t&&rn("a",{href:t,target:"_blank",children:"Privacy Policy"})]})}var $=({protectedByPrivy:e})=>rn(z,{children:e?lf(b0,{children:[rn(ks,{}),rn("a",{href:"https://www.privy.io/",target:"_blank",children:"Protected by Privy"})]}):null}),z=sf.div`
254
269
  display: flex;
255
270
  align-items: center;
256
271
  justify-content: center;
@@ -277,7 +292,7 @@ Resources:
277
292
  @media all and (display-mode: standalone) {
278
293
  padding-bottom: 30px;
279
294
  }
280
- `;import a0 from"@heroicons/react/24/outline/ArrowLeftIcon";import s0 from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import l0 from"@heroicons/react/24/outline/XMarkIcon";import Gn from"styled-components";import{jsx as Ut,jsxs as tf}from"react/jsx-runtime";var c0=({backFn:e})=>Ut("div",{children:Ut(ed,{onClick:e,children:Ut(a0,{height:"16px",width:"16px",strokeWidth:2})})}),d0=({infoFn:e})=>Ut("div",{children:Ut(u0,{"aria-label":"info",onClick:e,children:Ut(s0,{height:"22px",width:"22px",strokeWidth:2})})}),p0=e=>Ut("div",{children:Ut(ed,{"aria-label":"close modal",onClick:e.onClose,children:Ut(l0,{height:"16px",width:"16px",strokeWidth:2})})});var P=({backFn:e,infoFn:t,onClose:r,title:o,closeable:n=!0})=>{let{closePrivyModal:i}=M(),a=yt();return tf(m0,{children:[tf(f0,{children:[e&&Ut(c0,{backFn:e}),t&&Ut(d0,{infoFn:t})]}),o&&Ut(y0,{id:"privy-dialog-title",children:o}),Ut(h0,{children:!a.render.standalone&&n&&Ut(p0,{onClose:r||(()=>i())})})]})},ed=Gn.button`
295
+ `;import E0 from"@heroicons/react/24/outline/ArrowLeftIcon";import T0 from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import P0 from"@heroicons/react/24/outline/XMarkIcon";import $n from"styled-components";import{jsx as Bt,jsxs as cf}from"react/jsx-runtime";var _0=({backFn:e})=>Bt("div",{children:Bt(ad,{onClick:e,children:Bt(E0,{height:"16px",width:"16px",strokeWidth:2})})}),S0=({infoFn:e})=>Bt("div",{children:Bt(x0,{"aria-label":"info",onClick:e,children:Bt(T0,{height:"22px",width:"22px",strokeWidth:2})})}),A0=e=>Bt("div",{children:Bt(ad,{"aria-label":"close modal",onClick:e.onClose,children:Bt(P0,{height:"16px",width:"16px",strokeWidth:2})})});var S=({backFn:e,infoFn:t,onClose:r,title:o,closeable:n=!0})=>{let{closePrivyModal:i}=M(),a=it();return cf(k0,{children:[cf(R0,{children:[e&&Bt(_0,{backFn:e}),t&&Bt(S0,{infoFn:t})]}),o&&Bt(M0,{id:"privy-dialog-title",children:o}),Bt(I0,{children:!a.render.standalone&&n&&Bt(A0,{onClose:r||(()=>i())})})]})},ad=$n.button`
281
296
  && {
282
297
  cursor: pointer;
283
298
  display: flex;
@@ -296,11 +311,11 @@ Resources:
296
311
  opacity: 1;
297
312
  }
298
313
  }
299
- `,u0=Gn(ed)`
314
+ `,x0=$n(ad)`
300
315
  && {
301
316
  background-color: transparent;
302
317
  }
303
- `,m0=Gn.div`
318
+ `,k0=$n.div`
304
319
  padding: 16px 0;
305
320
  display: flex;
306
321
  align-items: center;
@@ -312,31 +327,31 @@ Resources:
312
327
  font-weight: 600;
313
328
  color: var(--privy-color-foreground);
314
329
  }
315
- `,f0=Gn.div`
330
+ `,R0=$n.div`
316
331
  flex: 1;
317
332
  align-items: center;
318
333
  display: flex;
319
334
  gap: 8px;
320
- `,h0=Gn.div`
335
+ `,I0=$n.div`
321
336
  flex: 1;
322
337
  display: flex;
323
338
  justify-content: flex-end;
324
- `,y0=Gn.div`
339
+ `,M0=$n.div`
325
340
  overflow: hidden;
326
341
  white-space: nowrap;
327
342
  max-width: 100%;
328
343
  text-overflow: ellipsis;
329
344
  text-align: center;
330
345
  color: var(--privy-color-foreground-2);
331
- `;import bo,{css as g0}from"styled-components";var Ys=bo.div`
346
+ `;import bo,{css as W0}from"styled-components";var el=bo.div`
332
347
  text-align: left;
333
348
  flex-grow: 1;
334
- `,Zs=bo.div`
349
+ `,tl=bo.div`
335
350
  display: flex;
336
351
  flex-direction: column;
337
352
  justify-content: flex-end;
338
353
  flex-grow: 1;
339
- `,Pr=bo.div`
354
+ `,_r=bo.div`
340
355
  display: flex;
341
356
  flex-direction: column;
342
357
  gap: 12px;
@@ -351,13 +366,13 @@ Resources:
351
366
  &::-webkit-scrollbar {
352
367
  display: none;
353
368
  }
354
- `,rf=bo(Pr)`
369
+ `,df=bo(_r)`
355
370
  ${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;"}}
356
371
 
357
372
  background-repeat: no-repeat;
358
373
  background-size: 100% 32px, 100% 16px;
359
374
  background-attachment: local, scroll;
360
- `,of=g0`
375
+ `,pf=W0`
361
376
  && {
362
377
  width: 100%;
363
378
  font-size: 16px;
@@ -394,18 +409,18 @@ Resources:
394
409
  max-width: 24px;
395
410
  }
396
411
  }
397
- `,Js=bo.div`
412
+ `,rl=bo.div`
398
413
  text-align: center;
399
414
  font-size: 14px;
400
415
  margin-bottom: 24px;
401
416
  `,Te=bo.button`
402
- ${of}
403
- `,td=bo.a`
404
- ${of}
417
+ ${pf}
418
+ `,sd=bo.a`
419
+ ${pf}
405
420
  `,Sr=bo.div`
406
421
  width: 100%;
407
422
  ${e=>e.if?"display: none;":""}
408
- `;import it from"styled-components";var Ae=it.div`
423
+ `;import st from"styled-components";var xe=st.div`
409
424
  display: flex;
410
425
  flex-direction: column;
411
426
  align-items: center;
@@ -413,17 +428,17 @@ Resources:
413
428
  @media (max-width: 440px) {
414
429
  padding: 10px 10px 20px;
415
430
  }
416
- `,se=it.div`
431
+ `,le=st.div`
417
432
  font-size: 18px;
418
433
  line-height: 30px;
419
434
  text-align: center;
420
435
  font-weight: 600;
421
436
  margin-bottom: 10px;
422
- `,ce=it.div`
437
+ `,de=st.div`
423
438
  font-size: 0.875rem;
424
439
 
425
440
  text-align: center;
426
- `,pr=it.div`
441
+ `,pr=st.div`
427
442
  display: flex;
428
443
  flex-direction: column;
429
444
  align-items: center;
@@ -433,7 +448,7 @@ Resources:
433
448
  @media (max-width: 440px) {
434
449
  padding: 10px 10px 20px;
435
450
  }
436
- `,rn=it.div`
451
+ `,on=st.div`
437
452
  display: flex;
438
453
  flex-direction: column;
439
454
  align-items: stretch;
@@ -441,7 +456,7 @@ Resources:
441
456
  padding: 1rem 0rem 0rem;
442
457
  flex-grow: 1;
443
458
  width: 100%;
444
- `,Ft=it.div`
459
+ `,Ht=st.div`
445
460
  width: 25px;
446
461
  display: flex;
447
462
  align-items: center;
@@ -453,19 +468,19 @@ Resources:
453
468
  width: 25px !important;
454
469
  color: var(--privy-color-accent);
455
470
  }
456
- `,Bt=it.div`
471
+ `,Gt=st.div`
457
472
  display: flex;
458
473
  align-items: center;
459
474
  gap: 10px;
460
475
  font-size: 0.875rem;
461
476
  line-height: 1rem;
462
477
  text-align: left;
463
- `,gt=it.div`
478
+ `,gt=st.div`
464
479
  display: flex;
465
480
  flex-direction: column;
466
481
  gap: 10px;
467
482
  padding-top: 20px;
468
- `,Qs=it.div`
483
+ `,ol=st.div`
469
484
  display: flex;
470
485
  flex-direction: column;
471
486
  align-items: stretch;
@@ -473,11 +488,11 @@ Resources:
473
488
  padding: 1rem 0rem 0rem;
474
489
  flex-grow: 1;
475
490
  width: 100%;
476
- `,Xs=it.div`
491
+ `,nl=st.div`
477
492
  display: flex;
478
493
  gap: 5px;
479
494
  width: 100%;
480
- `,el=it.button`
495
+ `,il=st.button`
481
496
  && {
482
497
  background-color: transparent;
483
498
  color: var(--privy-color-foreground-3);
@@ -495,7 +510,7 @@ Resources:
495
510
  &&:hover {
496
511
  color: var(--privy-color-error);
497
512
  }
498
- `,tl=it.div`
513
+ `,al=st.div`
499
514
  display: flex;
500
515
  align-items: center;
501
516
  gap: 0.5rem;
@@ -505,7 +520,7 @@ Resources:
505
520
  height: 20px !important;
506
521
  width: 20px !important;
507
522
  }
508
- `,on=it.div`
523
+ `,nn=st.div`
509
524
  display: flex;
510
525
  align-items: center;
511
526
  gap: 6px;
@@ -519,15 +534,15 @@ Resources:
519
534
  display: flex !important;
520
535
  align-items: flex-end;
521
536
  }
522
- `,rl=it.div`
537
+ `,sl=st.div`
523
538
  width: 100%;
524
539
  display: flex;
525
540
  justify-content: space-between;
526
- `,nf=it.p`
541
+ `,uf=st.p`
527
542
  text-align: left;
528
543
  width: 100%;
529
544
  color: var(--privy-color-foreground-3) !important;
530
- `,$i=it.button`
545
+ `,Qi=st.button`
531
546
  display: flex;
532
547
  flex-direction: row;
533
548
  align-items: center;
@@ -557,7 +572,7 @@ Resources:
557
572
  &:hover {
558
573
  text-decoration: underline;
559
574
  }
560
- `,He=it.div`
575
+ `,Ge=st.div`
561
576
  display: flex;
562
577
  align-items: center;
563
578
  justify-content: center;
@@ -572,12 +587,12 @@ Resources:
572
587
  width: auto !important;
573
588
  color: white;
574
589
  }
575
- `,ol=it.div`
590
+ `,ll=st.div`
576
591
  color: var(--privy-color-error);
577
- `;import{Fragment as E0,jsx as Gr,jsxs as Ki}from"react/jsx-runtime";var sf=()=>{let{user:e,logout:t}=B(),{app:r,onUserCloseViaDialogOrKeybindRef:o,setModalData:n,navigate:i}=A(),{acceptTerms:a,closePrivyModal:l,createAnalyticsEvent:s}=M(),c=h=>{h?.preventDefault(),l({shouldCallAuthOnSuccess:!1}),t()};o.current=c;let u=async h=>{h.preventDefault(),await a(),e&&Nt(e,r?.embeddedWallets?.createOnLogin)?(n({createWallet:{onSuccess:()=>{},onFailure:f=>{console.error(f),s({eventName:"embedded_wallet_creation_failure_logout",payload:{error:f,screen:"AffirmativeConsentScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")):l()};return Gr(w0,{termsAndConditionsUrl:r?.legal.termsAndConditionsUrl,privacyPolicyUrl:r?.legal.privacyPolicyUrl,onAccept:u,onDecline:c})},w0=({termsAndConditionsUrl:e,privacyPolicyUrl:t,onAccept:r,onDecline:o})=>Ki(E0,{children:[Gr(P,{closeable:!1}),Gr(v0,{width:56,height:56,fill:"var(--privy-color-accent)",style:{margin:"auto"}}),Gr(se,{style:{marginTop:24},children:"One last step"}),Gr(ce,{children:"By signing up, you agree to our terms and privacy policy."}),Ki(Pr,{style:{marginTop:24},children:[e&&Ki(td,{target:"_blank",href:e,children:["View Terms ",Gr(af,{style:{marginLeft:"auto"}})]}),t&&Ki(td,{target:"_blank",href:t,children:["View Privacy Policy ",Gr(af,{style:{marginLeft:"auto"}})]})]}),Ki(b0,{style:{marginTop:24},children:[Gr(Tr,{onClick:o,children:"No thanks"}),Gr(N,{onClick:r,children:"Accept"})]}),Gr(q,{protectedByPrivy:!0})]}),b0=C0.div`
592
+ `;import{Fragment as U0,jsx as Vr,jsxs as Xi}from"react/jsx-runtime";var ff=()=>{let{user:e,logout:t}=F(),{app:r,onUserCloseViaDialogOrKeybindRef:o,setModalData:n,navigate:i}=x(),{acceptTerms:a,closePrivyModal:s,createAnalyticsEvent:l}=M(),c=f=>{f?.preventDefault(),s({shouldCallAuthOnSuccess:!1}),t()};o.current=c;let u=async f=>{f.preventDefault(),await a(),e&&Dt(e,r?.embeddedWallets?.createOnLogin)?(n({createWallet:{onSuccess:()=>{},onFailure:h=>{console.error(h),l({eventName:"embedded_wallet_creation_failure_logout",payload:{error:h,screen:"AffirmativeConsentScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")):s()};return Vr(N0,{termsAndConditionsUrl:r?.legal.termsAndConditionsUrl,privacyPolicyUrl:r?.legal.privacyPolicyUrl,onAccept:u,onDecline:c})},N0=({termsAndConditionsUrl:e,privacyPolicyUrl:t,onAccept:r,onDecline:o})=>Xi(U0,{children:[Vr(S,{closeable:!1}),Vr(L0,{width:56,height:56,fill:"var(--privy-color-accent)",style:{margin:"auto"}}),Vr(le,{style:{marginTop:24},children:"One last step"}),Vr(de,{children:"By signing up, you agree to our terms and privacy policy."}),Xi(_r,{style:{marginTop:24},children:[e&&Xi(sd,{target:"_blank",href:e,children:["View Terms ",Vr(mf,{style:{marginLeft:"auto"}})]}),t&&Xi(sd,{target:"_blank",href:t,children:["View Privacy Policy ",Vr(mf,{style:{marginLeft:"auto"}})]})]}),Xi(D0,{style:{marginTop:24},children:[Vr(Pr,{onClick:o,children:"No thanks"}),Vr(D,{onClick:r,children:"Accept"})]}),Vr($,{protectedByPrivy:!0})]}),D0=O0.div`
578
593
  display: flex;
579
594
  gap: 10px;
580
- `;import cf from"styled-components";import T0 from"styled-components";var nl=T0.span`
595
+ `;import yf from"styled-components";import F0 from"styled-components";var cl=F0.span`
581
596
  && {
582
597
  width: 82px;
583
598
  height: 82px;
@@ -592,7 +607,7 @@ Resources:
592
607
  transition: border-color 800ms;
593
608
  border-bottom-color: ${e=>e.color??"var(--privy-color-accent)"};
594
609
  }
595
- `;import P0 from"styled-components";var S0=P0.div`
610
+ `;import B0 from"styled-components";var H0=B0.div`
596
611
  display: flex;
597
612
  flex-direction: column;
598
613
  justify-content: center;
@@ -615,7 +630,7 @@ Resources:
615
630
  left: -19px;
616
631
  top: -19px;
617
632
  }
618
- `,at=S0;import{jsx as lf}from"react/jsx-runtime";var il=({style:e,...t})=>lf("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:lf("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 rd,jsx as Vr,jsxs as al}from"react/jsx-runtime";var df=()=>{let{navigate:e,app:t}=A(),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 al(rd,{children:[Vr(P,{}),al(_0,{children:[Vr(at,{children:al("div",{children:[Vr(nl,{}),Vr(il,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),al(x0,{children:[typeof r=="string"?Vr("h3",{children:r}):Vr(rd,{children:r}),typeof o=="string"?Vr("p",{children:o}):Vr(rd,{children:o})]}),t?.allowlistConfig.errorCtaLink?Vr(N,{as:"a",href:t.allowlistConfig.errorCtaLink,children:n}):Vr(N,{onClick:()=>{e("LANDING")},children:n})]})]})},_0=cf.div`
633
+ `,Qe=H0;import{jsx as hf}from"react/jsx-runtime";var dl=({style:e,...t})=>hf("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:hf("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 ld,jsx as zr,jsxs as pl}from"react/jsx-runtime";var gf=()=>{let{navigate:e,app:t}=x(),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 pl(ld,{children:[zr(S,{}),pl(G0,{children:[zr(Qe,{children:pl("div",{children:[zr(cl,{}),zr(dl,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),pl(V0,{children:[typeof r=="string"?zr("h3",{children:r}):zr(ld,{children:r}),typeof o=="string"?zr("p",{children:o}):zr(ld,{children:o})]}),t?.allowlistConfig.errorCtaLink?zr(D,{as:"a",href:t.allowlistConfig.errorCtaLink,children:n}):zr(D,{onClick:()=>{e("LANDING")},children:n})]})]})},G0=yf.div`
619
634
  display: flex;
620
635
  flex-direction: column;
621
636
  align-items: center;
@@ -623,11 +638,11 @@ Resources:
623
638
  gap: 24px;
624
639
  width: 100%;
625
640
  padding-bottom: 16px;
626
- `,x0=cf.div`
641
+ `,V0=yf.div`
627
642
  display: flex;
628
643
  flex-direction: column;
629
644
  gap: 8px;
630
- `;import R0 from"@heroicons/react/24/outline/EnvelopeIcon";import I0 from"@heroicons/react/24/outline/PhoneIcon";import{useEffect as gf,useState as sl}from"react";import{isMobile as M0}from"react-device-detect";import Zi from"styled-components";import Jt from"styled-components";var ur=Jt.div`
645
+ `;import $0 from"@heroicons/react/24/outline/EnvelopeIcon";import K0 from"@heroicons/react/24/outline/PhoneIcon";import{useEffect as Pf,useState as ul}from"react";import{isMobile as j0}from"react-device-detect";import ra from"styled-components";import Qt from"styled-components";var ur=Qt.div`
631
646
  display: flex;
632
647
  flex-direction: column;
633
648
  align-items: flex-start;
@@ -635,36 +650,36 @@ Resources:
635
650
  margin-top: auto;
636
651
  gap: 16px;
637
652
  flex-grow: 100;
638
- `,_t=Jt.div`
653
+ `,St=Qt.div`
639
654
  display: flex;
640
655
  flex-direction: column;
641
656
  align-items: center;
642
657
  justify-content: center;
643
658
  flex-grow: 1;
644
659
  width: 100%;
645
- `,pf=Jt.div`
660
+ `,vf=Qt.div`
646
661
  display: flex;
647
662
  flex-direction: column;
648
663
  align-items: center;
649
664
  width: 100%;
650
- `,Vn=Jt(_t)`
665
+ `,Kn=Qt(St)`
651
666
  padding: 20px 0;
652
- `,_r=Jt(_t)`
667
+ `,Ar=Qt(St)`
653
668
  gap: 16px;
654
- `,od=Jt.div`
669
+ `,cd=Qt.div`
655
670
  display: flex;
656
671
  flex-direction: column;
657
672
  width: 100%;
658
- `,Ze=Jt.div`
673
+ `,qe=Qt.div`
659
674
  display: flex;
660
675
  flex-direction: column;
661
676
  gap: 8px;
662
- `,Ak=Jt.div`
677
+ `,$k=Qt.div`
663
678
  display: flex;
664
679
  flex-direction: column;
665
680
  justify-content: space-between;
666
681
  height: 100%;
667
- `,uf=Jt.div`
682
+ `,Cf=Qt.div`
668
683
  display: flex;
669
684
  flex-direction: column;
670
685
  justify-content: flex-start;
@@ -687,13 +702,13 @@ Resources:
687
702
  color: var(--privy-color-foreground-3);
688
703
  font-size: 14px;
689
704
  }
690
- `,Q=Jt.div`
705
+ `,Q=Qt.div`
691
706
  height: 16px;
692
- `,re=Jt.div`
707
+ `,re=Qt.div`
693
708
  height: 12px;
694
- `,mf=Jt.div`
709
+ `,wf=Qt.div`
695
710
  position: relative;
696
- `,ff=Jt.div`
711
+ `,bf=Qt.div`
697
712
  background-color: var(--privy-color-accent);
698
713
  display: flex;
699
714
  justify-content: center;
@@ -701,9 +716,9 @@ Resources:
701
716
  border-radius: 50%;
702
717
  border-color: white;
703
718
  border-width: 2px !important;
704
- `;import nd from"styled-components";import{Fragment as k0,jsx as ji,jsxs as yf}from"react/jsx-runtime";var Yi=({title:e,description:t,children:r,...o})=>ji(hf,{...o,children:yf(k0,{children:[ji("h3",{children:e}),typeof t=="string"?ji("p",{children:t}):t,r]})}),zr=nd(Yi)`
719
+ `;import dd from"styled-components";import{Fragment as q0,jsx as ea,jsxs as Tf}from"react/jsx-runtime";var ta=({title:e,description:t,children:r,...o})=>ea(Ef,{...o,children:Tf(q0,{children:[ea("h3",{children:e}),typeof t=="string"?ea("p",{children:t}):t,r]})}),qr=dd(ta)`
705
720
  margin-bottom: 24px;
706
- `,ke=({title:e,description:t,icon:r,children:o,...n})=>yf(A0,{...n,children:[r||null,ji("h3",{children:e}),t&&typeof t=="string"?ji("p",{children:t}):t,o]}),hf=nd.div`
721
+ `,ke=({title:e,description:t,icon:r,children:o,...n})=>Tf(z0,{...n,children:[r||null,ea("h3",{children:e}),t&&typeof t=="string"?ea("p",{children:t}):t,o]}),Ef=dd.div`
707
722
  display: flex;
708
723
  flex-direction: column;
709
724
  justify-content: flex-start;
@@ -723,7 +738,7 @@ Resources:
723
738
  color: var(--privy-color-foreground-2);
724
739
  font-size: 14px;
725
740
  }
726
- `,A0=nd(hf)`
741
+ `,z0=dd(Ef)`
727
742
  align-items: center;
728
743
  text-align: center;
729
744
  gap: 16px;
@@ -731,7 +746,7 @@ Resources:
731
746
  h3 {
732
747
  margin-bottom: 24px;
733
748
  }
734
- `;import{Fragment as id,jsx as vt,jsxs as Eo}from"react/jsx-runtime";var ad=6,vf=new Array(ad).fill(""),W0=1400;var wf=()=>{let{app:e,navigate:t,navigateBack:r,setModalData:o,onUserCloseViaDialogOrKeybindRef:n}=A(),{closePrivyModal:i,resendEmailCode:a,resendSmsCode:l,getAuthMeta:s,loginWithCode:c,updateWallets:u,createAnalyticsEvent:h}=M(),{authenticated:f,logout:g,user:v}=B(),[y,S]=sl(vf),[_,w]=sl(!1),[x,k]=sl(null),[D,I]=sl(null);n.current=()=>null;let R=s()?.email?0:1,H=Fe,K=H-500;gf(()=>{if(f&&_&&v){if(e?.legal.requireUsersAcceptTerms&&!v.hasAcceptedTerms){let pe=setTimeout(()=>{t("AFFIRMATIVE_CONSENT_SCREEN")},K);return()=>clearTimeout(pe)}if(Nt(v,e?.embeddedWallets?.createOnLogin)){let pe=setTimeout(()=>{o({createWallet:{onSuccess:()=>{},onFailure:ue=>{console.error(ue),h({eventName:"embedded_wallet_creation_failure_logout",payload:{error:ue,screen:"AwaitingPasswordlessCodeScreen"}}),g()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},K);return()=>clearTimeout(pe)}else{u();let pe=setTimeout(()=>i({shouldCallAuthOnSuccess:!0,isSuccess:!0}),H);return()=>clearTimeout(pe)}}},[f,_,v]),gf(()=>{if(x&&D===0){let ae=setTimeout(()=>{S(vf),k(null),document.querySelector("input[name=code-0]")?.focus()},W0);return()=>clearTimeout(ae)}},[x]);let Y=ae=>{ae.preventDefault();let pe=ae.currentTarget.value.replace(" ","");if(pe==="")return;if(isNaN(Number(pe))){k("Code should be numeric"),I(1);return}k(null),I(null);let ue=Number(ae.currentTarget.name?.charAt(5)),be=[...pe||[""]].slice(0,ad-ue),X=[...y.slice(0,ue),...be,...y.slice(ue+be.length)];S(X);let Pt=be.length,et=Math.min(Math.max(ue+Pt,0),ad-1);isNaN(Number(ae.currentTarget.value))||document.querySelector(`input[name=code-${et}]`)?.focus(),X.every(Mt=>Mt&&!isNaN(+Mt))&&(document.querySelector(`input[name=code-${et}]`)?.blur(),c(X.join("")).then(()=>w(!0)).catch(rt=>{if(rt?.status===422)k("Invalid or expired verification code");else if(rt instanceof wr&&rt.privyErrorCode==="cannot_link_more_of_type")k(rt.message);else if(rt instanceof wr&&rt.privyErrorCode==="max_accounts_reached"){console.error(new lr(rt).toString()),t("USER_LIMIT_REACHED_SCREEN");return}else k("Issue verifying code");I(0)}))},W=ae=>{D===1&&(k(null),I(null));let pe=[...y.slice(0,ae),"",...y.slice(ae+1)];S(pe),ae>0&&document.querySelector(`input[name=code-${ae-1}]`)?.focus()},G=R==0?vt(R0,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):vt(I0,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),L=R==0?Eo("p",{children:["Please check ",vt(Cf,{children:s()?.email})," for an email from privy.io and enter your code below."]}):Eo("p",{children:["Please check ",vt(Cf,{children:s()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return Eo(id,{children:[vt(P,{backFn:()=>r()},"header"),Eo(L0,{children:[vt(ke,{title:"Enter confirmation code",description:L,icon:G}),Eo(pf,{children:[Eo(O0,{children:[vt(N0,{fail:!!x,success:_,children:vt("span",{children:x||(_?"Success!":"")})}),vt("div",{children:y.map((ae,pe)=>vt("input",{name:`code-${pe}`,type:"text",value:y[pe],onChange:Y,onKeyUp:ue=>{ue.key==="Backspace"&&W(pe)},inputMode:"numeric",autoFocus:pe===0,pattern:"[0-9]",className:`${_?"success":""} ${x?"fail":""}`,autoComplete:M0?"one-time-code":"off"},pe))})]}),vt(D0,{children:R==0?Eo(id,{children:[vt("span",{children:"Didn't get an email?"}),vt("button",{onClick:a,children:"Resend code"})]}):Eo(id,{children:[vt("span",{children:"Didn't get a message?"}),vt("button",{onClick:l,children:"Resend code"})]})})]})]}),vt(q,{protectedByPrivy:!0})]})},L0=Zi.div`
749
+ `;import{Fragment as pd,jsx as vt,jsxs as Eo}from"react/jsx-runtime";var ud=6,_f=new Array(ud).fill(""),Y0=1400;var Af=()=>{let{app:e,navigate:t,navigateBack:r,setModalData:o,onUserCloseViaDialogOrKeybindRef:n}=x(),{closePrivyModal:i,resendEmailCode:a,resendSmsCode:s,getAuthMeta:l,loginWithCode:c,updateWallets:u,createAnalyticsEvent:f}=M(),{authenticated:h,logout:g,user:v}=F(),[y,T]=ul(_f),[_,b]=ul(!1),[A,k]=ul(null),[N,R]=ul(null);n.current=()=>null;let I=l()?.email?0:1,H=Oe,G=H-500;Pf(()=>{if(h&&_&&v){if(e?.legal.requireUsersAcceptTerms&&!v.hasAcceptedTerms){let ue=setTimeout(()=>{t("AFFIRMATIVE_CONSENT_SCREEN")},G);return()=>clearTimeout(ue)}if(Dt(v,e?.embeddedWallets?.createOnLogin)){let ue=setTimeout(()=>{o({createWallet:{onSuccess:()=>{},onFailure:me=>{console.error(me),f({eventName:"embedded_wallet_creation_failure_logout",payload:{error:me,screen:"AwaitingPasswordlessCodeScreen"}}),g()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},G);return()=>clearTimeout(ue)}else{u();let ue=setTimeout(()=>i({shouldCallAuthOnSuccess:!0,isSuccess:!0}),H);return()=>clearTimeout(ue)}}},[h,_,v]),Pf(()=>{if(A&&N===0){let se=setTimeout(()=>{T(_f),k(null),document.querySelector("input[name=code-0]")?.focus()},Y0);return()=>clearTimeout(se)}},[A]);let Z=se=>{se.preventDefault();let ue=se.currentTarget.value.replace(" ","");if(ue==="")return;if(isNaN(Number(ue))){k("Code should be numeric"),R(1);return}k(null),R(null);let me=Number(se.currentTarget.name?.charAt(5)),be=[...ue||[""]].slice(0,ud-me),X=[...y.slice(0,me),...be,...y.slice(me+be.length)];T(X);let Pt=be.length,rt=Math.min(Math.max(me+Pt,0),ud-1);isNaN(Number(se.currentTarget.value))||document.querySelector(`input[name=code-${rt}]`)?.focus(),X.every(Mt=>Mt&&!isNaN(+Mt))&&(document.querySelector(`input[name=code-${rt}]`)?.blur(),c(X.join("")).then(()=>b(!0)).catch(nt=>{if(nt?.status===422)k("Invalid or expired verification code");else if(nt instanceof wr&&nt.privyErrorCode==="cannot_link_more_of_type")k(nt.message);else if(nt instanceof wr&&nt.privyErrorCode==="max_accounts_reached"){console.error(new cr(nt).toString()),t("USER_LIMIT_REACHED_SCREEN");return}else k("Issue verifying code");R(0)}))},W=se=>{N===1&&(k(null),R(null));let ue=[...y.slice(0,se),"",...y.slice(se+1)];T(ue),se>0&&document.querySelector(`input[name=code-${se-1}]`)?.focus()},q=I==0?vt($0,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):vt(K0,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),L=I==0?Eo("p",{children:["Please check ",vt(Sf,{children:l()?.email})," for an email from privy.io and enter your code below."]}):Eo("p",{children:["Please check ",vt(Sf,{children:l()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return Eo(pd,{children:[vt(S,{backFn:()=>r()},"header"),Eo(Z0,{children:[vt(ke,{title:"Enter confirmation code",description:L,icon:q}),Eo(vf,{children:[Eo(J0,{children:[vt(Q0,{fail:!!A,success:_,children:vt("span",{children:A||(_?"Success!":"")})}),vt("div",{children:y.map((se,ue)=>vt("input",{name:`code-${ue}`,type:"text",value:y[ue],onChange:Z,onKeyUp:me=>{me.key==="Backspace"&&W(ue)},inputMode:"numeric",autoFocus:ue===0,pattern:"[0-9]",className:`${_?"success":""} ${A?"fail":""}`,autoComplete:j0?"one-time-code":"off"},ue))})]}),vt(X0,{children:I==0?Eo(pd,{children:[vt("span",{children:"Didn't get an email?"}),vt("button",{onClick:a,children:"Resend code"})]}):Eo(pd,{children:[vt("span",{children:"Didn't get a message?"}),vt("button",{onClick:s,children:"Resend code"})]})})]})]}),vt($,{protectedByPrivy:!0})]})},Z0=ra.div`
735
750
  display: flex;
736
751
  flex-direction: column;
737
752
  align-items: flex-start;
@@ -739,7 +754,7 @@ Resources:
739
754
  margin: auto;
740
755
  gap: 16px;
741
756
  flex-grow: 1;
742
- `,O0=Zi.div`
757
+ `,J0=ra.div`
743
758
  display: flex;
744
759
  flex-direction: column;
745
760
  width: 100%;
@@ -796,7 +811,7 @@ Resources:
796
811
  transform: translate(1px, 0px);
797
812
  }
798
813
  }
799
- `,N0=Zi.div`
814
+ `,Q0=ra.div`
800
815
  line-height: 20px;
801
816
  height: 20px;
802
817
  font-size: 13px;
@@ -804,7 +819,7 @@ Resources:
804
819
  display: flex;
805
820
  justify-content: flex-end;
806
821
  width: 100%;
807
- `,D0=Zi.div`
822
+ `,X0=ra.div`
808
823
  font-size: 13px;
809
824
  color: var(--privy-color-foreground-3);
810
825
  display: flex;
@@ -818,10 +833,10 @@ Resources:
818
833
  > button {
819
834
  text-decoration: underline;
820
835
  }
821
- `,Cf=Zi.span`
836
+ `,Sf=ra.span`
822
837
  font-weight: 500;
823
838
  word-break: break-all;
824
- `;import G0 from"@heroicons/react/24/solid/CheckCircleIcon";import V0 from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as sd,useRef as z0,useState as qn}from"react";import q0 from"styled-components";import U0 from"styled-components";import{Fragment as H0,jsx as zn,jsxs as B0}from"react/jsx-runtime";var bf=({icon:e})=>{let t=e;return zn(H0,{children:zn(F0,{children:B0("div",{children:[zn(ot,{}),typeof t=="string"?zn("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):t?zn(t,{style:{width:"38px",height:"38px"}}):zn("span",{})]})})})},F0=U0.div`
839
+ `;import nv from"@heroicons/react/24/solid/CheckCircleIcon";import iv from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as md,useRef as av,useState as Yn}from"react";import sv from"styled-components";import ev from"styled-components";import{Fragment as ov,jsx as jn,jsxs as rv}from"react/jsx-runtime";var xf=({icon:e})=>{let t=e;return jn(ov,{children:jn(tv,{children:rv("div",{children:[jn(Je,{}),typeof t=="string"?jn("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):t?jn(t,{style:{width:"38px",height:"38px"}}):jn("span",{})]})})})},tv=ev.div`
825
840
  display: flex;
826
841
  flex-direction: column;
827
842
  justify-content: center;
@@ -844,14 +859,14 @@ Resources:
844
859
  left: -19px;
845
860
  top: -19px;
846
861
  }
847
- `;import{Fragment as K0,jsx as xr,jsxs as ld}from"react/jsx-runtime";var Tf=500,Ef=Tf*2,Pf=()=>{let{lastScreen:e,currentScreen:t,data:r,navigateBack:o,navigate:n,setModalData:i}=A(),{status:a,token:l,waitForResult:s,reset:c,execute:u}=ye(),h=z0([]),f=G=>{h.current=[G,...h.current]},[g,v]=qn(!0);sd(()=>{let G=setTimeout(v,Ef,!1);return f(G),()=>{h.current.forEach(L=>clearTimeout(L)),h.current=[]}},[]);let[y,S]=qn(""),[_,w]=qn("Checking that you are a human..."),[x,k]=qn(xr(N,{onClick:()=>{},disabled:!0,children:"Continue"})),[D,I]=qn(!1),[R,H]=qn(3),K=r?.captchaModalData,Y=async G=>{try{await K?.callback(G),K?.onSuccessNavigateTo&&n(K?.onSuccessNavigateTo,!1)}catch(L){if(L instanceof Er)return;{let ae={error:L,previousScreen:e||"LANDING"};i({errorModalData:ae}),n(K?.onErrorNavigateTo||"ERROR_SCREEN",!1)}}};sd(()=>{if(a==="success"){let G=setTimeout(async()=>{let L=await s();!L||K?.userIntentRequired||Y(L)},Ef);f(G)}else if(a==="ready"){let G=setTimeout(()=>{a==="ready"&&u()},Tf);f(G)}},[a]),sd(()=>{if(!g)switch(a){case"success":S("Success!"),w("CAPTCHA passed successfully."),k(xr(N,{onClick:()=>{I(!0),Y(l)},disabled:!K?.userIntentRequired,loading:D,children:K?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":S(""),w("Checking that you are a human..."),k(xr(N,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":S("Something went wrong"),R<=0?(w("If you use an adblocker or VPN, try disabling and re-attempting."),k(null)):(w("You did not pass CAPTCHA. Please try again."),k(xr(N,{onClick:W,children:"Retry"})));break;case"ready":default:break}},[a,g,D]);let W=async()=>{if(R<=0)return;H(L=>L-1),c(),u();let G=await s();!G||K?.userIntentRequired||Y(G)};return ld(K0,{children:[xr(P,{backFn:!e||t===e?void 0:o}),ld($0,{children:[a==="success"?xr(G0,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):a==="error"?xr(V0,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):xr(bf,{}),ld(Ze,{children:[y?xr("h3",{children:y}):null,xr("p",{children:_})]}),x]}),xr(V,{})]})},$0=q0.div`
862
+ `;import{Fragment as cv,jsx as xr,jsxs as fd}from"react/jsx-runtime";var Rf=500,kf=Rf*2,If=()=>{let{lastScreen:e,currentScreen:t,data:r,navigateBack:o,navigate:n,setModalData:i}=x(),{status:a,token:s,waitForResult:l,reset:c,execute:u}=ge(),f=av([]),h=q=>{f.current=[q,...f.current]},[g,v]=Yn(!0);md(()=>{let q=setTimeout(v,kf,!1);return h(q),()=>{f.current.forEach(L=>clearTimeout(L)),f.current=[]}},[]);let[y,T]=Yn(""),[_,b]=Yn("Checking that you are a human..."),[A,k]=Yn(xr(D,{onClick:()=>{},disabled:!0,children:"Continue"})),[N,R]=Yn(!1),[I,H]=Yn(3),G=r?.captchaModalData,Z=async q=>{try{await G?.callback(q),G?.onSuccessNavigateTo&&n(G?.onSuccessNavigateTo,!1)}catch(L){if(L instanceof Tr)return;{let se={error:L,previousScreen:e||"LANDING"};i({errorModalData:se}),n(G?.onErrorNavigateTo||"ERROR_SCREEN",!1)}}};md(()=>{if(a==="success"){let q=setTimeout(async()=>{let L=await l();!L||G?.userIntentRequired||Z(L)},kf);h(q)}else if(a==="ready"){let q=setTimeout(()=>{a==="ready"&&u()},Rf);h(q)}},[a]),md(()=>{if(!g)switch(a){case"success":T("Success!"),b("CAPTCHA passed successfully."),k(xr(D,{onClick:()=>{R(!0),Z(s)},disabled:!G?.userIntentRequired,loading:N,children:G?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":T(""),b("Checking that you are a human..."),k(xr(D,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":T("Something went wrong"),I<=0?(b("If you use an adblocker or VPN, try disabling and re-attempting."),k(null)):(b("You did not pass CAPTCHA. Please try again."),k(xr(D,{onClick:W,children:"Retry"})));break;case"ready":default:break}},[a,g,N]);let W=async()=>{if(I<=0)return;H(L=>L-1),c(),u();let q=await l();!q||G?.userIntentRequired||Z(q)};return fd(cv,{children:[xr(S,{backFn:!e||t===e?void 0:o}),fd(lv,{children:[a==="success"?xr(nv,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):a==="error"?xr(iv,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):xr(xf,{}),fd(qe,{children:[y?xr("h3",{children:y}):null,xr("p",{children:_})]}),A]}),xr(z,{})]})},lv=sv.div`
848
863
  display: flex;
849
864
  flex-direction: column;
850
865
  align-items: center;
851
866
  justify-content: center;
852
867
  gap: 24px;
853
868
  width: 100%;
854
- `;import j0 from"@heroicons/react/24/outline/WalletIcon";import{isMobile as Lf}from"react-device-detect";import Y0 from"styled-components";import{jsx as Ar,jsxs as Sf}from"react/jsx-runtime";var _f=({...e})=>Sf("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...e,children:[Ar("defs",{children:Sf("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:[Ar("stop",{offset:"0",stopColor:"#f1562b"}),Ar("stop",{offset:"0.3",stopColor:"#f1542b"}),Ar("stop",{offset:"0.41",stopColor:"#f04d2a"}),Ar("stop",{offset:"0.49",stopColor:"#ef4229"}),Ar("stop",{offset:"0.5",stopColor:"#ef4029"}),Ar("stop",{offset:"0.56",stopColor:"#e83e28"}),Ar("stop",{offset:"0.67",stopColor:"#e13c26"}),Ar("stop",{offset:"1",stopColor:"#df3c26"})]})}),Ar("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"}),Ar("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 kr,jsxs as Ji}from"react/jsx-runtime";var xf=({style:e,...t})=>Ji("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:[kr("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"}),kr("mask",{id:"mask0_16909_31415",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"400",height:"400",children:kr("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"})}),Ji("g",{mask:"url(#mask0_16909_31415)",children:[kr("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"}),kr("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"}),kr("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"}}),kr("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"}})]}),Ji("defs",{children:[Ji("linearGradient",{id:"paint0_linear_16909_31415",x1:"325.255",y1:"325.727",x2:"325.255",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[kr("stop",{stopColor:"#002D72"}),kr("stop",{offset:"1",stopColor:"#002D72",stopOpacity:"0.01"})]}),Ji("linearGradient",{id:"paint1_linear_16909_31415",x1:"184.827",y1:"325.727",x2:"184.827",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[kr("stop",{stopColor:"#002D72",stopOpacity:"0.01"}),kr("stop",{offset:"1",stopColor:"#002D72"})]})]})]});import{jsx as Qt,jsxs as $n}from"react/jsx-runtime";var Af=e=>$n("svg",{width:"52",height:"52",viewBox:"0 0 52 52",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[Qt("rect",{width:"52",height:"52",rx:"26",fill:"#7084FF"}),Qt("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)"}),Qt("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)"}),Qt("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)"}),Qt("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)"}),$n("defs",{children:[$n("linearGradient",{id:"paint0_linear_81034_11443",x1:"18.249",y1:"25.4646",x2:"43.3806",y2:"32.5728",gradientUnits:"userSpaceOnUse",children:[Qt("stop",{stopColor:"white"}),Qt("stop",{offset:"1",stopColor:"white"})]}),$n("linearGradient",{id:"paint1_linear_81034_11443",x1:"39.1432",y1:"24.9813",x2:"20.9691",y2:"6.81008",gradientUnits:"userSpaceOnUse",children:[Qt("stop",{stopColor:"#8697FF"}),Qt("stop",{offset:"1",stopColor:"#8697FF",stopOpacity:"0"})]}),$n("linearGradient",{id:"paint2_linear_81034_11443",x1:"29.7761",y1:"35.1727",x2:"12.345",y2:"25.1792",gradientUnits:"userSpaceOnUse",children:[Qt("stop",{stopColor:"#8697FF"}),Qt("stop",{offset:"1",stopColor:"#8697FF",stopOpacity:"0"})]}),$n("linearGradient",{id:"paint3_linear_81034_11443",x1:"19.7472",y1:"25.2716",x2:"31.5549",y2:"40.2352",gradientUnits:"userSpaceOnUse",children:[Qt("stop",{stopColor:"white"}),Qt("stop",{offset:"0.983895",stopColor:"#D1D8FF"})]})]})]});import{jsx as oe,jsxs as Xt}from"react/jsx-runtime";var kf=({style:e,...t})=>Xt("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:[oe("g",{clipPath:"url(#clip0_5_32)",children:Xt("g",{clipPath:"url(#clip1_5_32)",children:[oe("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:oe("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"})}),oe("g",{mask:"url(#mask0_5_32)",children:oe("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),oe("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)"}),oe("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),oe("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),oe("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),oe("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),oe("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),oe("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)"}),oe("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),oe("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),Xt("defs",{children:[Xt("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[oe("stop",{stopColor:"#174299"}),oe("stop",{offset:"1",stopColor:"#001E59"})]}),Xt("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[oe("stop",{offset:"0.770277",stopColor:"#FF4000"}),oe("stop",{offset:"1",stopColor:"#8754C9"})]}),Xt("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[oe("stop",{stopColor:"#FF4000"}),oe("stop",{offset:"1",stopColor:"#8754C9"})]}),Xt("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[oe("stop",{stopColor:"#8754C9"}),oe("stop",{offset:"1",stopColor:"#FF4000"})]}),Xt("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[oe("stop",{offset:"0.723929",stopColor:"#FFF700"}),oe("stop",{offset:"1",stopColor:"#FF9901"})]}),Xt("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[oe("stop",{stopColor:"#FFF700"}),oe("stop",{offset:"1",stopColor:"#FF9901"})]}),Xt("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[oe("stop",{stopColor:"#FFF700"}),oe("stop",{offset:"1",stopColor:"#FF9901"})]}),Xt("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[oe("stop",{offset:"0.59513",stopColor:"#00AAFF"}),oe("stop",{offset:"1",stopColor:"#01DA40"})]}),Xt("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[oe("stop",{stopColor:"#00AAFF"}),oe("stop",{offset:"1",stopColor:"#01DA40"})]}),Xt("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:[oe("stop",{stopColor:"#00AAFF"}),oe("stop",{offset:"1",stopColor:"#01DA40"})]}),oe("clipPath",{id:"clip0_5_32",children:oe("rect",{width:"120",height:"120",fill:"white"})}),oe("clipPath",{id:"clip1_5_32",children:oe("rect",{width:"120",height:"120",fill:"white"})})]})]});import{jsx as qr,jsxs as Rf}from"react/jsx-runtime";var If=({style:e,...t})=>Rf("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:[qr("rect",{width:"96",height:"96",rx:"18",fill:"#FEF4FF"}),Rf("g",{filter:"url(#filter0_d_12393_20043)",children:[qr("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"}),qr("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"}),qr("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"}),qr("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"}),qr("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"}),qr("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"}),qr("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"}),qr("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"}),qr("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 Qi,jsxs as Mf}from"react/jsx-runtime";var Wf=({style:e,...t})=>Mf("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:[Mf("g",{clipPath:"url(#clip0_1704_1423)",children:[Qi("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"}),Qi("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"})]}),Qi("defs",{children:Qi("clipPath",{id:"clip0_1704_1423",children:Qi("rect",{width:"176",height:"176",fill:"white"})})})]});import{jsx as Kn,jsxs as ev}from"react/jsx-runtime";var mr={coinbase_wallet:{logo:Di,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},coinbase_smart_wallet:{logo:Di,displayName:"Coinbase Smart Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:Wn,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:Fr,displayName:"Phantom"},rainbow:{logo:kf,displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:Vi,displayName:"WalletConnect"},zerion:{logo:Wf,displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:_f,displayName:"Brave Wallet",rdns:"com.brave.wallet"},cryptocom:{logo:xf,displayName:"Crypto.com DeFi Wallet"},uniswap:{logo:If,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:Af,displayName:"Rabby Wallet",rdns:"io.rabby.wallet"}},nn=({provider:e,displayName:t,logo:r,connectOnly:o,connector:n})=>{let{navigate:i}=A(),{connectWallet:a}=M(),l=n.connectorType==="wallet_connect_v2"?e:n.walletClientType,s;return n.connectorType==="phantom"?s=()=>{yo()?(a(n,l),i(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")):i(Lf?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:n.connectorType==="coinbase_wallet"&&n.connectionOptions==="eoaOnly"&&Lf&&!Za()?s=()=>{window.location.href=`https://go.cb-w.com/dapp?cb_url=${encodeURI(window.location.href)}`}:s=()=>{a(n,l),i(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")},ev(X0,{onClick:s,children:[Kn(Q0,{icon:J0(e,n.connectorType,n.walletClientType)??r,name:n.walletClientType}),Kn("span",{children:Z0(e,n.connectorType,n.walletClientType)||t||n.walletClientType}),Kn("span",{id:"connect-text",children:"Connect"})]})},Z0=(e,t,r)=>{if(mr[e]?.displayName)return e==="coinbase_wallet"?mr[r].displayName:mr[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},J0=(e,t,r)=>{if(mr[e]?.logo)return e==="coinbase_wallet"?mr[r].logo:mr[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return Vi},Q0=({icon:e,name:t})=>typeof e=="string"?Kn("img",{alt:`${t||"wallet"} logo`,src:e,style:{height:24,width:24,borderRadius:4}}):typeof e===void 0?Kn(j0,{}):e?Kn(e,{}):null,X0=Y0(Te)`
869
+ `;import dv from"@heroicons/react/24/outline/WalletIcon";import{isMobile as Hf}from"react-device-detect";import pv from"styled-components";import{jsx as kr,jsxs as Mf}from"react/jsx-runtime";var Wf=({...e})=>Mf("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...e,children:[kr("defs",{children:Mf("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:[kr("stop",{offset:"0",stopColor:"#f1562b"}),kr("stop",{offset:"0.3",stopColor:"#f1542b"}),kr("stop",{offset:"0.41",stopColor:"#f04d2a"}),kr("stop",{offset:"0.49",stopColor:"#ef4229"}),kr("stop",{offset:"0.5",stopColor:"#ef4029"}),kr("stop",{offset:"0.56",stopColor:"#e83e28"}),kr("stop",{offset:"0.67",stopColor:"#e13c26"}),kr("stop",{offset:"1",stopColor:"#df3c26"})]})}),kr("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"}),kr("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 Rr,jsxs as oa}from"react/jsx-runtime";var Lf=({style:e,...t})=>oa("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:[Rr("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"}),Rr("mask",{id:"mask0_16909_31415",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"400",height:"400",children:Rr("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"})}),oa("g",{mask:"url(#mask0_16909_31415)",children:[Rr("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"}),Rr("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"}),Rr("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"}}),Rr("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"}})]}),oa("defs",{children:[oa("linearGradient",{id:"paint0_linear_16909_31415",x1:"325.255",y1:"325.727",x2:"325.255",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[Rr("stop",{stopColor:"#002D72"}),Rr("stop",{offset:"1",stopColor:"#002D72",stopOpacity:"0.01"})]}),oa("linearGradient",{id:"paint1_linear_16909_31415",x1:"184.827",y1:"325.727",x2:"184.827",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[Rr("stop",{stopColor:"#002D72",stopOpacity:"0.01"}),Rr("stop",{offset:"1",stopColor:"#002D72"})]})]})]});import{jsx as Xt,jsxs as Zn}from"react/jsx-runtime";var Of=e=>Zn("svg",{width:"52",height:"52",viewBox:"0 0 52 52",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[Xt("rect",{width:"52",height:"52",rx:"26",fill:"#7084FF"}),Xt("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)"}),Xt("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)"}),Xt("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)"}),Xt("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)"}),Zn("defs",{children:[Zn("linearGradient",{id:"paint0_linear_81034_11443",x1:"18.249",y1:"25.4646",x2:"43.3806",y2:"32.5728",gradientUnits:"userSpaceOnUse",children:[Xt("stop",{stopColor:"white"}),Xt("stop",{offset:"1",stopColor:"white"})]}),Zn("linearGradient",{id:"paint1_linear_81034_11443",x1:"39.1432",y1:"24.9813",x2:"20.9691",y2:"6.81008",gradientUnits:"userSpaceOnUse",children:[Xt("stop",{stopColor:"#8697FF"}),Xt("stop",{offset:"1",stopColor:"#8697FF",stopOpacity:"0"})]}),Zn("linearGradient",{id:"paint2_linear_81034_11443",x1:"29.7761",y1:"35.1727",x2:"12.345",y2:"25.1792",gradientUnits:"userSpaceOnUse",children:[Xt("stop",{stopColor:"#8697FF"}),Xt("stop",{offset:"1",stopColor:"#8697FF",stopOpacity:"0"})]}),Zn("linearGradient",{id:"paint3_linear_81034_11443",x1:"19.7472",y1:"25.2716",x2:"31.5549",y2:"40.2352",gradientUnits:"userSpaceOnUse",children:[Xt("stop",{stopColor:"white"}),Xt("stop",{offset:"0.983895",stopColor:"#D1D8FF"})]})]})]});import{jsx as ie,jsxs as er}from"react/jsx-runtime";var Nf=({style:e,...t})=>er("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:[ie("g",{clipPath:"url(#clip0_5_32)",children:er("g",{clipPath:"url(#clip1_5_32)",children:[ie("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:ie("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"})}),ie("g",{mask:"url(#mask0_5_32)",children:ie("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),ie("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)"}),ie("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),ie("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),ie("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),ie("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),ie("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),ie("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)"}),ie("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),ie("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),er("defs",{children:[er("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[ie("stop",{stopColor:"#174299"}),ie("stop",{offset:"1",stopColor:"#001E59"})]}),er("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[ie("stop",{offset:"0.770277",stopColor:"#FF4000"}),ie("stop",{offset:"1",stopColor:"#8754C9"})]}),er("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[ie("stop",{stopColor:"#FF4000"}),ie("stop",{offset:"1",stopColor:"#8754C9"})]}),er("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[ie("stop",{stopColor:"#8754C9"}),ie("stop",{offset:"1",stopColor:"#FF4000"})]}),er("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[ie("stop",{offset:"0.723929",stopColor:"#FFF700"}),ie("stop",{offset:"1",stopColor:"#FF9901"})]}),er("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[ie("stop",{stopColor:"#FFF700"}),ie("stop",{offset:"1",stopColor:"#FF9901"})]}),er("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[ie("stop",{stopColor:"#FFF700"}),ie("stop",{offset:"1",stopColor:"#FF9901"})]}),er("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[ie("stop",{offset:"0.59513",stopColor:"#00AAFF"}),ie("stop",{offset:"1",stopColor:"#01DA40"})]}),er("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[ie("stop",{stopColor:"#00AAFF"}),ie("stop",{offset:"1",stopColor:"#01DA40"})]}),er("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:[ie("stop",{stopColor:"#00AAFF"}),ie("stop",{offset:"1",stopColor:"#01DA40"})]}),ie("clipPath",{id:"clip0_5_32",children:ie("rect",{width:"120",height:"120",fill:"white"})}),ie("clipPath",{id:"clip1_5_32",children:ie("rect",{width:"120",height:"120",fill:"white"})})]})]});import{jsx as $r,jsxs as Df}from"react/jsx-runtime";var Uf=({style:e,...t})=>Df("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:[$r("rect",{width:"96",height:"96",rx:"18",fill:"#FEF4FF"}),Df("g",{filter:"url(#filter0_d_12393_20043)",children:[$r("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"}),$r("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"}),$r("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"}),$r("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"}),$r("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"}),$r("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"}),$r("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"}),$r("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"}),$r("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 na,jsxs as Ff}from"react/jsx-runtime";var Bf=({style:e,...t})=>Ff("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:[Ff("g",{clipPath:"url(#clip0_1704_1423)",children:[na("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"}),na("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"})]}),na("defs",{children:na("clipPath",{id:"clip0_1704_1423",children:na("rect",{width:"176",height:"176",fill:"white"})})})]});import{jsx as Jn,jsxs as yv}from"react/jsx-runtime";var mr={coinbase_wallet:{logo:Gi,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},coinbase_smart_wallet:{logo:Gi,displayName:"Coinbase Smart Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:Dn,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:Br,displayName:"Phantom"},rainbow:{logo:Nf,displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:ji,displayName:"WalletConnect"},zerion:{logo:Bf,displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:Wf,displayName:"Brave Wallet",rdns:"com.brave.wallet"},cryptocom:{logo:Lf,displayName:"Crypto.com DeFi Wallet"},uniswap:{logo:Uf,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:Of,displayName:"Rabby Wallet",rdns:"io.rabby.wallet"}},an=({provider:e,displayName:t,logo:r,connectOnly:o,connector:n})=>{let{navigate:i}=x(),{connectWallet:a}=M(),s=n.connectorType==="wallet_connect_v2"?e:n.walletClientType,l;return n.connectorType==="phantom"?l=()=>{go()?(a(n,s),i(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")):i(Hf?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:n.connectorType==="coinbase_wallet"&&n.connectionOptions==="eoaOnly"&&Hf&&!is()?l=()=>{window.location.href=`https://go.cb-w.com/dapp?cb_url=${encodeURI(window.location.href)}`}:l=()=>{a(n,s),i(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")},yv(hv,{onClick:l,children:[Jn(fv,{icon:mv(e,n.connectorType,n.walletClientType)??r,name:n.walletClientType}),Jn("span",{children:uv(e,n.connectorType,n.walletClientType)||t||n.walletClientType}),Jn("span",{id:"connect-text",children:"Connect"})]})},uv=(e,t,r)=>{if(mr[e]?.displayName)return e==="coinbase_wallet"?mr[r].displayName:mr[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},mv=(e,t,r)=>{if(mr[e]?.logo)return e==="coinbase_wallet"?mr[r].logo:mr[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return ji},fv=({icon:e,name:t})=>typeof e=="string"?Jn("img",{alt:`${t||"wallet"} logo`,src:e,style:{height:24,width:24,borderRadius:4}}):typeof e===void 0?Jn(dv,{}):e?Jn(e,{}):null,hv=pv(Te)`
855
870
  /* Show "Connect" on hover */
856
871
  > #connect-text {
857
872
  font-weight: 500;
@@ -873,23 +888,23 @@ Resources:
873
888
  display: none;
874
889
  }
875
890
  }
876
- `;import{Fragment as iv,jsx as jn,jsxs as av}from"react/jsx-runtime";var tv=["coinbase_wallet"],rv=["metamask","okx_wallet","rainbow","uniswap","zerion","rabby_wallet"],ov=["cryptocom"],nv=["phantom"],Yn=({connectOnly:e})=>{let{connectors:t}=M(),{app:r}=A(),o=Xi(r.appearance.walletList,t,e,r.appearance.walletList);return av(iv,{children:[...o]})},Xi=(e,t,r,o)=>{let n=[],i=[],a=[],l=t.find(s=>s.connectorType==="wallet_connect_v2");for(let s of e)if(s==="detected_wallets"){let c=t.filter(({connectorType:u,walletClientType:h})=>h==="uniswap_wallet_extension"?!o.includes("uniswap"):u==="injected"&&!o.includes(h));for(let u of c){let{walletClientType:h,walletBranding:f}=u;(h==="unknown"?i:n).push(jn(nn,{connectOnly:r,provider:h,logo:f.icon,displayName:f.name,connector:u},`${s}-${h}`))}}else if(nv.includes(s)){let c=t.find(u=>u.connectorType==="injected"&&u.walletClientType===s||u.connectorType===s);c&&n.push(jn(nn,{connectOnly:r,provider:s,connector:c},s))}else if(rv.includes(s)){let c=t.find(u=>s==="uniswap"?u.walletClientType==="uniswap_wallet_extension":u.connectorType==="injected"&&u.walletClientType===s)??l;c&&n.push(jn(nn,{connectOnly:r,provider:s,connector:c},s))}else if(tv.includes(s)){let c=t.find(({connectorType:u})=>u===s);c&&n.push(jn(nn,{connectOnly:r,provider:s,connector:c},s))}else ov.includes(s)?l&&a.push(jn(nn,{connectOnly:r,provider:s,connector:l},s)):s==="wallet_connect"&&l&&a.push(jn(nn,{connectOnly:r,provider:s,connector:l},s));return[...i,...n,...a]};import{Fragment as sv,jsx as ea,jsxs as lv}from"react/jsx-runtime";var Of=()=>{let{app:e}=A(),t=`Connect a wallet to ${e?.name}`;return lv(sv,{children:[ea(P,{},"header"),ea(zr,{title:"Connect your wallet",description:t}),ea(Pr,{children:ea(Yn,{connectOnly:!0})}),ea(q,{protectedByPrivy:!0})]})};import mv from"styled-components";import pv from"styled-components";import cv from"react";import{jsx as dv}from"react/jsx-runtime";var Nf=()=>{let{app:e}=A(),t=e?.appearance?.logo,r=`${e?.name} logo`,o={maxHeight:"90px",maxWidth:"180px"};return t?typeof t=="string"?dv("img",{src:t,alt:r,style:o}):t.type==="svg"||t.type==="img"?cv.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 Df}from"react/jsx-runtime";var Zn=e=>{let{app:t}=A();return t?.appearance.logo?Df(uv,{...e,children:Df(Nf,{})}):null},uv=pv.div`
891
+ `;import{Fragment as bv,jsx as Qn,jsxs as Ev}from"react/jsx-runtime";var gv=["coinbase_wallet"],vv=["metamask","okx_wallet","rainbow","uniswap","zerion","rabby_wallet"],Cv=["cryptocom"],wv=["phantom"],Xn=({connectOnly:e})=>{let{connectors:t}=M(),{app:r}=x(),o=ia(r.appearance.walletList,t,e,r.appearance.walletList);return Ev(bv,{children:[...o]})},ia=(e,t,r,o)=>{let n=[],i=[],a=[],s=t.find(l=>l.connectorType==="wallet_connect_v2");for(let l of e)if(l==="detected_wallets"){let c=t.filter(({connectorType:u,walletClientType:f})=>f==="uniswap_wallet_extension"?!o.includes("uniswap"):u==="injected"&&!o.includes(f));for(let u of c){let{walletClientType:f,walletBranding:h}=u;(f==="unknown"?i:n).push(Qn(an,{connectOnly:r,provider:f,logo:h.icon,displayName:h.name,connector:u},`${l}-${f}`))}}else if(wv.includes(l)){let c=t.find(u=>u.connectorType==="injected"&&u.walletClientType===l||u.connectorType===l);c&&n.push(Qn(an,{connectOnly:r,provider:l,connector:c},l))}else if(vv.includes(l)){let c=t.find(u=>l==="uniswap"?u.walletClientType==="uniswap_wallet_extension":u.connectorType==="injected"&&u.walletClientType===l)??s;c&&n.push(Qn(an,{connectOnly:r,provider:l,connector:c},l))}else if(gv.includes(l)){let c=t.find(({connectorType:u})=>u===l);c&&n.push(Qn(an,{connectOnly:r,provider:l,connector:c},l))}else Cv.includes(l)?s&&a.push(Qn(an,{connectOnly:r,provider:l,connector:s},l)):l==="wallet_connect"&&s&&a.push(Qn(an,{connectOnly:r,provider:l,connector:s},l));return[...i,...n,...a]};import{Fragment as Tv,jsx as aa,jsxs as Pv}from"react/jsx-runtime";var Gf=()=>{let{app:e}=x(),t=`Connect a wallet to ${e?.name}`;return Pv(Tv,{children:[aa(S,{},"header"),aa(qr,{title:"Connect your wallet",description:t}),aa(_r,{children:aa(Xn,{connectOnly:!0})}),aa($,{protectedByPrivy:!0})]})};import kv from"styled-components";import Av from"styled-components";import _v from"react";import{jsx as Sv}from"react/jsx-runtime";var Vf=()=>{let{app:e}=x(),t=e?.appearance?.logo,r=`${e?.name} logo`,o={maxHeight:"90px",maxWidth:"180px"};return t?typeof t=="string"?Sv("img",{src:t,alt:r,style:o}):t.type==="svg"||t.type==="img"?_v.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 zf}from"react/jsx-runtime";var ei=e=>{let{app:t}=x();return t?.appearance.logo?zf(xv,{...e,children:zf(Vf,{})}):null},xv=Av.div`
877
892
  display: flex;
878
893
  flex-direction: column;
879
894
  align-items: center;
880
895
  padding: 24px 0;
881
896
  flex-grow: 1;
882
897
  justify-content: center;
883
- `;import{Fragment as hv,jsx as Jn,jsxs as yv}from"react/jsx-runtime";var Uf=()=>{let{app:e}=A();return yv(hv,{children:[Jn(P,{},"header"),Jn(fv,{}),Jn(Pr,{children:Jn(Yn,{connectOnly:!0})}),e&&Jn(Hn,{app:e,alwaysShowImplicitConsent:!0}),Jn(q,{protectedByPrivy:!0})]})},fv=mv(Zn)`
898
+ `;import{Fragment as Iv,jsx as ti,jsxs as Mv}from"react/jsx-runtime";var qf=()=>{let{app:e}=x();return Mv(Iv,{children:[ti(S,{},"header"),ti(Rv,{}),ti(_r,{children:ti(Xn,{connectOnly:!0})}),e&&ti(qn,{app:e,alwaysShowImplicitConsent:!0}),ti($,{protectedByPrivy:!0})]})},Rv=kv(ei)`
884
899
  margin-bottom: 16px;
885
- `;import{useEffect as qf,useState as $f}from"react";import{isMobile as Pv}from"react-device-detect";import Sv from"styled-components";import{useEffect as cd,useState as an}from"react";import{isMobile as ll}from"react-device-detect";import Gf from"styled-components";import{useEffect as Ff,useRef as gv}from"react";var vv=(e,t)=>{let r=gv(()=>{});Ff(()=>{r.current=e}),Ff(()=>{if(t!==null){let o=setInterval(()=>r.current(),t||0);return()=>clearInterval(o)}},[t])},Bf=vv;import{useState as Cv,useEffect as wv,useCallback as bv}from"react";function Hf(){let[e,t]=Cv(!1),r=bv(()=>{document.hidden&&t(!0)},[]);return wv(()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}import{Fragment as zf,jsx as mt,jsxs as ta}from"react/jsx-runtime";var dd=2,pd=e=>e?.privyErrorCode==="linked_to_another_user"?oo.ERROR_USER_EXISTS:e instanceof ze&&!e.details.default?e.details:e instanceof kn?oo.ERROR_TIMED_OUT:e instanceof Rn?oo.ERROR_USER_REJECTED_CONNECTION:oo.ERROR_WALLET_CONNECTION,Vf=()=>{let[e,t]=an(!1),[r,o]=an(!1),[n,i]=an(void 0),{authenticated:a,logout:l}=B(),{app:s,navigate:c,navigateBack:u,lastScreen:h,currentScreen:f,setModalData:g}=A(),{getAuthFlow:v,walletConnectionStatus:y,closePrivyModal:S,initLoginWithWallet:_,loginWithWallet:w,updateWallets:x,createAnalyticsEvent:k}=M(),{walletConnectors:D}=B(),[I,R]=an(0),{user:H}=B(),[K]=an(H?.linkedAccounts.length||0),[Y,W]=an(""),[G,L]=an(!1),{hasTabbedAway:ae}=Hf(),{enabled:pe,token:ue}=ye(),be=ll&&y?.connector?.connectorType==="wallet_connect_v2"||ll&&y?.connector?.connectorType==="coinbase_wallet"||ll&&y?.connector?.connectorType==="injected"&&y?.connector?.walletClientType==="phantom",X=y?.status==="connected",Pt=y?.status==="switching_to_supported_chain";cd(()=>{let Se=v();if(X&&!Se&&(pe&&!ue&&!a?(g({captchaModalData:{callback:J=>_(y.connectedWallet,J).then(()=>{L(!0)}),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN",!1)):_(y.connectedWallet,ue).then(()=>{L(!0)})),Se&&be&&X&&!Se.preparedMessage){Se.buildSiweMessage();return}!Se||be||!X||r||(async()=>{o(!0),i(void 0);try{y?.connector?.connectorType==="wallet_connect_v2"&&y?.connector?.walletClientType==="metamask"&&await Sc(2500),await Mt()}catch(J){console.warn("Auto-prompted signature failed",J)}finally{o(!1)}})()},[I,X,G]),cd(()=>{if(H&&e){let J=Fe-500;if(s?.legal.requireUsersAcceptTerms&&!H.hasAcceptedTerms){let ve=setTimeout(()=>{c("AFFIRMATIVE_CONSENT_SCREEN")},J);return()=>clearTimeout(ve)}if(Nt(H,s?.embeddedWallets?.createOnLogin)){let ve=setTimeout(()=>{g({createWallet:{onSuccess:()=>{},onFailure:Ne=>{console.error(Ne),k({eventName:"embedded_wallet_creation_failure_logout",payload:{error:Ne,screen:"ConnectionStatusScreen"}}),l()},callAuthOnSuccessOnClose:!0}}),c("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},J);return()=>clearTimeout(ve)}x();let ee=setTimeout(()=>S({shouldCallAuthOnSuccess:!0,isSuccess:!0}),Fe);return()=>clearTimeout(ee)}},[H,e]);let et=Se=>{if(Se?.privyErrorCode==="allowlist_rejected"){c("ALLOWLIST_REJECTION_SCREEN");return}else if(Se?.privyErrorCode==="max_accounts_reached"){console.error(new lr(Se).toString()),c("USER_LIMIT_REACHED_SCREEN");return}i(pd(Se))};async function Mt(){try{await w(),t(!0)}catch(Se){et(Se)}finally{o(!1)}}cd(()=>{y?.connectError&&et(y?.connectError)},[y]),Bf(()=>{let Se=rt==="wallet_connect_v2"&&y?.connector instanceof Br?y.connector.redirectUri:void 0;Se&&W(Se)},y?.connector instanceof Br&&!Y?500:null);let rt=y?.connector?.connectorType||"injected",ar=y?.connector?.walletClientType||"unknown",Ie=mr[ar]?.displayName||y?.connector?.walletBranding.name||"Browser Extension",Ke=mr[ar]?.logo||y?.connector?.walletBranding.icon||(Se=>mt(Mn,{...Se})),sr=Ie==="Browser Extension"?Ie.toLowerCase():Ie,Wt;e?Wt=`Successfully connected with ${sr}`:n?Wt=n.message:Pt?Wt="Switching networks":X?Wt=r&&be?"Signing":"Sign to verify":Wt=`Waiting for ${sr}`;let qe="Don\u2019t see your wallet? Check your other browser windows.";if(e){let Se=H?.linkedAccounts.length||0;K===Se?qe="Wallet was already linked.":qe="You\u2019re good to go!"}else I>=dd&&n?qe="Unable to connect wallet":n?qe=n.detail:Pt?qe="Switch your wallet to the requested network.":X&&be?qe="Sign the message in your wallet to verify it belongs to you.":ar==="metamask"&&ll?qe="Click continue to open and connect MetaMask.":ar==="metamask"?qe="For the best experience, connect only one wallet at a time.":rt==="wallet_connect"?qe="Open your mobile wallet app to continue":rt==="coinbase_wallet"&&(Za()||(Gc(H)?qe="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":qe="Open the Coinbase app on your phone to continue."));let O=D?.walletConnectors?.find(Se=>Se.walletClientType==="coinbase_wallet"),Ho=ar==="coinbase_wallet"&&(Gc(H)||n===oo.ERROR_USER_EXISTS);return ta(zf,{children:[mt(P,{backFn:!h||f===h?void 0:u}),ta(Ev,{children:[mt(ud,{walletLogo:Ke,success:e,fail:!!n}),ta(Ze,{children:[mt("h3",{children:Wt}),mt("p",{children:qe}),!X&&Y&&!ae?ta("p",{children:["Still here?"," ",mt("a",{href:Y,target:"_blank",style:{textDecoration:"underline"},children:"Try again"})]}):null]}),Ho?mt(N,{onClick:()=>O&&O?.disconnect(),disabled:e,children:"Use a different wallet"}):n==oo.ERROR_USER_EXISTS&&f!==h?mt(N,{onClick:u,children:"Use a different wallet"}):X&&!e&&be?mt(N,{onClick:()=>{o(!0),Mt()},disabled:r,children:r?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&I<dd?mt(N,{onClick:()=>{R(I+1),i(void 0),X?(o(!0),Mt()):y?.connectRetry()},disabled:!e&&(!n?.retryable||I>=dd),children:"Retry"}):!e&&!n?mt(N,{onClick:()=>{},disabled:!0,children:"Connecting"}):null]}),mt(V,{})]})},Ev=Gf.div`
900
+ `;import{useEffect as Qf,useState as Xf}from"react";import{isMobile as Bv}from"react-device-detect";import Hv from"styled-components";import{useEffect as hd,useState as sn}from"react";import{isMobile as ml}from"react-device-detect";import Yf from"styled-components";import{useEffect as $f,useRef as Wv}from"react";var Lv=(e,t)=>{let r=Wv(()=>{});$f(()=>{r.current=e}),$f(()=>{if(t!==null){let o=setInterval(()=>r.current(),t||0);return()=>clearInterval(o)}},[t])},Kf=Lv;import{useState as Ov,useEffect as Nv,useCallback as Dv}from"react";function jf(){let[e,t]=Ov(!1),r=Dv(()=>{document.hidden&&t(!0)},[]);return Nv(()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}import{Fragment as Jf,jsx as ft,jsxs as sa}from"react/jsx-runtime";var yd=2,gd=e=>e?.privyErrorCode==="linked_to_another_user"?io.ERROR_USER_EXISTS:e instanceof ze&&!e.details.default?e.details:e instanceof Wn?io.ERROR_TIMED_OUT:e instanceof Ln?io.ERROR_USER_REJECTED_CONNECTION:io.ERROR_WALLET_CONNECTION,Zf=()=>{let[e,t]=sn(!1),[r,o]=sn(!1),[n,i]=sn(void 0),{authenticated:a,logout:s}=F(),{app:l,navigate:c,navigateBack:u,lastScreen:f,currentScreen:h,setModalData:g}=x(),{getAuthFlow:v,walletConnectionStatus:y,closePrivyModal:T,initLoginWithWallet:_,loginWithWallet:b,updateWallets:A,createAnalyticsEvent:k}=M(),{walletConnectors:N}=F(),[R,I]=sn(0),{user:H}=F(),[G]=sn(H?.linkedAccounts.length||0),[Z,W]=sn(""),[q,L]=sn(!1),{hasTabbedAway:se}=jf(),{enabled:ue,token:me}=ge(),be=ml&&y?.connector?.connectorType==="wallet_connect_v2"||ml&&y?.connector?.connectorType==="coinbase_wallet"||ml&&y?.connector?.connectorType==="injected"&&y?.connector?.walletClientType==="phantom",X=y?.status==="connected",Pt=y?.status==="switching_to_supported_chain";hd(()=>{let _e=v();if(X&&!_e&&(ue&&!me&&!a?(g({captchaModalData:{callback:J=>_(y.connectedWallet,J).then(()=>{L(!0)}),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN",!1)):_(y.connectedWallet,me).then(()=>{L(!0)})),_e&&be&&X&&!_e.preparedMessage){_e.buildSiweMessage();return}!_e||be||!X||r||(async()=>{o(!0),i(void 0);try{y?.connector?.connectorType==="wallet_connect_v2"&&y?.connector?.walletClientType==="metamask"&&await Mc(2500),await Mt()}catch(J){console.warn("Auto-prompted signature failed",J)}finally{o(!1)}})()},[R,X,q]),hd(()=>{if(H&&e){let J=Oe-500;if(l?.legal.requireUsersAcceptTerms&&!H.hasAcceptedTerms){let Ce=setTimeout(()=>{c("AFFIRMATIVE_CONSENT_SCREEN")},J);return()=>clearTimeout(Ce)}if(Dt(H,l?.embeddedWallets?.createOnLogin)){let Ce=setTimeout(()=>{g({createWallet:{onSuccess:()=>{},onFailure:De=>{console.error(De),k({eventName:"embedded_wallet_creation_failure_logout",payload:{error:De,screen:"ConnectionStatusScreen"}}),s()},callAuthOnSuccessOnClose:!0}}),c("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},J);return()=>clearTimeout(Ce)}A();let ee=setTimeout(()=>T({shouldCallAuthOnSuccess:!0,isSuccess:!0}),Oe);return()=>clearTimeout(ee)}},[H,e]);let rt=_e=>{if(_e?.privyErrorCode==="allowlist_rejected"){c("ALLOWLIST_REJECTION_SCREEN");return}else if(_e?.privyErrorCode==="max_accounts_reached"){console.error(new cr(_e).toString()),c("USER_LIMIT_REACHED_SCREEN");return}i(gd(_e))};async function Mt(){try{await b(),t(!0)}catch(_e){rt(_e)}finally{o(!1)}}hd(()=>{y?.connectError&&rt(y?.connectError)},[y]),Kf(()=>{let _e=nt==="wallet_connect_v2"&&y?.connector instanceof Hr?y.connector.redirectUri:void 0;_e&&W(_e)},y?.connector instanceof Hr&&!Z?500:null);let nt=y?.connector?.connectorType||"injected",sr=y?.connector?.walletClientType||"unknown",Ie=mr[sr]?.displayName||y?.connector?.walletBranding.name||"Browser Extension",je=mr[sr]?.logo||y?.connector?.walletBranding.icon||(_e=>ft(Nn,{..._e})),lr=Ie==="Browser Extension"?Ie.toLowerCase():Ie,Wt;e?Wt=`Successfully connected with ${lr}`:n?Wt=n.message:Pt?Wt="Switching networks":X?Wt=r&&be?"Signing":"Sign to verify":Wt=`Waiting for ${lr}`;let $e="Don\u2019t see your wallet? Check your other browser windows.";if(e){let _e=H?.linkedAccounts.length||0;G===_e?$e="Wallet was already linked.":$e="You\u2019re good to go!"}else R>=yd&&n?$e="Unable to connect wallet":n?$e=n.detail:Pt?$e="Switch your wallet to the requested network.":X&&be?$e="Sign the message in your wallet to verify it belongs to you.":sr==="metamask"&&ml?$e="Click continue to open and connect MetaMask.":sr==="metamask"?$e="For the best experience, connect only one wallet at a time.":nt==="wallet_connect"?$e="Open your mobile wallet app to continue":nt==="coinbase_wallet"&&(is()||(Yc(H)?$e="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":$e="Open the Coinbase app on your phone to continue."));let O=N?.walletConnectors?.find(_e=>_e.walletClientType==="coinbase_wallet"),Bo=sr==="coinbase_wallet"&&(Yc(H)||n===io.ERROR_USER_EXISTS);return sa(Jf,{children:[ft(S,{backFn:!f||h===f?void 0:u}),sa(Uv,{children:[ft(vd,{walletLogo:je,success:e,fail:!!n}),sa(qe,{children:[ft("h3",{children:Wt}),ft("p",{children:$e}),!X&&Z&&!se?sa("p",{children:["Still here?"," ",ft("a",{href:Z,target:"_blank",style:{textDecoration:"underline"},children:"Try again"})]}):null]}),Bo?ft(D,{onClick:()=>O&&O?.disconnect(),disabled:e,children:"Use a different wallet"}):n==io.ERROR_USER_EXISTS&&h!==f?ft(D,{onClick:u,children:"Use a different wallet"}):X&&!e&&be?ft(D,{onClick:()=>{o(!0),Mt()},disabled:r,children:r?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&R<yd?ft(D,{onClick:()=>{I(R+1),i(void 0),X?(o(!0),Mt()):y?.connectRetry()},disabled:!e&&(!n?.retryable||R>=yd),children:"Retry"}):!e&&!n?ft(D,{onClick:()=>{},disabled:!0,children:"Connecting"}):null]}),ft(z,{})]})},Uv=Yf.div`
886
901
  display: flex;
887
902
  flex-direction: column;
888
903
  align-items: center;
889
904
  justify-content: center;
890
905
  gap: 24px;
891
906
  width: 100%;
892
- `,Tv=Gf.div`
907
+ `,Fv=Yf.div`
893
908
  display: flex;
894
909
  flex-direction: column;
895
910
  justify-content: center;
@@ -912,14 +927,22 @@ Resources:
912
927
  left: -19px;
913
928
  top: -19px;
914
929
  }
915
- `,ud=e=>{let t=e.walletLogo;return mt(zf,{children:mt(Tv,{children:ta("div",{children:[mt(ot,{success:e.success,fail:e.fail}),typeof t=="string"?mt("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):mt(t,{style:{width:"38px",height:"38px"}})]})})})};import{Fragment as xv,jsx as ao,jsxs as md}from"react/jsx-runtime";var cl=2,Kf=()=>{let{navigateBack:e,lastScreen:t,currentScreen:r}=A(),{walletConnectionStatus:o,closePrivyModal:n}=M(),[i,a]=$f(void 0),[l,s]=$f(0),c=o?.status==="connected",u=o?.status==="switching_to_supported_chain";qf(()=>{if(c){let x=setTimeout(n,Fe);return()=>clearTimeout(x)}},[c]);let h=x=>{a(pd(x))};qf(()=>{o?.connectError&&h(o?.connectError)},[o]);let f=o?.connector?.connectorType||"injected",g=o?.connector?.walletClientType||"unknown",v=mr[g]?.displayName||o?.connector?.walletBranding.name||"Browser Extension",y=mr[g]?.logo||o?.connector?.walletBranding.icon||(x=>ao(Mn,{...x})),S=v==="Browser Extension"?v.toLowerCase():v,_;c?_=`Successfully connected with ${S}`:i?_=i.message:u?_="Switching networks":_=`Waiting for ${S}`;let w="Don\u2019t see your wallet? Check your other browser windows.";return c?w="You\u2019re good to go!":l>=cl&&i?w="Unable to connect wallet":i?w=i.detail:u?w="Switch your wallet to the requested network.":g==="metamask"&&Pv?w="Click to continue to open and connect MetaMask.":g==="metamask"?w="For the best experience, connect only one wallet at a time.":f==="wallet_connect_v2"?w="Open your mobile wallet app to continue":f==="coinbase_wallet"&&(w="Open the Coinbase app on your phone to continue."),md(xv,{children:[ao(P,{backFn:r===t?void 0:e}),md(_v,{children:[ao(ud,{walletLogo:y,success:c,fail:!!i}),md(Ze,{children:[ao("h3",{children:_}),ao("p",{children:w})]}),i==oo.ERROR_USER_EXISTS?ao(N,{onClick:e,children:"Use a different wallet"}):!c&&i?.retryable&&l<cl?ao(N,{onClick:()=>{s(l+1),a(void 0),o?.connectRetry()},disabled:!c&&(!i?.retryable||l>=cl),children:"Retry"}):!c&&i&&l>=cl?ao(N,{onClick:e,children:"Use a different wallet"}):null]}),ao(V,{})]})},_v=Sv.div`
930
+ `,vd=e=>{let t=e.walletLogo;return ft(Jf,{children:ft(Fv,{children:sa("div",{children:[ft(Je,{success:e.success,fail:e.fail}),typeof t=="string"?ft("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):ft(t,{style:{width:"38px",height:"38px"}})]})})})};import{Fragment as Vv,jsx as so,jsxs as Cd}from"react/jsx-runtime";var fl=2,eh=()=>{let{navigateBack:e,lastScreen:t,currentScreen:r}=x(),{walletConnectionStatus:o,closePrivyModal:n}=M(),[i,a]=Xf(void 0),[s,l]=Xf(0),c=o?.status==="connected",u=o?.status==="switching_to_supported_chain";Qf(()=>{if(c){let A=setTimeout(n,Oe);return()=>clearTimeout(A)}},[c]);let f=A=>{a(gd(A))};Qf(()=>{o?.connectError&&f(o?.connectError)},[o]);let h=o?.connector?.connectorType||"injected",g=o?.connector?.walletClientType||"unknown",v=mr[g]?.displayName||o?.connector?.walletBranding.name||"Browser Extension",y=mr[g]?.logo||o?.connector?.walletBranding.icon||(A=>so(Nn,{...A})),T=v==="Browser Extension"?v.toLowerCase():v,_;c?_=`Successfully connected with ${T}`:i?_=i.message:u?_="Switching networks":_=`Waiting for ${T}`;let b="Don\u2019t see your wallet? Check your other browser windows.";return c?b="You\u2019re good to go!":s>=fl&&i?b="Unable to connect wallet":i?b=i.detail:u?b="Switch your wallet to the requested network.":g==="metamask"&&Bv?b="Click to continue to open and connect MetaMask.":g==="metamask"?b="For the best experience, connect only one wallet at a time.":h==="wallet_connect_v2"?b="Open your mobile wallet app to continue":h==="coinbase_wallet"&&(b="Open the Coinbase app on your phone to continue."),Cd(Vv,{children:[so(S,{backFn:r===t?void 0:e}),Cd(Gv,{children:[so(vd,{walletLogo:y,success:c,fail:!!i}),Cd(qe,{children:[so("h3",{children:_}),so("p",{children:b})]}),i==io.ERROR_USER_EXISTS?so(D,{onClick:e,children:"Use a different wallet"}):!c&&i?.retryable&&s<fl?so(D,{onClick:()=>{l(s+1),a(void 0),o?.connectRetry()},disabled:!c&&(!i?.retryable||s>=fl),children:"Retry"}):!c&&i&&s>=fl?so(D,{onClick:e,children:"Use a different wallet"}):null]}),so(z,{})]})},Gv=Hv.div`
916
931
  display: flex;
917
932
  flex-direction: column;
918
933
  align-items: center;
919
934
  justify-content: center;
920
935
  gap: 24px;
921
936
  width: 100%;
922
- `;import Lv from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as Ov,useMemo as Nv,useState as Dv}from"react";import Uv from"styled-components";import dl from"styled-components";import{jsx as fd,jsxs as Mv}from"react/jsx-runtime";var Qn=()=>fd(Av,{children:Mv(kv,{children:[fd(Rv,{}),fd(Iv,{})]})}),Av=dl.div`
937
+ `;import{useEffect as oh,useState as nh}from"react";import zv from"styled-components";import{jsx as th}from"react/jsx-runtime";var rh=({name:e,logoUrl:t})=>{let r=`${e??"Provider app"} logo`;return typeof t=="string"?th("img",{src:t,alt:r,style:{width:"38px",height:"38px",maxHeight:"90px",maxWidth:"180px"}}):th("span",{})};import{Fragment as $v,jsx as lo,jsxs as hl}from"react/jsx-runtime";var ih=()=>{let{authenticated:e,ready:t,user:r}=F(),{data:o}=x(),{crossAppAuthFlow:n,updateWallets:i,closePrivyModal:a}=M(),[s,l]=nh(!1),[c,u]=nh(void 0),f={id:o?.crossAppAuth?.appId??"",name:o?.crossAppAuth?.name??"app",logoUrl:o?.crossAppAuth?.logoUrl},h=Oe,g=new Fe(T=>new Promise(_=>{setTimeout(async()=>{try{if(!o?.crossAppAuth?.popup){u({message:"Authentication failed",detail:`There was an issue connecting your ${f.name} account. Please try again.`,retryable:!1});return}await n({appId:T,popup:o.crossAppAuth.popup}),l(!0),_()}catch(b){u({message:"Authentication failed",detail:b instanceof w?b.message:`There was an issue connecting your ${f.name} account. Please try again.`,retryable:!1}),_()}},0)}));oh(()=>{f.id.length&&g.execute(f.id)},[f.id]),oh(()=>{if(!(t&&e&&s&&r))return;let _=setTimeout(()=>a({shouldCallAuthOnSuccess:!0,isSuccess:!0}),h);return i(),()=>clearTimeout(_)},[t,e,s,r]);let v=s?`Successfully connected with ${f.name}`:c?c.message:`Connecting to ${f.name}`,y="";return s?y="You\u2019re good to go!":c?y=c.detail:y=`Please check the pop-up from ${f.name} to continue`,hl($v,{children:[lo(S,{}),lo(Q,{}),hl(qv,{children:[lo(Qe,{children:hl("div",{children:[lo(Je,{success:s,fail:!!c}),lo(rh,{name:f.name,logoUrl:f.logoUrl})]})}),hl(qe,{children:[lo("h3",{children:v}),lo("p",{children:y})]})]}),lo(re,{}),lo(z,{})]})},qv=zv.div`
938
+ display: flex;
939
+ flex-direction: column;
940
+ align-items: center;
941
+ justify-content: center;
942
+ margin-left: 27px;
943
+ margin-right: 27px;
944
+ gap: 24px;
945
+ `;import Xv from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as eC,useMemo as tC,useState as rC}from"react";import oC from"styled-components";import yl from"styled-components";import{jsx as wd,jsxs as Jv}from"react/jsx-runtime";var ri=()=>wd(Kv,{children:Jv(jv,{children:[wd(Yv,{}),wd(Zv,{})]})}),Kv=yl.div`
923
946
  display: flex;
924
947
  justify-content: center;
925
948
  align-items: center;
@@ -931,14 +954,14 @@ Resources:
931
954
  @media all and (display-mode: standalone) {
932
955
  margin-bottom: 30px;
933
956
  }
934
- `,kv=dl.div`
957
+ `,jv=yl.div`
935
958
  position: relative;
936
959
  height: 140px;
937
960
  width: 140px;
938
961
 
939
962
  opacity: 1;
940
963
  animation: fadein 200ms ease;
941
- `,Rv=dl.div`
964
+ `,Yv=yl.div`
942
965
  position: absolute;
943
966
  top: 0;
944
967
  right: 0;
@@ -951,7 +974,7 @@ Resources:
951
974
  border: 4px solid var(--privy-color-accent-light);
952
975
  border-radius: 50%;
953
976
  }
954
- `,Iv=dl.div`
977
+ `,Zv=yl.div`
955
978
  position: absolute;
956
979
  top: 0;
957
980
  right: 0;
@@ -975,20 +998,20 @@ Resources:
975
998
  transform: rotate(360deg);
976
999
  }
977
1000
  }
978
- `;var jf=["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 Ge=class extends Error{constructor(r,o){super(o);this.type=r}};function Xn(e){let t=e.type;return typeof t=="string"&&jf.includes(t)}function Wv(e){let t=e.type;return typeof t=="string"&&t==="client_error"}function ei(e){return Xn(e)&&e.type==="wallet_not_on_device"}function Yf(e){return Xn(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function sn(e){return!!(Xn(e)&&e.type==="mfa_timeout")}function ln(e){return!!(Xn(e)&&e.type==="missing_or_invalid_mfa")}function hd(e){return!!(Xn(e)&&e.type==="mfa_verification_max_attempts_reached")}function pl(e){return!!(Xn(e)&&e.message.includes("code 429"))}function ul(e){return!!(Wv(e)&&e.message==="MFA canceled")}function yd({isCreatingWallet:e,skipSplashScreen:t}){return e?"EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN":t?"EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN":"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"}function ml({walletAction:e,availableRecoveryMethods:t,legacySetWalletPasswordFlow:r=!1,isResettingPassword:o=!1}){return r||t.length===1?yd({isCreatingWallet:e==="create",skipSplashScreen:o}):"EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"}function fl(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 gd({api:e,provider:t}){let r=Wi(),o=as(),n=await ss(r);try{return t==="icloud"?{url:(await e.post(nu,{client_type:"web"})).url}:{url:(await e.post(ou,{redirect_to:window.location.href,code_challenge:n,state_code:o})).url,codeVerifier:r,stateCode:o,provider:t}}catch(i){throw ne(i)}}async function Zf({api:e,provider:t,stateCode:r,codeVerifier:o,authorizationCode:n}){if(!n||!r)throw new b("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if(n==="undefined")throw new b("User denied confirmation during OAuth flow");try{return(await e.post(iu,{authorization_code:n,state_code:r,code_verifier:o,provider:t})).access_token}catch(i){let a=ne(i);throw a.privyErrorCode?new b(a.message||"Invalid code during OAuth flow.",void 0,a.privyErrorCode):a.message==="User denied confirmation during OAuth flow"?new b("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new b("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}import{Fragment as Qf,jsx as ti,jsxs as vd}from"react/jsx-runtime";var Jf=1,Xf=()=>{let{authenticated:e,user:t,getAccessToken:r}=B(),{closePrivyModal:o,createAnalyticsEvent:n,walletProxy:i}=M(),{navigate:a,data:l,setModalData:s,onUserCloseViaDialogOrKeybindRef:c}=A(),u=Nv(()=>Date.now(),[]),[h,f]=Dv(!1),{onCompleteNavigateTo:g,onFailure:v,shouldForceMFA:y,address:S}=l?.connectWallet,_=x=>{h||(f(!0),v(typeof x=="string"?new Error(x):x))};Ov(()=>{let x=S?t?.linkedAccounts.find(I=>I.type==="wallet"&&I.walletClientType==="privy"&&I.address===S):xe(t),k;return!e||!x?_("User must be authenticated and have a Privy wallet before it can be connected"):i?((async()=>{let I=await r();if(!I)return _("User must be authenticated and have a Privy wallet before it can be connected");try{await i.connect({accessToken:I,address:x.address}),y&&await i.verifyMfa({accessToken:I});let R=(Date.now()-u)/1e3;g==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&R<Jf?k=setTimeout(()=>{a(g)},(Jf-R)*1e3):a(g)}catch(R){if(ei(R)&&x.recoveryMethod==="privy"){let H=await r();if(!H)return _("User must be authenticated and have a Privy wallet before it can be recovered");try{n({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:x.address}}),(await i?.recover({address:x.address,accessToken:H,recoveryMethod:x.recoveryMethod}))?.address||_(new Error("Unable to recover wallet")),g?a(g):o({shouldCallAuthOnSuccess:!1}),n({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:x.address}}),a(g)}catch{_("An error has occurred, please try again.")}}else if(ei(R)&&x.recoveryMethod!=="privy"){s({...l,recoverWallet:{privyWallet:x,onCompleteNavigateTo:g,onFailure:v},recoveryOAuthStatus:{provider:x.recoveryMethod,action:"recover",isInAccountCreateFlow:!1}});let H=fl(x.recoveryMethod);a(H)}else _(R)}})(),()=>clearTimeout(k)):void 0},[e,t,i]);let w=()=>{_("User exited before wallet could be connected"),o({shouldCallAuthOnSuccess:!1})};return c.current=w,vd(Qf,{children:[ti(P,{onClose:w}),h?vd(Qf,{children:[vd(_r,{children:[ti(Lv,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),ti(ke,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),ti(N,{onClick:()=>o({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):ti(Qn,{}),ti(Fv,{})]})},Fv=Uv.div`
1001
+ `;var ah=["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 Ve=class extends Error{constructor(r,o){super(o);this.type=r}};function oi(e){let t=e.type;return typeof t=="string"&&ah.includes(t)}function Qv(e){let t=e.type;return typeof t=="string"&&t==="client_error"}function ni(e){return oi(e)&&e.type==="wallet_not_on_device"}function sh(e){return oi(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function ln(e){return!!(oi(e)&&e.type==="mfa_timeout")}function cn(e){return!!(oi(e)&&e.type==="missing_or_invalid_mfa")}function bd(e){return!!(oi(e)&&e.type==="mfa_verification_max_attempts_reached")}function gl(e){return!!(oi(e)&&e.message.includes("code 429"))}function vl(e){return!!(Qv(e)&&e.message==="MFA canceled")}function Ed({isCreatingWallet:e,skipSplashScreen:t}){return e?"EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN":t?"EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN":"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"}function Cl({walletAction:e,availableRecoveryMethods:t,legacySetWalletPasswordFlow:r=!1,isResettingPassword:o=!1}){return r||t.length===1?Ed({isCreatingWallet:e==="create",skipSplashScreen:o}):"EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"}function wl(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 Td({api:e,provider:t}){let r=Yo(),o=Rn(),n=await In(r);try{return t==="icloud"?{url:(await e.post(cu,{client_type:"web"})).url}:{url:(await e.post(lu,{redirect_to:window.location.href,code_challenge:n,state_code:o})).url,codeVerifier:r,stateCode:o,provider:t}}catch(i){throw te(i)}}async function lh({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(du,{authorization_code:n,state_code:r,code_verifier:o,provider:t})).access_token}catch(i){let a=te(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 dh,jsx as ii,jsxs as Pd}from"react/jsx-runtime";var ch=1,ph=()=>{let{authenticated:e,user:t,getAccessToken:r}=F(),{closePrivyModal:o,createAnalyticsEvent:n,walletProxy:i}=M(),{navigate:a,data:s,setModalData:l,onUserCloseViaDialogOrKeybindRef:c}=x(),u=tC(()=>Date.now(),[]),[f,h]=rC(!1),{onCompleteNavigateTo:g,onFailure:v,shouldForceMFA:y,address:T}=s?.connectWallet,_=A=>{f||(h(!0),v(typeof A=="string"?new Error(A):A))};eC(()=>{let A=T?t?.linkedAccounts.find(R=>R.type==="wallet"&&R.walletClientType==="privy"&&R.address===T):Ae(t),k;return!e||!A?_("User must be authenticated and have a Privy wallet before it can be connected"):i?((async()=>{let R=await r();if(!R)return _("User must be authenticated and have a Privy wallet before it can be connected");try{await i.connect({accessToken:R,address:A.address}),y&&await i.verifyMfa({accessToken:R});let I=(Date.now()-u)/1e3;g==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&I<ch?k=setTimeout(()=>{a(g)},(ch-I)*1e3):a(g)}catch(I){if(ni(I)&&A.recoveryMethod==="privy"){let H=await r();if(!H)return _("User must be authenticated and have a Privy wallet before it can be recovered");try{n({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:A.address}}),(await i?.recover({address:A.address,accessToken:H,recoveryMethod:A.recoveryMethod}))?.address||_(new Error("Unable to recover wallet")),g?a(g):o({shouldCallAuthOnSuccess:!1}),n({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:A.address}}),a(g)}catch{_("An error has occurred, please try again.")}}else if(ni(I)&&A.recoveryMethod!=="privy"){l({...s,recoverWallet:{privyWallet:A,onCompleteNavigateTo:g,onFailure:v},recoveryOAuthStatus:{provider:A.recoveryMethod,action:"recover",isInAccountCreateFlow:!1}});let H=wl(A.recoveryMethod);a(H)}else _(I)}})(),()=>clearTimeout(k)):void 0},[e,t,i]);let b=()=>{_("User exited before wallet could be connected"),o({shouldCallAuthOnSuccess:!1})};return c.current=b,Pd(dh,{children:[ii(S,{onClose:b}),f?Pd(dh,{children:[Pd(Ar,{children:[ii(Xv,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),ii(ke,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),ii(D,{onClick:()=>o({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):ii(ri,{}),ii(nC,{})]})},nC=oC.div`
979
1002
  height: 44px;
980
- `;import Bv from"@heroicons/react/24/solid/CheckCircleIcon";import{useEffect as Hv}from"react";import{Fragment as Gv,jsx as ri,jsxs as eh}from"react/jsx-runtime";var th=()=>{let{user:e}=B(),{closePrivyModal:t,isNewUserThisSession:r,updateWallets:o}=M(),{app:n,data:i,onUserCloseViaDialogOrKeybindRef:a}=A(),{onSuccess:l,onFailure:s,callAuthOnSuccessOnClose:c}=i.createWallet,u=()=>{let h=xe(e);h?(o(),l(h)):s(new Error("Failed to create wallet")),t({shouldCallAuthOnSuccess:c})};return Hv(()=>{let h=setTimeout(u,Du);return()=>clearTimeout(h)},[]),a.current=u,eh(Gv,{children:[ri(P,{onClose:u}),ri(Q,{}),eh(_r,{children:[ri(Bv,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),ri(ke,{title:r?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:r?"You\u2019ve successfully created an account.":"Your account is secured."})]}),ri(re,{}),ri(q,{protectedByPrivy:!0})]})};import Vv from"@heroicons/react/20/solid/ExclamationTriangleIcon";import zv from"@heroicons/react/24/outline/ArrowRightOnRectangleIcon";import{useEffect as nh,useRef as qv,useState as Cd}from"react";import To from"styled-components";import{Fragment as eC,jsx as tt,jsxs as Rr}from"react/jsx-runtime";var ih=()=>{let[e,t]=Cd(null),{authenticated:r,user:o,getAccessToken:n}=B(),{closePrivyModal:i,createAnalyticsEvent:a,clientAnalyticsId:l}=M(),{data:s,onUserCloseViaDialogOrKeybindRef:c}=A(),u=xe(o)?.address,{onFailure:h,onSuccess:f,origin:g,appId:v,appClientId:y}=s.keyExport,S=w=>{i({shouldCallAuthOnSuccess:!1}),h(typeof w=="string"?new Error(w):w)},_=()=>{i({shouldCallAuthOnSuccess:!1}),f(),a({eventName:"embedded_wallet_key_export_completed",payload:{walletAddress:u}})};return nh(()=>{let w=xe(o);if(!r||!w)return S("User must be authenticated before exporting their wallet");n().then(t,S)},[r,o]),c.current=_,Rr(eC,{children:[tt(P,{onClose:_}),Rr(jv,{children:[Rr(ke,{icon:tt(zv,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),title:"Transfer Wallet",children:[Rr(Qv,{children:[tt(Kv,{style:{marginRight:6}}),go(u)]}),tt("p",{children:"You can bring your account with you to another site using an external wallet."})]}),Rr(Yv,{children:[Rr(rh,{children:[tt(oh,{children:"1"}),Rr("span",{children:[tt("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."]})]}),Rr(rh,{children:[tt(oh,{children:"2"}),tt("span",{children:"Copy this key into your other wallet"})]})]}),tt("div",{style:{width:"100%"},children:e&&tt($v,{origin:g,appId:v,appClientId:y,accessToken:e,clientAnalyticsId:l,address:u,dimensions:{height:"44px"}})}),Rr(Xv,{children:[Rr("div",{children:[tt(Vv,{viewBox:"0 0 20 18"}),tt("h4",{children:"Warning"})]}),tt("p",{children:"Never share your private key with anyone! It controls your account."})]})]}),tt(q,{protectedByPrivy:!0})]})};function $v(e){let[t,r]=Cd(e.dimensions.width),[o,n]=Cd(void 0),i=qv(null);return nh(()=>{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")})},[]),tt("div",{ref:i,children:t&&Rr(Zv,{children:[tt("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:Qa(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})}),tt(Jv,{children:"Loading..."})]})})}function Kv(e){return tt("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e.style,children:tt("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 jv=To.div`
1003
+ `;import iC from"@heroicons/react/24/solid/CheckCircleIcon";import{useEffect as aC}from"react";import{Fragment as sC,jsx as ai,jsxs as uh}from"react/jsx-runtime";var mh=()=>{let{user:e}=F(),{closePrivyModal:t,isNewUserThisSession:r,updateWallets:o}=M(),{app:n,data:i,onUserCloseViaDialogOrKeybindRef:a}=x(),{onSuccess:s,onFailure:l,callAuthOnSuccessOnClose:c}=i.createWallet,u=()=>{let f=Ae(e);f?(o(),s(f)):l(new Error("Failed to create wallet")),t({shouldCallAuthOnSuccess:c})};return aC(()=>{let f=setTimeout(u,Gu);return()=>clearTimeout(f)},[]),a.current=u,uh(sC,{children:[ai(S,{onClose:u}),ai(Q,{}),uh(Ar,{children:[ai(iC,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),ai(ke,{title:r?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:r?"You\u2019ve successfully created an account.":"Your account is secured."})]}),ai(re,{}),ai($,{protectedByPrivy:!0})]})};import lC from"@heroicons/react/20/solid/ExclamationTriangleIcon";import cC from"@heroicons/react/24/outline/ArrowRightOnRectangleIcon";import{useEffect as yh,useRef as dC,useState as _d}from"react";import To from"styled-components";import{Fragment as CC,jsx as ot,jsxs as Ir}from"react/jsx-runtime";var gh=()=>{let[e,t]=_d(null),{authenticated:r,user:o,getAccessToken:n}=F(),{closePrivyModal:i,createAnalyticsEvent:a,clientAnalyticsId:s}=M(),{data:l,onUserCloseViaDialogOrKeybindRef:c}=x(),u=Ae(o)?.address,{onFailure:f,onSuccess:h,origin:g,appId:v,appClientId:y}=l.keyExport,T=b=>{i({shouldCallAuthOnSuccess:!1}),f(typeof b=="string"?new Error(b):b)},_=()=>{i({shouldCallAuthOnSuccess:!1}),h(),a({eventName:"embedded_wallet_key_export_completed",payload:{walletAddress:u}})};return yh(()=>{let b=Ae(o);if(!r||!b)return T("User must be authenticated before exporting their wallet");n().then(t,T)},[r,o]),c.current=_,Ir(CC,{children:[ot(S,{onClose:_}),Ir(mC,{children:[Ir(ke,{icon:ot(cC,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),title:"Transfer Wallet",children:[Ir(gC,{children:[ot(uC,{style:{marginRight:6}}),vo(u)]}),ot("p",{children:"You can bring your account with you to another site using an external wallet."})]}),Ir(fC,{children:[Ir(fh,{children:[ot(hh,{children:"1"}),Ir("span",{children:[ot("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."]})]}),Ir(fh,{children:[ot(hh,{children:"2"}),ot("span",{children:"Copy this key into your other wallet"})]})]}),ot("div",{style:{width:"100%"},children:e&&ot(pC,{origin:g,appId:v,appClientId:y,accessToken:e,clientAnalyticsId:s,address:u,dimensions:{height:"44px"}})}),Ir(vC,{children:[Ir("div",{children:[ot(lC,{viewBox:"0 0 20 18"}),ot("h4",{children:"Warning"})]}),ot("p",{children:"Never share your private key with anyone! It controls your account."})]})]}),ot($,{protectedByPrivy:!0})]})};function pC(e){let[t,r]=_d(e.dimensions.width),[o,n]=_d(void 0),i=dC(null);return yh(()=>{if(i.current&&t===void 0){let{width:s}=i.current.getBoundingClientRect();r(s)}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")})},[]),ot("div",{ref:i,children:t&&Ir(hC,{children:[ot("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:ss(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})}),ot(yC,{children:"Loading..."})]})})}function uC(e){return ot("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e.style,children:ot("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 mC=To.div`
981
1004
  display: flex;
982
1005
  flex-direction: column;
983
1006
  text-align: left;
984
- `,Yv=To.div`
1007
+ `,fC=To.div`
985
1008
  display: flex;
986
1009
  flex-direction: column;
987
1010
  gap: 24px;
988
1011
  padding-bottom: 16px;
989
1012
  margin-left: 11px;
990
1013
  border-left: 1px solid var(--privy-color-foreground-4) !important;
991
- `,rh=To.div`
1014
+ `,fh=To.div`
992
1015
  display: flex;
993
1016
  align-items: top;
994
1017
  gap: 8px;
@@ -997,7 +1020,7 @@ Resources:
997
1020
  color: var(--privy-color-accent);
998
1021
  text-decoration: underline;
999
1022
  }
1000
- `,oh=To.div`
1023
+ `,hh=To.div`
1001
1024
  display: flex;
1002
1025
  align-items: center;
1003
1026
  justify-content: center;
@@ -1011,11 +1034,11 @@ Resources:
1011
1034
  border-radius: 100%;
1012
1035
  background: var(--privy-color-background);
1013
1036
  color: var(--privy-color-accent);
1014
- `,Zv=To.div`
1037
+ `,hC=To.div`
1015
1038
  overflow: visible;
1016
1039
  position: relative;
1017
1040
  height: 44px;
1018
- `,Jv=To.div`
1041
+ `,yC=To.div`
1019
1042
  position: absolute;
1020
1043
  display: flex;
1021
1044
  align-items: center;
@@ -1027,7 +1050,7 @@ Resources:
1027
1050
  border-radius: var(--privy-border-radius-md);
1028
1051
  background-color: var(--privy-color-background-2);
1029
1052
  color: var(--privy-color-foreground-3);
1030
- `,Qv=To.div`
1053
+ `,gC=To.div`
1031
1054
  display: flex;
1032
1055
  align-items: center;
1033
1056
  padding-top: 1px;
@@ -1040,7 +1063,7 @@ Resources:
1040
1063
  font-size: 12px;
1041
1064
  font-weight: 500;
1042
1065
  margin: auto;
1043
- `,Xv=To.div`
1066
+ `,vC=To.div`
1044
1067
  border: 1px solid var(--privy-color-background-2) !important;
1045
1068
  border-radius: var(--privy-border-radius-md);
1046
1069
  padding: 16px;
@@ -1062,9 +1085,9 @@ Resources:
1062
1085
  color: var(--privy-color-error);
1063
1086
  }
1064
1087
  }
1065
- `;import oC from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as nC,useState as ah}from"react";import iC from"styled-components";import{useCallback as tC,useRef as rC}from"react";function hl(){let{refreshUser:e,createAnalyticsEvent:t,initializeWalletProxy:r}=M(),o=rC(!1);return{createWallet:tC(async i=>{let a=await Ee();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(xn);if(!l)throw new Error("walletProxy does not exist.");let s=1e4,c=new Promise((g,v)=>{setTimeout(()=>{v(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 h=await e();if(!h)throw new Error("Failed to refresh user.");let f=xe(h);if(!f)throw new Error("Updated user is missing embedded wallet.");return t({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:f.address}}),o.current=!0,f}catch(l){if(o.current)return;throw t({eventName:"embedded_wallet_creation_failed",payload:{error:l.toString()}}),console.warn(l),l}},[])}}import{Fragment as sC,jsx as oi,jsxs as sh}from"react/jsx-runtime";var lh=()=>{let{app:e,setModalData:t,navigate:r,data:o,onUserCloseViaDialogOrKeybindRef:n}=A(),[i,a]=ah(""),{embeddedWallets:l}=yt(),{authenticated:s}=B(),{closePrivyModal:c}=M(),{onSuccess:u,onFailure:h,callAuthOnSuccessOnClose:f}=o.createWallet,g=e?.embeddedWallets.requireUserOwnedRecoveryOnCreate===!0,{createWallet:v}=hl(),[y,S]=ah(null),_=new Ve(async()=>{try{let x=await v();if(!x)return;S(x),r("EMBEDDED_WALLET_CREATED_SCREEN")}catch(x){a(x.message)}});nC(()=>{if(!s){r("LANDING"),h(new Error("User must be authenticated before creating a Privy wallet"));return}if(g){t({...o,recoverySelection:{...o?.recoverySelection,isInAccountCreateFlow:!0}});let x=ml({walletAction:"create",availableRecoveryMethods:l.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:!1,isResettingPassword:!1});return r(x)}_.execute()},[g,s]);let w=()=>{y?(u(y),c({shouldCallAuthOnSuccess:f})):(h(new St("User wallet creation failed")),c({shouldCallAuthOnSuccess:!1}))};return n.current=()=>null,i?sh(sC,{children:[oi(P,{closeable:!1}),sh(_r,{children:[oi(oC,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),oi(ke,{title:"Something went wrong",description:i})]}),oi(N,{onClick:w,children:"Close"}),oi(aC,{})]}):oi(Qn,{})},aC=iC.div`
1088
+ `;import EC from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as TC,useState as vh}from"react";import PC from"styled-components";import{useCallback as wC,useRef as bC}from"react";function bl(){let{refreshUser:e,createAnalyticsEvent:t,initializeWalletProxy:r}=M(),o=bC(!1);return{createWallet:wC(async i=>{let a=await Ee();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 s=await r(kn);if(!s)throw new Error("walletProxy does not exist.");let l=1e4,c=new Promise((g,v)=>{setTimeout(()=>{v(new Error("walletProxy.create timed out."))},l)});if(!await Promise.race([s.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 h=Ae(f);if(!h)throw new Error("Updated user is missing embedded wallet.");return t({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:h.address}}),o.current=!0,h}catch(s){if(o.current)return;throw t({eventName:"embedded_wallet_creation_failed",payload:{error:s.toString()}}),console.warn(s),s}},[])}}import{Fragment as SC,jsx as si,jsxs as Ch}from"react/jsx-runtime";var wh=()=>{let{app:e,setModalData:t,navigate:r,data:o,onUserCloseViaDialogOrKeybindRef:n}=x(),[i,a]=vh(""),{embeddedWallets:s}=it(),{authenticated:l}=F(),{closePrivyModal:c}=M(),{onSuccess:u,onFailure:f,callAuthOnSuccessOnClose:h}=o.createWallet,g=e?.embeddedWallets.requireUserOwnedRecoveryOnCreate===!0,{createWallet:v}=bl(),[y,T]=vh(null),_=new Fe(async()=>{try{let A=await v();if(!A)return;T(A),r("EMBEDDED_WALLET_CREATED_SCREEN")}catch(A){a(A.message)}});TC(()=>{if(!l){r("LANDING"),f(new Error("User must be authenticated before creating a Privy wallet"));return}if(g){t({...o,recoverySelection:{...o?.recoverySelection,isInAccountCreateFlow:!0}});let A=Cl({walletAction:"create",availableRecoveryMethods:s.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:!1,isResettingPassword:!1});return r(A)}_.execute()},[g,l]);let b=()=>{y?(u(y),c({shouldCallAuthOnSuccess:h})):(f(new _t("User wallet creation failed")),c({shouldCallAuthOnSuccess:!1}))};return n.current=()=>null,i?Ch(SC,{children:[si(S,{closeable:!1}),Ch(Ar,{children:[si(EC,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),si(ke,{title:"Something went wrong",description:i})]}),si(D,{onClick:b,children:"Close"}),si(_C,{})]}):si(ri,{})},_C=PC.div`
1066
1089
  height: 44px;
1067
- `;import{useEffect as e4,useState as wl}from"react";import{useCallback as _d,useEffect as XC}from"react";import uC from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useEffect as mC,useState as Ed}from"react";import lC from"@heroicons/react/24/outline/ArrowPathIcon";import cC from"@heroicons/react/24/outline/EyeIcon";import dC from"@heroicons/react/24/outline/EyeSlashIcon";import Ct,{css as wd}from"styled-components";var pC=wd`
1090
+ `;import{useEffect as C4,useState as Sl}from"react";import{useCallback as Md,useEffect as v4}from"react";import IC from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useEffect as MC,useState as xd}from"react";import AC from"@heroicons/react/24/outline/ArrowPathIcon";import xC from"@heroicons/react/24/outline/EyeIcon";import kC from"@heroicons/react/24/outline/EyeSlashIcon";import Ct,{css as Sd}from"styled-components";var RC=Sd`
1068
1091
  font-size: 14px;
1069
1092
  font-style: normal;
1070
1093
  font-weight: 400;
@@ -1072,8 +1095,8 @@ Resources:
1072
1095
  letter-spacing: -0.008px;
1073
1096
  text-align: left;
1074
1097
  transition: color 0.1s ease-in;
1075
- `,yl=Ct.span`
1076
- ${pC}
1098
+ `,El=Ct.span`
1099
+ ${RC}
1077
1100
  transition: color 0.1s ease-in;
1078
1101
  color: ${({error:e})=>e?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
1079
1102
  text-transform: ${({error:e})=>e?"":"capitalize"};
@@ -1086,13 +1109,13 @@ Resources:
1086
1109
  flex-direction: column;
1087
1110
  justify-content: center;
1088
1111
  flex-grow: 1;
1089
- `,So=Ct(N)`
1090
- ${e=>e.hideAnimations&&wd`
1112
+ `,_o=Ct(D)`
1113
+ ${e=>e.hideAnimations&&Sd`
1091
1114
  && {
1092
1115
  transition: none;
1093
1116
  }
1094
1117
  `}
1095
- `,ch=wd`
1118
+ `,bh=Sd`
1096
1119
  && {
1097
1120
  width: 100%;
1098
1121
  border-width: 1px;
@@ -1107,8 +1130,8 @@ Resources:
1107
1130
  font-weight: 300;
1108
1131
  line-height: 22px; /* 137.5% */
1109
1132
  }
1110
- `,ni=Ct.input`
1111
- ${ch}
1133
+ `,li=Ct.input`
1134
+ ${bh}
1112
1135
 
1113
1136
  &::placeholder {
1114
1137
  color: var(--privy-color-foreground-3);
@@ -1119,15 +1142,15 @@ Resources:
1119
1142
  overflow: hidden;
1120
1143
  text-overflow: ellipsis;
1121
1144
  white-space: nowrap;
1122
- `,dh=Ct.div`
1123
- ${ch}
1124
- `,_o=Ct.div`
1145
+ `,Eh=Ct.div`
1146
+ ${bh}
1147
+ `,So=Ct.div`
1125
1148
  position: relative;
1126
1149
  width: 100%;
1127
1150
  display: flex;
1128
1151
  align-items: center;
1129
1152
  justify-content: ${({centered:e})=>e?"center":"space-between"};
1130
- `,xo=Ct.div`
1153
+ `,Ao=Ct.div`
1131
1154
  display: flex;
1132
1155
  flex-direction: column;
1133
1156
  align-items: center;
@@ -1149,12 +1172,12 @@ Resources:
1149
1172
  font-weight: 400;
1150
1173
  line-height: 20px;
1151
1174
  }
1152
- `,ra=Ct.div`
1175
+ `,la=Ct.div`
1153
1176
  display: flex;
1154
1177
  flex-direction: column;
1155
1178
  gap: 10px;
1156
1179
  padding-bottom: 1rem;
1157
- `,oa=Ct.div`
1180
+ `,ca=Ct.div`
1158
1181
  display: flex;
1159
1182
  text-align: left;
1160
1183
  align-items: center;
@@ -1174,13 +1197,13 @@ Resources:
1174
1197
  > :first-child {
1175
1198
  min-width: 24px;
1176
1199
  }
1177
- `,GW=Ct.div`
1200
+ `,PL=Ct.div`
1178
1201
  height: var(--privy-height-modal-full);
1179
1202
 
1180
1203
  @media (max-width: 440px) {
1181
1204
  height: var(--privy-height-modal-compact);
1182
1205
  }
1183
- `,bd=Ct($s)`
1206
+ `,Ad=Ct(Ji)`
1184
1207
  display: flex;
1185
1208
  flex: 1;
1186
1209
  gap: 4px;
@@ -1192,7 +1215,7 @@ Resources:
1192
1215
  border-color: var(--privy-color-foreground-3);
1193
1216
  border-width: 1px;
1194
1217
  }
1195
- `,ii=Ct.div`
1218
+ `,ci=Ct.div`
1196
1219
  position: absolute;
1197
1220
  right: 0.5rem;
1198
1221
 
@@ -1200,7 +1223,7 @@ Resources:
1200
1223
  flex-direction: row;
1201
1224
  justify-content: space-around;
1202
1225
  align-items: center;
1203
- `,ph=Ct(lC)`
1226
+ `,Th=Ct(AC)`
1204
1227
  height: 1.25rem;
1205
1228
  width: 1.25rem;
1206
1229
  stroke: var(--privy-color-accent);
@@ -1209,7 +1232,7 @@ Resources:
1209
1232
  :active {
1210
1233
  stroke: var(--privy-color-accent-light);
1211
1234
  }
1212
- `,ai=Ct(dC)`
1235
+ `,di=Ct(kC)`
1213
1236
  height: 1.25rem;
1214
1237
  width: 1.25rem;
1215
1238
  stroke: var(--privy-color-accent);
@@ -1218,7 +1241,7 @@ Resources:
1218
1241
  :active {
1219
1242
  stroke: var(--privy-color-accent-light);
1220
1243
  }
1221
- `,si=Ct(cC)`
1244
+ `,pi=Ct(xC)`
1222
1245
  height: 1.25rem;
1223
1246
  width: 1.25rem;
1224
1247
  stroke: var(--privy-color-accent);
@@ -1227,7 +1250,7 @@ Resources:
1227
1250
  :active {
1228
1251
  stroke: var(--privy-color-accent-light);
1229
1252
  }
1230
- `,uh=Ct.progress`
1253
+ `,Ph=Ct.progress`
1231
1254
  height: 4px;
1232
1255
  width: 100%;
1233
1256
  margin: 8px 0;
@@ -1243,7 +1266,7 @@ Resources:
1243
1266
  transition: all 0.1s ease-out;
1244
1267
  background: ${({label:e})=>e==="Strong"&&"#78dca6"||e==="Medium"&&"var(--privy-color-warn)"||"var(--privy-color-error)"};
1245
1268
  }
1246
- `;import{Fragment as fC,jsx as er,jsxs as gl}from"react/jsx-runtime";var mh=({buttonHideAnimations:e,buttonLoading:t,password:r,onSubmit:o,onBack:n})=>{let[i,a]=Ed(!0),[l,s]=Ed(!1),[c,u]=Ed(""),h=r===c;return mC(()=>{c&&!l&&s(!0)},[c]),gl(fC,{children:[er(P,{closeable:!1,backFn:n}),er(Q,{}),gl(Po,{children:[gl(xo,{children:[er(uC,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),er("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),er("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),gl(_o,{children:[er(ni,{value:c,onChange:f=>u(f.target.value),onBlur:()=>s(!0),placeholder:"confirm your password",type:i?"password":"text",style:{paddingRight:"2.3rem"}}),er(ii,{style:{right:"0.75rem"},children:i?er(ai,{onClick:()=>a(!1)}):er(si,{onClick:()=>a(!0)})})]}),er(yl,{"aria-hidden":!l||h,error:!0,children:"Passwords do not match"})]}),er(So,{onClick:o,loading:t,disabled:!h,hideAnimations:e,children:"Continue"}),er(re,{}),er(q,{protectedByPrivy:!0})]})};import vC from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as CC}from"react";import wC from"styled-components";import ia from"styled-components";import{jsx as na,jsxs as gC}from"react/jsx-runtime";var fh=({className:e,checked:t,color:r="var(--privy-color-accent)",...o})=>na("label",{children:gC(hC,{className:e,children:[na(yh,{checked:t,...o}),na(yC,{color:r,checked:t,children:na(hh,{viewBox:"0 0 24 24",children:na("polyline",{points:"20 6 9 17 4 12"})})})]})});var eL=ia.label`
1269
+ `;import{Fragment as WC,jsx as tr,jsxs as Tl}from"react/jsx-runtime";var _h=({buttonHideAnimations:e,buttonLoading:t,password:r,onSubmit:o,onBack:n})=>{let[i,a]=xd(!0),[s,l]=xd(!1),[c,u]=xd(""),f=r===c;return MC(()=>{c&&!s&&l(!0)},[c]),Tl(WC,{children:[tr(S,{closeable:!1,backFn:n}),tr(Q,{}),Tl(Po,{children:[Tl(Ao,{children:[tr(IC,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),tr("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),tr("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),Tl(So,{children:[tr(li,{value:c,onChange:h=>u(h.target.value),onBlur:()=>l(!0),placeholder:"confirm your password",type:i?"password":"text",style:{paddingRight:"2.3rem"}}),tr(ci,{style:{right:"0.75rem"},children:i?tr(di,{onClick:()=>a(!1)}):tr(pi,{onClick:()=>a(!0)})})]}),tr(El,{"aria-hidden":!s||f,error:!0,children:"Passwords do not match"})]}),tr(_o,{onClick:o,loading:t,disabled:!f,hideAnimations:e,children:"Continue"}),tr(re,{}),tr($,{protectedByPrivy:!0})]})};import DC from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as UC}from"react";import FC from"styled-components";import pa from"styled-components";import{jsx as da,jsxs as NC}from"react/jsx-runtime";var Sh=({className:e,checked:t,color:r="var(--privy-color-accent)",...o})=>da("label",{children:NC(LC,{className:e,children:[da(xh,{checked:t,...o}),da(OC,{color:r,checked:t,children:da(Ah,{viewBox:"0 0 24 24",children:da("polyline",{points:"20 6 9 17 4 12"})})})]})});var NL=pa.label`
1247
1270
  && {
1248
1271
  cursor: pointer;
1249
1272
  display: flex;
@@ -1255,14 +1278,14 @@ Resources:
1255
1278
  border: 1px solid var(--privy-color-foreground-4);
1256
1279
  width: 100%;
1257
1280
  }
1258
- `,hC=ia.div`
1281
+ `,LC=pa.div`
1259
1282
  display: inline-block;
1260
1283
  vertical-align: middle;
1261
- `,hh=ia.svg`
1284
+ `,Ah=pa.svg`
1262
1285
  fill: none;
1263
1286
  stroke: white;
1264
1287
  stroke-width: 3px;
1265
- `,yh=ia.input.attrs({type:"checkbox"})`
1288
+ `,xh=pa.input.attrs({type:"checkbox"})`
1266
1289
  border: 0;
1267
1290
  clip: rect(0 0 0 0);
1268
1291
  clippath: inset(50%);
@@ -1273,7 +1296,7 @@ Resources:
1273
1296
  position: absolute;
1274
1297
  white-space: nowrap;
1275
1298
  width: 1px;
1276
- `,yC=ia.div`
1299
+ `,OC=pa.div`
1277
1300
  display: inline-block;
1278
1301
  width: 18px;
1279
1302
  height: 18px;
@@ -1288,28 +1311,28 @@ Resources:
1288
1311
  border-width: 1px;
1289
1312
  }
1290
1313
 
1291
- ${yh}:focus + & {
1314
+ ${xh}:focus + & {
1292
1315
  box-shadow: 0 0 0 1px ${e=>e.color};
1293
1316
  }
1294
1317
 
1295
- ${hh} {
1318
+ ${Ah} {
1296
1319
  visibility: ${e=>e.checked?"visible":"hidden"};
1297
1320
  }
1298
- `;import{Fragment as gh,jsx as fr,jsxs as aa}from"react/jsx-runtime";var vh=({buttonHideAnimations:e,buttonLoading:t,onSubmit:r,onBack:o,config:n})=>{let[i,a]=CC(!1);return aa(gh,{children:[fr(P,{closeable:!1,backFn:o}),fr(Q,{}),aa(Po,{children:[aa(xo,{children:[fr(vC,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),fr("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),fr("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),fr(ra,{children:aa(oa,{style:{color:"var(--privy-color-error)",cursor:"pointer"},onClick:l=>{l.preventDefault(),a(s=>!s)},children:[fr(fh,{color:"var(--privy-color-error)",readOnly:!0,checked:i}),fr(gh,{children:"I understand that if I lose my password and device, I will lose access to my account and my assets."})]})})]}),aa(bC,{children:[n.initiatedBy==="user"&&fr(Tr,{onClick:n.onCancel,disabled:t,children:"Cancel"}),fr(So,{onClick:r,loading:t,hideAnimations:e,disabled:!i,children:"Set Password"})]}),fr(re,{}),fr(q,{protectedByPrivy:!0})]})},bC=wC.div`
1321
+ `;import{Fragment as kh,jsx as fr,jsxs as ua}from"react/jsx-runtime";var Rh=({buttonHideAnimations:e,buttonLoading:t,onSubmit:r,onBack:o,config:n})=>{let[i,a]=UC(!1);return ua(kh,{children:[fr(S,{closeable:!1,backFn:o}),fr(Q,{}),ua(Po,{children:[ua(Ao,{children:[fr(DC,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),fr("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),fr("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),fr(la,{children:ua(ca,{style:{color:"var(--privy-color-error)",cursor:"pointer"},onClick:s=>{s.preventDefault(),a(l=>!l)},children:[fr(Sh,{color:"var(--privy-color-error)",readOnly:!0,checked:i}),fr(kh,{children:"I understand that if I lose my password and device, I will lose access to my account and my assets."})]})})]}),ua(BC,{children:[n.initiatedBy==="user"&&fr(Pr,{onClick:n.onCancel,disabled:t,children:"Cancel"}),fr(_o,{onClick:r,loading:t,hideAnimations:e,disabled:!i,children:"Set Password"})]}),fr(re,{}),fr($,{protectedByPrivy:!0})]})},BC=FC.div`
1299
1322
  display: flex;
1300
1323
  gap: 10px;
1301
- `;import DC from"@heroicons/react/24/outline/KeyIcon";import Sh from"@heroicons/react/24/solid/CheckCircleIcon";import{useState as _h,useMemo as Td,useEffect as UC}from"react";import xh from"styled-components";import EC from"fast-password-entropy";import*as Ch from"secure-password-utilities";import{DEFAULT_WORDLIST as TC}from"secure-password-utilities/wordlists";var PC=95,SC=8,_C=3,xC=.3,AC=/[a-z]/,kC=/[A-Z]/,RC=/[0-9]/,IC="a-zA-Z0-9",wh="!@#$%^&*()\\-_+.",bh=`${IC}${wh}`,MC=new RegExp(`[${wh}]`),WC=new RegExp(`[${bh}]`),Eh=new RegExp(`^[${bh}]{6,}$`),Th=(e="")=>{let t=e.split("").filter(r=>!WC.test(r)).map(r=>r.replace(" ","SPACE"));return[...new Set(t)]},vl=()=>Ch.generatePassphrase(4,TC);function LC(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function OC(e){if(e.length<SC)return 0;let t=0;AC.test(e)&&(t+=1),kC.test(e)&&(t+=1),RC.test(e)&&(t+=1),MC.test(e)&&(t+=1);let r=t/_C;return Math.max(0,Math.min(1,r))}function NC(e=""){let t=OC(e),r=EC(e)/PC;return(t*xC+r)/2}function Ph(e=""){let t=NC(e);return{value:t,label:LC(t)}}import{Fragment as HC,jsx as wt,jsxs as $r}from"react/jsx-runtime";var Ah=({buttonHideAnimations:e,buttonLoading:t,password:r="",config:o,isResettingPassword:n,onSubmit:i,onClose:a,onBack:l,onPasswordChange:s,onPasswordGenerate:c})=>{let[u,h]=_h(!1),[f,g]=_h(!1);UC(()=>{r&&!f&&g(!0)},[r]);let v=Td(()=>f?(r?.length||0)<6?"Password must be at least 6 characters":Eh.test(r||"")?null:`Invalid characters used ( ${Th(r).join(" ")} )`:null,[r,f]),y=Td(()=>v?{value:0,label:"Weak"}:Ph(r),[r,v]),S=Td(()=>!!(!r?.length||v),[v,r]);return $r(HC,{children:[wt(P,{onClose:a,closeable:o.initiatedBy==="user",backFn:l}),wt(Q,{}),$r(Po,{children:[$r(xo,{children:[wt(DC,{height:48,width:48,stroke:"var(--privy-color-accent)"}),$r("h3",{style:{color:"var(--privy-color-foreground)"},children:[n?"Reset":"Set"," your password"]}),wt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),$r(_o,{children:[wt(ni,{value:r,onChange:_=>s(_.target.value),placeholder:"enter or generate a strong password",type:u?"password":"text",style:{paddingRight:"3.8rem"}}),$r(ii,{style:{width:"3.5rem"},children:[u?wt(ai,{onClick:()=>h(!1)}):wt(si,{onClick:()=>h(!0)}),wt(ph,{onClick:c})]})]}),wt(uh,{value:y.value===0?.01:y.value,label:y.label}),wt(yl,{error:!!v,children:v||`Password Strength: ${f?y.label:"--"}`}),$r(BC,{children:[wt(FC,{children:$r(ra,{children:[$r(oa,{children:[wt(Sh,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),$r(oa,{children:[wt(Sh,{width:24,height:24,fill:"var(--privy-color-accent)"}),"Use it to log in on a new environment, like another browser or device."]})]})}),wt(So,{onClick:i,loading:t,disabled:S,hideAnimations:e,children:"Continue"})]})]}),wt(re,{}),wt(q,{protectedByPrivy:!0})]})},FC=xh(ra)`
1324
+ `;import r4 from"@heroicons/react/24/outline/KeyIcon";import Dh from"@heroicons/react/24/solid/CheckCircleIcon";import{useState as Uh,useMemo as kd,useEffect as o4}from"react";import Fh from"styled-components";import HC from"fast-password-entropy";import*as Ih from"secure-password-utilities";import{DEFAULT_WORDLIST as GC}from"secure-password-utilities/wordlists";var VC=95,zC=8,qC=3,$C=.3,KC=/[a-z]/,jC=/[A-Z]/,YC=/[0-9]/,ZC="a-zA-Z0-9",Mh="!@#$%^&*()\\-_+.",Wh=`${ZC}${Mh}`,JC=new RegExp(`[${Mh}]`),QC=new RegExp(`[${Wh}]`),Lh=new RegExp(`^[${Wh}]{6,}$`),Oh=(e="")=>{let t=e.split("").filter(r=>!QC.test(r)).map(r=>r.replace(" ","SPACE"));return[...new Set(t)]},Pl=()=>Ih.generatePassphrase(4,GC);function XC(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function e4(e){if(e.length<zC)return 0;let t=0;KC.test(e)&&(t+=1),jC.test(e)&&(t+=1),YC.test(e)&&(t+=1),JC.test(e)&&(t+=1);let r=t/qC;return Math.max(0,Math.min(1,r))}function t4(e=""){let t=e4(e),r=HC(e)/VC;return(t*$C+r)/2}function Nh(e=""){let t=t4(e);return{value:t,label:XC(t)}}import{Fragment as a4,jsx as wt,jsxs as Kr}from"react/jsx-runtime";var Bh=({buttonHideAnimations:e,buttonLoading:t,password:r="",config:o,isResettingPassword:n,onSubmit:i,onClose:a,onBack:s,onPasswordChange:l,onPasswordGenerate:c})=>{let[u,f]=Uh(!1),[h,g]=Uh(!1);o4(()=>{r&&!h&&g(!0)},[r]);let v=kd(()=>h?(r?.length||0)<6?"Password must be at least 6 characters":Lh.test(r||"")?null:`Invalid characters used ( ${Oh(r).join(" ")} )`:null,[r,h]),y=kd(()=>v?{value:0,label:"Weak"}:Nh(r),[r,v]),T=kd(()=>!!(!r?.length||v),[v,r]);return Kr(a4,{children:[wt(S,{onClose:a,closeable:o.initiatedBy==="user",backFn:s}),wt(Q,{}),Kr(Po,{children:[Kr(Ao,{children:[wt(r4,{height:48,width:48,stroke:"var(--privy-color-accent)"}),Kr("h3",{style:{color:"var(--privy-color-foreground)"},children:[n?"Reset":"Set"," your password"]}),wt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),Kr(So,{children:[wt(li,{value:r,onChange:_=>l(_.target.value),placeholder:"enter or generate a strong password",type:u?"password":"text",style:{paddingRight:"3.8rem"}}),Kr(ci,{style:{width:"3.5rem"},children:[u?wt(di,{onClick:()=>f(!1)}):wt(pi,{onClick:()=>f(!0)}),wt(Th,{onClick:c})]})]}),wt(Ph,{value:y.value===0?.01:y.value,label:y.label}),wt(El,{error:!!v,children:v||`Password Strength: ${h?y.label:"--"}`}),Kr(i4,{children:[wt(n4,{children:Kr(la,{children:[Kr(ca,{children:[wt(Dh,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),Kr(ca,{children:[wt(Dh,{width:24,height:24,fill:"var(--privy-color-accent)"}),"Use it to log in on a new environment, like another browser or device."]})]})}),wt(_o,{onClick:i,loading:t,disabled:T,hideAnimations:e,children:"Continue"})]})]}),wt(re,{}),wt($,{protectedByPrivy:!0})]})},n4=Fh(la)`
1302
1325
  flex: 1;
1303
1326
  padding-top: 1rem;
1304
- `,BC=xh.div`
1327
+ `,i4=Fh.div`
1305
1328
  display: flex;
1306
1329
  flex-direction: column;
1307
1330
  height: 100%;
1308
- `;import GC from"@heroicons/react/24/outline/ArrowDownTrayIcon";import VC from"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import zC from"@heroicons/react/24/outline/DocumentDuplicateIcon";import qC from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as $C,useCallback as kh}from"react";import{Fragment as Pd,jsx as Ht,jsxs as cn}from"react/jsx-runtime";var Rh=({buttonHideAnimations:e,buttonLoading:t,appName:r,password:o,onSubmit:n,onBack:i})=>{let[a,l]=$C(!1),s=kh(()=>{l(!0),o&&navigator.clipboard.writeText(o)},[o]),c=kh(()=>{let u=document.createElement("a"),h=r.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),f=new Blob([KC(r,o)],{type:"text/plain"}),g=URL.createObjectURL(f);u.href=g,u.target="_blank",u.download=`${h}-privy-wallet-recovery.txt`,document.body.appendChild(u),u.click(),setTimeout(()=>{u.remove(),URL.revokeObjectURL(g)},5e3)},[o]);return cn(Pd,{children:[Ht(P,{backFn:i,closeable:!1}),Ht(Q,{}),cn(Po,{children:[cn(xo,{children:[Ht(qC,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),Ht("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),Ht("p",{style:{color:"var(--privy-color-foreground-2)"},children:"For your security, this password cannot be reset, so keep it somewhere safe."})]}),Ht(_o,{centered:!0,children:Ht(dh,{children:o})}),cn("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[Ht(bd,{onClick:s,children:a?cn(Pd,{children:[Ht(VC,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):cn(Pd,{children:[Ht(zC,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),cn(bd,{onClick:c,children:[Ht(GC,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),Ht(So,{onClick:n,loading:t,hideAnimations:e,children:"Continue"}),Ht(re,{}),Ht(q,{protectedByPrivy:!0})]})},KC=(e,t)=>`Your wallet recovery password for ${e} is
1331
+ `;import s4 from"@heroicons/react/24/outline/ArrowDownTrayIcon";import l4 from"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import c4 from"@heroicons/react/24/outline/DocumentDuplicateIcon";import d4 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as p4,useCallback as Hh}from"react";import{Fragment as Rd,jsx as Vt,jsxs as dn}from"react/jsx-runtime";var Gh=({buttonHideAnimations:e,buttonLoading:t,appName:r,password:o,onSubmit:n,onBack:i})=>{let[a,s]=p4(!1),l=Hh(()=>{s(!0),o&&navigator.clipboard.writeText(o)},[o]),c=Hh(()=>{let u=document.createElement("a"),f=r.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),h=new Blob([u4(r,o)],{type:"text/plain"}),g=URL.createObjectURL(h);u.href=g,u.target="_blank",u.download=`${f}-privy-wallet-recovery.txt`,document.body.appendChild(u),u.click(),setTimeout(()=>{u.remove(),URL.revokeObjectURL(g)},5e3)},[o]);return dn(Rd,{children:[Vt(S,{backFn:i,closeable:!1}),Vt(Q,{}),dn(Po,{children:[dn(Ao,{children:[Vt(d4,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),Vt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),Vt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"For your security, this password cannot be reset, so keep it somewhere safe."})]}),Vt(So,{centered:!0,children:Vt(Eh,{children:o})}),dn("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[Vt(Ad,{onClick:l,children:a?dn(Rd,{children:[Vt(l4,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):dn(Rd,{children:[Vt(c4,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),dn(Ad,{onClick:c,children:[Vt(s4,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),Vt(_o,{onClick:n,loading:t,hideAnimations:e,children:"Continue"}),Vt(re,{}),Vt($,{protectedByPrivy:!0})]})},u4=(e,t)=>`Your wallet recovery password for ${e} is
1309
1332
 
1310
1333
  ${t}
1311
1334
 
1312
- You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;import jC from"@heroicons/react/24/solid/CheckCircleIcon";import YC from"@heroicons/react/24/solid/XCircleIcon";import{Fragment as ZC,jsx as so,jsxs as Sd}from"react/jsx-runtime";var Ih=({error:e,onClose:t})=>Sd(ZC,{children:[so(P,{closeable:!1}),so(Q,{}),e?Sd(_r,{children:[so(YC,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),so(ke,{title:"Something went wrong",description:e})]}):Sd(_r,{children:[so(jC,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),so(ke,{title:"Success"})]}),so(N,{onClick:t,children:"Close"}),so(re,{}),so(q,{protectedByPrivy:!0})]});import{useReducer as JC}from"react";var QC=(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}},Mh=()=>{let[e,t]=JC(QC,"creating");return{send:t,state:e}};import{jsx as sa}from"react/jsx-runtime";var Cl=({onSubmit:e,...t})=>{let{lastScreen:r,navigate:o}=A(),{send:n,state:i}=Mh(),a=_d(async()=>{i==="finalizing"&&await e(),n("next")},[i,n,e]);XC(()=>{let c;return i==="done"&&t.config.initiatedBy==="automatic"&&(c=setTimeout(()=>t.onClose?.(),Fe)),()=>{c&&clearTimeout(c)}},[i,t.config.initiatedBy,t.onClose]);let l=_d(()=>{n("back")},[n]),s=_d(()=>{o("EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN")},[r,o]);return i==="creating"?sa(Ah,{...t,onSubmit:a,onBack:r==="EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"?s:void 0}):i==="saving"?sa(Rh,{...t,onSubmit:a,onBack:l}):i==="confirming"?sa(mh,{...t,onSubmit:a,onBack:l}):i==="finalizing"?sa(vh,{...t,onSubmit:a,onBack:l}):i==="done"?sa(Ih,{...t,onSubmit:a}):null};import{jsx as t4}from"react/jsx-runtime";var Wh=()=>{let[e,t]=wl(null),[r,o]=wl(!1),[n,i]=wl(null),[a,l]=wl(""),{authenticated:s,getAccessToken:c,user:u}=B(),{walletProxy:h,refreshUser:f,closePrivyModal:g,createAnalyticsEvent:v}=M(),{app:y,navigate:S,data:_,onUserCloseViaDialogOrKeybindRef:w}=A(),{onSuccess:x,onFailure:k}=_.createWallet,D=xe(u),I=e?.recoveryMethod==="user-passcode",R=D?.recoveryMethod==="user-passcode";e4(()=>{s||(S("LANDING"),k(new Ga("User must be authenticated before setting a password on a Privy wallet")))},[s]);let H=()=>{if(n){k(n),g({shouldCallAuthOnSuccess:!1});return}if(!I){k(new St("Exited before password was added to wallet")),g({shouldCallAuthOnSuccess:!1});return}x(e),g({shouldCallAuthOnSuccess:!1})};w.current=H;let K=async()=>{let W=await c();if(W&&D?.address&&a&&h)try{if(v({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:D.address,recoveryMethod:"user-passcode",isResettingPassword:R}}),!(await h.setRecovery({accessToken:W,address:D.address,recoveryPassword:a,recoveryMethod:"user-passcode"})).address){i(new St("Error setting password on privy wallet")),v({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:D.address,recoveryMethod:"user-passcode",isResettingPassword:R,reason:"error setting password"}});return}let L=await f(),ae=xe(L);if(!ae){i(new St("Error setting password on privy wallet")),v({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:D.address,recoveryMethod:"user-passcode",isResettingPassword:R,reason:"wallet disconnected"}});return}t(ae),v({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:D.address,recoveryMethod:"user-passcode",isResettingPassword:R}})}catch(G){console.warn(G),i(G instanceof Error?G:new Error("Error setting password on privy wallet")),v({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:D.address,reason:G}})}},Y=async()=>{I?(x(e),g({shouldCallAuthOnSuccess:!1})):(o(!0),i(null),await K(),o(!1))};return t4(Cl,{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:R,onPasswordGenerate:()=>l(vl()),onPasswordChange:l,onSubmit:Y,onClose:H})};import r4 from"@heroicons/react/24/outline/UserCircleIcon";import o4 from"@heroicons/react/24/solid/LockClosedIcon";import{Fragment as n4,jsx as lo,jsxs as bl}from"react/jsx-runtime";var Lh=()=>{let{closePrivyModal:e}=M(),{data:t,setModalData:r,navigate:o,onUserCloseViaDialogOrKeybindRef:n}=A(),{onSuccess:i,onFailure:a}=t.setWalletPassword,l=()=>{a(new St("Exited before password was added to wallet")),e({shouldCallAuthOnSuccess:!1})};return n.current=l,bl(n4,{children:[lo(P,{onClose:l}),lo(Q,{}),bl(_r,{children:[bl(mf,{children:[lo(r4,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),lo(ff,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:lo(o4,{width:"12px",height:"12px",fill:"white"})})]}),bl(ke,{title:"Secure Your Account",children:["Please set a password to secure your account.",lo("p",{children:"Losing access to this password and this device will make your account inaccessible."})]})]}),lo(N,{onClick:()=>{r({createWallet:{onFailure:a,onSuccess:i,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),o("EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:"Add password"}),lo(re,{}),lo(q,{protectedByPrivy:!0})]})};import i4 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import a4 from"@heroicons/react/24/outline/PhoneIcon";import Oh from"styled-components";import{Fragment as d4,jsx as hr,jsxs as El}from"react/jsx-runtime";var s4=e=>{let t=hr(i4,{height:38,width:38,stroke:"var(--privy-color-error)"});if(e instanceof b)switch(e.privyErrorCode){case"client_request_timeout":return{title:"Timed out",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 Ge&&e.type==="twilio_verification_failed")return{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:hr(a4,{height:38,width:38,stroke:"var(--privy-color-error)"})};if(e instanceof $e)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:hr(il,{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:hr("span",{})};case"captcha_timeout":return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:hr("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 wr&&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}}},Nh=()=>{let{navigate:e,navigateBack:t,data:r,lastScreen:o,currentScreen:n}=A();return hr(la,{error:r?.errorModalData?.error||new Error,backFn:!o||n===o?void 0:t,onClick:()=>e(o||"LANDING",!1)})},la=({error:e,backFn:t,onClick:r})=>{let{reset:o}=ye(),n=s4(e),i=()=>{e instanceof $e&&e.privyErrorCode==="invalid_captcha"&&o(),r?.()};return El(d4,{children:[hr(P,{backFn:t}),El(l4,{children:[hr(at,{children:El("div",{children:[hr(nl,{color:"var(--privy-color-error)"}),n.icon]})}),El(c4,{children:[hr("h3",{children:n.title}),hr("p",{children:n.detail})]}),hr(N,{color:"var(--privy-color-error)",onClick:i,children:n.ctaText})]})]})},l4=Oh.div`
1335
+ You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;import m4 from"@heroicons/react/24/solid/CheckCircleIcon";import f4 from"@heroicons/react/24/solid/XCircleIcon";import{Fragment as h4,jsx as co,jsxs as Id}from"react/jsx-runtime";var Vh=({error:e,onClose:t})=>Id(h4,{children:[co(S,{closeable:!1}),co(Q,{}),e?Id(Ar,{children:[co(f4,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),co(ke,{title:"Something went wrong",description:e})]}):Id(Ar,{children:[co(m4,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),co(ke,{title:"Success"})]}),co(D,{onClick:t,children:"Close"}),co(re,{}),co($,{protectedByPrivy:!0})]});import{useReducer as y4}from"react";var g4=(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}},zh=()=>{let[e,t]=y4(g4,"creating");return{send:t,state:e}};import{jsx as ma}from"react/jsx-runtime";var _l=({onSubmit:e,...t})=>{let{lastScreen:r,navigate:o}=x(),{send:n,state:i}=zh(),a=Md(async()=>{i==="finalizing"&&await e(),n("next")},[i,n,e]);v4(()=>{let c;return i==="done"&&t.config.initiatedBy==="automatic"&&(c=setTimeout(()=>t.onClose?.(),Oe)),()=>{c&&clearTimeout(c)}},[i,t.config.initiatedBy,t.onClose]);let s=Md(()=>{n("back")},[n]),l=Md(()=>{o("EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN")},[r,o]);return i==="creating"?ma(Bh,{...t,onSubmit:a,onBack:r==="EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"?l:void 0}):i==="saving"?ma(Gh,{...t,onSubmit:a,onBack:s}):i==="confirming"?ma(_h,{...t,onSubmit:a,onBack:s}):i==="finalizing"?ma(Rh,{...t,onSubmit:a,onBack:s}):i==="done"?ma(Vh,{...t,onSubmit:a}):null};import{jsx as w4}from"react/jsx-runtime";var qh=()=>{let[e,t]=Sl(null),[r,o]=Sl(!1),[n,i]=Sl(null),[a,s]=Sl(""),{authenticated:l,getAccessToken:c,user:u}=F(),{walletProxy:f,refreshUser:h,closePrivyModal:g,createAnalyticsEvent:v}=M(),{app:y,navigate:T,data:_,onUserCloseViaDialogOrKeybindRef:b}=x(),{onSuccess:A,onFailure:k}=_.createWallet,N=Ae(u),R=e?.recoveryMethod==="user-passcode",I=N?.recoveryMethod==="user-passcode";C4(()=>{l||(T("LANDING"),k(new Ya("User must be authenticated before setting a password on a Privy wallet")))},[l]);let H=()=>{if(n){k(n),g({shouldCallAuthOnSuccess:!1});return}if(!R){k(new _t("Exited before password was added to wallet")),g({shouldCallAuthOnSuccess:!1});return}A(e),g({shouldCallAuthOnSuccess:!1})};b.current=H;let G=async()=>{let W=await c();if(W&&N?.address&&a&&f)try{if(v({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:N.address,recoveryMethod:"user-passcode",isResettingPassword:I}}),!(await f.setRecovery({accessToken:W,address:N.address,recoveryPassword:a,recoveryMethod:"user-passcode"})).address){i(new _t("Error setting password on privy wallet")),v({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:N.address,recoveryMethod:"user-passcode",isResettingPassword:I,reason:"error setting password"}});return}let L=await h(),se=Ae(L);if(!se){i(new _t("Error setting password on privy wallet")),v({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:N.address,recoveryMethod:"user-passcode",isResettingPassword:I,reason:"wallet disconnected"}});return}t(se),v({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:N.address,recoveryMethod:"user-passcode",isResettingPassword:I}})}catch(q){console.warn(q),i(q instanceof Error?q:new Error("Error setting password on privy wallet")),v({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:N.address,reason:q}})}},Z=async()=>{R?(A(e),g({shouldCallAuthOnSuccess:!1})):(o(!0),i(null),await G(),o(!1))};return w4(_l,{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:I,onPasswordGenerate:()=>s(Pl()),onPasswordChange:s,onSubmit:Z,onClose:H})};import b4 from"@heroicons/react/24/outline/UserCircleIcon";import E4 from"@heroicons/react/24/solid/LockClosedIcon";import{Fragment as T4,jsx as po,jsxs as Al}from"react/jsx-runtime";var $h=()=>{let{closePrivyModal:e}=M(),{data:t,setModalData:r,navigate:o,onUserCloseViaDialogOrKeybindRef:n}=x(),{onSuccess:i,onFailure:a}=t.setWalletPassword,s=()=>{a(new _t("Exited before password was added to wallet")),e({shouldCallAuthOnSuccess:!1})};return n.current=s,Al(T4,{children:[po(S,{onClose:s}),po(Q,{}),Al(Ar,{children:[Al(wf,{children:[po(b4,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),po(bf,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:po(E4,{width:"12px",height:"12px",fill:"white"})})]}),Al(ke,{title:"Secure Your Account",children:["Please set a password to secure your account.",po("p",{children:"Losing access to this password and this device will make your account inaccessible."})]})]}),po(D,{onClick:()=>{r({createWallet:{onFailure:a,onSuccess:i,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),o("EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:"Add password"}),po(re,{}),po($,{protectedByPrivy:!0})]})};import P4 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import _4 from"@heroicons/react/24/outline/PhoneIcon";import Kh from"styled-components";import{Fragment as k4,jsx as hr,jsxs as xl}from"react/jsx-runtime";var S4=e=>{let t=hr(P4,{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};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else{if(e instanceof Ve&&e.type==="twilio_verification_failed")return{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:hr(_4,{height:38,width:38,stroke:"var(--privy-color-error)"})};if(e instanceof Ke)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:hr(dl,{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:hr("span",{})};case"captcha_timeout":return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:hr("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 wr&&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}}},jh=()=>{let{navigate:e,navigateBack:t,data:r,lastScreen:o,currentScreen:n}=x();return hr(fa,{error:r?.errorModalData?.error||new Error,backFn:!o||n===o?void 0:t,onClick:()=>e(o||"LANDING",!1)})},fa=({error:e,backFn:t,onClick:r})=>{let{reset:o}=ge(),n=S4(e),i=()=>{e instanceof Ke&&e.privyErrorCode==="invalid_captcha"&&o(),r?.()};return xl(k4,{children:[hr(S,{backFn:t}),xl(A4,{children:[hr(Qe,{children:xl("div",{children:[hr(cl,{color:"var(--privy-color-error)"}),n.icon]})}),xl(x4,{children:[hr("h3",{children:n.title}),hr("p",{children:n.detail})]}),hr(D,{color:"var(--privy-color-error)",onClick:i,children:n.ctaText})]})]})},A4=Kh.div`
1313
1336
  display: flex;
1314
1337
  flex-direction: column;
1315
1338
  align-items: center;
@@ -1317,11 +1340,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
1317
1340
  gap: 24px;
1318
1341
  width: 100%;
1319
1342
  padding-bottom: 16px;
1320
- `,c4=Oh.div`
1343
+ `,x4=Kh.div`
1321
1344
  display: flex;
1322
1345
  flex-direction: column;
1323
1346
  gap: 8px;
1324
- `;import{useEffect as Vh,useRef as R4,useState as kd}from"react";import{isIOS as I4,isMobile as zh}from"react-device-detect";import Kh from"styled-components";import{useState as p4}from"react";import u4 from"styled-components";import{jsx as Dh}from"react/jsx-runtime";var Tl=({style:e,color:t,...r})=>Dh("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:Dh("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});import{jsx as xd}from"react/jsx-runtime";var Uh=({color:e,...t})=>xd("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:xd("g",{children:xd("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 Fh,jsxs as f4}from"react/jsx-runtime";var Ao=e=>{let[t,r]=p4(!1);return f4(m4,{color:e.color,onClick:()=>{r(!0),navigator.clipboard.writeText(e.text),setTimeout(()=>r(!1),1500)},justCopied:t,children:[t?Fh(Tl,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):Fh(Uh,{style:{height:"14px",width:"14px"}}),t?"Copied":"Copy"," ",e.itemName?e.itemName:"to Clipboard"]})},m4=u4.button`
1347
+ `;import{useEffect as ty,useRef as Y4,useState as Od}from"react";import{isIOS as Z4,isMobile as ry}from"react-device-detect";import iy from"styled-components";import{useState as R4}from"react";import I4 from"styled-components";import{jsx as Yh}from"react/jsx-runtime";var kl=({style:e,color:t,...r})=>Yh("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:Yh("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});import{jsx as Wd}from"react/jsx-runtime";var Zh=({color:e,...t})=>Wd("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:Wd("g",{children:Wd("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 Jh,jsxs as W4}from"react/jsx-runtime";var xo=e=>{let[t,r]=R4(!1);return W4(M4,{color:e.color,onClick:()=>{r(!0),navigator.clipboard.writeText(e.text),setTimeout(()=>r(!1),1500)},justCopied:t,children:[t?Jh(kl,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):Jh(Zh,{style:{height:"14px",width:"14px"}}),t?"Copied":"Copy"," ",e.itemName?e.itemName:"to Clipboard"]})},M4=I4.button`
1325
1348
  display: flex;
1326
1349
  align-items: center;
1327
1350
  gap: 6px;
@@ -1359,7 +1382,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1359
1382
  width: 14px;
1360
1383
  height: 14px;
1361
1384
  }
1362
- `;import{useState as h4}from"react";import y4 from"styled-components";import{jsx as v4}from"react/jsx-runtime";var Pl=e=>{let[t,r]=h4(!1);return v4(g4,{color:e.color,href:e.url,target:"_blank",rel:"noreferrer noopener",onClick:()=>{r(!0),setTimeout(()=>r(!1),1500)},justOpened:t,children:e.text})},g4=y4.a`
1385
+ `;import{useState as L4}from"react";import O4 from"styled-components";import{jsx as D4}from"react/jsx-runtime";var Rl=e=>{let[t,r]=L4(!1);return D4(N4,{color:e.color,href:e.url,target:"_blank",rel:"noreferrer noopener",onClick:()=>{r(!0),setTimeout(()=>r(!1),1500)},justOpened:t,children:e.text})},N4=O4.a`
1363
1386
  display: flex;
1364
1387
  align-items: center;
1365
1388
  gap: 6px;
@@ -1397,7 +1420,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1397
1420
  width: 14px;
1398
1421
  height: 14px;
1399
1422
  }
1400
- `;import C4 from"qrcode";import w4 from"react";import b4 from"styled-components";import{jsx as Bh}from"react/jsx-runtime";var Hh=()=>Bh("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:Bh("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});import{Fragment as ca,jsx as xt,jsxs as Gh}from"react/jsx-runtime";var tr=7,Ad=(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},E4=e=>{let t=C4.create(e,{errorCorrectionLevel:"high"}).modules,r=bu(Array.from(t.data),t.size);return r=Ad(r,0,0,tr,tr),r=Ad(r,r.length-tr,0,tr,tr),r=Ad(r,0,r.length-tr,tr,tr),r},T4=({x:e,y:t,cellSize:r,bgColor:o,fgColor:n})=>xt(ca,{children:[0,1,2].map(i=>xt("circle",{r:r*(tr-i*2)/2,cx:e+r*tr/2,cy:t+r*tr/2,fill:i%2!==0?o:n},`finder-${e}-${t}-${i}`))}),P4=({cellSize:e,matrixSize:t,bgColor:r,fgColor:o})=>{let n=[[0,0],[(t-tr)*e,0],[0,(t-tr)*e]];return xt(ca,{children:n.map(([i,a])=>xt(T4,{x:i,y:a,cellSize:e,bgColor:r,fgColor:o},`finder-${i}-${a}`))})},S4=({matrix:e,cellSize:t,color:r})=>xt(ca,{children:e.map((i,a)=>i.map((l,s)=>l?xt("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}`):xt(w4.Fragment,{},`circle-${a}-${s}`)))}),_4=({cellSize:e,matrixSize:t,element:r,sizePercentage:o,bgColor:n})=>{if(!r)return xt(ca,{});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,u=s-s*c*2,h=r,f=a*e;return Gh(ca,{children:[xt("rect",{x:a*e,y:a*e,width:s,height:s,fill:n}),xt(h,{x:f+s*c,y:f+s*c,height:u,width:u})]})},x4=e=>{let t=e.outputSize,r=E4(e.url),o=t/r.length;return Gh("svg",{height:e.outputSize,width:e.outputSize,viewBox:`0 0 ${e.outputSize} ${e.outputSize}`,style:{height:"100%",width:"100%"},children:[xt(S4,{matrix:r,cellSize:o,color:e.fgColor}),xt(P4,{cellSize:o,matrixSize:r.length,fgColor:e.fgColor,bgColor:e.bgColor}),xt(_4,{cellSize:o,element:e.logo?.element,bgColor:e.bgColor,matrixSize:r.length})]})},A4=b4.div`
1423
+ `;import U4 from"qrcode";import F4 from"react";import B4 from"styled-components";import{jsx as Qh}from"react/jsx-runtime";var Xh=()=>Qh("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:Qh("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});import{Fragment as ha,jsx as At,jsxs as ey}from"react/jsx-runtime";var rr=7,Ld=(e,t,r,o,n)=>{for(let i=t;i<t+o;i++)for(let a=r;a<r+n;a++){let s=e?.[a];s&&s[i]&&(s[i]=0)}return e},H4=e=>{let t=U4.create(e,{errorCorrectionLevel:"high"}).modules,r=Su(Array.from(t.data),t.size);return r=Ld(r,0,0,rr,rr),r=Ld(r,r.length-rr,0,rr,rr),r=Ld(r,0,r.length-rr,rr,rr),r},G4=({x:e,y:t,cellSize:r,bgColor:o,fgColor:n})=>At(ha,{children:[0,1,2].map(i=>At("circle",{r:r*(rr-i*2)/2,cx:e+r*rr/2,cy:t+r*rr/2,fill:i%2!==0?o:n},`finder-${e}-${t}-${i}`))}),V4=({cellSize:e,matrixSize:t,bgColor:r,fgColor:o})=>{let n=[[0,0],[(t-rr)*e,0],[0,(t-rr)*e]];return At(ha,{children:n.map(([i,a])=>At(G4,{x:i,y:a,cellSize:e,bgColor:r,fgColor:o},`finder-${i}-${a}`))})},z4=({matrix:e,cellSize:t,color:r})=>At(ha,{children:e.map((i,a)=>i.map((s,l)=>s?At("rect",{height:t-.2*2,width:t-.2*2,x:a*t+t*(.2/2),y:l*t+t*(.2/2),rx:t*.5,ry:t*.5,fill:r},`cell-${a}-${l}`):At(F4.Fragment,{},`circle-${a}-${l}`)))}),q4=({cellSize:e,matrixSize:t,element:r,sizePercentage:o,bgColor:n})=>{if(!r)return At(ha,{});let i=t*(o||.15),a=Math.floor(t/2-i/2),s=Math.floor(t/2+i/2);(s-a)%2!==t%2&&(s+=1);let l=(s-a)*e,c=.1,u=l-l*c*2,f=r,h=a*e;return ey(ha,{children:[At("rect",{x:a*e,y:a*e,width:l,height:l,fill:n}),At(f,{x:h+l*c,y:h+l*c,height:u,width:u})]})},$4=e=>{let t=e.outputSize,r=H4(e.url),o=t/r.length;return ey("svg",{height:e.outputSize,width:e.outputSize,viewBox:`0 0 ${e.outputSize} ${e.outputSize}`,style:{height:"100%",width:"100%"},children:[At(z4,{matrix:r,cellSize:o,color:e.fgColor}),At(V4,{cellSize:o,matrixSize:r.length,fgColor:e.fgColor,bgColor:e.bgColor}),At(q4,{cellSize:o,element:e.logo?.element,bgColor:e.bgColor,matrixSize:r.length})]})},K4=B4.div`
1401
1424
  display: flex;
1402
1425
  justify-content: center;
1403
1426
  align-items: center;
@@ -1412,7 +1435,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1412
1435
  border-color: ${e=>e.borderColor};
1413
1436
  border-radius: var(--privy-border-radius-md);
1414
1437
  }
1415
- `,li=e=>{let{appearance:t}=yt(),r=e.bgColor||"#FFFFFF",o=e.fgColor||"#000000",n=e.size||160,i=t.palette.colorScheme==="dark"?r:o;return xt(A4,{size:n,bgColor:r,fgColor:o,borderColor:i,children:xt(x4,{url:e.url,logo:{element:e.squareLogoElement??Hh},outputSize:n,bgColor:r,fgColor:o})})};import{jsx as Sl,jsxs as k4}from"react/jsx-runtime";var Kr=({style:e,...t})=>k4("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:[Sl("rect",{width:"1000",height:"1000",rx:"200",fill:"#855DCD"}),Sl("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"}),Sl("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"}),Sl("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 we,jsxs as jr}from"react/jsx-runtime";var qh="#8a63d2",jh=1e3,M4=jh*2,W4=jh*120,Yh=()=>{let{authenticated:e,logout:t,ready:r,user:o}=B(),{lastScreen:n,navigate:i,navigateBack:a,setModalData:l,app:s}=A(),{getAuthFlow:c,loginWithFarcaster:u,closePrivyModal:h,createAnalyticsEvent:f}=M(),[g,v]=kd(void 0),[y,S]=kd(!1),[_,w]=kd(!1),x=R4([]),k=Fe,D=c(),I=D?.meta.connectUri;return Vh(()=>{let R=Date.now(),H=setInterval(async()=>{let K=await D.pollForReady.execute(),Y=Date.now()-R;if(K){clearInterval(H),S(!0);try{await u(),w(!0)}catch(W){let G={retryable:!1,message:"Authentication failed"};if(W?.privyErrorCode==="allowlist_rejected"){i("ALLOWLIST_REJECTION_SCREEN");return}else if(W?.privyErrorCode==="max_accounts_reached"){console.error(new lr(W).toString()),i("USER_LIMIT_REACHED_SCREEN");return}else W?.privyErrorCode==="linked_to_another_user"?G.detail="This account has already been linked to another user.":W?.privyErrorCode==="invalid_credentials"?(G.retryable=!0,G.detail="Something went wrong. Try again."):W?.privyErrorCode==="too_many_requests"&&(G.detail="Too many requests. Please wait before trying again.");v(G)}}else Y>W4&&(clearInterval(H),v({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))},M4);return()=>{clearInterval(H),x.current.forEach(K=>clearTimeout(K))}},[]),Vh(()=>{if(r&&e&&_&&o){if(s?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let H=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},k);return()=>clearTimeout(H)}_&&(Nt(o,s?.embeddedWallets.createOnLogin)?x.current.push(setTimeout(()=>{l({createWallet:{onSuccess:()=>{},onFailure:H=>{console.error(H),f({eventName:"embedded_wallet_creation_failure_logout",payload:{error:H,screen:"FarcasterConnectStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},k)):x.current.push(setTimeout(()=>h({shouldCallAuthOnSuccess:!0,isSuccess:!0}),k)))}},[_,r,e,o]),zh||y?jr(_l,{children:[we(P,{backFn:n?a:void 0,onClose:h},"header"),we(Q,{}),I4?we(_l,{children:jr(L4,{children:[we(at,{children:jr("div",{children:[we(ot,{success:_,fail:!!g}),we(Kr,{style:{width:"38px",height:"38px"}})]})}),jr(Ze,{children:[we(se,{children:g?g.message:"Sign in with Farcaster"}),we(ce,{children:g?g.detail:"To sign in with Farcaster, please open the Warpcast app."})]}),I&&we(N,{onClick:R=>{R.preventDefault(),window.location.href=I},children:"Open Warpcast app"})]})}):we(_l,{children:jr($h,{children:[we(at,{children:jr("div",{children:[we(ot,{success:_,fail:!!g}),we(Kr,{style:{width:"38px",height:"38px"}})]})}),jr(Ze,{children:[we(se,{children:g?g.message:"Signing in with Farcaster"}),we(ce,{children:g?g.detail:"This should only take a moment"}),we(_t,{children:I&&zh&&we(Pl,{text:"Take me to Warpcast",url:I,color:qh})})]})]})}),we(V,{})]}):jr(_l,{children:[we(P,{backFn:n?a:void 0,onClose:h},"header"),we(Q,{}),we($h,{children:jr("div",{children:[we(se,{children:"Sign in with Farcaster"}),we(ce,{children:"Scan with your phone's camera to continue."}),we(Vn,{children:I?we(li,{url:I,size:275,squareLogoElement:Kr}):we(nt,{})}),jr(_t,{children:[we(ce,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),I&&we(Ao,{text:I,itemName:"link",color:qh})]})]})}),we(V,{})]})},$h=Kh.div`
1438
+ `,ui=e=>{let{appearance:t}=it(),r=e.bgColor||"#FFFFFF",o=e.fgColor||"#000000",n=e.size||160,i=t.palette.colorScheme==="dark"?r:o;return At(K4,{size:n,bgColor:r,fgColor:o,borderColor:i,children:At($4,{url:e.url,logo:{element:e.squareLogoElement??Xh},outputSize:n,bgColor:r,fgColor:o})})};import{jsx as Il,jsxs as j4}from"react/jsx-runtime";var jr=({style:e,...t})=>j4("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:[Il("rect",{width:"1000",height:"1000",rx:"200",fill:"#855DCD"}),Il("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"}),Il("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"}),Il("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 Ml,jsx as we,jsxs as Yr}from"react/jsx-runtime";var oy="#8a63d2",ay=1e3,J4=ay*2,Q4=ay*120,sy=()=>{let{authenticated:e,logout:t,ready:r,user:o}=F(),{lastScreen:n,navigate:i,navigateBack:a,setModalData:s,app:l}=x(),{getAuthFlow:c,loginWithFarcaster:u,closePrivyModal:f,createAnalyticsEvent:h}=M(),[g,v]=Od(void 0),[y,T]=Od(!1),[_,b]=Od(!1),A=Y4([]),k=Oe,N=c(),R=N?.meta.connectUri;return ty(()=>{let I=Date.now(),H=setInterval(async()=>{let G=await N.pollForReady.execute(),Z=Date.now()-I;if(G){clearInterval(H),T(!0);try{await u(),b(!0)}catch(W){let q={retryable:!1,message:"Authentication failed"};if(W?.privyErrorCode==="allowlist_rejected"){i("ALLOWLIST_REJECTION_SCREEN");return}else if(W?.privyErrorCode==="max_accounts_reached"){console.error(new cr(W).toString()),i("USER_LIMIT_REACHED_SCREEN");return}else W?.privyErrorCode==="linked_to_another_user"?q.detail="This account has already been linked to another user.":W?.privyErrorCode==="invalid_credentials"?(q.retryable=!0,q.detail="Something went wrong. Try again."):W?.privyErrorCode==="too_many_requests"&&(q.detail="Too many requests. Please wait before trying again.");v(q)}}else Z>Q4&&(clearInterval(H),v({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))},J4);return()=>{clearInterval(H),A.current.forEach(G=>clearTimeout(G))}},[]),ty(()=>{if(r&&e&&_&&o){if(l?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let H=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},k);return()=>clearTimeout(H)}_&&(Dt(o,l?.embeddedWallets.createOnLogin)?A.current.push(setTimeout(()=>{s({createWallet:{onSuccess:()=>{},onFailure:H=>{console.error(H),h({eventName:"embedded_wallet_creation_failure_logout",payload:{error:H,screen:"FarcasterConnectStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},k)):A.current.push(setTimeout(()=>f({shouldCallAuthOnSuccess:!0,isSuccess:!0}),k)))}},[_,r,e,o]),ry||y?Yr(Ml,{children:[we(S,{backFn:n?a:void 0,onClose:f},"header"),we(Q,{}),Z4?we(Ml,{children:Yr(X4,{children:[we(Qe,{children:Yr("div",{children:[we(Je,{success:_,fail:!!g}),we(jr,{style:{width:"38px",height:"38px"}})]})}),Yr(qe,{children:[we(le,{children:g?g.message:"Sign in with Farcaster"}),we(de,{children:g?g.detail:"To sign in with Farcaster, please open the Warpcast app."})]}),R&&we(D,{onClick:I=>{I.preventDefault(),window.location.href=R},children:"Open Warpcast app"})]})}):we(Ml,{children:Yr(ny,{children:[we(Qe,{children:Yr("div",{children:[we(Je,{success:_,fail:!!g}),we(jr,{style:{width:"38px",height:"38px"}})]})}),Yr(qe,{children:[we(le,{children:g?g.message:"Signing in with Farcaster"}),we(de,{children:g?g.detail:"This should only take a moment"}),we(St,{children:R&&ry&&we(Rl,{text:"Take me to Warpcast",url:R,color:oy})})]})]})}),we(z,{})]}):Yr(Ml,{children:[we(S,{backFn:n?a:void 0,onClose:f},"header"),we(Q,{}),we(ny,{children:Yr("div",{children:[we(le,{children:"Sign in with Farcaster"}),we(de,{children:"Scan with your phone's camera to continue."}),we(Kn,{children:R?we(ui,{url:R,size:275,squareLogoElement:jr}):we(at,{})}),Yr(St,{children:[we(de,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),R&&we(xo,{text:R,itemName:"link",color:oy})]})]})}),we(z,{})]})},ny=iy.div`
1416
1439
  display: flex;
1417
1440
  flex-direction: column;
1418
1441
  align-items: center;
@@ -1420,14 +1443,14 @@ You will need this password to access your ${e} wallet on a new device. Please k
1420
1443
  margin-left: 27px;
1421
1444
  margin-right: 27px;
1422
1445
  gap: 24px;
1423
- `,L4=Kh.div`
1446
+ `,X4=iy.div`
1424
1447
  display: flex;
1425
1448
  flex-direction: column;
1426
1449
  align-items: center;
1427
1450
  justify-content: center;
1428
1451
  gap: 24px;
1429
1452
  width: 100%;
1430
- `;import{useEffect as O4,useRef as N4,useState as Rd}from"react";import{isIOS as D4,isMobile as Zh}from"react-device-detect";import Xh from"styled-components";import{Fragment as xl,jsx as Pe,jsxs as Ir}from"react/jsx-runtime";var Jh="#8a63d2",ey=1e3,U4=ey*2,F4=ey*300,ty=()=>{let{lastScreen:e,navigateBack:t,data:r,app:o}=A(),{requestFarcasterSignerStatus:n,closePrivyModal:i}=M(),[a,l]=Rd(void 0),[s,c]=Rd(!1),[u,h]=Rd(!1),f=N4([]),g=Fe,v=r?.farcasterSigner;O4(()=>{let S=Date.now(),_=setInterval(async()=>{if(!v?.public_key){clearInterval(_),l({retryable:!0,message:"Connect failed",detail:"Something went wrong. Please try again."});return}v.status==="approved"&&(clearInterval(_),c(!1),h(!0),f.current.push(setTimeout(()=>i({shouldCallAuthOnSuccess:!1,isSuccess:!0}),g)));let w=await n(v?.public_key),x=Date.now()-S;w.status==="approved"?(clearInterval(_),c(!1),h(!0),f.current.push(setTimeout(()=>i({shouldCallAuthOnSuccess:!1,isSuccess:!0}),g))):x>F4?(clearInterval(_),l({retryable:!0,message:"Connect failed",detail:"The request timed out. Try again."})):w.status==="revoked"&&(clearInterval(_),l({retryable:!0,message:"Request rejected",detail:"The request was rejected. Please try again."}))},U4);return()=>{clearInterval(_),f.current.forEach(w=>clearTimeout(w))}},[]);let y=v?.status==="pending_approval"?v.signer_approval_url:void 0;return Zh||s?Ir(xl,{children:[Pe(P,{backFn:e?t:void 0,onClose:i},"header"),Pe(Q,{}),D4?Pe(xl,{children:Ir(B4,{children:[Pe(at,{children:Ir("div",{children:[Pe(ot,{success:u,fail:!!a}),Pe(Kr,{style:{width:"38px",height:"38px"}})]})}),Ir(Ze,{children:[Pe(se,{children:a?a.message:"Add a signer to Farcaster"}),Pe(ce,{children:a?a.detail:"This will allow "+o.name+" to add casts, likes, follows, and more on your behalf."})]}),y&&Pe(N,{onClick:S=>{S.preventDefault(),window.location.href=y},children:"Open Warpcast app"})]})}):Pe(xl,{children:Ir(Qh,{children:[Pe(at,{children:Ir("div",{children:[Pe(ot,{success:u,fail:!!a}),Pe(Kr,{style:{width:"38px",height:"38px"}})]})}),Ir(Ze,{children:[Pe(se,{children:a?a.message:"Requesting signer from Farcaster"}),Pe(ce,{children:a?a.detail:"This should only take a moment"}),Pe(_t,{children:y&&Zh&&Pe(Pl,{text:"Take me to Warpcast",url:y,color:Jh})})]})]})}),Pe(V,{})]}):Ir(xl,{children:[Pe(P,{backFn:e?t:void 0,onClose:i},"header"),Pe(Q,{}),Pe(Qh,{children:Ir("div",{children:[Pe(se,{children:"Add a signer to Farcaster"}),Ir(ce,{children:["This will allow ",o.name," to add casts, likes, follows, and more on your behalf."]}),Pe(Vn,{children:v?.status==="pending_approval"?Pe(li,{url:v.signer_approval_url,size:275,squareLogoElement:Kr}):Pe(nt,{})}),Ir(_t,{children:[Pe(ce,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),v?.status==="pending_approval"&&Pe(Ao,{text:v.signer_approval_url,itemName:"link",color:Jh})]})]})}),Pe(V,{})]})},Qh=Xh.div`
1453
+ `;import{useEffect as ew,useRef as tw,useState as Nd}from"react";import{isIOS as rw,isMobile as ly}from"react-device-detect";import py from"styled-components";import{Fragment as Wl,jsx as Pe,jsxs as Mr}from"react/jsx-runtime";var cy="#8a63d2",uy=1e3,ow=uy*2,nw=uy*300,my=()=>{let{lastScreen:e,navigateBack:t,data:r,app:o}=x(),{requestFarcasterSignerStatus:n,closePrivyModal:i}=M(),[a,s]=Nd(void 0),[l,c]=Nd(!1),[u,f]=Nd(!1),h=tw([]),g=Oe,v=r?.farcasterSigner;ew(()=>{let T=Date.now(),_=setInterval(async()=>{if(!v?.public_key){clearInterval(_),s({retryable:!0,message:"Connect failed",detail:"Something went wrong. Please try again."});return}v.status==="approved"&&(clearInterval(_),c(!1),f(!0),h.current.push(setTimeout(()=>i({shouldCallAuthOnSuccess:!1,isSuccess:!0}),g)));let b=await n(v?.public_key),A=Date.now()-T;b.status==="approved"?(clearInterval(_),c(!1),f(!0),h.current.push(setTimeout(()=>i({shouldCallAuthOnSuccess:!1,isSuccess:!0}),g))):A>nw?(clearInterval(_),s({retryable:!0,message:"Connect failed",detail:"The request timed out. Try again."})):b.status==="revoked"&&(clearInterval(_),s({retryable:!0,message:"Request rejected",detail:"The request was rejected. Please try again."}))},ow);return()=>{clearInterval(_),h.current.forEach(b=>clearTimeout(b))}},[]);let y=v?.status==="pending_approval"?v.signer_approval_url:void 0;return ly||l?Mr(Wl,{children:[Pe(S,{backFn:e?t:void 0,onClose:i},"header"),Pe(Q,{}),rw?Pe(Wl,{children:Mr(iw,{children:[Pe(Qe,{children:Mr("div",{children:[Pe(Je,{success:u,fail:!!a}),Pe(jr,{style:{width:"38px",height:"38px"}})]})}),Mr(qe,{children:[Pe(le,{children:a?a.message:"Add a signer to Farcaster"}),Pe(de,{children:a?a.detail:"This will allow "+o.name+" to add casts, likes, follows, and more on your behalf."})]}),y&&Pe(D,{onClick:T=>{T.preventDefault(),window.location.href=y},children:"Open Warpcast app"})]})}):Pe(Wl,{children:Mr(dy,{children:[Pe(Qe,{children:Mr("div",{children:[Pe(Je,{success:u,fail:!!a}),Pe(jr,{style:{width:"38px",height:"38px"}})]})}),Mr(qe,{children:[Pe(le,{children:a?a.message:"Requesting signer from Farcaster"}),Pe(de,{children:a?a.detail:"This should only take a moment"}),Pe(St,{children:y&&ly&&Pe(Rl,{text:"Take me to Warpcast",url:y,color:cy})})]})]})}),Pe(z,{})]}):Mr(Wl,{children:[Pe(S,{backFn:e?t:void 0,onClose:i},"header"),Pe(Q,{}),Pe(dy,{children:Mr("div",{children:[Pe(le,{children:"Add a signer to Farcaster"}),Mr(de,{children:["This will allow ",o.name," to add casts, likes, follows, and more on your behalf."]}),Pe(Kn,{children:v?.status==="pending_approval"?Pe(ui,{url:v.signer_approval_url,size:275,squareLogoElement:jr}):Pe(at,{})}),Mr(St,{children:[Pe(de,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),v?.status==="pending_approval"&&Pe(xo,{text:v.signer_approval_url,itemName:"link",color:cy})]})]})}),Pe(z,{})]})},dy=py.div`
1431
1454
  display: flex;
1432
1455
  flex-direction: column;
1433
1456
  align-items: center;
@@ -1435,14 +1458,14 @@ You will need this password to access your ${e} wallet on a new device. Please k
1435
1458
  margin-left: 27px;
1436
1459
  margin-right: 27px;
1437
1460
  gap: 24px;
1438
- `,B4=Xh.div`
1461
+ `,iw=py.div`
1439
1462
  display: flex;
1440
1463
  flex-direction: column;
1441
1464
  align-items: center;
1442
1465
  justify-content: center;
1443
1466
  gap: 24px;
1444
1467
  width: 100%;
1445
- `;import G4 from"@heroicons/react/24/outline/ClockIcon";import V4 from"@heroicons/react/24/outline/EyeSlashIcon";import z4 from"@heroicons/react/24/outline/LinkIcon";import Yr from"styled-components";import{jsx as Id,jsxs as H4}from"react/jsx-runtime";var Al=({size:e=61,...t})=>Id("svg",{width:e,height:e,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:H4("g",{id:"moonpay_symbol_wht 2",children:[Id("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),Id("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{Fragment as ry,jsx as At,jsxs as dn}from"react/jsx-runtime";var Md=({title:e,desc:t,icon:r})=>dn(Z4,{children:[At(Q4,{children:r}),dn(J4,{children:[At(j4,{children:e}),At(Y4,{children:t})]})]}),oy=({app:e,signedUrl:t,onContinue:r})=>dn(ry,{children:[dn($4,{children:[At(Al,{size:"3.75rem"}),dn(K4,{children:[e?.name," uses ",At("span",{style:{fontWeight:"bold"},children:"Moonpay"})," to fund your account"]}),dn(X4,{children:[At(Md,{icon:At(z4,{width:"1rem"}),title:"Purchase assets to fund your account",desc:dn(ry,{children:["Connect a payment method (",At("strong",{children:"debit card recommended"}),") to purchase digital assets."]})}),At(Md,{icon:At(G4,{width:"1rem"}),title:"Compliance takes time",desc:"Funding a new account may take a few hours. You'll be good to go thereafter."}),At(Md,{icon:At(V4,{width:"1rem"}),title:"Your data belongs to you",desc:"MoonPay does not sell your data and will only use it with your permission."})]}),At(ew,{className:"mobile-only"})]}),At(q4,{children:"By clicking continue, you will be taken to MoonPay in a new tab."}),At(Ks,{href:t,target:"_blank",rel:"noopener noreferrer",onClick:r,children:"Continue to Moonpay"})]}),q4=Yr.span`
1468
+ `;import sw from"@heroicons/react/24/outline/ClockIcon";import lw from"@heroicons/react/24/outline/EyeSlashIcon";import cw from"@heroicons/react/24/outline/LinkIcon";import Zr from"styled-components";import{jsx as Dd,jsxs as aw}from"react/jsx-runtime";var Ll=({size:e=61,...t})=>Dd("svg",{width:e,height:e,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:aw("g",{id:"moonpay_symbol_wht 2",children:[Dd("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),Dd("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{Fragment as fy,jsx as xt,jsxs as pn}from"react/jsx-runtime";var Ud=({title:e,desc:t,icon:r})=>pn(hw,{children:[xt(gw,{children:r}),pn(yw,{children:[xt(mw,{children:e}),xt(fw,{children:t})]})]}),hy=({app:e,signedUrl:t,onContinue:r})=>pn(fy,{children:[pn(pw,{children:[xt(Ll,{size:"3.75rem"}),pn(uw,{children:[e?.name," uses ",xt("span",{style:{fontWeight:"bold"},children:"Moonpay"})," to fund your account"]}),pn(vw,{children:[xt(Ud,{icon:xt(cw,{width:"1rem"}),title:"Purchase assets to fund your account",desc:pn(fy,{children:["Connect a payment method (",xt("strong",{children:"debit card recommended"}),") to purchase digital assets."]})}),xt(Ud,{icon:xt(sw,{width:"1rem"}),title:"Compliance takes time",desc:"Funding a new account may take a few hours. You'll be good to go thereafter."}),xt(Ud,{icon:xt(lw,{width:"1rem"}),title:"Your data belongs to you",desc:"MoonPay does not sell your data and will only use it with your permission."})]}),xt(Cw,{className:"mobile-only"})]}),xt(dw,{children:"By clicking continue, you will be taken to MoonPay in a new tab."}),xt(Qs,{href:t,target:"_blank",rel:"noopener noreferrer",onClick:r,children:"Continue to Moonpay"})]}),dw=Zr.span`
1446
1469
  display: inline-block;
1447
1470
  color: var(--privy-color-foreground-3);
1448
1471
  text-align: center;
@@ -1451,13 +1474,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
1451
1474
  font-weight: 400;
1452
1475
  line-height: 140%; /* 0.875rem */
1453
1476
  margin-bottom: 0.25rem;
1454
- `,$4=Yr.div`
1477
+ `,pw=Zr.div`
1455
1478
  display: flex;
1456
1479
  flex-direction: column;
1457
1480
  align-items: center;
1458
1481
  justify-content: center;
1459
1482
  padding: 1.5rem 0;
1460
- `,K4=Yr.span`
1483
+ `,uw=Zr.span`
1461
1484
  color: var(--privy-color-foreground);
1462
1485
  text-align: center;
1463
1486
  font-size: 1.125rem;
@@ -1466,46 +1489,46 @@ You will need this password to access your ${e} wallet on a new device. Please k
1466
1489
  margin: 1.5rem 0;
1467
1490
  text-align: center;
1468
1491
  max-width: 19.5rem;
1469
- `,j4=Yr.span`
1492
+ `,mw=Zr.span`
1470
1493
  color: var(--privy-color-foreground);
1471
1494
  font-size: 0.875rem;
1472
1495
  font-weight: 500;
1473
1496
  line-height: 1.225rem;
1474
1497
  width: 100%;
1475
- `,Y4=Yr.span`
1498
+ `,fw=Zr.span`
1476
1499
  color: var(--privy-color-foreground-2);
1477
1500
  font-size: 0.875rem;
1478
1501
  font-weight: 400;
1479
1502
  line-height: 1.225rem;
1480
- `,Z4=Yr.div`
1503
+ `,hw=Zr.div`
1481
1504
  display: flex;
1482
1505
  align-items: flex-start;
1483
1506
  gap: 0.5rem;
1484
1507
  align-self: stretch;
1485
- `,J4=Yr.div`
1508
+ `,yw=Zr.div`
1486
1509
  display: flex;
1487
1510
  flex-direction: column;
1488
1511
  gap: 0.25rem;
1489
1512
  align-items: flex-start;
1490
1513
  text-align: left;
1491
1514
  flex: 1 0 0;
1492
- `,Q4=Yr.div`
1515
+ `,gw=Zr.div`
1493
1516
  padding-top: 2px;
1494
- `,X4=Yr.div`
1517
+ `,vw=Zr.div`
1495
1518
  display: flex;
1496
1519
  flex-direction: column;
1497
1520
  gap: 1.25rem;
1498
1521
  margin: 0 0.5rem;
1499
- `,ew=Yr.div`
1522
+ `,Cw=Zr.div`
1500
1523
  margin: 30px 0;
1501
- `;import{ofetch as tw}from"ofetch";import{useEffect as rw,useRef as ow,useState as nw}from"react";var kl="moonpay",ny="sdk_fiat_on_ramp_completed_with_status";async function iy(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 iw(e,t){let r=t?Bu:Fu,o=t?Gu:Hu;return tw(`${r}/transactions/ext/${e}`,{query:{apiKey:o}})}function ay(e,t=!1){let[r,o]=nw(null),{createAnalyticsEvent:n}=M(),i=ow(0);return rw(()=>{let a=setInterval(async()=>{if(e)try{let[l]=await iw(e,t),s=l.status==="waitingAuthorization"&&l.paymentMethod==="credit_debit_card"?"pending":l.status;o(s),["failed","completed","awaitingAuthorization"].includes(s)&&(n({eventName:ny,payload:{status:s,provider:kl,paymentMethod:l.paymentMethod,cardPaymentType:l.cardPaymentType,currency:l.currency?.code,baseCurrencyAmount:l.baseCurrencyAmount,quoteCurrencyAmount:l.quoteCurrencyAmount,feeAmount:l.feeAmount,extraFeeAmount:l.extraFeeAmount,networkFeeAmount:l.networkFeeAmount}}),clearInterval(a))}catch(l){l.response?.status!==404&&(i.current+=1),i.current>=3&&(o("serviceFailure"),n({eventName:ny,payload:{status:"serviceFailure",provider:kl}}),clearInterval(a))}},3e3);return()=>clearInterval(a)},[e,i]),r}import{Fragment as aw,jsx as Wd,jsxs as sw}from"react/jsx-runtime";var sy=()=>{let{app:e,data:t,navigate:r}=A(),{createAnalyticsEvent:o}=M(),{signedUrl:n}=t.fiatOnRampPrompt;return!e||!n?null:sw(aw,{children:[Wd(P,{title:"Fund account"},"header"),Wd(oy,{app:e,signedUrl:n,onContinue:()=>{o({eventName:"sdk_fiat_on_ramp_started",payload:{provider:kl}}),r("FIAT_ON_RAMP_STATUS_SCREEN")}}),Wd(q,{protectedByPrivy:!0})]})};import lw from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import cw from"@heroicons/react/24/solid/CheckCircleIcon";import dw from"@heroicons/react/24/solid/XCircleIcon";import{useMemo as pw}from"react";import ly from"styled-components";import{Fragment as Ld,jsx as kt,jsxs as pn}from"react/jsx-runtime";var cy=()=>{let{app:e,data:t}=A(),{closePrivyModal:r}=M(),{externalTransactionId:o}=t?.fiatOnRampStatus,n=ay(o||null,e.fiatOnRamp.useSandbox);return pn(Ld,{children:[kt(P,{title:"Fund account"},"header"),kt(mw,{status:n,onClickCta:r}),kt(q,{protectedByPrivy:!0})]})},uw=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"failed":return{title:"Something went wrong!",body:pn(Ld,{children:[pn("p",{children:["It looks like there was an issue with your payment. Please contact"," ",kt("a",{href:"https://support.moonpay.com/hc/en-gb",target:"_blank",rel:"noreferrer noopener",style:{textDecoration:"underline"},children:"Moonpay support"})," ","for assistance."]}),kt("p",{style:{fontStyle:"italic"},children:"Note that debit cards typically work better than credit cards here."})]}),cta:"Done"};case"serviceFailure":return{title:"Something went wrong!",body:"MoonPay ran into an error when processing your transaction. Try again?",cta:"Done"};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:""}}},mw=({status:e,onClickCta:t})=>{let{title:r,body:o,cta:n}=pw(()=>uw(e),[e]);return pn(Ld,{children:[pn(vw,{children:[kt(yw,{status:e}),pn(Ze,{children:[kt("h3",{children:r}),kt(gw,{children:o})]})]}),n&&kt(N,{onClick:t,children:n})]})},fw=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)",hw=e=>{switch(e){case"serviceFailure":case"failed":return dw;case"completed":return cw;case"waitingAuthorization":return()=>kt(lw,{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}},yw=({status:e})=>{if(!e||e==="pending"){let o="var(--privy-color-foreground-4)";return pn("div",{style:{position:"relative"},children:[kt(nt,{color:o,style:{position:"absolute"}}),kt(Jc,{color:o}),kt(Al,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=hw(e),r=fw(e);return kt("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&kt(t,{width:"4rem",height:"4rem",color:r})})},gw=ly.p`
1524
+ `;import{ofetch as ww}from"ofetch";import{useEffect as bw,useRef as Ew,useState as Tw}from"react";var Ol="moonpay",yy="sdk_fiat_on_ramp_completed_with_status";async function gy(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 Pw(e,t){let r=t?qu:zu,o=t?Ku:$u;return ww(`${r}/transactions/ext/${e}`,{query:{apiKey:o}})}function vy(e,t=!1){let[r,o]=Tw(null),{createAnalyticsEvent:n}=M(),i=Ew(0);return bw(()=>{let a=setInterval(async()=>{if(e)try{let[s]=await Pw(e,t),l=s.status==="waitingAuthorization"&&s.paymentMethod==="credit_debit_card"?"pending":s.status;o(l),["failed","completed","awaitingAuthorization"].includes(l)&&(n({eventName:yy,payload:{status:l,provider:Ol,paymentMethod:s.paymentMethod,cardPaymentType:s.cardPaymentType,currency:s.currency?.code,baseCurrencyAmount:s.baseCurrencyAmount,quoteCurrencyAmount:s.quoteCurrencyAmount,feeAmount:s.feeAmount,extraFeeAmount:s.extraFeeAmount,networkFeeAmount:s.networkFeeAmount}}),clearInterval(a))}catch(s){s.response?.status!==404&&(i.current+=1),i.current>=3&&(o("serviceFailure"),n({eventName:yy,payload:{status:"serviceFailure",provider:Ol}}),clearInterval(a))}},3e3);return()=>clearInterval(a)},[e,i]),r}import{Fragment as _w,jsx as Fd,jsxs as Sw}from"react/jsx-runtime";var Cy=()=>{let{app:e,data:t,navigate:r}=x(),{createAnalyticsEvent:o}=M(),{signedUrl:n}=t.fiatOnRampPrompt;return!e||!n?null:Sw(_w,{children:[Fd(S,{title:"Fund account"},"header"),Fd(hy,{app:e,signedUrl:n,onContinue:()=>{o({eventName:"sdk_fiat_on_ramp_started",payload:{provider:Ol}}),r("FIAT_ON_RAMP_STATUS_SCREEN")}}),Fd($,{protectedByPrivy:!0})]})};import Aw from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import xw from"@heroicons/react/24/solid/CheckCircleIcon";import kw from"@heroicons/react/24/solid/XCircleIcon";import{useMemo as Rw}from"react";import wy from"styled-components";import{Fragment as Bd,jsx as kt,jsxs as un}from"react/jsx-runtime";var by=()=>{let{app:e,data:t}=x(),{closePrivyModal:r}=M(),{externalTransactionId:o}=t?.fiatOnRampStatus,n=vy(o||null,e.fiatOnRamp.useSandbox);return un(Bd,{children:[kt(S,{title:"Fund account"},"header"),kt(Mw,{status:n,onClickCta:r}),kt($,{protectedByPrivy:!0})]})},Iw=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"failed":return{title:"Something went wrong!",body:un(Bd,{children:[un("p",{children:["It looks like there was an issue with your payment. Please contact"," ",kt("a",{href:"https://support.moonpay.com/hc/en-gb",target:"_blank",rel:"noreferrer noopener",style:{textDecoration:"underline"},children:"Moonpay support"})," ","for assistance."]}),kt("p",{style:{fontStyle:"italic"},children:"Note that debit cards typically work better than credit cards here."})]}),cta:"Done"};case"serviceFailure":return{title:"Something went wrong!",body:"MoonPay ran into an error when processing your transaction. Try again?",cta:"Done"};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:""}}},Mw=({status:e,onClickCta:t})=>{let{title:r,body:o,cta:n}=Rw(()=>Iw(e),[e]);return un(Bd,{children:[un(Dw,{children:[kt(Ow,{status:e}),un(qe,{children:[kt("h3",{children:r}),kt(Nw,{children:o})]})]}),n&&kt(D,{onClick:t,children:n})]})},Ww=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)",Lw=e=>{switch(e){case"serviceFailure":case"failed":return kw;case"completed":return xw;case"waitingAuthorization":return()=>kt(Aw,{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}},Ow=({status:e})=>{if(!e||e==="pending"){let o="var(--privy-color-foreground-4)";return un("div",{style:{position:"relative"},children:[kt(at,{color:o,style:{position:"absolute"}}),kt(nd,{color:o}),kt(Ll,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=Lw(e),r=Ww(e);return kt("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&kt(t,{width:"4rem",height:"4rem",color:r})})},Nw=wy.p`
1502
1525
  font-size: 1rem;
1503
1526
  color: var(--privy-color-foreground-3);
1504
1527
  margin-bottom: 1rem;
1505
1528
  display: flex;
1506
1529
  flex-direction: column;
1507
1530
  gap: 1rem;
1508
- `,vw=ly.div`
1531
+ `,Dw=wy.div`
1509
1532
  display: flex;
1510
1533
  flex-direction: column;
1511
1534
  align-items: center;
@@ -1513,7 +1536,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1513
1536
  margin-left: 1.75rem;
1514
1537
  margin-right: 1.75rem;
1515
1538
  padding: 2rem 0;
1516
- `;import Cw from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import ww from"styled-components";import{Fragment as Ew,jsx as ko,jsxs as Tw}from"react/jsx-runtime";var dy=()=>{let{closePrivyModal:e}=M();return Tw(Ew,{children:[ko(P,{},"header"),ko(bw,{children:ko(Cw,{style:{width:32,height:32}})}),ko(zr,{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"}}),ko(ur,{children:ko(N,{onClick:()=>e(),children:"Close"})}),ko(re,{}),ko(q,{protectedByPrivy:!0})]})},bw=ww.div`
1539
+ `;import Uw from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import Fw from"styled-components";import{Fragment as Hw,jsx as ko,jsxs as Gw}from"react/jsx-runtime";var Ey=()=>{let{closePrivyModal:e}=M();return Gw(Hw,{children:[ko(S,{},"header"),ko(Bw,{children:ko(Uw,{style:{width:32,height:32}})}),ko(qr,{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"}}),ko(ur,{children:ko(D,{onClick:()=>e(),children:"Close"})}),ko(re,{}),ko($,{protectedByPrivy:!0})]})},Bw=Fw.div`
1517
1540
  border-radius: 50%;
1518
1541
  height: 68px;
1519
1542
  width: 68px;
@@ -1523,18 +1546,18 @@ You will need this password to access your ${e} wallet on a new device. Please k
1523
1546
  background-color: var(--privy-color-accent);
1524
1547
  color: white;
1525
1548
  margin: 0 auto 24px auto;
1526
- `;import*as fy from"react-device-detect";import xw from"styled-components";import Od from"styled-components";import{jsx as py}from"react/jsx-runtime";var uy=({style:e,...t})=>py("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:py("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 Sw,jsxs as _w}from"react/jsx-runtime";var my=Od.div`
1549
+ `;import*as Sy from"react-device-detect";import $w from"styled-components";import Hd from"styled-components";import{jsx as Ty}from"react/jsx-runtime";var Py=({style:e,...t})=>Ty("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:Ty("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 zw,jsxs as qw}from"react/jsx-runtime";var _y=Hd.div`
1527
1550
  display: flex;
1528
1551
  flex-direction: column;
1529
1552
  justify-content: flex-start;
1530
1553
  gap: 4px;
1531
- `,Nd=Od.div`
1554
+ `,Gd=Hd.div`
1532
1555
  &&& {
1533
1556
  margin-left: 7px; /* TODO: This is a total hack */
1534
1557
  border-left: 2px solid var(--privy-color-foreground-4);
1535
1558
  height: 12px;
1536
1559
  }
1537
- `,Rl=({children:e})=>_w(Pw,{children:[Sw(uy,{style:{width:"16px",height:"16px"}}),e]}),Pw=Od.div`
1560
+ `,Nl=({children:e})=>qw(Vw,{children:[zw(Py,{style:{width:"16px",height:"16px"}}),e]}),Vw=Hd.div`
1538
1561
  display: flex;
1539
1562
  justify-content: flex-start;
1540
1563
  justify-items: center;
@@ -1552,15 +1575,15 @@ You will need this password to access your ${e} wallet on a new device. Please k
1552
1575
  margin-bottom: auto;
1553
1576
  }
1554
1577
  }
1555
- `;import{Fragment as Rw,jsx as ft,jsxs as da}from"react/jsx-runtime";var Aw=()=>da(kw,{children:[ft(Yi,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),ft(_t,{children:ft(Fr,{style:{width:"152px",height:"152px"}})}),da(my,{children:[ft(Rl,{children:da("div",{children:[ft("span",{children:"Install the "}),ft("a",{href:fy.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"})]})}),ft(Nd,{}),ft(Rl,{children:"Set up your first wallet"}),ft(Nd,{}),ft(Rl,{children:"Store your recovery phrase in a safe place!"})]}),ft(Fn,{onClick:()=>window.location.reload(),children:"Reload the page to use your wallet"})]}),hy=()=>{let{navigateBack:e}=A();return da(Rw,{children:[ft(P,{backFn:e},"header"),ft(Q,{}),ft(Aw,{}),ft(re,{}),da(V,{children:[ft("span",{children:"Still not sure? "}),ft("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})},kw=xw(_t)`
1578
+ `;import{Fragment as Yw,jsx as ht,jsxs as ya}from"react/jsx-runtime";var Kw=()=>ya(jw,{children:[ht(ta,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),ht(St,{children:ht(Br,{style:{width:"152px",height:"152px"}})}),ya(_y,{children:[ht(Nl,{children:ya("div",{children:[ht("span",{children:"Install the "}),ht("a",{href:Sy.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"})]})}),ht(Gd,{}),ht(Nl,{children:"Set up your first wallet"}),ht(Gd,{}),ht(Nl,{children:"Store your recovery phrase in a safe place!"})]}),ht(Vn,{onClick:()=>window.location.reload(),children:"Reload the page to use your wallet"})]}),Ay=()=>{let{navigateBack:e}=x();return ya(Yw,{children:[ht(S,{backFn:e},"header"),ht(Q,{}),ht(Kw,{}),ht(re,{}),ya(z,{children:[ht("span",{children:"Still not sure? "}),ht("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})},jw=$w(St)`
1556
1579
  gap: 30px;
1557
1580
 
1558
1581
  > :first-child > svg {
1559
1582
  margin-top: 20px;
1560
1583
  }
1561
- `;import h5 from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as y5,useState as ky}from"react";import{isMobile as g5}from"react-device-detect";import v5 from"styled-components";import Nw from"@heroicons/react/24/outline/EnvelopeIcon";import{useRef as Dw}from"react";import Iw from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as Mw,useState as yy}from"react";import vy from"styled-components";import{Fragment as Ow,jsx as pa,jsxs as gy}from"react/jsx-runtime";var Il=Mw((e,t)=>{let[r,o]=yy(""),[n,i]=yy(!1),{authenticated:a}=B(),{initLoginWithEmail:l}=M(),{navigate:s,setModalData:c,currentScreen:u}=A(),{enabled:h,token:f}=ye(),g=Ja(r),v=n,y=n||!g,S=w=>{i(!0),l(r,w).then(()=>{s("AWAITING_PASSWORDLESS_CODE")}).catch(x=>{c({errorModalData:{error:x,previousScreen:u||"LANDING"}}),s("ERROR_SCREEN")}).finally(()=>{i(!1)})},_=()=>{h&&!f&&!a?(c({captchaModalData:{callback:w=>l(r,w),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),s("CAPTCHA_SCREEN")):S(f)};return gy(Ow,{children:[pa(Ww,{children:gy(Lw,{stacked:e.stacked,children:[pa(Iw,{}),pa("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:w=>o(w.target.value),onKeyUp:w=>{w.key==="Enter"&&_()},value:r,autoComplete:"email"}),e.stacked?null:pa(Bn,{isSubmitting:v,onClick:_,disabled:y,children:"Submit"})]})}),e.stacked?pa(N,{loadingText:null,loading:v,disabled:y,onClick:_,children:"Submit"}):null]})}),Ww=vy.div`
1584
+ `;import L5 from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as O5,useState as Hy}from"react";import{isMobile as N5}from"react-device-detect";import D5 from"styled-components";import t5 from"@heroicons/react/24/outline/EnvelopeIcon";import{useRef as r5}from"react";import Zw from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as Jw,useState as xy}from"react";import Ry from"styled-components";import{Fragment as e5,jsx as ga,jsxs as ky}from"react/jsx-runtime";var Dl=Jw((e,t)=>{let[r,o]=xy(""),[n,i]=xy(!1),{authenticated:a}=F(),{initLoginWithEmail:s}=M(),{navigate:l,setModalData:c,currentScreen:u}=x(),{enabled:f,token:h}=ge(),g=as(r),v=n,y=n||!g,T=b=>{i(!0),s(r,b).then(()=>{l("AWAITING_PASSWORDLESS_CODE")}).catch(A=>{c({errorModalData:{error:A,previousScreen:u||"LANDING"}}),l("ERROR_SCREEN")}).finally(()=>{i(!1)})},_=()=>{f&&!h&&!a?(c({captchaModalData:{callback:b=>s(r,b),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),l("CAPTCHA_SCREEN")):T(h)};return ky(e5,{children:[ga(Qw,{children:ky(Xw,{stacked:e.stacked,children:[ga(Zw,{}),ga("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:b=>o(b.target.value),onKeyUp:b=>{b.key==="Enter"&&_()},value:r,autoComplete:"email"}),e.stacked?null:ga(zn,{isSubmitting:v,onClick:_,disabled:y,children:"Submit"})]})}),e.stacked?ga(D,{loadingText:null,loading:v,disabled:y,onClick:_,children:"Submit"}):null]})}),Qw=Ry.div`
1562
1585
  width: 100%;
1563
- `,Lw=vy.label`
1586
+ `,Xw=Ry.label`
1564
1587
  display: block;
1565
1588
  position: relative;
1566
1589
  width: 100%;
@@ -1621,7 +1644,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1621
1644
  && > input::placeholder {
1622
1645
  color: var(--privy-color-foreground-3);
1623
1646
  }
1624
- `;import{Fragment as Uw,jsx as Ml,jsxs as Cy}from"react/jsx-runtime";var Wl=({isEditable:e,setIsEditable:t})=>{let r=Dw(null);return Cy(Uw,{children:[Ml(Sr,{if:!e,children:Ml(Il,{ref:r})}),Ml(Sr,{if:e,children:Cy(Te,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[Ml(Nw,{})," Continue with Email"]})})]})};import{useState as Fw}from"react";import{jsx as Dd,jsxs as Bw}from"react/jsx-runtime";var Ll=()=>{let[e,t]=Fw(!1),{currentScreen:r,navigate:o,setModalData:n}=A(),{enabled:i,token:a}=ye(),{initLoginWithFarcaster:l}=M();return Bw(Te,{onClick:async()=>{t(!0);try{i&&!a?(n({captchaModalData:{callback:c=>l(c),userIntentRequired:!0,onSuccessNavigateTo:"AWAITING_FARCASTER_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):(await l(a),o("AWAITING_FARCASTER_CONNECTION"))}catch(c){n({errorModalData:{error:c,previousScreen:r||"LANDING"}}),o("ERROR_SCREEN")}finally{t(!1)}},disabled:!1,children:[Dd(Kr,{})," Farcaster",e&&Dd("span",{children:Dd(io,{})})]})};import Hw,{css as Gw}from"styled-components";import{jsx as qw}from"react/jsx-runtime";var Ol=()=>{let{enabled:e,token:t}=ye(),{navigate:r,setModalData:o}=A(),{initLoginWithPasskey:n}=M();return qw(zw,{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"})},Vw=Gw`
1647
+ `;import{Fragment as o5,jsx as Ul,jsxs as Iy}from"react/jsx-runtime";var Fl=({isEditable:e,setIsEditable:t})=>{let r=r5(null);return Iy(o5,{children:[Ul(Sr,{if:!e,children:Ul(Dl,{ref:r})}),Ul(Sr,{if:e,children:Iy(Te,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[Ul(t5,{})," Continue with Email"]})})]})};import{useState as n5}from"react";import{jsx as Vd,jsxs as i5}from"react/jsx-runtime";var Bl=()=>{let[e,t]=n5(!1),{currentScreen:r,navigate:o,setModalData:n}=x(),{enabled:i,token:a}=ge(),{initLoginWithFarcaster:s}=M();return i5(Te,{onClick:async()=>{t(!0);try{i&&!a?(n({captchaModalData:{callback:c=>s(c),userIntentRequired:!0,onSuccessNavigateTo:"AWAITING_FARCASTER_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):(await s(a),o("AWAITING_FARCASTER_CONNECTION"))}catch(c){n({errorModalData:{error:c,previousScreen:r||"LANDING"}}),o("ERROR_SCREEN")}finally{t(!1)}},disabled:!1,children:[Vd(jr,{})," Farcaster",e&&Vd("span",{children:Vd(Gr,{})})]})};import a5,{css as s5}from"styled-components";import{jsx as d5}from"react/jsx-runtime";var Hl=()=>{let{enabled:e,token:t}=ge(),{navigate:r,setModalData:o}=x(),{initLoginWithPasskey:n}=M();return d5(c5,{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"})},l5=s5`
1625
1648
  && {
1626
1649
  width: 100%;
1627
1650
  font-size: 0.875rem;
@@ -1646,11 +1669,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
1646
1669
  box-shadow: none;
1647
1670
  }
1648
1671
  }
1649
- `,zw=Hw.button`
1650
- ${Vw}
1651
- `;import n5 from"@heroicons/react/24/outline/PhoneIcon";import{useRef as i5}from"react";import{forwardRef as e5,useState as Ud}from"react";import Sy from"styled-components";import $w from"libphonenumber-js/examples.mobile.json";import{isPossiblePhoneNumber as Kw,AsYouType as jw,getCountries as Yw,getCountryCallingCode as Nl,getExampleNumber as Zw}from"libphonenumber-js/min";import{jsx as Xw,jsxs as Qw}from"react/jsx-runtime";var ua=(e,t)=>Kw(String(e),t),Dl=(e,t)=>`+${Nl(t)} ${e}`,wy=e=>`*${e.replaceAll("-","").slice(-4)}`,by=e=>new jw(e),Jw=Yw().map(e=>({code:e,callCode:Nl(e)})),Ey=e=>{let t=Zw(e,$w)?.formatInternational();return t?.substring(t.indexOf(" ")+1)},Ty=({value:e,onChange:t})=>Xw("select",{value:e,onChange:t,children:Jw.map(r=>Qw("option",{value:r.code,children:[r.code," +",r.callCode]},r.code))});import{Fragment as o5,jsx as ma,jsxs as Py}from"react/jsx-runtime";var ci=e5((e,t)=>{let{app:r}=A(),[o,n]=Ud(""),[i,a]=Ud(r?.intl.defaultCountry??"US"),l=ua(o,i),s=by(i),c=Ey(i),u=Nl(i),h=!l,[f,g]=Ud(!1),v=u.length,y=w=>{let x=w.target.value;a(x),n(""),e.onChange&&e.onChange({rawPhoneNumber:o,qualifiedPhoneNumber:Dl(o,x),countryCode:x,isValid:ua(o,i)})},S=w=>{try{let x=w.replace(/\D/g,""),k=o.replace(/\D/g,""),D=x===k?w:s.input(w);n(D),e.onChange&&e.onChange({rawPhoneNumber:D,qualifiedPhoneNumber:Dl(w,i),countryCode:i,isValid:ua(w,i)})}catch(x){console.error("Error processing phone number:",x)}},_=()=>{g(!0);let w=Dl(o,i);e.onSubmit({rawPhoneNumber:o,qualifiedPhoneNumber:w,countryCode:i,isValid:ua(o,i)}).finally(()=>g(!1))};return Py(o5,{children:[ma(t5,{children:Py(r5,{callingCodeLength:v,stacked:e.stacked,children:[ma(Ty,{value:i,onChange:y}),ma("input",{ref:t,id:"phone-number-input",type:"tel",placeholder:c,onChange:w=>{S(w.target.value)},onKeyUp:w=>{w.key==="Enter"&&_()},value:o,autoComplete:"tel"}),!e.stacked&&!e.noIncludeSubmitButton?ma(Bn,{isSubmitting:f,onClick:_,disabled:h,children:"Submit"}):null]})}),e.stacked&&!e.noIncludeSubmitButton?ma(N,{loading:f,loadingText:null,onClick:_,disabled:h,children:"Submit"}):null]})}),t5=Sy.div`
1672
+ `,c5=a5.button`
1673
+ ${l5}
1674
+ `;import T5 from"@heroicons/react/24/outline/PhoneIcon";import{useRef as P5}from"react";import{forwardRef as C5,useState as zd}from"react";import Dy from"styled-components";import p5 from"libphonenumber-js/examples.mobile.json";import{isPossiblePhoneNumber as u5,AsYouType as m5,getCountries as f5,getCountryCallingCode as Gl,getExampleNumber as h5}from"libphonenumber-js/min";import{jsx as v5,jsxs as g5}from"react/jsx-runtime";var va=(e,t)=>u5(String(e),t),Vl=(e,t)=>`+${Gl(t)} ${e}`,My=e=>`*${e.replaceAll("-","").slice(-4)}`,Wy=e=>new m5(e),y5=f5().map(e=>({code:e,callCode:Gl(e)})),Ly=e=>{let t=h5(e,p5)?.formatInternational();return t?.substring(t.indexOf(" ")+1)},Oy=({value:e,onChange:t})=>v5("select",{value:e,onChange:t,children:y5.map(r=>g5("option",{value:r.code,children:[r.code," +",r.callCode]},r.code))});import{Fragment as E5,jsx as Ca,jsxs as Ny}from"react/jsx-runtime";var mi=C5((e,t)=>{let{app:r}=x(),[o,n]=zd(""),[i,a]=zd(r?.intl.defaultCountry??"US"),s=va(o,i),l=Wy(i),c=Ly(i),u=Gl(i),f=!s,[h,g]=zd(!1),v=u.length,y=b=>{let A=b.target.value;a(A),n(""),e.onChange&&e.onChange({rawPhoneNumber:o,qualifiedPhoneNumber:Vl(o,A),countryCode:A,isValid:va(o,i)})},T=b=>{try{let A=b.replace(/\D/g,""),k=o.replace(/\D/g,""),N=A===k?b:l.input(b);n(N),e.onChange&&e.onChange({rawPhoneNumber:N,qualifiedPhoneNumber:Vl(b,i),countryCode:i,isValid:va(b,i)})}catch(A){console.error("Error processing phone number:",A)}},_=()=>{g(!0);let b=Vl(o,i);e.onSubmit({rawPhoneNumber:o,qualifiedPhoneNumber:b,countryCode:i,isValid:va(o,i)}).finally(()=>g(!1))};return Ny(E5,{children:[Ca(w5,{children:Ny(b5,{callingCodeLength:v,stacked:e.stacked,children:[Ca(Oy,{value:i,onChange:y}),Ca("input",{ref:t,id:"phone-number-input",type:"tel",placeholder:c,onChange:b=>{T(b.target.value)},onKeyUp:b=>{b.key==="Enter"&&_()},value:o,autoComplete:"tel"}),!e.stacked&&!e.noIncludeSubmitButton?Ca(zn,{isSubmitting:h,onClick:_,disabled:f,children:"Submit"}):null]})}),e.stacked&&!e.noIncludeSubmitButton?Ca(D,{loading:h,loadingText:null,onClick:_,disabled:f,children:"Submit"}):null]})}),w5=Dy.div`
1652
1675
  width: 100%;
1653
- `,r5=Sy.label`
1676
+ `,b5=Dy.label`
1654
1677
  --country-code-dropdown-width: calc(54px + calc(12 * ${e=>e.callingCodeLength}px));
1655
1678
  --phone-input-extra-padding-left: calc(12px + calc(3 * ${e=>e.callingCodeLength}px));
1656
1679
  display: block;
@@ -1737,11 +1760,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
1737
1760
  && > input::placeholder {
1738
1761
  color: var(--privy-color-foreground-3);
1739
1762
  }
1740
- `;import{Fragment as a5,jsx as Ul,jsxs as _y}from"react/jsx-runtime";var Fl=({isEditable:e,setIsEditable:t})=>{let r=i5(null),{authenticated:o}=B(),{navigate:n,setModalData:i,currentScreen:a}=A(),{initLoginWithSms:l}=M(),{enabled:s,token:c}=ye();async function u({qualifiedPhoneNumber:h}){if(s&&!c&&!o)i({captchaModalData:{callback:f=>l(h,f),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await l(h,c),n("AWAITING_PASSWORDLESS_CODE")}catch(f){i({errorModalData:{error:f,previousScreen:a||"LANDING"}}),n("ERROR_SCREEN")}}return _y(a5,{children:[Ul(Sr,{if:!e,children:Ul(ci,{ref:r,onSubmit:u})}),Ul(Sr,{if:e,children:_y(Te,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[Ul(n5,{})," Continue with SMS"]})})]})};import{useState as s5}from"react";import{jsx as co,jsxs as c5}from"react/jsx-runtime";var l5={apple:{logo:co(cs,{}),displayName:"Apple"},discord:{logo:co(ds,{}),displayName:"Discord"},github:{logo:co(ps,{}),displayName:"GitHub"},google:{logo:co(ms,{}),displayName:"Google"},linkedin:{logo:co(gs,{}),displayName:"LinkedIn"},spotify:{logo:co(vs,{}),displayName:"Spotify"},instagram:{logo:co(hs,{}),displayName:"Instagram"},twitter:{logo:co(ws,{}),displayName:"Twitter"},tiktok:{logo:co(Cs,{}),displayName:"TikTok"}},st=({provider:e})=>{let{enabled:t,token:r}=ye(),{navigate:o,setModalData:n}=A(),[i,a]=s5(!1),{initLoginWithOAuth:l}=M(),{displayName:s,logo:c}=l5[e];return c5(Te,{onClick:()=>{a(!0),t&&!r?(n({captchaModalData:{callback:h=>l(e,h),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):l(e)},disabled:i,children:[c," ",s]})};import{useState as d5}from"react";import{jsx as Ro,jsxs as xy}from"react/jsx-runtime";function Bl(e){return xy("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 240 240",...e,children:[Ro("defs",{children:xy("linearGradient",{x1:"120",y1:"240",x2:"120",gradientUnits:"userSpaceOnUse",id:"telegram-linear-gradient",children:[Ro("stop",{offset:"0",stopColor:"#1d93d2"}),Ro("stop",{offset:"1",stopColor:"#38b0e3"})]})}),Ro("title",{children:"Telegram_logo"}),Ro("circle",{cx:"120",cy:"120",r:"120",fill:"url(#telegram-linear-gradient)"}),Ro("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"}),Ro("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"}),Ro("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 p5,jsxs as u5}from"react/jsx-runtime";var Hl=()=>{let{enabled:e,token:t}=ye(),{navigate:r,setModalData:o}=A(),[n,i]=d5(!1),{initLoginWithTelegram:a}=M();async function l(c){try{await a(c),r("TELEGRAM_AUTH_SCREEN")}catch(u){console.error(u),i(!1)}}async function s(){if(i(!0),e&&!t){o({captchaModalData:{callback:l,userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),r("CAPTCHA_SCREEN");return}await l()}return u5(Te,{onClick:s,disabled:n,children:[p5(Bl,{})," Telegram"]})};import m5 from"@heroicons/react/24/outline/ChevronRightIcon";import{jsx as Ay,jsxs as f5}from"react/jsx-runtime";var Gl=({onClick:e,text:t,icon:r})=>f5(Te,{onClick:e,children:[r,Ay(Ys,{children:t}),Ay(m5,{})]});import{Fragment as Fd,jsx as Je,jsxs as zl}from"react/jsx-runtime";var ql=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=M(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=A(),{appearance:{palette:{colorScheme:i}}}=yt(),a=o.loginMethodsAndOrder?.primary??[],l=o.loginMethodsAndOrder?.overflow??[],s=[...a,...l],c=o.loginMethods.passkey,[u,h]=ky("default"),[f,g]=ky("email");y5(()=>{let R=s.indexOf("sms"),H=s.indexOf("email");R>-1&&R<H&&g("sms")},[a,l]);let v=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{h("default")},150)};n.current=v;let y=R=>R==="email"?Je(Wl,{isEditable:f==="email",setIsEditable:()=>{g("email")}},R):R==="sms"?Je(Fl,{isEditable:f==="sms",setIsEditable:()=>{g("sms")}},R):R==="apple"?Je(st,{provider:"apple"},R):R==="discord"?Je(st,{provider:"discord"},R):R==="farcaster"?Je(Ll,{},R):R==="github"?Je(st,{provider:"github"},R):R==="google"?Je(st,{provider:"google"},R):R==="linkedin"?Je(st,{provider:"linkedin"},R):R==="tiktok"?Je(st,{provider:"tiktok"},R):R==="twitter"&&(!g5||o?.loginConfig.twitterOAuthOnMobileEnabled)?Je(st,{provider:"twitter"},R):R==="telegram"?Je(Hl,{},R):Xi([R],r,e,s),S=a.map(y).flat(),_=l.map(y).flat(),w=[...S,..._],x=C5({primary:S.length,overflow:_.length}),[k,D]=wu(w,x),I=u==="default"?void 0:()=>{h("default")};return zl(Fd,{children:[Je(P,{title:o.appearance.landingHeader,onClose:v,backFn:I}),u==="default"&&Je(w5,{}),u==="default"&&(typeof o.appearance.loginMessage=="string"?Je(Js,{children:o.appearance.loginMessage}):o.appearance.loginMessage),Je(Zs,{style:{overflow:"hidden"},children:zl(rf,{colorScheme:i,style:{maxHeight:400,overflowY:"scroll",padding:2},children:[u==="default"&&zl(Fd,{children:[...k,D.length>0&&Je(Gl,{text:"More options",icon:Je(h5,{}),onClick:()=>h("overflow")})]}),u==="overflow"&&zl(Fd,{children:[...D]}),c&&u==="default"&&Je(Ol,{})]})}),o&&Je(Hn,{app:o}),Je(q,{protectedByPrivy:!0})]})},Vl=5,C5=({primary:e,overflow:t})=>e<Vl?e:e===Vl&&t===0?Vl:Vl-1,w5=v5(Zn)`
1763
+ `;import{Fragment as _5,jsx as zl,jsxs as Uy}from"react/jsx-runtime";var ql=({isEditable:e,setIsEditable:t})=>{let r=P5(null),{authenticated:o}=F(),{navigate:n,setModalData:i,currentScreen:a}=x(),{initLoginWithSms:s}=M(),{enabled:l,token:c}=ge();async function u({qualifiedPhoneNumber:f}){if(l&&!c&&!o)i({captchaModalData:{callback:h=>s(f,h),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await s(f,c),n("AWAITING_PASSWORDLESS_CODE")}catch(h){i({errorModalData:{error:h,previousScreen:a||"LANDING"}}),n("ERROR_SCREEN")}}return Uy(_5,{children:[zl(Sr,{if:!e,children:zl(mi,{ref:r,onSubmit:u})}),zl(Sr,{if:e,children:Uy(Te,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[zl(T5,{})," Continue with SMS"]})})]})};import{useState as S5}from"react";import{jsx as uo,jsxs as x5}from"react/jsx-runtime";var A5={apple:{logo:uo(hs,{}),displayName:"Apple"},discord:{logo:uo(ys,{}),displayName:"Discord"},github:{logo:uo(gs,{}),displayName:"GitHub"},google:{logo:uo(Cs,{}),displayName:"Google"},linkedin:{logo:uo(Ts,{}),displayName:"LinkedIn"},spotify:{logo:uo(Ps,{}),displayName:"Spotify"},instagram:{logo:uo(bs,{}),displayName:"Instagram"},twitter:{logo:uo(Ss,{}),displayName:"Twitter"},tiktok:{logo:uo(_s,{}),displayName:"TikTok"}},lt=({provider:e})=>{let{enabled:t,token:r}=ge(),{navigate:o,setModalData:n}=x(),[i,a]=S5(!1),{initLoginWithOAuth:s}=M(),{displayName:l,logo:c}=A5[e];return x5(Te,{onClick:()=>{a(!0),t&&!r?(n({captchaModalData:{callback:f=>s(e,f),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):s(e)},disabled:i,children:[c," ",l]})};import{useState as k5}from"react";import{jsx as Ro,jsxs as Fy}from"react/jsx-runtime";function $l(e){return Fy("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 240 240",...e,children:[Ro("defs",{children:Fy("linearGradient",{x1:"120",y1:"240",x2:"120",gradientUnits:"userSpaceOnUse",id:"telegram-linear-gradient",children:[Ro("stop",{offset:"0",stopColor:"#1d93d2"}),Ro("stop",{offset:"1",stopColor:"#38b0e3"})]})}),Ro("title",{children:"Telegram_logo"}),Ro("circle",{cx:"120",cy:"120",r:"120",fill:"url(#telegram-linear-gradient)"}),Ro("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"}),Ro("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"}),Ro("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 R5,jsxs as I5}from"react/jsx-runtime";var Kl=()=>{let{enabled:e,token:t}=ge(),{navigate:r,setModalData:o}=x(),[n,i]=k5(!1),{initLoginWithTelegram:a}=M();async function s(c){try{await a(c),r("TELEGRAM_AUTH_SCREEN")}catch(u){console.error(u),i(!1)}}async function l(){if(i(!0),e&&!t){o({captchaModalData:{callback:s,userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),r("CAPTCHA_SCREEN");return}await s()}return I5(Te,{onClick:l,disabled:n,children:[R5($l,{})," Telegram"]})};import M5 from"@heroicons/react/24/outline/ChevronRightIcon";import{jsx as By,jsxs as W5}from"react/jsx-runtime";var jl=({onClick:e,text:t,icon:r})=>W5(Te,{onClick:e,children:[r,By(el,{children:t}),By(M5,{})]});import{Fragment as qd,jsx as Xe,jsxs as Zl}from"react/jsx-runtime";var Jl=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=M(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=x(),{appearance:{palette:{colorScheme:i}}}=it(),a=o.loginMethodsAndOrder?.primary??[],s=o.loginMethodsAndOrder?.overflow??[],l=[...a,...s],c=o.loginMethods.passkey,[u,f]=Hy("default"),[h,g]=Hy("email");O5(()=>{let I=l.indexOf("sms"),H=l.indexOf("email");I>-1&&I<H&&g("sms")},[a,s]);let v=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{f("default")},150)};n.current=v;let y=I=>I==="email"?Xe(Fl,{isEditable:h==="email",setIsEditable:()=>{g("email")}},I):I==="sms"?Xe(ql,{isEditable:h==="sms",setIsEditable:()=>{g("sms")}},I):I==="apple"?Xe(lt,{provider:"apple"},I):I==="discord"?Xe(lt,{provider:"discord"},I):I==="farcaster"?Xe(Bl,{},I):I==="github"?Xe(lt,{provider:"github"},I):I==="google"?Xe(lt,{provider:"google"},I):I==="linkedin"?Xe(lt,{provider:"linkedin"},I):I==="tiktok"?Xe(lt,{provider:"tiktok"},I):I==="twitter"&&(!N5||o?.loginConfig.twitterOAuthOnMobileEnabled)?Xe(lt,{provider:"twitter"},I):I==="telegram"?Xe(Kl,{},I):ia([I],r,e,l),T=a.map(y).flat(),_=s.map(y).flat(),b=[...T,..._],A=U5({primary:T.length,overflow:_.length}),[k,N]=_u(b,A),R=u==="default"?void 0:()=>{f("default")};return Zl(qd,{children:[Xe(S,{title:o.appearance.landingHeader,onClose:v,backFn:R}),u==="default"&&Xe(F5,{}),u==="default"&&(typeof o.appearance.loginMessage=="string"?Xe(rl,{children:o.appearance.loginMessage}):o.appearance.loginMessage),Xe(tl,{style:{overflow:"hidden"},children:Zl(df,{colorScheme:i,style:{maxHeight:400,overflowY:"scroll",padding:2},children:[u==="default"&&Zl(qd,{children:[...k,N.length>0&&Xe(jl,{text:"More options",icon:Xe(L5,{}),onClick:()=>f("overflow")})]}),u==="overflow"&&Zl(qd,{children:[...N]}),c&&u==="default"&&Xe(Hl,{})]})}),o&&Xe(qn,{app:o}),Xe($,{protectedByPrivy:!0})]})},Yl=5,U5=({primary:e,overflow:t})=>e<Yl?e:e===Yl&&t===0?Yl:Yl-1,F5=D5(ei)`
1741
1764
  margin-bottom: 16px;
1742
- `;import P5 from"@heroicons/react/24/outline/EnvelopeIcon";import S5 from"@heroicons/react/24/outline/PhoneIcon";import _5 from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as x5,useState as Wy}from"react";import{isMobile as A5}from"react-device-detect";import k5 from"styled-components";import{jsx as fa,jsxs as Ry}from"react/jsx-runtime";var Iy=({...e})=>Ry("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...e,children:[Ry("g",{clipPath:"url(#clip0_2856_1743)",children:[fa("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"}),fa("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"})]}),fa("defs",{children:fa("clipPath",{id:"clip0_2856_1743",children:fa("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]});import b5 from"@heroicons/react/24/outline/ChevronRightIcon";import E5 from"@heroicons/react/24/outline/WalletIcon";import{jsx as Bd,jsxs as T5}from"react/jsx-runtime";var My=({onClick:e,text:t})=>T5(Te,{onClick:e,children:[Bd(E5,{}),Bd(Ys,{children:t}),Bd(b5,{})]});import{Fragment as ha,jsx as Me,jsxs as di}from"react/jsx-runtime";var $l=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=M(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=A(),{email:i,sms:a,google:l,twitter:s,discord:c,github:u,spotify:h,instagram:f,tiktok:g,linkedin:v,apple:y,wallet:S,farcaster:_,passkey:w,telegram:x}=o?.loginMethods??{},k=o?.appearance.loginGroupPriority||"web2-first",D=o?.appearance.hideDirectWeb2Inputs,[I,R]=Wy("default"),[H,K]=Wy(i?"email":"sms");x5(()=>{K(i?"email":"sms")},[i]);let Y=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{R("default")},150)};n.current=Y;let W=[i&&Me(Wl,{isEditable:H==="email",setIsEditable:()=>{K("email")}}),a&&Me(Fl,{isEditable:H==="sms",setIsEditable:()=>{K("sms")}})].filter(Boolean),G=[l&&Me(st,{provider:"google"}),s&&(!A5||o?.loginConfig.twitterOAuthOnMobileEnabled)&&Me(st,{provider:"twitter"}),c&&Me(st,{provider:"discord"}),u&&Me(st,{provider:"github"}),h&&Me(st,{provider:"spotify"}),f&&Me(st,{provider:"instagram"}),g&&Me(st,{provider:"tiktok"}),v&&Me(st,{provider:"linkedin"}),y&&Me(st,{provider:"apple"}),_&&Me(Ll,{}),x&&Me(Hl,{})].filter(Boolean),L=Xi(o.appearance.walletList,r,e,o.appearance.walletList),ae=I==="default"?void 0:()=>{R("default")},pe=I5({priority:k,email:i,sms:a,social:G}),ue=M5({priority:k,email:i,sms:a,social:G}),be=W5({priority:k,email:i,sms:a,social:G}),X=Me(My,{text:be,onClick:()=>R("web3-overflow")}),Pt=Me(Gl,{text:pe,icon:ue,onClick:()=>R("web2-overflow")}),et=D?0:1;return di(ha,{children:[Me(P,{title:o.appearance.landingHeader,onClose:Y,backFn:ae}),I==="default"&&Me(R5,{}),I==="default"&&(typeof o.appearance.loginMessage=="string"?Me(Js,{children:o.appearance.loginMessage}):o.appearance.loginMessage),Me(Zs,{style:{overflow:"hidden",padding:2},children:di(Pr,{children:[I==="default"&&k==="web2-first"&&di(ha,{children:[...W,...G.length+W.length>4?G.slice(0,3-W.length):G,W.length+G.length>4&&Pt,S&&X]}),I==="default"&&k==="web3-first"&&di(ha,{children:[S&&di(ha,{children:[...L.length>4?L.slice(0,3):L,L.length>4&&X]}),W.length+G.length>et&&Pt,W.length+G.length===et&&W.length?W[0]:null,W.length+G.length===et&&G.length?G[0]:null]}),I==="web2-overflow"&&di(ha,{children:[...k==="web3-first"?W:[],...G]}),...I==="web3-overflow"?L:[],w&&I==="default"&&Me(Ol,{})]})}),o&&Me(Hn,{app:o}),Me(q,{protectedByPrivy:!0})]})},R5=k5(Zn)`
1765
+ `;import V5 from"@heroicons/react/24/outline/EnvelopeIcon";import z5 from"@heroicons/react/24/outline/PhoneIcon";import q5 from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as $5,useState as qy}from"react";import{isMobile as K5}from"react-device-detect";import j5 from"styled-components";import{jsx as wa,jsxs as Gy}from"react/jsx-runtime";var Vy=({...e})=>Gy("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...e,children:[Gy("g",{clipPath:"url(#clip0_2856_1743)",children:[wa("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"}),wa("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"})]}),wa("defs",{children:wa("clipPath",{id:"clip0_2856_1743",children:wa("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]});import B5 from"@heroicons/react/24/outline/ChevronRightIcon";import H5 from"@heroicons/react/24/outline/WalletIcon";import{jsx as $d,jsxs as G5}from"react/jsx-runtime";var zy=({onClick:e,text:t})=>G5(Te,{onClick:e,children:[$d(H5,{}),$d(el,{children:t}),$d(B5,{})]});import{Fragment as ba,jsx as Me,jsxs as fi}from"react/jsx-runtime";var Ql=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=M(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=x(),{email:i,sms:a,google:s,twitter:l,discord:c,github:u,spotify:f,instagram:h,tiktok:g,linkedin:v,apple:y,wallet:T,farcaster:_,passkey:b,telegram:A}=o?.loginMethods??{},k=o?.appearance.loginGroupPriority||"web2-first",N=o?.appearance.hideDirectWeb2Inputs,[R,I]=qy("default"),[H,G]=qy(i?"email":"sms");$5(()=>{G(i?"email":"sms")},[i]);let Z=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{I("default")},150)};n.current=Z;let W=[i&&Me(Fl,{isEditable:H==="email",setIsEditable:()=>{G("email")}}),a&&Me(ql,{isEditable:H==="sms",setIsEditable:()=>{G("sms")}})].filter(Boolean),q=[s&&Me(lt,{provider:"google"}),l&&(!K5||o?.loginConfig.twitterOAuthOnMobileEnabled)&&Me(lt,{provider:"twitter"}),c&&Me(lt,{provider:"discord"}),u&&Me(lt,{provider:"github"}),f&&Me(lt,{provider:"spotify"}),h&&Me(lt,{provider:"instagram"}),g&&Me(lt,{provider:"tiktok"}),v&&Me(lt,{provider:"linkedin"}),y&&Me(lt,{provider:"apple"}),_&&Me(Bl,{}),A&&Me(Kl,{})].filter(Boolean),L=ia(o.appearance.walletList,r,e,o.appearance.walletList),se=R==="default"?void 0:()=>{I("default")},ue=Z5({priority:k,email:i,sms:a,social:q}),me=J5({priority:k,email:i,sms:a,social:q}),be=Q5({priority:k,email:i,sms:a,social:q}),X=Me(zy,{text:be,onClick:()=>I("web3-overflow")}),Pt=Me(jl,{text:ue,icon:me,onClick:()=>I("web2-overflow")}),rt=N?0:1;return fi(ba,{children:[Me(S,{title:o.appearance.landingHeader,onClose:Z,backFn:se}),R==="default"&&Me(Y5,{}),R==="default"&&(typeof o.appearance.loginMessage=="string"?Me(rl,{children:o.appearance.loginMessage}):o.appearance.loginMessage),Me(tl,{style:{overflow:"hidden",padding:2},children:fi(_r,{children:[R==="default"&&k==="web2-first"&&fi(ba,{children:[...W,...q.length+W.length>4?q.slice(0,3-W.length):q,W.length+q.length>4&&Pt,T&&X]}),R==="default"&&k==="web3-first"&&fi(ba,{children:[T&&fi(ba,{children:[...L.length>4?L.slice(0,3):L,L.length>4&&X]}),W.length+q.length>rt&&Pt,W.length+q.length===rt&&W.length?W[0]:null,W.length+q.length===rt&&q.length?q[0]:null]}),R==="web2-overflow"&&fi(ba,{children:[...k==="web3-first"?W:[],...q]}),...R==="web3-overflow"?L:[],b&&R==="default"&&Me(Hl,{})]})}),o&&Me(qn,{app:o}),Me($,{protectedByPrivy:!0})]})},Y5=j5(ei)`
1743
1766
  margin-bottom: 16px;
1744
- `,I5=({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",M5=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"||o.length>0?Me(_5,{}):t&&r?Me(Iy,{}):t?Me(P5,{}):r?Me(S5,{}):null,W5=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets";import{jsx as Ly}from"react/jsx-runtime";var Oy=()=>{let{app:e}=A();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?Ly(ql,{connectOnly:!0}):Ly($l,{connectOnly:!0})};import{jsx as Ny}from"react/jsx-runtime";var Dy=()=>{let{app:e}=A();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?Ny(ql,{connectOnly:!1}):Ny($l,{connectOnly:!1})};import L5 from"@heroicons/react/24/outline/EnvelopeIcon";import{Fragment as O5,jsx as Io,jsxs as N5}from"react/jsx-runtime";var Uy=()=>{let{app:e}=A();return N5(O5,{children:[Io(P,{},"header"),Io(Q,{}),Io(ke,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:Io(L5,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),Io(ur,{children:Io(Il,{stacked:!0})}),Io(re,{}),Io(q,{protectedByPrivy:!0})]})};import D5 from"@heroicons/react/24/outline/ClockIcon";import U5 from"@heroicons/react/24/outline/TrashIcon";import F5 from"@heroicons/react/24/solid/CheckBadgeIcon";import B5 from"@heroicons/react/24/solid/CheckCircleIcon";import H5 from"@heroicons/react/24/solid/LockClosedIcon";import{useEffect as G5,useState as ya}from"react";import yr,{css as Vy}from"styled-components";import{jsx as Fy}from"react/jsx-runtime";var un=({style:e,...t})=>Fy("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:Fy("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 Le,jsxs as By}from"react/jsx-runtime";var mn=({style:e,...t})=>By("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:[By("g",{clipPath:"url(#clip0_113_33841)",children:[Le("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"}),Le("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"}),Le("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"}),Le("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"}),Le("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"}),Le("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"}),Le("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"}),Le("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"}),Le("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"}),Le("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"}),Le("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"}),Le("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"}),Le("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"}),Le("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"}),Le("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"}),Le("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"}),Le("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"}),Le("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"}),Le("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"}),Le("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"}),Le("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"}),Le("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"})]}),Le("defs",{children:Le("clipPath",{id:"clip0_113_33841",children:Le("rect",{width:"64",height:"64",fill:"white",transform:"translate(0.483887)"})})})]});import{Fragment as Hd,jsx as de,jsxs as Gt}from"react/jsx-runtime";var Hy=({passkeys:e,expanded:t,onUnlink:r,onExpand:o})=>{let[n,i]=ya([]),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(u=>u.concat([c])),await r(c),i(u=>u.filter(h=>h!==c))};return Gt("div",{children:[de(Y5,{children:"Your passkeys"}),Gt(qy,{children:[e.slice(0,a).map(c=>Gt(Q5,{children:[Gt("div",{children:[de(Z5,{children:l(c)}),Gt(J5,{children:["Last used: ",(c.latestVerifiedAt??c.verifiedAt).toLocaleString()]})]}),de(e6,{disabled:n.includes(c.credentialId),onClick:()=>s(c.credentialId),children:n.includes(c.credentialId)?de(io,{}):de(U5,{height:"1.6em"})})]},c.credentialId)),e.length>2&&!t&&de($5,{onClick:o,children:"View all"})]})]})},V5=()=>Gt(qy,{children:[Gt(Bt,{children:[de(Ft,{children:de(F5,{})}),"Log in with Touch ID, Face ID, or a security key."]}),Gt(Bt,{children:[de(Ft,{children:de(H5,{})}),"More secure than a password."]}),Gt(Bt,{children:[de(Ft,{children:de(D5,{})}),"Takes seconds to set up and use."]})]}),zy=()=>{let{user:e,unlinkPasskey:t}=B(),{linkWithPasskey:r,closePrivyModal:o}=M(),n=e?.linkedAccounts.filter(y=>y.type==="passkey"),[i,a]=ya(!1),[l,s]=ya(""),[c,u]=ya(!1),[h,f]=ya(!1);G5(()=>{n.length===0&&f(!1)},[n.length]);let g=()=>{a(!0),r().then(()=>u(!0)).catch(y=>{if(y instanceof $e){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)})},v=async y=>(a(!0),await t(y).then(()=>u(!0)).catch(S=>{if(S instanceof $e&&S.privyErrorCode==="missing_or_invalid_mfa"){s("Cannot unlink a passkey enrolled in MFA");return}s("Unknown error occurred.")}).finally(()=>{a(!1)}));return c?Gt(Hd,{children:[de(P,{onClose:()=>o()},"header"),de(Ae,{children:de(He,{status:"success",children:de(B5,{})})}),de(Gy,{children:"Passkey added"}),de(K5,{children:"From now on, you can use your passkey to log in."}),de(gt,{children:de(N,{onClick:()=>o(),children:"Done"})}),de(V,{})]}):h?Gt(Hd,{children:[de(P,{backFn:()=>f(!1),onClose:()=>o()},"header"),de(Hy,{passkeys:n,expanded:h,onUnlink:v,onExpand:()=>f(!0)}),de(V,{})]}):Gt(Hd,{children:[de(P,{onClose:()=>o()},"header"),de(Ae,{children:Gt(Kl,{children:[de(un,{}),de(mn,{})]})}),de(Gy,{children:"Secure your account with a passkey"}),de(j5,{}),n.length===0?de(V5,{}):de(Hy,{passkeys:n,expanded:h,onUnlink:v,onExpand:()=>f(!0)}),Gt(gt,{style:{marginTop:"12px"},children:[l&&de(z5,{fail:!0,children:l}),de(N,{onClick:g,loading:i,children:"Add new passkey"})]}),de(V,{})]})},Kl=yr.div`
1767
+ `,Z5=({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",J5=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"||o.length>0?Me(q5,{}):t&&r?Me(Vy,{}):t?Me(V5,{}):r?Me(z5,{}):null,Q5=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets";import{jsx as $y}from"react/jsx-runtime";var Ky=()=>{let{app:e}=x();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?$y(Jl,{connectOnly:!0}):$y(Ql,{connectOnly:!0})};import{jsx as jy}from"react/jsx-runtime";var Yy=()=>{let{app:e}=x();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?jy(Jl,{connectOnly:!1}):jy(Ql,{connectOnly:!1})};import X5 from"@heroicons/react/24/outline/EnvelopeIcon";import{Fragment as e6,jsx as Io,jsxs as t6}from"react/jsx-runtime";var Zy=()=>{let{app:e}=x();return t6(e6,{children:[Io(S,{},"header"),Io(Q,{}),Io(ke,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:Io(X5,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),Io(ur,{children:Io(Dl,{stacked:!0})}),Io(re,{}),Io($,{protectedByPrivy:!0})]})};import r6 from"@heroicons/react/24/outline/ClockIcon";import o6 from"@heroicons/react/24/outline/TrashIcon";import n6 from"@heroicons/react/24/solid/CheckBadgeIcon";import i6 from"@heroicons/react/24/solid/CheckCircleIcon";import a6 from"@heroicons/react/24/solid/LockClosedIcon";import{useEffect as s6,useState as Ea}from"react";import yr,{css as tg}from"styled-components";import{jsx as Jy}from"react/jsx-runtime";var mn=({style:e,...t})=>Jy("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:Jy("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 Ne,jsxs as Qy}from"react/jsx-runtime";var fn=({style:e,...t})=>Qy("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:[Qy("g",{clipPath:"url(#clip0_113_33841)",children:[Ne("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"}),Ne("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"}),Ne("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"}),Ne("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"}),Ne("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"}),Ne("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"}),Ne("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"}),Ne("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"}),Ne("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"}),Ne("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"}),Ne("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"}),Ne("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"}),Ne("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"}),Ne("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"}),Ne("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"}),Ne("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"}),Ne("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"}),Ne("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"}),Ne("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"}),Ne("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"}),Ne("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"}),Ne("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"})]}),Ne("defs",{children:Ne("clipPath",{id:"clip0_113_33841",children:Ne("rect",{width:"64",height:"64",fill:"white",transform:"translate(0.483887)"})})})]});import{Fragment as Kd,jsx as pe,jsxs as zt}from"react/jsx-runtime";var Xy=({passkeys:e,expanded:t,onUnlink:r,onExpand:o})=>{let[n,i]=Ea([]),a=t?e.length:2,s=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",l=async c=>{i(u=>u.concat([c])),await r(c),i(u=>u.filter(f=>f!==c))};return zt("div",{children:[pe(f6,{children:"Your passkeys"}),zt(og,{children:[e.slice(0,a).map(c=>zt(g6,{children:[zt("div",{children:[pe(h6,{children:s(c)}),zt(y6,{children:["Last used: ",(c.latestVerifiedAt??c.verifiedAt).toLocaleString()]})]}),pe(C6,{disabled:n.includes(c.credentialId),onClick:()=>l(c.credentialId),children:n.includes(c.credentialId)?pe(Gr,{}):pe(o6,{height:"1.6em"})})]},c.credentialId)),e.length>2&&!t&&pe(p6,{onClick:o,children:"View all"})]})]})},l6=()=>zt(og,{children:[zt(Gt,{children:[pe(Ht,{children:pe(n6,{})}),"Log in with Touch ID, Face ID, or a security key."]}),zt(Gt,{children:[pe(Ht,{children:pe(a6,{})}),"More secure than a password."]}),zt(Gt,{children:[pe(Ht,{children:pe(r6,{})}),"Takes seconds to set up and use."]})]}),rg=()=>{let{user:e,unlinkPasskey:t}=F(),{linkWithPasskey:r,closePrivyModal:o}=M(),n=e?.linkedAccounts.filter(y=>y.type==="passkey"),[i,a]=Ea(!1),[s,l]=Ea(""),[c,u]=Ea(!1),[f,h]=Ea(!1);s6(()=>{n.length===0&&h(!1)},[n.length]);let g=()=>{a(!0),r().then(()=>u(!0)).catch(y=>{if(y instanceof Ke){if(y.privyErrorCode==="cannot_link_more_of_type"){l("Cannot link more passkeys to account.");return}else if(y.privyErrorCode==="passkey_not_allowed"){l("Passkey request timed out or rejected by user.");return}}l("Unknown error occurred.")}).finally(()=>{a(!1)})},v=async y=>(a(!0),await t(y).then(()=>u(!0)).catch(T=>{if(T instanceof Ke&&T.privyErrorCode==="missing_or_invalid_mfa"){l("Cannot unlink a passkey enrolled in MFA");return}l("Unknown error occurred.")}).finally(()=>{a(!1)}));return c?zt(Kd,{children:[pe(S,{onClose:()=>o()},"header"),pe(xe,{children:pe(Ge,{status:"success",children:pe(i6,{})})}),pe(eg,{children:"Passkey added"}),pe(u6,{children:"From now on, you can use your passkey to log in."}),pe(gt,{children:pe(D,{onClick:()=>o(),children:"Done"})}),pe(z,{})]}):f?zt(Kd,{children:[pe(S,{backFn:()=>h(!1),onClose:()=>o()},"header"),pe(Xy,{passkeys:n,expanded:f,onUnlink:v,onExpand:()=>h(!0)}),pe(z,{})]}):zt(Kd,{children:[pe(S,{onClose:()=>o()},"header"),pe(xe,{children:zt(Xl,{children:[pe(mn,{}),pe(fn,{})]})}),pe(eg,{children:"Secure your account with a passkey"}),pe(m6,{}),n.length===0?pe(l6,{}):pe(Xy,{passkeys:n,expanded:f,onUnlink:v,onExpand:()=>h(!0)}),zt(gt,{style:{marginTop:"12px"},children:[s&&pe(c6,{fail:!0,children:s}),pe(D,{onClick:g,loading:i,children:"Add new passkey"})]}),pe(z,{})]})},Xl=yr.div`
1745
1768
  display: flex;
1746
1769
  align-items: center;
1747
1770
  justify-content: center;
@@ -1757,7 +1780,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1757
1780
  stroke: var(--privy-color-accent) !important;
1758
1781
  fill: var(--privy-color-accent) !important;
1759
1782
  }
1760
- `,z5=yr.div`
1783
+ `,c6=yr.div`
1761
1784
  line-height: 20px;
1762
1785
  height: 20px;
1763
1786
  font-size: 13px;
@@ -1765,7 +1788,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1765
1788
  display: flex;
1766
1789
  justify-content: flex-beginngin;
1767
1790
  width: 100%;
1768
- `,q5=Vy`
1791
+ `,d6=tg`
1769
1792
  && {
1770
1793
  width: 100%;
1771
1794
  font-size: 0.875rem;
@@ -1790,9 +1813,9 @@ You will need this password to access your ${e} wallet on a new device. Please k
1790
1813
  box-shadow: none;
1791
1814
  }
1792
1815
  }
1793
- `,$5=yr.button`
1794
- ${q5}
1795
- `,qy=yr.div`
1816
+ `,p6=yr.button`
1817
+ ${d6}
1818
+ `,og=yr.div`
1796
1819
  display: flex;
1797
1820
  flex-direction: column;
1798
1821
  align-items: stretch;
@@ -1800,18 +1823,18 @@ You will need this password to access your ${e} wallet on a new device. Please k
1800
1823
  padding: 0.5rem 0rem 0rem;
1801
1824
  flex-grow: 1;
1802
1825
  width: 100%;
1803
- `,Gy=yr.div`
1826
+ `,eg=yr.div`
1804
1827
  font-size: 18px;
1805
1828
  line-height: 18px;
1806
1829
  text-align: center;
1807
1830
  font-weight: 600;
1808
- `,K5=yr.div`
1831
+ `,u6=yr.div`
1809
1832
  font-size: 0.875rem;
1810
1833
  text-align: center;
1811
1834
  margin-top: 10px;
1812
- `,j5=yr.div`
1835
+ `,m6=yr.div`
1813
1836
  height: 32px;
1814
- `,Y5=yr.div`
1837
+ `,f6=yr.div`
1815
1838
  line-height: 20px;
1816
1839
  height: 20px;
1817
1840
  font-size: 1em;
@@ -1819,18 +1842,18 @@ You will need this password to access your ${e} wallet on a new device. Please k
1819
1842
  display: flex;
1820
1843
  justify-content: flex-beginning;
1821
1844
  width: 100%;
1822
- `,Z5=yr.div`
1845
+ `,h6=yr.div`
1823
1846
  font-size: 1em;
1824
1847
  line-height: 1.3em;
1825
1848
  font-weight: 500;
1826
1849
  color: var(--privy-color-foreground-2);
1827
1850
  padding: 0.2em 0;
1828
- `,J5=yr.div`
1851
+ `,y6=yr.div`
1829
1852
  font-size: 0.875rem;
1830
1853
  line-height: 1rem;
1831
1854
  color: #64668b;
1832
1855
  padding: 0.2em 0;
1833
- `,Q5=yr.div`
1856
+ `,g6=yr.div`
1834
1857
  display: flex;
1835
1858
  align-items: center;
1836
1859
  justify-content: space-between;
@@ -1843,7 +1866,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1843
1866
  border: 1px solid #e2e3f0 !important;
1844
1867
  width: 100%;
1845
1868
  height: 5em;
1846
- `,X5=Vy`
1869
+ `,v6=tg`
1847
1870
  :focus,
1848
1871
  :hover,
1849
1872
  :active {
@@ -1860,9 +1883,9 @@ You will need this password to access your ${e} wallet on a new device. Please k
1860
1883
  svg:hover {
1861
1884
  color: var(--privy-color-foreground-3);
1862
1885
  }
1863
- `,e6=yr.button`
1864
- ${X5}
1865
- `;import t6 from"@heroicons/react/24/outline/PhoneIcon";import{Fragment as r6,jsx as Mo,jsxs as o6}from"react/jsx-runtime";var $y=()=>{let{app:e,currentScreen:t,data:r,navigate:o,setModalData:n}=A(),{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 o6(r6,{children:[Mo(P,{},"header"),Mo(Q,{}),Mo(ke,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:Mo(t6,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),Mo(ur,{children:Mo(ci,{stacked:!0,onSubmit:a})}),Mo(re,{}),Mo(q,{protectedByPrivy:!0})]})};import{Fragment as n6,jsx as ga,jsxs as i6}from"react/jsx-runtime";var Ky=()=>{let{linkingHint:e}=M(),{app:t}=A(),r=e?`Select the wallet with ${go(e)} and follow the instructions to reconnect your wallet${t?.name?` to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return i6(n6,{children:[ga(P,{},"header"),ga(zr,{title:`${e?"Reconnect":"Connect"} your wallet`,description:r}),ga(Pr,{children:ga(Yn,{connectOnly:!1})}),ga(q,{protectedByPrivy:!0})]})};import{jsx as jy,jsxs as a6}from"react/jsx-runtime";var Yy=({style:e,...t})=>a6("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:[jy("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),jy("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 s6,jsx as Wo,jsxs as Zy}from"react/jsx-runtime";var Jy=()=>{let{closePrivyModal:e}=M(),{navigate:t}=A();return Zy(s6,{children:[Wo(P,{},"header"),Wo(Q,{}),Wo(Yy,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),Wo(zr,{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"}}),Zy(ur,{children:[Wo(N,{onClick:()=>t("LANDING"),children:"Try again"}),Wo(Tr,{onClick:()=>e(),children:"Cancel"})]}),Wo(re,{}),Wo(q,{protectedByPrivy:!0})]})};import z6 from"@heroicons/react/24/solid/CheckBadgeIcon";import q6 from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import $6 from"@heroicons/react/24/solid/IdentificationIcon";import K6 from"@heroicons/react/24/solid/PhoneIcon";import j6 from"@heroicons/react/24/solid/QuestionMarkCircleIcon";import d1 from"@heroicons/react/24/solid/ShieldCheckIcon";import{useEffect as Y6,useState as pi}from"react";import{useContext as l6}from"react";function va(){let{promptMfa:e,init:t,submit:r,cancel:o,mfaMethods:n}=l6(he);return{promptMfa:e,init:t,submit:r,cancel:o,mfaMethods:n}}import{useContext as c6}from"react";function Mr(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:n,submitEnrollmentWithPasskey:i,unenroll:a,enrollInMfa:l}=c6(he);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 d6 from"styled-components";import{jsx as Qy,jsxs as u6}from"react/jsx-runtime";var Xy=e=>u6(p6,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...e,children:[Qy("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),Qy("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"})]}),p6=d6.svg`
1886
+ `,C6=yr.button`
1887
+ ${v6}
1888
+ `;import w6 from"@heroicons/react/24/outline/PhoneIcon";import{Fragment as b6,jsx as Mo,jsxs as E6}from"react/jsx-runtime";var ng=()=>{let{app:e,currentScreen:t,data:r,navigate:o,setModalData:n}=x(),{initLoginWithSms:i}=M();async function a({qualifiedPhoneNumber:s}){try{await i(s),o("AWAITING_PASSWORDLESS_CODE")}catch(l){n({errorModalData:{error:l,previousScreen:r?.errorModalData?.previousScreen||t||"LINK_PHONE_SCREEN"}}),o("ERROR_SCREEN")}}return E6(b6,{children:[Mo(S,{},"header"),Mo(Q,{}),Mo(ke,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:Mo(w6,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),Mo(ur,{children:Mo(mi,{stacked:!0,onSubmit:a})}),Mo(re,{}),Mo($,{protectedByPrivy:!0})]})};import{Fragment as T6,jsx as Ta,jsxs as P6}from"react/jsx-runtime";var ig=()=>{let{linkingHint:e}=M(),{app:t}=x(),r=e?`Select the wallet with ${vo(e)} and follow the instructions to reconnect your wallet${t?.name?` to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return P6(T6,{children:[Ta(S,{},"header"),Ta(qr,{title:`${e?"Reconnect":"Connect"} your wallet`,description:r}),Ta(_r,{children:Ta(Xn,{connectOnly:!1})}),Ta($,{protectedByPrivy:!0})]})};import{jsx as ag,jsxs as _6}from"react/jsx-runtime";var sg=({style:e,...t})=>_6("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:[ag("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),ag("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 S6,jsx as Wo,jsxs as lg}from"react/jsx-runtime";var cg=()=>{let{closePrivyModal:e}=M(),{navigate:t}=x();return lg(S6,{children:[Wo(S,{},"header"),Wo(Q,{}),Wo(sg,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),Wo(qr,{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"}}),lg(ur,{children:[Wo(D,{onClick:()=>t("LANDING"),children:"Try again"}),Wo(Pr,{onClick:()=>e(),children:"Cancel"})]}),Wo(re,{}),Wo($,{protectedByPrivy:!0})]})};import c7 from"@heroicons/react/24/solid/CheckBadgeIcon";import d7 from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import p7 from"@heroicons/react/24/solid/IdentificationIcon";import u7 from"@heroicons/react/24/solid/PhoneIcon";import m7 from"@heroicons/react/24/solid/QuestionMarkCircleIcon";import Eg from"@heroicons/react/24/solid/ShieldCheckIcon";import{useEffect as f7,useState as hi}from"react";import{useContext as A6}from"react";function Pa(){let{promptMfa:e,init:t,submit:r,cancel:o,mfaMethods:n}=A6(ye);return{promptMfa:e,init:t,submit:r,cancel:o,mfaMethods:n}}import{useContext as x6}from"react";function Wr(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:n,submitEnrollmentWithPasskey:i,unenroll:a,enrollInMfa:s}=x6(ye);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:n,submitEnrollmentWithPasskey:i,unenrollWithSms:()=>a("sms"),unenrollWithTotp:()=>a("totp"),unenrollWithPasskey:()=>a("passkey"),showMfaEnrollmentModal:()=>s(!0),closeMfaEnrollmentModal:()=>s(!1)}}import k6 from"styled-components";import{jsx as dg,jsxs as I6}from"react/jsx-runtime";var pg=e=>I6(R6,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...e,children:[dg("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),dg("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"})]}),R6=k6.svg`
1866
1889
  height: 90px;
1867
1890
  width: 90px;
1868
1891
 
@@ -1873,7 +1896,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1873
1896
  > path {
1874
1897
  fill: white;
1875
1898
  }
1876
- `;import Gd from"@heroicons/react/20/solid/CheckIcon";import m6 from"@heroicons/react/24/outline/ChevronRightIcon";import f6 from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import h6 from"@heroicons/react/24/outline/FingerPrintIcon";import y6 from"@heroicons/react/24/outline/PhoneIcon";import Vd from"@heroicons/react/24/outline/TrashIcon";import g6 from"@heroicons/react/24/solid/ShieldCheckIcon";import{Fragment as v6,jsx as ge,jsxs as Vt}from"react/jsx-runtime";var e1=({showIntro:e,userMfaMethods:t,appMfaMethods:r,userHasAuthSms:o,isTotpLoading:n,isPasskeyLoading:i,error:a,onClose:l,onBackToIntro:s,handleSelectMethod:c,setRemovingMfaMethod:u})=>{let h=t.reduce((g,v)=>({...g,[v]:!0}),{}),f=r.reduce((g,v)=>({...g,[v]:!0}),{});return Vt(v6,{children:[ge(P,{backFn:e?s:void 0,onClose:l},"header"),ge(Ae,{children:ge(He,{children:ge(g6,{})})}),ge(se,{children:"Choose a verification method"}),t.length>0?ge(ce,{children:"To add or delete verification methods, verification is required."}):ge(ce,{children:"How would you like to verify your identity? You can change this later."}),a&&ge(ol,{style:{marginTop:"1.25rem"},children:a.message}),Vt(Qs,{children:[(f.totp||h.totp)&&Vt(Xs,{children:[ge(Te,{style:{justifyContent:"center"},disabled:h.totp||n,onClick:()=>c("totp"),children:n?ge(nt,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):Vt(rl,{children:[Vt(tl,{children:[ge(f6,{}),"Authenticator App"]}),h.totp?Vt(on,{children:[ge(Gd,{}),"Added"]}):ge(on,{children:"Recommended"})]})}),h.totp&&ge(el,{onClick:()=>u("totp"),children:ge(Vd,{})})]},"totp"),(f.sms||h.sms)&&Vt(Xs,{children:[ge(Te,{disabled:h.sms||o,onClick:()=>c("sms"),children:Vt(rl,{children:[Vt(tl,{children:[ge(y6,{}),"SMS"]}),h.sms&&Vt(on,{children:[ge(Gd,{}),"Added"]}),o&&ge(on,{children:"Disabled"})]})}),h.sms&&ge(el,{onClick:()=>u("sms"),children:ge(Vd,{})})]},"sms"),(f.passkey||h.passkey)&&Vt(Xs,{children:[ge(Te,{style:{justifyContent:"center"},onClick:()=>c("passkey"),disabled:h.passkey||i,children:i?ge(nt,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):Vt(rl,{children:[Vt(tl,{children:[ge(h6,{}),"Passkey"]}),h.passkey?Vt(on,{children:[ge(Gd,{}),"Added"]}):ge(on,{isAccent:!0,children:ge(m6,{})})]})}),h.passkey&&ge(el,{onClick:()=>u("passkey"),children:ge(Vd,{})})]},"passkey")]}),ge(V,{})]})};import C6 from"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import w6 from"@heroicons/react/24/outline/ClockIcon";import b6 from"@heroicons/react/24/outline/ShieldCheckIcon";import E6 from"@heroicons/react/24/solid/CheckCircleIcon";import{useMemo as T6,useState as Ca}from"react";import jl from"styled-components";import{Fragment as zd,jsx as ie,jsxs as gr}from"react/jsx-runtime";var r1=({onComplete:e,onClose:t,onReset:r})=>{let{user:o}=B(),{data:n}=A(),{initLinkWithPasskey:i,linkWithPasskey:a}=M(),{initEnrollmentWithPasskey:l,submitEnrollmentWithPasskey:s}=Mr(),[c,u]=Ca(!1),[h,f]=Ca(!1),[g,v]=Ca(!1),[y,S]=Ca(null),_=T6(()=>o?.linkedAccounts.filter(D=>D.type==="passkey")??[],[o]),w=()=>{n?.mfaEnrollmentFlow?.onSuccess(),e()},x=async D=>{u(!0);try{await l(),await s({credentialIds:D}),v(!0)}catch(I){S(I)}finally{u(!1)}},k=async()=>{f(!0),S(null);try{await i();let I=(await a())?.linkedAccounts.filter(R=>R.type==="passkey").map(R=>R.credentialId)??[];await x(I)}catch(D){S(D)}finally{f(!1)}};return _.length===0||h?ie(P6,{onReset:r,onClose:t,onClick:k,isCreating:h}):g?ie(_6,{onClick:w,onClose:w}):y?ie(la,{error:y,backFn:()=>S(null),onClick:()=>S(null)}):ie(S6,{passkeys:_,isSubmitting:c,isCreating:h,onReset:r,onClose:t,onSubmitEnrollment:()=>x(_.map(D=>D.credentialId)),onAddPasskey:k})},P6=({onReset:e,onClose:t,onClick:r,isCreating:o})=>gr(zd,{children:[ie(P,{backFn:e,onClose:t},"header"),ie(Ae,{children:gr(Kl,{children:[ie(un,{}),ie(mn,{})]})}),ie(se,{children:"Set up passkey verification"}),gr(rn,{children:[gr(Bt,{children:[ie(Ft,{children:ie(b6,{})}),"Verify with Touch ID, Face ID, PIN, or hardware key"]}),gr(Bt,{children:[ie(Ft,{children:ie(w6,{})}),"Takes seconds to set up and use"]}),gr(Bt,{children:[ie(Ft,{children:ie(C6,{})}),"Use your passkey to verify transactions and login to your account"]})]}),ie(N,{style:{marginTop:"2.25rem"},onClick:r,loading:o,children:"Add a new passkey"}),ie(V,{})]}),S6=({onReset:e,onClose:t,onAddPasskey:r,onSubmitEnrollment:o,passkeys:n,isSubmitting:i,isCreating:a})=>{let[l,s]=Ca(!1),c=l?n.length:n.length>3?2:3;return gr(zd,{children:[ie(P,{backFn:l?()=>s(!1):e,onClose:t},"header"),!l&&ie(Ae,{children:gr(Kl,{children:[ie(un,{}),ie(mn,{})]})}),ie(se,{children:"Enable your passkeys for verification"}),gr(rn,{children:[n.slice(0,c).map(u=>gr(x6,{children:[ie(A6,{children:R6(u)}),gr(k6,{children:["Last used: ",u.latestVerifiedAt?.toLocaleString()]})]},u.credentialId)),!l&&n.length>3&&ie(t1,{onClick:()=>s(!0),children:"View All"})]}),ie(N,{style:{marginTop:"1.5rem"},onClick:o,loading:i,children:"Enable passkeys"}),n.length<5&&ie(t1,{style:{marginTop:"0.5rem"},onClick:r,disabled:a,children:a?ie(nt,{style:{height:"1rem",width:"1rem",borderWidth:2}}):"Add new passkey"}),ie(V,{})]})},_6=({onClick:e,onClose:t})=>gr(zd,{children:[ie(P,{onClose:t},"header"),ie(Ae,{children:ie(He,{status:"success",children:ie(E6,{})})}),ie(se,{children:"Passkey verification added"}),ie(ce,{children:"From now on, you'll use the passkey whenever you use your Privy wallet."}),ie(gt,{children:ie(N,{onClick:e,children:"Done"})}),ie(V,{})]}),x6=jl.div`
1899
+ `;import jd from"@heroicons/react/20/solid/CheckIcon";import M6 from"@heroicons/react/24/outline/ChevronRightIcon";import W6 from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import L6 from"@heroicons/react/24/outline/FingerPrintIcon";import O6 from"@heroicons/react/24/outline/PhoneIcon";import Yd from"@heroicons/react/24/outline/TrashIcon";import N6 from"@heroicons/react/24/solid/ShieldCheckIcon";import{Fragment as D6,jsx as ve,jsxs as qt}from"react/jsx-runtime";var ug=({showIntro:e,userMfaMethods:t,appMfaMethods:r,userHasAuthSms:o,isTotpLoading:n,isPasskeyLoading:i,error:a,onClose:s,onBackToIntro:l,handleSelectMethod:c,setRemovingMfaMethod:u})=>{let f=t.reduce((g,v)=>({...g,[v]:!0}),{}),h=r.reduce((g,v)=>({...g,[v]:!0}),{});return qt(D6,{children:[ve(S,{backFn:e?l:void 0,onClose:s},"header"),ve(xe,{children:ve(Ge,{children:ve(N6,{})})}),ve(le,{children:"Choose a verification method"}),t.length>0?ve(de,{children:"To add or delete verification methods, verification is required."}):ve(de,{children:"How would you like to verify your identity? You can change this later."}),a&&ve(ll,{style:{marginTop:"1.25rem"},children:a.message}),qt(ol,{children:[(h.totp||f.totp)&&qt(nl,{children:[ve(Te,{style:{justifyContent:"center"},disabled:f.totp||n,onClick:()=>c("totp"),children:n?ve(at,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):qt(sl,{children:[qt(al,{children:[ve(W6,{}),"Authenticator App"]}),f.totp?qt(nn,{children:[ve(jd,{}),"Added"]}):ve(nn,{children:"Recommended"})]})}),f.totp&&ve(il,{onClick:()=>u("totp"),children:ve(Yd,{})})]},"totp"),(h.sms||f.sms)&&qt(nl,{children:[ve(Te,{disabled:f.sms||o,onClick:()=>c("sms"),children:qt(sl,{children:[qt(al,{children:[ve(O6,{}),"SMS"]}),f.sms&&qt(nn,{children:[ve(jd,{}),"Added"]}),o&&ve(nn,{children:"Disabled"})]})}),f.sms&&ve(il,{onClick:()=>u("sms"),children:ve(Yd,{})})]},"sms"),(h.passkey||f.passkey)&&qt(nl,{children:[ve(Te,{style:{justifyContent:"center"},onClick:()=>c("passkey"),disabled:f.passkey||i,children:i?ve(at,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):qt(sl,{children:[qt(al,{children:[ve(L6,{}),"Passkey"]}),f.passkey?qt(nn,{children:[ve(jd,{}),"Added"]}):ve(nn,{isAccent:!0,children:ve(M6,{})})]})}),f.passkey&&ve(il,{onClick:()=>u("passkey"),children:ve(Yd,{})})]},"passkey")]}),ve(z,{})]})};import U6 from"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import F6 from"@heroicons/react/24/outline/ClockIcon";import B6 from"@heroicons/react/24/outline/ShieldCheckIcon";import H6 from"@heroicons/react/24/solid/CheckCircleIcon";import{useMemo as G6,useState as _a}from"react";import ec from"styled-components";import{Fragment as Zd,jsx as ae,jsxs as gr}from"react/jsx-runtime";var fg=({onComplete:e,onClose:t,onReset:r})=>{let{user:o}=F(),{data:n}=x(),{initLinkWithPasskey:i,linkWithPasskey:a}=M(),{initEnrollmentWithPasskey:s,submitEnrollmentWithPasskey:l}=Wr(),[c,u]=_a(!1),[f,h]=_a(!1),[g,v]=_a(!1),[y,T]=_a(null),_=G6(()=>o?.linkedAccounts.filter(N=>N.type==="passkey")??[],[o]),b=()=>{n?.mfaEnrollmentFlow?.onSuccess(),e()},A=async N=>{u(!0);try{await s(),await l({credentialIds:N}),v(!0)}catch(R){T(R)}finally{u(!1)}},k=async()=>{h(!0),T(null);try{await i();let R=(await a())?.linkedAccounts.filter(I=>I.type==="passkey").map(I=>I.credentialId)??[];await A(R)}catch(N){T(N)}finally{h(!1)}};return _.length===0||f?ae(V6,{onReset:r,onClose:t,onClick:k,isCreating:f}):g?ae(q6,{onClick:b,onClose:b}):y?ae(fa,{error:y,backFn:()=>T(null),onClick:()=>T(null)}):ae(z6,{passkeys:_,isSubmitting:c,isCreating:f,onReset:r,onClose:t,onSubmitEnrollment:()=>A(_.map(N=>N.credentialId)),onAddPasskey:k})},V6=({onReset:e,onClose:t,onClick:r,isCreating:o})=>gr(Zd,{children:[ae(S,{backFn:e,onClose:t},"header"),ae(xe,{children:gr(Xl,{children:[ae(mn,{}),ae(fn,{})]})}),ae(le,{children:"Set up passkey verification"}),gr(on,{children:[gr(Gt,{children:[ae(Ht,{children:ae(B6,{})}),"Verify with Touch ID, Face ID, PIN, or hardware key"]}),gr(Gt,{children:[ae(Ht,{children:ae(F6,{})}),"Takes seconds to set up and use"]}),gr(Gt,{children:[ae(Ht,{children:ae(U6,{})}),"Use your passkey to verify transactions and login to your account"]})]}),ae(D,{style:{marginTop:"2.25rem"},onClick:r,loading:o,children:"Add a new passkey"}),ae(z,{})]}),z6=({onReset:e,onClose:t,onAddPasskey:r,onSubmitEnrollment:o,passkeys:n,isSubmitting:i,isCreating:a})=>{let[s,l]=_a(!1),c=s?n.length:n.length>3?2:3;return gr(Zd,{children:[ae(S,{backFn:s?()=>l(!1):e,onClose:t},"header"),!s&&ae(xe,{children:gr(Xl,{children:[ae(mn,{}),ae(fn,{})]})}),ae(le,{children:"Enable your passkeys for verification"}),gr(on,{children:[n.slice(0,c).map(u=>gr($6,{children:[ae(K6,{children:Y6(u)}),gr(j6,{children:["Last used: ",u.latestVerifiedAt?.toLocaleString()]})]},u.credentialId)),!s&&n.length>3&&ae(mg,{onClick:()=>l(!0),children:"View All"})]}),ae(D,{style:{marginTop:"1.5rem"},onClick:o,loading:i,children:"Enable passkeys"}),n.length<5&&ae(mg,{style:{marginTop:"0.5rem"},onClick:r,disabled:a,children:a?ae(at,{style:{height:"1rem",width:"1rem",borderWidth:2}}):"Add new passkey"}),ae(z,{})]})},q6=({onClick:e,onClose:t})=>gr(Zd,{children:[ae(S,{onClose:t},"header"),ae(xe,{children:ae(Ge,{status:"success",children:ae(H6,{})})}),ae(le,{children:"Passkey verification added"}),ae(de,{children:"From now on, you'll use the passkey whenever you use your Privy wallet."}),ae(gt,{children:ae(D,{onClick:e,children:"Done"})}),ae(z,{})]}),$6=ec.div`
1877
1900
  && {
1878
1901
  padding: 0.75rem 1rem;
1879
1902
  text-align: left;
@@ -1881,19 +1904,19 @@ You will need this password to access your ${e} wallet on a new device. Please k
1881
1904
  border: 1px solid var(--privy-color-foreground-4);
1882
1905
  width: 100%;
1883
1906
  }
1884
- `,A6=jl.div`
1907
+ `,K6=ec.div`
1885
1908
  font-size: 0.875rem;
1886
1909
  line-height: 1.375rem;
1887
1910
  font-weight: 500;
1888
1911
 
1889
1912
  color: var(--privy-color-foreground-1);
1890
- `,k6=jl.div`
1913
+ `,j6=ec.div`
1891
1914
  font-size: 0.75rem;
1892
1915
  font-weight: 400;
1893
1916
  line-height: 1.125rem;
1894
1917
 
1895
1918
  color: var(--privy-color-foreground-2);
1896
- `,R6=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",t1=jl.button`
1919
+ `,Y6=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",mg=ec.button`
1897
1920
  && {
1898
1921
  width: 100%;
1899
1922
  font-size: 0.875rem;
@@ -1918,7 +1941,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1918
1941
  box-shadow: none;
1919
1942
  }
1920
1943
  }
1921
- `;import F6 from"@heroicons/react/24/solid/CheckCircleIcon";import i1 from"@heroicons/react/24/solid/PhoneIcon";import{useState as Yl}from"react";import{useState as qd}from"react";import{isMobile as I6}from"react-device-detect";import n1 from"styled-components";import{Fragment as U6,jsx as wa,jsxs as D6}from"react/jsx-runtime";var ba=6,M6=new Array(ba).fill("");function W6(e){return e.replace(/\s+/g,"")}function $d(e){return/^[0-9]{1}$/.test(e)}function o1(e){return e.length===ba&&e.every($d)}function L6(e,t){return e.reduce((r,o)=>r+Number(t(o)),0)}var fn=({onChange:e,disabled:t,errorReasonOverride:r,success:o})=>{let[n,i]=qd(M6),[a,l]=qd(null),[s,c]=qd(null),u=async v=>{v.preventDefault();let y=W6(v.currentTarget.value);if(y==="")return;let S=L6(n,$d),_=y.split(""),w=!_.every($d),x=_.length+S>ba;if(w){l("Passcode can only be numbers"),c(1);return}if(x){l("Passcode must be exactly 6 numbers"),c(1);return}l(null),c(null);let k=Number(v.currentTarget.name?.charAt(4)),D=[...y||[""]].slice(0,ba-k),I=[...n.slice(0,k),...D,...n.slice(k+D.length)];i(I);let R=D.length,H=Math.min(Math.max(k+R,0),ba-1);if(document.querySelector(`input[name=pin-${H}]`)?.focus(),o1(I))try{await e(I.join("")),document.querySelector(`input[name=pin-${H}]`)?.blur()}catch(Y){c(1),l(Y.message)}else try{await e(null)}catch(Y){c(1),l(Y.message)}},h=v=>{s===1&&(l(null),c(null));let y=[...n.slice(0,v),"",...n.slice(v+1)];i(y),v>0&&document.querySelector(`input[name=pin-${v-1}]`)?.focus(),o1(y)?e(y.join("")):e(null)},g=o?"success":!!(r||a)?"fail":"";return wa(U6,{children:D6(O6,{children:[wa("div",{children:n.map((v,y)=>wa("input",{name:`pin-${y}`,type:"text",value:n[y],onChange:u,onKeyUp:S=>{S.key==="Backspace"&&h(y)},inputMode:"numeric",autoFocus:y===0,pattern:"[0-9]",className:g,autoComplete:I6?"one-time-code":"off",disabled:t},y))}),wa("div",{children:wa(N6,{fail:!!r||!!a,children:r||a})})]})})},O6=n1.div`
1944
+ `;import n7 from"@heroicons/react/24/solid/CheckCircleIcon";import gg from"@heroicons/react/24/solid/PhoneIcon";import{useState as tc}from"react";import{useState as Jd}from"react";import{isMobile as Z6}from"react-device-detect";import yg from"styled-components";import{Fragment as o7,jsx as Sa,jsxs as r7}from"react/jsx-runtime";var Aa=6,J6=new Array(Aa).fill("");function Q6(e){return e.replace(/\s+/g,"")}function Qd(e){return/^[0-9]{1}$/.test(e)}function hg(e){return e.length===Aa&&e.every(Qd)}function X6(e,t){return e.reduce((r,o)=>r+Number(t(o)),0)}var hn=({onChange:e,disabled:t,errorReasonOverride:r,success:o})=>{let[n,i]=Jd(J6),[a,s]=Jd(null),[l,c]=Jd(null),u=async v=>{v.preventDefault();let y=Q6(v.currentTarget.value);if(y==="")return;let T=X6(n,Qd),_=y.split(""),b=!_.every(Qd),A=_.length+T>Aa;if(b){s("Passcode can only be numbers"),c(1);return}if(A){s("Passcode must be exactly 6 numbers"),c(1);return}s(null),c(null);let k=Number(v.currentTarget.name?.charAt(4)),N=[...y||[""]].slice(0,Aa-k),R=[...n.slice(0,k),...N,...n.slice(k+N.length)];i(R);let I=N.length,H=Math.min(Math.max(k+I,0),Aa-1);if(document.querySelector(`input[name=pin-${H}]`)?.focus(),hg(R))try{await e(R.join("")),document.querySelector(`input[name=pin-${H}]`)?.blur()}catch(Z){c(1),s(Z.message)}else try{await e(null)}catch(Z){c(1),s(Z.message)}},f=v=>{l===1&&(s(null),c(null));let y=[...n.slice(0,v),"",...n.slice(v+1)];i(y),v>0&&document.querySelector(`input[name=pin-${v-1}]`)?.focus(),hg(y)?e(y.join("")):e(null)},g=o?"success":!!(r||a)?"fail":"";return Sa(o7,{children:r7(e7,{children:[Sa("div",{children:n.map((v,y)=>Sa("input",{name:`pin-${y}`,type:"text",value:n[y],onChange:u,onKeyUp:T=>{T.key==="Backspace"&&f(y)},inputMode:"numeric",autoFocus:y===0,pattern:"[0-9]",className:g,autoComplete:Z6?"one-time-code":"off",disabled:t},y))}),Sa("div",{children:Sa(t7,{fail:!!r||!!a,children:r||a})})]})})},e7=yg.div`
1922
1945
  display: flex;
1923
1946
  flex-direction: column;
1924
1947
  width: 100%;
@@ -1986,7 +2009,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1986
2009
  transform: translate(1px, 0px);
1987
2010
  }
1988
2011
  }
1989
- `,N6=n1.div`
2012
+ `,t7=yg.div`
1990
2013
  line-height: 20px;
1991
2014
  font-size: 13px;
1992
2015
  display: flex;
@@ -1994,7 +2017,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1994
2017
  width: 100%;
1995
2018
 
1996
2019
  color: ${e=>e.fail?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
1997
- `;import{Fragment as Kd,jsx as We,jsxs as hn}from"react/jsx-runtime";var a1=({onComplete:e,onReset:t,onClose:r})=>{let[o,n]=Yl(""),[i,a]=Yl(!1),[l,s]=Yl(null),[c,u]=Yl("enroll"),{initEnrollmentWithSms:h,submitEnrollmentWithSms:f}=Mr(),{app:g,data:v}=A();function y(){v?.mfaEnrollmentFlow?.onSuccess(),e()}async function S({qualifiedPhoneNumber:x}){try{await h({phoneNumber:x}),n(x),u("verify")}catch(k){s(k)}}async function _(x){try{if(!x)return;await f({phoneNumber:o,mfaCode:x}),a(!0)}catch(k){throw pl(k)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):ln(k)?new Error("The code you entered is not valid"):sn(k)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):ul(k)?new Error("Verification canceled"):new Error("Unknown error")}}function w(){c==="verify"?u("enroll"):t()}return l?We(la,{error:l,backFn:()=>s(null),onClick:()=>s(null)}):c==="enroll"?hn(Kd,{children:[We(P,{backFn:t,onClose:r},"header"),We(Ae,{children:We(He,{children:We(i1,{})})}),We(se,{children:"Set up SMS verification"}),We(ce,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),hn(pr,{children:[We(ci,{onSubmit:S}),hn(nf,{children:["By providing your mobile number, you agree to receive text messages from ",g?.name,". Some carrier charges may apply"]})]}),We(V,{})]}):i?hn(Kd,{children:[We(P,{onClose:y},"header"),We(Ae,{children:We(He,{status:"success",children:We(F6,{})})}),We(se,{children:"SMS verification added"}),We(ce,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),We(gt,{children:We(N,{onClick:y,children:"Done"})}),We(V,{})]}):hn(Kd,{children:[We(P,{backFn:w,onClose:r},"header"),We(Ae,{children:We(He,{children:We(i1,{})})}),We(se,{children:"Enter enrollment code"}),hn(pr,{children:[We(fn,{onChange:_}),hn(ce,{children:["To continue, enter the 6-digit code sent to ",We("strong",{children:wy(o)})]})]}),We(V,{})]})};import G6 from"@heroicons/react/24/solid/CheckCircleIcon";import V6 from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import{useState as l1}from"react";import B6 from"@heroicons/react/24/solid/ShieldCheckIcon";import{jsx as H6}from"react/jsx-runtime";var s1=({size:e,authUrl:t})=>H6(li,{url:t,squareLogoElement:B6,size:e,fgColor:"#1F1F1F"});import{Fragment as jd,jsx as Re,jsxs as Ea}from"react/jsx-runtime";var c1=({onComplete:e,onClose:t,onReset:r,totpInfo:o})=>{let[n,i]=l1("enroll"),[a,l]=l1(!1),{submitEnrollmentWithTotp:s}=Mr(),{data:c}=A();function u(){c?.mfaEnrollmentFlow?.onSuccess(),e()}function h(){i("verify")}async function f(v){try{if(!v)return;await s({mfaCode:v}),l(!0)}catch(y){throw pl(y)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):ln(y)?new Error("The code you entered is not valid"):sn(y)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):ul(y)?new Error("Verification canceled"):new Error("Unknown error")}}function g(){n==="verify"?i("enroll"):r()}return n==="enroll"?Ea(jd,{children:[Re(P,{backFn:r,onClose:t},"header"),Re(se,{children:"Scan QR code"}),Re(ce,{children:"Open your authenticator app and scan the QR code to continue."}),Re(Vn,{children:Re(s1,{authUrl:o.authUrl,size:200})}),Ea(gt,{children:[Re(_t,{children:Re(Ao,{itemName:"secret",text:o.secret})}),Re(N,{onClick:h,children:"Continue"})]}),Re(V,{})]}):a?Ea(jd,{children:[Re(P,{onClose:u},"header"),Re(Ae,{children:Re(He,{status:"success",children:Re(G6,{})})}),Re(se,{children:"Authenticator app verification added"}),Re(ce,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),Re(gt,{children:Re(N,{onClick:u,children:"Done"})}),Re(V,{})]}):Ea(jd,{children:[Re(P,{backFn:g,onClose:t},"header"),Re(Ae,{children:Re(He,{children:Re(V6,{})})}),Re(se,{children:"Enter enrollment code"}),Re(pr,{children:Re(fn,{onChange:f})}),Ea(ce,{children:["To continue, enter the 6-digit code generated from your ",Re("strong",{children:"authenticator app"})]}),Re(V,{})]})};import{Fragment as ui,jsx as $,jsxs as rr}from"react/jsx-runtime";var p1=()=>{let{user:e,enrollInMfa:t}=B(),[r,o]=pi(null),{unenrollWithSms:n,unenrollWithTotp:i,unenrollWithPasskey:a}=Mr(),{app:l,ready:s,data:c,onUserCloseViaDialogOrKeybindRef:u}=A(),{closePrivyModal:h}=M(),{promptMfa:f}=va(),{initEnrollmentWithTotp:g}=Mr(),[v,y]=pi(!1),[S,_]=pi(null),[w,x]=pi(null),k=()=>{h({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{o(null),_(null)},500)},{initEnrollmentWithPasskey:D,submitEnrollmentWithPasskey:I}=Mr(),[R,H]=pi(!1),[K,Y]=pi(null);u.current=k;let W=e?.mfaMethods.includes("sms"),G=!!e?.phone,L=e?.mfaMethods.includes("totp"),ae=e?.mfaMethods.includes("passkey"),pe=W||L||ae,ue=e?.linkedAccounts.filter(Ke=>Ke.type==="passkey").map(Ke=>Ke.credentialId)??[];Y6(()=>{pe&&y(!0)},[pe]);function be(){o(null),_(null)}function X(){y(!1)}async function Pt(){H(!0);try{await D(),await I({credentialIds:ue})}catch(Ke){Y(Ke)}finally{H(!1)}}async function et(Ke){if(await f().catch(Y),Ke==="totp"){_(Ke),x(null),g().then(sr=>{x(sr)}).catch(()=>{x(null),be()});return}if(Ke==="passkey"&&ue.length===1)return await Pt();_(Ke)}if(!s||!e||!l)return rr(ui,{children:[$(P,{onClose:k},"header"),$(Ae,{children:$(Xy,{})}),$(pr,{children:$(nt,{})}),$(V,{})]});async function Mt(){o(null);try{await n()}catch{o(null)}}async function rt(){o(null);try{await i()}catch{o(null)}}async function ar(){o(null);try{await f(),await a()}catch{o(null)}}if(r==="sms")return rr(ui,{children:[$(P,{backFn:be,onClose:k},"header"),$(Ae,{children:$(He,{children:$(K6,{})})}),$(se,{children:"Remove SMS verification?"}),rr(ce,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),$(gt,{children:$(N,{warn:!0,onClick:Mt,children:"Remove SMS for MFA"})}),$(V,{})]});if(r==="totp")return rr(ui,{children:[$(P,{backFn:be,onClose:k},"header"),$(Ae,{children:$(He,{children:$(q6,{})})}),$(se,{children:"Remove Authenticator App verification?"}),rr(ce,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),$(gt,{children:$(N,{warn:!0,onClick:rt,children:"Remove Authenticator App for MFA"})}),$(V,{})]});if(r==="passkey")return rr(ui,{children:[$(P,{backFn:be,onClose:k},"header"),$(Ae,{children:$(He,{children:$(j6,{})})}),$(se,{children:"Are you sure you want to remove passkey verification?"}),$(ce,{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."}),$(gt,{children:$(N,{warn:!0,onClick:ar,children:"Yes, remove"})}),$(V,{})]});if(c.mfaEnrollmentFlow.mfaMethods.length===0&&!pe)return rr(ui,{children:[$(P,{onClose:k},"header"),$(Ae,{children:$(He,{children:$(d1,{})})}),$(se,{children:"Add more security"}),rr(ce,{children:[l?.name," does not have any verification methods enabled."]}),$(gt,{children:$(N,{onClick:k,children:"Close"})}),$(V,{})]});let Ie=!pe&&!v;return Ie?rr(ui,{children:[$(P,{onClose:k},"header"),$(Ae,{children:$(He,{children:$(d1,{})})}),$(se,{children:"Transaction Protection"}),$(ce,{children:"Set up transaction protection to add an extra layer of security to your account"}),rr(rn,{children:[rr(Bt,{children:[$(Ft,{children:$(z6,{})}),"Enable 2-Step verification for your ",l?.name," wallet."]}),rr(Bt,{children:[$(Ft,{children:$($6,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),rr(gt,{children:[$(N,{onClick:()=>y(!0),children:"Continue"}),$(Tr,{onClick:k,children:"Not now"})]}),$(V,{})]}):S==="sms"?$(a1,{onComplete:k,onReset:be,onClose:k}):S==="totp"&&w?$(c1,{onComplete:k,onClose:k,onReset:be,totpInfo:w}):S==="passkey"?$(r1,{onComplete:k,onReset:be,onClose:k}):$(e1,{showIntro:Ie,userMfaMethods:e.mfaMethods,appMfaMethods:l.mfa.methods,userHasAuthSms:G,onBackToIntro:X,handleSelectMethod:et,isTotpLoading:S==="totp"&&!w,isPasskeyLoading:R,error:K,onClose:k,setRemovingMfaMethod:o})};import Z7 from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import J7 from"@heroicons/react/24/outline/FingerPrintIcon";import Q7 from"@heroicons/react/24/outline/PhoneIcon";import X7 from"@heroicons/react/24/outline/ShieldCheckIcon";import eb from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import tb from"@heroicons/react/24/solid/PhoneIcon";import{useEffect as rb,useState as Ia}from"react";import{useMemo as V7,useEffect as z7,useState as Q1}from"react";import q7 from"styled-components";import W1 from"styled-components";import m1 from"styled-components";import{jsx as u1,jsxs as Q6}from"react/jsx-runtime";var Zl=({label:e,children:t,valueStyles:r})=>Q6(Z6,{children:[u1("div",{children:e}),u1(J6,{style:{...r},children:t})]}),Z6=m1.div`
2020
+ `;import{Fragment as Xd,jsx as We,jsxs as yn}from"react/jsx-runtime";var vg=({onComplete:e,onReset:t,onClose:r})=>{let[o,n]=tc(""),[i,a]=tc(!1),[s,l]=tc(null),[c,u]=tc("enroll"),{initEnrollmentWithSms:f,submitEnrollmentWithSms:h}=Wr(),{app:g,data:v}=x();function y(){v?.mfaEnrollmentFlow?.onSuccess(),e()}async function T({qualifiedPhoneNumber:A}){try{await f({phoneNumber:A}),n(A),u("verify")}catch(k){l(k)}}async function _(A){try{if(!A)return;await h({phoneNumber:o,mfaCode:A}),a(!0)}catch(k){throw gl(k)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):cn(k)?new Error("The code you entered is not valid"):ln(k)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):vl(k)?new Error("Verification canceled"):new Error("Unknown error")}}function b(){c==="verify"?u("enroll"):t()}return s?We(fa,{error:s,backFn:()=>l(null),onClick:()=>l(null)}):c==="enroll"?yn(Xd,{children:[We(S,{backFn:t,onClose:r},"header"),We(xe,{children:We(Ge,{children:We(gg,{})})}),We(le,{children:"Set up SMS verification"}),We(de,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),yn(pr,{children:[We(mi,{onSubmit:T}),yn(uf,{children:["By providing your mobile number, you agree to receive text messages from ",g?.name,". Some carrier charges may apply"]})]}),We(z,{})]}):i?yn(Xd,{children:[We(S,{onClose:y},"header"),We(xe,{children:We(Ge,{status:"success",children:We(n7,{})})}),We(le,{children:"SMS verification added"}),We(de,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),We(gt,{children:We(D,{onClick:y,children:"Done"})}),We(z,{})]}):yn(Xd,{children:[We(S,{backFn:b,onClose:r},"header"),We(xe,{children:We(Ge,{children:We(gg,{})})}),We(le,{children:"Enter enrollment code"}),yn(pr,{children:[We(hn,{onChange:_}),yn(de,{children:["To continue, enter the 6-digit code sent to ",We("strong",{children:My(o)})]})]}),We(z,{})]})};import s7 from"@heroicons/react/24/solid/CheckCircleIcon";import l7 from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import{useState as wg}from"react";import i7 from"@heroicons/react/24/solid/ShieldCheckIcon";import{jsx as a7}from"react/jsx-runtime";var Cg=({size:e,authUrl:t})=>a7(ui,{url:t,squareLogoElement:i7,size:e,fgColor:"#1F1F1F"});import{Fragment as ep,jsx as Re,jsxs as xa}from"react/jsx-runtime";var bg=({onComplete:e,onClose:t,onReset:r,totpInfo:o})=>{let[n,i]=wg("enroll"),[a,s]=wg(!1),{submitEnrollmentWithTotp:l}=Wr(),{data:c}=x();function u(){c?.mfaEnrollmentFlow?.onSuccess(),e()}function f(){i("verify")}async function h(v){try{if(!v)return;await l({mfaCode:v}),s(!0)}catch(y){throw gl(y)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):cn(y)?new Error("The code you entered is not valid"):ln(y)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):vl(y)?new Error("Verification canceled"):new Error("Unknown error")}}function g(){n==="verify"?i("enroll"):r()}return n==="enroll"?xa(ep,{children:[Re(S,{backFn:r,onClose:t},"header"),Re(le,{children:"Scan QR code"}),Re(de,{children:"Open your authenticator app and scan the QR code to continue."}),Re(Kn,{children:Re(Cg,{authUrl:o.authUrl,size:200})}),xa(gt,{children:[Re(St,{children:Re(xo,{itemName:"secret",text:o.secret})}),Re(D,{onClick:f,children:"Continue"})]}),Re(z,{})]}):a?xa(ep,{children:[Re(S,{onClose:u},"header"),Re(xe,{children:Re(Ge,{status:"success",children:Re(s7,{})})}),Re(le,{children:"Authenticator app verification added"}),Re(de,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),Re(gt,{children:Re(D,{onClick:u,children:"Done"})}),Re(z,{})]}):xa(ep,{children:[Re(S,{backFn:g,onClose:t},"header"),Re(xe,{children:Re(Ge,{children:Re(l7,{})})}),Re(le,{children:"Enter enrollment code"}),Re(pr,{children:Re(hn,{onChange:h})}),xa(de,{children:["To continue, enter the 6-digit code generated from your ",Re("strong",{children:"authenticator app"})]}),Re(z,{})]})};import{Fragment as yi,jsx as K,jsxs as or}from"react/jsx-runtime";var Tg=()=>{let{user:e,enrollInMfa:t}=F(),[r,o]=hi(null),{unenrollWithSms:n,unenrollWithTotp:i,unenrollWithPasskey:a}=Wr(),{app:s,ready:l,data:c,onUserCloseViaDialogOrKeybindRef:u}=x(),{closePrivyModal:f}=M(),{promptMfa:h}=Pa(),{initEnrollmentWithTotp:g}=Wr(),[v,y]=hi(!1),[T,_]=hi(null),[b,A]=hi(null),k=()=>{f({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{o(null),_(null)},500)},{initEnrollmentWithPasskey:N,submitEnrollmentWithPasskey:R}=Wr(),[I,H]=hi(!1),[G,Z]=hi(null);u.current=k;let W=e?.mfaMethods.includes("sms"),q=!!e?.phone,L=e?.mfaMethods.includes("totp"),se=e?.mfaMethods.includes("passkey"),ue=W||L||se,me=e?.linkedAccounts.filter(je=>je.type==="passkey").map(je=>je.credentialId)??[];f7(()=>{ue&&y(!0)},[ue]);function be(){o(null),_(null)}function X(){y(!1)}async function Pt(){H(!0);try{await N(),await R({credentialIds:me})}catch(je){Z(je)}finally{H(!1)}}async function rt(je){if(await h().catch(Z),je==="totp"){_(je),A(null),g().then(lr=>{A(lr)}).catch(()=>{A(null),be()});return}if(je==="passkey"&&me.length===1)return await Pt();_(je)}if(!l||!e||!s)return or(yi,{children:[K(S,{onClose:k},"header"),K(xe,{children:K(pg,{})}),K(pr,{children:K(at,{})}),K(z,{})]});async function Mt(){o(null);try{await n()}catch{o(null)}}async function nt(){o(null);try{await i()}catch{o(null)}}async function sr(){o(null);try{await h(),await a()}catch{o(null)}}if(r==="sms")return or(yi,{children:[K(S,{backFn:be,onClose:k},"header"),K(xe,{children:K(Ge,{children:K(u7,{})})}),K(le,{children:"Remove SMS verification?"}),or(de,{children:["MFA adds an extra layer of security to your ",s?.name," account. Make sure you have other methods to secure your account."]}),K(gt,{children:K(D,{warn:!0,onClick:Mt,children:"Remove SMS for MFA"})}),K(z,{})]});if(r==="totp")return or(yi,{children:[K(S,{backFn:be,onClose:k},"header"),K(xe,{children:K(Ge,{children:K(d7,{})})}),K(le,{children:"Remove Authenticator App verification?"}),or(de,{children:["MFA adds an extra layer of security to your ",s?.name," account. Make sure you have other methods to secure your account."]}),K(gt,{children:K(D,{warn:!0,onClick:nt,children:"Remove Authenticator App for MFA"})}),K(z,{})]});if(r==="passkey")return or(yi,{children:[K(S,{backFn:be,onClose:k},"header"),K(xe,{children:K(Ge,{children:K(m7,{})})}),K(le,{children:"Are you sure you want to remove passkey verification?"}),K(de,{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."}),K(gt,{children:K(D,{warn:!0,onClick:sr,children:"Yes, remove"})}),K(z,{})]});if(c.mfaEnrollmentFlow.mfaMethods.length===0&&!ue)return or(yi,{children:[K(S,{onClose:k},"header"),K(xe,{children:K(Ge,{children:K(Eg,{})})}),K(le,{children:"Add more security"}),or(de,{children:[s?.name," does not have any verification methods enabled."]}),K(gt,{children:K(D,{onClick:k,children:"Close"})}),K(z,{})]});let Ie=!ue&&!v;return Ie?or(yi,{children:[K(S,{onClose:k},"header"),K(xe,{children:K(Ge,{children:K(Eg,{})})}),K(le,{children:"Transaction Protection"}),K(de,{children:"Set up transaction protection to add an extra layer of security to your account"}),or(on,{children:[or(Gt,{children:[K(Ht,{children:K(c7,{})}),"Enable 2-Step verification for your ",s?.name," wallet."]}),or(Gt,{children:[K(Ht,{children:K(p7,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),or(gt,{children:[K(D,{onClick:()=>y(!0),children:"Continue"}),K(Pr,{onClick:k,children:"Not now"})]}),K(z,{})]}):T==="sms"?K(vg,{onComplete:k,onReset:be,onClose:k}):T==="totp"&&b?K(bg,{onComplete:k,onClose:k,onReset:be,totpInfo:b}):T==="passkey"?K(fg,{onComplete:k,onReset:be,onClose:k}):K(ug,{showIntro:Ie,userMfaMethods:e.mfaMethods,appMfaMethods:s.mfa.methods,userHasAuthSms:q,onBackToIntro:X,handleSelectMethod:rt,isTotpLoading:T==="totp"&&!b,isPasskeyLoading:I,error:G,onClose:k,setRemovingMfaMethod:o})};import hb from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import yb from"@heroicons/react/24/outline/FingerPrintIcon";import gb from"@heroicons/react/24/outline/PhoneIcon";import vb from"@heroicons/react/24/outline/ShieldCheckIcon";import Cb from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import wb from"@heroicons/react/24/solid/PhoneIcon";import{useEffect as bb,useState as Da}from"react";import{useMemo as lb,useEffect as cb,useState as d1}from"react";import db from"styled-components";import qg from"styled-components";import _g from"styled-components";import{jsx as Pg,jsxs as g7}from"react/jsx-runtime";var rc=({label:e,children:t,valueStyles:r})=>g7(h7,{children:[Pg("div",{children:e}),Pg(y7,{style:{...r},children:t})]}),h7=_g.div`
1998
2021
  display: flex;
1999
2022
  align-items: center;
2000
2023
  justify-content: space-between;
@@ -2009,7 +2032,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2009
2032
  color: var(--privy-color-foreground-2);
2010
2033
  text-align: right;
2011
2034
  }
2012
- `,J6=m1.div`
2035
+ `,y7=_g.div`
2013
2036
  font-size: 14px;
2014
2037
  line-height: 100%;
2015
2038
  display: flex;
@@ -2018,28 +2041,28 @@ You will need this password to access your ${e} wallet on a new device. Please k
2018
2041
  border-radius: var(--privy-border-radius-full);
2019
2042
  background-color: var(--privy-color-background-2);
2020
2043
  padding: 4px 8px;
2021
- `;import Ql from"styled-components";import{BigNumber as f1}from"@ethersproject/bignumber";import{formatEther as h1}from"@ethersproject/units";var Ta=(e,t)=>{let r=(t*parseFloat(h1(e))).toFixed(2);return r!=="0.00"?`$${r}`:"<$0.01"},Zr=(e,t,r=6,o=!1)=>{let i=parseFloat(h1(e)).toFixed(r).replace(/0+$/,"").replace(/\.$/,"");return o?`${i} ${t}`:`${i==="0"?"<0.001":i} ${t}`},Yd=e=>e.map(bt).reduce((t,r)=>t.add(r),f1.from(0)).toHexString(),y1=(e,t)=>{let{chains:r}=M(),o=`https://etherscan.io/address/${t}`,n=`${_u(e,r)}/address/${t}`;if(!n)return o;try{new URL(n)}catch{return o}return n},bt=e=>f1.from(e);import{Fragment as r7,jsx as Jl,jsxs as g1}from"react/jsx-runtime";var v1=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=Yd(e),n=t?Ta(o,t):void 0,i=Zr(o,r);return Jl(C1,{children:n||i})},Zd=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=Yd(e),n=t?Ta(o,t):void 0,i=Zr(o,r);return Jl(C1,{children:n?g1(r7,{children:[Jl(X6,{children:"USD"}),n==="<$0.01"?g1(t7,{children:[Jl(e7,{children:"<"}),"$0.01"]}):n]}):i})},C1=Ql.span`
2044
+ `;import nc from"styled-components";import{BigNumber as Sg}from"@ethersproject/bignumber";import{formatEther as Ag}from"@ethersproject/units";var ka=(e,t)=>{let r=(t*parseFloat(Ag(e))).toFixed(2);return r!=="0.00"?`$${r}`:"<$0.01"},Jr=(e,t,r=6,o=!1)=>{let i=parseFloat(Ag(e)).toFixed(r).replace(/0+$/,"").replace(/\.$/,"");return o?`${i} ${t}`:`${i==="0"?"<0.001":i} ${t}`},tp=e=>e.map(bt).reduce((t,r)=>t.add(r),Sg.from(0)).toHexString(),xg=(e,t)=>{let{chains:r}=M(),o=`https://etherscan.io/address/${t}`,n=`${Iu(e,r)}/address/${t}`;if(!n)return o;try{new URL(n)}catch{return o}return n},bt=e=>Sg.from(e);import{Fragment as b7,jsx as oc,jsxs as kg}from"react/jsx-runtime";var Rg=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=tp(e),n=t?ka(o,t):void 0,i=Jr(o,r);return oc(Ig,{children:n||i})},rp=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=tp(e),n=t?ka(o,t):void 0,i=Jr(o,r);return oc(Ig,{children:n?kg(b7,{children:[oc(v7,{children:"USD"}),n==="<$0.01"?kg(w7,{children:[oc(C7,{children:"<"}),"$0.01"]}):n]}):i})},Ig=nc.span`
2022
2045
  font-size: 14px;
2023
2046
  line-height: 140%;
2024
2047
  display: flex;
2025
2048
  gap: 4px;
2026
2049
  align-items: center;
2027
- `,X6=Ql.span`
2050
+ `,v7=nc.span`
2028
2051
  font-size: 12px;
2029
2052
  line-height: 12px;
2030
2053
  color: var(--privy-color-foreground-3);
2031
- `,e7=Ql.span`
2054
+ `,C7=nc.span`
2032
2055
  font-size: 10px;
2033
- `,t7=Ql.span`
2056
+ `,w7=nc.span`
2034
2057
  display: flex;
2035
2058
  align-items: center;
2036
- `;import Jd from"styled-components";import{jsx as Lo,jsxs as Xl}from"react/jsx-runtime";var w1=({gas:e,tokenPrice:t,tokenSymbol:r})=>Xl(od,{style:{paddingBottom:"12px"},children:[Xl(E1,{children:[Lo(P1,{children:"Est. Fees"}),Lo("div",{children:Lo(Zd,{weiQuantities:[e],tokenPrice:t,tokenSymbol:r})})]}),t&&Lo(T1,{children:`${Zr(e,r)}`})]}),b1=({transactionData:e,gas:t,tokenPrice:r,tokenSymbol:o})=>{let n=bt(e.value||0).add(bt(t)).toHexString();return Xl(od,{children:[Xl(E1,{children:[Lo(P1,{children:"Total (including fees)"}),Lo("div",{children:Lo(Zd,{weiQuantities:[e.value||0,t],tokenPrice:r,tokenSymbol:o})})]}),r&&Lo(T1,{children:Zr(n,o)})]})},E1=Jd.div`
2059
+ `;import op from"styled-components";import{jsx as Lo,jsxs as ic}from"react/jsx-runtime";var Mg=({gas:e,tokenPrice:t,tokenSymbol:r})=>ic(cd,{style:{paddingBottom:"12px"},children:[ic(Lg,{children:[Lo(Ng,{children:"Est. Fees"}),Lo("div",{children:Lo(rp,{weiQuantities:[e],tokenPrice:t,tokenSymbol:r})})]}),t&&Lo(Og,{children:`${Jr(e,r)}`})]}),Wg=({transactionData:e,gas:t,tokenPrice:r,tokenSymbol:o})=>{let n=bt(e.value||0).add(bt(t)).toHexString();return ic(cd,{children:[ic(Lg,{children:[Lo(Ng,{children:"Total (including fees)"}),Lo("div",{children:Lo(rp,{weiQuantities:[e.value||0,t],tokenPrice:r,tokenSymbol:o})})]}),r&&Lo(Og,{children:Jr(n,o)})]})},Lg=op.div`
2037
2060
  display: flex;
2038
2061
  flex-direction: row;
2039
2062
  justify-content: space-between;
2040
2063
  align-items: center;
2041
2064
  padding-top: 4px;
2042
- `,T1=Jd.div`
2065
+ `,Og=op.div`
2043
2066
  display: flex;
2044
2067
  flex-direction: row;
2045
2068
  height: 12px;
@@ -2048,23 +2071,23 @@ You will need this password to access your ${e} wallet on a new device. Please k
2048
2071
  line-height: 12px;
2049
2072
  color: var(--privy-color-foreground-3);
2050
2073
  font-weight: 400;
2051
- `,P1=Jd.div`
2074
+ `,Ng=op.div`
2052
2075
  font-size: 14px;
2053
2076
  line-height: 22.4px;
2054
2077
  font-weight: 400;
2055
- `;import o7 from"@heroicons/react/24/outline/ChevronDownIcon";import{useContext as yn,useState as n7}from"react";import Oo from"styled-components";import{createContext as S1,useContext as Az}from"react";var mi=S1(void 0);var Pa=S1(void 0);import{Fragment as u7,jsx as Wr,jsxs as _1}from"react/jsx-runtime";var x1=({defaultValue:e,children:t})=>{let[r,o]=n7(e||null),n=i=>{o(r===i?null:i)};return Wr(mi.Provider,{value:{activePanel:r,togglePanel:n},children:Wr(i7,{children:t})})},A1=({value:e,children:t})=>{let{activePanel:r,togglePanel:o}=yn(mi),n=r===e;return Wr(Pa.Provider,{value:{onToggle:()=>o(e),value:e},children:Wr(c7,{isActive:n,"data-open":n,children:t})})},k1=({children:e})=>{let{activePanel:t}=yn(mi),{onToggle:r,value:o}=yn(Pa),n=t===o;return _1(u7,{children:[_1(a7,{onClick:r,"data-open":n,children:[Wr(l7,{children:e}),Wr(p7,{isactive:n,children:Wr(o7,{height:"16px",width:"16px",strokeWidth:"2"})})]}),Wr(s7,{})]})},R1=({children:e})=>{let{activePanel:t}=yn(mi),{value:r}=yn(Pa);return Wr(d7,{"data-open":t===r,children:Wr(M1,{children:e})})},I1=({children:e})=>{let{activePanel:t}=yn(mi),{value:r}=yn(Pa);return Wr(M1,{children:typeof e=="function"?e({isActive:t===r}):e})},i7=Oo.div`
2078
+ `;import E7 from"@heroicons/react/24/outline/ChevronDownIcon";import{useContext as gn,useState as T7}from"react";import Oo from"styled-components";import{createContext as Dg,useContext as dq}from"react";var gi=Dg(void 0);var Ra=Dg(void 0);import{Fragment as I7,jsx as Lr,jsxs as Ug}from"react/jsx-runtime";var Fg=({defaultValue:e,children:t})=>{let[r,o]=T7(e||null),n=i=>{o(r===i?null:i)};return Lr(gi.Provider,{value:{activePanel:r,togglePanel:n},children:Lr(P7,{children:t})})},Bg=({value:e,children:t})=>{let{activePanel:r,togglePanel:o}=gn(gi),n=r===e;return Lr(Ra.Provider,{value:{onToggle:()=>o(e),value:e},children:Lr(x7,{isActive:n,"data-open":n,children:t})})},Hg=({children:e})=>{let{activePanel:t}=gn(gi),{onToggle:r,value:o}=gn(Ra),n=t===o;return Ug(I7,{children:[Ug(_7,{onClick:r,"data-open":n,children:[Lr(A7,{children:e}),Lr(R7,{isactive:n,children:Lr(E7,{height:"16px",width:"16px",strokeWidth:"2"})})]}),Lr(S7,{})]})},Gg=({children:e})=>{let{activePanel:t}=gn(gi),{value:r}=gn(Ra);return Lr(k7,{"data-open":t===r,children:Lr(zg,{children:e})})},Vg=({children:e})=>{let{activePanel:t}=gn(gi),{value:r}=gn(Ra);return Lr(zg,{children:typeof e=="function"?e({isActive:t===r}):e})},P7=Oo.div`
2056
2079
  display: flex;
2057
2080
  flex-direction: column;
2058
2081
  width: 100%;
2059
2082
  gap: 8px;
2060
- `,a7=Oo.div`
2083
+ `,_7=Oo.div`
2061
2084
  display: flex;
2062
2085
  justify-content: space-between;
2063
2086
  align-items: center;
2064
2087
  width: 100%;
2065
2088
  cursor: pointer;
2066
2089
  padding-bottom: 8px;
2067
- `,s7=Oo.div`
2090
+ `,S7=Oo.div`
2068
2091
  width: 100%;
2069
2092
 
2070
2093
  && {
@@ -2072,13 +2095,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
2072
2095
  border-color: var(--privy-color-foreground-4);
2073
2096
  }
2074
2097
  padding-bottom: 12px;
2075
- `,l7=Oo.div`
2098
+ `,A7=Oo.div`
2076
2099
  font-size: 14px;
2077
2100
  font-weight: 500;
2078
2101
  line-height: 19.6px;
2079
2102
  width: 100%;
2080
2103
  padding-right: 8px;
2081
- `,c7=Oo.div`
2104
+ `,x7=Oo.div`
2082
2105
  display: flex;
2083
2106
  flex-direction: column;
2084
2107
  width: 100%;
@@ -2090,7 +2113,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2090
2113
  border-color: var(--privy-color-foreground-4);
2091
2114
  border-radius: var(--privy-border-radius-md);
2092
2115
  }
2093
- `,d7=Oo.div`
2116
+ `,k7=Oo.div`
2094
2117
  position: relative;
2095
2118
  overflow: hidden;
2096
2119
  transition: max-height 25ms ease-out;
@@ -2102,38 +2125,38 @@ You will need this password to access your ${e} wallet on a new device. Please k
2102
2125
  &[data-open='false'] {
2103
2126
  max-height: 0;
2104
2127
  }
2105
- `,M1=Oo.div`
2128
+ `,zg=Oo.div`
2106
2129
  display: flex;
2107
2130
  flex-direction: column;
2108
2131
  gap: 12px;
2109
2132
  flex: 1 1 auto;
2110
2133
  min-height: 1px;
2111
- `,p7=Oo.div`
2134
+ `,R7=Oo.div`
2112
2135
  transform: ${e=>e.isactive?"rotate(180deg)":"rotate(0deg)"};
2113
- `;import m7 from"styled-components";import{jsx as h7}from"react/jsx-runtime";var Qd=({walletAddress:e,chainId:t=ro})=>h7(f7,{href:y1(t,e),target:"_blank",children:go(e)}),f7=m7.a`
2136
+ `;import M7 from"styled-components";import{jsx as L7}from"react/jsx-runtime";var np=({walletAddress:e,chainId:t=no})=>L7(W7,{href:xg(t,e),target:"_blank",children:vo(e)}),W7=M7.a`
2114
2137
  &:hover {
2115
2138
  text-decoration: underline;
2116
2139
  }
2117
- `;import{jsx as or,jsxs as Xd}from"react/jsx-runtime";var fi=({from:e,to:t,txn:r,transactionInfo:o,tokenPrice:n,gas:i,tokenSymbol:a})=>{let l=r?.value||0;return or(x1,{children:Xd(A1,{value:"details",children:[or(k1,{children:Xd(y7,{children:[or("div",{children:o?.title||o?.actionDescription||"Details"}),or(g7,{children:or(v1,{weiQuantities:[l],tokenPrice:n,tokenSymbol:a})})]})}),Xd(R1,{children:[or(Zl,{label:"From",children:or(Qd,{walletAddress:e,chainId:r.chainId||ro})}),or(Zl,{label:"To",children:or(Qd,{walletAddress:t,chainId:r.chainId||ro})}),o&&o.action&&or(Zl,{label:"Action",children:o.action}),i&&or(w1,{transactionData:r,gas:i,tokenPrice:n,tokenSymbol:a})]}),or(I1,{children:({isActive:s})=>or(b1,{transactionData:r,displayFee:s,gas:i||"0x0",tokenPrice:n,tokenSymbol:a})})]})})},y7=W1.div`
2140
+ `;import{jsx as nr,jsxs as ip}from"react/jsx-runtime";var vi=({from:e,to:t,txn:r,transactionInfo:o,tokenPrice:n,gas:i,tokenSymbol:a})=>{let s=r?.value||0,l=it();return nr(Fg,{...l.render.standalone?{defaultValue:"details"}:{},children:ip(Bg,{value:"details",children:[nr(Hg,{children:ip(O7,{children:[nr("div",{children:o?.title||o?.actionDescription||"Details"}),nr(N7,{children:nr(Rg,{weiQuantities:[s],tokenPrice:n,tokenSymbol:a})})]})}),ip(Gg,{children:[nr(rc,{label:"From",children:nr(np,{walletAddress:e,chainId:r.chainId||no})}),nr(rc,{label:"To",children:nr(np,{walletAddress:t,chainId:r.chainId||no})}),o&&o.action&&nr(rc,{label:"Action",children:o.action}),i&&nr(Mg,{transactionData:r,gas:i,tokenPrice:n,tokenSymbol:a})]}),nr(Vg,{children:({isActive:c})=>nr(Wg,{transactionData:r,displayFee:c,gas:i||"0x0",tokenPrice:n,tokenSymbol:a})})]})})},O7=qg.div`
2118
2141
  display: flex;
2119
2142
  flex-direction: row;
2120
2143
  justify-content: space-between;
2121
- `,g7=W1.div`
2144
+ `,N7=qg.div`
2122
2145
  flex-shrink: 0;
2123
2146
  padding-left: 8px;
2124
- `;import _a from"styled-components";import{jsx as Sa,jsxs as T7}from"react/jsx-runtime";var ep=({description:e,contractInfo:t})=>T7(v7,{children:[t.imgUrl&&Sa(C7,{size:t.imgSize||"sm",src:t.imgUrl,alt:t.imgAltText||`${t.name} image`}),t.url&&Sa(w7,{children:Sa("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",children:t.url.replace(/^(https?:\/\/)(www\.)?/,"")})}),t.name&&Sa(b7,{children:t.name}),Sa(E7,{children:e||t.actionText})]}),v7=_a.div`
2147
+ `;import Ma from"styled-components";import{jsx as Ia,jsxs as G7}from"react/jsx-runtime";var ap=({description:e,contractInfo:t})=>G7(D7,{children:[t.imgUrl&&Ia(U7,{size:t.imgSize||"sm",src:t.imgUrl,alt:t.imgAltText||`${t.name} image`}),t.url&&Ia(F7,{children:Ia("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",children:t.url.replace(/^(https?:\/\/)(www\.)?/,"")})}),t.name&&Ia(B7,{children:t.name}),Ia(H7,{children:e||t.actionText})]}),D7=Ma.div`
2125
2148
  display: flex;
2126
2149
  flex-direction: column;
2127
2150
  align-items: center;
2128
2151
  margin-bottom: 8px;
2129
- `,C7=_a.img`
2152
+ `,U7=Ma.img`
2130
2153
  && {
2131
2154
  height: ${e=>e.size==="sm"?"65px":"140px"};
2132
2155
  width: ${e=>e.size==="sm"?"65px":"140px"};
2133
2156
  border-radius: 16px;
2134
2157
  margin-bottom: 12px;
2135
2158
  }
2136
- `,w7=_a.div`
2159
+ `,F7=Ma.div`
2137
2160
  font-size: 12px;
2138
2161
  line-height: 12px;
2139
2162
  padding: 7px;
@@ -2146,7 +2169,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2146
2169
  text-decoration: underline;
2147
2170
  }
2148
2171
  }
2149
- `,b7=_a.div`
2172
+ `,B7=Ma.div`
2150
2173
  font-size: 18px;
2151
2174
  line-height: 18px;
2152
2175
  font-weight: 500;
@@ -2154,7 +2177,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2154
2177
  white-space: nowrap;
2155
2178
  max-width: 275px;
2156
2179
  text-overflow: ellipsis;
2157
- `,E7=_a.div`
2180
+ `,H7=Ma.div`
2158
2181
  font-size: 16px;
2159
2182
  line-height: 140%;
2160
2183
  font-weight: 400;
@@ -2162,7 +2185,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2162
2185
  overflow: hidden;
2163
2186
  max-width: 275px;
2164
2187
  text-overflow: ellipsis;
2165
- `;import P7 from"@heroicons/react/24/outline/WalletIcon";import rp from"styled-components";import{jsx as L1,jsxs as tp}from"react/jsx-runtime";var O1=({address:e,txn:t,balance:r,hasFunds:o})=>{let n=!!r,{nativeTokenSymbolForChainId:i}=M(),a=i(t.chainId)||"ETH";return tp(S7,{children:[tp(_7,{children:[L1(P7,{strokeWidth:"2",width:"16px",height:"16px"}),L1("div",{children:go(e)})]}),tp(x7,{displayBalanceColor:n,hasFunds:o,children:[r?Zr(r,a,6,!0):0," available"]})]})},S7=rp.div`
2188
+ `;import V7 from"@heroicons/react/24/outline/WalletIcon";import lp from"styled-components";import{jsx as $g,jsxs as sp}from"react/jsx-runtime";var Kg=({address:e,txn:t,balance:r,hasFunds:o})=>{let n=!!r,{nativeTokenSymbolForChainId:i}=M(),a=i(t.chainId)||"ETH";return sp(z7,{children:[sp(q7,{children:[$g(V7,{strokeWidth:"2",width:"16px",height:"16px"}),$g("div",{children:vo(e)})]}),sp($7,{displayBalanceColor:n,hasFunds:o,children:[r?Jr(r,a,6,!0):0," available"]})]})},z7=lp.div`
2166
2189
  display: flex;
2167
2190
  flex-direction: row;
2168
2191
  justify-content: space-between;
@@ -2175,12 +2198,12 @@ You will need this password to access your ${e} wallet on a new device. Please k
2175
2198
  border: 1px solid var(--privy-color-foreground-4);
2176
2199
  border-radius: var(--privy-border-radius-md);
2177
2200
  }
2178
- `,_7=rp.div`
2201
+ `,q7=lp.div`
2179
2202
  display: flex;
2180
2203
  flex-direction: row;
2181
2204
  align-items: center;
2182
2205
  gap: 8px;
2183
- `,x7=rp.div`
2206
+ `,$7=lp.div`
2184
2207
  display: flex;
2185
2208
  align-items: center;
2186
2209
  justify-content: center;
@@ -2190,35 +2213,35 @@ You will need this password to access your ${e} wallet on a new device. Please k
2190
2213
  background-color: var(--privy-color-background-2);
2191
2214
  padding: 5px 8px;
2192
2215
  color: ${e=>e.displayBalanceColor?e.hasFunds?"var(--privy-color-success-dark)":"var(--privy-color-error)":"inherit"};
2193
- `;import ec from"styled-components";import{Fragment as D1,jsx as xa,jsxs as U1}from"react/jsx-runtime";var F1=({description:e,txn:t,tokenSymbol:r,tokenPrice:o})=>{let n=t.value||0,i=o?Ta(n,o):void 0,a=Zr(n,r);return U1(A7,{children:[i?U1(D1,{children:[xa(N1,{children:i}),xa(k7,{children:a})]}):xa(D1,{children:xa(N1,{children:a})}),xa(R7,{children:e})]})},A7=ec.div`
2216
+ `;import ac from"styled-components";import{Fragment as Yg,jsx as Wa,jsxs as Zg}from"react/jsx-runtime";var Jg=({description:e,txn:t,tokenSymbol:r,tokenPrice:o})=>{let n=t.value||0,i=o?ka(n,o):void 0,a=Jr(n,r);return Zg(K7,{children:[i?Zg(Yg,{children:[Wa(jg,{children:i}),Wa(j7,{children:a})]}):Wa(Yg,{children:Wa(jg,{children:a})}),Wa(Y7,{children:e})]})},K7=ac.div`
2194
2217
  display: flex;
2195
2218
  flex-direction: column;
2196
2219
  align-items: center;
2197
2220
  margin-bottom: 20px;
2198
- `,N1=ec.h2`
2221
+ `,jg=ac.h2`
2199
2222
  && {
2200
2223
  font-size: 48px;
2201
2224
  line-height: 48px;
2202
2225
  margin: 8px auto;
2203
2226
  }
2204
- `,k7=ec.p`
2227
+ `,j7=ac.p`
2205
2228
  margin-bottom: 12px;
2206
2229
  && {
2207
2230
  font-size: 17px;
2208
2231
  line-height: 17px;
2209
2232
  color: var(--privy-color-foreground-3);
2210
2233
  }
2211
- `,R7=ec.div`
2234
+ `,Y7=ac.div`
2212
2235
  font-size: 16px;
2213
2236
  line-height: 22.4px;
2214
2237
  font-weight: 400;
2215
2238
  overflow: hidden;
2216
2239
  max-width: 275px;
2217
2240
  text-overflow: ellipsis;
2218
- `;import{VoidSigner as U7}from"@ethersproject/abstract-signer";import{EtherscanProvider as jq}from"@ethersproject/providers";import{BigNumber as V1}from"@ethersproject/bignumber";import{BigNumber as hi}from"@ethersproject/bignumber";import{Contract as I7}from"@ethersproject/contracts";import{serialize as M7}from"@ethersproject/transactions";var W7=81457,L7=168587773,yi=e=>[Is.id,Ms.id,Ws.id,Os.id,Ns.id,Ds.id,Us.id,Bs.id,Fs.id,W7,L7].includes(e),B1=async(e,t)=>{if(!yi(e.chainId))throw new Error("Invalid chain ID for OP Stack gas estimation.");if(e.type===void 0&&(e.type=2),e.maxPriorityFeePerGas&&e.maxFeePerGas||e.gasPrice)return e;try{if(!e.maxPriorityFeePerGas){let r=await t.send("eth_maxPriorityFeePerGas",[]);e.maxPriorityFeePerGas=r}if(e.maxFeePerGas&&(console.warn("maxFeePerGas is specified without maxPriorityFeePerGas - this can result in hung transactions."),e.maxPriorityFeePerGas>=e.maxFeePerGas))throw new Error("Overridden maxFeePerGas is less than or equal to the calculated maxPriorityFeePerGas. Please set both values or maxPriorityFeePerGas alone for correct gas estimation.");if(!e.maxFeePerGas){let{lastBaseFeePerGas:r}=await t.getFeeData();if(!r)throw new Error("Unable to fetch baseFee for last block.");let i=hi.from(r).mul(hi.from(126)).div(hi.from(100)).add(hi.from(e.maxPriorityFeePerGas));e.maxFeePerGas=Aa(i)}}catch(r){throw new Error(`Failed to set gas price for OP stack transaction: ${r}.`)}return e};async function H1(e,t){if(!e.chainId||e.chainId&&!yi(e.chainId))return hi.from(0);let r=hi.from(0);try{let o=new I7(Vu,zu,t),n=G1(e),i=M7(n);r=await o.getL1Fee(i)}catch{}return r}async function z1(e,t){try{return(await t.estimateGas(e)).toHexString()}catch(r){console.warn(`Gas estimation failed with error: ${r}. Retrying gas estimation by omitting the 'from' address`);try{let o={...e,from:void 0};return(await t.estimateGas(o)).toHexString()}catch(o){throw console.warn(`Gas estimation failed with error: ${o} when omitting the 'from' address`),r}}}var q1=async(e,t)=>{if(e.type===void 0&&(e.type=2),e.type===2){if(!e.maxFeePerGas||!e.maxPriorityFeePerGas){let r=await t.getFeeData();e.maxFeePerGas||(e.maxFeePerGas=r.maxFeePerGas?.toHexString()),e.maxPriorityFeePerGas||(e.maxPriorityFeePerGas=r.maxPriorityFeePerGas?.toHexString())}}else if(!e.gasPrice){let r=await t.getFeeData();e.gasPrice=r.gasPrice?.toHexString()}return e};async function gi(e,t){if(!e.gasLimit)throw new ze("gasLimit was not successfully set for transaction.");let r=bt(e.gasLimit),o=V1.from(0);if(e.type==2)if(e.maxFeePerGas)o=bt(e.maxFeePerGas);else throw new ze("maxFeePerGas was not successfully set for transaction of type 2.");else if(e.gasPrice)o=bt(e.gasPrice);else throw new ze("gasPrice was not successfully set for transaction of type 0 or 1.");let n=r.mul(o),i=V1.from(0);if(e.chainId&&yi(e.chainId))try{i=await H1(e,t),n=n.add(i)}catch{}return{totalGasEstimate:n,l1ExecutionFeeEstimate:i}}import{BigNumber as op}from"@ethersproject/bignumber";var np=e=>[As.id,ks.id,Rs.id].includes(e),$1=async(e,t)=>{if(!np(e.chainId))throw new Error("Invalid chain ID for Arbitrum gas estimation.");if(e.type===void 0&&(e.type=2),e.maxFeePerGas)return e;try{let{lastBaseFeePerGas:r}=await t.getFeeData();if(r){let o=r.mul(op.from(120)).div(op.from(100));e.maxFeePerGas=Aa(o),e.maxPriorityFeePerGas=Aa(op.from(0))}}catch(r){throw new Error(`Failed to set gas price for Arbitrum transaction: ${r}.`)}return e};var ip=e=>[56,97].includes(e),K1=async(e,t)=>{if(!ip(e.chainId))throw new Error("Invalid chain ID for BSC gas estimation.");if(e.type===void 0?e.type=0:(e.type==1||e.type==2)&&console.warn("Transaction request type specified is incompatible for chain and will result in undefined behavior. Please use transaction type 0."),!e.gasPrice){let r=await t.getFeeData();e.gasPrice=r.gasPrice?.toHexString()}return e};import{parseUnits as j1}from"@ethersproject/units";import{ofetch as O7}from"ofetch";var ap={id:80002,name:"Polygon Amoy",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{privy:{http:["https://polygon-amoy.rpc.privy.systems"]},infura:{http:["https://polygon-amoy.infura.io/v3"],webSocket:["wss://polygon-amoy.infura.io/ws/v3"]},default:{http:["https://rpc-amoy.polygon.technology"]}},blockExplorers:{default:{name:"OK LINK",url:"https://www.oklink.com/amoy"}},testnet:!0};var lp=e=>[Bi.id,Hi.id,ap.id].includes(e),sp=e=>({maxPriorityFee:j1(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:j1(e.maxFee.toFixed(9),"gwei").toHexString()}),N7=e=>({safeLow:sp(e.safeLow),standard:sp(e.standard),fast:sp(e.fast)}),D7=async e=>{let t="";switch(e){case Bi.id:t="https://gasstation.polygon.technology/v2";break;case Hi.id:t="https://gasstation-testnet.polygon.technology/v2";break;case ap.id:t="https://gasstation-testnet.polygon.technology/amoy";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}return N7(await O7(t))};async function Y1(e){if(!lp(e.chainId))throw new Error("Invalid chain ID for Polygon gas estimation.");if(e.type===void 0&&(e.type=2),e.maxPriorityFeePerGas&&e.maxFeePerGas)return e;try{let{standard:t}=await D7(e.chainId);e.maxPriorityFeePerGas||(e.maxPriorityFeePerGas=t.maxPriorityFee),e.maxFeePerGas||(e.maxFeePerGas=t.maxFee)}catch(t){throw new Error(`Failed to set gas prices from Polygon gas station with error: ${t}.`)}return e}function Aa(e){if(typeof e=="number"||typeof e=="bigint"||typeof e=="string")return e;if(typeof e.toHexString=="function")return e.toHexString();throw new Error(`Expected numeric value but received ${e}`)}function G1(e){let t={};return e.to!==void 0&&(t.to=e.to),e.data!==void 0&&(t.data=e.data),e.chainId!==void 0&&(t.chainId=e.chainId),e.type!==void 0&&(t.type=e.type),e.accessList!==void 0&&(t.accessList=e.accessList),e.nonce!==void 0&&(t.nonce=bt(e.nonce).toNumber()),e.gasLimit!==void 0&&(t.gasLimit=bt(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=bt(e.gasPrice)),e.value!==void 0&&(t.value=bt(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=bt(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=bt(e.maxPriorityFeePerGas)),t}async function vi(e,t,r){if(t.chainId=Number(t.chainId),Z1(t),t.from||(t.from=e),!t.nonce){let o=new U7(e,r);t.nonce=await o.getTransactionCount("pending")}return t.gasLimit||(t.gas?(t.gasLimit=t.gas,delete t.gas):t.gasLimit=await z1(t,r)),typeof t.type=="string"&&J1(t.type)&&(t.type=Number(t.type)),[23294,23295].includes(t.chainId)&&(t.type=0),lp(t.chainId)?t=await Y1(t):np(t.chainId)?t=await $1(t,r):yi(t.chainId)?t=await B1(t,r):ip(t.chainId)?t=await K1(t,r):t=await q1(t,r),t.type===0&&delete t.accessList,t.type!==2&&(delete t.maxPriorityFeePerGas,delete t.maxFeePerGas),t}async function tc(e,t,r,o,n){o=Object.assign({chainId:ro},o),Z1(o);let a=(await r.rpc({address:t,accessToken:e,request:{method:"eth_signTransaction",params:[o]}})).response.data;return await n.sendTransaction(a)}async function rc(e,t,r,o){let n=await o.getBalance(e),i=t.value||0,l=!n.sub(bt(i)).sub(r).isNegative();return{balance:n,hasSufficientFunds:l}}function Z1(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let r of t){let o=e[r];if(!(typeof o>"u")&&!F7(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 F7(e){let t=typeof e=="number",r=typeof e=="bigint",o=typeof e=="string"&&J1(e);return t||r||o}function J1(e){return/^-?0x[a-f0-9]+$/i.test(e)}function oc(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 B7}from"react";var nc=e=>{let{showFiatPrices:t,getUsdTokenPrice:r,chains:o}=M(),[n,i]=cp(!0),[a,l]=cp(void 0),[s,c]=cp(void 0);return B7(()=>{let u=e.chainId||ro,h=o.find(g=>g.id===Number(u));if(!h)throw new te(`Unsupported chain: ${u}`);(async()=>{if(!t){i(!1);return}try{i(!0);let g=await r(h);g?c(g):l(new Error(`Unable to fetch token price on chain id ${h.id}`))}catch(g){l(g)}finally{i(!1)}})()},[e.chainId]),{tokenPrice:s,isTokenPriceLoading:n,tokenPriceError:a}};import{createContext as H7,useContext as G7}from"react";var dp=H7(null);function ka(){let e=G7(dp);if(e===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return e}import{jsx as X1}from"react/jsx-runtime";var Ra=({pendingTransaction:e})=>{let{getAccessToken:t}=B(),{wallets:r}=ka(),{walletProxy:o,rpcConfig:n,chains:i,appId:a,nativeTokenSymbolForChainId:l}=M(),[s,c]=Q1(null),[u,h]=Q1(e),{tokenPrice:f}=nc(u),g=l(e.chainId)||"ETH",v=V7(()=>r.find(y=>y.walletClientType==="privy"),[r]);return z7(()=>{async function y(){if(!await t()||!o||!v)return u;let _=to(u.chainId,i,n,{appId:a}),w=await vi(v.address,u,_),{totalGasEstimate:x}=await gi(w,_);return c(x.toHexString()),w}y().then(h).catch(console.error)},[o]),v?X1($7,{children:X1(fi,{from:v.address,to:u.to,txn:u,gas:s??void 0,tokenPrice:f,tokenSymbol:g})}):null},$7=q7.div`
2241
+ `;import{VoidSigner as ob}from"@ethersproject/abstract-signer";import{EtherscanProvider as I$}from"@ethersproject/providers";import{BigNumber as t1}from"@ethersproject/bignumber";import{BigNumber as Ci}from"@ethersproject/bignumber";import{Contract as Z7}from"@ethersproject/contracts";import{serialize as J7}from"@ethersproject/transactions";var Q7=81457,X7=168587773,wi=e=>[Ds.id,Us.id,Fs.id,Hs.id,Gs.id,Vs.id,zs.id,$s.id,qs.id,Q7,X7].includes(e),Qg=async(e,t)=>{if(!wi(e.chainId))throw new Error("Invalid chain ID for OP Stack gas estimation.");if(e.type===void 0&&(e.type=2),e.maxPriorityFeePerGas&&e.maxFeePerGas||e.gasPrice)return e;try{if(!e.maxPriorityFeePerGas){let r=await t.send("eth_maxPriorityFeePerGas",[]);e.maxPriorityFeePerGas=r}if(e.maxFeePerGas&&(console.warn("maxFeePerGas is specified without maxPriorityFeePerGas - this can result in hung transactions."),e.maxPriorityFeePerGas>=e.maxFeePerGas))throw new Error("Overridden maxFeePerGas is less than or equal to the calculated maxPriorityFeePerGas. Please set both values or maxPriorityFeePerGas alone for correct gas estimation.");if(!e.maxFeePerGas){let{lastBaseFeePerGas:r}=await t.getFeeData();if(!r)throw new Error("Unable to fetch baseFee for last block.");let i=Ci.from(r).mul(Ci.from(126)).div(Ci.from(100)).add(Ci.from(e.maxPriorityFeePerGas));e.maxFeePerGas=La(i)}}catch(r){throw new Error(`Failed to set gas price for OP stack transaction: ${r}.`)}return e};async function Xg(e,t){if(!e.chainId||e.chainId&&!wi(e.chainId))return Ci.from(0);let r=Ci.from(0);try{let o=new Z7(ju,Yu,t),n=e1(e),i=J7(n);r=await o.getL1Fee(i)}catch{}return r}async function r1(e,t){try{return(await t.estimateGas(e)).toHexString()}catch(r){console.warn(`Gas estimation failed with error: ${r}. Retrying gas estimation by omitting the 'from' address`);try{let o={...e,from:void 0};return(await t.estimateGas(o)).toHexString()}catch(o){throw console.warn(`Gas estimation failed with error: ${o} when omitting the 'from' address`),r}}}var o1=async(e,t)=>{if(e.type===void 0&&(e.type=2),e.type===2){if(!e.maxFeePerGas||!e.maxPriorityFeePerGas){let r=await t.getFeeData();e.maxFeePerGas||(e.maxFeePerGas=r.maxFeePerGas?.toHexString()),e.maxPriorityFeePerGas||(e.maxPriorityFeePerGas=r.maxPriorityFeePerGas?.toHexString())}}else if(!e.gasPrice){let r=await t.getFeeData();e.gasPrice=r.gasPrice?.toHexString()}return e};async function bi(e,t){if(!e.gasLimit)throw new ze("gasLimit was not successfully set for transaction.");let r=bt(e.gasLimit),o=t1.from(0);if(e.type==2)if(e.maxFeePerGas)o=bt(e.maxFeePerGas);else throw new ze("maxFeePerGas was not successfully set for transaction of type 2.");else if(e.gasPrice)o=bt(e.gasPrice);else throw new ze("gasPrice was not successfully set for transaction of type 0 or 1.");let n=r.mul(o),i=t1.from(0);if(e.chainId&&wi(e.chainId))try{i=await Xg(e,t),n=n.add(i)}catch{}return{totalGasEstimate:n,l1ExecutionFeeEstimate:i}}import{BigNumber as cp}from"@ethersproject/bignumber";var dp=e=>[Ls.id,Os.id,Ns.id].includes(e),n1=async(e,t)=>{if(!dp(e.chainId))throw new Error("Invalid chain ID for Arbitrum gas estimation.");if(e.type===void 0&&(e.type=2),e.maxFeePerGas)return e;try{let{lastBaseFeePerGas:r}=await t.getFeeData();if(r){let o=r.mul(cp.from(120)).div(cp.from(100));e.maxFeePerGas=La(o),e.maxPriorityFeePerGas=La(cp.from(0))}}catch(r){throw new Error(`Failed to set gas price for Arbitrum transaction: ${r}.`)}return e};var pp=e=>[56,97].includes(e),i1=async(e,t)=>{if(!pp(e.chainId))throw new Error("Invalid chain ID for BSC gas estimation.");if(e.type===void 0?e.type=0:(e.type==1||e.type==2)&&console.warn("Transaction request type specified is incompatible for chain and will result in undefined behavior. Please use transaction type 0."),!e.gasPrice){let r=await t.getFeeData();e.gasPrice=r.gasPrice?.toHexString()}return e};import{parseUnits as a1}from"@ethersproject/units";import{ofetch as eb}from"ofetch";var up={id:80002,name:"Polygon Amoy",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{privy:{http:["https://polygon-amoy.rpc.privy.systems"]},infura:{http:["https://polygon-amoy.infura.io/v3"],webSocket:["wss://polygon-amoy.infura.io/ws/v3"]},default:{http:["https://rpc-amoy.polygon.technology"]}},blockExplorers:{default:{name:"OK LINK",url:"https://www.oklink.com/amoy"}},testnet:!0};var fp=e=>[qi.id,$i.id,up.id].includes(e),mp=e=>({maxPriorityFee:a1(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:a1(e.maxFee.toFixed(9),"gwei").toHexString()}),tb=e=>({safeLow:mp(e.safeLow),standard:mp(e.standard),fast:mp(e.fast)}),rb=async e=>{let t="";switch(e){case qi.id:t="https://gasstation.polygon.technology/v2";break;case $i.id:t="https://gasstation-testnet.polygon.technology/v2";break;case up.id:t="https://gasstation-testnet.polygon.technology/amoy";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}return tb(await eb(t))};async function s1(e){if(!fp(e.chainId))throw new Error("Invalid chain ID for Polygon gas estimation.");if(e.type===void 0&&(e.type=2),e.maxPriorityFeePerGas&&e.maxFeePerGas)return e;try{let{standard:t}=await rb(e.chainId);e.maxPriorityFeePerGas||(e.maxPriorityFeePerGas=t.maxPriorityFee),e.maxFeePerGas||(e.maxFeePerGas=t.maxFee)}catch(t){throw new Error(`Failed to set gas prices from Polygon gas station with error: ${t}.`)}return e}function La(e){if(typeof e=="number"||typeof e=="bigint"||typeof e=="string")return e;if(typeof e.toHexString=="function")return e.toHexString();throw new Error(`Expected numeric value but received ${e}`)}function e1(e){let t={};return e.to!==void 0&&(t.to=e.to),e.data!==void 0&&(t.data=e.data),e.chainId!==void 0&&(t.chainId=e.chainId),e.type!==void 0&&(t.type=e.type),e.accessList!==void 0&&(t.accessList=e.accessList),e.nonce!==void 0&&(t.nonce=bt(e.nonce).toNumber()),e.gasLimit!==void 0&&(t.gasLimit=bt(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=bt(e.gasPrice)),e.value!==void 0&&(t.value=bt(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=bt(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=bt(e.maxPriorityFeePerGas)),t}async function Ei(e,t,r){if(t.chainId=Number(t.chainId),l1(t),t.from||(t.from=e),!t.nonce){let o=new ob(e,r);t.nonce=await o.getTransactionCount("pending")}return t.gasLimit||(t.gas?(t.gasLimit=t.gas,delete t.gas):t.gasLimit=await r1(t,r)),typeof t.type=="string"&&c1(t.type)&&(t.type=Number(t.type)),[23294,23295].includes(t.chainId)&&(t.type=0),fp(t.chainId)?t=await s1(t):dp(t.chainId)?t=await n1(t,r):wi(t.chainId)?t=await Qg(t,r):pp(t.chainId)?t=await i1(t,r):t=await o1(t,r),t.type===0&&delete t.accessList,t.type!==2&&(delete t.maxPriorityFeePerGas,delete t.maxFeePerGas),t}async function sc(e,t,r,o,n){o=Object.assign({chainId:no},o),l1(o);let a=(await r.rpc({address:t,accessToken:e,request:{method:"eth_signTransaction",params:[o]}})).response.data;return await n.sendTransaction(a)}async function lc(e,t,r,o){let n=await o.getBalance(e),i=t.value||0,s=!n.sub(bt(i)).sub(r).isNegative();return{balance:n,hasSufficientFunds:s}}function l1(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let r of t){let o=e[r];if(!(typeof o>"u")&&!nb(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 nb(e){let t=typeof e=="number",r=typeof e=="bigint",o=typeof e=="string"&&c1(e);return t||r||o}function c1(e){return/^-?0x[a-f0-9]+$/i.test(e)}function cc(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 hp,useEffect as ib}from"react";var dc=e=>{let{showFiatPrices:t,getUsdTokenPrice:r,chains:o}=M(),[n,i]=hp(!0),[a,s]=hp(void 0),[l,c]=hp(void 0);return ib(()=>{let u=e.chainId||no,f=o.find(g=>g.id===Number(u));if(!f)throw new ne(`Unsupported chain: ${u}`);(async()=>{if(!t){i(!1);return}try{i(!0);let g=await r(f);g?c(g):s(new Error(`Unable to fetch token price on chain id ${f.id}`))}catch(g){s(g)}finally{i(!1)}})()},[e.chainId]),{tokenPrice:l,isTokenPriceLoading:n,tokenPriceError:a}};import{createContext as ab,useContext as sb}from"react";var yp=ab(null);function Oa(){let e=sb(yp);if(e===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return e}import{jsx as p1}from"react/jsx-runtime";var Na=({pendingTransaction:e})=>{let{getAccessToken:t}=F(),{wallets:r}=Oa(),{walletProxy:o,rpcConfig:n,chains:i,appId:a,nativeTokenSymbolForChainId:s}=M(),[l,c]=d1(null),[u,f]=d1(e),{tokenPrice:h}=dc(u),g=s(e.chainId)||"ETH",v=lb(()=>r.find(y=>y.walletClientType==="privy"),[r]);return cb(()=>{async function y(){if(!await t()||!o||!v)return u;let _=oo(u.chainId,i,n,{appId:a}),b=await Ei(v.address,u,_),{totalGasEstimate:A}=await bi(b,_);return c(A.toHexString()),b}y().then(f).catch(console.error)},[o]),v?p1(pb,{children:p1(vi,{from:v.address,to:u.to,txn:u,gas:l??void 0,tokenPrice:h,tokenSymbol:g})}):null},pb=db.div`
2219
2242
  width: 100%;
2220
2243
  padding: 1rem 0;
2221
- `;import K7 from"@heroicons/react/24/outline/CalendarIcon";import j7 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import Y7 from"@heroicons/react/24/outline/ShieldCheckIcon";import{Fragment as eg,jsx as Et,jsxs as Ci}from"react/jsx-runtime";var tg=({hasBlockingError:e,error:t,onClose:r,onBack:o,handleSubmit:n,account:i,submitSuccess:a})=>{let{pendingTransaction:l}=M();return Ci(eg,{children:[Et(P,{onClose:r},"header"),Et(at,{children:Ci("div",{children:[Et(ot,{success:a,fail:!!t}),t?Et(j7,{style:{width:"38px",height:"38px"}}):Et(un,{style:{width:"38px",height:"38px"}})]})}),Et(se,{style:{marginTop:"1rem"},children:"Verifying with passkey"}),Ci(rn,{children:[Ci(Bt,{children:[Et(Ft,{children:Et(Y7,{})}),"Approve this action using your touch, face, PIN, or hardware key."]}),Ci(Bt,{children:[Et(Ft,{children:Et(K7,{})}),"You last added a passkey on"," ",i?.firstVerifiedAt?.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),"."]})]}),l&&Et(pr,{children:Et(Ra,{pendingTransaction:l})}),t&&Ci(eg,{children:[Et(ol,{style:{marginTop:"1.25rem"},children:t.message}),Et(N,{disabled:e,onClick:n,style:{marginTop:"1.25rem"},children:"Try again"})]}),o&&Et($i,{style:{marginTop:"1rem"},onClick:o,children:"Choose another method"}),Et(V,{})]})};import{Fragment as pp,jsx as fe,jsxs as Lr}from"react/jsx-runtime";var up=({open:e,onClose:t})=>{let{user:r}=B(),[o,n]=Ia(null),{init:i,cancel:a,submit:l}=va(),[s,c]=Ia(!1),[u,h]=Ia(!1),[f,g]=Ia(null),[v,y]=Ia(null);rb(()=>{e&&r?.mfaMethods&&r.mfaMethods.length>0?w(r.mfaMethods[0]):n(null)},[r?.mfaMethods,e]);let S=D=>hd(D)?(c(!0),new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):ln(D)?(c(!1),new Error("The code you entered is not valid")):sn(D)?(c(!0),new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.")):(console.error(D),c(!1),new Error("Something went wrong."));async function _(D){y(null);try{if(!D||!o)return;await l(o,D),h(!0),c(!1),t()}catch(I){throw S(I)}}async function w(D){if(D==="passkey"){try{n(D);let I=await i(D);if(!I)throw new Error("something went wrong");g(I),await l(D,I),h(!0),c(!1),t()}catch(I){y(S(I))}return}try{n(D),await i(D)}catch(I){console.error(I)}}let x=()=>{n(null),y(null),a(),t()},k=()=>{n(null),y(null)};if(!e||!r)return null;if(o==="passkey"){let D=r.linkedAccounts.filter(I=>I.type==="passkey"&&I.enrolledInMfa).sort((I,R)=>R.firstVerifiedAt.valueOf()-I.firstVerifiedAt.valueOf())[0];return fe(tg,{account:D,selectedMethod:o,submitSuccess:u,hasBlockingError:s,error:v,onClose:x,onBack:k,handleSubmit:()=>_(f).catch(y)})}return o?fe(ob,{submitSuccess:u,hasBlockingError:s,handleSubmitCode:_,selectedMethod:o,onClose:x,onBack:r.mfaMethods.length>1?()=>n(null):void 0}):Lr(pp,{children:[fe(P,{onClose:x},"header"),fe(Ae,{children:fe(He,{children:fe(X7,{})})}),fe(se,{children:"Verify your identity"}),fe(ce,{children:"Choose a verification method"}),Lr(Qs,{children:[r.mfaMethods.includes("totp")&&Lr(Te,{onClick:()=>w("totp"),children:[fe(Z7,{}),"Authenticator App"]},"totp"),r.mfaMethods.includes("sms")&&Lr(Te,{onClick:()=>w("sms"),children:[fe(Q7,{}),"SMS"]},"sms"),r.mfaMethods.includes("passkey")&&Lr(Te,{onClick:()=>w("passkey"),children:[fe(J7,{}),"Passkey"]},"passkey")]}),fe(V,{})]})},ob=({selectedMethod:e,submitSuccess:t,hasBlockingError:r,onClose:o,onBack:n,handleSubmitCode:i})=>{let{app:a}=A(),{pendingTransaction:l}=M();switch(e){case"sms":return Lr(pp,{children:[fe(P,{onClose:o},"header"),fe(Ae,{children:fe(He,{children:fe(tb,{})})}),fe(se,{children:"Enter verification code"}),Lr(pr,{children:[fe(fn,{success:t,disabled:r,onChange:i}),Lr(ce,{children:["To continue, please enter the 6-digit code sent to your ",fe("strong",{children:"mobile device"})]}),l&&fe(Ra,{pendingTransaction:l})]}),n&&fe($i,{theme:a?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),fe(Tr,{onClick:o,children:"Not now"}),fe(V,{})]});case"totp":return Lr(pp,{children:[fe(P,{onClose:o},"header"),fe(Ae,{children:fe(He,{children:fe(eb,{})})}),fe(se,{children:"Enter verification code"}),Lr(pr,{children:[fe(fn,{success:t,disabled:r,onChange:i}),Lr(ce,{children:["To continue, please enter the 6-digit code generated from your"," ",fe("strong",{children:"authenticator app"})]}),l&&fe(Ra,{pendingTransaction:l})]}),n&&fe($i,{theme:a?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),fe(Tr,{onClick:o,children:"Not now"}),fe(V,{})]});default:return null}};import{useEffect as rg,useState as og}from"react";import nb from"styled-components";import{Fragment as ab,jsx as Jr,jsxs as ic}from"react/jsx-runtime";var ng=()=>{let{authenticated:e,logout:t,ready:r,user:o}=B(),{app:n,setModalData:i,navigate:a,resetNavigation:l}=A(),{getAuthMeta:s,initLoginWithOAuth:c,loginWithOAuth:u,updateWallets:h,setReadyToTrue:f,closePrivyModal:g,createAnalyticsEvent:v}=M(),[y,S]=og(!1),[_,w]=og(void 0),x=s()?.provider||"google",{name:k,component:D}=Oi(x),I=qs(),R=Fe;rg(()=>{u(x).then(Y=>{S(!0),f(!0),Y&&I("login","onOAuthLoginComplete",Y)}).catch(Y=>{if(Y?.privyErrorCode==="allowlist_rejected"){w(void 0),l(),a("ALLOWLIST_REJECTION_SCREEN");return}if(Y?.privyErrorCode==="max_accounts_reached"){console.error(new lr(Y).toString()),w(void 0),l(),a("USER_LIMIT_REACHED_SCREEN");return}let{retryable:W,detail:G}=em(Y,x);w({retryable:W,detail:G,message:"Authentication failed"}),f(!1)}).finally(()=>{Zo()})},[k,x]),rg(()=>{if(r&&e&&y&&o){if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let W=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},R);return()=>clearTimeout(W)}if(Nt(o,n?.embeddedWallets?.createOnLogin)){let W=setTimeout(()=>{i({createWallet:{onSuccess:()=>{},onFailure:G=>{console.error(G),v({eventName:"embedded_wallet_creation_failure_logout",payload:{error:G,provider:x,screen:"OAuthStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},R);return()=>clearTimeout(W)}else{let W=setTimeout(()=>g({shouldCallAuthOnSuccess:!0,isSuccess:!0}),R);return h(),()=>clearTimeout(W)}}},[r,e,y,o]);let H=y?`Successfully connected with ${k}`:_?_.message:`Verifying connection to ${k}`,K="";return y?K="You\u2019re good to go!":_?K=_.detail:K="Just a few moments more",ic(ab,{children:[Jr(P,{}),Jr(Q,{}),ic(ib,{children:[Jr(at,{children:ic("div",{children:[Jr(ot,{success:y,fail:!!_}),Jr(D,{style:{width:"38px",height:"38px"}})]})}),ic(Ze,{children:[Jr("h3",{children:H}),Jr("p",{children:K})]}),_&&_?.retryable?Jr(Fn,{onClick:()=>{Zo(),c(x),w(void 0)},disabled:!y&&!_?.retryable,children:"Retry"}):null]}),Jr(re,{}),Jr(V,{})]})},ib=nb.div`
2244
+ `;import ub from"@heroicons/react/24/outline/CalendarIcon";import mb from"@heroicons/react/24/outline/ExclamationTriangleIcon";import fb from"@heroicons/react/24/outline/ShieldCheckIcon";import{Fragment as u1,jsx as Et,jsxs as Ti}from"react/jsx-runtime";var m1=({hasBlockingError:e,error:t,onClose:r,onBack:o,handleSubmit:n,account:i,submitSuccess:a})=>{let{pendingTransaction:s}=M();return Ti(u1,{children:[Et(S,{onClose:r},"header"),Et(Qe,{children:Ti("div",{children:[Et(Je,{success:a,fail:!!t}),t?Et(mb,{style:{width:"38px",height:"38px"}}):Et(mn,{style:{width:"38px",height:"38px"}})]})}),Et(le,{style:{marginTop:"1rem"},children:"Verifying with passkey"}),Ti(on,{children:[Ti(Gt,{children:[Et(Ht,{children:Et(fb,{})}),"Approve this action using your touch, face, PIN, or hardware key."]}),Ti(Gt,{children:[Et(Ht,{children:Et(ub,{})}),"You last added a passkey on"," ",i?.firstVerifiedAt?.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),"."]})]}),s&&Et(pr,{children:Et(Na,{pendingTransaction:s})}),t&&Ti(u1,{children:[Et(ll,{style:{marginTop:"1.25rem"},children:t.message}),Et(D,{disabled:e,onClick:n,style:{marginTop:"1.25rem"},children:"Try again"})]}),o&&Et(Qi,{style:{marginTop:"1rem"},onClick:o,children:"Choose another method"}),Et(z,{})]})};import{Fragment as gp,jsx as fe,jsxs as Or}from"react/jsx-runtime";var vp=({open:e,onClose:t})=>{let{user:r}=F(),[o,n]=Da(null),{init:i,cancel:a,submit:s}=Pa(),[l,c]=Da(!1),[u,f]=Da(!1),[h,g]=Da(null),[v,y]=Da(null);bb(()=>{e&&r?.mfaMethods&&r.mfaMethods.length>0?b(r.mfaMethods[0]):n(null)},[r?.mfaMethods,e]);let T=N=>bd(N)?(c(!0),new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):cn(N)?(c(!1),new Error("The code you entered is not valid")):ln(N)?(c(!0),new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.")):(console.error(N),c(!1),new Error("Something went wrong."));async function _(N){y(null);try{if(!N||!o)return;await s(o,N),f(!0),c(!1),t()}catch(R){throw T(R)}}async function b(N){if(N==="passkey"){try{n(N);let R=await i(N);if(!R)throw new Error("something went wrong");g(R),await s(N,R),f(!0),c(!1),t()}catch(R){y(T(R))}return}try{n(N),await i(N)}catch(R){console.error(R)}}let A=()=>{n(null),y(null),a(),t()},k=()=>{n(null),y(null)};if(!e||!r)return null;if(o==="passkey"){let N=r.linkedAccounts.filter(R=>R.type==="passkey"&&R.enrolledInMfa).sort((R,I)=>I.firstVerifiedAt.valueOf()-R.firstVerifiedAt.valueOf())[0];return fe(m1,{account:N,selectedMethod:o,submitSuccess:u,hasBlockingError:l,error:v,onClose:A,onBack:k,handleSubmit:()=>_(h).catch(y)})}return o?fe(Eb,{submitSuccess:u,hasBlockingError:l,handleSubmitCode:_,selectedMethod:o,onClose:A,onBack:r.mfaMethods.length>1?()=>n(null):void 0}):Or(gp,{children:[fe(S,{onClose:A},"header"),fe(xe,{children:fe(Ge,{children:fe(vb,{})})}),fe(le,{children:"Verify your identity"}),fe(de,{children:"Choose a verification method"}),Or(ol,{children:[r.mfaMethods.includes("totp")&&Or(Te,{onClick:()=>b("totp"),children:[fe(hb,{}),"Authenticator App"]},"totp"),r.mfaMethods.includes("sms")&&Or(Te,{onClick:()=>b("sms"),children:[fe(gb,{}),"SMS"]},"sms"),r.mfaMethods.includes("passkey")&&Or(Te,{onClick:()=>b("passkey"),children:[fe(yb,{}),"Passkey"]},"passkey")]}),fe(z,{})]})},Eb=({selectedMethod:e,submitSuccess:t,hasBlockingError:r,onClose:o,onBack:n,handleSubmitCode:i})=>{let{app:a}=x(),{pendingTransaction:s}=M();switch(e){case"sms":return Or(gp,{children:[fe(S,{onClose:o},"header"),fe(xe,{children:fe(Ge,{children:fe(wb,{})})}),fe(le,{children:"Enter verification code"}),Or(pr,{children:[fe(hn,{success:t,disabled:r,onChange:i}),Or(de,{children:["To continue, please enter the 6-digit code sent to your ",fe("strong",{children:"mobile device"})]}),s&&fe(Na,{pendingTransaction:s})]}),n&&fe(Qi,{theme:a?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),fe(Pr,{onClick:o,children:"Not now"}),fe(z,{})]});case"totp":return Or(gp,{children:[fe(S,{onClose:o},"header"),fe(xe,{children:fe(Ge,{children:fe(Cb,{})})}),fe(le,{children:"Enter verification code"}),Or(pr,{children:[fe(hn,{success:t,disabled:r,onChange:i}),Or(de,{children:["To continue, please enter the 6-digit code generated from your"," ",fe("strong",{children:"authenticator app"})]}),s&&fe(Na,{pendingTransaction:s})]}),n&&fe(Qi,{theme:a?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),fe(Pr,{onClick:o,children:"Not now"}),fe(z,{})]});default:return null}};import{useEffect as f1,useState as h1}from"react";import Tb from"styled-components";import{Fragment as _b,jsx as Qr,jsxs as pc}from"react/jsx-runtime";var y1=()=>{let{authenticated:e,logout:t,ready:r,user:o}=F(),{app:n,setModalData:i,navigate:a,resetNavigation:s}=x(),{getAuthMeta:l,initLoginWithOAuth:c,loginWithOAuth:u,updateWallets:f,setReadyToTrue:h,closePrivyModal:g,createAnalyticsEvent:v}=M(),[y,T]=h1(!1),[_,b]=h1(void 0),A=l()?.provider||"google",{name:k,component:N}=Bi(A),R=Js(),I=Oe;f1(()=>{u(A).then(Z=>{T(!0),h(!0),Z&&R("login","onOAuthLoginComplete",Z)}).catch(Z=>{if(Z?.privyErrorCode==="allowlist_rejected"){b(void 0),s(),a("ALLOWLIST_REJECTION_SCREEN");return}if(Z?.privyErrorCode==="max_accounts_reached"){console.error(new cr(Z).toString()),b(void 0),s(),a("USER_LIMIT_REACHED_SCREEN");return}let{retryable:W,detail:q}=im(Z,A);b({retryable:W,detail:q,message:"Authentication failed"}),h(!1)}).finally(()=>{Zo()})},[k,A]),f1(()=>{if(r&&e&&y&&o){if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let W=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},I);return()=>clearTimeout(W)}if(Dt(o,n?.embeddedWallets?.createOnLogin)){let W=setTimeout(()=>{i({createWallet:{onSuccess:()=>{},onFailure:q=>{console.error(q),v({eventName:"embedded_wallet_creation_failure_logout",payload:{error:q,provider:A,screen:"OAuthStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},I);return()=>clearTimeout(W)}else{let W=setTimeout(()=>g({shouldCallAuthOnSuccess:!0,isSuccess:!0}),I);return f(),()=>clearTimeout(W)}}},[r,e,y,o]);let H=y?`Successfully connected with ${k}`:_?_.message:`Verifying connection to ${k}`,G="";return y?G="You\u2019re good to go!":_?G=_.detail:G="Just a few moments more",pc(_b,{children:[Qr(S,{}),Qr(Q,{}),pc(Pb,{children:[Qr(Qe,{children:pc("div",{children:[Qr(Je,{success:y,fail:!!_}),Qr(N,{style:{width:"38px",height:"38px"}})]})}),pc(qe,{children:[Qr("h3",{children:H}),Qr("p",{children:G})]}),_&&_?.retryable?Qr(Vn,{onClick:()=>{Zo(),c(A),b(void 0)},disabled:!y&&!_?.retryable,children:"Retry"}):null]}),Qr(re,{}),Qr(z,{})]})},Pb=Tb.div`
2222
2245
  display: flex;
2223
2246
  flex-direction: column;
2224
2247
  align-items: center;
@@ -2226,17 +2249,17 @@ You will need this password to access your ${e} wallet on a new device. Please k
2226
2249
  margin-left: 27px;
2227
2250
  margin-right: 27px;
2228
2251
  gap: 24px;
2229
- `;import{useEffect as mp,useRef as sb,useState as ig}from"react";import ag from"styled-components";import{Fragment as cb,jsx as po,jsxs as ac}from"react/jsx-runtime";var sg=()=>{let{lastScreen:e,currentScreen:t,navigateBack:r}=A(),{loginWithPasskey:o,closePrivyModal:n}=M(),i=Fe,[a,l]=ig("loading"),[s,c]=ig(null),u=sb([]),h=S=>{u.current=[S,...u.current]};mp(()=>()=>{u.current.forEach(S=>clearTimeout(S)),u.current=[]},[]);let f=()=>{switch(a){case"loading":return"Waiting for passkey";case"success":return"Success";case"error":return"Something went wrong"}},g=()=>{switch(a){case"loading":return`Please follow prompts to verify your passkey.
2230
- 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 $e){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.
2252
+ `;import{useEffect as Cp,useRef as Sb,useState as g1}from"react";import v1 from"styled-components";import{Fragment as xb,jsx as mo,jsxs as uc}from"react/jsx-runtime";var C1=()=>{let{lastScreen:e,currentScreen:t,navigateBack:r}=x(),{loginWithPasskey:o,closePrivyModal:n}=M(),i=Oe,[a,s]=g1("loading"),[l,c]=g1(null),u=Sb([]),f=T=>{u.current=[T,...u.current]};Cp(()=>()=>{u.current.forEach(T=>clearTimeout(T)),u.current=[]},[]);let h=()=>{switch(a){case"loading":return"Waiting for passkey";case"success":return"Success";case"error":return"Something went wrong"}},g=()=>{switch(a){case"loading":return`Please follow prompts to verify your passkey.
2253
+ 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(l instanceof Ke){if(l.privyErrorCode==="cannot_link_more_of_type")return"Cannot link more passkeys to account.";if(l.privyErrorCode==="passkey_not_allowed")return`Passkey request timed out or rejected by user.
2231
2254
  You will have to sign up with another method first to register a passkey for your account.`}return`An unknown error occurred.
2232
- You will have to sign up with another method first to register a passkey for your account.`}},v=()=>{switch(a){case"loading":case"success":return po(N,{onClick:()=>{},disabled:!0,children:"Continue"});case"error":return po(N,{onClick:y,disabled:!1,children:"Retry"})}},y=async()=>{l("loading");try{await o(),l("success")}catch(S){c(S),l("error")}};return mp(()=>{a==="success"&&h(setTimeout(()=>{n({shouldCallAuthOnSuccess:!0,isSuccess:!0})},i))},[a]),mp(()=>{y()},[]),ac(cb,{children:[po(P,{backFn:!e||t===e?void 0:r}),ac(lb,{children:[po(at,{children:ac("div",{children:[po(ot,{success:a==="success",fail:a==="error"}),po(mn,{style:{width:"38px",height:"38px"}})]})}),ac(Ze,{children:[po("h3",{children:f()}),po("p",{style:{whiteSpace:"pre-wrap"},children:g()})]}),v()]}),po(V,{})]})},lb=ag.div`
2255
+ You will have to sign up with another method first to register a passkey for your account.`}},v=()=>{switch(a){case"loading":case"success":return mo(D,{onClick:()=>{},disabled:!0,children:"Continue"});case"error":return mo(D,{onClick:y,disabled:!1,children:"Retry"})}},y=async()=>{s("loading");try{await o(),s("success")}catch(T){c(T),s("error")}};return Cp(()=>{a==="success"&&f(setTimeout(()=>{n({shouldCallAuthOnSuccess:!0,isSuccess:!0})},i))},[a]),Cp(()=>{y()},[]),uc(xb,{children:[mo(S,{backFn:!e||t===e?void 0:r}),uc(Ab,{children:[mo(Qe,{children:uc("div",{children:[mo(Je,{success:a==="success",fail:a==="error"}),mo(fn,{style:{width:"38px",height:"38px"}})]})}),uc(qe,{children:[mo("h3",{children:h()}),mo("p",{style:{whiteSpace:"pre-wrap"},children:g()})]}),v()]}),mo(z,{})]})},Ab=v1.div`
2233
2256
  display: flex;
2234
2257
  flex-direction: column;
2235
2258
  align-items: center;
2236
2259
  justify-content: center;
2237
2260
  gap: 24px;
2238
2261
  width: 100%;
2239
- `,NK=ag.div`
2262
+ `,Cj=v1.div`
2240
2263
  display: flex;
2241
2264
  align-items: center;
2242
2265
  justify-content: center;
@@ -2252,9 +2275,9 @@ You will have to sign up with another method first to register a passkey for you
2252
2275
  stroke: var(--privy-color-accent) !important;
2253
2276
  fill: var(--privy-color-accent) !important;
2254
2277
  }
2255
- `;import{useEffect as pb,useState as cg}from"react";import ub from"styled-components";import{isMobile as db}from"react-device-detect";var lg=(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(!yo()&&db)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${o}?ref=${o}`};import{Fragment as fb,jsx as uo,jsxs as dg}from"react/jsx-runtime";var pg=()=>{let{forkSession:e,ready:t,authenticated:r}=B(),[o,n]=cg(""),[i,a]=cg(!1);pb(()=>{t&&r&&e().then(n)},[t,r]);let l=lg(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."),dg(fb,{children:[uo(P,{},"header"),uo(Q,{}),uo(zr,{title:s.title,description:s.description}),dg(ur,{children:[uo(mb,{children:uo(Fr,{style:{width:"72px",height:"72px"}})}),uo(Ks,{href:l,onClick:()=>{setTimeout(()=>a(!0),1e3)},loading:t&&!l,children:i?"Go to App Store":"Continue"}),s.footnote?uo("p",{children:s.footnote}):null]}),uo(re,{}),uo(q,{protectedByPrivy:!0})]})},mb=ub(_t)`
2278
+ `;import{useEffect as Rb,useState as b1}from"react";import Ib from"styled-components";import{isMobile as kb}from"react-device-detect";var w1=(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(!go()&&kb)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${o}?ref=${o}`};import{Fragment as Wb,jsx as fo,jsxs as E1}from"react/jsx-runtime";var T1=()=>{let{forkSession:e,ready:t,authenticated:r}=F(),[o,n]=b1(""),[i,a]=b1(!1);Rb(()=>{t&&r&&e().then(n)},[t,r]);let s=w1(o,!i),l={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&&(l.description="For the best experience, we'll automatically log you into the Phantom Mobile Wallet in-app browser.",l.footnote="Once you're done, you can always return here and refresh to view your updated account."),i&&(l.title="Still here?",l.description="You may need to install the Phantom mobile app.",l.footnote="Once you're done, you can return here or connect via Phantom's in-app browser."),E1(Wb,{children:[fo(S,{},"header"),fo(Q,{}),fo(qr,{title:l.title,description:l.description}),E1(ur,{children:[fo(Mb,{children:fo(Br,{style:{width:"72px",height:"72px"}})}),fo(Qs,{href:s,onClick:()=>{setTimeout(()=>a(!0),1e3)},loading:t&&!s,children:i?"Go to App Store":"Continue"}),l.footnote?fo("p",{children:l.footnote}):null]}),fo(re,{}),fo($,{protectedByPrivy:!0})]})},Mb=Ib(St)`
2256
2279
  margin: 16px auto;
2257
- `;import hb from"@heroicons/react/24/outline/ShieldCheckIcon";import{useEffect as yb,useState as sc}from"react";import lc,{css as gb}from"styled-components";import{Fragment as Eb,jsx as Rt,jsxs as gn}from"react/jsx-runtime";var ug=()=>{let[e,t]=sc(!0),{authenticated:r,getAccessToken:o}=B(),{walletProxy:n,closePrivyModal:i,createAnalyticsEvent:a}=M(),{navigate:l,data:s,onUserCloseViaDialogOrKeybindRef:c}=A(),[u,h]=sc(void 0),[f,g]=sc(""),[v,y]=sc(!1),{privyWallet:S,onCompleteNavigateTo:_,onSuccess:w,onFailure:x}=s.recoverWallet,k=(R="User exited before their wallet could be recovered")=>{i({shouldCallAuthOnSuccess:!1}),x(typeof R=="string"?new St(R):R)};c.current=k,yb(()=>{if(!r||!S)return k("User must be authenticated and have a Privy wallet before it can be recovered")},[r]);let D=R=>{R&&h(R)};return gn(Eb,{children:[Rt(P,{onClose:k}),Rt(Q,{}),gn(Cb,{children:[gn(vb,{children:[Rt(hb,{height:48,width:48,stroke:"var(--privy-color-accent)"}),Rt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Enter your password"}),Rt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),gn("div",{children:[gn(_o,{children:[Rt(ni,{type:e?"password":"text",onChange:R=>D(R.target.value),disabled:v,style:{paddingRight:"2.3rem"}}),Rt(ii,{style:{right:"0.75rem"},children:e?Rt(ai,{onClick:()=>t(!1)}):Rt(si,{onClick:()=>t(!0)})})]}),!!f&&Rt(wb,{children:f})]}),gn("div",{children:[gn(uf,{children:[Rt("h4",{children:"Why is this necessary?"}),Rt("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),Rt(bb,{loading:v||!n,disabled:!u,onClick:async()=>{y(!0);let R=await o();if(R&&S&&u!==null)try{a({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:S.address}}),await n?.recover({address:S.address,accessToken:R,recoveryPin:u,recoveryMethod:S.recoveryMethod}),g(""),_?l(_):i({shouldCallAuthOnSuccess:!1}),w?.(S),a({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:S.address}})}catch(H){Yf(H)?g("Invalid recovery password, please try again."):g("An error has occurred, please try again.")}finally{y(!1)}else return k("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!S&&v,children:"Recover your account"})]})]}),Rt(re,{}),Rt(q,{protectedByPrivy:!0})]})},vb=lc.div`
2280
+ `;import Lb from"@heroicons/react/24/outline/ShieldCheckIcon";import{useEffect as Ob,useState as mc}from"react";import fc,{css as Nb}from"styled-components";import{Fragment as Hb,jsx as Rt,jsxs as vn}from"react/jsx-runtime";var P1=()=>{let[e,t]=mc(!0),{authenticated:r,getAccessToken:o}=F(),{walletProxy:n,closePrivyModal:i,createAnalyticsEvent:a}=M(),{navigate:s,data:l,onUserCloseViaDialogOrKeybindRef:c}=x(),[u,f]=mc(void 0),[h,g]=mc(""),[v,y]=mc(!1),{privyWallet:T,onCompleteNavigateTo:_,onSuccess:b,onFailure:A}=l.recoverWallet,k=(I="User exited before their wallet could be recovered")=>{i({shouldCallAuthOnSuccess:!1}),A(typeof I=="string"?new _t(I):I)};c.current=k,Ob(()=>{if(!r||!T)return k("User must be authenticated and have a Privy wallet before it can be recovered")},[r]);let N=I=>{I&&f(I)};return vn(Hb,{children:[Rt(S,{onClose:k}),Rt(Q,{}),vn(Ub,{children:[vn(Db,{children:[Rt(Lb,{height:48,width:48,stroke:"var(--privy-color-accent)"}),Rt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Enter your password"}),Rt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),vn("div",{children:[vn(So,{children:[Rt(li,{type:e?"password":"text",onChange:I=>N(I.target.value),disabled:v,style:{paddingRight:"2.3rem"}}),Rt(ci,{style:{right:"0.75rem"},children:e?Rt(di,{onClick:()=>t(!1)}):Rt(pi,{onClick:()=>t(!0)})})]}),!!h&&Rt(Fb,{children:h})]}),vn("div",{children:[vn(Cf,{children:[Rt("h4",{children:"Why is this necessary?"}),Rt("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),Rt(Bb,{loading:v||!n,disabled:!u,onClick:async()=>{y(!0);let I=await o();if(I&&T&&u!==null)try{a({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:T.address}}),await n?.recover({address:T.address,accessToken:I,recoveryPin:u,recoveryMethod:T.recoveryMethod}),g(""),_?s(_):i({shouldCallAuthOnSuccess:!1}),b?.(T),a({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:T.address}})}catch(H){sh(H)?g("Invalid recovery password, please try again."):g("An error has occurred, please try again.")}finally{y(!1)}else return k("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!T&&v,children:"Recover your account"})]})]}),Rt(re,{}),Rt($,{protectedByPrivy:!0})]})},Db=fc.div`
2258
2281
  display: flex;
2259
2282
  flex-direction: column;
2260
2283
  align-items: center;
@@ -2276,45 +2299,45 @@ You will have to sign up with another method first to register a passkey for you
2276
2299
  font-weight: 400;
2277
2300
  line-height: 20px;
2278
2301
  }
2279
- `,Cb=lc.div`
2302
+ `,Ub=fc.div`
2280
2303
  display: flex;
2281
2304
  flex-direction: column;
2282
2305
  justify-content: space-between;
2283
- `,wb=lc.div`
2306
+ `,Fb=fc.div`
2284
2307
  line-height: 20px;
2285
2308
  height: 20px;
2286
2309
  font-size: 13px;
2287
2310
  color: var(--privy-color-error);
2288
2311
  text-align: left;
2289
2312
  margin-top: 0.5rem;
2290
- `,bb=lc(N)`
2291
- ${e=>e.hideAnimations&&gb`
2313
+ `,Bb=fc(D)`
2314
+ ${e=>e.hideAnimations&&Nb`
2292
2315
  && {
2293
2316
  // Remove animations because the recoverWallet task on the iframe partially
2294
2317
  // blocks the renderer, so the animation stutters and doesn't look good
2295
2318
  transition: none;
2296
2319
  }
2297
2320
  `}
2298
- `;import{useCallback as Tb,useEffect as gg,useState as fp}from"react";import{jsx as cc,jsxs as mg}from"react/jsx-runtime";var dc=e=>mg("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 21 20",...e,children:[cc("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"}),cc("defs",{children:mg("linearGradient",{id:"icloud-gradient",x1:19.086,x2:3.333,y1:14.38,y2:14.163,gradientUnits:"userSpaceOnUse",children:[cc("stop",{stopColor:"#3E82F4"}),cc("stop",{offset:1,stopColor:"#93DCF7"})]})})]});import{jsx as mo,jsxs as fg}from"react/jsx-runtime";var pc=({style:e,...t})=>fg("svg",{width:"16",height:"14",style:e,viewBox:"0 0 16 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[fg("g",{clipPath:"url(#clip0_2115_829)",children:[mo("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"}),mo("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"}),mo("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"}),mo("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"}),mo("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"}),mo("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"})]}),mo("defs",{children:mo("clipPath",{id:"clip0_2115_829",children:mo("rect",{width:"16",height:"14",fill:"white"})})})]});import hg from"styled-components";var Ma=hg.div`
2321
+ `;import{useCallback as Gb,useEffect as k1,useState as wp}from"react";import{jsx as hc,jsxs as _1}from"react/jsx-runtime";var yc=e=>_1("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 21 20",...e,children:[hc("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"}),hc("defs",{children:_1("linearGradient",{id:"icloud-gradient",x1:19.086,x2:3.333,y1:14.38,y2:14.163,gradientUnits:"userSpaceOnUse",children:[hc("stop",{stopColor:"#3E82F4"}),hc("stop",{offset:1,stopColor:"#93DCF7"})]})})]});import{jsx as ho,jsxs as S1}from"react/jsx-runtime";var gc=({style:e,...t})=>S1("svg",{width:"16",height:"14",style:e,viewBox:"0 0 16 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[S1("g",{clipPath:"url(#clip0_2115_829)",children:[ho("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"}),ho("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"}),ho("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"}),ho("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"}),ho("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"}),ho("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"})]}),ho("defs",{children:ho("clipPath",{id:"clip0_2115_829",children:ho("rect",{width:"16",height:"14",fill:"white"})})})]});import A1 from"styled-components";var Ua=A1.div`
2299
2322
  display: flex;
2300
2323
  flex-direction: column;
2301
2324
  gap: 12px;
2302
2325
  padding-top: 24px;
2303
2326
  padding-bottom: 24px;
2304
- `,yg=hg.div`
2327
+ `,x1=A1.div`
2305
2328
  padding-bottom: 24px;
2306
- `;import{Fragment as Cg,jsx as No,jsxs as uc}from"react/jsx-runtime";var vg={"google-drive":{name:"Google Drive",component:pc},icloud:{name:"iCloud",component:dc}},wg=()=>{let{logout:e}=B(),{navigate:t,setModalData:r,data:o}=A(),{recoveryOAuthFlow:n,closePrivyModal:i,createAnalyticsEvent:a}=M(),[l,s]=fp(!1),{provider:c,action:u,isInAccountCreateFlow:h}=o?.recoveryOAuthStatus,[f,g]=fp(void 0),[v,y]=fp(u==="create-wallet");if(c==="user-passcode")throw new Error("RecoveryOAuthScreen should never be called with a wallet that specifies recoveryMethod: `user-passcode`");let S=vg[c].name,_=vg[c].component,w=o?.recoverWallet?.onCompleteNavigateTo,x=new Ve(async(Y="create-wallet")=>(y(!0),new Promise((W,G)=>{setTimeout(async()=>{try{let L=window.open();await n(c,Y,L),s(!0),W()}catch{g({message:`${Y==="recover"?"Recovery":"Back up"} with ${S} unsuccessful`,detail:u==="recover"?`Please verify that you are selecting the ${S} account associated with your backup.`:"",retryable:!0}),G()}},0)})));gg(()=>{u!=="recover"&&x.execute(h?"create-wallet":"set-recovery")},[]),gg(()=>{if(!l)return;let Y=setTimeout(()=>{h?(r({createWallet:{onSuccess:()=>{},onFailure:W=>{a({eventName:"embedded_wallet_creation_failure_logout",payload:{error:W,screen:"RecoveryOAuthScreen"}}),e()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_CREATED_SCREEN")):i({shouldCallAuthOnSuccess:!1})},Fe);return()=>clearTimeout(Y)},[l]);let k=Tb(async()=>{await x.execute("recover"),w?t(w):s(!0)},[]),D=c==="google-drive"?"Google Drive":"Apple iCloud",I=u==="recover"?"recovered":"backed up",R=u==="recover"?"Recovering":"Backing up",H=l&&`Successfully ${I} with ${D}.`||f&&f.message||`${R} with ${D}...`,K=f?f.detail:"";return uc(Cg,{children:[No(P,{}),v?No(Cg,{children:uc(Ma,{children:[No(ke,{title:H,icon:No(_,{style:{width:"38px",height:"38px"}}),description:K}),f&&f?.retryable?No(N,{onClick:()=>{Zo(),g(void 0),u==="create-wallet"?x.execute("create-wallet"):k()},disabled:!l&&!f?.retryable,children:"Try again"}):null]})}):uc(Ma,{children:[No(ke,{title:"Confirm it's really you",icon:No(_,{style:{height:42,width:48}}),description:`To confirm your identity, please log in to ${D} where your account is backed up.`}),uc(N,{onClick:k,children:["Confirm with ",D]})]}),No(q,{protectedByPrivy:!0})]})};import{useEffect as bg,useState as Wa}from"react";import{jsx as Pb}from"react/jsx-runtime";var Eg=()=>{let{app:e,navigate:t,data:r,onUserCloseViaDialogOrKeybindRef:o}=A(),[n,i]=Wa(""),[a,l]=Wa(!1),[s,c]=Wa(),[u,h]=Wa(null),{authenticated:f}=B(),{closePrivyModal:g,isNewUserThisSession:v,initializeWalletProxy:y}=M(),{onSuccess:S,onFailure:_,callAuthOnSuccessOnClose:w}=r.createWallet,{createWallet:x}=hl(),[k,D]=Wa(null),I=new Ve(async()=>{try{let K=await x(s);if(!K)return;D(K),v?t("EMBEDDED_WALLET_CREATED_SCREEN"):(S(K),g({shouldCallAuthOnSuccess:w}))}catch(K){i(K.message)}});bg(()=>{u||y(3e4).then(K=>h(K))},[u]),bg(()=>{if(!f){t("LANDING"),_(new Error("User must be authenticated before creating a Privy wallet"));return}},[f]);let R=()=>{k&&k?.recoveryMethod!=="user-passcode"?(_(new St("User created a wallet but failed to set a password for it")),g({shouldCallAuthOnSuccess:!1})):k?(S(k),g({shouldCallAuthOnSuccess:w})):(_(new St("User wallet creation failed")),g({shouldCallAuthOnSuccess:!1}))};o.current=()=>null;let H=async()=>{l(!0);let K=250;return I.execute().then(()=>new Promise(Y=>setTimeout(Y,K))).finally(()=>l(!1))};return Pb(Cl,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:!u,buttonLoading:a,buttonHideAnimations:!k&&a,isResettingPassword:!1,error:n,password:s||"",onClose:R,onPasswordChange:c,onPasswordGenerate:()=>c(vl()),onSubmit:H})};import Sb from"@heroicons/react/24/outline/LockClosedIcon";import _b from"@heroicons/react/24/outline/PencilSquareIcon";import xb from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import{useState as Ab}from"react";import kb from"styled-components";import{Fragment as yp,jsx as lt,jsxs as Do}from"react/jsx-runtime";var hp=kb.div`
2329
+ `;import{Fragment as I1,jsx as No,jsxs as vc}from"react/jsx-runtime";var R1={"google-drive":{name:"Google Drive",component:gc},icloud:{name:"iCloud",component:yc}},M1=()=>{let{logout:e}=F(),{navigate:t,setModalData:r,data:o}=x(),{recoveryOAuthFlow:n,closePrivyModal:i,createAnalyticsEvent:a}=M(),[s,l]=wp(!1),{provider:c,action:u,isInAccountCreateFlow:f}=o?.recoveryOAuthStatus,[h,g]=wp(void 0),[v,y]=wp(u==="create-wallet");if(c==="user-passcode")throw new Error("RecoveryOAuthScreen should never be called with a wallet that specifies recoveryMethod: `user-passcode`");let T=R1[c].name,_=R1[c].component,b=o?.recoverWallet?.onCompleteNavigateTo,A=new Fe(async(Z="create-wallet")=>(y(!0),new Promise((W,q)=>{setTimeout(async()=>{try{let L=window.open();await n(c,Z,L),l(!0),W()}catch{g({message:`${Z==="recover"?"Recovery":"Back up"} with ${T} unsuccessful`,detail:u==="recover"?`Please verify that you are selecting the ${T} account associated with your backup.`:"",retryable:!0}),q()}},0)})));k1(()=>{u!=="recover"&&A.execute(f?"create-wallet":"set-recovery")},[]),k1(()=>{if(!s)return;let Z=setTimeout(()=>{f?(r({createWallet:{onSuccess:()=>{},onFailure:W=>{a({eventName:"embedded_wallet_creation_failure_logout",payload:{error:W,screen:"RecoveryOAuthScreen"}}),e()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_CREATED_SCREEN")):i({shouldCallAuthOnSuccess:!1})},Oe);return()=>clearTimeout(Z)},[s]);let k=Gb(async()=>{await A.execute("recover"),b?t(b):l(!0)},[]),N=c==="google-drive"?"Google Drive":"Apple iCloud",R=u==="recover"?"recovered":"backed up",I=u==="recover"?"Recovering":"Backing up",H=s&&`Successfully ${R} with ${N}.`||h&&h.message||`${I} with ${N}...`,G=h?h.detail:"";return vc(I1,{children:[No(S,{}),v?No(I1,{children:vc(Ua,{children:[No(ke,{title:H,icon:No(_,{style:{width:"38px",height:"38px"}}),description:G}),h&&h?.retryable?No(D,{onClick:()=>{Zo(),g(void 0),u==="create-wallet"?A.execute("create-wallet"):k()},disabled:!s&&!h?.retryable,children:"Try again"}):null]})}):vc(Ua,{children:[No(ke,{title:"Confirm it's really you",icon:No(_,{style:{height:42,width:48}}),description:`To confirm your identity, please log in to ${N} where your account is backed up.`}),vc(D,{onClick:k,children:["Confirm with ",N]})]}),No($,{protectedByPrivy:!0})]})};import{useEffect as W1,useState as Fa}from"react";import{jsx as Vb}from"react/jsx-runtime";var L1=()=>{let{app:e,navigate:t,data:r,onUserCloseViaDialogOrKeybindRef:o}=x(),[n,i]=Fa(""),[a,s]=Fa(!1),[l,c]=Fa(),[u,f]=Fa(null),{authenticated:h}=F(),{closePrivyModal:g,isNewUserThisSession:v,initializeWalletProxy:y}=M(),{onSuccess:T,onFailure:_,callAuthOnSuccessOnClose:b}=r.createWallet,{createWallet:A}=bl(),[k,N]=Fa(null),R=new Fe(async()=>{try{let G=await A(l);if(!G)return;N(G),v?t("EMBEDDED_WALLET_CREATED_SCREEN"):(T(G),g({shouldCallAuthOnSuccess:b}))}catch(G){i(G.message)}});W1(()=>{u||y(3e4).then(G=>f(G))},[u]),W1(()=>{if(!h){t("LANDING"),_(new Error("User must be authenticated before creating a Privy wallet"));return}},[h]);let I=()=>{k&&k?.recoveryMethod!=="user-passcode"?(_(new _t("User created a wallet but failed to set a password for it")),g({shouldCallAuthOnSuccess:!1})):k?(T(k),g({shouldCallAuthOnSuccess:b})):(_(new _t("User wallet creation failed")),g({shouldCallAuthOnSuccess:!1}))};o.current=()=>null;let H=async()=>{s(!0);let G=250;return R.execute().then(()=>new Promise(Z=>setTimeout(Z,G))).finally(()=>s(!1))};return Vb(_l,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:!u,buttonLoading:a,buttonHideAnimations:!k&&a,isResettingPassword:!1,error:n,password:l||"",onClose:I,onPasswordChange:c,onPasswordGenerate:()=>c(Pl()),onSubmit:H})};import zb from"@heroicons/react/24/outline/LockClosedIcon";import qb from"@heroicons/react/24/outline/PencilSquareIcon";import $b from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import{useState as Kb}from"react";import jb from"styled-components";import{Fragment as Ep,jsx as ct,jsxs as Do}from"react/jsx-runtime";var bp=jb.div`
2307
2330
  width: 24px;
2308
2331
  height: 24px;
2309
2332
  display: flex;
2310
2333
  justify-content: center;
2311
2334
  align-items: center;
2312
- `,Rb={"google-drive":"Google Drive",icloud:"iCloud","user-passcode":"password",privy:"Privy"},Ib=({onClose:e})=>Do(yg,{children:[lt(ke,{title:"Why do I need to secure my account?",icon:lt(xb,{width:48}),description:Do(yp,{children:[lt("p",{children:"Your app uses cryptography to secure your account. App secrets are split and encrypted so only you can access them."}),lt("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."})]})}),lt(N,{onClick:e,children:"Select backup method"})]}),Tg=()=>{let[e,t]=Ab(!1),{navigate:r,setModalData:o,data:n}=A(),{user:i}=B(),{embeddedWallets:a}=yt(),l=xe(i),s=l===null,{isInAccountCreateFlow:c,isResettingPassword:u}=n.recoverySelection,h=l?.recoveryMethod!=="privy",f=h?"Update backup method":"Secure your account",g=h?Do("span",{children:["Your account is currently secured using"," ",lt("strong",{children:Rb[l?.recoveryMethod||"user-passcode"]}),"."]}):"Select a method for logging in on new devices and recovering your account.";function v(y){o({recoveryOAuthStatus:{provider:y,action:s?"create-wallet":"set-recovery",isInAccountCreateFlow:c}}),r("EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN")}return Do(yp,{children:[lt(P,{backFn:e?()=>t(!1):void 0,infoFn:e?void 0:()=>t(!0)},"header"),e?lt(Ib,{onClose:()=>t(!1)}):Do(yp,{children:[lt(ke,{title:f,icon:lt(Sb,{width:48}),description:g}),lt(Ma,{children:a.userOwnedRecoveryOptions.filter(y=>["icloud","google-drive"].includes(l?.recoveryMethod||"")?y!==l?.recoveryMethod:!0).sort().map(y=>{switch(y){case"google-drive":return Do(Te,{onClick:()=>v("google-drive"),children:[lt(hp,{children:lt(pc,{style:{width:18}})}),"Back up to Google Drive"]},y);case"icloud":return Do(Te,{onClick:()=>v("icloud"),children:[lt(hp,{children:lt(dc,{style:{width:24}})}),"Back up to Apple iCloud"]},y);case"user-passcode":return Do(Te,{onClick:()=>{let S=yd({isCreatingWallet:s,skipSplashScreen:!0});r(S)},children:[lt(hp,{children:lt(_b,{style:{width:18}})}),u?"Reset your":"Set a"," password"]},y);default:return null}})})]}),lt(q,{protectedByPrivy:!0})]})};import{BigNumber as Mg}from"@ethersproject/bignumber";import{useMemo as r8,useEffect as Wg,useState as ir}from"react";import bi from"styled-components";function Pg(e){return e.to&&e.data?"CONTRACT_CALL":e.to&&e.value?"SEND":"UNKNOWN"}import{ExclamationCircleIcon as Wb,ClipboardDocumentIcon as Lb,ClipboardDocumentCheckIcon as Ob}from"@heroicons/react/24/outline";import{useState as Nb}from"react";import nr from"styled-components";import{ErrorCode as mc}from"@ethersproject/logger";var Mb=new Set([mc.CALL_EXCEPTION,mc.NONCE_EXPIRED,mc.REPLACEMENT_UNDERPRICED,mc.TRANSACTION_REPLACED]),Sg=e=>{let t;return e.code&&e.code!==-32e3&&Mb.has(e.code)&&(t=e.transactionHash),t},_g=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 Zb,jsx as Tt,jsxs as vn}from"react/jsx-runtime";var Db=e=>{let t=e.code?e.code?.toString().charAt(0)+e.code?.toString().slice(1).replace("_"," ").toLowerCase():"Something went wrong.",r=Sg(e),o=_g(e);return{errorCode:t,transactionHash:r,errorMessage:o}},Ub=()=>vn(Gb,{children:[Tt(zb,{}),Tt(Vb,{})]}),Rg=({transactionError:e,chainId:t,onClose:r,onRetry:o})=>{let{chains:n}=M(),[i,a]=Nb(!1),{errorCode:l,transactionHash:s,errorMessage:c}=Db(e),u=n.find(h=>h.id===t)?.blockExplorers?.default.url??"https://etherscan.io";return vn(Zb,{children:[Tt(P,{onClose:r}),vn(Fb,{children:[Tt(Ub,{}),Tt(Bb,{children:l}),Tt(Hb,{children:"Please try again."}),vn(Ag,{children:[Tt(xg,{children:"Error message"}),Tt(kg,{clickable:!1,children:c})]}),s&&vn(Ag,{children:[Tt(xg,{children:"Transaction hash"}),vn($b,{children:["Copy this hash to view details about the transaction on a"," ",Tt("u",{children:Tt("a",{href:u,children:"block explorer"})}),"."]}),vn(kg,{clickable:!0,onClick:async()=>{await navigator.clipboard.writeText(s),a(!0)},children:[s,Tt(Yb,{clicked:i})]})]}),Tt(qb,{onClick:()=>o({resetNonce:!!s}),children:"Retry transaction"})]}),Tt(V,{})]})},Fb=nr.div`
2335
+ `,Yb={"google-drive":"Google Drive",icloud:"iCloud","user-passcode":"password",privy:"Privy"},Zb=({onClose:e})=>Do(x1,{children:[ct(ke,{title:"Why do I need to secure my account?",icon:ct($b,{width:48}),description:Do(Ep,{children:[ct("p",{children:"Your app uses cryptography to secure your account. App secrets are split and encrypted so only you can access them."}),ct("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."})]})}),ct(D,{onClick:e,children:"Select backup method"})]}),O1=()=>{let[e,t]=Kb(!1),{navigate:r,setModalData:o,data:n}=x(),{user:i}=F(),{embeddedWallets:a}=it(),s=Ae(i),l=s===null,{isInAccountCreateFlow:c,isResettingPassword:u}=n.recoverySelection,f=s?.recoveryMethod!=="privy",h=f?"Update backup method":"Secure your account",g=f?Do("span",{children:["Your account is currently secured using"," ",ct("strong",{children:Yb[s?.recoveryMethod||"user-passcode"]}),"."]}):"Select a method for logging in on new devices and recovering your account.";function v(y){o({recoveryOAuthStatus:{provider:y,action:l?"create-wallet":"set-recovery",isInAccountCreateFlow:c}}),r("EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN")}return Do(Ep,{children:[ct(S,{backFn:e?()=>t(!1):void 0,infoFn:e?void 0:()=>t(!0)},"header"),e?ct(Zb,{onClose:()=>t(!1)}):Do(Ep,{children:[ct(ke,{title:h,icon:ct(zb,{width:48}),description:g}),ct(Ua,{children:a.userOwnedRecoveryOptions.filter(y=>["icloud","google-drive"].includes(s?.recoveryMethod||"")?y!==s?.recoveryMethod:!0).sort().map(y=>{switch(y){case"google-drive":return Do(Te,{onClick:()=>v("google-drive"),children:[ct(bp,{children:ct(gc,{style:{width:18}})}),"Back up to Google Drive"]},y);case"icloud":return Do(Te,{onClick:()=>v("icloud"),children:[ct(bp,{children:ct(yc,{style:{width:24}})}),"Back up to Apple iCloud"]},y);case"user-passcode":return Do(Te,{onClick:()=>{let T=Ed({isCreatingWallet:l,skipSplashScreen:!0});r(T)},children:[ct(bp,{children:ct(qb,{style:{width:18}})}),u?"Reset your":"Set a"," password"]},y);default:return null}})})]}),ct($,{protectedByPrivy:!0})]})};import{BigNumber as z1}from"@ethersproject/bignumber";import{useMemo as b8,useEffect as q1,useState as ar}from"react";import _i from"styled-components";function N1(e){return e.to&&e.data?"CONTRACT_CALL":e.to&&e.value?"SEND":"UNKNOWN"}import{ExclamationCircleIcon as Qb,ClipboardDocumentIcon as Xb,ClipboardDocumentCheckIcon as e8}from"@heroicons/react/24/outline";import{useState as t8}from"react";import ir from"styled-components";import{ErrorCode as Cc}from"@ethersproject/logger";var Jb=new Set([Cc.CALL_EXCEPTION,Cc.NONCE_EXPIRED,Cc.REPLACEMENT_UNDERPRICED,Cc.TRANSACTION_REPLACED]),D1=e=>{let t;return e.code&&e.code!==-32e3&&Jb.has(e.code)&&(t=e.transactionHash),t},U1=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 h8,jsx as Tt,jsxs as Cn}from"react/jsx-runtime";var r8=e=>{let t=e.code?e.code?.toString().charAt(0)+e.code?.toString().slice(1).replace("_"," ").toLowerCase():"Something went wrong.",r=D1(e),o=U1(e);return{errorCode:t,transactionHash:r,errorMessage:o}},o8=()=>Cn(s8,{children:[Tt(c8,{}),Tt(l8,{})]}),G1=({transactionError:e,chainId:t,onClose:r,onRetry:o})=>{let{chains:n}=M(),[i,a]=t8(!1),{errorCode:s,transactionHash:l,errorMessage:c}=r8(e),u=n.find(f=>f.id===t)?.blockExplorers?.default.url??"https://etherscan.io";return Cn(h8,{children:[Tt(S,{onClose:r}),Cn(n8,{children:[Tt(o8,{}),Tt(i8,{children:s}),Tt(a8,{children:"Please try again."}),Cn(B1,{children:[Tt(F1,{children:"Error message"}),Tt(H1,{clickable:!1,children:c})]}),l&&Cn(B1,{children:[Tt(F1,{children:"Transaction hash"}),Cn(p8,{children:["Copy this hash to view details about the transaction on a"," ",Tt("u",{children:Tt("a",{href:u,children:"block explorer"})}),"."]}),Cn(H1,{clickable:!0,onClick:async()=>{await navigator.clipboard.writeText(l),a(!0)},children:[l,Tt(f8,{clicked:i})]})]}),Tt(d8,{onClick:()=>o({resetNonce:!!l}),children:"Retry transaction"})]}),Tt(z,{})]})},n8=ir.div`
2313
2336
  display: flex;
2314
2337
  flex-direction: column;
2315
2338
  align-items: center;
2316
2339
  justify-content: center;
2317
- `,Bb=nr.span`
2340
+ `,i8=ir.span`
2318
2341
  color: var(--privy-color-foreground);
2319
2342
  text-align: center;
2320
2343
  font-size: 1.125rem;
@@ -2322,7 +2345,7 @@ You will have to sign up with another method first to register a passkey for you
2322
2345
  line-height: 1.25rem; /* 111.111% */
2323
2346
  text-align: center;
2324
2347
  margin: 10px;
2325
- `,Hb=nr.span`
2348
+ `,a8=ir.span`
2326
2349
  margin-top: 4px;
2327
2350
  margin-bottom: 10px;
2328
2351
  color: var(--privy-color-foreground-3);
@@ -2333,7 +2356,7 @@ You will have to sign up with another method first to register a passkey for you
2333
2356
  font-weight: 400;
2334
2357
  line-height: 20px; /* 142.857% */
2335
2358
  letter-spacing: -0.008px;
2336
- `,Gb=nr.div`
2359
+ `,s8=ir.div`
2337
2360
  position: relative;
2338
2361
  width: 60px;
2339
2362
  height: 60px;
@@ -2341,37 +2364,37 @@ You will have to sign up with another method first to register a passkey for you
2341
2364
  display: flex;
2342
2365
  justify-content: center;
2343
2366
  align-items: center;
2344
- `,Vb=nr(Wb)`
2367
+ `,l8=ir(Qb)`
2345
2368
  position: absolute;
2346
2369
  width: 35px;
2347
2370
  height: 35px;
2348
2371
  color: var(--privy-color-error);
2349
- `,zb=nr.div`
2372
+ `,c8=ir.div`
2350
2373
  position: absolute;
2351
2374
  width: 60px;
2352
2375
  height: 60px;
2353
2376
  border-radius: 50%;
2354
2377
  background-color: var(--privy-color-error);
2355
2378
  opacity: 0.1;
2356
- `,qb=nr(N)`
2379
+ `,d8=ir(D)`
2357
2380
  && {
2358
2381
  margin-top: 24px;
2359
2382
  }
2360
2383
  transition: color 350ms ease, background-color 350ms ease;
2361
- `,xg=nr.span`
2384
+ `,F1=ir.span`
2362
2385
  width: 100%;
2363
2386
  text-align: left;
2364
2387
  font-size: 0.825rem;
2365
2388
  color: var(--privy-color-foreground);
2366
2389
  padding: 4px;
2367
- `,Ag=nr.div`
2390
+ `,B1=ir.div`
2368
2391
  width: 100%;
2369
2392
  margin: 5px;
2370
2393
  display: flex;
2371
2394
  flex-direction: column;
2372
2395
  justify-content: center;
2373
2396
  align-items: center;
2374
- `,$b=nr.text`
2397
+ `,p8=ir.text`
2375
2398
  position: relative;
2376
2399
  width: 100%;
2377
2400
  padding: 5px;
@@ -2379,7 +2402,7 @@ You will have to sign up with another method first to register a passkey for you
2379
2402
  color: var(--privy-color-foreground-3);
2380
2403
  text-align: left;
2381
2404
  word-wrap: break-word;
2382
- `,kg=nr.span`
2405
+ `,H1=ir.span`
2383
2406
  position: relative;
2384
2407
  width: 100%;
2385
2408
  background-color: var(--privy-color-background-2);
@@ -2397,65 +2420,65 @@ You will have to sign up with another method first to register a passkey for you
2397
2420
  &:hover {
2398
2421
  background-color: var(--privy-color-foreground-4);
2399
2422
  }`}
2400
- `,Kb=nr(Lb)`
2423
+ `,u8=ir(Xb)`
2401
2424
  position: absolute;
2402
2425
  top: 13px;
2403
2426
  right: 13px;
2404
2427
  width: 24px;
2405
2428
  height: 24px;
2406
- `,jb=nr(Ob)`
2429
+ `,m8=ir(e8)`
2407
2430
  position: absolute;
2408
2431
  top: 13px;
2409
2432
  right: 13px;
2410
2433
  width: 24px;
2411
2434
  height: 24px;
2412
- `,Yb=({clicked:e})=>e?Tt(jb,{}):Tt(Kb,{});import{BigNumber as gp}from"@ethersproject/bignumber";import Jb from"styled-components";import{Fragment as e8,jsx as La,jsxs as t8}from"react/jsx-runtime";var Qb=(e,t)=>{if(e.gasUsed&&e.effectiveGasPrice)try{let r=gp.from(e.gasUsed),o=gp.from(e.effectiveGasPrice),n=r.mul(o);if(t){let i=gp.from(t);n=n.add(i)}return n.toString()}catch{return}else return},Ig=({txn:e,receipt:t,transactionInfo:r,onClose:o,tokenPrice:n,tokenSymbol:i,l1GasEstimate:a,receiptHeader:l,receiptDescription:s})=>t8(e8,{children:[La(P,{onClose:o}),La(Yi,{title:l??"Transaction complete!",description:s??"You're all set."}),La(fi,{tokenPrice:n,from:t.from,to:t.to,gas:Qb(t,a),txn:e,transactionInfo:r,tokenSymbol:i}),La(Xb,{loading:!1,onClick:o,children:"All Done"}),La(V,{})]}),Xb=Jb(N)`
2435
+ `,f8=({clicked:e})=>e?Tt(m8,{}):Tt(u8,{});import{BigNumber as Tp}from"@ethersproject/bignumber";import y8 from"styled-components";import{Fragment as C8,jsx as Ba,jsxs as w8}from"react/jsx-runtime";var g8=(e,t)=>{if(e.gasUsed&&e.effectiveGasPrice)try{let r=Tp.from(e.gasUsed),o=Tp.from(e.effectiveGasPrice),n=r.mul(o);if(t){let i=Tp.from(t);n=n.add(i)}return n.toString()}catch{return}else return},V1=({txn:e,receipt:t,transactionInfo:r,onClose:o,tokenPrice:n,tokenSymbol:i,l1GasEstimate:a,receiptHeader:s,receiptDescription:l})=>w8(C8,{children:[Ba(S,{onClose:o}),Ba(ta,{title:s??"Transaction complete!",description:l??"You're all set."}),Ba(vi,{tokenPrice:n,from:t.from,to:t.to,gas:g8(t,a),txn:e,transactionInfo:r,tokenSymbol:i}),Ba(v8,{loading:!1,onClick:o,children:"All Done"}),Ba(z,{})]}),v8=y8(D)`
2413
2436
  && {
2414
2437
  margin-top: 24px;
2415
2438
  }
2416
2439
  transition: color 350ms ease, background-color 350ms ease;
2417
- `;import{Fragment as vp,jsx as ht,jsxs as wi}from"react/jsx-runtime";var o8=({txn:e,txnFamily:t,uiOptions:r,tokenSymbol:o,tokenPrice:n})=>{if(t==="CONTRACT_CALL"){if(r.transactionInfo?.contractInfo)return ht(ep,{contractInfo:r.transactionInfo.contractInfo,description:r.description});if(r.senderInfo)return ht(ep,{contractInfo:r.senderInfo,description:r.description||r.senderInfo.actionText})}return ht(vp,{children:ht(F1,{description:r.description||r.transactionInfo?.description||"",txn:e,tokenSymbol:o,tokenPrice:n})})},Og=()=>{let{authenticated:e,getAccessToken:t}=B(),{wallets:r}=ka(),{walletProxy:o,closePrivyModal:n,getFiatOnRampConfig:i,rpcConfig:a,chains:l,nativeTokenSymbolForChainId:s,appId:c}=M(),{app:u,navigate:h,data:f,onUserCloseViaDialogOrKeybindRef:g,setModalData:v}=A(),{transactionRequest:y,onSuccess:S,onFailure:_,uiOptions:w,fundWalletConfig:x}=f.sendTransaction,[k,D]=ir(null),[I,R]=ir(null),[H,K]=ir(""),[Y,W]=ir(),[G,L]=ir(),[ae,pe]=ir(!1),ue=()=>{K(""),W(void 0),L(void 0)},be=(je,Ye,Tn)=>{K(je),W(new ze(new jt(Ye??je,Tn??ut.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))},[X,Pt]=ir(!1),[et,Mt]=ir(!0),[rt,ar]=ir(null),[Ie,Ke]=ir(y),{tokenPrice:sr,isTokenPriceLoading:Wt}=nc(Ie),qe=s(y.chainId)||"ETH",[O,Ho]=ir(null),[Se,J]=ir(null),[ee,ve]=ir(!0);Wg(()=>{e||(h("LANDING"),_(new Error("User must be authenticated before transacting with a Privy wallet")))},[e]);let Ne=y.from?r.find(je=>je.address===y.from):r.find(je=>je.walletClientType==="privy"&&!je.imported),vc=async()=>{if(!Ne)return console.warn("No privy wallet found, cannot fund wallet.");let{signedUrl:je,externalTransactionId:Ye}=await i(Ne.address,{config:x?.config||{}});v({fiatOnRampPrompt:{signedUrl:je},fiatOnRampStatus:{externalTransactionId:Ye}}),h("FIAT_ON_RAMP_PROMPT_SCREEN")},wn=r8(()=>to(Ie.chainId,l,a,{appId:c}),[Ie.chainId,a]);async function Da(je){let Ye=je;if(!await t()||!o||!Ne)return;try{Ye=await vi(Ne.address,je,wn),Ke(Ye)}catch(Xr){console.error(Xr),be("There was an error preparing your transaction. Your transaction request will likely fail.",Xr.reason)}let Go=Mg.from(0),Vo=Mg.from(0);try{({totalGasEstimate:Go,l1ExecutionFeeEstimate:Vo}=await gi(Ye,wn)),Ho(Go.toHexString()),J(Vo.toHexString())}catch{Ho(null)}try{let{balance:Xr,hasSufficientFunds:Ua}=await rc(Ne.address,Ye,Go,wn);ar(Xr.toHexString()),Ua||(Mt(!1),be("Wallet has insufficient funds on this network for this transaction."),u?.fiatOnRamp.enabled&&pe(!0))}catch(Xr){console.warn(`Failed to fetch wallet balance with error: ${Xr}`)}ve(!1)}Wg(()=>{Da(Ie)},[o]);let bn=Pg(Ie),En=bn==="SEND"?`Send ${qe}`:"Review transaction",_i={modalTitle:w.header||w.modalTitle||En,buttonText:w.buttonText||"Submit"},De=()=>{X||(I?S(I):_(Y||new ze(new jt("The user rejected the request",ut.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}))};return g.current=De,sr===void 0&&Wt||ee?wi(vp,{children:[w.transactionInfo?.contractInfo?.imgUrl&&ht(xs,{src:w.transactionInfo?.contractInfo?.imgUrl}),ht(P,{title:_i.modalTitle,onClose:De}),ht(Lg,{children:ht(Qn,{})})]}):k!==null?ht(Ig,{txn:Ie,onClose:De,receipt:k,transactionInfo:w.transactionInfo,tokenPrice:sr,tokenSymbol:qe,l1GasEstimate:Se,receiptHeader:w.successHeader,receiptDescription:w.successDescription}):G?ht(Rg,{transactionError:G,chainId:Ie.chainId,onClose:De,onRetry:({resetNonce:je})=>{ue();let Ye=Ie;je&&(Ye={...Ie,nonce:void 0}),Da(Ye)}}):wi(vp,{children:[ht(P,{title:_i.modalTitle,onClose:De}),wi(Lg,{children:[wi(s8,{children:[ht(o8,{txn:Ie,txnFamily:bn,uiOptions:w,tokenSymbol:qe,tokenPrice:sr}),Ne?ht(fi,{from:Ne.address,to:Ie.to,txn:Ie,transactionInfo:w.transactionInfo,gas:O||void 0,tokenPrice:sr,tokenSymbol:qe}):null]}),wi(l8,{children:[ht(n8,{children:H}),ht(O1,{txn:Ie,address:Ne?.address??"",hasFunds:et,balance:rt}),wi(i8,{children:[ae&&ht(N,{onClick:vc,children:"Add Funds"}),ht(a8,{disabled:X||!et,loading:!o||X,loadingText:X?"Submitting (may take a few moments)...":"Loading...",onClick:async()=>{Pt(!0);let je=await t();if(je&&!X&&Ne)try{let Ye=await tc(je,Ne.address,o,Ie,wn);R(Ye);let Tn=await Ye.wait();D(oc(Tn)),ue()}catch(Ye){console.warn({transaction:Ie,error:Ye}),L(Ye),W(new ze(new jt(Ye.reason??"Error processing transaction",ut.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}finally{Pt(!1)}},children:_i.buttonText})]})]})]})]})},Lg=bi.div`
2440
+ `;import{Fragment as Pp,jsx as yt,jsxs as Pi}from"react/jsx-runtime";var E8=({txn:e,txnFamily:t,uiOptions:r,tokenSymbol:o,tokenPrice:n})=>{if(t==="CONTRACT_CALL"){if(r.transactionInfo?.contractInfo)return yt(ap,{contractInfo:r.transactionInfo.contractInfo,description:r.description});if(r.senderInfo)return yt(ap,{contractInfo:r.senderInfo,description:r.description||r.senderInfo.actionText})}return yt(Pp,{children:yt(Jg,{description:r.description||r.transactionInfo?.description||"",txn:e,tokenSymbol:o,tokenPrice:n})})},K1=()=>{let{authenticated:e,getAccessToken:t}=F(),{wallets:r}=Oa(),{walletProxy:o,closePrivyModal:n,getFiatOnRampConfig:i,rpcConfig:a,chains:s,nativeTokenSymbolForChainId:l,appId:c}=M(),{app:u,navigate:f,data:h,onUserCloseViaDialogOrKeybindRef:g,setModalData:v}=x(),{transactionRequest:y,onSuccess:T,onFailure:_,uiOptions:b,fundWalletConfig:A}=h.sendTransaction,[k,N]=ar(null),[R,I]=ar(null),[H,G]=ar(""),[Z,W]=ar(),[q,L]=ar(),[se,ue]=ar(!1),me=()=>{G(""),W(void 0),L(void 0)},be=(Ye,Ze,_n)=>{G(Ye),W(new ze(new Yt(Ze??Ye,_n??mt.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))},[X,Pt]=ar(!1),[rt,Mt]=ar(!0),[nt,sr]=ar(null),[Ie,je]=ar(y),{tokenPrice:lr,isTokenPriceLoading:Wt}=dc(Ie),$e=l(y.chainId)||"ETH",[O,Bo]=ar(null),[_e,J]=ar(null),[ee,Ce]=ar(!0);q1(()=>{e||(f("LANDING"),_(new Error("User must be authenticated before transacting with a Privy wallet")))},[e]);let De=y.from?r.find(Ye=>Ye.address===y.from):r.find(Ye=>Ye.walletClientType==="privy"&&!Ye.imported),_c=async()=>{if(!De)return console.warn("No privy wallet found, cannot fund wallet.");let{signedUrl:Ye,externalTransactionId:Ze}=await i(De.address,{config:A?.config||{}});v({fiatOnRampPrompt:{signedUrl:Ye},fiatOnRampStatus:{externalTransactionId:Ze}}),f("FIAT_ON_RAMP_PROMPT_SCREEN")},En=b8(()=>oo(Ie.chainId,s,a,{appId:c}),[Ie.chainId,a]);async function za(Ye){let Ze=Ye;if(!await t()||!o||!De)return;try{Ze=await Ei(De.address,Ye,En),je(Ze)}catch(to){console.error(to),be("There was an error preparing your transaction. Your transaction request will likely fail.",to.reason)}let Ho=z1.from(0),Go=z1.from(0);try{({totalGasEstimate:Ho,l1ExecutionFeeEstimate:Go}=await bi(Ze,En)),Bo(Ho.toHexString()),J(Go.toHexString())}catch{Bo(null)}try{let{balance:to,hasSufficientFunds:qa}=await lc(De.address,Ze,Ho,En);sr(to.toHexString()),qa||(Mt(!1),be("Wallet has insufficient funds on this network for this transaction."),u?.fiatOnRamp.enabled&&ue(!0))}catch(to){console.warn(`Failed to fetch wallet balance with error: ${to}`)}Ce(!1)}q1(()=>{za(Ie)},[o]);let Tn=N1(Ie),Pn=Tn==="SEND"?`Send ${$e}`:"Review transaction",Ri={modalTitle:b.header||b.modalTitle||Pn,buttonText:b.buttonText||"Submit"},Ue=()=>{X||(R?T(R):_(Z||new ze(new Yt("The user rejected the request",mt.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}))};return g.current=Ue,lr===void 0&&Wt||ee?Pi(Pp,{children:[b.transactionInfo?.contractInfo?.imgUrl&&yt(Ws,{src:b.transactionInfo?.contractInfo?.imgUrl}),yt(S,{title:Ri.modalTitle,onClose:Ue}),yt($1,{children:yt(ri,{})})]}):k!==null?yt(V1,{txn:Ie,onClose:Ue,receipt:k,transactionInfo:b.transactionInfo,tokenPrice:lr,tokenSymbol:$e,l1GasEstimate:_e,receiptHeader:b.successHeader,receiptDescription:b.successDescription}):q?yt(G1,{transactionError:q,chainId:Ie.chainId,onClose:Ue,onRetry:({resetNonce:Ye})=>{me();let Ze=Ie;Ye&&(Ze={...Ie,nonce:void 0}),za(Ze)}}):Pi(Pp,{children:[yt(S,{title:Ri.modalTitle,onClose:Ue}),Pi($1,{children:[Pi(S8,{children:[yt(E8,{txn:Ie,txnFamily:Tn,uiOptions:b,tokenSymbol:$e,tokenPrice:lr}),De?yt(vi,{from:De.address,to:Ie.to,txn:Ie,transactionInfo:b.transactionInfo,gas:O||void 0,tokenPrice:lr,tokenSymbol:$e}):null]}),Pi(A8,{children:[yt(T8,{children:H}),yt(Kg,{txn:Ie,address:De?.address??"",hasFunds:rt,balance:nt}),Pi(P8,{children:[se&&yt(D,{onClick:_c,children:"Add Funds"}),yt(_8,{disabled:X||!rt,loading:!o||X,loadingText:X?"Submitting (may take a few moments)...":"Loading...",onClick:async()=>{Pt(!0);let Ye=await t();if(Ye&&!X&&De)try{let Ze=await sc(Ye,De.address,o,Ie,En);I(Ze);let _n=await Ze.wait();N(cc(_n)),me()}catch(Ze){console.warn({transaction:Ie,error:Ze}),L(Ze),W(new ze(new Yt(Ze.reason??"Error processing transaction",mt.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}finally{Pt(!1)}},children:Ri.buttonText})]})]})]})]})},$1=_i.div`
2418
2441
  display: flex;
2419
2442
  flex-direction: column;
2420
2443
  justify-content: space-between;
2421
2444
  flex-grow: 1;
2422
2445
  padding-bottom: 16px;
2423
- `,n8=bi.div`
2446
+ `,T8=_i.div`
2424
2447
  font-size: 13px;
2425
2448
  color: var(--privy-color-error);
2426
2449
  width: 100%;
2427
2450
  margin-top: 16px;
2428
- `,i8=bi.div`
2451
+ `,P8=_i.div`
2429
2452
  display: flex;
2430
2453
  direction: row;
2431
2454
  justify-content: space-between;
2432
2455
  align-items: center;
2433
2456
  gap: 8px;
2434
- `,a8=bi(N)`
2457
+ `,_8=_i(D)`
2435
2458
  transition: color 350ms ease, background-color 350ms ease;
2436
- `,s8=bi.div`
2459
+ `,S8=_i.div`
2437
2460
  height: 100%;
2438
2461
  display: flex;
2439
2462
  flex-direction: column;
2440
2463
  justify-content: space-evenly;
2441
2464
  flex-grow: 1;
2442
- `,l8=bi.div`
2465
+ `,A8=_i.div`
2443
2466
  display: flex;
2444
2467
  flex-direction: column;
2445
2468
  gap: 8px;
2446
- `;import{isHexString as c8}from"@ethersproject/bytes";import{toUtf8String as d8}from"@ethersproject/strings";import{useEffect as Ng,useState as fc}from"react";import Uo,{css as p8}from"styled-components";import{Fragment as Fg,jsx as ct,jsxs as Ei}from"react/jsx-runtime";var u8=e=>{if(!c8(e))return e;try{return d8(e)}catch{return e}},m8=e=>JSON.stringify(e,null,2),f8=({data:e})=>{let t=r=>typeof r=="object"&&r!==null?ct(C8,{children:Object.entries(r).map(([o,n])=>Ei("li",{children:[Ei("strong",{children:[o,":"]})," ",t(n)]},o))}):ct("span",{children:String(r)});return ct("div",{children:t(e)})},h8=e=>{let{types:t,primaryType:r,...o}=e.typedData;return Ei(Fg,{children:[ct(Ug,{children:ct(f8,{data:o})}),ct(Ao,{text:m8(e.typedData),itemName:"full payload to clipboard"})," "]})},Dg=()=>{let{authenticated:e}=B(),{initializeWalletProxy:t,closePrivyModal:r}=M(),{navigate:o,data:n,onUserCloseViaDialogOrKeybindRef:i}=A(),[a,l]=fc(!0),[s,c]=fc(""),[u,h]=fc(),[f,g]=fc(null),v=f!==null;Ng(()=>{e||o("LANDING")},[e]),Ng(()=>{t(xn).then(R=>{l(!1),R||(c("An error has occurred, please try again."),h(new ze(new jt(s,ut.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))})},[]);let{method:y,data:S,confirmAndSign:_,onSuccess:w,onFailure:x,uiOptions:k}=n.signMessage,D={title:k.title||"Sign message",description:k.description||"Signing this message will not cost you any fees.",buttonText:k.buttonText||"Sign and continue"},I=R=>{R?w(R):x(u||new ze(new jt("The user rejected the request.",ut.E4001_USER_REJECTED_REQUEST.eipCode))),r({shouldCallAuthOnSuccess:!1}),g(null),c(""),h(void 0)};return i.current=()=>{I(f)},Ei(Fg,{children:[ct(P,{onClose:()=>I(f)}),ct(Q,{}),Ei(y8,{children:[ct(g8,{children:D.title}),ct(v8,{children:D.description}),y==="personal_sign"&&ct(Ug,{children:u8(S)}),y==="eth_signTypedData_v4"&&ct(h8,{typedData:S}),ct(w8,{fail:!0,children:s}),ct(E8,{success:v,loading:a,disabled:v,onClick:async()=>{try{let R=await _();g(R),c(""),setTimeout(()=>{I(R)},Fe)}catch(R){console.error(R),c("An error has occurred, please try again."),h(new ze(new jt(s,ut.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}},children:v?Ei(b8,{children:[ct(Tl,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",ct("span",{children:"Success"})]}):D.buttonText})]}),ct(re,{}),ct(q,{protectedByPrivy:!0})]})},y8=Uo.div`
2469
+ `;import{isHexString as x8}from"@ethersproject/bytes";import{toUtf8String as k8}from"@ethersproject/strings";import{useEffect as j1,useState as Ha}from"react";import wn from"styled-components";import{Fragment as J1,jsx as dt,jsxs as Si}from"react/jsx-runtime";var R8=e=>{if(!x8(e))return e;try{return k8(e)}catch{return e}},I8=e=>JSON.stringify(e,null,2),M8=({data:e})=>{let t=r=>typeof r=="object"&&r!==null?dt(D8,{children:Object.entries(r).map(([o,n])=>Si("li",{children:[Si("strong",{children:[o,":"]})," ",t(n)]},o))}):dt("span",{children:String(r)});return dt("div",{children:t(e)})},W8=e=>{let{types:t,primaryType:r,...o}=e.typedData;return Si(J1,{children:[dt(Z1,{children:dt(M8,{data:o})}),dt(xo,{text:I8(e.typedData),itemName:"full payload to clipboard"})," "]})},Y1=()=>{let{authenticated:e}=F(),{initializeWalletProxy:t,closePrivyModal:r}=M(),{navigate:o,data:n,onUserCloseViaDialogOrKeybindRef:i}=x(),[a,s]=Ha(!0),[l,c]=Ha(""),[u,f]=Ha(),[h,g]=Ha(null),[v,y]=Ha(!1),T=h!==null;j1(()=>{e||o("LANDING")},[e]),j1(()=>{t(kn).then(G=>{s(!1),G||(c("An error has occurred, please try again."),f(new ze(new Yt(l,mt.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))})},[]);let{method:_,data:b,confirmAndSign:A,onSuccess:k,onFailure:N,uiOptions:R}=n.signMessage,I={title:R.title||"Sign message",description:R.description||"Signing this message will not cost you any fees.",buttonText:R.buttonText||"Sign and continue"},H=G=>{G?k(G):N(u||new ze(new Yt("The user rejected the request.",mt.E4001_USER_REJECTED_REQUEST.eipCode))),r({shouldCallAuthOnSuccess:!1}),setTimeout(()=>{g(null),c(""),f(void 0)},200)};return i.current=()=>{H(h)},Si(J1,{children:[dt(S,{onClose:()=>H(h)}),dt(Q,{}),Si(L8,{children:[dt(O8,{children:I.title}),dt(N8,{children:I.description}),_==="personal_sign"&&dt(Z1,{children:R8(b)}),_==="eth_signTypedData_v4"&&dt(W8,{typedData:b}),dt(U8,{fail:!0,children:l}),dt(nf,{disabled:v||T||a,loading:v,onClick:async()=>{y(!0),c("");try{let G=await A();g(G),y(!1),setTimeout(()=>{H(G)},Oe)}catch(G){console.error(G),c("An error has occurred, please try again."),f(new ze(new Yt(l,mt.E32603_DEFAULT_INTERNAL_ERROR.eipCode))),y(!1)}},children:v?"Signing...":T?Si(F8,{children:[dt(kl,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",dt("span",{children:"Success"})]}):I.buttonText})]}),dt(re,{}),dt($,{protectedByPrivy:!0})]})},L8=wn.div`
2447
2470
  display: flex;
2448
2471
  flex-direction: column;
2449
2472
  align-items: center;
2450
2473
  justify-content: center;
2451
- `,g8=Uo.span`
2474
+ `,O8=wn.span`
2452
2475
  color: var(--privy-color-foreground);
2453
2476
  text-align: center;
2454
2477
  font-size: 1.125rem;
2455
2478
  font-weight: 500;
2456
2479
  line-height: 1.25rem; /* 111.111% */
2457
2480
  text-align: center;
2458
- `,v8=Uo.span`
2481
+ `,N8=wn.span`
2459
2482
  margin-top: 4px;
2460
2483
  color: var(--privy-color-foreground);
2461
2484
  text-align: center;
@@ -2465,7 +2488,7 @@ You will have to sign up with another method first to register a passkey for you
2465
2488
  font-weight: 400;
2466
2489
  line-height: 20px; /* 142.857% */
2467
2490
  letter-spacing: -0.008px;
2468
- `,Ug=Uo.div`
2491
+ `,Z1=wn.div`
2469
2492
  margin-top: 1.5rem;
2470
2493
  background-color: var(--privy-color-background-2);
2471
2494
  border-radius: var(--privy-border-radius-md);
@@ -2484,7 +2507,7 @@ You will have to sign up with another method first to register a passkey for you
2484
2507
  display: none; /* Safari and Chrome */
2485
2508
  }
2486
2509
  }
2487
- `,C8=Uo.ul`
2510
+ `,D8=wn.ul`
2488
2511
  margin-left: 12px !important;
2489
2512
  white-space: nowrap;
2490
2513
 
@@ -2496,7 +2519,7 @@ You will have to sign up with another method first to register a passkey for you
2496
2519
  font-weight: 500 !important;
2497
2520
  }
2498
2521
  }
2499
- `,w8=Uo.div`
2522
+ `,U8=wn.div`
2500
2523
  line-height: 20px;
2501
2524
  height: 20px;
2502
2525
  font-size: 13px;
@@ -2506,20 +2529,11 @@ You will have to sign up with another method first to register a passkey for you
2506
2529
  width: 100%;
2507
2530
  margin-top: 16px;
2508
2531
  margin-bottom: 4px;
2509
- `,b8=Uo.span`
2532
+ `,F8=wn.span`
2510
2533
  display: flex;
2511
2534
  align-items: center;
2512
2535
  gap: 8px;
2513
- `,E8=Uo(N)`
2514
- transition: color 350ms ease, background-color 350ms ease;
2515
-
2516
- ${e=>e.success&&p8`
2517
- &&&& {
2518
- background-color: var(--privy-color-success);
2519
- color: #ffffff;
2520
- }
2521
- `}
2522
- `;import{useEffect as Bg,useState as Hg}from"react";import T8 from"styled-components";import{Fragment as S8,jsx as Qr,jsxs as hc}from"react/jsx-runtime";var Gg=()=>{let{authenticated:e,logout:t,ready:r,user:o}=B(),{app:n,setModalData:i,navigate:a,resetNavigation:l}=A(),{initLoginWithTelegram:s,loginWithTelegram:c,updateWallets:u,setReadyToTrue:h,closePrivyModal:f,createAnalyticsEvent:g}=M(),[v,y]=Hg(!1),[S,_]=Hg(void 0),w=Fe;async function x(){try{await c(),y(!0),h(!0)}catch(I){if(I?.privyErrorCode==="allowlist_rejected"){_(void 0),l(),a("ALLOWLIST_REJECTION_SCREEN");return}if(I?.privyErrorCode==="max_accounts_reached"){console.error(new lr(I).toString()),_(void 0),l(),a("USER_LIMIT_REACHED_SCREEN");return}let{retryable:R,detail:H}=Lc(I);_({retryable:R,detail:H,message:"Authentication failed"})}}Bg(()=>{x()},[]),Bg(()=>{if(!(r&&e&&v&&o))return;if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let H=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},w);return()=>clearTimeout(H)}if(Nt(o,n?.embeddedWallets?.createOnLogin)){let H=setTimeout(()=>{i({createWallet:{onSuccess:()=>{},onFailure:K=>{console.error(K),g({eventName:"embedded_wallet_creation_failure_logout",payload:{error:K,provider:"telegram",screen:"TelegramAuthScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},w);return()=>clearTimeout(H)}u();let R=setTimeout(()=>f({shouldCallAuthOnSuccess:!0,isSuccess:!0}),w);return()=>clearTimeout(R)},[r,e,v,o]);let k=v?"Successfully connected with Telegram":S?S.message:"Verifying connection to Telegram",D="";return v?D="You\u2019re good to go!":S?D=S.detail:D="Just a few moments more",hc(S8,{children:[Qr(P,{}),Qr(Q,{}),hc(P8,{children:[Qr(at,{children:hc("div",{children:[Qr(ot,{success:v,fail:!!S}),Qr(Bl,{style:{width:"38px",height:"38px"}})]})}),hc(Ze,{children:[Qr("h3",{children:k}),Qr("p",{children:D})]}),S&&S?.retryable?Qr(Fn,{onClick:()=>{s().then(async()=>x()).catch(I=>{let{retryable:R,detail:H}=Lc(I);_({retryable:R,detail:H,message:"Authentication failed"})}),_(void 0)},disabled:!v&&!S?.retryable,children:"Retry"}):null]}),Qr(re,{}),Qr(V,{})]})},P8=T8.div`
2536
+ `;import{useEffect as Q1,useState as X1}from"react";import B8 from"styled-components";import{Fragment as G8,jsx as Xr,jsxs as wc}from"react/jsx-runtime";var e2=()=>{let{authenticated:e,logout:t,ready:r,user:o}=F(),{app:n,setModalData:i,navigate:a,resetNavigation:s}=x(),{initLoginWithTelegram:l,loginWithTelegram:c,updateWallets:u,setReadyToTrue:f,closePrivyModal:h,createAnalyticsEvent:g}=M(),[v,y]=X1(!1),[T,_]=X1(void 0),b=Oe;async function A(){try{await c(),y(!0),f(!0)}catch(R){if(R?.privyErrorCode==="allowlist_rejected"){_(void 0),s(),a("ALLOWLIST_REJECTION_SCREEN");return}if(R?.privyErrorCode==="max_accounts_reached"){console.error(new cr(R).toString()),_(void 0),s(),a("USER_LIMIT_REACHED_SCREEN");return}let{retryable:I,detail:H}=Hc(R);_({retryable:I,detail:H,message:"Authentication failed"})}}Q1(()=>{A()},[]),Q1(()=>{if(!(r&&e&&v&&o))return;if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let H=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},b);return()=>clearTimeout(H)}if(Dt(o,n?.embeddedWallets?.createOnLogin)){let H=setTimeout(()=>{i({createWallet:{onSuccess:()=>{},onFailure:G=>{console.error(G),g({eventName:"embedded_wallet_creation_failure_logout",payload:{error:G,provider:"telegram",screen:"TelegramAuthScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},b);return()=>clearTimeout(H)}u();let I=setTimeout(()=>h({shouldCallAuthOnSuccess:!0,isSuccess:!0}),b);return()=>clearTimeout(I)},[r,e,v,o]);let k=v?"Successfully connected with Telegram":T?T.message:"Verifying connection to Telegram",N="";return v?N="You\u2019re good to go!":T?N=T.detail:N="Just a few moments more",wc(G8,{children:[Xr(S,{}),Xr(Q,{}),wc(H8,{children:[Xr(Qe,{children:wc("div",{children:[Xr(Je,{success:v,fail:!!T}),Xr($l,{style:{width:"38px",height:"38px"}})]})}),wc(qe,{children:[Xr("h3",{children:k}),Xr("p",{children:N})]}),T&&T?.retryable?Xr(Vn,{onClick:()=>{l().then(async()=>A()).catch(R=>{let{retryable:I,detail:H}=Hc(R);_({retryable:I,detail:H,message:"Authentication failed"})}),_(void 0)},disabled:!v&&!T?.retryable,children:"Retry"}):null]}),Xr(re,{}),Xr(z,{})]})},H8=B8.div`
2523
2537
  display: flex;
2524
2538
  flex-direction: column;
2525
2539
  align-items: center;
@@ -2527,9 +2541,9 @@ You will have to sign up with another method first to register a passkey for you
2527
2541
  margin-left: 27px;
2528
2542
  margin-right: 27px;
2529
2543
  gap: 24px;
2530
- `;import I8 from"@heroicons/react/24/outline/EnvelopeIcon";import _8 from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as x8,useState as Vg}from"react";import qg from"styled-components";import{Fragment as R8,jsx as Oa,jsxs as zg}from"react/jsx-runtime";var $g=x8((e,t)=>{let[r,o]=Vg(""),[n,i]=Vg(!1),{authenticated:a,user:l}=B(),{initUpdateEmail:s}=M(),{navigate:c,setModalData:u,currentScreen:h}=A(),{enabled:f,token:g}=ye(),v=Ja(r),y=n,S=n||!v,_=async x=>{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,x),c("AWAITING_PASSWORDLESS_CODE")}catch(k){u({errorModalData:{error:k,previousScreen:h||"LANDING"}})}i(!1)},w=()=>{f&&!g&&!a?(u({captchaModalData:{callback:x=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");return s(l.email.address,r,x)},userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN")):_(g)};return zg(R8,{children:[Oa(A8,{children:zg(k8,{children:[Oa(_8,{}),Oa("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:x=>o(x.target.value),onKeyUp:x=>{x.key==="Enter"&&w()},value:r,autoComplete:"email"}),e.stacked?null:Oa(Bn,{isSubmitting:y,onClick:w,disabled:S,children:"Submit"})]})}),e.stacked?Oa(N,{loadingText:null,loading:y,disabled:S,onClick:w,children:"Submit"}):null]})}),A8=qg.div`
2544
+ `;import j8 from"@heroicons/react/24/outline/EnvelopeIcon";import V8 from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as z8,useState as t2}from"react";import o2 from"styled-components";import{Fragment as K8,jsx as Ga,jsxs as r2}from"react/jsx-runtime";var n2=z8((e,t)=>{let[r,o]=t2(""),[n,i]=t2(!1),{authenticated:a,user:s}=F(),{initUpdateEmail:l}=M(),{navigate:c,setModalData:u,currentScreen:f}=x(),{enabled:h,token:g}=ge(),v=as(r),y=n,T=n||!v,_=async A=>{if(!s?.email)throw new Error("User is required to have an email address to update it.");i(!0);try{await l(s.email.address,r,A),c("AWAITING_PASSWORDLESS_CODE")}catch(k){u({errorModalData:{error:k,previousScreen:f||"LANDING"}})}i(!1)},b=()=>{h&&!g&&!a?(u({captchaModalData:{callback:A=>{if(!s?.email)throw new Error("User is required to have an email address to update it.");return l(s.email.address,r,A)},userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN")):_(g)};return r2(K8,{children:[Ga(q8,{children:r2($8,{children:[Ga(V8,{}),Ga("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:A=>o(A.target.value),onKeyUp:A=>{A.key==="Enter"&&b()},value:r,autoComplete:"email"}),e.stacked?null:Ga(zn,{isSubmitting:y,onClick:b,disabled:T,children:"Submit"})]})}),e.stacked?Ga(D,{loadingText:null,loading:y,disabled:T,onClick:b,children:"Submit"}):null]})}),q8=o2.div`
2531
2545
  width: 100%;
2532
- `,k8=qg.label`
2546
+ `,$8=o2.label`
2533
2547
  display: block;
2534
2548
  position: relative;
2535
2549
  width: 100%;
@@ -2587,7 +2601,7 @@ You will have to sign up with another method first to register a passkey for you
2587
2601
  && > input::placeholder {
2588
2602
  color: var(--privy-color-foreground-3);
2589
2603
  }
2590
- `;import{Fragment as M8,jsx as Fo,jsxs as W8}from"react/jsx-runtime";var Kg=()=>W8(M8,{children:[Fo(P,{},"header"),Fo(Q,{}),Fo(ke,{title:"Update your email",description:"Add the email address you'd like to use going forward. We'll send you a confirmation code",icon:Fo(I8,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),Fo(ur,{children:Fo($g,{stacked:!0})}),Fo(re,{}),Fo(q,{protectedByPrivy:!0})]});import wp from"styled-components";import{jsx as jg}from"react/jsx-runtime";var Yg=({style:e,...t})=>jg("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:jg("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 D8,jsx as Cn,jsxs as Cp}from"react/jsx-runtime";var Zg=()=>{let{navigate:e}=A();return Cp(D8,{children:[Cn(P,{}),Cp(L8,{children:[Cn(O8,{children:Cn(Yg,{})}),Cp(N8,{children:[Cn("h3",{children:"Unable to sign in"}),Cn("p",{children:"This application has reached its user limit and cannot sign in new users."})]}),Cn(N,{onClick:()=>{e("LANDING")},children:"Go back"})]}),Cn(q,{protectedByPrivy:!0})]})},L8=wp.div`
2604
+ `;import{Fragment as Y8,jsx as Uo,jsxs as Z8}from"react/jsx-runtime";var i2=()=>Z8(Y8,{children:[Uo(S,{},"header"),Uo(Q,{}),Uo(ke,{title:"Update your email",description:"Add the email address you'd like to use going forward. We'll send you a confirmation code",icon:Uo(j8,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),Uo(ur,{children:Uo(n2,{stacked:!0})}),Uo(re,{}),Uo($,{protectedByPrivy:!0})]});import Sp from"styled-components";import{jsx as a2}from"react/jsx-runtime";var s2=({style:e,...t})=>a2("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:a2("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 eE,jsx as bn,jsxs as _p}from"react/jsx-runtime";var l2=()=>{let{navigate:e}=x();return _p(eE,{children:[bn(S,{}),_p(J8,{children:[bn(Q8,{children:bn(s2,{})}),_p(X8,{children:[bn("h3",{children:"Unable to sign in"}),bn("p",{children:"This application has reached its user limit and cannot sign in new users."})]}),bn(D,{onClick:()=>{e("LANDING")},children:"Go back"})]}),bn($,{protectedByPrivy:!0})]})},J8=Sp.div`
2591
2605
  display: flex;
2592
2606
  flex-direction: column;
2593
2607
  align-items: center;
@@ -2596,7 +2610,7 @@ You will have to sign up with another method first to register a passkey for you
2596
2610
  width: 100%;
2597
2611
  padding-top: 8px;
2598
2612
  padding-bottom: 32px;
2599
- `,O8=wp.div`
2613
+ `,Q8=Sp.div`
2600
2614
  display: flex;
2601
2615
  align-items: center;
2602
2616
  justify-content: center;
@@ -2605,11 +2619,11 @@ You will have to sign up with another method first to register a passkey for you
2605
2619
  color: var(--privy-color-error);
2606
2620
  background-color: var(--privy-color-error-light);
2607
2621
  border-radius: 50%;
2608
- `,N8=wp.div`
2622
+ `,X8=Sp.div`
2609
2623
  display: flex;
2610
2624
  flex-direction: column;
2611
2625
  gap: 8px;
2612
- `;import F8,{createGlobalStyle as B8}from"styled-components";var U8=`
2626
+ `;import rE,{createGlobalStyle as oE}from"styled-components";var tE=`
2613
2627
  *,
2614
2628
  ::before,
2615
2629
  ::after {
@@ -2839,7 +2853,7 @@ You will have to sign up with another method first to register a passkey for you
2839
2853
  [hidden] {
2840
2854
  display: none;
2841
2855
  }
2842
- `,Jg=U8;var Qg=B8`
2856
+ `,c2=tE;var d2=oE`
2843
2857
  :root {
2844
2858
  // Borders
2845
2859
  --privy-border-radius-sm: 6px;
@@ -2872,10 +2886,10 @@ You will have to sign up with another method first to register a passkey for you
2872
2886
  --privy-height-modal-full: 620px;
2873
2887
  --privy-height-modal-compact: 480px;
2874
2888
  };
2875
- `,bp=F8.div`
2889
+ `,Ap=rE.div`
2876
2890
  // css normalize only the privy application to avoid conflicts
2877
2891
  // with consuming application
2878
- ${Jg}
2892
+ ${c2}
2879
2893
 
2880
2894
  // Privy styles
2881
2895
  color: var(--privy-color-foreground-2);
@@ -2910,14 +2924,6 @@ You will have to sign up with another method first to register a passkey for you
2910
2924
  box-shadow: 0 0 0 1px var(--privy-color-accent-light);
2911
2925
  }
2912
2926
 
2913
- /* Utilities when you can't add an additional span tag for mobile formatting */
2914
-
2915
- .hide-on-mobile {
2916
- @media (max-width: 440px) {
2917
- display: none;
2918
- }
2919
- }
2920
-
2921
2927
  .mobile-only {
2922
2928
  @media (min-width: 441px) {
2923
2929
  display: none;
@@ -2934,7 +2940,7 @@ You will have to sign up with another method first to register a passkey for you
2934
2940
  opacity: 1;
2935
2941
  }
2936
2942
  }
2937
- `;import{Dialog as Xg,Transition as Ep}from"@headlessui/react";import Tp from"react";import Na from"styled-components";import{jsx as Ti,jsxs as q8}from"react/jsx-runtime";var e2=({children:e,open:t,onClick:r,...o})=>Ti(Ep,{show:t,as:Tp.Fragment,children:q8(Xg,{onClose:r,...o,as:G8,children:[Ti(Ep.Child,{as:Tp.Fragment,enterFrom:"entering",leaveTo:"leaving",children:Ti(H8,{id:"privy-dialog-backdrop","aria-hidden":"true"})}),Ti(V8,{children:Ti(Ep.Child,{as:Tp.Fragment,enterFrom:"entering",leaveTo:"leaving",children:Ti(Xg.Panel,{as:z8,children:e})})})]})}),H8=Na.div`
2943
+ `;import{Dialog as p2,Transition as xp}from"@headlessui/react";import kp from"react";import Va from"styled-components";import{jsx as Ai,jsxs as lE}from"react/jsx-runtime";var u2=({children:e,open:t,onClick:r,...o})=>Ai(xp,{show:t,as:kp.Fragment,children:lE(p2,{onClose:r,...o,as:iE,children:[Ai(xp.Child,{as:kp.Fragment,enterFrom:"entering",leaveTo:"leaving",children:Ai(nE,{id:"privy-dialog-backdrop","aria-hidden":"true"})}),Ai(aE,{children:Ai(xp.Child,{as:kp.Fragment,enterFrom:"entering",leaveTo:"leaving",children:Ai(p2.Panel,{as:sE,children:e})})})]})}),nE=Va.div`
2938
2944
  position: fixed;
2939
2945
  inset: 0;
2940
2946
 
@@ -2947,10 +2953,10 @@ You will have to sign up with another method first to register a passkey for you
2947
2953
  backdrop-filter: unset;
2948
2954
  -webkit-backdrop-filter: unset;
2949
2955
  }
2950
- `,G8=Na.div`
2956
+ `,iE=Va.div`
2951
2957
  position: relative;
2952
2958
  z-index: 999999;
2953
- `,V8=Na.div`
2959
+ `,aE=Va.div`
2954
2960
  position: fixed;
2955
2961
  inset: 0;
2956
2962
  display: flex;
@@ -2958,7 +2964,7 @@ You will have to sign up with another method first to register a passkey for you
2958
2964
  justify-content: center;
2959
2965
  width: 100vw;
2960
2966
  min-height: 100vh;
2961
- `,z8=Na.div`
2967
+ `,sE=Va.div`
2962
2968
  // reset some default dialog styles
2963
2969
  padding: 0;
2964
2970
  background: transparent;
@@ -3005,13 +3011,13 @@ You will have to sign up with another method first to register a passkey for you
3005
3011
  box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
3006
3012
  border-radius: var(--privy-border-radius-lg);
3007
3013
  }
3008
- `,t2=Na.div`
3014
+ `,m2=Va.div`
3009
3015
  display: flex;
3010
3016
  flex-direction: column;
3011
3017
  align-items: center;
3012
3018
  justify-content: center;
3013
3019
  height: 100%;
3014
- `;import{Fragment as o2,jsx as Qe,jsxs as n2}from"react/jsx-runtime";var Y8={["LANDING"]:Dy,["CONNECT_OR_CREATE"]:Oy,["AWAITING_PASSWORDLESS_CODE"]:wf,["AWAITING_CONNECTION"]:Vf,["AWAITING_CONNECT_ONLY_CONNECTION"]:Kf,["AWAITING_FARCASTER_CONNECTION"]:Yh,["AWAITING_FARCASTER_SIGNER"]:ty,["AWAITING_PASSKEY_SYSTEM_DIALOGUE"]:sg,["PHANTOM_INTERSTITIAL_SCREEN"]:pg,["LOGIN_FAILED_SCREEN"]:Jy,["AWAITING_OAUTH_SCREEN"]:ng,["ALLOWLIST_REJECTION_SCREEN"]:df,["USER_LIMIT_REACHED_SCREEN"]:Zg,["INSTALL_PHANTOM_SCREEN"]:hy,["LINK_EMAIL_SCREEN"]:Uy,["LINK_PHONE_SCREEN"]:$y,["LINK_WALLET_SCREEN"]:Ky,["LINK_PASSKEY_SCREEN"]:zy,["UPDATE_EMAIL_SCREEN"]:Kg,["CONNECT_ONLY_LANDING_SCREEN"]:Uf,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:Of,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:lh,["EMBEDDED_WALLET_CREATED_SCREEN"]:th,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:Xf,["EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN"]:ug,["EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"]:Tg,["EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN"]:wg,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:ih,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:Dg,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:Og,["FIAT_ON_RAMP_PROMPT_SCREEN"]:sy,["FIAT_ON_RAMP_STATUS_SCREEN"]:cy,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:Lh,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:Wh,["EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN"]:Eg,["MFA_ENROLLMENT_FLOW_SCREEN"]:p1,["CAPTCHA_SCREEN"]:Pf,["ERROR_SCREEN"]:Nh,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:dy,["AFFIRMATIVE_CONSENT_SCREEN"]:sf,["TELEGRAM_AUTH_SCREEN"]:Gg},Z8=["LANDING","AWAITING_CONNECTION"],a2=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:r,isModalOpen:o}=B(),{headless:n}=yt(),{ready:i,currentScreen:a}=A(),{status:l,execute:s,reset:c,enabled:u}=ye(),h=o&&a&&Z8.includes(a)&&!n&&l==="ready";if(r2(()=>{h&&s()},[h]),r2(()=>{!o&&u&&c()},[o,u]),(!r||!i)&&a!=="AWAITING_OAUTH_SCREEN"&&a!=="TELEGRAM_AUTH_SCREEN")return n2(o2,{children:[Qe(P,{}),Qe(Q,{}),Qe(t2,{children:Qe(nt,{})}),Qe(re,{}),Qe(V,{})]});if(!a&&e)return Qe(up,{open:e,onClose:t});if(!a)return null;let f=Y8[a];return n2(o2,{children:[Qe(Sr,{if:!!e,children:Qe(f,{})}),Qe(Sr,{if:!e,children:Qe(up,{open:e,onClose:t})})]})},J8=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let r=K8(null),o=Ym(r);return Qe(X8,{style:{height:o},id:"privy-modal-content",children:Qe("div",{ref:r,children:Qe(a2,{isMfaVerifying:e,onMfaVerificationComplete:t})})})},Q8=()=>{let{closePrivyModal:e}=M(),{onUserCloseViaDialogOrKeybindRef:t}=A();return{gracefulClosePrivyModal:$8(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},Pp=({open:e})=>{let{app:t}=A(),{gracefulClosePrivyModal:r}=Q8(),[o,n]=j8(!1);jc({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let i=e||o;return t.render.standalone?Qe(bp,{children:Qe(s2,{children:Qe(a2,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})})}):Qe(e2,{open:i,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>r(),children:Qe(bp,{children:Qe(J8,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})})})},s2=i2.div`
3020
+ `;import{Fragment as h2,jsx as et,jsxs as y2}from"react/jsx-runtime";var uE={["LANDING"]:Yy,["CONNECT_OR_CREATE"]:Ky,["AWAITING_PASSWORDLESS_CODE"]:Af,["AWAITING_CONNECTION"]:Zf,["AWAITING_CONNECT_ONLY_CONNECTION"]:eh,["AWAITING_FARCASTER_CONNECTION"]:sy,["AWAITING_FARCASTER_SIGNER"]:my,["AWAITING_PASSKEY_SYSTEM_DIALOGUE"]:C1,["PHANTOM_INTERSTITIAL_SCREEN"]:T1,["LOGIN_FAILED_SCREEN"]:cg,["AWAITING_OAUTH_SCREEN"]:y1,["CROSS_APP_AUTH_SCREEN"]:ih,["ALLOWLIST_REJECTION_SCREEN"]:gf,["USER_LIMIT_REACHED_SCREEN"]:l2,["INSTALL_PHANTOM_SCREEN"]:Ay,["LINK_EMAIL_SCREEN"]:Zy,["LINK_PHONE_SCREEN"]:ng,["LINK_WALLET_SCREEN"]:ig,["LINK_PASSKEY_SCREEN"]:rg,["UPDATE_EMAIL_SCREEN"]:i2,["CONNECT_ONLY_LANDING_SCREEN"]:qf,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:Gf,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:wh,["EMBEDDED_WALLET_CREATED_SCREEN"]:mh,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:ph,["EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN"]:P1,["EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"]:O1,["EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN"]:M1,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:gh,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:Y1,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:K1,["FIAT_ON_RAMP_PROMPT_SCREEN"]:Cy,["FIAT_ON_RAMP_STATUS_SCREEN"]:by,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:$h,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:qh,["EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN"]:L1,["MFA_ENROLLMENT_FLOW_SCREEN"]:Tg,["CAPTCHA_SCREEN"]:If,["ERROR_SCREEN"]:jh,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:Ey,["AFFIRMATIVE_CONSENT_SCREEN"]:ff,["TELEGRAM_AUTH_SCREEN"]:e2},mE=["LANDING","AWAITING_CONNECTION"],v2=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:r,isModalOpen:o}=F(),{headless:n}=it(),{ready:i,currentScreen:a}=x(),{status:s,execute:l,reset:c,enabled:u}=ge(),f=o&&a&&mE.includes(a)&&!n&&s==="ready";if(f2(()=>{f&&l()},[f]),f2(()=>{!o&&u&&c()},[o,u]),(!r||!i)&&a!=="AWAITING_OAUTH_SCREEN"&&a!=="CROSS_APP_AUTH_SCREEN"&&a!=="TELEGRAM_AUTH_SCREEN")return y2(h2,{children:[et(S,{}),et(Q,{}),et(m2,{children:et(at,{})}),et(re,{}),et(z,{})]});if(!a&&e)return et(vp,{open:e,onClose:t});if(!a)return null;let h=uE[a];return y2(h2,{children:[et(Sr,{if:!!e,children:et(h,{})}),et(Sr,{if:!e,children:et(vp,{open:e,onClose:t})})]})},fE=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let r=dE(null),o=ef(r);return et(yE,{style:{height:o},id:"privy-modal-content",children:et("div",{ref:r,children:et(v2,{isMfaVerifying:e,onMfaVerificationComplete:t})})})},hE=()=>{let{closePrivyModal:e}=M(),{onUserCloseViaDialogOrKeybindRef:t}=x();return{gracefulClosePrivyModal:cE(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},Rp=({open:e})=>{let{app:t}=x(),{gracefulClosePrivyModal:r}=hE(),[o,n]=pE(!1);td({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let i=e||o;return t.render.standalone?et(Ap,{children:et(C2,{children:et(v2,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})})}):et(u2,{open:i,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>r(),children:et(Ap,{children:et(fE,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})})})},C2=g2.div`
3015
3021
  display: flex;
3016
3022
  flex-direction: column;
3017
3023
  text-align: center;
@@ -3020,7 +3026,7 @@ You will have to sign up with another method first to register a passkey for you
3020
3026
  width: 100%;
3021
3027
  background: var(--privy-color-background);
3022
3028
  padding: 0 16px;
3023
- `,X8=i2(s2)`
3029
+ `,yE=g2(C2)`
3024
3030
  transition: height 150ms ease-out;
3025
3031
  overflow: hidden;
3026
3032
 
@@ -3034,4 +3040,4 @@ You will have to sign up with another method first to register a passkey for you
3034
3040
  box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
3035
3041
  border-radius: var(--privy-border-radius-lg);
3036
3042
  }
3037
- `;import{useRef as l2,useEffect as eE}from"react";import{jsx as rE}from"react/jsx-runtime";function tE({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 c2(e){let t=l2(null),r=l2();return eE(()=>{r.current?.remove(),r.current=tE(e),t.current?.after(r.current)},[e]),rE("div",{ref:t,hidden:!0})}import{useState as oE}from"react";import{useEffect as d2,useRef as p2}from"react";var yc=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;default:throw new Error(`invalid wallet event type ${t}`)}}};async function Bo(e,t,r,o,n,i=!1){let a=i,l=async u=>{if(a&&t&&t.length>0){u===(i?0:1)?n("configureMfa","onMfaRequired",t):o.current?.reject(new Ge("missing_or_invalid_mfa","MFA verification failed, retry."));let h=await new Promise((f,g)=>{r.current={resolve:f,reject:g};let v=1e3*60*5;setTimeout(()=>{let y=new Ge("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(y),g(y)},v)});return await e(h)}return await e()},s=4,c=null;for(let u=0;u<s;u++)try{c=await l(u),o.current?.resolve(void 0);break}catch(h){if(h.type==="missing_or_invalid_mfa")a=!0;else throw o.current?.resolve(void 0),h}if(c===null){let u=new Ge("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(u),u}return c}import{jsx as cE}from"react/jsx-runtime";var nE=function(e){return()=>`id-${e++}`}(0);function iE(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function zt(e){return e.error!==void 0}var It=new yc,Sp=new Map,aE=(e,t)=>typeof t=="bigint"?t.toString():t,sE=(e,t)=>`${e}${JSON.stringify(t,aE)}`;function qt(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let i=sE(e,t);if(e==="privy:wallet:create"){let l=Sp.get(i);if(l)return l}let a=new Promise((l,s)=>{let c=nE();It.enqueue(c,{resolve:l,reject:s}),n.postMessage({id:c,event:e,data:t},o)}).finally(()=>{Sp.delete(i)});return Sp.set(i,a),a}function lE(e){switch(e.event){case"privy:iframe:ready":let t=It.dequeue(e.event,e.id);return zt(e)?t.reject(new Ge(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=It.dequeue(e.event,e.id);return zt(e)?r.reject(new Ge(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:import":let o=It.dequeue(e.event,e.id);return zt(e)?o.reject(new Ge(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:connect":let n=It.dequeue(e.event,e.id);return zt(e)?n.reject(new Ge(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:recover":let i=It.dequeue(e.event,e.id);return zt(e)?i.reject(new Ge(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:rpc":let a=It.dequeue(e.event,e.id);return zt(e)?a.reject(new Ge(e.error.type,e.error.message)):a.resolve(e.data);case"privy:wallet:set-recovery":let l=It.dequeue(e.event,e.id);return zt(e)?l.reject(new Ge(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:verify":let s=It.dequeue(e.event,e.id);return zt(e)?s.reject(new Ge(e.error.type,e.error.message)):s.resolve(e.data);case"privy:mfa:init-enrollment":{let c=It.dequeue(e.event,e.id);return zt(e)?c.reject(new Ge(e.error.type,e.error.message)):c.resolve(e.data)}case"privy:mfa:submit-enrollment":{let c=It.dequeue(e.event,e.id);return zt(e)?c.reject(new Ge(e.error.type,e.error.message)):c.resolve(e.data)}case"privy:mfa:unenroll":{let c=It.dequeue(e.event,e.id);return zt(e)?c.reject(new Ge(e.error.type,e.error.message)):c.resolve(e.data)}case"privy:mfa:clear":{let c=It.dequeue(e.event,e.id);return zt(e)?c.reject(new Ge(e.error.type,e.error.message)):c.resolve(e.data)}case"privy:farcaster:init-signer":{let c=It.dequeue(e.event,e.id);return zt(e)?c.reject(new Ge(e.error.type,e.error.message)):c.resolve(e.data)}case"privy:farcaster:sign":{let c=It.dequeue(e.event,e.id);return zt(e)?c.reject(new Ge(e.error.type,e.error.message)):c.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function u2(e){let t=p2(null),r=p2(e.mfaMethods),o=qs(),[n,i]=oE(!1);return d2(()=>{r.current=e.mfaMethods},[e.mfaMethods]),d2(()=>{if(!n)return;let a=t.current;if(!a)return;function l(f){f&&f.origin===e.origin&&iE(f.data)&&lE(f.data)}let s={create(f){return qt("privy:wallet:create",f,a,e.origin)},import(f){return qt("privy:wallet:import",f,a,e.origin)},connect(f){return qt("privy:wallet:connect",f,a,e.origin)},recover(f){return Bo(g=>qt("privy:wallet:recover",{...f,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!f.recoveryMethod||f.recoveryMethod==="privy")},rpc(f){return Bo(g=>qt("privy:wallet:rpc",{...f,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},setRecovery(f){return Bo(g=>qt("privy:wallet:set-recovery",{...f,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(f){return Bo(g=>qt("privy:mfa:verify",{...f,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(f){return Bo(g=>qt("privy:mfa:init-enrollment",{...f,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(f){return Bo(g=>qt("privy:mfa:submit-enrollment",{...f,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},unenrollMfa(f){return Bo(g=>qt("privy:mfa:unenroll",{...f,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},clearMfa(f){return qt("privy:mfa:clear",f,a,e.origin)},initFarcasterSigner(f){return qt("privy:farcaster:init-signer",f,a,e.origin)},signFarcasterMessage(f){return qt("privy:farcaster:sign",f,a,e.origin)}};window.addEventListener("message",l);let c=()=>e.onLoad(s),u=(...f)=>{console.warn("Privy iframe failed to load: ",...f),e.onLoadFailed()},h=new AbortController;return Ai(()=>qt("privy:iframe:ready",{},a,e.origin),{abortSignal:h.signal}).then(c,u),()=>{window.removeEventListener("message",l),h.abort()}},[n]),cE("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>i(!0),src:Qa(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId,client_id:e.appClientId})})}function gc(e){let t=e.toLowerCase();return!!window?.webkit?.messageHandlers?.ReactNativeWebView||!!window?.ReactNativeWebView||["fbav","fban","instagram","snapchat","linkedinapp"].some(n=>t.includes(n))}var dE="https://cdn.apple-cloudkit.com";async function _p({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===dE&&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 m2=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 vr,jsxs as f2}from"react/jsx-runtime";var fo;function fE(e){return typeof e=="string"&&e.length===25}function Ee(){if(!fo){let e=Z.get(qo);return Promise.resolve(e||null)}return fo.getAccessToken()}var h2,nm=(e,t,r)=>h2(e,t,r),y2,im=(e,t)=>y2(e,t),g2,am=(e,t)=>g2(e,t),v2,sm=()=>v2(),hE=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;Z.put(Ii,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},yE=({config:e,...t})=>{if(!fE(t.appId))throw new b("Cannot initialize the Privy provider with an invalid Privy app ID");fo||(fo=new qi({appId:t.appId,appClientId:t.clientId,apiUrl:t.apiUrl||Ri}));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."),vr(Um,{client:fo,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:vr(gE,{...t,client:fo})})},gE=e=>{let t=e.client,[r,o]=Xe(!1),[n,i]=Xe(!1),[a,l]=Xe(!1),[s,c]=Xe(null),[u,h]=Xe([]),f=Si(u),[g,v]=Xe(!1),[y,S]=Xe(null),[_,w]=Xe(!1),[x,k]=Xe({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:E}),[D,I]=Xe({status:"initial"}),[R,H]=Xe(null),[K,Y]=Xe(null),[W,G]=Xe(null),L=yt(),ae=Hs(),[pe,ue]=Xe(!0),[be,X]=Xe({}),[Pt,et]=Xe(null),[Mt,rt]=Xe(null),[ar,Ie]=Xe(!1),[Ke,sr]=Xe(!1),Wt=Si(null),qe=Si(null),O=Si(Zm),[Ho,Se]=Xe(!1);t.onStoreToken=d=>{d&&U(O,"accessToken","onAccessTokenGranted",d)},t.onDeleteToken=()=>{c(null),l(!1),U(O,"accessToken","onAccessTokenRemoved")};let J=Si(null),ee=Si(null),ve=d=>{S(d),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent({eventName:"modal_open",payload:{initialScreen:d}})},Ne=d=>{L.embeddedWallets.createOnLogin!=="off"&&ue(!0),ve(d)};Or(()=>{let d=()=>{document.visibilityState==="hidden"&&t.createAnalyticsEvent({eventName:"page_hidden",options:{keepAlive:!0}})};return document.addEventListener("visibilitychange",d),()=>{document.removeEventListener("visibilitychange",d)}},[]),Or(()=>{if(!s){t.connectors?.removeEmbeddedWalletConnector();return}let d=xe(s),p=Oc(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(!W){console.debug("Failed to add embedded wallet connector: Wallet proxy not initialized");return}d&&t.connectors.addEmbeddedWalletConnector(W,d.address,L.defaultChain,e.appId),p&&t.connectors.addImportedWalletConnector(W,p.address,L.defaultChain,e.appId)},[W,s]),Or(()=>{W&&Mt?.(W)},[W]),Or(()=>{(async()=>{if(!L.customAuth?.enabled)return;ue(!0);let{getCustomAccessToken:p,isLoading:m}=L.customAuth;if(!(!n||m))try{let C=await p();if(!C&&a){await Pn.logout();return}if(!C||a)return;t.startAuthFlow(new Sn(C));let{user:T,isNewUser:F}=await t.authenticate();if(!T){await Pn.logout();return}c(T||null),v(F||!1),l(!0),sr(!0)}catch(C){console.warn(C),a&&await Pn.logout()}})()},[L.customAuth?.enabled,L.customAuth?.getCustomAccessToken,L.customAuth?.isLoading,n,a]),Or(()=>{Ke&&W&&s&&Nt(s,L.embeddedWallets.createOnLogin)&&(sr(!1),Ua(s,xn).catch(console.error))},[Ke&&W&&s]),Or(()=>{async function d(){let p=vc(),m=wn();hE();let C=pE();H(C),t.initializeConnectorManager({walletConnectCloudProjectId:L.walletConnectCloudProjectId,rpcConfig:L.rpcConfig,chains:L.chains,defaultChain:L.defaultChain,store:C,walletList:L.appearance.walletList,shouldEnforceDefaultChainOnConnect:L.shouldEnforceDefaultChainOnConnect,externalWalletConfig:L.externalWallets,appName:L.name??"Privy"});let T;t.connectors?.on("connectorInitialized",()=>{T&&clearTimeout(T);let le=t.connectors.walletConnectors.length,Ue=t.connectors.walletConnectors.reduce((Ce,dt)=>Ce+(dt.initialized?1:0),0);Ue===le?Se(!0):T=setTimeout(()=>{console.debug({message:"Unable to initialize all expected connectors before timeout",initialized:Ue,expected:le}),Se(!0)},1500)}),t.connectors?.initialize().then(()=>{_i()});let F=await t.getAuthenticatedUser(),z=!!F;if(L.customAuth?.enabled||(l(!!F),F&&U(O,"login","onComplete",F,!1,!0,null,null),c(F)),p){ee.current=z?"link":"login";return}if(m&&!z){ee.current="login",Ne("TELEGRAM_AUTH_SCREEN");return}me.setReadyToTrue(!!F)}!n&&ae&&d()},[t,Pt,n,ae]),Or(()=>{if(!n)return;if(!s){Ie(!0);return}if(!!!s.linkedAccounts.find(m=>m.type==="wallet"&&m.walletClientType==="privy")){Ie(!0);return}let p=!!u.find(m=>m.walletClientType==="privy");Ie(p)},[n,s,u]);let vc=()=>{let d=Ni();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}window.opener.postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:d.stateCode,authorizationCode:d.authorizationCode});return}return!d.inProgress||d.headless?!1:(t.startAuthFlow(new Nr(d)),Ne("AWAITING_OAUTH_SCREEN"),!0)},wn=()=>{let d=tm();if(!d||!L.loginMethods.telegram||!L.loginConfig.telegramAuthConfiguration?.seamlessAuthEnabled)return;let p=new An;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},Da=async(d,p,m,C)=>{let T=await t.connectors?.createWalletConnector(d,p)||null;bn(T,p,m,C)};async function bn(d,p,m,C){if(d)k({status:"disconnected",connectedWallet:null,connectError:null,connector:d,connectRetry:E});else return k({status:"disconnected",connectedWallet:null,connectError:new te("Unable to connect to wallet."),connector:null,connectRetry:E}),C?.(null,m);d instanceof Br&&p&&await d.resetConnection(p),k({connector:d,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>bn(d,p,m,C)});try{let T=await d.connect({showPrompt:!0});if(L.shouldEnforceDefaultChainOnConnect&&!L.chains.find(F=>F.id===Number(T?.chainId))&&!(T?.connectorType==="wallet_connect_v2"&&T?.walletClientType==="metamask")&&!(T?.connectorType==="coinbase_wallet"&&L.externalWallets.coinbaseWallet.connectionOptions!=="eoaOnly")){k(F=>({...F,connector:d,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:E}));try{await T?.switchChain(L.defaultChain.id),T&&(T.chainId=_n(zo(L.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${L.defaultChain.id}`)}}return k(F=>({...F,status:"connected",connectedWallet:T,connectError:null,connectRetry:E})),T&&U(O,"connectWallet","onSuccess",T),C?.(T,m)}catch(T){return T instanceof $e?(console.warn(T.cause?T.cause:T.message),U(O,"connectWallet","onError",T.privyErrorCode||"generic_connect_wallet_error")):(console.warn(T),U(O,"connectWallet","onError","unknown_connect_wallet_error")),k(F=>({...F,status:"disconnected",connectedWallet:null,connectError:T})),C?.(null,m)}}let En=async(d,p)=>{if(d===null)return;let m=new Qo(d,p);t.startAuthFlow(m)},_i=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_connector"),m=d.get("privy_wallet_client");if(!p||!m)return;if(m==="phantom"&&!yo()&&Ne("LOGIN_FAILED_SCREEN"),!t.connectors)throw new b("Connector not initialized");ve("AWAITING_CONNECTION");let C=new URL(window.location.href);C.searchParams.delete("privy_connector"),C.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",C),Da(p,m,void 0,En)};Or(()=>{n&&a&&s===null&&t.getAuthenticatedUser().then(c)},[n,a,s,t]);let De=()=>{if(!a)throw U(O,"linkAccount","onError","must_be_authenticated"),new b("User must be authenticated before linking an account.")},je=()=>{De(),J.current="siwe",ee.current="link",ve("LINK_WALLET_SCREEN")},Ye=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},Tn=async d=>{if(!t.connectors)throw new b("Connector not initialized");let p=t.connectors.findWalletConnector(d.connectorType,d.walletClientType)||null;if(k(m=>({...m,connector:p,status:"connected",connectedWallet:d,connectError:null,connectRetry:E})),L.captchaEnabled&&!a){let m={callback:C=>En(d,C),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};X({captchaModalData:m}),Ne("CAPTCHA_SCREEN")}else await En(d),Ne("AWAITING_CONNECTION")},Go=async(d,p)=>{if(!L.fiatOnRamp.enabled)throw new b("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:m,externalTransactionId:C}=await iy(t,d,p?.config??{},L.appearance.palette,L.fiatOnRamp.useSandbox);return{signedUrl:m,externalTransactionId:C}}else throw new b("Unsupported fund provider. Currently supported option is `moonpay`.")},Vo=()=>{h(d=>{let p=t.connectors?.wallets.map(m=>({...m,linked:Ye(m),loginOrLink:async()=>{if(!await m.isConnected())throw new b("Wallet is not connected");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new b("Cannot link or login with embedded wallet");Tn(m)},fund:async C=>{let{signedUrl:T,externalTransactionId:F}=await Go(m.address,C);X({fiatOnRampPrompt:{signedUrl:T},fiatOnRampStatus:{externalTransactionId:F}}),ve("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!a)throw new b("User is not authenticated.");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new b("Cannot unlink an embedded wallet");let C=await t.unlinkWallet(m.address);c(C)}}))||[];return bs(d,p)?d:p})};Or(()=>{Vo()},[s?.linkedAccounts,a,n]),Or(()=>{if(n){if(!t.connectors)throw new b("Connector not initialized");Vo(),t.connectors.on("walletsUpdated",Vo)}},[n]);let Xr=()=>{ve(a?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};Or(()=>{if(!u[0])return;let d=u[0],p=f.current.find(C=>C.address===d.address),m;if(d.walletClientType==="privy"?m=s?.linkedAccounts.find(C=>C.type==="wallet"&&C.address===d.address&&C.walletClientType==="privy"):m=s?.linkedAccounts.find(C=>C.type==="wallet"&&C.address===d.address&&C.walletClientType!=="privy"),!p&&m){let C=Object.assign({},s);C.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType,imported:m.imported},c(C)}f.current=u},[u]);let Ua=async(d,p)=>{if(xe(d))throw U(O,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[C,T]=await Promise.all([me.initializeWalletProxy(p),Ee()]);if(!C&&L.customAuth?.enabled)throw U(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!C||!T||L.embeddedWallets?.requireUserOwnedRecoveryOnCreate)return new Promise((F,z)=>{ue(!0),X({createWallet:{onSuccess:Ue=>{U(O,"createWallet","onSuccess",Ue),F(Ue)},onFailure:Ue=>{U(O,"createWallet","onError","unknown_embedded_wallet_error"),z(Ue)},callAuthOnSuccessOnClose:!1}}),ve("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await C.create({accessToken:T});let F=await me.refreshUser(),z=xe(F);if(!z)throw U(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return U(O,"createWallet","onSuccess",z),z}},E2=d=>{if(!L.chains.map(p=>p.id).includes(d))throw new te(`Chain ID ${d} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},Ap=(d,p,m)=>new Promise(async(C,T)=>{if(!a||!s){U(O,"sendTransaction","onError","must_be_authenticated"),T(new Error("User must be authenticated before signing with a Privy wallet"));return}let F=d.from,z=F?s?.linkedAccounts.find(_e=>_e.type==="wallet"&&_e.walletClientType==="privy"&&_e.address===F):xe(s);if(!z){U(O,"sendTransaction","onError","embedded_wallet_not_found"),T(new Error("Must have a Privy wallet before signing"));return}ue(!0);let le=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,Ue=d.chainId?Number(d.chainId):le.chainId;E2(Ue);let Ce=Object.assign({},d,{chainId:Ue}),dt=async()=>{let _e=await Ee();if(!_e||!W){U(O,"sendTransaction","onError","embedded_wallet_not_found"),T(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await me.recoverEmbeddedWallet()){U(O,"sendTransaction","onError","unknown_connect_wallet_error"),T(new Error("Unable to connect to wallet"));return}let Cr=to(Ce.chainId,L.chains,L.rpcConfig,{appId:e.appId}),Cc=await vi(z.address,Ce,Cr);if(L.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:S2}=await gi(Cc,Cr),{hasSufficientFunds:_2}=await rc(z.address,Cc,S2,Cr);if(!_2)throw new ze(new jt("Wallet has insufficient funds for this transaction.",ut.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let Ip=await tc(_e,z.address,W,Cc,Cr);U(O,"sendTransaction","onSuccess",Ip),C(Ip)}catch(Fa){U(O,"sendTransaction","onError","transaction_failure"),T(Fa)}};if(L.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),dt();else{let _e={transactionRequest:Ce,onSuccess:Cr=>{U(O,"sendTransaction","onSuccess",Cr),C(Cr)},onFailure:Cr=>{U(O,"sendTransaction","onError","transaction_failure"),T(Cr)},uiOptions:p||{},fundWalletConfig:m},Fa={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:Cr=>{U(O,"sendTransaction","onError","unknown_connect_wallet_error"),T(Cr)}};X({connectWallet:Fa,sendTransaction:_e}),ve("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function kp(){return new Promise(async(d,p)=>{let m=await Ee();if(!m||!W)throw new Error("Must have valid access token to enroll in MFA");try{await W.verifyMfa({accessToken:m}),d()}catch(C){p(C)}})}let Lt=d=>{if(d==="passkey"){if(s&&s.linkedAccounts.filter(p=>p.type==="passkey").length>=5)throw U(O,"linkAccount","onError","cannot_link_more_of_type"),new b(`User already has an account of type ${d} linked.`)}else if(s?.[d])throw U(O,"linkAccount","onError","cannot_link_more_of_type"),new b(`User already has an account of type ${d} linked.`)},T2=()=>{if(!L.loginConfig.telegramAuthConfiguration?.linkEnabled)throw U(O,"linkAccount","onError","cannot_link_more_of_type"),new b("User can't link an account because Telegram linking is disabled.")};async function Rp({legacySetWalletPasswordFlow:d=!1}){S(null);let p=d?"setWalletPassword":"setWalletRecovery";if(!a||!s)throw U(O,p,"onError","must_be_authenticated"),new Error("User must be authenticated before adding recovery method to Privy wallet");let m=xe(s);if(!m||!W)throw U(O,p,"onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a recovery method");try{await kp()}catch(C){throw U(O,p,"onError","missing_or_invalid_mfa"),C}return new Promise((C,T)=>{ue(!0);let F={onSuccess:Ce=>{U(O,p,"onSuccess","user-passcode",Ce),C(Ce)},onFailure:Ce=>{U(O,p,"onError","user_exited_set_password_flow"),T(Ce)},callAuthOnSuccessOnClose:!1},z=m.recoveryMethod==="user-passcode",Ue={onCompleteNavigateTo:ml({walletAction:"update",availableRecoveryMethods:L.embeddedWallets.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:d,isResettingPassword:z}),shouldForceMFA:!1,onFailure:Ce=>{U(O,p,"onError","unknown_connect_wallet_error"),T(Ce)}};X({setWalletPassword:F,createWallet:F,connectWallet:Ue,recoverySelection:{isInAccountCreateFlow:!1,isResettingPassword:z}}),ve("EMBEDDED_WALLET_CONNECTING_SCREEN")})}let Pn={ready:n,authenticated:a,user:s,walletConnectors:t.connectors||null,connectWallet:Xr,importWallet:async({privateKey:d})=>{De();let[p,m]=await Promise.all([me.initializeWalletProxy(15e3),Ee()]);if(p&&m){await p.import({privateKey:d,accessToken:m});let C=await me.refreshUser(),T=Oc(C);if(!T)throw U(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to import wallet");return U(O,"createWallet","onSuccess",T),T}else throw new b("User is not authenticated")},linkWallet:je,linkEmail:()=>{De(),Lt("email"),J.current="email",ee.current="link",ve("LINK_EMAIL_SCREEN")},linkPhone:()=>{De(),Lt("phone"),J.current="sms",ee.current="link",ve("LINK_PHONE_SCREEN")},linkGoogle:async()=>{De(),Lt("google"),ee.current="link",await me.initLoginWithOAuth("google")},linkTwitter:async()=>{De(),Lt("twitter"),ee.current="link",await me.initLoginWithOAuth("twitter")},linkDiscord:async()=>{De(),Lt("discord"),ee.current="link",await me.initLoginWithOAuth("discord")},linkGithub:async()=>{De(),Lt("github"),ee.current="link",await me.initLoginWithOAuth("github")},linkSpotify:async()=>{De(),Lt("spotify"),ee.current="link",await me.initLoginWithOAuth("spotify")},linkInstagram:async()=>{De(),Lt("instagram"),ee.current="link",await me.initLoginWithOAuth("instagram")},linkTiktok:async()=>{De(),Lt("tiktok"),ee.current="link",await me.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{De(),Lt("linkedin"),ee.current="link",await me.initLoginWithOAuth("linkedin")},linkApple:async()=>{De(),Lt("apple"),ee.current="link",await me.initLoginWithOAuth("apple")},linkPasskey:async()=>{De(),Lt("passkey"),await me.initLinkWithPasskey(),ve("LINK_PASSKEY_SCREEN")},linkTelegram:async()=>{De(),Lt("telegram"),T2(),ee.current="link",J.current="telegram",await me.initLoginWithTelegram(),ve("TELEGRAM_AUTH_SCREEN")},linkFarcaster:async()=>{De(),Lt("farcaster"),await me.initLoginWithFarcaster(),ee.current="link",J.current="farcaster",ve("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(De(),!s?.email)throw new b("User does not have an email linked to their account.");ee.current="link",J.current="email",ve("UPDATE_EMAIL_SCREEN")},login:async()=>{let d="Attempted to log in, but user is already logged in. Use a `link` helper instead.";if(!n){let p=await new Promise(m=>{et(C=>m.bind(C))});if(et(null),p){console.warn(d);return}}if(a){console.warn(d);return}ee.current="login",Ne("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(d=>{et(()=>d)}),et(null)),a){console.warn("User must be unauthenticated to `connectOrCreateWallet`");return}if(u[0]){console.warn("User must have no connected wallets to `connectOrCreateWallet`");return}Ne("CONNECT_OR_CREATE")},logout:async()=>{if(await t.logout(),s&&W)try{await W.clearMfa({userId:s.id})}catch{}c(null),l(!1),S(null),U(O,"logout","onSuccess"),ee.current=null,J.current=null,o(!1),Z.del(Mi)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new Be;let d=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(C=>C.address===d?.address));return!d||!p?new Be:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new xp(new Dr(new Be));let d=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(C=>C.address===d?.address));return!d||!p?new xp(new Dr(new Be)):new xp(new Dr(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new Co(new Be);let d=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(C=>C.address===d?.address));return!d||!p?new Co(new Be):new Co(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},setActiveWallet:async d=>{let p=u.find(C=>Pi(C.address)===Pi(d)),m=s?.linkedAccounts.find(C=>C.type==="wallet"&&Pi(C.address)===Pi(d));if(!p||!await p.isConnected())Y(d),je();else if(!p.linked)p.loginOrLink();else{let C=Object.assign({},s);C.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType,imported:m.imported},c(C)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!a||!s)throw U(O,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return Ua(s,15e3)},setWalletRecovery:async()=>Rp({legacySetWalletPasswordFlow:!1}),setWalletPassword:async()=>Rp({legacySetWalletPasswordFlow:!0}),signMessage:(d,p,m)=>new Promise(async(C,T)=>{if(!a||!s){U(O,"signMessage","onError","must_be_authenticated"),T(new Error("User must be authenticated before signing with a Privy wallet"));return}let F=m?s?.linkedAccounts.find(le=>le.type==="wallet"&&le.walletClientType==="privy"&&Pi(le.address)===Pi(m)):xe(s);if(!F){U(O,"signMessage","onError","embedded_wallet_not_found"),T(new Error("Must have a Privy wallet before signing"));return}if(typeof d!="string"||d.length<1){U(O,"signMessage","onError","invalid_message"),T(new Error("Message must be a non-empty string"));return}ue(!0);let z=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let le=await Ee();if(!W||!le)throw new Error("Unable to connect to wallet");if(!await me.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_started",payload:{walletAddress:F.address}});let{response:Ce}=await W.rpc({accessToken:le,address:F.address,request:{method:"personal_sign",params:[d,F.address]}}),dt=Ce.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_completed",payload:{walletAddress:F.address}}),dt};if(L.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let le=await z();U(O,"signMessage","onSuccess",le),C(le)}catch(le){U(O,"signMessage","onError","unable_to_sign"),T(le??new ze("Unable to sign message"))}}else{let Ce={method:"personal_sign",data:d,confirmAndSign:z,onSuccess:_e=>{U(O,"signMessage","onSuccess",_e),C(_e)},onFailure:_e=>{U(O,"signMessage","onError","unable_to_sign"),T(_e)},uiOptions:p||{}},dt={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:_e=>{U(O,"signMessage","onError","unknown_connect_wallet_error"),T(_e)},address:F.address};X({signMessage:Ce,connectWallet:dt}),ve("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(d,p)=>new Promise(async(m,C)=>{if(!a||!s){U(O,"signTypedData","onError","must_be_authenticated"),C(new Error("User must be authenticated before signing with a Privy wallet"));return}let T=xe(s);if(!T){U(O,"signTypedData","onError","embedded_wallet_not_found"),C(new Error("Must have a Privy wallet before signing"));return}ue(!0);let F=Xa(d),z=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let le=await Ee();if(!W||!le)throw new Error("Unable to connect to wallet");if(!await me.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_started",payload:{walletAddress:T.address}});let{response:Ce}=await W.rpc({accessToken:le,address:T.address,request:{method:"eth_signTypedData_v4",params:[T.address,F]}}),dt=Ce.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_completed",payload:{walletAddress:T.address}}),dt};if(L.embeddedWallets.noPromptOnSignature||(L.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let le=await z();U(O,"signTypedData","onSuccess",le),m(le)}catch(le){U(O,"signTypedData","onError","unable_to_sign"),C(le??new ze("Unable to sign message"))}}else{let Ce={method:"eth_signTypedData_v4",data:F,confirmAndSign:z,onSuccess:_e=>{U(O,"signTypedData","onSuccess",_e),m(_e)},onFailure:_e=>{U(O,"signTypedData","onError","unable_to_sign"),C(_e)},uiOptions:p||{}},dt={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:_e=>{U(O,"signMessage","onError","unknown_connect_wallet_error"),C(_e)}};X({signMessage:Ce,connectWallet:dt}),ve("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(d,p,m)=>{let T=await(await Ap(d,p,m)).wait();return oc(T)},exportWallet:()=>new Promise(async(d,p)=>{if(!a||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}if(!xe(s)){p(new Error("Must have a Privy wallet before exporting"));return}ue(!0);let C={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p,shouldForceMFA:!0};if(X(be),!await Ee()||!W){p(new Error("Must have valid access token to enroll in MFA"));return}if(!W){p(new Error("Must have a Privy wallet before exporting"));return}let F={appId:e.appId,appClientId:e.clientId,origin:t.apiUrl,onSuccess:d,onFailure:p};X({keyExport:F,connectWallet:C}),ve("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:kp,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 b("Invalid MFA code");Wt.current?.resolve({mfaMethod:d,mfaCode:p,relyingParty:window.origin}),await new Promise((F,z)=>{qe.current={resolve:F,reject:z}});break;case"passkey":if(typeof p=="string")throw new b("Invalid authenticator response");let C=await(await import("@simplewebauthn/browser")).startAuthentication(p),T=m2(C);Wt.current?.resolve({mfaMethod:d,mfaCode:T,relyingParty:window.origin}),await new Promise((F,z)=>{qe.current={resolve:F,reject:z}});break;default:throw Wt.current?.reject(new b("Unsupported MFA method")),new b(`Unsupported MFA method: ${d}`)}},cancel(){Wt.current?.reject(new b("MFA canceled"))},async initEnrollmentWithSms(d){let p=await Ee();if(!p||!W)throw new Error("Must have valid access token to enroll in MFA");await W.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber})},enrollInMfa(d){return new Promise((p,m)=>{if(!d){me.closePrivyModal(),p();return}L.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."),X({mfaEnrollmentFlow:{mfaMethods:L.mfa.methods,onSuccess:p,onFailure:m}}),ve("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let d=await Ee();if(!d||!W)throw new Error("Must have valid access token to enroll in MFA");let p=await W.initEnrollMfa({method:"totp",accessToken:d});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(d){let p=await Ee();if(!p||!W)throw new Error("Must have valid access token to enroll in MFA");await W.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber,code:d.mfaCode});let m=await t.getAuthenticatedUser();c(m)},async submitEnrollmentWithTotp(d){let p=await Ee();if(!p||!W)throw new Error("Must have valid access token to enroll in MFA");await W.submitEnrollMfa({method:"totp",accessToken:p,code:d.mfaCode});let m=await t.getAuthenticatedUser();c(m)},async initEnrollmentWithPasskey(){},async submitEnrollmentWithPasskey({credentialIds:d}){let p=await Ee();if(!p||!W)throw new Error("Must have valid access token to enroll in MFA");await W.submitEnrollMfa({method:"passkey",accessToken:p,credentialIds:d});let m=await t.getAuthenticatedUser();c(m)},async unenroll(d){let p=await Ee();if(!p||!W)throw new Error("Must have valid access token to remove MFA");d==="passkey"?await W.submitEnrollMfa({method:"passkey",accessToken:p,credentialIds:[]}):await W.unenrollMfa({method:d,accessToken:p});let m=await t.getAuthenticatedUser();c(m)},requestFarcasterSignerFromWarpcast:async()=>{let d=await Ee(),p=s?.linkedAccounts.find(T=>T.type==="wallet"&&T.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!W||!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 me.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");let C=await W.initFarcasterSigner({address:p.address,hdWalletIndex:null,accessToken:d,mfaCode:null,mfaMethod:null,relyingParty:window.origin});if(C.status==="approved"){let T=await t.getAuthenticatedUser();c(T||s||null)}X({farcasterSigner:C}),ve("AWAITING_FARCASTER_SIGNER")},getFarcasterSignerPublicKey:async()=>{let d=await Ee(),p=s?.linkedAccounts.find(T=>T.type==="wallet"&&T.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!W||!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 me.recoverEmbeddedWallet())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(T=>Uint8Array.from(T.match(/.{1,2}/g).map(F=>parseInt(F,16))))(s.farcaster.signerPublicKey.slice(2))},signFarcasterMessage:async d=>{let p=await Ee(),m=s?.linkedAccounts.find(z=>z.type==="wallet"&&z.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!W||!m)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 me.recoverEmbeddedWallet())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 T=await import("@simplewebauthn/browser"),F=await W.signFarcasterMessage({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{hash:T.bufferToBase64URLString(d)},fid:BigInt(s.farcaster.fid),relyingParty:window.origin});return new Uint8Array(T.base64URLStringToBuffer(F.signature))},isHeadlessOAuthLoading:_,loginWithCode(d){return me.loginWithCode(d)},initLoginWithEmail(d){return me.initLoginWithEmail(d)},initLoginWithSms(d){return me.initLoginWithSms(d)},otpState:D,fundWallet(d,p){return me.fundWallet(d,p)},initLoginWithHeadlessOAuth(d,p){return me.initLoginWithHeadlessOAuth(d,p)},loginWithHeadlessOAuth(d){return me.loginWithHeadlessOAuth(d)},isModalOpen:r,mfaMethods:L.mfa.methods};h2=Pn.signMessage,y2=Pn.signTypedData,g2=async(...d)=>{let p=await Ap(...d);return L.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let me=(()=>({isNewUserThisSession:g,linkingHint:K,pendingTransaction:null,walletConnectionStatus:x,mipdStore:R,connectors:t.connectors?.walletConnectors??[],rpcConfig:L.rpcConfig,chains:L.chains,appId:e.appId,showFiatPrices:L.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:d=>L.chains.find(p=>p.id===Number(d))?.nativeCurrency.symbol,initializeWalletProxy:async d=>{if(W)return W;let p=new Promise(T=>{rt(()=>F=>T(F))}),m=new Promise(T=>setTimeout(()=>T(null),d)),C=await Promise.race([p,m]);return rt(null),C},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(d={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let p=n&&a&&s,m;p&&J.current&&(m=s?.linkedAccounts.filter(C=>C.latestVerifiedAt!==null&&!(C.type==="wallet"&&C.walletClientType==="privy")).sort((C,T)=>T.latestVerifiedAt.getTime()-C.latestVerifiedAt.getTime())[0]),ee.current==="login"&&J.current?d.shouldCallAuthOnSuccess&&p?(U(O,"login","onComplete",s,g,!1,J.current,m??null),e.onSuccess?.(s,g)):U(O,"login","onError","exited_auth_flow"):ee.current==="link"&&J.current&&m&&(d.isSuccess&&p?U(O,"linkAccount","onSuccess",s,J.current,m):U(O,"linkAccount","onError","exited_link_flow")),Y(null),ee.current=null,J.current=null,v(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent({eventName:"modal_closed"})},openPrivyModal:ve,connectWallet:bn,initLoginWithWallet:async(d,p)=>{J.current="siwe",En(d,p)},loginWithWallet:async()=>{if(!n)throw new eo;if(!(t.authFlow instanceof Qo))throw new b("Must initialize SIWE flow first.");let d,p;if(a)try{({user:d}=await t.link()),J.current="siwe"}catch(m){throw U(O,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:d,isNewUser:p}=await t.authenticate()),J.current="siwe"}catch(m){throw U(O,"login","onError",m.privyErrorCode||"generic_connect_wallet_error"),m}c(d||s||null),v(p||!1),l(!0)},initLoginWithFarcaster:async d=>{let p=new ki(d);t.startAuthFlow(p);try{J.current="farcaster",await p.initializeFarcasterConnect()}catch(m){throw ee.current==="login"?U(O,"login","onError",m.privyErrorCode||"unknown_auth_error"):ee.current==="link"&&U(O,"linkAccount","onError",m.privyErrorCode||"unknown_auth_error"),m}},loginWithFarcaster:async()=>{if(!n)throw new eo;if(!(t.authFlow instanceof ki))throw new b("Must initialize Farcaster flow first.");let d,p;if(a)try{({user:d}=await t.link()),J.current="farcaster"}catch(m){throw U(O,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:d,isNewUser:p}=await t.authenticate()),J.current="farcaster"}catch(m){throw U(O,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}c(d||null),v(p||!1),l(!0)},async initLoginWithOAuth(d,p){if(J.current=d,Tc()){if(d==="google"&&gc(window.navigator.userAgent)){Ne("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{Ne("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}Z.del(jo);let m=new Nr({provider:d});p&&m.addCaptchaToken(p),t.startAuthFlow(m);let C=await t.authFlow.getAuthorizationUrl();C&&C.url&&(d==="twitter"&&mE&&(C.url=C.url.replace("x.com","twitter.com")),window.location.assign(C.url))},async initLoginWithTelegram(d){if(!n)throw new eo;J.current="telegram";let p=new An(d);t.startAuthFlow(p),p.meta.telegramWebAppData=void 0,p.meta.telegramAuthResult=await new Promise((m,C)=>{if(!L.loginConfig.telegramAuthConfiguration)return C(new b("Telegram Auth configuration is not loaded"));if(!window.Telegram)return C(new b("Telegram was not initialized"));window.Telegram.Login.auth({bot_id:L.loginConfig.telegramAuthConfiguration.botId,request_access:!0},T=>T?m(T):C(new b("Telegram auth failed or was canceled by the client")))})},async loginWithTelegram(){if(!(t.authFlow instanceof An))throw new b("Must initialize Telegram flow before calling loginWithTelegram");let d,p;if(a)try{({user:d}=await t.link()),J.current="telegram"}catch(m){throw U(O,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{let m=await t.authenticate();d=m.user,p=m.isNewUser,J.current="telegram"}catch(m){throw ee.current==="login"?U(O,"login","onError",m.privyErrorCode||"unknown_auth_error"):ee.current==="link"&&U(O,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}c(d),v(p||!1),l(!0)},async recoveryOAuthFlow(d,p,m){let C,T;function F(z){if(!z)throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:"Unable to open recovery OAuth popup",provider:d}}),new b("Recovery OAuth failed")}switch(d){case"google-drive":{let{url:z,codeVerifier:le,stateCode:Ue}=await gd({api:fo.api,provider:d});F(z);let Ce,dt;try{let _e=await _p({url:z,popup:m,provider:d});if(Ce=_e.stateCode,dt=_e.authorizationCode,Ce!==Ue)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d,storedStateCode:Ue??"",returnedStateCode:Ce??""}}),new b("Unexpected auth flow. This may be a phishing attempt.")}catch(_e){throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:_e.toString(),provider:d}}),new b("Recovery OAuth failed")}[C,T]=await Promise.all([Ee(),Zf({api:fo.api,provider:d,codeVerifier:le,stateCode:Ce,authorizationCode:dt})]);break}case"icloud":{let{url:z}=await gd({api:fo.api,provider:d});F(z);let{ckWebAuthToken:le}=await _p({url:z,popup:m,provider:d});T=le,C=await Ee();break}}if(!W)throw new b("Cannot connect to wallet proxy");if(!C)throw new b("Unable to authorize user");switch(p){case"recover":let z=be.recoverWallet?.privyWallet?.address;if(!z)throw new b("Recovery OAuth failed");t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:z,recoveryMethod:d}}),await W.recover({address:z,accessToken:C,recoveryAccessToken:T,recoveryMethod:d}),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:z,recoveryMethod:d}});break;case"create-wallet":t.createAnalyticsEvent({eventName:"embedded_wallet_creation_started"}),await W.create({accessToken:C,recoveryAccessToken:T,recoveryMethod:d});let le=await me.refreshUser(),Ue=xe(le);if(!Ue)throw U(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:Ue.address}}),U(O,"createWallet","onSuccess",Ue);break;case"set-recovery":let Ce=xe(s);if(!Ce)throw U(O,"setWalletRecovery","onError","embedded_wallet_not_found"),new Error("Embedded wallet not found");t.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_started",payload:{recoveryMethod:d}}),await W.setRecovery({address:Ce.address,accessToken:C,recoveryAccessToken:T,recoveryMethod:d});let dt=xe(await me.refreshUser());if(!dt)throw U(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to set recovery on wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:Ce.address,recoveryMethod:d}}),U(O,"setWalletRecovery","onSuccess",d,dt);break;default:throw new b("Unsupported recovery action")}},async loginWithOAuth(d){if(!(t.authFlow instanceof Nr))throw new b("Must initialize OAuth flow before calling loginWithOAuth");let p=Z.get($o),m=t.authFlow.meta.stateCode;if(p!==m)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d,storedStateCode:p??"",returnedStateCode:m??""}}),new b("Unexpected auth flow. This may be a phishing attempt.");let C,T,F;if(a)try{let z=await t.link();C=z.user,F=z.oAuthProviderTokens,J.current=d}catch(z){throw U(O,"linkAccount","onError",z.privyErrorCode||"failed_to_link_account"),z}else try{let z=await t.authenticate();C=z.user,T=z.isNewUser,F=z.oAuthProviderTokens,J.current=d}catch(z){throw ee.current==="login"?U(O,"login","onError",z.privyErrorCode||"unknown_auth_error"):ee.current==="link"&&U(O,"linkAccount","onError",z.privyErrorCode||"failed_to_link_account"),z}return c(C),v(T||!1),l(!0),F},async initLoginWithPasskey(d){let p=new Jo(d);t.startAuthFlow(p),ee.current="login";try{J.current="passkey",await p.initAuthenticationFlow()}catch(m){throw U(O,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}},async loginWithPasskey(){if(!n)throw new eo;if(!(t.authFlow instanceof Jo))throw new b("Must initialize Passkey flow first.");if(J.current!=="passkey")throw new b("Must init login with Passkey flow first.");let d,p;try{J.current="passkey",{user:d,isNewUser:p}=await t.authenticate()}catch(m){throw U(O,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}c(d),v(p||!1),l(!0)},async initLinkWithPasskey(d){let p=new Jo(d);t.startAuthFlow(p),ee.current="link",J.current="passkey";try{await p.initLinkFlow()}catch(m){throw U(O,"linkAccount","onError",m.privyErrorCode||"unknown_auth_error"),m}},async linkWithPasskey(){if(!n)throw new eo;if(!(t.authFlow instanceof Jo))throw new b("Must initialize Passkey flow first.");if(J.current!=="passkey")throw new b("Must init login with Passkey flow first.");let d;try{J.current="passkey",{user:d}=await t.link()}catch(p){throw U(O,"linkAccount","onError",p.privyErrorCode||"failed_to_link_account"),p}return c(d||s||null),d},async initLoginWithHeadlessOAuth(d,p){if(Tc()){if(d==="google"&&gc(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 m=new Nr({provider:d,headless:!0});p&&m.addCaptchaToken(p);let C=await t.startAuthFlow(m).getAuthorizationUrl();C?.url&&window.location.assign(C.url)},async loginWithHeadlessOAuth(d){w(!0),t.startAuthFlow(new Nr(d));let p=Z.get($o),m=d.stateCode;if(p!==m)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d.provider,storedStateCode:p??"",returnedStateCode:m??""}}),w(!1),new b("Unexpected auth flow. This may be a phishing attempt.");let C,T;if(a)try{({user:C}=await t.link()),J.current=d.provider}catch(F){throw U(O,"linkAccount","onError",F.privyErrorCode||"failed_to_link_account"),F}else try{({user:C,isNewUser:T}=await t.authenticate()),J.current=d.provider}catch(F){throw ee.current==="login"?U(O,"login","onError",F.privyErrorCode||"unknown_auth_error"):ee.current==="link"&&U(O,"linkAccount","onError",F.privyErrorCode||"failed_to_link_account"),F}return c(C),v(T||!1),l(!0),w(!1),C??void 0},initLoginWithEmail:async(d,p)=>{let m=new ho(d,p);t.startAuthFlow(m);try{J.current="email",await m.sendCodeEmail()}catch(C){throw ee.current==="login"?U(O,"login","onError",C.privyErrorCode||"unknown_auth_error"):ee.current==="link"&&U(O,"linkAccount","onError",C.privyErrorCode||"failed_to_link_account"),C}},initUpdateEmail:async(d,p,m)=>{let C=new Ka(d,p,m);t.startAuthFlow(C),await C.sendCodeEmail()},initLoginWithSms:async(d,p)=>{I({status:"sending-code"});let m=new Xo(d,p);t.startAuthFlow(m);try{J.current="sms",await m.sendSmsCode(),I({status:"awaiting-code-input"})}catch(C){throw I({status:"error",error:C}),ee.current==="login"?U(O,"login","onError",C.privyErrorCode||"unknown_auth_error"):ee.current==="link"&&U(O,"linkAccount","onError",C.privyErrorCode||"failed_to_link_account"),C}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async d=>{if(I({status:"submitting-code"}),!n){let T=new eo;throw I({status:"error",error:T}),T}if(t.authFlow instanceof ho)t.authFlow.meta.emailCode=d.trim();else if(t.authFlow instanceof Xo)t.authFlow.meta.smsCode=d.trim();else{let T=new b("Must initialize a passwordless code flow first");throw I({status:"error",error:T}),T}let p=await Ee(),m,C;if(p&&t.sessionHasActiveToken())try{({user:m}=await t.link())}catch(T){throw I({status:"error",error:T}),U(O,"linkAccount","onError",T.privyErrorCode||"failed_to_link_account"),T}else try{({user:m,isNewUser:C}=await t.authenticate())}catch(T){throw I({status:"error",error:T}),U(O,"login","onError",T.privyErrorCode||"unknown_auth_error"),T}c(m||s||null),v(C||!1),l(!0),I({status:"done"})},refreshUser:async()=>{let d=await t.getAuthenticatedUser();return c(d),d},walletProxy:W,createAnalyticsEvent:({eventName:d,payload:p,timestamp:m})=>t.createAnalyticsEvent({eventName:d,payload:p,timestamp:m}),acceptTerms:async()=>{let d=await t.acceptTerms();return c(d),d},getUsdTokenPrice:d=>t.getUsdTokenPrice(d),recoverEmbeddedWallet:async()=>new Promise(async(d,p)=>{let m=s?.linkedAccounts.find(T=>T.type==="wallet"&&T.walletClientType==="privy"),C=await Ee();if(!C||!W||!m){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}ue(!0);try{await W.connect({accessToken:C,address:m.address}),d(!0)}catch(T){if(ei(T)&&m.recoveryMethod==="privy")t.createAnalyticsEvent({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:m.address}}),(await W.recover({address:m.address,accessToken:C,recoveryMethod:m.recoveryMethod})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:m.address}}),d(!0);else if(ei(T)&&m.recoveryMethod!=="privy"){X({recoverWallet:{privyWallet:m,onFailure:p,onSuccess:()=>d(!0)},recoveryOAuthStatus:{provider:m.recoveryMethod,action:"recover"}});let F=fl(m.recoveryMethod);ve(F)}else p(T)}}),getFiatOnRampConfig:Go,setReadyToTrue:d=>{i(!0),Pt?.(d)},updateWallets:()=>Vo(),fundWallet:async(d,p)=>{let{signedUrl:m,externalTransactionId:C}=await Go(d,p);X({fiatOnRampPrompt:{signedUrl:m},fiatOnRampStatus:{externalTransactionId:C}}),ve("FIAT_ON_RAMP_PROMPT_SCREEN")},requestFarcasterSignerStatus:async d=>{let p=await Ee(),m=s?.linkedAccounts.find(T=>T.type==="wallet"&&T.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!W||!m)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 C=await t.requestFarcasterSignerStatus(d);if(C.status==="approved"){let T=await t.getAuthenticatedUser();c(T||s||null)}return C}}))();v2=me.recoverEmbeddedWallet;let P2=uE(()=>({wallets:u,ready:ar&&Ho}),[u,ar,Ho]);return vr(he.Provider,{value:Pn,children:vr(Kc.Provider,{value:O,children:vr(dp.Provider,{value:P2,children:vr(Km,{...L,children:f2($c.Provider,{value:me,children:[f2(Bm,{data:be,setModalData:X,setInitialScreen:S,initialScreen:y,authenticated:a,open:r,children:[e.children,!L.headless&&L.captchaEnabled&&n&&!a&&vr(qc,{delayedExecution:!1}),vr(Qg,{theme:{...L.appearance.palette||{}}}),!L.render.standalone&&vr(Pp,{open:r})]}),pe&&ae?vr(u2,{appId:e.appId,appClientId:e.clientId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:Wt,mfaSubmitPromise:qe,onLoad:G,onLoadFailed:()=>null}):null,L.loginMethods.telegram&&L.loginConfig.telegramAuthConfiguration&&vr(Sr,{if:!0,children:vr(c2,{scriptHost:e.apiUrl||Ri,botUsername:L.loginConfig.telegramAuthConfiguration.botName})})]})})})})})};import{useContext as vE}from"react";function CE(e){let{login:t}=vE(he);return Oe("login",e),{login:t}}import{useContext as wE}from"react";function bE(e){let{logout:t}=wE(he);return Oe("logout",e),{logout:t}}import{useCallback as C2,useEffect as EE}from"react";function TE(){let e=ye(),t=Hs(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:i,user:a}=B(),l=C2(async c=>{if(e.enabled&&e.status!=="success")throw new Er(e.error,null,"captcha_failure");return r(c.provider,e.token)},[r,e]),s=C2(async()=>{let c=Ni();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(u){throw u}finally{Zo()}},[o]);return EE(()=>{let c=Ni();i&&t&&c.inProgress&&c.headless&&!c.popupFlow&&s()},[i,t]),{initOAuth:l,loginWithOAuth:s,loading:n}}import{useCallback as w2}from"react";var PE=()=>{let e=ye(),{initLoginWithEmail:t,loginWithCode:r}=B(),o=w2(async({email:i})=>{if(!i)throw new Error("Email required to send OTP code");return t(i)},[t]),n=w2(async({code:i})=>{if(e.enabled&&e.status==="error")throw new Er(e.error,null,"captcha_failure");return r(i)},[r,e.status]);return{sendCode:o,loginWithCode:n}};import{useCallback as b2}from"react";var SE=()=>{let e=ye(),{initLoginWithSms:t,loginWithCode:r,otpState:o}=B(),n=b2(async({phoneNumber:a})=>{if(!a)throw new Error("SMS required to send OTP code");return t(a)},[t]),i=b2(async({code:a})=>{if(e.enabled&&e.status!=="success")throw new Er(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:n,loginWithCode:i,state:o}};import{useContext as _E}from"react";function xE(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:a,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:u,linkSpotify:h,linkInstagram:f,linkTelegram:g,linkFarcaster:v}=_E(he);return Oe("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:a,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:u,linkSpotify:h,linkInstagram:f,linkFarcaster:v,linkTelegram:g}}import{useContext as AE}from"react";function kE(e){let{connectWallet:t}=AE(he);return Oe("connectWallet",e),{connectWallet:t}}import{useContext as RE}from"react";function IE(e){let{createWallet:t}=RE(he);return Oe("createWallet",e),{createWallet:t}}var ME=()=>{let{fundWallet:e}=B();return{fundWallet:e}};import{useContext as WE}from"react";function LE(e){let{sendTransaction:t}=WE(he);return Oe("sendTransaction",e),{sendTransaction:t}}import{useContext as OE}from"react";function NE(e){let{setWalletPassword:t}=OE(he);return Oe("setWalletPassword",e),{setWalletPassword:t}}import{useContext as DE}from"react";function UE(e){let{setWalletRecovery:t}=DE(he);return Oe("setWalletRecovery",e),{setWalletRecovery:t}}import{useContext as FE}from"react";function BE(e){let{signMessage:t}=FE(he);return Oe("signMessage",e),{signMessage:t}}import{useContext as HE}from"react";function GE(e){let{signTypedData:t}=HE(he);return Oe("signTypedData",e),{signTypedData:t}}import{useContext as VE}from"react";var zE=()=>{let{isModalOpen:e}=VE(he);return{isOpen:e}};import{useContext as qE}from"react";function $E(e){let{getAccessToken:t}=qE(he);return Oe("accessToken",e),{getAccessToken:t}}function KE(){let{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}=B();return{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}}function jE(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}function YE(e){return e.find(r=>r.walletClientType==="privy"&&r.connectorType==="embedded"&&!r.imported)??null}export{Dr as AsExternalProvider,qc as Captcha,zi as ConnectorManager,Pp as LoginModal,qi as PrivyClient,yE as PrivyProvider,Be as PrivyProxyProvider,Gi as SUPPORTED_CHAINS,_c as VERSION,Dt as WalletConnector,jE as addRpcUrlOverrideToChain,hd as errorIndicatesMaxMfaRetries,sn as errorIndicatesMfaTimeout,ln as errorIndicatesMfaVerificationFailed,Ee as getAccessToken,YE as getEmbeddedConnectedWallet,kE as useConnectWallet,IE as useCreateWallet,KE as useExperimentalFarcasterSigner,ME as useFundWallet,xE as useLinkAccount,CE as useLogin,PE as useLoginWithEmail,TE as useLoginWithOAuth,SE as useLoginWithSms,bE as useLogout,va as useMfa,Mr as useMfaEnrollment,zE as useModalStatus,B as usePrivy,jc as useRegisterMfaListener,LE as useSendTransaction,NE as useSetWalletPassword,UE as useSetWalletRecovery,BE as useSignMessage,GE as useSignTypedData,$E as useToken,ka as useWallets};
3043
+ `;import{useRef as w2,useEffect as gE}from"react";import{jsx as CE}from"react/jsx-runtime";function vE({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 b2(e){let t=w2(null),r=w2();return gE(()=>{r.current?.remove(),r.current=vE(e),t.current?.after(r.current)},[e]),CE("div",{ref:t,hidden:!0})}import{useState as wE}from"react";import{useEffect as E2,useRef as T2}from"react";var bc=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;default:throw new Error(`invalid wallet event type ${t}`)}}};async function Fo(e,t,r,o,n,i=!1){let a=i,s=async u=>{if(a&&t&&t.length>0){u===(i?0:1)?n("configureMfa","onMfaRequired",t):o.current?.reject(new Ve("missing_or_invalid_mfa","MFA verification failed, retry."));let f=await new Promise((h,g)=>{r.current={resolve:h,reject:g};let v=1e3*60*5;setTimeout(()=>{let y=new Ve("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(y),g(y)},v)});return await e(f)}return await e()},l=4,c=null;for(let u=0;u<l;u++)try{c=await s(u),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 u=new Ve("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(u),u}return c}import{jsx as SE}from"react/jsx-runtime";var bE=function(e){return()=>`id-${e++}`}(0);function EE(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function $t(e){return e.error!==void 0}var It=new bc,Ip=new Map,TE=(e,t)=>typeof t=="bigint"?t.toString():t,PE=(e,t)=>`${e}${JSON.stringify(t,TE)}`;function Kt(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let i=PE(e,t);if(e==="privy:wallet:create"){let s=Ip.get(i);if(s)return s}let a=new Promise((s,l)=>{let c=bE();It.enqueue(c,{resolve:s,reject:l}),n.postMessage({id:c,event:e,data:t},o)}).finally(()=>{Ip.delete(i)});return Ip.set(i,a),a}function _E(e){switch(e.event){case"privy:iframe:ready":let t=It.dequeue(e.event,e.id);return $t(e)?t.reject(new Ve(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=It.dequeue(e.event,e.id);return $t(e)?r.reject(new Ve(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:import":let o=It.dequeue(e.event,e.id);return $t(e)?o.reject(new Ve(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:connect":let n=It.dequeue(e.event,e.id);return $t(e)?n.reject(new Ve(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:recover":let i=It.dequeue(e.event,e.id);return $t(e)?i.reject(new Ve(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:rpc":let a=It.dequeue(e.event,e.id);return $t(e)?a.reject(new Ve(e.error.type,e.error.message)):a.resolve(e.data);case"privy:wallet:set-recovery":let s=It.dequeue(e.event,e.id);return $t(e)?s.reject(new Ve(e.error.type,e.error.message)):s.resolve(e.data);case"privy:mfa:verify":let l=It.dequeue(e.event,e.id);return $t(e)?l.reject(new Ve(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:init-enrollment":{let c=It.dequeue(e.event,e.id);return $t(e)?c.reject(new Ve(e.error.type,e.error.message)):c.resolve(e.data)}case"privy:mfa:submit-enrollment":{let c=It.dequeue(e.event,e.id);return $t(e)?c.reject(new Ve(e.error.type,e.error.message)):c.resolve(e.data)}case"privy:mfa:unenroll":{let c=It.dequeue(e.event,e.id);return $t(e)?c.reject(new Ve(e.error.type,e.error.message)):c.resolve(e.data)}case"privy:mfa:clear":{let c=It.dequeue(e.event,e.id);return $t(e)?c.reject(new Ve(e.error.type,e.error.message)):c.resolve(e.data)}case"privy:farcaster:init-signer":{let c=It.dequeue(e.event,e.id);return $t(e)?c.reject(new Ve(e.error.type,e.error.message)):c.resolve(e.data)}case"privy:farcaster:sign":{let c=It.dequeue(e.event,e.id);return $t(e)?c.reject(new Ve(e.error.type,e.error.message)):c.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function P2(e){let t=T2(null),r=T2(e.mfaMethods),o=Js(),[n,i]=wE(!1);return E2(()=>{r.current=e.mfaMethods},[e.mfaMethods]),E2(()=>{if(!n)return;let a=t.current;if(!a)return;function s(h){h&&h.origin===e.origin&&EE(h.data)&&_E(h.data)}let l={create(h){return Kt("privy:wallet:create",h,a,e.origin)},import(h){return Kt("privy:wallet:import",h,a,e.origin)},connect(h){return Kt("privy:wallet:connect",h,a,e.origin)},recover(h){return Fo(g=>Kt("privy:wallet:recover",{...h,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!h.recoveryMethod||h.recoveryMethod==="privy")},rpc(h){return Fo(g=>Kt("privy:wallet:rpc",{...h,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},setRecovery(h){return Fo(g=>Kt("privy:wallet:set-recovery",{...h,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(h){return Fo(g=>Kt("privy:mfa:verify",{...h,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(h){return Fo(g=>Kt("privy:mfa:init-enrollment",{...h,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(h){return Fo(g=>Kt("privy:mfa:submit-enrollment",{...h,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},unenrollMfa(h){return Fo(g=>Kt("privy:mfa:unenroll",{...h,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},clearMfa(h){return Kt("privy:mfa:clear",h,a,e.origin)},initFarcasterSigner(h){return Kt("privy:farcaster:init-signer",h,a,e.origin)},signFarcasterMessage(h){return Kt("privy:farcaster:sign",h,a,e.origin)}};window.addEventListener("message",s);let c=()=>e.onLoad(l),u=(...h)=>{console.warn("Privy iframe failed to load: ",...h),e.onLoadFailed()},f=new AbortController;return Mi(()=>Kt("privy:iframe:ready",{},a,e.origin),{abortSignal:f.signal}).then(c,u),()=>{window.removeEventListener("message",s),f.abort()}},[n]),SE("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>i(!0),src:ss(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId,client_id:e.appClientId})})}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,apiUrl:n.provider_app_custom_api_url}}async function _2({api:e,appId:t}){let r=Yo(),o=Rn(),n=await In(r);try{let{url:i}=await e.post(Xa,{provider:`privy:${t}`,redirect_to:window.location.href,code_challenge:n,state_code:o});return{url:i,stateCode:o,codeVerifier:r}}catch(i){throw te(i)}}async function S2({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_provider_tokens.access_token}catch(i){let a=te(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")}}async function A2({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.")),s()},12e4);function s(){t?.close(),window.removeEventListener("message",c)}let l=setInterval(()=>{t?.closed&&(s(),clearInterval(l),clearTimeout(a),n(new w("User rejected request")))},300);function c(u){u.data&&(u.data.type==="PRIVY_OAUTH_RESPONSE"&&u.data.stateCode&&u.data.authorizationCode&&(clearTimeout(a),o(u.data),s()),u.data.type==="PRIVY_OAUTH_ERROR"&&(clearTimeout(a),n(new w(u.data.error)),s()))}window.addEventListener("message",c)})}var Tc=({user:e,address:t,client:r,request:o,requesterAppId:n})=>{let i=e?.linkedAccounts.find(c=>!!(c.type==="cross_app"&&c.embeddedWallets.find(u=>u.address===t)));if(!e||!i)throw new w("Cannot request a signature with for this wallet address");let a=r.getProviderAccessToken(i.providerApp.id);if(!a)throw new w("Transactions require a valid token");let s=window.open(void 0,void 0,Mp({w:400,h:680}));if(!s)throw new w("Failed to initialize signature request");return Ec({api:r.api,requesterAppId:n,providerAppId:i.providerApp.id}).then(({apiUrl:c})=>{let u=new URL(`${c}/oauth/transact`);u.searchParams.set("token",a),u.searchParams.set("request",AE(o)),s.location=u.href}),new Promise((c,u)=>{let f=()=>{s.close(),window.removeEventListener("message",y)},g=setTimeout(()=>{f(),u(new w("Request timeout"))},12e4),v=setInterval(()=>{s.closed&&(f(),clearInterval(v),clearTimeout(g),u(new w("User rejected request")))},300),y=T=>{T.data&&T.data.type==="PRIVY_CROSS_APP_ACTION_RESPONSE"&&T.data.result&&(f(),clearTimeout(g),c(T.data.result))};window.addEventListener("message",y)})},AE=e=>JSON.stringify({content:{request:{request:e}},timestamp:Date.now(),callbackUrl:window.origin}),Mp=({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,s=i/window.screen.availHeight,l=(n-e)/2/a+r,c=(i-t)/2/s+o;return`toolbar=0,location=0,menubar=0,height=${t},width=${e},popup=1,left=${l},top=${c}`};function Pc(e){let t=e.toLowerCase();return!!window?.webkit?.messageHandlers?.ReactNativeWebView||!!window?.ReactNativeWebView||["fbav","fban","instagram","snapchat","linkedinapp"].some(n=>t.includes(n))}var xE="https://cdn.apple-cloudkit.com";async function Wp({url:e,popup:t,provider:r}){return t.location=e,new Promise((n,i)=>{function a(){t?.close(),window.removeEventListener("message",s)}function s(l){l.data&&(l.data.type==="PRIVY_OAUTH_RESPONSE"&&l.data.stateCode&&l.data.authorizationCode&&(n(l.data),a()),l.origin===xE&&l.data.ckSession&&(n({type:"PRIVY_OAUTH_RESPONSE",ckWebAuthToken:l.data.ckSession}),a()),l.data.type==="PRIVY_OAUTH_ERROR"&&(i(l.data.error),a()))}window.addEventListener("message",s)})}var x2=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 vr,jsxs as k2}from"react/jsx-runtime";var eo;function ME(e){return typeof e=="string"&&e.length===25}function Ee(){if(!eo){let e=Y.get(zo);return Promise.resolve(e||null)}return eo.getAccessToken()}var R2,cm=(e,t,r)=>R2(e,t,r),I2,dm=(e,t)=>I2(e,t),M2,pm=(e,t)=>M2(e,t),W2,um=()=>W2(),WE=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;Y.put(Ni,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},LE=({config:e,...t})=>{if(!ME(t.appId))throw new w("Cannot initialize the Privy provider with an invalid Privy app ID");eo||(eo=new Zi({appId:t.appId,appClientId:t.clientId,apiUrl:t.apiUrl||Oi}));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."),vr(Vm,{client:eo,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:vr(OE,{...t,client:eo})})},OE=e=>{let t=e.client,[r,o]=tt(!1),[n,i]=tt(!1),[a,s]=tt(!1),[l,c]=tt(null),[u,f]=tt([]),h=ki(u),[g,v]=tt(!1),[y,T]=tt(null),[_,b]=tt(!1),[A,k]=tt({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:E}),[N,R]=tt({status:"initial"}),[I,H]=tt(null),[G,Z]=tt(null),[W,q]=tt(null),L=it(),se=Ks(),[ue,me]=tt(!0),[be,X]=tt({}),[Pt,rt]=tt(null),[Mt,nt]=tt(null),[sr,Ie]=tt(!1),[je,lr]=tt(!1),Wt=ki(null),$e=ki(null),O=ki(tf),[Bo,_e]=tt(!1);t.onStoreToken=d=>{d&&U(O,"accessToken","onAccessTokenGranted",d)},t.onDeleteToken=()=>{c(null),s(!1),U(O,"accessToken","onAccessTokenRemoved")};let J=ki(null),ee=ki(null),Ce=d=>{T(d),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent({eventName:"modal_open",payload:{initialScreen:d}})},De=d=>{L.embeddedWallets.createOnLogin!=="off"&&me(!0),Ce(d)};Nr(()=>{let d=()=>{document.visibilityState==="hidden"&&t.createAnalyticsEvent({eventName:"page_hidden",options:{keepAlive:!0}})};return document.addEventListener("visibilitychange",d),()=>{document.removeEventListener("visibilitychange",d)}},[]),Nr(()=>{if(!l){t.connectors?.removeEmbeddedWalletConnector();return}let d=Ae(l),p=Gc(l);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(!W){console.debug("Failed to add embedded wallet connector: Wallet proxy not initialized");return}d&&t.connectors.addEmbeddedWalletConnector(W,d.address,L.defaultChain,e.appId),p&&t.connectors.addImportedWalletConnector(W,p.address,L.defaultChain,e.appId)},[W,l]),Nr(()=>{W&&Mt?.(W)},[W]),Nr(()=>{(async()=>{if(!L.customAuth?.enabled)return;me(!0);let{getCustomAccessToken:p,isLoading:m}=L.customAuth;if(!(!n||m))try{let C=await p();if(!C&&a){await Sn.logout();return}if(!C||a)return;t.startAuthFlow(new An(C));let{user:P,isNewUser:B}=await t.authenticate();if(!P){await Sn.logout();return}c(P||null),v(B||!1),s(!0),lr(!0)}catch(C){console.warn(C),a&&await Sn.logout()}})()},[L.customAuth?.enabled,L.customAuth?.getCustomAccessToken,L.customAuth?.isLoading,n,a]),Nr(()=>{je&&W&&l&&Dt(l,L.embeddedWallets.createOnLogin)&&(lr(!1),qa(l,kn).catch(console.error))},[je&&W&&l]),Nr(()=>{async function d(){let p=_c(),m=En();WE();let C=kE();H(C),t.initializeConnectorManager({walletConnectCloudProjectId:L.walletConnectCloudProjectId,rpcConfig:L.rpcConfig,chains:L.chains,defaultChain:L.defaultChain,store:C,walletList:L.appearance.walletList,shouldEnforceDefaultChainOnConnect:L.shouldEnforceDefaultChainOnConnect,externalWalletConfig:L.externalWallets,appName:L.name??"Privy"});let P;t.connectors?.on("connectorInitialized",()=>{P&&clearTimeout(P);let oe=t.connectors.walletConnectors.length,Le=t.connectors.walletConnectors.reduce((he,pt)=>he+(pt.initialized?1:0),0);Le===oe?_e(!0):P=setTimeout(()=>{console.debug({message:"Unable to initialize all expected connectors before timeout",initialized:Le,expected:oe}),_e(!0)},1500)}),t.connectors?.initialize().then(()=>{Ri()});let B=await t.getAuthenticatedUser(),V=!!B;if(L.customAuth?.enabled||(s(!!B),B&&U(O,"login","onComplete",B,!1,!0,null,null),c(B)),p){ee.current=V?"link":"login";return}if(m&&!V){ee.current="login",De("TELEGRAM_AUTH_SCREEN");return}ce.setReadyToTrue(!!B)}!n&&se&&d()},[t,Pt,n,se]),Nr(()=>{if(!n)return;if(!l){Ie(!0);return}if(!!!l.linkedAccounts.find(m=>m.type==="wallet"&&m.walletClientType==="privy")){Ie(!0);return}let p=!!u.find(m=>m.walletClientType==="privy");Ie(p)},[n,l,u]);let _c=()=>{let d=Hi();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:"There was an issue completing the OAuth flow"});return}window.opener.postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:d.stateCode,authorizationCode:d.authorizationCode});return}return!d.inProgress||d.headless?!1:(t.startAuthFlow(new Dr(d)),De("AWAITING_OAUTH_SCREEN"),!0)},En=()=>{let d=am();if(!d||!L.loginMethods.telegram||!L.loginConfig.telegramAuthConfiguration?.seamlessAuthEnabled)return;let p=new Mn;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},za=async(d,p,m,C)=>{let P=await t.connectors?.createWalletConnector(d,p)||null;Tn(P,p,m,C)};async function Tn(d,p,m,C){if(d)k({status:"disconnected",connectedWallet:null,connectError:null,connector:d,connectRetry:E});else return k({status:"disconnected",connectedWallet:null,connectError:new ne("Unable to connect to wallet."),connector:null,connectRetry:E}),C?.(null,m);d instanceof Hr&&p&&await d.resetConnection(p),k({connector:d,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>Tn(d,p,m,C)});try{let P=await d.connect({showPrompt:!0});if(L.shouldEnforceDefaultChainOnConnect&&!L.chains.find(B=>B.id===Number(P?.chainId))&&!(P?.connectorType==="wallet_connect_v2"&&P?.walletClientType==="metamask")&&!(P?.connectorType==="coinbase_wallet"&&L.externalWallets.coinbaseWallet.connectionOptions!=="eoaOnly")){k(B=>({...B,connector:d,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:E}));try{await P?.switchChain(L.defaultChain.id),P&&(P.chainId=xn(Vo(L.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${L.defaultChain.id}`)}}return k(B=>({...B,status:"connected",connectedWallet:P,connectError:null,connectRetry:E})),P&&U(O,"connectWallet","onSuccess",P),C?.(P,m)}catch(P){return P instanceof Ke?(console.warn(P.cause?P.cause:P.message),U(O,"connectWallet","onError",P.privyErrorCode||"generic_connect_wallet_error")):(console.warn(P),U(O,"connectWallet","onError","unknown_connect_wallet_error")),k(B=>({...B,status:"disconnected",connectedWallet:null,connectError:P})),C?.(null,m)}}let Pn=async(d,p)=>{if(d===null)return;let m=new Qo(d,p);t.startAuthFlow(m)},Ri=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_connector"),m=d.get("privy_wallet_client");if(!p||!m)return;if(m==="phantom"&&!go()&&De("LOGIN_FAILED_SCREEN"),!t.connectors)throw new w("Connector not initialized");Ce("AWAITING_CONNECTION");let C=new URL(window.location.href);C.searchParams.delete("privy_connector"),C.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",C),za(p,m,void 0,Pn)};Nr(()=>{n&&a&&l===null&&t.getAuthenticatedUser().then(c)},[n,a,l,t]);let Ue=()=>{if(!a)throw U(O,"linkAccount","onError","must_be_authenticated"),new w("User must be authenticated before linking an account.")},Ye=()=>{Ue(),J.current="siwe",ee.current="link",Ce("LINK_WALLET_SCREEN")},Ze=d=>{if(!a||!l)return!1;if(d.walletClientType==="privy")return!0;for(let p of l.linkedAccounts)if(p.type==="wallet"&&p.address===d.address&&p.walletClientType!=="privy")return!0;return!1},_n=async d=>{if(!t.connectors)throw new w("Connector not initialized");let p=t.connectors.findWalletConnector(d.connectorType,d.walletClientType)||null;if(k(m=>({...m,connector:p,status:"connected",connectedWallet:d,connectError:null,connectRetry:E})),L.captchaEnabled&&!a){let m={callback:C=>Pn(d,C),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};X({captchaModalData:m}),De("CAPTCHA_SCREEN")}else await Pn(d),De("AWAITING_CONNECTION")},Ho=async(d,p)=>{if(!L.fiatOnRamp.enabled)throw new w("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:m,externalTransactionId:C}=await gy(t,d,p?.config??{},L.appearance.palette,L.fiatOnRamp.useSandbox);return{signedUrl:m,externalTransactionId:C}}else throw new w("Unsupported fund provider. Currently supported option is `moonpay`.")},Go=()=>{f(d=>{let p=t.connectors?.wallets.map(m=>({...m,linked:Ze(m),loginOrLink:async()=>{if(!await m.isConnected())throw new w("Wallet is not connected");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new w("Cannot link or login with embedded wallet");_n(m)},fund:async C=>{let{signedUrl:P,externalTransactionId:B}=await Ho(m.address,C);X({fiatOnRampPrompt:{signedUrl:P},fiatOnRampStatus:{externalTransactionId:B}}),Ce("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!a)throw new w("User is not authenticated.");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new w("Cannot unlink an embedded wallet");let C=await t.unlinkWallet(m.address);c(C)}}))||[];return As(d,p)?d:p})};Nr(()=>{Go()},[l?.linkedAccounts,a,n]),Nr(()=>{if(n){if(!t.connectors)throw new w("Connector not initialized");Go(),t.connectors.on("walletsUpdated",Go)}},[n]);let to=()=>{Ce(a?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};Nr(()=>{if(!u[0])return;let d=u[0],p=h.current.find(C=>C.address===d.address),m;if(d.walletClientType==="privy"?m=l?.linkedAccounts.find(C=>C.type==="wallet"&&C.address===d.address&&C.walletClientType==="privy"):m=l?.linkedAccounts.find(C=>C.type==="wallet"&&C.address===d.address&&C.walletClientType!=="privy"),!p&&m){let C=Object.assign({},l);C.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType,imported:m.imported},c(C)}h.current=u},[u]);let qa=async(d,p)=>{if(Ae(d))throw U(O,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[C,P]=await Promise.all([ce.initializeWalletProxy(p),Ee()]);if(!C&&L.customAuth?.enabled)throw U(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!C||!P||L.embeddedWallets?.requireUserOwnedRecoveryOnCreate)return new Promise((B,V)=>{me(!0),X({createWallet:{onSuccess:Le=>{U(O,"createWallet","onSuccess",Le),B(Le)},onFailure:Le=>{U(O,"createWallet","onError","unknown_embedded_wallet_error"),V(Le)},callAuthOnSuccessOnClose:!1}}),Ce("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await C.create({accessToken:P});let B=await ce.refreshUser(),V=Ae(B);if(!V)throw U(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return U(O,"createWallet","onSuccess",V),V}},D2=d=>{if(!L.chains.map(p=>p.id).includes(d))throw new ne(`Chain ID ${d} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},Op=(d,p,m)=>new Promise(async(C,P)=>{if(!a||!l){U(O,"sendTransaction","onError","must_be_authenticated"),P(new Error("User must be authenticated before signing with a Privy wallet"));return}let B=d.from,V=B?l?.linkedAccounts.find(Se=>Se.type==="wallet"&&Se.walletClientType==="privy"&&Se.address===B):Ae(l);if(!V){U(O,"sendTransaction","onError","embedded_wallet_not_found"),P(new Error("Must have a Privy wallet before signing"));return}me(!0);let oe=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,Le=d.chainId?Number(d.chainId):oe.chainId;D2(Le);let he=Object.assign({},d,{chainId:Le}),pt=async()=>{let Se=await Ee();if(!Se||!W){U(O,"sendTransaction","onError","embedded_wallet_not_found"),P(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await ce.recoverEmbeddedWallet()){U(O,"sendTransaction","onError","unknown_connect_wallet_error"),P(new Error("Unable to connect to wallet"));return}let Cr=oo(he.chainId,L.chains,L.rpcConfig,{appId:e.appId}),Sc=await Ei(V.address,he,Cr);if(L.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:B2}=await bi(Sc,Cr),{hasSufficientFunds:H2}=await lc(V.address,Sc,B2,Cr);if(!H2)throw new ze(new Yt("Wallet has insufficient funds for this transaction.",mt.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let Up=await sc(Se,V.address,W,Sc,Cr);U(O,"sendTransaction","onSuccess",Up),C(Up)}catch($a){U(O,"sendTransaction","onError","transaction_failure"),P($a)}};if(L.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),pt();else{let Se={transactionRequest:he,onSuccess:Cr=>{U(O,"sendTransaction","onSuccess",Cr),C(Cr)},onFailure:Cr=>{U(O,"sendTransaction","onError","transaction_failure"),P(Cr)},uiOptions:p||{},fundWalletConfig:m},$a={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:Cr=>{U(O,"sendTransaction","onError","unknown_connect_wallet_error"),P(Cr)}};X({connectWallet:$a,sendTransaction:Se}),Ce("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function Np(){return new Promise(async(d,p)=>{let m=await Ee();if(!m||!W)throw new Error("Must have valid access token to enroll in MFA");try{await W.verifyMfa({accessToken:m}),d()}catch(C){p(C)}})}let Lt=d=>{if(d==="passkey"){if(l&&l.linkedAccounts.filter(p=>p.type==="passkey").length>=5)throw U(O,"linkAccount","onError","cannot_link_more_of_type"),new w(`User already has an account of type ${d} linked.`)}else if(l?.[d])throw U(O,"linkAccount","onError","cannot_link_more_of_type"),new w(`User already has an account of type ${d} linked.`)},U2=()=>{if(!L.loginConfig.telegramAuthConfiguration?.linkEnabled)throw U(O,"linkAccount","onError","cannot_link_more_of_type"),new w("User can't link an account because Telegram linking is disabled.")};async function Dp({legacySetWalletPasswordFlow:d=!1}){T(null);let p=d?"setWalletPassword":"setWalletRecovery";if(!a||!l)throw U(O,p,"onError","must_be_authenticated"),new Error("User must be authenticated before adding recovery method to Privy wallet");let m=Ae(l);if(!m||!W)throw U(O,p,"onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a recovery method");try{await Np()}catch(C){throw U(O,p,"onError","missing_or_invalid_mfa"),C}return new Promise((C,P)=>{me(!0);let B={onSuccess:he=>{U(O,p,"onSuccess","user-passcode",he),C(he)},onFailure:he=>{U(O,p,"onError","user_exited_set_password_flow"),P(he)},callAuthOnSuccessOnClose:!1},V=m.recoveryMethod==="user-passcode",Le={onCompleteNavigateTo:Cl({walletAction:"update",availableRecoveryMethods:L.embeddedWallets.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:d,isResettingPassword:V}),shouldForceMFA:!1,onFailure:he=>{U(O,p,"onError","unknown_connect_wallet_error"),P(he)}};X({setWalletPassword:B,createWallet:B,connectWallet:Le,recoverySelection:{isInAccountCreateFlow:!1,isResettingPassword:V}}),Ce("EMBEDDED_WALLET_CONNECTING_SCREEN")})}let Sn={ready:n,authenticated:a,user:l,walletConnectors:t.connectors||null,connectWallet:to,importWallet:async({privateKey:d})=>{Ue();let[p,m]=await Promise.all([ce.initializeWalletProxy(15e3),Ee()]);if(p&&m){await p.import({privateKey:d,accessToken:m});let C=await ce.refreshUser(),P=Gc(C);if(!P)throw U(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to import wallet");return U(O,"createWallet","onSuccess",P),P}else throw new w("User is not authenticated")},linkWallet:Ye,linkCrossAppAccount:({appId:d})=>{Ue(),J.current=`privy:${d}`,ee.current="link";let p=window.open(void 0,void 0,Mp({w:440,h:680}));Ec({api:t.api,providerAppId:d,requesterAppId:L.id}).then(({name:m,logoUrl:C})=>{X({crossAppAuth:{appId:d,name:m,logoUrl:C,popup:p}}),De("CROSS_APP_AUTH_SCREEN")})},linkEmail:()=>{Ue(),Lt("email"),J.current="email",ee.current="link",Ce("LINK_EMAIL_SCREEN")},linkPhone:()=>{Ue(),Lt("phone"),J.current="sms",ee.current="link",Ce("LINK_PHONE_SCREEN")},linkGoogle:async()=>{Ue(),Lt("google"),ee.current="link",await ce.initLoginWithOAuth("google")},linkTwitter:async()=>{Ue(),Lt("twitter"),ee.current="link",await ce.initLoginWithOAuth("twitter")},linkDiscord:async()=>{Ue(),Lt("discord"),ee.current="link",await ce.initLoginWithOAuth("discord")},linkGithub:async()=>{Ue(),Lt("github"),ee.current="link",await ce.initLoginWithOAuth("github")},linkSpotify:async()=>{Ue(),Lt("spotify"),ee.current="link",await ce.initLoginWithOAuth("spotify")},linkInstagram:async()=>{Ue(),Lt("instagram"),ee.current="link",await ce.initLoginWithOAuth("instagram")},linkTiktok:async()=>{Ue(),Lt("tiktok"),ee.current="link",await ce.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{Ue(),Lt("linkedin"),ee.current="link",await ce.initLoginWithOAuth("linkedin")},linkApple:async()=>{Ue(),Lt("apple"),ee.current="link",await ce.initLoginWithOAuth("apple")},linkPasskey:async()=>{Ue(),Lt("passkey"),await ce.initLinkWithPasskey(),Ce("LINK_PASSKEY_SCREEN")},linkTelegram:async()=>{Ue(),Lt("telegram"),U2(),ee.current="link",J.current="telegram",await ce.initLoginWithTelegram(),Ce("TELEGRAM_AUTH_SCREEN")},linkFarcaster:async()=>{Ue(),Lt("farcaster"),await ce.initLoginWithFarcaster(),ee.current="link",J.current="farcaster",Ce("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(Ue(),!l?.email)throw new w("User does not have an email linked to their account.");ee.current="link",J.current="email",Ce("UPDATE_EMAIL_SCREEN")},login:async()=>{let d="Attempted to log in, but user is already logged in. Use a `link` helper instead.";if(!n){let p=await new Promise(m=>{rt(C=>m.bind(C))});if(rt(null),p){console.warn(d);return}}if(a){console.warn(d);return}ee.current="login",De("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(d=>{rt(()=>d)}),rt(null)),a){console.warn("User must be unauthenticated to `connectOrCreateWallet`");return}if(u[0]){console.warn("User must have no connected wallets to `connectOrCreateWallet`");return}De("CONNECT_OR_CREATE")},logout:async()=>{if(await t.logout(),l&&W)try{await W.clearMfa({userId:l.id})}catch{}c(null),s(!1),T(null),U(O,"logout","onSuccess"),ee.current=null,J.current=null,o(!1),Y.del(Di)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!l||!l.wallet)return new He;let d=u.find(m=>l.wallet&&m.address===l.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(C=>C.address===d?.address));return!d||!p?new He:p.proxyProvider},getEthersProvider:()=>{if(!l||!l.wallet)return new Lp(new Ur(new He));let d=u.find(m=>l.wallet&&m.address===l.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(C=>C.address===d?.address));return!d||!p?new Lp(new Ur(new He)):new Lp(new Ur(p.proxyProvider))},getWeb3jsProvider:()=>{if(!l||!l.wallet)return new wo(new He);let d=u.find(m=>l.wallet&&m.address===l.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(C=>C.address===d?.address));return!d||!p?new wo(new He):new wo(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},setActiveWallet:async d=>{let p=u.find(C=>xi(C.address)===xi(d)),m=l?.linkedAccounts.find(C=>C.type==="wallet"&&xi(C.address)===xi(d));if(!p||!await p.isConnected())Z(d),Ye();else if(!p.linked)p.loginOrLink();else{let C=Object.assign({},l);C.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType,imported:m.imported},c(C)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!a||!l)throw U(O,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return qa(l,15e3)},setWalletRecovery:async()=>Dp({legacySetWalletPasswordFlow:!1}),setWalletPassword:async()=>Dp({legacySetWalletPasswordFlow:!0}),signMessage:(d,p,m)=>new Promise(async(C,P)=>{if(!a||!l){U(O,"signMessage","onError","must_be_authenticated"),P(new Error("User must be authenticated before signing with a Privy wallet"));return}let B=m?l?.linkedAccounts.find(oe=>oe.type==="wallet"&&oe.walletClientType==="privy"&&xi(oe.address)===xi(m)):Ae(l);if(!B){U(O,"signMessage","onError","embedded_wallet_not_found"),P(new Error("Must have a Privy wallet before signing"));return}if(typeof d!="string"||d.length<1){U(O,"signMessage","onError","invalid_message"),P(new Error("Message must be a non-empty string"));return}me(!0);let V=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let oe=await Ee();if(!W||!oe)throw new Error("Unable to connect to wallet");if(!await ce.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_started",payload:{walletAddress:B.address}});let{response:he}=await W.rpc({accessToken:oe,address:B.address,request:{method:"personal_sign",params:[d,B.address]}}),pt=he.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_completed",payload:{walletAddress:B.address}}),pt};if(L.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let oe=await V();U(O,"signMessage","onSuccess",oe),C(oe)}catch(oe){U(O,"signMessage","onError","unable_to_sign"),P(oe??new ze("Unable to sign message"))}}else{let he={method:"personal_sign",data:d,confirmAndSign:V,onSuccess:Se=>{U(O,"signMessage","onSuccess",Se),C(Se)},onFailure:Se=>{U(O,"signMessage","onError","unable_to_sign"),P(Se)},uiOptions:p||{}},pt={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Se=>{U(O,"signMessage","onError","unknown_connect_wallet_error"),P(Se)},address:B.address};X({signMessage:he,connectWallet:pt}),Ce("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(d,p)=>new Promise(async(m,C)=>{if(!a||!l){U(O,"signTypedData","onError","must_be_authenticated"),C(new Error("User must be authenticated before signing with a Privy wallet"));return}let P=Ae(l);if(!P){U(O,"signTypedData","onError","embedded_wallet_not_found"),C(new Error("Must have a Privy wallet before signing"));return}me(!0);let B=Wi(d),V=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let oe=await Ee();if(!W||!oe)throw new Error("Unable to connect to wallet");if(!await ce.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_started",payload:{walletAddress:P.address}});let{response:he}=await W.rpc({accessToken:oe,address:P.address,request:{method:"eth_signTypedData_v4",params:[P.address,B]}}),pt=he.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_completed",payload:{walletAddress:P.address}}),pt};if(L.embeddedWallets.noPromptOnSignature||(L.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let oe=await V();U(O,"signTypedData","onSuccess",oe),m(oe)}catch(oe){U(O,"signTypedData","onError","unable_to_sign"),C(oe??new ze("Unable to sign message"))}}else{let he={method:"eth_signTypedData_v4",data:B,confirmAndSign:V,onSuccess:Se=>{U(O,"signTypedData","onSuccess",Se),m(Se)},onFailure:Se=>{U(O,"signTypedData","onError","unable_to_sign"),C(Se)},uiOptions:p||{}},pt={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Se=>{U(O,"signMessage","onError","unknown_connect_wallet_error"),C(Se)}};X({signMessage:he,connectWallet:pt}),Ce("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(d,p,m)=>{let P=await(await Op(d,p,m)).wait();return cc(P)},exportWallet:()=>new Promise(async(d,p)=>{if(!a||!l){p(new Error("User must be authenticated before exporting their Privy wallet"));return}if(!Ae(l)){p(new Error("Must have a Privy wallet before exporting"));return}me(!0);let C={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p,shouldForceMFA:!0};if(X(be),!await Ee()||!W){p(new Error("Must have valid access token to enroll in MFA"));return}if(!W){p(new Error("Must have a Privy wallet before exporting"));return}let B={appId:e.appId,appClientId:e.clientId,origin:t.apiUrl,onSuccess:d,onFailure:p};X({keyExport:B,connectWallet:C}),Ce("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:Np,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");Wt.current?.resolve({mfaMethod:d,mfaCode:p,relyingParty:window.origin}),await new Promise((B,V)=>{$e.current={resolve:B,reject:V}});break;case"passkey":if(typeof p=="string")throw new w("Invalid authenticator response");let C=await(await import("@simplewebauthn/browser")).startAuthentication(p),P=x2(C);Wt.current?.resolve({mfaMethod:d,mfaCode:P,relyingParty:window.origin}),await new Promise((B,V)=>{$e.current={resolve:B,reject:V}});break;default:throw Wt.current?.reject(new w("Unsupported MFA method")),new w(`Unsupported MFA method: ${d}`)}},cancel(){Wt.current?.reject(new w("MFA canceled"))},async initEnrollmentWithSms(d){let p=await Ee();if(!p||!W)throw new Error("Must have valid access token to enroll in MFA");await W.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber})},enrollInMfa(d){return new Promise((p,m)=>{if(!d){ce.closePrivyModal(),p();return}L.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."),X({mfaEnrollmentFlow:{mfaMethods:L.mfa.methods,onSuccess:p,onFailure:m}}),Ce("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let d=await Ee();if(!d||!W)throw new Error("Must have valid access token to enroll in MFA");let p=await W.initEnrollMfa({method:"totp",accessToken:d});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(d){let p=await Ee();if(!p||!W)throw new Error("Must have valid access token to enroll in MFA");await W.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber,code:d.mfaCode});let m=await t.getAuthenticatedUser();c(m)},async submitEnrollmentWithTotp(d){let p=await Ee();if(!p||!W)throw new Error("Must have valid access token to enroll in MFA");await W.submitEnrollMfa({method:"totp",accessToken:p,code:d.mfaCode});let m=await t.getAuthenticatedUser();c(m)},async initEnrollmentWithPasskey(){},async submitEnrollmentWithPasskey({credentialIds:d}){let p=await Ee();if(!p||!W)throw new Error("Must have valid access token to enroll in MFA");await W.submitEnrollMfa({method:"passkey",accessToken:p,credentialIds:d});let m=await t.getAuthenticatedUser();c(m)},async unenroll(d){let p=await Ee();if(!p||!W)throw new Error("Must have valid access token to remove MFA");d==="passkey"?await W.submitEnrollMfa({method:"passkey",accessToken:p,credentialIds:[]}):await W.unenrollMfa({method:d,accessToken:p});let m=await t.getAuthenticatedUser();c(m)},requestFarcasterSignerFromWarpcast:async()=>{let d=await Ee(),p=l?.linkedAccounts.find(P=>P.type==="wallet"&&P.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!W||!p)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!l?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await ce.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");let C=await W.initFarcasterSigner({address:p.address,hdWalletIndex:null,accessToken:d,mfaCode:null,mfaMethod:null,relyingParty:window.origin});if(C.status==="approved"){let P=await t.getAuthenticatedUser();c(P||l||null)}X({farcasterSigner:C}),Ce("AWAITING_FARCASTER_SIGNER")},getFarcasterSignerPublicKey:async()=>{let d=await Ee(),p=l?.linkedAccounts.find(P=>P.type==="wallet"&&P.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!W||!p)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!l?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await ce.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");if(!l.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster signer public key to sign");return(P=>Uint8Array.from(P.match(/.{1,2}/g).map(B=>parseInt(B,16))))(l.farcaster.signerPublicKey.slice(2))},signFarcasterMessage:async d=>{let p=await Ee(),m=l?.linkedAccounts.find(V=>V.type==="wallet"&&V.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!W||!m)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!l?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await ce.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");if(!l.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster signer public key to sign");let P=await import("@simplewebauthn/browser"),B=await W.signFarcasterMessage({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{hash:P.bufferToBase64URLString(d)},fid:BigInt(l.farcaster.fid),relyingParty:window.origin});return new Uint8Array(P.base64URLStringToBuffer(B.signature))},isHeadlessOAuthLoading:_,loginWithCode(d){return ce.loginWithCode(d)},initLoginWithEmail(d){return ce.initLoginWithEmail(d)},initLoginWithSms(d){return ce.initLoginWithSms(d)},otpState:N,fundWallet(d,p){return ce.fundWallet(d,p)},initLoginWithHeadlessOAuth(d,p){return ce.initLoginWithHeadlessOAuth(d,p)},loginWithHeadlessOAuth(d){return ce.loginWithHeadlessOAuth(d)},signMessageWithCrossAppWallet(d,{address:p}){return Tc({user:l,client:t,address:p,requesterAppId:L.id,request:{method:"personal_sign",params:[d,p]}})},signTypedDataWithCrossAppWallet(d,{address:p}){let m=Wi(d);return Tc({user:l,client:t,address:p,requesterAppId:L.id,request:{method:"eth_signTypedData_v4",params:[p,m]}})},sendTransactionWithCrossAppWallet(d,{address:p}){return Tc({user:l,client:t,address:p,requesterAppId:L.id,request:{method:"eth_sendTransaction",params:[d]}})},isModalOpen:r,mfaMethods:L.mfa.methods};R2=Sn.signMessage,I2=Sn.signTypedData,M2=async(...d)=>{let p=await Op(...d);return L.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let ce=(()=>({isNewUserThisSession:g,linkingHint:G,pendingTransaction:null,walletConnectionStatus:A,mipdStore:I,connectors:t.connectors?.walletConnectors??[],rpcConfig:L.rpcConfig,chains:L.chains,appId:e.appId,showFiatPrices:L.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:d=>L.chains.find(p=>p.id===Number(d))?.nativeCurrency.symbol,initializeWalletProxy:async d=>{if(W)return W;let p=new Promise(P=>{nt(()=>B=>P(B))}),m=new Promise(P=>setTimeout(()=>P(null),d)),C=await Promise.race([p,m]);return nt(null),C},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(d={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let p=n&&a&&l,m;p&&J.current&&(m=l?.linkedAccounts.filter(C=>C.latestVerifiedAt!==null&&!(C.type==="wallet"&&C.walletClientType==="privy")).sort((C,P)=>P.latestVerifiedAt.getTime()-C.latestVerifiedAt.getTime())[0]),ee.current==="login"&&J.current?d.shouldCallAuthOnSuccess&&p?(U(O,"login","onComplete",l,g,!1,J.current,m??null),e.onSuccess?.(l,g)):U(O,"login","onError","exited_auth_flow"):ee.current==="link"&&J.current&&m&&(d.isSuccess&&p?U(O,"linkAccount","onSuccess",l,J.current,m):U(O,"linkAccount","onError","exited_link_flow")),Z(null),ee.current=null,J.current=null,v(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent({eventName:"modal_closed"})},openPrivyModal:Ce,connectWallet:Tn,initLoginWithWallet:async(d,p)=>{J.current="siwe",Pn(d,p)},loginWithWallet:async()=>{if(!n)throw new ro;if(!(t.authFlow instanceof Qo))throw new w("Must initialize SIWE flow first.");let d,p;if(a)try{({user:d}=await t.link()),J.current="siwe"}catch(m){throw U(O,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:d,isNewUser:p}=await t.authenticate()),J.current="siwe"}catch(m){throw U(O,"login","onError",m.privyErrorCode||"generic_connect_wallet_error"),m}c(d||l||null),v(p||!1),s(!0)},initLoginWithFarcaster:async d=>{let p=new Li(d);t.startAuthFlow(p);try{J.current="farcaster",await p.initializeFarcasterConnect()}catch(m){throw ee.current==="login"?U(O,"login","onError",m.privyErrorCode||"unknown_auth_error"):ee.current==="link"&&U(O,"linkAccount","onError",m.privyErrorCode||"unknown_auth_error"),m}},loginWithFarcaster:async()=>{if(!n)throw new ro;if(!(t.authFlow instanceof Li))throw new w("Must initialize Farcaster flow first.");let d,p;if(a)try{({user:d}=await t.link()),J.current="farcaster"}catch(m){throw U(O,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:d,isNewUser:p}=await t.authenticate()),J.current="farcaster"}catch(m){throw U(O,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}c(d||null),v(p||!1),s(!0)},async crossAppAuthFlow({appId:d,popup:p}){let m=`privy:${d}`;J.current=m;let{url:C,stateCode:P,codeVerifier:B}=await _2({api:t.api,appId:d});if(!C)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 V=await A2({url:C,popup:p,provider:m}),oe=V.stateCode,Le=V.authorizationCode;if(oe!==P)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:m,storedStateCode:P??"",returnedStateCode:oe??""}}),new w("Unexpected auth flow. This may be a phishing attempt.");let he=await S2({api:eo.api,appId:d,codeVerifier:B,stateCode:oe,authorizationCode:Le});t.storeProviderAccessToken(d,he),await ce.refreshUser()}catch(V){throw t.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:V.toString(),provider:m}}),V}},async initLoginWithOAuth(d,p){if(J.current=d,Rc()){if(d==="google"&&Pc(window.navigator.userAgent)){De("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{De("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}Y.del(Ko);let m=new Dr({provider:d});p&&m.addCaptchaToken(p),t.startAuthFlow(m);let C=await t.authFlow.getAuthorizationUrl();C&&C.url&&(d==="twitter"&&IE&&(C.url=C.url.replace("x.com","twitter.com")),window.location.assign(C.url))},async initLoginWithTelegram(d){if(!n)throw new ro;J.current="telegram";let p=new Mn(d);t.startAuthFlow(p),p.meta.telegramWebAppData=void 0,p.meta.telegramAuthResult=await new Promise((m,C)=>{if(!L.loginConfig.telegramAuthConfiguration)return C(new w("Telegram Auth configuration is not loaded"));if(!window.Telegram)return C(new w("Telegram was not initialized"));window.Telegram.Login.auth({bot_id:L.loginConfig.telegramAuthConfiguration.botId,request_access:!0},P=>P?m(P):C(new w("Telegram auth failed or was canceled by the client")))})},async loginWithTelegram(){if(!(t.authFlow instanceof Mn))throw new w("Must initialize Telegram flow before calling loginWithTelegram");let d,p;if(a)try{({user:d}=await t.link()),J.current="telegram"}catch(m){throw U(O,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{let m=await t.authenticate();d=m.user,p=m.isNewUser,J.current="telegram"}catch(m){throw ee.current==="login"?U(O,"login","onError",m.privyErrorCode||"unknown_auth_error"):ee.current==="link"&&U(O,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}c(d),v(p||!1),s(!0)},async recoveryOAuthFlow(d,p,m){let C,P;function B(V){if(!V)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:V,codeVerifier:oe,stateCode:Le}=await Td({api:eo.api,provider:d});B(V);let he,pt;try{let Se=await Wp({url:V,popup:m,provider:d});if(he=Se.stateCode,pt=Se.authorizationCode,he!==Le)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d,storedStateCode:Le??"",returnedStateCode:he??""}}),new w("Unexpected auth flow. This may be a phishing attempt.")}catch(Se){throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:Se.toString(),provider:d}}),new w("Recovery OAuth failed")}[C,P]=await Promise.all([Ee(),lh({api:eo.api,provider:d,codeVerifier:oe,stateCode:he,authorizationCode:pt})]);break}case"icloud":{let{url:V}=await Td({api:eo.api,provider:d});B(V);let{ckWebAuthToken:oe}=await Wp({url:V,popup:m,provider:d});P=oe,C=await Ee();break}}if(!W)throw new w("Cannot connect to wallet proxy");if(!C)throw new w("Unable to authorize user");switch(p){case"recover":let V=be.recoverWallet?.privyWallet?.address;if(!V)throw new w("Recovery OAuth failed");t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:V,recoveryMethod:d}}),await W.recover({address:V,accessToken:C,recoveryAccessToken:P,recoveryMethod:d}),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:V,recoveryMethod:d}});break;case"create-wallet":t.createAnalyticsEvent({eventName:"embedded_wallet_creation_started"}),await W.create({accessToken:C,recoveryAccessToken:P,recoveryMethod:d});let oe=await ce.refreshUser(),Le=Ae(oe);if(!Le)throw U(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:Le.address}}),U(O,"createWallet","onSuccess",Le);break;case"set-recovery":let he=Ae(l);if(!he)throw U(O,"setWalletRecovery","onError","embedded_wallet_not_found"),new Error("Embedded wallet not found");t.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_started",payload:{recoveryMethod:d}}),await W.setRecovery({address:he.address,accessToken:C,recoveryAccessToken:P,recoveryMethod:d});let pt=Ae(await ce.refreshUser());if(!pt)throw U(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to set recovery on wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:he.address,recoveryMethod:d}}),U(O,"setWalletRecovery","onSuccess",d,pt);break;default:throw new w("Unsupported recovery action")}},async loginWithOAuth(d){if(!(t.authFlow instanceof Dr))throw new w("Must initialize OAuth flow before calling loginWithOAuth");let p=Y.get(qo),m=t.authFlow.meta.stateCode;if(p!==m)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d,storedStateCode:p??"",returnedStateCode:m??""}}),new w("Unexpected auth flow. This may be a phishing attempt.");let C,P,B;if(a)try{let V=await t.link();C=V.user,B=V.oAuthProviderTokens,J.current=d}catch(V){throw U(O,"linkAccount","onError",V.privyErrorCode||"failed_to_link_account"),V}else try{let V=await t.authenticate();C=V.user,P=V.isNewUser,B=V.oAuthProviderTokens,J.current=d}catch(V){throw ee.current==="login"?U(O,"login","onError",V.privyErrorCode||"unknown_auth_error"):ee.current==="link"&&U(O,"linkAccount","onError",V.privyErrorCode||"failed_to_link_account"),V}return c(C),v(P||!1),s(!0),B},async initLoginWithPasskey(d){let p=new Jo(d);t.startAuthFlow(p),ee.current="login";try{J.current="passkey",await p.initAuthenticationFlow()}catch(m){throw U(O,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}},async loginWithPasskey(){if(!n)throw new ro;if(!(t.authFlow instanceof Jo))throw new w("Must initialize Passkey flow first.");if(J.current!=="passkey")throw new w("Must init login with Passkey flow first.");let d,p;try{J.current="passkey",{user:d,isNewUser:p}=await t.authenticate()}catch(m){throw U(O,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}c(d),v(p||!1),s(!0)},async initLinkWithPasskey(d){let p=new Jo(d);t.startAuthFlow(p),ee.current="link",J.current="passkey";try{await p.initLinkFlow()}catch(m){throw U(O,"linkAccount","onError",m.privyErrorCode||"unknown_auth_error"),m}},async linkWithPasskey(){if(!n)throw new ro;if(!(t.authFlow instanceof Jo))throw new w("Must initialize Passkey flow first.");if(J.current!=="passkey")throw new w("Must init login with Passkey flow first.");let d;try{J.current="passkey",{user:d}=await t.link()}catch(p){throw U(O,"linkAccount","onError",p.privyErrorCode||"failed_to_link_account"),p}return c(d||l||null),d},async initLoginWithHeadlessOAuth(d,p){if(Rc()){if(d==="google"&&Pc(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 m=new Dr({provider:d,headless:!0});p&&m.addCaptchaToken(p);let C=await t.startAuthFlow(m).getAuthorizationUrl();C?.url&&window.location.assign(C.url)},async loginWithHeadlessOAuth(d){b(!0),t.startAuthFlow(new Dr(d));let p=Y.get(qo),m=d.stateCode;if(p!==m)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d.provider,storedStateCode:p??"",returnedStateCode:m??""}}),b(!1),new w("Unexpected auth flow. This may be a phishing attempt.");let C,P;if(a)try{({user:C}=await t.link()),J.current=d.provider}catch(B){throw U(O,"linkAccount","onError",B.privyErrorCode||"failed_to_link_account"),B}else try{({user:C,isNewUser:P}=await t.authenticate()),J.current=d.provider}catch(B){throw ee.current==="login"?U(O,"login","onError",B.privyErrorCode||"unknown_auth_error"):ee.current==="link"&&U(O,"linkAccount","onError",B.privyErrorCode||"failed_to_link_account"),B}return c(C),v(P||!1),s(!0),b(!1),C??void 0},initLoginWithEmail:async(d,p)=>{let m=new yo(d,p);t.startAuthFlow(m);try{J.current="email",await m.sendCodeEmail()}catch(C){throw ee.current==="login"?U(O,"login","onError",C.privyErrorCode||"unknown_auth_error"):ee.current==="link"&&U(O,"linkAccount","onError",C.privyErrorCode||"failed_to_link_account"),C}},initUpdateEmail:async(d,p,m)=>{let C=new rs(d,p,m);t.startAuthFlow(C),await C.sendCodeEmail()},initLoginWithSms:async(d,p)=>{R({status:"sending-code"});let m=new Xo(d,p);t.startAuthFlow(m);try{J.current="sms",await m.sendSmsCode(),R({status:"awaiting-code-input"})}catch(C){throw R({status:"error",error:C}),ee.current==="login"?U(O,"login","onError",C.privyErrorCode||"unknown_auth_error"):ee.current==="link"&&U(O,"linkAccount","onError",C.privyErrorCode||"failed_to_link_account"),C}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async d=>{if(R({status:"submitting-code"}),!n){let P=new ro;throw R({status:"error",error:P}),P}if(t.authFlow instanceof yo)t.authFlow.meta.emailCode=d.trim();else if(t.authFlow instanceof Xo)t.authFlow.meta.smsCode=d.trim();else{let P=new w("Must initialize a passwordless code flow first");throw R({status:"error",error:P}),P}let p=await Ee(),m,C;if(p&&t.sessionHasActiveToken())try{({user:m}=await t.link())}catch(P){throw R({status:"error",error:P}),U(O,"linkAccount","onError",P.privyErrorCode||"failed_to_link_account"),P}else try{({user:m,isNewUser:C}=await t.authenticate())}catch(P){throw R({status:"error",error:P}),U(O,"login","onError",P.privyErrorCode||"unknown_auth_error"),P}c(m||l||null),v(C||!1),s(!0),R({status:"done"})},refreshUser:async()=>{let d=await t.getAuthenticatedUser();return c(d),d},walletProxy:W,createAnalyticsEvent:({eventName:d,payload:p,timestamp:m})=>t.createAnalyticsEvent({eventName:d,payload:p,timestamp:m}),acceptTerms:async()=>{let d=await t.acceptTerms();return c(d),d},getUsdTokenPrice:d=>t.getUsdTokenPrice(d),recoverEmbeddedWallet:async()=>new Promise(async(d,p)=>{let m=l?.linkedAccounts.find(P=>P.type==="wallet"&&P.walletClientType==="privy"),C=await Ee();if(!C||!W||!m){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}me(!0);try{await W.connect({accessToken:C,address:m.address}),d(!0)}catch(P){if(ni(P)&&m.recoveryMethod==="privy")t.createAnalyticsEvent({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:m.address}}),(await W.recover({address:m.address,accessToken:C,recoveryMethod:m.recoveryMethod})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:m.address}}),d(!0);else if(ni(P)&&m.recoveryMethod!=="privy"){X({recoverWallet:{privyWallet:m,onFailure:p,onSuccess:()=>d(!0)},recoveryOAuthStatus:{provider:m.recoveryMethod,action:"recover"}});let B=wl(m.recoveryMethod);Ce(B)}else p(P)}}),getFiatOnRampConfig:Ho,setReadyToTrue:d=>{i(!0),Pt?.(d)},updateWallets:()=>Go(),fundWallet:async(d,p)=>{let{signedUrl:m,externalTransactionId:C}=await Ho(d,p);X({fiatOnRampPrompt:{signedUrl:m},fiatOnRampStatus:{externalTransactionId:C}}),Ce("FIAT_ON_RAMP_PROMPT_SCREEN")},requestFarcasterSignerStatus:async d=>{let p=await Ee(),m=l?.linkedAccounts.find(P=>P.type==="wallet"&&P.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!W||!m)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!l?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");let C=await t.requestFarcasterSignerStatus(d);if(C.status==="approved"){let P=await t.getAuthenticatedUser();c(P||l||null)}return C}}))();W2=ce.recoverEmbeddedWallet;let F2=RE(()=>({wallets:u,ready:sr&&Bo}),[u,sr,Bo]);return vr(ye.Provider,{value:Sn,children:vr(ed.Provider,{value:O,children:vr(yp.Provider,{value:F2,children:vr(Qm,{...L,children:k2(Xc.Provider,{value:ce,children:[k2(qm,{data:be,setModalData:X,setInitialScreen:T,initialScreen:y,authenticated:a,open:r,children:[e.children,!L.headless&&L.captchaEnabled&&n&&!a&&vr(Qc,{delayedExecution:!1}),vr(d2,{theme:{...L.appearance.palette||{}}}),!L.render.standalone&&vr(Rp,{open:r})]}),ue&&se?vr(P2,{appId:e.appId,appClientId:e.clientId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:l?.mfaMethods,mfaPromise:Wt,mfaSubmitPromise:$e,onLoad:q,onLoadFailed:()=>null}):null,L.loginMethods.telegram&&L.loginConfig.telegramAuthConfiguration&&vr(Sr,{if:!0,children:vr(b2,{scriptHost:e.apiUrl||Oi,botUsername:L.loginConfig.telegramAuthConfiguration.botName})})]})})})})})};import{useContext as NE}from"react";function DE(e){let{login:t}=NE(ye);return Be("login",e),{login:t}}import{useContext as UE}from"react";function FE(e){let{logout:t}=UE(ye);return Be("logout",e),{logout:t}}import{useCallback as L2,useEffect as BE}from"react";function HE(){let e=ge(),t=Ks(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:i,user:a}=F(),s=L2(async c=>{if(e.enabled&&e.status!=="success")throw new Tr(e.error,null,"captcha_failure");return r(c.provider,e.token)},[r,e]),l=L2(async()=>{let c=Hi();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(u){throw u}finally{Zo()}},[o]);return BE(()=>{let c=Hi();i&&t&&c.inProgress&&c.headless&&!c.popupFlow&&l()},[i,t]),{initOAuth:s,loginWithOAuth:l,loading:n}}import{useCallback as O2}from"react";var GE=()=>{let e=ge(),{initLoginWithEmail:t,loginWithCode:r}=F(),o=O2(async({email:i})=>{if(!i)throw new Error("Email required to send OTP code");return t(i)},[t]),n=O2(async({code:i})=>{if(e.enabled&&e.status==="error")throw new Tr(e.error,null,"captcha_failure");return r(i)},[r,e.status]);return{sendCode:o,loginWithCode:n}};import{useCallback as N2}from"react";var VE=()=>{let e=ge(),{initLoginWithSms:t,loginWithCode:r,otpState:o}=F(),n=N2(async({phoneNumber:a})=>{if(!a)throw new Error("SMS required to send OTP code");return t(a)},[t]),i=N2(async({code:a})=>{if(e.enabled&&e.status!=="success")throw new Tr(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:n,loginWithCode:i,state:o}};import{useContext as zE}from"react";function qE(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:a,linkDiscord:s,linkGithub:l,linkLinkedIn:c,linkTiktok:u,linkSpotify:f,linkInstagram:h,linkTelegram:g,linkFarcaster:v}=zE(ye);return Be("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:a,linkDiscord:s,linkGithub:l,linkLinkedIn:c,linkTiktok:u,linkSpotify:f,linkInstagram:h,linkFarcaster:v,linkTelegram:g}}import{useContext as $E}from"react";function KE(e){let{connectWallet:t}=$E(ye);return Be("connectWallet",e),{connectWallet:t}}import{useContext as jE}from"react";function YE(e){let{createWallet:t}=jE(ye);return Be("createWallet",e),{createWallet:t}}var ZE=()=>{let{fundWallet:e}=F();return{fundWallet:e}};var JE=()=>{let{linkCrossAppAccount:e,signMessageWithCrossAppWallet:t,signTypedDataWithCrossAppWallet:r,sendTransactionWithCrossAppWallet:o}=F();return{linkCrossAppAccount:e,signMessage:t,signTypedData:r,sendTransaction:o}};import{useContext as QE}from"react";function XE(e){let{sendTransaction:t}=QE(ye);return Be("sendTransaction",e),{sendTransaction:t}}import{useContext as e9}from"react";function t9(e){let{setWalletPassword:t}=e9(ye);return Be("setWalletPassword",e),{setWalletPassword:t}}import{useContext as r9}from"react";function o9(e){let{setWalletRecovery:t}=r9(ye);return Be("setWalletRecovery",e),{setWalletRecovery:t}}import{useContext as n9}from"react";function i9(e){let{signMessage:t}=n9(ye);return Be("signMessage",e),{signMessage:t}}import{useContext as a9}from"react";function s9(e){let{signTypedData:t}=a9(ye);return Be("signTypedData",e),{signTypedData:t}}import{useContext as l9}from"react";var c9=()=>{let{isModalOpen:e}=l9(ye);return{isOpen:e}};import{useContext as d9}from"react";function p9(e){let{getAccessToken:t}=d9(ye);return Be("accessToken",e),{getAccessToken:t}}function u9(){let{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}=F();return{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}}function m9(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}function f9(e){return e.find(r=>r.walletClientType==="privy"&&r.connectorType==="embedded"&&!r.imported)??null}export{Ur as AsExternalProvider,Qc as Captcha,Yi as ConnectorManager,Rp as LoginModal,Zi as PrivyClient,LE as PrivyProvider,He as PrivyProxyProvider,Ki as SUPPORTED_CHAINS,Wc as VERSION,Ut as WalletConnector,m9 as addRpcUrlOverrideToChain,bd as errorIndicatesMaxMfaRetries,ln as errorIndicatesMfaTimeout,cn as errorIndicatesMfaVerificationFailed,Ee as getAccessToken,f9 as getEmbeddedConnectedWallet,KE as useConnectWallet,YE as useCreateWallet,JE as useCrossAppAccounts,u9 as useExperimentalFarcasterSigner,ZE as useFundWallet,qE as useLinkAccount,DE as useLogin,GE as useLoginWithEmail,HE as useLoginWithOAuth,VE as useLoginWithSms,FE as useLogout,Pa as useMfa,Wr as useMfaEnrollment,c9 as useModalStatus,F as usePrivy,td as useRegisterMfaListener,XE as useSendTransaction,t9 as useSetWalletPassword,o9 as useSetWalletRecovery,i9 as useSignMessage,s9 as useSignTypedData,p9 as useToken,Oa as useWallets};