{"version":3,"file":"AgeGateAutoTrigger.CIQPCAvl.mjs","names":["useRef","useMemo","useCallback","__esmMin","pe","init_npm_react_18_3_1","window","de","ne","ce","init_ssg_sandbox_shims","addPropertyControls","init_framer_BL70qLPA","ControlType","useIsStaticRenderer","AgeGateAutoTrigger","props","rootRef","noRedirectScheduledRef","isStaticRenderer","shouldAttemptTrigger","enabled","markAgeGateDecisionThisSession","AGE_GATE_DECISION_SESSION_KEY","hasAgeGateDecisionThisSession","findClosestPreviousActivatableSibling","rootNode","candidate","isKeyboardOrClickActivatable","fallbackTimeouts","onDocumentClickCapture","event","target","yesButton","noButton","timeoutId","attemptCloseAgeGateOverlayFallback","safeDelay","delayMs","activationTarget","targetElementId","dispatchActivationEvents","isElementVisible","findLikelyAgeGateContainerFromButton","init_AgeGateAutoTrigger","init_jsx_runtime","element","style","rect","overlayRoot","button","current","currentYes","closeCandidate","yesButtonElement","liveYes","liveContainer","tag","hasNativeInteraction","tabIndexAttr","tabIndex","isTabFocusable","role","hasInteractiveRole","hasClickHandlerAttribute"],"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":"A,2MAKG,SAAwBe,EAAmB,EAAM,CAAC,GAAK,CAAC,UAAQ,UAAQ,kBAAgB,oBAAoBC,EAAYC,EAAQjB,EAAO,IAAI,EAAQkB,EAAuBlB,EAAO,EAAK,EAAQmB,EAAiBL,EAAoB,EAAQM,EAAqBnB,MAAoJ,EAApI,CAACoB,GAAwBF,GAAwCb,IAAS,QAAa,OAAO,SAAW,KAA8BA,EAAO,SAAS,WAAW,mBAA6C,CAACe,EAAQF,CAAgB,CAAC,EAAQG,EAA+BpB,MAAgB,CAAC,GAAUI,IAAS,OAAmB,GAAG,CAACA,EAAO,eAAe,QAAQiB,EAA8B,MAAM,CAAE,MAAa,CAC/qB,CAAC,EAA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