/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
const require_subcomponents = require('./subcomponents.cjs');
const require_mapValues = require('./mapValues.cjs');

//#region ../automated-config/dist/utils/coalesceConfigVariant.js
/*! © 2026 Yahoo, Inc. UDS Default Config v0.0.0-development */
function coalesceConfigVariant(config, variantKey) {
	const rootVariantDef = config.variants?.[variantKey];
	if (rootVariantDef) return {
		type: "no-sub-components",
		variant: rootVariantDef
	};
	const subComponents = require_subcomponents.getConfigSubcomponents(config);
	if (!subComponents) return { type: "no-variants" };
	return {
		type: "has-sub-components",
		variants: require_mapValues.mapValues(subComponents, (subComponent) => subComponent.variants[variantKey])
	};
}

//#endregion
exports.coalesceConfigVariant = coalesceConfigVariant;