{"version":3,"file":"CustomCursor.DbC5_9l5.mjs","names":["useState","useRef","useMemo"],"sources":["https:/framerusercontent.com/modules/g2xCHXMOOLckr4brjFj2/9s2uXOoemBZd1kUW05eE/CustomCursor.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect,useRef,useMemo}from\"react\";import{addPropertyControls,ControlType}from\"framer\";const CONTAINER_PATTERN=/framer-\\w+-container/;/**\n * Custom Cursor\n *\n * A custom cursor component that replaces the default cursor with\n * a styled arrow + label. The label text is randomized from a\n * configurable list each time the user enters the page.\n *\n * Place this component on your page and stretch it to fill the frame.\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function CustomCursor(props){const{texts=[\"Cool guy\"],cursorColor=\"#FF5041\",borderColor=\"#000000\",textColor=\"#000000\",fontSize=9,hideBubbleLayerNames=[],hideOnComponents=true}=props;const[currentText,setCurrentText]=useState(\"\");const cursorRef=useRef(null);const bubbleRef=useRef(null);const isVisibleRef=useRef(false);const bubbleVisibleRef=useRef(true);const pointerRef=useRef({x:0,y:0});// Pre-compute the layer name selector\nconst layerSelector=useMemo(()=>{return hideBubbleLayerNames.filter(n=>n&&n.trim()).map(n=>`[data-framer-name=\"${n.trim()}\"]`).join(\", \");},[hideBubbleLayerNames]);// Randomize text on mount (each page visit)\nuseEffect(()=>{const validTexts=texts.filter(t=>t&&t.trim()!==\"\");if(validTexts.length>0){const randomIndex=Math.floor(Math.random()*validTexts.length);setCurrentText(validTexts[randomIndex]);}},[]);useEffect(()=>{// ── Movement ─────────────────────────────────────────────────\n// mousemove only records the position; a persistent rAF loop\n// writes the transform. The loop does NOTHING else — no layout\n// reads — so it can never cause a reflow or get slowed by one.\nconst handleMouseMove=e=>{pointerRef.current.x=e.clientX;pointerRef.current.y=e.clientY;if(!isVisibleRef.current){isVisibleRef.current=true;if(cursorRef.current){cursorRef.current.style.opacity=\"1\";}}};let raf=requestAnimationFrame(function tick(){const{x,y}=pointerRef.current;if(cursorRef.current){cursorRef.current.style.transform=`translate(${x}px, ${y}px)`;}raf=requestAnimationFrame(tick);});// ── Hover detection (event-driven, zero layout reads) ───────\n// Previous versions polled document.elementFromPoint(), which\n// forces a synchronous style+layout pass. While a Framer hover\n// animation dirties layout every frame, that poll caused long\n// main-thread stalls and froze the cursor. pointerover fires\n// only on element-boundary crossings, and closest()/className\n// walks read the DOM tree without touching layout.\nconst setBubbleVisible=visible=>{if(bubbleVisibleRef.current===visible)return;bubbleVisibleRef.current=visible;if(bubbleRef.current){bubbleRef.current.style.opacity=visible?\"1\":\"0\";}};const handlePointerOver=e=>{const el=e.target;if(!el||!(el instanceof Element))return;let shouldHide=false;if(layerSelector&&el.closest(layerSelector)){shouldHide=true;}if(!shouldHide&&hideOnComponents){if(el.closest(\"a[href], button, [role='button'], [role='link']\")){shouldHide=true;}}if(!shouldHide&&hideOnComponents){let cur=el;let depth=0;while(cur&&cur!==document.body&&depth<15){const cls=cur.className;if(typeof cls===\"string\"&&CONTAINER_PATTERN.test(cls)){shouldHide=true;break;}cur=cur.parentElement;depth++;}}setBubbleVisible(!shouldHide);};const handleMouseLeave=()=>{isVisibleRef.current=false;if(cursorRef.current){cursorRef.current.style.opacity=\"0\";}};const handleMouseEnter=()=>{isVisibleRef.current=true;if(cursorRef.current){cursorRef.current.style.opacity=\"1\";}};// Inject global style to hide native cursor\nconst style=document.createElement(\"style\");style.id=\"custom-cursor-hide\";style.textContent=\"*, *::before, *::after { cursor: none !important; }\";document.head.appendChild(style);window.addEventListener(\"mousemove\",handleMouseMove,{passive:true});window.addEventListener(\"pointerover\",handlePointerOver,{passive:true,capture:true});document.addEventListener(\"mouseleave\",handleMouseLeave);document.addEventListener(\"mouseenter\",handleMouseEnter);return()=>{window.removeEventListener(\"mousemove\",handleMouseMove);window.removeEventListener(\"pointerover\",handlePointerOver,{capture:true});document.removeEventListener(\"mouseleave\",handleMouseLeave);document.removeEventListener(\"mouseenter\",handleMouseEnter);const el=document.getElementById(\"custom-cursor-hide\");if(el)el.remove();cancelAnimationFrame(raf);};},[hideOnComponents,layerSelector]);return /*#__PURE__*/_jsx(\"div\",{style:{position:\"fixed\",inset:0,pointerEvents:\"none\",zIndex:999999},children:/*#__PURE__*/_jsxs(\"div\",{ref:cursorRef,style:{position:\"absolute\",left:0,top:0,opacity:0,willChange:\"transform\"},children:[/*#__PURE__*/_jsx(\"svg\",{width:\"32\",height:\"32\",viewBox:\"0 0 32 32\",fill:\"none\",xmlns:\"http://www.w3.org/2000/svg\",style:{display:\"block\",overflow:\"visible\"},children:/*#__PURE__*/_jsx(\"path\",{d:\"M6.17292 4.45456C6.72169 4.35931 7.28628 4.41896 7.80321 4.62636L7.80346 4.6273L26.3611 12.0811C29.0347 13.1543 28.8031 17.0177 26.0203 17.7633L18.3948 19.8066C18.2468 19.8462 18.1093 19.9192 17.994 20.0201C17.8793 20.1206 17.788 20.2457 17.7292 20.3863L17.7304 20.387L14.6309 27.874C13.5352 30.5232 9.70372 30.2714 8.9617 27.5025L3.78822 8.18724L3.74098 7.98455C3.64813 7.50798 3.67273 7.0148 3.81299 6.54781C3.97325 6.01425 4.27853 5.53554 4.69535 5.16591C5.1122 4.79627 5.62399 4.54985 6.17292 4.45456Z\",fill:cursorColor,stroke:borderColor,strokeWidth:\"2\"})}),/*#__PURE__*/_jsx(\"div\",{ref:bubbleRef,style:{position:\"absolute\",left:21,top:23,background:cursorColor,border:`2px solid ${borderColor}`,borderRadius:\"4px 16px 16px 14px\",padding:8,whiteSpace:\"nowrap\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",overflow:\"hidden\",opacity:1,transition:\"opacity 0.15s ease\"},children:/*#__PURE__*/_jsx(\"span\",{style:{fontFamily:\"'Poppins', sans-serif\",fontWeight:600,fontSize:fontSize,color:textColor,lineHeight:\"0.94em\",textAlign:\"center\"},children:currentText})})]})});}addPropertyControls(CustomCursor,{texts:{type:ControlType.Array,title:\"Texts\",control:{type:ControlType.String},defaultValue:[\"Cool guy\",\"Hello!\",\"Nice to meet you\"]},cursorColor:{type:ControlType.Color,title:\"Cursor Color\",defaultValue:\"#FF5041\"},borderColor:{type:ControlType.Color,title:\"Border Color\",defaultValue:\"#000000\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},fontSize:{type:ControlType.Number,title:\"Font Size\",defaultValue:9,min:6,max:24,step:1},hideOnComponents:{type:ControlType.Boolean,title:\"Hide on Components\",defaultValue:true,description:\"Auto-hide bubble when hovering over Framer components\"},hideBubbleLayerNames:{type:ControlType.Array,title:\"Hide Bubble Layers\",control:{type:ControlType.String},defaultValue:[],description:\"Additional Framer layer names where the bubble hides\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CustomCursor\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CustomCursor.map"],"mappings":"+MAWG,SAAwB,EAAa,EAAM,CAAC,GAAK,CAAC,QAAM,CAAC,UAAU,EAAE,cAAY,UAAU,cAAY,UAAU,YAAU,UAAU,WAAS,EAAE,uBAAqB,CAAC,EAAE,mBAAiB,IAAM,EAAW,CAAC,EAAY,GAAgBA,EAAS,EAAE,EAAQ,EAAUC,EAAO,IAAI,EAAQ,EAAUA,EAAO,IAAI,EAAQ,EAAaA,EAAO,EAAK,EAAQ,EAAiBA,EAAO,EAAI,EAAQ,EAAWA,EAAO,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EACjZ,EAAcC,MAAoB,EAAqB,OAAO,GAAG,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,GAAG,sBAAsB,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,KAAK,IAAI,EAAI,CAAC,CAAoB,CAAC,EAa2qB,OAZ70B,MAAc,CAAC,IAAM,EAAW,EAAM,OA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