1import{R as g,u as $,a as W,r as m,j as e,C as N,m as H,S as Y,B as b,L as y,f as J}from"./index-BTFpJOLG.js";import{c as K}from"./authcode-reveal-reauth-DaIsqXiZ.js";import{C as Q,b as V,c as X,d as Z,a as ee}from"./card-8AhoKK5G.js";import{I as C}from"./input-Di4d8hu6.js";import{L as P}from"./label-CEzSKDR9.js";import{P as A}from"./PasswordField-CNweWrgH.js";import{A as te}from"./arrow-right-dXpWAUbG.js";import"./eye-off-CszhKear.js";import"./eye-Cv0RCvR7.js";function L(t){if(typeof t!="string")return null;if(t==="/dashboard")return t;const r=/^\/dashboard\/domains\/([a-z0-9.-]+)(?:\?authcodeReauth=complete)?(?:#auth-code)?$/.exec(t);if(!r||r[0]!==t)return null;const s=r[1];if(s.length>253)return null;const i=s.split(".");return i.length<2||!i.every(l=>l.length<=63&&/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/.test(l))||!/[a-z]/.test(i[i.length-1])?null:t}var F={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},I=g.createContext&&g.createContext(F),re=["attr","size","title"];function ae(t,r){if(t==null)return{};var s=se(t,r),i,l;if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(t);for(l=0;l<d.length;l++)i=d[l],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(t,i)&&(s[i]=t[i])}return s}function se(t,r){if(t==null)return{};var s={};for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(r.indexOf(i)>=0)continue;s[i]=t[i]}return s}function w(){return w=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var s=arguments[r];for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(t[i]=s[i])}return t},w.apply(this,arguments)}function T(t,r){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);r&&(i=i.filter(function(l){return Object.getOwnPropertyDescriptor(t,l).enumerable})),s.push.apply(s,i)}return s}function v(t){for(var r=1;r<arguments.length;r++){var s=arguments[r]!=null?arguments[r]:{};r%2?T(Object(s),!0).forEach(function(i){ie(t,i,s[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):T(Object(s)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(s,i))})}return t}function ie(t,r,s){return r=ne(r),r in t?Object.defineProperty(t,r,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[r]=s,t}function ne(t){var r=oe(t,"string");return typeof r=="symbol"?r:r+""}function oe(t,r){if(typeof t!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var i=s.call(t,r);
1if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}function D(t){return t&&t.map((r,s)=>g.createElement(r.tag,v({key:s},r.attr),D(r.child)))}function M(t){return r=>g.createElement(le,w({attr:v({},t.attr)},r),D(t.child))}function le(t){var r=s=>{var{attr:i,size:l,title:d}=t,n=ae(t,re),p=l||s.size||"1em",u;return s.className&&(u=s.className),t.className&&(u=(u?u+" ":"")+t.className),g.createElement("svg",w({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},s.attr,i,n,{className:u,style:v(v({color:t.color||s.color},s.style),t.style),height:p,width:p,xmlns:"http://www.w3.org/2000/svg"}),d&&g.createElement("title",null,d),t.children)};return I!==void 0?g.createElement(I.Consumer,null,s=>r(s)):r(F)}function ce(t){return M({attr:{role:"img",viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"},child:[]}]})(t)}function de(t){return M({attr:{role:"img",viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M12.48 10.92v3.28h7.84c-.24 1.84-.853 3.187-1.787 4.133-1.147 1.147-2.933 2.4-6.053 2.4-4.827 0-8.6-3.893-8.6-8.72s3.773-8.72 8.6-8.72c2.6 0 4.507 1.027 5.907 2.347l2.307-2.307C18.747 1.44 16.133 0 12.48 0 5.867 0 .307 5.387.307 12s5.56 12 12.173 12c3.573 0 6.267-1.173 8.373-3.36 2.16-2.16 2.84-5.213 2.84-7.667 0-.76-.053-1.467-.173-2.053H12.48z"},child:[]}]})(t)}function je(){const{isAuthenticated:t,isLoading:r}=$(),{toast:s}=W(),i=window.location.pathname==="/register",l=m.useMemo(()=>{const a=new URLSearchParams(window.location.search).get("returnTo");return L(a)??"/dashboard"},[]),d=new URLSearchParams(window.location.search).get("reauth")==="authcode",[n,p]=m.useState(i?"register":"login"),[u,S]=m.useState(i),[x,z]=m.useState({email:!0,google:!1,github:!1,registrationEnabled:!0}),[O,k]=m.useState(!1),[E,f]=m.useState(void 0),[o,h]=m.useState({email:"",password:"",confirmPassword:"",firstName:"",lastName:""});m.useEffect(()=>{fetch("/api/auth/providers",{credentials:"include"}).then(a=>a.ok?a.json():null).then(a=>{a&&z({email:a.email??!0,google:a.google??!1,github:a.github??!1,registrationEnabled:a.registrationEnabled??!0})}).catch(()=>{})},[]);const B=m.useMemo(()=>n==="login"?"Sign in with email":"Create your account",[n]),j=(a,c)=>c?a!==c?"Passwords do not match":void 0:n==="register"?"Please confirm your password":void 0;if(r)return e.jsx("div",{className:"min-h-screen flex items-center justify-center font-mono bg-background",children:e.jsxs("div",{className:"text-center",children:[e.jsx(N,{className:"w-12 h-12 text-primary mx-auto mb-4 animate-pulse"}),e.jsx("p",{className:"text-muted-foreground",children:"Loading..."})]})});if(t&&!d)return e.jsx(H,{to:l});const R=a=>{if(!x[a]){s({title:"Provider not configured",description:`Set ${a.toUpperCase()} client credentials to enable this.`,variant:"destructive"});return}const c=encodeURIComponent(l);window.location.href=`/api/auth/oauth/${a}?returnTo=${c}`},_=a=>{h(c=>({...c,password:a})),n==="register"&&f(j(a,o.confirmPassword))},q=a=>{h(c=>({...c,confirmPassword:a})),f(j(o.password,a))},U=async a=>{if(a.preventDefault(),!o.email||!o.password){s({title:"Missing details",description:"Email and password are required.",variant:"destructive"});return}if(n==="register"){const c=j(o.password,o.confirmPassword);if(c){f(c);return}}k(!0);try{const c=n==="register"?{email:o.email,password:o.password,firstName:o.firstName||void 0,lastName:o.lastName||void 0}:{email:o.email,password:o.password},G=await(await J("POST",n==="register"?"/api/auth/register":"/api/auth/login",{...c,returnTo:l})).json();window.location.href=L(G.returnTo)??"/dashboard"}catch(c){s({title:"Authentication failed",className:"[&>div]:min-w-0 [&>div]:[overflow-wrap:anywhere]",description:c?.message||"Unable to sign in",variant:"destructive"})}finally{k(!1)}};return e.jsxs("div",{className:"min-h-screen flex font-mono text-sm selection:bg-primary selection:text-black",children:[e.jsxs("div",{className:"hidden lg:flex lg:w-1/2 bg-gradient-to-br from-primary/20 via-background to-background p-12 flex-col justify-between relative overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 opacity-20",children:e.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle at 30% 40%, rgba(38, 217, 98, 0.4) 0%, transparent 50%)"}})}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-12",children:[e.jsx("div",{className:"bg-primary/20 p-3 border border-primary/50",children:e.jsx(N,{className:"w-8 h-8 text-primary"})}),e.jsxs("div",{children:[e.jsxs("h1",{className:"font-bold text-2xl tracking-wider text-glow",children:["DOMAINSNIPER",e.jsx("span",{className:"text-primary",children:".NL"})]}),e.jsx("div",{className:"text-[10px] text-muted-foreground tracking-[0.2em] uppercase",children:"Premium Domain Marketplace"})]})]}),e.jsxs("div",{className:"max-w-md",children:[e.jsxs("h2",{className:"text-4xl font-bold tracking-tight mb-6 leading-tight","aria-label":"Your gateway to premium domains",children:["Your gateway to"," ",e.jsx("span",{className:"text-primary block",children:"premium domains"})]}),e.jsx("p",{className:"text-muted-foreground text-lg leading-relaxed",children:"Join to request verified upcoming .nl releases, track captures, and manage eligible verified domains in your account."})]})]}),e.jsx("div",{className:"relative",children:e.jsxs("div",{className:"flex items-center gap-6 text-xs text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Y,{className:"w-4 h-4 text-primary"}),e.jsx("span",{children:"Secure Authentication"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-2 h-2 bg-primary rounded-full animate-pulse"}),e.jsx("span",{children:"Approved Listings Only"})]})]})})]}),e.jsx("div",{className:"min-w-0 flex-1 flex items-center justify-center px-4 py-8 sm:px-8 bg-background",children:e.jsxs("div",{className:"min-w-0
1w-full max-w-md",children:[e.jsxs("div",{className:"lg:hidden flex items-center gap-3 mb-8 justify-center",children:[e.jsx("div",{className:"bg-primary/20 p-2 border border-primary/50",children:e.jsx(N,{className:"w-6 h-6 text-primary"})}),e.jsxs("h1",{className:"min-w-0 break-words font-bold text-base sm:text-xl tracking-wider",children:["DOMAINSNIPER",e.jsx("span",{className:"text-primary",children:".NL"})]})]}),e.jsxs(Q,{className:"terminal-card border-border/50",children:[e.jsxs(V,{className:"text-center pb-4",children:[e.jsx(X,{className:"text-2xl tracking-tight",children:n==="register"?"Create Your Account":d?"Confirm your sign-in":"Welcome Back"}),e.jsx(Z,{className:"text-muted-foreground",children:n==="register"?"Register to start tracking domain opportunities":d?"Sign in again to reveal your auth code. It remains protected until reveal succeeds.":"Sign in to access your dashboard"})]}),e.jsxs(ee,{className:"space-y-4",children:[d?e.jsx(b,{variant:"outline",className:"min-w-0 w-full min-h-11 whitespace-normal",onClick:()=>{K(window.sessionStorage);const a=new URL(l,window.location.origin);a.searchParams.delete("authcodeReauth"),window.location.href=a.pathname+a.hash},children:"Cancel and return to Auth Code"}):null,e.jsxs(b,{onClick:()=>R("google"),className:"min-w-0 w-full min-h-12 whitespace-normal text-base gap-3","data-testid":"button-login-google",disabled:!x.google,children:[e.jsx(de,{className:"w-5 h-5"}),"Continue with Google"]}),e.jsxs(b,{onClick:()=>R("github"),variant:"outline",className:"min-w-0 w-full min-h-12 whitespace-normal text-base gap-3 border-border hover:border-primary/50","data-testid":"button-login-github",disabled:!x.github,children:[e.jsx(ce,{className:"w-5 h-5"}),"Continue with GitHub"]}),e.jsxs("div",{className:"relative my-6",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("div",{className:"w-full border-t border-border"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-card px-2 text-muted-foreground",children:"or"})})]}),e.jsxs(b,{onClick:()=>S(a=>!a),variant:"secondary",className:"min-w-0 w-full min-h-12 whitespace-normal text-base gap-2","data-testid":"button-login-email",children:["Continue with Email",e.jsx(te,{className:"w-4 h-4"})]}),u&&e.jsxs("form",{onSubmit:U,className:"space-y-4 pt-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-muted-foreground",children:B}),e.jsxs("div",{className:"flex gap-2 text-[10px] uppercase tracking-widest",children:[e.jsx("button",{type:"button",className:n==="login"?"text-primary":"text-muted-foreground hover:text-primary",onClick:()=>{p("login"),f(void 0),h(a=>({...a,confirmPassword:""}))},children:"Sign in"}),x.registrationEnabled&&!d?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:"/"}),e.jsx("button",{type:"button",className:n==="register"?"text-primary":"text-muted-foreground hover:text-primary",onClick:()=>p("register"),children:"Register"})]}):null]})]}),n==="register"&&x.registrationEnabled&&e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(P,{htmlFor:"firstName",className:"text-[10px] uppercase tracking-widest text-muted-foreground",children:"First name"}),e.jsx(C,{id:"firstName",className:"mt-2 bg-black/40",value:o.firstName,onChange:a=>h({...o,firstName:a.target.value}),placeholder:"John"})]}),e.jsxs("div",{children:[e.jsx(P,{htmlFor:"lastName",className:"text-[10px] uppercase tracking-widest text-muted-foreground",children:"Last name"}),e.jsx(C,{id:"lastName",className:"mt-2 bg-black/40",value:o.lastName,onChange:a=>h({...o,lastName:a.target.value}),placeholder:"Doe"})]})]}),e.jsxs("div",{children:[e.jsx(P,{htmlFor:"email",className:"text-[10px] uppercase tracking-widest text-muted-foreground",children:"Email"}),e.jsx(C,{id:"email",type:"email",className:"mt-2 bg-black/40",value:o.email,onChange:a=>h({...o,email:a.target.value}),placeholder:"[email protected]"})]}),e.jsx(A,{label:"Password",id:"password",hint:n==="register"?"Minimum 8 characters":void 0,value:o.password,onChange:a=>_(a.target.value),placeholder:"Minimum 8 characters",autoComplete:n==="register"?"new-password":"current-password",minLength:8,required:!0}),n==="register"?e.jsx(A,{label:"Confirm password",id:"confirmPassword",error:E,value:o.confirmPassword,onChange:a=>q(a.target.value),placeholder:"Enter your password again",autoComplete:"new-password",minLength:8,required:!0}):e.jsx("div",{className:"text-right",children:e.jsx(y,{href:"/forgot-password",className:"text-xs text-primary hover:underline",children:"Forgot password?"})}),e.jsx(b,{type:"submit",className:"w-full",disabled:O||n==="register"&&!!E,children:O?"Please wait...":n==="register"?"Create account":"Sign in"})]}),e.jsxs("p",{className:"text-xs text-muted-foreground text-center pt-4",children:[n==="register"?"By creating an account":"By signing in",", you agree to our"," ",e.jsx(y,{href:"/terms",className:"text-primary hover:underline",children:"Terms of Service"})," ","and"," ",e.jsx(y,{href:"/privacy",className:"text-primary hover:underline",children:"Privacy Policy"}),"."]})]})]}),e.jsx("p",{className:"text-center text-xs text-muted-foreground mt-6",children:x.registrationEnabled&&!d?e.jsxs(e.Fragment,{children:[n==="register"?"Already have an account?":"Don't have an account?"," ",e.jsx("button",{onClick:()=>{S(!0),p(n==="register"?"login":"register"),f(void 0),h(a=>({...a,confirmPassword:""}))},className:"text-primary hover:underline",children:n==="register"?"Sign in":"Create one for free"})]}):e.jsx(e.Fragment,{children:d?"Confirm your existing account to continue."
1:"Registration is currently unavailable."})})]})})]})}export{je 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.