"use strict";
/* Socket Lib - Built with esbuild */
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var flag_predicates_exports = {};
__export(flag_predicates_exports, {
  getLogLevel: () => getLogLevel,
  isAll: () => isAll,
  isChanged: () => isChanged,
  isCoverage: () => isCoverage,
  isDebug: () => isDebug,
  isDryRun: () => isDryRun,
  isFix: () => isFix,
  isForce: () => isForce,
  isHelp: () => isHelp,
  isJson: () => isJson,
  isQuiet: () => isQuiet,
  isStaged: () => isStaged,
  isUpdate: () => isUpdate,
  isVerbose: () => isVerbose,
  isWatch: () => isWatch,
  makeFlagPredicate: () => makeFlagPredicate
});
module.exports = __toCommonJS(flag_predicates_exports);
var import_node_process = __toESM(require("node:process"));
var import_array = require("../primordials/array");
const processArg = [...import_node_process.default.argv];
function makeFlagPredicate(longFlags, shortFlags = [], keys = [longFlags[0].replace(/^--/, "")]) {
  const argvForms = [...longFlags, ...shortFlags];
  return function check(input) {
    if (!input) {
      return argvForms.some((f) => processArg.includes(f));
    }
    if ((0, import_array.ArrayIsArray)(input)) {
      return argvForms.some((f) => (0, import_array.ArrayPrototypeIncludes)(input, f));
    }
    return keys.some((k) => !!input[k]);
  };
}
const isAll = makeFlagPredicate(["--all"]);
const isChanged = makeFlagPredicate(["--changed"]);
const isCoverage = makeFlagPredicate(
  ["--coverage", "--cover"],
  [],
  ["coverage", "cover"]
);
const isDebug = makeFlagPredicate(["--debug"]);
const isDryRun = makeFlagPredicate(["--dry-run"], [], ["dry-run"]);
const isFix = makeFlagPredicate(["--fix"]);
const isForce = makeFlagPredicate(["--force"]);
const isHelp = makeFlagPredicate(["--help"], ["-h"]);
const isJson = makeFlagPredicate(["--json"]);
const isQuiet = makeFlagPredicate(
  ["--quiet", "--silent"],
  [],
  ["quiet", "silent"]
);
const isStaged = makeFlagPredicate(["--staged"]);
const isUpdate = makeFlagPredicate(["--update"], ["-u"]);
const isVerbose = makeFlagPredicate(["--verbose"]);
const isWatch = makeFlagPredicate(["--watch"], ["-w"]);
function getLogLevel(input) {
  if (isQuiet(input)) {
    return "silent";
  }
  if (isDebug(input)) {
    return "debug";
  }
  if (isVerbose(input)) {
    return "verbose";
  }
  return "info";
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  getLogLevel,
  isAll,
  isChanged,
  isCoverage,
  isDebug,
  isDryRun,
  isFix,
  isForce,
  isHelp,
  isJson,
  isQuiet,
  isStaged,
  isUpdate,
  isVerbose,
  isWatch,
  makeFlagPredicate
});
