{"version":3,"file":"WithScrollDirection.BCKgmGYr.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/BaRR2usjYNxBtDEcZgBU/aYEgXwKsGFO8RJFuG0Hc/WithScrollDirection.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";import{useScroll,useMotionValueEvent}from\"framer-motion\";const SCROLL_THRESHOLD=600;function getVariant(width,visible){let size=\"Desktop\";if(width<=799)size=\"Mobile\";else if(width<=1279)size=\"Tablet\";return`${visible?\"Visible\":\"Hidden\"}-${size}`;}export function withScrollDirection(Component){return props=>{const{scrollY}=useScroll();const[width,setWidth]=useState(typeof window!==\"undefined\"?window.innerWidth:1440);const[variant,setVariant]=useState(getVariant(width,false));const[lastY,setLastY]=useState(0);useEffect(()=>{const onResize=()=>setWidth(window.innerWidth);window.addEventListener(\"resize\",onResize);return()=>window.removeEventListener(\"resize\",onResize);},[]);useMotionValueEvent(scrollY,\"change\",current=>{const goingDown=current>lastY;const pastThreshold=current>SCROLL_THRESHOLD;if(goingDown&&pastThreshold){setVariant(getVariant(width,true));}else if(!goingDown){setVariant(getVariant(width,false));}setLastY(current);});return /*#__PURE__*/_jsx(Component,{...props,variant:variant});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withScrollDirection\":{\"type\":\"reactHoc\",\"name\":\"withScrollDirection\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./WithScrollDirection.map"],"mappings":"+LAAqK,SAAS,EAAW,EAAM,EAAQ,CAAC,IAAI,EAAK,UAAwE,OAA3D,GAAO,IAAI,EAAK,SAAiB,GAAO,OAAK,EAAK,UAAe,GAAG,EAAQ,UAAU,SAAS,GAAG,GAAO,CAAC,SAAgB,EAAoB,EAAU,CAAC,MAAO,IAAO,CAAC,GAAK,CAAC,WAAS,EAAU,EAAO,CAAC,EAAM,GAAUA,EAAgB,IAAS,OAA8B,KAAlB,EAAO,UAAe,EAAO,CAAC,EAAQ,GAAYA,EAAS,EAAW,EAAM,EAAK,CAAC,EAAO,CAAC,EAAM,GAAUA,EAAS,CAAC,EAAkb,OAAhb,MAAc,CAAC,IAAM,MAAa,EAAS,EAAO,UAAU,EAA6C,OAA3C,EAAO,iBAAiB,SAAS,CAAQ,MAAY,EAAO,oBAAoB,SAAS,CAAQ,CAAE,EAAE,CAAC,CAAC,EAAE,EAAoB,EAAQ,SAAS,GAAS,CAAC,IAAM,EAAU,EAAQ,EAAsD,GAA5B,EAAQ,EAA8C,EAAW,EAAW,EAAM,EAAI,CAAC,EAAY,GAAW,EAAW,EAAW,EAAM,EAAK,CAAC,EAAG,EAAS,CAAO,CAAE,CAAC,EAAsB,EAAK,EAAU,CAAC,GAAG,EAAc,SAAO,CAAC,CAAE,CAAE,uBAAzhC,IAAsC,IAAyD,EAAO,EAAiB"}