{"version":3,"file":"HoverButton.P68i8Mut.mjs","names":["useStore","useState","useRef","useState"],"sources":["https:/framerusercontent.com/modules/vj7bFUjvEQFgEzNBkdoG/vf3CKm378wlVcBk7IhSU/createStore.js","https:/framer.com/m/framer/store.js@^1.0.0","https:/framerusercontent.com/modules/wFHc7x7ljaC9ZxUFhZxf/QgmXalrpV9Iwe3qJK5gF/HoverButton.js"],"sourcesContent":["import{useState,useEffect}from\"react\";import{Data,useObserveData}from\"framer\";export function createStore(state1){// Use Data so that a Preview reload resets the state\nconst dataStore=Data({state:Object.freeze({...state1})});// Create a set function that updates the state\nconst setDataStore=newState=>{// If the state is an object, make sure we copy it\nif(typeof newState===\"function\"){newState=newState(dataStore.state);}dataStore.state=Object.freeze({...dataStore.state,...newState});};// Store the initial state, copy the object if it's an object\nlet storeState=typeof state1===\"object\"?Object.freeze({...state1}):state1;// Keep a list of all the listeners, in the form of React hook setters\nconst storeSetters=new Set();// Create a set function that updates all the listeners / setters\nconst setStoreState=newState=>{// If the state is an object, make sure we copy it\nif(typeof newState===\"function\"){newState=newState(storeState);}storeState=typeof newState===\"object\"?Object.freeze({...storeState,...newState}):newState;// Update all the listeners / setters with the new value\nstoreSetters.forEach(setter=>setter(storeState));};// Create the actual hook based on everything above\nfunction useStore(){// Create the hook we are going to use as a listener\nconst[state,setState]=useState(storeState);// If we unmount the component using this hook, we need to remove the listener\n// @ts-ignore\nuseEffect(()=>{// But right now, we need to add the listener\nstoreSetters.add(setState);return()=>storeSetters.delete(setState);},[]);// If Data context exists, use Data, otherwise use vanilla React state\nif(useObserveData()===true){useObserveData();return[dataStore.state,setDataStore];}else{// Return the state and a function to update the central store\nreturn[state,setStoreState];}}return useStore;}\nexport const __FramerMetadata__ = {\"exports\":{\"createStore\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./createStore.map","/*\n * createStore (framer/store@1.0.1)\n *\n * Learn More: https://www.framer.com/asset-urls\n */\n\nexport * from \"https://framerusercontent.com/modules/vj7bFUjvEQFgEzNBkdoG/vf3CKm378wlVcBk7IhSU/createStore.js\"\n","import{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect,useRef}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";// Create a shared store to manage state for mouse position and background position\nconst useStore=createStore({mousePos:{x:0,y:0},backgroundPos:{x:0,y:0}});/**\n * Override to add a hover-fill effect to a component.\n * The effect tracks the mouse position and animates a background shape\n * (e.g., a circular fill) to follow the mouse and appear on hover.\n *\n * @param Component The component to enhance with the hover-fill effect.\n * @returns The enhanced component with hover-fill behavior.\n */export function withFillFollowCursor(Component){return props=>{// Ref to the container element to track its size and position\nconst ref=useRef(null);// Use the shared store for managing state\nconst[store,setStore]=useStore();// Local state to track hover status\nconst[isHover,setIsHover]=useState(null);/**\n         * Handles the mouse entering or moving within the component area.\n         * Updates the mouse position in the store and sets hover state.\n         */const handleMouseOver=event=>{const rect=event.target.getBoundingClientRect();const x=event.clientX-rect.left;const y=event.clientY-rect.top;if(!isHover){setIsHover(true);}setStore({mousePos:{x:x,y:y}});};/**\n         * Handles the mouse leaving the component area.\n         * Updates the mouse position in the store and unsets hover state.\n         */const handleMouseLeave=event=>{const rect=event.target.getBoundingClientRect();const x=event.clientX-rect.left;const y=event.clientY-rect.top;setStore({mousePos:{x:x,y:y}});if(isHover){setIsHover(false);}};/**\n         * Reacts to hover state changes to update the background's position.\n         * Background position is synchronized with the current mouse position.\n         */useEffect(()=>{const x=store.mousePos.x;const y=store.mousePos.y;setStore({backgroundPos:{x:x,y:y}});},[isHover]);// Styles for the container to occupy full area\nconst containerStyle={width:\"100%\",height:\"100%\",position:\"absolute\"};// Render the wrapped component with hover-fill behavior\nreturn /*#__PURE__*/_jsx(\"div\",{ref:ref,style:containerStyle,onMouseOver:handleMouseOver,onMouseLeave:handleMouseLeave,children:/*#__PURE__*/_jsx(Component,{...props,style:{...props.style,position:\"absolute\",minWidth:\"225%\",aspectRatio:1,pointerEvents:\"none\",borderRadius:\"50%\",visibility:isHover?\"visible\":\"hidden\",transformOrigin:\"center center\",top:store.backgroundPos.y,left:store.backgroundPos.x},animate:{scale:isHover?1:0},/* ADJUST THE ANIMATION BEHAVIOUR HERE */transition:{default:{type:\"tween\",duration:.4,ease:\"easeOut\"}}})});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withFillFollowCursor\":{\"type\":\"reactHoc\",\"name\":\"withFillFollowCursor\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HoverButton.map"],"mappings":"yLAA8E,SAAgB,EAAY,EAAO,CACjH,IAAM,EAAU,EAAK,CAAC,MAAM,OAAO,OAAO,CAAC,GAAG,EAAO,CAAC,CAAC,CAAC,CAClD,EAAa,GAAU,CAC1B,OAAO,GAAW,aAAY,EAAS,EAAS,EAAU,MAAM,EAAE,EAAU,MAAM,OAAO,OAAO,CAAC,GAAG,EAAU,MAAM,GAAG,EAAS,CAAC,EAChI,EAAW,OAAO,GAAS,SAAS,OAAO,OAAO,CAAC,GAAG,EAAO,CAAC,CAAC,EAC7D,EAAa,IAAI,IACjB,EAAc,GAAU,CAC3B,OAAO,GAAW,aAAY,EAAS,EAAS,EAAW,EAAE,EAAW,OAAO,GAAW,SAAS,OAAO,OAAO,CAAC,GAAG,EAAW,GAAG,EAAS,CAAC,CAAC,EACjJ,EAAa,QAAQ,GAAQ,EAAO,EAAW,CAAC,EAChD,SAASA,GAAU,CACnB,GAAK,CAAC,EAAM,GAAUC,EAAS,EAAW,CAK1C,OAHA,OACA,EAAa,IAAI,EAAS,KAAW,EAAa,OAAO,EAAS,EAAG,EAAE,CAAC,CACrE,GAAgB,GAAG,IAAM,GAAgB,CAAO,CAAC,EAAU,MAAM,EAAa,EAC3E,CAAC,EAAM,EAAc,CAAG,OAAOD,mBAfC,IAAwC,qBEQ3E,SAAgB,EAAqB,EAAU,CA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