/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
const require_variantConfigGuards = require("./variantConfigGuards.cjs");
const require_getConfigComponentVariant = require("./getConfigComponentVariant.cjs");
//#region ../automated-config/dist/utils/getConfigVariantPseudoStates.js
/*! © 2026 Yahoo, Inc. UDS Default Config v0.0.0-development */
const DEFAULT_PSEUDO_STATES = ["rest"];
function getConfigVariantPseudoStates(config, variantKey, state, subComponentName) {
	const componentVariant = require_getConfigComponentVariant.getConfigComponentVariant(config, variantKey, subComponentName);
	if (!componentVariant) return null;
	const variantLayers = require_variantConfigGuards.isVariantConfigWithProperties(componentVariant) ? Object.entries(componentVariant?.layers ?? {}) : [];
	const stateLayers = require_variantConfigGuards.isVariantConfigWithComponentStates(componentVariant) && state ? Object.entries(componentVariant.componentStates[state].layers ?? {}) : [];
	return [...variantLayers, ...stateLayers].flatMap(([layerKey, layer]) => Object.entries(layer.properties).map(([propertyKey, property]) => [
		layerKey,
		propertyKey,
		property
	])).flatMap(([layerKey, propertyKey, property]) => [...property.skipRestState ? DEFAULT_PSEUDO_STATES.filter((s) => s !== "rest") : DEFAULT_PSEUDO_STATES, ...property.pseudoStates ?? []].map((pseudoState) => [
		layerKey,
		propertyKey,
		property,
		pseudoState
	])).reduce((acc, [layerKey, propertyKey, property, pseudoState]) => {
		acc[pseudoState] = acc[pseudoState] ?? [];
		const info = [
			layerKey,
			propertyKey,
			property
		];
		acc[pseudoState].push(info);
		return acc;
	}, {});
}
//#endregion
exports.getConfigVariantPseudoStates = getConfigVariantPseudoStates;
