{"version":3,"file":"ConditionalVisibility.oXZIx2he.mjs","names":["__legacyOverrideHOC_DataObserverContext","_jsx","useRef","useState","useCallback","__esmMin","window","le","te","init_ssg_sandbox_shims","init_npm_react_18_3_1","_e","oe","ne","c","init_jsx_runtime","de","init_framer_DymZktPS","DataObserverContext","bgHasImage","bg","withwithHideIfEmpty","C","props","withHideIfEmpty","withwithAutoHideRow","withAutoHideRow","withwithAutoHideGallery","withAutoHideGallery","withwithHideIfCollectionListEmpty","withHideIfCollectionListEmpty","init_ConditionalVisibility","ref","show","setShow","hasAnyVisible","child","localRef","hasVisibleRenderedDescendant","root","style","el","evaluateVisibility","sectionEl","collectionListEl","shouldShow","mutationObserver","resizeObserver","node","incomingRef"],"sources":["https:/framerusercontent.com/modules/Wz10SSgrL759q2sn2UPb/5MzJXLqXyqaKVtZFO5p6/ConditionalVisibility.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{startTransition,useCallback,useLayoutEffect,useRef,useState}from\"react\";/** Returns true if a Framer `background` prop contains a real image. */function bgHasImage(bg){if(!bg||typeof bg!==\"object\")return false;return\"src\"in bg&&typeof bg.src===\"string\";}export const withHideIfEmpty=props=>{const hasImage=bgHasImage(props.background)||typeof props.src===\"string\"&&props.src.length>0||typeof props.backgroundImage===\"string\"&&props.backgroundImage.length>0&&props.backgroundImage!==\"none\";if(hasImage)return{};return{style:{...props.style,display:\"none\"}};};/**\n * Hides the row if ALL direct children have display:none\n * (i.e. every image slot in this row was hidden by withHideIfEmpty).\n */export const withAutoHideRow=props=>{const ref=useRef(null);const[show,setShow]=useState(true);useLayoutEffect(()=>{if(!ref.current)return;const children=Array.from(ref.current.children);const hasAnyVisible=children.some(child=>window.getComputedStyle(child).display!==\"none\");setShow(hasAnyVisible);});return{ref,style:{...props.style,display:show?undefined:\"none\"}};};/**\n * Hides the gallery section if ALL direct children (rows) have display:none\n * (i.e. every row was hidden by withAutoHideRow).\n */export const withAutoHideGallery=props=>{const ref=useRef(null);const[show,setShow]=useState(true);useLayoutEffect(()=>{if(!ref.current)return;const children=Array.from(ref.current.children);const hasAnyVisible=children.some(child=>window.getComputedStyle(child).display!==\"none\");setShow(hasAnyVisible);});return{ref,style:{...props.style,display:show?undefined:\"none\"}};};/**\n * Hides a section when its collection-list child has no visible rendered descendants.\n * Expected structure:\n * - section wrapper\n *   - first child: heading/content\n *   - last child: Framer CMS collection-list container\n */export const withHideIfCollectionListEmpty=props=>{const localRef=useRef(null);const[show,setShow]=useState(true);const hasVisibleRenderedDescendant=useCallback(root=>{if(!root)return false;const descendants=Array.from(root.querySelectorAll(\"*\"));return descendants.some(el=>{const style=window.getComputedStyle(el);if(style.display===\"none\"||style.visibility===\"hidden\")return false;return el.getClientRects().length>0;});},[]);const evaluateVisibility=useCallback(()=>{if(typeof window===\"undefined\")return;const sectionEl=localRef.current;if(!sectionEl)return;const collectionListEl=sectionEl.lastElementChild;const shouldShow=!!collectionListEl&&hasVisibleRenderedDescendant(collectionListEl);startTransition(()=>setShow(shouldShow));},[hasVisibleRenderedDescendant]);useLayoutEffect(()=>{if(typeof window===\"undefined\")return;const sectionEl=localRef.current;if(!sectionEl)return;evaluateVisibility();const collectionListEl=sectionEl.lastElementChild;if(!collectionListEl)return;const mutationObserver=new MutationObserver(()=>{evaluateVisibility();});mutationObserver.observe(collectionListEl,{childList:true,subtree:true,attributes:true,attributeFilter:[\"style\",\"class\",\"hidden\",\"aria-hidden\"]});let resizeObserver=null;if(typeof ResizeObserver!==\"undefined\"){resizeObserver=new ResizeObserver(()=>{evaluateVisibility();});resizeObserver.observe(collectionListEl);}return()=>{mutationObserver.disconnect();if(resizeObserver)resizeObserver.disconnect();};},[evaluateVisibility]);const composedRef=useCallback(node=>{localRef.current=node;const incomingRef=props.ref;if(typeof incomingRef===\"function\"){incomingRef(node);}else if(incomingRef&&typeof incomingRef===\"object\"&&\"current\"in incomingRef){incomingRef.current=node;}},[props]);return{ref:composedRef,style:{...props.style,display:show?props.style?.display:\"none\"}};};import{useContext as __legacyOverrideHOC_useContext}from\"react\";import{DataObserverContext as __legacyOverrideHOC_DataObserverContext}from\"framer\";export function withwithHideIfEmpty(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...withHideIfEmpty(props)});};}withwithHideIfEmpty.displayName=\"withHideIfEmpty\";export function withwithAutoHideRow(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...withAutoHideRow(props)});};}withwithAutoHideRow.displayName=\"withAutoHideRow\";export function withwithAutoHideGallery(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...withAutoHideGallery(props)});};}withwithAutoHideGallery.displayName=\"withAutoHideGallery\";export function withwithHideIfCollectionListEmpty(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...withHideIfCollectionListEmpty(props)});};}withwithHideIfCollectionListEmpty.displayName=\"withHideIfCollectionListEmpty\";\nexport const __FramerMetadata__ = {\"exports\":{\"withwithHideIfCollectionListEmpty\":{\"type\":\"reactHoc\",\"name\":\"withwithHideIfCollectionListEmpty\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHideIfCollectionListEmpty\":{\"type\":\"override\",\"name\":\"withHideIfCollectionListEmpty\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withwithAutoHideGallery\":{\"type\":\"reactHoc\",\"name\":\"withwithAutoHideGallery\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withwithAutoHideRow\":{\"type\":\"reactHoc\",\"name\":\"withwithAutoHideRow\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withAutoHideRow\":{\"type\":\"override\",\"name\":\"withAutoHideRow\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withAutoHideGallery\":{\"type\":\"override\",\"name\":\"withAutoHideGallery\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHideIfEmpty\":{\"type\":\"override\",\"name\":\"withHideIfEmpty\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withwithHideIfEmpty\":{\"type\":\"reactHoc\",\"name\":\"withwithHideIfEmpty\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ConditionalVisibility.map"],"mappings":"A,oNAAkM,SAASmB,EAAW,EAAG,CAA2C,MAAvC,CAACC,GAAI,OAAOA,GAAK,SAAgB,GAAY,QAAQA,GAAI,OAAOA,EAAG,KAAM,QAAS,CAY8oD,SAAgBC,EAAoB,EAAE,CAAC,MAAO,KAAQT,EAA+BZ,CAAuC,EAASC,EAAKqB,EAAE,CAAC,GAAGC,EAAM,GAAGC,EAAgBD,CAAK,CAAC,CAAC,EAAI,CAAmD,SAAgBE,EAAoB,EAAE,CAAC,MAAO,KAAQb,EAA+BZ,CAAuC,EAASC,EAAKqB,EAAE,CAAC,GAAGC,EAAM,GAAGG,EAAgBH,CAAK,CAAC,CAAC,EAAI,CAAmD,SAAgBI,EAAwB,EAAE,CAAC,MAAO,KAAQf,EAA+BZ,CAAuC,EAASC,EAAKqB,EAAE,CAAC,GAAGC,EAAM,GAAGK,EAAoBL,CAAK,CAAC,CAAC,EAAI,CAA2D,SAAgBM,EAAkC,EAAE,CAAC,MAAO,KAAQjB,EAA+BZ,CAAuC,EAASC,EAAKqB,EAAE,CAAC,GAAGC,EAAM,GAAGO,EAA8BP,CAAK,CAAC,CAAC,EAAI,C,0DAZrhF,EAAgB,GAAuBJ,EAAWI,EAAM,UAAU,GAAG,OAAOA,EAAM,KAAM,UAAUA,EAAM,IAAI,OAAO,GAAG,OAAOA,EAAM,iBAAkB,UAAUA,EAAM,gBAAgB,OAAO,GAAGA,EAAM,kBAAkB,OAAyB,CAAC,EAAQ,CAAC,MAAM,CAAC,GAAGA,EAAM,MAAM,QAAQ,MAAM,CAAC,EAG5kB,EAAgB,GAAO,CAAC,IAAMS,EAAI9B,EAAO,IAAI,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