{"version":3,"file":"Auth.D0NOnzEd.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/yVZFphePKvLtsqB8zode/ajIrdgwD47YOm8y0Uoj2/Auth.js"],"sourcesContent":["// Planta template · Log in / Sign up / Forgot password form behaviour (validation, redirect). Edit: PORTAL constant (redirect target).\n// Planta — Auth forms (Task 16: /login, /signup, /forgot-password). Static template pages: nothing is sent anywhere.\n// Same validation look as /contact: the browser bubble is replaced by each field's \"Error\" row (Alert icon + message),\n// aria-invalid + aria-describedby, focus moves to the first invalid field, typing clears the error.\n//   withAuthLogin / withAuthSignup → the <form> frame. A valid submit goes to the member portal (/portal).\n//   withAuthReset → the <form> frame. A valid submit shows the \"Sent\" row (\"Check your inbox…\", role=status) instead\n//                   of navigating; the email field row stays.\n// The submit control is a Form Button (the form's only <button>); a click on it calls form.requestSubmit(), so the\n// browser's own required/email checks run whatever type Framer renders. Inputs get the Text Field focus halo. CSS is raw (dangerouslySetInnerHTML).\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";// Member portal (Task 17).\nconst PORTAL=\"/portal\";const ACCENT=\"var(--token-cbb839e3-d4da-45f0-b67b-1b3aaa4208bd, #2F4BFF)\"// border/accent\n;const RING=\"var(--token-62dee98a-3547-46f0-9797-2fb847ed0ddb, #2F4BFF)\"// focus/ring\n;const PAGE=\"var(--token-d19efcd4-2bb2-4a29-a780-c7096b882460, #F5F3EE)\"// bg/page\n;const ERROR=\"var(--token-42ada93e-ffbb-4f5f-9145-ab51fbf4b883, #C4320A)\"// border/error\n;const CSS=`\n[data-auth] label [data-framer-name=\"Error\"]{display:none!important}\n[data-auth] label[data-invalid] [data-framer-name=\"Error\"]{display:flex!important}\n[data-auth] label[data-invalid] :is(input,select,textarea){box-shadow:inset 0 0 0 1px ${ERROR}!important;border-color:${ERROR}!important}\n[data-auth] label :is(input:not([type=checkbox]),select,textarea):focus{outline:none!important;box-shadow:inset 0 0 0 1.5px ${ACCENT},0 0 0 2px ${PAGE},0 0 0 6px ${RING}!important}\n[data-auth] label[data-invalid] :is(input,select,textarea):focus{box-shadow:inset 0 0 0 1.5px ${ERROR},0 0 0 2px ${PAGE},0 0 0 6px ${ERROR}!important}\n[data-auth] [data-framer-name=\"Sent\"]{display:none!important}\n[data-auth][data-sent] [data-framer-name=\"Sent\"]{display:flex!important}\n`;function authForm(kind){return function(Component){return function AuthForm(props){const ref=useRef(null);const firstInvalid=useRef(false);const[sent,setSent]=useState(false);const form=()=>ref.current?.querySelector(\"form\");useEffect(()=>{const f=form();if(!f)return;f.noValidate=false;f.querySelectorAll(\"label\").forEach((l,i)=>{const err=l.querySelector('[data-framer-name=\"Error\"]');const field=l.querySelector(\"input,select,textarea\");if(err&&field){err.id=err.id||`auth-${kind}-error-${i}`;field.setAttribute(\"aria-describedby\",err.id);}});const sentRow=f.querySelector('[data-framer-name=\"Sent\"]');sentRow?.setAttribute(\"role\",\"status\");},[]);const clear=e=>{const field=e.target;if(field?.checkValidity?.()){field.closest(\"label\")?.removeAttribute(\"data-invalid\");field.removeAttribute(\"aria-invalid\");}};return /*#__PURE__*/_jsxs(\"div\",{ref:ref,style:{display:\"contents\"},children:[/*#__PURE__*/_jsx(\"style\",{dangerouslySetInnerHTML:{__html:CSS}}),/*#__PURE__*/_jsx(Component,{...props,\"data-auth\":kind,\"data-sent\":sent?\"\":undefined,onClickCapture:e=>{const submit=e.target.closest(\"button\");const f=form();if(submit&&f){e.preventDefault();f.requestSubmit();}},onSubmitCapture:e=>{e.preventDefault();firstInvalid.current=false;if(kind===\"reset\")setSent(true);else window.location.assign(PORTAL);},onInvalidCapture:e=>{e.preventDefault()// no browser bubble — our error row instead\n;const field=e.target;field.closest(\"label\")?.setAttribute(\"data-invalid\",\"\");field.setAttribute(\"aria-invalid\",\"true\");if(!firstInvalid.current){// Safari only fires \"invalid\" for the first bad field — mark every invalid field at once\nfield.closest(\"form\")?.querySelectorAll(\"input,select,textarea\").forEach(el=>{if(el.willValidate&&!el.checkValidity()){el.closest(\"label\")?.setAttribute(\"data-invalid\",\"\");el.setAttribute(\"aria-invalid\",\"true\");}});firstInvalid.current=true;window.setTimeout(()=>{field.focus?.();firstInvalid.current=false;},0);}},onInputCapture:clear,onChangeCapture:clear})]});};};}export function withAuthLogin(Component){return authForm(\"login\")(Component);}export function withAuthSignup(Component){return authForm(\"signup\")(Component);}export function withAuthReset(Component){return authForm(\"reset\")(Component);}\nexport const __FramerMetadata__ = {\"exports\":{\"withAuthLogin\":{\"type\":\"reactHoc\",\"name\":\"withAuthLogin\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withAuthSignup\":{\"type\":\"reactHoc\",\"name\":\"withAuthSignup\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withAuthReset\":{\"type\":\"reactHoc\",\"name\":\"withAuthReset\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Auth.map"],"mappings":"2IAsBE,SAAS,EAAS,EAAK,CAAC,OAAO,SAAS,EAAU,CAAC,OAAO,SAAkB,EAAM,CAAC,IAAM,EAAIA,EAAO,IAAI,EAAQ,EAAaA,EAAO,EAAK,EAAO,CAAC,EAAK,GAASC,EAAS,EAAK,EAAQ,MAAS,EAAI,SAAS,cAAc,MAAM,EAAE,MAAc,CAAC,IAAM,EAAE,EAAK,EAAM,IAAS,EAAE,WAAW,GAAM,EAAE,iBAAiB,OAAO,CAAC,CAAC,SAAS,EAAE,IAAI,CAAC,IAAM,EAAI,EAAE,cAAc,4BAA4B,EAAQ,EAAM,EAAE,cAAc,uBAAuB,EAAK,GAAK,IAAO,EAAI,GAAG,EAAI,IAAI,QAAQ,EAAK,SAAS,IAAI,EAAM,aAAa,mBAAmB,EAAI,EAAE,EAAG,CAAC,EAA6D,EAA3C,cAAc,2BAAmC,CAAC,EAAE,aAAa,OAAO,QAAQ,EAAE,EAAE,CAAC,CAAC,EAAE,IAAM,EAAM,GAAG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