import { MODES, DEPRECATED_MODES } from "../types.js";
import { createLogger } from "../logger.js";
const log = createLogger("mode");
const DEPRECATION_MAP = {
  fast: "cache",
  balanced: "default",
  deep: "default"
};
function assertMode(value) {
  if (value === void 0) return;
  if (typeof value !== "string") {
    throw new Error(`Invalid mode: ${JSON.stringify(value)}. Valid: ${MODES.join(", ")}`);
  }
  const all = [...MODES, ...DEPRECATED_MODES];
  if (!all.includes(value)) {
    throw new Error(`Invalid mode: ${JSON.stringify(value)}. Valid: ${MODES.join(", ")}`);
  }
}
function resolveMode(value) {
  assertMode(value);
  if (value === void 0) return "default";
  if (DEPRECATED_MODES.includes(value)) {
    const dep = value;
    const next = DEPRECATION_MAP[dep];
    log.warn(`mode '${dep}' deprecated, use '${next === "cache" ? "cache" : "no mode or 'default'"}'`);
    return next;
  }
  return value;
}
export {
  assertMode,
  resolveMode
};
//# sourceMappingURL=mode.js.map