{"version":3,"file":"RandomLetters.msnrU1B9.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/9t632P0fyspKkoI3OrO8/v7YhyWNPaQ15q7BkNYiC/RandomLetters.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{RenderTarget}from\"framer\";import{useEffect,useRef,useState}from\"react\";import{useInView}from\"framer-motion\";const ALPHABET=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\";export function withTextScramble(Component){return props=>{// Check if the component is being rendered on the Framer canvas\nconst isCanvas=RenderTarget.current()===RenderTarget.canvas;const ref=useRef(null);const isInView=useInView(ref,{once:true,amount:.5});const[displayText,setDisplayText]=useState(null);const[isAnimating,setIsAnimating]=useState(false);const[originalSize,setOriginalSize]=useState(null);const originalText=useRef(null);useEffect(()=>{// Disable animation completely if inside the Framer editor\nif(isCanvas||!ref.current)return;// Capture exact dimensions and text on the first render\nif(originalText.current===null){originalText.current=ref.current.innerText||ref.current.textContent||\"\";const rect=ref.current.getBoundingClientRect();setOriginalSize({width:rect.width,height:rect.height});}if(!isInView||!originalText.current)return;const text=originalText.current;const duration=700;const intervalMs=40;const totalSteps=Math.floor(duration/intervalMs);let currentStep=0;setIsAnimating(true);const interval=setInterval(()=>{const currentScramble=text.split(\"\").map(char=>{// Preserve spaces and line breaks\nif(char.trim()===\"\")return char;return ALPHABET[Math.floor(Math.random()*ALPHABET.length)];}).join(\"\");setDisplayText(currentScramble);currentStep++;if(currentStep>=totalSteps){clearInterval(interval);setDisplayText(text);setIsAnimating(false);}},intervalMs);return()=>clearInterval(interval);},[isInView,isCanvas]);// Early return for the Framer editor to keep it static and editable\nif(isCanvas){return /*#__PURE__*/_jsx(Component,{...props});}const overrideProps={};if(displayText!==null){overrideProps.text=displayText;}// Lock dimensions and hide overflow during animation to prevent layout jumping\nif(isAnimating&&originalSize){overrideProps.style={...props.style,minWidth:originalSize.width,maxWidth:originalSize.width,minHeight:originalSize.height,maxHeight:originalSize.height,overflow:\"hidden\"};}return /*#__PURE__*/_jsx(Component,{...props,...overrideProps,ref:ref});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withTextScramble\":{\"type\":\"reactHoc\",\"name\":\"withTextScramble\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./RandomLetters.map"],"mappings":"6NAAoO,SAAgB,EAAiB,EAAU,CAAC,MAAO,IAAO,CAC9R,IAAM,EAAS,EAAa,QAAQ,IAAI,EAAa,OAAa,EAAIA,EAAO,IAAI,EAAQ,EAAS,EAAU,EAAI,CAAC,KAAK,GAAK,OAAO,EAAE,CAAC,EAAO,CAAC,EAAY,GAAgBC,EAAS,IAAI,EAAO,CAAC,EAAY,GAAgBA,EAAS,EAAK,EAAO,CAAC,EAAa,GAAiBA,EAAS,IAAI,EAAQ,EAAaD,EAAO,IAAI,EAI3T,GAJ6T,MAAc,CAC3U,GAAG,GAAU,CAAC,EAAI,QAAQ,OAC1B,GAAG,EAAa,UAAU,KAAK,CAAC,EAAa,QAAQ,EAAI,QAAQ,WAAW,EAAI,QAAQ,aAAa,GAAG,IAAM,EAAK,EAAI,QAAQ,sBAAsB,EAAE,EAAgB,CAAC,MAAM,EAAK,MAAM,OAAO,EAAK,MAAM,CAAC,CAAE,CAAC,GAAG,CAAC,GAAU,CAAC,EAAa,QAAQ,OAAO,IAAM,EAAK,EAAa,QAAoG,EAAY,EAAE,EAAe,EAAI,EAAE,IAAM,EAAS,gBAAgB,CAAC,IAAM,EAAgB,EAAK,MAAM,EAAE,CAAC,CAAC,IAAI,GAC/d,EAAK,KAAK,IAAI,GAAU,EAAY,EAAS,KAAK,MAAM,KAAK,OAAO,EAAE,EAAe,EAAI,CAAC,CAAC,KAAK,EAAE,EAAE,EAAe,CAAe,EAAE,IAAiB,GAAa,KAAY,cAAc,CAAQ,EAAE,EAAe,CAAI,EAAE,EAAe,EAAK,EAAG,EAAE,EAAU,EAAE,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