{"version":3,"file":"TextFlap.PqaCaO4e.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/P5CIRT7A8zh4LGZTEYNm/RWaL3QAV1mwXQKPwmmtU/TextFlap.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * @framerDisableUnlink\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */export default function ScrambleText(props){const isCanvas=RenderTarget.current()===RenderTarget.canvas;const[displayText,setDisplayText]=useState(props.words[0]);const[currentIndex,setCurrentIndex]=useState(0);const chars=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\";// For canvas, just render the first word without animations\nif(isCanvas){return /*#__PURE__*/_jsx(\"div\",{style:{...props.font,color:props.color},children:props.words[0]});}// Handle word cycling\nuseEffect(()=>{const wordInterval=setInterval(()=>{setCurrentIndex(prev=>(prev+1)%props.words.length);},(props.animationDuration+props.pauseDuration)*1e3);return()=>clearInterval(wordInterval);},[props.words,props.animationDuration,props.pauseDuration]);// Handle scramble effect\nuseEffect(()=>{const targetWord=props.words[currentIndex];let iterations=0;const scrambleInterval=setInterval(()=>{setDisplayText(()=>{const progress=iterations/(props.animationDuration*20);return targetWord.split(\"\").map((letter,index)=>{if(progress>=index/targetWord.length){return letter;}return chars[Math.floor(Math.random()*chars.length)];}).join(\"\");});if(iterations>props.animationDuration*20){clearInterval(scrambleInterval);}iterations++;},50);return()=>clearInterval(scrambleInterval);},[currentIndex,props.words,props.animationDuration]);return /*#__PURE__*/_jsx(\"div\",{style:{...props.font,color:props.color},children:displayText});}ScrambleText.defaultProps={words:[\"Hello\",\"World\",\"Framer\"],animationDuration:1.5,pauseDuration:1,color:\"#000000\"};addPropertyControls(ScrambleText,{words:{type:ControlType.Array,control:{type:ControlType.String},defaultValue:[\"Hello\",\"World\",\"Framer\"],title:\"Words\"},animationDuration:{type:ControlType.Number,min:.1,max:5,step:.1,defaultValue:1.5,title:\"Animation\"},pauseDuration:{type:ControlType.Number,min:.1,max:5,step:.1,defaultValue:1,title:\"Pause\"},color:{type:ControlType.Color,title:\"Color\"},font:{type:ControlType.Font,controls:\"extended\",title:\"Font\",description:\"v1.0 \\n[via SegmentUI](https://www.segmentUI.com)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrambleText\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"*\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TextFlap.map"],"mappings":"4RAKG,SAAwB,EAAa,EAAM,CAAC,IAAM,EAAS,EAAa,SAAS,GAAG,EAAa,OAAY,CAAC,EAAY,GAAgBA,EAAS,EAAM,MAAM,GAAG,CAAM,CAAC,EAAa,GAAiBA,EAAS,EAAE,CAGiV,OAFniB,EAA8B,EAAK,MAAM,CAAC,MAAM,CAAC,GAAG,EAAM,KAAK,MAAM,EAAM,MAAM,CAAC,SAAS,EAAM,MAAM,GAAG,CAAC,EAC9G,MAAc,CAAC,IAAM,EAAa,gBAAgB,CAAC,EAAgB,IAAO,EAAK,GAAG,EAAM,MAAM,OAAO,GAAI,EAAM,kBAAkB,EAAM,eAAe,IAAI,CAAC,UAAU,cAAc,EAAa,EAAG,CAAC,EAAM,MAAM,EAAM,kBAAkB,EAAM,cAAc,CAAC,CAC7P,MAAc,CAAC,IAAM,EAAW,EAAM,MAAM,GAAkB,EAAW,EAAQ,EAAiB,gBAAgB,CAAC,MAAmB,CAAC,IAAM,EAAS,GAAY,EAAM,kBAAkB,IAAI,OAAO,EAAW,MAAM,GAAG,CAAC,KAAK,EAAO,IAAY,GAAU,EAAM,EAAW,OAAe,EAAe,uDAAM,KAAK,MAAM,KAAK,QAAQ,CAAC,GAAa,EAAI,CAAC,KAAK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