1import{j as e,a as i}from"./react-vendor-BGQ-fvu8.js";import{M as l,aD as ye,aE as ne,aF as oe,w as ie,aG as le,m as B,I as W,B as q,o as C,k as z,ah as V,aH as de,aI as Se,i as Q,aJ as Ne,aK as me,Y as pe,ao as he,aL as ge,aM as ve,aN as te,R as Y,aO as Ae,aP as Le,aQ as Pe,aC as Me,aR as Ce,aS as Ee,C as Re,D as Fe,j as Ie,aT as Te,ak as ce,al as O}from"./main-BjGN4ckN.js";import{A as xe}from"./arrow-right-BkQYzSlb.js";import{H as Be,u as ae}from"./useNextLocation-CunN72Ln.js";import{A as We}from"./arrow-up-right-B2AINsDR.js";import{A as R}from"./Layout-DamczIiy.js";import{z as N}from"./form-vendor-0hBSyWfc.js";import{a as ze,g as Ue,P as $e,u as De}from"./index-Bidu2D1q.js";import{A as T}from"./auth.schema-Ba-_8pWS.js";import"./useConnectionPage-BTbbEfwS.js";import"./checkbox-CLy4ehUu.js";import{u as J,F as K}from"./useForm-B9SS0o31.js";import"./editor-vendor-BUwO_Joe.js";import"./switch-BTo2ktPD.js";import"./lodash-vendor-0cI-KiNp.js";import{g as fe,b as re}from"./apollo-vendor-WdUFfbxi.js";import{B as _e,a as Oe,b as ee,c as se,d as ue}from"./breadcrumb-DeDhdVa1.js";import{F as Ve,a as He,b as Ge}from"./button-group-BJMhmbJF.js";import"./charts-vendor-fU6IkEZ_.js";import"./chevron-left-5-Gg-yzc.js";import"./popover-0Z-4IRr6.js";import"./useValueChanged-CApZTwHC.js";import"./textarea-BvmO5uxP.js";import"./eye-Bbl7GlPX.js";import"./radio-group-C_7LLUci.js";function qe(s,o){if(window.loadScriptPromise[s])return window.loadScriptPromise[s];const n=new Promise(t=>{if(document.getElementById(s))t();else{const r=document.createElement("script");r.src=o,r.id=s,document.body.appendChild(r),r.onload=()=>{t()}}});return window.loadScriptPromise[s]=n,n}function Qe(){return qe("apple-auth","https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js")}const Ye={login:"auth.role",signup:"auth.role.signup"};function je({variant:s,onConfirm:o,footer:n}){return e.jsxs("div",{className:"animate-in space-y-8 duration-500 fade-in slide-in-from-bottom-4",children:[e.jsxs("div",{className:"space-y-2 text-center",children:[e.jsx("h2",{className:"text-2xl font-semibold tracking-tight",children:e.jsx(l,{id:Ye[s]})}),e.jsx("p",{className:"text-base text-muted-foreground",children:e.jsx(l,{id:"auth.role.description",defaultMessage:"How are you using the platform today?"})})]}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("button",{onClick:o,className:ie(le(),"group flex items-start gap-5 p-6 text-left transition-all hover:border-primary hover:bg-primary-muted/50 hover:shadow-md"),children:[e.jsx("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-full bg-primary-muted text-primary transition-colors group-hover:bg-primary group-hover:text-primary-foreground",children:e.jsx(ye,{size:24,strokeWidth:1.5})}),e.jsxs("div",{className:"flex-1",children:[e.jsx(ne,{children:e.jsx(l,{id:"auth.role.podcaster"})}),e.jsx(oe,{className:"mt-2 leading-relaxed",children:e.jsx(l,{id:"auth.role.podcaster.description"})})]}),e.jsx(xe,{size:18,className:"mt-1 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100"})]}),e.jsxs("a",{href:B.urls.player,target:"_blank",rel:"noreferrer",className:ie(le(),"group flex items-start gap-5 p-6 text-left transition-all hover:border-primary hover:bg-muted/50 hover:shadow-md"),children:[e.jsx("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground transition-colors group-hover:bg-foreground group-hover:text-background",children:e.jsx(Be,{size:24,strokeWidth:1.5})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{children:e.jsx(l,{id:"auth.role.audience"})}),e.jsx(We,{size:14,className:"text-muted-foreground"})]}),e.jsx(oe,{className:"mt-2 leading-relaxed",children:e.jsx(l,{id:"auth.role.audience.description"})})]})]})]}),n&&e.jsx("div",{className:"pt-4 text-center",children:n})]})}function be({appleLoading:s,className:o,onClick:n,compact:t}){const[a,r]=i.useState(!1);return i.useEffect(()=>{Qe()?.then(()=>{window.AppleID.auth.init({clientId:"me.firstory",scope:"name email",redirectURI:`${B.urls.studio}/login`,usePopup:!0}),r(!0)})},[]),e.jsxs(W,{variant:"outline",size:"lg",className:o,loading:s,disabled:s||!a,onClick:n,children:[e.jsx("img",{src:ze,alt:"Apple",className:"mr-2 h-5 w-auto dark:invert"}),t?e.jsx(l,{id:"auth.common.apple",defaultMessage:"Apple"}):e.jsx(l,{id:"auth.continueWithApple"})]})}function we({className:s,next:o,compact:n}){const t=i.useCallback(()=>{const a=B.urls.studio+"/auth/google/callback",r=new URL("https://accounts.google.com/o/oauth2/v2/auth"),d={next:o?o.toString():"/"};r.searchParams.set("client_id",B.googleClientId),r.searchParams.set("redirect_uri",a),r.searchParams.set("response_type","code"),r.searchParams.set("scope","email profile openid"),r.searchParams.set("state",encodeURIComponent(JSON.stringify(d))),r.searchParams.set("access_type","offline"),location.href=r.href},[o]);return e.jsxs(q,{variant:"outline",size:"lg",className:s,onClick:t,children:[e.jsx("img",{src:Ue,alt:"Google",className:"mr-2 size-5"}),n?e.jsx(l,{id:"auth.common.google",defaultMessage:"Google"}):e.jsx(l,{id:"auth.continueWithGoogle"})]})}function ke({error:s}){if(!s)return null;if(T[s]){const o=s;return e.jsx("p",{className:"text-sm","data-testid":"auth-error",children:e.jsx(l,{id:`auth.error.${o}`})})}return e.jsx("p",{className:"text-sm","data-testid":"auth-error",children:e.jsx(l,{id:"auth.error.unknown"})})}function Je({next:s,appleLoading:o,onAppleClick:n,onSubmit:t}
1){const a=C(),r=z(),d=new URLSearchParams(r.search),h=d.get("error"),[m,u]=i.useState(h||null),x=N.object({email:N.string().email(),password:N.string().min(1)}),c=i.useId(),w=J({defaultValues:{email:"",password:""},schema:x,onSubmit:async({data:b})=>{const{error:p}=await t({email:b.email,password:b.password});u(p)}}),j={email:{label:a.formatMessage({id:"general.email"}),name:"email",control:"text-field"},password:{label:a.formatMessage({id:"general.password"}),name:"password",control:"password-input"}},f=i.useCallback(async()=>{const{error:b}=await n();u(b)},[n]);return e.jsx("div",{className:"w-full text-center",children:e.jsx(K,{id:c,form:w,controllers:j,className:"gap-4",error:m?e.jsx(ke,{error:m}):null,before:e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(we,{compact:!0,className:"w-full",next:s}),e.jsx(be,{compact:!0,className:"w-full",appleLoading:o,onClick:f})]}),e.jsxs("div",{className:"relative flex items-center justify-center py-6",children:[e.jsx(de,{className:"absolute w-full"}),e.jsx("span",{className:"relative bg-background px-4 text-xs font-medium tracking-widest text-muted-foreground uppercase",children:e.jsx(l,{id:"auth.common.orUseEmail",defaultMessage:"Or use email"})})]})]}),children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("div",{className:"text-center",children:e.jsx(V,{to:`/password-reset?${d.toString()}`,className:"text-sm text-primary hover:underline",children:a.formatMessage({id:"auth.forgetPassword"})})}),e.jsx(W,{size:"lg",className:"w-full",form:c,type:"submit",loading:w.methods.formState.isSubmitting,children:a.formatMessage({id:"auth.login"})}),e.jsxs("div",{className:"flex flex-col gap-1 pt-2 text-center text-sm text-muted-foreground",children:[e.jsxs("p",{children:[a.formatMessage({id:"auth.dontHaveAccount"})," ",e.jsx(V,{to:`/signup?${d.toString()}`,className:"text-primary hover:underline",children:a.formatMessage({id:"auth.signup"})})]}),e.jsx("p",{children:e.jsx(l,{id:"auth.gotoWebplayer",values:{link:b=>e.jsx("a",{href:B.urls.player,target:"_blank",rel:"noreferrer noopener",className:"text-primary hover:underline",children:b})}})})]})]})})})}function Ke({email:s,onBack:o,onSubmit:n}){const t=C(),a=N.object({otp:N.string().min(1,t.formatMessage({id:"general.required"}))}),r=i.useId(),d=J({defaultValues:{otp:""},schema:a,onSubmit:async({data:m})=>{const{success:u}=await n({otp:m.otp});u||d.methods.setError("otp",{message:t.formatMessage({id:"error.tokenInvalid"})})}}),h={otp:{label:t.formatMessage({id:"general.token"}),name:"otp",control:"text-field"}};return e.jsxs("div",{className:"w-full text-center",children:[e.jsx("div",{className:"mb-4 text-center",children:t.formatMessage({id:"auth.twoFADescription"},{email:e.jsx("span",{className:"my-2.5 block rounded-sm bg-muted px-5 py-2.5 font-bold",children:s})})}),e.jsx(K,{id:r,form:d,controllers:h,children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(W,{form:r,type:"submit",loading:d.methods.formState.isSubmitting,children:t.formatMessage({id:"general.submit"})}),e.jsx(q,{variant:"ghost",onClick:o,children:t.formatMessage({id:"general.back"})})]})})]})}const Xe=fe` 2 fragment AgentAuthPayload on AgentAuthPayload { 3 token 4 } 5`,Ze=fe` 6 mutation AgentAuthLoginWithEmail($email: String!, $password: String!) { 7 authLoginWithEmail(email: $email, password: $password) { 8 ...AgentAuthPayload 9 } 10 } 11 ${Xe} 12`;function es(){const[s]=re(Ne);return i.useCallback(async n=>{try{return{result:(await s({variables:{email:n.email,password:n.password,hcaptchaToken:n.hcaptchaToken}})).data?.authSignupWithEmail}}catch(t){return me.captureError(t),{error:t}}},[s])}function ss(){const[s]=re(Se),o=Q();return i.useCallback(async t=>{try{return{result:(await s({variables:{email:t.email,password:t.password}})).data?.authLoginWithEmail}}catch(a){return o.error(a),{error:a}}},[s,o])}function ts(){const[s]=re(Ze);return i.useCallback(async({email:n,password:t})=>{try{return{result:(await s({variables:{email:n,password:t},context:{endpoint:"ad"}})).data?.authLoginWithEmail}}catch(a){return{error:a}}},[s])}function G(s,o){const n=z(),t=pe(),a=o?.replace??!0,d=new URLSearchParams(n.search).get(s)??null,h=i.useCallback(m=>{const u=new URLSearchParams(n.search);m===null?u.delete(s):u.set(s,m);const x=u.toString(),c={...n,search:x?`?${x}`:""};a?t.replace(c):t.push(c)},[t,s,n,a]);return[d,h]}function as(){const s=C(),o=z(),[n,t]=G("role",{replace:!1}),[a,r]=G("step",{replace:!1}),d=n==="creator",h=a==="twofa",[m,u]=i.useState(!1),[x,c]=i.useState({email:"",token:""});i.useEffect(()=>{h&&!x.token&&r(null)},[h,x.token,r]);const{show:w}=he(),j=ss(),f=ge(),b=ve(),{handleLogin:p}=te(),S=Q(),{next:P}=ae(),F=P||"/";i.useEffect(()=>{S.clickSignupOrLogin({from:"login"})},[S]);const U=i.useCallback(()=>{h?r(null):t(null)},[h,r,t]),$=i.useCallback(()=>{t("creator")},[t]),A=i.useCallback(async({email:L,password:y})=>{const{result:g}=await j({email:L,password:y});let k=null;return g?.error?k=g.error:g?.token||(k=T.unknown),!k&&g?.token&&(g.isTwoFa?(c({email:L,token:g.token}),r("twofa")):p({isSignup:!1,...g,method:"EMAIL"})),{success:!k,error:k}},[j,p,r]),E=i.useCallback(async({otp:L})=>{const{result:y}=await b({token:x.token,otp:L});let g=null;return y?.error?g=y.error:y?.token||(g=T.unknown),g||p({isSignup:!1,...y,method:"TWO_FA"}),{success:!g,error:g}},[b,p,x]),M=i.useCallback(async()=>{u(!0);const L=await window.AppleID.auth.signIn(),{id_token:y}=L.authorization,{result:g}=await f({appleToken:y});u(!1);let k=null;return g?.error?k=g.error:g?.token||(k=T.unknown),k||p({isSignup:!1,...g,method:"APPLE"}),{success:!k,error:k}},[f,p]),H=s.formatMessage({id:"auth.login"}),D=new URLSearchParams(o.search);D.set("role","creator"),D.delete("step");const X=e.jsxs("p",{className:"text-center text-sm text-muted-foreground",children:[e.jsx(l,{id:"auth.dontHaveAccount"})," ",e.jsx(V,{to:`/signup?${D.toString()}`,className:"font-semibold text-primary hover:underline",children:e.jsx(l,{id:"auth.signup"})})]});return w?e.jsx(Y,{to:F}):d?e.jsx(R,{title:H,onBack:U,children:e.jsxs("div",{className:"space-y-8",children:[e.jsxs("header",{className:"space-y-2 text-center",children:[e.jsx("h2",{className:"text-2xl font-semibold tracking-tight",children:e.jsx(l,{id:"auth.login"})}),e.jsx("p",{className:"text-base text-muted-foreground",children:e.jsx(l,{id:"auth.login.description",defaultMessage:"Welcome back to your studio"})})]}),h&&x.token?e.jsx(Ke,{email:x.email,onBack:()=>r(null),onSubmit:E}):e.jsx(Je,{appleLoading:m,next:F,onAppleClick:M,onSubmit:A})]})}):e.jsx(R,{title:H,wide:!0,children:e.jsx(je,{variant:"login",onConfirm:$,footer
12:X})})}function rs(){const s=pe(),o=z(),n=Ae(),t=Le(),a=Pe(),[r,d]=i.useState(!1),[h,m]=i.useState(null),[u,x]=i.useState({email:"",token:"",password:""}),[c,w]=i.useState(0),j=Q(),f=C();i.useEffect(()=>{j.clickForgetPassword()},[j]);const b=E=>M=>{x({...u,[E]:M.target.value})},p=i.useCallback(()=>{s.goBack()},[s]),S=i.useCallback(async E=>{if(E.preventDefault(),c===0){if(u.email.trim()===""){m("error.emptyEmail");return}}else if(c===1){if(u.token.trim()===""){m("error.emptyToken");return}}else if(c===2&&u.password.trim()===""){m("error.emptyPassword");return}try{if(d(!0),c===0)await n(u.email)?(m(null),w(1),j.submitForgetPasswordEmail()):m("error.emailInvalid");else if(c===1)try{await t(u),m(null),w(2),j.submitForgetPasswordToken()}catch{m("error.tokenInvalid")}else if(c===2)try{await a(u),j.submitNewPassword(),alert(f.formatMessage({id:"auth.passwordReset.success"})),s.push({pathname:"/login",state:o.state})}catch(M){me.captureError(M)}}finally{d(!1)}},[j,c,u,n,t,a,s,o,f]),P=["email","token","password"],F=[f.formatMessage({id:"auth.passwordReset.enterEmail"}),f.formatMessage({id:"auth.passwordReset.emailSent"},{email:e.jsx("span",{className:"mx-0 my-2.5 block rounded bg-muted px-5 py-2.5 font-bold",children:u.email})}),f.formatMessage({id:"auth.passwordReset.enterPassword"})],U=[f.formatMessage({id:"general.email"}),f.formatMessage({id:"general.token"}),f.formatMessage({id:"general.password"})],$=["email","text","password"],A=f.formatMessage({id:"auth.passwordReset.title"});return e.jsx(R,{title:A,children:e.jsxs("div",{className:"flex w-full flex-col items-center",children:[e.jsx("h4",{className:"mb-4 text-2xl font-semibold",children:A}),e.jsx(_e,{className:"mb-8",children:e.jsxs(Oe,{children:[e.jsx(ee,{children:e.jsx(se,{className:c===0?"text-primary":"text-inherit",children:e.jsx(l,{id:"auth.breadcrumb.email"})})}),e.jsx(ue,{}),e.jsx(ee,{children:e.jsx(se,{className:c===1?"text-primary":"text-inherit",children:e.jsx(l,{id:"auth.breadcrumb.verify"})})}),e.jsx(ue,{}),e.jsx(ee,{children:e.jsx(se,{className:c===2?"text-primary":"text-inherit",children:e.jsx(l,{id:"auth.breadcrumb.password"})})})]})}),e.jsx("p",{className:"mb-4 text-center",children:F[c]}),e.jsxs("form",{onSubmit:S,className:"flex flex-col",children:[e.jsxs(Ve,{className:"mb-4 w-full",children:[e.jsx(He,{children:U[c]}),e.jsx(Me,{type:$[c],value:u[P[c]],"aria-invalid":!!h,onChange:b(P[c])}),h&&e.jsx(Ge,{children:f.formatMessage({id:h})})]},c),e.jsx(W,{type:"submit",className:"mb-2",loading:r,children:e.jsx(l,{id:"general.send"})}),e.jsx(q,{onClick:p,variant:"ghost",children:e.jsx(l,{id:"general.back"})})]})]})})}function ns({onSubmit:s}){const o=C(),n=N.object({email:N.string().email(),password:N.string()}),t=J({schema:n,defaultValues:{email:"",password:""},onSubmit:({data:d})=>s(d)}),{methods:a}=t,r={email:{control:"text-field",label:o.formatMessage({id:"general.email"}),name:"email"},password:{control:"text-field",label:o.formatMessage({id:"general.password"}),type:"password",name:"password"}};return e.jsx("div",{className:"w-full",children:e.jsx(K,{form:t,controllers:r,children:e.jsx(W,{loading:a.formState.isSubmitting,size:"lg",type:"submit",className:"w-full",children:e.jsx(l,{id:"auth.loginWithEmail"})})})})}function os(){const s=C(),{loading:o,data:n}=Ce(),t=ts(),{handleLogin:a}=te(),r=!!Ee("/signup"),{next:d}=ae(),h=i.useCallback(async({email:u,password:x})=>{const{result:c,error:w}=await t({email:u,password:x});if(w)return{error:w};c&&a({isSignup:r,token:c.token,show:null,method:"EMAIL"})},[t,a,r]),m=s.formatMessage({id:r?"auth.signup":"auth.login"});return o?e.jsxs(R,{title:m,children:[e.jsx("h3",{className:"mb-12 text-center text-3xl font-bold",children:e.jsx(l,{id:r?"auth.signup":"auth.login"})}),e.jsx(Re,{})]}):n?.podarAdAgentFindOne?e.jsx(Y,{to:d||"/campaigns"}):e.jsxs(R,{title:m,children:[e.jsx("h3",{className:"mb-12 text-center text-3xl font-bold",children:e.jsx(l,{id:r?"auth.signup":"auth.login"})}),e.jsx(ns,{onSubmit:h})]})}function is({next:s,appleLoading:o,onAppleClick:n,onSubmit:t}
12){const a=C(),r=z(),d=new URLSearchParams(r.search),h=d.get("error"),[m,u]=i.useState(h||null),x=["hotmail","outlook"],c=N.object({email:N.string().email(a.formatMessage({id:"error.emailInvalid"})).refine(p=>{for(const S of x)if(p.includes(`@${S}`))return!1;return!0},a.formatMessage({id:"error.emailProvider"},{provider:x.join(", ")})),password:N.string().min(1,a.formatMessage({id:"general.required"})),hcaptchaToken:N.string().min(1,a.formatMessage({id:"general.required"}))}),w=i.useId(),j=J({defaultValues:{email:"",password:"",hcaptchaToken:""},schema:c,onSubmit:async({data:p})=>{const{error:S}=await t({email:p.email,password:p.password,hcaptchaToken:p.hcaptchaToken});u(S),j.methods.resetField("hcaptchaToken")}}),f={email:{label:a.formatMessage({id:"general.email"}),name:"email",control:"text-field"},password:{label:a.formatMessage({id:"general.password"}),name:"password",control:"password-input"},hcaptchaToken:{label:"",name:"hcaptchaToken",control:"h-captcha"}},b=i.useCallback(async()=>{const{error:p}=await n();u(p)},[n]);return e.jsx(K,{id:w,form:j,className:"gap-4",controllers:f,error:m?e.jsx(ke,{error:m}):null,before:e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(we,{compact:!0,className:"w-full",next:s}),e.jsx(be,{compact:!0,className:"w-full",appleLoading:o,onClick:b})]}),e.jsxs("div",{className:"relative flex items-center justify-center py-6",children:[e.jsx(de,{className:"absolute w-full"}),e.jsx("span",{className:"relative bg-background px-4 text-xs font-medium tracking-widest text-muted-foreground uppercase",children:e.jsx(l,{id:"auth.common.orUseEmail",defaultMessage:"Or use email"})})]})]}),children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(W,{size:"lg",className:"w-full",form:w,type:"submit",loading:j.methods.formState.isSubmitting,children:a.formatMessage({id:"auth.signup"})}),e.jsxs("div",{className:"flex flex-col gap-1 pt-2 text-center text-sm text-muted-foreground",children:[e.jsxs("p",{children:[a.formatMessage({id:"auth.haveAccount"})," ",e.jsx(V,{to:`/login?${d.toString()}`,className:"text-primary hover:underline",children:a.formatMessage({id:"auth.login"})})]}),e.jsx("p",{children:e.jsx(l,{id:"auth.signupAgreePolicy",values:{a:p=>e.jsx("a",{href:"https://firstory.me/zh/terms-of-service",target:"_blank",rel:"noreferrer noopener",className:"text-primary hover:underline",children:p})}})}),e.jsx("p",{children:e.jsx(l,{id:"auth.gotoWebplayer",values:{link:p=>e.jsx("a",{href:B.urls.player,target:"_blank",rel:"noreferrer noopener",className:"text-primary hover:underline",children:p})}})})]})]})})}function ls({selectedPlan:s,selectedInterval:o,signupSuccessPath:n,appleLoading:t,onAppleClick:a,onSubmit:r}){const d=s===Fe.User.Subscription.Type.free;return e.jsxs("div",{className:"animate-in space-y-8 duration-500 fade-in slide-in-from-right-6",children:[e.jsxs("header",{className:"space-y-2 text-center",children:[e.jsx("h2",{className:"text-2xl font-semibold tracking-tight",children:e.jsx(l,{id:"auth.signup.createAccount",defaultMessage:"Create your studio"})}),e.jsx("p",{className:"text-base text-muted-foreground",children:d?e.jsx(l,{id:"auth.signup.selectedPlanFree",defaultMessage:"You've selected the {plan} plan.",values:{plan:e.jsx("span",{className:"font-semibold text-foreground",children:s})}}):e.jsx(l,{id:"auth.signup.selectedPlan",defaultMessage:"You've selected the {plan} plan, billed {interval}.",values:{plan:e.jsx("span",{className:"font-semibold text-foreground",children:s}),interval:e.jsx("span",{className:"font-semibold text-foreground",children:e.jsx(l,{id:o==="MONTHLY"?"plan.monthly":"plan.yearly"})})}})})]}),e.jsx("div",{className:"mx-auto max-w-[400px]",children:e.jsx(is,{next:n,appleLoading:t,onAppleClick:a,onSubmit:r})})]})}function cs({selectedPlan:s,selectedInterval:o,onPlanChange:n,onIntervalChange:t,onNext:a,footer:r}){const d=Ie();return e.jsxs("div",{className:"animate-in space-y-8 duration-500 fade-in slide-in-from-right-6",children:[e.jsxs("header",{className:"space-y-2 text-center",children:[e.jsx("h2",{className:"text-2xl font-semibold tracking-tight",children:e.jsx(l,{id:"auth.signup.selectPlan",defaultMessage:"Select your plan"})}),e.jsx("p",{className:"text-base text-muted-foreground",children:e.jsx(l,{id:"upgrade.freeTrial.description"})})]}),e.jsx($e,{selectedPlan:s,selectedInterval:o,onPlanChange:n,onIntervalChange:t,regi
12on:d,gridClassName:"grid grid-cols-1 gap-4 sm:grid-cols-2"}),e.jsxs("div",{className:"mx-auto max-w-sm space-y-6",children:[e.jsxs(q,{size:"lg",onClick:a,className:"w-full",children:[e.jsx(l,{id:"general.next"}),e.jsx(xe,{})]}),r]})]})}function us(){const s=C(),o=z(),[n,t]=G("role",{replace:!1}),[a,r]=G("step",{replace:!1}),d=n==="creator",h=a==="auth",[m,u]=i.useState(!1),[x,c]=i.useState(!1),{show:w}=he(),j=es(),f=ge(),{handleLogin:b}=te(),p=Q(),{selectedPlan:S,selectedInterval:P,onPlanChange:F,onIntervalChange:U}=De({syncToUrl:!0}),$=`/account/subscription/checkout?plan=${S}&interval=${P}&page=signup`,A=`/signup/success?next=${encodeURIComponent($)}`;i.useEffect(()=>{p.clickSignupOrLogin({from:"login"})},[p]);const E=i.useCallback(()=>{h?r(null):t(null)},[h,r,t]),M=i.useCallback(()=>{t("creator")},[t]),H=i.useCallback(()=>{r("auth")},[r]),D=i.useCallback(async({email:k,password:Z,hcaptchaToken:I})=>{const{result:v}=await j({email:k,password:Z,hcaptchaToken:I});let _=null;return v?.error?_=v.error:v?.token||(_=T.unknown),_||(b({isSignup:!0,...v,method:"EMAIL"}),c(!0),window.location.href=A),{success:!_,error:_}},[j,b,A]),X=i.useCallback(async()=>{u(!0);const k=await window.AppleID.auth.signIn(),{id_token:Z}=k.authorization,{result:I}=await f({appleToken:Z});u(!1);let v=null;return I?.error?v=I.error:I?.token||(v=T.unknown),v||(b({isSignup:!0,...I,method:"APPLE"}),c(!0)),{success:!v,error:v}},[f,b]),L=s.formatMessage({id:"auth.signup"}),y=new URLSearchParams(o.search);y.set("role","creator"),y.delete("step"),y.delete("plan"),y.delete("interval");const g=e.jsxs("p",{className:"text-center text-sm text-muted-foreground",children:[e.jsx(l,{id:"auth.haveAccount"})," ",e.jsx(V,{to:`/login?${y.toString()}`,className:"font-semibold text-primary hover:underline",children:e.jsx(l,{id:"auth.login"})})]});return w?e.jsx(Y,{to:x?A:"/"}):d?e.jsx(R,{title:L,wide:!h,onBack:E,children:e.jsx("div",{className:"w-full",children:h?e.jsx(ls,{selectedPlan:S,selectedInterval:P,signupSuccessPath:A,appleLoading:m,onAppleClick:X,onSubmit:D}):e.jsx(cs,{selectedPlan:S,selectedInterval:P,onPlanChange:F,onIntervalChange:U,onNext:H,footer:g})})}):e.jsx(R,{title:L,wide:!0,children:e.jsx(je,{variant:"signup",onConfirm:M,footer:g})})}function ds(){const{next:s}=ae();return e.jsx(Y,{to:s||"/"})}function Ws(){const{subdomain:s}=Te();return s==="podar"?e.jsx(ce,{children:e.jsx(O,{path:["/login","/signup"],exact:!0,children:e.jsx(os,{})})}):e.jsxs(ce,{children:[e.jsx(O,{path:"/signup/success",children:e.jsx(ds,{})}),e.jsx(O,{path:"/login",children:e.jsx(as,{})}),e.jsx(O,{path:"/signup",children:e.jsx(us,{})}),e.jsx(O,{path:"/password-reset",component:rs})]})}export{Ws as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.