{"version":3,"file":"RotatingText.CQsWXL-F.mjs","names":["React.useMemo","React.useState"],"sources":["https:/framerusercontent.com/modules/ZOoW8QQRwTe9FbeOHkPx/8D2iK20cPXIyTcKACH56/RotatingText.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{AnimatePresence,motion}from\"framer-motion\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */export default function RotatingText(props){const{prefix=\"Learn\",suffix=\"with beautifully designed visual flashcards.\",words=\"pronunciation, characters, context, related words, meaning\",colors=\"#22c55e, #a855f7, #22c55e, #3b82f6, #22c55e\",interval=2,fontSize=18,fontWeight=\"700\"}=props;const wordList=React.useMemo(()=>{const parsedWords=(words||\"\").split(\",\").map(word=>word.trim()).filter(Boolean);return parsedWords.length>0?parsedWords:[\"context\"];},[words]);const colorList=React.useMemo(()=>{const parsedColors=(colors||\"\").split(\",\").map(color=>color.trim()).filter(Boolean);return parsedColors.length>0?parsedColors:[\"#22c55e\"];},[colors]);const[index,setIndex]=React.useState(0);React.useEffect(()=>{setIndex(0);},[words]);React.useEffect(()=>{if(wordList.length<=1)return;const safeInterval=Number.isFinite(interval)&&interval>=.5?interval:2;const timer=window.setInterval(()=>{setIndex(currentIndex=>{return(currentIndex+1)%wordList.length;});},safeInterval*1e3);return()=>window.clearInterval(timer);},[interval,wordList.length]);const safeIndex=index%wordList.length;const currentWord=wordList[safeIndex];const currentColor=colorList[safeIndex%colorList.length];const longestWord=React.useMemo(()=>{return wordList.reduce((longest,word)=>{return word.length>longest.length?word:longest;},\"\");},[wordList]);return /*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",fontSize,fontWeight:fontWeight,lineHeight:1.1,whiteSpace:\"normal\",overflowWrap:\"break-word\",color:\"#555555\",textAlign:\"center\"},children:[prefix&&/*#__PURE__*/_jsxs(\"span\",{children:[prefix,\" \"]}),/*#__PURE__*/_jsxs(\"span\",{style:{display:\"inline-grid\",position:\"relative\",overflow:\"hidden\",verticalAlign:\"baseline\",whiteSpace:\"nowrap\"},children:[/*#__PURE__*/_jsx(\"span\",{\"aria-hidden\":\"true\",style:{gridArea:\"1 / 1\",visibility:\"hidden\"},children:longestWord}),/*#__PURE__*/_jsx(AnimatePresence,{initial:false,mode:\"wait\",children:/*#__PURE__*/_jsx(motion.span,{style:{gridArea:\"1 / 1\",display:\"inline-block\",color:currentColor},initial:{opacity:0,y:\"0.45em\",filter:\"blur(4px)\"},animate:{opacity:1,y:0,filter:\"blur(0px)\"},exit:{opacity:0,y:\"-0.45em\",filter:\"blur(4px)\"},transition:{duration:.35,ease:[.22,1,.36,1]},children:currentWord},`${safeIndex}-${currentWord}`)})]}),suffix&&/*#__PURE__*/_jsxs(\"span\",{children:[\" \",suffix]})]});}RotatingText.defaultProps={prefix:\"Learn\",suffix:\"with beautifully designed visual flashcards.\",words:\"pronunciation, characters, context, related words, meaning, radicals\",colors:\"#22c55e, #a855f7, #22c55e, #3b82f6, #22c55e, #a855f7\",interval:2,fontSize:18,fontWeight:\"700\"};addPropertyControls(RotatingText,{prefix:{type:ControlType.String,title:\"Text Before\",defaultValue:\"Learn\"},words:{type:ControlType.String,title:\"Words\",defaultValue:\"context, characters, pronunciation, related words, meaning\",displayTextArea:true},suffix:{type:ControlType.String,title:\"Text After\",defaultValue:\"with beautifully designed visual flashcards.\",displayTextArea:true},colors:{type:ControlType.String,title:\"Colors\",defaultValue:\"#22c55e, #a855f7, #22c55e, #3b82f6, #22c55e\",displayTextArea:true},interval:{type:ControlType.Number,title:\"Interval\",defaultValue:2,min:.5,max:10,step:.5,unit:\"s\"},fontSize:{type:ControlType.Number,title:\"Font Size\",defaultValue:18,min:8,max:200,step:1,unit:\"px\"},fontWeight:{type:ControlType.Enum,title:\"Weight\",options:[\"400\",\"500\",\"600\",\"700\",\"800\",\"900\"],optionTitles:[\"Regular\",\"Medium\",\"Semi Bold\",\"Bold\",\"Extra Bold\",\"Black\"],defaultValue:\"700\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RotatingText\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./RotatingText.map"],"mappings":"qQAGG,SAAwB,EAAa,EAAM,CAAC,GAAK,CAAC,SAAO,QAAQ,SAAO,+CAA+C,QAAM,6DAA6D,SAAO,8CAA8C,WAAS,EAAE,WAAS,GAAG,aAAW,OAAO,EAAY,EAASA,MAAkB,CAAC,IAAM,GAAa,GAAO,GAAA,CAAI,MAAM,GAAG,CAAC,CAAC,IAAI,GAAM,EAAK,KAAK,CAAC,CAAC,CAAC,OAAO,OAAO,EAAE,OAAO,EAAY,OAAO,EAAE,EAAY,CAAC,SAAS,CAAE,EAAE,CAAC,CAAK,CAAC,EAAQ,EAAUA,MAAkB,CAAC,IAAM,GAAc,GAAQ,GAAA,CAAI,MAAM,GAAG,CAAC,CAAC,IAAI,GAAO,EAAM,KAAK,CAAC,CAAC,CAAC,OAAO,OAAO,EAAE,OAAO,EAAa,OAAO,EAAE,EAAa,CAAC,SAAS,CAAE,EAAE,CAAC,CAAM,CAAC,EAAO,CAAC,EAAM,GAAUC,EAAe,CAAC,EAAE,MAAoB,CAAC,EAAS,CAAC,CAAE,EAAE,CAAC,CAAK,CAAC,EAAE,MAAoB,CAAC,GAAG,EAAS,QAAQ,EAAE,OAAO,IAAM,EAAa,OAAO,SAAS,CAAQ,GAAG,GAAU,GAAG,EAAS,EAAQ,EAAM,EAAO,gBAAgB,CAAC,EAAS,IAAsB,EAAa,GAAG,EAAS,MAAQ,CAAE,EAAE,EAAa,GAAG,EAAE,UAAU,EAAO,cAAc,CAAK,CAAE,EAAE,CAAC,EAAS,EAAS,MAAM,CAAC,EAAE,IAAM,EAAU,EAAM,EAAS,OAAa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