// snippets/Loading/TTFB.js | sha256:7e9187ba15c2c402 | https://github.com/nucliweb/webperf-snippets/blob/main/snippets/Loading/TTFB.js (()=>{new PerformanceObserver(e=>{const[t]=e.getEntriesByType("navigation"),r=Math.max(0,t.responseStart-(t.activationStart||0));let o,n;r<=800?(o="Good",n="#22c55e"):r<=1800?(o="Needs Improvement",n="#f59e0b"):(o="Poor",n="#ef4444")}).observe({type:"navigation",buffered:!0});const[e]=performance.getEntriesByType("navigation");if(!e)return{script:"TTFB",status:"error",error:"No navigation entry"};const t=Math.round(Math.max(0,e.responseStart-(e.activationStart||0)));return{script:"TTFB",status:"ok",metric:"TTFB",value:t,unit:"ms",rating:t<=800?"good":t<=1800?"needs-improvement":"poor",thresholds:{good:800,needsImprovement:1800}}})();