{"version":3,"file":"withMouseParallax.CGedjNsT.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/GEUTVtWgPKTlXPMKV7F2/LZmQBb3wuXuMYyAT9Ij1/withMouseParallax.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{motion,useMotionValue,useSpring}from\"framer-motion\";import{useEffect,useRef,useState}from\"react\";export function withMouseParallax(Component){return props=>{const wrapperRef=useRef(null);const[enabled,setEnabled]=useState(false);const posX=useMotionValue(0);const posY=useMotionValue(0);const elScale=useMotionValue(0);const springValue={damping:40,mass:1,stiffness:500};const x=useSpring(posX,springValue);const y=useSpring(posY,springValue);const scale=useSpring(elScale,springValue);const offsetFactor=4;const onMouseMove=e=>{var _wrapperRef_current;const rect=(_wrapperRef_current=wrapperRef.current)===null||_wrapperRef_current===void 0?void 0:_wrapperRef_current.getBoundingClientRect();x.set((e.clientX-rect.left-rect.width/2)/offsetFactor);y.set((e.clientY-rect.top-rect.height/2)/offsetFactor);};const onMouseOver=()=>{scale.set(1);};const onMouseOut=()=>{scale.set(0);};useEffect(()=>{if(window.matchMedia(\"(pointer: fine)\").matches){setEnabled(true);}else{setEnabled(false);}});return /*#__PURE__*/_jsx(Component,{...props,style:{...props.style},onMouseOver:enabled?onMouseOver:undefined,onMouseOut:enabled?onMouseOut:undefined,onMouseMove:enabled?onMouseMove:undefined,children:/*#__PURE__*/_jsx(motion.div,{ref:wrapperRef,style:{pointerEvents:\"none\",x,y,scale},initial:false,children:props.children})});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withMouseParallax\":{\"type\":\"reactHoc\",\"name\":\"withMouseParallax\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./withMouseParallax.map"],"mappings":"6MAAmJ,SAAgB,EAAkB,EAAU,CAAC,MAAO,IAAO,CAAC,IAAM,EAAWA,EAAO,IAAI,EAAO,CAAC,EAAQ,GAAYC,EAAS,EAAK,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