@privy-io/react-auth
Version:
React client for the Privy Auth API
5 lines • 465 kB
JavaScript
"use strict";var e=require("react/jsx-runtime"),t=require("react"),r=require("@privy-io/js-sdk-core"),n=require("uuid"),i=require("jose"),a=require("./privy-context-CrM9_s6G.js"),s=require("eventemitter3"),o=require("./useActiveWallet-BfMD5hzE.js"),l=require("./useWallets-dikDynAG.js"),c=require("./use-export-wallet-_EIyxyle.js"),d=require("./internal-context-BJv4f_bO.js"),C=require("@coinbase/wallet-sdk"),u=require("@privy-io/ethereum"),h=require("./context-Cg3IEi80.js"),p=require("mipd"),L=require("react-device-detect"),y=require("viem/utils"),w=require("@privy-io/popup"),f=require("./paths-DizMb-lU.js"),m=require("./usePrivy-C-Rab7yP.js"),g=require("@scure/base"),v=require("styled-components"),E=require("./events-context-Di6--rDg.js"),A=require("zustand"),P=require("@headlessui/react"),M=require("@walletconnect/ethereum-provider"),k=require("@privy-io/urls"),x=require("viem"),T=require("./PrivyPluginContext-DsgaS6n9.js"),_=require("./getEmbeddedConnectedWallet-pJd-l936.js"),S=require("ofetch"),b=require("js-cookie"),I=require("./frame-Oz7volks.js"),Z=require("@privy-io/routes"),j=require("x402/client"),W=require("@privy-io/api-base"),F=require("@privy-io/are-addresses-equal"),U=require("viem/accounts"),R=require("./use-sign-with-user-signer-Cu_6Bx7m.js");function O(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function N(e){if(e&&"object"==typeof e&&"default"in e)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var H=/*#__PURE__*/O(t),D=/*#__PURE__*/O(r),V=/*#__PURE__*/N(i),q=/*#__PURE__*/O(s),B=/*#__PURE__*/O(b);class z{static parse(e){try{return new z(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 K extends z{static parse(e){try{return new K(e)}catch(e){return null}}get appId(){return this._decoded.aid?this._decoded.aid:this.audience}}const Y="data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PScwIDAgMTAyNCAxMDI0JyBmaWxsPSdub25lJyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHN0eWxlPSdoZWlnaHQ6MjhweDt3aWR0aDoyOHB4Jz48cmVjdCB3aWR0aD0nMTAyNCcgaGVpZ2h0PScxMDI0JyBmaWxsPScjMDA1MkZGJyByeD0nMTAwJyByeT0nMTAwJz48L3JlY3Q+PHBhdGggZmlsbC1ydWxlPSdldmVub2RkJyBjbGlwLXJ1bGU9J2V2ZW5vZGQnIGQ9J00xNTIgNTEyQzE1MiA3MTAuODIzIDMxMy4xNzcgODcyIDUxMiA4NzJDNzEwLjgyMyA4NzIgODcyIDcxMC44MjMgODcyIDUxMkM4NzIgMzEzLjE3NyA3MTAuODIzIDE1MiA1MTIgMTUyQzMxMy4xNzcgMTUyIDE1MiAzMTMuMTc3IDE1MiA1MTJaTTQyMCAzOTZDNDA2Ljc0NSAzOTYgMzk2IDQwNi43NDUgMzk2IDQyMFY2MDRDMzk2IDYxNy4yNTUgNDA2Ljc0NSA2MjggNDIwIDYyOEg2MDRDNjE3LjI1NSA2MjggNjI4IDYxNy4yNTUgNjI4IDYwNFY0MjBDNjI4IDQwNi43NDUgNjE3LjI1NSAzOTYgNjA0IDM5Nkg0MjBaJyBmaWxsPSd3aGl0ZSc+PC9wYXRoPjwvc3ZnPg==",G="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAALZJREFUaEPtmjEOhDAMBNc/O14GvOzys3CAKK6eAlmaVGl2Zc+kTOU685vkc9/bnD2prZK5/TZY24z9P+g4F5hNh7/GdoG37WlAA5CATwgCxHENYISwQAMQII5rACOEBRqAAHFcAxghLNAABIjjGsAIYYEGIEAc1wBGCAs0AAHiuAYwQligAQgQxzWAEcICDUCAOK4BjBAWaAACxHENYISwQAMQII6fBjr+VHkW3+u+tfyxMpJaDgYzYxb/ALZVAAAAAElFTkSuQmCC";let $,J;class Q extends o.EthereumWalletConnector{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:G,id:"com.coinbase.wallet"}}async promptConnection(){c.connectorLogger.debug("Prompting connection via Base Account",{wallet:this.walletClientType});try{await this.importPromise,c.connectorLogger.rpcRequest("eth_requestAccounts",this.walletClientType);let e=await this.proxyProvider.request({method:"eth_requestAccounts"});if(c.connectorLogger.rpcResponse("eth_requestAccounts",this.walletClientType),!e||0===e.length||!e[0])throw new d.PrivyConnectorError("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([e[0]])}catch(e){throw c.connectorLogger.connectionFailed(this.walletClientType,e,{method:"base_account"}),c.formatConnectorError(e)}}constructor(e,t,r,n,i){super("base_account",e,t,r),this.connectorType="base_account",this.walletClientType="base_account",this.displayName="Base",this.setBaseAccountSdk=i,this.proxyProvider=new o.PrivyProxyProvider(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.baseAccountConfig={...n,appChainIds:[t.id].concat(e.map((e=>e.id)))},$?(this.proxyProvider.setWalletProvider($.getProvider()),this.setBaseAccountSdk($)):this.importPromise=import("@base-org/account").then((({createBaseAccountSDK:e})=>{$=e(this.baseAccountConfig),this.proxyProvider.setWalletProvider($.getProvider()),this.setBaseAccountSdk($)})).catch(console.error)}}let X=[1,11155111,137,10,8453,84532,42161,7777777,43114,56];class ee extends o.EthereumWalletConnector{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:Y,id:"com.coinbase.wallet"}}async promptConnection(){c.connectorLogger.debug("Prompting connection via Coinbase Wallet",{wallet:this.walletClientType});try{c.connectorLogger.rpcRequest("eth_requestAccounts",this.walletClientType);let e=await this.proxyProvider.request({method:"eth_requestAccounts"});if(c.connectorLogger.rpcResponse("eth_requestAccounts",this.walletClientType),!e||0===e.length||!e[0])throw new d.PrivyConnectorError("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([e[0]])}catch(e){throw c.connectorLogger.connectionFailed(this.walletClientType,e,{method:"coinbase_wallet"}),c.formatConnectorError(e)}}updateConnectionPreference(e){this.coinbaseWalletConfig={...this.coinbaseWalletConfig,preference:{...this.coinbaseWalletConfig.preference,options:e}},this.walletClientType="smartWalletOnly"===e?"coinbase_smart_wallet":"coinbase_wallet",J=C.createCoinbaseWalletSDK({...this.coinbaseWalletConfig}),this.proxyProvider.setWalletProvider(J.getProvider())}constructor(e,t,n,i){if(super("coinbase_wallet",e,t,n),this.connectorType="coinbase_wallet",this.displayName="Coinbase Wallet",this.proxyProvider=new o.PrivyProxyProvider(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.coinbaseWalletConfig={...i,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"),!J){let e="eoaOnly"!==this.coinbaseWalletConfig.preference?.options?(this.coinbaseWalletConfig.appChainIds??[]).filter((e=>!X.includes(e))):[];e.length>0&&!e.every((e=>r.DEFAULT_SUPPORTED_CHAIN_IDS.has(e)))&&console.info(`The configured chains are not supported by Coinbase Smart Wallet: ${e.join(", ")}`),J=C.createCoinbaseWalletSDK(this.coinbaseWalletConfig)}this.proxyProvider.setWalletProvider(J.getProvider())}}const te=({...t})=>/*#__PURE__*/e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:/*#__PURE__*/e.jsx("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:t.color||"var(--privy-color-foreground-3)"})});class re extends o.EthereumWalletConnector{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:[c.toHex(e?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:te,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}constructor({provider:e,chains:t,defaultChain:r,rpcConfig:n,imported:i,walletIndex:a}){super("privy",t,r,n),this.connectorType="embedded",this.proxyProvider=e,this.walletIndex=a,i&&(this.connectorType="embedded_imported"),this.subscribeListeners()}}async function ne(){let e=Hr();return e?e.getAccessToken():Promise.resolve(c.s.get(h.PRIVY_ACCESS_TOKEN_STORAGE_KEY)||c.s.get(h.CUSTOMER_ACCESS_TOKEN_STORAGE_KEY)||null)}const ie=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4","csw_signUserOperation","secp256k1_sign"];function ae(e){return e?{"privy-ui":"t"}:void 0}class se{async authenticate(){if(!this.api)throw new d.PrivyClientError("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new d.PrivyClientError("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(f.passwordlessAuthenticatePath,{email:this.meta.email,code:this.meta.emailCode,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw d.formatApiError(e)}}async link(){if(!this.api)throw new d.PrivyClientError("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new d.PrivyClientError("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(f.passwordlessLinkPath,{email:this.meta.email,code:this.meta.emailCode})}catch(e){throw d.formatApiError(e)}}async sendCodeEmail({email:e,captchaToken:t,withPrivyUi:r}){if(!this.api)throw new d.PrivyClientError("Auth flow has no API instance");if(e&&(this.meta.email=e),t&&(this.meta.captchaToken=t),!this.meta.email)throw new d.PrivyClientError("Email must be set when initialzing authentication.");let n=ae(r);try{return await this.api.post(f.passwordlessInitPath,{email:this.meta.email,token:this.meta.captchaToken},{headers:{...n}})}catch(e){throw d.formatApiError(e)}}constructor({email:e,captchaToken:t,disableSignup:r}){this.meta={email:e,captchaToken:t,disableSignup:r??!1}}}class oe extends se{async link(){if(!this.api)throw new d.PrivyClientError("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new d.PrivyClientError("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(f.updateEmailPath,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(e){throw d.formatApiError(e)}}constructor(e,t,r){super({email:t,captchaToken:r}),this.meta={email:t,captchaToken:r,oldAddress:e,disableSignup:!1}}}class le{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 ce{get meta(){return this._meta}async authenticate(){if(!this.api)throw new d.PrivyClientError("Auth flow has no API instance");if(!this.meta.channelToken)throw new d.PrivyClientError("Auth flow must be initialized first");try{let e=await this.api.post(f.farcasterAuthenticatePath,{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 d.PrivyClientError("No response from authentication");return e}catch(e){throw d.formatApiError(e)}}async link(){if(!this.api)throw new d.PrivyClientError("Auth flow has no API instance");try{return await this.api.post(f.farcasterLinkPath,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(e){throw d.formatApiError(e)}}async _startChannelOnce(){if(!this.api)throw new d.PrivyClientError("Auth flow has no API instance");let e=await this.api.post(f.farcasterInitPath,{token:this.captchaToken});L.isMobile&&!L.isIOS&&e.connect_uri&&m.openHref(e.connect_uri,"_blank"),this._meta={...this._meta,connectUri:e.connect_uri,channelToken:e.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new d.PrivyClientError("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new d.PrivyClientError("Auth flow has no API instance");if(!this.meta.channelToken)throw new d.PrivyClientError("Auth flow must be initialized first");let e=await this.api.get(f.farcasterStatusPath,{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 le(this._startChannelOnce.bind(this)),this.pollForReady=new le(this._pollForReady.bind(this)),this._meta.disableSignup=t}}function de(){return"undefined"!=typeof window&&"chrome-extension:"===window.location.protocol&&"chrome"in window}function Ce(){if(!de())return;let e=window.chrome;return e?.runtime?.id}function ue(){if(!de())return!1;let e=window.chrome;return"function"==typeof e?.identity?.launchWebAuthFlow}async function he(e){return new Promise(((t,r)=>{ue()?window.chrome.identity.launchWebAuthFlow({url:e,interactive:!0},(async e=>{try{let r=function(){if(!de())return;let e=window.chrome;return e?.runtime?.lastError?.message}();if(r||!e){let e=`WebAuthFlow failed: ${r||"Response URI missing"}`;throw Error(e)}let n=new URL(e),i=Ce();if(!i)throw Error("Invalid extension context");if("chrome-extension:"===n.protocol){if(n.hostname!==i)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]!==i)throw Error("Invalid responseUri origin")}}let a=n.searchParams.get("privy_oauth_state"),s=n.searchParams.get("privy_oauth_code");if(!a||!s)throw Error("Invalid responseUri - missing required parameters");t({privyOAuthState:a,privyOAuthCode:s})}catch(e){r(e)}})):r(Error("Chrome identity API not available"))}))}function pe(e){return crypto.getRandomValues(new Uint8Array(e))}function Le(){return i.base64url.encode(pe(36))}function ye(){return Le()}async function we(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 i.base64url.encode(t)}}class fe{addCaptchaToken(e){this.meta.captchaToken=e}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new d.PrivyClientError("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new d.PrivyClientError("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if("undefined"===this.meta.authorizationCode)throw new d.PrivyClientError("User denied confirmation during OAuth flow");let e=function(){let e=c.s.get(h.CODE_VERIFIER_KEY);if(!e)throw new d.PrivyClientError("Authentication error.");return e}();try{let t=await this.api.post(f.oAuthAuthenticatePath,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:e,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});return c.s.del(h.CODE_VERIFIER_KEY),c.s.del(h.HEADLESS_OAUTH_KEY),c.s.del(h.OAUTH_DISABLE_SIGNUP_KEY),t}catch(e){let t=d.formatApiError(e);if(t.privyErrorCode)throw new d.PrivyClientError(t.message||"Invalid code during OAuth flow.",void 0,t.privyErrorCode);if("User denied confirmation during OAuth flow"===t.message)throw new d.PrivyClientError("Invalid code during oauth flow.",void 0,d.PrivyErrorCode.OAUTH_USER_DENIED);throw new d.PrivyClientError("Invalid code during OAuth flow.",void 0,d.PrivyErrorCode.UNKNOWN_AUTH_ERROR)}}async link(){if(!this.api)throw new d.PrivyClientError("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new d.PrivyClientError("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if("undefined"===this.meta.authorizationCode)throw new d.PrivyClientError("User denied confirmation during OAuth flow");let e=c.s.get(h.CODE_VERIFIER_KEY);if(!e)throw new d.PrivyClientError("Authentication error.");try{let t=await this.api.post(f.oAuthLinkPath,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:e});return c.s.del(h.CODE_VERIFIER_KEY),t}catch(e){throw d.formatApiError(e)}}async getAuthorizationUrl(){if(!this.api)throw new d.PrivyClientError("Auth flow has no API instance");if(!this.meta.provider)throw new d.PrivyClientError("Provider must be set when initializing OAuth authentication.");let e=Le();c.s.put(h.CODE_VERIFIER_KEY,e);let t=ye();c.s.put(h.STATE_CODE_KEY,t);let r=await we(e);this.meta.withPrivyUi||c.s.put(h.HEADLESS_OAUTH_KEY,!0),this.meta.disableSignup?c.s.put(h.OAUTH_DISABLE_SIGNUP_KEY,!0):c.s.del(h.OAUTH_DISABLE_SIGNUP_KEY);let n=ae(this.meta.withPrivyUi),i=window.location.href,a=function(){let e=Ce();if(e)return`https://${e}.chromiumapp.org`}();a&&(i=a);try{return await this.api.post(f.oAuthInitPath,{provider:this.meta.provider,redirect_to:this.meta.customOAuthRedirectUrl||i,token:this.meta.captchaToken,code_challenge:r,state_code:t},{headers:{...n}})}catch(e){throw d.formatApiError(e)}}constructor(e){this.meta=e}}function me(){let e=new URLSearchParams(window.location.search),t=e.get("privy_oauth_code"),r=e.get("privy_oauth_state"),n=e.get("privy_oauth_provider");if(!t||!r||!n)return{inProgress:!1};let i=!1;try{i=!!window.opener.location.origin}catch{}return{inProgress:!0,authorizationCode:t,stateCode:r,provider:n,withPrivyUi:!c.s.get(h.HEADLESS_OAUTH_KEY),popupFlow:null!==window.opener&&i,disableSignup:!!c.s.get(h.OAUTH_DISABLE_SIGNUP_KEY)}}function ge(){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"),c.s.del(h.STATE_CODE_KEY),window.history.replaceState({},"",e)}class ve{async initRegisterFlow(e){if(!this.api)throw new d.PrivyClientError("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 d.PrivyClientError("Auth flow has no API instance");this.authenticateForRegistration=!1,this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute(e)}async initLinkFlow(){if(!this.api)throw new d.PrivyClientError("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 d.PrivyClientError("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new d.PrivyClientError("WebAuthn is not supported in this browser");this.meta.initRegisterResponse||(this.meta.initRegisterResponse=await this.initRegisterOnce.execute());try{let t=this.meta.initRegisterResponse.options,r=await e.startRegistration({optionsJSON:this._transformInitLinkOptionsToCamelCase(t)});return this.meta.setPasskeyAuthState?.({status:"submitting-response"}),await this.api.post(f.passkeyRegisterPath,{relying_party:this.meta.initRegisterResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(r)})}catch(e){if("NotAllowedError"===e.name)throw new d.PrivyClientError("Passkey request timed out or rejected by user.",void 0,d.PrivyErrorCode.PASSKEY_NOT_ALLOWED);throw d.formatApiError(e)}}async authenticate(){if(this.authenticateForRegistration)return this.register();let e=await import("@simplewebauthn/browser");if(!this.api)throw new d.PrivyClientError("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new d.PrivyClientError("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 r=await e.startAuthentication({optionsJSON:this._transformInitAuthenticateOptionsToCamelCase({...this.meta.initAuthenticateResponse.options,allow_credentials:t})});return this.meta.setPasskeyAuthState?.({status:"submitting-response"}),await this.api.post(f.passkeyAuthenticatePath,{relying_party:this.meta.initAuthenticateResponse.relying_party,challenge:this.meta.initAuthenticateResponse.options.challenge,authenticator_response:this._transformAuthenticationResponseToSnakeCase(r)})}catch(e){if("NotAllowedError"===e.name)throw new d.PrivyClientError("Passkey request timed out or rejected by user.",void 0,d.PrivyErrorCode.PASSKEY_NOT_ALLOWED);throw d.formatApiError(e)}}async link(){let e=await import("@simplewebauthn/browser");if(!this.api)throw new d.PrivyClientError("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new d.PrivyClientError("WebAuthn is not supported in this browser");this.meta.initLinkResponse||(this.meta.initLinkResponse=await this.initLinkOnce.execute());try{let t=this.meta.initLinkResponse.options,r=await e.startRegistration({optionsJSON:this._transformInitLinkOptionsToCamelCase(t)});return this.meta.setPasskeyAuthState?.({status:"submitting-response"}),await this.api.post(f.passkeyLinkPath,{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(r)})}catch(e){if("NotAllowedError"===e.name)throw new d.PrivyClientError("Passkey request timed out or rejected by user.",void 0,d.PrivyErrorCode.PASSKEY_NOT_ALLOWED);throw d.formatApiError(e)}}async _initRegisterOnce(e){if(!this.api)throw new d.PrivyClientError("Auth flow has no API instance");let t=ae(e);return await this.api.post(f.passkeyInitRegisterPath,{token:this.meta.captchaToken},{headers:{...t}})}async _initAuthenticateOnce(e){if(!this.api)throw new d.PrivyClientError("Auth flow has no API instance");let t=ae(e);return await this.api.post(f.passkeyInitAuthenticatePath,{token:this.meta.captchaToken},{headers:{...t}})}async _initLinkOnce(){if(!this.api)throw new d.PrivyClientError("Auth flow has no API instance");return await this.api.post(f.passkeyInitLinkPath,{})}_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:r}){this.authenticateForRegistration=!1,this.initRegisterOnce=new le(this._initRegisterOnce.bind(this)),this.initAuthenticateOnce=new le(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new le(this._initLinkOnce.bind(this)),this.meta={captchaToken:e,setPasskeyAuthState:t,hints:r}}}const Ee=({address:e,chainId:t,nonce:r})=>`${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: ${r}\nIssued At: ${(new Date).toISOString()}\nResources:\n- https://privy.io`;class Ae{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 d.PrivyClientError("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 d.PrivyClientError("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 d.formatApiError(e)}}async link(){if(!this.client)throw new d.PrivyClientError("SiweFlow has no client instance");try{if(!this.wallet)throw new d.PrivyClientError("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 d.formatApiError(e)}}async sign(){if(!this.client)throw new d.PrivyClientError("SiweFlow has no client instance");if(await this.buildMessage(),!this.preparedMessage)throw new d.PrivyClientError("Could not prepare SIWE message");if(!this.wallet)throw new d.PrivyClientError("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 d.PrivyClientError("SiweFlow has no client instance");if(!this.wallet)throw new d.PrivyClientError("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 d.PrivyClientError("SiweFlow has no client instance");if(!this.wallet)throw new d.PrivyClientError("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=Ee({address:e,chainId:t,nonce:this.nonce}),this.preparedMessage}constructor(e,t,r,n=!1,i){this._meta={disableSignup:!1},this.getNonceOnce=new le(this._getNonceOnce.bind(this)),this.wallet=t,this.captchaToken=r,this.client=e,this._meta.disableSignup=n,this.preparedMessage=i?.message,this.signature=i?.signature,this.walletClientType=i?.walletClientType,this.connectorType=i?.connectorType}}class Pe{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 d.PrivyClientError("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 d.formatApiError(e)}}async link(){if(!this.client)throw new d.PrivyClientError("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 d.formatApiError(e)}}async sign(){let e,t;if(!this.client)throw new d.PrivyClientError("SiwsFlow has no client instance");await this.buildMessage();let r="transaction"===this.meta.messageType;if(!this.preparedMessage)throw new d.PrivyClientError("Could not prepare SIWS message");if(!r&&!this.wallet.provider.signMessage||r&&!this.wallet.provider.signTransaction)throw new d.PrivyClientError("Wallet does not support the necessary signing methods");if(r&&this._plugin){let r=await this.wallet.provider.signTransaction({transaction:g.base64.decode(this.preparedMessage)});e=g.base64.encode(r.signedTransaction),t=this._plugin.getSignatureFromTransaction(r.signedTransaction,this.wallet.address)}else{e=this.preparedMessage;let r=await this.wallet.provider.signMessage({message:(new TextEncoder).encode(this.preparedMessage)});t=g.base64.encode(r.signature)}return{message:e,signature:t}}async _getNonceOnce(){if(!this.client)throw new d.PrivyClientError("SiwsFlow has no client instance");return await this.client.generateSiwsNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildMessage(){if(!this.client)throw new d.PrivyClientError("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=m.prepareSiwsMessageWithNonce({address:e,nonce:this.nonce}),this.preparedMessage}constructor(e,t,r,n=!1,i="plain",a){this._meta={disableSignup:!1,messageType:"plain"},this.getNonceOnce=new le(this._getNonceOnce.bind(this)),this.wallet=e,this.captchaToken=r,this.client=t,this._meta.disableSignup=n,this._meta.messageType=i,this._plugin=a}}class Me{async authenticate(){if(!this.api)throw new d.PrivyClientError("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new d.PrivyClientError("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(f.passwordlessSmsAuthenticatePath,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw d.formatApiError(e)}}async link(){if(!this.api)throw new d.PrivyClientError("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new d.PrivyClientError("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(f.passwordlessSmsLinkPath,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(e){throw d.formatApiError(e)}}async sendSmsCode({phoneNumber:e,captchaToken:t,withPrivyUi:r}){if(!this.api)throw new d.PrivyClientError("Auth flow has no API instance");if(e&&(this.meta.phoneNumber=e),t&&(this.meta.captchaToken=t),!this.meta.phoneNumber)throw new d.PrivyClientError("phone nNumber must be set when initialzing authentication.");let n=ae(r);try{return await this.api.post(f.passwordlessSmsInitPath,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken},{headers:{...n}})}catch(e){throw d.formatApiError(e)}}constructor({phoneNumber:e,captchaToken:t,disableSignup:r}){this.meta={phoneNumber:e,captchaToken:t,disableSignup:r??!1}}}class ke extends Me{async link(){if(!this.api)throw new d.PrivyClientError("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode||!this.meta.oldPhoneNumber)throw new d.PrivyClientError("Phone number, sms code, and an old phone number must be set prior to calling update.");try{return await this.api.post(f.updatePhonePath,{old_phone_number:this.meta.oldPhoneNumber,new_phone_number:this.meta.phoneNumber,code:this.meta.smsCode})}catch(e){throw d.formatApiError(e)}}constructor(e,t,r){super({phoneNumber:t,captchaToken:r}),this.meta={phoneNumber:t,captchaToken:r,oldPhoneNumber:e,disableSignup:!1}}}const xe=/*#__PURE__*/t.createContext({enabled:!1,siteKey:"",provider:void 0,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:d.notImplemented,setError:d.notImplemented,setExecuting:d.notImplemented,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:d.noop,reset:d.notImplemented,execute:d.notImplemented});class Te extends d.PrivyError{constructor(e,t,r){super(e||"Captcha failed"),this.type="Captcha",t instanceof Error&&(this.cause=t),this.privyErrorCode=r}}const _e=({children:r,appId:n,captchaSiteKey:i,enabledCaptchaProvider:a})=>{let s=t.useRef(null),o=t.useRef(null),[l,C]=t.useState(),[u,h]=t.useState(),[p,L]=t.useState(!1),y=t.useMemo((()=>a?p||l||u?!p||l||u?l&&!u?{status:"success",token:l}:u?{status:"error",error:u}:{status:"ready"}:{status:"loading"}:{status:"ready"}:{status:"disabled"}),[a,l,u,p]),w=t.useMemo((()=>a?"turnstile"===a?{remove:()=>{s.current?.remove(),L(!1),h(void 0),C(void 0)},reset:()=>{s.current?.reset(),L(!1),h(void 0),C(void 0)},execute:()=>{L(!0),s.current?.execute()},waitForResult:async()=>{try{return await c.pollForResult((()=>s.current?.getResponse()),{interval:200,timeout:2e4})}catch(e){throw new Te("Captcha failed",null,d.PrivyErrorCode.CAPTCHA_TIMEOUT)}}}:{remove:()=>{o.current?.removeCaptcha(),L(!1),h(void 0),C(void 0)},reset:()=>{o.current?.resetCaptcha(),L(!1),h(void 0),C(void 0)},execute:()=>{L(!0),o.current?.execute()},waitForResult:async()=>{try{return await c.pollForResult((()=>{let e=o.current?.getResponse();if(e)return e}),{interval:200,timeout:2e4})}catch(e){throw new Te("Captcha failed",null,d.PrivyErrorCode.CAPTCHA_TIMEOUT)}}}:null),[a]),f=t.useMemo((()=>{if(!a||!w)return{...y,enabled:!1,siteKey:"",appId:n,setToken:d.notImplemented,setError:d.notImplemented,setExecuting:d.notImplemented,waitForResult:()=>Promise.resolve(void 0),remove:d.noop,reset:d.notImplemented,execute:d.notImplemented,provider:void 0,ref:{current:null}};let e={...y,enabled:!0,appId:n,setToken:C,setError:h,setExecuting:L};return"turnstile"===a?{...e,provider:"turnstile",ref:s,siteKey:i.split("t:")[1]??"",...w}:{...e,provider:"hcaptcha",ref:o,siteKey:i.split("h:")[1]??"",...w}}),[y,a,w,n,i]);/*#__PURE__*/return e.jsx(xe.Provider,{value:f,children:r})},Se=()=>t.useContext(xe);async function be(e){if(e.enabled){if("error"===e.status)throw new Te(e.error,null,d.PrivyErrorCode.CAPTCHA_FAILURE);return"success"===e.status?e.token:(e.execute(),await e.waitForResult())}}class Ie{async authenticate(){if(!this.api)throw new d.PrivyClientError("Auth flow has no API instance");try{return await this.api.post(f.telegramAccountAuthenticatePath,{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 d.formatApiError(e)}}async link(){if(!this.api)throw new d.PrivyClientError("Auth flow has no API instance");try{return await this.api.post(f.telegramAccountLinkPath,{telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData})}catch(e){throw d.formatApiError(e)}}constructor(e,t=!1){this.meta={disableSignup:!1},this.meta={captchaToken:e,disableSignup:!1},this.meta.disableSignup=t}}function Ze(e){return Object.fromEntries(decodeURIComponent(e).split("&").map((e=>e.split("=").map(decodeURIComponent))))}function je(){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 We=/*#__PURE__*/t.lazy((()=>Promise.resolve().then((function(){return require("./TurnstileWrapper-qLN0G5m7.js")})))),Fe=/*#__PURE__*/t.lazy((()=>Promise.resolve().then((function(){return require("./HCaptchaWrapper-CxqJE5RH.js")}))));const Ue=r=>{let n=Se();return t.useEffect((()=>n.remove),[n.remove]),n.enabled&&n.provider?/*#__PURE__*/e.jsx(t.Suspense,{fallback:null,children:/*#__PURE__*/e.jsxs("div",{className:"hidden h-0 w-0",children:["turnstile"===n.provider&&/*#__PURE__*/e.jsx(We,{...r,captchaContext:n}),"hcaptcha"===n.provider&&/*#__PURE__*/e.jsx(Fe,{...r,captchaContext:n})]})}):null};var Re=/*#__PURE__*/Object.freeze({__proto__:null,AccountNotFoundScreen:()=>Promise.resolve().then((function(){return require("./AccountNotFoundScreen-B3YeQpWL.js")})),AffirmativeConsentScreen:()=>Promise.resolve().then((function(){return require("./AffirmativeConsentScreen-BxXaVIHv.js")})),AllowlistRejectionScreen:()=>Promise.resolve().then((function(){return require("./AllowlistRejectionScreen-BD_J-XYk.js")})),AuthenticateWithWalletScreen:()=>Promise.resolve().then((function(){return require("./AuthenticateWithWalletScreen-Cq6uIAU2.js")})),AwaitingEvmToSolBridgingScreen:()=>Promise.resolve().then((function(){return require("./AwaitingEvmToSolBridgingScreen-4-zu3acA.js")})),AwaitingExternalEthereumTransferScreen:()=>Promise.resolve().then((function(){return require("./AwaitingExternalEthereumTransferScreen-D29PTwhu.js")})),AwaitingPasswordlessCodeScreen:()=>Promise.resolve().then((function(){return require("./AwaitingPasswordlessCodeScreen-C1mky_bR.js")})),AwaitingSolToEvmBridgingScreen:()=>Promise.resolve().then((function(){return require("./AwaitingSolToEvmBridgingScreen-C8F1Te8E.js")})),CaptchaScreen:()=>Promise.resolve().then((function(){return require("./CaptchaScreen-DBhEtYLQ.js")})),CoinbaseOnrampStatusScreen:()=>Promise.resolve().then((function(){return require("./CoinbaseOnrampStatusScreen-Dfnox1A2.js")})),ConnectLedgerScreen:()=>Promise.resolve().then((function(){return require("./ConnectLedgerScreen-C65stJPS.js")})),ConnectOnlyLandingScreen:()=>Promise.resolve().then((function(){return require("./ConnectOnlyLandingScreen-CtEavMfn.js")})),ConnectOnlyStatusScreen:()=>Promise.resolve().then((function(){return require("./ConnectOnlyStatusScreen-_MF8WNxi.js")})),ConnectOrCreateScreen:()=>Promise.resolve().then((function(){return require("./ConnectOrCreateScreen-Dio0_2A7.js")})),ConnectionStatusScreen:()=>Promise.resolve().then((function(){return require("./ConnectionStatusScreen-D2KorLaB.js")})),CrossAppAuthScreen:()=>Promise.resolve().then((function(){return require("./CrossAppAuthScreen-Hg4b16x6.js")})),DelegatedActionsConsentScreen:()=>Promise.resolve().then((function(){return require("./DelegatedActionsConsentScreen-Sexxy676.js")})),DelegatedActionsRevokeScreen:()=>Promise.resolve().then((function(){return require("./DelegatedActionsRevokeScreen-3ghpT6XE.js")})),EmbeddedWalletConnectingScreen:()=>Promise.resolve().then((function(){return require("./EmbeddedWalletConnectingScreen-Br1aDNP5.js")})),EmbeddedWalletCreatedScreen:()=>Promise.resolve().then((function(){return require("./EmbeddedWalletCreatedScreen-BpEQig7I.js")})),EmbeddedWalletKeyExportScreen:()=>Promise.resolve().then((function(){return require("./EmbeddedWalletKeyExportScreen-DiMRj8ux.js")})),EmbeddedWalletOnAccountCreateScreen:()=>Promise.resolve().then((function(){return require("./EmbeddedWalletOnAccountCreateScreen-DjbrcMWa.js")})),EmbeddedWalletPasswordCreateScreen:()=>Promise.resolve().then((function(){return require("./RecoveryPasswordCreateScreen-CFg7-HMy.js")})),EmbeddedWalletPasswordUpdateScreen:()=>Promise.resolve().then((function(){return require("./EmbeddedWalletPasswordUpdateScreen-BakLaUGz.js")})),EmbeddedWalletPasswordUpdateSplashScreen:()=>Promise.resolve().then((function(){return require("./EmbeddedWalletPasswordUpdateSplashScreen-sIrTUqTo.js")})),ErrorScreen:()=>Promise.resolve().then((function(){return require("./ErrorScreen-CL31INic.js")})),FarcasterConnectStatusScreen:()=>Promise.resolve().then((function(){return require("./FarcasterConnectStatusScreen-VcZ3BOP9.js")})),FarcasterSignerStatusScreen:()=>Promise.resolve().then((function(){return require("./FarcasterSignerStatusScreen-CZMxSZ2B.js")})),FiatOnrampScreen:()=>Promise.resolve().then((function(){return require("./FiatOnrampScreen-BWE-wzus.js")})),FundSolWalletWithExternalSolanaWallet:()=>Promise.resolve().then((function(){return require("./FundSolWalletWithExternalSolanaWallet-e1pL6w1L.js")})),FundWithBankDepositScreen:()=>Promise.resolve().then((function(){return require("./FundWithBankDepositScreen-HfVq1zvk.js")})),FundingAmountEditScreen:()=>Promise.resolve().then((function(){return require("./FundingEditAmountScreen-CIOt-oGd.js")})),FundingMethodSelectionScreen:()=>Promise.resolve().then((function(){return require("./FundingMethodSelectionScreen-BGeCpJBJ.js")})),InAppBrowserLoginNotPossible:()=>Promise.resolve().then((function(){return require("./InAppBrowserLoginNotPossible-CywcWPkZ.js")})),InstallWalletScreen:()=>Promise.resolve().then((function(){return require("./InstallWalletScreen-JfaInrUT.js")})),LandingScreen:()=>Promise.resolve().then((function(){return require("./LandingScreen-CfjeYypD.js")})),LinkConflictScreen:()=>Promise.resolve().then((function(){return require("./LinkConflictScreen-BsgVq6Bs.js")})),LinkEmailScreen:()=>Promise.resolve().then((function(){return require("./LinkEmailScreen-DFTW39Tg.js")})),LinkPasskeyScreen:()=>Promise.resolve().then((function(){return require("./LinkPasskeyScreen-D9Y8PpKL.js")})),LinkPhoneScreen:()=>Promise.resolve().then((function(){return require("./LinkPhoneScreen-C2upPfpV.js")})),LoginFailedScreen:()=>Promise.resolve().then((function(){return require("./LoginFailedScreen-BIu3aXER.js")})),ManualTransferScreen:()=>Promise.resolve().then((function(){return require("./ManualTransferScreen-CV6De31D.js")})),MfaAuthEnrollmentFlowScreen:()=>Promise.resolve().then((function(){return require("./MfaAuthEnrollmentFlowScreen-BWPXMD7y.js")})),MfaAuthVerifyFlowScreen:()=>Promise.resolve().then((function(){return require("./MfaAuthVerifyFlowScreen-BUmI5UD9.js")})),MfaEnrollmentFlowScreen:()=>Promise.resolve().then((function(){return require("./MfaEnrollmentFlowScreen-DtN8H9mT.js")})),MoonpayStatusScreen:()=>Promise.resolve().then((function(){return require("./MoonpayStatusScreen-w3skMb5T.js")})),OAuthStatusScreen:()=>Promise.resolve().then((function(){return require("./OAuthStatusScreen-G1IaSk2E.js")})),PasskeySelectSignupOrLogin:()=>Promise.resolve().then((function(){return require("./PasskeySelectSignupOrLogin-BsYJUF4P.js")})),PasskeyStatusScreen:()=>Promise.resolve().then((function(){return require("./PasskeyStatusScreen-hu8v0vH3.js")})),PasswordRecoveryScreen:()=>Promise.resolve().then((function(){return require("./PasswordRecoveryScreen-C0fjY1Ij.js")})),RecoveryOAuthScreen:()=>Promise.resolve().then((function(){return require("./RecoveryOAuthStatusScreen-Bv2UEdKD.js")})),RecoverySelectionScreen:()=>Promise.resolve().then((function(){return require("./RecoverySelectionScreen-5crBwkcF.js")})),SendTransactionScreen:()=>Promise.resolve().then((function(){return require("./index-DrQAmIx6.js")})),SetAutomaticRecoveryScreen:()=>Promise.resolve().then((function(){return require("./SetAutomaticRecoveryScreen-CYXvomBY.js")})),SignRequestScreen:()=>Promise.resolve().then((function(){return require("./SignRequestScreen-BfqKiJ9G.js")})),StandardSignAndSendTransactionScreen:()=>Promise.resolve().then((function(){return require("./StandardSignAndSendTransactionScreen-BM1NyC8e.js")})),TelegramAuthScreen:()=>Promise.resolve().then((function(){return require("./TelegramAuthScreen-D1eqNUPF.js")})),TransferFromWalletScreen:()=>Promise.resolve().then((function(){return require("./TransferFromWalletScreen-BItctfpp.js")})),UpdateEmailScreen:()=>Promise.resolve().then((function(){return require("./UpdateEmailScreen-BvoRUAa3.js")})),UpdatePhoneScreen:()=>Promise.resolve().then((function(){return require("./UpdatePhoneScreen-a-ISQK3q.js")})),UserLimitReachedScreen:()=>Promise.resolve().then((function(){return require("./UserLimitReachedScreen-twyMZzVF.js")})),WalletInterstitialScreen:()=>Promise.resolve().then((function(){return require("./WalletInterstitialScreen-D0fMvmub.js")}))});function Oe(e){E.usePrivyEventSubscription("configureMfa",e)}const Ne=A.create((()=>({inProgressMfaFlow:void 0})));const He=v.createGlobalStyle`
:root {
${e=>De(e.palette)}
};
`;const De=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","--priv