/**
 * The ONE place this package renders a USD amount as text.
 *
 * Extracted (GENC-1464 budget meter) from the ad-hoc `.toFixed(2)` call sites
 * that had grown in `formatBlockedReason` and the settings modal's cost blocks,
 * so the blocked banner, the session-cost figures and the budget meter cannot
 * drift to different precisions. Two decimals always — money columns jitter
 * when "$5.1" sits above "$5.10".
 *
 * @internal
 */

/** Decimal places for every USD figure this package renders. */
export const USD_DECIMALS = 2;

/**
 * The bare amount, no currency sign — `(12.3) => "12.30"`.
 *
 * Exists for the settings modal's cost blocks, where the `$` is a separately
 * styled `<span class="prefix">` and folding it into the text would change the
 * DOM those styles target.
 */
export const formatUsdAmount = (value: number): string => value.toFixed(USD_DECIMALS);

/** A signed USD figure — `(12.3) => "$12.30"`. */
export const formatUsd = (value: number): string => `$${formatUsdAmount(value)}`;
