1import{u as f,r,e as x,j as e,au as b,B as v,L as j,g as m,f as w}from"./index-O_T_ntd1.js";import{S as y}from"./switch-GEQsN4cF.js";import"./index-BNYDqDYc.js";const k="https://kvrwtxjayijgkamfnavy.supabase.co",u=`${k}/functions/v1/email-unsubscribe`,N=w({en:{prefs:{onboarding:{label:"Getting-started emails",description:"A few short emails in your first week, helping you set up your AI-self."},digest:{label:"Weekly digest",description:"Once it launches: your memory's week in new patterns, recalls and documents."},product_news:{label:"Product tips & news",description:"Occasional notes on new capabilities. Turning this on requires signing in (Settings)."}},saved:"Saved. This takes effect immediately.",saveFailed:"Couldn't save that, please try again.",invalidTitle:"That link doesn't work.",invalidBodyA:"The preferences link in your email may be incomplete. You can also manage email preferences in Settings after signing in, or mail ",invalidBodyB:" and we'll sort it out.",signIn:"Sign in",titleA:"Email ",titleB:"preferences",intro:"Changes apply immediately. Sign-in emails always keep working, they're how you access your account.",unsubscribeAll:"Unsubscribe from everything"},nl:{prefs:{onboarding:{label:"E-mails om te beginnen",description:"Een paar korte e-mails in je eerste week, die je helpen je AI-ik op te zetten."},digest:{label:"Wekelijks overzicht",description:"Zodra het er is: wat je geheugen die week leerde aan nieuwe patronen, herinneringen en documenten."},product_news:{label:"Producttips en nieuws",description:"Af en toe een bericht over nieuwe mogelijkheden. Aanzetten kan alleen als je bent ingelogd (Instellingen)."}},saved:"Opgeslagen. Dit geldt meteen.",saveFailed:"Opslaan is niet gelukt, probeer het opnieuw.",invalidTitle:"Deze link werkt niet.",invalidBodyA:"De link in je e-mail is misschien niet compleet. Je kunt je e-mailvoorkeuren ook aanpassen bij Instellingen als je bent ingelogd, of mail ",invalidBodyB:", dan lossen we het op.",signIn:"Inloggen",titleA:"E-mail",titleB:"voorkeuren",intro:"Wijzigingen gelden meteen. Inlogmails blijven altijd werken, daarmee kom je in je account.",unsubscribeAll:"Meld je af voor alles"}}),A=["onboarding","digest","product_news"],I=()=>{const[g]=f(),l=g.get("token")??"",[t,d]=r.useState(null),[o,a]=r.useState("loading"),n=x(N);r.useEffect(()=>{if(!l){a("invalid");return}fetch(`${u}?token=${encodeURIComponent(l)}`).then(async s=>{if(!s.ok)throw new Error("invalid");d(await s.json()),a("ready")}).catch(()=>a("invalid"))},[l]);const c=async s=>{a("saving");try{const i=await fetch(`${u}?token=${encodeURIComponent(l)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prefs:s})});if(!i.ok)throw new Error("failed");d(await i.json()),m.success(n.saved)}catch{m.error(n.saveFailed)}finally{a("ready")}};return e.jsxs("div",{className:"min-h-screen bg-surface flex items-center justify-center px-6 relative overflow-hidden",children:[e.jsx("div",{className:"absolute top-1/4 left-1/4 w-96 h-96 rounded-full bg-lavender/5 blur-[120px]"}),e.jsxs("div",{className:"w-full max-w-md relative z-10",children:[e.jsx("div",{className:"flex items-center justify-center gap-2 mb-8",children:e.jsx("img",{src:b,alt:"Memnar",className:"w-10 h-10 rounded-lg"})}),e.jsx("div",{className:"glass rounded-3xl p-8",children:o==="invalid"?e.jsxs("div",{className:"text-center py-2",children:[e.jsx("h1",{className:"font-headline text-2xl text-on-surface mb-3",children:n.invalidTitle}),e.jsxs("p",{className:"text-on-surface/60 font-body text-sm mb-6",children:[n.invalidBodyA,e.jsx("a",{href:"mailto:[email protected]",className:"text-lavender hover:underline",children:"[email protected]"}),n.invalidBodyB]}),e.jsx(v,{asChild:!0,size:"lg",className:"w-full",children:e.jsx(j,{to:"/login",children:n.signIn})})]}):o==="loading"?e.jsx("div",{className:"animate-soft-pulse h-40 bg-surface-mid rounded-xl"}):e.jsxs(e.Fragment,{children:[e.jsxs("h1",{className:"font-headline text-2xl text-on-surface mb-2",children:[n.titleA,e.jsx("span",{className:"text-lavender",children:n.titleB})]}),e.jsx("p",{className:"text-on-surface-muted font-body text-sm mb-6",children:n.intro}),e.jsx("div",{className:"space-y-4",children:A.map(s=>{const{label:i,description:h}=n.prefs[s];return e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-body text-sm text-on-surface",children:i}),e.jsx("p",{className:"font-body text-xs text-on-surface-muted leading-relaxed",children:h})]}),e.jsx(y,{checked:(t==null?void 0:t[s])??!1,onCheckedChange:p=>c({[s]:p}),disabled:o==="saving"||s==="product_news"&&!(t!=null&&t.product_news),"aria-label":i})]},s)})}),e.jsx("button",{onClick:()=>c({onboarding:!1,digest:!1,product_news:!1}),disabled:o==="saving",className:"mt-6 w-full text-sm text-on-surface-muted hover:text-lavender font-body transition-colors",children:n.unsubscribeAll})]})})]})]})};export{I 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.