{"version":3,"file":"TextOverrides.DoP_dk4-.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/YUDagPEc7VMJAlM6Njhr/fhbMCCd4BSa04mO01oh0/TextOverrides.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect,useRef,forwardRef,isValidElement,cloneElement}from\"react\";import{useInView,animate}from\"framer-motion\";// Swap only the text leaves so the layer's text style and colour stay intact.\nfunction replaceText(node,text){if(typeof node===\"string\"||typeof node===\"number\")return text;if(Array.isArray(node))return node.map(child=>replaceText(child,text));if(/*#__PURE__*/isValidElement(node)){const props=node.props;if(props&&props.children!==undefined){return /*#__PURE__*/cloneElement(node,undefined,replaceText(props.children,text));}}return node;}function formatTime(d){const pad=n=>String(n).padStart(2,\"0\");return pad(d.getHours())+\":\"+pad(d.getMinutes())+\":\"+pad(d.getSeconds());}export function withLiveClock(Component){return function LiveClock(props){const[time,setTime]=useState(null);useEffect(()=>{const tick=()=>setTime(formatTime(new Date));tick();const id=window.setInterval(tick,1e3);return()=>window.clearInterval(id);},[]);return /*#__PURE__*/_jsx(Component,{...props,children:time===null?props.children:replaceText(props.children,time)});};}export function withCopyLink(Component){return function CopyLink(props){const[copied,setCopied]=useState(false);useEffect(()=>{if(!copied)return;const id=window.setTimeout(()=>setCopied(false),1800);return()=>window.clearTimeout(id);},[copied]);function handleClick(){if(typeof window!==\"undefined\"&&navigator.clipboard){navigator.clipboard.writeText(window.location.href).catch(()=>{});}setCopied(true);}return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick,style:{...props.style,cursor:\"pointer\"},children:copied?replaceText(props.children,\"COPIED ✓\"):props.children});};}// First string leaf of the rendered text, so the count reads the layer's own copy.\nfunction firstText(node){if(typeof node===\"string\"||typeof node===\"number\")return String(node);if(Array.isArray(node)){for(const child of node){const t=firstText(child);if(t!==null)return t;}return null;}if(/*#__PURE__*/isValidElement(node))return firstText(node.props?.children);return null;}// Counts the first number in the text up from 0 when it scrolls into view.\n// \"24/7\" -> 0/7 ... 24/7, \"<48h\" -> <0h ... <48h, \"12,480\" keeps its separator.\nexport function withCountUp(Component){return /*#__PURE__*/forwardRef(function CountUp(props,forwarded){const ref=useRef(null);const inView=useInView(ref,{once:true,margin:\"0px 0px -15% 0px\"});const fromProp=typeof props.text===\"string\";const source=fromProp?props.text:firstText(props.children);const match=source?source.match(/\\d[\\d,]*(\\.\\d+)?/):null;const[shown,setShown]=useState(null);useEffect(()=>{if(!source||!match)return;const target=parseFloat(match[0].replace(/,/g,\"\"));const decimals=match[1]?match[1].length-1:0;const grouped=match[0].includes(\",\");const fmt=v=>{const n=decimals?v.toFixed(decimals):String(Math.round(v));const out=grouped?Number(n).toLocaleString(\"en-US\",{minimumFractionDigits:decimals,maximumFractionDigits:decimals}):n;return source.replace(match[0],out);};if(!inView){setShown(fmt(0));return;}const controls=animate(0,target,{duration:1.6,ease:[.16,1,.3,1],onUpdate:v=>setShown(fmt(v))});return()=>controls.stop();},[inView,source]);const setRef=el=>{ref.current=el;if(typeof forwarded===\"function\")forwarded(el);else if(forwarded)forwarded.current=el;};return /*#__PURE__*/_jsx(Component,{...props,ref:setRef,...shown===null?{}:fromProp?{text:shown}:{children:replaceText(props.children,shown)}});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withCountUp\":{\"type\":\"reactHoc\",\"name\":\"withCountUp\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withLiveClock\":{\"type\":\"reactHoc\",\"name\":\"withLiveClock\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCopyLink\":{\"type\":\"reactHoc\",\"name\":\"withCopyLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TextOverrides.map"],"mappings":"kOACA,SAAS,EAAY,EAAK,EAAK,CAAC,GAAG,OAAO,GAAO,UAAU,OAAO,GAAO,SAAS,OAAO,EAAK,GAAG,MAAM,QAAQ,CAAI,EAAE,OAAO,EAAK,I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