@donotdev/auth 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"EmailPasswordForm.d.ts","sourceRoot":"","sources":["../../src/components/EmailPasswordForm.tsx"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EAAE,sBAAsB,EAAY,MAAM,cAAc,CAAC;AA8KrE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,iBAAS,iBAAiB,CAAC,EACzB,IAAe,EACf,SAAS,EACT,OAAO,EACP,SAAc,EACd,GAAG,EACH,OAAO,EACP,YAAY,GACb,EAAE,sBAAsB,+BA2qBxB;AAED,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"EmailPasswordForm.d.ts","sourceRoot":"","sources":["../../src/components/EmailPasswordForm.tsx"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAE,sBAAsB,EAAY,MAAM,cAAc,CAAC;AA8KrE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,iBAAS,iBAAiB,CAAC,EACzB,IAAe,EACf,SAAS,EACT,OAAO,EACP,SAAc,EACd,GAAG,EACH,OAAO,EACP,YAAY,GACb,EAAE,sBAAsB,+BA2qBxB;AAED,eAAe,iBAAiB,CAAC"}
@@ -1,2 +1,2 @@
1
1
  "use client";import{jsx as i,jsxs as n,Fragment as ne}from"react/jsx-runtime";import{useCallback as V,useEffect as Ue,useRef as Ke,useState as h}from"react";import{useForm as Me,Controller as W,useWatch as oe}from"react-hook-form";import{Alert as A,ALERT_VARIANT as N,Button as g,BUTTON_VARIANT as f,Checkbox as le,Dialog as de,Input as De,Label as ce,PasswordInput as ue,Stack as o,Text as b,cn as Oe}from"@donotdev/components";import{useTranslation as Ve,useAppConfig as We}from"@donotdev/core";import{useAuth as v}from"../useAuth";import{PasswordStrengthIndicator as je}from"./PasswordStrengthIndicator";const Fe=6e4,He=5,$e=3e4;function Ge(){const a=Ke([]),[t,m]=h(null),l=V(()=>!!(t&&Date.now()<t),[t]),y=V(()=>{const d=Date.now();a.current=a.current.filter(p=>d-p<Fe),a.current.push(d),a.current.length>=He&&(m(d+$e),a.current=[])},[]);return Ue(()=>{if(!t)return;const d=t-Date.now();if(d<=0){m(null);return}const p=setTimeout(()=>m(null),d);return()=>clearTimeout(p)},[t]),{isRateLimited:l,recordAttempt:y,cooldownUntil:t}}async function Be(a){try{const t=new TextEncoder().encode(a),m=await crypto.subtle.digest("SHA-1",t),l=Array.from(new Uint8Array(m)).map(e=>e.toString(16).padStart(2,"0")).join("").toUpperCase(),y=l.slice(0,5),d=l.slice(5),p=await fetch(`https://api.pwnedpasswords.com/range/${y}`,{headers:{"Add-Padding":"true"},credentials:"omit"});return p.ok?(await p.text()).split(`
2
- `).some(e=>{const[E]=e.split(":");return E?.trim()===d}):!1}catch{return!1}}const ze=[{test:a=>a.includes("429")||a.includes("rate")||a.includes("too_many_requests"),key:"errors.rate_limit",fallback:"Too many attempts. Please wait a moment and try again."},{test:a=>a.includes("email_not_confirmed")||a.includes("email not confirmed")||a.includes("auth/unverified-email"),key:"errors.email_not_confirmed",fallback:"Please verify your email before signing in."},{test:a=>a.includes("invalid_credentials")||a.includes("invalid login credentials")||a.includes("invalid-credential")||a.includes("auth/wrong-password")||a.includes("auth/user-not-found")||a.includes("invalid")&&a.includes("credential"),key:"errors.invalid_credentials",fallback:"Invalid email or password."},{test:a=>a.includes("already")||a.includes("exists")||a.includes("user_already_exists")||a.includes("user already registered")||a.includes("auth/email-already-in-use"),key:"signup.check_email",fallback:"Check your email to confirm your account."},{test:a=>a.includes("weak_password")||a.includes("weak password")||a.includes("auth/weak-password"),key:"errors.weak_password",fallback:"Password is too weak. Please choose a stronger password."},{test:a=>a.includes("network")||a.includes("fetch"),key:"networkError",fallback:"Network error. Please check your connection and try again."}];function Ze(a,t){const m=(a instanceof Error?a.message:String(a)).toLowerCase();for(const l of ze)if(l.test(m))return t(l.key,l.fallback);return t("errorGeneric","Authentication failed. Please try again.")}function Ye({mode:a="signin",onSuccess:t,onError:m,className:l="",tos:y,privacy:d,captchaToken:p}){const{t:e}=Ve("auth"),E=We("app"),me=v("signInWithEmail"),pe=v("createUserWithEmail"),we=v("sendPasswordResetEmail"),he=v("sendEmailVerification"),ge=v("setRememberMe"),fe=v("isAvailable"),j=v("status"),ve=v("loading"),ye=j==="degraded"||j==="error",[T,be]=h(a),w=T==="signup",[q,ke]=h(!1),[F,x]=h(!1),[k,H]=h(!1),[$,U]=h(!1),[K,G]=h(!1),[Pe,B]=h(!1),[_e,z]=h(!1),P=y!==void 0?y:E?.footer?.legalLinks?.find(r=>r.path.includes("terms"))?.path??"/legal/terms",_=d!==void 0?d:E?.footer?.legalLinks?.find(r=>r.path.includes("privacy"))?.path??"/legal/privacy",C=P!==!1,S=_!==!1,Z=C&&typeof P!="string",Y=S&&typeof _!="string",X=C&&typeof P=="string"?P:null,J=S&&typeof _=="string"?_:null,{isRateLimited:M,recordAttempt:Ce,cooldownUntil:Q}=Ge(),{control:R,handleSubmit:Se,getValues:Re,reset:ee,formState:{errors:s,isSubmitting:Ie},setError:D,clearErrors:ae}=Me({mode:"onChange",defaultValues:{email:"",password:"",confirmPassword:""}}),re=oe({control:R,name:"password"}),I=oe({control:R,name:"email"}),O=V(r=>{ee({email:I||"",password:"",confirmPassword:""}),ae(),U(!1),x(!1),G(!1),be(r)},[ee,ae,I]),Ae=async r=>{if(M()){D("root",{message:e("errors.rate_limit","Too many attempts. Please wait a moment and try again.")});return}Ce();try{T==="signin"?(q!==void 0&&await ge(q),await me(r.email,r.password),t?.(void 0)):(await pe(r.email,r.password,K?{gdpr_consent_at:new Date().toISOString()}:void 0),U(!0),t?.(void 0))}catch(u){const qe=T==="signup",te=u instanceof Error?u.message:String(u),L=te.toLowerCase();if(qe&&(L.includes("already")||L.includes("exists")||L.includes("user_already_exists")||L.includes("auth/email-already-in-use"))){U(!0);return}const xe=Ze(u,e);D("root",{message:xe}),m?.(u instanceof Error?u:new Error(te))}},Ne=async()=>{if(!I||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(I)){D("email",{message:e("emailRequired","Email is required")});return}H(!0);try{await we(I)}catch{}finally{x(!0),H(!1)}},Ee=async()=>{try{await he()}catch{}};if(ye)return i(o,{className:l,children:i(A,{variant:N.WARNING,title:e("unavailable.title","Authentication Unavailable"),description:e("unavailable.description","Sign-in is temporarily unavailable. Please try again later.")})});const c=ve||Ie||!fe,ie=w&&(C||S),Le=p!==void 0&&!p,Te=c||M()||Le||ie&&!K,se=Q?Math.max(0,Math.ceil((Q-Date.now())/1e3)):0;return i("form",{onSubmit:Se(Ae),className:Oe("dndev-auth-form",l),noValidate:!0,children:n(o,{children:[s.root&&i(A,{variant:N.ERROR,description:s.root.message}),M()&&se>0&&i(A,{variant:N.WARNING,description:e("errors.rate_limit_cooldown",`Too many attempts. Please wait ${se} seconds.`)}),$&&n(o,{children:[i(A,{variant:N.SUCCESS,title:e("signup.success_title","Check your email"),description:e("signup.check_email","If an account was created, you will receive a confirmation email. Check your inbox and spam folder.")}),n(o,{direction:"row",gap:"tight",justify:"center",align:"center",children:[i(g,{type:"button",variant:f.GHOST,onClick:Ee,children:e("signup.resend_verification","Resend verification email")}),i(b,{as:"span",variant:"muted",children:"|"}),i(g,{type:"button",variant:f.LINK,onClick:()=>O("signin"),children:e("actions.sign_in_submit","Sign In")})]})]}),F&&n(o,{children:[i(A,{variant:N.SUCCESS,title:e("forgotPassword.sent","Password reset email sent"),description:e("forgotPassword.check_email_safe","If an account exists with this email, you will receive password reset instructions.")}),i(o,{align:"center",children:i(g,{type:"button",variant:f.LINK,onClick:()=>{x(!1)},children:e("back","Back")})})]}),!$&&!F&&n(o,{children:[i(W,{name:"email",control:R,rules:{required:e("emailRequired","Email is required"),pattern:{value:/^[^\s@]+@[^\s@]+\.[^\s@]+$/,message:e("emailInvalid","Invalid email address")}},render:({field:r})=>n(o,{gap:"tight",children:[i(De,{...r,type:"email",label:e("email","Email"),placeholder:e("emailPlaceholder","Enter your email"),autoComplete:"email webauthn",disabled:c||k,"aria-invalid":!!s.email,"aria-describedby":s.email?"email-error":void 0,className:"dndev-w-full","data-variant":s.email?"destructive":void 0}),s.email&&i(b,{as:"span",level:"caption",variant:"destructive",id:"email-error",role:"alert",children:s.email.message})]})}),i(W,{name:"password",control:R,rules:{required:e("passwordRequired","Password is required"),minLength:{value:8,message:e("passwordMinLength","Password must be at least 8 characters")},validate:w?{uppercase:r=>r?/[A-Z]/.test(r)?!0:e("passwordRequirement.uppercase","Password must contain at least one uppercase letter"):!0,lowercase:r=>r?/[a-z]/.test(r)?!0:e("passwordRequirement.lowercase","Password must contain at least one lowercase letter"):!0,number:r=>r?/[0-9]/.test(r)?!0:e("passwordRequirement.number","Password must contain at least one number"):!0,special:r=>r?/[^a-zA-Z0-9]/.test(r)?!0:e("passwordRequirement.special","Password must contain at least one special character"):!0,breached:async r=>!r||r.length<8?!0:await Be(r)?e("errors.breached_password","This password has appeared in a data breach. Please choose a different password."):!0}:void 0},render:({field:r})=>{const u=`password-${r.name}`;return n(o,{gap:"tight",children:[i(ue,{...r,id:u,label:e("password","Password"),placeholder:e("passwordPlaceholder","Enter your password"),autoComplete:w?"new-password":"current-password",disabled:c||k,"aria-invalid":!!s.password,"aria-describedby":s.password?"password-error":void 0,className:"dndev-w-full","data-variant":s.password?"destructive":void 0}),s.password&&i(b,{as:"span",level:"caption",variant:"destructive",id:"password-error",role:"alert",children:s.password.message})]})}}),w&&i(W,{name:"confirmPassword",control:R,rules:{required:e("confirmPasswordRequired","Please confirm your password"),validate:r=>{const u=Re("password");return r!==u?e("confirmPasswordMismatch","Passwords do not match"):!0}},render:({field:r})=>n(o,{gap:"tight",children:[i(ue,{...r,label:e("confirmPassword","Confirm Password"),placeholder:e("confirmPasswordPlaceholder","Re-enter your password"),autoComplete:"new-password",disabled:c,"aria-invalid":!!s.confirmPassword,"aria-describedby":s.confirmPassword?"confirm-password-error":void 0,className:"dndev-w-full","data-variant":s.confirmPassword?"destructive":void 0}),s.confirmPassword&&i(b,{as:"span",level:"caption",variant:"destructive",id:"confirm-password-error",role:"alert",children:s.confirmPassword.message})]})}),w&&re&&i(je,{password:re,minLength:8,showRequirements:!0}),ie&&n(ne,{children:[n(o,{direction:"row",gap:"tight",align:"start",children:[i(le,{id:"tos-accept",checked:K,onCheckedChange:r=>G(r===!0),disabled:c}),i(ce,{htmlFor:"tos-accept",children:n(b,{as:"span",level:"caption",children:[e("terms.accept_prefix","I accept the")," ",C&&i(g,{type:"button",variant:f.LINK,onClick:()=>{Z?B(!0):X&&window.open(X,"_blank","noopener,noreferrer")},className:"dndev-p-0 dndev-h-auto",style:{minHeight:"auto",padding:0,display:"inline"},children:e("terms.tos","Terms of Service")}),C&&S&&n(ne,{children:[" ",e("terms.and","and")," "]}),S&&i(g,{type:"button",variant:f.LINK,onClick:()=>{Y?z(!0):J&&window.open(J,"_blank","noopener,noreferrer")},className:"dndev-p-0 dndev-h-auto",style:{minHeight:"auto",padding:0,display:"inline"},children:e("terms.privacy","Privacy Policy")})]})})]}),Z&&i(de,{open:Pe,onOpenChange:B,title:e("terms.tos","Terms of Service"),showClose:!0,children:P}),Y&&i(de,{open:_e,onOpenChange:z,title:e("terms.privacy","Privacy Policy"),showClose:!0,children:_})]}),!w&&n(o,{direction:"row",gap:"tight",align:"center",children:[i(le,{id:"remember-me",checked:q,onCheckedChange:r=>ke(r===!0),disabled:c||k}),i(ce,{htmlFor:"remember-me",children:e("rememberMe","Remember me")})]}),i(g,{type:"submit",variant:f.PRIMARY,disabled:Te,fullWidth:!0,children:c?e("loading","Loading..."):w?e("actions.sign_up_submit","Sign Up"):e("actions.sign_in_submit","Sign In")}),!w&&n(o,{direction:"row",gap:"tight",justify:"center",align:"center",children:[i(g,{type:"button",variant:f.LINK,disabled:c||k,onClick:Ne,children:k?e("loading","Loading..."):e("forgotPassword","Forgot password?")}),i(b,{as:"span",variant:"muted",children:"|"}),i(g,{type:"button",variant:f.LINK,disabled:c,onClick:()=>O("signup"),children:e("actions.sign_up_submit","Sign Up")})]}),w&&i(o,{align:"center",children:i(g,{type:"button",variant:f.LINK,disabled:c,onClick:()=>O("signin"),children:e("alreadyHaveAccount","Already have an account? Sign In")})})]})]})})}var Xe=Ye;export{Xe as default};
2
+ `).some(e=>{const[E]=e.split(":");return E?.trim()===d}):!1}catch{return!1}}const ze=[{test:a=>a.includes("429")||a.includes("rate")||a.includes("too_many_requests"),key:"errors.rate_limit",fallback:"Too many attempts. Please wait a moment and try again."},{test:a=>a.includes("email_not_confirmed")||a.includes("email not confirmed")||a.includes("auth/unverified-email"),key:"errors.email_not_confirmed",fallback:"Please verify your email before signing in."},{test:a=>a.includes("invalid_credentials")||a.includes("invalid login credentials")||a.includes("invalid-credential")||a.includes("auth/wrong-password")||a.includes("auth/user-not-found")||a.includes("invalid")&&a.includes("credential"),key:"errors.invalid_credentials",fallback:"Invalid email or password."},{test:a=>a.includes("already")||a.includes("exists")||a.includes("user_already_exists")||a.includes("user already registered")||a.includes("auth/email-already-in-use"),key:"signup.check_email",fallback:"Check your email to confirm your account."},{test:a=>a.includes("weak_password")||a.includes("weak password")||a.includes("auth/weak-password"),key:"errors.weak_password",fallback:"Password is too weak. Please choose a stronger password."},{test:a=>a.includes("network")||a.includes("fetch"),key:"networkError",fallback:"Network error. Please check your connection and try again."}];function Ze(a,t){const m=(a instanceof Error?a.message:String(a)).toLowerCase();for(const l of ze)if(l.test(m))return t(l.key,l.fallback);return t("errorGeneric","Authentication failed. Please try again.")}function Xe({mode:a="signin",onSuccess:t,onError:m,className:l="",tos:y,privacy:d,captchaToken:p}){const{t:e}=Ve("auth"),E=We("app"),me=v("signInWithEmail"),pe=v("createUserWithEmail"),we=v("sendPasswordResetEmail"),he=v("sendEmailVerification"),ge=v("setRememberMe"),fe=v("isAvailable"),j=v("status"),ve=v("loading"),ye=j==="degraded"||j==="error",[T,be]=h(a),w=T==="signup",[q,ke]=h(!1),[F,x]=h(!1),[k,H]=h(!1),[$,U]=h(!1),[K,G]=h(!1),[Pe,B]=h(!1),[_e,z]=h(!1),P=y!==void 0?y:E?.footer?.legalLinks?.find(r=>r.path.includes("terms"))?.path??"/legal/terms",_=d!==void 0?d:E?.footer?.legalLinks?.find(r=>r.path.includes("privacy"))?.path??"/legal/privacy",C=P!==!1,S=_!==!1,Z=C&&typeof P!="string",X=S&&typeof _!="string",Y=C&&typeof P=="string"?P:null,J=S&&typeof _=="string"?_:null,{isRateLimited:M,recordAttempt:Ce,cooldownUntil:Q}=Ge(),{control:R,handleSubmit:Se,getValues:Re,reset:ee,formState:{errors:s,isSubmitting:Ie},setError:D,clearErrors:ae}=Me({mode:"onChange",defaultValues:{email:"",password:"",confirmPassword:""}}),re=oe({control:R,name:"password"}),I=oe({control:R,name:"email"}),O=V(r=>{ee({email:I||"",password:"",confirmPassword:""}),ae(),U(!1),x(!1),G(!1),be(r)},[ee,ae,I]),Ae=async r=>{if(M()){D("root",{message:e("errors.rate_limit","Too many attempts. Please wait a moment and try again.")});return}Ce();try{T==="signin"?(q!==void 0&&await ge(q),await me(r.email,r.password),t?.(void 0)):(await pe(r.email,r.password,K?{gdpr_consent_at:new Date().toISOString()}:void 0),U(!0),t?.(void 0))}catch(u){const qe=T==="signup",te=u instanceof Error?u.message:String(u),L=te.toLowerCase();if(qe&&(L.includes("already")||L.includes("exists")||L.includes("user_already_exists")||L.includes("auth/email-already-in-use"))){U(!0);return}const xe=Ze(u,e);D("root",{message:xe}),m?.(u instanceof Error?u:new Error(te))}},Ne=async()=>{if(!I||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(I)){D("email",{message:e("emailRequired","Email is required")});return}H(!0);try{await we(I)}catch{}finally{x(!0),H(!1)}},Ee=async()=>{try{await he()}catch{}};if(ye)return i(o,{className:l,children:i(A,{variant:N.WARNING,title:e("unavailable.title","Authentication Unavailable"),description:e("unavailable.description","Sign-in is temporarily unavailable. Please try again later.")})});const c=ve||Ie||!fe,ie=w&&(C||S),Le=p!==void 0&&!p,Te=c||M()||Le||ie&&!K,se=Q?Math.max(0,Math.ceil((Q-Date.now())/1e3)):0;return i("form",{onSubmit:Se(Ae),className:Oe("dndev-auth-form",l),noValidate:!0,children:n(o,{children:[s.root&&i(A,{variant:N.ERROR,description:s.root.message}),M()&&se>0&&i(A,{variant:N.WARNING,description:e("errors.rate_limit_cooldown",`Too many attempts. Please wait ${se} seconds.`)}),$&&n(o,{children:[i(A,{variant:N.SUCCESS,title:e("signup.success_title","Check your email"),description:e("signup.check_email","If an account was created, you will receive a confirmation email. Check your inbox and spam folder.")}),n(o,{direction:"row",gap:"tight",justify:"center",align:"center",children:[i(g,{type:"button",variant:f.GHOST,onClick:Ee,children:e("signup.resend_verification","Resend verification email")}),i(b,{as:"span",variant:"muted",children:"|"}),i(g,{type:"button",variant:f.LINK,onClick:()=>O("signin"),children:e("actions.sign_in_submit","Sign In")})]})]}),F&&n(o,{children:[i(A,{variant:N.SUCCESS,title:e("forgotPassword.sent","Password reset email sent"),description:e("forgotPassword.check_email_safe","If an account exists with this email, you will receive password reset instructions.")}),i(o,{align:"center",children:i(g,{type:"button",variant:f.LINK,onClick:()=>{x(!1)},children:e("back","Back")})})]}),!$&&!F&&n(o,{children:[i(W,{name:"email",control:R,rules:{required:e("emailRequired","Email is required"),pattern:{value:/^[^\s@]+@[^\s@]+\.[^\s@]+$/,message:e("emailInvalid","Invalid email address")}},render:({field:r})=>n(o,{gap:"tight",children:[i(De,{...r,type:"email",label:e("email","Email"),placeholder:e("emailPlaceholder","Enter your email"),autoComplete:"username webauthn",disabled:c||k,"aria-invalid":!!s.email,"aria-describedby":s.email?"email-error":void 0,className:"dndev-w-full","data-variant":s.email?"destructive":void 0}),s.email&&i(b,{as:"span",level:"caption",variant:"destructive",id:"email-error",role:"alert",children:s.email.message})]})}),i(W,{name:"password",control:R,rules:{required:e("passwordRequired","Password is required"),minLength:{value:8,message:e("passwordMinLength","Password must be at least 8 characters")},validate:w?{uppercase:r=>r?/[A-Z]/.test(r)?!0:e("passwordRequirement.uppercase","Password must contain at least one uppercase letter"):!0,lowercase:r=>r?/[a-z]/.test(r)?!0:e("passwordRequirement.lowercase","Password must contain at least one lowercase letter"):!0,number:r=>r?/[0-9]/.test(r)?!0:e("passwordRequirement.number","Password must contain at least one number"):!0,special:r=>r?/[^a-zA-Z0-9]/.test(r)?!0:e("passwordRequirement.special","Password must contain at least one special character"):!0,breached:async r=>!r||r.length<8?!0:await Be(r)?e("errors.breached_password","This password has appeared in a data breach. Please choose a different password."):!0}:void 0},render:({field:r})=>{const u=`password-${r.name}`;return n(o,{gap:"tight",children:[i(ue,{...r,id:u,label:e("password","Password"),placeholder:e("passwordPlaceholder","Enter your password"),autoComplete:w?"new-password":"current-password",disabled:c||k,"aria-invalid":!!s.password,"aria-describedby":s.password?"password-error":void 0,className:"dndev-w-full","data-variant":s.password?"destructive":void 0}),s.password&&i(b,{as:"span",level:"caption",variant:"destructive",id:"password-error",role:"alert",children:s.password.message})]})}}),w&&i(W,{name:"confirmPassword",control:R,rules:{required:e("confirmPasswordRequired","Please confirm your password"),validate:r=>{const u=Re("password");return r!==u?e("confirmPasswordMismatch","Passwords do not match"):!0}},render:({field:r})=>n(o,{gap:"tight",children:[i(ue,{...r,label:e("confirmPassword","Confirm Password"),placeholder:e("confirmPasswordPlaceholder","Re-enter your password"),autoComplete:"new-password",disabled:c,"aria-invalid":!!s.confirmPassword,"aria-describedby":s.confirmPassword?"confirm-password-error":void 0,className:"dndev-w-full","data-variant":s.confirmPassword?"destructive":void 0}),s.confirmPassword&&i(b,{as:"span",level:"caption",variant:"destructive",id:"confirm-password-error",role:"alert",children:s.confirmPassword.message})]})}),w&&re&&i(je,{password:re,minLength:8,showRequirements:!0}),ie&&n(ne,{children:[n(o,{direction:"row",gap:"tight",align:"start",children:[i(le,{id:"tos-accept",checked:K,onCheckedChange:r=>G(r===!0),disabled:c}),i(ce,{htmlFor:"tos-accept",children:n(b,{as:"span",level:"caption",children:[e("terms.accept_prefix","I accept the")," ",C&&i(g,{type:"button",variant:f.LINK,onClick:()=>{Z?B(!0):Y&&window.open(Y,"_blank","noopener,noreferrer")},className:"dndev-p-0 dndev-h-auto",style:{minHeight:"auto",padding:0,display:"inline"},children:e("terms.tos","Terms of Service")}),C&&S&&n(ne,{children:[" ",e("terms.and","and")," "]}),S&&i(g,{type:"button",variant:f.LINK,onClick:()=>{X?z(!0):J&&window.open(J,"_blank","noopener,noreferrer")},className:"dndev-p-0 dndev-h-auto",style:{minHeight:"auto",padding:0,display:"inline"},children:e("terms.privacy","Privacy Policy")})]})})]}),Z&&i(de,{open:Pe,onOpenChange:B,title:e("terms.tos","Terms of Service"),showClose:!0,children:P}),X&&i(de,{open:_e,onOpenChange:z,title:e("terms.privacy","Privacy Policy"),showClose:!0,children:_})]}),!w&&n(o,{direction:"row",gap:"tight",align:"center",children:[i(le,{id:"remember-me",checked:q,onCheckedChange:r=>ke(r===!0),disabled:c||k}),i(ce,{htmlFor:"remember-me",children:e("rememberMe","Remember me")})]}),i(g,{type:"submit",variant:f.PRIMARY,disabled:Te,fullWidth:!0,children:c?e("loading","Loading..."):w?e("actions.sign_up_submit","Sign Up"):e("actions.sign_in_submit","Sign In")}),!w&&n(o,{direction:"row",gap:"tight",justify:"center",align:"center",children:[i(g,{type:"button",variant:f.LINK,disabled:c||k,onClick:Ne,children:k?e("loading","Loading..."):e("forgotPassword","Forgot password?")}),i(b,{as:"span",variant:"muted",children:"|"}),i(g,{type:"button",variant:f.LINK,disabled:c,onClick:()=>O("signup"),children:e("actions.sign_up_submit","Sign Up")})]}),w&&i(o,{align:"center",children:i(g,{type:"button",variant:f.LINK,disabled:c,onClick:()=>O("signin"),children:e("alreadyHaveAccount","Already have an account? Sign In")})})]})]})})}var Ye=Xe;export{Ye as default};