{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/e2XH355UDw8hzgcWLIGz/JB61OHCOSq5hapMHKjNk/Counter.js", "ssg:https://framer.com/m/framer/store.js@^1.0.0", "ssg:https://framer.com/m/framer/utils.js@^0.9.0", "ssg:https://framerusercontent.com/modules/luJbP8loUlTKcoYNw1KI/61NHjn039TxwJAZBAtrl/Examples.js"],
  "sourcesContent": ["// Welcome to Code in Framer\n// Get Started: https://www.framer.com/developers/\nimport{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{useInView,useMotionValue,useSpring}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";/**\n * These annotations control how your component sizes\n * Learn more: https://www.framer.com/developers/#code-components-auto-sizing\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function Counter({decimal,value,decimalValue,direction,stiffness,damping,prefix,prefixText,suffix,suffixText,color,fontStyle}){const initialValue=0;const ref=useRef(null);const updatedDecimalValue=decimal===true?decimalValue:value;const motionValue=useMotionValue(direction===\"down\"?updatedDecimalValue:initialValue);const springValue=useSpring(motionValue,{damping:damping,stiffness:stiffness});const isInView=useInView(ref,{once:true,margin:\"-100px\"});useEffect(()=>{if(isInView){motionValue.set(direction===\"down\"?initialValue:updatedDecimalValue);}},[motionValue,isInView]);useEffect(()=>springValue.on(\"change\",latest=>{if(ref.current){ref.current.textContent=Intl.NumberFormat(\"en-US\").format(latest.toFixed(decimal===true?2:0));}}),[springValue]);return /*#__PURE__*/_jsxs(_Fragment,{children:[prefix?/*#__PURE__*/_jsx(\"span\",{style:{...fontStyle,color:color},children:prefixText}):null,/*#__PURE__*/_jsx(\"span\",{ref:ref,style:{...fontStyle,color:color},children:initialValue}),suffix?/*#__PURE__*/_jsx(\"span\",{style:{...fontStyle,color:color},children:suffixText}):null]});}Counter.defaultProps={decimal:false,value:100,decimalValue:100,direction:\"up\",stiffness:300,damping:100,prefix:false,prefixText:\"\",suffix:false,suffixText:\"\",color:\"#000000\",fontStyle:\"\"};addPropertyControls(Counter,{decimal:{title:\"Decimal\",type:ControlType.Boolean,enabledTitle:\"Yes\",disabledTitle:\"No\"},value:{title:\"Value\",type:ControlType.Number,min:0,max:1e3,hidden(props){return props.decimal===true;}},decimalValue:{title:\"Value\",type:ControlType.Number,min:0,max:1e3,step:.01,hidden(props){return props.decimal===false;}},prefix:{title:\"Prefix\",type:ControlType.Boolean,enabledTitle:\"Yes\",disabledTitle:\"No\"},prefixText:{title:\"Prefix Value\",type:ControlType.String,hidden(props){return props.prefix===false;}},suffix:{title:\"Suffix\",type:ControlType.Boolean,enabledTitle:\"Yes\",disabledTitle:\"No\"},suffixText:{title:\"Suffix Value\",type:ControlType.String,hidden(props){return props.suffix===false;}},direction:{title:\"Direction\",type:ControlType.Enum,options:[\"up\",\"down\"]},stiffness:{title:\"Stiffness\",type:ControlType.Number,min:1,max:1e3},damping:{title:\"Damping\",type:ControlType.Number,min:0,max:100},color:{title:\"Color\",type:ControlType.Color},fontStyle:{title:\"Font Style\",type:\"font\",controls:\"extended\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Counter\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Counter.map", "import{useState,useEffect}from\"react\";import{Data,useObserveData}from\"framer\";export function createStore(state1){// Use Data so that a Preview reload resets the state\nconst dataStore=Data({state:Object.freeze({...state1})});// Create a set function that updates the state\nconst setDataStore=newState=>{// If the state is an object, make sure we copy it\nif(typeof newState===\"function\"){newState=newState(dataStore.state);}dataStore.state=Object.freeze({...dataStore.state,...newState});};// Store the initial state, copy the object if it's an object\nlet storeState=typeof state1===\"object\"?Object.freeze({...state1}):state1;// Keep a list of all the listeners, in the form of React hook setters\nconst storeSetters=new Set();// Create a set function that updates all the listeners / setters\nconst setStoreState=newState=>{// If the state is an object, make sure we copy it\nif(typeof newState===\"function\"){newState=newState(storeState);}storeState=typeof newState===\"object\"?Object.freeze({...storeState,...newState}):newState;// Update all the listeners / setters with the new value\nstoreSetters.forEach(setter=>setter(storeState));};// Create the actual hook based on everything above\nfunction useStore(){// Create the hook we are going to use as a listener\nconst[state,setState]=useState(storeState);// If we unmount the component using this hook, we need to remove the listener\n// @ts-ignore\nuseEffect(()=>{// But right now, we need to add the listener\nstoreSetters.add(setState);return()=>storeSetters.delete(setState);},[]);// If Data context exists, use Data, otherwise use vanilla React state\nif(useObserveData()===true){useObserveData();return[dataStore.state,setDataStore];}else{// Return the state and a function to update the central store\nreturn[state,setStoreState];}}return useStore;}\nexport const __FramerMetadata__ = {\"exports\":{\"createStore\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./createStore.map", "export const centerContent = {\n    display: \"flex\",\n    justifyContent: \"center\",\n    alignItems: \"center\"\n};\nexport const autoSizingText = {\n    width: \"max-content\",\n    wordBreak: \"break-word\",\n    overflowWrap: \"break-word\",\n    overflow: \"hidden\",\n    whiteSpace: \"pre-wrap\",\n    flexShrink: 0\n};\nexport const defaultContainerStyles = {\n    ...centerContent,\n    overflow: \"hidden\"\n};\nexport const containerStyles = defaultContainerStyles;\nexport const randomColor = ()=>\"#\" + Math.floor(Math.random() * 16777215).toString(16)\n;\n\nexport const __FramerMetadata__ = {\"exports\":{\"centerContent\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"containerStyles\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"autoSizingText\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"defaultContainerStyles\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"randomColor\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}}}}\n//# sourceMappingURL=./Utils.map", "import{jsx as _jsx}from\"react/jsx-runtime\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import{randomColor}from\"https://framer.com/m/framer/utils.js@^0.9.0\";// Learn more: https://www.framer.com/docs/guides/overrides/\nconst useStore=createStore({background:\"#0099FF\"});export function withRotate(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,animate:{rotate:90},transition:{duration:4}});};}export function withHover(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,whileHover:{scale:1.05}});};}export function withRandomColor(Component){return props=>{const[store,setStore]=useStore();return /*#__PURE__*/_jsx(Component,{...props,animate:{background:store.background},onClick:()=>{setStore({background:randomColor()});}});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withRandomColor\":{\"type\":\"reactHoc\",\"name\":\"withRandomColor\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHover\":{\"type\":\"reactHoc\",\"name\":\"withHover\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRotate\":{\"type\":\"reactHoc\",\"name\":\"withRotate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Examples.map"],
  "mappings": "4HAQkB,SAARA,EAAyB,CAAC,QAAAC,EAAQ,MAAAC,EAAM,aAAAC,EAAa,UAAAC,EAAU,UAAAC,EAAU,QAAAC,EAAQ,OAAAC,EAAO,WAAAC,EAAW,OAAAC,EAAO,WAAAC,EAAW,MAAAC,EAAM,UAAAC,CAAS,EAAE,CAAsB,IAAMC,EAAIC,EAAO,IAAI,EAAQC,EAAoBd,IAAU,GAAKE,EAAaD,EAAYc,EAAYC,EAAeb,IAAY,OAAOW,EAAoB,CAAY,EAAQG,EAAYC,EAAUH,EAAY,CAAC,QAAQV,EAAQ,UAAUD,CAAS,CAAC,EAAQe,EAASC,EAAUR,EAAI,CAAC,KAAK,GAAK,OAAO,QAAQ,CAAC,EA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AQA,EAAOH,CAAU,CAAC,CAAE,EACjD,SAASI,GAAU,CACnB,GAAK,CAACC,EAAMC,CAAQ,EAAEC,EAASP,CAAU,EAIzC,OAFAQ,EAAU,KACVP,EAAa,IAAIK,CAAQ,EAAQ,IAAIL,EAAa,OAAOK,CAAQ,GAAI,CAAC,CAAC,EACpEG,EAAe,IAAI,IAAMA,EAAe,EAAQ,CAACb,EAAU,MAAME,CAAY,GAC1E,CAACO,EAAMH,CAAa,CAAG,CAAC,OAAOE,CAAS,CCfvC,IAAMM,EAAgB,CACzB,QAAS,OACT,eAAgB,SAChB,WAAY,QAChB,EASO,IAAMC,EAAyB,CAClC,GAAGC,EACH,SAAU,QACd,ECfA,IAAMC,GAASC,EAAY,CAAC,WAAW,SAAS,CAAC,EAA4J,SAASC,GAAUC,EAAU,CAAC,OAAOC,GAA4BC,EAAKF,EAAU,CAAC,GAAGC,EAAM,WAAW,CAAC,MAAM,IAAI,CAAC,CAAC,CAAI",
  "names": ["Counter", "decimal", "value", "decimalValue", "direction", "stiffness", "damping", "prefix", "prefixText", "suffix", "suffixText", "color", "fontStyle", "ref", "pe", "updatedDecimalValue", "motionValue", "useMotionValue", "springValue", "useSpring", "isInView", "useInView", "ue", "latest", "u", "l", "p", "addPropertyControls", "ControlType", "props", "createStore", "state1", "dataStore", "Data", "setDataStore", "newState", "storeState", "storeSetters", "setStoreState", "setter", "useStore", "state", "setState", "ye", "ue", "useObserveData", "centerContent", "defaultContainerStyles", "centerContent", "useStore", "createStore", "withHover", "Component", "props", "p"]
}
