@privy-io/react-auth
Version:
React client for the Privy Auth API
10 lines • 439 kB
JavaScript
import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import n,{useContext as r,createContext as i,useRef as s,useState as o,useMemo as l,useEffect as c,Suspense as d,lazy as C,useCallback as h}from"react";import u,{DEFAULT_SUPPORTED_CHAIN_IDS as p,rpc as L,PrivyClientError as w,getWallet as m,updateWallet as f,generateAuthorizationSignature as y}from"@privy-io/js-sdk-core";import{v4 as g}from"uuid";import*as v from"jose";import{base64url as A}from"jose";import{u as M,a as k,g as T,i as _,b as E,c as b,d as S,e as Z,f as F,h as I,P as W,M as P,j as U,k as O,l as N}from"./privy-context-DrMxzgOR.mjs";import R from"eventemitter3";import{E as H,P as x,H as V,u as D,L as j,g as B,a as q,b as z,c as K,s as $,R as G,i as Y,d as Q,e as J,f as X,M as ee,m as te,S as ae,h as ne,j as re,k as ie}from"./useActiveWallet-CvP7iYvj.mjs";import{u as se,t as oe,U as le,g as ce,a as de,b as Ce}from"./useWallets-BzNCTucF.mjs";import{c as he,f as ue,t as pe,s as Le,p as we,W as me,a as fe,g as ye,i as ge,b as ve,d as Ae,e as Me,P as ke,h as Te,j as _e,k as Ee,l as be,m as Se,n as Ze,o as Fe,q as Ie}from"./use-export-wallet-_wu5ex5t.mjs";import{P as We,a as Pe,f as Ue,b as Oe,c as Ne,n as Re,d as He,u as xe,e as Ve,I as De,g as je,h as Be,i as qe}from"./internal-context-Z-fyxadS.mjs";import{createCoinbaseWalletSDK as ze}from"@coinbase/wallet-sdk";import{toViemTransactionSerializable as Ke,STRING_TO_NUMBER_TXN_TYPE as $e}from"@privy-io/ethereum";import{P as Ge,C as Ye,a as Qe,H as Je,O as Xe,S as et,u as tt,b as at,c as nt,D as rt,d as it,g as st,V as ot,R as lt,e as ct,f as dt,h as Ct,i as ht,j as ut,I as pt,k as Lt,l as wt,m as mt,W as ft}from"./context-DLtU3JQy.mjs";import{createStore as yt}from"mipd";import{isMobile as gt,isIOS as vt,isAndroid as At,isSafari as Mt}from"react-device-detect";import{toHex as kt,getAddress as Tt,isHex as _t,hashAuthorization as Et}from"viem/utils";import{trigger as bt}from"@privy-io/popup";import{u as St,p as Zt,a as Ft,b as It,f as Wt,c as Pt,d as Ut,e as Ot,o as Nt,g as Rt,h as Ht,i as xt,j as Vt,k as Dt,l as jt,m as Bt,n as qt,q as zt,r as Kt,s as $t,t as Gt,v as Yt,w as Qt,x as Jt,y as Xt,z as ea,A as ta,B as aa,C as na,D as ra,E as ia,F as sa,G as oa,H as la,I as ca,J as da,K as Ca,L as ha,M as ua,N as pa,O as La,P as wa,Q as ma,R as fa,S as ya,T as ga,U as va,V as Aa,W as Ma,X as ka,Y as Ta,Z as _a,_ as Ea,$ as ba,a0 as Sa,a1 as Za,a2 as Fa,a3 as Ia,a4 as Wa}from"./paths-3HW55qZg.mjs";import{o as Pa,p as Ua,d as Oa,r as Na,b as Ra,s as Ha,a as xa,c as Va,u as Da,S as ja,e as Ba,f as qa}from"./usePrivy-C_sY2Duk.mjs";import{base64 as za}from"@scure/base";import{styled as Ka,createGlobalStyle as $a,css as Ga}from"styled-components";import{u as Ya,a as Qa,p as Ja,e as Xa,P as en}from"./events-context-CI0iqAXA.mjs";import{create as tn}from"zustand";import{Transition as an,Dialog as nn,TransitionChild as rn,DialogPanel as sn}from"@headlessui/react";import{EthereumProvider as on,OPTIONAL_METHODS as ln,OPTIONAL_EVENTS as cn}from"@walletconnect/ethereum-provider";import{constructURL as dn}from"@privy-io/urls";import{toHex as Cn,zeroAddress as hn,getAddress as un,createWalletClient as pn,http as Ln,parseSignature as wn}from"viem";import{u as mn,P as fn}from"./PrivyPluginContext-2QN2dVUw.mjs";import{D as yn}from"./getEmbeddedConnectedWallet-JzK4iD-L.mjs";import{ofetch as gn}from"ofetch";import vn from"js-cookie";import{F as An}from"./frame-uzTmvtww.mjs";import{CreateFiatVirtualAccount as Mn,CreateOrUpdateFiatCustomer as kn,GetFiatCustomer as Tn,GetFiatOnrampTransactionStatus as _n,GetFiatOnrampURL as En,GetFiatOnrampQuotes as bn,MfaAuthPasskeyVerify as Sn,MfaAuthPasskeyInit as Zn,MfaAuthTotpVerify as Fn,MfaAuthPasskeyEnrollment as In,MfaAuthTotpUnenroll as Wn,MfaAuthTotpEnroll as Pn,MfaAuthTotpInit as Un}from"@privy-io/routes";import{selectPaymentRequirements as On,createPaymentHeader as Nn}from"x402/client";import{InvalidInputError as Rn}from"@privy-io/api-base";import{areAddressesEqual as Hn}from"@privy-io/are-addresses-equal";import{toAccount as xn}from"viem/accounts";import{u as Vn}from"./use-sign-with-user-signer-Do5Oi_rb.mjs";class Dn{static parse(e){try{return new Dn(e)}catch(e){return null}}static throwIfNotWellFormedJwt(e){return v.decodeJwt(e),e}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(e=0){return Date.now()>=1e3*(this.expiration-e)}constructor(e){this.value=e,this._decoded=v.decodeJwt(e)}}class jn extends Dn{static parse(e){try{return new jn(e)}catch(e){return null}}get appId(){return this._decoded.aid?this._decoded.aid:this.audience}}const Bn=({style:a,...n})=>/*#__PURE__*/e("svg",{viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...a},...n,children:[/*#__PURE__*/t("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),/*#__PURE__*/t("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"})]}),qn="data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PScwIDAgMTAyNCAxMDI0JyBmaWxsPSdub25lJyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHN0eWxlPSdoZWlnaHQ6MjhweDt3aWR0aDoyOHB4Jz48cmVjdCB3aWR0aD0nMTAyNCcgaGVpZ2h0PScxMDI0JyBmaWxsPScjMDA1MkZGJyByeD0nMTAwJyByeT0nMTAwJz48L3JlY3Q+PHBhdGggZmlsbC1ydWxlPSdldmVub2RkJyBjbGlwLXJ1bGU9J2V2ZW5vZGQnIGQ9J00xNTIgNTEyQzE1MiA3MTAuODIzIDMxMy4xNzcgODcyIDUxMiA4NzJDNzEwLjgyMyA4NzIgODcyIDcxMC44MjMgODcyIDUxMkM4NzIgMzEzLjE3NyA3MTAuODIzIDE1MiA1MTIgMTUyQzMxMy4xNzcgMTUyIDE1MiAzMTMuMTc3IDE1MiA1MTJaTTQyMCAzOTZDNDA2Ljc0NSAzOTYgMzk2IDQwNi43NDUgMzk2IDQyMFY2MDRDMzk2IDYxNy4yNTUgNDA2Ljc0NSA2MjggNDIwIDYyOEg2MDRDNjE3LjI1NSA2MjggNjI4IDYxNy4yNTUgNjI4IDYwNFY0MjBDNjI4IDQwNi43NDUgNjE3LjI1NSAzOTYgNjA0IDM5Nkg0MjBaJyBmaWxsPSd3aGl0ZSc+PC9wYXRoPjwvc3ZnPg==",zn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAALZJREFUaEPtmjEOhDAMBNc/O14GvOzys3CAKK6eAlmaVGl2Zc+kTOU685vkc9/bnD2prZK5/TZY24z9P+g4F5hNh7/GdoG37WlAA5CATwgCxHENYISwQAMQII5rACOEBRqAAHFcAxghLNAABIjjGsAIYYEGIEAc1wBGCAs0AAHiuAYwQligAQgQxzWAEcICDUCAOK4BjBAWaAACxHENYISwQAMQII6fBjr+VHkW3+u+tfyxMpJaDgYzYxb/ALZVAAAAAElFTkSuQmCC";let Kn,$n;class Gn extends H{async initialize(){await this.importPromise,await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(e){return e.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}disconnect(){this.proxyProvider.walletProvider.disconnect(),this.onDisconnect()}get walletBranding(){return{name:this.displayName,icon:zn,id:"com.coinbase.wallet"}}async promptConnection(){he.debug("Prompting connection via Base Account",{wallet:this.walletClientType});try{await this.importPromise,he.rpcRequest("eth_requestAccounts",this.walletClientType);let e=await this.proxyProvider.request({method:"eth_requestAccounts"});if(he.rpcResponse("eth_requestAccounts",this.walletClientType),!e||0===e.length||!e[0])throw new We("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([e[0]])}catch(e){throw he.connectionFailed(this.walletClientType,e,{method:"base_account"}),ue(e)}}constructor(e,t,a,n,r){super("base_account",e,t,a),this.connectorType="base_account",this.walletClientType="base_account",this.displayName="Base",this.setBaseAccountSdk=r,this.proxyProvider=new x(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.baseAccountConfig={...n,appChainIds:[t.id].concat(e.map((e=>e.id)))},Kn?(this.proxyProvider.setWalletProvider(Kn.getProvider()),this.setBaseAccountSdk(Kn)):this.importPromise=import("@base-org/account").then((({createBaseAccountSDK:e})=>{Kn=e(this.baseAccountConfig),this.proxyProvider.setWalletProvider(Kn.getProvider()),this.setBaseAccountSdk(Kn)})).catch(console.error)}}let Yn=[1,11155111,137,10,8453,84532,42161,7777777,43114,56];class Qn extends H{async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(e){return e.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}disconnect(){this.proxyProvider.walletProvider.disconnect(),this.onDisconnect()}get walletBranding(){return{name:this.displayName,icon:qn,id:"com.coinbase.wallet"}}async promptConnection(){he.debug("Prompting connection via Coinbase Wallet",{wallet:this.walletClientType});try{he.rpcRequest("eth_requestAccounts",this.walletClientType);let e=await this.proxyProvider.request({method:"eth_requestAccounts"});if(he.rpcResponse("eth_requestAccounts",this.walletClientType),!e||0===e.length||!e[0])throw new We("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([e[0]])}catch(e){throw he.connectionFailed(this.walletClientType,e,{method:"coinbase_wallet"}),ue(e)}}updateConnectionPreference(e){this.coinbaseWalletConfig={...this.coinbaseWalletConfig,preference:{...this.coinbaseWalletConfig.preference,options:e}},this.walletClientType="smartWalletOnly"===e?"coinbase_smart_wallet":"coinbase_wallet",$n=ze({...this.coinbaseWalletConfig}),this.proxyProvider.setWalletProvider($n.getProvider())}constructor(e,t,a,n){if(super("coinbase_wallet",e,t,a),this.connectorType="coinbase_wallet",this.displayName="Coinbase Wallet",this.proxyProvider=new x(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.coinbaseWalletConfig={...n,appChainIds:[t.id].concat(e.map((e=>e.id)))},this.walletClientType="smartWalletOnly"===this.coinbaseWalletConfig.preference?.options?"coinbase_smart_wallet":"coinbase_wallet","coinbase_smart_wallet"===this.walletClientType&&(this.displayName="Coinbase Smart Wallet"),!$n){let e="eoaOnly"!==this.coinbaseWalletConfig.preference?.options?(this.coinbaseWalletConfig.appChainIds??[]).filter((e=>!Yn.includes(e))):[];e.length>0&&!e.every((e=>p.has(e)))&&console.info(`The configured chains are not supported by Coinbase Smart Wallet: ${e.join(", ")}`),$n=ze(this.coinbaseWalletConfig)}this.proxyProvider.setWalletProvider($n.getProvider())}}const Jn=({...e})=>/*#__PURE__*/t("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:/*#__PURE__*/t("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)"})});class Xn extends H{async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(e){return await this.isConnected()?(await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[pe(e?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:Jn,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}constructor({provider:e,chains:t,defaultChain:a,rpcConfig:n,imported:r,walletIndex:i}){super("privy",t,a,n),this.connectorType="embedded",this.proxyProvider=e,this.walletIndex=i,r&&(this.connectorType="embedded_imported"),this.subscribeListeners()}}async function er(){let e=$s();return e?e.getAccessToken():Promise.resolve(Le.get(Ge)||Le.get(Ye)||null)}const tr=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4","csw_signUserOperation","secp256k1_sign"];function ar(e){return e?{"privy-ui":"t"}:void 0}class nr{async authenticate(){if(!this.api)throw new Pe("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new Pe("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(Zt,{email:this.meta.email,code:this.meta.emailCode,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw Ue(e)}}async link(){if(!this.api)throw new Pe("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new Pe("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(Ft,{email:this.meta.email,code:this.meta.emailCode})}catch(e){throw Ue(e)}}async sendCodeEmail({email:e,captchaToken:t,withPrivyUi:a}){if(!this.api)throw new Pe("Auth flow has no API instance");if(e&&(this.meta.email=e),t&&(this.meta.captchaToken=t),!this.meta.email)throw new Pe("Email must be set when initialzing authentication.");let n=ar(a);try{return await this.api.post(It,{email:this.meta.email,token:this.meta.captchaToken},{headers:{...n}})}catch(e){throw Ue(e)}}constructor({email:e,captchaToken:t,disableSignup:a}){this.meta={email:e,captchaToken:t,disableSignup:a??!1}}}class rr extends nr{async link(){if(!this.api)throw new Pe("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new Pe("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(St,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(e){throw Ue(e)}}constructor(e,t,a){super({email:t,captchaToken:a}),this.meta={email:t,captchaToken:a,oldAddress:e,disableSignup:!1}}}class ir{execute(e){return null===this.promise&&(this.promise=(async()=>{try{return await this.fn(e)}finally{this.promise=null}})()),this.promise}constructor(e){this.promise=null,this.fn=e}}class sr{get meta(){return this._meta}async authenticate(){if(!this.api)throw new Pe("Auth flow has no API instance");if(!this.meta.channelToken)throw new Pe("Auth flow must be initialized first");try{let e=await this.api.post(Wt,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});if(!e)throw new Pe("No response from authentication");return e}catch(e){throw Ue(e)}}async link(){if(!this.api)throw new Pe("Auth flow has no API instance");try{return await this.api.post(Pt,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(e){throw Ue(e)}}async _startChannelOnce(){if(!this.api)throw new Pe("Auth flow has no API instance");let e=await this.api.post(Ut,{token:this.captchaToken});gt&&!vt&&e.connect_uri&&Pa(e.connect_uri,"_blank"),this._meta={...this._meta,connectUri:e.connect_uri,channelToken:e.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new Pe("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new Pe("Auth flow has no API instance");if(!this.meta.channelToken)throw new Pe("Auth flow must be initialized first");let e=await this.api.get(Ot,{headers:{"farcaster-channel-token":this.meta.channelToken}});return"completed"===e.state&&(this.message=e.message,this.signature=e.signature,this.fid=e.fid,!0)}constructor(e,t=!1){this._meta={disableSignup:!1},this.captchaToken=e,this.startChannelOnce=new ir(this._startChannelOnce.bind(this)),this.pollForReady=new ir(this._pollForReady.bind(this)),this._meta.disableSignup=t}}function or(){return"undefined"!=typeof window&&"chrome-extension:"===window.location.protocol&&"chrome"in window}function lr(){if(!or())return;let e=window.chrome;return e?.runtime?.id}function cr(){if(!or())return!1;let e=window.chrome;return"function"==typeof e?.identity?.launchWebAuthFlow}async function dr(e){return new Promise(((t,a)=>{cr()?window.chrome.identity.launchWebAuthFlow({url:e,interactive:!0},(async e=>{try{let a=function(){if(!or())return;let e=window.chrome;return e?.runtime?.lastError?.message}();if(a||!e){let e=`WebAuthFlow failed: ${a||"Response URI missing"}`;throw Error(e)}let n=new URL(e),r=lr();if(!r)throw Error("Invalid extension context");if("chrome-extension:"===n.protocol){if(n.hostname!==r)throw Error("Invalid responseUri origin")}else{if("https:"!==n.protocol)throw Error("Invalid responseUri protocol");{let e=n.hostname.split(".");if(3!==e.length||"chromiumapp"!==e[1]||"org"!==e[2]||e[0]!==r)throw Error("Invalid responseUri origin")}}let i=n.searchParams.get("privy_oauth_state"),s=n.searchParams.get("privy_oauth_code");if(!i||!s)throw Error("Invalid responseUri - missing required parameters");t({privyOAuthState:i,privyOAuthCode:s})}catch(e){a(e)}})):a(Error("Chrome identity API not available"))}))}function Cr(e){return crypto.getRandomValues(new Uint8Array(e))}function hr(){return A.encode(Cr(36))}function ur(){return hr()}async function pr(e,t="S256"){if("S256"!=t)return e;{let t=await async function(e){let t=(new TextEncoder).encode(e);return new Uint8Array(await crypto.subtle.digest("SHA-256",t))}(e);return A.encode(t)}}class Lr{addCaptchaToken(e){this.meta.captchaToken=e}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new Pe("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new Pe("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if("undefined"===this.meta.authorizationCode)throw new Pe("User denied confirmation during OAuth flow");let e=function(){let e=Le.get(Qe);if(!e)throw new Pe("Authentication error.");return e}();try{let t=await this.api.post(Nt,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:e,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});return Le.del(Qe),Le.del(Je),Le.del(Xe),t}catch(e){let t=Ue(e);if(t.privyErrorCode)throw new Pe(t.message||"Invalid code during OAuth flow.",void 0,t.privyErrorCode);if("User denied confirmation during OAuth flow"===t.message)throw new Pe("Invalid code during oauth flow.",void 0,Oe.OAUTH_USER_DENIED);throw new Pe("Invalid code during OAuth flow.",void 0,Oe.UNKNOWN_AUTH_ERROR)}}async link(){if(!this.api)throw new Pe("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new Pe("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if("undefined"===this.meta.authorizationCode)throw new Pe("User denied confirmation during OAuth flow");let e=Le.get(Qe);if(!e)throw new Pe("Authentication error.");try{let t=await this.api.post(Rt,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:e});return Le.del(Qe),t}catch(e){throw Ue(e)}}async getAuthorizationUrl(){if(!this.api)throw new Pe("Auth flow has no API instance");if(!this.meta.provider)throw new Pe("Provider must be set when initializing OAuth authentication.");let e=hr();Le.put(Qe,e);let t=ur();Le.put(et,t);let a=await pr(e);this.meta.withPrivyUi||Le.put(Je,!0),this.meta.disableSignup?Le.put(Xe,!0):Le.del(Xe);let n=ar(this.meta.withPrivyUi),r=window.location.href,i=function(){let e=lr();if(e)return`https://${e}.chromiumapp.org`}();i&&(r=i);try{return await this.api.post(Ht,{provider:this.meta.provider,redirect_to:this.meta.customOAuthRedirectUrl||r,token:this.meta.captchaToken,code_challenge:a,state_code:t},{headers:{...n}})}catch(e){throw Ue(e)}}constructor(e){this.meta=e}}function wr(){let e=new URLSearchParams(window.location.search),t=e.get("privy_oauth_code"),a=e.get("privy_oauth_state"),n=e.get("privy_oauth_provider");if(!t||!a||!n)return{inProgress:!1};let r=!1;try{r=!!window.opener.location.origin}catch{}return{inProgress:!0,authorizationCode:t,stateCode:a,provider:n,withPrivyUi:!Le.get(Je),popupFlow:null!==window.opener&&r,disableSignup:!!Le.get(Xe)}}function mr(){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"),Le.del(et),window.history.replaceState({},"",e)}class fr{async initRegisterFlow(e){if(!this.api)throw new Pe("Auth flow has no API instance");this.authenticateForRegistration=!0,this.meta.initRegisterResponse=await this.initRegisterOnce.execute(e)}async initAuthenticationFlow(e){if(!this.api)throw new Pe("Auth flow has no API instance");this.authenticateForRegistration=!1,this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute(e)}async initLinkFlow(){if(!this.api)throw new Pe("Auth flow has no API instance");this.meta.initLinkResponse=await this.initLinkOnce.execute()}async register(){let e=await import("@simplewebauthn/browser");if(!this.api)throw new Pe("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new Pe("WebAuthn is not supported in this browser");this.meta.initRegisterResponse||(this.meta.initRegisterResponse=await this.initRegisterOnce.execute());try{let t=this.meta.initRegisterResponse.options,a=await e.startRegistration({optionsJSON:this._transformInitLinkOptionsToCamelCase(t)});return this.meta.setPasskeyAuthState?.({status:"submitting-response"}),await this.api.post(xt,{relying_party:this.meta.initRegisterResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(a)})}catch(e){if("NotAllowedError"===e.name)throw new Pe("Passkey request timed out or rejected by user.",void 0,Oe.PASSKEY_NOT_ALLOWED);throw Ue(e)}}async authenticate(){if(this.authenticateForRegistration)return this.register();let e=await import("@simplewebauthn/browser");if(!this.api)throw new Pe("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new Pe("WebAuthn is not supported in this browser");this.meta.initAuthenticateResponse||(this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute());let t=this.meta.allowedCredentialsIds?.map((e=>({type:"public-key",id:e})))??this.meta.initAuthenticateResponse.options.allow_credentials;try{let a=await e.startAuthentication({optionsJSON:this._transformInitAuthenticateOptionsToCamelCase({...this.meta.initAuthenticateResponse.options,allow_credentials:t})});return this.meta.setPasskeyAuthState?.({status:"submitting-response"}),await this.api.post(Vt,{relying_party:this.meta.initAuthenticateResponse.relying_party,challenge:this.meta.initAuthenticateResponse.options.challenge,authenticator_response:this._transformAuthenticationResponseToSnakeCase(a)})}catch(e){if("NotAllowedError"===e.name)throw new Pe("Passkey request timed out or rejected by user.",void 0,Oe.PASSKEY_NOT_ALLOWED);throw Ue(e)}}async link(){let e=await import("@simplewebauthn/browser");if(!this.api)throw new Pe("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new Pe("WebAuthn is not supported in this browser");this.meta.initLinkResponse||(this.meta.initLinkResponse=await this.initLinkOnce.execute());try{let t=this.meta.initLinkResponse.options,a=await e.startRegistration({optionsJSON:this._transformInitLinkOptionsToCamelCase(t)});return this.meta.setPasskeyAuthState?.({status:"submitting-response"}),await this.api.post(Dt,{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(a)})}catch(e){if("NotAllowedError"===e.name)throw new Pe("Passkey request timed out or rejected by user.",void 0,Oe.PASSKEY_NOT_ALLOWED);throw Ue(e)}}async _initRegisterOnce(e){if(!this.api)throw new Pe("Auth flow has no API instance");let t=ar(e);return await this.api.post(jt,{token:this.meta.captchaToken},{headers:{...t}})}async _initAuthenticateOnce(e){if(!this.api)throw new Pe("Auth flow has no API instance");let t=ar(e);return await this.api.post(Bt,{token:this.meta.captchaToken},{headers:{...t}})}async _initLinkOnce(){if(!this.api)throw new Pe("Auth flow has no API instance");return await this.api.post(qt,{})}_transformInitLinkOptionsToCamelCase(e){return{rp:e.rp,user:{id:e.user.id,name:e.user.name,displayName:e.user.display_name},challenge:e.challenge,pubKeyCredParams:e.pub_key_cred_params.map((e=>({type:e.type,alg:e.alg}))),timeout:e.timeout,excludeCredentials:e.exclude_credentials?.map((e=>({id:e.id,type:e.type,transports:e.transports}))),authenticatorSelection:{authenticatorAttachment:e.authenticator_selection?.authenticator_attachment,requireResidentKey:e.authenticator_selection?.require_resident_key,residentKey:e.authenticator_selection?.resident_key,userVerification:e.authenticator_selection?.user_verification},attestation:e.attestation,extensions:{appid:e.extensions?.app_id,credProps:e.extensions?.cred_props?.rk,hmacCreateSecret:e.extensions?.hmac_create_secret},hints:this.meta.hints}}_transformRegistrationResponseToSnakeCase(e){return{id:e.id,raw_id:e.rawId,response:{client_data_json:e.response.clientDataJSON,attestation_object:e.response.attestationObject,authenticator_data:e.response.authenticatorData},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}}_transformInitAuthenticateOptionsToCamelCase(e){return{rpId:e.rp_id,challenge:e.challenge,allowCredentials:e.allow_credentials?.map((e=>({id:e.id,type:e.type,transports:e.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}}_transformAuthenticationResponseToSnakeCase(e){return{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}}constructor({captchaToken:e,setPasskeyAuthState:t,hints:a}){this.authenticateForRegistration=!1,this.initRegisterOnce=new ir(this._initRegisterOnce.bind(this)),this.initAuthenticateOnce=new ir(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new ir(this._initLinkOnce.bind(this)),this.meta={captchaToken:e,setPasskeyAuthState:t,hints:a}}}const yr=({address:e,chainId:t,nonce:a})=>`${window.location.host} wants you to sign in with your Ethereum account:\n${e}\n\nBy signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.\n\nURI: ${window.location.origin}\nVersion: 1\nChain ID: ${t}\nNonce: ${a}\nIssued At: ${(new Date).toISOString()}\nResources:\n- https://privy.io`;class gr{get meta(){return{connectorType:this.wallet?.connectorType,walletClientType:this.wallet?.walletClientType,chainId:this.wallet?.chainId,address:this.wallet?.address,disableSignup:this._meta.disableSignup}}async authenticate(){if(!this.client)throw new Pe("SiweFlow has no client instance");try{if(this.preparedMessage&&this.signature)return await this.client.authenticateWithSiweInternal({message:this.preparedMessage,signature:this.signature,chainId:this.wallet?.chainId,walletClientType:this.walletClientType??this.wallet?.walletClientType,connectorType:this.connectorType??this.wallet?.connectorType,mode:this._meta.disableSignup?"no-signup":"login-or-sign-up"});if(!this.wallet)throw new Pe("SiweFlow has no wallet instance");let{message:e,signature:t}=await this.sign();return await this.client.authenticateWithSiweInternal({message:e,signature:t,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw Ue(e)}}async link(){if(!this.client)throw new Pe("SiweFlow has no client instance");try{if(!this.wallet)throw new Pe("SiweFlow has no wallet instance");let{message:e,signature:t}=await this.sign();return await this.client.linkWithSiweInternal({message:e,signature:t,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(e){throw Ue(e)}}async sign(){if(!this.client)throw new Pe("SiweFlow has no client instance");if(await this.buildMessage(),!this.preparedMessage)throw new Pe("Could not prepare SIWE message");if(!this.wallet)throw new Pe("SiweFlow has no wallet instance");let e=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:e}}async _getNonceOnce(){if(!this.client)throw new Pe("SiweFlow has no client instance");if(!this.wallet)throw new Pe("UI SiweFlow has no wallet instance");return await this.client.generateSiweNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildMessage(){if(!this.client)throw new Pe("SiweFlow has no client instance");if(!this.wallet)throw new Pe("SiweFlow has no wallet instance");let e=this.wallet.address,t=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=yr({address:e,chainId:t,nonce:this.nonce}),this.preparedMessage}constructor(e,t,a,n=!1,r){this._meta={disableSignup:!1},this.getNonceOnce=new ir(this._getNonceOnce.bind(this)),this.wallet=t,this.captchaToken=a,this.client=e,this._meta.disableSignup=n,this.preparedMessage=r?.message,this.signature=r?.signature,this.walletClientType=r?.walletClientType,this.connectorType=r?.connectorType}}class vr{get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType,disableSignup:this._meta.disableSignup,messageType:this._meta.messageType,address:this.wallet?.address}}set messageType(e){this._meta.messageType=e}async authenticate(){if(!this.client)throw new Pe("SiwsFlow has no client instance");try{let{message:e,signature:t}=await this.sign();return await this.client.authenticateWithSiwsInternal({message:e,signature:t,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up",messageType:this.meta.messageType})}catch(e){throw Ue(e)}}async link(){if(!this.client)throw new Pe("SiwsFlow has no client instance");try{let{message:e,signature:t}=await this.sign();return await this.client.linkWithSiwsInternal({message:e,signature:t,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType,messageType:this.meta.messageType})}catch(e){throw Ue(e)}}async sign(){let e,t;if(!this.client)throw new Pe("SiwsFlow has no client instance");await this.buildMessage();let a="transaction"===this.meta.messageType;if(!this.preparedMessage)throw new Pe("Could not prepare SIWS message");if(!a&&!this.wallet.provider.signMessage||a&&!this.wallet.provider.signTransaction)throw new Pe("Wallet does not support the necessary signing methods");if(a&&this._plugin){let a=await this.wallet.provider.signTransaction({transaction:za.decode(this.preparedMessage)});e=za.encode(a.signedTransaction),t=this._plugin.getSignatureFromTransaction(a.signedTransaction,this.wallet.address)}else{e=this.preparedMessage;let a=await this.wallet.provider.signMessage({message:(new TextEncoder).encode(this.preparedMessage)});t=za.encode(a.signature)}return{message:e,signature:t}}async _getNonceOnce(){if(!this.client)throw new Pe("SiwsFlow has no client instance");return await this.client.generateSiwsNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildMessage(){if(!this.client)throw new Pe("SiwsFlow has no client instance");let e=this.wallet.address;return this.nonce||(this.nonce=await this.getNonceOnce.execute()),"transaction"===this.meta.messageType&&this._plugin?this.preparedMessage=this._plugin.createSiwsMemoTransaction({address:e,nonce:this.nonce}):this.preparedMessage=Ua({address:e,nonce:this.nonce}),this.preparedMessage}constructor(e,t,a,n=!1,r="plain",i){this._meta={disableSignup:!1,messageType:"plain"},this.getNonceOnce=new ir(this._getNonceOnce.bind(this)),this.wallet=e,this.captchaToken=a,this.client=t,this._meta.disableSignup=n,this._meta.messageType=r,this._plugin=i}}class Ar{async authenticate(){if(!this.api)throw new Pe("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new Pe("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(zt,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw Ue(e)}}async link(){if(!this.api)throw new Pe("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new Pe("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(Kt,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(e){throw Ue(e)}}async sendSmsCode({phoneNumber:e,captchaToken:t,withPrivyUi:a}){if(!this.api)throw new Pe("Auth flow has no API instance");if(e&&(this.meta.phoneNumber=e),t&&(this.meta.captchaToken=t),!this.meta.phoneNumber)throw new Pe("phone nNumber must be set when initialzing authentication.");let n=ar(a);try{return await this.api.post($t,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken},{headers:{...n}})}catch(e){throw Ue(e)}}constructor({phoneNumber:e,captchaToken:t,disableSignup:a}){this.meta={phoneNumber:e,captchaToken:t,disableSignup:a??!1}}}class Mr extends Ar{async link(){if(!this.api)throw new Pe("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode||!this.meta.oldPhoneNumber)throw new Pe("Phone number, sms code, and an old phone number must be set prior to calling update.");try{return await this.api.post(Gt,{old_phone_number:this.meta.oldPhoneNumber,new_phone_number:this.meta.phoneNumber,code:this.meta.smsCode})}catch(e){throw Ue(e)}}constructor(e,t,a){super({phoneNumber:t,captchaToken:a}),this.meta={phoneNumber:t,captchaToken:a,oldPhoneNumber:e,disableSignup:!1}}}const kr=/*#__PURE__*/i({enabled:!1,siteKey:"",provider:void 0,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:Re,setError:Re,setExecuting:Re,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:He,reset:Re,execute:Re});class Tr extends Ne{constructor(e,t,a){super(e||"Captcha failed"),this.type="Captcha",t instanceof Error&&(this.cause=t),this.privyErrorCode=a}}const _r=({children:e,appId:a,captchaSiteKey:n,enabledCaptchaProvider:r})=>{let i=s(null),c=s(null),[d,C]=o(),[h,u]=o(),[p,L]=o(!1),w=l((()=>r?p||d||h?!p||d||h?d&&!h?{status:"success",token:d}:h?{status:"error",error:h}:{status:"ready"}:{status:"loading"}:{status:"ready"}:{status:"disabled"}),[r,d,h,p]),m=l((()=>r?"turnstile"===r?{remove:()=>{i.current?.remove(),L(!1),u(void 0),C(void 0)},reset:()=>{i.current?.reset(),L(!1),u(void 0),C(void 0)},execute:()=>{L(!0),i.current?.execute()},waitForResult:async()=>{try{return await we((()=>i.current?.getResponse()),{interval:200,timeout:2e4})}catch(e){throw new Tr("Captcha failed",null,Oe.CAPTCHA_TIMEOUT)}}}:{remove:()=>{c.current?.removeCaptcha(),L(!1),u(void 0),C(void 0)},reset:()=>{c.current?.resetCaptcha(),L(!1),u(void 0),C(void 0)},execute:()=>{L(!0),c.current?.execute()},waitForResult:async()=>{try{return await we((()=>{let e=c.current?.getResponse();if(e)return e}),{interval:200,timeout:2e4})}catch(e){throw new Tr("Captcha failed",null,Oe.CAPTCHA_TIMEOUT)}}}:null),[r]),f=l((()=>{if(!r||!m)return{...w,enabled:!1,siteKey:"",appId:a,setToken:Re,setError:Re,setExecuting:Re,waitForResult:()=>Promise.resolve(void 0),remove:He,reset:Re,execute:Re,provider:void 0,ref:{current:null}};let e={...w,enabled:!0,appId:a,setToken:C,setError:u,setExecuting:L};return"turnstile"===r?{...e,provider:"turnstile",ref:i,siteKey:n.split("t:")[1]??"",...m}:{...e,provider:"hcaptcha",ref:c,siteKey:n.split("h:")[1]??"",...m}}),[w,r,m,a,n]);/*#__PURE__*/return t(kr.Provider,{value:f,children:e})},Er=()=>r(kr);async function br(e){if(e.enabled){if("error"===e.status)throw new Tr(e.error,null,Oe.CAPTCHA_FAILURE);return"success"===e.status?e.token:(e.execute(),await e.waitForResult())}}class Sr{async authenticate(){if(!this.api)throw new Pe("Auth flow has no API instance");try{return await this.api.post(Yt,{captcha_token:this.meta.captchaToken,telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw Ue(e)}}async link(){if(!this.api)throw new Pe("Auth flow has no API instance");try{return await this.api.post(Qt,{telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData})}catch(e){throw Ue(e)}}constructor(e,t=!1){this.meta={disableSignup:!1},this.meta={captchaToken:e,disableSignup:!1},this.meta.disableSignup=t}}function Zr(e){let t={detail:"",retryable:!1};return e?.privyErrorCode===Oe.LINKED_TO_ANOTHER_USER&&(t.detail="This account has already been linked to another user."),e?.privyErrorCode===Oe.DISALLOWED_LOGIN_METHOD&&(t.detail="Login with Telegram not allowed."),e?.privyErrorCode===Oe.INVALID_DATA&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===Oe.CANNOT_LINK_MORE_OF_TYPE&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===Oe.INVALID_CREDENTIALS&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===Oe.TOO_MANY_REQUESTS&&(t.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode===Oe.TOO_MANY_REQUESTS&&e.message.includes("rate limit")&&(t.detail="Request limit reached for Telegram. Please wait a moment and try again."),e instanceof Tr&&(t.retryable=!0,t.detail="Something went wrong. Try again."),t}function Fr(e){return Object.fromEntries(decodeURIComponent(e).split("&").map((e=>e.split("=").map(decodeURIComponent))))}function Ir(){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"),e.hash="",window.history.replaceState({},"",e)}let Wr=/*#__PURE__*/C((()=>import("./TurnstileWrapper-Co-t5mTh.mjs"))),Pr=/*#__PURE__*/C((()=>import("./HCaptchaWrapper-CUi9LJsp.mjs")));const Ur=a=>{let n=Er();return c((()=>n.remove),[n.remove]),n.enabled&&n.provider?/*#__PURE__*/t(d,{fallback:null,children:/*#__PURE__*/e("div",{className:"hidden h-0 w-0",children:["turnstile"===n.provider&&/*#__PURE__*/t(Wr,{...a,captchaContext:n}),"hcaptcha"===n.provider&&/*#__PURE__*/t(Pr,{...a,captchaContext:n})]})}):null};var Or=/*#__PURE__*/Object.freeze({__proto__:null,AccountNotFoundScreen:()=>import("./AccountNotFoundScreen-D59Em28p.mjs"),AffirmativeConsentScreen:()=>import("./AffirmativeConsentScreen-nijRFoNp.mjs"),AllowlistRejectionScreen:()=>import("./AllowlistRejectionScreen-CpZy18yk.mjs"),AuthenticateWithWalletScreen:()=>import("./AuthenticateWithWalletScreen-BWicCqKg.mjs"),AwaitingEvmToSolBridgingScreen:()=>import("./AwaitingEvmToSolBridgingScreen-Bca7Dq5r.mjs"),AwaitingExternalEthereumTransferScreen:()=>import("./AwaitingExternalEthereumTransferScreen-NbFK0A1q.mjs"),AwaitingPasswordlessCodeScreen:()=>import("./AwaitingPasswordlessCodeScreen-cLUlwC9S.mjs"),AwaitingSolToEvmBridgingScreen:()=>import("./AwaitingSolToEvmBridgingScreen-CXPb-Ukz.mjs"),CaptchaScreen:()=>import("./CaptchaScreen-Cu3_cr8h.mjs"),CoinbaseOnrampStatusScreen:()=>import("./CoinbaseOnrampStatusScreen-lD0tNDQe.mjs"),ConnectLedgerScreen:()=>import("./ConnectLedgerScreen-BbsW8DSt.mjs"),ConnectOnlyLandingScreen:()=>import("./ConnectOnlyLandingScreen-D7uxtarL.mjs"),ConnectOnlyStatusScreen:()=>import("./ConnectOnlyStatusScreen-DpKUDVIK.mjs"),ConnectOrCreateScreen:()=>import("./ConnectOrCreateScreen-BNNYF6Ns.mjs"),ConnectionStatusScreen:()=>import("./ConnectionStatusScreen-Dfv_mgId.mjs"),CrossAppAuthScreen:()=>import("./CrossAppAuthScreen-BOCFddJL.mjs"),DelegatedActionsConsentScreen:()=>import("./DelegatedActionsConsentScreen-CS1yCHBG.mjs"),DelegatedActionsRevokeScreen:()=>import("./DelegatedActionsRevokeScreen-Cw1FPv8x.mjs"),EmbeddedWalletConnectingScreen:()=>import("./EmbeddedWalletConnectingScreen-DGY8j-Si.mjs"),EmbeddedWalletCreatedScreen:()=>import("./EmbeddedWalletCreatedScreen-DLR7TF4o.mjs"),EmbeddedWalletKeyExportScreen:()=>import("./EmbeddedWalletKeyExportScreen-B3GsSPLG.mjs"),EmbeddedWalletOnAccountCreateScreen:()=>import("./EmbeddedWalletOnAccountCreateScreen-ColmQZ-q.mjs"),EmbeddedWalletPasswordCreateScreen:()=>import("./RecoveryPasswordCreateScreen-OrukIxHX.mjs"),EmbeddedWalletPasswordUpdateScreen:()=>import("./EmbeddedWalletPasswordUpdateScreen-BRG9dsaW.mjs"),EmbeddedWalletPasswordUpdateSplashScreen:()=>import("./EmbeddedWalletPasswordUpdateSplashScreen-B3cMml6w.mjs"),ErrorScreen:()=>import("./ErrorScreen-sNIfGI6q.mjs"),FarcasterConnectStatusScreen:()=>import("./FarcasterConnectStatusScreen-DmhyV2vW.mjs"),FarcasterSignerStatusScreen:()=>import("./FarcasterSignerStatusScreen-DqEULwox.mjs"),FiatOnrampScreen:()=>import("./FiatOnrampScreen-A5_TNfEg.mjs"),FundSolWalletWithExternalSolanaWallet:()=>import("./FundSolWalletWithExternalSolanaWallet-Cy3gO2rc.mjs"),FundWithBankDepositScreen:()=>import("./FundWithBankDepositScreen--e9rfZCc.mjs"),FundingAmountEditScreen:()=>import("./FundingEditAmountScreen-BLmy4zpf.mjs"),FundingMethodSelectionScreen:()=>import("./FundingMethodSelectionScreen-CFTtSc8T.mjs"),InAppBrowserLoginNotPossible:()=>import("./InAppBrowserLoginNotPossible-BcEZlehe.mjs"),InstallWalletScreen:()=>import("./InstallWalletScreen-CtJuryxO.mjs"),LandingScreen:()=>import("./LandingScreen-yPpishM-.mjs"),LinkConflictScreen:()=>import("./LinkConflictScreen-CElxCrSW.mjs"),LinkEmailScreen:()=>import("./LinkEmailScreen-C08N0_oz.mjs"),LinkPasskeyScreen:()=>import("./LinkPasskeyScreen-DmtRo8xi.mjs"),LinkPhoneScreen:()=>import("./LinkPhoneScreen-aZRsfGsF.mjs"),LoginFailedScreen:()=>import("./LoginFailedScreen-C8ktIEOG.mjs"),ManualTransferScreen:()=>import("./ManualTransferScreen-DiSMGPNF.mjs"),MfaAuthEnrollmentFlowScreen:()=>import("./MfaAuthEnrollmentFlowScreen-DnpsjnqC.mjs"),MfaAuthVerifyFlowScreen:()=>import("./MfaAuthVerifyFlowScreen-cdXMRh6f.mjs"),MfaEnrollmentFlowScreen:()=>import("./MfaEnrollmentFlowScreen-_yDQyI2u.mjs"),MoonpayStatusScreen:()=>import("./MoonpayStatusScreen-tZ8mdR2X.mjs"),OAuthStatusScreen:()=>import("./OAuthStatusScreen-GWwbWdSi.mjs"),PasskeySelectSignupOrLogin:()=>import("./PasskeySelectSignupOrLogin-Dl5rDsw7.mjs"),PasskeyStatusScreen:()=>import("./PasskeyStatusScreen-2znvW7Lc.mjs"),PasswordRecoveryScreen:()=>import("./PasswordRecoveryScreen-DBLHkrI_.mjs"),RecoveryOAuthScreen:()=>import("./RecoveryOAuthStatusScreen-7cATjPBS.mjs"),RecoverySelectionScreen:()=>import("./RecoverySelectionScreen-CFkgwzMS.mjs"),SendTransactionScreen:()=>import("./index-B7Y-7rkw.mjs"),SetAutomaticRecoveryScreen:()=>import("./SetAutomaticRecoveryScreen-CaXj1unh.mjs"),SignRequestScreen:()=>import("./SignRequestScreen-CKO-pLHy.mjs"),StandardSignAndSendTransactionScreen:()=>import("./StandardSignAndSendTransactionScreen-Cya0O4wv.mjs"),TelegramAuthScreen:()=>import("./TelegramAuthScreen-DMBY4HLl.mjs"),TransferFromWalletScreen:()=>import("./TransferFromWalletScreen-DMoSgPhn.mjs"),UpdateEmailScreen:()=>import("./UpdateEmailScreen-Dtbkg-xg.mjs"),UpdatePhoneScreen:()=>import("./UpdatePhoneScreen-DJzzJhXJ.mjs"),UserLimitReachedScreen:()=>import("./UserLimitReachedScreen-DsJc40Yi.mjs"),WalletInterstitialScreen:()=>import("./WalletInterstitialScreen-CK6FWlf-.mjs")});function Nr(e){Ya("configureMfa",e)}const Rr=tn((()=>({inProgressMfaFlow:void 0})));const Hr=$a`
:root {
${e=>xr(e.palette)}
};
`;const xr=e=>{let t=function(e){return{"--privy-color-background":e.background,"--privy-color-background-2":e.background2,"--privy-color-background-3":e.background3,"--privy-color-foreground":e.foreground,"--privy-color-foreground-2":e.foreground2,"--privy-color-foreground-3":e.foreground3,"--privy-color-foreground-4":e.foreground4,"--privy-color-foreground-accent":e.foregroundAccent,"--privy-color-accent":e.accent,"--privy-color-accent-light":e.accentLight,"--privy-color-accent-hover":e.accentHover,"--privy-color-accent-dark":e.accentDark,"--privy-color-accent-darkest":e.accentDarkest,"--privy-color-success":e.success,"--privy-color-success-dark":e.successDark,"--privy-color-success-light":e.successLight,"--privy-color-success-bg":e.successBg,"--privy-color-error":e.error,"--privy-color-error-light":e.errorLight,"--privy-color-error-bg":e.errorBg,"--privy-color-error-bg-hover":e.errorBgHover,"--privy-color-warn":e.warn,"--privy-color-warn-light":e.warnLight,"--privy-color-warn-bg":e.warnBg,"--privy-color-warning-dark":e.warningDark,"--privy-color-error-dark":e.errorDark,"--privy-color-info-bg":e.infoBg,"--privy-color-info-bg-hover":e.infoBgHover,"--privy-color-border-default":e.borderDefault,"--privy-color-border-hover":e.borderHover,"--privy-color-border-focus":e.borderFocus,"--privy-color-border-error":e.borderError,"--privy-color-border-success":e.borderSuccess,"--privy-color-border-warning":e.borderWarning,"--privy-color-border-info":e.borderInfo,"--privy-color-border-interactive":e.borderInteractive,"--privy-color-border-interactive-hover":e.borderInteractiveHover,"--privy-color-background-hover":e.backgroundHover,"--privy-color-background-clicked":e.backgroundClicked,"--privy-color-background-disabled":e.backgroundDisabled,"--privy-color-background-interactive":e.backgroundInteractive,"--privy-color-background-interactive-hover":e.backgroundInteractiveHover,"--privy-color-background-interactive-clicked":e.backgroundInteractiveClicked,"--privy-color-background-interactive-disabled":e.backgroundInteractiveDisabled,"--privy-color-foreground-hover":e.foregroundHover,"--privy-color-foreground-clicked":e.foregroundClicked,"--privy-color-foreground-disabled":e.foregroundDisabled,"--privy-color-foreground-interactive":e.foregroundInteractive,"--privy-color-foreground-interactive-hover":e.foregroundInteractiveHover,"--privy-link-navigation-color":e.linkNavigationColor,"--privy-link-navigation-decoration":e.linkNavigationDecoration,"--privy-accent-has-good-contrast":e.accentHasGoodContrast,"--privy-color-icon-default":e.iconDefault,"--privy-color-icon-muted":e.iconMuted,"--privy-color-icon-subtle":e.iconSubtle,"--privy-color-icon-inverse":e.iconInverse,"--privy-color-icon-success":e.iconSuccess,"--privy-color-icon-warning":e.iconWarning,"--privy-color-icon-error":e.iconError,"--privy-color-icon-interactive":e.iconInteractive,"--privy-color-icon-default-hover":e.iconDefaultHover,"--privy-color-icon-muted-hover":e.iconMutedHover,"--privy-color-icon-subtle-hover":e.iconSubtleHover,"--privy-color-icon-default-clicked":e.iconDefaultClicked,"--privy-color-icon-muted-clicked":e.iconMutedClicked,"--privy-color-icon-subtle-clicked":e.iconSubtleClicked,"--privy-color-icon-default-disabled":e.iconDefaultDisabled,"--privy-color-icon-muted-disabled":e.iconMutedDisabled,"--privy-color-icon-subtle-disabled":e.iconSubtleDisabled,"--privy-color-icon-error-hover":e.iconErrorHover,"--privy-color-icon-interactive-hover":e.iconInteractiveHover,"--privy-color-icon-error-clicked":e.iconErrorClicked,"--privy-color-icon-interactive-clicked":e.iconInteractiveClicked,"--privy-color-icon-muted-disabled-alt":e.iconMutedDisabledAlt,"--privy-color-icon-subtle-disabled-alt":e.iconSubtleDisabledAlt,"--privy-border-radius-xs":"6px","--privy-border-radius-sm":"8px","--privy-border-radius-md":"12px","--privy-border-radius-mdlg":"16px","--privy-border-radius-lg":"24px","--privy-border-radius-full":"9999px","--privy-height-modal-full":"620px","--privy-height-modal-compact":"480px"}}(e);return Ga`
${Object.entries(t).map((([e,t])=>`${e}: ${t};`)).join("\n")}
`},Vr=Ka.div`
// css normalize only the privy application to avoid conflicts
// with consuming application
${"\n *,\n ::before,\n ::after {\n box-sizing: border-box;\n border-width: 0;\n border-style: solid;\n }\n\n line-height: 1.15;\n -webkit-text-size-adjust: 100%;\n -moz-tab-size: 4;\n tab-size: 4;\n font-feature-settings: normal;\n\n margin: 0;\n font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif,\n 'Apple Color Emoji', 'Segoe UI Emoji';\n\n hr {\n height: 0;\n color: inherit;\n border-top-width: 1px;\n }\n\n abbr:where([title]) {\n text-decoration: underline dotted;\n }\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n font-size: inherit;\n font-weight: inherit;\n font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif,\n 'Apple Color Emoji', 'Segoe UI Emoji';\n display: inline;\n }\n\n a {\n color: inherit;\n text-decoration: inherit;\n }\n\n b,\n strong {\n font-weight: bolder;\n }\n\n code,\n kbd,\n samp,\n pre {\n font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;\n font-size: 1em;\n }\n\n small {\n font-size: 80%;\n }\n\n sub,\n sup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n }\n\n sub {\n bottom: -0.25em;\n }\n\n sup {\n top: -0.5em;\n }\n\n table {\n text-indent: 0;\n border-color: inherit;\n border-collapse: collapse;\n }\n\n button,\n input,\n optgroup,\n select,\n textarea {\n font-family: inherit;\n font-size: 100%;\n font-weight: inherit;\n line-height: inherit;\n color: inherit;\n margin: 0;\n padding: 0;\n }\n\n button,\n select {\n text-transform: none;\n }\n\n button,\n [type='button'],\n [type='reset'],\n [type='submit'] {\n -webkit-appearance: button;\n background