/*! © 2026 Yahoo, Inc. UDS Tailwind and Purger v0.0.0-development */
import { DARK_COLOR_MODE_CLASSNAME, INVERT_COLOR_MODE_CLASSNAME, LIGHT_COLOR_MODE_CLASSNAME, SYSTEM_COLOR_MODE_CLASSNAME } from "../../css-tokens/dist/index.js";
import { DEFAULT_COLOR_MODE } from "../../modes/dist/index.js";
import { getColorModeStyles } from "../utils/getColorModeStyles.js";
import { isString } from "lodash-es";

//#region src/tailwind/base/addColorModeVarsV2.ts
function addColorModeVarsV2(tokens, { addBase, config }) {
	const parentConfigImportant = config().important;
	const rootSelector = isString(parentConfigImportant) ? parentConfigImportant : ":root";
	const styles = getColorModeStyles(tokens);
	const stylesWithInvert = (key) => {
		const { colorScheme: _, ...stylesDefault } = styles[key];
		const { colorScheme: __, ...stylesInvert } = styles[key === "light" ? "dark" : "light"];
		return {
			...stylesDefault,
			[`.${INVERT_COLOR_MODE_CLASSNAME}`]: stylesInvert
		};
	};
	const lightWithInvert = stylesWithInvert("light");
	const darkWithInvert = stylesWithInvert("dark");
	addBase({
		[rootSelector]: {
			colorScheme: DEFAULT_COLOR_MODE,
			...stylesWithInvert(DEFAULT_COLOR_MODE)
		},
		[`.${SYSTEM_COLOR_MODE_CLASSNAME}`]: {
			colorScheme: "light dark",
			"@media (prefers-color-scheme: dark)": darkWithInvert
		},
		[`.${LIGHT_COLOR_MODE_CLASSNAME}`]: {
			colorScheme: "light",
			...lightWithInvert
		},
		[`.${DARK_COLOR_MODE_CLASSNAME}`]: {
			colorScheme: "dark",
			...darkWithInvert
		}
	});
}

//#endregion
export { addColorModeVarsV2 };
//# sourceMappingURL=addColorModeVarsV2.js.map