import{onCLS as t,onLCP as u,onFCP as l,onTTFB as i}from"web-vitals";import{useMount as P}from"@redocly/theme/core/openapi";function f({sendTelemetry:a}){P(()=>{const n={},r=[new Promise(o=>t(e=>o({name:"CLS",value:e.value}))),new Promise(o=>u(e=>o({name:"LCP",value:e.value}))),new Promise(o=>l(e=>o({name:"FCP",value:e.value}))),new Promise(o=>i(e=>o({name:"TTFB",value:e.value})))];Promise.allSettled(r).then(o=>{o.forEach(e=>{if(e.status==="fulfilled"){const{name:m,value:s}=e.value;n[m]=Math.round(s)}}),a(n)})})}export{f as usePerformanceMetrics};
