;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="3362e95c-5866-cf54-c614-62caa678d1f5")}catch(e){}}(); (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,586906,e=>{"use strict";var r=e.i(319181),t=e.i(595052),i=e.i(121169),a=e.i(638961),n=e.i(190642);function s(){let[e,s]=(0,t.useState)(""),[c,o]=(0,t.useState)(""),[l,d]=(0,t.useState)(""),[u,m]=(0,t.useState)(""),[h,b]=(0,t.useState)(!1),[p,g]=(0,t.useState)(""),f=(0,a.useSearchParams)(),x=f.get("tier"),y=(f.get("currency")||"gbp").toLowerCase();async function j(r){r.preventDefault(),b(!0),m("");try{let r=await fetch("/api/auth/register",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,email:c,password:l})}),t=await r.json();if(!r.ok){m(t.error||"Registration failed."),b(!1);return}let a=await (0,i.signIn)("credentials",{email:c,password:l,redirect:!1});if(a?.error)m("Account created but sign-in failed. Try logging in."),b(!1);else{fetch("/api/track-event",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({event:"register_completed"})}).catch(()=>{}),b(!1);let e=x||"free";if("free"===e){g(`Account created! Check ${c} to verify your email. Taking you to the app...`),window.location.href="/app/hooks";return}g(`Account created! Check ${c} to verify your email. Redirecting to checkout...`);let r=await fetch("/api/stripe/checkout",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tierId:e,currency:y})}),t=await r.json();t.url?window.location.href=t.url:window.location.href="/app"}}catch{m("Something went wrong. Please try again."),b(!1)}}return(0,r.jsxs)("div",{className:"w-full max-w-sm",children:[(0,r.jsx)("h1",{className:"text-2xl font-bold text-zinc-100 text-center mb-2",children:"Create your account"}),(0,r.jsxs)("p",{className:"text-zinc-500 text-center text-sm mb-8",children:["Already have an account?"," ",(0,r.jsx)(n.default,{href:"/login",className:"text-amber-400 hover:underline",children:"Sign in"})]}),u&&(0,r.jsx)("div",{className:"bg-red-900/30 border border-red-800 text-red-300 px-4 py-3 rounded-lg mb-4 text-sm",children:u}),p&&(0,r.jsx)("div",{className:"bg-amber-900/30 border border-amber-800 text-amber-200 px-4 py-3 rounded-lg mb-4 text-sm",children:p}),(0,r.jsxs)("form",{onSubmit:j,className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"register-name",className:"block text-sm text-zinc-400 mb-1.5",children:"Name"}),(0,r.jsx)("input",{id:"register-name",type:"text",value:e,onChange:e=>s(e.target.value),className:"w-full bg-zinc-900 border border-zinc-700 rounded-lg px-4 py-2.5 text-zinc-100 placeholder-zinc-600 focus:outline-none focus:border-amber-500 focus:ring-1 focus:ring-amber-500/30",placeholder:"Jane Doe"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"register-email",className:"block text-sm text-zinc-400 mb-1.5",children:"Email"}),(0,r.jsx)("input",{id:"register-email",type:"email",value:c,onChange:e=>o(e.target.value),required:!0,"aria-required":"true",className:"w-full bg-zinc-900 border border-zinc-700 rounded-lg px-4 py-2.5 text-zinc-100 placeholder-zinc-600 focus:outline-none focus:border-amber-500 focus:ring-1 focus:ring-amber-500/30",placeholder:"you@company.com"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"register-password",className:"block text-sm text-zinc-400 mb-1.5",children:"Password"}),(0,r.jsx)("input",{id:"register-password",type:"password",value:l,onChange:e=>d(e.target.value),required:!0,"aria-required":"true",minLength:8,className:"w-full bg-zinc-900 border border-zinc-700 rounded-lg px-4 py-2.5 text-zinc-100 placeholder-zinc-600 focus:outline-none focus:border-amber-500 focus:ring-1 focus:ring-amber-500/30",placeholder:"Min 8 characters"})]}),(0,r.jsx)("button",{type:"submit",disabled:h,className:"w-full bg-amber-600 hover:bg-amber-500 disabled:opacity-50 text-white font-medium py-2.5 rounded-lg transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-amber-500 focus-visible:ring-offset-2 focus-visible:ring-offset-[#0a0a0b]",children:h?"Creating account...":"Create account"}),(0,r.jsx)("p",{className:"text-xs text-zinc-600 text-center",children:x&&"free"!==x?`You'll be redirected to checkout for the ${x.charAt(0).toUpperCase()+x.slice(1)} plan.`:(0,r.jsxs)(r.Fragment,{children:["Free — 10 hooks, no card required. ",(0,r.jsx)(n.default,{href:"/#pricing",className:"text-amber-400 hover:underline",children:"View paid plans"}),"."]})})]})]})}function c(){return(0,r.jsx)("div",{className:"min-h-screen bg-[#0a0a0b] flex items-center justify-center px-4",children:(0,r.jsx)(t.Suspense,{children:(0,r.jsx)(s,{})})})}e.s(["default",()=>c])}]); //# debugId=3362e95c-5866-cf54-c614-62caa678d1f5 //# sourceMappingURL=30dd1436da2be4e6.js.map