/*! © 2026 Yahoo, Inc. UDS Tailwind and Purger v0.0.0-development */
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
const require_index = require('../../palette/dist/index.cjs');
const require_index$1 = require('../../css-tokens/dist/index.cjs');
const require_mapValues = require('../../utils/mapValues.cjs');
const require_parseTokens = require('../../utils/parseTokens.cjs');
const require_index$2 = require('../../modes/dist/index.cjs');
const require_addColorModeVars = require('../base/addColorModeVars.cjs');
const require_addColorModeVarsV2 = require('../base/addColorModeVarsV2.cjs');
const require_getTailwindAsUdsColors = require('./getTailwindAsUdsColors.cjs');
let tailwindcss_plugin_js = require("tailwindcss/plugin.js");
tailwindcss_plugin_js = require_runtime.__toESM(tailwindcss_plugin_js);
let lodash_mapKeys_js = require("lodash/mapKeys.js");
lodash_mapKeys_js = require_runtime.__toESM(lodash_mapKeys_js);

//#region src/tailwind/plugins/colors.ts
const tailwindColorsAsUds = require_getTailwindAsUdsColors.getTailwindAsUdsColors();
const colorsPlugin = tailwindcss_plugin_js.default.withOptions(({ config, enableSystemColorMode = false }) => (api) => {
	const tokens = require_parseTokens.parseTokens(config);
	if (enableSystemColorMode) require_addColorModeVarsV2.addColorModeVarsV2(tokens, api);
	else require_addColorModeVars.addColorModeVars(tokens, api);
}, ({ config }) => {
	const colorModeToken = require_parseTokens.parseTokens(config).colorMode[require_index$2.DEFAULT_COLOR_MODE].tailwindConfig;
	const spectrumWithTailwind = require_mapValues.mapValues(colorModeToken.spectrum, (hueConfig, hue) => {
		return {
			...hueConfig,
			...tailwindColorsAsUds[hue]
		};
	});
	const nestedNewAlwaysPalette = (0, lodash_mapKeys_js.default)(require_index.newAlwaysPalette, (_, key) => key.replace(require_index.ALWAYS_PREFIX, ""));
	const colors = {
		...tailwindColorsAsUds,
		...spectrumWithTailwind,
		...require_index.deprecatedAlwaysPalette,
		always: nestedNewAlwaysPalette
	};
	const textColors = colorModeToken.palette.foreground;
	const backgroundColors = colorModeToken.palette.background;
	const borderColors = colorModeToken.palette.line;
	const elevationBackgroundColors = config.elevation ? Object.fromEntries(Object.keys(config.elevation).map((level) => [`elevation-${level}`, `var(--${require_index$1.BACKGROUND_COLOR_PREFIX}-elevation-${level})`])) : {};
	return {
		darkMode: ["class", require_index$1.DARK_COLOR_MODE_CLASSNAME],
		safelist: [
			require_index$1.LIGHT_COLOR_MODE_CLASSNAME,
			require_index$1.DARK_COLOR_MODE_CLASSNAME,
			require_index$1.INVERT_COLOR_MODE_CLASSNAME,
			require_index$1.SYSTEM_COLOR_MODE_CLASSNAME
		],
		theme: { extend: {
			outlineColor: {
				...borderColors,
				DEFAULT: colors.gray["15"]
			},
			colors,
			backgroundColor: backgroundColors,
			textColor: textColors,
			borderColor: borderColors,
			fill: backgroundColors,
			caretColor: textColors,
			placeholderColor: textColors,
			textDecorationColor: textColors,
			divideColor: borderColors,
			ringColor: borderColors,
			ringOffsetColor: borderColors,
			stroke: borderColors,
			gradientColorStops: {
				...backgroundColors,
				...elevationBackgroundColors,
				...colors
			}
		} }
	};
});

//#endregion
exports.colorsPlugin = colorsPlugin;