"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.formatHumanAiRunHours = formatHumanAiRunHours;
const SECONDS_PER_HOUR = 60 * 60;
const SECONDS_PER_MINUTE = 60;
const DURATION_UNITS = {
    en: {
        hour: "h",
        minute: "m",
        second: "s",
        separator: " ",
    },
    ja: {
        hour: "時間",
        minute: "分",
        second: "秒",
        separator: "",
    },
    zh: {
        hour: "小时",
        minute: "分",
        second: "秒",
        separator: "",
    },
};
function formatHumanAiRunHours(totalAiRunHours, locale) {
    const totalSeconds = Math.max(0, Math.round(totalAiRunHours * SECONDS_PER_HOUR));
    const hours = Math.trunc(totalSeconds / SECONDS_PER_HOUR);
    const remainingSeconds = totalSeconds % SECONDS_PER_HOUR;
    const minutes = Math.trunc(remainingSeconds / SECONDS_PER_MINUTE);
    const seconds = remainingSeconds % SECONDS_PER_MINUTE;
    const units = DURATION_UNITS[locale];
    const parts = [];
    if (hours > 0) {
        parts.push(`${hours}${units.hour}`);
    }
    if (minutes > 0) {
        parts.push(`${minutes}${units.minute}`);
    }
    if (seconds > 0 || parts.length === 0) {
        parts.push(`${seconds}${units.second}`);
    }
    return parts.join(units.separator);
}
