"use strict";
/* Socket Lib - Built with esbuild */
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var detect_format_exports = {};
__export(detect_format_exports, {
  detectFormat: () => detectFormat,
  jsDetectFormat: () => jsDetectFormat,
  supportedFiles: () => supportedFiles
});
module.exports = __toCommonJS(detect_format_exports);
var import_lockfile_format = require("../cargo/lockfile-format");
var import_manifest_format = require("../cargo/manifest-format");
var import_manifest_format2 = require("../npm/manifest-format");
var import_lockfile_format2 = require("../npm/npm/lockfile-format");
var import_lockfile_format3 = require("../npm/pnpm/lockfile-format");
var import_lockfile_format4 = require("../npm/yarnpkg/yarn/lockfile-format");
var import_object = require("../../primordials/object");
var import_manifest = require("../../smol/manifest");
var import_string = require("../../primordials/string");
const COMPOSER_JSON_FORMAT = (0, import_object.ObjectFreeze)({
  __proto__: null,
  ecosystem: "composer",
  type: "manifest"
});
const COMPOSER_LOCK_FORMAT = (0, import_object.ObjectFreeze)({
  __proto__: null,
  ecosystem: "composer",
  format: "composer",
  type: "lockfile"
});
const MANIFEST_NAMES = (0, import_object.ObjectFreeze)([
  import_manifest_format2.PACKAGE_JSON_FILENAME,
  import_manifest_format.CARGO_TOML_FILENAME,
  "composer.json"
]);
const LOCKFILE_NAMES = (0, import_object.ObjectFreeze)([
  ...import_lockfile_format2.PACKAGE_LOCK_FILENAMES,
  import_lockfile_format4.YARN_LOCK_FILENAME,
  import_lockfile_format3.PNPM_LOCK_FILENAME,
  import_lockfile_format.CARGO_LOCK_FILENAME,
  "composer.lock"
]);
const _jsSupportedFiles = (0, import_object.ObjectFreeze)({
  __proto__: null,
  manifests: MANIFEST_NAMES,
  lockfiles: LOCKFILE_NAMES
});
function jsDetectFormat(filename) {
  const lastSlash = (0, import_string.StringPrototypeLastIndexOf)(filename, "/");
  const basename = lastSlash === -1 ? filename : (0, import_string.StringPrototypeSlice)(filename, lastSlash + 1);
  switch (basename) {
    case import_manifest_format2.PACKAGE_JSON_FILENAME:
      return import_manifest_format2.PACKAGE_JSON_FORMAT;
    case import_manifest_format.CARGO_TOML_FILENAME:
      return import_manifest_format.CARGO_TOML_FORMAT;
    case "composer.json":
      return COMPOSER_JSON_FORMAT;
    case "package-lock.json":
    case "npm-shrinkwrap.json":
      return import_lockfile_format2.PACKAGE_LOCK_FORMAT;
    case import_lockfile_format4.YARN_LOCK_FILENAME:
      return import_lockfile_format4.YARN_LOCK_FORMAT;
    case import_lockfile_format3.PNPM_LOCK_FILENAME:
      return import_lockfile_format3.PNPM_LOCK_FORMAT;
    case import_lockfile_format.CARGO_LOCK_FILENAME:
      return import_lockfile_format.CARGO_LOCK_FORMAT;
    case "composer.lock":
      return COMPOSER_LOCK_FORMAT;
    default:
      return void 0;
  }
}
const _smol = (0, import_manifest.getSmolManifest)();
const detectFormat = _smol?.detectFormat ?? jsDetectFormat;
const supportedFiles = _smol?.supportedFiles ?? _jsSupportedFiles;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  detectFormat,
  jsDetectFormat,
  supportedFiles
});
