{"version":3,"file":"CountUP.aCDFpgxX.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/schJYqegTZ6xxjWkAked/BfwZMsxP7VpDo2p43FLs/CountUP.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Count up (Count up numbers with dynamic controls)\n * By OneFramer.com\n *\n * @framerDisableUnlink\n */export default function CountUp(props){const{endAt,speed,textSize,fontWeight,fontColor,fontFamily,userSuffix}=props;// Value states\nconst[count,setCount]=useState(0);const[isVisible,setIsVisible]=useState(false);// Ref for the target element\nconst countRef=useRef(null);useEffect(()=>{const observer=new IntersectionObserver(entries=>{entries.forEach(entry=>{if(entry.isIntersecting){setIsVisible(true);observer.unobserve(entry.target);}});},{threshold:.5}// Trigger when 50% of the element is in view\n);// Start observing when component mounts\nobserver.observe(countRef.current);return()=>{// Clean up observer when component unmounts\nobserver.disconnect();};},[]);useEffect(()=>{if(isVisible){// Calculate the interval time based on speed and endAt\nconst intervalTime=speed*1e3/endAt;const interval=setInterval(()=>{if(count<endAt){setCount(prevCount=>prevCount+1);}else{clearInterval(interval);}},intervalTime);// Clean up after unmount\nreturn()=>clearInterval(interval);}},[count,endAt,speed,isVisible]);// styles\nconst styleObj={fontSize:`${textSize}px`,fontWeight:fontWeight,color:fontColor,fontFamily:fontFamily};return /*#__PURE__*/_jsx(\"span\",{ref:countRef,style:styleObj,children:count+userSuffix});}// Property controls\naddPropertyControls(CountUp,{endAt:{type:ControlType.Number,title:\"End\",defaultValue:10,min:2},speed:{type:ControlType.Number,title:\"Speed (s)\",defaultValue:5,min:1},textSize:{type:ControlType.Number,title:\"Text Size (px)\",defaultValue:20,min:12},fontWeight:{type:ControlType.Number,title:\"Font Weight\",defaultValue:600,min:100,max:900},fontColor:{type:ControlType.Color,title:\"Color\",defaultValue:\"#000000\"},fontFamily:{type:ControlType.String,title:\"Font Family\",defaultValue:\"Calibri\"},userSuffix:{type:ControlType.String,title:\"Suffix\",defaultValue:\"\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CountUp\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CountUP.map"],"mappings":"kRAKG,SAAwB,EAAQ,EAAM,CAAC,GAAK,CAAC,QAAM,QAAM,WAAS,aAAW,YAAU,aAAW,aAAW,CAAC,EAC5G,CAAC,EAAM,EAAS,CAACA,EAAS,GAAQ,CAAC,EAAU,EAAa,CAACA,EAAS,IACnE,EAASC,EAAO,MAAM,MAAc,CAAC,IAAM,EAAS,IAAI,qBAAqB,GAAS,CAAC,EAAQ,QAAQ,GAAO,CAAI,EAAM,iBAAgB,EAAa,IAAM,EAAS,UAAU,EAAM,QAAU,EAAG,EAAC,CAAC,UAAU,GAAG,EAEnL,OAAnC,EAAS,QAAQ,EAAS,aAAmB,CAC7C,EAAS,YAAc,CAAE,EAAC,EAAE,EAAE,MAAc,CAAC,GAAG,EAAU,CAC1D,IAAM,EAAa,EAAM,IAAI,EAAY,EAAS,gBAAgB,CAAI,EAAM,EAAO,EAAS,GAAW,EAAU,GAAS,cAAc,EAAY,EAAC,GACrJ,UAAU,cAAc,EAAW,CAAC,EAAC,CAAC,EAAM,EAAM,EAAM,EAAU,EAClE,IAAM,EAAS,CAAC,SAAS,GAAG,EAAS,IAAe,aAAW,MAAM,EAAqB,aAAW,CAAC,OAAoB,EAAK,OAAO,CAAC,IAAI,EAAS,MAAM,EAAS,SAAS,EAAM,EAAW,CAAG,2BAChM,EAAoB,EAAQ,CAAC,MAAM,CAAC,KAAK,EAAY,OAAO,MAAM,MAAM,aAAa,GAAG,IAAI,EAAE,CAAC,MAAM,CAAC,KAAK,EAAY,OAAO,MAAM,YAAY,aAAa,EAAE,IAAI,EAAE,CAAC,SAAS,CAAC,KAAK,EAAY,OAA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