{"version":3,"file":"FormSuccess.BVlnVBK2.mjs","names":["useRef","__esmMin","init_ssg_sandbox_shims","window","de","init_jsx_runtime","J","c","init_npm_react_18_3_1","ce","useRouter","init_framer_DKtAEkcX","zRouteId","r","router","id","path","zGoThankYou","w","TY_PATH","withThankYouRedirect","box","v","props","el","mo","SUCCESS_SEL","Component","init_FormSuccess"],"sources":["https:/framerusercontent.com/modules/GNrh9XRoNsqG1zm1yr5y/J8pHAbSPUxeaZXhpUC7W/FormSuccess.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect,useRef,useState}from\"react\";import{useRouter}from\"framer\";// Keeps the submit button in its \"Success\" state once a form has been sent,\n// so the thank-you message stays visible instead of flashing for a moment.\nexport function withPersistentSuccess(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const box=useRef(null);const[sent,setSent]=useState(false);useEffect(()=>{const el=box.current;if(!el||sent)return;const check=()=>{if(el.querySelector('[data-framer-name=\"Success Message\"]'))setSent(true);};const mo=new MutationObserver(check);mo.observe(el,{childList:true,subtree:true,attributes:true});check();return()=>mo.disconnect();},[sent]);return /*#__PURE__*/_jsx(\"div\",{ref:box,style:{display:\"contents\"},children:/*#__PURE__*/_jsx(Component,{...props,ref:ref,variant:sent?\"Success\":props.variant,style:{...props.style,pointerEvents:sent?\"none\":props.style?.pointerEvents}})});});}// ---------- Thank-you redirect (all forms) ----------\nconst TY_PATH=\"/thank-you\";function zRouteId(router,path){try{const r=router&&router.routes;if(r){for(const id in r)if(r[id]&&r[id].path===path)return id;}}catch(e){}return null;}function zGoThankYou(router){const w=window;if(w.__zTyGone&&Date.now()-w.__zTyGone<4e3)return;w.__zTyGone=Date.now();w.__zTyPending=0;try{sessionStorage.setItem(\"zauber-ty-back\",window.location.pathname+window.location.search);if(router&&router.currentRouteId)sessionStorage.setItem(\"zauber-ty-back-route\",JSON.stringify({id:router.currentRouteId,vars:router.currentPathVariables||{}}));}catch(e){}setTimeout(()=>{const id=zRouteId(router,TY_PATH);if(id&&router&&typeof router.navigate===\"function\"){try{router.navigate(id);return;}catch(e){}}try{window.location.href=TY_PATH;}catch(e){}},250);}function zWatchFetch(){const w=window;if(w.__zTyFetch||typeof w.fetch!==\"function\")return;w.__zTyFetch=true;const orig=w.fetch.bind(w);w.fetch=(...args)=>{const p=orig(...args);try{const u=String(args[0]&&args[0].url||args[0]||\"\");const m=String(args[1]&&args[1].method||args[0]&&args[0].method||\"GET\").toUpperCase();if(w.__zTyPending&&m===\"POST\"&&/form/i.test(u))p.then(r=>{if(r&&r.ok&&w.__zTyPending)zGoThankYou(w.__zTyRouter);}).catch(()=>{});}catch(e){}return p;};}const SUCCESS_SEL='[data-framer-name=\"Success\"], [data-framer-name=\"Success Message\"], [data-framer-name=\"success\"]';// On a submit button: go to the thank-you page when the button reaches its Success state.\nexport function withThankYouRedirect(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const router=useRouter();const box=useRef(null);const v=String(props.variant||\"\");useEffect(()=>{window.__zTyRouter=router;},[router]);useEffect(()=>{if(/success|PmCCVl7Mi|IQPilkiW0|wmTn2beJk/i.test(v))zGoThankYou(router);},[v]);useEffect(()=>{const el=box.current;if(!el)return;const check=()=>{if(el.querySelector(SUCCESS_SEL))zGoThankYou(router);};const mo=new MutationObserver(check);mo.observe(el,{childList:true,subtree:true,attributes:true,attributeFilter:[\"data-framer-name\",\"class\"]});return()=>mo.disconnect();},[router]);return /*#__PURE__*/_jsx(\"div\",{ref:box,style:{display:\"contents\"},children:/*#__PURE__*/_jsx(Component,{...props,ref:ref})});});}// On a form frame: go to the thank-you page once the form has been sent successfully.\nexport function withFormThankYou(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const router=useRouter();const box=useRef(null);useEffect(()=>{const w=window;w.__zTyRouter=router;zWatchFetch();const el=box.current;if(!el)return;const onSubmit=()=>{w.__zTyPending=Date.now();};el.addEventListener(\"submit\",onSubmit,true);const check=()=>{if(w.__zTyPending&&el.querySelector(SUCCESS_SEL))zGoThankYou(router);};const mo=new MutationObserver(check);mo.observe(el,{childList:true,subtree:true,attributes:true,attributeFilter:[\"data-framer-name\",\"class\"]});return()=>{el.removeEventListener(\"submit\",onSubmit,true);mo.disconnect();};},[router]);return /*#__PURE__*/_jsx(\"div\",{ref:box,style:{display:\"contents\"},children:/*#__PURE__*/_jsx(Component,{...props,ref:ref})});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withFormThankYou\":{\"type\":\"reactHoc\",\"name\":\"withFormThankYou\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withThankYouRedirect\":{\"type\":\"reactHoc\",\"name\":\"withThankYouRedirect\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withPersistentSuccess\":{\"type\":\"reactHoc\",\"name\":\"withPersistentSuccess\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FormSuccess.map"],"mappings":"A,gMAG2B,SAASY,EAAS,EAAO,EAAK,CAAC,GAAG,CAAC,IAAMC,EAAEC,GAAQA,EAAO,OAAO,GAAGD,EAAO,KAAA,IAAME,KAAMF,EAAE,GAAGA,EAAEE,IAAKF,EAAEE,EAAG,CAAC,OAAOC,EAAK,OAAOD,CAAA,CAAI,MAAS,CAAC,CAAC,OAAO,IAAK,CAAC,SAASE,EAAY,EAAO,CAAC,IAAMC,EAAEf,EAAO,GAAG,IAAE,WAAW,KAAK,IAAI,EAAEe,EAAE,UAAU,KAAW,GAAE,UAAU,KAAK,IAAI,EAAE,EAAE,aAAa,EAAE,GAAG,CAAC,eAAe,QAAQ,iBAAiBf,EAAO,SAAS,SAASA,EAAO,SAAS,MAAM,EAAKW,GAAQA,EAAO,gBAAe,eAAe,QAAQ,uBAAuB,KAAK,UAAU,CAAC,GAAGA,EAAO,eAAe,KAAKA,EAAO,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAE,MAAS,CAAC,CAAC,eAAe,CAAC,IAAMC,EAAGH,EAASE,EAAOK,CAA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