'use strict';

// src/features/token-optimizer/domain/mode.ts
var ENABLE_MODE_ALIASES = ["on", "enable", "enabled", "true", "1", "\uCF1C\uAE30", "\uCF1C\uC9D0", "\uD65C\uC131\uD654"];
var DISABLE_MODE_ALIASES = ["off", "disable", "disabled", "false", "0", "\uB044\uAE30", "\uAEBC\uC9D0", "\uBE44\uD65C\uC131\uD654"];
var STATUS_MODE_ALIASES = ["status", "state", "\uC0C1\uD0DC", "\uD655\uC778"];
var TOGGLE_MODE_ALIASES = ["toggle", "switch", "\uC804\uD658"];
function parseTokenOptimizerMode(rawArg) {
  const normalized = rawArg?.trim().toLowerCase();
  if (!normalized) {
    return "toggle";
  }
  if (ENABLE_MODE_ALIASES.includes(normalized)) {
    return "enable";
  }
  if (DISABLE_MODE_ALIASES.includes(normalized)) {
    return "disable";
  }
  if (STATUS_MODE_ALIASES.includes(normalized)) {
    return "status";
  }
  if (TOGGLE_MODE_ALIASES.includes(normalized)) {
    return "toggle";
  }
  return void 0;
}
function formatTokenOptimizerLabel(enabled) {
  return enabled ? "\uD65C\uC131\uD654" : "\uBE44\uD65C\uC131\uD654";
}
function resolveNextTokenOptimizerEnabled(previousEnabled, requestedMode) {
  if (requestedMode === "status") {
    return previousEnabled;
  }
  if (requestedMode === "enable") {
    return true;
  }
  if (requestedMode === "disable") {
    return false;
  }
  return !previousEnabled;
}
function formatTokenOptimizerOutput(previousEnabled, nextEnabled, requestedMode) {
  const unchanged = previousEnabled === nextEnabled;
  return [
    requestedMode === "status" ? "\uD1A0\uD070 \uCD5C\uC801\uD654 \uC124\uC815 \uC0C1\uD0DC\uB97C \uD655\uC778\uD588\uC2B5\uB2C8\uB2E4." : unchanged ? "\uD1A0\uD070 \uCD5C\uC801\uD654 \uC124\uC815 \uC0C1\uD0DC\uB97C \uC720\uC9C0\uD588\uC2B5\uB2C8\uB2E4." : "\uD1A0\uD070 \uCD5C\uC801\uD654 \uC124\uC815 \uC0C1\uD0DC\uB97C \uBCC0\uACBD\uD588\uC2B5\uB2C8\uB2E4.",
    `\uC774\uC804 \uC0C1\uD0DC: ${formatTokenOptimizerLabel(previousEnabled)}`,
    `\uD604\uC7AC \uC0C1\uD0DC: ${formatTokenOptimizerLabel(nextEnabled)}`,
    "",
    "- on \uC0C1\uD0DC\uC5D0\uC11C\uB294 \uC11C\uBE44\uC2A4 \uD638\uCD9C \uC9C1\uC804 \uCD5C\uC885 \uD504\uB86C\uD504\uD2B8 \uBB38\uC790\uC5F4\uC5D0 \uBCF4\uC218\uC801 \uD1A0\uD070 \uCD5C\uC801\uD654 preset\uC744 \uC801\uC6A9\uD569\uB2C8\uB2E4.",
    "- \uD604\uC7AC preset\uC740 \uBAA8\uB4E0 \uBAA8\uB4DC\uC5D0\uC11C ANSI \uCF54\uB4DC\uB97C \uC81C\uAC70\uD558\uACE0, review/commit \uD504\uB86C\uD504\uD2B8\uC5D0\uB294 \uBE48 \uC904 \uC81C\uAC70\uC640 \uAE34 \uC904 \uC81C\uD55C\uC744 \uCD94\uAC00\uD569\uB2C8\uB2E4.",
    "- off \uC0C1\uD0DC\uC5D0\uC11C\uB294 \uCD5C\uC801\uD654 \uC5C6\uC774 \uC6D0\uBCF8 \uD14D\uC2A4\uD2B8\uB97C \uADF8\uB300\uB85C \uC804\uB2EC\uD569\uB2C8\uB2E4.",
    "- \uC801\uC6A9 \uBC94\uC704: \uD604\uC7AC \uC791\uC5C5 \uB514\uB809\uD130\uB9AC\uC758 `.ju-hong-e/token-optimizer-config.json`"
  ].join("\n");
}
function buildTokenOptimizerSummary(previousEnabled, nextEnabled, requestedMode) {
  if (requestedMode === "status") {
    return `\uD1A0\uD070 \uCD5C\uC801\uD654 \uC0C1\uD0DC \uD655\uC778: ${formatTokenOptimizerLabel(nextEnabled)}`;
  }
  return `\uD1A0\uD070 \uCD5C\uC801\uD654 ${previousEnabled === nextEnabled ? "\uC720\uC9C0" : "\uBCC0\uACBD"}: ${formatTokenOptimizerLabel(nextEnabled)}`;
}

exports.buildTokenOptimizerSummary = buildTokenOptimizerSummary;
exports.formatTokenOptimizerLabel = formatTokenOptimizerLabel;
exports.formatTokenOptimizerOutput = formatTokenOptimizerOutput;
exports.parseTokenOptimizerMode = parseTokenOptimizerMode;
exports.resolveNextTokenOptimizerEnabled = resolveNextTokenOptimizerEnabled;
