@privy-io/react-auth 2.19.1 → 2.19.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{createStore as a}from"mipd";import r,{useRef as i,useState as o,useMemo as s,useContext as l,createContext as c,useEffect as d,useCallback as h,useReducer as p,forwardRef as u}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 T,{ProviderErrors as x,DEFAULT_SUPPORTED_CHAIN_IDS as A,rpc as I,dedupeSupportedChains as _,DEFAULT_SUPPORTED_CHAINS as S,mainnet as E,addToDefaultChains as N,create as M,countryCodesAndNumbers as P,validatePhoneNumber as W,phoneNumberTypingFormatter as U,getPlaceholderPhoneNumber as O,getCountryCallingCode as L,getPhoneCountryCodeAndNumber as R,formatPhoneNumber as F,toObjectKeys as D,arbitrum as B,avalanche as z,base as $,celo as j,linea as V,optimism as H,polygon as q,zora as K,SolanaUsdcAddressMap as Z,UsdcAddressMap as Y,formatWalletAddress as G,getCoinbaseOnRampUrl as J,chainToMoonpayCurrency as Q,isSupportedChainIdForMoonpay as X,isSupportedChainIdForCoinbaseOnramp as ee,sepolia as te,optimismSepolia as ne,polygonAmoy as ae,baseSepolia as re,avalancheFuji as ie,arbitrumSepolia as oe,formatTokenAmount as se,SolanaClient as le,formatWeiAmount as ce,getJsonRpcEndpointFromChain as de,lastFourDigits as he}from"@privy-io/js-sdk-core";import{P as pe,p as ue,f as me,b as ge,c as ye,u as fe,d as we,e as ve,g as Ce,h as be,o as ke,a as Te,i as xe,j as Ae,k as Ie,l as _e,m as Se,n as Ee,q as Ne,r as Me,s as Pe,t as We,v as Ue,w as Oe,x as Le,y as Re,z as Fe,A as De,B as Be,C as ze,D as $e,E as je,F as Ve,G as He,H as qe,I as Ke,J as Ze,K as Ye,L as Ge,M as Je,N as Qe,O as Xe,Q as et,R as tt,S as nt,T as at,U as rt,V as it,W as ot,X as st,Y as lt,Z as ct,_ as dt,$ as ht,a0 as pt,a1 as ut,a2 as mt,a3 as gt,a4 as yt,a5 as ft,a6 as wt,a7 as vt,a8 as Ct,a9 as bt,aa as kt,ab as Tt,ac as xt,ad as At,ae as It,af as _t,ag as St,ah as Et,ai as Nt,aj as Mt}from"./paths-DCwuPDUk.mjs";import{a as Pt,n as Wt,u as Ut,I as Ot}from"./internal-context-qdNgTV5f.mjs";import{createPublicClient as Lt,http as Rt,formatEther as Ft,formatUnits as Dt,toHex as Bt,isHex as zt,getAddress as $t,parseEther as jt,createWalletClient as Vt,custom as Ht,publicActions as qt,encodeFunctionData as Kt,isAddress as Zt,hexToString as Yt,decodeFunctionData as Gt,decodeAbiParameters as Jt}from"viem";import{v4 as Qt}from"uuid";import*as Xt from"jose";import{base64url as en}from"jose";import{h as tn,c as nn,i as an,u as rn,P as on,j as sn,g as ln,b as cn,e as dn,k as hn,a as pn,d as un,l as mn,m as gn}from"./use-sign-with-user-signer-DnNPDfxp.mjs";import yn from"eventemitter3";import{createCoinbaseWalletSDK as fn}from"@coinbase/wallet-sdk";import{toViemTransactionSerializable as wn,STRING_TO_NUMBER_TXN_TYPE as vn}from"@privy-io/ethereum";import{Turnstile as Cn}from"@marsidev/react-turnstile";import{styled as bn,css as kn,createGlobalStyle as Tn,keyframes as xn}from"styled-components";import An from"tinycolor2";import In from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import _n from"@heroicons/react/24/outline/FingerPrintIcon";import Sn from"@heroicons/react/24/outline/PhoneIcon";import En from"@heroicons/react/24/outline/ShieldCheckIcon";import Nn from"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import Mn from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import Pn from"@heroicons/react/24/outline/XMarkIcon";import Wn from"@heroicons/react/24/outline/CalendarIcon";import Un 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 Fn,TransitionChild as Dn,DialogPanel as Bn,Menu as zn,MenuButton as $n,MenuItems as jn,MenuItem as Vn}from"@headlessui/react";import Hn from"@heroicons/react/24/outline/CheckIcon";import qn from"@heroicons/react/24/outline/Square2StackIcon";import{EthereumProvider as Kn,OPTIONAL_EVENTS as Zn,OPTIONAL_METHODS as Yn}from"@walletconnect/ethereum-provider";import Gn from"fast-password-entropy";import*as Jn from"secure-password-utilities";import{DEFAULT_WORDLIST as Qn}from"secure-password-utilities/wordlists";import Xn from"@heroicons/react/24/outline/UserCircleIcon";import ea from"@heroicons/react/24/outline/EnvelopeIcon";import ta from"@heroicons/react/20/solid/CheckIcon";import na from"@heroicons/react/24/outline/WalletIcon";import aa from"@heroicons/react/24/outline/ExclamationCircleIcon";import ra from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import ia from"@heroicons/react/24/solid/DocumentCheckIcon";import oa from"@heroicons/react/24/solid/XCircleIcon";import sa from"@heroicons/react/24/solid/CheckCircleIcon";import{MagnifyingGlassIcon as la,ChevronDownIcon as ca,ArrowRightIcon as da}from"@heroicons/react/24/outline";import{useVirtualizer as ha}from"@tanstack/react-virtual";import pa from"qrcode";import ua from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import ma from"@heroicons/react/24/outline/ChevronRightIcon";import ga from"@heroicons/react/24/outline/LockClosedIcon";import ya from"@heroicons/react/24/outline/PencilSquareIcon";import fa from"@heroicons/react/24/outline/ArrowPathIcon";import wa from"@heroicons/react/24/outline/EyeIcon";import va from"@heroicons/react/24/outline/EyeSlashIcon";import Ca from"@heroicons/react/24/outline/KeyIcon";import ba from"@heroicons/react/24/outline/ArrowDownTrayIcon";import ka from"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import Ta from"@heroicons/react/24/outline/DocumentDuplicateIcon";import xa from"@heroicons/react/24/solid/LockClosedIcon";import Aa from"@heroicons/react/24/outline/CheckCircleIcon";import Ia from"@heroicons/react/24/outline/InformationCircleIcon";import _a from"@heroicons/react/24/outline/CreditCardIcon";import Sa from"@heroicons/react/24/outline/QrCodeIcon";import Ea from"@heroicons/react/24/outline/GlobeAltIcon";import{ofetch as Na}from"ofetch";import Ma from"@heroicons/react/24/outline/ClipboardDocumentIcon";import Pa from"@heroicons/react/24/outline/CloudArrowUpIcon";import Wa from"@heroicons/react/24/outline/NoSymbolIcon";import Ua from"@heroicons/react/24/outline/ClockIcon";import Oa from"@heroicons/react/24/outline/TrashIcon";import La from"@heroicons/react/24/solid/CheckBadgeIcon";import Ra from"@heroicons/react/24/solid/IdentificationIcon";import Fa from"@heroicons/react/24/outline/MinusCircleIcon";import Da from"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import Ba from"@heroicons/react/24/solid/ShieldCheckIcon";import za from"js-cookie";function $a(e){return e?{"privy-ui":"t"}:void 0}class ja{async authenticate(){if(!this.api)throw new pe("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new pe("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(ue,{email:this.meta.email,code:this.meta.emailCode,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw me(e)}}async link(){if(!this.api)throw new pe("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new pe("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(ge,{email:this.meta.email,code:this.meta.emailCode})}catch(e){throw me(e)}}async sendCodeEmail({email:e,captchaToken:t,withPrivyUi:n}){if(!this.api)throw new pe("Auth flow has no API instance");if(e&&(this.meta.email=e),t&&(this.meta.captchaToken=t),!this.meta.email)throw new pe("Email must be set when initialzing authentication.");let a=$a(n);try{return await this.api.post(ye,{email:this.meta.email,token:this.meta.captchaToken},{headers:{...a}})}catch(e){throw me(e)}}constructor({email:e,captchaToken:t,disableSignup:n}){this.meta={email:e,captchaToken:t,disableSignup:n??!1}}}class Va extends ja{async link(){if(!this.api)throw new pe("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new pe("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(fe,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(e){throw me(e)}}constructor(e,t,n){super({email:t,captchaToken:n}),this.meta={email:t,captchaToken:n,oldAddress:e,disableSignup:!1}}}class Ha{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 qa(){try{let e="privy:__session_storage__test",t=new Ha;return t.put(e,"blobby"),t.del(e),!0}catch(e){return!1}}var Ka="undefined"!=typeof window&&window.localStorage?new Ha: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={}}};const Za=["c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96","4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0","225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f","1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369","c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a","ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18","bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6","74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d","afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7","f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d","84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04","0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150","38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662","9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0","c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576","8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4","e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4","f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2","138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98","47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83","7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26","8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3","031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa","2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568","dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd","2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01","b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f","0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92","719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3","942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef","8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2","07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80","8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819","bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a","cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e","94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43","2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715","14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc","576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd","49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd","19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b","5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b","d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b","50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b","9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8","6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa","41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071","14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd","a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1","971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709","18388be9ac2d02726dbac9777c96efaac06d744b2f6d580fccdd4127a6d01fd1","15c8b91ade1a4e58f3ce4e7a0dd7f42b47db0c8df7e0d84f63eb39bcb96c4e0f","541d5dcd4ede02f3afaf75bf8e3e4c4f1fb09edb5fa6c4377ebf31c2785d9adf"];function Ya(e){return{name:e.metadata?.shortName||e.name||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}let Ga="WALLETCONNECT_DEEPLINK_CHOICE";function Ja(e){return e.startsWith("http://")||e.startsWith("https://")}function Qa(e,t){if(Ja(e))return Xa(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 Xa(e,t){if(!Ja(e))return Qa(e,t);let n=e;return n.endsWith("/")||(n=`${n}/`),{redirect:`${n}wc?uri=${encodeURIComponent(t)}`,href:n}}function er(e,t){window.open(e,t,"noreferrer noopener")}class tr{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 nr{get meta(){return this._meta}async authenticate(){if(!this.api)throw new pe("Auth flow has no API instance");if(!this.meta.channelToken)throw new pe("Auth flow must be initialized first");try{let e=await this.api.post(we,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});if(!e)throw new pe("No response from authentication");return e}catch(e){throw me(e)}}async link(){if(!this.api)throw new pe("Auth flow has no API instance");try{return await this.api.post(ve,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(e){throw me(e)}}async _startChannelOnce(){if(!this.api)throw new pe("Auth flow has no API instance");let e=await this.api.post(Ce,{token:this.captchaToken});g&&!y&&e.connect_uri&&er(e.connect_uri,"_blank"),this._meta={...this._meta,connectUri:e.connect_uri,channelToken:e.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new pe("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new pe("Auth flow has no API instance");if(!this.meta.channelToken)throw new pe("Auth flow must be initialized first");let e=await this.api.get(be,{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 tr(this._startChannelOnce.bind(this)),this.pollForReady=new tr(this._pollForReady.bind(this)),this._meta.disableSignup=t}}const ar="https://auth.privy.io",rr=1400,ir=2500,or=4e3,sr="2.19.1",lr="privy:token",cr="privy-token",dr="privy:refresh_token",hr="privy:pat",pr="privy:id_token",ur="privy-id-token",mr="privy-session",gr="privy:caid",yr=e=>`privy:guest:${e}`,fr=e=>`privy:cross-app:${e}`,wr="privy:state_code",vr="privy:code_verifier",Cr="privy:headless_oauth",br="privy:oauth_disable_signup",kr=e=>`privy:wallet:${e}`,Tr="privy:connectors",xr="privy:connections",Ar=12e4,Ir=3e4,_r="https://api.moonpay.com/v1",Sr="https://api.moonpay.com/v1",Er="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",Nr="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI";function Mr(e){return crypto.getRandomValues(new Uint8Array(e))}function Pr(){return en.encode(Mr(36))}function Wr(){return Pr()}async function Ur(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 en.encode(t)}}class Or{addCaptchaToken(e){this.meta.captchaToken=e}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new pe("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new pe("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if("undefined"===this.meta.authorizationCode)throw new pe("User denied confirmation during OAuth flow");let e=function(){let e=Ka.get(vr);if(!e)throw new pe("Authentication error.");return e}();try{let t=await this.api.post(ke,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:e,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});return Ka.del(vr),Ka.del(Cr),Ka.del(br),t}catch(e){let t=me(e);if(t.privyErrorCode)throw new pe(t.message||"Invalid code during OAuth flow.",void 0,t.privyErrorCode);if("User denied confirmation during OAuth flow"===t.message)throw new pe("Invalid code during oauth flow.",void 0,Te.OAUTH_USER_DENIED);throw new pe("Invalid code during OAuth flow.",void 0,Te.UNKNOWN_AUTH_ERROR)}}async link(){if(!this.api)throw new pe("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new pe("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if("undefined"===this.meta.authorizationCode)throw new pe("User denied confirmation during OAuth flow");let e=Ka.get(vr);if(!e)throw new pe("Authentication error.");try{let t=await this.api.post(xe,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:e});return Ka.del(vr),t}catch(e){throw me(e)}}async getAuthorizationUrl(){if(!this.api)throw new pe("Auth flow has no API instance");if(!this.meta.provider)throw new pe("Provider must be set when initializing OAuth authentication.");let e=Pr();Ka.put(vr,e);let t=Wr();Ka.put(wr,t);let n=await Ur(e);this.meta.withPrivyUi||Ka.put(Cr,!0),this.meta.disableSignup?Ka.put(br,!0):Ka.del(br);let a=$a(this.meta.withPrivyUi);try{return await this.api.post(Ae,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:n,state_code:t},{headers:{...a}})}catch(e){throw me(e)}}constructor(e){this.meta=e}}function Lr(e){return e.charAt(0).toUpperCase()+e.slice(1)}const Rr=({style:n,...a})=>/*#__PURE__*/e("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 24 24",style:{height:"24px",...n},...a,children:[/*#__PURE__*/t("path",{d:"M17.0722 11.6888C17.0471 8.90571 19.3263 7.56847 19.429 7.50274C18.1466 5.60938 16.153 5.35154 15.4417 5.3212C13.7461 5.14678 12.1306 6.32982 11.269 6.32982C10.4074 6.32982 9.08004 5.34648 7.67246 5.37429C5.82158 5.40209 4.11595 6.45874 3.16171 8.13218C1.24068 11.4942 2.6708 16.4817 4.54423 19.2143C5.46091 20.549 6.55041 22.0531 7.98554 21.9975C9.36803 21.9419 9.88905 21.095 11.5571 21.095C13.2251 21.095 13.696 21.9975 15.1537 21.9697C16.6389 21.9393 17.5806 20.6046 18.4897 19.2648C19.5392 17.7153 19.9725 16.2137 19.9975 16.1354C19.965 16.1228 17.1022 15.0155 17.0722 11.6888Z",fill:"currentColor"}),/*#__PURE__*/t("path",{d:"M14.3295 3.51373C15.0909 2.58347 15.6043 1.28921 15.4641 0C14.3671 0.0455014 13.0396 0.738135 12.2532 1.66838C11.5494 2.48994 10.9307 3.80695 11.0986 5.07089C12.3183 5.16694 13.5681 4.44145 14.3295 3.51373Z",fill:"currentColor"})]}),Fr=({style:n,...a})=>/*#__PURE__*/e("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 71 55",style:{height:"24px",...n},...a,children:[/*#__PURE__*/t("g",{clipPath:"url(#clip0)",children:/*#__PURE__*/t("path",{d:"M60.1045 4.8978C55.5792 2.8214 50.7265 1.2916 45.6527 0.41542C45.5603 0.39851 45.468 0.440769 45.4204 0.525289C44.7963 1.6353 44.105 3.0834 43.6209 4.2216C38.1637 3.4046 32.7345 3.4046 27.3892 4.2216C26.905 3.0581 26.1886 1.6353 25.5617 0.525289C25.5141 0.443589 25.4218 0.40133 25.3294 0.41542C20.2584 1.2888 15.4057 2.8186 10.8776 4.8978C10.8384 4.9147 10.8048 4.9429 10.7825 4.9795C1.57795 18.7309 -0.943561 32.1443 0.293408 45.3914C0.299005 45.4562 0.335386 45.5182 0.385761 45.5576C6.45866 50.0174 12.3413 52.7249 18.1147 54.5195C18.2071 54.5477 18.305 54.5139 18.3638 54.4378C19.7295 52.5728 20.9469 50.6063 21.9907 48.5383C22.0523 48.4172 21.9935 48.2735 21.8676 48.2256C19.9366 47.4931 18.0979 46.6 16.3292 45.5858C16.1893 45.5041 16.1781 45.304 16.3068 45.2082C16.679 44.9293 17.0513 44.6391 17.4067 44.3461C17.471 44.2926 17.5606 44.2813 17.6362 44.3151C29.2558 49.6202 41.8354 49.6202 53.3179 44.3151C53.3935 44.2785 53.4831 44.2898 53.5502 44.3433C53.9057 44.6363 54.2779 44.9293 54.6529 45.2082C54.7816 45.304 54.7732 45.5041 54.6333 45.5858C52.8646 46.6197 51.0259 47.4931 49.0921 48.2228C48.9662 48.2707 48.9102 48.4172 48.9718 48.5383C50.038 50.6034 51.2554 52.5699 52.5959 54.435C52.6519 54.5139 52.7526 54.5477 52.845 54.5195C58.6464 52.7249 64.529 50.0174 70.6019 45.5576C70.6551 45.5182 70.6887 45.459 70.6943 45.3942C72.1747 30.0791 68.2147 16.7757 60.1968 4.9823C60.1772 4.9429 60.1437 4.9147 60.1045 4.8978ZM23.7259 37.3253C20.2276 37.3253 17.3451 34.1136 17.3451 30.1693C17.3451 26.225 20.1717 23.0133 23.7259 23.0133C27.308 23.0133 30.1626 26.2532 30.1066 30.1693C30.1066 34.1136 27.28 37.3253 23.7259 37.3253ZM47.3178 37.3253C43.8196 37.3253 40.9371 34.1136 40.9371 30.1693C40.9371 26.225 43.7636 23.0133 47.3178 23.0133C50.9 23.0133 53.7545 26.2532 53.6986 30.1693C53.6986 34.1136 50.9 37.3253 47.3178 37.3253Z",fill:"#5865F2"})}),/*#__PURE__*/t("defs",{children:/*#__PURE__*/t("clipPath",{id:"clip0",children:/*#__PURE__*/t("rect",{width:"71",height:"55",fill:"white"})})})]}),Dr=({style:e,...n})=>/*#__PURE__*/t("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"24",y:"24",viewBox:"0 0 98 96",style:{height:"24px",...e},...n,children:/*#__PURE__*/t("path",{d:"M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z",fill:"currentColor"})}),Br=({style:e})=>/*#__PURE__*/t(Ea,{style:{color:"var(--privy-color-error)",...e}}),zr=({style:n,...a})=>/*#__PURE__*/e("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...n},...a,children:[/*#__PURE__*/t("path",{d:"M22.56 12.25C22.56 11.47 22.49 10.72 22.36 10H12V14.255H17.92C17.665 15.63 16.89 16.795 15.725 17.575V20.335H19.28C21.36 18.42 22.56 15.6 22.56 12.25Z",fill:"#4285F4"}),/*#__PURE__*/t("path",{d:"M12 23C14.97 23 17.46 22.015 19.28 20.335L15.725 17.575C14.74 18.235 13.48 18.625 12 18.625C9.13504 18.625 6.71004 16.69 5.84504 14.09H2.17004V16.94C3.98004 20.535 7.70004 23 12 23Z",fill:"#34A853"}),/*#__PURE__*/t("path",{d:"M5.845 14.09C5.625 13.43 5.5 12.725 5.5 12C5.5 11.275 5.625 10.57 5.845 9.91V7.06H2.17C1.4 8.59286 0.999321 10.2846 1 12C1 13.775 1.425 15.455 2.17 16.94L5.845 14.09Z",fill:"#FBBC05"}),/*#__PURE__*/t("path",{d:"M12 5.375C13.615 5.375 15.065 5.93 16.205 7.02L19.36 3.865C17.455 2.09 14.965 1 12 1C7.70004 1 3.98004 3.465 2.17004 7.06L5.84504 9.91C6.71004 7.31 9.13504 5.375 12 5.375Z",fill:"#EA4335"})]});function $r(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 jr(n){/*#__PURE__*/return t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 320 320",width:24,height:24,...n,children:/*#__PURE__*/t("g",{children:/*#__PURE__*/e("g",{children:[/*#__PURE__*/t("rect",{fill:"#06c755",width:"320",height:"320",rx:"72.14"}),/*#__PURE__*/t("path",{fill:"#fff",d:"M266.66,144.92c0-47.74-47.86-86.58-106.69-86.58S53.28,97.18,53.28,144.92c0,42.8,38,78.65,89.22,85.42,3.48.75,8.21,2.29,9.4,5.26,1.08,2.7.71,6.93.35,9.65,0,0-1.25,7.53-1.52,9.13-.47,2.7-2.15,10.55,9.24,5.76s61.44-36.18,83.82-61.95h0C259.25,181.24,266.66,164,266.66,144.92Z"}),/*#__PURE__*/t("path",{fill:"#06c755",d:"M231.16,172.49h-30a2,2,0,0,1-2-2v0h0V123.94h0v0a2,2,0,0,1,2-2h30a2,2,0,0,1,2,2v7.57a2,2,0,0,1-2,2H210.79v7.85h20.37a2,2,0,0,1,2,2V151a2,2,0,0,1-2,2H210.79v7.86h20.37a2,2,0,0,1,2,2v7.56A2,2,0,0,1,231.16,172.49Z"}),/*#__PURE__*/t("path",{fill:"#06c755",d:"M120.29,172.49a2,2,0,0,0,2-2v-7.56a2,2,0,0,0-2-2H99.92v-37a2,2,0,0,0-2-2H90.32a2,2,0,0,0-2,2v46.53h0v0a2,2,0,0,0,2,2h30Z"}),/*#__PURE__*/t("rect",{fill:"#06c755",x:"128.73",y:"121.85",width:"11.64",height:"50.64",rx:"2.04"}),/*#__PURE__*/t("path",{fill:"#06c755",d:"M189.84,121.85h-7.56a2,2,0,0,0-2,2v27.66l-21.3-28.77a1.2,1.2,0,0,0-.17-.21v0l-.12-.12,0,0-.11-.09-.06,0-.11-.08-.06,0-.11-.06-.07,0-.11,0-.07,0-.12,0-.08,0-.12,0h-.08l-.11,0h-7.71a2,2,0,0,0-2,2v46.56a2,2,0,0,0,2,2h7.57a2,2,0,0,0,2-2V142.81l21.33,28.8a2,2,0,0,0,.52.52h0l.12.08.06,0,.1.05.1,0,.07,0,.14,0h0a2.42,2.42,0,0,0,.54.07h7.52a2,2,0,0,0,2-2V123.89A2,2,0,0,0,189.84,121.85Z"})]})})})}function Vr({style:e,...n}){/*#__PURE__*/return t("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0,0,256,256",style:{height:"26px",width:"26px",...e},...n,children:/*#__PURE__*/t("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:/*#__PURE__*/t("g",{transform:"scale(5.12,5.12)",children:/*#__PURE__*/t("path",{d:"M41,4h-32c-2.76,0 -5,2.24 -5,5v32c0,2.76 2.24,5 5,5h32c2.76,0 5,-2.24 5,-5v-32c0,-2.76 -2.24,-5 -5,-5zM17,20v19h-6v-19zM11,14.47c0,-1.4 1.2,-2.47 3,-2.47c1.8,0 2.93,1.07 3,2.47c0,1.4 -1.12,2.53 -3,2.53c-1.8,0 -3,-1.13 -3,-2.53zM39,39h-6c0,0 0,-9.26 0,-10c0,-2 -1,-4 -3.5,-4.04h-0.08c-2.42,0 -3.42,2.06 -3.42,4.04c0,0.91 0,10 0,10h-6v-19h6v2.56c0,0 1.93,-2.56 5.81,-2.56c3.97,0 7.19,2.73 7.19,8.26z"})})})})}function Hr(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 qr(n){/*#__PURE__*/return e("svg",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 293768 333327",width:24,height:24,...n,children:[/*#__PURE__*/t("path",{fill:"#26f4ee",d:"M204958 0c5369 45832 32829 78170 77253 81022v43471l-287 27V87593c-44424-2850-69965-30183-75333-76015l-47060-1v192819c6791 86790-60835 89368-86703 56462 30342 18977 79608 6642 73766-68039V0h58365zM78515 319644c-26591-5471-50770-21358-64969-44588-34496-56437-3401-148418 96651-157884v54345l-164 27v-40773C17274 145544 7961 245185 33650 286633c9906 15984 26169 27227 44864 33011z"}),/*#__PURE__*/t("path",{fill:"#fb2c53",d:"M218434 11587c3505 29920 15609 55386 35948 70259-27522-10602-43651-34934-47791-70262l11843 3zm63489 82463c3786 804 7734 1348 11844 1611v51530c-25770 2537-48321-5946-74600-21749l4034 88251c0 28460 106 41467-15166 67648-34260 58734-95927 63376-137628 35401 54529 22502 137077-4810 136916-103049v-96320c26279 15803 48830 24286 74600 21748V94050zm-171890 37247c5390-1122 11048-1985 16998-2548v54345c-21666 3569-35427 10222-41862 22528-20267 38754 5827 69491 35017 74111-33931 5638-73721-28750-49999-74111 6434-12304 18180-18959 39846-22528v-51797zm64479-119719h1808-1808z"}),/*#__PURE__*/t("path",{d:"M206590 11578c5369 45832 30910 73164 75333 76015v51528c-25770 2539-48321-5945-74600-21748v96320c206 125717-135035 135283-173673 72939-25688-41449-16376-141089 76383-155862v52323c-21666 3569-33412 10224-39846 22528-39762 76035 98926 121273 89342-1225V11577l47060 1z",fill:"#000000"})]})}const Kr=({style:e,...n})=>/*#__PURE__*/t("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",width:"24px",...e},...n,children:/*#__PURE__*/t("path",{d:"M 14.285156 10.171875 L 23.222656 0 L 21.105469 0 L 13.34375 8.832031 L 7.148438 0 L 0 0 L 9.371094 13.355469 L 0 24.019531 L 2.117188 24.019531 L 10.308594 14.691406 L 16.851562 24.019531 L 24 24.019531 M 2.878906 1.5625 L 6.132812 1.5625 L 21.101562 22.535156 L 17.851562 22.535156",fill:"currentColor"})});let Zr={google:{name:"Google",component:zr},discord:{name:"Discord",component:Fr},github:{name:"Github",component:Dr},linkedin:{name:"LinkedIn",component:Vr},twitter:{name:"Twitter",component:Kr},spotify:{name:"Spotify",component:Hr},instagram:{name:"Instagram",component:$r},tiktok:{name:"Tiktok",component:qr},line:{name:"LINE",component:jr},apple:{name:"Apple",component:Rr}};const Yr=e=>e in Zr?Zr[e]:{name:"Unknown",component:Br};function Gr(){let e=new URLSearchParams(window.location.search),t=e.get("privy_oauth_code"),n=e.get("privy_oauth_state"),a=e.get("privy_oauth_provider");if(!t||!n||!a)return{inProgress:!1};let r=!1;try{r=!!window.opener.location.origin}catch{}return{inProgress:!0,authorizationCode:t,stateCode:n,provider:a,withPrivyUi:!Ka.get(Cr),popupFlow:null!==window.opener&&r,disableSignup:!!Ka.get(br)}}function Jr(){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"),Ka.del(wr),window.history.replaceState({},"",e)}class Qr{async initRegisterFlow(e){if(!this.api)throw new pe("Auth flow has no API instance");this.authenticateForRegistration=!0,this.meta.initRegisterResponse=await this.initRegisterOnce.execute(e)}async initAuthenticationFlow(e){if(!this.api)throw new pe("Auth flow has no API instance");this.authenticateForRegistration=!1,this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute(e)}async initLinkFlow(){if(!this.api)throw new pe("Auth flow has no API instance");this.meta.initLinkResponse=await this.initLinkOnce.execute()}async register(){let e=await import("@simplewebauthn/browser");if(!this.api)throw new pe("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new pe("WebAuthn is not supported in this browser");this.meta.initRegisterResponse||(this.meta.initRegisterResponse=await this.initRegisterOnce.execute());try{let t=this.meta.initRegisterResponse.options,n=await e.startRegistration(this._transformInitLinkOptionsToCamelCase(t));return this.meta.setPasskeyAuthState?.({status:"submitting-response"}),await this.api.post(Ie,{relying_party:this.meta.initRegisterResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(n)})}catch(e){if("NotAllowedError"===e.name)throw new pe("Passkey request timed out or rejected by user.",void 0,Te.PASSKEY_NOT_ALLOWED);throw me(e)}}async authenticate(){if(this.authenticateForRegistration)return this.register();let e=await import("@simplewebauthn/browser");if(!this.api)throw new pe("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new pe("WebAuthn is not supported in this browser");this.meta.initAuthenticateResponse||(this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute());let t=this.meta.allowedCredentialsIds?.map((e=>({type:"public-key",id:e})))??this.meta.initAuthenticateResponse.options.allow_credentials;try{let n=await e.startAuthentication(this._transformInitAuthenticateOptionsToCamelCase({...this.meta.initAuthenticateResponse.options,allow_credentials:t}));return this.meta.setPasskeyAuthState?.({status:"submitting-response"}),await this.api.post(_e,{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 pe("Passkey request timed out or rejected by user.",void 0,Te.PASSKEY_NOT_ALLOWED);throw me(e)}}async link(){let e=await import("@simplewebauthn/browser");if(!this.api)throw new pe("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new pe("WebAuthn is not supported in this browser");this.meta.initLinkResponse||(this.meta.initLinkResponse=await this.initLinkOnce.execute());try{let t=this.meta.initLinkResponse.options,n=await e.startRegistration(this._transformInitLinkOptionsToCamelCase(t));return this.meta.setPasskeyAuthState?.({status:"submitting-response"}),await this.api.post(Se,{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(n)})}catch(e){if("NotAllowedError"===e.name)throw new pe("Passkey request timed out or rejected by user.",void 0,Te.PASSKEY_NOT_ALLOWED);throw me(e)}}async _initRegisterOnce(e){if(!this.api)throw new pe("Auth flow has no API instance");let t=$a(e);return await this.api.post(Ee,{token:this.meta.captchaToken},{headers:{...t}})}async _initAuthenticateOnce(e){if(!this.api)throw new pe("Auth flow has no API instance");let t=$a(e);return await this.api.post(Ne,{token:this.meta.captchaToken},{headers:{...t}})}async _initLinkOnce(){if(!this.api)throw new pe("Auth flow has no API instance");return await this.api.post(Me,{})}_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 tr(this._initRegisterOnce.bind(this)),this.initAuthenticateOnce=new tr(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new tr(this._initLinkOnce.bind(this)),this.meta={captchaToken:e,setPasskeyAuthState:t}}}const Xr=({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 ei{get meta(){return{connectorType:this.wallet?.connectorType,walletClientType:this.wallet?.walletClientType,chainId:this.wallet?.chainId,address:this.wallet?.address,disableSignup:this._meta.disableSignup}}async authenticate(){if(!this.client)throw new pe("SiweFlow has no client instance");try{if(this.preparedMessage&&this.signature)return await this.client.authenticateWithSiweInternal({message:this.preparedMessage,signature:this.signature,chainId:this.wallet?.chainId,walletClientType:this.wallet?.walletClientType,connectorType:this.wallet?.connectorType,mode:this._meta.disableSignup?"no-signup":"login-or-sign-up"});if(!this.wallet)throw new pe("SiweFlow has no wallet instance");let{message:e,signature:t}=await this.sign();return await this.client.authenticateWithSiweInternal({message:e,signature:t,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw me(e)}}async link(){if(!this.client)throw new pe("SiweFlow has no client instance");try{if(!this.wallet)throw new pe("SiweFlow has no wallet instance");let{message:e,signature:t}=await this.sign();return await this.client.linkWithSiweInternal({message:e,signature:t,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(e){throw me(e)}}async sign(){if(!this.client)throw new pe("SiweFlow has no client instance");if(await this.buildMessage(),!this.preparedMessage)throw new pe("Could not prepare SIWE message");if(!this.wallet)throw new pe("SiweFlow has no wallet instance");let e=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:e}}async _getNonceOnce(){if(!this.client)throw new pe("SiweFlow has no client instance");if(!this.wallet)throw new pe("UI SiweFlow has no wallet instance");return await this.client.generateSiweNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildMessage(){if(!this.client)throw new pe("SiweFlow has no client instance");if(!this.wallet)throw new pe("SiweFlow has no wallet instance");let e=this.wallet.address,t=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=Xr({address:e,chainId:t,nonce:this.nonce}),this.preparedMessage}constructor(e,t,n,a=!1,r){this._meta={disableSignup:!1},this.getNonceOnce=new tr(this._getNonceOnce.bind(this)),this.wallet=t,this.captchaToken=n,this.client=e,this._meta.disableSignup=a,this.preparedMessage=r?.message,this.signature=r?.signature}}const ti=(...e)=>{if("undefined"==typeof Buffer)throw new pe("Buffer is not defined.",void 0,Te.BUFFER_NOT_DEFINED);return Buffer.from(...e)},ni=({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 ai{get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType,disableSignup:this._meta.disableSignup,messageType:this._meta.messageType,address:this.wallet?.address}}set messageType(e){this._meta.messageType=e}async authenticate(){if(!this.client)throw new pe("SiwsFlow has no client instance");try{let{message:e,signature:t}=await this.sign();return await this.client.authenticateWithSiwsInternal({message:e,signature:t,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up",messageType:this.meta.messageType})}catch(e){throw me(e)}}async link(){if(!this.client)throw new pe("SiwsFlow has no client instance");try{let{message:e,signature:t}=await this.sign();return await this.client.linkWithSiwsInternal({message:e,signature:t,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType,messageType:this.meta.messageType})}catch(e){throw me(e)}}async sign(){let e,t;if(!this.client)throw new pe("SiwsFlow has no client instance");await this.buildMessage();let n="transaction"===this.meta.messageType;if(!this.preparedMessage)throw new pe("Could not prepare SIWS message");if(!n&&!this.wallet.signMessage||n&&!this.wallet.signTransaction)throw new pe("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=ti(n.signatures[0]?.signature??Buffer.from("missing signature")).toString("base64")}else e=this.preparedMessage,t=ti(await this.wallet.signMessage(ti(this.preparedMessage))).toString("base64");return{message:e,signature:t}}async _getNonceOnce(){if(!this.client)throw new pe("SiwsFlow has no client instance");return await this.client.generateSiwsNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildMessage(){if(!this.client)throw new pe("SiwsFlow has no client instance");let e=this.wallet.address;return this.nonce||(this.nonce=await this.getNonceOnce.execute()),"transaction"===this.meta.messageType&&this._siwsTransactionMethods?this.preparedMessage=this._siwsTransactionMethods.prepareSiwsTransactionWithMemo({address:e,nonce:this.nonce}):this.preparedMessage=ni({address:e,nonce:this.nonce}),this.preparedMessage}constructor(e,t,n,a=!1,r="plain",i){this._meta={disableSignup:!1,messageType:"plain"},this.getNonceOnce=new tr(this._getNonceOnce.bind(this)),this.wallet=e,this.captchaToken=n,this.client=t,this._meta.disableSignup=a,this._meta.messageType=r,this._siwsTransactionMethods=i}}class ri{async authenticate(){if(!this.api)throw new pe("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new pe("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(Pe,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw me(e)}}async link(){if(!this.api)throw new pe("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new pe("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(We,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(e){throw me(e)}}async sendSmsCode({phoneNumber:e,captchaToken:t,withPrivyUi:n}){if(!this.api)throw new pe("Auth flow has no API instance");if(e&&(this.meta.phoneNumber=e),t&&(this.meta.captchaToken=t),!this.meta.phoneNumber)throw new pe("phone nNumber must be set when initialzing authentication.");let a=$a(n);try{return await this.api.post(Ue,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken},{headers:{...a}})}catch(e){throw me(e)}}constructor({phoneNumber:e,captchaToken:t,disableSignup:n}){this.meta={phoneNumber:e,captchaToken:t,disableSignup:n??!1}}}class ii extends ri{async link(){if(!this.api)throw new pe("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode||!this.meta.oldPhoneNumber)throw new pe("Phone number, sms code, and an old phone number must be set prior to calling update.");try{return await this.api.post(Oe,{old_phone_number:this.meta.oldPhoneNumber,new_phone_number:this.meta.phoneNumber,code:this.meta.smsCode})}catch(e){throw me(e)}}constructor(e,t,n){super({phoneNumber:t,captchaToken:n}),this.meta={phoneNumber:t,captchaToken:n,oldPhoneNumber:e,disableSignup:!1}}}const oi=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,si=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||"MetaMask"!==oi(e))return!1;if(e.providers)for(let t of e.providers)if(!si(t))return!1;return!0},li=()=>{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},ci=(e,t,n,a)=>{let r=Number(e),i=t.find((e=>e.id===r));if(!i)throw new Le(`Unsupported chainId ${e}`,4901);return Lt({transport:Rt(di(i,n,a.appId)),chain:i})},di=(e,t,n)=>{let a,r=e.id,i=Number(e.id);if(e.rpcUrls.privyWalletOverride&&e.rpcUrls.privyWalletOverride.http[0])a=e.rpcUrls.privyWalletOverride.http[0];else if(t.rpcUrls&&t.rpcUrls[i])a=t.rpcUrls[i];else if(e.rpcUrls.privy?.http[0]){let t=new URL(e.rpcUrls.privy.http[0]);t.searchParams.append("privyAppId",n),a=t.toString()}else a=e.rpcUrls.public?.http[0]?e.rpcUrls.public.http[0]:e.rpcUrls.default?.http[0];if(!a)throw new Le(`No RPC url found for ${r}`);return a},hi=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,}))$/),pi=(e,t=3,n=4,a="ethereum")=>{if(!e)return"";let r="ethereum"===a?2:0;return t+n+r+3>=e.length?e:`${e.slice(0,r+t)}...${e.slice(e.length-n,e.length)}`},ui=(e,t=3,n=4)=>pi(e,t,n,"solana"),mi=e=>new Promise((t=>setTimeout(t,e)));const gi=(e,t={})=>{let n=t.delayMs||150,a=t.maxAttempts||270;return new Promise((async(r,i)=>{let o=!1,s=0;for(;!o&&s<a;){if(t.abortSignal?.aborted)return;e().then((e=>{o=!0,r(e)}),((...e)=>{o=!0,i(...e)})),s+=1,await mi(n)}o||i(Error("Exceeded max attempts before resolving function"))}))},yi=(e,t,n={},a={})=>{let r=new URL(t,e);for(let[e,t]of Object.entries(n))void 0!==t&&r.searchParams.set(e,t);let i=Object.entries(a);if(i.length>0){let e=new URLSearchParams;for(let[t,n]of i)e.append(t,n);r.hash=e.toString()}return r.href},fi=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),wi=e=>"string"==typeof e?e:"0x"+e.toString(16);async function vi({store:e,walletList:t,externalWalletConfig:n,walletChainType:a,timeout:r=3e3}){let i=!1,o=window;return new Promise((s=>{function l(){if(i)return;i=!0,window.removeEventListener("ethereum#initialized",l);let r=e.getProviders();console.debug("Detected injected providers:",r.map((e=>e.info)));let o=[];for(let e of r)t.includes("coinbase_wallet")&&"com.coinbase.wallet"===e.info.rdns||"solana-only"===a&&"app.phantom"===e.info.rdns||o.push({type:e.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:e});if("solana-only"!==a)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=oi(e);if(!r.some((e=>e.info.name===t))){if(si(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()}),r))}))}function Ci(e){return`eip155:${String(Number(e))}`}const bi=(e,t,n,a)=>{let r=Number(e),i=t.find((e=>e.id===r));if(!i)throw new Le(`Unsupported chainId ${e}`,4901);return di(i,n,a)},ki=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 Ti=e=>e?.map((e=>({signer_id:e.signerId,override_policy_ids:e.policyIds}))),xi=/*#__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 Ai extends Re{constructor(e,t,n){super(e||"Captcha failed"),this.type="Captcha",t instanceof Error&&(this.cause=t),this.privyErrorCode=n}}const Ii=({children:e,id:n,captchaSiteKey:a,captchaEnabled:r})=>{let l=i(null),[c,d]=o(),[h,p]=o(),[u,m]=o(!1),g=s((()=>r?u||c||h?!u||c||h?c&&!h?{status:"success",token:c}:h?{status:"error",error:h}:{status:"ready"}:{status:"loading"}:{status:"ready"}:{status:"disabled"}),[r,c,h,u]);/*#__PURE__*/return t(xi.Provider,{value:{...g,ref:l,enabled:r,siteKey:a,appId:n,setToken:d,setError:p,setExecuting:m,remove(){r&&(l.current?.remove(),m(!1),p(void 0),d(void 0))},reset(){r&&(l.current?.reset(),m(!1),p(void 0),d(void 0))},execute(){r&&(m(!0),l.current?.execute())},async waitForResult(){if(!r)return"";try{return await function(e,{interval:t=100,timeout:n=5e3}={}){return new Promise(((a,r)=>{let i,o=0,s=()=>{o>=n?r("Max attempts reached without result"):(i=e(),o+=t,null==i?setTimeout(s,t):a(i))};s()}))}((()=>l.current?.getResponse()),{interval:200,timeout:2e4})}catch(e){throw new Ai("Captcha failed",null,Te.CAPTCHA_TIMEOUT)}}},children:e})},_i=()=>l(xi);class Si{async authenticate(){if(!this.api)throw new pe("Auth flow has no API instance");try{return await this.api.post(Fe,{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 me(e)}}async link(){if(!this.api)throw new pe("Auth flow has no API instance");try{return await this.api.post(De,{telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData})}catch(e){throw me(e)}}constructor(e,t=!1){this.meta={disableSignup:!1},this.meta={captchaToken:e,disableSignup:!1},this.meta.disableSignup=t}}function Ei(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 Ai&&(t.retryable=!0,t.detail="Something went wrong. Try again."),t}function Ni(e){return Object.fromEntries(decodeURIComponent(e).split("&").map((e=>e.split("=").map(decodeURIComponent))))}function Mi(){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 Pi{static parse(e){try{return new Pi(e)}catch(e){return null}}static throwIfNotWellFormedJwt(e){return Xt.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=Xt.decodeJwt(e)}}class Wi extends Pi{static parse(e){try{return new Wi(e)}catch(e){return null}}get appId(){return this._decoded.aid?this._decoded.aid:this.audience}}let Ui=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 Oi=(e,t)=>{if(t?.imported)return Ui(t);let n=tn(e);if(!n)throw Error("Failed to find primary wallet");return Ui(n)},Li=({style:n,...a})=>/*#__PURE__*/e("svg",{viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...n},...a,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"})]}),Ri="data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PScwIDAgMTAyNCAxMDI0JyBmaWxsPSdub25lJyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHN0eWxlPSdoZWlnaHQ6MjhweDt3aWR0aDoyOHB4Jz48cmVjdCB3aWR0aD0nMTAyNCcgaGVpZ2h0PScxMDI0JyBmaWxsPScjMDA1MkZGJyByeD0nMTAwJyByeT0nMTAwJz48L3JlY3Q+PHBhdGggZmlsbC1ydWxlPSdldmVub2RkJyBjbGlwLXJ1bGU9J2V2ZW5vZGQnIGQ9J00xNTIgNTEyQzE1MiA3MTAuODIzIDMxMy4xNzcgODcyIDUxMiA4NzJDNzEwLjgyMyA4NzIgODcyIDcxMC44MjMgODcyIDUxMkM4NzIgMzEzLjE3NyA3MTAuODIzIDE1MiA1MTIgMTUyQzMxMy4xNzcgMTUyIDE1MiAzMTMuMTc3IDE1MiA1MTJaTTQyMCAzOTZDNDA2Ljc0NSAzOTYgMzk2IDQwNi43NDUgMzk2IDQyMFY2MDRDMzk2IDYxNy4yNTUgNDA2Ljc0NSA2MjggNDIwIDYyOEg2MDRDNjE3LjI1NSA2MjggNjI4IDYxNy4yNTUgNjI4IDYwNFY0MjBDNjI4IDQwNi43NDUgNjE3LjI1NSAzOTYgNjA0IDM5Nkg0MjBaJyBmaWxsPSd3aGl0ZSc+PC9wYXRoPjwvc3ZnPg==";class Fi extends Le{constructor(){super("Wallet timeout"),this.type="wallet_error"}}class Di extends Le{constructor(){super("User rejected connection"),this.type="wallet_error"}}const Bi=e=>e instanceof Le?e:e?.code?new $i(e):new Le("Unknown connector error",e);class zi extends Re{constructor(e,t,n){super(e),this.type="provider_error",this.code=t,this.data=n}}class $i extends zi{constructor(e){super(e.message,e.code,e.data);let t=Object.values(x).find((t=>t.eipCode===e.code));this.details=t||x.UNKNOWN_ERROR,-32002===e.code&&(e.message?.includes("already pending for origin")?e.message?.includes("wallet_requestPermissions")?this.details=x.E32002_CONNECTION_ALREADY_PENDING:this.details=x.E32002_REQUEST_ALREADY_PENDING:e.message?.includes("Already processing")&&e.message.includes("eth_requestAccounts")&&(this.details=x.E32002_WALLET_LOCKED))}}const ji={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},...x};function Vi(e){return"ethereum"===e.type}function Hi(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let a=e[n],r=t[n];if(a?.address!==r?.address||a&&r&&Vi(a)&&Vi(r)&&a?.chainId!==r?.chainId||a?.connectorType!==r?.connectorType||a?.connectedAt!==r?.connectedAt||a?.walletClientType!==r?.walletClientType||a?.isConnected!==r?.isConnected||a?.linked!==r?.linked)return!1}return!0}class qi extends yn{constructor(e){super(),this.walletClientType=e,this.connected=!1,this.initialized=!1}}const Ki=(e,t)=>e.rpcTimeouts&&e.rpcTimeouts[t]||Ar;let Zi,Yi;function Gi(e){return"ethereum"===e.chainType}class Ji extends qi{buildConnectedWallet(e,t,n,a){let r=async()=>!!this.wallets.find((t=>v(t.address)===v(e)));return{type:"ethereum",address:v(e),chainId:t,meta:n,imported:a,switchChain:async n=>{let a,i;if(!r)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?(a=`0x${n.toString(16)}`,i=n):(a=n,i=Number(n)),o===Ci(a))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:a}]})};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 mi(300),await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:a,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:r,getEthereumProvider:async()=>{if(!await r())throw new Le("Wallet is not currently connected.");return this.proxyProvider},sign:async e=>{if(!await r())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 gi((()=>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 a=n[0],r=v(a),i=[];if("privy"===this.walletClientType){let e=Ka.get(kr(r));this.chains.find((t=>t.id===Number(e)))||(Ka.del(kr(r)),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 gi((()=>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=Ci(t);if(!i.find((e=>v(e.address)===r))){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(a),o,e,"embedded_imported"===this.connectorType))}Hi(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,a){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=Ci(e),"privy"===this.walletClientType&&Ka.put(kr(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 mi(500),this.syncAccounts())},this.wallets=[],this.walletClientType=e,this.chains=t,this.defaultChain=n,this.rpcConfig=a,this.rpcTimeoutDuration=Ki(a,e),this.connected=!1,this.initialized=!1}}class Qi{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 Bi(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 Fi,t=this.rpcTimeoutDuration)=>new Promise(((n,a)=>setTimeout((()=>{a(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||Ar,this._subscriptions=[]}}class Xi extends Ji{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:Ri,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 Bi(e)}}constructor(e,t,n,a,r){super("base_account",e,t,n),this.connectorType="base_account",this.walletClientType="base_account",this.displayName="Base Account",this.setBaseAccountSdk=r,this.proxyProvider=new Qi(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.baseAccountConfig={...a,appChainIds:[t.id].concat(e.map((e=>e.id)))},Zi?(this.proxyProvider.setWalletProvider(Zi.getProvider()),this.setBaseAccountSdk(Zi),console.log("Base Account SDK Initialized")):this.importPromise=import("@base-org/account").then((({createBaseAccountSDK:e})=>{Zi=e(this.baseAccountConfig),this.proxyProvider.setWalletProvider(Zi.getProvider()),this.setBaseAccountSdk(Zi),console.log("Base Account SDK Initialized")})).catch(console.error)}}let eo=[1,11155111,137,10,8453,84532,42161,7777777,43114,56];class to extends Ji{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:Ri,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 Bi(e)}}updateConnectionPreference(e){this.coinbaseWalletConfig={...this.coinbaseWalletConfig,preference:{...this.coinbaseWalletConfig.preference,options:e}},this.walletClientType="smartWalletOnly"===e?"coinbase_smart_wallet":"coinbase_wallet",Yi=fn({...this.coinbaseWalletConfig}),this.proxyProvider.setWalletProvider(Yi.getProvider())}constructor(e,t,n,a){if(super("coinbase_wallet",e,t,n),this.connectorType="coinbase_wallet",this.displayName="Coinbase Wallet",this.proxyProvider=new Qi(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.coinbaseWalletConfig={...a,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"),!Yi){let e="eoaOnly"!==this.coinbaseWalletConfig.preference?.options?(this.coinbaseWalletConfig.appChainIds??[]).filter((e=>!eo.includes(e))):[];e.length>0&&!e.every((e=>A.has(e)))&&console.info(`The configured chains are not supported by Coinbase Smart Wallet: ${e.join(", ")}`),Yi=fn(this.coinbaseWalletConfig)}this.proxyProvider.setWalletProvider(Yi.getProvider())}}const no=({...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 ao extends Ji{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:[wi(e?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:no,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}constructor({provider:e,chains:t,defaultChain:n,rpcConfig:a,imported:r,walletIndex:i}){super("privy",t,n,a),this.connectorType="embedded",this.proxyProvider=e,this.walletIndex=i,r&&(this.connectorType="embedded_imported"),this.subscribeListeners()}}const ro=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4","csw_signUserOperation","secp256k1_sign"];class io extends Error{constructor(e,t,n){super(e),this.code=t,this.data=n}}class oo extends yn{async handleSendTransaction(e){if(!e.params||!Array.isArray(e.params))throw new io(`Invalid params for ${e.method}`,4200);let t=e.params[0];if(!await Tk()||!this.address)throw new io("Disconnected",4900);let{hash:n}=await _k(t,{address:this.address});return n}async handleSignTransaction(e){if(!e.params||!Array.isArray(e.params))throw new io(`Invalid params for ${e.method}`,4200);let t=e.params[0];if(!await Tk()||!this.address)throw new io("Disconnected",4900);let{signature:n}=await Ik(t,{address:this.address});return n}handleSwitchEthereumChain(e){let t;if(!e.params||!Array.isArray(e.params))throw new io(`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 io(`Invalid params for ${e.method}`,4200);t=e.params[0].chainId}this.chainId=Number(t),this.publicClient=ci(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:a}=await xk({message:t},{address:n});return a}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:a}=await Ak(ki(n),{address:t});return a}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:wi(this.chainId)};return await this.publicClient.estimateGas({account:t.from??this.address,...wn(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 wi(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=>ro.includes(e))(e.method))return this.publicClient.request({method:e.method,params:e.params});{let t=await Tk();if(await Sk({address:this.address}),!t||!this.address)throw new io("Disconnected",4900);try{let n={method:e.method,params:e.params},a=this.walletAccount;return a&&nn(a)?this.handleWalletApiRequest(n,a,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 io("Disconnected",4900)}}}async handleWalletApiRequest(e,t,n){let a=this.privyClient;if(!a)throw new io("Disconnected",4900);if("secp256k1_sign"===e.method){let r=await I(a,(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"!==r.method)throw new io(`Invalid params for ${e.method}`,4200);return r.data.signature}throw new io(`Method not supported: ${e.method}`,4200)}constructor({walletProxy:e,address:t,entropyId:n,entropyIdVerifier:a,rpcConfig:r,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=a,this.chainId=s,this.rpcConfig=r,this.chains=i,this.publicClient=ci(s,this.chains,r,{appId:o}),this.rpcTimeoutDuration=Ki(r,"privy"),this.appId=o,this.walletIndex=l,this.privyClient=c,this.walletAccount=d}}class so extends Ji{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:a,defaultChain:r}){super(a,[],r,{}),this.connectorType="null",this.proxyProvider=new Qi(void 0,Ar),this.id=e,this.name=t,this.icon=n,this.connectorType=a}}const lo=({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"})}),co=({style:n,...a})=>/*#__PURE__*/e("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",x:0,y:0,viewBox:"0 0 318.6 318.6",width:"28",height:"28",style:{height:"28px",width:"28px",...n},...a,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"})]}),ho=({style:n,...a})=>/*#__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},...a,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 po(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var uo=0;class mo extends Ji{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 Bi(e)}}constructor(e,t,n,a,r){super(r||"unknown",e,t,n),this.connectorType="injected",this.proxyProvider=new Qi(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=a;let i=a.provider;this.proxyProvider.setWalletProvider(i)}}var go="__private_"+uo+++"__walletBranding";class yo extends Ji{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 po(this,go)[go]??{name:"Browser Extension",icon:lo,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 Bi(e)}}constructor(e,t,n,a,r){super(r??"unknown",e,t,n),Object.defineProperty(this,go,{writable:!0,value:void 0}),this.connectorType="injected",this.proxyProvider=new Qi(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(a),"metamask"===r?po(this,go)[go]={name:"MetaMask",icon:co,id:"io.metamask"}:"phantom"===r&&(po(this,go)[go]={name:"Phantom",icon:ho,id:"phantom"})}}class fo extends mo{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 Bi(e)}}}const wo=["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","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"],vo=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 a=bo({client:this.client,isSolana:t,connectOnly:n});return`${e?"phantom://":"https://phantom.app/ul/"}browse/${a}?ref=${a}`}},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 a=bo({client:this.client,isSolana:t,connectOnly:n});return`${e?"solflare://ul/v1/":"https://solflare.com/ul/v1/"}browse/${a}?ref=${a}`}},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 a=bo({client:this.client,isSolana:t,connectOnly:n});return`${e?"backpack://ul/v1/":"https://backpack.com/ul/v1/"}browse/${a}?ref=${a}`}},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="+bo({client:this.client,isSolana:e,connectOnly:t}))}}});function Co({connectorType:e,walletClientType:t}){for(let n of wo)if(e===n||t===n)return vo[n]}function bo({client:e,isSolana:t,connectOnly:n}){let a=new URL(window.location.href);return a.searchParams.set("privy_connector",t?"solana_adapter":"injected"),a.searchParams.set("privy_wallet_client",e),a.searchParams.set("privy_connect_only",String(n)),encodeURIComponent(a.href.replace(/\/$/g,""))}const ko=()=>{let e=Ka.get(xr);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 To=["phantom","glow","solflare","backpack","okx_wallet","walletconnect"];function xo(e){return"solana"===e.chainType}function Ao(e){return"solana"===e.type}class Io extends qi{get isInstalled(){return"Installed"===this.adapter.readyState}get wallet(){return this.adapter.wallet}buildConnectedWallet(e,t){let n,a,r,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&&(a=async(...t)=>await e.sendTransaction(t[0],t[1],t[2])),"signTransaction"in e&&(r=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:Wt(`${this.walletClientType||""} wallet does not support 'getProvider'`),signMessage:n??Wt(`${this.walletClientType||""} wallet does not support 'signMessage'`),sendTransaction:a??Wt(`${this.walletClientType||""} wallet does not support 'sendTransaction'`),signTransaction:r??Wt(`${this.walletClientType||""} wallet does not support 'signTransaction'`),signAllTransactions:i??Wt(`${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||!To.includes(this.walletClientType))&&("phantom"!==this.walletClientType||ko().some((({walletClientType:e})=>"phantom"===e)))}constructor(e,t){super(function(e){return e.name.toLowerCase().split(" ").join("_")}(e)),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 Bi(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 _o extends Io{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 Qi(void 0,Ar),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}}const So=Ln((()=>({listings:[]}))),Eo=So.setState,No=e=>{let t;try{t=new URL(e).hostname}catch(e){return}return So.getState().listings.find((({homepage:e})=>{let n;try{n=new URL(e).hostname}catch(e){return!1}return t.includes(n)}))},Mo=e=>So((({listings:t})=>t.find((({slug:t})=>Po(t)===Po(e)))));function Po(e){return"cryptocom"===e?"cryptocom-defi":"binance"===e?"binance-defi":e.replace(/[-_]wallet$/,"")}function Wo({src:e,...n}){/*#__PURE__*/return t("img",{src:e,...n,style:{display:"none"}})}const Uo={appearance:{landingHeader:"Log in or sign up",theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:"34357d3c125c2bcf2ce2bc3309d98715",externalWallets:{coinbaseWallet:{connectionOptions:"all"}},embeddedWallets:{extendedCalldataDecoding:!1},captchaEnabled:!1,_render:{standalone:!1},fundingMethodConfig:{moonpay:{useSandbox:!1}}};let Oo=new Set(["coinbase_wallet","base_account","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","universal_profile","bybit_wallet","ronin_wallet","haha_wallet","wallet_connect","detected_wallets","detected_solana_wallets","detected_ethereum_wallets","rabby_wallet","safe","solflare","backpack","binance"]),Lo=e=>Oo.has(e),Ro=(e,t,n)=>n.indexOf(e)===t;const Fo=792703809,Do="11111111111111111111111111111111";function Bo(e){return e.includes("testnet")?"testnet":e.includes("devnet")?"devnet":"mainnet-beta"}function zo(e,t){return`https://explorer.solana.com/account/${e}?cluster=${t}`}let $o="#FFFFFF";function jo(e,t){let n=Math.max(0,Math.min(1,e.toHsl().l+t));return An({...e.toHsl(),l:n})}function Vo({backgroundTheme:e,accentHex:t}){let n;switch(e){case"light":n=$o;break;case"dark":n="#1E1E1D";break;default:n=e}let a=An(n),r=An(t),i=An("#51BA81"),o=An("#FFB74D"),s=An("#EC6351"),l=function(e){return e<.8&&e>.2&&console.warn("Background color is not light or dark enough, which could lead to accessibility issues."),e>.5?"light":"dark"}(a.getLuminance()),c=jo(a,"light"===l?-.04:.11),d=jo(a,"light"===l?-.08:.16),h=jo(a,"light"===l?-.88:.87),p=jo(a,"light"===l?-.7:.75),u=jo(a,"light"===l?-.43:.45).desaturate("light"===l?60:20),m=jo(a,"light"===l?-.08:.25).desaturate("light"===l?60:20),g=jo(r,.15),y=jo(r,.25),f=jo(r,-.06),w=jo(r,-.6),v=jo(s,.3),C=jo(o,.3),b=An(r.getLuminance()>.5?"#040217":$o),k=jo(i,-.16),T=jo(i,.4);return{colorScheme:l,background:a.toHslString(),background2:c.toHslString(),background3:d.toHslString(),foreground:h.toHslString(),foreground2:p.toHslString(),foreground3:u.toHslString(),foreground4:m.toHslString(),accent:r.toHslString(),accentLight:g.toHslString(),accentLightest:y.toHslString(),accentDark:f.toHslString(),accentDarkest:w.toHslString(),foregroundAccent:b.toHslString(),success:i.toHslString(),successDark:k.toHslString(),successLight:T.toHslString(),error:s.toHslString(),errorLight:v.toHslString(),warn:o.toHslString(),warnLight:C.toHslString()}}function Ho(e,t,n,a){let r,i,o,s,l,c,d,h,p,u,m,g,y,f,w,v,C=n?console.warn:()=>{};t?.loginMethods?(r=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"),u=t.loginMethods.includes("spotify"),m=t.loginMethods.includes("instagram"),h=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")):(r=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,u=e.spotify_oauth,m=e.instagram_oauth,h=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=[r,i].filter(Boolean),k=[l,c,d,y,u,m,h,p,g,f,w,v].filter(Boolean),T=[s].filter(Boolean),x=t?.loginMethods?.includes("passkey")??!1,A=e.passkeys_for_signup_enabled??!1,I=[o&&(A||x)].filter(Boolean);if(b.length+k.length+T.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===T.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 P=(({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(Lo).filter(Ro):e?e.filter(Lo).filter(Ro):Uo.appearance.walletList)({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),W=(({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 a of e.overflow??[])t.includes(a)||n.includes(a)?console.warn(`Duplicated login method: ${a}`):n.push(a);return{primary:t,overflow:n}})({input:t?.loginMethodsAndOrder}),U=t?.intl?.defaultCountry??"US",{chains:O,defaultChain:L}=function({supportedChains:e,defaultChainFromConfig:t}){let n;if(e){if(0===e.length)throw Error("`supportedChains` must contain at least one chain");n=_(e)}else n=[...S];let a=e?n[0]:E,r=t??a;if(!n.find((e=>e.id===r.id)))throw Error("`defaultChain` must be included in `supportedChains`");return{chains:n,defaultChain:r}}({supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain}),R=!!t?.defaultChain,F=t?.customAuth?.getCustomAccessToken&&!1!==t?.customAuth?.enabled,D=t?.embeddedWallets?.requireUserPasswordOnCreate,B=t?.embeddedWallets?.createOnLogin,z=F?"all-users":e.embedded_wallet_config.ethereum.create_on_login,$=e.embedded_wallet_config.solana.create_on_login,j={"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:a}=e;j[t]={rpcUrl:n??j[t].rpcUrl,blockExplorerUrl:a??j[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 V=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,H=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??Uo.appearance.landingHeader,loginMessage:"string"==typeof t?.appearance?.loginMessage?t?.appearance?.loginMessage.slice(0,100):t?.appearance?.loginMessage,footerLogo:t?.appearance?.footerLogo,palette:Vo({backgroundTheme:t?.appearance?.theme??Uo.appearance.theme,accentHex:t?.appearance?.accentColor??e.accent_color??Uo.appearance.accentColor}),loginGroupPriority:N?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:P,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:r,sms:i,passkey:o,google:l,twitter:c,discord:d,github:y,spotify:u,instagram:m,tiktok:h,line:p,linkedin:g,apple:f,farcaster:w,telegram:v},disablePlusEmails:e.disable_plus_emails,loginMethodsAndOrder:W,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??Uo.walletConnectCloudProjectId,rpcConfig:{rpcUrls:{},rpcTimeouts:t?.externalWallets?.signatureRequestTimeouts??{}},chains:O,solanaClusters:j,defaultChain:L,intl:{defaultCountry:U},shouldEnforceDefaultChainOnConnect:R,captchaEnabled:e.captcha_enabled??Uo.captchaEnabled,captchaSiteKey:e.captcha_site_key,externalWallets:{coinbaseWallet:{config:{appName:e.name,appLogoUrl:e.logo_url,preference:{options:t?.externalWallets?.coinbaseWallet?.connectionOptions??Uo.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??(!F&&(e.embedded_wallet_config.require_user_owned_recovery_on_create??!1)),userOwnedRecoveryOptions:F?["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??$},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??a??"https://auth.privy.io"}},mfa:{methods:e.mfa_methods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},passkeys:{shouldUnlinkOnUnenrollMfa:t?.passkeys?.shouldUnlinkOnUnenrollMfa,shouldUnenrollMfaOnUnlink:t?.passkeys?.shouldUnenrollMfaOnUnlink},customAuth:F?{enabled:!0,...t.customAuth}:void 0,loginConfig:{telegramAuthConfiguration:V,passkeysForSignupEnabled:e.passkeys_for_signup_enabled},headless:!!t?.headless,render:{standalone:t?._render?.standalone??Uo._render.standalone},fundingConfig:H,fundingMethodConfig:{...t?.fundingMethodConfig??Uo.fundingMethodConfig,moonpay:{...t?.fundingMethodConfig?.moonpay??Uo.fundingMethodConfig.moonpay,useSandbox:t?.fundingMethodConfig?.moonpay.useSandbox??t?.fiatOnRamp?.useSandbox??Uo.fundingMethodConfig.moonpay.useSandbox}},whatsAppEnabled:!!e.whatsapp_enabled}}const qo={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},Ko=Ho(qo,void 0,!1);let Zo=/*#__PURE__*/c({appConfig:Ko,isServerConfigLoaded:!1});const Yo=({children:e,client:n,legacyClient:a,clientConfig:r})=>{let[i,l]=o(null),c=s((()=>Ho(i??qo,r,!!i,"undefined"!=typeof window?window.location.origin:void 0)),[i,r]);return d((()=>{if(!i)return;let e=function(e){if(!e)return{};let{appearance:t,supportedChains:n,defaultChain:a,externalWallets:r,...i}=e;return{...i,...n?{supportedChains:n.map((e=>e.id))}:void 0,...a?{defaultChain:a.id}:void 0,...r?{walletConnect:r.walletConnect?{enabled:r.walletConnect.enabled}:void 0,coinbaseWallet:r.coinbaseWallet,solana:{connectors:r.solana?.connectors?.get().map((e=>e.walletClientType))}}:void 0}}(r),t=function(e,t=0){let n=3735928559^t,a=1103547991^t;for(let t,r=0;r<e.length;r++)n=Math.imul(n^(t=e.charCodeAt(r)),2654435761),a=Math.imul(a^t,1597334677);return n=Math.imul(n^n>>>16,2246822507)^Math.imul(a^a>>>13,3266489909),4294967296*(2097151&(a=Math.imul(a^a>>>16,2246822507)^Math.imul(n^n>>>13,3266489909)))+(n>>>0)}(JSON.stringify(e)).toString(),n=`privy:sent:${i.id}:${t}`;localStorage.getItem(n)||(a.createAnalyticsEvent({eventName:"sdk_initialize",payload:e}),localStorage.setItem(n,"t"))}),[r,i]),d((()=>{i||(async()=>{try{await n.initialize();let e=n.app.getConfig();e.custom_api_url&&a.updateApiUrl(e.custom_api_url),l(e)}catch(e){console.warn("Error generating app config: ",e)}})()}),[]),/*#__PURE__*/t(Zo.Provider,{value:{appConfig:c,isServerConfigLoaded:!!i},children:e})},Go=()=>{let{appConfig:e}=l(Zo);return e},Jo=()=>{let{isServerConfigLoaded:e}=l(Zo);return e},Qo=/*#__PURE__*/c({app:Ko,currentScreen:null,lastScreen:null,navigate:Pt,navigateBack:Pt,resetNavigation:Pt,setModalData:Pt,onUserCloseViaDialogOrKeybindRef:void 0}),Xo=n=>{let a=Go(),r=n.authenticated,[s,l]=o(n.initialScreen);d((()=>{r||!n.initialScreen||n.initialScreen.isUnauthenticatedScreem||n.setInitialScreen(null)}),[r]);let c=i(null);d((()=>{n.open||(c.current=null)}),[n.open]),d((()=>{c.current=null}),[n.initialScreen]);let h={app:a,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(Qo.Provider,{value:h,children:[("string"==typeof a.appearance.logo||"img"===a.appearance.logo?.type)&&/*#__PURE__*/t(Wo,{src:"string"==typeof a.appearance.logo?a.appearance.logo:a.appearance.logo.props.src}),n.children]})},es=()=>l(Qo),ts=({style:n,...a})=>{let{app:r}=es();/*#__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},...a,children:[/*#__PURE__*/t("rect",{width:"28",height:"28",rx:"3",fill:"dark"===r?.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)"})})})]})};class ns extends Ji{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=No(this.walletProvider?.session?.peer.metadata.url),this.walletClientType=this.walletEntry?.slug||"unknown"),this.connected=!0,await this.syncAccounts()),this.initialized=!0,this.emit("initialized");let{createAppKit:t}=await import("@reown/appkit");this.modal??=t({projectId:this.walletConnectCloudProjectId,themeVariables:{"--w3m-z-index":1e6},networks:this.chains,includeWalletIds:Za,allowUnsupportedChain:!0}),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:fi(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:"string"==typeof e?e:"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",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(Ga)}catch{}}(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise(((e,t)=>{this.onQrModalClosed=()=>{t(new Di)},(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=No(this.walletProvider?.session?.peer.metadata.url),this.walletClientType=this.walletEntry?.slug||"unknown",this.proxyProvider.rpcTimeoutDuration=Ki(this.rpcConfig,this.walletClientType)),this.connected=!0,await this.syncAccounts(n),e()})().catch((e=>{t(e?Bi(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=bi(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)),a=await Kn.init({projectId:this.walletConnectCloudProjectId,chains:t,optionalChains:n,optionalEvents:Zn,optionalMethods:Yn,rpcMap:e,showQrModal:!1,metadata:{description:this.privyAppName,name:this.privyAppName,url:window.location.origin,icons:[]}});return a.on("display_uri",(e=>{if(a.signer.abortPairingAttempt(),this.walletEntry){let{redirect:t,href:n}=function(e,t){let n=Ya(t);if(n.deepLink)return Qa(n.deepLink,e);if(n.universalLink)return Xa(n.universalLink,e);throw new pe(`Unsupported wallet ${t.id}`)}(e,this.walletEntry);(function({href:e,name:t}){try{localStorage.setItem(Ga,JSON.stringify({href:e,name:t}))}catch{}})({href:n,name:this.walletEntry.metadata?.shortName||this.walletEntry.name}),this.redirectUri=t;let a=function(e,t){let n=Ya(t);if(n.universalLink)return Xa(n.universalLink,e)}(e,this.walletEntry);a?.redirect&&(this.fallbackUniversalRedirectUri=a.redirect),g?(er(t,"_self"),this.showPrivyQrModal?.({native:t,universal:this.fallbackUniversalRedirectUri})):this.showPrivyQrModal?this.showPrivyQrModal?.({native:t,universal:this.fallbackUniversalRedirectUri}):this.modal?.open({uri:e})}else this.modal?.open({uri:e})})),a.on("connect",(()=>{this.modal?.close(),a.session?.peer.metadata.url&&(this.walletEntry=No(a.session?.peer.metadata.url),this.walletClientType=this.walletEntry?.slug||"unknown")})),a}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:a,shouldEnforceDefaultChainOnConnect:r,privyAppId:i,privyAppName:o,walletClientType:s,appKit:l}){super(s||"unknown",n,a,t),this.connectorType="wallet_connect_v2",this.privyAppId=i,this.privyAppName=o,this.walletConnectCloudProjectId=e,this.rpcConfig=t,this.shouldEnforceDefaultChainOnConnect=r,this.proxyProvider=new Qi(void 0,this.rpcTimeoutDuration),this.modal=l,s&&(this.walletEntry=(e=>So.getState().listings.find((({slug:t})=>Po(t)===Po(e))))(s),this.walletClientType=s)}}class as extends yn{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(),Ka.get(Tr)&&(Ka.getKeys().forEach((e=>{e.startsWith("walletconnect")&&Ka.del(e)})),Ka.del(Tr)),this.externalWalletConfig.disableAllExternalWallets))return;let t=vi({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(vo)))!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 _o({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(Gi).find((t=>t.connectorType===e))??null:this.walletConnectors.filter(Gi).find((n=>n.connectorType===e&&n.walletClientType===t))??null}findSolanaWalletConnector(e){return this.walletConnectors.filter(xo).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:a,appId:r,privyClient:i}){let{entropyId:o,entropyIdVerifier:s}=Oi(t);for(let t of n){let n=this.findEmbeddedWalletConnectors().find((e=>e.walletIndex===t.walletIndex));if(n&&Gi(n))n.proxyProvider.walletProxy=e;else{let n=new ao({provider:new oo({walletProxy:e,address:t.address,entropyId:o,entropyIdVerifier:s,rpcConfig:this.rpcConfig,chains:this.chains,appId:r,chainId:a.id,walletIndex:t.walletIndex,privyClient:i,walletAccount:t}),chains:this.chains,defaultChain:a,rpcConfig:this.rpcConfig,imported:!1,walletIndex:t.walletIndex});this.addWalletConnector(n)}}}addImportedWalletConnector(e,t,n,a){let r=this.findWalletConnector("embedded_imported","privy");if(r&&Gi(r))r.proxyProvider.walletProxy=e;else{let r=new ao({provider:new oo({walletProxy:e,address:t,entropyId:t,entropyIdVerifier:"ethereum-address-verifier",walletIndex:0,rpcConfig:this.rpcConfig,chains:this.chains,appId:a,chainId:n.id}),chains:this.chains,walletIndex:0,defaultChain:n,rpcConfig:this.rpcConfig,imported:!0});this.addWalletConnector(r)}}removeEmbeddedWalletConnectors(){this.walletConnectors=this.walletConnectors.filter((e=>"embedded"!==e.connectorType)),this.storedConnections=ko(),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=ko(),this.emit("walletsUpdated")}}async createEthereumWalletConnector({connectorType:e,walletClientType:t,providers:n,walletConfig:a}){let r=this.findWalletConnector(e,t);if(r&&Gi(r))return r instanceof ns&&r.resetConnection(t),r;let i=(()=>"injected"!==e?"coinbase_wallet"===e?new to(this.chains,this.defaultChain,this.rpcConfig,this.externalWalletConfig.coinbaseWallet.config):"base_account"===e?new Xi(this.chains,this.defaultChain,this.rpcConfig,this.externalWalletConfig.baseAccount.config,this.setBaseAccountSdk):"null"!==e?new ns({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}):a?new so({id:a.client,name:a.name,defaultChain:this.defaultChain,walletClientType:a.client}):null:"metamask"===t&&n?.eip6963InjectedProvider?new fo(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask"):"metamask"===t&&n?.legacyInjectedProvider?new yo(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask"):"phantom"===t&&n?.legacyInjectedProvider?new yo(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom"):n?.legacyInjectedProvider&&"unknown_browser_extension"===t?new yo(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider):n?.eip6963InjectedProvider?new mo(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&&Vi(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,a,r,i,o,s,l,c,d,h,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 Qi},this.privyAppId=e,this.walletConnectCloudProjectId=t,this.rpcConfig=n,this.chains=a,this.defaultChain=r,this.walletConnectors=[],this.initialized=!1,this.store=i,this.walletList=o,this.shouldEnforceDefaultChainOnConnect=s,this.externalWalletConfig=l,this.privyAppName=c,this.walletChainType=h||"ethereum-only",this.appKit=p,this.setBaseAccountSdk=d,this.storedConnections=ko()}}let rs=[ze,$e,je];class is{async get(e,t){try{return await this.baseFetch(e,t)}catch(e){throw me(e)}}async post(e,t,n){try{return await this.baseFetch(e,{method:"POST",...t?{body:t}:{},...n})}catch(e){throw me(e)}}async delete(e,t){try{return await this.baseFetch(e,{method:"DELETE",...t})}catch(e){throw me(e)}}constructor({appId:e,appClientId:t,client:n,defaults:a}){this.appId=e,this.appClientId=t,this.clientAnalyticsId=n.clientAnalyticsId,this.sdkVersion=sr,this.client=n,this.defaults=a,this.fallbackApiUrl=n.fallbackApiUrl,this.baseFetch=Na.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 a=rs.includes(e.toString());if(!n.has("authorization")){let e=await this.client.getAccessToken({disableAutoRefresh:a});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 Be}})}}let os=/paymaster\.biconomy\.io\/api/i,ss={mode:"SPONSORED",calculateGasLimits:!0,expiryDuration:300,sponsorshipInfo:{webhookData:{},smartAccountInfo:{name:"BICONOMY",version:"2.0.0"}}};const ls=(e,t)=>e&&os.test(e)?ss:t&&t.policy_id?{policyId:t.policy_id}:void 0,cs=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 ds{async authenticate(){if(!this.api)throw new pe("Auth flow has no API instance");try{return await this.api.post(Ve,{token:this.meta.token})}catch(e){throw me(e)}}async link(){if(!this.api)throw new pe("Auth flow has no API instance");try{return await this.api.post(He,{token:this.meta.token})}catch(e){throw me(e)}}constructor(e){this.meta={token:e}}}class hs{getOrCreateGuestCredential(e){let t=yr(e);if(qa()){if(Ka.get(t))return Ka.get(t);{let e=en.encode(Mr(32));return Ka.put(t,e),e}}return en.encode(Mr(32))}async authenticate(){if(!this.api)throw new pe("Auth flow has no API instance");try{return await this.api.post(qe,{guest_credential:this.meta.guestCredential})}catch(e){throw me(e)}}async link(){throw Error("Linking is not supported for the guest flow")}constructor(e){this.meta={guestCredential:this.getOrCreateGuestCredential(e)}}}function ps(){return!(f&&window.location.origin.startsWith("http://localhost"))}const us=Ln((()=>({identityToken:null})));function ms(){let{identityToken:e}=us();return{identityToken:e}}var gs,ys=((gs={}).PRIVY="privy_access_token",gs.CUSTOMER="customer_access_token",gs);class fs{get token(){return this.privyAccessToken||this.customerAccessToken}getToken(e){return"privy_access_token"===e?this.privyAccessToken:this.customerAccessToken}get customerAccessToken(){return this._getToken(lr)}get privyAccessToken(){return this._getToken(hr)}_getToken(e){try{let t=Ka.get(e);return"string"==typeof t?Pi.throwIfNotWellFormedJwt(t):null}catch(e){return console.error(e),this.destroyLocalState(),null}}get refreshToken(){try{let e=Ka.get(dr);return"string"==typeof e?e:null}catch(e){return console.error(e),this.destroyLocalState(),null}}getProviderAccessToken(e){try{let t=Ka.get(fr(e));if("string"!=typeof t)return null;{let n=new Pi(t);return n.isExpired()?(Ka.del(fr(e)),null):n.value}}catch(e){return console.error(e),null}}get mightHaveServerCookies(){try{let e=za.get(mr);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=Pi.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?Ka.put(fr(e),t):Ka.del(fr(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:a,oauth_tokens:r}=t;this.handleTokenResponse(t);let i=r?{provider:r.provider,accessToken:r.access_token,accessTokenExpiresInSeconds:r.access_token_expires_in_seconds,refreshToken:r.refresh_token,refreshTokenExpiresInSeconds:r.refresh_token_expires_in_seconds,scopes:r.scopes}:void 0;return this._trackAuthenticateEvents(e,a),{user:an(n),isNewUser:a,oAuthTokens:i}}catch(e){throw console.warn("Error authenticating session"),Ke(e)}}_trackAuthenticateEvents(e,t){let n=function(e){return e instanceof ja?"email":e instanceof ri?"sms":e instanceof ei?"siwe":e instanceof hs?"guest":e instanceof ds?"custom_auth":e instanceof Or?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,a=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:a}}catch(e){throw console.warn("Error linking account"),Ke(e)}}async _refresh(){if(!this.api)throw new pe("Session has no API instance");if(!this.client)throw new pe("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 a={};e&&(a.authorization=`Bearer ${e}`),n=await this.api.post(ze,t?{refresh_token:t}:{},{headers:a})}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 Ke(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($e,{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=Ka.get(lr);if(Ka.put(lr,e),!this.client?.useServerCookies){let t=Pi.parse(e)?.expiration;za.set(cr,e,{sameSite:"Strict",secure:ps(),expires:t?new Date(1e3*t):void 0})}t!==e&&this.client?.onStoreCustomerAccessToken?.(e)}else Ka.del(lr),za.remove(cr),this.client?.onDeleteCustomerAccessToken?.()}storeRefreshToken(e){"string"==typeof e?(Ka.put(dr,e),this.client?.useServerCookies||za.set(mr,"t",{sameSite:"Strict",secure:ps(),expires:30})):(Ka.del(dr),za.remove("privy-refresh-token"),za.remove(mr))}storePrivyAccessToken(e){"string"==typeof e?Ka.put(hr,e):Ka.del(hr)}storeIdentityToken(e){if(us.setState({identityToken:e}),this.client?.useServerCookies)return;Ka.put(pr,e);let t=Pi.parse(e)?.expiration;za.set(ur,e,{sameSite:"Strict",secure:ps(),expires:t?new Date(1e3*t):void 0})}clearIdentityToken(){Ka.del(pr),us.setState({identityToken:null}),za.remove(ur)}constructor(){this.authenticateOnce=new tr((async e=>this._authenticate(e))),this.linkOnce=new tr((async e=>this._link(e))),this.refreshOnce=new tr(this._refresh.bind(this)),this.destroyOnce=new tr(this._destroy.bind(this))}}let ws;var vs=0,Cs="__private_"+vs+++"__getOrGenerateClientAnalyticsId";class bs{getAppId(){return this.appId}initializeConnectorManager({walletConnectCloudProjectId:e,rpcConfig:t,chains:n,defaultChain:a,store:r,walletList:i,shouldEnforceDefaultChainOnConnect:o,externalWalletConfig:s,appName:l,walletChainType:c,setBaseAccountSdk:d,appKit:h}){this.connectors||(this.connectors=new as(this.appId,e,t,n,a,r,i,o,s,l,d,c,h))}generateApi(){let e=new is({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 pe("No auth flow in progress.");return this.session.authenticate(this.authFlow)}async link(){if(!this.authFlow)throw new pe("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 me(e)}}async initMfaPasskeyVerification(){try{let e=await this.api.post(Ge,{});return cs(e.options)}catch(e){throw me(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(Je,{});return an(e)}catch(e){throw Ke(e)}}async unlinkEmail(e){try{let t=await this.api.post(Qe,{address:e});return await this.getAuthenticatedUser()??an(t)}catch(e){throw Ke(e)}}async unlinkPhone(e){try{let t=await this.api.post(Xe,{phoneNumber:e});return await this.getAuthenticatedUser()??an(t)}catch(e){throw Ke(e)}}async unlinkEthereumWallet(e){try{let t=await this.api.post(et,{address:e});return await this.getAuthenticatedUser()??an(t)}catch(e){throw Ke(e)}}async unlinkSolanaWallet(e){try{let t=await this.api.post(tt,{address:e});return await this.getAuthenticatedUser()??an(t)}catch(e){throw Ke(e)}}async unlinkOAuth(e,t){try{let n=await this.api.post(nt,{provider:e,subject:t});return await this.getAuthenticatedUser()??an(n)}catch(e){throw Ke(e)}}async unlinkFarcaster(e){try{let t=await this.api.post(at,{fid:e});return await this.getAuthenticatedUser()??an(t)}catch(e){throw Ke(e)}}async unlinkTelegram(e){try{let t=await this.api.post(rt,{telegram_user_id:e});return await this.getAuthenticatedUser()??an(t)}catch(e){throw Ke(e)}}async revokeDelegatedWallet(){try{await this.api.post(it,{})}catch(e){throw Ke(e)}}async createAnalyticsEvent({eventName:e,payload:t,timestamp:n,options:a}){if("undefined"!=typeof window)try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(je,{event_name:e,client_id:this.clientAnalyticsId,payload:{...t||{},clientTimestamp:n?n.toISOString():(new Date).toISOString()}},{retry:-1,keepalive:a?.keepAlive??!1})}catch(e){console.log("Unable to submit event. This is not an issue.")}}async signMoonpayOnRampUrl(e){try{return this.api.post(ot,e)}catch(e){throw Ke(e)}}async initCoinbaseOnRamp(e){try{return this.api.post(st,e)}catch(e){throw Ke(e)}}async getCoinbaseOnRampStatus({partnerUserId:e}){try{return this.api.get(`${lt}?partnerUserId=${e}`)}catch(e){throw Ke(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(ys.CUSTOMER,e)}async getPrivyAccessToken(e){return await this._getToken(ys.PRIVY,e)}async _getToken(e,t){return this.session.getToken(e)?this.session.hasActiveAccessToken(e)?this.session.hasRefreshCredentials(e)?Wi.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,smartWalletType:n.smart_wallet_type,configuredNetworks:n.configured_networks.map((e=>({chainId:e.chain_id,bundlerUrl:e.bundler_url,paymasterUrl:e.paymaster_url,paymasterContext:ls(e.paymaster_url,e.paymaster_context)})))}:{enabled:n.enabled}}catch(e){throw Ke(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(ct,{address:e,token:t})).nonce}catch(e){throw Ke(e)}}async authenticateWithSiweInternal({message:e,signature:t,chainId:n,walletClientType:a,connectorType:r,mode:i}){return await this.api.post(dt,{message:e,signature:t,chainId:n,walletClientType:a,connectorType:r,mode:i})}async linkWithSiweInternal({message:e,signature:t,chainId:n,walletClientType:a,connectorType:r}){return await this.api.post(ht,{message:e,signature:t,chainId:n,walletClientType:a,connectorType:r})}async linkSmartWallet({message:e,signature:t,smartWalletType:n}){try{let a=await this.api.post(pt,{message:e,signature:t,smart_wallet_type:n});return an(a)}catch(e){throw Ke(e)}}async linkWithSiwe({message:e,signature:t,chainId:n,walletClientType:a,connectorType:r}){try{let i=await this.linkWithSiweInternal({message:e,signature:t,chainId:n,walletClientType:a,connectorType:r});return an(i)}catch(e){throw Ke(e)}}async generateSiwsNonce({address:e,captchaToken:t}){try{return(await this.api.post(ut,{address:e,token:t})).nonce}catch(e){throw Ke(e)}}async authenticateWithSiwsInternal({message:e,signature:t,walletClientType:n,connectorType:a,mode:r,messageType:i="plain"}){return await this.api.post(mt,{message:e,signature:t,walletClientType:n,connectorType:a,mode:r,message_type:i})}async sendAccountTransferRequest({nonce:e,account:t,accountType:n,externalWalletMetadata:a,telegramAuthResult:r,telegramWebAppData:i,farcasterEmbeddedAddress:o,oAuthUserInfo:s}){try{let l,c;switch(n){case"email":l=bt,c={nonce:e,email:t};break;case"sms":l=Ct,c={nonce:e,phoneNumber:t};break;case"siwe":if(l=vt,!a)throw Error("Wallet parameters must be defined");c={nonce:e,address:t,...a};break;case"farcaster":l=wt,c={nonce:e,farcaster_id:t,farcaster_embedded_address:o};break;case"telegram":l=ft,c={nonce:e,telegram_auth_result:r,telegram_web_app_data:i};break;case"siws":l=yt,c={nonce:e,address:t,...a};break;case"custom":case"guest":case"passkey":throw Error("Invalid transfer account type");default:l=gt,c={nonce:e,userInfo:s}}let d=await this.api.post(l,c);return await this.getAuthenticatedUser()??an(d)}catch(e){throw Ke(e)}}async linkWithSiwsInternal({message:e,signature:t,walletClientType:n,connectorType:a,messageType:r="plain"}){return await this.api.post(kt,{message:e,signature:t,walletClientType:n,connectorType:a,message_type:r})}async linkWithSiws({message:e,signature:t,walletClientType:n,connectorType:a,messageType:r="plain"}){try{let i=await this.linkWithSiwsInternal({message:e,signature:t,walletClientType:n,connectorType:a,messageType:r});return an(i)}catch(e){throw Ke(e)}}async updateUserAndIdToken(){try{let e=await this.api.get(Tt);return this.session.updateIdentityToken(e.identity_token),an(e.user)}catch(e){throw Ke(e)}}async scanTransaction(e){try{return await this.api.post(xt,e)}catch(e){throw Ke(e)}}constructor({apiUrl:e=ar,appId:t,appClientId:n,timeout:a=2e4}){Object.defineProperty(this,Cs,{value:ks}),this._cachedProviderAppDetails={},this.apiUrl=e,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=e!==ar&&e.startsWith("https://privy."),this.timeout=a,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,Cs)[Cs](),ws||(ws=new fs),this.session=ws,this.api=this.generateApi(),this.session.client=this}}function ks(){if("undefined"==typeof window)return null;try{let e=Ka.get(gr);if("string"==typeof e&&e.length>0)return e}catch(e){}let e=Qt();try{return Ka.put(gr,e),e}catch(t){return e}}const Ts=({delayedExecution:e,...n})=>{let{enabled:a,siteKey:r,appId:i,setError:o,setToken:l,setExecuting:c,ref:h}=_i(),[,p]=s((()=>r?.split("t:")||[]),[r]);if(d((()=>h.current?.remove),[]),!a)return null;if(!p)throw Error("Unsupported captcha site key");/*#__PURE__*/return t("div",{className:"hidden h-0 w-0",children:/*#__PURE__*/t(Cn,{...n,ref:h,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{h.current?.reset(),o(void 0),l(void 0)}catch(e){o("expired_and_failed_reset")}}})})},xs=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},As={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:[]}},Is=/*#__PURE__*/c(void 0);let _s=()=>l(Is);function Ss(e,t){if(!t)return;let n=_s().current[e];return d((()=>{for(let[a,r]of Object.entries(t))Object.prototype.hasOwnProperty.call(n,a)||console.warn(`Invalid event type "${a}" for action "${e}"`),n[a]?.push(r);return()=>{for(let[a,r]of Object.entries(t))Object.prototype.hasOwnProperty.call(n,a)||console.warn(`Invalid event type "${a}" for action "${e}"`),n[a]=n[a]?.filter((e=>e!==r))}}),[t])}function Es(e,t,n,...a){for(let r of e.current[t][n])r(...a)}function Ns(){let e=_s();return(t,n,...a)=>Es(e,t,n,...a)}function Ms(e){Ss("configureMfa",e)}const Ps=/*#__PURE__*/bn.div.withConfig({displayName:"Grow",componentId:"sc-ddbf22b4-0"})(["text-align:left;flex-grow:1;"]),Ws=/*#__PURE__*/bn.div.withConfig({displayName:"AlignBottom",componentId:"sc-ddbf22b4-1"})(["display:flex;flex-direction:column;justify-content:flex-end;flex-grow:1;"]),Us=/*#__PURE__*/bn.div.withConfig({displayName:"LoginMethodContainer",componentId:"sc-ddbf22b4-2"})(["display:flex;flex-direction:column;gap:12px;-ms-overflow-style:none;scrollbar-width:none;&::-webkit-scrollbar{display:none;}"]),Os=/*#__PURE__*/bn(Us).withConfig({displayName:"LoginMethodContainerWithScrollShadows",componentId:"sc-ddbf22b4-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:2px;"],(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 Ls=/*#__PURE__*/kn(["&&{width:100%;font-size:16px;line-height:24px;@media (min-width:440px){font-size:14px;}display:flex;gap:12px;align-items:center;padding:12px 16px;border:1px solid var(--privy-color-foreground-4) !important;border-radius:var(--privy-border-radius-mdlg);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);}svg{height:24px;max-height:24px;max-width:24px;}}"]);const Rs=/*#__PURE__*/bn.div.withConfig({displayName:"Subtitle",componentId:"sc-ddbf22b4-4"})(["text-align:center;font-size:14px;margin-bottom:24px;"]),Fs=/*#__PURE__*/bn.button.attrs({className:"login-method-button"}).withConfig({displayName:"LoginMethodButton",componentId:"sc-ddbf22b4-5"})(["",""],Ls),Ds=/*#__PURE__*/bn.a.withConfig({displayName:"LoginMethodButtonLink",componentId:"sc-ddbf22b4-6"})(["",""],Ls),Bs=/*#__PURE__*/bn.div.withConfig({displayName:"Hide",componentId:"sc-ddbf22b4-7"})(["width:100%;height:100%;min-height:inherit;display:flex;flex-direction:column;",""],(e=>e.$if?"display: none;":"")),zs=/*#__PURE__*/bn.div.withConfig({displayName:"EmptyWalletState",componentId:"sc-ddbf22b4-8"})(["width:100%;height:100%;padding:",";"],(e=>e.$withPadding?"64px 0px":"0px")),$s=/*#__PURE__*/bn.div.withConfig({displayName:"Header",componentId:"sc-ddbf22b4-9"})(["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 js(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 Vs=/*#__PURE__*/bn.div.withConfig({displayName:"TermsAndConditionsContainer",componentId:"sc-bdb69ecc-0"})(["margin-top:16px;font-size:13px;text-align:center;color:var(--privy-color-foreground-3);&& > a{color:var(--privy-color-accent);}"]);function Hs({app:{legal:{privacyPolicyUrl:n,termsAndConditionsUrl:a,requireUsersAcceptTerms:r}},alwaysShowImplicitConsent:i}){let o=!(!n||!a);return r&&!i||!a&&!n?
1
+ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{createStore as a}from"mipd";import r,{useRef as i,useState as o,useMemo as s,useContext as l,createContext as c,useEffect as d,useCallback as h,useReducer as p,forwardRef as u}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 T,{ProviderErrors as x,DEFAULT_SUPPORTED_CHAIN_IDS as A,rpc as I,dedupeSupportedChains as _,DEFAULT_SUPPORTED_CHAINS as S,mainnet as E,addToDefaultChains as N,create as M,countryCodesAndNumbers as P,validatePhoneNumber as W,phoneNumberTypingFormatter as U,getPlaceholderPhoneNumber as O,getCountryCallingCode as L,getPhoneCountryCodeAndNumber as R,formatPhoneNumber as F,toObjectKeys as D,arbitrum as B,avalanche as z,base as $,celo as j,linea as V,optimism as H,polygon as q,zora as K,SolanaUsdcAddressMap as Z,UsdcAddressMap as Y,formatWalletAddress as G,getCoinbaseOnRampUrl as J,chainToMoonpayCurrency as Q,isSupportedChainIdForMoonpay as X,isSupportedChainIdForCoinbaseOnramp as ee,sepolia as te,optimismSepolia as ne,polygonAmoy as ae,baseSepolia as re,avalancheFuji as ie,arbitrumSepolia as oe,formatTokenAmount as se,SolanaClient as le,formatWeiAmount as ce,getJsonRpcEndpointFromChain as de,lastFourDigits as he}from"@privy-io/js-sdk-core";import{P as pe,p as ue,f as me,b as ge,c as ye,u as fe,d as we,e as ve,g as Ce,h as be,o as ke,a as Te,i as xe,j as Ae,k as Ie,l as _e,m as Se,n as Ee,q as Ne,r as Me,s as Pe,t as We,v as Ue,w as Oe,x as Le,y as Re,z as Fe,A as De,B as Be,C as ze,D as $e,E as je,F as Ve,G as He,H as qe,I as Ke,J as Ze,K as Ye,L as Ge,M as Je,N as Qe,O as Xe,Q as et,R as tt,S as nt,T as at,U as rt,V as it,W as ot,X as st,Y as lt,Z as ct,_ as dt,$ as ht,a0 as pt,a1 as ut,a2 as mt,a3 as gt,a4 as yt,a5 as ft,a6 as wt,a7 as vt,a8 as Ct,a9 as bt,aa as kt,ab as Tt,ac as xt,ad as At,ae as It,af as _t,ag as St,ah as Et,ai as Nt,aj as Mt}from"./paths-DCwuPDUk.mjs";import{a as Pt,n as Wt,u as Ut,I as Ot}from"./internal-context-qdNgTV5f.mjs";import{createPublicClient as Lt,http as Rt,formatEther as Ft,formatUnits as Dt,toHex as Bt,isHex as zt,getAddress as $t,parseEther as jt,createWalletClient as Vt,custom as Ht,publicActions as qt,encodeFunctionData as Kt,isAddress as Zt,hexToString as Yt,decodeFunctionData as Gt,decodeAbiParameters as Jt}from"viem";import{v4 as Qt}from"uuid";import*as Xt from"jose";import{base64url as en}from"jose";import{h as tn,c as nn,i as an,u as rn,P as on,j as sn,g as ln,b as cn,e as dn,k as hn,a as pn,d as un,l as mn,m as gn}from"./use-sign-with-user-signer-DnNPDfxp.mjs";import yn from"eventemitter3";import{createCoinbaseWalletSDK as fn}from"@coinbase/wallet-sdk";import{toViemTransactionSerializable as wn,STRING_TO_NUMBER_TXN_TYPE as vn}from"@privy-io/ethereum";import{Turnstile as Cn}from"@marsidev/react-turnstile";import{styled as bn,css as kn,createGlobalStyle as Tn,keyframes as xn}from"styled-components";import An from"tinycolor2";import In from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import _n from"@heroicons/react/24/outline/FingerPrintIcon";import Sn from"@heroicons/react/24/outline/PhoneIcon";import En from"@heroicons/react/24/outline/ShieldCheckIcon";import Nn from"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import Mn from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import Pn from"@heroicons/react/24/outline/XMarkIcon";import Wn from"@heroicons/react/24/outline/CalendarIcon";import Un 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 Fn,TransitionChild as Dn,DialogPanel as Bn,Menu as zn,MenuButton as $n,MenuItems as jn,MenuItem as Vn}from"@headlessui/react";import Hn from"@heroicons/react/24/outline/CheckIcon";import qn from"@heroicons/react/24/outline/Square2StackIcon";import{EthereumProvider as Kn,OPTIONAL_EVENTS as Zn,OPTIONAL_METHODS as Yn}from"@walletconnect/ethereum-provider";import Gn from"fast-password-entropy";import*as Jn from"secure-password-utilities";import{DEFAULT_WORDLIST as Qn}from"secure-password-utilities/wordlists";import Xn from"@heroicons/react/24/outline/UserCircleIcon";import ea from"@heroicons/react/24/outline/EnvelopeIcon";import ta from"@heroicons/react/20/solid/CheckIcon";import na from"@heroicons/react/24/outline/WalletIcon";import aa from"@heroicons/react/24/outline/ExclamationCircleIcon";import ra from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import ia from"@heroicons/react/24/solid/DocumentCheckIcon";import oa from"@heroicons/react/24/solid/XCircleIcon";import sa from"@heroicons/react/24/solid/CheckCircleIcon";import{MagnifyingGlassIcon as la,ChevronDownIcon as ca,ArrowRightIcon as da}from"@heroicons/react/24/outline";import{useVirtualizer as ha}from"@tanstack/react-virtual";import pa from"qrcode";import ua from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import ma from"@heroicons/react/24/outline/ChevronRightIcon";import ga from"@heroicons/react/24/outline/LockClosedIcon";import ya from"@heroicons/react/24/outline/PencilSquareIcon";import fa from"@heroicons/react/24/outline/ArrowPathIcon";import wa from"@heroicons/react/24/outline/EyeIcon";import va from"@heroicons/react/24/outline/EyeSlashIcon";import Ca from"@heroicons/react/24/outline/KeyIcon";import ba from"@heroicons/react/24/outline/ArrowDownTrayIcon";import ka from"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import Ta from"@heroicons/react/24/outline/DocumentDuplicateIcon";import xa from"@heroicons/react/24/solid/LockClosedIcon";import Aa from"@heroicons/react/24/outline/CheckCircleIcon";import Ia from"@heroicons/react/24/outline/InformationCircleIcon";import _a from"@heroicons/react/24/outline/CreditCardIcon";import Sa from"@heroicons/react/24/outline/QrCodeIcon";import Ea from"@heroicons/react/24/outline/GlobeAltIcon";import{ofetch as Na}from"ofetch";import Ma from"@heroicons/react/24/outline/ClipboardDocumentIcon";import Pa from"@heroicons/react/24/outline/CloudArrowUpIcon";import Wa from"@heroicons/react/24/outline/NoSymbolIcon";import Ua from"@heroicons/react/24/outline/ClockIcon";import Oa from"@heroicons/react/24/outline/TrashIcon";import La from"@heroicons/react/24/solid/CheckBadgeIcon";import Ra from"@heroicons/react/24/solid/IdentificationIcon";import Fa from"@heroicons/react/24/outline/MinusCircleIcon";import Da from"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import Ba from"@heroicons/react/24/solid/ShieldCheckIcon";import za from"js-cookie";function $a(e){return e?{"privy-ui":"t"}:void 0}class ja{async authenticate(){if(!this.api)throw new pe("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new pe("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(ue,{email:this.meta.email,code:this.meta.emailCode,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw me(e)}}async link(){if(!this.api)throw new pe("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new pe("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(ge,{email:this.meta.email,code:this.meta.emailCode})}catch(e){throw me(e)}}async sendCodeEmail({email:e,captchaToken:t,withPrivyUi:n}){if(!this.api)throw new pe("Auth flow has no API instance");if(e&&(this.meta.email=e),t&&(this.meta.captchaToken=t),!this.meta.email)throw new pe("Email must be set when initialzing authentication.");let a=$a(n);try{return await this.api.post(ye,{email:this.meta.email,token:this.meta.captchaToken},{headers:{...a}})}catch(e){throw me(e)}}constructor({email:e,captchaToken:t,disableSignup:n}){this.meta={email:e,captchaToken:t,disableSignup:n??!1}}}class Va extends ja{async link(){if(!this.api)throw new pe("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new pe("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(fe,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(e){throw me(e)}}constructor(e,t,n){super({email:t,captchaToken:n}),this.meta={email:t,captchaToken:n,oldAddress:e,disableSignup:!1}}}class Ha{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 qa(){try{let e="privy:__session_storage__test",t=new Ha;return t.put(e,"blobby"),t.del(e),!0}catch(e){return!1}}var Ka="undefined"!=typeof window&&window.localStorage?new Ha: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={}}};const Za=["c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96","4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0","225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f","1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369","c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a","ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18","bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6","74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d","afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7","f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d","84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04","0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150","38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662","9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0","c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576","8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4","e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4","f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2","138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98","47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83","7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26","8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3","031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa","2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568","dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd","2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01","b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f","0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92","719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3","942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef","8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2","07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80","8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819","bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a","cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e","94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43","2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715","14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc","576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd","49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd","19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b","5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b","d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b","50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b","9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8","6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa","41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071","14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd","a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1","971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709","18388be9ac2d02726dbac9777c96efaac06d744b2f6d580fccdd4127a6d01fd1","15c8b91ade1a4e58f3ce4e7a0dd7f42b47db0c8df7e0d84f63eb39bcb96c4e0f","541d5dcd4ede02f3afaf75bf8e3e4c4f1fb09edb5fa6c4377ebf31c2785d9adf"];function Ya(e){return{name:e.metadata?.shortName||e.name||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}let Ga="WALLETCONNECT_DEEPLINK_CHOICE";function Ja(e){return e.startsWith("http://")||e.startsWith("https://")}function Qa(e,t){if(Ja(e))return Xa(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 Xa(e,t){if(!Ja(e))return Qa(e,t);let n=e;return n.endsWith("/")||(n=`${n}/`),{redirect:`${n}wc?uri=${encodeURIComponent(t)}`,href:n}}function er(e,t){window.open(e,t,"noreferrer noopener")}class tr{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 nr{get meta(){return this._meta}async authenticate(){if(!this.api)throw new pe("Auth flow has no API instance");if(!this.meta.channelToken)throw new pe("Auth flow must be initialized first");try{let e=await this.api.post(we,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});if(!e)throw new pe("No response from authentication");return e}catch(e){throw me(e)}}async link(){if(!this.api)throw new pe("Auth flow has no API instance");try{return await this.api.post(ve,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(e){throw me(e)}}async _startChannelOnce(){if(!this.api)throw new pe("Auth flow has no API instance");let e=await this.api.post(Ce,{token:this.captchaToken});g&&!y&&e.connect_uri&&er(e.connect_uri,"_blank"),this._meta={...this._meta,connectUri:e.connect_uri,channelToken:e.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new pe("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new pe("Auth flow has no API instance");if(!this.meta.channelToken)throw new pe("Auth flow must be initialized first");let e=await this.api.get(be,{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 tr(this._startChannelOnce.bind(this)),this.pollForReady=new tr(this._pollForReady.bind(this)),this._meta.disableSignup=t}}const ar="https://auth.privy.io",rr=1400,ir=2500,or=4e3,sr="2.19.3",lr="privy:token",cr="privy-token",dr="privy:refresh_token",hr="privy:pat",pr="privy:id_token",ur="privy-id-token",mr="privy-session",gr="privy:caid",yr=e=>`privy:guest:${e}`,fr=e=>`privy:cross-app:${e}`,wr="privy:state_code",vr="privy:code_verifier",Cr="privy:headless_oauth",br="privy:oauth_disable_signup",kr=e=>`privy:wallet:${e}`,Tr="privy:connectors",xr="privy:connections",Ar=12e4,Ir=3e4,_r="https://api.moonpay.com/v1",Sr="https://api.moonpay.com/v1",Er="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",Nr="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI";function Mr(e){return crypto.getRandomValues(new Uint8Array(e))}function Pr(){return en.encode(Mr(36))}function Wr(){return Pr()}async function Ur(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 en.encode(t)}}class Or{addCaptchaToken(e){this.meta.captchaToken=e}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new pe("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new pe("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if("undefined"===this.meta.authorizationCode)throw new pe("User denied confirmation during OAuth flow");let e=function(){let e=Ka.get(vr);if(!e)throw new pe("Authentication error.");return e}();try{let t=await this.api.post(ke,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:e,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});return Ka.del(vr),Ka.del(Cr),Ka.del(br),t}catch(e){let t=me(e);if(t.privyErrorCode)throw new pe(t.message||"Invalid code during OAuth flow.",void 0,t.privyErrorCode);if("User denied confirmation during OAuth flow"===t.message)throw new pe("Invalid code during oauth flow.",void 0,Te.OAUTH_USER_DENIED);throw new pe("Invalid code during OAuth flow.",void 0,Te.UNKNOWN_AUTH_ERROR)}}async link(){if(!this.api)throw new pe("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new pe("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if("undefined"===this.meta.authorizationCode)throw new pe("User denied confirmation during OAuth flow");let e=Ka.get(vr);if(!e)throw new pe("Authentication error.");try{let t=await this.api.post(xe,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:e});return Ka.del(vr),t}catch(e){throw me(e)}}async getAuthorizationUrl(){if(!this.api)throw new pe("Auth flow has no API instance");if(!this.meta.provider)throw new pe("Provider must be set when initializing OAuth authentication.");let e=Pr();Ka.put(vr,e);let t=Wr();Ka.put(wr,t);let n=await Ur(e);this.meta.withPrivyUi||Ka.put(Cr,!0),this.meta.disableSignup?Ka.put(br,!0):Ka.del(br);let a=$a(this.meta.withPrivyUi);try{return await this.api.post(Ae,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:n,state_code:t},{headers:{...a}})}catch(e){throw me(e)}}constructor(e){this.meta=e}}function Lr(e){return e.charAt(0).toUpperCase()+e.slice(1)}const Rr=({style:n,...a})=>/*#__PURE__*/e("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 24 24",style:{height:"24px",...n},...a,children:[/*#__PURE__*/t("path",{d:"M17.0722 11.6888C17.0471 8.90571 19.3263 7.56847 19.429 7.50274C18.1466 5.60938 16.153 5.35154 15.4417 5.3212C13.7461 5.14678 12.1306 6.32982 11.269 6.32982C10.4074 6.32982 9.08004 5.34648 7.67246 5.37429C5.82158 5.40209 4.11595 6.45874 3.16171 8.13218C1.24068 11.4942 2.6708 16.4817 4.54423 19.2143C5.46091 20.549 6.55041 22.0531 7.98554 21.9975C9.36803 21.9419 9.88905 21.095 11.5571 21.095C13.2251 21.095 13.696 21.9975 15.1537 21.9697C16.6389 21.9393 17.5806 20.6046 18.4897 19.2648C19.5392 17.7153 19.9725 16.2137 19.9975 16.1354C19.965 16.1228 17.1022 15.0155 17.0722 11.6888Z",fill:"currentColor"}),/*#__PURE__*/t("path",{d:"M14.3295 3.51373C15.0909 2.58347 15.6043 1.28921 15.4641 0C14.3671 0.0455014 13.0396 0.738135 12.2532 1.66838C11.5494 2.48994 10.9307 3.80695 11.0986 5.07089C12.3183 5.16694 13.5681 4.44145 14.3295 3.51373Z",fill:"currentColor"})]}),Fr=({style:n,...a})=>/*#__PURE__*/e("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 71 55",style:{height:"24px",...n},...a,children:[/*#__PURE__*/t("g",{clipPath:"url(#clip0)",children:/*#__PURE__*/t("path",{d:"M60.1045 4.8978C55.5792 2.8214 50.7265 1.2916 45.6527 0.41542C45.5603 0.39851 45.468 0.440769 45.4204 0.525289C44.7963 1.6353 44.105 3.0834 43.6209 4.2216C38.1637 3.4046 32.7345 3.4046 27.3892 4.2216C26.905 3.0581 26.1886 1.6353 25.5617 0.525289C25.5141 0.443589 25.4218 0.40133 25.3294 0.41542C20.2584 1.2888 15.4057 2.8186 10.8776 4.8978C10.8384 4.9147 10.8048 4.9429 10.7825 4.9795C1.57795 18.7309 -0.943561 32.1443 0.293408 45.3914C0.299005 45.4562 0.335386 45.5182 0.385761 45.5576C6.45866 50.0174 12.3413 52.7249 18.1147 54.5195C18.2071 54.5477 18.305 54.5139 18.3638 54.4378C19.7295 52.5728 20.9469 50.6063 21.9907 48.5383C22.0523 48.4172 21.9935 48.2735 21.8676 48.2256C19.9366 47.4931 18.0979 46.6 16.3292 45.5858C16.1893 45.5041 16.1781 45.304 16.3068 45.2082C16.679 44.9293 17.0513 44.6391 17.4067 44.3461C17.471 44.2926 17.5606 44.2813 17.6362 44.3151C29.2558 49.6202 41.8354 49.6202 53.3179 44.3151C53.3935 44.2785 53.4831 44.2898 53.5502 44.3433C53.9057 44.6363 54.2779 44.9293 54.6529 45.2082C54.7816 45.304 54.7732 45.5041 54.6333 45.5858C52.8646 46.6197 51.0259 47.4931 49.0921 48.2228C48.9662 48.2707 48.9102 48.4172 48.9718 48.5383C50.038 50.6034 51.2554 52.5699 52.5959 54.435C52.6519 54.5139 52.7526 54.5477 52.845 54.5195C58.6464 52.7249 64.529 50.0174 70.6019 45.5576C70.6551 45.5182 70.6887 45.459 70.6943 45.3942C72.1747 30.0791 68.2147 16.7757 60.1968 4.9823C60.1772 4.9429 60.1437 4.9147 60.1045 4.8978ZM23.7259 37.3253C20.2276 37.3253 17.3451 34.1136 17.3451 30.1693C17.3451 26.225 20.1717 23.0133 23.7259 23.0133C27.308 23.0133 30.1626 26.2532 30.1066 30.1693C30.1066 34.1136 27.28 37.3253 23.7259 37.3253ZM47.3178 37.3253C43.8196 37.3253 40.9371 34.1136 40.9371 30.1693C40.9371 26.225 43.7636 23.0133 47.3178 23.0133C50.9 23.0133 53.7545 26.2532 53.6986 30.1693C53.6986 34.1136 50.9 37.3253 47.3178 37.3253Z",fill:"#5865F2"})}),/*#__PURE__*/t("defs",{children:/*#__PURE__*/t("clipPath",{id:"clip0",children:/*#__PURE__*/t("rect",{width:"71",height:"55",fill:"white"})})})]}),Dr=({style:e,...n})=>/*#__PURE__*/t("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"24",y:"24",viewBox:"0 0 98 96",style:{height:"24px",...e},...n,children:/*#__PURE__*/t("path",{d:"M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z",fill:"currentColor"})}),Br=({style:e})=>/*#__PURE__*/t(Ea,{style:{color:"var(--privy-color-error)",...e}}),zr=({style:n,...a})=>/*#__PURE__*/e("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...n},...a,children:[/*#__PURE__*/t("path",{d:"M22.56 12.25C22.56 11.47 22.49 10.72 22.36 10H12V14.255H17.92C17.665 15.63 16.89 16.795 15.725 17.575V20.335H19.28C21.36 18.42 22.56 15.6 22.56 12.25Z",fill:"#4285F4"}),/*#__PURE__*/t("path",{d:"M12 23C14.97 23 17.46 22.015 19.28 20.335L15.725 17.575C14.74 18.235 13.48 18.625 12 18.625C9.13504 18.625 6.71004 16.69 5.84504 14.09H2.17004V16.94C3.98004 20.535 7.70004 23 12 23Z",fill:"#34A853"}),/*#__PURE__*/t("path",{d:"M5.845 14.09C5.625 13.43 5.5 12.725 5.5 12C5.5 11.275 5.625 10.57 5.845 9.91V7.06H2.17C1.4 8.59286 0.999321 10.2846 1 12C1 13.775 1.425 15.455 2.17 16.94L5.845 14.09Z",fill:"#FBBC05"}),/*#__PURE__*/t("path",{d:"M12 5.375C13.615 5.375 15.065 5.93 16.205 7.02L19.36 3.865C17.455 2.09 14.965 1 12 1C7.70004 1 3.98004 3.465 2.17004 7.06L5.84504 9.91C6.71004 7.31 9.13504 5.375 12 5.375Z",fill:"#EA4335"})]});function $r(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 jr(n){/*#__PURE__*/return t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 320 320",width:24,height:24,...n,children:/*#__PURE__*/t("g",{children:/*#__PURE__*/e("g",{children:[/*#__PURE__*/t("rect",{fill:"#06c755",width:"320",height:"320",rx:"72.14"}),/*#__PURE__*/t("path",{fill:"#fff",d:"M266.66,144.92c0-47.74-47.86-86.58-106.69-86.58S53.28,97.18,53.28,144.92c0,42.8,38,78.65,89.22,85.42,3.48.75,8.21,2.29,9.4,5.26,1.08,2.7.71,6.93.35,9.65,0,0-1.25,7.53-1.52,9.13-.47,2.7-2.15,10.55,9.24,5.76s61.44-36.18,83.82-61.95h0C259.25,181.24,266.66,164,266.66,144.92Z"}),/*#__PURE__*/t("path",{fill:"#06c755",d:"M231.16,172.49h-30a2,2,0,0,1-2-2v0h0V123.94h0v0a2,2,0,0,1,2-2h30a2,2,0,0,1,2,2v7.57a2,2,0,0,1-2,2H210.79v7.85h20.37a2,2,0,0,1,2,2V151a2,2,0,0,1-2,2H210.79v7.86h20.37a2,2,0,0,1,2,2v7.56A2,2,0,0,1,231.16,172.49Z"}),/*#__PURE__*/t("path",{fill:"#06c755",d:"M120.29,172.49a2,2,0,0,0,2-2v-7.56a2,2,0,0,0-2-2H99.92v-37a2,2,0,0,0-2-2H90.32a2,2,0,0,0-2,2v46.53h0v0a2,2,0,0,0,2,2h30Z"}),/*#__PURE__*/t("rect",{fill:"#06c755",x:"128.73",y:"121.85",width:"11.64",height:"50.64",rx:"2.04"}),/*#__PURE__*/t("path",{fill:"#06c755",d:"M189.84,121.85h-7.56a2,2,0,0,0-2,2v27.66l-21.3-28.77a1.2,1.2,0,0,0-.17-.21v0l-.12-.12,0,0-.11-.09-.06,0-.11-.08-.06,0-.11-.06-.07,0-.11,0-.07,0-.12,0-.08,0-.12,0h-.08l-.11,0h-7.71a2,2,0,0,0-2,2v46.56a2,2,0,0,0,2,2h7.57a2,2,0,0,0,2-2V142.81l21.33,28.8a2,2,0,0,0,.52.52h0l.12.08.06,0,.1.05.1,0,.07,0,.14,0h0a2.42,2.42,0,0,0,.54.07h7.52a2,2,0,0,0,2-2V123.89A2,2,0,0,0,189.84,121.85Z"})]})})})}function Vr({style:e,...n}){/*#__PURE__*/return t("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0,0,256,256",style:{height:"26px",width:"26px",...e},...n,children:/*#__PURE__*/t("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:/*#__PURE__*/t("g",{transform:"scale(5.12,5.12)",children:/*#__PURE__*/t("path",{d:"M41,4h-32c-2.76,0 -5,2.24 -5,5v32c0,2.76 2.24,5 5,5h32c2.76,0 5,-2.24 5,-5v-32c0,-2.76 -2.24,-5 -5,-5zM17,20v19h-6v-19zM11,14.47c0,-1.4 1.2,-2.47 3,-2.47c1.8,0 2.93,1.07 3,2.47c0,1.4 -1.12,2.53 -3,2.53c-1.8,0 -3,-1.13 -3,-2.53zM39,39h-6c0,0 0,-9.26 0,-10c0,-2 -1,-4 -3.5,-4.04h-0.08c-2.42,0 -3.42,2.06 -3.42,4.04c0,0.91 0,10 0,10h-6v-19h6v2.56c0,0 1.93,-2.56 5.81,-2.56c3.97,0 7.19,2.73 7.19,8.26z"})})})})}function Hr(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 qr(n){/*#__PURE__*/return e("svg",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 293768 333327",width:24,height:24,...n,children:[/*#__PURE__*/t("path",{fill:"#26f4ee",d:"M204958 0c5369 45832 32829 78170 77253 81022v43471l-287 27V87593c-44424-2850-69965-30183-75333-76015l-47060-1v192819c6791 86790-60835 89368-86703 56462 30342 18977 79608 6642 73766-68039V0h58365zM78515 319644c-26591-5471-50770-21358-64969-44588-34496-56437-3401-148418 96651-157884v54345l-164 27v-40773C17274 145544 7961 245185 33650 286633c9906 15984 26169 27227 44864 33011z"}),/*#__PURE__*/t("path",{fill:"#fb2c53",d:"M218434 11587c3505 29920 15609 55386 35948 70259-27522-10602-43651-34934-47791-70262l11843 3zm63489 82463c3786 804 7734 1348 11844 1611v51530c-25770 2537-48321-5946-74600-21749l4034 88251c0 28460 106 41467-15166 67648-34260 58734-95927 63376-137628 35401 54529 22502 137077-4810 136916-103049v-96320c26279 15803 48830 24286 74600 21748V94050zm-171890 37247c5390-1122 11048-1985 16998-2548v54345c-21666 3569-35427 10222-41862 22528-20267 38754 5827 69491 35017 74111-33931 5638-73721-28750-49999-74111 6434-12304 18180-18959 39846-22528v-51797zm64479-119719h1808-1808z"}),/*#__PURE__*/t("path",{d:"M206590 11578c5369 45832 30910 73164 75333 76015v51528c-25770 2539-48321-5945-74600-21748v96320c206 125717-135035 135283-173673 72939-25688-41449-16376-141089 76383-155862v52323c-21666 3569-33412 10224-39846 22528-39762 76035 98926 121273 89342-1225V11577l47060 1z",fill:"#000000"})]})}const Kr=({style:e,...n})=>/*#__PURE__*/t("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",width:"24px",...e},...n,children:/*#__PURE__*/t("path",{d:"M 14.285156 10.171875 L 23.222656 0 L 21.105469 0 L 13.34375 8.832031 L 7.148438 0 L 0 0 L 9.371094 13.355469 L 0 24.019531 L 2.117188 24.019531 L 10.308594 14.691406 L 16.851562 24.019531 L 24 24.019531 M 2.878906 1.5625 L 6.132812 1.5625 L 21.101562 22.535156 L 17.851562 22.535156",fill:"currentColor"})});let Zr={google:{name:"Google",component:zr},discord:{name:"Discord",component:Fr},github:{name:"Github",component:Dr},linkedin:{name:"LinkedIn",component:Vr},twitter:{name:"Twitter",component:Kr},spotify:{name:"Spotify",component:Hr},instagram:{name:"Instagram",component:$r},tiktok:{name:"Tiktok",component:qr},line:{name:"LINE",component:jr},apple:{name:"Apple",component:Rr}};const Yr=e=>e in Zr?Zr[e]:{name:"Unknown",component:Br};function Gr(){let e=new URLSearchParams(window.location.search),t=e.get("privy_oauth_code"),n=e.get("privy_oauth_state"),a=e.get("privy_oauth_provider");if(!t||!n||!a)return{inProgress:!1};let r=!1;try{r=!!window.opener.location.origin}catch{}return{inProgress:!0,authorizationCode:t,stateCode:n,provider:a,withPrivyUi:!Ka.get(Cr),popupFlow:null!==window.opener&&r,disableSignup:!!Ka.get(br)}}function Jr(){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"),Ka.del(wr),window.history.replaceState({},"",e)}class Qr{async initRegisterFlow(e){if(!this.api)throw new pe("Auth flow has no API instance");this.authenticateForRegistration=!0,this.meta.initRegisterResponse=await this.initRegisterOnce.execute(e)}async initAuthenticationFlow(e){if(!this.api)throw new pe("Auth flow has no API instance");this.authenticateForRegistration=!1,this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute(e)}async initLinkFlow(){if(!this.api)throw new pe("Auth flow has no API instance");this.meta.initLinkResponse=await this.initLinkOnce.execute()}async register(){let e=await import("@simplewebauthn/browser");if(!this.api)throw new pe("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new pe("WebAuthn is not supported in this browser");this.meta.initRegisterResponse||(this.meta.initRegisterResponse=await this.initRegisterOnce.execute());try{let t=this.meta.initRegisterResponse.options,n=await e.startRegistration(this._transformInitLinkOptionsToCamelCase(t));return this.meta.setPasskeyAuthState?.({status:"submitting-response"}),await this.api.post(Ie,{relying_party:this.meta.initRegisterResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(n)})}catch(e){if("NotAllowedError"===e.name)throw new pe("Passkey request timed out or rejected by user.",void 0,Te.PASSKEY_NOT_ALLOWED);throw me(e)}}async authenticate(){if(this.authenticateForRegistration)return this.register();let e=await import("@simplewebauthn/browser");if(!this.api)throw new pe("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new pe("WebAuthn is not supported in this browser");this.meta.initAuthenticateResponse||(this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute());let t=this.meta.allowedCredentialsIds?.map((e=>({type:"public-key",id:e})))??this.meta.initAuthenticateResponse.options.allow_credentials;try{let n=await e.startAuthentication(this._transformInitAuthenticateOptionsToCamelCase({...this.meta.initAuthenticateResponse.options,allow_credentials:t}));return this.meta.setPasskeyAuthState?.({status:"submitting-response"}),await this.api.post(_e,{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 pe("Passkey request timed out or rejected by user.",void 0,Te.PASSKEY_NOT_ALLOWED);throw me(e)}}async link(){let e=await import("@simplewebauthn/browser");if(!this.api)throw new pe("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new pe("WebAuthn is not supported in this browser");this.meta.initLinkResponse||(this.meta.initLinkResponse=await this.initLinkOnce.execute());try{let t=this.meta.initLinkResponse.options,n=await e.startRegistration(this._transformInitLinkOptionsToCamelCase(t));return this.meta.setPasskeyAuthState?.({status:"submitting-response"}),await this.api.post(Se,{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(n)})}catch(e){if("NotAllowedError"===e.name)throw new pe("Passkey request timed out or rejected by user.",void 0,Te.PASSKEY_NOT_ALLOWED);throw me(e)}}async _initRegisterOnce(e){if(!this.api)throw new pe("Auth flow has no API instance");let t=$a(e);return await this.api.post(Ee,{token:this.meta.captchaToken},{headers:{...t}})}async _initAuthenticateOnce(e){if(!this.api)throw new pe("Auth flow has no API instance");let t=$a(e);return await this.api.post(Ne,{token:this.meta.captchaToken},{headers:{...t}})}async _initLinkOnce(){if(!this.api)throw new pe("Auth flow has no API instance");return await this.api.post(Me,{})}_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 tr(this._initRegisterOnce.bind(this)),this.initAuthenticateOnce=new tr(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new tr(this._initLinkOnce.bind(this)),this.meta={captchaToken:e,setPasskeyAuthState:t}}}const Xr=({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 ei{get meta(){return{connectorType:this.wallet?.connectorType,walletClientType:this.wallet?.walletClientType,chainId:this.wallet?.chainId,address:this.wallet?.address,disableSignup:this._meta.disableSignup}}async authenticate(){if(!this.client)throw new pe("SiweFlow has no client instance");try{if(this.preparedMessage&&this.signature)return await this.client.authenticateWithSiweInternal({message:this.preparedMessage,signature:this.signature,chainId:this.wallet?.chainId,walletClientType:this.wallet?.walletClientType,connectorType:this.wallet?.connectorType,mode:this._meta.disableSignup?"no-signup":"login-or-sign-up"});if(!this.wallet)throw new pe("SiweFlow has no wallet instance");let{message:e,signature:t}=await this.sign();return await this.client.authenticateWithSiweInternal({message:e,signature:t,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw me(e)}}async link(){if(!this.client)throw new pe("SiweFlow has no client instance");try{if(!this.wallet)throw new pe("SiweFlow has no wallet instance");let{message:e,signature:t}=await this.sign();return await this.client.linkWithSiweInternal({message:e,signature:t,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(e){throw me(e)}}async sign(){if(!this.client)throw new pe("SiweFlow has no client instance");if(await this.buildMessage(),!this.preparedMessage)throw new pe("Could not prepare SIWE message");if(!this.wallet)throw new pe("SiweFlow has no wallet instance");let e=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:e}}async _getNonceOnce(){if(!this.client)throw new pe("SiweFlow has no client instance");if(!this.wallet)throw new pe("UI SiweFlow has no wallet instance");return await this.client.generateSiweNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildMessage(){if(!this.client)throw new pe("SiweFlow has no client instance");if(!this.wallet)throw new pe("SiweFlow has no wallet instance");let e=this.wallet.address,t=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=Xr({address:e,chainId:t,nonce:this.nonce}),this.preparedMessage}constructor(e,t,n,a=!1,r){this._meta={disableSignup:!1},this.getNonceOnce=new tr(this._getNonceOnce.bind(this)),this.wallet=t,this.captchaToken=n,this.client=e,this._meta.disableSignup=a,this.preparedMessage=r?.message,this.signature=r?.signature}}const ti=(...e)=>{if("undefined"==typeof Buffer)throw new pe("Buffer is not defined.",void 0,Te.BUFFER_NOT_DEFINED);return Buffer.from(...e)},ni=({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 ai{get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType,disableSignup:this._meta.disableSignup,messageType:this._meta.messageType,address:this.wallet?.address}}set messageType(e){this._meta.messageType=e}async authenticate(){if(!this.client)throw new pe("SiwsFlow has no client instance");try{let{message:e,signature:t}=await this.sign();return await this.client.authenticateWithSiwsInternal({message:e,signature:t,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up",messageType:this.meta.messageType})}catch(e){throw me(e)}}async link(){if(!this.client)throw new pe("SiwsFlow has no client instance");try{let{message:e,signature:t}=await this.sign();return await this.client.linkWithSiwsInternal({message:e,signature:t,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType,messageType:this.meta.messageType})}catch(e){throw me(e)}}async sign(){let e,t;if(!this.client)throw new pe("SiwsFlow has no client instance");await this.buildMessage();let n="transaction"===this.meta.messageType;if(!this.preparedMessage)throw new pe("Could not prepare SIWS message");if(!n&&!this.wallet.signMessage||n&&!this.wallet.signTransaction)throw new pe("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=ti(n.signatures[0]?.signature??Buffer.from("missing signature")).toString("base64")}else e=this.preparedMessage,t=ti(await this.wallet.signMessage(ti(this.preparedMessage))).toString("base64");return{message:e,signature:t}}async _getNonceOnce(){if(!this.client)throw new pe("SiwsFlow has no client instance");return await this.client.generateSiwsNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildMessage(){if(!this.client)throw new pe("SiwsFlow has no client instance");let e=this.wallet.address;return this.nonce||(this.nonce=await this.getNonceOnce.execute()),"transaction"===this.meta.messageType&&this._siwsTransactionMethods?this.preparedMessage=this._siwsTransactionMethods.prepareSiwsTransactionWithMemo({address:e,nonce:this.nonce}):this.preparedMessage=ni({address:e,nonce:this.nonce}),this.preparedMessage}constructor(e,t,n,a=!1,r="plain",i){this._meta={disableSignup:!1,messageType:"plain"},this.getNonceOnce=new tr(this._getNonceOnce.bind(this)),this.wallet=e,this.captchaToken=n,this.client=t,this._meta.disableSignup=a,this._meta.messageType=r,this._siwsTransactionMethods=i}}class ri{async authenticate(){if(!this.api)throw new pe("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new pe("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(Pe,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw me(e)}}async link(){if(!this.api)throw new pe("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new pe("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(We,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(e){throw me(e)}}async sendSmsCode({phoneNumber:e,captchaToken:t,withPrivyUi:n}){if(!this.api)throw new pe("Auth flow has no API instance");if(e&&(this.meta.phoneNumber=e),t&&(this.meta.captchaToken=t),!this.meta.phoneNumber)throw new pe("phone nNumber must be set when initialzing authentication.");let a=$a(n);try{return await this.api.post(Ue,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken},{headers:{...a}})}catch(e){throw me(e)}}constructor({phoneNumber:e,captchaToken:t,disableSignup:n}){this.meta={phoneNumber:e,captchaToken:t,disableSignup:n??!1}}}class ii extends ri{async link(){if(!this.api)throw new pe("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode||!this.meta.oldPhoneNumber)throw new pe("Phone number, sms code, and an old phone number must be set prior to calling update.");try{return await this.api.post(Oe,{old_phone_number:this.meta.oldPhoneNumber,new_phone_number:this.meta.phoneNumber,code:this.meta.smsCode})}catch(e){throw me(e)}}constructor(e,t,n){super({phoneNumber:t,captchaToken:n}),this.meta={phoneNumber:t,captchaToken:n,oldPhoneNumber:e,disableSignup:!1}}}const oi=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,si=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||"MetaMask"!==oi(e))return!1;if(e.providers)for(let t of e.providers)if(!si(t))return!1;return!0},li=()=>{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},ci=(e,t,n,a)=>{let r=Number(e),i=t.find((e=>e.id===r));if(!i)throw new Le(`Unsupported chainId ${e}`,4901);return Lt({transport:Rt(di(i,n,a.appId)),chain:i})},di=(e,t,n)=>{let a,r=e.id,i=Number(e.id);if(e.rpcUrls.privyWalletOverride&&e.rpcUrls.privyWalletOverride.http[0])a=e.rpcUrls.privyWalletOverride.http[0];else if(t.rpcUrls&&t.rpcUrls[i])a=t.rpcUrls[i];else if(e.rpcUrls.privy?.http[0]){let t=new URL(e.rpcUrls.privy.http[0]);t.searchParams.append("privyAppId",n),a=t.toString()}else a=e.rpcUrls.public?.http[0]?e.rpcUrls.public.http[0]:e.rpcUrls.default?.http[0];if(!a)throw new Le(`No RPC url found for ${r}`);return a},hi=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,}))$/),pi=(e,t=3,n=4,a="ethereum")=>{if(!e)return"";let r="ethereum"===a?2:0;return t+n+r+3>=e.length?e:`${e.slice(0,r+t)}...${e.slice(e.length-n,e.length)}`},ui=(e,t=3,n=4)=>pi(e,t,n,"solana"),mi=e=>new Promise((t=>setTimeout(t,e)));const gi=(e,t={})=>{let n=t.delayMs||150,a=t.maxAttempts||270;return new Promise((async(r,i)=>{let o=!1,s=0;for(;!o&&s<a;){if(t.abortSignal?.aborted)return;e().then((e=>{o=!0,r(e)}),((...e)=>{o=!0,i(...e)})),s+=1,await mi(n)}o||i(Error("Exceeded max attempts before resolving function"))}))},yi=(e,t,n={},a={})=>{let r=new URL(t,e);for(let[e,t]of Object.entries(n))void 0!==t&&r.searchParams.set(e,t);let i=Object.entries(a);if(i.length>0){let e=new URLSearchParams;for(let[t,n]of i)e.append(t,n);r.hash=e.toString()}return r.href},fi=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),wi=e=>"string"==typeof e?e:"0x"+e.toString(16);async function vi({store:e,walletList:t,externalWalletConfig:n,walletChainType:a,timeout:r=3e3}){let i=!1,o=window;return new Promise((s=>{function l(){if(i)return;i=!0,window.removeEventListener("ethereum#initialized",l);let r=e.getProviders();console.debug("Detected injected providers:",r.map((e=>e.info)));let o=[];for(let e of r)t.includes("coinbase_wallet")&&"com.coinbase.wallet"===e.info.rdns||"solana-only"===a&&"app.phantom"===e.info.rdns||o.push({type:e.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:e});if("solana-only"!==a)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=oi(e);if(!r.some((e=>e.info.name===t))){if(si(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()}),r))}))}function Ci(e){return`eip155:${String(Number(e))}`}const bi=(e,t,n,a)=>{let r=Number(e),i=t.find((e=>e.id===r));if(!i)throw new Le(`Unsupported chainId ${e}`,4901);return di(i,n,a)},ki=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 Ti=e=>e?.map((e=>({signer_id:e.signerId,override_policy_ids:e.policyIds}))),xi=/*#__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 Ai extends Re{constructor(e,t,n){super(e||"Captcha failed"),this.type="Captcha",t instanceof Error&&(this.cause=t),this.privyErrorCode=n}}const Ii=({children:e,id:n,captchaSiteKey:a,captchaEnabled:r})=>{let l=i(null),[c,d]=o(),[h,p]=o(),[u,m]=o(!1),g=s((()=>r?u||c||h?!u||c||h?c&&!h?{status:"success",token:c}:h?{status:"error",error:h}:{status:"ready"}:{status:"loading"}:{status:"ready"}:{status:"disabled"}),[r,c,h,u]);/*#__PURE__*/return t(xi.Provider,{value:{...g,ref:l,enabled:r,siteKey:a,appId:n,setToken:d,setError:p,setExecuting:m,remove(){r&&(l.current?.remove(),m(!1),p(void 0),d(void 0))},reset(){r&&(l.current?.reset(),m(!1),p(void 0),d(void 0))},execute(){r&&(m(!0),l.current?.execute())},async waitForResult(){if(!r)return"";try{return await function(e,{interval:t=100,timeout:n=5e3}={}){return new Promise(((a,r)=>{let i,o=0,s=()=>{o>=n?r("Max attempts reached without result"):(i=e(),o+=t,null==i?setTimeout(s,t):a(i))};s()}))}((()=>l.current?.getResponse()),{interval:200,timeout:2e4})}catch(e){throw new Ai("Captcha failed",null,Te.CAPTCHA_TIMEOUT)}}},children:e})},_i=()=>l(xi);class Si{async authenticate(){if(!this.api)throw new pe("Auth flow has no API instance");try{return await this.api.post(Fe,{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 me(e)}}async link(){if(!this.api)throw new pe("Auth flow has no API instance");try{return await this.api.post(De,{telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData})}catch(e){throw me(e)}}constructor(e,t=!1){this.meta={disableSignup:!1},this.meta={captchaToken:e,disableSignup:!1},this.meta.disableSignup=t}}function Ei(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 Ai&&(t.retryable=!0,t.detail="Something went wrong. Try again."),t}function Ni(e){return Object.fromEntries(decodeURIComponent(e).split("&").map((e=>e.split("=").map(decodeURIComponent))))}function Mi(){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 Pi{static parse(e){try{return new Pi(e)}catch(e){return null}}static throwIfNotWellFormedJwt(e){return Xt.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=Xt.decodeJwt(e)}}class Wi extends Pi{static parse(e){try{return new Wi(e)}catch(e){return null}}get appId(){return this._decoded.aid?this._decoded.aid:this.audience}}let Ui=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 Oi=(e,t)=>{if(t?.imported)return Ui(t);let n=tn(e);if(!n)throw Error("Failed to find primary wallet");return Ui(n)},Li=({style:n,...a})=>/*#__PURE__*/e("svg",{viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...n},...a,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"})]}),Ri="data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PScwIDAgMTAyNCAxMDI0JyBmaWxsPSdub25lJyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHN0eWxlPSdoZWlnaHQ6MjhweDt3aWR0aDoyOHB4Jz48cmVjdCB3aWR0aD0nMTAyNCcgaGVpZ2h0PScxMDI0JyBmaWxsPScjMDA1MkZGJyByeD0nMTAwJyByeT0nMTAwJz48L3JlY3Q+PHBhdGggZmlsbC1ydWxlPSdldmVub2RkJyBjbGlwLXJ1bGU9J2V2ZW5vZGQnIGQ9J00xNTIgNTEyQzE1MiA3MTAuODIzIDMxMy4xNzcgODcyIDUxMiA4NzJDNzEwLjgyMyA4NzIgODcyIDcxMC44MjMgODcyIDUxMkM4NzIgMzEzLjE3NyA3MTAuODIzIDE1MiA1MTIgMTUyQzMxMy4xNzcgMTUyIDE1MiAzMTMuMTc3IDE1MiA1MTJaTTQyMCAzOTZDNDA2Ljc0NSAzOTYgMzk2IDQwNi43NDUgMzk2IDQyMFY2MDRDMzk2IDYxNy4yNTUgNDA2Ljc0NSA2MjggNDIwIDYyOEg2MDRDNjE3LjI1NSA2MjggNjI4IDYxNy4yNTUgNjI4IDYwNFY0MjBDNjI4IDQwNi43NDUgNjE3LjI1NSAzOTYgNjA0IDM5Nkg0MjBaJyBmaWxsPSd3aGl0ZSc+PC9wYXRoPjwvc3ZnPg==";class Fi extends Le{constructor(){super("Wallet timeout"),this.type="wallet_error"}}class Di extends Le{constructor(){super("User rejected connection"),this.type="wallet_error"}}const Bi=e=>e instanceof Le?e:e?.code?new $i(e):new Le("Unknown connector error",e);class zi extends Re{constructor(e,t,n){super(e),this.type="provider_error",this.code=t,this.data=n}}class $i extends zi{constructor(e){super(e.message,e.code,e.data);let t=Object.values(x).find((t=>t.eipCode===e.code));this.details=t||x.UNKNOWN_ERROR,-32002===e.code&&(e.message?.includes("already pending for origin")?e.message?.includes("wallet_requestPermissions")?this.details=x.E32002_CONNECTION_ALREADY_PENDING:this.details=x.E32002_REQUEST_ALREADY_PENDING:e.message?.includes("Already processing")&&e.message.includes("eth_requestAccounts")&&(this.details=x.E32002_WALLET_LOCKED))}}const ji={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},...x};function Vi(e){return"ethereum"===e.type}function Hi(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let a=e[n],r=t[n];if(a?.address!==r?.address||a&&r&&Vi(a)&&Vi(r)&&a?.chainId!==r?.chainId||a?.connectorType!==r?.connectorType||a?.connectedAt!==r?.connectedAt||a?.walletClientType!==r?.walletClientType||a?.isConnected!==r?.isConnected||a?.linked!==r?.linked)return!1}return!0}class qi extends yn{constructor(e){super(),this.walletClientType=e,this.connected=!1,this.initialized=!1}}const Ki=(e,t)=>e.rpcTimeouts&&e.rpcTimeouts[t]||Ar;let Zi,Yi;function Gi(e){return"ethereum"===e.chainType}class Ji extends qi{buildConnectedWallet(e,t,n,a){let r=async()=>!!this.wallets.find((t=>v(t.address)===v(e)));return{type:"ethereum",address:v(e),chainId:t,meta:n,imported:a,switchChain:async n=>{let a,i;if(!r)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?(a=`0x${n.toString(16)}`,i=n):(a=n,i=Number(n)),o===Ci(a))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:a}]})};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 mi(300),await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:a,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:r,getEthereumProvider:async()=>{if(!await r())throw new Le("Wallet is not currently connected.");return this.proxyProvider},sign:async e=>{if(!await r())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 gi((()=>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 a=n[0],r=v(a),i=[];if("privy"===this.walletClientType){let e=Ka.get(kr(r));this.chains.find((t=>t.id===Number(e)))||(Ka.del(kr(r)),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 gi((()=>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=Ci(t);if(!i.find((e=>v(e.address)===r))){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(a),o,e,"embedded_imported"===this.connectorType))}Hi(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,a){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=Ci(e),"privy"===this.walletClientType&&Ka.put(kr(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 mi(500),this.syncAccounts())},this.wallets=[],this.walletClientType=e,this.chains=t,this.defaultChain=n,this.rpcConfig=a,this.rpcTimeoutDuration=Ki(a,e),this.connected=!1,this.initialized=!1}}class Qi{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 Bi(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 Fi,t=this.rpcTimeoutDuration)=>new Promise(((n,a)=>setTimeout((()=>{a(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||Ar,this._subscriptions=[]}}class Xi extends Ji{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:Ri,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 Bi(e)}}constructor(e,t,n,a,r){super("base_account",e,t,n),this.connectorType="base_account",this.walletClientType="base_account",this.displayName="Base Account",this.setBaseAccountSdk=r,this.proxyProvider=new Qi(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.baseAccountConfig={...a,appChainIds:[t.id].concat(e.map((e=>e.id)))},Zi?(this.proxyProvider.setWalletProvider(Zi.getProvider()),this.setBaseAccountSdk(Zi),console.log("Base Account SDK Initialized")):this.importPromise=import("@base-org/account").then((({createBaseAccountSDK:e})=>{Zi=e(this.baseAccountConfig),this.proxyProvider.setWalletProvider(Zi.getProvider()),this.setBaseAccountSdk(Zi),console.log("Base Account SDK Initialized")})).catch(console.error)}}let eo=[1,11155111,137,10,8453,84532,42161,7777777,43114,56];class to extends Ji{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:Ri,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 Bi(e)}}updateConnectionPreference(e){this.coinbaseWalletConfig={...this.coinbaseWalletConfig,preference:{...this.coinbaseWalletConfig.preference,options:e}},this.walletClientType="smartWalletOnly"===e?"coinbase_smart_wallet":"coinbase_wallet",Yi=fn({...this.coinbaseWalletConfig}),this.proxyProvider.setWalletProvider(Yi.getProvider())}constructor(e,t,n,a){if(super("coinbase_wallet",e,t,n),this.connectorType="coinbase_wallet",this.displayName="Coinbase Wallet",this.proxyProvider=new Qi(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.coinbaseWalletConfig={...a,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"),!Yi){let e="eoaOnly"!==this.coinbaseWalletConfig.preference?.options?(this.coinbaseWalletConfig.appChainIds??[]).filter((e=>!eo.includes(e))):[];e.length>0&&!e.every((e=>A.has(e)))&&console.info(`The configured chains are not supported by Coinbase Smart Wallet: ${e.join(", ")}`),Yi=fn(this.coinbaseWalletConfig)}this.proxyProvider.setWalletProvider(Yi.getProvider())}}const no=({...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 ao extends Ji{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:[wi(e?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:no,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}constructor({provider:e,chains:t,defaultChain:n,rpcConfig:a,imported:r,walletIndex:i}){super("privy",t,n,a),this.connectorType="embedded",this.proxyProvider=e,this.walletIndex=i,r&&(this.connectorType="embedded_imported"),this.subscribeListeners()}}const ro=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4","csw_signUserOperation","secp256k1_sign"];class io extends Error{constructor(e,t,n){super(e),this.code=t,this.data=n}}class oo extends yn{async handleSendTransaction(e){if(!e.params||!Array.isArray(e.params))throw new io(`Invalid params for ${e.method}`,4200);let t=e.params[0];if(!await Tk()||!this.address)throw new io("Disconnected",4900);let{hash:n}=await _k(t,{address:this.address});return n}async handleSignTransaction(e){if(!e.params||!Array.isArray(e.params))throw new io(`Invalid params for ${e.method}`,4200);let t=e.params[0];if(!await Tk()||!this.address)throw new io("Disconnected",4900);let{signature:n}=await Ik(t,{address:this.address});return n}handleSwitchEthereumChain(e){let t;if(!e.params||!Array.isArray(e.params))throw new io(`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 io(`Invalid params for ${e.method}`,4200);t=e.params[0].chainId}this.chainId=Number(t),this.publicClient=ci(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:a}=await xk({message:t},{address:n});return a}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:a}=await Ak(ki(n),{address:t});return a}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:wi(this.chainId)};return await this.publicClient.estimateGas({account:t.from??this.address,...wn(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 wi(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=>ro.includes(e))(e.method))return this.publicClient.request({method:e.method,params:e.params});{let t=await Tk();if(await Sk({address:this.address}),!t||!this.address)throw new io("Disconnected",4900);try{let n={method:e.method,params:e.params},a=this.walletAccount;return a&&nn(a)?this.handleWalletApiRequest(n,a,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 io("Disconnected",4900)}}}async handleWalletApiRequest(e,t,n){let a=this.privyClient;if(!a)throw new io("Disconnected",4900);if("secp256k1_sign"===e.method){let r=await I(a,(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"!==r.method)throw new io(`Invalid params for ${e.method}`,4200);return r.data.signature}throw new io(`Method not supported: ${e.method}`,4200)}constructor({walletProxy:e,address:t,entropyId:n,entropyIdVerifier:a,rpcConfig:r,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=a,this.chainId=s,this.rpcConfig=r,this.chains=i,this.publicClient=ci(s,this.chains,r,{appId:o}),this.rpcTimeoutDuration=Ki(r,"privy"),this.appId=o,this.walletIndex=l,this.privyClient=c,this.walletAccount=d}}class so extends Ji{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:a,defaultChain:r}){super(a,[],r,{}),this.connectorType="null",this.proxyProvider=new Qi(void 0,Ar),this.id=e,this.name=t,this.icon=n,this.connectorType=a}}const lo=({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"})}),co=({style:n,...a})=>/*#__PURE__*/e("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",x:0,y:0,viewBox:"0 0 318.6 318.6",width:"28",height:"28",style:{height:"28px",width:"28px",...n},...a,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"})]}),ho=({style:n,...a})=>/*#__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},...a,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 po(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var uo=0;class mo extends Ji{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 Bi(e)}}constructor(e,t,n,a,r){super(r||"unknown",e,t,n),this.connectorType="injected",this.proxyProvider=new Qi(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=a;let i=a.provider;this.proxyProvider.setWalletProvider(i)}}var go="__private_"+uo+++"__walletBranding";class yo extends Ji{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 po(this,go)[go]??{name:"Browser Extension",icon:lo,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 Bi(e)}}constructor(e,t,n,a,r){super(r??"unknown",e,t,n),Object.defineProperty(this,go,{writable:!0,value:void 0}),this.connectorType="injected",this.proxyProvider=new Qi(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(a),"metamask"===r?po(this,go)[go]={name:"MetaMask",icon:co,id:"io.metamask"}:"phantom"===r&&(po(this,go)[go]={name:"Phantom",icon:ho,id:"phantom"})}}class fo extends mo{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 Bi(e)}}}const wo=["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","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"],vo=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 a=bo({client:this.client,isSolana:t,connectOnly:n});return`${e?"phantom://":"https://phantom.app/ul/"}browse/${a}?ref=${a}`}},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 a=bo({client:this.client,isSolana:t,connectOnly:n});return`${e?"solflare://ul/v1/":"https://solflare.com/ul/v1/"}browse/${a}?ref=${a}`}},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 a=bo({client:this.client,isSolana:t,connectOnly:n});return`${e?"backpack://ul/v1/":"https://backpack.com/ul/v1/"}browse/${a}?ref=${a}`}},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="+bo({client:this.client,isSolana:e,connectOnly:t}))}}});function Co({connectorType:e,walletClientType:t}){for(let n of wo)if(e===n||t===n)return vo[n]}function bo({client:e,isSolana:t,connectOnly:n}){let a=new URL(window.location.href);return a.searchParams.set("privy_connector",t?"solana_adapter":"injected"),a.searchParams.set("privy_wallet_client",e),a.searchParams.set("privy_connect_only",String(n)),encodeURIComponent(a.href.replace(/\/$/g,""))}const ko=()=>{let e=Ka.get(xr);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 To=["phantom","glow","solflare","backpack","okx_wallet","walletconnect"];function xo(e){return"solana"===e.chainType}function Ao(e){return"solana"===e.type}class Io extends qi{get isInstalled(){return"Installed"===this.adapter.readyState}get wallet(){return this.adapter.wallet}buildConnectedWallet(e,t){let n,a,r,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&&(a=async(...t)=>await e.sendTransaction(t[0],t[1],t[2])),"signTransaction"in e&&(r=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:Wt(`${this.walletClientType||""} wallet does not support 'getProvider'`),signMessage:n??Wt(`${this.walletClientType||""} wallet does not support 'signMessage'`),sendTransaction:a??Wt(`${this.walletClientType||""} wallet does not support 'sendTransaction'`),signTransaction:r??Wt(`${this.walletClientType||""} wallet does not support 'signTransaction'`),signAllTransactions:i??Wt(`${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||!To.includes(this.walletClientType))&&("phantom"!==this.walletClientType||ko().some((({walletClientType:e})=>"phantom"===e)))}constructor(e,t){super(function(e){return e.name.toLowerCase().split(" ").join("_")}(e)),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 Bi(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 _o extends Io{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 Qi(void 0,Ar),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}}const So=Ln((()=>({listings:[]}))),Eo=So.setState,No=e=>{let t;try{t=new URL(e).hostname}catch(e){return}return So.getState().listings.find((({homepage:e})=>{let n;try{n=new URL(e).hostname}catch(e){return!1}return t.includes(n)}))},Mo=e=>So((({listings:t})=>t.find((({slug:t})=>Po(t)===Po(e)))));function Po(e){return"cryptocom"===e?"cryptocom-defi":"binance"===e?"binance-defi":e.replace(/[-_]wallet$/,"")}function Wo({src:e,...n}){/*#__PURE__*/return t("img",{src:e,...n,style:{display:"none"}})}const Uo={appearance:{landingHeader:"Log in or sign up",theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:"34357d3c125c2bcf2ce2bc3309d98715",externalWallets:{coinbaseWallet:{connectionOptions:"all"}},embeddedWallets:{extendedCalldataDecoding:!1},captchaEnabled:!1,_render:{standalone:!1},fundingMethodConfig:{moonpay:{useSandbox:!1}}};let Oo=new Set(["coinbase_wallet","base_account","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","universal_profile","bybit_wallet","ronin_wallet","haha_wallet","wallet_connect","detected_wallets","detected_solana_wallets","detected_ethereum_wallets","rabby_wallet","safe","solflare","backpack","binance"]),Lo=e=>Oo.has(e),Ro=(e,t,n)=>n.indexOf(e)===t;const Fo=792703809,Do="11111111111111111111111111111111";function Bo(e){return e.includes("testnet")?"testnet":e.includes("devnet")?"devnet":"mainnet-beta"}function zo(e,t){return`https://explorer.solana.com/account/${e}?cluster=${t}`}let $o="#FFFFFF";function jo(e,t){let n=Math.max(0,Math.min(1,e.toHsl().l+t));return An({...e.toHsl(),l:n})}function Vo({backgroundTheme:e,accentHex:t}){let n;switch(e){case"light":n=$o;break;case"dark":n="#1E1E1D";break;default:n=e}let a=An(n),r=An(t),i=An("#51BA81"),o=An("#FFB74D"),s=An("#EC6351"),l=function(e){return e<.8&&e>.2&&console.warn("Background color is not light or dark enough, which could lead to accessibility issues."),e>.5?"light":"dark"}(a.getLuminance()),c=jo(a,"light"===l?-.04:.11),d=jo(a,"light"===l?-.08:.16),h=jo(a,"light"===l?-.88:.87),p=jo(a,"light"===l?-.7:.75),u=jo(a,"light"===l?-.43:.45).desaturate("light"===l?60:20),m=jo(a,"light"===l?-.08:.25).desaturate("light"===l?60:20),g=jo(r,.15),y=jo(r,.25),f=jo(r,-.06),w=jo(r,-.6),v=jo(s,.3),C=jo(o,.3),b=An(r.getLuminance()>.5?"#040217":$o),k=jo(i,-.16),T=jo(i,.4);return{colorScheme:l,background:a.toHslString(),background2:c.toHslString(),background3:d.toHslString(),foreground:h.toHslString(),foreground2:p.toHslString(),foreground3:u.toHslString(),foreground4:m.toHslString(),accent:r.toHslString(),accentLight:g.toHslString(),accentLightest:y.toHslString(),accentDark:f.toHslString(),accentDarkest:w.toHslString(),foregroundAccent:b.toHslString(),success:i.toHslString(),successDark:k.toHslString(),successLight:T.toHslString(),error:s.toHslString(),errorLight:v.toHslString(),warn:o.toHslString(),warnLight:C.toHslString()}}function Ho(e,t,n,a){let r,i,o,s,l,c,d,h,p,u,m,g,y,f,w,v,C=n?console.warn:()=>{};t?.loginMethods?(r=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"),u=t.loginMethods.includes("spotify"),m=t.loginMethods.includes("instagram"),h=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")):(r=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,u=e.spotify_oauth,m=e.instagram_oauth,h=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=[r,i].filter(Boolean),k=[l,c,d,y,u,m,h,p,g,f,w,v].filter(Boolean),T=[s].filter(Boolean),x=t?.loginMethods?.includes("passkey")??!1,A=e.passkeys_for_signup_enabled??!1,I=[o&&(A||x)].filter(Boolean);if(b.length+k.length+T.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===T.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 P=(({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(Lo).filter(Ro):e?e.filter(Lo).filter(Ro):Uo.appearance.walletList)({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),W=(({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 a of e.overflow??[])t.includes(a)||n.includes(a)?console.warn(`Duplicated login method: ${a}`):n.push(a);return{primary:t,overflow:n}})({input:t?.loginMethodsAndOrder}),U=t?.intl?.defaultCountry??"US",{chains:O,defaultChain:L}=function({supportedChains:e,defaultChainFromConfig:t}){let n;if(e){if(0===e.length)throw Error("`supportedChains` must contain at least one chain");n=_(e)}else n=[...S];let a=e?n[0]:E,r=t??a;if(!n.find((e=>e.id===r.id)))throw Error("`defaultChain` must be included in `supportedChains`");return{chains:n,defaultChain:r}}({supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain}),R=!!t?.defaultChain,F=t?.customAuth?.getCustomAccessToken&&!1!==t?.customAuth?.enabled,D=t?.embeddedWallets?.requireUserPasswordOnCreate,B=t?.embeddedWallets?.createOnLogin,z=F?"all-users":e.embedded_wallet_config.ethereum.create_on_login,$=e.embedded_wallet_config.solana.create_on_login,j={"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:a}=e;j[t]={rpcUrl:n??j[t].rpcUrl,blockExplorerUrl:a??j[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 V=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,H=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??Uo.appearance.landingHeader,loginMessage:"string"==typeof t?.appearance?.loginMessage?t?.appearance?.loginMessage.slice(0,100):t?.appearance?.loginMessage,footerLogo:t?.appearance?.footerLogo,palette:Vo({backgroundTheme:t?.appearance?.theme??Uo.appearance.theme,accentHex:t?.appearance?.accentColor??e.accent_color??Uo.appearance.accentColor}),loginGroupPriority:N?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:P,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:r,sms:i,passkey:o,google:l,twitter:c,discord:d,github:y,spotify:u,instagram:m,tiktok:h,line:p,linkedin:g,apple:f,farcaster:w,telegram:v},disablePlusEmails:e.disable_plus_emails,loginMethodsAndOrder:W,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??Uo.walletConnectCloudProjectId,rpcConfig:{rpcUrls:{},rpcTimeouts:t?.externalWallets?.signatureRequestTimeouts??{}},chains:O,solanaClusters:j,defaultChain:L,intl:{defaultCountry:U},shouldEnforceDefaultChainOnConnect:R,captchaEnabled:e.captcha_enabled??Uo.captchaEnabled,captchaSiteKey:e.captcha_site_key,externalWallets:{coinbaseWallet:{config:{appName:e.name,appLogoUrl:e.logo_url,preference:{options:t?.externalWallets?.coinbaseWallet?.connectionOptions??Uo.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??(!F&&(e.embedded_wallet_config.require_user_owned_recovery_on_create??!1)),userOwnedRecoveryOptions:F?["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??$},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??a??"https://auth.privy.io"}},mfa:{methods:e.mfa_methods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},passkeys:{shouldUnlinkOnUnenrollMfa:t?.passkeys?.shouldUnlinkOnUnenrollMfa,shouldUnenrollMfaOnUnlink:t?.passkeys?.shouldUnenrollMfaOnUnlink},customAuth:F?{enabled:!0,...t.customAuth}:void 0,loginConfig:{telegramAuthConfiguration:V,passkeysForSignupEnabled:e.passkeys_for_signup_enabled},headless:!!t?.headless,render:{standalone:t?._render?.standalone??Uo._render.standalone},fundingConfig:H,fundingMethodConfig:{...t?.fundingMethodConfig??Uo.fundingMethodConfig,moonpay:{...t?.fundingMethodConfig?.moonpay??Uo.fundingMethodConfig.moonpay,useSandbox:t?.fundingMethodConfig?.moonpay.useSandbox??t?.fiatOnRamp?.useSandbox??Uo.fundingMethodConfig.moonpay.useSandbox}},whatsAppEnabled:!!e.whatsapp_enabled}}const qo={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},Ko=Ho(qo,void 0,!1);let Zo=/*#__PURE__*/c({appConfig:Ko,isServerConfigLoaded:!1});const Yo=({children:e,client:n,legacyClient:a,clientConfig:r})=>{let[i,l]=o(null),c=s((()=>Ho(i??qo,r,!!i,"undefined"!=typeof window?window.location.origin:void 0)),[i,r]);return d((()=>{if(!i)return;let e=function(e){if(!e)return{};let{appearance:t,supportedChains:n,defaultChain:a,externalWallets:r,...i}=e;return{...i,...n?{supportedChains:n.map((e=>e.id))}:void 0,...a?{defaultChain:a.id}:void 0,...r?{walletConnect:r.walletConnect?{enabled:r.walletConnect.enabled}:void 0,coinbaseWallet:r.coinbaseWallet,solana:{connectors:r.solana?.connectors?.get().map((e=>e.walletClientType))}}:void 0}}(r),t=function(e,t=0){let n=3735928559^t,a=1103547991^t;for(let t,r=0;r<e.length;r++)n=Math.imul(n^(t=e.charCodeAt(r)),2654435761),a=Math.imul(a^t,1597334677);return n=Math.imul(n^n>>>16,2246822507)^Math.imul(a^a>>>13,3266489909),4294967296*(2097151&(a=Math.imul(a^a>>>16,2246822507)^Math.imul(n^n>>>13,3266489909)))+(n>>>0)}(JSON.stringify(e)).toString(),n=`privy:sent:${i.id}:${t}`;localStorage.getItem(n)||(a.createAnalyticsEvent({eventName:"sdk_initialize",payload:e}),localStorage.setItem(n,"t"))}),[r,i]),d((()=>{i||(async()=>{try{await n.initialize();let e=n.app.getConfig();e.custom_api_url&&a.updateApiUrl(e.custom_api_url),l(e)}catch(e){console.warn("Error generating app config: ",e)}})()}),[]),/*#__PURE__*/t(Zo.Provider,{value:{appConfig:c,isServerConfigLoaded:!!i},children:e})},Go=()=>{let{appConfig:e}=l(Zo);return e},Jo=()=>{let{isServerConfigLoaded:e}=l(Zo);return e},Qo=/*#__PURE__*/c({app:Ko,currentScreen:null,lastScreen:null,navigate:Pt,navigateBack:Pt,resetNavigation:Pt,setModalData:Pt,onUserCloseViaDialogOrKeybindRef:void 0}),Xo=n=>{let a=Go(),r=n.authenticated,[s,l]=o(n.initialScreen);d((()=>{r||!n.initialScreen||n.initialScreen.isUnauthenticatedScreem||n.setInitialScreen(null)}),[r]);let c=i(null);d((()=>{n.open||(c.current=null)}),[n.open]),d((()=>{c.current=null}),[n.initialScreen]);let h={app:a,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(Qo.Provider,{value:h,children:[("string"==typeof a.appearance.logo||"img"===a.appearance.logo?.type)&&/*#__PURE__*/t(Wo,{src:"string"==typeof a.appearance.logo?a.appearance.logo:a.appearance.logo.props.src}),n.children]})},es=()=>l(Qo),ts=({style:n,...a})=>{let{app:r}=es();/*#__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},...a,children:[/*#__PURE__*/t("rect",{width:"28",height:"28",rx:"3",fill:"dark"===r?.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)"})})})]})};class ns extends Ji{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=No(this.walletProvider?.session?.peer.metadata.url),this.walletClientType=this.walletEntry?.slug||"unknown"),this.connected=!0,await this.syncAccounts()),this.initialized=!0,this.emit("initialized");let{createAppKit:t}=await import("@reown/appkit");this.modal??=t({projectId:this.walletConnectCloudProjectId,themeVariables:{"--w3m-z-index":1e6},networks:this.chains,includeWalletIds:Za,allowUnsupportedChain:!0}),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:fi(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:"string"==typeof e?e:"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",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(Ga)}catch{}}(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise(((e,t)=>{this.onQrModalClosed=()=>{t(new Di)},(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=No(this.walletProvider?.session?.peer.metadata.url),this.walletClientType=this.walletEntry?.slug||"unknown",this.proxyProvider.rpcTimeoutDuration=Ki(this.rpcConfig,this.walletClientType)),this.connected=!0,await this.syncAccounts(n),e()})().catch((e=>{t(e?Bi(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=bi(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)),a=await Kn.init({projectId:this.walletConnectCloudProjectId,chains:t,optionalChains:n,optionalEvents:Zn,optionalMethods:Yn,rpcMap:e,showQrModal:!1,metadata:{description:this.privyAppName,name:this.privyAppName,url:window.location.origin,icons:[]}});return a.on("display_uri",(e=>{if(a.signer.abortPairingAttempt(),this.walletEntry){let{redirect:t,href:n}=function(e,t){let n=Ya(t);if(n.deepLink)return Qa(n.deepLink,e);if(n.universalLink)return Xa(n.universalLink,e);throw new pe(`Unsupported wallet ${t.id}`)}(e,this.walletEntry);(function({href:e,name:t}){try{localStorage.setItem(Ga,JSON.stringify({href:e,name:t}))}catch{}})({href:n,name:this.walletEntry.metadata?.shortName||this.walletEntry.name}),this.redirectUri=t;let a=function(e,t){let n=Ya(t);if(n.universalLink)return Xa(n.universalLink,e)}(e,this.walletEntry);a?.redirect&&(this.fallbackUniversalRedirectUri=a.redirect),g?(er(t,"_self"),this.showPrivyQrModal?.({native:t,universal:this.fallbackUniversalRedirectUri})):this.showPrivyQrModal?this.showPrivyQrModal?.({native:t,universal:this.fallbackUniversalRedirectUri}):this.modal?.open({uri:e})}else this.modal?.open({uri:e})})),a.on("connect",(()=>{this.modal?.close(),a.session?.peer.metadata.url&&(this.walletEntry=No(a.session?.peer.metadata.url),this.walletClientType=this.walletEntry?.slug||"unknown")})),a}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:a,shouldEnforceDefaultChainOnConnect:r,privyAppId:i,privyAppName:o,walletClientType:s,appKit:l}){super(s||"unknown",n,a,t),this.connectorType="wallet_connect_v2",this.privyAppId=i,this.privyAppName=o,this.walletConnectCloudProjectId=e,this.rpcConfig=t,this.shouldEnforceDefaultChainOnConnect=r,this.proxyProvider=new Qi(void 0,this.rpcTimeoutDuration),this.modal=l,s&&(this.walletEntry=(e=>So.getState().listings.find((({slug:t})=>Po(t)===Po(e))))(s),this.walletClientType=s)}}class as extends yn{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(),Ka.get(Tr)&&(Ka.getKeys().forEach((e=>{e.startsWith("walletconnect")&&Ka.del(e)})),Ka.del(Tr)),this.externalWalletConfig.disableAllExternalWallets))return;let t=vi({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(vo)))!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 _o({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(Gi).find((t=>t.connectorType===e))??null:this.walletConnectors.filter(Gi).find((n=>n.connectorType===e&&n.walletClientType===t))??null}findSolanaWalletConnector(e){return this.walletConnectors.filter(xo).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:a,appId:r,privyClient:i}){let{entropyId:o,entropyIdVerifier:s}=Oi(t);for(let t of n){let n=this.findEmbeddedWalletConnectors().find((e=>e.walletIndex===t.walletIndex));if(n&&Gi(n))n.proxyProvider.walletProxy=e;else{let n=new ao({provider:new oo({walletProxy:e,address:t.address,entropyId:o,entropyIdVerifier:s,rpcConfig:this.rpcConfig,chains:this.chains,appId:r,chainId:a.id,walletIndex:t.walletIndex,privyClient:i,walletAccount:t}),chains:this.chains,defaultChain:a,rpcConfig:this.rpcConfig,imported:!1,walletIndex:t.walletIndex});this.addWalletConnector(n)}}}addImportedWalletConnector(e,t,n,a){let r=this.findWalletConnector("embedded_imported","privy");if(r&&Gi(r))r.proxyProvider.walletProxy=e;else{let r=new ao({provider:new oo({walletProxy:e,address:t,entropyId:t,entropyIdVerifier:"ethereum-address-verifier",walletIndex:0,rpcConfig:this.rpcConfig,chains:this.chains,appId:a,chainId:n.id}),chains:this.chains,walletIndex:0,defaultChain:n,rpcConfig:this.rpcConfig,imported:!0});this.addWalletConnector(r)}}removeEmbeddedWalletConnectors(){this.walletConnectors=this.walletConnectors.filter((e=>"embedded"!==e.connectorType)),this.storedConnections=ko(),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=ko(),this.emit("walletsUpdated")}}async createEthereumWalletConnector({connectorType:e,walletClientType:t,providers:n,walletConfig:a}){let r=this.findWalletConnector(e,t);if(r&&Gi(r))return r instanceof ns&&r.resetConnection(t),r;let i=(()=>"injected"!==e?"coinbase_wallet"===e?new to(this.chains,this.defaultChain,this.rpcConfig,this.externalWalletConfig.coinbaseWallet.config):"base_account"===e?new Xi(this.chains,this.defaultChain,this.rpcConfig,this.externalWalletConfig.baseAccount.config,this.setBaseAccountSdk):"null"!==e?new ns({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}):a?new so({id:a.client,name:a.name,defaultChain:this.defaultChain,walletClientType:a.client}):null:"metamask"===t&&n?.eip6963InjectedProvider?new fo(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask"):"metamask"===t&&n?.legacyInjectedProvider?new yo(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask"):"phantom"===t&&n?.legacyInjectedProvider?new yo(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom"):n?.legacyInjectedProvider&&"unknown_browser_extension"===t?new yo(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider):n?.eip6963InjectedProvider?new mo(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&&Vi(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,a,r,i,o,s,l,c,d,h,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 Qi},this.privyAppId=e,this.walletConnectCloudProjectId=t,this.rpcConfig=n,this.chains=a,this.defaultChain=r,this.walletConnectors=[],this.initialized=!1,this.store=i,this.walletList=o,this.shouldEnforceDefaultChainOnConnect=s,this.externalWalletConfig=l,this.privyAppName=c,this.walletChainType=h||"ethereum-only",this.appKit=p,this.setBaseAccountSdk=d,this.storedConnections=ko()}}let rs=[ze,$e,je];class is{async get(e,t){try{return await this.baseFetch(e,t)}catch(e){throw me(e)}}async post(e,t,n){try{return await this.baseFetch(e,{method:"POST",...t?{body:t}:{},...n})}catch(e){throw me(e)}}async delete(e,t){try{return await this.baseFetch(e,{method:"DELETE",...t})}catch(e){throw me(e)}}constructor({appId:e,appClientId:t,client:n,defaults:a}){this.appId=e,this.appClientId=t,this.clientAnalyticsId=n.clientAnalyticsId,this.sdkVersion=sr,this.client=n,this.defaults=a,this.fallbackApiUrl=n.fallbackApiUrl,this.baseFetch=Na.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 a=rs.includes(e.toString());if(!n.has("authorization")){let e=await this.client.getAccessToken({disableAutoRefresh:a});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 Be}})}}let os=/paymaster\.biconomy\.io\/api/i,ss={mode:"SPONSORED",calculateGasLimits:!0,expiryDuration:300,sponsorshipInfo:{webhookData:{},smartAccountInfo:{name:"BICONOMY",version:"2.0.0"}}};const ls=(e,t)=>e&&os.test(e)?ss:t&&t.policy_id?{policyId:t.policy_id}:void 0,cs=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 ds{async authenticate(){if(!this.api)throw new pe("Auth flow has no API instance");try{return await this.api.post(Ve,{token:this.meta.token})}catch(e){throw me(e)}}async link(){if(!this.api)throw new pe("Auth flow has no API instance");try{return await this.api.post(He,{token:this.meta.token})}catch(e){throw me(e)}}constructor(e){this.meta={token:e}}}class hs{getOrCreateGuestCredential(e){let t=yr(e);if(qa()){if(Ka.get(t))return Ka.get(t);{let e=en.encode(Mr(32));return Ka.put(t,e),e}}return en.encode(Mr(32))}async authenticate(){if(!this.api)throw new pe("Auth flow has no API instance");try{return await this.api.post(qe,{guest_credential:this.meta.guestCredential})}catch(e){throw me(e)}}async link(){throw Error("Linking is not supported for the guest flow")}constructor(e){this.meta={guestCredential:this.getOrCreateGuestCredential(e)}}}function ps(){return!(f&&window.location.origin.startsWith("http://localhost"))}const us=Ln((()=>({identityToken:null})));function ms(){let{identityToken:e}=us();return{identityToken:e}}var gs,ys=((gs={}).PRIVY="privy_access_token",gs.CUSTOMER="customer_access_token",gs);class fs{get token(){return this.privyAccessToken||this.customerAccessToken}getToken(e){return"privy_access_token"===e?this.privyAccessToken:this.customerAccessToken}get customerAccessToken(){return this._getToken(lr)}get privyAccessToken(){return this._getToken(hr)}_getToken(e){try{let t=Ka.get(e);return"string"==typeof t?Pi.throwIfNotWellFormedJwt(t):null}catch(e){return console.error(e),this.destroyLocalState(),null}}get refreshToken(){try{let e=Ka.get(dr);return"string"==typeof e?e:null}catch(e){return console.error(e),this.destroyLocalState(),null}}getProviderAccessToken(e){try{let t=Ka.get(fr(e));if("string"!=typeof t)return null;{let n=new Pi(t);return n.isExpired()?(Ka.del(fr(e)),null):n.value}}catch(e){return console.error(e),null}}get mightHaveServerCookies(){try{let e=za.get(mr);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=Pi.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?Ka.put(fr(e),t):Ka.del(fr(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:a,oauth_tokens:r}=t;this.handleTokenResponse(t);let i=r?{provider:r.provider,accessToken:r.access_token,accessTokenExpiresInSeconds:r.access_token_expires_in_seconds,refreshToken:r.refresh_token,refreshTokenExpiresInSeconds:r.refresh_token_expires_in_seconds,scopes:r.scopes}:void 0;return this._trackAuthenticateEvents(e,a),{user:an(n),isNewUser:a,oAuthTokens:i}}catch(e){throw console.warn("Error authenticating session"),Ke(e)}}_trackAuthenticateEvents(e,t){let n=function(e){return e instanceof ja?"email":e instanceof ri?"sms":e instanceof ei?"siwe":e instanceof hs?"guest":e instanceof ds?"custom_auth":e instanceof Or?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,a=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:a}}catch(e){throw console.warn("Error linking account"),Ke(e)}}async _refresh(){if(!this.api)throw new pe("Session has no API instance");if(!this.client)throw new pe("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 a={};e&&(a.authorization=`Bearer ${e}`),n=await this.api.post(ze,t?{refresh_token:t}:{},{headers:a})}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 Ke(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($e,{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=Ka.get(lr);if(Ka.put(lr,e),!this.client?.useServerCookies){let t=Pi.parse(e)?.expiration;za.set(cr,e,{sameSite:"Strict",secure:ps(),expires:t?new Date(1e3*t):void 0})}t!==e&&this.client?.onStoreCustomerAccessToken?.(e)}else Ka.del(lr),za.remove(cr),this.client?.onDeleteCustomerAccessToken?.()}storeRefreshToken(e){"string"==typeof e?(Ka.put(dr,e),this.client?.useServerCookies||za.set(mr,"t",{sameSite:"Strict",secure:ps(),expires:30})):(Ka.del(dr),za.remove("privy-refresh-token"),za.remove(mr))}storePrivyAccessToken(e){"string"==typeof e?Ka.put(hr,e):Ka.del(hr)}storeIdentityToken(e){if(us.setState({identityToken:e}),this.client?.useServerCookies)return;Ka.put(pr,e);let t=Pi.parse(e)?.expiration;za.set(ur,e,{sameSite:"Strict",secure:ps(),expires:t?new Date(1e3*t):void 0})}clearIdentityToken(){Ka.del(pr),us.setState({identityToken:null}),za.remove(ur)}constructor(){this.authenticateOnce=new tr((async e=>this._authenticate(e))),this.linkOnce=new tr((async e=>this._link(e))),this.refreshOnce=new tr(this._refresh.bind(this)),this.destroyOnce=new tr(this._destroy.bind(this))}}let ws;var vs=0,Cs="__private_"+vs+++"__getOrGenerateClientAnalyticsId";class bs{getAppId(){return this.appId}initializeConnectorManager({walletConnectCloudProjectId:e,rpcConfig:t,chains:n,defaultChain:a,store:r,walletList:i,shouldEnforceDefaultChainOnConnect:o,externalWalletConfig:s,appName:l,walletChainType:c,setBaseAccountSdk:d,appKit:h}){this.connectors||(this.connectors=new as(this.appId,e,t,n,a,r,i,o,s,l,d,c,h))}generateApi(){let e=new is({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 pe("No auth flow in progress.");return this.session.authenticate(this.authFlow)}async link(){if(!this.authFlow)throw new pe("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 me(e)}}async initMfaPasskeyVerification(){try{let e=await this.api.post(Ge,{});return cs(e.options)}catch(e){throw me(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(Je,{});return an(e)}catch(e){throw Ke(e)}}async unlinkEmail(e){try{let t=await this.api.post(Qe,{address:e});return await this.getAuthenticatedUser()??an(t)}catch(e){throw Ke(e)}}async unlinkPhone(e){try{let t=await this.api.post(Xe,{phoneNumber:e});return await this.getAuthenticatedUser()??an(t)}catch(e){throw Ke(e)}}async unlinkEthereumWallet(e){try{let t=await this.api.post(et,{address:e});return await this.getAuthenticatedUser()??an(t)}catch(e){throw Ke(e)}}async unlinkSolanaWallet(e){try{let t=await this.api.post(tt,{address:e});return await this.getAuthenticatedUser()??an(t)}catch(e){throw Ke(e)}}async unlinkOAuth(e,t){try{let n=await this.api.post(nt,{provider:e,subject:t});return await this.getAuthenticatedUser()??an(n)}catch(e){throw Ke(e)}}async unlinkFarcaster(e){try{let t=await this.api.post(at,{fid:e});return await this.getAuthenticatedUser()??an(t)}catch(e){throw Ke(e)}}async unlinkTelegram(e){try{let t=await this.api.post(rt,{telegram_user_id:e});return await this.getAuthenticatedUser()??an(t)}catch(e){throw Ke(e)}}async revokeDelegatedWallet(){try{await this.api.post(it,{})}catch(e){throw Ke(e)}}async createAnalyticsEvent({eventName:e,payload:t,timestamp:n,options:a}){if("undefined"!=typeof window)try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(je,{event_name:e,client_id:this.clientAnalyticsId,payload:{...t||{},clientTimestamp:n?n.toISOString():(new Date).toISOString()}},{retry:-1,keepalive:a?.keepAlive??!1})}catch(e){console.log("Unable to submit event. This is not an issue.")}}async signMoonpayOnRampUrl(e){try{return this.api.post(ot,e)}catch(e){throw Ke(e)}}async initCoinbaseOnRamp(e){try{return this.api.post(st,e)}catch(e){throw Ke(e)}}async getCoinbaseOnRampStatus({partnerUserId:e}){try{return this.api.get(`${lt}?partnerUserId=${e}`)}catch(e){throw Ke(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(ys.CUSTOMER,e)}async getPrivyAccessToken(e){return await this._getToken(ys.PRIVY,e)}async _getToken(e,t){return this.session.getToken(e)?this.session.hasActiveAccessToken(e)?this.session.hasRefreshCredentials(e)?Wi.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,smartWalletType:n.smart_wallet_type,configuredNetworks:n.configured_networks.map((e=>({chainId:e.chain_id,bundlerUrl:e.bundler_url,paymasterUrl:e.paymaster_url,paymasterContext:ls(e.paymaster_url,e.paymaster_context)})))}:{enabled:n.enabled}}catch(e){throw Ke(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(ct,{address:e,token:t})).nonce}catch(e){throw Ke(e)}}async authenticateWithSiweInternal({message:e,signature:t,chainId:n,walletClientType:a,connectorType:r,mode:i}){return await this.api.post(dt,{message:e,signature:t,chainId:n,walletClientType:a,connectorType:r,mode:i})}async linkWithSiweInternal({message:e,signature:t,chainId:n,walletClientType:a,connectorType:r}){return await this.api.post(ht,{message:e,signature:t,chainId:n,walletClientType:a,connectorType:r})}async linkSmartWallet({message:e,signature:t,smartWalletType:n}){try{let a=await this.api.post(pt,{message:e,signature:t,smart_wallet_type:n});return an(a)}catch(e){throw Ke(e)}}async linkWithSiwe({message:e,signature:t,chainId:n,walletClientType:a,connectorType:r}){try{let i=await this.linkWithSiweInternal({message:e,signature:t,chainId:n,walletClientType:a,connectorType:r});return an(i)}catch(e){throw Ke(e)}}async generateSiwsNonce({address:e,captchaToken:t}){try{return(await this.api.post(ut,{address:e,token:t})).nonce}catch(e){throw Ke(e)}}async authenticateWithSiwsInternal({message:e,signature:t,walletClientType:n,connectorType:a,mode:r,messageType:i="plain"}){return await this.api.post(mt,{message:e,signature:t,walletClientType:n,connectorType:a,mode:r,message_type:i})}async sendAccountTransferRequest({nonce:e,account:t,accountType:n,externalWalletMetadata:a,telegramAuthResult:r,telegramWebAppData:i,farcasterEmbeddedAddress:o,oAuthUserInfo:s}){try{let l,c;switch(n){case"email":l=bt,c={nonce:e,email:t};break;case"sms":l=Ct,c={nonce:e,phoneNumber:t};break;case"siwe":if(l=vt,!a)throw Error("Wallet parameters must be defined");c={nonce:e,address:t,...a};break;case"farcaster":l=wt,c={nonce:e,farcaster_id:t,farcaster_embedded_address:o};break;case"telegram":l=ft,c={nonce:e,telegram_auth_result:r,telegram_web_app_data:i};break;case"siws":l=yt,c={nonce:e,address:t,...a};break;case"custom":case"guest":case"passkey":throw Error("Invalid transfer account type");default:l=gt,c={nonce:e,userInfo:s}}let d=await this.api.post(l,c);return await this.getAuthenticatedUser()??an(d)}catch(e){throw Ke(e)}}async linkWithSiwsInternal({message:e,signature:t,walletClientType:n,connectorType:a,messageType:r="plain"}){return await this.api.post(kt,{message:e,signature:t,walletClientType:n,connectorType:a,message_type:r})}async linkWithSiws({message:e,signature:t,walletClientType:n,connectorType:a,messageType:r="plain"}){try{let i=await this.linkWithSiwsInternal({message:e,signature:t,walletClientType:n,connectorType:a,messageType:r});return an(i)}catch(e){throw Ke(e)}}async updateUserAndIdToken(){try{let e=await this.api.get(Tt);return this.session.updateIdentityToken(e.identity_token),an(e.user)}catch(e){throw Ke(e)}}async scanTransaction(e){try{return await this.api.post(xt,e)}catch(e){throw Ke(e)}}constructor({apiUrl:e=ar,appId:t,appClientId:n,timeout:a=2e4}){Object.defineProperty(this,Cs,{value:ks}),this._cachedProviderAppDetails={},this.apiUrl=e,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=e!==ar&&e.startsWith("https://privy."),this.timeout=a,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,Cs)[Cs](),ws||(ws=new fs),this.session=ws,this.api=this.generateApi(),this.session.client=this}}function ks(){if("undefined"==typeof window)return null;try{let e=Ka.get(gr);if("string"==typeof e&&e.length>0)return e}catch(e){}let e=Qt();try{return Ka.put(gr,e),e}catch(t){return e}}const Ts=({delayedExecution:e,...n})=>{let{enabled:a,siteKey:r,appId:i,setError:o,setToken:l,setExecuting:c,ref:h}=_i(),[,p]=s((()=>r?.split("t:")||[]),[r]);if(d((()=>h.current?.remove),[]),!a)return null;if(!p)throw Error("Unsupported captcha site key");/*#__PURE__*/return t("div",{className:"hidden h-0 w-0",children:/*#__PURE__*/t(Cn,{...n,ref:h,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{h.current?.reset(),o(void 0),l(void 0)}catch(e){o("expired_and_failed_reset")}}})})},xs=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},As={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:[]}},Is=/*#__PURE__*/c(void 0);let _s=()=>l(Is);function Ss(e,t){if(!t)return;let n=_s().current[e];return d((()=>{for(let[a,r]of Object.entries(t))Object.prototype.hasOwnProperty.call(n,a)||console.warn(`Invalid event type "${a}" for action "${e}"`),n[a]?.push(r);return()=>{for(let[a,r]of Object.entries(t))Object.prototype.hasOwnProperty.call(n,a)||console.warn(`Invalid event type "${a}" for action "${e}"`),n[a]=n[a]?.filter((e=>e!==r))}}),[t])}function Es(e,t,n,...a){for(let r of e.current[t][n])r(...a)}function Ns(){let e=_s();return(t,n,...a)=>Es(e,t,n,...a)}function Ms(e){Ss("configureMfa",e)}const Ps=/*#__PURE__*/bn.div.withConfig({displayName:"Grow",componentId:"sc-ddbf22b4-0"})(["text-align:left;flex-grow:1;"]),Ws=/*#__PURE__*/bn.div.withConfig({displayName:"AlignBottom",componentId:"sc-ddbf22b4-1"})(["display:flex;flex-direction:column;justify-content:flex-end;flex-grow:1;"]),Us=/*#__PURE__*/bn.div.withConfig({displayName:"LoginMethodContainer",componentId:"sc-ddbf22b4-2"})(["display:flex;flex-direction:column;gap:12px;-ms-overflow-style:none;scrollbar-width:none;&::-webkit-scrollbar{display:none;}"]),Os=/*#__PURE__*/bn(Us).withConfig({displayName:"LoginMethodContainerWithScrollShadows",componentId:"sc-ddbf22b4-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:2px;"],(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 Ls=/*#__PURE__*/kn(["&&{width:100%;font-size:16px;line-height:24px;@media (min-width:440px){font-size:14px;}display:flex;gap:12px;align-items:center;padding:12px 16px;border:1px solid var(--privy-color-foreground-4) !important;border-radius:var(--privy-border-radius-mdlg);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);}svg{height:24px;max-height:24px;max-width:24px;}}"]);const Rs=/*#__PURE__*/bn.div.withConfig({displayName:"Subtitle",componentId:"sc-ddbf22b4-4"})(["text-align:center;font-size:14px;margin-bottom:24px;"]),Fs=/*#__PURE__*/bn.button.attrs({className:"login-method-button"}).withConfig({displayName:"LoginMethodButton",componentId:"sc-ddbf22b4-5"})(["",""],Ls),Ds=/*#__PURE__*/bn.a.withConfig({displayName:"LoginMethodButtonLink",componentId:"sc-ddbf22b4-6"})(["",""],Ls),Bs=/*#__PURE__*/bn.div.withConfig({displayName:"Hide",componentId:"sc-ddbf22b4-7"})(["width:100%;height:100%;min-height:inherit;display:flex;flex-direction:column;",""],(e=>e.$if?"display: none;":"")),zs=/*#__PURE__*/bn.div.withConfig({displayName:"EmptyWalletState",componentId:"sc-ddbf22b4-8"})(["width:100%;height:100%;padding:",";"],(e=>e.$withPadding?"64px 0px":"0px")),$s=/*#__PURE__*/bn.div.withConfig({displayName:"Header",componentId:"sc-ddbf22b4-9"})(["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 js(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 Vs=/*#__PURE__*/bn.div.withConfig({displayName:"TermsAndConditionsContainer",componentId:"sc-bdb69ecc-0"})(["margin-top:16px;font-size:13px;text-align:center;color:var(--privy-color-foreground-3);&& > a{color:var(--privy-color-accent);}"]);function Hs({app:{legal:{privacyPolicyUrl:n,termsAndConditionsUrl:a,requireUsersAcceptTerms:r}},alwaysShowImplicitConsent:i}){let o=!(!n||!a);return r&&!i||!a&&!n?
2
2
  /*#__PURE__*/t(Vs,{}):
3
3
  /*#__PURE__*/ /*#__PURE__*/e(Vs,{children:["By logging in I agree to the"," ",a&&/*#__PURE__*/t("a",{href:a,target:"_blank",children:o?"Terms":"Terms of Service"}),o&&" & ",n&&/*#__PURE__*/t("a",{href:n,target:"_blank",children:"Privacy Policy"})]})}const qs=()=>{let{appearance:e}=Go();/*#__PURE__*/return t(Ks,{children:e.footerLogo??/*#__PURE__*/t("a",{href:"https://www.privy.io/",target:"_blank",id:"protected-by-privy",children:/*#__PURE__*/t(js,{height:13,width:150})})})},Ks=/*#__PURE__*/bn.div.withConfig({displayName:"ModalFooter",componentId:"sc-bdb69ecc-1"})(["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;}"]),Zs=({backFn:e})=>/*#__PURE__*/t("div",{children:/*#__PURE__*/t(Qs,{onClick:e,children:/*#__PURE__*/t(Nn,{height:"16px",width:"16px",strokeWidth:2})})}),Ys=({infoFn:e})=>/*#__PURE__*/t("div",{children:/*#__PURE__*/t(Xs,{"aria-label":"info",onClick:e,children:/*#__PURE__*/t(Mn,{height:"22px",width:"22px",strokeWidth:2})})}),Gs=e=>/*#__PURE__*/t("div",{children:/*#__PURE__*/t(Qs,{"aria-label":"close modal",onClick:e.onClose,children:/*#__PURE__*/t(Pn,{height:"16px",width:"16px",strokeWidth:2})})}),Js=({backFn:n,infoFn:a,onClose:r,title:i,closeable:o=!0})=>{let{closePrivyModal:s}=Ut(),l=Go();/*#__PURE__*/return e(el,{children:[/*#__PURE__*/e(tl,{children:[n&&/*#__PURE__*/t(Zs,{backFn:n}),a&&/*#__PURE__*/t(Ys,{infoFn:a})]}),i&&/*#__PURE__*/t(al,{id:"privy-dialog-title",children:i}),/*#__PURE__*/t(nl,{children:!l.render.standalone&&o&&/*#__PURE__*/t(Gs,{onClose:r||(()=>s())})})]})};let Qs=/*#__PURE__*/bn.button.withConfig({displayName:"StyledButton",componentId:"sc-f295093d-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;}}"]),Xs=/*#__PURE__*/bn(Qs).withConfig({displayName:"TransparentStyledButton",componentId:"sc-f295093d-1"})(["&&{background-color:transparent;}"]),el=/*#__PURE__*/bn.div.withConfig({displayName:"StyledHeader",componentId:"sc-f295093d-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);}"]),tl=/*#__PURE__*/bn.div.withConfig({displayName:"LeftActionContainer",componentId:"sc-f295093d-3"})(["flex:1;align-items:center;display:flex;gap:8px;"]),nl=/*#__PURE__*/bn.div.withConfig({displayName:"RightActionContainer",componentId:"sc-f295093d-4"})(["flex:1;display:flex;justify-content:flex-end;"]),al=/*#__PURE__*/bn.div.withConfig({displayName:"TitleContainer",componentId:"sc-f295093d-5"})(["overflow:hidden;white-space:nowrap;max-width:100%;text-overflow:ellipsis;text-align:center;color:var(--privy-color-foreground-2);"]);const rl=/*#__PURE__*/bn.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;}"]),il=/*#__PURE__*/bn.div.withConfig({displayName:"Title",componentId:"sc-ba98f772-1"})(["font-size:18px;line-height:30px;text-align:center;font-weight:600;margin-bottom:10px;"]),ol=/*#__PURE__*/bn.div.withConfig({displayName:"SubTitle",componentId:"sc-ba98f772-2"})(["font-size:0.875rem;text-align:center;"]),sl=/*#__PURE__*/bn.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;}"]),ll=/*#__PURE__*/bn.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%;"]),cl=/*#__PURE__*/bn.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);}"]),dl=/*#__PURE__*/bn.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;"]),hl=/*#__PURE__*/bn.div.withConfig({displayName:"BottomSection",componentId:"sc-ba98f772-7"})(["display:flex;flex-direction:column;gap:10px;padding-top:20px;"]),pl=/*#__PURE__*/bn.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%;"]),ul=/*#__PURE__*/bn.div.withConfig({displayName:"MethodListItem",componentId:"sc-ba98f772-9"})(["display:flex;gap:5px;width:100%;position:relative;"]),ml=/*#__PURE__*/bn.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);}"]),gl=/*#__PURE__*/bn.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;}"]),yl=/*#__PURE__*/bn.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)")),fl=/*#__PURE__*/bn.div.withConfig({displayName:"SmsInsecureText",componentId:"sc-ba98f772-13"})(["width:100%;display:flex;justify-content:space-between;"]),wl=/*#__PURE__*/bn.p.withConfig({displayName:"TermsText",componentId:"sc-ba98f772-14"})(["text-align:left;width:100%;color:var(--privy-color-foreground-3) !important;"]),vl=/*#__PURE__*/bn.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)")),Cl=/*#__PURE__*/bn.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;}"]),bl=/*#__PURE__*/bn.div.withConfig({displayName:"ErrorMessage",componentId:"sc-ba98f772-17"})(["color:var(--privy-color-error);"]),kl=({handleClose:a,user:r,onSelect:i})=>/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Js,{onClose:a},"header"),/*#__PURE__*/t(Cl,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(En,{})}),/*#__PURE__*/t(il,{children:"Verify your identity"}),/*#__PURE__*/t(ol,{children:"Choose a verification method"}),/*#__PURE__*/e(pl,{children:[r.mfaMethods.includes("totp")&&/*#__PURE__*/e(Fs,{onClick:()=>i("totp"),children:[/*#__PURE__*/t(In,{}),"Authenticator app"]},"totp"),r.mfaMethods.includes("sms")&&/*#__PURE__*/e(Fs,{onClick:()=>i("sms"),children:[/*#__PURE__*/t(Sn,{}),"SMS"]},"sms"),r.mfaMethods.includes("passkey")&&/*#__PURE__*/e(Fs,{onClick:()=>i("passkey"),children:[/*#__PURE__*/t(_n,{}),"Passkey"]},"passkey")]}),/*#__PURE__*/t(Ks,{})]}),Tl=({success:a,fail:r})=>/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(xl,{className:a?"success":r?"fail":""}),/*#__PURE__*/t(Al,{className:a?"success":r?"fail":""})]}),xl=/*#__PURE__*/bn.span.withConfig({displayName:"Loader",componentId:"sc-ce7792e2-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;}@keyframes rotation{0%{transform:rotate(0deg);}100%{transform:rotate(360deg);}}&&&.success{border-color:var(--privy-color-success);border-bottom-color:var(--privy-color-success);}&&&.fail{border-color:var(--privy-color-error);border-bottom-color:var(--privy-color-error);}"],(e=>e.color??"var(--privy-color-accent)")),Al=/*#__PURE__*/bn(xl).withConfig({displayName:"LoaderFaint",componentId:"sc-ce7792e2-1"})(["&&{border-bottom-color:",";animation:none;opacity:0.5;}"],(e=>e.color??"var(--privy-color-accent)")),Il=e=>/*#__PURE__*/t(_l,{color:e.color||"var(--privy-color-foreground-3)"});let _l=/*#__PURE__*/bn(xl).withConfig({displayName:"StyledButtonLoader",componentId:"sc-ce7792e2-2"})(["&&{height:1rem;width:1rem;margin:2px 0;border-width:1.5px;transition:border-color 200ms ease;}"]);const Sl=/*#__PURE__*/bn.button.withConfig({displayName:"Button",componentId:"sc-172643dd-0"})(["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:1rem;font-style:normal;font-weight:500;line-height:22px;letter-spacing:-0.016px;}&&{padding:12px 16px;}"]),El=({children:n,loading:a,disabled:r,success:i,loadingText:o="Loading...",...s})=>/*#__PURE__*/t(Wl,{disabled:a||r,$success:i,...s,children:a?/*#__PURE__*/e("span",{children:[/*#__PURE__*/t(Il,{}),o?/*#__PURE__*/t("span",{children:o}):null]}):n}),Nl=({children:e,loading:n,disabled:a,...r})=>/*#__PURE__*/t(Ml,{disabled:a,...r,children:n?/*#__PURE__*/t(Il,{color:"var(--privy-color-foreground-accent)"}):e});let Ml=/*#__PURE__*/bn(Sl).withConfig({displayName:"StyledPrimaryButtonWithoutGray",componentId:"sc-172643dd-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;pointer-events:none;color:var(--privy-color-foreground-accent);background-color:var(--privy-color-accent-dark);}"]);const Pl=({children:n,loading:a,disabled:r,loadingText:i="Loading...",...o})=>/*#__PURE__*/t(Wl,{as:"a",disabled:a||r,...o,children:a?/*#__PURE__*/e("span",{children:[/*#__PURE__*/t(Il,{}),i?/*#__PURE__*/t("span",{children:i}):null]}):n});let Wl=/*#__PURE__*/bn(Sl).withConfig({displayName:"StyledPrimaryButton",componentId:"sc-172643dd-2"})(["position:relative;&&{background-color:",";color:var(--privy-color-foreground-accent);transition:background-color 200ms ease;}&:hover{background-color:",";}&:active{background-color:",";}&:hover:disabled,&:active:disabled{background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-3);cursor:not-allowed;}"," > span{display:flex;align-items:center;gap:8px;opacity:1;animation:fadein 200ms ease;}"],(e=>e.$warn?"var(--privy-color-error)":e.$success?"var(--privy-color-success)":"var(--privy-color-accent)"),(e=>e.$warn?"var(--privy-color-error)":e.$success?"var(--privy-color-success)":"var(--privy-color-accent-dark)"),(e=>e.$warn?"var(--privy-color-error)":e.$success?"var(--privy-color-success)":"var(--privy-color-accent-dark)"),(e=>e.disabled?/*#__PURE__*/kn(["&&&,&&&:hover,&&&:active{background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-3);cursor:not-allowed;pointer-events:none;}"]):""));const Ul=({children:n,loading:a,disabled:r,loadingText:i="Loading...",...o})=>/*#__PURE__*/t(Ol,{disabled:a||r,...o,children:a?/*#__PURE__*/e("span",{children:[/*#__PURE__*/t(Il,{}),i?/*#__PURE__*/t("span",{children:i}):null]}):n});let Ol=/*#__PURE__*/bn(Sl).withConfig({displayName:"StyledSecondaryButton",componentId:"sc-172643dd-3"})(["&&{border-width:1px;border-color:",";color:var(--privy-color-foreground);transition:border-color 200ms ease;}&:hover,&:active{border-color:",";}&:hover:disabled,&:active:disabled{border-color:var(--privy-color-foreground-accent);color:var(--privy-color-foreground-3);cursor:not-allowed;}> span{display:flex;align-items:center;gap:8px;opacity:1;animation:fadein 200ms ease;}"],(e=>e.$warn?"var(--privy-color-error)":"var(--privy-color-foreground-4)"),(e=>e.$warn?"var(--privy-color-error)":"var(--privy-color-foreground-3)"));const Ll=/*#__PURE__*/bn.button.withConfig({displayName:"SoftCtaButton",componentId:"sc-172643dd-4"})(["&&{padding:12px 16px;font-weight:500;text-align:center;color:var(--privy-color-foreground-accent);background-color:var(--privy-color-accent);border-radius:var(--privy-border-radius-sm);min-width:144px;opacity:",";transition:opacity 200ms ease,background-color 200ms ease,color 200ms ease;user-select:none;"," &:hover{background-color:var(--privy-color-accent-dark);}&:active{background-color:var(--privy-color-accent-dark);}&:hover:disabled,&:active:disabled{background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-3);cursor:not-allowed;}}"],(e=>e.invisible?"0":"1"),(e=>e.invisible&&/*#__PURE__*/kn(["pointer-events:none;"]))),Rl=({children:n,onClick:a,disabled:r,isSubmitting:i,...o})=>/*#__PURE__*/e(Fl,{$isSubmitting:i,onClick:a,disabled:r,...o,children:[/*#__PURE__*/t("span",{children:n}),
4
4
  /*#__PURE__*/t("span",{children:/*#__PURE__*/t(Il,{})})]});let Fl=/*#__PURE__*/bn.button.withConfig({displayName:"StyledEmbeddedButton",componentId:"sc-172643dd-6"})(["&&{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-3);cursor:not-allowed;}}"],(e=>e.$isSubmitting?0:1),(e=>e.$isSubmitting?1:0));const Dl=({label:n,children:a,valueStyles:r})=>/*#__PURE__*/e(Bl,{children:[/*#__PURE__*/t("div",{children:n}),/*#__PURE__*/t(zl,{style:{...r},children:a})]});let Bl=/*#__PURE__*/bn.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;}"]),zl=/*#__PURE__*/bn.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;"]),$l=new Intl.NumberFormat(void 0,{style:"currency",currency:"USD",maximumFractionDigits:2}),jl=e=>$l.format(e);const Vl=(e,t)=>{let n=jl(t*parseFloat(e));return"$0.00"!==n?n:"<$0.01"},Hl=(e,t)=>{let n=jl(t*parseFloat(Ft(e)));return"$0.00"===n?"<$0.01":n},ql=(e,t,n=6,a=!1)=>`${Kl(e,n,a)} ${t}`,Kl=(e,t=6,n=!1)=>{let a=parseFloat(Ft(e)).toFixed(t).replace(/0+$/,"").replace(/\.$/,"");return n?a:`${"0"===a?"<0.001":a}`},Zl=e=>e.reduce(((e,t)=>e+t),0n),Yl=(e,t)=>{let{chains:n}=Ut(),a=`https://etherscan.io/address/${t}`,r=`${((e,t)=>{let n=Number(e),a=t.find((e=>e.id===n));if(!a)throw new Le(`Unsupported chainId ${e}`,4901);return a.blockExplorers?.default.url})(e,n)}/address/${t}`;if(!r)return a;try{new URL(r)}catch{return a}return r};async function Gl(e,t){try{return await e}catch{return t}}const Jl="11111111111111111111111111111111",Ql=["CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C","CPMDWBwJDtYax9qW7AyRuVC19Cc4L4Vcy4n2BHAbHkCW"],Xl=["JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"];let ec=new Intl.NumberFormat(void 0,{style:"currency",currency:"USD",maximumFractionDigits:2});function tc(e,t=6,n=!1,a=!1){let r=(parseFloat(e.toString())/1e9).toFixed(t).replace(/0+$/,"").replace(/\.$/,""),i=a?"":" SOL";return n?`${r}${i}`:`${"0"===r?"<0.001":r}${i}`}function nc(e,t){let n=parseFloat(e.toString())/1e9,a=ec.format(t*n);return"$0.00"===a?"<$0.01":a}function ac({amount:e,fee:t,tokenPrice:n,isUsdc:a}){let r=BigInt(Math.floor(parseFloat(e)*10**(a?6:9))),i=a?r:r+t;return{fundingAmountInBaseUnit:r,fundingAmountInUsd:n?nc(r,n):void 0,totalPriceInUsd:n?nc(i,n):void 0,totalPriceInNativeCurrency:tc(i),feePriceInNativeCurrency:tc(t),feePriceInUsd:n?nc(t,n):void 0}}let rc={"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 ic(e,t,n){let a=rc[e];if(!a[n]){let r=await t.getSplTokenMetadata({mintAddress:n,cluster:e});r&&(a[n]={address:n,symbol:r.symbol,decimals:r.decimals})}return a[n]}function oc(e){return"version"in e}function sc(e,t){let n=(oc(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 lc(e,t,n){return{signature:e,parsedTransaction:n??null,signedTransaction:t,fees:BigInt(n?.meta?.fee||0)}}async function cc(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 dc({tx:e,connection:t,client:n,checkFunds:a}){let r=oc(e)?e.message:e.compileMessage(),i=r.staticAccountKeys[0]?.toBase58()??"",o=await async function(e,t){return BigInt((oc(e)?(await t.getFeeForMessage(e.message)).value:await e.getEstimatedFee(t))??0)}(e,t),s=!a||await Gl(cc(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 a=t?.state.addresses[e];if(a)return{key:a,isWritable:!0,altIdx:n}}))??[],...e.addressTableLookups[n]?.readonlyIndexes.map((e=>{let a=t?.state.addresses[e];if(a)return{key:a,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))]}(r,t);for(let e of r.compiledInstructions){let a=r.staticAccountKeys[e.programIdIndex]?.toBase58()||"";if("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"!==a&&"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"!==a)if(a!==Jl){if("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"===a){let t=await Gl(function(e,t,n){let[a,r,i,o]=e.accountKeyIndexes.map((e=>t[e]));return{type:"ata-creation",program:n,payer:a?.toBase58(),ata:r?.toBase58(),owner:i?.toBase58(),mint:o?.toBase58()}}(e,d,a));if(!t){c.push({type:"unknown",program:a,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(Ql.includes(a)){let r=await Gl(mc(e,d,t,n,a));if(!r){c.push({type:"unknown",program:a,discriminator:e.data[0]});continue}c.push(r)}else if(Xl.includes(a)){let r=await Gl(gc(e,d,t,n,a));if(!r){c.push({type:"unknown",program:a,discriminator:e.data[0]});continue}c.push(r)}else c.push({type:"unknown",program:a,discriminator:e.data[0]})}else{let t=await Gl(uc(e,d));if(!t){c.push({type:"unknown",program:a,discriminator:e.data[0]});continue}c.push(t)}else{let r=await Gl(pc(e,d,t,n,l,a));if(!r){c.push({type:"unknown",program:a,discriminator:e.data[0]});continue}c.push(r),"spl-transfer"===r.type&&(r.fromAta&&r.fromAccount&&r.token.address&&(l[r.fromAta]??={owner:r.fromAccount,mint:r.token.address}),r.toAta&&r.toAccount&&r.token.address&&(l[r.toAta]??={owner:r.toAccount,mint:r.token.address}))}}return{spender:i,fee:o,instructions:c,hasFunds:!!s}}function hc(e,t=0){try{return function(e,t=0){let n=0n;for(let a=0;a<8;a++)n|=BigInt(e[t+a])<<BigInt(8*a);return n}(e,t)}catch{}try{return e.readBigInt64LE(t)}catch{}let n=ti(e);try{return((e,t=0)=>{let n=e[t],a=e[t+7];if(!n||!a)throw Error(`Buffer offset out of range: first: ${n}, last: ${a}.`);return(BigInt(e[t+4]+256*e[t+5]+65536*e[t+6]+(a<<24))<<32n)+BigInt(n+256*e[++t]+65536*e[++t]+16777216*e[++t])})(n)}catch{}try{return n.subarray(t).readBigInt64LE()}catch{}try{return n.readBigInt64LE(t)}catch{}return 0n}async function pc(e,t,n,a,r,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,h="",p=c?r[c.toBase58()]:void 0;if(p)t=p.owner,h=p.mint;else if(c){let e=await n.getParsedAccountInfo(c,"confirmed"),a=e.value?.data;t=a?.parsed?.info?.owner,h=a?.parsed?.info?.mint??"",o=a?.parsed?.info?.tokenAmount?.decimals}if(!h&&l){let e=await n.getParsedAccountInfo(l,"confirmed"),t=e.value?.data;h=t?.parsed?.info?.mint??""}let u=Bo(n.rpcEndpoint),m=await ic(u,a,h),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:hc(e.data,1),token:{symbol:g,decimals:o,address:h}}}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 uc(e,t){let n=e.data[0],a=e.accountKeyIndexes.map((e=>t[e]));if(0===n){let[,t]=a;return{type:"create-account",program:Jl,account:t?.toBase58(),value:hc(e.data,4),withSeed:!1}}if(2===n){let[t,n]=a;return{type:"sol-transfer",program:Jl,fromAccount:t?.toBase58(),toAccount:n?.toBase58(),token:{symbol:"SOL",decimals:9},value:hc(e.data,4),withSeed:!1}}if(3===n){let[,t]=a,n=hc(e.data.slice(e.data.length-32-8-8));return{type:"create-account",program:Jl,account:t?.toBase58(),withSeed:!0,value:n}}if(11===n){let[t,n]=a;return{type:"sol-transfer",program:Jl,fromAccount:t?.toBase58(),toAccount:n?.toBase58(),value:hc(e.data,4),token:{symbol:"SOL",decimals:9},withSeed:!0}}throw Error(`System program instruction type ${n} not supported`)}async function mc(e,t,n,a,r){let i=e.accountKeyIndexes.map((e=>t[e]?.toBase58())),o=e.data[0],s=Bo(n.rpcEndpoint);if(143===o){let t=i[10],n=i[11];return{type:"raydium-swap-base-input",program:r,mintIn:t,mintOut:n,tokenIn:t?await ic(s,a,t):void 0,tokenOut:n?await ic(s,a,n):void 0,amountIn:hc(e.data,8),minimumAmountOut:hc(e.data,16)}}if(55===o){let t=i[10],n=i[11];return{type:"raydium-swap-base-output",program:r,mintIn:t,mintOut:n,tokenIn:t?await ic(s,a,t):void 0,tokenOut:n?await ic(s,a,n):void 0,maxAmountIn:hc(e.data,8),amountOut:hc(e.data,16)}}throw Error(`Raydium swap program instruction type ${o} not supported`)}async function gc(e,t,n,a,r){let i=e.data[0],o=e.accountKeyIndexes.map((e=>t[e])),s=Bo(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:r,mintIn:t,mintOut:n,tokenIn:t?await ic(s,a,t):void 0,tokenOut:n?await ic(s,a,n):void 0,outAmount:hc(e.data,e.data.length-1-2-8-8),quotedInAmount:hc(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:r,mintIn:t,mintOut:n,tokenIn:t?await ic(s,a,t):void 0,tokenOut:n?await ic(s,a,n):void 0,outAmount:hc(e.data,e.data.length-1-2-8-8),quotedInAmount:hc(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:r,mintIn:t,mintOut:n,tokenIn:t?await ic(s,a,t):void 0,tokenOut:n?await ic(s,a,n):void 0,inAmount:hc(e.data,e.data.length-1-2-8-8),quotedOutAmount:hc(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 yc=({weiQuantities:e,tokenPrice:n,tokenSymbol:a})=>{let r=Zl(e),i=n?Hl(r,n):void 0,o=ql(r,a);/*#__PURE__*/return t(vc,{children:i||o})},fc=({weiQuantities:a,tokenPrice:r,tokenSymbol:i})=>{let o=Zl(a),s=r?Hl(o,r):void 0,l=ql(o,i);/*#__PURE__*/return t(vc,{children:s?/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Cc,{children:"USD"}),"<$0.01"===s?
@@ -15,7 +15,7 @@ return t(jc,{...Go().render.standalone?{defaultValue:"details"}:{},children:/*#_
15
15
  /*#__PURE__*/t(El,{as:"a",href:r.allowlistConfig.errorCtaLink,children:s}):/*#__PURE__*/t(El,{onClick:()=>{a(of)},children:s})]})]})}};let fm=/*#__PURE__*/bn.div.withConfig({displayName:"ConnectContainer",componentId:"sc-274cb2fe-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;width:100%;padding-bottom:16px;"]),wm=/*#__PURE__*/bn.div.withConfig({displayName:"GappedContainer",componentId:"sc-274cb2fe-1"})(["display:flex;flex-direction:column;gap:8px;"]);const vm=({icon:a})=>/*#__PURE__*/t(n,{children:/*#__PURE__*/t(Cm,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(Tl,{}),"string"==typeof a?
16
16
  /*#__PURE__*/t("span",{style:{background:`url('${a}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):a?/*#__PURE__*/t(a,{style:{width:"38px",height:"38px"}}):
17
17
  /*#__PURE__*/t("span",{})]})})});let Cm=/*#__PURE__*/bn.div.withConfig({displayName:"StackedContainer",componentId:"sc-26c1d9b9-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 bm={component:()=>{let{lastScreen:a,currentScreen:r,data:s,navigateBack:l,navigate:c,setModalData:h}=es(),{status:p,token:u,waitForResult:m,reset:g,execute:y}=_i(),f=i([]),w=e=>{f.current=[e,...f.current]},[v,C]=o(!0);d((()=>(w(setTimeout(C,1e3,!1)),()=>{f.current.forEach((e=>clearTimeout(e))),f.current=[]})),[]);let[b,k]=o(""),[T,x]=o("Checking that you are a human..."),[A,I]=o(/*#__PURE__*/t(El,{onClick:()=>{},disabled:!0,children:"Continue"})),[_,S]=o(!1),[E,N]=o(3),M=s?.captchaModalData,P=async e=>{try{await(M?.callback(e)),M?.onSuccessNavigateTo&&c(M?.onSuccessNavigateTo,!1)}catch(e){if(e instanceof Ai)return;h({errorModalData:{error:e,previousScreen:a||of}}),c(M?.onErrorNavigateTo||Cu,!1)}};d((()=>{"success"===p?w(setTimeout((async()=>{let e=await m();!e||M?.userIntentRequired||P(e)}),1e3)):"ready"===p&&w(setTimeout((()=>{"ready"===p&&y()}),500))}),[p]),d((()=>{if(!v)switch(p){case"success":k("Success!"),x("CAPTCHA passed successfully."),I(/*#__PURE__*/t(El,{onClick:()=>{S(!0),P(u)},disabled:!M?.userIntentRequired,loading:_,children:M?.userIntentRequired?"Continue":"Continuing..."})),setTimeout((()=>{S(!0),P(u)}),2e3);break;case"loading":k(""),x("Checking that you are a human..."),I(/*#__PURE__*/t(El,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":k("Something went wrong"),E<=0?(x("If you use an adblocker or VPN, try disabling and re-attempting."),I(null)):(x("You did not pass CAPTCHA. Please try again."),I(/*#__PURE__*/t(El,{onClick:W,children:"Retry"})))}}),[p,v,_]);let W=async()=>{if(E<=0)return;N((e=>e-1)),g(),y();let e=await m();!e||M?.userIntentRequired||P(e)};/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{backFn:a&&r!==a?l:void 0}),/*#__PURE__*/e(km,{children:["success"===p?/*#__PURE__*/t(sa,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):"error"===p?/*#__PURE__*/t(oa,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):/*#__PURE__*/t(vm,{}),/*#__PURE__*/e(Ec,{children:[b?/*#__PURE__*/t("h3",{children:b}):null,/*#__PURE__*/t("p",{children:T})]}),A]}),/*#__PURE__*/t(Ks,{})]})}};let km=/*#__PURE__*/bn.div.withConfig({displayName:"CaptchaContainer",componentId:"sc-1be5b3b9-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;width:100%;"]);const Tm=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"})})});const xm={component:function(){let{data:a,setModalData:r,navigateBack:i,lastScreen:o,navigate:s}=es();function l(e){r("wallet"===e?{...a,login:{...a?.login,isSigningInWithLedgerSolana:!1}}:{...a,login:{...a?.login,isSigningInWithLedgerSolana:!0}}),s(Rm)}/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{backFn:o&&o!==Rm?i:void 0}),/*#__PURE__*/e(Am,{children:[/*#__PURE__*/e(Im,{children:[/*#__PURE__*/t(ho,{style:{width:"48px",height:"48px"}}),/*#__PURE__*/t(ua,{width:24,height:24}),/*#__PURE__*/t(Tm,{style:{width:"48px",height:"48px"}})]}),/*#__PURE__*/e(_m,{children:[/*#__PURE__*/t(Sm,{children:"Phantom supports Ledger"}),/*#__PURE__*/e(Em,{children:["Are you using a Ledger hardware wallet?",/*#__PURE__*/t("br",{}),"Continue to sign with Ledger"]})]}),/*#__PURE__*/e(Nm,{children:[/*#__PURE__*/t(Ul,{onClick:()=>l("wallet"),children:"Continue without Ledger"}),/*#__PURE__*/t(El,{onClick:()=>l("ledger"),children:"Continue with Ledger"})]})]}),/*#__PURE__*/t(qs,{})]})}};let Am=/*#__PURE__*/bn.div.withConfig({displayName:"ConnectContainer",componentId:"sc-8c598100-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;width:100%;"]),Im=/*#__PURE__*/bn.div.withConfig({displayName:"IconContainer",componentId:"sc-8c598100-1"})(["display:flex;align-items:center;justify-content:center;gap:8px;"]),_m=/*#__PURE__*/bn.div.withConfig({displayName:"TextContainer",componentId:"sc-8c598100-2"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;"]),Sm=/*#__PURE__*/bn.p.withConfig({displayName:"Title",componentId:"sc-8c598100-3"})(["&&{font-size:18px;font-weight:600;}"]),Em=/*#__PURE__*/bn.p.withConfig({displayName:"Subtitle",componentId:"sc-8c598100-4"})(["&&{font-size:14px;}"]),Nm=/*#__PURE__*/bn.div.withConfig({displayName:"ButtonsContainer",componentId:"sc-8c598100-5"})(["width:100%;display:flex;flex-direction:column;gap:10px;margin-top:24px;"]);const Mm=({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"})}),Pm={component:()=>{let{navigate:a}=es();/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{}),/*#__PURE__*/e(Wm,{children:[/*#__PURE__*/t(Um,{children:/*#__PURE__*/t(Mm,{})}),/*#__PURE__*/e(Om,{children:[/*#__PURE__*/t("h3",{children:"Unable to sign in"}),/*#__PURE__*/t("p",{children:"This application has reached its user limit and cannot sign in new users."})]}),/*#__PURE__*/t(El,{onClick:()=>{a(of)},children:"Go back"})]}),/*#__PURE__*/t(qs,{})]})}};let Wm=/*#__PURE__*/bn.div.withConfig({displayName:"ConnectContainer",componentId:"sc-b3ae112e-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;width:100%;padding-top:8px;padding-bottom:32px;"]),Um=/*#__PURE__*/bn.div.withConfig({displayName:"IconContainer",componentId:"sc-b3ae112e-1"})(["display:flex;align-items:center;justify-content:center;height:72px;aspect-ratio:1;color:var(--privy-color-error);background-color:var(--privy-color-error-light);border-radius:50%;"]),Om=/*#__PURE__*/bn.div.withConfig({displayName:"GappedContainer",componentId:"sc-b3ae112e-2"})(["display:flex;flex-direction:column;gap:8px;"]);const Lm=e=>e?.privyErrorCode===Te.LINKED_TO_ANOTHER_USER?ji.ERROR_USER_EXISTS:e instanceof $i&&!e.details.default?e.details:e instanceof Fi?ji.ERROR_TIMED_OUT:e instanceof Di?ji.ERROR_USER_REJECTED_CONNECTION:e?.privyErrorCode===Te.CANNOT_LINK_MORE_OF_TYPE?ji.ERROR_USER_LIMIT_REACHED:ji.ERROR_WALLET_CONNECTION,Rm={component:()=>{let a,[r,s]=o(!1),[l,c]=o(!1),[p,u]=o(void 0),{authenticated:m,logout:y}=rn(),{app:f,navigate:w,navigateBack:v,lastScreen:C,currentScreen:b,setModalData:k,data:T}=es(),{getAuthFlow:x,walletConnectionStatus:A,closePrivyModal:I,initLoginWithWallet:_,loginWithWallet:S,updateWallets:E,createAnalyticsEvent:N}=Ut(),{walletConnectors:M}=rn(),[P,W]=o(0),{user:U}=rn(),O=mm(),[L]=o(U?.linkedAccounts.length||0),[R,F]=o(""),[D,B]=o(""),[z,$]=o(!1),{hasTabbedAway:j}=function(){let[e,t]=o(!1),n=h((()=>{document.hidden&&t(!0)}),[]);return d((()=>(document.addEventListener("visibilitychange",n),()=>document.removeEventListener("visibilitychange",n))),[n]),{hasTabbedAway:e,reset:()=>t(!1)}}(),{enabled:V,token:H}=_i(),q=Mo(A?.connector?.walletClientType||"unknown"),K=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,Z="connected"===A?.status,Y="switching_to_supported_chain"===A?.status;d((()=>{let e=x(),t=e instanceof ei||e instanceof ai?e:void 0;Z&&"solana"===A.connector?.chainType&&"phantom"===A.connector?.walletClientType&&O(gm)&&void 0===T?.login?.isSigningInWithLedgerSolana?w(xm,!1):(Z&&!t&&(!V||H||m?_(A.connectedWallet,H,T?.login?.disableSignup,T?.login?.isSigningInWithLedgerSolana?"transaction":"plain").then((()=>{$(!0)})):(k({captchaModalData:{callback:e=>_(A.connectedWallet,e,T?.login?.disableSignup,T?.login?.isSigningInWithLedgerSolana?"transaction":"plain").then((()=>{$(!0)})),userIntentRequired:!1,onSuccessNavigateTo:Rm,onErrorNavigateTo:Cu}}),w(bm,!1))),t instanceof ai&&T?.login?.isSigningInWithLedgerSolana&&(t.messageType="transaction"),t&&K&&Z&&!t.preparedMessage?t.buildMessage():t&&!K&&Z&&(l||(async()=>{c(!0),u(void 0);try{"wallet_connect_v2"===A?.connector?.connectorType&&"metamask"===A?.connector?.walletClientType&&await mi(2500),await J()}catch(e){console.warn("Auto-prompted signature failed",e)}finally{c(!1)}})()))}),[P,Z,z]),d((()=>{if(U&&r){let e=900;if(f?.legal.requireUsersAcceptTerms&&!U.hasAcceptedTerms){let t=setTimeout((()=>{w(qu)}),e);return()=>clearTimeout(t)}if(ru(U,f.embeddedWallets)){let t=setTimeout((()=>{k({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),N({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"ConnectionStatusScreen"}}),y()},callAuthOnSuccessOnClose:!0}}),w(Vu)}),e);return()=>clearTimeout(t)}E();let t=setTimeout((()=>I({shouldCallAuthOnSuccess:!0,isSuccess:!0})),rr);return()=>clearTimeout(t)}}),[U,r]);let G=e=>{if(e?.privyErrorCode!==Te.ALLOWLIST_REJECTED){if(e?.privyErrorCode===Te.USER_LIMIT_REACHED)return console.error(new Et(e).toString()),void w(Pm);if(e?.privyErrorCode!==Te.USER_DOES_NOT_EXIST)return e?.privyErrorCode===Te.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce?(k({accountTransfer:{nonce:e.data?.data?.nonce,account:x()?.meta.address,displayName:e.data?.data?.account?.displayName,externalWalletMetadata:{walletClientType:x()?.meta.walletClientType,chainId:x()?.meta.chainId,connectorType:x()?.meta.connectorType},linkMethod:x()instanceof ei?"siwe":"siws",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void w(Lu)):void u(Lm(e));w(ou)}else w(ym)};async function J(){try{await S(),s(!0)}catch(e){G(e)}finally{c(!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"===Q&&A?.connector instanceof ns?A.connector.redirectUri:void 0;e&&F(e);let t="wallet_connect_v2"===Q&&A?.connector instanceof ns?A.connector.fallbackUniversalRedirectUri:void 0;t&&B(t)}),A?.connector instanceof ns&&!R?500:null);let Q=A?.connector?.connectorType||"injected",X=A?.connector?.walletClientType||"unknown",ee=q?.metadata?.shortName||q?.name||A?.connector?.walletBranding.name||"Browser Extension",te=q?.image_url?.md||A?.connector?.walletBranding.icon||(e=>/*#__PURE__*/t(lo,{...e})),ne="Browser Extension"===ee?ee.toLowerCase():ee;a=r?`Successfully connected with ${ne}`:p?p.message:Y?"Switching networks":Z?l&&K?"Signing":"Sign to verify":`Waiting for ${ne}`;let ae="Don’t see your wallet? Check your other browser windows.";r?ae=L===(U?.linkedAccounts.length||0)?"Wallet was already linked.":"You’re good to go!":P>=2&&p?ae="Unable to connect wallet":p?ae=p.detail:Y?ae="Switch your wallet to the requested network.":Z&&K?ae="Sign the message in your wallet to verify it belongs to you.":"metamask"===X&&g?ae="Click continue to open and connect MetaMask.":"metamask"===X?ae="For the best experience, connect only one wallet at a time.":"wallet_connect"===Q?ae="Open your mobile wallet app to continue":"coinbase_wallet"===Q?li()||(ae=dm(U)?"Continue with the Coinbase app. Not the right wallet? Reset your connection below.":"Open the Coinbase app on your phone to continue."):T?.login?.isSigningInWithLedgerSolana&&(ae="Ledger requires a transaction to verify your identity. You’ll sign a transaction that performs no onchain action.");let re=M?.walletConnectors?.find((e=>"coinbase_wallet"===e.walletClientType)),ie="coinbase_wallet"===X&&(dm(U)||p===ji.ERROR_USER_EXISTS);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{backFn:C&&b!==C?v:void 0}),/*#__PURE__*/e(Fm,{children:[/*#__PURE__*/t(Bm,{walletLogo:te,success:r,fail:!!p}),/*#__PURE__*/e(Ec,{children:[/*#__PURE__*/t("h3",{children:a}),/*#__PURE__*/t("p",{children:ae}),Z||!R||j?null:/*#__PURE__*/e("p",{children:["Still here?"," ",/*#__PURE__*/t("a",{href:R,target:"_blank",style:{textDecoration:"underline"},children:"Try connecting again"}),D&&/*#__PURE__*/e(n,{children:[" ","or"," ",/*#__PURE__*/t("a",{href:D,target:"_blank",style:{textDecoration:"underline"},children:"use this different link"})]})]})]}),ie?/*#__PURE__*/t(El,{onClick:()=>re&&re?.disconnect(),disabled:r,children:"Use a different wallet"}):p==ji.ERROR_USER_EXISTS&&b!==C?/*#__PURE__*/t(El,{onClick:v,children:"Use a different wallet"}):Z&&!r&&K?/*#__PURE__*/t(El,{onClick:()=>{c(!0),J()},disabled:l,children:l?"Signing":"Sign with your wallet"}):!r&&p?.retryable&&P<2?/*#__PURE__*/t(El,{onClick:()=>{W(P+1),u(void 0),Z?(c(!0),J()):A?.connectRetry()},disabled:!r&&(!p?.retryable||P>=2),children:"Retry"}):r||p?null:/*#__PURE__*/t(El,{onClick:()=>{},disabled:!0,children:"Connecting"})]}),/*#__PURE__*/t(Ks,{})]})}};let Fm=/*#__PURE__*/bn.div.withConfig({displayName:"ConnectContainer",componentId:"sc-f8d47c4f-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;width:100%;"]),Dm=/*#__PURE__*/bn.div.withConfig({displayName:"StackedContainer",componentId:"sc-f8d47c4f-1"})(["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 Bm=a=>{let r=a.walletLogo;/*#__PURE__*/return t(n,{children:/*#__PURE__*/t(Dm,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(Tl,{success:a.success,fail:a.fail}),"string"==typeof r?
18
- /*#__PURE__*/t("span",{style:{background:`url('${r}') 0 0 / contain`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"contain"}}):/*#__PURE__*/t(r,{style:{width:"38px",height:"38px"}})]})})})};class zm{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=zm.normalize(e);return this.normalizedAllowList.some((e=>n===zm.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,a=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=zm.normalize(e.walletClientType);a({id:t,label:e.walletBranding?.name??t,source:"connector",connector:e,chainType:e.chainType,icon:"string"==typeof e.walletBranding?.icon?e.walletBranding.icon:void 0,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),r=zm.normalize(e.slug);a({id:r,label:e.name||r,source:"listing",listing:e,chainType:t&&n?"multi":t?"ethereum":"solana",icon:e.image_url?.sm,url:e.homepage,chains:e.chains})}));let r=Array.from(n.values()),i=new Map;return this.normalizedAllowList?.forEach(((e,t)=>{i.set(zm.normalize(e),t)})),{wallets:r.slice().sort(((e,t)=>{let n=zm.normalize(e.id),a=zm.normalize(t.id);"binanceus"===n||"binance-defi"===n?n="binance":"universalprofiles"===n?n="universal_profile":"cryptocom-defi"===n&&(n="cryptocom"),"binanceus"===a||"binance-defi"===a?a="binance":"universalprofiles"===a?a="universal_profile":"cryptocom-defi"===a&&(a="cryptocom");let r=i.has(n),o=i.has(a);return r&&o?i.get(n)-i.get(a):r?-1:o?1:"connector"===e.source&&"listing"===t.source?-1:"listing"===e.source&&"connector"===t.source?1:e.label.toLowerCase().localeCompare(t.label.toLowerCase())})),walletCount:r.length}}constructor(e,t){this.chainFilter=e,t&&t.length>0&&(this.normalizedAllowList=t.map(String)),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}}const $m=({...e})=>/*#__PURE__*/t("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:/*#__PURE__*/t("path",{d:"M4 12L12 4M4 4L12 12",stroke:"black",strokeOpacity:"0.8",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jm={phantom:{mobile:{native:"phantom://",universal:"https://phantom.app/ul/"}},solflare:{mobile:{native:void 0,universal:"https://solflare.com/ul/v1/"}}};var Vm=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"})]}),Hm=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 qm=/*#__PURE__*/bn.div.withConfig({displayName:"Header",componentId:"sc-5622aaf1-0"})(["display:flex;justify-content:space-between;align-items:center;"]),Km=/*#__PURE__*/bn.button.withConfig({displayName:"CloseButton",componentId:"sc-5622aaf1-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);"]),Zm=/*#__PURE__*/bn.div.withConfig({displayName:"WalletIconWithActiveIndicator",componentId:"sc-5622aaf1-2"})(["position:relative;&::after{content:' ';border-radius:var(--privy-border-radius-full);height:6px;width:6px;background-color:var(--privy-color-success);position:absolute;right:-3px;bottom:-3px;}"]),Ym=/*#__PURE__*/bn.img.withConfig({displayName:"WalletIcon",componentId:"sc-5622aaf1-3"})(["width:1.5rem;height:1.5rem;border-radius:0.25rem;object-fit:contain;"]),Gm=/*#__PURE__*/bn.span.withConfig({displayName:"Chip",componentId:"sc-5622aaf1-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-3);svg{width:100%;max-width:1rem;max-height:1rem;stroke-width:2;}"]),Jm=/*#__PURE__*/bn.div.withConfig({displayName:"ScrollContainer",componentId:"sc-5622aaf1-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)),Qm=Ln((()=>({isModalOpen:!1,resolvers:null})));let Xm=Ln((()=>({})));const eg=(e,t)=>Xm((n=>n[e]?.[t])),tg=(e,t,n)=>{Xm.setState((a=>({[e]:{...a[e],[t]:n}})))},ng=async()=>{let e,t,n=new Promise(((n,a)=>{e=n,t=a}));return Xm.setState({}),Qm.setState({isModalOpen:!0,resolvers:{resolve:e,reject:t}}),await n},ag=()=>{let e=Qm.getState().resolvers;e||console.warn("useActiveWalletStore: Called close while modal was not open"),Qm.setState({isModalOpen:!1}),e?.resolve({wallet:Qm.getState().wallet})},rg=({address:e,client:t,appId:n})=>{let a=`${t}:${e}`;n&&Ka.put(og(n),a),Qm.setState({wallet:a})},ig=()=>Qm((e=>e.isModalOpen)),og=e=>`privy:${e}:active-wallet-connection`;function sg({walletList:e,walletChainType:t}){let n=Go(),{connectors:a}=Ut(),r=So((e=>e.listings)),i=t??n.appearance.walletChainType,l=e??n.appearance?.walletList,c=s((()=>new zm(i,l)),[i,l]),{wallets:d,walletCount:h}=s((()=>c.getWallets(a,r)),[c,a,r]),[p,u]=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:u,wallets:m,walletCount:h}}let lg=e=>!e||"string"!=typeof e&&(e instanceof so||e instanceof _o);const cg=({index:a,style:r,data:i,recent:o})=>{let s=i.wallets[a],{walletChainType:l,handleWalletClick:c}=i,d={...r,boxSizing:"border-box"};return s?/*#__PURE__*/e(hg,{style:d,onClick:()=>c(s),children:[s.icon&&(s.connector&&!lg(s.connector)?/*#__PURE__*/t(Zm,{children:/*#__PURE__*/t(Ym,{src:s.icon})}):/*#__PURE__*/t(Ym,{src:s.icon})),/*#__PURE__*/t(yg,{children:s.label}),o?/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(pg,{children:/*#__PURE__*/e(n,{children:["ethereum-only"===l&&/*#__PURE__*/t(Vm,{}),"solana-only"===l&&/*#__PURE__*/t(Hm,{})]})}),/*#__PURE__*/t(Gm,{children:"Recent"})]}):/*#__PURE__*/t(pg,{children:!("ethereum-only"===l||"solana-only"===l)&&/*#__PURE__*/e(n,{children:[s.chains?.some((e=>e.startsWith("eip155")))&&/*#__PURE__*/t(Vm,{}),s.chains?.some((e=>e.startsWith("solana")))&&/*#__PURE__*/t(Hm,{})]})})]}):null};var dg=({showHeader:a=!0,className:r,suggestedAddress:l,customDescription:c,connectOnly:p,preSelectedWalletId:u,...m})=>{let y=Go(),{connectors:f}=Ut(),w=m.walletChainType||y.appearance.walletChainType,v=m.walletList||y.appearance?.walletList,{onBack:C,onClose:b,app:k}=m,{selected:T,setSelected:x,qrUrl:A,setQrUrl:I,connecting:_,uiState:S,wallets:E,handleConnect:N,handleBack:M,showSearchBar:P,isInitialConnectView:W,title:U,search:O,setSearch:L}=function({onConnect:e,onBack:t,onClose:n,walletList:a,walletChainType:r,app:i}){let l=Go(),{connectors:c}=Ut(),{wallets:d,walletCount:p,search:u,setSearch:m,selected:y,setSelected:f}=sg({walletList:a,walletChainType:r}),[w,v]=o(),[C,b]=o(),[k,T]=o(),x=!y&&!C&&!k,A=x&&(p>6||u.length>0),I=c.find((e=>"wallet_connect_v2"===e.connectorType)),_=h((async(t,n)=>{if(t){if(v("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 void v("error");v("success"),rg({address:n.address,client:n.walletClientType,appId:l.id}),setTimeout((()=>{e({connector:t,wallet:n})}),rr)}catch(t){v("error")}}}),[l.id,e]),S=h((()=>C?(v(void 0),T(void 0),void b(void 0)):k?(v(void 0),void T(void 0)):y?(v(void 0),T(void 0),void f(void 0)):"error"===w||"loading"===w?(v(void 0),void T(void 0)):void t?.()),[C,k,y,w,t]),E=s((()=>k?.connector===I&&C&&g?`Go to ${k.name} to continue`:k?.connector===I&&C?`Scan code to connect to ${k.name}`:"string"==typeof k?.connector?`Open or install ${k.name}`:y&&!k?"Select network":k?null:"Connect wallet"),[k,C,y,I]);return{selected:y,setSelected:f,qrUrl:C,setQrUrl:b,connecting:k,uiState:w,search:u,setSearch:m,wallets:d,walletCount:p,wc:I,isInitialConnectView:x,showSearchBar:A,title:E,handleConnect:_,handleBack:S,onClose:n,onConnect:e,app:i}}({...m,walletList:v,walletChainType:w}),R=f.find((e=>"wallet_connect_v2"===e.connectorType)),F=E.length>0,D=i(null),B=ha({count:E.length,getScrollElement:()=>D.current,estimateSize:()=>54,overscan:6,gap:5}),z=h((async e=>{let t,n="solana-only"!==w&&e.chains?.some((e=>e.startsWith("eip155"))),a="ethereum-only"!==w&&e.chains?.some((e=>e.startsWith("solana"))),r=vo[e.id];if(a&&r)t=r.getMobileRedirect({isSolana:!0,connectOnly:!!p,useUniversalLink:!1});else{let n=e.listing?.mobile?.native;t=e.listing?.mobile?.universal||n||e.url}if(n&&a){let n=zm.normalize(e.id),a=f.filter((e=>zm.normalize(e.walletClientType)===n&&!("ethereum"===e.chainType&&e instanceof so||"solana"===e.chainType&&e instanceof _o))),r=a.find((e=>"ethereum"===e.chainType)),i=a.find((e=>"solana"===e.chainType));if(!r&&e.listing){let t=jm[e.listing.slug]?{...e.listing,...jm[e.listing.slug]}:e.listing;R.setWalletEntry(t,I),await R.resetConnection(e.id),r=R}if(!i&&t&&(i=t),r||i)return void x({eth:r,sol:i,name:e.label,icon:e.icon})}if(lg(e.connector)){if(n||a||e.url||e.listing){if(n&&e.listing){let t=jm[e.listing.slug]?{...e.listing,...jm[e.listing.slug]}:e.listing;R.setWalletEntry(t,I),await R.resetConnection(e.id)}if(n&&a)return void x({eth:R,sol:t,name:e.label,icon:e.icon});if(a)return void await N(t,{name:e.label,icon:e.icon});if(n)return void(e.listing?await N(R,{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})}}else await N(e.connector,{name:e.label,icon:e.icon})}),[R,N,x,I,M,b,k,W,U,c,l,y,f]),$=u?C:M;return d((()=>{if(!u)return;let e=E.find((({id:e})=>e===u));e&&z(e).catch(console.error)}),[u]),/*#__PURE__*/e("div",{className:r,children:[a&&/*#__PURE__*/t(n,{children:/*#__PURE__*/e(qm,{children:[C||!W?/*#__PURE__*/t(Km,{onClick:$,children:/*#__PURE__*/t(Nn,{height:"1rem",width:"1rem",strokeWidth:1.5})}):/*#__PURE__*/t("div",{}),/*#__PURE__*/t(Km,{onClick:b,children:/*#__PURE__*/t($m,{})})]})}),/*#__PURE__*/t(fg,{title:a&&U||"",description:_&&!A&&"string"==typeof _.connector?`To connect to ${_.name}, install and open the app. Then confirm the connection when prompted.`:W?c??(l?/*#__PURE__*/e("span",{children:["Connect the wallet with address ",/*#__PURE__*/t(eh,{address:l})," ",k?.name?`to ${k.name}.`:"."]}):k?`Connect a wallet to your ${k.name} account`:null):null}),P&&/*#__PURE__*/e(n,{children:[/*#__PURE__*/e(om,{style:{marginTop:"0.5rem",background:"transparent"},children:[/*#__PURE__*/t(la,{}),/*#__PURE__*/t("input",{className:"login-method-button",type:"text",placeholder:"Search wallets",onChange:e=>L(e.target.value),value:O})]}),/*#__PURE__*/t(mg,{})]}),/*#__PURE__*/e(Jm,{ref:D,$colorScheme:y.appearance.palette.colorScheme,style:{marginBottom:A?"0.5rem":void 0},children:[A&&/*#__PURE__*/e(n,{children:[g?/*#__PURE__*/e(ug,{children:[_?.icon?/*#__PURE__*/t(Bm,{walletLogo:_.icon,success:"success"===S,fail:"error"===S}):null,/*#__PURE__*/e("h3",{children:["Waiting for ",_?.name??"connection"]})]}):/*#__PURE__*/t(am,{size:280,url:A.universal??A.native,squareLogoElement:_?.icon?"string"==typeof _.icon?e=>/*#__PURE__*/t("svg",{...e,children:/*#__PURE__*/t("image",{href:_.icon,height:e.height,width:e.width})}):_.icon:ts}),g&&"loading"===S&&/*#__PURE__*/t(El,{style:{marginTop:"0.5rem"},onClick:()=>window.open(A.universal??A.native,"_blank"),children:"Open in app"})]}),_&&!A&&"string"!=typeof _.connector&&/*#__PURE__*/e(ug,{children:[_.icon?/*#__PURE__*/t(Bm,{walletLogo:_.icon,success:"success"===S,fail:"error"===S}):null,/*#__PURE__*/e("h3",{children:["Waiting for ",_.name]}),/*#__PURE__*/t(cm,{children:"error"===S?"Please try connecting again.":"For the best experience, connect only one wallet at a time."}),"error"===S&&/*#__PURE__*/t(El,{style:{marginTop:"1.5rem"},onClick:()=>N(_.connector,{name:_.name,icon:_.icon}),children:"Retry"})]}),_&&!A&&"string"==typeof _.connector&&/*#__PURE__*/t(n,{children:/*#__PURE__*/e(hg,{onClick:()=>window.open(_.connector,"_blank"),children:[_.icon&&("string"==typeof _.icon?/*#__PURE__*/t(Ym,{src:_.icon}):/*#__PURE__*/t(_.icon,{})),/*#__PURE__*/t(yg,{children:_.name})]})}),T?.eth&&!_&&/*#__PURE__*/e(hg,{onClick:()=>N(T.eth,{name:T.name,icon:T.icon}),children:[T.icon&&("string"==typeof T.icon?/*#__PURE__*/t(Ym,{src:T.icon}):/*#__PURE__*/t(T.icon,{})),/*#__PURE__*/t(yg,{children:T.name}),/*#__PURE__*/t(pg,{children:/*#__PURE__*/t(Vm,{})})]}),T?.sol&&!_&&/*#__PURE__*/e(hg,{onClick:()=>N(T.sol,{name:T.name,icon:T.icon}),children:[T.icon&&("string"==typeof T.icon?/*#__PURE__*/t(Ym,{src:T.icon}):/*#__PURE__*/t(T.icon,{})),/*#__PURE__*/t(yg,{children:T.name}),/*#__PURE__*/t(pg,{children:/*#__PURE__*/t(Hm,{})})]}),W&&/*#__PURE__*/e(n,{children:[!F&&/*#__PURE__*/t(gg,{children:"No wallets found. Try another search."}),E.length>0&&/*#__PURE__*/t("div",{style:{height:54*Math.min(E.length+1,5),width:"100%"},children:/*#__PURE__*/t("div",{style:{height:`${B.getTotalSize()}px`,width:"100%",position:"relative"},children:B.getVirtualItems().map((e=>/*#__PURE__*/t(cg,{index:e.index,style:{position:"absolute",top:0,left:0,height:`${e.size}px`,transform:`translateY(${e.start}px)`},data:{wallets:E,walletChainType:w,handleWalletClick:z}},e.key)))})})]})]})]})};let hg=/*#__PURE__*/bn.button.withConfig({displayName:"Button",componentId:"sc-a459b5ac-0"})(["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-mdlg);margin:0 2px;padding:1em;border:1px solid var(--privy-color-foreground-4);}svg{stroke-width:2.5;width:100%;max-height:1rem;max-width:1rem;flex-shrink:0;}&:hover{background:var(--privy-color-background-2);}"]),pg=/*#__PURE__*/bn.span.withConfig({displayName:"ButtonBadge",componentId:"sc-a459b5ac-1"})(["display:flex;align-items:center;justify-content:end;margin-left:auto;position:relative;& > svg{border-radius:var(--privy-border-radius-full);}& > svg:not(:last-child){border-radius:var(--privy-border-radius-full);margin-right:-0.375rem;}"]),ug=/*#__PURE__*/bn.div.withConfig({displayName:"ConnectContainer",componentId:"sc-a459b5ac-2"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;h3{margin-top:1.5rem;font-size:1rem;font-weight:500;line-height:1.5rem;}"]),mg=/*#__PURE__*/bn.div.withConfig({displayName:"SearchDivider",componentId:"sc-a459b5ac-3"})(["width:100%;height:0.5rem;"]),gg=/*#__PURE__*/bn.div.withConfig({displayName:"EmptyContainer",componentId:"sc-a459b5ac-4"})(["height:60px;display:flex;align-items:center;justify-content:center;text-align:center;"]),yg=/*#__PURE__*/bn.span.withConfig({displayName:"WalletName",componentId:"sc-a459b5ac-5"})(["text-overflow:ellipsis;white-space:nowrap;"]),fg=/*#__PURE__*/bn(Mh).withConfig({displayName:"StyledCenteredScreenHeader",componentId:"sc-a459b5ac-6"})(["gap:8px;margin-bottom:8px;h3{margin-bottom:0;}"]);const wg=({...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"})})})]}),vg={component:()=>{let{client:a,setWalletConnectionStatus:r,closePrivyModal:o}=Ut(),{app:s,data:l,navigate:c}=es(),d=l?.externalConnectWallet?.description,p=i(l?.externalConnectWallet?.suggestedAddress).current,u=i(l?.externalConnectWallet?.walletList??s.appearance.walletList),m=i(l?.externalConnectWallet?.walletChainType??s.appearance.walletChainType);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Cg,{walletList:u.current,walletChainType:m.current,onClose:o,onConnect:h((({connector:e,wallet:t})=>{let n="ethereum"===t.type?new ei(a,t,void 0,l?.login?.disableSignup):new ai(t,a,void 0,l?.login?.disableSignup);a.startAuthFlow(n),r({status:"connected",connectedWallet:t,connector:e,connectError:null,connectRetry:()=>null}),c(Rm,!l?.externalConnectWallet?.preSelectedWalletId)}),[a,r,c]),onBack:()=>c(of),suggestedAddress:p,customDescription:d||"",preSelectedWalletId:l?.externalConnectWallet?.preSelectedWalletId,app:s}),s&&/*#__PURE__*/t(Hs,{app:s}),/*#__PURE__*/t(qs,{})]})},isUnauthenticatedScreem:!0};let Cg=/*#__PURE__*/bn(dg).withConfig({displayName:"StyledConnectWalletView",componentId:"sc-2aeb55a1-0"})(["padding:0;padding-top:1em;"]);const bg={component:()=>{let{closePrivyModal:a}=Ut(),{app:r,data:o}=es(),s=o?.externalConnectWallet?.description,l=i(o?.externalConnectWallet?.suggestedAddress).current,c=i(o?.externalConnectWallet?.walletList??r.appearance.walletList),d=i(o?.externalConnectWallet?.walletChainType??r.appearance.walletChainType);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(kg,{connectOnly:!0,walletList:c.current,walletChainType:d.current,onClose:a,onConnect:()=>a(),suggestedAddress:l,customDescription:s,app:r}),r&&/*#__PURE__*/t(Hs,{app:r,alwaysShowImplicitConsent:!0}),/*#__PURE__*/t(qs,{})]})},isUnauthenticatedScreem:!0};let kg=/*#__PURE__*/bn(dg).withConfig({displayName:"StyledConnectWalletView",componentId:"sc-a6929795-0"})(["padding:0;padding-top:1em;"]);const Tg=({chainType:n,withPadding:a})=>{let r="";return r="ethereum-only"===n||"ethereum-and-solana"===n?"Rainbow, Phantom, or Coinbase Wallet":"Phantom or Solflare",/*#__PURE__*/t(zs,{$withPadding:a,children:/*#__PURE__*/e($s,{children:[/*#__PURE__*/t(Mn,{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 ",r,"."]})]})},"empty-wallet-state")};let xg=/*#__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 Ag=/*#__PURE__*/kn(["",""],(e=>e.$isLoading?/*#__PURE__*/kn(["width:35%;animation:"," 2s linear infinite;border-radius:var(--privy-border-radius-sm);"],xg):"")),Ig=({children:e,color:n,isLoading:a,isPulsing:r,...i})=>/*#__PURE__*/t(_g,{$color:n,$isLoading:a,$isPulsing:r,...i,children:e});let _g=/*#__PURE__*/bn.span.withConfig({displayName:"StyledSpan",componentId:"sc-eba15c9-0"})(["padding:0.125rem 0.5rem;font-size:0.75rem;font-weight:500;line-height:1.125rem;border-radius:var(--privy-border-radius-sm);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 a=/*#__PURE__*/xn(["from,to{background-color:",";}50%{background-color:rgba(",",0.8);}"],n,n);/*#__PURE__*/return kn(["color:",";background-color:",";",";"],t,n,e.$isPulsing&&/*#__PURE__*/kn(["animation:"," 3s linear infinite;"],a))}),Ag);const Sg=({style:n,...a})=>/*#__PURE__*/e("svg",{width:"1000",height:"1000",viewBox:"0 0 1000 1000",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",...n},...a,children:[/*#__PURE__*/t("rect",{width:"1000",height:"1000",rx:"200",fill:"#855DCD"}),/*#__PURE__*/t("path",{d:"M257.778 155.556H742.222V844.444H671.111V528.889H670.414C662.554 441.677 589.258 373.333 500 373.333C410.742 373.333 337.446 441.677 329.586 528.889H328.889V844.444H257.778V155.556Z",fill:"white"}),/*#__PURE__*/t("path",{d:"M128.889 253.333L157.778 351.111H182.222V746.667C169.949 746.667 160 756.616 160 768.889V795.556H155.556C143.283 795.556 133.333 805.505 133.333 817.778V844.444H382.222V817.778C382.222 805.505 372.273 795.556 360 795.556H355.556V768.889C355.556 756.616 345.606 746.667 333.333 746.667H306.667V253.333H128.889Z",fill:"white"}),/*#__PURE__*/t("path",{d:"M675.556 746.667C663.283 746.667 653.333 756.616 653.333 768.889V795.556H648.889C636.616 795.556 626.667 805.505 626.667 817.778V844.444H875.556V817.778C875.556 805.505 865.606 795.556 853.333 795.556H848.889V768.889C848.889 756.616 838.94 746.667 826.667 746.667V351.111H851.111L880 253.333H702.222V746.667H675.556Z",fill:"white"})]}),Eg=({style:e,color:n,...a})=>/*#__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},...a,children:/*#__PURE__*/t("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),Ng=({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"})})}),Mg=n=>{let[a,r]=o(!1);/*#__PURE__*/return e(Pg,{color:n.color,onClick:()=>{r(!0),navigator.clipboard.writeText(n.text),setTimeout((()=>r(!1)),1500)},$justCopied:a,children:[a?/*#__PURE__*/t(Eg,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):/*#__PURE__*/t(Ng,{style:{height:"14px",width:"14px"}}),a?"Copied":"Copy"," ",n.itemName?n.itemName:"to Clipboard"]})};let Pg=/*#__PURE__*/bn.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 Wg=e=>{let[n,a]=o(!1);/*#__PURE__*/return t(Ug,{color:e.color,href:e.url,target:"_blank",rel:"noreferrer noopener",onClick:()=>{a(!0),setTimeout((()=>a(!1)),1500)},justOpened:n,children:e.text})};let Ug=/*#__PURE__*/bn.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)")),Og="#8a63d2";const Lg={component:()=>{let{authenticated:a,logout:r,ready:s,user:l}=rn(),{lastScreen:c,navigate:h,navigateBack:p,setModalData:u,app:m}=es(),{getAuthFlow:f,loginWithFarcaster:w,closePrivyModal:v,createAnalyticsEvent:C}=Ut(),[b,k]=o(void 0),[T,x]=o(!1),[A,I]=o(!1),_=i([]),S=f(),E=S?.meta.connectUri;return d((()=>{let e=Date.now(),t=setInterval((async()=>{let n=await S.pollForReady.execute(),a=Date.now()-e;if(n){clearInterval(t),x(!0);try{await w(),I(!0)}catch(e){let t={retryable:!1,message:"Authentication failed"};if(e?.privyErrorCode===Te.ALLOWLIST_REJECTED)return void h(ym);if(e?.privyErrorCode===Te.USER_LIMIT_REACHED)return console.error(new Et(e).toString()),void h(Pm);if(e?.privyErrorCode===Te.USER_DOES_NOT_EXIST)return void h(ou);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 h(Lu);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.")}k(t)}}else a>12e4&&(clearInterval(t),k({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))}),2e3);return()=>{clearInterval(t),_.current.forEach((e=>clearTimeout(e)))}}),[]),d((()=>{if(s&&a&&A&&l){if(m?.legal.requireUsersAcceptTerms&&!l.hasAcceptedTerms){let e=setTimeout((()=>{h(qu)}),rr);return()=>clearTimeout(e)}A&&(ru(l,m.embeddedWallets)?_.current.push(setTimeout((()=>{u({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),C({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"FarcasterConnectStatusScreen"}}),r()},callAuthOnSuccessOnClose:!0}}),h(Vu)}),rr)):_.current.push(setTimeout((()=>v({shouldCallAuthOnSuccess:!0,isSuccess:!0})),rr)))}}),[A,s,a,l]),/*#__PURE__*/e(n,g||T?{children:[/*#__PURE__*/t(Js,{backFn:c?p:void 0,onClose:v},"header"),/*#__PURE__*/t(Mc,{}),
18
+ /*#__PURE__*/t("span",{style:{background:`url('${r}') 0 0 / contain`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"contain"}}):/*#__PURE__*/t(r,{style:{width:"38px",height:"38px"}})]})})})};class zm{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=zm.normalize(e);return this.normalizedAllowList.some((e=>n===zm.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,a=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=zm.normalize(e.walletClientType);a({id:t,label:e.walletBranding?.name??t,source:"connector",connector:e,chainType:e.chainType,icon:"string"==typeof e.walletBranding?.icon?e.walletBranding.icon:void 0,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),r=zm.normalize(e.slug);a({id:r,label:e.name||r,source:"listing",listing:e,chainType:t&&n?"multi":t?"ethereum":"solana",icon:e.image_url?.sm,url:e.homepage,chains:e.chains})}));let r=Array.from(n.values()),i=new Map;return this.normalizedAllowList?.forEach(((e,t)=>{i.set(zm.normalize(e),t)})),{wallets:r.slice().sort(((e,t)=>{let n=zm.normalize(e.id),a=zm.normalize(t.id);"binanceus"===n||"binance-defi"===n?n="binance":"universalprofiles"===n?n="universal_profile":"cryptocom-defi"===n&&(n="cryptocom"),"binanceus"===a||"binance-defi"===a?a="binance":"universalprofiles"===a?a="universal_profile":"cryptocom-defi"===a&&(a="cryptocom");let r=i.has(n),o=i.has(a);return r&&o?i.get(n)-i.get(a):r?-1:o?1:"connector"===e.source&&"listing"===t.source?-1:"listing"===e.source&&"connector"===t.source?1:e.label.toLowerCase().localeCompare(t.label.toLowerCase())})),walletCount:r.length}}constructor(e,t){this.chainFilter=e,t&&t.length>0&&(this.normalizedAllowList=t.map(String)),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}}const $m=({...e})=>/*#__PURE__*/t("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:/*#__PURE__*/t("path",{d:"M4 12L12 4M4 4L12 12",stroke:"black",strokeOpacity:"0.8",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jm={phantom:{mobile:{native:"phantom://",universal:"https://phantom.app/ul/"}},solflare:{mobile:{native:void 0,universal:"https://solflare.com/ul/v1/"}}};var Vm=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"})]}),Hm=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 qm=/*#__PURE__*/bn.div.withConfig({displayName:"Header",componentId:"sc-5622aaf1-0"})(["display:flex;justify-content:space-between;align-items:center;"]),Km=/*#__PURE__*/bn.button.withConfig({displayName:"CloseButton",componentId:"sc-5622aaf1-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);"]),Zm=/*#__PURE__*/bn.div.withConfig({displayName:"WalletIconWithActiveIndicator",componentId:"sc-5622aaf1-2"})(["position:relative;&::after{content:' ';border-radius:var(--privy-border-radius-full);height:6px;width:6px;background-color:var(--privy-color-success);position:absolute;right:-3px;bottom:-3px;}"]),Ym=/*#__PURE__*/bn.img.withConfig({displayName:"WalletIcon",componentId:"sc-5622aaf1-3"})(["width:1.5rem;height:1.5rem;border-radius:0.25rem;object-fit:contain;"]),Gm=/*#__PURE__*/bn.span.withConfig({displayName:"Chip",componentId:"sc-5622aaf1-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-3);svg{width:100%;max-width:1rem;max-height:1rem;stroke-width:2;}"]),Jm=/*#__PURE__*/bn.div.withConfig({displayName:"ScrollContainer",componentId:"sc-5622aaf1-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)),Qm=Ln((()=>({isModalOpen:!1,resolvers:null})));let Xm=Ln((()=>({})));const eg=(e,t)=>Xm((n=>n[e]?.[t])),tg=(e,t,n)=>{Xm.setState((a=>({[e]:{...a[e],[t]:n}})))},ng=async()=>{let e,t,n=new Promise(((n,a)=>{e=n,t=a}));return Xm.setState({}),Qm.setState({isModalOpen:!0,resolvers:{resolve:e,reject:t}}),await n},ag=()=>{let e=Qm.getState().resolvers;e||console.warn("useActiveWalletStore: Called close while modal was not open"),Qm.setState({isModalOpen:!1}),e?.resolve({wallet:Qm.getState().wallet})},rg=({address:e,client:t,appId:n})=>{let a=`${t}:${e}`;n&&Ka.put(og(n),a),Qm.setState({wallet:a})},ig=()=>Qm((e=>e.isModalOpen)),og=e=>`privy:${e}:active-wallet-connection`;function sg({walletList:e,walletChainType:t}){let n=Go(),{connectors:a}=Ut(),r=So((e=>e.listings)),i=t??n.appearance.walletChainType,l=e??n.appearance?.walletList,c=s((()=>new zm(i,l)),[i,l]),{wallets:d,walletCount:h}=s((()=>c.getWallets(a,r)),[c,a,r]),[p,u]=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:u,wallets:m,walletCount:h}}let lg=e=>!e||"string"!=typeof e&&(e instanceof so||e instanceof _o);const cg=({index:a,style:r,data:i,recent:o})=>{let s=i.wallets[a],{walletChainType:l,handleWalletClick:c}=i,d={...r,boxSizing:"border-box"};return s?/*#__PURE__*/e(hg,{style:d,onClick:()=>c(s),children:[s.icon&&(s.connector&&!lg(s.connector)?/*#__PURE__*/t(Zm,{children:/*#__PURE__*/t(Ym,{src:s.icon})}):/*#__PURE__*/t(Ym,{src:s.icon})),/*#__PURE__*/t(yg,{children:s.label}),o?/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(pg,{children:/*#__PURE__*/e(n,{children:["ethereum-only"===l&&/*#__PURE__*/t(Vm,{}),"solana-only"===l&&/*#__PURE__*/t(Hm,{})]})}),/*#__PURE__*/t(Gm,{children:"Recent"})]}):/*#__PURE__*/t(pg,{children:!("ethereum-only"===l||"solana-only"===l)&&/*#__PURE__*/e(n,{children:[s.chains?.some((e=>e.startsWith("eip155")))&&/*#__PURE__*/t(Vm,{}),s.chains?.some((e=>e.startsWith("solana")))&&/*#__PURE__*/t(Hm,{})]})})]}):null};var dg=({showHeader:a=!0,className:r,suggestedAddress:l,customDescription:c,connectOnly:p,preSelectedWalletId:u,...m})=>{let y=Go(),{connectors:f}=Ut(),w=m.walletChainType||y.appearance.walletChainType,v=m.walletList||y.appearance?.walletList,{onBack:C,onClose:b,app:k}=m,{selected:T,setSelected:x,qrUrl:A,setQrUrl:I,connecting:_,uiState:S,wallets:E,handleConnect:N,handleBack:M,showSearchBar:P,isInitialConnectView:W,title:U,search:O,setSearch:L}=function({onConnect:e,onBack:t,onClose:n,walletList:a,walletChainType:r,app:i}){let l=Go(),{connectors:c}=Ut(),{wallets:d,walletCount:p,search:u,setSearch:m,selected:y,setSelected:f}=sg({walletList:a,walletChainType:r}),[w,v]=o(),[C,b]=o(),[k,T]=o(),x=!y&&!C&&!k,A=x&&(p>6||u.length>0),I=c.find((e=>"wallet_connect_v2"===e.connectorType)),_=h((async(t,n)=>{if(t){if(v("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 void v("error");v("success"),rg({address:n.address,client:n.walletClientType,appId:l.id}),setTimeout((()=>{e({connector:t,wallet:n})}),rr)}catch(t){v("error")}}}),[l.id,e]),S=h((()=>C?(v(void 0),T(void 0),void b(void 0)):k?(v(void 0),void T(void 0)):y?(v(void 0),T(void 0),void f(void 0)):"error"===w||"loading"===w?(v(void 0),void T(void 0)):void t?.()),[C,k,y,w,t]),E=s((()=>k?.connector===I&&C&&g?`Go to ${k.name} to continue`:k?.connector===I&&C?`Scan code to connect to ${k.name}`:"string"==typeof k?.connector?`Open or install ${k.name}`:y&&!k?"Select network":k?null:"Connect wallet"),[k,C,y,I]);return{selected:y,setSelected:f,qrUrl:C,setQrUrl:b,connecting:k,uiState:w,search:u,setSearch:m,wallets:d,walletCount:p,wc:I,isInitialConnectView:x,showSearchBar:A,title:E,handleConnect:_,handleBack:S,onClose:n,onConnect:e,app:i}}({...m,walletList:v,walletChainType:w}),R=f.find((e=>"wallet_connect_v2"===e.connectorType)),F=E.length>0,D=i(null),B=ha({count:E.length,getScrollElement:()=>D.current,estimateSize:()=>54,overscan:6,gap:5}),z=h((async e=>{let t,n="solana-only"!==w&&e.chains?.some((e=>e.startsWith("eip155"))),a="ethereum-only"!==w&&e.chains?.some((e=>e.startsWith("solana"))),r=vo[e.id];if(a&&r)t=r.getMobileRedirect({isSolana:!0,connectOnly:!!p,useUniversalLink:!1});else{let n=e.listing?.mobile?.native;t=e.listing?.mobile?.universal||n||e.url}if(n&&a){let n=zm.normalize(e.id),a=f.filter((e=>zm.normalize(e.walletClientType)===n&&!("ethereum"===e.chainType&&e instanceof so||"solana"===e.chainType&&e instanceof _o))),r=a.find((e=>"ethereum"===e.chainType)),i=a.find((e=>"solana"===e.chainType));if(!r&&e.listing){let t=jm[e.listing.slug]?{...e.listing,...jm[e.listing.slug]}:e.listing;R.setWalletEntry(t,I),await R.resetConnection(e.id),r=R}if(!i&&t&&(i=t),r||i)return void x({eth:r,sol:i,name:e.label,icon:e.icon})}if(lg(e.connector)){if(n||a||e.url||e.listing){if(n&&e.listing){let t=jm[e.listing.slug]?{...e.listing,...jm[e.listing.slug]}:e.listing;R.setWalletEntry(t,I),await R.resetConnection(e.id)}if(n&&a)return void x({eth:R,sol:t,name:e.label,icon:e.icon});if(a)return void await N(t,{name:e.label,icon:e.icon});if(n)return void(e.listing?await N(R,{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})}}else await N(e.connector,{name:e.label,icon:e.icon})}),[R,N,x,I,M,b,k,W,U,c,l,y,f]),$=u?C:M;return d((()=>{if(!u)return;let e=E.find((({id:e})=>e===u));e&&z(e).catch(console.error)}),[u]),/*#__PURE__*/e("div",{className:r,children:[a&&/*#__PURE__*/t(n,{children:/*#__PURE__*/e(qm,{children:[C||!W?/*#__PURE__*/t(Km,{onClick:$,children:/*#__PURE__*/t(Nn,{height:"1rem",width:"1rem",strokeWidth:1.5})}):/*#__PURE__*/t("div",{}),/*#__PURE__*/t(Km,{onClick:b,children:/*#__PURE__*/t($m,{})})]})}),/*#__PURE__*/t(fg,{title:a&&U||"",description:_&&!A&&"string"==typeof _.connector?`To connect to ${_.name}, install and open the app. Then confirm the connection when prompted.`:W?c??(l?/*#__PURE__*/e("span",{children:["Connect the wallet with address ",/*#__PURE__*/t(eh,{address:l})," ",k?.name?`to ${k.name}.`:"."]}):k?`Connect a wallet to your ${k.name} account`:null):null}),P&&/*#__PURE__*/e(n,{children:[/*#__PURE__*/e(om,{style:{marginTop:"0.5rem",background:"transparent"},children:[/*#__PURE__*/t(la,{}),/*#__PURE__*/t("input",{className:"login-method-button",type:"text",placeholder:"Search wallets",onChange:e=>L(e.target.value),value:O})]}),/*#__PURE__*/t(mg,{})]}),/*#__PURE__*/e(Jm,{ref:D,$colorScheme:y.appearance.palette.colorScheme,style:{marginBottom:A?"0.5rem":void 0},children:[A&&/*#__PURE__*/e(n,{children:[g?/*#__PURE__*/e(ug,{children:[_?.icon?/*#__PURE__*/t(Bm,{walletLogo:_.icon,success:"success"===S,fail:"error"===S}):null,/*#__PURE__*/e("h3",{children:["Waiting for ",_?.name??"connection"]})]}):/*#__PURE__*/t(am,{size:280,url:A.universal??A.native,squareLogoElement:_?.icon?"string"==typeof _.icon?e=>/*#__PURE__*/t("svg",{...e,children:/*#__PURE__*/t("image",{href:_.icon,height:e.height,width:e.width})}):_.icon:ts}),g&&"loading"===S&&/*#__PURE__*/t(El,{style:{marginTop:"0.5rem"},onClick:()=>window.open(A.universal??A.native,"_blank"),children:"Open in app"})]}),_&&!A&&"string"!=typeof _.connector&&/*#__PURE__*/e(ug,{children:[_.icon?/*#__PURE__*/t(Bm,{walletLogo:_.icon,success:"success"===S,fail:"error"===S}):null,/*#__PURE__*/e("h3",{children:["Waiting for ",_.name]}),/*#__PURE__*/t(cm,{children:"error"===S?"Please try connecting again.":"For the best experience, connect only one wallet at a time."}),"error"===S&&/*#__PURE__*/t(El,{style:{marginTop:"1.5rem"},onClick:()=>N(_.connector,{name:_.name,icon:_.icon}),children:"Retry"})]}),_&&!A&&"string"==typeof _.connector&&/*#__PURE__*/t(n,{children:/*#__PURE__*/e(hg,{onClick:()=>window.open(_.connector,"_blank"),children:[_.icon&&("string"==typeof _.icon?/*#__PURE__*/t(Ym,{src:_.icon}):/*#__PURE__*/t(_.icon,{})),/*#__PURE__*/t(yg,{children:_.name})]})}),T?.eth&&!_&&/*#__PURE__*/e(hg,{onClick:()=>N(T.eth,{name:T.name,icon:T.icon}),children:[T.icon&&("string"==typeof T.icon?/*#__PURE__*/t(Ym,{src:T.icon}):/*#__PURE__*/t(T.icon,{})),/*#__PURE__*/t(yg,{children:T.name}),/*#__PURE__*/t(pg,{children:/*#__PURE__*/t(Vm,{})})]}),T?.sol&&!_&&/*#__PURE__*/e(hg,{onClick:()=>N(T.sol,{name:T.name,icon:T.icon}),children:[T.icon&&("string"==typeof T.icon?/*#__PURE__*/t(Ym,{src:T.icon}):/*#__PURE__*/t(T.icon,{})),/*#__PURE__*/t(yg,{children:T.name}),/*#__PURE__*/t(pg,{children:/*#__PURE__*/t(Hm,{})})]}),W&&/*#__PURE__*/e(n,{children:[!F&&/*#__PURE__*/t(gg,{children:"No wallets found. Try another search."}),E.length>0&&/*#__PURE__*/t("div",{style:{height:54*Math.min(E.length+1,5),width:"100%"},children:/*#__PURE__*/t("div",{style:{height:`${B.getTotalSize()}px`,width:"100%",position:"relative"},children:B.getVirtualItems().map((e=>/*#__PURE__*/t(cg,{index:e.index,style:{position:"absolute",top:0,left:0,height:`${e.size}px`,transform:`translateY(${e.start}px)`},data:{wallets:E,walletChainType:w,handleWalletClick:z}},e.key)))})})]})]})]})};let hg=/*#__PURE__*/bn.button.withConfig({displayName:"Button",componentId:"sc-a459b5ac-0"})(["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-mdlg);margin:0 2px;padding:1em;border:1px solid var(--privy-color-foreground-4);}svg{stroke-width:2.5;width:100%;max-height:1rem;max-width:1rem;flex-shrink:0;}&:hover{background:var(--privy-color-background-2);}"]),pg=/*#__PURE__*/bn.span.withConfig({displayName:"ButtonBadge",componentId:"sc-a459b5ac-1"})(["display:flex;align-items:center;justify-content:end;margin-left:auto;position:relative;& > svg{border-radius:var(--privy-border-radius-full);}& > svg:not(:last-child){border-radius:var(--privy-border-radius-full);margin-right:-0.375rem;}"]),ug=/*#__PURE__*/bn.div.withConfig({displayName:"ConnectContainer",componentId:"sc-a459b5ac-2"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;h3{margin-top:1.5rem;font-size:1rem;font-weight:500;line-height:1.5rem;}"]),mg=/*#__PURE__*/bn.div.withConfig({displayName:"SearchDivider",componentId:"sc-a459b5ac-3"})(["width:100%;height:0.5rem;"]),gg=/*#__PURE__*/bn.div.withConfig({displayName:"EmptyContainer",componentId:"sc-a459b5ac-4"})(["height:60px;display:flex;align-items:center;justify-content:center;text-align:center;"]),yg=/*#__PURE__*/bn.span.withConfig({displayName:"WalletName",componentId:"sc-a459b5ac-5"})(["text-overflow:ellipsis;white-space:nowrap;"]),fg=/*#__PURE__*/bn(Mh).withConfig({displayName:"StyledCenteredScreenHeader",componentId:"sc-a459b5ac-6"})(["gap:8px;margin-bottom:8px;h3{margin-bottom:0;}"]);const wg=({...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"})})})]}),vg={component:()=>{let{setWalletConnectionStatus:a,closePrivyModal:r}=Ut(),{app:o,data:s,navigate:l}=es(),c=s?.externalConnectWallet?.description,d=i(s?.externalConnectWallet?.suggestedAddress).current,p=i(s?.externalConnectWallet?.walletList??o.appearance.walletList),u=i(s?.externalConnectWallet?.walletChainType??o.appearance.walletChainType);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Cg,{walletList:p.current,walletChainType:u.current,onClose:r,onConnect:h((({connector:e,wallet:t})=>{a({status:"connected",connectedWallet:t,connector:e,connectError:null,connectRetry:()=>null}),l(Rm,!s?.externalConnectWallet?.preSelectedWalletId)}),[a,l,s?.externalConnectWallet?.preSelectedWalletId]),onBack:()=>l(of),suggestedAddress:d,customDescription:c||"",preSelectedWalletId:s?.externalConnectWallet?.preSelectedWalletId,app:o}),o&&/*#__PURE__*/t(Hs,{app:o}),/*#__PURE__*/t(qs,{})]})},isUnauthenticatedScreem:!0};let Cg=/*#__PURE__*/bn(dg).withConfig({displayName:"StyledConnectWalletView",componentId:"sc-b3924de-0"})(["padding:0;padding-top:1em;"]);const bg={component:()=>{let{closePrivyModal:a}=Ut(),{app:r,data:o}=es(),s=o?.externalConnectWallet?.description,l=i(o?.externalConnectWallet?.suggestedAddress).current,c=i(o?.externalConnectWallet?.walletList??r.appearance.walletList),d=i(o?.externalConnectWallet?.walletChainType??r.appearance.walletChainType);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(kg,{connectOnly:!0,walletList:c.current,walletChainType:d.current,onClose:a,onConnect:()=>a(),suggestedAddress:l,customDescription:s,app:r}),r&&/*#__PURE__*/t(Hs,{app:r,alwaysShowImplicitConsent:!0}),/*#__PURE__*/t(qs,{})]})},isUnauthenticatedScreem:!0};let kg=/*#__PURE__*/bn(dg).withConfig({displayName:"StyledConnectWalletView",componentId:"sc-a6929795-0"})(["padding:0;padding-top:1em;"]);const Tg=({chainType:n,withPadding:a})=>{let r="";return r="ethereum-only"===n||"ethereum-and-solana"===n?"Rainbow, Phantom, or Coinbase Wallet":"Phantom or Solflare",/*#__PURE__*/t(zs,{$withPadding:a,children:/*#__PURE__*/e($s,{children:[/*#__PURE__*/t(Mn,{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 ",r,"."]})]})},"empty-wallet-state")};let xg=/*#__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 Ag=/*#__PURE__*/kn(["",""],(e=>e.$isLoading?/*#__PURE__*/kn(["width:35%;animation:"," 2s linear infinite;border-radius:var(--privy-border-radius-sm);"],xg):"")),Ig=({children:e,color:n,isLoading:a,isPulsing:r,...i})=>/*#__PURE__*/t(_g,{$color:n,$isLoading:a,$isPulsing:r,...i,children:e});let _g=/*#__PURE__*/bn.span.withConfig({displayName:"StyledSpan",componentId:"sc-eba15c9-0"})(["padding:0.125rem 0.5rem;font-size:0.75rem;font-weight:500;line-height:1.125rem;border-radius:var(--privy-border-radius-sm);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 a=/*#__PURE__*/xn(["from,to{background-color:",";}50%{background-color:rgba(",",0.8);}"],n,n);/*#__PURE__*/return kn(["color:",";background-color:",";",";"],t,n,e.$isPulsing&&/*#__PURE__*/kn(["animation:"," 3s linear infinite;"],a))}),Ag);const Sg=({style:n,...a})=>/*#__PURE__*/e("svg",{width:"1000",height:"1000",viewBox:"0 0 1000 1000",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",...n},...a,children:[/*#__PURE__*/t("rect",{width:"1000",height:"1000",rx:"200",fill:"#855DCD"}),/*#__PURE__*/t("path",{d:"M257.778 155.556H742.222V844.444H671.111V528.889H670.414C662.554 441.677 589.258 373.333 500 373.333C410.742 373.333 337.446 441.677 329.586 528.889H328.889V844.444H257.778V155.556Z",fill:"white"}),/*#__PURE__*/t("path",{d:"M128.889 253.333L157.778 351.111H182.222V746.667C169.949 746.667 160 756.616 160 768.889V795.556H155.556C143.283 795.556 133.333 805.505 133.333 817.778V844.444H382.222V817.778C382.222 805.505 372.273 795.556 360 795.556H355.556V768.889C355.556 756.616 345.606 746.667 333.333 746.667H306.667V253.333H128.889Z",fill:"white"}),/*#__PURE__*/t("path",{d:"M675.556 746.667C663.283 746.667 653.333 756.616 653.333 768.889V795.556H648.889C636.616 795.556 626.667 805.505 626.667 817.778V844.444H875.556V817.778C875.556 805.505 865.606 795.556 853.333 795.556H848.889V768.889C848.889 756.616 838.94 746.667 826.667 746.667V351.111H851.111L880 253.333H702.222V746.667H675.556Z",fill:"white"})]}),Eg=({style:e,color:n,...a})=>/*#__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},...a,children:/*#__PURE__*/t("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),Ng=({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"})})}),Mg=n=>{let[a,r]=o(!1);/*#__PURE__*/return e(Pg,{color:n.color,onClick:()=>{r(!0),navigator.clipboard.writeText(n.text),setTimeout((()=>r(!1)),1500)},$justCopied:a,children:[a?/*#__PURE__*/t(Eg,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):/*#__PURE__*/t(Ng,{style:{height:"14px",width:"14px"}}),a?"Copied":"Copy"," ",n.itemName?n.itemName:"to Clipboard"]})};let Pg=/*#__PURE__*/bn.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 Wg=e=>{let[n,a]=o(!1);/*#__PURE__*/return t(Ug,{color:e.color,href:e.url,target:"_blank",rel:"noreferrer noopener",onClick:()=>{a(!0),setTimeout((()=>a(!1)),1500)},justOpened:n,children:e.text})};let Ug=/*#__PURE__*/bn.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)")),Og="#8a63d2";const Lg={component:()=>{let{authenticated:a,logout:r,ready:s,user:l}=rn(),{lastScreen:c,navigate:h,navigateBack:p,setModalData:u,app:m}=es(),{getAuthFlow:f,loginWithFarcaster:w,closePrivyModal:v,createAnalyticsEvent:C}=Ut(),[b,k]=o(void 0),[T,x]=o(!1),[A,I]=o(!1),_=i([]),S=f(),E=S?.meta.connectUri;return d((()=>{let e=Date.now(),t=setInterval((async()=>{let n=await S.pollForReady.execute(),a=Date.now()-e;if(n){clearInterval(t),x(!0);try{await w(),I(!0)}catch(e){let t={retryable:!1,message:"Authentication failed"};if(e?.privyErrorCode===Te.ALLOWLIST_REJECTED)return void h(ym);if(e?.privyErrorCode===Te.USER_LIMIT_REACHED)return console.error(new Et(e).toString()),void h(Pm);if(e?.privyErrorCode===Te.USER_DOES_NOT_EXIST)return void h(ou);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 h(Lu);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.")}k(t)}}else a>12e4&&(clearInterval(t),k({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))}),2e3);return()=>{clearInterval(t),_.current.forEach((e=>clearTimeout(e)))}}),[]),d((()=>{if(s&&a&&A&&l){if(m?.legal.requireUsersAcceptTerms&&!l.hasAcceptedTerms){let e=setTimeout((()=>{h(qu)}),rr);return()=>clearTimeout(e)}A&&(ru(l,m.embeddedWallets)?_.current.push(setTimeout((()=>{u({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),C({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"FarcasterConnectStatusScreen"}}),r()},callAuthOnSuccessOnClose:!0}}),h(Vu)}),rr)):_.current.push(setTimeout((()=>v({shouldCallAuthOnSuccess:!0,isSuccess:!0})),rr)))}}),[A,s,a,l]),/*#__PURE__*/e(n,g||T?{children:[/*#__PURE__*/t(Js,{backFn:c?p:void 0,onClose:v},"header"),/*#__PURE__*/t(Mc,{}),
19
19
  /*#__PURE__*/t(n,y?{children:/*#__PURE__*/e(Fg,{children:[/*#__PURE__*/t(md,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(Tl,{success:A,fail:!!b}),/*#__PURE__*/t(Sg,{style:{width:"38px",height:"38px"}})]})}),/*#__PURE__*/e(Ec,{children:[/*#__PURE__*/t(il,{children:b?b.message:"Sign in with Farcaster"}),/*#__PURE__*/t(ol,{children:b?b.detail:"To sign in with Farcaster, please open the Farcaster app."})]}),E&&/*#__PURE__*/t(El,{onClick:e=>{e.preventDefault(),window.location.href=E},children:"Open Farcaster app"})]})}:{children:/*#__PURE__*/e(Rg,{children:[/*#__PURE__*/t(md,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(Tl,{success:A,fail:!!b}),/*#__PURE__*/t(Sg,{style:{width:"38px",height:"38px"}})]})}),/*#__PURE__*/e(Ec,{children:[/*#__PURE__*/t(il,{children:b?b.message:"Signing in with Farcaster"}),/*#__PURE__*/t(ol,{children:b?b.detail:"This should only take a moment"}),/*#__PURE__*/t(xc,{children:E&&g&&/*#__PURE__*/t(Wg,{text:"Take me to Farcaster",url:E,color:Og})})]})]})}),/*#__PURE__*/t(Ks,{})]}:{children:[/*#__PURE__*/t(Js,{backFn:c?p:void 0,onClose:v},"header"),/*#__PURE__*/t(Mc,{}),/*#__PURE__*/t(Rg,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(il,{children:"Sign in with Farcaster"}),/*#__PURE__*/t(ol,{children:"Scan with your phone's camera to continue."}),/*#__PURE__*/t(Ic,{children:E?/*#__PURE__*/t(am,{url:E,size:275,squareLogoElement:Sg}):/*#__PURE__*/t(xl,{})}),/*#__PURE__*/e(xc,{children:[/*#__PURE__*/t(ol,{children:"Or copy this link and paste it into a phone browser to open the Farcaster app."}),E&&/*#__PURE__*/t(Mg,{text:E,itemName:"link",color:Og})]})]})}),/*#__PURE__*/t(Ks,{})]})}};let Rg=/*#__PURE__*/bn.div.withConfig({displayName:"ConnectContainer",componentId:"sc-e6c4537-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin-left:27px;margin-right:27px;gap:24px;"]),Fg=/*#__PURE__*/bn.div.withConfig({displayName:"ConnectContainerButton",componentId:"sc-e6c4537-1"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;width:100%;"]);const Dg=()=>{let[n,a]=o(!1),{currentScreen:r,navigate:i,setModalData:s,data:l}=es(),{enabled:c,token:d}=_i(),{initLoginWithFarcaster:h}=Ut(),{accountType:p}=Zp();/*#__PURE__*/return e(Fs,{onClick:async()=>{a(!0);try{c&&!d?(s({captchaModalData:{callback:e=>h(e,l?.login?.disableSignup),userIntentRequired:!0,onSuccessNavigateTo:Lg,onErrorNavigateTo:Cu}}),i(bm)):(await h(d,l?.login?.disableSignup),i(Lg))}catch(e){s({errorModalData:{error:e,previousScreen:r||of}}),i(Cu)}finally{a(!1)}},disabled:!1,children:[/*#__PURE__*/t(Sg,{})," Farcaster",n&&/*#__PURE__*/t(Il,{}),"farcaster"===p&&/*#__PURE__*/t(Bg,{color:"gray",children:"Recent"})]})};let Bg=/*#__PURE__*/bn(Ig).withConfig({displayName:"StyledChip",componentId:"sc-30c9632d-0"})(["margin-left:auto;"]);const zg=({style:n,...a})=>/*#__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",...a,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)"})})})]}),$g={component:()=>{let{app:a,lastScreen:r,currentScreen:s,navigateBack:l,data:c,setModalData:h,navigate:p}=es(),{loginWithPasskey:u,signupWithPasskey:m,closePrivyModal:g,createAnalyticsEvent:y}=Ut(),{user:f,logout:w}=rn(),{passkeySignupFlow:v}=c?.passkeyAuthModalData??{},[C,b]=o("loading"),[k,T]=o(null),x=i([]),A=e=>{x.current=[e,...x.current]};d((()=>()=>{x.current.forEach((e=>clearTimeout(e))),x.current=[]}),[]);let I=async()=>{b("loading");try{v?await m():await u(),b("success")}catch(e){T(e),b("error")}};return d((()=>{if("success"===C&&f){if(a?.legal.requireUsersAcceptTerms&&!f.hasAcceptedTerms)return void A(setTimeout((()=>{p(qu)}),900));if(!ru(f,a?.embeddedWallets))return void A(setTimeout((()=>{g({shouldCallAuthOnSuccess:!0,isSuccess:!0})}),rr));A(setTimeout((()=>{h({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),y({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"PasskeyStatusScreen"}}),w()},callAuthOnSuccessOnClose:!0}}),p(Vu)}),900))}}),[f,C]),d((()=>{I()}),[]),/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Js,{backFn:r&&s!==r?l:void 0}),/*#__PURE__*/e(jg,{children:[/*#__PURE__*/t(md,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(Tl,{success:"success"===C,fail:"error"===C}),/*#__PURE__*/t(zg,{style:{width:"38px",height:"38px"}})]})}),/*#__PURE__*/e(Ec,{children:[/*#__PURE__*/t("h3",{children:(()=>{switch(C){case"loading":return"Waiting for passkey";case"success":return"Success";case"error":return"Something went wrong"}})()}),/*#__PURE__*/t("p",{style:{whiteSpace:"pre-wrap"},children:(()=>{switch(C){case"loading":return v?"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(k instanceof Re){if(k.privyErrorCode===Te.CANNOT_LINK_MORE_OF_TYPE)return"Cannot link more passkeys to account.";if(k.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."}})()})]}),(()=>{switch(C){case"loading":case"success":/*#__PURE__*/return t(El,{onClick:()=>{},disabled:!0,children:"Continue"});case"error":/*#__PURE__*/return t(El,{onClick:I,disabled:!1,children:"Retry"})}})()]}),/*#__PURE__*/t(Ks,{})]})}};let jg=/*#__PURE__*/bn.div.withConfig({displayName:"Container",componentId:"sc-46c03a59-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;width:100%;"]);const Vg={component:()=>{let{enabled:a,token:r}=_i(),{lastScreen:i,currentScreen:o,navigateBack:s,navigate:l,setModalData:c}=es(),{initSignupWithPasskey:d,initLoginWithPasskey:h}=Ut();/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{backFn:i&&o!==i?s:void 0}),/*#__PURE__*/t(rl,{children:/*#__PURE__*/e(Hg,{children:[/*#__PURE__*/t(gd,{}),/*#__PURE__*/t(zg,{})]})}),/*#__PURE__*/t(il,{children:"Log in or create a new account?"}),/*#__PURE__*/t(ol,{children:"Create a new account with a passkey or use a passkey to log in to an existing account."}),/*#__PURE__*/e(hl,{children:[/*#__PURE__*/t(El,{onClick:async()=>{a&&!r?(c({passkeyAuthModalData:{passkeySignupFlow:!0},captchaModalData:{callback:e=>d({captchaToken:e,withPrivyUi:!0}),userIntentRequired:!1,onSuccessNavigateTo:$g,onErrorNavigateTo:Cu}}),l(bm)):(await d({withPrivyUi:!0}),c({passkeyAuthModalData:{passkeySignupFlow:!0}}),l($g))},children:"Create new account"}),/*#__PURE__*/t(vl,{onClick:async()=>{a&&!r?(c({passkeyAuthModalData:{passkeySignupFlow:!1},captchaModalData:{callback:e=>h({captchaToken:e,withPrivyUi:!0}),userIntentRequired:!1,onSuccessNavigateTo:$g,onErrorNavigateTo:Cu}}),l(bm)):(await h({withPrivyUi:!0}),c({passkeyAuthModalData:{passkeySignupFlow:!1}}),l($g))},children:"Log in with a passkey"})]}),/*#__PURE__*/t(qs,{})]})}},Hg=/*#__PURE__*/bn.div.withConfig({displayName:"DoubleIconWrapper",componentId:"sc-f058c8a2-0"})(["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);stroke:var(--privy-color-accent);fill:var(--privy-color-accent);}"]),qg=()=>{let{enabled:n,token:a}=_i(),{navigate:r,setModalData:i,app:o,data:l}=es(),{initLoginWithPasskey:c}=Ut(),d=()=>{o.loginConfig.passkeysForSignupEnabled?r(Vg):(async()=>{n&&!a?(i({passkeyAuthModalData:{passkeySignupFlow:!1},captchaModalData:{callback:e=>c({captchaToken:e,withPrivyUi:!0}),userIntentRequired:!1,onSuccessNavigateTo:$g,onErrorNavigateTo:Cu}}),r(bm)):(await c({withPrivyUi:!0}),i({passkeyAuthModalData:{passkeySignupFlow:!1}}),r($g))})()};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(Fs,{onClick:d,children:[/*#__PURE__*/t(_n,{})," Continue with passkey"]}):/*#__PURE__*/t(Zg,{onClick:d,children:"I have a passkey"})};let Kg=/*#__PURE__*/kn(["&&{width:100%;font-size:0.875rem;line-height:1rem;display:flex;gap:0.5rem;justify-content:center;align-items: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 Zg=/*#__PURE__*/bn.button.withConfig({displayName:"StyledLink",componentId:"sc-1c6127e5-0"})(["",""],Kg),Yg=({value:n,onChange:a})=>/*#__PURE__*/t("select",{value:n,onChange:a,children:P.map((t=>/*#__PURE__*/e("option",{value:t.code,children:[t.code," +",t.callCode]},t.code)))}),Gg=/*#__PURE__*/u(((a,r)=>{let{app:i}=es(),[s,l]=o(!1),{accountType:c}=Zp(),[h,p]=o(""),[u,m]=o(i?.intl.defaultCountry??"US"),g=W(h,u),y=U(u),f=O(u),w=L(u),v=!g,[C,b]=o(!1),k=w.length,T=e=>{let t=e.target.value;m(t),p(""),a.onChange&&a.onChange({rawPhoneNumber:h,qualifiedPhoneNumber:F(h,t),countryCode:t,isValid:W(h,u)})},x=(e,t)=>{try{let n=e.replace(/\D/g,"")===h.replace(/\D/g,"")?e:y.input(e);p(n),a.onChange&&a.onChange({rawPhoneNumber:n,qualifiedPhoneNumber:F(e,t),countryCode:t,isValid:W(e,t)})}catch(e){console.error("Error processing phone number:",e)}},A=()=>{b(!0);let e=F(h,u);a.onSubmit({rawPhoneNumber:h,qualifiedPhoneNumber:e,countryCode:u,isValid:W(h,u)}).finally((()=>b(!1)))};return d((()=>{if(a.defaultValue){let e=R(a.defaultValue);y.reset(),T({target:{value:e.countryCode}}),x(e.phone,e.countryCode)}}),[a.defaultValue]),/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Jg,{children:/*#__PURE__*/e(Qg,{$callingCodeLength:k,$stacked:a.stacked,children:[/*#__PURE__*/t(Yg,{value:u,onChange:T}),/*#__PURE__*/t("input",{ref:r,id:"phone-number-input",className:"login-method-button",type:"tel",placeholder:f,onFocus:()=>l(!0),onChange:e=>{x(e.target.value,u)},onKeyUp:e=>{"Enter"===e.key&&A()},value:h,autoComplete:"tel"}),"phone"!==c||s||a.hideRecent?a.stacked||a.noIncludeSubmitButton?/*#__PURE__*/t("span",{}):/*#__PURE__*/t(Rl,{isSubmitting:C,onClick:A,disabled:v,children:"Submit"}):/*#__PURE__*/t(Ig,{color:"gray",children:"Recent"})]})}),a.stacked&&!a.noIncludeSubmitButton?/*#__PURE__*/t(El,{loading:C,loadingText:null,onClick:A,disabled:v,children:"Submit"}):null]})}));let Jg=/*#__PURE__*/bn.div.withConfig({displayName:"InputContainer",componentId:"sc-2a729487-0"})(["width:100%;"]),Qg=/*#__PURE__*/bn.label.withConfig({displayName:"PhoneNumberInput",componentId:"sc-2a729487-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;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-mdlg);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 Xg=({isEditable:a,setIsEditable:r,defaultValue:o})=>{let s=i(null),{authenticated:l}=rn(),{navigate:c,setModalData:d,currentScreen:h,data:p}=es(),{initLoginWithSms:u}=Ut(),{enabled:m,token:g}=_i(),{whatsAppEnabled:y}=Go();/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Bs,{$if:!a,children:/*#__PURE__*/t(Gg,{ref:s,onSubmit:async function({qualifiedPhoneNumber:e}){if(!m||g||l)try{await u({phoneNumber:e,captchaToken:g,withPrivyUi:!0,disableSignup:p?.login?.disableSignup}),c(ky)}catch(e){d({errorModalData:{error:e,previousScreen:h||of}}),c(Cu)}else d({captchaModalData:{callback:t=>u({phoneNumber:e,captchaToken:t,withPrivyUi:!0,disableSignup:p?.login?.disableSignup}),userIntentRequired:!1,onSuccessNavigateTo:ky,onErrorNavigateTo:Cu}}),c(bm)},defaultValue:o})}),/*#__PURE__*/t(Bs,{$if:a,children:/*#__PURE__*/e(Fs,{onClick:()=>{r(),setTimeout((()=>{s.current?.focus()}),0)},children:[/*#__PURE__*/t(Sn,{})," Continue with ",y?"WhatsApp":"SMS"]})})]})};let ey={apple:{logo:/*#__PURE__*/t(Rr,{}),displayName:"Apple"},discord:{logo:/*#__PURE__*/t(Fr,{}),displayName:"Discord"},github:{logo:/*#__PURE__*/t(Dr,{}),displayName:"GitHub"},google:{logo:/*#__PURE__*/t(zr,{}),displayName:"Google"},linkedin:{logo:/*#__PURE__*/t(Vr,{}),displayName:"LinkedIn"},spotify:{logo:/*#__PURE__*/t(Hr,{}),displayName:"Spotify"},instagram:{logo:/*#__PURE__*/t($r,{}),displayName:"Instagram"},twitter:{logo:/*#__PURE__*/t(Kr,{}),displayName:"Twitter"},tiktok:{logo:/*#__PURE__*/t(qr,{}),displayName:"TikTok"},line:{logo:/*#__PURE__*/t(jr,{}),displayName:"LINE"}};const ty=({provider:n})=>{let{enabled:a,token:r}=_i(),{navigate:i,setModalData:l,data:c}=es(),[d,h]=o(!1),{initLoginWithOAuth:p}=Ut(),{accountType:u}=Zp(),m=s((()=>u&&"guest"!==u&&"authorization_key"!==u&&"cross_app"!==u?$p(u):null),[u]),{displayName:g,logo:y}=ey[n];/*#__PURE__*/return e(Fs,{onClick:()=>{h(!0),setTimeout((()=>{h(!1)}),2e3),a&&!r?(l({captchaModalData:{callback:e=>p(n,e,c?.login?.disableSignup),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:Cu}}),i(bm)):p(n,void 0,c?.login?.disableSignup)},disabled:d,children:[y," ",g,m?.loginMethod===n&&/*#__PURE__*/t(ny,{color:"gray",children:"Recent"})]})};let ny=/*#__PURE__*/bn(Ig).withConfig({displayName:"StyledChip",componentId:"sc-209315e7-0"})(["margin-left:auto;"]);function ay(n){/*#__PURE__*/return e("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 240 240",...n,children:[/*#__PURE__*/t("defs",{children:/*#__PURE__*/e("linearGradient",{x1:"120",y1:"240",x2:"120",gradientUnits:"userSpaceOnUse",id:"telegram-linear-gradient",children:[/*#__PURE__*/t("stop",{offset:"0",stopColor:"#1d93d2"}),/*#__PURE__*/t("stop",{offset:"1",stopColor:"#38b0e3"})]})}),/*#__PURE__*/t("title",{children:"Telegram_logo"}),/*#__PURE__*/t("circle",{cx:"120",cy:"120",r:"120",fill:"url(#telegram-linear-gradient)"}),/*#__PURE__*/t("path",{d:"M81.229,128.772l14.237,39.406s1.78,3.687,3.686,3.687,30.255-29.492,30.255-29.492l31.525-60.89L81.737,118.6Z",fill:"#c8daea"}),/*#__PURE__*/t("path",{d:"M100.106,138.878l-2.733,29.046s-1.144,8.9,7.754,0,17.415-15.763,17.415-15.763",fill:"#a9c6d8"}),/*#__PURE__*/t("path",{d:"M81.486,130.178,52.2,120.636s-3.5-1.42-2.373-4.64c.232-.664.7-1.229,2.1-2.2,6.489-4.523,120.106-45.36,120.106-45.36s3.208-1.081,5.1-.362a2.766,2.766,0,0,1,1.885,2.055,9.357,9.357,0,0,1,.254,2.585c-.009.752-.1,1.449-.169,2.542-.692,11.165-21.4,94.493-21.4,94.493s-1.239,4.876-5.678,5.043A8.13,8.13,0,0,1,146.1,172.5c-8.711-7.493-38.819-27.727-45.472-32.177a1.27,1.27,0,0,1-.546-.9c-.093-.469.417-1.05.417-1.05s52.426-46.6,53.821-51.492c.108-.379-.3-.566-.848-.4-3.482,1.281-63.844,39.4-70.506,43.607A3.21,3.21,0,0,1,81.486,130.178Z",fill:"#fff"})]})}const ry={component:()=>{let{authenticated:a,logout:r,ready:i,user:s}=rn(),{app:l,setModalData:c,navigate:h,resetNavigation:p,data:u}=es(),{initLoginWithTelegram:m,loginWithTelegram:g,updateWallets:y,setReadyToTrue:f,closePrivyModal:w,createAnalyticsEvent:v,getAuthMeta:C}=Ut(),[b,k]=o(!1),[T,x]=o(void 0),A=_i();async function I(){try{let e=await async function(){let e;if(!a){if(A.enabled&&"error"===A.status)throw new Ai(A.error,null,Te.CAPTCHA_FAILURE);return A.enabled&&"success"!==A.status&&(A.execute(),e=await A.waitForResult()),e}}();await g({captchaToken:e}),k(!0),f(!0)}catch(e){if(e?.privyErrorCode===Te.ALLOWLIST_REJECTED)return x(void 0),p(),void h(ym);if(e?.privyErrorCode===Te.USER_LIMIT_REACHED)return console.error(new Et(e).toString()),x(void 0),p(),void h(Pm);if(e?.privyErrorCode===Te.USER_DOES_NOT_EXIST)return x(void 0),p(),void h(ou);if(e?.privyErrorCode===Te.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return x(void 0),p(),c({accountTransfer:{nonce:e.data?.data?.nonce,account:e.data?.data?.subject,telegramAuthResult:C()?.telegramAuthResult,telegramWebAppData:C()?.telegramWebAppData,displayName:e.data?.data?.account?.displayName,linkMethod:"telegram",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void h(Lu);let{retryable:t,detail:n}=Ei(e);x({retryable:t,detail:n,message:"Authentication failed"})}}d((()=>{I()}),[]),d((()=>{if(!(i&&a&&b&&s))return;if(l?.legal.requireUsersAcceptTerms&&!s.hasAcceptedTerms){let e=setTimeout((()=>{h(qu)}),rr);return()=>clearTimeout(e)}if(ru(s,l.embeddedWallets)){let e=setTimeout((()=>{c({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),v({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,provider:"telegram",screen:"TelegramAuthScreen"}}),r()},callAuthOnSuccessOnClose:!0}}),h(Vu)}),rr);return()=>clearTimeout(e)}y();let e=setTimeout((()=>w({shouldCallAuthOnSuccess:!0,isSuccess:!0})),rr);return()=>clearTimeout(e)}),[i,a,b,s]);let _=b?"Successfully connected with Telegram":T?T.message:"Verifying connection to Telegram",S="";return S=b?"You’re good to go!":T?T.detail:"Just a few moments more",/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Js,{}),/*#__PURE__*/t(Mc,{}),/*#__PURE__*/e(iy,{children:[/*#__PURE__*/t(md,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(Tl,{success:b,fail:!!T}),/*#__PURE__*/t(ay,{style:{width:"38px",height:"38px"}})]})}),/*#__PURE__*/e(Ec,{children:[/*#__PURE__*/t("h3",{children:_}),/*#__PURE__*/t("p",{children:S})]}),T&&T?.retryable?/*#__PURE__*/t(Ll,{onClick:async()=>{try{x(void 0),u?.telegramAuthModalData?.seamlessAuth||await m(void 0,u?.login?.disableSignup),await I()}catch(e){let{retryable:t,detail:n}=Ei(e);x({retryable:t,detail:n,message:"Authentication failed"})}},disabled:!b&&!T?.retryable,children:"Retry"}):null]}),/*#__PURE__*/t(Pc,{}),/*#__PURE__*/t(Ks,{})]})},isCaptchaRequired:!0};let iy=/*#__PURE__*/bn.div.withConfig({displayName:"ConnectContainer",componentId:"sc-491d0b9b-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin-left:27px;margin-right:27px;gap:24px;"]);const oy=()=>{let{enabled:n,token:a}=_i(),{navigate:r,setModalData:i,data:s}=es(),[l,c]=o(!1),{initLoginWithTelegram:d}=Ut(),{accountType:h}=Zp();async function p(e){try{await d(e,s?.login?.disableSignup),i({telegramAuthModalData:{seamlessAuth:!1}}),r(ry)}catch(e){console.error(e),c(!1)}}/*#__PURE__*/return e(Fs,{onClick:async function(){if(c(!0),n&&!a)return i({captchaModalData:{callback:p,userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:Cu}}),void r(bm);await p(a)},disabled:l,children:[/*#__PURE__*/t(ay,{}),"Telegram","telegram"===h&&/*#__PURE__*/t(sy,{color:"gray",children:"Recent"})]})};let sy=/*#__PURE__*/bn(Ig).withConfig({displayName:"StyledChip",componentId:"sc-d81b85b5-0"})(["margin-left:auto;"]);const ly=({onClick:n,text:a})=>/*#__PURE__*/e(Fs,{onClick:n,children:[/*#__PURE__*/t(na,{}),/*#__PURE__*/t(Ps,{children:a}),/*#__PURE__*/t(ma,{})]}),cy=({onClick:n,text:a,icon:r})=>/*#__PURE__*/e(Fs,{onClick:n,children:[r,/*#__PURE__*/t(Ps,{children:a}),/*#__PURE__*/t(ma,{})]}),dy=({connectOnly:a})=>{let{closePrivyModal:r}=Ut(),{data:i,setModalData:l,onUserCloseViaDialogOrKeybindRef:c,navigate:h}=es(),p=Go(),u=i?.login,m=p.appearance.walletList,g=u?.walletChainType??p.appearance.walletChainType,{accountType:y,walletClientType:f,chainType:w}=Zp(),{wallets:v}=sg({walletList:m,walletChainType:g}),C=s((()=>y&&"guest"!==y&&"authorization_key"!==y&&"cross_app"!==y?$p(y):null),[y]),{email:b,sms:k,google:T,twitter:x,discord:A,github:I,spotify:_,instagram:S,tiktok:E,line:N,linkedin:M,apple:P,wallet:W,farcaster:U,telegram:O}=s((()=>u?.loginMethods?D(u.loginMethods,!0):null),[u])??p.loginMethods,{passkey:L}=p.loginMethods,R=[b&&"email",k&&"sms",T&&"google",x&&"twitter",A&&"discord",I&&"github",_&&"spotify",S&&"instagram",E&&"tiktok",N&&"line",M&&"linkedin",P&&"apple",U&&"farcaster",O&&"telegram"].filter((e=>!!e)),F=R.length>0,B=s((()=>W&&!F?"web3-first":W&&p?.appearance.loginGroupPriority||"web2-first"),[W,F,p?.appearance.loginGroupPriority]),z=p?.appearance.hideDirectWeb2Inputs,[$,j]=o("default"),[V,H]=o(gy({mostRecentlyUsedAccountType:y,smsAvailable:k,emailAvailable:b,prefilledType:u?.prefill?.type}));d((()=>{H(gy({mostRecentlyUsedAccountType:y,smsAvailable:k,emailAvailable:b,prefilledType:u?.prefill?.type}))}),[b,k,y]);let q=()=>{r({shouldCallAuthOnSuccess:!0}),setTimeout((()=>{j("default")}),150)};c.current=q;let K=[];f&&W?K.push(f):C?.loginMethod&&R.includes(C.loginMethod)&&K.push(C.loginMethod);let Z=e=>{if("email"===e)/*#__PURE__*/return t(Wy,{isEditable:"email"===V,setIsEditable:()=>{H("email")},defaultValue:"email"===u?.prefill?.type?u.prefill.value:void 0},e);if("sms"===e)/*#__PURE__*/return t(Xg,{isEditable:"sms"===V,setIsEditable:()=>{H("sms")},defaultValue:"phone"===u?.prefill?.type?u.prefill.value:void 0},e);if("apple"===e)/*#__PURE__*/return t(ty,{provider:"apple"},e);if("discord"===e)/*#__PURE__*/return t(ty,{provider:"discord"},e);if("farcaster"===e)/*#__PURE__*/return t(Dg,{},e);if("github"===e)/*#__PURE__*/return t(ty,{provider:"github"},e);if("google"===e)/*#__PURE__*/return t(ty,{provider:"google"},e);if("linkedin"===e)/*#__PURE__*/return t(ty,{provider:"linkedin"},e);if("tiktok"===e)/*#__PURE__*/return t(ty,{provider:"tiktok"},e);if("line"===e)/*#__PURE__*/return t(ty,{provider:"line"},e);if("spotify"===e)/*#__PURE__*/return t(ty,{provider:"spotify"},e);if("instagram"===e)/*#__PURE__*/return t(ty,{provider:"instagram"},e);if("twitter"===e)/*#__PURE__*/return t(ty,{provider:"twitter"},e);if("telegram"===e)/*#__PURE__*/return t(oy,{},e);let n=v.findIndex((({id:t})=>t===zm.normalize(e))),r="solana"===w?"solana-only":"ethereum-only";/*#__PURE__*/return t(cg,{recent:!0,index:n,data:{wallets:v,walletChainType:r,handleWalletClick(e){l((t=>({...t,externalConnectWallet:{walletList:m,walletChainType:r,preSelectedWalletId:e.id}}))),h(a?bg:vg)}}})},Y=v.filter((e=>e.id!==zm.normalize(f||""))),G=Y.map(((e,n)=>/*#__PURE__*/t(cg,{index:n,data:{walletChainType:g,wallets:Y,handleWalletClick(e){l((t=>({...t,externalConnectWallet:{walletList:m,walletChainType:g,preSelectedWalletId:e.id}}))),h(a?bg:vg)}}},e.id))),J=R.filter((e=>e!==C?.loginMethod)).flatMap(Z),Q=K.flatMap(Z);"web3-first"===B&&"default"===$?G.unshift(...Q):"web2-first"===B&&J.unshift(...Q);let X=R.filter((e=>"email"!==e&&"sms"!==e)),ee=py({priority:B,email:b,sms:k,social:X}),te=uy({priority:B,email:b,sms:k,social:X}),ne=/*#__PURE__*/t(ly,{text:my({priority:B}),onClick:()=>{l({...i,externalConnectWallet:{walletChainType:u?.walletChainType??p.appearance.walletChainType}}),h(vg)}}),ae=/*#__PURE__*/t(cy,{text:ee,icon:te,onClick:()=>j("web2-overflow")}),re=z?0:1,ie=W&&G.length>0,oe=0===J.length&&W&&0===G.length,se=5-(ie?1:0);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{title:p.appearance.landingHeader,onClose:q,backFn:"default"===$?void 0:()=>{j("default")}}),"default"===$&&/*#__PURE__*/t(hy,{}),"default"===$&&("string"==typeof p.appearance.loginMessage?/*#__PURE__*/t(Rs,{children:p.appearance.loginMessage}):p.appearance.loginMessage),/*#__PURE__*/t(Ws,{style:{overflow:"hidden",padding:2},children:/*#__PURE__*/e(Us,{children:["default"===$&&"web2-first"===B&&/*#__PURE__*/e(n,{children:[J.length>se?J.slice(0,se-1):J,J.length>se&&ae,ie&&ne,oe&&/*#__PURE__*/t(Tg,{chainType:p.appearance.walletChainType})]}),"default"===$&&"web3-first"===B&&/*#__PURE__*/e(n,{children:[W&&/*#__PURE__*/e(n,{children:[G.length>se?G.slice(0,se-1):G,G.length>se&&ne]}),J.length>re&&ae,J.length===re&&J[0],oe&&/*#__PURE__*/t(Tg,{chainType:p.appearance.walletChainType})]}),"web2-overflow"===$&&/*#__PURE__*/t(n,{children:"web3-first"===B?J:J.slice(3)}),L&&"default"===$&&/*#__PURE__*/t(qg,{})]})}),p&&/*#__PURE__*/t(Hs,{app:p}),/*#__PURE__*/t(qs,{})]})};let hy=/*#__PURE__*/bn(Gp).withConfig({displayName:"StyledAppLogoHeader",componentId:"sc-75fbce5c-0"})(["margin-bottom:16px;"]),py=({priority:e,email:t,sms:n,social:a})=>"web2-first"===e?"Other socials":t&&n&&a.length>0||t&&a.length>0?"Log in with email or socials":n&&a.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",uy=({priority:e,email:n,sms:a,social:r})=>"web2-first"===e||r.length>0?/*#__PURE__*/t(Xn,{}):n&&a?/*#__PURE__*/t(wg,{}):n?/*#__PURE__*/t(ea,{}):a?/*#__PURE__*/t(Sn,{}):null,my=({priority:e})=>"web2-first"===e?"Continue with a wallet":"Other wallets";const gy=({mostRecentlyUsedAccountType:e,smsAvailable:t,emailAvailable:n,prefilledType:a})=>n&&("email"===e&&"phone"!==a||"email"===a)||!t||"phone"!==e&&"phone"!==a?"email":"sms",yy={component:()=>{let{app:e}=es();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?/*#__PURE__*/t(nf,{connectOnly:!0}):/*#__PURE__*/t(dy,{connectOnly:!0})}};let fy=Array(6).fill("");var wy,vy,Cy=((wy=Cy||{})[wy.RESET_AFTER_DELAY=0]="RESET_AFTER_DELAY",wy[wy.CLEAR_ON_NEXT_VALID_INPUT=1]="CLEAR_ON_NEXT_VALID_INPUT",wy),by=((vy=by||{})[vy.EMAIL=0]="EMAIL",vy[vy.SMS=1]="SMS",vy);const ky={component:()=>{let{app:a,navigate:r,lastScreen:i,navigateBack:s,setModalData:l,onUserCloseViaDialogOrKeybindRef:c}=es(),{closePrivyModal:h,resendEmailCode:p,resendSmsCode:u,getAuthMeta:m,loginWithCode:y,updateWallets:f,createAnalyticsEvent:w}=Ut(),{authenticated:v,logout:C,user:b}=rn(),{whatsAppEnabled:k}=Go(),[T,x]=o(fy),[A,I]=o(!1),[_,S]=o(null),[E,N]=o(null),[M,P]=o(0);c.current=()=>null;let W=m()?.email?0:1;d((()=>{if(M){let e=setTimeout((()=>{P(M-1)}),1e3);return()=>clearTimeout(e)}}),[M]),d((()=>{if(v&&A&&b){if(a?.legal.requireUsersAcceptTerms&&!b.hasAcceptedTerms){let e=setTimeout((()=>{r(qu)}),900);return()=>clearTimeout(e)}if(ru(b,a.embeddedWallets)){let e=setTimeout((()=>{l({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),w({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"AwaitingPasswordlessCodeScreen"}}),C()},callAuthOnSuccessOnClose:!0}}),r(Vu)}),900);return()=>clearTimeout(e)}{f();let e=setTimeout((()=>h({shouldCallAuthOnSuccess:!0,isSuccess:!0})),rr);return()=>clearTimeout(e)}}}),[v,A,b]),d((()=>{if(_&&0===E){let e=setTimeout((()=>{x(fy),S(null);let e=document.querySelector("input[name=code-0]");e?.focus()}),1400);return()=>clearTimeout(e)}}),[_]);let U=e=>{e.preventDefault();let t=e.currentTarget.value.replace(" ","");if(""===t)return;if(isNaN(Number(t)))return S("Code should be numeric"),void N(1);S(null),N(null);let n=Number(e.currentTarget.name?.charAt(5)),a=[...t||[""]].slice(0,6-n),o=[...T.slice(0,n),...a,...T.slice(n+a.length)];x(o);let s=Math.min(Math.max(n+a.length,0),5);if(!isNaN(Number(e.currentTarget.value))){let e=document.querySelector(`input[name=code-${s}]`);e?.focus()}if(o.every((e=>e&&!isNaN(+e)))){let e=document.querySelector(`input[name=code-${s}]`);e?.blur(),y(o.join("")).then((()=>I(!0))).catch((e=>{if(e instanceof Ze&&e.privyErrorCode===Te.INVALID_CREDENTIALS)S("Invalid or expired verification code");else if(e instanceof Ze&&e.privyErrorCode===Te.CANNOT_LINK_MORE_OF_TYPE)S(e.message);else{if(e instanceof Ze&&e.privyErrorCode===Te.USER_LIMIT_REACHED)return console.error(new Et(e).toString()),void r(Pm);if(e instanceof Ze&&e.privyErrorCode===Te.USER_DOES_NOT_EXIST)return void r(ou);if(e instanceof Ze&&e.privyErrorCode===Te.LINKED_TO_ANOTHER_USER)return l({errorModalData:{error:e,previousScreen:i??ky}}),void r(Cu,!1);if(e instanceof Ze&&e.privyErrorCode===Te.DISALLOWED_PLUS_EMAIL)return l({inlineError:{error:e}}),void r(yy,!1);if(e instanceof Ze&&e.privyErrorCode===Te.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return l({accountTransfer:{nonce:e.data?.data?.nonce,account:0===W?m()?.email:m()?.phoneNumber,displayName:e.data?.data?.account?.displayName,linkMethod:0===W?"email":"sms",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void r(Lu);S("Issue verifying code")}N(0)}))}},O=0==W?/*#__PURE__*/t(ea,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):
20
20
  /*#__PURE__*/t(Sn,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),L=/*#__PURE__*/e("p",0==W?{children:["Please check ",/*#__PURE__*/t(Ey,{children:m()?.email})," for an email from privy.io and enter your code below."]}:{children:["Please check ",/*#__PURE__*/t(Ey,{children:m()?.phoneNumber})," for a",k?" WhatsApp":""," message from ",a?.name||"Privy"," and enter your code below."]});/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{backFn:()=>s()},"header"),/*#__PURE__*/e(Ty,{children:[/*#__PURE__*/t(Mh,{title:"Enter confirmation code",description:L,icon:O}),/*#__PURE__*/e(Ac,{children:[/*#__PURE__*/e(xy,{children:[/*#__PURE__*/t(Ay,{$fail:!!_,$success:A,children:/*#__PURE__*/t("span",{children:_||(A?"Success!":"")})}),/*#__PURE__*/t("div",{children:T.map(((e,n)=>/*#__PURE__*/t("input",{name:`code-${n}`,type:"text",value:T[n],onChange:U,onKeyUp:e=>{"Backspace"===e.key&&(e=>{if(1===E&&(S(null),N(null)),x([...T.slice(0,e),"",...T.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:`${A?"success":""} ${_?"fail":""}`,autoComplete:g?"one-time-code":"off"},n)))})]}),/*#__PURE__*/e(Iy,{children:[/*#__PURE__*/e("span",{children:["Didn't get ",0==W?"an email":"a message","?"]}),M?/*#__PURE__*/e(Sy,{children:[/*#__PURE__*/t(ta,{color:"var(--privy-color-foreground)",strokeWidth:1.33,height:"12px",width:"12px"}),/*#__PURE__*/t("span",{children:"Code sent"})]}):/*#__PURE__*/t(_y,{children:/*#__PURE__*/t("button",{onClick:async()=>{P(30),0==W?await p():await u()},children:"Resend code"})})]})]})]}),/*#__PURE__*/t(qs,{})]})}};let Ty=/*#__PURE__*/bn.div.withConfig({displayName:"PasswordlessCodeContainer",componentId:"sc-2171637e-0"})(["display:flex;flex-direction:column;align-items:flex-start;justify-content:center;margin:auto;gap:16px;flex-grow:1;"]),xy=/*#__PURE__*/bn.div.withConfig({displayName:"CodeInput",componentId:"sc-2171637e-1"})(["display:flex;flex-direction:column;width:100%;gap:8px;> div:last-child{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: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);}}"]),Ay=/*#__PURE__*/bn.div.withConfig({displayName:"InputHelp",componentId:"sc-2171637e-2"})(["line-height:20px;height:20px;font-size:13px;color:",";display:flex;justify-content:flex-end;width:100%;"],(e=>e.$success?"var(--privy-color-success)":e.$fail?"var(--privy-color-error)":"var(--privy-color-foreground-3)")),Iy=/*#__PURE__*/bn.div.withConfig({displayName:"HelpText",componentId:"sc-2171637e-3"})(["font-size:13px;color:var(--privy-color-foreground);display:flex;gap:8px;align-items:center;width:100%;margin-top:16px;padding-bottom:32px;"]),_y=/*#__PURE__*/bn.div.withConfig({displayName:"ResendButtonContainer",componentId:"sc-2171637e-4"})(["color:var(--privy-color-accent);padding:2px 0;> button{text-decoration:underline;}"]),Sy=/*#__PURE__*/bn.div.withConfig({displayName:"Badge",componentId:"sc-2171637e-5"})(["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);"]),Ey=/*#__PURE__*/bn.span.withConfig({displayName:"BoldWrappingSpan",componentId:"sc-2171637e-6"})(["font-weight:500;word-break:break-all;"]);const Ny=/*#__PURE__*/u(((a,r)=>{let[i,s]=o(a.defaultValue||""),[l,c]=o(""),[h,p]=o(!1),{authenticated:u}=rn(),{initLoginWithEmail:m}=Ut(),{navigate:g,setModalData:y,currentScreen:f,data:w}=es(),{enabled:v,token:C}=_i(),[b,k]=o(!1),{accountType:T}=Zp(),x=Go();d((()=>{!i&&x.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 A=hi(i),I=h||!A,_=()=>{y({login:w?.login,inlineError:void 0}),!v||C||u?(e=>{p(!0),m({email:i,captchaToken:e,disableSignup:w?.login?.disableSignup,withPrivyUi:!0}).then((()=>{g(ky)})).catch((e=>{y({errorModalData:{error:e,previousScreen:f||of}}),g(Cu)})).finally((()=>{p(!1)}))})(C):(y({captchaModalData:{callback:e=>m({email:i,captchaToken:e,withPrivyUi:!0}),userIntentRequired:!1,onSuccessNavigateTo:ky,onErrorNavigateTo:Cu}}),g(bm))};/*#__PURE__*/return e(n,{children:[/*#__PURE__*/e(My,{children:[l&&/*#__PURE__*/t(rm,{style:{display:"block",marginTop:"0.25rem",textAlign:"left"},children:l}),/*#__PURE__*/e(Py,{stacked:a.stacked,$error:!!l,children:[/*#__PURE__*/t(ea,{}),/*#__PURE__*/t("input",{ref:r,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&&_()},value:i,autoComplete:"email"}),"email"!==T||b?a.stacked?/*#__PURE__*/t("span",{}):/*#__PURE__*/t(Rl,{isSubmitting:h,onClick:_,disabled:I,children:"Submit"}):/*#__PURE__*/t(Ig,{color:"gray",children:"Recent"})]})]}),a.stacked?/*#__PURE__*/t(El,{loadingText:null,loading:h,disabled:I,onClick:_,children:"Submit"}):null]})}));let My=lm,Py=sm;const Wy=({isEditable:a,setIsEditable:r,defaultValue:o})=>{let s=i(null);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Bs,{$if:!a,children:/*#__PURE__*/t(Ny,{ref:s,defaultValue:o})}),/*#__PURE__*/t(Bs,{$if:a,children:/*#__PURE__*/e(Fs,{onClick:()=>{r(),setTimeout((()=>{s.current?.focus()}),0)},children:[/*#__PURE__*/t(ea,{})," Continue with Email"]})})]})},Uy=({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(na,{}):e?/*#__PURE__*/t(e,{}):null;function Oy(e){let t=e.toLowerCase();return!!window?.webkit?.messageHandlers?.ReactNativeWebView||!!window?.ReactNativeWebView||["fbav","fban","instagram","snapchat","linkedinapp"].some((e=>t.includes(e)))}const Ly={component:()=>{let a,{navigateBack:r,navigate:i,lastScreen:s,currentScreen:l,data:c,setModalData:h}=es(),{walletConnectionStatus:p,closePrivyModal:u}=Ut(),[m,y]=o(void 0),[f,w]=o(0),v=Mo(p?.connector?.walletClientType||"unknown"),C="connected"===p?.status,b="switching_to_supported_chain"===p?.status;d((()=>{if(C){let e;if(c?.externalConnectWallet?.onCompleteNavigateTo){let t=c.externalConnectWallet.onCompleteNavigateTo,n=p.connectedWallet?.address;e=setTimeout((()=>{c.funding&&h({...c,funding:{...c.funding,connectedWalletAddress:n}}),i(t({walletChainType:p.connector?.chainType}))}),rr)}else e=setTimeout(u,rr);return()=>clearTimeout(e)}}),[C]);d((()=>{p?.connectError&&(e=>{y(Lm(e))})(p?.connectError)}),[p]);let k=p?.connector?.connectorType||"injected",T=p?.connector?.walletClientType||"unknown",x=v?.metadata?.shortName||v?.name||p?.connector?.walletBranding.name||"Browser Extension",A=v?.image_url?.md||p?.connector?.walletBranding.icon||(e=>/*#__PURE__*/t(lo,{...e})),I="Browser Extension"===x?x.toLowerCase():x;a=C?`Successfully connected with ${I}`:m?m.message:b?"Switching networks":`Waiting for ${I}`;let _="Don’t see your wallet? Check your other browser windows.";return C?_="You’re good to go!":f>=2&&m?_="Unable to connect wallet":m?_=m.detail:b?_="Switch your wallet to the requested network.":"metamask"===T&&g?_="Click to continue to open and connect MetaMask.":"metamask"===T?_="For the best experience, connect only one wallet at a time.":"wallet_connect_v2"===k?_="Open your mobile wallet app to continue":"coinbase_wallet"===k&&(_="Open the Coinbase app on your phone to continue."),/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Js,{backFn:l===s?void 0:r}),/*#__PURE__*/e(Ry,{children:[/*#__PURE__*/t(Bm,{walletLogo:A,success:C,fail:!!m}),/*#__PURE__*/e(Ec,{children:[/*#__PURE__*/t("h3",{children:a}),/*#__PURE__*/t("p",{children:_})]}),m==ji.ERROR_USER_EXISTS?/*#__PURE__*/t(El,{onClick:r,children:"Use a different wallet"}):!C&&m?.retryable&&f<2?/*#__PURE__*/t(El,{onClick:()=>{w(f+1),y(void 0),p?.connectRetry()},disabled:!C&&(!m?.retryable||f>=2),children:"Retry"}):!C&&m&&f>=2?/*#__PURE__*/t(El,{onClick:r,children:"Use a different wallet"}):null]}),/*#__PURE__*/t(Ks,{})]})}};let Ry=/*#__PURE__*/bn.div.withConfig({displayName:"ConnectContainer",componentId:"sc-604d07cd-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;width:100%;"]);const Fy=({style:e,...n})=>/*#__PURE__*/t("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"17",height:"17",viewBox:"0 0 17 17",style:{height:"1.25rem",width:"1.25rem",...e},...n,children:/*#__PURE__*/t("path",{strokeLinecap:"round",strokeLinejoin:"round",fillRule:"evenodd",clipRule:"evenodd",d:"M16.5 8.67993C16.5 9.82986 15.853 10.8287 14.9032 11.3322C15.2188 12.3599 14.97 13.5237 14.1569 14.3368C13.3437 15.1499 12.18 15.3987 11.1523 15.0831C10.6488 16.0329 9.64993 16.6799 8.5 16.6799C7.35007 16.6799 6.35126 16.0329 5.84771 15.0831C4.82003 15.3987 3.65627 15.1499 2.84314 14.3368C2.03001 13.5237 1.78124 12.3599 2.09681 11.3322C1.14699 10.8287 0.5 9.82986 0.5 8.67993C0.5 7.53 1.14699 6.53119 2.0968 6.02764C1.78125 4.99996 2.03003 3.83621 2.84315 3.02309C3.65627 2.20997 4.82002 1.96119 5.8477 2.27675C6.35125 1.32692 7.35007 0.679932 8.5 0.679932C9.64992 0.679932 10.6487 1.32691 11.1523 2.27672C12.18 1.96115 13.3437 2.20993 14.1569 3.02305C14.97 3.83618 15.2188 4.99996 14.9032 6.02764C15.853 6.53119 16.5 7.53 16.5 8.67993ZM12.2659 6.68856C12.5654 6.40238 12.5761 5.92763 12.29 5.62818C12.0038 5.32873 11.529 5.31797 11.2296 5.60416C9.73022 7.03711 8.40877 8.65489 7.3018 10.4211L5.78033 8.89963C5.48744 8.60673 5.01256 8.60673 4.71967 8.89963C4.42678 9.19252 4.42678 9.66739 4.71967 9.96029L6.92031 12.1609C7.08544 12.3261 7.31807 12.4048 7.54957 12.374C7.78106 12.3432 7.98499 12.2064 8.1012 12.0038C9.23027 10.0356 10.6362 8.24613 12.2659 6.68856Z",fill:"var(--privy-color-accent)"})}),Dy=/*#__PURE__*/bn.div.withConfig({displayName:"TodoList",componentId:"sc-491785d-0"})(["display:flex;flex-direction:column;justify-content:flex-start;gap:4px;"]),By=/*#__PURE__*/bn.div.withConfig({displayName:"TodoSpacer",componentId:"sc-491785d-1"})(["&&&{margin-left:7px;border-left:2px solid var(--privy-color-foreground-4);height:12px;}"]),zy=({children:n})=>/*#__PURE__*/e($y,{children:[/*#__PURE__*/t(Fy,{style:{width:"16px",height:"16px"}}),n]});let $y=/*#__PURE__*/bn.div.withConfig({displayName:"TodoItemWrapper",componentId:"sc-491785d-2"})(["display:flex;justify-content:flex-start;justify-items:center;text-align:left;gap:8px;&&{a{text-decoration:underline;color:var(--privy-color-accent);}svg{margin-top:auto;margin-bottom:auto;}}"]),jy=({name:n,installLink:a})=>/*#__PURE__*/e(xc,{children:[/*#__PURE__*/t(Eh,{title:`Create a ${n} wallet`.replace(/wallet wallet/gi,"wallet"),description:"Follow the instructions below to get started."}),/*#__PURE__*/e(Dy,{children:[/*#__PURE__*/t(zy,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t("span",{children:"Install the "})," ",/*#__PURE__*/e("a",{href:a,target:"_blank",children:[n," browser extension"]})]})}),/*#__PURE__*/t(By,{}),/*#__PURE__*/t(zy,{children:"Set up your first wallet"}),/*#__PURE__*/t(By,{}),/*#__PURE__*/t(zy,{children:"Store your recovery phrase in a safe place!"})]}),/*#__PURE__*/t(Ll,{onClick:()=>window.location.reload(),style:{marginTop:"20px"},children:"Reload the page to use your wallet"})]});const Vy={component:()=>{let{navigateBack:a,data:r}=es();if(!r?.installWalletModalData)throw Error("Wallet data is missing");let{walletConfig:i}=r.installWalletModalData;/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{backFn:a},"header"),/*#__PURE__*/t(Mc,{}),/*#__PURE__*/t(jy,{...i}),/*#__PURE__*/t(Pc,{}),/*#__PURE__*/e(Ks,{children:[/*#__PURE__*/t("span",{children:"Still not sure? "}),/*#__PURE__*/t("a",{target:"_blank",href:"https://solana.com/docs/intro/wallets",children:"Learn more"})]})]})}},Hy={component:()=>{let{ready:a}=rn(),{data:r}=es(),[i,s]=o(!1);if(!r?.installWalletModalData)throw Error("Wallet data is missing");let{walletConfig:l,connectOnly:c,chainType:d}=r.installWalletModalData,h=l.getMobileRedirect({useUniversalLink:!i,isSolana:"solana"===d,connectOnly:c}),p=l.name.replace(/ wallet/gi,""),u={title:`Redirecting to ${p} Mobile Wallet`,description:`We'll take you to the ${p} Mobile Wallet app to continue your login experience.`,footnote:""};return a&&(u.description=`For the best experience, we'll automatically log you into the ${p} Mobile Wallet in-app browser.`,u.footnote="You can always return here to login via other methods."),i&&(u.title="Still here?",u.description=`You may need to install the ${l.name} mobile app.`,u.footnote=`Once you're done, you can connect with ${l.name} wallet to complete the login.`),/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Js,{},"header"),/*#__PURE__*/t(Mc,{}),/*#__PURE__*/t(Nh,{title:u.title,description:u.description}),/*#__PURE__*/e(Tc,{children:[/*#__PURE__*/t(Pl,{href:h,onClick:()=>setTimeout((()=>s(!0)),1e3),loading:a&&!h,children:i?"Go to App Store":"Continue"}),u.footnote?/*#__PURE__*/t("p",{children:u.footnote}):null]}),/*#__PURE__*/t(Pc,{}),/*#__PURE__*/t(qs,{})]})}},qy=({provider:n,displayName:a,logo:r,connectOnly:i,connector:o})=>{let s,{navigate:l,setModalData:c}=es(),{connectWallet:d}=Ut(),h=Zp(),p=Mo(n),u="wallet_connect_v2"===o.connectorType?n:o.walletClientType,m=window.matchMedia("(display-mode: standalone)").matches,y=Co({connectorType:o.connectorType,walletClientType:u});s=y&&y.chainTypes.includes(o.chainType)?()=>{y.isInstalled||"solana"===o.chainType&&"isInstalled"in o&&o.isInstalled?(d(o,u),l(i?Ly:Rm)):g?(c({installWalletModalData:{walletConfig:y,chainType:o.chainType,connectOnly:i}}),l(Hy)):(c({installWalletModalData:{walletConfig:y,chainType:o.chainType,connectOnly:i}}),l(Vy))}:"coinbase_wallet"!==o.connectorType||"eoaOnly"!==o.coinbaseWalletConfig.preference?.options||!g||m||li()?()=>{(!Oy(window.navigator.userAgent)||event?.isTrusted)&&(d(o,u),l(i?Ly:Rm))}:()=>{window.location.href=`https://go.cb-w.com/dapp?cb_url=${encodeURI(window.location.href)}`};let f=a||p?.metadata?.shortName||p?.name||o.walletClientType;/*#__PURE__*/return e(Ky,{onClick:s,children:[/*#__PURE__*/t(Uy,{icon:r||p?.image_url?.md,name:f}),/*#__PURE__*/t("span",{children:f}),/*#__PURE__*/e(Yy,{id:"chip-container",children:[h?.walletClientType===u&&h?.chainType===o.chainType?/*#__PURE__*/t(Zy,{color:"gray",children:"Recent"}):/*#__PURE__*/t("span",{id:"connect-text",children:"Connect"}),"solana"===o.chainType&&/*#__PURE__*/t(Zy,{color:"gray",children:"Solana"})]})]})};let Ky=/*#__PURE__*/bn(Fs).withConfig({displayName:"ConnectWalletButton",componentId:"sc-3baa344c-0"})(["> #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;}}"]),Zy=/*#__PURE__*/bn(Ig).withConfig({displayName:"StyledChip",componentId:"sc-3baa344c-1"})(["margin-left:auto;"]),Yy=/*#__PURE__*/bn.div.withConfig({displayName:"ChipContainer",componentId:"sc-3baa344c-2"})(["display:flex;flex-wrap:wrap;gap:8px;margin-left:auto;"]);const Gy=["coinbase_wallet","base_account"];let Jy=["metamask","okx_wallet","rainbow","uniswap","bybit_wallet","ronin_wallet","haha_wallet","uniswap_extension","zerion","rabby_wallet","cryptocom","binance"];const Qy=["safe"],Xy=["phantom","backpack","solflare","universal_profile"],ef=({wallets:e})=>{let{app:a}=es();return 0===e.length?/*#__PURE__*/t(Tg,{chainType:a.appearance.walletChainType,withPadding:!0}):/*#__PURE__*/t(n,{children:e})},tf=({walletList:e,walletChainType:n,connectors:a,connectOnly:r,ignore:i,walletConnectEnabled:o,forceWallet:s})=>{let l=[],c=[],d=[],h=a.filter((e=>"ethereum-only"===n?"ethereum"===e.chainType:"solana-only"!==n||"solana"===e.chainType)),p=h.find((e=>"wallet_connect_v2"===e.connectorType));for(let[a,u]of(s?[s.wallet]:e).entries()){if("detected_ethereum_wallets"===u||"detected_wallets"===u)for(let[e,n]of h.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(qy,{connectOnly:r,provider:i,logo:o.icon,displayName:o.name,connector:n},`${a}-${u}-${i}-${s}-${e}`))}if("detected_solana_wallets"===u||"detected_wallets"===u)for(let[e,o]of h.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(qy,{connectOnly:r,provider:n,logo:i.icon,displayName:i.name,connector:o},`${a}-${u}-${n}-${s}-${e}`))}if(Xy.includes(u)){let e=h.find((e=>"injected"===e.connectorType&&e.walletClientType===u||e.connectorType===u));if(e&&l.push(/*#__PURE__*/t(qy,{connectOnly:r,provider:u,connector:e},`${a}-${u}`)),"solana-only"===n||"ethereum-and-solana"===n){let e=h.find((({chainType:e,walletClientType:t})=>"solana"===e&&t===u));e&&l.push(/*#__PURE__*/t(qy,{connectOnly:r,provider:u,connector:e},`${u}-solana`))}}else if(Jy.includes(u)){let e=h.find((e=>"uniswap"===u?"uniswap_wallet_extension"===e.walletClientType||"uniswap_extension"===e.walletClientType:"cryptocom"===u?"crypto.com_wallet_extension"===e.walletClientType||"crypto.com_onchain"===e.walletClientType:"injected"===e.connectorType&&e.walletClientType===u));if(o&&!e&&(e=p),e&&l.push(/*#__PURE__*/t(qy,{connectOnly:r,provider:u,connector:e,logo:"injected"===e.connectorType?e.walletBranding.icon:void 0,displayName:"injected"===e.connectorType?e.walletBranding.name:void 0},`${a}-${u}`)),"solana-only"===n||"ethereum-and-solana"===n){let e=h.find((({chainType:e,walletClientType:t})=>"solana"===e&&t===u));e&&l.push(/*#__PURE__*/t(qy,{connectOnly:r,provider:u,connector:e},`${u}-solana`))}}else if(Gy.includes(u)){let e=h.find((({connectorType:e})=>e===u));e&&l.push(/*#__PURE__*/t(qy,{connectOnly:r,provider:u,connector:e,displayName:"coinbase_wallet"===e.walletClientType?"Coinbase":"Base Account",logo:Ri},`${a}-${u}`))}else if(Qy.includes(u))p&&d.push(/*#__PURE__*/t(qy,{connectOnly:r,provider:u,connector:p},`${a}-${u}`));else if("wallet_connect"===u)p&&d.push(/*#__PURE__*/t(qy,{connectOnly:r,provider:u,connector:p,logo:p.walletBranding.icon,displayName:"WalletConnect"},`${a}-${u}`));else if(u===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=h.find((({walletClientType:e})=>e===u));e&&l.push(/*#__PURE__*/t(qy,{connectOnly:r,provider:u,displayName:e.walletBranding?.name,logo:e.walletBranding?.icon,connector:e},`${a}-${u}`))}}}return[...c,...l,...d]},nf=({connectOnly:a})=>{let{closePrivyModal:r,connectors:i}=Ut(),{app:l,onUserCloseViaDialogOrKeybindRef:c,data:h}=es(),{appearance:{palette:{colorScheme:p}}}=Go(),{accountType:u,walletClientType:m,chainType:g}=Zp(),y=s((()=>u&&"guest"!==u&&"authorization_key"!==u&&"cross_app"!==u?$p(u):null),[u]),f=l.loginMethodsAndOrder?.primary??[],w=l.loginMethodsAndOrder?.overflow??[],v=s((()=>[...f,...w]),[f,w]),C=l.loginMethods.passkey,b=h?.login,k=[];m&&v.includes(m)?k.push(m):u&&v.includes(y?.loginMethod)&&k.push(y?.loginMethod);let[T,x]=o("default"),[A,I]=o(gy({mostRecentlyUsedAccountType:u,smsAvailable:v.includes("sms"),emailAvailable:v.includes("email"),prefilledType:b?.prefill?.type}));d((()=>{I(gy({mostRecentlyUsedAccountType:u,smsAvailable:v.includes("sms"),emailAvailable:v.includes("email"),prefilledType:b?.prefill?.type}))}),[v,u]),d((()=>{"phone"===u&&I("sms");let e=v.indexOf("sms"),t=v.indexOf("email");e>-1&&e<t&&I("sms")}),[u,f,w]);let _=()=>{r({shouldCallAuthOnSuccess:!0}),setTimeout((()=>{x("default")}),150)};c.current=_;let S=e=>"email"===e?/*#__PURE__*/t(Wy,{isEditable:"email"===A,setIsEditable:()=>{I("email")},defaultValue:"email"===b?.prefill?.type?b.prefill.value:void 0},e):"sms"===e?/*#__PURE__*/t(Xg,{isEditable:"sms"===A,setIsEditable:()=>{I("sms")},defaultValue:"phone"===b?.prefill?.type?b.prefill.value:void 0},e):"apple"===e?/*#__PURE__*/t(ty,{provider:"apple"},e):"discord"===e?/*#__PURE__*/t(ty,{provider:"discord"},e):"farcaster"===e?/*#__PURE__*/t(Dg,{},e):"github"===e?/*#__PURE__*/t(ty,{provider:"github"},e):"google"===e?/*#__PURE__*/t(ty,{provider:"google"},e):"linkedin"===e?/*#__PURE__*/t(ty,{provider:"linkedin"},e):"spotify"===e?/*#__PURE__*/t(ty,{provider:"spotify"},e):"instagram"===e?/*#__PURE__*/t(ty,{provider:"instagram"},e):"tiktok"===e?/*#__PURE__*/t(ty,{provider:"tiktok"},e):"line"===e?/*#__PURE__*/t(ty,{provider:"line"},e):"twitter"===e?/*#__PURE__*/t(ty,{provider:"twitter"},e):"telegram"===e?/*#__PURE__*/t(oy,{},e):e.startsWith("privy:")?/*#__PURE__*/t(Xp,{appId:e.replace("privy:","")},e):tf({walletList:l.appearance.walletList,walletChainType:b?.walletChainType??l.appearance.walletChainType,connectors:i,connectOnly:a,ignore:v,walletConnectEnabled:l.externalWallets.walletConnect.enabled,forceWallet:{wallet:e,chainType:g??"ethereum"}}),E=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),[P,W]=((e,t)=>{let n=[],a=[];for(let[r,i]of e.entries())r<t?n.push(i):a.push(i);return[n,a]})([...E,...N,...M],af({primary:N.length+E.length,overflow:M.length}));/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{title:l.appearance.landingHeader,onClose:_,backFn:"default"===T?void 0:()=>{x("default")}}),"default"===T&&/*#__PURE__*/t(rf,{}),"default"===T&&("string"==typeof l.appearance.loginMessage?/*#__PURE__*/t(Rs,{children:l.appearance.loginMessage}):l.appearance.loginMessage),/*#__PURE__*/t(Ws,{style:{overflow:"hidden"},children:/*#__PURE__*/e(Os,{$colorScheme:p,children:["default"===T&&/*#__PURE__*/e(n,{children:[P,W.length>0&&/*#__PURE__*/t(cy,{text:"More options",icon:/*#__PURE__*/t(Xn,{}),onClick:()=>x("overflow")})]}),"overflow"===T&&/*#__PURE__*/t(n,{children:W}),C&&"default"===T&&/*#__PURE__*/t(qg,{})]})}),l&&/*#__PURE__*/t(Hs,{app:l}),/*#__PURE__*/t(qs,{})]})};let af=({primary:e,overflow:t})=>e<5?e:5===e&&0===t?5:4,rf=/*#__PURE__*/bn(Gp).withConfig({displayName:"StyledAppLogoHeader",componentId:"sc-d846420a-0"})(["margin-bottom:16px;"]);const of={component:()=>{let{app:e}=es();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?/*#__PURE__*/t(nf,{connectOnly:!1}):/*#__PURE__*/t(dy,{connectOnly:!1})},isCaptchaRequired:!0,isUnauthenticatedScreem:!0},sf={component:()=>{let[e,n]=o(null),[a,r]=o(!1),[i,s]=o(null),[l,c]=o(""),{authenticated:h,getAccessToken:p,user:u}=rn(),{walletProxy:m,refreshSessionAndUser:g,closePrivyModal:y,createAnalyticsEvent:f}=Ut(),{app:w,navigate:v,data:C,onUserCloseViaDialogOrKeybindRef:b}=es(),{onSuccess:k,onFailure:T}=C.setWalletPassword,x=tn(u),A="user-passcode"===e?.recoveryMethod,I="user-passcode"===x?.recoveryMethod;d((()=>{h||(v(of),T(new Nt("User must be authenticated before setting a password on a Privy wallet")))}),[h]);let _=()=>i?(T(i),void y({shouldCallAuthOnSuccess:!1})):A?(k(e),void y({shouldCallAuthOnSuccess:!1})):(T(new St("Exited before password was added to wallet")),void y({shouldCallAuthOnSuccess:!1}));b.current=_;/*#__PURE__*/return t(Bp,{appName:w?.name||"privy",config:{initiatedBy:"user",onCancel:_},error:i?"An error has occurred, please try again.":void 0,buttonLoading:a,buttonHideAnimations:!1,password:l,isResettingPassword:I,onPasswordGenerate:()=>c(Np()),onPasswordChange:c,onSubmit:async()=>{A?(k(e),y({shouldCallAuthOnSuccess:!1})):(r(!0),s(null),await(async()=>{let e=await p();if(e&&u&&x?.address&&l&&m)try{f({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:x.address,existingRecoveryMethod:x.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:I}});let{entropyId:t,entropyIdVerifier:a}=Oi(u);if(!(await m.setRecovery({accessToken:e,entropyId:t,entropyIdVerifier:a,recoveryPassword:l,recoveryMethod:"user-passcode"})).entropyId)return s(new St("Error setting password on privy wallet")),void f({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:x.address,existingRecoveryMethod:x.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:I,reason:"error setting password"}});let r=await g(),i=tn(r);if(!i)return s(new St("Error setting password on privy wallet")),void f({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:x.address,existingRecoveryMethod:x.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:I,reason:"wallet disconnected"}});n(i),f({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:x.address,existingRecoveryMethod:x.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:x.address,reason:e}})}})(),r(!1))},onClose:_})}},lf={component:()=>{let{closePrivyModal:a}=Ut(),{data:r,navigate:i,onUserCloseViaDialogOrKeybindRef:o}=es(),{onFailure:s}=r.setWalletPassword,l=()=>{s(new St("Exited before password was added to wallet")),a({shouldCallAuthOnSuccess:!1})};return o.current=l,/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Js,{onClose:l}),/*#__PURE__*/t(Mc,{}),/*#__PURE__*/e(_c,{children:[/*#__PURE__*/e(Wc,{children:[/*#__PURE__*/t(Xn,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),/*#__PURE__*/t(Oc,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:/*#__PURE__*/t(xa,{width:"12px",height:"12px",fill:"white"})})]}),/*#__PURE__*/e(Mh,{title:"Secure Your Account",children:["Please set a password to secure your account.",/*#__PURE__*/t("p",{children:"Losing access to this password and this device will make your account inaccessible."})]})]}),/*#__PURE__*/t(El,{onClick:()=>{i(sf)},children:"Add password"}),/*#__PURE__*/t(Pc,{}),/*#__PURE__*/t(qs,{})]})}},cf={component:()=>{let[a,r]=o(!0),{authenticated:i,getAccessToken:s,user:l}=rn(),{walletProxy:c,closePrivyModal:h,createAnalyticsEvent:p}=Ut(),{navigate:u,data:m,onUserCloseViaDialogOrKeybindRef:g}=es(),[y,f]=o(void 0),[w,v]=o(""),[C,b]=o(!1),{entropyId:k,entropyIdVerifier:T,onCompleteNavigateTo:x,onSuccess:A,onFailure:I}=m.recoverWallet,_=(e="User exited before their wallet could be recovered")=>{h({shouldCallAuthOnSuccess:!1}),I("string"==typeof e?new St(e):e)};g.current=_,d((()=>{if(!i)return _("User must be authenticated and have a Privy wallet before it can be recovered")}),[i]);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{onClose:_}),/*#__PURE__*/t(Mc,{}),/*#__PURE__*/e(hf,{children:[/*#__PURE__*/e(df,{children:[/*#__PURE__*/t(En,{height:48,width:48,stroke:"var(--privy-color-accent)"}),/*#__PURE__*/t("h3",{style:{color:"var(--privy-color-foreground)"},children:"Enter your password"}),/*#__PURE__*/t("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),/*#__PURE__*/e("div",{children:[/*#__PURE__*/e(rp,{children:[/*#__PURE__*/t(np,{type:a?"password":"text",onChange:e=>(e=>{e&&f(e)})(e.target.value),disabled:C,style:{paddingRight:"2.3rem"}}),/*#__PURE__*/t(cp,{style:{right:"0.75rem"},children:a?/*#__PURE__*/t(hp,{onClick:()=>r(!1)}):/*#__PURE__*/t(pp,{onClick:()=>r(!0)})})]}),!!w&&/*#__PURE__*/t(pf,{children:w})]}),/*#__PURE__*/e("div",{children:[/*#__PURE__*/e(Nc,{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(uf,{loading:C||!c,disabled:!y,onClick:async()=>{b(!0);let e=await s(),t=cn(l,k);if(!e||!t||null===y)return _("User must be authenticated and have a Privy wallet before it can be recovered");try{p({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:t.address}}),await(c?.recover({accessToken:e,entropyId:k,entropyIdVerifier:T,recoveryPassword:y})),v(""),x?u(x):h({shouldCallAuthOnSuccess:!1}),A?.(t),p({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:t.address}})}catch(e){!function(e){return Sd(e)&&("invalid_recovery_pin"===e.type||"invalid_request_arguments"===e.type)}(e)?v("An error has occurred, please try again."):v("Invalid recovery password, please try again.")}finally{b(!1)}},$hideAnimations:!k&&C,children:"Recover your account"})]})]}),/*#__PURE__*/t(Pc,{}),/*#__PURE__*/t(qs,{})]})}},df=/*#__PURE__*/bn.div.withConfig({displayName:"Header",componentId:"sc-3736fa5b-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin:20px 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;}"]);let hf=/*#__PURE__*/bn.div.withConfig({displayName:"Content",componentId:"sc-3736fa5b-1"})(["display:flex;flex-direction:column;justify-content:space-between;"]),pf=/*#__PURE__*/bn.div.withConfig({displayName:"ErrorMessage",componentId:"sc-3736fa5b-2"})(["line-height:20px;height:20px;font-size:13px;color:var(--privy-color-error);text-align:left;margin-top:0.5rem;"]),uf=/*#__PURE__*/bn(El).withConfig({displayName:"NoAnimationPrimaryButton",componentId:"sc-3736fa5b-3"})(["",""],(({$hideAnimations:e})=>e&&/*#__PURE__*/kn(["&&{transition:none;}"])));const mf={component:()=>{let{app:e,navigate:n,data:a,onUserCloseViaDialogOrKeybindRef:r}=es(),[i,s]=o(""),[l,c]=o(!1),[h,p]=o(),[u,m]=o(null),{create:g}=zh(),{authenticated:y,user:f}=rn(),{closePrivyModal:w,isNewUserThisSession:v,initializeWalletProxy:C}=Ut(),{onSuccess:b,onFailure:k,callAuthOnSuccessOnClose:T,shouldCreateEth:x,shouldCreateSol:A}=a.createWallet,[I,_]=o(null),S=new tr((async()=>{try{let e;if(x&&A)e=await g({recoveryMethod:"user-passcode",recoveryPassword:h,chainType:"ethereum",walletIndex:0,latestUser:f}),e=await g({chainType:"solana",walletIndex:0,latestUser:e.user});else if(A)e=await g({recoveryMethod:"user-passcode",recoveryPassword:h,chainType:"solana",walletIndex:0,latestUser:f});else{if(!x)throw Error("Invalid args to create wallet");e=await g({recoveryMethod:"user-passcode",recoveryPassword:h,chainType:"ethereum",walletIndex:0,latestUser:f})}_(e),v?n($h):(b(e),w({shouldCallAuthOnSuccess:T}))}catch(e){s(e.message)}}));d((()=>{u||C(3e4).then((e=>m(e)))}),[u]),d((()=>{if(!y||!f)return n(of),void k(Error("User must be authenticated before creating a Privy wallet"))}),[y]),r.current=()=>null;/*#__PURE__*/return t(Bp,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:!u,buttonLoading:l,buttonHideAnimations:!I&&l,isResettingPassword:!1,error:i,password:h||"",onClose:()=>{I&&"user-passcode"!==I.account.recoveryMethod?(k(new St("User created a wallet but failed to set a password for it")),w({shouldCallAuthOnSuccess:!1})):I?(b(I),w({shouldCallAuthOnSuccess:T})):(k(new St("User wallet creation failed")),w({shouldCallAuthOnSuccess:!1}))},onPasswordChange:p,onPasswordGenerate:()=>p(Np()),onSubmit:async()=>(c(!0),S.execute().then((()=>new Promise((e=>setTimeout(e,250))))).finally((()=>c(!1))))})}},gf=/*#__PURE__*/bn.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)")),yf=/*#__PURE__*/bn.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;"]),ff={component:()=>{let{user:a,getAccessToken:r}=rn(),{walletProxy:i,refreshSessionAndUser:s,closePrivyModal:l}=Ut(),c=es(),{entropyId:d,entropyIdVerifier:h}=c.data?.recoverWallet,[p,u]=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(Js,{onClose:w},"header"),/*#__PURE__*/t(gf,{$color:"var(--privy-color-error)",style:{alignSelf:"center"},children:/*#__PURE__*/t(Un,{height:38,width:38,stroke:"var(--privy-color-error)"})}),/*#__PURE__*/t(yf,{style:{marginTop:"0.5rem"},children:"Something went wrong"}),/*#__PURE__*/t(Ps,{style:{minHeight:"2rem"}}),/*#__PURE__*/t(Nl,{onClick:()=>f(null),children:"Try again"}),/*#__PURE__*/t(qs,{})]}:{children:[/*#__PURE__*/t(Js,{onClose:w},"header"),/*#__PURE__*/t(ga,{style:{width:"3rem",height:"3rem",alignSelf:"center"}}),/*#__PURE__*/t(yf,{style:{marginTop:"0.5rem"},children:"Automatically secure your account"}),/*#__PURE__*/t(cm,{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(Ps,{style:{minHeight:"2rem"}}),/*#__PURE__*/t(Nl,{loading:p,disabled:v,onClick:()=>async function(){u(!0);try{let e=await r(),t=cn(a,d);if(!e||!i||!t)return;if(!(await i.setRecovery({accessToken:e,entropyId:d,entropyIdVerifier:h,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=cn(n,t.address);if(!o)throw Error("Unabled to set recovery on wallet");g(!!n),setTimeout((()=>{c.data?.setWalletPassword?.onSuccess(o),l()}),rr)}catch(e){f(e)}finally{u(!1)}}(),children:m?"Success":"Confirm"}),/*#__PURE__*/t(qs,{})]})}};function wf({isCreatingWallet:e,skipSplashScreen:t}){return e?mf:t?sf:lf}function vf({walletAction:e,availableRecoveryMethods:t,legacySetWalletPasswordFlow:n,isResettingPassword:a,showAutomaticRecovery:r}){return r?ff:n||1===t.length?wf({isCreatingWallet:"create"===e,skipSplashScreen:a}):Gh}function Cf(e){switch(e){case"user-passcode":return cf;case"google-drive":case"icloud":return qh;default:throw Error("Recovery method not supported")}}const bf=({children:n,theme:a})=>/*#__PURE__*/e(kf,{$theme:a,children:[/*#__PURE__*/t(Ia,{width:"1.25rem",color:"dark"===a?"var(--privy-color-accent-light)":"var(--privy-color-accent-dark)",style:{minWidth:"1.25rem"}}),n]});let kf=/*#__PURE__*/bn.div.withConfig({displayName:"Container",componentId:"sc-c3403117-0"})(["display:flex;gap:0.5rem;background-color:var(--privy-color-warn-light);color:var(--privy-color-foreground);align-items:flex-start;text-align:left;font-size:0.8125rem;font-weight:400;line-height:1.125rem;padding:0.75rem;&&{border-radius:var(--privy-border-radius-sm);}"]);const Tf=/*#__PURE__*/bn.div.withConfig({displayName:"Column",componentId:"sc-cfc52180-0"})(["display:flex;flex-direction:column;"]),xf=/*#__PURE__*/bn.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;"]),Af=/*#__PURE__*/kn(["&&{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?"border-color: var(--privy-color-error);":"")),If=/*#__PURE__*/bn.div.withConfig({displayName:"Box",componentId:"sc-1660059c-0"})(["",""],Af),_f=({errMsg:a,balance:r,address:i,isLoading:o,className:s,title:l,isPulsing:c,showIcon:d,statusColor:h="green"})=>{let p;return p=h||(a?"red":"green"),/*#__PURE__*/e(n,{children:[/*#__PURE__*/e(If,{className:s,$state:a?"error":void 0,children:[/*#__PURE__*/e(Tf,{children:[/*#__PURE__*/t(xf,{children:l||"Pay with"}),/*#__PURE__*/t(eh,{address:i,showCopyIcon:d||!!a})]}),void 0!==r&&/*#__PURE__*/t(Ig,{isLoading:o,isPulsing:c,color:p,children:r})]}),a&&/*#__PURE__*/t(rm,{style:{marginTop:"0.25rem"},children:a})]})};function Sf({rpcConfig:e,appId:t,address:n,chain:a}){let{chains:r}=Ut(),[i,l]=o(0n),[c,p]=o(!1),u=s((()=>{let n=a||r[0];if(n)return Lt({chain:a,transport:Rt(di(n,e,t))})}),[a,e,t]),m=h((async()=>{if(!n||!u)return;p(!0);let e=await u.getBalance({address:n}).catch(console.error);return e?(l(e),p(!1),e):void 0}),[u,n,l]);return d((()=>{m().catch(console.error)}),[]),{balance:i,isLoading:c,reloadBalance:m}}const Ef="sdk_fiat_on_ramp_completed_with_status",Nf=async({chain:e,address:t,appId:n,rpcConfig:a,erc20Address:r})=>{let i=Lt({chain:e,transport:Rt(di(e,a,n))});return{balance:await i.readContract({address:r,abi:Mf,functionName:"balanceOf",args:[t]}).catch((()=>0n)),chain:e}};let Mf=[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"}];const Pf=Symbol("solana-funding-plugin"),Wf=async({emitPrivyEvent:e,getAccessToken:t,initializeWalletProxy:n,refreshSessionAndUser:a,user:r,appConfig:i},{privateKey:o,chainType:s})=>{if("user-controlled-server-wallets-only"===i.embeddedWallets.mode)throw e("linkAccount","onError",Te.UNSUPPORTED_WALLET_TYPE,{linkMethod:"siwe"}),new pe("Importing wallets is only supported for on-device execution and this app uses TEE execution. Learn more https://docs.privy.io/recipes/tee-wallet-migration-guide");if(!r)throw e("linkAccount","onError",Te.MUST_BE_AUTHENTICATED,{linkMethod:"siwe"}),new pe("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 pe("User must be authenticated before linking an account.");await c.importWallet({privateKey:o,accessToken:l,chainType:s});let d=await a(),h="solana"===s?dn(d):hn(d);if(!h)throw e("createWallet","onError",Te.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to import wallet");return e("createWallet","onSuccess",{wallet:h}),h};class Uf{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(ti(e.params.message,"base64"));return{signature:ti(t).toString("base64")}}async request(e){if(console.debug("EmbeddedSolanaProvider.request() called with args",e),!await Tk())throw Error("User must be authenticated to use embedded Solana wallet");if(!await Ek({address:this.address}))throw new pe("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 Of({tx:e,accessToken:t,walletProxy:n,entropyId:a,entropyIdVerifier:r,transactingWalletAddress:i,transactingWalletIndex:o}){let s=sc(e,i),l=oc(e)?ti(e.message.serialize()):e.serializeMessage(),{response:c}=await n.rpc({accessToken:t,entropyId:a,entropyIdVerifier:r,chainType:"solana",hdWalletIndex:o,request:{method:"signMessage",params:{message:l.toString("base64")}}}),d=ti(c.data.signature,"base64");return e.addSignature(s,d),e}const Lf=e=>e.reduce(((e,t)=>!e||e.walletIndex<t.walletIndex?t:e),null);let Rf=async({accessToken:e,appConfig:t,privy:n,emitPrivyEvent:a,proxy:r,refreshSessionAndUser:i,recoverEmbeddedWallet:o,user:s,walletIndex:l,setModalData:c,openModal:d,chainType:h,setUser:p})=>{if(l<0)throw a("createWallet","onError",Te.EMBEDDED_WALLET_CREATE_ERROR),Error(`A negative walletIndex (${l}) is invalid.`);let u=tn(s);if(l>0&&!u)throw a("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 a("createWallet","onError",Te.EMBEDDED_WALLET_CREATE_ERROR),Error("User owned recovery not yet supported for this app.");if(!u&&t.embeddedWallets.requireUserOwnedRecoveryOnCreate)return await Ff({emitPrivyEvent:a,setModalData:c,openModal:d,chainType:h});let m=Dh(s,{chainType:h,walletIndex:l})[0];if(m)return{user:s,account:m};if(0===l&&!r)return Ff({emitPrivyEvent:a,setModalData:c,openModal:d,chainType:h});if(!r)throw a("createWallet","onError",Te.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to connect to wallet proxy");return Bh({appConfig:t,walletIndex:l,chainType:h,user:s,accessToken:e,proxy:r,refreshSessionAndUser:i,privy:n,recoverEmbeddedWallet:o,setUser:p})},Ff=async({emitPrivyEvent:e,setModalData:t,openModal:n,chainType:a})=>new Promise(((r,i)=>{t({createWallet:{onSuccess:({user:t,account:n})=>{e("createWallet","onSuccess",{wallet:n}),r({user:t,account:n})},onFailure:t=>{e("createWallet","onError",Te.UNKNOWN_EMBEDDED_WALLET_ERROR),i(t)},callAuthOnSuccessOnClose:!1,shouldCreateEth:"ethereum"===a,shouldCreateSol:"solana"===a}}),n(Vu)}));const Df=()=>{let e=Go(),t=Ns(),{setModalData:n}=es(),{getAccessToken:a}=rn(),{initializeWalletProxy:r,recoverEmbeddedWallet:i,setUser:o,openModal:s,refreshSessionAndUser:l,privy:c}=Ut();return{create:async({chainType:d,options:h,latestUser:p})=>{let u=p;if(u||(u=await l()),!u)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:a,privy:r,emitPrivyEvent:i,recoverEmbeddedWallet:o,setModalData:s,openModal:l,setUser:c,options:d,timeoutDuration:h,refreshSessionAndUser:p,chainType:u})=>{let[m,g]=await Promise.all([n(h),t()]);if(!g||!a)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 Rf({accessToken:g,appConfig:e,privy:r,emitPrivyEvent:i,openModal:l,proxy:m,refreshSessionAndUser:p,recoverEmbeddedWallet:o,setModalData:s,user:a,walletIndex:d.walletIndex,chainType:u,setUser:c})}let y=d&&"createAdditional"in d&&d.createAdditional,f=Dh(a,{chainType:u});if(f[0]&&!y)throw i("createWallet","onError",Te.EMBEDDED_WALLET_ALREADY_EXISTS),Error("User already has an embedded wallet.");return Rf({accessToken:g,appConfig:e,privy:r,emitPrivyEvent:i,openModal:l,proxy:m,recoverEmbeddedWallet:o,setModalData:s,user:a,walletIndex:(Lf(f)?.walletIndex??-1)+1,chainType:u,refreshSessionAndUser:p,setUser:c})})({appConfig:e,privy:c,getAccessToken:a,refreshSessionAndUser:l,initializeWalletProxy:r,user:u,emitPrivyEvent:t,recoverEmbeddedWallet:i,setModalData:n,openModal:s,setUser:o,options:h,timeoutDuration:Ir,chainType:d})}}};function Bf(e){let{create:t}=Df();return Ss("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 zf=()=>{let{getAccessToken:e,user:t}=rn(),{refreshSessionAndUser:n,initializeWalletProxy:a}=Ut(),r=Ns(),i=Go();return{importWallet:h((({privateKey:o})=>Wf({getAccessToken:e,user:t,initializeWalletProxy:a,refreshSessionAndUser:n,emitPrivyEvent:r,appConfig:i},{privateKey:o,chainType:"ethereum"})),[t,e,n,a,r])}},$f=()=>{let{importWallet:e}=zf(),{createWallet:t}=Bf();return{...l(on),importWallet:e,createWallet:t}},jf=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)))),Vf=e=>!!e.fundingConfig&&jf(e.fundingConfig.options).length>=1,Hf=({children:n,theme:a})=>/*#__PURE__*/e(qf,{$theme:a,children:[/*#__PURE__*/t(Un,{width:"3rem",color:"var(--privy-color-error)"}),n]});let qf=/*#__PURE__*/bn.div.withConfig({displayName:"Container",componentId:"sc-5400b18f-0"})(["display:flex;gap:0.5rem;"," align-items:flex-start;text-align:left;padding:0.5rem 0.75rem;font-size:0.75rem;font-weight:400;line-height:1.125rem;padding:0.5rem 0.75rem;&&{border:1px solid var(--privy-color-error);border-radius:var(--privy-border-radius-sm);}"],(e=>"dark"===e.$theme?"color: var(--privy-color-error);":"background-color: var(--privy-color-error-light);"));const Kf=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"})}),Zf=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"})]}),Yf=e=>{let[t,n]=o();return d((()=>{e().then((e=>{n(e)})).catch((()=>{}))}),[]),t},Gf=({...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"})]}),Jf=async({address:e,chain:t,rpcConfig:n,privyAppId:a})=>{try{let r=Lt({chain:t,transport:Rt(di(t,n,a))}),[i,o]=await Promise.all([r.readContract({abi:Qf,address:e,functionName:"symbol"}),r.readContract({abi:Qf,address:e,functionName:"decimals"})]);return{decimals:o,symbol:i}}catch(e){return console.log(e),null}};let Qf=[{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 Xf=({size:n})=>/*#__PURE__*/t(ew,{$size:n,children:/*#__PURE__*/e(tw,{children:[/*#__PURE__*/t(nw,{}),/*#__PURE__*/t(aw,{})]})});let ew=/*#__PURE__*/bn.div.withConfig({displayName:"LoadingContainer",componentId:"sc-3ddaba1c-0"})(["--spinner-size:",";display:flex;justify-content:center;align-items:center;flex-grow:1;@media all and (display-mode:standalone){margin-bottom:30px;}"],(e=>e.$size?e.$size:"96px")),tw=/*#__PURE__*/bn.div.withConfig({displayName:"SpinnerContainer",componentId:"sc-3ddaba1c-1"})(["position:relative;height:var(--spinner-size);width:var(--spinner-size);opacity:1;animation:fadein 200ms ease;"]),nw=/*#__PURE__*/bn.div.withConfig({displayName:"CircleFixed",componentId:"sc-3ddaba1c-2"})(["position:absolute;top:0;right:0;bottom:0;left:0;width:var(--spinner-size);height:var(--spinner-size);&&{border:4px solid #f1f2f9;border-radius:50%;}"]),aw=/*#__PURE__*/bn.div.withConfig({displayName:"CircleRotate",componentId:"sc-3ddaba1c-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:#cbcde1 transparent transparent transparent;border-radius:50%;}@keyframes spin{from{transform:rotate(0deg);}to{transform:rotate(360deg);}}"]);const rw=/*#__PURE__*/bn.span.withConfig({displayName:"Rows",componentId:"sc-b764aab6-0"})(["display:flex;flex-direction:column;gap:0.35rem;width:100%;"]),iw=/*#__PURE__*/bn.span.withConfig({displayName:"Row",componentId:"sc-b764aab6-1"})(["display:flex;width:100%;justify-content:space-between;gap:0.5rem;"]),ow=/*#__PURE__*/bn.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;"]),sw=/*#__PURE__*/bn(ow).withConfig({displayName:"LabelSmPrimary",componentId:"sc-6c002d6-1"})(["color:var(--privy-color-accent);"]),lw=/*#__PURE__*/bn.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;",""],Ag),cw=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 dw={[B.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"})]})]})})]})})}),[z.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"})]}),[$.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"})]}),[j.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"})]}),[V.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)"})})})]}),[E.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"})]}),[H.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"})]}),[q.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"})]}),[K.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 hw=({chainId:e,...n})=>{if("solana"===e)/*#__PURE__*/return t(cw,{...n});let a=dw[e];/*#__PURE__*/return t(a||Ea,{...n})},pw=({wallet:a,displayName:r,addressToFund:i,chainId:o,chainName:s,isBridging:l,isErc20Flow:c,totalPriceInNativeCurrency:d,totalPriceInUsd:h,gasPriceInNativeCurrency:p,gasPriceInUsd:u})=>{let m=Mo(a.walletClientType);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(gb,{}),/*#__PURE__*/t(Xf,{}),/*#__PURE__*/t(xc,{style:{marginTop:"16px"},children:/*#__PURE__*/t(Uy,{icon:m?.image_url?.md,name:a.walletClientType})}),/*#__PURE__*/t(Mh,{style:{marginTop:"8px",marginBottom:"12px"},title:`${l?"Bridging":"Confirming"} with ${r}`}),!l&&!c&&/*#__PURE__*/e(rw,{children:[/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Total"}),/*#__PURE__*/t(lw,{children:h||d})]}),/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"To"}),/*#__PURE__*/t(lw,{children:/*#__PURE__*/t(eh,{address:i,showCopyIcon:!1})})]}),/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Network"}),/*#__PURE__*/t(lw,{children:/*#__PURE__*/e(uw,{children:[/*#__PURE__*/t(hw,{chainId:o,height:16,width:16})," ",s]})})]}),p&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Estimated fee"}),/*#__PURE__*/t(lw,{children:u||p})]})]}),/*#__PURE__*/t(Uc,{height:24}),/*#__PURE__*/t(qs,{})]})};let uw=/*#__PURE__*/bn.div.withConfig({displayName:"NetworkColumn",componentId:"sc-ec6320ce-0"})(["display:flex;flex-direction:row;align-items:center;gap:4px;"]);const mw={component:()=>{let{closePrivyModal:a,createAnalyticsEvent:r}=Ut(),{navigate:s,setModalData:l,app:c,data:h}=es(),{wallets:p}=$C(),u=mm(),[m,g]=o(0n),[y,f]=o(null),[w,v]=o(!1),[C,b]=o(!1),k=i(!1);if(!h?.funding||"solana"!==h.funding.chainType)throw Error("Invalid funding data");let{address:T,amount:x,cluster:A,connectedWalletAddress:I}=h.funding,_=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"}}(A),{tokenPrice:S}=ld("solana"),{fundingAmountInBaseUnit:E,totalPriceInUsd:N,totalPriceInNativeCurrency:M,feePriceInNativeCurrency:P,feePriceInUsd:W}=ac({amount:x,fee:m,tokenPrice:S,isUsdc:h.funding.isUSDC}),U=I?p.find((({address:e})=>e===I)):p[0],O=Mo(U?.walletClientType||"unknown"),L=O?.name||"wallet";return d((()=>{(async()=>{if("solana"===U?.type&&U.sendTransaction&&!w&&!k.current){k.current=!0;try{let e=u(Pf);if(!e)throw new pe("Unable to load solana plugin");let{connection:t,transaction:n}=h.funding?.isUSDC?await e.createSplTransferTransaction({from:U.address,to:T,amount:E,mintAddress:Z[A.name],cluster:A}):await e.createTransferTransaction({from:U.address,to:T,amount:E,cluster:A}),a=await n.getEstimatedFee(t);null!=a&&g(BigInt(a)),v(!0);let i=await t.simulateTransaction(n);if(i.value.err)return i.value.logs?.find((e=>/insufficient (lamports|funds)/gi.test(e)))?void f(new pe(`Wallet ${pi(U.address,void 0,void 0,"solana")} does not have enough funds.`,void 0,Te.INSUFFICIENT_BALANCE)):(console.error("Transaction failed:",i.value.err),void f(new pe("Something went wrong",void 0,Te.TRANSACTION_FAILURE)));let o=await U.sendTransaction(n,t),{value:s,token:l}=h.funding?.isUSDC?{value:Dt(E,6),token:"USDC"}:{value:Dt(E,9),token:"SOL"};r({eventName:Ef,payload:{provider:"external",status:"success",txHash:o,rpcEndpoint:_,address:U.address,value:s,chainType:"solana",clusterName:A.name,token:l,destinationAddress:T,destinationValue:s,destinationChainType:"solana",destinationClusterName:A.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 pe("Transaction was rejected by the user",void 0,Te.TRANSACTION_FAILURE));f(new pe("Something went wrong",void 0,Te.TRANSACTION_FAILURE))}}})().catch(console.error).finally((()=>k.current=!1))}),[]),d((()=>{y&&(l({funding:h?.funding,sendTransaction:h?.sendTransaction,errorModalData:{error:y,previousScreen:sv}}),s(Cu,!1))}),[y]),d((()=>{if(!C)return;let e=setTimeout(a,or);return()=>clearTimeout(e)}),[C]),C?/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(gb,{}),/*#__PURE__*/t(Mc,{}),/*#__PURE__*/e(_c,{children:[/*#__PURE__*/t(Aa,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),/*#__PURE__*/t(Mh,{title:"Success!",description:`You’ve successfully added ${x} ${h.funding?.isUSDC?"USDC":"SOL"} to your ${c.name} wallet. It may take a minute before the funds are available to use.`})]}),/*#__PURE__*/t(Pc,{}),/*#__PURE__*/t(qs,{})]}):U&&w?/*#__PURE__*/t(pw,{wallet:U,displayName:L,addressToFund:T,isBridging:!1,isErc20Flow:!!h.funding?.isUSDC,totalPriceInUsd:N,totalPriceInNativeCurrency:M,gasPriceInUsd:W,gasPriceInNativeCurrency:P,chainId:"solana",chainName:A.name}):
21
21
  /*#__PURE__*/e(n,{children:[/*#__PURE__*/t(gb,{}),/*#__PURE__*/t(Xf,{}),/*#__PURE__*/t("div",{style:{marginTop:"1rem"}}),/*#__PURE__*/t(qs,{})]})}},gw=[{constant:!1,inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}];let yw=2n**256n-1n;const fw=({amount:e,decimals:t})=>e===yw?"Maximum":Intl.NumberFormat(void 0,{maximumFractionDigits:t}).format(Number(e)/10**t),ww=({chains:e,appId:t,address:n,rpcConfig:a,includeUsdc:r})=>Promise.all(e.map((async e=>{let i=Lt({chain:e,transport:Rt(di(e,a,t))}),o=await i.getBalance({address:n}).catch((()=>0n)),s=null,l=Y[e.id];if(r&&l){let{balance:r}=await Nf({address:n,chain:e,rpcConfig:a,appId:t,erc20Address:l});s=r}return{balance:o,erc20Balance:s,erc20Address:l,chain:e}}))),vw=({balance:e,className:n,chain:a})=>/*#__PURE__*/t(If,{className:n,$state:void 0,children:/*#__PURE__*/t(Cw,{balance:e,chain:a})}),Cw=({balance:a,chain:r})=>/*#__PURE__*/e(n,{children:[/*#__PURE__*/e(bw,{children:[/*#__PURE__*/t(Tw,{chainId:"id"in r?r.id:"solana"}),/*#__PURE__*/t(lw,{children:r.name})]}),/*#__PURE__*/e(Ig,{isLoading:!1,isPulsing:!1,color:"gray",children:[/*#__PURE__*/t(kw,{children:/*#__PURE__*/t(na,{})}),a]})]});let bw=/*#__PURE__*/bn.div.withConfig({displayName:"Container",componentId:"sc-d24ae982-0"})(["display:flex;align-items:center;"]),kw=/*#__PURE__*/bn.div.withConfig({displayName:"IconContainer",componentId:"sc-d24ae982-1"})(["height:0.75rem;width:0.75rem;margin-right:0.2rem;"]),Tw=/*#__PURE__*/bn(hw).withConfig({displayName:"StyledNetworkIcon",componentId:"sc-d24ae982-2"})(["height:1.25rem;width:1.25rem;display:inline-block;margin-right:0.5rem;border-radius:4px;"]);const xw=({options:n,onSelect:a,selected:r,className:i})=>/*#__PURE__*/e(zn,{as:Aw,children:[/*#__PURE__*/e($n,{as:Ew,children:[/*#__PURE__*/t(Cw,{balance:r.balance,chain:r.chain}),/*#__PURE__*/t(Sw,{height:16})]}),/*#__PURE__*/t(jn,{as:Iw,className:i,children:n.map(((e,n)=>/*#__PURE__*/t(Vn,{as:_w,onClick:()=>a(n),children:/*#__PURE__*/t(Cw,{balance:e.balance,chain:e.chain})},n)))})]});let Aw=/*#__PURE__*/bn.div.withConfig({displayName:"Wrapper",componentId:"sc-31c00f79-0"})(["width:100%;position:relative;"]),Iw=/*#__PURE__*/bn.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;"]),_w=/*#__PURE__*/bn.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);}"]),Sw=/*#__PURE__*/bn(On).withConfig({displayName:"StyledChevronIcon",componentId:"sc-31c00f79-3"})(["height:1rem;margin-left:0.5rem;"]),Ew=/*#__PURE__*/bn.button.withConfig({displayName:"StyledMenuButton",componentId:"sc-31c00f79-4"})([""," span{margin-left:auto;}","{transition:rotate 100ms ease-in;}&[aria-expanded='true']{","{rotate:-180deg;}}"],Af,Sw,Sw),Nw=({passkeys:n,expanded:a,onUnlink:r,onExpand:i})=>{let[s,l]=o([]),c=a?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(zw,{children:"Your passkeys"}),/*#__PURE__*/e(Rw,{children:[n.slice(0,c).map((n=>/*#__PURE__*/e(Vw,{children:[/*#__PURE__*/e("div",{children:[/*#__PURE__*/t($w,{children:d(n)}),/*#__PURE__*/e(jw,{children:["Last used: ",(n.latestVerifiedAt??n.verifiedAt).toLocaleString()]})]}),/*#__PURE__*/t(qw,{disabled:s.includes(n.credentialId),onClick:()=>(async e=>{l((t=>t.concat([e]))),await r(e),l((t=>t.filter((t=>t!==e))))})(n.credentialId),children:s.includes(n.credentialId)?/*#__PURE__*/t(Il,{}):/*#__PURE__*/t(Oa,{height:"1.6em"})})]},n.credentialId))),n.length>2&&!a&&/*#__PURE__*/t(Lw,{onClick:i,children:"View all"})]})]})},Mw=()=>/*#__PURE__*/e(Rw,{children:[/*#__PURE__*/e(dl,{children:[/*#__PURE__*/t(cl,{children:/*#__PURE__*/t(La,{})}),"Log in with Touch ID, Face ID, or a security key."]}),/*#__PURE__*/e(dl,{children:[/*#__PURE__*/t(cl,{children:/*#__PURE__*/t(xa,{})}),"More secure than a password."]}),/*#__PURE__*/e(dl,{children:[/*#__PURE__*/t(cl,{children:/*#__PURE__*/t(Ua,{})}),"Takes seconds to set up and use."]})]});const Pw={component:()=>{let{user:a,unlinkPasskey:r}=rn(),{linkWithPasskey:i,closePrivyModal:s}=Ut(),l=a?.linkedAccounts.filter((e=>"passkey"===e.type)),[c,h]=o(!1),[p,u]=o(""),[m,g]=o(!1),[y,f]=o(!1);d((()=>{0===l.length&&f(!1)}),[l.length]);let w=async e=>(h(!0),await r(e).then((()=>g(!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((()=>{h(!1)})));/*#__PURE__*/return e(n,m?{children:[/*#__PURE__*/t(Js,{onClose:()=>s()},"header"),/*#__PURE__*/t(Cl,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(Aa,{})}),/*#__PURE__*/t(Fw,{style:{marginBottom:"1.5rem"},children:"Passkeys updated"}),/*#__PURE__*/t(Dw,{children:" "}),/*#__PURE__*/t(hl,{children:/*#__PURE__*/t(El,{onClick:()=>s(),children:"Done"})}),/*#__PURE__*/t(Ks,{})]}:y?{children:[/*#__PURE__*/t(Js,{backFn:()=>f(!1),onClose:()=>s()},"header"),/*#__PURE__*/t(Nw,{passkeys:l,expanded:y,onUnlink:w,onExpand:()=>f(!0)}),/*#__PURE__*/t(Ks,{})]}:{children:[/*#__PURE__*/t(Js,{onClose:()=>s()},"header"),/*#__PURE__*/t(rl,{children:/*#__PURE__*/e(Ww,{children:[/*#__PURE__*/t(gd,{}),/*#__PURE__*/t(zg,{})]})}),/*#__PURE__*/t(Fw,{children:"Secure your account with a passkey"}),/*#__PURE__*/t(Bw,{}),0===l.length?/*#__PURE__*/t(Mw,{}):/*#__PURE__*/t(Nw,{passkeys:l,expanded:y,onUnlink:w,onExpand:()=>f(!0)}),/*#__PURE__*/e(hl,{style:{marginTop:"12px"},children:[p&&/*#__PURE__*/t(Uw,{$fail:!0,children:p}),/*#__PURE__*/t(El,{onClick:()=>{h(!0),i().then((()=>g(!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((()=>{h(!1)}))},loading:c,children:"Add new passkey"})]}),/*#__PURE__*/t(Ks,{})]})}},Ww=/*#__PURE__*/bn.div.withConfig({displayName:"DoubleIconWrapper",componentId:"sc-d6832d36-0"})(["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 Uw=/*#__PURE__*/bn.div.withConfig({displayName:"InputHelp",componentId:"sc-d6832d36-1"})(["line-height:20px;height:20px;font-size:13px;color:",";display:flex;justify-content:flex-beginngin;width:100%;"],(e=>e.$fail?"var(--privy-color-error)":"var(--privy-color-foreground-3)")),Ow=/*#__PURE__*/kn(["&&{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 Lw=/*#__PURE__*/bn.button.withConfig({displayName:"LinkButton",componentId:"sc-d6832d36-2"})(["",""],Ow);let Rw=/*#__PURE__*/bn.div.withConfig({displayName:"List",componentId:"sc-d6832d36-3"})(["display:flex;flex-direction:column;align-items:stretch;gap:0.8rem;padding:0.5rem 0rem 0rem;flex-grow:1;width:100%;"]),Fw=/*#__PURE__*/bn.div.withConfig({displayName:"ModalTitle",componentId:"sc-d6832d36-4"})(["font-size:18px;line-height:18px;text-align:center;font-weight:600;"]),Dw=/*#__PURE__*/bn.div.withConfig({displayName:"ModalSubTitle",componentId:"sc-d6832d36-5"})(["font-size:0.875rem;text-align:center;margin-top:10px;"]),Bw=/*#__PURE__*/bn.div.withConfig({displayName:"SectionSpacer",componentId:"sc-d6832d36-6"})(["height:32px;"]),zw=/*#__PURE__*/bn.div.withConfig({displayName:"PasskeyListTitle",componentId:"sc-d6832d36-7"})(["line-height:20px;height:20px;font-size:1em;font-weight:450;display:flex;justify-content:flex-beginning;width:100%;"]),$w=/*#__PURE__*/bn.div.withConfig({displayName:"PasskeyItemTitle",componentId:"sc-d6832d36-8"})(["font-size:1em;line-height:1.3em;font-weight:500;color:var(--privy-color-foreground-2);padding:0.2em 0;"]),jw=/*#__PURE__*/bn.div.withConfig({displayName:"PasskeyItemSubtitle",componentId:"sc-d6832d36-9"})(["font-size:0.875rem;line-height:1rem;color:#64668b;padding:0.2em 0;"]),Vw=/*#__PURE__*/bn.div.withConfig({displayName:"PasskeyListItem",componentId:"sc-d6832d36-10"})(["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;"]),Hw=/*#__PURE__*/kn([":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);}"]),qw=/*#__PURE__*/bn.button.withConfig({displayName:"PasskeyItemUnlinkButton",componentId:"sc-d6832d36-11"})(["",""],Hw);const Kw=/*#__PURE__*/bn.div.withConfig({displayName:"FundingMethodContainer",componentId:"sc-eaaa12a-0"})(["display:flex;flex-direction:column;gap:12px;padding-top:24px;padding-bottom:24px;"]),Zw=/*#__PURE__*/bn.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);}"]),Yw=/*#__PURE__*/bn.div.withConfig({displayName:"FundingQuantityWrapper",componentId:"sc-eaaa12a-2"})(["display:flex;flex-direction:column;justify-content:center;align-items:flex-start;gap:8px;"]),Gw=/*#__PURE__*/bn.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);}"]),Jw=/*#__PURE__*/bn.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;}"]),Qw=/*#__PURE__*/bn(Jw).withConfig({displayName:"FundingAmountInputLarge",componentId:"sc-eaaa12a-6"})(["&&{font-size:42px;}"]),Xw=/*#__PURE__*/bn.div.withConfig({displayName:"FundingCurrency",componentId:"sc-eaaa12a-8"})(["font-size:18px;"]),ev=/*#__PURE__*/bn.div.withConfig({displayName:"FundingDollars",componentId:"sc-eaaa12a-9"})(["font-size:12px;color:var(--privy-color-foreground-3);height:20px;"]),tv=/*#__PURE__*/bn.div.withConfig({displayName:"InfoButtonText",componentId:"sc-eaaa12a-13"})([""]),nv=/*#__PURE__*/bn.a.withConfig({displayName:"InfoButtonLink",componentId:"sc-eaaa12a-14"})(["&&{color:var(--privy-color-accent);}cursor:pointer;"]),av=({displayName:a,errorMessage:r,configuredFundingChain:o,formattedBalance:s,fundingAmount:l,fundingCurrency:c,fundingAmountInUsd:d,options:h,selectedOption:p,isPreparing:u,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(gb,{}),/*#__PURE__*/t(Mc,{}),/*#__PURE__*/t(yf,{children:"Transfer from another network"}),/*#__PURE__*/e(cm,{children:["You need more funds on the ",o.name," network. Bridge from another blockchain network."]}),/*#__PURE__*/e(Yw,{style:{marginTop:"2rem"},children:[/*#__PURE__*/e(Gw,{onClick:()=>b.current?.focus(),children:[/*#__PURE__*/t(Jw,{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(Xw,{children:c})]}),d&&/*#__PURE__*/t(ev,{children:d})]}),/*#__PURE__*/e(iw,{style:{marginTop:"1.5rem"},children:[/*#__PURE__*/t(ow,{children:"From"}),/*#__PURE__*/t(ow,{children:G(y)})]}),/*#__PURE__*/t(xw,{selected:{chain:p.chain,balance:p.isErc20Quote?fw({amount:p.erc20Balance??0n,decimals:C?.decimals??6})+` ${C?.symbol||""}`:ql(p.balance,p.chain.nativeCurrency.symbol,3,!0)},options:h.map((({chain:e,balance:t,isErc20Quote:n,erc20Balance:a})=>({chain:e,balance:n?fw({amount:a??0n,decimals:C?.decimals??6})+` ${C?.symbol||""}`:ql(t,e.nativeCurrency.symbol,3,!0)}))),onSelect:w}),/*#__PURE__*/e(iw,{style:{marginTop:"1.5rem"},children:[/*#__PURE__*/t(ow,{children:"To"}),/*#__PURE__*/t(ow,{children:G(g)})]}),/*#__PURE__*/t(vw,{chain:o,balance:s}),/*#__PURE__*/t(rm,{style:{marginTop:"1rem"},children:r}),/*#__PURE__*/e(Nl,{style:{marginTop:"1rem"},loading:m||u,disabled:u||m,onClick:f,children:["Confirm with ",a]}),/*#__PURE__*/t(Pc,{}),/*#__PURE__*/t(qs,{})]})},rv={component:()=>{let{rpcConfig:a,appId:r,closePrivyModal:i,createAnalyticsEvent:s}=Ut(),{navigate:l,setModalData:c,app:h,data:p}=es(),{wallets:u}=dd(),[m,g]=o(!1),[y,f]=o(0n),[w,v]=o(!1),[C,b]=o(null),[k,T]=o(null),[x,A]=o([]),[I,_]=o(0),[S,E]=o(!1),[M,P]=o(!1),[W,U]=o(!1),[O,L]=o(!1),[R,F]=o(),[D,B]=o();if(!p?.funding||"ethereum"!==p.funding.chainType)throw Error("Invalid funding data");let{erc20ContractInfo:z,chain:$,connectedWalletAddress:j}=p.funding,V=p.funding.address,H=p.funding.erc20Address,[q,K]=o(p.funding.amount);d((()=>{H&&!z&&b(Error("Unable to fetch token details"))}),[]);let Z=!!H&&!!z,Y=Z?BigInt(parseFloat(q)*10**z.decimals):jt(q),G=j?u.find((({address:e})=>e===j)):u[0],J=Mo(G?.walletClientType||"unknown"),Q=J?.name||"wallet",[X,ee]=o(null);d((()=>{(async()=>{if(!G)return;let e=await G.getEthereumProvider();ee(Vt({account:G.address,transport:Ht(e)}).extend(qt))})().catch(console.error)}),[G]);let[te,ne]=o(0n);d((()=>{Lt({chain:$,transport:Rt(di($,a,r))}).getBalance({address:V}).then(ne).catch(console.error)}),[]);let[ae,re]=o(0n);d((()=>{Z&&Nf({chain:$,address:V,appId:r,rpcConfig:a,erc20Address:H}).then((e=>re(e.balance))).catch(console.error)}),[]);let{tokenPrice:ie}=ld($.id),[oe,se]=o({to:V,chain:$,value:Y,data:void 0});d((()=>{(async()=>{let e,t;if(!X||!G||S||W)return;E(!0);let n=Lt({chain:oe.chain,transport:Rt(di(oe.chain,a,r))});if(Z&&!oe.data)return await n.simulateContract({address:H,chain:oe.chain,abi:gw,functionName:"transfer",args:[V,Y],account:G.address}).catch((e=>{console.warn("Simulated token transfer failed with error, fetching bridge options.",e)}))?(E(!1),void se({to:H,chain:oe.chain,data:Kt({abi:gw,functionName:"transfer",args:[V,Y]}),value:"0x0"})):(E(!1),void v(!0));try{e=await n.prepareTransactionRequest({account:G.address,to:oe.to,chain:oe.chain,data:oe.data,value:BigInt(oe.value??0)})}catch(e){if(console.error(e),x.length>1)T(e.shortMessage??"Something went wrong");else if(M&&0===x.length)return void b(new pe(`Wallet ${pi(G.address)} does not have enough funds.`,void 0,Te.INSUFFICIENT_BALANCE))}if(!e)return E(!1),void v(!0);E(!1),U(!0),g(!0),f(e.gas);try{await X.switchChain({id:oe.chain.id})}catch(e){await X.addChain({chain:oe.chain}),await X.switchChain({id:oe.chain.id})}try{t=await X.sendTransaction(e)}catch(e){if(console.error(e),"TransactionExecutionError"===e.name)if(x.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 pe(t,void 0,Te.TRANSACTION_FAILURE))}else T(e.shortMessage??"Something went wrong")}if(t)return await X.waitForTransactionReceipt({hash:t}),U(!1),M?(F(t),void B("pending")):(L(!0),void s({eventName:Ef,payload:{provider:"external",status:"success",txHash:t,address:G.address,chainId:oe.chain.id,chainType:"ethereum",value:oe.value?Dt(BigInt(oe.value),z?.decimals??18):void 0,token:z?.symbol??H??"ETH",destinationAddress:V,destinationChainId:$.id,destinationChainType:"ethereum",destinationValue:Y?Dt(Y,z?.decimals??18):void 0,destinationToken:z?.symbol??H??$.nativeCurrency.name}}));U(!1)})().catch(console.error)}),[X,oe]),d((()=>{(async()=>{if(!w||!X||!G)return;let e=N(h.chains).filter((e=>e.id!==$.id&&!!e.testnet==!!$.testnet));Z&&e.unshift($);let t=await ww({chains:e,address:G.address,appId:r,rpcConfig:a,includeUsdc:p.funding?.isUSDC}),n=Z?t.filter((e=>e.balance>0n)):t.filter((e=>e.balance>Y));if(n.length<1)return void b(new pe(`Wallet ${pi(G.address)} does not have enough funds.`,void 0,Te.INSUFFICIENT_BALANCE));n.sort(((e,t)=>Number(Z?(t.erc20Balance??0n)-(e.erc20Balance??0n):t.balance-e.balance)));let i=n.flatMap((e=>{let t=[{...e,isErc20Quote:!1,isTestnet:!!$.testnet,input:pu({amount:Y.toString(),user:G.address,recipient:V,destinationChainId:$.id,destinationCurrency:H,originChainId:e.chain.id})}];return Z&&H&&(e.erc20Balance??0n)>=Y&&t.push({...e,isErc20Quote:!0,isTestnet:!!$.testnet,input:pu({amount:Y.toString(),user:G.address,recipient:V,destinationChainId:$.id,destinationCurrency:H,originChainId:e.chain.id,originCurrency:e.erc20Address})}),t})),o=(await Promise.allSettled(i.map((async e=>({...e,quote:await gu(e)}))))).filter((e=>"fulfilled"===e.status)).map((e=>e.value));if(o.length<1)return void b(new pe(`Wallet ${pi(G.address)} does not have enough funds.`,void 0,Te.INSUFFICIENT_BALANCE));let s=o.map((e=>({bridgeTx:yu(e.quote),balance:e.balance,chain:e.chain,erc20Balance:e.erc20Balance,isErc20Quote:e.isErc20Quote}))).filter((e=>!!e.bridgeTx));if(s.length>1)return void A(s);let l=s[0];l?(P(!0),se({data:l.bridgeTx.data,to:l.bridgeTx.to,value:l.bridgeTx.value,chain:l.chain})):b(new pe(`Wallet ${pi(G.address)} does not have enough funds.`,void 0,Te.INSUFFICIENT_BALANCE))})().catch(console.error)}),[w]),fu({transactionHash:R,wallet:G,isTestnet:!!$.testnet,bridgingStatus:D,setBridgingStatus:B,onSuccess({transactionHash:e,wallet:t}){P(!1),L(!0),s({eventName:Ef,payload:{provider:"external",status:"success",txHash:e,address:t.address,chainId:oe.chain.id,chainType:"ethereum",value:oe.value?Dt(BigInt(oe.value),z?.decimals??18):void 0,token:z?.symbol??H??"ETH",destinationAddress:V,destinationChainId:$.id,destinationChainType:"ethereum",destinationValue:Y?Dt(Y,z?.decimals??18):void 0,destinationToken:z?.symbol??H??$.nativeCurrency.name}})},onFailure({error:e}){P(!1),b(e)}}),d((()=>{C&&(c({funding:p?.funding,sendTransaction:p?.sendTransaction,errorModalData:{error:C,previousScreen:sv}}),l(Cu,!1))}),[C]);let le=!Z&&ie?Vl(q??"0",ie):void 0,ce=Z?y:Zl([y,Y]),de=ce&&ie?Hl(ce,ie):void 0,he=ce?ql(ce,p?.funding?.erc20Address?p?.funding?.erc20ContractInfo?.symbol||"ETH":p?.funding?.chain.nativeCurrency.symbol||"ETH"):void 0,ue=y&&ie?Hl(y,ie):void 0,me=y?ql(y,$?.nativeCurrency?.symbol||"ETH"):void 0;if(d((()=>{if(!O)return;let e=setTimeout(i,or);return()=>clearTimeout(e)}),[O]),O/*#__PURE__*/)return e(n,{children:[/*#__PURE__*/t(gb,{}),/*#__PURE__*/t(Mc,{}),/*#__PURE__*/e(_c,{children:[/*#__PURE__*/t(Aa,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),/*#__PURE__*/t(Mh,{title:"Success!",description:`You’ve successfully added ${q} ${Z?z.symbol:$.nativeCurrency.symbol} to your ${h.name} wallet. It may take a minute before the funds are available to use.`})]}),/*#__PURE__*/t(Pc,{}),/*#__PURE__*/t(qs,{})]});let ge=Z?`${fw({amount:ae,decimals:z.decimals})} ${z.symbol}`:ql(te,$.nativeCurrency.symbol,3,!0),ye=x[I];return x.length>1&&ye?/*#__PURE__*/t(av,{displayName:Q,configuredFundingChain:$,erc20ContractInfo:z,formattedBalance:ge,fundingAmount:q,fundingCurrency:Z?z.symbol:$.nativeCurrency.symbol,fundingAmountInUsd:le,options:x,selectedOption:ye,isPreparing:S,isSubmitting:W,addressToFund:V,fundingWalletAddress:G?.address||"",errorMessage:k,onSubmit:()=>{p.funding?.amount!==q?async function(){if(G&&ye)try{let e=await gu({isTestnet:!!$.testnet,input:pu({amount:Y.toString(),user:G.address,recipient:V,destinationChainId:$.id,destinationCurrency:H,originChainId:ye.chain.id})}),t=yu(e);if(!t)throw Error("Invalid transaction request");P(!0),se({data:t.data,to:t.to,value:t.value,chain:ye.chain})}catch(e){console.error(e),b(new pe("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&&(T(null),_(e))},onAmountChange:K}):m&&y&&G&&p?.funding?/*#__PURE__*/t(pw,{wallet:G,displayName:Q,addressToFund:V,isBridging:M,isErc20Flow:Z,totalPriceInUsd:de,totalPriceInNativeCurrency:he,gasPriceInUsd:ue,gasPriceInNativeCurrency:me,chainId:$.id,chainName:$.name}):
@@ -24,6 +24,6 @@ return t(jc,{...Go().render.standalone?{defaultValue:"details"}:{},children:/*#_
24
24
  /*#__PURE__*/e(Dv,{children:[/*#__PURE__*/t("iframe",{style:{position:"absolute",zIndex:1},width:a,height:n.dimensions.height,allow:"clipboard-write self *",src:yi(n.origin,`/apps/${n.appId}/embedded-wallets/export`,n.isUnifiedWallet?{v:"1-unified",wallet_id:n.walletId,client_id:n.appClientId,width:`${a}px`,caid:n.clientAnalyticsId,phrase_export:h,...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:`${a}px`,caid:n.clientAnalyticsId,phrase_export:h,...s},{token:n.accessToken})}),/*#__PURE__*/t(Bv,{children:"Loading..."}),h&&/*#__PURE__*/t(Bv,{children:"Loading..."})]})})}const Rv={component:()=>{let[a,r]=o(null),{authenticated:i,user:s}=rn(),{closePrivyModal:l,createAnalyticsEvent:c,clientAnalyticsId:h,client:p}=Ut(),u=Go(),{data:m,onUserCloseViaDialogOrKeybindRef:g}=es(),{onFailure:y,onSuccess:f,origin:w,appId:v,appClientId:C,entropyId:b,entropyIdVerifier:k,walletId:T,hdWalletIndex:x,chainType:A,address:I,isUnifiedWallet:_,imported:S}=m.keyExport,E=e=>{l({shouldCallAuthOnSuccess:!1}),y("string"==typeof e?Error(e):e)},N=()=>{l({shouldCallAuthOnSuccess:!1}),f(),c({eventName:"embedded_wallet_key_export_completed",payload:{walletAddress:I}})};return d((()=>{if(!i)return E("User must be authenticated before exporting their wallet");p.getAccessToken().then(r).catch(E)}),[i,s]),g.current=N,/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Js,{onClose:N}),/*#__PURE__*/e(Fv,{children:[/*#__PURE__*/t(yf,{children:"Export wallet"}),/*#__PURE__*/e(cm,{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"})]}),/*#__PURE__*/t(Uv,{theme:u.appearance.palette.colorScheme,children:"Never share your private key or seed phrase with anyone."}),/*#__PURE__*/t(_f,{isLoading:!1,isPulsing:!1,title:"Your wallet",address:I,showIcon:!0}),/*#__PURE__*/t("div",{style:{width:"100%"},children:a&&/*#__PURE__*/t(Lv,{origin:w,appId:v,appClientId:C,accessToken:a,clientAnalyticsId:h,entropyId:b,entropyIdVerifier:k,walletId:T,hdWalletIndex:x,isUnifiedWallet:_,imported:S,chainType:A,dimensions:{height:"44px"}})})]}),/*#__PURE__*/t(qs,{})]})}};let Fv=/*#__PURE__*/bn.div.withConfig({displayName:"EmbeddedWalletScreenContainer",componentId:"sc-7b921328-0"})(["display:flex;flex-direction:column;gap:1.25rem;text-align:left;"]),Dv=/*#__PURE__*/bn.div.withConfig({displayName:"ButtonContainer",componentId:"sc-7b921328-1"})(["overflow:visible;position:relative;overflow:none;height:44px;display:flex;gap:12px;"]),Bv=/*#__PURE__*/bn.div.withConfig({displayName:"LoadingButton",componentId:"sc-7b921328-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);"]);const zv={component:()=>{let{authenticated:a,user:r,getAccessToken:i}=rn(),{closePrivyModal:l,createAnalyticsEvent:c,walletProxy:h}=Ut(),{navigate:p,data:u,setModalData:m,onUserCloseViaDialogOrKeybindRef:g}=es(),y=s((()=>Date.now()),[]),[f,w]=o(!1),{onCompleteNavigateTo:v,onFailure:C,shouldForceMFA:b,entropyId:k,entropyIdVerifier:T,recoveryMethod:x,connectingWalletAddress:A,isUnifiedWallet:I=!1}=u?.connectWallet,_=e=>{f||(w(!0),C("string"==typeof e?Error(e):e))};d((()=>{let e;return a?h?((async()=>{let t=await i();if(!t)return _("User must be authenticated and have a Privy wallet before it can be connected");try{I||await h.connect({accessToken:t,entropyId:k,entropyIdVerifier:T}),b&&await h.verifyMfa({accessToken:t});let n=(Date.now()-y)/1e3;v===Rv&&n<1?e=setTimeout((()=>{p(v,!1)}),1e3*(1-n)):p(v,!1)}catch(e){if(Ed(e)&&"privy"===x){let e=await i();if(!e)return _("User must be authenticated and have a Privy wallet before it can be recovered");try{c({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:A}});let t=await(h?.recover({accessToken:e,entropyId:k,entropyIdVerifier:T}));t?.entropyId||_(Error("Unable to recover wallet")),v?p(v):l({shouldCallAuthOnSuccess:!1}),c({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:A}}),p(v)}catch(e){_("An error has occurred, please try again.")}}else Ed(e)&&"privy"!==x&&"privy-v2"!==x?(m({...u,recoverWallet:{entropyId:k,entropyIdVerifier:T,onCompleteNavigateTo:v,onFailure:C},recoveryOAuthStatus:{provider:x,action:"recover",isInAccountCreateFlow:!1,shouldCreateEth:!1,shouldCreateSol:!1}}),p(Cf(x))):_(e)}})(),()=>clearTimeout(e)):void 0:_("User must be authenticated and have a Privy wallet before it can be connected")}),[a,r,h]);let S=()=>{_("User exited before wallet could be connected"),l({shouldCallAuthOnSuccess:!1})};return g.current=S,/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Js,{onClose:S}),f?/*#__PURE__*/e(n,{children:[/*#__PURE__*/e(_c,{children:[/*#__PURE__*/t(oa,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),/*#__PURE__*/t(Mh,{title:"Something went wrong",description:"We’re on it. Please try again later."})]}),/*#__PURE__*/t(El,{onClick:()=>l({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):/*#__PURE__*/t(Du,{}),/*#__PURE__*/t($v,{})]})}};let $v=/*#__PURE__*/bn.div.withConfig({displayName:"BottomSpacing",componentId:"sc-1ec92f42-0"})(["height:44px;"]);const jv=/*#__PURE__*/bn(ow).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 Vv=({iconUrl:n,value:a,symbol:r,usdValue:i,nftName:o,nftCount:s,decimals:l,$isLoading:c})=>{if(c)/*#__PURE__*/return t(Hv,{$isLoading:c});let d=a&&i&&l?function(e,t,n){let a=parseFloat(e),r=parseFloat(n);if(0===a||0===r||Number.isNaN(a)||Number.isNaN(r))return e;let i=Math.ceil(-Math.log10(.01/(r/a))),o=Math.pow(10,i=Math.max(i=Math.min(i,t),1));return(Math.floor(a*o)/o).toFixed(i).replace(/\.?0+$/,"")}(a,l,i):a;/*#__PURE__*/return e("div",{children:[/*#__PURE__*/e(Hv,{$isLoading:c,children:[n&&/*#__PURE__*/t(Kv,{src:n,alt:"Token icon"}),s&&s>1?s+"x":void 0," ",o,d," ",r]}),i&&/*#__PURE__*/e(qv,{$isLoading:c,children:["$",i]})]})};let Hv=/*#__PURE__*/bn.span.withConfig({displayName:"Value",componentId:"sc-e57378e9-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;",""],Ag);const qv=/*#__PURE__*/bn.span.withConfig({displayName:"Subvalue",componentId:"sc-e57378e9-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;",""],Ag);let Kv=/*#__PURE__*/bn.img.withConfig({displayName:"TokenIcon",componentId:"sc-e57378e9-2"})(["height:14px;width:14px;margin-right:4px;object-fit:contain;"]);const Zv=a=>{let{chain:r,transactionDetails:i,isTokenContractInfoLoading:o,symbol:s}=a,{action:l,functionName:c}=i;/*#__PURE__*/return t(If,{children:/*#__PURE__*/e(rw,{children:["transaction"!==l&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Action"}),/*#__PURE__*/t(lw,{children:c})]}),"mint"===c&&"args"in i&&i.args.filter((e=>e)).map(((n,a)=>/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:`Param ${a}`}),/*#__PURE__*/t(lw,{children:"string"==typeof n&&Zt(n)?/*#__PURE__*/t(eh,{address:n,url:r?.blockExplorers?.default?.url,showCopyIcon:!1}):n?.toString()})]},a))),"setApprovalForAll"===c&&i.operator&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Operator"}),/*#__PURE__*/t(lw,{children:/*#__PURE__*/t(eh,{address:i.operator,url:r?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),"setApprovalForAll"===c&&void 0!==i.approved&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Set approval to"}),/*#__PURE__*/t(lw,{children:i.approved?"true":"false"})]}),"transfer"===c||"transferFrom"===c||"safeTransferFrom"===c||"approve"===c?/*#__PURE__*/e(n,{children:["formattedAmount"in i&&i.formattedAmount&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Amount"}),/*#__PURE__*/e(lw,{$isLoading:o,children:[i.formattedAmount," ",s]})]}),"tokenId"in i&&i.tokenId&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Token ID"}),/*#__PURE__*/t(lw,{children:i.tokenId.toString()})]})]}):null,"safeBatchTransferFrom"===c&&/*#__PURE__*/e(n,{children:["amounts"in i&&i.amounts&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Amounts"}),/*#__PURE__*/t(lw,{children:i.amounts.join(", ")})]}),"tokenIds"in i&&i.tokenIds&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Token IDs"}),/*#__PURE__*/t(lw,{children:i.tokenIds.join(", ")})]})]}),"approve"===c&&i.spender&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Spender"}),/*#__PURE__*/t(lw,{children:/*#__PURE__*/t(eh,{address:i.spender,url:r?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),("transferFrom"===c||"safeTransferFrom"===c||"safeBatchTransferFrom"===c)&&i.transferFrom&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Transferring from"}),/*#__PURE__*/t(lw,{children:/*#__PURE__*/t(eh,{address:i.transferFrom,url:r?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),("transferFrom"===c||"safeTransferFrom"===c||"safeBatchTransferFrom"===c)&&i.transferTo&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Transferring to"}),/*#__PURE__*/t(lw,{children:/*#__PURE__*/t(eh,{address:i.transferTo,url:r?.blockExplorers?.default?.url,showCopyIcon:!1})})]})]})})};let Yv={success:"background: var(--privy-color-success-lightest, #dcfce7);",warn:"background: var(--privy-color-warn-lightest, #fff7e6);",error:"background: var(--privy-color-error-lightest, #fde8e8);"};const Gv=/*#__PURE__*/bn.div.withConfig({displayName:"Pill",componentId:"sc-8c138024-0"})(["border-radius:var(--privy-border-radius-md,8px);padding:12px;text-align:left;margin-top:23px;",""],(e=>Yv[e.variant])),Jv=({variant:n,setPreventMaliciousTransaction:a,preventMaliciousTransaction:r})=>"warn"===n?/*#__PURE__*/t(Gv,{variant:n,children:/*#__PURE__*/e("div",{className:"flex flex-row",children:[/*#__PURE__*/t(Qv,{$variant:n}),/*#__PURE__*/e("p",{children:[/*#__PURE__*/t("b",{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"===n?/*#__PURE__*/t(Gv,{variant:n,children:/*#__PURE__*/e("div",{className:"flex flex-col",children:[/*#__PURE__*/e("div",{className:"flex flex-row",children:[/*#__PURE__*/t(Qv,{$variant:n}),/*#__PURE__*/e("p",{children:[/*#__PURE__*/t("b",{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("div",{className:"mt-3 flex flex-row gap-2",children:[/*#__PURE__*/t(gp,{color:"var(--privy-color-error)",checked:!r,readOnly:!0,onClick:()=>a(!r)}),/*#__PURE__*/t("p",{children:"I understand and want to proceed anyways."})]})]})}):void 0;let Qv=/*#__PURE__*/bn(Un).withConfig({displayName:"StyledExclamationTriangleIcon",componentId:"sc-91effb27-0"})(["width:20px;height:20px;stroke-width:2px;flex-shrink:0;display:inline-block;margin-right:8px;",";"],(({$variant:e})=>"error"===e?"color: var(--privy-color-error)":"color: var(--privy-color-warn)"));const Xv=({transactionIndex:e,maxIndex:t})=>"number"!=typeof e||0===t?"":` (${e+1} / ${t+1})`,eC=({img:a,submitError:r,prepareError:i,onClose:s,action:l,title:c,subtitle:d,txValue:h,to:p,tokenAddress:u,network:m,missingFunds:g,fee:y,from:f,cta:w,disabled:v,chain:C,isSubmitting:b,isPreparing:k,isTokenPriceLoading:T,isTokenContractInfoLoading:x,isSponsored:A,symbol:I,balance:_,onClick:S,transactionDetails:E,transactionIndex:N,maxIndex:M,onBack:P,chainName:W,validation:U,hasScanDetails:O,setIsScanDetailsOpen:L,preventMaliciousTransaction:R,setPreventMaliciousTransaction:F,tokensSent:D,tokensReceived:B,isScanning:z,isCancellable:$,functionName:j})=>{let{showTransactionDetails:V,setShowTransactionDetails:H,hasMoreDetails:q,isErc20Ish:K}=(e=>{let[t,n]=o(!1),a=!0,r=!1;return(!e||e.isErc20Ish||"transaction"===e.action)&&(a=!1),a&&(r=Object.entries(e||{}).some((([e,t])=>t&&!["action","isErc20Ish","isNFTIsh"].includes(e)))),{showTransactionDetails:t,setShowTransactionDetails:n,hasMoreDetails:a&&r,isErc20Ish:e?.isErc20Ish}})(E),Z=K&&x||k||T||z;/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{onClose:s,backFn:P}),a&&/*#__PURE__*/t(iC,{children:a}),/*#__PURE__*/e(yf,{style:{marginTop:a?"1.5rem":0},children:[c,/*#__PURE__*/t(Xv,{maxIndex:M,transactionIndex:N})]}),/*#__PURE__*/t(cm,{children:d}),/*#__PURE__*/e(rw,{style:{marginTop:"2rem"},children:[(!!D[0]||Z)&&/*#__PURE__*/e(iw,{children:[B.length>0?/*#__PURE__*/t(ow,{children:"Send"}):/*#__PURE__*/t(ow,{children:"approve"===l?"Approval amount":"Amount"}),/*#__PURE__*/t("div",{className:"flex flex-col",children:D.map(((e,n)=>/*#__PURE__*/t(Vv,{iconUrl:e.iconUrl,value:"setApprovalForAll"===j?"All":e.value,usdValue:e.usdValue,symbol:e.symbol,nftName:e.nftName,nftCount:e.nftCount,decimals:e.decimals},n)))})]}),B.length>0&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Receive"}),/*#__PURE__*/t("div",{className:"flex flex-col",children:B.map(((e,n)=>/*#__PURE__*/t(Vv,{iconUrl:e.iconUrl,value:e.value,usdValue:e.usdValue,symbol:e.symbol,nftName:e.nftName,nftCount:e.nftCount,decimals:e.decimals},n)))})]}),E&&"spender"in E&&E?.spender?/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Spender"}),/*#__PURE__*/t(lw,{children:/*#__PURE__*/t(eh,{address:E.spender,url:C?.blockExplorers?.default?.url})})]}):null,p&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"To"}),/*#__PURE__*/t(lw,{children:/*#__PURE__*/t(eh,{address:p,url:C?.blockExplorers?.default?.url,showCopyIcon:!0})})]}),u&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Token address"}),/*#__PURE__*/t(lw,{children:/*#__PURE__*/t(eh,{address:u,url:C?.blockExplorers?.default?.url})})]}),/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Network"}),/*#__PURE__*/t(lw,{children:m})]}),/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Estimated fee"}),/*#__PURE__*/t(lw,{$isLoading:k||T||void 0===A,children:A?"Sponsored":y})]}),q&&!O&&/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(iw,{className:"cursor-pointer",onClick:()=>H(!V),children:/*#__PURE__*/e(sw,{className:"flex items-center gap-x-1",children:["Details"," ",/*#__PURE__*/t(ca,{style:{width:"0.75rem",marginLeft:"0.25rem",transform:V?"rotate(180deg)":void 0}})]})}),V&&E&&/*#__PURE__*/t(Zv,{action:l,chain:C,transactionDetails:E,isTokenContractInfoLoading:x,symbol:I})]}),O&&/*#__PURE__*/t(iw,{children:/*#__PURE__*/e(jv,{onClick:()=>L(!0),children:[/*#__PURE__*/t("span",{className:"text-color-primary",children:"Details"}),/*#__PURE__*/t(da,{height:"14px",width:"14px",strokeWidth:"2"})]})})]}),/*#__PURE__*/t(Ps,{}),r?/*#__PURE__*/t(rm,{style:{marginTop:"2rem"},children:r.message}):i&&0===N?
25
25
  /*#__PURE__*/t(rm,{style:{marginTop:"2rem"},children:i.shortMessage??rC}):null,/*#__PURE__*/t(Jv,{variant:U,preventMaliciousTransaction:R,setPreventMaliciousTransaction:F}),/*#__PURE__*/t(nC,{$useSmallMargins:!(!i&&!r&&"warn"!==U&&"error"!==U),title:Number(h)>0?void 0:!1!==A?"Your wallet":void 0,address:f,balance:_,isLoading:k||T,errMsg:k||i||r||!g?void 0:`Add funds on ${C?.name??W} to complete transaction.`}),/*#__PURE__*/t(El,{style:{marginTop:"1rem"},loading:b,disabled:v||k,onClick:S,children:w}),$&&/*#__PURE__*/t(Rl,{style:{marginTop:"1rem"},onClick:s,isSubmitting:!1,children:"Not now"}),/*#__PURE__*/t(qs,{})]})},tC=({img:a,title:r,subtitle:i,cta:s,instructions:l,network:c,blockExplorerUrl:d,isMissingFunds:h,submitError:p,parseError:u,total:m,swap:g,transactingWalletAddress:y,fee:f,balance:w,disabled:v,isSubmitting:C,isPreparing:b,isTokenPriceLoading:k,onClick:T,onClose:x,onBack:A})=>{let I=b||k,[_,S]=o(!1);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{onClose:x,backFn:A}),a&&/*#__PURE__*/t(iC,{children:a}),/*#__PURE__*/t(yf,{style:{marginTop:a?"1.5rem":0},children:r}),/*#__PURE__*/t(cm,{children:i}),/*#__PURE__*/e(rw,{style:{marginTop:"2rem",marginBottom:".5rem"},children:[(m||I)&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Amount"}),/*#__PURE__*/t(lw,{$isLoading:I,children:m})]}),g&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Swap"}),/*#__PURE__*/t(lw,{children:g})]}),c&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Network"}),/*#__PURE__*/t(lw,{children:c})]}),(f||I)&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Estimated fee"}),/*#__PURE__*/t(lw,{$isLoading:I,children:f})]})]}),/*#__PURE__*/t(iw,{children:/*#__PURE__*/e(jv,{onClick:()=>S((e=>!e)),children:[/*#__PURE__*/t("span",{children:"Advanced"}),/*#__PURE__*/t(ca,{height:"16px",width:"16px",strokeWidth:"2",style:{transition:"all 300ms",transform:_?"rotate(180deg)":void 0}})]})}),_&&/*#__PURE__*/t(n,{children:l.map(((n,a)=>"sol-transfer"===n.type?/*#__PURE__*/e(aC,{children:[/*#__PURE__*/t(iw,{children:/*#__PURE__*/e(xf,{children:["Transfer ",n.withSeed?"with seed":""]})}),/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Amount"}),/*#__PURE__*/e(lw,{children:[se({amount:n.value,decimals:n.token.decimals})," ",n.token.symbol]})]}),!!n.toAccount&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Destination"}),/*#__PURE__*/t(lw,{children:/*#__PURE__*/t(eh,{address:n.toAccount,url:d})})]})]},a):"spl-transfer"===n.type?/*#__PURE__*/e(aC,{children:[/*#__PURE__*/t(iw,{children:/*#__PURE__*/e(xf,{children:["Transfer ",n.token.symbol]})}),/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Amount"}),/*#__PURE__*/t(lw,{children:n.value.toString()})]}),!!n.fromAta&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Source"}),/*#__PURE__*/t(lw,{children:/*#__PURE__*/t(eh,{address:n.fromAta,url:d})})]}),!!n.toAta&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Destination"}),/*#__PURE__*/t(lw,{children:/*#__PURE__*/t(eh,{address:n.toAta,url:d})})]}),!!n.token.address&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Token"}),/*#__PURE__*/t(lw,{children:/*#__PURE__*/t(eh,{address:n.token.address,url:d})})]})]},a):"ata-creation"===n.type?/*#__PURE__*/e(aC,{children:[/*#__PURE__*/t(iw,{children:/*#__PURE__*/t(xf,{children:"Create token account"})}),/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Program ID"}),/*#__PURE__*/t(lw,{children:/*#__PURE__*/t(eh,{address:n.program,url:d})})]}),!!n.owner&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Owner"}),/*#__PURE__*/t(lw,{children:/*#__PURE__*/t(eh,{address:n.owner,url:d})})]})]},a):"create-account"===n.type?/*#__PURE__*/e(aC,{children:[/*#__PURE__*/t(iw,{children:/*#__PURE__*/e(xf,{children:["Create account ",n.withSeed?"with seed":""]})}),!!n.account&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Account"}),/*#__PURE__*/t(lw,{children:/*#__PURE__*/t(eh,{address:n.account,url:d})})]}),/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Amount"}),/*#__PURE__*/e(lw,{children:[se({amount:n.value,decimals:9})," SOL"]})]})]},a):"spl-init-account"===n.type?/*#__PURE__*/e(aC,{children:[/*#__PURE__*/t(iw,{children:/*#__PURE__*/t(xf,{children:"Initialize token account"})}),!!n.account&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Account"}),/*#__PURE__*/t(lw,{children:/*#__PURE__*/t(eh,{address:n.account,url:d})})]}),!!n.mint&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Mint"}),/*#__PURE__*/t(lw,{children:/*#__PURE__*/t(eh,{address:n.mint,url:d})})]}),!!n.owner&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Owner"}),/*#__PURE__*/t(lw,{children:/*#__PURE__*/t(eh,{address:n.owner,url:d})})]})]},a):"spl-close-account"===n.type?/*#__PURE__*/e(aC,{children:[/*#__PURE__*/t(iw,{children:/*#__PURE__*/t(xf,{children:"Close token account"})}),!!n.source&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Source"}),/*#__PURE__*/t(lw,{children:/*#__PURE__*/t(eh,{address:n.source,url:d})})]}),!!n.destination&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Destination"}),/*#__PURE__*/t(lw,{children:/*#__PURE__*/t(eh,{address:n.destination,url:d})})]}),!!n.owner&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Owner"}),/*#__PURE__*/t(lw,{children:/*#__PURE__*/t(eh,{address:n.owner,url:d})})]})]},a):"spl-sync-native"===n.type?/*#__PURE__*/e(aC,{children:[/*#__PURE__*/t(iw,{children:/*#__PURE__*/t(xf,{children:"Sync native"})}),/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Program ID"}),/*#__PURE__*/t(lw,{children:/*#__PURE__*/t(eh,{address:n.program,url:d})})]})]},a):"raydium-swap-base-input"===n.type?/*#__PURE__*/e(aC,{children:[/*#__PURE__*/t(iw,{children:/*#__PURE__*/e(xf,{children:["Raydium swap"," ",n.tokenIn&&n.tokenOut?`${n.tokenIn.symbol} → ${n.tokenOut.symbol}`:""]})}),/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Amount in"}),/*#__PURE__*/t(lw,{children:n.amountIn.toString()})]}),/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Minimum amount out"}),/*#__PURE__*/t(lw,{children:n.minimumAmountOut.toString()})]}),n.mintIn&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Token in"}),/*#__PURE__*/t(lw,{children:/*#__PURE__*/t(eh,{address:n.mintIn,url:d})})]}),n.mintOut&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Token out"}),/*#__PURE__*/t(lw,{children:/*#__PURE__*/t(eh,{address:n.mintOut,url:d})})]})]},a):"raydium-swap-base-output"===n.type?/*#__PURE__*/e(aC,{children:[/*#__PURE__*/t(iw,{children:/*#__PURE__*/e(xf,{children:["Raydium swap"," ",n.tokenIn&&n.tokenOut?`${n.tokenIn.symbol} → ${n.tokenOut.symbol}`:""]})}),/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Max amount in"}),/*#__PURE__*/t(lw,{children:n.maxAmountIn.toString()})]}),/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Amount out"}),/*#__PURE__*/t(lw,{children:n.amountOut.toString()})]}),n.mintIn&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Token in"}),/*#__PURE__*/t(lw,{children:/*#__PURE__*/t(eh,{address:n.mintIn,url:d})})]}),n.mintOut&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Token out"}),/*#__PURE__*/t(lw,{children:/*#__PURE__*/t(eh,{address:n.mintOut,url:d})})]})]},a):"jupiter-swap-shared-accounts-route"===n.type?/*#__PURE__*/e(aC,{children:[/*#__PURE__*/t(iw,{children:/*#__PURE__*/e(xf,{children:["Jupiter swap"," ",n.tokenIn&&n.tokenOut?`${n.tokenIn.symbol} → ${n.tokenOut.symbol}`:""]})}),/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"In amount"}),/*#__PURE__*/t(lw,{children:n.inAmount.toString()})]}),/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Quoted out amount"}),/*#__PURE__*/t(lw,{children:n.quotedOutAmount.toString()})]}),n.mintIn&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Token in"}),/*#__PURE__*/t(lw,{children:/*#__PURE__*/t(eh,{address:n.mintIn,url:d})})]}),n.mintOut&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Token out"}),/*#__PURE__*/t(lw,{children:/*#__PURE__*/t(eh,{address:n.mintOut,url:d})})]})]},a):"jupiter-swap-exact-out-route"===n.type?/*#__PURE__*/e(aC,{children:[/*#__PURE__*/t(iw,{children:/*#__PURE__*/e(xf,{children:["Jupiter swap"," ",n.tokenIn&&n.tokenOut?`${n.tokenIn.symbol} → ${n.tokenOut.symbol}`:""]})}),/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Quoted in amount"}),/*#__PURE__*/t(lw,{children:n.quotedInAmount.toString()})]}),/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Amount out"}),/*#__PURE__*/t(lw,{children:n.outAmount.toString()})]}),n.mintIn&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Token in"}),/*#__PURE__*/t(lw,{children:/*#__PURE__*/t(eh,{address:n.mintIn,url:d})})]}),n.mintOut&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Token out"}),/*#__PURE__*/t(lw,{children:/*#__PURE__*/t(eh,{address:n.mintOut,url:d})})]})]},a):/*#__PURE__*/e(aC,{children:[/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Program ID"}),/*#__PURE__*/t(lw,{children:/*#__PURE__*/t(eh,{address:n.program,url:d})})]}),/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Data"}),/*#__PURE__*/t(lw,{children:n.discriminator})]})]},a)))}),/*#__PURE__*/t(Ps,{}),p?/*#__PURE__*/t(rm,{style:{marginTop:"2rem"},children:p.message}):u?/*#__PURE__*/t(rm,{style:{marginTop:"2rem"},children:rC}):null,/*#__PURE__*/t(nC,{$useSmallMargins:!(!u&&!p),title:"Your wallet",address:y,balance:w,isLoading:b||k,errMsg:b||u||p||!h?void 0:"Add funds on Solana to complete transaction."}),/*#__PURE__*/t(El,{style:{marginTop:"1rem"},loading:C,disabled:v||b,onClick:T,children:s}),/*#__PURE__*/t(qs,{})]})};let nC=/*#__PURE__*/bn(_f).withConfig({displayName:"StyledWalletInfoCard",componentId:"sc-bb761902-0"})(["",""],(e=>e.$useSmallMargins?"margin-top: 0.5rem;":"margin-top: 2rem;")),aC=/*#__PURE__*/bn(rw).withConfig({displayName:"InstructionRows",componentId:"sc-bb761902-1"})(["margin-top:0.5rem;border:1px solid var(--privy-color-foreground-4);border-radius:var(--privy-border-radius-sm);padding:0.5rem;"]),rC="There was an error preparing your transaction. Your transaction request will likely fail.",iC=/*#__PURE__*/bn.div.withConfig({displayName:"ImageContainer",componentId:"sc-bb761902-2"})(["display:flex;width:100%;justify-content:center;max-height:40px;> img{object-fit:contain;border-radius:var(--privy-border-radius-sm);}"]),oC=()=>/*#__PURE__*/e(hC,{children:[/*#__PURE__*/t(uC,{}),/*#__PURE__*/t(pC,{})]});const sC=({transactionError:a,chainId:r,onClose:i,onRetry:s,network:l,connection:c,transactionHash:d})=>{let{chains:h}=Ut(),[p,u]=o(!1),{errorCode:m,errorMessage:g}=((e,t)=>{if("ethereum"===t)return{errorCode:e.details??e.message,errorMessage:e.shortMessage};let n=e.txSignature,a=e?.transactionMessage||"Something went wrong.";if(Array.isArray(e.logs)){let t=e.logs.find((e=>/insufficient (lamports|funds)/gi.test(e)));t&&(a=t)}return{transactionHash:n,errorMessage:a}})(a,l),y=(({chains:e,chainId:t,network:n,connection:a,transactionHash:r})=>"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}`}(r||"",Bo(a?.rpcEndpoint||"")))({chains:h,chainId:r,network:l,connection:c,transactionHash:d});/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{onClose:i}),/*#__PURE__*/e(lC,{children:[/*#__PURE__*/t(oC,{}),/*#__PURE__*/t(cC,{children:m}),/*#__PURE__*/t(dC,{children:"Please try again."}),/*#__PURE__*/e(yC,{children:[/*#__PURE__*/t(gC,{children:"Error message"}),/*#__PURE__*/t(wC,{$clickable:!1,children:g})]}),d&&/*#__PURE__*/e(yC,{children:[/*#__PURE__*/t(gC,{children:"Transaction hash"}),/*#__PURE__*/e(fC,{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(wC,{$clickable:!0,onClick:async()=>{await navigator.clipboard.writeText(d),u(!0)},children:[d,/*#__PURE__*/t(bC,{clicked:p})]})]}),/*#__PURE__*/t(mC,{onClick:()=>s({resetNonce:!!d}),children:"Retry transaction"})]}),/*#__PURE__*/t(Ks,{})]})};let lC=/*#__PURE__*/bn.div.withConfig({displayName:"TransactionErrorScreenContainer",componentId:"sc-92716bea-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;"]),cC=/*#__PURE__*/bn.span.withConfig({displayName:"ErrorCode",componentId:"sc-92716bea-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;"]),dC=/*#__PURE__*/bn.span.withConfig({displayName:"Subtitle",componentId:"sc-92716bea-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;"]),hC=/*#__PURE__*/bn.div.withConfig({displayName:"CircleContainer",componentId:"sc-92716bea-3"})(["position:relative;width:60px;height:60px;margin:10px;display:flex;justify-content:center;align-items:center;"]),pC=/*#__PURE__*/bn(aa).withConfig({displayName:"StyledExclamationCircleIcon",componentId:"sc-92716bea-4"})(["position:absolute;width:35px;height:35px;color:var(--privy-color-error);"]),uC=/*#__PURE__*/bn.div.withConfig({displayName:"StyledRedCircle",componentId:"sc-92716bea-5"})(["position:absolute;width:60px;height:60px;border-radius:50%;background-color:var(--privy-color-error);opacity:0.1;"]),mC=/*#__PURE__*/bn(El).withConfig({displayName:"RetryButton",componentId:"sc-92716bea-6"})(["&&{margin-top:24px;}transition:color 350ms ease,background-color 350ms ease;"]),gC=/*#__PURE__*/bn.span.withConfig({displayName:"TextBoxTitle",componentId:"sc-92716bea-7"})(["width:100%;text-align:left;font-size:0.825rem;color:var(--privy-color-foreground);padding:4px;"]),yC=/*#__PURE__*/bn.div.withConfig({displayName:"TextBoxContainer",componentId:"sc-92716bea-8"})(["width:100%;margin:5px;display:flex;flex-direction:column;justify-content:center;align-items:center;"]),fC=/*#__PURE__*/bn.text.withConfig({displayName:"HelperText",componentId:"sc-92716bea-9"})(["position:relative;width:100%;padding:5px;font-size:0.8rem;color:var(--privy-color-foreground-3);text-align:left;word-wrap:break-word;"]),wC=/*#__PURE__*/bn.span.withConfig({displayName:"TextBox",componentId:"sc-92716bea-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 }")),vC=/*#__PURE__*/bn(Ma).withConfig({displayName:"StyledClipboardIcon",componentId:"sc-92716bea-11"})(["position:absolute;top:13px;right:13px;width:24px;height:24px;"]),CC=/*#__PURE__*/bn(ka).withConfig({displayName:"StyledClipboardCheckIcon",componentId:"sc-92716bea-12"})(["position:absolute;top:13px;right:13px;width:24px;height:24px;"]),bC=({clicked:e})=>/*#__PURE__*/t(e?CC:vC,{});const kC=({instruction:n,fees:a,transactionInfo:r,solPrice:i,rpcEndpoint:o})=>/*#__PURE__*/e(rw,{children:[r?.action&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Action"}),/*#__PURE__*/t(lw,{children:r.action})]}),null!=n?.total&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Total"}),/*#__PURE__*/t(lw,{children:n.total})]}),!n?.total&&null!=n?.amount&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Total"}),/*#__PURE__*/t(lw,{children:/*#__PURE__*/t(wc,{quantities:[n.amount,a],tokenPrice:i})})]}),/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"Fees"}),/*#__PURE__*/t(lw,{children:/*#__PURE__*/t(wc,{quantities:[a],tokenPrice:i})})]}),n?.to&&/*#__PURE__*/e(iw,{children:[/*#__PURE__*/t(ow,{children:"To"}),/*#__PURE__*/t(lw,{children:/*#__PURE__*/t(nd,{walletAddress:n.to,rpcEndpoint:o,network:"solana"})})]})]}),TC=({fees:a,onClose:r,receiptHeader:i,receiptDescription:o,transactionInfo:s,solPrice:l,rpcEndpoint:c,signOnly:d,instruction:h})=>/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Js,{onClose:r}),/*#__PURE__*/t(md,{style:{marginBottom:"16px"},children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(iu,{color:"var(--privy-color-success-light)"}),/*#__PURE__*/t(Aa,{height:38,width:38,strokeWidth:2,stroke:"var(--privy-color-success)"})]})}),/*#__PURE__*/t(Mh,{title:i??`Transaction ${d?"signed":"complete"}!`,description:o??"You're all set."}),/*#__PURE__*/t(kC,{solPrice:l,instruction:h,fees:a,transactionInfo:s,rpcEndpoint:c}),/*#__PURE__*/t(Ps,{}),/*#__PURE__*/t(xC,{loading:!1,onClick:r,children:"Close"}),/*#__PURE__*/t(Pc,{}),/*#__PURE__*/t(qs,{})]});let xC=/*#__PURE__*/bn(El).withConfig({displayName:"SubmitButton",componentId:"sc-df6d4eec-0"})(["&&{margin-top:24px;}transition:color 350ms ease,background-color 350ms ease;"]);const AC={component:()=>{let{data:e,onUserCloseViaDialogOrKeybindRef:n,setModalData:a,navigate:r}=es(),{client:i,closePrivyModal:l,walletProxy:c,showFiatPrices:h}=Ut(),p=Go(),{user:u}=rn(),[m,g]=o(e?.sendSolanaTransaction?.transactionRequest),[y,f]=o(),[w,v]=o(),[C,b]=o({value:0n,isLoading:!1}),[k,T]=o(!1),[x,A]=o(),[I,_]=o(),S=e?.sendSolanaTransaction?.connection,E=e?.sendSolanaTransaction?.transactingWallet,N=!!e?.sendSolanaTransaction?.signOnly,M=E?.imported?dn(u):tn(u),P=Bo(S?.rpcEndpoint||""),{solPrice:W,isSolPriceLoading:U}=sd({enabled:h}),O=s((()=>{if(!y)return;let e=y.spender,t=tc(y.fee),n=tc(C.value,3,!0),a=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))),r=a.at(0);if(!r||a.length>1)return{fee:t,spender:e,balance:n};if("sol-transfer"===r.type)return{fee:t,spender:e,balance:n,total:tc(r.value)};if("spl-transfer"===r.type)return{fee:t,spender:e,balance:n,total:`${se({amount:r.value,decimals:r.token.decimals})} ${r.token.symbol}`};if("raydium-swap-base-input"===r.type&&r.tokenIn&&r.tokenOut){return{fee:t,spender:e,balance:n,swap:`${`${se({amount:r.amountIn,decimals:r.tokenIn.decimals})} ${r.tokenIn.symbol}`} → ${`${se({amount:r.minimumAmountOut,decimals:r.tokenOut.decimals})} ${r.tokenOut.symbol}`}`}}if("raydium-swap-base-output"===r.type&&r.tokenIn&&r.tokenOut){return{fee:t,spender:e,balance:n,swap:`${`${se({amount:r.maxAmountIn,decimals:r.tokenIn.decimals})} ${r.tokenIn.symbol}`} → ${`${se({amount:r.amountOut,decimals:r.tokenOut.decimals})} ${r.tokenOut.symbol}`}`}}if("jupiter-swap-shared-accounts-route"===r.type&&r.tokenIn&&r.tokenOut){return{fee:t,spender:e,balance:n,swap:`${`${se({amount:r.inAmount,decimals:r.tokenIn.decimals})} ${r.tokenIn.symbol}`} → ${`${se({amount:r.quotedOutAmount,decimals:r.tokenOut.decimals})} ${r.tokenOut.symbol}`}`}}if("jupiter-swap-exact-out-route"===r.type&&r.tokenIn&&r.tokenOut){return{fee:t,spender:e,balance:n,swap:`${`${se({amount:r.quotedInAmount,decimals:r.tokenIn.decimals})} ${r.tokenIn.symbol}`} → ${`${se({amount:r.outAmount,decimals:r.tokenOut.decimals})} ${r.tokenOut.symbol}`}`}}return{fee:t,spender:e,balance:n}}),[y,E?.address,C]),L=s((()=>{let e;if(!y||!h||!W||U)return;function t(...e){return nc(e.reduce(((e,t)=>e+t),0n),W??0)}E?.address===y.spender&&(e=t(y.fee));let n=t(C.value),a=y.instructions.filter((e=>"sol-transfer"===e.type||"spl-transfer"===e.type)).at(0);return!a||y.instructions.length>1?{fee:e,balance:n}:"sol-transfer"===a.type?{fee:e,balance:n,total:t(a.value,E?.address===y.spender?y.fee:0n)}:"spl-transfer"===a.type?{fee:e,balance:n,total:`${se({amount:a.value,decimals:a.token.decimals})} ${a.token.symbol}`}:{fee:e,balance:n}}),[y,h,W,U,E?.address,C]);if(d((()=>{!async function(){if(m&&S&&i)try{v(void 0);let e=await dc({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(!E||!S)return;b({value:C.value,isLoading:!0});let e=new le({name:"mainnet-beta",rpcUrl:S.rpcEndpoint});b({value:await e.getBalance(E.address).catch((()=>0n))??0n,isLoading:!1})})().catch(console.error)}),[y,S]),!(m&&e?.sendSolanaTransaction&&E&&S)){let n=Error("Invalid transaction request");/*#__PURE__*/return t(bu,{error:n,onClick:()=>{e?.sendSolanaTransaction?.onFailure(n),l({shouldCallAuthOnSuccess:!1})}})}let R=()=>{if(!k)return x?e?.sendSolanaTransaction?.onSuccess(x):e?.sendSolanaTransaction?.onFailure(I??w??Error("User exited the modal before submitting the transaction")),l({shouldCallAuthOnSuccess:!1})};n.current=R;let F=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(x){let n=y?.instructions.filter((e=>"sol-transfer"===e.type||"spl-transfer"===e.type)),a=1===n?.length?n?.at(0):void 0;/*#__PURE__*/return t(TC,{fees:x.fees,onClose:R,transactionInfo:e.sendSolanaTransaction?.uiOptions.transactionInfo,solPrice:W,receiptHeader:e.sendSolanaTransaction?.uiOptions.successHeader,receiptDescription:e.sendSolanaTransaction?.uiOptions.successDescription,rpcEndpoint:S.rpcEndpoint,signOnly:N,instruction:"sol-transfer"===a?.type?{to:a.toAccount,amount:a.value}:{to:a?.toAccount||a?.toAta,total:O?.total}})}return I?/*#__PURE__*/t(sC,{transactionError:I,connection:S,onClose:R,network:"solana",onRetry:async()=>{_(void 0);let{blockhash:e}=await S.getLatestBlockhash();oc(m)?m.message.recentBlockhash=e:m.recentBlockhash=e,g(m)}}):/*#__PURE__*/t(tC,{img:F,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"==P?"Solana":P,blockExplorerUrl:p.solanaClusters[P].blockExplorerUrl,total:h?L?.total:O?.total,fee:h?L?.fee:O?.fee,balance:h?L?.balance:O?.balance,swap:O?.swap,transactingWalletAddress:E.address,disabled:!y?.hasFunds&&!D,isSubmitting:k,isPreparing:!y||C.isLoading,isTokenPriceLoading:h&&U,isMissingFunds:!y?.hasFunds,submitError:I??void 0,parseError:w,onClick:B?async()=>{if(E){if(!D)throw Error("Funding wallet is not enabled");a({...e,funding:{...e.funding,methodScreen:Iv}}),r(Iv)}}:async()=>{try{if(T(!0),k||!E||!c||!u||!M)return;let t=await e.sendSolanaTransaction.onConfirm();A(t)}catch(e){console.warn({transaction:m,error:e}),_(e)}finally{T(!1)}},onClose:R})}},IC=({privy:e,appConfig:t,getAccessToken:n,isHeadlessSigning:a,emitPrivyEvent:r,setModalData:i,openModal:o,walletProxy:s,user:l,signWithUserSigner:c,recoverEmbeddedWallet:d,connectedExternalWallet:h},{transaction:p,connection:u,transactionOptions:m,fundWalletConfig:g,uiOptions:y,address:f,signOnly:w})=>new Promise((async(v,C)=>{let{requesterAppId:b}=y||{},k=w?"signSolanaTransaction":"sendSolanaTransaction",T=f?cn(l,f):sn(l);if(!T&&f&&h)try{if(w){let e=await h.signTransaction(p);return r(k,"onSuccess",{signedTransaction:e}),void v(lc("",e,null))}{let e=await h.sendTransaction(p,u,m),t=await u.getParsedTransaction(e,{maxSupportedTransactionVersion:0}),n=lc(e,p,t??null);return r(k,"onSuccess",{response:n}),void v(n)}}catch(e){throw r(k,"onError",Te.TRANSACTION_FAILURE),C(e),e}if(!T)return r(k,"onError",Te.EMBEDDED_WALLET_NOT_FOUND),void C(new pe("No wallet found for address",Te.EMBEDDED_WALLET_NOT_FOUND));if(!l)return r(k,"onError",Te.MUST_BE_AUTHENTICATED),void C(new pe("User must be authenticated before signing with a Privy wallet",Te.MUST_BE_AUTHENTICATED));let x=nn(T);if(!await d({address:T.address}).catch((()=>!1)))throw r(k,"onError",Te.EMBEDDED_WALLET_NOT_FOUND),new pe(`Cannot sendSolanaTransaction before embedded wallet ${T.address} is connected`,Te.EMBEDDED_WALLET_NOT_FOUND);let A=async()=>{let t=await n();if(!t||!s)throw r(k,"onError",Te.EMBEDDED_WALLET_NOT_FOUND),C(new pe("Must have valid access token and Privy wallet to send transaction",Te.EMBEDDED_WALLET_NOT_FOUND)),new pe("Must have valid access token and Privy wallet to send transaction",Te.EMBEDDED_WALLET_NOT_FOUND);try{let n,i;if(!await d({address:T.address}))throw r(k,"onError",Te.UNKNOWN_CONNECT_WALLET_ERROR),C(new pe("Unable to connect to wallet",Te.UNKNOWN_CONNECT_WALLET_ERROR)),new pe("Unable to connect to wallet",Te.UNKNOWN_CONNECT_WALLET_ERROR);if(a({showWalletUIs:y?.showWalletUIs})&&!w)try{if(!await cc(p,u))throw r(k,"onError",Te.INSUFFICIENT_BALANCE),C(new pe("Solana wallet has insufficient funds for this transaction.",Te.INSUFFICIENT_BALANCE)),new pe("Solana wallet has insufficient funds for this transaction.",Te.INSUFFICIENT_BALANCE)}catch(e){throw console.error(e),r(k,"onError",Te.TRANSACTION_FAILURE),C(new pe(e instanceof Error?e.message:"Transaction failed.",Te.TRANSACTION_FAILURE)),new pe(e instanceof Error?e.message:"Transaction failed.",Te.TRANSACTION_FAILURE)}let{entropyId:o,entropyIdVerifier:h}=Oi(l);if(x){let t=oc(p)?ti(p.message.serialize()):p.serializeMessage(),a=await I(e,c,{chain_type:"solana",method:"signMessage",params:{message:t.toString("base64"),encoding:"base64"},wallet_id:T.id});if(!a.data||!("signature"in a.data))throw Error("Failed to sign transaction");p.addSignature(sc(p,T.address),ti(a.data.signature,"base64")),n=p}else n=await Of({accessToken:t,tx:p,walletProxy:s,entropyId:o,entropyIdVerifier:h,transactingWalletAddress:T.address,transactingWalletIndex:T.walletIndex??0});if(w)return i=lc("",n,null),r("signSolanaTransaction","onSuccess",{signedTransaction:n}),v(i),i;{let{signature:e,receipt:t}=await async function({tx:e,connection:t,transactionOptions:n}){let a;try{let r=e.serialize();a=await t.sendRawTransaction(r,n);let i=await t.confirmTransaction(a);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:a,signedTransaction:e,receipt:await t.getParsedTransaction(a,{maxSupportedTransactionVersion:0})}}catch(e){throw e.txSignature=a,e}}({tx:n,connection:u,transactionOptions:m});i=lc(e,p,t),r("sendSolanaTransaction","onSuccess",{response:i})}return v(i),i}catch(e){throw r(k,"onError",Te.TRANSACTION_FAILURE),C(e),e}};if(a({showWalletUIs:y?.showWalletUIs}))A();else{let{entropyId:e,entropyIdVerifier:n}=Oi(l,T),a={recoveryMethod:T.recoveryMethod,connectingWalletAddress:T.address,entropyId:e,entropyIdVerifier:n,isUnifiedWallet:x,onCompleteNavigateTo:AC,onFailure:e=>{r(k,"onError",Te.UNKNOWN_CONNECT_WALLET_ERROR),C(e)}},s=Vf(t)?Wv({address:T.address,appConfig:t,methodScreen:Iv,fundWalletConfig:g,comingFromSendTransactionScreen:!0}):void 0;i({connectWallet:a,sendSolanaTransaction:{transactionRequest:p,connection:u,transactionOptions:m,transactingWallet:T,onConfirm:A,onSuccess:e=>{w?r("signSolanaTransaction","onSuccess",{signedTransaction:e.signedTransaction}):r("sendSolanaTransaction","onSuccess",{response:e}),v(e)},onFailure:e=>{r(k,"onError",Te.TRANSACTION_FAILURE),C(e)},uiOptions:y||{},requesterAppId:b,signOnly:w},funding:s}),o(zv)}}));function _C(e){let t=Go(),{getAccessToken:n,user:a}=$f(),{setModalData:r}=es(),{isHeadlessSigning:i,openModal:o,walletProxy:s,recoverEmbeddedWallet:l,privy:c,solanaWallets:d}=Ut(),h=Ns(),{signWithUserSigner:p}=pn();return Ss("sendSolanaTransaction",e),{sendTransaction:async({transaction:e,connection:u,uiOptions:m,transactionOptions:g,fundWalletConfig:y,address:f})=>{let w=f?d.find((e=>e.address===f&&"privy"!==e.walletClientType)):void 0;return await IC({privy:c,appConfig:t,getAccessToken:n,isHeadlessSigning:i,emitPrivyEvent:h,setModalData:r,openModal:o,walletProxy:s,user:a,signWithUserSigner:p,recoverEmbeddedWallet:l,connectedExternalWallet:w},{transaction:e,connection:u,transactionOptions:g,uiOptions:m,fundWalletConfig:y,address:f,signOnly:!1})}}}const SC=/*#__PURE__*/bn.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 EC=({data:n})=>{let a=n=>"object"==typeof n&&null!==n?/*#__PURE__*/t(MC,{children:Object.entries(n).map((([t,n])=>/*#__PURE__*/e("li",{children:[/*#__PURE__*/e("strong",{children:[t,":"]})," ",a(n)]},t)))}):/*#__PURE__*/t("span",{children:String(n)});/*#__PURE__*/return t("div",{children:a(n)})};const NC=/*#__PURE__*/bn.div.withConfig({displayName:"Message",componentId:"sc-ccf49562-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%;-ms-overflow-style:none;scrollbar-width:none;&::-webkit-scrollbar{display:none;}"]);let MC=/*#__PURE__*/bn.ul.withConfig({displayName:"MessageList",componentId:"sc-ccf49562-1"})(["margin-left:12px !important;white-space:nowrap;&:first-child{margin-left:0 !important;}strong{font-weight:500 !important;}"]);const PC=({data:e})=>/*#__PURE__*/t(NC,{children:/*#__PURE__*/t(EC,{data:e})});let WC=e=>{if(!zt(e))return e;try{let t=Yt(e);return t.includes("�")?e:t}catch{return e}},UC=e=>JSON.stringify(e,null,2),OC=a=>{let{types:r,primaryType:i,...o}=a.typedData;/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(PC,{data:o}),/*#__PURE__*/t(Mg,{text:UC(a.typedData),itemName:"full payload to clipboard"})," "]})};const LC={component:()=>{let{authenticated:a}=rn(),{initializeWalletProxy:r,closePrivyModal:i}=Ut(),{navigate:s,data:l,onUserCloseViaDialogOrKeybindRef:c}=es(),[h,p]=o(!0),[u,m]=o(""),[g,y]=o(),[f,w]=o(null),[v,C]=o(!1),b=null!==f;d((()=>{a||s(of)}),[a]),d((()=>{r(Ir).then((e=>{p(!1),e||(m("An error has occurred, please try again."),y(new $i(new zi(u,x.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))}))}),[]);let{method:k,data:T,confirmAndSign:A,onSuccess:I,onFailure:_,uiOptions:S}=l.signMessage,E={title:S?.title||"Sign message",description:S?.description||"Signing this message will not cost you any fees.",buttonText:S?.buttonText||"Sign and continue"},N=e=>{e?I(e):_(g||new $i(new zi("The user rejected the request.",x.E4001_USER_REJECTED_REQUEST.eipCode))),i({shouldCallAuthOnSuccess:!1}),setTimeout((()=>{w(null),m(""),y(void 0)}),200)};return c.current=()=>{N(f)},/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Js,{onClose:()=>N(f)}),/*#__PURE__*/t(Mc,{}),S?.iconUrl&&"string"==typeof S.iconUrl?/*#__PURE__*/t(DC,{children:/*#__PURE__*/t(SC,{size:"sm",src:S.iconUrl,alt:"app image"})}):null,/*#__PURE__*/t(yf,{children:E.title}),/*#__PURE__*/t(cm,{children:E.description}),"personal_sign"===k&&/*#__PURE__*/t(NC,{children:WC(T)}),"eth_signTypedData_v4"===k&&/*#__PURE__*/t(OC,{typedData:T}),"solana_signMessage"===k&&/*#__PURE__*/t(NC,{children:T}),/*#__PURE__*/t(BC,{}),/*#__PURE__*/t(RC,{$fail:!0,children:u}),/*#__PURE__*/t(Nl,{disabled:v||b||h,loading:v,onClick:async()=>{C(!0),m("");try{let e=await A();w(e),C(!1),setTimeout((()=>{N(e)}),rr)}catch(e){console.error(e),m("An error has occurred, please try again."),y(new $i(new zi(u,x.E32603_DEFAULT_INTERNAL_ERROR.eipCode))),C(!1)}},children:v?"Signing...":b?/*#__PURE__*/e(FC,{children:[/*#__PURE__*/t(Eg,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",/*#__PURE__*/t("span",{children:"Success"})]}):E.buttonText}),S?.isCancellable&&/*#__PURE__*/t(Rl,{style:{marginTop:"1rem"},onClick:()=>N(null),isSubmitting:!1,children:"Not now"}),/*#__PURE__*/t(Pc,{}),/*#__PURE__*/t(qs,{})]})}};let RC=/*#__PURE__*/bn.div.withConfig({displayName:"InputHelp",componentId:"sc-af56055-0"})(["line-height:20px;height:20px;font-size:13px;color:",";display:flex;justify-content:flex-start;width:100%;margin-top:16px;margin-bottom:4px;"],(e=>e.$fail?"var(--privy-color-error)":"var(--privy-color-foreground-3)")),FC=/*#__PURE__*/bn.span.withConfig({displayName:"ContentWithIcon",componentId:"sc-af56055-1"})(["display:flex;align-items:center;gap:8px;"]),DC=/*#__PURE__*/bn.div.withConfig({displayName:"IconContainer",componentId:"sc-af56055-2"})(["display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%;height:82px;"]),BC=/*#__PURE__*/bn.div.withConfig({displayName:"Grow",componentId:"sc-af56055-3"})(["flex-grow:1;"]);function zC(e){let{isHeadlessSigning:t,walletProxy:n,initializeWalletProxy:a,recoverEmbeddedWallet:r,openModal:i,privy:o,solanaWallets:s}=Ut(),{user:l,getAccessToken:c}=$f(),d=Ns(),{setModalData:h}=es(),{signWithUserSigner:p}=pn();return Ss("signSolanaMessage",e),{signMessage:({message:e,options:u})=>new Promise((async(m,g)=>{let y=u?.address?cn(l,u.address):sn(l);if(!y&&u?.address){let t=s.find((e=>e.address===u.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(!l)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}=Oi(l,y),v=nn(y),C=ti(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(!l)throw Error("User must be authenticated before signing with a Privy wallet");let t=await c();if(!t)throw Error("User must be authenticated to use their embedded wallet.");let i=n??await a(15e3);if(!i)throw Error("Failed to initialize embedded wallet proxy.");if(!await r({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:u?.uiOptions?.showWalletUIs}))try{let e=await b(),t=new Uint8Array(ti(e,"base64"));d("signSolanaMessage","onSuccess",{signature:t}),m(t)}catch(e){g(e)}else h({signMessage:{method:"solana_signMessage",data:C,confirmAndSign:b,onSuccess:e=>{let t=new Uint8Array(ti(e,"base64"));d("signSolanaMessage","onSuccess",{signature:t}),m(t)},onFailure:e=>{g(e)},uiOptions:u?.uiOptions},connectWallet:{recoveryMethod:y.recoveryMethod,connectingWalletAddress:y.address,entropyId:f,entropyIdVerifier:w,isUnifiedWallet:v,onCompleteNavigateTo:LC,onFailure:e=>{d("signSolanaMessage","onError",Te.UNKNOWN_CONNECT_WALLET_ERROR),g(e)}}}),i(zv)}))}}const $C=()=>{let{exportSolanaWallet:e,solanaWallets:t,walletProxy:n,recoverEmbeddedWallet:a,privy:r}=Ut(),{sendTransaction:i}=_C(),{signMessage:o}=zC(),{create:l}=Df(),{signWithUserSigner:c}=pn(),{user:d,getAccessToken:h}=$f(),{ready:p}=dd(),u=s((()=>{if(!n)return t;let e=[...un(d),dn(d)].filter((e=>!!e)).map((e=>({type:"solana",imported:e.imported,address:e.address,connectedAt:Date.now(),walletClientType:"privy",connectorType:"embedded",walletIndex:e.walletIndex??void 0,meta:{name:"Privy Wallet",icon:void 0,id:"io.privy.solana.wallet"},linked:!0,fund(){throw new pe("'fund' is deprecated for Solana wallets - use 'fundWallet' instead")},unlink:()=>{throw new pe("Cannot unlink an embedded Solana wallet")},async getProvider(){return new Uf(n,e.address,this.signMessage)},signMessage:async t=>await o({message:t,options:{address:e.address,uiOptions:{showWalletUIs:!1}}}),async sendTransaction(t,n,a){let{signature:r}=await i({transaction:t,connection:n,transactionOptions:a,address:e.address});return r},async signTransaction(t){let i=await h();if(!i||!n)throw new pe("Must have valid access token and Privy wallet to send transaction",Te.MUST_BE_AUTHENTICATED);if(!await a({address:e.address}).catch((()=>!1)))throw new pe("Wallet couldn't be connected",Te.UNKNOWN_CONNECT_WALLET_ERROR);let{entropyId:o,entropyIdVerifier:s}=Oi(d,e);if(nn(e)){let n=oc(t)?ti(t.message.serialize()):t.serializeMessage(),a=await I(r,c,{chain_type:"solana",method:"signMessage",params:{message:n.toString("base64"),encoding:"base64"},wallet_id:e.id});if(a.data&&"signature"in a.data)return t.addSignature(sc(t,e.address),ti(a.data.signature,"base64")),t;throw Error("Failed to sign transaction")}return await Of({tx:t,accessToken:i,walletProxy:n,entropyId:o,entropyIdVerifier:s,transactingWalletAddress:e.address,transactingWalletIndex:e.walletIndex??0})},async signAllTransactions(t){let i=await h();if(!i||!n)throw new pe("Must have valid access token and Privy wallet to send transaction",Te.MUST_BE_AUTHENTICATED);if(!await a({address:e.address}).catch((()=>!1)))throw new pe("Wallet couldn't be connected",Te.UNKNOWN_CONNECT_WALLET_ERROR);let{entropyId:o,entropyIdVerifier:s}=Oi(d,e);if(nn(e))return await Promise.all(t.map((async t=>{let n=oc(t)?ti(t.message.serialize()):t.serializeMessage(),a=await I(r,c,{chain_type:"solana",method:"signMessage",params:{message:n.toString("base64"),encoding:"base64"},wallet_id:e.id});if(a.data&&"signature"in a.data)return t.addSignature(sc(t,e.address),ti(a.data.signature,"base64")),t;throw Error("Failed to sign transaction")})));for(let a of t)await Of({tx:a,accessToken:i,walletProxy:n,entropyId:o,entropyIdVerifier:s,transactingWalletAddress:e.address,transactingWalletIndex:e.walletIndex??0});return t},loginOrLink:async()=>{throw new pe("Cannot login or link with an embedded Solana wallet")},disconnect:()=>{},isConnected:async()=>!0})));return t.concat(e)}),[d,n,h,t]);return{ready:!(!p||!n),createWallet:async e=>{e&&"target"in e&&e&&(e=void 0);let{account:t}=await l({chainType:"solana",options:e});return t},exportWallet:e,wallets:u}},jC={component:()=>{let{wallets:a}=dd(),{wallets:r}=$C(),{data:i,setModalData:l,navigate:c,lastScreen:h}=es(),{rpcConfig:p,appId:u,createAnalyticsEvent:m,closePrivyModal:g}=Ut(),y=Go(),[f,w]=o(void 0),[v,C]=o(!1),b=mm(),k=i?.funding,{reloadBalance:T}=Sf({rpcConfig:p,appId:u,address:"ethereum"===k.chainType?k.address:void 0,chain:"ethereum"===k.chainType?k.chain:void 0}),x="solana"===k.chainType,A=x?k.isUSDC?"USDC":"SOL":k.erc20Address?k.erc20ContractInfo?.symbol:k.chain.nativeCurrency.symbol,I=x?r.find((({address:e})=>e===k.address)):a.find((({address:e})=>pi(e)===pi(k.address)));if(!k)return l({errorModalData:{error:Error("Couldn't find funding config"),previousScreen:h||Iv},funding:i?.funding,sendTransaction:i?.sendTransaction}),c(Cu),/*#__PURE__*/t(n,{});d((()=>{let e=x?async function(){if("solana"!==k.chainType)return;let e=b(Pf);e?(k.isUSDC?e.getTokenBalance({address:k.address,cluster:k.cluster,mintAddress:Z[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:Ef,payload:{provider:"manual",status:"success",chainType:"solana",address:I?.address,value:k.isUSDC?Dt(t-f,6):Dt(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 T()??BigInt(0);{let{balance:e}=await Nf({chain:k.chain,address:k.address,erc20Address:k.erc20Address,rpcConfig:p,appId:u});return e}})().then((e=>{f&&e>f&&(C(!0),m({eventName:Ef,payload:{provider:"manual",status:"success",chainType:"ethereum",address:I?.address,chainId:k.chain.id,value:Dt(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 _=s((()=>void 0!==f&&f>=parseFloat(k.amount)),[f,k.amount]),S=s((()=>null==f?"":k.isUSDC?se({amount:f,decimals:6}):x?tc(f,3,!0,!0):null!=k.erc20ContractInfo?.decimals?se({amount:f,decimals:k.erc20ContractInfo.decimals}):ce({wei:f})),[f,x,k]),E="ethereum"===k.chainType?k.chain.name:HC[k.cluster.name],N=s((()=>""===k.uiConfig?.receiveFundsTitle?null:/*#__PURE__*/t(yf,{children:k.uiConfig?.receiveFundsTitle??`Receive ${k.amount} ${A??""}`.trim()})),[k.uiConfig?.receiveFundsTitle,k.amount,A]),M=s((()=>""===k.uiConfig?.receiveFundsSubtitle?null:/*#__PURE__*/t(cm,{children:k.uiConfig?.receiveFundsSubtitle??`Scan this code or copy your wallet address to receive funds on ${E}.`})),[k.uiConfig?.receiveFundsSubtitle,E]),P="solana"===k.chainType&&k.isUSDC&&Z[k.cluster.name]?`?spl-token=${Z[k.cluster.name]}`:"";/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(gb,{}),N,M,/*#__PURE__*/e(Sc,{style:{gap:"1rem",margin:N||M?"1rem 0":"0"},children:[/*#__PURE__*/t(am,{url:`${k.chainType}:${k.address}${P}`,size:200,squareLogoElement:VC}),/*#__PURE__*/e(bf,{theme:y.appearance.palette.colorScheme,children:["Make sure to send funds on ",E,"."]}),/*#__PURE__*/t(_f,{title:"Your wallet",errMsg:void 0,showIcon:!0,isLoading:!k||void 0===f,isPulsing:!_,balance:`${S} ${A}`,address:k.address,statusColor:_?"green":"gray"}),v&&/*#__PURE__*/t(El,{onClick:()=>g({shouldCallAuthOnSuccess:!1,isSuccess:!0}),children:"Continue"})]}),/*#__PURE__*/t(qs,{})]})}};let VC=({...e})=>/*#__PURE__*/t(no,{color:"black",...e}),HC={devnet:"Devnet","mainnet-beta":"Solana",testnet:"Testnet"};let qC=[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"}],KC=/*#__PURE__*/bn.div.withConfig({displayName:"Container",componentId:"sc-b3a607dd-0"})(["display:flex;flex-direction:column;min-height:72px;"]);var ZC=({onBack:n,details:a})=>/*#__PURE__*/e(KC,{children:[/*#__PURE__*/t(Js,{backFn:n}),/*#__PURE__*/t(PC,{data:a}),/*#__PURE__*/t(qs,{})]});let YC=({gasUsed:e,effectiveGasPrice:t})=>{if(e&&t)try{return Bt(e*t)}catch(e){return}};const GC=({txn:a,receipt:r,transactionInfo:i,onClose:o,tokenPrice:s,tokenSymbol:l,receiptHeader:c,receiptDescription:d})=>/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Js,{onClose:o}),/*#__PURE__*/t(Eh,{title:c??"Transaction complete!",description:d??"You're all set."}),/*#__PURE__*/t(rd,{tokenPrice:s,from:r.from,to:r.to,gas:YC(r),txn:a,transactionInfo:i,tokenSymbol:l}),/*#__PURE__*/t(Ps,{}),/*#__PURE__*/t(JC,{loading:!1,onClick:o,children:"All Done"}),/*#__PURE__*/t(Pc,{}),/*#__PURE__*/t(qs,{})]});let JC=/*#__PURE__*/bn(El).withConfig({displayName:"SubmitButton",componentId:"sc-f70d0f7a-0"})(["&&{margin-top:24px;}transition:color 350ms ease,background-color 350ms ease;"]);const QC=[{constant:!1,inputs:[{name:"_salt",type:"bytes32"},{name:"_initializer",type:"bytes"}],name:"deployAccount",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],XC=[{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"}]}],eb=[{constant:!1,inputs:[{name:"spender",type:"address"},{name:"value",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],tb=[{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"}],nb=[{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"}],ab=[{constant:!1,inputs:[{name:"_operator",type:"address"},{name:"_approved",type:"bool"}],name:"setApprovalForAll",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],rb=[{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"}],ib=[{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"}],ob=[{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"}],sb=(e,t)=>{let n=lb(eb,e);if(n)return{action:"approve",functionName:"approve",isErc20Ish:!0,isNFTIsh:!1,spender:n.args[0],amount:n.args[1]};let a=lb(gw,e);if(a)return{action:"transfer",functionName:"transfer",isErc20Ish:!0,isNFTIsh:!1,transferTo:a.args[0],amount:a.args[1]};if(!t)return{action:"transaction",functionName:"",isErc20Ish:!1,isNFTIsh:!1};let r=lb(QC,e);if(r&&"string"==typeof r.args[1]){let e=cb(r.args[1]);if(e&&e[4].encodedInitData)return sb(e[4].encodedInitData,t)}let i=lb(ab,e);if(i)return{action:"approve",functionName:"setApprovalForAll",isNFTIsh:!0,isErc20Ish:!1,operator:i.args[0],approved:i.args[1]};let o=lb(rb,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=lb(nb,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=lb(ob,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=lb(ib,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=lb(tb,e);return d?{action:"mint",functionName:d.functionName,isNFTIsh:!0,isErc20Ish:!1,args:d.args}:{action:"transaction",isErc20Ish:!1,isNFTIsh:!1}};let lb=(e,t)=>{try{let n=Gt({abi:e,data:t});return{functionName:n.functionName,args:n.args||[]}}catch(e){return null}},cb=e=>{try{if("string"==typeof e)return Jt(XC,`0x${e.slice(10)}`)}catch(e){return null}},db=e=>`${parseFloat(e).toFixed(2)}`;const hb=(e,t,n,a)=>{let[r,i]=o(null),{getAccessToken:s}=rn(),{walletProxy:l}=Ut();return d((()=>{r&&i(null),(async()=>{if(!await s()||!l||!t)return null;let r=[],i=!0,o=await hd(e,n,t,a).catch((t=>(t.message&&t.message.includes("Insufficient balance for transaction")||t.details&&t.details.includes("insufficient funds")?i=!1:r.push(t),e)));return{tx:o,totalGasEstimate:o.gas,hasFunds:i,errors:r}})().then(i)}),[e]),r};let pb=new $i(new zi("There was an issue preparing your transaction",x.E32603_DEFAULT_INTERNAL_ERROR.eipCode)),ub=(e,t)=>e?.sendTransaction?"transactionRequest"in e.sendTransaction?e.sendTransaction.transactionRequest:e.sendTransaction.transactionRequests[t]:void 0;const mb={component:()=>{let{data:a,onUserCloseViaDialogOrKeybindRef:r,setModalData:i,navigate:l}=es(),{rpcConfig:c,chains:p,closePrivyModal:u,walletProxy:m,showFiatPrices:g}=Ut(),{getAccessToken:y,user:f}=rn(),w=Go(),[v,C]=o(0),[b,k]=o(0),[T,A]=o(ub(a,v)),[I,_]=o(null),[S,E]=o(),[N,M]=o(!1),[P,W]=o(null),[U,O]=o(null),[L,R]=o(null),[F,D]=o(void 0),[B,z]=o(void 0),[$,j]=o(!1),[V,H]=o(!1),[q,K]=o([]),[Z,Y]=o([]),[G,J]=o("uninitiated"),[Q,X]=o(void 0);if(!T||!a?.sendTransaction||!a?.sendTransaction)/*#__PURE__*/return t(bu,{error:Error("Invalid transaction request"),onClick:()=>{a?.sendTransaction?.onFailure(pb),u({shouldCallAuthOnSuccess:!1})}});let{transactingWalletAddress:ee}=a.sendTransaction,te=s((()=>p.find((e=>Number(e.id)===Number(T.chainId)))),[T.chainId]),ne=te?.nativeCurrency.symbol??"ETH",ae=s((()=>sb(T.data,!!w.embeddedWallets.extendedCalldataDecoding)),[T.data]),{action:re,isErc20Ish:ie,isNFTIsh:oe,functionName:le}=ae,{toAddress:ce,tokenAddress:he}=s((()=>({toAddress:ae.isErc20Ish?ae.transferTo:T.to??void 0,tokenAddress:ae.isErc20Ish?T.to:void 0})),[ae]);d((()=>{T.to&&te&&ie&&Jf({address:T.to,chain:te,rpcConfig:w.rpcConfig,privyAppId:w.id}).then(_).catch(console.error)}),[T.to,te]);let{tokenPrice:pe,isTokenPriceLoading:ue}=ld(T.chainId),{balance:me}=Sf({rpcConfig:w.rpcConfig,appId:w.id,address:ee,chain:te}),ge=function({rpcConfig:e,appId:t,address:n,chain:a,tokenInfo:r}){let{chains:i}=Ut(),[l,c]=o(null),[p,u]=o(!1),m=s((()=>{let n=a||i[0];if(n)return Lt({chain:a,transport:Rt(de(n,e,t))})}),[a,e,t]),g=h((async()=>{if(n&&m&&r.address)try{return u(!0),await m.readContract({address:r.address,abi:qC,functionName:"balanceOf",args:[n]})}catch(e){console.error(e)}finally{u(!1)}}),[m,n,r?.address,a]);return d((()=>{g().then((e=>null!=e&&c(e)))}),[g]),{balance:l,isLoading:p&&null==l,formattedBalance:se({amount:l??BigInt(0),decimals:r.decimals})}}({rpcConfig:w.rpcConfig,appId:w.id,address:ee,tokenInfo:{address:he||"",decimals:I?.decimals??18},chain:te}),ye=s((()=>ci(Number(T.chainId),p,c,{appId:w.id})),[T.chainId,c]),fe=hb(T,ee,ye,a?.sendTransaction?.prepareTransactionRequest);d((()=>{A(ub(a,v))}),[v]),d((()=>{a.sendTransaction?.getIsSponsored?a.sendTransaction.getIsSponsored().then(E).catch(console.error):E(!1)}),[a.sendTransaction.getIsSponsored]);let we=()=>{if(!N)return P?a?.sendTransaction?.onSuccess({hash:P}):L||fe?.errors[0]?a?.sendTransaction?.onFailure(L??fe?.errors[0]??pb):a?.sendTransaction?.onFailure(new $i(new zi("The user rejected the request",x.E4001_USER_REJECTED_REQUEST.eipCode))),u({shouldCallAuthOnSuccess:!1})};r.current=we;let ve=!!(a.funding&&a.funding.supportedOptions.length>0),Ce=ql(BigInt(fe?.totalGasEstimate??0n),ne),be=g&&pe?Hl(BigInt(fe?.totalGasEstimate??0n),pe):void 0,ke=ql(me??0n,ne,void 0,!0),Te=g&&pe?Hl(me??0n,pe):void 0,xe=I&&!ge.isLoading&&ie&&"approve"!==re?`${ge.formattedBalance} ${I.symbol}`:void 0,Ae=a.sendTransaction?.uiOptions?.transactionInfo?.title;Ae||(Ae="approve"===re?ie?"Confirm address":"Confirm action":`Approve ${re}`);let Ie=s((()=>{if(a.sendTransaction?.uiOptions?.description)return a.sendTransaction?.uiOptions?.description;if("approve"===re&&"setApprovalForAll"===le&&ae.approved){let a=/*#__PURE__*/t(eh,{address:ae.operator||"",url:te?.blockExplorers?.default?.url});/*#__PURE__*/return e(n,{children:[w.name," would like your permission for ",a," to transfer tokens on your behalf."]})}if("approve"===re&&"setApprovalForAll"===le&&!ae.approved){let a=/*#__PURE__*/t(eh,{address:ae.operator||"",url:te?.blockExplorers?.default?.url});/*#__PURE__*/return e(n,{children:[w.name," would like your permission to revoke permissions of ",a," from transferring tokens on your behalf."]})}return ie&&"approve"===re||ie&&"approve"===re?`${w.name} would like your permission for ${pi(ae.spender)} to spend tokens on your behalf.`:`${w.name} wants your permission to approve the following transaction.`}),[w.name,ie,ae,a.sendSolanaTransaction?.uiOptions.description,le]),_e=a.sendTransaction?.uiOptions?.transactionInfo?.contractInfo?.imgUrl?/*#__PURE__*/t("img",{src:a.sendTransaction.uiOptions.transactionInfo.contractInfo.imgUrl,alt:a.sendTransaction.uiOptions.transactionInfo.contractInfo.imgAltText}):null,Se=!(!fe||fe.errors[0]||fe.hasFunds||!1!==S),Ee=Se&&ve,Ne=Ee?"Add funds":a.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"),H(!0))),"Success"!==e.simulation.status)throw Error("Simulation failed");{D(e.simulation.params);let{assetsIn:t,assetsOut:n}=function(e,t){let n=[],a=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?db(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?db(t.out[0].usd_price):void 0,decimals:t.asset.decimals},a.has(e.id)||a.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?db(e.spenders[t]?.usd_price):void 0,decimals:e.asset.decimals},a.has(n.id)||a.set(n.id,n)}return{assetsIn:n,assetsOut:Array.from(a.values())}}(e.simulation.assets_diffs,e.simulation.exposures);if(0===n.length&&0===t.length)throw Error("No tokens found");K(n),Y(t)}};if(d((()=>{a.sendTransaction?.scanTransaction&&w.embeddedWallets.transactionScanning.enabled&&"uninitiated"===G&&(J("in progress"),a.sendTransaction.scanTransaction().then((e=>{Me(e),J("completed")})).catch((()=>J("failed"))))}),[!!a.sendTransaction?.scanTransaction]),d((()=>{a.sendTransaction?.scanTransaction&&"failed"!==G||((e,t,n)=>{if(k((e=>e?.sendTransaction?"transactionRequest"in e.sendTransaction?0:e.sendTransaction.transactionRequests.length-1:0)(a)),t.isErc20Ish&&t.amount&&n){let e=fw({amount:t.amount,decimals:n.decimals});X(e),K([{value:e,symbol:n?.symbol,decimals:n?.decimals}])}else if(e.value){let t=BigInt(e.value),n=pe?Hl(t,pe):void 0;K(g&&n?[{value:n}]:[{value:Kl(t),symbol:ne,decimals:18,usdValue:n}])}else K(g?[{value:"$0"}]:[{value:"0",symbol:ne,decimals:18}])})(fe?.tx??T,ae,I)}),[T,fe?.tx,ae,I,G]),U/*#__PURE__*/)return t(GC,{txn:fe?.tx??T,onClose:we,receipt:U,transactionInfo:a.sendTransaction?.uiOptions.transactionInfo,tokenPrice:pe,tokenSymbol:ne,receiptHeader:a.sendTransaction?.uiOptions.successHeader,receiptDescription:a.sendTransaction?.uiOptions.successDescription});if(L)/*#__PURE__*/return t(sC,{transactionError:L,transactionHash:P??void 0,network:"ethereum",chainId:fe?.tx.chainId??T.chainId,onClose:we,onRetry:({resetNonce:e})=>{R(null);let t={...fe?.tx??T};e&&(t.nonce=void 0),A(t)}});let Pe=0!==b&&"number"==typeof v&&0!==v?()=>{C(v-1)}:void 0;return $&&F?/*#__PURE__*/t(ZC,{details:F,onBack:()=>j(!1)}):/*#__PURE__*/t(eC,{transactionIndex:v,onBack:Pe,maxIndex:b,disabled:Se&&!ve||V,isSubmitting:N,submitError:L,isPreparing:!fe,isTokenPriceLoading:ue,isTokenContractInfoLoading:!oe&&!I,prepareError:fe?.errors[0],symbol:I?.symbol,chain:te,img:_e,title:Ae,subtitle:Ie,txValue:T.value,fee:be??Ce,isSponsored:S,from:ee??"",to:ce,tokenAddress:he??void 0,network:w.chains.find((e=>e.id===T.chainId))?.name??"",transactionDetails:{...ae,formattedAmount:Q},cta:Ne,missingFunds:Se,action:re,balance:xe??Te??ke,onClose:we,onClick:Ee?async()=>{if(ee){if(!ve)throw Error("Funding wallet is not enabled");i({...a,funding:{...a.funding,methodScreen:Iv,chainType:"ethereum",amount:Ft(BigInt(fe?.tx.value??0)+BigInt(fe?.totalGasEstimate?.toString()??0)),chain:te}}),l(Iv)}}:async()=>{if(v<b)C(v+1);else{M(!0);try{let e=await y();if(N||!e||!m||!f)return;let t=await a.sendTransaction.onConfirm({transactionRequest:fe?.tx??T});if(W(t),a.sendTransaction?.signOnly)return await new Promise((e=>setTimeout(e,rr))),a?.sendTransaction?.onSuccess({hash:t}),u({shouldCallAuthOnSuccess:!1});let n=await ye.waitForTransactionReceipt({hash:t});if("reverted"===n.status)throw Error("Transaction failed");O(n)}catch(e){console.warn({transaction:fe?.tx??T,error:e}),R(e)}finally{M(!1)}}},validation:B,hasScanDetails:!!F,setIsScanDetailsOpen:j,preventMaliciousTransaction:V,setPreventMaliciousTransaction:H,tokensSent:q,tokensReceived:Z,isScanning:"in progress"===G,isCancellable:a.sendTransaction?.uiOptions?.isCancellable??!1,functionName:le})}};function gb({title:e}){let{currentScreen:n,navigateBack:a,navigate:r,data:i,setModalData:o}=es();/*#__PURE__*/return t(Js,{title:e,backFn:n===jC?a:n===i?.funding?.methodScreen?i.funding.comingFromSendTransactionScreen?()=>r(mb):void 0:i?.funding?.methodScreen?()=>{let e=i.funding;e.usingDefaultFundingMethod&&(e.usingDefaultFundingMethod=!1),o({funding:e}),r(e.methodScreen)}:void 0})}const yb={component:()=>{let{rpcConfig:a,appId:r,closePrivyModal:i,createAnalyticsEvent:s}=Ut(),{navigate:l,setModalData:c,app:h,data:p}=es(),{wallets:u}=dd(),m=mm(),[g,y]=o(null),[f,w]=o(null),[v,C]=o([]),[b,k]=o(0),[T,x]=o(!1),[A,I]=o(!1),[_,S]=o(!1),[E,M]=o(!1),[P,W]=o(),[U,O]=o();if(!p?.funding||"solana"!==p.funding.chainType)throw Error("Invalid funding data");let{address:L,cluster:R,connectedWalletAddress:F}=p.funding,[D,B]=o(p.funding.amount),z=F?u.find((({address:e})=>e===F)):u[0],$=Mo(z?.walletClientType||"unknown"),j=$?.name||"wallet",[V,H]=o(null);d((()=>{(async()=>{if(!z)return;let e=await z.getEthereumProvider();H(Vt({account:z.address,transport:Ht(e)}).extend(qt))})().catch(console.error)}),[z]);let[q,K]=o(0n),Z=tc(q);d((()=>{let e=m(Pf);e?e.getBalance({address:L,cluster:R}).then((e=>K(BigInt(e)))):console.warn("Unable to load solana plugin, skipping balance")}),[]);let[Y,G]=o(),{tokenPrice:J}=ld("solana"),{fundingAmountInBaseUnit:Q,fundingAmountInUsd:X}=ac({amount:D,fee:0n,tokenPrice:J,isUsdc:p.funding.isUSDC});if(d((()=>{(async()=>{if(!V||!z)return;let e=["testnet","devnet"].includes(R.name);e&&console.warn("Solana testnets are not supported for bridging");let t=N(h.chains).filter((({testnet:t})=>!!t===e)),n=(await ww({chains:t,address:z.address,appId:r,rpcConfig:a})).filter((e=>e.balance>0n));if(n.length<1)return void y(new pe(`Wallet ${pi(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 gu({isTestnet:!1,input:pu({amount:Q.toString(),user:z.address,recipient:L,destinationChainId:Fo,destinationCurrency:Do,originChainId:e.chain.id})})}))))).filter((e=>"fulfilled"===e.status)).map((e=>e.value));if(i.length<1)return void y(new pe(`Unable to fetch quotes for bridging. Wallet ${pi(z.address)} does not have enough funds.`,void 0,Te.INSUFFICIENT_BALANCE));let o=i.map((({quote:e,balance:t,chain:n})=>({bridgeTx:yu(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),G({data:s.bridgeTx.data,to:s.bridgeTx.to,value:s.bridgeTx.value,chain:s.chain})):y(new pe(`Unable to select bridge option from quotes. Wallet ${pi(z.address)} does not have enough funds.`,void 0,Te.INSUFFICIENT_BALANCE))})().catch(console.error)}),[V]),d((()=>{(async()=>{let e,t;if(!V||!z||T||_||!Y)return;x(!0);let n=Lt({chain:Y.chain,transport:Rt(di(Y.chain,a,r))});try{e=await n.prepareTransactionRequest({account:z.address,to:Y.to,chain:Y.chain,data:Y.data,value:BigInt(Y.value??0)})}catch(e){console.error(e),v.length>1&&w(e.shortMessage??"Something went wrong")}if(e){x(!1),S(!0);try{await V.switchChain({id:Y.chain.id})}catch(e){await V.addChain({chain:Y.chain}),await V.switchChain({id:Y.chain.id})}try{t=await V.sendTransaction(e)}catch(e){console.error(e),"TransactionExecutionError"===e.name&&(v.length<1?y(new pe(e.shortMessage,void 0,Te.TRANSACTION_FAILURE)):w(e.shortMessage??"Something went wrong"))}if(t)return await V.waitForTransactionReceipt({hash:t}),A?(O("pending"),void W(t)):(S(!1),M(!0),void s({eventName:Ef,payload:{provider:"external",status:"success",txHash:t,address:z.address,chainId:Y.chain.id,chainType:"ethereum",value:Y.value?Dt(BigInt(Y.value),18):void 0,token:"ETH",destination:L,destinationClusterName:"mainnet-beta",destinationChainType:"solana",destinationValue:Dt(Q,9),destinationToken:"SOL"}}));S(!1)}else x(!1)})().catch(console.error)}),[V,Y]),fu({transactionHash:P,wallet:z,isTestnet:!1,bridgingStatus:U,setBridgingStatus:O,onSuccess({transactionHash:e,wallet:t}){I(!1),M(!0),s({eventName:Ef,payload:{provider:"external",status:"success",txHash:e,address:t.address,chainId:Y?.chain.id,chainType:"ethereum",value:Y?.value?Dt(BigInt(Y.value),18):void 0,token:"ETH",destination:L,destinationClusterName:"mainnet-beta",destinationChainType:"solana",destinationValue:Dt(Q,9),destinationToken:"SOL"}})},onFailure({error:e}){I(!1),y(e)}}),d((()=>{g&&(c({funding:p?.funding,sendTransaction:p?.sendTransaction,errorModalData:{error:g,previousScreen:sv}}),l(Cu,!1))}),[g]),d((()=>{if(!E)return;let e=setTimeout(i,or);return()=>clearTimeout(e)}),[E]),E/*#__PURE__*/)return e(n,{children:[/*#__PURE__*/t(gb,{}),/*#__PURE__*/t(Mc,{}),/*#__PURE__*/e(_c,{children:[/*#__PURE__*/t(Aa,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),/*#__PURE__*/t(Mh,{title:"Success!",description:`You’ve successfully added ${D} SOL to your ${h.name} wallet. It may take a minute before the funds are available to use.`})]}),/*#__PURE__*/t(Pc,{}),/*#__PURE__*/t(qs,{})]});let ee=v[b];return v.length>1&&ee?/*#__PURE__*/t(av,{displayName:j,configuredFundingChain:R,formattedBalance:Z,fundingAmount:D,fundingCurrency:"SOL",fundingAmountInUsd:X,options:v,selectedOption:ee,isPreparing:T,isSubmitting:_,addressToFund:L,fundingWalletAddress:z?.address||"",errorMessage:f,onSubmit:()=>{p.funding?.amount!==D?async function(){if(z&&ee)try{let e=await gu({isTestnet:!1,input:pu({amount:Q.toString(),user:z.address,recipient:L,destinationChainId:Fo,destinationCurrency:Do,originChainId:ee.chain.id})}),t=yu(e);if(!t)throw Error("Invalid transaction request");I(!0),G({data:t.data,to:t.to,value:t.value,chain:ee.chain})}catch(e){console.error(e),y(new pe("Unable to fetch quotes for bridging",e,Te.INSUFFICIENT_BALANCE))}}().catch(console.error):G({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}):_&&z?/*#__PURE__*/t(pw,{wallet:z,displayName:j,addressToFund:L,isBridging:A,isErc20Flow:!1,chainId:"solana",chainName:R.name,totalPriceInUsd:void 0,totalPriceInNativeCurrency:void 0,gasPriceInUsd:void 0,gasPriceInNativeCurrency:void 0}):
26
26
  /*#__PURE__*/e(n,{children:[/*#__PURE__*/t(gb,{}),/*#__PURE__*/t(Xf,{}),/*#__PURE__*/t("div",{style:{marginTop:"1rem"}}),/*#__PURE__*/t(qs,{})]})}},fb=new Map([[Iv,null],[sv,"external"],[rv,"external"],[mw,"external"],[yb,"external"],[iv,"external"],[jC,"manual"],[fv,"moonpay"]]);const wb=()=>((()=>{let e=Go(),{user:t,getAccessToken:n}=rn(),{refreshSessionAndUser:a,walletProxy:r}=Ut();d((()=>{(async()=>{if("legacy-embedded-wallets-only"===e.embeddedWallets.mode||!t)return;let i=tn(t);if(!i||nn(i)||!mh(i)||!r)return;let o=await n();if(!o)return;let s=i.imported?[i]:t.linkedAccounts.filter((e=>"wallet"===e.type&&"privy"===e.walletClientType&&!e.imported)).filter(mh),{entropyId:l,entropyIdVerifier:c}=Oi(t,i);try{await r.connect({accessToken:o,entropyId:l,entropyIdVerifier:c})}catch(e){if(!Ed(e)||"privy"!==i.recoveryMethod)return void console.debug("Unable to migrate wallet: ",e);await r.recover({accessToken:o,entropyId:l,entropyIdVerifier:c})}try{await r.createDelegatedAction({accessToken:o,rootWallet:{address:i.address,chainType:i.chainType,imported:i.imported},delegatedWallets:s}),await a()}catch(i){console.debug("Unable to migrate wallet: ",i)}})()}),[t,r,e])})(),null),vb=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}),Cb={component:()=>{let{app:a,data:r}=es(),i=Go(),o=r?.externalConnectWallet?.suggestedAddress,s=r?.externalConnectWallet?.description??(o?`Connect the wallet with address ${pi(o)} ${a?.name?`to ${a.name}.`:"."}`:`Connect a wallet to ${a?.name}`),{connectors:l}=Ut(),c=tf({walletList:r?.externalConnectWallet?.walletList??a.appearance.walletList,walletChainType:r?.externalConnectWallet?.walletChainType??a.appearance.walletChainType,connectors:l,connectOnly:!0,ignore:a.appearance.walletList,walletConnectEnabled:a.externalWallets.walletConnect.enabled});/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{},"header"),c.length>0&&/*#__PURE__*/t(Nh,{title:"Connect your wallet",description:s}),/*#__PURE__*/t(Os,{$colorScheme:i.appearance.palette.colorScheme,children:/*#__PURE__*/t(ef,{wallets:c})}),/*#__PURE__*/t(qs,{})]})}};function bb(e){let{logout:t}=l(on);return Ss("logout",e),{logout:t}}const kb={component:()=>{let a=Go(),{data:r,navigate:i,setModalData:l,onUserCloseViaDialogOrKeybindRef:c}=es(),{crossAppAuthFlow:h,updateWallets:p,closePrivyModal:u,createAnalyticsEvent:m}=Ut(),{logout:g}=bb(),[y,f]=o({}),w=r?.crossAppAuth,v={id:w.appId,name:w.name,logoUrl:w.logoUrl},C=new pe(`There was an issue connecting your ${v.name} account. Please try again.`),b=new tr((async e=>{if(w.popup)try{let t=await h({appId:e,popup:w.popup,action:w.action});f({data:t})}catch(e){if(e instanceof pe)f({error:e});else if(e instanceof Ze){if(e.privyErrorCode===Te.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return l({accountTransfer:{nonce:e.data?.data?.nonce,account:e.data?.data?.subject,displayName:e.data?.data?.account?.displayName,linkMethod:`privy:${v.id}`,embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress,oAuthUserInfo:e.data?.data?.otherUser?.oAuthUserInfo}}),void i(Lu);w.popup&&w.popup.close(),f({error:C})}else f({error:C})}else f({error:C})})),k=()=>{y.data&&(p(),w.onSuccess(y.data),u({shouldCallAuthOnSuccess:!0,isSuccess:!0})),w.onError(y.error??new pe("User canceled flow")),u({shouldCallAuthOnSuccess:!1,isSuccess:!1})};c.current=k,d((()=>{v.id.length&&b.execute(v.id)}),[v.id]),d((()=>{if(!y.data)return;let e=y.data;if(a.legal.requireUsersAcceptTerms&&!e.hasAcceptedTerms){let e=setTimeout((()=>{i(qu)}),rr);return()=>clearTimeout(e)}if(ru(e,a.embeddedWallets)){let e=setTimeout((()=>{l({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),m({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,provider:`privy:${v.id}`,screen:"CrossAppAuthScreen"}}),g()},callAuthOnSuccessOnClose:!0}}),i(Vu)}),rr);return()=>clearTimeout(e)}let t=setTimeout(k,rr);return()=>clearTimeout(t)}),[y.data]);let{title:T,subtitle:x}=s((()=>y.data?{title:`Successfully connected with ${v.name}`,subtitle:"You're good to go!"}:y.error?{title:"Authentication failed",subtitle:y.error.message}:{title:`Connecting to ${v.name}`,subtitle:`Please check the pop-up from ${v.name} to continue`}),[y,v.name]);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{onClose:k}),/*#__PURE__*/t(Mc,{}),/*#__PURE__*/e(Tb,{children:[/*#__PURE__*/t(md,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(Tl,{success:!!y.data,fail:!!y.error}),/*#__PURE__*/t(Qp,{name:v.name,logoUrl:v.logoUrl})]})}),/*#__PURE__*/e(Ec,{children:[/*#__PURE__*/t("h3",{children:T}),/*#__PURE__*/t("p",{children:x})]})]}),/*#__PURE__*/t(Pc,{}),/*#__PURE__*/t(Ks,{})]})}};let Tb=/*#__PURE__*/bn.div.withConfig({displayName:"ConnectContainer",componentId:"sc-90b9ae6b-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin-left:27px;margin-right:27px;gap:24px;"]);const xb={component:()=>{let{app:a,data:r}=es(),{closePrivyModal:i}=Ut(),[s,l]=o(!1),[c,h]=o(),{address:p,onDelegate:u,onSuccess:m,onError:g}=r.delegatedActions.consent,y=async()=>{s?m():g(c??new pe("User declined delegating actions.")),i({shouldCallAuthOnSuccess:!1})};return d((()=>{if(!s&&!c)return;let e=setTimeout(y,ir);return()=>clearTimeout(e)}),[s,c]),/*#__PURE__*/e(n,s||c?{children:[/*#__PURE__*/t(Js,{onClose:y}),/*#__PURE__*/t(Mc,{}),/*#__PURE__*/e(Ac,{children:[c?/*#__PURE__*/t(aa,{stroke:"var(--privy-color-error)",width:"64px",height:"64px"}):/*#__PURE__*/t(Aa,{stroke:"var(--privy-color-success)",width:"64px",height:"64px"}),/*#__PURE__*/t(Uc,{height:20}),/*#__PURE__*/t(Mh,{title:c?"Something went wrong":"Success!",description:c?"Please try again.":`You’ve successfully granted delegated action permissions to ${a.name}.`})]}),/*#__PURE__*/t(Pc,{}),/*#__PURE__*/t(qs,{})]}:{children:[/*#__PURE__*/t(Js,{closeable:!0,onClose:y}),/*#__PURE__*/t(Pa,{width:56,height:56,style:{margin:"auto"}}),/*#__PURE__*/t(il,{style:{marginTop:24,color:"var(--privy-color-foreground)"},children:"Enable offline access"}),/*#__PURE__*/e(ol,{style:{marginBottom:24,textWrap:"pretty"},children:["By confirming, ",a.name," will be able to use your wallet for you even when you're not around. You can revoke this later."]}),/*#__PURE__*/t(Ib,{showIcon:!0,address:p,title:"Wallet",isLoading:!1}),/*#__PURE__*/e(Ab,{style:{marginTop:24},children:[/*#__PURE__*/t(Ul,{onClick:y,children:"Not now"}),/*#__PURE__*/t(El,{onClick:async()=>{try{await u(),l(!0)}catch(e){h(e)}},children:"Accept"})]}),/*#__PURE__*/t(qs,{})]})}};let Ab=/*#__PURE__*/bn.div.withConfig({displayName:"ButtonsContainer",componentId:"sc-bdb7bc51-0"})(["display:flex;gap:10px;"]),Ib=/*#__PURE__*/bn(_f).withConfig({displayName:"StyledWalletInfoCard",componentId:"sc-bdb7bc51-1"})(["margin-top:1.5rem;"]);const _b={component:()=>{let{app:a,data:r}=es(),{closePrivyModal:i}=Ut(),[s,l]=o(!1),[c,h]=o(),{onRevoke:p,onSuccess:u,onError:m}=r.delegatedActions.revoke,g=async()=>{s?u():m(c??new pe("User declined revoking access to their delegated wallet.")),i({shouldCallAuthOnSuccess:!1})};return d((()=>{if(!s&&!c)return;let e=setTimeout(g,ir);return()=>clearTimeout(e)}),[s,c]),/*#__PURE__*/e(n,s||c?{children:[/*#__PURE__*/t(Js,{onClose:g}),/*#__PURE__*/t(Mc,{}),/*#__PURE__*/e(Ac,{children:[c?/*#__PURE__*/t(aa,{stroke:"var(--privy-color-error)",width:"64px",height:"64px"}):/*#__PURE__*/t(Aa,{stroke:"var(--privy-color-success)",width:"64px",height:"64px"}),/*#__PURE__*/t(Uc,{height:20}),/*#__PURE__*/t(Mh,{title:c?"Something went wrong":"Success!",description:c?"Please try again.":"You've successfully revoked permissions."})]}),/*#__PURE__*/t(Pc,{}),/*#__PURE__*/t(qs,{})]}:{children:[/*#__PURE__*/t(Js,{closeable:!0,onClose:g}),/*#__PURE__*/t(Wa,{width:56,height:56,style:{margin:"auto"}}),/*#__PURE__*/t(il,{style:{marginTop:24},children:"Revoke offline access to wallet"}),/*#__PURE__*/e(ol,{children:["By confirming, ",a.name," will no longer be able to use this wallet on your behalf when you are not online."]}),/*#__PURE__*/e(Sb,{style:{marginTop:24},children:[/*#__PURE__*/t(Ul,{onClick:g,children:"Deny"}),/*#__PURE__*/t(El,{onClick:async()=>{try{await p(),l(!0)}catch(e){h(e)}},children:"Confirm"})]}),/*#__PURE__*/t(qs,{})]})}};let Sb=/*#__PURE__*/bn.div.withConfig({displayName:"ButtonsContainer",componentId:"sc-993a839-0"})(["display:flex;gap:10px;"]),Eb="#8a63d2";const Nb={component:()=>{let{lastScreen:a,navigateBack:r,data:s,app:l}=es(),{requestFarcasterSignerStatus:c,closePrivyModal:h}=Ut(),[p,u]=o(void 0),[m,f]=o(!1),[w,v]=o(!1),C=i([]),b=s?.farcasterSigner;d((()=>{let e=Date.now(),t=setInterval((async()=>{if(!b?.public_key)return clearInterval(t),void u({retryable:!0,message:"Connect failed",detail:"Something went wrong. Please try again."});"approved"===b.status&&(clearInterval(t),f(!1),v(!0),C.current.push(setTimeout((()=>h({shouldCallAuthOnSuccess:!1,isSuccess:!0})),rr)));let n=await c(b?.public_key),a=Date.now()-e;"approved"===n.status?(clearInterval(t),f(!1),v(!0),C.current.push(setTimeout((()=>h({shouldCallAuthOnSuccess:!1,isSuccess:!0})),rr))):a>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),C.current.forEach((e=>clearTimeout(e)))}}),[]);let k="pending_approval"===b?.status?b.signer_approval_url:void 0;/*#__PURE__*/return e(n,g||m?{children:[/*#__PURE__*/t(Js,{backFn:a?r:void 0,onClose:h},"header"),/*#__PURE__*/t(Mc,{}),
27
- /*#__PURE__*/t(n,y?{children:/*#__PURE__*/e(Pb,{children:[/*#__PURE__*/t(md,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(Tl,{success:w,fail:!!p}),/*#__PURE__*/t(Sg,{style:{width:"38px",height:"38px"}})]})}),/*#__PURE__*/e(Ec,{children:[/*#__PURE__*/t(il,{children:p?p.message:"Add a signer to Farcaster"}),/*#__PURE__*/t(ol,{children:p?p.detail:"This will allow "+l.name+" to add casts, likes, follows, and more on your behalf."})]}),k&&/*#__PURE__*/t(El,{onClick:e=>{e.preventDefault(),window.location.href=k},children:"Open Farcaster app"})]})}:{children:/*#__PURE__*/e(Mb,{children:[/*#__PURE__*/t(md,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(Tl,{success:w,fail:!!p}),/*#__PURE__*/t(Sg,{style:{width:"38px",height:"38px"}})]})}),/*#__PURE__*/e(Ec,{children:[/*#__PURE__*/t(il,{children:p?p.message:"Requesting signer from Farcaster"}),/*#__PURE__*/t(ol,{children:p?p.detail:"This should only take a moment"}),/*#__PURE__*/t(xc,{children:k&&g&&/*#__PURE__*/t(Wg,{text:"Take me to Farcaster",url:k,color:Eb})})]})]})}),/*#__PURE__*/t(Ks,{})]}:{children:[/*#__PURE__*/t(Js,{backFn:a?r:void 0,onClose:h},"header"),/*#__PURE__*/t(Mc,{}),/*#__PURE__*/t(Mb,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(il,{children:"Add a signer to Farcaster"}),/*#__PURE__*/e(ol,{children:["This will allow ",l.name," to add casts, likes, follows, and more on your behalf."]}),/*#__PURE__*/t(Ic,{children:"pending_approval"===b?.status?/*#__PURE__*/t(am,{url:b.signer_approval_url,size:275,squareLogoElement:Sg}):/*#__PURE__*/t(xl,{})}),/*#__PURE__*/e(xc,{children:[/*#__PURE__*/t(ol,{children:"Or copy this link and paste it into a phone browser to open the Farcaster app."}),"pending_approval"===b?.status&&/*#__PURE__*/t(Mg,{text:b.signer_approval_url,itemName:"link",color:Eb})]})]})}),/*#__PURE__*/t(Ks,{})]})}};let Mb=/*#__PURE__*/bn.div.withConfig({displayName:"ConnectContainer",componentId:"sc-b12dfec-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin-left:27px;margin-right:27px;gap:24px;"]),Pb=/*#__PURE__*/bn.div.withConfig({displayName:"ConnectContainerButton",componentId:"sc-b12dfec-1"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;width:100%;"]);const Wb={component:()=>{let{closePrivyModal:a}=Ut();/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{},"header"),/*#__PURE__*/t(Ub,{children:/*#__PURE__*/t(ra,{style:{width:32,height:32}})}),/*#__PURE__*/t(Nh,{title:"Could not log in with provider",description:"It looks like you're using an in-app browser. To log in, please try again using an external browser.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),/*#__PURE__*/t(Tc,{children:/*#__PURE__*/t(El,{onClick:()=>a(),children:"Close"})}),/*#__PURE__*/t(Pc,{}),/*#__PURE__*/t(qs,{})]})}};let Ub=/*#__PURE__*/bn.div.withConfig({displayName:"StyledCircle",componentId:"sc-7bde5742-0"})(["border-radius:50%;height:68px;width:68px;display:flex;align-items:center;justify-content:center;background-color:var(--privy-color-accent);color:white;margin:0 auto 24px auto;"]);const Ob={component:()=>{let{app:a}=es();/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{},"header"),/*#__PURE__*/t(Mc,{}),/*#__PURE__*/t(Mh,{title:"Connect your email",description:`Add your email to your ${a?.name} account`,icon:/*#__PURE__*/t(ea,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),/*#__PURE__*/t(Tc,{children:/*#__PURE__*/t(Ny,{stacked:!0})}),/*#__PURE__*/t(Pc,{}),/*#__PURE__*/t(qs,{})]})}},Lb={component:()=>{let{app:a,currentScreen:r,data:i,navigate:o,setModalData:s}=es(),{initLoginWithSms:l}=Ut();/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{},"header"),/*#__PURE__*/t(Mc,{}),/*#__PURE__*/t(Mh,{title:"Connect your phone",description:`Add your number to your ${a?.name} account`,icon:/*#__PURE__*/t(Sn,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),/*#__PURE__*/t(Tc,{children:/*#__PURE__*/t(Gg,{stacked:!0,onSubmit:async function({qualifiedPhoneNumber:e}){try{await l({phoneNumber:e,withPrivyUi:!0}),o(ky)}catch(e){s({errorModalData:{error:e,previousScreen:i?.errorModalData?.previousScreen||r||Lb}}),o(Cu)}},hideRecent:!0})}),/*#__PURE__*/t(Pc,{}),/*#__PURE__*/t(qs,{})]})}},Rb=({style:n,...a})=>/*#__PURE__*/e("svg",{width:"164",height:"164",viewBox:"0 0 164 164",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...n},...a,children:[/*#__PURE__*/t("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),/*#__PURE__*/t("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M81.9999 100.788C93.3288 100.788 102.513 91.6043 102.513 80.2754C102.513 68.9465 93.3288 59.7626 81.9999 59.7626C70.671 59.7626 61.4871 68.9465 61.4871 80.2754C61.4871 91.6043 70.671 100.788 81.9999 100.788ZM88.3236 71.8304C88.9093 71.2446 89.8591 71.2446 90.4449 71.8304C91.0307 72.4161 91.0307 73.3659 90.4449 73.9517L84.121 80.2756L90.445 86.5996C91.0308 87.1854 91.0308 88.1351 90.445 88.7209C89.8592 89.3067 88.9095 89.3067 88.3237 88.7209L81.9997 82.3969L75.6756 88.7209C75.0899 89.3067 74.1401 89.3067 73.5543 88.7209C72.9685 88.1351 72.9685 87.1854 73.5543 86.5996L79.8783 80.2756L73.5544 73.9517C72.9686 73.3659 72.9686 72.4161 73.5544 71.8304C74.1402 71.2446 75.09 71.2446 75.6758 71.8304L81.9997 78.1543L88.3236 71.8304Z",fill:"#EC6351"})]}),Fb={component:()=>{let{closePrivyModal:a}=Ut(),{navigate:r}=es();/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{},"header"),/*#__PURE__*/t(Mc,{}),/*#__PURE__*/t(Rb,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),/*#__PURE__*/t(Nh,{title:"Could not connect with wallet",description:"Please check that Phantom multichain is enabled and try again.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),/*#__PURE__*/e(Tc,{children:[/*#__PURE__*/t(El,{onClick:()=>r(of),children:"Try again"}),/*#__PURE__*/t(Ul,{onClick:()=>a(),children:"Cancel"})]}),/*#__PURE__*/t(Pc,{}),/*#__PURE__*/t(qs,{})]})}};function Db(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:n,submitEnrollmentWithSms:a,submitEnrollmentWithTotp:r,submitEnrollmentWithPasskey:i,unenroll:o,enrollInMfa:s}=l(on);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:n,submitEnrollmentWithSms:a,submitEnrollmentWithTotp:r,submitEnrollmentWithPasskey:i,unenrollWithSms:()=>o("sms"),unenrollWithTotp:()=>o("totp"),unenrollWithPasskey:e=>o("passkey",e),showMfaEnrollmentModal:()=>s(!0),closeMfaEnrollmentModal:()=>s(!1)}}const Bb=n=>/*#__PURE__*/e(zb,{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 zb=/*#__PURE__*/bn.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 $b=({showIntro:a,userMfaMethods:r,appMfaMethods:i,userHasAuthSms:o,isTotpLoading:s,isPasskeyLoading:l,error:c,onClose:d,onBackToIntro:h,handleSelectMethod:p,setRemovingMfaMethod:u})=>{let m=r.reduce(((e,t)=>({...e,[t]:!0})),{}),g=i.reduce(((e,t)=>({...e,[t]:!0})),{});/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{backFn:a?h:void 0,onClose:d},"header"),/*#__PURE__*/t(Cl,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(En,{})}),/*#__PURE__*/t(il,{children:"Choose a verification method"}),r.length>0?/*#__PURE__*/t(ol,{children:"To add or delete verification methods, verification is required."}):/*#__PURE__*/t(ol,{children:"How would you like to verify your identity?"}),c&&/*#__PURE__*/t(bl,{style:{marginTop:"1.25rem"},children:c.message}),/*#__PURE__*/e(pl,{children:[(g.passkey||m.passkey)&&/*#__PURE__*/e(ul,{children:[/*#__PURE__*/t(Fs,{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(fl,{children:[/*#__PURE__*/e(gl,{children:[/*#__PURE__*/t(_n,{}),"Passkey"]}),m.passkey?/*#__PURE__*/t(jb,{color:"green",children:"Enabled"}):/*#__PURE__*/t(yl,{$isAccent:!0,children:/*#__PURE__*/t(ma,{})})]})}),m.passkey&&/*#__PURE__*/t(ml,{style:{position:"absolute",right:0},onClick:()=>u("passkey"),children:/*#__PURE__*/t(Fa,{})})]},"passkey"),(g.totp||m.totp)&&/*#__PURE__*/e(ul,{children:[/*#__PURE__*/t(Fs,{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(fl,{children:[/*#__PURE__*/e(gl,{children:[/*#__PURE__*/t(In,{}),"Authenticator app"]}),m.totp&&/*#__PURE__*/t(jb,{color:"green",children:"Enabled"})]})}),m.totp&&/*#__PURE__*/t(ml,{style:{position:"absolute",right:0},onClick:()=>u("totp"),children:/*#__PURE__*/t(Fa,{})})]},"totp"),(g.sms||m.sms)&&/*#__PURE__*/e(ul,{children:[/*#__PURE__*/t(Fs,{disabled:m.sms||o,onClick:()=>p("sms"),children:/*#__PURE__*/e(fl,{children:[/*#__PURE__*/e(gl,{children:[/*#__PURE__*/t(Sn,{}),"SMS"]}),m.sms&&/*#__PURE__*/t(jb,{color:"green",children:"Enabled"}),o&&/*#__PURE__*/t(yl,{children:"Disabled"})]})}),m.sms&&/*#__PURE__*/t(ml,{style:{position:"absolute",right:0},onClick:()=>u("sms"),children:/*#__PURE__*/t(Fa,{})})]},"sms")]}),/*#__PURE__*/t(Vb,{children:"You can always change your selection later"}),/*#__PURE__*/t(Ks,{})]})};let jb=/*#__PURE__*/bn(Ig).withConfig({displayName:"StyledChip",componentId:"sc-24f8b314-0"})(["margin-right:1.5rem;"]),Vb=/*#__PURE__*/bn(wl).withConfig({displayName:"StyledTerms",componentId:"sc-24f8b314-1"})(["&&{margin-top:1rem;}text-align:center;"]);const Hb=({onClose:e,onReset:n,submitEnrollmentWithPasskey:a})=>{let{user:r}=rn(),{initLinkWithPasskey:i,linkWithPasskey:l}=Ut(),[c,d]=o(!1),[h,p]=o(!1),[u,m]=o(null),g=s((()=>r?.linkedAccounts.filter((e=>"passkey"===e.type))??[]),[r]),y=async e=>{d(!0);try{await a(e)}catch(e){m(e)}finally{d(!1)}},f=async()=>{p(!0),m(null);try{await i();let e=await l(),t=e?.linkedAccounts.filter((e=>"passkey"===e.type)).map((e=>e.credentialId))??[];await y(t)}catch(e){m(e)}finally{p(!1)}};return 0===g.length||h?/*#__PURE__*/t(qb,{onReset:n,onClose:e,onClick:f,isCreating:h}):u?/*#__PURE__*/t(bu,{error:u,backFn:()=>m(null),onClick:()=>m(null)}):/*#__PURE__*/t(Kb,{passkeys:g,isSubmitting:c,isCreating:h,onReset:n,onClose:e,onSubmitEnrollment:()=>y(g.map((e=>e.credentialId))),onAddPasskey:f})};let qb=({onReset:a,onClose:r,onClick:i,isCreating:o})=>/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Js,{backFn:a,onClose:r},"header"),/*#__PURE__*/t(rl,{children:/*#__PURE__*/e(Ww,{children:[/*#__PURE__*/t(gd,{}),/*#__PURE__*/t(zg,{})]})}),/*#__PURE__*/t(il,{children:"Set up passkey verification"}),/*#__PURE__*/e(ll,{children:[/*#__PURE__*/e(dl,{children:[/*#__PURE__*/t(cl,{children:/*#__PURE__*/t(En,{})}),"Verify with Touch ID, Face ID, PIN, or hardware key"]}),/*#__PURE__*/e(dl,{children:[/*#__PURE__*/t(cl,{children:/*#__PURE__*/t(Ua,{})}),"Takes seconds to set up and use"]}),/*#__PURE__*/e(dl,{children:[/*#__PURE__*/t(cl,{children:/*#__PURE__*/t(Da,{})}),"Use your passkey to verify transactions and login to your account"]})]}),/*#__PURE__*/t(El,{style:{marginTop:"2.25rem"},onClick:i,loading:o,children:"Add a new passkey"}),/*#__PURE__*/t(Ks,{})]}),Kb=({onReset:a,onClose:r,onAddPasskey:i,onSubmitEnrollment:s,passkeys:l,isSubmitting:c,isCreating:d})=>{let[h,p]=o(!1),u=h?l.length:l.length>3?2:3;/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{backFn:h?()=>p(!1):a,onClose:r},"header"),!h&&/*#__PURE__*/t(rl,{children:/*#__PURE__*/e(Ww,{children:[/*#__PURE__*/t(gd,{}),/*#__PURE__*/t(zg,{})]})}),/*#__PURE__*/t(il,{children:"Enable your passkeys for verification"}),/*#__PURE__*/e(ll,{children:[l.slice(0,u).map((n=>/*#__PURE__*/e(Zb,{children:[/*#__PURE__*/t(Yb,{children:Jb(n)}),/*#__PURE__*/e(Gb,{children:["Last used: ",n.latestVerifiedAt?.toLocaleString()]})]},n.credentialId))),!h&&l.length>3&&/*#__PURE__*/t(Qb,{onClick:()=>p(!0),children:"View All"})]}),/*#__PURE__*/t(El,{style:{marginTop:"1.5rem"},onClick:s,loading:c,children:"Enable passkeys"}),l.length<5&&/*#__PURE__*/t(Qb,{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(Ks,{})]})},Zb=/*#__PURE__*/bn.div.withConfig({displayName:"PasskeyItem",componentId:"sc-bae3649d-0"})(["&&{padding:0.75rem 1rem;text-align:left;border-radius:0.5rem;border:1px solid var(--privy-color-foreground-4);width:100%;}"]),Yb=/*#__PURE__*/bn.div.withConfig({displayName:"PasskeyItemTitle",componentId:"sc-bae3649d-1"})(["font-size:0.875rem;line-height:1.375rem;font-weight:500;color:var(--privy-color-foreground-1);"]),Gb=/*#__PURE__*/bn.div.withConfig({displayName:"PasskeyItemSubtitle",componentId:"sc-bae3649d-2"})(["font-size:0.75rem;font-weight:400;line-height:1.125rem;color:var(--privy-color-foreground-2);"]),Jb=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 Qb=/*#__PURE__*/bn.button.withConfig({displayName:"StyledLink",componentId:"sc-bae3649d-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;}}"]),Xb=({appName:a,onComplete:r,onReset:i,onClose:s})=>{let[l,c]=o(""),[d,h]=o(!1),[p,u]=o(null),[m,g]=o("enroll"),{initEnrollmentWithSms:y,submitEnrollmentWithSms:f}=Db(),{app:w,data:v}=es();function C(){v?.mfaEnrollmentFlow?.onSuccess(),r()}return p?/*#__PURE__*/t(bu,{error:p,backFn:()=>u(null),onClick:()=>u(null)}):/*#__PURE__*/e(n,"enroll"===m?{children:[/*#__PURE__*/t(Js,{backFn:i,onClose:s},"header"),/*#__PURE__*/t(Cl,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(Sn,{})}),/*#__PURE__*/t(il,{children:"Set up SMS verification"}),/*#__PURE__*/e(ol,{children:["We'll text a verification code to this mobile device whenever you use your ",a," ","wallet."]}),/*#__PURE__*/e(sl,{children:[/*#__PURE__*/t(Gg,{onSubmit:async function({qualifiedPhoneNumber:e}){try{await y({phoneNumber:e}),c(e),g("verify")}catch(e){u(e)}},hideRecent:!0}),/*#__PURE__*/e(wl,{children:["By providing your mobile number, you agree to receive text messages from ",w?.name,". Some carrier charges may apply"]})]}),/*#__PURE__*/t(Ks,{})]}:d?{children:[/*#__PURE__*/t(Js,{onClose:C},"header"),/*#__PURE__*/t(Cl,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(Aa,{})}),/*#__PURE__*/t(il,{children:"SMS verification added"}),/*#__PURE__*/e(ol,{children:["From now on, you'll enter the verification code sent to your mobile device whenever you use your ",a," wallet."]}),/*#__PURE__*/t(hl,{children:/*#__PURE__*/t(El,{onClick:C,children:"Done"})}),/*#__PURE__*/t(Ks,{})]}:{children:[/*#__PURE__*/t(Js,{backFn:function(){"verify"===m?g("enroll"):i()},onClose:s},"header"),/*#__PURE__*/t(Cl,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(Sn,{})}),/*#__PURE__*/t(il,{children:"Enter enrollment code"}),/*#__PURE__*/e(sl,{children:[/*#__PURE__*/t(kd,{onChange:async function(e){try{if(!e)return;await f({phoneNumber:l,mfaCode:e}),h(!0)}catch(e){if(Wd(e))throw Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.");if(Md(e))throw Error("The code you entered is not valid");if(Nd(e))throw Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.");throw Ud(e)?Error("Verification canceled"):Error("Unknown error")}}}),/*#__PURE__*/e(ol,{children:["To continue, enter the 6-digit code sent to ",/*#__PURE__*/t("strong",{children:he(l)})]})]}),/*#__PURE__*/t(Ks,{})]})},ek=({size:e,authUrl:n})=>/*#__PURE__*/t(am,{url:n,squareLogoElement:Ba,size:e,fgColor:"#1F1F1F"}),tk=({onClose:a,onReset:r,totpInfo:i,submitEnrollmentWithTotp:s,error:l})=>{let[c,d]=o("enroll");/*#__PURE__*/return e(n,"enroll"===c?{children:[/*#__PURE__*/t(Js,{backFn:r,onClose:a},"header"),/*#__PURE__*/t(yf,{children:"Scan QR code"}),/*#__PURE__*/t(cm,{children:"Open your authenticator app and scan this code to continue"}),/*#__PURE__*/t(Ic,{children:/*#__PURE__*/t(ek,{authUrl:i.authUrl,size:240})}),/*#__PURE__*/t(xf,{style:{textAlign:"left"},children:"Setup key"}),/*#__PURE__*/e(If,{style:{marginTop:"0.25rem"},children:[/*#__PURE__*/t(Tf,{children:"•".repeat(16)}),/*#__PURE__*/t(Mg,{itemName:" ",text:i.secret})]}),/*#__PURE__*/t(El,{style:{marginTop:"1rem"},onClick:function(){d("verify")},children:"Continue"}),/*#__PURE__*/t(Ks,{})]}:{children:[/*#__PURE__*/t(Js,{backFn:function(){"verify"===c?d("enroll"):r()},onClose:a},"header"),/*#__PURE__*/t(Cl,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(In,{})}),/*#__PURE__*/t(yf,{children:"Enter enrollment code"}),/*#__PURE__*/t(cm,{children:"To continue, enter the 6-digit code generated from your authenticator app"}),/*#__PURE__*/t(sl,{children:/*#__PURE__*/t(kd,{onChange:async function(e){try{if(!e)return;await s({mfaCode:e})}catch(e){if(Wd(e))throw Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.");if(Md(e))throw Error("The code you entered is not valid");if(Nd(e))throw Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.");throw Ud(e)?Error("Verification canceled"):Error("Unknown error")}},errorReasonOverride:l?.message})}),/*#__PURE__*/t(Ks,{})]})},nk={component:()=>{let{user:a,enrollInMfa:r,ready:i}=rn(),[s,l]=o(null),{unenrollWithSms:c,unenrollWithTotp:h,unenrollWithPasskey:p,submitEnrollmentWithTotp:u,initEnrollmentWithPasskey:m,submitEnrollmentWithPasskey:g,initEnrollmentWithTotp:y}=Db(),{app:f,data:w,onUserCloseViaDialogOrKeybindRef:v}=es(),{closePrivyModal:C}=Ut(),{promptMfa:b}=Rd(),[k,T]=o(!1),[x,A]=o(null),[I,_]=o(null),S=()=>{C({shouldCallAuthOnSuccess:!0}),r(!1),setTimeout((()=>{l(null),A(null)}),500)},[E,N]=o(!1),[M,P]=o();v.current=S;let W=a?.mfaMethods.includes("sms"),U=!!a?.phone,O=a?.mfaMethods.includes("totp"),L=a?.mfaMethods.includes("passkey"),R=W||O||L,F=a?.linkedAccounts.filter((e=>"passkey"===e.type)).map((e=>e.credentialId))??[];function D(){l(null),A(null)}async function B(e=F){N(!0);try{return await m(),await g({credentialIds:e},{removeForLogin:w?.mfaEnrollmentFlow?.shouldUnlinkOnUnenrollMfa}),w?.mfaEnrollmentFlow?.onSuccess(),S()}catch(e){P(e)}finally{N(!1)}}if(d((()=>{R&&T(!0)}),[R]),!i||!a||!f/*#__PURE__*/)return e(n,{children:[/*#__PURE__*/t(Js,{onClose:S},"header"),/*#__PURE__*/t(rl,{children:/*#__PURE__*/t(Bb,{})}),/*#__PURE__*/t(sl,{children:/*#__PURE__*/t(xl,{})}),/*#__PURE__*/t(Ks,{})]});if("sms"===s)/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{backFn:D,onClose:S},"header"),/*#__PURE__*/t(Cl,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(Mn,{})}),/*#__PURE__*/t(il,{children:"Remove SMS verification?"}),/*#__PURE__*/e(ol,{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(hl,{children:/*#__PURE__*/t(El,{$warn:!0,onClick:async function(){l(null);try{await c()}catch(e){l(null)}},children:"Remove"})}),/*#__PURE__*/t(Ks,{})]});if("totp"===s)/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{backFn:D,onClose:S},"header"),/*#__PURE__*/t(Cl,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(Mn,{})}),/*#__PURE__*/t(il,{children:"Remove authenticator app verification?"}),/*#__PURE__*/e(ol,{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(hl,{children:/*#__PURE__*/t(El,{$warn:!0,onClick:async function(){l(null);try{await h()}catch(e){l(null)}},children:"Remove"})}),/*#__PURE__*/t(Ks,{})]});if("passkey"===s){let a=w?.mfaEnrollmentFlow?.shouldUnlinkOnUnenrollMfa??!0;/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{backFn:D,onClose:S},"header"),/*#__PURE__*/t(Cl,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(Mn,{})}),/*#__PURE__*/t(il,{children:"Are you sure you want to remove this passkey?"}),/*#__PURE__*/t(ol,{children:a?"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(hl,{children:/*#__PURE__*/t(El,{$warn:!0,onClick:async function(){l(null);try{await p({removeForLogin:w?.mfaEnrollmentFlow?.shouldUnlinkOnUnenrollMfa})}catch(e){l(null)}},children:"Remove"})}),/*#__PURE__*/t(Ks,{})]})}if(0===w.mfaEnrollmentFlow.mfaMethods.length&&!R)/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{onClose:S},"header"),/*#__PURE__*/t(Cl,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(En,{})}),/*#__PURE__*/t(il,{children:"Add more security"}),/*#__PURE__*/e(ol,{children:[f?.name," does not have any verification methods enabled."]}),/*#__PURE__*/t(hl,{children:/*#__PURE__*/t(El,{onClick:S,children:"Close"})}),/*#__PURE__*/t(Ks,{})]});let z=!R&&!k;return z?/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Js,{onClose:S},"header"),/*#__PURE__*/t(Cl,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(En,{})}),/*#__PURE__*/t(il,{children:"Transaction Protection"}),/*#__PURE__*/t(ol,{children:"Set up transaction protection to add an extra layer of security to your account"}),/*#__PURE__*/e(ll,{children:[/*#__PURE__*/e(dl,{children:[/*#__PURE__*/t(cl,{children:/*#__PURE__*/t(La,{})}),"Enable 2-Step verification for your ",f?.name," wallet."]}),/*#__PURE__*/e(dl,{children:[/*#__PURE__*/t(cl,{children:/*#__PURE__*/t(Ra,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),/*#__PURE__*/e(hl,{children:[/*#__PURE__*/t(El,{onClick:()=>T(!0),children:"Continue"}),/*#__PURE__*/t(Ul,{onClick:S,children:"Not now"})]}),/*#__PURE__*/t(Ks,{})]}):"sms"===x?/*#__PURE__*/t(Xb,{appName:f?.name||"Privy",onComplete:S,onReset:D,onClose:S}):"totp"===x&&I?/*#__PURE__*/t(tk,{onClose:S,onReset:D,submitEnrollmentWithTotp:({mfaCode:e})=>async function(e){try{return P(void 0),await u({mfaCode:e}),w?.mfaEnrollmentFlow?.onSuccess(),S()}catch(e){P(e)}finally{l(null)}}(e),totpInfo:{...I,appName:f?.name||"Privy"}}):"passkey"===x?/*#__PURE__*/t(Hb,{onReset:D,onClose:S,submitEnrollmentWithPasskey:B}):/*#__PURE__*/t($b,{showIntro:z,userMfaMethods:a.mfaMethods,appMfaMethods:f.mfa.methods,userHasAuthSms:U,onBackToIntro:function(){T(!1)},handleSelectMethod:async function(e){try{await b()}catch(e){return void P(e)}return"totp"===e?(A(e),_(null),void y().then((e=>{_(e)})).catch((()=>{_(null),D()}))):"passkey"===e&&1===F.length?await B():void A(e)},isTotpLoading:"totp"===x&&!I,isPasskeyLoading:E,error:M,onClose:S,setRemovingMfaMethod:async e=>{try{await b()}catch(e){return void P(e)}l(e)}})}},ak={component:()=>{let{authenticated:a,logout:r,ready:i,user:s}=rn(),{app:l,setModalData:c,navigate:h,resetNavigation:p}=es(),{getAuthMeta:u,initLoginWithOAuth:m,loginWithOAuth:g,updateWallets:y,setReadyToTrue:f,closePrivyModal:w,createAnalyticsEvent:v}=Ut(),[C,b]=o(!1),[k,T]=o(void 0),x=u()?.provider||"google",{name:A,component:I}=Yr(x);d((()=>{g(x).then((()=>{b(!0),f(!0)})).catch((e=>{if(f(!1),e?.privyErrorCode===Te.ALLOWLIST_REJECTED)return T(void 0),p(),void h(ym);if(e?.privyErrorCode===Te.USER_LIMIT_REACHED)return console.error(new Et(e).toString()),T(void 0),p(),void h(Pm);if(e?.privyErrorCode===Te.USER_DOES_NOT_EXIST)return T(void 0),p(),void h(ou);if(e?.privyErrorCode===Te.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return T(void 0),p(),c({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 h(Lu);let{retryable:t,detail:n}=function(e,t){let n={detail:"",retryable:!1},a=Lr(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 ${a} 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=Yr(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=Yr(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,x);T({retryable:t,detail:n,message:"Authentication failed"})})).finally((()=>{Jr()}))}),[A,x]),d((()=>{if(i&&a&&C&&s){if(l?.legal.requireUsersAcceptTerms&&!s.hasAcceptedTerms){let e=setTimeout((()=>{h(qu)}),rr);return()=>clearTimeout(e)}if(ru(s,l.embeddedWallets)){let e=setTimeout((()=>{c({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),v({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,provider:x,screen:"OAuthStatusScreen"}}),r()},callAuthOnSuccessOnClose:!0}}),h(Vu)}),rr);return()=>clearTimeout(e)}{let e=setTimeout((()=>w({shouldCallAuthOnSuccess:!0,isSuccess:!0})),rr);return y(),()=>clearTimeout(e)}}}),[i,a,C,s]);let _=C?`Successfully connected with ${A}`:k?k.message:`Verifying connection to ${A}`,S="";return S=C?"You’re good to go!":k?k.detail:"Just a few moments more",/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Js,{}),/*#__PURE__*/t(Mc,{}),/*#__PURE__*/e(rk,{children:[/*#__PURE__*/t(md,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(Tl,{success:C,fail:!!k}),/*#__PURE__*/t(I,{style:{width:"38px",height:"38px"}})]})}),/*#__PURE__*/e(Ec,{children:[/*#__PURE__*/t("h3",{children:_}),/*#__PURE__*/t("p",{children:S})]}),k&&k?.retryable?/*#__PURE__*/t(Ll,{onClick:()=>{Jr(),m(x),T(void 0)},disabled:!C&&!k?.retryable,children:"Retry"}):null]}),/*#__PURE__*/t(Pc,{}),/*#__PURE__*/t(Ks,{})]})}};let rk=/*#__PURE__*/bn.div.withConfig({displayName:"ConnectContainer",componentId:"sc-89bb91a9-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin-left:27px;margin-right:27px;gap:24px;"]);const ik=/*#__PURE__*/u(((a,r)=>{let[i,s]=o(""),[l,c]=o(""),[d,h]=o(!1),{authenticated:p,user:u}=rn(),{initUpdateEmail:m}=Ut(),{navigate:g,setModalData:y,currentScreen:f}=es(),{enabled:w,token:v}=_i(),C=Go(),b=hi(i)&&(C.disablePlusEmails&&i.includes("+")?(l||c("Please enter a valid email address without a '+'."),!1):(l&&c(""),!0)),k=d||!b,T=()=>{!w||v||p?(async e=>{if(!u?.email)throw Error("User is required to have an email address to update it.");h(!0);try{await m({oldAddress:u.email.address,newAddress:i,captchaToken:e}),g(ky)}catch(e){y({errorModalData:{error:e,previousScreen:f||of}})}h(!1)})(v):(y({captchaModalData:{callback:e=>{if(!u?.email)throw Error("User is required to have an email address to update it.");return m({oldAddress:u.email.address,newAddress:i,captchaToken:e})},userIntentRequired:!1,onSuccessNavigateTo:ky,onErrorNavigateTo:Cu}}),g(bm))};/*#__PURE__*/return e(n,{children:[/*#__PURE__*/e(ok,{children:[l&&/*#__PURE__*/t(rm,{style:{marginTop:"0.25rem",textAlign:"left"},children:l}),/*#__PURE__*/e(sk,{$error:!!l,children:[/*#__PURE__*/t(ea,{}),/*#__PURE__*/t("input",{ref:r,id:"email-input",type:"email",placeholder:"your@email.com",onChange:e=>s(e.target.value),onKeyUp:e=>{"Enter"===e.key&&T()},value:i,autoComplete:"email"}),a.stacked?null:/*#__PURE__*/t(Rl,{isSubmitting:d,onClick:T,disabled:k,children:"Submit"})]})]}),a.stacked?/*#__PURE__*/t(El,{loadingText:null,loading:d,disabled:k,onClick:T,children:"Submit"}):null]})}));let ok=lm,sk=om;const lk={component:()=>/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Js,{},"header"),/*#__PURE__*/t(Mc,{}),/*#__PURE__*/t(Mh,{title:"Update your email",description:"Add the email address you'd like to use going forward. We'll send you a confirmation code",icon:/*#__PURE__*/t(ea,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),/*#__PURE__*/t(Tc,{children:/*#__PURE__*/t(ik,{stacked:!0})}),/*#__PURE__*/t(Pc,{}),/*#__PURE__*/t(qs,{})]})},ck={component:()=>{let{currentScreen:a,data:r,navigate:i,setModalData:o}=es(),{user:s}=rn(),{initUpdatePhone:l}=Ut();/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{},"header"),/*#__PURE__*/t(Mc,{}),/*#__PURE__*/t(Mh,{title:"Update your phone number",description:"Add the phone number you'd like to use going forward. We'll send you a confirmation code",icon:/*#__PURE__*/t(Sn,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),/*#__PURE__*/t(Tc,{children:/*#__PURE__*/t(Gg,{stacked:!0,onSubmit:async function({qualifiedPhoneNumber:e}){try{if(!s?.phone?.number)throw Error("User is required to have an phone number to update it.");await l(s?.phone?.number,e),i(ky)}catch(e){o({errorModalData:{error:e,previousScreen:r?.errorModalData?.previousScreen||a||Lb}}),i(Cu)}},hideRecent:!0})}),/*#__PURE__*/t(Pc,{}),/*#__PURE__*/t(qs,{})]})}};function dk({subscribe:e,getExternalJwt:t,enabled:n=!0,onAuthenticated:a,onUnauthenticated:r,onError:s}){let{client:l,onCustomAuthAuthenticated:c}=Ut(),{logout:h,authenticated:p,ready:u}=$f();if(!l)throw new pe("`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(a);d((()=>{v.current=a}),[a]);let C=i(r);d((()=>{C.current=r}),[r]);let b=i(s);return d((()=>{b.current=s}),[s]),d((()=>{if(!n||!u)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 h(),C.current?.()),y.current=e,void g({status:"done"});l.startAuthFlow(new ds(e));let{user:t,isNewUser:n=!1}=await l.authenticate();if(!t)throw new pe("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 h().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,h,n,u]),n?{state:m}:{state:{status:"not-enabled"}}}let hk=Ln((()=>({jwtAuthFlowState:{status:"not-enabled"}})));const pk=()=>hk((e=>e.jwtAuthFlowState));function uk({customAuth:e}){let{jwtAuthFlowState:t}=function({customAuth:e}){let t=Ns(),n=i(),a=h((e=>(n.current=e,()=>{n.current=void 0})),[]),r=e?.getCustomAccessToken??(()=>Promise.resolve(void 0)),{state:o}=dk({enabled:!0===e?.enabled,subscribe:a,getExternalJwt:r,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((()=>{hk.setState({jwtAuthFlowState:t})}),[t]),null}const mk=/*#__PURE__*/c(!1);let gk,yk,fk,wk,vk,Ck,bk;function kk(){return gk?gk.getCustomerAccessToken():Promise.resolve(Ka.get(lr)||null)}async function Tk(){return gk?gk.getAccessToken():Promise.resolve(Ka.get(hr)||Ka.get(lr)||null)}const xk=(e,t)=>yk(e,t),Ak=(e,t)=>fk(e,t),Ik=(e,t)=>wk(e,t),_k=(e,t)=>vk(e,t),Sk=e=>Ck(e),Ek=e=>bk(e),Nk=({config:e,...n})=>{var a;if((()=>{if(l(mk))throw new pe("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)throw new pe("Embedded wallet is only available over HTTPS");if("string"!=typeof(a=n.appId)||25!==a.length)throw new pe("Cannot initialize the Privy provider with an invalid Privy app ID");gk||(gk=new bs({appId:n.appId,appClientId:n.clientId,apiUrl:n.apiUrl}));let r=Object.assign({},e),i=s((()=>new T({appId:n.appId,clientId:n.clientId,storage:Ka,baseUrl:n.apiUrl,sdkVersion:"react-auth:2.19.1"})),[]);/*#__PURE__*/
27
+ /*#__PURE__*/t(n,y?{children:/*#__PURE__*/e(Pb,{children:[/*#__PURE__*/t(md,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(Tl,{success:w,fail:!!p}),/*#__PURE__*/t(Sg,{style:{width:"38px",height:"38px"}})]})}),/*#__PURE__*/e(Ec,{children:[/*#__PURE__*/t(il,{children:p?p.message:"Add a signer to Farcaster"}),/*#__PURE__*/t(ol,{children:p?p.detail:"This will allow "+l.name+" to add casts, likes, follows, and more on your behalf."})]}),k&&/*#__PURE__*/t(El,{onClick:e=>{e.preventDefault(),window.location.href=k},children:"Open Farcaster app"})]})}:{children:/*#__PURE__*/e(Mb,{children:[/*#__PURE__*/t(md,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(Tl,{success:w,fail:!!p}),/*#__PURE__*/t(Sg,{style:{width:"38px",height:"38px"}})]})}),/*#__PURE__*/e(Ec,{children:[/*#__PURE__*/t(il,{children:p?p.message:"Requesting signer from Farcaster"}),/*#__PURE__*/t(ol,{children:p?p.detail:"This should only take a moment"}),/*#__PURE__*/t(xc,{children:k&&g&&/*#__PURE__*/t(Wg,{text:"Take me to Farcaster",url:k,color:Eb})})]})]})}),/*#__PURE__*/t(Ks,{})]}:{children:[/*#__PURE__*/t(Js,{backFn:a?r:void 0,onClose:h},"header"),/*#__PURE__*/t(Mc,{}),/*#__PURE__*/t(Mb,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(il,{children:"Add a signer to Farcaster"}),/*#__PURE__*/e(ol,{children:["This will allow ",l.name," to add casts, likes, follows, and more on your behalf."]}),/*#__PURE__*/t(Ic,{children:"pending_approval"===b?.status?/*#__PURE__*/t(am,{url:b.signer_approval_url,size:275,squareLogoElement:Sg}):/*#__PURE__*/t(xl,{})}),/*#__PURE__*/e(xc,{children:[/*#__PURE__*/t(ol,{children:"Or copy this link and paste it into a phone browser to open the Farcaster app."}),"pending_approval"===b?.status&&/*#__PURE__*/t(Mg,{text:b.signer_approval_url,itemName:"link",color:Eb})]})]})}),/*#__PURE__*/t(Ks,{})]})}};let Mb=/*#__PURE__*/bn.div.withConfig({displayName:"ConnectContainer",componentId:"sc-b12dfec-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin-left:27px;margin-right:27px;gap:24px;"]),Pb=/*#__PURE__*/bn.div.withConfig({displayName:"ConnectContainerButton",componentId:"sc-b12dfec-1"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;width:100%;"]);const Wb={component:()=>{let{closePrivyModal:a}=Ut();/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{},"header"),/*#__PURE__*/t(Ub,{children:/*#__PURE__*/t(ra,{style:{width:32,height:32}})}),/*#__PURE__*/t(Nh,{title:"Could not log in with provider",description:"It looks like you're using an in-app browser. To log in, please try again using an external browser.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),/*#__PURE__*/t(Tc,{children:/*#__PURE__*/t(El,{onClick:()=>a(),children:"Close"})}),/*#__PURE__*/t(Pc,{}),/*#__PURE__*/t(qs,{})]})}};let Ub=/*#__PURE__*/bn.div.withConfig({displayName:"StyledCircle",componentId:"sc-7bde5742-0"})(["border-radius:50%;height:68px;width:68px;display:flex;align-items:center;justify-content:center;background-color:var(--privy-color-accent);color:white;margin:0 auto 24px auto;"]);const Ob={component:()=>{let{app:a}=es();/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{},"header"),/*#__PURE__*/t(Mc,{}),/*#__PURE__*/t(Mh,{title:"Connect your email",description:`Add your email to your ${a?.name} account`,icon:/*#__PURE__*/t(ea,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),/*#__PURE__*/t(Tc,{children:/*#__PURE__*/t(Ny,{stacked:!0})}),/*#__PURE__*/t(Pc,{}),/*#__PURE__*/t(qs,{})]})}},Lb={component:()=>{let{app:a,currentScreen:r,data:i,navigate:o,setModalData:s}=es(),{initLoginWithSms:l}=Ut();/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{},"header"),/*#__PURE__*/t(Mc,{}),/*#__PURE__*/t(Mh,{title:"Connect your phone",description:`Add your number to your ${a?.name} account`,icon:/*#__PURE__*/t(Sn,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),/*#__PURE__*/t(Tc,{children:/*#__PURE__*/t(Gg,{stacked:!0,onSubmit:async function({qualifiedPhoneNumber:e}){try{await l({phoneNumber:e,withPrivyUi:!0}),o(ky)}catch(e){s({errorModalData:{error:e,previousScreen:i?.errorModalData?.previousScreen||r||Lb}}),o(Cu)}},hideRecent:!0})}),/*#__PURE__*/t(Pc,{}),/*#__PURE__*/t(qs,{})]})}},Rb=({style:n,...a})=>/*#__PURE__*/e("svg",{width:"164",height:"164",viewBox:"0 0 164 164",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...n},...a,children:[/*#__PURE__*/t("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),/*#__PURE__*/t("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M81.9999 100.788C93.3288 100.788 102.513 91.6043 102.513 80.2754C102.513 68.9465 93.3288 59.7626 81.9999 59.7626C70.671 59.7626 61.4871 68.9465 61.4871 80.2754C61.4871 91.6043 70.671 100.788 81.9999 100.788ZM88.3236 71.8304C88.9093 71.2446 89.8591 71.2446 90.4449 71.8304C91.0307 72.4161 91.0307 73.3659 90.4449 73.9517L84.121 80.2756L90.445 86.5996C91.0308 87.1854 91.0308 88.1351 90.445 88.7209C89.8592 89.3067 88.9095 89.3067 88.3237 88.7209L81.9997 82.3969L75.6756 88.7209C75.0899 89.3067 74.1401 89.3067 73.5543 88.7209C72.9685 88.1351 72.9685 87.1854 73.5543 86.5996L79.8783 80.2756L73.5544 73.9517C72.9686 73.3659 72.9686 72.4161 73.5544 71.8304C74.1402 71.2446 75.09 71.2446 75.6758 71.8304L81.9997 78.1543L88.3236 71.8304Z",fill:"#EC6351"})]}),Fb={component:()=>{let{closePrivyModal:a}=Ut(),{navigate:r}=es();/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{},"header"),/*#__PURE__*/t(Mc,{}),/*#__PURE__*/t(Rb,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),/*#__PURE__*/t(Nh,{title:"Could not connect with wallet",description:"Please check that Phantom multichain is enabled and try again.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),/*#__PURE__*/e(Tc,{children:[/*#__PURE__*/t(El,{onClick:()=>r(of),children:"Try again"}),/*#__PURE__*/t(Ul,{onClick:()=>a(),children:"Cancel"})]}),/*#__PURE__*/t(Pc,{}),/*#__PURE__*/t(qs,{})]})}};function Db(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:n,submitEnrollmentWithSms:a,submitEnrollmentWithTotp:r,submitEnrollmentWithPasskey:i,unenroll:o,enrollInMfa:s}=l(on);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:n,submitEnrollmentWithSms:a,submitEnrollmentWithTotp:r,submitEnrollmentWithPasskey:i,unenrollWithSms:()=>o("sms"),unenrollWithTotp:()=>o("totp"),unenrollWithPasskey:e=>o("passkey",e),showMfaEnrollmentModal:()=>s(!0),closeMfaEnrollmentModal:()=>s(!1)}}const Bb=n=>/*#__PURE__*/e(zb,{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 zb=/*#__PURE__*/bn.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 $b=({showIntro:a,userMfaMethods:r,appMfaMethods:i,userHasAuthSms:o,isTotpLoading:s,isPasskeyLoading:l,error:c,onClose:d,onBackToIntro:h,handleSelectMethod:p,setRemovingMfaMethod:u})=>{let m=r.reduce(((e,t)=>({...e,[t]:!0})),{}),g=i.reduce(((e,t)=>({...e,[t]:!0})),{});/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{backFn:a?h:void 0,onClose:d},"header"),/*#__PURE__*/t(Cl,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(En,{})}),/*#__PURE__*/t(il,{children:"Choose a verification method"}),r.length>0?/*#__PURE__*/t(ol,{children:"To add or delete verification methods, verification is required."}):/*#__PURE__*/t(ol,{children:"How would you like to verify your identity?"}),c&&/*#__PURE__*/t(bl,{style:{marginTop:"1.25rem"},children:c.message}),/*#__PURE__*/e(pl,{children:[(g.passkey||m.passkey)&&/*#__PURE__*/e(ul,{children:[/*#__PURE__*/t(Fs,{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(fl,{children:[/*#__PURE__*/e(gl,{children:[/*#__PURE__*/t(_n,{}),"Passkey"]}),m.passkey?/*#__PURE__*/t(jb,{color:"green",children:"Enabled"}):/*#__PURE__*/t(yl,{$isAccent:!0,children:/*#__PURE__*/t(ma,{})})]})}),m.passkey&&/*#__PURE__*/t(ml,{style:{position:"absolute",right:0},onClick:()=>u("passkey"),children:/*#__PURE__*/t(Fa,{})})]},"passkey"),(g.totp||m.totp)&&/*#__PURE__*/e(ul,{children:[/*#__PURE__*/t(Fs,{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(fl,{children:[/*#__PURE__*/e(gl,{children:[/*#__PURE__*/t(In,{}),"Authenticator app"]}),m.totp&&/*#__PURE__*/t(jb,{color:"green",children:"Enabled"})]})}),m.totp&&/*#__PURE__*/t(ml,{style:{position:"absolute",right:0},onClick:()=>u("totp"),children:/*#__PURE__*/t(Fa,{})})]},"totp"),(g.sms||m.sms)&&/*#__PURE__*/e(ul,{children:[/*#__PURE__*/t(Fs,{disabled:m.sms||o,onClick:()=>p("sms"),children:/*#__PURE__*/e(fl,{children:[/*#__PURE__*/e(gl,{children:[/*#__PURE__*/t(Sn,{}),"SMS"]}),m.sms&&/*#__PURE__*/t(jb,{color:"green",children:"Enabled"}),o&&/*#__PURE__*/t(yl,{children:"Disabled"})]})}),m.sms&&/*#__PURE__*/t(ml,{style:{position:"absolute",right:0},onClick:()=>u("sms"),children:/*#__PURE__*/t(Fa,{})})]},"sms")]}),/*#__PURE__*/t(Vb,{children:"You can always change your selection later"}),/*#__PURE__*/t(Ks,{})]})};let jb=/*#__PURE__*/bn(Ig).withConfig({displayName:"StyledChip",componentId:"sc-24f8b314-0"})(["margin-right:1.5rem;"]),Vb=/*#__PURE__*/bn(wl).withConfig({displayName:"StyledTerms",componentId:"sc-24f8b314-1"})(["&&{margin-top:1rem;}text-align:center;"]);const Hb=({onClose:e,onReset:n,submitEnrollmentWithPasskey:a})=>{let{user:r}=rn(),{initLinkWithPasskey:i,linkWithPasskey:l}=Ut(),[c,d]=o(!1),[h,p]=o(!1),[u,m]=o(null),g=s((()=>r?.linkedAccounts.filter((e=>"passkey"===e.type))??[]),[r]),y=async e=>{d(!0);try{await a(e)}catch(e){m(e)}finally{d(!1)}},f=async()=>{p(!0),m(null);try{await i();let e=await l(),t=e?.linkedAccounts.filter((e=>"passkey"===e.type)).map((e=>e.credentialId))??[];await y(t)}catch(e){m(e)}finally{p(!1)}};return 0===g.length||h?/*#__PURE__*/t(qb,{onReset:n,onClose:e,onClick:f,isCreating:h}):u?/*#__PURE__*/t(bu,{error:u,backFn:()=>m(null),onClick:()=>m(null)}):/*#__PURE__*/t(Kb,{passkeys:g,isSubmitting:c,isCreating:h,onReset:n,onClose:e,onSubmitEnrollment:()=>y(g.map((e=>e.credentialId))),onAddPasskey:f})};let qb=({onReset:a,onClose:r,onClick:i,isCreating:o})=>/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Js,{backFn:a,onClose:r},"header"),/*#__PURE__*/t(rl,{children:/*#__PURE__*/e(Ww,{children:[/*#__PURE__*/t(gd,{}),/*#__PURE__*/t(zg,{})]})}),/*#__PURE__*/t(il,{children:"Set up passkey verification"}),/*#__PURE__*/e(ll,{children:[/*#__PURE__*/e(dl,{children:[/*#__PURE__*/t(cl,{children:/*#__PURE__*/t(En,{})}),"Verify with Touch ID, Face ID, PIN, or hardware key"]}),/*#__PURE__*/e(dl,{children:[/*#__PURE__*/t(cl,{children:/*#__PURE__*/t(Ua,{})}),"Takes seconds to set up and use"]}),/*#__PURE__*/e(dl,{children:[/*#__PURE__*/t(cl,{children:/*#__PURE__*/t(Da,{})}),"Use your passkey to verify transactions and login to your account"]})]}),/*#__PURE__*/t(El,{style:{marginTop:"2.25rem"},onClick:i,loading:o,children:"Add a new passkey"}),/*#__PURE__*/t(Ks,{})]}),Kb=({onReset:a,onClose:r,onAddPasskey:i,onSubmitEnrollment:s,passkeys:l,isSubmitting:c,isCreating:d})=>{let[h,p]=o(!1),u=h?l.length:l.length>3?2:3;/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{backFn:h?()=>p(!1):a,onClose:r},"header"),!h&&/*#__PURE__*/t(rl,{children:/*#__PURE__*/e(Ww,{children:[/*#__PURE__*/t(gd,{}),/*#__PURE__*/t(zg,{})]})}),/*#__PURE__*/t(il,{children:"Enable your passkeys for verification"}),/*#__PURE__*/e(ll,{children:[l.slice(0,u).map((n=>/*#__PURE__*/e(Zb,{children:[/*#__PURE__*/t(Yb,{children:Jb(n)}),/*#__PURE__*/e(Gb,{children:["Last used: ",n.latestVerifiedAt?.toLocaleString()]})]},n.credentialId))),!h&&l.length>3&&/*#__PURE__*/t(Qb,{onClick:()=>p(!0),children:"View All"})]}),/*#__PURE__*/t(El,{style:{marginTop:"1.5rem"},onClick:s,loading:c,children:"Enable passkeys"}),l.length<5&&/*#__PURE__*/t(Qb,{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(Ks,{})]})},Zb=/*#__PURE__*/bn.div.withConfig({displayName:"PasskeyItem",componentId:"sc-bae3649d-0"})(["&&{padding:0.75rem 1rem;text-align:left;border-radius:0.5rem;border:1px solid var(--privy-color-foreground-4);width:100%;}"]),Yb=/*#__PURE__*/bn.div.withConfig({displayName:"PasskeyItemTitle",componentId:"sc-bae3649d-1"})(["font-size:0.875rem;line-height:1.375rem;font-weight:500;color:var(--privy-color-foreground-1);"]),Gb=/*#__PURE__*/bn.div.withConfig({displayName:"PasskeyItemSubtitle",componentId:"sc-bae3649d-2"})(["font-size:0.75rem;font-weight:400;line-height:1.125rem;color:var(--privy-color-foreground-2);"]),Jb=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 Qb=/*#__PURE__*/bn.button.withConfig({displayName:"StyledLink",componentId:"sc-bae3649d-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;}}"]),Xb=({appName:a,onComplete:r,onReset:i,onClose:s})=>{let[l,c]=o(""),[d,h]=o(!1),[p,u]=o(null),[m,g]=o("enroll"),{initEnrollmentWithSms:y,submitEnrollmentWithSms:f}=Db(),{app:w,data:v}=es();function C(){v?.mfaEnrollmentFlow?.onSuccess(),r()}return p?/*#__PURE__*/t(bu,{error:p,backFn:()=>u(null),onClick:()=>u(null)}):/*#__PURE__*/e(n,"enroll"===m?{children:[/*#__PURE__*/t(Js,{backFn:i,onClose:s},"header"),/*#__PURE__*/t(Cl,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(Sn,{})}),/*#__PURE__*/t(il,{children:"Set up SMS verification"}),/*#__PURE__*/e(ol,{children:["We'll text a verification code to this mobile device whenever you use your ",a," ","wallet."]}),/*#__PURE__*/e(sl,{children:[/*#__PURE__*/t(Gg,{onSubmit:async function({qualifiedPhoneNumber:e}){try{await y({phoneNumber:e}),c(e),g("verify")}catch(e){u(e)}},hideRecent:!0}),/*#__PURE__*/e(wl,{children:["By providing your mobile number, you agree to receive text messages from ",w?.name,". Some carrier charges may apply"]})]}),/*#__PURE__*/t(Ks,{})]}:d?{children:[/*#__PURE__*/t(Js,{onClose:C},"header"),/*#__PURE__*/t(Cl,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(Aa,{})}),/*#__PURE__*/t(il,{children:"SMS verification added"}),/*#__PURE__*/e(ol,{children:["From now on, you'll enter the verification code sent to your mobile device whenever you use your ",a," wallet."]}),/*#__PURE__*/t(hl,{children:/*#__PURE__*/t(El,{onClick:C,children:"Done"})}),/*#__PURE__*/t(Ks,{})]}:{children:[/*#__PURE__*/t(Js,{backFn:function(){"verify"===m?g("enroll"):i()},onClose:s},"header"),/*#__PURE__*/t(Cl,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(Sn,{})}),/*#__PURE__*/t(il,{children:"Enter enrollment code"}),/*#__PURE__*/e(sl,{children:[/*#__PURE__*/t(kd,{onChange:async function(e){try{if(!e)return;await f({phoneNumber:l,mfaCode:e}),h(!0)}catch(e){if(Wd(e))throw Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.");if(Md(e))throw Error("The code you entered is not valid");if(Nd(e))throw Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.");throw Ud(e)?Error("Verification canceled"):Error("Unknown error")}}}),/*#__PURE__*/e(ol,{children:["To continue, enter the 6-digit code sent to ",/*#__PURE__*/t("strong",{children:he(l)})]})]}),/*#__PURE__*/t(Ks,{})]})},ek=({size:e,authUrl:n})=>/*#__PURE__*/t(am,{url:n,squareLogoElement:Ba,size:e,fgColor:"#1F1F1F"}),tk=({onClose:a,onReset:r,totpInfo:i,submitEnrollmentWithTotp:s,error:l})=>{let[c,d]=o("enroll");/*#__PURE__*/return e(n,"enroll"===c?{children:[/*#__PURE__*/t(Js,{backFn:r,onClose:a},"header"),/*#__PURE__*/t(yf,{children:"Scan QR code"}),/*#__PURE__*/t(cm,{children:"Open your authenticator app and scan this code to continue"}),/*#__PURE__*/t(Ic,{children:/*#__PURE__*/t(ek,{authUrl:i.authUrl,size:240})}),/*#__PURE__*/t(xf,{style:{textAlign:"left"},children:"Setup key"}),/*#__PURE__*/e(If,{style:{marginTop:"0.25rem"},children:[/*#__PURE__*/t(Tf,{children:"•".repeat(16)}),/*#__PURE__*/t(Mg,{itemName:" ",text:i.secret})]}),/*#__PURE__*/t(El,{style:{marginTop:"1rem"},onClick:function(){d("verify")},children:"Continue"}),/*#__PURE__*/t(Ks,{})]}:{children:[/*#__PURE__*/t(Js,{backFn:function(){"verify"===c?d("enroll"):r()},onClose:a},"header"),/*#__PURE__*/t(Cl,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(In,{})}),/*#__PURE__*/t(yf,{children:"Enter enrollment code"}),/*#__PURE__*/t(cm,{children:"To continue, enter the 6-digit code generated from your authenticator app"}),/*#__PURE__*/t(sl,{children:/*#__PURE__*/t(kd,{onChange:async function(e){try{if(!e)return;await s({mfaCode:e})}catch(e){if(Wd(e))throw Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.");if(Md(e))throw Error("The code you entered is not valid");if(Nd(e))throw Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.");throw Ud(e)?Error("Verification canceled"):Error("Unknown error")}},errorReasonOverride:l?.message})}),/*#__PURE__*/t(Ks,{})]})},nk={component:()=>{let{user:a,enrollInMfa:r,ready:i}=rn(),[s,l]=o(null),{unenrollWithSms:c,unenrollWithTotp:h,unenrollWithPasskey:p,submitEnrollmentWithTotp:u,initEnrollmentWithPasskey:m,submitEnrollmentWithPasskey:g,initEnrollmentWithTotp:y}=Db(),{app:f,data:w,onUserCloseViaDialogOrKeybindRef:v}=es(),{closePrivyModal:C}=Ut(),{promptMfa:b}=Rd(),[k,T]=o(!1),[x,A]=o(null),[I,_]=o(null),S=()=>{C({shouldCallAuthOnSuccess:!0}),r(!1),setTimeout((()=>{l(null),A(null)}),500)},[E,N]=o(!1),[M,P]=o();v.current=S;let W=a?.mfaMethods.includes("sms"),U=!!a?.phone,O=a?.mfaMethods.includes("totp"),L=a?.mfaMethods.includes("passkey"),R=W||O||L,F=a?.linkedAccounts.filter((e=>"passkey"===e.type)).map((e=>e.credentialId))??[];function D(){l(null),A(null)}async function B(e=F){N(!0);try{return await m(),await g({credentialIds:e},{removeForLogin:w?.mfaEnrollmentFlow?.shouldUnlinkOnUnenrollMfa}),w?.mfaEnrollmentFlow?.onSuccess(),S()}catch(e){P(e)}finally{N(!1)}}if(d((()=>{R&&T(!0)}),[R]),!i||!a||!f/*#__PURE__*/)return e(n,{children:[/*#__PURE__*/t(Js,{onClose:S},"header"),/*#__PURE__*/t(rl,{children:/*#__PURE__*/t(Bb,{})}),/*#__PURE__*/t(sl,{children:/*#__PURE__*/t(xl,{})}),/*#__PURE__*/t(Ks,{})]});if("sms"===s)/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{backFn:D,onClose:S},"header"),/*#__PURE__*/t(Cl,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(Mn,{})}),/*#__PURE__*/t(il,{children:"Remove SMS verification?"}),/*#__PURE__*/e(ol,{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(hl,{children:/*#__PURE__*/t(El,{$warn:!0,onClick:async function(){l(null);try{await c()}catch(e){l(null)}},children:"Remove"})}),/*#__PURE__*/t(Ks,{})]});if("totp"===s)/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{backFn:D,onClose:S},"header"),/*#__PURE__*/t(Cl,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(Mn,{})}),/*#__PURE__*/t(il,{children:"Remove authenticator app verification?"}),/*#__PURE__*/e(ol,{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(hl,{children:/*#__PURE__*/t(El,{$warn:!0,onClick:async function(){l(null);try{await h()}catch(e){l(null)}},children:"Remove"})}),/*#__PURE__*/t(Ks,{})]});if("passkey"===s){let a=w?.mfaEnrollmentFlow?.shouldUnlinkOnUnenrollMfa??!0;/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{backFn:D,onClose:S},"header"),/*#__PURE__*/t(Cl,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(Mn,{})}),/*#__PURE__*/t(il,{children:"Are you sure you want to remove this passkey?"}),/*#__PURE__*/t(ol,{children:a?"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(hl,{children:/*#__PURE__*/t(El,{$warn:!0,onClick:async function(){l(null);try{await p({removeForLogin:w?.mfaEnrollmentFlow?.shouldUnlinkOnUnenrollMfa})}catch(e){l(null)}},children:"Remove"})}),/*#__PURE__*/t(Ks,{})]})}if(0===w.mfaEnrollmentFlow.mfaMethods.length&&!R)/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{onClose:S},"header"),/*#__PURE__*/t(Cl,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(En,{})}),/*#__PURE__*/t(il,{children:"Add more security"}),/*#__PURE__*/e(ol,{children:[f?.name," does not have any verification methods enabled."]}),/*#__PURE__*/t(hl,{children:/*#__PURE__*/t(El,{onClick:S,children:"Close"})}),/*#__PURE__*/t(Ks,{})]});let z=!R&&!k;return z?/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Js,{onClose:S},"header"),/*#__PURE__*/t(Cl,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(En,{})}),/*#__PURE__*/t(il,{children:"Transaction Protection"}),/*#__PURE__*/t(ol,{children:"Set up transaction protection to add an extra layer of security to your account"}),/*#__PURE__*/e(ll,{children:[/*#__PURE__*/e(dl,{children:[/*#__PURE__*/t(cl,{children:/*#__PURE__*/t(La,{})}),"Enable 2-Step verification for your ",f?.name," wallet."]}),/*#__PURE__*/e(dl,{children:[/*#__PURE__*/t(cl,{children:/*#__PURE__*/t(Ra,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),/*#__PURE__*/e(hl,{children:[/*#__PURE__*/t(El,{onClick:()=>T(!0),children:"Continue"}),/*#__PURE__*/t(Ul,{onClick:S,children:"Not now"})]}),/*#__PURE__*/t(Ks,{})]}):"sms"===x?/*#__PURE__*/t(Xb,{appName:f?.name||"Privy",onComplete:S,onReset:D,onClose:S}):"totp"===x&&I?/*#__PURE__*/t(tk,{onClose:S,onReset:D,submitEnrollmentWithTotp:({mfaCode:e})=>async function(e){try{return P(void 0),await u({mfaCode:e}),w?.mfaEnrollmentFlow?.onSuccess(),S()}catch(e){P(e)}finally{l(null)}}(e),totpInfo:{...I,appName:f?.name||"Privy"}}):"passkey"===x?/*#__PURE__*/t(Hb,{onReset:D,onClose:S,submitEnrollmentWithPasskey:B}):/*#__PURE__*/t($b,{showIntro:z,userMfaMethods:a.mfaMethods,appMfaMethods:f.mfa.methods,userHasAuthSms:U,onBackToIntro:function(){T(!1)},handleSelectMethod:async function(e){try{await b()}catch(e){return void P(e)}return"totp"===e?(A(e),_(null),void y().then((e=>{_(e)})).catch((()=>{_(null),D()}))):"passkey"===e&&1===F.length?await B():void A(e)},isTotpLoading:"totp"===x&&!I,isPasskeyLoading:E,error:M,onClose:S,setRemovingMfaMethod:async e=>{try{await b()}catch(e){return void P(e)}l(e)}})}},ak={component:()=>{let{authenticated:a,logout:r,ready:i,user:s}=rn(),{app:l,setModalData:c,navigate:h,resetNavigation:p}=es(),{getAuthMeta:u,initLoginWithOAuth:m,loginWithOAuth:g,updateWallets:y,setReadyToTrue:f,closePrivyModal:w,createAnalyticsEvent:v}=Ut(),[C,b]=o(!1),[k,T]=o(void 0),x=u()?.provider||"google",{name:A,component:I}=Yr(x);d((()=>{g(x).then((()=>{b(!0),f(!0)})).catch((e=>{if(f(!1),e?.privyErrorCode===Te.ALLOWLIST_REJECTED)return T(void 0),p(),void h(ym);if(e?.privyErrorCode===Te.USER_LIMIT_REACHED)return console.error(new Et(e).toString()),T(void 0),p(),void h(Pm);if(e?.privyErrorCode===Te.USER_DOES_NOT_EXIST)return T(void 0),p(),void h(ou);if(e?.privyErrorCode===Te.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return T(void 0),p(),c({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 h(Lu);let{retryable:t,detail:n}=function(e,t){let n={detail:"",retryable:!1},a=Lr(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 ${a} 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=Yr(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=Yr(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,x);T({retryable:t,detail:n,message:"Authentication failed"})})).finally((()=>{Jr()}))}),[A,x]),d((()=>{if(i&&a&&C&&s){if(l?.legal.requireUsersAcceptTerms&&!s.hasAcceptedTerms){let e=setTimeout((()=>{h(qu)}),rr);return()=>clearTimeout(e)}if(ru(s,l.embeddedWallets)){let e=setTimeout((()=>{c({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),v({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,provider:x,screen:"OAuthStatusScreen"}}),r()},callAuthOnSuccessOnClose:!0}}),h(Vu)}),rr);return()=>clearTimeout(e)}{let e=setTimeout((()=>w({shouldCallAuthOnSuccess:!0,isSuccess:!0})),rr);return y(),()=>clearTimeout(e)}}}),[i,a,C,s]);let _=C?`Successfully connected with ${A}`:k?k.message:`Verifying connection to ${A}`,S="";return S=C?"You’re good to go!":k?k.detail:"Just a few moments more",/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Js,{}),/*#__PURE__*/t(Mc,{}),/*#__PURE__*/e(rk,{children:[/*#__PURE__*/t(md,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(Tl,{success:C,fail:!!k}),/*#__PURE__*/t(I,{style:{width:"38px",height:"38px"}})]})}),/*#__PURE__*/e(Ec,{children:[/*#__PURE__*/t("h3",{children:_}),/*#__PURE__*/t("p",{children:S})]}),k&&k?.retryable?/*#__PURE__*/t(Ll,{onClick:()=>{Jr(),m(x),T(void 0)},disabled:!C&&!k?.retryable,children:"Retry"}):null]}),/*#__PURE__*/t(Pc,{}),/*#__PURE__*/t(Ks,{})]})}};let rk=/*#__PURE__*/bn.div.withConfig({displayName:"ConnectContainer",componentId:"sc-89bb91a9-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin-left:27px;margin-right:27px;gap:24px;"]);const ik=/*#__PURE__*/u(((a,r)=>{let[i,s]=o(""),[l,c]=o(""),[d,h]=o(!1),{authenticated:p,user:u}=rn(),{initUpdateEmail:m}=Ut(),{navigate:g,setModalData:y,currentScreen:f}=es(),{enabled:w,token:v}=_i(),C=Go(),b=hi(i)&&(C.disablePlusEmails&&i.includes("+")?(l||c("Please enter a valid email address without a '+'."),!1):(l&&c(""),!0)),k=d||!b,T=()=>{!w||v||p?(async e=>{if(!u?.email)throw Error("User is required to have an email address to update it.");h(!0);try{await m({oldAddress:u.email.address,newAddress:i,captchaToken:e}),g(ky)}catch(e){y({errorModalData:{error:e,previousScreen:f||of}})}h(!1)})(v):(y({captchaModalData:{callback:e=>{if(!u?.email)throw Error("User is required to have an email address to update it.");return m({oldAddress:u.email.address,newAddress:i,captchaToken:e})},userIntentRequired:!1,onSuccessNavigateTo:ky,onErrorNavigateTo:Cu}}),g(bm))};/*#__PURE__*/return e(n,{children:[/*#__PURE__*/e(ok,{children:[l&&/*#__PURE__*/t(rm,{style:{marginTop:"0.25rem",textAlign:"left"},children:l}),/*#__PURE__*/e(sk,{$error:!!l,children:[/*#__PURE__*/t(ea,{}),/*#__PURE__*/t("input",{ref:r,id:"email-input",type:"email",placeholder:"your@email.com",onChange:e=>s(e.target.value),onKeyUp:e=>{"Enter"===e.key&&T()},value:i,autoComplete:"email"}),a.stacked?null:/*#__PURE__*/t(Rl,{isSubmitting:d,onClick:T,disabled:k,children:"Submit"})]})]}),a.stacked?/*#__PURE__*/t(El,{loadingText:null,loading:d,disabled:k,onClick:T,children:"Submit"}):null]})}));let ok=lm,sk=om;const lk={component:()=>/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Js,{},"header"),/*#__PURE__*/t(Mc,{}),/*#__PURE__*/t(Mh,{title:"Update your email",description:"Add the email address you'd like to use going forward. We'll send you a confirmation code",icon:/*#__PURE__*/t(ea,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),/*#__PURE__*/t(Tc,{children:/*#__PURE__*/t(ik,{stacked:!0})}),/*#__PURE__*/t(Pc,{}),/*#__PURE__*/t(qs,{})]})},ck={component:()=>{let{currentScreen:a,data:r,navigate:i,setModalData:o}=es(),{user:s}=rn(),{initUpdatePhone:l}=Ut();/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Js,{},"header"),/*#__PURE__*/t(Mc,{}),/*#__PURE__*/t(Mh,{title:"Update your phone number",description:"Add the phone number you'd like to use going forward. We'll send you a confirmation code",icon:/*#__PURE__*/t(Sn,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),/*#__PURE__*/t(Tc,{children:/*#__PURE__*/t(Gg,{stacked:!0,onSubmit:async function({qualifiedPhoneNumber:e}){try{if(!s?.phone?.number)throw Error("User is required to have an phone number to update it.");await l(s?.phone?.number,e),i(ky)}catch(e){o({errorModalData:{error:e,previousScreen:r?.errorModalData?.previousScreen||a||Lb}}),i(Cu)}},hideRecent:!0})}),/*#__PURE__*/t(Pc,{}),/*#__PURE__*/t(qs,{})]})}};function dk({subscribe:e,getExternalJwt:t,enabled:n=!0,onAuthenticated:a,onUnauthenticated:r,onError:s}){let{client:l,onCustomAuthAuthenticated:c}=Ut(),{logout:h,authenticated:p,ready:u}=$f();if(!l)throw new pe("`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(a);d((()=>{v.current=a}),[a]);let C=i(r);d((()=>{C.current=r}),[r]);let b=i(s);return d((()=>{b.current=s}),[s]),d((()=>{if(!n||!u)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 h(),C.current?.()),y.current=e,void g({status:"done"});l.startAuthFlow(new ds(e));let{user:t,isNewUser:n=!1}=await l.authenticate();if(!t)throw new pe("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 h().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,h,n,u]),n?{state:m}:{state:{status:"not-enabled"}}}let hk=Ln((()=>({jwtAuthFlowState:{status:"not-enabled"}})));const pk=()=>hk((e=>e.jwtAuthFlowState));function uk({customAuth:e}){let{jwtAuthFlowState:t}=function({customAuth:e}){let t=Ns(),n=i(),a=h((e=>(n.current=e,()=>{n.current=void 0})),[]),r=e?.getCustomAccessToken??(()=>Promise.resolve(void 0)),{state:o}=dk({enabled:!0===e?.enabled,subscribe:a,getExternalJwt:r,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((()=>{hk.setState({jwtAuthFlowState:t})}),[t]),null}const mk=/*#__PURE__*/c(!1);let gk,yk,fk,wk,vk,Ck,bk;function kk(){return gk?gk.getCustomerAccessToken():Promise.resolve(Ka.get(lr)||null)}async function Tk(){return gk?gk.getAccessToken():Promise.resolve(Ka.get(hr)||Ka.get(lr)||null)}const xk=(e,t)=>yk(e,t),Ak=(e,t)=>fk(e,t),Ik=(e,t)=>wk(e,t),_k=(e,t)=>vk(e,t),Sk=e=>Ck(e),Ek=e=>bk(e),Nk=({config:e,...n})=>{var a;if((()=>{if(l(mk))throw new pe("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)throw new pe("Embedded wallet is only available over HTTPS");if("string"!=typeof(a=n.appId)||25!==a.length)throw new pe("Cannot initialize the Privy provider with an invalid Privy app ID");gk||(gk=new bs({appId:n.appId,appClientId:n.clientId,apiUrl:n.apiUrl}));let r=Object.assign({},e),i=s((()=>new T({appId:n.appId,clientId:n.clientId,storage:Ka,baseUrl:n.apiUrl,sdkVersion:"react-auth:2.19.3"})),[]);/*#__PURE__*/
28
28
  return t(Yo,{client:i,legacyClient:gk,clientConfig:r,children:/*#__PURE__*/t(pm,{children:/*#__PURE__*/t(Mk,{...n,client:gk,privy:i})})})};let Mk=n=>{let r=n.client,l=n.privy,c=mm();wh();let[p,u]=o(!1),[m,g]=o(!1),[y,f]=o(!1),[T,x]=o(null),[A,_]=o([]),[S,E]=o([]),[N,M]=o(void 0),[P,W]=o(!1),[U,O]=o(null),[L,R]=o(!1),[F,D]=o({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:Pt}),[B,z]=o({status:"initial"}),[$,j]=o({status:"initial"}),[V,H]=o({status:"initial"}),[q,K]=o({status:"initial"}),[Z,Y]=o({status:"initial"}),[G,J]=o({status:"initial"}),[Q,X]=o(null),ee=Go(),te=Jo(),[ne,ae]=o({}),[re,ie]=o(null),oe=i(null),[se,le]=o(!1),[ce,de]=o(!1),he=i(null),ue=i(null),ge=i(As),[ye,fe]=o(!1);r.onStoreCustomerAccessToken=e=>{e&&Es(ge,"accessToken","onAccessTokenGranted",{accessToken:e})},r.onDeleteCustomerAccessToken=()=>{x(null),f(!1),Es(ge,"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=>{O(e),setTimeout((()=>{u(!0)}),15)};d((()=>{if(!T)return void r.connectors?.removeEmbeddedWalletConnectors();let e=ln(T),t=mn(T),a=hn(T);e&&t.length||r.connectors?.removeEmbeddedWalletConnectors(),a||r.connectors?.removeImportedWalletConnector(),r.connectors?Q?(e&&r.connectors.addEmbeddedWalletConnectors({walletProxy:Q,user:T,embeddedWallets:t,defaultChain:ee.defaultChain,appId:n.appId,privyClient:l}),a&&r.connectors.addImportedWalletConnector(Q,a.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")}),[Q,T]),d((()=>{Q&&oe.current?.(Q)}),[Q]);let xe=h(((e,t)=>{x(e),W(t),f(!0),de(!0)}),[]);d((()=>{ce&&Q&&T&&(async()=>{let e=eu(T,ee.embeddedWallets.ethereum.createOnLogin),t=nu(T,ee.embeddedWallets.solana.createOnLogin),n=await Tk();if(n){if(e&&t){let e=await Q.create({accessToken:n});return await Q.createSolana({accessToken:n,ethereumAddress:e?.address}),void de(!1)}if(t)return await Q.createSolana({accessToken:n,ethereumAddress:ln(T)?.address}),await qe.refreshSessionAndUser(),void de(!1);if(e)return await Q.create({accessToken:n}),void de(!1)}})().catch(console.error)}),[ce&&Q&&T]),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=Ie(),n=_e(),i=a();r.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}),r.connectors?.on("connectorInitialized",(()=>{e&&clearTimeout(e);let t=r.connectors.walletConnectors.length,n=r.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)})),r.connectors?.initialize().then((()=>{Pe()}));let o=await r.getAuthenticatedUser(),s=!!o;ee.legal.requireUsersAcceptTerms&&o&&!o.hasAcceptedTerms?(await r.logout(),qe.setReadyToTrue(!0),Es(ge,"logout","onSuccess")):(ee.customAuth?.enabled||(f(!!o),o&&Es(ge,"login","onComplete",{user:o,isNewUser:!1,wasAlreadyAuthenticated:!0,loginMethod:null,loginAccount:null}),x(o)),t?ve.current=s?"link":"login":n&&!s?(ve.current="login",ae({telegramAuthModalData:{seamlessAuth:!0}}),ke(ry)):qe.setReadyToTrue(!!o))}()}),[r,re,m,te]),d((()=>{if(m){if(!T||!T.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType)))return void le(!!Q);if([...A].some((e=>"privy"===e.walletClientType)))return void le(!0);le(!!Q)}}),[m,T,A,Q]),d((()=>{r.connectors?.setWalletList(ee.appearance.walletList)}),[ee.appearance.walletList.join()]);let Ie=()=>{let e=Gr();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(Ch).postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:e.stateCode,authorizationCode:e.authorizationCode}),window.close()),!!e.inProgress&&!!e.withPrivyUi&&(r.startAuthFlow(new Or(e)),ke(ak),!0))},_e=()=>{let e=function(){let e;return(e=function(){let e=new URLSearchParams(window.location.search),t=Number(e.get("id")||""),n=e.get("hash"),a=Number(e.get("auth_date")||""),r=e.get("first_name");if(t&&r&&a&&n)return Object.fromEntries(e.entries())}())?(Mi(),{flowType:"login-url",authData:e}):(e=function(){let e=window.location.hash;if(!e||!e.startsWith("#tgWebAppData"))return;let t=Ni(e.replace("#tgWebAppData=","")),{user:n,auth_date:a,hash:r}=t;return n&&a&&r?t:void 0}())?(Mi(),{flowType:"web-app",authData:e}):void 0}();if(!e||!ee.loginMethods.telegram||!ee.loginConfig.telegramAuthConfiguration?.seamlessAuthEnabled)return;let t=new Si;return r.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,a)=>{if("solana_adapter"!==e)Ee(await(r.connectors?.createEthereumWalletConnector({connectorType:e,walletClientType:t}))||null,t,n,a);else{let e=r.connectors?.findSolanaWalletConnector(t);if(!e)return;Ee(e,t,n,a)}};async function Ee(e,t,n,a){if(!e)return D({status:"disconnected",connectedWallet:null,connectError:new Le("Unable to connect to wallet."),connector:null,connectRetry:Pt}),a?.(null,n);D({status:"disconnected",connectedWallet:null,connectError:null,connector:e,connectRetry:Pt}),e instanceof ns&&t&&await e.resetConnection(t),D({connector:e,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>Ee(e,t,n,a)});try{let t=await e.connect({showPrompt:!0});if((!t||Vi(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=Ci(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&&Es(ge,"connectWallet","onSuccess",{wallet:t}),a?.(t,n)}catch(e){return e instanceof Re?(console.warn(e.cause?e.cause:e.message),Es(ge,"connectWallet","onError",e.privyErrorCode||Te.GENERIC_CONNECT_WALLET_ERROR)):(console.warn(e),Es(ge,"connectWallet","onError",Te.UNKNOWN_CONNECT_WALLET_ERROR)),D((t=>({...t,status:"disconnected",connectedWallet:null,connectError:e}))),a?.(null,n)}}let Ne=async(e,t,n)=>{if(null===e||!Vi(e))return;let a=new ei(r,e,t,n);r.startAuthFlow(a)},Me=async(e,t,n,a="plain")=>{let i=c(gm);if("transaction"===a&&!i)throw new pe("useSolanaLedger plugin hook must be mounted");if(null===e||!Ao(e))return;let o=new ai(e,r,t,n,a,i?{deserializeTransactionFromB64String:i.deserializeTransactionFromB64String,prepareSiwsTransactionWithMemo:i.prepareSiwsTransactionWithMemo}:void 0);r.startAuthFlow(o)},Pe=()=>{let e=new URLSearchParams(window.location.search),t=e.get("privy_connector"),n=e.get("privy_wallet_client"),a="true"===e.get("privy_connect_only");if(!t||!n)return;let i=Co({connectorType:t,walletClientType:n});if(!i||!i.isInstalled)return ke(Fb);if(!r.connectors)throw new pe("Connector not initialized");ke(a?Ly:Rm);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,a?void 0:"solana_adapter"===t?Me:Ne)};d((()=>{m&&y&&null===T&&r.getAuthenticatedUser().then(x)}),[m,y,T,r]);let We=e=>{if(!y)throw Es(ge,"linkAccount","onError",Te.MUST_BE_AUTHENTICATED,{linkMethod:e}),new pe("User must be authenticated before linking an account.")},Ue=e=>{if(!y||!T)return!1;if("privy"===e.walletClientType)return!0;for(let t of T.linkedAccounts)if("wallet"===t.type&&t.address===e.address&&"privy"!==t.walletClientType)return!0;return!1},Oe=async e=>{let t;if(!r.connectors)throw new pe("Connector not initialized");t="ethereum"===e.type?r.connectors.findWalletConnector(e.connectorType,e.walletClientType)||null:r.connectors.findSolanaWalletConnector(e.walletClientType)||null,D((n=>({...n,connector:t,status:"connected",connectedWallet:e,connectError:null,connectRetry:Pt}))),ee.captchaEnabled&&!y?(ae({captchaModalData:{callback:t=>Vi(e)?Ne(e,t):Me(e,t),userIntentRequired:!1,onSuccessNavigateTo:Rm,onErrorNavigateTo:Cu}}),ke(bm)):(Vi(e)?await Ne(e):await Me(e),ke(Rm))},Fe=()=>{_((e=>{let t=r.connectors?.wallets.filter(Vi).map((e=>({...e,linked:Ue(e),loginOrLink:async()=>{if(!await e.isConnected())throw new pe("Wallet is not connected");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new pe("Cannot link or login with embedded wallet");Oe(e)},fund:async t=>{await qe.fundWallet(e.address,t)},unlink:async()=>{if(!y)throw new pe("User is not authenticated.");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new pe("Cannot unlink an embedded wallet");x(await r.unlinkEthereumWallet(e.address))}})))||[];return Hi(e,t)?e:t})),E((e=>{let t=(r.connectors?.wallets??[]).filter(Ao).map((e=>({...e,linked:Ue(e),loginOrLink:async()=>{if(!await e.isConnected())throw new pe("Wallet is not connected");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new pe("Cannot link or login with embedded wallet");Oe(e)},fund:async()=>{throw new pe("'fund' is deprecated for Solana wallets - use 'fundWallet' instead")},unlink:async()=>{if(!y)throw new pe("User is not authenticated.");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new pe("Cannot unlink an embedded wallet");x(await r.unlinkSolanaWallet(e.address))}})));return Hi(e,t)?e:t}))};d((()=>{Fe()}),[T?.linkedAccounts,y,m]),d((()=>{if(m){if(!r.connectors)throw new pe("Connector not initialized");Fe(),r.connectors.on("walletsUpdated",Fe)}}),[m]),d((()=>{[...ee.loginMethodsAndOrder?.primary??[],...ee.loginMethodsAndOrder?.overflow??[]].filter((e=>e.startsWith("privy:"))).forEach((e=>r.getCrossAppProviderDetails(e.replace("privy:",""))))}),[!!r]);let De=({transaction:e,uiOptions:t,fundWalletConfig:a,address:i,signOnly:o})=>new Promise((async(s,c)=>{let{requesterAppId:d}=t||{},h=o?"signTransaction":"sendTransaction",p=i?cn(T,i):ln(T);if(!p&&i){let t=gn(A,i);if(t)try{let n=await t.getEthereumProvider(),a={...e,from:i,chainId:e.chainId||Number(t.chainId.replace("eip155:","")),value:void 0!==e.value?C(e.value):void 0},r=await n.request({method:"sendTransaction"===h?"eth_sendTransaction":"eth_signTransaction",params:[a]});return Es(ge,h,"onSuccess",{hash:r}),void s({hash:r})}catch(e){return Es(ge,h,"onError",Te.TRANSACTION_FAILURE),void c(e??new $i("Unable to "+h+e))}}if(!p)return Es(ge,h,"onError",Te.EMBEDDED_WALLET_NOT_FOUND),void c(new pe("No embedded or connected wallet found for address."));if(!y||!T)return Es(ge,h,"onError",Te.MUST_BE_AUTHENTICATED),void c(Error("User must be authenticated before signing with a Privy wallet"));let u=p.address,m=p.walletIndex??0,{entropyId:g,entropyIdVerifier:f}=Oi(T,p),w=Ke.wallets.find((e=>"privy"===e.walletClientType&&v(e.address)===v(u)));if(!w)return Es(ge,h,"onError",Te.EMBEDDED_WALLET_NOT_FOUND),void c(Error("Must have a Privy wallet before signing"));let b=await w.getEthereumProvider(),x=await b.request({method:"eth_chainId"}),_=e.chainId?Number(e.chainId):vh(x);(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)})(_);let S={...e,from:e.from??u,chainId:_},E=await Tk();if(!E||!Q)return Es(ge,h,"onError",Te.EMBEDDED_WALLET_NOT_FOUND),void c(Error("Must have valid access token and Privy wallet to send transaction"));let N=ci(S.chainId,ee.chains,ee.rpcConfig,{appId:n.appId}),M=nn(p),P=async({transactionRequest:e})=>{try{let t;if(!await qe.recoverEmbeddedWallet({address:u}))throw Es(ge,h,"onError",Te.UNKNOWN_CONNECT_WALLET_ERROR),c(Error("Unable to connect to wallet")),Error("Unable to connect to wallet");if(M){let n=e=>null==e?void 0:C(e),a=await I(l,(async({message:e})=>await Q.signWithUserSigner({accessToken:E,requesterAppId:d,message:e})),{chain_type:"ethereum",method:"eth_signTransaction",params:{transaction:{from:e.from,to:e.to,nonce:n(e.nonce),chain_id:n(e.chainId),data:k(e.data)?e.data?e.data:C(Uint8Array.from(e.data)):void 0,value:n(e.value),type:e.type,gas_limit:n(e.gasLimit??e.gas),gas_price:n(e.gasPrice??e.gas),max_fee_per_gas:n(e.maxFeePerGas),max_priority_fee_per_gas:n(e.maxPriorityFeePerGas)}},wallet_id:p.id});if(!a.data||!("signed_transaction"in a.data))throw new $i("Unable to sign transaction");t=a.data.signed_transaction}else t=await async function({accessToken:e,entropyId:t,entropyIdVerifier:n,transactingWalletIndex:a,walletProxy:r,transactionRequest:i,requesterAppId:o}){return(await r.rpc({entropyId:t,entropyIdVerifier:n,hdWalletIndex:a??0,chainType:"ethereum",accessToken:e,requesterAppId:o,request:{method:"eth_signTransaction",params:[i]}})).response.data}({accessToken:E,entropyId:g,entropyIdVerifier:f,transactingWalletIndex:m,walletProxy:Q,transactionRequest:e,requesterAppId:d});if(o)return Es(ge,"signTransaction","onSuccess",{signature:t}),t;{let e=await N.sendRawTransaction({serializedTransaction:t});return Es(ge,"sendTransaction","onSuccess",{hash:e}),e}}catch(e){throw Es(ge,h,"onError",Te.TRANSACTION_FAILURE),e}};if(be({showWalletUIs:t?.showWalletUIs}))P({transactionRequest:o?S:await hd(S,N,S.from)}).then((e=>{o?Es(ge,"signTransaction","onSuccess",{signature:e}):Es(ge,"sendTransaction","onSuccess",{hash:e}),s({hash:e})})).catch((e=>{Es(ge,h,"onError",Te.TRANSACTION_FAILURE),c(e)}));else{let e={connectingWalletAddress:u,recoveryMethod:p.recoveryMethod,entropyId:g,entropyIdVerifier:f,onCompleteNavigateTo:mb,isUnifiedWallet:M,onFailure:e=>{Es(ge,h,"onError",Te.UNKNOWN_CONNECT_WALLET_ERROR),c(e)}},n=Vf(ee)?Pv({address:u,appConfig:ee,fundWalletConfig:a,methodScreen:Iv,chainIdOverride:S.chainId,comingFromSendTransactionScreen:!0}):void 0;ae({connectWallet:e,sendTransaction:{transactionRequest:S,transactingWalletIndex:m,transactingWalletAddress:u,entropyId:g,entropyIdVerifier:f,signOnly:o,scanTransaction:async()=>{let e=await hd(S,N,S.from);return await r.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}]}})},onConfirm:({transactionRequest:e})=>P({transactionRequest:e}),onSuccess:e=>{o?Es(ge,"signTransaction","onSuccess",{signature:e.hash}):Es(ge,"sendTransaction","onSuccess",{hash:e.hash}),s(e)},onFailure:e=>{Es(ge,h,"onError",Te.TRANSACTION_FAILURE),c(e)},uiOptions:t||{},fundWalletConfig:a,requesterAppId:d},funding:n}),ke(zv)}}));function Be(){return new Promise((async(e,t)=>{let n=await Tk();if(!n||!Q)throw Error("Must have valid access token to enroll in MFA");try{await Q.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],$e=e=>{let t=T?.linkedAccounts.filter((t=>t.type===e)).length??0,{displayName:n,loginMethod:a}=$p(e);if("passkey"===e&&t>=5||"passkey"!==e&&t>=1)throw Es(ge,"linkAccount","onError",Te.CANNOT_LINK_MORE_OF_TYPE,{linkMethod:a}),new pe(`User already has an account of type ${n} linked.`)};async function je({showAutomaticRecovery:e=!1,legacySetWalletPasswordFlow:t=!1}){O(null);let n=t?"setWalletPassword":"setWalletRecovery";if(!y||!T)throw Es(ge,n,"onError",Te.MUST_BE_AUTHENTICATED),Error("User must be authenticated before adding recovery method to Privy wallet");let a=tn(T);if(!a||!Q)throw Es(ge,n,"onError",Te.EMBEDDED_WALLET_NOT_FOUND),Error("Must have a Privy wallet to add a recovery method");let r=nn(a);if(r)throw Es(ge,n,"onError",Te.UNSUPPORTED_WALLET_TYPE),new pe("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 Es(ge,n,"onError",Te.MISSING_MFA_CREDENTIALS),e}return new Promise(((i,o)=>{let s="user-passcode"===a.recoveryMethod,l=vf({walletAction:"update",availableRecoveryMethods:ee.embeddedWallets.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:t,isResettingPassword:s,showAutomaticRecovery:e}),{entropyId:c,entropyIdVerifier:d}=Oi(T),h={recoveryMethod:a.recoveryMethod,connectingWalletAddress:a.address,onCompleteNavigateTo:l,shouldForceMFA:!1,entropyId:c,isUnifiedWallet:r,entropyIdVerifier:d,onFailure:e=>{Es(ge,n,"onError",Te.UNKNOWN_CONNECT_WALLET_ERROR),o(e)}};ae({setWalletPassword:{onSuccess:e=>{Es(ge,n,"onSuccess",{method:"user-passcode",wallet:e}),i(e)},onFailure:e=>{Es(ge,n,"onError",Te.USER_EXITED_SET_PASSWORD_FLOW),o(e)},callAuthOnSuccessOnClose:!1},recoverWallet:{entropyId:c,entropyIdVerifier:d,onFailure:o},connectWallet:h,recoverySelection:{isInAccountCreateFlow:!1,isResettingPassword:s,shouldCreateEth:!1,shouldCreateSol:!1}}),ke(zv)}))}async function Ve({appId:e,action:t}){let n=await Tk();if("link"===t&&!n)throw Es(ge,"linkAccount","onError",Te.MUST_BE_AUTHENTICATED,{linkMethod:`privy:${e}`}),new pe("User must be authenticated before linking an account.");if("login"===t&&n)throw Es(ge,"login","onError",Te.UNKNOWN_AUTH_ERROR),new pe("Attempted to log in, but user is already logged in. Use a `link` helper instead.");we.current=`privy:${e}`,ve.current=t;let a=xh();return r.createAnalyticsEvent({eventName:"cross_app_auth_started",payload:{providerAppId:e}}),new Promise((async(n,i)=>{let{name:o,logoUrl:s}=await Th({api:r.api,providerAppId:e,requesterAppId:ee.id});ae({crossAppAuth:{appId:e,name:o,logoUrl:s,action:t,popup:a,onSuccess:n,onError:i}}),ke(kb)}))}let He={ready:m,authenticated:y,user:T,walletConnectors:r.connectors||null,connectWallet:e=>{e&&"target"in e&&e&&(e=void 0),ae({externalConnectWallet:{walletList:e?.walletList&&e?.walletList.length>0?e.walletList:void 0,suggestedAddress:e?.suggestedAddress,walletChainType:e?.walletChainType,description:e?.description}}),ke(y?Cb:bg)},linkWallet:n=>{n&&"target"in n&&n&&(n=void 0),We("siwe"),we.current="siwe",ve.current="link",ae({...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(eh,{showCopyIcon:!1,address:n?.suggestedAddress})," ",ee?.name?`to ${ee.name}.`:"."]}):`Link a wallet to your ${ee?.name} account`}}),ke(vg)},startCrossAppAuthFlow:Ve,linkEmail:()=>{We("email"),$e("email"),we.current="email",ve.current="link",ke(Ob)},linkPhone:()=>{We("sms"),$e("phone"),we.current="sms",ve.current="link",ke(Lb)},linkGoogle:async()=>{We("google"),$e("google_oauth"),ve.current="link",await qe.initLoginWithOAuth("google")},linkTwitter:async()=>{We("twitter"),$e("twitter_oauth"),ve.current="link",await qe.initLoginWithOAuth("twitter")},linkDiscord:async()=>{We("discord"),$e("discord_oauth"),ve.current="link",await qe.initLoginWithOAuth("discord")},linkGithub:async()=>{We("github"),$e("github_oauth"),ve.current="link",await qe.initLoginWithOAuth("github")},linkSpotify:async()=>{We("spotify"),$e("spotify_oauth"),ve.current="link",await qe.initLoginWithOAuth("spotify")},linkInstagram:async()=>{We("instagram"),$e("instagram_oauth"),ve.current="link",await qe.initLoginWithOAuth("instagram")},linkTiktok:async()=>{We("tiktok"),$e("tiktok_oauth"),ve.current="link",await qe.initLoginWithOAuth("tiktok")},linkLine:async()=>{We("line"),$e("line_oauth"),ve.current="link",await qe.initLoginWithOAuth("line")},linkLinkedIn:async()=>{We("linkedin"),$e("linkedin_oauth"),ve.current="link",await qe.initLoginWithOAuth("linkedin")},linkApple:async()=>{We("apple"),$e("apple_oauth"),ve.current="link",await qe.initLoginWithOAuth("apple")},linkPasskey:async()=>{We("passkey"),$e("passkey"),await qe.initLinkWithPasskey(),ke(Pw)},linkTelegram:async e=>{if(We("telegram"),$e("telegram"),ve.current="link",we.current="telegram",e?.launchParams)if(e.launchParams.initDataRaw){let t=new Si;r.startAuthFlow(t),t.meta.telegramAuthResult=void 0,t.meta.telegramWebAppData=Ni(e.launchParams.initDataRaw),ae({telegramAuthModalData:{seamlessAuth:!0}}),ke(ry)}else Es(ge,"linkAccount","onError",Te.INVALID_DATA,{linkMethod:"telegram"});else await qe.initLoginWithTelegram();ke(ry)},linkFarcaster:async()=>{We("farcaster"),$e("farcaster"),await qe.initLoginWithFarcaster(),ve.current="link",we.current="farcaster",ke(Lg)},updateEmail:()=>{if(We("email"),!T?.email)throw new pe("User does not have an email linked to their account.");ve.current="update",we.current="email",ke(lk)},updatePhone:()=>{if(We("sms"),!T?.phone)throw new pe("User does not have a phone number linked to their account.");ve.current="update",we.current="sms",ke(ck)},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)}!T||T.isGuest?(ve.current="login",ae({login:e}),ke(of)):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(yy))},logout:async()=>{if(ve.current=null,we.current=null,T&&r.clearProviderAcccessTokens(T),O(null),await r.logout(),T&&Q)try{await Q.clearMfa({userId:T.id})}catch(e){}x(null),f(!1),Es(ge,"logout","onSuccess"),u(!1),Ka.del(gr),Ka.del(yr(ee.id))},getAccessToken:h((()=>r.getCustomerAccessToken()),[r]),unlinkWallet:async e=>{let t;return x(t=e.startsWith("0x")?await r.unlinkEthereumWallet(e):await r.unlinkSolanaWallet(e)),t},unlinkEmail:async e=>{let t=await r.unlinkEmail(e);return x(t),t},unlinkPhone:async e=>{let t=await r.unlinkPhone(e);return x(t),t},unlinkGoogle:async e=>{let t=await r.unlinkOAuth("google",e);return x(t),t},unlinkTwitter:async e=>{let t=await r.unlinkOAuth("twitter",e);return x(t),t},unlinkDiscord:async e=>{let t=await r.unlinkOAuth("discord",e);return x(t),t},unlinkGithub:async e=>{let t=await r.unlinkOAuth("github",e);return x(t),t},unlinkSpotify:async e=>{let t=await r.unlinkOAuth("spotify",e);return x(t),t},unlinkInstagram:async e=>{let t=await r.unlinkOAuth("instagram",e);return x(t),t},unlinkTiktok:async e=>{let t=await r.unlinkOAuth("tiktok",e);return x(t),t},unlinkLine:async e=>{let t=await r.unlinkOAuth("line",e);return x(t),t},unlinkLinkedIn:async e=>{let t=await r.unlinkOAuth("linkedin",e);return x(t),t},unlinkApple:async e=>{let t=await r.unlinkOAuth("apple",e);return x(t),t},unlinkFarcaster:async e=>{let t=await r.unlinkFarcaster(e);return x(t),t},unlinkTelegram:async e=>{let t=await r.unlinkTelegram(e);return x(t),t},unlinkPasskey:async e=>{let t=await Tk();if(!t)throw Error("Must have valid access token to enroll in MFA");if(!Q)throw Error("Wallet proxy not initialized.");let n=ee.passkeys.shouldUnenrollMfaOnUnlink;await Q.unlinkPasskeyAccount({credentialId:e,accessToken:t,removeAsMfa:n});let a=await r.getAuthenticatedUser();return x(a),a},unlinkCrossAppAccount:async({subject:e})=>{let t=T?.linkedAccounts.find((t=>"cross_app"===t.type&&t.subject===e))?.providerApp;if(!t)throw new pe("Invalid subject");r.storeProviderAccessToken(t.id,null);let n=await r.unlinkOAuth(`privy:${t.id}`,e);return x(n),n},setWalletRecovery:async e=>je({legacySetWalletPasswordFlow:!1,showAutomaticRecovery:e?.showAutomaticRecovery??!1}),setWalletPassword:async()=>je({legacySetWalletPasswordFlow:!0,showAutomaticRecovery:!1}),signMessage:(e,t)=>new Promise((async(n,a)=>{let{requesterAppId:i}=t?.uiOptions||{},o=e.message,s=t?.address?cn(T,t.address):ln(T);if(!s&&void 0!==t?.address){let e=gn(A,t.address);if(e)try{let t=await e.getEthereumProvider(),a=await t.request({method:"personal_sign",params:[o,e.address]});return Es(ge,"signMessage","onSuccess",{signature:a}),void n({signature:a})}catch(e){return Es(ge,"signMessage","onError",Te.UNABLE_TO_SIGN),void a(e??new $i("Unable to sign message"))}}if(!s)throw new pe("No embedded or connected wallet found for address.");if(!y||!T)return Es(ge,"signMessage","onError",Te.MUST_BE_AUTHENTICATED),void a(Error("User must be authenticated before signing with a Privy wallet"));let c=s.address,d=s.walletIndex??0,{entropyId:h,entropyIdVerifier:p}=Oi(T,s),u=nn(s);if("string"!=typeof o||o.length<1)return Es(ge,"signMessage","onError",Te.INVALID_MESSAGE),void a(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 Tk();if(!Q||!n||!await qe.recoverEmbeddedWallet({address:c}))throw Error("Unable to connect to wallet");if(r.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_started",payload:{walletAddress:c,requesterAppId:i}}),u){let a=k(e.message,{strict:!0}),r=await I(l,(async({message:e})=>await Q.signWithUserSigner({accessToken:n,requesterAppId:i,message:e})),{chain_type:"ethereum",method:"personal_sign",params:a?{message:o.slice(2),encoding:"hex"}:{message:o,encoding:"utf-8"},wallet_id:s.id});if(!r.data||!("signature"in r.data))throw new $i("Unable to sign message");t=r.data.signature}else{let{response:e}=await Q.rpc({accessToken:n,entropyId:h,entropyIdVerifier:p,chainType:"ethereum",hdWalletIndex:d,requesterAppId:i,request:{method:"personal_sign",params:[o,c]}});t=e.data}return r.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_completed",payload:{walletAddress:c,requesterAppId:i}}),t};if(be({showWalletUIs:t?.uiOptions?.showWalletUIs}))try{let e=await m();Es(ge,"signMessage","onSuccess",{signature:e}),n({signature:e})}catch(e){Es(ge,"signMessage","onError",Te.UNABLE_TO_SIGN),a(e??new $i("Unable to sign message"))}else ae({signMessage:{method:"personal_sign",data:o,confirmAndSign:m,onSuccess:e=>{Es(ge,"signMessage","onSuccess",{signature:e}),n({signature:e})},onFailure:e=>{Es(ge,"signMessage","onError",Te.UNABLE_TO_SIGN),a(e)},uiOptions:t?.uiOptions||{}},connectWallet:{recoveryMethod:s.recoveryMethod,connectingWalletAddress:c,entropyId:h,entropyIdVerifier:p,onCompleteNavigateTo:LC,isUnifiedWallet:u,onFailure:e=>{Es(ge,"signMessage","onError",Te.UNKNOWN_CONNECT_WALLET_ERROR),a(e)}}}),ke(zv)})),signTypedData:(e,t)=>new Promise((async(n,a)=>{let{requesterAppId:i}=t?.uiOptions||{},o=t?.address?cn(T,t.address):ln(T);if(!o&&t?.address){let r=gn(A,t.address);if(r)try{let t=await r.getEthereumProvider(),a=ki(e),i=await t.request({method:"eth_signTypedData_v4",params:[r.address,a]});return Es(ge,"signTypedData","onSuccess",{signature:i}),void n({signature:i})}catch(e){return Es(ge,"signTypedData","onError",Te.UNABLE_TO_SIGN),void a(e??new $i("Unable to sign typed data "+e))}}if(!o)throw new pe("No embedded or connected wallet found for address.");if(!y||!T)return Es(ge,"signTypedData","onError",Te.MUST_BE_AUTHENTICATED),void a(Error("User must be authenticated before signing with a Privy wallet"));let s=o.address,c=o.walletIndex??0,{entropyId:d,entropyIdVerifier:h}=Oi(T,o),p=nn(o),u=ki(e),m=async()=>{let e;if(!y)throw Error("User must be authenticated before signing with a Privy wallet");let t=await Tk();if(!Q||!t||!await qe.recoverEmbeddedWallet({address:s}))throw Error("Unable to connect to wallet");if(r.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_started",payload:{walletAddress:s,requesterAppId:i}}),p){let{domain:n,types:a,primaryType:r,message:s}=u,c=await I(l,(async({message:e})=>await Q.signWithUserSigner({accessToken:t,requesterAppId:i,message:e})),{chain_type:"ethereum",method:"eth_signTypedData_v4",params:{typed_data:{domain:n,types:a,primary_type:r,message:s}},wallet_id:o.id});if(!c.data||!("signature"in c.data))throw new $i("Unable to sign message");e=c.data.signature}else{let{response:n}=await Q.rpc({accessToken:t,entropyId:d,entropyIdVerifier:h,chainType:"ethereum",hdWalletIndex:c,requesterAppId:i,request:{method:"eth_signTypedData_v4",params:[s,u]}});e=n.data}return r.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();Es(ge,"signTypedData","onSuccess",{signature:e}),n({signature:e})}catch(e){Es(ge,"signTypedData","onError",Te.UNABLE_TO_SIGN),a(e??new $i("Unable to sign message"))}else ae({signMessage:{method:"eth_signTypedData_v4",data:u,confirmAndSign:m,onSuccess:e=>{Es(ge,"signTypedData","onSuccess",{signature:e}),n({signature:e})},onFailure:e=>{Es(ge,"signTypedData","onError",Te.UNABLE_TO_SIGN),a(e)},uiOptions:t?.uiOptions||{}},connectWallet:{recoveryMethod:o.recoveryMethod,connectingWalletAddress:o.address,entropyId:d,isUnifiedWallet:p,entropyIdVerifier:h,onCompleteNavigateTo:LC,onFailure:e=>{Es(ge,"signMessage","onError",Te.UNKNOWN_CONNECT_WALLET_ERROR),a(e)}}}),ke(zv)})),sendTransaction:async(e,t)=>await De({transaction:e,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,a)=>{if(!y||!T)return void a(Error("User must be authenticated before exporting their Privy wallet"));e&&"target"in e&&e&&(e=void 0);let i=e?.address?cn(T,e.address):ln(T),o=tn(T);if(!i||!o)return void a(new pe("User must have an embedded wallet."));let s=i.address,{entropyId:l,entropyIdVerifier:c}=Oi(T,i),d=nn(i);if(!s)return void a(Error("User does not have an HD Ethereum wallet. To export an imported wallet, pass the `address` of the wallet to `exportWallet`."));if(!b(s))return void a(Error("Must provide a valid Ethereum address."));let h={recoveryMethod:i.recoveryMethod,connectingWalletAddress:i.address,isUnifiedWallet:d,entropyId:l,entropyIdVerifier:c,onCompleteNavigateTo:Rv,onFailure:a,shouldForceMFA:!0};ae(ne),await Tk()&&Q?Q?mh(i)?(ae({keyExport:{appId:n.appId,appClientId:n.clientId,origin:r.apiUrl,address:i.address,entropyId:l,entropyIdVerifier:c,hdWalletIndex:i.walletIndex,chainType:i.chainType,walletId:i.id,isUnifiedWallet:d,imported:i.imported,onSuccess:t,onFailure:a},connectWallet:h}),ke(zv)):a(Error(`Export is not supported for ${i.chainType} wallets`)):a(Error("Must have a Privy wallet before exporting")):a(Error("Must have valid access token to enroll in MFA"))})),promptMfa:Be,async init(e){switch(e){case"sms":return void await r.initMfaSmsVerification();case"passkey":return await r.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 pe("Invalid MFA code");he.current?.resolve({mfaMethod:e,mfaCode:t,relyingParty:window.origin}),await new Promise(((e,t)=>{ue.current={resolve:e,reject:t}}));break;case"passkey":if("string"==typeof t)throw new pe("Invalid authenticator response");let n=await import("@simplewebauthn/browser"),a=vb(await n.startAuthentication(t));he.current?.resolve({mfaMethod:e,mfaCode:a,relyingParty:window.origin}),await new Promise(((e,t)=>{ue.current={resolve:e,reject:t}}));break;default:throw he.current?.reject(new pe("Unsupported MFA method")),new pe(`Unsupported MFA method: ${e}`)}},cancel(){he.current?.reject(new pe("MFA canceled"))},async initEnrollmentWithSms(e){let t=await Tk();if(!t||!Q)throw Error("Must have valid access token to enroll in MFA");await Q.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."),ae({mfaEnrollmentFlow:{mfaMethods:ee.mfa.methods,shouldUnlinkOnUnenrollMfa:ee.passkeys.shouldUnlinkOnUnenrollMfa,onSuccess:t,onFailure:n}}),ke(nk)})),async initEnrollmentWithTotp(){let e=await Tk();if(!e||!Q)throw Error("Must have valid access token to enroll in MFA");let t=await Q.initEnrollMfa({method:"totp",accessToken:e});return{secret:t.secret,authUrl:t.authUrl}},async submitEnrollmentWithSms(e){let t=await Tk();if(!t||!Q)throw Error("Must have valid access token to enroll in MFA");await Q.submitEnrollMfa({method:"sms",accessToken:t,phoneNumber:e.phoneNumber,code:e.mfaCode}),x(await r.getAuthenticatedUser())},async submitEnrollmentWithTotp(e){let t=await Tk();if(!t||!Q)throw Error("Must have valid access token to enroll in MFA");await Q.submitEnrollMfa({method:"totp",accessToken:t,code:e.mfaCode}),x(await r.getAuthenticatedUser())},async initEnrollmentWithPasskey(){},async submitEnrollmentWithPasskey({credentialIds:e},t={}){let n=await Tk();if(!n||!Q)throw Error("Must have valid access token to enroll in MFA");await Q.submitEnrollMfa({method:"passkey",accessToken:n,credentialIds:e,removeForLogin:t.removeForLogin}),x(await r.getAuthenticatedUser())},async unenroll(e,t={}){let n=await Tk();if(!n||!Q)throw Error("Must have valid access token to remove MFA");"passkey"===e?await Q.submitEnrollMfa({method:"passkey",accessToken:n,credentialIds:[],removeForLogin:t.removeForLogin}):await Q.unenrollMfa({method:e,accessToken:n}),x(await r.getAuthenticatedUser())},requestFarcasterSignerFromWarpcast:async()=>{let e=await Tk(),t=T?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!e)throw Error("Must have valid access token to connect with Farcaster");if(!Q||!t)throw Error("Must have an embedded wallet to use Farcaster signers");if(nn(t))throw new pe("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(!T?.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 Q.initFarcasterSigner({address:t.address,hdWalletIndex:null,accessToken:e,mfaCode:null,mfaMethod:null,relyingParty:window.origin});"approved"===n.status&&x(await r.getAuthenticatedUser()||T||null),ae({farcasterSigner:n}),ke(Nb)},getFarcasterSignerPublicKey:async()=>{let e,t=await Tk(),n=T?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!t)throw Error("Must have valid access token to connect with Farcaster");if(!Q||!n)throw Error("Must have an embedded wallet to use Farcaster signers");if(nn(n))throw new pe("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(!T?.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(!T.farcaster?.signerPublicKey)throw Error("Must have a Farcaster signer public key to sign");return e=T.farcaster.signerPublicKey.slice(2),Uint8Array.from(e.match(/.{1,2}/g).map((e=>parseInt(e,16))))},signFarcasterMessage:async e=>{let t=await Tk(),n=T?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!t)throw Error("Must have valid access token to connect with Farcaster");if(!Q||!n)throw Error("Must have an embedded wallet to use Farcaster signers");if(nn(n))throw new pe("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(!T?.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(!T.farcaster?.signerPublicKey)throw Error("Must have a Farcaster signer public key to sign");let a=await import("@simplewebauthn/browser"),r=await Q.signFarcasterMessage({address:n.address,hdWalletIndex:null,accessToken:t,mfaCode:null,mfaMethod:null,payload:{hash:a.bufferToBase64URLString(e)},fid:BigInt(T.farcaster.fid),relyingParty:window.origin});return new Uint8Array(a.base64URLStringToBuffer(r.signature))},signMessageWithCrossAppWallet(e,{address:t,chainId:n}){let a=T?.linkedAccounts.some((e=>"cross_app"===e.type&&e.smartWallets.some((e=>e.address===t))));return Ih({user:T,client:r,address:t,requesterAppId:ee.id,request:{method:a?"privy_signSmartWalletMessage":"personal_sign",params:[e,t],chainId:n},reconnect:Ve})},signTypedDataWithCrossAppWallet(e,{address:t,chainId:n}){let a=T?.linkedAccounts.some((e=>"cross_app"===e.type&&e.smartWallets.some((e=>e.address===t)))),i=ki(e);return Ih({user:T,client:r,address:t,requesterAppId:ee.id,request:{method:a?"privy_signSmartWalletTypedData":"eth_signTypedData_v4",params:[t,i],chainId:n},reconnect:Ve})},sendTransactionWithCrossAppWallet(e,{address:t}){let n=T?.linkedAccounts.some((e=>"cross_app"===e.type&&e.smartWallets.some((e=>e.address===t))));return Ih({user:T,client:r,address:t,requesterAppId:ee.id,request:{method:n?"privy_sendSmartWalletTx":"eth_sendTransaction",params:[e],chainId:e.chainId},reconnect:Ve})},isModalOpen:p,mfaMethods:ee.mfa.methods};yk=He.signMessage,fk=He.signTypedData,vk=async(e,t)=>await De({transaction:e,...t,signOnly:!1}),wk=async(e,t)=>({signature:(await De({transaction:e,...t,signOnly:!0})).hash});let qe={privy:l,setAuthenticated:f,setUser:x,setIsNewUser:W,isNewUserThisSession:P,pendingTransaction:null,walletConnectionStatus:F,setWalletConnectionStatus:D,connectors:r.connectors?.walletConnectors??[],solanaWallets:S,rpcConfig:ee.rpcConfig,chains:ee.chains,appId:n.appId,showFiatPrices:"native-token"!==ee.embeddedWallets.priceDisplay.primary,clientAnalyticsId:r.clientAnalyticsId,onCustomAuthAuthenticated:xe,hideWalletUIs:Ce,isHeadlessSigning:h(be,[ee.embeddedWallets.showWalletUIs]),emailOtpState:$,setEmailOtpState:j,smsOtpState:V,setSmsOtpState:H,oAuthState:Z,setOAuthState:Y,telegramAuthState:G,setTelegramAuthState:J,siweState:q,setSiweState:K,isHeadlessOAuthLoading:L,baseAccountSdk:N,setBaseAccountSdk:M,nativeTokenSymbolForChainId:e=>ee.chains.find((t=>t.id===Number(e)))?.nativeCurrency.symbol,initializeWalletProxy:async e=>{if(Q)return Q;let t=new Promise((e=>{oe.current=e})),n=new Promise((t=>setTimeout((()=>t(null)),e))),a=await Promise.race([t,n]);return oe.current=null,a},getAuthFlow:()=>r.authFlow,getAuthMeta:()=>r.authFlow?.meta,client:r,closePrivyModal:async(e={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let t,a=m&&y&&T;a&&we.current&&(t=ze(T)),"login"===ve.current?e.shouldCallAuthOnSuccess&&a&&we.current?Es(ge,"login","onComplete",{user:T,isNewUser:P,wasAlreadyAuthenticated:!1,loginMethod:we.current,loginAccount:t??null}):Es(ge,"login","onError",Te.USER_EXITED_AUTH_FLOW):"link"===ve.current&&t?e.isSuccess&&a&&we.current?Es(ge,"linkAccount","onSuccess",{user:T,linkMethod:we.current,linkedAccount:t}):we.current&&Es(ge,"linkAccount","onError",Te.USER_EXITED_LINK_FLOW,{linkMethod:we.current}):"update"===ve.current&&t?e.isSuccess&&a&&we.current?Es(ge,"update","onSuccess",{user:T,updateMethod:we.current,updatedAccount:t}):we.current&&Es(ge,"update","onError",Te.USER_EXITED_UPDATE_FLOW,{linkMethod:we.current}):"connect-or-create"===ve.current&&(A[0]?Es(ge,"connectOrCreateWallet","onSuccess",{wallet:A[0]}):Es(ge,"connectOrCreateWallet","onError",Te.USER_EXITED_AUTH_FLOW));let i=U&&fb.has(U),o=U===Cu&&ne.errorModalData&&fb.has(ne.errorModalData.previousScreen);if((i||o)&&ne.funding){let e,t=fb.get(U)??null;if("solana"===ne.funding.chainType){let n=c(Pf);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");Es(ge,"fundSolanaWallet","onUserExited",{address:ne.funding.address,cluster:ne.funding.cluster,fundingMethod:t,balance:e})}else{let a=ci(ne.funding.chain.id,ee.chains,ee.rpcConfig,{appId:n.appId});try{e=await a.getBalance({address:ne.funding.address})}catch{console.error("Unable to pull wallet balance")}Es(ge,"fundWallet","onUserExited",{address:ne.funding.address,chain:ne.funding.chain,fundingMethod:t,balance:e})}}ae((e=>({...e,externalConnectWallet:{suggestedAddress:void 0}}))),ve.current=null,we.current=null,W(!1),u(!1),setTimeout((()=>{r.authFlow=void 0}),200)},openPrivyModal:ke,connectWallet:Ee,initLoginWithWallet:async(e,t,n,a)=>{Vi(e)?(we.current="siwe",Ne(e,t,n)):(we.current="siws",Me(e,t,n,a))},loginWithWallet:async()=>{let e,t,n;if(!m)throw new Mt;if(r.authFlow instanceof ei?e="siwe":r.authFlow instanceof ai&&(e="siws"),!e)throw new pe("Must initialize SIWE/SIWS flow first.");if(null!==await r.getAccessToken())try{({user:t}=await r.link()),we.current=e}catch(t){throw Es(ge,"linkAccount","onError",t.privyErrorCode||Te.FAILED_TO_LINK_ACCOUNT,{linkMethod:e}),t}else try{({user:t,isNewUser:n}=await r.authenticate()),we.current=e}catch(e){throw Es(ge,"login","onError",e.privyErrorCode||Te.GENERIC_CONNECT_WALLET_ERROR),e}x(t||T||null),W(n||!1),f(!0)},delegateWallet:async({address:e,chainType:t,showDelegationUIs:n})=>new Promise((async(a,r)=>{let i=await Tk();if(!y||!T||!i)throw new pe("User must be authenticated and have an embedded wallet to delegate actions.");if("solana"!==t&&"ethereum"!==t)throw new pe("Only Solana and Ethereum embedded wallets are supported for delegation and revocation.");let o=qe.walletProxy??await qe.initializeWalletProxy(15e3);if(!o)throw new pe("Wallet proxy not initialized.");if((({address:e,user:t})=>!!fh(t).find((t=>t.address===e)))({address:e,user:T}))return a();let s=cn(T,e);if(!s)throw new pe("Address to delegate is not associated with current user.");if(nn(s))throw new pe("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=gh({address:e,user:T}),c=yh({address:e,user:T}),d=async()=>{await o.createDelegatedAction({accessToken:i,rootWallet:c,delegatedWallets:[l]}),await qe.refreshSessionAndUser()};if(await qe.recoverEmbeddedWallet({address:e}),n)ae({delegatedActions:{consent:{address:e,onDelegate:d,onSuccess:async()=>{a()},onError:async e=>{r(e)}}}}),ke(xb);else try{await d(),a()}catch(e){r(e)}})),revokeDelegatedWallets:async({showDelegationUIs:e})=>new Promise((async(t,n)=>{if(!y||!T)throw new pe("User must be authenticated and have an embedded wallet to revoke a delegated wallet.");let a=fh(T);if(0===a.length)throw new pe("User has no delegated wallets to revoke.");if(a.some(nn))throw new pe("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 r.revokeDelegatedWallet(),await qe.refreshSessionAndUser()};if(e)ae({delegatedActions:{revoke:{onRevoke:i,onSuccess:async()=>{t()},onError:async e=>{n(e)}}}}),ke(_b);else try{await i(),t()}catch(e){n(e)}})),initLoginWithFarcaster:async(e,t)=>{let n=new nr(e,t);r.startAuthFlow(n);try{we.current="farcaster",await n.initializeFarcasterConnect()}catch(e){throw"login"===ve.current?Es(ge,"login","onError",e.privyErrorCode||Te.UNKNOWN_AUTH_ERROR):"link"===ve.current&&Es(ge,"linkAccount","onError",e.privyErrorCode||Te.UNKNOWN_AUTH_ERROR,{linkMethod:"farcaster"}),e}},loginWithFarcaster:async()=>{let e,t;if(!m)throw new Mt;if(!(r.authFlow instanceof nr))throw new pe("Must initialize Farcaster flow first.");if(null!==await r.getAccessToken())try{({user:e}=await r.link()),we.current="farcaster"}catch(e){throw Es(ge,"linkAccount","onError",e.privyErrorCode||Te.FAILED_TO_LINK_ACCOUNT,{linkMethod:"farcaster"}),e}else try{({user:e,isNewUser:t}=await r.authenticate()),we.current="farcaster"}catch(e){throw Es(ge,"login","onError",e.privyErrorCode||Te.UNKNOWN_AUTH_ERROR),e}x(e||null),W(t||!1),f(!0)},async crossAppAuthFlow({appId:e,popup:t,action:n}){let a=`privy:${e}`;we.current=a;let{url:i,stateCode:o,codeVerifier:s}=await async function({api:e,appId:t}){let n=Pr(),a=Wr(),r=await Ur(n);try{let{url:i}=await e.post(Ae,{provider:`privy:${t}`,redirect_to:window.location.href,code_challenge:r,state_code:a});return{url:i,stateCode:a,codeVerifier:n}}catch(e){throw me(e)}}({api:r.api,appId:e});if(!i)throw r.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:"Unable to open cross-app auth popup",appId:e}}),new pe("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 a,r=setTimeout((()=>{n(new pe("Authorization request timed out after 2 minutes.")),i()}),12e4);function i(){t?.close(),window.removeEventListener("message",s)}let o=setInterval((()=>{t?.closed&&!a&&(i(),clearInterval(o),clearTimeout(r),n(new pe("User rejected request")))}),300);function s(t){t.data&&("PRIVY_OAUTH_RESPONSE"===t.data.type&&t.data.stateCode&&t.data.authorizationCode&&(clearTimeout(r),e(t.data),i()),"PRIVY_OAUTH_ERROR"===t.data.type&&(clearTimeout(r),n(new pe(t.data.error)),i()),t.data.type===bh&&((a=new BroadcastChannel(Ch)).onmessage=s))}window.addEventListener("message",s)}))}({url:i,popup:t,provider:a}),c=l.stateCode,d=l.authorizationCode;if(c!==o)throw r.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:a,storedStateCode:o??"",returnedStateCode:c??""}}),new pe("Unexpected auth flow. This may be a phishing attempt.",void 0,Te.OAUTH_UNEXPECTED);let h=await async function({appId:e,stateCode:t,codeVerifier:n,authorizationCode:a,action:r,client:i}){if(!a||!t)throw new pe("[Cross-App AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if("undefined"===a)throw new pe("User denied confirmation during cross-app auth flow");try{let o=new kh({authorizationCode:a,stateCode:t,codeVerifier:n,provider:`privy:${e}`});i.startAuthFlow(o);let s="link"===r?await i.link():await i.authenticate(),l=s.oAuthTokens?.accessToken;return console.debug(),l}catch(e){let t=me(e);if(t.privyErrorCode===Te.ACCOUNT_TRANSFER_REQUIRED)throw t;if(t.privyErrorCode)throw new pe(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 pe("Invalid code during cross-app auth flow.",void 0,Te.OAUTH_USER_DENIED);throw new pe("Invalid code during cross-app auth flow.",void 0,Te.UNKNOWN_AUTH_ERROR)}}({appId:e,codeVerifier:s,stateCode:c,authorizationCode:d,action:n,client:r});h&&r.storeProviderAccessToken(e,h);let p=await qe.refreshSessionAndUser();if(!p)throw new pe("Unable to update user");return r.createAnalyticsEvent({eventName:"cross_app_auth_completed",payload:{providerAppId:e}}),p}catch(e){throw r.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:e.toString(),provider:a}}),e}},async initLoginWithOAuth(e,t,n){if(we.current=e,!qa())return void ke(Wb);if("google"===e&&Oy(window.navigator.userAgent))return void ke(Wb);"twitter"===e&&window.opener&&window.opener.postMessage({type:bh},"*"),Ka.del(Cr),Ka.del(br);let a=new Or({provider:e,disableSignup:!!n,withPrivyUi:!0});t&&a.addCaptchaToken(t),r.startAuthFlow(a);let i=await r.authFlow.getAuthorizationUrl();i&&i.url&&("twitter"===e&&w&&(i.url=i.url.replace("x.com","twitter.com")),window.location.assign(i.url))},async initLoginWithTelegram(e,t){if(!m)throw new Mt;we.current="telegram";let n=new Si(e,t);r.startAuthFlow(n),J({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 pe("Telegram auth failed or was canceled by the client")))):t(new pe("Telegram was not initialized")):t(new pe("Telegram Auth configuration is not loaded"))))},async loginWithTelegram(e){let t,n;if(!(r.authFlow instanceof Si))throw new pe("Must initialize Telegram flow before calling loginWithTelegram");r.authFlow.meta.captchaToken||=e?.captchaToken;let a=await Tk(),i=e?.intent||ve.current;if("login"===i)try{let e=await r.authenticate();t=e.user,n=e.isNewUser,we.current="telegram"}catch(e){throw Es(ge,"login","onError",e.privyErrorCode||Te.UNKNOWN_AUTH_ERROR),e}else{if("link"!==i)throw new pe("Unknown auth intent");try{t=(await r.link()).user,we.current="telegram"}catch(e){throw Es(ge,"linkAccount","onError",e.privyErrorCode||Te.FAILED_TO_LINK_ACCOUNT,{linkMethod:"telegram"}),e}}x(t),W(n||!1),f(!0),J({status:"done"});let o=t?.linkedAccounts.find((({type:e})=>"telegram"===e))||null;return{user:t,isNewUser:n||!1,wasAlreadyAuthenticated:!!a,loginAccount:o}},async loginWithOAuth(e){let t,n,a;if(!(r.authFlow instanceof Or))throw new pe("Must initialize OAuth flow before calling loginWithOAuth");let i=Ka.get(wr),o=r.authFlow.meta.stateCode;if(i!==o)throw r.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:e,storedStateCode:i??"",returnedStateCode:o??""}}),new pe("Unexpected auth flow. This may be a phishing attempt.",void 0,Te.OAUTH_UNEXPECTED);if(null!==await r.getAccessToken())try{let n=await r.link();t=n.user,a=n.oAuthTokens,we.current=e}catch(t){throw Es(ge,"linkAccount","onError",t.privyErrorCode||Te.FAILED_TO_LINK_ACCOUNT,{linkMethod:e}),t}else try{let i=await r.authenticate();t=i.user,n=i.isNewUser,a=i.oAuthTokens,we.current=e}catch(t){throw"login"===ve.current?Es(ge,"login","onError",t.privyErrorCode||Te.UNKNOWN_AUTH_ERROR):"link"===ve.current&&Es(ge,"linkAccount","onError",t.privyErrorCode||Te.FAILED_TO_LINK_ACCOUNT,{linkMethod:e}),t}return x(t),W(n||!1),f(!0),a&&t&&Es(ge,"oAuthAuthorization","onOAuthTokenGrant",{oAuthTokens:a,user:t}),a},passkeyAuthState:B,setPasskeyAuthState:z,async initSignupWithPasskey({captchaToken:e,withPrivyUi:t}){let n=new Qr({captchaToken:e,setPasskeyAuthState:z});r.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}),Es(ge,"login","onError",e.privyErrorCode||Te.UNKNOWN_AUTH_ERROR),e}},async signupWithPasskey(){let e,t;if(!m)throw new Mt;if(!(r.authFlow instanceof Qr))throw new pe("Must initialize Passkey flow first.");if("passkey"!==we.current){let e=new pe("Must init login with Passkey flow first.");throw z({status:"error",error:e}),e}let n=await Tk();try{we.current="passkey",z({status:"awaiting-passkey"}),({user:e,isNewUser:t}=await r.authenticate())}catch(e){throw z({status:"error",error:e}),Es(ge,"login","onError",e.privyErrorCode||Te.UNKNOWN_AUTH_ERROR),e}x(e),W(t||!1),f(!0),z({status:"done"});let a=e?.linkedAccounts.find((({type:e})=>"passkey"===e))||null;return{user:e,isNewUser:t||!1,wasAlreadyAuthenticated:!!n,loginAccount:a}},async initLoginWithPasskey({captchaToken:e,withPrivyUi:t}){let n=new Qr({captchaToken:e,setPasskeyAuthState:z});r.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}),Es(ge,"login","onError",e.privyErrorCode||Te.UNKNOWN_AUTH_ERROR),e}},async loginWithPasskey(e){let t,n;if(!m)throw new Mt;if(!(r.authFlow instanceof Qr))throw new pe("Must initialize Passkey flow first.");if(e?.credentialIds&&(r.authFlow.meta.allowedCredentialsIds=e.credentialIds),"passkey"!==we.current){let e=new pe("Must init login with Passkey flow first.");throw z({status:"error",error:e}),e}let a=await Tk();try{we.current="passkey",z({status:"awaiting-passkey"}),({user:t,isNewUser:n}=await r.authenticate())}catch(e){throw z({status:"error",error:e}),Es(ge,"login","onError",e.privyErrorCode||Te.UNKNOWN_AUTH_ERROR),e}x(t),W(n||!1),f(!0),z({status:"done"});let i=t?.linkedAccounts.find((({type:e})=>"passkey"===e))||null;return{user:t,isNewUser:n||!1,wasAlreadyAuthenticated:!!a,loginAccount:i}},async initLinkWithPasskey(e){let t=new Qr({captchaToken:e});r.startAuthFlow(t),ve.current="link",we.current="passkey",z({status:"generating-challenge"});try{await t.initLinkFlow(),z({status:"awaiting-passkey"})}catch(e){throw Es(ge,"linkAccount","onError",e.privyErrorCode||Te.UNKNOWN_AUTH_ERROR,{linkMethod:"passkey"}),z({status:"error",error:e}),e}},async linkWithPasskey(){let e;if(!m)throw new Mt;if(!(r.authFlow instanceof Qr))throw new pe("Must initialize Passkey flow first.");if("passkey"!==we.current)throw new pe("Must init login with Passkey flow first.");try{we.current="passkey",({user:e}=await r.link())}catch(e){throw Es(ge,"linkAccount","onError",e.privyErrorCode||Te.FAILED_TO_LINK_ACCOUNT,{linkMethod:"passkey"}),e}return x(e||T||null),z({status:"done"}),e},async initLoginWithHeadlessOAuth(e,t,n){if(!qa())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&&Oy(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 a=new Or({provider:e,withPrivyUi:!1,disableSignup:n??!1});t&&a.addCaptchaToken(t),Y({status:"loading"});let i=await r.startAuthFlow(a).getAuthorizationUrl();i?.url&&window.location.assign(i.url)},async loginWithHeadlessOAuth(e){let t,n,a;R(!0),Y({status:"loading"}),r.startAuthFlow(new Or(e));let i=Ka.get(wr),o=e.stateCode;if(i!==o)throw r.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:e.provider,storedStateCode:i??"",returnedStateCode:o??""}}),R(!1),new pe("Unexpected auth flow. This may be a phishing attempt.",void 0,Te.OAUTH_UNEXPECTED);if(null!==await r.getAccessToken())try{({user:t,oAuthTokens:a}=await r.link()),we.current=e.provider;let n=ze(t);t&&n&&Es(ge,"linkAccount","onSuccess",{user:t,linkMethod:we.current,linkedAccount:n})}catch(t){throw R(!1),Es(ge,"linkAccount","onError",t.privyErrorCode||Te.FAILED_TO_LINK_ACCOUNT,{linkMethod:e.provider}),t}else try{({user:t,isNewUser:n,oAuthTokens:a}=await r.authenticate()),we.current=e.provider;let i=ze(t);t&&i&&void 0!==n&&Es(ge,"login","onComplete",{user:t,isNewUser:n,wasAlreadyAuthenticated:!1,loginMethod:we.current,loginAccount:i})}catch(e){throw R(!1),Y({status:"error",error:e}),Es(ge,"login","onError",e.privyErrorCode||Te.UNKNOWN_AUTH_ERROR),e}return x(t),W(n||!1),f(!0),R(!1),Y({status:"done"}),a&&t&&Es(ge,"oAuthAuthorization","onOAuthTokenGrant",{oAuthTokens:a,user:t}),t??void 0},initLoginWithEmail:async({email:e,captchaToken:t,disableSignup:n,withPrivyUi:a})=>{let i=new ja({email:e,captchaToken:t,disableSignup:n});r.startAuthFlow(i);try{we.current="email",j({status:"sending-code"}),await i.sendCodeEmail({withPrivyUi:a}),j({status:"awaiting-code-input"})}catch(e){throw j({status:"error",error:e}),"login"===ve.current?Es(ge,"login","onError",e.privyErrorCode||Te.UNKNOWN_AUTH_ERROR):"link"===ve.current&&Es(ge,"linkAccount","onError",e.privyErrorCode||Te.FAILED_TO_LINK_ACCOUNT,{linkMethod:"email"}),e}},initUpdateEmail:async({oldAddress:e,newAddress:t,captchaToken:n})=>{let a=new Va(e,t,n);r.startAuthFlow(a);try{await a.sendCodeEmail({withPrivyUi:!0})}catch(e){Es(ge,"update","onError",e.privyErrorCode||Te.UNKNOWN_AUTH_ERROR,{linkMethod:we.current})}},initUpdatePhone:async(e,t,n)=>{let a=new ii(e,t,n);r.startAuthFlow(a);try{await a.sendSmsCode({withPrivyUi:!0})}catch(e){Es(ge,"update","onError",e.privyErrorCode||Te.UNKNOWN_AUTH_ERROR,{linkMethod:we.current})}},initLoginWithSms:async({phoneNumber:e,captchaToken:t,disableSignup:n,withPrivyUi:a})=>{H({status:"sending-code"});let i=new ri({phoneNumber:e,captchaToken:t,disableSignup:n});r.startAuthFlow(i);try{we.current="sms",await i.sendSmsCode({withPrivyUi:a}),H({status:"awaiting-code-input"})}catch(e){throw H({status:"error",error:e}),"login"===ve.current?Es(ge,"login","onError",e.privyErrorCode||Te.UNKNOWN_AUTH_ERROR):"link"===ve.current&&Es(ge,"linkAccount","onError",e.privyErrorCode||Te.FAILED_TO_LINK_ACCOUNT,{linkMethod:"sms"}),e}},resendEmailCode:async()=>{await(r.authFlow?.sendCodeEmail({withPrivyUi:!0}))},resendSmsCode:async()=>{await(r.authFlow?.sendSmsCode({withPrivyUi:!0}))},loginWithCode:async e=>{let t,n;function a(e){r.authFlow instanceof ja?j(e):r.authFlow instanceof ri&&H(e)}if(a({status:"submitting-code"}),!m){let e=new Mt;throw a({status:"error",error:e}),e}if(r.authFlow instanceof ja)r.authFlow.meta.emailCode=e.trim();else{if(!(r.authFlow instanceof ri)){let e=new pe("Must initialize a passwordless code flow first");throw a({status:"error",error:e}),e}r.authFlow.meta.smsCode=e.trim()}let i=await Tk();if("link"===ve.current)try{({user:t}=await r.link())}catch(e){throw a({status:"error",error:e}),Es(ge,"linkAccount","onError",e.privyErrorCode||Te.FAILED_TO_LINK_ACCOUNT,{linkMethod:we.current}),e}else if("update"===ve.current)try{({user:t}=await r.link())}catch(e){throw a({status:"error",error:e}),Es(ge,"update","onError",e.privyErrorCode||Te.FAILED_TO_UPDATE_ACCOUNT,{linkMethod:we.current}),e}else try{({user:t,isNewUser:n}=await r.authenticate())}catch(e){throw a({status:"error",error:e}),Es(ge,"login","onError",e.privyErrorCode||Te.UNKNOWN_AUTH_ERROR),e}let o=t||T;x(o||null),W(n||!1),f(!0),a({status:"done"});let s=null;return r.authFlow instanceof ja?s=o?.linkedAccounts.find((({type:e})=>"email"===e))||null:r.authFlow instanceof ri&&(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 a=await r.generateSiweNonce({address:e,captchaToken:n});return K({status:"awaiting-signature"}),Xr({address:e,chainId:t.replace("eip155:",""),nonce:a})},generateSiweMessageForSmartWallet:async({address:e,chainId:t})=>{let n=await r.generateSiweNonce({address:e});return Xr({address:e,chainId:t.replace("eip155:",""),nonce:n})},linkSmartWallet:async({message:e,signature:t,smartWalletType:n})=>{let a;a=await r.linkSmartWallet({message:e,signature:t,smartWalletType:n}),x((a=await qe.refreshSessionAndUser()??a)||T||null)},loginWithSiwe:async({message:e,signature:t,captchaToken:n,disableSignup:a})=>{let i,o=null;try{if(T)throw Error("User already authenticated");let s=new ei(r,void 0,n,a,{message:e,signature:t});r.startAuthFlow(s),we.current="siwe",ve.current="login",K({status:"submitting-signature"});let l=await r.authenticate();if(({user:o,isNewUser:i}=l),!o)throw Error("Authentication failed - no user returned")}catch(e){throw Es(ge,"login","onError",e.privyErrorCode||Te.UNKNOWN_AUTH_ERROR),K({status:"error",error:e}),e}return x(o),W(i||!1),f(!0),K({status:"done"}),ve.current=null,we.current=null,o},linkWithSiwe:async({message:e,signature:t,chainId:n,walletClientType:a,connectorType:i})=>{let o;We("siwe");let s=null;try{K({status:"submitting-signature"}),o=await r.linkWithSiwe({message:e,signature:t,chainId:n,walletClientType:a,connectorType:i}),o=await qe.refreshSessionAndUser()??o,K({status:"done"}),(s=ze(o)||null)&&Es(ge,"linkAccount","onSuccess",{user:o,linkMethod:"siwe",linkedAccount:s})}catch(e){throw Es(ge,"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||T;return x(l||null),ve.current=null,we.current=null,{user:l,linkedAccount:s}},refreshSessionAndUser:async()=>{let e=await r.getAuthenticatedUser();return f(!!e),x(e),e},walletProxy:Q,createAnalyticsEvent:({eventName:e,payload:t,timestamp:n})=>r.createAnalyticsEvent({eventName:e,payload:t,timestamp:n}),acceptTerms:async()=>{let e=await r.acceptTerms();return x(e),e},getUsdTokenPrice:e=>r.getUsdTokenPrice(e),getUsdPriceForSol:()=>r.getUsdPriceForSol(),getSplTokenMetadata:e=>r.getSplTokenMetadata(e),recoverEmbeddedWallet:async e=>new Promise((async(t,n)=>{if(!T)return void t(!0);let a=e?.address?cn(T,e.address):tn(T)||hn(T)||dn(T);if(!a||nn(a))return void t(!0);let i=await Tk();if(!i||!Q||!a)return void n(Error("Must have valid access token and Privy wallet to recover wallet"));let{entropyId:o,entropyIdVerifier:s}=Oi(T,a);try{await Q.connect({accessToken:i,entropyId:o,entropyIdVerifier:s}),t(!0)}catch(e){if(Ed(e)&&"privy"===a.recoveryMethod){let e;r.createAnalyticsEvent({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:a.address}});try{e=await Q.recover({entropyId:o,entropyIdVerifier:s,accessToken:i})}catch(e){return void n(e)}e.entropyId||n(Error("Unable to recover wallet")),r.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:a.address}}),t(!0)}else Ed(e)&&"privy"!==a.recoveryMethod&&"privy-v2"!==a.recoveryMethod?(ae({recoverWallet:{entropyId:o,entropyIdVerifier:s,onFailure:n,onSuccess:()=>t(!0)},recoveryOAuthStatus:{provider:a.recoveryMethod,action:"recover",shouldCreateEth:!1,shouldCreateSol:!1}}),ke(Cf(a.recoveryMethod))):n(e)}})),exportSolanaWallet:e=>new Promise((async(t,a)=>{if(!y||!T)return void a(Error("User must be authenticated before exporting their Privy wallet"));let i=e?.address?cn(T,e.address):sn(T),o=tn(T);if(!i||!o)return void a(new pe("User must have an embedded wallet."));let{entropyId:s,entropyIdVerifier:l}=Oi(T,i);if(!i||!o)return void a(Error("Must have a Privy wallet before exporting"));let c=nn(i);if(!await Tk()||!Q)return void a(Error("Must have valid access token to enroll in MFA"));if(!Q)return void a(Error("Must have a Privy wallet before exporting"));let d={recoveryMethod:i.recoveryMethod,connectingWalletAddress:i.address,isUnifiedWallet:c,entropyId:s,entropyIdVerifier:l,onCompleteNavigateTo:Rv,onFailure:a,shouldForceMFA:!0};mh(i)?(ae({connectWallet:d,keyExport:{appId:n.appId,appClientId:n.clientId,origin:r.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:a}}),ke(zv)):a(Error(`Export is not supported for ${i.chainType} wallets`))})),setReadyToTrue:e=>{g(!0),re?.(e)},updateWallets:()=>Fe(),fundWallet:async(e,t)=>{ae({funding:Pv({address:e,appConfig:ee,fundWalletConfig:t,methodScreen:Iv})}),ke(Iv)},openModal:ke,requestFarcasterSignerStatus:async e=>{let t=await Tk(),n=T?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!t)throw Error("Must have valid access token to connect with Farcaster");if(!Q||!n)throw Error("Must have an embedded wallet to use Farcaster signers");if(!T?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");let a=await r.requestFarcasterSignerStatus(e);return"approved"===a.status&&x(await r.getAuthenticatedUser()||T||null),a},connectCoinbaseSmartWallet:async()=>{ee.externalWallets.coinbaseWallet.config.preference={...ee.externalWallets.coinbaseWallet.config.preference,options:"smartWalletOnly"};let e=r.connectors?.findWalletConnector("coinbase_wallet","coinbase_smart_wallet")||r.connectors?.findWalletConnector("coinbase_wallet","coinbase_wallet");if(e)return e.updateConnectionPreference("smartWalletOnly"),Ee(e);await Se("coinbase_wallet","coinbase_smart_wallet")},connectBaseAccount:async()=>{let e=r.connectors?.findWalletConnector("base_account","base_account");if(e)return Ee(e);await Se("base_account","base_account")},initiateAccountTransfer:async({nonce:e,account:t,accountType:n,externalWalletMetadata:a,telegramAuthResult:i,telegramWebAppData:o,farcasterEmbeddedAddress:s,oAuthUserInfo:l})=>{let c=await r.sendAccountTransferRequest({nonce:e,account:t,accountType:n,externalWalletMetadata:a,telegramAuthResult:i,telegramWebAppData:o,farcasterEmbeddedAddress:s,oAuthUserInfo:l});return x(c),c},inProgressAuthFlowRef:ve,inProgressLoginOrLinkMethodRef:we};Ck=qe.recoverEmbeddedWallet,bk=qe.recoverEmbeddedWallet;let Ke=s((()=>({wallets:A,ready:se&&ye})),[A,se,ye]),Ze=r.authFlow instanceof Si,Ye=!ee.headless&&ee.captchaEnabled&&!y&&(m||Ze);/*#__PURE__*/return t(mk.Provider,{value:!0,children:/*#__PURE__*/t(on.Provider,{value:He,children:/*#__PURE__*/t(Is.Provider,{value:ge,children:/*#__PURE__*/t(cd.Provider,{value:Ke,children:/*#__PURE__*/t(Ii,{...ee,children:/*#__PURE__*/e(Ot.Provider,{value:qe,children:[/*#__PURE__*/t(Vp,{children:/*#__PURE__*/e(Xo,{data:ne,setModalData:ae,setInitialScreen:O,initialScreen:U,authenticated:y,open:p,children:[n.children,/*#__PURE__*/t(uk,{customAuth:ee.customAuth}),Ye&&/*#__PURE__*/t(Ts,{delayedExecution:!1}),/*#__PURE__*/t(rh,{}),/*#__PURE__*/t(wb,{}),/*#__PURE__*/t(Bd,{theme:{...ee.appearance.palette||{}}}),!ee.render.standalone&&/*#__PURE__*/t(Gd,{open:p})]})}),/*#__PURE__*/t(uh,{appId:n.appId,appClientId:n.clientId,clientAnalyticsId:r.clientAnalyticsId,origin:r.apiUrl,mfaMethods:T?.mfaMethods,mfaPromise:he,mfaSubmitPromise:ue,onLoad:X,onLoadFailed:()=>null}),ee.loginConfig.telegramAuthConfiguration&&
29
29
  /*#__PURE__*/t(Bs,{$if:!0,children:/*#__PURE__*/t(Xd,{scriptHost:n.apiUrl||ar,botUsername:ee.loginConfig.telegramAuthConfiguration.botName})})]})})})})})})};export{Pd as $,rl as A,hl as B,Ai as C,dk as D,tk as E,Ti as F,hs as G,gh as H,Cl as I,yh as J,Nk as K,xl as L,Ld as M,kk as N,Ts as O,El as P,as as Q,qi as R,ol as S,il as T,Va as U,Ji as V,Ir as W,$f as X,Rd as Y,Db as Z,Md as _,Oi as a,LC as a$,Nd as a0,sr as a1,bs as a2,ms as a3,bb as a4,Ms as a5,Bf as a6,$C as a7,zf as a8,Gd as a9,rw as aA,qm as aB,yf as aC,Km as aD,cm as aE,Jm as aF,rg as aG,ig as aH,dg as aI,ag as aJ,Qm as aK,Ka as aL,og as aM,ng as aN,Io as aO,Wf as aP,oc as aQ,IC as aR,zC as aS,_C as aT,um as aU,gm as aV,ni as aW,ti as aX,Pf as aY,Wv as aZ,Iv as a_,Ng as aa,Gf as ab,jr as ac,pi as ad,Zp as ae,$m as af,Sf as ag,_f as ah,ql as ai,xs as aj,qs as ak,Il as al,eg as am,Vi as an,tg as ao,Ao as ap,vh as aq,Jf as ar,Nf as as,fw as at,Tf as au,iw as av,Gm as aw,hw as ax,Ym as ay,eh as az,_i as b,zv as b0,mb as b1,Jo as c,Gr as d,es as e,Dd as f,Tk as g,vb as h,Js as i,Bb as j,sl as k,Ks as l,Hb as m,$b as n,Go as o,Ns as p,Df as q,eu as r,Jr as s,cs as t,Ss as u,nu as v,dd as w,di as x,ds as y,pk as z};