export { resolveTargetCharacters } from "../shared/summary-length.js";
export function formatOptionalString(value) {
    if (typeof value === "string" && value.trim().length > 0) {
        return value.trim();
    }
    return "none";
}
export function formatOptionalNumber(value) {
    if (typeof value === "number" && Number.isFinite(value)) {
        return String(value);
    }
    return "none";
}
export function sumNumbersOrNull(values) {
    let sum = 0;
    let any = false;
    for (const value of values) {
        if (typeof value === "number" && Number.isFinite(value)) {
            sum += value;
            any = true;
        }
    }
    return any ? sum : null;
}
export function formatUSD(value) {
    if (!Number.isFinite(value))
        return "n/a";
    return `$${value.toFixed(4)}`;
}
export function estimateWhisperTranscriptionCostUsd({ transcriptionProvider, transcriptSource, mediaDurationSeconds, openaiWhisperUsdPerMinute, }) {
    if (transcriptSource !== "whisper")
        return null;
    if (!transcriptionProvider || transcriptionProvider.toLowerCase() !== "openai")
        return null;
    if (typeof mediaDurationSeconds !== "number" ||
        !Number.isFinite(mediaDurationSeconds) ||
        mediaDurationSeconds <= 0) {
        return null;
    }
    const perSecond = openaiWhisperUsdPerMinute / 60;
    const cost = mediaDurationSeconds * perSecond;
    return Number.isFinite(cost) && cost > 0 ? cost : null;
}
//# sourceMappingURL=format.js.map