{"version":3,"file":"HoverUnderline.iAxdjWSg.mjs","names":["useState","useRef","useCallback","__esmMin","ne","init_npm_react_18_3_1","te","window","init_jsx_runtime","J","_e","de","init_ssg_sandbox_shims","withHoverUnderline","isHovered","setIsHovered","resolvedUnderlineColor","setResolvedUnderlineColor","internalRef","setMergedRef","node","ref","resolveRenderedTextColor","props","element","matches","target","computedColor","handleMouseEnter","nextColor","event","handleMouseLeave","hoverStyle","Component","init_HoverUnderline"],"sources":["https:/framerusercontent.com/modules/f2BoxK5Mj3FvjhXWNRay/t8xKvNrRixhvLPmOS8d1/HoverUnderline.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,startTransition,useCallback,useRef,useState}from\"react\";// User request: Create a Framer code override named withHoverUnderline that preserves canvas styling and only adds an underline on hover.\nexport function withHoverUnderline(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[isHovered,setIsHovered]=useState(false);const[resolvedUnderlineColor,setResolvedUnderlineColor]=useState(undefined);const internalRef=useRef(null);const setMergedRef=useCallback(node=>{internalRef.current=node;if(typeof ref===\"function\"){ref(node);}else if(ref&&typeof ref===\"object\"){ref.current=node;}},[ref]);const resolveRenderedTextColor=useCallback(()=>{if(typeof window===\"undefined\"){return props.style?.color??\"inherit\";}const element=internalRef.current;if(!element){return props.style?.color??\"inherit\";}const matches=element.querySelectorAll(\"p, h1, h2, h3, h4, h5, h6, span\");const target=matches.length>0?matches[matches.length-1]:element;const computedColor=window.getComputedStyle(target).color;if(computedColor&&computedColor.trim().length>0){return computedColor;}return props.style?.color??\"inherit\";},[props.style]);const handleMouseEnter=useCallback(event=>{const nextColor=resolveRenderedTextColor();startTransition(()=>setResolvedUnderlineColor(nextColor));startTransition(()=>setIsHovered(true));props.onMouseEnter?.(event);},[props,resolveRenderedTextColor]);const handleMouseLeave=useCallback(event=>{startTransition(()=>setIsHovered(false));props.onMouseLeave?.(event);},[props]);const hoverStyle=isHovered?{textDecoration:\"underline\",WebkitTextDecorationLine:\"underline\",textDecorationThickness:\"2px\",WebkitTextDecorationThickness:\"2px\",textUnderlineOffset:\"0.15em\",textDecorationColor:resolvedUnderlineColor??props.style?.color??\"inherit\",WebkitTextDecorationColor:resolvedUnderlineColor??props.style?.color??\"inherit\",textDecorationSkipInk:\"none\"}:{};return /*#__PURE__*/_jsx(Component,{ref:setMergedRef,...props,onMouseEnter:handleMouseEnter,onMouseLeave:handleMouseLeave,style:{...props.style,...hoverStyle}});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withHoverUnderline\":{\"type\":\"reactHoc\",\"name\":\"withHoverUnderline\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HoverUnderline.map"],"mappings":"A,uJACA,SAAgBa,EAAmB,EAAU,CAAC,MAAoB,iBAAY,EAAM,IAAM,CAAC,GAAK,CAACC,EAAUC,GAAcf,EAAS,EAAK,EAAO,CAACgB,EAAuBC,GAA2BjB,EAAS,IAAA,EAAS,EAAQkB,EAAYjB,EAAO,IAAI,EAAQkB,EAAajB,EAAY,GAAM,CAAC,EAAY,QAAQkB,EAAQ,OAAOC,GAAM,WAAYA,EAAID,CAAI,EAAWC,GAAK,OAAOA,GAAM,WAAU,EAAI,QAAQD,EAAM,EAAE,CAACC,CAAG,CAAC,EAAQC,EAAyBpB,MAAgB,CAAC,GAAUK,IAAS,OAAa,OAAOgB,EAAM,OAAO,OAAO,UAAW,IAAMC,EAAQN,EAAY,QAAQ,GAAG,CAACM,EAAS,OAAOD,EAAM,OAAO,OAAO,UAAW,IAAME,EAAQD,EAAQ,iBAAiB,iCAAiC,EAAQE,EAAOD,EAAQ,OAAO,EAAEA,EAAQA,EAAQ,OAAO,GAAGD,EAAcG,EAAcpB,EAAO,iBAAiBmB,CAAM,CAAC,CAAC,MAA6E,OAApEC,GAAeA,EAAc,KAAK,CAAC,CAAC,OAAO,EAAUA,EAAsBJ,EAAM,OAAO,OAAO,SAAU,EAAE,CAACA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