{"version":3,"file":"AgeGateAutoTrigger.DhsdwlVM.mjs","names":["useRef","useMemo","useCallback"],"sources":["https:/framerusercontent.com/modules/LEP9TRqiWFxdnCk0YVWr/F29oYV28grOswOCoyECM/AgeGateAutoTrigger.js"],"sourcesContent":["// Create a new Framer code component named AgeGateAutoTrigger. It should be invisible and used as a helper on the Home page to open an existing Framer FixedOverlay age gate. Behavior: on mount, wait a configurable delayMs (default 300), then find the closest previous sibling element that can receive focus/keyboard activation or click-like activation; dispatch focus, Enter keydown/up, and click events to trigger the existing canvas trigger. It should only run when localStorage key `neft_age_gate_confirmed` is not `true` and the URL path is not `/age-restricted`. When the user clicks the existing Yes button in the overlay with id `popup-btn-yes`, set `neft_age_gate_confirmed` to `true`. Do not manage the overlay UI itself. Expose controls: delayMs number and enabled boolean. Render a 1px transparent div with aria-hidden. Keep it safe for SSR/static render.\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useCallback,useEffect,useMemo,useRef}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";const AGE_GATE_DECISION_SESSION_KEY=\"neft_age_gate_decided_this_session\";const isElementVisible=element=>{if(!(element instanceof HTMLElement))return false;if(typeof window===\"undefined\")return false;const style=window.getComputedStyle(element);if(style.display===\"none\"||style.visibility===\"hidden\"||style.opacity===\"0\"){return false;}const rect=element.getBoundingClientRect();return rect.width>0&&rect.height>0;};const findLikelyAgeGateContainerFromButton=button=>{const overlayRoot=button.closest('[role=\"dialog\"], [aria-modal=\"true\"], [data-framer-modal], .framer-overlay, .framer-modal');if(overlayRoot)return overlayRoot;let current=button.parentElement;while(current){if(!isElementVisible(current)){current=current.parentElement;continue;}const rect=current.getBoundingClientRect();if(rect.width>=window.innerWidth*.6&&rect.height>=window.innerHeight*.4){return current;}current=current.parentElement;}return null;};const attemptCloseAgeGateOverlayFallback=yesButtonElement=>{if(typeof document===\"undefined\"||typeof window===\"undefined\")return;const currentYes=document.getElementById(\"popup-btn-yes\");if(!currentYes||!isElementVisible(currentYes))return;const container=findLikelyAgeGateContainerFromButton(yesButtonElement);const closeCandidate=container?.querySelector('[aria-label*=\"close\" i], [data-dismiss], [data-close], button[class*=\"close\" i], [role=\"button\"][aria-label*=\"close\" i]');if(closeCandidate){closeCandidate.dispatchEvent(new MouseEvent(\"click\",{bubbles:true,cancelable:true,button:0}));}else{document.dispatchEvent(new KeyboardEvent(\"keydown\",{key:\"Escape\",bubbles:true,cancelable:true}));document.dispatchEvent(new KeyboardEvent(\"keyup\",{key:\"Escape\",bubbles:true,cancelable:true}));}window.setTimeout(()=>{const yesStillVisible=isElementVisible(document.getElementById(\"popup-btn-yes\"));if(!yesStillVisible)return;const liveYes=document.getElementById(\"popup-btn-yes\");if(!liveYes)return;const liveContainer=findLikelyAgeGateContainerFromButton(liveYes);if(!liveContainer)return;liveContainer.setAttribute(\"aria-hidden\",\"true\");liveContainer.style.pointerEvents=\"none\";liveContainer.style.visibility=\"hidden\";liveContainer.style.opacity=\"0\";liveContainer.style.display=\"none\";},120);};const isKeyboardOrClickActivatable=element=>{const tag=element.tagName.toLowerCase();const hasNativeInteraction=tag===\"button\"||tag===\"a\"||tag===\"input\"||tag===\"select\"||tag===\"textarea\"||tag===\"summary\";const tabIndexAttr=element.getAttribute(\"tabindex\");const tabIndex=tabIndexAttr!==null?Number.parseInt(tabIndexAttr,10):NaN;const isTabFocusable=!Number.isNaN(tabIndex)&&tabIndex>=0;const role=element.getAttribute(\"role\")?.toLowerCase();const hasInteractiveRole=role===\"button\"||role===\"link\"||role===\"menuitem\";const hasClickHandlerAttribute=element.hasAttribute(\"onclick\");return hasNativeInteraction||isTabFocusable||hasInteractiveRole||hasClickHandlerAttribute;};const dispatchActivationEvents=element=>{try{element.dispatchEvent(new FocusEvent(\"focus\",{bubbles:true}));element.focus({preventScroll:true});}catch(error){// Keep best-effort behavior for browsers where FocusEvent may fail.\n}element.dispatchEvent(new KeyboardEvent(\"keydown\",{bubbles:true,cancelable:true,key:\"Enter\"}));element.dispatchEvent(new KeyboardEvent(\"keyup\",{bubbles:true,cancelable:true,key:\"Enter\"}));const supportsPointerEvents=typeof window!==\"undefined\"&&\"PointerEvent\"in window;if(supportsPointerEvents){element.dispatchEvent(new PointerEvent(\"pointerdown\",{bubbles:true,cancelable:true,pointerType:\"mouse\",isPrimary:true,button:0}));element.dispatchEvent(new PointerEvent(\"pointerup\",{bubbles:true,cancelable:true,pointerType:\"mouse\",isPrimary:true,button:0}));}element.dispatchEvent(new MouseEvent(\"mousedown\",{bubbles:true,cancelable:true,button:0}));element.dispatchEvent(new MouseEvent(\"mouseup\",{bubbles:true,cancelable:true,button:0}));element.dispatchEvent(new MouseEvent(\"click\",{bubbles:true,cancelable:true,button:0}));};/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function AgeGateAutoTrigger(props){const{enabled,delayMs,targetElementId=\"age-gate-trigger\"}=props;const rootRef=useRef(null);const noRedirectScheduledRef=useRef(false);const isStaticRenderer=useIsStaticRenderer();const shouldAttemptTrigger=useMemo(()=>{if(!enabled)return false;if(isStaticRenderer)return false;if(typeof window===\"undefined\"||typeof document===\"undefined\"){return false;}if(window.location.pathname===\"/age-restricted\")return false;return true;},[enabled,isStaticRenderer]);const markAgeGateDecisionThisSession=useCallback(()=>{if(typeof window===\"undefined\")return;try{window.sessionStorage.setItem(AGE_GATE_DECISION_SESSION_KEY,\"true\");}catch(error){// Ignore storage failures.\n}},[]);const hasAgeGateDecisionThisSession=useCallback(()=>{if(typeof window===\"undefined\")return false;try{return window.sessionStorage.getItem(AGE_GATE_DECISION_SESSION_KEY)===\"true\";}catch(error){return false;}},[]);const findClosestPreviousActivatableSibling=useCallback(()=>{const rootNode=rootRef.current;if(!rootNode)return null;let candidate=rootNode.previousElementSibling;while(candidate){if(isKeyboardOrClickActivatable(candidate))return candidate;candidate=candidate.previousElementSibling;}return null;},[]);useEffect(()=>{if(typeof document===\"undefined\"||typeof window===\"undefined\")return;if(window.location.pathname===\"/age-restricted\")return;const fallbackTimeouts=[];const onDocumentClickCapture=event=>{if(!event.isTrusted)return;const target=event.target;if(!target)return;const yesButton=target.closest(\"#popup-btn-yes\");const noButton=target.closest(\"#popup-btn-no\");if(!yesButton&&!noButton)return;markAgeGateDecisionThisSession();if(yesButton){const timeoutId=window.setTimeout(()=>{attemptCloseAgeGateOverlayFallback(yesButton);},100);fallbackTimeouts.push(timeoutId);}if(noButton&&window.location.pathname!==\"/age-restricted\"&&!noRedirectScheduledRef.current){noRedirectScheduledRef.current=true;window.setTimeout(()=>{window.location.href=\"/age-restricted\";},0);}};document.addEventListener(\"click\",onDocumentClickCapture,true);return()=>{document.removeEventListener(\"click\",onDocumentClickCapture,true);for(const timeoutId of fallbackTimeouts){window.clearTimeout(timeoutId);}};},[markAgeGateDecisionThisSession]);useEffect(()=>{if(!shouldAttemptTrigger)return;if(hasAgeGateDecisionThisSession())return;const safeDelay=Number.isFinite(delayMs)?Math.max(0,delayMs):300;const timeoutId=window.setTimeout(()=>{const targetById=targetElementId&&typeof document!==\"undefined\"?document.getElementById(targetElementId):null;const activationTarget=targetById??findClosestPreviousActivatableSibling();if(!activationTarget)return;dispatchActivationEvents(activationTarget);},safeDelay);return()=>{window.clearTimeout(timeoutId);};},[delayMs,findClosestPreviousActivatableSibling,hasAgeGateDecisionThisSession,shouldAttemptTrigger,targetElementId]);return /*#__PURE__*/_jsx(\"div\",{ref:rootRef,\"aria-hidden\":\"true\",style:{position:\"relative\",width:\"1px\",height:\"1px\",opacity:0,pointerEvents:\"none\",background:\"transparent\"}});}addPropertyControls(AgeGateAutoTrigger,{enabled:{type:ControlType.Boolean,title:\"Enabled\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},delayMs:{type:ControlType.Number,title:\"Delay\",defaultValue:300,min:0,max:1e4,step:50,unit:\"ms\"},targetElementId:{type:ControlType.String,title:\"Target ID\",defaultValue:\"age-gate-trigger\",placeholder:\"age-gate-trigger\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AgeGateAutoTrigger\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"fixed\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AgeGateAutoTrigger.map"],"mappings":"2MAKG,SAAwB,EAAmB,EAAM,CAAC,GAAK,CAAC,UAAQ,UAAQ,kBAAgB,oBAAoB,EAAY,EAAQA,EAAO,IAAI,EAAQ,EAAuBA,EAAO,EAAK,EAAQ,EAAiB,EAAoB,EAAQ,EAAqBC,MAAoJ,EAApI,CAAC,GAAwB,GAAwC,IAAS,QAAa,OAAO,SAAW,KAA8B,EAAO,SAAS,WAAW,mBAA6C,CAAC,EAAQ,CAAgB,CAAC,EAAQ,EAA+BC,MAAgB,CAAI,GAAO,IAAS,OAAmB,GAAG,CAAC,EAAO,eAAe,QAAQ,EAA8B,MAAM,CAAE,MAAa,CAC/qB,CAAC,EAAE,CAAC,CAAC,EAAQ,EAA8BA,MAAgB,CAAC,GAAU,IAAS,OAAY,MAAO,GAAM,GAAG,CAAC,OAAO,EAAO,eAAe,QAAQ,CAA6B,IAAI,MAAO,MAAa,CAAC,MAAO,EAAM,CAAC,EAAE,CAAC,CAAC,EAAQ,EAAsCA,MAAgB,CAAC,IAAM,EAAS,EAAQ,QAAQ,GAAG,CAAC,EAAS,OAAO,KAAK,IAAI,EAAU,EAAS,uBAAuB,KAAM,GAAU,CAAC,GAAG,EAA6B,CAAS,EAAE,OAAO,EAAU,EAAU,EAAU,sBAAuB,CAAC,OAAO,IAAK,EAAE,CAAC,CAAC,EAAinD,OAA/mD,MAAc,CAAsE,GAAlE,OAAO,SAAW,KAAoB,IAAS,QAAsB,EAAO,SAAS,WAAW,kBAAkB,OAAO,IAAM,EAAiB,CAAC,EAAQ,EAAuB,GAAO,CAAC,GAAG,CAAC,EAAM,UAAU,OAAO,IAAM,EAAO,EAAM,OAAO,GAA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