1import{l as R,u as r,k as m}from"./index.notebook.web.C_cnQpuh.js";import{d as p}from"./preact.CLum3pgv.js";const g=8,S=6;function z(t,n){if(t==="reset")return!0;const o=n||"";return t==="signUp"?o.length>=g&&!C(o):o.length>=S}function C(t){return P.has((t||"").toLowerCase())}const P=new Set(["password","password1","password123","12345678","123456789","1234567890","11111111","00000000","qwerty123","qwertyuiop","iloveyou","abc12345","letmein1","welcome1","football","baseball","sunshine","princess"]),M=["Weak","Okay","Strong"];function O(t){const n=t||"",o=n.length,i=[/[a-z]/,/[A-Z]/,/[0-9]/,/[^A-Za-z0-9]/].filter(x=>x.test(n)).length;let a;return o<g||C(n)||/^(.)\1*$/.test(n)?a=0:o>=14||o>=12&&i>=2||o>=10&&i>=3?a=2:a=1,{score:a,label:M[a]}}const h="#4A6741",w=["#f87171","#fbbf24","#4ade80"];function $({S:t,sBtn:n,sInput:o,onSignedIn:i}){const{attemptEmailSignIn:a,attemptEmailSignUp:x,sendPasswordReset:_}=R(),[s,b]=p("signIn"),[c,U]=p(""),[l,T]=p(""),[v,N]=p(!1),[B,u]=p(null),[E,d]=p(null),G=async()=>{N(!0),d(null),u(null);try{if(s==="reset"){const e=await _(c);e!=null&&e.error?d(e.error):(u("Reset link sent â check your email."),m("password_reset_requested"))}else if(s==="signUp"){const e=await x(c,l);e!=null&&e.error?(d(e.error),m("signin_failed",{method:"email_signup",reason:e.error.slice(0,60)})):(m("sign_up",{method:"email"}),i==null||i(e.user))}else{const e=await a(c,l);e!=null&&e.error?(d(e.error),m("signin_failed",{method:"email",reason:e.error.slice(0,60)})):(m("sign_in",{method:"email"}),i==null||i(e.user))}}finally{N(!1)}},y=v||!c||!z(s,l),f=O(l);return r("div",{style:{background:t.dark,border:`1px solid ${t.border}`,borderRadius:"10px",padding:"14px",marginTop:"12px"},children:[r("div",{style:{display:"flex",justifyContent:"center",gap:"12px",marginBottom:"12px",fontSize:"12px",letterSpacing:"1px"},children:[r("button",{onClick:()=>{b("signIn"),d(null),u(null)},style:k(s==="signIn",t),children:"SIGN IN"}),r("button",{onClick:()=>{b("signUp"),d(null),u(null)},style:k(s==="signUp",t),children:"SIGN UP"}),r("button",{onClick:()=>{b("reset"),d(null),u(null)},style:k(s==="reset",t),children:"FORGOT"})]}),r("input",{type:"email",placeholder:"Email",autoComplete:"email",value:c,onChange:e=>U(e.target.value),style:{...o(),width:"100%",marginBottom:"8px"}}),s!=="reset"&&r("input",{type:"password",placeholder:s==="signUp"?`New password (${g}+ characters)`:"Password",autoComplete:s==="signUp"?"new-password":"current-password",value:l,onChange:e=>T(e.target.value),style:{...o(),width:"100%",marginBottom:"8px"}}),s==="signUp"&&l&&r("div",{style:{marginTop:"-2px",marginBottom:"10px"},children:[r("div",{style:{display:"flex",gap:"4px",marginBottom:"4px"},"aria-hidden":"true",children:[0,1,2].map(e=>r("div",{style:{flex:1,height:"4px",borderRadius:"2px",background:e<=f.score?w[f.score]:t.border}},e))}),r("div",{"aria-live":"polite",style:{fontSize:"11px",color:t.muted},children:["Password strength: ",r("span",{style:{color:w[f.score],fontWeight:600},children:f.label}),l.length<g&&` · at least ${g} characters`]}),C(l)&&r("div",{style:{fontSize:"11px",color:w[0],marginTop:"2px"},children:"That password is too common. Pick a different one."})]}),E&&r("div",{style:{fontSize:"12px",color:"#fca5a5",background:"#3a1717",border:"1px solid #f87171",borderRadius:"6px",padding:"8px 10px",marginBottom:"8px"},children:E}),B&&r("div",{style:{fontSize:"12px",color:"#86efac",background:"#1f3d24",border:`1px solid ${h}`,borderRadius:"6px",padding:"8px 10px",marginBottom:"8px"},children:B}),r("button",{onClick:G,disabled:y,style:{...n(!y,!1),width:"100%",padding:"10px",background:y?"#444":h,color:"#fff",border:"none"},children:v?"Working...":s==="reset"?"Send reset link":s==="signUp"?"Create account":"Sign in with email"})]})}function k(t,n){return{background:"none",border:"none",color:t?h:n.muted,cursor:"pointer",fontWeight:"700",letterSpacing:"1px",fontSize:"11px",padding:"4px 0",borderBottom:t?`2px solid ${h}`:"2px solid transparent"}}export{$ as E};
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.