{"version":3,"file":"CountUpStat.oea4HOty.mjs","names":["useRef","__esmMin","window","init_ssg_sandbox_shims","init_npm_react_18_3_1","ce","init_jsx_runtime","c","de","useIsStaticRenderer","init_framer_DKtAEkcX","ensureStyles","STYLE_ID","style","STYLES","easeOutExpo","progress","format","decimals","original","fixed","value","whole","fraction","grouped","withCountUp","element","isStatic","root","walker","textNodes","node","target","host","parts","STAT_PATTERN","prefix","digits","suffix","total","write","ATTRIBUTE","finish","frame","timer","startedAt","step","now","DURATION_MS","observer","entries","entry","DELAY_MS","IN_VIEW_THRESHOLD","hostStyle","Component","props","init_CountUpStat"],"sources":["https:/framerusercontent.com/modules/EqtMMbR2A9BkFlvb0GX3/SNgvLMnkKbqGanL13yTM/CountUpStat.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{useIsStaticRenderer}from\"framer\";// How long the count runs, and how long it waits so the count starts just\n// after the column's reveal (the Stats Row staggers its columns 0.1s apart).\nconst DURATION_MS=1600;const DELAY_MS=150;// How much of the number must be on screen before it starts counting.\nconst IN_VIEW_THRESHOLD=.4;// Splits \"24hr\" into \"\" / \"24\" / \"hr\", and \"8M+\" into \"\" / \"8\" / \"M+\".\nconst STAT_PATTERN=/^(\\D*)(\\d[\\d,]*(?:\\.\\d+)?)(.*)$/;// The real figure never leaves the DOM: while counting, the text is made\n// transparent and the running value is painted over it from an attribute via\n// ::after. Generated content is not part of textContent or innerText, so\n// crawlers and LLMs that read the rendered page get \"24hr\", not \"0hr\". The\n// `/ \"\"` alt text keeps screen readers from announcing the running value too.\nconst STYLE_ID=\"count-up-stat-style\";const ATTRIBUTE=\"data-count-up\";const STYLES=`\n[${ATTRIBUTE}] {\n    position: relative;\n    color: transparent !important;\n    -webkit-text-fill-color: transparent !important;\n}\n[${ATTRIBUTE}]::after {\n    content: attr(${ATTRIBUTE});\n    content: attr(${ATTRIBUTE}) / \"\";\n    position: absolute;\n    top: 0;\n    left: 0;\n    right: 0;\n    white-space: nowrap;\n    pointer-events: none;\n    color: var(--count-up-color);\n    -webkit-text-fill-color: var(--count-up-color);\n}\n[${ATTRIBUTE}][${ATTRIBUTE}-inline]::after {\n    /* An inline host's box is the font's content area, so \"normal\" puts the\n       glyphs on the same baseline as the real text underneath. A block host\n       (Framer's own h1/p) keeps its inherited line-height instead. */\n    line-height: normal;\n}\n`;function ensureStyles(){if(document.getElementById(STYLE_ID))return;const style=document.createElement(\"style\");style.id=STYLE_ID;style.textContent=STYLES;document.head.appendChild(style);}function easeOutExpo(progress){return progress>=1?1:1-Math.pow(2,-10*progress);}// Writes the running value the way the original was written: same thousands\n// separators, same number of decimals.\nfunction format(value,original){const decimals=original.includes(\".\")?original.split(\".\")[1].length:0;const fixed=value.toFixed(decimals);if(!original.includes(\",\"))return fixed;const[whole,fraction]=fixed.split(\".\");const grouped=whole.replace(/\\B(?=(\\d{3})+(?!\\d))/g,\",\");return fraction?`${grouped}.${fraction}`:grouped;}/**\n * Apply to a stat text layer such as \"24hr\", \"8M+\", \"250+\" or \"30+\".\n *\n * The number ticks up from zero the first time it scrolls into view. The target\n * is read from the layer's own text, so the copy stays editable on the canvas and\n * whatever prefix or suffix it carries (\"hr\", \"M+\", \"+\") is preserved exactly.\n *\n * The layer keeps its own text style, colour and responsive sizes, and its real\n * text is never rewritten: the running value is painted over it (see STYLES),\n * so the true figure is always what the page's text says.\n *\n * Counting is skipped — leaving the final value on screen — on the canvas, for\n * visitors who ask for reduced motion, and for any text with no number in it.\n */export function withCountUp(Component){return function CountUp(props){const element=useRef(null);const isStatic=useIsStaticRenderer();useEffect(()=>{if(isStatic||typeof window===\"undefined\")return;const root=element.current;if(!root)return;if(window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches){return;}// Framer renders the copy as one text node inside nested spans. If it\n// is split across several runs, leave the text alone.\nconst walker=document.createTreeWalker(root,NodeFilter.SHOW_TEXT);const textNodes=[];while(walker.nextNode()){const node=walker.currentNode;if((node.nodeValue??\"\").trim()!==\"\")textNodes.push(node);}if(textNodes.length!==1)return;const target=textNodes[0];const host=target.parentElement;if(!host)return;const original=target.nodeValue??\"\";const parts=original.match(STAT_PATTERN);if(!parts)return;const[,prefix,digits,suffix]=parts;const total=Number(digits.replace(/,/g,\"\"));if(!Number.isFinite(total))return;const write=value=>{host.setAttribute(ATTRIBUTE,prefix+format(value,digits)+suffix);};// Hand back to the real text once the count lands on it.\nconst finish=()=>{host.removeAttribute(ATTRIBUTE);host.removeAttribute(`${ATTRIBUTE}-inline`);host.style.removeProperty(\"--count-up-color\");};let frame=0;let timer=0;let startedAt=0;const step=now=>{if(startedAt===0)startedAt=now;const progress=Math.min((now-startedAt)/DURATION_MS,1);if(progress>=1){finish();return;}write(total*easeOutExpo(progress));frame=window.requestAnimationFrame(step);};const observer=new IntersectionObserver(entries=>{if(!entries.some(entry=>entry.isIntersecting))return;observer.disconnect();timer=window.setTimeout(()=>{frame=window.requestAnimationFrame(step);},DELAY_MS);},{threshold:IN_VIEW_THRESHOLD});// Show zero only now that we know the count can actually run. The\n// overlay takes the text's own colour, read before it goes clear.\nensureStyles();const hostStyle=window.getComputedStyle(host);host.style.setProperty(\"--count-up-color\",hostStyle.color);if(hostStyle.display===\"inline\"){host.setAttribute(`${ATTRIBUTE}-inline`,\"\");}write(0);observer.observe(root);return()=>{observer.disconnect();window.clearTimeout(timer);window.cancelAnimationFrame(frame);finish();};},[isStatic]);return /*#__PURE__*/_jsx(Component,{...props,ref:element});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withCountUp\":{\"type\":\"reactHoc\",\"name\":\"withCountUp\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CountUpStat.map"],"mappings":"A,yLAiCE,SAASW,GAAc,CAAC,GAAG,SAAS,eAAeC,CAAQ,EAAE,OAAO,IAAMC,EAAM,SAAS,cAAc,OAAO,EAAE,EAAM,GAAGD,EAAS,EAAM,YAAYE,EAAO,SAAS,KA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