{"version":3,"file":"Rotating_Text_Pro.B02CyjBC.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/cHTGB59FF0vd0ZnGFGrb/RcvBGS2R4SMM6DXpW1lM/Rotating_Text_Pro.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * Rotating Text Heading — CA Edition\n * Responsive for desktop, tablet, and mobile.\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */export default function RotatingTextPro(props){const{beforeText,rotatingWords,afterText,highlightColor,textColor,font,textAlign,stepDuration,wordTransition,headingTag,direction,style}=props;const headingRef=useRef(null);const activeTokenRef=useRef(null);const delayedCallsRef=useRef([]);const splitInstanceRef=useRef(null);const isCanvas=RenderTarget.current()===RenderTarget.canvas;useEffect(()=>{if(isCanvas)return;const token=Symbol();activeTokenRef.current=token;const isCurrent=()=>token===activeTokenRef.current;const cleanup=()=>{if(activeTokenRef.current===token){activeTokenRef.current=null;}delayedCallsRef.current.forEach(dc=>{try{dc?.kill();}catch(e){}});delayedCallsRef.current=[];try{splitInstanceRef.current?.revert();}catch(e){}splitInstanceRef.current=null;if(headingRef.current){const span=headingRef.current.querySelector(\"[data-rotating-words]\");if(span){const first=(rotatingWords||\"\").split(\",\").map(w=>w.trim()).filter(Boolean)[0]||\"\";span.textContent=first;}}};const runAnimation=(gsap,SplitText)=>{if(!isCurrent())return;const heading=headingRef.current;if(!heading)return;const rotatingSpan=heading.querySelector(\"[data-rotating-words]\");if(!rotatingSpan)return;const words=(rotatingWords||\"\").split(\",\").map(w=>w.trim()).filter(Boolean);if(!words.length)return;const longestWord=words.reduce((a,b)=>b.length>a.length?b:a);rotatingSpan.textContent=longestWord;try{splitInstanceRef.current?.revert();}catch(e){}splitInstanceRef.current=SplitText.create(heading,{type:\"lines\",mask:\"lines\",autoSplit:true,linesClass:\"rotating-line\",onSplit(){if(!isCurrent())return;const wrapper=document.createElement(\"span\");wrapper.className=\"rotating-text__inner\";Object.assign(wrapper.style,{display:\"inline-block\",position:\"relative\",verticalAlign:\"bottom\",clipPath:\"inset(-5% -10% -25% -10%)\",overflow:\"visible\"});const wordEls=words.map(word=>{const el=document.createElement(\"span\");el.className=\"rotating-text__word\";Object.assign(el.style,{display:\"block\",whiteSpace:\"nowrap\",position:\"absolute\",top:\"0\",left:\"0\",willChange:\"transform, opacity\"});el.textContent=word;wrapper.appendChild(el);return el;});rotatingSpan.textContent=\"\";rotatingSpan.appendChild(wrapper);requestAnimationFrame(()=>{if(!isCurrent())return;const dur=wordTransition?.duration??.7;const ease=\"power4.inOut\";const enterY=direction===\"down\"?\"-150%\":\"150%\";const exitY=direction===\"down\"?\"150%\":\"-150%\";gsap.set(wordEls,{y:enterY,opacity:0});let activeIndex=0;gsap.set(wordEls[activeIndex],{y:\"0%\",opacity:1});const rect=wordEls[activeIndex].getBoundingClientRect();wrapper.style.width=`${rect.width}px`;wrapper.style.height=`${rect.height}px`;function showNext(){if(!isCurrent())return;const nextIndex=(activeIndex+1)%wordEls.length;const prev=wordEls[activeIndex];const current=wordEls[nextIndex];const targetWidth=current.getBoundingClientRect().width;gsap.to(wrapper,{width:targetWidth,duration:dur,ease});gsap.to(prev,{y:exitY,opacity:0,duration:dur,ease});gsap.set(current,{y:enterY,opacity:0});gsap.to(current,{y:\"0%\",opacity:1,duration:dur,ease});activeIndex=nextIndex;const dc=gsap.delayedCall(stepDuration,showNext);delayedCallsRef.current.push(dc);}if(words.length>1){const dc=gsap.delayedCall(stepDuration,showNext);delayedCallsRef.current.push(dc);}});}});};const loadScript=src=>new Promise((resolve,reject)=>{const existing=document.querySelector(`script[src=\"${src}\"]`);if(existing){if(existing.__loaded)return resolve();existing.addEventListener(\"load\",()=>resolve());existing.addEventListener(\"error\",reject);return;}const s=document.createElement(\"script\");s.src=src;s.async=true;s.onload=()=>{s.__loaded=true;resolve();};s.onerror=reject;document.head.appendChild(s);});const loadAndRun=async()=>{if(!window.gsap){await loadScript(\"https://cdn.jsdelivr.net/npm/gsap@3.14.1/dist/gsap.min.js\");}if(!isCurrent())return;if(!window.SplitText){await loadScript(\"https://cdn.jsdelivr.net/npm/gsap@3.14.1/dist/SplitText.min.js\");}if(!isCurrent())return;runAnimation(window.gsap,window.SplitText);};loadAndRun();return cleanup;},[isCanvas,beforeText,rotatingWords,afterText,highlightColor,textColor,font,textAlign,stepDuration,wordTransition,headingTag,direction]);const firstWord=(rotatingWords||\"\").split(\",\").map(w=>w.trim()).filter(Boolean)[0]||\"\";const Tag=headingTag||\"h1\";return /*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",...style},children:[/*#__PURE__*/_jsx(\"style\",{children:`\n                .rotating-line-mask {\n                    overflow-x: visible !important;\n                    overflow-y: clip !important;\n                }\n                .rotating-line {\n                    padding-bottom: 0.25em;\n                    margin-bottom: -0.25em;\n                    white-space: nowrap;\n                }\n\n                /* ── Base: fluid scale desktop → tablet ── */\n                [data-rotating-title] {\n                    font-size: clamp(2.4rem, 5.5vw, 4.2rem) !important;\n                    line-height: 1.15 !important;\n                }\n\n                /* ── Tablet: 481px–768px ── */\n                @media (max-width: 768px) and (min-width: 481px) {\n                    [data-rotating-title] {\n                        font-size: clamp(2.2rem, 6vw, 3rem) !important;\n                        line-height: 1.2 !important;\n                        letter-spacing: -0.01em !important;\n                    }\n                }\n\n                /* ── Mobile: 480px and below ──\n                   Use vw-based sizing so text fills the screen\n                   regardless of device width (320px–480px range).\n                   10.5vw on a 390px iPhone = ~41px — bold, hero-size. */\n                @media (max-width: 480px) {\n                    [data-rotating-title] {\n                        font-size: 10.5vw !important;\n                        line-height: 1.2 !important;\n                        letter-spacing: -0.01em !important;\n                        word-break: keep-all !important;\n                    }\n                }\n\n                /* ── Very small phones: 360px and below ── */\n                @media (max-width: 360px) {\n                    [data-rotating-title] {\n                        font-size: 11vw !important;\n                        line-height: 1.22 !important;\n                    }\n                }\n            `}),/*#__PURE__*/_jsxs(Tag,{ref:headingRef,\"data-rotating-title\":true,style:{margin:0,padding:0,color:textColor,textAlign,lineHeight:1.1,letterSpacing:\"-0.02em\",// font spread is last so fontSize from font picker\n// only overrides on canvas, not on live (media queries win)\n...font},children:[beforeText?`${beforeText} `:\"\",/*#__PURE__*/_jsx(\"span\",{\"data-rotating-words\":rotatingWords,style:{color:highlightColor,display:\"inline-block\",position:\"relative\",overflow:\"visible\",verticalAlign:\"bottom\"},children:firstWord}),afterText?` ${afterText}`:\"\"]})]});}RotatingTextPro.defaultProps={beforeText:\"Chartered Accountant-level\",rotatingWords:\"Accountancy, Auditing, Tax, Compliance\",afterText:\"expertise, delivered.\",highlightColor:\"#3AB19B\",textColor:\"#0a0a0a\",font:{fontFamily:\"'Instrument Sans', sans-serif\",fontWeight:\"500\",fontStyle:\"normal\",fontSize:\"4.2rem\",lineHeight:\"1.1em\",letterSpacing:\"0em\"},textAlign:\"center\",headingTag:\"h1\",direction:\"up\",stepDuration:1.75,wordTransition:{type:\"tween\",duration:.7,ease:[.76,0,.04,1]}};addPropertyControls(RotatingTextPro,{beforeText:{type:ControlType.String,title:\"Before\",defaultValue:\"Chartered Accountant-level\",placeholder:\"Text before rotating word\"},rotatingWords:{type:ControlType.String,title:\"Rotating Words\",defaultValue:\"Accountancy, Auditing, Tax, Compliance\",displayTextArea:true,description:\"Comma-separated. The longest word is auto-used as the SplitText placeholder.\"},afterText:{type:ControlType.String,title:\"After\",defaultValue:\"expertise, delivered.\",displayTextArea:true,placeholder:\"Text after rotating word\"},highlightColor:{type:ControlType.Color,title:\"Highlight\",defaultValue:\"#3AB19B\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#0a0a0a\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",displayFontSize:true,displayTextAlignment:false,defaultValue:{variant:\"Medium\"}},textAlign:{type:ControlType.Enum,title:\"Align\",defaultValue:\"center\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Center\",\"Right\"],displaySegmentedControl:true},headingTag:{type:ControlType.Enum,title:\"Tag\",defaultValue:\"h1\",options:[\"h1\",\"h2\",\"h3\",\"h4\",\"p\"],optionTitles:[\"H1\",\"H2\",\"H3\",\"H4\",\"P\"],displaySegmentedControl:true},direction:{type:ControlType.Enum,title:\"Direction\",defaultValue:\"up\",options:[\"up\",\"down\"],optionTitles:[\"Up\",\"Down\"],displaySegmentedControl:true},stepDuration:{type:ControlType.Number,title:\"Step Duration\",defaultValue:1.75,min:.5,max:10,step:.25,unit:\"s\",description:\"Time each word holds before rotating\"},wordTransition:{type:ControlType.Transition,title:\"Word Transition\",defaultValue:{type:\"tween\",duration:.7,ease:[.76,0,.04,1]}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RotatingTextPro\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Rotating_Text_Pro.map"],"mappings":"6MAMG,SAAwB,EAAgB,EAAM,CAAC,GAAK,CAAC,aAAW,gBAAc,YAAU,iBAAe,YAAU,OAAK,YAAU,eAAa,iBAAe,aAAW,YAAU,SAAO,EAAY,EAAWA,EAAO,KAAK,CAAO,EAAeA,EAAO,KAAK,CAAO,EAAgBA,EAAO,EAAE,CAAC,CAAO,EAAiBA,EAAO,KAAK,CAAO,EAAS,EAAa,SAAS,GAAG,EAAa,OAAO,MAAc,CAAC,GAAG,EAAS,OAAO,IAAM,EAAM,QAAQ,CAAC,EAAe,QAAQ,EAAM,IAAM,MAAc,IAAQ,EAAe,QAAc,MAAY,CAAI,EAAe,UAAU,IAAO,EAAe,QAAQ,MAAM,EAAgB,QAAQ,QAAQ,GAAI,CAAC,GAAG,CAAC,GAAI,MAAM,MAAU,IAAI,CAAC,EAAgB,QAAQ,EAAE,CAAC,GA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