{"version":3,"file":"Match_Height.BVATXMuy.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/Axc1AmfVvnie7JMJVxQp/TaFF3oLVtM1zOnihCm8A/Match_Height.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useLayoutEffect,useRef}from\"react\";/**\n * Makes all direct child elements match the tallest child height.\n */export function withEqualChildHeights(Component){return props=>{const ref=useRef(null);useLayoutEffect(()=>{const parent=ref.current;if(!parent)return;const children=Array.from(parent.children);if(!children.length)return;let frameId=null;const updateHeights=()=>{if(frameId)cancelAnimationFrame(frameId);frameId=requestAnimationFrame(()=>{children.forEach(child=>{child.style.height=\"auto\";});const maxHeight=Math.max(...children.map(child=>child.offsetHeight));children.forEach(child=>{child.style.height=`${maxHeight}px`;});});};updateHeights();const observer=new ResizeObserver(updateHeights);children.forEach(child=>observer.observe(child));observer.observe(parent);window.addEventListener(\"resize\",updateHeights);return()=>{if(frameId)cancelAnimationFrame(frameId);observer.disconnect();window.removeEventListener(\"resize\",updateHeights);children.forEach(child=>{child.style.height=\"\";});};},[]);return /*#__PURE__*/_jsx(Component,{...props,ref:ref});};}/**\n * Same as above, but applies the equal height to each child's first inner element.\n * Useful for CMS Collections where Framer adds an extra wrapper around each item.\n */export function withEqualNestedChildHeights(Component){return props=>{const ref=useRef(null);useLayoutEffect(()=>{const parent=ref.current;if(!parent)return;const wrappers=Array.from(parent.children);const children=wrappers.map(wrapper=>wrapper.firstElementChild).filter(Boolean);if(!children.length)return;let frameId=null;const updateHeights=()=>{if(frameId)cancelAnimationFrame(frameId);frameId=requestAnimationFrame(()=>{children.forEach(child=>{child.style.height=\"auto\";});const maxHeight=Math.max(...children.map(child=>child.offsetHeight));children.forEach(child=>{child.style.height=`${maxHeight}px`;});});};updateHeights();const observer=new ResizeObserver(updateHeights);wrappers.forEach(wrapper=>observer.observe(wrapper));children.forEach(child=>observer.observe(child));observer.observe(parent);window.addEventListener(\"resize\",updateHeights);return()=>{if(frameId)cancelAnimationFrame(frameId);observer.disconnect();window.removeEventListener(\"resize\",updateHeights);children.forEach(child=>{child.style.height=\"\";});};},[]);return /*#__PURE__*/_jsx(Component,{...props,ref:ref});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withEqualNestedChildHeights\":{\"type\":\"reactHoc\",\"name\":\"withEqualNestedChildHeights\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withEqualChildHeights\":{\"type\":\"reactHoc\",\"name\":\"withEqualChildHeights\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Match_Height.map"],"mappings":"kIAEG,SAAgB,EAAsB,EAAU,CAAC,MAAO,IAAO,CAAC,IAAM,EAAIA,EAAO,IAAI,EAAgzB,OAA9yB,MAAoB,CAAC,IAAM,EAAO,EAAI,QAAQ,GAAG,CAAC,EAAO,OAAO,IAAM,EAAS,MAAM,KAAK,EAAO,QAAQ,EAAE,GAAG,CAAC,EAAS,OAAO,OAAO,IAAI,EAAQ,KAAW,MAAkB,CAAI,GAAQ,qBAAqB,CAAO,EAAE,EAAQ,0BAA0B,CAAC,EAAS,QAAQ,GAAO,CAAC,EAAM,MAAM,OAAO,MAAO,CAAC,EAAE,IAAM,EAAU,KAAK,IAAI,GAAG,EAAS,IAAI,GAAO,EAAM,YAAY,CAAC,EAAE,EAAS,QAAQ,GAAO,CAAC,EAAM,MAAM,OAAO,GAAG,EAAU,GAAI,CAAC,CAAE,CAAC,CAAE,EAAE,EAAc,EAAE,IAAM,EAAS,IAAI,eAAe,CAAa,EAA4H,OAA1H,EAAS,QAAQ,GAAO,EAAS,QAAQ,CAAK,CAAC,EAAE,EAAS,QAAQ,CAAM,EAAE,EAAO,iBAAiB,SAAS,CAAa,MAAY,CAAI,GAAQ,qBAAqB,CAAO,EAAE,EAAS,WAAW,EAAE,EAAO,oBAAoB,SAAS,CAAa,EAAE,EAAS,QAAQ,GAAO,CAAC,EAAM,MAAM,OAAO,EAAG,CAA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