@privy-io/react-auth 2.6.0 → 2.6.1-beta-20250303201149

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.
Files changed (26) hide show
  1. package/dist/cjs/abstract-smart-wallets.js +1 -1
  2. package/dist/cjs/{importWallet-D3s13-Ir.js → importWallet-LQE8HtVR.js} +1 -1
  3. package/dist/cjs/index.js +3 -3
  4. package/dist/cjs/{prepareFundingModalData-CT2XWfw3.js → prepareFundingModalData-kgmPUSJA.js} +1 -1
  5. package/dist/cjs/{smart-wallets-BggeovZV.js → smart-wallets-Cf57fLbv.js} +1 -1
  6. package/dist/cjs/smart-wallets.js +1 -1
  7. package/dist/cjs/solana.js +1 -1
  8. package/dist/cjs/ui.js +1 -1
  9. package/dist/cjs/{useActiveWallet-mT7IempW.js → useActiveWallet-Bj7XKToL.js} +4 -4
  10. package/dist/cjs/{useFundWallet-C1OiqVXT.js → useFundWallet-254tdw4L.js} +1 -1
  11. package/dist/cjs/{useWallets-qEcpULZl.js → useWallets-gySyQtio.js} +1 -1
  12. package/dist/dts/index.d.mts +2 -1
  13. package/dist/dts/index.d.ts +2 -1
  14. package/dist/esm/abstract-smart-wallets.mjs +1 -1
  15. package/dist/esm/{importWallet-Db-TmI57.mjs → importWallet-Uu69TNjx.mjs} +1 -1
  16. package/dist/esm/index.mjs +1 -1
  17. package/dist/esm/{prepareFundingModalData-kNpmfOTp.mjs → prepareFundingModalData-CXdNZxUD.mjs} +1 -1
  18. package/dist/esm/{smart-wallets-BF48FIHR.mjs → smart-wallets-BlXI_KVi.mjs} +1 -1
  19. package/dist/esm/smart-wallets.mjs +1 -1
  20. package/dist/esm/solana.mjs +1 -1
  21. package/dist/esm/ui.mjs +1 -1
  22. package/dist/esm/{useActiveWallet-C89-c9e3.mjs → useActiveWallet-Da0rUaE_.mjs} +3 -3
  23. package/dist/esm/{useFundWallet-DYXHQOzn.mjs → useFundWallet-u-s0pC_r.mjs} +1 -1
  24. package/dist/esm/useWallets-Dclt9ieV.mjs +1 -0
  25. package/package.json +2 -2
  26. package/dist/esm/useWallets-DhD2VeRF.mjs +0 -1
