{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/iSh4sVEz74G6DsgRzGDf/2a1o89uzpC4qUh4jOiuw/Counter1.js"],
  "sourcesContent": ["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect,useRef}from\"react\";import{motion}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";// Styles for the main container\nconst CounterStyles={container:{display:\"flex\",justifyContent:\"center\",alignItems:\"center\"}};// Digit component for slot machine animation\nconst Digit=({targetDigit,speed,textSize,textColor,selectedFont})=>{const[currentDigit,setCurrentDigit]=useState(0);const[isAnimating,setIsAnimating]=useState(true);useEffect(()=>{let intervalId;if(isAnimating){intervalId=setInterval(()=>{setCurrentDigit(prev=>{if(prev===targetDigit){clearInterval(intervalId);setIsAnimating(false);return prev;}return(prev+1)%10;});},speed);}return()=>clearInterval(intervalId);},[targetDigit,speed,isAnimating]);return /*#__PURE__*/_jsx(motion.div,{initial:{y:-textSize},animate:{y:0},transition:{type:\"spring\",stiffness:300,damping:20,duration:.3},style:{display:\"inline-block\",height:`${textSize}px`,overflow:\"hidden\",width:`${textSize/2}px`,textAlign:\"center\",fontFamily:selectedFont.fontFamily,fontWeight:selectedFont.fontWeight,fontSize:`${textSize}px`,color:textColor},children:currentDigit});};// Main Counter component\nexport function Counter(props){const{start,end,speed,gapSize,prefixText,suffixText,prefixFont,suffixFont,prefixColor,suffixColor,loop,decimalSeparatorType,textSize,selectedFont,textColor,startOnViewport,restartOnViewport,incrementType,slotMachine}=props;const[count,setCount]=useState(start);const[isVisible,setIsVisible]=useState(false);const containerRef=useRef(null);// Observer for viewport\nuseEffect(()=>{const observer=new IntersectionObserver(entries=>{const entry=entries[0];setIsVisible(entry.isIntersecting);});if(containerRef.current){observer.observe(containerRef.current);}return()=>{if(containerRef.current){observer.unobserve(containerRef.current);}};},[]);// Increment logic\nuseEffect(()=>{if(slotMachine)return;// Skip if slot machine is active\nconst updateCount=()=>{const increment=incrementType===\"integer\"?1:.1;setCount(prevCount=>{const nextCount=parseFloat((prevCount+increment).toFixed(2));if(loop){return nextCount>end?start:nextCount;}return nextCount>=end?end:nextCount;});};if(isVisible||!startOnViewport&&start!==end){const intervalId=setInterval(updateCount,speed);return()=>{clearInterval(intervalId);};}else if(startOnViewport&&isVisible){setCount(start);}},[count,start,end,loop,isVisible,speed,startOnViewport,incrementType,slotMachine]);// Restart on viewport\nuseEffect(()=>{if(restartOnViewport&&isVisible){setCount(start)// Restart the animation when re-entering the viewport\n;}},[isVisible,restartOnViewport,start]);// Format number based on separator\nconst formatNumber=number=>{if(decimalSeparatorType===\"comma\"){return number.toLocaleString(\"en-US\");}else if(decimalSeparatorType===\"period\"){return number.toLocaleString(\"de-DE\")// German uses period as thousand separator\n;}else{return number.toFixed(incrementType===\"integer\"?0:1);}};// Render slot machine digits\nconst renderSlotMachine=()=>{const targetStr=end.toString();const currentStr=count.toFixed(incrementType===\"integer\"?0:1).toString();// Pad with zeros to match the length\nconst maxLength=Math.max(targetStr.length,currentStr.length);const paddedTarget=targetStr.padStart(maxLength,\"0\");const paddedCurrent=currentStr.padStart(maxLength,\"0\");return /*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",gap:`${gapSize}px`},children:paddedTarget.split(\"\").map((digit,index)=>/*#__PURE__*/_jsx(Digit,{targetDigit:parseInt(digit,10),speed:speed,textSize:textSize,textColor:textColor,selectedFont:selectedFont},index))});};return /*#__PURE__*/_jsxs(motion.div,{ref:containerRef,style:{...CounterStyles.container,gap:`${gapSize}px`,flexDirection:\"row\",alignItems:\"center\",fontSize:`${textSize}px`,fontFamily:selectedFont.fontFamily,fontWeight:selectedFont.fontWeight,color:textColor},children:[/*#__PURE__*/_jsx(\"span\",{style:{fontFamily:prefixFont.fontFamily,fontWeight:prefixFont.fontWeight,color:prefixColor},children:prefixText}),slotMachine?renderSlotMachine():/*#__PURE__*/_jsx(\"span\",{children:formatNumber(count)}),/*#__PURE__*/_jsx(\"span\",{style:{fontFamily:suffixFont.fontFamily,fontWeight:suffixFont.fontWeight,color:suffixColor},children:suffixText})]});}// Default props for the Counter component\nCounter.defaultProps={start:0,end:100,speed:100,prefixText:\"\",suffixText:\"\",loop:false,decimalSeparatorType:\"comma\",textSize:36,selectedFont:{fontFamily:\"Inter\",fontWeight:500,systemFont:true},textColor:\"#D3D3D3\",startOnViewport:false,incrementType:\"integer\",slotMachine:false,prefixFont:{fontFamily:\"Inter\",fontWeight:500,systemFont:true},suffixFont:{fontFamily:\"Inter\",fontWeight:500,systemFont:true},prefixColor:\"#000000\",suffixColor:\"#000000\",gapSize:4};// Property controls for Framer\naddPropertyControls(Counter,{startOnViewport:{type:ControlType.Boolean,title:\"Viewport\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},restartOnViewport:{type:ControlType.Boolean,title:\"Replay\",defaultValue:false,enabledTitle:\"Yes\",disabledTitle:\"No\"},selectedFont:{title:\"Font\",type:ControlType.Font,defaultValue:{fontFamily:\"Inter\",fontWeight:500,systemFont:true}},textSize:{title:\"Font Size\",type:ControlType.Number,min:8,max:240,step:1},textColor:{type:ControlType.Color,title:\"Font Color\"},start:{type:ControlType.Number,title:\"Start Number\",defaultValue:0,displayStepper:true},end:{type:ControlType.Number,title:\"End Number\",defaultValue:10,displayStepper:true},speed:{type:ControlType.Number,title:\"Speed (ms)\",defaultValue:100,min:10,max:2e3,step:10,description:\"Speed of the animation in milliseconds\"},decimalSeparatorType:{type:ControlType.Enum,title:\"Separator\",defaultValue:\"comma\",options:[\"comma\",\"period\",\"none\"],optionTitles:[\"Comma (1,000)\",\"Period (1.000)\",\"None\"]},incrementType:{type:ControlType.Enum,title:\"Increment Type\",defaultValue:\"integer\",options:[\"integer\",\"decimal\"],optionTitles:[\"Integer\",\"Decimal\"]},prefixText:{type:ControlType.String,title:\"Prefix\",defaultValue:\"\"},prefixFont:{title:\"Prefix Font\",type:ControlType.Font,defaultValue:{fontFamily:\"Inter\",fontWeight:500,systemFont:true}},prefixColor:{type:ControlType.Color,title:\"Prefix Color\"},suffixText:{type:ControlType.String,title:\"Suffix\",defaultValue:\"\"},suffixFont:{title:\"Suffix Font\",type:ControlType.Font,defaultValue:{fontFamily:\"Inter\",fontWeight:500,systemFont:true}},suffixColor:{type:ControlType.Color,title:\"Suffix Color\"},gapSize:{type:ControlType.Number,title:\"Gap Size\",defaultValue:4,min:0,max:100,step:1},loop:{type:ControlType.Boolean,title:\"Loop Animation\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\",description:\"Loop the counting animation\"},slotMachine:{type:ControlType.Boolean,title:\"Slot Machine\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\",description:\"Enable slot machine style animation\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"Counter\":{\"type\":\"reactComponent\",\"name\":\"Counter\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Counter1.map"],
  "mappings": "4HACA,IAAMA,EAAc,CAAC,UAAU,CAAC,QAAQ,OAAO,eAAe,SAAS,WAAW,QAAQ,CAAC,EACrFC,EAAM,CAAC,CAAC,YAAAC,EAAY,MAAAC,EAAM,SAAAC,EAAS,UAAAC,EAAU,aAAAC,CAAY,IAAI,CAAC,GAAK,CAACC,EAAaC,CAAe,EAAEC,EAAS,CAAC,EAAO,CAACC,EAAYC,CAAc,EAAEF,EAAS,EAAI,EAAE,OAAAG,EAAU,IAAI,CAAC,IAAIC,EAAW,OAAGH,IAAaG,EAAW,YAAY,IAAI,CAACL,EAAgBM,GAAUA,IAAOZ,GAAa,cAAcW,CAAU,EAAEF,EAAe,EAAK,EAASG,IAAaA,EAAK,GAAG,EAAI,CAAE,EAAEX,CAAK,GAAS,IAAI,cAAcU,CAAU,CAAE,EAAE,CAACX,EAAYC,EAAMO,CAAW,CAAC,EAAsBK,EAAKC,EAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,CAACZ,CAAQ,EAAE,QAAQ,CAAC,EA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a,GAAM,aAAa,KAAK,cAAc,MAAM,YAAY,qCAAqC,CAAC,CAAC",
  "names": ["CounterStyles", "Digit", "targetDigit", "speed", "textSize", "textColor", "selectedFont", "currentDigit", "setCurrentDigit", "ye", "isAnimating", "setIsAnimating", "ue", "intervalId", "prev", "p", "motion", "Counter", "props", "start", "end", "gapSize", "prefixText", "suffixText", "prefixFont", "suffixFont", "prefixColor", "suffixColor", "loop", "decimalSeparatorType", "startOnViewport", "restartOnViewport", "incrementType", "slotMachine", "count", "setCount", "isVisible", "setIsVisible", "containerRef", "pe", "observer", "entries", "entry", "updateCount", "increment", "prevCount", "nextCount", "formatNumber", "number", "renderSlotMachine", "targetStr", "currentStr", "maxLength", "paddedTarget", "paddedCurrent", "digit", "index", "u", "addPropertyControls", "ControlType"]
}
