/**
 * OMK Theme — Brand color style builders & semantic status helpers
 * Extracted from util/theme.ts to break God Module coupling
 */
import { P } from "../brand/palette.js";
import { esc, rgb, bgRgb, sanitizeTerminalText } from "./ansi.js";
function sanitizeStyleMap(styles) {
    const sanitized = {};
    for (const [key, value] of Object.entries(styles)) {
        sanitized[key] = typeof value === "function"
            ? ((s) => value(sanitizeTerminalText(s)))
            : value;
    }
    return sanitized;
}
export const glyph = {
    routed: "◇",
    blocked: "◆",
    active: "●",
    queued: "○",
    verified: "✓",
    failed: "✕",
    evidence: "▣",
    signal: "⟡",
    warning: "⟁",
};
export const style = sanitizeStyleMap({
    reset: esc("0"),
    bold: esc("1"),
    dim: esc("2"),
    italic: esc("3"),
    underline: esc("4"),
    // Brand colors
    purple: (s) => esc(rgb(P.purple.r, P.purple.g, P.purple.b)) + s + esc("0"),
    lightPurple: (s) => esc(rgb(P.lightPurple.r, P.lightPurple.g, P.lightPurple.b)) + s + esc("0"),
    darkPurple: (s) => esc(rgb(P.darkPurple.r, P.darkPurple.g, P.darkPurple.b)) + s + esc("0"),
    pink: (s) => esc(rgb(P.pink.r, P.pink.g, P.pink.b)) + s + esc("0"),
    hotPink: (s) => esc(rgb(P.hotPink.r, P.hotPink.g, P.hotPink.b)) + s + esc("0"),
    mint: (s) => esc(rgb(P.mint.r, P.mint.g, P.mint.b)) + s + esc("0"),
    darkMint: (s) => esc(rgb(P.darkMint.r, P.darkMint.g, P.darkMint.b)) + s + esc("0"),
    orange: (s) => esc(rgb(P.orange.r, P.orange.g, P.orange.b)) + s + esc("0"),
    red: (s) => esc(rgb(P.red.r, P.red.g, P.red.b)) + s + esc("0"),
    blue: (s) => esc(rgb(P.blue.r, P.blue.g, P.blue.b)) + s + esc("0"),
    cream: (s) => esc(rgb(P.cream.r, P.cream.g, P.cream.b)) + s + esc("0"),
    gray: (s) => esc(rgb(P.gray.r, P.gray.g, P.gray.b)) + s + esc("0"),
    skin: (s) => esc(rgb(P.skin.r, P.skin.g, P.skin.b)) + s + esc("0"),
    rust: (s) => esc(rgb(P.rustOrange.r, P.rustOrange.g, P.rustOrange.b)) + s + esc("0"),
    rustBold: (s) => esc("1;" + rgb(P.rustOrange.r, P.rustOrange.g, P.rustOrange.b)) + s + esc("0"),
    rustOxide: (s) => esc(rgb(P.rustOxide.r, P.rustOxide.g, P.rustOxide.b)) + s + esc("0"),
    cargoGreen: (s) => esc(rgb(P.cargoGreen.r, P.cargoGreen.g, P.cargoGreen.b)) + s + esc("0"),
    matrixGreen: (s) => esc(rgb(P.matrixGreen.r, P.matrixGreen.g, P.matrixGreen.b)) + s + esc("0"),
    matrixDark: (s) => esc(rgb(P.matrixDark.r, P.matrixDark.g, P.matrixDark.b)) + s + esc("0"),
    // Combos
    purpleBold: (s) => esc("1;" + rgb(P.purple.r, P.purple.g, P.purple.b)) + s + esc("0"),
    pinkBold: (s) => esc("1;" + rgb(P.pink.r, P.pink.g, P.pink.b)) + s + esc("0"),
    mintBold: (s) => esc("1;" + rgb(P.mint.r, P.mint.g, P.mint.b)) + s + esc("0"),
    blueBold: (s) => esc("1;" + rgb(P.blue.r, P.blue.g, P.blue.b)) + s + esc("0"),
    creamBold: (s) => esc("1;" + rgb(P.cream.r, P.cream.g, P.cream.b)) + s + esc("0"),
    // Backgrounds
    bgPurple: (s) => esc(bgRgb(P.purple.r, P.purple.g, P.purple.b) + ";" + rgb(255, 255, 255)) + s + esc("0"),
    bgPink: (s) => esc(bgRgb(P.pink.r, P.pink.g, P.pink.b) + ";" + rgb(255, 255, 255)) + s + esc("0"),
    bgDark: (s) => esc(bgRgb(P.dark.r, P.dark.g, P.dark.b) + ";" + rgb(P.cream.r, P.cream.g, P.cream.b)) + s + esc("0"),
    // Parallel UI extras
    orangeBold: (s) => esc("1;" + rgb(P.orange.r, P.orange.g, P.orange.b)) + s + esc("0"),
    redBold: (s) => esc("1;" + rgb(P.red.r, P.red.g, P.red.b)) + s + esc("0"),
    // Matrix theme
    phosphor: (s) => esc(rgb(P.matrixGreen.r, P.matrixGreen.g, P.matrixGreen.b)) + s + esc("0"),
    phosphorBold: (s) => esc("1;" + rgb(P.matrixGreen.r, P.matrixGreen.g, P.matrixGreen.b)) + s + esc("0"),
    phosphorDim: (s) => esc("2;" + rgb(P.matrixGreen.r, P.matrixGreen.g, P.matrixGreen.b)) + s + esc("0"),
    matrixBlack: (s) => esc(rgb(0, 0, 0)) + s + esc("0"),
    bgMatrix: (s) => esc(bgRgb(0, 8, 0) + ";" + rgb(P.matrixGreen.r, P.matrixGreen.g, P.matrixGreen.b)) + s + esc("0"),
    // Matrix rain palette entries
    rainGreen: (s) => esc(rgb(P.matrixRainGreen.r, P.matrixRainGreen.g, P.matrixRainGreen.b)) + s + esc("0"),
    rainGreenBold: (s) => esc("1;" + rgb(P.matrixRainGreen.r, P.matrixRainGreen.g, P.matrixRainGreen.b)) + s + esc("0"),
    rainGreenDim: (s) => esc("2;" + rgb(P.matrixRainGreen.r, P.matrixRainGreen.g, P.matrixRainGreen.b)) + s + esc("0"),
    rainBgDeep: (s) => esc(bgRgb(P.matrixDeepBg.r, P.matrixDeepBg.g, P.matrixDeepBg.b) + ";" + rgb(P.matrixRainGreen.r, P.matrixRainGreen.g, P.matrixRainGreen.b)) + s + esc("0"),
    rainWarning: (s) => esc(rgb(P.matrixWarningAmber.r, P.matrixWarningAmber.g, P.matrixWarningAmber.b)) + s + esc("0"),
    rainError: (s) => esc(rgb(P.matrixErrorRed.r, P.matrixErrorRed.g, P.matrixErrorRed.b)) + s + esc("0"),
    // Metrics
    cyan: (s) => esc(rgb(P.metricsCyan.r, P.metricsCyan.g, P.metricsCyan.b)) + s + esc("0"),
    cyanBold: (s) => esc("1;" + rgb(P.metricsCyan.r, P.metricsCyan.g, P.metricsCyan.b)) + s + esc("0"),
    navy: (s) => esc(rgb(P.metricsNavy.r, P.metricsNavy.g, P.metricsNavy.b)) + s + esc("0"),
    slate: (s) => esc(rgb(P.metricsSlate.r, P.metricsSlate.g, P.metricsSlate.b)) + s + esc("0"),
    silver: (s) => esc(rgb(P.metricsSilver.r, P.metricsSilver.g, P.metricsSilver.b)) + s + esc("0"),
    white: (s) => esc(rgb(P.metricsWhite.r, P.metricsWhite.g, P.metricsWhite.b)) + s + esc("0"),
    whiteBold: (s) => esc("1;" + rgb(P.metricsWhite.r, P.metricsWhite.g, P.metricsWhite.b)) + s + esc("0"),
    amber: (s) => esc(rgb(P.metricsAmber.r, P.metricsAmber.g, P.metricsAmber.b)) + s + esc("0"),
    green: (s) => esc(rgb(P.metricsGreen.r, P.metricsGreen.g, P.metricsGreen.b)) + s + esc("0"),
    greenBold: (s) => esc("1;" + rgb(P.metricsGreen.r, P.metricsGreen.g, P.metricsGreen.b)) + s + esc("0"),
    metricsRed: (s) => esc(rgb(P.metricsRed.r, P.metricsRed.g, P.metricsRed.b)) + s + esc("0"),
    metricsBlue: (s) => esc(rgb(P.metricsBlue.r, P.metricsBlue.g, P.metricsBlue.b)) + s + esc("0"),
    violet: (s) => esc(rgb(P.metricsViolet.r, P.metricsViolet.g, P.metricsViolet.b)) + s + esc("0"),
    bgNavy: (s) => esc(bgRgb(P.metricsNavy.r, P.metricsNavy.g, P.metricsNavy.b) + ";" + rgb(P.metricsWhite.r, P.metricsWhite.g, P.metricsWhite.b)) + s + esc("0"),
    bgSlate: (s) => esc(bgRgb(P.metricsSlate.r, P.metricsSlate.g, P.metricsSlate.b) + ";" + rgb(P.metricsSilver.r, P.metricsSilver.g, P.metricsSilver.b)) + s + esc("0"),
    amberBold: (s) => esc("1;" + rgb(P.metricsAmber.r, P.metricsAmber.g, P.metricsAmber.b)) + s + esc("0"),
    metricsRedBold: (s) => esc("1;" + rgb(P.metricsRed.r, P.metricsRed.g, P.metricsRed.b)) + s + esc("0"),
});
export const status = {
    ok: (s) => style.mintBold(`${glyph.verified} ${s}`),
    warn: (s) => style.orange(`${glyph.warning} ${s}`),
    fail: (s) => style.red(`${glyph.failed} ${s}`),
    info: (s) => style.purple(`${glyph.signal} ${s}`),
    success: (s) => style.mint(`${glyph.verified} ${s}`),
    error: (s) => style.red(`${glyph.failed} ${s}`),
};
