{"version":3,"file":"ProTextType.DIZwCSoq.mjs","names":["React.useState","React.useRef","React.useCallback","p"],"sources":["https:/framerusercontent.com/modules/pJGoBPN8YZT9nfNj9fbA/KJktPQZL5sZnig67gW11/ProTextType.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import*as React from\"react\";import{motion}from\"framer-motion\";export default function WordByWordTypeEffect(props){const{texts,wordSpeed,speedVariation,initialDelay,pauseBeforeNext,fadeOutDuration,className,showCursor,cursorColor,cursorSize,blurAmount,animationDuration,style,...rest}=props;const[currentTextIndex,setCurrentTextIndex]=React.useState(0);const[displayedContent,setDisplayedContent]=React.useState([]);const[currentWordIndex,setCurrentWordIndex]=React.useState(0);const[isFadingOut,setIsFadingOut]=React.useState(false);const containerRef=React.useRef(null);const currentText=texts[currentTextIndex]||\"\";const tokens=currentText.split(/(\\s+)/);const getRandomSpeed=React.useCallback(()=>{if(!speedVariation)return wordSpeed;const variation=speedVariation/100;const minSpeed=wordSpeed*(1-variation);const maxSpeed=wordSpeed*(1+variation);return Math.random()*(maxSpeed-minSpeed)+minSpeed;},[wordSpeed,speedVariation]);React.useEffect(()=>{let timeout;if(currentWordIndex===0&&displayedContent.length===0&&!isFadingOut){timeout=setTimeout(()=>{setDisplayedContent([tokens[0]]);setCurrentWordIndex(1);},initialDelay);}else if(!isFadingOut&&currentWordIndex<tokens.length){timeout=setTimeout(()=>{setDisplayedContent(prev=>[...prev,tokens[currentWordIndex]]);setCurrentWordIndex(prev=>prev+1);},getRandomSpeed());}else if(!isFadingOut&&currentWordIndex>=tokens.length){timeout=setTimeout(()=>{setIsFadingOut(true);},pauseBeforeNext);}else if(isFadingOut){timeout=setTimeout(()=>{setDisplayedContent([]);setCurrentWordIndex(0);setIsFadingOut(false);setCurrentTextIndex(prev=>(prev+1)%texts.length);},fadeOutDuration*1e3);}return()=>timeout&&clearTimeout(timeout);},[currentWordIndex,displayedContent,tokens,initialDelay,getRandomSpeed,isFadingOut,pauseBeforeNext,fadeOutDuration,texts.length]);return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,className:className,style:{...style,display:\"block\",width:\"100%\",textAlign:\"left\",color:props.textColor,position:\"relative\",whiteSpace:\"pre-wrap\",...props.font},...rest,children:/*#__PURE__*/_jsxs(motion.div,{animate:{opacity:isFadingOut?0:1},transition:{duration:fadeOutDuration,ease:\"easeOut\"},style:{display:\"inline\"},children:[displayedContent.map((token,index)=>{if(/^\\s+$/.test(token)){return /*#__PURE__*/_jsx(\"span\",{children:token},index);}return /*#__PURE__*/_jsx(motion.span,{initial:{opacity:0,filter:`blur(${blurAmount}px)`,scale:.95},animate:{opacity:1,filter:\"blur(0px)\",scale:1},transition:{duration:animationDuration,ease:[.25,.1,.25,1]},style:{display:\"inline\"},children:token},index);}),showCursor&&displayedContent.length>0&&/*#__PURE__*/_jsx(motion.span,{style:{display:\"inline-block\",width:`${cursorSize}px`,height:`${cursorSize}px`,backgroundColor:cursorColor,borderRadius:\"50%\",marginLeft:\"4px\",verticalAlign:\"middle\"},animate:{opacity:[1,.2,1],scale:[1,.9,1]},transition:{opacity:{duration:1.5,repeat:Infinity,ease:\"easeInOut\"},scale:{duration:1.5,repeat:Infinity,ease:\"easeInOut\"}}})]},currentTextIndex)});}WordByWordTypeEffect.displayName=\"Word By Word Type Effect\";addPropertyControls(WordByWordTypeEffect,{texts:{type:ControlType.Array,title:\"Texts\",control:{type:ControlType.String,displayTextArea:true,placeholder:\"Enter your text here...\"},defaultValue:[\"Hey Sarah, Quick update on the Q4 roadmap. We've finalized the new features for December launch. Can we schedule a sync next week?\",\"const [isOpen, setIsOpen] = useState(false)\\n\\nfunction handleClick() {\\n  setIsOpen(!isOpen)\\n}\",\"Make a new React component called TaskDashboard. Add a useState hook for selectedTaskId initialized to null.\",\"@channel Heads up - deploying hotfix to production in 15 mins. Rolling back if any issues. 🚀\",\"□ Review pull requests\\n□ Update documentation\\n□ Fix responsive layout bug\\n□ Deploy to staging\"],maxCount:20},font:{type:\"font\",controls:\"extended\",defaultValue:{fontSize:16,lineHeight:1.5}},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#FFFFFF\"},wordSpeed:{type:ControlType.Number,title:\"Speed (ms)\",min:10,max:500,defaultValue:80,description:\"Vitesse moyenne entre les mots\"},speedVariation:{type:ControlType.Number,title:\"Speed Variation (%)\",min:0,max:100,defaultValue:50,description:\"Variation de vitesse\"},blurAmount:{type:ControlType.Number,title:\"Blur (px)\",min:0,max:15,defaultValue:6},animationDuration:{type:ControlType.Number,title:\"Word Animation (s)\",min:.1,max:2,step:.05,defaultValue:.5},fadeOutDuration:{type:ControlType.Number,title:\"Fade Out (s)\",min:.3,max:5,step:.1,defaultValue:1.5},initialDelay:{type:ControlType.Number,title:\"Initial Delay (ms)\",min:0,max:5e3,defaultValue:500},pauseBeforeNext:{type:ControlType.Number,title:\"Pause Before Next (ms)\",min:0,max:1e4,defaultValue:2500},showCursor:{type:ControlType.Boolean,title:\"Show Cursor\",defaultValue:true},cursorColor:{type:ControlType.Color,title:\"Cursor Color\",defaultValue:\"#3B82F6\",hidden:p=>!p.showCursor},cursorSize:{type:ControlType.Number,title:\"Cursor Size (px)\",min:4,max:20,defaultValue:8,hidden:p=>!p.showCursor}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"WordByWordTypeEffect\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ProTextType.map"],"mappings":"kPAA2K,SAAwB,EAAqB,EAAM,CAAC,GAAK,CAAC,QAAM,YAAU,iBAAe,eAAa,kBAAgB,kBAAgB,YAAU,aAAW,cAAY,aAAW,aAAW,oBAAkB,QAAM,GAAG,GAAM,EAAW,CAAC,EAAiB,GAAqBA,EAAe,EAAE,CAAM,CAAC,EAAiB,GAAqBA,EAAe,EAAE,CAAC,CAAM,CAAC,EAAiB,G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