{"version":3,"file":"FormNameOverrides.B83Il6CT.mjs","names":[],"sources":["https:/framerusercontent.com/modules/wOtn4aFM1rp6uXBxvadE/yOKv75JrrDgr55mAXPjD/FormNameOverrides.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect}from\"react\";const STORAGE_KEY=\"rfb_nome_encoded\";const THANK_YOU_PATH=\"/rfb-obrigado\";function readAndEncodeNomeFromForm(formElement){if(!formElement)return\"\";const input=formElement.querySelector('input[name=\"Nome\"], textarea[name=\"Nome\"]');if(!input)return\"\";const value=`${input.value??\"\"}`.trim();if(!value)return\"\";return encodeURIComponent(value);}function persistEncodedName(encodedName){if(!encodedName)return;if(typeof window===\"undefined\")return;try{window.sessionStorage.setItem(STORAGE_KEY,encodedName);}catch(_error){// ignore storage failures\n}}export function withCarryNameToThankYou(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const handleSubmit=event=>{const encodedName=readAndEncodeNomeFromForm(event.currentTarget);persistEncodedName(encodedName);if(typeof window!==\"undefined\"&&encodedName){window.setTimeout(()=>{if(typeof window===\"undefined\")return;const{pathname,search}=window.location;if(pathname!==THANK_YOU_PATH)return;const params=new URLSearchParams(search);if(params.get(\"nome\"))return;window.location.replace(`${THANK_YOU_PATH}?nome=${encodedName}`);},700);}if(typeof props.onSubmit===\"function\"){props.onSubmit(event);}};return /*#__PURE__*/_jsx(Component,{ref:ref,...props,onSubmit:handleSubmit});});}export function withEnsureNomeQueryParam(Component){return /*#__PURE__*/forwardRef((props,ref)=>{useEffect(()=>{if(typeof window===\"undefined\")return;if(window.location.pathname!==THANK_YOU_PATH)return;const params=new URLSearchParams(window.location.search);if(params.get(\"nome\"))return;let encodedName=\"\";try{encodedName=window.sessionStorage.getItem(STORAGE_KEY)||\"\";}catch(_error){encodedName=\"\";}if(!encodedName)return;const existingQuery=window.location.search.replace(/^\\?/,\"\");const separator=existingQuery.length>0?\"&\":\"\";const nextUrl=`${window.location.pathname}?${existingQuery}${separator}nome=${encodedName}${window.location.hash||\"\"}`;window.history.replaceState({},\"\",nextUrl);},[]);return /*#__PURE__*/_jsx(Component,{ref:ref,...props});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withEnsureNomeQueryParam\":{\"type\":\"reactHoc\",\"name\":\"withEnsureNomeQueryParam\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCarryNameToThankYou\":{\"type\":\"reactHoc\",\"name\":\"withCarryNameToThankYou\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FormNameOverrides.map"],"mappings":"kIAA6J,SAAS,EAA0B,EAAY,CAAC,GAAG,CAAC,EAAY,MAAM,GAAG,IAAM,EAAM,EAAY,cAAc,4CAA4C,CAAC,GAAG,CAAC,EAAM,MAAM,GAAG,IAAM,EAAM,GAAG,EAAM,OAAO,KAAK,MAAM,CAAoB,OAAf,EAAsB,mBAAmB,EAAM,CAAnC,GAAqC,SAAS,EAAmB,EAAY,CAAK,MAA6B,IAAS,OAAmB,GAAG,CAAC,EAAO,eAAe,QAAQ,EAAY,EAAY,MAAe,GACtlB,SAAgB,EAAwB,EAAU,CAAC,OAAoB,GAAY,EAAM,IAAM,CAAC,IAAM,EAAa,GAAO,CAAC,IAAM,EAAY,EAA0B,EAAM,cAAc,CAAC,EAAmB,EAAY,CAAW,IAAS,QAAa,GAAa,EAAO,eAAe,CAAC,GAAU,IAAS,OAAY,OAAO,GAAK,CAAC,WAAS,UAAQ,EAAO,SAAY,IAAW,IAAmC,IAAI,gBAAgB,EAAO,CAAW,IAAI,OAAO,EAAQ,EAAO,SAAS,QAAQ,GAAG,EAAe,QAAQ,IAAc,GAAG,IAAI,CAAK,OAAO,EAAM,UAAW,YAAY,EAAM,SAAS,EAAM,EAAI,OAAoB,EAAK,EAAU,CAAK,MAAI,GAAG,EAAM,SAAS,EAAa,CAAC,EAAG,CAAE,SAAgB,EAAyB,EAAU,CAAC,OAAoB,GAAY,EAAM,K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