1import{r,o as Z,j as e,a as m,b as H,d as y,q as Q,n as X,g as O,H as K,y as ee,z as W,T as te,G as se,B as ae,V as oe,W as ne}from"../app.js";import{s as ie,c as re}from"./authActions.js";import{a as E}from"./userRecord.js";import{S as c}from"./sentry.js";import{g as u,u as I,f as F}from"./profileHelpers.js";import{A as ce}from"./AuthLayout.js";import{S as le}from"./SocialLoginModal.js";import{M as de}from"./MfaCodeModal.js";const ue=()=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#666",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),e.jsx("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),he=()=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#666",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),e.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),me=()=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#666",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),pe=()=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#666",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94"}),e.jsx("path",{d:"M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19"}),e.jsx("path",{d:"m1 1 22 22"}),e.jsx("path",{d:"M14.12 14.12a3 3 0 1 1-4.24-4.24"})]});function ge(v){const p=new Date(v.metadata.creationTime)<new Date("2026-01-01T00:00:00Z")?"1":"0";document.cookie=`az_legacy_user=${p}; path=/; max-age=86400; SameSite=Strict; Secure`}function fe(){const[v,T]=r.useState(!1),[b,p]=r.useState(!1),[z,M]=r.useState(""),[h,Y]=r.useState(""),[j,G]=r.useState(""),[N,U]=r.useState(!1),[g,f]=r.useState({open:!1,provider:""}),[B,S]=r.useState(!1),[k,A]=r.useState(null),P=varValues.cdn||"cdn.aznude.com",_=u("next"),R=_?`?next=${encodeURIComponent(_)}`:"",a=r.useCallback(n=>M(n),[]),w=r.useCallback(()=>M(""),[]);r.useEffect(()=>{u("verify")==="true"&&a("Your account has been successfully verified."),u("accountDeleted")==="true"&&a("Your account has been successfully deleted. We're sorry to let you go!"),u("accountDisabled")==="true"&&a("Your account has been successfully disabled. You can reactivate your account at any time by signing in with your email and password."),u("passwordChanged")==="true"&&a("Your password has been changed successfully. Please sign in to continue."),u("emailRecovered")==="true"&&a("Your email has been successfully recovered. We also sent a password change link to keep your account secure."),u("2FARecovered")==="true"&&a("2FA has been deactivated. For your security, we have logged you out. Please log in to continue.")}
1,[a]),r.useEffect(()=>{const n=Z(m,async s=>{try{c.addBreadcrumb({category:"auth",message:"onAuthStateChanged",level:"info"})}catch{}if(s){try{c.setUser({id:s.uid||void 0,email:s.email||void 0})}catch{}try{const t=await s.getIdTokenResult(!0);try{c.setContext("firebaseClaims",t?.claims||{})}catch{}if(t.claims.isBanned)return a("Your account has been permanently banned due to a violation of our Community Guidelines and Terms of Service."),localStorage.removeItem("azn_id"),ie(m)}catch(t){try{c.captureException(t,{tags:{area:"auth",op:"getIdTokenResult"}})}catch{}}try{const t=H(y,`users/${s.uid}`);let o=await E(y,s.uid,"azn_id");if(o===void 0){const i=Q(t,X(1));let l=(await O(i)).exists();for(let d=0;d<5&&!l;d++)await new Promise(J=>setTimeout(J,Math.pow(2,d)*1e3)),l=(await O(i)).exists();l&&(o=await E(y,s.uid,"azn_id"))}o&&localStorage.setItem("azn_id",o);const x=await K(s),C=await(await fetch(I.onLogin,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({idToken:x,dateTime:Math.floor(Date.now()/1e3)})})).json();if(!o){const i=await E(y,s.uid,"azn_id");i&&localStorage.setItem("azn_id",i)}if(C.status==="ok"){ge(s),a("Signin successful.");let i="/profile.html";try{const l=u("next");if(l){const d=new URL(l,window.location.origin);d.origin===window.location.origin&&(i=d.pathname+d.search+d.hash)}}catch{}await re(s),window.location.href=i}else console.error("[signin] onLogin returned non-ok:",C),a("An error occurred!")}catch(t){console.error("[signin] post-login-flow exception:",t);try{c.captureException(t,{tags:{area:"signin",op:"post-login-flow"}})}catch{}a(String(t))}}else{try{c.setUser(null)}catch{}T(!1)}});return()=>n()},[]);const $=async n=>{n.preventDefault();try{c.addBreadcrumb({category:"auth",message:"email-password submit",level:"info"})}catch{}w();let s="";if(h.length||(s+="Enter a valid email.<br>"),j.length||(s+="Enter a valid password.<br>"),h&&!h.includes("@")&&(s+="Please type an e-mail address.<br>"),s)return a(s);p(!0);try{await ee(m,h,j)}catch(t){try{c.captureException(t,{tags:{area:"auth",op:"signInWithEmailAndPassword"}})}catch{}if(t.code==="auth/internal-error"&&t.message.includes("PERMISSION_DENIED"))a("This account has been permanently banned due to violating Terms and Conditions");else if(t.code==="auth/user-disabled")L(h);else if(t.code==="auth/wrong-password"||t.code==="auth/invalid-login-credentials"||t.code==="auth/user-not-found")a("Invalid email or password.");else if(t.code==="auth/multi-factor-auth-required"){const o=W(m,t);A(o),S(!0)}else a(F[t.code]||t.message||"An unknown error occurred.")}finally{p(!1)}},q=async(n,s)=>{if(!k)return;const t=te.assertionForSignIn(k.hints[0].uid,n);try{await k.resolveSignIn(t),window.location.reload()}catch(o){try{c.captureException(o,{tags:{area:"auth",op:"mfa-resolve"}})}catch{}s("Invalid or expired OTP.")}},L=async n=>{try{const t=await(await fetch(I.reenableUser,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:n,website:document.querySelector('meta[name="website"]')?.getAttribute("content")||""})})).json();a(t.message||"Your account has been re-enabled. Please log in again.")}catch(s){try{c.captureException(s,{tags:{area:"api",op:"reenableUser"}})}catch{}a("Failed to re-enable account.")}},V=async()=>{const s=g.provider==="google"?new se:new ae;try{const o=(await oe(m,s)).user;try{c.setUser({id:o.uid||void 0,email:o.email||void 0})}catch{}const{token:x}=await o.getIdTokenResult(!0),D=await window.grecaptcha?.execute("6LeGdvEZAAAAAEW8ZT6hkZWJykDD4bHc9EY9Odob",{action:"submit"}),i=await(await fetch(I.signinWithSocial,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({idToken:x,response:D,website:document.querySelector('meta[name="website"]')?.getAttribute("content")})})).json();i.status==="ok"?await ne(m,i.token):i.status==="error"?a(i.errorMessage):a("Oops. Something went wrong.")}catch(t){try{c.captureException(t,{tags:{area:"auth",op:"social-signin"},extra:{provider:g.provider}})}catch{}if(t.code==="auth/internal-error"&&t.message.includes("PERMISSION_DENIED"))a("This account has been permanently banned due to violating Terms and Conditions");else if(t.code==="auth/user-disabled")L(h);else if(t.code==="auth/multi-factor-auth-required"){const o=W(m,t);A(o),S(!0)}else a(F[t.code]||t.message||"An unknown error occurred.")}
1finally{f({open:!1,provider:""})}};return e.jsxs(ce,{message:z,onDismissMessage:w,loading:v,children:[e.jsxs("div",{className:"card-dark",children:[e.jsx("h1",{className:"text-center mb-6 text-2xl font-bold",children:"SIGN IN"}),e.jsxs("form",{onSubmit:$,className:"max-w-[420px] mx-auto",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{htmlFor:"email",children:"Email"}),e.jsxs("div",{className:"relative mt-1",children:[e.jsx("div",{className:"icon-input-left",children:e.jsx(ue,{})}),e.jsx("input",{id:"email",name:"email",type:"email",className:"form-input-dark !pl-9",value:h,onChange:n=>Y(n.target.value),placeholder:"Email address",autoComplete:"username"})]})]}),e.jsxs("div",{className:"mb-5",children:[e.jsx("label",{htmlFor:"password",children:"Password"}),e.jsxs("div",{className:"relative mt-1",children:[e.jsx("div",{className:"icon-input-left",children:e.jsx(he,{})}),e.jsx("input",{id:"password",name:"password",type:N?"text":"password",className:"form-input-dark !pl-9 pr-10",value:j,onChange:n=>G(n.target.value),placeholder:"Your password",autoComplete:"current-password"}),e.jsx("button",{type:"button",className:"icon-input-right",onClick:()=>U(n=>!n),children:N?e.jsx(pe,{}):e.jsx(me,{})})]})]}),e.jsx("button",{type:"submit",className:"btn-primary-tw w-full",disabled:b,children:b?"Signing in...":"Sign in"}),e.jsxs("p",{className:"text-center text-sm mt-4",children:["Forget your password? ",e.jsx("a",{href:`/forgetpassword.html${R}`,children:"Reset now"}),e.jsx("br",{}),"Don't have an account? ",e.jsx("a",{href:`/signup.html${R}`,children:"Create one"})]})]}),e.jsx("div",{className:"auth-divider",children:e.jsx("span",{children:"OR"})}),e.jsxs("div",{className:"flex justify-center gap-4",children:[e.jsx("button",{type:"button",className:"social-btn-react",onClick:()=>{w(),f({open:!0,provider:"google"})},children:e.jsx("img",{src:`https://${P}/images/firebase/google.svg`,alt:"Google",width:"24",height:"24"})}),e.jsx("button",{type:"button",className:"social-btn-react",onClick:()=>{w(),f({open:!0,provider:"x"})},children:e.jsx("img",{src:`https://${P}/images/firebase/x-black.svg`,alt:"X",width:"24",height:"24"})})]})]}),e.jsx(le,{isOpen:g.open,provider:g.provider,onConfirm:V,onClose:()=>f({open:!1,provider:""})}),e.jsx(de,{isOpen:B,onConfirm:q,onClose:()=>S(!1)})]})}function Ce(){return e.jsx(fe,{})}export{Ce 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.