1import{g as x,p as E,r as a,j as e,P as M,c as C,L as j}from"./index-vt5iT7Dr.js";import{s as D}from"./client-DCjqBwWL.js";import{C as R}from"./circle-check-CESpRKHc.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const g=x("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** 7 * @license lucide-react v0.462.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const L=x("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/** 12 * @license lucide-react v0.462.0 - ISC 13 * 14 * This source code is licensed under the ISC license. 15 * See the LICENSE file in the root directory of this source tree. 16 */const P=x("UserMinus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]),W=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,w={revoked:"Your previous Brain link was revoked. Drop your email below and we'll send a fresh one - or tell you why we can't.",expired:"Your previous Brain link has expired. Drop your email below and we'll send a fresh one.",not_found:"We couldn't match your previous Brain link. Drop your email below and we'll send a fresh one - or tell you why we can't.",malformed:"That Brain link looked malformed. Drop your email below and we'll send a fresh one."},q=()=>{const[s]=E(),t=s.get("reason")??null,[l,k]=a.useState(""),[u,v]=a.useState(""),[h,r]=a.useState(!1),[m,p]=a.useState(null),[f,o]=a.useState(null),b=l.trim().toLowerCase(),y=W.test(b)&&!h;a.useEffect(()=>{document.title="Resend my Brain link · Deepgrain"},[]);const N=a.useMemo(()=>t&&w[t]?w[t]:"Already signed up but can't access the Brain? Drop your email below - we'll send a fresh link, or tell you exactly why we can't.",[t]),S=async i=>{if(i.preventDefault(),!!y){r(!0),o(null);try{const{data:d,error:B}=await D.functions.invoke("resend-brain-link",{body:{email:b,website:u}});if(B){const n=d;if((n==null?void 0:n.status)==="rate_limited"){p({status:"rate_limited"}),r(!1);return}o((n==null?void 0:n.error)??"Something went wrong. Please try again."),r(!1);return}const c=d;if(!(c!=null&&c.status)){o("Something went wrong. Please try again."),r(!1);return}p(c),r(!1)}catch(d){console.error("Brain resend failed",d),o("Something went wrong. Please try again."),r(!1)}}};return e.jsxs("main",{className:"min-h-screen bg-walnut text-cream",children:[e.jsx(M,{title:"Resend my Brain link · Deepgrain",description:"Already signed up to the People Ops AI Brain but can't access it? Drop your email below and we'll send a fresh link.",path:"/brain/resend",noindex:!0}),e.jsxs("section",{className:"max-w-2xl mx-auto px-6 py-24 md:py-32",children:[e.jsx("p",{className:"font-sans uppercase text-[11px] text-brass mb-6",style:{letterSpacing:"0.18em"},children:"The Brain · Resend link"}),e.jsx("h1",{className:"font-display text-4xl md:text-5xl leading-tight text-cream",children:"Resend my Brain link."}),e.jsx("p",{className:"mt-6 text-base md:text-lg leading-relaxed text-cream/75",children:N}),!m&&e.jsxs("form",{onSubmit:S,className:"mt-10","aria-label":"Resend Brain link",noValidate:!0,children:[e.jsx("label",{htmlFor:"resend-email",className:"sr-only",children:"Email"}),e.jsx("input",{id:"resend-email",type:"email",autoComplete:"email",required:!0,maxLength:320,value:l,onChange:i=>k(i.target.value),placeholder:"[email protected]",className:"w-full bg-transparent border-0 border-b border-cream/30 focus:border-cream/80 py-3 px-1 font-sans text-base text-cream placeholder:text-cream/40 focus:outline-none transition-colors"}),e.jsxs("div",{"aria-hidden":"true",style:{position:"absolute",left:"-10000px",top:"auto",width:"1px",height:"1px",overflow:"hidden"},children:[e.jsx("label",{htmlFor:"resend-website",children:"Website"}),e.jsx("input",{id:"resend-website",type:"text",tabIndex:-1,autoComplete:"off",value:u,onChange:i=>v(i.target.value)})]}),e.jsxs("div",{className:"mt-6 flex flex-wrap items-center gap-4",children:[e.jsx("button",{type:"submit",disabled:!y,className:C("font-sans uppercase text-[11px] px-7 py-3 rounded-full border border-brass text-brass transition-colors","hover:bg-brass hover:text-walnut","disabled:opacity-50 disabled:cursor-not-allowed"),style:{letterSpacing:"0.16em"},children:h?"Sendingâ¦":"Send me a fresh link â"}),e.jsx(j,{to:"/brain",className:"text-xs underline underline-offset-2 text-cream/55 hover:text-cream/80 transition-colors",children:"Back to /brain"})]}),f&&e.jsx("p",{role:"alert",className:"mt-4 text-sm text-brass",children:f})]}),m&&e.jsx(A,{result:m})]})]})},A=({result:s})=>{const t=s.supportEmail??"[email protected]";if(s.status==="sent")return e.jsxs("div",{role:"status","aria-live":"polite",className:"mt-10 flex items-start gap-4",children:[e.jsx(R,{className:"h-7 w-7 mt-1 flex-shrink-0 text-brass"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-display text-2xl md:text-3xl leading-snug text-cream",children:"Fresh link on its way."}),e.jsx("p",{className:"mt-3 text-sm leading-relaxed text-cream/70",children:"We've emailed a new Brain link to your address. It should arrive within a minute. The new link replaces any earlier ones - older links from us no longer work."})]})]});if(s.status==="unsubscribed"){const l=s.since?new Date(s.since).toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"}):null;return e.jsxs("div",{role:"status","aria-live":"polite",className:"mt-10 flex items-start gap-4",children:[e.jsx(P,{className:"h-7 w-7 mt-1 flex-shrink-0 text-brass"}),e.jsxs("div",{children:[e.jsxs("p",{className:"font-display text-2xl md:text-3xl leading-snug text-cream",children:["This address unsubscribed",l?` on ${l}`:"","."]}),e.jsxs("p",{className:"mt-3 text-sm leading-relaxed text-cream/70",children:["We can't send Brain links to unsubscribed addresses - that's the whole point of unsubscribing. If you want back in, reply to"," ",e.jsx("a",{href:`mailto:${t}`,className:"underline underline-offset-2 text-brass hover:text-cream",children:t})," ","from this email and we'll re-enable it manually."]})]})]})}return s.status==="suppressed"?e.jsxs("div",{role:"status","aria-live":"polite",className:"mt-10 flex items-start gap-4",children:[e.jsx(g,{className:"h-7 w-7 mt-1 flex-shrink-0 text-brass"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-display text-2xl md:text-3xl leading-snug text-cream",children:"Mail to this address is being blocked."}),e.jsxs("p",{className:"mt-3 text-sm leading-relaxed text-cream/70",children:["Either earlier emails to you bounced, or one of them got marked as spam, so our email provider is blocking further sends to this address",s.reason?` (reason on file: ${s.reason})`:"",". Try a different email - or reply to"," ",e.jsx("a",{href:`mailto:${t}`,className:"underline underline-offset-2 text-brass hover:text-cream",children:t})," ","from a working address and we'll sort it out."]})]})]}):s.status==="not_found"?e.jsxs("div",{role:"status","aria-live":"polite",className:"mt-10 flex items-start gap-4",children:[e.jsx(L,{className:"h-7 w-7 mt-1 flex-shrink-0 text-brass"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-display text-2xl md:text-3xl leading-snug text-cream",children:"We don't have a record of this address."}),e.jsx("p",{className:"mt-3 text-sm leading-relaxed text-cream/70",children:"You may have signed up with a different email - try that one. Or, if this is your first time, sign up below."}),e.jsx(j,{to:"/brain",className:"mt-5 inline-flex items-center font-sans uppercase text-[11px] px-5 py-2.5 rounded-full border border-brass text-brass hover:bg-brass hover:text-walnut transition-colors",style:{letterSpacing:"0.16em"},children:"Sign up for the Brain â"})]})]}):e.jsxs("div",{role:"status","aria-live":"polite",className:"mt-10 flex items-start gap-4",children:[e.jsx(g,{className:"h-7 w-7 mt-1 flex-shrink-0 text-brass"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-display text-2xl md:text-3xl leading-snug text-cream",children:"Too many requests."}),e.jsx("p",{className:"mt-3 text-sm leading-relaxed text-cream/70",children:"Wait a minute and try again."})]})]})};export{q 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.