{"version":3,"file":"ConditionalVisibility.Dc_fr8AI.mjs","names":["__legacyOverrideHOC_DataObserverContext","_jsx","useRef","useState","useCallback"],"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":"+MAAkM,SAAS,EAAW,EAAG,CAA2C,MAAvC,CAAC,GAAI,OAAO,GAAK,SAAgB,GAAY,QAAQ,GAAI,OAAO,EAAG,KAAM,QAAS,CAY8oD,SAAgB,EAA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