{"version":3,"file":"RotatingText_1.D1cUblFD.mjs","names":["useState","useRef","useMemo","useCallback"],"sources":["https:/framerusercontent.com/modules/vwf7NcAjOT7kCSJ4Lynu/oWSbZvZ6vo1rXPgFm0TR/RotatingText_1.js"],"sourcesContent":["// Text Cycler component for Framer, adapted from provided code and following Framer component rules\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useCallback,useEffect,useMemo,useRef,useState,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{motion,AnimatePresence}from\"framer-motion\";/**\n * Text Cycler\n *\n * Animated cycling text with per-character/word/line animation and staggered transitions.\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function TextCycler(props){const{texts=[\"Healthy aging\",\"GLP-1 Weight Loss\",\"Hormone Therapy\",\"Sexual Performance\"],staggerFrom=\"last\",initial={y:\"100%\",opacity:0},animate={y:0,opacity:1},exit={y:\"-120%\",opacity:0,transition:{duration:.8}},staggerDuration=.025,transition={ease:\"easeInOut\",duration:.8},rotationInterval=2e3,loop=true,auto=true,splitBy=\"characters\",font,textColor=\"#000000\",style,duration=.8}=props;const[currentTextIndex,setCurrentTextIndex]=useState(0);const isStatic=useIsStaticRenderer();const intervalRef=useRef(null);const splitIntoCharacters=text=>{if(typeof Intl!==\"undefined\"&&Intl.Segmenter){const segmenter=new Intl.Segmenter(\"en\",{granularity:\"grapheme\"});return Array.from(segmenter.segment(text),segment=>segment.segment);}// Fallback: split graphemes manually, preserve spaces\nreturn text.split(/(\\s)/).flatMap(part=>{if(part===\" \")return[part]// preserve space\n;return Array.from(part);});};const elements=useMemo(()=>{const currentText=texts[currentTextIndex]||\"\";if(splitBy===\"characters\"){const chars=splitIntoCharacters(currentText);return chars.map((char,i)=>({characters:[char]}));}if(splitBy===\"words\"){return currentText.split(/\\s+/).filter(Boolean).map((word,i,arr)=>({characters:[word],needsSpace:i!==arr.length-1}));}if(splitBy===\"lines\"){return currentText.split(\"\\n\").map((line,i,arr)=>({characters:[line.trim()],needsSpace:i!==arr.length-1&&line.trim()!==\"\"}));}return[];},[texts,currentTextIndex,splitBy]);const getStaggerDelay=useCallback((index,totalChars)=>{const total=totalChars;if(staggerFrom===\"first\")return index*staggerDuration;if(staggerFrom===\"last\")return(total-1-index)*staggerDuration;if(staggerFrom===\"center\"){const center=Math.floor(total/2);return Math.abs(center-index)*staggerDuration;}if(staggerFrom===\"random\"){const randomIndex=Math.floor(Math.random()*total);return Math.abs(randomIndex-index)*staggerDuration;}return Math.abs(Number(staggerFrom)-index)*staggerDuration;},[staggerFrom,staggerDuration]);const handleIndexChange=useCallback(newIndex=>{startTransition(()=>setCurrentTextIndex(newIndex));},[]);const next=useCallback(()=>{const nextIndex=currentTextIndex===texts.length-1?loop?0:currentTextIndex:currentTextIndex+1;if(nextIndex!==currentTextIndex){handleIndexChange(nextIndex);}},[currentTextIndex,texts.length,loop,handleIndexChange]);useEffect(()=>{if(!auto||isStatic)return;intervalRef.current=window.setInterval(next,rotationInterval*1e3);return()=>{if(intervalRef.current)clearInterval(intervalRef.current);};},[next,rotationInterval,auto,isStatic]);// Style\nconst containerStyle={...style,position:\"relative\",display:\"flex\",alignItems:\"start\",justifyContent:\"start\",color:textColor,overflow:\"visible\",margin:0,...font};return /*#__PURE__*/_jsxs(motion.h1,{style:containerStyle,\"aria-label\":texts[currentTextIndex],children:[/*#__PURE__*/_jsx(\"span\",{style:{position:\"absolute\",left:-9999,opacity:0},children:texts[currentTextIndex]}),/*#__PURE__*/_jsx(AnimatePresence,{mode:\"wait\",initial:false,children:/*#__PURE__*/_jsxs(motion.span,{style:{display:\"flex\",alignItems:\"center\",flexWrap:\"wrap\"},\"aria-hidden\":\"true\",children:[elements.map((item,itemIndex)=>{const totalChars=elements.reduce((sum,el)=>sum+el.characters.length+(el.needsSpace?1:0),0);const previousCharsCount=elements.slice(0,itemIndex).reduce((sum,el)=>sum+el.characters.length+(el.needsSpace?1:0),0);return /*#__PURE__*/_jsxs(\"span\",{style:{display:\"inline-flex\",overflow:\"hidden\"},children:[item.characters.map((char,charIndex)=>{const globalIndex=previousCharsCount+charIndex;return /*#__PURE__*/_jsx(motion.span,{initial:initial,animate:animate,exit:exit,transition:{...transition,duration,delay:getStaggerDelay(globalIndex,totalChars)},style:{display:\"inline-block\",// Preserve space width\n...char===\" \"&&{width:\"0.25em\"}},children:char===\" \"?\"\\xa0\":char},`${itemIndex}-${charIndex}`);}),item.needsSpace&&splitBy!==\"characters\"&&/*#__PURE__*/_jsx(motion.span,{initial:initial,animate:animate,exit:exit,transition:{...transition,duration,delay:getStaggerDelay(previousCharsCount+item.characters.length,totalChars)},style:{display:\"inline-block\"},children:\"\\xa0\"})]},itemIndex);}),/*#__PURE__*/_jsx(\"span\",{style:{position:\"absolute\",left:-9999,opacity:0,pointerEvents:\"none\"},children:texts[currentTextIndex]})]},currentTextIndex)})]});}addPropertyControls(TextCycler,{texts:{type:ControlType.Array,title:\"Healthy aging\",control:{type:ControlType.String,defaultValue:\"Healthy aging\"},defaultValue:[\"Healthy aging\",\"GLP-1 Weight Loss\",\"Hormone Therapy\",\"Sexual Performance\"],maxCount:10},splitBy:{type:ControlType.Enum,title:\"Split By\",options:[\"characters\",\"words\",\"lines\"],optionTitles:[\"Characters\",\"Words\",\"Lines\"],defaultValue:\"characters\"},rotationInterval:{type:ControlType.Number,title:\"Rotation Interval\",defaultValue:2,min:2,max:60,step:1,unit:\"s\"},staggerFrom:{type:ControlType.Enum,title:\"Stagger From\",options:[\"first\",\"last\",\"center\",\"random\"],optionTitles:[\"First\",\"Last\",\"Center\",\"Random\"],defaultValue:\"last\"},staggerDuration:{type:ControlType.Number,title:\"Stagger Duration\",defaultValue:.025,min:0,max:.2,step:.005,unit:\"s\"},duration:{type:ControlType.Number,title:\"Animation Duration\",defaultValue:.5,min:.1,max:2,step:.1,unit:\"s\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"32px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1.2em\"}},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TextCycler\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./RotatingText_1.map"],"mappings":"6RAQG,SAAwB,EAAW,EAAM,CAAC,GAAK,CAAC,QAAM,CAAC,gBAAgB,oBAAoB,kBAAkB,qBAAqB,CAAC,cAAY,OAAO,UAAQ,CAAC,EAAE,OAAO,QAAQ,EAAE,CAAC,UAAQ,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,OAAK,CAAC,EAAE,QAAQ,QAAQ,EAAE,WAAW,CAAC,SAAS,GAAG,CAAC,CAAC,kBAAgB,KAAK,aAAW,CAAC,KAAK,YAAY,SAAS,GAAG,CAAC,mBAAiB,IAAI,OAAK,GAAK,OAAK,GAAK,UAAQ,aAAa,OAAK,YAAU,UAAU,QAAM,WAAS,IAAI,EAAW,CAAC,EAAiB,GAAqBA,EAAS,EAAE,CAAO,EAAS,GAAqB,CAAO,EAAYC,EAAO,KAAK,CAAO,EAAoB,GAAM,CAAC,GAAG,OAAO,KAAO,KAAa,KAAK,UAAU,CAAC,IAAM,EAAU,IAAI,KAAK,UAAU,KAAK,CAAC,YAAY,WAAW,CAAC,CAAC,OAAO,MAAM,KAAK,EAAU,QAAQ,EAAK,CAAC,GAAS,EAAQ,QAAQ,CACjwB,OAAO,EAAK,MAAM,OAAO,CAAC,QAAQ,GAAU,IAAO,IAAU,CAAC,EAAK,CAC3D,MAAM,KAAK,EAAK,CAAG,EAAS,EAASC,MAAY,CAAC,IAAM,EAAY,EAAM,IAAmB,GAA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