'use strict';

var _533SFXIE_cjs = require('./533SFXIE.cjs');
var _5GPMTH2I_cjs = require('./5GPMTH2I.cjs');
var _24WEKBY3_cjs = require('./24WEKBY3.cjs');
var esToolkit = require('es-toolkit');
var path = require('path');

// src/github/matrix.ts
_24WEKBY3_cjs.init_cjs_shims();
var TAG_SEPARATORS = [
  "-",
  "_"
];
var generateGithubMatrix = /* @__PURE__ */ _24WEKBY3_cjs.__name((images, directory, versionCombinations) => {
  const createImageEntry = /* @__PURE__ */ _24WEKBY3_cjs.__name(([imageId, image]) => {
    const imageName = _5GPMTH2I_cjs.getImageName(image.name);
    const tags = TAG_SEPARATORS.map((separator) => _533SFXIE_cjs.getImageTag(image, separator));
    return {
      entry: {
        id: imageId,
        name: image.name,
        build_args: Object.entries({
          ...image.versions,
          ...image.dependencies
        }).sort().map(([key, value]) => `${esToolkit.constantCase(key)}_VERSION=${value}`),
        directory: path.join(directory, "docker", image.name),
        image_name: imageName,
        tags
      },
      image
    };
  }, "createImageEntry");
  const results = Object.entries(images).map(createImageEntry);
  const imageEntries = results.map((r) => r.entry);
  const mirroredImages = results.filter((result) => result.image.mirrorRegistries?.length).flatMap((result) => result.image.mirrorRegistries.map((mirror) => ({
    id: result.entry.id,
    name: result.entry.name,
    image_name: result.entry.image_name,
    tags: result.entry.tags,
    mirror
  })));
  const activeImages = [];
  if (versionCombinations) {
    const activeImageIds = new Set(versionCombinations.flatMap((combo) => Object.values(combo.images)));
    activeImages.push(...activeImageIds);
  }
  return {
    images: imageEntries,
    mirroredImages,
    activeImages
  };
}, "generateGithubMatrix");

exports.generateGithubMatrix = generateGithubMatrix;
//# sourceMappingURL=7FZK5RET.cjs.map
//# sourceMappingURL=7FZK5RET.cjs.map