{"version":3,"file":"PhoneFluidShell.Dm1DQG4p.mjs","names":["useRef","useCallback"],"sources":["https:/framerusercontent.com/modules/dJrAWdW24ppUynbLpthm/PbcC1jKe0rNcpZCVqvcP/PhoneFluidShell.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useCallback,useEffect,useRef}from\"react\";export function PhoneFluidShell(Component){return /*#__PURE__*/forwardRef(function PhoneFluidShellOverride(props,ref){const rootRef=useRef(null);const savedStylesRef=useRef(new Map);const debounceTimerRef=useRef(null);const isApplyingRef=useRef(false);const lastAppliedWidthRef=useRef(null);const lastIsPhoneRef=useRef(null);const setCombinedRef=useCallback(node=>{rootRef.current=node;if(typeof ref===\"function\"){ref(node);}else if(ref&&typeof ref===\"object\"){ref.current=node;}},[ref]);useEffect(()=>{if(typeof window===\"undefined\")return;const PHONE_MAX_WIDTH=599;const WIDTH_TOLERANCE=1;const WIDTH_CHANGE_THRESHOLD=2;const DEBOUNCE_MS=150;const propsToManage=[\"width\",\"max-width\",\"min-width\",\"margin-left\",\"margin-right\"];const restoreAll=()=>{savedStylesRef.current.forEach((styleMap,element)=>{styleMap.forEach((saved,prop)=>{if(saved.value){element.style.setProperty(prop,saved.value,saved.priority);}else{element.style.removeProperty(prop);}});});savedStylesRef.current.clear();};const savePropIfNeeded=(element,prop)=>{let styleMap=savedStylesRef.current.get(element);if(!styleMap){styleMap=new Map;savedStylesRef.current.set(element,styleMap);}if(!styleMap.has(prop)){styleMap.set(prop,{value:element.style.getPropertyValue(prop),priority:element.style.getPropertyPriority(prop)});}};const applyWidthToElement=(element,viewportWidth)=>{const px=`${Math.round(viewportWidth)}px`;propsToManage.forEach(prop=>savePropIfNeeded(element,prop));element.style.setProperty(\"width\",px,\"important\");element.style.setProperty(\"max-width\",px,\"important\");element.style.setProperty(\"min-width\",\"0px\",\"important\");element.style.setProperty(\"margin-left\",\"0px\",\"important\");element.style.setProperty(\"margin-right\",\"0px\",\"important\");};const applyPhoneFluidShell=()=>{if(isApplyingRef.current)return;const root=rootRef.current;if(!root)return;const viewportWidth=Math.round(window.innerWidth);const isPhone=viewportWidth<=PHONE_MAX_WIDTH;const lastIsPhone=lastIsPhoneRef.current;const lastWidth=lastAppliedWidthRef.current;const isStatusChanged=lastIsPhone===null||lastIsPhone!==isPhone;const isWidthChangedEnough=lastWidth===null||Math.abs(viewportWidth-lastWidth)>=WIDTH_CHANGE_THRESHOLD;if(!isStatusChanged&&!isWidthChangedEnough)return;isApplyingRef.current=true;if(!isPhone){if(lastIsPhoneRef.current){restoreAll();}lastIsPhoneRef.current=false;lastAppliedWidthRef.current=viewportWidth;isApplyingRef.current=false;return;}restoreAll();applyWidthToElement(root,viewportWidth);let ancestor=root.parentElement;let patchedAncestors=0;while(ancestor&&patchedAncestors<4){const ancestorWidth=ancestor.getBoundingClientRect().width;if(ancestorWidth<viewportWidth-WIDTH_TOLERANCE){applyWidthToElement(ancestor,viewportWidth);patchedAncestors+=1;}ancestor=ancestor.parentElement;}lastIsPhoneRef.current=true;lastAppliedWidthRef.current=viewportWidth;isApplyingRef.current=false;};applyPhoneFluidShell();const scheduleApply=()=>{if(debounceTimerRef.current!==null){window.clearTimeout(debounceTimerRef.current);}debounceTimerRef.current=window.setTimeout(()=>{debounceTimerRef.current=null;applyPhoneFluidShell();},DEBOUNCE_MS);};window.addEventListener(\"resize\",scheduleApply);window.addEventListener(\"orientationchange\",scheduleApply);return()=>{window.removeEventListener(\"resize\",scheduleApply);window.removeEventListener(\"orientationchange\",scheduleApply);if(debounceTimerRef.current!==null){window.clearTimeout(debounceTimerRef.current);debounceTimerRef.current=null;}restoreAll();};},[]);return /*#__PURE__*/_jsx(Component,{...props,ref:setCombinedRef,style:{...props.style}});});}\nexport const __FramerMetadata__ = {\"exports\":{\"PhoneFluidShell\":{\"type\":\"reactHoc\",\"name\":\"PhoneFluidShell\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./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