| 1 |
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{T as t,a as n,k as r,w as i}from"./client-DWQBE01c.js";import{c as a,f as o,l as s}from"./chunk-62JRHF6Z-DYKXAPSj.js";import{t as ee}from"./useQuery-Q4exvDrv.js";import{t as c}from"./useMutation-D7HomC3_.js";import{n as te}from"./ToastContext-Bg6SLDR7.js";import{t as ne}from"./key-CD1tqr8p.js";import{t as re}from"./mail-xRVt2W5s.js";import{t as ie}from"./shield-BdzedGVS.js";import{t as ae}from"./smartphone-B2bcug0M.js";import{t as oe}from"./x-Ros7hs1-.js";import{n as se}from"./AuthContext-dqmb9nDE.js";import{n as ce}from"./ThemeContext-B3GhzVqo.js";import{i as le,n as ue,t as de}from"./Card-DwWt21H0.js";import{t as l}from"./Button-CDViejCk.js";var u=e(r(),1),d=i(),f=`auth_remember_me`,p=`auth_post_login_redirect`;function m(e){return e?`persistent`:`session`}function fe(){try{let e=sessionStorage.getItem(f)===`1`;return sessionStorage.removeItem(f),e}catch(e){return console.warn(`consumeSavedRememberMe: sessionStorage unavailable, Remember Me preference lost across OIDC redirect`,e),!1}}function h(e){return!e||!e.startsWith(`/`)||e.startsWith(`//`)||e.startsWith(`/login`)?null:e}function pe(e){let t=h(e);if(t)try{sessionStorage.setItem(p,t)}catch(e){console.warn(`stashPostLoginRedirect: sessionStorage unavailable, post-login target will be lost across OIDC redirect`,e)}}function me(){try{let e=sessionStorage.getItem(p);return sessionStorage.removeItem(p),h(e)}catch(e){return console.warn(`consumePostLoginRedirect: sessionStorage unavailable`,e),null}}function he({provider:e,onClick:r,disabled:i}){let{t:a}=t(),[o,s]=(0,u.useState)(!1);return(0,d.jsxs)(`button`,{type:`button`,onClick:r,disabled:i,className:`w-full flex items-center justify-center gap-3 py-3 px-4 bg-bambu-dark-secondary border border-bambu-dark-tertiary hover:border-bambu-green/50 rounded-lg text-white font-medium transition-colors disabled:opacity-50`,children:[e.has_icon&&!o?(0,d.jsx)(`img`,{src:n.oidcProviderIconUrl(e.id),alt:``,className:`w-5 h-5 object-contain`,onError:()=>s(!0)}):(0,d.jsx)(ie,{className:`w-5 h-5 text-bambu-green`}),a(`login.twoFA.signInWith`,{provider:e.name})]})}function g(){let e=s(),r=a(),[i]=o(),{t:p}=t(),{login:g,loginWithToken:_,user:v,loading:y}=se(),{showToast:b}=te(),{mode:ge}=ce();function x(){let e=r.state?.from;if(e?.pathname){let t=h(`${e.pathname}${e.search??``}`);if(t)return t}return me()??`/`}let[S,_e]=(0,u.useState)(``),[C,ve]=(0,u.useState)(``),[ye,w]=(0,u.useState)(!1),[T,E]=(0,u.useState)(``),[D,O]=(0,u.useState)(`credentials`),[be,k]=(0,u.useState)(``),[A,j]=(0,u.useState)([]),[M,N]=(0,u.useState)(`totp`),[P,F]=(0,u.useState)(``),[I,L]=(0,u.useState)(!1),xe=(0,u.useRef)(null),[R,z]=(0,u.useState)(!1),[Se,B]=(0,u.useState)(``),[V,H]=(0,u.useState)(``),[U,W]=(0,u.useState)(``),{data:G}=ee({queryKey:[`advancedAuthStatus`],queryFn:()=>n.getAdvancedAuthStatus()}),{data:K}=ee({queryKey:[`oidcProviders`],queryFn:()=>n.getOIDCProviders()}),[Ce,we]=(0,u.useState)(!1);(0,u.useEffect)(()=>{!y&&v&&D===`credentials`&&e(`/`,{replace:!0})},[y,v,D,e]);let Te=(0,u.useRef)(!1);(0,u.useEffect)(()=>{if(Te.current||i.get(`fallback`)===`local`||!G||!G.autologin_provider_id||window.location.hash.startsWith(`#oidc_token=`)||i.get(`oidc_error`))return;Te.current=!0;let e=G.autologin_provider_id,t=new Promise((e,t)=>setTimeout(()=>t(Error(`autologin timeout`)),5e3));Promise.race([n.getOIDCAuthorizeUrl(e),t]).then(e=>{let t=r.state?.from;t?.pathname&&pe(`${t.pathname}${t.search??``}`),window.location.href=e.auth_url}).catch(()=>{we(!0)})},[G,i,r.state]);let q=G?.local_login_enabled!==!1,Ee=Ce&&G?.autologin_provider_id!=null;(0,u.useEffect)(()=>{let t=window.location.hash,n=t.startsWith(`#reset_token=`)?t.slice(13):null;n&&(B(n),O(`reset-password`),e(`/login`,{replace:!0}))},[]),(0,u.useEffect)(()=>{let t=window.location.hash,r=t.startsWith(`#oidc_token=`)?t.slice(12):null,a=i.get(`oidc_error`);if(!r&&!a)return;let o=fe();if(a){let t={oidc_provider_error:p(`login.oidcErrors.providerError`),missing_parameters:p(`login.oidcErrors.missingParameters`),invalid_state:p(`login.oidcErrors.invalidState`),state_expired:p(`login.oidcErrors.stateExpired`),provider_not_found:p(`login.oidcErrors.providerNotFound`),discovery_failed:p(`login.oidcErrors.discoveryFailed`),invalid_discovery_document:p(`login.oidcErrors.invalidDiscovery`),token_exchange_network_error:p(`login.oidcErrors.networkError`),token_exchange_bad_response:p(`login.oidcErrors.badResponse`),no_id_token:p(`login.oidcErrors.noIdToken`),token_validation_failed:p(`login.oidcErrors.validationFailed`),nonce_mismatch:p(`login.oidcErrors.nonceMismatch`),missing_sub_claim:p(`login.oidcErrors.missingSubClaim`),no_linked_account:p(`login.oidcErrors.noLinkedAccount`),account_inactive:p(`login.oidcErrors.accountInactive`),user_resolution_failed:p(`login.oidcErrors.userResolutionFailed`),internal_error:p(`login.oidcErrors.internalError`)}[a]??(a.startsWith(`token_exchange_`)?p(`login.oidcErrors.tokenExchangeFailed`):p(`login.oidcLoginFailed`));b(t,`error`),e(`/login`,{replace:!0});return}r&&n.exchangeOIDCToken(r).then(t=>{if(t.requires_2fa&&t.pre_auth_token){z(o),k(t.pre_auth_token);let n=t.two_fa_methods??[];j(n),n.includes(`totp`)?N(`totp`):n.includes(`email`)?N(`email`):N(`backup`),O(`2fa`),e(`/login`,{replace:!0})}else t.access_token&&t.user?(_(t.access_token,t.user,m(o)),b(p(`login.loginSuccess`)),e(x(),{replace:!0})):(b(p(`login.oidcLoginFailed`),`error`),e(`/login`,{replace:!0}))}).catch(t=>{console.error(`OIDC token exchange failed`,t),b(p(`login.oidcLoginFailed`),`error`),e(`/login`,{replace:!0})})},[i]);let J=c({mutationFn:()=>g(S,C,m(R)),onSuccess:t=>{if(t.requires_2fa&&t.pre_auth_token){k(t.pre_auth_token);let e=t.two_fa_methods??[];j(e),e.includes(`totp`)?N(`totp`):e.includes(`email`)?N(`email`):N(`backup`),O(`2fa`)}else t.access_token&&t.user&&(b(p(`login.loginSuccess`)),e(x(),{replace:!0}))},onError:e=>{b(e.message||p(`login.loginFailed`),`error`)}}),Y=c({mutationFn:e=>n.forgotPassword({email:e}),onSuccess:e=>{b(e.message,`success`),w(!1),E(``)},onError:e=>{b(e.message,`error`)}}),X=c({mutationFn:()=>n.forgotPasswordConfirm(Se,V),onSuccess:e=>{b(e.message,`success`),O(`credentials`),B(``),H(``),W(``)},onError:e=>{b(e.message||p(`login.resetPassword.resetFailed`),`error`)}}),Z=c({mutationFn:()=>n.sendEmailOTP(be),onSuccess:e=>{L(!0),e.pre_auth_token&&k(e.pre_auth_token),b(e.message,`success`)},onError:e=>{b(e.message||p(`login.twoFA.sendCodeFailed`),`error`)}}),Q=c({mutationFn:()=>n.verify2FA({pre_auth_token:be,code:P,method:M}),onSuccess:t=>{t.access_token&&t.user?(_(t.access_token,t.user,m(R)),b(p(`login.loginSuccess`)),e(x(),{replace:!0})):(console.error(`2FA verify: unexpected response shape`,t),b(p(`login.loginFailed`),`error`))},onError:e=>{b(e.message||p(`login.twoFA.invalidCode`),`error`),F(``)}}),De=c({mutationFn:e=>n.getOIDCAuthorizeUrl(e),onSuccess:e=>{try{R?sessionStorage.setItem(f,`1`):sessionStorage.removeItem(f)}catch(e){console.warn(`setItem/removeItem auth_remember_me failed, Remember Me will not carry through OIDC redirect`,e)}let t=r.state?.from;t?.pathname&&pe(`${t.pathname}${t.search??``}`),window.location.href=e.auth_url},onError:e=>{b(e.message||p(`login.oidcLoginFailed`),`error`)}}),Oe=e=>{if(e.preventDefault(),!S||!C){b(p(`login.enterCredentials`),`error`);return}J.mutate()},ke=e=>{if(e.preventDefault(),!P.trim()){b(p(`login.twoFA.enterCode`),`error`);return}Q.mutate()},Ae=e=>{if(e.preventDefault(),!T){b(p(`login.enterEmail`),`error`);return}Y.mutate(T)},$=e=>{N(e),F(``),L(!1),setTimeout(()=>xe.current?.focus(),0)};return D===`reset-password`?(0,d.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-bambu-dark p-4`,children:(0,d.jsxs)(`div`,{className:`max-w-md w-full space-y-8 p-8 bg-gradient-to-br from-bambu-card to-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary shadow-lg`,children:[(0,d.jsxs)(`div`,{className:`text-center`,children:[(0,d.jsx)(`div`,{className:`flex items-center justify-center mb-4`,children:(0,d.jsx)(`div`,{className:`w-14 h-14 rounded-full bg-bambu-green/20 flex items-center justify-center`,children:(0,d.jsx)(ne,{className:`w-7 h-7 text-bambu-green`})})}),(0,d.jsx)(`h2`,{className:`text-2xl font-bold text-white`,children:p(`login.resetPassword.title`)}),(0,d.jsx)(`p`,{className:`mt-2 text-sm text-bambu-gray`,children:p(`login.resetPassword.subtitle`)})]}),(0,d.jsxs)(`form`,{onSubmit:e=>{if(e.preventDefault(),V!==U){b(p(`login.resetPassword.passwordsDoNotMatch`),`error`);return}if(V.length<8){b(p(`login.resetPassword.passwordTooShort`),`error`);return}X.mutate()},className:`space-y-4`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{htmlFor:`new-password`,className:`block text-sm font-medium text-white mb-2`,children:p(`login.resetPassword.newPassword`)}),(0,d.jsx)(`input`,{id:`new-password`,type:`password`,required:!0,value:V,onChange:e=>H(e.target.value),className:`block w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:p(`login.resetPassword.newPasswordPlaceholder`),autoFocus:!0,autoComplete:`new-password`,minLength:8})]}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{htmlFor:`confirm-password`,className:`block text-sm font-medium text-white mb-2`,children:p(`login.resetPassword.confirmPassword`)}),(0,d.jsx)(`input`,{id:`confirm-password`,type:`password`,required:!0,value:U,onChange:e=>W(e.target.value),className:`block w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:p(`login.resetPassword.confirmPasswordPlaceholder`),autoComplete:`new-password`})]}),(0,d.jsx)(`button`,{type:`submit`,disabled:X.isPending||!V||!U,className:`w-full flex justify-center py-3 px-4 bg-bambu-green hover:bg-bambu-green-light text-white font-medium rounded-lg shadow-lg shadow-bambu-green/20 hover:shadow-bambu-green/30 focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:ring-offset-2 focus:ring-offset-bambu-dark-secondary transition-all disabled:opacity-50 disabled:cursor-not-allowed`,children:X.isPending?p(`login.resetPassword.saving`):p(`login.resetPassword.submit`)})]}),(0,d.jsx)(`div`,{className:`text-center`,children:(0,d.jsx)(`button`,{type:`button`,onClick:()=>{O(`credentials`),B(``),H(``),W(``)},className:`text-sm text-bambu-gray hover:text-bambu-green transition-colors`,children:p(`login.resetPassword.backToLogin`)})})]})}):D===`2fa`?(0,d.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-bambu-dark p-4`,children:(0,d.jsxs)(`div`,{className:`max-w-md w-full space-y-8 p-8 bg-gradient-to-br from-bambu-card to-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary shadow-lg`,children:[(0,d.jsxs)(`div`,{className:`text-center`,children:[(0,d.jsx)(`div`,{className:`flex items-center justify-center mb-4`,children:(0,d.jsx)(`div`,{className:`w-14 h-14 rounded-full bg-bambu-green/20 flex items-center justify-center`,children:(0,d.jsx)(ie,{className:`w-7 h-7 text-bambu-green`})})}),(0,d.jsx)(`h2`,{className:`text-2xl font-bold text-white`,children:p(`login.twoFA.title`)}),(0,d.jsx)(`p`,{className:`mt-2 text-sm text-bambu-gray`,children:p(`login.twoFA.subtitle`)})]}),A.length>1&&(0,d.jsxs)(`div`,{className:`flex gap-2`,children:[A.includes(`totp`)&&(0,d.jsxs)(`button`,{type:`button`,onClick:()=>$(`totp`),className:`flex-1 flex flex-col items-center gap-1 py-2 px-3 rounded-lg border text-xs font-medium transition-colors ${M===`totp`?`border-bambu-green bg-bambu-green/10 text-bambu-green`:`border-bambu-dark-tertiary text-bambu-gray hover:border-bambu-green/50`}`,children:[(0,d.jsx)(ae,{className:`w-4 h-4`}),p(`login.twoFA.methodAuthenticator`)]}),A.includes(`email`)&&(0,d.jsxs)(`button`,{type:`button`,onClick:()=>$(`email`),className:`flex-1 flex flex-col items-center gap-1 py-2 px-3 rounded-lg border text-xs font-medium transition-colors ${M===`email`?`border-bambu-green bg-bambu-green/10 text-bambu-green`:`border-bambu-dark-tertiary text-bambu-gray hover:border-bambu-green/50`}`,children:[(0,d.jsx)(re,{className:`w-4 h-4`}),p(`login.twoFA.methodEmail`)]}),A.includes(`backup`)&&(0,d.jsxs)(`button`,{type:`button`,onClick:()=>$(`backup`),className:`flex-1 flex flex-col items-center gap-1 py-2 px-3 rounded-lg border text-xs font-medium transition-colors ${M===`backup`?`border-bambu-green bg-bambu-green/10 text-bambu-green`:`border-bambu-dark-tertiary text-bambu-gray hover:border-bambu-green/50`}`,children:[(0,d.jsx)(ne,{className:`w-4 h-4`}),p(`login.twoFA.methodBackup`)]})]}),(0,d.jsxs)(`form`,{onSubmit:ke,className:`space-y-4`,children:[M===`totp`&&(0,d.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:p(`login.twoFA.instructionsTotp`)}),M===`email`&&(0,d.jsxs)(`div`,{className:`space-y-3`,children:[(0,d.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:p(I?`login.twoFA.instructionsEmail`:`login.twoFA.instructionsEmailNotSent`)}),!I&&(0,d.jsx)(l,{type:`button`,variant:`secondary`,className:`w-full`,onClick:()=>Z.mutate(),disabled:Z.isPending,children:Z.isPending?p(`login.twoFA.sendingCode`):p(`login.twoFA.sendCodeButton`)}),I&&(0,d.jsx)(`button`,{type:`button`,onClick:()=>{L(!1),Z.mutate()},className:`text-xs text-bambu-gray hover:text-bambu-green transition-colors`,children:p(`login.twoFA.resendCode`)})]}),M===`backup`&&(0,d.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:p(`login.twoFA.instructionsBackup`)}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{htmlFor:`twofa-code`,className:`block text-sm font-medium text-white mb-2`,children:p(M===`backup`?`login.twoFA.backupCodeLabel`:`login.twoFA.codeLabel`)}),(0,d.jsx)(`input`,{ref:xe,id:`twofa-code`,type:`text`,inputMode:M===`backup`?`text`:`numeric`,autoComplete:`one-time-code`,value:P,onChange:e=>F(e.target.value.trim()),disabled:M===`email`&&!I,className:`block w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray text-center tracking-widest text-xl font-mono focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors disabled:opacity-40`,placeholder:p(M===`backup`?`login.twoFA.backupCodePlaceholder`:`login.twoFA.codePlaceholder`),maxLength:M===`backup`?8:6,autoFocus:!0})]}),(0,d.jsx)(`button`,{type:`submit`,disabled:Q.isPending||!P.trim()||M===`email`&&!I,className:`w-full flex justify-center py-3 px-4 bg-bambu-green hover:bg-bambu-green-light text-white font-medium rounded-lg shadow-lg shadow-bambu-green/20 hover:shadow-bambu-green/30 focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:ring-offset-2 focus:ring-offset-bambu-dark-secondary transition-all disabled:opacity-50 disabled:cursor-not-allowed`,children:Q.isPending?p(`login.twoFA.verifyingButton`):p(`login.twoFA.verifyButton`)})]}),(0,d.jsx)(`div`,{className:`text-center`,children:(0,d.jsx)(`button`,{type:`button`,onClick:()=>{O(`credentials`),k(``),F(``),L(!1)},className:`text-sm text-bambu-gray hover:text-bambu-green transition-colors`,children:p(`login.twoFA.backToLogin`)})})]})}):(0,d.jsxs)(`div`,{className:`min-h-screen flex items-center justify-center bg-bambu-dark p-4`,children:[(0,d.jsxs)(`div`,{className:`max-w-md w-full space-y-8 p-8 bg-gradient-to-br from-bambu-card to-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary shadow-lg`,children:[(0,d.jsxs)(`div`,{className:`text-center`,children:[(0,d.jsx)(`div`,{className:`flex items-center justify-center mb-6`,children:(0,d.jsx)(`img`,{src:ge===`dark`?`/img/bambuddy_logo_dark_transparent.png`:`/img/bambuddy_logo_light.png`,alt:`Bambuddy`,className:`h-16`})}),(0,d.jsx)(`h2`,{className:`text-3xl font-bold text-white`,children:p(`login.title`)}),(0,d.jsx)(`p`,{className:`mt-2 text-sm text-bambu-gray`,children:p(`login.subtitle`)})]}),Ee&&(0,d.jsx)(`div`,{className:`mt-6 rounded-lg border border-amber-300 dark:border-amber-500/40 bg-amber-50 dark:bg-amber-500/10 px-4 py-3 text-sm text-amber-800 dark:text-amber-200`,children:p(`login.autologinFailed`)}),!q&&(0,d.jsx)(`div`,{className:`mt-6 rounded-lg border border-bambu-dark-tertiary bg-bambu-dark/40 px-4 py-3 text-sm text-bambu-gray`,children:p(`login.localDisabledNotice`)}),q&&(0,d.jsxs)(`form`,{className:`mt-8 space-y-6`,onSubmit:Oe,children:[(0,d.jsxs)(`div`,{className:`space-y-4`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{htmlFor:`username`,className:`block text-sm font-medium text-white mb-2`,children:G?.advanced_auth_enabled?p(`login.usernameOrEmail`):p(`login.username`)}),(0,d.jsx)(`input`,{id:`username`,type:`text`,required:!0,value:S,onChange:e=>_e(e.target.value),className:`block w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:G?.advanced_auth_enabled?p(`login.usernameOrEmailPlaceholder`):p(`login.usernamePlaceholder`),autoComplete:`username`})]}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{htmlFor:`password`,className:`block text-sm font-medium text-white mb-2`,children:p(`login.password`)||`Password`}),(0,d.jsx)(`input`,{id:`password`,type:`password`,required:!0,value:C,onChange:e=>ve(e.target.value),className:`block w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:p(`login.passwordPlaceholder`),autoComplete:`current-password`})]})]}),(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(`input`,{id:`remember-me`,type:`checkbox`,checked:R,onChange:e=>z(e.target.checked),className:`h-4 w-4 rounded border-bambu-dark-tertiary bg-bambu-dark-secondary text-bambu-green focus:ring-bambu-green/50 cursor-pointer`}),(0,d.jsx)(`label`,{htmlFor:`remember-me`,className:`text-sm text-bambu-gray cursor-pointer`,children:p(`login.rememberMe`)})]}),(0,d.jsx)(`div`,{children:(0,d.jsx)(`button`,{type:`submit`,disabled:J.isPending,className:`w-full flex justify-center py-3 px-4 bg-bambu-green hover:bg-bambu-green-light text-white font-medium rounded-lg shadow-lg shadow-bambu-green/20 hover:shadow-bambu-green/30 focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:ring-offset-2 focus:ring-offset-bambu-dark-secondary transition-all disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-bambu-green`,children:J.isPending?p(`login.signingIn`):p(`login.signIn`)})}),(0,d.jsx)(`div`,{className:`text-center`,children:(0,d.jsx)(`button`,{type:`button`,onClick:()=>w(!0),className:`text-sm text-bambu-gray hover:text-bambu-green transition-colors`,children:p(`login.forgotPassword`)})})]}),K&&K.length>0&&(0,d.jsxs)(`div`,{className:`space-y-3`,children:[q&&(0,d.jsxs)(`div`,{className:`relative`,children:[(0,d.jsx)(`div`,{className:`absolute inset-0 flex items-center`,children:(0,d.jsx)(`div`,{className:`w-full border-t border-bambu-dark-tertiary`})}),(0,d.jsx)(`div`,{className:`relative flex justify-center text-sm`,children:(0,d.jsx)(`span`,{className:`px-2 bg-bambu-dark-secondary text-bambu-gray`,children:p(`login.twoFA.orContinueWith`)})})]}),!q&&(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(`input`,{id:`remember-me`,type:`checkbox`,checked:R,onChange:e=>z(e.target.checked),className:`h-4 w-4 rounded border-bambu-dark-tertiary bg-bambu-dark-secondary text-bambu-green focus:ring-bambu-green/50 cursor-pointer`}),(0,d.jsx)(`label`,{htmlFor:`remember-me`,className:`text-sm text-bambu-gray cursor-pointer`,children:p(`login.rememberMe`)})]}),(0,d.jsx)(`div`,{className:`space-y-2`,children:K.map(e=>(0,d.jsx)(he,{provider:e,onClick:()=>De.mutate(e.id),disabled:De.isPending},e.id))})]})]}),ye&&(0,d.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,onClick:()=>w(!1),children:(0,d.jsxs)(de,{className:`w-full max-w-md`,onClick:e=>e.stopPropagation(),children:[(0,d.jsx)(le,{children:(0,d.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(re,{className:`w-5 h-5 text-bambu-green`}),(0,d.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:p(`login.forgotPasswordTitle`)})]}),(0,d.jsx)(l,{variant:`ghost`,size:`sm`,onClick:()=>{w(!1),E(``)},children:(0,d.jsx)(oe,{className:`w-5 h-5`})})]})}),(0,d.jsx)(ue,{children:G?.advanced_auth_enabled?(0,d.jsxs)(`form`,{onSubmit:Ae,className:`space-y-4`,children:[(0,d.jsx)(`p`,{className:`text-bambu-gray text-sm`,children:p(`login.forgotPasswordEmailMessage`)}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{htmlFor:`forgot-email`,className:`block text-sm font-medium text-white mb-2`,children:p(`login.emailAddress`)}),(0,d.jsx)(`input`,{id:`forgot-email`,type:`email`,required:!0,value:T,onChange:e=>E(e.target.value),className:`block w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:p(`login.emailPlaceholder`)})]}),(0,d.jsxs)(`div`,{className:`flex gap-2`,children:[(0,d.jsx)(l,{type:`button`,variant:`secondary`,className:`flex-1`,onClick:()=>{w(!1),E(``)},children:p(`login.cancel`)}),(0,d.jsx)(l,{type:`submit`,className:`flex-1`,disabled:Y.isPending,children:Y.isPending?p(`login.sending`):p(`login.sendResetEmail`)})]})]}):(0,d.jsxs)(`div`,{className:`space-y-4`,children:[(0,d.jsx)(`p`,{className:`text-bambu-gray`,children:p(`login.forgotPasswordMessage`)}),(0,d.jsxs)(`div`,{className:`bg-bambu-dark rounded-lg p-4 space-y-2`,children:[(0,d.jsx)(`p`,{className:`text-sm text-white font-medium`,children:p(`login.howToReset`)}),(0,d.jsxs)(`ol`,{className:`text-sm text-bambu-gray space-y-1 list-decimal list-inside`,children:[(0,d.jsx)(`li`,{children:p(`login.resetStep1`)}),(0,d.jsx)(`li`,{children:p(`login.resetStep2`)}),(0,d.jsx)(`li`,{children:p(`login.resetStep3`)}),(0,d.jsx)(`li`,{children:p(`login.resetStep4`)})]})]}),(0,d.jsx)(l,{variant:`secondary`,className:`w-full`,onClick:()=>w(!1),children:p(`login.gotIt`)})]})})]})})]})}export{g as LoginPage};
|