import { findToolByName, getToolDefaultVersion, findToolsByType, getToolSupportedVersions, findToolVersionsForCombination, getCombinationId } from './H7LPHZJT.js';
import { versionMatrices } from './F35TPZS3.js';
import { init_esm_shims, __name } from './4RNWLMHM.js';
import * as console from 'node:console';

// src/core/version-resolver.ts
init_esm_shims();
function resolveToolVersion(toolName, userSpecifiedVersions) {
  const tool = findToolByName(toolName);
  const userVersion = userSpecifiedVersions[toolName];
  if (typeof userVersion === "string" && userVersion !== "") {
    return userVersion;
  }
  return getToolDefaultVersion(tool.name);
}
__name(resolveToolVersion, "resolveToolVersion");
function resolveTypeVersions(type, userSpecifiedVersions) {
  const tools = findToolsByType(type);
  if (!tools.length) {
    throw new Error(`Type ${type} not found or no tools available`);
  }
  const versions = {};
  for (const tool of tools) {
    const version = resolveToolVersion(tool.name, userSpecifiedVersions);
    if (!version) {
      continue;
    }
    versions[tool.name] = version;
    if (version === getToolDefaultVersion(tool.name)) {
      continue;
    }
    const supportedVersions = getToolSupportedVersions(tool.name);
    if (!supportedVersions.includes(version)) {
      console.warn(`\u26A0\uFE0F  Version ${version} for ${tool.name} is not in the supported list.`);
      console.warn(`   Supported versions: ${supportedVersions.join(", ")}`);
      console.warn(`   Continuing with Docker availability as final validation...`);
    }
  }
  const combination = versionMatrices[type].find((combination2) => Object.entries(findToolVersionsForCombination(combination2)).every(([tool, version]) => versions[tool] === version));
  if (!combination) {
    throw new Error("Compatible combination of tool versions not found");
  }
  console.info(`\u2705 ${getCombinationId(combination)} ${combination.description ? `(${combination.description})` : ""})`);
  return versions;
}
__name(resolveTypeVersions, "resolveTypeVersions");

export { resolveTypeVersions };
//# sourceMappingURL=55HL3CFD.js.map
//# sourceMappingURL=55HL3CFD.js.map