"use strict";
/* Socket Lib - Built with esbuild */
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 versions_exports = {};
__export(versions_exports, {
  coerceVersion: () => coerceVersion,
  compareVersions: () => compareVersions,
  filterVersions: () => filterVersions,
  getMajorVersion: () => getMajorVersion,
  getMinorVersion: () => getMinorVersion,
  getPatchVersion: () => getPatchVersion,
  incrementVersion: () => incrementVersion,
  isEqual: () => isEqual,
  isGreaterThan: () => isGreaterThan,
  isGreaterThanOrEqual: () => isGreaterThanOrEqual,
  isLessThan: () => isLessThan,
  isLessThanOrEqual: () => isLessThanOrEqual,
  isValidVersion: () => isValidVersion,
  maxVersion: () => maxVersion,
  minVersion: () => minVersion,
  parseVersion: () => parseVersion,
  satisfiesVersion: () => satisfiesVersion,
  sortVersions: () => sortVersions,
  sortVersionsDesc: () => sortVersionsDesc,
  versionDiff: () => versionDiff
});
module.exports = __toCommonJS(versions_exports);
var semver = __toESM(require("./external/semver.js"));
function coerceVersion(version) {
  const coerced = semver.coerce(version);
  return coerced?.version;
}
function compareVersions(v1, v2) {
  try {
    return semver.compare(v1, v2);
  } catch {
    return void 0;
  }
}
function filterVersions(versions, range) {
  return versions.filter((v) => semver.satisfies(v, range));
}
function getMajorVersion(version) {
  const parsed = semver.parse(version);
  return parsed?.major;
}
function getMinorVersion(version) {
  const parsed = semver.parse(version);
  return parsed?.minor;
}
function getPatchVersion(version) {
  const parsed = semver.parse(version);
  return parsed?.patch;
}
function incrementVersion(version, release, identifier) {
  return semver.inc(version, release, identifier) || void 0;
}
function isEqual(version1, version2) {
  return semver.eq(version1, version2);
}
function isGreaterThan(version1, version2) {
  return semver.gt(version1, version2);
}
function isGreaterThanOrEqual(version1, version2) {
  return semver.gte(version1, version2);
}
function isLessThan(version1, version2) {
  return semver.lt(version1, version2);
}
function isLessThanOrEqual(version1, version2) {
  return semver.lte(version1, version2);
}
function isValidVersion(version) {
  return semver.valid(version) !== null;
}
function maxVersion(versions) {
  return semver.maxSatisfying(versions, "*") || void 0;
}
function minVersion(versions) {
  return semver.minSatisfying(versions, "*") || void 0;
}
function parseVersion(version) {
  const parsed = semver.parse(version);
  if (!parsed) {
    return void 0;
  }
  return {
    major: parsed.major,
    minor: parsed.minor,
    patch: parsed.patch,
    prerelease: parsed.prerelease,
    build: parsed.build
  };
}
function satisfiesVersion(version, range) {
  return semver.satisfies(version, range);
}
function sortVersions(versions) {
  return semver.sort([...versions]);
}
function sortVersionsDesc(versions) {
  return semver.rsort([...versions]);
}
function versionDiff(version1, version2) {
  try {
    return semver.diff(version1, version2) || void 0;
  } catch {
    return void 0;
  }
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  coerceVersion,
  compareVersions,
  filterVersions,
  getMajorVersion,
  getMinorVersion,
  getPatchVersion,
  incrementVersion,
  isEqual,
  isGreaterThan,
  isGreaterThanOrEqual,
  isLessThan,
  isLessThanOrEqual,
  isValidVersion,
  maxVersion,
  minVersion,
  parseVersion,
  satisfiesVersion,
  sortVersions,
  sortVersionsDesc,
  versionDiff
});
