{"version":3,"file":"Text_Chr_Reveal.DMQdH0W_.mjs","names":["useState","useRef","useMemo","useLayoutEffect","useEffect"],"sources":["https:/framerusercontent.com/modules/eJLdAnMZPa9VP5LMX7MG/y5hgktXwRal50kxdtTUl/Text_Chr_Reveal.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,motion,RenderTarget}from\"framer\";import{useRef,useEffect,useLayoutEffect,useState,memo,useMemo}from\"react\";import{useInView}from\"framer-motion\";const useIsomorphicLayoutEffect=typeof window!==\"undefined\"?useLayoutEffect:useEffect;// Fit Width: measures the text once at the set font size, then scales the font so the\n// line spans the component's width. Row offsets scale with it so the reveal keeps its feel.\nfunction useFitFontSize(enabled,rootRef,measureRef,baseSize){const[size,setSize]=useState(null);useIsomorphicLayoutEffect(()=>{if(!enabled){setSize(null);return;}const root=rootRef.current;const measure=measureRef.current;if(!root||!measure)return;let cancelled=false;const update=()=>{if(cancelled)return;const natural=measure.getBoundingClientRect().width;const available=root.clientWidth;if(natural>0&&available>0)setSize(baseSize*available/natural);};update();const observer=new ResizeObserver(update);observer.observe(root);document.fonts?.ready.then(update);return()=>{cancelled=true;observer.disconnect();};},[enabled,baseSize]);return size;}const CharacterRow=/*#__PURE__*/memo(({characters,yOffset,top,color,textStyle,keyPrefix,isInView,duration,isLooping,repeat,direction,delay})=>{// Determine initial and target Y positions based on direction\nconst initialY=direction===\"top-to-bottom\"?-yOffset:yOffset;const targetY=direction===\"top-to-bottom\"?0:0;return /*#__PURE__*/_jsx(\"div\",{style:{position:top===true?\"relative\":\"absolute\",top:top===true?undefined:`${top}%`,left:top===true?undefined:\"50%\",transform:top===true?undefined:\"translate(-50%, -50%)\",display:\"flex\",justifyContent:\"center\",textTransform:\"uppercase\",color,willChange:\"transform\",...textStyle},children:characters.map((char,index)=>/*#__PURE__*/_jsx(motion.span,{initial:{y:initialY},animate:{y:isInView?targetY:initialY},transition:{type:\"tween\",ease:[.2,.8,0,1],duration:duration,delay:delay+index*.06,repeat:isLooping?repeat:0,repeatType:\"reverse\"},style:{position:\"relative\",display:\"inline-block\",willChange:\"transform\"},children:char},`${keyPrefix}-${index}`))});});CharacterRow.displayName=\"CharacterRow\";// LogoIntro covers the page on load; holding the entrance until the cover lifts keeps it\n// from playing unseen. Falls back to starting anyway if no lift event ever arrives.\nconst COVER_EVENT=\"zhu:cover-lift\";const COVER_FALLBACK_MS=6e3;function useCoverLifted(){const[lifted,setLifted]=useState(false);useEffect(()=>{const w=window;const covers=w.__zhuCovers;const pending=covers?covers.size>0||!!w.__zhuCoverBoot:!!w.__zhuCoverBoot;if(!pending){setLifted(true);return;}const done=()=>setLifted(true);window.addEventListener(COVER_EVENT,done,{once:true});const fallback=window.setTimeout(done,COVER_FALLBACK_MS);return()=>{window.removeEventListener(COVER_EVENT,done);window.clearTimeout(fallback);};},[]);return lifted;}export default function Text_Chr_Reveal({text=\"SELECTED\",textStyle={fontSize:26,lineHeight:\"1\"},color=\"#ECEBEB\",yOffset1=290,yOffset2=290,yOffset3=300,duration=2.5,loopDelay=1,isLooping=false,repeat=0,direction=\"top-to-bottom\",delay=0,fitWidth=false}){const ref=useRef(null);const measureRef=useRef(null);const inView=useInView(ref,{once:!isLooping});const coverLifted=useCoverLifted();const isInView=inView&&coverLifted;const[key,setKey]=useState(0);// Memoize characters array to avoid recalculating on every render\nconst characters=useMemo(()=>text.split(\"\"),[text]);const baseSize=parseFloat(String(textStyle?.fontSize??26))||26;const fitSize=useFitFontSize(fitWidth,ref,measureRef,baseSize);const scale=fitSize?fitSize/baseSize:1;const rowStyle=fitSize?{...textStyle,fontSize:fitSize}:textStyle;// Hidden copy of one row at the set size; Fit Width scales from its width.\nconst measurer=fitWidth?/*#__PURE__*/_jsx(\"div\",{ref:measureRef,\"aria-hidden\":\"true\",style:{position:\"absolute\",top:0,left:0,visibility:\"hidden\",pointerEvents:\"none\",display:\"flex\",width:\"max-content\",whiteSpace:\"nowrap\",textTransform:\"uppercase\",...textStyle},children:characters.map((char,index)=>/*#__PURE__*/_jsx(\"span\",{style:{display:\"inline-block\"},children:char},index))}):null;// Reset animation periodically if looping is enabled\nuseEffect(()=>{if(isInView&&isLooping){const interval=setInterval(()=>{setKey(prev=>prev+1);},(duration+loopDelay)*1e3);return()=>clearInterval(interval);}},[isInView,duration,loopDelay,isLooping]);if(RenderTarget.current()===\"CANVAS\"){return /*#__PURE__*/_jsxs(\"div\",{ref:ref,style:{position:\"relative\",width:fitWidth?\"100%\":undefined,display:\"flex\",justifyContent:\"center\",textTransform:\"uppercase\",color,willChange:\"transform\",...rowStyle},children:[measurer,characters.map((char,index)=>/*#__PURE__*/_jsx(motion.span,{style:{position:\"relative\",display:\"inline-block\"},children:char},index))]});}return /*#__PURE__*/_jsxs(\"div\",{ref:ref,style:{display:\"flex\",flexDirection:\"column\",width:\"100%\",height:\"auto\",justifyContent:\"center\",overflow:\"hidden\",position:\"relative\"},children:[measurer,/*#__PURE__*/_jsx(CharacterRow,{characters:characters,yOffset:yOffset1*scale,top:true,color:color,textStyle:rowStyle,keyPrefix:`${key}-top`,isInView:isInView,duration:duration,isLooping:isLooping,repeat:repeat,direction:direction,delay:delay}),/*#__PURE__*/_jsx(CharacterRow,{characters:characters,yOffset:yOffset2*scale,top:180,color:color,textStyle:rowStyle,keyPrefix:`${key}-middle`,isInView:isInView,duration:duration,isLooping:isLooping,repeat:repeat,direction:direction,delay:delay}),/*#__PURE__*/_jsx(CharacterRow,{characters:characters,yOffset:yOffset3*scale,top:250,color:color,textStyle:rowStyle,keyPrefix:`${key}-bottom`,isInView:isInView,duration:duration,isLooping:isLooping,repeat:repeat,direction:direction,delay:delay})]});}addPropertyControls(Text_Chr_Reveal,{textStyle:{type:\"font\",title:\"Font\",controls:\"extended\",defaultValue:{fontSize:26,lineHeight:\"1\"}},fitWidth:{type:ControlType.Boolean,defaultValue:false,title:\"Fit Width\",description:\"Scales the font so the text spans the full width.\"},delay:{type:ControlType.Number,defaultValue:0,title:\"Delay\"},duration:{type:ControlType.Number,defaultValue:2.5,title:\"Animation Duration\"},isLooping:{type:ControlType.Boolean,defaultValue:false,title:\"Loop\"},loopDelay:{type:ControlType.Number,defaultValue:1,title:\"Delay Between Loops\"},repeat:{type:ControlType.Number,defaultValue:0,title:\"Repeat Time\"},yOffset1:{type:ControlType.Number,defaultValue:290,title:\"Top Row Offset\"},yOffset2:{type:ControlType.Number,defaultValue:290,title:\"Middle Row Offset\"},yOffset3:{type:ControlType.Number,defaultValue:300,title:\"Bottom Row Offset\"},color:{type:ControlType.Color,defaultValue:\"#ECEBEB\",title:\"Text Color\"},text:{type:ControlType.String,title:\"Text Content\"},direction:{type:ControlType.Enum,defaultValue:\"top-to-bottom\",title:\"Transition Direction\",options:[\"top-to-bottom\",\"bottom-to-top\"],optionTitles:[\"Top to Bottom\",\"Bottom to Top\"]}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Text_Chr_Reveal\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Text_Chr_Reveal.map"],"mappings":"iSAEA,SAAS,EAAe,EAAQ,EAAQ,EAAW,EAAS,CAAC,GAAK,CAAC,EAAK,GAASA,EAAS,IAAI,EAA8hB,OAA5hB,MAA8B,CAAC,GAAG,CAAC,EAAQ,CAAC,EAAQ,IAAI,EAAE,MAAO,CAAC,IAAM,EAAK,EAAQ,QAAc,EAAQ,EAAW,QAAQ,GAAG,CAAC,GAAM,CAAC,EAAQ,OAAO,IAAI,EAAU,GAAY,MAAW,CAAC,GAAG,EAAU,OAAO,IAAM,EAAQ,EAAQ,sBAAsB,CAAC,CAAC,MAAY,EAAU,EAAK,YAAe,EAAQ,GAAG,EAAU,GAAE,EAAQ,EAAS,EAAU,CAAO,CAAE,EAAE,EAAO,EAAE,IAAM,EAAS,IAAI,eAAe,CAAM,EAA4D,OAA1D,EAAS,QAAQ,CAAI,E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