@privy-io/react-auth 2.24.0 → 2.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/abstract-smart-wallets.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/privy-provider-zm0SWrLy.js +34 -0
- package/dist/cjs/{smart-wallets-TcsJ7a-J.js → smart-wallets-DO-QDpuC.js} +1 -1
- package/dist/cjs/smart-wallets.js +1 -1
- package/dist/cjs/solana.js +2 -1
- package/dist/cjs/ui.js +1 -1
- package/dist/cjs/{useActiveWallet-CGbGRerk.js → useActiveWallet-DDZXLk7d.js} +1 -1
- package/dist/cjs/useFundWallet-C9bw6h3P.js +1 -0
- package/dist/dts/extended-chains.d.mts +1 -1
- package/dist/dts/extended-chains.d.ts +1 -1
- package/dist/dts/farcaster.d.mts +1 -1
- package/dist/dts/farcaster.d.ts +1 -1
- package/dist/dts/index.d.mts +27 -5
- package/dist/dts/index.d.ts +27 -5
- package/dist/dts/smart-wallets.d.mts +1 -1
- package/dist/dts/smart-wallets.d.ts +1 -1
- package/dist/dts/solana.d.mts +12 -5
- package/dist/dts/solana.d.ts +12 -5
- package/dist/dts/{types-zpHmPFW8.d.mts → types-B_DvyjIb.d.mts} +34 -3
- package/dist/dts/{types-zpHmPFW8.d.ts → types-B_DvyjIb.d.ts} +34 -3
- package/dist/dts/ui.d.mts +1 -1
- package/dist/dts/ui.d.ts +1 -1
- package/dist/dts/{useSolanaWallets-Bnyf2wo3.d.mts → useSolanaWallets-EdHHRSMB.d.mts} +1 -1
- package/dist/dts/{useSolanaWallets-Bnyf2wo3.d.ts → useSolanaWallets-EdHHRSMB.d.ts} +1 -1
- package/dist/esm/abstract-smart-wallets.mjs +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/privy-provider-BG8GtKO6.mjs +31 -0
- package/dist/esm/{smart-wallets-Dyw1Yps1.mjs → smart-wallets-CYfnJBkN.mjs} +1 -1
- package/dist/esm/smart-wallets.mjs +1 -1
- package/dist/esm/solana.mjs +1 -1
- package/dist/esm/ui.mjs +1 -1
- package/dist/esm/useActiveWallet-BGo6de6R.mjs +1 -0
- package/dist/esm/useFundWallet-Dx-BELh-.mjs +1 -0
- package/package.json +16 -7
- package/dist/cjs/privy-provider-Cc-fBpNe.js +0 -34
- package/dist/cjs/useFundWallet-aHyY2NF8.js +0 -1
- package/dist/esm/privy-provider-C-OGn-Rn.mjs +0 -31
- package/dist/esm/useActiveWallet-Bj6Y6Ioo.mjs +0 -1
- package/dist/esm/useFundWallet-Co5a-0jh.mjs +0 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{createStore as r}from"mipd";import a,{useRef as i,useState as o,useMemo as s,useContext as l,createContext as c,useEffect as d,useCallback as u,useReducer as p,forwardRef as h}from"react";import*as m from"react-device-detect";import{isMobile as g,isIOS as y,isSafari as f,isAndroid as w}from"react-device-detect";import{getAddress as v,toHex as C,isAddress as b,isHex as k}from"viem/utils";import A,{ProviderErrors as T,DEFAULT_SUPPORTED_CHAIN_IDS as x,rpc as I,dedupeSupportedChains as E,DEFAULT_SUPPORTED_CHAINS as S,mainnet as _,addToDefaultChains as N,create as M,countryCodesAndNumbers as W,validatePhoneNumber as P,phoneNumberTypingFormatter as U,getPlaceholderPhoneNumber as F,getCountryCallingCode as O,getPhoneCountryCodeAndNumber as L,formatPhoneNumber as R,toObjectKeys as D,UsdcAddressMap as B,arbitrum as z,avalanche as H,base as V,celo as $,linea as j,optimism as q,polygon as K,zora as G,formatWalletAddress as Z,SolanaUsdcAddressMap as Y,toCoinbaseAssetId as Q,getCoinbaseOnRampUrl as X,chainToMoonpayCurrency as J,isSupportedChainIdForMoonpay as ee,isSupportedChainIdForCoinbaseOnramp as te,sepolia as ne,optimismSepolia as re,polygonAmoy as ae,baseSepolia as ie,avalancheFuji as oe,arbitrumSepolia as se,formatTokenAmount as le,SolanaClient as ce,formatWeiAmount as de,getJsonRpcEndpointFromChain as ue,lastFourDigits as pe}from"@privy-io/js-sdk-core";import{P as he,p as me,f as ge,b as ye,c as fe,u as we,d as ve,e as Ce,g as be,h as ke,o as Ae,a as Te,i as xe,j as Ie,k as Ee,l as Se,m as _e,n as Ne,q as Me,r as We,s as Pe,t as Ue,v as Fe,w as Oe,x as Le,y as Re,z as De,A as Be,B as ze,C as He,D as Ve,E as $e,F as je,G as qe,H as Ke,I as Ge,J as Ze,K as Ye,L as Qe,M as Xe,N as Je,O as et,Q as tt,R as nt,S as rt,T as at,U as it,V as ot,W as st,X as lt,Y as ct,Z as dt,_ as ut,$ as pt,a0 as ht,a1 as mt,a2 as gt,a3 as yt,a4 as ft,a5 as wt,a6 as vt,a7 as Ct,a8 as bt,a9 as kt,aa as At,ab as Tt,ac as xt,ad as It,ae as Et,af as St,ag as _t,ah as Nt,ai as Mt,aj as Wt}from"./paths-DCwuPDUk.mjs";import{a as Pt,n as Ut,u as Ft,I as Ot}from"./internal-context-qdNgTV5f.mjs";import{createPublicClient as Lt,http as Rt,formatEther as Dt,formatUnits as Bt,toHex as zt,isHex as Ht,getAddress as Vt,parseEther as $t,createWalletClient as jt,custom as qt,publicActions as Kt,encodeFunctionData as Gt,isAddress as Zt,hexToString as Yt,decodeFunctionData as Qt,decodeAbiParameters as Xt}from"viem";import{v4 as Jt}from"uuid";import*as en from"jose";import{base64url as tn}from"jose";import{e as nn,c as rn,i as an,u as on,P as sn,j as ln,g as cn,b as dn,d as un,k as pn,a as hn,f as mn,l as gn,m as yn}from"./use-sign-with-user-signer-CpL9I6iB.mjs";import fn from"eventemitter3";import{createCoinbaseWalletSDK as wn}from"@coinbase/wallet-sdk";import{toViemTransactionSerializable as vn,STRING_TO_NUMBER_TXN_TYPE as Cn}from"@privy-io/ethereum";import{Turnstile as bn}from"@marsidev/react-turnstile";import{styled as kn,css as An,createGlobalStyle as Tn,keyframes as xn}from"styled-components";import In from"tinycolor2";import En from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import Sn from"@heroicons/react/24/outline/FingerPrintIcon";import _n from"@heroicons/react/24/outline/PhoneIcon";import Nn from"@heroicons/react/24/outline/ShieldCheckIcon";import Mn from"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import Wn from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import Pn from"@heroicons/react/24/outline/XMarkIcon";import Un from"@heroicons/react/24/outline/CalendarIcon";import Fn from"@heroicons/react/24/outline/ExclamationTriangleIcon";import On from"@heroicons/react/24/outline/ChevronDownIcon";import{create as Ln}from"zustand";import{Transition as Rn,Dialog as Dn,TransitionChild as Bn,DialogPanel as zn,Menu as Hn,MenuButton as Vn,MenuItems as $n,MenuItem as jn}from"@headlessui/react";import{Check as qn,Copy as Kn,CheckCircle as Gn,HelpCircle as Zn,AlertTriangle as Yn,Phone as Qn,Lock as Xn,XCircle as Jn,FileCheck as er,ExternalLink as tr,ArrowRightLeft as nr,FingerprintIcon as rr,Smartphone as ar,Wallet as ir,UserCircle as or,Mail as sr,X as lr,Trash2 as cr,Edit as dr,AlertCircle as ur,CloudUpload as pr,Ban as hr}from"lucide-react";import{EthereumProvider as mr,OPTIONAL_EVENTS as gr,OPTIONAL_METHODS as yr}from"@walletconnect/ethereum-provider";import fr from"fast-password-entropy";import*as wr from"secure-password-utilities";import{DEFAULT_WORDLIST as vr}from"secure-password-utilities/wordlists";import Cr from"@heroicons/react/24/outline/UserCircleIcon";import br from"@heroicons/react/20/solid/CheckIcon";import kr from"@heroicons/react/24/outline/EnvelopeIcon";import Ar from"@heroicons/react/24/outline/WalletIcon";import Tr from"@heroicons/react/24/outline/ExclamationCircleIcon";import xr from"@heroicons/react/24/outline/Square2StackIcon";import{MagnifyingGlassIcon as Ir,BoltIcon as Er,ChevronDownIcon as Sr,ArrowRightIcon as _r}from"@heroicons/react/24/outline";import{useVirtualizer as Nr}from"@tanstack/react-virtual";import Mr from"@heroicons/react/24/outline/CheckIcon";import Wr from"qrcode";import Pr from"@heroicons/react/24/outline/LockClosedIcon";import Ur from"@heroicons/react/24/outline/PencilSquareIcon";import Fr from"@heroicons/react/24/outline/ArrowPathIcon";import Or from"@heroicons/react/24/outline/EyeIcon";import Lr from"@heroicons/react/24/outline/EyeSlashIcon";import Rr from"@heroicons/react/24/outline/KeyIcon";import Dr from"@heroicons/react/24/solid/CheckCircleIcon";import Br from"@heroicons/react/24/outline/ArrowDownTrayIcon";import zr from"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import Hr from"@heroicons/react/24/outline/DocumentDuplicateIcon";import Vr from"@heroicons/react/24/solid/XCircleIcon";import $r from"@heroicons/react/24/outline/CheckCircleIcon";import jr from"@heroicons/react/24/outline/InformationCircleIcon";import qr from"@heroicons/react/24/outline/CreditCardIcon";import Kr from"@heroicons/react/24/outline/QrCodeIcon";import Gr from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import Zr from"@heroicons/react/24/outline/GlobeAltIcon";import{ofetch as Yr}from"ofetch";import Qr from"@heroicons/react/24/outline/ClipboardDocumentIcon";import Xr from"@heroicons/react/24/solid/CheckBadgeIcon";import Jr from"@heroicons/react/24/solid/IdentificationIcon";import ea from"@heroicons/react/24/outline/ChevronRightIcon";import ta from"@heroicons/react/24/outline/MinusCircleIcon";import na from"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import ra from"@heroicons/react/24/outline/ClockIcon";import aa from"@heroicons/react/24/solid/ShieldCheckIcon";import ia from"js-cookie";function oa(e){return e?{"privy-ui":"t"}:void 0}class sa{async authenticate(){if(!this.api)throw new he("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new he("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(me,{email:this.meta.email,code:this.meta.emailCode,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw ge(e)}}async link(){if(!this.api)throw new he("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new he("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(ye,{email:this.meta.email,code:this.meta.emailCode})}catch(e){throw ge(e)}}async sendCodeEmail({email:e,captchaToken:t,withPrivyUi:n}){if(!this.api)throw new he("Auth flow has no API instance");if(e&&(this.meta.email=e),t&&(this.meta.captchaToken=t),!this.meta.email)throw new he("Email must be set when initialzing authentication.");let r=oa(n);try{return await this.api.post(fe,{email:this.meta.email,token:this.meta.captchaToken},{headers:{...r}})}catch(e){throw ge(e)}}constructor({email:e,captchaToken:t,disableSignup:n}){this.meta={email:e,captchaToken:t,disableSignup:n??!1}}}class la extends sa{async link(){if(!this.api)throw new he("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new he("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(we,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(e){throw ge(e)}}constructor(e,t,n){super({email:t,captchaToken:n}),this.meta={email:t,captchaToken:n,oldAddress:e,disableSignup:!1}}}class ca{get(e){let t=localStorage.getItem(e);return null===t?void 0:JSON.parse(t)}put(e,t){void 0!==t?localStorage.setItem(e,JSON.stringify(t)):this.del(e)}del(e){localStorage.removeItem(e)}getKeys(){return Object.entries(localStorage).map((([e])=>e))}}function da(){try{let e="privy:__session_storage__test",t=new ca;return t.put(e,"blobby"),t.del(e),!0}catch(e){return!1}}var ua="undefined"!=typeof window&&window.localStorage?new ca:new class{get(e){return this._cache[e]}put(e,t){void 0!==t?this._cache[e]=t:this.del(e)}del(e){delete this._cache[e]}getKeys(){return Object.keys(this._cache)}constructor(){this._cache={}}};function pa(e){return{name:e.metadata?.shortName||e.name||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function ha(e,t){let n=pa(t);if(n.universalLink)return fa(n.universalLink,e)}let ma="WALLETCONNECT_DEEPLINK_CHOICE";function ga(e){return e.startsWith("http://")||e.startsWith("https://")}function ya(e,t){if(ga(e))return fa(e,t);let n=e;return n.includes("://")||(n=e.replaceAll("/","").replaceAll(":",""),n=`${n}://`),n.endsWith("/")||(n=`${n}/`),{redirect:`${n}wc?uri=${encodeURIComponent(t)}`,href:n}}function fa(e,t){if(!ga(e))return ya(e,t);let n=e;return n.endsWith("/")||(n=`${n}/`),{redirect:`${n}wc?uri=${encodeURIComponent(t)}`,href:n}}function wa(e,t){window.open(e,t,"noreferrer noopener")}class va{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 Ca{get meta(){return this._meta}async authenticate(){if(!this.api)throw new he("Auth flow has no API instance");if(!this.meta.channelToken)throw new he("Auth flow must be initialized first");try{let e=await this.api.post(ve,{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 he("No response from authentication");return e}catch(e){throw ge(e)}}async link(){if(!this.api)throw new he("Auth flow has no API instance");try{return await this.api.post(Ce,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(e){throw ge(e)}}async _startChannelOnce(){if(!this.api)throw new he("Auth flow has no API instance");let e=await this.api.post(be,{token:this.captchaToken});g&&!y&&e.connect_uri&&wa(e.connect_uri,"_blank"),this._meta={...this._meta,connectUri:e.connect_uri,channelToken:e.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new he("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new he("Auth flow has no API instance");if(!this.meta.channelToken)throw new he("Auth flow must be initialized first");let e=await this.api.get(ke,{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 va(this._startChannelOnce.bind(this)),this.pollForReady=new va(this._pollForReady.bind(this)),this._meta.disableSignup=t}}const ba="https://auth.privy.io",ka=1400,Aa=2500,Ta=4e3,xa="2.25.0",Ia="privy:token",Ea="privy-token",Sa="privy:refresh_token",_a="privy:pat",Na="privy:id_token",Ma="privy-id-token",Wa="privy-session",Pa="privy:caid",Ua=e=>`privy:guest:${e}`,Fa=e=>`privy:cross-app:${e}`,Oa="privy:state_code",La="privy:code_verifier",Ra="privy:headless_oauth",Da="privy:oauth_disable_signup",Ba=e=>`privy:wallet:${e}`,za="privy:connectors",Ha="privy:connections",Va=12e4,$a=3e4,ja="https://api.moonpay.com/v1",qa="https://api.moonpay.com/v1",Ka="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",Ga="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI";function Za(){return"undefined"!=typeof window&&"chrome-extension:"===window.location.protocol&&"chrome"in window}function Ya(){if(!Za())return;let e=window.chrome;return e?.runtime?.id}function Qa(){if(!Za())return!1;let e=window.chrome;return"function"==typeof e?.identity?.launchWebAuthFlow}async function Xa(e){return new Promise(((t,n)=>{Qa()?window.chrome.identity.launchWebAuthFlow({url:e,interactive:!0},(async e=>{try{let n=function(){if(!Za())return;let e=window.chrome;return e?.runtime?.lastError?.message}();if(n||!e){let e=`WebAuthFlow failed: ${n||"Response URI missing"}`;throw Error(e)}let r=new URL(e),a=Ya();if(!a)throw Error("Invalid extension context");if("chrome-extension:"===r.protocol){if(r.hostname!==a)throw Error("Invalid responseUri origin")}else{if("https:"!==r.protocol)throw Error("Invalid responseUri protocol");{let e=r.hostname.split(".");if(3!==e.length||"chromiumapp"!==e[1]||"org"!==e[2]||e[0]!==a)throw Error("Invalid responseUri origin")}}let i=r.searchParams.get("privy_oauth_state"),o=r.searchParams.get("privy_oauth_code");if(!i||!o)throw Error("Invalid responseUri - missing required parameters");t({privyOAuthState:i,privyOAuthCode:o})}catch(e){n(e)}})):n(Error("Chrome identity API not available"))}))}function Ja(e){return crypto.getRandomValues(new Uint8Array(e))}function ei(){return tn.encode(Ja(36))}function ti(){return ei()}async function ni(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 tn.encode(t)}}class ri{addCaptchaToken(e){this.meta.captchaToken=e}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new he("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new he("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if("undefined"===this.meta.authorizationCode)throw new he("User denied confirmation during OAuth flow");let e=function(){let e=ua.get(La);if(!e)throw new he("Authentication error.");return e}();try{let t=await this.api.post(Ae,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:e,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});return ua.del(La),ua.del(Ra),ua.del(Da),t}catch(e){let t=ge(e);if(t.privyErrorCode)throw new he(t.message||"Invalid code during OAuth flow.",void 0,t.privyErrorCode);if("User denied confirmation during OAuth flow"===t.message)throw new he("Invalid code during oauth flow.",void 0,Te.OAUTH_USER_DENIED);throw new he("Invalid code during OAuth flow.",void 0,Te.UNKNOWN_AUTH_ERROR)}}async link(){if(!this.api)throw new he("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new he("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if("undefined"===this.meta.authorizationCode)throw new he("User denied confirmation during OAuth flow");let e=ua.get(La);if(!e)throw new he("Authentication error.");try{let t=await this.api.post(xe,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:e});return ua.del(La),t}catch(e){throw ge(e)}}async getAuthorizationUrl(){if(!this.api)throw new he("Auth flow has no API instance");if(!this.meta.provider)throw new he("Provider must be set when initializing OAuth authentication.");let e=ei();ua.put(La,e);let t=ti();ua.put(Oa,t);let n=await ni(e);this.meta.withPrivyUi||ua.put(Ra,!0),this.meta.disableSignup?ua.put(Da,!0):ua.del(Da);let r=oa(this.meta.withPrivyUi),a=window.location.href,i=function(){let e=Ya();if(e)return`https://${e}.chromiumapp.org`}();i&&(a=i);try{return await this.api.post(Ie,{provider:this.meta.provider,redirect_to:this.meta.customOAuthRedirectUrl||a,token:this.meta.captchaToken,code_challenge:n,state_code:t},{headers:{...r}})}catch(e){throw ge(e)}}constructor(e){this.meta=e}}function ai(e){return e.charAt(0).toUpperCase()+e.slice(1)}const ii=({style:n,...r})=>/*#__PURE__*/e("svg",{width:"33",height:"32",viewBox:"0 0 33 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",...n},...r,children:[/*#__PURE__*/t("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"#040507"}),/*#__PURE__*/t("path",{d:"M17.2949 6.37537C18.0156 5.44684 19.4671 4.57877 20.4927 4.46512C20.8178 4.42885 20.8581 4.43127 20.9312 4.50139L20.9967 4.56426L20.9816 4.99225C20.9564 5.65963 20.8682 6.12873 20.6716 6.6341C20.4751 7.13705 20.1198 7.71738 19.8426 7.97852C19.7594 8.06074 19.6007 8.22516 19.4948 8.34848C19.0563 8.84901 18.439 9.20205 17.5973 9.4366C17.2823 9.52606 17.2596 9.52848 16.8917 9.52606C16.4482 9.52365 16.3852 9.51156 16.3524 9.43176C16.3398 9.39791 16.3272 9.18996 16.3222 8.9675L16.3171 8.56127L16.423 8.17922C16.6347 7.41512 16.8791 6.90733 17.2949 6.37537Z",fill:"white"}),/*#__PURE__*/t("path",{d:"M17.4512 10.2081C18.4163 9.84541 19.7595 9.48754 20.2584 9.46336C20.6616 9.4416 21.2966 9.49238 21.7225 9.57943C22.1383 9.66164 22.4357 9.76078 22.8666 9.96148C23.5571 10.2831 24.1442 10.7135 24.6104 11.2382C24.9582 11.6299 24.9783 11.6807 24.8397 11.8113C24.7944 11.8548 24.6885 11.9249 24.6054 11.9709C24.4542 12.0507 23.8368 12.5464 23.8368 12.5875C23.8368 12.5971 23.736 12.7108 23.6125 12.8341C23.2068 13.25 23.0279 13.5861 22.7683 14.4252C22.7078 14.6186 22.6448 14.8725 22.6272 14.9934C22.5566 15.4577 22.5919 16.125 22.7154 16.7344C22.7885 17.1044 23.0808 17.7306 23.3706 18.1489C23.7763 18.7317 24.3786 19.2491 24.9909 19.5514C25.316 19.7086 25.5 19.8464 25.5 19.9334C25.5 19.96 25.4773 20.0205 25.4521 20.064C25.4244 20.1075 25.3866 20.2164 25.3639 20.3034C25.311 20.521 25.001 21.244 24.807 21.5971C24.0862 22.9052 23.3731 23.8748 22.6095 24.5833C21.8611 25.2725 21.1606 25.582 20.4348 25.5385C19.9359 25.5094 19.4596 25.3934 18.7842 25.1322C18.2248 24.917 18.0081 24.8493 17.7939 24.8203C17.688 24.8058 17.4915 24.7768 17.3604 24.7574C16.9774 24.697 16.7254 24.6921 16.4533 24.7478C15.5461 24.9267 15.5133 24.9364 15.0144 25.1371C14.2231 25.4562 13.8073 25.5578 13.2907 25.5578C12.8875 25.5602 12.696 25.5143 12.2575 25.3087C11.8694 25.125 11.5948 24.9315 11.2546 24.5978C10.9295 24.2811 10.7052 24.0151 10.2642 23.4323C9.18818 22.0081 9.02187 21.7276 8.49519 20.4582C8.28612 19.9546 8.19971 19.7502 8.13026 19.5402C8.07498 19.373 8.03043 19.2023 7.94332 18.8744C7.73164 18.074 7.70896 17.9869 7.70896 17.8709C7.70896 17.8153 7.68628 17.675 7.66108 17.5565C7.44184 16.5917 7.44688 15.0007 7.67116 14.1713C7.82236 13.6127 8.02648 13.088 8.30367 12.5512C8.92863 11.3325 9.71738 10.5539 10.874 10.0123C11.2571 9.8309 11.5444 9.74627 12.0534 9.65922C12.2903 9.62054 12.5523 9.56976 12.6355 9.54799C12.8421 9.49238 13.3184 9.49963 13.6057 9.56008C14.2911 9.71 14.7548 9.84058 15.2059 10.0123C16.0551 10.3411 16.549 10.4789 16.7506 10.4475C16.7692 10.4444 16.7848 10.4418 16.8002 10.4387C16.8815 10.4225 16.9601 10.3929 17.4512 10.2081Z",fill:"white"})]}),oi=({style:n,...r})=>/*#__PURE__*/e("svg",{width:"33",height:"32",viewBox:"0 0 33 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",...n},...r,children:[/*#__PURE__*/t("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"#5462EB"}),/*#__PURE__*/t("path",{d:"M23.5433 8.87438C22.2479 8.26174 20.8587 7.81038 19.4063 7.55187C19.3799 7.54688 19.3534 7.55934 19.3398 7.58428C19.1612 7.91179 18.9633 8.33905 18.8247 8.67487C17.2625 8.43382 15.7084 8.43382 14.1782 8.67487C14.0396 8.33158 13.8345 7.91179 13.6551 7.58428C13.6414 7.56018 13.615 7.54771 13.5886 7.55187C12.1369 7.80955 10.7478 8.26092 9.45159 8.87438C9.44037 8.87937 9.43075 8.88769 9.42437 8.89849C6.78947 12.9558 6.06766 16.9134 6.42176 20.8219C6.42336 20.841 6.43378 20.8593 6.4482 20.871C8.18663 22.1868 9.87059 22.9857 11.5233 23.5152C11.5497 23.5235 11.5778 23.5135 11.5946 23.491C11.9855 22.9408 12.334 22.3606 12.6328 21.7504C12.6505 21.7147 12.6336 21.6723 12.5976 21.6581C12.0448 21.442 11.5185 21.1785 11.0122 20.8793C10.9721 20.8552 10.9689 20.7961 11.0058 20.7679C11.1123 20.6856 11.2189 20.6 11.3206 20.5135C11.339 20.4977 11.3647 20.4944 11.3863 20.5044C14.7125 22.0696 18.3136 22.0696 21.6006 20.5044C21.6222 20.4936 21.6479 20.4969 21.6671 20.5127C21.7688 20.5991 21.8754 20.6856 21.9827 20.7679C22.0196 20.7961 22.0172 20.8552 21.9771 20.8793C21.4708 21.1843 20.9445 21.442 20.3909 21.6573C20.3548 21.6715 20.3388 21.7147 20.3564 21.7504C20.6617 22.3597 21.0101 22.9399 21.3939 23.4902C21.4099 23.5135 21.4387 23.5235 21.4652 23.5152C23.1259 22.9857 24.8099 22.1868 26.5483 20.871C26.5635 20.8593 26.5731 20.8419 26.5747 20.8228C26.9985 16.3041 25.8649 12.3789 23.5697 8.89931C23.5641 8.88769 23.5545 8.87937 23.5433 8.87438ZM13.1295 18.442C12.1281 18.442 11.303 17.4944 11.303 16.3307C11.303 15.1669 12.1121 14.2193 13.1295 14.2193C14.155 14.2193 14.9721 15.1752 14.9561 16.3307C14.9561 17.4944 14.1469 18.442 13.1295 18.442ZM19.883 18.442C18.8816 18.442 18.0564 17.4944 18.0564 16.3307C18.0564 15.1669 18.8655 14.2193 19.883 14.2193C20.9084 14.2193 21.7255 15.1752 21.7095 16.3307C21.7095 17.4944 20.9084 18.442 19.883 18.442Z",fill:"#F7F7F7"})]}),si=({style:n,...r})=>/*#__PURE__*/e("svg",{width:"33",height:"32",viewBox:"0 0 33 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",...n},...r,children:[/*#__PURE__*/t("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"black"}),/*#__PURE__*/t("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M16.5083 5.62451C10.8896 5.62451 6.34741 10.2078 6.34741 15.878C6.34741 20.4104 9.25774 24.2471 13.2951 25.605C13.7999 25.7071 13.9848 25.3844 13.9848 25.1129C13.9848 24.8752 13.9682 24.0604 13.9682 23.2115C11.1417 23.8227 10.5531 21.9892 10.5531 21.9892C10.0988 20.8009 9.42579 20.4954 9.42579 20.4954C8.50068 19.8673 9.49318 19.8673 9.49318 19.8673C10.5194 19.9352 11.0578 20.9198 11.0578 20.9198C11.9661 22.4815 13.4297 22.0402 14.0185 21.7686C14.1025 21.1065 14.3719 20.6482 14.6579 20.3936C12.4035 20.1559 10.0317 19.2732 10.0317 15.3347C10.0317 14.2142 10.4351 13.2976 11.0745 12.5847C10.9736 12.3301 10.6202 11.2774 11.1756 9.86844C11.1756 9.86844 12.0335 9.59678 13.968 10.9209C14.7962 10.6965 15.6503 10.5823 16.5083 10.5814C17.3662 10.5814 18.2408 10.7003 19.0484 10.9209C20.9831 9.59678 21.841 9.86844 21.841 9.86844C22.3963 11.2774 22.0428 12.3301 21.9419 12.5847C22.5981 13.2976 22.9849 14.2142 22.9849 15.3347C22.9849 19.2732 20.6131 20.1388 18.3419 20.3936C18.7121 20.7161 19.0316 21.3271 19.0316 22.2948C19.0316 23.6698 19.0149 24.7733 19.0149 25.1127C19.0149 25.3844 19.2 25.7071 19.7046 25.6052C23.742 24.2469 26.6523 20.4104 26.6523 15.878C26.669 10.2078 22.1102 5.62451 16.5083 5.62451Z",fill:"white"})]}),li=({style:e})=>/*#__PURE__*/t(Zr,{style:{color:"var(--privy-color-error)",...e}}),ci=n=>/*#__PURE__*/e("svg",{width:"33",height:"32",viewBox:"0 0 33 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n,children:[/*#__PURE__*/t("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"#F1F2F9"}),/*#__PURE__*/t("path",{d:"M26.1001 16.2273C26.1001 15.5182 26.0365 14.8364 25.9183 14.1818H16.5001V18.05H21.8819C21.6501 19.3 20.9456 20.3591 19.8865 21.0682V23.5773H23.1183C25.0092 21.8364 26.1001 19.2727 26.1001 16.2273Z",fill:"#4285F4"}),/*#__PURE__*/t("path",{d:"M16.5001 26C19.2001 26 21.4637 25.1046 23.1182 23.5773L19.8864 21.0682C18.991 21.6682 17.8455 22.0227 16.5001 22.0227C13.8955 22.0227 11.691 20.2637 10.9046 17.9H7.56372V20.4909C9.20917 23.7591 12.591 26 16.5001 26Z",fill:"#34A853"}),/*#__PURE__*/t("path",{d:"M10.9047 17.8999C10.7047 17.2999 10.591 16.659 10.591 15.9999C10.591 15.3408 10.7047 14.6999 10.9047 14.0999V11.509H7.56376C6.86376 12.9025 6.49951 14.4405 6.50012 15.9999C6.50012 17.6136 6.88649 19.1408 7.56376 20.4908L10.9047 17.8999Z",fill:"#FBBC05"}),/*#__PURE__*/t("path",{d:"M16.5001 9.97726C17.9682 9.97726 19.2864 10.4818 20.3228 11.4727L23.191 8.60454C21.4591 6.99091 19.1955 6 16.5001 6C12.591 6 9.20917 8.2409 7.56372 11.5091L10.9046 14.1C11.691 11.7364 13.8955 9.97726 16.5001 9.97726Z",fill:"#EA4335"})]});function di(n){/*#__PURE__*/return e("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:26,height:26,viewBox:"0 0 140 140",x:"0px",y:"0px",fill:"none",...n,children:[/*#__PURE__*/e("defs",{children:[/*#__PURE__*/e("linearGradient",{id:"b",children:[/*#__PURE__*/t("stop",{offset:"0",stopColor:"#3771c8"}),/*#__PURE__*/t("stop",{stopColor:"#3771c8",offset:".128"}),/*#__PURE__*/t("stop",{offset:"1",stopColor:"#60f",stopOpacity:"0"})]}),/*#__PURE__*/e("linearGradient",{id:"a",children:[/*#__PURE__*/t("stop",{offset:"0",stopColor:"#fd5"}),/*#__PURE__*/t("stop",{offset:".1",stopColor:"#fd5"}),/*#__PURE__*/t("stop",{offset:".5",stopColor:"#ff543e"}),/*#__PURE__*/t("stop",{offset:"1",stopColor:"#c837ab"})]}),/*#__PURE__*/t("radialGradient",{id:"c",cx:"158.429",cy:"578.088",r:"65",xlinkHref:"#a",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(0 -1.98198 1.8439 0 -1031.402 454.004)",fx:"158.429",fy:"578.088"}),/*#__PURE__*/t("radialGradient",{id:"d",cx:"147.694",cy:"473.455",r:"65",xlinkHref:"#b",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(.17394 .86872 -3.5818 .71718 1648.348 -458.493)",fx:"147.694",fy:"473.455"})]}),/*#__PURE__*/t("path",{fill:"url(#c)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),/*#__PURE__*/t("path",{fill:"url(#d)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),/*#__PURE__*/t("path",{fill:"#fff",d:"M66.004 18c-13.036 0-14.672.057-19.792.29-5.11.234-8.598 1.043-11.65 2.23-3.157 1.226-5.835 2.866-8.503 5.535-2.67 2.668-4.31 5.346-5.54 8.502-1.19 3.053-2 6.542-2.23 11.65C18.06 51.327 18 52.964 18 66s.058 14.667.29 19.787c.235 5.11 1.044 8.598 2.23 11.65 1.227 3.157 2.867 5.835 5.536 8.503 2.667 2.67 5.345 4.314 8.5 5.54 3.054 1.187 6.543 1.996 11.652 2.23 5.12.233 6.755.29 19.79.29 13.037 0 14.668-.057 19.788-.29 5.11-.234 8.602-1.043 11.656-2.23 3.156-1.226 5.83-2.87 8.497-5.54 2.67-2.668 4.31-5.346 5.54-8.502 1.18-3.053 1.99-6.542 2.23-11.65.23-5.12.29-6.752.29-19.788 0-13.036-.06-14.672-.29-19.792-.24-5.11-1.05-8.598-2.23-11.65-1.23-3.157-2.87-5.835-5.54-8.503-2.67-2.67-5.34-4.31-8.5-5.535-3.06-1.187-6.55-1.996-11.66-2.23-5.12-.233-6.75-.29-19.79-.29zm-4.306 8.65c1.278-.002 2.704 0 4.306 0 12.816 0 14.335.046 19.396.276 4.68.214 7.22.996 8.912 1.653 2.24.87 3.837 1.91 5.516 3.59 1.68 1.68 2.72 3.28 3.592 5.52.657 1.69 1.44 4.23 1.653 8.91.23 5.06.28 6.58.28 19.39s-.05 14.33-.28 19.39c-.214 4.68-.996 7.22-1.653 8.91-.87 2.24-1.912 3.835-3.592 5.514-1.68 1.68-3.275 2.72-5.516 3.59-1.69.66-4.232 1.44-8.912 1.654-5.06.23-6.58.28-19.396.28-12.817 0-14.336-.05-19.396-.28-4.68-.216-7.22-.998-8.913-1.655-2.24-.87-3.84-1.91-5.52-3.59-1.68-1.68-2.72-3.276-3.592-5.517-.657-1.69-1.44-4.23-1.653-8.91-.23-5.06-.276-6.58-.276-19.398s.046-14.33.276-19.39c.214-4.68.996-7.22 1.653-8.912.87-2.24 1.912-3.84 3.592-5.52 1.68-1.68 3.28-2.72 5.52-3.592 1.692-.66 4.233-1.44 8.913-1.655 4.428-.2 6.144-.26 15.09-.27zm29.928 7.97c-3.18 0-5.76 2.577-5.76 5.758 0 3.18 2.58 5.76 5.76 5.76 3.18 0 5.76-2.58 5.76-5.76 0-3.18-2.58-5.76-5.76-5.76zm-25.622 6.73c-13.613 0-24.65 11.037-24.65 24.65 0 13.613 11.037 24.645 24.65 24.645C79.617 90.645 90.65 79.613 90.65 66S79.616 41.35 66.003 41.35zm0 8.65c8.836 0 16 7.163 16 16 0 8.836-7.164 16-16 16-8.837 0-16-7.164-16-16 0-8.837 7.163-16 16-16z"})]})}function ui(n){/*#__PURE__*/return e("svg",{width:"33",height:"32",viewBox:"0 0 33 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",...n,children:[/*#__PURE__*/t("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"black"}),/*#__PURE__*/t("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"#06C755"}),/*#__PURE__*/t("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"url(#pattern0_1769_69)"}),/*#__PURE__*/e("defs",{children:[/*#__PURE__*/t("pattern",{id:"pattern0_1769_69",patternContentUnits:"objectBoundingBox",width:"1",height:"1",children:/*#__PURE__*/t("use",{xlinkHref:"#image0_1769_69",transform:"scale(0.003125)"})}),/*#__PURE__*/t("image",{id:"image0_1769_69",width:"320",height:"320",preserveAspectRatio:"none",xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUAAAAFACAYAAADNkKWqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABpkSURBVHgB7d1fbFTXtcfxdWZs45h7g6lClajoetJIRKIqGKmhTSvF5qEvqUqIitM+XEIikYf+QWlVaF+IACVPBamN0ps8NFL5cx+qmioOVXsf+oCJ1Pg2VMKkKlKRSMZVqlalCiaSHf9hZvesMx5jm/k/58w5Z+/vR3KM8cSAPf55rbX32ccTx/Rf3tO/uNiXWygsDnri5UTMgOd5/UZMTozXX3qU/2vAOl4++K+Y4LUR8V97U5KRyUwxM93bOzc5vWNsWhziicU07GYXeoY9I0P+mzljZJBwA6rzv0emM55MGvEuajD29SyM2xyKVgWgBt7cXO+g8YpP+BXdsASBB6AtfiD63dK4ZzJvzj36i3GxSOoDUENvZq57T0Zkf9EPPM+TfgEQGX9kNFY05s31vYtjaa8OUxuAvRPfGDZSOEroAfHRMDSenF74/C/HJIVSFYDBTG+u53ljzHcJPSBR8hqGfpv8st8m5yUlUhGAWu0VTfF58cweAZB0pzKSPZ6GIEx0AJbbXH+5flgApE3igzCRAdj9+5HBTEZ+TPABVkhsECYqAIMV3fmeo54/4xMAtklcECYmANf9/9efLxaLx1jcAKyW9zu744uPjp6SBIg9AP05X86f8/2cdhdwSt6vBnfFXQ1mJEZa9RVM4TLhBzgnV5TC+z0TTx2VGMVSAVL1AVjmyWTGZJ+MoxrseAXY84ev7aHqA7DMyKBfDV7onhh5RjqsowHY8we/3C1m3mChA8AaOb8d/XmnW+KOtMC6veXjue43qPoA1KOX1N2zbuHZThy0EHkA6ryvKMULnMMHoAkdWSWOtAXWKzoIPwAt0FXiC1pASYQiqwA1/PyPfoF5H4CWeTLdnZFdMztHJyUCkQQg4QcgNBGGYOgBSPgBCF1EIRhqABJ+ACITQQiGFoA6rNQNzoQfgMiEHIKhrAKXt7oQfgAiZaR/sSBvhLU63HYA6iZntroA6KBgi4xmj7Sp7QCc/bjn54QfgA7L6dVl0qa2AjC4tpcbFQGIgV5a2+61wy0vgujJDXrxsgBAnDLFJxc+/6uW7kvcUgByfS+AxPBXhjMmu6OV64ZbaoGLXuENwg9AIvgrw3rAsrSg6QAM5n5GBgUAEkLngeve/nrTd5NsqgUutb6F9wUAkqaFVripCrA09wOABGqhFW44AEvn9TP3A5BczbbCDbXArPoCSA2/Fe5bt/hgI0fqN1QB+nO/o4QfgFTwW+GZj3sa2iBdtwJk4QNAGnVnZUe9U2PqVoCl6g8A0uV2QX5c7zE1K0CqPwBplhGza+7Rc+PV318D1R+ANDPi1cywqhUg1R8AG9SqAqtWgFR/AGxgvMzz1d5XsQKk+gNgk77exY2V9gVWrAAL3u2qiQkAaTM721Px6pCKAeiZDKc8A7BH1lQs6u4KwJ63v7aHqz4AWMVIf+/E3uG1v31XAHqZ7H4BAMtU2hKzehHkwp7+nt7umwIAtqlwSMKqCrC7t5vZHwA76SEJc6szblUAZjzvCQEAS/mBt3/N23cYwz1+AdjLeDLYf3lPf/nt5QDsnfjGsACAzfw2eG6ua/mmbssBWDAFqj8A1jPGW8665QD0l4OHBAAsZ1ZkXWkbDNtfADikfG1wUAH2rMsOCwA4YvbjnmF9XWqBveygAIAjPDHD+rpr6Y0hI0B7+rvWy4bsehlYtyl4CX4v2ycb/N9XuXWfbOjj5Of/Gby+dXtGpguzcqvgv749G7w9tXDD//WMAG3K6X+CADRGBhu7QzBcpgE30LNJtq3PBQGngVYOu3Lgdcq7s/kgFKfmbwSBWX679JqARG3Gk+362mMBBJUM+OH22L1bZbuGnR9625dCLw3KQXjFf3nroz/L1NyN4NfASroQ4ukG6KIULgicpZWdht1j935GtvflZJv/0t/VJzYph+JFPxDf+ugqlSKkO9u9o6toFvvFq3t7YFhEA09DbvcnHpEhP/j017bTQC+F/Nbl3ysF4lU5/+GloFKEWxYKi4NdpRVglkBspy3t7o2f80Nvp5UVXiu2LVW7B+9/PHhbK8OzN8aDUJxaWoiBvTzxcroIkhNYSVtarfD2bRpOzfwuTisrRK0O3/Qrw1/7L8wPLeWZAW/dxMgFv/4bFlhBK72nNw0ReiHSleZX/v4bOX/zj1SGFvGMvEkAWkBnevvuGwra25UzLoSv3Caf8V+QckYmvZ6Jp97nJkjppC2uLmTsu2+YmV6HaVWoCycvfnCOqjC98gRgCmmlp4N7qr1koCpMLQ3AEZaAU0DbXA2979z/Faq9hNKq8KUPRgnCFCEAE47gSx8WTdKDAEwogi/9NAhLrfFFgjChCMCEIfjsQ2ucXARggujevZMDzxB8liIIk4cATADdzvLC5hFWdR1xZSYvI9dO0hYnAAEYI213Twzsl6f9yg/u0fkg+wjjRQDGROd8RzY/RbvrONrieBGAHabX6r7+0Ldod7EK1WA8CMAOoupDLXpA6+Gp01SDHUQAdgBVH5pBNdg5BGDE9LCCn33621R9aIrOBg9cf5WTqiPGWfgROpl7Rka3HCb80DQ9y/F3W48G26MQHSrACGjLe+7hQ07cawPR0yrwwPXXaIkjQAUYMt3UrD+5CT+EpfycGmjwxvJoHAEYIl3lLT1ROYoe4dLn1LUdP12+gRPCQQCGRGc1OvMDoqTPMeaC4ekStEUvZzs5sD84yADohCN+AG7I9smhqdOC9hCAbdDwY96HOBx84CtBW/zce68FG6jRGlrgFulAmvBDnPTeMPoc1B/EaA0B2ALCD0mhz8F3PvsjVohbRAA2qRx+rPQiKcqbpgnB5hGATSD8kFTlEKQdbg4B2CDCD0lHCDaPAGyAPqH00jbCD0mnM8HRLYcEjSEAG/CzT3+LBQ+khl46p8evoT4CsA7dda9HWgFpohvzuWKkPgKwBn0CHeFJhJTS5y7XDtdGAFahbQThh7TTa4e3M76pigCsoHyEPWCD0YcPs0ewCgKwAra7wCb6XH79oW8K7kYArqEtA+EH2+hIR08twmoE4Aq6csbQGLbSE2Q0CHEHAbhEZyRsG4DtdLbNlSJ3EIBLjmzeS+sL6+lz/Min9gpKCEAptb5Pc6IzHEErfIfzAUjrCxfRCpc4H4C0vnARrXCJ0wGoBxzQ+sJV2gq7fpWI0wF47uHDArjsZM7tvYHOBqAufND6wnW6GOLygoizAcjCB1Di8nXvTgYg1R9wh34vuDoLdzIAqf6A1Vw9+s25AKT6A+7mahXoXABS/QGVuVgFOhWAVH9Adfq94dqKsFMBSPUH1PbCZreuDnEmAPUnG9UfUJtr+wKdCcB9m4YEQH0u3QbWiQDUE1+45hdozL77hpw5KcaJAHzs3q0CoDEafo/9pxvfM13igCRUf1PzN2q+P+75ZL2/n0rLDHX69ozcKszWfMyGbB/n4dVw8IHH5fzNS2I76wNQ2984K8Cp+X/Kl68ebygAdR9WHGF94PqrcvbGeN3H6fFhl7b9qOZjzvgf55W//7ZuAOnXJIprUPXzvfNPPwxCsJ7RLYdrzrvenc0HX7tGPlZU9DkRx+4F/VrrD4g4/+2dYH0LHHf7q2HQSHWlj3npg1HptLc+utpQ+CkNhDM1Hqvh85wfpvo4/XWtF/0zD02dlrAdyp9u+Jv2lX/8tub7v9/Ex4qKPiemb89Kp2n4fXWj/Ysh1gdg3O3vdKHzT964TM3/q6nHv/L33/gB/GcJUzOfbw3iWv5a5/2dMl2IJ4SHHJidWx2AwTCXBZBEG7l2sm4QIR5UgCm3zfHjvtNAW8wD118TJE+pgLB7U7TVAejShs400zb4xRjmn6jP9g7K6gB0/YYvaaLD/rDngWif7XNAawOQ+V/66HacOFY8UZ3tYyRrA5D5X/roVqCRaycEyaGFhM2dlMUBOCBIH22D6+3PQ2dtW58TW1kbgEMb3L3VX9odyp9iHrhEr2TKxXwJ4naLA9DaS+H6s1znmWY6D3znsyf8FqxP0kCDKuwj17T93HffsMRtoOc+sZW1AcgMMN10Hvjce6/K6JZDkgZ6LbetJ45vX/+g2MrKFlh/cqalckB15z98h3lgAmi423pyjpUBSPVnD90fqIcrIF79WTsLCmsrQNhBL5Xb+5cT7A+Mma1FhZUB+F8WD21dpPPAQ1OnBPHZQAucHlSA9tHzA5kHxocWOEW4/aWddB7I0VnxsLUCdOKeILCDzgP1iPok7g/UhRrduxgmrbr03hy6xzBucW/GjoqVAUgLbK/g1gF/G5WTA/slSTScG721QDP0xkRp2hCeNnbOALkKJBUOPvCVln5Y6VH6ZyIImyTSwI/rSHwXOHFfYCSTHlhx5FN7pRWHp04zD0TbCEDESqvAVm5cVdofeFKAdhCAiN0Jf57XyqBfFx6iuLUm3GFlAOZpjVJF54DnHm7t0AOdB57/8JIAraACRCLopVatruzqqTHMA6Nl6/2tCUAkhs4DW7kNI7fWjJ5+jm1kZQDq1gGkk57/18o8UE+QZh4YnVsEYHoQgOml88DXH/qmtELngTYenZWEfa20wECHaBvc6jzQplZNfxiczD2TiKtAbC0qrLwU7t3ZKUG66Tzw/M0/pubmSBrav9t6VGxFC5wirAja4fWHvpWIgwAgcsXSU7mtDEBtgzhBOP30WLNW54EIz5WZvNjK2hngXxeoAm2greXB+x8XxOeWpQsgytoAnLT4p5ZrdCGglf2BCIet7a+yNgBtLttdpPNAznmMx1u30rEQ1QprA5CVYLvoPPBnn2YeGAeb99VaeyR+WjfEhv1k25Dts6Zy2v2JncE8MIk3R9I5mY1fO91RYXMLbG0A6kqw7iFL0+xIv4G2XP62hE331CXtCPlW6TzwrY+uJu6b8srM+5F87Y5sHpEX/Je42D5KsvpKkCu0wQHbLhEbffiwM/NAvRNePsYW9Nc3/yg2szoAOSfuDpv2Reo80JaKNumoAFNMqx42RNtp36Zh9gdGzPb5n7I6AHUO+O7s+wI76Xxse19OEA2dtdrO+tNg3qQNtpbOAV2aB3bamRsXxXbWB+D//sv+L6LLdB7Y6q01UZ22v2k5iacd1gdgeTsM7KXbfJgHhsuF9lc5cSAqbbD9dB7I0VnhefGDUXGBEwGobTCrweFI6rytfGvNZv5+/V3/Ibibbn1x5bYSTgSgtsFn/zUucRi6d6vETSsjnZVVsq1voOHKScOl1qqrfqxmAmgo5Kt09NaazcwDd2/8XM33//emYYmbfm1yVb52UflpAi81jIrXMzFixAFxHlmu85SLMc0hNZB2b3ykagAq/Wl/5sZ42x9Hnf/wHXnlH/9X52P1yVf9j/V0RAGjn2/9oVfrHDv9dzzWwA+ns/7nJa4rMfRzvu++4Y7eE0QXP7Zc/o64wpkAVBqAnCsHVKeXTbp0e1Gn7grnwr4moB1JPGknSk4F4K9vXmIxBKhC233X7qntVADqXOiVf/xGANzNla0vKzl3Y3Rd4aIKBFZzsfpTzgUgVSCwmn5PuFj9KecCUFEFAnfowoeL1Z9yMgD1J96hqVMCuE73/b3kaPWnnAxApTMPDkmA61764Jy4zNkAVC86/sWH2/SWEfWuALKd0wGoFaDrTwC4izGQ4wGoDk+dZkEEztFVX1cXPlZyPgB1QeSlv7k7BIZ7XF/4WMn5AFR6ATgLInDFl68eF5QQgEsOXH+VVhjWo/VdjQBcok+K5957VQBb6aovre9qBOAKpcM83ToOCG7QuR+rvncjANd4KWgR/imATfb+5SStbwUE4Bq6KqxDYuaBsIXO/d6dzQvuRgBWwDwQttBLPpn7VUcAVqHzQFePCIIdSnM/d+7v0QoCsAb9ycmiCNJIw680ypkRVEcA1nEof4pN0kgVDT0WPRpDADZg5NpJhshIDZ1f83xtDAHYgNJP1BNsj0Hi6dxaNzyjMQRgg7Sd0JkKIYik0vBjxbc5BGATCEEklS7WEX7NIwCbRAgiabTl1cU6NI8AbAEhiKTQxQ427beOAGxROQRZbUNc9LnHXr/2EIBtKIcgq27oNDY6h4MAbJM+AUeuneCyOXQM4RceAjAkugJHCCJq5fDjKo9wEIAh0hBkcQRR0Znfzj/9kPALEQEYMr1umBBE2FjwiAYBGAH9Cb3l8nc4SQaheOujq4RfRAjACOnmVL3bHNUgWnXmxrgffscIv4gQgBE7GzyBj3OkFpqmi2rPXWeTc5QIwA4o7xdklRiN4mCDzvB6JkaMoGMG1m2Scw8flm19OQEq0dEJ8+POIABjsm/TsLywea8fiJ8UQJU21Z9kXNJBBGCMtBo8snlEnvbDEG5jg3M8CMAE2L4+J6NbDlENOkr3+JVOHCf8Oo1FkAS4MpMP9g2yZcY9Z5Z2CRB+8aACTCDmg25gpTd+BGBC6XxQg/DpTUMEoWV0sUNvWK57RBEvAjDhNAgfu/czVISW0BGH3rOXg3STgQBMEVrjdGOxI3kIwBTa/YmdcvD+x/3KcKsgHXRjMzcuSh4CMMXK+wiH/CCkKkwuruxILgLQEtoe7974iF8dPiJIBuZ9yUcAWqa8aKJXl9Aix0fP8Dtw/X+Y9yUcAWgxwjAe7O9LDwLQEf1d6+WrfousQcjMMBocZpA+BKCj9DguDUKtEDUUNSDROra4pBMBiIAGoh7KoGE46L/mvMLGscUlvQhAVKQVYRCKfQMy0PtJ/7WG4gCV4gra8j733qty/sNLgnQiANGUcjDq6/I80cVqkVVeOxCAaJuuNusexIMPPO7E4gotrz0IQITK5uuVdWPzgeuvscprEQIQodOK8OTAM1ZdlaJzPp33cX9eu3AiNEKnc7GRayesqJSCs/v8dlf/PYSffQhAREYP/Uwz3du3808/4CADixGAiIze6yStBwFo6D3y7g9Y5bVclwARmvRDME3bZFjocAsBiEilqYLSqk8PMWDW5w4CEJFKQwBS9bmLAITTqPrcRgDCSVzHC0UAIlK6KTpp2NSMMgIQkUrS6TFUfViLAESkklIBMutDJQQgItWfjbcCZIUXtRCAiFScm6Cp+lAPAYjIbF//oD8D7JNOo+pDowhARGZDtrPhp5VeueoDGkEAIjJ6D5FO4Yh6tIIARGSGNnxGoqZV3+Gp03LmxrgAzfID0MuLmJwAIYt6BZhFDrQpTwWIyES1Aqzt7ot+8LHIgXZ1iTHT4gkQqihWgLXS04qPE5oRBk8rQC/j5Y0xgwKEKOwVYNpdRKHLGLklQMjCWgFmdRdRMV5pBpgXIGS53vbuC6z3Evl+/jRzPkTHeFNdRkyeESDC1moLzLYWdIyRya6erEwuFgQI1a3CbFOPL1/F8VP/hTkfOiHjFae7ZmYW8z293QKESWd3B+9/vO7jCD7Epbf39mTQ/fZMPPU+m6ERtkvbflR1LyB7+RArT6YXvjC6MdgI7Xky6a8G5wQIkd5YfN+mYRm6t3RJ3HRhJgg+DT2qPcTJ8+d/+joIwGLRTHmshCACZ/3FjLMsaCBhjHgX9XVG/+NJcVwAwBVLFWAQgAvzhXEBAEf03bMwrq+DAJRdY9PlRAQAq/lZN73DzzwpB2Dwe3JRAMBy3oqsWw7ArGfGBAAs563IuuUAnJu7PemXgdMCABabe/TcePnXywGoc0DdDygAYCnPyJsr386sfKMocloAwFJ+kbdq1LcqABfnFsdogwHYqrd3sXoA0gYDsJW2v+XtL2WZux4k5rgAgGWMeKfW/l7FK4B73h656b+nXwDAAnoDpPlHRx9c+/uZyo/2XhYAsETR8yruc64YgAtzCz8RALBE1mQqFnWVK8BgMcTjyhAA6efJqblHf5Gv9K5M1f/HFGmDAaRexmSrLuxWDUC9XMQfHI4LAKRVjepPZWr/v2yJAZBetaq/4P213kkVCCC16lR/qmYAqmJRvicAkDL1qr/gMfUesPil0UnDggiANGmg+lN1A1AtzheOcUgCgDTQqz4aqf5UQwEY7AvMsCACIPn8ADzeSPW39NjGrZsYuWBEhgUAEqjaNb/VNFYBLn/w7LO0wgCSys+oXc08vqkA1LKSVhhAIhVNw61vWVMtcBmtMIAk0YOc578wukOa1FQFuPyH0QoDSAid+3km+6S0oKUALJWZxWcFAGLWzKrvWi0FoFr44q/GhGuFAcQpmPuNnpIWtTQDXIl5IIBYeN7Ywhd+2VLrW9ZyBVg2P7f4pCdeXgCgQ3Tu17duoe0xXNsBGFwlIpldhCCATggWPSS7a+0tLlv8WOHo/v3IoL8UfYG7yQGIjJHpjJfd0eqix1rtV4BLSqfGyC62xwCIhJ8tmjFhhZ8KrQIsoxIEELql8NNCS0IUegAqQhBAaCIKPxVJACpCEEDbIgw/FdoMcC39C+uwktVhAK3Q1d4ow2/pz4hW78Q3ckaKF4yYnABAA8pbXcJc8KgksgqwTP8B83MLO8R4YwIAdeidKO/pXdwRdfgt/Vmd0zOx95j/Rx4VAKikaI4vfOncMemQjgag6p0Yecb4IUhLDGCZv9jRlS0+O/v5X3W0U+x4ACqdCxZN4Q3/Tx8UAE7TllfPGO1Ey7tWLAFYRksMOMyv+jwxx+e/eO4nEpNYA1CxSgy4J86qb83fIxmYDQIOSEDVt1JiAlAFs0G5fcz/a+0XAFbxTPHle+4pHAvjGKuwJCoAywhCwB7a7haL8r0or+hoVSIDsIwgBNKrNOfTe3acG5eESnQAlhGEQHp4njem7W6Sg68sFQFYpkFYMIvfzXjZJ1gsARJED0L2zMt9vbd/kqQZXz2pCsCVet7+2h6R7H7/k75HAHSeruh6Mpn0NreW1AZgWf/lPf1zc917isZ7gjAEIrYUekWR0+t7F8fSVO1VkvoAXKt3Yu+w8bw9pihDXGoHhMD4VV5GLnrGjPX23p5Me+itZF0ArqTV4ezH2WHxsoN+mT5kjB+InFAN1ODlS4FnpkyxON53T2HcpsBby+oArKTUMncNFo3p12D0f7wN+J+EnL7PiJcrPYoFFtho6XR2Y6aDX3vB6yl/QTEvRZlc37eYtznsKvk3kqxyUwkTXfIAAAAASUVORK5CYII="})]})]})}function pi(n){/*#__PURE__*/return e("svg",{width:"33",height:"32",viewBox:"0 0 33 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n,children:[/*#__PURE__*/e("g",{"clip-path":"url(#clip0_1715_1956)",children:[/*#__PURE__*/t("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"#0977B6"}),/*#__PURE__*/t("path",{d:"M9.46878 6.82104C10.6699 6.82104 11.6461 7.79742 11.6461 8.999C11.6461 10.2017 10.6699 11.1782 9.46878 11.1782C8.26447 11.1782 7.28967 10.2017 7.28967 8.999C7.28967 7.79742 8.26447 6.82104 9.46878 6.82104ZM7.58908 12.8309H11.3467V24.9207H7.58908V12.8309Z",fill:"white"}),/*#__PURE__*/t("path",{d:"M13.7032 12.8309H17.3076V14.4827H17.3576C17.8589 13.5322 19.0846 12.53 20.9127 12.53C24.7175 12.53 25.42 15.0341 25.42 18.2891V24.9207H21.6651V19.0415C21.6651 17.6388 21.6394 15.8355 19.7126 15.8355C17.7573 15.8355 17.4579 17.363 17.4579 18.9399V24.9207H13.7032L13.7032 12.8309Z",fill:"white"})]}),/*#__PURE__*/t("defs",{children:/*#__PURE__*/t("clipPath",{id:"clip0_1715_1956",children:/*#__PURE__*/t("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"white"})})})]})}function hi(n){/*#__PURE__*/return e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...n,children:[/*#__PURE__*/t("path",{fill:"#1ed760",d:"M248 8C111.1 8 0 119.1 0 256s111.1 248 248 248 248-111.1 248-248S384.9 8 248 8Z"}),/*#__PURE__*/t("path",{d:"M406.6 231.1c-5.2 0-8.4-1.3-12.9-3.9-71.2-42.5-198.5-52.7-280.9-29.7-3.6 1-8.1 2.6-12.9 2.6-13.2 0-23.3-10.3-23.3-23.6 0-13.6 8.4-21.3 17.4-23.9 35.2-10.3 74.6-15.2 117.5-15.2 73 0 149.5 15.2 205.4 47.8 7.8 4.5 12.9 10.7 12.9 22.6 0 13.6-11 23.3-23.2 23.3zm-31 76.2c-5.2 0-8.7-2.3-12.3-4.2-62.5-37-155.7-51.9-238.6-29.4-4.8 1.3-7.4 2.6-11.9 2.6-10.7 0-19.4-8.7-19.4-19.4s5.2-17.8 15.5-20.7c27.8-7.8 56.2-13.6 97.8-13.6 64.9 0 127.6 16.1 177 45.5 8.1 4.8 11.3 11 11.3 19.7-.1 10.8-8.5 19.5-19.4 19.5zm-26.9 65.6c-4.2 0-6.8-1.3-10.7-3.6-62.4-37.6-135-39.2-206.7-24.5-3.9 1-9 2.6-11.9 2.6-9.7 0-15.8-7.7-15.8-15.8 0-10.3 6.1-15.2 13.6-16.8 81.9-18.1 165.6-16.5 237 26.2 6.1 3.9 9.7 7.4 9.7 16.5s-7.1 15.4-15.2 15.4z"})]})}function mi(e){/*#__PURE__*/return t("svg",{xmlns:"http://www.w3.org/2000/svg","shape-rendering":"geometricPrecision","text-rendering":"geometricPrecision","image-rendering":"optimizeQuality","fill-rule":"evenodd","clip-rule":"evenodd",viewBox:"0 0 1000 1000",...e,children:/*#__PURE__*/t("path",{d:"M906.25 0H93.75C42.19 0 0 42.19 0 93.75v812.49c0 51.57 42.19 93.75 93.75 93.75l812.5.01c51.56 0 93.75-42.19 93.75-93.75V93.75C1000 42.19 957.81 0 906.25 0zM684.02 319.72c-32.42-21.13-55.81-54.96-63.11-94.38-1.57-8.51-2.45-17.28-2.45-26.25H515l-.17 414.65c-1.74 46.43-39.96 83.7-86.8 83.7-14.57 0-28.27-3.63-40.35-9.99-27.68-14.57-46.63-43.58-46.63-76.97 0-47.96 39.02-86.98 86.97-86.98 8.95 0 17.54 1.48 25.66 4.01V421.89c-8.41-1.15-16.95-1.86-25.66-1.86-105.01 0-190.43 85.43-190.43 190.45 0 64.42 32.18 121.44 81.3 155.92 30.93 21.72 68.57 34.51 109.14 34.51 105.01 0 190.43-85.43 190.43-190.43V400.21c40.58 29.12 90.3 46.28 143.95 46.28V343.03c-28.89 0-55.8-8.59-78.39-23.31z"})})}const gi=n=>/*#__PURE__*/e("svg",{width:"33",height:"32",viewBox:"0 0 33 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n,children:[/*#__PURE__*/t("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"black"}),/*#__PURE__*/t("path",{d:"M8.53901 8L14.7164 16.2153L8.5 22.8947H9.89907L15.3415 17.0468L19.7389 22.8947H24.5L17.975 14.2173L23.7612 8H22.3621L17.3499 13.3858L13.3001 8H8.53901ZM10.5964 9.02501H12.7837L22.4422 21.8695H20.255L10.5964 9.02501Z",fill:"#F7F7F7"})]});let yi={google:{name:"Google",component:ci},discord:{name:"Discord",component:oi},github:{name:"Github",component:si},linkedin:{name:"LinkedIn",component:pi},twitter:{name:"Twitter",component:gi},spotify:{name:"Spotify",component:hi},instagram:{name:"Instagram",component:di},tiktok:{name:"Tiktok",component:mi},line:{name:"LINE",component:ui},apple:{name:"Apple",component:ii}};const fi=e=>e in yi?yi[e]:{name:"Unknown",component:li};function wi(){let e=new URLSearchParams(window.location.search),t=e.get("privy_oauth_code"),n=e.get("privy_oauth_state"),r=e.get("privy_oauth_provider");if(!t||!n||!r)return{inProgress:!1};let a=!1;try{a=!!window.opener.location.origin}catch{}return{inProgress:!0,authorizationCode:t,stateCode:n,provider:r,withPrivyUi:!ua.get(Ra),popupFlow:null!==window.opener&&a,disableSignup:!!ua.get(Da)}}function vi(){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"),ua.del(Oa),window.history.replaceState({},"",e)}class Ci{async initRegisterFlow(e){if(!this.api)throw new he("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 he("Auth flow has no API instance");this.authenticateForRegistration=!1,this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute(e)}async initLinkFlow(){if(!this.api)throw new he("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 he("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new he("WebAuthn is not supported in this browser");this.meta.initRegisterResponse||(this.meta.initRegisterResponse=await this.initRegisterOnce.execute());try{let t=this.meta.initRegisterResponse.options,n=await e.startRegistration(this._transformInitLinkOptionsToCamelCase(t));return this.meta.setPasskeyAuthState?.({status:"submitting-response"}),await this.api.post(Ee,{relying_party:this.meta.initRegisterResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(n)})}catch(e){if("NotAllowedError"===e.name)throw new he("Passkey request timed out or rejected by user.",void 0,Te.PASSKEY_NOT_ALLOWED);throw ge(e)}}async authenticate(){if(this.authenticateForRegistration)return this.register();let e=await import("@simplewebauthn/browser");if(!this.api)throw new he("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new he("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 n=await e.startAuthentication(this._transformInitAuthenticateOptionsToCamelCase({...this.meta.initAuthenticateResponse.options,allow_credentials:t}));return this.meta.setPasskeyAuthState?.({status:"submitting-response"}),await this.api.post(Se,{relying_party:this.meta.initAuthenticateResponse.relying_party,challenge:this.meta.initAuthenticateResponse.options.challenge,authenticator_response:this._transformAuthenticationResponseToSnakeCase(n)})}catch(e){if("NotAllowedError"===e.name)throw new he("Passkey request timed out or rejected by user.",void 0,Te.PASSKEY_NOT_ALLOWED);throw ge(e)}}async link(){let e=await import("@simplewebauthn/browser");if(!this.api)throw new he("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new he("WebAuthn is not supported in this browser");this.meta.initLinkResponse||(this.meta.initLinkResponse=await this.initLinkOnce.execute());try{let t=this.meta.initLinkResponse.options,n=await e.startRegistration(this._transformInitLinkOptionsToCamelCase(t));return this.meta.setPasskeyAuthState?.({status:"submitting-response"}),await this.api.post(_e,{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(n)})}catch(e){if("NotAllowedError"===e.name)throw new he("Passkey request timed out or rejected by user.",void 0,Te.PASSKEY_NOT_ALLOWED);throw ge(e)}}async _initRegisterOnce(e){if(!this.api)throw new he("Auth flow has no API instance");let t=oa(e);return await this.api.post(Ne,{token:this.meta.captchaToken},{headers:{...t}})}async _initAuthenticateOnce(e){if(!this.api)throw new he("Auth flow has no API instance");let t=oa(e);return await this.api.post(Me,{token:this.meta.captchaToken},{headers:{...t}})}async _initLinkOnce(){if(!this.api)throw new he("Auth flow has no API instance");return await this.api.post(We,{})}_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}}}_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}){this.authenticateForRegistration=!1,this.initRegisterOnce=new va(this._initRegisterOnce.bind(this)),this.initAuthenticateOnce=new va(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new va(this._initLinkOnce.bind(this)),this.meta={captchaToken:e,setPasskeyAuthState:t}}}const bi=({address:e,chainId:t,nonce:n})=>`${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: ${n}\nIssued At: ${(new Date).toISOString()}\nResources:\n- https://privy.io`;class ki{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 he("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.wallet?.walletClientType,connectorType:this.wallet?.connectorType,mode:this._meta.disableSignup?"no-signup":"login-or-sign-up"});if(!this.wallet)throw new he("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 ge(e)}}async link(){if(!this.client)throw new he("SiweFlow has no client instance");try{if(!this.wallet)throw new he("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 ge(e)}}async sign(){if(!this.client)throw new he("SiweFlow has no client instance");if(await this.buildMessage(),!this.preparedMessage)throw new he("Could not prepare SIWE message");if(!this.wallet)throw new he("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 he("SiweFlow has no client instance");if(!this.wallet)throw new he("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 he("SiweFlow has no client instance");if(!this.wallet)throw new he("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=bi({address:e,chainId:t,nonce:this.nonce}),this.preparedMessage}constructor(e,t,n,r=!1,a){this._meta={disableSignup:!1},this.getNonceOnce=new va(this._getNonceOnce.bind(this)),this.wallet=t,this.captchaToken=n,this.client=e,this._meta.disableSignup=r,this.preparedMessage=a?.message,this.signature=a?.signature}}const Ai=(...e)=>{if("undefined"==typeof Buffer)throw new he("Buffer is not defined.",void 0,Te.BUFFER_NOT_DEFINED);return Buffer.from(...e)},Ti=({address:e,nonce:t})=>`${window.location.host} wants you to sign in with your Solana account:\n${e}\n\n${`You are proving you own ${e}.`}\n\nURI: ${window.location.origin}\nVersion: 1\nChain ID: mainnet\nNonce: ${t}\nIssued At: ${(new Date).toISOString()}\nResources:\n- https://privy.io`;class xi{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 he("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 ge(e)}}async link(){if(!this.client)throw new he("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 ge(e)}}async sign(){let e,t;if(!this.client)throw new he("SiwsFlow has no client instance");await this.buildMessage();let n="transaction"===this.meta.messageType;if(!this.preparedMessage)throw new he("Could not prepare SIWS message");if(!n&&!this.wallet.signMessage||n&&!this.wallet.signTransaction)throw new he("Wallet does not support the necessary signing methods");if(n&&this._siwsTransactionMethods){let n=await this.wallet.signTransaction(this._siwsTransactionMethods.deserializeTransactionFromB64String(this.preparedMessage));e=n.serialize().toString("base64"),t=Ai(n.signatures[0]?.signature??Buffer.from("missing signature")).toString("base64")}else e=this.preparedMessage,t=Ai(await this.wallet.signMessage((new TextEncoder).encode(this.preparedMessage))).toString("base64");return{message:e,signature:t}}async _getNonceOnce(){if(!this.client)throw new he("SiwsFlow has no client instance");return await this.client.generateSiwsNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildMessage(){if(!this.client)throw new he("SiwsFlow has no client instance");let e=this.wallet.address;return this.nonce||(this.nonce=await this.getNonceOnce.execute()),"transaction"===this.meta.messageType&&this._siwsTransactionMethods?this.preparedMessage=this._siwsTransactionMethods.prepareSiwsTransactionWithMemo({address:e,nonce:this.nonce}):this.preparedMessage=Ti({address:e,nonce:this.nonce}),this.preparedMessage}constructor(e,t,n,r=!1,a="plain",i){this._meta={disableSignup:!1,messageType:"plain"},this.getNonceOnce=new va(this._getNonceOnce.bind(this)),this.wallet=e,this.captchaToken=n,this.client=t,this._meta.disableSignup=r,this._meta.messageType=a,this._siwsTransactionMethods=i}}class Ii{async authenticate(){if(!this.api)throw new he("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new he("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(Pe,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw ge(e)}}async link(){if(!this.api)throw new he("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new he("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(Ue,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(e){throw ge(e)}}async sendSmsCode({phoneNumber:e,captchaToken:t,withPrivyUi:n}){if(!this.api)throw new he("Auth flow has no API instance");if(e&&(this.meta.phoneNumber=e),t&&(this.meta.captchaToken=t),!this.meta.phoneNumber)throw new he("phone nNumber must be set when initialzing authentication.");let r=oa(n);try{return await this.api.post(Fe,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken},{headers:{...r}})}catch(e){throw ge(e)}}constructor({phoneNumber:e,captchaToken:t,disableSignup:n}){this.meta={phoneNumber:e,captchaToken:t,disableSignup:n??!1}}}class Ei extends Ii{async link(){if(!this.api)throw new he("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode||!this.meta.oldPhoneNumber)throw new he("Phone number, sms code, and an old phone number must be set prior to calling update.");try{return await this.api.post(Oe,{old_phone_number:this.meta.oldPhoneNumber,new_phone_number:this.meta.phoneNumber,code:this.meta.smsCode})}catch(e){throw ge(e)}}constructor(e,t,n){super({phoneNumber:t,captchaToken:n}),this.meta={phoneNumber:t,captchaToken:n,oldPhoneNumber:e,disableSignup:!1}}}const Si=e=>e.isApexWallet?"Apex Wallet":e.isAvalanche?"Core Wallet":e.isBackpack?"Backpack":e.isBifrost?"Bifrost Wallet":e.isBitKeep?"BitKeep":e.isBitski?"Bitski":e.isBlockWallet?"BlockWallet":e.isBraveWallet?"Brave Wallet":e.isClover?"Clover":e.isCoin98?"Coin98 Wallet":e.isCoinbaseWallet?"Coinbase Wallet":e.isDawn?"Dawn Wallet":e.isDefiant?"Defiant":e.isDesig?"Desig Wallet":e.isEnkrypt?"Enkrypt":e.isExodus?"Exodus":e.isFordefi?"Fordefi":e.isFrame?"Frame":e.isFrontier?"Frontier Wallet":e.isGamestop?"GameStop Wallet":e.isHaqqWallet?"HAQQ Wallet":e.isHyperPay?"HyperPay Wallet":e.isImToken?"ImToken":e.isHaloWallet?"Halo Wallet":e.isKuCoinWallet?"KuCoin Wallet":e.isMathWallet?"MathWallet":e.isNovaWallet?"Nova Wallet":e.isOkxWallet||e.isOKExWallet?"OKX Wallet":e.isOneInchIOSWallet||e.isOneInchAndroidWallet?"1inch Wallet":e.isOneKey?"OneKey Wallet":e.isOpera?"Opera":e.isPhantom||"isPhantom"in e?"Phantom":e.isPortal?"Ripio Portal":e.isRabby?"Rabby Wallet":e.isRainbow?"Rainbow":e.isSafePal?"SafePal Wallet":e.isStatus?"Status":e.isSubWallet?"SubWallet":e.isTalisman?"Talisman":e.isTally||e.isTaho?"Taho":e.isTokenPocket?"TokenPocket":e.isTokenary?"Tokenary":e.isTrust||e.isTrustWallet?"Trust Wallet":e.isTTWallet?"TTWallet":e.isXDEFI?"XDEFI Wallet":e.isZeal?"Zeal":e.isZerion?"Zerion":e.isMetaMask?"MetaMask":void 0,_i=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||"MetaMask"!==Si(e))return!1;if(e.providers)for(let t of e.providers)if(!_i(t))return!1;return!0},Ni=()=>{let e=window;if(!e.ethereum)return!1;if(e.ethereum.isCoinbaseWallet)return!0;if(e.ethereum.providers)for(let t of e.ethereum.providers)if(t&&t.isCoinbaseWallet)return!0;return!1},Mi=(e,t,n,r)=>{let a=Number(e),i=t.find((e=>e.id===a));if(!i)throw new Le(`Unsupported chainId ${e}`,4901);return Lt({transport:Rt(Wi(i,n,r.appId)),chain:i})},Wi=(e,t,n)=>{let r,a=e.id,i=Number(e.id);if(e.rpcUrls.privyWalletOverride&&e.rpcUrls.privyWalletOverride.http[0])r=e.rpcUrls.privyWalletOverride.http[0];else if(t.rpcUrls&&t.rpcUrls[i])r=t.rpcUrls[i];else if(e.rpcUrls.privy?.http[0]){let t=new URL(e.rpcUrls.privy.http[0]);t.searchParams.append("privyAppId",n),r=t.toString()}else r=e.rpcUrls.public?.http[0]?e.rpcUrls.public.http[0]:e.rpcUrls.default?.http[0];if(!r)throw new Le(`No RPC url found for ${a}`);return r},Pi=e=>!!String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),Ui=(e,t=3,n=4,r="ethereum")=>{if(!e)return"";let a="ethereum"===r?2:0;return t+n+a+3>=e.length?e:`${e.slice(0,a+t)}...${e.slice(e.length-n,e.length)}`},Fi=(e,t=3,n=4)=>Ui(e,t,n,"solana"),Oi=e=>new Promise((t=>setTimeout(t,e)));const Li=(e,t={})=>{let n=t.delayMs||150,r=t.maxAttempts||270;return new Promise((async(a,i)=>{let o=!1,s=0;for(;!o&&s<r;){if(t.abortSignal?.aborted)return;e().then((e=>{o=!0,a(e)}),((...e)=>{o=!0,i(...e)})),s+=1,await Oi(n)}o||i(Error("Exceeded max attempts before resolving function"))}))},Ri=(e,t,n={},r={})=>{let a=new URL(t,e);for(let[e,t]of Object.entries(n))void 0!==t&&a.searchParams.set(e,t);let i=Object.entries(r);if(i.length>0){let e=new URLSearchParams;for(let[t,n]of i)e.append(t,n);a.hash=e.toString()}return a.href},Di=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),Bi=e=>"string"==typeof e?e:"0x"+e.toString(16);async function zi({store:e,walletList:t,externalWalletConfig:n,walletChainType:r,timeout:a=3e3}){let i=!1,o=window;return new Promise((s=>{function l(){if(i)return;i=!0,window.removeEventListener("ethereum#initialized",l);let a=e.getProviders();console.debug("Detected injected providers:",a.map((e=>e.info)));let o=[];for(let e of a)t.includes("coinbase_wallet")&&"com.coinbase.wallet"===e.info.rdns||"solana-only"===r&&"app.phantom"===e.info.rdns||o.push({type:e.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:e});if("solana-only"!==r)for(let e of function(){let e=window,t=e.ethereum;if(!t)return[];let n=[];if(t.providers?.length)for(let e of t.providers)e&&n.push(e);return n.push(e.ethereum),n}()){let t=Si(e);if(!a.some((e=>e.info.name===t))){if(_i(e,!0)&&!o.find((e=>"metamask"===e.type))){o.push({type:"metamask",legacyInjectedProvider:e});continue}if("Phantom"===t&&!o.find((e=>"phantom"===e.type))){o.push({type:"phantom",legacyInjectedProvider:e});continue}if("Coinbase Wallet"===t&&!o.find((e=>"coinbase_wallet"===e.type&&"smartWalletOnly"!==n.coinbaseWallet?.config?.preference?.options))){o.push({type:"coinbase_wallet",legacyInjectedProvider:e});continue}o.find((e=>"unknown_browser_extension"===e.type))||o.push({type:"unknown_browser_extension",legacyInjectedProvider:e})}}s(o)}o.ethereum?l():(window.addEventListener("ethereum#initialized",l,{once:!0}),setTimeout((()=>{l()}),a))}))}function Hi(e){return`eip155:${String(Number(e))}`}const Vi=(e,t,n,r)=>{let a=Number(e),i=t.find((e=>e.id===a));if(!i)throw new Le(`Unsupported chainId ${e}`,4901);return Wi(i,n,r)},$i=e=>{let t={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},n=e.types.EIP712Domain??Object.entries(e.domain).map((([e,n])=>{if(null!=n&&"string"==typeof e&&e in t)return{name:e,type:t[e]}})).filter((e=>void 0!==e));return{...e,types:{...e.types,EIP712Domain:n}}};const ji=e=>e?.map((e=>({signer_id:e.signerId,override_policy_ids:e.policyIds}))),qi=/*#__PURE__*/c({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:Pt,setError:Pt,setExecuting:Pt,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:Pt,reset:Pt,execute:Pt});class Ki extends Re{constructor(e,t,n){super(e||"Captcha failed"),this.type="Captcha",t instanceof Error&&(this.cause=t),this.privyErrorCode=n}}const Gi=({children:e,id:n,captchaSiteKey:r,captchaEnabled:a})=>{let l=i(null),[c,d]=o(),[u,p]=o(),[h,m]=o(!1),g=s((()=>a?h||c||u?!h||c||u?c&&!u?{status:"success",token:c}:u?{status:"error",error:u}:{status:"ready"}:{status:"loading"}:{status:"ready"}:{status:"disabled"}),[a,c,u,h]);/*#__PURE__*/return t(qi.Provider,{value:{...g,ref:l,enabled:a,siteKey:r,appId:n,setToken:d,setError:p,setExecuting:m,remove(){a&&(l.current?.remove(),m(!1),p(void 0),d(void 0))},reset(){a&&(l.current?.reset(),m(!1),p(void 0),d(void 0))},execute(){a&&(m(!0),l.current?.execute())},async waitForResult(){if(!a)return"";try{return await function(e,{interval:t=100,timeout:n=5e3}={}){return new Promise(((r,a)=>{let i,o=0,s=()=>{o>=n?a("Max attempts reached without result"):(i=e(),o+=t,null==i?setTimeout(s,t):r(i))};s()}))}((()=>l.current?.getResponse()),{interval:200,timeout:2e4})}catch(e){throw new Ki("Captcha failed",null,Te.CAPTCHA_TIMEOUT)}}},children:e})},Zi=()=>l(qi);class Yi{async authenticate(){if(!this.api)throw new he("Auth flow has no API instance");try{return await this.api.post(De,{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 ge(e)}}async link(){if(!this.api)throw new he("Auth flow has no API instance");try{return await this.api.post(Be,{telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData})}catch(e){throw ge(e)}}constructor(e,t=!1){this.meta={disableSignup:!1},this.meta={captchaToken:e,disableSignup:!1},this.meta.disableSignup=t}}function Qi(e){let t={detail:"",retryable:!1};return e?.privyErrorCode===Te.LINKED_TO_ANOTHER_USER&&(t.detail="This account has already been linked to another user."),e?.privyErrorCode===Te.DISALLOWED_LOGIN_METHOD&&(t.detail="Login with Telegram not allowed."),e?.privyErrorCode===Te.INVALID_DATA&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===Te.CANNOT_LINK_MORE_OF_TYPE&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===Te.INVALID_CREDENTIALS&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===Te.TOO_MANY_REQUESTS&&(t.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode===Te.TOO_MANY_REQUESTS&&e.message.includes("rate limit")&&(t.detail="Request limit reached for Telegram. Please wait a moment and try again."),e instanceof Ki&&(t.retryable=!0,t.detail="Something went wrong. Try again."),t}function Xi(e){return Object.fromEntries(decodeURIComponent(e).split("&").map((e=>e.split("=").map(decodeURIComponent))))}function Ji(){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)}class eo{static parse(e){try{return new eo(e)}catch(e){return null}}static throwIfNotWellFormedJwt(e){return en.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=en.decodeJwt(e)}}class to extends eo{static parse(e){try{return new to(e)}catch(e){return null}}get appId(){return this._decoded.aid?this._decoded.aid:this.audience}}let no=e=>{if("ethereum"===e.chainType)return{entropyId:e.address,entropyIdVerifier:"ethereum-address-verifier"};if("solana"===e.chainType)return{entropyId:e.address,entropyIdVerifier:"solana-address-verifier"};throw Error("Failed to get account entropy details")};const ro=(e,t)=>{if(t?.imported)return no(t);let n=nn(e);if(!n)throw Error("Failed to find primary wallet");return no(n)},ao=({style:n,...r})=>/*#__PURE__*/e("svg",{viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...n},...r,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"})]}),io="data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PScwIDAgMTAyNCAxMDI0JyBmaWxsPSdub25lJyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHN0eWxlPSdoZWlnaHQ6MjhweDt3aWR0aDoyOHB4Jz48cmVjdCB3aWR0aD0nMTAyNCcgaGVpZ2h0PScxMDI0JyBmaWxsPScjMDA1MkZGJyByeD0nMTAwJyByeT0nMTAwJz48L3JlY3Q+PHBhdGggZmlsbC1ydWxlPSdldmVub2RkJyBjbGlwLXJ1bGU9J2V2ZW5vZGQnIGQ9J00xNTIgNTEyQzE1MiA3MTAuODIzIDMxMy4xNzcgODcyIDUxMiA4NzJDNzEwLjgyMyA4NzIgODcyIDcxMC44MjMgODcyIDUxMkM4NzIgMzEzLjE3NyA3MTAuODIzIDE1MiA1MTIgMTUyQzMxMy4xNzcgMTUyIDE1MiAzMTMuMTc3IDE1MiA1MTJaTTQyMCAzOTZDNDA2Ljc0NSAzOTYgMzk2IDQwNi43NDUgMzk2IDQyMFY2MDRDMzk2IDYxNy4yNTUgNDA2Ljc0NSA2MjggNDIwIDYyOEg2MDRDNjE3LjI1NSA2MjggNjI4IDYxNy4yNTUgNjI4IDYwNFY0MjBDNjI4IDQwNi43NDUgNjE3LjI1NSAzOTYgNjA0IDM5Nkg0MjBaJyBmaWxsPSd3aGl0ZSc+PC9wYXRoPjwvc3ZnPg==",oo="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAALZJREFUaEPtmjEOhDAMBNc/O14GvOzys3CAKK6eAlmaVGl2Zc+kTOU685vkc9/bnD2prZK5/TZY24z9P+g4F5hNh7/GdoG37WlAA5CATwgCxHENYISwQAMQII5rACOEBRqAAHFcAxghLNAABIjjGsAIYYEGIEAc1wBGCAs0AAHiuAYwQligAQgQxzWAEcICDUCAOK4BjBAWaAACxHENYISwQAMQII6fBjr+VHkW3+u+tfyxMpJaDgYzYxb/ALZVAAAAAElFTkSuQmCC";class so extends Le{constructor(){super("Wallet timeout"),this.type="wallet_error"}}class lo extends Le{constructor(){super("User rejected connection"),this.type="wallet_error"}}const co=e=>e instanceof Le?e:e?.code?new po(e):new Le("Unknown connector error",e);class uo extends Re{constructor(e,t,n){super(e),this.type="provider_error",this.code=t,this.data=n}}class po extends uo{constructor(e){super(e.message,e.code,e.data);let t=Object.values(T).find((t=>t.eipCode===e.code));this.details=t||T.UNKNOWN_ERROR,-32002===e.code&&(e.message?.includes("already pending for origin")?e.message?.includes("wallet_requestPermissions")?this.details=T.E32002_CONNECTION_ALREADY_PENDING:this.details=T.E32002_REQUEST_ALREADY_PENDING:e.message?.includes("Already processing")&&e.message.includes("eth_requestAccounts")&&(this.details=T.E32002_WALLET_LOCKED))}}const ho={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Wallet request timed out",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_USER_REJECTED_CONNECTION:{message:"You rejected the request",detail:"Please try connecting again.",retryable:!0},ERROR_USER_LIMIT_REACHED:{message:"Unable to link",detail:"You've reached the maximum number of linked wallets.",retryable:!1},...T};function mo(e){return"ethereum"===e.type}function go(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],a=t[n];if(r?.address!==a?.address||r&&a&&mo(r)&&mo(a)&&r?.chainId!==a?.chainId||r?.connectorType!==a?.connectorType||r?.connectedAt!==a?.connectedAt||r?.walletClientType!==a?.walletClientType||r?.isConnected!==a?.isConnected||r?.linked!==a?.linked)return!1}return!0}class yo extends fn{constructor(e){super(),this.walletClientType=e,this.connected=!1,this.initialized=!1}}const fo=(e,t)=>e.rpcTimeouts&&e.rpcTimeouts[t]||Va;let wo,vo;function Co(e){return"ethereum"===e.chainType}class bo extends yo{buildConnectedWallet(e,t,n,r){let a=async()=>!!this.wallets.find((t=>v(t.address)===v(e)));return{type:"ethereum",address:v(e),chainId:t,meta:n,imported:r,switchChain:async n=>{let r,i;if(!a)throw new Le("Wallet is not currently connected.");let o=this.wallets.find((t=>v(t.address)===v(e)))?.chainId;if(!o)throw new Le("Unable to determine current chainId.");if("number"==typeof n?(r=`0x${n.toString(16)}`,i=n):(r=n,i=Number(n)),o===Hi(r))return;let s=this.chains.find((e=>e.id===i));if(!s)throw new Le(`Unsupported chainId: ${n}`);let l=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:r}]})};try{return await l()}catch(e){if(((e,t)=>{switch(t){case"coinbase_wallet":case"base_account":return e.message.includes("addEthereumChain");case"rabby_wallet":return e.message.includes("Unrecognized chain ID");default:return 4902===e.code||e.message?.includes("4902")}})(e,this.walletClientType))return"rabby_wallet"===this.walletClientType&&await Oi(300),await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:r,chainName:s.name,nativeCurrency:s.nativeCurrency,rpcUrls:[s.rpcUrls.default?.http[0]??""],blockExplorerUrls:[s.blockExplorers?.default.url??""]}]}),l();if("rainbow"===this.walletClientType&&e.message?.includes("wallet_switchEthereumChain"))throw new Le(`Rainbow does not support the chainId ${t}`);throw e}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:a,getEthereumProvider:async()=>{if(!await a())throw new Le("Wallet is not currently connected.");return this.proxyProvider},sign:async e=>{if(!await a())throw new Le("Wallet is not currently connected.");return await this.sign(e)},disconnect:()=>{this.disconnect()}}}async syncAccounts(e){let t,n=e;try{if(void 0===n){let e=await Li((()=>this.proxyProvider.request({method:"eth_accounts"})),{maxAttempts:10,delayMs:500});console.debug(`eth_accounts for ${this.walletClientType}:`,e),Array.isArray(e)&&(n=e)}}catch(e){console.debug("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.",e)}if(!n||!Array.isArray(n)||n.length<=0||!n[0])return;let r=n[0],a=v(r),i=[];if("privy"===this.walletClientType){let e=ua.get(Ba(a));this.chains.find((t=>t.id===Number(e)))||(ua.del(Ba(a)),e=null),t=e||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:t}]})}catch(e){console.warn(`Unable to switch embedded wallet to chain ID ${t} on initialization`)}}else try{let e=await Li((()=>this.proxyProvider.request({method:"eth_chainId"})),{maxAttempts:10,delayMs:500});if(console.debug(`eth_chainId for ${this.walletClientType}:`,e),"string"==typeof e)t=e;else{if("number"!=typeof e)throw Error("Invalid chainId returned from provider");t=`0x${e.toString(16)}`}}catch(e){console.warn("Failed to get chainId from provider, defaulting to 0x1",e),t="0x1"}let o=Hi(t);if(!i.find((e=>v(e.address)===a))){let e={name:this.walletBranding.name,icon:"string"==typeof this.walletBranding.icon?this.walletBranding.icon:void 0,id:this.walletBranding.id};i.push(this.buildConnectedWallet(v(r),o,e,"embedded_imported"===this.connectorType))}go(i,this.wallets)||(this.wallets=i,this.emit("walletsUpdated"))}async getConnectedWallet(){let e=await this.proxyProvider.request({method:"eth_accounts"});return this.wallets.sort(((e,t)=>t.connectedAt-e.connectedAt)).find((t=>e.find((e=>v(e)===v(t.address)))))||null}async isConnected(){let e=await this.proxyProvider.request({method:"eth_accounts"});return Array.isArray(e)&&e.length>0}async sign(e){return await this.connect({showPrompt:!1}),this.proxyProvider.request({method:"personal_sign",params:[C(e),this.wallets[0]?.address]})}subscribeListeners(){this.proxyProvider.on("accountsChanged",this.onAccountsChanged),this.proxyProvider.on("chainChanged",this.onChainChanged),this.proxyProvider.on("disconnect",this.onDisconnect),this.proxyProvider.on("connect",this.onConnect)}unsubscribeListeners(){this.proxyProvider.removeListener("accountsChanged",this.onAccountsChanged),this.proxyProvider.removeListener("chainChanged",this.onChainChanged),this.proxyProvider.removeListener("disconnect",this.onDisconnect),this.proxyProvider.removeListener("connect",this.onConnect)}constructor(e,t,n,r){super(e),this.chainType="ethereum",this.onAccountsChanged=e=>{0===e.length?this.onDisconnect():this.syncAccounts(e)},this.onChainChanged=e=>{this.wallets.forEach((t=>{t.chainId=Hi(e),"privy"===this.walletClientType&&ua.put(Ba(t.address),e)})),this.emit("walletsUpdated")},this.onDisconnect=()=>{this.connected=!1,this.wallets=[],this.emit("walletsUpdated")},this.onConnect=async()=>{"base_account"===this.connectorType&&this.connected||(this.connected=!0,"coinbase_wallet"===this.connectorType&&await Oi(500),this.syncAccounts())},this.wallets=[],this.walletClientType=e,this.chains=t,this.defaultChain=n,this.rpcConfig=r,this.rpcTimeoutDuration=fo(r,e),this.connected=!1,this.initialized=!1}}class ko{on(e,t){if(this.walletProvider)return this.walletProvider.on(e,t);this._subscriptions.push({eventName:e,listener:t})}async request(e){if(!this.walletProvider)throw new Le(`A wallet request of type ${e.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(e),this.walletTimeout()]).catch((e=>{throw co(e)}))}constructor(e,t){this.removeListener=(e,t)=>{if(this.walletProvider)try{return this.walletProvider.removeListener(e,t)}catch(e){console.warn("Unable to remove wallet provider listener")}},this.walletTimeout=(e=new so,t=this.rpcTimeoutDuration)=>new Promise(((n,r)=>setTimeout((()=>{r(e)}),t))),this.setWalletProvider=e=>{this.walletProvider&&this._subscriptions.forEach((e=>{this.removeListener(e.eventName,e.listener)})),this.walletProvider=e,this._subscriptions.forEach((e=>{this.walletProvider?.on(e.eventName,e.listener)}))},this.walletProvider=e,this.rpcTimeoutDuration=t||Va,this._subscriptions=[]}}class Ao extends bo{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:oo,id:"com.coinbase.wallet"}}async promptConnection(){try{await this.importPromise;let e=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!e||0===e.length||!e[0])throw new Le("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([e[0]])}catch(e){throw co(e)}}constructor(e,t,n,r,a){super("base_account",e,t,n),this.connectorType="base_account",this.walletClientType="base_account",this.displayName="Base",this.setBaseAccountSdk=a,this.proxyProvider=new ko(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.baseAccountConfig={...r,appChainIds:[t.id].concat(e.map((e=>e.id)))},wo?(this.proxyProvider.setWalletProvider(wo.getProvider()),this.setBaseAccountSdk(wo),console.log("Base Account SDK Initialized")):this.importPromise=import("@base-org/account").then((({createBaseAccountSDK:e})=>{wo=e(this.baseAccountConfig),this.proxyProvider.setWalletProvider(wo.getProvider()),this.setBaseAccountSdk(wo),console.log("Base Account SDK Initialized")})).catch(console.error)}}let To=[1,11155111,137,10,8453,84532,42161,7777777,43114,56];class xo extends bo{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:io,id:"com.coinbase.wallet"}}async promptConnection(){try{let e=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!e||0===e.length||!e[0])throw new Le("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([e[0]])}catch(e){throw co(e)}}updateConnectionPreference(e){this.coinbaseWalletConfig={...this.coinbaseWalletConfig,preference:{...this.coinbaseWalletConfig.preference,options:e}},this.walletClientType="smartWalletOnly"===e?"coinbase_smart_wallet":"coinbase_wallet",vo=wn({...this.coinbaseWalletConfig}),this.proxyProvider.setWalletProvider(vo.getProvider())}constructor(e,t,n,r){if(super("coinbase_wallet",e,t,n),this.connectorType="coinbase_wallet",this.displayName="Coinbase Wallet",this.proxyProvider=new ko(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.coinbaseWalletConfig={...r,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"),!vo){let e="eoaOnly"!==this.coinbaseWalletConfig.preference?.options?(this.coinbaseWalletConfig.appChainIds??[]).filter((e=>!To.includes(e))):[];e.length>0&&!e.every((e=>x.has(e)))&&console.info(`The configured chains are not supported by Coinbase Smart Wallet: ${e.join(", ")}`),vo=wn(this.coinbaseWalletConfig)}this.proxyProvider.setWalletProvider(vo.getProvider())}}const Io=({...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 Eo extends bo{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:[Bi(e?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:Io,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}constructor({provider:e,chains:t,defaultChain:n,rpcConfig:r,imported:a,walletIndex:i}){super("privy",t,n,r),this.connectorType="embedded",this.proxyProvider=e,this.walletIndex=i,a&&(this.connectorType="embedded_imported"),this.subscribeListeners()}}const So=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4","csw_signUserOperation","secp256k1_sign"];class _o extends Error{constructor(e,t,n){super(e),this.code=t,this.data=n}}class No extends fn{async handleSendTransaction(e){if(!e.params||!Array.isArray(e.params))throw new _o(`Invalid params for ${e.method}`,4200);let t=e.params[0];if(!await QA()||!this.address)throw new _o("Disconnected",4900);let{hash:n}=await tT(t,{address:this.address});return n}async handleSignTransaction(e){if(!e.params||!Array.isArray(e.params))throw new _o(`Invalid params for ${e.method}`,4200);let t=e.params[0];if(!await QA()||!this.address)throw new _o("Disconnected",4900);let{signature:n}=await eT(t,{address:this.address});return n}handleSwitchEthereumChain(e){let t;if(!e.params||!Array.isArray(e.params))throw new _o(`Invalid params for ${e.method}`,4200);if("string"==typeof e.params[0])t=e.params[0];else{if(!("chainId"in e.params[0])||"string"!=typeof e.params[0].chainId)throw new _o(`Invalid params for ${e.method}`,4200);t=e.params[0].chainId}this.chainId=Number(t),this.publicClient=Mi(this.chainId,this.chains,this.rpcConfig,{appId:this.appId}),this.emit("chainChanged",t)}async handlePersonalSign(e){if(!e.params||!Array.isArray(e.params))throw Error("Invalid params for personal_sign");let t=e.params[0],n=e.params[1],{signature:r}=await XA({message:t},{address:n});return r}async handleSignedTypedData(e){if(!e.params||!Array.isArray(e.params))throw Error("Invalid params for eth_signTypedData_v4");let t=e.params[0],n="string"==typeof e.params[1]?JSON.parse(e.params[1]):e.params[1],{signature:r}=await JA($i(n),{address:t});return r}async handleEstimateGas(e){if(!e.params||!Array.isArray(e.params))throw Error("Invalid params for eth_estimateGas");delete e.params[0].gasPrice,delete e.params[0].maxFeePerGas,delete e.params[0].maxPriorityFeePerGas;let t={...e.params[0],chainId:Bi(this.chainId)};return await this.publicClient.estimateGas({account:t.from??this.address,...vn(t)})}async request(e){switch(console.debug("Embedded1193Provider.request() called with args",e),e.method){case"eth_accounts":case"eth_requestAccounts":return this.address?[this.address]:[];case"eth_chainId":return Bi(this.chainId);case"eth_estimateGas":return this.handleEstimateGas(e);case"eth_sendTransaction":return this.handleSendTransaction(e);case"eth_signTransaction":return this.handleSignTransaction(e);case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(e);case"personal_sign":return this.handlePersonalSign(e);case"eth_signTypedData_v4":return this.handleSignedTypedData(e)}if(!(e=>So.includes(e))(e.method))return this.publicClient.request({method:e.method,params:e.params});{let t=await QA();if(await nT({address:this.address}),!t||!this.address)throw new _o("Disconnected",4900);try{let n={method:e.method,params:e.params},r=this.walletAccount;return r&&rn(r)?this.handleWalletApiRequest(n,r,t):(await this.walletProxy.rpc({accessToken:t,entropyId:this.entropyId,entropyIdVerifier:this.entropyIdVerifier,chainType:"ethereum",hdWalletIndex:this.walletIndex,request:n})).response.data}catch(e){throw console.error(e),new _o("Disconnected",4900)}}}async handleWalletApiRequest(e,t,n){let r=this.privyClient;if(!r)throw new _o("Disconnected",4900);if("secp256k1_sign"===e.method){let a=await I(r,(async({message:e})=>this.walletProxy.signWithUserSigner({accessToken:n,message:e})),{chain_type:"ethereum",method:"secp256k1_sign",wallet_id:t.id,params:{hash:e.params[0]}});if("secp256k1_sign"!==a.method)throw new _o(`Invalid params for ${e.method}`,4200);return a.data.signature}throw new _o(`Method not supported: ${e.method}`,4200)}constructor({walletProxy:e,address:t,entropyId:n,entropyIdVerifier:r,rpcConfig:a,chains:i,appId:o,chainId:s=1,walletIndex:l,privyClient:c,walletAccount:d}){super(),this.walletProxy=e,this.address=t,this.entropyId=n,this.entropyIdVerifier=r,this.chainId=s,this.rpcConfig=a,this.chains=i,this.publicClient=Mi(s,this.chains,a,{appId:o}),this.rpcTimeoutDuration=fo(a,"privy"),this.appId=o,this.walletIndex=l,this.privyClient=c,this.walletAccount=d}}class Mo extends bo{get walletBranding(){return{id:this.id,name:this.name,icon:this.icon}}async initialize(){this.initialized=!0,this.emit("initialized")}async connect(){throw Error("connect called for an uninstalled wallet via the EthereumNullConnector")}disconnect(){throw Error("disconnect called for an uninstalled wallet via the EthereumNullConnector")}promptConnection(e){throw Error(`promptConnection called for an uninstalled wallet via the EthereumNullConnector for ${e}`)}constructor({id:e,name:t,icon:n,walletClientType:r,defaultChain:a}){super(r,[],a,{}),this.connectorType="null",this.proxyProvider=new ko(void 0,Va),this.id=e,this.name=t,this.icon=n,this.connectorType=r}}const Wo=({style:e,...n})=>/*#__PURE__*/t("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...n,children:/*#__PURE__*/t("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})}),Po=({...n})=>/*#__PURE__*/e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",...n,children:[/*#__PURE__*/t("rect",{width:"32",height:"32",rx:"6",fill:"#121314"}),/*#__PURE__*/t("g",{transform:"translate(4, 4)",children:/*#__PURE__*/e("svg",{width:"24",height:"24",viewBox:"0 0 318.6 318.6",children:[/*#__PURE__*/t("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),/*#__PURE__*/t("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),/*#__PURE__*/t("path",{d:"m44.4 35.5 98.7 74.6-17.5-44.3zm193.9 171.3-26.5 40.6 56.7 15.6 16.3-55.3zm-204.4.9L50.1 263l56.7-15.6-26.5-40.6z",className:"s1 s2"}),/*#__PURE__*/t("path",{d:"m103.6 138.2-15.8 23.9 56.3 2.5-2-60.5zm111.3 0-39-34.8-1.3 61.2 56.2-2.5zM106.8 247.4l33.8-16.5-29.2-22.8zm71.1-16.5 33.9 16.5-4.7-39.3z",className:"s1 s2"}),/*#__PURE__*/t("path",{fill:"#d7c1b3",stroke:"#d7c1b3",className:"s1",d:"m211.8 247.4-33.9-16.5 2.7 22.1-.3 9.3zm-105 0 31.5 14.9-.2-9.3 2.5-22.1z"}),/*#__PURE__*/t("path",{fill:"#233447",stroke:"#233447",className:"s1",d:"m138.8 193.5-28.2-8.3 19.9-9.1zm40.9 0 8.3-17.4 20 9.1z"}),/*#__PURE__*/t("path",{fill:"#cd6116",stroke:"#cd6116",className:"s1",d:"m106.8 247.4 4.8-40.6-31.3.9zM207 206.8l4.8 40.6 26.5-39.7zm23.8-44.7-56.2 2.5 5.2 28.9 8.3-17.4 20 9.1zm-120.2 23.1 20-9.1 8.2 17.4 5.3-28.9-56.3-2.5z"}),/*#__PURE__*/t("path",{fill:"#e4751f",stroke:"#e4751f",className:"s1",d:"m87.8 162.1 23.6 46-.8-22.9zm120.3 23.1-1 22.9 23.7-46zm-64-20.6-5.3 28.9 6.6 34.1 1.5-44.9zm30.5 0-2.7 18 1.2 45 6.7-34.1z"}),/*#__PURE__*/t("path",{d:"m179.8 193.5-6.7 34.1 4.8 3.3 29.2-22.8 1-22.9zm-69.2-8.3.8 22.9 29.2 22.8 4.8-3.3-6.6-34.1z",className:"s3"}),/*#__PURE__*/t("path",{fill:"#c0ad9e",stroke:"#c0ad9e",className:"s1",d:"m180.3 262.3.3-9.3-2.5-2.2h-37.7l-2.3 2.2.2 9.3-31.5-14.9 11 9 22.3 15.5h38.3l22.4-15.5 11-9z"}),/*#__PURE__*/t("path",{fill:"#161616",stroke:"#161616",className:"s1",d:"m177.9 230.9-4.8-3.3h-27.7l-4.8 3.3-2.5 22.1 2.3-2.2h37.7l2.5 2.2z"}),/*#__PURE__*/t("path",{fill:"#763d16",stroke:"#763d16",className:"s1",d:"m278.3 114.2 8.5-40.8-12.7-37.9-96.2 71.4 37 31.3 52.3 15.3 11.6-13.5-5-3.6 8-7.3-6.2-4.8 8-6.1zM31.8 73.4l8.5 40.8-5.4 4 8 6.1-6.1 4.8 8 7.3-5 3.6 11.5 13.5 52.3-15.3 37-31.3-96.2-71.4z"}),/*#__PURE__*/t("path",{d:"m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z",className:"s3"})]})})]}),Uo=({style:n,...r})=>/*#__PURE__*/e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"108",height:"108",viewBox:"0 0 108 108",fill:"none",style:{height:"28px",width:"28px",...n},...r,children:[/*#__PURE__*/t("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),/*#__PURE__*/t("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M46.5267 69.9229C42.0054 76.8509 34.4292 85.6182 24.348 85.6182C19.5824 85.6182 15 83.6563 15 75.1342C15 53.4305 44.6326 19.8327 72.1268 19.8327C87.768 19.8327 94 30.6846 94 43.0079C94 58.8258 83.7355 76.9122 73.5321 76.9122C70.2939 76.9122 68.7053 75.1342 68.7053 72.314C68.7053 71.5783 68.8275 70.7812 69.0719 69.9229C65.5893 75.8699 58.8685 81.3878 52.5754 81.3878C47.993 81.3878 45.6713 78.5063 45.6713 74.4598C45.6713 72.9884 45.9768 71.4556 46.5267 69.9229ZM83.6761 42.5794C83.6761 46.1704 81.5575 47.9658 79.1875 47.9658C76.7816 47.9658 74.6989 46.1704 74.6989 42.5794C74.6989 38.9885 76.7816 37.1931 79.1875 37.1931C81.5575 37.1931 83.6761 38.9885 83.6761 42.5794ZM70.2103 42.5795C70.2103 46.1704 68.0916 47.9658 65.7216 47.9658C63.3157 47.9658 61.233 46.1704 61.233 42.5795C61.233 38.9885 63.3157 37.1931 65.7216 37.1931C68.0916 37.1931 70.2103 38.9885 70.2103 42.5795Z",fill:"#FFFDF8"})]});function Fo(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var Oo=0;class Lo extends bo{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}get walletBranding(){return{name:this.providerDetail.info.name,icon:this.providerDetail.info.icon,id:this.providerDetail.info.rdns}}disconnect(){console.warn(`Programmatic disconnect with ${this.providerDetail.info.name} is not yet supported.`)}async promptConnection(){try{let e=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!e||0===e.length||!e[0])throw new Le("Unable to retrieve accounts");await this.syncAccounts([e[0]])}catch(e){throw co(e)}}constructor(e,t,n,r,a){super(a||"unknown",e,t,n),this.connectorType="injected",this.proxyProvider=new ko(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=r;let i=r.provider;this.proxyProvider.setWalletProvider(i)}}var Ro="__private_"+Oo+++"__walletBranding";class Do extends bo{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}get walletBranding(){return Fo(this,Ro)[Ro]??{name:"Browser Extension",icon:Wo,id:"extension"}}disconnect(){console.warn("Programmatic disconnect with browser wallets is not yet supported.")}async promptConnection(){try{let e=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!e||0===e.length||!e[0])throw new Le("Unable to retrieve accounts");await this.syncAccounts([e[0]])}catch(e){throw co(e)}}constructor(e,t,n,r,a){super(a??"unknown",e,t,n),Object.defineProperty(this,Ro,{writable:!0,value:void 0}),this.connectorType="injected",this.proxyProvider=new ko(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(r),"metamask"===a?Fo(this,Ro)[Ro]={name:"MetaMask",icon:Po,id:"io.metamask"}:"phantom"===a&&(Fo(this,Ro)[Ro]={name:"Phantom",icon:Uo,id:"phantom"})}}class Bo extends Lo{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{g||await this.proxyProvider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let e=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!e||0===e.length||!e[0])throw new Le("Unable to retrieve accounts");await this.syncAccounts([e[0]])}catch(e){throw co(e)}}}const zo=["metamask","phantom","brave_wallet","rainbow","uniswap_wallet_extension","uniswap_extension","rabby_wallet","bybit_wallet","ronin_wallet","haha_wallet","crypto.com_wallet_extension","crypto.com_onchain","binance","bitkeep","coinbase_wallet","coinbase_smart_wallet","base_account","metamask","trust","safe","rainbow","uniswap","zerion","argent","spot","omni","cryptocom","blockchain","safepal","bitkeep","zengo","1inch","binance","exodus","mew_wallet","alphawallet","keyring_pro","mathwallet","unstoppable","obvious","ambire","internet_money_wallet","coin98","abc_wallet","arculus_wallet","haha","cling_wallet","broearn","copiosa","burrito_wallet","enjin_wallet","plasma_wallet","avacus","bee","pitaka","pltwallet","minerva","kryptogo","prema","slingshot","kriptonio","timeless","secux","bitizen","blocto","okx_wallet","safemoon","rabby_wallet","bybit_wallet","ronin_wallet","haha_wallet","privy","unknown","phantom","solflare","glow","backpack","mobile_wallet_adapter"],Ho=Object.freeze({phantom:{client:"phantom",name:"Phantom",installLink:m.isFirefox?"https://addons.mozilla.org/en-US/firefox/addon/phantom-app/":"https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa?hl=en",chainTypes:["ethereum","solana"],get isInstalled(){if("phantom"in window){let e=window;if(e?.phantom?.ethereum?.isPhantom&&e?.phantom?.ethereum?.chainId||e?.phantom?.solana?.isPhantom)return!0}return!1},getMobileRedirect({useUniversalLink:e,isSolana:t,connectOnly:n}){let r=$o({client:this.client,isSolana:t,connectOnly:n});return`${e?"phantom://":"https://phantom.app/ul/"}browse/${r}?ref=${r}`}},solflare:{client:"solflare",name:"Solflare",installLink:m.isFirefox?"https://addons.mozilla.org/es/firefox/addon/solflare-wallet/":"https://chromewebstore.google.com/detail/solflare-wallet/bhhhlbepdkbapadjdnnojkbgioiodbic",chainTypes:["solana"],get isInstalled(){return"solflare"in window&&!!window?.solflare?.isSolflare},getMobileRedirect({useUniversalLink:e,isSolana:t,connectOnly:n}){let r=$o({client:this.client,isSolana:t,connectOnly:n});return`${e?"solflare://ul/v1/":"https://solflare.com/ul/v1/"}browse/${r}?ref=${r}`}},backpack:{client:"backpack",name:"Backpack",installLink:"https://chromewebstore.google.com/detail/backpack/aflkmfhebedbjioipglgcbcmnbpgliof",chainTypes:["ethereum","solana"],get isInstalled(){return!(!("backpack"in window)||!window?.backpack?.ethereum?.isBackpack&&!window?.backpack?.solana?.isBackpack)},getMobileRedirect({useUniversalLink:e,isSolana:t,connectOnly:n}){let r=$o({client:this.client,isSolana:t,connectOnly:n});return`${e?"backpack://ul/v1/":"https://backpack.com/ul/v1/"}browse/${r}?ref=${r}`}},okx_wallet:{client:"okx_wallet",name:"OKX Wallet",installLink:"https://chromewebstore.google.com/detail/okx-wallet/mcohilncbfahbmgdjkbpemcciiolgcge",chainTypes:["solana"],get isInstalled(){return"okxwallet"in window&&!!window?.okxwallet?.isOkxWallet},getMobileRedirect({isSolana:e,connectOnly:t}){return"https://www.okx.com/download?deeplink="+encodeURIComponent("okx://wallet/dapp/url?dappUrl="+$o({client:this.client,isSolana:e,connectOnly:t}))}}});function Vo({connectorType:e,walletClientType:t}){for(let n of zo)if(e===n||t===n)return Ho[n]}function $o({client:e,isSolana:t,connectOnly:n}){let r=new URL(window.location.href);return r.searchParams.set("privy_connector",t?"solana_adapter":"injected"),r.searchParams.set("privy_wallet_client",e),r.searchParams.set("privy_connect_only",String(n)),encodeURIComponent(r.href.replace(/\/$/g,""))}const jo=()=>{let e=ua.get(Ha);return e&&Array.isArray(e)&&e.map((e=>(e=>e&&"string"==typeof e.address&&"string"==typeof e.connectorType&&"string"==typeof e.walletClientType&&"number"==typeof e.connectedAt)(e))).every(Boolean)?e:[]};let qo=["phantom","glow","solflare","backpack","okx_wallet","walletconnect","mobile_wallet_adapter"];function Ko(e){return e.toLowerCase().split(" ").join("_")}class Go extends yo{get isInstalled(){return"Installed"===this.adapter.readyState}get wallet(){return this.adapter.wallet}buildConnectedWallet(e,t){let n,r,a,i;if("Installed"!==e.readyState||!e.publicKey)throw Error("Wallet is not connected.");return"signMessage"in e&&(n=async(...t)=>{if(!e.connected)throw Error("Wallet is not connected.");return await e.signMessage(t[0])}),"sendTransaction"in e&&(r=async(...t)=>await e.sendTransaction(t[0],t[1],t[2])),"signTransaction"in e&&(a=async t=>await e.signTransaction(t)),"signAllTransactions"in e&&(i=async t=>await e.signAllTransactions(t)),{type:"solana",address:e.publicKey.toBase58(),meta:t,imported:!1,connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:async()=>e.connected,disconnect:()=>{try{e.disconnect()}catch(e){console.error("Wallet does not support programmatic disconnect")}},getProvider:Ut(`${this.walletClientType||""} wallet does not support 'getProvider'`),signMessage:n??Ut(`${this.walletClientType||""} wallet does not support 'signMessage'`),sendTransaction:r??Ut(`${this.walletClientType||""} wallet does not support 'sendTransaction'`),signTransaction:a??Ut(`${this.walletClientType||""} wallet does not support 'signTransaction'`),signAllTransactions:i??Ut(`${this.walletClientType||""} wallet does not support 'signAllTransactions'`)}}async syncAccounts(){if("Installed"===this.adapter.readyState&&this.adapter.publicKey){let e={name:this.walletBranding.name,icon:"string"==typeof this.walletBranding.icon?this.walletBranding.icon:void 0,id:this.walletBranding.id};this.wallets.find((e=>this.adapter.publicKey&&e.address===this.adapter.publicKey.toBase58()))||(this.wallets=[this.buildConnectedWallet(this.adapter,e)],this.emit("walletsUpdated"))}else this.wallets.length>0&&(this.wallets=[],this.emit("walletsUpdated"))}get walletBranding(){return{id:this.adapter.name,name:this.adapter.name,icon:this.adapter.icon}}async initialize(){this.subscribeListeners(),await this.syncAccounts(),this.shouldAttemptAutoConnect()&&await this.adapter.autoConnect().catch((()=>{})),this.initialized=!0,this.emit("initialized")}async connect(e){return e.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}async getConnectedWallet(){return this.wallets.sort(((e,t)=>t.connectedAt-e.connectedAt))[0]||null}async isConnected(){return this.adapter.connected&&["Installed"].includes(this.adapter.readyState)}subscribeListeners(){this.adapter.addListener("disconnect",this.onDisconnect),this.adapter.addListener("connect",this.onConnect),this.adapter.addListener("error",this.onError),this.adapter.addListener("readyStateChange",this.onReadyStateChange)}unsubscribeListeners(){this.adapter.removeAllListeners()}shouldAttemptAutoConnect(){return!(!this.autoConnectEnabled||!qo.includes(this.walletClientType))&&("phantom"!==this.walletClientType||jo().some((({walletClientType:e})=>"phantom"===e)))}constructor(e,t){super(Ko(e.name)),this.chainType="solana",this.connectorType="solana_adapter",this.disconnect=()=>{this.adapter.disconnect().then((()=>this.onDisconnect())).catch((e=>console.error("Error disconnecting",e)))},this.promptConnection=async()=>{try{await this.adapter.connect()}catch(e){throw co(e)}},this.onDisconnect=()=>{this.syncAccounts()},this.onConnect=e=>{this.syncAccounts()},this.onError=e=>{this.syncAccounts()},this.onReadyStateChange=e=>{"Installed"!==e&&(this.connected=!1),this.syncAccounts()},this.adapter=e,this.autoConnectEnabled=t,this.wallets=[]}}class Zo extends Go{get walletBranding(){return{id:this.id,name:this.name,icon:this.icon}}async initialize(){this.initialized=!0,this.emit("initialized")}async connect(){throw Error("connect called for an uninstalled wallet via the SolanaNullConnector")}constructor({id:e,name:t,icon:n}){super({name:t},!1),this.connectorType="null",this.proxyProvider=new ko(void 0,Va),this.disconnect=async()=>{throw Error("disconnect called for an uninstalled wallet via the SolanaNullConnector")},this.promptConnection=async()=>{throw Error("promptConnection called for an uninstalled wallet via the SolanaNullConnector")},this.id=e,this.name=t,this.icon=n}}function Yo(e){return"solana"===e.chainType}function Qo(e){return"solana"===e.type}const Xo=Ln((()=>({listings:[]}))),Jo=Xo.setState,es=e=>{let t;try{t=new URL(e).hostname}catch(e){return}return Xo.getState().listings.find((({homepage:e})=>{let n;try{n=new URL(e).hostname}catch(e){return!1}return t.includes(n)}))},ts=e=>Xo((({listings:t})=>t.find((({slug:t})=>ns(t)===ns(e)))));function ns(e){return"cryptocom"===e?"cryptocom-defi":"binance"===e?"binance-defi":e.replace(/[-_]wallet$/,"")}function rs({src:e,...n}){/*#__PURE__*/return t("img",{src:e,...n,style:{display:"none"}})}const as={appearance:{landingHeader:"Log in or sign up",theme:"light",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","base_account","wallet_connect"]},walletConnectCloudProjectId:"34357d3c125c2bcf2ce2bc3309d98715",externalWallets:{coinbaseWallet:{connectionOptions:"all"}},embeddedWallets:{extendedCalldataDecoding:!1},captchaEnabled:!1,_render:{standalone:!1},fundingMethodConfig:{moonpay:{useSandbox:!1}}};let is=new Set(["coinbase_wallet","base_account","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","universal_profile","bybit_wallet","ronin_wallet","haha_wallet","wallet_connect","wallet_connect_qr","detected_wallets","detected_solana_wallets","detected_ethereum_wallets","rabby_wallet","safe","solflare","backpack","binance","binanceus","bitkeep"]),os=e=>is.has(e),ss=(e,t,n)=>n.indexOf(e)===t;const ls=792703809,cs="11111111111111111111111111111111";function ds(e){return e.includes("testnet")?"testnet":e.includes("devnet")?"devnet":"mainnet-beta"}function us(e,t){return`https://explorer.solana.com/account/${e}?cluster=${t}`}function ps(e,t){let n=Math.max(0,Math.min(1,e.toHsl().l+t));return In({...e.toHsl(),l:n})}function hs(e,t){let n=e.getLuminance(),r=t.getLuminance();return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function ms({backgroundTheme:e,accentHex:t}){let n,r;"light"===e?n=!1:"dark"===e?n=!0:(n=.5>=In(e).getLuminance(),r=In(e).toHslString());let a=n?"dark":"light",i=n?gs:ys,{accent:o,accentLight:s,accentHover:l,accentDark:c,accentDarkest:d}=function(e,t){if(!e){let e=t?gs:ys;return{accent:In(e.background.interactive),accentLight:In(e.background.interactive),accentHover:In(e.background["interactive-hover"]),accentDark:In(e.background["interactive-clicked"]),accentDarkest:In(e.background["interactive-disabled"])}}let n=In(e);return{accent:n,accentLight:ps(n,.15),accentHover:ps(n,.3),accentDark:ps(n,-.06),accentDarkest:ps(n,-.6)}}(t,n),u=function(e){let t=In(ys.text.default),n=In(gs.text.default),r=hs(e,t),a=hs(e,n),i=e.toHsl();return i.h>=220&&i.h<=300&&a>=3?gs.text.default:r>a?ys.text.default:gs.text.default}(o),p=In(u),h=hs(o,In(i.background.default))>=3;return{colorScheme:a,background:r||i.background.default,background2:i.background.elevated,background3:i.background.interactive,foreground:i.text.default,foreground2:i.text.muted,foreground3:i.text.placeholder,foreground4:i.border.default,accent:o.toHslString(),accentLight:s.toHslString(),accentHover:l.toHslString(),accentDark:c.toHslString(),accentDarkest:d.toHslString(),foregroundAccent:p.toHslString(),success:i.background.success,successDark:i.text.success,successLight:i.background.success,error:i.text.error,errorLight:i.background.error,warn:i.background.warning,warnLight:i.background.warning,warningDark:i.text.warning,errorDark:i.text.error,successBg:i.background.success,errorBg:i.background.error,errorBgHover:i.background["error-hover"],warnBg:i.background.warning,infoBg:i.background.info,infoBgHover:i.background["info-hover"],borderDefault:i.border.default,borderHover:i.border["default-hover"],borderFocus:i.border.focused,borderError:i.border.error,borderSuccess:i.border.success,borderWarning:i.border.warning,borderInfo:i.border.info,borderInteractive:i.border.interactive,borderInteractiveHover:i.border["interactive-hover"],backgroundHover:i.background["default-hover"],backgroundClicked:i.background["default-clicked"],backgroundDisabled:i.background["default-disabled"],backgroundInteractive:i.background.interactive,backgroundInteractiveHover:i.background["interactive-hover"],backgroundInteractiveClicked:i.background["interactive-clicked"],backgroundInteractiveDisabled:i.background["interactive-disabled"],foregroundHover:i.text.default,foregroundClicked:i.text.default,foregroundDisabled:i.text["default-disabled"],foregroundInteractive:i.text.interactive,foregroundInteractiveHover:i.text["interactive-hover"],accentHasGoodContrast:h?"1":"0",linkNavigationColor:h?o.toHslString():i.text.default,linkNavigationDecoration:h?"none":"underline",iconDefault:i.icon.default,iconMuted:i.icon.muted,iconSubtle:i.icon.subtle,iconInverse:i.icon.inverse,iconSuccess:i.icon.success,iconWarning:i.icon.warning,iconError:i.icon.error,iconInteractive:i.icon.interactive,iconDefaultHover:i.icon["default-hover"],iconMutedHover:i.icon["muted-hover"],iconSubtleHover:i.icon["subtle-hover"],iconDefaultClicked:i.icon["default-clicked"],iconMutedClicked:i.icon["muted-clicked"],iconSubtleClicked:i.icon["subtle-clicked"],iconDefaultDisabled:i.icon["default-disabled"],iconMutedDisabled:i.icon["muted-disabled"],iconSubtleDisabled:i.icon["subtle-disabled"],iconErrorHover:i.icon["error-hover"],iconInteractiveHover:i.icon["interactive-hover"],iconErrorClicked:i.icon["error-clicked"],iconInteractiveClicked:i.icon["interactive-clicked"],iconMutedDisabledAlt:i.icon["muted-disabled"],iconSubtleDisabledAlt:i.icon["subtle-disabled"]}}const gs={background:{default:"#020713",elevated:"#1A2230","default-hover":"#101724","elevated-hover":"#242B3B","default-clicked":"#1A2230","elevated-clicked":"#2C3444","default-disabled":"#020713","elevated-disabled":"#141824",success:"#0E3E2D",warning:"#373827",error:"#2E0C18",interactive:"#8B86FF","error-hover":"#441821","interactive-hover":"#7B73E5","interactive-clicked":"#6560CC","interactive-disabled":"#141824",info:"#1F2937","info-hover":"#141824"},icon:{default:"#F8F8F8",muted:"#9BA2AE",subtle:"#7B8491",inverse:"#020713",success:"#88E3B5",warning:"#FDF27B",error:"#EF4444",interactive:"#88B6FF","default-hover":"#F8F8F8","muted-hover":"#AEB3BD","subtle-hover":"#8B939E","default-clicked":"#F8F8F8","muted-clicked":"#9097A5","subtle-clicked":"#78818E","default-disabled":"#404452","muted-disabled":"#404452","subtle-disabled":"#404452","error-hover":"#F05555","interactive-hover":"#7B73E5","error-clicked":"#EF4444","interactive-clicked":"#6560CC","muted-disabled-alt":"#404452","subtle-disabled-alt":"#404452"},text:{default:"#F8F8F8",muted:"#9BA2AE",placeholder:"#7B8491",inverse:"#020713",success:"#ACEECB",warning:"#FEF9A0",error:"#FCA5A5",interactive:"#A29EFF","default-hover":"#F8F8F8","muted-hover":"#9BA2AE","placeholder-hover":"#656C78","default-clicked":"#F8F8F8","muted-clicked":"#9BA2AE","placeholder-clicked":"#656C78","default-disabled":"#404452","muted-disabled":"#404452","placeholder-disabled":"#404452","error-hover":"#FA8B8B","interactive-hover":"#8C88E5","error-clicked":"#F87171","interactive-clicked":"#7671CC","error-disabled":"#404452","interactive-disabled":"#404452"},border:{default:"#1F2937",primary:"#110F2A",interactive:"#88B0FF",focused:"#F8F8FC",info:"#5B83D3",success:"#317056",warning:"#FBBF24",error:"#F87171","default-hover":"#34304A","interactive-hover":"#88B0FF","default-clicked":"#1F2937","interactive-clicked":"#88B0FF","default-active":"#F8F8F8","default-disabled":"#1F2937","interactive-disabled":"#1F2937","error-hover":"#971B1C","error-clicked":"#971B1C","error-disabled":"#1F2937"}},ys={background:{default:"#FFFFFF",elevated:"#F1F2F9","default-hover":"#F8F9FC","elevated-hover":"#E8E9F4","default-clicked":"#F1F2F9","elevated-clicked":"#DFE0EF","default-disabled":"#FFFFFF","elevated-disabled":"#F1F2F9",success:"#DCFCE7",warning:"#FEF3C7",error:"#FEE2E2",interactive:"#5B4FFF","error-hover":"#FECACA","interactive-hover":"#4F46E5","interactive-clicked":"#4338CA","interactive-disabled":"#F1F2F9",info:"#E0E7FF","info-hover":"#EEF2FF"},icon:{default:"#110F2A",muted:"#64668B",subtle:"#9498B8",inverse:"#FFFFFF",success:"#33B287",warning:"#F59E0B",error:"#EF4444",interactive:"#564FFF","default-hover":"#1D1B35","muted-hover":"#64668B","subtle-hover":"#888AAE","default-clicked":"#060C23","muted-clicked":"#64668B","subtle-clicked":"#788804","default-disabled":"#CBCDE1","muted-disabled":"#CBCDE1","subtle-disabled":"#CBCDE1","error-hover":"#F06060","interactive-hover":"#4F46E5","error-clicked":"#DC3838","interactive-clicked":"#2BA482","error-disabled":"#CBCDE1","interactive-disabled":"#CBCDE1"},text:{default:"#040217",muted:"#64668B",placeholder:"#9498B8",inverse:"#FFFFFF",success:"#135638",warning:"#906218",error:"#991B1B",interactive:"#5B4FFF","default-hover":"#040217","muted-hover":"#64668B","placeholder-hover":"#9498B8","default-clicked":"#040217","muted-clicked":"#64668B","placeholder-clicked":"#9498B8","default-disabled":"#CBCDE1","muted-disabled":"#CBCDE1","placeholder-disabled":"#CBCDE1","error-hover":"#991B1B","interactive-hover":"#5B4FFF","error-clicked":"#991B1B","interactive-clicked":"#5B4FFF","error-disabled":"#CBCDE1","interactive-disabled":"#CBCDE1"},border:{default:"#E2E3F0",primary:"#110F2A",interactive:"#5B4FFF",focused:"#949DF9",info:"#F1F2F9",success:"#87D7B7",warning:"#FACD63",error:"#F69393","default-hover":"#E2E3F0","interactive-hover":"#5B4FFF","default-clicked":"#E2E3F0","interactive-clicked":"#5B4FFF","default-active":"#110F2A","default-disabled":"#E2E3F0","interactive-disabled":"#E2E3F0","error-hover":"#F69393","error-clicked":"#F69393","error-disabled":"#E2E3F0"}};function fs(e,t,n,r){let a,i,o,s,l,c,d,u,p,h,m,g,y,f,w,v,C=n?console.warn:()=>{};t?.loginMethods?(a=t.loginMethods.includes("email"),i=t.loginMethods.includes("sms"),s=t.loginMethods.includes("wallet"),l=t.loginMethods.includes("google"),c=t.loginMethods.includes("twitter"),d=t.loginMethods.includes("discord"),h=t.loginMethods.includes("spotify"),m=t.loginMethods.includes("instagram"),u=t.loginMethods.includes("tiktok"),p=t.loginMethods.includes("line"),y=t.loginMethods.includes("github"),g=t.loginMethods.includes("linkedin"),f=t.loginMethods.includes("apple"),w=t.loginMethods.includes("farcaster"),v=t.loginMethods.includes("telegram"),o=t.loginMethods.includes("passkey")):(a=e.email_auth,i=e.sms_auth,s=e.wallet_auth||e.solana_wallet_auth,l=e.google_oauth,c=e.twitter_oauth,d=e.discord_oauth,y=e.github_oauth,h=e.spotify_oauth,m=e.instagram_oauth,u=e.tiktok_oauth,p=e.line_oauth,g=e.linkedin_oauth,f=e.apple_oauth,w=e.farcaster_auth,v=e.telegram_auth,o=e.passkey_auth),e.passkey_auth&&(o=!0),"undefined"!=typeof window&&"function"!=typeof window.PublicKeyCredential&&(o=!1);let b=[a,i].filter(Boolean),k=[l,c,d,y,h,m,u,p,g,f,w,v].filter(Boolean),A=[s].filter(Boolean),T=t?.loginMethods?.includes("passkey")??!1,x=e.passkeys_for_signup_enabled??!1,I=[o&&(x||T)].filter(Boolean);if(b.length+k.length+A.length+I.length===0)throw Error("You must enable at least one login method");let N=void 0!==t?.appearance?.showWalletLoginFirst?t?.appearance?.showWalletLoginFirst:e.show_wallet_login_first;N&&0===A.length?(C("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),N=!1):N||k.length+b.length!==0||(C("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),N=!0);let M=t?.externalWallets?.walletConnect?.enabled??!0;t?.loginMethods&&t.loginMethodsAndOrder&&C("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let W=(({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(os).filter(ss):e?e.filter(os).filter(ss):as.appearance.walletList)({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),P=(({input:e})=>{if(!e||!e.primary[0])return;let t=[e.primary[0]],n=[];for(let n of(e.primary.length>4&&console.warn("You should not specify greater than 4 login methods in `loginMethodsAndOrder.primary`"),e.primary.slice(1)))t.includes(n)?console.warn(`Duplicated login method: ${n}`):t.push(n);for(let r of e.overflow??[])t.includes(r)||n.includes(r)?console.warn(`Duplicated login method: ${r}`):n.push(r);return{primary:t,overflow:n}})({input:t?.loginMethodsAndOrder}),U=t?.intl?.defaultCountry??"US",{chains:F,defaultChain:O}=function({supportedChains:e,defaultChainFromConfig:t}){let n;if(e){if(0===e.length)throw Error("`supportedChains` must contain at least one chain");n=E(e)}else n=[...S];let r=e?n[0]:_,a=t??r;if(!n.find((e=>e.id===a.id)))throw Error("`defaultChain` must be included in `supportedChains`");return{chains:n,defaultChain:a}}({supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain}),L=!!t?.defaultChain,R=t?.customAuth?.getCustomAccessToken&&!1!==t?.customAuth?.enabled,D=t?.embeddedWallets?.requireUserPasswordOnCreate,B=t?.embeddedWallets?.createOnLogin,z=R?"all-users":e.embedded_wallet_config.ethereum.create_on_login,H=e.embedded_wallet_config.solana.create_on_login,V={"mainnet-beta":{rpcUrl:"https://api.mainnet-beta.solana.com",blockExplorerUrl:"https://explorer.solana.com"},testnet:{rpcUrl:"https://api.testnet.solana.com",blockExplorerUrl:"https://explorer.solana.com/?cluster=testnet"},devnet:{rpcUrl:"https://api.devnet.solana.com",blockExplorerUrl:"https://explorer.solana.com/?cluster=devnet"}};if(t?.solanaClusters)for(let e of t.solanaClusters){let{name:t,rpcUrl:n,blockExplorerUrl:r}=e;V[t]={rpcUrl:n??V[t].rpcUrl,blockExplorerUrl:r??V[t].blockExplorerUrl}}e.solana_wallet_auth&&!t?.externalWallets?.solana?.connectors&&console.warn("App configuration has Solana wallet login enabled, but no Solana wallet connectors have been passed to Privy. Make sure to pass Solana connectors to the `config.externalWallets.solana.connectors` field of the `PrivyProvider`");let $=e.telegram_auth_config?{botId:e.telegram_auth_config.bot_id,botName:e.telegram_auth_config.bot_name,linkEnabled:e.telegram_auth_config.link_enabled,seamlessAuthEnabled:e.telegram_auth_config.seamless_auth_enabled}:void 0,j=e.funding_config?{methods:e.funding_config.methods,options:e.funding_config.options,defaultRecommendedAmount:e.funding_config.default_recommended_amount,defaultRecommendedCurrency:e.funding_config.default_recommended_currency,promptFundingOnWalletCreation:e.funding_config.prompt_funding_on_wallet_creation,crossChainBridgingEnabled:e.funding_config.cross_chain_bridging_enabled}:void 0;return{id:e.id,name:e.name,allowlistConfig:{errorTitle:e.allowlist_config.error_title,errorDetail:e.allowlist_config.error_detail,errorCtaText:e.allowlist_config.cta_text,errorCtaLink:e.allowlist_config.cta_link},legacyWalletUiConfig:e.legacy_wallet_ui_config,appearance:{logo:t?.appearance?.logo??e.logo_url??void 0,landingHeader:t?.appearance?.landingHeader??as.appearance.landingHeader,loginMessage:"string"==typeof t?.appearance?.loginMessage?t?.appearance?.loginMessage.slice(0,100):t?.appearance?.loginMessage,footerLogo:t?.appearance?.footerLogo,palette:ms({backgroundTheme:t?.appearance?.theme??as.appearance.theme,accentHex:t?.appearance?.accentColor??e.accent_color}),loginGroupPriority:N?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:W,walletChainType:t?.appearance?.walletChainType??(({evmWalletAuth:e,solanaWalletAuth:t})=>e&&t?"ethereum-and-solana":e?"ethereum-only":t?"solana-only":"ethereum-only")({evmWalletAuth:e.wallet_auth??!1,solanaWalletAuth:e.solana_wallet_auth??!1})},loginMethods:{wallet:s,email:a,sms:i,passkey:o,google:l,twitter:c,discord:d,github:y,spotify:h,instagram:m,tiktok:u,line:p,linkedin:g,apple:f,farcaster:w,telegram:v},disablePlusEmails:e.disable_plus_emails,loginMethodsAndOrder:P,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.terms_and_conditions_url,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacy_policy_url,requireUsersAcceptTerms:e.require_users_accept_terms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.wallet_connect_cloud_project_id??as.walletConnectCloudProjectId,rpcConfig:{rpcUrls:{},rpcTimeouts:t?.externalWallets?.signatureRequestTimeouts??{}},chains:F,solanaClusters:V,defaultChain:O,intl:{defaultCountry:U},shouldEnforceDefaultChainOnConnect:L,captchaEnabled:e.captcha_enabled??as.captchaEnabled,captchaSiteKey:e.captcha_site_key,externalWallets:{coinbaseWallet:{config:{appName:e.name,appLogoUrl:e.logo_url,preference:{options:t?.externalWallets?.coinbaseWallet?.connectionOptions??as.externalWallets.coinbaseWallet.connectionOptions,...t?.externalWallets?.coinbaseWallet?.config?.preference},...t?.externalWallets?.coinbaseWallet?.config}},baseAccount:{config:{appName:e.name,appLogoUrl:e.logo_url,...t?.externalWallets?.baseAccount?.config,preference:{...t?.externalWallets?.baseAccount?.config?.preference,telemetry:!1}}},walletConnect:{enabled:M,appKit:t?.externalWallets?.walletConnect?.appKit},solana:{connectors:t?.externalWallets?.solana?.connectors},disableAllExternalWallets:t?.externalWallets?.disableAllExternalWallets??!1},embeddedWallets:{requireUserOwnedRecoveryOnCreate:D??(!R&&(e.embedded_wallet_config.require_user_owned_recovery_on_create??!1)),userOwnedRecoveryOptions:R?["user-passcode"]:e.embedded_wallet_config.user_owned_recovery_options,priceDisplay:t?.embeddedWallets?.priceDisplay??{primary:"fiat-currency",secondary:"native-token"},ethereum:{createOnLogin:B??t?.embeddedWallets?.ethereum?.createOnLogin??z},solana:{createOnLogin:t?.embeddedWallets?.solana?.createOnLogin??H},disableAutomaticMigration:t?.embeddedWallets?.disableAutomaticMigration??!1,mode:e.embedded_wallet_config.mode,showWalletUIs:t?.embeddedWallets?.showWalletUIs??e.enforce_wallet_uis??!0,extendedCalldataDecoding:t?.embeddedWallets?.extendedCalldataDecoding??!1,transactionScanning:{enabled:t?.embeddedWallets?.transactionScanning?.enabled??!1,domain:t?.embeddedWallets?.transactionScanning?.domain??r??"https://auth.privy.io"}},mfa:{methods:e.mfa_methods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},passkeys:{shouldUnlinkOnUnenrollMfa:t?.passkeys?.shouldUnlinkOnUnenrollMfa,shouldUnenrollMfaOnUnlink:t?.passkeys?.shouldUnenrollMfaOnUnlink},customAuth:R?{enabled:!0,...t.customAuth}:void 0,loginConfig:{telegramAuthConfiguration:$,passkeysForSignupEnabled:e.passkeys_for_signup_enabled},headless:!!t?.headless,render:{standalone:t?._render?.standalone??as._render.standalone},fundingConfig:j,fundingMethodConfig:{...t?.fundingMethodConfig??as.fundingMethodConfig,moonpay:{...t?.fundingMethodConfig?.moonpay??as.fundingMethodConfig.moonpay,useSandbox:t?.fundingMethodConfig?.moonpay.useSandbox??t?.fiatOnRamp?.useSandbox??as.fundingMethodConfig.moonpay.useSandbox}},whatsAppEnabled:!!e.whatsapp_enabled,customOAuthRedirectUrl:t?.customOAuthRedirectUrl,solanaRpcs:{"solana:mainnet":t?.solana?.rpcs?.["solana:mainnet"]??null,"solana:devnet":t?.solana?.rpcs?.["solana:devnet"]??null,"solana:testnet":t?.solana?.rpcs?.["solana:testnet"]??null}}}const ws={show_wallet_login_first:!0,allowlist_config:{error_title:null,error_detail:null,cta_text:null,cta_link:null},wallet_auth:!0,email_auth:!0,sms_auth:!1,google_oauth:!1,twitter_oauth:!1,discord_oauth:!1,github_oauth:!1,linkedin_oauth:!1,apple_oauth:!1,disable_plus_emails:!1,terms_and_conditions_url:null,privacy_policy_url:null,embedded_wallet_config:{create_on_login:"off",ethereum:{create_on_login:"off"},solana:{create_on_login:"off"},require_user_owned_recovery_on_create:!1,user_owned_recovery_options:["user-passcode"],mode:"user-controlled-server-wallets-only"},fiat_on_ramp_enabled:!1,captcha_enabled:!1,captcha_site_key:"",enforce_wallet_uis:!1,legacy_wallet_ui_config:!1,id:"",name:"",passkeys_for_signup_enabled:!1,whatsapp_enabled:!1},vs=fs(ws,void 0,!1);let Cs=/*#__PURE__*/c({appConfig:vs,isServerConfigLoaded:!1});const bs=({children:e,client:n,legacyClient:r,clientConfig:a})=>{let[i,l]=o(null),c=s((()=>fs(i??ws,a,!!i,"undefined"!=typeof window?window.location.origin:void 0)),[i,a]);return d((()=>{if(!i)return;let e=function(e){if(!e)return{};let{appearance:t,supportedChains:n,defaultChain:r,externalWallets:a,...i}=e;return{...i,...n?{supportedChains:n.map((e=>e.id))}:void 0,...r?{defaultChain:r.id}:void 0,...a?{walletConnect:a.walletConnect?{enabled:a.walletConnect.enabled}:void 0,coinbaseWallet:a.coinbaseWallet,solana:{connectors:a.solana?.connectors?.get().map((e=>e.walletClientType))}}:void 0}}(a),t=function(e,t=0){let n=3735928559^t,r=1103547991^t;for(let t,a=0;a<e.length;a++)n=Math.imul(n^(t=e.charCodeAt(a)),2654435761),r=Math.imul(r^t,1597334677);return n=Math.imul(n^n>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),4294967296*(2097151&(r=Math.imul(r^r>>>16,2246822507)^Math.imul(n^n>>>13,3266489909)))+(n>>>0)}(JSON.stringify(e)).toString(),n=`privy:sent:${i.id}:${t}`;localStorage.getItem(n)||(r.createAnalyticsEvent({eventName:"sdk_initialize",payload:e}),localStorage.setItem(n,"t"))}),[a,i]),d((()=>{i||(async()=>{try{await n.initialize();let e=n.app.getConfig();e.custom_api_url&&r.updateApiUrl(e.custom_api_url),l(e)}catch(e){console.warn("Error generating app config: ",e)}})()}),[]),/*#__PURE__*/t(Cs.Provider,{value:{appConfig:c,isServerConfigLoaded:!!i},children:e})},ks=()=>{let{appConfig:e}=l(Cs);return e},As=()=>{let{isServerConfigLoaded:e}=l(Cs);return e},Ts=/*#__PURE__*/c({app:vs,currentScreen:null,lastScreen:null,navigate:Pt,navigateBack:Pt,resetNavigation:Pt,setModalData:Pt,onUserCloseViaDialogOrKeybindRef:void 0}),xs=n=>{let r=ks(),a=n.authenticated,[s,l]=o(n.initialScreen);d((()=>{a||!n.initialScreen||n.initialScreen.isUnauthenticatedScreem||n.setInitialScreen(null)}),[a]);let c=i(null);d((()=>{n.open||(c.current=null)}),[n.open]),d((()=>{c.current=null}),[n.initialScreen]);let u={app:r,data:n.data,setModalData:n.setModalData,currentScreen:n.initialScreen,lastScreen:s,navigate:(e,t=!0)=>{n.setInitialScreen(e),t&&l(n.initialScreen)},navigateBack:()=>{n.setInitialScreen(s)},resetNavigation:()=>{n.setInitialScreen(null),l(null)},onUserCloseViaDialogOrKeybindRef:c};/*#__PURE__*/return e(Ts.Provider,{value:u,children:[("string"==typeof r.appearance.logo||"img"===r.appearance.logo?.type)&&/*#__PURE__*/t(rs,{src:"string"==typeof r.appearance.logo?r.appearance.logo:r.appearance.logo.props.src}),n.children]})},Is=()=>l(Ts),Es=({style:n,...r})=>{let{app:a}=Is();/*#__PURE__*/return e("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...n},...r,children:[/*#__PURE__*/t("rect",{width:"28",height:"28",rx:"3",fill:"dark"===a?.appearance.palette.colorScheme?"#3396ff":"#141414"}),/*#__PURE__*/t("g",{clipPath:"url(#clip0_1765_9946)",children:/*#__PURE__*/t("path",{d:"M8.09448 10.3941C11.3558 7.20196 16.6442 7.20196 19.9055 10.3941L20.2982 10.7782C20.3369 10.8157 20.3677 10.8606 20.3887 10.9102C20.4097 10.9599 20.4206 11.0132 20.4206 11.0671C20.4206 11.121 20.4097 11.1744 20.3887 11.224C20.3677 11.2737 20.3369 11.3186 20.2982 11.3561L18.9554 12.6702C18.9158 12.7086 18.8628 12.7301 18.8077 12.7301C18.7526 12.7301 18.6996 12.7086 18.66 12.6702L18.1198 12.1415C15.8448 9.91503 12.1557 9.91503 9.88015 12.1415L9.30167 12.7075C9.26207 12.7459 9.20909 12.7673 9.15395 12.7673C9.0988 12.7673 9.04582 12.7459 9.00622 12.7075L7.66346 11.3934C7.62475 11.3559 7.59397 11.3109 7.57295 11.2613C7.55193 11.2117 7.5411 11.1583 7.5411 11.1044C7.5411 11.0505 7.55193 10.9971 7.57295 10.9475C7.59397 10.8979 7.62475 10.8529 7.66346 10.8154L8.09448 10.3941ZM22.6829 13.1115L23.8776 14.2814C23.9163 14.319 23.9471 14.3639 23.9681 14.4135C23.9892 14.4632 24 14.5165 24 14.5704C24 14.6243 23.9892 14.6777 23.9681 14.7273C23.9471 14.777 23.9163 14.8219 23.8776 14.8594L18.4893 20.1332C18.4102 20.2101 18.3042 20.2531 18.1938 20.2531C18.0835 20.2531 17.9775 20.2101 17.8984 20.1332L14.0743 16.3901C14.0545 16.3708 14.0279 16.36 14.0003 16.36C13.9726 16.36 13.9461 16.3708 13.9263 16.3901L10.1021 20.1332C10.023 20.2101 9.91703 20.2531 9.8067 20.2531C9.69636 20.2531 9.59038 20.2101 9.51124 20.1332L4.12236 14.8594C4.08365 14.8219 4.05287 14.777 4.03185 14.7273C4.01083 14.6777 4 14.6243 4 14.5704C4 14.5165 4.01083 14.4632 4.03185 14.4135C4.05287 14.3639 4.08365 14.319 4.12236 14.2814L5.31767 13.1115C5.39678 13.0348 5.50265 12.9919 5.61285 12.9919C5.72305 12.9919 5.82892 13.0348 5.90803 13.1115L9.73216 16.8546C9.75194 16.874 9.7785 16.8848 9.80616 16.8848C9.83381 16.8848 9.86037 16.874 9.88015 16.8546L13.7043 13.1115C13.7834 13.0346 13.8894 12.9916 13.9997 12.9916C14.1101 12.9916 14.216 13.0346 14.2952 13.1115L18.1198 16.8546C18.1396 16.874 18.1662 16.8848 18.1938 16.8848C18.2215 16.8848 18.2481 16.874 18.2678 16.8546L22.092 13.1115C22.1711 13.0346 22.2771 12.9916 22.3874 12.9916C22.4977 12.9916 22.6037 13.0346 22.6829 13.1115Z",fill:"white"})}),/*#__PURE__*/t("defs",{children:/*#__PURE__*/t("clipPath",{id:"clip0_1765_9946",children:/*#__PURE__*/t("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})},Ss="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAHdElNRQfoDAIVODUC+w+GAAAGsUlEQVRYw6WXbYwWVxXHf+fOLAtCXYS2QJdIaClipGCTknXXNqBQMVHbfmhItH4Aral+IAEaG03UxJgYKQJGTUxtDWjaxDSNtcZqIGDwpRuW1oYiVqpdpZSlpC3qysu+PHPP3w/3mXnmeXZbPzjJZO7cefn/z/mfe865xlscq3dGDIguGiHLaMQVLja4s87FShcLo5jtApdddnHexUmHIy475JmdUkPRAQMu7gzT4ljnxJpdk0QPmMFkyAKN2OfOFpc2uuh1J3MZDrjAvXmVEQUuoosRxw642FcEG7IoDxiFxNiu8NYE+vcUYIFYRKKs113bXWx2Z34CoQZsVHOiCZ7mopdzdsFhv8NexEgRDHMxUSNREbh1bwNZwBsFblmfu/a4a6AEENYO5i3AOoEWeEUCF4MOOxBDMQAOk99OJALA2u80sBCwWGBZWG/yRwMaCAbBIAsQTJT3gea1OWfNeaPzvjoHEI85rA8ObtB1v7cIdJkIHgkh9AXpocy0LJjIKvB2wPpZB0v3wkrw5jdNEjeYeMhFX3BAyfn2ke9NUrgB9LrrcZcGJFCld4fWNddXbvbWfWzGR6xJFZsBGh0cBh3bBIxIEGTQ3W0h4NuDaSAzyAxCmGq11Vzf5uaa1aG8p+WFtrEYQGwvjICJkAEqvC+YNmcmMlMNvEaCdrcbyUvQAWDTjVuESHObM6cPGWHmzDwLaEtmzG9Z3qF1zUpXmuuZBb1z4bqeNC6f0WE1NtUTwHzEloiy3BvFisy0sYoLlQtT6XW15md2Qf9SY+2Ngfdca/TMSm/9ewz+/Boc/It45h/i4kSTsKw90SQJsPTvjSZbkWemDW7qTRZ0JEYJWSKxZJ7xmf6M224MzMzbX1s8F1YugjtvMg6eErt/4/z1jUrz1rXUKxnZC2zIg2mdBTK1mFUOKC1fOt/48kdzVixIz86Nij+eEacvpJWyZJ5xy7th8VzjjpuMJfMCW58QL73ekXPVlhsyE+vyzFiplJyauEIyrGIquruMq7qTxk+dcB495rzyTzFepCUWLIFv/kBg081Gd55WUk1IDGFTS89K++TDYxddzKnWcbluHd450xgdh7EGrOo1rr868PMTzqWJRGZ2d8oB/xpL33Xnxl2rjeNn4blXRXduzJ4B5y+28kWscAwXl+yeR654FFZPHoUb710YuPeDOUdPO48di1xptKpeEeHqOcYXNwQKGd88EDk3mqxtxPSfGRlsXRtYt8z4ytPOH/7eqpg1Aso7fYKgK4NPrMpYvsC4/poMA34yVJIQC3sCD9yecdsNyaV5yPj6ryJnR1PAvSNP4J+/1cgDfLbfePaMGGtM7Qdyl12WmKOmXgKKAp54vmBRTxfLrjE+tSYjBPjRM5FrrzIeuD2jf2lLzw8vN4JlfPVp581LsO1DgXv7jSzAiXPw/d+JiYLpjsu26Yfjf5O0rF5WoxsNT9G/bX0XKxakmPjlSee6HlizJJXSX7/oRDc+vjKR+f2wODcKd78/gR8/C9uedF44myJxmhh4OY/ipMQyqaWxmjn95TfEroMFOzbkvG+RceeqViPx1Aln1yEnOow1AnffHCpJAJ5/Vex4UvzptZRdY/O/1dJIS/NkcNmR6MTYah6qzseA4TfFtw4UvHBW1bc/O+7sPhwZHYf/jMODh5yfPudVbXj2TAJ/8XxrOZagNamj4Ei2/GNfuyRxh8t6BG2l15up+MIVODEiFr8rcPS0+O6RBF6mrrEGHHtFzOo2Lo7Dl37hvPQ6mNV6R9JYKgnYWcE37K5HlE2OT/5A0udaPUBHH+BQOMzuNsYLuDyZflTW+fTcmJFDHhJhaZqewMuewXDxcDR9IYyPN6Jj+6K4MF2vV8qBtZJScqVRNi6lpGONVJis5mpKi1WbgwsY+zIsBpcR8mzIZfuTRVZrtdu9odrptR/Xx5XONXJqBmCN0P6YMUQq9WJiwt0Je102WHdbpxSqydMObBWYdwDWLVcqcIMYe3NPjg0Ht84od0Ajju1w2XCr9e6QoqM9V23ZtnmI6cfAMMb9AY0YEHdb6oobEh4y3H3Ize6LsmGvN5IdUnhttdQ9UVrfLk/ljWEZ9wXsqAdQk1EA+O22GcgdZTke/bAs3OPY4HSdcB20HhvVtTMu0jmI8ekAhz2IICj2hKpNqI60NcuIRUHEej1quzubXa2tmZhenrfZmv3YYQ9ipDAIgvHptmblccuDjdRcmjFpWbDi/9ycZjZkRbk5jYztai/AUwiUx+qdEQB/m+25i9lxyvbcjrg45Lmd0uT/3p7/Fw6ODf+WO019AAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDI0LTEyLTAyVDIxOjU2OjQ4KzAwOjAwMVpslgAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyNC0xMi0wMlQyMTo1Njo0OCswMDowMEAH1CoAAAAodEVYdGRhdGU6dGltZXN0YW1wADIwMjQtMTItMDJUMjE6NTY6NTMrMDA6MDDZv6GRAAAAAElFTkSuQmCC";class _s extends bo{async initialize(){let e=await this.createProvider();this.provider=e,this.proxyProvider.setWalletProvider(e),this.subscribeListeners(),e.session&&(this.walletProvider?.session?.peer.metadata.url&&(this.walletEntry=es(this.walletProvider?.session?.peer.metadata.url),this.walletClientType=this.walletEntry?.slug||"unknown"),this.connected=!0,await this.syncAccounts()),this.initialized=!0,this.emit("initialized"),this.modal?.subscribeState((e=>{e.open||this.walletProvider?.session||!this.onQrModalClosed||this.onQrModalClosed()}))}async connect(e){return e.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return!!this.walletProvider?.connected}get walletBranding(){let e=this.walletProvider?.session?.peer.metadata.icons?.[0];return{name:Di(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:"string"==typeof e?e:Ss,id:this.walletProvider?.session?.peer.metadata.name.toLowerCase()||"wallet_connect_v2"}}async resetConnection(e){this.walletProvider&&this.walletProvider.connected&&(await this.walletProvider.disconnect(),this.walletProvider.signer.session=void 0,this.walletClientType=e,this.redirectUri=void 0,this.fallbackUniversalRedirectUri=void 0,function(){try{localStorage.removeItem(ma)}catch{}}(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise(((e,t)=>{this.onQrModalClosed=()=>{t(new lo)},(async()=>{let t="",n=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(n?.length&&(t=n[0]),!t||""===t)throw new Le("Unable to retrieve address");this.walletProvider?.session?.peer.metadata.url&&(this.walletEntry=es(this.walletProvider?.session?.peer.metadata.url),this.walletClientType=this.walletEntry?.slug||"unknown",this.proxyProvider.rpcTimeoutDuration=fo(this.rpcConfig,this.walletClientType)),this.connected=!0,await this.syncAccounts(n),e()})().catch((e=>{t(e?co(e):new Le("Unknown error during connection"))})).finally((()=>this.modal?.close()))}))}disconnect(){this.walletProvider?.disconnect().then((()=>this.onDisconnect())).catch((()=>console.warn("Unable to disconnect WalletConnect provider")))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(e){this.proxyProvider.setWalletProvider(e)}async createProvider(){let e={};for(let t of this.chains){let n=Vi(t.id,this.chains,this.rpcConfig,this.privyAppId);n&&(e[t.id]=n)}let t=this.shouldEnforceDefaultChainOnConnect?[this.defaultChain.id]:[],n=this.chains.map((e=>e.id)),r=await mr.init({projectId:this.walletConnectCloudProjectId,chains:t,optionalChains:n,optionalEvents:gr,optionalMethods:yr,rpcMap:e,showQrModal:!1,metadata:{description:this.privyAppName,name:this.privyAppName,url:window.location.origin,icons:[]}});return r.on("display_uri",(e=>{if(r.signer.abortPairingAttempt(),function(){try{localStorage.removeItem(ma)}catch{}}(),!this.showPrivyQrModal){if(!this.modal)throw new Le("Unable to open connect modal");return this.modal?.open({uri:e})}if(g&&this.walletEntry){let{redirect:t,href:n}=function(e,t){let n=pa(t);if(n.deepLink)return ya(n.deepLink,e);if(n.universalLink)return fa(n.universalLink,e);throw new he(`Unsupported wallet ${t.id}`)}(e,this.walletEntry);wa(t,"_self"),function({href:e,name:t}){try{localStorage.setItem(ma,JSON.stringify({href:e,name:t}))}catch{}}({href:n,name:this.walletEntry.metadata?.shortName||this.walletEntry.name});let r=ha(e,this.walletEntry);return this.redirectUri=t,this.fallbackUniversalRedirectUri=r?.redirect,this.showPrivyQrModal({native:t,universal:t})}if(this.redirectUri=void 0,this.walletEntry){let t=ha(e,this.walletEntry);this.fallbackUniversalRedirectUri=t?.redirect}this.showPrivyQrModal({native:e,universal:void 0})})),r.on("connect",(()=>{this.modal?.close(),r.session?.peer.metadata.url&&(this.walletEntry=es(r.session?.peer.metadata.url),this.walletClientType=this.walletEntry?.slug||"unknown")})),r}async enableProvider(){return this.walletProvider?.connected?Promise.resolve(this.walletProvider.accounts):await(this.walletProvider?.enable())}setWalletEntry(e,t){this.walletEntry=e,this.showPrivyQrModal=t}constructor({walletConnectCloudProjectId:e,rpcConfig:t,chains:n,defaultChain:r,shouldEnforceDefaultChainOnConnect:a,privyAppId:i,privyAppName:o,walletClientType:s,appKit:l}){super(s||"unknown",n,r,t),this.connectorType="wallet_connect_v2",this.privyAppId=i,this.privyAppName=o,this.walletConnectCloudProjectId=e,this.rpcConfig=t,this.shouldEnforceDefaultChainOnConnect=a,this.proxyProvider=new ko(void 0,this.rpcTimeoutDuration),this.modal=l,s&&(this.walletEntry=(e=>Xo.getState().listings.find((({slug:t})=>ns(t)===ns(e))))(s),this.walletClientType=s)}}class Ns extends fn{get wallets(){let e=new Set,t=this.walletConnectors.flatMap((e=>e.wallets)).sort(((e,t)=>e.connectedAt&&t.connectedAt?t.connectedAt-e.connectedAt:0)).filter((t=>{let n=`${t.address}${t.walletClientType}${t.connectorType}${t.meta.id}`;return!e.has(n)&&(e.add(n),!0)})),n=t.findIndex((e=>e.address===(this.activeWallet?this.activeWallet:"unknown")));return n>=0&&t.unshift(t.splice(n,1)[0]),t}async initialize(e){if(this.initialized&&!e||(e&&this.removeAllConnectors(),ua.get(za)&&(ua.getKeys().forEach((e=>{e.startsWith("walletconnect")&&ua.del(e)})),ua.del(za)),this.externalWalletConfig.disableAllExternalWallets))return;let t=zi({store:this.store,walletList:this.walletList,externalWalletConfig:this.externalWalletConfig,walletChainType:this.walletChainType}).then((e=>{e.forEach((({type:e,eip6963InjectedProvider:t,legacyInjectedProvider:n})=>{this.createEthereumWalletConnector({connectorType:"injected",walletClientType:e,providers:{eip6963InjectedProvider:t,legacyInjectedProvider:n}})}))}));for(let e of(this.walletList.includes("coinbase_wallet")&&this.createEthereumWalletConnector({connectorType:"coinbase_wallet",walletClientType:"coinbase_wallet"}),this.walletList.includes("base_account")&&this.createEthereumWalletConnector({connectorType:"base_account",walletClientType:"base_account"}),Object.values(Ho)))!e.isInstalled&&this.walletList.includes(e.client)&&(["ethereum-only","ethereum-and-solana"].includes(this.walletChainType)&&e.chainTypes.includes("ethereum")&&this.createEthereumWalletConnector({connectorType:"null",walletClientType:e.client,walletConfig:e}),["ethereum-and-solana","solana-only"].includes(this.walletChainType)&&e.chainTypes.includes("solana")&&this.addSolanaWalletConnector(new Zo({id:e.client,name:e.name})));this.externalWalletConfig.walletConnect.enabled&&this.createEthereumWalletConnector({connectorType:"wallet_connect_v2",walletClientType:"unknown"}),this.externalWalletConfig.solana.connectors?.get().forEach(this.addSolanaWalletConnector),this.externalWalletConfig.solana.connectors?._setOnConnectorsUpdated?.((e=>{e?.forEach(this.addSolanaWalletConnector)})),await t,this.initialized=!0}findWalletConnector(e,t){return"wallet_connect_v2"===e?this.walletConnectors.filter(Co).find((t=>t.connectorType===e))??null:this.walletConnectors.filter(Co).find((n=>n.connectorType===e&&n.walletClientType===t))??null}findSolanaWalletConnector(e){return this.walletConnectors.filter(Yo).find((t=>"unknown"===t.walletClientType?t.walletBranding.id===e:t.walletClientType===e))??null}findEmbeddedWalletConnectors(){return this.walletConnectors.filter((e=>"embedded"===e.connectorType))}onInitialized(e){e.wallets.forEach((e=>{let t=this.storedConnections.find((t=>t.address===e.address&&t.connectorType===e.connectorType&&("solana"===e.type&&"unknown"===t.walletClientType&&"unknown"===e.walletClientType?e.meta.id===t.id:t.walletClientType===e.walletClientType)));t&&(e.connectedAt=t.connectedAt)})),this.emit("walletsUpdated"),this.emit("connectorInitialized")}onWalletsUpdated(e){e.initialized&&this.emit("walletsUpdated")}addEmbeddedWalletConnectors({walletProxy:e,user:t,embeddedWallets:n,defaultChain:r,appId:a,privyClient:i}){let{entropyId:o,entropyIdVerifier:s}=ro(t);for(let t of n){let n=this.findEmbeddedWalletConnectors().find((e=>e.walletIndex===t.walletIndex));if(n&&Co(n))n.proxyProvider.walletProxy=e;else{let n=new Eo({provider:new No({walletProxy:e,address:t.address,entropyId:o,entropyIdVerifier:s,rpcConfig:this.rpcConfig,chains:this.chains,appId:a,chainId:r.id,walletIndex:t.walletIndex,privyClient:i,walletAccount:t}),chains:this.chains,defaultChain:r,rpcConfig:this.rpcConfig,imported:!1,walletIndex:t.walletIndex});this.addWalletConnector(n)}}}addImportedWalletConnector(e,t,n,r){let a=this.findWalletConnector("embedded_imported","privy");if(a&&Co(a))a.proxyProvider.walletProxy=e;else{let a=new Eo({provider:new No({walletProxy:e,address:t,entropyId:t,entropyIdVerifier:"ethereum-address-verifier",walletIndex:0,rpcConfig:this.rpcConfig,chains:this.chains,appId:r,chainId:n.id}),chains:this.chains,walletIndex:0,defaultChain:n,rpcConfig:this.rpcConfig,imported:!0});this.addWalletConnector(a)}}removeEmbeddedWalletConnectors(){this.walletConnectors=this.walletConnectors.filter((e=>"embedded"!==e.connectorType)),this.storedConnections=jo(),this.emit("walletsUpdated")}removeImportedWalletConnector(){let e=this.findWalletConnector("embedded_imported","privy");if(e){let t=this.walletConnectors.indexOf(e);this.walletConnectors.splice(t,1),this.storedConnections=jo(),this.emit("walletsUpdated")}}async createEthereumWalletConnector({connectorType:e,walletClientType:t,providers:n,walletConfig:r}){let a=this.findWalletConnector(e,t);if(a&&Co(a))return a instanceof _s&&a.resetConnection(t),a;let i=(()=>"injected"!==e?"coinbase_wallet"===e?new xo(this.chains,this.defaultChain,this.rpcConfig,this.externalWalletConfig.coinbaseWallet.config):"base_account"===e?new Ao(this.chains,this.defaultChain,this.rpcConfig,this.externalWalletConfig.baseAccount.config,this.setBaseAccountSdk):"null"!==e?new _s({walletConnectCloudProjectId:this.walletConnectCloudProjectId,rpcConfig:this.rpcConfig,chains:this.chains,defaultChain:this.defaultChain,shouldEnforceDefaultChainOnConnect:this.shouldEnforceDefaultChainOnConnect,privyAppId:this.privyAppId,privyAppName:this.privyAppName,walletClientType:t,appKit:this.appKit}):r?new Mo({id:r.client,name:r.name,defaultChain:this.defaultChain,walletClientType:r.client}):null:"metamask"===t&&n?.eip6963InjectedProvider?new Bo(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask"):"metamask"===t&&n?.legacyInjectedProvider?new Do(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask"):"phantom"===t&&n?.legacyInjectedProvider?new Do(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom"):n?.legacyInjectedProvider&&"unknown_browser_extension"===t?new Do(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider):n?.eip6963InjectedProvider?new Lo(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,t):void 0)();return i&&this.addWalletConnector(i),i||null}addWalletConnector(e){this.walletConnectors.push(e),e.on("initialized",(()=>this.onInitialized(e))),e.on("walletsUpdated",(()=>this.onWalletsUpdated(e))),e.initialize().catch((e=>{console.debug("Failed to initialize connector",e)}))}async activeWalletSign(e){let t=this.wallets,n=t.length>0?t[0]:null;return n&&mo(n)?n.sign(e):null}setActiveWallet(e){this.activeWallet=v(e),this.emit("walletsUpdated")}setWalletList(e){this.walletList=e,this.initialized&&this.initialize(!0).catch(console.error)}removeAllConnectors(){for(let e of this.walletConnectors)e.removeAllListeners();this.walletConnectors=[]}constructor(e,t,n,r,a,i,o,s,l,c,d,u,p){super(),this.addSolanaWalletConnector=async e=>{let t=this.findSolanaWalletConnector(e.walletClientType);if(!t||"null"===t.connectorType){if("null"===t?.connectorType){let e=this.walletConnectors.indexOf(t);this.walletConnectors.splice(e,1)}this.addWalletConnector(e)}},this.getEthereumProvider=()=>{let e=this.wallets[0],t=this.walletConnectors.find((t=>t.wallets.find((t=>t.address===e?.address))));return e&&t?t.proxyProvider:new ko},this.privyAppId=e,this.walletConnectCloudProjectId=t,this.rpcConfig=n,this.chains=r,this.defaultChain=a,this.walletConnectors=[],this.initialized=!1,this.store=i,this.walletList=o,this.shouldEnforceDefaultChainOnConnect=s,this.externalWalletConfig=l,this.privyAppName=c,this.walletChainType=u||"ethereum-only",this.appKit=p,this.setBaseAccountSdk=d,this.storedConnections=jo()}}let Ms=[He,Ve,$e];class Ws{async get(e,t){try{return await this.baseFetch(e,t)}catch(e){throw ge(e)}}async post(e,t,n){try{return await this.baseFetch(e,{method:"POST",...t?{body:t}:{},...n})}catch(e){throw ge(e)}}async delete(e,t){try{return await this.baseFetch(e,{method:"DELETE",...t})}catch(e){throw ge(e)}}constructor({appId:e,appClientId:t,client:n,defaults:r}){this.appId=e,this.appClientId=t,this.clientAnalyticsId=n.clientAnalyticsId,this.sdkVersion=xa,this.client=n,this.defaults=r,this.fallbackApiUrl=n.fallbackApiUrl,this.baseFetch=Yr.create({baseURL:this.defaults.baseURL,timeout:this.defaults.timeout,retry:3,retryDelay:500,retryStatusCodes:[408,409,425,500,502,503,504],credentials:"include",onRequest:async({request:e,options:t})=>{let n=new Headers(t.headers);n.set("privy-app-id",this.appId),this.appClientId&&n.set("privy-client-id",this.appClientId),n.set("privy-ca-id",this.clientAnalyticsId||""),n.set("privy-client",`react-auth:${this.sdkVersion}`);let r=Ms.includes(e.toString());if(!n.has("authorization")){let e=await this.client.getAccessToken({disableAutoRefresh:r});null!==e&&n.set("authorization",`Bearer ${e}`)}t.headers=n,t.retryDelay&&"number"==typeof t.retryDelay&&(t.retryDelay=3*t.retryDelay)},onRequestError:({error:e})=>{if(e instanceof DOMException&&"AbortError"===e.name)throw new ze}})}}let Ps=/paymaster\.biconomy\.io\/api/i,Us={mode:"SPONSORED",calculateGasLimits:!0,expiryDuration:300,sponsorshipInfo:{webhookData:{},smartAccountInfo:{name:"BICONOMY",version:"2.0.0"}}};const Fs=(e,t)=>e&&Ps.test(e)?Us:t&&t.policy_id?{policyId:t.policy_id}:void 0,Os=e=>({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});class Ls{async authenticate(){if(!this.api)throw new he("Auth flow has no API instance");try{return await this.api.post(je,{token:this.meta.token})}catch(e){throw ge(e)}}async link(){if(!this.api)throw new he("Auth flow has no API instance");try{return await this.api.post(qe,{token:this.meta.token})}catch(e){throw ge(e)}}constructor(e){this.meta={token:e}}}class Rs{getOrCreateGuestCredential(e){let t=Ua(e);if(da()){if(ua.get(t))return ua.get(t);{let e=tn.encode(Ja(32));return ua.put(t,e),e}}return tn.encode(Ja(32))}async authenticate(){if(!this.api)throw new he("Auth flow has no API instance");try{return await this.api.post(Ke,{guest_credential:this.meta.guestCredential})}catch(e){throw ge(e)}}async link(){throw Error("Linking is not supported for the guest flow")}constructor(e){this.meta={guestCredential:this.getOrCreateGuestCredential(e)}}}function Ds(){return!(f&&window.location.origin.startsWith("http://localhost"))}const Bs=Ln((()=>({identityToken:null})));function zs(){let{identityToken:e}=Bs();return{identityToken:e}}var Hs,Vs=((Hs={}).PRIVY="privy_access_token",Hs.CUSTOMER="customer_access_token",Hs);class $s{get token(){return this.privyAccessToken||this.customerAccessToken}getToken(e){return"privy_access_token"===e?this.privyAccessToken:this.customerAccessToken}get customerAccessToken(){return this._getToken(Ia)}get privyAccessToken(){return this._getToken(_a)}_getToken(e){try{let t=ua.get(e);return"string"==typeof t?eo.throwIfNotWellFormedJwt(t):null}catch(e){return console.error(e),this.destroyLocalState(),null}}get refreshToken(){try{let e=ua.get(Sa);return"string"==typeof e?e:null}catch(e){return console.error(e),this.destroyLocalState(),null}}getProviderAccessToken(e){try{let t=ua.get(Fa(e));if("string"!=typeof t)return null;{let n=new eo(t);return n.isExpired()?(ua.del(Fa(e)),null):n.value}}catch(e){return console.error(e),null}}get mightHaveServerCookies(){try{let e=ia.get(Wa);return void 0!==e&&e.length>0}catch(e){console.error(e)}return!1}hasRefreshCredentials(e="privy_access_token"){let t="string"==typeof this.getToken(e),n="string"==typeof this.refreshToken&&"deprecated"!==this.refreshToken;return this.mightHaveServerCookies||t&&n}hasActiveAccessToken(e){let t=eo.parse(this.getToken(e));return null!==t&&!t.isExpired(30)}authenticate(e){return this.authenticateOnce.execute(e)}link(e){return this.linkOnce.execute(e)}refresh(){return this.refreshOnce.execute()}destroy(){return this.destroyOnce.execute()}storeProviderAccessToken(e,t){"string"==typeof t?ua.put(Fa(e),t):ua.del(Fa(e))}updateIdentityToken(e){"string"==typeof e?this.storeIdentityToken(e):this.clearIdentityToken()}async _authenticate(e){try{let t=await e.authenticate(),{user:n,is_new_user:r,oauth_tokens:a}=t;this.handleTokenResponse(t);let i=a?{provider:a.provider,accessToken:a.access_token,accessTokenExpiresInSeconds:a.access_token_expires_in_seconds,refreshToken:a.refresh_token,refreshTokenExpiresInSeconds:a.refresh_token_expires_in_seconds,scopes:a.scopes}:void 0;return this._trackAuthenticateEvents(e,r),{user:an(n),isNewUser:r,oAuthTokens:i}}catch(e){throw console.warn("Error authenticating session"),Ge(e)}}_trackAuthenticateEvents(e,t){let n=function(e){return e instanceof sa?"email":e instanceof Ii?"sms":e instanceof ki?"siwe":e instanceof Rs?"guest":e instanceof Ls?"custom_auth":e instanceof ri?e.meta.provider:null}(e);n&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate",payload:{method:n,isNewUser:t}}),"siwe"===n&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate_siwe",payload:{connectorType:e.meta.connectorType,walletClientType:e.meta.walletClientType}})}async _link(e){try{let t=await e.link(),n=t.oauth_tokens,r=n?{provider:n.provider,accessToken:n.access_token,accessTokenExpiresInSeconds:n.access_token_expires_in_seconds,refreshToken:n.refresh_token,refreshTokenExpiresInSeconds:n.refresh_token_expires_in_seconds,scopes:n.scopes}:void 0;return{user:an(t),oAuthTokens:r}}catch(e){throw console.warn("Error linking account"),Ge(e)}}async _refresh(){if(!this.api)throw new he("Session has no API instance");if(!this.client)throw new he("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let e=this.token,t=this.refreshToken;if(this.client.useServerCookies&&!this.mightHaveServerCookies&&this.token&&window.location.origin===this.client.apiUrl)return this.destroyLocalState(),null;try{let n;if(!(e&&t||this.mightHaveServerCookies))return null;{let r={};e&&(r.authorization=`Bearer ${e}`),n=await this.api.post(He,t?{refresh_token:t}:{},{headers:r})}return this.handleTokenResponse(n),an(n.user)}catch(e){if(e instanceof Ze&&e.privyErrorCode===Te.MISSING_OR_INVALID_TOKEN)return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw Ge(e)}}handleTokenResponse(e){e.session_update_action&&"set"!==e.session_update_action?"clear"===e.session_update_action?this.destroyLocalState():"ignore"===e.session_update_action&&(e.token&&(this.storeCustomerAccessToken(e.token),this.storePrivyAccessToken(e.privy_access_token)),e.identity_token&&this.storeIdentityToken(e.identity_token)):this._storeAllTokens(e)}_storeAllTokens(e){this.storeRefreshToken(e.refresh_token),this.storeCustomerAccessToken(e.token),this.storePrivyAccessToken(e.privy_access_token),e.identity_token&&this.storeIdentityToken(e.identity_token)}async _destroy(){try{await(this.api?.post(Ve,{refresh_token:this.refreshToken}))}catch(e){console.warn("Error destroying session")}this.destroyLocalState()}destroyLocalState(){this.storeRefreshToken(null),this.storeCustomerAccessToken(null),this.storePrivyAccessToken(null),this.clearIdentityToken()}storeCustomerAccessToken(e){if("string"==typeof e){let t=ua.get(Ia);if(ua.put(Ia,e),!this.client?.useServerCookies){let t=eo.parse(e)?.expiration;ia.set(Ea,e,{sameSite:"Strict",secure:Ds(),expires:t?new Date(1e3*t):void 0})}t!==e&&this.client?.onStoreCustomerAccessToken?.(e)}else ua.del(Ia),ia.remove(Ea),this.client?.onDeleteCustomerAccessToken?.()}storeRefreshToken(e){"string"==typeof e?(ua.put(Sa,e),this.client?.useServerCookies||ia.set(Wa,"t",{sameSite:"Strict",secure:Ds(),expires:30})):(ua.del(Sa),ia.remove("privy-refresh-token"),ia.remove(Wa))}storePrivyAccessToken(e){"string"==typeof e?ua.put(_a,e):ua.del(_a)}storeIdentityToken(e){if(Bs.setState({identityToken:e}),this.client?.useServerCookies)return;ua.put(Na,e);let t=eo.parse(e)?.expiration;ia.set(Ma,e,{sameSite:"Strict",secure:Ds(),expires:t?new Date(1e3*t):void 0})}clearIdentityToken(){ua.del(Na),Bs.setState({identityToken:null}),ia.remove(Ma)}constructor(){this.authenticateOnce=new va((async e=>this._authenticate(e))),this.linkOnce=new va((async e=>this._link(e))),this.refreshOnce=new va(this._refresh.bind(this)),this.destroyOnce=new va(this._destroy.bind(this))}}let js;var qs=0,Ks="__private_"+qs+++"__getOrGenerateClientAnalyticsId";class Gs{getAppId(){return this.appId}initializeConnectorManager({walletConnectCloudProjectId:e,rpcConfig:t,chains:n,defaultChain:r,store:a,walletList:i,shouldEnforceDefaultChainOnConnect:o,externalWalletConfig:s,appName:l,walletChainType:c,setBaseAccountSdk:d,appKit:u}){this.connectors||(this.connectors=new Ns(this.appId,e,t,n,r,a,i,o,s,l,d,c,u))}generateApi(){let e=new Ws({appId:this.appId,appClientId:this.appClientId,client:this,defaults:{baseURL:this.apiUrl,timeout:this.timeout}});return this.session.api=e,e}updateApiUrl(e){this.apiUrl=e||this.fallbackApiUrl,this.api=this.generateApi(),e&&(this.useServerCookies=!0)}authenticate(){if(!this.authFlow)throw new he("No auth flow in progress.");return this.session.authenticate(this.authFlow)}async link(){if(!this.authFlow)throw new he("No auth flow in progress.");let{oAuthTokens:e}=await this.session.link(this.authFlow);return{user:await this.getAuthenticatedUser(),oAuthTokens:e}}storeProviderAccessToken(e,t){this.session.storeProviderAccessToken(e,t)}getProviderAccessToken(e){return this.session.getProviderAccessToken(e)}async logout(){await this.session.destroy(),this.authFlow=void 0}clearProviderAcccessTokens(e){e.linkedAccounts.filter((e=>"cross_app"===e.type)).forEach((e=>{this.storeProviderAccessToken(e.providerApp.id,null)}))}startAuthFlow(e){return e.api=this.api,this.authFlow=e,this.authFlow}async initMfaSmsVerification(){try{await this.api.post(Ye,{action:"verify"})}catch(e){throw ge(e)}}async initMfaPasskeyVerification(){try{let e=await this.api.post(Qe,{});return Os(e.options)}catch(e){throw ge(e)}}async getCrossAppProviderDetails(e){try{return this._cachedProviderAppDetails[e]||(this._cachedProviderAppDetails[e]=await this.api.get(`/api/v1/apps/${e}/cross-app/details`)),this._cachedProviderAppDetails[e]}catch(e){console.error("Error fetching cross app provider details",e)}}async acceptTerms(){try{let e=await this.api.post(Xe,{});return an(e)}catch(e){throw Ge(e)}}async unlinkEmail(e){try{let t=await this.api.post(Je,{address:e});return await this.getAuthenticatedUser()??an(t)}catch(e){throw Ge(e)}}async unlinkPhone(e){try{let t=await this.api.post(et,{phoneNumber:e});return await this.getAuthenticatedUser()??an(t)}catch(e){throw Ge(e)}}async unlinkEthereumWallet(e){try{let t=await this.api.post(tt,{address:e});return await this.getAuthenticatedUser()??an(t)}catch(e){throw Ge(e)}}async unlinkSolanaWallet(e){try{let t=await this.api.post(nt,{address:e});return await this.getAuthenticatedUser()??an(t)}catch(e){throw Ge(e)}}async unlinkOAuth(e,t){try{let n=await this.api.post(rt,{provider:e,subject:t});return await this.getAuthenticatedUser()??an(n)}catch(e){throw Ge(e)}}async unlinkFarcaster(e){try{let t=await this.api.post(at,{fid:e});return await this.getAuthenticatedUser()??an(t)}catch(e){throw Ge(e)}}async unlinkTelegram(e){try{let t=await this.api.post(it,{telegram_user_id:e});return await this.getAuthenticatedUser()??an(t)}catch(e){throw Ge(e)}}async revokeDelegatedWallet(){try{await this.api.post(ot,{})}catch(e){throw Ge(e)}}async createAnalyticsEvent({eventName:e,payload:t,timestamp:n,options:r}){if("undefined"!=typeof window)try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post($e,{event_name:e,client_id:this.clientAnalyticsId,payload:{...t||{},clientTimestamp:n?n.toISOString():(new Date).toISOString()}},{retry:-1,keepalive:r?.keepAlive??!1})}catch(e){console.log("Unable to submit event. This is not an issue.")}}async signMoonpayOnRampUrl(e){try{return this.api.post(st,e)}catch(e){throw Ge(e)}}async initCoinbaseOnRamp(e){try{return this.api.post(lt,e)}catch(e){throw Ge(e)}}async getCoinbaseOnRampStatus({partnerUserId:e}){try{return this.api.get(`${ct}?partnerUserId=${e}`)}catch(e){throw Ge(e)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()?this.session.refresh():null}async getAccessToken(e){return await this.getPrivyAccessToken(e)||await this.getCustomerAccessToken(e)}async getCustomerAccessToken(e){return await this._getToken(Vs.CUSTOMER,e)}async getPrivyAccessToken(e){return await this._getToken(Vs.PRIVY,e)}async _getToken(e,t){return this.session.getToken(e)?this.session.hasActiveAccessToken(e)?this.session.hasRefreshCredentials(e)?to.parse(this.session.getToken(e))?.appId!==this.appId?(await this.logout(),null):this.session.getToken(e):(this.session.destroyLocalState(),null):!t?.disableAutoRefresh&&this.session.hasRefreshCredentials(e)?(await this.session.refresh(),this.session.getToken(e)):null:null}async getSmartWalletsConfig(){try{let e={},t=this.session.token;t&&(e.authorization=`Bearer ${t}`);let n=await this.api.get(`/api/v1/apps/${this.appId}/smart_wallets`,{baseURL:this.fallbackApiUrl,headers:e});return n.enabled?{enabled:n.enabled,smartWalletVersion:n.smart_wallet_version,smartWalletType:n.smart_wallet_type,configuredNetworks:n.configured_networks.map((e=>({chainId:e.chain_id,bundlerUrl:e.bundler_url,paymasterUrl:e.paymaster_url,paymasterContext:Fs(e.paymaster_url,e.paymaster_context)})))}:{enabled:n.enabled}}catch(e){throw Ge(e)}}async getUsdTokenPrice(e){try{return(await this.api.get(`/api/v1/token_price?chainId=${e.id}&tokenSymbol=${e.nativeCurrency.symbol}`)).usd}catch(t){return void console.error(`Unable to fetch token price for chain with id ${e.id}`)}}async getUsdPriceForSol(){try{return(await this.api.get("/api/v1/token_price?chainId=0&tokenSymbol=SOL")).usd}catch(e){return void console.error("Unable to fetch token price for SOL")}}async getSplTokenMetadata({mintAddress:e,cluster:t}){try{return await this.api.get(`/api/v1/spl_token_info?mint_address=${e}&cluster=${t}`)}catch(n){return void console.error(`Unable to fetch token metadata for ${t}:${e}`)}}async requestFarcasterSignerStatus(e){try{return await this.api.post("/api/v1/farcaster/signer/status",{ed25519_public_key:e})}catch(e){throw console.error("Unable to fetch Farcaster signer status"),e}}async generateSiweNonce({address:e,captchaToken:t}){try{return(await this.api.post(dt,{address:e,token:t})).nonce}catch(e){throw Ge(e)}}async authenticateWithSiweInternal({message:e,signature:t,chainId:n,walletClientType:r,connectorType:a,mode:i}){return await this.api.post(ut,{message:e,signature:t,chainId:n,walletClientType:r,connectorType:a,mode:i})}async linkWithSiweInternal({message:e,signature:t,chainId:n,walletClientType:r,connectorType:a}){return await this.api.post(pt,{message:e,signature:t,chainId:n,walletClientType:r,connectorType:a})}async linkSmartWallet({message:e,signature:t,smartWalletType:n,smartWalletVersion:r}){try{let a=await this.api.post(ht,{message:e,signature:t,smart_wallet_type:n,smart_wallet_version:r});return an(a)}catch(e){throw Ge(e)}}async linkWithSiwe({message:e,signature:t,chainId:n,walletClientType:r,connectorType:a}){try{let i=await this.linkWithSiweInternal({message:e,signature:t,chainId:n,walletClientType:r,connectorType:a});return an(i)}catch(e){throw Ge(e)}}async generateSiwsNonce({address:e,captchaToken:t}){try{return(await this.api.post(mt,{address:e,token:t})).nonce}catch(e){throw Ge(e)}}async authenticateWithSiwsInternal({message:e,signature:t,walletClientType:n,connectorType:r,mode:a,messageType:i="plain"}){return await this.api.post(gt,{message:e,signature:t,walletClientType:n,connectorType:r,mode:a,message_type:i})}async authenticateWithSiws({message:e,signature:t,walletClientType:n,connectorType:r,mode:a,messageType:i="plain"}){let o=await this.authenticateWithSiwsInternal({message:e,signature:t,walletClientType:n,connectorType:r,mode:a,messageType:i});this.session.handleTokenResponse(o);let s=an(o.user);if(!s)throw Error("Authentication failed - no user returned");return{user:s,isNewUser:o.is_new_user||!1}}async sendAccountTransferRequest({nonce:e,account:t,accountType:n,externalWalletMetadata:r,telegramAuthResult:a,telegramWebAppData:i,farcasterEmbeddedAddress:o,oAuthUserInfo:s}){try{let l,c;switch(n){case"email":l=kt,c={nonce:e,email:t};break;case"sms":l=bt,c={nonce:e,phoneNumber:t};break;case"siwe":if(l=Ct,!r)throw Error("Wallet parameters must be defined");c={nonce:e,address:t,...r};break;case"farcaster":l=vt,c={nonce:e,farcaster_id:t,farcaster_embedded_address:o};break;case"telegram":l=wt,c={nonce:e,telegram_auth_result:a,telegram_web_app_data:i};break;case"siws":l=ft,c={nonce:e,address:t,...r};break;case"custom":case"guest":case"passkey":throw Error("Invalid transfer account type");default:l=yt,c={nonce:e,userInfo:s}}let d=await this.api.post(l,c);return await this.getAuthenticatedUser()??an(d)}catch(e){throw Ge(e)}}async linkWithSiwsInternal({message:e,signature:t,walletClientType:n,connectorType:r,messageType:a="plain"}){return await this.api.post(At,{message:e,signature:t,walletClientType:n,connectorType:r,message_type:a})}async linkWithSiws({message:e,signature:t,walletClientType:n,connectorType:r,messageType:a="plain"}){try{let i=await this.linkWithSiwsInternal({message:e,signature:t,walletClientType:n,connectorType:r,messageType:a});return an(i)}catch(e){throw Ge(e)}}async updateUserAndIdToken(){try{let e=await this.api.get(Tt);return this.session.updateIdentityToken(e.identity_token),an(e.user)}catch(e){throw Ge(e)}}async scanTransaction(e){try{return await this.api.post(xt,e)}catch(e){throw Ge(e)}}constructor({apiUrl:e=ba,appId:t,appClientId:n,timeout:r=2e4}){Object.defineProperty(this,Ks,{value:Zs}),this._cachedProviderAppDetails={},this.apiUrl=e,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=e!==ba&&e.startsWith("https://privy."),this.timeout=r,this.appId=t,this.appClientId=n,this.clientAnalyticsId=function(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}(this,Ks)[Ks](),js||(js=new $s),this.session=js,this.api=this.generateApi(),this.session.client=this}}function Zs(){if("undefined"==typeof window)return null;try{let e=ua.get(Pa);if("string"==typeof e&&e.length>0)return e}catch(e){}let e=Jt();try{return ua.put(Pa,e),e}catch(t){return e}}const Ys=({delayedExecution:e,...n})=>{let{enabled:r,siteKey:a,appId:i,setError:o,setToken:l,setExecuting:c,ref:u}=Zi(),[,p]=s((()=>a?.split("t:")||[]),[a]);if(d((()=>u.current?.remove),[]),!r)return null;if(!p)throw Error("Unsupported captcha site key");/*#__PURE__*/return t("div",{className:"hidden h-0 w-0",children:/*#__PURE__*/t(bn,{...n,ref:u,siteKey:p,options:{action:i,size:"invisible",...e?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{n.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{n.onError?.(),o("Captcha failed"),c(!1)},onSuccess:e=>{n.onSuccess?.(e),l(e),c(!1)},onExpire:()=>{n.onExpire?.();try{u.current?.reset(),o(void 0),l(void 0)}catch(e){o("expired_and_failed_reset")}}})})},Qs=e=>{let[t,n]=o("auto");return d((()=>{let t=new ResizeObserver((e=>{n(e[0]?.contentRect.height??"auto")}));return e.current&&t.observe(e.current),()=>{e.current&&t.unobserve(e.current)}}),[e.current]),t},Xs={login:{onComplete:[],onError:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},connectOrCreateWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]},linkAccount:{onSuccess:[],onError:[]},update:{onSuccess:[],onError:[]},configureMfa:{onMfaRequired:[]},setWalletPassword:{onSuccess:[],onError:[]},setWalletRecovery:{onSuccess:[],onError:[]},signMessage:{onSuccess:[],onError:[]},signTypedData:{onSuccess:[],onError:[]},sendTransaction:{onSuccess:[],onError:[]},signTransaction:{onSuccess:[],onError:[]},signSolanaTransaction:{onSuccess:[],onError:[]},signSolanaMessage:{onSuccess:[],onError:[]},sendSolanaTransaction:{onSuccess:[],onError:[]},accessToken:{onAccessTokenGranted:[],onAccessTokenRemoved:[]},oAuthAuthorization:{onOAuthTokenGrant:[]},fundWallet:{onUserExited:[]},fundSolanaWallet:{onUserExited:[]},customAuth:{onAuthenticated:[],onUnauthenticated:[]}},Js=/*#__PURE__*/c(void 0);let el=()=>l(Js);function tl(e,t){if(!t)return;let n=el().current[e];return d((()=>{for(let[r,a]of Object.entries(t))Object.prototype.hasOwnProperty.call(n,r)||console.warn(`Invalid event type "${r}" for action "${e}"`),n[r]?.push(a);return()=>{for(let[r,a]of Object.entries(t))Object.prototype.hasOwnProperty.call(n,r)||console.warn(`Invalid event type "${r}" for action "${e}"`),n[r]=n[r]?.filter((e=>e!==a))}}),[t])}function nl(e,t,n,...r){for(let a of e.current[t][n])a(...r)}function rl(){let e=el();return(t,n,...r)=>nl(e,t,n,...r)}function al(e){tl("configureMfa",e)}const il=/*#__PURE__*/kn.div.withConfig({displayName:"Grow",componentId:"sc-681ff332-0"})(["text-align:left;flex-grow:1;"]),ol=/*#__PURE__*/kn.div.withConfig({displayName:"AlignBottom",componentId:"sc-681ff332-1"})(["display:flex;flex-direction:column;justify-content:flex-end;flex-grow:1;"]),sl=/*#__PURE__*/kn.div.withConfig({displayName:"LoginMethodContainer",componentId:"sc-681ff332-2"})(["display:flex;flex-direction:column;gap:8px;-ms-overflow-style:none;scrollbar-width:none;&::-webkit-scrollbar{display:none;}"]),ll=/*#__PURE__*/kn(sl).withConfig({displayName:"LoginMethodContainerWithScrollShadows",componentId:"sc-681ff332-3"})([""," background-repeat:no-repeat;background-size:100% 32px,100% 16px;background-attachment:local,scroll;max-height:400px;overflow-y:auto;scrollbar-width:none;padding:3px;"],(e=>"light"===e.$colorScheme?"background: linear-gradient(var(--privy-color-background), var(--privy-color-background) 70%) bottom, linear-gradient(rgba(0, 0, 0, 0) 20%, rgba(0, 0, 0, 0.06)) bottom;":"dark"===e.$colorScheme?"background: linear-gradient(var(--privy-color-background), var(--privy-color-background) 70%) bottom, linear-gradient(rgba(255, 255, 255, 0) 20%, rgba(255, 255, 255, 0.06)) bottom;":void 0));let cl=/*#__PURE__*/An(["&&{width:100%;font-size:16px;line-height:24px;min-height:56px;@media (min-width:440px){font-size:14px;}display:flex;gap:12px;align-items:center;color:var(--privy-color-foreground);padding:10px 12px;border:1px solid var(--privy-color-foreground-4) !important;border-radius:var(--privy-border-radius-md);transition:background-color 200ms ease;cursor:pointer;&:hover{background-color:var(--privy-color-background-2);}&:disabled{cursor:pointer;background-color:var(--privy-color-background-2);}}"]);const dl=/*#__PURE__*/kn.div.withConfig({displayName:"Subtitle",componentId:"sc-681ff332-4"})(["text-align:center;font-size:14px;margin-bottom:24px;"]),ul=/*#__PURE__*/kn.button.attrs({className:"login-method-button"}).withConfig({displayName:"LoginMethodButton",componentId:"sc-681ff332-5"})(["",""],cl),pl=/*#__PURE__*/kn.div.withConfig({displayName:"LoginMethodIconWrapper",componentId:"sc-681ff332-7"})(["width:32px;height:32px;border-radius:",";background:",";display:flex;align-items:center;justify-content:center;flex-shrink:0;svg{width:",";height:",";color:",";}"],(e=>e.$fullSize?"0":"4px"),(e=>e.$fullSize?"transparent":"var(--privy-color-background-2)"),(e=>e.$fullSize?"32px":"18px"),(e=>e.$fullSize?"32px":"18px"),(e=>e.$fullSize?"inherit":"var(--privy-color-icon-muted)")),hl=/*#__PURE__*/kn.div.withConfig({displayName:"Hide",componentId:"sc-681ff332-8"})(["width:100%;height:100%;min-height:inherit;display:flex;flex-direction:column;",""],(e=>e.$if?"display: none;":"")),ml=/*#__PURE__*/kn.div.withConfig({displayName:"EmptyWalletState",componentId:"sc-681ff332-9"})(["width:100%;height:100%;padding:",";"],(e=>e.$withPadding?"64px 0px":"0px")),gl=/*#__PURE__*/kn.div.withConfig({displayName:"Header",componentId:"sc-681ff332-10"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin-bottom:32px;gap:12px;& h3{font-size:18px;font-style:normal;font-weight:600;line-height:24px;}& p{max-width:300px;font-size:14px;font-style:normal;font-weight:400;line-height:20px;}"]);function yl(e){/*#__PURE__*/return t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 460 40",...e,children:/*#__PURE__*/t("g",{fill:e.color||"var(--privy-color-foreground)",children:/*#__PURE__*/t("path",{d:"M0 15.4v15.38h4.64V19.96h3.58c2.47 0 3.63-.01 3.77-.02 1-.08 1.49-.15 2.18-.3a9.45 9.45 0 0 0 4.6-2.37c1.66-1.57 2.64-3.87 2.81-6.56.02-.3.02-1.19 0-1.49-.1-1.77-.56-3.35-1.36-4.72A8.84 8.84 0 0 0 15.14.57c-.93-.3-1.75-.43-3.09-.54C11.9.02 10.2 0 5.93 0H0ZM10.85 4c1.85.05 3.1.45 4.16 1.3.22.17.54.49.69.68a5.97 5.97 0 0 1 1.19 3.13c.04.35.04 1.36 0 1.71-.08.68-.23 1.3-.44 1.85a4.8 4.8 0 0 1-1.09 1.68A5.63 5.63 0 0 1 12 15.92c-.6.08-.4.08-4.01.09H4.64V3.98h2.9c1.6 0 3.08 0 3.31.02ZM187.65 5.71v5.72h-.27l-.09-.14a15.9 15.9 0 0 0-1.21-1.73c-.43-.5-1-.95-1.7-1.36-.54-.3-1.05-.5-1.73-.63a8.98 8.98 0 0 0-1.7-.17 8.84 8.84 0 0 0-7.8 4.03 12.95 12.95 0 0 0-2.03 6.39c-.07.98-.06 2.15.02 3.13.2 2.47.87 4.53 2.02 6.25a8.98 8.98 0 0 0 10.22 3.65 6.5 6.5 0 0 0 2.8-1.93c.41-.51.84-1.1 1.1-1.55l.1-.17h.37v3.58h4.38V0h-4.48Zm-5.24 5.54c1.3.14 2.3.6 3.17 1.48.9.9 1.5 2.09 1.85 3.64.36 1.6.39 3.72.06 5.43a8.13 8.13 0 0 1-1.54 3.62 5.1 5.1 0 0 1-3.93 1.96 6.13 6.13 0 0 1-2.32-.31 5.87 5.87 0 0 1-3.33-3.5c-.39-1-.62-2.05-.72-3.32-.03-.32-.04-1.35-.02-1.73.08-1.56.4-2.91.96-4.05a6.2 6.2 0 0 1 1.06-1.58 5.08 5.08 0 0 1 3.6-1.66c.25-.02.9 0 1.16.02ZM210.07 15.39l.01 15.38h4.38l.01-3.57h.37l.09.15c.24.44.84 1.26 1.21 1.7a6.79 6.79 0 0 0 2.57 1.75 9.3 9.3 0 0 0 6.86-.49 9.28 9.28 0 0 0 4.05-4.07A13.05 13.05 0 0 0 231 21.6c.21-1.73.18-3.7-.09-5.32a13.03 13.03 0 0 0-1.5-4.3 9.1 9.1 0 0 0-3.75-3.63 9.15 9.15 0 0 0-4.43-.96 7.46 7.46 0 0 0-2.8.5A7.07 7.07 0 0 0 216 9.7c-.4.52-.82 1.12-1.1 1.59l-.07.14h-.27V0h-4.5Zm11.13-4.14c1.07.1 1.94.44 2.7 1.04a6.1 6.1 0 0 1 1.64 1.98c.43.84.78 2 .94 3.11.15 1.16.16 2.4.02 3.54a9.34 9.34 0 0 1-1.39 4.03 5.33 5.33 0 0 1-2.69 2.15c-.9.3-2.04.38-3.06.2a5.14 5.14 0 0 1-3.45-2.37 6.03 6.03 0 0 1-.45-.8c-.5-1.03-.8-2.2-.92-3.58-.04-.49-.06-.89-.05-1.53.01-.76.05-1.23.13-1.85.38-2.53 1.47-4.38 3.15-5.31a5.46 5.46 0 0 1 2.3-.63 10 10 0 0 1 1.13.02ZM69.05 2.17l-.01 2.77V7.7h-3.36v3.6h3.36v6.8l.01 7.15c.06 1.4.4 2.44 1.1 3.37a5.8 5.8 0 0 0 2.97 2.07c.91.3 1.83.42 2.9.38a8.71 8.71 0 0 0 2.66-.48l-.8-3.7-.38.06a4.96 4.96 0 0 1-2.43-.06c-.33-.1-.56-.25-.8-.49-.4-.41-.6-.88-.7-1.67-.02-.2-.02-.62-.03-6.82v-6.6h4.73V7.7h-4.73V2.16h-4.49ZM133.34 2.17V7.7h-3.39v3.6h3.38v6.9l.01 7.17a5.66 5.66 0 0 0 2.36 4.49c.85.6 2.03 1.03 3.26 1.17.85.1 2.03.05 2.81-.1.3-.06.75-.18 1-.26l.2-.06v-.05l-.81-3.67-.37.06a4.99 4.99 0 0 1-1.8.09c-.85-.13-1.32-.4-1.7-.97a2.63 2.63 0 0 1-.39-1.04c-.06-.4-.06 0-.06-7.1V11.3h4.7V7.7h-4.7l-.01-2.77V2.16h-4.49ZM293.41 2.36a14.56 14.56 0 0 0-13.7 16.07 14.59 14.59 0 0 0 21.86 11.08 14.5 14.5 0 0 0 7.11-14.07 14.61 14.61 0 0 0-6.53-10.73 14.49 14.49 0 0 0-8.74-2.35ZM350.8 2.36a10.17 10.17 0 0 0-7.56 4.2c-.16.2-.45.63-.58.83l-.05.1h-.47l-.01-4.36h-7.36v36.4h7.82V27.27h.49l.05.07a11.3 11.3 0 0 0 7.49 4.15 10.52 10.52 0 0 0 9.38-4.1c1.66-2.1 2.73-4.9 3.07-8.06.1-.87.13-1.4.13-2.37 0-.8 0-1.1-.07-1.76a15.95 15.95 0 0 0-3.23-8.72 12.8 12.8 0 0 0-1.85-1.84 10.49 10.49 0 0 0-7.26-2.28Zm-.94 6.05c1.27.15 2.33.65 3.2 1.5.98.96 1.67 2.31 2.03 4 .34 1.57.38 3.68.12 5.39a9.78 9.78 0 0 1-1.04 3.25c-.14.25-.44.69-.6.89a5.35 5.35 0 0 1-4.31 2.07 5.25 5.25 0 0 1-4.41-1.9 7.35 7.35 0 0 1-1.26-2.32 14.09 14.09 0 0 1-.62-4.83c.05-1.98.38-3.53 1.02-4.85a5.63 5.63 0 0 1 2.5-2.65c.66-.34 1.3-.5 2.14-.58.18-.02 1.04 0 1.23.03ZM363.63 3.1l-.01 3.2v3.16h1.43c1.26.01 1.44.02 1.54.04.42.09.66.28.79.62.08.23.08.08.08 2.96a911.57 911.57 0 0 1 .03 10.18v7.54h7.82v-7.4l.01-7.83c.03-.94.11-1.63.27-2.28.46-1.9 1.54-2.93 3.35-3.23.52-.08.2-.08 5-.08h4.4V3.08h-3.1c-3.48 0-3.91.01-4.67.1-1.83.2-3.04.79-3.96 1.88-.5.6-.9 1.32-1.26 2.26l-.06.17h-.46V3.09h-5.6c-4.46 0-5.6 0-5.6.02ZM390.8 16.95V30.8h3.87l3.86-.01V3.09h-7.73ZM400.6 3.1l-.01.4v.38l4.66 13.4 4.69 13.47.02.05h10.3l.03-.05 4.67-13.45 4.67-13.4V3.1h-7.43l-6.7 19.26h-.5l-3.28-9.5-3.31-9.64-.05-.12h-3.88l-3.88.01ZM430.98 3.1c-.01 0-.02.19-.02.4v.39l5.08 14.59c2.8 8.02 5.08 14.6 5.08 14.61.01.02-.22.02-4.8.02h-4.82v6.42h4.95c5.09 0 5.23 0 5.87-.06 3.15-.28 5.29-1.63 6.63-4.15.28-.55.44-.95.87-2.16L459 6.78l1-2.89v-.8h-7.43l-6.69 19.26h-.5l-3.27-9.46-3.31-9.64-.06-.16h-3.88l-3.88.01ZM36.57 7.36c-1.36.1-2.6.6-3.62 1.45a5.65 5.65 0 0 0-1.67 2.42l-.05.13H31V7.7h-4.35v23.08h4.5v-7.3c0-8 0-7.34.08-7.82a4.89 4.89 0 0 1 2.06-3.18c.83-.58 1.74-.89 2.87-.98a11.87 11.87 0 0 1 2.8.25H39v-4.3l-.21-.02c-.61-.07-1.74-.1-2.22-.07ZM51.08 7.41c-2.33.12-4.3.84-5.95 2.16a9.89 9.89 0 0 0-2.03 2.2 12.5 12.5 0 0 0-2 5.78 18.04 18.04 0 0 0 0 3.65 12.13 12.13 0 0 0 2.26 6.05 9.74 9.74 0 0 0 5 3.52c2.11.64 4.7.64 6.8 0a9.78 9.78 0 0 0 4.88-3.37c1.38-1.78 2.19-4 2.4-6.58.13-1.46.06-3.06-.18-4.42a11.24 11.24 0 0 0-3.58-6.6 10 10 0 0 0-5.75-2.35c-.56-.06-1.31-.07-1.85-.04Zm1.42 3.78c.88.1 1.62.34 2.28.75a6.13 6.13 0 0 1 1.99 2.15 10.31 10.31 0 0 1 1.2 5c.02 1.23-.12 2.44-.42 3.51a7.14 7.14 0 0 1-1.81 3.32c-.61.6-1.2.98-1.95 1.24a6 6 0 0 1-2 .3 5.7 5.7 0 0 1-2.72-.6 5 5 0 0 1-1.28-.94A7.1 7.1 0 0 1 46 22.73c-.57-1.99-.6-4.46-.08-6.5a7.24 7.24 0 0 1 2.03-3.67 5.13 5.13 0 0 1 3.35-1.4 11 11 0 0 1 1.2.03ZM92.05 7.4c-.96.06-1.56.15-2.3.33a9.62 9.62 0 0 0-6.09 4.66 13.5 13.5 0 0 0-1.71 7c0 .83 0 1.04.06 1.6.16 1.77.58 3.32 1.29 4.7A9.72 9.72 0 0 0 90.28 31c1.84.37 4.08.32 5.85-.13a9.07 9.07 0 0 0 5.02-3.1A7.64 7.64 0 0 0 102.5 25l-2.11-.39-2.11-.38-.08.13a4.72 4.72 0 0 1-2.35 2.55 6.3 6.3 0 0 1-2.23.58c-.29.03-1.13.03-1.44 0a6.35 6.35 0 0 1-3.02-1.04 5.93 5.93 0 0 1-2.02-2.43 8.44 8.44 0 0 1-.72-3.18v-.26h16.38v-.81c0-1.83-.06-2.76-.25-3.87-.2-1.22-.53-2.24-1.05-3.28a8.9 8.9 0 0 0-2.66-3.26 10.1 10.1 0 0 0-5.34-1.94 18.3 18.3 0 0 0-1.46-.03Zm1.3 3.75c1.2.13 2.19.55 3.05 1.3a5.8 5.8 0 0 1 1.78 2.96c.13.51.21 1.17.21 1.66v.15H86.43v-.12c.08-.97.3-1.78.72-2.61.5-1 1.2-1.8 2.14-2.42a5.32 5.32 0 0 1 2.9-.95c.2-.01.97 0 1.17.03ZM116.79 7.41c-2 .1-3.73.65-5.22 1.65a10.7 10.7 0 0 0-4.25 6.06 16.1 16.1 0 0 0-.5 5.8c.2 2.17.84 4.13 1.88 5.76.58.9 1.32 1.73 2.15 2.4a9.37 9.37 0 0 0 3.6 1.8 12.06 12.06 0 0 0 3.92.34 10.2 10.2 0 0 0 3.84-.95 8.31 8.31 0 0 0 4.76-6.75l.01-.04h-4.37l-.05.16a4.87 4.87 0 0 1-4.24 3.75c-.59.07-1.32.06-1.93-.05a5.47 5.47 0 0 1-3.5-2.27c-.56-.75-1-1.73-1.26-2.79a13.8 13.8 0 0 1-.16-5.24 7.77 7.77 0 0 1 2.1-4.3 5.48 5.48 0 0 1 2.15-1.3 6.4 6.4 0 0 1 3.89.1c.59.21 1.03.5 1.5.96a5.32 5.32 0 0 1 1.46 2.5l.04.15h4.37v-.06a8.22 8.22 0 0 0-5.31-6.94 10.98 10.98 0 0 0-4.88-.74ZM156.2 7.41a9.87 9.87 0 0 0-6 2.29 11.02 11.02 0 0 0-3.41 5.43c-.52 1.78-.68 3.9-.48 5.97.17 1.8.63 3.38 1.37 4.8a9.68 9.68 0 0 0 5.91 4.86c1.65.48 3.63.61 5.53.36 3.72-.49 6.55-2.62 7.56-5.69.12-.39.13-.42.1-.43-.02 0-4.13-.75-4.19-.75-.03 0-.04 0-.1.16-.18.42-.45.9-.72 1.22-.16.2-.49.53-.7.7-.67.54-1.5.9-2.43 1.08-.48.08-.83.11-1.41.11-.64 0-1.07-.04-1.6-.15a5.76 5.76 0 0 1-3.93-2.83 8 8 0 0 1-.99-3.79v-.16h16.38v-1.11l-.02-1.43c-.1-2.25-.53-4-1.35-5.59a9.24 9.24 0 0 0-6.18-4.75c-1.04-.26-2.2-.36-3.33-.3Zm1.45 3.74a5.35 5.35 0 0 1 3.66 1.94 6.1 6.1 0 0 1 1.38 4.01v.12h-11.97v-.06c0-.02 0-.14.02-.25a6.6 6.6 0 0 1 2.15-4.32 5.73 5.73 0 0 1 3.5-1.46c.25-.02 1 0 1.26.02ZM233.58 7.82l8.37 23.22a49.22 49.22 0 0 1-.67 1.9 5.36 5.36 0 0 1-1.14 1.8c-.41.4-.82.58-1.48.69-.27.04-1.03.03-1.35 0a8.05 8.05 0 0 1-1.1-.23l-1.08 3.67c0 .02.32.14.66.22.83.21 1.57.29 2.56.28.56-.01.8-.03 1.24-.1 2.71-.4 4.66-2.09 5.86-5.08l9.64-26.44c0-.02-4.82-.06-4.83-.05l-2.93 8.96-2.91 8.94h-.24l-.22-.65-2.91-8.95-2.7-8.3H233.53ZM293.05 35.8c-1.18.04-1.93.09-2.8.16-2.52.24-4.53.69-5.43 1.23-.7.41-.76.86-.2 1.28.88.66 3.29 1.19 6.36 1.4a48.55 48.55 0 0 0 5.75.05c3.47-.19 6.24-.78 7.11-1.5.22-.19.3-.34.3-.53 0-.1 0-.12-.04-.22-.35-.69-2.32-1.3-5.25-1.63a41.09 41.09 0 0 0-5.8-.24Zm0 0"})})})}let fl=/*#__PURE__*/kn.span.withConfig({displayName:"TermsAndConditionsContainer",componentId:"sc-ff3bd734-0"})(["margin-top:16px;font-size:13px;text-align:center;color:var(--privy-color-foreground-3);display:block;&& > a{color:var(--privy-color-accent);}"]);function wl({app:{legal:{privacyPolicyUrl:n,termsAndConditionsUrl:r,requireUsersAcceptTerms:a}},alwaysShowImplicitConsent:i}){let o=!(!n||!r);return a&&!i||!r&&!n?
|
|
2
|
+
/*#__PURE__*/t(fl,{}):
|
|
3
|
+
/*#__PURE__*/ /*#__PURE__*/e(fl,{children:["By logging in I agree to the"," ",r&&/*#__PURE__*/t("a",{href:r,target:"_blank",children:o?"Terms":"Terms of Service"}),o&&" & ",n&&/*#__PURE__*/t("a",{href:n,target:"_blank",children:"Privacy Policy"})]})}const vl=({className:e})=>{let{appearance:n}=ks();/*#__PURE__*/return t(bl,{className:e,children:n.footerLogo??/*#__PURE__*/t(Cl,{href:"https://www.privy.io/",target:"_blank",id:"protected-by-privy",children:/*#__PURE__*/t(yl,{color:"currentColor",height:13,width:150})})})};let Cl=/*#__PURE__*/kn.a.withConfig({displayName:"PrivyLink",componentId:"sc-ff3bd734-1"})(["&&{padding:0;color:var(--privy-color-foreground-3);}"]);const bl=/*#__PURE__*/kn.div.withConfig({displayName:"ModalFooter",componentId:"sc-ff3bd734-2"})(["display:flex;align-items:center;justify-content:center;padding-top:8px;padding-bottom:12px;gap:8px;font-size:13px;&& a{padding:0.5rem 0;&:hover{text-decoration:none;}}@media all and (display-mode:standalone){padding-bottom:30px;}"]),kl=({success:n,fail:r})=>/*#__PURE__*/e(Tl,{children:[/*#__PURE__*/t(Al,{children:/*#__PURE__*/t(Il,{className:n?"success":r?"fail":""})}),/*#__PURE__*/t(Al,{children:/*#__PURE__*/t(xl,{className:n?"success":r?"fail":""})})]});let Al=/*#__PURE__*/kn.span.withConfig({displayName:"PositionedAbsoluteLoader",componentId:"sc-aba6339d-0"})(["&&{position:absolute;top:0;left:0;z-index:2;}"]),Tl=/*#__PURE__*/kn.span.withConfig({displayName:"ConnectionLoaderContainer",componentId:"sc-aba6339d-1"})(["position:relative;width:82px;height:82px;display:inline-block;"]);const xl=/*#__PURE__*/kn.span.withConfig({displayName:"Loader",componentId:"sc-aba6339d-2"})(["&&{width:82px;height:82px;border-width:4px;border-style:solid;border-color:",";border-bottom-color:transparent;border-radius:50%;display:inline-block;box-sizing:border-box;animation:rotation 1.2s linear infinite;transition:border-color 800ms;}@keyframes rotation{0%{transform:rotate(0deg);}100%{transform:rotate(360deg);}}&&&.success{border-color:var(--privy-color-icon-success);border-bottom-color:var(--privy-color-icon-success);}&&&.fail{border-color:var(--privy-color-icon-error);border-bottom-color:var(--privy-color-icon-error);}"],(e=>e.color??"var(--privy-color-icon-subtle)")),Il=/*#__PURE__*/kn(xl).withConfig({displayName:"LoaderFaint",componentId:"sc-aba6339d-3"})(["&&{border-bottom-color:",";border-color:",";animation:none;opacity:0.5;}"],(e=>e.color??"var(--privy-color-border-default)"),(e=>e.color??"var(--privy-color-border-default)")),El=e=>/*#__PURE__*/t(Sl,{color:e.color||"var(--privy-color-foreground-3)"});let Sl=/*#__PURE__*/kn(xl).withConfig({displayName:"StyledButtonLoader",componentId:"sc-aba6339d-4"})(["&&{height:1rem;width:1rem;margin:2px 0;border-width:1.5px;transition:border-color 200ms ease;}"]);const _l=({variant:e="primary",size:n="lg",children:r,success:a,...i})=>{switch(e){case"secondary":/*#__PURE__*/return t(Fl,{size:n,...i,children:r});case"error":/*#__PURE__*/return t(Fl,{$warn:!0,size:n,...i,children:r});case"muted":/*#__PURE__*/return t(Ol,{size:n,...i,children:r});default:/*#__PURE__*/return t(Ml,{size:n,success:a,...i,children:r})}},Nl=/*#__PURE__*/kn.button.withConfig({displayName:"BaseButton",componentId:"sc-e537b447-0"})(["display:flex;flex-direction:row;align-items:center;justify-content:center;user-select:none;&{width:auto;cursor:pointer;border-radius:",";font-size:14px;font-style:normal;font-weight:500;line-height:22px;letter-spacing:-0.016px;}&&{height:",";padding:0 ",";}"],(({$size:e})=>"sm"===e?"6px":"var(--privy-border-radius-sm)"),(({$size:e})=>"sm"===e?"28px":"48px"),(({$size:e})=>"sm"===e?"10px":"16px")),Ml=({children:r,loading:a,disabled:i,success:o,size:s="lg",loadingText:l="Loading...",as:c,onClick:d,...u})=>{let p="a"===c,h=!(!a&&!i);/*#__PURE__*/return t(Ul,{as:c,disabled:p?void 0:h,"aria-disabled":p?h:void 0,$success:o,$size:s,onClick:e=>{p&&h?e.preventDefault():d?.(e)},...u,children:a?/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(El,{}),l?/*#__PURE__*/t("span",{style:{marginLeft:"8px"},children:l}):null]}):r})},Wl=({children:e,loading:n,disabled:r,...a})=>/*#__PURE__*/t(Pl,{disabled:r,...a,children:n?/*#__PURE__*/t(El,{color:"var(--privy-color-foreground-accent)"}):e});let Pl=/*#__PURE__*/kn(Nl).withConfig({displayName:"StyledPrimaryButtonWithoutGray",componentId:"sc-e537b447-1"})(["position:relative;&&{background-color:var(--privy-color-accent);color:var(--privy-color-foreground-accent);transition:background-color 200ms ease;}&:hover{background-color:var(--privy-color-accent-dark);}&:active{background-color:var(--privy-color-accent-dark);}&:disabled,&:hover:disabled,&:active:disabled{cursor:not-allowed;color:var(--privy-color-foreground-disabled);background-color:var(--privy-color-accent-dark);}"]),Ul=/*#__PURE__*/kn(Nl).withConfig({displayName:"StyledPrimaryButton",componentId:"sc-e537b447-2"})(["position:relative;&&{background-color:",";color:var(--privy-color-foreground-accent);transition:background-color 200ms ease;}&:hover{background-color:",";}&:active{background-color:",";}&:focus{outline:none;box-shadow:0 0 0 3px #949df9;}&:disabled{background-color:var(--privy-color-background-2);border:1px solid var(--privy-color-border-default);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}&:hover:disabled,&:active:disabled{background-color:var(--privy-color-background-2);border:1px solid var(--privy-color-border-default);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}",""],(e=>e.$warn?"var(--privy-color-error-dark)":"var(--privy-color-accent)"),(e=>e.$warn?"var(--privy-color-error-dark)":"var(--privy-color-accent-dark)"),(e=>e.$warn?"var(--privy-color-error-dark)":"var(--privy-color-accent-dark)"),(e=>e.disabled&&/*#__PURE__*/An(["&&&,&&&:hover,&&&:active{background-color:var(--privy-color-background-2);border:1px solid var(--privy-color-border-default);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}"])));const Fl=({children:r,loading:a,disabled:i,size:o="lg",loadingText:s="Loading...",as:l,onClick:c,...d})=>{let u="a"===l,p=!(!a&&!i);/*#__PURE__*/return t(Ll,{as:l,disabled:u?void 0:p,"aria-disabled":u?p:void 0,$size:o,onClick:e=>{u&&p?e.preventDefault():c?.(e)},...d,children:a?/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(El,{}),s?/*#__PURE__*/t("span",{style:{marginLeft:"8px"},children:s}):null]}):r})},Ol=({children:r,loading:a,disabled:i,size:o="lg",loadingText:s="Loading...",as:l,onClick:c,...d})=>{let u="a"===l,p=!(!a&&!i);/*#__PURE__*/return t(Rl,{as:l,disabled:u?void 0:p,"aria-disabled":u?p:void 0,$size:o,onClick:e=>{u&&p?e.preventDefault():c?.(e)},...d,children:a?/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(El,{}),s?/*#__PURE__*/t("span",{style:{marginLeft:"8px"},children:s}):null]}):r})};let Ll=/*#__PURE__*/kn(Nl).withConfig({displayName:"StyledSecondaryButton",componentId:"sc-e537b447-3"})(["&&{border-width:1px;border-style:solid;border-color:",";background-color:var(--privy-color-background);color:",";transition:border-color 200ms ease,color 200ms ease,background-color 200ms ease;}&:hover{border-color:",";background-color:",";color:",";}&:active{border-color:",";background-color:",";color:",";}&:disabled{border-color:var(--privy-color-border-default);background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}&:hover:disabled,&:active:disabled{border-color:var(--privy-color-border-default);background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}",""],(e=>e.$warn?"var(--privy-color-border-error)":"var(--privy-color-accent)"),(e=>e.$warn?"var(--privy-color-error-dark)":"var(--privy-color-accent)"),(e=>e.$warn?"var(--privy-color-border-error)":"var(--privy-color-border-interactive-hover)"),(e=>e.$warn?"var(--privy-color-error-light)":"var(--privy-color-info-bg-hover)"),(e=>e.$warn?"var(--privy-color-error-dark)":"var(--privy-color-accent)"),(e=>e.$warn?"var(--privy-color-border-error)":"var(--privy-color-border-interactive)"),(e=>e.$warn?"var(--privy-color-error-bg-hover)":"var(--privy-color-info-bg)"),(e=>e.$warn?"var(--privy-color-error-dark)":"var(--privy-color-accent)"),(e=>e.disabled&&/*#__PURE__*/An(["&&&,&&&:hover,&&&:active{border-color:var(--privy-color-border-default);background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}"]))),Rl=/*#__PURE__*/kn(Nl).withConfig({displayName:"StyledMutedButton",componentId:"sc-e537b447-4"})(["&&{border-width:1px;border-style:solid;border-color:var(--privy-color-border-default);background-color:transparent;color:var(--privy-color-text-muted);transition:border-color 200ms ease,color 200ms ease,background-color 200ms ease;}&:hover{border-color:var(--privy-color-border-default);background-color:var(--privy-color-info-bg-hover);color:var(--privy-color-foreground-2);}&:active{border-color:var(--privy-color-border-default);background-color:var(--privy-color-info-bg);color:var(--privy-color-foreground-2);}&:focus{outline:none;box-shadow:0 0 0 3px #949df9;}&:disabled{border-color:var(--privy-color-border-default);background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}&:hover:disabled,&:active:disabled{border-color:var(--privy-color-border-default);background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}",""],(e=>e.disabled&&/*#__PURE__*/An(["&&&,&&&:hover,&&&:active{border-color:var(--privy-color-border-default);background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}"])));const Dl=({children:n,onClick:r,disabled:a,isSubmitting:i,...o})=>/*#__PURE__*/e(Bl,{$isSubmitting:i,onClick:r,disabled:a,...o,children:[/*#__PURE__*/t("span",{children:n}),
|
|
4
|
+
/*#__PURE__*/t("span",{children:/*#__PURE__*/t(El,{})})]});let Bl=/*#__PURE__*/kn.button.withConfig({displayName:"StyledEmbeddedButton",componentId:"sc-e537b447-7"})(["&&{color:var(--privy-color-accent);font-size:16px;font-style:normal;font-weight:500;line-height:24px;cursor:pointer;border-radius:0px var(--privy-border-radius-mdlg) var(--privy-border-radius-mdlg) 0px;border:none;transition:color 200ms ease;@media (min-width:441px){font-size:14px;}:hover{color:var(--privy-color-accent-dark);}&& > :first-child{opacity:",";}&& > :last-child{position:absolute;display:flex;top:50%;left:50%;transform:translate3d(-50%,-50%,0);opacity:",";}:disabled,:hover:disabled{color:var(--privy-color-foreground-disabled);cursor:not-allowed;}}"],(e=>e.$isSubmitting?0:1),(e=>e.$isSubmitting?1:0));const zl=({backFn:e})=>/*#__PURE__*/t("div",{children:/*#__PURE__*/t(jl,{onClick:e,children:/*#__PURE__*/t(Mn,{height:"16px",width:"16px",strokeWidth:2})})}),Hl=({infoFn:e})=>/*#__PURE__*/t("div",{children:/*#__PURE__*/t(ql,{"aria-label":"info",onClick:e,children:/*#__PURE__*/t(Wn,{height:"22px",width:"22px",strokeWidth:2})})}),Vl=e=>/*#__PURE__*/t("div",{children:/*#__PURE__*/t(jl,{"aria-label":"close modal",onClick:e.onClose,children:/*#__PURE__*/t(Pn,{height:"16px",width:"16px",strokeWidth:2})})}),$l=({backFn:n,infoFn:r,onClose:a,title:i,closeable:o=!0,className:s})=>{let{closePrivyModal:l}=Ft(),c=ks();/*#__PURE__*/return e(Kl,{className:s,children:[/*#__PURE__*/e(Gl,{children:[n&&/*#__PURE__*/t(zl,{backFn:n}),r&&/*#__PURE__*/t(Hl,{infoFn:r})]}),i&&/*#__PURE__*/t(Yl,{id:"privy-dialog-title",children:i}),/*#__PURE__*/t(Zl,{children:!c.render.standalone&&o&&/*#__PURE__*/t(Vl,{onClose:a||(()=>l())})})]})};let jl=/*#__PURE__*/kn.button.withConfig({displayName:"StyledButton",componentId:"sc-e033e17a-0"})(["&&{cursor:pointer;display:flex;opacity:0.6;background-color:var(--privy-color-background-2);border-radius:var(--privy-border-radius-full);padding:4px;> svg{margin:auto;color:var(--privy-color-foreground);}:hover{opacity:1;}}"]),ql=/*#__PURE__*/kn(jl).withConfig({displayName:"TransparentStyledButton",componentId:"sc-e033e17a-1"})(["&&{background-color:transparent;}"]),Kl=/*#__PURE__*/kn.div.withConfig({displayName:"StyledHeader",componentId:"sc-e033e17a-2"})(["padding:16px 0;display:flex;align-items:center;justify-content:space-between;h2{font-size:16px;line-height:24px;font-weight:600;color:var(--privy-color-foreground);}"]),Gl=/*#__PURE__*/kn.div.withConfig({displayName:"LeftActionContainer",componentId:"sc-e033e17a-3"})(["flex:1;align-items:center;display:flex;gap:8px;"]),Zl=/*#__PURE__*/kn.div.withConfig({displayName:"RightActionContainer",componentId:"sc-e033e17a-4"})(["flex:1;display:flex;justify-content:flex-end;"]),Yl=/*#__PURE__*/kn.div.withConfig({displayName:"TitleContainer",componentId:"sc-e033e17a-5"})(["overflow:hidden;white-space:nowrap;max-width:100%;text-overflow:ellipsis;text-align:center;color:var(--privy-color-foreground-2);"]);const Ql=({size:n})=>/*#__PURE__*/t(Xl,{$size:n,children:/*#__PURE__*/e(Jl,{children:[/*#__PURE__*/t(ec,{}),/*#__PURE__*/t(tc,{})]})});let Xl=/*#__PURE__*/kn.div.withConfig({displayName:"LoadingContainer",componentId:"sc-5be8451e-0"})(["--spinner-size:",";display:inline-flex;justify-content:center;align-items:center;@media all and (display-mode:standalone){margin-bottom:30px;}"],(e=>e.$size?e.$size:"96px")),Jl=/*#__PURE__*/kn.div.withConfig({displayName:"SpinnerContainer",componentId:"sc-5be8451e-1"})(["position:relative;height:var(--spinner-size);width:var(--spinner-size);opacity:1;animation:fadein 200ms ease;"]),ec=/*#__PURE__*/kn.div.withConfig({displayName:"CircleFixed",componentId:"sc-5be8451e-2"})(["position:absolute;top:0;right:0;bottom:0;left:0;width:var(--spinner-size);height:var(--spinner-size);&&{border:4px solid var(--privy-color-border-default);border-radius:50%;}"]),tc=/*#__PURE__*/kn.div.withConfig({displayName:"CircleRotate",componentId:"sc-5be8451e-3"})(["position:absolute;top:0;right:0;bottom:0;left:0;width:var(--spinner-size);height:var(--spinner-size);animation:spin 1200ms linear infinite;&&{border:4px solid;border-color:var(--privy-color-icon-subtle) transparent transparent transparent;border-radius:50%;}@keyframes spin{from{transform:rotate(0deg);}to{transform:rotate(360deg);}}"]);const nc=/*#__PURE__*/kn.div.withConfig({displayName:"ScreenRoot",componentId:"sc-cc9e9a32-0"})(["--screen-space:16px;--screen-space-lg:calc(var(--screen-space) * 1.5);position:relative;overflow:hidden;margin:0 calc(-1 * var(--screen-space));height:100%;border-radius:var(--privy-border-radius-lg);"]),rc=/*#__PURE__*/kn.div.withConfig({displayName:"ScreenRootInner",componentId:"sc-cc9e9a32-1"})(["display:flex;flex-direction:column;gap:calc(var(--screen-space) * 1.5);width:100%;background:var(--privy-color-background);padding:0 var(--screen-space-lg) var(--screen-space);height:100%;border-radius:var(--privy-border-radius-lg);"]),ac=/*#__PURE__*/kn.div.withConfig({displayName:"HeaderContainer",componentId:"sc-cc9e9a32-2"})(["position:relative;display:flex;flex-direction:column;"]),ic=/*#__PURE__*/kn($l).withConfig({displayName:"StyledModalHeader",componentId:"sc-cc9e9a32-3"})(["margin:0 -8px;"]),oc=/*#__PURE__*/kn.div.withConfig({displayName:"BodyContainer",componentId:"sc-cc9e9a32-4"})(["flex:1 1 auto;display:flex;flex-direction:column;overflow-y:auto;padding:3px;margin:-3px;&::-webkit-scrollbar{display:none;}scrollbar-gutter:stable both-edges;scrollbar-width:none;-ms-overflow-style:none;"," background-repeat:no-repeat;background-size:100% 32px,100% 16px;background-attachment:local,scroll;"],(({$colorScheme:e})=>"light"===e?"background: linear-gradient(var(--privy-color-background), var(--privy-color-background) 70%) bottom, linear-gradient(rgba(0, 0, 0, 0) 20%, rgba(0, 0, 0, 0.06)) bottom;":"dark"===e?"background: linear-gradient(var(--privy-color-background), var(--privy-color-background) 70%) bottom, linear-gradient(rgba(255, 255, 255, 0) 20%, rgba(255, 255, 255, 0.06)) bottom;":void 0)),sc=/*#__PURE__*/kn.div.withConfig({displayName:"FooterContainer",componentId:"sc-cc9e9a32-5"})(["display:flex;flex-direction:column;gap:var(--screen-space-lg);"]);let lc=/*#__PURE__*/kn.div.withConfig({displayName:"CenteredHeader",componentId:"sc-cc9e9a32-6"})(["text-align:center;display:flex;flex-direction:column;align-items:center;gap:var(--screen-space);"]),cc=/*#__PURE__*/kn.div.withConfig({displayName:"TitleContainer",componentId:"sc-cc9e9a32-7"})(["display:flex;flex-direction:column;gap:4px;"]),dc=/*#__PURE__*/kn.h3.withConfig({displayName:"HeaderTitle",componentId:"sc-cc9e9a32-8"})(["&&{font-size:20px;line-height:32px;font-weight:500;color:var(--privy-color-foreground);margin:0;}"]),uc=/*#__PURE__*/kn.p.withConfig({displayName:"HeaderSubtitle",componentId:"sc-cc9e9a32-9"})(["&&{margin:0;font-size:16px;font-weight:300;line-height:24px;color:var(--privy-color-foreground);}"]),pc=/*#__PURE__*/kn.div.withConfig({displayName:"IconContainer",componentId:"sc-cc9e9a32-10"})(["background:",";border-radius:50%;width:64px;height:64px;display:flex;align-items:center;justify-content:center;"],(({$variant:e})=>{switch(e){case"success":return"var(--privy-color-success-bg, #EAFCEF)";case"warning":return"var(--privy-color-warn, #FEF3C7)";case"error":return"var(--privy-color-error-bg, #FEE2E2)";case"loading":case"logo":return"transparent";default:return"var(--privy-color-background-2)"}})),hc=/*#__PURE__*/kn.div.withConfig({displayName:"LogoContainer",componentId:"sc-cc9e9a32-11"})(["display:flex;align-items:center;justify-content:center;margin-bottom:var(--screen-space);img,svg{max-height:90px;max-width:180px;}"]),mc=/*#__PURE__*/kn.div.withConfig({displayName:"LoadingWithIconContainer",componentId:"sc-cc9e9a32-12"})(["display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%;height:82px;> div{position:relative;}> div > :first-child{position:relative;}> div > :last-child{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);}"]);const gc=({children:e,...n})=>/*#__PURE__*/t(nc,{children:/*#__PURE__*/t(rc,{...n,children:e})});let yc=/*#__PURE__*/kn.div.withConfig({displayName:"ProgressBarContainer",componentId:"sc-cc9e9a32-13"})(["position:absolute;top:0;left:calc(-1 * var(--screen-space-lg));width:calc(100% + calc(var(--screen-space-lg) * 2));height:4px;background:var(--privy-color-background-2);border-top-left-radius:inherit;border-top-right-radius:inherit;overflow:hidden;"]),fc=/*#__PURE__*/kn(vl).withConfig({displayName:"StyledBlobbyFooter",componentId:"sc-cc9e9a32-14"})(["padding:0;&& a{padding:0;color:var(--privy-color-foreground-3);}"]),wc=/*#__PURE__*/kn.div.withConfig({displayName:"ProgressBarFill",componentId:"sc-cc9e9a32-15"})(["height:100%;width:","%;background:var(--privy-color-foreground-3);border-radius:2px;transition:width 300ms ease-in-out;"],(({pct:e})=>e)),vc=({step:e})=>e?/*#__PURE__*/t(yc,{children:/*#__PURE__*/t(wc,{pct:Math.min(100,e.current/e.total*100)})}):null;gc.Header=({title:n,subtitle:r,icon:a,iconVariant:i,iconLoadingStatus:o,showBack:s,onBack:l,showInfo:c,onInfo:d,showClose:u,onClose:p,step:h,...m})=>/*#__PURE__*/e(ac,{...m,children:[/*#__PURE__*/t(ic,{backFn:s?l:void 0,infoFn:c?d:void 0,onClose:u?p:void 0,closeable:u}),(a||i||n||r)&&/*#__PURE__*/e(lc,{children:[a||i?/*#__PURE__*/t(gc.Icon,{icon:a,variant:i,loadingStatus:o}):null,/*#__PURE__*/e(cc,{children:[n&&/*#__PURE__*/t(dc,{children:n}),r&&/*#__PURE__*/t(uc,{children:r})]})]}),h&&/*#__PURE__*/t(vc,{step:h})]}),gc.Body=/*#__PURE__*/a.forwardRef((({children:e,...n},r)=>/*#__PURE__*/t(oc,{ref:r,...n,children:e}))),gc.Body.displayName="Screen.Body",gc.Footer=({children:e,...n})=>/*#__PURE__*/t(sc,{...n,children:e}),gc.Actions=({children:e,...n})=>/*#__PURE__*/t(Cc,{...n,children:e}),gc.HelpText=({children:e,...n})=>/*#__PURE__*/t(bc,{...n,children:e}),gc.Watermark=()=>/*#__PURE__*/t(fc,{}),gc.Icon=({icon:n,variant:r="subtle",loadingStatus:i})=>"logo"===r&&n?/*#__PURE__*/t(hc,"string"==typeof n?{children:/*#__PURE__*/t("img",{src:n,alt:""})}:/*#__PURE__*/a.isValidElement(n)?{children:n}:{children:/*#__PURE__*/a.createElement(n)}):"loading"===r?n?
|
|
5
|
+
/*#__PURE__*/t(mc,{children:/*#__PURE__*/e("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:[/*#__PURE__*/t(kl,{success:i?.success,fail:i?.fail}),"string"==typeof n?
|
|
6
|
+
/*#__PURE__*/t("span",{style:{background:`url('${n}') 0 0 / contain`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"contain"}}):/*#__PURE__*/a.isValidElement(n)?
|
|
7
|
+
/*#__PURE__*/a.cloneElement(n,{style:{width:"38px",height:"38px"}}):
|
|
8
|
+
/*#__PURE__*/a.createElement(n,{style:{width:"38px",height:"38px"}})]})}):
|
|
9
|
+
/*#__PURE__*/t(pc,{$variant:r,children:/*#__PURE__*/t(Ql,{size:"64px"})}):/*#__PURE__*/t(pc,{$variant:r,children:n&&("string"==typeof n?
|
|
10
|
+
/*#__PURE__*/t("img",{src:n,alt:"",style:{width:"32px",height:"32px",borderRadius:"6px"}}):/*#__PURE__*/a.isValidElement(n)?n:
|
|
11
|
+
/*#__PURE__*/a.createElement(n,{width:32,height:32,stroke:(()=>{switch(r){case"success":return"var(--privy-color-icon-success)";case"warning":return"var(--privy-color-icon-warning)";case"error":return"var(--privy-color-icon-error)";default:return"var(--privy-color-icon-muted)"}})(),strokeWidth:2}))});let Cc=/*#__PURE__*/kn.div.withConfig({displayName:"ActionsContainer",componentId:"sc-cc9e9a32-16"})(["width:100%;display:flex;flex-direction:column;gap:calc(var(--screen-space) / 2);"]),bc=/*#__PURE__*/kn.p.withConfig({displayName:"HelpTextContainer",componentId:"sc-cc9e9a32-17"})(["&&{margin:0;width:100%;text-align:center;color:var(--privy-color-foreground-3);font-size:14px;line-height:22px;& a{color:var(--privy-color-accent);}}"]);const kc=({primaryCta:r,secondaryCta:a,helpText:i,watermark:o=!0,children:s,...l})=>{let c=r||a?/*#__PURE__*/e(n,{children:[r&&(()=>{let{label:e,...n}=r,a=n.variant||"primary";/*#__PURE__*/return t(_l,{...n,variant:a,style:{width:"100%",...n.style},children:e})})(),a&&(()=>{let{label:e,...n}=a,r=n.variant||"secondary";/*#__PURE__*/return t(_l,{...n,variant:r,style:{width:"100%",...n.style},children:e})})()]}):null;/*#__PURE__*/return e(gc,{id:l.id,className:l.className,children:[/*#__PURE__*/t(gc.Header,{...l}),s?/*#__PURE__*/t(gc.Body,{children:s}):null,i||c||o?/*#__PURE__*/e(gc.Footer,{children:[i?/*#__PURE__*/t(gc.HelpText,{children:i}):null,c?/*#__PURE__*/t(gc.Actions,{children:c}):null,o?/*#__PURE__*/t(gc.Watermark,{}):null]}):null]})},Ac=/*#__PURE__*/kn.div.withConfig({displayName:"AppLogoContainer",componentId:"sc-ba98f772-0"})(["display:flex;flex-direction:column;align-items:center;padding:0px 0px 30px;@media (max-width:440px){padding:10px 10px 20px;}"]),Tc=/*#__PURE__*/kn.div.withConfig({displayName:"Title",componentId:"sc-ba98f772-1"})(["font-size:18px;line-height:30px;text-align:center;font-weight:600;margin-bottom:10px;"]),xc=/*#__PURE__*/kn.div.withConfig({displayName:"SubTitle",componentId:"sc-ba98f772-2"})(["font-size:0.875rem;text-align:center;"]),Ic=/*#__PURE__*/kn.div.withConfig({displayName:"Container",componentId:"sc-ba98f772-3"})(["display:flex;flex-direction:column;align-items:center;gap:10px;flex-grow:1;padding:20px 0;@media (max-width:440px){padding:10px 10px 20px;}"]),Ec=/*#__PURE__*/kn.div.withConfig({displayName:"List",componentId:"sc-ba98f772-4"})(["display:flex;flex-direction:column;align-items:stretch;gap:0.75rem;padding:1rem 0rem 0rem;flex-grow:1;width:100%;"]),Sc=/*#__PURE__*/kn.div.withConfig({displayName:"ListItemIcon",componentId:"sc-ba98f772-5"})(["width:25px;display:flex;align-items:center;justify-content:flex-start;> svg{z-index:2;height:25px !important;width:25px !important;color:var(--privy-color-accent);}"]),_c=/*#__PURE__*/kn.div.withConfig({displayName:"ListItem",componentId:"sc-ba98f772-6"})(["display:flex;align-items:center;gap:10px;font-size:0.875rem;line-height:1rem;text-align:left;"]),Nc=/*#__PURE__*/kn.div.withConfig({displayName:"BottomSection",componentId:"sc-ba98f772-7"})(["display:flex;flex-direction:column;gap:10px;padding-top:20px;"]),Mc=/*#__PURE__*/kn.div.withConfig({displayName:"MethodList",componentId:"sc-ba98f772-8"})(["display:flex;flex-direction:column;align-items:stretch;gap:1rem;padding:1rem 0rem 0rem;flex-grow:1;width:100%;"]),Wc=/*#__PURE__*/kn.div.withConfig({displayName:"MethodListItem",componentId:"sc-ba98f772-9"})(["display:flex;gap:5px;width:100%;position:relative;"]),Pc=/*#__PURE__*/kn.button.withConfig({displayName:"RemoveMethodButton",componentId:"sc-ba98f772-10"})(["&&{background-color:transparent;color:var(--privy-color-foreground-3);padding:0 0.75rem;display:flex;align-items:center;height:100%;> svg{z-index:2;height:20px !important;width:20px !important;}}&&:hover{color:var(--privy-color-error);}"]),Uc=/*#__PURE__*/kn.div.withConfig({displayName:"MethodText",componentId:"sc-ba98f772-11"})(["display:flex;align-items:center;gap:0.5rem;> svg{z-index:2;height:20px !important;width:20px !important;}"]),Fc=/*#__PURE__*/kn.div.withConfig({displayName:"ExtraText",componentId:"sc-ba98f772-12"})(["display:flex;align-items:center;gap:6px;font-weight:400 !important;color:",";> svg{z-index:2;height:18px !important;width:18px !important;display:flex !important;align-items:flex-end;}"],(e=>e.$isAccent?"var(--privy-color-accent)":"var(--privy-color-foreground-3)")),Oc=/*#__PURE__*/kn.div.withConfig({displayName:"SmsInsecureText",componentId:"sc-ba98f772-13"})(["width:100%;display:flex;justify-content:space-between;"]),Lc=/*#__PURE__*/kn.p.withConfig({displayName:"TermsText",componentId:"sc-ba98f772-14"})(["text-align:left;width:100%;color:var(--privy-color-foreground-3) !important;"]),Rc=/*#__PURE__*/kn.button.withConfig({displayName:"PrimaryTextButton",componentId:"sc-ba98f772-15"})(["display:flex;flex-direction:row;align-items:center;justify-content:center;user-select:none;&{width:100%;cursor:pointer;border-radius:var(--privy-border-radius-md);font-size:0.875rem;line-height:1rem;font-style:normal;font-weight:500;line-height:22px;letter-spacing:-0.016px;}&&{color:",";background-color:transparent;padding:0.5rem 0px;}&:hover{text-decoration:underline;}"],(e=>"dark"===e.theme?"var(--privy-color-foreground-2)":"var(--privy-color-accent)")),Dc=/*#__PURE__*/kn.div.withConfig({displayName:"IconWrapper",componentId:"sc-ba98f772-16"})(["display:flex;align-items:center;justify-content:center;color:var(--privy-color-accent);width:100%;> svg{z-index:2;width:3rem;height:3rem;}"]),Bc=/*#__PURE__*/kn.div.withConfig({displayName:"ErrorMessage",componentId:"sc-ba98f772-17"})(["color:var(--privy-color-error);"]),zc=({handleClose:n,user:r,onSelect:a})=>/*#__PURE__*/e(kc,{title:"Verify your identity",subtitle:"Choose a verification method",icon:Nn,iconVariant:"subtle",onClose:n,showClose:!0,watermark:!0,children:[/*#__PURE__*/e(Mc,{children:[r.mfaMethods.includes("totp")&&/*#__PURE__*/e(ul,{onClick:()=>a("totp"),children:[/*#__PURE__*/t(pl,{children:/*#__PURE__*/t(En,{})}),"Authenticator app"]},"totp"),r.mfaMethods.includes("sms")&&/*#__PURE__*/e(ul,{onClick:()=>a("sms"),children:[/*#__PURE__*/t(pl,{children:/*#__PURE__*/t(_n,{})}),"SMS"]},"sms"),r.mfaMethods.includes("passkey")&&/*#__PURE__*/e(ul,{onClick:()=>a("passkey"),children:[/*#__PURE__*/t(pl,{children:/*#__PURE__*/t(Sn,{})}),"Passkey"]},"passkey")]}),/*#__PURE__*/t(bl,{})]}),Hc=({label:n,children:r,valueStyles:a})=>/*#__PURE__*/e(Vc,{children:[/*#__PURE__*/t("div",{children:n}),/*#__PURE__*/t($c,{style:{...a},children:r})]});let Vc=/*#__PURE__*/kn.div.withConfig({displayName:"StyledDetailsRow",componentId:"sc-4ebfdd45-0"})(["display:flex;align-items:center;justify-content:space-between;width:100%;> :first-child{color:var(--privy-color-foreground-3);text-align:left;}> :last-child{color:var(--privy-color-foreground-2);text-align:right;}"]),$c=/*#__PURE__*/kn.div.withConfig({displayName:"ValueWrapper",componentId:"sc-4ebfdd45-1"})(["font-size:14px;line-height:100%;display:flex;align-items:center;justify-content:center;border-radius:var(--privy-border-radius-full);background-color:var(--privy-color-background-2);padding:4px 8px;"]),jc=new Intl.NumberFormat(void 0,{style:"currency",currency:"USD",maximumFractionDigits:2}),qc=e=>jc.format(e);const Kc=(e,t)=>{let n=qc(t*parseFloat(e));return"$0.00"!==n?n:"<$0.01"},Gc=(e,t)=>{let n=qc(t*parseFloat(Dt(e)));return"$0.00"===n?"<$0.01":n},Zc=(e,t,n=6,r=!1)=>`${Yc(e,n,r)} ${t}`,Yc=(e,t=6,n=!1)=>{let r=parseFloat(Dt(e)).toFixed(t).replace(/0+$/,"").replace(/\.$/,"");return n?r:`${"0"===r?"<0.001":r}`},Qc=e=>e.reduce(((e,t)=>e+t),0n),Xc=(e,t)=>{let{chains:n}=Ft(),r=`https://etherscan.io/address/${t}`,a=`${((e,t)=>{let n=Number(e),r=t.find((e=>e.id===n));if(!r)throw new Le(`Unsupported chainId ${e}`,4901);return r.blockExplorers?.default.url})(e,n)}/address/${t}`;if(!a)return r;try{new URL(a)}catch{return r}return a},Jc=1e9,ed="11111111111111111111111111111111",td="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",nd="TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb",rd="ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",ad=["CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C","CPMDWBwJDtYax9qW7AyRuVC19Cc4L4Vcy4n2BHAbHkCW"],id=["JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"],od={"solana:mainnet":{EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v:{symbol:"USDC",decimals:6,address:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB:{symbol:"USDT",decimals:6,address:"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"},So11111111111111111111111111111111111111112:{symbol:"SOL",decimals:9,address:"So11111111111111111111111111111111111111112"}},"solana:devnet":{"4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU":{symbol:"USDC",decimals:6,address:"4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU"},EJwZgeZrdC8TXTQbQBoL6bfuAnFUUy1PVCMB4DYPzVaS:{symbol:"USDT",decimals:6,address:"EJwZgeZrdC8TXTQbQBoL6bfuAnFUUy1PVCMB4DYPzVaS"},So11111111111111111111111111111111111111112:{symbol:"SOL",decimals:9,address:"So11111111111111111111111111111111111111112"}},"solana:testnet":{}};function sd(e,t){let n=parseFloat(e.toString())/Jc,r=ld.format(t*n);return"$0.00"===r?"<$0.01":r}let ld=new Intl.NumberFormat(void 0,{style:"currency",currency:"USD",maximumFractionDigits:2});const cd=(e,t=0)=>{let n=e[t],r=e[t+7];if(!n||!r)throw Error(`Buffer offset out of range: first: ${n}, last: ${r}.`);return(BigInt(e[t+4]+256*e[t+5]+65536*e[t+6]+(r<<24))<<32n)+BigInt(n+256*e[++t]+65536*e[++t]+16777216*e[++t])};function dd(e,t=0){let n=0n;for(let r=0;r<8;r++)n|=BigInt(e[t+r])<<BigInt(8*r);return n}async function ud(e,t){try{return await e}catch{return t}}const pd="11111111111111111111111111111111",hd=["CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C","CPMDWBwJDtYax9qW7AyRuVC19Cc4L4Vcy4n2BHAbHkCW"],md=["JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"];function gd(e,t=6,n=!1,r=!1){let a=(parseFloat(e.toString())/1e9).toFixed(t).replace(/0+$/,"").replace(/\.$/,""),i=r?"":" SOL";return n?`${a}${i}`:`${"0"===a?"<0.001":a}${i}`}function yd({amount:e,fee:t,tokenPrice:n,isUsdc:r}){let a=BigInt(Math.floor(parseFloat(e)*10**(r?6:9))),i=r?a:a+t;return{fundingAmountInBaseUnit:a,fundingAmountInUsd:n?sd(a,n):void 0,totalPriceInUsd:n?sd(i,n):void 0,totalPriceInNativeCurrency:gd(i),feePriceInNativeCurrency:gd(t),feePriceInUsd:n?sd(t,n):void 0}}let fd={"mainnet-beta":{EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v:{symbol:"USDC",decimals:6,address:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB:{symbol:"USDT",decimals:6,address:"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"},So11111111111111111111111111111111111111112:{symbol:"SOL",decimals:9,address:"So11111111111111111111111111111111111111112"}},devnet:{"4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU":{symbol:"USDC",decimals:6,address:"4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU"},EJwZgeZrdC8TXTQbQBoL6bfuAnFUUy1PVCMB4DYPzVaS:{symbol:"USDT",decimals:6,address:"EJwZgeZrdC8TXTQbQBoL6bfuAnFUUy1PVCMB4DYPzVaS"},So11111111111111111111111111111111111111112:{symbol:"SOL",decimals:9,address:"So11111111111111111111111111111111111111112"}},testnet:{}};async function wd(e,t,n){let r=fd[e];if(!r[n]){let a=await t.getSplTokenMetadata({mintAddress:n,cluster:e});a&&(r[n]={address:n,symbol:a.symbol,decimals:a.decimals})}return r[n]}function vd(e){return"version"in e}function Cd(e,t){let n=(vd(e)?e.message:e.compileMessage()).staticAccountKeys.find((e=>e.toBase58()===t));if(!n)throw Error(`Transaction does not contain public key ${t}`);return n}function bd(e,t,n){return{signature:e,parsedTransaction:n??null,signedTransaction:t,fees:BigInt(n?.meta?.fee||0)}}async function kd(e,t){let{value:n}=await t.simulateTransaction(e);if("BlockhashNotFound"===n.err)throw Error("Simulation failed: Blockhash not found");return null==n.err&&n.logs?.every((e=>!/insufficient funds/gi.test(e)))}async function Ad({tx:e,connection:t,client:n,checkFunds:r}){let a=vd(e)?e.message:e.compileMessage(),i=a.staticAccountKeys[0]?.toBase58()??"",o=await async function(e,t){return BigInt((vd(e)?(await t.getFeeForMessage(e.message)).value:await e.getEstimatedFee(t))??0)}(e,t),s=!r||await ud(kd(e,t),!0),l={},c=[],d=await async function(e,t){return[...e.staticAccountKeys.map((e=>e)),...(await Promise.all(e.addressTableLookups.map((async e=>t.getAddressLookupTable(e.accountKey).then((({value:e})=>e)))))).map(((t,n)=>[...e.addressTableLookups[n]?.writableIndexes.map((e=>{let r=t?.state.addresses[e];if(r)return{key:r,isWritable:!0,altIdx:n}}))??[],...e.addressTableLookups[n]?.readonlyIndexes.map((e=>{let r=t?.state.addresses[e];if(r)return{key:r,isWritable:!1,altIdx:n}}))??[]])).flat().filter((e=>!!e)).sort(((e,t)=>e.isWritable!==t.isWritable?e.isWritable?-1:1:e.altIdx-t.altIdx)).map((({key:e})=>e))]}(a,t);for(let e of a.compiledInstructions){let r=a.staticAccountKeys[e.programIdIndex]?.toBase58()||"";if("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"!==r&&"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"!==r)if(r!==pd){if("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"===r){let t=await ud(function(e,t,n){let[r,a,i,o]=e.accountKeyIndexes.map((e=>t[e]));return{type:"ata-creation",program:n,payer:r?.toBase58(),ata:a?.toBase58(),owner:i?.toBase58(),mint:o?.toBase58()}}(e,d,r));if(!t){c.push({type:"unknown",program:r,discriminator:e.data[0]});continue}if(c.push(t),t.ata&&t.owner&&t.mint){l[t.ata]={owner:t.owner,mint:t.mint};continue}}if(hd.includes(r)){let a=await ud(Ed(e,d,t,n,r));if(!a){c.push({type:"unknown",program:r,discriminator:e.data[0]});continue}c.push(a)}else if(md.includes(r)){let a=await ud(Sd(e,d,t,n,r));if(!a){c.push({type:"unknown",program:r,discriminator:e.data[0]});continue}c.push(a)}else c.push({type:"unknown",program:r,discriminator:e.data[0]})}else{let t=await ud(Id(e,d));if(!t){c.push({type:"unknown",program:r,discriminator:e.data[0]});continue}c.push(t)}else{let a=await ud(xd(e,d,t,n,l,r));if(!a){c.push({type:"unknown",program:r,discriminator:e.data[0]});continue}c.push(a),"spl-transfer"===a.type&&(a.fromAta&&a.fromAccount&&a.token.address&&(l[a.fromAta]??={owner:a.fromAccount,mint:a.token.address}),a.toAta&&a.toAccount&&a.token.address&&(l[a.toAta]??={owner:a.toAccount,mint:a.token.address}))}}return{spender:i,fee:o,instructions:c,hasFunds:!!s}}function Td(e,t=0){try{return dd(e,t)}catch{}try{return e.readBigInt64LE(t)}catch{}let n=Ai(e);try{return cd(n)}catch{}try{return n.subarray(t).readBigInt64LE()}catch{}try{return n.readBigInt64LE(t)}catch{}return 0n}async function xd(e,t,n,r,a,i){let o=e.data[0],s=e.accountKeyIndexes.map((e=>t[e]));if(1===o){let[e,t,n]=s;return{type:"spl-init-account",program:i,account:e?.toBase58(),mint:t?.toBase58(),owner:n?.toBase58()}}if(3===o){let t,o,[l,c,d]=s,u="",p=c?a[c.toBase58()]:void 0;if(p)t=p.owner,u=p.mint;else if(c){let e=await n.getParsedAccountInfo(c,"confirmed"),r=e.value?.data;t=r?.parsed?.info?.owner,u=r?.parsed?.info?.mint??"",o=r?.parsed?.info?.tokenAmount?.decimals}if(!u&&l){let e=await n.getParsedAccountInfo(l,"confirmed"),t=e.value?.data;u=t?.parsed?.info?.mint??""}let h=ds(n.rpcEndpoint),m=await wd(h,r,u),g=m?.symbol??"";return o??=m?.decimals??9,{type:"spl-transfer",program:i,fromAta:l?.toBase58(),fromAccount:d?.toBase58(),toAta:c?.toBase58(),toAccount:t,value:Td(e.data,1),token:{symbol:g,decimals:o,address:u}}}if(9===o){let[e,t,n]=s;return{type:"spl-close-account",program:i,source:e?.toBase58(),destination:t?.toBase58(),owner:n?.toBase58()}}if(17===o)return{type:"spl-sync-native",program:i};throw Error(`Token program instruction type ${o} not supported`)}async function Id(e,t){let n=e.data[0],r=e.accountKeyIndexes.map((e=>t[e]));if(0===n){let[,t]=r;return{type:"create-account",program:pd,account:t?.toBase58(),value:Td(e.data,4),withSeed:!1}}if(2===n){let[t,n]=r;return{type:"sol-transfer",program:pd,fromAccount:t?.toBase58(),toAccount:n?.toBase58(),token:{symbol:"SOL",decimals:9},value:Td(e.data,4),withSeed:!1}}if(3===n){let[,t]=r,n=Td(e.data.slice(e.data.length-32-8-8));return{type:"create-account",program:pd,account:t?.toBase58(),withSeed:!0,value:n}}if(11===n){let[t,n]=r;return{type:"sol-transfer",program:pd,fromAccount:t?.toBase58(),toAccount:n?.toBase58(),value:Td(e.data,4),token:{symbol:"SOL",decimals:9},withSeed:!0}}throw Error(`System program instruction type ${n} not supported`)}async function Ed(e,t,n,r,a){let i=e.accountKeyIndexes.map((e=>t[e]?.toBase58())),o=e.data[0],s=ds(n.rpcEndpoint);if(143===o){let t=i[10],n=i[11];return{type:"raydium-swap-base-input",program:a,mintIn:t,mintOut:n,tokenIn:t?await wd(s,r,t):void 0,tokenOut:n?await wd(s,r,n):void 0,amountIn:Td(e.data,8),minimumAmountOut:Td(e.data,16)}}if(55===o){let t=i[10],n=i[11];return{type:"raydium-swap-base-output",program:a,mintIn:t,mintOut:n,tokenIn:t?await wd(s,r,t):void 0,tokenOut:n?await wd(s,r,n):void 0,maxAmountIn:Td(e.data,8),amountOut:Td(e.data,16)}}throw Error(`Raydium swap program instruction type ${o} not supported`)}async function Sd(e,t,n,r,a){let i=e.data[0],o=e.accountKeyIndexes.map((e=>t[e])),s=ds(n.rpcEndpoint);if([208,51,239,151,123,43,237,92].includes(i)){let t=o[5]?.toBase58(),n=o[6]?.toBase58();return{type:"jupiter-swap-exact-out-route",program:a,mintIn:t,mintOut:n,tokenIn:t?await wd(s,r,t):void 0,tokenOut:n?await wd(s,r,n):void 0,outAmount:Td(e.data,e.data.length-1-2-8-8),quotedInAmount:Td(e.data,e.data.length-1-2-8)}}if([176,209,105,168,154,125,69,62].includes(i)){let t=o[7]?.toBase58(),n=o[8]?.toBase58();return{type:"jupiter-swap-exact-out-route",program:a,mintIn:t,mintOut:n,tokenIn:t?await wd(s,r,t):void 0,tokenOut:n?await wd(s,r,n):void 0,outAmount:Td(e.data,e.data.length-1-2-8-8),quotedInAmount:Td(e.data,e.data.length-1-2-8)}}if([193,32,155,51,65,214,156,129].includes(i)){let t=o[7]?.toBase58(),n=o[8]?.toBase58();return{type:"jupiter-swap-shared-accounts-route",program:a,mintIn:t,mintOut:n,tokenIn:t?await wd(s,r,t):void 0,tokenOut:n?await wd(s,r,n):void 0,inAmount:Td(e.data,e.data.length-1-2-8-8),quotedOutAmount:Td(e.data,e.data.length-1-2-8)}}throw[62,198,214,193,213,159,108,210].includes(i)&&console.warn("Jupiter swap program instruction 'claim' not implemented"),[116,206,27,191,166,19,0,73].includes(i)&&console.warn("Jupiter swap program instruction 'claim_token' not implemented"),[26,74,236,151,104,64,183,249].includes(i)&&console.warn("Jupiter swap program instruction 'close_token' not implemented"),[229,194,212,172,8,10,134,147].includes(i)&&console.warn("Jupiter swap program instruction 'create_open_orders' not implemented"),[28,226,32,148,188,136,113,171].includes(i)&&console.warn("Jupiter swap program instruction 'create_program_open_orders' not implemented"),[232,242,197,253,240,143,129,52].includes(i)&&console.warn("Jupiter swap program instruction 'create_token_ledger' not implemented"),[147,241,123,100,244,132,174,118].includes(i)&&console.warn("Jupiter swap program instruction 'create_token_account' not implemented"),[229,23,203,151,122,227,173,42].includes(i)&&console.warn("Jupiter swap program instruction 'route' not implemented"),[150,86,71,116,167,93,14,104].includes(i)&&console.warn("Jupiter swap program instruction 'route_with_token_ledger' not implemented"),[228,85,185,112,78,79,77,2].includes(i)&&console.warn("Jupiter swap program instruction 'set_token_ledger' not implemented"),[230,121,143,80,119,159,106,170].includes(i)&&console.warn("Jupiter swap program instruction 'shared_accounts_route_with_token_ledger' not implemented"),Error(`Jupiter swap program instruction type ${i} not supported`)}const _d=({weiQuantities:e,tokenPrice:n,tokenSymbol:r})=>{let a=Qc(e),i=n?Gc(a,n):void 0,o=Zc(a,r);/*#__PURE__*/return t(Wd,{children:i||o})},Nd=({weiQuantities:r,tokenPrice:a,tokenSymbol:i})=>{let o=Qc(r),s=a?Gc(o,a):void 0,l=Zc(o,i);/*#__PURE__*/return t(Wd,{children:s?/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Pd,{children:"USD"}),"<$0.01"===s?
|
|
12
|
+
/*#__PURE__*/e(Fd,{children:[/*#__PURE__*/t(Ud,{children:"<"}),"$0.01"]}):s]}):l})},Md=({quantities:r,tokenPrice:a,tokenSymbol:i="SOL",tokenDecimals:o=9})=>{let s=r.reduce(((e,t)=>e+t),0n),l=a&&"SOL"===i&&9===o?sd(s,a):void 0,c="SOL"===i&&9===o?gd(s):`${Bt(s,o)} ${i}`;/*#__PURE__*/return t(Wd,{children:l?/*#__PURE__*/t(n,{children:"<$0.01"===l?
|
|
13
|
+
/*#__PURE__*/e(Fd,{children:[/*#__PURE__*/t(Ud,{children:"<"}),"$0.01"]}):l}):c})};let Wd=/*#__PURE__*/kn.span.withConfig({displayName:"StyledPriceDisplay",componentId:"sc-3cd56c8a-0"})(["font-size:14px;line-height:140%;display:flex;gap:4px;align-items:center;"]),Pd=/*#__PURE__*/kn.span.withConfig({displayName:"StyledPriceUnit",componentId:"sc-3cd56c8a-1"})(["font-size:12px;line-height:12px;color:var(--privy-color-foreground-3);"]),Ud=/*#__PURE__*/kn.span.withConfig({displayName:"TinyLessThan",componentId:"sc-3cd56c8a-2"})(["font-size:10px;"]),Fd=/*#__PURE__*/kn.span.withConfig({displayName:"FlexCenter",componentId:"sc-3cd56c8a-3"})(["display:flex;align-items:center;"]);const Od=/*#__PURE__*/kn.div.withConfig({displayName:"BottomPusherContainer",componentId:"sc-cb963810-0"})(["display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-end;margin-top:auto;gap:16px;flex-grow:100;"]),Ld=/*#__PURE__*/kn.div.withConfig({displayName:"CenteredItem",componentId:"sc-cb963810-1"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;flex-grow:1;width:100%;"]),Rd=/*#__PURE__*/kn.div.withConfig({displayName:"HorizontallyCenteredItem",componentId:"sc-cb963810-2"})(["display:flex;flex-direction:column;align-items:center;width:100%;"]),Dd=/*#__PURE__*/kn(Ld).withConfig({displayName:"CenteredItemWithPadding",componentId:"sc-cb963810-3"})(["padding:20px 0;"]),Bd=/*#__PURE__*/kn(Ld).withConfig({displayName:"CenteredItemWithGap",componentId:"sc-cb963810-4"})(["gap:16px;"]),zd=/*#__PURE__*/kn.div.withConfig({displayName:"FlexContainer",componentId:"sc-cb963810-5"})(["display:flex;flex-direction:column;width:100%;"]),Hd=/*#__PURE__*/kn.div.withConfig({displayName:"FixedGappedContainer",componentId:"sc-cb963810-6"})(["display:flex;flex-direction:column;gap:8px;"]),Vd=/*#__PURE__*/kn.div.withConfig({displayName:"StyledCalloutSection",componentId:"sc-cb963810-8"})(["display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start;text-align:left;gap:8px;padding:16px;margin-top:16px;margin-bottom:16px;width:100%;background:var(--privy-color-background-2);border-radius:var(--privy-border-radius-md);&& h4{color:var(--privy-color-foreground-3);font-size:14px;text-decoration:underline;font-weight:medium;}&& p{color:var(--privy-color-foreground-3);font-size:14px;}"]),$d=/*#__PURE__*/kn.div.withConfig({displayName:"RefactorSpacerTop",componentId:"sc-cb963810-9"})(["height:16px;"]),jd=/*#__PURE__*/kn.div.withConfig({displayName:"RefactorSpacerBottom",componentId:"sc-cb963810-10"})(["height:12px;"]),qd=/*#__PURE__*/kn.div.withConfig({displayName:"ConfigurableSpacer",componentId:"sc-cb963810-12"})(["height:","px;"],(e=>e.height??"12")),Kd=({gas:n,tokenPrice:r,tokenSymbol:a})=>/*#__PURE__*/e(zd,{style:{paddingBottom:"12px"},children:[/*#__PURE__*/e(Zd,{children:[/*#__PURE__*/t(Qd,{children:"Est. Fees"}),/*#__PURE__*/t("div",{children:/*#__PURE__*/t(Nd,{weiQuantities:[BigInt(n)],tokenPrice:r,tokenSymbol:a})})]}),r&&/*#__PURE__*/t(Yd,{children:`${Zc(BigInt(n),a)}`})]}),Gd=({value:n,gas:r,tokenPrice:a,tokenSymbol:i})=>{let o=BigInt(n??0)+BigInt(r);/*#__PURE__*/return e(zd,{children:[/*#__PURE__*/e(Zd,{children:[/*#__PURE__*/t(Qd,{children:"Total (including fees)"}),/*#__PURE__*/t("div",{children:/*#__PURE__*/t(Nd,{weiQuantities:[BigInt(n||0),BigInt(r)],tokenPrice:a,tokenSymbol:i})})]}),a&&/*#__PURE__*/t(Yd,{children:Zc(o,i)})]})};let Zd=/*#__PURE__*/kn.div.withConfig({displayName:"TransactionTotalRow",componentId:"sc-f8ef9b74-0"})(["display:flex;flex-direction:row;justify-content:space-between;align-items:center;padding-top:4px;"]),Yd=/*#__PURE__*/kn.div.withConfig({displayName:"ValueConversionRow",componentId:"sc-f8ef9b74-1"})(["display:flex;flex-direction:row;height:12px;font-size:12px;line-height:12px;color:var(--privy-color-foreground-3);font-weight:400;"]),Qd=/*#__PURE__*/kn.div.withConfig({displayName:"TotalText",componentId:"sc-f8ef9b74-2"})(["font-size:14px;line-height:22.4px;font-weight:400;"]);const Xd=/*#__PURE__*/c(void 0),Jd=/*#__PURE__*/c(void 0),eu=({defaultValue:e,children:n})=>{let[r,a]=o(e||null);/*#__PURE__*/return t(Xd.Provider,{value:{activePanel:r,togglePanel:e=>{a(r===e?null:e)}},children:/*#__PURE__*/t(iu,{children:n})})},tu=({value:e,children:n})=>{let{activePanel:r,togglePanel:a}=l(Xd),i=r===e;/*#__PURE__*/return t(Jd.Provider,{value:{onToggle:()=>a(e),value:e},children:/*#__PURE__*/t(cu,{isActive:i?"true":"false","data-open":String(i),children:n})})},nu=({children:r})=>{let{activePanel:a}=l(Xd),{onToggle:i,value:o}=l(Jd),s=a===o;/*#__PURE__*/
|
|
14
|
+
return e(n,{children:[/*#__PURE__*/e(ou,{onClick:i,"data-open":String(s),children:[/*#__PURE__*/t(lu,{children:r}),/*#__PURE__*/t(pu,{isactive:s?"true":"false",children:/*#__PURE__*/t(On,{height:"16px",width:"16px",strokeWidth:"2"})})]}),/*#__PURE__*/t(su,{})]})},ru=({children:e})=>{let{activePanel:n}=l(Xd),{value:r}=l(Jd);/*#__PURE__*/return t(du,{"data-open":String(n===r),children:/*#__PURE__*/t(uu,{children:e})})},au=({children:e})=>{let{activePanel:n}=l(Xd),{value:r}=l(Jd);/*#__PURE__*/return t(uu,{children:"function"==typeof e?e({isActive:n===r}):e})};let iu=/*#__PURE__*/kn.div.withConfig({displayName:"AccordionRoot",componentId:"sc-d25f9267-0"})(["display:flex;flex-direction:column;width:100%;gap:8px;"]),ou=/*#__PURE__*/kn.div.withConfig({displayName:"AccordionTriggerContainer",componentId:"sc-d25f9267-1"})(["display:flex;justify-content:space-between;align-items:center;width:100%;cursor:pointer;padding-bottom:8px;"]),su=/*#__PURE__*/kn.div.withConfig({displayName:"AccordionDivider",componentId:"sc-d25f9267-2"})(["width:100%;&&{border-top:1px solid;border-color:var(--privy-color-foreground-4);}padding-bottom:12px;"]),lu=/*#__PURE__*/kn.div.withConfig({displayName:"AccordionTriggerContent",componentId:"sc-d25f9267-3"})(["font-size:14px;font-weight:500;line-height:19.6px;width:100%;padding-right:8px;"]),cu=/*#__PURE__*/kn.div.withConfig({displayName:"AccordionPanelContainer",componentId:"sc-d25f9267-4"})(["display:flex;flex-direction:column;width:100%;overflow:hidden;padding:12px;&&{border:1px solid;border-color:var(--privy-color-foreground-4);border-radius:var(--privy-border-radius-md);}"]),du=/*#__PURE__*/kn.div.withConfig({displayName:"AccordionContentContainer",componentId:"sc-d25f9267-5"})(["position:relative;overflow:hidden;transition:max-height 25ms ease-out;&[data-open='true']{max-height:700px;}&[data-open='false']{max-height:0;}"]),uu=/*#__PURE__*/kn.div.withConfig({displayName:"ContentWrapper",componentId:"sc-d25f9267-6"})(["display:flex;flex-direction:column;gap:12px;flex:1 1 auto;min-height:1px;"]),pu=/*#__PURE__*/kn.div.withConfig({displayName:"IconWrapper",componentId:"sc-d25f9267-7"})(["transform:",";"],(e=>"true"===e.isactive?"rotate(180deg)":"rotate(0deg)"));const hu=({walletAddress:e,chainId:n=1,network:r,rpcEndpoint:a})=>/*#__PURE__*/t(mu,{href:"ethereum"===r?Xc(n,e):us(e,ds(a||"")),target:"_blank",children:Ui(e)});let mu=/*#__PURE__*/kn.a.withConfig({displayName:"StyledLink",componentId:"sc-adda23e5-0"})(["&:hover{text-decoration:underline;}"]);const gu=({from:n,to:r,txn:a,transactionInfo:i,tokenPrice:o,gas:s,tokenSymbol:l})=>{let c=BigInt(a?.value||0);/*#__PURE__*/
|
|
15
|
+
return t(eu,{...ks().render.standalone?{defaultValue:"details"}:{},children:/*#__PURE__*/e(tu,{value:"details",children:[/*#__PURE__*/t(nu,{children:/*#__PURE__*/e(yu,{children:[/*#__PURE__*/t("div",{children:i?.title||"Details"}),/*#__PURE__*/t(fu,{children:/*#__PURE__*/t(_d,{weiQuantities:[c],tokenPrice:o,tokenSymbol:l})})]})}),/*#__PURE__*/e(ru,{children:[/*#__PURE__*/t(Hc,{label:"From",children:/*#__PURE__*/t(hu,{walletAddress:n,chainId:a.chainId||1,network:"ethereum"})}),/*#__PURE__*/t(Hc,{label:"To",children:/*#__PURE__*/t(hu,{walletAddress:r,chainId:a.chainId||1,network:"ethereum"})}),i&&i.action&&/*#__PURE__*/t(Hc,{label:"Action",children:i.action}),s&&/*#__PURE__*/t(Kd,{value:a.value,gas:s,tokenPrice:o,tokenSymbol:l})]}),/*#__PURE__*/t(au,{children:({isActive:e})=>/*#__PURE__*/t(Gd,{value:a.value,displayFee:e,gas:s||"0x0",tokenPrice:o,tokenSymbol:l})})]})})};let yu=/*#__PURE__*/kn.div.withConfig({displayName:"AccordionTriggerContent",componentId:"sc-e1259f7b-0"})(["display:flex;flex-direction:row;justify-content:space-between;"]),fu=/*#__PURE__*/kn.div.withConfig({displayName:"TotalText",componentId:"sc-e1259f7b-1"})(["flex-shrink:0;padding-left:8px;"]);const wu=({enabled:e=!0}={})=>{let{showFiatPrices:t,getUsdPriceForSol:n}=Ft(),[r,a]=o(!0),[i,s]=o(void 0),[l,c]=o(void 0);return d((()=>{(async()=>{if(t&&e)try{a(!0);let e=await n();e?c(e):s(Error("Unable to fetch SOL price"))}catch(e){s(e)}finally{a(!1)}else a(!1)})()}),[]),{solPrice:l,isSolPriceLoading:r,solPriceError:i}};function vu(e){let{tokenPrice:t,isTokenPriceLoading:n,tokenPriceError:r}=(e=>{let{showFiatPrices:t,getUsdTokenPrice:n,chains:r}=Ft(),[a,i]=o(!0),[s,l]=o(void 0),[c,u]=o(void 0);return d((()=>{e||=1;let a=N(r).find((t=>t.id===Number(e)));(async()=>{if(t){if(!a)return i(!1),void l(Error(`Unable to fetch token price on chain id ${e}`));try{i(!0);let e=await n(a);e?u(e):l(Error(`Unable to fetch token price on chain id ${a.id}`))}catch(e){l(e)}finally{i(!1)}}else i(!1)})()}),[e]),{tokenPrice:c,isTokenPriceLoading:a,tokenPriceError:s}})("solana"===e?-1:e),{solPrice:a,isSolPriceLoading:i,solPriceError:s}=wu({enabled:"solana"===e});return"solana"===e?{tokenPrice:a,isTokenPriceLoading:i,tokenPriceError:s}:{tokenPrice:t,isTokenPriceLoading:n,tokenPriceError:r}}const Cu=/*#__PURE__*/c(null);function bu(){let e=l(Cu);return null===e?(console.warn("`useWallets` was called outside the PrivyProvider component"),{wallets:[],ready:!1}):e}async function ku(e,t,n,r){let a=vn(e),i=await(async()=>r?await r():await t.prepareTransactionRequest({...a,account:{address:n,type:"json-rpc"}}))();return{...i,type:Cn[i.type]}}const Au=({pendingTransaction:e})=>{let{wallets:n}=bu(),{walletProxy:r,rpcConfig:a,chains:i,appId:l,nativeTokenSymbolForChainId:c}=Ft(),[u,p]=o(null),[h,m]=o(e),{tokenPrice:g}=vu(h.chainId),y=c(e.chainId)||"ETH",f=s((()=>n.find((e=>"privy"===e.walletClientType))),[n]);return d((()=>{(async function(){if(!r||!f)return h;let e=Mi(h.chainId,i,a,{appId:l}),t=await ku(h,e,f.address);return p(zt(BigInt(t.gas??0))),t})().then(m).catch(console.error)}),[r]),f?/*#__PURE__*/t(Tu,{children:/*#__PURE__*/t(gu,{from:f.address,to:h.to,txn:h,gas:u??void 0,tokenPrice:g,tokenSymbol:y})}):null};let Tu=/*#__PURE__*/kn.div.withConfig({displayName:"TransactionInfoWrapper",componentId:"sc-8d9a2f57-0"})(["width:100%;padding:1rem 0;"]),xu=/*#__PURE__*/kn.div.withConfig({displayName:"StackedContainer",componentId:"sc-f7e7d474-0"})(["display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%;height:82px;> div{position:relative;}> div > span{position:absolute;left:-41px;top:-41px;}> div > :last-child{position:absolute;left:-19px;top:-19px;}"]);const Iu=({style:e,...n})=>/*#__PURE__*/t("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...e},fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...n,children:/*#__PURE__*/t("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.71369 17.5625V10.375C3.71369 6.44625 6.85845 3.25 10.7238 3.25H17.7953C18.6783 3.25 19.3941 2.52244 19.3941 1.625C19.3941 0.727562 18.6783 0 17.7953 0H10.7238C5.09529 0 0.516113 4.65419 0.516113 10.375V17.5625C0.516113 18.4599 1.23194 19.1875 2.1149 19.1875C2.99787 19.1875 3.71369 18.4599 3.71369 17.5625ZM17.7953 60.7501C18.6783 60.7501 19.3941 61.4777 19.3941 62.3751C19.3941 63.2726 18.6783 64.0001 17.7953 64.0001H10.7238C5.09529 64.0001 0.516113 59.3459 0.516113 53.6251V46.4376C0.516113 45.5402 1.23194 44.8126 2.1149 44.8126C2.99787 44.8126 3.71369 45.5402 3.71369 46.4376V53.6251C3.71369 57.5538 6.85845 60.7501 10.7238 60.7501H17.7953ZM63.4839 46.4376V53.6251C63.4839 59.3459 58.9048 64.0001 53.2763 64.0001H46.2047C45.3217 64.0001 44.6059 63.2726 44.6059 62.3751C44.6059 61.4777 45.3217 60.7501 46.2047 60.7501H53.2763C57.1416 60.7501 60.2864 57.5538 60.2864 53.6251V46.4376C60.2864 45.5402 61.0022 44.8126 61.8851 44.8126C62.7681 44.8126 63.4839 45.5402 63.4839 46.4376ZM63.4839 10.375V17.5625C63.4839 18.4599 62.7681 19.1875 61.8851 19.1875C61.0022 19.1875 60.2864 18.4599 60.2864 17.5625V10.375C60.2864 6.44625 57.1416 3.25 53.2763 3.25H46.2047C45.3217 3.25 44.6059 2.52244 44.6059 1.625C44.6059 0.727562 45.3217 0 46.2047 0H53.2763C58.9048 0 63.4839 4.65419 63.4839 10.375ZM43.0331 47.3022C43.7067 46.6698 43.7483 45.6022 43.1262 44.9176C42.5039 44.233 41.4536 44.1906 40.78 44.823C38.3832 47.0732 35.265 48.3125 31.9997 48.3125C28.7344 48.3125 25.6162 47.0732 23.2194 44.823C22.5457 44.1906 21.4955 44.233 20.8732 44.9176C20.251 45.6022 20.2927 46.6698 20.9663 47.3022C23.9784 50.1301 27.8968 51.6875 31.9997 51.6875C36.1026 51.6875 40.021 50.1301 43.0331 47.3022ZM35.3207 24.1249V36.1249C35.3207 38.5029 33.4173 40.4374 31.0777 40.4374H29.7249C28.8079 40.4374 28.0646 39.6819 28.0646 38.7499C28.0646 37.8179 28.8079 37.0624 29.7249 37.0624H31.0777C31.5863 37.0624 32.0001 36.6419 32.0001 36.1249V24.1249C32.0001 23.1929 32.7434 22.4374 33.6604 22.4374C34.5774 22.4374 35.3207 23.1929 35.3207 24.1249ZM46.7581 28.8437V24.0312C46.7581 23.151 46.056 22.4374 45.19 22.4374C44.324 22.4374 43.622 23.151 43.622 24.0312V28.8437C43.622 29.7239 44.324 30.4374 45.19 30.4374C46.056 30.4374 46.7581 29.7239 46.7581 28.8437ZM17.6109 28.8437C17.6109 29.7239 18.313 30.4374 19.1789 30.4374C20.0449 30.4374 20.747 29.7239 20.747 28.8437V24.0312C20.747 23.151 20.0449 22.4374 19.1789 22.4374C18.313 22.4374 17.6109 23.151 17.6109 24.0312V28.8437Z"})}),Eu=({hasBlockingError:r,error:a,onClose:i,onBack:o,handleSubmit:s,account:l,submitSuccess:c})=>{let{pendingTransaction:d}=Ft();/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t($l,{onClose:i},"header"),/*#__PURE__*/t(xu,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(kl,{success:c,fail:!!a}),/*#__PURE__*/t(a?Fn:Iu,{style:{width:"38px",height:"38px"}})]})}),/*#__PURE__*/t(Tc,{style:{marginTop:"1rem"},children:"Verifying with passkey"}),/*#__PURE__*/e(Ec,{children:[/*#__PURE__*/e(_c,{children:[/*#__PURE__*/t(Sc,{children:/*#__PURE__*/t(Nn,{})}),"Approve this action using your touch, face, PIN, or hardware key."]}),/*#__PURE__*/e(_c,{children:[/*#__PURE__*/t(Sc,{children:/*#__PURE__*/t(Un,{})}),"You last added a passkey on"," ",l?.firstVerifiedAt?.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),"."]})]}),d&&/*#__PURE__*/t(Ic,{children:/*#__PURE__*/t(Au,{pendingTransaction:d})}),a&&/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Bc,{style:{marginTop:"1.25rem"},children:a.message}),/*#__PURE__*/t(Ml,{disabled:r,onClick:s,style:{marginTop:"1.25rem"},children:"Try again"})]}),o&&/*#__PURE__*/t(Rc,{style:{marginTop:"1rem"},onClick:o,children:"Choose another method"}),/*#__PURE__*/t(bl,{})]})};let Su=Array(6).fill("");var _u,Nu=((_u=Nu||{})[_u.RESET_AFTER_DELAY=0]="RESET_AFTER_DELAY",_u[_u.CLEAR_ON_NEXT_VALID_INPUT=1]="CLEAR_ON_NEXT_VALID_INPUT",_u);function Mu(e){return/^[0-9]{1}$/.test(e)}function Wu(e){return 6===e.length&&e.every(Mu)}const Pu=({onChange:r,disabled:a,errorReasonOverride:i,success:s})=>{let[l,c]=o(Su),[d,u]=o(null),[p,h]=o(null),m=async e=>{e.preventDefault();let t=e.currentTarget.value.replace(/\s+/g,"");if(""===t)return;let n=l.reduce(((e,t)=>e+Number(Mu(t))),0),a=t.split(""),i=!a.every(Mu),o=a.length+n>6;if(i)return u("Passcode can only be numbers"),void h(1);if(o)return u("Passcode must be exactly 6 numbers"),void h(1);u(null),h(null);let s=Number(e.currentTarget.name?.charAt(4)),d=[...t||[""]].slice(0,6-s),p=[...l.slice(0,s),...d,...l.slice(s+d.length)];c(p);let m=Math.min(Math.max(s+d.length,0),5),g=document.querySelector(`input[name=pin-${m}]`);if(g?.focus(),Wu(p))try{await r(p.join(""));let e=document.querySelector(`input[name=pin-${m}]`);e?.blur()}catch(e){h(1),u(e.message)}else try{await r(null)}catch(e){h(1),u(e.message)}},y=s?"success":!(!i&&!d)?"fail":"";/*#__PURE__*/return t(n,{children:/*#__PURE__*/e(Uu,{children:[/*#__PURE__*/t("div",{children:l.map(((e,n)=>/*#__PURE__*/t("input",{name:`pin-${n}`,type:"text",value:l[n],onChange:m,onKeyUp:e=>{"Backspace"===e.key&&(e=>{1===p&&(u(null),h(null));let t=[...l.slice(0,e),"",...l.slice(e+1)];if(c(t),e>0){let t=document.querySelector(`input[name=pin-${e-1}]`);t?.focus()}Wu(t)?r(t.join("")):r(null)})(n)},inputMode:"numeric",autoFocus:0===n,pattern:"[0-9]",className:y,autoComplete:g?"one-time-code":"off",disabled:a},n)))}),/*#__PURE__*/t("div",{children:/*#__PURE__*/t(Fu,{$fail:!!i||!!d,children:i||d})})]})})};let Uu=/*#__PURE__*/kn.div.withConfig({displayName:"PinInputContainer",componentId:"sc-7a171f6-0"})(["display:flex;flex-direction:column;width:100%;gap:8px;@media (max-width:440px){margin-top:8px;margin-bottom:8px;}> div:nth-child(1){display:flex;justify-content:center;gap:0.5rem;width:100%;border-radius:var(--privy-border-radius-md);> input{border:1px solid var(--privy-color-foreground-4);background:var(--privy-color-background);border-radius:var(--privy-border-radius-md);padding:8px 10px;height:58px;width:46px;text-align:center;font-size:18px;}> input:disabled{background:var(--privy-color-background-2);}> input:focus{border:1px solid var(--privy-color-accent);}> input:invalid{border:1px solid var(--privy-color-error);}> input.success{border:1px solid var(--privy-color-success);}> input.fail{border:1px solid var(--privy-color-error);animation:shake 180ms;animation-iteration-count:2;}}@keyframes shake{0%{transform:translate(1px,0px);}33%{transform:translate(-1px,0px);}67%{transform:translate(-1px,0px);}100%{transform:translate(1px,0px);}}"]),Fu=/*#__PURE__*/kn.div.withConfig({displayName:"InputHelp",componentId:"sc-7a171f6-1"})(["line-height:20px;font-size:13px;display:flex;justify-content:flex-start;width:100%;color:",";"],(e=>e.$fail?"var(--privy-color-error)":"var(--privy-color-foreground-3)"));const Ou=({selectedMethod:r,submitSuccess:a,hasBlockingError:i,onClose:o,onBack:s,handleSubmitCode:l})=>{let{app:c}=Is(),{pendingTransaction:d}=Ft();switch(r){case"sms":/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t($l,{onClose:o},"header"),/*#__PURE__*/t(Dc,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(_n,{})}),/*#__PURE__*/t(Tc,{children:"Enter verification code"}),/*#__PURE__*/e(Ic,{children:[/*#__PURE__*/t(Pu,{success:a,disabled:i,onChange:l}),/*#__PURE__*/e(xc,{children:["To continue, please enter the 6-digit code sent to your ",/*#__PURE__*/t("strong",{children:"mobile device"})]}),d&&/*#__PURE__*/t(Au,{pendingTransaction:d})]}),s&&/*#__PURE__*/t(Rc,{theme:c?.appearance.palette.colorScheme,onClick:s,children:"Choose another method"}),/*#__PURE__*/t(Fl,{onClick:o,children:"Cancel"}),/*#__PURE__*/t(bl,{})]});case"totp":/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t($l,{onClose:o},"header"),/*#__PURE__*/t(Dc,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(En,{})}),/*#__PURE__*/t(Tc,{children:"Enter verification code"}),/*#__PURE__*/e(Ic,{children:[/*#__PURE__*/t(Pu,{success:a,disabled:i,onChange:l}),/*#__PURE__*/e(xc,{children:["To continue, please enter the 6-digit code generated from your"," ",/*#__PURE__*/t("strong",{children:"authenticator app"})]}),d&&/*#__PURE__*/t(Au,{pendingTransaction:d})]}),s&&/*#__PURE__*/t(Rc,{theme:c?.appearance.palette.colorScheme,onClick:s,children:"Choose another method"}),/*#__PURE__*/t(Fl,{onClick:o,children:"Cancel"}),/*#__PURE__*/t(bl,{})]});default:return null}},Lu=["error","invalid_request_arguments","wallet_not_on_device","invalid_recovery_pin","insufficient_funds","missing_or_invalid_mfa","mfa_verification_max_attempts_reached","mfa_timeout","twilio_verification_failed"];class Ru extends Error{constructor(e,t){super(t),this.type=e}}function Du(e){let t=e.type;return"string"==typeof t&&Lu.includes(t)}function Bu(e){return Du(e)&&"wallet_not_on_device"===e.type}function zu(e){return!!Du(e)&&"mfa_timeout"===e.type}function Hu(e){return!!Du(e)&&"missing_or_invalid_mfa"===e.type}function Vu(e){return!!Du(e)&&"mfa_verification_max_attempts_reached"===e.type}function $u(e){return!(!Du(e)||!e.message.includes("code 429"))}function ju(e){return!!function(e){let t=e.type;return"string"==typeof t&&"client_error"===t}(e)&&"MFA canceled"===e.message}const qu=e=>Vu(e)?{isBlocking:!0,error:Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")}:Hu(e)?{isBlocking:!1,error:Error("The code you entered is not valid")}:zu(e)?{isBlocking:!0,error:Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.")}:(console.error(e),{isBlocking:!1,error:Error("Something went wrong.")}),Ku={component:()=>{let{user:e}=on(),{data:n}=Is(),[r,a]=o(e?.mfaMethods[0]),[s,l]=o(!1),[c,u]=o(),[p,h]=o();if(d((()=>{a(e?.mfaMethods[0])}),[e?.mfaMethods]),!n?.mfaVerify)throw Error("Missing modal data for MFA verification screen.");let{onFailure:m,onSuccess:g,generateOptions:y,verifyTotpCode:f,verifyPasskey:w,verifySmsCode:v,sendSmsCode:C}=n.mfaVerify,b=async e=>{if("passkey"!==e)try{a(e),"sms"===e&&(a(e),await C()),"totp"===e&&a(e)}catch(e){console.error(e)}else try{a(e);let t=await y();if(!t)throw Error("something went wrong");u(t),await w(t),l(!0),h(void 0),g()}catch(e){h(qu(e))}},k=async e=>{h(void 0);try{if(!e||!r)return;if("passkey"===r){if(!c)throw Error("Missing passkey challenge");await w(c)}else"sms"===r?await v(e):"totp"===r&&await f(e);h(void 0),l(!0),g()}catch(e){throw qu(e).error}},A=()=>{p||!s?m(p?.error??Error("Canceled MFA verification.")):g()},T=i(!1);return d((()=>{!T.current&&r&&(T.current=!0,b(r).finally((()=>{T.current=!1})))}),[open]),e?"passkey"===r?/*#__PURE__*/t(Eu,{account:e.linkedAccounts.filter((e=>"passkey"===e.type&&e.enrolledInMfa)).sort(((e,t)=>t.firstVerifiedAt.valueOf()-e.firstVerifiedAt.valueOf()))[0],submitSuccess:s,hasBlockingError:p?.isBlocking??!1,error:p?.error,onClose:A,onBack:()=>{a(void 0),h(void 0)},handleSubmit:()=>k(c).catch(h)}):"sms"===r||"totp"===r?/*#__PURE__*/t(Ou,{selectedMethod:r,submitSuccess:s,hasBlockingError:p?.isBlocking??!1,handleSubmitCode:k,onClose:A,onBack:e.mfaMethods.length>1?()=>a(void 0):void 0}):/*#__PURE__*/t(zc,{user:e,onSelect:b,handleClose:A}):null}};function Gu(){let{promptMfa:e,init:t,submit:n,cancel:r,mfaMethods:a}=l(sn);return{promptMfa:e,init:t,submit:n,cancel:r,mfaMethods:a}}const Zu=({onClose:e})=>{let{user:n}=on(),[r,a]=o(n?.mfaMethods[0]??null),{init:s,cancel:l,submit:c}=Gu(),[u,p]=o(!1),[h,m]=o(null),[g,y]=o();d((()=>{a(n?.mfaMethods[0]??null)}),[n?.mfaMethods]);let f=i(!1);async function w(t){y(void 0);try{if(!t||!r)return;await c(r,t),p(!0),y(void 0),e()}catch(t){throw qu(t).error}}async function v(t){if("passkey"!==t)try{a(t),await s(t)}catch(t){console.error(t)}else try{a(t);let n=await s(t);if(!n)throw Error("something went wrong");m(n),await c(t,n),p(!0),y(void 0),e()}catch(t){y(qu(t))}}d((()=>{!f.current&&r&&(f.current=!0,v(r).finally((()=>{f.current=!1})))}),[]);let C=()=>{a(null),y(void 0),l(),e()};return n?"passkey"===r?/*#__PURE__*/t(Eu,{account:n.linkedAccounts.filter((e=>"passkey"===e.type&&e.enrolledInMfa)).sort(((e,t)=>t.firstVerifiedAt.valueOf()-e.firstVerifiedAt.valueOf()))[0],submitSuccess:u,hasBlockingError:g?.isBlocking??!1,error:g?.error,onClose:C,onBack:()=>{a(null),y(void 0)},handleSubmit:()=>w(h).catch(y)}):r?/*#__PURE__*/t(Ou,{submitSuccess:u,hasBlockingError:g?.isBlocking??!1,handleSubmitCode:w,selectedMethod:r,onClose:C,onBack:n.mfaMethods.length>1?()=>a(null):void 0}):/*#__PURE__*/t(zc,{user:n,onSelect:v,handleClose:C}):null},Yu=Ln((()=>({inProgressMfaFlow:void 0})));const Qu=/*#__PURE__*/Tn([":root{","};"],(e=>Xu(e.palette)));const Xu=e=>
|
|
16
|
+
/*#__PURE__*/An(["",""],Object.entries(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)).map((([e,t])=>`${e}: ${t};`)).join("\n")),Ju=/*#__PURE__*/kn.div.withConfig({displayName:"StylesWrapper",componentId:"sc-188229e4-0"})([""," color:var(--privy-color-foreground-2);h3{font-size:16px;line-height:24px;font-weight:500;color:var(--privy-color-foreground-2);}h4{font-size:14px;line-height:20px;font-weight:500;color:var(--privy-color-foreground);}p{font-size:13px;line-height:20px;color:var(--privy-color-foreground-2);}button:focus,input:focus,optgroup:focus,select:focus,textarea:focus{outline:none;border-color:var(--privy-color-accent-light);box-shadow:0 0 0 3px var(--privy-color-border-focus);}.mobile-only{@media (min-width:441px){display:none;}}@keyframes fadein{0%{opacity:0;}100%{opacity:1;}}"],"\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-color: transparent;\n background-image: none;\n }\n\n ::-moz-focus-inner {\n border-style: none;\n padding: 0;\n }\n\n :-moz-focusring {\n outline: 1px dotted ButtonText;\n }\n\n :-moz-ui-invalid {\n box-shadow: none;\n }\n\n legend {\n padding: 0;\n }\n\n progress {\n vertical-align: baseline;\n }\n\n ::-webkit-inner-spin-button,\n ::-webkit-outer-spin-button {\n height: auto;\n }\n\n [type='search'] {\n -webkit-appearance: textfield;\n outline-offset: -2px;\n }\n\n ::-webkit-search-decoration {\n -webkit-appearance: none;\n }\n\n ::-webkit-file-upload-button {\n -webkit-appearance: button;\n font: inherit;\n }\n\n summary {\n display: list-item;\n }\n\n blockquote,\n dl,\n dd,\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n hr,\n figure,\n p,\n pre {\n margin: 0;\n }\n\n fieldset {\n margin: 0;\n padding: 0;\n }\n\n legend {\n padding: 0;\n }\n\n ol,\n ul,\n menu {\n list-style: none;\n margin: 0;\n padding: 0;\n }\n\n textarea {\n resize: vertical;\n }\n\n input::placeholder,\n textarea::placeholder {\n opacity: 1;\n color: #9ca3af;\n }\n\n button,\n [role='button'] {\n cursor: pointer;\n }\n\n :disabled {\n cursor: default;\n }\n\n img,\n svg,\n video,\n canvas,\n audio,\n iframe,\n embed,\n object {\n display: block;\n }\n\n img,\n video {\n max-width: 100%;\n height: auto;\n }\n\n [hidden] {\n display: none;\n }\n"),ep=({children:n,open:r,onClick:i,...o})=>/*#__PURE__*/t(Rn,{show:r,as:a.Fragment,children:/*#__PURE__*/e(Dn,{onClose:i,...o,as:np,children:[/*#__PURE__*/t(Bn,{as:a.Fragment,enterFrom:"entering",leaveTo:"leaving",children:/*#__PURE__*/t(tp,{id:"privy-dialog-backdrop","aria-hidden":"true"})}),/*#__PURE__*/t(rp,{children:/*#__PURE__*/t(Bn,{as:a.Fragment,enterFrom:"entering",leaveTo:"leaving",children:/*#__PURE__*/t(zn,{as:ap,children:n})})})]})});let tp=/*#__PURE__*/kn.div.withConfig({displayName:"Backdrop",componentId:"sc-3cfde0b5-0"})(["position:fixed;inset:0;transition:backdrop-filter 100ms ease;backdrop-filter:blur(3px);-webkit-backdrop-filter:blur(3px);&.entering,&.leaving{backdrop-filter:unset;-webkit-backdrop-filter:unset;}"]),np=/*#__PURE__*/kn.div.withConfig({displayName:"DialogWrapper",componentId:"sc-3cfde0b5-1"})(["position:relative;z-index:999999;"]),rp=/*#__PURE__*/kn.div.withConfig({displayName:"DialogContainer",componentId:"sc-3cfde0b5-2"})(["position:fixed;inset:0;display:flex;align-items:center;justify-content:center;width:100vw;min-height:100vh;"]);const ap=/*#__PURE__*/kn.div.withConfig({displayName:"Panel",componentId:"sc-3cfde0b5-3"})(["padding:0;background:transparent;border:none;width:100%;pointer-events:auto;outline:none;display:block;@media (max-width:440px){opacity:1;transform:translate3d(0,0,0);transition:transform 200ms ease-in;position:fixed;bottom:0;&.entering,&.leaving{opacity:0;transform:translate3d(0,100%,0);transition:transform 150ms ease-in 0ms,opacity 0ms ease 150ms;}}@media (min-width:441px){opacity:1;transition:opacity 100ms ease-in;&.entering,&.leaving{opacity:0;transition-delay:5ms;}margin:auto;width:360px;box-shadow:0px 8px 36px rgba(55,65,81,0.15);border-radius:var(--privy-border-radius-lg);}"]),ip=/*#__PURE__*/kn.div.withConfig({displayName:"CenterItem",componentId:"sc-3cfde0b5-4"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;"]);let op=()=>{let{ready:r,isModalOpen:a}=on(),{headless:i}=ks(),{currentScreen:o}=Is(),{status:s,execute:l,reset:c,enabled:u}=Zi(),p=Yu((e=>e.inProgressMfaFlow)),h=()=>Yu.setState({inProgressMfaFlow:void 0}),m=a&&o&&o.isCaptchaRequired&&!i&&"ready"===s;return d((()=>{m&&l()}),[m]),d((()=>{!a&&u&&c()}),[a,u]),o&&!r&&o.isShownBeforeReady?/*#__PURE__*/e(n,{children:[/*#__PURE__*/t($l,{}),/*#__PURE__*/t($d,{}),/*#__PURE__*/t(ip,{children:/*#__PURE__*/t(xl,{})}),/*#__PURE__*/t(jd,{}),/*#__PURE__*/t(bl,{})]}):o||"txn"!==p?o?
|
|
17
|
+
/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(hl,{$if:!!p,children:/*#__PURE__*/t(o.component,{})}),"txn"===p&&/*#__PURE__*/t(Zu,{onClose:h}),"auth"===p&&/*#__PURE__*/t(Ku.component,{})]}):null:/*#__PURE__*/t(Zu,{onClose:h})},sp=()=>{let e=i(null);/*#__PURE__*/return t(dp,{style:{height:Qs(e)},id:"privy-modal-content",children:/*#__PURE__*/t("div",{ref:e,children:/*#__PURE__*/t(op,{})})})};const lp=({open:e})=>{let n=ks(),{gracefulClosePrivyModal:r}=(()=>{let{closePrivyModal:e}=Ft(),{onUserCloseViaDialogOrKeybindRef:t}=Is();return{gracefulClosePrivyModal:u((()=>{if(!t?.current)return e({shouldCallAuthOnSuccess:!1});t.current()}),[e])}})(),a=Yu((e=>e.inProgressMfaFlow));return al({onMfaRequired:()=>{n.mfa.noPromptOnMfaRequired||Yu.setState({inProgressMfaFlow:"txn"})}}),n.render.standalone?/*#__PURE__*/t(Ju,{children:/*#__PURE__*/t(cp,{id:"privy-modal-content",children:/*#__PURE__*/t(op,{})})}):/*#__PURE__*/t(ep,{open:!(!e&&!a),id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>r(),children:/*#__PURE__*/t(Ju,{children:/*#__PURE__*/t(sp,{})})})};let cp=/*#__PURE__*/kn.div.withConfig({displayName:"ContentWrapper",componentId:"sc-b220e1ee-0"})(["display:flex;flex-direction:column;text-align:center;font-size:14px;line-height:20px;width:100%;background:var(--privy-color-background);padding:0 16px;"]),dp=/*#__PURE__*/kn(cp).withConfig({displayName:"BaseModal",componentId:"sc-b220e1ee-1"})(["transition:height 150ms ease-out;overflow-x:hidden;overflow-y:auto;scrollbar-width:none;max-height:calc(100svh - 32px);border-radius:var(--privy-border-radius-lg) var(--privy-border-radius-lg) 0 0;box-shadow:0px 0px 36px rgba(55,65,81,0.15);@media (min-width:441px){box-shadow:0px 8px 36px rgba(55,65,81,0.15);border-radius:var(--privy-border-radius-lg);}"]);function up(e){let n=i(null),r=i();return d((()=>{r.current?.remove(),r.current=function({botUsername:e,scriptHost:t}){let n=document.createElement("script"),{origin:r}=new URL(t);return n.async=!0,n.src=`${r}/js/telegram-login.js`,n.setAttribute("data-telegram-login",e),n.setAttribute("data-request-access","write"),n.setAttribute("data-lang","en"),n}(e),n.current?.after(r.current)}),[e]),/*#__PURE__*/t("div",{ref:n,hidden:!0})}const pp=({address:r,showCopyIcon:a,url:i,className:s})=>{let[l,c]=o(!1);function u(e){e.stopPropagation(),navigator.clipboard.writeText(r).then((()=>c(!0))).catch(console.error)}return d((()=>{if(l){let e=setTimeout((()=>c(!1)),3e3);return()=>clearTimeout(e)}}),[l]),/*#__PURE__*/e(hp,i?{children:[/*#__PURE__*/t(gp,{title:r,className:s,href:`${i}/address/${r}`,target:"_blank",children:Ui(r)}),a&&/*#__PURE__*/t(Fl,{onClick:u,size:"sm",style:{gap:"0.375rem"},children:/*#__PURE__*/e(n,l?{children:["Copied",/*#__PURE__*/t(qn,{size:16})]}:{children:["Copy",/*#__PURE__*/t(Kn,{size:16})]})})]}:{children:[/*#__PURE__*/t(mp,{title:r,className:s,children:Ui(r)}),a&&/*#__PURE__*/t(Fl,{onClick:u,size:"sm",style:{gap:"0.375rem",fontSize:"14px"},children:/*#__PURE__*/e(n,l?{children:["Copied",/*#__PURE__*/t(qn,{size:14})]}:{children:["Copy",/*#__PURE__*/t(Kn,{size:14})]})})]})};let hp=/*#__PURE__*/kn.span.withConfig({displayName:"AddressContainer",componentId:"sc-3a987cc8-0"})(["display:inline-flex;align-items:center;gap:0.5rem;"]),mp=/*#__PURE__*/kn.span.withConfig({displayName:"AddressText",componentId:"sc-3a987cc8-1"})(["font-size:14px;font-weight:500;color:var(--privy-color-foreground);"]),gp=/*#__PURE__*/kn.a.withConfig({displayName:"AddressLink",componentId:"sc-3a987cc8-2"})(["font-size:14px;color:var(--privy-color-foreground);text-decoration:none;&:hover{text-decoration:underline;}"]);const yp=()=>{let{solanaWallets:e}=Ft(),{ready:t,wallets:n}=bu();return d((()=>{if(t){let t=[...n,...e].map((e=>({address:e.address,connectorType:e.connectorType,walletClientType:e.walletClientType,connectedAt:e.connectedAt,id:e.meta.id})));ua.put(Ha,t)}}),[t,n,e]),null};async function fp(e,t,n,r,a,i=!1){let o=i,s=async s=>{if(o&&t&&t.length>0){s===(i?0:1)?a("configureMfa","onMfaRequired",{mfaMethods:t}):r.current?.reject(new Ru("missing_or_invalid_mfa","MFA verification failed, retry."));let o=await new Promise(((e,t)=>{n.current={resolve:e,reject:t},setTimeout((()=>{let e=new Ru("mfa_timeout","Timed out waiting for MFA code");r.current?.reject(e),t(e)}),3e5)}));return await e(o)}return await e()},l=null;for(let e=0;e<4;e++)try{l=await s(e),r.current?.resolve(void 0);break}catch(e){if("missing_or_invalid_mfa"!==e.type)throw r.current?.resolve(void 0),e;o=!0}if(null===l){let e=new Ru("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw r.current?.reject(e),e}return l}var wp;let vp=(wp=0,()=>"id-"+wp++);function Cp(e){return void 0!==e.error}let bp=new class{enqueue(e,t){this.callbacks[e]=t}dequeue(e,t){let n=this.callbacks[t];if(!n)throw Error(`cannot dequeue ${e} event: no event found for id ${t}`);switch(delete this.callbacks[t],e){case"privy:iframe:ready":case"privy:user-signer:sign":case"privy:wallets:add":case"privy:wallets:import":case"privy:wallets:set-recovery":case"privy:wallets:connect":case"privy:wallets:recover":case"privy:wallets:rpc":case"privy:wallet:create":case"privy:mfa:verify":case"privy:mfa:init-enrollment":case"privy:mfa:submit-enrollment":case"privy:mfa:unenroll":case"privy:mfa:clear":case"privy:auth:unlink-passkey":case"privy:farcaster:init-signer":case"privy:farcaster:sign":case"privy:solana-wallet:create":case"privy:delegated-actions:consent":return n;default:throw Error(`invalid wallet event type ${e}`)}}constructor(){this.callbacks={}}},kp=new Map,Ap=(e,t)=>"bigint"==typeof t?t.toString():t;function Tp(e,t,n,r){let a=n.contentWindow;if(!a)throw Error("iframe not initialized");let i=((e,t)=>`${e}${JSON.stringify(t,Ap)}`)(e,t);if("privy:wallet:create"===e){let e=kp.get(i);if(e)return e}let o=new Promise(((n,i)=>{let o=vp();bp.enqueue(o,{resolve:n,reject:i}),a.postMessage({id:o,event:e,data:t},r)})).finally((()=>{kp.delete(i)}));return kp.set(i,o),o}function xp(e){let n=As(),r=i(null),a=i(e.mfaMethods),s=rl(),[l,c]=o(!1);return d((()=>{a.current=e.mfaMethods}),[e.mfaMethods]),d((()=>{if(!l)return;let t=r.current;if(!t)return;function n(t){var n;t&&t.origin===e.origin&&"string"==typeof(n=t.data).event&&/^privy:.+/.test(n.event)&&function(e){switch(e.event){case"privy:iframe:ready":let t=bp.dequeue(e.event,e.id);return Cp(e)?t.reject(new Ru(e.error.type,e.error.message)):t.resolve(e.data);case"privy:user-signer:sign":{let t=bp.dequeue(e.event,e.id);return Cp(e)?t.reject(new Ru(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:wallets:add":{let t=bp.dequeue(e.event,e.id);return Cp(e)?t.reject(new Ru(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:wallets:set-recovery":{let t=bp.dequeue(e.event,e.id);return Cp(e)?t.reject(new Ru(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:wallets:connect":{let t=bp.dequeue(e.event,e.id);return Cp(e)?t.reject(new Ru(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:wallets:recover":{let t=bp.dequeue(e.event,e.id);return Cp(e)?t.reject(new Ru(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:wallets:rpc":{let t=bp.dequeue(e.event,e.id);return Cp(e)?t.reject(new Ru(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:wallet:create":let n=bp.dequeue(e.event,e.id);return Cp(e)?n.reject(new Ru(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallets:import":let r=bp.dequeue(e.event,e.id);return Cp(e)?r.reject(new Ru(e.error.type,e.error.message)):r.resolve(e.data);case"privy:mfa:verify":let a=bp.dequeue(e.event,e.id);return Cp(e)?a.reject(new Ru(e.error.type,e.error.message)):a.resolve(e.data);case"privy:mfa:init-enrollment":{let t=bp.dequeue(e.event,e.id);return Cp(e)?t.reject(new Ru(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:mfa:submit-enrollment":{let t=bp.dequeue(e.event,e.id);return Cp(e)?t.reject(new Ru(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:mfa:unenroll":{let t=bp.dequeue(e.event,e.id);return Cp(e)?t.reject(new Ru(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:mfa:clear":{let t=bp.dequeue(e.event,e.id);return Cp(e)?t.reject(new Ru(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:auth:unlink-passkey":{let t=bp.dequeue(e.event,e.id);return Cp(e)?t.reject(new Ru(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:solana-wallet:create":let i=bp.dequeue(e.event,e.id);return Cp(e)?i.reject(new Ru(e.error.type,e.error.message)):i.resolve(e.data);case"privy:farcaster:init-signer":{let t=bp.dequeue(e.event,e.id);return Cp(e)?t.reject(new Ru(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:farcaster:sign":{let t=bp.dequeue(e.event,e.id);return Cp(e)?t.reject(new Ru(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:delegated-actions:consent":{let t=bp.dequeue(e.event,e.id);return Cp(e)?t.reject(new Ru(e.error.type,e.error.message)):t.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}(t.data)}let i={signWithUserSigner:n=>fp((r=>Tp("privy:user-signer:sign",{...n,...r},t,e.origin)),a.current,e.mfaPromise,e.mfaSubmitPromise,s),addWallet:n=>fp((r=>Tp("privy:wallets:add",{...n,...r},t,e.origin)),a.current,e.mfaPromise,e.mfaSubmitPromise,s),setRecovery:n=>fp((r=>Tp("privy:wallets:set-recovery",{...n,...r},t,e.origin)),a.current,e.mfaPromise,e.mfaSubmitPromise,s),connect:n=>fp((r=>Tp("privy:wallets:connect",{...n,...r},t,e.origin)),a.current,e.mfaPromise,e.mfaSubmitPromise,s),recover:n=>fp((r=>Tp("privy:wallets:recover",{...n,...r},t,e.origin)),a.current,e.mfaPromise,e.mfaSubmitPromise,s,!n.recoveryAccessToken&&!n.recoveryPassword&&!n.recoverySecretOverride),rpc:n=>fp((r=>Tp("privy:wallets:rpc",{...n,...r},t,e.origin)),a.current,e.mfaPromise,e.mfaSubmitPromise,s),create:n=>Tp("privy:wallet:create",n,t,e.origin),importWallet:n=>Tp("privy:wallets:import",n,t,e.origin),createSolana:n=>fp((r=>Tp("privy:solana-wallet:create",{...n,...r},t,e.origin)),a.current,e.mfaPromise,e.mfaSubmitPromise,s),createDelegatedAction:n=>Tp("privy:delegated-actions:consent",n,t,e.origin),verifyMfa:n=>fp((r=>Tp("privy:mfa:verify",{...n,...r},t,e.origin)),a.current,e.mfaPromise,e.mfaSubmitPromise,s,!0),initEnrollMfa:n=>fp((r=>Tp("privy:mfa:init-enrollment",{...n,...r},t,e.origin)),a.current,e.mfaPromise,e.mfaSubmitPromise,s),submitEnrollMfa:n=>fp((r=>Tp("privy:mfa:submit-enrollment",{...n,...r},t,e.origin)),a.current,e.mfaPromise,e.mfaSubmitPromise,s),unenrollMfa:n=>fp((r=>Tp("privy:mfa:unenroll",{...n,...r},t,e.origin)),a.current,e.mfaPromise,e.mfaSubmitPromise,s),clearMfa:n=>Tp("privy:mfa:clear",n,t,e.origin),unlinkPasskeyAccount:n=>fp((r=>Tp("privy:auth:unlink-passkey",{...n,...r},t,e.origin)),a.current,e.mfaPromise,e.mfaSubmitPromise,s),initFarcasterSigner:n=>Tp("privy:farcaster:init-signer",n,t,e.origin),signFarcasterMessage:n=>Tp("privy:farcaster:sign",n,t,e.origin)};window.addEventListener("message",n);let o=new AbortController;return Li((()=>Tp("privy:iframe:ready",{},t,e.origin)),{abortSignal:o.signal}).then((()=>e.onLoad(i)),((...t)=>{console.warn("Privy iframe failed to load: ",...t),e.onLoadFailed()})),()=>{window.removeEventListener("message",n),o.abort()}}),[l]),n?
|
|
18
|
+
/*#__PURE__*/t("iframe",{ref:r,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>c(!0),src:Ri(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId,client_id:e.appClientId})}):null}function Ip(e){return["ethereum","solana"].includes(e.chainType)}const Ep=({address:e,user:t})=>{let n=t.linkedAccounts.find((t=>"wallet"===t.type&&"privy"===t.walletClientType&&t.address===e));if(!n)throw new he("Address to delegate is not associated with current user.");if(!Ip(n))throw new he(`useDelegatedActions is not supported for ${n.chainType} wallets. Use the useSessionSigners hook to provision server side access on behalf of your users.`);return{address:n.address,chainType:n.chainType,walletIndex:n.walletIndex??0}},Sp=({address:e,user:t})=>{let n=t.linkedAccounts.find((t=>"wallet"===t.type&&"privy"===t.walletClientType&&t.address===e));if(!n)throw new he("Address to delegate is not associated with current user.");let r=n.imported?n:nn(t);if(!r)throw new he("Unable to determine root address for delegated address.");if(!Ip(r))throw new he(`useDelegatedActions is not supported for ${r.chainType} wallets. Use the useSessionSigners hook to provision server side access on behalf of your users.`);return{address:r.address,chainType:r.chainType,imported:r.imported}},_p=e=>e.linkedAccounts.filter((e=>"wallet"===e.type&&"privy"===e.walletClientType&&e.delegated));const Np=()=>{let e=ks();d((()=>{(async e=>{let t=new URL("v3/wallets","https://explorer-api.walletconnect.com");t.searchParams.append("projectId",e);let n=await fetch(t);return n.ok?Object.values((await n.json()).listings).sort((({slug:e},{slug:t})=>"rainbow"===e&&"metamask"===t?1:"metamask"===e||"rainbow"===e?-1:1)):(console.debug(`Failed to fetch WalletConnect listings: ${await n.text().catch((()=>"No response."))}`),[])})(e.walletConnectCloudProjectId).then((e=>Jo({listings:e}))).catch(console.error)}),[e.walletConnectCloudProjectId])};function Mp(e){let t=e.replace("eip155:","");if(t)return parseInt(t);throw Error("Chain ID not compatible with CAIP-2 format.")}const Wp="popup-privy-oauth",Pp="PRIVY_OAUTH_USE_BROADCAST_CHANNEL";class Up{async authenticate(){if(!this.api)throw new he("Auth flow has no API instance");try{return await this.api.post(Ae,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:this.meta.codeVerifier,provider:this.meta.provider})}catch(e){throw ge(e)}}async link(){if(!this.api)throw new he("Auth flow has no API instance");try{return await this.api.post(xe,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:this.meta.codeVerifier,provider:this.meta.provider})}catch(e){throw ge(e)}}constructor({authorizationCode:e,stateCode:t,codeVerifier:n,provider:r}){this.meta={authorizationCode:e,stateCode:t,codeVerifier:n,provider:r}}}async function Fp({api:e,requesterAppId:t,providerAppId:n}){let r=(await e.get(`/api/v1/apps/${t}/cross-app/connections`)).connections.find((e=>e.provider_app_id===n));if(!r)throw new he("Invalid connected app");return{name:r.provider_app_name,logoUrl:r.provider_app_icon_url||void 0,apiUrl:r.provider_app_custom_api_url,readOnly:r.read_only,customAuthAuthorizeUrl:r.provider_app_custom_auth_authorize_url,customAuthTransactUrl:r.provider_app_custom_auth_transact_url}}const Op=()=>window.open(void 0,void 0,Lp({w:440,h:680}));let Lp=({w:e,h:t})=>{let n=void 0!==window.screenLeft?window.screenLeft:window.screenX,r=void 0!==window.screenTop?window.screenTop:window.screenY,a=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,i=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height;return`toolbar=0,location=0,menubar=0,height=${t},width=${e},popup=1,left=${(a-e)/2/(a/window.screen.availWidth)+n},top=${(i-t)/2/(i/window.screen.availHeight)+r}`};const Rp=async({user:e,address:t,client:n,request:r,requesterAppId:a,reconnect:i})=>{n.createAnalyticsEvent({eventName:"cross_app_request_started",payload:{address:t,method:r.method}});let o=e?.linkedAccounts.find((e=>"cross_app"===e.type&&(e.embeddedWallets.some((e=>e.address===t))||e.smartWallets.some((e=>e.address===t)))));if(!e||!o)throw n.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Cannot request a signature with this wallet address",address:t}}),new he("Cannot request a signature with this wallet address");let s=n.getProviderAccessToken(o.providerApp.id),l=await Fp({api:n.api,requesterAppId:a,providerAppId:o.providerApp.id});if(!s){if(l.readOnly)throw console.error("cannot transact against a read-only provider app"),new he("Cannot transact against a read-only provider app");await i({appId:o.providerApp.id,action:"link"})&&(s=n.getProviderAccessToken(o.providerApp.id))}if(!s)throw n.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Transactions require a valid token",address:t}}),new he("Transactions require a valid token");let c=Op();if(!c)throw n.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Missing token",address:t}}),new he("Failed to initialize signature request");let d=new URL(l.customAuthTransactUrl||`${l.apiUrl}/oauth/transact`);return d.searchParams.set("token",s||""),d.searchParams.set("request",Dp(r)),c.location=d.href,new Promise(((e,a)=>{let i=setTimeout((()=>{d(),a(new he("Request timeout")),n.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Request timeout",address:t}})}),12e4),s=setInterval((()=>{c.closed&&(d(),a(new he("User rejected request")),n.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"User rejected request",address:t}}))}),300),l=i=>{i.data&&("set"===i.data.token?.action&&void 0!==i.data.token?.value?n.storeProviderAccessToken(o.providerApp.id,i.data.token.value):"clear"===i.data.token?.action&&n.storeProviderAccessToken(o.providerApp.id,null),"PRIVY_CROSS_APP_ACTION_RESPONSE"===i.data.type&&i.data.result&&(d(),e(i.data.result),n.createAnalyticsEvent({eventName:"cross_app_request_success",payload:{address:t,method:r.method}})),"PRIVY_CROSS_APP_ACTION_ERROR"===i.data.type&&i.data.error&&(d(),a(i.data.error),n.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:i.data.error,address:t}})))};window.addEventListener("message",l);let d=()=>{c.close(),clearInterval(s),clearTimeout(i),window.removeEventListener("message",l)}}))};let Dp=e=>JSON.stringify({content:{request:{request:Bp(e,zt)}},timestamp:Date.now(),callbackUrl:window.origin});const Bp=(e,t)=>"bigint"==typeof e?t(e):Array.isArray(e)?e.map((e=>Bp(e,t))):e&&"object"==typeof e?Object.fromEntries(Object.entries(e).map((([e,n])=>[e,Bp(n,t)]))):e,zp=({title:r,description:a,children:i,...o})=>
|
|
19
|
+
/*#__PURE__*/t(Vp,{...o,children:/*#__PURE__*/e(n,{children:[/*#__PURE__*/t("h3",{children:r}),"string"==typeof a?/*#__PURE__*/t("p",{children:a}):a,i]})}),Hp=({title:n,description:r,icon:a,children:i,...o})=>/*#__PURE__*/e($p,{...o,children:[a||null,/*#__PURE__*/t("h3",{children:n}),r&&"string"==typeof r?/*#__PURE__*/t("p",{children:r}):r,i]});let Vp=/*#__PURE__*/kn.div.withConfig({displayName:"StyledSection",componentId:"sc-523a75d6-1"})(["display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start;text-align:left;gap:8px;width:100%;margin-bottom:24px;&& h3{font-size:17px;color:var(--privy-color-foreground);}&& p{color:var(--privy-color-foreground-2);font-size:14px;}"]),$p=/*#__PURE__*/kn(Vp).withConfig({displayName:"CenteredStyledSection",componentId:"sc-523a75d6-2"})(["align-items:center;text-align:center;gap:16px;h3{margin-bottom:24px;}"]);const jp=n=>/*#__PURE__*/e("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 21 20",...n,children:[/*#__PURE__*/t("path",{fill:"url(#icloud-gradient)",d:"M12.34 7.315a4.26 4.26 0 0 0-3.707 2.18 2.336 2.336 0 0 0-1.02-.236 2.336 2.336 0 0 0-2.3 1.963 3.217 3.217 0 0 0 1.244 6.181c.135-.001.27-.01.404-.029h8.943c.047.004.094.006.141.007.045-.001.09-.004.135-.007h.214v-.016a2.99 2.99 0 0 0 1.887-.988c.487-.55.757-1.261.757-1.998v-.006a3.017 3.017 0 0 0-.69-1.915 2.992 2.992 0 0 0-1.748-1.034 4.26 4.26 0 0 0-4.26-4.102Z"}),/*#__PURE__*/t("defs",{children:/*#__PURE__*/e("linearGradient",{id:"icloud-gradient",x1:19.086,x2:3.333,y1:14.38,y2:14.163,gradientUnits:"userSpaceOnUse",children:[/*#__PURE__*/t("stop",{stopColor:"#3E82F4"}),/*#__PURE__*/t("stop",{offset:1,stopColor:"#93DCF7"})]})})]}),qp=({style:n,...r})=>/*#__PURE__*/e("svg",{width:"16",height:"14",style:n,viewBox:"0 0 16 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r,children:[/*#__PURE__*/e("g",{clipPath:"url(#clip0_2115_829)",children:[/*#__PURE__*/t("path",{d:"M2.34709 12.9404L2.3471 12.9404L2.34565 12.938L1.64031 11.7448L1.64004 11.7444L0.651257 10.0677C0.640723 10.0496 0.630746 10.0314 0.621325 10.0129H4.16461L2.39424 13.0139C2.3775 12.9901 2.36178 12.9656 2.34709 12.9404Z",fill:"#0066DA",stroke:"#6366F1"}),/*#__PURE__*/t("path",{d:"M8 4.48713L5.47995 0.215332C5.23253 0.358922 5.02176 0.556358 4.87514 0.80764L0.219931 8.70508C0.076007 8.95094 0.000191627 9.22937 0 9.51277H5.04009L8 4.48713Z",fill:"#00AC47"}),/*#__PURE__*/t("path",{d:"M13.48 13.7847C13.7274 13.6411 13.9382 13.4437 14.0848 13.1924L14.3781 12.6988L15.7801 10.3206C15.9267 10.0693 16.0001 9.79114 16.0001 9.51294H10.9596L12.0321 11.577L13.48 13.7847Z",fill:"#EA4335"}),/*#__PURE__*/t("path",{d:"M8.00003 4.48718L10.5201 0.215385C10.2726 0.0717949 9.98857 0 9.69533 0H6.30472C6.01148 0 5.7274 0.0807692 5.47998 0.215385L8.00003 4.48718Z",fill:"#00832D"}),/*#__PURE__*/t("path",{d:"M10.9599 9.51294H5.04007L2.52002 13.7847C2.76744 13.9283 3.05152 14.0001 3.34476 14.0001H12.6552C12.9484 14.0001 13.2325 13.9194 13.4799 13.7847L10.9599 9.51294Z",fill:"#2684FC"}),/*#__PURE__*/t("path",{d:"M13.4525 4.75636L11.1249 0.80764C10.9782 0.556358 10.7675 0.358922 10.52 0.215332L8 4.48713L10.9599 9.51277H15.9908C15.9908 9.23456 15.9175 8.95636 15.7709 8.70508L13.4525 4.75636Z",fill:"#FFBA00"})]}),/*#__PURE__*/t("defs",{children:/*#__PURE__*/t("clipPath",{id:"clip0_2115_829",children:/*#__PURE__*/t("rect",{width:"16",height:"14",fill:"white"})})})]});async function Kp({url:e,popup:t,provider:n}){return t.location=e,new Promise(((e,n)=>{function r(){t?.close(),window.removeEventListener("message",a)}function a(t){t.data&&("PRIVY_OAUTH_RESPONSE"===t.data.type&&t.data.stateCode&&t.data.authorizationCode&&(e(t.data),r()),"https://cdn.apple-cloudkit.com"===t.origin&&t.data.ckSession&&(e({type:"PRIVY_OAUTH_RESPONSE",ckWebAuthToken:t.data.ckSession}),r()),"PRIVY_OAUTH_ERROR"===t.data.type&&(n(t.data.error),r()))}window.addEventListener("message",a)}))}async function Gp({api:e,provider:t,stateCode:n,codeVerifier:r,authorizationCode:a}){if(!a||!n)throw new he("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if("undefined"===a)throw new he("User denied confirmation during OAuth flow");try{return(await e.post(It,{authorization_code:a,state_code:n,code_verifier:r,provider:t})).access_token}catch(e){let t=ge(e);if(t.privyErrorCode)throw new he(t.message||"Invalid code during OAuth flow.",void 0,t.privyErrorCode);if("User denied confirmation during OAuth flow"===t.message)throw new he("Invalid code during oauth flow.",void 0,Te.OAUTH_USER_DENIED);throw new he("Invalid code during OAuth flow.",void 0,Te.UNKNOWN_AUTH_ERROR)}}async function Zp({api:e,provider:t}){let n=ei(),r=ti(),a=await ni(n);try{return"icloud"===t?{url:(await e.post(Et,{client_type:"web"})).url}:{url:(await e.post(St,{redirect_to:window.location.href,code_challenge:a,state_code:r})).url,codeVerifier:n,stateCode:r,provider:t}}catch(e){throw ge(e)}}const Yp=(e,{chainType:t,walletIndex:n}={})=>e?.linkedAccounts.filter((e=>!("wallet"!==e.type||"privy"!==e.walletClientType||void 0!==n&&e.walletIndex!==n||void 0!==t&&e.chainType!==t)))??[],Qp=async({user:e,accessToken:t,proxy:n,refreshSessionAndUser:r,privy:a,appConfig:i,recoverEmbeddedWallet:o,setUser:s,walletIndex:l,chainType:c,recoveryMethod:d,recoveryPassword:u,recoveryAccessToken:p})=>{if(0===l)if("user-controlled-server-wallets-only"===i.embeddedWallets.mode)await M(a,{request:{chain_type:c}});else if("ethereum"===c){let r=ln(e);r&&await o({address:r.address}),await n.create({accessToken:t,solanaAddress:r?.address,recoveryMethod:d,recoveryPassword:u,recoveryAccessToken:p})}else{if("solana"!==c)throw Error("Invalid input to create wallet");{let r=cn(e);r&&await o({address:r.address}),await n.createSolana({accessToken:t,ethereumAddress:r?.address,recoveryMethod:d,recoveryPassword:u,recoveryAccessToken:p})}}else if("user-controlled-server-wallets-only"===i.embeddedWallets.mode)await M(a,{request:{chain_type:c}});else{let{entropyId:r,entropyIdVerifier:a}=ro(e);await o(),await n.addWallet({accessToken:t,entropyId:r,entropyIdVerifier:a,chainType:c,hdWalletIndex:l})}let h=await r(),m=Yp(h,{chainType:c,walletIndex:l})[0];return s(h),{user:h,account:m}},Xp=()=>{let{walletProxy:e,recoverEmbeddedWallet:t,setUser:n,refreshSessionAndUser:r,privy:a,client:i}=Ft(),o=ks();return{create:async({walletIndex:s,chainType:l,latestUser:c,recoveryMethod:d,recoveryPassword:u,recoveryAccessToken:p})=>{let h=c;h||(h=await r());let m=await i.getAccessToken();if(!h||!m||!e)throw Error("User must be authenticated before creating a Privy wallet");return await Qp({appConfig:o,user:h,refreshSessionAndUser:r,privy:a,accessToken:m,proxy:e,recoverEmbeddedWallet:t,setUser:n,walletIndex:s,chainType:l,recoveryMethod:d,recoveryPassword:u,recoveryAccessToken:p})}}},Jp=({title:e,description:n,onClose:r})=>/*#__PURE__*/t(kc,{title:e,subtitle:n,icon:Gn,iconVariant:"success",watermark:!0,onBack:r}),eh={component:()=>{let{user:e}=on(),{closePrivyModal:n,isNewUserThisSession:r,updateWallets:a}=Ft(),{app:i,data:o,onUserCloseViaDialogOrKeybindRef:s}=Is(),{onSuccess:l,onFailure:c,callAuthOnSuccessOnClose:u}=o.createWallet,p=()=>{let t=cn(e)??ln(e);e&&t?(a(),l({user:e,account:t})):c(Error("Failed to create wallet")),n({shouldCallAuthOnSuccess:u})};return d((()=>{let e=setTimeout(p,Aa);return()=>clearTimeout(e)}),[]),s.current=p,/*#__PURE__*/t(Jp,{title:r?"Welcome"+(i?.name?` to ${i?.name}`:""):"All set!",description:r?"You've successfully created an account.":"Your account is secured.",onClose:p})}},th=/*#__PURE__*/kn.div.withConfig({displayName:"RecoveryContainer",componentId:"sc-12b46968-0"})(["display:flex;flex-direction:column;gap:12px;padding-top:24px;padding-bottom:24px;"]),nh=/*#__PURE__*/kn.div.withConfig({displayName:"RecoveryExplainerContainer",componentId:"sc-12b46968-1"})(["padding-bottom:24px;"]);let rh={"google-drive":{name:"Google Drive",component:qp},icloud:{name:"iCloud",component:jp}};const ah={component:()=>{let{logout:r}=on(),{navigate:a,setModalData:i,data:s}=Is(),{closePrivyModal:l,createAnalyticsEvent:c}=Ft(),{execute:p}=(()=>{let{client:e,walletProxy:t,refreshSessionAndUser:n}=Ft(),{data:r}=Is(),{user:a}=on(),i=rl(),{create:o}=Xp();return{execute:async({provider:s,action:l,popup:c,shouldCreateEth:d,shouldCreateSol:u})=>{let p,h;if(!e)throw new he("Missing client");function m(t){if(!t&&e)throw e.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:"Unable to open recovery OAuth popup",provider:s}}),new he("Recovery OAuth failed")}switch(s){case"google-drive":{let t,n,{url:r,codeVerifier:a,stateCode:i}=await Zp({api:e.api,provider:s});m(r);try{let a=await Kp({url:r,popup:c,provider:s});if(t=a.stateCode,n=a.authorizationCode,t!==i)throw e.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:s,storedStateCode:i??"",returnedStateCode:t??""}}),new he("Unexpected auth flow. This may be a phishing attempt.",void 0,Te.OAUTH_UNEXPECTED)}catch(t){throw e.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:t.toString(),provider:s}}),new he("Recovery OAuth failed")}[p,h]=await Promise.all([e.getAccessToken(),Gp({api:e.api,provider:s,codeVerifier:a,stateCode:t,authorizationCode:n})]);break}case"icloud":{let{url:t}=await Zp({api:e.api,provider:s});m(t);let{ckWebAuthToken:n}=await Kp({url:t,popup:c,provider:s});h=n,p=await e.getAccessToken()}}if(!t)throw new he("Cannot connect to wallet proxy");if(!p)throw new he("Unable to authorize user");switch(l){case"recover":{let n=r?.recoverWallet?.entropyId,a=r?.recoverWallet?.entropyIdVerifier;if(!n||!a)throw new he("Recovery OAuth failed");e.createAnalyticsEvent({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:n,recoveryMethod:s}}),await t.recover({accessToken:p,entropyId:n,entropyIdVerifier:a,recoveryAccessToken:h}),e.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:n,recoveryMethod:s}});break}case"create-wallet":{let t;if(e.createAnalyticsEvent({eventName:"embedded_wallet_creation_started"}),d&&u)t=await o({recoveryMethod:s,recoveryAccessToken:h,chainType:"ethereum",walletIndex:0,latestUser:a}),t=await o({chainType:"solana",walletIndex:0,latestUser:t.user});else if(u)t=await o({recoveryMethod:s,recoveryAccessToken:h,chainType:"solana",walletIndex:0,latestUser:a});else{if(!d)throw Error("Invalid args to create wallet");t=await o({recoveryMethod:s,recoveryAccessToken:h,chainType:"ethereum",walletIndex:0,latestUser:a})}if(!t)throw i("createWallet","onError",Te.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to create wallet");e.createAnalyticsEvent({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:t.account.address}}),i("createWallet","onSuccess",{wallet:t.account});break}case"set-recovery":{let r=nn(a);if(!r)throw i("setWalletRecovery","onError",Te.EMBEDDED_WALLET_NOT_FOUND),Error("Embedded wallet not found");e.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:r.address,existingRecoveryMethod:r.recoveryMethod,targetRecoveryMethod:s}});let{entropyId:o,entropyIdVerifier:l}=ro(a);await t.setRecovery({accessToken:p,entropyId:o,entropyIdVerifier:l,recoveryMethod:s,recoveryAccessToken:h});let c=nn(await n());if(!c)throw i("createWallet","onError",Te.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to set recovery on wallet");e.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:r.address,existingRecoveryMethod:r.recoveryMethod,targetRecoveryMethod:s}}),i("setWalletRecovery","onSuccess",{method:s,wallet:c});break}default:throw new he("Unsupported recovery action")}}}})(),[h,m]=o(!1),{provider:g,action:y,isInAccountCreateFlow:f,shouldCreateEth:w,shouldCreateSol:v}=s?.recoveryOAuthStatus,[C,b]=o(void 0),[k,A]=o("create-wallet"===y);if("user-passcode"===g)throw Error("RecoveryOAuthScreen should never be called with a wallet that specifies recoveryMethod: `user-passcode`");let T=rh[g].name,x=rh[g].component,I=s?.recoverWallet?.onCompleteNavigateTo,E=new va((async(e="create-wallet")=>(A(!0),new Promise(((t,n)=>{setTimeout((async()=>{try{let n=window.open();await p({provider:g,action:e,popup:n,shouldCreateEth:w,shouldCreateSol:v}),m(!0),t()}catch(t){b({message:`${"recover"===e?"Recovery":"Back up"} with ${T} unsuccessful`,detail:"recover"===y?`Please verify that you are selecting the ${T} account associated with your backup.`:"",retryable:!0}),n()}}),0)})))));d((()=>{"recover"!==y&&E.execute(f?"create-wallet":"set-recovery")}),[]),d((()=>{if(!h)return;let e=setTimeout((()=>{f?(i({createWallet:{onSuccess:()=>{},onFailure:e=>{c({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"RecoveryOAuthScreen"}}),r()},callAuthOnSuccessOnClose:!0,shouldCreateEth:!1,shouldCreateSol:!1}}),a(eh)):l({shouldCallAuthOnSuccess:!1})}),ka);return()=>clearTimeout(e)}),[h]);let S=u((async()=>{await E.execute("recover"),I?a(I):m(!0)}),[]),_="google-drive"===g?"Google Drive":"Apple iCloud",N=h&&`Successfully ${"recover"===y?"recovered":"backed up"} with ${_}.`||C&&C.message||`${"recover"===y?"Recovering":"Backing up"} with ${_}...`,M=C?C.detail:"";/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t($l,{}),k?/*#__PURE__*/t(n,{children:/*#__PURE__*/e(th,{children:[/*#__PURE__*/t(Hp,{title:N,icon:/*#__PURE__*/t(x,{style:{width:"38px",height:"38px"}}),description:M}),C&&C?.retryable?/*#__PURE__*/t(Ml,{onClick:()=>{vi(),b(void 0),"create-wallet"===y?E.execute("create-wallet"):S()},disabled:!h&&!C?.retryable,children:"Try again"}):null]})}):/*#__PURE__*/e(th,{children:[/*#__PURE__*/t(Hp,{title:"Confirm it's really you",icon:/*#__PURE__*/t(x,{style:{height:42,width:48}}),description:`To confirm your identity, please log in to ${_} where your account is backed up.`}),/*#__PURE__*/e(Ml,{onClick:S,children:["Confirm with ",_]})]}),/*#__PURE__*/t(vl,{})]})}};let ih=/*#__PURE__*/kn.div.withConfig({displayName:"IconContainer",componentId:"sc-ccfae04f-0"})(["width:24px;height:24px;display:flex;justify-content:center;align-items:center;"]),oh={"google-drive":"Google Drive",icloud:"iCloud","user-passcode":"password",privy:"Privy","privy-v2":"Privy"},sh=({onClose:r})=>/*#__PURE__*/e(nh,{children:[/*#__PURE__*/t(Hp,{title:"Why do I need to secure my account?",icon:/*#__PURE__*/t(Wn,{width:48}),description:/*#__PURE__*/e(n,{children:[/*#__PURE__*/t("p",{children:"Your app uses cryptography to secure your account. App secrets are split and encrypted so only you can access them."}),/*#__PURE__*/t("p",{children:"To use this app on new devices, secure account secrets using a password, your Google or your Apple account. It’s important you don’t lose access to the method you choose."})]})}),/*#__PURE__*/t(Ml,{onClick:r,children:"Select backup method"})]});const lh={component:()=>{let[r,a]=o(!1),{navigate:i,lastScreen:s,navigateBack:l,setModalData:c,data:d,onUserCloseViaDialogOrKeybindRef:u}=Is(),{user:p}=on(),{embeddedWallets:h}=ks(),{closePrivyModal:m}=Ft(),g=nn(p),y=null===g,{isInAccountCreateFlow:f,isResettingPassword:w,shouldCreateEth:v,shouldCreateSol:C}=d.recoverySelection,b=g&&"privy"!==g.recoveryMethod,k=b?/*#__PURE__*/e("span",{children:["Your account is currently secured using"," ",/*#__PURE__*/t("strong",{children:oh[g?.recoveryMethod||"user-passcode"]}),"."]}):"Select a method for logging in on new devices and recovering your account.";function A(e){c({recoveryOAuthStatus:{provider:e,action:y?"create-wallet":"set-recovery",isInAccountCreateFlow:f,shouldCreateEth:v,shouldCreateSol:C}}),i(ah)}function T(){d?.setWalletPassword?.onFailure(Error("User exited set recovery flow")),m({shouldCallAuthOnSuccess:d?.setWalletPassword?.callAuthOnSuccessOnClose??!1})}return u.current=T,/*#__PURE__*/e(n,{children:[/*#__PURE__*/t($l,{onClose:T,backFn:r?()=>a(!1):s?l:void 0,infoFn:s||r?void 0:()=>a(!0)},"header"),r?/*#__PURE__*/t(sh,{onClose:()=>a(!1)}):/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Hp,{title:b?"Update backup method":"Secure your account",icon:/*#__PURE__*/t(Pr,{width:48}),description:k}),/*#__PURE__*/t(th,{children:h.userOwnedRecoveryOptions.filter((e=>!["icloud","google-drive"].includes(g?.recoveryMethod||"")||e!==g?.recoveryMethod)).sort().map((n=>{switch(n){case"google-drive":/*#__PURE__*/return e(ul,{onClick:()=>A("google-drive"),children:[/*#__PURE__*/t(ih,{children:/*#__PURE__*/t(qp,{style:{width:18}})}),"Back up to Google Drive"]},n);case"icloud":/*#__PURE__*/return e(ul,{onClick:()=>A("icloud"),children:[/*#__PURE__*/t(ih,{children:/*#__PURE__*/t(jp,{style:{width:24}})}),"Back up to Apple iCloud"]},n);case"user-passcode":/*#__PURE__*/return e(ul,{onClick:()=>{i(Iw({isCreatingWallet:y,skipSplashScreen:!0}))},children:[/*#__PURE__*/t(ih,{children:/*#__PURE__*/t(Ur,{style:{width:18}})}),w?"Reset your":"Set a"," password"]},n);default:return null}}))})]}),/*#__PURE__*/t(vl,{})]})}};let ch=/*#__PURE__*/An(["font-size:14px;font-style:normal;font-weight:400;line-height:20px;letter-spacing:-0.008px;text-align:left;transition:color 0.1s ease-in;"]);const dh=/*#__PURE__*/kn.span.withConfig({displayName:"StatusText",componentId:"sc-acac4b9-0"})([""," transition:color 0.1s ease-in;color:",";text-transform:",";&[aria-hidden='true']{visibility:hidden;}"],ch,(({error:e})=>e?"var(--privy-color-error)":"var(--privy-color-foreground-3)"),(({error:e})=>e?"":"capitalize")),uh=/*#__PURE__*/kn.div.withConfig({displayName:"EmbeddedWalletScreenContainer",componentId:"sc-acac4b9-1"})(["display:flex;flex-direction:column;justify-content:center;flex-grow:1;"]),ph=/*#__PURE__*/kn(Ml).withConfig({displayName:"NoAnimationPrimaryButton",componentId:"sc-acac4b9-2"})(["",""],(({$hideAnimations:e})=>e&&/*#__PURE__*/An(["&&{transition:none;}"])));let hh=/*#__PURE__*/An(["&&{width:100%;border-width:1px;border-radius:var(--privy-border-radius-md);border-color:var(--privy-color-foreground-3);background:var(--privy-color-background);color:var(--privy-color-foreground);padding:12px;font-size:16px;font-style:normal;font-weight:300;line-height:22px;}"]);const mh=/*#__PURE__*/kn.input.withConfig({displayName:"PasswordInput",componentId:"sc-acac4b9-3"})([""," &::placeholder{color:var(--privy-color-foreground-3);font-style:italic;font-size:14px;}overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"],hh),gh=/*#__PURE__*/kn.div.withConfig({displayName:"PasswordDisplay",componentId:"sc-acac4b9-4"})(["",""],hh),yh=/*#__PURE__*/kn.div.withConfig({displayName:"PasswordContainer",componentId:"sc-acac4b9-5"})(["position:relative;width:100%;display:flex;align-items:center;justify-content:",";"],(({centered:e})=>e?"center":"space-between")),fh=/*#__PURE__*/kn.div.withConfig({displayName:"Header",componentId:"sc-acac4b9-6"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin:32px 0;gap:4px;& h3{font-size:18px;font-style:normal;font-weight:600;line-height:24px;}& p{max-width:300px;font-size:14px;font-style:normal;font-weight:400;line-height:20px;}"]),wh=/*#__PURE__*/kn.div.withConfig({displayName:"Details",componentId:"sc-acac4b9-7"})(["display:flex;flex-direction:column;gap:10px;padding-bottom:1rem;"]),vh=/*#__PURE__*/kn.div.withConfig({displayName:"DetailItem",componentId:"sc-acac4b9-8"})(["display:flex;text-align:left;align-items:center;gap:8px;max-width:300px;font-size:14px;font-style:normal;font-weight:400;line-height:20px;letter-spacing:-0.008px;margin:0 8px;color:var(--privy-color-foreground-2);> :first-child{min-width:24px;}"]),Ch=/*#__PURE__*/kn(_l).withConfig({displayName:"ExportButton",componentId:"sc-acac4b9-10"})(["display:flex;flex:1;gap:4px;justify-content:center;&&{background:var(--privy-color-background);border-radius:var(--privy-border-radius-md);border-color:var(--privy-color-foreground-3);border-width:1px;}"]),bh=/*#__PURE__*/kn.div.withConfig({displayName:"InputRightIcons",componentId:"sc-acac4b9-11"})(["position:absolute;right:0.5rem;display:flex;flex-direction:row;justify-content:space-around;align-items:center;"]),kh=/*#__PURE__*/kn(Fr).withConfig({displayName:"RegenerateIcon",componentId:"sc-acac4b9-12"})(["height:1.25rem;width:1.25rem;stroke:var(--privy-color-accent);cursor:pointer;:active{stroke:var(--privy-color-accent-light);}"]),Ah=/*#__PURE__*/kn(Lr).withConfig({displayName:"HiddenIcon",componentId:"sc-acac4b9-13"})(["height:1.25rem;width:1.25rem;stroke:var(--privy-color-accent);cursor:pointer;:active{stroke:var(--privy-color-accent-light);}"]),Th=/*#__PURE__*/kn(Or).withConfig({displayName:"ShownIcon",componentId:"sc-acac4b9-14"})(["height:1.25rem;width:1.25rem;stroke:var(--privy-color-accent);cursor:pointer;:active{stroke:var(--privy-color-accent-light);}"]),xh=/*#__PURE__*/kn.progress.withConfig({displayName:"StrengthMeter",componentId:"sc-acac4b9-15"})(["height:4px;width:100%;margin:8px 0;::-webkit-progress-bar{border-radius:8px;background:var(--privy-color-foreground-4);}::-webkit-progress-value{border-radius:8px;transition:all 0.1s ease-out;background:",";}"],(({label:e})=>("Strong"===e?"#78dca6":"Medium"===e&&"var(--privy-color-warn)")||"var(--privy-color-error)")),Ih=({buttonHideAnimations:r,buttonLoading:a,password:i,onSubmit:s,onBack:l})=>{let[c,u]=o(!0),[p,h]=o(!1),[m,g]=o(""),y=i===m;return d((()=>{m&&!p&&h(!0)}),[m]),/*#__PURE__*/e(n,{children:[/*#__PURE__*/t($l,{closeable:!1,backFn:l}),/*#__PURE__*/t($d,{}),/*#__PURE__*/e(uh,{children:[/*#__PURE__*/e(fh,{children:[/*#__PURE__*/t(Fn,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),/*#__PURE__*/t("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),/*#__PURE__*/t("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),/*#__PURE__*/e(yh,{children:[/*#__PURE__*/t(mh,{value:m,onChange:e=>g(e.target.value),onKeyUp:e=>{"Enter"===e.key&&s()},onBlur:()=>h(!0),placeholder:"confirm your password",type:c?"password":"text",style:{paddingRight:"2.3rem"}}),/*#__PURE__*/t(bh,{style:{right:"0.75rem"},children:c?/*#__PURE__*/t(Ah,{onClick:()=>u(!1)}):/*#__PURE__*/t(Th,{onClick:()=>u(!0)})})]}),
|
|
20
|
+
/*#__PURE__*/t(dh,{"aria-hidden":!p||y,error:!0,children:"Passwords do not match"})]}),/*#__PURE__*/t(ph,{onClick:s,loading:a,disabled:!y,$hideAnimations:r,children:"Continue"}),/*#__PURE__*/t(jd,{}),/*#__PURE__*/t(vl,{})]})},Eh=({className:n,checked:r,color:a="var(--privy-color-accent)",...i})=>/*#__PURE__*/t("label",{children:/*#__PURE__*/e(Sh,{className:n,children:[/*#__PURE__*/t(Nh,{checked:r,...i}),/*#__PURE__*/t(Mh,{color:a,checked:r,children:/*#__PURE__*/t(_h,{viewBox:"0 0 24 24",children:/*#__PURE__*/t("polyline",{points:"20 6 9 17 4 12"})})})]})});let Sh=/*#__PURE__*/kn.div.withConfig({displayName:"CheckboxContainer",componentId:"sc-db51b935-1"})(["display:inline-block;vertical-align:middle;"]),_h=/*#__PURE__*/kn.svg.withConfig({displayName:"Icon",componentId:"sc-db51b935-2"})(["fill:none;stroke:white;stroke-width:3px;"]),Nh=/*#__PURE__*/kn.input.attrs({type:"checkbox"}).withConfig({displayName:"HiddenCheckbox",componentId:"sc-db51b935-3"})(["border:0;clip:rect(0 0 0 0);clippath:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px;"]),Mh=/*#__PURE__*/kn.div.withConfig({displayName:"StyledCheckbox",componentId:"sc-db51b935-4"})(["display:inline-block;width:18px;height:18px;transition:all 150ms;cursor:pointer;border-color:",";border-radius:3px;background:",";&&{border-width:1px;}",":focus + &{box-shadow:0 0 0 1px ",";}","{visibility:",";}"],(e=>e.color),(e=>e.checked?e.color:"var(--privy-color-background)"),Nh,(e=>e.color),_h,(e=>e.checked?"visible":"hidden"));const Wh=({buttonHideAnimations:r,buttonLoading:a,onSubmit:i,onBack:s,config:l})=>{let[c,d]=o(!1);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t($l,{closeable:!1,backFn:s}),/*#__PURE__*/t($d,{}),/*#__PURE__*/e(uh,{children:[/*#__PURE__*/e(fh,{children:[/*#__PURE__*/t(Fn,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),/*#__PURE__*/t("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),/*#__PURE__*/t("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),/*#__PURE__*/t(wh,{children:/*#__PURE__*/e(vh,{style:{color:"var(--privy-color-error)",cursor:"pointer"},onClick:e=>{e.preventDefault(),d((e=>!e))},children:[/*#__PURE__*/t(Eh,{color:"var(--privy-color-error)",readOnly:!0,checked:c}),/*#__PURE__*/t(n,{children:"I understand that if I lose my password and device, I will lose access to my account and my assets."})]})})]}),/*#__PURE__*/e(Ph,{children:["user"===l.initiatedBy&&/*#__PURE__*/t(Fl,{onClick:l.onCancel,disabled:a,children:"Cancel"}),/*#__PURE__*/t(ph,{onClick:i,loading:a,$hideAnimations:r,disabled:!c,children:"Set Password"})]}),/*#__PURE__*/t(jd,{}),/*#__PURE__*/t(vl,{})]})};let Ph=/*#__PURE__*/kn.div.withConfig({displayName:"ButtonsContainer",componentId:"sc-d1659c5f-0"})(["display:flex;gap:10px;"]),Uh=/[a-z]/,Fh=/[A-Z]/,Oh=/[0-9]/,Lh="!@#$%^&*()\\-_+.",Rh=`a-zA-Z0-9${Lh}`,Dh=RegExp(`[${Lh}]`),Bh=RegExp(`[${Rh}]`);const zh=RegExp(`^[${Rh}]{6,}$`),Hh=()=>wr.generatePassphrase(4,vr);function Vh(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function $h(e=""){return(.3*function(e){if(e.length<8)return 0;let t=0;return Uh.test(e)&&(t+=1),Fh.test(e)&&(t+=1),Oh.test(e)&&(t+=1),Dh.test(e)&&(t+=1),Math.max(0,Math.min(1,t/3))}(e)+fr(e)/95)/2}const jh=({buttonHideAnimations:r,buttonLoading:a,password:i="",config:l,isResettingPassword:c,onSubmit:u,onClose:p,onBack:h,onPasswordChange:m,onPasswordGenerate:g})=>{let[y,f]=o(!1),[w,v]=o(!1);d((()=>{i&&!w&&v(!0)}),[i]);let C=s((()=>w?6>(i?.length||0)?"Password must be at least 6 characters":zh.test(i||"")?null:`Invalid characters used ( ${((e="")=>[...new Set(e.split("").filter((e=>!Bh.test(e))).map((e=>e.replace(" ","SPACE"))))])(i).join(" ")} )`:null),[i,w]),b=s((()=>C?{value:0,label:"Weak"}:function(e=""){let t=$h(e);return{value:t,label:Vh(t)}}(i)),[i,C]),k=s((()=>!i?.length||!!C),[C,i]);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t($l,{onClose:p,closeable:"user"===l.initiatedBy,backFn:h}),/*#__PURE__*/t($d,{}),/*#__PURE__*/e(uh,{children:[/*#__PURE__*/e(fh,{children:[/*#__PURE__*/t(Rr,{height:48,width:48,stroke:"var(--privy-color-accent)"}),/*#__PURE__*/e("h3",{style:{color:"var(--privy-color-foreground)"},children:[c?"Reset":"Set"," your password"]}),/*#__PURE__*/t("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),/*#__PURE__*/e(yh,{children:[/*#__PURE__*/t(mh,{value:i,onChange:e=>m(e.target.value),onKeyUp:e=>{"Enter"===e.key&&u()},placeholder:"enter or generate a strong password",type:y?"password":"text",style:{paddingRight:"3.8rem"}}),/*#__PURE__*/e(bh,{style:{width:"3.5rem"},children:[y?/*#__PURE__*/t(Ah,{onClick:()=>f(!1)}):/*#__PURE__*/t(Th,{onClick:()=>f(!0)}),/*#__PURE__*/t(kh,{onClick:g})]})]}),/*#__PURE__*/t(xh,{value:0===b.value?.01:b.value,label:b.label}),/*#__PURE__*/t(dh,{error:!!C,children:C||`Password Strength: ${w?b.label:"--"}`}),/*#__PURE__*/e(Kh,{children:[/*#__PURE__*/t(qh,{children:/*#__PURE__*/e(wh,{children:[/*#__PURE__*/e(vh,{children:[/*#__PURE__*/t(Dr,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),/*#__PURE__*/e(vh,{children:[/*#__PURE__*/t(Dr,{width:24,height:24,fill:"var(--privy-color-accent)"}),"Use it to log in on a new environment, like another browser or device."]})]})}),/*#__PURE__*/t(ph,{onClick:u,loading:a,disabled:k,$hideAnimations:r,children:"Continue"})]})]}),/*#__PURE__*/t(jd,{}),/*#__PURE__*/t(vl,{})]})};let qh=/*#__PURE__*/kn(wh).withConfig({displayName:"DetailsContainer",componentId:"sc-2da5fe90-0"})(["flex:1;padding-top:1rem;"]),Kh=/*#__PURE__*/kn.div.withConfig({displayName:"LowerContainer",componentId:"sc-2da5fe90-1"})(["display:flex;flex-direction:column;height:100%;"]);const Gh=({buttonHideAnimations:r,buttonLoading:a,appName:i,password:s,onSubmit:l,onBack:c})=>{let[d,p]=o(!1),[h,m]=o(!0),g=u((()=>{p(!0),s&&navigator.clipboard.writeText(s)}),[s]),y=u((()=>{let e=document.createElement("a"),t=i.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),n=new Blob([Zh(i,s)],{type:"text/plain"}),r=URL.createObjectURL(n);e.href=r,e.target="_blank",e.download=`${t}-privy-wallet-recovery.txt`,document.body.appendChild(e),e.click(),setTimeout((()=>{e.remove(),URL.revokeObjectURL(r)}),5e3)}),[s]);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t($l,{backFn:c,closeable:!1}),/*#__PURE__*/t($d,{}),/*#__PURE__*/e(uh,{children:[/*#__PURE__*/e(fh,{children:[/*#__PURE__*/t(Fn,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),/*#__PURE__*/t("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),/*#__PURE__*/t("p",{style:{color:"var(--privy-color-foreground-2)"},children:"For your security, this password cannot be reset, so keep it somewhere safe."})]}),/*#__PURE__*/e(yh,{centered:!0,children:[/*#__PURE__*/t(gh,{children:h?"•".repeat(s.length):s}),/*#__PURE__*/t(bh,{style:{right:"0.75rem"},children:h?/*#__PURE__*/t(Ah,{onClick:()=>m(!1)}):/*#__PURE__*/t(Th,{onClick:()=>m(!0)})})]}),/*#__PURE__*/e("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[/*#__PURE__*/t(Ch,{onClick:g,children:/*#__PURE__*/e(n,d?{children:[/*#__PURE__*/t(zr,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}:{children:[/*#__PURE__*/t(Hr,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),/*#__PURE__*/e(Ch,{onClick:y,children:[/*#__PURE__*/t(Br,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),/*#__PURE__*/t(ph,{onClick:l,loading:a,$hideAnimations:r,children:"Continue"}),/*#__PURE__*/t(jd,{}),/*#__PURE__*/t(vl,{})]})};let Zh=(e,t)=>`Your wallet recovery password for ${e} is\n\n${t}\n\nYou will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;const Yh=({error:r,onClose:a})=>/*#__PURE__*/e(n,{children:[/*#__PURE__*/t($l,{closeable:!1}),/*#__PURE__*/t($d,{}),/*#__PURE__*/e(Bd,r?{children:[/*#__PURE__*/t(Vr,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),/*#__PURE__*/t(Hp,{title:"Something went wrong",description:r})]}:{children:[/*#__PURE__*/t(Dr,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),/*#__PURE__*/t(Hp,{title:"Success"})]}),/*#__PURE__*/t(Ml,{onClick:a,children:"Close"}),/*#__PURE__*/t(jd,{}),/*#__PURE__*/t(vl,{})]});let Qh=(e,t)=>{switch(e){case"creating":return"back"===t?e:"saving";case"saving":return"back"===t?"creating":"confirming";case"confirming":return"back"===t?"saving":"finalizing";case"finalizing":return"back"===t?"confirming":"done";default:return e}};const Xh=({onSubmit:e,...n})=>{let{lastScreen:r,navigate:a}=Is(),{send:i,state:o}=(()=>{let[e,t]=p(Qh,"creating");return{send:t,state:e}})(),s=u((async()=>{"finalizing"===o&&await e(),i("next")}),[o,i,e]);d((()=>{let e;return"done"===o&&"automatic"===n.config.initiatedBy&&(e=setTimeout((()=>n.onClose?.()),ka)),()=>{e&&clearTimeout(e)}}),[o,n.config.initiatedBy,n.onClose]);let l=u((()=>{i("back")}),[i]),c=u((()=>{a(lh)}),[r,a]);return"creating"===o?/*#__PURE__*/t(jh,{...n,onSubmit:s,onBack:r===lh?c:void 0}):"saving"===o?/*#__PURE__*/t(Gh,{...n,onSubmit:s,onBack:l}):"confirming"===o?/*#__PURE__*/t(Ih,{...n,onSubmit:s,onBack:l}):"finalizing"===o?/*#__PURE__*/t(Wh,{...n,onSubmit:s,onBack:l}):"done"===o?/*#__PURE__*/t(Yh,{...n,onSubmit:s}):null};let Jh={apple_oauth:"apple",custom_auth:"custom",discord_oauth:"discord",email:"email",farcaster:"farcaster",github_oauth:"github",google_oauth:"google",instagram_oauth:"instagram",linkedin_oauth:"linkedin",passkey:"passkey",phone:"sms",spotify_oauth:"spotify",telegram:"telegram",tiktok_oauth:"tiktok",line_oauth:"line",twitter_oauth:"twitter",wallet:"siwe",smart_wallet:"siwe",cross_app:"privy:"};const em=e=>{let t=Jh[e];return"wallet"===e||"phone"===e?{displayName:e,loginMethod:t}:{displayName:t,loginMethod:t}};let tm=/*#__PURE__*/c({});const nm=({children:e})=>{let n=ks(),[r,a]=o({});return tl("login",{onComplete:({loginAccount:e})=>{e&&"passkey"!==e.type&&"cross_app"!==e.type&&("wallet"!==e.type||"privy"!==e.walletClientType)&&(ua.put(rm(n.id),e.type),"wallet"===e.type?(ua.put(am(n.id),e.walletClientType),ua.put(im(n.id),e.chainType),a({accountType:e.type,walletClientType:e.walletClientType,chainType:e.chainType})):(ua.del(am(n.id)),ua.del(im(n.id)),a({accountType:e.type})))}}),d((()=>{if(!n.id)return;let e=ua.get(rm(n.id)),t=ua.get(am(n.id)),r=ua.get(im(n.id));e&&a("wallet"===e?{accountType:e,walletClientType:t,chainType:r}:{accountType:e})}),[n.id]),/*#__PURE__*/t(tm.Provider,{value:r,children:e})};let rm=e=>`privy:${e}:recent-login-method`,am=e=>`privy:${e}:recent-login-wallet-client`,im=e=>`privy:${e}:recent-login-chain-type`;const om=()=>l(tm),sm=()=>{let{app:e}=Is(),n=e?.appearance?.logo,r=`${e?.name} logo`,i={maxHeight:"90px",maxWidth:"180px"};return n?"string"==typeof n?/*#__PURE__*/t("img",{src:n,alt:r,style:i}):"svg"===n.type||"img"===n.type?/*#__PURE__*/a.cloneElement(n,{alt:r,style:i}):(console.warn("`config.appearance.logo` must be a string, or an SVG / IMG element. Nothing will be rendered."),null):null},lm=e=>{let{app:n}=Is();return n?.appearance.logo?/*#__PURE__*/t(cm,{...e,children:/*#__PURE__*/t(sm,{})}):null},cm=/*#__PURE__*/kn.div.withConfig({displayName:"AppLogoContainer",componentId:"sc-a206bd44-0"})(["display:flex;flex-direction:column;align-items:center;padding:24px 0;flex-grow:1;justify-content:center;"]),dm=({name:e,logoUrl:n,size:r="38px"})=>"string"==typeof n?/*#__PURE__*/t("img",{src:n,alt:`${e??"Provider app"} logo`,style:{width:r,height:r,maxHeight:"90px",maxWidth:"180px",borderRadius:"8px"}}):
|
|
21
|
+
/*#__PURE__*/t("span",{}),um=({appId:r})=>{let[a,i]=o(void 0),{startCrossAppAuthFlow:s,authenticated:l}=on(),{client:c}=Ft();return d((()=>{(async()=>{c&&i(await c.getCrossAppProviderDetails(r))})()}),[c]),/*#__PURE__*/t(ul,{onClick:()=>s({appId:r,action:l?"link":"login"}),disabled:!a,children:a?/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(dm,{name:a.name,logoUrl:a.icon_url||void 0,size:"24px"})," ",a.name]}):/*#__PURE__*/t(El,{})})};let pm=/*#__PURE__*/kn.a.withConfig({displayName:"StyledLink",componentId:"sc-c8577138-0"})(["&&{color:",";font-weight:400;text-decoration:",";text-underline-offset:4px;text-decoration-thickness:1px;cursor:",";opacity:",";font-size:",";line-height:",";transition:color 200ms ease,text-decoration-color 200ms ease,opacity 200ms ease;&:hover{color:",";text-decoration:",";text-underline-offset:4px;}&:active{color:",";}&:focus{outline:none;box-shadow:0 0 0 3px #949df9;border-radius:2px;}}"],(({$variant:e})=>"underlined"===e?"var(--privy-color-foreground)":"var(--privy-link-navigation-color, var(--privy-color-accent))"),(({$variant:e})=>"underlined"===e?"underline":"var(--privy-link-navigation-decoration, none)"),(({$disabled:e})=>e?"not-allowed":"pointer"),(({$disabled:e})=>e?.5:1),(({$size:e})=>{switch(e){case"xs":return"12px";case"sm":return"14px";default:return"16px"}}),(({$size:e})=>{switch(e){case"xs":return"18px";case"sm":return"22px";default:return"24px"}}),(({$variant:e,$disabled:t})=>"underlined"===e?"var(--privy-color-foreground)":"var(--privy-link-navigation-color, var(--privy-color-accent))"),(({$disabled:e})=>e?"none":"underline"),(({$variant:e,$disabled:t})=>t?"underlined"===e?"var(--privy-color-foreground)":"var(--privy-link-navigation-color, var(--privy-color-accent))":"var(--privy-color-foreground)"));const hm=({size:e="md",variant:n="navigation",disabled:r=!1,as:a,children:i,onClick:o,...s})=>/*#__PURE__*/t(pm,{as:a,$size:e,$variant:n,$disabled:r,onClick:e=>{r?e.preventDefault():o?.(e)},...s,children:i}),mm=(e,t)=>!cn(e)&&("all-users"===t||"users-without-wallets"===t&&!gm(e).length);let gm=e=>e.linkedAccounts.filter((e=>"wallet"===e.type&&"ethereum"===e.chainType));const ym=(e,t)=>!ln(e)&&("all-users"===t||"users-without-wallets"===t&&!fm(e).length);let fm=e=>e.linkedAccounts.filter((e=>"wallet"===e.type&&"solana"===e.chainType));const wm=(e,t)=>mm(e,t.ethereum.createOnLogin)||ym(e,t.solana.createOnLogin),vm=({title:e="Account not found",subtitle:n,appName:r="this app",ctaText:a="Try logging in again",onRetry:i})=>/*#__PURE__*/t(kc,{title:e,subtitle:n||`Please try logging in again or go to ${r} to create an account.`,icon:Zn,iconVariant:"warning",primaryCta:{label:a,onClick:i},watermark:!0}),Cm={component:()=>{let{navigate:e,app:n,setModalData:r,data:a}=Is(),{getAuthMeta:i,client:o}=Ft();/*#__PURE__*/return t(vm,{appName:n?.name,onRetry:()=>{let t=i();r({...a,login:{...a?.login,...t?.disableSignup?{disableSignup:!0}:{}}}),o?.authFlow&&(o.authFlow=void 0),e(hw)}})}},bm=/*#__PURE__*/kn.span.withConfig({displayName:"CircleBorder",componentId:"sc-9056b8b8-0"})(["&&{width:82px;height:82px;border-width:4px;border-style:solid;border-color:",";border-bottom-color:transparent;border-radius:50%;display:inline-block;box-sizing:border-box;animation:rotation 1.2s linear infinite;transition:border-color 800ms;border-bottom-color:",";}"],(e=>e.color??"var(--privy-color-accent)"),(e=>e.color??"var(--privy-color-accent)"));function km(n){/*#__PURE__*/return e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...n,children:[/*#__PURE__*/t("circle",{cx:"12",cy:"12",r:"10"}),/*#__PURE__*/t("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),/*#__PURE__*/t("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]})}let Am="0x0000000000000000000000000000000000000000";const Tm=({originCurrency:e,destinationCurrency:t,...n})=>({tradeType:"EXPECTED_OUTPUT",originCurrency:e??Am,destinationCurrency:t??Am,...n});let xm="https://api.relay.link",Im="https://api.testnets.relay.link";const Em=async({input:e,isTestnet:t})=>{let n=await fetch((t?Im:xm)+"/quote",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),r=await n.json();if(!(n.ok||"string"==typeof r.message&&r.message.startsWith("Invalid address")))throw console.error("Relay error:",r),Error(r.message??"Error fetching quote from relay");return r},Sm=e=>{let t=e.steps[0]?.items?.[0];if(t)return{from:t.data.from,to:t.data.to,value:Number(t.data.value),chainId:Number(t.data.chainId),data:t.data.data}};function _m({transactionHash:e,wallet:t,isTestnet:n,bridgingStatus:r,setBridgingStatus:a,onSuccess:i,onFailure:o}){d((()=>{if(e&&t&&r){if(["delayed","waiting","pending"].includes(r)){let t=setInterval((async()=>{try{let t=await async function({transactionHash:e,isTestnet:t}){let n=await fetch((t?Im:xm)+"/requests/v2?hash="+e),r=await n.json();if(!n.ok){if("message"in r&&"string"==typeof r.message)throw Error(r.message);throw Error("Error fetching request from relay")}return r.requests.at(0)?.status??"pending"}({transactionHash:e,isTestnet:n});a(t)}catch(e){console.error(e)}}),1e3);return()=>clearInterval(t)}"success"===r?i({transactionHash:e,wallet:t}):["refund","failure"].includes(r)&&o({error:new Nm(e,n)})}}),[r,e,n,t])}class Nm extends he{constructor(e,t){super("We were unable to complete the bridging transaction. Funds will be refunded on your wallet.",void 0,Te.TRANSACTION_FAILURE),this.relayLink=t?`https://testnets.relay.link/transaction/${e}`:`https://relay.link/transaction/${e}`}}const Mm=({error:r,allowlistConfig:a,onRetry:i,onCaptchaReset:o,onBack:s})=>{let l=((r,a)=>{if(r instanceof Nm)return{title:"Transaction failed",detail:/*#__PURE__*/e(n,{children:[/*#__PURE__*/t("span",{children:r.message}),/*#__PURE__*/e("span",{children:[" ","Check the"," ",/*#__PURE__*/t(Pm,{href:r.relayLink,target:"_blank",children:"refund status"}),"."]})]}),ctaText:"Try again",icon:Yn};if(r instanceof he)switch(r.privyErrorCode){case Te.CLIENT_REQUEST_TIMEOUT:return{title:"Timed out",detail:r.message,ctaText:"Try again",icon:Yn};case Te.INSUFFICIENT_BALANCE:return{title:"Insufficient balance",detail:r.message,ctaText:"Try again",icon:Yn};case Te.TRANSACTION_FAILURE:return{title:"Transaction failure",detail:r.message,ctaText:"Try again",icon:Yn};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:Yn}}else{if(r instanceof Ru&&"twilio_verification_failed"===r.type)return{title:"Something went wrong",detail:r.message,ctaText:"Try again",icon:Qn};if(!(r instanceof Re))return r instanceof Ze&&r.status&&[400,422].includes(r.status)?{title:"Something went wrong",detail:r.message,ctaText:"Try again",icon:Yn}:{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:Yn};switch(r.privyErrorCode){case Te.INVALID_CAPTCHA:return{title:"Something went wrong",detail:"Please try again.",ctaText:"Try again",icon:Yn};case Te.DISALLOWED_LOGIN_METHOD:return{title:"Not allowed",detail:r.message,ctaText:"Try another method",icon:Yn};case Te.ALLOWLIST_REJECTED:return{title:a.errorTitle||"You don't have access to this app",detail:a.errorDetail||"Have you been invited?",ctaText:a.errorCtaText||"Try another account",icon:Xn};case Te.CAPTCHA_FAILURE:return{title:"Something went wrong",detail:"You did not pass CAPTCHA. Please try again.",ctaText:"Try again",icon:null};case Te.CAPTCHA_TIMEOUT:return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:null};case Te.LINKED_TO_ANOTHER_USER:return{title:"Authentication failed",detail:"This account has already been linked to another user.",ctaText:"Try again",icon:Yn};case Te.NOT_SUPPORTED:return{title:"This region is not supported",detail:"SMS authentication from this region is not available",ctaText:"Try another method",icon:Yn};case Te.TOO_MANY_REQUESTS:return{title:"Request failed",detail:"Too many attempts.",ctaText:"Try again later",icon:Yn};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:Yn}}}})(r,a);/*#__PURE__*/return t(kc,{title:l.title,subtitle:l.detail,icon:l.icon,onBack:s,iconVariant:"error",primaryCta:{label:l.ctaText,onClick:()=>{r instanceof Re&&(r.privyErrorCode===Te.INVALID_CAPTCHA&&o?.(),r.privyErrorCode===Te.ALLOWLIST_REJECTED&&a.errorCtaLink)?window.location.href=a.errorCtaLink:i?.()},variant:"error"},watermark:!0})},Wm={component:()=>{let{navigate:e,data:n,lastScreen:r,currentScreen:a,app:i}=Is(),{reset:o}=Zi(),s=n?.errorModalData?.previousScreen||(r===a?void 0:r);/*#__PURE__*/return t(Mm,{error:n?.errorModalData?.error||Error(),allowlistConfig:i.allowlistConfig,onRetry:()=>{e(s||hw,!1)},onCaptchaReset:o})}};let Pm=/*#__PURE__*/kn.a.withConfig({displayName:"Link",componentId:"sc-89a5a605-0"})(["color:var(--privy-color-accent) !important;font-weight:600;"]);const Um=({onTransfer:e,isTransferring:n,transferSuccess:r})=>/*#__PURE__*/t(Ml,{...r?{success:!0,children:"Success!"}:{warn:!0,loading:n,onClick:e,children:"Transfer and delete account"}}),Fm=/*#__PURE__*/kn.div.withConfig({displayName:"ConnectContainer",componentId:"sc-3505eb4c-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;width:100%;padding-bottom:16px;"]),Om=/*#__PURE__*/kn.div.withConfig({displayName:"GappedContainer",componentId:"sc-3505eb4c-1"})(["display:flex;flex-direction:column;&& p{font-size:14px;}width:100%;gap:16px;"]),Lm=/*#__PURE__*/kn.div.withConfig({displayName:"DisclosedAccountContainer",componentId:"sc-3505eb4c-2"})(["display:flex;cursor:pointer;align-items:center;width:100%;border:1px solid var(--privy-color-foreground-4) !important;border-radius:var(--privy-border-radius-md);padding:8px 10px;font-size:14px;font-weight:500;gap:8px;"]),Rm=/*#__PURE__*/kn(Tr).withConfig({displayName:"StyledExclamationCircleIcon",componentId:"sc-3505eb4c-3"})(["position:relative;width:",";height:",";color:var(--privy-color-foreground-3);margin-left:auto;"],(({$iconSize:e})=>`${e}px`),(({$iconSize:e})=>`${e}px`)),Dm=/*#__PURE__*/kn(xr).withConfig({displayName:"StyledCopyIcon",componentId:"sc-3505eb4c-4"})(["position:relative;width:15px;height:15px;color:var(--privy-color-foreground-3);margin-left:auto;"]),Bm=/*#__PURE__*/kn.ol.withConfig({displayName:"ListContainer",componentId:"sc-3505eb4c-5"})(["display:flex;flex-direction:column;font-size:14px;width:100%;text-align:left;"]),zm=/*#__PURE__*/kn.li.withConfig({displayName:"ListItem",componentId:"sc-3505eb4c-6"})(["font-size:14px;list-style-type:auto;list-style-position:outside;margin-left:1rem;margin-bottom:0.5rem;&:last-child{margin-bottom:0;}"]),Hm=/*#__PURE__*/kn.div.withConfig({displayName:"CircleContainer",componentId:"sc-3505eb4c-7"})(["position:relative;width:60px;height:60px;margin:10px;display:flex;justify-content:center;align-items:center;"]);let Vm=()=>/*#__PURE__*/t(Hm,{children:/*#__PURE__*/t(Rm,{$iconSize:60})});const $m=({address:r,onClose:a,onRetry:i,onTransfer:o,isTransferring:s,transferSuccess:l})=>{let{defaultChain:c}=ks(),d=c.blockExplorers?.default.url??"https://etherscan.io";/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t($l,{onClose:a,backFn:i}),/*#__PURE__*/e(Fm,{children:[/*#__PURE__*/t(Vm,{}),/*#__PURE__*/e(Om,{children:[/*#__PURE__*/t("h3",{children:"Check account assets before transferring"}),/*#__PURE__*/t("p",{children:"Before transferring, ensure there are no assets in the other account. Assets in that account will not transfer automatically and may be lost."}),/*#__PURE__*/e(Bm,{children:[/*#__PURE__*/t("p",{children:" To check your balance, you can:"}),/*#__PURE__*/t(zm,{children:"Log out and log back into the other account, or "}),/*#__PURE__*/e(zm,{children:["Copy your wallet address and use a"," ",/*#__PURE__*/t("u",{children:/*#__PURE__*/t("a",{target:"_blank",href:d,children:"block explorer"})})," ","to see if the account holds any assets."]})]}),/*#__PURE__*/e(Lm,{onClick:()=>navigator.clipboard.writeText(r).catch(console.error),children:[/*#__PURE__*/t(Ar,{color:"var(--privy-color-foreground-1)",strokeWidth:2,height:"28px",width:"28px"}),/*#__PURE__*/t(pp,{address:r,showCopyIcon:!1}),/*#__PURE__*/t(Dm,{})]}),/*#__PURE__*/t(Um,{onTransfer:o,isTransferring:s,transferSuccess:l})]})]}),/*#__PURE__*/t(vl,{})]})},jm={component:()=>{let{initiateAccountTransfer:e,closePrivyModal:n}=Ft(),{data:r,navigate:a,lastScreen:i,setModalData:s}=Is(),[l,c]=o(void 0),[d,u]=o(!1),[p,h]=o(!1),m=async()=>{try{if(!r?.accountTransfer?.nonce||!r?.accountTransfer?.account)throw Error("missing account transfer inputs");h(!0),await e({nonce:r?.accountTransfer?.nonce,account:r?.accountTransfer?.account,accountType:r?.accountTransfer?.linkMethod,externalWalletMetadata:r?.accountTransfer?.externalWalletMetadata,telegramWebAppData:r?.accountTransfer?.telegramWebAppData,telegramAuthResult:r?.accountTransfer?.telegramAuthResult,farcasterEmbeddedAddress:r?.accountTransfer?.farcasterEmbeddedAddress,oAuthUserInfo:r?.accountTransfer?.oAuthUserInfo}),u(!0),h(!1),setTimeout(n,1e3)}catch(e){s({errorModalData:{error:e,previousScreen:i||jm}}),a(Wm,!0)}};return l?/*#__PURE__*/t($m,{address:l,onClose:n,onRetry:()=>c(void 0),onTransfer:m,isTransferring:p,transferSuccess:d}):/*#__PURE__*/t(qm,{onClose:n,onInfo:()=>c(r?.accountTransfer?.embeddedWalletAddress),onContinue:()=>c(r?.accountTransfer?.embeddedWalletAddress),onTransfer:m,isTransferring:p,transferSuccess:d,data:r})}},qm=({onClose:r,onContinue:a,onInfo:i,onTransfer:o,transferSuccess:s,isTransferring:l,data:c})=>{if(!c?.accountTransfer?.linkMethod||!c?.accountTransfer?.displayName)return;let d={method:c?.accountTransfer?.linkMethod,handle:c?.accountTransfer?.displayName,disclosedAccount:c?.accountTransfer?.embeddedWalletAddress?{type:"wallet",handle:c?.accountTransfer?.embeddedWalletAddress}:void 0};/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t($l,{closeable:!0}),/*#__PURE__*/e(Fm,{children:[/*#__PURE__*/t(xu,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(bm,{color:"var(--privy-color-error)"}),/*#__PURE__*/t(Fn,{height:38,width:38,stroke:"var(--privy-color-error)"})]})}),/*#__PURE__*/e(Om,{children:[/*#__PURE__*/e("h3",{children:[function(e){switch(e){case"sms":return"Phone number";case"email":return"Email address";case"siwe":return"Wallet address";case"siws":return"Solana wallet address";case"linkedin":return"LinkedIn profile";case"google":case"apple":case"discord":case"github":case"instagram":case"spotify":case"tiktok":case"line":case"twitter":case"telegram":case"farcaster":return`${ai(e.replace("_oauth",""))} profile`;default:return e.startsWith("privy:")?"Cross-app account":e}}(d.method)," is associated with another account"]}),/*#__PURE__*/e("p",{children:["Do you want to transfer",/*#__PURE__*/t("b",{children:d.handle?` ${d.handle}`:""})," to this account instead? This will delete your other account."]}),/*#__PURE__*/t(Km,{onClick:i,disclosedAccount:d.disclosedAccount})]}),/*#__PURE__*/e(Om,{style:{gap:12,marginTop:12},children:[c?.accountTransfer?.embeddedWalletAddress?/*#__PURE__*/t(Ml,{onClick:a,children:"Continue"}):/*#__PURE__*/t(Um,{onTransfer:o,transferSuccess:s,isTransferring:l}),/*#__PURE__*/t(Fl,{onClick:r,children:"No thanks"})]})]}),/*#__PURE__*/t(vl,{})]})};function Km({disclosedAccount:n,onClick:r}){return n?/*#__PURE__*/e(Lm,{onClick:r,children:[/*#__PURE__*/t(Ar,{color:"var(--privy-color-foreground-1)",strokeWidth:2,height:"28px",width:"28px"}),/*#__PURE__*/t(pp,{address:n.handle,showCopyIcon:!1}),/*#__PURE__*/t(km,{width:15,height:15,color:"var(--privy-color-foreground-3)",style:{marginLeft:"auto"}})]}):null}const Gm=({errorMessage:e,onClose:n})=>/*#__PURE__*/t(kc,e?{title:"Something went wrong",subtitle:e,icon:Jn,iconVariant:"error",primaryCta:{label:"Close",onClick:n},watermark:!0}:{title:"Creating your wallet",subtitle:"Please wait...",iconVariant:"loading",watermark:!1}),Zm={component:()=>{let{app:e,setModalData:n,navigate:r,data:a,onUserCloseViaDialogOrKeybindRef:i}=Is(),[s,l]=o(""),{embeddedWallets:c}=ks(),{authenticated:u,user:p}=on(),{closePrivyModal:h,walletProxy:m,client:g}=Ft(),{onSuccess:y,onFailure:f,callAuthOnSuccessOnClose:w,shouldCreateEth:v,shouldCreateSol:C}=a.createWallet,b="legacy-embedded-wallets-only"===e.embeddedWallets.mode&&!0===e?.embeddedWallets.requireUserOwnedRecoveryOnCreate,[k,A]=o(null),{create:T}=Xp(),x=v??(!!p&&mm(p,e.embeddedWallets.ethereum.createOnLogin)),I=C??(!!p&&ym(p,e.embeddedWallets.solana.createOnLogin)),E=new va((async()=>{let e=await g.getAccessToken();if(p&&e&&m)try{let e;if(x&&I)e=await T({chainType:"ethereum",walletIndex:0,latestUser:p}),e=await T({chainType:"solana",walletIndex:0,latestUser:e.user});else if(I)e=await T({chainType:"solana",walletIndex:0,latestUser:p});else{if(!x)return void h({shouldCallAuthOnSuccess:w});e=await T({chainType:"ethereum",walletIndex:0,latestUser:p})}A(e),r(eh)}catch(e){l(e.message)}}));return d((()=>u&&p?b?(n({...a,createWallet:{...a.createWallet,shouldCreateEth:x,shouldCreateSol:I},recoverySelection:{...a?.recoverySelection,isInAccountCreateFlow:!0,shouldCreateEth:x,shouldCreateSol:I}}),r(Ew({walletAction:"create",showAutomaticRecovery:!1,availableRecoveryMethods:c.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:!1,isResettingPassword:!1}))):void E.execute():(r(hw),void f(Error("User must be authenticated before creating a Privy wallet")))),[b,u]),i.current=()=>null/*#__PURE__*/,t(Gm,{errorMessage:s||void 0,onClose:()=>{k?(y(k),h({shouldCallAuthOnSuccess:w})):(f(new _t("User wallet creation failed")),h({shouldCallAuthOnSuccess:!1}))}})}},Ym={component:()=>{let{user:e,logout:n}=on(),{app:r,onUserCloseViaDialogOrKeybindRef:a,setModalData:i,navigate:o}=Is(),{acceptTerms:s,closePrivyModal:l,createAnalyticsEvent:c}=Ft(),d=e=>{e?.preventDefault(),l({shouldCallAuthOnSuccess:!1}),n()};a.current=d;/*#__PURE__*/return t(Qm,{termsAndConditionsUrl:r?.legal.termsAndConditionsUrl,privacyPolicyUrl:r?.legal.privacyPolicyUrl,onAccept:async t=>{t?.preventDefault(),await s(),e&&wm(e,r.embeddedWallets)?(i({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),c({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"AffirmativeConsentScreen"}}),n()},callAuthOnSuccessOnClose:!0}}),o(Zm)):l()},onDecline:d})}},Qm=({termsAndConditionsUrl:n,privacyPolicyUrl:r,onAccept:a,onDecline:i,title:o="One last step",subtitle:s="By signing up, you agree to our terms and privacy policy."})=>/*#__PURE__*/t(kc,{title:o,subtitle:s,icon:er,primaryCta:{label:"Accept",onClick:a},secondaryCta:{label:"No thanks",onClick:i},watermark:!0,children:(n||r)&&/*#__PURE__*/e(Xm,{children:[n&&/*#__PURE__*/e(_l,{variant:"muted",href:n,target:"_blank",size:"lg",style:{justifyContent:"space-between"},as:"a",children:["View Terms",/*#__PURE__*/t(tr,{width:16,height:16,strokeWidth:2.25})]}),r&&/*#__PURE__*/e(_l,{variant:"muted",href:r,target:"_blank",size:"lg",style:{justifyContent:"space-between"},as:"a",children:["View Privacy Policy",/*#__PURE__*/t(tr,{width:16,height:16,strokeWidth:2.25})]})]})});let Xm=/*#__PURE__*/kn.div.withConfig({displayName:"LinksContainer",componentId:"sc-b9d25a6d-0"})(["display:flex;flex-direction:column;gap:12px;margin-top:var(--screen-space);"]);const Jm=({color:e,...n})=>/*#__PURE__*/t("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 115.77 122.88",xmlSpace:"preserve",...n,children:/*#__PURE__*/t("g",{children:/*#__PURE__*/t("path",{fill:e||"currentColor",className:"st0",d:"M89.62,13.96v7.73h12.19h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02v0.02 v73.27v0.01h-0.02c-0.01,3.84-1.57,7.33-4.1,9.86c-2.51,2.5-5.98,4.06-9.82,4.07v0.02h-0.02h-61.7H40.1v-0.02 c-3.84-0.01-7.34-1.57-9.86-4.1c-2.5-2.51-4.06-5.98-4.07-9.82h-0.02v-0.02V92.51H13.96h-0.01v-0.02c-3.84-0.01-7.34-1.57-9.86-4.1 c-2.5-2.51-4.06-5.98-4.07-9.82H0v-0.02V13.96v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07V0h0.02h61.7 h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02V13.96L89.62,13.96z M79.04,21.69v-7.73v-0.02h0.02 c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v64.59v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h12.19V35.65 v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07v-0.02h0.02H79.04L79.04,21.69z M105.18,108.92V35.65v-0.02 h0.02c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v73.27v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h61.7h0.02 v0.02c0.91,0,1.75-0.39,2.37-1.01c0.61-0.61,1-1.46,1-2.37h-0.02V108.92L105.18,108.92z"})})});let eg=/*#__PURE__*/kn.button.withConfig({displayName:"CopyTextButton",componentId:"sc-4b0620dc-0"})(["display:flex;align-items:center;gap:0.5rem;&:hover{text-decoration:underline;}svg{width:0.875rem;height:0.875rem;}"]),tg=/*#__PURE__*/kn.span.withConfig({displayName:"CopiedText",componentId:"sc-4b0620dc-1"})(["display:flex;align-items:center;gap:0.25rem;font-size:0.875rem;color:var(--privy-color-foreground-2);"]),ng=/*#__PURE__*/kn(Mr).withConfig({displayName:"GreenCheck",componentId:"sc-4b0620dc-2"})(["color:var(--privy-color-success);"]),rg=/*#__PURE__*/kn(Jm).withConfig({displayName:"StyledCopy",componentId:"sc-4b0620dc-3"})(["color:var(--privy-color-foreground-3);opactiy:0.5;"]);function ag({children:n,iconOnly:r,value:a,hideCopyIcon:i,...s}){let[l,c]=o(!1);/*#__PURE__*/return e(eg,{...s,onClick:()=>{navigator.clipboard.writeText(a||n).catch(console.error),c(!0),setTimeout((()=>c(!1)),1500)},children:[n," ",l?/*#__PURE__*/e(tg,{children:[/*#__PURE__*/t(ng,{})," ",!r&&"Copied"]}):!i&&/*#__PURE__*/t(rg,{})]})}const ig=()=>/*#__PURE__*/t("svg",{width:"200",height:"200",viewBox:"-77 -77 200 200",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px"},children:/*#__PURE__*/t("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});let og=(e,t,n,r,a)=>{for(let i=t;i<t+r;i++)for(let t=n;t<n+a;t++){let n=e?.[t];n&&n[i]&&(n[i]=0)}return e},sg=({x:e,y:r,cellSize:a,bgColor:i,fgColor:o})=>
|
|
22
|
+
/*#__PURE__*/t(n,{children:[0,1,2].map((n=>/*#__PURE__*/t("circle",{r:a*(7-2*n)/2,cx:e+7*a/2,cy:r+7*a/2,fill:n%2!=0?i:o},`finder-${e}-${r}-${n}`)))}),lg=({cellSize:e,matrixSize:r,bgColor:a,fgColor:i})=>/*#__PURE__*/t(n,{children:[[0,0],[(r-7)*e,0],[0,(r-7)*e]].map((([n,r])=>/*#__PURE__*/t(sg,{x:n,y:r,cellSize:e,bgColor:a,fgColor:i},`finder-${n}-${r}`)))}),cg=({matrix:e,cellSize:r,color:i})=>/*#__PURE__*/t(n,{children:e.map(((e,n)=>e.map(((e,o)=>e?/*#__PURE__*/t("rect",{height:r-.4,width:r-.4,x:n*r+.1*r,y:o*r+.1*r,rx:.5*r,ry:.5*r,fill:i},`cell-${n}-${o}`):/*#__PURE__*/t(a.Fragment,{},`circle-${n}-${o}`)))))}),dg=({cellSize:r,matrixSize:a,element:i,sizePercentage:o,bgColor:s})=>{if(!i)/*#__PURE__*/return t(n,{});let l=a*(o||.14),c=Math.floor(a/2-l/2),d=Math.floor(a/2+l/2);(d-c)%2!=a%2&&(d+=1);let u=(d-c)*r,p=u-.2*u,h=c*r;/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t("rect",{x:c*r,y:c*r,width:u,height:u,fill:s}),/*#__PURE__*/t(i,{x:h+.1*u,y:h+.1*u,height:p,width:p})]})},ug=n=>{let r=n.outputSize,a=((e,t)=>{let n=Wr.create(e,{errorCorrectionLevel:t}).modules,r=((e,t)=>{let n=e.slice(0),r=[];for(;n.length;)r.push(n.splice(0,t));return r})(Array.from(n.data),n.size);return r=og(r,0,0,7,7),r=og(r,r.length-7,0,7,7),og(r,0,r.length-7,7,7)})(n.url,n.errorCorrectionLevel),i=r/a.length,o=function(e,{min:t,max:n}){return Math.min(Math.max(e,t),n)}(2*i,{min:.025*r,max:.036*r});/*#__PURE__*/return e("svg",{height:n.outputSize,width:n.outputSize,viewBox:`0 0 ${n.outputSize} ${n.outputSize}`,style:{height:"100%",width:"100%",padding:`${o}px`},children:[/*#__PURE__*/t(cg,{matrix:a,cellSize:i,color:n.fgColor}),/*#__PURE__*/t(lg,{cellSize:i,matrixSize:a.length,fgColor:n.fgColor,bgColor:n.bgColor}),/*#__PURE__*/t(dg,{cellSize:i,element:n.logo?.element,bgColor:n.bgColor,matrixSize:a.length})]})},pg=/*#__PURE__*/kn.div.attrs({className:"ph-no-capture"}).withConfig({displayName:"QrContainer",componentId:"sc-597e27f3-0"})(["display:flex;justify-content:center;align-items:center;height:",";width:",";margin:auto;background-color:",";&&{border-width:2px;border-color:",";border-radius:var(--privy-border-radius-md);}"],(e=>`${e.$size}px`),(e=>`${e.$size}px`),(e=>e.$bgColor),(e=>e.$borderColor));const hg=e=>{let{appearance:n}=ks(),r=e.bgColor||"#FFFFFF",a=e.fgColor||"#000000",i=e.size||160,o="dark"===n.palette.colorScheme?r:a;/*#__PURE__*/return t(pg,{$size:i,$bgColor:r,$fgColor:a,$borderColor:o,children:/*#__PURE__*/t(ug,{url:e.url,logo:{element:e.squareLogoElement??ig},outputSize:i,bgColor:r,fgColor:a,errorCorrectionLevel:e.errorCorrectionLevel||"Q"})})},mg=/*#__PURE__*/kn.span.withConfig({displayName:"ErrorMessage",componentId:"sc-fcb8cd50-0"})(["text-align:left;font-size:0.75rem;font-weight:500;line-height:1.125rem;color:var(--privy-color-error);"]);let gg=/*#__PURE__*/kn.label.withConfig({displayName:"BaseEmailForm",componentId:"sc-f34af797-0"})(["display:block;position:relative;width:100%;height:56px;&& > :first-child{position:absolute;left:0.75em;top:50%;transform:translate(0,-50%);}&& > input{font-size:16px;line-height:24px;color:var(--privy-color-foreground);padding:12px 88px 12px 52px;flex-grow:1;background:var(--privy-color-background);border:1px solid ",";border-radius:var(--privy-border-radius-md);width:100%;height:100%;@media (min-width:441px){font-size:14px;padding-right:78px;}:focus{outline:none;border-color:",";box-shadow:",";}:autofill,:-webkit-autofill{background:var(--privy-color-background);}&& > input::placeholder{color:var(--privy-color-foreground-3);}&:disabled{opacity:0.4;cursor:not-allowed;}&:disabled,&:disabled:hover,&:disabled > span{color:var(--privy-color-foreground-3);}}&& > button:last-child{right:0px;line-height:24px;padding:13px 17px;:focus{outline:none;}&:disabled{opacity:0.4;cursor:not-allowed;}&:disabled,&:disabled:hover,&:disabled > span{color:var(--privy-color-foreground-3);}}"],(({$error:e})=>e?"var(--privy-color-error) !important":"var(--privy-color-foreground-4)"),(({$error:e})=>e?"var(--privy-color-error) !important":"var(--privy-color-accent-light)"),(({$error:e})=>e?"none":"0 0 0 1px var(--privy-color-accent-light)"));const yg=/*#__PURE__*/kn(gg).withConfig({displayName:"EmailUpdateForm",componentId:"sc-f34af797-1"})(["background-color:var(--privy-color-background);transition:background-color 200ms ease;&& > button{right:0;line-height:24px;position:absolute;padding:13px 17px;background-color:#090;:focus{outline:none;border-color:var(--privy-color-accent);}}"]),fg=/*#__PURE__*/kn(gg).withConfig({displayName:"EmailInputForm",componentId:"sc-f34af797-2"})(["&& > input{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding-right:",";border:1px solid ",";&& > input::placeholder{color:var(--privy-color-foreground-3);}}&& > :last-child{right:16px;position:absolute;top:50%;transform:translate(0,-50%);}&& > button:last-child{right:0px;line-height:24px;padding:13px 17px;:focus{outline:none;}}"],(e=>e.$stacked?"16px":"88px"),(({$error:e})=>e?"var(--privy-color-error) !important":"var(--privy-color-foreground-4)")),wg=/*#__PURE__*/kn.div.withConfig({displayName:"InputContainerForm",componentId:"sc-f34af797-3"})(["width:100%;&& > ","{display:block;text-align:left;padding-left:var(--privy-border-radius-md);padding-bottom:5px;}"],mg),vg=({...n})=>/*#__PURE__*/e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...n,children:[/*#__PURE__*/t("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),/*#__PURE__*/t("path",{d:"M3 9a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2"}),/*#__PURE__*/t("path",{d:"M3 11h3c.8 0 1.6.3 2.1.9l1.1.9c1.6 1.6 4.1 1.6 5.7 0l1.1-.9c.5-.5 1.3-.9 2.1-.9H21"})]}),Cg={phantom:{mobile:{native:"phantom://",universal:"https://phantom.app/ul/"}},solflare:{mobile:{native:void 0,universal:"https://solflare.com/ul/v1/"}},metamask:{image_url:{sm:Po,md:Po}}};class bg{static normalize(e){return e.replace(/[-_]wallet$/,"").replace(/[-_]extension$/,"").toLowerCase()}isEth(e){return e.chains.some((e=>e.startsWith("eip155:")))}isSol(e){return e.chains.some((e=>e.startsWith("solana:")))}inAllowList(e,t){if(!this.normalizedAllowList||0===this.normalizedAllowList.length||"listing"===t&&this.includeWalletConnect)return!0;let n=bg.normalize(e);return this.normalizedAllowList.some((e=>n===bg.normalize(e)))}chainMatches(e){return"ethereum-only"===this.chainFilter?"ethereum"===e:"solana-only"!==this.chainFilter||"solana"===e}connectorOk(e){return!!("null"!==e.connectorType&&this.chainMatches(e.chainType)&&(this.inAllowList(e.walletClientType,"connector")||("injected"===e.connectorType||"solana_adapter"===e.connectorType)&&(this.detectedGeneric||"ethereum"===e.chainType&&this.detectedEth||"solana"===e.chainType&&this.detectedSol)))}listingOk(e){if(e.slug.includes("coinbase"))return!1;if("ethereum-only"===this.chainFilter){if(!this.isEth(e))return!1}else if("solana-only"===this.chainFilter&&!this.isSol(e))return!1;return!!this.inAllowList(e.slug,"listing")}getWallets(e,t){let n=new Map,r=e=>{let t=n.get(e.id);if(t){t.chainType!==e.chainType&&(t.chainType="multi");let n=new Set(t.chains);e.chains.forEach((e=>n.add(e))),t.chains=Array.from(n),!t.icon&&e.icon&&(t.icon=e.icon),!t.url&&e.url&&(t.url=e.url),!t.listing&&e.listing&&(t.listing=e.listing)}else n.set(e.id,e)};e.filter((e=>this.connectorOk(e))).forEach((e=>{let t=bg.normalize(e.walletClientType);r({id:t,label:e.walletBranding?.name??t,source:"connector",connector:e,chainType:e.chainType,icon:e.walletBranding?.icon,url:void 0,chains:["ethereum"===e.chainType?"eip155":"solana"]})})),t.filter((e=>this.listingOk(e))).forEach((e=>{let t=this.isEth(e),n=this.isSol(e),a=bg.normalize(e.slug),i=Cg[e.slug],o=i?.image_url?.sm||e.image_url?.sm;r({id:a,label:e.name||a,source:"listing",listing:e,chainType:t&&n?"multi":t?"ethereum":"solana",icon:o,url:e.homepage,chains:e.chains})}));let a=e.find((e=>"wallet_connect_v2"===e.connectorType));this.includeWalletConnectQr&&a&&r({id:"wallet_connect_qr",label:"WalletConnect",source:"connector",connector:a,chainType:"ethereum",icon:Ss,url:void 0,chains:["ethereum"===a.chainType?"eip155":"solana"]});let i=Array.from(n.values());i.forEach((e=>{let t=Cg[e.listing?.slug||e.id];t?.image_url?.sm&&(e.icon=t.image_url.sm)}));let o=new Map;return this.normalizedAllowList?.forEach(((e,t)=>{o.set(bg.normalize(e),t)})),{wallets:i.slice().sort(((e,t)=>{let n=bg.normalize(e.id),r=bg.normalize(t.id);"binance-defi"===n?n="binance":"universalprofiles"===n?n="universal_profile":"cryptocom-defi"===n&&(n="cryptocom"),"binance-defi"===r?r="binance":"universalprofiles"===r?r="universal_profile":"cryptocom-defi"===r&&(r="cryptocom");let a=o.has(n),i=o.has(r);return a&&i?o.get(n)-o.get(r):a?-1:i?1:"connector"===e.source&&"listing"===t.source?-1:"listing"===e.source&&"connector"===t.source?1:e.label.toLowerCase().localeCompare(t.label.toLowerCase())})),walletCount:i.length}}constructor(e,t){this.chainFilter=e,t&&t.length>0&&(this.normalizedAllowList=t.map(String),this.normalizedAllowList.includes("binance")&&this.normalizedAllowList.push("binance-defi-wallet")),this.detectedGeneric=this.normalizedAllowList?.includes("detected_wallets")??!1,this.detectedEth=this.normalizedAllowList?.includes("detected_ethereum_wallets")??!1,this.detectedSol=this.normalizedAllowList?.includes("detected_solana_wallets")??!1,this.includeWalletConnect=this.normalizedAllowList?.includes("wallet_connect")??!1,this.includeWalletConnectQr=this.normalizedAllowList?.includes("wallet_connect_qr")??!1}}var kg=n=>/*#__PURE__*/e("svg",{viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg",...n,children:[/*#__PURE__*/t("path",{d:"m0 0h32v32h-32z",fill:"#5469d4"}),/*#__PURE__*/t("path",{d:"m15.997 5.333-.143.486v14.106l.143.143 6.548-3.87z",fill:"#c2ccf4"}),/*#__PURE__*/t("path",{d:"m15.996 5.333-6.548 10.865 6.548 3.87z",fill:"#fff"}),/*#__PURE__*/t("path",{d:"m15.997 21.306-.08.098v5.025l.08.236 6.552-9.227z",fill:"#c2ccf4"}),/*#__PURE__*/t("path",{d:"m15.996 26.665v-5.36l-6.548-3.867z",fill:"#fff"}),/*#__PURE__*/t("path",{d:"m15.995 20.07 6.548-3.87-6.548-2.976v6.847z",fill:"#8698e8"}),/*#__PURE__*/t("path",{d:"m9.448 16.2 6.548 3.87v-6.846z",fill:"#c2ccf4"})]}),Ag=n=>/*#__PURE__*/e("svg",{viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg",...n,children:[/*#__PURE__*/e("linearGradient",{id:"a",gradientUnits:"userSpaceOnUse",x1:"7.233",x2:"24.766",y1:"24.766",y2:"7.234",children:[/*#__PURE__*/t("stop",{offset:"0",stopColor:"#9945ff"}),/*#__PURE__*/t("stop",{offset:".2",stopColor:"#7962e7"}),/*#__PURE__*/t("stop",{offset:"1",stopColor:"#00d18c"})]}),/*#__PURE__*/t("path",{d:"m0 0h32v32h-32z",fill:"#10111a"}),/*#__PURE__*/t("path",{clipRule:"evenodd",d:"m9.873 20.41a.645.645 0 0 1 .476-.21l14.662.012a.323.323 0 0 1 .238.54l-3.123 3.438a.643.643 0 0 1 -.475.21l-14.662-.012a.323.323 0 0 1 -.238-.54zm15.376-2.862a.322.322 0 0 1 -.238.54l-14.662.012a.642.642 0 0 1 -.476-.21l-3.122-3.44a.323.323 0 0 1 .238-.54l14.662-.012a.644.644 0 0 1 .475.21zm-15.376-9.738a.644.644 0 0 1 .476-.21l14.662.012a.322.322 0 0 1 .238.54l-3.123 3.438a.643.643 0 0 1 -.475.21l-14.662-.012a.323.323 0 0 1 -.238-.54z",fill:"url(#a)",fillRule:"evenodd"})]});const Tg=/*#__PURE__*/kn.div.withConfig({displayName:"Header",componentId:"sc-9b65f2b6-0"})(["display:flex;justify-content:space-between;align-items:center;"]),xg=/*#__PURE__*/kn.button.withConfig({displayName:"CloseButton",componentId:"sc-9b65f2b6-1"})(["padding:0.25rem;height:30px;width:30px;display:flex;align-items:center;justify-content:center;border-radius:var(--privy-border-radius-full);background:var(--privy-color-background-2);"]),Ig=/*#__PURE__*/kn.div.withConfig({displayName:"WalletIconWithActiveIndicator",componentId:"sc-9b65f2b6-2"})(["position:relative;display:inline-flex;align-items:center;&::after{content:' ';border-radius:var(--privy-border-radius-full);height:6px;width:6px;background-color:var(--privy-color-icon-success);position:absolute;right:-3px;top:-3px;}"]),Eg=/*#__PURE__*/kn.img.withConfig({displayName:"WalletIcon",componentId:"sc-9b65f2b6-3"})(["width:32px;height:32px;border-radius:0.25rem;object-fit:contain;"]),Sg=/*#__PURE__*/kn.span.withConfig({displayName:"Chip",componentId:"sc-9b65f2b6-4"})(["display:flex;gap:0.25rem;align-items:center;padding:0.25rem 0.5rem;font-size:0.75rem;font-weight:500;line-height:1.125rem;border-radius:var(--privy-border-radius-sm);background-color:var(--privy-color-background-2);svg{width:100%;max-width:1rem;max-height:1rem;stroke-width:2;}"]),_g=/*#__PURE__*/kn.div.withConfig({displayName:"ScrollContainer",componentId:"sc-9b65f2b6-5"})(["display:flex;flex-direction:column;gap:0.5rem;max-height:24rem;overflow-y:scroll;&::-webkit-scrollbar{display:none;}scrollbar-gutter:stable both-edges;scrollbar-width:none;-ms-overflow-style:none;"," background-repeat:no-repeat;background-size:100% 32px,100% 16px;background-attachment:local,scroll;"],(e=>"light"===e.$colorScheme?"background: linear-gradient(var(--privy-color-background), var(--privy-color-background) 70%) bottom, linear-gradient(rgba(0, 0, 0, 0) 20%, rgba(0, 0, 0, 0.06)) bottom;":"dark"===e.$colorScheme?"background: linear-gradient(var(--privy-color-background), var(--privy-color-background) 70%) bottom, linear-gradient(rgba(255, 255, 255, 0) 20%, rgba(255, 255, 255, 0.06)) bottom;":void 0)),Ng=Ln((()=>({isModalOpen:!1,resolvers:null})));let Mg=Ln((()=>({})));const Wg=(e,t)=>Mg((n=>n[e]?.[t])),Pg=(e,t,n)=>{Mg.setState((r=>({[e]:{...r[e],[t]:n}})))},Ug=async()=>{let e,t,n=new Promise(((n,r)=>{e=n,t=r}));return Mg.setState({}),Ng.setState({isModalOpen:!0,resolvers:{resolve:e,reject:t}}),await n},Fg=()=>{let e=Ng.getState().resolvers;e||console.warn("useActiveWalletStore: Called close while modal was not open"),Ng.setState({isModalOpen:!1}),e?.resolve({wallet:Ng.getState().wallet})},Og=({address:e,client:t,appId:n})=>{let r=`${t}:${e}`;n&&ua.put(Rg(n),r),Ng.setState({wallet:r})},Lg=()=>Ng((e=>e.isModalOpen)),Rg=e=>`privy:${e}:active-wallet-connection`;function Dg({walletList:e,walletChainType:t}){let n=ks(),{connectors:r}=Ft(),a=Xo((e=>e.listings)),i=t??n.appearance.walletChainType,l=e??n.appearance?.walletList,c=s((()=>new bg(i,l)),[i,l]),{wallets:d,walletCount:u}=s((()=>c.getWallets(r,a)),[c,r,a]),[p,h]=o(""),m=s((()=>p?d.filter((e=>e.label.toLowerCase().includes(p.toLowerCase()))):d),[p,d]),[g,y]=o();return{selected:g,setSelected:y,search:p,setSearch:h,wallets:m,walletCount:u}}let Bg=e=>!e||"string"!=typeof e&&(e instanceof Mo||e instanceof Zo);const zg=({index:r,style:a,data:i,recent:o})=>{let s=i.wallets[r],{walletChainType:l,handleWalletClick:c}=i,d={...a,boxSizing:"border-box"};return s?/*#__PURE__*/e(jg,{style:d,onClick:()=>c(s),children:[s.icon&&(s.connector&&!Bg(s.connector)?/*#__PURE__*/t(Ig,{children:"string"==typeof s.icon?/*#__PURE__*/t(Eg,{src:s.icon}):/*#__PURE__*/t(s.icon,{style:{width:"32px",height:"32px"}})}):"string"==typeof s.icon?/*#__PURE__*/t(Eg,{src:s.icon}):/*#__PURE__*/t(s.icon,{style:{width:"32px",height:"32px"}})),/*#__PURE__*/t(Gg,{children:s.label}),o?/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Sg,{children:"Last used"}),/*#__PURE__*/t(qg,{children:/*#__PURE__*/e(n,{children:["ethereum-only"===l&&/*#__PURE__*/t(kg,{}),"solana-only"===l&&/*#__PURE__*/t(Ag,{})]})})]}):/*#__PURE__*/t(qg,{children:!("ethereum-only"===l||"solana-only"===l)&&/*#__PURE__*/e(n,{children:[s.chains?.some((e=>e.startsWith("eip155")))&&/*#__PURE__*/t(kg,{}),s.chains?.some((e=>e.startsWith("solana")))&&/*#__PURE__*/t(Ag,{})]})})]}):null};var Hg=({className:r,suggestedAddress:a,customDescription:l,connectOnly:c,preSelectedWalletId:p,...h})=>{let m=ks(),{connectors:y}=Ft(),f=h.walletChainType||m.appearance.walletChainType,w=h.walletList||m.appearance?.walletList,{onBack:v,onClose:C,app:b}=h,{selected:k,setSelected:A,qrUrl:T,setQrUrl:x,connecting:I,uiState:E,wallets:S,walletCount:_,handleConnect:N,handleBack:M,showSearchBar:W,isInitialConnectView:P,title:U,search:F,setSearch:O}=function({onConnect:e,onBack:t,onClose:n,onConnectError:r,walletList:a,walletChainType:i,app:l}){let c=ks(),{connectors:d}=Ft(),{wallets:p,walletCount:h,search:m,setSearch:y,selected:f,setSelected:w}=Dg({walletList:a,walletChainType:i}),[v,C]=o(),[b,k]=o(),[A,T]=o(),x=!f&&!b&&!A,I=x&&(h>6||m.length>0),E=d.find((e=>"wallet_connect_v2"===e.connectorType)),S=u((async(t,n)=>{if(t){if(A?.connector===t)return void console.log("Already connecting to this wallet, skipping duplicate attempt");if(C("loading"),"string"==typeof t)return T({connector:t,name:n?.name??"Wallet",icon:n?.icon}),void window.open(t,"_blank");T({connector:t,name:n?.name??t.walletBranding.name??"Wallet",icon:n?.icon??t.walletBranding.icon});try{let n=await t.connect({showPrompt:!0});if(!n)return C("error"),void r?.(new Le("Unable to connect wallet"));C("success"),Og({address:n.address,client:n.walletClientType,appId:c.id}),setTimeout((()=>{e({connector:t,wallet:n})}),ka)}catch(t){if(console.error("ERROR: ",{e:t}),t?.message?.includes("already pending for origin")||t?.message?.includes("wallet_requestPermissions"))return void console.log("Connection request already pending, maintaining loading state");C("error"),r?.(new Le("Unable to connect wallet"))}}}),[c.id,e,A]),_=u((()=>b?(C(void 0),T(void 0),void k(void 0)):A?(C(void 0),void T(void 0)):f?(C(void 0),T(void 0),void w(void 0)):"error"===v||"loading"===v?(C(void 0),void T(void 0)):void t?.()),[b,A,f,v,t]),N=s((()=>A?.connector===E&&b&&g?`Go to ${A.name} to continue`:A?.connector===E&&b?`Scan code to connect to ${A.name}`:"string"==typeof A?.connector?`Open or install ${A.name}`:f&&!A?"Select network":A?null:"Select your wallet"),[A,b,f,E]);return{selected:f,setSelected:w,qrUrl:b,setQrUrl:k,connecting:A,uiState:v,search:m,setSearch:y,wallets:p,walletCount:h,wc:E,isInitialConnectView:x,showSearchBar:I,title:N,handleConnect:S,handleBack:_,onClose:n,onConnect:e,app:l}}({...h,walletList:w,walletChainType:f}),L=y.find((e=>"wallet_connect_v2"===e.connectorType)),R=i(null),D=Nr({count:S.length,getScrollElement:()=>R.current,estimateSize:()=>56,overscan:6,gap:5}),B=u((async e=>{let t,n="solana-only"!==f&&e.chains?.some((e=>e.startsWith("eip155"))),r="ethereum-only"!==f&&e.chains?.some((e=>e.startsWith("solana"))),a=Ho[e.id];if(r&&a)t=a.getMobileRedirect({isSolana:!0,connectOnly:!!c,useUniversalLink:!1});else{let n=e.listing?.mobile?.native;t=e.listing?.mobile?.universal||n||e.url}if(n&&r){let n=bg.normalize(e.id),r=y.filter((e=>bg.normalize(e.walletClientType)===n&&!("ethereum"===e.chainType&&e instanceof Mo||"solana"===e.chainType&&e instanceof Zo))),a=r.find((e=>"ethereum"===e.chainType)),i=r.find((e=>"solana"===e.chainType));if(!a&&e.listing){let t=Cg[e.listing.slug]?{...e.listing,...Cg[e.listing.slug]}:e.listing;L.setWalletEntry(t,x),await L.resetConnection(e.id),a=L}if(!i&&t&&(i=t),a||i)return void A({eth:a,sol:i,name:e.label,icon:e.icon})}if(!Bg(e.connector))return"wallet_connect_v2"===e.connector?.connectorType&&(await L.resetConnection(e.id),L.setWalletEntry({id:"wallet_connect_qr",name:"WalletConnect",rdns:"",slug:"wallet-connect",homepage:"",chains:["eip155"],mobile:{native:"",universal:void 0}},x)),void await N(e.connector,{name:e.label,icon:e.icon});if(n||r||e.url||e.listing){if(n&&e.listing){let t=Cg[e.listing.slug]?{...e.listing,...Cg[e.listing.slug]}:e.listing;L.setWalletEntry(t,x),await L.resetConnection(e.id)}if(n&&r)return void A({eth:L,sol:t,name:e.label,icon:e.icon});if(r)return void await N(t,{name:e.label,icon:e.icon});if(n)return void(e.listing?await N(L,{name:e.label,icon:e.icon}):e.url?await N(e.url,{name:e.label,icon:e.icon}):console.warn("Cannot connect to EVM wallet without connector or listing details:",e.label));if(e.url)return void await N(e.url,{name:e.label,icon:e.icon})}}),[L,N,A,x,M,C,b,P,U,l,a,m,y]),z=v||M,H=!!v||!P;return d((()=>{if(!p)return;let e=S.find((({id:e})=>e===p));e&&B(e).catch(console.error)}),[p]),/*#__PURE__*/e(gc,{className:r,children:[/*#__PURE__*/t(gc.Header,{icon:I&&!T||T&&g&&I?.icon?I.icon:I?void 0:vg,iconVariant:I&&!T||T&&g?"loading":void 0,iconLoadingStatus:I&&!T||T&&g?{success:"success"===E,fail:"error"===E}:void 0,title:I&&!T?`Waiting for ${I.name}`:T&&g?`Waiting for ${I?.name??"connection"}`:U,subtitle:I&&!T&&"string"==typeof I.connector?`To connect to ${I.name}, install and open the app. Then confirm the connection when prompted.`:I&&!T&&"string"!=typeof I.connector?"error"===E?"Please try connecting again.":"For the best experience, connect only one wallet at a time.":P?l??(a?/*#__PURE__*/e("span",{children:["Connect the wallet with address ",/*#__PURE__*/t(pp,{address:a})," ",b?.name?`to ${b.name}.`:"."]}):b?`Connect a wallet to your ${b.name} account`:null):null,showBack:H,showClose:!0,onBack:z,onClose:C}),/*#__PURE__*/e(gc.Body,{ref:R,$colorScheme:m.appearance.palette.colorScheme,style:{marginBottom:T?"0.5rem":void 0},children:[W&&/*#__PURE__*/t(Vg,{children:/*#__PURE__*/e(yg,{style:{background:"transparent"},children:[/*#__PURE__*/t(pl,{children:/*#__PURE__*/t(Ir,{})}),/*#__PURE__*/t("input",{className:"login-method-button",type:"text",placeholder:"Search wallets",onChange:e=>O(e.target.value),value:F})]})}),T&&g&&"loading"===E&&/*#__PURE__*/t("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"1rem"},children:/*#__PURE__*/t(_l,{variant:"primary",onClick:()=>window.open(T.universal??T.native,"_blank"),style:{width:"100%"},children:"Open in app"})}),T&&!g&&"loading"===E&&/*#__PURE__*/t("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"1rem"},children:/*#__PURE__*/t(Zg,{value:T.universal??T.native,iconOnly:!0,children:"Copy link"})}),T&&!g&&/*#__PURE__*/t(hg,{size:280,url:T.universal??T.native,squareLogoElement:I?.icon?"string"==typeof I.icon?e=>/*#__PURE__*/t("svg",{...e,children:/*#__PURE__*/t("image",{href:I.icon,height:e.height,width:e.width})}):I.icon:Es}),/*#__PURE__*/e($g,{children:[I&&!T&&"string"==typeof I.connector&&/*#__PURE__*/e(jg,{onClick:()=>window.open(I.connector,"_blank"),children:[I.icon&&("string"==typeof I.icon?/*#__PURE__*/t(Eg,{src:I.icon}):/*#__PURE__*/t(I.icon,{})),/*#__PURE__*/t(Gg,{children:I.name})]}),k?.eth&&!I&&/*#__PURE__*/e(jg,{onClick:()=>N(k.eth,{name:k.name,icon:k.icon}),children:[k.icon&&("string"==typeof k.icon?/*#__PURE__*/t(Eg,{src:k.icon}):/*#__PURE__*/t(k.icon,{})),/*#__PURE__*/t(Gg,{children:k.name}),/*#__PURE__*/t(qg,{children:/*#__PURE__*/t(kg,{})})]}),k?.sol&&!I&&/*#__PURE__*/e(jg,{onClick:()=>N(k.sol,{name:k.name,icon:k.icon}),children:[k.icon&&("string"==typeof k.icon?/*#__PURE__*/t(Eg,{src:k.icon}):/*#__PURE__*/t(k.icon,{})),/*#__PURE__*/t(Gg,{children:k.name}),/*#__PURE__*/t(qg,{children:/*#__PURE__*/t(Ag,{})})]}),P&&/*#__PURE__*/e(n,{children:[!(_>0)&&/*#__PURE__*/t(Kg,{children:"No wallets found. Try another search."}),_>0&&!T&&/*#__PURE__*/t("div",{style:{maxHeight:56*Math.min(S.length,5)+5,width:"100%"},children:/*#__PURE__*/t("div",{style:{height:`${D.getTotalSize()}px`,width:"100%",position:"relative"},children:D.getVirtualItems().map((e=>/*#__PURE__*/t(zg,{index:e.index,style:{position:"absolute",top:0,left:0,height:`${e.size}px`,transform:`translateY(${e.start}px)`},data:{wallets:S,walletChainType:f,handleWalletClick:B}},e.key)))})})]})]})]}),/*#__PURE__*/e(gc.Footer,{children:[I&&!T&&"string"!=typeof I.connector&&"error"===E&&/*#__PURE__*/t(gc.Actions,{children:/*#__PURE__*/t(_l,{style:{width:"100%",alignItems:"center"},variant:"error",onClick:()=>N(I.connector,{name:I.name,icon:I.icon}),children:"Retry"})}),!!(b&&b.legal.privacyPolicyUrl&&b.legal.termsAndConditionsUrl)&&/*#__PURE__*/t(wl,{app:b,alwaysShowImplicitConsent:!0}),/*#__PURE__*/t(gc.Watermark,{})]})]})};let Vg=/*#__PURE__*/kn.div.withConfig({displayName:"StickySearchContainer",componentId:"sc-ee081e08-0"})(["position:sticky;margin-top:-3px;padding-top:3px;top:-3px;z-index:1;background:var(--privy-color-background);padding-bottom:calc(var(--screen-space) / 2);"]),$g=/*#__PURE__*/kn.div.withConfig({displayName:"WalletListContainer",componentId:"sc-ee081e08-1"})(["display:flex;flex-direction:column;gap:","px;"],5),jg=/*#__PURE__*/kn.button.withConfig({displayName:"Button",componentId:"sc-ee081e08-2"})(["button&{gap:0.5rem;align-items:center;display:flex;position:relative;text-align:left;font-weight:500;transition:background 200ms ease-in;width:calc(100% - 4px);border-radius:var(--privy-border-radius-md);padding:0.75em;border:1px solid var(--privy-color-foreground-4);justify-content:space-between;}&:hover{background:var(--privy-color-background-2);}"]),qg=/*#__PURE__*/kn.span.withConfig({displayName:"ButtonBadge",componentId:"sc-ee081e08-3"})(["display:flex;align-items:center;justify-content:end;position:relative;& > svg{border-radius:var(--privy-border-radius-full);stroke-width:2.5;width:100%;max-height:1rem;max-width:1rem;flex-shrink:0;}& > svg:not(:last-child){border-radius:var(--privy-border-radius-full);margin-right:-0.375rem;}"]),Kg=/*#__PURE__*/kn.div.withConfig({displayName:"EmptyContainer",componentId:"sc-ee081e08-4"})(["height:60px;display:flex;align-items:center;justify-content:center;text-align:center;"]),Gg=/*#__PURE__*/kn.span.withConfig({displayName:"WalletName",componentId:"sc-ee081e08-5"})(["text-overflow:ellipsis;white-space:nowrap;color:var(--privy-color-foreground);font-weight:400;flex:1;"]),Zg=/*#__PURE__*/kn(ag).withConfig({displayName:"StyledCopyableText",componentId:"sc-ee081e08-6"})(["&&{margin:0.5rem auto 0 auto;}"]);const Yg=({...n})=>/*#__PURE__*/e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...n,children:[/*#__PURE__*/e("g",{clipPath:"url(#clip0_2856_1743)",children:[/*#__PURE__*/t("path",{d:"M22.1673 8.24075V16.3642C22.1673 17.3256 21.3421 18.105 20.3241 18.105H17.0028M22.1673 8.24075C22.1673 7.27936 21.3421 6.5 20.3241 6.5H11.5302M22.1673 8.24075V8.42852C22.1673 9.03302 21.8352 9.59423 21.2901 9.91105L15.1463 13.4818C14.5539 13.8261 13.8067 13.8261 13.2143 13.4818L10.1621 11.5401",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),/*#__PURE__*/t("path",{d:"M3.12913 6.64816C0.508085 12.9507 3.49251 20.1847 9.79504 22.8057L11.5068 23.5176C12.4522 23.9108 13.7783 23.2222 14.1714 22.2768L14.6054 21.2333C14.7687 20.8406 14.6438 20.3871 14.3024 20.1334L11.2872 17.8927C10.9878 17.6702 10.5843 17.6488 10.2632 17.8384L9.11575 18.5156C8.78274 18.7121 8.3597 18.6844 8.07552 18.4221C5.94293 16.4542 4.77629 13.6264 4.90096 10.7273C4.91757 10.3409 5.19796 10.023 5.57269 9.92753L6.86381 9.59869C7.22522 9.50664 7.49627 9.20696 7.55169 8.83815L8.10986 5.12321C8.17306 4.70259 7.94188 4.29293 7.54915 4.1296L6.50564 3.69564C5.56026 3.30248 4.23416 3.99103 3.84101 4.9364L3.12913 6.64816Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),/*#__PURE__*/t("defs",{children:/*#__PURE__*/t("clipPath",{id:"clip0_2856_1743",children:/*#__PURE__*/t("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]}),Qg=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses")?.split(" ").filter((e=>Ht(e,{strict:!0}))).map((e=>Vt(e)));return!!t?.length&&!!e?.linkedAccounts.filter((e=>"wallet"==e.type&&t.includes(e.address))).length};let Xg=/*#__PURE__*/c({plugins:{current:{}}});const Jg=({children:e})=>{let n=i({});/*#__PURE__*/return t(Xg.Provider,{value:{plugins:n},children:e})},ey=(...e)=>{let{plugins:t}=l(Xg);d((()=>{for(let n of e)t.current[n.id]=n;return()=>{for(let n of e)delete t.current[n.id]}}),[t])},ty=()=>{let{plugins:e}=l(Xg);return u((t=>e.current[t]),[e])},ny=Symbol("solana-ledger-plugin"),ry=({title:e="You don't have access to this app",subtitle:n="Have you been invited?",ctaText:r="Try another account",ctaLink:a,onCtaClick:i})=>/*#__PURE__*/t(kc,{title:e,subtitle:n,icon:Xn,iconVariant:"warning",primaryCta:{label:r,onClick:()=>{a?window.open(a,"_blank"):i?.()}},watermark:!0}),ay={component:()=>{let{navigate:e,app:n}=Is(),r=n?.allowlistConfig.errorTitle||"You don't have access to this app",a=n?.allowlistConfig.errorDetail||"Have you been invited?",i=n?.allowlistConfig.errorCtaText||"Try another account",o=n?.allowlistConfig.errorCtaLink;/*#__PURE__*/return t(ry,{title:r,subtitle:a,ctaText:i,ctaLink:o??void 0,onCtaClick:()=>{e(hw)}})}},iy=({status:e,title:n,description:r,userIntentRequired:a,retriesRemaining:i,hasSelectedCta:o,onContinue:l,onRetry:c})=>{let d=s((()=>{switch(e){case"loading":default:return;case"success":return a?{label:o?"Continuing...":"Continue",onClick:l,disabled:o,loading:o}:void 0;case"error":return i>0?{label:"Retry",onClick:c}:void 0}}),[e,o,l,c]),u=s((()=>({loading:"loading",ready:"subtle",disabled:"subtle",success:"success",error:"error"}[e]||"loading")),[e]);/*#__PURE__*/return t(kc,{icon:"loading"===e||"ready"===e?void 0:"success"===e?Gn:Jn,iconVariant:u,title:n,subtitle:r,primaryCta:d,watermark:!0})},oy={component:()=>{let{lastScreen:e,data:n,navigate:r,setModalData:a}=Is(),{status:s,token:l,waitForResult:c,reset:u,execute:p}=Zi(),h=i([]),m=e=>{h.current=[e,...h.current]},[g,y]=o(!0);d((()=>(m(setTimeout(y,1e3,!1)),()=>{h.current.forEach((e=>clearTimeout(e))),h.current=[]})),[]);let[f,w]=o(""),[v,C]=o("Checking that you are a human..."),[b,k]=o(!1),[A,T]=o(3),x=n?.captchaModalData,I=async t=>{try{await(x?.callback(t)),x?.onSuccessNavigateTo&&r(x?.onSuccessNavigateTo,!1)}catch(t){if(t instanceof Ki)return;a({errorModalData:{error:t,previousScreen:e||hw}}),r(x?.onErrorNavigateTo||Wm,!1)}};d((()=>{"success"===s?m(setTimeout((async()=>{let e=await c();!e||x?.userIntentRequired||I(e)}),1e3)):"ready"===s&&m(setTimeout((()=>{"ready"===s&&p()}),500))}),[s]),d((()=>{if(!g)switch(s){case"success":w("Success!"),C("CAPTCHA passed successfully."),x?.userIntentRequired||setTimeout((()=>{k(!0),I(l)}),2e3);break;case"loading":w(""),C("Checking that you are a human...");break;case"error":w("Something went wrong"),C(A<=0?"If you use an adblocker or VPN, try disabling and re-attempting.":"You did not pass CAPTCHA. Please try again.")}}),[s,g,b]);/*#__PURE__*/return t(iy,{status:s,title:f,description:v,userIntentRequired:x?.userIntentRequired,retriesRemaining:A,hasSelectedCta:b,onContinue:()=>{k(!0),I(l)},onRetry:async()=>{if(A<=0)return;T((e=>e-1)),u(),p();let e=await c();!e||x?.userIntentRequired||I(e)}})}},sy=e=>/*#__PURE__*/t("svg",{id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",viewBox:"-0.625 12.48 397.647 399.546",width:"2500",height:"674",preserveAspectRatio:"none",...e,children:/*#__PURE__*/t("g",{children:/*#__PURE__*/t("path",{fill:"#333745",d:"M 333.9 12.8 L 150.9 12.8 L 150.9 258.4 L 396.5 258.4 L 396.5 76.7 C 396.6 42.2 368.4 12.8 333.9 12.8 Z M 94.7 12.8 L 64 12.8 C 29.5 12.8 0 40.9 0 76.8 L 0 107.5 L 94.7 107.5 L 94.7 12.8 Z M 0 165 L 94.7 165 L 94.7 259.7 L 0 259.7 L 0 165 Z M 301.9 410.6 L 332.6 410.6 C 367.1 410.6 396.6 382.5 396.6 346.6 L 396.6 316 L 301.9 316 L 301.9 410.6 Z M 150.9 316 L 245.6 316 L 245.6 410.7 L 150.9 410.7 L 150.9 316 Z M 0 316 L 0 346.7 C 0 381.2 28.1 410.7 64 410.7 L 94.7 410.7 L 94.7 316 L 0 316 Z"})})}),ly=({onContinueWithLedger:n,onContinueWithoutLedger:r,title:a="Phantom supports Ledger",subtitle:i="Are you using a Ledger hardware wallet?\nContinue to sign with Ledger"})=>/*#__PURE__*/t(kc,{title:a,subtitle:/*#__PURE__*/t(uy,{children:i}),primaryCta:{label:"Continue with Ledger",onClick:n},secondaryCta:{label:"Continue without Ledger",onClick:r},watermark:!0,children:/*#__PURE__*/e(dy,{children:[/*#__PURE__*/t(Uo,{style:{width:"48px",height:"48px"}}),/*#__PURE__*/t(nr,{strokeWidth:2,color:"var(--privy-color-icon-subtle)",width:22,height:22}),/*#__PURE__*/t(sy,{style:{width:"48px",height:"48px"}})]})});const cy={component:function(){let{data:e,setModalData:n,navigate:r}=Is();/*#__PURE__*/return t(ly,{onContinueWithLedger:function(){n({...e,login:{...e?.login,isSigningInWithLedgerSolana:!0}}),r(fy)},onContinueWithoutLedger:function(){n({...e,login:{...e?.login,isSigningInWithLedgerSolana:!1}}),r(fy)}})}};let dy=/*#__PURE__*/kn.div.withConfig({displayName:"IconContainer",componentId:"sc-218811f1-0"})(["display:flex;align-items:center;justify-content:center;gap:8px;margin-bottom:var(--screen-space);"]),uy=/*#__PURE__*/kn.span.withConfig({displayName:"SubtitleText",componentId:"sc-218811f1-1"})(["white-space:pre-wrap;"]);const py=({style:e,...n})=>/*#__PURE__*/t("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"38px",width:"38px",...e},...n,children:/*#__PURE__*/t("path",{d:"M20 13.6V20M20 26.4H20.016M36 20C36 28.8365 28.8366 36 20 36C11.1635 36 4.00001 28.8365 4.00001 20C4.00001 11.1634 11.1635 3.99999 20 3.99999C28.8366 3.99999 36 11.1634 36 20Z",stroke:"currentColor",strokeWidth:"3.2",strokeLinecap:"round",strokeLinejoin:"round"})}),hy=({title:e="Unable to sign in",subtitle:n="This is a test application that has reached its user limit. To allow more users, this app needs to be upgraded to production.",onGoBack:r})=>/*#__PURE__*/t(kc,{title:e,subtitle:n,icon:py,iconVariant:"subtle",primaryCta:{label:"Go back",onClick:r},showBack:!0,onBack:r,watermark:!0}),my={component:()=>{let{navigate:e}=Is();/*#__PURE__*/return t(hy,{onGoBack:()=>{e(hw)}})}},gy=e=>e?.privyErrorCode===Te.LINKED_TO_ANOTHER_USER?ho.ERROR_USER_EXISTS:e instanceof po&&!e.details.default?e.details:e instanceof so?ho.ERROR_TIMED_OUT:e instanceof lo?ho.ERROR_USER_REJECTED_CONNECTION:e?.privyErrorCode===Te.CANNOT_LINK_MORE_OF_TYPE?ho.ERROR_USER_LIMIT_REACHED:ho.ERROR_WALLET_CONNECTION,yy=({walletLogo:r,title:a,subtitle:i,signSuccess:o,errorMessage:s,connectSuccess:l,separateConnectAndSign:c,signing:d,walletConnectRedirectUri:u,walletConnectFallbackUniversalUri:p,hasTabbedAway:h,showCoinbaseWalletResetCta:m,numRetries:g,onBack:y,onSign:f,onRetry:w,onCoinbaseReset:v,onDifferentWallet:C})=>{let b=m?{label:"Use a different wallet",onClick:v,disabled:o}:s===ho.ERROR_USER_EXISTS&&y?{label:"Use a different wallet",onClick:C}:l&&!o&&c?{label:d?"Signing":"Sign with your wallet",onClick:f,disabled:d}:!o&&s?.retryable&&g<2?{label:"Retry",onClick:w,disabled:!1}:o||s?void 0:{label:"Connecting",onClick:()=>{},disabled:!0};/*#__PURE__*/return t(kc,{title:a,subtitle:i,icon:r,iconVariant:"loading",iconLoadingStatus:{success:o,fail:!!s},primaryCta:b,onBack:y,watermark:!0,children:!l&&u&&!h&&/*#__PURE__*/e(wy,{children:["Still here?"," ",/*#__PURE__*/t(hm,{href:u,target:"_blank",variant:"underlined",size:"sm",children:"Try connecting again"}),p&&/*#__PURE__*/e(n,{children:[" ","or"," ",/*#__PURE__*/t(hm,{href:p,target:"_blank",variant:"underlined",size:"sm",children:"use this different link"})]})]})})},fy={component:()=>{let e,[n,r]=o(!1),[a,s]=o(!1),[l,c]=o(void 0),{authenticated:p,logout:h}=on(),{app:m,navigate:y,navigateBack:f,lastScreen:w,currentScreen:v,setModalData:C,data:b}=Is(),{getAuthFlow:k,walletConnectionStatus:A,closePrivyModal:T,initLoginWithWallet:x,loginWithWallet:I,updateWallets:E,createAnalyticsEvent:S}=Ft(),{walletConnectors:_}=on(),[N,M]=o(0),{user:W}=on(),P=ty(),[U]=o(W?.linkedAccounts.length||0),[F,O]=o(""),[L,R]=o(""),[D,B]=o(!1),{hasTabbedAway:z}=function(){let[e,t]=o(!1),n=u((()=>{document.hidden&&t(!0)}),[]);return d((()=>(document.addEventListener("visibilitychange",n),()=>document.removeEventListener("visibilitychange",n))),[n]),{hasTabbedAway:e,reset:()=>t(!1)}}(),{enabled:H,token:V}=Zi(),$=ts(A?.connector?.walletClientType||"unknown"),j=g&&"wallet_connect_v2"===A?.connector?.connectorType||g&&"coinbase_wallet"===A?.connector?.connectorType||g&&"base_account"===A?.connector?.connectorType||g&&"injected"===A?.connector?.connectorType&&"phantom"===A?.connector?.walletClientType||g&&"solana_adapter"===A?.connector?.connectorType&&"mobile_wallet_adapter"===A.connector.walletClientType,q="connected"===A?.status,K="switching_to_supported_chain"===A?.status;d((()=>{let e=k(),t=e instanceof ki||e instanceof xi?e:void 0;q&&"solana"===A.connector?.chainType&&"phantom"===A.connector?.walletClientType&&P(ny)&&void 0===b?.login?.isSigningInWithLedgerSolana?y(cy,!1):(q&&!t&&(!H||V||p?x(A.connectedWallet,V,b?.login?.disableSignup,b?.login?.isSigningInWithLedgerSolana?"transaction":"plain").then((()=>{B(!0)})):(C({captchaModalData:{callback:e=>x(A.connectedWallet,e,b?.login?.disableSignup,b?.login?.isSigningInWithLedgerSolana?"transaction":"plain").then((()=>{B(!0)})),userIntentRequired:!1,onSuccessNavigateTo:fy,onErrorNavigateTo:Wm}}),y(oy,!1))),t instanceof xi&&b?.login?.isSigningInWithLedgerSolana&&(t.messageType="transaction"),t&&j&&q&&!t.preparedMessage?t.buildMessage():t&&!j&&q&&(a||(async()=>{s(!0),c(void 0);try{"wallet_connect_v2"===A?.connector?.connectorType&&"metamask"===A?.connector?.walletClientType&&await Oi(2500),await Z()}catch(e){console.warn("Auto-prompted signature failed",e)}finally{s(!1)}})()))}),[N,q,D]),d((()=>{if(W&&n){let e=900;if(m?.legal.requireUsersAcceptTerms&&!W.hasAcceptedTerms){let t=setTimeout((()=>{y(Ym)}),e);return()=>clearTimeout(t)}if(wm(W,m.embeddedWallets)){let t=setTimeout((()=>{C({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),S({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"ConnectionStatusScreen"}}),h()},callAuthOnSuccessOnClose:!0}}),y(Zm)}),e);return()=>clearTimeout(t)}E();let t=setTimeout((()=>T({shouldCallAuthOnSuccess:!0,isSuccess:!0})),ka);return()=>clearTimeout(t)}}),[W,n]);let G=e=>{if(e?.privyErrorCode!==Te.ALLOWLIST_REJECTED){if(e?.privyErrorCode===Te.USER_LIMIT_REACHED)return console.error(new Nt(e).toString()),void y(my);if(e?.privyErrorCode!==Te.USER_DOES_NOT_EXIST)return e?.privyErrorCode===Te.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce?(C({accountTransfer:{nonce:e.data?.data?.nonce,account:k()?.meta.address,displayName:e.data?.data?.account?.displayName,externalWalletMetadata:{walletClientType:k()?.meta.walletClientType,chainId:k()?.meta.chainId,connectorType:k()?.meta.connectorType},linkMethod:k()instanceof ki?"siwe":"siws",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void y(jm)):void c(gy(e));y(Cm)}else y(ay)};async function Z(){try{await I(),r(!0)}catch(e){G(e)}finally{s(!1)}}d((()=>{A?.connectError&&G(A?.connectError)}),[A]),((e,t)=>{let n=i((()=>{}));d((()=>{n.current=e})),d((()=>{if(null!==t){let e=setInterval((()=>n.current()),t||0);return()=>clearInterval(e)}}),[t])})((()=>{let e="wallet_connect_v2"===Y&&A?.connector instanceof _s?A.connector.redirectUri:void 0;e&&O(e);let t="wallet_connect_v2"===Y&&A?.connector instanceof _s?A.connector.fallbackUniversalRedirectUri:void 0;t&&R(t)}),A?.connector instanceof _s&&!F?500:null);let Y=A?.connector?.connectorType||"injected",Q=A?.connector?.walletClientType||"unknown",X=$?.metadata?.shortName||$?.name||A?.connector?.walletBranding.name||"Browser Extension",J=$?.image_url?.md||A?.connector?.walletBranding.icon||(e=>/*#__PURE__*/t(Wo,{...e})),ee="Browser Extension"===X?X.toLowerCase():X;e=n?`Successfully connected with ${ee}`:l?l.message:K?"Switching networks":q?a&&j?"Signing":"Sign to verify":`Waiting for ${ee}`;let te="Don’t see your wallet? Check your other browser windows.";n?te=U===(W?.linkedAccounts.length||0)?"Wallet was already linked.":"You’re good to go!":N>=2&&l?te="Unable to connect wallet":l?te=l.detail:K?te="Switch your wallet to the requested network.":q&&j?te="Sign the message in your wallet to verify it belongs to you.":"metamask"===Q&&g?te="Click continue to open and connect MetaMask.":"metamask"===Q?te="For the best experience, connect only one wallet at a time.":"wallet_connect"===Y?te="Open your mobile wallet app to continue":"coinbase_wallet"===Y?Ni()||(te=Qg(W)?"Continue with the Coinbase app. Not the right wallet? Reset your connection below.":"Open the Coinbase app on your phone to continue."):b?.login?.isSigningInWithLedgerSolana&&(te="Ledger requires a transaction to verify your identity. You’ll sign a transaction that performs no onchain action.");let ne=_?.walletConnectors?.find((e=>"coinbase_wallet"===e.walletClientType)),re="coinbase_wallet"===Q&&(Qg(W)||l===ho.ERROR_USER_EXISTS);/*#__PURE__*/return t(yy,{walletLogo:J,title:e,subtitle:te,signSuccess:n,errorMessage:l,connectSuccess:q,separateConnectAndSign:j,signing:a,walletConnectRedirectUri:F,walletConnectFallbackUniversalUri:L,hasTabbedAway:z,showCoinbaseWalletResetCta:re,numRetries:N,onBack:w&&v!==w?f:void 0,onSign:()=>{s(!0),Z()},onRetry:()=>{M(N+1),c(void 0),q?(s(!0),Z()):A?.connectRetry()},onCoinbaseReset:()=>{ne&&ne?.disconnect()},onDifferentWallet:f})}};let wy=/*#__PURE__*/kn.p.withConfig({displayName:"RedirectLinksContainer",componentId:"sc-a5253f07-0"})(["text-align:center;color:var(--privy-color-foreground-2);font-size:14px;line-height:22px;margin:16px 0;"]);const vy={component:()=>{let{setWalletConnectionStatus:e,closePrivyModal:n,inProgressAuthFlowRef:r}=Ft(),{app:a,data:o,navigate:s}=Is(),l=rl(),c=o?.externalConnectWallet?.description,d=i(o?.externalConnectWallet?.suggestedAddress).current,p=i(o?.externalConnectWallet?.walletList??a.appearance.walletList),h=i(o?.externalConnectWallet?.walletChainType??a.appearance.walletChainType),m=p.current,g=h.current,y="link"===r.current?void 0:()=>s(hw);/*#__PURE__*/return t(Hg,{walletList:m,walletChainType:g,onClose:n,onConnect:u((({connector:t,wallet:n})=>{l("connectWallet","onSuccess",{wallet:n}),e({status:"connected",connectedWallet:n,connector:t,connectError:null,connectRetry:()=>null}),s(fy,!o?.externalConnectWallet?.preSelectedWalletId)}),[e,s,o?.login?.disableSignup,o?.externalConnectWallet?.preSelectedWalletId]),onConnectError:e=>{e instanceof Re?(console.warn(e.cause?e.cause:e.message),l("connectWallet","onError",e.privyErrorCode||Te.GENERIC_CONNECT_WALLET_ERROR)):(console.warn(e),l("connectWallet","onError",Te.UNKNOWN_CONNECT_WALLET_ERROR))},onBack:y,suggestedAddress:d,customDescription:c||"",preSelectedWalletId:o?.externalConnectWallet?.preSelectedWalletId,app:a})},isUnauthenticatedScreem:!0},Cy={component:()=>{let{closePrivyModal:e}=Ft(),{app:n,data:r}=Is(),a=rl(),o=r?.externalConnectWallet?.description,s=i(r?.externalConnectWallet?.suggestedAddress).current,l=i(r?.externalConnectWallet?.walletList??n.appearance.walletList),c=i(r?.externalConnectWallet?.walletChainType??n.appearance.walletChainType);/*#__PURE__*/return t(Hg,{walletList:l.current,walletChainType:c.current,onClose:()=>{a("connectWallet","onError",Te.GENERIC_CONNECT_WALLET_ERROR),e()},onConnect:({wallet:t})=>{a("connectWallet","onSuccess",{wallet:t}),e()},onConnectError:e=>{e instanceof Re?(console.warn(e.cause?e.cause:e.message),a("connectWallet","onError",e.privyErrorCode||Te.GENERIC_CONNECT_WALLET_ERROR)):(console.warn(e),a("connectWallet","onError",Te.UNKNOWN_CONNECT_WALLET_ERROR))},suggestedAddress:s,customDescription:o,app:n})},isUnauthenticatedScreem:!0},by=({chainType:n,withPadding:r})=>{let a="";return a="ethereum-only"===n||"ethereum-and-solana"===n?"Rainbow, Phantom, or Coinbase Wallet":"Phantom or Solflare",/*#__PURE__*/t(ml,{$withPadding:r,children:/*#__PURE__*/e(gl,{children:[/*#__PURE__*/t(Wn,{style:{color:"var(--privy-color-warn)",height:48,width:48}}),/*#__PURE__*/t("h3",{children:"No wallets available"}),/*#__PURE__*/e("p",{children:["Please download an external wallet provider, like ",a,"."]})]})},"empty-wallet-state")};let ky=/*#__PURE__*/xn(["from,to{background:var(--privy-color-foreground-4);color:var(--privy-color-foreground-4);}50%{background:var(--privy-color-foreground-accent);color:var(--privy-color-foreground-accent);}"]);const Ay=/*#__PURE__*/An(["",""],(e=>e.$isLoading?/*#__PURE__*/An(["width:35%;animation:"," 2s linear infinite;border-radius:var(--privy-border-radius-sm);"],ky):"")),Ty=({children:e,color:n,isLoading:r,isPulsing:a,...i})=>/*#__PURE__*/t(xy,{$color:n,$isLoading:r,$isPulsing:a,...i,children:e});let xy=/*#__PURE__*/kn.span.withConfig({displayName:"StyledSpan",componentId:"sc-80725f4-0"})(["padding:0.25rem;font-size:0.75rem;font-weight:500;line-height:1rem;border-radius:var(--privy-border-radius-xs);display:flex;align-items:center;"," ",""],(e=>{let t,n;"green"===e.$color&&(t="var(--privy-color-success-dark)",n="var(--privy-color-success-light)"),"red"===e.$color&&(t="var(--privy-color-error)",n="var(--privy-color-error-light)"),"gray"===e.$color&&(t="var(--privy-color-foreground-2)",n="var(--privy-color-background-2)");let r=/*#__PURE__*/xn(["from,to{background-color:",";}50%{background-color:rgba(",",0.8);}"],n,n);/*#__PURE__*/return An(["color:",";background-color:",";",";"],t,n,e.$isPulsing&&/*#__PURE__*/An(["animation:"," 3s linear infinite;"],r))}),Ay);const Iy=n=>/*#__PURE__*/e("svg",{width:"33",height:"32",viewBox:"0 0 33 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n,children:[/*#__PURE__*/t("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"#855DCD"}),/*#__PURE__*/e("g",{"clip-path":"url(#clip0_1715_1960)",children:[/*#__PURE__*/t("path",{d:"M4.5 4H28.5V28H4.5V4Z",fill:"#855DCD"}),/*#__PURE__*/t("path",{d:"M11.1072 8.42105H21.6983V23.5789H20.1437V16.6357H20.1284C19.9566 14.7167 18.3542 13.2129 16.4028 13.2129C14.4514 13.2129 12.849 14.7167 12.6771 16.6357H12.6619V23.5789H11.1072V8.42105Z",fill:"white"}),/*#__PURE__*/t("path",{d:"M8.28943 10.5725L8.92101 12.7239H9.45542V21.4275C9.1871 21.4275 8.96959 21.6464 8.96959 21.9165V22.5032H8.87242C8.60411 22.5032 8.38659 22.7221 8.38659 22.9922V23.5789H13.8279V22.9922C13.8279 22.7221 13.6104 22.5032 13.3421 22.5032H13.2449V21.9165C13.2449 21.6464 13.0274 21.4275 12.7591 21.4275H12.1761V10.5725H8.28943Z",fill:"white"}),/*#__PURE__*/t("path",{d:"M20.2408 21.4275C19.9725 21.4275 19.755 21.6464 19.755 21.9165V22.5032H19.6579C19.3895 22.5032 19.172 22.7221 19.172 22.9922V23.5789H24.6133V22.9922C24.6133 22.7221 24.3958 22.5032 24.1275 22.5032H24.0303V21.9165C24.0303 21.6464 23.8128 21.4275 23.5445 21.4275V12.7239H24.0789L24.7105 10.5725H20.8238V21.4275H20.2408Z",fill:"white"})]}),/*#__PURE__*/t("defs",{children:/*#__PURE__*/t("clipPath",{id:"clip0_1715_1960",children:/*#__PURE__*/t("rect",{width:"24",height:"24",fill:"white",transform:"translate(4.5 4)"})})})]}),Ey=e=>{let[n,r]=o(!1);/*#__PURE__*/return t(Sy,{color:e.color,href:e.url,target:"_blank",rel:"noreferrer noopener",onClick:()=>{r(!0),setTimeout((()=>r(!1)),1500)},justOpened:n,children:e.text})};let Sy=/*#__PURE__*/kn.a.withConfig({displayName:"StyledOpenLinkButton",componentId:"sc-4e695c83-0"})(["display:flex;align-items:center;gap:6px;&&{margin:8px 2px;font-size:14px;color:",";font-weight:",";transition:color 350ms ease;:focus,:active{background-color:transparent;border:none;outline:none;box-shadow:none;}:hover{color:",";}:active{color:'var(--privy-color-foreground)';font-weight:medium;}@media (max-width:440px){margin:12px 2px;}}svg{width:14px;height:14px;}"],(e=>e.justOpened?"var(--privy-color-foreground)":e.color||"var(--privy-color-foreground-3)"),(e=>e.justOpened?"medium":"normal"),(e=>e.justOpened?"var(--privy-color-foreground)":"var(--privy-color-foreground-2)"));const _y=/*#__PURE__*/kn.span.withConfig({displayName:"LabelXs",componentId:"sc-4c43f9fd-0"})(["color:var(--privy-color-foreground-3);font-size:0.75rem;font-weight:500;line-height:1.125rem;"]);let Ny=/*#__PURE__*/kn.div.withConfig({displayName:"Container",componentId:"sc-913deead-0"})(["width:100%;"]),My=/*#__PURE__*/kn.div.withConfig({displayName:"InputContainer",componentId:"sc-913deead-1"})(["display:flex;align-items:center;justify-content:space-between;gap:0.75rem;padding:0.75rem;height:56px;background:",";border:1px solid var(--privy-color-foreground-4);border-radius:var(--privy-border-radius-md);&:hover{border-color:",";}"],(e=>e.$disabled?"var(--privy-color-background-2)":"var(--privy-color-background)"),(e=>e.$disabled?"var(--privy-color-foreground-4)":"var(--privy-color-foreground-3)")),Wy=/*#__PURE__*/kn.div.withConfig({displayName:"TextContainer",componentId:"sc-913deead-2"})(["flex:1;min-width:0;display:flex;align-items:center;"]),Py=/*#__PURE__*/kn.span.withConfig({displayName:"Text",componentId:"sc-913deead-3"})(["display:block;font-size:16px;line-height:24px;color:",";overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;word-break:break-all;@media (min-width:441px){font-size:14px;line-height:20px;}"],(e=>e.$disabled?"var(--privy-color-foreground-2)":"var(--privy-color-foreground)")),Uy=/*#__PURE__*/kn(Py).withConfig({displayName:"PlaceholderText",componentId:"sc-913deead-4"})(["color:var(--privy-color-foreground-3);font-style:italic;"]),Fy=/*#__PURE__*/kn(_y).withConfig({displayName:"TitleLabel",componentId:"sc-913deead-5"})(["margin-bottom:0.5rem;"]),Oy=/*#__PURE__*/kn(Fl).withConfig({displayName:"CopyButton",componentId:"sc-913deead-6"})(["&&{gap:0.375rem;font-size:14px;flex-shrink:0;}"]);const Ly=({value:r,title:a,placeholder:i,className:s,showCopyButton:l=!0,truncate:c,maxLength:u=40,disabled:p=!1})=>{let[h,m]=o(!1),g=c&&r?((e,t,n)=>{if((e=e.startsWith("https://")?e.slice(8):e).length<=n)return e;if("middle"===t){let t=Math.ceil(n/2)-2,r=Math.floor(n/2)-1;return`${e.slice(0,t)}...${e.slice(-r)}`}return`${e.slice(0,n-3)}...`})(r,c,u):r;return d((()=>{if(h){let e=setTimeout((()=>m(!1)),3e3);return()=>clearTimeout(e)}}),[h]),/*#__PURE__*/e(Ny,{className:s,children:[a&&/*#__PURE__*/t(Fy,{children:a}),/*#__PURE__*/e(My,{$disabled:p,children:[/*#__PURE__*/t(Wy,{children:r?/*#__PURE__*/t(Py,{$disabled:p,title:r,children:g}):/*#__PURE__*/t(Uy,{$disabled:p,children:i||"No value"})}),l&&r&&/*#__PURE__*/t(Oy,{onClick:function(e){e.stopPropagation(),navigator.clipboard.writeText(r).then((()=>m(!0))).catch(console.error)},size:"sm",children:/*#__PURE__*/e(n,h?{children:["Copied",/*#__PURE__*/t(qn,{size:14})]}:{children:["Copy",/*#__PURE__*/t(Kn,{size:14})]})})]})]})},Ry=({connectUri:n,loading:r,success:a,errorMessage:i,onBack:o,onClose:s,onOpenFarcaster:l})=>/*#__PURE__*/t(kc,g||r?y?{title:i?i.message:"Sign in with Farcaster",subtitle:i?i.detail:"To sign in with Farcaster, please open the Farcaster app.",icon:Iy,iconVariant:"loading",iconLoadingStatus:{success:a,fail:!!i},primaryCta:n&&l?{label:"Open Farcaster app",onClick:l}:void 0,onBack:o,onClose:s,watermark:!0}:{title:i?i.message:"Signing in with Farcaster",subtitle:i?i.detail:"This should only take a moment",icon:Iy,iconVariant:"loading",iconLoadingStatus:{success:a,fail:!!i},onBack:o,onClose:s,watermark:!0,children:n&&g&&/*#__PURE__*/t(By,{children:/*#__PURE__*/t(Ey,{text:"Take me to Farcaster",url:n,color:"#8a63d2"})})}:{title:"Sign in with Farcaster",subtitle:"Scan with your phone's camera to continue.",onBack:o,onClose:s,watermark:!0,children:/*#__PURE__*/e(zy,{children:[/*#__PURE__*/t(Hy,{children:n?/*#__PURE__*/t(hg,{url:n,size:275,squareLogoElement:Iy}):/*#__PURE__*/t(jy,{children:/*#__PURE__*/t(xl,{})})}),/*#__PURE__*/e(Vy,{children:[/*#__PURE__*/t($y,{children:"Or copy this link and paste it into a phone browser to open the Farcaster app."}),n&&/*#__PURE__*/t(Ly,{value:n,truncate:"end",maxLength:30,showCopyButton:!0,disabled:!0})]})]})}),Dy={component:()=>{let{authenticated:e,logout:n,ready:r,user:a}=on(),{lastScreen:s,navigate:l,navigateBack:c,setModalData:u,app:p}=Is(),{getAuthFlow:h,loginWithFarcaster:m,closePrivyModal:g,createAnalyticsEvent:y}=Ft(),[f,w]=o(void 0),[v,C]=o(!1),[b,k]=o(!1),A=i([]),T=h(),x=T?.meta.connectUri;return d((()=>{let e=Date.now(),t=setInterval((async()=>{let n=await T.pollForReady.execute(),r=Date.now()-e;if(n){clearInterval(t),C(!0);try{await m(),k(!0)}catch(e){let t={retryable:!1,message:"Authentication failed"};if(e?.privyErrorCode===Te.ALLOWLIST_REJECTED)return void l(ay);if(e?.privyErrorCode===Te.USER_LIMIT_REACHED)return console.error(new Nt(e).toString()),void l(my);if(e?.privyErrorCode===Te.USER_DOES_NOT_EXIST)return void l(Cm);if(e?.privyErrorCode===Te.LINKED_TO_ANOTHER_USER)t.detail=e.message??"This account has already been linked to another user.";else{if(e?.privyErrorCode===Te.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return u({accountTransfer:{nonce:e.data?.data?.nonce,account:e.data?.data?.subject,displayName:e.data?.data?.account?.displayName,linkMethod:"farcaster",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress,farcasterEmbeddedAddress:e.data?.data?.otherUser?.farcasterEmbeddedAddress}}),void l(jm);e?.privyErrorCode===Te.INVALID_CREDENTIALS?(t.retryable=!0,t.detail="Something went wrong. Try again."):e?.privyErrorCode===Te.TOO_MANY_REQUESTS&&(t.detail="Too many requests. Please wait before trying again.")}w(t)}}else r>12e4&&(clearInterval(t),w({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))}),2e3);return()=>{clearInterval(t),A.current.forEach((e=>clearTimeout(e)))}}),[]),d((()=>{if(r&&e&&b&&a){if(p?.legal.requireUsersAcceptTerms&&!a.hasAcceptedTerms){let e=setTimeout((()=>{l(Ym)}),ka);return()=>clearTimeout(e)}b&&(wm(a,p.embeddedWallets)?A.current.push(setTimeout((()=>{u({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),y({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"FarcasterConnectStatusScreen"}}),n()},callAuthOnSuccessOnClose:!0}}),l(Zm)}),ka)):A.current.push(setTimeout((()=>g({shouldCallAuthOnSuccess:!0,isSuccess:!0})),ka)))}}),[b,r,e,a]),/*#__PURE__*/t(Ry,{connectUri:x,loading:v,success:b,errorMessage:f,onBack:s?c:void 0,onClose:g,onOpenFarcaster:()=>{x&&(window.location.href=x)}})}};let By=/*#__PURE__*/kn.div.withConfig({displayName:"MobileLinkContainer",componentId:"sc-8d74ecf6-0"})(["margin-top:24px;"]),zy=/*#__PURE__*/kn.div.withConfig({displayName:"ContentContainer",componentId:"sc-8d74ecf6-1"})(["display:flex;flex-direction:column;align-items:center;gap:24px;"]),Hy=/*#__PURE__*/kn.div.withConfig({displayName:"QrContainer",componentId:"sc-8d74ecf6-2"})(["display:flex;align-items:center;justify-content:center;min-height:275px;"]),Vy=/*#__PURE__*/kn.div.withConfig({displayName:"InstructionsContainer",componentId:"sc-8d74ecf6-3"})(["display:flex;flex-direction:column;align-items:center;gap:16px;"]),$y=/*#__PURE__*/kn.div.withConfig({displayName:"InstructionText",componentId:"sc-8d74ecf6-4"})(["font-size:0.875rem;text-align:center;color:var(--privy-color-foreground-2);"]),jy=/*#__PURE__*/kn.div.withConfig({displayName:"LoaderWrapper",componentId:"sc-8d74ecf6-5"})(["position:relative;width:82px;height:82px;"]);const qy=()=>{let[n,r]=o(!1),{currentScreen:a,navigate:i,setModalData:s,data:l}=Is(),{enabled:c,token:d}=Zi(),{initLoginWithFarcaster:u}=Ft(),{accountType:p}=om();/*#__PURE__*/return e(ul,{onClick:async()=>{r(!0);try{c&&!d?(s({captchaModalData:{callback:e=>u(e,l?.login?.disableSignup),userIntentRequired:!0,onSuccessNavigateTo:Dy,onErrorNavigateTo:Wm}}),i(oy)):(await u(d,l?.login?.disableSignup),i(Dy))}catch(e){s({errorModalData:{error:e,previousScreen:a||hw}}),i(Wm)}finally{r(!1)}},disabled:!1,children:[/*#__PURE__*/t(Iy,{width:32,height:32})," Farcaster",n&&/*#__PURE__*/t(El,{}),"farcaster"===p&&/*#__PURE__*/t(Ky,{color:"gray",children:"Recent"})]})};let Ky=/*#__PURE__*/kn(Ty).withConfig({displayName:"StyledChip",componentId:"sc-c6317ff9-0"})(["margin-left:auto;"]);const Gy=({status:e,passkeySignupFlow:n=!1,error:r,onRetry:a})=>/*#__PURE__*/t(kc,{title:(()=>{switch(e){case"loading":return"Waiting for passkey";case"success":return"Success";case"error":return"Something went wrong"}})(),subtitle:/*#__PURE__*/t(Yy,{children:(()=>{switch(e){case"loading":return n?"Please follow prompts to register your passkey.":"Please follow prompts to verify your passkey.\nYou will have to sign up with another method first to register a passkey for your account.";case"success":return"You've successfully logged in with your passkey.";case"error":if(r instanceof Re){if(r.privyErrorCode===Te.CANNOT_LINK_MORE_OF_TYPE)return"Cannot link more passkeys to account.";if(r.privyErrorCode===Te.PASSKEY_NOT_ALLOWED)return"Passkey request timed out or rejected by user.\nYou will have to sign up with another method first to register a passkey for your account."}return"An unknown error occurred.\nYou will have to sign up with another method first to register a passkey for your account."}})()}),icon:rr,iconVariant:"loading",iconLoadingStatus:{success:"success"===e,fail:"error"===e},primaryCta:"error"===e&&a?{label:"Retry",onClick:a}:"success"===e?{label:"Continue",disabled:!0}:void 0,watermark:!0}),Zy={component:()=>{let{app:e,data:n,setModalData:r,navigate:a}=Is(),{loginWithPasskey:s,signupWithPasskey:l,closePrivyModal:c,createAnalyticsEvent:u}=Ft(),{user:p,logout:h}=on(),{passkeySignupFlow:m}=n?.passkeyAuthModalData??{},[g,y]=o("loading"),[f,w]=o(null),v=i([]),C=e=>{v.current=[e,...v.current]};d((()=>()=>{v.current.forEach((e=>clearTimeout(e))),v.current=[]}),[]);let b=async()=>{y("loading");try{m?await l():await s(),y("success")}catch(e){w(e),y("error")}};return d((()=>{if("success"===g&&p){if(e?.legal.requireUsersAcceptTerms&&!p.hasAcceptedTerms)return void C(setTimeout((()=>{a(Ym)}),900));if(!wm(p,e?.embeddedWallets))return void C(setTimeout((()=>{c({shouldCallAuthOnSuccess:!0,isSuccess:!0})}),ka));C(setTimeout((()=>{r({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),u({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"PasskeyStatusScreen"}}),h()},callAuthOnSuccessOnClose:!0}}),a(Zm)}),900))}}),[p,g]),d((()=>{b()}),[]),/*#__PURE__*/t(Gy,{status:g,passkeySignupFlow:m,error:f,onRetry:b})}};let Yy=/*#__PURE__*/kn.span.withConfig({displayName:"SubtitleText",componentId:"sc-ad4f7fb3-0"})(["white-space:pre-wrap;"]);const Qy=({title:e="Log in or create a new account?",subtitle:n="Create a new account with a passkey or use a passkey to log in to an existing account.",onSignup:r,onLogin:a})=>/*#__PURE__*/t(kc,{title:e,subtitle:n,icon:rr,primaryCta:{label:"Create new account",onClick:r},secondaryCta:{label:"Log in with a passkey",onClick:a},watermark:!0}),Xy={component:()=>{let{enabled:e,token:n}=Zi(),{navigate:r,setModalData:a}=Is(),{initSignupWithPasskey:i,initLoginWithPasskey:o}=Ft();/*#__PURE__*/return t(Qy,{onSignup:async()=>{e&&!n?(a({passkeyAuthModalData:{passkeySignupFlow:!0},captchaModalData:{callback:e=>i({captchaToken:e,withPrivyUi:!0}),userIntentRequired:!1,onSuccessNavigateTo:Zy,onErrorNavigateTo:Wm}}),r(oy)):(await i({withPrivyUi:!0}),a({passkeyAuthModalData:{passkeySignupFlow:!0}}),r(Zy))},onLogin:async()=>{e&&!n?(a({passkeyAuthModalData:{passkeySignupFlow:!1},captchaModalData:{callback:e=>o({captchaToken:e,withPrivyUi:!0}),userIntentRequired:!1,onSuccessNavigateTo:Zy,onErrorNavigateTo:Wm}}),r(oy)):(await o({withPrivyUi:!0}),a({passkeyAuthModalData:{passkeySignupFlow:!1}}),r(Zy))}})}},Jy=()=>{let{enabled:n,token:r}=Zi(),{navigate:a,setModalData:i,app:o,data:l}=Is(),{initLoginWithPasskey:c}=Ft(),d=()=>{o.loginConfig.passkeysForSignupEnabled?a(Xy):(async()=>{n&&!r?(i({passkeyAuthModalData:{passkeySignupFlow:!1},captchaModalData:{callback:e=>c({captchaToken:e,withPrivyUi:!0}),userIntentRequired:!1,onSuccessNavigateTo:Zy,onErrorNavigateTo:Wm}}),a(oy)):(await c({withPrivyUi:!0}),i({passkeyAuthModalData:{passkeySignupFlow:!1}}),a(Zy))})()};return 0===s((()=>{let e=l?.login?.loginMethods;return e?e.filter((e=>"passkey"!==e)).length:Object.entries(o.loginMethods).filter((([e,t])=>t)).filter((([e])=>"passkey"!==e)).length}),[o.loginMethods,l?.login])?/*#__PURE__*/e(ul,{onClick:d,children:[/*#__PURE__*/t(Sn,{})," Continue with passkey"]}):/*#__PURE__*/t(hm,{as:"button",onClick:d,size:"sm",variant:"navigation",style:{width:"100%",justifyContent:"center"},children:"I have a passkey"})},ef=({value:n,onChange:r})=>/*#__PURE__*/t("select",{value:n,onChange:r,children:W.map((t=>/*#__PURE__*/e("option",{value:t.code,children:[t.code," +",t.callCode]},t.code)))}),tf=/*#__PURE__*/h(((r,a)=>{let{app:i}=Is(),[s,l]=o(!1),{accountType:c}=om(),[u,p]=o(""),[h,m]=o(i?.intl.defaultCountry??"US"),g=P(u,h),y=U(h),f=F(h),w=O(h),v=!g,[C,b]=o(!1),k=w.length,A=e=>{let t=e.target.value;m(t),p(""),r.onChange&&r.onChange({rawPhoneNumber:u,qualifiedPhoneNumber:R(u,t),countryCode:t,isValid:P(u,h)})},T=(e,t)=>{try{let n=e.replace(/\D/g,"")===u.replace(/\D/g,"")?e:y.input(e);p(n),r.onChange&&r.onChange({rawPhoneNumber:n,qualifiedPhoneNumber:R(e,t),countryCode:t,isValid:P(e,t)})}catch(e){console.error("Error processing phone number:",e)}},x=()=>{b(!0);let e=R(u,h);r.onSubmit({rawPhoneNumber:u,qualifiedPhoneNumber:e,countryCode:h,isValid:P(u,h)}).finally((()=>b(!1)))};return d((()=>{if(r.defaultValue){let e=L(r.defaultValue);y.reset(),A({target:{value:e.countryCode}}),T(e.phone,e.countryCode)}}),[r.defaultValue]),/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(nf,{children:/*#__PURE__*/e(rf,{$callingCodeLength:k,$stacked:r.stacked,children:[/*#__PURE__*/t(ef,{value:h,onChange:A}),/*#__PURE__*/t("input",{ref:a,id:"phone-number-input",className:"login-method-button",type:"tel",placeholder:f,onFocus:()=>l(!0),onChange:e=>{T(e.target.value,h)},onKeyUp:e=>{"Enter"===e.key&&x()},value:u,autoComplete:"tel"}),"phone"!==c||s||r.hideRecent?r.stacked||r.noIncludeSubmitButton?/*#__PURE__*/t("span",{}):/*#__PURE__*/t(Dl,{isSubmitting:C,onClick:x,disabled:v,children:"Submit"}):/*#__PURE__*/t(Ty,{color:"gray",children:"Recent"})]})}),r.stacked&&!r.noIncludeSubmitButton?/*#__PURE__*/t(Ml,{loading:C,loadingText:null,onClick:x,disabled:v,children:"Submit"}):null]})}));let nf=/*#__PURE__*/kn.div.withConfig({displayName:"InputContainer",componentId:"sc-f29a1304-0"})(["width:100%;"]),rf=/*#__PURE__*/kn.label.withConfig({displayName:"PhoneNumberInput",componentId:"sc-f29a1304-1"})(["--country-code-dropdown-width:calc(54px + calc(12 * ","px));--phone-input-extra-padding-left:calc(12px + calc(3 * ","px));display:block;position:relative;width:100%;@media (min-width:441px){--country-code-dropdown-width:calc(52px + calc(10 * ","px));}&& > select{font-size:16px;height:24px;position:absolute;margin:13px calc(var(--country-code-dropdown-width) / 4);line-height:24px;width:var(--country-code-dropdown-width);background-color:var(--privy-color-background);background-size:auto;background-position-x:right;cursor:pointer;@media (min-width:441px){font-size:14px;width:var(--country-code-dropdown-width);}:focus{outline:none;box-shadow:none;}}&& > input{font-size:16px;line-height:24px;color:var(--privy-color-foreground);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;width:calc(100% - var(--country-code-dropdown-width));padding:12px 88px 12px calc(var(--country-code-dropdown-width) + var(--phone-input-extra-padding-left));padding-right:",";flex-grow:1;background:var(--privy-color-background);border:1px solid var(--privy-color-foreground-4);border-radius:var(--privy-border-radius-md);width:100%;:focus{outline:none;border-color:var(--privy-color-accent);}:autofill,:-webkit-autofill{background:var(--privy-color-background);}@media (min-width:441px){font-size:14px;padding-right:78px;}}&& > :last-child{right:16px;position:absolute;top:50%;transform:translate(0,-50%);}&& > button:last-child{right:0px;line-height:24px;padding:13px 17px;:focus{outline:none;border-color:var(--privy-color-accent);}}&& > input::placeholder{color:var(--privy-color-foreground-3);}"],(e=>e.$callingCodeLength),(e=>e.$callingCodeLength),(e=>e.$callingCodeLength),(e=>e.$stacked?"16px":"88px"));const af=({isEditable:r,setIsEditable:a,defaultValue:o})=>{let s=i(null),{authenticated:l}=on(),{navigate:c,setModalData:d,currentScreen:u,data:p}=Is(),{initLoginWithSms:h}=Ft(),{enabled:m,token:g}=Zi(),{whatsAppEnabled:y}=ks();/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(hl,{$if:!r,children:/*#__PURE__*/t(tf,{ref:s,onSubmit:async function({qualifiedPhoneNumber:e}){if(!m||g||l)try{await h({phoneNumber:e,captchaToken:g,withPrivyUi:!0,disableSignup:p?.login?.disableSignup}),c(Mf)}catch(e){d({errorModalData:{error:e,previousScreen:u||hw}}),c(Wm)}else d({captchaModalData:{callback:t=>h({phoneNumber:e,captchaToken:t,withPrivyUi:!0,disableSignup:p?.login?.disableSignup}),userIntentRequired:!1,onSuccessNavigateTo:Mf,onErrorNavigateTo:Wm}}),c(oy)},defaultValue:o})}),/*#__PURE__*/t(hl,{$if:r,children:/*#__PURE__*/e(ul,{onClick:()=>{a(),setTimeout((()=>{s.current?.focus()}),0)},children:[/*#__PURE__*/t(pl,{children:/*#__PURE__*/t(ar,{})}),"Continue with ",y?"WhatsApp":"SMS"]})})]})};let of={apple:{logo:ii,displayName:"Apple"},discord:{logo:oi,displayName:"Discord"},github:{logo:si,displayName:"GitHub"},google:{logo:ci,displayName:"Google"},linkedin:{logo:pi,displayName:"LinkedIn"},spotify:{logo:hi,displayName:"Spotify"},instagram:{logo:di,displayName:"Instagram"},twitter:{logo:gi,displayName:"Twitter"},tiktok:{logo:mi,displayName:"TikTok"},line:{logo:ui,displayName:"LINE"}};const sf=({provider:n})=>{let{enabled:r,token:a}=Zi(),{navigate:i,setModalData:l,data:c}=Is(),[d,u]=o(!1),{initLoginWithOAuth:p}=Ft(),{accountType:h}=om(),m=s((()=>h&&"guest"!==h&&"authorization_key"!==h&&"cross_app"!==h?em(h):null),[h]),{displayName:g,logo:y}=of[n];/*#__PURE__*/return e(ul,{onClick:()=>{u(!0),setTimeout((()=>{u(!1)}),2e3),r&&!a?(l({captchaModalData:{callback:e=>p(n,e,c?.login?.disableSignup),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:Wm}}),i(oy)):p(n,void 0,c?.login?.disableSignup)},disabled:d,children:[/*#__PURE__*/t(pl,{$fullSize:!0,children:/*#__PURE__*/t(y,{style:{width:"32px",height:"32px"}})}),g,m?.loginMethod===n&&/*#__PURE__*/t(lf,{color:"gray",children:"Recent"})]})};let lf=/*#__PURE__*/kn(Ty).withConfig({displayName:"StyledChip",componentId:"sc-afd4ca87-0"})(["margin-left:auto;"]);function cf(n){/*#__PURE__*/return e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",...n,children:[/*#__PURE__*/t("rect",{width:"512",height:"512",rx:"15%",fill:"#37aee2"}),/*#__PURE__*/t("path",{fill:"#c8daea",d:"M199 404c-11 0-10-4-13-14l-32-105 245-144"}),/*#__PURE__*/t("path",{fill:"#a9c9dd",d:"M199 404c7 0 11-4 16-8l45-43-56-34"}),/*#__PURE__*/t("path",{fill:"#f6fbfe",d:"M204 319l135 99c14 9 26 4 30-14l55-258c5-22-9-32-24-25L79 245c-21 8-21 21-4 26l83 26 190-121c9-5 17-3 11 4"})]})}const df=({success:e,errorMessage:n,onRetry:r})=>{let a=e?"Successfully connected with Telegram":n?n.message:"Verifying connection to Telegram";/*#__PURE__*/return t(kc,{title:a,subtitle:e?"You're good to go!":n?n.detail:"Just a few moments more",icon:cf,iconVariant:"loading",iconLoadingStatus:{success:e,fail:!!n},secondaryCta:n?.retryable&&r?{label:"Retry",onClick:r}:void 0,watermark:!0})},uf={component:()=>{let{authenticated:e,logout:n,ready:r,user:a}=on(),{app:i,setModalData:s,navigate:l,resetNavigation:c,data:u}=Is(),{initLoginWithTelegram:p,loginWithTelegram:h,updateWallets:m,setReadyToTrue:g,closePrivyModal:y,createAnalyticsEvent:f,getAuthMeta:w}=Ft(),[v,C]=o(!1),[b,k]=o(void 0),A=Zi();async function T(){try{let t=await async function(){let t;if(!e){if(A.enabled&&"error"===A.status)throw new Ki(A.error,null,Te.CAPTCHA_FAILURE);return A.enabled&&"success"!==A.status&&(A.execute(),t=await A.waitForResult()),t}}();await h({captchaToken:t}),C(!0),g(!0)}catch(e){if(e?.privyErrorCode===Te.ALLOWLIST_REJECTED)return k(void 0),c(),void l(ay);if(e?.privyErrorCode===Te.USER_LIMIT_REACHED)return console.error(new Nt(e).toString()),k(void 0),c(),void l(my);if(e?.privyErrorCode===Te.USER_DOES_NOT_EXIST)return k(void 0),c(),void l(Cm);if(e?.privyErrorCode===Te.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return k(void 0),c(),s({accountTransfer:{nonce:e.data?.data?.nonce,account:e.data?.data?.subject,telegramAuthResult:w()?.telegramAuthResult,telegramWebAppData:w()?.telegramWebAppData,displayName:e.data?.data?.account?.displayName,linkMethod:"telegram",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void l(jm);let{retryable:t,detail:n}=Qi(e);k({retryable:t,detail:n,message:"Authentication failed"})}}d((()=>{T()}),[]),d((()=>{if(!(r&&e&&v&&a))return;if(i?.legal.requireUsersAcceptTerms&&!a.hasAcceptedTerms){let e=setTimeout((()=>{l(Ym)}),ka);return()=>clearTimeout(e)}if(wm(a,i.embeddedWallets)){let e=setTimeout((()=>{s({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),f({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,provider:"telegram",screen:"TelegramAuthScreen"}}),n()},callAuthOnSuccessOnClose:!0}}),l(Zm)}),ka);return()=>clearTimeout(e)}m();let t=setTimeout((()=>y({shouldCallAuthOnSuccess:!0,isSuccess:!0})),ka);return()=>clearTimeout(t)}),[r,e,v,a]);/*#__PURE__*/return t(df,{success:v,errorMessage:b,onRetry:b?.retryable?async()=>{try{k(void 0),u?.telegramAuthModalData?.seamlessAuth||await p(void 0,u?.login?.disableSignup),await T()}catch(e){let{retryable:t,detail:n}=Qi(e);k({retryable:t,detail:n,message:"Authentication failed"})}}:void 0})},isCaptchaRequired:!0},pf=()=>{let{enabled:n,token:r}=Zi(),{navigate:a,setModalData:i,data:s}=Is(),[l,c]=o(!1),{initLoginWithTelegram:d}=Ft(),{accountType:u}=om();async function p(e){try{await d(e,s?.login?.disableSignup),i({telegramAuthModalData:{seamlessAuth:!1}}),a(uf)}catch(e){console.error(e),c(!1)}}/*#__PURE__*/return e(ul,{onClick:async function(){if(c(!0),n&&!r)return i({captchaModalData:{callback:p,userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:Wm}}),void a(oy);await p(r)},disabled:l,children:[/*#__PURE__*/t(cf,{width:32,height:32}),"Telegram","telegram"===u&&/*#__PURE__*/t(hf,{color:"gray",children:"Recent"})]})};let hf=/*#__PURE__*/kn(Ty).withConfig({displayName:"StyledChip",componentId:"sc-4b233cf1-0"})(["margin-left:auto;"]);const mf=({onClick:n,text:r})=>/*#__PURE__*/e(ul,{onClick:n,children:[/*#__PURE__*/t(pl,{children:/*#__PURE__*/t(ir,{})}),/*#__PURE__*/t(il,{children:r})]}),gf=({onClick:n,text:r,icon:a})=>/*#__PURE__*/e(ul,{onClick:n,children:[/*#__PURE__*/t(pl,{children:a}),/*#__PURE__*/t(il,{children:r})]}),yf=({connectOnly:r})=>{let{closePrivyModal:a}=Ft(),{data:i,setModalData:l,onUserCloseViaDialogOrKeybindRef:c,navigate:u}=Is(),p=ks(),h=i?.login,m=p.appearance.walletList,g=h?.walletChainType??p.appearance.walletChainType,{accountType:y,walletClientType:f,chainType:w}=om(),{wallets:v}=Dg({walletList:m,walletChainType:g}),C=s((()=>y&&"guest"!==y&&"authorization_key"!==y&&"cross_app"!==y?em(y):null),[y]),{email:b,sms:k,google:A,twitter:T,discord:x,github:I,spotify:E,instagram:S,tiktok:_,line:N,linkedin:M,apple:W,wallet:P,farcaster:U,telegram:F}=s((()=>h?.loginMethods?D(h.loginMethods,!0):null),[h])??p.loginMethods,{passkey:O}=p.loginMethods,L=[b&&"email",k&&"sms",A&&"google",T&&"twitter",x&&"discord",I&&"github",E&&"spotify",S&&"instagram",_&&"tiktok",N&&"line",M&&"linkedin",W&&"apple",U&&"farcaster",F&&"telegram"].filter((e=>!!e)),R=L.length>0,B=s((()=>P&&!R?"web3-first":P&&p?.appearance.loginGroupPriority||"web2-first"),[P,R,p?.appearance.loginGroupPriority]),z=p?.appearance.hideDirectWeb2Inputs,[H,V]=o("default"),[$,j]=o(kf({mostRecentlyUsedAccountType:y,smsAvailable:k,emailAvailable:b,prefilledType:h?.prefill?.type}));d((()=>{j(kf({mostRecentlyUsedAccountType:y,smsAvailable:k,emailAvailable:b,prefilledType:h?.prefill?.type}))}),[b,k,y]);let q=()=>{a({shouldCallAuthOnSuccess:!0}),setTimeout((()=>{V("default")}),150)};c.current=q;let K=[];f&&P?K.push(f):C?.loginMethod&&L.includes(C.loginMethod)&&K.push(C.loginMethod);let G=e=>{if("email"===e)/*#__PURE__*/return t(Hf,{isEditable:"email"===$,setIsEditable:()=>{j("email")},defaultValue:"email"===h?.prefill?.type?h.prefill.value:void 0},e);if("sms"===e)/*#__PURE__*/return t(af,{isEditable:"sms"===$,setIsEditable:()=>{j("sms")},defaultValue:"phone"===h?.prefill?.type?h.prefill.value:void 0},e);if("apple"===e)/*#__PURE__*/return t(sf,{provider:"apple"},e);if("discord"===e)/*#__PURE__*/return t(sf,{provider:"discord"},e);if("farcaster"===e)/*#__PURE__*/return t(qy,{},e);if("github"===e)/*#__PURE__*/return t(sf,{provider:"github"},e);if("google"===e)/*#__PURE__*/return t(sf,{provider:"google"},e);if("linkedin"===e)/*#__PURE__*/return t(sf,{provider:"linkedin"},e);if("tiktok"===e)/*#__PURE__*/return t(sf,{provider:"tiktok"},e);if("line"===e)/*#__PURE__*/return t(sf,{provider:"line"},e);if("spotify"===e)/*#__PURE__*/return t(sf,{provider:"spotify"},e);if("instagram"===e)/*#__PURE__*/return t(sf,{provider:"instagram"},e);if("twitter"===e)/*#__PURE__*/return t(sf,{provider:"twitter"},e);if("telegram"===e)/*#__PURE__*/return t(pf,{},e);let n=v.findIndex((({id:t})=>t===bg.normalize(e))),a="solana"===w?"solana-only":"ethereum-only";/*#__PURE__*/return t(zg,{recent:!0,index:n,data:{wallets:v,walletChainType:a,handleWalletClick(e){l((t=>({...t,externalConnectWallet:{walletList:m,walletChainType:a,preSelectedWalletId:e.id}}))),u(r?Cy:vy)}}})},Z=v.filter((e=>e.id!==bg.normalize(f||""))),Y=Z.map(((e,n)=>/*#__PURE__*/t(zg,{index:n,data:{walletChainType:g,wallets:Z,handleWalletClick(e){l((t=>({...t,externalConnectWallet:{walletList:m,walletChainType:g,preSelectedWalletId:e.id}}))),u(r?Cy:vy)}}},e.id))),Q=L.filter((e=>e!==C?.loginMethod)).flatMap(G),X=K.flatMap(G);"web3-first"===B&&"default"===H?Y.unshift(...X):"web2-first"===B&&Q.unshift(...X);let J="web2-overflow"===H?()=>V("default"):void 0,ee=L.filter((e=>"email"!==e&&"sms"!==e)),te=vf({priority:B,email:b,sms:k,social:ee}),ne=Cf({priority:B,email:b,sms:k,social:ee}),re=/*#__PURE__*/t(mf,{text:bf({priority:B}),onClick:()=>{l({...i,externalConnectWallet:{walletChainType:h?.walletChainType??p.appearance.walletChainType}}),u(vy)}}),ae=/*#__PURE__*/t(gf,{text:te,icon:ne,onClick:()=>V("web2-overflow")}),ie=z?0:1,oe=P&&Y.length>0,se=0===Q.length&&P&&0===Y.length,le=5-(oe?1:0),ce="default"===H&&p?.appearance.logo,de="default"===H&&p.appearance.loginMessage;/*#__PURE__*/return e(kc,{title:p.appearance.landingHeader,icon:ce?/*#__PURE__*/t(sm,{}):void 0,iconVariant:ce?"logo":void 0,onClose:q,showClose:!0,onBack:J,showBack:!!J,helpText:p||O&&"default"===H?/*#__PURE__*/e(n,{children:[O&&"default"===H&&/*#__PURE__*/t(Jy,{}),p&&/*#__PURE__*/t(wl,{app:p})]}):void 0,watermark:!0,children:[de&&("string"==typeof p.appearance.loginMessage?/*#__PURE__*/t(ff,{children:p.appearance.loginMessage}):/*#__PURE__*/t(wf,{children:p.appearance.loginMessage})),/*#__PURE__*/t(ll,{$colorScheme:p.appearance.palette.colorScheme,children:"default"===H&&"web2-first"===B?/*#__PURE__*/e(n,{children:[Q.length>le?Q.slice(0,le-1):Q,Q.length>le&&ae,oe&&re,se&&/*#__PURE__*/t(by,{chainType:p.appearance.walletChainType})]}):"default"===H&&"web3-first"===B?/*#__PURE__*/e(n,{children:[P&&/*#__PURE__*/e(n,{children:[Y.length>le?Y.slice(0,le-1):Y,Y.length>le&&re]}),Q.length>ie&&ae,Q.length===ie&&Q[0],se&&/*#__PURE__*/t(by,{chainType:p.appearance.walletChainType})]}):"web2-overflow"===H?/*#__PURE__*/t(n,{children:"web3-first"===B?Q:Q.slice(3)}):null})]})};let ff=/*#__PURE__*/kn.div.withConfig({displayName:"StyledSubtitle",componentId:"sc-a0c826dc-0"})(["text-align:center;font-size:14px;margin-bottom:24px;"]),wf=/*#__PURE__*/kn.div.withConfig({displayName:"MessageContainer",componentId:"sc-a0c826dc-1"})(["margin-bottom:24px;"]),vf=({priority:e,email:t,sms:n,social:r})=>"web2-first"===e?"Other socials":t&&n&&r.length>0||t&&r.length>0?"Log in with email or socials":n&&r.length>0?"Log in with sms or socials":t&&n?"Continue with email or sms":t?"Continue with email":n?"Continue with sms":"Log in with a social account",Cf=({priority:e,email:n,sms:r,social:a})=>"web2-first"===e||a.length>0?/*#__PURE__*/t(or,{}):n&&r?/*#__PURE__*/t(Yg,{}):n?/*#__PURE__*/t(sr,{}):r?/*#__PURE__*/t(ar,{}):null,bf=({priority:e})=>"web2-first"===e?"Continue with a wallet":"Other wallets";const kf=({mostRecentlyUsedAccountType:e,smsAvailable:t,emailAvailable:n,prefilledType:r})=>n&&("email"===e&&"phone"!==r||"email"===r)||!t||"phone"!==e&&"phone"!==r?"email":"sms",Af={component:()=>{let{app:e}=Is();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?/*#__PURE__*/t(dw,{connectOnly:!0}):/*#__PURE__*/t(yf,{connectOnly:!0})}},Tf=({contactMethod:n,authFlow:r,appName:a="Privy",whatsAppEnabled:i=!1,onBack:s,onCodeSubmit:l,onResend:c,errorMessage:u,success:p=!1,resendCountdown:h=0,onInvalidInput:m,onClearError:y})=>{let[f,w]=o(If);d((()=>{u||w(If)}),[u]);let v=async e=>{e.preventDefault();let t=e.currentTarget.value.replace(" ","");if(""===t)return;if(isNaN(Number(t)))return void m?.("Code should be numeric");y?.();let n=Number(e.currentTarget.name?.charAt(5)),r=[...t||[""]].slice(0,xf-n),a=[...f.slice(0,n),...r,...f.slice(n+r.length)];w(a);let i=Math.min(Math.max(n+r.length,0),xf-1);if(!isNaN(Number(e.currentTarget.value))){let e=document.querySelector(`input[name=code-${i}]`);e?.focus()}if(a.every((e=>e&&!isNaN(+e)))){let e=document.querySelector(`input[name=code-${i}]`);e?.blur(),await(l?.(a.join("")))}};/*#__PURE__*/return t(kc,{title:"Enter confirmation code",subtitle:/*#__PURE__*/e("span","email"===r?{children:["Please check ",/*#__PURE__*/t(Lf,{children:n})," for an email from privy.io and enter your code below."]}:{children:["Please check ",/*#__PURE__*/t(Lf,{children:n})," for a",i?" WhatsApp":""," message from ",a," and enter your code below."]}),icon:"email"===r?kr:_n,onBack:s,showBack:!0,helpText:/*#__PURE__*/e(Ff,{children:[/*#__PURE__*/e("span",{children:["Didn't get ","email"===r?"an email":"a message","?"]}),h?/*#__PURE__*/e(Of,{children:[/*#__PURE__*/t(br,{color:"var(--privy-color-foreground)",strokeWidth:1.33,height:"12px",width:"12px"}),/*#__PURE__*/t("span",{children:"Code sent"})]}):/*#__PURE__*/t(hm,{as:"button",size:"sm",onClick:c,children:"Resend code"})]}),children:/*#__PURE__*/t(Wf,{children:/*#__PURE__*/t(Rd,{children:/*#__PURE__*/e(Pf,{children:[/*#__PURE__*/t("div",{children:f.map(((e,n)=>/*#__PURE__*/t("input",{name:`code-${n}`,type:"text",value:f[n],onChange:v,onKeyUp:e=>{"Backspace"===e.key&&(e=>{if(y?.(),w([...f.slice(0,e),"",...f.slice(e+1)]),e>0){let t=document.querySelector(`input[name=code-${e-1}]`);t?.focus()}})(n)},inputMode:"numeric",autoFocus:0===n,pattern:"[0-9]",className:`${p?"success":""} ${u?"fail":""}`,autoComplete:g?"one-time-code":"off"},n)))}),/*#__PURE__*/t(Uf,{$fail:!!u,$success:p,children:/*#__PURE__*/t("span",{children:"Invalid or expired verification code"===u?"Incorrect code":u||(p?"Success!":"")})})]})})})})};let xf=6,If=Array(6).fill("");var Ef,Sf,_f=((Ef=_f||{})[Ef.RESET_AFTER_DELAY=0]="RESET_AFTER_DELAY",Ef[Ef.CLEAR_ON_NEXT_VALID_INPUT=1]="CLEAR_ON_NEXT_VALID_INPUT",Ef),Nf=((Sf=Nf||{})[Sf.EMAIL=0]="EMAIL",Sf[Sf.SMS=1]="SMS",Sf);const Mf={component:()=>{let{app:e,navigate:n,lastScreen:r,navigateBack:a,setModalData:i,onUserCloseViaDialogOrKeybindRef:s}=Is(),{closePrivyModal:l,resendEmailCode:c,resendSmsCode:u,getAuthMeta:p,loginWithCode:h,updateWallets:m,createAnalyticsEvent:g}=Ft(),{authenticated:y,logout:f,user:w}=on(),{whatsAppEnabled:v}=ks(),[C,b]=o(!1),[k,A]=o(null),[T,x]=o(null),[I,E]=o(0);s.current=()=>null;let S=p()?.email?0:1,_=0===S?p()?.email||"":p()?.phoneNumber||"";d((()=>{if(I){let e=setTimeout((()=>{E(I-1)}),1e3);return()=>clearTimeout(e)}}),[I]),d((()=>{if(y&&C&&w){if(e?.legal.requireUsersAcceptTerms&&!w.hasAcceptedTerms){let e=setTimeout((()=>{n(Ym)}),900);return()=>clearTimeout(e)}if(wm(w,e.embeddedWallets)){let e=setTimeout((()=>{i({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),g({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"AwaitingPasswordlessCodeScreen"}}),f()},callAuthOnSuccessOnClose:!0}}),n(Zm)}),900);return()=>clearTimeout(e)}{m();let e=setTimeout((()=>l({shouldCallAuthOnSuccess:!0,isSuccess:!0})),ka);return()=>clearTimeout(e)}}}),[y,C,w]),d((()=>{if(k&&0===T){let e=setTimeout((()=>{A(null),x(null);let e=document.querySelector("input[name=code-0]");e?.focus()}),1400);return()=>clearTimeout(e)}}),[k,T]);/*#__PURE__*/return t(Tf,{contactMethod:_,authFlow:0===S?"email":"sms",appName:e?.name,whatsAppEnabled:v,onBack:()=>a(),onCodeSubmit:async e=>{try{await h(e),b(!0)}catch(e){if(e instanceof Ze&&e.privyErrorCode===Te.INVALID_CREDENTIALS)A("Invalid or expired verification code"),x(0);else if(e instanceof Ze&&e.privyErrorCode===Te.CANNOT_LINK_MORE_OF_TYPE)A(e.message);else{if(e instanceof Ze&&e.privyErrorCode===Te.USER_LIMIT_REACHED)return console.error(new Nt(e).toString()),void n(my);if(e instanceof Ze&&e.privyErrorCode===Te.USER_DOES_NOT_EXIST)return void n(Cm);if(e instanceof Ze&&e.privyErrorCode===Te.LINKED_TO_ANOTHER_USER)return i({errorModalData:{error:e,previousScreen:r??Mf}}),void n(Wm,!1);if(e instanceof Ze&&e.privyErrorCode===Te.DISALLOWED_PLUS_EMAIL)return i({inlineError:{error:e}}),void n(Af,!1);if(e instanceof Ze&&e.privyErrorCode===Te.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return i({accountTransfer:{nonce:e.data?.data?.nonce,account:_,displayName:e.data?.data?.account?.displayName,linkMethod:0===S?"email":"sms",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void n(jm);A("Issue verifying code"),x(0)}}},onResend:async()=>{E(30),0===S?await c():await u()},errorMessage:k||void 0,success:C,resendCountdown:I,onInvalidInput:e=>{A(e),x(1)},onClearError:()=>{1===T&&(A(null),x(null))}})}};let Wf=/*#__PURE__*/kn.div.withConfig({displayName:"PasswordlessCodeContainer",componentId:"sc-5dd8bc26-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin:auto;gap:16px;flex-grow:1;width:100%;"]),Pf=/*#__PURE__*/kn.div.withConfig({displayName:"CodeInput",componentId:"sc-5dd8bc26-1"})(["display:flex;flex-direction:column;width:100%;gap:12px;> div:first-child{display:flex;justify-content:center;gap:0.5rem;width:100%;border-radius:var(--privy-border-radius-sm);> input{border:1px solid var(--privy-color-foreground-4);background:var(--privy-color-background);border-radius:var(--privy-border-radius-sm);padding:8px 10px;height:48px;width:40px;text-align:center;font-size:18px;font-weight:600;color:var(--privy-color-foreground);transition:all 0.2s ease;}> input:focus{border:1px solid var(--privy-color-foreground);box-shadow:0 0 0 1px var(--privy-color-foreground);}> input:invalid{border:1px solid var(--privy-color-error);}> input.success{border:1px solid var(--privy-color-border-success);background:var(--privy-color-success-bg);}> input.fail{border:1px solid var(--privy-color-border-error);background:var(--privy-color-error-bg);animation:shake 180ms;animation-iteration-count:2;}}@keyframes shake{0%{transform:translate(1px,0px);}33%{transform:translate(-1px,0px);}67%{transform:translate(-1px,0px);}100%{transform:translate(1px,0px);}}"]),Uf=/*#__PURE__*/kn.div.withConfig({displayName:"InputHelp",componentId:"sc-5dd8bc26-2"})(["line-height:20px;min-height:20px;font-size:14px;font-weight:400;color:",";display:flex;justify-content:center;width:100%;text-align:center;"],(e=>e.$success?"var(--privy-color-success-dark)":e.$fail?"var(--privy-color-error-dark)":"transparent")),Ff=/*#__PURE__*/kn.div.withConfig({displayName:"HelpTextContainer",componentId:"sc-5dd8bc26-3"})(["display:flex;gap:8px;align-items:center;justify-content:center;width:100%;color:var(--privy-color-foreground-2);"]),Of=/*#__PURE__*/kn.div.withConfig({displayName:"Badge",componentId:"sc-5dd8bc26-4"})(["display:flex;align-items:center;justify-content:center;border-radius:var(--privy-border-radius-sm);padding:2px 8px;gap:4px;background:var(--privy-color-background-2);color:var(--privy-color-foreground-2);"]),Lf=/*#__PURE__*/kn.span.withConfig({displayName:"BoldWrappingSpan",componentId:"sc-5dd8bc26-5"})(["font-weight:500;word-break:break-all;color:var(--privy-color-foreground);"]);const Rf=/*#__PURE__*/h(((r,a)=>{let[i,s]=o(r.defaultValue||""),[l,c]=o(""),[u,p]=o(!1),{authenticated:h}=on(),{initLoginWithEmail:m}=Ft(),{navigate:g,setModalData:y,currentScreen:f,data:w}=Is(),{enabled:v,token:C}=Zi(),[b,k]=o(!1),{accountType:A}=om(),T=ks();d((()=>{!i&&T.disablePlusEmails&&w?.inlineError?.error instanceof Re&&w?.inlineError?.error.privyErrorCode===Te.DISALLOWED_PLUS_EMAIL&&!l&&c("Please enter a valid email address without a '+'."),l&&c("")}),[i]);let x=Pi(i),I=u||!x,E=()=>{y({login:w?.login,inlineError:void 0}),!v||C||h?(e=>{p(!0),m({email:i,captchaToken:e,disableSignup:w?.login?.disableSignup,withPrivyUi:!0}).then((()=>{g(Mf)})).catch((e=>{y({errorModalData:{error:e,previousScreen:f||hw}}),g(Wm)})).finally((()=>{p(!1)}))})(C):(y({captchaModalData:{callback:e=>m({email:i,captchaToken:e,withPrivyUi:!0}),userIntentRequired:!1,onSuccessNavigateTo:Mf,onErrorNavigateTo:Wm}}),g(oy))};/*#__PURE__*/return e(n,{children:[/*#__PURE__*/e(Df,{children:[l&&/*#__PURE__*/t(mg,{style:{display:"block",marginTop:"0.25rem",textAlign:"left"},children:l}),/*#__PURE__*/e(Bf,{stacked:r.stacked,$error:!!l,children:[/*#__PURE__*/t(zf,{children:/*#__PURE__*/t(sr,{})}),/*#__PURE__*/t("input",{ref:a,id:"email-input",className:"login-method-button",type:"email",placeholder:"your@email.com",onFocus:()=>k(!0),onChange:e=>s(e.target.value),onKeyUp:e=>{"Enter"===e.key&&E()},value:i,autoComplete:"email"}),"email"!==A||b?r.stacked?/*#__PURE__*/t("span",{}):/*#__PURE__*/t(Dl,{isSubmitting:u,onClick:E,disabled:I,children:"Submit"}):/*#__PURE__*/t(Ty,{color:"gray",children:"Recent"})]})]}),r.stacked?/*#__PURE__*/t(Ml,{loadingText:null,loading:u,disabled:I,onClick:E,style:{width:"100%"},children:"Submit"}):null]})}));let Df=wg,Bf=fg,zf=/*#__PURE__*/kn(pl).withConfig({displayName:"StyledLoginMethodIconWrapper",componentId:"sc-e33d938a-0"})(["display:inline-flex;"]);const Hf=({isEditable:r,setIsEditable:a,defaultValue:o})=>{let s=i(null);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(hl,{$if:!r,children:/*#__PURE__*/t(Rf,{ref:s,defaultValue:o})}),/*#__PURE__*/t(hl,{$if:r,children:/*#__PURE__*/e(ul,{onClick:()=>{a(),setTimeout((()=>{s.current?.focus()}),0)},children:[/*#__PURE__*/t(pl,{children:/*#__PURE__*/t(sr,{})}),"Continue with Email"]})})]})},Vf=({icon:e,name:n})=>"string"==typeof e?/*#__PURE__*/t("img",{alt:`${n||"wallet"} logo`,src:e,style:{height:24,width:24,borderRadius:4}}):void 0===e?/*#__PURE__*/t(Ar,{style:{height:24,width:24}}):e?/*#__PURE__*/t(e,{}):null;function $f(e){let t=e.toLowerCase();return!!window?.webkit?.messageHandlers?.ReactNativeWebView||!!window?.ReactNativeWebView||["fbav","fban","instagram","snapchat","linkedinapp"].some((e=>t.includes(e)))}const jf=({walletLogo:e,success:n,errorMessage:r,title:a,subtitle:i,onRetry:o,onUseDifferentWallet:s,onBack:l,numRetries:c,maxRetries:d})=>/*#__PURE__*/t(kc,{title:a,subtitle:i,icon:e,iconVariant:"loading",iconLoadingStatus:{success:n,fail:!!r},primaryCta:r===ho.ERROR_USER_EXISTS?{label:"Use a different wallet",onClick:s}:!n&&r?.retryable&&c<d?{label:"Retry",onClick:o,disabled:!r?.retryable||c>=d}:!n&&r&&c>=d?{label:"Use a different wallet",onClick:s}:void 0,onBack:l,watermark:!0}),qf={component:()=>{let e,{navigateBack:n,navigate:r,lastScreen:a,currentScreen:i,data:s,setModalData:l}=Is(),{walletConnectionStatus:c,closePrivyModal:u}=Ft(),[p,h]=o(void 0),[m,y]=o(0),f=ts(c?.connector?.walletClientType||"unknown"),w="connected"===c?.status,v="switching_to_supported_chain"===c?.status;d((()=>{if(w){let e;if(s?.externalConnectWallet?.onCompleteNavigateTo){let t=s.externalConnectWallet.onCompleteNavigateTo,n=c.connectedWallet?.address;e=setTimeout((()=>{s.funding&&l({...s,funding:{...s.funding,connectedWalletAddress:n}}),r(t({address:n,walletClientType:c.connector?.walletClientType,walletChainType:c.connector?.chainType}))}),ka)}else e=setTimeout(u,ka);return()=>clearTimeout(e)}}),[w]);d((()=>{c?.connectError&&(e=>{h(gy(e))})(c?.connectError)}),[c]);let C=c?.connector?.connectorType||"injected",b=c?.connector?.walletClientType||"unknown",k=f?.metadata?.shortName||f?.name||c?.connector?.walletBranding.name||"Browser Extension",A=f?.image_url?.md||c?.connector?.walletBranding.icon||(e=>/*#__PURE__*/t(Wo,{...e})),T="Browser Extension"===k?k.toLowerCase():k;e=w?`Successfully connected with ${T}`:p?p.message:v?"Switching networks":`Waiting for ${T}`;let x="Don’t see your wallet? Check your other browser windows.";return w?x="You’re good to go!":m>=2&&p?x="Unable to connect wallet":p?x=p.detail:v?x="Switch your wallet to the requested network.":"metamask"===b&&g?x="Click to continue to open and connect MetaMask.":"metamask"===b?x="For the best experience, connect only one wallet at a time.":"wallet_connect_v2"===C?x="Open your mobile wallet app to continue":"coinbase_wallet"===C&&(x="Open the Coinbase app on your phone to continue."),/*#__PURE__*/t(jf,{walletName:k,walletLogo:A,success:w,errorMessage:p,title:e,subtitle:x,onRetry:()=>{y(m+1),h(void 0),c?.connectRetry()},onUseDifferentWallet:n,onBack:i===a?void 0:n,numRetries:m,maxRetries:2})}},Kf=/*#__PURE__*/kn.div.withConfig({displayName:"TodoList",componentId:"sc-bcc78743-0"})(["display:flex;flex-direction:column;justify-content:flex-start;gap:10px;padding-left:8px;"]),Gf=({children:n,variant:r="default",icon:i})=>{let o=()=>{switch(r){case"success":return"var(--privy-color-icon-success)";case"error":return"var(--privy-color-icon-error)";default:return"var(--privy-color-icon-muted)"}};/*#__PURE__*/return e(Yf,{children:[/*#__PURE__*/t(Zf,{$variant:r,"data-variant":r,children:(()=>{if(i)
|
|
23
|
+
/*#__PURE__*/return a.isValidElement(i)?/*#__PURE__*/a.cloneElement(i,{stroke:o(),strokeWidth:2}):i;switch(r){case"success":default:/*#__PURE__*/return t(qn,{size:12,stroke:o(),strokeWidth:3});case"error":/*#__PURE__*/return t(lr,{size:12,stroke:o(),strokeWidth:3})}})()}),n]})};let Zf=/*#__PURE__*/kn.div.withConfig({displayName:"IconBackground",componentId:"sc-bcc78743-2"})(["display:flex;align-items:center;justify-content:center;width:20px;height:20px;border-radius:50%;background-color:",";flex-shrink:0;"],(({$variant:e})=>{switch(e){case"success":return"var(--privy-color-success-bg, #EAFCEF)";case"error":return"var(--privy-color-error-bg, #FEE2E2)";default:return"var(--privy-color-background-2)"}})),Yf=/*#__PURE__*/kn.div.withConfig({displayName:"TodoItemWrapper",componentId:"sc-bcc78743-3"})(["display:flex;justify-content:flex-start;align-items:flex-start;text-align:left;gap:8px;&&{a{color:var(--privy-color-accent);}}"]);const Qf=({walletName:r,installLink:a,title:i,subtitle:o="Follow the instructions below to get started.",onReload:s,onBack:l})=>{let c=i||`Create a ${r} wallet`.replace(/wallet wallet/gi,"wallet");/*#__PURE__*/return t(kc,{title:c,subtitle:o,onBack:l,showBack:!0,primaryCta:{label:"Reload the page to use your wallet",onClick:s},helpText:/*#__PURE__*/e(n,{children:[/*#__PURE__*/t("span",{children:"Still not sure? "}),/*#__PURE__*/t(hm,{size:"sm",target:"_blank",href:"https://solana.com/docs/intro/wallets",children:"Learn more"})]}),watermark:!0,children:/*#__PURE__*/e(Kf,{children:[/*#__PURE__*/t(Gf,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t("span",{children:"Install the "})," ",/*#__PURE__*/e(hm,{href:a,target:"_blank",children:[r," browser extension"]})]})}),/*#__PURE__*/t(Gf,{children:"Set up your first wallet"}),/*#__PURE__*/t(Gf,{children:"Store your recovery phrase in a safe place!"})]})})},Xf={component:()=>{let{navigateBack:e,data:n}=Is();if(!n?.installWalletModalData)throw Error("Wallet data is missing");let{walletConfig:r}=n.installWalletModalData;/*#__PURE__*/return t(Qf,{walletName:r.name,installLink:r.installLink,onReload:()=>{window.location.reload()},onBack:e})}},Jf=({title:e,subtitle:n,buttonText:r,buttonHref:a,isLoading:i=!1,helpText:o,onButtonClick:s})=>/*#__PURE__*/t(kc,{title:e,subtitle:n,primaryCta:{label:r,onClick:()=>{a&&window.open(a,"_self"),s?.()},disabled:i},helpText:o,watermark:!0}),ew={component:()=>{let{ready:e}=on(),{data:n}=Is(),[r,a]=o(!1);if(!n?.installWalletModalData)throw Error("Wallet data is missing");let{walletConfig:i,connectOnly:s,chainType:l}=n.installWalletModalData,c=i.getMobileRedirect({useUniversalLink:!r,isSolana:"solana"===l,connectOnly:s}),d=i.name.replace(/ wallet/gi,""),u={title:`Redirecting to ${d} Mobile Wallet`,description:`We'll take you to the ${d} Mobile Wallet app to continue your login experience.`,footnote:""};return e&&(u.description=`For the best experience, we'll automatically log you into the ${d} Mobile Wallet in-app browser.`,u.footnote="You can always return here to login via other methods."),r&&(u.title="Still here?",u.description=`You may need to install the ${i.name} mobile app.`,u.footnote=`Once you're done, you can connect with ${i.name} wallet to complete the login.`),/*#__PURE__*/t(Jf,{title:u.title,subtitle:u.description,buttonText:r?"Go to App Store":"Continue",buttonHref:c,isLoading:e&&!c,helpText:u.footnote||void 0,onButtonClick:()=>{setTimeout((()=>a(!0)),1e3)}})}},tw=({provider:n,displayName:r,logo:a,connectOnly:i,connector:o})=>{let s,{navigate:l,setModalData:c}=Is(),{connectWallet:d}=Ft(),u=om(),p=ts(n),h="wallet_connect_v2"===o.connectorType?n:o.walletClientType,m=window.matchMedia("(display-mode: standalone)").matches,y=Vo({connectorType:o.connectorType,walletClientType:h});s=y&&y.chainTypes.includes(o.chainType)?()=>{y.isInstalled||"solana"===o.chainType&&"isInstalled"in o&&o.isInstalled?(d(o,h),l(i?qf:fy)):g?(c({installWalletModalData:{walletConfig:y,chainType:o.chainType,connectOnly:i}}),l(ew)):(c({installWalletModalData:{walletConfig:y,chainType:o.chainType,connectOnly:i}}),l(Xf))}:"coinbase_wallet"!==o.connectorType||"eoaOnly"!==o.coinbaseWalletConfig.preference?.options||!g||m||Ni()?()=>{(!$f(window.navigator.userAgent)||event?.isTrusted)&&(d(o,h),l(i?qf:fy))}:()=>{window.location.href=`https://go.cb-w.com/dapp?cb_url=${encodeURI(window.location.href)}`};let f=r||p?.metadata?.shortName||p?.name||o.walletClientType;/*#__PURE__*/return e(nw,{onClick:s,children:[/*#__PURE__*/t(Vf,{icon:a||p?.image_url?.md,name:f}),/*#__PURE__*/t("span",{children:f}),/*#__PURE__*/e(aw,{id:"chip-container",children:[u?.walletClientType===h&&u?.chainType===o.chainType?/*#__PURE__*/t(rw,{color:"gray",children:"Recent"}):/*#__PURE__*/t("span",{id:"connect-text",children:"Connect"}),"solana"===o.chainType&&/*#__PURE__*/t(rw,{color:"gray",children:"Solana"})]})]})};let nw=/*#__PURE__*/kn(ul).withConfig({displayName:"ConnectWalletButton",componentId:"sc-42d67b97-0"})(["> span{color:var(--privy-color-foreground);}> #chip-container > #connect-text{font-weight:500;color:var(--privy-color-accent);opacity:0;transition:opacity 0.1s ease-out;}:hover > #chip-container > #connect-text{opacity:1;}@media (max-width:440px){> #chip-container > #connect-text{display:none;}}"]),rw=/*#__PURE__*/kn(Ty).withConfig({displayName:"StyledChip",componentId:"sc-42d67b97-1"})(["margin-left:auto;"]),aw=/*#__PURE__*/kn.div.withConfig({displayName:"ChipContainer",componentId:"sc-42d67b97-2"})(["display:flex;flex-wrap:wrap;gap:8px;margin-left:auto;"]);const iw=["coinbase_wallet","base_account"];let ow=["metamask","okx_wallet","rainbow","uniswap","bybit_wallet","ronin_wallet","haha_wallet","uniswap_extension","zerion","rabby_wallet","cryptocom","binance"];const sw=["safe"],lw=["phantom","backpack","solflare","universal_profile"],cw=({walletList:e,walletChainType:n,connectors:r,connectOnly:a,ignore:i,walletConnectEnabled:o,forceWallet:s})=>{let l=[],c=[],d=[],u=r.filter((e=>"ethereum-only"===n?"ethereum"===e.chainType:"solana-only"!==n||"solana"===e.chainType)),p=u.find((e=>"wallet_connect_v2"===e.connectorType));for(let[r,h]of(s?[s.wallet]:e).entries()){if("detected_ethereum_wallets"===h||"detected_wallets"===h)for(let[e,n]of u.filter((({chainType:e,connectorType:t,walletClientType:n})=>"solana"!==e&&("uniswap_wallet_extension"===n||"uniswap_extension"===n?!i.includes("uniswap"):"crypto.com_wallet_extension"===n||"crypto.com_onchain"===n?!i.includes("cryptocom"):"injected"===t&&!i.includes(n)))).entries()){let{walletClientType:i,walletBranding:o,chainType:s}=n;("unknown"===i?c:l).push(/*#__PURE__*/t(tw,{connectOnly:a,provider:i,logo:o.icon,displayName:o.name,connector:n},`${r}-${h}-${i}-${s}-${e}`))}if("detected_solana_wallets"===h||"detected_wallets"===h)for(let[e,o]of u.filter((({chainType:e,walletClientType:t})=>{if("solana"===e)return"ethereum-only"!==n&&!i.includes(t)})).entries()){let{walletClientType:n,walletBranding:i,chainType:s}=o;("unknown"===n?c:l).push(/*#__PURE__*/t(tw,{connectOnly:a,provider:n,logo:i.icon,displayName:i.name,connector:o},`${r}-${h}-${n}-${s}-${e}`))}if(lw.includes(h)){let e=u.find((e=>"injected"===e.connectorType&&e.walletClientType===h||e.connectorType===h));if(e&&l.push(/*#__PURE__*/t(tw,{connectOnly:a,provider:h,connector:e},`${r}-${h}`)),"solana-only"===n||"ethereum-and-solana"===n){let e=u.find((({chainType:e,walletClientType:t})=>"solana"===e&&t===h));e&&l.push(/*#__PURE__*/t(tw,{connectOnly:a,provider:h,connector:e},`${h}-solana`))}}else if(ow.includes(h)){let e=u.find((e=>"uniswap"===h?"uniswap_wallet_extension"===e.walletClientType||"uniswap_extension"===e.walletClientType:"cryptocom"===h?"crypto.com_wallet_extension"===e.walletClientType||"crypto.com_onchain"===e.walletClientType:"injected"===e.connectorType&&e.walletClientType===h));if(o&&!e&&(e=p),e&&l.push(/*#__PURE__*/t(tw,{connectOnly:a,provider:h,connector:e,logo:"injected"===e.connectorType?e.walletBranding.icon:void 0,displayName:"injected"===e.connectorType?e.walletBranding.name:void 0},`${r}-${h}`)),"solana-only"===n||"ethereum-and-solana"===n){let e=u.find((({chainType:e,walletClientType:t})=>"solana"===e&&t===h));e&&l.push(/*#__PURE__*/t(tw,{connectOnly:a,provider:h,connector:e},`${h}-solana`))}}else if(iw.includes(h)){let e=u.find((({connectorType:e})=>e===h));e&&l.push(/*#__PURE__*/t(tw,{connectOnly:a,provider:h,connector:e,displayName:"coinbase_wallet"===e.walletClientType?"Coinbase":"Base",logo:"coinbase_wallet"===e.walletClientType?io:oo},`${r}-${h}`))}else if(sw.includes(h))p&&d.push(/*#__PURE__*/t(tw,{connectOnly:a,provider:h,connector:p},`${r}-${h}`));else if("wallet_connect"===h)p&&d.push(/*#__PURE__*/t(tw,{connectOnly:a,provider:h,connector:p,logo:p.walletBranding.icon,displayName:"WalletConnect"},`${r}-${h}`));else if(h===s?.wallet){let n="ethereum"===s.chainType&&e.includes("detected_ethereum_wallets"),i="solana"===s.chainType&&e.includes("detected_solana_wallets");if(e.includes("detected_wallets")||n||i){let e=u.find((({walletClientType:e})=>e===h));e&&l.push(/*#__PURE__*/t(tw,{connectOnly:a,provider:h,displayName:e.walletBranding?.name,logo:e.walletBranding?.icon,connector:e},`${r}-${h}`))}}}return[...c,...l,...d]},dw=({connectOnly:r})=>{let{closePrivyModal:a,connectors:i}=Ft(),{app:l,onUserCloseViaDialogOrKeybindRef:c,data:u}=Is(),{appearance:{palette:{colorScheme:p}}}=ks(),{accountType:h,walletClientType:m,chainType:g}=om(),y=s((()=>h&&"guest"!==h&&"authorization_key"!==h&&"cross_app"!==h?em(h):null),[h]),f=l.loginMethodsAndOrder?.primary??[],w=l.loginMethodsAndOrder?.overflow??[],v=s((()=>[...f,...w]),[f,w]),C=l.loginMethods.passkey,b=u?.login,k=[];m&&v.includes(m)?k.push(m):h&&v.includes(y?.loginMethod)&&k.push(y?.loginMethod);let[A,T]=o("default"),[x,I]=o(kf({mostRecentlyUsedAccountType:h,smsAvailable:v.includes("sms"),emailAvailable:v.includes("email"),prefilledType:b?.prefill?.type}));d((()=>{I(kf({mostRecentlyUsedAccountType:h,smsAvailable:v.includes("sms"),emailAvailable:v.includes("email"),prefilledType:b?.prefill?.type}))}),[v,h]),d((()=>{"phone"===h&&I("sms");let e=v.indexOf("sms"),t=v.indexOf("email");e>-1&&e<t&&I("sms")}),[h,f,w]);let E=()=>{a({shouldCallAuthOnSuccess:!0}),setTimeout((()=>{T("default")}),150)};c.current=E;let S=e=>"email"===e?/*#__PURE__*/t(Hf,{isEditable:"email"===x,setIsEditable:()=>{I("email")},defaultValue:"email"===b?.prefill?.type?b.prefill.value:void 0},e):"sms"===e?/*#__PURE__*/t(af,{isEditable:"sms"===x,setIsEditable:()=>{I("sms")},defaultValue:"phone"===b?.prefill?.type?b.prefill.value:void 0},e):"apple"===e?/*#__PURE__*/t(sf,{provider:"apple"},e):"discord"===e?/*#__PURE__*/t(sf,{provider:"discord"},e):"farcaster"===e?/*#__PURE__*/t(qy,{},e):"github"===e?/*#__PURE__*/t(sf,{provider:"github"},e):"google"===e?/*#__PURE__*/t(sf,{provider:"google"},e):"linkedin"===e?/*#__PURE__*/t(sf,{provider:"linkedin"},e):"spotify"===e?/*#__PURE__*/t(sf,{provider:"spotify"},e):"instagram"===e?/*#__PURE__*/t(sf,{provider:"instagram"},e):"tiktok"===e?/*#__PURE__*/t(sf,{provider:"tiktok"},e):"line"===e?/*#__PURE__*/t(sf,{provider:"line"},e):"twitter"===e?/*#__PURE__*/t(sf,{provider:"twitter"},e):"telegram"===e?/*#__PURE__*/t(pf,{},e):e.startsWith("privy:")?/*#__PURE__*/t(um,{appId:e.replace("privy:","")},e):cw({walletList:l.appearance.walletList,walletChainType:b?.walletChainType??l.appearance.walletChainType,connectors:i,connectOnly:r,ignore:v,walletConnectEnabled:l.externalWallets.walletConnect.enabled,forceWallet:{wallet:e,chainType:g??"ethereum"}}),_=k.flatMap(S),N=f.filter((e=>e!==m&&e!==y?.loginMethod)).flatMap(S),M=w.filter((e=>e!==m&&e!==y?.loginMethod)).flatMap(S),[W,P]=((e,t)=>{let n=[],r=[];for(let[a,i]of e.entries())a<t?n.push(i):r.push(i);return[n,r]})([..._,...N,...M],uw({primary:N.length+_.length,overflow:M.length}));/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t($l,{title:l.appearance.landingHeader,onClose:E,backFn:"default"===A?void 0:()=>{T("default")}}),"default"===A&&/*#__PURE__*/t(pw,{}),"default"===A&&("string"==typeof l.appearance.loginMessage?/*#__PURE__*/t(dl,{children:l.appearance.loginMessage}):l.appearance.loginMessage),/*#__PURE__*/t(ol,{style:{overflow:"hidden"},children:/*#__PURE__*/e(ll,{$colorScheme:p,children:["default"===A&&/*#__PURE__*/e(n,{children:[W,P.length>0&&/*#__PURE__*/t(gf,{text:"More options",icon:/*#__PURE__*/t(Cr,{}),onClick:()=>T("overflow")})]}),"overflow"===A&&/*#__PURE__*/t(n,{children:P}),C&&"default"===A&&/*#__PURE__*/t(Jy,{})]})}),l&&/*#__PURE__*/t(wl,{app:l}),/*#__PURE__*/t(vl,{})]})};let uw=({primary:e,overflow:t})=>e<5?e:5===e&&0===t?5:4,pw=/*#__PURE__*/kn(lm).withConfig({displayName:"StyledAppLogoHeader",componentId:"sc-d846420a-0"})(["margin-bottom:16px;"]);const hw={component:()=>{let{app:e}=Is();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?/*#__PURE__*/t(dw,{connectOnly:!1}):/*#__PURE__*/t(yf,{connectOnly:!1})},isCaptchaRequired:!0,isUnauthenticatedScreem:!0},mw={component:()=>{let[e,n]=o(null),[r,a]=o(!1),[i,s]=o(null),[l,c]=o(""),{authenticated:u,user:p}=on(),{client:h,walletProxy:m,refreshSessionAndUser:g,closePrivyModal:y,createAnalyticsEvent:f}=Ft(),{app:w,navigate:v,data:C,onUserCloseViaDialogOrKeybindRef:b}=Is(),{onSuccess:k,onFailure:A}=C.setWalletPassword,T=nn(p),x="user-passcode"===e?.recoveryMethod,I="user-passcode"===T?.recoveryMethod;d((()=>{u||(v(hw),A(new Mt("User must be authenticated before setting a password on a Privy wallet")))}),[u]);let E=()=>i?(A(i),void y({shouldCallAuthOnSuccess:!1})):x?(k(e),void y({shouldCallAuthOnSuccess:!1})):(A(new _t("Exited before password was added to wallet")),void y({shouldCallAuthOnSuccess:!1}));b.current=E;/*#__PURE__*/return t(Xh,{appName:w?.name||"privy",config:{initiatedBy:"user",onCancel:E},error:i?"An error has occurred, please try again.":void 0,buttonLoading:r,buttonHideAnimations:!1,password:l,isResettingPassword:I,onPasswordGenerate:()=>c(Hh()),onPasswordChange:c,onSubmit:async()=>{x?(k(e),y({shouldCallAuthOnSuccess:!1})):(a(!0),s(null),await(async()=>{let e=await h.getAccessToken();if(e&&p&&T?.address&&l&&m)try{f({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:T.address,existingRecoveryMethod:T.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:I}});let{entropyId:t,entropyIdVerifier:r}=ro(p);if(!(await m.setRecovery({accessToken:e,entropyId:t,entropyIdVerifier:r,recoveryPassword:l,recoveryMethod:"user-passcode"})).entropyId)return s(new _t("Error setting password on privy wallet")),void f({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:T.address,existingRecoveryMethod:T.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:I,reason:"error setting password"}});let a=await g(),i=nn(a);if(!i)return s(new _t("Error setting password on privy wallet")),void f({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:T.address,existingRecoveryMethod:T.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:I,reason:"wallet disconnected"}});n(i),f({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:T.address,existingRecoveryMethod:T.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:I}})}catch(e){console.warn(e),s(e instanceof Error?e:Error("Error setting password on privy wallet")),f({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:T.address,reason:e}})}})(),a(!1))},onClose:E})}},gw=({onClose:r,onProceed:a})=>/*#__PURE__*/t(kc,{title:"Secure Your Account",subtitle:/*#__PURE__*/e(n,{children:["Please set a password to secure your account.",/*#__PURE__*/t("br",{}),"Losing access to this password and this device will make your account inaccessible."]}),icon:Xn,primaryCta:{label:"Add password",onClick:a},onClose:r,watermark:!0}),yw={component:()=>{let{closePrivyModal:e}=Ft(),{data:n,navigate:r,onUserCloseViaDialogOrKeybindRef:a}=Is(),{onFailure:i}=n.setWalletPassword,o=()=>{i(new _t("Exited before password was added to wallet")),e({shouldCallAuthOnSuccess:!1})};return a.current=o,/*#__PURE__*/t(gw,{onClose:o,onProceed:()=>{r(mw)}})}},fw={component:()=>{let[n,r]=o(!0),{authenticated:a,user:i}=on(),{walletProxy:s,closePrivyModal:l,createAnalyticsEvent:c,client:u}=Ft(),{navigate:p,data:h,onUserCloseViaDialogOrKeybindRef:m}=Is(),[g,y]=o(void 0),[f,w]=o(""),[v,C]=o(!1),{entropyId:b,entropyIdVerifier:k,onCompleteNavigateTo:A,onSuccess:T,onFailure:x}=h.recoverWallet,I=(e="User exited before their wallet could be recovered")=>{l({shouldCallAuthOnSuccess:!1}),x("string"==typeof e?new _t(e):e)};m.current=I,d((()=>{if(!a)return I("User must be authenticated and have a Privy wallet before it can be recovered")}),[a]);/*#__PURE__*/return e(gc,{children:[/*#__PURE__*/t(gc.Header,{icon:Nn,title:"Enter your password",subtitle:"Please provision your account on this new device. To continue, enter your recovery password.",showClose:!0,onClose:I}),/*#__PURE__*/t(gc.Body,{children:/*#__PURE__*/t(ww,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/e(yh,{children:[/*#__PURE__*/t(mh,{type:n?"password":"text",onChange:e=>(e=>{e&&y(e)})(e.target.value),disabled:v,style:{paddingRight:"2.3rem"}}),/*#__PURE__*/t(bh,{style:{right:"0.75rem"},children:n?/*#__PURE__*/t(Ah,{onClick:()=>r(!1)}):/*#__PURE__*/t(Th,{onClick:()=>r(!0)})})]}),!!f&&/*#__PURE__*/t(vw,{children:f})]})})}),/*#__PURE__*/e(gc.Footer,{children:[/*#__PURE__*/t(gc.HelpText,{children:/*#__PURE__*/e(Vd,{children:[/*#__PURE__*/t("h4",{children:"Why is this necessary?"}),/*#__PURE__*/t("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]})}),/*#__PURE__*/t(gc.Actions,{children:/*#__PURE__*/t(Cw,{loading:v||!s,disabled:!g,onClick:async()=>{C(!0);let e=await u.getAccessToken(),t=dn(i,b);if(!e||!t||null===g)return I("User must be authenticated and have a Privy wallet before it can be recovered");try{c({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:t.address}}),await(s?.recover({accessToken:e,entropyId:b,entropyIdVerifier:k,recoveryPassword:g})),w(""),A?p(A):l({shouldCallAuthOnSuccess:!1}),T?.(t),c({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:t.address}})}catch(e){!function(e){return Du(e)&&("invalid_recovery_pin"===e.type||"invalid_request_arguments"===e.type)}(e)?w("An error has occurred, please try again."):w("Invalid recovery password, please try again.")}finally{C(!1)}},$hideAnimations:!b&&v,children:"Recover your account"})}),/*#__PURE__*/t(gc.Watermark,{})]})]})}};let ww=/*#__PURE__*/kn.div.withConfig({displayName:"Content",componentId:"sc-f366413c-0"})(["display:flex;flex-direction:column;gap:1.5rem;"]),vw=/*#__PURE__*/kn.div.withConfig({displayName:"ErrorMessage",componentId:"sc-f366413c-1"})(["line-height:20px;height:20px;font-size:13px;color:var(--privy-color-error);text-align:left;margin-top:0.5rem;"]),Cw=/*#__PURE__*/kn(Ml).withConfig({displayName:"NoAnimationPrimaryButton",componentId:"sc-f366413c-2"})(["",""],(({$hideAnimations:e})=>e&&/*#__PURE__*/An(["&&{transition:none;}"])));const bw={component:()=>{let{app:e,navigate:n,data:r,onUserCloseViaDialogOrKeybindRef:a}=Is(),[i,s]=o(""),[l,c]=o(!1),[u,p]=o(),[h,m]=o(null),{create:g}=Xp(),{authenticated:y,user:f}=on(),{closePrivyModal:w,isNewUserThisSession:v,initializeWalletProxy:C}=Ft(),{onSuccess:b,onFailure:k,callAuthOnSuccessOnClose:A,shouldCreateEth:T,shouldCreateSol:x}=r.createWallet,[I,E]=o(null),S=new va((async()=>{try{let e;if(T&&x)e=await g({recoveryMethod:"user-passcode",recoveryPassword:u,chainType:"ethereum",walletIndex:0,latestUser:f}),e=await g({chainType:"solana",walletIndex:0,latestUser:e.user});else if(x)e=await g({recoveryMethod:"user-passcode",recoveryPassword:u,chainType:"solana",walletIndex:0,latestUser:f});else{if(!T)throw Error("Invalid args to create wallet");e=await g({recoveryMethod:"user-passcode",recoveryPassword:u,chainType:"ethereum",walletIndex:0,latestUser:f})}E(e),v?n(eh):(b(e),w({shouldCallAuthOnSuccess:A}))}catch(e){s(e.message)}}));d((()=>{h||C(3e4).then((e=>m(e)))}),[h]),d((()=>{if(!y||!f)return n(hw),void k(Error("User must be authenticated before creating a Privy wallet"))}),[y]),a.current=()=>null;/*#__PURE__*/return t(Xh,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:!h,buttonLoading:l,buttonHideAnimations:!I&&l,isResettingPassword:!1,error:i,password:u||"",onClose:()=>{I&&"user-passcode"!==I.account.recoveryMethod?(k(new _t("User created a wallet but failed to set a password for it")),w({shouldCallAuthOnSuccess:!1})):I?(b(I),w({shouldCallAuthOnSuccess:A})):(k(new _t("User wallet creation failed")),w({shouldCallAuthOnSuccess:!1}))},onPasswordChange:p,onPasswordGenerate:()=>p(Hh()),onSubmit:async()=>(c(!0),S.execute().then((()=>new Promise((e=>setTimeout(e,250))))).finally((()=>c(!1))))})}},kw=/*#__PURE__*/kn.div.withConfig({displayName:"WithCircleBorder",componentId:"sc-e4fc5563-0"})(["&&{border-width:4px;}display:flex;justify-content:center;align-items:center;padding:1rem;aspect-ratio:1;border-style:solid;border-color:",";border-radius:50%;"],(e=>e.$color??"var(--privy-color-accent)")),Aw=/*#__PURE__*/kn.span.withConfig({displayName:"Subtitle",componentId:"sc-7a11f796-0"})(["margin-top:4px;color:var(--privy-color-foreground);text-align:center;font-size:0.875rem;font-weight:400;line-height:1.375rem;&& a{color:var(--privy-color-accent);}"]),Tw=/*#__PURE__*/kn.span.withConfig({displayName:"Title",componentId:"sc-66de63c-0"})(["color:var(--privy-color-foreground);font-size:1.125rem;font-weight:600;line-height:1.875rem;text-align:center;"]),xw={component:()=>{let{user:r}=on(),{client:a,walletProxy:i,refreshSessionAndUser:s,closePrivyModal:l}=Ft(),c=Is(),{entropyId:d,entropyIdVerifier:u}=c.data?.recoverWallet,[p,h]=o(!1),[m,g]=o(null),[y,f]=o(null);function w(){if(!p){if(y)return c.data?.setWalletPassword?.onFailure(y),void l();if(!m)return c.data?.setWalletPassword?.onFailure(Error("User exited set recovery flow")),void l()}}c.onUserCloseViaDialogOrKeybindRef.current=w;let v=!(!p&&!m);/*#__PURE__*/return e(n,y?{children:[/*#__PURE__*/t($l,{onClose:w},"header"),/*#__PURE__*/t(kw,{$color:"var(--privy-color-error)",style:{alignSelf:"center"},children:/*#__PURE__*/t(Fn,{height:38,width:38,stroke:"var(--privy-color-error)"})}),/*#__PURE__*/t(Tw,{style:{marginTop:"0.5rem"},children:"Something went wrong"}),/*#__PURE__*/t(il,{style:{minHeight:"2rem"}}),/*#__PURE__*/t(Wl,{onClick:()=>f(null),children:"Try again"}),/*#__PURE__*/t(vl,{})]}:{children:[/*#__PURE__*/t($l,{onClose:w},"header"),/*#__PURE__*/t(Pr,{style:{width:"3rem",height:"3rem",alignSelf:"center"}}),/*#__PURE__*/t(Tw,{style:{marginTop:"0.5rem"},children:"Automatically secure your account"}),/*#__PURE__*/t(Aw,{style:{marginTop:"1rem"},children:"When you log into a new device, you’ll only need to authenticate to access your account. Never get logged out if you forget your password."}),/*#__PURE__*/t(il,{style:{minHeight:"2rem"}}),/*#__PURE__*/t(Wl,{loading:p,disabled:v,onClick:()=>async function(){h(!0);try{let e=await a.getAccessToken(),t=dn(r,d);if(!e||!i||!t)return;if(!(await i.setRecovery({accessToken:e,entropyId:d,entropyIdVerifier:u,existingRecoveryMethod:t.recoveryMethod,recoveryMethod:"privy"})).entropyId)throw Error("Unable to set recovery on wallet");let n=await s();if(!n)throw Error("Unable to set recovery on wallet");let o=dn(n,t.address);if(!o)throw Error("Unabled to set recovery on wallet");g(!!n),setTimeout((()=>{c.data?.setWalletPassword?.onSuccess(o),l()}),ka)}catch(e){f(e)}finally{h(!1)}}(),children:m?"Success":"Confirm"}),/*#__PURE__*/t(vl,{})]})}};function Iw({isCreatingWallet:e,skipSplashScreen:t}){return e?bw:t?mw:yw}function Ew({walletAction:e,availableRecoveryMethods:t,legacySetWalletPasswordFlow:n,isResettingPassword:r,showAutomaticRecovery:a}){return a?xw:n||1===t.length?Iw({isCreatingWallet:"create"===e,skipSplashScreen:r}):lh}function Sw(e){switch(e){case"user-passcode":return fw;case"google-drive":case"icloud":return ah;default:throw Error("Recovery method not supported")}}const _w=({children:n,theme:r})=>/*#__PURE__*/e(Nw,{$theme:r,children:[/*#__PURE__*/t(jr,{width:"20px",height:"20px",color:"var(--privy-color-icon-subtle)",strokeWidth:2,style:{flexShrink:0}}),/*#__PURE__*/t(Mw,{$theme:r,children:n})]});let Nw=/*#__PURE__*/kn.div.withConfig({displayName:"Container",componentId:"sc-1b5ed8dd-0"})(["display:flex;gap:0.75rem;background-color:var(--privy-color-background-2);align-items:flex-start;padding:1rem;border-radius:0.75rem;"]),Mw=/*#__PURE__*/kn.div.withConfig({displayName:"Content",componentId:"sc-1b5ed8dd-1"})(["color:",";font-size:1rem;font-weight:400;line-height:1.5;flex:1;text-align:left;"],(e=>"dark"===e.$theme?"var(--privy-color-foreground-2)":"var(--privy-color-foreground)"));const Ww=/*#__PURE__*/An(["&&{border-width:1px;padding:0.5rem 1rem;}width:100%;text-align:left;border:solid 1px var(--privy-color-foreground-4);border-radius:var(--privy-border-radius-md);display:flex;justify-content:space-between;align-items:center;",""],(e=>"error"===e.$state?"\n border-color: var(--privy-color-error);\n background: var(--privy-color-error-bg);\n ":"")),Pw=/*#__PURE__*/kn.div.withConfig({displayName:"Box",componentId:"sc-7252360a-0"})(["",""],Ww);let Uw=/*#__PURE__*/kn(Pw).withConfig({displayName:"StyledBox",componentId:"sc-4010d8f3-0"})(["&&{padding:0.75rem;height:56px;}"]),Fw=/*#__PURE__*/kn.div.withConfig({displayName:"WalletContent",componentId:"sc-4010d8f3-1"})(["display:flex;align-items:center;justify-content:space-between;width:100%;"]),Ow=/*#__PURE__*/kn.div.withConfig({displayName:"AddressContainer",componentId:"sc-4010d8f3-2"})(["display:flex;flex-direction:column;gap:0;"]),Lw=/*#__PURE__*/kn.div.withConfig({displayName:"BalanceText",componentId:"sc-4010d8f3-3"})(["font-size:12px;line-height:1rem;color:var(--privy-color-foreground-3);"]),Rw=/*#__PURE__*/kn(_y).withConfig({displayName:"TitleLabel",componentId:"sc-4010d8f3-4"})(["text-align:left;margin-bottom:0.5rem;"]),Dw=/*#__PURE__*/kn(mg).withConfig({displayName:"StyledErrorMessage",componentId:"sc-4010d8f3-5"})(["margin-top:0.25rem;"]),Bw=/*#__PURE__*/kn(Fl).withConfig({displayName:"CopyButton",componentId:"sc-4010d8f3-6"})(["&&{gap:0.375rem;font-size:14px;}"]);const zw=({errMsg:r,balance:a,address:i,className:s,title:l,showCopyButton:c=!1})=>{let[u,p]=o(!1);return d((()=>{if(u){let e=setTimeout((()=>p(!1)),3e3);return()=>clearTimeout(e)}}),[u]),/*#__PURE__*/e("div",{children:[l&&/*#__PURE__*/t(Rw,{children:l}),/*#__PURE__*/t(Uw,{className:s,$state:r?"error":void 0,children:/*#__PURE__*/e(Fw,{children:[/*#__PURE__*/e(Ow,{children:[/*#__PURE__*/t(pp,{address:i,showCopyIcon:!1}),void 0!==a&&/*#__PURE__*/t(Lw,{children:a})]}),c&&/*#__PURE__*/t(Bw,{onClick:function(e){e.stopPropagation(),navigator.clipboard.writeText(i).then((()=>p(!0))).catch(console.error)},size:"sm",children:/*#__PURE__*/e(n,u?{children:["Copied",/*#__PURE__*/t(qn,{size:14})]}:{children:["Copy",/*#__PURE__*/t(Kn,{size:14})]})})]})}),r&&/*#__PURE__*/t(Dw,{children:r})]})};function Hw({rpcConfig:e,appId:t,address:n,chain:r}){let{chains:a}=Ft(),[i,l]=o(0n),[c,p]=o(!1),h=s((()=>{let n=r||a[0];if(n)return Lt({chain:r,transport:Rt(Wi(n,e,t))})}),[r,e,t]),m=u((async()=>{if(!n||!h)return;p(!0);let e=await h.getBalance({address:n}).catch(console.error);return e?(l(e),p(!1),e):void 0}),[h,n,l]);return d((()=>{m().catch(console.error)}),[]),{balance:i,isLoading:c,reloadBalance:m}}const Vw="sdk_fiat_on_ramp_completed_with_status",$w=async({chain:e,address:t,appId:n,rpcConfig:r,erc20Address:a})=>{let i=Lt({chain:e,transport:Rt(Wi(e,r,n))});return{balance:await i.readContract({address:a,abi:jw,functionName:"balanceOf",args:[t]}).catch((()=>0n)),chain:e}};let jw=[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"}];const qw=Symbol("solana-funding-plugin"),Kw=async({emitPrivyEvent:e,getAccessToken:t,initializeWalletProxy:n,refreshSessionAndUser:r,user:a,appConfig:i},{privateKey:o,chainType:s})=>{if(!a)throw e("linkAccount","onError",Te.MUST_BE_AUTHENTICATED,{linkMethod:"siwe"}),new he("User must be authenticated before linking an account.");let[l,c]=await Promise.all([t(),n(15e3)]);if(!c||!l)throw e("linkAccount","onError",Te.MUST_BE_AUTHENTICATED,{linkMethod:"siwe"}),new he("User must be authenticated before linking an account.");await c.importWallet({privateKey:o,accessToken:l,chainType:s,mode:"user-controlled-server-wallets-only"===i.embeddedWallets.mode?"tee":"on-device"});let d=await r(),u="solana"===s?un(d):pn(d);if(!u)throw e("createWallet","onError",Te.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to import wallet");return e("createWallet","onSuccess",{wallet:u}),u};class Gw{async handleSignMessage(e){if(!e.params||"string"!=typeof e.params.message)throw Error("Message must be provided as a string for Solana signMessage RPC");let t=await this.signMessage(Ai(e.params.message,"base64"));return{signature:Ai(t).toString("base64")}}async request(e){if(console.debug("EmbeddedSolanaProvider.request() called with args",e),!await QA())throw Error("User must be authenticated to use embedded Solana wallet");if(!await rT({address:this.address}))throw new he("Unable to connect to Solana embedded wallet");if("signMessage"===e.method)return await this.handleSignMessage(e);throw Error("Embedded Solana provider does not yet support this RPC method.")}constructor(e,t,n){this.walletProxy=e,this.address=t,this.signMessage=n}}async function Zw({tx:e,accessToken:t,walletProxy:n,entropyId:r,entropyIdVerifier:a,transactingWalletAddress:i,transactingWalletIndex:o}){let s=Cd(e,i),l=vd(e)?Ai(e.message.serialize()):e.serializeMessage(),{response:c}=await n.rpc({accessToken:t,entropyId:r,entropyIdVerifier:a,chainType:"solana",hdWalletIndex:o,request:{method:"signMessage",params:{message:l.toString("base64")}}}),d=Ai(c.data.signature,"base64");return e.addSignature(s,d),e}const Yw=e=>e.reduce(((e,t)=>!e||e.walletIndex<t.walletIndex?t:e),null);let Qw=async({accessToken:e,appConfig:t,privy:n,emitPrivyEvent:r,proxy:a,refreshSessionAndUser:i,recoverEmbeddedWallet:o,user:s,walletIndex:l,setModalData:c,openModal:d,chainType:u,setUser:p})=>{if(l<0)throw r("createWallet","onError",Te.EMBEDDED_WALLET_CREATE_ERROR),Error(`A negative walletIndex (${l}) is invalid.`);let h=nn(s);if(l>0&&!h)throw r("createWallet","onError",Te.EMBEDDED_WALLET_NOT_FOUND),Error("Must have an existing embedded wallet to create an additional wallet.");if(t.embeddedWallets.requireUserOwnedRecoveryOnCreate&&"user-controlled-server-wallets-only"===t.embeddedWallets.mode)throw r("createWallet","onError",Te.EMBEDDED_WALLET_CREATE_ERROR),Error("User owned recovery not yet supported for this app.");if(!h&&t.embeddedWallets.requireUserOwnedRecoveryOnCreate)return await Xw({emitPrivyEvent:r,setModalData:c,openModal:d,chainType:u});let m=Yp(s,{chainType:u,walletIndex:l})[0];if(m)return{user:s,account:m};if(0===l&&!a)return Xw({emitPrivyEvent:r,setModalData:c,openModal:d,chainType:u});if(!a)throw r("createWallet","onError",Te.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to connect to wallet proxy");return Qp({appConfig:t,walletIndex:l,chainType:u,user:s,accessToken:e,proxy:a,refreshSessionAndUser:i,privy:n,recoverEmbeddedWallet:o,setUser:p})},Xw=async({emitPrivyEvent:e,setModalData:t,openModal:n,chainType:r})=>new Promise(((a,i)=>{t({createWallet:{onSuccess:({user:t,account:n})=>{e("createWallet","onSuccess",{wallet:n}),a({user:t,account:n})},onFailure:t=>{e("createWallet","onError",Te.UNKNOWN_EMBEDDED_WALLET_ERROR),i(t)},callAuthOnSuccessOnClose:!1,shouldCreateEth:"ethereum"===r,shouldCreateSol:"solana"===r}}),n(Zm)}));const Jw=()=>{let e=ks(),t=rl(),{setModalData:n}=Is(),{initializeWalletProxy:r,recoverEmbeddedWallet:a,setUser:i,openModal:o,refreshSessionAndUser:s,privy:l,client:c}=Ft();return{create:async({chainType:d,options:u,latestUser:p})=>{let h=p;if(h||(h=await s()),!h)throw t("createWallet","onError",Te.MUST_BE_AUTHENTICATED),Error("User must be authenticated before creating a Privy wallet");return await(async({appConfig:e,getAccessToken:t,initializeWalletProxy:n,user:r,privy:a,emitPrivyEvent:i,recoverEmbeddedWallet:o,setModalData:s,openModal:l,setUser:c,options:d,timeoutDuration:u,refreshSessionAndUser:p,chainType:h})=>{let[m,g]=await Promise.all([n(u),t()]);if(!g||!r)throw i("createWallet","onError",Te.MUST_BE_AUTHENTICATED),Error("User must be authenticated before creating a Privy wallet");if(!m&&e.customAuth?.enabled)throw i("createWallet","onError",Te.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to connect to wallet proxy");if(d&&"walletIndex"in d&&"number"==typeof d.walletIndex){if("user-controlled-server-wallets-only"===e.embeddedWallets.mode)throw i("createWallet","onError",Te.INVALID_DATA),Error("Invalid input, use `createAdditional` instead of `walletIndex` to create additional wallets.");return Qw({accessToken:g,appConfig:e,privy:a,emitPrivyEvent:i,openModal:l,proxy:m,refreshSessionAndUser:p,recoverEmbeddedWallet:o,setModalData:s,user:r,walletIndex:d.walletIndex,chainType:h,setUser:c})}let y=d&&"createAdditional"in d&&d.createAdditional,f=Yp(r,{chainType:h});if(f[0]&&!y)throw i("createWallet","onError",Te.EMBEDDED_WALLET_ALREADY_EXISTS),Error("User already has an embedded wallet.");return Qw({accessToken:g,appConfig:e,privy:a,emitPrivyEvent:i,openModal:l,proxy:m,recoverEmbeddedWallet:o,setModalData:s,user:r,walletIndex:(Yw(f)?.walletIndex??-1)+1,chainType:h,refreshSessionAndUser:p,setUser:c})})({appConfig:e,privy:l,getAccessToken:()=>c.getAccessToken(),refreshSessionAndUser:s,initializeWalletProxy:r,user:h,emitPrivyEvent:t,recoverEmbeddedWallet:a,setModalData:n,openModal:o,setUser:i,options:u,timeoutDuration:$a,chainType:d})}}};function ev(e){let{create:t}=Jw();return tl("createWallet",e),{createWallet:async e=>{e&&"target"in e&&e&&(e=void 0);let{account:n}=await t({chainType:"ethereum",options:e});return n}}}const tv=()=>{let{user:e}=on(),{client:t,refreshSessionAndUser:n,initializeWalletProxy:r}=Ft(),a=rl(),i=ks();return{importWallet:u((({privateKey:o})=>Kw({getAccessToken:()=>t.getAccessToken(),user:e,initializeWalletProxy:r,refreshSessionAndUser:n,emitPrivyEvent:a,appConfig:i},{privateKey:o,chainType:"ethereum"})),[e,t,n,r,a])}},nv=()=>{let{importWallet:e}=tv(),{createWallet:t}=ev();return{...l(sn),importWallet:e,createWallet:t}},rv=e=>e.filter((e=>"wallets"===e.method||("exchange"===e.method?"coinbase"===e.provider:"card"===e.method||"payment-request"===e.method?"coinbase"===e.provider||"moonpay"===e.provider:(e.method,!1)))),av=e=>!!e.fundingConfig&&rv(e.fundingConfig.options).length>=1,iv=[{constant:!1,inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}];let ov=2n**256n-1n;const sv=({amount:e,decimals:t})=>e===ov?"Maximum":Intl.NumberFormat(void 0,{maximumFractionDigits:t}).format(Number(e)/10**t),lv=({chains:e,appId:t,address:n,rpcConfig:r,includeUsdc:a})=>Promise.all(e.map((async e=>{let i=Lt({chain:e,transport:Rt(Wi(e,r,t))}),o=await i.getBalance({address:n}).catch((()=>0n)),s=null,l=B[e.id];if(a&&l){let{balance:a}=await $w({address:n,chain:e,rpcConfig:r,appId:t,erc20Address:l});s=a}return{balance:o,erc20Balance:s,erc20Address:l,chain:e}}))),cv=/*#__PURE__*/kn.span.withConfig({displayName:"Rows",componentId:"sc-b764aab6-0"})(["display:flex;flex-direction:column;gap:0.35rem;width:100%;"]),dv=/*#__PURE__*/kn.span.withConfig({displayName:"Row",componentId:"sc-b764aab6-1"})(["display:flex;width:100%;justify-content:space-between;gap:0.5rem;"]),uv=/*#__PURE__*/kn.span.withConfig({displayName:"LabelSm",componentId:"sc-6c002d6-0"})(["color:var(--privy-color-foreground-3);font-size:0.875rem;font-weight:400;line-height:1.375rem;"]),pv=/*#__PURE__*/kn(uv).withConfig({displayName:"LabelSmPrimary",componentId:"sc-6c002d6-1"})(["color:var(--privy-color-accent);"]),hv=/*#__PURE__*/kn.span.withConfig({displayName:"Value",componentId:"sc-72aa026-0"})(["color:var(--privy-color-foreground);font-size:0.875rem;font-weight:500;line-height:1.375rem;word-break:break-all;text-align:right;",""],Ay),mv=n=>/*#__PURE__*/e("svg",{xmlns:"http://www.w3.org/2000/svg",version:"1.1",id:"Layer_1",x:"0px",y:"0px",viewBox:"0 0 397.7 311.7",enableBackground:"new 0 0 397.7 311.7",xmlSpace:"preserve",...n,children:[/*#__PURE__*/e("linearGradient",{id:"SVGID_1_",gradientUnits:"userSpaceOnUse",x1:"360.8791",y1:"351.4553",x2:"141.213",y2:"-69.2936",gradientTransform:"matrix(1 0 0 -1 0 314)",children:[/*#__PURE__*/t("stop",{offset:"0",stopColor:"#00FFA3"}),/*#__PURE__*/t("stop",{offset:"1",stopColor:"#DC1FFF"})]}),/*#__PURE__*/t("path",{d:"M64.6,237.9c2.4-2.4,5.7-3.8,9.2-3.8h317.4c5.8,0,8.7,7,4.6,11.1l-62.7,62.7c-2.4,2.4-5.7,3.8-9.2,3.8H6.5 c-5.8,0-8.7-7-4.6-11.1L64.6,237.9z",fill:"url(#SVGID_1_)"}),/*#__PURE__*/e("linearGradient",{id:"SVGID_2_",gradientUnits:"userSpaceOnUse",x1:"264.8291",y1:"401.6014",x2:"45.163",y2:"-19.1475",gradientTransform:"matrix(1 0 0 -1 0 314)",children:[/*#__PURE__*/t("stop",{offset:"0",stopColor:"#00FFA3"}),/*#__PURE__*/t("stop",{offset:"1",stopColor:"#DC1FFF"})]}),/*#__PURE__*/t("path",{d:"M64.6,3.8C67.1,1.4,70.4,0,73.8,0h317.4c5.8,0,8.7,7,4.6,11.1l-62.7,62.7c-2.4,2.4-5.7,3.8-9.2,3.8H6.5 c-5.8,0-8.7-7-4.6-11.1L64.6,3.8z",fill:"url(#SVGID_2_)"}),/*#__PURE__*/e("linearGradient",{id:"SVGID_3_",gradientUnits:"userSpaceOnUse",x1:"312.5484",y1:"376.688",x2:"92.8822",y2:"-44.061",gradientTransform:"matrix(1 0 0 -1 0 314)",children:[/*#__PURE__*/t("stop",{offset:"0",stopColor:"#00FFA3"}),/*#__PURE__*/t("stop",{offset:"1",stopColor:"#DC1FFF"})]}),/*#__PURE__*/t("path",{d:"M333.1,120.1c-2.4-2.4-5.7-3.8-9.2-3.8H6.5c-5.8,0-8.7,7-4.6,11.1l62.7,62.7c2.4,2.4,5.7,3.8,9.2,3.8h317.4 c5.8,0,8.7-7,4.6-11.1L333.1,120.1z",fill:"url(#SVGID_3_)"})]});let gv={[z.id]:n=>/*#__PURE__*/t("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",version:"1.1",id:"Layer_1",x:"0px",y:"0px",viewBox:"0 0 2500 2500",xmlSpace:"preserve",...n,children:/*#__PURE__*/t("g",{id:"Layer_x0020_1",children:/*#__PURE__*/e("g",{id:"_2405588477232",children:[/*#__PURE__*/t("rect",{fill:"none",width:"2500",height:"2500"}),/*#__PURE__*/t("g",{children:/*#__PURE__*/e("g",{children:[/*#__PURE__*/t("path",{fill:"#213147",d:"M226,760v980c0,63,33,120,88,152l849,490c54,31,121,31,175,0l849-490c54-31,88-89,88-152V760 c0-63-33-120-88-152l-849-490c-54-31-121-31-175,0L314,608c-54,31-87,89-87,152H226z"}),/*#__PURE__*/t("g",{children:/*#__PURE__*/e("g",{children:[/*#__PURE__*/t("g",{children:/*#__PURE__*/t("path",{fill:"#12AAFF",d:"M1435,1440l-121,332c-3,9-3,19,0,29l208,571l241-139l-289-793C1467,1422,1442,1422,1435,1440z"})}),/*#__PURE__*/t("g",{children:/*#__PURE__*/t("path",{fill:"#12AAFF",d:"M1678,882c-7-18-32-18-39,0l-121,332c-3,9-3,19,0,29l341,935l241-139L1678,883V882z"})})]})}),/*#__PURE__*/t("g",{children:/*#__PURE__*/t("path",{fill:"#9DCCED",d:"M1250,155c6,0,12,2,17,5l918,530c11,6,17,18,17,30v1060c0,12-7,24-17,30l-918,530c-5,3-11,5-17,5 s-12-2-17-5l-918-530c-11-6-17-18-17-30V719c0-12,7-24,17-30l918-530c5-3,11-5,17-5l0,0V155z M1250,0c-33,0-65,8-95,25L237,555 c-59,34-95,96-95,164v1060c0,68,36,130,95,164l918,530c29,17,62,25,95,25s65-8,95-25l918-530c59-34,95-96,95-164V719 c0-68-36-130-95-164L1344,25c-29-17-62-25-95-25l0,0H1250z"})}),/*#__PURE__*/t("polygon",{fill:"#213147",points:"642,2179 727,1947 897,2088 738,2234 "}),/*#__PURE__*/e("g",{children:[/*#__PURE__*/t("path",{fill:"#FFFFFF",d:"M1172,644H939c-17,0-33,11-39,27L401,2039l241,139l550-1507c5-14-5-28-19-28L1172,644z"}),/*#__PURE__*/t("path",{fill:"#FFFFFF",d:"M1580,644h-233c-17,0-33,11-39,27L738,2233l241,139l620-1701c5-14-5-28-19-28V644z"})]})]})})]})})}),[H.id]:n=>/*#__PURE__*/e("svg",{width:"1503",height:"1504",viewBox:"0 0 1503 1504",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n,children:[/*#__PURE__*/t("rect",{x:"287",y:"258",width:"928",height:"844",fill:"white"}),/*#__PURE__*/t("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1502.5 752C1502.5 1166.77 1166.27 1503 751.5 1503C336.734 1503 0.5 1166.77 0.5 752C0.5 337.234 336.734 1 751.5 1C1166.27 1 1502.5 337.234 1502.5 752ZM538.688 1050.86H392.94C362.314 1050.86 347.186 1050.86 337.962 1044.96C327.999 1038.5 321.911 1027.8 321.173 1015.99C320.619 1005.11 328.184 991.822 343.312 965.255L703.182 330.935C718.495 303.999 726.243 290.531 736.021 285.55C746.537 280.2 759.083 280.2 769.599 285.55C779.377 290.531 787.126 303.999 802.438 330.935L876.42 460.079L876.797 460.738C893.336 489.635 901.723 504.289 905.385 519.669C909.443 536.458 909.443 554.169 905.385 570.958C901.695 586.455 893.393 601.215 876.604 630.549L687.573 964.702L687.084 965.558C670.436 994.693 661.999 1009.46 650.306 1020.6C637.576 1032.78 622.263 1041.63 605.474 1046.62C590.161 1050.86 573.004 1050.86 538.688 1050.86ZM906.75 1050.86H1115.59C1146.4 1050.86 1161.9 1050.86 1171.13 1044.78C1181.09 1038.32 1187.36 1027.43 1187.92 1015.63C1188.45 1005.1 1181.05 992.33 1166.55 967.307C1166.05 966.455 1165.55 965.588 1165.04 964.706L1060.43 785.75L1059.24 783.735C1044.54 758.877 1037.12 746.324 1027.59 741.472C1017.08 736.121 1004.71 736.121 994.199 741.472C984.605 746.453 976.857 759.552 961.544 785.934L857.306 964.891L856.949 965.507C841.69 991.847 834.064 1005.01 834.614 1015.81C835.352 1027.62 841.44 1038.5 851.402 1044.96C860.443 1050.86 875.94 1050.86 906.75 1050.86Z",fill:"#E84142"})]}),[V.id]:n=>/*#__PURE__*/e("svg",{width:"146",height:"146",viewBox:"0 0 146 146",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n,children:[/*#__PURE__*/t("circle",{cx:"73",cy:"73",r:"73",fill:"#0052FF"}),/*#__PURE__*/t("path",{d:"M73.323 123.729C101.617 123.729 124.553 100.832 124.553 72.5875C124.553 44.343 101.617 21.4463 73.323 21.4463C46.4795 21.4463 24.4581 42.0558 22.271 68.2887H89.9859V76.8864H22.271C24.4581 103.119 46.4795 123.729 73.323 123.729Z",fill:"white"})]}),[$.id]:n=>/*#__PURE__*/e("svg",{fill:"none",height:"400",viewBox:"0 0 400 400",width:"400",xmlns:"http://www.w3.org/2000/svg",...n,children:[/*#__PURE__*/t("path",{d:"m0 0h400v400h-400z",fill:"#fcff52"}),/*#__PURE__*/t("path",{d:"m300 100h-200v200h199.996v-69.813h-33.191c-11.442 25.468-37.194 43.206-66.665 43.206-40.63 0-73.533-33.187-73.533-73.533s32.903-73.249 73.533-73.249c30.043 0 55.795 18.313 67.24 44.349h32.62z",fill:"#000"})]}),[j.id]:n=>/*#__PURE__*/e("svg",{width:"200",height:"208",viewBox:"0 0 200 208",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n,children:[/*#__PURE__*/t("rect",{width:"199.4",height:"207.623",fill:"#121212"}),/*#__PURE__*/e("g",{"clip-path":"url(#clip0_2303_643)",children:[/*#__PURE__*/t("path",{d:"M132.369 155.99H49.7001V68.8854H68.6148V139.109H132.369V155.981V155.99Z",fill:"white"}),/*#__PURE__*/t("path",{d:"M132.369 85.7575C141.687 85.7575 149.241 78.2036 149.241 68.8855C149.241 59.5673 141.687 52.0134 132.369 52.0134C123.05 52.0134 115.497 59.5673 115.497 68.8855C115.497 78.2036 123.05 85.7575 132.369 85.7575Z",fill:"white"})]}),/*#__PURE__*/t("defs",{children:/*#__PURE__*/t("clipPath",{id:"clip0_2303_643",children:/*#__PURE__*/t("rect",{width:"99.5407",height:"103.977",fill:"white",transform:"translate(49.7001 52.0134)"})})})]}),[_.id]:n=>/*#__PURE__*/e("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 327.5 533.3",enableBackground:"new 0 0 327.5 533.3;",xmlSpace:"preserve",...n,children:[/*#__PURE__*/t("path",{fill:"#8492B2",d:"M163.7,197.2V0L0,271.6L163.7,197.2z"}),/*#__PURE__*/t("path",{fill:"#62688F",d:"M163.7,368.4V197.2L0,271.6L163.7,368.4z M163.7,197.2l163.7,74.4L163.7,0V197.2z"}),/*#__PURE__*/t("path",{fill:"#454A75",d:"M163.7,197.2v171.2l163.7-96.8L163.7,197.2z"}),/*#__PURE__*/t("path",{fill:"#8492B2",d:"M163.7,399.4L0,302.7l163.7,230.7V399.4z"}),/*#__PURE__*/t("path",{fill:"#62688F",d:"M327.5,302.7l-163.8,96.7v134L327.5,302.7z"})]}),[q.id]:n=>/*#__PURE__*/e("svg",{width:"500",height:"500",viewBox:"0 0 500 500",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n,children:[/*#__PURE__*/t("circle",{cx:"250",cy:"250",r:"250",fill:"#FF0420"}),/*#__PURE__*/t("path",{d:"M177.133 316.446C162.247 316.446 150.051 312.943 140.544 305.938C131.162 298.808 126.471 288.676 126.471 275.541C126.471 272.789 126.784 269.411 127.409 265.408C129.036 256.402 131.35 245.581 134.352 232.947C142.858 198.547 164.812 181.347 200.213 181.347C209.845 181.347 218.476 182.973 226.107 186.225C233.738 189.352 239.742 194.106 244.12 200.486C248.498 206.74 250.688 214.246 250.688 223.002C250.688 225.629 250.375 228.944 249.749 232.947C247.873 244.08 245.621 254.901 242.994 265.408C238.616 282.546 231.048 295.368 220.29 303.874C209.532 312.255 195.147 316.446 177.133 316.446ZM179.76 289.426C186.766 289.426 192.707 287.362 197.586 283.234C202.59 279.106 206.155 272.789 208.281 264.283C211.158 252.524 213.348 242.266 214.849 233.51C215.349 230.883 215.599 228.194 215.599 225.441C215.599 214.058 209.657 208.366 197.774 208.366C190.768 208.366 184.764 210.43 179.76 214.558C174.882 218.687 171.379 225.004 169.253 233.51C167.001 241.891 164.749 252.149 162.498 264.283C161.997 266.784 161.747 269.411 161.747 272.163C161.747 283.672 167.752 289.426 179.76 289.426Z",fill:"white"}),/*#__PURE__*/t("path",{d:"M259.303 314.57C257.927 314.57 256.863 314.132 256.113 313.256C255.487 312.255 255.3 311.13 255.55 309.879L281.444 187.914C281.694 186.538 282.382 185.412 283.508 184.536C284.634 183.661 285.822 183.223 287.073 183.223H336.985C350.87 183.223 362.003 186.1 370.384 191.854C378.891 197.609 383.144 205.927 383.144 216.81C383.144 219.937 382.769 223.19 382.018 226.567C378.891 240.953 372.574 251.586 363.067 258.466C353.685 265.346 340.8 268.786 324.413 268.786H299.082L290.451 309.879C290.2 311.255 289.512 312.38 288.387 313.256C287.261 314.132 286.072 314.57 284.822 314.57H259.303ZM325.727 242.892C330.98 242.892 335.546 241.453 339.424 238.576C343.427 235.699 346.054 231.571 347.305 226.192C347.68 224.065 347.868 222.189 347.868 220.563C347.868 216.935 346.805 214.183 344.678 212.307C342.551 210.305 338.924 209.305 333.795 209.305H311.278L304.148 242.892H325.727Z",fill:"white"})]}),[K.id]:n=>/*#__PURE__*/e("svg",{width:"360",height:"360",viewBox:"0 0 360 360",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n,children:[/*#__PURE__*/t("rect",{width:"360",height:"360",rx:"180",fill:"#6C00F6"}),/*#__PURE__*/t("path",{d:"M157.743 154.241L141.052 144.58L90.9766 173.561V231.519L141.052 260.5L191.13 231.519V141.359L218.948 125.26L246.77 141.359V173.561L218.948 189.66L202.257 180.002V205.759L218.948 215.42L269.024 186.439V128.481L218.948 99.5L168.873 128.481V218.641L141.052 234.74L113.233 218.641V186.439L141.052 170.34L157.743 179.998V154.241Z",fill:"white"})]}),[G.id]:n=>/*#__PURE__*/e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"30",height:"30",viewBox:"0 0 30 30",fill:"none",...n,children:[/*#__PURE__*/t("g",{clipPath:"url(#clip0)",children:/*#__PURE__*/t("g",{clipPath:"url(#clip1)",children:/*#__PURE__*/t("path",{d:"M14.9188 29.8373C6.67944 29.8373 0.00012207 23.1581 0.00012207 14.9187C0.00012207 6.67931 6.67944 0 14.9188 0C23.1581 0 29.8373 6.67931 29.8373 14.9187C29.8373 23.1581 23.1581 29.8373 14.9188 29.8373Z",fill:"url(#paint0)"})})}),/*#__PURE__*/e("defs",{children:[/*#__PURE__*/e("radialGradient",{id:"paint0",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(21.6921 8.02215) rotate(180) scale(25.2008)",children:[/*#__PURE__*/t("stop",{offset:"0.00682297",stopColor:"#F2CEFE"}),/*#__PURE__*/t("stop",{offset:"0.1913",stopColor:"#AFBAF1"}),/*#__PURE__*/t("stop",{offset:"0.4982",stopColor:"#4281D3"}),/*#__PURE__*/t("stop",{offset:"0.666667",stopColor:"#2E427D"}),/*#__PURE__*/t("stop",{offset:"0.822917",stopColor:"#230101"}),/*#__PURE__*/t("stop",{offset:"1",stopColor:"#8F6B40"})]}),/*#__PURE__*/t("clipPath",{id:"clip0",children:/*#__PURE__*/t("rect",{width:"30",height:"30",fill:"white"})}),/*#__PURE__*/t("clipPath",{id:"clip1",children:/*#__PURE__*/t("rect",{width:"30",height:"30",fill:"white"})})]})]})};const yv=({chainId:e,...n})=>{if("solana"===e)/*#__PURE__*/return t(mv,{...n});let r=gv[e];/*#__PURE__*/return t(r||Zr,{...n})},fv=({balance:e,className:n,chain:r})=>/*#__PURE__*/t(Pw,{className:n,$state:void 0,children:/*#__PURE__*/t(wv,{balance:e,chain:r})}),wv=({balance:r,chain:a})=>/*#__PURE__*/e(n,{children:[/*#__PURE__*/e(vv,{children:[/*#__PURE__*/t(bv,{chainId:"id"in a?a.id:"solana"}),/*#__PURE__*/t(hv,{children:a.name})]}),/*#__PURE__*/e(Ty,{isLoading:!1,isPulsing:!1,color:"gray",children:[/*#__PURE__*/t(Cv,{children:/*#__PURE__*/t(Ar,{})}),r]})]});let vv=/*#__PURE__*/kn.div.withConfig({displayName:"Container",componentId:"sc-d24ae982-0"})(["display:flex;align-items:center;"]),Cv=/*#__PURE__*/kn.div.withConfig({displayName:"IconContainer",componentId:"sc-d24ae982-1"})(["height:0.75rem;width:0.75rem;margin-right:0.2rem;"]),bv=/*#__PURE__*/kn(yv).withConfig({displayName:"StyledNetworkIcon",componentId:"sc-d24ae982-2"})(["height:1.25rem;width:1.25rem;display:inline-block;margin-right:0.5rem;border-radius:4px;"]);const kv=({options:n,onSelect:r,selected:a,className:i})=>/*#__PURE__*/e(Hn,{as:Av,children:[/*#__PURE__*/e(Vn,{as:Ev,children:[/*#__PURE__*/t(wv,{balance:a.balance,chain:a.chain}),/*#__PURE__*/t(Iv,{height:16})]}),/*#__PURE__*/t($n,{as:Tv,className:i,children:n.map(((e,n)=>/*#__PURE__*/t(jn,{as:xv,onClick:()=>r(n),children:/*#__PURE__*/t(wv,{balance:e.balance,chain:e.chain})},n)))})]});let Av=/*#__PURE__*/kn.div.withConfig({displayName:"Wrapper",componentId:"sc-31c00f79-0"})(["width:100%;position:relative;"]),Tv=/*#__PURE__*/kn.div.withConfig({displayName:"Popover",componentId:"sc-31c00f79-1"})(["width:100%;margin-top:0.5rem;position:absolute;background-color:var(--privy-color-background);border-radius:var(--privy-border-radius-md);overflow-x:hidden;overflow-y:auto;box-shadow:0px 1px 2px 0px rgba(16,24,40,0.05);max-height:11.75rem;&&{border:solid 1px var(--privy-color-foreground-4);}z-index:1;"]),xv=/*#__PURE__*/kn.button.withConfig({displayName:"Button",componentId:"sc-31c00f79-2"})(["width:100%;display:flex;justify-content:space-between;&&{padding:1rem;}:not(:last-child){border-bottom:solid 1px var(--privy-color-foreground-4);}:hover{background:var(--privy-color-background-2);}"]),Iv=/*#__PURE__*/kn(On).withConfig({displayName:"StyledChevronIcon",componentId:"sc-31c00f79-3"})(["height:1rem;margin-left:0.5rem;"]),Ev=/*#__PURE__*/kn.button.withConfig({displayName:"StyledMenuButton",componentId:"sc-31c00f79-4"})([""," span{margin-left:auto;}","{transition:rotate 100ms ease-in;}&[aria-expanded='true']{","{rotate:-180deg;}}"],Ww,Iv,Iv);const Sv=({passkeys:e,isLoading:n,errorReason:r,success:a,expanded:i,onLinkPasskey:o,onUnlinkPasskey:s,onExpand:l,onBack:c,onClose:d})=>/*#__PURE__*/t(kc,a?{title:"Passkeys updated",icon:Gn,iconVariant:"success",primaryCta:{label:"Done",onClick:d},onClose:d,watermark:!0}:i?{icon:rr,title:"Your passkeys",onBack:c,onClose:d,watermark:!0,children:/*#__PURE__*/t(Nv,{passkeys:e,expanded:i,onUnlink:s,onExpand:l})}:{icon:rr,title:"Set up passkey verification",subtitle:"Verify with passkey",primaryCta:{label:"Add new passkey",onClick:o,loading:n},onClose:d,watermark:!0,helpText:r||void 0,children:0===e.length?/*#__PURE__*/t(Mv,{}):/*#__PURE__*/t(_v,{children:/*#__PURE__*/t(Nv,{passkeys:e,expanded:i,onUnlink:s,onExpand:l})})});let _v=/*#__PURE__*/kn.div.withConfig({displayName:"ContentContainer",componentId:"sc-e693657c-0"})(["margin-bottom:12px;"]),Nv=({passkeys:n,expanded:r,onUnlink:a,onExpand:i})=>{let[s,l]=o([]),c=r?n.length:2,d=e=>e.authenticatorName?e.createdWithBrowser?`${e.authenticatorName} on ${e.createdWithBrowser}`:e.authenticatorName:e.createdWithBrowser?e.createdWithOs?`${e.createdWithBrowser} on ${e.createdWithOs}`:`${e.createdWithBrowser}`:"Unknown device";/*#__PURE__*/return e("div",{children:[/*#__PURE__*/t(Lv,{children:"Your passkeys"}),/*#__PURE__*/e(Ov,{children:[n.slice(0,c).map((n=>/*#__PURE__*/e(Bv,{children:[/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(Rv,{children:d(n)}),/*#__PURE__*/e(Dv,{children:["Last used: ",(n.latestVerifiedAt??n.verifiedAt).toLocaleString()]})]}),/*#__PURE__*/t(Hv,{disabled:s.includes(n.credentialId),onClick:()=>(async e=>{l((t=>t.concat([e]))),await a(e),l((t=>t.filter((t=>t!==e))))})(n.credentialId),children:s.includes(n.credentialId)?/*#__PURE__*/t(El,{}):/*#__PURE__*/t(cr,{size:16})})]},n.credentialId))),n.length>2&&!r&&/*#__PURE__*/t(Fv,{onClick:i,children:"View all"})]})]})},Mv=()=>/*#__PURE__*/e(Kf,{style:{color:"var(--privy-color-foreground)"},children:[/*#__PURE__*/t(Gf,{children:"Verify with Touch ID, Face ID, PIN, or hardware key"}),/*#__PURE__*/t(Gf,{children:"Takes seconds to set up and use"}),/*#__PURE__*/t(Gf,{children:"Use your passkey to verify transactions and login to your account"})]});const Wv={component:()=>{let{user:e,unlinkPasskey:n}=on(),{linkWithPasskey:r,closePrivyModal:a}=Ft(),i=e?.linkedAccounts.filter((e=>"passkey"===e.type)),[s,l]=o(!1),[c,u]=o(""),[p,h]=o(!1),[m,g]=o(!1);return d((()=>{0===i.length&&g(!1)}),[i.length]),/*#__PURE__*/t(Sv,{passkeys:i,isLoading:s,errorReason:c,success:p,expanded:m,onLinkPasskey:()=>{l(!0),r().then((()=>h(!0))).catch((e=>{if(e instanceof Re){if(e.privyErrorCode===Te.CANNOT_LINK_MORE_OF_TYPE)return void u("Cannot link more passkeys to account.");if(e.privyErrorCode===Te.PASSKEY_NOT_ALLOWED)return void u("Passkey request timed out or rejected by user.")}u("Unknown error occurred.")})).finally((()=>{l(!1)}))},onUnlinkPasskey:async e=>(l(!0),await n(e).then((()=>h(!0))).catch((e=>{e instanceof Re&&e.privyErrorCode===Te.MISSING_MFA_CREDENTIALS?u("Cannot unlink a passkey enrolled in MFA"):u("Unknown error occurred.")})).finally((()=>{l(!1)}))),onExpand:()=>g(!0),onBack:()=>g(!1),onClose:()=>a()})}},Pv=/*#__PURE__*/kn.div.withConfig({displayName:"DoubleIconWrapper",componentId:"sc-e693657c-1"})(["display:flex;align-items:center;justify-content:center;width:180px;height:90px;border-radius:50%;svg + svg{margin-left:12px;}> svg{z-index:2;color:var(--privy-color-accent) !important;stroke:var(--privy-color-accent) !important;fill:var(--privy-color-accent) !important;}"]);let Uv=/*#__PURE__*/An(["&&{width:100%;font-size:0.875rem;line-height:1rem;@media (min-width:440px){font-size:14px;}display:flex;gap:12px;justify-content:center;padding:6px 8px;background-color:var(--privy-color-background);transition:background-color 200ms ease;color:var(--privy-color-accent) !important;:focus{outline:none;box-shadow:none;}}"]);const Fv=/*#__PURE__*/kn.button.withConfig({displayName:"LinkButton",componentId:"sc-e693657c-2"})(["",""],Uv);let Ov=/*#__PURE__*/kn.div.withConfig({displayName:"List",componentId:"sc-e693657c-3"})(["display:flex;flex-direction:column;align-items:stretch;gap:0.8rem;padding:0.5rem 0rem 0rem;flex-grow:1;width:100%;"]),Lv=/*#__PURE__*/kn.div.withConfig({displayName:"PasskeyListTitle",componentId:"sc-e693657c-4"})(["line-height:20px;height:20px;font-size:1em;font-weight:450;display:flex;justify-content:flex-beginning;width:100%;"]),Rv=/*#__PURE__*/kn.div.withConfig({displayName:"PasskeyItemTitle",componentId:"sc-e693657c-5"})(["font-size:1em;line-height:1.3em;font-weight:500;color:var(--privy-color-foreground-2);padding:0.2em 0;"]),Dv=/*#__PURE__*/kn.div.withConfig({displayName:"PasskeyItemSubtitle",componentId:"sc-e693657c-6"})(["font-size:0.875rem;line-height:1rem;color:#64668b;padding:0.2em 0;"]),Bv=/*#__PURE__*/kn.div.withConfig({displayName:"PasskeyListItem",componentId:"sc-e693657c-7"})(["display:flex;align-items:center;justify-content:space-between;padding:1em;gap:10px;font-size:0.875rem;line-height:1rem;text-align:left;border-radius:8px;border:1px solid #e2e3f0 !important;width:100%;height:5em;"]),zv=/*#__PURE__*/An([":focus,:hover,:active{outline:none;}display:flex;width:2em;height:2em;justify-content:center;align-items:center;svg{color:var(--privy-color-error);}svg:hover{color:var(--privy-color-foreground-3);}"]),Hv=/*#__PURE__*/kn.button.withConfig({displayName:"PasskeyItemUnlinkButton",componentId:"sc-e693657c-8"})(["",""],zv);const Vv=/*#__PURE__*/kn.div.withConfig({displayName:"FundingMethodContainer",componentId:"sc-eaaa12a-0"})(["display:flex;flex-direction:column;gap:12px;padding-top:24px;padding-bottom:24px;"]),$v=/*#__PURE__*/kn.div.withConfig({displayName:"IconContainer",componentId:"sc-eaaa12a-1"})(["width:24px;height:24px;display:flex;justify-content:center;align-items:center;svg{border-radius:var(--privy-border-radius-sm);}"]),jv=/*#__PURE__*/kn.div.withConfig({displayName:"FundingQuantityWrapper",componentId:"sc-eaaa12a-2"})(["display:flex;flex-direction:column;justify-content:center;align-items:flex-start;gap:8px;"]),qv=/*#__PURE__*/kn.div.withConfig({displayName:"FundingQuantity",componentId:"sc-eaaa12a-3"})(["display:flex;align-items:center;gap:4px;width:100%;padding:0 16px;border-width:1px !important;border-radius:12px;cursor:text;&:focus-within{border-color:var(--privy-color-accent);}"]),Kv=/*#__PURE__*/kn.input.withConfig({displayName:"FundingAmountInput",componentId:"sc-eaaa12a-5"})(["background-color:var(--privy-color-background);width:100%;&:focus{outline:none !important;border:none !important;box-shadow:none !important;}&&{font-size:26px;}"]),Gv=/*#__PURE__*/kn(Kv).withConfig({displayName:"FundingAmountInputLarge",componentId:"sc-eaaa12a-6"})(["&&{font-size:42px;}"]),Zv=/*#__PURE__*/kn.div.withConfig({displayName:"FundingCurrency",componentId:"sc-eaaa12a-8"})(["font-size:18px;"]),Yv=/*#__PURE__*/kn.div.withConfig({displayName:"FundingDollars",componentId:"sc-eaaa12a-9"})(["font-size:12px;color:var(--privy-color-foreground-3);height:20px;"]),Qv=/*#__PURE__*/kn.div.withConfig({displayName:"InfoButtonText",componentId:"sc-eaaa12a-13"})([""]),Xv=/*#__PURE__*/kn.a.withConfig({displayName:"InfoButtonLink",componentId:"sc-eaaa12a-14"})(["&&{color:var(--privy-color-accent);}cursor:pointer;"]),Jv=({displayName:r,errorMessage:a,configuredFundingChain:o,formattedBalance:s,fundingAmount:l,fundingCurrency:c,fundingAmountInUsd:d,options:u,selectedOption:p,isPreparing:h,isSubmitting:m,addressToFund:g,fundingWalletAddress:y,onSubmit:f,onSelect:w,onAmountChange:v,erc20ContractInfo:C})=>{let b=i(null);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Pk,{}),/*#__PURE__*/t($d,{}),/*#__PURE__*/t(Tw,{children:"Transfer from another network"}),/*#__PURE__*/e(Aw,{children:["You need more funds on the ",o.name," network. Bridge from another blockchain network."]}),/*#__PURE__*/e(jv,{style:{marginTop:"2rem"},children:[/*#__PURE__*/e(qv,{onClick:()=>b.current?.focus(),children:[/*#__PURE__*/t(Kv,{ref:b,value:l,onChange:e=>{let t=e.target.value;if(/^[0-9.]*$/.test(t)&&t.split(".").length-1<=1){let e=/\.$/.test(t)?".":"",n=Number(t.replace(/\.$/,"")||"0");if(Number.isNaN(n))return void v("0");v(n.toString()+e)}}}),/*#__PURE__*/t(Zv,{children:c})]}),d&&/*#__PURE__*/t(Yv,{children:d})]}),/*#__PURE__*/e(dv,{style:{marginTop:"1.5rem"},children:[/*#__PURE__*/t(uv,{children:"From"}),/*#__PURE__*/t(uv,{children:Z(y)})]}),/*#__PURE__*/t(kv,{selected:{chain:p.chain,balance:p.isErc20Quote?sv({amount:p.erc20Balance??0n,decimals:C?.decimals??6})+` ${C?.symbol||""}`:Zc(p.balance,p.chain.nativeCurrency.symbol,3,!0)},options:u.map((({chain:e,balance:t,isErc20Quote:n,erc20Balance:r})=>({chain:e,balance:n?sv({amount:r??0n,decimals:C?.decimals??6})+` ${C?.symbol||""}`:Zc(t,e.nativeCurrency.symbol,3,!0)}))),onSelect:w}),/*#__PURE__*/e(dv,{style:{marginTop:"1.5rem"},children:[/*#__PURE__*/t(uv,{children:"To"}),/*#__PURE__*/t(uv,{children:Z(g)})]}),/*#__PURE__*/t(fv,{chain:o,balance:s}),/*#__PURE__*/t(mg,{style:{marginTop:"1rem"},children:a}),/*#__PURE__*/e(Wl,{style:{marginTop:"1rem"},loading:m||h,disabled:h||m,onClick:f,children:["Confirm with ",r]}),/*#__PURE__*/t(jd,{}),/*#__PURE__*/t(vl,{})]})},eC=({wallet:r,displayName:a,addressToFund:i,chainId:o,chainName:s,isBridging:l,isErc20Flow:c,totalPriceInNativeCurrency:d,totalPriceInUsd:u,gasPriceInNativeCurrency:p,gasPriceInUsd:h})=>{let m=ts(r.walletClientType);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Pk,{}),/*#__PURE__*/t(Ql,{}),/*#__PURE__*/t(Ld,{style:{marginTop:"16px"},children:/*#__PURE__*/t(Vf,{icon:m?.image_url?.md,name:r.walletClientType})}),/*#__PURE__*/t(Hp,{style:{marginTop:"8px",marginBottom:"12px"},title:`${l?"Bridging":"Confirming"} with ${a}`}),!l&&!c&&/*#__PURE__*/e(cv,{children:[/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Total"}),/*#__PURE__*/t(hv,{children:u||d})]}),/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"To"}),/*#__PURE__*/t(hv,{children:/*#__PURE__*/t(pp,{address:i,showCopyIcon:!1})})]}),/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Network"}),/*#__PURE__*/t(hv,{children:/*#__PURE__*/e(tC,{children:[/*#__PURE__*/t(yv,{chainId:o,height:16,width:16})," ",s]})})]}),p&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Estimated fee"}),/*#__PURE__*/t(hv,{children:h||p})]})]}),/*#__PURE__*/t(qd,{height:24}),/*#__PURE__*/t(vl,{})]})};let tC=/*#__PURE__*/kn.div.withConfig({displayName:"NetworkColumn",componentId:"sc-ec6320ce-0"})(["display:flex;flex-direction:row;align-items:center;gap:4px;"]);const nC={component:()=>{let{rpcConfig:r,appId:a,closePrivyModal:i,createAnalyticsEvent:s}=Ft(),{navigate:l,setModalData:c,app:u,data:p}=Is(),{wallets:h}=bu(),[m,g]=o(!1),[y,f]=o(0n),[w,v]=o(!1),[C,b]=o(null),[k,A]=o(null),[T,x]=o([]),[I,E]=o(0),[S,_]=o(!1),[M,W]=o(!1),[P,U]=o(!1),[F,O]=o(!1),[L,R]=o(),[D,B]=o();if(!p?.funding||"ethereum"!==p.funding.chainType)throw Error("Invalid funding data");let{erc20ContractInfo:z,chain:H,connectedWalletAddress:V}=p.funding,$=p.funding.address,j=p.funding.erc20Address,[q,K]=o(p.funding.amount);d((()=>{j&&!z&&b(Error("Unable to fetch token details"))}),[]);let G=!!j&&!!z,Z=G?BigInt(parseFloat(q)*10**z.decimals):$t(q),Y=V?h.find((({address:e})=>e===V)):h[0],Q=ts(Y?.walletClientType||"unknown"),X=Q?.name||"wallet",[J,ee]=o(null);d((()=>{(async()=>{if(!Y)return;let e=await Y.getEthereumProvider();ee(jt({account:Y.address,transport:qt(e)}).extend(Kt))})().catch(console.error)}),[Y]);let[te,ne]=o(0n);d((()=>{Lt({chain:H,transport:Rt(Wi(H,r,a))}).getBalance({address:$}).then(ne).catch(console.error)}),[]);let[re,ae]=o(0n);d((()=>{G&&$w({chain:H,address:$,appId:a,rpcConfig:r,erc20Address:j}).then((e=>ae(e.balance))).catch(console.error)}),[]);let{tokenPrice:ie}=vu(H.id),[oe,se]=o({to:$,chain:H,value:Z,data:void 0});d((()=>{(async()=>{let e,t;if(!J||!Y||S||P)return;_(!0);let n=Lt({chain:oe.chain,transport:Rt(Wi(oe.chain,r,a))});if(G&&!oe.data)return await n.simulateContract({address:j,chain:oe.chain,abi:iv,functionName:"transfer",args:[$,Z],account:Y.address}).catch((e=>{console.warn("Simulated token transfer failed with error, fetching bridge options.",e)}))?(_(!1),void se({to:j,chain:oe.chain,data:Gt({abi:iv,functionName:"transfer",args:[$,Z]}),value:"0x0"})):(_(!1),void v(!0));try{e=await n.prepareTransactionRequest({account:Y.address,to:oe.to,chain:oe.chain,data:oe.data,value:BigInt(oe.value??0)})}catch(e){if(console.error(e),T.length>1)A(e.shortMessage??"Something went wrong");else if(M&&0===T.length)return void b(new he(`Wallet ${Ui(Y.address)} does not have enough funds.`,void 0,Te.INSUFFICIENT_BALANCE))}if(!e)return _(!1),void v(!0);_(!1),U(!0),g(!0),f(e.gas);try{await J.switchChain({id:oe.chain.id})}catch(e){await J.addChain({chain:oe.chain}),await J.switchChain({id:oe.chain.id})}try{t=await J.sendTransaction(e)}catch(e){if(console.error(e),"TransactionExecutionError"===e.name)if(T.length<1){let t=e.shortMessage;(e.shortMessage.includes("rejected the request")||e.details.includes("rejected the request"))&&(t="User rejected the request."),b(new he(t,void 0,Te.TRANSACTION_FAILURE))}else A(e.shortMessage??"Something went wrong")}if(t)return await J.waitForTransactionReceipt({hash:t}),U(!1),M?(R(t),void B("pending")):(O(!0),void s({eventName:Vw,payload:{provider:"external",status:"success",txHash:t,address:Y.address,chainId:oe.chain.id,chainType:"ethereum",value:oe.value?Bt(BigInt(oe.value),z?.decimals??18):void 0,token:z?.symbol??j??"ETH",destinationAddress:$,destinationChainId:H.id,destinationChainType:"ethereum",destinationValue:Z?Bt(Z,z?.decimals??18):void 0,destinationToken:z?.symbol??j??H.nativeCurrency.name}}));U(!1)})().catch(console.error)}),[J,oe]),d((()=>{(async()=>{if(!w||!J||!Y)return;let e=N(u.chains).filter((e=>e.id!==H.id&&!!e.testnet==!!H.testnet));G&&e.unshift(H);let t=await lv({chains:e,address:Y.address,appId:a,rpcConfig:r,includeUsdc:p.funding?.isUSDC}),n=G?t.filter((e=>e.balance>0n)):t.filter((e=>e.balance>Z)),i=G&&t.every((e=>0n===e.balance));if(n.length<1)return void b(new he(i?`Wallet ${Ui(Y.address)} doesn't have enough funds to cover gas fees. Top up your wallet and try again.`:`Wallet ${Ui(Y.address)} does not have enough funds.`,void 0,Te.INSUFFICIENT_BALANCE));n.sort(((e,t)=>Number(G?(t.erc20Balance??0n)-(e.erc20Balance??0n):t.balance-e.balance)));let o=n.flatMap((e=>{let t=[{...e,isErc20Quote:!1,isTestnet:!!H.testnet,input:Tm({amount:Z.toString(),user:Y.address,recipient:$,destinationChainId:H.id,destinationCurrency:j,originChainId:e.chain.id})}];return G&&j&&(e.erc20Balance??0n)>=Z&&t.push({...e,isErc20Quote:!0,isTestnet:!!H.testnet,input:Tm({amount:Z.toString(),user:Y.address,recipient:$,destinationChainId:H.id,destinationCurrency:j,originChainId:e.chain.id,originCurrency:e.erc20Address})}),t})),s=(await Promise.allSettled(o.map((async e=>({...e,quote:await Em(e)}))))).filter((e=>"fulfilled"===e.status)).map((e=>e.value));if(s.length<1)return void b(new he(`Wallet ${Ui(Y.address)} does not have enough funds.`,void 0,Te.INSUFFICIENT_BALANCE));let l=s.map((e=>({bridgeTx:Sm(e.quote),balance:e.balance,chain:e.chain,erc20Balance:e.erc20Balance,isErc20Quote:e.isErc20Quote}))).filter((e=>!!e.bridgeTx));if(l.length>1)return void x(l);let c=l[0];c?(W(!0),se({data:c.bridgeTx.data,to:c.bridgeTx.to,value:c.bridgeTx.value,chain:c.chain})):b(new he(`Wallet ${Ui(Y.address)} does not have enough funds.`,void 0,Te.INSUFFICIENT_BALANCE))})().catch(console.error)}),[w]),_m({transactionHash:L,wallet:Y,isTestnet:!!H.testnet,bridgingStatus:D,setBridgingStatus:B,onSuccess({transactionHash:e,wallet:t}){W(!1),O(!0),s({eventName:Vw,payload:{provider:"external",status:"success",txHash:e,address:t.address,chainId:oe.chain.id,chainType:"ethereum",value:oe.value?Bt(BigInt(oe.value),z?.decimals??18):void 0,token:z?.symbol??j??"ETH",destinationAddress:$,destinationChainId:H.id,destinationChainType:"ethereum",destinationValue:Z?Bt(Z,z?.decimals??18):void 0,destinationToken:z?.symbol??j??H.nativeCurrency.name}})},onFailure({error:e}){W(!1),b(e)}}),d((()=>{C&&(c({funding:p?.funding,solanaFundingData:p?.solanaFundingData,sendTransaction:p?.sendTransaction,errorModalData:{error:C,previousScreen:iC}}),l(Wm,!1))}),[C]);let le=!G&&ie?Kc(q??"0",ie):void 0,ce=G?y:Qc([y,Z]),de=ce&&ie?Gc(ce,ie):void 0,ue=ce?Zc(ce,p?.funding?.erc20Address?p?.funding?.erc20ContractInfo?.symbol||"ETH":p?.funding?.chain.nativeCurrency.symbol||"ETH"):void 0,pe=y&&ie?Gc(y,ie):void 0,me=y?Zc(y,H?.nativeCurrency?.symbol||"ETH"):void 0;if(d((()=>{if(!F)return;let e=setTimeout(i,Ta);return()=>clearTimeout(e)}),[F]),F/*#__PURE__*/)return e(n,{children:[/*#__PURE__*/t(Pk,{}),/*#__PURE__*/t($d,{}),/*#__PURE__*/e(Bd,{children:[/*#__PURE__*/t($r,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),/*#__PURE__*/t(Hp,{title:"Success!",description:`You’ve successfully added ${q} ${G?z.symbol:H.nativeCurrency.symbol} to your ${u.name} wallet. It may take a minute before the funds are available to use.`})]}),/*#__PURE__*/t(jd,{}),/*#__PURE__*/t(vl,{})]});let ge=G?`${sv({amount:re,decimals:z.decimals})} ${z.symbol}`:Zc(te,H.nativeCurrency.symbol,3,!0),ye=T[I];return T.length>1&&ye?/*#__PURE__*/t(Jv,{displayName:X,configuredFundingChain:H,erc20ContractInfo:z,formattedBalance:ge,fundingAmount:q,fundingCurrency:G?z.symbol:H.nativeCurrency.symbol,fundingAmountInUsd:le,options:T,selectedOption:ye,isPreparing:S,isSubmitting:P,addressToFund:$,fundingWalletAddress:Y?.address||"",errorMessage:k,onSubmit:()=>{p.funding?.amount!==q?async function(){if(Y&&ye)try{let e=await Em({isTestnet:!!H.testnet,input:Tm({amount:Z.toString(),user:Y.address,recipient:$,destinationChainId:H.id,destinationCurrency:j,originChainId:ye.chain.id})}),t=Sm(e);if(!t)throw Error("Invalid transaction request");W(!0),se({data:t.data,to:t.to,value:t.value,chain:ye.chain})}catch(e){console.error(e),b(new he("Unable to fetch quotes for bridging",e,Te.INSUFFICIENT_BALANCE))}}().catch(console.error):se({to:ye.bridgeTx.to,data:ye.bridgeTx.data,value:ye.bridgeTx.value,chain:ye.chain})},onSelect:e=>{e!==I&&(A(null),E(e))},onAmountChange:K}):m&&y&&Y&&p?.funding?/*#__PURE__*/t(eC,{wallet:Y,displayName:X,addressToFund:$,isBridging:M,isErc20Flow:G,totalPriceInUsd:de,totalPriceInNativeCurrency:ue,gasPriceInUsd:pe,gasPriceInNativeCurrency:me,chainId:H.id,chainName:H.name}):
|
|
24
|
+
/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Pk,{}),/*#__PURE__*/t(Ql,{}),/*#__PURE__*/t("div",{style:{marginTop:"1rem"}}),/*#__PURE__*/t(vl,{})]})}},rC={component:function(){let{closePrivyModal:r,createAnalyticsEvent:a}=Ft(),{navigate:s,setModalData:l,app:c,data:u}=Is(),{wallets:p}=ok(),h=i(!1),m=ty(),[g,y]=o(!1),[f,w]=o(!1),[v,C]=o(null),[b,k]=o(),[A,T]=o();if(!u?.funding||"ethereum"!==u.funding.chainType)throw Error("Invalid funding data");let{amount:x,connectedWalletAddress:I,chain:E,cluster:S,isUSDC:_}=u.funding,N=u.funding.address,M=u.funding.erc20Address,W=u.funding.isUSDC?"USDC":E.nativeCurrency.symbol,P=S??{name:"mainnet-beta"},U=I?p.find((({address:e})=>e===I)):p[0],F=ts(U?.walletClientType||"unknown"),O=F?.name||"wallet";return d((()=>{(async function(){if(!U||!E||h.current)return;let e=m(qw);if(!e)return void C(new he("Unable to solana plugin"));h.current=!0,E?.testnet&&console.warn("Solana testnets are not supported for bridging");let t=_?1e6*parseFloat(x):$t(x),n=await Em({isTestnet:!!E.testnet,input:Tm({amount:t.toString(),user:U.address,recipient:N,destinationChainId:E.id,originChainId:ls,originCurrency:_?"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v":cs,destinationCurrency:_?M:void 0})}).catch(console.error);if(!n)return void C(new he(`Unable to fetch quotes for bridging. Wallet ${Fi(U.address)} does not have enough funds.`,void 0,Te.INSUFFICIENT_BALANCE));let r=await e.createBridgeTransactionFromRelayQuote({quote:n,from:U.address,cluster:P});if(r)try{y(!0);let{connection:e,transaction:t}=r,a=await e.simulateTransaction(t);if(a.value.err)return a.value.logs?.find((e=>/insufficient (lamports|funds)/gi.test(e)))?void C(new he(`Wallet ${Fi(U?.address)} does not have enough funds. ${n.details.currencyIn.amountFormatted} ${W} are needed to complete the transaction.`,void 0,Te.INSUFFICIENT_BALANCE)):(console.error("Transaction failed:",a.value.err),void C(new he("Something went wrong",void 0,Te.TRANSACTION_FAILURE)));let i=await U.sendTransaction(t,e),o=await e.confirmTransaction(i);if(o.value.err)return console.error("Transaction failed:",o.value.err),void C(new he("Something went wrong",void 0,Te.TRANSACTION_FAILURE));k(i),T("pending")}catch(e){if(console.error(e),/user rejected the request/gi.test(e.message||""))return void C(new he("Transaction was rejected by the user",void 0,Te.TRANSACTION_FAILURE));C(new he("Something went wrong",void 0,Te.TRANSACTION_FAILURE))}else C(new he(`Unable to select bridge option from quotes. Wallet ${Fi(U.address)} does not have enough funds.`,void 0,Te.INSUFFICIENT_BALANCE))})().catch(console.error)}),[]),_m({transactionHash:b,wallet:U,isTestnet:!1,bridgingStatus:A,setBridgingStatus:T,onSuccess({transactionHash:e,wallet:t}){y(!1),w(!0),a({eventName:Vw,payload:{provider:"external",status:"success",txHash:e,address:t.address,chainType:"solana",clusterName:P.name,token:"SOL",destinationAddress:N,destinationChainId:E.id,destinationChainType:"ethereum",destinationValue:x,destinationToken:_?"USDC":"ETH"}})},onFailure({error:e}){y(!1),C(e)}}),d((()=>{if(!f)return;let e=setTimeout(r,Ta);return()=>clearTimeout(e)}),[f]),d((()=>{v&&(l({funding:u?.funding,solanaFundingData:u?.solanaFundingData,sendTransaction:u?.sendTransaction,errorModalData:{error:v,previousScreen:iC}}),s(Wm,!1))}),[v]),f?/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Pk,{}),/*#__PURE__*/t($d,{}),/*#__PURE__*/e(Bd,{children:[/*#__PURE__*/t($r,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),/*#__PURE__*/t(Hp,{title:"Success!",description:`You’ve successfully added ${x} ${W} to your ${c.name} wallet. It may take a minute before the funds are available to use.`})]}),/*#__PURE__*/t(jd,{}),/*#__PURE__*/t(vl,{})]}):g&&U?/*#__PURE__*/t(eC,{wallet:U,displayName:O,addressToFund:N,isBridging:g,isErc20Flow:!1,chainId:E.id,chainName:E.name,totalPriceInUsd:void 0,totalPriceInNativeCurrency:void 0,gasPriceInUsd:void 0,gasPriceInNativeCurrency:void 0}):
|
|
25
|
+
/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Pk,{}),/*#__PURE__*/t(Ql,{}),/*#__PURE__*/t("div",{style:{marginTop:"1rem"}}),/*#__PURE__*/t(vl,{})]})}},aC={component:()=>{let{data:r,setModalData:a}=Is(),o=r?.funding,s="solana"===o.chainType,l=i(null),{tokenPrice:c}=vu(s?"solana":o.chain.id),d=s?void 0:o,u=!(!d?.erc20Address||d?.erc20ContractInfo),p=s?o.isUSDC?"USDC":"SOL":o.erc20Address?o.erc20ContractInfo?.symbol:o.chain.nativeCurrency.symbol||"ETH",h=parseFloat(o.amount),m=!isNaN(h)&&h>0,g=c?Kc(o.amount,c):void 0;/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Pk,{}),/*#__PURE__*/t(Tw,{children:"Confirm or edit amount"}),/*#__PURE__*/e(zd,{style:{marginTop:"32px"},children:[/*#__PURE__*/t(jv,{children:u?/*#__PURE__*/t(Ql,{size:"50px"}):/*#__PURE__*/e(n,{children:[/*#__PURE__*/e(qv,{onClick:()=>l.current?.focus(),children:[/*#__PURE__*/t(Gv,{ref:l,value:o.amount,onChange:e=>{let t=e.target.value;/^[0-9.]*$/.test(t)&&t.split(".").length-1<=1&&a({...r,funding:{...o,amount:t},solanaFundingData:r?.solanaFundingData?{...r.solanaFundingData,amount:t}:void 0})}}),/*#__PURE__*/t(Zv,{children:p})]}),!d?.erc20Address&&/*#__PURE__*/t(Yv,{children:g&&m?`${g} USD`:""})]})}),/*#__PURE__*/t(Wl,{style:{marginTop:"1rem"},disabled:!m,onClick:o.onContinueWithExternalWallet,children:"Continue"})]}),/*#__PURE__*/t(vl,{})]})}},iC={component:()=>{let r,{connectors:a}=Ft(),{app:i,setModalData:s,data:l,navigate:c}=Is(),{wallets:u}=bu(),{wallets:p}=ok(),[h,m]=o("default"),g="solana"===l?.funding?.chainType,y=!!l?.funding?.crossChainBridgingEnabled;r="ethereum"===l?.funding?.chainType?l.funding.erc20Address&&!l.funding.isUSDC?"ethereum-only":y&&!l.funding.chain.testnet?"ethereum-and-solana":"ethereum-only":y&&!l.funding?.isUSDC?"ethereum-and-solana":"solana-only";let f=u.filter((e=>"privy"!==e.walletClientType)),w=f.map((e=>e.walletClientType)),v=p.filter((e=>"privy"!==e.walletClientType)),C=v.map((e=>e.walletClientType)),b=[],k={...l.funding};k.usingDefaultFundingMethod&&(k.usingDefaultFundingMethod=!1);let A=({address:e,walletChainType:t,walletClientType:n})=>{s({...l,funding:{...k,connectedWalletAddress:e,onContinueWithExternalWallet:()=>c(x({destChainType:g?"solana":"ethereum",sourceChainType:t}))},solanaFundingData:l?.solanaFundingData?{...l.solanaFundingData,sourceWalletData:{address:e,walletClientType:n}}:void 0}),c(aC)};"solana-only"!==r&&b.push(...f.map(((e,n)=>/*#__PURE__*/t(oC,{onClick:()=>A({address:e.address,walletChainType:"ethereum",walletClientType:e.walletClientType}),icon:e.meta.icon,name:e.meta.name,chainType:e.type},n)))),"ethereum-only"!==r&&b.push(...v.map(((e,n)=>/*#__PURE__*/t(oC,{onClick:()=>A({address:e.address,walletChainType:"solana",walletClientType:e.walletClientType}),icon:e.meta.icon,name:e.meta.name,chainType:e.type},n)))),b.push(...cw({walletList:i.appearance.walletList.filter((e=>!f.some((t=>t.walletClientType===e))&&!v.some((t=>t.walletClientType===e)))),walletChainType:r,connectors:a,connectOnly:!0,ignore:[...i.appearance.walletList,...w,...C],walletConnectEnabled:i.externalWallets.walletConnect.enabled}));let T=/*#__PURE__*/t(mf,{text:"More wallets",onClick:()=>m("overflow")}),x=({sourceChainType:e,destChainType:t})=>"ethereum"===e&&"solana"===t?Uk:"ethereum"===e&&"ethereum"===t?nC:"solana"===e&&"ethereum"===t?rC:k.externalSolanaFundingScreen;return d((()=>{s({...l,externalConnectWallet:{onCompleteNavigateTo:({address:e,walletClientType:t,walletChainType:n})=>(s({...l,funding:{...k,onContinueWithExternalWallet:()=>{c(x({destChainType:g?"solana":"ethereum",sourceChainType:n??"ethereum"}))}},solanaFundingData:l?.solanaFundingData?{...l.solanaFundingData,sourceWalletData:{address:e||"",walletClientType:t||""}}:void 0}),aC)}})}),[]),/*#__PURE__*/e(n,"overflow"===h?{children:[/*#__PURE__*/t($l,{backFn:()=>m("default")},"header"),/*#__PURE__*/e(sl,{children:[/*#__PURE__*/t(Aw,{style:{color:"var(--privy-color-foreground-3)",textAlign:"left"},children:"More wallets"}),b]}),/*#__PURE__*/t(vl,{})]}:{children:[/*#__PURE__*/t(Pk,{}),/*#__PURE__*/t(Hp,{title:"Transfer from wallet",description:"Connect a wallet to deposit funds or send funds manually to your wallet address."}),/*#__PURE__*/e(sl,{children:[b.length>4?b.slice(0,3):b,b.length>4&&T]}),/*#__PURE__*/t(vl,{})]})}};let oC=({onClick:n,icon:r,name:a,chainType:i})=>/*#__PURE__*/e(ul,{onClick:n,children:[/*#__PURE__*/t($v,{style:{width:20},children:/*#__PURE__*/t("img",{src:r})}),a,/*#__PURE__*/t(Ty,{color:"gray",style:{marginLeft:"auto"},children:"Connected"}),"solana"===i&&/*#__PURE__*/t(Ty,{color:"gray",children:"Solana"})]});const sC={component:()=>{let{closePrivyModal:r,createAnalyticsEvent:a}=Ft(),{navigate:s,setModalData:l,app:c,data:u}=Is(),{wallets:p}=ok(),h=ty(),[m,g]=o(0n),[y,f]=o(null),[w,v]=o(!1),[C,b]=o(!1),k=i(!1);if(!u?.funding||"solana"!==u.funding.chainType)throw Error("Invalid funding data");let{address:A,amount:T,cluster:x,connectedWalletAddress:I}=u.funding,E=function({name:e,rpcUrl:t}){if(t)return t;switch(e){case"mainnet-beta":return"https://api.mainnet-beta.solana.com";case"testnet":return"https://api.testnet.solana.com";case"devnet":return"https://api.devnet.solana.com"}}(x),{tokenPrice:S}=vu("solana"),{fundingAmountInBaseUnit:_,totalPriceInUsd:N,totalPriceInNativeCurrency:M,feePriceInNativeCurrency:W,feePriceInUsd:P}=yd({amount:T,fee:m,tokenPrice:S,isUsdc:u.funding.isUSDC}),U=I?p.find((({address:e})=>e===I)):p[0],F=ts(U?.walletClientType||"unknown"),O=F?.name||"wallet";return d((()=>{(async()=>{if("solana"===U?.type&&U.sendTransaction&&!w&&!k.current){k.current=!0;try{let e=h(qw);if(!e)throw new he("Unable to load solana plugin");let{connection:t,transaction:n}=u.funding?.isUSDC?await e.createSplTransferTransaction({from:U.address,to:A,amount:_,mintAddress:Y[x.name],cluster:x}):await e.createTransferTransaction({from:U.address,to:A,amount:_,cluster:x}),r=await n.getEstimatedFee(t);null!=r&&g(BigInt(r)),v(!0);let i=await t.simulateTransaction(n);if(i.value.err){let e=i.value.logs?.find((e=>/insufficient funds/gi.test(e))),t=i.value.logs?.find((e=>/insufficient lamports/gi.test(e)));return e?void f(new he(`Wallet ${Ui(U.address,void 0,void 0,"solana")} does not have enough funds.`,void 0,Te.INSUFFICIENT_BALANCE)):t?void f(new he(`Wallet ${Ui(U.address,void 0,void 0,"solana")} doesn't have enough funds to cover gas fees. Top up your wallet and try again.`,void 0,Te.INSUFFICIENT_BALANCE)):(console.error("Transaction failed:",i.value.err),void f(new he("Something went wrong",void 0,Te.TRANSACTION_FAILURE)))}let o=await U.sendTransaction(n,t),{value:s,token:l}=u.funding?.isUSDC?{value:Bt(_,6),token:"USDC"}:{value:Bt(_,9),token:"SOL"};a({eventName:Vw,payload:{provider:"external",status:"success",txHash:o,rpcEndpoint:E,address:U.address,value:s,chainType:"solana",clusterName:x.name,token:l,destinationAddress:A,destinationValue:s,destinationChainType:"solana",destinationClusterName:x.name,destinationToken:l}}),v(!1),b(!0)}catch(e){if(console.error(e),v(!1),/user rejected the request/gi.test(e.message||""))return void f(new he("Transaction was rejected by the user",void 0,Te.TRANSACTION_FAILURE));f(new he("Something went wrong",void 0,Te.TRANSACTION_FAILURE))}}})().catch(console.error).finally((()=>k.current=!1))}),[]),d((()=>{y&&(l({funding:u?.funding,solanaFundingData:u?.solanaFundingData,sendTransaction:u?.sendTransaction,errorModalData:{error:y,previousScreen:iC}}),s(Wm,!1))}),[y]),d((()=>{if(!C)return;let e=setTimeout(r,Ta);return()=>clearTimeout(e)}),[C]),C?/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Pk,{}),/*#__PURE__*/t($d,{}),/*#__PURE__*/e(Bd,{children:[/*#__PURE__*/t($r,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),/*#__PURE__*/t(Hp,{title:"Success!",description:`You’ve successfully added ${T} ${u.funding?.isUSDC?"USDC":"SOL"} to your ${c.name} wallet. It may take a minute before the funds are available to use.`})]}),/*#__PURE__*/t(jd,{}),/*#__PURE__*/t(vl,{})]}):U&&w?/*#__PURE__*/t(eC,{wallet:U,displayName:O,addressToFund:A,isBridging:!1,isErc20Flow:!!u.funding?.isUSDC,totalPriceInUsd:N,totalPriceInNativeCurrency:M,gasPriceInUsd:P,gasPriceInNativeCurrency:W,chainId:"solana",chainName:x.name}):
|
|
26
|
+
/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Pk,{}),/*#__PURE__*/t(Ql,{}),/*#__PURE__*/t("div",{style:{marginTop:"1rem"}}),/*#__PURE__*/t(vl,{})]})}},lC=({children:n,theme:r})=>/*#__PURE__*/e(cC,{$theme:r,children:[/*#__PURE__*/t(Tr,{width:"20px",height:"20px",color:"var(--privy-color-icon-error)",strokeWidth:2,style:{flexShrink:0}}),/*#__PURE__*/t(dC,{$theme:r,children:n})]});let cC=/*#__PURE__*/kn.div.withConfig({displayName:"Container",componentId:"sc-34910fd1-0"})(["display:flex;gap:0.75rem;background-color:var(--privy-color-error-bg);align-items:flex-start;padding:1rem;border-radius:0.75rem;"]),dC=/*#__PURE__*/kn.div.withConfig({displayName:"Content",componentId:"sc-34910fd1-1"})(["color:",";font-size:1rem;font-weight:400;line-height:1.5;flex:1;text-align:left;"],(e=>"dark"===e.$theme?"var(--privy-color-foreground-2)":"var(--privy-color-foreground)"));const uC=e=>/*#__PURE__*/t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 210.2",xmlSpace:"preserve",...e,children:/*#__PURE__*/t("path",{d:"M93.6,27.1C87.6,34.2,78,39.8,68.4,39c-1.2-9.6,3.5-19.8,9-26.1c6-7.3,16.5-12.5,25-12.9 C103.4,10,99.5,19.8,93.6,27.1 M102.3,40.9c-13.9-0.8-25.8,7.9-32.4,7.9c-6.7,0-16.8-7.5-27.8-7.3c-14.3,0.2-27.6,8.3-34.9,21.2 c-15,25.8-3.9,64,10.6,85c7.1,10.4,15.6,21.8,26.8,21.4c10.6-0.4,14.8-6.9,27.6-6.9c12.9,0,16.6,6.9,27.8,6.7 c11.6-0.2,18.9-10.4,26-20.8c8.1-11.8,11.4-23.3,11.6-23.9c-0.2-0.2-22.4-8.7-22.6-34.3c-0.2-21.4,17.5-31.6,18.3-32.2 C123.3,42.9,107.7,41.3,102.3,40.9 M182.6,11.9v155.9h24.2v-53.3h33.5c30.6,0,52.1-21,52.1-51.4c0-30.4-21.1-51.2-51.3-51.2H182.6z M206.8,32.3h27.9c21,0,33,11.2,33,30.9c0,19.7-12,31-33.1,31h-27.8V32.3z M336.6,169c15.2,0,29.3-7.7,35.7-19.9h0.5v18.7h22.4V90.2 c0-22.5-18-37-45.7-37c-25.7,0-44.7,14.7-45.4,34.9h21.8c1.8-9.6,10.7-15.9,22.9-15.9c14.8,0,23.1,6.9,23.1,19.6v8.6l-30.2,1.8 c-28.1,1.7-43.3,13.2-43.3,33.2C298.4,155.6,314.1,169,336.6,169z M343.1,150.5c-12.9,0-21.1-6.2-21.1-15.7c0-9.8,7.9-15.5,23-16.4 l26.9-1.7v8.8C371.9,140.1,359.5,150.5,343.1,150.5z M425.1,210.2c23.6,0,34.7-9,44.4-36.3L512,54.7h-24.6l-28.5,92.1h-0.5 l-28.5-92.1h-25.3l41,113.5l-2.2,6.9c-3.7,11.7-9.7,16.2-20.4,16.2c-1.9,0-5.6-0.2-7.1-0.4v18.7C417.3,210,423.3,210.2,425.1,210.2z"})}),pC=n=>/*#__PURE__*/e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 80 38.1",xmlSpace:"preserve",...n,children:[/*#__PURE__*/t("path",{style:{fill:"#5F6368"},d:"M37.8,19.7V29h-3V6h7.8c1.9,0,3.7,0.7,5.1,2c1.4,1.2,2.1,3,2.1,4.9c0,1.9-0.7,3.6-2.1,4.9c-1.4,1.3-3.1,2-5.1,2 L37.8,19.7L37.8,19.7z M37.8,8.8v8h5c1.1,0,2.2-0.4,2.9-1.2c1.6-1.5,1.6-4,0.1-5.5c0,0-0.1-0.1-0.1-0.1c-0.8-0.8-1.8-1.3-2.9-1.2 L37.8,8.8L37.8,8.8z"}),/*#__PURE__*/t("path",{style:{fill:"#5F6368"},d:"M56.7,12.8c2.2,0,3.9,0.6,5.2,1.8s1.9,2.8,1.9,4.8V29H61v-2.2h-0.1c-1.2,1.8-2.9,2.7-4.9,2.7 c-1.7,0-3.2-0.5-4.4-1.5c-1.1-1-1.8-2.4-1.8-3.9c0-1.6,0.6-2.9,1.8-3.9c1.2-1,2.9-1.4,4.9-1.4c1.8,0,3.2,0.3,4.3,1v-0.7 c0-1-0.4-2-1.2-2.6c-0.8-0.7-1.8-1.1-2.9-1.1c-1.7,0-3,0.7-3.9,2.1l-2.6-1.6C51.8,13.8,53.9,12.8,56.7,12.8z M52.9,24.2 c0,0.8,0.4,1.5,1,1.9c0.7,0.5,1.5,0.8,2.3,0.8c1.2,0,2.4-0.5,3.3-1.4c1-0.9,1.5-2,1.5-3.2c-0.9-0.7-2.2-1.1-3.9-1.1 c-1.2,0-2.2,0.3-3,0.9C53.3,22.6,52.9,23.3,52.9,24.2z"}),/*#__PURE__*/t("path",{style:{fill:"#5F6368"},d:"M80,13.3l-9.9,22.7h-3l3.7-7.9l-6.5-14.7h3.2l4.7,11.3h0.1l4.6-11.3H80z"}),/*#__PURE__*/t("path",{style:{fill:"#4285F4"},d:"M25.9,17.7c0-0.9-0.1-1.8-0.2-2.7H13.2v5.1h7.1c-0.3,1.6-1.2,3.1-2.6,4v3.3H22C24.5,25.1,25.9,21.7,25.9,17.7z"}),/*#__PURE__*/t("path",{style:{fill:"#34A853"},d:"M13.2,30.6c3.6,0,6.6-1.2,8.8-3.2l-4.3-3.3c-1.2,0.8-2.7,1.3-4.5,1.3c-3.4,0-6.4-2.3-7.4-5.5H1.4v3.4 C3.7,27.8,8.2,30.6,13.2,30.6z"}),/*#__PURE__*/t("path",{style:{fill:"#FBBC04"},d:"M5.8,19.9c-0.6-1.6-0.6-3.4,0-5.1v-3.4H1.4c-1.9,3.7-1.9,8.1,0,11.9L5.8,19.9z"}),/*#__PURE__*/t("path",{style:{fill:"#EA4335"},d:"M13.2,9.4c1.9,0,3.7,0.7,5.1,2l0,0l3.8-3.8c-2.4-2.2-5.6-3.5-8.8-3.4c-5,0-9.6,2.8-11.8,7.3l4.4,3.4 C6.8,11.7,9.8,9.4,13.2,9.4z"})]}),hC=e=>{let[t,n]=o();return d((()=>{e().then((e=>{n(e)})).catch((()=>{}))}),[]),t},mC=async({address:e,chain:t,rpcConfig:n,privyAppId:r})=>{try{let a=Lt({chain:t,transport:Rt(Wi(t,n,r))}),[i,o]=await Promise.all([a.readContract({abi:gC,address:e,functionName:"symbol"}),a.readContract({abi:gC,address:e,functionName:"decimals"})]);return{decimals:o,symbol:i}}catch(e){return console.log(e),null}};let gC=[{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"}];const yC={component:()=>{let{data:r,setModalData:a,navigate:s,navigateBack:l}=Is(),{closePrivyModal:c,createAnalyticsEvent:u,client:p}=Ft(),[h,m]=o("pending-in-flow"),g=i(0),y={...r?.funding,showAlternateFundingMethod:!0};y.usingDefaultFundingMethod&&(y.usingDefaultFundingMethod=!1);let{partnerUserId:f,popup:w}=r?.coinbaseOnrampStatus??{};return d((()=>{if("pending-in-flow"===h||"pending-after-flow"===h){let e=setInterval((async()=>{if(f)try{let{status:e}=await p.getCoinbaseOnRampStatus({partnerUserId:f});if("success"===e)return void m("success");if("failure"===e)throw Error("There was an error completing Coinbase Onramp flow.");if(g.current>=3)return a({funding:y,solanaFundingData:r?.solanaFundingData}),void s(PC);w?.closed&&(g.current=g.current+1,m("pending-after-flow"))}catch(e){console.error(e),m("error"),u({eventName:Vw,payload:{status:"failure",provider:"coinbase-onramp",error:e.message}}),a({funding:{...y,errorMessage:"Something went wrong adding funds. Please try again or use another method."},solanaFundingData:r?.solanaFundingData}),s(PC)}}),1500);return()=>clearInterval(e)}}),[f,w,h]),/*#__PURE__*/e(n,{children:[/*#__PURE__*/t($l,{title:"Fund account",backFn:()=>{a({funding:y,solanaFundingData:r?.solanaFundingData}),l()}},"header"),/*#__PURE__*/t(fC,{status:h,onClickCta:c}),/*#__PURE__*/t(vl,{})]})}};let fC=({status:r,onClickCta:a})=>{let{title:i,body:o,cta:l}=s((()=>(e=>{switch(e){case"success":return{title:"You've funded your account!",body:"It may take a few minutes for the assets to appear.",cta:"Continue"};case"pending-after-flow":return{title:"In Progress",body:"Almost done. Retrieving transaction status from Coinbase",cta:""};case"error":case"pending-in-flow":return{title:"In Progress",body:"Go back to Coinbase Onramp to finish funding your account.",cta:""}}})(r)),[r]);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/e(CC,{children:[/*#__PURE__*/t(wC,{isSucccess:"success"===r}),/*#__PURE__*/e(Hd,{children:[/*#__PURE__*/t("h3",{children:i}),/*#__PURE__*/t(vC,{children:o})]})]}),l&&/*#__PURE__*/t(Ml,{onClick:a,children:l})]})},wC=({isSucccess:n})=>{if(!n){let n="var(--privy-color-foreground-4)";/*#__PURE__*/return e("div",{style:{position:"relative"},children:[/*#__PURE__*/t(xl,{color:n,style:{position:"absolute"}}),/*#__PURE__*/t(Il,{color:n}),/*#__PURE__*/t(ao,{style:{position:"absolute",width:"2.8rem",height:"2.8rem",top:"1.2rem",left:"1.2rem"}})]})}let r=(e=>e?Dr:()=>/*#__PURE__*/t(Gr,{width:"3rem",height:"3rem",style:{backgroundColor:"var(--privy-color-foreground-4)",color:"var(--privy-color-background)",borderRadius:"100%",padding:"0.5rem",margin:"0.5rem"}}))(n),a=(e=>e?"var(--privy-color-success)":"var(--privy-color-foreground-4)")(n);/*#__PURE__*/return t("div",{style:{borderColor:a,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:r&&/*#__PURE__*/t(r,{width:"4rem",height:"4rem",color:a})})},vC=/*#__PURE__*/kn.p.withConfig({displayName:"StatusBody",componentId:"sc-8428a551-0"})(["font-size:1rem;color:var(--privy-color-foreground-3);margin-bottom:1rem;display:flex;flex-direction:column;gap:1rem;"]),CC=/*#__PURE__*/kn.div.withConfig({displayName:"ConnectContainer",componentId:"sc-8428a551-1"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin-left:1.75rem;margin-right:1.75rem;padding:2rem 0;"]);let bC={[_.id]:"ethereum",[V.id]:"base",[q.id]:"optimism",[K.id]:"polygon",[z.id]:"arbitrum"};const kC=(e,t,n,r,a,i)=>new Promise((async(o,s)=>{let l=Op();if(!l)return void s(Error("Unable to initialize flow"));let c="ethereum"===t.chainType?function(e){let t=bC[e];if(!t)throw new he(`Unsupported chainId: ${e} for Coinbase Onramp`);return t}(t.chain.id):"solana",d=t.isUSDC?"USDC":"ethereum"===t.chainType?Q(t.chain.id,"native-currency"):"SOL",u=await e.initCoinbaseOnRamp({addresses:[{address:t.address,blockchains:[c]}],assets:[d]}),{url:p}=X({appId:e.getAppId(),input:u,amount:t.amount,blockchain:c,asset:d,experience:i});l.location=p.toString();let h={...a?.funding,showAlternateFundingMethod:!0};t.usingDefaultFundingMethod&&(h.usingDefaultFundingMethod=!1),n({funding:h,solanaFundingData:a?.solanaFundingData,coinbaseOnrampStatus:{popup:l}}),r(yC),e.createAnalyticsEvent({eventName:"sdk_fiat_on_ramp_started",payload:{provider:"coinbase-onramp",value:t.amount,chainType:t.chainType,chainId:"ethereum"===t.chainType?t.chain.id:t.cluster.name}}),setTimeout((()=>{n({funding:h,solanaFundingData:a?.solanaFundingData,coinbaseOnrampStatus:{partnerUserId:u.partner_user_id,popup:l}})}),5e3),o()})),AC=({size:n=61,...r})=>/*#__PURE__*/t("svg",{width:n,height:n,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r,children:/*#__PURE__*/e("g",{id:"moonpay_symbol_wht 2",children:[/*#__PURE__*/t("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),/*#__PURE__*/t("path",{id:"Vector",d:"M43.8884 23.3258C45.0203 23.3258 46.1268 22.9901 47.068 22.3613C48.0091 21.7324 48.7427 20.8386 49.1759 19.7928C49.6091 18.747 49.7224 17.5962 49.5016 16.4861C49.2807 15.3759 48.7357 14.3561 47.9353 13.5557C47.1349 12.7553 46.1151 12.2102 45.0049 11.9893C43.8947 11.7685 42.7439 11.8819 41.6982 12.3151C40.6524 12.7482 39.7585 13.4818 39.1297 14.423C38.5008 15.3641 38.1651 16.4707 38.1651 17.6026C38.165 18.3542 38.3131 19.0985 38.6007 19.7929C38.8883 20.4873 39.3098 21.1182 39.8413 21.6496C40.3728 22.1811 41.0037 22.6027 41.6981 22.8903C42.3925 23.1778 43.1367 23.3259 43.8884 23.3258ZM26.3395 49.1017C23.5804 49.1017 20.8832 48.2836 18.5891 46.7507C16.295 45.2178 14.5069 43.039 13.4511 40.49C12.3952 37.9409 12.1189 35.1359 12.6572 32.4298C13.1955 29.7237 14.5241 27.238 16.4751 25.287C18.4262 23.336 20.9118 22.0074 23.6179 21.4691C26.324 20.9308 29.129 21.2071 31.6781 22.2629C34.2272 23.3189 36.406 25.1069 37.9389 27.401C39.4717 29.6952 40.2899 32.3923 40.2899 35.1514C40.2899 36.9835 39.9291 38.7975 39.2281 40.49C38.527 42.1826 37.4994 43.7205 36.204 45.0159C34.9086 46.3113 33.3707 47.3389 31.6781 48.04C29.9856 48.741 28.1715 49.1018 26.3395 49.1017Z",fill:"white"})]})});const TC={component:()=>{let{app:r,data:a,setModalData:s,navigateBack:l}=Is(),{closePrivyModal:c}=Ft(),{externalTransactionId:u}=a?.moonpayStatus,p=function(e,t=!1){let[n,r]=o(null),{createAnalyticsEvent:a}=Ft(),{data:s,navigate:l,setModalData:c}=Is(),u=s?.funding,p=i(0);return d((()=>{let n=setInterval((async()=>{if(e)try{let[i]=await async function(e,t){return Yr(`${t?qa:ja}/transactions/ext/${e}`,{query:{apiKey:t?Ga:Ka}})}(e,t),o="waitingAuthorization"===i.status&&"credit_debit_card"===i.paymentMethod?"pending":i.status;if(["failed","completed","awaitingAuthorization"].includes(o)&&(a({eventName:Vw,payload:{status:o,provider:UC,paymentMethod:i.paymentMethod,cardPaymentType:i.cardPaymentType,currency:i.currency?.code,baseCurrencyAmount:i.baseCurrencyAmount,quoteCurrencyAmount:i.quoteCurrencyAmount,feeAmount:i.feeAmount,extraFeeAmount:i.extraFeeAmount,networkFeeAmount:i.networkFeeAmount,isSandbox:t}}),clearInterval(n)),"failed"===o||"serviceFailure"===o)return c({funding:{...u,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."},solanaFundingData:s?.solanaFundingData}),void l(PC);r(o)}catch(e){404!==e.response?.status&&(p.current+=1),p.current>=3&&(a({eventName:Vw,payload:{status:"serviceFailure",provider:UC}}),clearInterval(n),c({funding:{...u,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."},solanaFundingData:s?.solanaFundingData}),l(PC))}}),3e3);return()=>clearInterval(n)}),[e,p]),n}(u||null,r.fundingMethodConfig.moonpay.useSandbox??!1);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t($l,{title:"Fund account",backFn:()=>{let e={...a?.funding,showAlternateFundingMethod:!0};e.usingDefaultFundingMethod&&(e.usingDefaultFundingMethod=!1),s({funding:e,solanaFundingData:a?.solanaFundingData}),l()}}),/*#__PURE__*/t(xC,{status:p,onClickCta:c}),/*#__PURE__*/t(vl,{})]})}};let xC=({status:r,onClickCta:a})=>{let{title:i,body:o,cta:l}=s((()=>(e=>{switch(e){case"completed":return{title:"You've funded your account!",body:"It may take a few minutes for the assets to appear.",cta:"Continue"};case"waitingAuthorization":return{title:"Processing payment",body:"This may take up to a few hours. You will receive an email when the purchase is complete.",cta:"Continue"};default:return{title:"In Progress",body:"Go back to MoonPay to finish funding your account.",cta:""}}})(r)),[r]);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/e(SC,{children:[/*#__PURE__*/t(IC,{status:r}),/*#__PURE__*/e(Hd,{children:[/*#__PURE__*/t("h3",{children:i}),/*#__PURE__*/t(EC,{children:o})]})]}),l&&/*#__PURE__*/t(Ml,{onClick:a,children:l})]})},IC=({status:n})=>{if(!n||"pending"===n){let n="var(--privy-color-foreground-4)";/*#__PURE__*/return e("div",{style:{position:"relative"},children:[/*#__PURE__*/t(xl,{color:n,style:{position:"absolute"}}),/*#__PURE__*/t(Il,{color:n}),/*#__PURE__*/t(AC,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let r=(e=>{switch(e){case"completed":return Dr;case"waitingAuthorization":return()=>/*#__PURE__*/t(Gr,{width:"3rem",height:"3rem",style:{backgroundColor:"var(--privy-color-foreground-4)",color:"var(--privy-color-background)",borderRadius:"100%",padding:"0.5rem",margin:"0.5rem"}});default:return}})(n),a=(e=>e?{completed:"var(--privy-color-success)",failed:"var(--privy-color-error)",serviceFailure:"var(--privy-color-error)",waitingAuthorization:"var(--privy-color-accent)",pending:"var(--privy-color-foreground-4)"}[e]:"var(--privy-color-foreground-4)")(n);/*#__PURE__*/return t("div",{style:{borderColor:a,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:r&&/*#__PURE__*/t(r,{width:"4rem",height:"4rem",color:a})})},EC=/*#__PURE__*/kn.p.withConfig({displayName:"StatusBody",componentId:"sc-75e2a891-0"})(["font-size:1rem;color:var(--privy-color-foreground-3);margin-bottom:1rem;display:flex;flex-direction:column;gap:1rem;"]),SC=/*#__PURE__*/kn.div.withConfig({displayName:"ConnectContainer",componentId:"sc-75e2a891-1"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin-left:1.75rem;margin-right:1.75rem;padding:2rem 0;"]);const _C=async(e,t,n,r,a,i,o,s)=>{let l=Op();if(!l)throw Error("Unable to initialize flow");let c="ethereum"===t.chainType?t.moonpayConfigOverride?.currencyCode??J(t.chain.id,r):t.isUSDC?"USDC_SOL":"SOL",{signedUrl:d,externalTransactionId:u}=await e.signMoonpayOnRampUrl({address:t.address,useSandbox:n.fundingMethodConfig.moonpay.useSandbox??!1,config:{uiConfig:{accentColor:n.appearance.palette.accent,theme:n.appearance.palette.colorScheme},...t.moonpayConfigOverride,paymentMethod:s,currencyCode:c,quoteCurrencyAmount:t.moonpayConfigOverride?.quoteCurrencyAmount??FC(t.amount)}});e.createAnalyticsEvent({eventName:"sdk_fiat_on_ramp_started",payload:{provider:"moonpay",value:t.amount,chainType:t.chainType,chainId:"ethereum"===t.chainType?t.chain.id:t.cluster.name}}),l.location=d;let p={...o?.funding,showAlternateFundingMethod:!0};t.usingDefaultFundingMethod&&(p.usingDefaultFundingMethod=!1),a({moonpayStatus:{},funding:p,solanaFundingData:o?.solanaFundingData}),i(TC),setTimeout((()=>{a({moonpayStatus:{externalTransactionId:u},funding:p,solanaFundingData:o?.solanaFundingData})}),8e3)};let NC=async e=>"undefined"!=typeof window&&"PaymentRequest"in window&&await new window.PaymentRequest([{supportedMethods:e}],{id:"0",total:{label:"Item",amount:{currency:"USD",value:"1.00"}}}).canMakePayment();const MC=()=>NC("https://apple.com/apple-pay"),WC=()=>NC("https://google.com/pay"),PC={component:()=>{let{wallets:r}=bu(),{wallets:a}=ok(),{navigate:i,data:o,setModalData:l}=Is(),{client:c}=Ft(),u=ks(),p=o?.funding,h=hC(MC),m=hC(WC),g="solana"===p.chainType,y=g?void 0:p,f=s((()=>((e,t,n,r,a,i)=>{let o,s,l="solana"===n.chainType,c=l?void 0:n,d=n.isUSDC?"USDC":c?.erc20Address?void 0:"native-currency",u=!!l||d&&ee(Number(n.chain.id),d),p=!!l||d&&te(Number(n.chain.id),d),h=[];for(let o of(n.preferredCardProvider&&n.supportedOptions.sort((e=>e.provider===n.preferredCardProvider?-1:1)),n.supportedOptions))"card"===o.method&&"coinbase"===o.provider&&p&&h.push((()=>kC(t,n,r,a,i,"buy"))),"card"===o.method&&"moonpay"===o.provider&&u&&d&&h.push((()=>_C(t,n,e,d,r,a,i,"credit_debit_card")));for(let e of n.supportedOptions)"exchange"===e.method&&"coinbase"===e.provider&&p&&(o=()=>kC(t,n,r,a,i,"buy"));for(let e of i?.funding?.supportedOptions??[])"wallets"===e.method&&(s=()=>a(iC));return{onFundWithCard:h,onFundWithExchange:o,onFundWithWallet:s}})(u,c,p,l,i,o)),[u,c,p,o,l,i]),w=g?a.find((({address:e})=>e===p.address)):r.find((({address:e})=>v(e)===v(p.address))),C=ts(w?.walletClientType||"unknown"),b=C?.name||"wallet",k=w&&"privy"!==w.walletClientType?b:u.name,A=s((()=>p.uiConfig?.landing?.title?p.uiConfig?.landing?.title:`Add funds to your ${k?.toLowerCase().endsWith("wallet")?k:k+" wallet"}`),[p.uiConfig?.landing?.title,k]);d((()=>{if(p?.defaultFundingMethod&&p.usingDefaultFundingMethod)switch(l({funding:{...p,usingDefaultFundingMethod:!1},solanaFundingData:o?.solanaFundingData}),p?.defaultFundingMethod){case"card":f.onFundWithCard[0]&&f.onFundWithCard[0]();break;case"exchange":f.onFundWithExchange&&f.onFundWithExchange();break;case"wallet":f.onFundWithWallet&&f.onFundWithWallet();break;case"manual":i(sk)}}),[]),d((()=>{y?.erc20Address&&!y.erc20ContractInfo&&mC({address:y.erc20Address,chain:y.chain,rpcConfig:u.rpcConfig,privyAppId:u.id}).then((e=>{l({...o,funding:{...y,erc20ContractInfo:e?{symbol:e.symbol,decimals:e.decimals}:void 0}})})).catch(console.error)}),[y?.erc20Address,y?.chain]);let T=!(!y?.erc20Address||y?.erc20ContractInfo);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Pk,{}),/*#__PURE__*/t("h3",{children:A}),/*#__PURE__*/e(Vv,{children:[p.errorMessage&&/*#__PURE__*/t(lC,{theme:u.appearance.palette.colorScheme,children:p.errorMessage}),f.onFundWithCard?.[0]&&/*#__PURE__*/e(ul,{disabled:T,onClick:f.onFundWithCard[0],children:[/*#__PURE__*/t($v,{children:/*#__PURE__*/t(qr,{style:{width:24}})}),"Pay with card",h?/*#__PURE__*/t(uC,{style:{marginLeft:"auto",maxWidth:"100%",width:"auto",height:"0.875rem"}}):m?/*#__PURE__*/t(pC,{style:{marginLeft:"auto",maxWidth:"100%",width:"auto",height:"0.875rem"}}):null]}),f.onFundWithExchange&&/*#__PURE__*/e(ul,{disabled:T,onClick:f.onFundWithExchange,children:[/*#__PURE__*/t($v,{children:/*#__PURE__*/t(Gr,{style:{width:24}})}),"Transfer from an exchange"]}),f.onFundWithWallet&&/*#__PURE__*/e(ul,{disabled:T,onClick:f.onFundWithWallet,children:[/*#__PURE__*/t($v,{children:/*#__PURE__*/t(vg,{style:{width:24}})}),"Transfer from wallet"]}),/*#__PURE__*/e(ul,{disabled:T,onClick:()=>i(sk),children:[/*#__PURE__*/t($v,{children:/*#__PURE__*/t(Kr,{style:{width:24}})}),"Receive funds"]}),p?.showAlternateFundingMethod&&f.onFundWithCard?.[1]&&/*#__PURE__*/t(_w,{theme:u.appearance.palette.colorScheme,children:/*#__PURE__*/e(Qv,{children:["Having trouble or facing location restrictions?"," ",/*#__PURE__*/t(Xv,{onClick:f.onFundWithCard[1],children:"Try a different provider."})]})})]}),/*#__PURE__*/t(vl,{})]})}},UC="moonpay";function FC(e){return parseFloat(e)}function OC(e){return!!e&&void 0!==e.config&&void 0!==e.provider}function LC(e){return!!e&&(void 0!==e.chain||void 0!==e.amount)}const RC={[_.id]:"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",[ne.id]:"0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",[q.id]:"0x0b2c639c533813f4aa9d7837caf62653d097ff85",[re.id]:"0x5fd84259d66Cd46123540766Be93DFE6D43130D7",[K.id]:"0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",[ae.id]:"0x41e94eb019c0762f9bfcf9fb1e58725bfb0e7582",[V.id]:"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",[ie.id]:"0x036CbD53842c5426634e7929541eC2318f3dCF7e",[H.id]:"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",[oe.id]:"0x5425890298aed601595a70ab815c96711a31bc65",[z.id]:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",[se.id]:"0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"},DC=({address:e,appConfig:t,fundWalletConfig:n,methodScreen:r,chainIdOverride:a,comingFromSendTransactionScreen:i=!1})=>{let o,s;if(!t.fundingConfig)throw Error("Wallet funding is not enabled");let l=rv(t.fundingConfig.options);if(l.length<1)throw Error("Wallet funding is not enabled");o=a||(LC(n)&&n.chain?n.chain.id:Mp(t.fundingConfig.defaultRecommendedCurrency.chain));let c=t.chains.find((e=>e.id===o));if(!c)throw new he(`Funding chain ${o} is not in PrivyProvider chains list`);let d=LC(n)&&n.amount?n.amount:t.fundingConfig.defaultRecommendedAmount,u=!1;function p(){if(!o)return;let e=RC[o];l.find((e=>"wallets"===e.method))&&!e&&console.warn("Attempting to fund with USDC on chain where USDC address is not known. Funding via external wallet will be disabled."),s=e,u=!0}LC(n)&&"asset"in n?"USDC"===n.asset?p():"string"!=typeof n.asset&&"erc20"in n.asset&&(u=((e,t)=>e===RC[t.id])(s=n.asset.erc20,c)):"USDC"===t.fundingConfig.defaultRecommendedCurrency.asset&&p();let h=n?.defaultFundingMethod;return{chainType:"ethereum",address:e,amount:d,chain:c,erc20Address:s,erc20ContractInfo:u?{symbol:"USDC",decimals:6}:void 0,isUSDC:u,methodScreen:r,supportedOptions:l,comingFromSendTransactionScreen:i,defaultFundingMethod:h,usingDefaultFundingMethod:!!h,preferredCardProvider:n?.card?.preferredProvider,crossChainBridgingEnabled:t.fundingConfig.crossChainBridgingEnabled??!1,cluster:{name:"mainnet-beta",rpcUrl:t.solanaClusters["mainnet-beta"].rpcUrl},...OC(n)?{moonpayConfigOverride:n.config}:{},uiConfig:n&&"uiConfig"in n?n.uiConfig:void 0,externalSolanaFundingScreen:sC}};function BC({address:e,fundWalletConfig:t,appConfig:n,comingFromSendTransactionScreen:r,externalSolanaFundingScreen:a,methodScreen:i}){if(!n.fundingConfig)throw Error("Wallet funding is not enabled");let o=rv(n.fundingConfig.options);if(o.length<1)throw Error("Wallet funding is not enabled");if("USDC"===t?.asset&&"testnet"===t?.cluster?.name)throw Error("USDC funding is not supported on the Solana testnet");let s=t?.amount??n.fundingConfig.defaultRecommendedAmount,l=t?.defaultFundingMethod;return{chainType:"solana",address:e,supportedOptions:o,amount:s,isUSDC:"USDC"===t?.asset,methodScreen:i,comingFromSendTransactionScreen:r,cluster:{name:t?.cluster?.name??"mainnet-beta",rpcUrl:n.solanaClusters[t?.cluster?.name??"mainnet-beta"].rpcUrl},crossChainBridgingEnabled:n.fundingConfig.crossChainBridgingEnabled??!1,defaultFundingMethod:l,preferredCardProvider:t?.card?.preferredProvider,usingDefaultFundingMethod:!!l,uiConfig:t?.uiConfig,externalSolanaFundingScreen:a}}const zC=({children:n,theme:r})=>/*#__PURE__*/e(HC,{$theme:r,children:[/*#__PURE__*/t(Fn,{width:"20px",height:"20px",color:"var(--privy-color-icon-warning)",strokeWidth:2,style:{flexShrink:0}}),/*#__PURE__*/t(VC,{$theme:r,children:n})]});let HC=/*#__PURE__*/kn.div.withConfig({displayName:"Container",componentId:"sc-a77c2854-0"})(["display:flex;gap:0.75rem;background-color:var(--privy-color-warn-bg);align-items:flex-start;padding:1rem;border-radius:0.75rem;"]),VC=/*#__PURE__*/kn.div.withConfig({displayName:"Content",componentId:"sc-a77c2854-1"})(["color:",";font-size:1rem;font-weight:400;line-height:1.5;flex:1;text-align:left;"],(e=>"dark"===e.$theme?"var(--privy-color-foreground-2)":"var(--privy-color-foreground)"));const $C=({address:r,accessToken:a,appConfigTheme:i,onClose:o,isLoading:s=!1,exportButtonProps:l})=>/*#__PURE__*/t(kc,{title:"Export wallet",subtitle:/*#__PURE__*/e(n,{children:["Copy either your private key or seed phrase to export your wallet."," ",/*#__PURE__*/t("a",{href:"https://privy-io.notion.site/Transferring-your-account-9dab9e16c6034a7ab1ff7fa479b02828",target:"blank",rel:"noopener noreferrer",children:"Learn more"})]}),onClose:o,watermark:!0,children:/*#__PURE__*/e(jC,{children:[/*#__PURE__*/t(zC,{theme:i,children:"Never share your private key or seed phrase with anyone."}),/*#__PURE__*/t(zw,{title:"Your wallet",address:r,showCopyButton:!0}),/*#__PURE__*/t("div",{style:{width:"100%"},children:s?/*#__PURE__*/t(qC,{}):a&&l&&/*#__PURE__*/t(ZC,{accessToken:a,dimensions:{height:"44px"},...l})})]})});let jC=/*#__PURE__*/kn.div.withConfig({displayName:"ContentContainer",componentId:"sc-e0132ced-0"})(["display:flex;flex-direction:column;gap:1.25rem;text-align:left;"]),qC=()=>/*#__PURE__*/t(KC,{children:/*#__PURE__*/t(GC,{children:"Loading..."})}),KC=/*#__PURE__*/kn.div.withConfig({displayName:"PlaceholderContainer",componentId:"sc-e0132ced-1"})(["display:flex;gap:12px;height:44px;"]),GC=/*#__PURE__*/kn.div.withConfig({displayName:"PlaceholderButton",componentId:"sc-e0132ced-2"})(["display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-size:16px;font-weight:500;border-radius:var(--privy-border-radius-md);background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-3);"]);function ZC(n){let[r,a]=o(n.dimensions.width),[s,l]=o(void 0),c=i(null);d((()=>{if(c.current&&void 0===r){let{width:e}=c.current.getBoundingClientRect();a(e)}let e=getComputedStyle(document.documentElement);l({background:e.getPropertyValue("--privy-color-background"),background2:e.getPropertyValue("--privy-color-background-2"),foreground3:e.getPropertyValue("--privy-color-foreground-3"),foregroundAccent:e.getPropertyValue("--privy-color-foreground-accent"),accent:e.getPropertyValue("--privy-color-accent"),accentDark:e.getPropertyValue("--privy-color-accent-dark"),success:e.getPropertyValue("--privy-color-success"),colorScheme:e.getPropertyValue("color-scheme")})}),[]);let u="ethereum"===n.chainType&&!n.imported&&!n.isUnifiedWallet;/*#__PURE__*/return t("div",{ref:c,children:r&&
|
|
27
|
+
/*#__PURE__*/e(QC,{children:[/*#__PURE__*/t("iframe",{style:{position:"absolute",zIndex:1},width:r,height:n.dimensions.height,allow:"clipboard-write self *",src:Ri(n.origin,`/apps/${n.appId}/embedded-wallets/export`,n.isUnifiedWallet?{v:"1-unified",wallet_id:n.walletId,client_id:n.appClientId,width:`${r}px`,caid:n.clientAnalyticsId,phrase_export:u,...s}:{v:"1",entropy_id:n.entropyId,entropy_id_verifier:n.entropyIdVerifier,hd_wallet_index:n.hdWalletIndex,chain_type:n.chainType,client_id:n.appClientId,width:`${r}px`,caid:n.clientAnalyticsId,phrase_export:u,...s},{token:n.accessToken})}),/*#__PURE__*/t(XC,{children:"Loading..."}),u&&/*#__PURE__*/t(XC,{children:"Loading..."})]})})}const YC={component:()=>{let[e,n]=o(null),{authenticated:r,user:a}=on(),{closePrivyModal:i,createAnalyticsEvent:s,clientAnalyticsId:l,client:c}=Ft(),u=ks(),{data:p,onUserCloseViaDialogOrKeybindRef:h}=Is(),{onFailure:m,onSuccess:g,origin:y,appId:f,appClientId:w,entropyId:v,entropyIdVerifier:C,walletId:b,hdWalletIndex:k,chainType:A,address:T,isUnifiedWallet:x,imported:I}=p.keyExport,E=e=>{i({shouldCallAuthOnSuccess:!1}),m("string"==typeof e?Error(e):e)},S=()=>{i({shouldCallAuthOnSuccess:!1}),g(),s({eventName:"embedded_wallet_key_export_completed",payload:{walletAddress:T}})};return d((()=>{if(!r)return E("User must be authenticated before exporting their wallet");c.getAccessToken().then(n).catch(E)}),[r,a]),h.current=S,/*#__PURE__*/t($C,{address:T,accessToken:e,appConfigTheme:u.appearance.palette.colorScheme,onClose:S,isLoading:!e,exportButtonProps:e?{origin:y,appId:f,appClientId:w,clientAnalyticsId:l,entropyId:v,entropyIdVerifier:C,walletId:b,hdWalletIndex:k,isUnifiedWallet:x,imported:I,chainType:A}:void 0})}};let QC=/*#__PURE__*/kn.div.withConfig({displayName:"ButtonContainer",componentId:"sc-e0132ced-3"})(["overflow:visible;position:relative;overflow:none;height:44px;display:flex;gap:12px;"]),XC=/*#__PURE__*/kn.div.withConfig({displayName:"LoadingButton",componentId:"sc-e0132ced-4"})(["display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-size:16px;font-weight:500;border-radius:var(--privy-border-radius-md);background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-3);"]);const JC=({connectionFailed:e,onClose:n})=>/*#__PURE__*/t(kc,e?{title:"Something went wrong",subtitle:"We're on it. Please try again later.",icon:Jn,iconVariant:"error",primaryCta:{label:"Close",onClick:n},watermark:!0}:{title:"Connecting to your wallet",subtitle:"Please wait...",iconVariant:"loading",showClose:!0,onClose:n,watermark:!1}),eb={component:()=>{let{authenticated:e,user:n}=on(),{client:r,closePrivyModal:a,createAnalyticsEvent:i,walletProxy:l}=Ft(),{navigate:c,data:u,setModalData:p,onUserCloseViaDialogOrKeybindRef:h}=Is(),m=s((()=>Date.now()),[]),[g,y]=o(!1),{onCompleteNavigateTo:f,onFailure:w,shouldForceMFA:v,entropyId:C,entropyIdVerifier:b,recoveryMethod:k,connectingWalletAddress:A,isUnifiedWallet:T=!1}=u?.connectWallet,x=e=>{g||(y(!0),w("string"==typeof e?Error(e):e))};return d((()=>{let t;return e?l?((async()=>{let e=await r.getAccessToken();if(!e)return x("User must be authenticated and have a Privy wallet before it can be connected");try{T||await l.connect({accessToken:e,entropyId:C,entropyIdVerifier:b}),v&&await l.verifyMfa({accessToken:e});let n=(Date.now()-m)/1e3;f===YC&&n<1?t=setTimeout((()=>{c(f,!1)}),1e3*(1-n)):c(f,!1)}catch(e){if(Bu(e)&&"privy"===k){let e=await r.getAccessToken();if(!e)return x("User must be authenticated and have a Privy wallet before it can be recovered");try{i({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:A}});let t=await(l?.recover({accessToken:e,entropyId:C,entropyIdVerifier:b}));t?.entropyId||x(Error("Unable to recover wallet")),f?c(f):a({shouldCallAuthOnSuccess:!1}),i({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:A}}),c(f)}catch(e){x("An error has occurred, please try again.")}}else Bu(e)&&"privy"!==k&&"privy-v2"!==k?(p({...u,recoverWallet:{entropyId:C,entropyIdVerifier:b,onCompleteNavigateTo:f,onFailure:w},recoveryOAuthStatus:{provider:k,action:"recover",isInAccountCreateFlow:!1,shouldCreateEth:!1,shouldCreateSol:!1}}),c(Sw(k))):x(e)}})(),()=>clearTimeout(t)):void 0:x("User must be authenticated and have a Privy wallet before it can be connected")}),[e,n,l]),h.current=()=>{x("User exited before wallet could be connected"),a({shouldCallAuthOnSuccess:!1})},/*#__PURE__*/t(JC,{connectionFailed:g,onClose:()=>a({shouldCallAuthOnSuccess:!1})})}},tb=/*#__PURE__*/kn(uv).withConfig({displayName:"InteractiveLabel",componentId:"sc-b57d0824-0"})(["cursor:pointer;display:inline-flex;gap:8px;align-items:center;color:var(--privy-color-accent);svg{fill:var(--privy-color-accent);}"]);var nb=({iconUrl:n,value:r,symbol:a,usdValue:i,nftName:o,nftCount:s,decimals:l,$isLoading:c})=>{if(c)/*#__PURE__*/return t(rb,{$isLoading:c});let d=r&&i&&l?function(e,t,n){let r=parseFloat(e),a=parseFloat(n);if(0===r||0===a||Number.isNaN(r)||Number.isNaN(a))return e;let i=Math.ceil(-Math.log10(.01/(a/r))),o=Math.pow(10,i=Math.max(i=Math.min(i,t),1)),s=+(Math.floor(r*o)/o).toFixed(i).replace(/\.?0+$/,"");return Intl.NumberFormat(void 0,{maximumFractionDigits:t}).format(s)}(r,l,i):r;/*#__PURE__*/return e("div",{children:[/*#__PURE__*/e(rb,{$isLoading:c,children:[n&&/*#__PURE__*/t(ib,{src:n,alt:"Token icon"}),s&&s>1?s+"x":void 0," ",o,d," ",a]}),i&&/*#__PURE__*/e(ab,{$isLoading:c,children:["$",i]})]})};let rb=/*#__PURE__*/kn.span.withConfig({displayName:"Value",componentId:"sc-991db279-0"})(["color:var(--privy-color-foreground);font-size:0.875rem;font-weight:500;line-height:1.375rem;word-break:break-all;text-align:right;display:flex;justify-content:flex-end;",""],Ay);const ab=/*#__PURE__*/kn.span.withConfig({displayName:"Subvalue",componentId:"sc-991db279-1"})(["color:var(--privy-color-foreground-2);font-size:12px;font-weight:400;line-height:18px;word-break:break-all;text-align:right;display:flex;justify-content:flex-end;",""],Ay);let ib=/*#__PURE__*/kn.img.withConfig({displayName:"TokenIcon",componentId:"sc-991db279-2"})(["height:14px;width:14px;margin-right:4px;object-fit:contain;"]);const ob=r=>{let{chain:a,transactionDetails:i,isTokenContractInfoLoading:o,symbol:s}=r,{action:l,functionName:c}=i;/*#__PURE__*/return t(Pw,{children:/*#__PURE__*/e(cv,{children:["transaction"!==l&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Action"}),/*#__PURE__*/t(hv,{children:c})]}),"mint"===c&&"args"in i&&i.args.filter((e=>e)).map(((n,r)=>/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:`Param ${r}`}),/*#__PURE__*/t(hv,{children:"string"==typeof n&&Zt(n)?/*#__PURE__*/t(pp,{address:n,url:a?.blockExplorers?.default?.url,showCopyIcon:!1}):n?.toString()})]},r))),"setApprovalForAll"===c&&i.operator&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Operator"}),/*#__PURE__*/t(hv,{children:/*#__PURE__*/t(pp,{address:i.operator,url:a?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),"setApprovalForAll"===c&&void 0!==i.approved&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Set approval to"}),/*#__PURE__*/t(hv,{children:i.approved?"true":"false"})]}),"transfer"===c||"transferFrom"===c||"safeTransferFrom"===c||"approve"===c?/*#__PURE__*/e(n,{children:["formattedAmount"in i&&i.formattedAmount&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Amount"}),/*#__PURE__*/e(hv,{$isLoading:o,children:[i.formattedAmount," ",s]})]}),"tokenId"in i&&i.tokenId&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Token ID"}),/*#__PURE__*/t(hv,{children:i.tokenId.toString()})]})]}):null,"safeBatchTransferFrom"===c&&/*#__PURE__*/e(n,{children:["amounts"in i&&i.amounts&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Amounts"}),/*#__PURE__*/t(hv,{children:i.amounts.join(", ")})]}),"tokenIds"in i&&i.tokenIds&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Token IDs"}),/*#__PURE__*/t(hv,{children:i.tokenIds.join(", ")})]})]}),"approve"===c&&i.spender&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Spender"}),/*#__PURE__*/t(hv,{children:/*#__PURE__*/t(pp,{address:i.spender,url:a?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),("transferFrom"===c||"safeTransferFrom"===c||"safeBatchTransferFrom"===c)&&i.transferFrom&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Transferring from"}),/*#__PURE__*/t(hv,{children:/*#__PURE__*/t(pp,{address:i.transferFrom,url:a?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),("transferFrom"===c||"safeTransferFrom"===c||"safeBatchTransferFrom"===c)&&i.transferTo&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Transferring to"}),/*#__PURE__*/t(hv,{children:/*#__PURE__*/t(pp,{address:i.transferTo,url:a?.blockExplorers?.default?.url,showCopyIcon:!1})})]})]})})},sb=({variant:r,setPreventMaliciousTransaction:a,colorScheme:i="light",preventMaliciousTransaction:o})=>"warn"===r?/*#__PURE__*/t(lb,{children:/*#__PURE__*/e(zC,{theme:i,children:[/*#__PURE__*/t("span",{style:{fontWeight:"500"},children:"Warning: Suspicious transaction"}),/*#__PURE__*/t("br",{}),"This has been flagged as a potentially deceptive request. Approving could put your assets or funds at risk."]})}):"error"===r?/*#__PURE__*/t(n,{children:/*#__PURE__*/e(lb,{children:[/*#__PURE__*/t(lC,{theme:i,children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t("strong",{children:"This is a malicious transaction"}),/*#__PURE__*/t("br",{}),"This transaction transfers tokens to a known malicious address. Proceeding may result in the loss of valuable assets."]})}),/*#__PURE__*/e(cb,{children:[/*#__PURE__*/t(Eh,{color:"var(--privy-color-error)",checked:!o,readOnly:!0,onClick:()=>a(!o)}),/*#__PURE__*/t("span",{children:"I understand and want to proceed anyways."})]})]})}):null;let lb=/*#__PURE__*/kn.div.withConfig({displayName:"BannerContainer",componentId:"sc-ab8a5a0b-0"})(["margin-top:1.5rem;"]),cb=/*#__PURE__*/kn.div.withConfig({displayName:"CheckboxContainer",componentId:"sc-ab8a5a0b-1"})(["display:flex;align-items:center;gap:0.5rem;margin-top:0.75rem;"]);const db=({transactionIndex:e,maxIndex:t})=>"number"!=typeof e||0===t?"":` (${e+1} / ${t+1})`,ub=({img:r,submitError:a,prepareError:i,onClose:s,action:l,title:c,subtitle:d,to:u,tokenAddress:p,network:h,missingFunds:m,fee:g,from:y,cta:f,disabled:w,chain:v,isSubmitting:C,isPreparing:b,isTokenPriceLoading:k,isTokenContractInfoLoading:A,isSponsored:T,symbol:x,balance:I,onClick:E,transactionDetails:S,transactionIndex:_,maxIndex:N,onBack:M,chainName:W,validation:P,hasScanDetails:U,setIsScanDetailsOpen:F,preventMaliciousTransaction:O,setPreventMaliciousTransaction:L,tokensSent:R,tokensReceived:D,isScanning:B,isCancellable:z,functionName:H})=>{let{showTransactionDetails:V,setShowTransactionDetails:$,hasMoreDetails:j,isErc20Ish:q}=(e=>{let[t,n]=o(!1),r=!0,a=!1;return(!e||e.isErc20Ish||"transaction"===e.action)&&(r=!1),r&&(a=Object.entries(e||{}).some((([e,t])=>t&&!["action","isErc20Ish","isNFTIsh"].includes(e)))),{showTransactionDetails:t,setShowTransactionDetails:n,hasMoreDetails:r&&a,isErc20Ish:e?.isErc20Ish}})(S),K=ks(),G=q&&A||b||k||B;/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t($l,{onClose:s,backFn:M}),r&&/*#__PURE__*/t(yb,{children:r}),/*#__PURE__*/e(Tw,{style:{marginTop:r?"1.5rem":0},children:[c,/*#__PURE__*/t(db,{maxIndex:N,transactionIndex:_})]}),/*#__PURE__*/t(Aw,{children:d}),/*#__PURE__*/e(cv,{style:{marginTop:"2rem"},children:[(!!R[0]||G)&&/*#__PURE__*/e(dv,{children:[D.length>0?/*#__PURE__*/t(uv,{children:"Send"}):/*#__PURE__*/t(uv,{children:"approve"===l?"Approval amount":"Amount"}),/*#__PURE__*/t("div",{className:"flex flex-col",children:R.map(((e,n)=>/*#__PURE__*/t(nb,{iconUrl:e.iconUrl,value:"setApprovalForAll"===H?"All":e.value,usdValue:e.usdValue,symbol:e.symbol,nftName:e.nftName,nftCount:e.nftCount,decimals:e.decimals},n)))})]}),D.length>0&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Receive"}),/*#__PURE__*/t("div",{className:"flex flex-col",children:D.map(((e,n)=>/*#__PURE__*/t(nb,{iconUrl:e.iconUrl,value:e.value,usdValue:e.usdValue,symbol:e.symbol,nftName:e.nftName,nftCount:e.nftCount,decimals:e.decimals},n)))})]}),S&&"spender"in S&&S?.spender?/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Spender"}),/*#__PURE__*/t(hv,{children:/*#__PURE__*/t(pp,{address:S.spender,url:v?.blockExplorers?.default?.url})})]}):null,u&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"To"}),/*#__PURE__*/t(hv,{children:/*#__PURE__*/t(pp,{address:u,url:v?.blockExplorers?.default?.url,showCopyIcon:!0})})]}),p&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Token address"}),/*#__PURE__*/t(hv,{children:/*#__PURE__*/t(pp,{address:p,url:v?.blockExplorers?.default?.url})})]}),/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Network"}),/*#__PURE__*/t(hv,{children:h})]}),/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Estimated fee"}),/*#__PURE__*/t(hv,{$isLoading:b||k||void 0===T,children:T?/*#__PURE__*/e(fb,{children:[/*#__PURE__*/e(wb,{children:["Sponsored by ",K.name]}),/*#__PURE__*/t(Er,{height:16,width:16})]}):g})]}),j&&!U&&/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(dv,{className:"cursor-pointer",onClick:()=>$(!V),children:/*#__PURE__*/e(pv,{className:"flex items-center gap-x-1",children:["Details"," ",/*#__PURE__*/t(Sr,{style:{width:"0.75rem",marginLeft:"0.25rem",transform:V?"rotate(180deg)":void 0}})]})}),V&&S&&/*#__PURE__*/t(ob,{action:l,chain:v,transactionDetails:S,isTokenContractInfoLoading:A,symbol:x})]}),U&&/*#__PURE__*/t(dv,{children:/*#__PURE__*/e(tb,{onClick:()=>F(!0),children:[/*#__PURE__*/t("span",{className:"text-color-primary",children:"Details"}),/*#__PURE__*/t(_r,{height:"14px",width:"14px",strokeWidth:"2"})]})})]}),/*#__PURE__*/t(il,{}),a?/*#__PURE__*/t(mg,{style:{marginTop:"2rem"},children:a.message}):i&&0===_?
|
|
28
|
+
/*#__PURE__*/t(mg,{style:{marginTop:"2rem"},children:i.shortMessage??gb}):null,/*#__PURE__*/t(sb,{variant:P,preventMaliciousTransaction:O,setPreventMaliciousTransaction:L}),/*#__PURE__*/t(hb,{$useSmallMargins:!(!i&&!a&&"warn"!==P&&"error"!==P),address:y,balance:I,errMsg:b||i||a||!m?void 0:`Add funds on ${v?.name??W} to complete transaction.`}),/*#__PURE__*/t(Ml,{style:{marginTop:"1rem"},loading:C,disabled:w||b,onClick:E,children:f}),z&&/*#__PURE__*/t(Dl,{style:{marginTop:"1rem"},onClick:s,isSubmitting:!1,children:"Not now"}),/*#__PURE__*/t(vl,{})]})},pb=({img:r,title:a,subtitle:i,cta:s,instructions:l,network:c,blockExplorerUrl:d,isMissingFunds:u,submitError:p,parseError:h,total:m,swap:g,transactingWalletAddress:y,fee:f,balance:w,disabled:v,isSubmitting:C,isPreparing:b,isTokenPriceLoading:k,onClick:A,onClose:T,onBack:x})=>{let I=b||k,[E,S]=o(!1);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t($l,{onClose:T,backFn:x}),r&&/*#__PURE__*/t(yb,{children:r}),/*#__PURE__*/t(Tw,{style:{marginTop:r?"1.5rem":0},children:a}),/*#__PURE__*/t(Aw,{children:i}),/*#__PURE__*/e(cv,{style:{marginTop:"2rem",marginBottom:".5rem"},children:[(m||I)&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Amount"}),/*#__PURE__*/t(hv,{$isLoading:I,children:m})]}),g&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Swap"}),/*#__PURE__*/t(hv,{children:g})]}),c&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Network"}),/*#__PURE__*/t(hv,{children:c})]}),(f||I)&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Estimated fee"}),/*#__PURE__*/t(hv,{$isLoading:I,children:f})]})]}),/*#__PURE__*/t(dv,{children:/*#__PURE__*/e(tb,{onClick:()=>S((e=>!e)),children:[/*#__PURE__*/t("span",{children:"Advanced"}),/*#__PURE__*/t(Sr,{height:"16px",width:"16px",strokeWidth:"2",style:{transition:"all 300ms",transform:E?"rotate(180deg)":void 0}})]})}),E&&/*#__PURE__*/t(n,{children:l.map(((n,r)=>"sol-transfer"===n.type?/*#__PURE__*/e(mb,{children:[/*#__PURE__*/t(dv,{children:/*#__PURE__*/e(_y,{children:["Transfer ",n.withSeed?"with seed":""]})}),/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Amount"}),/*#__PURE__*/e(hv,{children:[le({amount:n.value,decimals:n.token.decimals})," ",n.token.symbol]})]}),!!n.toAccount&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Destination"}),/*#__PURE__*/t(hv,{children:/*#__PURE__*/t(pp,{address:n.toAccount,url:d})})]})]},r):"spl-transfer"===n.type?/*#__PURE__*/e(mb,{children:[/*#__PURE__*/t(dv,{children:/*#__PURE__*/e(_y,{children:["Transfer ",n.token.symbol]})}),/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Amount"}),/*#__PURE__*/t(hv,{children:n.value.toString()})]}),!!n.fromAta&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Source"}),/*#__PURE__*/t(hv,{children:/*#__PURE__*/t(pp,{address:n.fromAta,url:d})})]}),!!n.toAta&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Destination"}),/*#__PURE__*/t(hv,{children:/*#__PURE__*/t(pp,{address:n.toAta,url:d})})]}),!!n.token.address&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Token"}),/*#__PURE__*/t(hv,{children:/*#__PURE__*/t(pp,{address:n.token.address,url:d})})]})]},r):"ata-creation"===n.type?/*#__PURE__*/e(mb,{children:[/*#__PURE__*/t(dv,{children:/*#__PURE__*/t(_y,{children:"Create token account"})}),/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Program ID"}),/*#__PURE__*/t(hv,{children:/*#__PURE__*/t(pp,{address:n.program,url:d})})]}),!!n.owner&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Owner"}),/*#__PURE__*/t(hv,{children:/*#__PURE__*/t(pp,{address:n.owner,url:d})})]})]},r):"create-account"===n.type?/*#__PURE__*/e(mb,{children:[/*#__PURE__*/t(dv,{children:/*#__PURE__*/e(_y,{children:["Create account ",n.withSeed?"with seed":""]})}),!!n.account&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Account"}),/*#__PURE__*/t(hv,{children:/*#__PURE__*/t(pp,{address:n.account,url:d})})]}),/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Amount"}),/*#__PURE__*/e(hv,{children:[le({amount:n.value,decimals:9})," SOL"]})]})]},r):"spl-init-account"===n.type?/*#__PURE__*/e(mb,{children:[/*#__PURE__*/t(dv,{children:/*#__PURE__*/t(_y,{children:"Initialize token account"})}),!!n.account&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Account"}),/*#__PURE__*/t(hv,{children:/*#__PURE__*/t(pp,{address:n.account,url:d})})]}),!!n.mint&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Mint"}),/*#__PURE__*/t(hv,{children:/*#__PURE__*/t(pp,{address:n.mint,url:d})})]}),!!n.owner&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Owner"}),/*#__PURE__*/t(hv,{children:/*#__PURE__*/t(pp,{address:n.owner,url:d})})]})]},r):"spl-close-account"===n.type?/*#__PURE__*/e(mb,{children:[/*#__PURE__*/t(dv,{children:/*#__PURE__*/t(_y,{children:"Close token account"})}),!!n.source&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Source"}),/*#__PURE__*/t(hv,{children:/*#__PURE__*/t(pp,{address:n.source,url:d})})]}),!!n.destination&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Destination"}),/*#__PURE__*/t(hv,{children:/*#__PURE__*/t(pp,{address:n.destination,url:d})})]}),!!n.owner&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Owner"}),/*#__PURE__*/t(hv,{children:/*#__PURE__*/t(pp,{address:n.owner,url:d})})]})]},r):"spl-sync-native"===n.type?/*#__PURE__*/e(mb,{children:[/*#__PURE__*/t(dv,{children:/*#__PURE__*/t(_y,{children:"Sync native"})}),/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Program ID"}),/*#__PURE__*/t(hv,{children:/*#__PURE__*/t(pp,{address:n.program,url:d})})]})]},r):"raydium-swap-base-input"===n.type?/*#__PURE__*/e(mb,{children:[/*#__PURE__*/t(dv,{children:/*#__PURE__*/e(_y,{children:["Raydium swap"," ",n.tokenIn&&n.tokenOut?`${n.tokenIn.symbol} → ${n.tokenOut.symbol}`:""]})}),/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Amount in"}),/*#__PURE__*/t(hv,{children:n.amountIn.toString()})]}),/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Minimum amount out"}),/*#__PURE__*/t(hv,{children:n.minimumAmountOut.toString()})]}),n.mintIn&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Token in"}),/*#__PURE__*/t(hv,{children:/*#__PURE__*/t(pp,{address:n.mintIn,url:d})})]}),n.mintOut&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Token out"}),/*#__PURE__*/t(hv,{children:/*#__PURE__*/t(pp,{address:n.mintOut,url:d})})]})]},r):"raydium-swap-base-output"===n.type?/*#__PURE__*/e(mb,{children:[/*#__PURE__*/t(dv,{children:/*#__PURE__*/e(_y,{children:["Raydium swap"," ",n.tokenIn&&n.tokenOut?`${n.tokenIn.symbol} → ${n.tokenOut.symbol}`:""]})}),/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Max amount in"}),/*#__PURE__*/t(hv,{children:n.maxAmountIn.toString()})]}),/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Amount out"}),/*#__PURE__*/t(hv,{children:n.amountOut.toString()})]}),n.mintIn&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Token in"}),/*#__PURE__*/t(hv,{children:/*#__PURE__*/t(pp,{address:n.mintIn,url:d})})]}),n.mintOut&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Token out"}),/*#__PURE__*/t(hv,{children:/*#__PURE__*/t(pp,{address:n.mintOut,url:d})})]})]},r):"jupiter-swap-shared-accounts-route"===n.type?/*#__PURE__*/e(mb,{children:[/*#__PURE__*/t(dv,{children:/*#__PURE__*/e(_y,{children:["Jupiter swap"," ",n.tokenIn&&n.tokenOut?`${n.tokenIn.symbol} → ${n.tokenOut.symbol}`:""]})}),/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"In amount"}),/*#__PURE__*/t(hv,{children:n.inAmount.toString()})]}),/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Quoted out amount"}),/*#__PURE__*/t(hv,{children:n.quotedOutAmount.toString()})]}),n.mintIn&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Token in"}),/*#__PURE__*/t(hv,{children:/*#__PURE__*/t(pp,{address:n.mintIn,url:d})})]}),n.mintOut&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Token out"}),/*#__PURE__*/t(hv,{children:/*#__PURE__*/t(pp,{address:n.mintOut,url:d})})]})]},r):"jupiter-swap-exact-out-route"===n.type?/*#__PURE__*/e(mb,{children:[/*#__PURE__*/t(dv,{children:/*#__PURE__*/e(_y,{children:["Jupiter swap"," ",n.tokenIn&&n.tokenOut?`${n.tokenIn.symbol} → ${n.tokenOut.symbol}`:""]})}),/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Quoted in amount"}),/*#__PURE__*/t(hv,{children:n.quotedInAmount.toString()})]}),/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Amount out"}),/*#__PURE__*/t(hv,{children:n.outAmount.toString()})]}),n.mintIn&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Token in"}),/*#__PURE__*/t(hv,{children:/*#__PURE__*/t(pp,{address:n.mintIn,url:d})})]}),n.mintOut&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Token out"}),/*#__PURE__*/t(hv,{children:/*#__PURE__*/t(pp,{address:n.mintOut,url:d})})]})]},r):/*#__PURE__*/e(mb,{children:[/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Program ID"}),/*#__PURE__*/t(hv,{children:/*#__PURE__*/t(pp,{address:n.program,url:d})})]}),/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Data"}),/*#__PURE__*/t(hv,{children:n.discriminator})]})]},r)))}),/*#__PURE__*/t(il,{}),p?/*#__PURE__*/t(mg,{style:{marginTop:"2rem"},children:p.message}):h?/*#__PURE__*/t(mg,{style:{marginTop:"2rem"},children:gb}):null,/*#__PURE__*/t(hb,{$useSmallMargins:!(!h&&!p),title:"Your wallet",address:y,balance:w,errMsg:b||h||p||!u?void 0:"Add funds on Solana to complete transaction."}),/*#__PURE__*/t(Ml,{style:{marginTop:"1rem"},loading:C,disabled:v||b,onClick:A,children:s}),/*#__PURE__*/t(vl,{})]})};let hb=/*#__PURE__*/kn(zw).withConfig({displayName:"StyledWalletInfoCard",componentId:"sc-4e16a794-0"})(["",""],(e=>e.$useSmallMargins?"margin-top: 0.5rem;":"margin-top: 2rem;")),mb=/*#__PURE__*/kn(cv).withConfig({displayName:"InstructionRows",componentId:"sc-4e16a794-1"})(["margin-top:0.5rem;border:1px solid var(--privy-color-foreground-4);border-radius:var(--privy-border-radius-sm);padding:0.5rem;"]),gb="There was an error preparing your transaction. Your transaction request will likely fail.",yb=/*#__PURE__*/kn.div.withConfig({displayName:"ImageContainer",componentId:"sc-4e16a794-2"})(["display:flex;width:100%;justify-content:center;max-height:40px;> img{object-fit:contain;border-radius:var(--privy-border-radius-sm);}"]),fb=/*#__PURE__*/kn.span.withConfig({displayName:"SponsoredRow",componentId:"sc-4e16a794-3"})(["display:inline-flex;align-items:center;gap:0.3rem;"]),wb=/*#__PURE__*/kn.span.withConfig({displayName:"SponsoredText",componentId:"sc-4e16a794-4"})(["font-size:14px;font-weight:500;color:var(--privy-color-foreground);"]),vb=()=>/*#__PURE__*/e(Tb,{children:[/*#__PURE__*/t(Ib,{}),/*#__PURE__*/t(xb,{})]});const Cb=({transactionError:r,chainId:a,onClose:i,onRetry:s,network:l,rpcEndpoint:c,transactionHash:d})=>{let{chains:u}=Ft(),[p,h]=o(!1),{errorCode:m,errorMessage:g}=((e,t)=>{if("ethereum"===t)return{errorCode:e.details??e.message,errorMessage:e.shortMessage};let n=e.txSignature,r=e?.transactionMessage||"Something went wrong.";if(Array.isArray(e.logs)){let t=e.logs.find((e=>/insufficient (lamports|funds)/gi.test(e)));t&&(r=t)}return{transactionHash:n,errorMessage:r}})(r,l),y=(({chains:e,chainId:t,network:n,rpcEndpoint:r,transactionHash:a})=>"ethereum"===n?e.find((e=>e.id===t))?.blockExplorers?.default.url??"https://etherscan.io":function(e,t){return`https://explorer.solana.com/tx/${e}?cluster=${t}`}(a||"",ds(r||"")))({chains:u,chainId:a,network:l,rpcEndpoint:c,transactionHash:d});/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t($l,{onClose:i}),/*#__PURE__*/e(bb,{children:[/*#__PURE__*/t(vb,{}),/*#__PURE__*/t(kb,{children:m}),/*#__PURE__*/t(Ab,{children:"Please try again."}),/*#__PURE__*/e(_b,{children:[/*#__PURE__*/t(Sb,{children:"Error message"}),/*#__PURE__*/t(Mb,{$clickable:!1,children:g})]}),d&&/*#__PURE__*/e(_b,{children:[/*#__PURE__*/t(Sb,{children:"Transaction hash"}),/*#__PURE__*/e(Nb,{children:["Copy this hash to view details about the transaction on a"," ",/*#__PURE__*/t("u",{children:/*#__PURE__*/t("a",{href:y,children:"block explorer"})}),"."]}),/*#__PURE__*/e(Mb,{$clickable:!0,onClick:async()=>{await navigator.clipboard.writeText(d),h(!0)},children:[d,/*#__PURE__*/t(Ub,{clicked:p})]})]}),/*#__PURE__*/t(Eb,{onClick:()=>s({resetNonce:!!d}),children:"Retry transaction"})]}),/*#__PURE__*/t(bl,{})]})};let bb=/*#__PURE__*/kn.div.withConfig({displayName:"TransactionErrorScreenContainer",componentId:"sc-9ada48aa-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;"]),kb=/*#__PURE__*/kn.span.withConfig({displayName:"ErrorCode",componentId:"sc-9ada48aa-1"})(["color:var(--privy-color-foreground);text-align:center;font-size:1.125rem;font-weight:500;line-height:1.25rem;text-align:center;margin:10px;"]),Ab=/*#__PURE__*/kn.span.withConfig({displayName:"Subtitle",componentId:"sc-9ada48aa-2"})(["margin-top:4px;margin-bottom:10px;color:var(--privy-color-foreground-3);text-align:center;font-size:0.875rem;font-style:normal;font-weight:400;line-height:20px;letter-spacing:-0.008px;"]),Tb=/*#__PURE__*/kn.div.withConfig({displayName:"CircleContainer",componentId:"sc-9ada48aa-3"})(["position:relative;width:60px;height:60px;margin:10px;display:flex;justify-content:center;align-items:center;"]),xb=/*#__PURE__*/kn(Tr).withConfig({displayName:"StyledExclamationCircleIcon",componentId:"sc-9ada48aa-4"})(["position:absolute;width:35px;height:35px;color:var(--privy-color-error);"]),Ib=/*#__PURE__*/kn.div.withConfig({displayName:"StyledRedCircle",componentId:"sc-9ada48aa-5"})(["position:absolute;width:60px;height:60px;border-radius:50%;background-color:var(--privy-color-error);opacity:0.1;"]),Eb=/*#__PURE__*/kn(Ml).withConfig({displayName:"RetryButton",componentId:"sc-9ada48aa-6"})(["&&{margin-top:24px;}transition:color 350ms ease,background-color 350ms ease;"]),Sb=/*#__PURE__*/kn.span.withConfig({displayName:"TextBoxTitle",componentId:"sc-9ada48aa-7"})(["width:100%;text-align:left;font-size:0.825rem;color:var(--privy-color-foreground);padding:4px;"]),_b=/*#__PURE__*/kn.div.withConfig({displayName:"TextBoxContainer",componentId:"sc-9ada48aa-8"})(["width:100%;margin:5px;display:flex;flex-direction:column;justify-content:center;align-items:center;"]),Nb=/*#__PURE__*/kn.text.withConfig({displayName:"HelperText",componentId:"sc-9ada48aa-9"})(["position:relative;width:100%;padding:5px;font-size:0.8rem;color:var(--privy-color-foreground-3);text-align:left;word-wrap:break-word;"]),Mb=/*#__PURE__*/kn.span.withConfig({displayName:"TextBox",componentId:"sc-9ada48aa-10"})(["position:relative;width:100%;background-color:var(--privy-color-background-2);padding:8px 12px;border-radius:10px;margin-top:5px;font-size:14px;color:var(--privy-color-foreground-3);text-align:left;word-wrap:break-word;",""],(e=>e.$clickable&&"cursor: pointer;\n transition: background-color 0.3s;\n padding-right: 45px;\n\n &:hover {\n background-color: var(--privy-color-foreground-4);\n }")),Wb=/*#__PURE__*/kn(Qr).withConfig({displayName:"StyledClipboardIcon",componentId:"sc-9ada48aa-11"})(["position:absolute;top:13px;right:13px;width:24px;height:24px;"]),Pb=/*#__PURE__*/kn(zr).withConfig({displayName:"StyledClipboardCheckIcon",componentId:"sc-9ada48aa-12"})(["position:absolute;top:13px;right:13px;width:24px;height:24px;"]),Ub=({clicked:e})=>/*#__PURE__*/t(e?Pb:Wb,{});const Fb=/*#__PURE__*/kn.span.withConfig({displayName:"CircleBackground",componentId:"sc-c9f33cd-0"})(["&&{width:82px;height:82px;border-width:4px;border-style:solid;border-color:",";background-color:",";border-radius:50%;display:inline-block;box-sizing:border-box;}"],(e=>e.color??"var(--privy-color-accent)"),(e=>e.color??"var(--privy-color-accent)")),Ob=({instruction:n,fees:r,transactionInfo:a,solPrice:i,rpcEndpoint:o})=>/*#__PURE__*/e(cv,{children:[a?.action&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Action"}),/*#__PURE__*/t(hv,{children:a.action})]}),null!=n?.total&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Total"}),/*#__PURE__*/t(hv,{children:n.total})]}),!n?.total&&null!=n?.amount&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Total"}),/*#__PURE__*/t(hv,{children:/*#__PURE__*/t(Md,{quantities:[n.amount,r],tokenPrice:i})})]}),/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"Fees"}),/*#__PURE__*/t(hv,{children:/*#__PURE__*/t(Md,{quantities:[r],tokenPrice:i})})]}),n?.to&&/*#__PURE__*/e(dv,{children:[/*#__PURE__*/t(uv,{children:"To"}),/*#__PURE__*/t(hv,{children:/*#__PURE__*/t(hu,{walletAddress:n.to,rpcEndpoint:o,network:"solana"})})]})]}),Lb=({fees:r,onClose:a,receiptHeader:i,receiptDescription:o,transactionInfo:s,solPrice:l,rpcEndpoint:c,signOnly:d,instruction:u})=>/*#__PURE__*/e(n,{children:[/*#__PURE__*/t($l,{onClose:a}),/*#__PURE__*/t(xu,{style:{marginBottom:"16px"},children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(Fb,{color:"var(--privy-color-success-light)"}),/*#__PURE__*/t($r,{height:38,width:38,strokeWidth:2,stroke:"var(--privy-color-success)"})]})}),/*#__PURE__*/t(Hp,{title:i??`Transaction ${d?"signed":"complete"}!`,description:o??"You're all set."}),/*#__PURE__*/t(Ob,{solPrice:l,instruction:u,fees:r,transactionInfo:s,rpcEndpoint:c}),/*#__PURE__*/t(il,{}),/*#__PURE__*/t(Rb,{loading:!1,onClick:a,children:"Close"}),/*#__PURE__*/t(jd,{}),/*#__PURE__*/t(vl,{})]});let Rb=/*#__PURE__*/kn(Ml).withConfig({displayName:"SubmitButton",componentId:"sc-df6d4eec-0"})(["&&{margin-top:24px;}transition:color 350ms ease,background-color 350ms ease;"]);const Db={component:()=>{let{data:e,onUserCloseViaDialogOrKeybindRef:n,setModalData:r,navigate:a}=Is(),{client:i,closePrivyModal:l,walletProxy:c,showFiatPrices:u}=Ft(),p=ks(),{user:h}=on(),[m,g]=o(e?.sendSolanaTransaction?.transactionRequest),[y,f]=o(),[w,v]=o(),[C,b]=o({value:0n,isLoading:!1}),[k,A]=o(!1),[T,x]=o(),[I,E]=o(),S=e?.sendSolanaTransaction?.connection,_=e?.sendSolanaTransaction?.transactingWallet,N=!!e?.sendSolanaTransaction?.signOnly,M=_?.imported?un(h):nn(h),W=ds(S?.rpcEndpoint||""),{solPrice:P,isSolPriceLoading:U}=wu({enabled:u}),F=s((()=>{if(!y)return;let e=y.spender,t=gd(y.fee),n=gd(C.value,3,!0),r=y.instructions.filter((e=>["sol-transfer","spl-transfer","raydium-swap-base-input","raydium-swap-base-output","jupiter-swap-shared-accounts-route","jupiter-swap-exact-out-route"].includes(e.type))),a=r.at(0);if(!a||r.length>1)return{fee:t,spender:e,balance:n};if("sol-transfer"===a.type)return{fee:t,spender:e,balance:n,total:gd(a.value)};if("spl-transfer"===a.type)return{fee:t,spender:e,balance:n,total:`${le({amount:a.value,decimals:a.token.decimals})} ${a.token.symbol}`};if("raydium-swap-base-input"===a.type&&a.tokenIn&&a.tokenOut){return{fee:t,spender:e,balance:n,swap:`${`${le({amount:a.amountIn,decimals:a.tokenIn.decimals})} ${a.tokenIn.symbol}`} → ${`${le({amount:a.minimumAmountOut,decimals:a.tokenOut.decimals})} ${a.tokenOut.symbol}`}`}}if("raydium-swap-base-output"===a.type&&a.tokenIn&&a.tokenOut){return{fee:t,spender:e,balance:n,swap:`${`${le({amount:a.maxAmountIn,decimals:a.tokenIn.decimals})} ${a.tokenIn.symbol}`} → ${`${le({amount:a.amountOut,decimals:a.tokenOut.decimals})} ${a.tokenOut.symbol}`}`}}if("jupiter-swap-shared-accounts-route"===a.type&&a.tokenIn&&a.tokenOut){return{fee:t,spender:e,balance:n,swap:`${`${le({amount:a.inAmount,decimals:a.tokenIn.decimals})} ${a.tokenIn.symbol}`} → ${`${le({amount:a.quotedOutAmount,decimals:a.tokenOut.decimals})} ${a.tokenOut.symbol}`}`}}if("jupiter-swap-exact-out-route"===a.type&&a.tokenIn&&a.tokenOut){return{fee:t,spender:e,balance:n,swap:`${`${le({amount:a.quotedInAmount,decimals:a.tokenIn.decimals})} ${a.tokenIn.symbol}`} → ${`${le({amount:a.outAmount,decimals:a.tokenOut.decimals})} ${a.tokenOut.symbol}`}`}}return{fee:t,spender:e,balance:n}}),[y,_?.address,C]),O=s((()=>{let e;if(!y||!u||!P||U)return;function t(...e){return sd(e.reduce(((e,t)=>e+t),0n),P??0)}_?.address===y.spender&&(e=t(y.fee));let n=t(C.value),r=y.instructions.filter((e=>"sol-transfer"===e.type||"spl-transfer"===e.type)).at(0);return!r||y.instructions.length>1?{fee:e,balance:n}:"sol-transfer"===r.type?{fee:e,balance:n,total:t(r.value,_?.address===y.spender?y.fee:0n)}:"spl-transfer"===r.type?{fee:e,balance:n,total:`${le({amount:r.value,decimals:r.token.decimals})} ${r.token.symbol}`}:{fee:e,balance:n}}),[y,u,P,U,_?.address,C]);if(d((()=>{!async function(){if(m&&S&&i)try{v(void 0);let e=await Ad({tx:m,connection:S,client:i,checkFunds:!N});f(e)}catch(e){console.error("Failed to prepare transaction",e),v(e)}}()}),[m,S,i,N]),d((()=>{(async function(){if(!_||!S)return;b({value:C.value,isLoading:!0});let e=new ce({name:"mainnet-beta",rpcUrl:S.rpcEndpoint});b({value:await e.getBalance(_.address).catch((()=>0n))??0n,isLoading:!1})})().catch(console.error)}),[y,S]),!(m&&e?.sendSolanaTransaction&&_&&S)){let n=Error("Invalid transaction request");/*#__PURE__*/return t(Mm,{error:n,allowlistConfig:p.allowlistConfig,onRetry:()=>{e?.sendSolanaTransaction?.onFailure(n),l({shouldCallAuthOnSuccess:!1})}})}let L=()=>{if(!k)return T?e?.sendSolanaTransaction?.onSuccess(T):e?.sendSolanaTransaction?.onFailure(I??w??Error("User exited the modal before submitting the transaction")),l({shouldCallAuthOnSuccess:!1})};n.current=L;let R=e.sendSolanaTransaction?.uiOptions?.transactionInfo?.contractInfo?.imgUrl?/*#__PURE__*/t("img",{src:e.sendSolanaTransaction.uiOptions.transactionInfo.contractInfo.imgUrl,alt:e.sendSolanaTransaction.uiOptions.transactionInfo.contractInfo.imgAltText}):null,D=!!(e.funding&&e.funding.supportedOptions.length>0),B=!y?.hasFunds&&D;if(T){let n=y?.instructions.filter((e=>"sol-transfer"===e.type||"spl-transfer"===e.type)),r=1===n?.length?n?.at(0):void 0;/*#__PURE__*/return t(Lb,{fees:T.fees,onClose:L,transactionInfo:e.sendSolanaTransaction?.uiOptions.transactionInfo,solPrice:P,receiptHeader:e.sendSolanaTransaction?.uiOptions.successHeader,receiptDescription:e.sendSolanaTransaction?.uiOptions.successDescription,rpcEndpoint:S.rpcEndpoint,signOnly:N,instruction:"sol-transfer"===r?.type?{to:r.toAccount,amount:r.value}:{to:r?.toAccount||r?.toAta,total:F?.total}})}return I?/*#__PURE__*/t(Cb,{transactionError:I,rpcEndpoint:S.rpcEndpoint,onClose:L,network:"solana",onRetry:async()=>{E(void 0);let{blockhash:e}=await S.getLatestBlockhash();vd(m)?m.message.recentBlockhash=e:m.recentBlockhash=e,g(m)}}):/*#__PURE__*/t(pb,{img:R,title:e.sendSolanaTransaction?.uiOptions?.transactionInfo?.title||"Confirm transaction",subtitle:e.sendSolanaTransaction?.uiOptions?.description||`${p.name} wants your permission to approve the following transaction.`,cta:B?"Add funds":e.sendSolanaTransaction?.uiOptions?.buttonText||"Approve",instructions:y?.instructions??[],network:"mainnet-beta"==W?"Solana":W,blockExplorerUrl:p.solanaClusters[W].blockExplorerUrl,total:u?O?.total:F?.total,fee:u?O?.fee:F?.fee,balance:u?O?.balance:F?.balance,swap:F?.swap,transactingWalletAddress:_.address,disabled:!y?.hasFunds&&!D,isSubmitting:k,isPreparing:!y||C.isLoading,isTokenPriceLoading:u&&U,isMissingFunds:!y?.hasFunds,submitError:I??void 0,parseError:w,onClick:B?async()=>{if(_){if(!D)throw Error("Funding wallet is not enabled");r({...e,funding:{...e.funding,methodScreen:PC},solanaFundingData:e?.solanaFundingData}),a(PC)}}:async()=>{try{if(A(!0),k||!_||!c||!h||!M)return;let t=await e.sendSolanaTransaction.onConfirm();x(t)}catch(e){console.warn({transaction:m,error:e}),E(e)}finally{A(!1)}},onClose:L})}},Bb=({privy:e,appConfig:t,getAccessToken:n,isHeadlessSigning:r,emitPrivyEvent:a,setModalData:i,openModal:o,walletProxy:s,user:l,signWithUserSigner:c,recoverEmbeddedWallet:d,connectedExternalWallet:u},{transaction:p,connection:h,transactionOptions:m,fundWalletConfig:g,uiOptions:y,address:f,signOnly:w})=>new Promise((async(v,C)=>{let{requesterAppId:b}=y||{},k=w?"signSolanaTransaction":"sendSolanaTransaction",A=f?dn(l,f):ln(l);if(!A&&f&&u)try{if(w){let e=await u.signTransaction(p);return a(k,"onSuccess",{signedTransaction:e}),void v(bd("",e,null))}{let e=await u.sendTransaction(p,h,m),t=await h.getParsedTransaction(e,{maxSupportedTransactionVersion:0}),n=bd(e,p,t??null);return a(k,"onSuccess",{response:n}),void v(n)}}catch(e){throw a(k,"onError",Te.TRANSACTION_FAILURE),C(e),e}if(!A)return a(k,"onError",Te.EMBEDDED_WALLET_NOT_FOUND),void C(new he("No wallet found for address",Te.EMBEDDED_WALLET_NOT_FOUND));if(!l)return a(k,"onError",Te.MUST_BE_AUTHENTICATED),void C(new he("User must be authenticated before signing with a Privy wallet",Te.MUST_BE_AUTHENTICATED));let T=rn(A);if(!await d({address:A.address}).catch((()=>!1)))throw a(k,"onError",Te.EMBEDDED_WALLET_NOT_FOUND),new he(`Cannot sendSolanaTransaction before embedded wallet ${A.address} is connected`,Te.EMBEDDED_WALLET_NOT_FOUND);let x=async()=>{let t=await n();if(!t||!s)throw a(k,"onError",Te.EMBEDDED_WALLET_NOT_FOUND),C(new he("Must have valid access token and Privy wallet to send transaction",Te.EMBEDDED_WALLET_NOT_FOUND)),new he("Must have valid access token and Privy wallet to send transaction",Te.EMBEDDED_WALLET_NOT_FOUND);try{let n,i;if(!await d({address:A.address}))throw a(k,"onError",Te.UNKNOWN_CONNECT_WALLET_ERROR),C(new he("Unable to connect to wallet",Te.UNKNOWN_CONNECT_WALLET_ERROR)),new he("Unable to connect to wallet",Te.UNKNOWN_CONNECT_WALLET_ERROR);if(r({showWalletUIs:y?.showWalletUIs})&&!w)try{if(!await kd(p,h))throw a(k,"onError",Te.INSUFFICIENT_BALANCE),C(new he("Solana wallet has insufficient funds for this transaction.",Te.INSUFFICIENT_BALANCE)),new he("Solana wallet has insufficient funds for this transaction.",Te.INSUFFICIENT_BALANCE)}catch(e){throw console.error(e),a(k,"onError",Te.TRANSACTION_FAILURE),C(new he(e instanceof Error?e.message:"Transaction failed.",Te.TRANSACTION_FAILURE)),new he(e instanceof Error?e.message:"Transaction failed.",Te.TRANSACTION_FAILURE)}let{entropyId:o,entropyIdVerifier:u}=ro(l);if(T){let t=vd(p)?Ai(p.message.serialize()):p.serializeMessage(),r=await I(e,c,{chain_type:"solana",method:"signMessage",params:{message:t.toString("base64"),encoding:"base64"},wallet_id:A.id});if(!r.data||!("signature"in r.data))throw Error("Failed to sign transaction");p.addSignature(Cd(p,A.address),Ai(r.data.signature,"base64")),n=p}else n=await Zw({accessToken:t,tx:p,walletProxy:s,entropyId:o,entropyIdVerifier:u,transactingWalletAddress:A.address,transactingWalletIndex:A.walletIndex??0});if(w)return i=bd("",n,null),a("signSolanaTransaction","onSuccess",{signedTransaction:n}),v(i),i;{let{signature:e,receipt:t}=await async function({tx:e,connection:t,transactionOptions:n}){let r;try{let a=e.serialize();r=await t.sendRawTransaction(a,n);let i=await t.confirmTransaction(r);if(i.value.err||i.value.err){let e=i.value.err||i.value.err;if("string"==typeof e)throw Error(e);throw e}return{signature:r,signedTransaction:e,receipt:await t.getParsedTransaction(r,{maxSupportedTransactionVersion:0})}}catch(e){throw e.txSignature=r,e}}({tx:n,connection:h,transactionOptions:m});i=bd(e,p,t),a("sendSolanaTransaction","onSuccess",{response:i})}return v(i),i}catch(e){throw a(k,"onError",Te.TRANSACTION_FAILURE),C(e),e}};if(r({showWalletUIs:y?.showWalletUIs}))x();else{let{entropyId:e,entropyIdVerifier:n}=ro(l,A),r={recoveryMethod:A.recoveryMethod,connectingWalletAddress:A.address,entropyId:e,entropyIdVerifier:n,isUnifiedWallet:T,onCompleteNavigateTo:Db,onFailure:e=>{a(k,"onError",Te.UNKNOWN_CONNECT_WALLET_ERROR),C(e)}},s=av(t)?BC({address:A.address,appConfig:t,methodScreen:PC,fundWalletConfig:g,comingFromSendTransactionScreen:!0,externalSolanaFundingScreen:sC}):void 0;i({connectWallet:r,sendSolanaTransaction:{transactionRequest:p,connection:h,transactionOptions:m,transactingWallet:A,onConfirm:x,onSuccess:e=>{w?a("signSolanaTransaction","onSuccess",{signedTransaction:e.signedTransaction}):a("sendSolanaTransaction","onSuccess",{response:e}),v(e)},onFailure:e=>{a(k,"onError",Te.TRANSACTION_FAILURE),C(e)},uiOptions:y||{},requesterAppId:b,signOnly:w},funding:s}),o(eb)}}));function zb(e){let t=ks(),{user:n}=nv(),{setModalData:r}=Is(),{client:a,isHeadlessSigning:i,openModal:o,walletProxy:s,recoverEmbeddedWallet:l,privy:c,solanaWallets:d}=Ft(),u=rl(),{signWithUserSigner:p}=hn();return tl("sendSolanaTransaction",e),{sendTransaction:async({transaction:e,connection:h,uiOptions:m,transactionOptions:g,fundWalletConfig:y,address:f})=>{let w=f?d.find((e=>e.address===f&&"privy"!==e.walletClientType)):void 0;return await Bb({privy:c,appConfig:t,getAccessToken:()=>a.getAccessToken(),isHeadlessSigning:i,emitPrivyEvent:u,setModalData:r,openModal:o,walletProxy:s,user:n,signWithUserSigner:p,recoverEmbeddedWallet:l,connectedExternalWallet:w},{transaction:e,connection:h,transactionOptions:g,uiOptions:m,fundWalletConfig:y,address:f,signOnly:!1})}}}const Hb=({style:e,color:n,...r})=>/*#__PURE__*/t("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:n||"currentColor",style:{height:"1.5rem",width:"1.5rem",...e},...r,children:/*#__PURE__*/t("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),Vb=n=>{let[r,a]=o(!1);/*#__PURE__*/return e($b,{color:n.color,onClick:()=>{a(!0),navigator.clipboard.writeText(n.text),setTimeout((()=>a(!1)),1500)},$justCopied:r,children:[r?/*#__PURE__*/t(Hb,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):/*#__PURE__*/t(Jm,{style:{height:"14px",width:"14px"}}),r?"Copied":"Copy"," ",n.itemName?n.itemName:"to Clipboard"]})};let $b=/*#__PURE__*/kn.button.withConfig({displayName:"StyledCopytoClipboardButton",componentId:"sc-46f4187f-0"})(["display:flex;align-items:center;gap:6px;&&{margin:8px 2px;font-size:14px;color:",";font-weight:",";transition:color 350ms ease;:focus,:active{background-color:transparent;border:none;outline:none;box-shadow:none;}:hover{color:",";}:active{color:'var(--privy-color-foreground)';font-weight:medium;}@media (max-width:440px){margin:12px 2px;}}svg{width:14px;height:14px;}"],(e=>e.$justCopied?"var(--privy-color-foreground)":e.color||"var(--privy-color-foreground-3)"),(e=>e.$justCopied?"medium":"normal"),(e=>e.$justCopied?"var(--privy-color-foreground)":"var(--privy-color-foreground-2)"));const jb=/*#__PURE__*/kn.img.withConfig({displayName:"StyledLogo",componentId:"sc-68c1b1ea-0"})(["&&{height:",";width:",";border-radius:16px;margin-bottom:12px;}"],(e=>"sm"===e.size?"65px":"140px"),(e=>"sm"===e.size?"65px":"140px"));let qb=({data:n})=>{let r=n=>"object"==typeof n&&null!==n?/*#__PURE__*/t(Gb,{children:Object.entries(n).map((([t,n])=>/*#__PURE__*/e("li",{children:[/*#__PURE__*/e("strong",{children:[t,":"]})," ",r(n)]},t)))}):/*#__PURE__*/t("span",{children:String(n)});/*#__PURE__*/return t("div",{children:r(n)})};const Kb=/*#__PURE__*/kn.div.withConfig({displayName:"Message",componentId:"sc-70ec2a4f-0"})(["margin-top:1.5rem;background-color:var(--privy-color-background-2);border-radius:var(--privy-border-radius-md);padding:12px;text-align:left;max-height:310px;overflow:scroll;white-space:pre-wrap;width:100%;font-size:0.875rem;font-weight:400;color:var(--privy-color-foreground);line-height:1.5;-ms-overflow-style:none;scrollbar-width:none;&::-webkit-scrollbar{display:none;}"]);let Gb=/*#__PURE__*/kn.ul.withConfig({displayName:"MessageList",componentId:"sc-70ec2a4f-1"})(["margin-left:12px !important;white-space:nowrap;&:first-child{margin-left:0 !important;}strong{font-weight:500 !important;}"]);const Zb=({data:e,className:n})=>/*#__PURE__*/t(Kb,{className:n,children:/*#__PURE__*/t(qb,{data:e})});let Yb=e=>{if(!Ht(e))return e;try{let t=Yt(e);return t.includes("�")?e:t}catch{return e}},Qb=e=>JSON.stringify(e,null,2),Xb=r=>{let{types:a,primaryType:i,...o}=r.typedData;/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(rk,{data:o}),/*#__PURE__*/t(Vb,{text:Qb(r.typedData),itemName:"full payload to clipboard"})," "]})};const Jb=({method:n,messageData:r,copy:a,iconUrl:i,isLoading:o,success:s,walletProxyIsLoading:l,errorMessage:c,isCancellable:d,onSign:u,onCancel:p,onClose:h})=>/*#__PURE__*/t(kc,{title:a.title,subtitle:a.description,showClose:!0,onClose:h,icon:dr,iconVariant:"subtle",helpText:c?/*#__PURE__*/t(nk,{children:c}):void 0,primaryCta:{label:a.buttonText,onClick:u,disabled:o||s||l,loading:o},secondaryCta:d?{label:"Not now",onClick:p,disabled:o||s||l}:void 0,watermark:!0,children:/*#__PURE__*/e(Hd,{children:[i?/*#__PURE__*/t(jb,{style:{alignSelf:"center"},size:"sm",src:i,alt:"app image"}):null,/*#__PURE__*/e(tk,{children:["personal_sign"===n&&/*#__PURE__*/t(ak,{children:Yb(r)}),"eth_signTypedData_v4"===n&&/*#__PURE__*/t(Xb,{typedData:r}),"solana_signMessage"===n&&/*#__PURE__*/t(ak,{children:r})]})]})}),ek={component:()=>{let{authenticated:e}=on(),{initializeWalletProxy:n,closePrivyModal:r}=Ft(),{navigate:a,data:i,onUserCloseViaDialogOrKeybindRef:s}=Is(),[l,c]=o(!0),[u,p]=o(""),[h,m]=o(),[g,y]=o(null),[f,w]=o(!1);d((()=>{e||a(hw)}),[e]),d((()=>{n($a).then((e=>{c(!1),e||(p("An error has occurred, please try again."),m(new po(new uo(u,T.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))}))}),[]);let{method:v,data:C,confirmAndSign:b,onSuccess:k,onFailure:A,uiOptions:x}=i.signMessage,I={title:x?.title||"Sign message",description:x?.description||"Signing this message will not cost you any fees.",buttonText:x?.buttonText||"Sign and continue"},E=e=>{e?k(e):A(h||new po(new uo("The user rejected the request.",T.E4001_USER_REJECTED_REQUEST.eipCode))),r({shouldCallAuthOnSuccess:!1}),setTimeout((()=>{y(null),p(""),m(void 0)}),200)};s.current=()=>{E(g)};/*#__PURE__*/return t(Jb,{method:v,messageData:C,copy:I,iconUrl:x?.iconUrl&&"string"==typeof x.iconUrl?x.iconUrl:void 0,isLoading:f,success:null!==g,walletProxyIsLoading:l,errorMessage:u,isCancellable:x?.isCancellable,onSign:async()=>{w(!0),p("");try{let e=await b();y(e),w(!1),setTimeout((()=>{E(e)}),ka)}catch(e){console.error(e),p("An error has occurred, please try again."),m(new po(new uo(u,T.E32603_DEFAULT_INTERNAL_ERROR.eipCode))),w(!1)}},onCancel:()=>E(null),onClose:()=>E(g)})}};let tk=/*#__PURE__*/kn.div.withConfig({displayName:"MessageContainer",componentId:"sc-21a0e112-0"})(["flex:1;display:flex;flex-direction:column;gap:16px;"]),nk=/*#__PURE__*/kn.p.withConfig({displayName:"ErrorText",componentId:"sc-21a0e112-1"})(["&&{margin:0;width:100%;text-align:center;color:var(--privy-color-error-dark);font-size:14px;line-height:22px;}"]),rk=/*#__PURE__*/kn(Zb).withConfig({displayName:"StyledDisplayJsonTree",componentId:"sc-21a0e112-2"})(["margin-top:0;"]),ak=/*#__PURE__*/kn(Kb).withConfig({displayName:"StyledMessage",componentId:"sc-21a0e112-3"})(["margin-top:0;"]);function ik(e){let{isHeadlessSigning:t,walletProxy:n,initializeWalletProxy:r,recoverEmbeddedWallet:a,openModal:i,privy:o,solanaWallets:s,client:l}=Ft(),{user:c}=nv(),d=rl(),{setModalData:u}=Is(),{signWithUserSigner:p}=hn();return tl("signSolanaMessage",e),{signMessage:({message:e,options:h})=>new Promise((async(m,g)=>{let y=h?.address?dn(c,h.address):ln(c);if(!y&&h?.address){let t=s.find((e=>e.address===h.address&&"privy"!==e.walletClientType));if(t)try{let n=await t.signMessage(e);d("signSolanaMessage","onSuccess",{signature:n}),m(n)}catch(e){d("signSolanaMessage","onError",Te.UNABLE_TO_SIGN),g(e)}}if(!y)return d("signSolanaMessage","onError",Te.UNABLE_TO_SIGN),void g(Error("No embedded or connected wallet found for address."));if(!c)return d("signSolanaMessage","onError",Te.MUST_BE_AUTHENTICATED),void g(Error("User must be authenticated before signing with a Privy wallet"));let{entropyId:f,entropyIdVerifier:w}=ro(c,y),v=rn(y),C=Ai(e).toString("base64");if(C.length<1)return d("signMessage","onError",Te.INVALID_MESSAGE),void g(Error("Message must be a non-empty string"));let b=async()=>{let e;if(!c)throw Error("User must be authenticated before signing with a Privy wallet");let t=await l.getAccessToken();if(!t)throw Error("User must be authenticated to use their embedded wallet.");let i=n??await r(15e3);if(!i)throw Error("Failed to initialize embedded wallet proxy.");if(!await a({address:y.address}))throw Error("Unable to connect to wallet");if(v){let t=await I(o,p,{chain_type:"solana",method:"signMessage",params:{message:C,encoding:"base64"},wallet_id:y.id});if(!t.data||!("signature"in t.data))throw Error("Failed to sign message");e=t.data.signature}else{let{response:n}=await i.rpc({accessToken:t,entropyId:f,entropyIdVerifier:w,chainType:"solana",hdWalletIndex:y.walletIndex??0,request:{method:"signMessage",params:{message:C}}});e=n.data.signature}return e};if(t({showWalletUIs:h?.uiOptions?.showWalletUIs}))try{let e=await b(),t=new Uint8Array(Ai(e,"base64"));d("signSolanaMessage","onSuccess",{signature:t}),m(t)}catch(e){g(e)}else u({signMessage:{method:"solana_signMessage",data:C,confirmAndSign:b,onSuccess:e=>{let t=new Uint8Array(Ai(e,"base64"));d("signSolanaMessage","onSuccess",{signature:t}),m(t)},onFailure:e=>{g(e)},uiOptions:h?.uiOptions},connectWallet:{recoveryMethod:y.recoveryMethod,connectingWalletAddress:y.address,entropyId:f,entropyIdVerifier:w,isUnifiedWallet:v,onCompleteNavigateTo:ek,onFailure:e=>{d("signSolanaMessage","onError",Te.UNKNOWN_CONNECT_WALLET_ERROR),g(e)}}}),i(eb)}))}}const ok=()=>{let{client:e,exportSolanaWallet:t,solanaWallets:n,walletProxy:r,recoverEmbeddedWallet:a,privy:i}=Ft(),{sendTransaction:o}=zb(),{signMessage:l}=ik(),{create:c}=Jw(),{signWithUserSigner:d}=hn(),{user:u}=nv(),{ready:p}=bu(),h=s((()=>{if(!r)return n;let t=[...mn(u),un(u)].filter((e=>!!e)).map((t=>({type:"solana",imported:t.imported,address:t.address,connectedAt:Date.now(),walletClientType:"privy",connectorType:"embedded",walletIndex:t.walletIndex??void 0,meta:{name:"Privy Wallet",icon:void 0,id:"io.privy.solana.wallet"},linked:!0,fund(){throw new he("'fund' is deprecated for Solana wallets - use 'fundWallet' instead")},unlink:()=>{throw new he("Cannot unlink an embedded Solana wallet")},async getProvider(){return new Gw(r,t.address,this.signMessage)},signMessage:async e=>await l({message:e,options:{address:t.address,uiOptions:{showWalletUIs:!1}}}),async sendTransaction(e,n,r){let{signature:a}=await o({transaction:e,connection:n,transactionOptions:r,address:t.address});return a},async signTransaction(n){let o=await e.getAccessToken();if(!o||!r)throw new he("Must have valid access token and Privy wallet to send transaction",Te.MUST_BE_AUTHENTICATED);if(!await a({address:t.address}).catch((()=>!1)))throw new he("Wallet couldn't be connected",Te.UNKNOWN_CONNECT_WALLET_ERROR);let{entropyId:s,entropyIdVerifier:l}=ro(u,t);if(rn(t)){let e=vd(n)?Ai(n.message.serialize()):n.serializeMessage(),r=await I(i,d,{chain_type:"solana",method:"signMessage",params:{message:e.toString("base64"),encoding:"base64"},wallet_id:t.id});if(r.data&&"signature"in r.data)return n.addSignature(Cd(n,t.address),Ai(r.data.signature,"base64")),n;throw Error("Failed to sign transaction")}return await Zw({tx:n,accessToken:o,walletProxy:r,entropyId:s,entropyIdVerifier:l,transactingWalletAddress:t.address,transactingWalletIndex:t.walletIndex??0})},async signAllTransactions(n){let o=await e.getAccessToken();if(!o||!r)throw new he("Must have valid access token and Privy wallet to send transaction",Te.MUST_BE_AUTHENTICATED);if(!await a({address:t.address}).catch((()=>!1)))throw new he("Wallet couldn't be connected",Te.UNKNOWN_CONNECT_WALLET_ERROR);let{entropyId:s,entropyIdVerifier:l}=ro(u,t);if(rn(t))return await Promise.all(n.map((async e=>{let n=vd(e)?Ai(e.message.serialize()):e.serializeMessage(),r=await I(i,d,{chain_type:"solana",method:"signMessage",params:{message:n.toString("base64"),encoding:"base64"},wallet_id:t.id});if(r.data&&"signature"in r.data)return e.addSignature(Cd(e,t.address),Ai(r.data.signature,"base64")),e;throw Error("Failed to sign transaction")})));for(let e of n)await Zw({tx:e,accessToken:o,walletProxy:r,entropyId:s,entropyIdVerifier:l,transactingWalletAddress:t.address,transactingWalletIndex:t.walletIndex??0});return n},loginOrLink:async()=>{throw new he("Cannot login or link with an embedded Solana wallet")},disconnect:()=>{},isConnected:async()=>!0})));return n.concat(t)}),[u,r,e,n]);return{ready:!(!p||!r),createWallet:async e=>{e&&"target"in e&&e&&(e=void 0);let{account:t}=await c({chainType:"solana",options:e});return t},exportWallet:t,wallets:h}},sk={component:()=>{let{wallets:r}=bu(),{wallets:a}=ok(),{data:i,setModalData:l,navigate:c,lastScreen:u}=Is(),{rpcConfig:p,appId:h,createAnalyticsEvent:m,closePrivyModal:g}=Ft(),y=ks(),[f,w]=o(void 0),[v,C]=o(!1),b=ty(),k=i?.funding,{reloadBalance:A}=Hw({rpcConfig:p,appId:h,address:"ethereum"===k.chainType?k.address:void 0,chain:"ethereum"===k.chainType?k.chain:void 0}),T="solana"===k.chainType,x=T?k.isUSDC?"USDC":"SOL":k.erc20Address?k.erc20ContractInfo?.symbol:k.chain.nativeCurrency.symbol,I=T?a.find((({address:e})=>e===k.address)):r.find((({address:e})=>Ui(e)===Ui(k.address)));if(!k)return l({errorModalData:{error:Error("Couldn't find funding config"),previousScreen:u||PC},funding:i?.funding,solanaFundingData:i?.solanaFundingData,sendTransaction:i?.sendTransaction}),c(Wm),/*#__PURE__*/t(n,{});d((()=>{let e=T?async function(){if("solana"!==k.chainType)return;let e=b(qw);e?(k.isUSDC?e.getTokenBalance({address:k.address,cluster:k.cluster,mintAddress:Y[k.cluster.name]}).then((({amount:e})=>e)):e.getBalance({address:k.address,cluster:k.cluster})).then((e=>{let t=BigInt(e);f&&t>f&&(C(!0),m({eventName:Vw,payload:{provider:"manual",status:"success",chainType:"solana",address:I?.address,value:k.isUSDC?Bt(t-f,6):Bt(t-f,9),token:k.isUSDC?"USDC":"SOL"}})),w(t)})):console.warn("Unable to load solana plugin, skipping balance")}:async function(){"ethereum"===k.chainType&&(async()=>{if(!k.erc20Address)return await A()??BigInt(0);{let{balance:e}=await $w({chain:k.chain,address:k.address,erc20Address:k.erc20Address,rpcConfig:p,appId:h});return e}})().then((e=>{f&&e>f&&(C(!0),m({eventName:Vw,payload:{provider:"manual",status:"success",chainType:"ethereum",address:I?.address,chainId:k.chain.id,value:Bt(e-f,k.erc20ContractInfo?.decimals??18),token:k.erc20ContractInfo?.symbol??k.erc20Address??"ETH"}})),w(e)})).catch((()=>w(void 0)))},t=setInterval(e,2e3);return e(),()=>clearInterval(t)}),[f]);let E=s((()=>null==f?"":k.isUSDC?le({amount:f,decimals:6}):T?gd(f,3,!0,!0):null!=k.erc20ContractInfo?.decimals?le({amount:f,decimals:k.erc20ContractInfo.decimals}):de({wei:f})),[f,T,k]),S="ethereum"===k.chainType?k.chain.name:ck[k.cluster.name],_=s((()=>""===k.uiConfig?.receiveFundsTitle?null:/*#__PURE__*/t(Tw,{children:k.uiConfig?.receiveFundsTitle??`Receive ${k.amount} ${x??""}`.trim()})),[k.uiConfig?.receiveFundsTitle,k.amount,x]),N=s((()=>""===k.uiConfig?.receiveFundsSubtitle?null:/*#__PURE__*/t(Aw,{children:k.uiConfig?.receiveFundsSubtitle??`Scan this code or copy your wallet address to receive funds on ${S}.`})),[k.uiConfig?.receiveFundsSubtitle,S]),M="solana"===k.chainType&&k.isUSDC&&Y[k.cluster.name]?`?spl-token=${Y[k.cluster.name]}`:"";/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Pk,{}),_,N,/*#__PURE__*/e(zd,{style:{gap:"1rem",margin:_||N?"1rem 0":"0"},children:[/*#__PURE__*/t(hg,{url:`${k.chainType}:${k.address}${M}`,size:200,squareLogoElement:lk}),/*#__PURE__*/e(_w,{theme:y.appearance.palette.colorScheme,children:["Make sure to send funds on ",S,"."]}),/*#__PURE__*/t(zw,{title:"Your wallet",errMsg:void 0,showCopyButton:!0,balance:`${E} ${x}`,address:k.address}),v&&/*#__PURE__*/t(Ml,{onClick:()=>g({shouldCallAuthOnSuccess:!1,isSuccess:!0}),children:"Continue"})]}),/*#__PURE__*/t(vl,{})]})}};let lk=({...e})=>/*#__PURE__*/t(Io,{color:"black",...e}),ck={devnet:"Devnet","mainnet-beta":"Solana",testnet:"Testnet"};let dk=[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"}],uk=/*#__PURE__*/kn.div.withConfig({displayName:"Container",componentId:"sc-b3a607dd-0"})(["display:flex;flex-direction:column;min-height:72px;"]);var pk=({onBack:n,details:r})=>/*#__PURE__*/e(uk,{children:[/*#__PURE__*/t($l,{backFn:n}),/*#__PURE__*/t(Zb,{data:r}),/*#__PURE__*/t(vl,{})]});let hk=({gasUsed:e,effectiveGasPrice:t})=>{if(e&&t)try{return zt(e*t)}catch(e){return}};const mk=({txn:r,receipt:a,transactionInfo:i,onClose:o,tokenPrice:s,tokenSymbol:l,receiptHeader:c,receiptDescription:d})=>/*#__PURE__*/e(n,{children:[/*#__PURE__*/t($l,{onClose:o}),/*#__PURE__*/t(zp,{title:c??"Transaction complete!",description:d??"You're all set."}),/*#__PURE__*/t(gu,{tokenPrice:s,from:a.from,to:a.to,gas:hk(a),txn:r,transactionInfo:i,tokenSymbol:l}),/*#__PURE__*/t(il,{}),/*#__PURE__*/t(gk,{loading:!1,onClick:o,children:"All Done"}),/*#__PURE__*/t(jd,{}),/*#__PURE__*/t(vl,{})]});let gk=/*#__PURE__*/kn(Ml).withConfig({displayName:"SubmitButton",componentId:"sc-f70d0f7a-0"})(["&&{margin-top:24px;}transition:color 350ms ease,background-color 350ms ease;"]);const yk=[{constant:!1,inputs:[{name:"_salt",type:"bytes32"},{name:"_initializer",type:"bytes"}],name:"deployAccount",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],fk=[{name:"from",type:"address"},{name:"param2",type:"address"},{name:"param3",type:"bytes"},{name:"param4",type:"tuple",components:[]},{type:"tuple",components:[{name:"param5",type:"address"},{name:"param6",type:"uint256"},{name:"param7",type:"uint256"},{name:"encodedInitData",type:"bytes"}]}],wk=[{constant:!1,inputs:[{name:"spender",type:"address"},{name:"value",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],vk=[{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"mint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"mint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"quantity",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"mint",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"quantity",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"mint",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256[]",name:"tokenIds",type:"uint256[]"},{internalType:"uint256[]",name:"quantities",type:"uint256[]"},{internalType:"bytes",name:"data",type:"bytes"}],name:"mintBatch",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256[]",name:"tokenIds",type:"uint256[]"},{internalType:"uint256[]",name:"quantities",type:"uint256[]"},{internalType:"bytes",name:"data",type:"bytes"}],name:"mintBatch",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"quantity",type:"uint256"}],name:"mint",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"quantity",type:"uint256"}],name:"mint",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"safeMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"safeMint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"string",name:"uri",type:"string"}],name:"safeMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"string",name:"uri",type:"string"}],name:"safeMint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeMint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"string",name:"uri",type:"string"}],name:"safeMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"string",name:"uri",type:"string"}],name:"safeMint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"batchMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"batchMint",outputs:[],stateMutability:"payable",type:"function"}],Ck=[{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],bk=[{constant:!1,inputs:[{name:"_operator",type:"address"},{name:"_approved",type:"bool"}],name:"setApprovalForAll",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],kk=[{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_tokenId",type:"uint256"}],name:"transferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],Ak=[{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_tokenIds",type:"uint256[]"},{name:"_amounts",type:"uint256[]"},{name:"_data",type:"bytes"}],name:"safeBatchTransferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],Tk=[{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_tokenId",type:"uint256"},{name:"_amount",type:"uint256"},{name:"_data",type:"bytes"}],name:"safeTransferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],xk=(e,t)=>{let n=Ik(wk,e);if(n)return{action:"approve",functionName:"approve",isErc20Ish:!0,isNFTIsh:!1,spender:n.args[0],amount:n.args[1]};let r=Ik(iv,e);if(r)return{action:"transfer",functionName:"transfer",isErc20Ish:!0,isNFTIsh:!1,transferTo:r.args[0],amount:r.args[1]};if(!t)return{action:"transaction",functionName:"",isErc20Ish:!1,isNFTIsh:!1};let a=Ik(yk,e);if(a&&"string"==typeof a.args[1]){let e=Ek(a.args[1]);if(e&&e[4].encodedInitData)return xk(e[4].encodedInitData,t)}let i=Ik(bk,e);if(i)return{action:"approve",functionName:"setApprovalForAll",isNFTIsh:!0,isErc20Ish:!1,operator:i.args[0],approved:i.args[1]};let o=Ik(kk,e);if(o)return{action:"transfer",functionName:"transferFrom",isNFTIsh:!0,isErc20Ish:!1,transferFrom:o.args[0],transferTo:o.args[1],tokenId:o.args[2]};let s=Ik(Ck,e);if(s)return{action:"transfer",functionName:"safeTransferFrom",isNFTIsh:!0,isErc20Ish:!1,transferFrom:s.args[0],transferTo:s.args[1],tokenId:s.args[2]};let l=Ik(Tk,e);if(l)return{action:"transfer",functionName:"safeTransferFrom",isNFTIsh:!0,isErc20Ish:!1,transferFrom:l.args[0],transferTo:l.args[1],tokenId:l.args[2],amount:l.args[3]};let c=Ik(Ak,e);if(c)return{action:"batch transfer",functionName:"safeBatchTransferFrom",isNFTIsh:!0,isErc20Ish:!1,transferFrom:c.args[0],transferTo:c.args[1],tokenIds:c.args[2],amounts:c.args[3]};let d=Ik(vk,e);return d?{action:"mint",functionName:d.functionName,isNFTIsh:!0,isErc20Ish:!1,args:d.args}:{action:"transaction",isErc20Ish:!1,isNFTIsh:!1}};let Ik=(e,t)=>{try{let n=Qt({abi:e,data:t});return{functionName:n.functionName,args:n.args||[]}}catch(e){return null}},Ek=e=>{try{if("string"==typeof e)return Xt(fk,`0x${e.slice(10)}`)}catch(e){return null}},Sk=e=>`${parseFloat(e).toFixed(2)}`;const _k=(e,t,n,r)=>{let[a,i]=o(null),{walletProxy:s}=Ft();return d((()=>{a&&i(null),(async()=>{if(!s||!t)return null;let a=[],i=!0,o=await ku(e,n,t,r).catch((t=>(t.message&&t.message.includes("Insufficient balance for transaction")||t.details&&t.details.includes("insufficient funds")?i=!1:a.push(t),e)));return{tx:o,totalGasEstimate:o.gas,hasFunds:i,errors:a}})().then(i)}),[e]),a};let Nk=new po(new uo("There was an issue preparing your transaction",T.E32603_DEFAULT_INTERNAL_ERROR.eipCode)),Mk=(e,t)=>e?.sendTransaction?"transactionRequest"in e.sendTransaction?e.sendTransaction.transactionRequest:e.sendTransaction.transactionRequests[t]:void 0;const Wk={component:()=>{let{data:r,onUserCloseViaDialogOrKeybindRef:a,setModalData:i,navigate:l}=Is(),{client:c,rpcConfig:p,chains:h,closePrivyModal:m,walletProxy:g,showFiatPrices:y}=Ft(),{user:f}=on(),w=ks(),[v,C]=o(0),[b,k]=o(0),[A,x]=o(Mk(r,v)),[I,E]=o(null),[S,_]=o(),[N,M]=o(!1),[W,P]=o(null),[U,F]=o(null),[O,L]=o(null),[R,D]=o(void 0),[B,z]=o(void 0),[H,V]=o(!1),[$,j]=o(!1),[q,K]=o([]),[G,Z]=o([]),[Y,Q]=o("uninitiated"),[X,J]=o(void 0);if(!A||!r?.sendTransaction||!r?.sendTransaction)/*#__PURE__*/return t(Mm,{error:Error("Invalid transaction request"),allowlistConfig:w.allowlistConfig,onRetry:()=>{r?.sendTransaction?.onFailure(Nk),m({shouldCallAuthOnSuccess:!1})}});let{transactingWalletAddress:ee}=r.sendTransaction,te=s((()=>h.find((e=>Number(e.id)===Number(A.chainId)))),[A.chainId]),ne=te?.nativeCurrency.symbol??"ETH",re=s((()=>xk(A.data,!!w.embeddedWallets.extendedCalldataDecoding)),[A.data]),{action:ae,isErc20Ish:ie,isNFTIsh:oe,functionName:se}=re,{toAddress:ce,tokenAddress:de}=s((()=>({toAddress:re.isErc20Ish?re.transferTo:A.to??void 0,tokenAddress:re.isErc20Ish?A.to:void 0})),[re]);d((()=>{A.to&&te&&ie&&mC({address:A.to,chain:te,rpcConfig:w.rpcConfig,privyAppId:w.id}).then(E).catch(console.error)}),[A.to,te]);let{tokenPrice:pe,isTokenPriceLoading:he}=vu(A.chainId),{balance:me}=Hw({rpcConfig:w.rpcConfig,appId:w.id,address:ee,chain:te}),ge=function({rpcConfig:e,appId:t,address:n,chain:r,tokenInfo:a}){let{chains:i}=Ft(),[l,c]=o(null),[p,h]=o(!1),m=s((()=>{let n=r||i[0];if(n)return Lt({chain:r,transport:Rt(ue(n,e,t))})}),[r,e,t]),g=u((async()=>{if(n&&m&&a.address)try{return h(!0),await m.readContract({address:a.address,abi:dk,functionName:"balanceOf",args:[n]})}catch(e){console.error(e)}finally{h(!1)}}),[m,n,a?.address,r]);return d((()=>{g().then((e=>null!=e&&c(e)))}),[g]),{balance:l,isLoading:p&&null==l,formattedBalance:le({amount:l??BigInt(0),decimals:a.decimals})}}({rpcConfig:w.rpcConfig,appId:w.id,address:ee,tokenInfo:{address:de||"",decimals:I?.decimals??18},chain:te}),ye=s((()=>Mi(Number(A.chainId),h,p,{appId:w.id})),[A.chainId,p]),fe=_k(A,ee,ye,r?.sendTransaction?.prepareTransactionRequest);d((()=>{x(Mk(r,v))}),[v]),d((()=>{r.sendTransaction?.getIsSponsored?r.sendTransaction.getIsSponsored().then(_).catch(console.error):_(!1)}),[r.sendTransaction.getIsSponsored]);let we=()=>{if(!N)return W?r?.sendTransaction?.onSuccess({hash:W}):O||fe?.errors[0]?r?.sendTransaction?.onFailure(O??fe?.errors[0]??Nk):r?.sendTransaction?.onFailure(new po(new uo("The user rejected the request",T.E4001_USER_REJECTED_REQUEST.eipCode))),m({shouldCallAuthOnSuccess:!1})};a.current=we;let ve=!!(r.funding&&r.funding.supportedOptions.length>0),Ce=Zc(BigInt(fe?.totalGasEstimate??0n),ne),be=y&&pe?Gc(BigInt(fe?.totalGasEstimate??0n),pe):void 0,ke=Zc(me??0n,ne,void 0,!0),Ae=y&&pe?Gc(me??0n,pe):void 0,Te=I&&!ge.isLoading&&ie&&"approve"!==ae?`${ge.formattedBalance} ${I.symbol}`:void 0,xe=r.sendTransaction?.uiOptions?.transactionInfo?.title;xe||(xe="approve"===ae?ie?"Confirm address":"Confirm action":`Approve ${ae}`);let Ie=s((()=>{if(r.sendTransaction?.uiOptions?.description)return r.sendTransaction?.uiOptions?.description;if("approve"===ae&&"setApprovalForAll"===se&&re.approved){let r=/*#__PURE__*/t(pp,{address:re.operator||"",url:te?.blockExplorers?.default?.url});/*#__PURE__*/return e(n,{children:[w.name," would like your permission for ",r," to transfer tokens on your behalf."]})}if("approve"===ae&&"setApprovalForAll"===se&&!re.approved){let r=/*#__PURE__*/t(pp,{address:re.operator||"",url:te?.blockExplorers?.default?.url});/*#__PURE__*/return e(n,{children:[w.name," would like your permission to revoke permissions of ",r," from transferring tokens on your behalf."]})}return ie&&"approve"===ae||ie&&"approve"===ae?`${w.name} would like your permission for ${Ui(re.spender)} to spend tokens on your behalf.`:`${w.name} wants your permission to approve the following transaction.`}),[w.name,ie,re,r.sendSolanaTransaction?.uiOptions.description,se]),Ee=r.sendTransaction?.uiOptions?.transactionInfo?.contractInfo?.imgUrl?/*#__PURE__*/t("img",{src:r.sendTransaction.uiOptions.transactionInfo.contractInfo.imgUrl,alt:r.sendTransaction.uiOptions.transactionInfo.contractInfo.imgAltText}):null,Se=!(!fe||fe.errors[0]||fe.hasFunds||!1!==S),_e=Se&&ve,Ne=_e?"Add funds":r.sendTransaction?.uiOptions?.buttonText||(v<b?"Continue":"Approve"),Me=e=>{if(!e)throw Error("Transaction scan failed");if("Success"===e.validation.status&&("Benign"===e.validation.result_type?z("safe"):"Warning"===e.validation.result_type?z("warn"):"Malicious"===e.validation.result_type&&(z("error"),j(!0))),"Success"!==e.simulation.status)throw Error("Simulation failed");{D(e.simulation.params);let{assetsIn:t,assetsOut:n}=function(e,t){let n=[],r=new Map;if(e)for(let t of e)if(t.in[0]){let e;e="ERC721"===t.asset.type||"approve_for_all"===t.in[0].value?{id:`nft:${t.asset.name}`,nftName:t.asset.name,nftCount:t.in.length}:{id:`token:${t.asset.type}:${t.asset.symbol}:${t.asset.name}`,iconUrl:t.asset.logo_url,value:t.in[0].value,symbol:t.asset.symbol,usdValue:t.in[0].usd_price?Sk(t.in[0].usd_price):void 0,decimals:t.asset.decimals},n.push(e)}else if(t.out[0]?.value){let e;e="ERC721"===t.asset.type||"approve_for_all"===t.out[0].value?{id:`nft:${t.asset.name}`,nftName:t.asset.name}:{id:`token:${t.asset.type}:${t.asset.symbol}:${t.asset.name}`,iconUrl:t.asset.logo_url,value:t.out[0].value,symbol:t.asset.symbol,usdValue:t.out[0].usd_price?Sk(t.out[0].usd_price):void 0,decimals:t.asset.decimals},r.has(e.id)||r.set(e.id,e)}for(let e of t)for(let t of Object.keys(e.spenders)){let n;n="ERC721"===e.asset.type||"approve_for_all"===e.spenders[t]?.value?{id:`nft:${e.asset.name}`,nftName:e.asset.name}:{id:`token:${e.asset.type}:${e.asset.symbol}:${e.asset.name}`,iconUrl:e.asset.logo_url,value:e.spenders[t]?.value,symbol:e.asset.symbol,usdValue:e.spenders[t]?.usd_price?Sk(e.spenders[t]?.usd_price):void 0,decimals:e.asset.decimals},r.has(n.id)||r.set(n.id,n)}return{assetsIn:n,assetsOut:Array.from(r.values())}}(e.simulation.assets_diffs,e.simulation.exposures);if(0===n.length&&0===t.length)throw Error("No tokens found");K(n),Z(t)}};if(d((()=>{r.sendTransaction?.scanTransaction&&w.embeddedWallets.transactionScanning.enabled&&"uninitiated"===Y&&(Q("in progress"),r.sendTransaction.scanTransaction().then((e=>{Me(e),Q("completed")})).catch((()=>Q("failed"))))}),[!!r.sendTransaction?.scanTransaction]),d((()=>{r.sendTransaction?.scanTransaction&&"failed"!==Y||((e,t,n)=>{if(k((e=>e?.sendTransaction?"transactionRequest"in e.sendTransaction?0:e.sendTransaction.transactionRequests.length-1:0)(r)),t.isErc20Ish&&t.amount&&n){let e=sv({amount:t.amount,decimals:n.decimals});J(e),K([{value:e,symbol:n?.symbol,decimals:n?.decimals}])}else if(e.value){let t=BigInt(e.value),n=pe?Gc(t,pe):void 0;K(y&&n?[{value:n}]:[{value:Yc(t),symbol:ne,decimals:18,usdValue:n}])}else K(y?[{value:"$0"}]:[{value:"0",symbol:ne,decimals:18}])})(fe?.tx??A,re,I)}),[A,fe?.tx,re,I,Y]),U/*#__PURE__*/)return t(mk,{txn:fe?.tx??A,onClose:we,receipt:U,transactionInfo:r.sendTransaction?.uiOptions.transactionInfo,tokenPrice:pe,tokenSymbol:ne,receiptHeader:r.sendTransaction?.uiOptions.successHeader,receiptDescription:r.sendTransaction?.uiOptions.successDescription});if(O)/*#__PURE__*/return t(Cb,{transactionError:O,transactionHash:W??void 0,network:"ethereum",chainId:fe?.tx.chainId??A.chainId,onClose:we,onRetry:({resetNonce:e})=>{L(null);let t={...fe?.tx??A};e&&(t.nonce=void 0),x(t)}});let We=0!==b&&"number"==typeof v&&0!==v?()=>{C(v-1)}:void 0;return H&&R?/*#__PURE__*/t(pk,{details:R,onBack:()=>V(!1)}):/*#__PURE__*/t(ub,{transactionIndex:v,onBack:We,maxIndex:b,disabled:Se&&!ve||$,isSubmitting:N,submitError:O,isPreparing:!fe,isTokenPriceLoading:he,isTokenContractInfoLoading:!oe&&!I,prepareError:fe?.errors[0],symbol:I?.symbol,chain:te,img:Ee,title:xe,subtitle:Ie,txValue:A.value,fee:be??Ce,isSponsored:S,from:ee??"",to:ce,tokenAddress:de??void 0,network:w.chains.find((e=>e.id===A.chainId))?.name??"",transactionDetails:{...re,formattedAmount:X},cta:Ne,missingFunds:Se,action:ae,balance:Te??Ae??ke,onClose:we,onClick:_e?async()=>{if(ee){if(!ve)throw Error("Funding wallet is not enabled");i({...r,funding:{...r.funding,methodScreen:PC,chainType:"ethereum",amount:Dt(BigInt(fe?.tx.value??0)+BigInt(fe?.totalGasEstimate?.toString()??0)),chain:te},solanaFundingData:r?.solanaFundingData}),l(PC)}}:async()=>{if(v<b)C(v+1);else{M(!0);try{let e=await c.getAccessToken();if(N||!e||!g||!f)return;let t=await r.sendTransaction.onConfirm({transactionRequest:fe?.tx??A});if(P(t),r.sendTransaction?.signOnly)return await new Promise((e=>setTimeout(e,ka))),r?.sendTransaction?.onSuccess({hash:t}),m({shouldCallAuthOnSuccess:!1});let n=await ye.waitForTransactionReceipt({hash:t});if("reverted"===n.status)throw Error("Transaction failed");F(n)}catch(e){console.warn({transaction:fe?.tx??A,error:e}),L(e)}finally{M(!1)}}},validation:B,hasScanDetails:!!R,setIsScanDetailsOpen:V,preventMaliciousTransaction:$,setPreventMaliciousTransaction:j,tokensSent:q,tokensReceived:G,isScanning:"in progress"===Y,isCancellable:r.sendTransaction?.uiOptions?.isCancellable??!1,functionName:se})}};function Pk({title:e}){let{currentScreen:n,navigateBack:r,navigate:a,data:i,setModalData:o}=Is();/*#__PURE__*/return t($l,{title:e,backFn:n===sk?r:n===i?.funding?.methodScreen?i.funding.comingFromSendTransactionScreen?()=>a(Wk):void 0:i?.funding?.methodScreen?()=>{let e=i.funding;e.usingDefaultFundingMethod&&(e.usingDefaultFundingMethod=!1),o({funding:e,solanaFundingData:i?.solanaFundingData}),a(e.methodScreen)}:void 0})}const Uk={component:()=>{let{rpcConfig:r,appId:a,closePrivyModal:i,createAnalyticsEvent:s}=Ft(),{navigate:l,setModalData:c,app:u,data:p}=Is(),{wallets:h}=bu(),m=ty(),[g,y]=o(null),[f,w]=o(null),[v,C]=o([]),[b,k]=o(0),[A,T]=o(!1),[x,I]=o(!1),[E,S]=o(!1),[_,M]=o(!1),[W,P]=o(),[U,F]=o();if(!p?.funding||"solana"!==p.funding.chainType)throw Error("Invalid funding data");let{address:O,cluster:L,connectedWalletAddress:R}=p.funding,[D,B]=o(p.funding.amount),z=R?h.find((({address:e})=>e===R)):h[0],H=ts(z?.walletClientType||"unknown"),V=H?.name||"wallet",[$,j]=o(null);d((()=>{(async()=>{if(!z)return;let e=await z.getEthereumProvider();j(jt({account:z.address,transport:qt(e)}).extend(Kt))})().catch(console.error)}),[z]);let[q,K]=o(0n),G=gd(q);d((()=>{let e=m(qw);e?e.getBalance({address:O,cluster:L}).then((e=>K(BigInt(e)))):console.warn("Unable to load solana plugin, skipping balance")}),[]);let[Z,Y]=o(),{tokenPrice:Q}=vu("solana"),{fundingAmountInBaseUnit:X,fundingAmountInUsd:J}=yd({amount:D,fee:0n,tokenPrice:Q,isUsdc:p.funding.isUSDC});if(d((()=>{(async()=>{if(!$||!z)return;let e=["testnet","devnet"].includes(L.name);e&&console.warn("Solana testnets are not supported for bridging");let t=N(u.chains).filter((({testnet:t})=>!!t===e)),n=(await lv({chains:t,address:z.address,appId:a,rpcConfig:r})).filter((e=>e.balance>0n));if(n.length<1)return void y(new he(`Wallet ${Ui(z.address)} does not have enough funds.`,void 0,Te.INSUFFICIENT_BALANCE));n.sort(((e,t)=>Number(t.balance-e.balance)));let i=(await Promise.allSettled(n.map((async e=>({...e,quote:await Em({isTestnet:!1,input:Tm({amount:X.toString(),user:z.address,recipient:O,destinationChainId:ls,destinationCurrency:cs,originChainId:e.chain.id})})}))))).filter((e=>"fulfilled"===e.status)).map((e=>e.value));if(i.length<1)return void y(new he(`Unable to fetch quotes for bridging. Wallet ${Ui(z.address)} does not have enough funds.`,void 0,Te.INSUFFICIENT_BALANCE));let o=i.map((({quote:e,balance:t,chain:n})=>({bridgeTx:Sm(e),balance:t,chain:n,isErc20Quote:!1}))).filter((({bridgeTx:e})=>!!e));if(o.length>1)return void C(o);let s=o.at(0);s?(I(!0),Y({data:s.bridgeTx.data,to:s.bridgeTx.to,value:s.bridgeTx.value,chain:s.chain})):y(new he(`Unable to select bridge option from quotes. Wallet ${Ui(z.address)} does not have enough funds.`,void 0,Te.INSUFFICIENT_BALANCE))})().catch(console.error)}),[$]),d((()=>{(async()=>{let e,t;if(!$||!z||A||E||!Z)return;T(!0);let n=Lt({chain:Z.chain,transport:Rt(Wi(Z.chain,r,a))});try{e=await n.prepareTransactionRequest({account:z.address,to:Z.to,chain:Z.chain,data:Z.data,value:BigInt(Z.value??0)})}catch(e){console.error(e),v.length>1&&w(e.shortMessage??"Something went wrong")}if(e){T(!1),S(!0);try{await $.switchChain({id:Z.chain.id})}catch(e){await $.addChain({chain:Z.chain}),await $.switchChain({id:Z.chain.id})}try{t=await $.sendTransaction(e)}catch(e){console.error(e),"TransactionExecutionError"===e.name&&(v.length<1?y(new he(e.shortMessage,void 0,Te.TRANSACTION_FAILURE)):w(e.shortMessage??"Something went wrong"))}if(t)return await $.waitForTransactionReceipt({hash:t}),x?(F("pending"),void P(t)):(S(!1),M(!0),void s({eventName:Vw,payload:{provider:"external",status:"success",txHash:t,address:z.address,chainId:Z.chain.id,chainType:"ethereum",value:Z.value?Bt(BigInt(Z.value),18):void 0,token:"ETH",destination:O,destinationClusterName:"mainnet-beta",destinationChainType:"solana",destinationValue:Bt(X,9),destinationToken:"SOL"}}));S(!1)}else T(!1)})().catch(console.error)}),[$,Z]),_m({transactionHash:W,wallet:z,isTestnet:!1,bridgingStatus:U,setBridgingStatus:F,onSuccess({transactionHash:e,wallet:t}){I(!1),M(!0),s({eventName:Vw,payload:{provider:"external",status:"success",txHash:e,address:t.address,chainId:Z?.chain.id,chainType:"ethereum",value:Z?.value?Bt(BigInt(Z.value),18):void 0,token:"ETH",destination:O,destinationClusterName:"mainnet-beta",destinationChainType:"solana",destinationValue:Bt(X,9),destinationToken:"SOL"}})},onFailure({error:e}){I(!1),y(e)}}),d((()=>{g&&(c({funding:p?.funding,solanaFundingData:p?.solanaFundingData,sendTransaction:p?.sendTransaction,errorModalData:{error:g,previousScreen:iC}}),l(Wm,!1))}),[g]),d((()=>{if(!_)return;let e=setTimeout(i,Ta);return()=>clearTimeout(e)}),[_]),_/*#__PURE__*/)return e(n,{children:[/*#__PURE__*/t(Pk,{}),/*#__PURE__*/t($d,{}),/*#__PURE__*/e(Bd,{children:[/*#__PURE__*/t($r,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),/*#__PURE__*/t(Hp,{title:"Success!",description:`You’ve successfully added ${D} SOL to your ${u.name} wallet. It may take a minute before the funds are available to use.`})]}),/*#__PURE__*/t(jd,{}),/*#__PURE__*/t(vl,{})]});let ee=v[b];return v.length>1&&ee?/*#__PURE__*/t(Jv,{displayName:V,configuredFundingChain:L,formattedBalance:G,fundingAmount:D,fundingCurrency:"SOL",fundingAmountInUsd:J,options:v,selectedOption:ee,isPreparing:A,isSubmitting:E,addressToFund:O,fundingWalletAddress:z?.address||"",errorMessage:f,onSubmit:()=>{p.funding?.amount!==D?async function(){if(z&&ee)try{let e=await Em({isTestnet:!1,input:Tm({amount:X.toString(),user:z.address,recipient:O,destinationChainId:ls,destinationCurrency:cs,originChainId:ee.chain.id})}),t=Sm(e);if(!t)throw Error("Invalid transaction request");I(!0),Y({data:t.data,to:t.to,value:t.value,chain:ee.chain})}catch(e){console.error(e),y(new he("Unable to fetch quotes for bridging",e,Te.INSUFFICIENT_BALANCE))}}().catch(console.error):Y({to:ee.bridgeTx.to,data:ee.bridgeTx.data,value:ee.bridgeTx.value,chain:ee.chain})},onSelect:e=>{e!==b&&(w(null),k(e))},onAmountChange:B}):E&&z?/*#__PURE__*/t(eC,{wallet:z,displayName:V,addressToFund:O,isBridging:x,isErc20Flow:!1,chainId:"solana",chainName:L.name,totalPriceInUsd:void 0,totalPriceInNativeCurrency:void 0,gasPriceInUsd:void 0,gasPriceInNativeCurrency:void 0}):
|
|
29
|
+
/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Pk,{}),/*#__PURE__*/t(Ql,{}),/*#__PURE__*/t("div",{style:{marginTop:"1rem"}}),/*#__PURE__*/t(vl,{})]})}},Fk=new Map([[PC,null],[iC,"external"],[nC,"external"],[sC,"external"],[Uk,"external"],[rC,"external"],[sk,"manual"],[TC,"moonpay"]]),Ok=()=>{let e=ks(),{user:t}=on(),{client:n,refreshSessionAndUser:r,walletProxy:a}=Ft();return{migrate:u((async()=>{if("legacy-embedded-wallets-only"===e.embeddedWallets.mode)return{success:!0};if(!t)throw new he("User must be authenticated before migrating wallets",Te.MUST_BE_AUTHENTICATED);let i=nn(t);if(!i||rn(i)||!Ip(i))return{success:!0};if(!a)throw new he("Cannot connect to wallet proxy");let o=await n.getAccessToken();if(!o)throw new he("User must be authenticated before migrating wallets",Te.MUST_BE_AUTHENTICATED);let s=i.imported?[i]:t.linkedAccounts.filter((e=>"wallet"===e.type&&"privy"===e.walletClientType&&!e.imported)).filter(Ip),{entropyId:l,entropyIdVerifier:c}=ro(t,i);try{await a.connect({accessToken:o,entropyId:l,entropyIdVerifier:c})}catch(e){if(!Bu(e)||"privy"!==i.recoveryMethod)throw e;await a.recover({accessToken:o,entropyId:l,entropyIdVerifier:c})}return await a.createDelegatedAction({accessToken:o,rootWallet:{address:i.address,chainType:i.chainType,imported:i.imported},delegatedWallets:s}),await r(),{success:!0}}),[e.embeddedWallets.mode,t,a,n,r])}},Lk=({disabled:e})=>{let{migrate:t}=Ok(),{user:n}=on(),{walletProxy:r}=Ft();return d((()=>{!e&&n&&r&&t().catch((e=>{console.debug("Unable to migrate wallets: ",e)}))}),[n,r,e,t]),null},Rk=e=>({id:e.id,raw_id:e.rawId,response:{client_data_json:e.response.clientDataJSON,authenticator_data:e.response.authenticatorData,signature:e.response.signature,user_handle:e.response.userHandle},authenticator_attachment:e.authenticatorAttachment,client_extension_results:{app_id:e.clientExtensionResults.appid,cred_props:e.clientExtensionResults.credProps,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret},type:e.type});function Dk(e){let{logout:t}=l(sn);return tl("logout",e),{logout:t}}const Bk=({providerApp:e,success:n,error:r,onClose:a})=>{let{title:i,subtitle:o}=s((()=>n?{title:`Successfully connected with ${e.name}`,subtitle:"You're good to go!"}:r?{title:"Authentication failed",subtitle:r.message}:{title:`Connecting to ${e.name}`,subtitle:`Please check the pop-up from ${e.name} to continue`}),[n,r,e.name]);/*#__PURE__*/return t(kc,{title:i,subtitle:o,icon:e.logoUrl,iconVariant:"loading",iconLoadingStatus:{success:n,fail:!!r},onBack:a,watermark:!0})},zk={component:()=>{let e=ks(),{data:n,navigate:r,setModalData:a,onUserCloseViaDialogOrKeybindRef:i}=Is(),{crossAppAuthFlow:s,updateWallets:l,closePrivyModal:c,createAnalyticsEvent:u}=Ft(),{logout:p}=Dk(),[h,m]=o({}),g=n?.crossAppAuth,y={id:g.appId,name:g.name,logoUrl:g.logoUrl},f=new he(`There was an issue connecting your ${y.name} account. Please try again.`),w=new va((async e=>{if(g.popup)try{let t=await s({appId:e,popup:g.popup,action:g.action});m({data:t})}catch(e){if(e instanceof he)m({error:e});else if(e instanceof Ze){if(e.privyErrorCode===Te.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return a({accountTransfer:{nonce:e.data?.data?.nonce,account:e.data?.data?.subject,displayName:e.data?.data?.account?.displayName,linkMethod:`privy:${y.id}`,embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress,oAuthUserInfo:e.data?.data?.otherUser?.oAuthUserInfo}}),void r(jm);g.popup&&g.popup.close(),m({error:f})}else m({error:f})}else m({error:f})})),v=()=>{h.data&&(l(),g.onSuccess(h.data),c({shouldCallAuthOnSuccess:!0,isSuccess:!0})),g.onError(h.error??new he("User canceled flow")),c({shouldCallAuthOnSuccess:!1,isSuccess:!1})};return i.current=v,d((()=>{y.id.length&&w.execute(y.id)}),[y.id]),d((()=>{if(!h.data)return;let t=h.data;if(e.legal.requireUsersAcceptTerms&&!t.hasAcceptedTerms){let e=setTimeout((()=>{r(Ym)}),ka);return()=>clearTimeout(e)}if(wm(t,e.embeddedWallets)){let e=setTimeout((()=>{a({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),u({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,provider:`privy:${y.id}`,screen:"CrossAppAuthScreen"}}),p()},callAuthOnSuccessOnClose:!0}}),r(Zm)}),ka);return()=>clearTimeout(e)}let n=setTimeout(v,ka);return()=>clearTimeout(n)}),[h.data]),/*#__PURE__*/t(Bk,{providerApp:y,success:!!h.data,error:h.error,onClose:v})}},Hk=({appName:e,address:n,success:r,error:a,onAccept:i,onDecline:o,onClose:s})=>/*#__PURE__*/t(kc,r||a?{title:a?"Something went wrong":"Success!",subtitle:a?"Please try again.":`You've successfully granted delegated action permissions to ${e}.`,icon:a?ur:Gn,iconVariant:a?"error":"success",onBack:s,watermark:!0}:{title:"Enable offline access",subtitle:`By confirming, ${e} will be able to use your wallet for you even when you're not around. You can revoke this later.`,icon:pr,primaryCta:{label:"Accept",onClick:i},secondaryCta:{label:"Not now",onClick:o},onBack:s,watermark:!0,children:/*#__PURE__*/t(zw,{address:n,title:"Wallet"})}),Vk={component:()=>{let{app:e,data:n}=Is(),{closePrivyModal:r}=Ft(),[a,i]=o(!1),[s,l]=o(),{address:c,onDelegate:u,onSuccess:p,onError:h}=n.delegatedActions.consent,m=async()=>{a?p():h(s??new he("User declined delegating actions.")),r({shouldCallAuthOnSuccess:!1})};return d((()=>{if(!a&&!s)return;let e=setTimeout(m,Aa);return()=>clearTimeout(e)}),[a,s]),/*#__PURE__*/t(Hk,{appName:e.name,address:c,success:a,error:s,onAccept:async()=>{try{await u(),i(!0)}catch(e){l(e)}},onDecline:()=>{m()},onClose:m})}},$k=({appName:e,success:n,error:r,onRevoke:a,onDeny:i,onClose:o})=>/*#__PURE__*/t(kc,n||r?{title:r?"Something went wrong":"Success!",subtitle:r?"Please try again.":"You've successfully revoked permissions.",icon:r?ur:Gn,iconVariant:r?"error":"success",onBack:o,watermark:!0}:{title:"Revoke offline access to wallet",subtitle:`By confirming, ${e} will no longer be able to use this wallet on your behalf when you are not online.`,icon:hr,primaryCta:{label:"Confirm",onClick:a},secondaryCta:{label:"Deny",onClick:i},onBack:o,watermark:!0}),jk={component:()=>{let{app:e,data:n}=Is(),{closePrivyModal:r}=Ft(),[a,i]=o(!1),[s,l]=o(),{onRevoke:c,onSuccess:u,onError:p}=n.delegatedActions.revoke,h=async()=>{a?u():p(s??new he("User declined revoking access to their delegated wallet.")),r({shouldCallAuthOnSuccess:!1})};return d((()=>{if(!a&&!s)return;let e=setTimeout(h,Aa);return()=>clearTimeout(e)}),[a,s]),/*#__PURE__*/t($k,{appName:e.name,success:a,error:s,onRevoke:async()=>{try{await c(),i(!0)}catch(e){l(e)}},onDeny:()=>{h()},onClose:h})}};let qk="#8a63d2";const Kk=({appName:n,loading:r,success:a,errorMessage:i,connectUri:o,onBack:s,onClose:l,onOpenFarcaster:c})=>/*#__PURE__*/t(kc,g||r?y?{title:i?i.message:"Add a signer to Farcaster",subtitle:i?i.detail:`This will allow ${n} to add casts, likes, follows, and more on your behalf.`,icon:Iy,iconVariant:"loading",iconLoadingStatus:{success:a,fail:!!i},primaryCta:o&&c?{label:"Open Farcaster app",onClick:c}:void 0,onBack:s,onClose:l,watermark:!0}:{title:i?i.message:"Requesting signer from Farcaster",subtitle:i?i.detail:"This should only take a moment",icon:Iy,iconVariant:"loading",iconLoadingStatus:{success:a,fail:!!i},onBack:s,onClose:l,watermark:!0,children:o&&g&&/*#__PURE__*/t(Gk,{children:/*#__PURE__*/t(Ey,{text:"Take me to Farcaster",url:o,color:qk})})}:{title:"Add a signer to Farcaster",subtitle:`This will allow ${n} to add casts, likes, follows, and more on your behalf.`,onBack:s,onClose:l,watermark:!0,children:/*#__PURE__*/e(Zk,{children:[/*#__PURE__*/t(Yk,{children:o?/*#__PURE__*/t(hg,{url:o,size:275,squareLogoElement:Iy}):/*#__PURE__*/t(Jk,{children:/*#__PURE__*/t(xl,{})})}),/*#__PURE__*/e(Qk,{children:[/*#__PURE__*/t(Xk,{children:"Or copy this link and paste it into a phone browser to open the Farcaster app."}),o&&/*#__PURE__*/t(Vb,{text:o,itemName:"link",color:qk})]})]})});let Gk=/*#__PURE__*/kn.div.withConfig({displayName:"MobileLinkContainer",componentId:"sc-da518e1f-0"})(["margin-top:24px;"]),Zk=/*#__PURE__*/kn.div.withConfig({displayName:"ContentContainer",componentId:"sc-da518e1f-1"})(["display:flex;flex-direction:column;align-items:center;gap:24px;"]),Yk=/*#__PURE__*/kn.div.withConfig({displayName:"QrContainer",componentId:"sc-da518e1f-2"})(["padding:24px;position:relative;display:flex;align-items:center;justify-content:center;min-height:275px;"]),Qk=/*#__PURE__*/kn.div.withConfig({displayName:"InstructionsContainer",componentId:"sc-da518e1f-3"})(["display:flex;flex-direction:column;align-items:center;gap:16px;"]),Xk=/*#__PURE__*/kn.div.withConfig({displayName:"InstructionText",componentId:"sc-da518e1f-4"})(["font-size:0.875rem;text-align:center;color:var(--privy-color-foreground-2);"]),Jk=/*#__PURE__*/kn.div.withConfig({displayName:"LoaderWrapper",componentId:"sc-da518e1f-5"})(["position:relative;width:82px;height:82px;"]);const eA={component:()=>{let{lastScreen:e,navigateBack:n,data:r,app:a}=Is(),{requestFarcasterSignerStatus:s,closePrivyModal:l}=Ft(),[c,u]=o(void 0),[p,h]=o(!1),[m,g]=o(!1),y=i([]),f=r?.farcasterSigner;d((()=>{let e=Date.now(),t=setInterval((async()=>{if(!f?.public_key)return clearInterval(t),void u({retryable:!0,message:"Connect failed",detail:"Something went wrong. Please try again."});"approved"===f.status&&(clearInterval(t),h(!1),g(!0),y.current.push(setTimeout((()=>l({shouldCallAuthOnSuccess:!1,isSuccess:!0})),ka)));let n=await s(f?.public_key),r=Date.now()-e;"approved"===n.status?(clearInterval(t),h(!1),g(!0),y.current.push(setTimeout((()=>l({shouldCallAuthOnSuccess:!1,isSuccess:!0})),ka))):r>3e5?(clearInterval(t),u({retryable:!0,message:"Connect failed",detail:"The request timed out. Try again."})):"revoked"===n.status&&(clearInterval(t),u({retryable:!0,message:"Request rejected",detail:"The request was rejected. Please try again."}))}),2e3);return()=>{clearInterval(t),y.current.forEach((e=>clearTimeout(e)))}}),[]);let w="pending_approval"===f?.status?f.signer_approval_url:void 0;/*#__PURE__*/return t(Kk,{appName:a.name,loading:p,success:m,errorMessage:c,connectUri:w,onBack:e?n:void 0,onClose:l,onOpenFarcaster:()=>{w&&(window.location.href=w)}})}},tA=({onClose:e})=>/*#__PURE__*/t(kc,{title:"Could not log in with provider",subtitle:"It looks like you're using an in-app browser. To log in, please try again using an external browser.",icon:tr,primaryCta:{label:"Close",onClick:e},watermark:!0}),nA={component:()=>{let{closePrivyModal:e}=Ft();/*#__PURE__*/return t(tA,{onClose:()=>e()})}},rA=({title:e="Connect your email",subtitle:n="Add your email to your account"})=>/*#__PURE__*/t(kc,{title:e,subtitle:n,icon:kr,watermark:!0,children:/*#__PURE__*/t(Od,{children:/*#__PURE__*/t(Rf,{stacked:!0})})}),aA={component:()=>{let{app:e}=Is();/*#__PURE__*/return t(rA,{subtitle:`Add your email to your ${e?.name} account`})}},iA=({title:e="Connect your phone",subtitle:n="Add your number to your account",onSubmit:r,isSubmitting:a=!1})=>{let[i,s]=o(null),l=async()=>{i?.qualifiedPhoneNumber&&await r(i)};/*#__PURE__*/return t(kc,{title:e,subtitle:n,icon:_n,primaryCta:{label:a?"Submitting":"Submit",onClick:l,disabled:!i?.isValid||a},watermark:!0,children:/*#__PURE__*/t(tf,{onChange:e=>{s(e)},onSubmit:l,noIncludeSubmitButton:!0,hideRecent:!0})})},oA={component:()=>{let{app:e,currentScreen:n,data:r,navigate:a,setModalData:i}=Is(),{initLoginWithSms:s}=Ft(),[l,c]=o(!1);/*#__PURE__*/return t(iA,{subtitle:`Add your number to your ${e?.name} account`,onSubmit:async e=>{c(!0);try{await s({phoneNumber:e.qualifiedPhoneNumber,withPrivyUi:!0}),a(Mf)}catch(e){i({errorModalData:{error:e,previousScreen:r?.errorModalData?.previousScreen||n||oA}}),a(Wm)}finally{c(!1)}},isSubmitting:l})}},sA=({title:e="Could not connect with wallet",subtitle:n="Please check that Phantom multichain is enabled and try again.",primaryCtaText:r="Try again",secondaryCtaText:a="Cancel",onTryAgain:i,onCancel:o})=>/*#__PURE__*/t(kc,{title:e,subtitle:n,icon:Jn,iconVariant:"error",primaryCta:{label:r,onClick:i},secondaryCta:{label:a,onClick:o},watermark:!0}),lA={component:()=>{let{closePrivyModal:e}=Ft(),{navigate:n}=Is();/*#__PURE__*/return t(sA,{onTryAgain:()=>{n(hw)},onCancel:async()=>{await e()}})}};function cA(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:n,submitEnrollmentWithSms:r,submitEnrollmentWithTotp:a,submitEnrollmentWithPasskey:i,unenroll:o,enrollInMfa:s}=l(sn);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:n,submitEnrollmentWithSms:r,submitEnrollmentWithTotp:a,submitEnrollmentWithPasskey:i,unenrollWithSms:()=>o("sms"),unenrollWithTotp:()=>o("totp"),unenrollWithPasskey:e=>o("passkey",e),showMfaEnrollmentModal:()=>s(!0),closeMfaEnrollmentModal:()=>s(!1)}}const dA=n=>/*#__PURE__*/e(uA,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...n,children:[/*#__PURE__*/t("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),/*#__PURE__*/t("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M45.2463 20.9106C44.5473 20.2486 43.4527 20.2486 42.7537 20.9106C37.8798 25.5263 31.3034 28.3546 24.0625 28.3546C23.9473 28.3546 23.8323 28.3539 23.7174 28.3525C22.9263 28.3427 22.2202 28.8471 21.9731 29.5987C20.9761 32.6311 20.4375 35.8693 20.4375 39.2297C20.4375 53.5896 30.259 65.651 43.5482 69.0714C43.8446 69.1477 44.1554 69.1477 44.4518 69.0714C57.741 65.651 67.5625 53.5896 67.5625 39.2297C67.5625 35.8693 67.0239 32.6311 66.0269 29.5987C65.7798 28.8471 65.0737 28.3427 64.2826 28.3525C64.1677 28.3539 64.0527 28.3546 63.9375 28.3546C56.6966 28.3546 50.1202 25.5263 45.2463 20.9106ZM52.7249 40.2829C53.3067 39.4683 53.1181 38.3363 52.3035 37.7545C51.4889 37.1726 50.3569 37.3613 49.7751 38.1759L41.9562 49.1223L38.0316 45.1977C37.3238 44.4899 36.1762 44.4899 35.4684 45.1977C34.7605 45.9056 34.7605 47.0532 35.4684 47.761L40.9059 53.1985C41.2826 53.5752 41.806 53.7671 42.337 53.7232C42.868 53.6792 43.3527 53.4039 43.6624 52.9704L52.7249 40.2829Z"})]});let uA=/*#__PURE__*/kn.svg.withConfig({displayName:"StyledSvg",componentId:"sc-59fa943f-0"})(["height:90px;width:90px;> rect{","}> path{fill:white;}"],(e=>"success"===e.color?"fill: var(--privy-color-success);":"fill: var(--privy-color-accent);"));const pA=({showIntro:r,userMfaMethods:a,appMfaMethods:i,userHasAuthSms:o,isTotpLoading:s,isPasskeyLoading:l,error:c,onClose:d,onBackToIntro:u,handleSelectMethod:p,setRemovingMfaMethod:h})=>{let m=a.reduce(((e,t)=>({...e,[t]:!0})),{}),g=i.reduce(((e,t)=>({...e,[t]:!0})),{});/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t($l,{backFn:r?u:void 0,onClose:d},"header"),/*#__PURE__*/t(Dc,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(Nn,{})}),/*#__PURE__*/t(Tc,{children:"Choose a verification method"}),a.length>0?/*#__PURE__*/t(xc,{children:"To add or delete verification methods, verification is required."}):/*#__PURE__*/t(xc,{children:"How would you like to verify your identity?"}),c&&/*#__PURE__*/t(Bc,{style:{marginTop:"1.25rem"},children:c.message}),/*#__PURE__*/e(Mc,{children:[(g.passkey||m.passkey)&&/*#__PURE__*/e(Wc,{children:[/*#__PURE__*/t(ul,{style:{justifyContent:"center"},onClick:()=>p("passkey"),disabled:m.passkey||l,children:l?/*#__PURE__*/t(xl,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):/*#__PURE__*/e(Oc,{children:[/*#__PURE__*/e(Uc,{children:[/*#__PURE__*/t(Sn,{}),"Passkey"]}),m.passkey?/*#__PURE__*/t(hA,{color:"green",children:"Enabled"}):/*#__PURE__*/t(Fc,{$isAccent:!0,children:/*#__PURE__*/t(ea,{})})]})}),m.passkey&&/*#__PURE__*/t(Pc,{style:{position:"absolute",right:0},onClick:()=>h("passkey"),children:/*#__PURE__*/t(ta,{})})]},"passkey"),(g.totp||m.totp)&&/*#__PURE__*/e(Wc,{children:[/*#__PURE__*/t(ul,{style:{justifyContent:"center"},disabled:m.totp||s,onClick:()=>p("totp"),children:s?/*#__PURE__*/t(xl,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):/*#__PURE__*/e(Oc,{children:[/*#__PURE__*/e(Uc,{children:[/*#__PURE__*/t(En,{}),"Authenticator app"]}),m.totp&&/*#__PURE__*/t(hA,{color:"green",children:"Enabled"})]})}),m.totp&&/*#__PURE__*/t(Pc,{style:{position:"absolute",right:0},onClick:()=>h("totp"),children:/*#__PURE__*/t(ta,{})})]},"totp"),(g.sms||m.sms)&&/*#__PURE__*/e(Wc,{children:[/*#__PURE__*/t(ul,{disabled:m.sms||o,onClick:()=>p("sms"),children:/*#__PURE__*/e(Oc,{children:[/*#__PURE__*/e(Uc,{children:[/*#__PURE__*/t(_n,{}),"SMS"]}),m.sms&&/*#__PURE__*/t(hA,{color:"green",children:"Enabled"}),o&&/*#__PURE__*/t(Fc,{children:"Disabled"})]})}),m.sms&&/*#__PURE__*/t(Pc,{style:{position:"absolute",right:0},onClick:()=>h("sms"),children:/*#__PURE__*/t(ta,{})})]},"sms")]}),/*#__PURE__*/t(mA,{children:"You can always change your selection later"}),/*#__PURE__*/t(bl,{})]})};let hA=/*#__PURE__*/kn(Ty).withConfig({displayName:"StyledChip",componentId:"sc-24f8b314-0"})(["margin-right:1.5rem;"]),mA=/*#__PURE__*/kn(Lc).withConfig({displayName:"StyledTerms",componentId:"sc-24f8b314-1"})(["&&{margin-top:1rem;}text-align:center;"]);const gA=({style:n,...r})=>/*#__PURE__*/e("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...n},xmlns:"http://www.w3.org/2000/svg",...r,children:[/*#__PURE__*/e("g",{clipPath:"url(#clip0_113_33841)",children:[/*#__PURE__*/t("path",{d:"M39.1193 0.943398C34.636 -0.174912 29.9185 -0.334713 25.328 0.656273C24.9732 0.732859 24.7477 1.08253 24.8243 1.43729C24.9009 1.79205 25.2506 2.01756 25.6053 1.94097C30.0015 0.991934 34.53 1.14842 38.8375 2.22802C49.1385 4.80983 57.7129 12.5548 60.9786 22.6718C62.2416 26.5843 62.7781 30.7505 62.8855 35.1167C62.8945 35.4795 63.1958 35.7664 63.5586 35.7575C63.9215 35.7485 64.2083 35.4472 64.1994 35.0843C64.0905 30.6582 63.5477 26.3849 62.2536 22.3432C58.8621 11.7515 49.9005 3.63265 39.1193 0.943398Z"}),/*#__PURE__*/t("path",{d:"M21.9931 2.93163C22.343 2.83511 22.5484 2.47325 22.4518 2.12339C22.3553 1.77352 21.9935 1.56815 21.6436 1.66466C16.8429 2.98903 10.0898 7.56519 5.91628 13.6786C5.91465 13.681 5.91304 13.6834 5.91145 13.6858C2.24684 19.2083 -0.0503572 26.1484 0.591012 32.8828C0.591623 32.8892 0.592328 32.8956 0.593127 32.902C0.746837 34.1317 1.00488 35.3591 1.26323 36.5879C1.80735 39.1761 2.35282 41.7706 1.92765 44.4064C1.86986 44.7647 2.11347 45.102 2.47177 45.1598C2.83007 45.2176 3.16738 44.974 3.22518 44.6157C3.66961 41.8605 3.11776 39.173 2.56581 36.4851C2.31054 35.2419 2.05525 33.9987 1.89847 32.7486C1.29525 26.3851 3.46802 19.7466 7.00418 14.416C11.0189 8.5373 17.5201 4.16562 21.9931 2.93163Z"}),/*#__PURE__*/t("path",{d:"M30.6166 4.39985C38.8671 3.89603 47.1159 7.26314 52.6556 13.7139C52.8921 13.9893 52.8605 14.4042 52.5852 14.6406C52.3099 14.8771 51.895 14.8455 51.6585 14.5702C46.3904 8.43576 38.541 5.23144 30.6927 5.71195C30.6899 5.71212 30.6871 5.71227 30.6843 5.71241C20.7592 6.19265 11.4643 12.9257 8.04547 22.3603C7.92183 22.7016 7.54498 22.8779 7.20375 22.7543C6.86253 22.6306 6.68616 22.2538 6.80981 21.9126C10.4114 11.9735 20.1717 4.90702 30.6166 4.39985Z"}),/*#__PURE__*/t("path",{d:"M54.6576 16.5848C54.4553 16.2836 54.047 16.2033 53.7457 16.4057C53.4444 16.608 53.3642 17.0163 53.5665 17.3176C56.6376 21.8904 57.9074 26.8665 58.4094 32.7717C58.4401 33.1333 58.7582 33.4016 59.1199 33.3708C59.4815 33.3401 59.7497 33.022 59.719 32.6604C59.206 26.6261 57.8965 21.4076 54.6576 16.5848Z"}),/*#__PURE__*/t("path",{d:"M59.2796 35.4504C59.6419 35.4277 59.9539 35.703 59.9765 36.0653C60.2242 40.0279 60.2265 44.5112 59.7881 47.8243C59.7405 48.1841 59.4102 48.4372 59.0504 48.3896C58.6906 48.342 58.4376 48.0117 58.4852 47.6519C58.9077 44.4586 58.91 40.0704 58.6648 36.1473C58.6421 35.785 58.9174 35.473 59.2796 35.4504Z"}),/*#__PURE__*/t("path",{d:"M7.05311 25.5432C7.13829 25.1904 6.92135 24.8354 6.56855 24.7502C6.21576 24.665 5.86071 24.882 5.77553 25.2348C5.2932 27.2325 5.0428 29.2847 5.03288 31.3388C5.02266 33.4559 5.41742 35.5225 5.81234 37.5899C6.1354 39.2811 6.45855 40.9728 6.5602 42.6932C6.69373 44.9531 6.21839 47.2163 5.39698 49.3703C5.26766 49.7094 5.43774 50.0891 5.77685 50.2184C6.11596 50.3477 6.4957 50.1777 6.62502 49.8386C7.49325 47.5617 8.01954 45.1092 7.87221 42.6157C7.77126 40.9071 7.44813 39.2252 7.12512 37.5439C6.73099 35.4925 6.33704 33.442 6.34716 31.3451C6.35659 29.3933 6.59455 27.4425 7.05311 25.5432Z"}),/*#__PURE__*/t("path",{d:"M24.2964 10.94C24.4317 11.2768 24.2683 11.6595 23.9315 11.7947C17.1187 14.5307 12.0027 20.7047 10.959 27.9852C10.523 31.0269 10.9941 34.0398 11.465 37.052C11.7303 38.7483 11.9954 40.4443 12.0985 42.1451C12.3221 45.833 11.902 49.8839 9.50192 53.5696C9.30387 53.8737 8.89677 53.9597 8.59264 53.7617C8.28851 53.5636 8.20251 53.1565 8.40056 52.8524C10.5873 49.4944 11.0012 45.7644 10.7867 42.2246C10.6821 40.499 10.4185 38.7833 10.1552 37.0686C9.68265 33.9923 9.21067 30.9195 9.65804 27.7987C10.7724 20.025 16.221 13.4748 23.4417 10.5751C23.7785 10.4399 24.1612 10.6032 24.2964 10.94Z"}),/*#__PURE__*/t("path",{d:"M47.3662 14.6814C41.9915 9.64741 34.2017 7.89046 27.122 9.4433C26.7675 9.52105 26.5432 9.87147 26.6209 10.226C26.6987 10.5805 27.0491 10.8048 27.4036 10.7271C34.1075 9.25665 41.4426 10.934 46.4677 15.6406C50.7033 19.6077 53.1628 25.38 53.8066 31.6779C53.8435 32.0389 54.1661 32.3017 54.5272 32.2648C54.8883 32.2279 55.151 31.9053 55.1141 31.5442C54.4456 25.0047 51.8822 18.9111 47.3662 14.6814Z"}),/*#__PURE__*/t("path",{d:"M54.9766 34.6738C55.3376 34.6368 55.6604 34.8994 55.6975 35.2604C56.3216 41.337 56.0526 47.9003 55.1104 54.2496C55.0571 54.6086 54.7229 54.8565 54.3639 54.8032C54.0049 54.7499 53.7571 54.4157 53.8103 54.0567C54.7394 47.7957 55.001 41.3439 54.39 35.3947C54.353 35.0336 54.6156 34.7109 54.9766 34.6738Z"}),/*#__PURE__*/t("path",{d:"M32.0659 13.3553C21.9959 13.3553 13.814 21.3892 13.814 31.3219C13.814 32.3829 13.9081 33.4225 14.0876 34.4334C14.1511 34.7907 14.4922 35.029 14.8495 34.9655C15.2069 34.9021 15.4451 34.561 15.3817 34.2036C15.2155 33.2677 15.1283 32.305 15.1283 31.3219C15.1283 22.1352 22.7014 14.6696 32.0659 14.6696C36.2978 14.6696 40.1642 16.1949 43.1319 18.7152C43.4086 18.9501 43.8233 18.9163 44.0582 18.6396C44.2931 18.363 44.2593 17.9483 43.9827 17.7134C40.7847 14.9975 36.6188 13.3553 32.0659 13.3553Z"}),/*#__PURE__*/t("path",{d:"M45.455 20.1635C45.717 19.9123 46.133 19.921 46.3842 20.183C49.2843 23.2072 50.2126 27.9605 50.8269 31.9494C51.5188 36.4426 51.6244 40.826 51.6244 42.8585C51.6244 43.2214 51.3302 43.5156 50.9673 43.5156C50.6044 43.5156 50.3101 43.2214 50.3101 42.8585C50.3101 40.8589 50.2055 36.5497 49.5279 32.1494C48.9577 28.4462 48.1356 23.9082 45.4356 21.0927C45.1844 20.8307 45.1931 20.4147 45.455 20.1635Z"}),/*#__PURE__*/t("path",{d:"M51.4576 46.6219C51.4864 46.2601 51.2165 45.9435 50.8547 45.9146C50.493 45.8858 50.1763 46.1557 50.1474 46.5175C49.8247 50.5654 49.403 54.6088 48.5474 58.3439C48.4663 58.6977 48.6874 59.0502 49.0412 59.1312C49.3949 59.2123 49.7474 58.9912 49.8285 58.6374C50.7067 54.8039 51.134 50.6806 51.4576 46.6219Z"}),/*#__PURE__*/t("path",{d:"M15.1454 36.852C15.5015 36.7819 15.847 37.0137 15.9171 37.3698C17.3066 44.4257 16.3467 50.8355 12.6672 56.4502C12.4682 56.7537 12.0609 56.8385 11.7573 56.6396C11.4538 56.4407 11.369 56.0333 11.5679 55.7298C15.0299 50.4469 15.9617 44.3985 14.6276 37.6238C14.5575 37.2677 14.7893 36.9221 15.1454 36.852Z"}),/*#__PURE__*/t("path",{d:"M32.0659 17.631C25.5291 17.631 19.1165 22.691 18.462 29.0504C18.1754 31.8345 18.578 34.5769 18.9807 37.3204C19.3323 39.7159 19.684 42.1124 19.5772 44.5381C19.3328 50.0898 17.7039 54.6726 14.905 58.4471C14.6888 58.7386 14.7499 59.1502 15.0414 59.3663C15.333 59.5825 15.7445 59.5214 15.9607 59.2299C18.9293 55.2266 20.6354 50.386 20.8903 44.5959C20.9966 42.1811 20.6438 39.7923 20.2912 37.4051C19.888 34.6752 19.4851 31.9473 19.7694 29.1849C20.3444 23.5983 26.0946 18.9453 32.0659 18.9453C34.851 18.9453 42.057 20.4534 44.3492 27.9205C45.7856 32.5998 46.1774 38.9326 45.8295 45.0849C45.4816 51.2364 44.3994 57.12 42.9442 60.8928C42.8136 61.2314 42.9822 61.6118 43.3208 61.7424C43.6594 61.873 44.0398 61.7044 44.1704 61.3658C45.6929 57.4186 46.7895 51.386 47.1417 45.1591C47.4938 38.9329 47.1068 32.4249 45.6056 27.5348C43.0612 19.2461 35.0851 17.631 32.0659 17.631Z"}),/*#__PURE__*/t("path",{d:"M21.9529 56.4512C22.2569 56.6494 22.3426 57.0566 22.1444 57.3606C21.7369 57.9854 21.3784 58.6391 21.0199 59.2928C20.6614 59.9465 20.3028 60.6004 19.8953 61.2253C19.697 61.5293 19.2898 61.615 18.9858 61.4167C18.6819 61.2184 18.5962 60.8113 18.7944 60.5073C19.2019 59.8825 19.5604 59.2288 19.9189 58.5751C20.2774 57.9213 20.636 57.2675 21.0435 56.6426C21.2418 56.3386 21.649 56.2529 21.9529 56.4512Z"}),/*#__PURE__*/t("path",{d:"M27.5799 24.4525C27.8816 24.2508 27.9625 23.8426 27.7608 23.541C27.559 23.2393 27.1509 23.1583 26.8492 23.3601C24.247 25.1006 22.6505 27.494 22.6505 31.0002C22.6505 33.088 23.0203 34.7946 23.3997 36.5449C23.9674 39.1641 24.3524 41.7777 24.2832 44.468C24.1992 47.7349 23.56 50.7201 22.3313 53.564C22.1873 53.8971 22.3407 54.2839 22.6739 54.4278C23.0071 54.5718 23.3938 54.4184 23.5378 54.0852C24.8369 51.0784 25.509 47.9266 25.5971 44.5018C25.6689 41.7062 25.2732 38.9892 24.6845 36.267C24.3042 34.509 23.9648 32.9394 23.9648 31.0002C23.9648 27.9961 25.2863 25.9866 27.5799 24.4525Z"}),/*#__PURE__*/t("path",{d:"M30.1447 22.1436C32.8717 21.5877 35.8061 22.2746 37.966 24.0228C41.8241 27.1455 42.3372 32.8403 42.753 37.4549L42.7742 37.69C43.3115 43.6385 42.6964 49.4163 41.4575 55.2186C41.3817 55.5736 41.0326 55.7999 40.6776 55.7241C40.3227 55.6483 40.0964 55.2991 40.1722 54.9442C41.3926 49.2288 41.9873 43.5885 41.4652 37.8082C41.4479 37.6169 41.4307 37.4228 41.4133 37.2264L41.4131 37.2235C41.0438 33.0534 40.5812 27.8304 37.1392 25.0444C35.2926 23.5498 32.7599 22.9518 30.4073 23.4314C30.0517 23.5039 29.7046 23.2744 29.6321 22.9188C29.5596 22.5632 29.7891 22.2161 30.1447 22.1436Z"}),/*#__PURE__*/t("path",{d:"M40.5287 58.4885C40.6183 58.1368 40.4057 57.7791 40.054 57.6896C39.7023 57.6 39.3446 57.8126 39.2551 58.1643C38.8578 59.7247 38.2456 61.1333 37.4695 62.4301C37.2831 62.7415 37.3844 63.145 37.6958 63.3314C38.0072 63.5178 38.4108 63.4165 38.5972 63.1051C39.4336 61.7075 40.0977 60.1816 40.5287 58.4885Z"}),/*#__PURE__*/t("path",{d:"M37.3152 48.9521C37.6756 48.9948 37.9332 49.3215 37.8906 49.682C37.2699 54.9267 35.8688 59.6042 33.6205 63.6613C33.4446 63.9787 33.0446 64.0934 32.7272 63.9175C32.4097 63.7416 32.295 63.3417 32.4709 63.0242C34.6226 59.1416 35.9811 54.6339 36.5854 49.5275C36.6281 49.1671 36.9548 48.9095 37.3152 48.9521Z"}),/*#__PURE__*/t("path",{d:"M37.1798 30.6556C36.7242 28.2212 34.6349 26.3591 32.0985 26.3591C28.6638 26.3591 26.254 29.8212 27.1032 33.0422C28.54 38.7279 28.7759 44.2077 27.8032 49.4855L27.8025 49.4893C26.9584 54.228 25.3374 58.4908 23.1263 62.1031C22.9368 62.4127 23.0342 62.8172 23.3437 63.0067C23.6533 63.1962 24.0578 63.0988 24.2473 62.7893C26.5488 59.0292 28.2249 54.6109 29.0961 49.7218C30.106 44.2403 29.8558 38.5684 28.3765 32.7168L28.3748 32.7099C27.7378 30.3005 29.5133 27.6734 32.0985 27.6734C33.9641 27.6734 35.5393 29.0459 35.8871 30.8929C36.8436 36.4411 37.3418 41.5862 36.9871 46.016C36.9581 46.3778 37.2279 46.6945 37.5897 46.7235C37.9515 46.7525 38.2682 46.4827 38.2972 46.1209C38.6649 41.5294 38.1459 36.2576 37.1815 30.6648C37.1809 30.6617 37.1804 30.6586 37.1798 30.6556Z"}),/*#__PURE__*/t("path",{d:"M30.1376 59.1171C30.4604 59.283 30.5876 59.6792 30.4217 60.002L28.6804 63.3906C28.5145 63.7134 28.1184 63.8406 27.7956 63.6747C27.4728 63.5088 27.3456 63.1127 27.5114 62.7899L29.2527 59.4013C29.4186 59.0785 29.8147 58.9513 30.1376 59.1171Z"}),/*#__PURE__*/t("path",{d:"M32.5872 31.2892C32.5042 30.9359 32.1505 30.7168 31.7972 30.7998C31.4439 30.8828 31.2247 31.2365 31.3077 31.5898C33.5238 41.0232 33.2194 49.3066 30.5201 56.363C30.3905 56.702 30.5602 57.0819 30.8991 57.2115C31.2381 57.3412 31.618 57.1715 31.7477 56.8326C34.5622 49.475 34.8483 40.9141 32.5872 31.2892Z"})]}),/*#__PURE__*/t("defs",{children:/*#__PURE__*/t("clipPath",{id:"clip0_113_33841",children:/*#__PURE__*/t("rect",{width:"64",height:"64",fill:"white",transform:"translate(0.483887)"})})})]}),yA=({onClose:e,onReset:n,submitEnrollmentWithPasskey:r})=>{let{user:a}=on(),{initLinkWithPasskey:i,linkWithPasskey:l}=Ft(),{app:c}=Is(),[d,u]=o(!1),[p,h]=o(!1),[m,g]=o(null),y=s((()=>a?.linkedAccounts.filter((e=>"passkey"===e.type))??[]),[a]),f=async e=>{u(!0);try{await r(e)}catch(e){g(e)}finally{u(!1)}},w=async()=>{h(!0),g(null);try{await i();let e=await l(),t=e?.linkedAccounts.filter((e=>"passkey"===e.type)).map((e=>e.credentialId))??[];await f(t)}catch(e){g(e)}finally{h(!1)}};return 0===y.length||p?/*#__PURE__*/t(fA,{onReset:n,onClose:e,onClick:w,isCreating:p}):m?/*#__PURE__*/t(Mm,{allowlistConfig:c.allowlistConfig,error:m,onBack:()=>g(null),onRetry:()=>g(null)}):/*#__PURE__*/t(wA,{passkeys:y,isSubmitting:d,isCreating:p,onReset:n,onClose:e,onSubmitEnrollment:()=>f(y.map((e=>e.credentialId))),onAddPasskey:w})};let fA=({onReset:r,onClose:a,onClick:i,isCreating:o})=>/*#__PURE__*/e(n,{children:[/*#__PURE__*/t($l,{backFn:r,onClose:a},"header"),/*#__PURE__*/t(Ac,{children:/*#__PURE__*/e(Pv,{children:[/*#__PURE__*/t(Iu,{}),/*#__PURE__*/t(gA,{})]})}),/*#__PURE__*/t(Tc,{children:"Set up passkey verification"}),/*#__PURE__*/e(Ec,{children:[/*#__PURE__*/e(_c,{children:[/*#__PURE__*/t(Sc,{children:/*#__PURE__*/t(Nn,{})}),"Verify with Touch ID, Face ID, PIN, or hardware key"]}),/*#__PURE__*/e(_c,{children:[/*#__PURE__*/t(Sc,{children:/*#__PURE__*/t(ra,{})}),"Takes seconds to set up and use"]}),/*#__PURE__*/e(_c,{children:[/*#__PURE__*/t(Sc,{children:/*#__PURE__*/t(na,{})}),"Use your passkey to verify transactions and login to your account"]})]}),/*#__PURE__*/t(Ml,{style:{marginTop:"2.25rem"},onClick:i,loading:o,children:"Add a new passkey"}),/*#__PURE__*/t(bl,{})]}),wA=({onReset:r,onClose:a,onAddPasskey:i,onSubmitEnrollment:s,passkeys:l,isSubmitting:c,isCreating:d})=>{let[u,p]=o(!1),h=u?l.length:l.length>3?2:3;/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t($l,{backFn:u?()=>p(!1):r,onClose:a},"header"),!u&&/*#__PURE__*/t(Ac,{children:/*#__PURE__*/e(Pv,{children:[/*#__PURE__*/t(Iu,{}),/*#__PURE__*/t(gA,{})]})}),/*#__PURE__*/t(Tc,{children:"Enable your passkeys for verification"}),/*#__PURE__*/e(Ec,{children:[l.slice(0,h).map((n=>/*#__PURE__*/e(vA,{children:[/*#__PURE__*/t(CA,{children:kA(n)}),/*#__PURE__*/e(bA,{children:["Last used: ",n.latestVerifiedAt?.toLocaleString()]})]},n.credentialId))),!u&&l.length>3&&/*#__PURE__*/t(AA,{onClick:()=>p(!0),children:"View All"})]}),/*#__PURE__*/t(Ml,{style:{marginTop:"1.5rem"},onClick:s,loading:c,children:"Enable passkeys"}),l.length<5&&/*#__PURE__*/t(AA,{style:{marginTop:"0.5rem"},onClick:i,disabled:d,children:d?/*#__PURE__*/t(xl,{style:{height:"1rem",width:"1rem",borderWidth:2}}):"Add new passkey"}),/*#__PURE__*/t(bl,{})]})},vA=/*#__PURE__*/kn.div.withConfig({displayName:"PasskeyItem",componentId:"sc-9b5fbdd5-0"})(["&&{padding:0.75rem 1rem;text-align:left;border-radius:0.5rem;border:1px solid var(--privy-color-foreground-4);width:100%;}"]),CA=/*#__PURE__*/kn.div.withConfig({displayName:"PasskeyItemTitle",componentId:"sc-9b5fbdd5-1"})(["font-size:0.875rem;line-height:1.375rem;font-weight:500;color:var(--privy-color-foreground-1);"]),bA=/*#__PURE__*/kn.div.withConfig({displayName:"PasskeyItemSubtitle",componentId:"sc-9b5fbdd5-2"})(["font-size:0.75rem;font-weight:400;line-height:1.125rem;color:var(--privy-color-foreground-2);"]),kA=e=>e.authenticatorName?e.createdWithBrowser?`${e.authenticatorName} on ${e.createdWithBrowser}`:e.authenticatorName:e.createdWithBrowser?e.createdWithOs?`${e.createdWithBrowser} on ${e.createdWithOs}`:`${e.createdWithBrowser}`:"Unknown device";const AA=/*#__PURE__*/kn.button.withConfig({displayName:"StyledLink",componentId:"sc-9b5fbdd5-3"})(["&&{width:100%;font-size:0.875rem;line-height:1rem;@media (min-width:440px){font-size:14px;}display:flex;gap:12px;justify-content:center;padding:0.75rem 1rem;background-color:var(--privy-color-background);transition:background-color 200ms ease;color:var(--privy-color-accent);:focus{outline:none;box-shadow:none;}}"]),TA=({appName:r,onComplete:a,onReset:i,onClose:s})=>{let[l,c]=o(""),[d,u]=o(!1),[p,h]=o(null),[m,g]=o("enroll"),{initEnrollmentWithSms:y,submitEnrollmentWithSms:f}=cA(),{app:w,data:v}=Is();function C(){v?.mfaEnrollmentFlow?.onSuccess(),a()}return p?/*#__PURE__*/t(Mm,{allowlistConfig:w.allowlistConfig,error:p,onBack:()=>h(null),onRetry:()=>h(null)}):/*#__PURE__*/e(n,"enroll"===m?{children:[/*#__PURE__*/t($l,{backFn:i,onClose:s},"header"),/*#__PURE__*/t(Dc,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(_n,{})}),/*#__PURE__*/t(Tc,{children:"Set up SMS verification"}),/*#__PURE__*/e(xc,{children:["We'll text a verification code to this mobile device whenever you use your ",r," ","wallet."]}),/*#__PURE__*/e(Ic,{children:[/*#__PURE__*/t(tf,{onSubmit:async function({qualifiedPhoneNumber:e}){try{await y({phoneNumber:e}),c(e),g("verify")}catch(e){h(e)}},hideRecent:!0}),/*#__PURE__*/e(Lc,{children:["By providing your mobile number, you agree to receive text messages from ",w?.name,". Some carrier charges may apply"]})]}),/*#__PURE__*/t(bl,{})]}:d?{children:[/*#__PURE__*/t($l,{onClose:C},"header"),/*#__PURE__*/t(Dc,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t($r,{})}),/*#__PURE__*/t(Tc,{children:"SMS verification added"}),/*#__PURE__*/e(xc,{children:["From now on, you'll enter the verification code sent to your mobile device whenever you use your ",r," wallet."]}),/*#__PURE__*/t(Nc,{children:/*#__PURE__*/t(Ml,{onClick:C,children:"Done"})}),/*#__PURE__*/t(bl,{})]}:{children:[/*#__PURE__*/t($l,{backFn:function(){"verify"===m?g("enroll"):i()},onClose:s},"header"),/*#__PURE__*/t(Dc,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(_n,{})}),/*#__PURE__*/t(Tc,{children:"Enter enrollment code"}),/*#__PURE__*/e(Ic,{children:[/*#__PURE__*/t(Pu,{onChange:async function(e){try{if(!e)return;await f({phoneNumber:l,mfaCode:e}),u(!0)}catch(e){if($u(e))throw Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.");if(Hu(e))throw Error("The code you entered is not valid");if(zu(e))throw Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.");throw ju(e)?Error("Verification canceled"):Error("Unknown error")}}}),/*#__PURE__*/e(xc,{children:["To continue, enter the 6-digit code sent to ",/*#__PURE__*/t("strong",{children:pe(l)})]})]}),/*#__PURE__*/t(bl,{})]})},xA=/*#__PURE__*/kn.div.withConfig({displayName:"Column",componentId:"sc-cfc52180-0"})(["display:flex;flex-direction:column;"]),IA=({size:e,authUrl:n})=>/*#__PURE__*/t(hg,{url:n,squareLogoElement:aa,size:e,fgColor:"#1F1F1F"}),EA=({onClose:r,onReset:a,totpInfo:i,submitEnrollmentWithTotp:s,error:l})=>{let[c,d]=o("enroll");/*#__PURE__*/return e(n,"enroll"===c?{children:[/*#__PURE__*/t($l,{backFn:a,onClose:r},"header"),/*#__PURE__*/t(Tw,{children:"Scan QR code"}),/*#__PURE__*/t(Aw,{children:"Open your authenticator app and scan this code to continue"}),/*#__PURE__*/t(Dd,{children:/*#__PURE__*/t(IA,{authUrl:i.authUrl,size:240})}),/*#__PURE__*/t(_y,{style:{textAlign:"left"},children:"Setup key"}),/*#__PURE__*/e(Pw,{style:{marginTop:"0.25rem"},children:[/*#__PURE__*/t(xA,{children:"•".repeat(16)}),/*#__PURE__*/t(Vb,{itemName:" ",text:i.secret})]}),/*#__PURE__*/t(Ml,{style:{marginTop:"1rem"},onClick:function(){d("verify")},children:"Continue"}),/*#__PURE__*/t(bl,{})]}:{children:[/*#__PURE__*/t($l,{backFn:function(){"verify"===c?d("enroll"):a()},onClose:r},"header"),/*#__PURE__*/t(Dc,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(En,{})}),/*#__PURE__*/t(Tw,{children:"Enter enrollment code"}),/*#__PURE__*/t(Aw,{children:"To continue, enter the 6-digit code generated from your authenticator app"}),/*#__PURE__*/t(Ic,{children:/*#__PURE__*/t(Pu,{onChange:async function(e){try{if(!e)return;await s({mfaCode:e})}catch(e){if($u(e))throw Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.");if(Hu(e))throw Error("The code you entered is not valid");if(zu(e))throw Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.");throw ju(e)?Error("Verification canceled"):Error("Unknown error")}},errorReasonOverride:l?.message})}),/*#__PURE__*/t(bl,{})]})},SA={component:()=>{let{user:r,enrollInMfa:a,ready:i}=on(),[s,l]=o(null),{unenrollWithSms:c,unenrollWithTotp:u,unenrollWithPasskey:p,submitEnrollmentWithTotp:h,initEnrollmentWithPasskey:m,submitEnrollmentWithPasskey:g,initEnrollmentWithTotp:y}=cA(),{app:f,data:w,onUserCloseViaDialogOrKeybindRef:v}=Is(),{closePrivyModal:C}=Ft(),{promptMfa:b}=Gu(),[k,A]=o(!1),[T,x]=o(null),[I,E]=o(null),S=()=>{C({shouldCallAuthOnSuccess:!0}),a(!1),setTimeout((()=>{l(null),x(null)}),500)},[_,N]=o(!1),[M,W]=o();v.current=S;let P=r?.mfaMethods.includes("sms"),U=!!r?.phone,F=r?.mfaMethods.includes("totp"),O=r?.mfaMethods.includes("passkey"),L=P||F||O,R=r?.linkedAccounts.filter((e=>"passkey"===e.type)).map((e=>e.credentialId))??[];function D(){l(null),x(null)}async function B(e=R){N(!0);try{return await m(),await g({credentialIds:e},{removeForLogin:w?.mfaEnrollmentFlow?.shouldUnlinkOnUnenrollMfa}),w?.mfaEnrollmentFlow?.onSuccess(),S()}catch(e){W(e)}finally{N(!1)}}if(d((()=>{L&&A(!0)}),[L]),!i||!r||!f/*#__PURE__*/)return e(n,{children:[/*#__PURE__*/t($l,{onClose:S},"header"),/*#__PURE__*/t(Ac,{children:/*#__PURE__*/t(dA,{})}),/*#__PURE__*/t(Ic,{children:/*#__PURE__*/t(xl,{})}),/*#__PURE__*/t(bl,{})]});if("sms"===s)/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t($l,{backFn:D,onClose:S},"header"),/*#__PURE__*/t(Dc,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(Wn,{})}),/*#__PURE__*/t(Tc,{children:"Remove SMS verification?"}),/*#__PURE__*/e(xc,{children:["MFA adds an extra layer of security to your ",f?.name," account. Make sure you have other methods to secure your account."]}),/*#__PURE__*/t(Nc,{children:/*#__PURE__*/t(Ml,{$warn:!0,onClick:async function(){l(null);try{await c()}catch(e){l(null)}},children:"Remove"})}),/*#__PURE__*/t(bl,{})]});if("totp"===s)/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t($l,{backFn:D,onClose:S},"header"),/*#__PURE__*/t(Dc,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(Wn,{})}),/*#__PURE__*/t(Tc,{children:"Remove authenticator app verification?"}),/*#__PURE__*/e(xc,{children:["MFA adds an extra layer of security to your ",f?.name," account. Make sure you have other methods to secure your account."]}),/*#__PURE__*/t(Nc,{children:/*#__PURE__*/t(Ml,{$warn:!0,onClick:async function(){l(null);try{await u()}catch(e){l(null)}},children:"Remove"})}),/*#__PURE__*/t(bl,{})]});if("passkey"===s){let r=w?.mfaEnrollmentFlow?.shouldUnlinkOnUnenrollMfa??!0;/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t($l,{backFn:D,onClose:S},"header"),/*#__PURE__*/t(Dc,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(Wn,{})}),/*#__PURE__*/t(Tc,{children:"Are you sure you want to remove this passkey?"}),/*#__PURE__*/t(xc,{children:r?"Removing your passkey will remove as both a verification method and a login method.":"Removing your passkey will remove as a verification method."}),/*#__PURE__*/t(Nc,{children:/*#__PURE__*/t(Ml,{$warn:!0,onClick:async function(){l(null);try{await p({removeForLogin:w?.mfaEnrollmentFlow?.shouldUnlinkOnUnenrollMfa})}catch(e){l(null)}},children:"Remove"})}),/*#__PURE__*/t(bl,{})]})}if(0===w.mfaEnrollmentFlow.mfaMethods.length&&!L)/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t($l,{onClose:S},"header"),/*#__PURE__*/t(Dc,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(Nn,{})}),/*#__PURE__*/t(Tc,{children:"Add more security"}),/*#__PURE__*/e(xc,{children:[f?.name," does not have any verification methods enabled."]}),/*#__PURE__*/t(Nc,{children:/*#__PURE__*/t(Ml,{onClick:S,children:"Close"})}),/*#__PURE__*/t(bl,{})]});let z=!L&&!k;return z?/*#__PURE__*/e(n,{children:[/*#__PURE__*/t($l,{onClose:S},"header"),/*#__PURE__*/t(Dc,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(Nn,{})}),/*#__PURE__*/t(Tc,{children:"Transaction Protection"}),/*#__PURE__*/t(xc,{children:"Set up transaction protection to add an extra layer of security to your account"}),/*#__PURE__*/e(Ec,{children:[/*#__PURE__*/e(_c,{children:[/*#__PURE__*/t(Sc,{children:/*#__PURE__*/t(Xr,{})}),"Enable 2-Step verification for your ",f?.name," wallet."]}),/*#__PURE__*/e(_c,{children:[/*#__PURE__*/t(Sc,{children:/*#__PURE__*/t(Jr,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),/*#__PURE__*/e(Nc,{children:[/*#__PURE__*/t(Ml,{onClick:()=>A(!0),children:"Continue"}),/*#__PURE__*/t(Fl,{onClick:S,children:"Not now"})]}),/*#__PURE__*/t(bl,{})]}):"sms"===T?/*#__PURE__*/t(TA,{appName:f?.name||"Privy",onComplete:S,onReset:D,onClose:S}):"totp"===T&&I?/*#__PURE__*/t(EA,{onClose:S,onReset:D,submitEnrollmentWithTotp:({mfaCode:e})=>async function(e){try{return W(void 0),await h({mfaCode:e}),w?.mfaEnrollmentFlow?.onSuccess(),S()}catch(e){W(e)}finally{l(null)}}(e),totpInfo:{...I,appName:f?.name||"Privy"}}):"passkey"===T?/*#__PURE__*/t(yA,{onReset:D,onClose:S,submitEnrollmentWithPasskey:B}):/*#__PURE__*/t(pA,{showIntro:z,userMfaMethods:r.mfaMethods,appMfaMethods:f.mfa.methods,userHasAuthSms:U,onBackToIntro:function(){A(!1)},handleSelectMethod:async function(e){try{await b()}catch(e){return void W(e)}return"totp"===e?(x(e),E(null),void y().then((e=>{E(e)})).catch((()=>{E(null),D()}))):"passkey"===e&&1===R.length?await B():void x(e)},isTotpLoading:"totp"===T&&!I,isPasskeyLoading:_,error:M,onClose:S,setRemovingMfaMethod:async e=>{try{await b()}catch(e){return void W(e)}l(e)}})}},_A=({providerName:e,ProviderLogo:n,success:r,errorMessage:a,onRetry:i})=>{let o=r?`Successfully connected with ${e}`:a?a.message:`Verifying connection to ${e}`;/*#__PURE__*/return t(kc,{title:o,subtitle:r?"You're good to go!":a?a.detail:"Just a few moments more",icon:n,iconVariant:"loading",iconLoadingStatus:{success:r,fail:!!a},secondaryCta:a?.retryable&&i?{label:"Retry",onClick:i}:void 0,watermark:!0})},NA={component:()=>{let{authenticated:e,logout:n,ready:r,user:a}=on(),{app:i,setModalData:s,navigate:l,resetNavigation:c}=Is(),{getAuthMeta:u,initLoginWithOAuth:p,loginWithOAuth:h,updateWallets:m,setReadyToTrue:g,closePrivyModal:y,createAnalyticsEvent:f}=Ft(),[w,v]=o(!1),[C,b]=o(void 0),k=u()?.provider||"google",{name:A,component:T}=fi(k);return d((()=>{h(k).then((()=>{v(!0),g(!0)})).catch((e=>{if(g(!1),e?.privyErrorCode===Te.ALLOWLIST_REJECTED)return b(void 0),c(),void l(ay);if(e?.privyErrorCode===Te.USER_LIMIT_REACHED)return console.error(new Nt(e).toString()),b(void 0),c(),void l(my);if(e?.privyErrorCode===Te.USER_DOES_NOT_EXIST)return b(void 0),c(),void l(Cm);if(e?.privyErrorCode===Te.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return b(void 0),c(),s({accountTransfer:{nonce:e.data?.data?.nonce,account:e.data?.data?.subject,displayName:e.data?.data?.account?.displayName,linkMethod:u()?.provider,embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress,oAuthUserInfo:e.data?.data?.otherUser?.oAuthUserInfo}}),void l(jm);let{retryable:t,detail:n}=function(e,t){let n={detail:"",retryable:!1},r=ai(t);if(e?.privyErrorCode===Te.LINKED_TO_ANOTHER_USER&&(n.detail="This account has already been linked to another user."),e?.privyErrorCode===Te.INVALID_CREDENTIALS&&(n.retryable=!0,n.detail="Something went wrong. Try again."),e.privyErrorCode===Te.OAUTH_USER_DENIED&&(n.detail=`Retry and check ${r} to finish connecting your account.`,n.retryable=!0),e?.privyErrorCode===Te.TOO_MANY_REQUESTS&&(n.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode===Te.TOO_MANY_REQUESTS&&e.message.includes("provider rate limit")){let e=fi(t).name;n.detail=`Request limit reached for ${e}. Please wait a moment and try again.`}if(e?.privyErrorCode===Te.OAUTH_ACCOUNT_SUSPENDED){let e=fi(t).name;n.detail=`Your ${e} account is suspended. Please try another login method.`}return e?.privyErrorCode===Te.CANNOT_LINK_MORE_OF_TYPE&&(n.detail="You cannot authorize more than one account for this user."),e?.privyErrorCode===Te.OAUTH_UNEXPECTED&&t.startsWith("privy:")&&(n.detail="Something went wrong. Please try again."),n}(e,k);b({retryable:t,detail:n,message:"Authentication failed"})})).finally((()=>{vi()}))}),[A,k]),d((()=>{if(r&&e&&w&&a){if(i?.legal.requireUsersAcceptTerms&&!a.hasAcceptedTerms){let e=setTimeout((()=>{l(Ym)}),ka);return()=>clearTimeout(e)}if(wm(a,i.embeddedWallets)){let e=setTimeout((()=>{s({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),f({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,provider:k,screen:"OAuthStatusScreen"}}),n()},callAuthOnSuccessOnClose:!0}}),l(Zm)}),ka);return()=>clearTimeout(e)}{let e=setTimeout((()=>y({shouldCallAuthOnSuccess:!0,isSuccess:!0})),ka);return m(),()=>clearTimeout(e)}}}),[r,e,w,a]),/*#__PURE__*/t(_A,{providerName:A,ProviderLogo:T,success:w,errorMessage:C,onRetry:C?.retryable?()=>{vi(),p(k),b(void 0)}:void 0})}},MA=/*#__PURE__*/h(((r,a)=>{let[i,s]=o(""),[l,c]=o(""),[d,u]=o(!1),{authenticated:p,user:h}=on(),{initUpdateEmail:m}=Ft(),{navigate:g,setModalData:y,currentScreen:f}=Is(),{enabled:w,token:v}=Zi(),C=ks(),b=Pi(i)&&(C.disablePlusEmails&&i.includes("+")?(l||c("Please enter a valid email address without a '+'."),!1):(l&&c(""),!0)),k=d||!b,A=()=>{!w||v||p?(async e=>{if(!h?.email)throw Error("User is required to have an email address to update it.");u(!0);try{await m({oldAddress:h.email.address,newAddress:i,captchaToken:e}),g(Mf)}catch(e){y({errorModalData:{error:e,previousScreen:f||hw}})}u(!1)})(v):(y({captchaModalData:{callback:e=>{if(!h?.email)throw Error("User is required to have an email address to update it.");return m({oldAddress:h.email.address,newAddress:i,captchaToken:e})},userIntentRequired:!1,onSuccessNavigateTo:Mf,onErrorNavigateTo:Wm}}),g(oy))};/*#__PURE__*/return e(n,{children:[/*#__PURE__*/e(WA,{children:[l&&/*#__PURE__*/t(mg,{style:{marginTop:"0.25rem",textAlign:"left"},children:l}),/*#__PURE__*/e(PA,{$error:!!l,children:[/*#__PURE__*/t(kr,{}),/*#__PURE__*/t("input",{ref:a,id:"email-input",type:"email",placeholder:"your@email.com",onChange:e=>s(e.target.value),onKeyUp:e=>{"Enter"===e.key&&A()},value:i,autoComplete:"email"}),r.stacked?null:/*#__PURE__*/t(Dl,{isSubmitting:d,onClick:A,disabled:k,children:"Submit"})]})]}),r.stacked?/*#__PURE__*/t(Ml,{loadingText:null,loading:d,disabled:k,onClick:A,style:{width:"100%"},children:"Submit"}):null]})}));let WA=wg,PA=yg;const UA=({title:e="Update your email",subtitle:n="Add the email address you'd like to use going forward. We'll send you a confirmation code"})=>/*#__PURE__*/t(kc,{title:e,subtitle:n,icon:kr,watermark:!0,children:/*#__PURE__*/t(Od,{children:/*#__PURE__*/t(MA,{stacked:!0})})}),FA={component:()=>/*#__PURE__*/t(UA,{})},OA=({title:e="Update your phone number",subtitle:n="Add the phone number you'd like to use going forward. We'll send you a confirmation code",onSubmit:r,isSubmitting:a=!1})=>{let[i,s]=o(null);/*#__PURE__*/return t(kc,{title:e,subtitle:n,icon:_n,primaryCta:{label:a?"Submitting":"Update",onClick:async()=>{i?.qualifiedPhoneNumber&&await r(i)},disabled:!i?.isValid||a},watermark:!0,children:/*#__PURE__*/t(tf,{onChange:e=>{s(e)},onSubmit:async()=>{},noIncludeSubmitButton:!0,hideRecent:!0})})},LA={component:()=>{let{currentScreen:e,data:n,navigate:r,setModalData:a}=Is(),{user:i}=on(),{initUpdatePhone:s}=Ft(),[l,c]=o(!1);/*#__PURE__*/return t(OA,{onSubmit:async t=>{c(!0);try{if(!i?.phone?.number)throw Error("User is required to have an phone number to update it.");await s(i?.phone?.number,t.qualifiedPhoneNumber),r(Mf)}catch(t){a({errorModalData:{error:t,previousScreen:n?.errorModalData?.previousScreen||e||oA}}),r(Wm)}finally{c(!1)}},isSubmitting:l})}};function RA({subscribe:e,getExternalJwt:t,enabled:n=!0,onAuthenticated:r,onUnauthenticated:a,onError:s}){let{client:l,onCustomAuthAuthenticated:c}=Ft(),{logout:u,authenticated:p,ready:h}=nv();if(!l)throw new he("`useSyncJwtBasedAuthState` must be used within a `PrivyProvider`");let[m,g]=o({status:"initial"}),y=i(),f=i(!1),w=i(t);d((()=>{w.current=t}),[t]);let v=i(r);d((()=>{v.current=r}),[r]);let C=i(a);d((()=>{C.current=a}),[a]);let b=i(s);return d((()=>{b.current=s}),[s]),d((()=>{if(!n||!h)return;let t=async()=>{if(!f.current){f.current=!0;try{g({status:"loading"});let e=await w.current();if(void 0!==y.current&&y.current===e)return void g({status:"done"});if(!e)return p&&(await u(),C.current?.()),y.current=e,void g({status:"done"});l.startAuthFlow(new Ls(e));let{user:t,isNewUser:n=!1}=await l.authenticate();if(!t)throw new he("Failed to sync with custom auth provider");v.current?.({user:t,isNewUser:n}),c(t,n),y.current=e,g({status:"done"})}catch(e){if(console.warn(e),await u().catch((()=>{})),C.current?.(),e instanceof Ze&&e.privyErrorCode===Te.LINKED_TO_ANOTHER_USER)return g({status:"initial"}),void setTimeout((()=>{t()}),0);b.current?.(e),g({status:"error",error:e})}finally{f.current=!1}}};return t(),e(t)}),[e,l,c,p,u,n,h]),n?{state:m}:{state:{status:"not-enabled"}}}let DA=Ln((()=>({jwtAuthFlowState:{status:"not-enabled"}})));const BA=()=>DA((e=>e.jwtAuthFlowState));function zA({customAuth:e}){let{jwtAuthFlowState:t}=function({customAuth:e}){let t=rl(),n=i(),r=u((e=>(n.current=e,()=>{n.current=void 0})),[]),a=e?.getCustomAccessToken??(()=>Promise.resolve(void 0)),{state:o}=RA({enabled:!0===e?.enabled,subscribe:r,getExternalJwt:a,onAuthenticated:({user:e,isNewUser:n})=>{t("login","onComplete",{user:e,isNewUser:n,wasAlreadyAuthenticated:!1,loginMethod:"custom",loginAccount:null}),t("customAuth","onAuthenticated",{user:e})},onUnauthenticated:()=>{t("customAuth","onUnauthenticated")},onError:e=>{t("login","onError",e.privyErrorCode||Te.UNKNOWN_AUTH_ERROR)}});return d((()=>{(async()=>{e&&!e.isLoading&&n.current?.()})()}),[e?.enabled,e?.getCustomAccessToken,e?.isLoading]),{jwtAuthFlowState:o}}({customAuth:e});return d((()=>{DA.setState({jwtAuthFlowState:t})}),[t]),null}const HA=/*#__PURE__*/c(!1);let VA,$A,jA,qA,KA,GA,ZA;function YA(){return VA?VA.getCustomerAccessToken():Promise.resolve(ua.get(Ia)||null)}async function QA(){return VA?VA.getAccessToken():Promise.resolve(ua.get(_a)||ua.get(Ia)||null)}const XA=(e,t)=>$A(e,t),JA=(e,t)=>jA(e,t),eT=(e,t)=>qA(e,t),tT=(e,t)=>KA(e,t),nT=e=>GA(e),rT=e=>ZA(e),aT=({config:e,...n})=>{var r;if((()=>{if(l(HA))throw new he("Multiple PrivyProvider instances found","Found multiple instances of PrivyProvider, ensure there is only one mounted in your application tree.")})(),"undefined"!=typeof window&&0>["localhost","127.0.0.1"].indexOf(window.location.hostname)&&"https:"!==window.location.protocol&&"chrome-extension:"!==window.location.protocol)throw new he("Embedded wallet is only available over HTTPS");if("string"!=typeof(r=n.appId)||25!==r.length)throw new he("Cannot initialize the Privy provider with an invalid Privy app ID");VA||(VA=new Gs({appId:n.appId,appClientId:n.clientId,apiUrl:n.apiUrl}));let a=Object.assign({},e),i=s((()=>new A({appId:n.appId,clientId:n.clientId,storage:ua,baseUrl:n.apiUrl,sdkVersion:"react-auth:2.25.0"})),[]);/*#__PURE__*/
|
|
30
|
+
return t(bs,{client:i,legacyClient:VA,clientConfig:a,children:/*#__PURE__*/t(Jg,{children:/*#__PURE__*/t(iT,{...n,client:VA,privy:i})})})};let iT=n=>{let a=n.client,l=n.privy,c=ty();Np();let[p,h]=o(!1),[m,g]=o(!1),[y,f]=o(!1),[A,T]=o(null),[x,E]=o([]),[S,_]=o([]),[N,M]=o(void 0),[W,P]=o(!1),[U,F]=o(null),[O,L]=o(!1),[R,D]=o({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:Pt}),[B,z]=o({status:"initial"}),[H,V]=o({status:"initial"}),[$,j]=o({status:"initial"}),[q,K]=o({status:"initial"}),[G,Z]=o({status:"initial"}),[Y,Q]=o({status:"initial"}),[X,J]=o(null),ee=ks(),te=As(),[ne,re]=o({}),[ae,ie]=o(null),oe=i(null),[se,le]=o(!1),[ce,de]=o(!1),ue=i(null),pe=i(null),me=i(Xs),[ye,fe]=o(!1);a.onStoreCustomerAccessToken=e=>{e&&nl(me,"accessToken","onAccessTokenGranted",{accessToken:e})},a.onDeleteCustomerAccessToken=()=>{T(null),f(!1),nl(me,"accessToken","onAccessTokenRemoved")};let we=i(null),ve=i(null),Ce=i(!1),be=({showWalletUIs:e})=>Ce.current?Ce.current:void 0!==e?!e:!ee.embeddedWallets.showWalletUIs,ke=e=>{F(e),setTimeout((()=>{h(!0)}),15)};d((()=>{if(!A)return void a.connectors?.removeEmbeddedWalletConnectors();let e=cn(A),t=gn(A),r=pn(A);e&&t.length||a.connectors?.removeEmbeddedWalletConnectors(),r||a.connectors?.removeImportedWalletConnector(),a.connectors?X?(e&&a.connectors.addEmbeddedWalletConnectors({walletProxy:X,user:A,embeddedWallets:t,defaultChain:ee.defaultChain,appId:n.appId,privyClient:l}),r&&a.connectors.addImportedWalletConnector(X,r.address,ee.defaultChain,n.appId)):console.debug("Failed to add embedded wallet connector: Wallet proxy not initialized"):console.debug("Failed to add embedded wallet connector: Client connectors not initialized")}),[X,A]),d((()=>{X&&oe.current?.(X)}),[X]);let Ae=u(((e,t)=>{T(e),P(t),f(!0),de(!0)}),[]);d((()=>{ce&&X&&A&&(async()=>{let e=mm(A,ee.embeddedWallets.ethereum.createOnLogin),t=ym(A,ee.embeddedWallets.solana.createOnLogin),n=await QA();if(n){if(e&&t){let e=await X.create({accessToken:n});return await X.createSolana({accessToken:n,ethereumAddress:e?.address}),void de(!1)}if(t)return await X.createSolana({accessToken:n,ethereumAddress:cn(A)?.address}),await qe.refreshSessionAndUser(),void de(!1);if(e)return await X.create({accessToken:n}),void de(!1)}})().catch(console.error)}),[ce&&X&&A]),d((()=>{if(ee.externalWallets.solana.connectors)return ee.externalWallets.solana.connectors.onMount(),()=>ee.externalWallets.solana.connectors?.onUnmount()}),[ee.externalWallets.solana.connectors]),d((()=>{!m&&te&&async function(){let e,t=xe(),n=Ee(),i=r();a.initializeConnectorManager({walletConnectCloudProjectId:ee.walletConnectCloudProjectId,rpcConfig:ee.rpcConfig,chains:ee.chains,defaultChain:ee.defaultChain,store:i,walletList:ee.appearance.walletList,shouldEnforceDefaultChainOnConnect:ee.shouldEnforceDefaultChainOnConnect,externalWalletConfig:ee.externalWallets,appName:ee.name??"Privy",walletChainType:ee.appearance.walletChainType,appKit:ee.externalWallets.walletConnect.appKit,setBaseAccountSdk:M}),a.connectors?.on("connectorInitialized",(()=>{e&&clearTimeout(e);let t=a.connectors.walletConnectors.length,n=a.connectors.walletConnectors.reduce(((e,t)=>e+(t.initialized?1:0)),0);n===t?fe(!0):e=setTimeout((()=>{console.debug({message:"Unable to initialize all expected connectors before timeout",initialized:n,expected:t}),fe(!0)}),1500)})),a.connectors?.initialize().then((()=>{We()}));let o=await a.getAuthenticatedUser(),s=!!o;ee.legal.requireUsersAcceptTerms&&o&&!o.hasAcceptedTerms?(await a.logout(),qe.setReadyToTrue(!0),nl(me,"logout","onSuccess")):(ee.customAuth?.enabled||(f(!!o),o&&nl(me,"login","onComplete",{user:o,isNewUser:!1,wasAlreadyAuthenticated:!0,loginMethod:null,loginAccount:null}),T(o)),t?ve.current=s?"link":"login":n&&!s?(ve.current="login",re({telegramAuthModalData:{seamlessAuth:!0}}),ke(uf)):qe.setReadyToTrue(!!o))}()}),[a,ae,m,te]),d((()=>{if(m){if(!A||!A.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType)))return void le(!!X);if([...x].some((e=>"privy"===e.walletClientType)))return void le(!0);le(!!X)}}),[m,A,x,X]),d((()=>{a.connectors?.setWalletList(ee.appearance.walletList)}),[ee.appearance.walletList.join()]);let xe=()=>{let e=wi();return e.inProgress&&e.popupFlow?window.opener.location.origin!==window.location.origin?void window.opener.postMessage({type:"PRIVY_OAUTH_ERROR",error:"Origins between parent and child windows do not match."}):"error"===e.authorizationCode?void window.opener.postMessage({type:"PRIVY_OAUTH_ERROR",error:"Something went wrong. Try again."}):void window.opener.postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:e.stateCode,authorizationCode:e.authorizationCode}):(e.inProgress&&function(e){return e.startsWith("privy:")}(e.provider)&&!e.popupFlow&&(new BroadcastChannel(Wp).postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:e.stateCode,authorizationCode:e.authorizationCode}),window.close()),!!e.inProgress&&!!e.withPrivyUi&&(a.startAuthFlow(new ri({...e,customOAuthRedirectUrl:ee.customOAuthRedirectUrl})),ke(NA),!0))},Ee=()=>{let e=function(){let e;return(e=function(){let e=new URLSearchParams(window.location.search),t=Number(e.get("id")||""),n=e.get("hash"),r=Number(e.get("auth_date")||""),a=e.get("first_name");if(t&&a&&r&&n)return Object.fromEntries(e.entries())}())?(Ji(),{flowType:"login-url",authData:e}):(e=function(){let e=window.location.hash;if(!e||!e.startsWith("#tgWebAppData"))return;let t=Xi(e.replace("#tgWebAppData=","")),{user:n,auth_date:r,hash:a}=t;return n&&r&&a?t:void 0}())?(Ji(),{flowType:"web-app",authData:e}):void 0}();if(!e||!ee.loginMethods.telegram||!ee.loginConfig.telegramAuthConfiguration?.seamlessAuthEnabled)return;let t=new Yi;return a.startAuthFlow(t),"login-url"===e.flowType&&(t.meta.telegramWebAppData=void 0,t.meta.telegramAuthResult=e.authData),"web-app"===e.flowType&&(t.meta.telegramAuthResult=void 0,t.meta.telegramWebAppData=e.authData),!0},Se=async(e,t,n,r)=>{if("solana_adapter"!==e)_e(await(a.connectors?.createEthereumWalletConnector({connectorType:e,walletClientType:t}))||null,t,n,r);else{let e=a.connectors?.findSolanaWalletConnector(t);if(!e)return;_e(e,t,n,r)}};async function _e(e,t,n,r){if(!e)return D({status:"disconnected",connectedWallet:null,connectError:new Le("Unable to connect to wallet."),connector:null,connectRetry:Pt}),r?.(null,n);D({status:"disconnected",connectedWallet:null,connectError:null,connector:e,connectRetry:Pt}),e instanceof _s&&t&&await e.resetConnection(t),D({connector:e,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>_e(e,t,n,r)});try{let t=await e.connect({showPrompt:!0});if((!t||mo(t))&&ee.shouldEnforceDefaultChainOnConnect&&!ee.chains.find((e=>e.id===Number(t?.chainId.replace("eip155:",""))))&&("wallet_connect_v2"!==t?.connectorType||"metamask"!==t?.walletClientType)){D((t=>({...t,connector:e,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:Pt})));try{await(t?.switchChain(ee.defaultChain.id)),t&&(t.chainId=Hi(C(ee.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${ee.defaultChain.id}`)}}return D((e=>({...e,status:"connected",connectedWallet:t,connectError:null,connectRetry:Pt}))),t&&nl(me,"connectWallet","onSuccess",{wallet:t}),r?.(t,n)}catch(e){return e instanceof Re?(console.warn(e.cause?e.cause:e.message),nl(me,"connectWallet","onError",e.privyErrorCode||Te.GENERIC_CONNECT_WALLET_ERROR)):(console.warn(e),nl(me,"connectWallet","onError",Te.UNKNOWN_CONNECT_WALLET_ERROR)),D((t=>({...t,status:"disconnected",connectedWallet:null,connectError:e}))),r?.(null,n)}}let Ne=async(e,t,n)=>{if(null===e||!mo(e))return;let r=new ki(a,e,t,n);a.startAuthFlow(r)},Me=async(e,t,n,r="plain")=>{let i=c(ny);if("transaction"===r&&!i)throw new he("useSolanaLedger plugin hook must be mounted");if(null===e||!Qo(e))return;let o=new xi(e,a,t,n,r,i?{deserializeTransactionFromB64String:i.deserializeTransactionFromB64String,prepareSiwsTransactionWithMemo:i.prepareSiwsTransactionWithMemo}:void 0);a.startAuthFlow(o)},We=()=>{let e=new URLSearchParams(window.location.search),t=e.get("privy_connector"),n=e.get("privy_wallet_client"),r="true"===e.get("privy_connect_only");if(!t||!n)return;let i=Vo({connectorType:t,walletClientType:n});if(!i||!i.isInstalled)return ke(lA);if(!a.connectors)throw new he("Connector not initialized");ke(r?qf:fy);let o=new URL(window.location.href);o.searchParams.delete("privy_connector"),o.searchParams.delete("privy_wallet_client"),o.searchParams.delete("privy_connect_only"),window.history.pushState({},"",o),Se(t,n,void 0,r?void 0:"solana_adapter"===t?Me:Ne)};d((()=>{m&&y&&null===A&&a.getAuthenticatedUser().then(T)}),[m,y,A,a]);let Pe=e=>{if(!y)throw nl(me,"linkAccount","onError",Te.MUST_BE_AUTHENTICATED,{linkMethod:e}),new he("User must be authenticated before linking an account.")},Ue=e=>{if(!y||!A)return!1;if("privy"===e.walletClientType)return!0;for(let t of A.linkedAccounts)if("wallet"===t.type&&t.address===e.address&&"privy"!==t.walletClientType)return!0;return!1},Fe=async e=>{let t;if(!a.connectors)throw new he("Connector not initialized");t="ethereum"===e.type?a.connectors.findWalletConnector(e.connectorType,e.walletClientType)||null:a.connectors.findSolanaWalletConnector(e.walletClientType)||null,D((n=>({...n,connector:t,status:"connected",connectedWallet:e,connectError:null,connectRetry:Pt}))),ee.captchaEnabled&&!y?(re({captchaModalData:{callback:t=>mo(e)?Ne(e,t):Me(e,t),userIntentRequired:!1,onSuccessNavigateTo:fy,onErrorNavigateTo:Wm}}),ke(oy)):(mo(e)?await Ne(e):await Me(e),ke(fy))},Oe=()=>{E((e=>{let t=a.connectors?.wallets.filter(mo).map((e=>({...e,linked:Ue(e),loginOrLink:async()=>{if(!await e.isConnected())throw new he("Wallet is not connected");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new he("Cannot link or login with embedded wallet");Fe(e)},fund:async t=>{await qe.fundWallet(e.address,t)},unlink:async()=>{if(!y)throw new he("User is not authenticated.");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new he("Cannot unlink an embedded wallet");T(await a.unlinkEthereumWallet(e.address))}})))||[];return go(e,t)?e:t})),_((e=>{let t=(a.connectors?.wallets??[]).filter(Qo).map((e=>({...e,linked:Ue(e),loginOrLink:async()=>{if(!await e.isConnected())throw new he("Wallet is not connected");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new he("Cannot link or login with embedded wallet");Fe(e)},fund:async()=>{throw new he("'fund' is deprecated for Solana wallets - use 'fundWallet' instead")},unlink:async()=>{if(!y)throw new he("User is not authenticated.");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new he("Cannot unlink an embedded wallet");T(await a.unlinkSolanaWallet(e.address))}})));return go(e,t)?e:t}))};d((()=>{Oe()}),[A?.linkedAccounts,y,m]),d((()=>{if(m){if(!a.connectors)throw new he("Connector not initialized");Oe(),a.connectors.on("walletsUpdated",Oe)}}),[m]),d((()=>{[...ee.loginMethodsAndOrder?.primary??[],...ee.loginMethodsAndOrder?.overflow??[]].filter((e=>e.startsWith("privy:"))).forEach((e=>a.getCrossAppProviderDetails(e.replace("privy:",""))))}),[!!a]);let De=({transaction:e,sponsor:t,uiOptions:r,fundWalletConfig:i,address:o,signOnly:s})=>new Promise((async(c,d)=>{let{requesterAppId:u}=r||{},p=s?"signTransaction":"sendTransaction",h=o?dn(A,o):cn(A);if(!h&&o){let n=yn(x,o);if(n){if(t)throw new he("Cannot sponsor transactions for externally connected wallet.");try{let t=await n.getEthereumProvider(),r={...e,from:o,chainId:e.chainId||Number(n.chainId.replace("eip155:","")),value:void 0!==e.value?C(e.value):void 0},a=await t.request({method:"sendTransaction"===p?"eth_sendTransaction":"eth_signTransaction",params:[r]});return nl(me,p,"onSuccess",{hash:a}),void c({hash:a})}catch(e){return nl(me,p,"onError",Te.TRANSACTION_FAILURE),void d(e??new po("Unable to "+p+e))}}}if(!h)return nl(me,p,"onError",Te.EMBEDDED_WALLET_NOT_FOUND),void d(new he("No embedded or connected wallet found for address."));if(!y||!A)return nl(me,p,"onError",Te.MUST_BE_AUTHENTICATED),void d(Error("User must be authenticated before signing with a Privy wallet"));let m=h.address,g=h.walletIndex??0,{entropyId:f,entropyIdVerifier:w}=ro(A,h),b=Ke.wallets.find((e=>"privy"===e.walletClientType&&v(e.address)===v(m)));if(!b)return nl(me,p,"onError",Te.EMBEDDED_WALLET_NOT_FOUND),void d(Error("Must have a Privy wallet before signing"));let T=await b.getEthereumProvider(),E=await T.request({method:"eth_chainId"}),S=e.chainId?Number(e.chainId):Mp(E);(e=>{if(!ee.chains.map((e=>e.id)).includes(e))throw new Le(`Chain ID ${e} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,Te.UNSUPPORTED_CHAIN_ID)})(S);let _={...e,from:e.from??m,chainId:S},N=await QA();if(!N||!X)return nl(me,p,"onError",Te.EMBEDDED_WALLET_NOT_FOUND),void d(Error("Must have valid access token and Privy wallet to send transaction"));let M=Mi(_.chainId,ee.chains,ee.rpcConfig,{appId:n.appId}),W=rn(h),P=async({transactionRequest:e})=>{try{let n;if(!await qe.recoverEmbeddedWallet({address:m}))throw nl(me,p,"onError",Te.UNKNOWN_CONNECT_WALLET_ERROR),d(Error("Unable to connect to wallet")),Error("Unable to connect to wallet");if(t){let t=await(async({transactionRequest:e})=>{if(!W)throw new he("Sponsoring is only supported for wallets on the TEE stack");if(s)throw new he("Cannot sponsor a sign transaction request");let t=e=>null==e?void 0:C(e),n=await I(l,(async({message:e})=>await X.signWithUserSigner({accessToken:N,requesterAppId:u,message:e})),{chain_type:"ethereum",method:"eth_sendTransaction",caip2:Hi(C(e.chainId)),sponsor:!0,params:{transaction:{from:e.from,to:e.to,chain_id:t(e.chainId),data:k(e.data)?e.data?e.data:C(Uint8Array.from(e.data)):void 0,value:t(e.value)}},wallet_id:h.id});if(n.data&&"hash"in n.data)return n.data.hash;throw new po("Unable to sign transaction")})({transactionRequest:e});return nl(me,"sendTransaction","onSuccess",{hash:t}),t}if(W){let t=e=>null==e?void 0:C(e),r=await I(l,(async({message:e})=>await X.signWithUserSigner({accessToken:N,requesterAppId:u,message:e})),{chain_type:"ethereum",method:"eth_signTransaction",params:{transaction:{from:e.from,to:e.to,nonce:t(e.nonce),chain_id:t(e.chainId),data:k(e.data)?e.data?e.data:C(Uint8Array.from(e.data)):void 0,value:t(e.value),type:e.type,gas_limit:t(e.gasLimit??e.gas),gas_price:t(e.gasPrice??e.gas),max_fee_per_gas:t(e.maxFeePerGas),max_priority_fee_per_gas:t(e.maxPriorityFeePerGas)}},wallet_id:h.id});if(!r.data||!("signed_transaction"in r.data))throw new po("Unable to sign transaction");n=r.data.signed_transaction}else n=await async function({accessToken:e,entropyId:t,entropyIdVerifier:n,transactingWalletIndex:r,walletProxy:a,transactionRequest:i,requesterAppId:o}){return(await a.rpc({entropyId:t,entropyIdVerifier:n,hdWalletIndex:r??0,chainType:"ethereum",accessToken:e,requesterAppId:o,request:{method:"eth_signTransaction",params:[i]}})).response.data}({accessToken:N,entropyId:f,entropyIdVerifier:w,transactingWalletIndex:g,walletProxy:X,transactionRequest:e,requesterAppId:u});if(s)return nl(me,"signTransaction","onSuccess",{signature:n}),n;{let e=await M.sendRawTransaction({serializedTransaction:n});return nl(me,"sendTransaction","onSuccess",{hash:e}),e}}catch(e){throw nl(me,p,"onError",Te.TRANSACTION_FAILURE),e}};if(be({showWalletUIs:r?.showWalletUIs})){let e=s||t?_:await ku(_,M,_.from);try{let t=await P({transactionRequest:e});s?nl(me,"signTransaction","onSuccess",{signature:t}):nl(me,"sendTransaction","onSuccess",{hash:t}),c({hash:t})}catch(e){nl(me,p,"onError",Te.TRANSACTION_FAILURE),d(e)}}else{let e={connectingWalletAddress:m,recoveryMethod:h.recoveryMethod,entropyId:f,entropyIdVerifier:w,onCompleteNavigateTo:Wk,isUnifiedWallet:W,onFailure:e=>{nl(me,p,"onError",Te.UNKNOWN_CONNECT_WALLET_ERROR),d(e)}},n=av(ee)?DC({address:m,appConfig:ee,fundWalletConfig:i,methodScreen:PC,chainIdOverride:_.chainId,comingFromSendTransactionScreen:!0}):void 0;re({connectWallet:e,sendTransaction:{transactionRequest:_,transactingWalletIndex:g,transactingWalletAddress:m,entropyId:f,entropyIdVerifier:w,signOnly:s,scanTransaction:async()=>{let e=await ku(_,M,_.from);return await a.scanTransaction({metadata:{domain:ee.embeddedWallets.transactionScanning.domain},chain_id:e.chainId.toString(),request:{method:"eth_sendTransaction",params:[{from:e.from,to:e.to,value:e.value?.toString(),gas:e.gas?.toString(),gasPrice:e.gasPrice?.toString(),nonce:e.nonce?.toString(),data:e.data}]}})},getIsSponsored:async()=>!!t,onConfirm:({transactionRequest:e})=>P({transactionRequest:e}),onSuccess:e=>{s?nl(me,"signTransaction","onSuccess",{signature:e.hash}):nl(me,"sendTransaction","onSuccess",{hash:e.hash}),c(e)},onFailure:e=>{nl(me,p,"onError",Te.TRANSACTION_FAILURE),d(e)},uiOptions:r||{},fundWalletConfig:i,requesterAppId:u},funding:n}),ke(eb)}}));function Be(){return new Promise((async(e,t)=>{let n=await QA();if(!n||!X)throw Error("Must have valid access token to enroll in MFA");try{await X.verifyMfa({accessToken:n}),e()}catch(e){t(e)}}))}let ze=e=>e?.linkedAccounts.filter((e=>null!==e.latestVerifiedAt&&!("wallet"===e.type&&"privy"===e.walletClientType))).sort(((e,t)=>t.latestVerifiedAt.getTime()-e.latestVerifiedAt.getTime()))[0],He=e=>{let t=A?.linkedAccounts.filter((t=>t.type===e)).length??0,{displayName:n,loginMethod:r}=em(e);if("passkey"===e&&t>=5||"passkey"!==e&&t>=1)throw nl(me,"linkAccount","onError",Te.CANNOT_LINK_MORE_OF_TYPE,{linkMethod:r}),new he(`User already has an account of type ${n} linked.`)};async function Ve({showAutomaticRecovery:e=!1,legacySetWalletPasswordFlow:t=!1}){F(null);let n=t?"setWalletPassword":"setWalletRecovery";if(!y||!A)throw nl(me,n,"onError",Te.MUST_BE_AUTHENTICATED),Error("User must be authenticated before adding recovery method to Privy wallet");let r=nn(A);if(!r||!X)throw nl(me,n,"onError",Te.EMBEDDED_WALLET_NOT_FOUND),Error("Must have a Privy wallet to add a recovery method");let a=rn(r);if(a)throw nl(me,n,"onError",Te.UNSUPPORTED_WALLET_TYPE),new he("User owned wallet recovery is only supported for on-device execution and this app uses TEE execution. Learn more https://docs.privy.io/recipes/tee-wallet-migration-guide");try{await Be()}catch(e){throw nl(me,n,"onError",Te.MISSING_MFA_CREDENTIALS),e}return new Promise(((i,o)=>{let s="user-passcode"===r.recoveryMethod,l=Ew({walletAction:"update",availableRecoveryMethods:ee.embeddedWallets.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:t,isResettingPassword:s,showAutomaticRecovery:e}),{entropyId:c,entropyIdVerifier:d}=ro(A),u={recoveryMethod:r.recoveryMethod,connectingWalletAddress:r.address,onCompleteNavigateTo:l,shouldForceMFA:!1,entropyId:c,isUnifiedWallet:a,entropyIdVerifier:d,onFailure:e=>{nl(me,n,"onError",Te.UNKNOWN_CONNECT_WALLET_ERROR),o(e)}};re({setWalletPassword:{onSuccess:e=>{nl(me,n,"onSuccess",{method:"user-passcode",wallet:e}),i(e)},onFailure:e=>{nl(me,n,"onError",Te.USER_EXITED_SET_PASSWORD_FLOW),o(e)},callAuthOnSuccessOnClose:!1},recoverWallet:{entropyId:c,entropyIdVerifier:d,onFailure:o},connectWallet:u,recoverySelection:{isInAccountCreateFlow:!1,isResettingPassword:s,shouldCreateEth:!1,shouldCreateSol:!1}}),ke(eb)}))}async function $e({appId:e,action:t}){let n=await QA();if("link"===t&&!n)throw nl(me,"linkAccount","onError",Te.MUST_BE_AUTHENTICATED,{linkMethod:`privy:${e}`}),new he("User must be authenticated before linking an account.");if("login"===t&&n)throw nl(me,"login","onError",Te.UNKNOWN_AUTH_ERROR),new he("Attempted to log in, but user is already logged in. Use a `link` helper instead.");we.current=`privy:${e}`,ve.current=t;let r=Op();return a.createAnalyticsEvent({eventName:"cross_app_auth_started",payload:{providerAppId:e}}),new Promise((async(n,i)=>{let{name:o,logoUrl:s}=await Fp({api:a.api,providerAppId:e,requesterAppId:ee.id});re({crossAppAuth:{appId:e,name:o,logoUrl:s,action:t,popup:r,onSuccess:n,onError:i}}),ke(zk)}))}let je={ready:m,authenticated:y,user:A,walletConnectors:a.connectors||null,connectWallet:e=>{e&&"target"in e&&e&&(e=void 0),re({externalConnectWallet:{walletList:e?.walletList&&e?.walletList.length>0?e.walletList:void 0,suggestedAddress:e?.suggestedAddress,walletChainType:e?.walletChainType,description:e?.description}}),ke(Cy)},linkWallet:n=>{n&&"target"in n&&n&&(n=void 0),Pe("siwe"),we.current="siwe",ve.current="link",re({...ne,externalConnectWallet:{...ne.externalConnectWallet,suggestedAddress:n?.suggestedAddress,walletList:n?.walletList,walletChainType:n?.walletChainType,description:n?.suggestedAddress?/*#__PURE__*/e("span",{children:["Link the wallet with address"," ",/*#__PURE__*/t(pp,{showCopyIcon:!1,address:n?.suggestedAddress})," ",ee?.name?`to ${ee.name}.`:"."]}):`Link a wallet to your ${ee?.name} account`}}),ke(vy)},startCrossAppAuthFlow:$e,linkEmail:()=>{Pe("email"),He("email"),we.current="email",ve.current="link",ke(aA)},linkPhone:()=>{Pe("sms"),He("phone"),we.current="sms",ve.current="link",ke(oA)},linkGoogle:async()=>{Pe("google"),He("google_oauth"),ve.current="link",await qe.initLoginWithOAuth("google")},linkTwitter:async()=>{Pe("twitter"),He("twitter_oauth"),ve.current="link",await qe.initLoginWithOAuth("twitter")},linkDiscord:async()=>{Pe("discord"),He("discord_oauth"),ve.current="link",await qe.initLoginWithOAuth("discord")},linkGithub:async()=>{Pe("github"),He("github_oauth"),ve.current="link",await qe.initLoginWithOAuth("github")},linkSpotify:async()=>{Pe("spotify"),He("spotify_oauth"),ve.current="link",await qe.initLoginWithOAuth("spotify")},linkInstagram:async()=>{Pe("instagram"),He("instagram_oauth"),ve.current="link",await qe.initLoginWithOAuth("instagram")},linkTiktok:async()=>{Pe("tiktok"),He("tiktok_oauth"),ve.current="link",await qe.initLoginWithOAuth("tiktok")},linkLine:async()=>{Pe("line"),He("line_oauth"),ve.current="link",await qe.initLoginWithOAuth("line")},linkLinkedIn:async()=>{Pe("linkedin"),He("linkedin_oauth"),ve.current="link",await qe.initLoginWithOAuth("linkedin")},linkApple:async()=>{Pe("apple"),He("apple_oauth"),ve.current="link",await qe.initLoginWithOAuth("apple")},linkPasskey:async()=>{Pe("passkey"),He("passkey"),await qe.initLinkWithPasskey(),ke(Wv)},linkTelegram:async e=>{if(Pe("telegram"),He("telegram"),ve.current="link",we.current="telegram",e?.launchParams)if(e.launchParams.initDataRaw){let t=new Yi;a.startAuthFlow(t),t.meta.telegramAuthResult=void 0,t.meta.telegramWebAppData=Xi(e.launchParams.initDataRaw),re({telegramAuthModalData:{seamlessAuth:!0}}),ke(uf)}else nl(me,"linkAccount","onError",Te.INVALID_DATA,{linkMethod:"telegram"});else await qe.initLoginWithTelegram();ke(uf)},linkFarcaster:async()=>{Pe("farcaster"),He("farcaster"),await qe.initLoginWithFarcaster(),ve.current="link",we.current="farcaster",ke(Dy)},updateEmail:()=>{if(Pe("email"),!A?.email)throw new he("User does not have an email linked to their account.");ve.current="update",we.current="email",ke(FA)},updatePhone:()=>{if(Pe("sms"),!A?.phone)throw new he("User does not have a phone number linked to their account.");ve.current="update",we.current="sms",ke(LA)},login:async e=>{e&&"target"in e&&e&&(e=void 0);let t="Attempted to log in, but user is already logged in. Use a `link` helper instead.";if(!m){let e=await new Promise((e=>{ie((t=>e.bind(t)))}));if(ie(null),e)return void console.warn(t)}!A||A.isGuest?(ve.current="login",re({login:e}),ke(hw)):console.warn(t)},connectOrCreateWallet:async()=>{m||(await new Promise((e=>{ie((()=>e))})),ie(null)),y?console.warn("User must be unauthenticated to `connectOrCreateWallet`"):(ve.current="connect-or-create",ke(Af))},logout:async()=>{if(ve.current=null,we.current=null,A&&a.clearProviderAcccessTokens(A),F(null),await a.logout(),A&&X)try{await X.clearMfa({userId:A.id})}catch(e){}T(null),f(!1),nl(me,"logout","onSuccess"),h(!1),ua.del(Pa),ua.del(Ua(ee.id))},getAccessToken:u((()=>a.getCustomerAccessToken()),[a]),unlinkWallet:async e=>{let t;return T(t=e.startsWith("0x")?await a.unlinkEthereumWallet(e):await a.unlinkSolanaWallet(e)),t},unlinkEmail:async e=>{let t=await a.unlinkEmail(e);return T(t),t},unlinkPhone:async e=>{let t=await a.unlinkPhone(e);return T(t),t},unlinkGoogle:async e=>{let t=await a.unlinkOAuth("google",e);return T(t),t},unlinkTwitter:async e=>{let t=await a.unlinkOAuth("twitter",e);return T(t),t},unlinkDiscord:async e=>{let t=await a.unlinkOAuth("discord",e);return T(t),t},unlinkGithub:async e=>{let t=await a.unlinkOAuth("github",e);return T(t),t},unlinkSpotify:async e=>{let t=await a.unlinkOAuth("spotify",e);return T(t),t},unlinkInstagram:async e=>{let t=await a.unlinkOAuth("instagram",e);return T(t),t},unlinkTiktok:async e=>{let t=await a.unlinkOAuth("tiktok",e);return T(t),t},unlinkLine:async e=>{let t=await a.unlinkOAuth("line",e);return T(t),t},unlinkLinkedIn:async e=>{let t=await a.unlinkOAuth("linkedin",e);return T(t),t},unlinkApple:async e=>{let t=await a.unlinkOAuth("apple",e);return T(t),t},unlinkFarcaster:async e=>{let t=await a.unlinkFarcaster(e);return T(t),t},unlinkTelegram:async e=>{let t=await a.unlinkTelegram(e);return T(t),t},unlinkPasskey:async e=>{let t=await QA();if(!t)throw Error("Must have valid access token to enroll in MFA");if(!X)throw Error("Wallet proxy not initialized.");let n=ee.passkeys.shouldUnenrollMfaOnUnlink;await X.unlinkPasskeyAccount({credentialId:e,accessToken:t,removeAsMfa:n});let r=await a.getAuthenticatedUser();return T(r),r},unlinkCrossAppAccount:async({subject:e})=>{let t=A?.linkedAccounts.find((t=>"cross_app"===t.type&&t.subject===e))?.providerApp;if(!t)throw new he("Invalid subject");a.storeProviderAccessToken(t.id,null);let n=await a.unlinkOAuth(`privy:${t.id}`,e);return T(n),n},setWalletRecovery:async e=>Ve({legacySetWalletPasswordFlow:!1,showAutomaticRecovery:e?.showAutomaticRecovery??!1}),setWalletPassword:async()=>Ve({legacySetWalletPasswordFlow:!0,showAutomaticRecovery:!1}),signMessage:(e,t)=>new Promise((async(n,r)=>{let{requesterAppId:i}=t?.uiOptions||{},o=e.message,s=t?.address?dn(A,t.address):cn(A);if(!s&&void 0!==t?.address){let e=yn(x,t.address);if(e)try{let t=await e.getEthereumProvider(),r=await t.request({method:"personal_sign",params:[o,e.address]});return nl(me,"signMessage","onSuccess",{signature:r}),void n({signature:r})}catch(e){return nl(me,"signMessage","onError",Te.UNABLE_TO_SIGN),void r(e??new po("Unable to sign message"))}}if(!s)throw new he("No embedded or connected wallet found for address.");if(!y||!A)return nl(me,"signMessage","onError",Te.MUST_BE_AUTHENTICATED),void r(Error("User must be authenticated before signing with a Privy wallet"));let c=s.address,d=s.walletIndex??0,{entropyId:u,entropyIdVerifier:p}=ro(A,s),h=rn(s);if("string"!=typeof o||o.length<1)return nl(me,"signMessage","onError",Te.INVALID_MESSAGE),void r(Error("Message must be a non-empty string"));let m=async()=>{let t;if(!y)throw Error("User must be authenticated before signing with a Privy wallet");let n=await QA();if(!X||!n||!await qe.recoverEmbeddedWallet({address:c}))throw Error("Unable to connect to wallet");if(a.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_started",payload:{walletAddress:c,requesterAppId:i}}),h){let r=k(e.message,{strict:!0}),a=await I(l,(async({message:e})=>await X.signWithUserSigner({accessToken:n,requesterAppId:i,message:e})),{chain_type:"ethereum",method:"personal_sign",params:r?{message:o.slice(2),encoding:"hex"}:{message:o,encoding:"utf-8"},wallet_id:s.id});if(!a.data||!("signature"in a.data))throw new po("Unable to sign message");t=a.data.signature}else{let{response:e}=await X.rpc({accessToken:n,entropyId:u,entropyIdVerifier:p,chainType:"ethereum",hdWalletIndex:d,requesterAppId:i,request:{method:"personal_sign",params:[o,c]}});t=e.data}return a.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_completed",payload:{walletAddress:c,requesterAppId:i}}),t};if(be({showWalletUIs:t?.uiOptions?.showWalletUIs}))try{let e=await m();nl(me,"signMessage","onSuccess",{signature:e}),n({signature:e})}catch(e){nl(me,"signMessage","onError",Te.UNABLE_TO_SIGN),r(e??new po("Unable to sign message"))}else re({signMessage:{method:"personal_sign",data:o,confirmAndSign:m,onSuccess:e=>{nl(me,"signMessage","onSuccess",{signature:e}),n({signature:e})},onFailure:e=>{nl(me,"signMessage","onError",Te.UNABLE_TO_SIGN),r(e)},uiOptions:t?.uiOptions||{}},connectWallet:{recoveryMethod:s.recoveryMethod,connectingWalletAddress:c,entropyId:u,entropyIdVerifier:p,onCompleteNavigateTo:ek,isUnifiedWallet:h,onFailure:e=>{nl(me,"signMessage","onError",Te.UNKNOWN_CONNECT_WALLET_ERROR),r(e)}}}),ke(eb)})),signTypedData:(e,t)=>new Promise((async(n,r)=>{let{requesterAppId:i}=t?.uiOptions||{},o=t?.address?dn(A,t.address):cn(A);if(!o&&t?.address){let a=yn(x,t.address);if(a)try{let t=await a.getEthereumProvider(),r=$i(e),i=await t.request({method:"eth_signTypedData_v4",params:[a.address,r]});return nl(me,"signTypedData","onSuccess",{signature:i}),void n({signature:i})}catch(e){return nl(me,"signTypedData","onError",Te.UNABLE_TO_SIGN),void r(e??new po("Unable to sign typed data "+e))}}if(!o)throw new he("No embedded or connected wallet found for address.");if(!y||!A)return nl(me,"signTypedData","onError",Te.MUST_BE_AUTHENTICATED),void r(Error("User must be authenticated before signing with a Privy wallet"));let s=o.address,c=o.walletIndex??0,{entropyId:d,entropyIdVerifier:u}=ro(A,o),p=rn(o),h=$i(e),m=async()=>{let e;if(!y)throw Error("User must be authenticated before signing with a Privy wallet");let t=await QA();if(!X||!t||!await qe.recoverEmbeddedWallet({address:s}))throw Error("Unable to connect to wallet");if(a.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_started",payload:{walletAddress:s,requesterAppId:i}}),p){let{domain:n,types:r,primaryType:a,message:s}=h,c=await I(l,(async({message:e})=>await X.signWithUserSigner({accessToken:t,requesterAppId:i,message:e})),{chain_type:"ethereum",method:"eth_signTypedData_v4",params:{typed_data:{domain:n,types:r,primary_type:a,message:s}},wallet_id:o.id});if(!c.data||!("signature"in c.data))throw new po("Unable to sign message");e=c.data.signature}else{let{response:n}=await X.rpc({accessToken:t,entropyId:d,entropyIdVerifier:u,chainType:"ethereum",hdWalletIndex:c,requesterAppId:i,request:{method:"eth_signTypedData_v4",params:[s,h]}});e=n.data}return a.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_completed",payload:{walletAddress:s,requesterAppId:i}}),e};if(be({showWalletUIs:t?.uiOptions?.showWalletUIs}))try{let e=await m();nl(me,"signTypedData","onSuccess",{signature:e}),n({signature:e})}catch(e){nl(me,"signTypedData","onError",Te.UNABLE_TO_SIGN),r(e??new po("Unable to sign message"))}else re({signMessage:{method:"eth_signTypedData_v4",data:h,confirmAndSign:m,onSuccess:e=>{nl(me,"signTypedData","onSuccess",{signature:e}),n({signature:e})},onFailure:e=>{nl(me,"signTypedData","onError",Te.UNABLE_TO_SIGN),r(e)},uiOptions:t?.uiOptions||{}},connectWallet:{recoveryMethod:o.recoveryMethod,connectingWalletAddress:o.address,entropyId:d,isUnifiedWallet:p,entropyIdVerifier:u,onCompleteNavigateTo:ek,onFailure:e=>{nl(me,"signMessage","onError",Te.UNKNOWN_CONNECT_WALLET_ERROR),r(e)}}}),ke(eb)})),sendTransaction:async(e,t)=>await De({transaction:e,sponsor:t?.sponsor,uiOptions:t?.uiOptions,fundWalletConfig:t?.fundWalletConfig,address:t?.address,signOnly:!1}),signTransaction:async(e,t)=>({signature:(await De({transaction:e,uiOptions:t?.uiOptions,address:t?.address,signOnly:!0})).hash}),exportWallet:e=>new Promise((async(t,r)=>{if(!y||!A)return void r(Error("User must be authenticated before exporting their Privy wallet"));e&&"target"in e&&e&&(e=void 0);let i=e?.address?dn(A,e.address):cn(A);if(!i)return void r(new he("User must have an embedded wallet."));let o=i.address,{entropyId:s,entropyIdVerifier:l}=ro(A,i),c=rn(i);if(!o)return void r(Error("User does not have an HD Ethereum wallet. To export an imported wallet, pass the `address` of the wallet to `exportWallet`."));if(!b(o))return void r(Error("Must provide a valid Ethereum address."));let d={recoveryMethod:i.recoveryMethod,connectingWalletAddress:i.address,isUnifiedWallet:c,entropyId:s,entropyIdVerifier:l,onCompleteNavigateTo:YC,onFailure:r,shouldForceMFA:!0};re(ne),await QA()&&X?X?Ip(i)?(re({keyExport:{appId:n.appId,appClientId:n.clientId,origin:a.apiUrl,address:i.address,entropyId:s,entropyIdVerifier:l,hdWalletIndex:i.walletIndex,chainType:i.chainType,walletId:i.id,isUnifiedWallet:c,imported:i.imported,onSuccess:t,onFailure:r},connectWallet:d}),ke(eb)):r(Error(`Export is not supported for ${i.chainType} wallets`)):r(Error("Must have a Privy wallet before exporting")):r(Error("Must have valid access token to enroll in MFA"))})),promptMfa:Be,async init(e){switch(e){case"sms":return void await a.initMfaSmsVerification();case"passkey":return await a.initMfaPasskeyVerification();case"totp":return;default:throw Error(`Unsupported MFA method: ${e}`)}},async submit(e,t){switch(e){case"totp":case"sms":if("string"!=typeof t)throw new he("Invalid MFA code");ue.current?.resolve({mfaMethod:e,mfaCode:t,relyingParty:window.origin}),await new Promise(((e,t)=>{pe.current={resolve:e,reject:t}}));break;case"passkey":if("string"==typeof t)throw new he("Invalid authenticator response");let n=await import("@simplewebauthn/browser"),r=Rk(await n.startAuthentication(t));ue.current?.resolve({mfaMethod:e,mfaCode:r,relyingParty:window.origin}),await new Promise(((e,t)=>{pe.current={resolve:e,reject:t}}));break;default:throw ue.current?.reject(new he("Unsupported MFA method")),new he(`Unsupported MFA method: ${e}`)}},cancel(){ue.current?.reject(new he("MFA canceled"))},async initEnrollmentWithSms(e){let t=await QA();if(!t||!X)throw Error("Must have valid access token to enroll in MFA");await X.initEnrollMfa({method:"sms",accessToken:t,phoneNumber:e.phoneNumber})},enrollInMfa:e=>new Promise(((t,n)=>{if(!e)return qe.closePrivyModal(),void t();ee.mfa.noPromptOnMfaRequired&&console.warn("[Privy Warning] Triggering the 'showMfaEnrollmentModal' function when 'noPromptOnMfaRequired' is set to true is unexpected. If this is intentional, ensure that you are building custom UIs for MFA verification."),re({mfaEnrollmentFlow:{mfaMethods:ee.mfa.methods,shouldUnlinkOnUnenrollMfa:ee.passkeys.shouldUnlinkOnUnenrollMfa,onSuccess:t,onFailure:n}}),ke(SA)})),async initEnrollmentWithTotp(){let e=await QA();if(!e||!X)throw Error("Must have valid access token to enroll in MFA");let t=await X.initEnrollMfa({method:"totp",accessToken:e});return{secret:t.secret,authUrl:t.authUrl}},async submitEnrollmentWithSms(e){let t=await QA();if(!t||!X)throw Error("Must have valid access token to enroll in MFA");await X.submitEnrollMfa({method:"sms",accessToken:t,phoneNumber:e.phoneNumber,code:e.mfaCode}),T(await a.getAuthenticatedUser())},async submitEnrollmentWithTotp(e){let t=await QA();if(!t||!X)throw Error("Must have valid access token to enroll in MFA");await X.submitEnrollMfa({method:"totp",accessToken:t,code:e.mfaCode}),T(await a.getAuthenticatedUser())},async initEnrollmentWithPasskey(){},async submitEnrollmentWithPasskey({credentialIds:e},t={}){let n=await QA();if(!n||!X)throw Error("Must have valid access token to enroll in MFA");await X.submitEnrollMfa({method:"passkey",accessToken:n,credentialIds:e,removeForLogin:t.removeForLogin}),T(await a.getAuthenticatedUser())},async unenroll(e,t={}){let n=await QA();if(!n||!X)throw Error("Must have valid access token to remove MFA");"passkey"===e?await X.submitEnrollMfa({method:"passkey",accessToken:n,credentialIds:[],removeForLogin:t.removeForLogin}):await X.unenrollMfa({method:e,accessToken:n}),T(await a.getAuthenticatedUser())},requestFarcasterSignerFromWarpcast:async()=>{let e=await QA(),t=A?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!e)throw Error("Must have valid access token to connect with Farcaster");if(!X||!t)throw Error("Must have an embedded wallet to use Farcaster signers");if(rn(t))throw new he("Farcaster signers are only supported for on-device execution and this app uses TEE execution. Learn more at https://docs.privy.io/recipes/tee-wallet-migration-guide");if(!A?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");if(!await qe.recoverEmbeddedWallet({address:t.address}))throw Error("Unable to connect to wallet");let n=await X.initFarcasterSigner({address:t.address,hdWalletIndex:null,accessToken:e,mfaCode:null,mfaMethod:null,relyingParty:window.origin});"approved"===n.status&&T(await a.getAuthenticatedUser()||A||null),re({farcasterSigner:n}),ke(eA)},getFarcasterSignerPublicKey:async()=>{let e,t=await QA(),n=A?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!t)throw Error("Must have valid access token to connect with Farcaster");if(!X||!n)throw Error("Must have an embedded wallet to use Farcaster signers");if(rn(n))throw new he("Farcaster signers are only supported for on-device execution and this app uses TEE execution. Learn more at https://docs.privy.io/recipes/tee-wallet-migration-guide");if(!A?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");if(!await qe.recoverEmbeddedWallet({address:n.address}))throw Error("Unable to connect to wallet");if(!A.farcaster?.signerPublicKey)throw Error("Must have a Farcaster signer public key to sign");return e=A.farcaster.signerPublicKey.slice(2),Uint8Array.from(e.match(/.{1,2}/g).map((e=>parseInt(e,16))))},signFarcasterMessage:async e=>{let t=await QA(),n=A?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!t)throw Error("Must have valid access token to connect with Farcaster");if(!X||!n)throw Error("Must have an embedded wallet to use Farcaster signers");if(rn(n))throw new he("Farcaster signers are only supported for on-device execution and this app uses TEE execution. Learn more at https://docs.privy.io/recipes/tee-wallet-migration-guide");if(!A?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");if(!await qe.recoverEmbeddedWallet({address:n.address}))throw Error("Unable to connect to wallet");if(!A.farcaster?.signerPublicKey)throw Error("Must have a Farcaster signer public key to sign");let r=await import("@simplewebauthn/browser"),a=await X.signFarcasterMessage({address:n.address,hdWalletIndex:null,accessToken:t,mfaCode:null,mfaMethod:null,payload:{hash:r.bufferToBase64URLString(e)},fid:BigInt(A.farcaster.fid),relyingParty:window.origin});return new Uint8Array(r.base64URLStringToBuffer(a.signature))},signMessageWithCrossAppWallet(e,{address:t,chainId:n}){let r=A?.linkedAccounts.some((e=>"cross_app"===e.type&&e.smartWallets.some((e=>e.address===t))));return Rp({user:A,client:a,address:t,requesterAppId:ee.id,request:{method:r?"privy_signSmartWalletMessage":"personal_sign",params:[e,t],chainId:n},reconnect:$e})},signTypedDataWithCrossAppWallet(e,{address:t,chainId:n}){let r=A?.linkedAccounts.some((e=>"cross_app"===e.type&&e.smartWallets.some((e=>e.address===t)))),i=$i(e);return Rp({user:A,client:a,address:t,requesterAppId:ee.id,request:{method:r?"privy_signSmartWalletTypedData":"eth_signTypedData_v4",params:[t,i],chainId:n},reconnect:$e})},sendTransactionWithCrossAppWallet(e,{address:t}){let n=A?.linkedAccounts.some((e=>"cross_app"===e.type&&e.smartWallets.some((e=>e.address===t))));return Rp({user:A,client:a,address:t,requesterAppId:ee.id,request:{method:n?"privy_sendSmartWalletTx":"eth_sendTransaction",params:[e],chainId:e.chainId},reconnect:$e})},signTransactionWithCrossAppWallet(e,{address:t}){let n=A?.linkedAccounts.some((e=>"cross_app"===e.type&&e.smartWallets.some((e=>e.address===t))));return Rp({user:A,client:a,address:t,requesterAppId:ee.id,request:{method:n?"privy_signSmartWalletTx":"eth_signTransaction",params:[e],chainId:e.chainId},reconnect:$e})},isModalOpen:p,mfaMethods:ee.mfa.methods};$A=je.signMessage,jA=je.signTypedData,KA=async(e,t)=>await De({transaction:e,...t,signOnly:!1}),qA=async(e,t)=>({signature:(await De({transaction:e,...t,signOnly:!0})).hash});let qe={privy:l,setAuthenticated:f,setUser:T,setIsNewUser:P,isNewUserThisSession:W,pendingTransaction:null,walletConnectionStatus:R,setWalletConnectionStatus:D,connectors:a.connectors?.walletConnectors??[],solanaWallets:S,rpcConfig:ee.rpcConfig,chains:ee.chains,appId:n.appId,showFiatPrices:"native-token"!==ee.embeddedWallets.priceDisplay.primary,clientAnalyticsId:a.clientAnalyticsId,onCustomAuthAuthenticated:Ae,hideWalletUIs:Ce,isHeadlessSigning:u(be,[ee.embeddedWallets.showWalletUIs]),emailOtpState:H,setEmailOtpState:V,smsOtpState:$,setSmsOtpState:j,oAuthState:G,setOAuthState:Z,telegramAuthState:Y,setTelegramAuthState:Q,siweState:q,setSiweState:K,isHeadlessOAuthLoading:O,baseAccountSdk:N,setBaseAccountSdk:M,nativeTokenSymbolForChainId:e=>ee.chains.find((t=>t.id===Number(e)))?.nativeCurrency.symbol,initializeWalletProxy:async e=>{if(X)return X;let t=new Promise((e=>{oe.current=e})),n=new Promise((t=>setTimeout((()=>t(null)),e))),r=await Promise.race([t,n]);return oe.current=null,r},getAuthFlow:()=>a.authFlow,getAuthMeta:()=>a.authFlow?.meta,client:a,closePrivyModal:async(e={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let t,r=m&&y&&A;r&&we.current&&(t=ze(A)),"login"===ve.current?e.shouldCallAuthOnSuccess&&r&&we.current?nl(me,"login","onComplete",{user:A,isNewUser:W,wasAlreadyAuthenticated:!1,loginMethod:we.current,loginAccount:t??null}):nl(me,"login","onError",Te.USER_EXITED_AUTH_FLOW):"link"===ve.current&&t?e.isSuccess&&r&&we.current?nl(me,"linkAccount","onSuccess",{user:A,linkMethod:we.current,linkedAccount:t}):we.current&&nl(me,"linkAccount","onError",Te.USER_EXITED_LINK_FLOW,{linkMethod:we.current}):"update"===ve.current&&t?e.isSuccess&&r&&we.current?nl(me,"update","onSuccess",{user:A,updateMethod:we.current,updatedAccount:t}):we.current&&nl(me,"update","onError",Te.USER_EXITED_UPDATE_FLOW,{linkMethod:we.current}):"connect-or-create"===ve.current&&(x[0]?nl(me,"connectOrCreateWallet","onSuccess",{wallet:x[0]}):nl(me,"connectOrCreateWallet","onError",Te.USER_EXITED_AUTH_FLOW));let i=U&&Fk.has(U),o=U===Wm&&ne.errorModalData&&Fk.has(ne.errorModalData.previousScreen);if((i||o)&&ne.funding){let e,t=Fk.get(U)??null;if("solana"===ne.funding.chainType){let n=c(qw);if(n)try{e=BigInt(await n.getBalance({address:ne.funding.address,cluster:ne.funding.cluster}))}catch{console.error("Unable to pull wallet balance")}else console.warn("Unable to load solana plugin, skipping balance");nl(me,"fundSolanaWallet","onUserExited",{address:ne.funding.address,cluster:ne.funding.cluster,fundingMethod:t,balance:e})}else{let r=Mi(ne.funding.chain.id,ee.chains,ee.rpcConfig,{appId:n.appId});try{e=await r.getBalance({address:ne.funding.address})}catch{console.error("Unable to pull wallet balance")}nl(me,"fundWallet","onUserExited",{address:ne.funding.address,chain:ne.funding.chain,fundingMethod:t,balance:e})}}re((e=>({...e,externalConnectWallet:{suggestedAddress:void 0}}))),ve.current=null,we.current=null,P(!1),h(!1),setTimeout((()=>{a.authFlow=void 0}),200)},openPrivyModal:ke,connectWallet:_e,initLoginWithWallet:async(e,t,n,r)=>{mo(e)?(we.current="siwe",Ne(e,t,n)):(we.current="siws",Me(e,t,n,r))},loginWithWallet:async()=>{let e,t,n;if(!m)throw new Wt;if(a.authFlow instanceof ki?e="siwe":a.authFlow instanceof xi&&(e="siws"),!e)throw new he("Must initialize SIWE/SIWS flow first.");if(null!==await a.getAccessToken())try{({user:t}=await a.link()),we.current=e}catch(t){throw nl(me,"linkAccount","onError",t.privyErrorCode||Te.FAILED_TO_LINK_ACCOUNT,{linkMethod:e}),t}else try{({user:t,isNewUser:n}=await a.authenticate()),we.current=e}catch(e){throw nl(me,"login","onError",e.privyErrorCode||Te.GENERIC_CONNECT_WALLET_ERROR),e}T(t||A||null),P(n||!1),f(!0)},delegateWallet:async({address:e,chainType:t,showDelegationUIs:n})=>new Promise((async(r,a)=>{let i=await QA();if(!y||!A||!i)throw new he("User must be authenticated and have an embedded wallet to delegate actions.");if("solana"!==t&&"ethereum"!==t)throw new he("Only Solana and Ethereum embedded wallets are supported for delegation and revocation.");let o=qe.walletProxy??await qe.initializeWalletProxy(15e3);if(!o)throw new he("Wallet proxy not initialized.");if((({address:e,user:t})=>!!_p(t).find((t=>t.address===e)))({address:e,user:A}))return r();let s=dn(A,e);if(!s)throw new he("Address to delegate is not associated with current user.");if(rn(s))throw new he("useDelegatedActions is only supported for on-device execution and this app uses TEE execution. Use the useSessionSigners hook to provision server side access on behalf of your users. Learn more at https://docs.privy.io/recipes/tee-wallet-migration-guide");let l=Ep({address:e,user:A}),c=Sp({address:e,user:A}),d=async()=>{await o.createDelegatedAction({accessToken:i,rootWallet:c,delegatedWallets:[l]}),await qe.refreshSessionAndUser()};if(await qe.recoverEmbeddedWallet({address:e}),n)re({delegatedActions:{consent:{address:e,onDelegate:d,onSuccess:async()=>{r()},onError:async e=>{a(e)}}}}),ke(Vk);else try{await d(),r()}catch(e){a(e)}})),revokeDelegatedWallets:async({showDelegationUIs:e})=>new Promise((async(t,n)=>{if(!y||!A)throw new he("User must be authenticated and have an embedded wallet to revoke a delegated wallet.");let r=_p(A);if(0===r.length)throw new he("User has no delegated wallets to revoke.");if(r.some(rn))throw new he("useDelegatedActions is only supported for on-device execution and this app uses TEE execution. Use the useSessionSigners hook to provision server side access on behalf of your users. Learn more at https://docs.privy.io/recipes/tee-wallet-migration-guide");let i=async()=>{await a.revokeDelegatedWallet(),await qe.refreshSessionAndUser()};if(e)re({delegatedActions:{revoke:{onRevoke:i,onSuccess:async()=>{t()},onError:async e=>{n(e)}}}}),ke(jk);else try{await i(),t()}catch(e){n(e)}})),initLoginWithFarcaster:async(e,t)=>{let n=new Ca(e,t);a.startAuthFlow(n);try{we.current="farcaster",await n.initializeFarcasterConnect()}catch(e){throw"login"===ve.current?nl(me,"login","onError",e.privyErrorCode||Te.UNKNOWN_AUTH_ERROR):"link"===ve.current&&nl(me,"linkAccount","onError",e.privyErrorCode||Te.UNKNOWN_AUTH_ERROR,{linkMethod:"farcaster"}),e}},loginWithFarcaster:async()=>{let e,t;if(!m)throw new Wt;if(!(a.authFlow instanceof Ca))throw new he("Must initialize Farcaster flow first.");if(null!==await a.getAccessToken())try{({user:e}=await a.link()),we.current="farcaster"}catch(e){throw nl(me,"linkAccount","onError",e.privyErrorCode||Te.FAILED_TO_LINK_ACCOUNT,{linkMethod:"farcaster"}),e}else try{({user:e,isNewUser:t}=await a.authenticate()),we.current="farcaster"}catch(e){throw nl(me,"login","onError",e.privyErrorCode||Te.UNKNOWN_AUTH_ERROR),e}T(e||null),P(t||!1),f(!0)},async crossAppAuthFlow({appId:e,popup:t,action:n}){let r=`privy:${e}`;we.current=r;let{url:i,stateCode:o,codeVerifier:s}=await async function({api:e,appId:t}){let n=ei(),r=ti(),a=await ni(n);try{let{url:i}=await e.post(Ie,{provider:`privy:${t}`,redirect_to:window.location.href,code_challenge:a,state_code:r});return{url:i,stateCode:r,codeVerifier:n}}catch(e){throw ge(e)}}({api:a.api,appId:e});if(!i)throw a.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:"Unable to open cross-app auth popup",appId:e}}),new he("No authorization URL returned for cross-app auth.");try{let l=await async function({url:e,popup:t}){return t.location=e,new Promise(((e,n)=>{let r,a=setTimeout((()=>{n(new he("Authorization request timed out after 2 minutes.")),i()}),12e4);function i(){t?.close(),window.removeEventListener("message",s)}let o=setInterval((()=>{t?.closed&&!r&&(i(),clearInterval(o),clearTimeout(a),n(new he("User rejected request")))}),300);function s(t){t.data&&("PRIVY_OAUTH_RESPONSE"===t.data.type&&t.data.stateCode&&t.data.authorizationCode&&(clearTimeout(a),e(t.data),i()),"PRIVY_OAUTH_ERROR"===t.data.type&&(clearTimeout(a),n(new he(t.data.error)),i()),t.data.type===Pp&&((r=new BroadcastChannel(Wp)).onmessage=s))}window.addEventListener("message",s)}))}({url:i,popup:t,provider:r}),c=l.stateCode,d=l.authorizationCode;if(c!==o)throw a.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:r,storedStateCode:o??"",returnedStateCode:c??""}}),new he("Unexpected auth flow. This may be a phishing attempt.",void 0,Te.OAUTH_UNEXPECTED);let u=await async function({appId:e,stateCode:t,codeVerifier:n,authorizationCode:r,action:a,client:i}){if(!r||!t)throw new he("[Cross-App AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if("undefined"===r)throw new he("User denied confirmation during cross-app auth flow");try{let o=new Up({authorizationCode:r,stateCode:t,codeVerifier:n,provider:`privy:${e}`});i.startAuthFlow(o);let s="link"===a?await i.link():await i.authenticate(),l=s.oAuthTokens?.accessToken;return console.debug(),l}catch(e){let t=ge(e);if(t.privyErrorCode===Te.ACCOUNT_TRANSFER_REQUIRED)throw t;if(t.privyErrorCode)throw new he(t.message||"Invalid code during cross-app auth flow.",void 0,t.privyErrorCode);if("User denied confirmation during cross-app auth flow"===t.message)throw new he("Invalid code during cross-app auth flow.",void 0,Te.OAUTH_USER_DENIED);throw new he("Invalid code during cross-app auth flow.",void 0,Te.UNKNOWN_AUTH_ERROR)}}({appId:e,codeVerifier:s,stateCode:c,authorizationCode:d,action:n,client:a});u&&a.storeProviderAccessToken(e,u);let p=await qe.refreshSessionAndUser();if(!p)throw new he("Unable to update user");return a.createAnalyticsEvent({eventName:"cross_app_auth_completed",payload:{providerAppId:e}}),p}catch(e){throw a.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:e.toString(),provider:r}}),e}},async initLoginWithOAuth(e,t,n){if(we.current=e,!da())return void ke(nA);if("google"===e&&$f(window.navigator.userAgent))return void ke(nA);"twitter"===e&&window.opener&&window.opener.postMessage({type:Pp},"*"),ua.del(Ra),ua.del(Da);let r=new ri({provider:e,disableSignup:!!n,withPrivyUi:!0,customOAuthRedirectUrl:ee.customOAuthRedirectUrl});t&&r.addCaptchaToken(t),a.startAuthFlow(r);let i=await a.authFlow.getAuthorizationUrl();if(i&&i.url)if("twitter"===e&&w&&(i.url=i.url.replace("x.com","twitter.com")),"chrome-extension:"===window.location.protocol&&Qa())try{let{privyOAuthCode:e,privyOAuthState:t}=await Xa(i.url);ke(NA),r.meta.stateCode=t,r.meta.authorizationCode=e}catch(e){throw console.error("OAuth in chrome extension flow failed:",e),e}else window.location.assign(i.url)},async initLoginWithTelegram(e,t){if(!m)throw new Wt;we.current="telegram";let n=new Yi(e,t);a.startAuthFlow(n),Q({status:"loading"}),n.meta.telegramWebAppData=void 0,n.meta.telegramAuthResult=await new Promise(((e,t)=>ee.loginConfig.telegramAuthConfiguration?window.Telegram?void window.Telegram.Login.auth({bot_id:ee.loginConfig.telegramAuthConfiguration.botId,request_access:!0},(n=>n?e(n):t(new he("Telegram auth failed or was canceled by the client")))):t(new he("Telegram was not initialized")):t(new he("Telegram Auth configuration is not loaded"))))},async loginWithTelegram(e){let t,n;if(!(a.authFlow instanceof Yi))throw new he("Must initialize Telegram flow before calling loginWithTelegram");a.authFlow.meta.captchaToken||=e?.captchaToken;let r=await QA(),i=e?.intent||ve.current;if("login"===i)try{let e=await a.authenticate();t=e.user,n=e.isNewUser,we.current="telegram"}catch(e){throw nl(me,"login","onError",e.privyErrorCode||Te.UNKNOWN_AUTH_ERROR),e}else{if("link"!==i)throw new he("Unknown auth intent");try{t=(await a.link()).user,we.current="telegram"}catch(e){throw nl(me,"linkAccount","onError",e.privyErrorCode||Te.FAILED_TO_LINK_ACCOUNT,{linkMethod:"telegram"}),e}}T(t),P(n||!1),f(!0),Q({status:"done"});let o=t?.linkedAccounts.find((({type:e})=>"telegram"===e))||null;return{user:t,isNewUser:n||!1,wasAlreadyAuthenticated:!!r,loginAccount:o}},async loginWithOAuth(e){let t,n,r;if(!(a.authFlow instanceof ri))throw new he("Must initialize OAuth flow before calling loginWithOAuth");let i=ua.get(Oa),o=a.authFlow.meta.stateCode;if(i!==o)throw a.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:e,storedStateCode:i??"",returnedStateCode:o??""}}),new he("Unexpected auth flow. This may be a phishing attempt.",void 0,Te.OAUTH_UNEXPECTED);if(null!==await a.getAccessToken())try{let n=await a.link();t=n.user,r=n.oAuthTokens,we.current=e}catch(t){throw nl(me,"linkAccount","onError",t.privyErrorCode||Te.FAILED_TO_LINK_ACCOUNT,{linkMethod:e}),t}else try{let i=await a.authenticate();t=i.user,n=i.isNewUser,r=i.oAuthTokens,we.current=e}catch(t){throw"login"===ve.current?nl(me,"login","onError",t.privyErrorCode||Te.UNKNOWN_AUTH_ERROR):"link"===ve.current&&nl(me,"linkAccount","onError",t.privyErrorCode||Te.FAILED_TO_LINK_ACCOUNT,{linkMethod:e}),t}return T(t),P(n||!1),f(!0),r&&t&&nl(me,"oAuthAuthorization","onOAuthTokenGrant",{oAuthTokens:r,user:t}),r},passkeyAuthState:B,setPasskeyAuthState:z,async initSignupWithPasskey({captchaToken:e,withPrivyUi:t}){let n=new Ci({captchaToken:e,setPasskeyAuthState:z});a.startAuthFlow(n),ve.current="login";try{we.current="passkey",z({status:"generating-challenge"}),await n.initRegisterFlow(t),z({status:"awaiting-passkey"})}catch(e){throw z({status:"error",error:e}),nl(me,"login","onError",e.privyErrorCode||Te.UNKNOWN_AUTH_ERROR),e}},async signupWithPasskey(){let e,t;if(!m)throw new Wt;if(!(a.authFlow instanceof Ci))throw new he("Must initialize Passkey flow first.");if("passkey"!==we.current){let e=new he("Must init login with Passkey flow first.");throw z({status:"error",error:e}),e}let n=await QA();try{we.current="passkey",z({status:"awaiting-passkey"}),({user:e,isNewUser:t}=await a.authenticate())}catch(e){throw z({status:"error",error:e}),nl(me,"login","onError",e.privyErrorCode||Te.UNKNOWN_AUTH_ERROR),e}T(e),P(t||!1),f(!0),z({status:"done"});let r=e?.linkedAccounts.find((({type:e})=>"passkey"===e))||null;return{user:e,isNewUser:t||!1,wasAlreadyAuthenticated:!!n,loginAccount:r}},async initLoginWithPasskey({captchaToken:e,withPrivyUi:t}){let n=new Ci({captchaToken:e,setPasskeyAuthState:z});a.startAuthFlow(n),ve.current="login";try{we.current="passkey",z({status:"generating-challenge"}),await n.initAuthenticationFlow(t),z({status:"awaiting-passkey"})}catch(e){throw z({status:"error",error:e}),nl(me,"login","onError",e.privyErrorCode||Te.UNKNOWN_AUTH_ERROR),e}},async loginWithPasskey(e){let t,n;if(!m)throw new Wt;if(!(a.authFlow instanceof Ci))throw new he("Must initialize Passkey flow first.");if(e?.credentialIds&&(a.authFlow.meta.allowedCredentialsIds=e.credentialIds),"passkey"!==we.current){let e=new he("Must init login with Passkey flow first.");throw z({status:"error",error:e}),e}let r=await QA();try{we.current="passkey",z({status:"awaiting-passkey"}),({user:t,isNewUser:n}=await a.authenticate())}catch(e){throw z({status:"error",error:e}),nl(me,"login","onError",e.privyErrorCode||Te.UNKNOWN_AUTH_ERROR),e}T(t),P(n||!1),f(!0),z({status:"done"});let i=t?.linkedAccounts.find((({type:e})=>"passkey"===e))||null;return{user:t,isNewUser:n||!1,wasAlreadyAuthenticated:!!r,loginAccount:i}},async initLinkWithPasskey(e){let t=new Ci({captchaToken:e});a.startAuthFlow(t),ve.current="link",we.current="passkey",z({status:"generating-challenge"});try{await t.initLinkFlow(),z({status:"awaiting-passkey"})}catch(e){throw nl(me,"linkAccount","onError",e.privyErrorCode||Te.UNKNOWN_AUTH_ERROR,{linkMethod:"passkey"}),z({status:"error",error:e}),e}},async linkWithPasskey(){let e;if(!m)throw new Wt;if(!(a.authFlow instanceof Ci))throw new he("Must initialize Passkey flow first.");if("passkey"!==we.current)throw new he("Must init login with Passkey flow first.");try{we.current="passkey",({user:e}=await a.link())}catch(e){throw nl(me,"linkAccount","onError",e.privyErrorCode||Te.FAILED_TO_LINK_ACCOUNT,{linkMethod:"passkey"}),e}return T(e||A||null),z({status:"done"}),e},async initLoginWithHeadlessOAuth(e,t,n){if(!da())throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.");if("google"===e&&$f(window.navigator.userAgent))throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.");let r=new ri({provider:e,withPrivyUi:!1,disableSignup:n??!1,customOAuthRedirectUrl:ee.customOAuthRedirectUrl});t&&r.addCaptchaToken(t),Z({status:"loading"});let i=await a.startAuthFlow(r).getAuthorizationUrl();if(i?.url)if("chrome-extension:"===window.location.protocol&&Qa())try{let{privyOAuthCode:e,privyOAuthState:t}=await Xa(i.url);r.meta.stateCode=t,r.meta.authorizationCode=e,await this.loginWithHeadlessOAuth(r.meta)}catch(e){throw Z({status:"error",error:e}),e}else window.location.assign(i.url)},async loginWithHeadlessOAuth(e){let t,n,r;L(!0),Z({status:"loading"}),a.startAuthFlow(new ri({...e,customOAuthRedirectUrl:ee.customOAuthRedirectUrl}));let i=ua.get(Oa),o=e.stateCode;if(i!==o)throw a.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:e.provider,storedStateCode:i??"",returnedStateCode:o??""}}),L(!1),new he("Unexpected auth flow. This may be a phishing attempt.",void 0,Te.OAUTH_UNEXPECTED);if(null!==await a.getAccessToken())try{({user:t,oAuthTokens:r}=await a.link()),we.current=e.provider;let n=ze(t);t&&n&&nl(me,"linkAccount","onSuccess",{user:t,linkMethod:we.current,linkedAccount:n})}catch(t){throw L(!1),nl(me,"linkAccount","onError",t.privyErrorCode||Te.FAILED_TO_LINK_ACCOUNT,{linkMethod:e.provider}),t}else try{({user:t,isNewUser:n,oAuthTokens:r}=await a.authenticate()),we.current=e.provider;let i=ze(t);t&&i&&void 0!==n&&nl(me,"login","onComplete",{user:t,isNewUser:n,wasAlreadyAuthenticated:!1,loginMethod:we.current,loginAccount:i})}catch(e){throw L(!1),Z({status:"error",error:e}),nl(me,"login","onError",e.privyErrorCode||Te.UNKNOWN_AUTH_ERROR),e}return T(t),P(n||!1),f(!0),L(!1),Z({status:"done"}),r&&t&&nl(me,"oAuthAuthorization","onOAuthTokenGrant",{oAuthTokens:r,user:t}),t??void 0},initLoginWithEmail:async({email:e,captchaToken:t,disableSignup:n,withPrivyUi:r})=>{let i=new sa({email:e,captchaToken:t,disableSignup:n});a.startAuthFlow(i);try{we.current="email",V({status:"sending-code"}),await i.sendCodeEmail({withPrivyUi:r}),V({status:"awaiting-code-input"})}catch(e){throw V({status:"error",error:e}),"login"===ve.current?nl(me,"login","onError",e.privyErrorCode||Te.UNKNOWN_AUTH_ERROR):"link"===ve.current&&nl(me,"linkAccount","onError",e.privyErrorCode||Te.FAILED_TO_LINK_ACCOUNT,{linkMethod:"email"}),e}},initUpdateEmail:async({oldAddress:e,newAddress:t,captchaToken:n})=>{let r=new la(e,t,n);a.startAuthFlow(r);try{await r.sendCodeEmail({withPrivyUi:!0})}catch(e){nl(me,"update","onError",e.privyErrorCode||Te.UNKNOWN_AUTH_ERROR,{linkMethod:we.current})}},initUpdatePhone:async(e,t,n)=>{let r=new Ei(e,t,n);a.startAuthFlow(r);try{await r.sendSmsCode({withPrivyUi:!0})}catch(e){nl(me,"update","onError",e.privyErrorCode||Te.UNKNOWN_AUTH_ERROR,{linkMethod:we.current})}},initLoginWithSms:async({phoneNumber:e,captchaToken:t,disableSignup:n,withPrivyUi:r})=>{j({status:"sending-code"});let i=new Ii({phoneNumber:e,captchaToken:t,disableSignup:n});a.startAuthFlow(i);try{we.current="sms",await i.sendSmsCode({withPrivyUi:r}),j({status:"awaiting-code-input"})}catch(e){throw j({status:"error",error:e}),"login"===ve.current?nl(me,"login","onError",e.privyErrorCode||Te.UNKNOWN_AUTH_ERROR):"link"===ve.current&&nl(me,"linkAccount","onError",e.privyErrorCode||Te.FAILED_TO_LINK_ACCOUNT,{linkMethod:"sms"}),e}},resendEmailCode:async()=>{await(a.authFlow?.sendCodeEmail({withPrivyUi:!0}))},resendSmsCode:async()=>{await(a.authFlow?.sendSmsCode({withPrivyUi:!0}))},loginWithCode:async e=>{let t,n;function r(e){a.authFlow instanceof sa?V(e):a.authFlow instanceof Ii&&j(e)}if(r({status:"submitting-code"}),!m){let e=new Wt;throw r({status:"error",error:e}),e}if(a.authFlow instanceof sa)a.authFlow.meta.emailCode=e.trim();else{if(!(a.authFlow instanceof Ii)){let e=new he("Must initialize a passwordless code flow first");throw r({status:"error",error:e}),e}a.authFlow.meta.smsCode=e.trim()}let i=await QA();if("link"===ve.current)try{({user:t}=await a.link())}catch(e){throw r({status:"error",error:e}),nl(me,"linkAccount","onError",e.privyErrorCode||Te.FAILED_TO_LINK_ACCOUNT,{linkMethod:we.current}),e}else if("update"===ve.current)try{({user:t}=await a.link())}catch(e){throw r({status:"error",error:e}),nl(me,"update","onError",e.privyErrorCode||Te.FAILED_TO_UPDATE_ACCOUNT,{linkMethod:we.current}),e}else try{({user:t,isNewUser:n}=await a.authenticate())}catch(e){throw r({status:"error",error:e}),nl(me,"login","onError",e.privyErrorCode||Te.UNKNOWN_AUTH_ERROR),e}let o=t||A;T(o||null),P(n||!1),f(!0),r({status:"done"});let s=null;return a.authFlow instanceof sa?s=o?.linkedAccounts.find((({type:e})=>"email"===e))||null:a.authFlow instanceof Ii&&(s=o?.linkedAccounts.find((({type:e})=>"phone"===e))||null),{user:o,isNewUser:n||!1,wasAlreadyAuthenticated:!!i,linkedAccount:s}},generateSiweMessage:async({address:e,chainId:t,captchaToken:n})=>{ve.current=y?"link":"login",we.current="siwe",K({status:"generating-message"});let r=await a.generateSiweNonce({address:e,captchaToken:n});return K({status:"awaiting-signature"}),bi({address:e,chainId:t.replace("eip155:",""),nonce:r})},generateSiweMessageForSmartWallet:async({address:e,chainId:t})=>{let n=await a.generateSiweNonce({address:e});return bi({address:e,chainId:t.replace("eip155:",""),nonce:n})},linkSmartWallet:async({message:e,signature:t,smartWalletType:n,smartWalletVersion:r})=>{let i;i=await a.linkSmartWallet({message:e,signature:t,smartWalletType:n,smartWalletVersion:r}),T((i=await qe.refreshSessionAndUser()??i)||A||null)},loginWithSiwe:async({message:e,signature:t,captchaToken:n,disableSignup:r})=>{let i,o=null;try{if(A)throw Error("User already authenticated");let s=new ki(a,void 0,n,r,{message:e,signature:t});a.startAuthFlow(s),we.current="siwe",ve.current="login",K({status:"submitting-signature"});let l=await a.authenticate();if(({user:o,isNewUser:i}=l),!o)throw Error("Authentication failed - no user returned")}catch(e){throw nl(me,"login","onError",e.privyErrorCode||Te.UNKNOWN_AUTH_ERROR),K({status:"error",error:e}),e}return T(o),P(i||!1),f(!0),K({status:"done"}),ve.current=null,we.current=null,o},linkWithSiwe:async({message:e,signature:t,chainId:n,walletClientType:r,connectorType:i})=>{let o;Pe("siwe");let s=null;try{K({status:"submitting-signature"}),o=await a.linkWithSiwe({message:e,signature:t,chainId:n,walletClientType:r,connectorType:i}),o=await qe.refreshSessionAndUser()??o,K({status:"done"}),(s=ze(o)||null)&&nl(me,"linkAccount","onSuccess",{user:o,linkMethod:"siwe",linkedAccount:s})}catch(e){throw nl(me,"linkAccount","onError",e.privyErrorCode||Te.FAILED_TO_LINK_ACCOUNT,{linkMethod:"siwe"}),ve.current=null,we.current=null,K({status:"error",error:e}),e}let l=o||A;return T(l||null),ve.current=null,we.current=null,{user:l,linkedAccount:s}},refreshSessionAndUser:async()=>{let e=await a.getAuthenticatedUser();return f(!!e),T(e),e},walletProxy:X,createAnalyticsEvent:({eventName:e,payload:t,timestamp:n})=>a.createAnalyticsEvent({eventName:e,payload:t,timestamp:n}),acceptTerms:async()=>{let e=await a.acceptTerms();return T(e),e},getUsdTokenPrice:e=>a.getUsdTokenPrice(e),getUsdPriceForSol:()=>a.getUsdPriceForSol(),getSplTokenMetadata:e=>a.getSplTokenMetadata(e),recoverEmbeddedWallet:async e=>new Promise((async(t,n)=>{if(!A)return void t(!0);let r=e?.address?dn(A,e.address):nn(A)||pn(A)||un(A);if(!r||rn(r))return void t(!0);let i=await QA();if(!i||!X||!r)return void n(Error("Must have valid access token and Privy wallet to recover wallet"));let{entropyId:o,entropyIdVerifier:s}=ro(A,r);try{await X.connect({accessToken:i,entropyId:o,entropyIdVerifier:s}),t(!0)}catch(e){if(Bu(e)&&"privy"===r.recoveryMethod){let e;a.createAnalyticsEvent({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:r.address}});try{e=await X.recover({entropyId:o,entropyIdVerifier:s,accessToken:i})}catch(e){return void n(e)}e.entropyId||n(Error("Unable to recover wallet")),a.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:r.address}}),t(!0)}else Bu(e)&&"privy"!==r.recoveryMethod&&"privy-v2"!==r.recoveryMethod?(re({recoverWallet:{entropyId:o,entropyIdVerifier:s,onFailure:n,onSuccess:()=>t(!0)},recoveryOAuthStatus:{provider:r.recoveryMethod,action:"recover",shouldCreateEth:!1,shouldCreateSol:!1}}),ke(Sw(r.recoveryMethod))):n(e)}})),exportSolanaWallet:e=>new Promise((async(t,r)=>{if(!y||!A)return void r(Error("User must be authenticated before exporting their Privy wallet"));let i=e?.address?dn(A,e.address):ln(A);if(!i)return void r(new he("User must have an embedded wallet."));let{entropyId:o,entropyIdVerifier:s}=ro(A,i),l=rn(i);if(!await QA()||!X)return void r(Error("Must have valid access token to enroll in MFA"));if(!X)return void r(Error("Must have a Privy wallet before exporting"));let c={recoveryMethod:i.recoveryMethod,connectingWalletAddress:i.address,isUnifiedWallet:l,entropyId:o,entropyIdVerifier:s,onCompleteNavigateTo:YC,onFailure:r,shouldForceMFA:!0};Ip(i)?(re({connectWallet:c,keyExport:{appId:n.appId,appClientId:n.clientId,origin:a.apiUrl,address:i.address,entropyId:o,entropyIdVerifier:s,hdWalletIndex:i.walletIndex,chainType:i.chainType,walletId:i.id,isUnifiedWallet:l,imported:i.imported,onSuccess:t,onFailure:r}}),ke(eb)):r(Error(`Export is not supported for ${i.chainType} wallets`))})),setReadyToTrue:e=>{g(!0),ae?.(e)},updateWallets:()=>Oe(),fundWallet:async(e,t)=>{re({funding:DC({address:e,appConfig:ee,fundWalletConfig:t,methodScreen:PC})}),ke(PC)},openModal:ke,requestFarcasterSignerStatus:async e=>{let t=await QA(),n=A?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!t)throw Error("Must have valid access token to connect with Farcaster");if(!X||!n)throw Error("Must have an embedded wallet to use Farcaster signers");if(!A?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");let r=await a.requestFarcasterSignerStatus(e);return"approved"===r.status&&T(await a.getAuthenticatedUser()||A||null),r},connectCoinbaseSmartWallet:async()=>{ee.externalWallets.coinbaseWallet.config.preference={...ee.externalWallets.coinbaseWallet.config.preference,options:"smartWalletOnly"};let e=a.connectors?.findWalletConnector("coinbase_wallet","coinbase_smart_wallet")||a.connectors?.findWalletConnector("coinbase_wallet","coinbase_wallet");if(e)return e.updateConnectionPreference("smartWalletOnly"),_e(e);await Se("coinbase_wallet","coinbase_smart_wallet")},connectBaseAccount:async()=>{let e=a.connectors?.findWalletConnector("base_account","base_account");if(e)return _e(e);await Se("base_account","base_account")},initiateAccountTransfer:async({nonce:e,account:t,accountType:n,externalWalletMetadata:r,telegramAuthResult:i,telegramWebAppData:o,farcasterEmbeddedAddress:s,oAuthUserInfo:l})=>{let c=await a.sendAccountTransferRequest({nonce:e,account:t,accountType:n,externalWalletMetadata:r,telegramAuthResult:i,telegramWebAppData:o,farcasterEmbeddedAddress:s,oAuthUserInfo:l});return T(c),c},inProgressAuthFlowRef:ve,inProgressLoginOrLinkMethodRef:we};GA=qe.recoverEmbeddedWallet,ZA=qe.recoverEmbeddedWallet;let Ke=s((()=>({wallets:x,ready:se&&ye})),[x,se,ye]),Ge=a.authFlow instanceof Yi,Ze=!ee.headless&&ee.captchaEnabled&&!y&&(m||Ge);/*#__PURE__*/return t(HA.Provider,{value:!0,children:/*#__PURE__*/t(sn.Provider,{value:je,children:/*#__PURE__*/t(Js.Provider,{value:me,children:/*#__PURE__*/t(Cu.Provider,{value:Ke,children:/*#__PURE__*/t(Gi,{...ee,children:/*#__PURE__*/e(Ot.Provider,{value:qe,children:[/*#__PURE__*/t(nm,{children:/*#__PURE__*/e(xs,{data:ne,setModalData:re,setInitialScreen:F,initialScreen:U,authenticated:y,open:p,children:[n.children,/*#__PURE__*/t(zA,{customAuth:ee.customAuth}),Ze&&/*#__PURE__*/t(Ys,{delayedExecution:!1}),/*#__PURE__*/t(yp,{}),/*#__PURE__*/t(Lk,{disabled:ee.embeddedWallets.disableAutomaticMigration}),/*#__PURE__*/t(Qu,{palette:ee.appearance.palette||{}}),!ee.render.standalone&&/*#__PURE__*/t(lp,{open:p})]})}),/*#__PURE__*/t(xp,{appId:n.appId,appClientId:n.clientId,clientAnalyticsId:a.clientAnalyticsId,origin:a.apiUrl,mfaMethods:A?.mfaMethods,mfaPromise:ue,mfaSubmitPromise:pe,onLoad:J,onLoadFailed:()=>null}),ee.loginConfig.telegramAuthConfiguration&&
|
|
31
|
+
/*#__PURE__*/t(hl,{$if:!0,children:/*#__PURE__*/t(up,{scriptHost:n.apiUrl||ba,botUsername:ee.loginConfig.telegramAuthConfiguration.botName})})]})})})})})})};export{bo as $,Ac as A,Nc as B,Ki as C,ym as D,EA as E,bu as F,Rs as G,Wi as H,Dc as I,Ls as J,BA as K,xl as L,Ku as M,RA as N,ji as O,Ml as P,Ep as Q,Sp as R,xc as S,eo as T,la as U,aT as V,$a as W,YA as X,Ys as Y,Ns as Z,yo as _,ro as a,sd as a$,Gu as a0,cA as a1,Hu as a2,Vu as a3,zu as a4,xa as a5,Gs as a6,zs as a7,Dk as a8,al as a9,Sg as aA,yv as aB,Eg as aC,pp as aD,cv as aE,Tg as aF,Tw as aG,xg as aH,Aw as aI,_g as aJ,Og as aK,Lg as aL,Hg as aM,Fg as aN,Ng as aO,Rg as aP,Ug as aQ,Go as aR,Kw as aS,uv as aT,hv as aU,od as aV,td as aW,Jc as aX,Ai as aY,Ko as aZ,vu as a_,ev as aa,ok as ab,tv as ac,lp as ad,Ok as ae,vg as af,ui as ag,ag as ah,Ui as ai,om as aj,Hw as ak,zw as al,Zc as am,Qs as an,vl as ao,El as ap,Wg as aq,mo as ar,Pg as as,Qo as at,Mp as au,mC as av,$w as aw,sv as ax,xA as ay,dv as az,Fa as b,Wm as b0,Ta as b1,Pk as b2,$d as b3,Bd as b4,Hp as b5,jd as b6,Ld as b7,Vf as b8,Vw as b9,Wk as bA,Ql as ba,ud as bb,nd as bc,ed as bd,rd as be,ad as bf,id as bg,dd as bh,cd as bi,wu as bj,gd as bk,Mm as bl,Lb as bm,Cb as bn,pb as bo,PC as bp,ek as bq,eb as br,BC as bs,ey as bt,ny as bu,Bb as bv,zb as bw,ik as bx,qw as by,sC as bz,Zi as c,As as d,wi as e,vi as f,QA as g,nv as h,Is as i,Yu as j,Rk as k,$l as l,dA as m,Ic as n,bl as o,Ti as p,Tc as q,yA as r,ua as s,Os as t,tl as u,pA as v,ks as w,rl as x,Jw as y,mm as z};
|