@@ -1,4 +1,4 @@
1
- import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{createStore as r}from"mipd";import a,{useMemo as i,useEffect as o,useState as s,useRef as l,useCallback as c,useReducer as d,forwardRef as u,useContext as h,createContext as p}from"react";import*as m from"react-device-detect";import{isMobile as y,isIOS as f,isSafari as w,isAndroid as v}from"react-device-detect";import{getAddress as C,isAddress as E}from"viem/utils";import{P as T,f as b,a as A,b as _,c as k,d as I,e as N,u as x,g as S,h as R,i as O,j as M,n as P,k as L,I as D}from"./internal-context-mSHyF0Gq.mjs";import{c as U,p as F,a as B,b as z,u as H,f as V,d as $,e as j,g as G,h as q,o as K,i as Y,j as Z,k as J,l as Q,m as X,n as ee,q as te,r as ne,s as re,t as ie,v as oe,w as se,x as le,y as ce,z as de,A as ue,B as he,C as pe,D as me,E as ye,F as ge,G as fe,H as we,I as ve,J as Ce,K as Ee,L as Te,M as be,N as Ae,O as _e,P as ke,Q as Ie,R as Ne,S as xe,T as Se,U as Re,V as Oe,W as We,X as Me,Y as Pe,Z as Le,_ as De,$ as Ue,a0 as Fe,a1 as Be,a2 as ze,a3 as He,a4 as Ve,a5 as $e}from"./paths-Q47X90aK.mjs";import{o as je,R as Ge,C as qe,E as Ke,P as Ye,t as Ze,g as Je,a as Qe,B as Xe,d as et,i as tt,W as nt,b as rt,S as at,u as it,M as ot,c as st,A as lt,e as ct,f as dt,s as ut,H as ht,h as pt,F as mt,j as yt,k as gt,l as ft,m as wt,n as vt,p as Ct,T as Et,q as Tt,r as bt,v as At,w as _t,x as kt,y as It,z as Nt,D as xt,G as St,I as Rt,J as Ot,K as Wt,L as Mt,N as Pt,O as Lt,Q as Dt,U as Ut,V as Ft,X as Bt,Y as zt,Z as Ht,_ as Vt,$ as $t,a0 as jt,a1 as Gt,a2 as qt,a3 as Kt,a4 as Yt,a5 as Zt,a6 as Jt,a7 as Qt,a8 as Xt,a9 as en,aa as tn,ab as nn,ac as rn,ad as an,ae as on,af as sn,ag as ln,ah as cn,ai as dn,aj as un,ak as hn,al as pn,am as mn,an as yn,ao as gn,ap as fn,aq as wn,ar as vn,as as Cn,at as En,au as Tn,av as bn,aw as An,ax as _n,ay as kn,az as In,aA as Nn,aB as xn,aC as Sn,aD as Rn,aE as On,aF as Wn,aG as Mn}from"./useActiveWallet-C89-c9e3.mjs";export{aK as useActiveWallet,aI as useConnectWallet,aJ as useFundWallet,aH as useLogin}from"./useActiveWallet-C89-c9e3.mjs";import*as Pn from"jose";import{base64url as Ln}from"jose";import{g as Dn,C as Un,H as Fn,O as Bn,S as zn,D as Hn,a as Vn,b as $n,c as jn,d as Gn,V as qn,e as Kn,P as Yn,R as Zn,f as Jn,h as Qn,i as Xn,j as er,k as tr,l as nr,I as rr,m as ar,n as ir,o as or,p as sr,u as lr,M as cr,q as dr,r as ur,s as hr,t as pr,v as mr,w as yr,x as gr,W as fr,y as wr,z as vr,A as Cr,B as Er,E as Tr,F as br,G as Ar,J as _r,K as kr,L as Ir,N as Nr,Q as xr,T as Sr,U as Rr,X as Or,Y as Wr,Z as Mr,_ as Pr,$ as Lr,a0 as Dr,a1 as Ur,a2 as Fr,a3 as Br,a4 as zr,a5 as Hr,a6 as Vr,a7 as $r,a8 as jr,a9 as Gr,aa as qr,ab as Kr}from"./useWallets-DhD2VeRF.mjs";export{ac as SUPPORTED_CHAINS,ae as addPrivyRpcToChain,ad as addRpcUrlOverrideToChain}from"./useWallets-DhD2VeRF.mjs";import{e as Yr,i as Zr,f as Jr,S as Qr,a as Xr,l as ea,u as ta,C as na,b as ra,c as aa,O as ia,d as oa,g as sa,h as la,P as ca,j as da,k as ua,m as ha,n as pa,p as ma,o as ya,q as ga,r as fa,s as wa,t as va,v as Ca}from"./prepareFundingModalData-kNpmfOTp.mjs";export{W as WalletConnector}from"./prepareFundingModalData-kNpmfOTp.mjs";import{v4 as Ea}from"uuid";import Ta from"eventemitter3";import{CoinbaseWalletSDK as ba}from"@coinbase/wallet-sdk";import{isHex as Aa,toHex as _a,createPublicClient as ka,http as Ia,createWalletClient as Na,custom as xa,publicActions as Sa,formatUnits as Ra,parseEther as Oa,encodeFunctionData as Wa,isAddress as Ma,decodeFunctionData as Pa,decodeAbiParameters as La,formatEther as Da,hexToString as Ua,zeroAddress as Fa,getAddress as Ba,parseSignature as za}from"viem";import{g as Ha,a as Va}from"./getPublicClient-wHgCncHx.mjs";import{ofetch as $a}from"ofetch";import ja from"js-cookie";import{create as Ga}from"zustand";import{Turnstile as qa}from"@marsidev/react-turnstile";import{styled as Ka,css as Ya,createGlobalStyle as Za}from"styled-components";import Ja from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import Qa from"@heroicons/react/24/outline/ExclamationTriangleIcon";import Xa from"@heroicons/react/24/outline/WalletIcon";import ei from"@heroicons/react/24/outline/ExclamationCircleIcon";import ti from"@heroicons/react/24/outline/Square2StackIcon";import ni from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import ri from"@heroicons/react/24/solid/DocumentCheckIcon";import ai from"@heroicons/react/20/solid/CheckIcon";import ii from"@heroicons/react/24/outline/EnvelopeIcon";import oi from"@heroicons/react/24/outline/PhoneIcon";import si from"@heroicons/react/24/solid/CheckCircleIcon";import li from"@heroicons/react/24/solid/XCircleIcon";import ci from"@heroicons/react/24/outline/CheckCircleIcon";import di from"@heroicons/react/24/outline/CloudArrowUpIcon";import ui from"@heroicons/react/24/outline/NoSymbolIcon";import hi from"fast-password-entropy";import*as pi from"secure-password-utilities";import{DEFAULT_WORDLIST as mi}from"secure-password-utilities/wordlists";import yi from"@heroicons/react/24/outline/ArrowPathIcon";import gi from"@heroicons/react/24/outline/EyeIcon";import fi from"@heroicons/react/24/outline/EyeSlashIcon";import wi from"@heroicons/react/24/outline/KeyIcon";import vi from"@heroicons/react/24/outline/ArrowDownTrayIcon";import Ci from"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import Ei from"@heroicons/react/24/outline/DocumentDuplicateIcon";import Ti from"@heroicons/react/24/outline/UserCircleIcon";import bi from"@heroicons/react/24/solid/LockClosedIcon";import{formatWalletAddress as Ai,getCoinbaseOnRampUrl as _i,chainToMoonpayCurrency as ki,isSupportedChainIdForMoonpay as Ii,isSupportedChainIdForCoinbaseOnramp as Ni,formatTokenAmount as xi,formatWeiAmount as Si,countryCodesAndNumbers as Ri,validatePhoneNumber as Oi,phoneNumberTypingFormatter as Wi,getPlaceholderPhoneNumber as Mi,getCountryCallingCode as Pi,getPhoneCountryCodeAndNumber as Li,formatPhoneNumber as Di,toObjectKeys as Ui,lastFourDigits as Fi,SolanaClient as Bi,ProviderErrors as zi}from"@privy-io/js-sdk-core";import{Menu as Hi,MenuButton as Vi,MenuItems as $i,MenuItem as ji,Transition as Gi,Dialog as qi,TransitionChild as Ki,DialogPanel as Yi}from"@headlessui/react";import Zi from"@heroicons/react/24/outline/ChevronDownIcon";import Ji from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import Qi from"@heroicons/react/24/outline/CreditCardIcon";import Xi from"@heroicons/react/24/outline/QrCodeIcon";import eo from"@heroicons/react/24/outline/InformationCircleIcon";import to from"@heroicons/react/24/outline/ChevronRightIcon";import no from"@heroicons/react/24/outline/FingerPrintIcon";import ro from"@heroicons/react/24/outline/ClockIcon";import ao from"@heroicons/react/24/outline/TrashIcon";import io from"@heroicons/react/24/solid/CheckBadgeIcon";import oo from"@heroicons/react/24/outline/ShieldCheckIcon";import so from"@heroicons/react/24/solid/IdentificationIcon";import lo from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import co from"@heroicons/react/24/outline/MinusCircleIcon";import uo from"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import ho from"@heroicons/react/24/solid/ShieldCheckIcon";import po from"@heroicons/react/24/outline/CalendarIcon";import mo from"@heroicons/react/24/outline/GlobeAltIcon";import yo from"@heroicons/react/24/outline/LockClosedIcon";import go from"@heroicons/react/24/outline/PencilSquareIcon";import{ChevronDownIcon as fo,ArrowRightIcon as wo}from"@heroicons/react/24/outline";import vo from"@heroicons/react/24/outline/ClipboardDocumentIcon";import{i as Co}from"./importWallet-Db-TmI57.mjs";import{eip7702Actions as Eo,hashAuthorization as To}from"viem/experimental";export{g as getEmbeddedConnectedWallet}from"./getEmbeddedConnectedWallet-CSSBWE2p.mjs";import"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import"@heroicons/react/24/outline/XMarkIcon";import"@walletconnect/ethereum-provider";import"@heroicons/react/24/outline/CheckIcon";import"qrcode";import"zustand/shallow";import"zustand/traditional";import"tinycolor2";class bo{async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");try{return await this.api.post(U,{token:this.meta.token})}catch(e){throw b(e)}}async link(){throw Error("Unimplemented")}constructor(e){this.meta={token:e}}}function Ao(e){return e?{"privy-ui":"t"}:void 0}class _o{async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new T("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(F,{email:this.meta.email,code:this.meta.emailCode,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw b(e)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new T("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(B,{email:this.meta.email,code:this.meta.emailCode})}catch(e){throw b(e)}}async sendCodeEmail({email:e,captchaToken:t,withPrivyUi:n}){if(!this.api)throw new T("Auth flow has no API instance");if(e&&(this.meta.email=e),t&&(this.meta.captchaToken=t),!this.meta.email)throw new T("Email must be set when initialzing authentication.");let r=Ao(n);try{return await this.api.post(z,{email:this.meta.email,token:this.meta.captchaToken},{headers:{...r}})}catch(e){throw b(e)}}constructor({email:e,captchaToken:t,disableSignup:n}){this.meta={email:e,captchaToken:t,disableSignup:n??!1}}}class ko extends _o{async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new T("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(H,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(e){throw b(e)}}constructor(e,t,n){super({email:t,captchaToken:n}),this.meta={email:t,captchaToken:n,oldAddress:e,disableSignup:!1}}}class Io{get meta(){return this._meta}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.channelToken)throw new T("Auth flow must be initialized first");try{let e=await this.api.post(V,{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 T("No response from authentication");return e}catch(e){throw b(e)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");try{return await this.api.post($,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(e){throw b(e)}}async _startChannelOnce(){if(!this.api)throw new T("Auth flow has no API instance");let e=await this.api.post(j,{token:this.captchaToken});y&&!f&&e.connect_uri&&je(e.connect_uri,"_blank"),this._meta={...this._meta,connectUri:e.connect_uri,channelToken:e.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new T("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.channelToken)throw new T("Auth flow must be initialized first");let e=await this.api.get(G,{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 Ge(this._startChannelOnce.bind(this)),this.pollForReady=new Ge(this._pollForReady.bind(this)),this._meta.disableSignup=t}}function No(e){return crypto.getRandomValues(new Uint8Array(e))}class xo{getOrCreateGuestCredential(e){let t=Dn(e);if(Yr()){if(Zr.get(t))return Zr.get(t);{let e=Ln.encode(No(32));return Zr.put(t,e),e}}return Ln.encode(No(32))}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");try{return await this.api.post(q,{guest_credential:this.meta.guestCredential})}catch(e){throw b(e)}}async link(){throw Error("Linking is not supported for the guest flow")}constructor(e){this.meta={guestCredential:this.getOrCreateGuestCredential(e)}}}function So(){return Ln.encode(No(36))}function Ro(){return So()}async function Oo(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 Ln.encode(t)}}class Wo{addCaptchaToken(e){this.meta.captchaToken=e}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new T("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if("undefined"===this.meta.authorizationCode)throw new T("User denied confirmation during OAuth flow");let e=function(){let e=Zr.get(Un);if(!e)throw new T("Authentication error.");return e}();try{let t=await this.api.post(K,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:e,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});return Zr.del(Un),Zr.del(Fn),Zr.del(Bn),t}catch(e){let t=b(e);if(t.privyErrorCode)throw new T(t.message||"Invalid code during OAuth flow.",void 0,t.privyErrorCode);if("User denied confirmation during OAuth flow"===t.message)throw new T("Invalid code during oauth flow.",void 0,A.OAUTH_USER_DENIED);throw new T("Invalid code during OAuth flow.",void 0,A.UNKNOWN_AUTH_ERROR)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new T("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if("undefined"===this.meta.authorizationCode)throw new T("User denied confirmation during OAuth flow");let e=Zr.get(Un);if(!e)throw new T("Authentication error.");try{let t=await this.api.post(Y,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:e});return Zr.del(Un),t}catch(e){throw b(e)}}async getAuthorizationUrl(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.provider)throw new T("Provider must be set when initializing OAuth authentication.");let e=So();Zr.put(Un,e);let t=Ro();Zr.put(zn,t);let n=await Oo(e);this.meta.withPrivyUi||Zr.put(Fn,!0),this.meta.disableSignup&&Zr.put(Bn,!0);let r=Ao(this.meta.withPrivyUi);try{return await this.api.post(Z,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:n,state_code:t},{headers:{...r}})}catch(e){throw b(e)}}constructor(e){this.meta=e}}function Mo(e){return e.charAt(0).toUpperCase()+e.slice(1)}const Po=({style:n,...r})=>/*#__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},...r,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"})]}),Lo=({style:n,...r})=>/*#__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},...r,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"})})})]}),Do=({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"})}),Uo=({style:e})=>/*#__PURE__*/t(mo,{style:{color:"var(--privy-color-error)",...e}}),Fo=({style:n,...r})=>/*#__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},...r,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 Bo(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 zo({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 Ho(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 Vo(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 $o=({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 jo={google:{name:"Google",component:Fo},discord:{name:"Discord",component:Lo},github:{name:"Github",component:Do},linkedin:{name:"LinkedIn",component:zo},twitter:{name:"Twitter",component:$o},spotify:{name:"Spotify",component:Ho},instagram:{name:"Instagram",component:Bo},tiktok:{name:"Tiktok",component:Vo},apple:{name:"Apple",component:Po}};const Go=e=>e in jo?jo[e]:{name:"Unknown",component:Uo};function qo(){let e=new URLSearchParams(window.location.search),t=e.get("privy_oauth_code"),n=e.get("privy_oauth_state"),r=e.get("privy_oauth_provider");if(!t||!n||!r)return{inProgress:!1};let a=!1;try{a=!!window.opener.location.origin}catch{}return{inProgress:!0,authorizationCode:t,stateCode:n,provider:r,withPrivyUi:!Zr.get(Fn),popupFlow:null!==window.opener&&a,disableSignup:!!Zr.get(Bn)}}function Ko(){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"),Zr.del(zn),window.history.replaceState({},"",e)}class Yo{async initRegisterFlow(e){if(!this.api)throw new T("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 T("Auth flow has no API instance");this.authenticateForRegistration=!1,this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute(e)}async initLinkFlow(){if(!this.api)throw new T("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 T("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new T("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(J,{relying_party:this.meta.initRegisterResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(n)})}catch(e){if("NotAllowedError"===e.name)throw new T("Passkey request timed out or rejected by user.",void 0,A.PASSKEY_NOT_ALLOWED);throw b(e)}}async authenticate(){if(this.authenticateForRegistration)return this.register();let e=await import("@simplewebauthn/browser");if(!this.api)throw new T("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new T("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(Q,{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 T("Passkey request timed out or rejected by user.",void 0,A.PASSKEY_NOT_ALLOWED);throw b(e)}}async link(){let e=await import("@simplewebauthn/browser");if(!this.api)throw new T("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new T("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(X,{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(n)})}catch(e){if("NotAllowedError"===e.name)throw new T("Passkey request timed out or rejected by user.",void 0,A.PASSKEY_NOT_ALLOWED);throw b(e)}}async _initRegisterOnce(e){if(!this.api)throw new T("Auth flow has no API instance");let t=Ao(e);return await this.api.post(ee,{token:this.meta.captchaToken},{headers:{...t}})}async _initAuthenticateOnce(e){if(!this.api)throw new T("Auth flow has no API instance");let t=Ao(e);return await this.api.post(te,{token:this.meta.captchaToken},{headers:{...t}})}async _initLinkOnce(){if(!this.api)throw new T("Auth flow has no API instance");return await this.api.post(ne,{})}_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 Ge(this._initRegisterOnce.bind(this)),this.initAuthenticateOnce=new Ge(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new Ge(this._initLinkOnce.bind(this)),this.meta={captchaToken:e,setPasskeyAuthState:t}}}class Zo{async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new T("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(re,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw b(e)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new T("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(ie,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(e){throw b(e)}}async sendSmsCode({phoneNumber:e,captchaToken:t,withPrivyUi:n}){if(!this.api)throw new T("Auth flow has no API instance");if(e&&(this.meta.phoneNumber=e),t&&(this.meta.captchaToken=t),!this.meta.phoneNumber)throw new T("phone nNumber must be set when initialzing authentication.");let r=Ao(n);try{return await this.api.post(oe,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken},{headers:{...r}})}catch(e){throw b(e)}}constructor({phoneNumber:e,captchaToken:t,disableSignup:n}){this.meta={phoneNumber:e,captchaToken:t,disableSignup:n??!1}}}class Jo extends Zo{async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode||!this.meta.oldPhoneNumber)throw new T("Phone number, sms code, and an old phone number must be set prior to calling update.");try{return await this.api.post(se,{old_phone_number:this.meta.oldPhoneNumber,new_phone_number:this.meta.phoneNumber,code:this.meta.smsCode})}catch(e){throw b(e)}}constructor(e,t,n){super({phoneNumber:t,captchaToken:n}),this.meta={phoneNumber:t,captchaToken:n,oldPhoneNumber:e,disableSignup:!1}}}class Qo{async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");try{return await this.api.post(le,{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 b(e)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");try{return await this.api.post(ce,{telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData})}catch(e){throw b(e)}}constructor(e,t=!1){this.meta={disableSignup:!1},this.meta={captchaToken:e,disableSignup:!1},this.meta.disableSignup=t}}function Xo(e){let t={detail:"",retryable:!1};return e?.privyErrorCode===A.LINKED_TO_ANOTHER_USER&&(t.detail="This account has already been linked to another user."),e?.privyErrorCode===A.DISALLOWED_LOGIN_METHOD&&(t.detail="Login with Telegram not allowed."),e?.privyErrorCode===A.INVALID_DATA&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===A.CANNOT_LINK_MORE_OF_TYPE&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===A.INVALID_CREDENTIALS&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===A.TOO_MANY_REQUESTS&&(t.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode===A.TOO_MANY_REQUESTS&&e.message.includes("rate limit")&&(t.detail="Request limit reached for Telegram. Please wait a moment and try again."),e instanceof qe&&(t.retryable=!0,t.detail="Something went wrong. Try again."),t}function es(e){return Object.fromEntries(decodeURIComponent(e).split("&").map((e=>e.split("=").map(decodeURIComponent))))}function ts(){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 ns{static parse(e){try{return new ns(e)}catch(e){return null}}static throwIfNotWellFormedJwt(e){return Pn.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=Pn.decodeJwt(e)}}class rs extends ns{static parse(e){try{return new rs(e)}catch(e){return null}}get appId(){return this._decoded.aid?this._decoded.aid:this.audience}}const as=({style:n,...r})=>/*#__PURE__*/e("svg",{viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...n},...r,children:[/*#__PURE__*/t("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),/*#__PURE__*/t("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]});let is,os=[1,11155111,137,10,8453,84532,42161,7777777,43114,56],ss=(e,t)=>e.makeWeb3Provider({options:t});class ls extends Ke{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:"data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PScwIDAgMTAyNCAxMDI0JyBmaWxsPSdub25lJyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHN0eWxlPSdoZWlnaHQ6MjhweDt3aWR0aDoyOHB4Jz48cmVjdCB3aWR0aD0nMTAyNCcgaGVpZ2h0PScxMDI0JyBmaWxsPScjMDA1MkZGJyByeD0nMTAwJyByeT0nMTAwJz48L3JlY3Q+PHBhdGggZmlsbC1ydWxlPSdldmVub2RkJyBjbGlwLXJ1bGU9J2V2ZW5vZGQnIGQ9J00xNTIgNTEyQzE1MiA3MTAuODIzIDMxMy4xNzcgODcyIDUxMiA4NzJDNzEwLjgyMyA4NzIgODcyIDcxMC44MjMgODcyIDUxMkM4NzIgMzEzLjE3NyA3MTAuODIzIDE1MiA1MTIgMTUyQzMxMy4xNzcgMTUyIDE1MiAzMTMuMTc3IDE1MiA1MTJaTTQyMCAzOTZDNDA2Ljc0NSAzOTYgMzk2IDQwNi43NDUgMzk2IDQyMFY2MDRDMzk2IDYxNy4yNTUgNDA2Ljc0NSA2MjggNDIwIDYyOEg2MDRDNjE3LjI1NSA2MjggNjI4IDYxNy4yNTUgNjI4IDYwNFY0MjBDNjI4IDQwNi43NDUgNjE3LjI1NSAzOTYgNjA0IDM5Nkg0MjBaJyBmaWxsPSd3aGl0ZSc+PC9wYXRoPjwvc3ZnPg==",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 _("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([e[0]])}catch(e){throw Jr(e)}}updateConnectionPreference(e){this.connectionOptions=e,this.walletClientType="smartWalletOnly"===e?"coinbase_smart_wallet":"coinbase_wallet",this.proxyProvider.setWalletProvider(ss(is,this.connectionOptions))}constructor(e,t,n,r,a,i){if(super("coinbase_wallet",e,t,n),this.connectorType="coinbase_wallet",this.displayName="Coinbase Wallet",this.proxyProvider=new Ye(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.connectionOptions=r.coinbaseWallet.connectionOptions??"all",this.walletClientType="smartWalletOnly"===this.connectionOptions?"coinbase_smart_wallet":"coinbase_wallet","coinbase_smart_wallet"===this.walletClientType&&(this.displayName="Coinbase Smart Wallet"),!is){let n=[t.id].concat(e.map((e=>e.id))),r="eoaOnly"!==this.connectionOptions?n.filter((e=>!os.includes(e))):[];r.length>0&&!r.every((e=>Hn.has(e)))&&console.info(`The configured chains are not supported by Coinbase Smart Wallet: ${r.join(", ")}`),is=new ba({appName:a,appLogoUrl:i,appChainIds:n})}this.proxyProvider.setWalletProvider(ss(is,this.connectionOptions))}}const cs=({...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 ds extends Ke{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:[Ze(e?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:cs,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}constructor({provider:e,chains:t,defaultChain:n,rpcConfig:r,imported:a,walletIndex:i}){super("privy",t,n,r),this.connectorType="embedded",this.proxyProvider=e,this.walletIndex=i,a&&(this.connectorType="embedded_imported"),this.subscribeListeners()}}const us=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4","csw_signUserOperation","secp256k1_sign"];let hs={0:"legacy",1:"eip2930",2:"eip1559",3:"eip4844"};const ps={legacy:0,eip2930:1,eip1559:2,eip4844:3};let ms=e=>void 0!==e?BigInt(e):void 0;function ys(e){let t,{type:n=2,...r}=e;r.accessList&&Array.isArray(r.accessList)?t=r.accessList.map((e=>Array.isArray(e)?{address:e[0],storageKeys:e[1]}:e)):r.accessList&&(t=Object.entries(r.accessList).map((e=>({address:e[0],storageKeys:e[1]}))));let a=Number(r.chainId??1),i=Aa(r.data)?r.data:r.data?_a(Uint8Array.from(r.data)):void 0,o=r.nonce?Number(r.nonce):void 0,s={chainId:a,data:i,nonce:o,value:ms(r.value),gas:ms(r.gas??r.gasLimit)},l=Number(n);if(0===l)return{...r,type:hs[l],...s,gasPrice:ms(r.gasPrice),accessList:void 0,maxFeePerGas:void 0,maxPriorityFeePerGas:void 0};if(1===l)return{...r,type:hs[l],...s,gasPrice:ms(r.gasPrice),accessList:t,maxFeePerGas:void 0,maxPriorityFeePerGas:void 0};if(2===l)return{...r,type:hs[l],...s,nonce:o,accessList:t,maxFeePerGas:ms(r.maxFeePerGas),maxPriorityFeePerGas:ms(r.maxPriorityFeePerGas),gasPrice:void 0,maxFeePerBlobGas:void 0};throw new T(`Unsupported transaction type: ${n}`)}class gs extends Error{constructor(e,t,n){super(e),this.code=t,this.data=n}}class fs extends Ta{async handleSendTransaction(e){if(!e.params||!Array.isArray(e.params))throw new gs(`Invalid params for ${e.method}`,4200);let t=e.params[0];if(!await rw()||!this.address)throw new gs("Disconnected",4900);let{hash:n}=await sw(t,{address:this.address});return n}async handleSignTransaction(e){if(!e.params||!Array.isArray(e.params))throw new gs(`Invalid params for ${e.method}`,4200);let t=e.params[0];if(!await rw()||!this.address)throw new gs("Disconnected",4900);let{signature:n}=await ow(t,{address:this.address});return n}handleSwitchEthereumChain(e){let t;if(!e.params||!Array.isArray(e.params))throw new gs(`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 gs(`Invalid params for ${e.method}`,4200);t=e.params[0].chainId}this.chainId=Number(t),this.publicClient=Ha(this.chainId,this.chains,this.rpcConfig,{appId:this.appId}),this.emit("chainChanged",t)}async handlePersonalSign(e){if(!e.params||!Array.isArray(e.params))throw Error("Invalid params for personal_sign");let t=e.params[0],n=e.params[1],{signature:r}=await aw({message:t},{address:n});return r}async handleSignedTypedData(e){if(!e.params||!Array.isArray(e.params))throw Error("Invalid params for eth_signTypedData_v4");let t=e.params[0],n="string"==typeof e.params[1]?JSON.parse(e.params[1]):e.params[1],{signature:r}=await iw(Je(n),{address:t});return r}async handleEstimateGas(e){if(!e.params||!Array.isArray(e.params))throw Error("Invalid params for eth_estimateGas");delete e.params[0].gasPrice,delete e.params[0].maxFeePerGas,delete e.params[0].maxPriorityFeePerGas;let t={...e.params[0],chainId:Ze(this.chainId)};return await this.publicClient.estimateGas({account:t.from??this.address,...ys(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 Ze(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=>us.includes(e))(e.method))return this.publicClient.request({method:e.method,params:e.params});{let t=await rw();if(await lw(),!t||!this.address)throw new gs("Disconnected",4900);try{return(await this.walletProxy.rpc({accessToken:t,entropyId:this.entropyId,entropyIdVerifier:this.entropyIdVerifier,chainType:"ethereum",hdWalletIndex:this.walletIndex,request:{method:e.method,params:e.params}})).response.data}catch(e){throw console.error(e),new gs("Disconnected",4900)}}}constructor({walletProxy:e,address:t,entropyId:n,entropyIdVerifier:r,rpcConfig:a,chains:i,appId:o,chainId:s=1,walletIndex:l}){super(),this.walletProxy=e,this.address=t,this.entropyId=n,this.entropyIdVerifier=r,this.chainId=s,this.rpcConfig=a,this.chains=i,this.publicClient=Ha(s,this.chains,a,{appId:o}),this.rpcTimeoutDuration=Qe(a,"privy"),this.appId=o,this.walletIndex=l}}class ws extends Ke{get walletBranding(){return{id:this.id,name:this.name,icon:this.icon}}async initialize(){this.initialized=!0,this.emit("initialized")}async connect(){throw Error("connect called for an uninstalled wallet via the EthereumNullConnector")}disconnect(){throw Error("disconnect called for an uninstalled wallet via the EthereumNullConnector")}promptConnection(e){throw Error(`promptConnection called for an uninstalled wallet via the EthereumNullConnector for ${e}`)}constructor({id:e,name:t,icon:n,walletClientType:r,defaultChain:a}){super(r,[],a,{}),this.connectorType="null",this.proxyProvider=new Ye(void 0,Vn),this.id=e,this.name=t,this.icon=n,this.connectorType=r}}const vs=({style:n,...r})=>/*#__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},...r,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"})]}),Cs=({style:n,...r})=>/*#__PURE__*/e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"108",height:"108",viewBox:"0 0 108 108",fill:"none",style:{height:"28px",width:"28px",...n},...r,children:[/*#__PURE__*/t("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),/*#__PURE__*/t("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M46.5267 69.9229C42.0054 76.8509 34.4292 85.6182 24.348 85.6182C19.5824 85.6182 15 83.6563 15 75.1342C15 53.4305 44.6326 19.8327 72.1268 19.8327C87.768 19.8327 94 30.6846 94 43.0079C94 58.8258 83.7355 76.9122 73.5321 76.9122C70.2939 76.9122 68.7053 75.1342 68.7053 72.314C68.7053 71.5783 68.8275 70.7812 69.0719 69.9229C65.5893 75.8699 58.8685 81.3878 52.5754 81.3878C47.993 81.3878 45.6713 78.5063 45.6713 74.4598C45.6713 72.9884 45.9768 71.4556 46.5267 69.9229ZM83.6761 42.5794C83.6761 46.1704 81.5575 47.9658 79.1875 47.9658C76.7816 47.9658 74.6989 46.1704 74.6989 42.5794C74.6989 38.9885 76.7816 37.1931 79.1875 37.1931C81.5575 37.1931 83.6761 38.9885 83.6761 42.5794ZM70.2103 42.5795C70.2103 46.1704 68.0916 47.9658 65.7216 47.9658C63.3157 47.9658 61.233 46.1704 61.233 42.5795C61.233 38.9885 63.3157 37.1931 65.7216 37.1931C68.0916 37.1931 70.2103 38.9885 70.2103 42.5795Z",fill:"#FFFDF8"})]});function Es(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var Ts=0;class bs extends Ke{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 _("Unable to retrieve accounts");await this.syncAccounts([e[0]])}catch(e){throw Jr(e)}}constructor(e,t,n,r,a){super(a||"unknown",e,t,n),this.connectorType="injected",this.proxyProvider=new Ye(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=r;let i=r.provider;this.proxyProvider.setWalletProvider(i)}}var As="__private_"+Ts+++"__walletBranding";class _s extends Ke{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 Es(this,As)[As]??{name:"Browser Extension",icon:Xe,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 _("Unable to retrieve accounts");await this.syncAccounts([e[0]])}catch(e){throw Jr(e)}}constructor(e,t,n,r,a){super(a??"unknown",e,t,n),Object.defineProperty(this,As,{writable:!0,value:void 0}),this.connectorType="injected",this.proxyProvider=new Ye(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(r),"metamask"===a?Es(this,As)[As]={name:"MetaMask",icon:vs,id:"io.metamask"}:"phantom"===a&&(Es(this,As)[As]={name:"Phantom",icon:Cs,id:"phantom"})}}class ks extends bs{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{y||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 _("Unable to retrieve accounts");await this.syncAccounts([e[0]])}catch(e){throw Jr(e)}}}const Is=["metamask","phantom","brave_wallet","rainbow","uniswap_wallet_extension","uniswap_extension","rabby_wallet","bybit_wallet","ronin_wallet","crypto.com_wallet_extension","crypto.com_onchain","coinbase_wallet","coinbase_smart_wallet","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","privy","unknown","phantom","solflare","glow","backpack"],Ns=Object.freeze({phantom:{client:"phantom",name:"Phantom",installLink:m.isFirefox?"https://addons.mozilla.org/en-US/firefox/addon/phantom-app/":"https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa?hl=en",chainTypes:["ethereum","solana"],get isInstalled(){if("phantom"in window){let e=window;if(e?.phantom?.ethereum?.isPhantom&&e?.phantom?.ethereum?.chainId||e?.phantom?.solana?.isPhantom)return!0}return!1},getMobileRedirect({useUniversalLink:e,isSolana:t,connectOnly:n}){let r=Ss({client:this.client,isSolana:t,connectOnly:n});return`${e?"phantom://":"https://phantom.app/ul/"}browse/${r}?ref=${r}`}},solflare:{client:"solflare",name:"Solflare",installLink:m.isFirefox?"https://addons.mozilla.org/es/firefox/addon/solflare-wallet/":"https://chromewebstore.google.com/detail/solflare-wallet/bhhhlbepdkbapadjdnnojkbgioiodbic",chainTypes:["solana"],get isInstalled(){return"solflare"in window&&!!window?.solflare?.isSolflare},getMobileRedirect({useUniversalLink:e,isSolana:t,connectOnly:n}){let r=Ss({client:this.client,isSolana:t,connectOnly:n});return`${e?"solflare://ul/v1/":"https://solflare.com/ul/v1/"}browse/${r}?ref=${r}`}},backpack:{client:"backpack",name:"Backpack",installLink:"https://chromewebstore.google.com/detail/backpack/aflkmfhebedbjioipglgcbcmnbpgliof",chainTypes:["ethereum","solana"],get isInstalled(){return!(!("backpack"in window)||!window?.backpack?.ethereum?.isBackpack&&!window?.backpack?.solana?.isBackpack)},getMobileRedirect({useUniversalLink:e,isSolana:t,connectOnly:n}){let r=Ss({client:this.client,isSolana:t,connectOnly:n});return`${e?"backpack://ul/v1/":"https://backpack.com/ul/v1/"}browse/${r}?ref=${r}`}},okx_wallet:{client:"okx_wallet",name:"OKX Wallet",installLink:"https://chromewebstore.google.com/detail/okx-wallet/mcohilncbfahbmgdjkbpemcciiolgcge",chainTypes:["solana"],get isInstalled(){return"okxwallet"in window&&!!window?.okxwallet?.isOkxWallet},getMobileRedirect({isSolana:e,connectOnly:t}){return"https://www.okx.com/download?deeplink="+encodeURIComponent("okx://wallet/dapp/url?dappUrl="+Ss({client:this.client,isSolana:e,connectOnly:t}))}}});function xs({connectorType:e,walletClientType:t}){for(let n of Is)if(e===n||t===n)return Ns[n]}function Ss({client:e,isSolana:t,connectOnly:n}){let r=new URL(window.location.href);return r.searchParams.set("privy_connector",t?"solana_adapter":"injected"),r.searchParams.set("privy_wallet_client",e),r.searchParams.set("privy_connect_only",String(n)),encodeURIComponent(r.href.replace(/\/$/g,""))}class Rs extends Qr{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 Ye(void 0,Vn),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}}class Os extends Ta{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)return;e&&this.removeAllConnectors(),Zr.get($n)&&(Zr.getKeys().forEach((e=>{e.startsWith("walletconnect")&&Zr.del(e)})),Zr.del($n));let t=et({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"}),Object.values(Ns)))!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 Rs({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(tt).find((t=>t.connectorType===e))??null:this.walletConnectors.filter(tt).find((n=>n.connectorType===e&&n.walletClientType===t))??null}findSolanaWalletConnector(e){return this.walletConnectors.filter(Xr).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.saveConnectionHistory(),this.emit("walletsUpdated"),this.emit("connectorInitialized")}onWalletsUpdated(e){e.initialized&&(this.saveConnectionHistory(),this.emit("walletsUpdated"))}addEmbeddedWalletConnectors({walletProxy:e,rootWallet:t,embeddedWallets:n,defaultChain:r,appId:a}){for(let i of n){let n=this.findEmbeddedWalletConnectors().find((e=>e.walletIndex===i.walletIndex));if(n&&tt(n))n.proxyProvider.walletProxy=e;else{let{entropyId:n,entropyIdVerifier:o}=jn(t),s=new ds({provider:new fs({walletProxy:e,address:i.address,entropyId:n,entropyIdVerifier:o,rpcConfig:this.rpcConfig,chains:this.chains,appId:a,chainId:r.id,walletIndex:i.walletIndex}),chains:this.chains,defaultChain:r,rpcConfig:this.rpcConfig,imported:!1,walletIndex:i.walletIndex});this.addWalletConnector(s)}}}addImportedWalletConnector(e,t,n,r){let a=this.findWalletConnector("embedded_imported","privy");if(a&&tt(a))a.proxyProvider.walletProxy=e;else{let a=new ds({provider:new fs({walletProxy:e,address:t,entropyId:t,entropyIdVerifier:"ethereum-address-verifier",walletIndex:0,rpcConfig:this.rpcConfig,chains:this.chains,appId:r,chainId:n.id}),chains:this.chains,walletIndex:0,defaultChain:n,rpcConfig:this.rpcConfig,imported:!0});this.addWalletConnector(a)}}removeEmbeddedWalletConnectors(){this.walletConnectors=this.walletConnectors.filter((e=>"embedded"!==e.connectorType)),this.saveConnectionHistory(),this.storedConnections=ea(),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.saveConnectionHistory(),this.storedConnections=ea(),this.emit("walletsUpdated")}}async createEthereumWalletConnector({connectorType:e,walletClientType:t,providers:n,walletConfig:r}){let a=this.findWalletConnector(e,t);if(a&&tt(a))return a instanceof nt&&a.resetConnection(t),a;let i=(()=>"injected"!==e?"coinbase_wallet"===e?new ls(this.chains,this.defaultChain,this.rpcConfig,this.externalWalletConfig,this.privyAppName,this.privyAppLogo):"null"!==e?new nt(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain,this.shouldEnforceDefaultChainOnConnect,this.privyAppId,this.privyAppName,t):r?new ws({id:r.client,name:r.name,defaultChain:this.defaultChain,walletClientType:r.client}):null:"metamask"===t&&n?.eip6963InjectedProvider?new ks(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask"):"metamask"===t&&n?.legacyInjectedProvider?new _s(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask"):"phantom"===t&&n?.legacyInjectedProvider?new _s(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom"):n?.legacyInjectedProvider&&"unknown_browser_extension"===t?new _s(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider):n?.eip6963InjectedProvider?new bs(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)}))}saveConnectionHistory(){let e=this.wallets.map((e=>({address:e.address,connectorType:e.connectorType,walletClientType:e.walletClientType,connectedAt:e.connectedAt,id:e.meta.id})));Zr.put(Gn,e)}async activeWalletSign(e){let t=this.wallets,n=t.length>0?t[0]:null;return n&&rt(n)?n.sign(e):null}setActiveWallet(e){this.activeWallet=C(e),this.emit("walletsUpdated")}setWalletList(e){this.walletList=e,this.initialized&&this.initialize(!0).catch(console.error)}removeAllConnectors(){for(let e of this.walletConnectors)e.removeAllListeners();this.walletConnectors=[]}constructor(e,t,n,r,a,i,o,s,l,c,d,u){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 Ye},this.privyAppId=e,this.walletConnectCloudProjectId=t,this.rpcConfig=n,this.chains=r,this.defaultChain=a,this.walletConnectors=[],this.initialized=!1,this.store=i,this.walletList=o,this.shouldEnforceDefaultChainOnConnect=s,this.externalWalletConfig=l,this.privyAppName=c,this.privyAppLogo=d,this.walletChainType=u||"ethereum-only",this.storedConnections=ea()}}let Ws=[de,ue,he];class Ms{async get(e,t){try{return await this.baseFetch(e,t)}catch(e){throw b(e)}}async post(e,t,n){try{return await this.baseFetch(e,{method:"POST",...t?{body:t}:{},...n})}catch(e){throw b(e)}}async delete(e,t){try{return await this.baseFetch(e,{method:"DELETE",...t})}catch(e){throw b(e)}}constructor({appId:e,appClientId:t,client:n,defaults:r}){this.appId=e,this.appClientId=t,this.clientAnalyticsId=n.clientAnalyticsId,this.sdkVersion=qn,this.client=n,this.defaults=r,this.fallbackApiUrl=n.fallbackApiUrl,this.baseFetch=$a.create({baseURL:this.defaults.baseURL,timeout:this.defaults.timeout,retry:3,retryDelay:500,retryStatusCodes:[408,409,425,500,502,503,504],credentials:"include",onRequest:async({request:e,options:t})=>{let n=new Headers(t.headers);n.set("privy-app-id",this.appId),this.appClientId&&n.set("privy-client-id",this.appClientId),n.set("privy-ca-id",this.clientAnalyticsId||""),n.set("privy-client",`react-auth:${this.sdkVersion}`);let r=Ws.includes(e.toString());if(!n.has("authorization")){let e=await this.client.getAccessToken({disableAutoRefresh:r});null!==e&&n.set("authorization",`Bearer ${e}`)}t.headers=n,t.retryDelay&&"number"==typeof t.retryDelay&&(t.retryDelay=3*t.retryDelay)},onRequestError:({error:e})=>{if(e instanceof DOMException&&"AbortError"===e.name)throw new k}})}}let Ps=/paymaster\.biconomy\.io\/api/i,Ls={mode:"SPONSORED",calculateGasLimits:!0,expiryDuration:300,sponsorshipInfo:{webhookData:{},smartAccountInfo:{name:"BICONOMY",version:"2.0.0"}}};const Ds=(e,t)=>e&&Ps.test(e)?Ls:t&&t.policy_id?{policyId:t.policy_id}:void 0;function Us(){return!(w&&window.location.origin.startsWith("http://localhost"))}const Fs=Ga((()=>({identityToken:null})));function Bs(){let{identityToken:e}=Fs();return{identityToken:e}}var zs,Hs=((zs={}).PRIVY="privy_access_token",zs.CUSTOMER="customer_access_token",zs);class Vs{get token(){return this.privyAccessToken||this.customerAccessToken}getToken(e){return"privy_access_token"===e?this.privyAccessToken:this.customerAccessToken}get customerAccessToken(){return this._getToken(Kn)}get privyAccessToken(){return this._getToken(Yn)}_getToken(e){try{let t=Zr.get(e);return"string"==typeof t?ns.throwIfNotWellFormedJwt(t):null}catch(e){return console.error(e),this.destroyLocalState(),null}}get refreshToken(){try{let e=Zr.get(Zn);return"string"==typeof e?e:null}catch(e){return console.error(e),this.destroyLocalState(),null}}getProviderAccessToken(e){try{let t=Zr.get(Jn(e));if("string"!=typeof t)return null;{let n=new ns(t);return n.isExpired()?(Zr.del(Jn(e)),null):n.value}}catch(e){return console.error(e),null}}get mightHaveServerCookies(){try{let e=ja.get(Qn);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&&this.refreshToken!==Xn;return this.mightHaveServerCookies||t&&n}hasActiveAccessToken(e){let t=ns.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?Zr.put(Jn(e),t):Zr.del(Jn(e))}updateIdentityToken(e){"string"==typeof e?this.storeIdentityToken(e):this.clearIdentityToken()}async _authenticate(e){try{let t=await e.authenticate(),{user:n,is_new_user:r,oauth_tokens:a}=t;this.handleTokenResponse(t);let i=a?{provider:a.provider,accessToken:a.access_token,accessTokenExpiresInSeconds:a.access_token_expires_in_seconds,refreshToken:a.refresh_token,refreshTokenExpiresInSeconds:a.refresh_token_expires_in_seconds,scopes:a.scopes}:void 0;return this._trackAuthenticateEvents(e,r),{user:er(n),isNewUser:r,oAuthTokens:i}}catch(e){throw console.warn("Error authenticating session"),I(e)}}_trackAuthenticateEvents(e,t){let n=function(e){return e instanceof _o?"email":e instanceof Zo?"sms":e instanceof at?"siwe":e instanceof xo?"guest":e instanceof bo?"custom_auth":e instanceof Wo?e.meta.provider:null}(e);n&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate",payload:{method:n,isNewUser:t}}),"siwe"===n&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate_siwe",payload:{connectorType:e.meta.connectorType,walletClientType:e.meta.walletClientType}})}async _link(e){try{let t=await e.link(),n=t.oauth_tokens,r=n?{provider:n.provider,accessToken:n.access_token,accessTokenExpiresInSeconds:n.access_token_expires_in_seconds,refreshToken:n.refresh_token,refreshTokenExpiresInSeconds:n.refresh_token_expires_in_seconds,scopes:n.scopes}:void 0;return{user:er(t),oAuthTokens:r}}catch(e){throw console.warn("Error linking account"),I(e)}}async _refresh(){if(!this.api)throw new T("Session has no API instance");if(!this.client)throw new T("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let e=this.token,t=this.refreshToken;if(this.client.useServerCookies&&!this.mightHaveServerCookies&&this.token&&window.location.origin===this.client.apiUrl)return this.destroyLocalState(),null;try{let n;if(!(e&&t||this.mightHaveServerCookies))return null;{let r={};e&&(r.authorization=`Bearer ${e}`),n=await this.api.post(de,t?{refresh_token:t}:{},{headers:r})}return this.handleTokenResponse(n),er(n.user)}catch(e){if(e instanceof N&&e.privyErrorCode===A.MISSING_OR_INVALID_TOKEN)return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw I(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(ue,{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=Zr.get(Kn);if(Zr.put(Kn,e),!this.client?.useServerCookies){let t=ns.parse(e)?.expiration;ja.set(tr,e,{sameSite:"Strict",secure:Us(),expires:t?new Date(1e3*t):void 0})}t!==e&&this.client?.onStoreCustomerAccessToken?.(e)}else Zr.del(Kn),ja.remove(tr),this.client?.onDeleteCustomerAccessToken?.()}storeRefreshToken(e){"string"==typeof e?(Zr.put(Zn,e),this.client?.useServerCookies||ja.set(Qn,"t",{sameSite:"Strict",secure:Us(),expires:30})):(Zr.del(Zn),ja.remove(nr),ja.remove(Qn))}storePrivyAccessToken(e){"string"==typeof e?Zr.put(Yn,e):Zr.del(Yn)}storeIdentityToken(e){if(Fs.setState({identityToken:e}),this.client?.useServerCookies)return;Zr.put(rr,e);let t=ns.parse(e)?.expiration;ja.set(ar,e,{sameSite:"Strict",secure:Us(),expires:t?new Date(1e3*t):void 0})}clearIdentityToken(){Zr.del(rr),Fs.setState({identityToken:null}),ja.remove(ar)}constructor(){this.authenticateOnce=new Ge((async e=>this._authenticate(e))),this.linkOnce=new Ge((async e=>this._link(e))),this.refreshOnce=new Ge(this._refresh.bind(this)),this.destroyOnce=new Ge(this._destroy.bind(this))}}let $s;var js=0,Gs="__private_"+js+++"__getOrGenerateClientAnalyticsId";class qs{initializeConnectorManager({walletConnectCloudProjectId:e,rpcConfig:t,chains:n,defaultChain:r,store:a,walletList:i,shouldEnforceDefaultChainOnConnect:o,externalWalletConfig:s,appName:l,walletChainType:c}){this.connectors||(this.connectors=new Os(this.appId,e,t,n,r,a,i,o,s,l,void 0,c))}generateApi(){let e=new Ms({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 T("No auth flow in progress.");return this.session.authenticate(this.authFlow)}async link(){if(!this.authFlow)throw new T("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(pe,{action:"verify"})}catch(e){throw b(e)}}async initMfaPasskeyVerification(){try{return(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}))((await this.api.post(me,{})).options)}catch(e){throw b(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(ye,{});return er(e)}catch(e){throw I(e)}}async unlinkEmail(e){try{let t=await this.api.post(ge,{address:e});return await this.getAuthenticatedUser()??er(t)}catch(e){throw I(e)}}async unlinkPhone(e){try{let t=await this.api.post(fe,{phoneNumber:e});return await this.getAuthenticatedUser()??er(t)}catch(e){throw I(e)}}async unlinkEthereumWallet(e){try{let t=await this.api.post(we,{address:e});return await this.getAuthenticatedUser()??er(t)}catch(e){throw I(e)}}async unlinkSolanaWallet(e){try{let t=await this.api.post(ve,{address:e});return await this.getAuthenticatedUser()??er(t)}catch(e){throw I(e)}}async unlinkOAuth(e,t){try{let n=await this.api.post(Ce,{provider:e,subject:t});return await this.getAuthenticatedUser()??er(n)}catch(e){throw I(e)}}async unlinkFarcaster(e){try{let t=await this.api.post(Ee,{fid:e});return await this.getAuthenticatedUser()??er(t)}catch(e){throw I(e)}}async unlinkTelegram(e){try{let t=await this.api.post(Te,{telegram_user_id:e});return await this.getAuthenticatedUser()??er(t)}catch(e){throw I(e)}}async revokeDelegatedWallet(){try{await this.api.post(be,{})}catch(e){throw I(e)}}async createAnalyticsEvent({eventName:e,payload:t,timestamp:n,options:r}){if("undefined"!=typeof window)try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(he,{event_name:e,client_id:this.clientAnalyticsId,payload:{...t||{},clientTimestamp:n?n.toISOString():(new Date).toISOString()}},{retry:-1,keepalive:r?.keepAlive??!1})}catch(e){console.log("Unable to submit event. This is not an issue.")}}async signMoonpayOnRampUrl(e){try{return this.api.post(Ae,e)}catch(e){throw I(e)}}async initCoinbaseOnRamp(e){try{return this.api.post(_e,e)}catch(e){throw I(e)}}async getCoinbaseOnRampStatus({partnerUserId:e}){try{return this.api.get(`${ke}?partnerUserId=${e}`)}catch(e){throw I(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(Hs.CUSTOMER,e)}async getPrivyAccessToken(e){return await this._getToken(Hs.PRIVY,e)}async _getToken(e,t){return this.session.getToken(e)?this.session.hasActiveAccessToken(e)?this.session.hasRefreshCredentials(e)?rs.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:Ds(e.paymaster_url,e.paymaster_context)})))}:{enabled:n.enabled}}catch(e){throw I(e)}}async getServerConfig(){try{let e={},t=this.session.token;t&&(e.authorization=`Bearer ${t}`);let n=await this.api.get(`/api/v1/apps/${this.appId}`,{baseURL:this.fallbackApiUrl,headers:e}),r=n.telegram_auth_config?{botId:n.telegram_auth_config.bot_id,botName:n.telegram_auth_config.bot_name,linkEnabled:n.telegram_auth_config.link_enabled,seamlessAuthEnabled:n.telegram_auth_config.seamless_auth_enabled}:void 0,a=n.funding_config?{methods:n.funding_config.methods,options:n.funding_config.options,defaultRecommendedAmount:n.funding_config.default_recommended_amount,defaultRecommendedCurrency:n.funding_config.default_recommended_currency,promptFundingOnWalletCreation:n.funding_config.prompt_funding_on_wallet_creation,crossChainBridgingEnabled:n.funding_config.cross_chain_bridging_enabled}:void 0;return{id:n.id,name:n.name,verificationKey:n.verification_key,logoUrl:n.logo_url||void 0,accentColor:n.accent_color||void 0,showWalletLoginFirst:n.show_wallet_login_first,allowlistConfig:{errorTitle:n.allowlist_config.error_title,errorDetail:n.allowlist_config.error_detail,errorCtaText:n.allowlist_config.cta_text,errorCtaLink:n.allowlist_config.cta_link},walletAuth:n.wallet_auth,solanaWalletAuth:n.solana_wallet_auth,emailAuth:n.email_auth,smsAuth:n.sms_auth,googleOAuth:n.google_oauth,twitterOAuth:n.twitter_oauth,discordOAuth:n.discord_oauth,githubOAuth:n.github_oauth,spotifyOAuth:n.spotify_oauth,instagramOAuth:n.instagram_oauth,tiktokOAuth:n.tiktok_oauth,linkedinOAuth:n.linkedin_oauth,appleOAuth:n.apple_oauth,farcasterAuth:n.farcaster_auth,passkeyAuth:n.passkey_auth,passkeysForSignupEnabled:n.passkeys_for_signup_enabled,telegramAuth:n.telegram_auth,disablePlusEmails:n.disable_plus_emails,termsAndConditionsUrl:n.terms_and_conditions_url,embeddedWalletConfig:{ethereum:{createOnLogin:n.embedded_wallet_config.ethereum?.create_on_login??n.embedded_wallet_config.create_on_login},solana:{createOnLogin:n.embedded_wallet_config.solana?.create_on_login??"off"},userOwnedRecoveryOptions:n.embedded_wallet_config.user_owned_recovery_options,requireUserOwnedRecoveryOnCreate:n.embedded_wallet_config.require_user_owned_recovery_on_create},privacyPolicyUrl:n.privacy_policy_url,requireUsersAcceptTerms:n.require_users_accept_terms,customApiUrl:n.custom_api_url,walletConnectCloudProjectId:n.wallet_connect_cloud_project_id,fiatOnRampEnabled:n.fiat_on_ramp_enabled,captchaEnabled:n.captcha_enabled,captchaSiteKey:n.captcha_site_key,createdAt:new Date(1e3*n.created_at),updatedAt:new Date(1e3*n.updated_at),mfaMethods:n.mfa_methods,enforceWalletUis:n.enforce_wallet_uis,legacyWalletUiConfig:n.legacy_wallet_ui_config,telegramAuthConfiguration:r,fundingConfig:a}}catch(e){throw I(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(Ie,{address:e,token:t})).nonce}catch(e){throw I(e)}}async authenticateWithSiweInternal({message:e,signature:t,chainId:n,walletClientType:r,connectorType:a,mode:i}){return await this.api.post(Ne,{message:e,signature:t,chainId:n,walletClientType:r,connectorType:a,mode:i})}async linkWithSiweInternal({message:e,signature:t,chainId:n,walletClientType:r,connectorType:a}){return await this.api.post(xe,{message:e,signature:t,chainId:n,walletClientType:r,connectorType:a})}async linkSmartWallet({message:e,signature:t,smartWalletType:n}){try{let r=await this.api.post(Se,{message:e,signature:t,smart_wallet_type:n});return er(r)}catch(e){throw I(e)}}async linkWithSiwe({message:e,signature:t,chainId:n,walletClientType:r,connectorType:a}){try{let i=await this.linkWithSiweInternal({message:e,signature:t,chainId:n,walletClientType:r,connectorType:a});return er(i)}catch(e){throw I(e)}}async generateSiwsNonce({address:e,captchaToken:t}){try{return(await this.api.post(Re,{address:e,token:t})).nonce}catch(e){throw I(e)}}async authenticateWithSiwsInternal({message:e,signature:t,walletClientType:n,connectorType:r,mode:a}){return await this.api.post(Oe,{message:e,signature:t,walletClientType:n,connectorType:r,mode:a})}async sendAccountTransferRequest({nonce:e,account:t,accountType:n,externalWalletMetadata:r,telegramAuthResult:a,telegramWebAppData:i,farcasterEmbeddedAddress:o,oAuthUserInfo:s}){try{let l,c;switch(n){case"email":l=Ue,c={nonce:e,email:t};break;case"sms":l=De,c={nonce:e,phoneNumber:t};break;case"siwe":if(l=Le,!r)throw Error("Wallet parameters must be defined");c={nonce:e,address:t,...r};break;case"farcaster":l=Pe,c={nonce:e,farcaster_id:t,farcaster_embedded_address:o};break;case"telegram":l=Me,c={nonce:e,telegram_auth_result:a,telegram_web_app_data:i};break;case"custom":case"guest":case"passkey":throw Error("Invalid transfer account type");default:l=We,c={nonce:e,userInfo:s}}let d=await this.api.post(l,c);return await this.getAuthenticatedUser()??er(d)}catch(e){throw I(e)}}async linkWithSiwsInternal({message:e,signature:t,walletClientType:n,connectorType:r}){return await this.api.post(Fe,{message:e,signature:t,walletClientType:n,connectorType:r})}async linkWithSiws({message:e,signature:t,walletClientType:n,connectorType:r}){try{let a=await this.linkWithSiwsInternal({message:e,signature:t,walletClientType:n,connectorType:r});return er(a)}catch(e){throw I(e)}}async updateUserAndIdToken(){try{let e=await this.api.get(Be);return this.session.updateIdentityToken(e.identity_token),er(e.user)}catch(e){throw I(e)}}async scanTransaction(e){try{return await this.api.post(ze,e)}catch(e){throw I(e)}}constructor({apiUrl:e=ir,appId:t,appClientId:n,timeout:r=or}){Object.defineProperty(this,Gs,{value:Ks}),this._cachedProviderAppDetails={},this.apiUrl=e,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=e!==ir&&e.startsWith("https://privy."),this.timeout=r,this.appId=t,this.appClientId=n,this.clientAnalyticsId=function(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}(this,Gs)[Gs](),$s||($s=new Vs),this.session=$s,this.api=this.generateApi(),this.session.client=this}}function Ks(){if("undefined"==typeof window)return null;try{let e=Zr.get(sr);if("string"==typeof e&&e.length>0)return e}catch(e){}let e=Ea();try{return Zr.put(sr,e),e}catch(t){return e}}const Ys=e=>{let{enabled:n,siteKey:r,appId:a,setError:s,setToken:l,setExecuting:c,ref:d}=it(),[,u]=i((()=>r?.split("t:")||[]),[r]);if(o((()=>d.current?.remove),[]),!n)return null;if(!u)throw Error("Unsupported captcha site key");/*#__PURE__*/return t("div",{className:"hidden h-0 w-0",children:/*#__PURE__*/t(qa,{...e,ref:d,siteKey:u,options:{action:a,size:"invisible",...e.delayedExecution?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{e.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{e.onError?.(),s("Captcha failed"),c(!1)},onSuccess:t=>{e.onSuccess?.(t),l(t),c(!1)},onExpire:()=>{e.onExpire?.();try{d.current?.reset(),s(void 0),l(void 0)}catch(e){s("expired_and_failed_reset")}}})})};function Zs(e){ta("configureMfa",e)}const Js=/*#__PURE__*/Ka.span.withConfig({displayName:"CircleBackground",componentId:"sc-c9f33cd-0"})(["&&{width:82px;height:82px;border-width:4px;border-style:solid;border-color:",";background-color:",";border-radius:50%;display:inline-block;box-sizing:border-box;}"],(e=>e.color??"var(--privy-color-accent)"),(e=>e.color??"var(--privy-color-accent)"));let Qs=/*#__PURE__*/Ka.div.withConfig({displayName:"StackedContainer",componentId:"sc-f7e7d474-0"})(["display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%;height:82px;> div{position:relative;}> div > span{position:absolute;left:-41px;top:-41px;}> div > :last-child{position:absolute;left:-19px;top:-19px;}"]);const Xs=/*#__PURE__*/Ka.div.withConfig({displayName:"Grow",componentId:"sc-ddbf22b4-0"})(["text-align:left;flex-grow:1;"]),el=/*#__PURE__*/Ka.div.withConfig({displayName:"AlignBottom",componentId:"sc-ddbf22b4-1"})(["display:flex;flex-direction:column;justify-content:flex-end;flex-grow:1;"]),tl=/*#__PURE__*/Ka.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;}"]),nl=/*#__PURE__*/Ka(tl).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 rl=/*#__PURE__*/Ya(["&&{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 al=/*#__PURE__*/Ka.div.withConfig({displayName:"Subtitle",componentId:"sc-ddbf22b4-4"})(["text-align:center;font-size:14px;margin-bottom:24px;"]),il=/*#__PURE__*/Ka.button.attrs({className:"login-method-button"}).withConfig({displayName:"LoginMethodButton",componentId:"sc-ddbf22b4-5"})(["",""],rl),ol=/*#__PURE__*/Ka.a.withConfig({displayName:"LoginMethodButtonLink",componentId:"sc-ddbf22b4-6"})(["",""],rl),sl=/*#__PURE__*/Ka.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;":"")),ll=/*#__PURE__*/Ka.div.withConfig({displayName:"EmptyWalletState",componentId:"sc-ddbf22b4-8"})(["width:100%;height:100%;padding:",";"],(e=>e.$withPadding?"64px 0px":"0px")),cl=/*#__PURE__*/Ka.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;}"]);let dl=/*#__PURE__*/Ka.div.withConfig({displayName:"ConnectContainer",componentId:"sc-a3e74b9e-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;width:100%;padding-bottom:16px;margin-top:24px;"]),ul=/*#__PURE__*/Ka.div.withConfig({displayName:"GappedContainer",componentId:"sc-a3e74b9e-1"})(["display:flex;flex-direction:column;gap:8px;"]);const hl=/*#__PURE__*/Ka.span.withConfig({displayName:"CircleBorder",componentId:"sc-9056b8b8-0"})(["&&{width:82px;height:82px;border-width:4px;border-style:solid;border-color:",";border-bottom-color:transparent;border-radius:50%;display:inline-block;box-sizing:border-box;animation:rotation 1.2s linear infinite;transition:border-color 800ms;border-bottom-color:",";}"],(e=>e.color??"var(--privy-color-accent)"),(e=>e.color??"var(--privy-color-accent)"));function pl(n){/*#__PURE__*/return e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...n,children:[/*#__PURE__*/t("circle",{cx:"12",cy:"12",r:"10"}),/*#__PURE__*/t("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),/*#__PURE__*/t("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]})}const ml=({onTransfer:e,isTransferring:n,transferSuccess:r})=>/*#__PURE__*/t(st,{...r?{success:!0,children:"Success!"}:{warn:!0,loading:n,onClick:e,children:"Transfer and delete account"}}),yl=/*#__PURE__*/Ka.div.withConfig({displayName:"ConnectContainer",componentId:"sc-aa2e65ff-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;width:100%;padding-bottom:16px;"]),gl=/*#__PURE__*/Ka.div.withConfig({displayName:"GappedContainer",componentId:"sc-aa2e65ff-1"})(["display:flex;flex-direction:column;&& p{font-size:14px;}width:100%;gap:16px;"]),fl=/*#__PURE__*/Ka.div.withConfig({displayName:"DisclosedAccountContainer",componentId:"sc-aa2e65ff-2"})(["display:flex;cursor:pointer;align-items:center;width:100%;border:1px solid var(--privy-color-foreground-4) !important;border-radius:var(--privy-border-radius-md);padding:8px 10px;font-size:14px;font-weight:500;gap:8px;"]),wl=/*#__PURE__*/Ka(ei).withConfig({displayName:"StyledExclamationCircleIcon",componentId:"sc-aa2e65ff-3"})(["position:relative;width:",";height:",";color:var(--privy-color-foreground-3);margin-left:auto;"],(e=>`${e.iconSize}px`),(e=>`${e.iconSize}px`)),vl=/*#__PURE__*/Ka(ti).withConfig({displayName:"StyledCopyIcon",componentId:"sc-aa2e65ff-4"})(["position:relative;width:15px;height:15px;color:var(--privy-color-foreground-3);margin-left:auto;"]),Cl=/*#__PURE__*/Ka.ol.withConfig({displayName:"ListContainer",componentId:"sc-aa2e65ff-5"})(["display:flex;flex-direction:column;font-size:14px;width:100%;text-align:left;"]),El=/*#__PURE__*/Ka.li.withConfig({displayName:"ListItem",componentId:"sc-aa2e65ff-6"})(["font-size:14px;list-style-type:auto;list-style-position:outside;margin-left:1rem;margin-bottom:0.5rem;&:last-child{margin-bottom:0;}"]),Tl=/*#__PURE__*/Ka.div.withConfig({displayName:"CircleContainer",componentId:"sc-aa2e65ff-7"})(["position:relative;width:60px;height:60px;margin:10px;display:flex;justify-content:center;align-items:center;"]);let bl=()=>/*#__PURE__*/t(Tl,{children:/*#__PURE__*/t(wl,{iconSize:60})});const Al=({address:r,onClose:a,onRetry:i,onTransfer:o,isTransferring:s,transferSuccess:l})=>{let{defaultChain:c}=dr(),d=c.blockExplorers?.default.url??"https://etherscan.io";/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(ot,{onClose:a,backFn:i}),/*#__PURE__*/e(yl,{children:[/*#__PURE__*/t(bl,{}),/*#__PURE__*/e(gl,{children:[/*#__PURE__*/t("h3",{children:"Check account assets before transferring"}),/*#__PURE__*/t("p",{children:"Before transferring, ensure there are no assets in the other account. Assets in that account will not transfer automatically and may be lost."}),/*#__PURE__*/e(Cl,{children:[/*#__PURE__*/t("p",{children:" To check your balance, you can:"}),/*#__PURE__*/t(El,{children:"Log out and log back into the other account, or "}),/*#__PURE__*/e(El,{children:["Copy your wallet address and use a"," ",/*#__PURE__*/t("u",{children:/*#__PURE__*/t("a",{target:"_blank",href:d,children:"block explorer"})})," ","to see if the account holds any assets."]})]}),/*#__PURE__*/e(fl,{onClick:()=>navigator.clipboard.writeText(r).catch(console.error),children:[/*#__PURE__*/t(Xa,{color:"var(--privy-color-foreground-1)",strokeWidth:2,height:"28px",width:"28px"}),/*#__PURE__*/t(lt,{address:r,showCopyIcon:!1}),/*#__PURE__*/t(vl,{})]}),/*#__PURE__*/t(ml,{onTransfer:o,isTransferring:s,transferSuccess:l})]})]}),/*#__PURE__*/t(ct,{})]})},_l=({onClose:r,onContinue:a,onInfo:i,onTransfer:o,transferSuccess:s,isTransferring:l,data:c})=>{if(!c?.accountTransfer?.linkMethod||!c?.accountTransfer?.displayName)return;let d={method:c?.accountTransfer?.linkMethod,handle:c?.accountTransfer?.displayName,disclosedAccount:c?.accountTransfer?.embeddedWalletAddress?{type:"wallet",handle:c?.accountTransfer?.embeddedWalletAddress}:void 0};/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(ot,{closeable:!0}),/*#__PURE__*/e(yl,{children:[/*#__PURE__*/t(Qs,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(hl,{color:"var(--privy-color-error)"}),/*#__PURE__*/t(Qa,{height:38,width:38,stroke:"var(--privy-color-error)"})]})}),/*#__PURE__*/e(gl,{children:[/*#__PURE__*/e("h3",{children:[function(e){switch(e){case"sms":return"Phone number";case"email":return"Email address";case"siwe":return"Wallet address";case"linkedin":return"LinkedIn profile";case"google":case"apple":case"discord":case"github":case"instagram":case"spotify":case"tiktok":case"twitter":case"telegram":case"farcaster":return`${Mo(e.replace("_oauth",""))} profile`;default:return e}}(d.method)," is associated with another account"]}),/*#__PURE__*/e("p",{children:["Do you want to transfer",/*#__PURE__*/t("b",{children:d.handle?` ${d.handle}`:""})," to this account instead? This will delete your other account."]}),/*#__PURE__*/t(kl,{onClick:i,disclosedAccount:d.disclosedAccount})]}),/*#__PURE__*/e(gl,{style:{gap:12,marginTop:12},children:[c?.accountTransfer?.embeddedWalletAddress?/*#__PURE__*/t(st,{onClick:a,children:"Continue"}):/*#__PURE__*/t(ml,{onTransfer:o,transferSuccess:s,isTransferring:l}),/*#__PURE__*/t(dt,{onClick:r,children:"No thanks"})]})]}),/*#__PURE__*/t(ct,{})]})};function kl({disclosedAccount:n,onClick:r}){return n?/*#__PURE__*/e(fl,{onClick:r,children:[/*#__PURE__*/t(Xa,{color:"var(--privy-color-foreground-1)",strokeWidth:2,height:"28px",width:"28px"}),/*#__PURE__*/t(lt,{address:n.handle,showCopyIcon:!1}),/*#__PURE__*/t(pl,{width:15,height:15,color:"var(--privy-color-foreground-3)",style:{marginLeft:"auto"}})]}):null}const Il=/*#__PURE__*/Ka.div.withConfig({displayName:"AppLogoContainer",componentId:"sc-a63b1990-0"})(["display:flex;flex-direction:column;align-items:center;padding:0px 0px 30px;@media (max-width:440px){padding:10px 10px 20px;}"]),Nl=/*#__PURE__*/Ka.div.withConfig({displayName:"Title",componentId:"sc-a63b1990-1"})(["font-size:18px;line-height:30px;text-align:center;font-weight:600;margin-bottom:10px;"]),xl=/*#__PURE__*/Ka.div.withConfig({displayName:"SubTitle",componentId:"sc-a63b1990-2"})(["font-size:0.875rem;text-align:center;"]),Sl=/*#__PURE__*/Ka.div.withConfig({displayName:"Container",componentId:"sc-a63b1990-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;}"]),Rl=/*#__PURE__*/Ka.div.withConfig({displayName:"List",componentId:"sc-a63b1990-4"})(["display:flex;flex-direction:column;align-items:stretch;gap:0.75rem;padding:1rem 0rem 0rem;flex-grow:1;width:100%;"]),Ol=/*#__PURE__*/Ka.div.withConfig({displayName:"ListItemIcon",componentId:"sc-a63b1990-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);}"]),Wl=/*#__PURE__*/Ka.div.withConfig({displayName:"ListItem",componentId:"sc-a63b1990-6"})(["display:flex;align-items:center;gap:10px;font-size:0.875rem;line-height:1rem;text-align:left;"]),Ml=/*#__PURE__*/Ka.div.withConfig({displayName:"BottomSection",componentId:"sc-a63b1990-7"})(["display:flex;flex-direction:column;gap:10px;padding-top:20px;"]),Pl=/*#__PURE__*/Ka.div.withConfig({displayName:"MethodList",componentId:"sc-a63b1990-8"})(["display:flex;flex-direction:column;align-items:stretch;gap:1rem;padding:1rem 0rem 0rem;flex-grow:1;width:100%;"]),Ll=/*#__PURE__*/Ka.div.withConfig({displayName:"MethodListItem",componentId:"sc-a63b1990-9"})(["display:flex;gap:5px;width:100%;position:relative;"]),Dl=/*#__PURE__*/Ka.button.withConfig({displayName:"RemoveMethodButton",componentId:"sc-a63b1990-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);}"]),Ul=/*#__PURE__*/Ka.div.withConfig({displayName:"MethodText",componentId:"sc-a63b1990-11"})(["display:flex;align-items:center;gap:0.5rem;> svg{z-index:2;height:20px !important;width:20px !important;}"]),Fl=/*#__PURE__*/Ka.div.withConfig({displayName:"ExtraText",componentId:"sc-a63b1990-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)")),Bl=/*#__PURE__*/Ka.div.withConfig({displayName:"SmsInsecureText",componentId:"sc-a63b1990-13"})(["width:100%;display:flex;justify-content:space-between;"]),zl=/*#__PURE__*/Ka.p.withConfig({displayName:"TermsText",componentId:"sc-a63b1990-14"})(["text-align:left;width:100%;color:var(--privy-color-foreground-3) !important;"]),Hl=/*#__PURE__*/Ka.button.withConfig({displayName:"PrimaryTextButton",componentId:"sc-a63b1990-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)")),Vl=/*#__PURE__*/Ka.div.withConfig({displayName:"IconWrapper",componentId:"sc-a63b1990-16"})(["display:flex;align-items:center;justify-content:center;color:var(--privy-color-accent);width:100%;> svg{z-index:2;width:3rem;height:3rem;}"]),$l=/*#__PURE__*/Ka.div.withConfig({displayName:"ErrorMessage",componentId:"sc-a63b1990-17"})(["color:var(--privy-color-error);"]),jl=({termsAndConditionsUrl:r,privacyPolicyUrl:a,onAccept:i,onDecline:o})=>/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(ot,{closeable:!1}),/*#__PURE__*/t(ri,{width:56,height:56,fill:"var(--privy-color-accent)",style:{margin:"auto"}}),/*#__PURE__*/t(Nl,{style:{marginTop:24},children:"One last step"}),/*#__PURE__*/t(xl,{children:"By signing up, you agree to our terms and privacy policy."}),/*#__PURE__*/e(tl,{style:{marginTop:24},children:[r&&/*#__PURE__*/e(ol,{target:"_blank",href:r,children:["View Terms ",/*#__PURE__*/t(ni,{style:{marginLeft:"auto"}})]}),a&&/*#__PURE__*/e(ol,{target:"_blank",href:a,children:["View Privacy Policy ",/*#__PURE__*/t(ni,{style:{marginLeft:"auto"}})]})]}),/*#__PURE__*/e(Gl,{style:{marginTop:24},children:[/*#__PURE__*/t(dt,{onClick:o,children:"No thanks"}),/*#__PURE__*/t(st,{onClick:i,children:"Accept"})]}),/*#__PURE__*/t(ct,{})]});let Gl=/*#__PURE__*/Ka.div.withConfig({displayName:"ButtonsContainer",componentId:"sc-d601b243-0"})(["display:flex;gap:10px;"]);const ql=({style:e,...n})=>/*#__PURE__*/t("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",style:{height:"1.5rem",width:"1.5rem",...e},...n,children:/*#__PURE__*/t("path",{fillRule:"evenodd",d:"M12 1.5a5.25 5.25 0 00-5.25 5.25v3a3 3 0 00-3 3v6.75a3 3 0 003 3h10.5a3 3 0 003-3v-6.75a3 3 0 00-3-3v-3c0-2.9-2.35-5.25-5.25-5.25zm3.75 8.25v-3a3.75 3.75 0 10-7.5 0v3h7.5z",clipRule:"evenodd"})});let Kl=/*#__PURE__*/Ka.div.withConfig({displayName:"ConnectContainer",componentId:"sc-ed4ecf-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;width:100%;padding-bottom:16px;"]),Yl=/*#__PURE__*/Ka.div.withConfig({displayName:"GappedContainer",componentId:"sc-ed4ecf-1"})(["display:flex;flex-direction:column;gap:8px;"]);const Zl=({title:r,description:a,children:i,...o})=>
1
+ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{createStore as r}from"mipd";import a,{useMemo as i,useEffect as o,useState as s,useRef as l,useCallback as c,useReducer as d,forwardRef as u,useContext as h,createContext as p}from"react";import*as m from"react-device-detect";import{isMobile as y,isIOS as f,isSafari as w,isAndroid as v}from"react-device-detect";import{getAddress as C,isAddress as E}from"viem/utils";import{P as T,f as b,a as A,b as _,c as k,d as I,e as N,u as x,g as S,h as R,i as O,j as M,n as P,k as L,I as D}from"./internal-context-mSHyF0Gq.mjs";import{c as U,p as F,a as B,b as z,u as H,f as V,d as $,e as j,g as G,h as q,o as K,i as Y,j as Z,k as J,l as Q,m as X,n as ee,q as te,r as ne,s as re,t as ie,v as oe,w as se,x as le,y as ce,z as de,A as ue,B as he,C as pe,D as me,E as ye,F as ge,G as fe,H as we,I as ve,J as Ce,K as Ee,L as Te,M as be,N as Ae,O as _e,P as ke,Q as Ie,R as Ne,S as xe,T as Se,U as Re,V as Oe,W as We,X as Me,Y as Pe,Z as Le,_ as De,$ as Ue,a0 as Fe,a1 as Be,a2 as ze,a3 as He,a4 as Ve,a5 as $e}from"./paths-Q47X90aK.mjs";import{o as je,R as Ge,C as qe,E as Ke,P as Ye,t as Ze,g as Je,a as Qe,B as Xe,d as et,i as tt,W as nt,b as rt,S as at,u as it,M as ot,c as st,A as lt,e as ct,f as dt,s as ut,H as ht,h as pt,F as mt,j as yt,k as gt,l as ft,m as wt,n as vt,p as Ct,T as Et,q as Tt,r as bt,v as At,w as _t,x as kt,y as It,z as Nt,D as xt,G as St,I as Rt,J as Ot,K as Wt,L as Mt,N as Pt,O as Lt,Q as Dt,U as Ut,V as Ft,X as Bt,Y as zt,Z as Ht,_ as Vt,$ as $t,a0 as jt,a1 as Gt,a2 as qt,a3 as Kt,a4 as Yt,a5 as Zt,a6 as Jt,a7 as Qt,a8 as Xt,a9 as en,aa as tn,ab as nn,ac as rn,ad as an,ae as on,af as sn,ag as ln,ah as cn,ai as dn,aj as un,ak as hn,al as pn,am as mn,an as yn,ao as gn,ap as fn,aq as wn,ar as vn,as as Cn,at as En,au as Tn,av as bn,aw as An,ax as _n,ay as kn,az as In,aA as Nn,aB as xn,aC as Sn,aD as Rn,aE as On,aF as Wn,aG as Mn}from"./useActiveWallet-Da0rUaE_.mjs";export{aK as useActiveWallet,aI as useConnectWallet,aJ as useFundWallet,aH as useLogin}from"./useActiveWallet-Da0rUaE_.mjs";import*as Pn from"jose";import{base64url as Ln}from"jose";import{g as Dn,C as Un,H as Fn,O as Bn,S as zn,D as Hn,a as Vn,b as $n,c as jn,d as Gn,V as qn,e as Kn,P as Yn,R as Zn,f as Jn,h as Qn,i as Xn,j as er,k as tr,l as nr,I as rr,m as ar,n as ir,o as or,p as sr,u as lr,M as cr,q as dr,r as ur,s as hr,t as pr,v as mr,w as yr,x as gr,W as fr,y as wr,z as vr,A as Cr,B as Er,E as Tr,F as br,G as Ar,J as _r,K as kr,L as Ir,N as Nr,Q as xr,T as Sr,U as Rr,X as Or,Y as Wr,Z as Mr,_ as Pr,$ as Lr,a0 as Dr,a1 as Ur,a2 as Fr,a3 as Br,a4 as zr,a5 as Hr,a6 as Vr,a7 as $r,a8 as jr,a9 as Gr,aa as qr,ab as Kr}from"./useWallets-Dclt9ieV.mjs";export{ac as SUPPORTED_CHAINS,ae as addPrivyRpcToChain,ad as addRpcUrlOverrideToChain}from"./useWallets-Dclt9ieV.mjs";import{e as Yr,s as Zr,f as Jr,S as Qr,i as Xr,l as ea,u as ta,C as na,a as ra,b as aa,O as ia,c as oa,d as sa,g as la,P as ca,h as da,j as ua,k as ha,m as pa,p as ma,n as ya,o as ga,q as fa,r as wa,t as va,v as Ca}from"./prepareFundingModalData-CXdNZxUD.mjs";export{W as WalletConnector}from"./prepareFundingModalData-CXdNZxUD.mjs";import{v4 as Ea}from"uuid";import Ta from"eventemitter3";import{CoinbaseWalletSDK as ba}from"@coinbase/wallet-sdk";import{isHex as Aa,toHex as _a,createPublicClient as ka,http as Ia,createWalletClient as Na,custom as xa,publicActions as Sa,formatUnits as Ra,parseEther as Oa,encodeFunctionData as Wa,isAddress as Ma,decodeFunctionData as Pa,decodeAbiParameters as La,formatEther as Da,hexToString as Ua,zeroAddress as Fa,getAddress as Ba,parseSignature as za}from"viem";import{g as Ha,a as Va}from"./getPublicClient-wHgCncHx.mjs";import{ofetch as $a}from"ofetch";import ja from"js-cookie";import{create as Ga}from"zustand";import{Turnstile as qa}from"@marsidev/react-turnstile";import{styled as Ka,css as Ya,createGlobalStyle as Za}from"styled-components";import Ja from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import Qa from"@heroicons/react/24/outline/ExclamationTriangleIcon";import Xa from"@heroicons/react/24/outline/WalletIcon";import ei from"@heroicons/react/24/outline/ExclamationCircleIcon";import ti from"@heroicons/react/24/outline/Square2StackIcon";import ni from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import ri from"@heroicons/react/24/solid/DocumentCheckIcon";import ai from"@heroicons/react/20/solid/CheckIcon";import ii from"@heroicons/react/24/outline/EnvelopeIcon";import oi from"@heroicons/react/24/outline/PhoneIcon";import si from"@heroicons/react/24/solid/CheckCircleIcon";import li from"@heroicons/react/24/solid/XCircleIcon";import ci from"@heroicons/react/24/outline/CheckCircleIcon";import di from"@heroicons/react/24/outline/CloudArrowUpIcon";import ui from"@heroicons/react/24/outline/NoSymbolIcon";import hi from"fast-password-entropy";import*as pi from"secure-password-utilities";import{DEFAULT_WORDLIST as mi}from"secure-password-utilities/wordlists";import yi from"@heroicons/react/24/outline/ArrowPathIcon";import gi from"@heroicons/react/24/outline/EyeIcon";import fi from"@heroicons/react/24/outline/EyeSlashIcon";import wi from"@heroicons/react/24/outline/KeyIcon";import vi from"@heroicons/react/24/outline/ArrowDownTrayIcon";import Ci from"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import Ei from"@heroicons/react/24/outline/DocumentDuplicateIcon";import Ti from"@heroicons/react/24/outline/UserCircleIcon";import bi from"@heroicons/react/24/solid/LockClosedIcon";import{formatWalletAddress as Ai,getCoinbaseOnRampUrl as _i,chainToMoonpayCurrency as ki,isSupportedChainIdForMoonpay as Ii,isSupportedChainIdForCoinbaseOnramp as Ni,formatTokenAmount as xi,formatWeiAmount as Si,countryCodesAndNumbers as Ri,validatePhoneNumber as Oi,phoneNumberTypingFormatter as Wi,getPlaceholderPhoneNumber as Mi,getCountryCallingCode as Pi,getPhoneCountryCodeAndNumber as Li,formatPhoneNumber as Di,toObjectKeys as Ui,lastFourDigits as Fi,SolanaClient as Bi,ProviderErrors as zi}from"@privy-io/js-sdk-core";import{Menu as Hi,MenuButton as Vi,MenuItems as $i,MenuItem as ji,Transition as Gi,Dialog as qi,TransitionChild as Ki,DialogPanel as Yi}from"@headlessui/react";import Zi from"@heroicons/react/24/outline/ChevronDownIcon";import Ji from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import Qi from"@heroicons/react/24/outline/CreditCardIcon";import Xi from"@heroicons/react/24/outline/QrCodeIcon";import eo from"@heroicons/react/24/outline/InformationCircleIcon";import to from"@heroicons/react/24/outline/ChevronRightIcon";import no from"@heroicons/react/24/outline/FingerPrintIcon";import ro from"@heroicons/react/24/outline/ClockIcon";import ao from"@heroicons/react/24/outline/TrashIcon";import io from"@heroicons/react/24/solid/CheckBadgeIcon";import oo from"@heroicons/react/24/outline/ShieldCheckIcon";import so from"@heroicons/react/24/solid/IdentificationIcon";import lo from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import co from"@heroicons/react/24/outline/MinusCircleIcon";import uo from"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import ho from"@heroicons/react/24/solid/ShieldCheckIcon";import po from"@heroicons/react/24/outline/CalendarIcon";import mo from"@heroicons/react/24/outline/GlobeAltIcon";import yo from"@heroicons/react/24/outline/LockClosedIcon";import go from"@heroicons/react/24/outline/PencilSquareIcon";import{ChevronDownIcon as fo,ArrowRightIcon as wo}from"@heroicons/react/24/outline";import vo from"@heroicons/react/24/outline/ClipboardDocumentIcon";import{i as Co}from"./importWallet-Uu69TNjx.mjs";import{eip7702Actions as Eo,hashAuthorization as To}from"viem/experimental";export{g as getEmbeddedConnectedWallet}from"./getEmbeddedConnectedWallet-CSSBWE2p.mjs";import"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import"@heroicons/react/24/outline/XMarkIcon";import"@walletconnect/ethereum-provider";import"@heroicons/react/24/outline/CheckIcon";import"qrcode";import"zustand/shallow";import"zustand/traditional";import"tinycolor2";class bo{async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");try{return await this.api.post(U,{token:this.meta.token})}catch(e){throw b(e)}}async link(){throw Error("Unimplemented")}constructor(e){this.meta={token:e}}}function Ao(e){return e?{"privy-ui":"t"}:void 0}class _o{async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new T("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(F,{email:this.meta.email,code:this.meta.emailCode,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw b(e)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new T("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(B,{email:this.meta.email,code:this.meta.emailCode})}catch(e){throw b(e)}}async sendCodeEmail({email:e,captchaToken:t,withPrivyUi:n}){if(!this.api)throw new T("Auth flow has no API instance");if(e&&(this.meta.email=e),t&&(this.meta.captchaToken=t),!this.meta.email)throw new T("Email must be set when initialzing authentication.");let r=Ao(n);try{return await this.api.post(z,{email:this.meta.email,token:this.meta.captchaToken},{headers:{...r}})}catch(e){throw b(e)}}constructor({email:e,captchaToken:t,disableSignup:n}){this.meta={email:e,captchaToken:t,disableSignup:n??!1}}}class ko extends _o{async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new T("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(H,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(e){throw b(e)}}constructor(e,t,n){super({email:t,captchaToken:n}),this.meta={email:t,captchaToken:n,oldAddress:e,disableSignup:!1}}}class Io{get meta(){return this._meta}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.channelToken)throw new T("Auth flow must be initialized first");try{let e=await this.api.post(V,{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 T("No response from authentication");return e}catch(e){throw b(e)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");try{return await this.api.post($,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(e){throw b(e)}}async _startChannelOnce(){if(!this.api)throw new T("Auth flow has no API instance");let e=await this.api.post(j,{token:this.captchaToken});y&&!f&&e.connect_uri&&je(e.connect_uri,"_blank"),this._meta={...this._meta,connectUri:e.connect_uri,channelToken:e.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new T("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.channelToken)throw new T("Auth flow must be initialized first");let e=await this.api.get(G,{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 Ge(this._startChannelOnce.bind(this)),this.pollForReady=new Ge(this._pollForReady.bind(this)),this._meta.disableSignup=t}}function No(e){return crypto.getRandomValues(new Uint8Array(e))}class xo{getOrCreateGuestCredential(e){let t=Dn(e);if(Yr()){if(Zr.get(t))return Zr.get(t);{let e=Ln.encode(No(32));return Zr.put(t,e),e}}return Ln.encode(No(32))}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");try{return await this.api.post(q,{guest_credential:this.meta.guestCredential})}catch(e){throw b(e)}}async link(){throw Error("Linking is not supported for the guest flow")}constructor(e){this.meta={guestCredential:this.getOrCreateGuestCredential(e)}}}function So(){return Ln.encode(No(36))}function Ro(){return So()}async function Oo(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 Ln.encode(t)}}class Wo{addCaptchaToken(e){this.meta.captchaToken=e}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new T("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if("undefined"===this.meta.authorizationCode)throw new T("User denied confirmation during OAuth flow");let e=function(){let e=Zr.get(Un);if(!e)throw new T("Authentication error.");return e}();try{let t=await this.api.post(K,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:e,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});return Zr.del(Un),Zr.del(Fn),Zr.del(Bn),t}catch(e){let t=b(e);if(t.privyErrorCode)throw new T(t.message||"Invalid code during OAuth flow.",void 0,t.privyErrorCode);if("User denied confirmation during OAuth flow"===t.message)throw new T("Invalid code during oauth flow.",void 0,A.OAUTH_USER_DENIED);throw new T("Invalid code during OAuth flow.",void 0,A.UNKNOWN_AUTH_ERROR)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new T("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if("undefined"===this.meta.authorizationCode)throw new T("User denied confirmation during OAuth flow");let e=Zr.get(Un);if(!e)throw new T("Authentication error.");try{let t=await this.api.post(Y,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:e});return Zr.del(Un),t}catch(e){throw b(e)}}async getAuthorizationUrl(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.provider)throw new T("Provider must be set when initializing OAuth authentication.");let e=So();Zr.put(Un,e);let t=Ro();Zr.put(zn,t);let n=await Oo(e);this.meta.withPrivyUi||Zr.put(Fn,!0),this.meta.disableSignup&&Zr.put(Bn,!0);let r=Ao(this.meta.withPrivyUi);try{return await this.api.post(Z,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:n,state_code:t},{headers:{...r}})}catch(e){throw b(e)}}constructor(e){this.meta=e}}function Mo(e){return e.charAt(0).toUpperCase()+e.slice(1)}const Po=({style:n,...r})=>/*#__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},...r,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"})]}),Lo=({style:n,...r})=>/*#__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},...r,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"})})})]}),Do=({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"})}),Uo=({style:e})=>/*#__PURE__*/t(mo,{style:{color:"var(--privy-color-error)",...e}}),Fo=({style:n,...r})=>/*#__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},...r,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 Bo(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 zo({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 Ho(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 Vo(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 $o=({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 jo={google:{name:"Google",component:Fo},discord:{name:"Discord",component:Lo},github:{name:"Github",component:Do},linkedin:{name:"LinkedIn",component:zo},twitter:{name:"Twitter",component:$o},spotify:{name:"Spotify",component:Ho},instagram:{name:"Instagram",component:Bo},tiktok:{name:"Tiktok",component:Vo},apple:{name:"Apple",component:Po}};const Go=e=>e in jo?jo[e]:{name:"Unknown",component:Uo};function qo(){let e=new URLSearchParams(window.location.search),t=e.get("privy_oauth_code"),n=e.get("privy_oauth_state"),r=e.get("privy_oauth_provider");if(!t||!n||!r)return{inProgress:!1};let a=!1;try{a=!!window.opener.location.origin}catch{}return{inProgress:!0,authorizationCode:t,stateCode:n,provider:r,withPrivyUi:!Zr.get(Fn),popupFlow:null!==window.opener&&a,disableSignup:!!Zr.get(Bn)}}function Ko(){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"),Zr.del(zn),window.history.replaceState({},"",e)}class Yo{async initRegisterFlow(e){if(!this.api)throw new T("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 T("Auth flow has no API instance");this.authenticateForRegistration=!1,this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute(e)}async initLinkFlow(){if(!this.api)throw new T("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 T("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new T("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(J,{relying_party:this.meta.initRegisterResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(n)})}catch(e){if("NotAllowedError"===e.name)throw new T("Passkey request timed out or rejected by user.",void 0,A.PASSKEY_NOT_ALLOWED);throw b(e)}}async authenticate(){if(this.authenticateForRegistration)return this.register();let e=await import("@simplewebauthn/browser");if(!this.api)throw new T("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new T("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(Q,{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 T("Passkey request timed out or rejected by user.",void 0,A.PASSKEY_NOT_ALLOWED);throw b(e)}}async link(){let e=await import("@simplewebauthn/browser");if(!this.api)throw new T("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new T("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(X,{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(n)})}catch(e){if("NotAllowedError"===e.name)throw new T("Passkey request timed out or rejected by user.",void 0,A.PASSKEY_NOT_ALLOWED);throw b(e)}}async _initRegisterOnce(e){if(!this.api)throw new T("Auth flow has no API instance");let t=Ao(e);return await this.api.post(ee,{token:this.meta.captchaToken},{headers:{...t}})}async _initAuthenticateOnce(e){if(!this.api)throw new T("Auth flow has no API instance");let t=Ao(e);return await this.api.post(te,{token:this.meta.captchaToken},{headers:{...t}})}async _initLinkOnce(){if(!this.api)throw new T("Auth flow has no API instance");return await this.api.post(ne,{})}_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 Ge(this._initRegisterOnce.bind(this)),this.initAuthenticateOnce=new Ge(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new Ge(this._initLinkOnce.bind(this)),this.meta={captchaToken:e,setPasskeyAuthState:t}}}class Zo{async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new T("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(re,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw b(e)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new T("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(ie,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(e){throw b(e)}}async sendSmsCode({phoneNumber:e,captchaToken:t,withPrivyUi:n}){if(!this.api)throw new T("Auth flow has no API instance");if(e&&(this.meta.phoneNumber=e),t&&(this.meta.captchaToken=t),!this.meta.phoneNumber)throw new T("phone nNumber must be set when initialzing authentication.");let r=Ao(n);try{return await this.api.post(oe,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken},{headers:{...r}})}catch(e){throw b(e)}}constructor({phoneNumber:e,captchaToken:t,disableSignup:n}){this.meta={phoneNumber:e,captchaToken:t,disableSignup:n??!1}}}class Jo extends Zo{async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode||!this.meta.oldPhoneNumber)throw new T("Phone number, sms code, and an old phone number must be set prior to calling update.");try{return await this.api.post(se,{old_phone_number:this.meta.oldPhoneNumber,new_phone_number:this.meta.phoneNumber,code:this.meta.smsCode})}catch(e){throw b(e)}}constructor(e,t,n){super({phoneNumber:t,captchaToken:n}),this.meta={phoneNumber:t,captchaToken:n,oldPhoneNumber:e,disableSignup:!1}}}class Qo{async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");try{return await this.api.post(le,{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 b(e)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");try{return await this.api.post(ce,{telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData})}catch(e){throw b(e)}}constructor(e,t=!1){this.meta={disableSignup:!1},this.meta={captchaToken:e,disableSignup:!1},this.meta.disableSignup=t}}function Xo(e){let t={detail:"",retryable:!1};return e?.privyErrorCode===A.LINKED_TO_ANOTHER_USER&&(t.detail="This account has already been linked to another user."),e?.privyErrorCode===A.DISALLOWED_LOGIN_METHOD&&(t.detail="Login with Telegram not allowed."),e?.privyErrorCode===A.INVALID_DATA&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===A.CANNOT_LINK_MORE_OF_TYPE&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===A.INVALID_CREDENTIALS&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===A.TOO_MANY_REQUESTS&&(t.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode===A.TOO_MANY_REQUESTS&&e.message.includes("rate limit")&&(t.detail="Request limit reached for Telegram. Please wait a moment and try again."),e instanceof qe&&(t.retryable=!0,t.detail="Something went wrong. Try again."),t}function es(e){return Object.fromEntries(decodeURIComponent(e).split("&").map((e=>e.split("=").map(decodeURIComponent))))}function ts(){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 ns{static parse(e){try{return new ns(e)}catch(e){return null}}static throwIfNotWellFormedJwt(e){return Pn.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=Pn.decodeJwt(e)}}class rs extends ns{static parse(e){try{return new rs(e)}catch(e){return null}}get appId(){return this._decoded.aid?this._decoded.aid:this.audience}}const as=({style:n,...r})=>/*#__PURE__*/e("svg",{viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...n},...r,children:[/*#__PURE__*/t("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),/*#__PURE__*/t("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]});let is,os=[1,11155111,137,10,8453,84532,42161,7777777,43114,56],ss=(e,t)=>e.makeWeb3Provider({options:t});class ls extends Ke{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:"data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PScwIDAgMTAyNCAxMDI0JyBmaWxsPSdub25lJyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHN0eWxlPSdoZWlnaHQ6MjhweDt3aWR0aDoyOHB4Jz48cmVjdCB3aWR0aD0nMTAyNCcgaGVpZ2h0PScxMDI0JyBmaWxsPScjMDA1MkZGJyByeD0nMTAwJyByeT0nMTAwJz48L3JlY3Q+PHBhdGggZmlsbC1ydWxlPSdldmVub2RkJyBjbGlwLXJ1bGU9J2V2ZW5vZGQnIGQ9J00xNTIgNTEyQzE1MiA3MTAuODIzIDMxMy4xNzcgODcyIDUxMiA4NzJDNzEwLjgyMyA4NzIgODcyIDcxMC44MjMgODcyIDUxMkM4NzIgMzEzLjE3NyA3MTAuODIzIDE1MiA1MTIgMTUyQzMxMy4xNzcgMTUyIDE1MiAzMTMuMTc3IDE1MiA1MTJaTTQyMCAzOTZDNDA2Ljc0NSAzOTYgMzk2IDQwNi43NDUgMzk2IDQyMFY2MDRDMzk2IDYxNy4yNTUgNDA2Ljc0NSA2MjggNDIwIDYyOEg2MDRDNjE3LjI1NSA2MjggNjI4IDYxNy4yNTUgNjI4IDYwNFY0MjBDNjI4IDQwNi43NDUgNjE3LjI1NSAzOTYgNjA0IDM5Nkg0MjBaJyBmaWxsPSd3aGl0ZSc+PC9wYXRoPjwvc3ZnPg==",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 _("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([e[0]])}catch(e){throw Jr(e)}}updateConnectionPreference(e){this.connectionOptions=e,this.walletClientType="smartWalletOnly"===e?"coinbase_smart_wallet":"coinbase_wallet",this.proxyProvider.setWalletProvider(ss(is,this.connectionOptions))}constructor(e,t,n,r,a,i){if(super("coinbase_wallet",e,t,n),this.connectorType="coinbase_wallet",this.displayName="Coinbase Wallet",this.proxyProvider=new Ye(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.connectionOptions=r.coinbaseWallet.connectionOptions??"all",this.walletClientType="smartWalletOnly"===this.connectionOptions?"coinbase_smart_wallet":"coinbase_wallet","coinbase_smart_wallet"===this.walletClientType&&(this.displayName="Coinbase Smart Wallet"),!is){let n=[t.id].concat(e.map((e=>e.id))),r="eoaOnly"!==this.connectionOptions?n.filter((e=>!os.includes(e))):[];r.length>0&&!r.every((e=>Hn.has(e)))&&console.info(`The configured chains are not supported by Coinbase Smart Wallet: ${r.join(", ")}`),is=new ba({appName:a,appLogoUrl:i,appChainIds:n})}this.proxyProvider.setWalletProvider(ss(is,this.connectionOptions))}}const cs=({...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 ds extends Ke{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:[Ze(e?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:cs,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}constructor({provider:e,chains:t,defaultChain:n,rpcConfig:r,imported:a,walletIndex:i}){super("privy",t,n,r),this.connectorType="embedded",this.proxyProvider=e,this.walletIndex=i,a&&(this.connectorType="embedded_imported"),this.subscribeListeners()}}const us=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4","csw_signUserOperation","secp256k1_sign"];let hs={0:"legacy",1:"eip2930",2:"eip1559",3:"eip4844"};const ps={legacy:0,eip2930:1,eip1559:2,eip4844:3};let ms=e=>void 0!==e?BigInt(e):void 0;function ys(e){let t,{type:n=2,...r}=e;r.accessList&&Array.isArray(r.accessList)?t=r.accessList.map((e=>Array.isArray(e)?{address:e[0],storageKeys:e[1]}:e)):r.accessList&&(t=Object.entries(r.accessList).map((e=>({address:e[0],storageKeys:e[1]}))));let a=Number(r.chainId??1),i=Aa(r.data)?r.data:r.data?_a(Uint8Array.from(r.data)):void 0,o=r.nonce?Number(r.nonce):void 0,s={chainId:a,data:i,nonce:o,value:ms(r.value),gas:ms(r.gas??r.gasLimit)},l=Number(n);if(0===l)return{...r,type:hs[l],...s,gasPrice:ms(r.gasPrice),accessList:void 0,maxFeePerGas:void 0,maxPriorityFeePerGas:void 0};if(1===l)return{...r,type:hs[l],...s,gasPrice:ms(r.gasPrice),accessList:t,maxFeePerGas:void 0,maxPriorityFeePerGas:void 0};if(2===l)return{...r,type:hs[l],...s,nonce:o,accessList:t,maxFeePerGas:ms(r.maxFeePerGas),maxPriorityFeePerGas:ms(r.maxPriorityFeePerGas),gasPrice:void 0,maxFeePerBlobGas:void 0};throw new T(`Unsupported transaction type: ${n}`)}class gs extends Error{constructor(e,t,n){super(e),this.code=t,this.data=n}}class fs extends Ta{async handleSendTransaction(e){if(!e.params||!Array.isArray(e.params))throw new gs(`Invalid params for ${e.method}`,4200);let t=e.params[0];if(!await rw()||!this.address)throw new gs("Disconnected",4900);let{hash:n}=await sw(t,{address:this.address});return n}async handleSignTransaction(e){if(!e.params||!Array.isArray(e.params))throw new gs(`Invalid params for ${e.method}`,4200);let t=e.params[0];if(!await rw()||!this.address)throw new gs("Disconnected",4900);let{signature:n}=await ow(t,{address:this.address});return n}handleSwitchEthereumChain(e){let t;if(!e.params||!Array.isArray(e.params))throw new gs(`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 gs(`Invalid params for ${e.method}`,4200);t=e.params[0].chainId}this.chainId=Number(t),this.publicClient=Ha(this.chainId,this.chains,this.rpcConfig,{appId:this.appId}),this.emit("chainChanged",t)}async handlePersonalSign(e){if(!e.params||!Array.isArray(e.params))throw Error("Invalid params for personal_sign");let t=e.params[0],n=e.params[1],{signature:r}=await aw({message:t},{address:n});return r}async handleSignedTypedData(e){if(!e.params||!Array.isArray(e.params))throw Error("Invalid params for eth_signTypedData_v4");let t=e.params[0],n="string"==typeof e.params[1]?JSON.parse(e.params[1]):e.params[1],{signature:r}=await iw(Je(n),{address:t});return r}async handleEstimateGas(e){if(!e.params||!Array.isArray(e.params))throw Error("Invalid params for eth_estimateGas");delete e.params[0].gasPrice,delete e.params[0].maxFeePerGas,delete e.params[0].maxPriorityFeePerGas;let t={...e.params[0],chainId:Ze(this.chainId)};return await this.publicClient.estimateGas({account:t.from??this.address,...ys(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 Ze(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=>us.includes(e))(e.method))return this.publicClient.request({method:e.method,params:e.params});{let t=await rw();if(await lw(),!t||!this.address)throw new gs("Disconnected",4900);try{return(await this.walletProxy.rpc({accessToken:t,entropyId:this.entropyId,entropyIdVerifier:this.entropyIdVerifier,chainType:"ethereum",hdWalletIndex:this.walletIndex,request:{method:e.method,params:e.params}})).response.data}catch(e){throw console.error(e),new gs("Disconnected",4900)}}}constructor({walletProxy:e,address:t,entropyId:n,entropyIdVerifier:r,rpcConfig:a,chains:i,appId:o,chainId:s=1,walletIndex:l}){super(),this.walletProxy=e,this.address=t,this.entropyId=n,this.entropyIdVerifier=r,this.chainId=s,this.rpcConfig=a,this.chains=i,this.publicClient=Ha(s,this.chains,a,{appId:o}),this.rpcTimeoutDuration=Qe(a,"privy"),this.appId=o,this.walletIndex=l}}class ws extends Ke{get walletBranding(){return{id:this.id,name:this.name,icon:this.icon}}async initialize(){this.initialized=!0,this.emit("initialized")}async connect(){throw Error("connect called for an uninstalled wallet via the EthereumNullConnector")}disconnect(){throw Error("disconnect called for an uninstalled wallet via the EthereumNullConnector")}promptConnection(e){throw Error(`promptConnection called for an uninstalled wallet via the EthereumNullConnector for ${e}`)}constructor({id:e,name:t,icon:n,walletClientType:r,defaultChain:a}){super(r,[],a,{}),this.connectorType="null",this.proxyProvider=new Ye(void 0,Vn),this.id=e,this.name=t,this.icon=n,this.connectorType=r}}const vs=({style:n,...r})=>/*#__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},...r,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"})]}),Cs=({style:n,...r})=>/*#__PURE__*/e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"108",height:"108",viewBox:"0 0 108 108",fill:"none",style:{height:"28px",width:"28px",...n},...r,children:[/*#__PURE__*/t("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),/*#__PURE__*/t("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M46.5267 69.9229C42.0054 76.8509 34.4292 85.6182 24.348 85.6182C19.5824 85.6182 15 83.6563 15 75.1342C15 53.4305 44.6326 19.8327 72.1268 19.8327C87.768 19.8327 94 30.6846 94 43.0079C94 58.8258 83.7355 76.9122 73.5321 76.9122C70.2939 76.9122 68.7053 75.1342 68.7053 72.314C68.7053 71.5783 68.8275 70.7812 69.0719 69.9229C65.5893 75.8699 58.8685 81.3878 52.5754 81.3878C47.993 81.3878 45.6713 78.5063 45.6713 74.4598C45.6713 72.9884 45.9768 71.4556 46.5267 69.9229ZM83.6761 42.5794C83.6761 46.1704 81.5575 47.9658 79.1875 47.9658C76.7816 47.9658 74.6989 46.1704 74.6989 42.5794C74.6989 38.9885 76.7816 37.1931 79.1875 37.1931C81.5575 37.1931 83.6761 38.9885 83.6761 42.5794ZM70.2103 42.5795C70.2103 46.1704 68.0916 47.9658 65.7216 47.9658C63.3157 47.9658 61.233 46.1704 61.233 42.5795C61.233 38.9885 63.3157 37.1931 65.7216 37.1931C68.0916 37.1931 70.2103 38.9885 70.2103 42.5795Z",fill:"#FFFDF8"})]});function Es(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var Ts=0;class bs extends Ke{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 _("Unable to retrieve accounts");await this.syncAccounts([e[0]])}catch(e){throw Jr(e)}}constructor(e,t,n,r,a){super(a||"unknown",e,t,n),this.connectorType="injected",this.proxyProvider=new Ye(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=r;let i=r.provider;this.proxyProvider.setWalletProvider(i)}}var As="__private_"+Ts+++"__walletBranding";class _s extends Ke{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 Es(this,As)[As]??{name:"Browser Extension",icon:Xe,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 _("Unable to retrieve accounts");await this.syncAccounts([e[0]])}catch(e){throw Jr(e)}}constructor(e,t,n,r,a){super(a??"unknown",e,t,n),Object.defineProperty(this,As,{writable:!0,value:void 0}),this.connectorType="injected",this.proxyProvider=new Ye(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(r),"metamask"===a?Es(this,As)[As]={name:"MetaMask",icon:vs,id:"io.metamask"}:"phantom"===a&&(Es(this,As)[As]={name:"Phantom",icon:Cs,id:"phantom"})}}class ks extends bs{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{y||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 _("Unable to retrieve accounts");await this.syncAccounts([e[0]])}catch(e){throw Jr(e)}}}const Is=["metamask","phantom","brave_wallet","rainbow","uniswap_wallet_extension","uniswap_extension","rabby_wallet","bybit_wallet","ronin_wallet","crypto.com_wallet_extension","crypto.com_onchain","coinbase_wallet","coinbase_smart_wallet","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","privy","unknown","phantom","solflare","glow","backpack"],Ns=Object.freeze({phantom:{client:"phantom",name:"Phantom",installLink:m.isFirefox?"https://addons.mozilla.org/en-US/firefox/addon/phantom-app/":"https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa?hl=en",chainTypes:["ethereum","solana"],get isInstalled(){if("phantom"in window){let e=window;if(e?.phantom?.ethereum?.isPhantom&&e?.phantom?.ethereum?.chainId||e?.phantom?.solana?.isPhantom)return!0}return!1},getMobileRedirect({useUniversalLink:e,isSolana:t,connectOnly:n}){let r=Ss({client:this.client,isSolana:t,connectOnly:n});return`${e?"phantom://":"https://phantom.app/ul/"}browse/${r}?ref=${r}`}},solflare:{client:"solflare",name:"Solflare",installLink:m.isFirefox?"https://addons.mozilla.org/es/firefox/addon/solflare-wallet/":"https://chromewebstore.google.com/detail/solflare-wallet/bhhhlbepdkbapadjdnnojkbgioiodbic",chainTypes:["solana"],get isInstalled(){return"solflare"in window&&!!window?.solflare?.isSolflare},getMobileRedirect({useUniversalLink:e,isSolana:t,connectOnly:n}){let r=Ss({client:this.client,isSolana:t,connectOnly:n});return`${e?"solflare://ul/v1/":"https://solflare.com/ul/v1/"}browse/${r}?ref=${r}`}},backpack:{client:"backpack",name:"Backpack",installLink:"https://chromewebstore.google.com/detail/backpack/aflkmfhebedbjioipglgcbcmnbpgliof",chainTypes:["ethereum","solana"],get isInstalled(){return!(!("backpack"in window)||!window?.backpack?.ethereum?.isBackpack&&!window?.backpack?.solana?.isBackpack)},getMobileRedirect({useUniversalLink:e,isSolana:t,connectOnly:n}){let r=Ss({client:this.client,isSolana:t,connectOnly:n});return`${e?"backpack://ul/v1/":"https://backpack.com/ul/v1/"}browse/${r}?ref=${r}`}},okx_wallet:{client:"okx_wallet",name:"OKX Wallet",installLink:"https://chromewebstore.google.com/detail/okx-wallet/mcohilncbfahbmgdjkbpemcciiolgcge",chainTypes:["solana"],get isInstalled(){return"okxwallet"in window&&!!window?.okxwallet?.isOkxWallet},getMobileRedirect({isSolana:e,connectOnly:t}){return"https://www.okx.com/download?deeplink="+encodeURIComponent("okx://wallet/dapp/url?dappUrl="+Ss({client:this.client,isSolana:e,connectOnly:t}))}}});function xs({connectorType:e,walletClientType:t}){for(let n of Is)if(e===n||t===n)return Ns[n]}function Ss({client:e,isSolana:t,connectOnly:n}){let r=new URL(window.location.href);return r.searchParams.set("privy_connector",t?"solana_adapter":"injected"),r.searchParams.set("privy_wallet_client",e),r.searchParams.set("privy_connect_only",String(n)),encodeURIComponent(r.href.replace(/\/$/g,""))}class Rs extends Qr{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 Ye(void 0,Vn),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}}class Os extends Ta{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)return;e&&this.removeAllConnectors(),Zr.get($n)&&(Zr.getKeys().forEach((e=>{e.startsWith("walletconnect")&&Zr.del(e)})),Zr.del($n));let t=et({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"}),Object.values(Ns)))!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 Rs({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(tt).find((t=>t.connectorType===e))??null:this.walletConnectors.filter(tt).find((n=>n.connectorType===e&&n.walletClientType===t))??null}findSolanaWalletConnector(e){return this.walletConnectors.filter(Xr).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.saveConnectionHistory(),this.emit("walletsUpdated"),this.emit("connectorInitialized")}onWalletsUpdated(e){e.initialized&&(this.saveConnectionHistory(),this.emit("walletsUpdated"))}addEmbeddedWalletConnectors({walletProxy:e,rootWallet:t,embeddedWallets:n,defaultChain:r,appId:a}){for(let i of n){let n=this.findEmbeddedWalletConnectors().find((e=>e.walletIndex===i.walletIndex));if(n&&tt(n))n.proxyProvider.walletProxy=e;else{let{entropyId:n,entropyIdVerifier:o}=jn(t),s=new ds({provider:new fs({walletProxy:e,address:i.address,entropyId:n,entropyIdVerifier:o,rpcConfig:this.rpcConfig,chains:this.chains,appId:a,chainId:r.id,walletIndex:i.walletIndex}),chains:this.chains,defaultChain:r,rpcConfig:this.rpcConfig,imported:!1,walletIndex:i.walletIndex});this.addWalletConnector(s)}}}addImportedWalletConnector(e,t,n,r){let a=this.findWalletConnector("embedded_imported","privy");if(a&&tt(a))a.proxyProvider.walletProxy=e;else{let a=new ds({provider:new fs({walletProxy:e,address:t,entropyId:t,entropyIdVerifier:"ethereum-address-verifier",walletIndex:0,rpcConfig:this.rpcConfig,chains:this.chains,appId:r,chainId:n.id}),chains:this.chains,walletIndex:0,defaultChain:n,rpcConfig:this.rpcConfig,imported:!0});this.addWalletConnector(a)}}removeEmbeddedWalletConnectors(){this.walletConnectors=this.walletConnectors.filter((e=>"embedded"!==e.connectorType)),this.saveConnectionHistory(),this.storedConnections=ea(),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.saveConnectionHistory(),this.storedConnections=ea(),this.emit("walletsUpdated")}}async createEthereumWalletConnector({connectorType:e,walletClientType:t,providers:n,walletConfig:r}){let a=this.findWalletConnector(e,t);if(a&&tt(a))return a instanceof nt&&a.resetConnection(t),a;let i=(()=>"injected"!==e?"coinbase_wallet"===e?new ls(this.chains,this.defaultChain,this.rpcConfig,this.externalWalletConfig,this.privyAppName,this.privyAppLogo):"null"!==e?new nt(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain,this.shouldEnforceDefaultChainOnConnect,this.privyAppId,this.privyAppName,t):r?new ws({id:r.client,name:r.name,defaultChain:this.defaultChain,walletClientType:r.client}):null:"metamask"===t&&n?.eip6963InjectedProvider?new ks(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask"):"metamask"===t&&n?.legacyInjectedProvider?new _s(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask"):"phantom"===t&&n?.legacyInjectedProvider?new _s(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom"):n?.legacyInjectedProvider&&"unknown_browser_extension"===t?new _s(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider):n?.eip6963InjectedProvider?new bs(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)}))}saveConnectionHistory(){let e=this.wallets.map((e=>({address:e.address,connectorType:e.connectorType,walletClientType:e.walletClientType,connectedAt:e.connectedAt,id:e.meta.id})));Zr.put(Gn,e)}async activeWalletSign(e){let t=this.wallets,n=t.length>0?t[0]:null;return n&&rt(n)?n.sign(e):null}setActiveWallet(e){this.activeWallet=C(e),this.emit("walletsUpdated")}setWalletList(e){this.walletList=e,this.initialized&&this.initialize(!0).catch(console.error)}removeAllConnectors(){for(let e of this.walletConnectors)e.removeAllListeners();this.walletConnectors=[]}constructor(e,t,n,r,a,i,o,s,l,c,d,u){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 Ye},this.privyAppId=e,this.walletConnectCloudProjectId=t,this.rpcConfig=n,this.chains=r,this.defaultChain=a,this.walletConnectors=[],this.initialized=!1,this.store=i,this.walletList=o,this.shouldEnforceDefaultChainOnConnect=s,this.externalWalletConfig=l,this.privyAppName=c,this.privyAppLogo=d,this.walletChainType=u||"ethereum-only",this.storedConnections=ea()}}let Ws=[de,ue,he];class Ms{async get(e,t){try{return await this.baseFetch(e,t)}catch(e){throw b(e)}}async post(e,t,n){try{return await this.baseFetch(e,{method:"POST",...t?{body:t}:{},...n})}catch(e){throw b(e)}}async delete(e,t){try{return await this.baseFetch(e,{method:"DELETE",...t})}catch(e){throw b(e)}}constructor({appId:e,appClientId:t,client:n,defaults:r}){this.appId=e,this.appClientId=t,this.clientAnalyticsId=n.clientAnalyticsId,this.sdkVersion=qn,this.client=n,this.defaults=r,this.fallbackApiUrl=n.fallbackApiUrl,this.baseFetch=$a.create({baseURL:this.defaults.baseURL,timeout:this.defaults.timeout,retry:3,retryDelay:500,retryStatusCodes:[408,409,425,500,502,503,504],credentials:"include",onRequest:async({request:e,options:t})=>{let n=new Headers(t.headers);n.set("privy-app-id",this.appId),this.appClientId&&n.set("privy-client-id",this.appClientId),n.set("privy-ca-id",this.clientAnalyticsId||""),n.set("privy-client",`react-auth:${this.sdkVersion}`);let r=Ws.includes(e.toString());if(!n.has("authorization")){let e=await this.client.getAccessToken({disableAutoRefresh:r});null!==e&&n.set("authorization",`Bearer ${e}`)}t.headers=n,t.retryDelay&&"number"==typeof t.retryDelay&&(t.retryDelay=3*t.retryDelay)},onRequestError:({error:e})=>{if(e instanceof DOMException&&"AbortError"===e.name)throw new k}})}}let Ps=/paymaster\.biconomy\.io\/api/i,Ls={mode:"SPONSORED",calculateGasLimits:!0,expiryDuration:300,sponsorshipInfo:{webhookData:{},smartAccountInfo:{name:"BICONOMY",version:"2.0.0"}}};const Ds=(e,t)=>e&&Ps.test(e)?Ls:t&&t.policy_id?{policyId:t.policy_id}:void 0;function Us(){return!(w&&window.location.origin.startsWith("http://localhost"))}const Fs=Ga((()=>({identityToken:null})));function Bs(){let{identityToken:e}=Fs();return{identityToken:e}}var zs,Hs=((zs={}).PRIVY="privy_access_token",zs.CUSTOMER="customer_access_token",zs);class Vs{get token(){return this.privyAccessToken||this.customerAccessToken}getToken(e){return"privy_access_token"===e?this.privyAccessToken:this.customerAccessToken}get customerAccessToken(){return this._getToken(Kn)}get privyAccessToken(){return this._getToken(Yn)}_getToken(e){try{let t=Zr.get(e);return"string"==typeof t?ns.throwIfNotWellFormedJwt(t):null}catch(e){return console.error(e),this.destroyLocalState(),null}}get refreshToken(){try{let e=Zr.get(Zn);return"string"==typeof e?e:null}catch(e){return console.error(e),this.destroyLocalState(),null}}getProviderAccessToken(e){try{let t=Zr.get(Jn(e));if("string"!=typeof t)return null;{let n=new ns(t);return n.isExpired()?(Zr.del(Jn(e)),null):n.value}}catch(e){return console.error(e),null}}get mightHaveServerCookies(){try{let e=ja.get(Qn);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&&this.refreshToken!==Xn;return this.mightHaveServerCookies||t&&n}hasActiveAccessToken(e){let t=ns.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?Zr.put(Jn(e),t):Zr.del(Jn(e))}updateIdentityToken(e){"string"==typeof e?this.storeIdentityToken(e):this.clearIdentityToken()}async _authenticate(e){try{let t=await e.authenticate(),{user:n,is_new_user:r,oauth_tokens:a}=t;this.handleTokenResponse(t);let i=a?{provider:a.provider,accessToken:a.access_token,accessTokenExpiresInSeconds:a.access_token_expires_in_seconds,refreshToken:a.refresh_token,refreshTokenExpiresInSeconds:a.refresh_token_expires_in_seconds,scopes:a.scopes}:void 0;return this._trackAuthenticateEvents(e,r),{user:er(n),isNewUser:r,oAuthTokens:i}}catch(e){throw console.warn("Error authenticating session"),I(e)}}_trackAuthenticateEvents(e,t){let n=function(e){return e instanceof _o?"email":e instanceof Zo?"sms":e instanceof at?"siwe":e instanceof xo?"guest":e instanceof bo?"custom_auth":e instanceof Wo?e.meta.provider:null}(e);n&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate",payload:{method:n,isNewUser:t}}),"siwe"===n&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate_siwe",payload:{connectorType:e.meta.connectorType,walletClientType:e.meta.walletClientType}})}async _link(e){try{let t=await e.link(),n=t.oauth_tokens,r=n?{provider:n.provider,accessToken:n.access_token,accessTokenExpiresInSeconds:n.access_token_expires_in_seconds,refreshToken:n.refresh_token,refreshTokenExpiresInSeconds:n.refresh_token_expires_in_seconds,scopes:n.scopes}:void 0;return{user:er(t),oAuthTokens:r}}catch(e){throw console.warn("Error linking account"),I(e)}}async _refresh(){if(!this.api)throw new T("Session has no API instance");if(!this.client)throw new T("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let e=this.token,t=this.refreshToken;if(this.client.useServerCookies&&!this.mightHaveServerCookies&&this.token&&window.location.origin===this.client.apiUrl)return this.destroyLocalState(),null;try{let n;if(!(e&&t||this.mightHaveServerCookies))return null;{let r={};e&&(r.authorization=`Bearer ${e}`),n=await this.api.post(de,t?{refresh_token:t}:{},{headers:r})}return this.handleTokenResponse(n),er(n.user)}catch(e){if(e instanceof N&&e.privyErrorCode===A.MISSING_OR_INVALID_TOKEN)return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw I(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(ue,{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=Zr.get(Kn);if(Zr.put(Kn,e),!this.client?.useServerCookies){let t=ns.parse(e)?.expiration;ja.set(tr,e,{sameSite:"Strict",secure:Us(),expires:t?new Date(1e3*t):void 0})}t!==e&&this.client?.onStoreCustomerAccessToken?.(e)}else Zr.del(Kn),ja.remove(tr),this.client?.onDeleteCustomerAccessToken?.()}storeRefreshToken(e){"string"==typeof e?(Zr.put(Zn,e),this.client?.useServerCookies||ja.set(Qn,"t",{sameSite:"Strict",secure:Us(),expires:30})):(Zr.del(Zn),ja.remove(nr),ja.remove(Qn))}storePrivyAccessToken(e){"string"==typeof e?Zr.put(Yn,e):Zr.del(Yn)}storeIdentityToken(e){if(Fs.setState({identityToken:e}),this.client?.useServerCookies)return;Zr.put(rr,e);let t=ns.parse(e)?.expiration;ja.set(ar,e,{sameSite:"Strict",secure:Us(),expires:t?new Date(1e3*t):void 0})}clearIdentityToken(){Zr.del(rr),Fs.setState({identityToken:null}),ja.remove(ar)}constructor(){this.authenticateOnce=new Ge((async e=>this._authenticate(e))),this.linkOnce=new Ge((async e=>this._link(e))),this.refreshOnce=new Ge(this._refresh.bind(this)),this.destroyOnce=new Ge(this._destroy.bind(this))}}let $s;var js=0,Gs="__private_"+js+++"__getOrGenerateClientAnalyticsId";class qs{initializeConnectorManager({walletConnectCloudProjectId:e,rpcConfig:t,chains:n,defaultChain:r,store:a,walletList:i,shouldEnforceDefaultChainOnConnect:o,externalWalletConfig:s,appName:l,walletChainType:c}){this.connectors||(this.connectors=new Os(this.appId,e,t,n,r,a,i,o,s,l,void 0,c))}generateApi(){let e=new Ms({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 T("No auth flow in progress.");return this.session.authenticate(this.authFlow)}async link(){if(!this.authFlow)throw new T("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(pe,{action:"verify"})}catch(e){throw b(e)}}async initMfaPasskeyVerification(){try{return(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}))((await this.api.post(me,{})).options)}catch(e){throw b(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(ye,{});return er(e)}catch(e){throw I(e)}}async unlinkEmail(e){try{let t=await this.api.post(ge,{address:e});return await this.getAuthenticatedUser()??er(t)}catch(e){throw I(e)}}async unlinkPhone(e){try{let t=await this.api.post(fe,{phoneNumber:e});return await this.getAuthenticatedUser()??er(t)}catch(e){throw I(e)}}async unlinkEthereumWallet(e){try{let t=await this.api.post(we,{address:e});return await this.getAuthenticatedUser()??er(t)}catch(e){throw I(e)}}async unlinkSolanaWallet(e){try{let t=await this.api.post(ve,{address:e});return await this.getAuthenticatedUser()??er(t)}catch(e){throw I(e)}}async unlinkOAuth(e,t){try{let n=await this.api.post(Ce,{provider:e,subject:t});return await this.getAuthenticatedUser()??er(n)}catch(e){throw I(e)}}async unlinkFarcaster(e){try{let t=await this.api.post(Ee,{fid:e});return await this.getAuthenticatedUser()??er(t)}catch(e){throw I(e)}}async unlinkTelegram(e){try{let t=await this.api.post(Te,{telegram_user_id:e});return await this.getAuthenticatedUser()??er(t)}catch(e){throw I(e)}}async revokeDelegatedWallet(){try{await this.api.post(be,{})}catch(e){throw I(e)}}async createAnalyticsEvent({eventName:e,payload:t,timestamp:n,options:r}){if("undefined"!=typeof window)try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(he,{event_name:e,client_id:this.clientAnalyticsId,payload:{...t||{},clientTimestamp:n?n.toISOString():(new Date).toISOString()}},{retry:-1,keepalive:r?.keepAlive??!1})}catch(e){console.log("Unable to submit event. This is not an issue.")}}async signMoonpayOnRampUrl(e){try{return this.api.post(Ae,e)}catch(e){throw I(e)}}async initCoinbaseOnRamp(e){try{return this.api.post(_e,e)}catch(e){throw I(e)}}async getCoinbaseOnRampStatus({partnerUserId:e}){try{return this.api.get(`${ke}?partnerUserId=${e}`)}catch(e){throw I(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(Hs.CUSTOMER,e)}async getPrivyAccessToken(e){return await this._getToken(Hs.PRIVY,e)}async _getToken(e,t){return this.session.getToken(e)?this.session.hasActiveAccessToken(e)?this.session.hasRefreshCredentials(e)?rs.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:Ds(e.paymaster_url,e.paymaster_context)})))}:{enabled:n.enabled}}catch(e){throw I(e)}}async getServerConfig(){try{let e={},t=this.session.token;t&&(e.authorization=`Bearer ${t}`);let n=await this.api.get(`/api/v1/apps/${this.appId}`,{baseURL:this.fallbackApiUrl,headers:e}),r=n.telegram_auth_config?{botId:n.telegram_auth_config.bot_id,botName:n.telegram_auth_config.bot_name,linkEnabled:n.telegram_auth_config.link_enabled,seamlessAuthEnabled:n.telegram_auth_config.seamless_auth_enabled}:void 0,a=n.funding_config?{methods:n.funding_config.methods,options:n.funding_config.options,defaultRecommendedAmount:n.funding_config.default_recommended_amount,defaultRecommendedCurrency:n.funding_config.default_recommended_currency,promptFundingOnWalletCreation:n.funding_config.prompt_funding_on_wallet_creation,crossChainBridgingEnabled:n.funding_config.cross_chain_bridging_enabled}:void 0;return{id:n.id,name:n.name,verificationKey:n.verification_key,logoUrl:n.logo_url||void 0,accentColor:n.accent_color||void 0,showWalletLoginFirst:n.show_wallet_login_first,allowlistConfig:{errorTitle:n.allowlist_config.error_title,errorDetail:n.allowlist_config.error_detail,errorCtaText:n.allowlist_config.cta_text,errorCtaLink:n.allowlist_config.cta_link},walletAuth:n.wallet_auth,solanaWalletAuth:n.solana_wallet_auth,emailAuth:n.email_auth,smsAuth:n.sms_auth,googleOAuth:n.google_oauth,twitterOAuth:n.twitter_oauth,discordOAuth:n.discord_oauth,githubOAuth:n.github_oauth,spotifyOAuth:n.spotify_oauth,instagramOAuth:n.instagram_oauth,tiktokOAuth:n.tiktok_oauth,linkedinOAuth:n.linkedin_oauth,appleOAuth:n.apple_oauth,farcasterAuth:n.farcaster_auth,passkeyAuth:n.passkey_auth,passkeysForSignupEnabled:n.passkeys_for_signup_enabled,telegramAuth:n.telegram_auth,disablePlusEmails:n.disable_plus_emails,termsAndConditionsUrl:n.terms_and_conditions_url,embeddedWalletConfig:{ethereum:{createOnLogin:n.embedded_wallet_config.ethereum?.create_on_login??n.embedded_wallet_config.create_on_login},solana:{createOnLogin:n.embedded_wallet_config.solana?.create_on_login??"off"},userOwnedRecoveryOptions:n.embedded_wallet_config.user_owned_recovery_options,requireUserOwnedRecoveryOnCreate:n.embedded_wallet_config.require_user_owned_recovery_on_create},privacyPolicyUrl:n.privacy_policy_url,requireUsersAcceptTerms:n.require_users_accept_terms,customApiUrl:n.custom_api_url,walletConnectCloudProjectId:n.wallet_connect_cloud_project_id,fiatOnRampEnabled:n.fiat_on_ramp_enabled,captchaEnabled:n.captcha_enabled,captchaSiteKey:n.captcha_site_key,createdAt:new Date(1e3*n.created_at),updatedAt:new Date(1e3*n.updated_at),mfaMethods:n.mfa_methods,enforceWalletUis:n.enforce_wallet_uis,legacyWalletUiConfig:n.legacy_wallet_ui_config,telegramAuthConfiguration:r,fundingConfig:a}}catch(e){throw I(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(Ie,{address:e,token:t})).nonce}catch(e){throw I(e)}}async authenticateWithSiweInternal({message:e,signature:t,chainId:n,walletClientType:r,connectorType:a,mode:i}){return await this.api.post(Ne,{message:e,signature:t,chainId:n,walletClientType:r,connectorType:a,mode:i})}async linkWithSiweInternal({message:e,signature:t,chainId:n,walletClientType:r,connectorType:a}){return await this.api.post(xe,{message:e,signature:t,chainId:n,walletClientType:r,connectorType:a})}async linkSmartWallet({message:e,signature:t,smartWalletType:n}){try{let r=await this.api.post(Se,{message:e,signature:t,smart_wallet_type:n});return er(r)}catch(e){throw I(e)}}async linkWithSiwe({message:e,signature:t,chainId:n,walletClientType:r,connectorType:a}){try{let i=await this.linkWithSiweInternal({message:e,signature:t,chainId:n,walletClientType:r,connectorType:a});return er(i)}catch(e){throw I(e)}}async generateSiwsNonce({address:e,captchaToken:t}){try{return(await this.api.post(Re,{address:e,token:t})).nonce}catch(e){throw I(e)}}async authenticateWithSiwsInternal({message:e,signature:t,walletClientType:n,connectorType:r,mode:a}){return await this.api.post(Oe,{message:e,signature:t,walletClientType:n,connectorType:r,mode:a})}async sendAccountTransferRequest({nonce:e,account:t,accountType:n,externalWalletMetadata:r,telegramAuthResult:a,telegramWebAppData:i,farcasterEmbeddedAddress:o,oAuthUserInfo:s}){try{let l,c;switch(n){case"email":l=Ue,c={nonce:e,email:t};break;case"sms":l=De,c={nonce:e,phoneNumber:t};break;case"siwe":if(l=Le,!r)throw Error("Wallet parameters must be defined");c={nonce:e,address:t,...r};break;case"farcaster":l=Pe,c={nonce:e,farcaster_id:t,farcaster_embedded_address:o};break;case"telegram":l=Me,c={nonce:e,telegram_auth_result:a,telegram_web_app_data:i};break;case"custom":case"guest":case"passkey":throw Error("Invalid transfer account type");default:l=We,c={nonce:e,userInfo:s}}let d=await this.api.post(l,c);return await this.getAuthenticatedUser()??er(d)}catch(e){throw I(e)}}async linkWithSiwsInternal({message:e,signature:t,walletClientType:n,connectorType:r}){return await this.api.post(Fe,{message:e,signature:t,walletClientType:n,connectorType:r})}async linkWithSiws({message:e,signature:t,walletClientType:n,connectorType:r}){try{let a=await this.linkWithSiwsInternal({message:e,signature:t,walletClientType:n,connectorType:r});return er(a)}catch(e){throw I(e)}}async updateUserAndIdToken(){try{let e=await this.api.get(Be);return this.session.updateIdentityToken(e.identity_token),er(e.user)}catch(e){throw I(e)}}async scanTransaction(e){try{return await this.api.post(ze,e)}catch(e){throw I(e)}}constructor({apiUrl:e=ir,appId:t,appClientId:n,timeout:r=or}){Object.defineProperty(this,Gs,{value:Ks}),this._cachedProviderAppDetails={},this.apiUrl=e,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=e!==ir&&e.startsWith("https://privy."),this.timeout=r,this.appId=t,this.appClientId=n,this.clientAnalyticsId=function(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}(this,Gs)[Gs](),$s||($s=new Vs),this.session=$s,this.api=this.generateApi(),this.session.client=this}}function Ks(){if("undefined"==typeof window)return null;try{let e=Zr.get(sr);if("string"==typeof e&&e.length>0)return e}catch(e){}let e=Ea();try{return Zr.put(sr,e),e}catch(t){return e}}const Ys=e=>{let{enabled:n,siteKey:r,appId:a,setError:s,setToken:l,setExecuting:c,ref:d}=it(),[,u]=i((()=>r?.split("t:")||[]),[r]);if(o((()=>d.current?.remove),[]),!n)return null;if(!u)throw Error("Unsupported captcha site key");/*#__PURE__*/return t("div",{className:"hidden h-0 w-0",children:/*#__PURE__*/t(qa,{...e,ref:d,siteKey:u,options:{action:a,size:"invisible",...e.delayedExecution?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{e.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{e.onError?.(),s("Captcha failed"),c(!1)},onSuccess:t=>{e.onSuccess?.(t),l(t),c(!1)},onExpire:()=>{e.onExpire?.();try{d.current?.reset(),s(void 0),l(void 0)}catch(e){s("expired_and_failed_reset")}}})})};function Zs(e){ta("configureMfa",e)}const Js=/*#__PURE__*/Ka.span.withConfig({displayName:"CircleBackground",componentId:"sc-c9f33cd-0"})(["&&{width:82px;height:82px;border-width:4px;border-style:solid;border-color:",";background-color:",";border-radius:50%;display:inline-block;box-sizing:border-box;}"],(e=>e.color??"var(--privy-color-accent)"),(e=>e.color??"var(--privy-color-accent)"));let Qs=/*#__PURE__*/Ka.div.withConfig({displayName:"StackedContainer",componentId:"sc-f7e7d474-0"})(["display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%;height:82px;> div{position:relative;}> div > span{position:absolute;left:-41px;top:-41px;}> div > :last-child{position:absolute;left:-19px;top:-19px;}"]);const Xs=/*#__PURE__*/Ka.div.withConfig({displayName:"Grow",componentId:"sc-ddbf22b4-0"})(["text-align:left;flex-grow:1;"]),el=/*#__PURE__*/Ka.div.withConfig({displayName:"AlignBottom",componentId:"sc-ddbf22b4-1"})(["display:flex;flex-direction:column;justify-content:flex-end;flex-grow:1;"]),tl=/*#__PURE__*/Ka.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;}"]),nl=/*#__PURE__*/Ka(tl).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 rl=/*#__PURE__*/Ya(["&&{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 al=/*#__PURE__*/Ka.div.withConfig({displayName:"Subtitle",componentId:"sc-ddbf22b4-4"})(["text-align:center;font-size:14px;margin-bottom:24px;"]),il=/*#__PURE__*/Ka.button.attrs({className:"login-method-button"}).withConfig({displayName:"LoginMethodButton",componentId:"sc-ddbf22b4-5"})(["",""],rl),ol=/*#__PURE__*/Ka.a.withConfig({displayName:"LoginMethodButtonLink",componentId:"sc-ddbf22b4-6"})(["",""],rl),sl=/*#__PURE__*/Ka.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;":"")),ll=/*#__PURE__*/Ka.div.withConfig({displayName:"EmptyWalletState",componentId:"sc-ddbf22b4-8"})(["width:100%;height:100%;padding:",";"],(e=>e.$withPadding?"64px 0px":"0px")),cl=/*#__PURE__*/Ka.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;}"]);let dl=/*#__PURE__*/Ka.div.withConfig({displayName:"ConnectContainer",componentId:"sc-a3e74b9e-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;width:100%;padding-bottom:16px;margin-top:24px;"]),ul=/*#__PURE__*/Ka.div.withConfig({displayName:"GappedContainer",componentId:"sc-a3e74b9e-1"})(["display:flex;flex-direction:column;gap:8px;"]);const hl=/*#__PURE__*/Ka.span.withConfig({displayName:"CircleBorder",componentId:"sc-9056b8b8-0"})(["&&{width:82px;height:82px;border-width:4px;border-style:solid;border-color:",";border-bottom-color:transparent;border-radius:50%;display:inline-block;box-sizing:border-box;animation:rotation 1.2s linear infinite;transition:border-color 800ms;border-bottom-color:",";}"],(e=>e.color??"var(--privy-color-accent)"),(e=>e.color??"var(--privy-color-accent)"));function pl(n){/*#__PURE__*/return e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...n,children:[/*#__PURE__*/t("circle",{cx:"12",cy:"12",r:"10"}),/*#__PURE__*/t("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),/*#__PURE__*/t("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]})}const ml=({onTransfer:e,isTransferring:n,transferSuccess:r})=>/*#__PURE__*/t(st,{...r?{success:!0,children:"Success!"}:{warn:!0,loading:n,onClick:e,children:"Transfer and delete account"}}),yl=/*#__PURE__*/Ka.div.withConfig({displayName:"ConnectContainer",componentId:"sc-aa2e65ff-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;width:100%;padding-bottom:16px;"]),gl=/*#__PURE__*/Ka.div.withConfig({displayName:"GappedContainer",componentId:"sc-aa2e65ff-1"})(["display:flex;flex-direction:column;&& p{font-size:14px;}width:100%;gap:16px;"]),fl=/*#__PURE__*/Ka.div.withConfig({displayName:"DisclosedAccountContainer",componentId:"sc-aa2e65ff-2"})(["display:flex;cursor:pointer;align-items:center;width:100%;border:1px solid var(--privy-color-foreground-4) !important;border-radius:var(--privy-border-radius-md);padding:8px 10px;font-size:14px;font-weight:500;gap:8px;"]),wl=/*#__PURE__*/Ka(ei).withConfig({displayName:"StyledExclamationCircleIcon",componentId:"sc-aa2e65ff-3"})(["position:relative;width:",";height:",";color:var(--privy-color-foreground-3);margin-left:auto;"],(e=>`${e.iconSize}px`),(e=>`${e.iconSize}px`)),vl=/*#__PURE__*/Ka(ti).withConfig({displayName:"StyledCopyIcon",componentId:"sc-aa2e65ff-4"})(["position:relative;width:15px;height:15px;color:var(--privy-color-foreground-3);margin-left:auto;"]),Cl=/*#__PURE__*/Ka.ol.withConfig({displayName:"ListContainer",componentId:"sc-aa2e65ff-5"})(["display:flex;flex-direction:column;font-size:14px;width:100%;text-align:left;"]),El=/*#__PURE__*/Ka.li.withConfig({displayName:"ListItem",componentId:"sc-aa2e65ff-6"})(["font-size:14px;list-style-type:auto;list-style-position:outside;margin-left:1rem;margin-bottom:0.5rem;&:last-child{margin-bottom:0;}"]),Tl=/*#__PURE__*/Ka.div.withConfig({displayName:"CircleContainer",componentId:"sc-aa2e65ff-7"})(["position:relative;width:60px;height:60px;margin:10px;display:flex;justify-content:center;align-items:center;"]);let bl=()=>/*#__PURE__*/t(Tl,{children:/*#__PURE__*/t(wl,{iconSize:60})});const Al=({address:r,onClose:a,onRetry:i,onTransfer:o,isTransferring:s,transferSuccess:l})=>{let{defaultChain:c}=dr(),d=c.blockExplorers?.default.url??"https://etherscan.io";/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(ot,{onClose:a,backFn:i}),/*#__PURE__*/e(yl,{children:[/*#__PURE__*/t(bl,{}),/*#__PURE__*/e(gl,{children:[/*#__PURE__*/t("h3",{children:"Check account assets before transferring"}),/*#__PURE__*/t("p",{children:"Before transferring, ensure there are no assets in the other account. Assets in that account will not transfer automatically and may be lost."}),/*#__PURE__*/e(Cl,{children:[/*#__PURE__*/t("p",{children:" To check your balance, you can:"}),/*#__PURE__*/t(El,{children:"Log out and log back into the other account, or "}),/*#__PURE__*/e(El,{children:["Copy your wallet address and use a"," ",/*#__PURE__*/t("u",{children:/*#__PURE__*/t("a",{target:"_blank",href:d,children:"block explorer"})})," ","to see if the account holds any assets."]})]}),/*#__PURE__*/e(fl,{onClick:()=>navigator.clipboard.writeText(r).catch(console.error),children:[/*#__PURE__*/t(Xa,{color:"var(--privy-color-foreground-1)",strokeWidth:2,height:"28px",width:"28px"}),/*#__PURE__*/t(lt,{address:r,showCopyIcon:!1}),/*#__PURE__*/t(vl,{})]}),/*#__PURE__*/t(ml,{onTransfer:o,isTransferring:s,transferSuccess:l})]})]}),/*#__PURE__*/t(ct,{})]})},_l=({onClose:r,onContinue:a,onInfo:i,onTransfer:o,transferSuccess:s,isTransferring:l,data:c})=>{if(!c?.accountTransfer?.linkMethod||!c?.accountTransfer?.displayName)return;let d={method:c?.accountTransfer?.linkMethod,handle:c?.accountTransfer?.displayName,disclosedAccount:c?.accountTransfer?.embeddedWalletAddress?{type:"wallet",handle:c?.accountTransfer?.embeddedWalletAddress}:void 0};/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(ot,{closeable:!0}),/*#__PURE__*/e(yl,{children:[/*#__PURE__*/t(Qs,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(hl,{color:"var(--privy-color-error)"}),/*#__PURE__*/t(Qa,{height:38,width:38,stroke:"var(--privy-color-error)"})]})}),/*#__PURE__*/e(gl,{children:[/*#__PURE__*/e("h3",{children:[function(e){switch(e){case"sms":return"Phone number";case"email":return"Email address";case"siwe":return"Wallet address";case"linkedin":return"LinkedIn profile";case"google":case"apple":case"discord":case"github":case"instagram":case"spotify":case"tiktok":case"twitter":case"telegram":case"farcaster":return`${Mo(e.replace("_oauth",""))} profile`;default:return e}}(d.method)," is associated with another account"]}),/*#__PURE__*/e("p",{children:["Do you want to transfer",/*#__PURE__*/t("b",{children:d.handle?` ${d.handle}`:""})," to this account instead? This will delete your other account."]}),/*#__PURE__*/t(kl,{onClick:i,disclosedAccount:d.disclosedAccount})]}),/*#__PURE__*/e(gl,{style:{gap:12,marginTop:12},children:[c?.accountTransfer?.embeddedWalletAddress?/*#__PURE__*/t(st,{onClick:a,children:"Continue"}):/*#__PURE__*/t(ml,{onTransfer:o,transferSuccess:s,isTransferring:l}),/*#__PURE__*/t(dt,{onClick:r,children:"No thanks"})]})]}),/*#__PURE__*/t(ct,{})]})};function kl({disclosedAccount:n,onClick:r}){return n?/*#__PURE__*/e(fl,{onClick:r,children:[/*#__PURE__*/t(Xa,{color:"var(--privy-color-foreground-1)",strokeWidth:2,height:"28px",width:"28px"}),/*#__PURE__*/t(lt,{address:n.handle,showCopyIcon:!1}),/*#__PURE__*/t(pl,{width:15,height:15,color:"var(--privy-color-foreground-3)",style:{marginLeft:"auto"}})]}):null}const Il=/*#__PURE__*/Ka.div.withConfig({displayName:"AppLogoContainer",componentId:"sc-a63b1990-0"})(["display:flex;flex-direction:column;align-items:center;padding:0px 0px 30px;@media (max-width:440px){padding:10px 10px 20px;}"]),Nl=/*#__PURE__*/Ka.div.withConfig({displayName:"Title",componentId:"sc-a63b1990-1"})(["font-size:18px;line-height:30px;text-align:center;font-weight:600;margin-bottom:10px;"]),xl=/*#__PURE__*/Ka.div.withConfig({displayName:"SubTitle",componentId:"sc-a63b1990-2"})(["font-size:0.875rem;text-align:center;"]),Sl=/*#__PURE__*/Ka.div.withConfig({displayName:"Container",componentId:"sc-a63b1990-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;}"]),Rl=/*#__PURE__*/Ka.div.withConfig({displayName:"List",componentId:"sc-a63b1990-4"})(["display:flex;flex-direction:column;align-items:stretch;gap:0.75rem;padding:1rem 0rem 0rem;flex-grow:1;width:100%;"]),Ol=/*#__PURE__*/Ka.div.withConfig({displayName:"ListItemIcon",componentId:"sc-a63b1990-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);}"]),Wl=/*#__PURE__*/Ka.div.withConfig({displayName:"ListItem",componentId:"sc-a63b1990-6"})(["display:flex;align-items:center;gap:10px;font-size:0.875rem;line-height:1rem;text-align:left;"]),Ml=/*#__PURE__*/Ka.div.withConfig({displayName:"BottomSection",componentId:"sc-a63b1990-7"})(["display:flex;flex-direction:column;gap:10px;padding-top:20px;"]),Pl=/*#__PURE__*/Ka.div.withConfig({displayName:"MethodList",componentId:"sc-a63b1990-8"})(["display:flex;flex-direction:column;align-items:stretch;gap:1rem;padding:1rem 0rem 0rem;flex-grow:1;width:100%;"]),Ll=/*#__PURE__*/Ka.div.withConfig({displayName:"MethodListItem",componentId:"sc-a63b1990-9"})(["display:flex;gap:5px;width:100%;position:relative;"]),Dl=/*#__PURE__*/Ka.button.withConfig({displayName:"RemoveMethodButton",componentId:"sc-a63b1990-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);}"]),Ul=/*#__PURE__*/Ka.div.withConfig({displayName:"MethodText",componentId:"sc-a63b1990-11"})(["display:flex;align-items:center;gap:0.5rem;> svg{z-index:2;height:20px !important;width:20px !important;}"]),Fl=/*#__PURE__*/Ka.div.withConfig({displayName:"ExtraText",componentId:"sc-a63b1990-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)")),Bl=/*#__PURE__*/Ka.div.withConfig({displayName:"SmsInsecureText",componentId:"sc-a63b1990-13"})(["width:100%;display:flex;justify-content:space-between;"]),zl=/*#__PURE__*/Ka.p.withConfig({displayName:"TermsText",componentId:"sc-a63b1990-14"})(["text-align:left;width:100%;color:var(--privy-color-foreground-3) !important;"]),Hl=/*#__PURE__*/Ka.button.withConfig({displayName:"PrimaryTextButton",componentId:"sc-a63b1990-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)")),Vl=/*#__PURE__*/Ka.div.withConfig({displayName:"IconWrapper",componentId:"sc-a63b1990-16"})(["display:flex;align-items:center;justify-content:center;color:var(--privy-color-accent);width:100%;> svg{z-index:2;width:3rem;height:3rem;}"]),$l=/*#__PURE__*/Ka.div.withConfig({displayName:"ErrorMessage",componentId:"sc-a63b1990-17"})(["color:var(--privy-color-error);"]),jl=({termsAndConditionsUrl:r,privacyPolicyUrl:a,onAccept:i,onDecline:o})=>/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(ot,{closeable:!1}),/*#__PURE__*/t(ri,{width:56,height:56,fill:"var(--privy-color-accent)",style:{margin:"auto"}}),/*#__PURE__*/t(Nl,{style:{marginTop:24},children:"One last step"}),/*#__PURE__*/t(xl,{children:"By signing up, you agree to our terms and privacy policy."}),/*#__PURE__*/e(tl,{style:{marginTop:24},children:[r&&/*#__PURE__*/e(ol,{target:"_blank",href:r,children:["View Terms ",/*#__PURE__*/t(ni,{style:{marginLeft:"auto"}})]}),a&&/*#__PURE__*/e(ol,{target:"_blank",href:a,children:["View Privacy Policy ",/*#__PURE__*/t(ni,{style:{marginLeft:"auto"}})]})]}),/*#__PURE__*/e(Gl,{style:{marginTop:24},children:[/*#__PURE__*/t(dt,{onClick:o,children:"No thanks"}),/*#__PURE__*/t(st,{onClick:i,children:"Accept"})]}),/*#__PURE__*/t(ct,{})]});let Gl=/*#__PURE__*/Ka.div.withConfig({displayName:"ButtonsContainer",componentId:"sc-d601b243-0"})(["display:flex;gap:10px;"]);const ql=({style:e,...n})=>/*#__PURE__*/t("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",style:{height:"1.5rem",width:"1.5rem",...e},...n,children:/*#__PURE__*/t("path",{fillRule:"evenodd",d:"M12 1.5a5.25 5.25 0 00-5.25 5.25v3a3 3 0 00-3 3v6.75a3 3 0 003 3h10.5a3 3 0 003-3v-6.75a3 3 0 00-3-3v-3c0-2.9-2.35-5.25-5.25-5.25zm3.75 8.25v-3a3.75 3.75 0 10-7.5 0v3h7.5z",clipRule:"evenodd"})});let Kl=/*#__PURE__*/Ka.div.withConfig({displayName:"ConnectContainer",componentId:"sc-ed4ecf-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;width:100%;padding-bottom:16px;"]),Yl=/*#__PURE__*/Ka.div.withConfig({displayName:"GappedContainer",componentId:"sc-ed4ecf-1"})(["display:flex;flex-direction:column;gap:8px;"]);const Zl=({title:r,description:a,children:i,...o})=>
2
2
  /*#__PURE__*/t(Xl,{...o,children:/*#__PURE__*/e(n,{children:[/*#__PURE__*/t("h3",{children:r}),"string"==typeof a?/*#__PURE__*/t("p",{children:a}):a,i]})}),Jl=/*#__PURE__*/Ka(Zl).withConfig({displayName:"PaddedScreenHeader",componentId:"sc-523a75d6-0"})(["margin-bottom:24px;"]),Ql=({title:n,description:r,icon:a,children:i,...o})=>/*#__PURE__*/e(ec,{...o,children:[a||null,/*#__PURE__*/t("h3",{children:n}),r&&"string"==typeof r?/*#__PURE__*/t("p",{children:r}):r,i]});let Xl=/*#__PURE__*/Ka.div.withConfig({displayName:"StyledSection",componentId:"sc-523a75d6-1"})(["display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start;text-align:left;gap:8px;width:100%;margin-bottom:24px;&& h3{font-size:17px;color:var(--privy-color-foreground);}&& p{color:var(--privy-color-foreground-2);font-size:14px;}"]),ec=/*#__PURE__*/Ka(Xl).withConfig({displayName:"CenteredStyledSection",componentId:"sc-523a75d6-2"})(["align-items:center;text-align:center;gap:16px;h3{margin-bottom:24px;}"]),tc=Array(6).fill("");var nc,rc,ic=((nc=ic||{})[nc.RESET_AFTER_DELAY=0]="RESET_AFTER_DELAY",nc[nc.CLEAR_ON_NEXT_VALID_INPUT=1]="CLEAR_ON_NEXT_VALID_INPUT",nc),oc=((rc=oc||{})[rc.EMAIL=0]="EMAIL",rc[rc.SMS=1]="SMS",rc);let sc=/*#__PURE__*/Ka.div.withConfig({displayName:"PasswordlessCodeContainer",componentId:"sc-bf1e04a-0"})(["display:flex;flex-direction:column;align-items:flex-start;justify-content:center;margin:auto;gap:16px;flex-grow:1;"]),lc=/*#__PURE__*/Ka.div.withConfig({displayName:"CodeInput",componentId:"sc-bf1e04a-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);}}"]),cc=/*#__PURE__*/Ka.div.withConfig({displayName:"InputHelp",componentId:"sc-bf1e04a-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)")),dc=/*#__PURE__*/Ka.div.withConfig({displayName:"HelpText",componentId:"sc-bf1e04a-3"})(["font-size:13px;color:var(--privy-color-foreground);display:flex;gap:8px;align-items:center;width:100%;margin-top:16px;padding-bottom:32px;"]),uc=/*#__PURE__*/Ka.div.withConfig({displayName:"ResendButtonContainer",componentId:"sc-bf1e04a-4"})(["color:var(--privy-color-accent);padding:2px 0;> button{text-decoration:underline;}"]),hc=/*#__PURE__*/Ka.div.withConfig({displayName:"Badge",componentId:"sc-bf1e04a-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);"]),pc=/*#__PURE__*/Ka.span.withConfig({displayName:"BoldWrappingSpan",componentId:"sc-bf1e04a-6"})(["font-weight:500;word-break:break-all;"]);const mc=({icon:r})=>/*#__PURE__*/t(n,{children:/*#__PURE__*/t(yc,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(pt,{}),"string"==typeof r?
3
3
  /*#__PURE__*/t("span",{style:{background:`url('${r}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):r?/*#__PURE__*/t(r,{style:{width:"38px",height:"38px"}}):
4
4
  /*#__PURE__*/t("span",{})]})})});let yc=/*#__PURE__*/Ka.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;}"]);let gc=/*#__PURE__*/Ka.div.withConfig({displayName:"CaptchaContainer",componentId:"sc-9afcf974-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;width:100%;"]);const fc=({chainType:n,withPadding:r})=>{let a="";return a="ethereum-only"===n||"ethereum-and-solana"===n?"Rainbow, Phantom, or Coinbase Wallet":"Phantom or Solflare",/*#__PURE__*/t(ll,{$withPadding:r,children:/*#__PURE__*/e(cl,{children:[/*#__PURE__*/t(Ja,{style:{color:"var(--privy-color-warn)",height:48,width:48}}),/*#__PURE__*/t("h3",{children:"No wallets available"}),/*#__PURE__*/e("p",{children:["Please download an external wallet provider, like ",a,"."]})]})},"empty-wallet-state")},wc=({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(Xa,{}):e?/*#__PURE__*/t(e,{}):null;function vc(e){let t=e.toLowerCase();return!!window?.webkit?.messageHandlers?.ReactNativeWebView||!!window?.ReactNativeWebView||["fbav","fban","instagram","snapchat","linkedinapp"].some((e=>t.includes(e)))}const Cc=({provider:n,displayName:r,logo:a,connectOnly:i,connector:o})=>{let s,{navigate:l,setModalData:c}=lr(),{connectWallet:d}=x(),u=gt(),h=ft(n),p="wallet_connect_v2"===o.connectorType?n:o.walletClientType,m=window.matchMedia("(display-mode: standalone)").matches,g=xs({connectorType:o.connectorType,walletClientType:p});s=g&&g.chainTypes.includes(o.chainType)?()=>{g.isInstalled||"solana"===o.chainType&&"isInstalled"in o&&o.isInstalled?(d(o,p),l(i?cr.AWAITING_CONNECT_ONLY_CONNECTION:cr.AWAITING_CONNECTION)):y?(c({installWalletModalData:{walletConfig:g,chainType:o.chainType,connectOnly:i}}),l(cr.WALLET_INTERSTITIAL_SCREEN)):(c({installWalletModalData:{walletConfig:g,chainType:o.chainType,connectOnly:i}}),l(cr.INSTALL_WALLET_SCREEN))}:"coinbase_wallet"!==o.connectorType||"eoaOnly"!==o.connectionOptions||!y||m||wt()?()=>{(!vc(window.navigator.userAgent)||event?.isTrusted)&&(d(o,p),l(i?cr.AWAITING_CONNECT_ONLY_CONNECTION:cr.AWAITING_CONNECTION))}:()=>{window.location.href=`https://go.cb-w.com/dapp?cb_url=${encodeURI(window.location.href)}`};let f=r||h?.metadata?.shortName||h?.name||o.walletClientType;/*#__PURE__*/return e(Ec,{onClick:s,children:[/*#__PURE__*/t(wc,{icon:a||h?.image_url?.md,name:f}),/*#__PURE__*/t("span",{children:f}),/*#__PURE__*/e(bc,{id:"chip-container",children:[u?.walletClientType===p&&u?.chainType===o.chainType?/*#__PURE__*/t(Tc,{color:"gray",children:"Recent"}):/*#__PURE__*/t("span",{id:"connect-text",children:"Connect"}),"solana"===o.chainType&&/*#__PURE__*/t(Tc,{color:"gray",children:"Solana"})]})]})};let Ec=/*#__PURE__*/Ka(il).withConfig({displayName:"ConnectWalletButton",componentId:"sc-c6a554d4-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;}}"]),Tc=/*#__PURE__*/Ka(vt).withConfig({displayName:"StyledChip",componentId:"sc-c6a554d4-1"})(["margin-left:auto;"]),bc=/*#__PURE__*/Ka.div.withConfig({displayName:"ChipContainer",componentId:"sc-c6a554d4-2"})(["display:flex;flex-wrap:wrap;gap:8px;margin-left:auto;"]);const Ac=["coinbase_wallet"];let _c=["metamask","okx_wallet","rainbow","uniswap","bybit_wallet","ronin_wallet","uniswap_extension","zerion","rabby_wallet","cryptocom"];const kc=["safe"],Ic=["phantom","backpack","solflare","universal_profile"],Nc=({wallets:e})=>{let{app:r}=lr();return 0===e.length?/*#__PURE__*/t(fc,{chainType:r.appearance.walletChainType,withPadding:!0}):/*#__PURE__*/t(n,{children:e})},xc=({walletList:e,walletChainType:n,connectors:r,connectOnly:a,ignore:i,walletConnectEnabled:o,forceWallet:s})=>{let l=[],c=[],d=[],u=r.filter((e=>"ethereum-only"===n?"ethereum"===e.chainType:"solana-only"!==n||"solana"===e.chainType)),h=u.find((e=>"wallet_connect_v2"===e.connectorType));for(let[r,p]of(s?[s.wallet]:e).entries()){if("detected_ethereum_wallets"===p||"detected_wallets"===p)for(let[e,n]of u.filter((({chainType:e,connectorType:t,walletClientType:n})=>"solana"!==e&&("uniswap_wallet_extension"===n||"uniswap_extension"===n?!i.includes("uniswap"):"crypto.com_wallet_extension"===n||"crypto.com_onchain"===n?!i.includes("cryptocom"):"injected"===t&&!i.includes(n)))).entries()){let{walletClientType:i,walletBranding:o,chainType:s}=n;("unknown"===i?c:l).push(/*#__PURE__*/t(Cc,{connectOnly:a,provider:i,logo:o.icon,displayName:o.name,connector:n},`${r}-${p}-${i}-${s}-${e}`))}if("detected_solana_wallets"===p||"detected_wallets"===p)for(let[e,o]of u.filter((({chainType:e,walletClientType:t})=>{if("solana"===e)return"ethereum-only"!==n&&!i.includes(t)})).entries()){let{walletClientType:n,walletBranding:i,chainType:s}=o;("unknown"===n?c:l).push(/*#__PURE__*/t(Cc,{connectOnly:a,provider:n,logo:i.icon,displayName:i.name,connector:o},`${r}-${p}-${n}-${s}-${e}`))}if(Ic.includes(p)){let e=u.find((e=>"injected"===e.connectorType&&e.walletClientType===p||e.connectorType===p));if(e&&l.push(/*#__PURE__*/t(Cc,{connectOnly:a,provider:p,connector:e},`${r}-${p}`)),"solana-only"===n||"ethereum-and-solana"===n){let e=u.find((({chainType:e,walletClientType:t})=>"solana"===e&&t===p));e&&l.push(/*#__PURE__*/t(Cc,{connectOnly:a,provider:p,connector:e},`${p}-solana`))}}else if(_c.includes(p)){let e=u.find((e=>"uniswap"===p?"uniswap_wallet_extension"===e.walletClientType||"uniswap_extension"===e.walletClientType:"cryptocom"===p?"crypto.com_wallet_extension"===e.walletClientType||"crypto.com_onchain"===e.walletClientType:"injected"===e.connectorType&&e.walletClientType===p));if(o&&!e&&(e=h),e&&l.push(/*#__PURE__*/t(Cc,{connectOnly:a,provider:p,connector:e,logo:"injected"===e.connectorType?e.walletBranding.icon:void 0,displayName:"injected"===e.connectorType?e.walletBranding.name:void 0},`${r}-${p}`)),"solana-only"===n||"ethereum-and-solana"===n){let e=u.find((({chainType:e,walletClientType:t})=>"solana"===e&&t===p));e&&l.push(/*#__PURE__*/t(Cc,{connectOnly:a,provider:p,connector:e},`${p}-solana`))}}else if(Ac.includes(p)){let e=u.find((({connectorType:e})=>e===p));e&&l.push(/*#__PURE__*/t(Cc,{connectOnly:a,provider:p,connector:e},`${r}-${p}`))}else if(kc.includes(p))h&&d.push(/*#__PURE__*/t(Cc,{connectOnly:a,provider:p,connector:h},`${r}-${p}`));else if("wallet_connect"===p)h&&d.push(/*#__PURE__*/t(Cc,{connectOnly:a,provider:p,connector:h,logo:h.walletBranding.icon,displayName:"Wallet Connect"},`${r}-${p}`));else if(p===s?.wallet){let n="ethereum"===s.chainType&&e.includes("detected_ethereum_wallets"),i="solana"===s.chainType&&e.includes("detected_solana_wallets");if(e.includes("detected_wallets")||n||i){let e=u.find((({walletClientType:e})=>e===p));e&&l.push(/*#__PURE__*/t(Cc,{connectOnly:a,provider:p,displayName:e.walletBranding?.name,logo:e.walletBranding?.icon,connector:e},`${r}-${p}`))}}}return[...c,...l,...d]};let Sc=/*#__PURE__*/Ka.div.withConfig({displayName:"ConnectContainer",componentId:"sc-4475d7d5-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;width:100%;"]);const Rc=({name:e,logoUrl:n,size:r="38px"})=>"string"==typeof n?/*#__PURE__*/t("img",{src:n,alt:`${e??"Provider app"} logo`,style:{width:r,height:r,maxHeight:"90px",maxWidth:"180px",borderRadius:"8px"}}):