'use strict';

var FOFSZBOK_cjs = require('./FOFSZBOK.cjs');
var PUL6NSHI_cjs = require('./PUL6NSHI.cjs');
var U7VZULNU_cjs = require('./U7VZULNU.cjs');
var console = require('console');

function _interopNamespace(e) {
  if (e && e.__esModule) return e;
  var n = Object.create(null);
  if (e) {
    Object.keys(e).forEach(function (k) {
      if (k !== 'default') {
        var d = Object.getOwnPropertyDescriptor(e, k);
        Object.defineProperty(n, k, d.get ? d : {
          enumerable: true,
          get: function () { return e[k]; }
        });
      }
    });
  }
  n.default = e;
  return Object.freeze(n);
}

var console__namespace = /*#__PURE__*/_interopNamespace(console);

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

exports.resolveTypeVersions = resolveTypeVersions;
//# sourceMappingURL=ACDTMA6Q.cjs.map
//# sourceMappingURL=ACDTMA6Q.cjs.map