PageSourceSearch

https://socialnarratives.ai/assets/Login-C1P3HMub.js

js socialnarratives.ai collected 2026-10-05 15:08:05 UTC 27,306 bytes, 1 lines download raw bytes

1import{j as a,w as Me,I as We}from"./ui-vendor-XNsX7NFl.js";import{g as _e,a as g,u as De,T as Re}from"./i18n-BCZ_8xSB.js";import{u as qe,i as ze,r as He,S as Ue,L as Be,B as U,a as Ge,g as Ve,W as Q,b as Ke,c as Ye}from"./index-Dg7geK91.js";import{C as Qe}from"./capacitor-DQeCf45c.js";import{P as Je}from"./PasswordField-DM1Juqm0.js";import{u as Xe,b as Ze,L as ue}from"./react-router-oAHNt2ka.js";import"./firebase-auth-BWbhO1CC.js";import"./firebase-db-Csu2kn54.js";var B={exports:{}},G,pe;function et(){if(pe)return G;pe=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return G=e,G}var V,fe;function tt(){if(fe)return V;fe=1;var e=et();function r(){}function o(){}return o.resetWarningCache=r,V=function(){function t(c,p,f,m,v,l){if(l!==e){var d=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw d.name="Invariant Violation",d}}t.isRequired=t;function n(){return t}var i={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:n,element:t,elementType:t,instanceOf:n,node:t,objectOf:n,oneOf:n,oneOfType:n,shape:n,exact:n,checkPropTypes:o,resetWarningCache:r};return i.PropTypes=i,i},V}var he;function rt(){return he||(he=1,B.exports=tt()()),B.exports}var nt=rt();const _=_e(nt);var ot=["sitekey","onChange","theme","type","tabindex","onExpired","onErrored","size","stoken","grecaptcha","badge","hl","isolated"];function J(){return J=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var o=arguments[r];for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t])}return e},J.apply(this,arguments)}function st(e,r){if(e==null)return{};var o={},t=Object.keys(e),n,i;for(i=0;i<t.length;i++)n=t[i],!(r.indexOf(n)>=0)&&(o[n]=e[n]);return o}function W(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function at(e,r){e.prototype=Object.create(r.prototype),e.prototype.constructor=e,X(e,r)}function X(e,r){return X=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},X(e,r)}var D=(function(e){at(r,e);function r(){var t;return t=e.call(this)||this,t.handleExpired=t.handleExpired.bind(W(t)),t.handleErrored=t.handleErrored.bind(W(t)),t.handleChange=t.handleChange.bind(W(t)),t.handleRecaptchaRef=t.handleRecaptchaRef.bind(W(t)),t}var o=r.prototype;return o.getCaptchaFunction=function(n){return this.props.grecaptcha?this.props.grecaptcha.enterprise?this.props.grecaptcha.enterprise[n]:this.props.grecaptcha[n]:null},o.getValue=function(){var n=this.getCaptchaFunction("getResponse");return n&&this._widgetId!==void 0?n(this._widgetId):null},o.getWidgetId=function(){return this.props.grecaptcha&&this._widgetId!==void 0?this._widgetId:null},o.execute=function(){var n=this.getCaptchaFunction("execute");if(n&&this._widgetId!==void 0)return n(this._widgetId);this._executeRequested=!0},o.executeAsync=function(){var n=this;return new Promise(function(i,c){n.executionResolve=i,n.executionReject=c,n.execute()})},o.reset=function(){var n=this.getCaptchaFunction("reset");n&&this._widgetId!==void 0&&n(this._widgetId)},o.forceReset=function(){var n=this.getCaptchaFunction("reset");n&&n()},o.handleExpired=function(){this.props.onExpired?this.props.onExpired():this.handleChange(null)},o.handleErrored=function(){this.props.onErrored&&this.props.onErrored(),this.executionReject&&(this.executionReject(),delete this.executionResolve,delete this.executionReject)},o.handleChange=function(n){this.props.onChange&&this.props.onChange(n),this.executionResolve&&(this.executionResolve(n),delete this.executionReject,delete this.executionResolve)},o.explicitRender=function(){var n=this.getCaptchaFunction("render");if(n&&this._widgetId===void 0){var i=document.createElement("div");this._widgetId=n(i,{sitekey:this.props.sitekey,callback:this.handleChange,theme:this.props.theme,type:this.props.type,tabindex:this.props.tabindex,"expired-callback":this.handleExpired,"error-callback":this.handleErrored,size:this.props.size,stoken:this.props.stoken,hl:this.props.hl,badge:this.props.badge,isolated:this.props.isolated}),this.captcha.appendChild(i)}this._executeRequested&&this.props.grecaptcha&&this._widgetId!==void 0&&(this._executeRequested=!1,this.execute())},o.componentDidMount=function(){this.explicitRender()},o.componentDidUpdate=function(){this.explicitRender()},o.handleRecaptchaRef=function(n){this.captcha=n},o.render=function(){var n=this.props;n.sitekey,n.onChange,n.theme,n.type,n.tabindex,n.onExpired,n.onErrored,n.size,n.stoken,n.grecaptcha,n.badge,n.hl,n.isolated;var i=st(n,ot);return g.createElement("div",J({},i,{ref:this.handleRecaptchaRef}))},r})(g.Component);D.displayName="ReCAPTCHA";D.propTypes={sitekey:_.string.isRequired,onChange:_.func,grecaptcha:_.object,theme:_.oneOf(["dark","light"]),type:_.oneOf(["image","audio"]),tabindex:_.number,onExpired:_.func,onErrored:_.func,size:_.oneOf(["compact","normal","invisible"]),stoken:_.string,hl:_.string,badge:_.oneOf(["bottomright","bottomleft","inline"]),isolated:_.bool};
1D.defaultProps={onChange:function(){},theme:"light",type:"image",tabindex:0,size:"normal",badge:"bottomright"};var K={exports:{}},u={};var me;function it(){if(me)return u;me=1;var e=typeof Symbol=="function"&&Symbol.for,r=e?Symbol.for("react.element"):60103,o=e?Symbol.for("react.portal"):60106,t=e?Symbol.for("react.fragment"):60107,n=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,c=e?Symbol.for("react.provider"):60109,p=e?Symbol.for("react.context"):60110,f=e?Symbol.for("react.async_mode"):60111,m=e?Symbol.for("react.concurrent_mode"):60111,v=e?Symbol.for("react.forward_ref"):60112,l=e?Symbol.for("react.suspense"):60113,d=e?Symbol.for("react.suspense_list"):60120,b=e?Symbol.for("react.memo"):60115,h=e?Symbol.for("react.lazy"):60116,R=e?Symbol.for("react.block"):60121,C=e?Symbol.for("react.fundamental"):60117,k=e?Symbol.for("react.responder"):60118,j=e?Symbol.for("react.scope"):60119;function w(s){if(typeof s=="object"&&s!==null){var y=s.$$typeof;switch(y){case r:switch(s=s.type,s){case f:case m:case t:case i:case n:case l:return s;default:switch(s=s&&s.$$typeof,s){case p:case v:case h:case b:case c:return s;default:return y}}case o:return y}}}function x(s){return w(s)===m}return u.AsyncMode=f,u.ConcurrentMode=m,u.ContextConsumer=p,u.ContextProvider=c,u.Element=r,u.ForwardRef=v,u.Fragment=t,u.Lazy=h,u.Memo=b,u.Portal=o,u.Profiler=i,u.StrictMode=n,u.Suspense=l,u.isAsyncMode=function(s){return x(s)||w(s)===f},u.isConcurrentMode=x,u.isContextConsumer=function(s){return w(s)===p},u.isContextProvider=function(s){return w(s)===c},u.isElement=function(s){return typeof s=="object"&&s!==null&&s.$$typeof===r},u.isForwardRef=function(s){return w(s)===v},u.isFragment=function(s){return w(s)===t},u.isLazy=function(s){return w(s)===h},u.isMemo=function(s){return w(s)===b},u.isPortal=function(s){return w(s)===o},u.isProfiler=function(s){return w(s)===i},u.isStrictMode=function(s){return w(s)===n},u.isSuspense=function(s){return w(s)===l},u.isValidElementType=function(s){return typeof s=="string"||typeof s=="function"||s===t||s===m||s===i||s===n||s===l||s===d||typeof s=="object"&&s!==null&&(s.$$typeof===h||s.$$typeof===b||s.$$typeof===c||s.$$typeof===p||s.$$typeof===v||s.$$typeof===C||s.$$typeof===k||s.$$typeof===j||s.$$typeof===R)},u.typeOf=w,u}var ge;function ct(){return ge||(ge=1,K.exports=it()),K.exports}var Y,be;function dt(){if(be)return Y;be=1;var e=ct(),r={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},o={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},t={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},n={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},i={};i[e.ForwardRef]=t,i[e.Memo]=n;function c(h){return e.isMemo(h)?n:i[h.$$typeof]||r}var p=Object.defineProperty,f=Object.getOwnPropertyNames,m=Object.getOwnPropertySymbols,v=Object.getOwnPropertyDescriptor,l=Object.getPrototypeOf,d=Object.prototype;function b(h,R,C){if(typeof R!="string"){if(d){var k=l(R);k&&k!==d&&b(h,k,C)}var j=f(R);m&&(j=j.concat(m(R)));for(var w=c(h),x=c(R),s=0;s<j.length;++s){var y=j[s];if(!o[y]&&!(C&&C[y])&&!(x&&x[y])&&!(w&&w[y])){var S=v(R,y);try{p(h,y,S)}catch{}}}}return h}return Y=b,Y}var lt=dt();const ut=_e(lt);function Z(){return Z=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var o=arguments[r];for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t])}return e},Z.apply(this,arguments)}function pt(e,r){if(e==null)return{};var o={},t=Object.keys(e),n,i;for(i=0;i<t.length;i++)n=t[i],!(r.indexOf(n)>=0)&&(o[n]=e[n]);return o}function ft(e,r){e.prototype=Object.create(r.prototype),e.prototype.constructor=e,e.__proto__=r}var N={},ht=0;function mt(e,r){return r=r||{},function(t){var n=t.displayName||t.name||"Component",i=(function(p){ft(f,p);function f(v,l){var d;return d=p.call(this,v,l)||this,d.state={},d.__scriptURL="",d}var m=f.prototype;return m.asyncScriptLoaderGetScriptLoaderID=function(){return this.__scriptLoaderID||(this.__scriptLoaderID="async-script-loader-"+ht++),this.__scriptLoaderID},m.setupScriptURL=function(){return this.__scriptURL=typeof e=="function"?e():e,this.__scriptURL},m.asyncScriptLoaderHandleLoad=function(l){var d=this;this.setState(l,function(){return d.props.asyncScriptOnLoad&&d.props.asyncScriptOnLoad(d.state)})},m.asyncScriptLoaderTriggerOnScriptLoaded=function(){var l=N[this.__scriptURL];if(!l||!l.loaded)throw new Error("Script is not loaded.");for(var d in l.observers)l.observers[d](l);delete window[r.callbackName]},m.componentDidMount=function(){var l=this,d=this.setupScriptURL(),b=this.asyncScriptLoaderGetScriptLoaderID(),h=r,R=h.globalName,C=h.callbackName,k=h.scriptId;if(R&&typeof window[R]<"u"&&(N[d]={loaded:!0,observers:{}}),N[d]){var j=N[d];if(j&&(j.loaded||j.errored)){this.asyncScriptLoaderHandleLoad(j);return}j.observers[b]=function(S){return l.asyncScriptLoaderHandleLoad(S)};return}var w={};w[b]=function(S){return l.asyncScriptLoaderHandleLoad(S)},N[d]={loaded:!1,observers:w};var x=document.createElement("script");x.src=d,x.async=!0;for(var s in r.attributes)x.setAttribute(s,r.attributes[s]);k&&(x.id=k);var y=function(P){if(N[d]){var T=N[d],I=T.observers;for(var A in I)P(I[A])&&delete I[A]}};C&&typeof window<"u"&&(window[C]=function(){return l.asyncScriptLoaderTriggerOnScriptLoaded()}),x.onload=function(){var S=N[d];
1S&&(S.loaded=!0,y(function(P){return C?!1:(P(S),!0)}))},x.onerror=function(){var S=N[d];S&&(S.errored=!0,y(function(P){return P(S),!0}))},document.body.appendChild(x)},m.componentWillUnmount=function(){var l=this.__scriptURL;if(r.removeOnUnmount===!0)for(var d=document.getElementsByTagName("script"),b=0;b<d.length;b+=1)d[b].src.indexOf(l)>-1&&d[b].parentNode&&d[b].parentNode.removeChild(d[b]);var h=N[l];h&&(delete h.observers[this.asyncScriptLoaderGetScriptLoaderID()],r.removeOnUnmount===!0&&delete N[l])},m.render=function(){var l=r.globalName,d=this.props;d.asyncScriptOnLoad;var b=d.forwardedRef,h=pt(d,["asyncScriptOnLoad","forwardedRef"]);return l&&typeof window<"u"&&(h[l]=typeof window[l]<"u"?window[l]:void 0),h.ref=b,g.createElement(t,h)},f})(g.Component),c=g.forwardRef(function(p,f){return g.createElement(i,Z({},p,{forwardedRef:f}))});return c.displayName="AsyncScriptLoader("+n+")",c.propTypes={asyncScriptOnLoad:_.func},ut(c,t)}}var ee="onloadcallback",gt="grecaptcha";function te(){return typeof window<"u"&&window.recaptchaOptions||{}}function bt(){var e=te(),r=e.useRecaptchaNet?"recaptcha.net":"www.google.com";return e.enterprise?"https://"+r+"/recaptcha/enterprise.js?onload="+ee+"&render=explicit":"https://"+r+"/recaptcha/api.js?onload="+ee+"&render=explicit"}const xt=mt(bt,{callbackName:ee,globalName:gt,attributes:te().nonce?{nonce:te().nonce}:{}})(D),yt=12e3,vt=(e,r,o)=>!e&&!r&&!o,wt=(e,r,o,t)=>e(r?"form.pleaseWait":o?"resetPassword.sendLink":t?"form.loginButton":"form.signupButton"),St=(e,r,o)=>{let t;const n=new Promise((i,c)=>{t=setTimeout(()=>c(new Error(o)),r)});return Promise.race([e,n]).finally(()=>clearTimeout(t))},$=e=>e&&typeof e=="object"&&typeof e.message=="string"?e.message:"",ne=e=>e&&typeof e=="object"&&typeof e.code=="string"?e.code:"",jt=new Set(["auth/popup-closed-by-user","auth/cancelled-popup-request","auth/user-cancelled"]),_t=/cancell?ed|error 1001\b|\b12501\b/i,Rt=e=>{const r=ne(e);return jt.has(r)?!0:!r.startsWith("auth/")&&_t.test($(e))},xe={"auth/user-not-found":"errors.userNotFound","auth/wrong-password":"errors.wrongPassword","auth/too-many-requests":"errors.tooManyRequests","auth/email-already-in-use":"errors.emailInUse","auth/weak-password":"errors.weakPassword","auth/invalid-email":"errors.invalidEmail","auth/network-request-failed":"errors.network",unavailable:"errors.network","auth/popup-blocked":"errors.popupBlocked","auth/user-disabled":"errors.suspended","app/banned":"errors.suspended"},ye={"auth/invalid-credential":"both","auth/user-not-found":"email","auth/wrong-password":"password","auth/invalid-email":"email","auth/weak-password":"password"},Ct=e=>{const r=ne(e);return ye[r]?ye[r]:$(e).includes("invalid-credential")?"both":null},ve=(e,{isLogin:r,isResetPassword:o,t,fallbackKey:n})=>{const i=$(e),c=ne(e),p=Ct(e),f=t(n||(o?"errors.resetFailed":r?"errors.loginFailed":"errors.signupFailed"));return c==="auth/invalid-credential"||i.includes("invalid-credential")?{message:t("errors.invalidCredential"),field:p,code:"auth/invalid-credential"}:{message:xe[c]?t(xe[c]):f,field:p,code:c}},F=(e,r)=>!!e?.field&&(e.field==="both"||e.field===r),Nt=["story","schedule","board","plan"],kt=(e,{isResetPassword:r,isLogin:o,intent:t,isAgentConnect:n})=>{if(r)return{title:e("resetPassword.title"),subtitle:e("resetPassword.subtitle")};if(o&&n)return{title:e("agentConnect.title"),subtitle:e("agentConnect.subtitle")};if(o)return{title:e("login.title"),subtitle:e("login.subtitle")};const i=e("signup.freeCredits",{count:Q});return{title:e("signup.title"),subtitle:t?e(`signup.subtitle_${t}`,{defaultValue:i}):i}},Et=e=>{const r=new URLSearchParams(e?.search||""),o=e?.state&&typeof e.state=="object"?e.state:{},t=o.mode||r.get("mode"),n=o.intent||r.get("intent"),i=o.returnTo||r.get("returnTo"),c=typeof o.email=="string"&&o.email.length<=254?o.email:"";return{mode:t==="signup"||t==="login"||t==="reset"?t:null,intent:Nt.includes(n)?n:null,returnTo:Ve(i)||null,email:c}},re=(e,r)=>{if(e.current){try{e.current.reset()}catch{}r(null)}},Pt=async({captchaToken:e,recaptchaRef:r,setCaptchaToken:o})=>{if(e||!r.current)return e;try{return await St(r.current.executeAsync(),yt,"recaptcha-timeout")}catch(t){return console.warn("reCAPTCHA unavailable, continuing without a token:",$(t)||t),re(r,o),null}},Tt=async e=>{if(!e)return!0;try{return(await(await Ye("verifyRecaptcha"))({token:e,action:"signup"}))?.data?.valid!==!1}catch(r){return console.warn("reCAPTCHA backend check errored, proceeding:",$(r)||r),!0}},Ce=(e,r,o,t)=>t?e(r,o,{returnPath:t}):e(r,o),It=async({email:e,password:r,captchaToken:o,recaptchaRef:t,setCaptchaToken:n,signup:i,returnTo:c})=>{const p=await Pt({captchaToken:o,recaptchaRef:t,setCaptchaToken:n});return await Tt(p)?(await Ce(i,e,r,c),"authenticated"):"captcha-blocked"},Lt=async({email:e,password:r,isLogin:o,isNativeApp:t,isResetPassword:n,captchaToken:i,recaptchaRef:c,setCaptchaToken:p,login:f,resetPassword:m,signup:v,returnTo:l})=>n?(await m(e),"reset"):o?(await f(e,r),"authenticated"):t?(await Ce(v,e,r,l),"authenticated"):It({email:e,password:r,captchaToken:i,recaptchaRef:c,setCaptchaToken:p,signup:v,returnTo:l}),Ot=({authError:e,inputRef:r,isLoading:o,isLogin:t,onChange:n,onForgotPassword:i,password:c,t:p})=>a.jsxs(a.Fragment,{children:[a.jsx(Je,{ref:r,id:"login-password",label:p("form.password"),placeholder:p("form.password"),value:c,onChange:n,autoComplete:t?"current-password":"new-password",minLength:t?void 0:6,hint:t?void 0:p("form.passwordHint",{defaultValue:"Use at least 6 characters"}
1),hintId:"password-requirements",invalid:F(e,"password"),describedBy:F(e,"password")?"auth-error":void 0,disabled:o}),t&&a.jsx("div",{className:"flex justify-end",children:a.jsx("button",{type:"button",onClick:i,className:"flex min-h-[44px] items-center rounded-lg px-2 text-sm font-bold text-sage-700 transition-colors hover:text-sage-900 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-sage-500 dark:text-sage-300 dark:hover:text-sage-200",children:p("form.forgotPassword")})})]}),we="font-semibold text-sage-700 underline underline-offset-2 hover:text-sage-900 focus:outline-none focus-visible:rounded focus-visible:ring-2 focus-visible:ring-sage-500 dark:text-sage-300 dark:hover:text-sage-200",At=()=>a.jsx("p",{className:"mt-5 text-center text-sm leading-relaxed text-slate-600 dark:text-dim-text-secondary","data-testid":"auth-legal-notice",children:a.jsx(Re,{i18nKey:"legal.notice",ns:"auth",components:{terms:a.jsx(ue,{to:"/terms",className:we}),privacy:a.jsx(ue,{to:"/privacy",className:we})}})}),Se="text-sage-700 underline underline-offset-2 dark:text-sage-300",Ft=()=>a.jsx("p",{className:"mt-2 text-center text-xs leading-snug text-slate-600 dark:text-dim-text-secondary",children:a.jsx(Re,{i18nKey:"recaptcha.notice",ns:"auth",components:{privacy:a.jsx("a",{href:"https://policies.google.com/privacy",target:"_blank",rel:"noreferrer",className:Se}),terms:a.jsx("a",{href:"https://policies.google.com/terms",target:"_blank",rel:"noreferrer",className:Se})}})}),$t=({authError:e,errorRef:r,onLogInInstead:o,t})=>a.jsxs("div",{ref:r,role:"alert",tabIndex:-1,id:"auth-error",className:"mb-6 flex items-start gap-3 rounded-xl border border-amber-200 bg-amber-50 p-4 text-left text-sm text-amber-900 outline-none transition-colors focus-visible:ring-2 focus-visible:ring-amber-500 dark:border-amber-800 dark:bg-amber-950 dark:text-amber-200",children:[a.jsx(We,{className:"mt-0.5 h-5 w-5 flex-shrink-0","aria-hidden":"true"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{children:e.message}),e.code==="auth/email-already-in-use"&&a.jsx("button",{type:"button",onClick:o,className:"mt-2 inline-flex min-h-[44px] items-center rounded-lg font-bold text-amber-950 underline underline-offset-2 focus:outline-none focus-visible:ring-2 focus-visible:ring-amber-600 dark:text-amber-100",children:t("errors.logInInstead")})]})]}),Mt=({t:e,withApple:r,isLogin:o})=>a.jsxs("p",{role:"note",className:"mb-6 flex items-start gap-3 rounded-xl border border-sage-200 bg-sage-50 p-4 text-left text-sm text-sage-900 dark:border-dim-border dark:bg-dim-elevated dark:text-dim-text",children:[a.jsx(Me,{className:"mt-0.5 h-5 w-5 flex-shrink-0 text-sage-700 dark:text-sage-300","aria-hidden":"true"}),a.jsxs("span",{children:[e(r?"agentConnect.noteWithApple":"agentConnect.note"),o&&` ${e("agentConnect.newHere",{count:Q,stories:Ke(Q)})}`]})]}),Wt=({t:e,isLogin:r,isResetPassword:o})=>r||o?null:a.jsx("p",{className:"text-center text-sm text-slate-600 dark:text-dim-text-secondary","data-testid":"signup-credits-note",children:e("signup.confirmForCredits")}),je="min-h-[44px] font-bold transition-colors text-sage-700 dark:text-sage-300 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-sage-500/50 rounded-lg px-2",Dt=({t:e,isLogin:r,isResetPassword:o,onBackToLogin:t,onToggleMode:n})=>a.jsx("div",{className:"mt-6 text-center",children:a.jsx("p",{className:"text-slate-600 dark:text-dim-text-secondary",children:o?a.jsx("button",{type:"button",onClick:t,className:je,children:e("switch.backToLogin")}):a.jsxs(a.Fragment,{children:[r?e("switch.noAccount")+" ":e("switch.haveAccount")+" ",a.jsx("button",{type:"button",onClick:n,className:je,children:e(r?"form.signupButton":"form.loginButton")})]})})});function Yt(){const{t:e}=De("auth"),r=Xe(),{mode:o,intent:t,returnTo:n,email:i}=Et(r),[c,p]=g.useState(o!=="signup"),[f,m]=g.useState(o==="reset"),[v,l]=g.useState(o);o!==v&&(l(o),o&&(p(o!=="signup"),m(o==="reset")));const[d,b]=g.useState(!1),[h,R]=g.useState(i),[C,k]=g.useState(""),[j,w]=g.useState(""),[x,s]=g.useState(null),[y,S]=g.useState(!1),[P,T]=g.useState(null),I=g.useRef(null),A=g.useRef(null),oe=g.useRef(null),q=g.useRef(!1),L=()=>s(null),se=Qe.isNativePlatform(),{login:Ne,loginWithGoogle:ke,loginWithApple:Ee,signup:Pe,user:z,resetPassword:Te}=qe(),ae=Ze(),H=vt(c,f,se),M=ze(n),ie=Ge("APPLE_SIGN_IN"),ce=!!z;g.useEffect(()=>{M&&!ce&&He()},[M,ce]),g.useEffect(()=>{z&&ae(n||"/dashboard")},[z,ae,n]),g.useEffect(()=>{x&&A.current?.focus({preventScroll:!0})},[x]),g.useEffect(()=>{c&&q.current&&(q.current=!1,oe.current?.focus())},[c]);const Ie=()=>{q.current=!0,p(!0),m(!1),L(),T(null)},Le=async E=>{if(E.preventDefault(),L(),!j){S(!0);try{const O=await Lt({email:h,password:C,isLogin:c,isNativeApp:se,isResetPassword:f,captchaToken:P,recaptchaRef:I,setCaptchaToken:T,login:Ne,resetPassword:Te,signup:Pe,returnTo:n});if(O==="reset"){b(!0),S(!1);return}O==="captcha-blocked"&&(s({message:e("errors.verificationFailed"),field:null,code:"app/captcha-blocked"}),S(!1),re(I,T))}catch(O){console.error("Auth error:",O),s(ve(O,{isLogin:c,isResetPassword:f,t:e})),S(!1),H&&re(I,T)}}},de=async(E,O)=>{L(),S(!0);try{await E()}catch(le){if(S(!1),Rt(le))return;s({...ve(le,{isLogin:c,isResetPassword:!1,t:e,fallbackKey:O}),field:null})}},Oe=()=>de(ke,"errors.googleFailed"),Ae=()=>
1de(Ee,"errors.appleFailed"),{title:Fe,subtitle:$e}=kt(e,{isResetPassword:f,isLogin:c,intent:t,isAgentConnect:M});return a.jsxs("div",{className:"min-h-screen flex items-start justify-center p-3 py-4 transition-colors duration-300 sm:items-center sm:p-4 sm:py-8 bg-sage-50 dark:bg-dim-deep",children:[a.jsx(Ue,{title:e("seo.title"),description:e("seo.description"),noIndex:!0}),a.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-transparent bg-white p-5 shadow-xl transition-all duration-300 sm:rounded-3xl sm:p-8 dark:border-dim-border dark:bg-dim-surface dark:shadow-none",children:[a.jsxs("div",{className:"mb-6 text-center font-['Quicksand'] sm:mb-8",children:[a.jsx(Be,{mode:"display",size:40,className:"mx-auto mb-4 [--sn-logo-size:36px] sm:mb-5 sm:[--sn-logo-size:44px]"}),a.jsx("h1",{className:"text-2xl md:text-3xl font-extrabold text-sage-900 dark:text-dim-text mb-2",children:Fe}),a.jsx("p",{className:"text-sm md:text-base font-['Nunito'] text-gray-600 dark:text-dim-text-secondary",children:$e})]}),M&&!f&&a.jsx(Mt,{t:e,withApple:ie,isLogin:c}),x&&a.jsx($t,{authError:x,errorRef:A,onLogInInstead:Ie,t:e}),!f&&a.jsxs("div",{className:"space-y-3 mb-6",children:[a.jsx(U,{variant:"outline",size:"md",fullWidth:!0,disabled:y,onClick:Oe,leftIcon:a.jsxs("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",children:[a.jsx("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),a.jsx("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),a.jsx("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),a.jsx("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]}),children:e(y?"form.pleaseWait":"form.continueWithGoogle")}),ie&&a.jsx(U,{variant:"outline",size:"md",fullWidth:!0,disabled:y,onClick:Ae,className:"!bg-black !text-white !border-black hover:!bg-gray-900 dark:!bg-white dark:!text-black dark:!border-white dark:hover:!bg-gray-100",leftIcon:a.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09l.01-.01zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z"})}),children:y?e("form.pleaseWait"):e("form.continueWithApple","Continue with Apple")})]}),!f&&a.jsxs("div",{className:"relative mb-6",children:[a.jsx("div",{className:"absolute inset-0 flex items-center",children:a.jsx("div",{className:"w-full border-t border-gray-300 dark:border-dim-border"})}),a.jsx("div",{className:"relative flex justify-center text-sm",children:a.jsx("span",{className:"px-4 font-['Nunito'] bg-white dark:bg-dim-surface text-gray-500 dark:text-dim-text-muted",children:e("form.orContinueWithEmail")})})]}),d?a.jsxs("div",{className:"text-center",children:[a.jsxs("div",{className:"mb-6 p-4 rounded-xl border transition-colors bg-sage-50 dark:bg-dim-elevated text-sage-900 dark:text-dim-text border-sage-200 dark:border-dim-border",role:"status",children:[a.jsx("p",{className:"font-bold mb-2",children:e("resetPassword.success")}),a.jsxs("p",{className:"text-sm",children:[e("resetPassword.successMessage")," ",a.jsx("span",{className:"font-semibold",children:h}),"."]})]}),a.jsx("button",{type:"button",onClick:()=>{m(!1),b(!1),L()},className:"w-full min-h-[48px] py-3 rounded-full font-bold transition-colors shadow-sm bg-sage-600 hover:bg-sage-700 text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-sage-500 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-dim-surface",children:e("resetPassword.returnToLogin")})]}):a.jsxs("form",{onSubmit:Le,className:"space-y-4",children:[a.jsx("div",{className:"hidden-field",style:{display:"none"},children:a.jsx("input",{type:"text",name:"confirm_email",tabIndex:"-1",autoComplete:"off",value:j,onChange:E=>w(E.target.value)})}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"login-email",className:"ml-1 block text-sm font-bold text-slate-700 dark:text-dim-text-secondary",children:e("form.email")}),a.jsx("input",{id:"login-email",type:"email",placeholder:e("form.email"),value:h,onChange:E=>R(E.target.value),autoComplete:"email",inputMode:"email",autoCapitalize:"none",spellCheck:"false","aria-invalid":F(x,"email")||void 0,"aria-describedby":F(x,"email")?"auth-error":void 0,className:`mt-1 min-h-[48px] w-full rounded-xl border px-4 py-3 outline-none transition-all bg-white dark:bg-dim-elevated text-ink dark:text-dim-text placeholder-slate-500 dark:placeholder-dim-text-muted focus:border-sage-500 dark:focus:border-sage-400 focus:ring-4 focus:ring-sage-500/20 ${F(x,"email")?"border-honey-700 dark:border-sun":"border-slate-300 dark:border-dim-border"}`,required:!0,disabled:y})]}),!f&&a.jsx(Ot,{authError:x,inputRef:oe,isLoading:y,isLogin:c,onChange:E=>k(E.target.value),onForgotPassword:()=>{m(!0),L()},password:C,t:e}),H&&a.jsx("div",{children:a.jsx(xt,{ref:I,sitekey:"6LeSVDIsAAAAAPzqMn8C5ngD_oQge6J8--QVhXHT",onChange:T,theme:"light",size:"invisible"})}),a.jsx(U,{type:"submit",variant:"primary",size:"md",fullWidth:!0,loading:y,children:wt(e,y,f,c)}),a.jsx(Wt,{t:e,isLogin:c,isResetPassword:f}),H&&a.jsx(Ft,{})]}),!f&&a.jsx(At,{}),a.jsx(Dt,{t:e,isLogin:c,isResetPassword:f,onBackToLogin:()=>{m(!1),p(!0),L(),b(!1)},onToggleMode:()=>{p(!c),L(),T(null)}})]})]})}export{Yt 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.