{"version":3,"file":"FixedMobileMenuOverride.DQ71mCe6.mjs","names":["React.useState","React.useRef","React.useCallback","React.useMemo","_Fragment"],"sources":["https:/framerusercontent.com/modules/qeYz0CcJrO4do0Stf3hY/0daNmZVEZsd1iOy482cy/FixedMobileMenuOverride.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import*as React from\"react\";import{createPortal}from\"react-dom\";import{addPropertyControls,ControlType}from\"framer\";export function withFixedMobileMenu(Component){return /*#__PURE__*/React.forwardRef(function FixedMobileMenuOverride(props,ref){const{zIndex=100,openHeightThreshold=140,closedHeightFallback=64,backdropColor,enableBodyScrollLock=true,style,...rest}=props;const[portalNode,setPortalNode]=React.useState(null);const[closedHeight,setClosedHeight]=React.useState(closedHeightFallback);const[isOpen,setIsOpen]=React.useState(false);const containerRef=React.useRef(null);const measureRef=React.useRef(null);const rafRef=React.useRef(null);const previousBodyStylesRef=React.useRef(null);const handleMeasurement=React.useCallback(height=>{if(!Number.isFinite(height)||height<=0)return;const nextIsOpen=height>openHeightThreshold;if(!nextIsOpen){React.startTransition(()=>{setClosedHeight(height);});}React.startTransition(()=>{setIsOpen(prev=>prev===nextIsOpen?prev:nextIsOpen);});},[openHeightThreshold]);React.useLayoutEffect(()=>{if(typeof document===\"undefined\")return;const node=document.createElement(\"div\");node.setAttribute(\"data-fixed-mobile-menu-portal\",\"true\");document.body.appendChild(node);React.startTransition(()=>{setPortalNode(node);});return()=>{if(node.parentNode)node.parentNode.removeChild(node);React.startTransition(()=>{setPortalNode(null);});};},[]);React.useLayoutEffect(()=>{const element=measureRef.current;if(!element)return;const measure=()=>{const rect=element.getBoundingClientRect();handleMeasurement(rect.height);};measure();let resizeObserver=null;if(typeof window!==\"undefined\"&&typeof window.ResizeObserver!==\"undefined\"){resizeObserver=new window.ResizeObserver(()=>{measure();});resizeObserver.observe(element);}const loop=()=>{measure();if(typeof window!==\"undefined\"){rafRef.current=window.requestAnimationFrame(loop);}};if(typeof window!==\"undefined\"){rafRef.current=window.requestAnimationFrame(loop);}return()=>{if(resizeObserver)resizeObserver.disconnect();if(typeof window!==\"undefined\"&&rafRef.current!==null){window.cancelAnimationFrame(rafRef.current);rafRef.current=null;}};},[handleMeasurement,portalNode]);React.useLayoutEffect(()=>{const container=containerRef.current;if(!container)return;if(isOpen){container.style.height=\"100vh\";container.style.height=\"100dvh\";}else{container.style.height=\"auto\";}},[isOpen]);React.useLayoutEffect(()=>{if(!enableBodyScrollLock)return;if(typeof document===\"undefined\"||typeof window===\"undefined\")return;const body=document.body;const html=document.documentElement;const restore=()=>{const previous=previousBodyStylesRef.current;if(!previous)return;body.style.overflow=previous.bodyOverflow;body.style.position=previous.bodyPosition;body.style.top=previous.bodyTop;body.style.width=previous.bodyWidth;html.style.overflow=previous.htmlOverflow;window.scrollTo(0,previous.scrollY);previousBodyStylesRef.current=null;};if(isOpen&&!previousBodyStylesRef.current){const scrollY=window.scrollY||window.pageYOffset||0;previousBodyStylesRef.current={bodyOverflow:body.style.overflow,htmlOverflow:html.style.overflow,bodyPosition:body.style.position,bodyTop:body.style.top,bodyWidth:body.style.width,scrollY};body.style.overflow=\"hidden\";html.style.overflow=\"hidden\";body.style.position=\"fixed\";body.style.top=`-${scrollY}px`;body.style.width=\"100%\";}if(!isOpen){restore();}return()=>{restore();};},[enableBodyScrollLock,isOpen]);const placeholderStyle=React.useMemo(()=>({position:\"relative\",width:\"100%\",height:closedHeight,pointerEvents:\"none\"}),[closedHeight]);const portalContainerStyle=React.useMemo(()=>{const openStyle=isOpen?{position:\"fixed\",inset:0,overflowY:\"auto\",overscrollBehavior:\"contain\",WebkitOverflowScrolling:\"touch\",paddingBottom:\"max(48px, env(safe-area-inset-bottom))\"}:{position:\"fixed\",top:0,left:0,right:0,height:\"auto\",overflow:\"visible\",paddingBottom:0};return{...openStyle,zIndex,background:isOpen&&backdropColor?backdropColor:\"transparent\"};},[isOpen,zIndex,backdropColor]);const wrappedStyle=React.useMemo(()=>({...style,width:\"100%\"}),[style]);if(typeof document===\"undefined\"){return /*#__PURE__*/_jsx(Component,{ref:ref,...rest,zIndex:zIndex,openHeightThreshold:openHeightThreshold,closedHeightFallback:closedHeightFallback,backdropColor:backdropColor,enableBodyScrollLock:enableBodyScrollLock,style:wrappedStyle});}return /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"div\",{\"aria-hidden\":true,style:placeholderStyle}),portalNode?/*#__PURE__*/createPortal(/*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:portalContainerStyle,children:/*#__PURE__*/_jsx(\"div\",{ref:measureRef,style:{position:\"relative\",width:\"100%\"},children:/*#__PURE__*/_jsx(Component,{ref:ref,...rest,zIndex:zIndex,openHeightThreshold:openHeightThreshold,closedHeightFallback:closedHeightFallback,backdropColor:backdropColor,enableBodyScrollLock:enableBodyScrollLock,style:wrappedStyle})})}),portalNode):null]});});}addPropertyControls(withFixedMobileMenu,{zIndex:{type:ControlType.Number,title:\"zIndex\",defaultValue:100,min:1,max:9999,step:1},openHeightThreshold:{type:ControlType.Number,title:\"Open Threshold\",defaultValue:140,min:80,max:600,step:1},closedHeightFallback:{type:ControlType.Number,title:\"Closed Height\",defaultValue:64,min:40,max:240,step:1},backdropColor:{type:ControlType.Color,title:\"Backdrop\",optional:true,defaultValue:\"#FFFFFF\"},enableBodyScrollLock:{type:ControlType.Boolean,title:\"Scroll Lock\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"withFixedMobileMenu\":{\"type\":\"reactHoc\",\"name\":\"withFixedMobileMenu\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FixedMobileMenuOverride.map"],"mappings":"yPAAmM,SAAgB,EAAoB,EAAU,CAAC,OAAoB,EAAiB,SAAiC,EAAM,EAAI,CAAC,GAAK,CAAC,SAAO,IAAI,sBAAoB,IAAI,uBAA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