var e=`train-metrics-sync`,t=`h-[220px] w-full`,n={top:4,right:8,bottom:0,left:4},r=/\.?0+$/,i=/^-0$/,a=[{step:0,loss:2.8},{step:50,loss:2.4},{step:100,loss:2},{step:150,loss:1.7},{step:200,loss:1.5}];function o(e){return Math.log10((Number.isFinite(e)?Math.max(e,0):0)+1)}function s(e){return Math.max(0,10**e-1)}function c(e){if(!Number.isFinite(e))return`0`;let t=Math.abs(e),n=6;return n=t>=1e3?0:t>=100?2:t>=1?4:t>=.01?5:t>=1e-4?6:8,e.toFixed(n).replace(r,``).replace(i,`0`)}function l(e){if(!Number.isFinite(e))return`0`;let t=Math.abs(e),n=4;return n=t>=1e3?0:t>=100?1:t>=1?3:t>=.01?4:5,e.toFixed(n).replace(r,``).replace(i,`0`)}function u(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(Math.round(e))}function d(e,t){if(e.length<=t)return e;let n=Math.ceil(e.length/t);return e.filter((t,r)=>r%n===0||r===e.length-1)}function f(e,t,n){return Math.min(n,Math.max(t,e))}function p(e,t,n=6){if(!(Number.isFinite(e)&&Number.isFinite(t)))return[0,1];if(t<=e)return[e,t];let r=Math.max(1,Math.ceil((t-e)/(n-1))),i=[],a=e;for(;a<t;)i.push(a),a+=r;return i.push(t),Array.from(new Set(i))}function m(e){let t=e.filter(e=>Number.isFinite(e));if(t.length===0)return[0,1];let n=Math.min(...t),r=Math.max(...t);if(n===r){let e=Math.abs(n),t=e>0?e*.08:.1;return[n-t,r+t]}let i=(r-n)*.12;return[n-i,r+i]}function h(e,t){if(t===`none`)return null;let n=e.filter(e=>Number.isFinite(e));if(n.length<3)return null;let r=[...n].sort((e,t)=>e-t),i=t===`p99`?.99:.95;return r[Math.max(0,Math.min(r.length-1,Math.floor((r.length-1)*i)))]??null}function g(e,t){let n=h(e,t);return n==null?e:e.map(e=>Math.min(e,n))}function _(e,t){if(e.length===0)return[];let n=e.map(e=>e.loss),r=n.every(e=>e===n[0]),i=0,a=0;return e.map(e=>{let n=e.loss;if(!Number.isFinite(n)||r)return{...e,smoothed:n};i=i*t+(1-t)*n,a+=1;let o=t===1?1:1-t**a;return{...e,smoothed:i/o}})}export{p as a,d as c,c as d,u as f,o as h,g as i,_ as l,a as m,e as n,m as o,s as p,n as r,f as s,t,l as u};