{"version":3,"file":"TimedNativePopup.CyDIYrJm.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/Mi2mlbQRuZ9J5Sy5WDAI/DugJ7QUtsMhyYeMJxpdO/TimedNativePopup.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect,useRef}from\"react\";import{RenderTarget,isStaticRenderer}from\"framer\";const POPUP_DELAY_MS=1e4;const CLAIM_DELAY_MS=100;const RUN_ONCE_KEY=\"__withTimedNativePopup_hasRun__\";const NATIVE_SUBMIT_DELAY_MS=0;const NATIVE_SUBMIT_LOCK_MS=1e3;const CLAIM_FORM_AUTOFILL_STYLE_ID=\"claim-form-dark-autofill-style\";const CLAIM_FORM_AUTOFILL_REFCOUNT_KEY=\"__claimFormAutofillStyleRefCount__\";function canRunInBrowserRuntime(){if(typeof window===\"undefined\"||typeof document===\"undefined\"){return false;}if(isStaticRenderer()){return false;}const target=RenderTarget.current();if(target===RenderTarget.canvas||target===RenderTarget.export||target===RenderTarget.thumbnail){return false;}return true;}function findClosestFormElement(source){if(!source||typeof source!==\"object\"){return null;}const directElement=source instanceof HTMLElement?source:source&&\"currentTarget\"in source?source.currentTarget:\"target\"in source?source.target:null;if(directElement&&typeof directElement.closest===\"function\"){return directElement.closest(\"form\");}return null;}export function withTimedNativePopup(Component){return /*#__PURE__*/forwardRef((props,ref)=>{useEffect(()=>{if(typeof window===\"undefined\"||typeof document===\"undefined\"){return;}const target=RenderTarget.current();if(target===RenderTarget.canvas||target===RenderTarget.export||target===RenderTarget.thumbnail){return;}const globalWindow=window;if(globalWindow[RUN_ONCE_KEY]){return;}globalWindow[RUN_ONCE_KEY]=true;const timeoutId=window.setTimeout(()=>{const trigger=document.getElementById(\"september-offer-trigger\");if(!trigger)return;if(typeof trigger.focus===\"function\"){trigger.focus();}const dispatchMouseEvent=type=>{trigger.dispatchEvent(new MouseEvent(type,{bubbles:true,cancelable:true,button:0}));};const canUsePointerEvents=typeof window.PointerEvent!==\"undefined\"&&typeof window.PointerEvent===\"function\";if(canUsePointerEvents){trigger.dispatchEvent(new PointerEvent(\"pointerdown\",{bubbles:true,cancelable:true,pointerType:\"mouse\",button:0,buttons:1,isPrimary:true,pointerId:1}));trigger.dispatchEvent(new PointerEvent(\"pointerup\",{bubbles:true,cancelable:true,pointerType:\"mouse\",button:0,buttons:0,isPrimary:true,pointerId:1}));}dispatchMouseEvent(\"mousedown\");dispatchMouseEvent(\"mouseup\");dispatchMouseEvent(\"click\");},POPUP_DELAY_MS);return()=>{window.clearTimeout(timeoutId);};},[]);return /*#__PURE__*/_jsx(Component,{ref:ref,...props});});}export function withOpenClaimForm(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const scheduleClaimOpen=()=>{if(typeof window===\"undefined\"||typeof document===\"undefined\"){return;}if(isStaticRenderer()){return;}const target=RenderTarget.current();if(target===RenderTarget.canvas||target===RenderTarget.export||target===RenderTarget.thumbnail){return;}window.setTimeout(()=>{const trigger=document.getElementById(\"september-claim-form-trigger\");if(!trigger)return;if(typeof trigger.focus===\"function\"){trigger.focus();}const dispatchMouseEvent=type=>{trigger.dispatchEvent(new MouseEvent(type,{bubbles:true,cancelable:true,button:0}));};const canUsePointerEvents=typeof window.PointerEvent!==\"undefined\"&&typeof window.PointerEvent===\"function\";if(canUsePointerEvents){trigger.dispatchEvent(new PointerEvent(\"pointerdown\",{bubbles:true,cancelable:true,pointerType:\"mouse\",button:0,buttons:1,isPrimary:true,pointerId:1}));trigger.dispatchEvent(new PointerEvent(\"pointerup\",{bubbles:true,cancelable:true,pointerType:\"mouse\",button:0,buttons:0,isPrimary:true,pointerId:1}));}dispatchMouseEvent(\"mousedown\");dispatchMouseEvent(\"mouseup\");dispatchMouseEvent(\"click\");},CLAIM_DELAY_MS);};const handleTap=(...args)=>{if(typeof props.onTap===\"function\"){props.onTap(...args);}scheduleClaimOpen();};const handleClick=(...args)=>{if(typeof props.onClick===\"function\"){props.onClick(...args);}scheduleClaimOpen();};return /*#__PURE__*/_jsx(Component,{ref:ref,...props,onTap:handleTap,onClick:handleClick});});}export function withNativeFormSubmit(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const lockTimeoutIdRef=useRef(0);const submitTimeoutIdRef=useRef(0);const isLockedRef=useRef(false);const hostElementRef=useRef(null);const setHostRef=node=>{hostElementRef.current=node;if(typeof ref===\"function\"){ref(node);return;}if(ref&&typeof ref===\"object\"){ref.current=node;}};useEffect(()=>{return()=>{if(typeof window!==\"undefined\"){window.clearTimeout(lockTimeoutIdRef.current);window.clearTimeout(submitTimeoutIdRef.current);}};},[]);const submitClosestForm=eventArg=>{if(!canRunInBrowserRuntime()||isLockedRef.current){return;}isLockedRef.current=true;submitTimeoutIdRef.current=window.setTimeout(()=>{const eventForm=findClosestFormElement(eventArg);const hostForm=findClosestFormElement(hostElementRef.current);const form=eventForm??hostForm;if(!form||typeof form.requestSubmit!==\"function\"){return;}form.requestSubmit();},NATIVE_SUBMIT_DELAY_MS);lockTimeoutIdRef.current=window.setTimeout(()=>{isLockedRef.current=false;},NATIVE_SUBMIT_LOCK_MS);};const handleTap=(...args)=>{if(typeof props.onTap===\"function\"){props.onTap(...args);}submitClosestForm(args[0]);};const handleClick=(...args)=>{if(typeof props.onClick===\"function\"){props.onClick(...args);}submitClosestForm(args[0]);};return /*#__PURE__*/_jsx(Component,{ref:setHostRef,...props,onTap:handleTap,onClick:handleClick});});}export function withDarkAutofillFields(Component){return /*#__PURE__*/forwardRef((props,ref)=>{useEffect(()=>{if(!canRunInBrowserRuntime()){return;}const globalWindow=window;const styleAlreadyPresent=document.getElementById(CLAIM_FORM_AUTOFILL_STYLE_ID);if(!styleAlreadyPresent){const styleElement=document.createElement(\"style\");styleElement.id=CLAIM_FORM_AUTOFILL_STYLE_ID;styleElement.textContent=`\n[data-framer-name=\"Claim Form\"] input,\n[data-framer-name=\"Claim Form\"] textarea,\n[data-framer-name=\"Claim Form\"] select {\n    background-color: #111111 !important;\n    color: #FFFFFF !important;\n    caret-color: #FFFFFF !important;\n}\n\n[data-framer-name=\"Claim Form\"] input:focus,\n[data-framer-name=\"Claim Form\"] textarea:focus,\n[data-framer-name=\"Claim Form\"] select:focus {\n    background-color: #111111 !important;\n    color: #FFFFFF !important;\n    caret-color: #FFFFFF !important;\n}\n\n[data-framer-name=\"Claim Form\"] input:-webkit-autofill,\n[data-framer-name=\"Claim Form\"] input:-webkit-autofill:hover,\n[data-framer-name=\"Claim Form\"] input:-webkit-autofill:focus,\n[data-framer-name=\"Claim Form\"] textarea:-webkit-autofill,\n[data-framer-name=\"Claim Form\"] textarea:-webkit-autofill:hover,\n[data-framer-name=\"Claim Form\"] textarea:-webkit-autofill:focus,\n[data-framer-name=\"Claim Form\"] select:-webkit-autofill,\n[data-framer-name=\"Claim Form\"] select:-webkit-autofill:hover,\n[data-framer-name=\"Claim Form\"] select:-webkit-autofill:focus {\n    -webkit-text-fill-color: #FFFFFF !important;\n    caret-color: #FFFFFF !important;\n    box-shadow: inset 0 0 0 1000px #111111 !important;\n    -webkit-box-shadow: inset 0 0 0 1000px #111111 !important;\n}\n`;document.head.appendChild(styleElement);}globalWindow[CLAIM_FORM_AUTOFILL_REFCOUNT_KEY]=(globalWindow[CLAIM_FORM_AUTOFILL_REFCOUNT_KEY]??0)+1;return()=>{globalWindow[CLAIM_FORM_AUTOFILL_REFCOUNT_KEY]=Math.max((globalWindow[CLAIM_FORM_AUTOFILL_REFCOUNT_KEY]??1)-1,0);if(globalWindow[CLAIM_FORM_AUTOFILL_REFCOUNT_KEY]===0){const styleElement=document.getElementById(CLAIM_FORM_AUTOFILL_STYLE_ID);if(styleElement&&styleElement.parentNode){styleElement.parentNode.removeChild(styleElement);}}};},[]);return /*#__PURE__*/_jsx(Component,{ref:ref,...props});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withOpenClaimForm\":{\"type\":\"reactHoc\",\"name\":\"withOpenClaimForm\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withNativeFormSubmit\":{\"type\":\"reactHoc\",\"name\":\"withNativeFormSubmit\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withDarkAutofillFields\":{\"type\":\"reactHoc\",\"name\":\"withDarkAutofillFields\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withTimedNativePopup\":{\"type\":\"reactHoc\",\"name\":\"withTimedNativePopup\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TimedNativePopup.map"],"mappings":"kMAAkc,SAAS,GAAwB,CAA8E,GAAnE,IAAS,QAAa,OAAO,SAAW,KAA8B,EAAiB,EAAG,MAAO,GAAO,IAAM,EAAO,EAAa,QAAQ,EAAgH,MAA9G,EAAG,IAAS,EAAa,QAAQ,IAAS,EAAa,QAAQ,IAAS,EAAa,UAAqC,CAAC,SAAS,EAAuB,EAAO,CAAC,GAAG,CAAC,GAAQ,OAAO,GAAS,SAAU,OAAO,KAAM,IAAM,EAAc,aAAkB,YAAY,EAAO,GAAQ,kBAAkB,EAAO,EAAO,cAAc,WAAW,EAAO,EAAO,OAAO,KAAwG,OAAhG,GAAe,OAAO,EAAc,SAAU,WAAmB,EAAc,QAAQ,MAAM,EAAU,IAAK,CAAC,SAAgB,EAAqB,EAAU,CAAC,OAAoB,GAAY,EAAM,KAAO,MAAc,CAAC,GAAU,IAAS,QAAa,OAAO,SAAW,IAAa,OAAQ,IAAM,EAAO,EAAa,QAAQ,EAAE,GAAG,IAAS,EAAa,QAAQ,IAAS,EAAa,QAAQ,IAAS,EAAa,UAAW,OAAQ,IAAM,EAAa,EAAO,GAAG,EAAa,GAAe,OAAQ,EAAa,GAAc,GAAK,IAAM,EAAU,EAAO,eAAe,CAAC,IAAM,EAAQ,SAAS,eAAe,yBAAyB,EAAE,GAAG,CAAC,EAAQ,OAAU,OAAO,EAAQ,OAAQ,YAAY,EAAQ,MAAM,EAAG,IAAM,EAAmB,GAAM,CAAC,EAAQ,cAAc,IAAI,WAAW,EAAK,CAAC,QAAQ,GAAK,W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