{"version":3,"file":"TypewriterHighlightText.Dy24wivC.mjs","names":["useRef","useMemo","useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/e1taYcs11hJWAAIA8Kd6/bxQOIU0K8JwREoaZxR90/TypewriterHighlightText.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{useEffect,useMemo,useRef,useState,startTransition}from\"react\";import{useInView}from\"framer-motion\";function clamp(n,min,max){return Math.max(min,Math.min(max,n));}/**\n * @framerIntrinsicWidth 900\n * @framerIntrinsicHeight 150\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function TypewriterHighlightText(props){const{prefix,highlight,suffix,animate,restartOnEnter,startDelayMs,charsPerSecond,showCursor,cursorChar,textColor,highlightTextColor,highlightBgColor,decorations,strokeColor,strokeWidth,cornerSize,paddingX,paddingY,radius,font,style}=props;const isStatic=useIsStaticRenderer();const rootRef=useRef(null);const inView=useInView(rootRef,{margin:\"-10% 0px -10% 0px\",once:!restartOnEnter});const safeCps=useMemo(()=>clamp(charsPerSecond,1,120),[charsPerSecond]);const intervalMs=useMemo(()=>Math.round(1e3/safeCps),[safeCps]);const[typedCount,setTypedCount]=useState(()=>isStatic||!animate?highlight.length:0);const[running,setRunning]=useState(false);const canAnimateNow=!isStatic&&animate&&inView&&highlight.length>0;useEffect(()=>{if(isStatic||!animate){startTransition(()=>{setTypedCount(highlight.length);setRunning(false);});return;}if(!inView){if(restartOnEnter){startTransition(()=>{setTypedCount(0);setRunning(false);});}return;}// In view\nstartTransition(()=>{setRunning(true);if(restartOnEnter)setTypedCount(0);});},[isStatic,animate,inView,restartOnEnter,highlight.length]);useEffect(()=>{if(!canAnimateNow)return;if(!running)return;let delayId=-1;let intervalId=-1;const start=()=>{intervalId=window.setInterval(()=>{startTransition(()=>{setTypedCount(c=>{const next=c+1;if(next>=highlight.length){window.clearInterval(intervalId);return highlight.length;}return next;});});},intervalMs);};if(typeof window!==\"undefined\"){delayId=window.setTimeout(start,Math.max(0,startDelayMs));}return()=>{if(typeof window!==\"undefined\"){window.clearTimeout(delayId);window.clearInterval(intervalId);}};},[canAnimateNow,running,highlight.length,intervalMs,startDelayMs]);const typedHighlight=useMemo(()=>{if(isStatic||!animate)return highlight;return highlight.slice(0,typedCount);},[highlight,typedCount,isStatic,animate]);const showCursorNow=useMemo(()=>{if(!showCursor)return false;if(isStatic||!animate)return false;return canAnimateNow&&typedCount<highlight.length;},[showCursor,isStatic,animate,canAnimateNow,typedCount,highlight.length]);const isFixedWidth=!!(style&&style.width===\"100%\");const isFixedHeight=!!(style&&style.height===\"100%\");const textWrapStyle={color:textColor,...font,whiteSpace:\"pre-wrap\",margin:0,width:\"100%\"};return /*#__PURE__*/_jsx(\"div\",{ref:rootRef,style:{position:\"relative\",width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",overflow:\"visible\",...isFixedWidth?{}:{minWidth:\"max-content\"},...isFixedHeight?{}:{minHeight:\"max-content\"},...style},children:/*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",width:\"100%\"},children:/*#__PURE__*/_jsxs(\"div\",{style:{...textWrapStyle,textAlign:font?.textAlign??\"center\"},\"aria-label\":`${prefix}${highlight}${suffix}`,children:[/*#__PURE__*/_jsx(\"span\",{children:prefix}),/*#__PURE__*/_jsxs(\"span\",{style:{position:\"relative\",display:\"inline-block\",color:highlightTextColor,padding:`${paddingY}px ${paddingX}px`,borderRadius:radius,margin:`0 ${Math.max(0,Math.round(paddingX*.2))}px`,verticalAlign:\"baseline\"},children:[/*#__PURE__*/_jsx(\"span\",{\"aria-hidden\":\"true\",style:{position:\"absolute\",inset:0,background:highlightBgColor,borderRadius:radius}}),decorations&&/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"span\",{\"aria-hidden\":\"true\",style:{position:\"absolute\",top:0,bottom:0,left:0,width:strokeWidth,background:strokeColor,borderTopLeftRadius:radius,borderBottomLeftRadius:radius}}),/*#__PURE__*/_jsx(\"span\",{\"aria-hidden\":\"true\",style:{position:\"absolute\",top:0,bottom:0,right:0,width:strokeWidth,background:strokeColor,borderTopRightRadius:radius,borderBottomRightRadius:radius}}),/*#__PURE__*/_jsx(\"span\",{\"aria-hidden\":\"true\",style:{position:\"absolute\",top:-cornerSize/2,left:-cornerSize/2,width:cornerSize,height:cornerSize,background:strokeColor}}),/*#__PURE__*/_jsx(\"span\",{\"aria-hidden\":\"true\",style:{position:\"absolute\",top:-cornerSize/2,right:-cornerSize/2,width:cornerSize,height:cornerSize,background:strokeColor}}),/*#__PURE__*/_jsx(\"span\",{\"aria-hidden\":\"true\",style:{position:\"absolute\",bottom:-cornerSize/2,left:-cornerSize/2,width:cornerSize,height:cornerSize,background:strokeColor}}),/*#__PURE__*/_jsx(\"span\",{\"aria-hidden\":\"true\",style:{position:\"absolute\",bottom:-cornerSize/2,right:-cornerSize/2,width:cornerSize,height:cornerSize,background:strokeColor}})]}),/*#__PURE__*/_jsxs(\"span\",{style:{position:\"relative\",zIndex:1},children:[typedHighlight,showCursorNow?cursorChar:\"\"]})]}),/*#__PURE__*/_jsx(\"span\",{children:suffix})]})})});}addPropertyControls(TypewriterHighlightText,{prefix:{type:ControlType.String,title:\"Prefix\",defaultValue:\"Turn your \"},highlight:{type:ControlType.String,title:\"Highlight\",defaultValue:\"YouTube videos\"},suffix:{type:ControlType.String,title:\"Suffix\",defaultValue:\" into\\nSEO-ready blog posts\",displayTextArea:true},animate:{type:ControlType.Boolean,title:\"Animate\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},restartOnEnter:{type:ControlType.Boolean,title:\"Restart\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\",hidden:p=>!p.animate},startDelayMs:{type:ControlType.Number,title:\"Delay\",defaultValue:250,min:0,max:5e3,step:50,unit:\"ms\",hidden:p=>!p.animate},charsPerSecond:{type:ControlType.Number,title:\"Speed\",defaultValue:18,min:1,max:120,step:1,unit:\"c/s\",hidden:p=>!p.animate},showCursor:{type:ControlType.Boolean,title:\"Cursor\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\",hidden:p=>!p.animate},cursorChar:{type:ControlType.String,title:\"Cursor Char\",defaultValue:\"|\",hidden:p=>!p.animate||!p.showCursor},textColor:{type:ControlType.Color,title:\"Text\",defaultValue:\"#000000\"},highlightTextColor:{type:ControlType.Color,title:\"Highlight Text\",defaultValue:\"#E4152A\"},highlightBgColor:{type:ControlType.Color,title:\"Highlight BG\",defaultValue:\"#F7DEE0\"},decorations:{type:ControlType.Boolean,title:\"Decor\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},strokeColor:{type:ControlType.Color,title:\"Stroke\",defaultValue:\"#E4152A\",hidden:p=>!p.decorations},strokeWidth:{type:ControlType.Number,title:\"Stroke W\",defaultValue:2,min:0,max:12,step:1,unit:\"px\",hidden:p=>!p.decorations},cornerSize:{type:ControlType.Number,title:\"Corner\",defaultValue:8,min:0,max:40,step:1,unit:\"px\",hidden:p=>!p.decorations},paddingX:{type:ControlType.Number,title:\"Pad X\",defaultValue:18,min:0,max:60,step:1,unit:\"px\"},paddingY:{type:ControlType.Number,title:\"Pad Y\",defaultValue:8,min:0,max:40,step:1,unit:\"px\"},radius:{type:ControlType.Number,title:\"Radius\",defaultValue:0,min:0,max:40,step:1,unit:\"px\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"92px\",variant:\"Medium\",letterSpacing:\"-0.03em\",lineHeight:\"1.05em\",textAlign:\"center\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TypewriterHighlightText\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicWidth\":\"900\",\"framerSup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