{"version":3,"file":"CountUpNumber.CyMMRcI9.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/d5ceWL9mQZOFVAP9Asp7/a559Nhtr6fgbTkRdQ1GB/CountUpNumber.js"],"sourcesContent":["import{jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{useEffect,useRef,useState}from\"react\";function prefersReducedMotion(){return typeof window!==\"undefined\"&&typeof window.matchMedia===\"function\"&&window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;}export default function CountUpNumber(props){const{value,decimals,prefix,suffix,duration,delay,threshold,replay,locale,fontFamily,fontSize,fontWeight,letterSpacing,color,style}=props;const isStatic=RenderTarget.current()!==RenderTarget.preview;const ref=useRef(null);/* Start on the finished number so server-rendered HTML, search engines\n       and the canvas never show a zero; the animation resets to 0 only\n       when the number actually scrolls into view. */const[current,setCurrent]=useState(value);useEffect(()=>{if(isStatic){setCurrent(value);return;}const node=ref.current;if(!node)return;/* Anyone who asked for less motion, or any browser without an\r\n           observer, simply gets the finished number. */if(prefersReducedMotion()||!(\"IntersectionObserver\"in window)){setCurrent(value);return;}let raf=0;let timer=0;let cancelled=false;const run=()=>{const startTime=performance.now();const tick=now=>{if(cancelled)return;const t=Math.min((now-startTime)/Math.max(duration*1e3,1),1);const eased=1-Math.pow(1-t,3);setCurrent(value*eased);if(t<1)raf=requestAnimationFrame(tick);};raf=requestAnimationFrame(tick);};const observer=new IntersectionObserver(entries=>{for(const entry of entries){if(entry.isIntersecting){timer=window.setTimeout(run,delay*1e3);if(!replay)observer.disconnect();}else if(replay){cancelAnimationFrame(raf);window.clearTimeout(timer);setCurrent(0);}}},{threshold:Math.min(Math.max(threshold,0),1)});observer.observe(node);return()=>{cancelled=true;observer.disconnect();cancelAnimationFrame(raf);window.clearTimeout(timer);};},[value,duration,delay,threshold,replay,isStatic]);/* An empty locale follows the visitor's own browser settings. */let formatted;try{formatted=current.toLocaleString(locale?locale:undefined,{minimumFractionDigits:decimals,maximumFractionDigits:decimals});}catch{formatted=current.toFixed(decimals);}/* The Font control hands back either a family string or a style object. */const fontStyle=typeof fontFamily===\"string\"?{fontFamily}:fontFamily??{};return /*#__PURE__*/_jsxs(\"div\",{ref:ref,style:{...style,display:\"flex\",alignItems:\"center\",...fontStyle,fontSize:fontSize,fontWeight:fontWeight,letterSpacing:letterSpacing+\"em\",lineHeight:1,color:color,fontVariantNumeric:\"tabular-nums\",whiteSpace:\"pre\"},children:[prefix,formatted,suffix]});}CountUpNumber.defaultProps={value:100,decimals:0,prefix:\"\",suffix:\"\",duration:1.8,delay:0,threshold:.4,replay:false,locale:\"\",fontFamily:\"Inter\",fontSize:80,fontWeight:700,letterSpacing:-.04,color:\"var(--token-c0b57eae-372f-498e-b01d-e9464d0a0851)\"};addPropertyControls(CountUpNumber,{value:{type:ControlType.Number,title:\"Value\",min:0,max:1e6,step:1,displayStepper:false},decimals:{type:ControlType.Number,title:\"Decimals\",min:0,max:3,step:1,displayStepper:true},prefix:{type:ControlType.String,title:\"Prefix\",defaultValue:\"\"},suffix:{type:ControlType.String,title:\"Suffix\",defaultValue:\"\"},duration:{type:ControlType.Number,title:\"Duration\",min:.2,max:6,step:.1,unit:\"s\"},delay:{type:ControlType.Number,title:\"Delay\",min:0,max:3,step:.05,unit:\"s\"},threshold:{type:ControlType.Number,title:\"Threshold\",min:0,max:1,step:.05},replay:{type:ControlType.Boolean,title:\"Replay\"},locale:{type:ControlType.String,title:\"Locale\",placeholder:\"Browser default\",description:\"Number formatting, e.g. en-US or da-DK. Leave empty to follow the visitor.\"},fontFamily:{type:ControlType.Font,controls:\"basic\",title:\"Font\"},fontSize:{type:ControlType.Number,title:\"Size\",min:8,max:300,step:1,unit:\"px\"},fontWeight:{type:ControlType.Number,title:\"Weight\",min:100,max:900,step:100},letterSpacing:{type:ControlType.Number,title:\"Tracking\",min:-.2,max:.5,step:.005,unit:\"em\"},color:{type:ControlType.Color,title:\"Color\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CountUpNumber\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CountUpNumber.map"],"mappings":"6MAA2J,SAAS,GAAsB,CAAC,OAAc,IAAS,QAAa,OAAO,EAAO,YAAa,YAAY,EAAO,WAAW,kCAAkC,CAAC,CAAC,OAAQ,CAAC,SAAwB,EAAc,EAAM,CAAC,GAAK,CAAC,QAAM,WAAS,SAAO,SAAO,WAAS,QAAM,YAAU,SAAO,SAAO,aAAW,WAAS,aAAW,gBAAc,QAAM,SAAO,EAAY,EAAS,EAAa,QAAQ,IAAI,EAAa,QAAc,EAAIA,EAAO,IAAI,EAEphB,CAAC,EAAQ,GAAYC,EAAS,CAAK,EAAE,MAAc,CAAC,GAAG,EAAS,CAAC,EAAW,CAAK,EAAE,MAAO,CAAC,IAAM,EAAK,EAAI,QAAQ,GAAG,CAAC,EAAK,OAC7H,GAAG,EAAqB,GAAG,EAAE,yBAAyB,GAAQ,CAAC,EAAW,CAAK,EAAE,MAAO,CAAC,IAAI,EAAI,EAAM,EAAM,EAAM,EAAU,GAAY,MAAQ,CAAC,IAAM,EAAU,YAAY,IAAI,EAAQ,EAAK,GAAK,CAAC,GAAG,EAAU,OAAO,IAAM,EAAE,KAAK,KAAK,EAAI,GAAW,KAAK,IAAI,EAAS,IAAI,CAAC,EAAE,CAAC,EAAQ,EAAM,GAAW,EAAE,IAAE,EAAG,EAAW,EAAM,CAAK,EAAK,EAAE,IAAE,EAAI,sBAAsB,CAAI,EAAE,EAAE,EAAI,sBAAsB,CAAI,CAAE,EAAQ,EAAS,IAAI,qBAAqB,GAAS,CAAC,IAAI,IAAM,KAAS,EAAY,EAAM,gBAAgB,EAAM,EAAO,WAAW,EAAI,EAAM,GAAG,EAAM,GAAO,EAAS,WAAW,GAAW,IAAQ,qBAAqB,CAAG,EAAE,EAAO,aAAa,CAAK,EAA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