{"version":3,"file":"MainMenuDropdownOverride.Ql4TKrPc.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/KKNizlOxEywfoL6pxj0s/APu3Uk6zPjGknFUFpoVG/MainMenuDropdownOverride.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect,useRef}from\"react\";// @ts-ignore - local utility path resolution in Framer runtime\nimport{getFirstFocusableElement}from\"https://framerusercontent.com/modules/6mZD1mkIUALd1E2W5DL8/cOrZhXPvCgxix4JUXL87/FocusUtils.js\";export function accessibleDropDown(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const wrapperRef=useRef(null);useEffect(()=>{if(typeof document===\"undefined\"||typeof window===\"undefined\"){return;}const item=ref?.current?ref:wrapperRef;const currentItem=item?.current;//The logic of moving the focus on open, makes sence only in the cases that we are in an overlay (desktop)\nif(currentItem?.closest?.(\"#overlay\")){const TimeDelayForAnimation=200;const originalElement=document.activeElement;let disableMainContentTimeout;let focusTimeout;const onDocumentKeyUp=event=>{if(event.key===\"Escape\"){tobbleInertOnMainContent(false);window.setTimeout(()=>{originalElement?.focus?.();},TimeDelayForAnimation);// Forces the overlay to close\ndocument.body?.dispatchEvent(new window.MouseEvent(\"mousemove\",{clientX:150,clientY:5,bubbles:true,cancelable:true,view:window}));}};focusTimeout=window.setTimeout(()=>{const firstElement=getFirstFocusableElement(currentItem);// Need to give the user time to move the cursor down, before making the main aria inert.\ndisableMainContentTimeout=window.setTimeout(()=>{tobbleInertOnMainContent(true);},1e3);firstElement?.focus?.();},TimeDelayForAnimation);document.body?.addEventListener(\"keyup\",onDocumentKeyUp);return()=>{originalElement?.focus?.();if(typeof focusTimeout===\"number\"){window.clearTimeout(focusTimeout);}if(typeof disableMainContentTimeout===\"number\"){window.clearTimeout(disableMainContentTimeout);}document.body?.removeEventListener(\"keyup\",onDocumentKeyUp);tobbleInertOnMainContent(false);};}},[]);if(ref){return /*#__PURE__*/_jsx(Component,{ref:ref,...props});}return /*#__PURE__*/_jsx(\"span\",{ref:wrapperRef,children:/*#__PURE__*/_jsx(Component,{ref:ref,...props})});});}/**\n * Disables the main aria of the contnet. This allows keyboard users to navigate freely only inside the dropdown.\n */function tobbleInertOnMainContent(isDisabled){if(typeof document!==\"undefined\"){const main=document.getElementById(\"main\");if(!main)return;const children=[...main.children].filter(item=>{return item.getAttribute(\"id\")!==\"overlay\";});children.forEach(child=>{if(isDisabled){child.setAttribute(\"inert\",\"true\");}else{child.removeAttribute(\"inert\");}});}}\nexport const __FramerMetadata__ = {\"exports\":{\"accessibleDropDown\":{\"type\":\"reactHoc\",\"name\":\"accessibleDropDown\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./MainMenuDropdownOverride.map"],"mappings":"8LACoI,SAAgB,EAAmB,EAAU,CAAC,OAAoB,GAAY,EAAM,IAAM,CAAC,IAAM,EAAWA,EAAO,IAAI,EAGuT,OAHrT,MAAc,CAAC,GAAG,OAAO,SAAW,KAAoB,IAAS,OAAa,OAA+C,IAAM,GAAlC,GAAK,QAAQ,EAAI,EAAA,EAAmC,QAClZ,GAAG,GAAa,UAAU,UAAU,EAAE,CAAC,IAAsC,EAAgB,SAAS,cAAkB,EAA8B,EAAmB,EAAgB,GAAO,CAAI,EAAM,MAAM,WAAU,EAAyB,EAAK,EAAE,EAAO,eAAe,CAAC,GAAiB,QAAQ,CAAE,EAAE,GAAqB,EACnU,SAAS,MAAM,cAAc,IAAI,EAAO,WAAW,YAAY,CAAC,QAAQ,IAAI,QAAQ,EAAE,QAAQ,GAAK,WAAW,GAAK,KAAK,CAAM,CAAC,CAAC,EAAG,EAC8D,MAD5D,GAAa,EAAO,eAAe,CAAC,IAAM,EAAa,EAAyB,CAAW,EAChO,EAA0B,EAAO,eAAe,CAAC,EAAyB,EAAI,CAAE,EAAE,GAAG,EAAE,GAAc,QAAQ,CAAE,EAAE,GAAqB,EAAE,SAAS,MAAM,iBAAiB,QA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