export function truncateToWidth(value, width) {
    if (width <= 0)
        return "";
    if (value.length <= width)
        return value;
    if (width <= 1)
        return "…";
    return `${value.slice(0, width - 1)}…`;
}
export function formatTokens(value) {
    if (value === undefined)
        return "n/a";
    if (value >= 1_000_000)
        return `${(value / 1_000_000).toFixed(1)}M`;
    if (value >= 1_000)
        return `${(value / 1_000).toFixed(1)}K`;
    return String(value);
}
