"use strict";var e=require("react/jsx-runtime"),t=require("@heroicons/react/24/outline/UserCircleIcon"),i=require("react"),a=require("styled-components"),l=require("./ModalHeader-Cpls13mi.js"),r=require("./context-rs-ygOK2.js"),n=require("./index-Ub4KpwSY.js"),s=require("./internal-context-CdsQ3LEl.js"),o=require("./modal-context-BgeioxwT.js"),d=require("./index-BoiKFBqR.js"),c=require("./ConnectWalletView-DM2o0nGM.js"),u=require("./useActiveWallet-dTc6deka.js"),p=require("./wallet-connect-BuohfvHK.js"),h=require("./privy-context-UTJouJ1x.js"),g=require("./usePrivy-Dt4_yE6Q.js"),m=require("lucide-react"),y=require("./ConnectEmailForm-C87PXIXT.js"),f=require("./Chip-C6r7fZiR.js"),x=require("./farcaster-CWHXGAib.js"),j=require("@privy-io/js-sdk-core"),v=require("@heroicons/react/24/outline/QuestionMarkCircleIcon"),w=require("@heroicons/react/24/outline/FingerPrintIcon"),C=require("./Link-BdtTp2J4.js"),b=require("./ConnectPhoneForm-xFB1DoYY.js"),S=require("./twitter-CJSxxOMI.js"),k=require("./twitch-BNvhZb2Y.js"),M=require("./telegram-D3O0_F1a.js"),T=require("./WalletOverflowButton-KujiMtRs.js"),L=require("./ScreenLayout-DaFW0I3a.js");function A(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var W=/*#__PURE__*/A(t),P=/*#__PURE__*/A(i),I=/*#__PURE__*/A(v),E=/*#__PURE__*/A(w);const q=()=>{let t=r.useAppConfig(),i=t?.appearance?.logo,a=`${t?.name} logo`,l={maxHeight:"90px",maxWidth:"180px"};return i?"string"==typeof i?/*#__PURE__*/e.jsx("img",{src:i,alt:a,style:l}):"svg"===i.type||"img"===i.type?/*#__PURE__*/P.default.cloneElement(i,{alt:a,style:l}):(console.warn("`config.appearance.logo` must be a string, or an SVG / IMG element. Nothing will be rendered."),null):null},F=a.styled.div`
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 0;
  flex-grow: 1;
  justify-content: center;
`,N=({name:t,logoUrl:i,size:a="38px"})=>{let l=`${t??"Provider app"} logo`;return"string"==typeof i?/*#__PURE__*/e.jsx("img",{src:i,alt:l,style:{width:a,height:a,maxHeight:"90px",maxWidth:"180px",borderRadius:"8px"}}):
/*#__PURE__*/e.jsx("span",{})},D=({appId:t})=>{let[a,l]=i.useState(void 0),{startCrossAppAuthFlow:r}=g.useCrossAppAccountsInternal(),{authenticated:n}=h.usePrivyContext(),{data:d}=o.usePrivyModal(),{client:c}=s.usePrivyInternal();return i.useEffect((()=>{(async()=>{c&&l(await c.getCrossAppProviderDetails(t))})()}),[c]),/*#__PURE__*/e.jsx(u.LoginMethodButton,{onClick:()=>r({appId:t,action:n?"link":"login",disableSignup:d?.login?.disableSignup}),disabled:!a,children:a?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(u.LoginMethodIconWrapper,{$fullSize:!0,children:/*#__PURE__*/e.jsx(N,{name:a.name,logoUrl:a.icon_url||void 0,size:"32px"})}),a.name]}):/*#__PURE__*/e.jsx(u.ButtonLoader,{})})},O=({isEditable:t,setIsEditable:a,defaultValue:l})=>{let r=i.useRef(null);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(u.Hide,{$if:!t,children:/*#__PURE__*/e.jsx(y.ConnectEmailForm,{ref:r,defaultValue:l})}),/*#__PURE__*/e.jsx(u.Hide,{$if:t,children:/*#__PURE__*/e.jsxs(u.LoginMethodButton,{onClick:()=>{a(),setTimeout((()=>{r.current?.focus()}),0)},children:[/*#__PURE__*/e.jsx(u.LoginMethodIconWrapper,{children:/*#__PURE__*/e.jsx(m.Mail,{})}),"Continue with Email"]})})]})},R=()=>{let[t,a]=i.useState(!1),{currentScreen:l,navigate:r,setModalData:n,data:c}=o.usePrivyModal(),{enabled:p,token:h}=d.useCaptcha(),{initLoginWithFarcaster:g}=s.usePrivyInternal(),{accountType:m}=u.useRecentlyUsedLogin();/*#__PURE__*/return e.jsxs(u.LoginMethodButton,{onClick:async()=>{a(!0);try{p&&!h?(n({captchaModalData:{callback:e=>g(e,c?.login?.disableSignup),userIntentRequired:!0,onSuccessNavigateTo:"FarcasterConnectStatusScreen",onErrorNavigateTo:"ErrorScreen"}}),r("CaptchaScreen")):(await g(h,c?.login?.disableSignup),r("FarcasterConnectStatusScreen"))}catch(e){n({errorModalData:{error:e,previousScreen:l||"LandingScreen"}}),r("ErrorScreen")}finally{a(!1)}},disabled:!1,children:[/*#__PURE__*/e.jsx(x.Farcaster,{width:32,height:32})," Farcaster",t&&/*#__PURE__*/e.jsx(u.ButtonLoader,{}),"farcaster"===m&&/*#__PURE__*/e.jsx(U,{color:"gray",children:"Recent"})]})};let U=a.styled(f.Chip)`
  margin-left: auto;
`;const H=({...t})=>/*#__PURE__*/e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...t,children:[/*#__PURE__*/e.jsxs("g",{clipPath:"url(#clip0_2856_1743)",children:[/*#__PURE__*/e.jsx("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.jsx("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.jsx("defs",{children:/*#__PURE__*/e.jsx("clipPath",{id:"clip0_2856_1743",children:/*#__PURE__*/e.jsx("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]}),B=({chainType:t,withPadding:i})=>{let a="";return a="ethereum-only"===t||"ethereum-and-solana"===t?"Rainbow, Phantom, or Coinbase Wallet":"Phantom or Solflare",/*#__PURE__*/e.jsx(u.EmptyWalletState,{$withPadding:i,children:/*#__PURE__*/e.jsxs(u.Header,{children:[/*#__PURE__*/e.jsx(I.default,{style:{color:"var(--privy-color-warn)",height:48,width:48}}),/*#__PURE__*/e.jsx("h3",{children:"No wallets available"}),/*#__PURE__*/e.jsxs("p",{children:["Please download an external wallet provider, like ",a,"."]})]})},"empty-wallet-state")},V=()=>{let{enabled:t,token:a}=d.useCaptcha(),{navigate:l,setModalData:n,data:c}=o.usePrivyModal(),p=r.useAppConfig(),{initLoginWithPasskey:h}=s.usePrivyInternal(),g=()=>{p.loginConfig.passkeysForSignupEnabled?l("PasskeySelectSignupOrLogin"):(async()=>{t&&!a?(n({passkeyAuthModalData:{passkeySignupFlow:!1},captchaModalData:{callback:e=>h({captchaToken:e,withPrivyUi:!0}),userIntentRequired:!1,onSuccessNavigateTo:"PasskeyStatusScreen",onErrorNavigateTo:"ErrorScreen"}}),l("CaptchaScreen")):(await h({withPrivyUi:!0,captchaToken:a}),n({passkeyAuthModalData:{passkeySignupFlow:!1}}),l("PasskeyStatusScreen"))})()};return 0===i.useMemo((()=>{let e=c?.login?.loginMethods;return e?e.filter((e=>"passkey"!==e)).length:Object.entries(p.loginMethods).filter((([e,t])=>t)).filter((([e])=>"passkey"!==e)).length}),[p.loginMethods,c?.login])?/*#__PURE__*/e.jsxs(u.LoginMethodButton,{onClick:g,children:[/*#__PURE__*/e.jsx(E.default,{})," Continue with passkey"]}):/*#__PURE__*/e.jsx(C.Link,{as:"button",onClick:g,size:"sm",variant:"navigation",style:{width:"100%",justifyContent:"center"},children:"I have a passkey"})},_=({isEditable:t,setIsEditable:a,defaultValue:l})=>{let n=i.useRef(null),{authenticated:c}=h.usePrivyContext(),{navigate:p,setModalData:g,currentScreen:y,data:f}=o.usePrivyModal(),{initLoginWithSms:x}=s.usePrivyInternal(),{enabled:j,token:v}=d.useCaptcha(),{whatsAppEnabled:w}=r.useAppConfig();/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(u.Hide,{$if:!t,children:/*#__PURE__*/e.jsx(b.ConnectPhoneNumberForm,{ref:n,onSubmit:async function({qualifiedPhoneNumber:e}){if(!j||v||c)try{await x({phoneNumber:e,captchaToken:v,withPrivyUi:!0,disableSignup:f?.login?.disableSignup}),p("AwaitingPasswordlessCodeScreen")}catch(e){g({errorModalData:{error:e,previousScreen:y||"LandingScreen"}}),p("ErrorScreen")}else g({captchaModalData:{callback:t=>x({phoneNumber:e,captchaToken:t,withPrivyUi:!0,disableSignup:f?.login?.disableSignup}),userIntentRequired:!1,onSuccessNavigateTo:"AwaitingPasswordlessCodeScreen",onErrorNavigateTo:"ErrorScreen"}}),p("CaptchaScreen")},defaultValue:l})}),/*#__PURE__*/e.jsx(u.Hide,{$if:t,children:/*#__PURE__*/e.jsxs(u.LoginMethodButton,{onClick:()=>{a(),setTimeout((()=>{n.current?.focus()}),0)},children:[/*#__PURE__*/e.jsx(u.LoginMethodIconWrapper,{children:/*#__PURE__*/e.jsx(m.Smartphone,{})}),"Continue with ",w?"WhatsApp":"SMS"]})})]})};let z={apple:{logo:S.Apple,displayName:"Apple"},discord:{logo:S.Discord,displayName:"Discord"},github:{logo:S.Github,displayName:"GitHub"},google:{logo:S.Google,displayName:"Google"},linkedin:{logo:S.LinkedIn,displayName:"LinkedIn"},spotify:{logo:S.Spotify,displayName:"Spotify"},instagram:{logo:S.Instagram,displayName:"Instagram"},telegram:{logo:M.Telegram,displayName:"Telegram"},twitter:{logo:S.Twitter,displayName:"Twitter"},tiktok:{logo:S.Tiktok,displayName:"TikTok"},line:{logo:k.Line,displayName:"LINE"},twitch:{logo:k.Twitch,displayName:"Twitch"}};const $=({provider:t})=>{let{enabled:a,token:l}=d.useCaptcha(),{navigate:n,setModalData:c,data:p}=o.usePrivyModal(),[g,m]=i.useState(!1),y=r.useAppConfig(),{initLoginWithOAuth:f}=s.usePrivyInternal(),{accountType:x}=u.useRecentlyUsedLogin(),j=i.useMemo((()=>x&&"guest"!==x&&"authorization_key"!==x&&"cross_app"!==x?d.toDisplayFromAccountType(x):null),[x]),{displayName:v,logo:w}=i.useMemo((()=>{if(h.isCustomOAuthProvider(t)){let i=y.customOAuthProviders.find((e=>e.provider===t)),a=i.provider_icon_url,l=i.provider_display_name;return{displayName:l,logo:({style:t})=>/*#__PURE__*/e.jsx("img",{alt:`${l} logo`,src:a,style:t})}}return z[t]}),[t,y.customOAuthProviders]);/*#__PURE__*/return e.jsxs(u.LoginMethodButton,{onClick:()=>{m(!0),setTimeout((()=>{m(!1)}),2e3),a&&!l?(c({captchaModalData:{callback:e=>f(t,e,p?.login?.disableSignup),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ErrorScreen"}}),n("CaptchaScreen")):f(t,void 0,p?.login?.disableSignup)},disabled:g,children:[/*#__PURE__*/e.jsx(u.LoginMethodIconWrapper,{$fullSize:!0,children:/*#__PURE__*/e.jsx(w,{style:{width:"32px",height:"32px"}})}),v,j?.loginMethod===t&&/*#__PURE__*/e.jsx(G,{color:"gray",children:"Recent"})]})};let G=a.styled(f.Chip)`
  margin-left: auto;
`;const K=()=>{let{enabled:t,token:a}=d.useCaptcha(),{navigate:l,setModalData:r,data:n}=o.usePrivyModal(),[c,p]=i.useState(!1),{initLoginWithTelegram:h}=s.usePrivyInternal(),{accountType:g}=u.useRecentlyUsedLogin();async function m(e){try{await h(e,n?.login?.disableSignup),r({telegramAuthModalData:{seamlessAuth:!1}}),l("TelegramAuthScreen")}catch(e){console.error(e),p(!1)}}/*#__PURE__*/return e.jsxs(u.LoginMethodButton,{onClick:async function(){if(p(!0),t&&!a)return r({captchaModalData:{callback:m,userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ErrorScreen"}}),void l("CaptchaScreen");await m(a)},disabled:c,children:[/*#__PURE__*/e.jsx(M.Telegram,{width:32,height:32}),"Telegram","telegram"===g&&/*#__PURE__*/e.jsx(Q,{color:"gray",children:"Recent"})]})};let Q=a.styled(f.Chip)`
  margin-left: auto;
`;const Y=({onClick:t,text:i,icon:a})=>/*#__PURE__*/e.jsxs(u.LoginMethodButton,{onClick:t,children:[/*#__PURE__*/e.jsx(u.LoginMethodIconWrapper,{children:a}),/*#__PURE__*/e.jsx(u.Grow,{children:i})]});let Z=a.styled.div`
  text-align: center;
  font-size: 14px;
  margin-bottom: 24px;
`,J=a.styled.div`
  margin-bottom: 24px;
`,X=({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.jsx(m.UserCircle,{}):i&&a?/*#__PURE__*/e.jsx(H,{}):i?/*#__PURE__*/e.jsx(m.Mail,{}):a?/*#__PURE__*/e.jsx(m.Smartphone,{}):null,te=({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";let ae=({primary:e,overflow:t})=>e<5?e:5===e&&0===t?5:4,le=a.styled((t=>{let i=r.useAppConfig();return i?.appearance.logo?/*#__PURE__*/e.jsx(F,{...t,children:/*#__PURE__*/e.jsx(q,{})}):null}))`
  margin-bottom: 16px;
`;exports.CustomLandingScreenView=({connectOnly:t})=>{let{closePrivyModal:a,connectors:h}=s.usePrivyInternal(),{data:g,setModalData:m,onUserCloseViaDialogOrKeybindRef:y,navigate:f}=o.usePrivyModal(),x=r.useAppConfig(),j=x.appearance.palette.colorScheme,{accountType:v,walletClientType:w}=u.useRecentlyUsedLogin(),C=i.useMemo((()=>v&&"guest"!==v&&"authorization_key"!==v&&"cross_app"!==v?d.toDisplayFromAccountType(v):null),[v]),b=x.loginMethodsAndOrder?.primary??[],S=x.loginMethodsAndOrder?.overflow??[],k=i.useMemo((()=>[...b,...S]),[b,S]),M=x.loginMethods.passkey,T=g?.login,L=[];w&&k.includes(w)?L.push(w):v&&k.includes(C?.loginMethod)&&L.push(C?.loginMethod);let[A,P]=i.useState("default"),[I,E]=i.useState(ie({mostRecentlyUsedAccountType:v,smsAvailable:k.includes("sms"),emailAvailable:k.includes("email"),prefilledType:T?.prefill?.type}));i.useEffect((()=>{E(ie({mostRecentlyUsedAccountType:v,smsAvailable:k.includes("sms"),emailAvailable:k.includes("email"),prefilledType:T?.prefill?.type}))}),[k,v]),i.useEffect((()=>{"phone"===v&&E("sms");let e=k.indexOf("sms"),t=k.indexOf("email");e>-1&&e<t&&E("sms")}),[v,b,S]);let q=()=>{a({shouldCallAuthOnSuccess:!0}),setTimeout((()=>{P("default")}),150)};y.current=q;let{listings:F}=n.useExternalWalletListings(),N=i=>{if("email"===i)/*#__PURE__*/return e.jsx(O,{isEditable:"email"===I,setIsEditable:()=>{E("email")},defaultValue:"email"===T?.prefill?.type?T.prefill.value:void 0},i);if("sms"===i)/*#__PURE__*/return e.jsx(_,{isEditable:"sms"===I,setIsEditable:()=>{E("sms")},defaultValue:"phone"===T?.prefill?.type?T.prefill.value:void 0},i);if("apple"===i)/*#__PURE__*/return e.jsx($,{provider:"apple"},i);if("discord"===i)/*#__PURE__*/return e.jsx($,{provider:"discord"},i);if("farcaster"===i)/*#__PURE__*/return e.jsx(R,{},i);if("github"===i)/*#__PURE__*/return e.jsx($,{provider:"github"},i);if("google"===i)/*#__PURE__*/return e.jsx($,{provider:"google"},i);if("linkedin"===i)/*#__PURE__*/return e.jsx($,{provider:"linkedin"},i);if("spotify"===i)/*#__PURE__*/return e.jsx($,{provider:"spotify"},i);if("instagram"===i)/*#__PURE__*/return e.jsx($,{provider:"instagram"},i);if("tiktok"===i)/*#__PURE__*/return e.jsx($,{provider:"tiktok"},i);if("line"===i)/*#__PURE__*/return e.jsx($,{provider:"line"},i);if("twitch"===i)/*#__PURE__*/return e.jsx($,{provider:"twitch"},i);if("twitter"===i)/*#__PURE__*/return e.jsx($,{provider:"twitter"},i);if("telegram"===i)return x.loginConfig.telegramHasHmacCredentials?/*#__PURE__*/e.jsx(K,{},i):/*#__PURE__*/e.jsx($,{provider:"telegram"},i);if(i.startsWith("privy:"))/*#__PURE__*/return e.jsx(D,{appId:i.replace("privy:","")},i);let a=x.appearance.walletChainType,l=new c.WalletFilterer(a,[i]).getWallets(h,F);return l.wallets.map(((i,r)=>/*#__PURE__*/e.jsx(c.WalletRow,{index:r,data:{wallets:l.wallets,walletChainType:a,handleWalletClick(e){m((t=>({...t,externalConnectWallet:{walletList:k,walletChainType:a,preSelectedWalletId:e.id}}))),f(t?"ConnectOnlyLandingScreen":"AuthenticateWithWalletScreen")}}},i.id+r)))},U=L.flatMap(N),H=b.filter((e=>e!==w&&e!==C?.loginMethod)).flatMap(N),B=S.filter((e=>e!==w&&e!==C?.loginMethod)).flatMap(N),[z,G]=p.splitAtIndex([...U,...H,...B],ae({primary:H.length+U.length,overflow:B.length}));/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(l.ModalHeader,{title:x.appearance.landingHeader,onClose:q,backFn:"default"===A?void 0:()=>{P("default")}}),"default"===A&&/*#__PURE__*/e.jsx(le,{}),"default"===A&&("string"==typeof x.appearance.loginMessage?/*#__PURE__*/e.jsx(u.Subtitle,{children:x.appearance.loginMessage}):x.appearance.loginMessage),/*#__PURE__*/e.jsx(u.AlignBottom,{style:{overflow:"hidden"},children:/*#__PURE__*/e.jsxs(u.LoginMethodContainerWithScrollShadows,{$colorScheme:j,children:["default"===A&&/*#__PURE__*/e.jsxs(e.Fragment,{children:[z,G.length>0&&/*#__PURE__*/e.jsx(Y,{text:"More options",icon:/*#__PURE__*/e.jsx(W.default,{}),onClick:()=>P("overflow")})]}),"overflow"===A&&/*#__PURE__*/e.jsx(e.Fragment,{children:G}),M&&"default"===A&&/*#__PURE__*/e.jsx(V,{})]})}),x&&/*#__PURE__*/e.jsx(l.TermsAndConditions,{app:x}),/*#__PURE__*/e.jsx(l.BlobbyFooter,{})]})},exports.LandingScreenView=({connectOnly:t})=>{let{closePrivyModal:a}=s.usePrivyInternal(),{data:p,setModalData:g,onUserCloseViaDialogOrKeybindRef:m,navigate:y}=o.usePrivyModal(),f=r.useAppConfig(),x=p?.login,v=f.appearance.walletList,w=x?.walletChainType??f.appearance.walletChainType,{accountType:C,walletClientType:b,chainType:S}=u.useRecentlyUsedLogin(),k=i.useMemo((()=>C&&"guest"!==C&&"authorization_key"!==C&&"cross_app"!==C?d.toDisplayFromAccountType(C):null),[C]),{email:M,sms:A,google:W,twitter:P,discord:I,github:E,spotify:F,instagram:N,tiktok:U,line:H,twitch:z,linkedin:G,apple:Q,wallet:ae,farcaster:le,telegram:re}=i.useMemo((()=>x?.loginMethods?j.toObjectKeys(x.loginMethods,!0):null),[x])??f.loginMethods,{wallets:ne}=c.useWalletsListController({enabled:n.shouldFetchWcRegistryListings(ae?v:[]),walletList:v,walletChainType:w}),se=f.customOAuthProviders,oe=f.crossAppProviders,{passkey:de}=f.loginMethods,ce=[M&&"email",A&&"sms",W&&"google",P&&"twitter",I&&"discord",E&&"github",F&&"spotify",N&&"instagram",U&&"tiktok",H&&"line",z&&"twitch",G&&"linkedin",Q&&"apple",le&&"farcaster",re&&"telegram",...se.map((e=>e.provider)),...oe].filter((e=>!!e)),ue=ce.length>0,pe=i.useMemo((()=>ae&&!ue?"web3-first":ae&&f?.appearance.loginGroupPriority||"web2-first"),[ae,ue,f?.appearance.loginGroupPriority]),he=f?.appearance.hideDirectWeb2Inputs,[ge,me]=i.useState("default"),[ye,fe]=i.useState(ie({mostRecentlyUsedAccountType:C,smsAvailable:A,emailAvailable:M,prefilledType:x?.prefill?.type}));i.useEffect((()=>{fe(ie({mostRecentlyUsedAccountType:C,smsAvailable:A,emailAvailable:M,prefilledType:x?.prefill?.type}))}),[M,A,C]);let xe=()=>{a({shouldCallAuthOnSuccess:!0}),setTimeout((()=>{me("default")}),150)};m.current=xe;let je=[];b&&ae?je.push(b):k?.loginMethod&&ce.includes(k.loginMethod)&&je.push(k.loginMethod);let ve=i=>{if("email"===i)/*#__PURE__*/return e.jsx(O,{isEditable:"email"===ye,setIsEditable:()=>{fe("email")},defaultValue:"email"===x?.prefill?.type?x.prefill.value:void 0},i);if("sms"===i)/*#__PURE__*/return e.jsx(_,{isEditable:"sms"===ye,setIsEditable:()=>{fe("sms")},defaultValue:"phone"===x?.prefill?.type?x.prefill.value:void 0},i);if("apple"===i)/*#__PURE__*/return e.jsx($,{provider:"apple"},i);if("discord"===i)/*#__PURE__*/return e.jsx($,{provider:"discord"},i);if("farcaster"===i)/*#__PURE__*/return e.jsx(R,{},i);if("github"===i)/*#__PURE__*/return e.jsx($,{provider:"github"},i);if("google"===i)/*#__PURE__*/return e.jsx($,{provider:"google"},i);if("linkedin"===i)/*#__PURE__*/return e.jsx($,{provider:"linkedin"},i);if("tiktok"===i)/*#__PURE__*/return e.jsx($,{provider:"tiktok"},i);if("line"===i)/*#__PURE__*/return e.jsx($,{provider:"line"},i);if("twitch"===i)/*#__PURE__*/return e.jsx($,{provider:"twitch"},i);if("spotify"===i)/*#__PURE__*/return e.jsx($,{provider:"spotify"},i);if("instagram"===i)/*#__PURE__*/return e.jsx($,{provider:"instagram"},i);if("twitter"===i)/*#__PURE__*/return e.jsx($,{provider:"twitter"},i);if("telegram"===i)return f.loginConfig.telegramHasHmacCredentials?/*#__PURE__*/e.jsx(K,{},i):/*#__PURE__*/e.jsx($,{provider:"telegram"},i);if(h.isCustomOAuthProvider(i))/*#__PURE__*/return e.jsx($,{provider:i},i);if(i.startsWith("privy:")){let t=i.split(":")[1];if(!t)throw Error("Invalid cross-app provider format. App ID missing.");/*#__PURE__*/return e.jsx(D,{appId:t},i)}let a=ne.findIndex((({id:e})=>e===c.WalletFilterer.normalize(i))),l="solana"===S?"solana-only":"ethereum-only";/*#__PURE__*/return e.jsx(c.WalletRow,{recent:!0,index:a,data:{wallets:ne,walletChainType:l,handleWalletClick(e){g((t=>({...t,externalConnectWallet:{walletList:v,walletChainType:l,preSelectedWalletId:e.id}}))),y(t?"ConnectOnlyLandingScreen":"AuthenticateWithWalletScreen")}}})},we=ne.filter((e=>e.id!==c.WalletFilterer.normalize(b||""))),Ce=we.map(((i,a)=>/*#__PURE__*/e.jsx(c.WalletRow,{index:a,data:{walletChainType:w,wallets:we,handleWalletClick(e){g((t=>({...t,externalConnectWallet:{walletList:v,walletChainType:w,preSelectedWalletId:e.id}}))),y(t?"ConnectOnlyLandingScreen":"AuthenticateWithWalletScreen")}}},i.id))),be=ce.filter((e=>e!==k?.loginMethod)).flatMap(ve),Se=je.flatMap(ve);"web3-first"===pe&&"default"===ge?Ce.unshift(...Se):"web2-first"===pe&&be.unshift(...Se);let ke="web2-overflow"===ge?()=>me("default"):void 0,Me=ce.filter((e=>"email"!==e&&"sms"!==e)),Te=X({priority:pe,email:M,sms:A,social:Me}),Le=ee({priority:pe,email:M,sms:A,social:Me}),Ae=/*#__PURE__*/e.jsx(T.WalletOverflowButton,{text:te({priority:pe}),onClick:()=>{g({...p,externalConnectWallet:{walletChainType:x?.walletChainType??f.appearance.walletChainType}}),y(t?"ConnectOnlyLandingScreen":"AuthenticateWithWalletScreen")}}),We=/*#__PURE__*/e.jsx(Y,{text:Te,icon:Le,onClick:()=>me("web2-overflow")}),Pe=he?0:1,Ie=ae&&Ce.length>0,Ee=0===be.length&&ae&&0===Ce.length,qe=5-(Ie?1:0),Fe="default"===ge&&f?.appearance.logo,Ne="default"===ge&&f.appearance.loginMessage;/*#__PURE__*/return e.jsxs(L.ScreenLayout,{title:f.appearance.landingHeader,icon:Fe?/*#__PURE__*/e.jsx(q,{}):void 0,iconVariant:Fe?"logo":void 0,onClose:xe,showClose:!0,onBack:ke,showBack:!!ke,helpText:f||de&&"default"===ge?/*#__PURE__*/e.jsxs(e.Fragment,{children:[de&&"default"===ge&&!f.globalDisablePasskeys&&/*#__PURE__*/e.jsx(V,{}),f&&/*#__PURE__*/e.jsx(l.TermsAndConditions,{app:f})]}):void 0,watermark:!0,children:[Ne&&("string"==typeof f.appearance.loginMessage?/*#__PURE__*/e.jsx(Z,{children:f.appearance.loginMessage}):/*#__PURE__*/e.jsx(J,{children:f.appearance.loginMessage})),/*#__PURE__*/e.jsx(u.LoginMethodContainerWithScrollShadows,{$colorScheme:f.appearance.palette.colorScheme,children:"default"===ge&&"web2-first"===pe?/*#__PURE__*/e.jsxs(e.Fragment,{children:[be.length>qe?be.slice(0,qe-1):be,be.length>qe&&We,Ie&&Ae,Ee&&/*#__PURE__*/e.jsx(B,{chainType:f.appearance.walletChainType})]}):"default"===ge&&"web3-first"===pe?/*#__PURE__*/e.jsxs(e.Fragment,{children:[ae&&/*#__PURE__*/e.jsxs(e.Fragment,{children:[Ce.length>qe?Ce.slice(0,qe-1):Ce,Ce.length>qe&&Ae]}),be.length>Pe&&We,be.length===Pe&&be[0],Ee&&/*#__PURE__*/e.jsx(B,{chainType:f.appearance.walletChainType})]}):"web2-overflow"===ge?/*#__PURE__*/e.jsx(e.Fragment,{children:"web3-first"===pe?be:be.slice(3)}):null})]})};
//# sourceMappingURL=CustomLandingScreenView-x7jk6QYN.js.map
