{"version":3,"file":"WithDynamicHeightHowItWorksSection.B3u-xg7t.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/IfTpzWBRHLaw1WBeiNuQ/awmAiWR5T576EoRMAGaw/WithDynamicHeightHowItWorksSection.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState,useRef}from\"react\";const DEFAULT_NAV_HEIGHT=80;const MIN_BREAKPOINT=810;export function withDynamicHeight(Component){return props=>{const[totalHeight,setTotalHeight]=useState(0);const[justifyContent,setJustifyContent]=useState(\"center\");const[isDesktop,setIsDesktop]=useState(false);const observerRef=useRef(null);const timeoutRef=useRef(null);useEffect(()=>{const updateHeight=()=>{// Only apply on 810px and above\nif(window.innerWidth<MIN_BREAKPOINT){setIsDesktop(false);return;}setIsDesktop(true);let height=0;// Get navbar height or use default\nconst nav=document.querySelector(\"nav\");if(nav){height+=nav.offsetHeight;}else{height+=DEFAULT_NAV_HEIGHT;}// Get banner height if exists\nconst banner=document.querySelector('[data-framer-name=\"banner\"]');if(banner){height+=banner.offsetHeight;}setTotalHeight(height);// Check if content fits in available space\nconst availableHeight=window.innerHeight-height;const minHeight=908;if(availableHeight<minHeight){setJustifyContent(\"flex-start\");}else{setJustifyContent(\"center\");}};// Debounce for resize events\nconst debouncedUpdate=()=>{if(timeoutRef.current){window.clearTimeout(timeoutRef.current);}timeoutRef.current=window.setTimeout(updateHeight,100);};// Wait for DOM to be ready\nif(document.readyState===\"complete\"){updateHeight();}else{window.addEventListener(\"load\",updateHeight,{once:true});}// Resize listener with debounce\nwindow.addEventListener(\"resize\",debouncedUpdate,{passive:true});// ResizeObserver for nav and banner\nif(typeof ResizeObserver!==\"undefined\"){observerRef.current=new ResizeObserver(debouncedUpdate);const nav=document.querySelector(\"nav\");if(nav){observerRef.current.observe(nav);}const banner=document.querySelector('[data-framer-name=\"banner\"]');if(banner){observerRef.current.observe(banner);}}return()=>{window.removeEventListener(\"resize\",debouncedUpdate);if(timeoutRef.current){window.clearTimeout(timeoutRef.current);}if(observerRef.current){observerRef.current.disconnect();}};},[]);// Below 810px: return component without any modifications\nif(!isDesktop){return /*#__PURE__*/_jsx(Component,{...props});}// 810px and above: apply dynamic height and justifyContent\nreturn /*#__PURE__*/_jsx(Component,{...props,style:{...props.style,height:`calc(100vh - ${totalHeight}px)`,minHeight:\"908px\",justifyContent:justifyContent}});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withDynamicHeight\":{\"type\":\"reactHoc\",\"name\":\"withDynamicHeight\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./WithDynamicHeightHowItWorksSection.map"],"mappings":"8IAA6I,SAAgB,EAAkB,EAAU,CAAC,MAAO,IAAO,CAAC,GAAK,CAAC,EAAY,GAAgBA,EAAS,CAAC,EAAO,CAAC,EAAe,GAAmBA,EAAS,QAAQ,EAAO,CAAC,EAAU,GAAcA,EAAS,EAAK,EAAQ,EAAYC,EAAO,IAAI,EAAQ,EAAWA,EAAO,IAAI,EAU3Z,OAV6Z,MAAc,CAAC,IAAM,MAAiB,CACnc,GAAG,EAAO,WAAW,EAAe,CAAC,EAAa,EAAK,EAAE,MAAO,CAAC,EAAa,EAAI,EAAE,IAAI,EAAO,EACzF,EAAI,SAAS,cAAc,KAAK,EAAK,EAAK,GAAQ,EAAI,aAAmB,GAAQ,EACvF,IAAM,EAAO,SAAS,cAAc,6BAA6B,EAAK,IAAQ,GAAQ,EAAO,cAAc,EAAe,CAAM,EAC1G,EAAO,YAAY,EAA8C,IAAW,EAAkB,YAAY,EAAQ,EAAkB,QAAQ,CAAG,EAC/J,MAAoB,CAAI,EAAW,SAAS,EAAO,aAAa,EAAW,OAAO,EAAG,EAAW,QAAQ,EAAO,WAAW,EAAa,GAAG,CAAE,EAGlJ,GAFG,SAAS,aAAa,WAAY,EAAa,EAAQ,EAAO,iBAAiB,OAAO,EAAa,CAAC,KAAK,EAAI,CAAC,EACjH,EAAO,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