{"version":3,"file":"HeaderBannerLogic.qBHeDFVh.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/g5rsU9UI6PMR7MgRilK8/D3PTPIJOBpFBHL4iq6lW/HeaderBannerLogic.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState,useRef}from\"react\";import{animate,useMotionValue}from\"framer\";const BANNER_VISIBILITY_EVENT=\"bannerVisibilityChanged\";let bannerVisible=false// banner hidden by default\n;function notifyBannerVisibility(visible){if(visible!==bannerVisible){bannerVisible=visible;document.dispatchEvent(new CustomEvent(BANNER_VISIBILITY_EVENT,{detail:visible}));}}export function setBannerVisibility(visible){notifyBannerVisibility(visible);}// 🔹 Banner override — only renders when visible\nexport function withStickyBanner(Component){return function BannerWrapper(props){const[visible,setVisible]=useState(bannerVisible);useEffect(()=>{const onChange=e=>setVisible(e.detail);document.addEventListener(BANNER_VISIBILITY_EVENT,onChange);return()=>document.removeEventListener(BANNER_VISIBILITY_EVENT,onChange);},[]);if(!visible)return null;return /*#__PURE__*/_jsx(Component,{...props});};}// 🔹 Close button override\nexport function withCloseBanner(Component){return function CloseButtonWrapper(props){const style={...props.style,cursor:\"pointer\",pointerEvents:\"auto\"};const handleClick=e=>{setBannerVisibility(false);if(props.onClick)props.onClick(e);};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick,style:style});};}// 🔹 Sticky top override\nexport function withStickyOffset(Component){return function StickyOffsetWrapper(props){const[visible,setVisible]=useState(bannerVisible);const top=useMotionValue(80)// default for tablet/mobile\n;const ref=useRef(null);const[isSticky,setIsSticky]=useState(false);useEffect(()=>{const onChange=e=>setVisible(e.detail);document.addEventListener(BANNER_VISIBILITY_EVENT,onChange);return()=>document.removeEventListener(BANNER_VISIBILITY_EVENT,onChange);},[]);function updateTop(){if(!ref.current)return;const computed=getComputedStyle(ref.current);const reallySticky=computed.position===\"sticky\";setIsSticky(reallySticky);const width=window.innerWidth;const isDesktop=width>=1080;let newTop=80// tablet/mobile default\n;if(reallySticky){newTop=isDesktop?visible?132:83:80;}animate(top,newTop,{duration:.3});}useEffect(()=>{updateTop();},[visible]);useEffect(()=>{window.addEventListener(\"resize\",updateTop);return()=>window.removeEventListener(\"resize\",updateTop);},[]);const finalStyle={...props.style||{},...isSticky?{top}:{}};return /*#__PURE__*/_jsx(Component,{...props,ref:ref,style:finalStyle});};}// 🔹 Y shift override\nexport function withYShiftOnBanner(Component){return function YShiftWrapper(props){const[visible,setVisible]=useState(bannerVisible);const y=useMotionValue(visible?132:83);useEffect(()=>{const onChange=e=>setVisible(e.detail);document.addEventListener(BANNER_VISIBILITY_EVENT,onChange);return()=>document.removeEventListener(BANNER_VISIBILITY_EVENT,onChange);},[]);useEffect(()=>{const width=window.innerWidth;const isDesktop=width>=1080;const newY=isDesktop?visible?132:83:80;animate(y,newY,{duration:.3});},[visible]);return /*#__PURE__*/_jsx(Component,{...props,style:{...props.style||{},y}});};}// export function withScrollMarginTop(\n//     Component: ComponentType<any>\n// ): ComponentType<any> {\n//     return function ScrollMarginTopWrapper(props) {\n//         const [visible, setVisible] = useState(bannerVisible)\n//         const scrollMarginTop = useMotionValue(83)\n//         const [marginValue, setMarginValue] = useState(scrollMarginTop.get())\n//         useEffect(() => {\n//             const onChange = (e: CustomEvent<boolean>) => setVisible(e.detail)\n//             document.addEventListener(\n//                 BANNER_VISIBILITY_EVENT,\n//                 onChange as EventListener\n//             )\n//             return () => {\n//                 document.removeEventListener(\n//                     BANNER_VISIBILITY_EVENT,\n//                     onChange as EventListener\n//                 )\n//             }\n//         }, [])\n//         useEffect(() => {\n//             const width = window.innerWidth\n//             const isDesktop = width >= 1080\n//             const target = isDesktop ? (visible ? 132 : 83) : 80\n//             animate(scrollMarginTop, target, { duration: 0.3 })\n//             const unsubscribe = scrollMarginTop.on(\"change\", (latest) => {\n//                 setMarginValue(latest)\n//             })\n//             return () => unsubscribe()\n//         }, [visible])\n//         return (\n//             <div style={{ scrollMarginTop: `${marginValue}px` }}>\n//                 <Component {...props} />\n//             </div>\n//         )\n//     }\n// }\n\nexport const __FramerMetadata__ = {\"exports\":{\"withCloseBanner\":{\"type\":\"reactHoc\",\"name\":\"withCloseBanner\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withStickyBanner\":{\"type\":\"reactHoc\",\"name\":\"withStickyBanner\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withYShiftOnBanner\":{\"type\":\"reactHoc\",\"name\":\"withYShiftOnBanner\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"setBannerVisibility\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withStickyOffset\":{\"type\":\"reactHoc\",\"name\":\"withStickyOffset\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HeaderBannerLogic.map"],"mappings":"0OACC,SAAS,EAAuB,EAAQ,CAAI,IAAU,IAAe,EAAc,EAAQ,SAAS,cAAc,IAAI,YAAY,EAAwB,CAAC,OAAO,EAAQ,CAAC,CAAC,EAAG,SAAgB,EAAoB,EAAQ,CAAC,EAAuB,EAAQ,CAC5P,SAAgB,EAAiB,EAAU,CAAC,OAAO,SAAuB,EAAM,CAAC,GAAK,CAAC,EAAQ,GAAYA,EAAS,EAAc,CAA0N,OAAzN,MAAc,CAAC,IAAM,EAAS,GAAG,EAAW,EAAE,OAAO,CAA6D,OAA5D,SAAS,iBAAiB,EAAwB,EAAS,KAAW,SAAS,oBAAoB,EAAwB,EAAS,EAAG,EAAE,CAAC,CAAK,EAAwC,EAAK,EAAU,CAAC,GAAG,EAAM,CAAC,CAAnD,MACvV,SAAgB,EAAgB,EAAU,CAAC,OAAO,SAA4B,EAAM,CAAC,IAAM,EAAM,CAAC,GAAG,EAAM,MAAM,OAAO,UAAU,cAAc,OAAO,CAAO,EAAY,GAAG,CAAC,EAAoB,GAAM,CAAI,EAAM,SAAQ,EAAM,QAAQ,EAAE,EAAG,OAAoB,EAAK,EAAU,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