{"version":3,"file":"FireOnView.CbZ2RHiR.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/w0i3wJpUxayc3ej6CwiE/UZJoeDYFkj6WXpZ5LeGA/FireOnView.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";// Keep this aligned with the mobile breakpoint used by the Framer layout.\nconst MOBILE_QUERY=\"(max-width: 809px)\";const MOBILE_ROOT_MARGIN=\"0px 0px 25% 0px\";function useIsMobile(){const[isMobile,setIsMobile]=useState(()=>typeof window!==\"undefined\"?window.matchMedia(MOBILE_QUERY).matches:false);useEffect(()=>{if(typeof window===\"undefined\")return;const mediaQuery=window.matchMedia(MOBILE_QUERY);const onChange=()=>setIsMobile(mediaQuery.matches);onChange();mediaQuery.addEventListener(\"change\",onChange);return()=>mediaQuery.removeEventListener(\"change\",onChange);},[]);return isMobile;}export function withMountOnLoad(Component){return props=>{return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\"},children:/*#__PURE__*/_jsx(Component,{...props})});};}export function withMountOnceInView(Component){return props=>{const ref=useRef(null);const[inView,setInView]=useState(false);const isMobile=useIsMobile();// Expand only mobile's lower viewport edge. The component therefore\n// mounts about a quarter viewport before the thumb reaches it, while\n// the 10% threshold remains safely earlier than the 25%-in-view goal.\nconst rootMargin=isMobile?MOBILE_ROOT_MARGIN:\"0px\";useEffect(()=>{const el=ref.current;if(!el||inView)return;const io=new IntersectionObserver(([entry])=>{if(entry.isIntersecting){setInView(true);io.disconnect();}},{threshold:.1,rootMargin});io.observe(el);return()=>io.disconnect();},[inView,rootMargin]);return /*#__PURE__*/_jsx(\"div\",{ref:ref,style:{width:\"100%\",height:\"100%\"},children:inView&&/*#__PURE__*/_jsx(Component,{...props})});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withMountOnceInView\":{\"type\":\"reactHoc\",\"name\":\"withMountOnceInView\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withMountOnLoad\":{\"type\":\"reactHoc\",\"name\":\"withMountOnLoad\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FireOnView.map"],"mappings":"8IACmF,SAAS,GAAa,CAAC,GAAK,CAAC,EAAS,GAAaA,MAAoB,IAAS,QAAY,EAAO,WAAW,CAAY,CAAC,CAAC,OAAa,EAAuR,OAArR,MAAc,CAAC,GAAU,IAAS,OAAY,OAAO,IAAM,EAAW,EAAO,WAAW,CAAY,EAAQ,MAAa,EAAY,EAAW,OAAO,EAA4D,OAA1D,EAAS,EAAE,EAAW,iBAAiB,SAAS,CAAQ,MAAY,EAAW,oBAAoB,SAAS,CAAQ,CAAE,EAAE,CAAC,CAAC,EAAS,CAAS,CAAoL,SAAgB,EAAoB,EAAU,CAAC,MAAO,IAAO,CAAC,IAAM,EAAIC,EAAO,IAAI,EAAO,CAAC,EAAO,GAAWD,EAAS,EAAK,EAG5yB,EAH6zB,EAG3yB,EAAE,EAAmB,MAAqQ,OAA/P,MAAc,CAAC,IAAM,EAAG,EAAI,QAAQ,GAAG,CAAC,GAAI,EAAO,OAAO,IAAM,EAAG,IAAI,sBAAsB,CAAC,KAAS,CAAI,EAAM,iBAAgB,EAAU,EAAI,EAAE,EAAG,WAAW,EAAG,EAAE,CAAC,UAAU,GAAG,YAAU,CAAC,EAAiB,OAAf,EAAG,QAAQ,CAAE,MAAY,EAAG,WAAW,CAAE,EAAE,CAAC,EAAO,CAAU,CAAC,EAAsB,EAAK,MAAM,CAAK,MAAI,MAAM,CAAC,MAAM,OAAO,OAAO,MAAM,EAAE,SAAS,GAAqB,EAAK,EAAU,CAAC,GAAG,CAAK,CAAC,CAAC,CAAC,CAAE,CAAE,yBAJhZ,IAA6C,EACjF,EAAa,qBAA2B,EAAmB"}