{"version":3,"file":"CursorSpotlightBackground.DriFCVe6.mjs","names":["useRef","useMemo","useCallback"],"sources":["https:/framerusercontent.com/modules/6JPcwOb04dvvfSowWCoa/BSA8M6k5ZNLKPeRUdMGS/CursorSpotlightBackground.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useCallback,useEffect,useMemo,useRef}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{motion,useInView,useMotionTemplate,useMotionValue,useReducedMotion,useSpring}from\"framer-motion\";function toRgba(color,opacity){const clampedOpacity=Math.max(0,Math.min(1,opacity));if(color.startsWith(\"#\")){let hex=color.slice(1);if(hex.length===3){hex=hex.split(\"\").map(char=>char+char).join(\"\");}if(hex.length===6){const r=Number.parseInt(hex.slice(0,2),16);const g=Number.parseInt(hex.slice(2,4),16);const b=Number.parseInt(hex.slice(4,6),16);return`rgba(${r}, ${g}, ${b}, ${clampedOpacity})`;}}if(color.startsWith(\"rgb(\")){const values=color.replace(\"rgb(\",\"\").replace(\")\",\"\").split(\",\").map(value=>value.trim());if(values.length===3){return`rgba(${values[0]}, ${values[1]}, ${values[2]}, ${clampedOpacity})`;}}if(color.startsWith(\"rgba(\")){const values=color.replace(\"rgba(\",\"\").replace(\")\",\"\").split(\",\").map(value=>value.trim());if(values.length>=3){return`rgba(${values[0]}, ${values[1]}, ${values[2]}, ${clampedOpacity})`;}}return color;}/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function CursorSpotlightBackground(props){const{style,baseColor,spotlightColor,ambientColor,spotlightOpacity,ambientOpacity,spotlightSize}=props;const containerRef=useRef(null);const isStaticRenderer=useIsStaticRenderer();const shouldReduceMotion=useReducedMotion();const isInView=useInView(containerRef,{amount:.05});const x=useMotionValue(0);const y=useMotionValue(0);const springX=useSpring(x,{stiffness:120,damping:28,mass:.7});const springY=useSpring(y,{stiffness:120,damping:28,mass:.7});const spotlightTint=useMemo(()=>toRgba(spotlightColor,spotlightOpacity),[spotlightColor,spotlightOpacity]);const ambientTint=useMemo(()=>toRgba(ambientColor,ambientOpacity),[ambientColor,ambientOpacity]);const cyanTint=useMemo(()=>toRgba(\"#7DEBFF\",ambientOpacity*.35),[ambientOpacity]);const spotlightGradient=useMotionTemplate`radial-gradient(circle ${spotlightSize}px at ${springX}px ${springY}px, ${spotlightTint} 0%, rgba(0, 0, 0, 0) 70%)`;const setCenter=useCallback(()=>{const node=containerRef.current;if(!node)return;const rect=node.getBoundingClientRect();x.set(rect.width/2);y.set(rect.height/2);},[x,y]);useEffect(()=>{if(typeof window!==\"undefined\"){setCenter();}},[setCenter]);useEffect(()=>{if(typeof window===\"undefined\"||isStaticRenderer||shouldReduceMotion||!isInView){return;}const handleMove=event=>{const node=containerRef.current;if(!node)return;const rect=node.getBoundingClientRect();const nextX=Math.min(Math.max(0,event.clientX-rect.left),rect.width);const nextY=Math.min(Math.max(0,event.clientY-rect.top),rect.height);x.set(nextX);y.set(nextY);};const handleResize=()=>{setCenter();};window.addEventListener(\"pointermove\",handleMove,{passive:true});window.addEventListener(\"resize\",handleResize);return()=>{window.removeEventListener(\"pointermove\",handleMove);window.removeEventListener(\"resize\",handleResize);};},[isInView,isStaticRenderer,setCenter,shouldReduceMotion,x,y]);const rootStyle=useMemo(()=>({...style,position:\"relative\",width:style?.width??\"100%\",height:style?.height??\"100%\",overflow:\"hidden\",pointerEvents:\"none\",backgroundColor:baseColor,isolation:\"isolate\"}),[style,baseColor]);return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:rootStyle,\"aria-hidden\":true,children:[/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",inset:0,pointerEvents:\"none\",background:`\n                        radial-gradient(120% 90% at 18% 12%, ${ambientTint} 0%, rgba(0, 0, 0, 0) 62%),\n                        radial-gradient(90% 70% at 78% 82%, ${cyanTint} 0%, rgba(0, 0, 0, 0) 68%)\n                    `}}),/*#__PURE__*/_jsx(motion.div,{style:{position:\"absolute\",inset:0,pointerEvents:\"none\",background:shouldReduceMotion||isStaticRenderer?\"none\":spotlightGradient}})]});}addPropertyControls(CursorSpotlightBackground,{baseColor:{type:ControlType.Color,title:\"Base Color\",defaultValue:\"#07090D\"},spotlightColor:{type:ControlType.Color,title:\"Spotlight\",defaultValue:\"#4A77FF\"},ambientColor:{type:ControlType.Color,title:\"Ambient\",defaultValue:\"#3F5FE0\"},spotlightOpacity:{type:ControlType.Number,title:\"Spot Opacity\",defaultValue:.18,min:0,max:1,step:.01},ambientOpacity:{type:ControlType.Number,title:\"Amb Opacity\",defaultValue:.12,min:0,max:1,step:.01},spotlightSize:{type:ControlType.Number,title:\"Spot Size\",defaultValue:520,min:180,max:1200,step:10,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CursorSpotlightBackground\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CursorSpotlightBackground.map"],"mappings":"2SAAiS,SAAS,EAAO,EAAM,EAAQ,CAAC,IAAM,EAAe,KAAK,IAAI,EAAE,KAAK,IAAI,EAAE,CAAO,CAAC,EAAE,GAAG,EAAM,WAAW,GAAG,EAAE,CAAC,IAAI,EAAI,EAAM,MAAM,CAAC,EAAsE,GAAjE,EAAI,SAAS,IAAG,EAAI,EAAI,MAAM,EAAE,CAAC,CAAC,IAAI,GAAM,EAAK,CAAI,CAAC,CAAC,KAAK,EAAE,GAAM,EAAI,SAAS,EAAoI,MAAM,QAA/H,OAAO,SAAS,EAAI,MAAM,EAAE,CAAC,EAAE,EAAwG,EAAE,IAA9F,OAAO,SAAS,EAAI,MAAM,EAAE,CAAC,EAAE,EAAmE,EAAE,IAAzD,OAAO,SAAS,EAAI,MAAM,EAAE,CAAC,EAAE,EAA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