{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/pYGJbktLS5nZG5gcVsy0/KNBzza2Jq9PDRC7k9cRA/TextMagnifier_Prod.js"],
  "sourcesContent": ["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useSpring,useMotionValue,useMotionValueEvent}from\"framer-motion\";import{useRef,useId,useMemo,useEffect}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n *\n * @framerDisableUnlink\n *\n * @framerIntrinsicWidth 400\n * @framerIntrinsicHeight 200\n */export default function MagneticText({text,color,font,transform,balance,userSelect,tag,style,range,smoothing}){const id=useInstanceId();const isCanvas=RenderTarget.current()===RenderTarget.canvas;const spanClassName=`${id}-span`;const Tag=tag;const springTransition={damping:100,stiffness:mapRange(smoothing,0,100,2e3,50)};const hasSpring=smoothing!==0;const mouseX=useMotionValue(0);const mouseY=useMotionValue(0);const mouseXSpring=useSpring(mouseX,springTransition);const mouseYSpring=useSpring(mouseY,springTransition);const elementsRef=useRef([]);// Add global mouse tracking effect\nuseEffect(()=>{const handleMouseMove=e=>{mouseX.set(e.clientX);mouseY.set(e.clientY);};window.addEventListener(\"mousemove\",handleMouseMove);return()=>window.removeEventListener(\"mousemove\",handleMouseMove);},[]);const lines=useMemo(()=>{const textLines=text.split(\"\\n\");const lines=[];for(let i=0;i<textLines.length;i++){const line=textLines[i].split(/[ \\t]+/);lines.push(line);}return lines;},[text]);let index=0;const createLineChildren=(lineIndex,lineWords)=>{return lineWords.map((word,wordIndex)=>/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"span\",{className:`${id}-word-wrapper`,children:word.split(\"\").map((char,charIndex)=>{const savedIndex=index;index++;return /*#__PURE__*/_jsx(\"span\",{ref:el=>{if(el)elementsRef.current[savedIndex]=el;},className:spanClassName,children:char},`${lineIndex}-${wordIndex}-${charIndex}`);})},`${lineIndex}-${wordIndex}`),wordIndex<lineWords.length-1&&\" \"]}));};const updateScale=(mx,my)=>{for(let i=0;i<elementsRef.current.length;i++){const element=elementsRef.current[i];if(!element)continue;const rect=element.getBoundingClientRect();const characterCenterX=rect.left+rect.width/2;const characterCenterY=rect.top+rect.height/2;const distance=Math.sqrt(Math.pow(characterCenterX-mx,2)+Math.pow(characterCenterY-my,2));const d=clamp01(mapRange(distance,range/2,0,0,1));const scaleX=mapRange(d,0,1,1,1.2);const w=mapRange(d,0,1,0,.07);const padding=mapRange(d,0,1,0,.05);const scaleY=mapRange(d,0,1,1,.95);element.style.transform=`scale(${scaleX}, ${scaleY})`;element.style[\"-webkit-text-stroke-width\"]=`${w}em`;element.style.paddingInline=`${padding}em`;}};useMotionValueEvent(hasSpring?mouseXSpring:mouseX,\"change\",mx=>{if(mouseY){updateScale(mx,hasSpring?mouseYSpring.get():mouseY.get());}});useMotionValueEvent(hasSpring?mouseYSpring:mouseY,\"change\",my=>{if(mouseX){updateScale(hasSpring?mouseXSpring.get():mouseX.get(),my);}});return /*#__PURE__*/_jsxs(Tag,{style:{position:\"relative\",cursor:\"default\",margin:0,whiteSpace:style?.width?\"pre\":\"nowrap\",fontWeight:400,textAlign:\"center\",userSelect:userSelect?\"auto\":\"none\",textWrap:balance?\"balance\":undefined,textTransform:transform,color,...font,...style},children:[/*#__PURE__*/_jsx(\"style\",{children:`\n\t.${id}-line {\n\t\twidth: 100%;\n\t\tdisplay: block;\n\t\ttransform-style: preserve-3d;\n\t}\n\t.${id}-word-wrapper {\n\t\tdisplay: inline-block;\n\t\ttransform-style: preserve-3d;\n\t\twhite-space: pre;\n\t}\n\t.${id}-span {\n\t\tdisplay: inline-block;\n\t\ttransform-style: preserve-3d;\n\t\twhite-space: pre;\n\t\twill-change: transform, -webkit-text-stroke-width, padding-inline;\n\t\ttransform-origin: 50% 50%};\n\t\t-webkit-text-stroke-color: currentColor;\n\t}\n`}),lines.length===1?createLineChildren(0,lines[0]):lines.map((lineWords,lineIndex)=>/*#__PURE__*/_jsx(\"span\",{className:`${id}-line`,children:createLineChildren(lineIndex,lineWords)},lineIndex))]});}MagneticText.displayName=\"Text Magnifier\";addPropertyControls(MagneticText,{text:{type:ControlType.String,defaultValue:\"Learn Framer With Framer University\",displayTextArea:true},range:{type:ControlType.Number,defaultValue:200},smoothing:{type:ControlType.Number,defaultValue:50,min:0,max:100,step:1},font:{type:\"font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:32,lineHeight:1.2}},color:{type:ControlType.Color,defaultValue:\"#999999\"},transform:{type:ControlType.Enum,defaultValue:\"none\",options:[\"none\",\"uppercase\",\"lowercase\"],optionTitles:[\"None\",\"Uppercase\",\"Lowercase\"]},balance:{type:ControlType.Boolean,defaultValue:false},userSelect:{type:ControlType.Boolean,defaultValue:false},tag:{type:ControlType.Enum,defaultValue:\"p\",displaySegmentedControl:true,options:[\"h1\",\"h2\",\"h3\",\"p\"],optionTitles:[\"H1\",\"H2\",\"H3\",\"P\"],description:\"More components at [Framer University](https://frameruni.link/cc).\"}});const useInstanceId=()=>{const id=useId();const cleanId=id.replace(/:/g,\"\");const instanceId=`frameruni-${cleanId}`;return instanceId;};function mapRange(value,fromLow,fromHigh,toLow,toHigh){if(fromLow===fromHigh){return toLow;}const percentage=(value-fromLow)/(fromHigh-fromLow);return toLow+percentage*(toHigh-toLow);}function clamp01(value){return Math.max(0,Math.min(value,1));}\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"MagneticText\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"200\",\"framerDisableUnlink\":\"*\",\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any\",\"framerContractVersion\":\"1\",\"framerIntrinsicWidth\":\"400\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TextMagnifier_Prod.map"],
  "mappings": "oNAAAA,IAQkB,SAARC,EAA8B,CAAC,KAA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C,EAAE,MAAM,CAAC,KAAKA,EAAY,MAAM,aAAa,SAAS,EAAE,UAAU,CAAC,KAAKA,EAAY,KAAK,aAAa,OAAO,QAAQ,CAAC,OAAO,YAAY,WAAW,EAAE,aAAa,CAAC,OAAO,YAAY,WAAW,CAAC,EAAE,QAAQ,CAAC,KAAKA,EAAY,QAAQ,aAAa,EAAK,EAAE,WAAW,CAAC,KAAKA,EAAY,QAAQ,aAAa,EAAK,EAAE,IAAI,CAAC,KAAKA,EAAY,KAAK,aAAa,IAAI,wBAAwB,GAAK,QAAQ,CAAC,KAAK,KAAK,KAAK,GAAG,EAAE,aAAa,CAAC,KAAK,KAAK,KAAK,GAAG,EAAE,YAAY,oEAAoE,CAAC,CAAC,EAAE,IAAMrD,EAAc,IAAyE,aAA3DsD,EAAM,EAAmB,QAAQ,KAAK,EAAE,CAAuC,GAAuB,SAAShD,EAASiD,EAAMC,EAAQC,EAASC,EAAMC,EAAO,CAAC,GAAGH,IAAUC,EAAU,OAAOC,EAAO,IAAME,GAAYL,EAAMC,IAAUC,EAASD,GAAS,OAAOE,EAAME,GAAYD,EAAOD,EAAO,CAAC,SAASZ,GAAQS,EAAM,CAAC,OAAO,KAAK,IAAI,EAAE,KAAK,IAAIA,EAAM,CAAC,CAAC,CAAE",
  "names": ["init_ssg_sandbox_shims", "MagneticText", "text", "color", "font", "transform", "balance", "userSelect", "tag", "style", "range", "smoothing", "id", "useInstanceId", "isCanvas", "RenderTarget", "spanClassName", "Tag", "springTransition", "mapRange", "hasSpring", "mouseX", "useMotionValue", "mouseY", "mouseXSpring", "useSpring", "mouseYSpring", "elementsRef", "pe", "ue", "handleMouseMove", "e", "lines", "se", "textLines", "i", "line", "index", "createLineChildren", "lineIndex", "lineWords", "word", "wordIndex", "u", "l", "p", "char", "charIndex", "savedIndex", "el", "updateScale", "mx", "my", "element", "rect", "characterCenterX", "characterCenterY", "distance", "d", "clamp01", "scaleX", "w", "padding", "scaleY", "useMotionValueEvent", "addPropertyControls", "ControlType", "ae", "value", "fromLow", "fromHigh", "toLow", "toHigh", "percentage"]
}
