import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import a from"@heroicons/react/24/outline/UserCircleIcon";import l,{useState as r,useEffect as n,useRef as o,useMemo as s}from"react";import{styled as c}from"styled-components";import{T as d,M as p,B as u}from"./ModalHeader-DffkxvO4.mjs";import{u as h}from"./context-BKnOUECq.mjs";import{s as m,u as g}from"./index-BtwxknTg.mjs";import{u as f}from"./internal-context-dfitw7Ot.mjs";import{u as y}from"./modal-context-DBwfUxD-.mjs";import{a as w,t as v}from"./index-C5jxD-zy.mjs";import{u as C,W as b,a as k}from"./ConnectWalletView-Bbw4fdoE.mjs";import{l as S,m as T,B as M,H as x,g as A,E as L,n as W,G as E,o as P,S as I,A as N}from"./useActiveWallet-BEfvREjE.mjs";import{r as j}from"./wallet-connect-58EobR5U.mjs";import{u as D,i as O}from"./privy-context-Bi6vqCPc.mjs";import{d as R}from"./usePrivy-BhL-ltvm.mjs";import{Mail as V,Smartphone as _,UserCircle as U}from"lucide-react";import{C as F}from"./ConnectEmailForm-C3yzMONB.mjs";import{C as H}from"./Chip-D2-wZOHJ.mjs";import{F as z}from"./farcaster-DPlSjvF5.mjs";import{toObjectKeys as $}from"@privy-io/js-sdk-core";import G from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import q from"@heroicons/react/24/outline/FingerPrintIcon";import{L as B}from"./Link-DJ5gq9Di.mjs";import{C as K}from"./ConnectPhoneForm-DtsOvq6k.mjs";import{T as Q,a as Y,I as Z,S as J,L as X,G as ee,b as te,D as ie,A as ae}from"./twitter-BoAxhlj6.mjs";import{T as le,L as re}from"./twitch-5IOe4sIQ.mjs";import{T as ne}from"./telegram-B-JqnkqZ.mjs";import{W as oe}from"./WalletOverflowButton-zWfc2OYf.mjs";import{S as se}from"./ScreenLayout-Caq5mGD8.mjs";const ce=()=>{let t=h(),i=t?.appearance?.logo,a=`${t?.name} logo`,r={maxHeight:"90px",maxWidth:"180px"};return i?"string"==typeof i?/*#__PURE__*/e("img",{src:i,alt:a,style:r}):"svg"===i.type||"img"===i.type?/*#__PURE__*/l.cloneElement(i,{alt:a,style:r}):(console.warn("`config.appearance.logo` must be a string, or an SVG / IMG element. Nothing will be rendered."),null):null},de=c.div`
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 0;
  flex-grow: 1;
  justify-content: center;
`,pe=({name:t,logoUrl:i,size:a="38px"})=>"string"==typeof i?/*#__PURE__*/e("img",{src:i,alt:`${t??"Provider app"} logo`,style:{width:a,height:a,maxHeight:"90px",maxWidth:"180px",borderRadius:"8px"}}):
/*#__PURE__*/e("span",{}),ue=({appId:a})=>{let[l,o]=r(void 0),{startCrossAppAuthFlow:s}=R(),{authenticated:c}=D(),{data:d}=y(),{client:p}=f();return n((()=>{(async()=>{p&&o(await p.getCrossAppProviderDetails(a))})()}),[p]),/*#__PURE__*/e(S,{onClick:()=>s({appId:a,action:c?"link":"login",disableSignup:d?.login?.disableSignup}),disabled:!l,children:l?/*#__PURE__*/t(i,{children:[/*#__PURE__*/e(T,{$fullSize:!0,children:/*#__PURE__*/e(pe,{name:l.name,logoUrl:l.icon_url||void 0,size:"32px"})}),l.name]}):/*#__PURE__*/e(M,{})})},he=({isEditable:a,setIsEditable:l,defaultValue:r})=>{let n=o(null);/*#__PURE__*/return t(i,{children:[/*#__PURE__*/e(x,{$if:!a,children:/*#__PURE__*/e(F,{ref:n,defaultValue:r})}),/*#__PURE__*/e(x,{$if:a,children:/*#__PURE__*/t(S,{onClick:()=>{l(),setTimeout((()=>{n.current?.focus()}),0)},children:[/*#__PURE__*/e(T,{children:/*#__PURE__*/e(V,{})}),"Continue with Email"]})})]})},me=()=>{let[i,a]=r(!1),{currentScreen:l,navigate:n,setModalData:o,data:s}=y(),{enabled:c,token:d}=w(),{initLoginWithFarcaster:p}=f(),{accountType:u}=A();/*#__PURE__*/return t(S,{onClick:async()=>{a(!0);try{c&&!d?(o({captchaModalData:{callback:e=>p(e,s?.login?.disableSignup),userIntentRequired:!0,onSuccessNavigateTo:"FarcasterConnectStatusScreen",onErrorNavigateTo:"ErrorScreen"}}),n("CaptchaScreen")):(await p(d,s?.login?.disableSignup),n("FarcasterConnectStatusScreen"))}catch(e){o({errorModalData:{error:e,previousScreen:l||"LandingScreen"}}),n("ErrorScreen")}finally{a(!1)}},disabled:!1,children:[/*#__PURE__*/e(z,{width:32,height:32})," Farcaster",i&&/*#__PURE__*/e(M,{}),"farcaster"===u&&/*#__PURE__*/e(ge,{color:"gray",children:"Recent"})]})};let ge=c(H)`
  margin-left: auto;
`;const fe=({...i})=>/*#__PURE__*/t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...i,children:[/*#__PURE__*/t("g",{clipPath:"url(#clip0_2856_1743)",children:[/*#__PURE__*/e("path",{d:"M22.1673 8.24075V16.3642C22.1673 17.3256 21.3421 18.105 20.3241 18.105H17.0028M22.1673 8.24075C22.1673 7.27936 21.3421 6.5 20.3241 6.5H11.5302M22.1673 8.24075V8.42852C22.1673 9.03302 21.8352 9.59423 21.2901 9.91105L15.1463 13.4818C14.5539 13.8261 13.8067 13.8261 13.2143 13.4818L10.1621 11.5401",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),/*#__PURE__*/e("path",{d:"M3.12913 6.64816C0.508085 12.9507 3.49251 20.1847 9.79504 22.8057L11.5068 23.5176C12.4522 23.9108 13.7783 23.2222 14.1714 22.2768L14.6054 21.2333C14.7687 20.8406 14.6438 20.3871 14.3024 20.1334L11.2872 17.8927C10.9878 17.6702 10.5843 17.6488 10.2632 17.8384L9.11575 18.5156C8.78274 18.7121 8.3597 18.6844 8.07552 18.4221C5.94293 16.4542 4.77629 13.6264 4.90096 10.7273C4.91757 10.3409 5.19796 10.023 5.57269 9.92753L6.86381 9.59869C7.22522 9.50664 7.49627 9.20696 7.55169 8.83815L8.10986 5.12321C8.17306 4.70259 7.94188 4.29293 7.54915 4.1296L6.50564 3.69564C5.56026 3.30248 4.23416 3.99103 3.84101 4.9364L3.12913 6.64816Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),/*#__PURE__*/e("defs",{children:/*#__PURE__*/e("clipPath",{id:"clip0_2856_1743",children:/*#__PURE__*/e("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]}),ye=({chainType:i,withPadding:a})=>{let l="";return l="ethereum-only"===i||"ethereum-and-solana"===i?"Rainbow, Phantom, or Coinbase Wallet":"Phantom or Solflare",/*#__PURE__*/e(L,{$withPadding:a,children:/*#__PURE__*/t(W,{children:[/*#__PURE__*/e(G,{style:{color:"var(--privy-color-warn)",height:48,width:48}}),/*#__PURE__*/e("h3",{children:"No wallets available"}),/*#__PURE__*/t("p",{children:["Please download an external wallet provider, like ",l,"."]})]})},"empty-wallet-state")},we=()=>{let{enabled:i,token:a}=w(),{navigate:l,setModalData:r,data:n}=y(),o=h(),{initLoginWithPasskey:c}=f(),d=()=>{o.loginConfig.passkeysForSignupEnabled?l("PasskeySelectSignupOrLogin"):(async()=>{i&&!a?(r({passkeyAuthModalData:{passkeySignupFlow:!1},captchaModalData:{callback:e=>c({captchaToken:e,withPrivyUi:!0}),userIntentRequired:!1,onSuccessNavigateTo:"PasskeyStatusScreen",onErrorNavigateTo:"ErrorScreen"}}),l("CaptchaScreen")):(await c({withPrivyUi:!0,captchaToken:a}),r({passkeyAuthModalData:{passkeySignupFlow:!1}}),l("PasskeyStatusScreen"))})()};return 0===s((()=>{let e=n?.login?.loginMethods;return e?e.filter((e=>"passkey"!==e)).length:Object.entries(o.loginMethods).filter((([e,t])=>t)).filter((([e])=>"passkey"!==e)).length}),[o.loginMethods,n?.login])?/*#__PURE__*/t(S,{onClick:d,children:[/*#__PURE__*/e(q,{})," Continue with passkey"]}):/*#__PURE__*/e(B,{as:"button",onClick:d,size:"sm",variant:"navigation",style:{width:"100%",justifyContent:"center"},children:"I have a passkey"})},ve=({isEditable:a,setIsEditable:l,defaultValue:r})=>{let n=o(null),{authenticated:s}=D(),{navigate:c,setModalData:d,currentScreen:p,data:u}=y(),{initLoginWithSms:m}=f(),{enabled:g,token:v}=w(),{whatsAppEnabled:C}=h();/*#__PURE__*/return t(i,{children:[/*#__PURE__*/e(x,{$if:!a,children:/*#__PURE__*/e(K,{ref:n,onSubmit:async function({qualifiedPhoneNumber:e}){if(!g||v||s)try{await m({phoneNumber:e,captchaToken:v,withPrivyUi:!0,disableSignup:u?.login?.disableSignup}),c("AwaitingPasswordlessCodeScreen")}catch(e){d({errorModalData:{error:e,previousScreen:p||"LandingScreen"}}),c("ErrorScreen")}else d({captchaModalData:{callback:t=>m({phoneNumber:e,captchaToken:t,withPrivyUi:!0,disableSignup:u?.login?.disableSignup}),userIntentRequired:!1,onSuccessNavigateTo:"AwaitingPasswordlessCodeScreen",onErrorNavigateTo:"ErrorScreen"}}),c("CaptchaScreen")},defaultValue:r})}),/*#__PURE__*/e(x,{$if:a,children:/*#__PURE__*/t(S,{onClick:()=>{l(),setTimeout((()=>{n.current?.focus()}),0)},children:[/*#__PURE__*/e(T,{children:/*#__PURE__*/e(_,{})}),"Continue with ",C?"WhatsApp":"SMS"]})})]})};let Ce={apple:{logo:ae,displayName:"Apple"},discord:{logo:ie,displayName:"Discord"},github:{logo:te,displayName:"GitHub"},google:{logo:ee,displayName:"Google"},linkedin:{logo:X,displayName:"LinkedIn"},spotify:{logo:J,displayName:"Spotify"},instagram:{logo:Z,displayName:"Instagram"},telegram:{logo:ne,displayName:"Telegram"},twitter:{logo:Y,displayName:"Twitter"},tiktok:{logo:Q,displayName:"TikTok"},line:{logo:re,displayName:"LINE"},twitch:{logo:le,displayName:"Twitch"}};const be=({provider:i})=>{let{enabled:a,token:l}=w(),{navigate:n,setModalData:o,data:c}=y(),[d,p]=r(!1),u=h(),{initLoginWithOAuth:m}=f(),{accountType:g}=A(),C=s((()=>g&&"guest"!==g&&"authorization_key"!==g&&"cross_app"!==g?v(g):null),[g]),{displayName:b,logo:k}=s((()=>{if(O(i)){let t=u.customOAuthProviders.find((e=>e.provider===i)),a=t.provider_icon_url,l=t.provider_display_name;return{displayName:l,logo:({style:t})=>/*#__PURE__*/e("img",{alt:`${l} logo`,src:a,style:t})}}return Ce[i]}),[i,u.customOAuthProviders]);/*#__PURE__*/return t(S,{onClick:()=>{p(!0),setTimeout((()=>{p(!1)}),2e3),a&&!l?(o({captchaModalData:{callback:e=>m(i,e,c?.login?.disableSignup),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ErrorScreen"}}),n("CaptchaScreen")):m(i,void 0,c?.login?.disableSignup)},disabled:d,children:[/*#__PURE__*/e(T,{$fullSize:!0,children:/*#__PURE__*/e(k,{style:{width:"32px",height:"32px"}})}),b,C?.loginMethod===i&&/*#__PURE__*/e(ke,{color:"gray",children:"Recent"})]})};let ke=c(H)`
  margin-left: auto;
`;const Se=()=>{let{enabled:i,token:a}=w(),{navigate:l,setModalData:n,data:o}=y(),[s,c]=r(!1),{initLoginWithTelegram:d}=f(),{accountType:p}=A();async function u(e){try{await d(e,o?.login?.disableSignup),n({telegramAuthModalData:{seamlessAuth:!1}}),l("TelegramAuthScreen")}catch(e){console.error(e),c(!1)}}/*#__PURE__*/return t(S,{onClick:async function(){if(c(!0),i&&!a)return n({captchaModalData:{callback:u,userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ErrorScreen"}}),void l("CaptchaScreen");await u(a)},disabled:s,children:[/*#__PURE__*/e(ne,{width:32,height:32}),"Telegram","telegram"===p&&/*#__PURE__*/e(Te,{color:"gray",children:"Recent"})]})};let Te=c(H)`
  margin-left: auto;
`;const Me=({onClick:i,text:a,icon:l})=>/*#__PURE__*/t(S,{onClick:i,children:[/*#__PURE__*/e(T,{children:l}),/*#__PURE__*/e(E,{children:a})]}),xe=({connectOnly:a})=>{let{closePrivyModal:l}=f(),{data:o,setModalData:c,onUserCloseViaDialogOrKeybindRef:p,navigate:u}=y(),g=h(),w=o?.login,S=g.appearance.walletList,T=w?.walletChainType??g.appearance.walletChainType,{accountType:M,walletClientType:x,chainType:L}=A(),W=s((()=>M&&"guest"!==M&&"authorization_key"!==M&&"cross_app"!==M?v(M):null),[M]),{email:E,sms:I,google:N,twitter:j,discord:D,github:R,spotify:V,instagram:_,tiktok:U,line:F,twitch:H,linkedin:z,apple:G,wallet:q,farcaster:B,telegram:K}=s((()=>w?.loginMethods?$(w.loginMethods,!0):null),[w])??g.loginMethods,{wallets:Q}=C({enabled:m(q?S:[]),walletList:S,walletChainType:T}),Y=g.customOAuthProviders,Z=g.crossAppProviders,{passkey:J}=g.loginMethods,X=[E&&"email",I&&"sms",N&&"google",j&&"twitter",D&&"discord",R&&"github",V&&"spotify",_&&"instagram",U&&"tiktok",F&&"line",H&&"twitch",z&&"linkedin",G&&"apple",B&&"farcaster",K&&"telegram",...Y.map((e=>e.provider)),...Z].filter((e=>!!e)),ee=X.length>0,te=s((()=>q&&!ee?"web3-first":q&&g?.appearance.loginGroupPriority||"web2-first"),[q,ee,g?.appearance.loginGroupPriority]),ie=g?.appearance.hideDirectWeb2Inputs,[ae,le]=r("default"),[re,ne]=r(Ie({mostRecentlyUsedAccountType:M,smsAvailable:I,emailAvailable:E,prefilledType:w?.prefill?.type}));n((()=>{ne(Ie({mostRecentlyUsedAccountType:M,smsAvailable:I,emailAvailable:E,prefilledType:w?.prefill?.type}))}),[E,I,M]);let de=()=>{l({shouldCallAuthOnSuccess:!0}),setTimeout((()=>{le("default")}),150)};p.current=de;let pe=[];x&&q?pe.push(x):W?.loginMethod&&X.includes(W.loginMethod)&&pe.push(W.loginMethod);let ge=t=>{if("email"===t)/*#__PURE__*/return e(he,{isEditable:"email"===re,setIsEditable:()=>{ne("email")},defaultValue:"email"===w?.prefill?.type?w.prefill.value:void 0},t);if("sms"===t)/*#__PURE__*/return e(ve,{isEditable:"sms"===re,setIsEditable:()=>{ne("sms")},defaultValue:"phone"===w?.prefill?.type?w.prefill.value:void 0},t);if("apple"===t)/*#__PURE__*/return e(be,{provider:"apple"},t);if("discord"===t)/*#__PURE__*/return e(be,{provider:"discord"},t);if("farcaster"===t)/*#__PURE__*/return e(me,{},t);if("github"===t)/*#__PURE__*/return e(be,{provider:"github"},t);if("google"===t)/*#__PURE__*/return e(be,{provider:"google"},t);if("linkedin"===t)/*#__PURE__*/return e(be,{provider:"linkedin"},t);if("tiktok"===t)/*#__PURE__*/return e(be,{provider:"tiktok"},t);if("line"===t)/*#__PURE__*/return e(be,{provider:"line"},t);if("twitch"===t)/*#__PURE__*/return e(be,{provider:"twitch"},t);if("spotify"===t)/*#__PURE__*/return e(be,{provider:"spotify"},t);if("instagram"===t)/*#__PURE__*/return e(be,{provider:"instagram"},t);if("twitter"===t)/*#__PURE__*/return e(be,{provider:"twitter"},t);if("telegram"===t)return g.loginConfig.telegramHasHmacCredentials?/*#__PURE__*/e(Se,{},t):/*#__PURE__*/e(be,{provider:"telegram"},t);if(O(t))/*#__PURE__*/return e(be,{provider:t},t);if(t.startsWith("privy:")){let i=t.split(":")[1];if(!i)throw Error("Invalid cross-app provider format. App ID missing.");/*#__PURE__*/return e(ue,{appId:i},t)}let i=Q.findIndex((({id:e})=>e===b.normalize(t))),l="solana"===L?"solana-only":"ethereum-only";/*#__PURE__*/return e(k,{recent:!0,index:i,data:{wallets:Q,walletChainType:l,handleWalletClick(e){c((t=>({...t,externalConnectWallet:{walletList:S,walletChainType:l,preSelectedWalletId:e.id}}))),u(a?"ConnectOnlyLandingScreen":"AuthenticateWithWalletScreen")}}})},fe=Q.filter((e=>e.id!==b.normalize(x||""))),Ce=fe.map(((t,i)=>/*#__PURE__*/e(k,{index:i,data:{walletChainType:T,wallets:fe,handleWalletClick(e){c((t=>({...t,externalConnectWallet:{walletList:S,walletChainType:T,preSelectedWalletId:e.id}}))),u(a?"ConnectOnlyLandingScreen":"AuthenticateWithWalletScreen")}}},t.id))),ke=X.filter((e=>e!==W?.loginMethod)).flatMap(ge),Te=pe.flatMap(ge);"web3-first"===te&&"default"===ae?Ce.unshift(...Te):"web2-first"===te&&ke.unshift(...Te);let xe="web2-overflow"===ae?()=>le("default"):void 0,Ne=X.filter((e=>"email"!==e&&"sms"!==e)),je=We({priority:te,email:E,sms:I,social:Ne}),De=Ee({priority:te,email:E,sms:I,social:Ne}),Oe=/*#__PURE__*/e(oe,{text:Pe({priority:te}),onClick:()=>{c({...o,externalConnectWallet:{walletChainType:w?.walletChainType??g.appearance.walletChainType}}),u(a?"ConnectOnlyLandingScreen":"AuthenticateWithWalletScreen")}}),Re=/*#__PURE__*/e(Me,{text:je,icon:De,onClick:()=>le("web2-overflow")}),Ve=ie?0:1,_e=q&&Ce.length>0,Ue=0===ke.length&&q&&0===Ce.length,Fe=5-(_e?1:0),He="default"===ae&&g?.appearance.logo,ze="default"===ae&&g.appearance.loginMessage;/*#__PURE__*/return t(se,{title:g.appearance.landingHeader,icon:He?/*#__PURE__*/e(ce,{}):void 0,iconVariant:He?"logo":void 0,onClose:de,showClose:!0,onBack:xe,showBack:!!xe,helpText:g||J&&"default"===ae?/*#__PURE__*/t(i,{children:[J&&"default"===ae&&!g.globalDisablePasskeys&&/*#__PURE__*/e(we,{}),g&&/*#__PURE__*/e(d,{app:g})]}):void 0,watermark:!0,children:[ze&&("string"==typeof g.appearance.loginMessage?/*#__PURE__*/e(Ae,{children:g.appearance.loginMessage}):/*#__PURE__*/e(Le,{children:g.appearance.loginMessage})),/*#__PURE__*/e(P,{$colorScheme:g.appearance.palette.colorScheme,children:"default"===ae&&"web2-first"===te?/*#__PURE__*/t(i,{children:[ke.length>Fe?ke.slice(0,Fe-1):ke,ke.length>Fe&&Re,_e&&Oe,Ue&&/*#__PURE__*/e(ye,{chainType:g.appearance.walletChainType})]}):"default"===ae&&"web3-first"===te?/*#__PURE__*/t(i,{children:[q&&/*#__PURE__*/t(i,{children:[Ce.length>Fe?Ce.slice(0,Fe-1):Ce,Ce.length>Fe&&Oe]}),ke.length>Ve&&Re,ke.length===Ve&&ke[0],Ue&&/*#__PURE__*/e(ye,{chainType:g.appearance.walletChainType})]}):"web2-overflow"===ae?/*#__PURE__*/e(i,{children:"web3-first"===te?ke:ke.slice(3)}):null})]})};let Ae=c.div`
  text-align: center;
  font-size: 14px;
  margin-bottom: 24px;
`,Le=c.div`
  margin-bottom: 24px;
`,We=({priority:e,email:t,sms:i,social:a})=>"web2-first"===e?"Other socials":t&&i&&a.length>0||t&&a.length>0?"Log in with email or socials":i&&a.length>0?"Log in with sms or socials":t&&i?"Continue with email or sms":t?"Continue with email":i?"Continue with sms":"Log in with a social account",Ee=({priority:t,email:i,sms:a,social:l})=>"web2-first"===t||l.length>0?/*#__PURE__*/e(U,{}):i&&a?/*#__PURE__*/e(fe,{}):i?/*#__PURE__*/e(V,{}):a?/*#__PURE__*/e(_,{}):null,Pe=({priority:e})=>"web2-first"===e?"Continue with a wallet":"Other wallets";const Ie=({mostRecentlyUsedAccountType:e,smsAvailable:t,emailAvailable:i,prefilledType:a})=>i&&("email"===e&&"phone"!==a||"email"===a)||!t||"phone"!==e&&"phone"!==a?"email":"sms",Ne=({connectOnly:l})=>{let{closePrivyModal:o,connectors:c}=f(),{data:m,setModalData:w,onUserCloseViaDialogOrKeybindRef:C,navigate:S}=y(),T=h(),M=T.appearance.palette.colorScheme,{accountType:x,walletClientType:L}=A(),W=s((()=>x&&"guest"!==x&&"authorization_key"!==x&&"cross_app"!==x?v(x):null),[x]),E=T.loginMethodsAndOrder?.primary??[],D=T.loginMethodsAndOrder?.overflow??[],O=s((()=>[...E,...D]),[E,D]),R=T.loginMethods.passkey,V=m?.login,_=[];L&&O.includes(L)?_.push(L):x&&O.includes(W?.loginMethod)&&_.push(W?.loginMethod);let[U,F]=r("default"),[H,z]=r(Ie({mostRecentlyUsedAccountType:x,smsAvailable:O.includes("sms"),emailAvailable:O.includes("email"),prefilledType:V?.prefill?.type}));n((()=>{z(Ie({mostRecentlyUsedAccountType:x,smsAvailable:O.includes("sms"),emailAvailable:O.includes("email"),prefilledType:V?.prefill?.type}))}),[O,x]),n((()=>{"phone"===x&&z("sms");let e=O.indexOf("sms"),t=O.indexOf("email");e>-1&&e<t&&z("sms")}),[x,E,D]);let $=()=>{o({shouldCallAuthOnSuccess:!0}),setTimeout((()=>{F("default")}),150)};C.current=$;let{listings:G}=g(),q=t=>{if("email"===t)/*#__PURE__*/return e(he,{isEditable:"email"===H,setIsEditable:()=>{z("email")},defaultValue:"email"===V?.prefill?.type?V.prefill.value:void 0},t);if("sms"===t)/*#__PURE__*/return e(ve,{isEditable:"sms"===H,setIsEditable:()=>{z("sms")},defaultValue:"phone"===V?.prefill?.type?V.prefill.value:void 0},t);if("apple"===t)/*#__PURE__*/return e(be,{provider:"apple"},t);if("discord"===t)/*#__PURE__*/return e(be,{provider:"discord"},t);if("farcaster"===t)/*#__PURE__*/return e(me,{},t);if("github"===t)/*#__PURE__*/return e(be,{provider:"github"},t);if("google"===t)/*#__PURE__*/return e(be,{provider:"google"},t);if("linkedin"===t)/*#__PURE__*/return e(be,{provider:"linkedin"},t);if("spotify"===t)/*#__PURE__*/return e(be,{provider:"spotify"},t);if("instagram"===t)/*#__PURE__*/return e(be,{provider:"instagram"},t);if("tiktok"===t)/*#__PURE__*/return e(be,{provider:"tiktok"},t);if("line"===t)/*#__PURE__*/return e(be,{provider:"line"},t);if("twitch"===t)/*#__PURE__*/return e(be,{provider:"twitch"},t);if("twitter"===t)/*#__PURE__*/return e(be,{provider:"twitter"},t);if("telegram"===t)return T.loginConfig.telegramHasHmacCredentials?/*#__PURE__*/e(Se,{},t):/*#__PURE__*/e(be,{provider:"telegram"},t);if(t.startsWith("privy:"))/*#__PURE__*/return e(ue,{appId:t.replace("privy:","")},t);let i=T.appearance.walletChainType,a=new b(i,[t]).getWallets(c,G);return a.wallets.map(((t,r)=>/*#__PURE__*/e(k,{index:r,data:{wallets:a.wallets,walletChainType:i,handleWalletClick(e){w((t=>({...t,externalConnectWallet:{walletList:O,walletChainType:i,preSelectedWalletId:e.id}}))),S(l?"ConnectOnlyLandingScreen":"AuthenticateWithWalletScreen")}}},t.id+r)))},B=_.flatMap(q),K=E.filter((e=>e!==L&&e!==W?.loginMethod)).flatMap(q),Q=D.filter((e=>e!==L&&e!==W?.loginMethod)).flatMap(q),[Y,Z]=j([...B,...K,...Q],je({primary:K.length+B.length,overflow:Q.length}));/*#__PURE__*/return t(i,{children:[/*#__PURE__*/e(p,{title:T.appearance.landingHeader,onClose:$,backFn:"default"===U?void 0:()=>{F("default")}}),"default"===U&&/*#__PURE__*/e(De,{}),"default"===U&&("string"==typeof T.appearance.loginMessage?/*#__PURE__*/e(I,{children:T.appearance.loginMessage}):T.appearance.loginMessage),/*#__PURE__*/e(N,{style:{overflow:"hidden"},children:/*#__PURE__*/t(P,{$colorScheme:M,children:["default"===U&&/*#__PURE__*/t(i,{children:[Y,Z.length>0&&/*#__PURE__*/e(Me,{text:"More options",icon:/*#__PURE__*/e(a,{}),onClick:()=>F("overflow")})]}),"overflow"===U&&/*#__PURE__*/e(i,{children:Z}),R&&"default"===U&&/*#__PURE__*/e(we,{})]})}),T&&/*#__PURE__*/e(d,{app:T}),/*#__PURE__*/e(u,{})]})};let je=({primary:e,overflow:t})=>e<5?e:5===e&&0===t?5:4,De=c((t=>{let i=h();return i?.appearance.logo?/*#__PURE__*/e(de,{...t,children:/*#__PURE__*/e(ce,{})}):null}))`
  margin-bottom: 16px;
`;export{Ne as C,xe as L};
//# sourceMappingURL=CustomLandingScreenView-CEYyi1B7.mjs.map
