{"version":3,"file":"Counter.CVa05l6c.mjs","names":[],"sources":["https:/framerusercontent.com/modules/ceofvr6jgpwQKThojLKQ/MQl2HfunWwWQkwu4Iw8R/Counter.js"],"sourcesContent":["import{jsxs as _jsxs}from\"react/jsx-runtime\";import{motion}from\"framer-motion\";import{useState,useEffect,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";export function NumberCounter(props){const{startNumber,endNumber,fontColor,fontSize,fontWeight,fontFamily,speed,prefix,suffix,loop}=props;const[count,setCount]=useState(startNumber);const[isVisible,setIsVisible]=useState(false);const ref=useRef(null);useEffect(()=>{const observer=new IntersectionObserver(entries=>{const entry=entries[0];setIsVisible(entry.isIntersecting);});if(ref.current){observer.observe(ref.current);}return()=>{if(ref.current){observer.unobserve(ref.current);}};},[]);useEffect(()=>{if(isVisible&&startNumber!==endNumber){const intervalId=setInterval(()=>{if(count<endNumber){setCount(prevCount=>prevCount+1);}else if(loop){setCount(startNumber);}},speed);return()=>{clearInterval(intervalId);};}},[count,startNumber,endNumber,loop,isVisible]);return /*#__PURE__*/_jsxs(motion.div,{ref:ref,style:{color:fontColor,fontSize:fontSize,fontWeight:fontWeight,fontFamily:fontFamily},children:[prefix,count,suffix]});}NumberCounter.defaultProps={startNumber:0,endNumber:10,fontColor:\"#000\",fontSize:\"16px\",fontWeight:\"normal\",fontFamily:\"Arial\",speed:100,prefix:\"\",suffix:\"\",loop:false};addPropertyControls(NumberCounter,{startNumber:{type:ControlType.Number,title:\"Start Number\",defaultValue:0,displayStepper:true},endNumber:{type:ControlType.Number,title:\"End Number\",defaultValue:10,displayStepper:true},fontColor:{type:ControlType.Color,title:\"Font Color\",defaultValue:\"#000\"},fontSize:{type:ControlType.Number,title:\"Font Size\",defaultValue:16,min:0,max:100,step:1},fontWeight:{type:ControlType.Enum,title:\"Font Weight\",defaultValue:\"normal\",options:[\"light\",\"normal\",\"italic\",\"medium\",\"semibold\",\"bold\"],optionTitles:[\"Light\",\"Regular\",\"Medium\",\"Semibold\",\"Bold\"]},fontFamily:{type:ControlType.String,title:\"Font Family\",defaultValue:\"Arial\"},speed:{type:ControlType.Number,title:\"Speed (ms)\",defaultValue:100,min:0,max:1e3,step:10},prefix:{type:ControlType.String,title:\"Prefix\",defaultValue:\"\"},suffix:{type:ControlType.String,title:\"Suffix\",defaultValue:\"\"},loop:{type:ControlType.Boolean,title:\"Loop Animation\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"NumberCounter\":{\"type\":\"reactComponent\",\"name\":\"NumberCounter\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Counter.map"],"mappings":"kWAAgL,SAAgB,EAAc,EAAM,CAAC,GAAK,CAAC,cAAY,YAAU,YAAU,WAAS,aAAW,aAAW,QAAM,SAAO,SAAO,OAAK,CAAC,EAAW,CAAC,EAAM,EAAS,CAAC,EAAS,EAAY,CAAM,CAAC,EAAU,EAAa,CAAC,GAAS,EAAM,CAAO,EAAI,EAAO,KAAK,CAAsgB,MAArgB,GAAU,IAAI,CAAC,IAAM,EAAS,IAAI,qBAAqB,GAAS,CAAC,IAAM,EAAM,EAAQ,GAAG,EAAa,EAAM,eAAe,AAAE,GAAiD,OAA5C,EAAI,SAAS,EAAS,QAAQ,EAAI,QAAQ,CAAQ,IAAI,CAAC,AAAG,EAAI,SAAS,EAAS,UAAU,EAAI,QAAQ,AAAG,CAAE,EAAC,CAAE,EAAC,CAAC,EAAU,IAAI,CAAC,GAAG,GAAW,IAAc,EAAU,CAAC,IAAM,EAAW,YAAY,IAAI,CAAC,AAAG,EAAM,EAAW,EAAS,GAAW,EAAU,EAAE,CAAU,GAAM,EAAS,EAAY,AAAG,EAAC,EAAM,CAAC,MAAM,IAAI,CAAC,cAAc,EAAW,AAAE,CAAE,CAAC,EAAC,CAAC,EAAM,EAAY,EAAU,EAAK,CAAU,EAAC,CAAqB,EAAM,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