/*! © 2026 Yahoo, Inc. UDS Tailwind and Purger v0.0.0-development */
import { BORDER_WIDTH_PREFIX, LINE_COLOR_PREFIX } from "../../css-tokens/dist/index.js";
import { entries } from "../../utils/entries.js";
import { fromEntries } from "../../utils/fromEntries.js";
import { shouldNotMergeTokensIntoTailwindTheme } from "../utils/composeTailwindPlugins.js";
import { UDS_BORDER_WIDTH_THEME_KEY } from "./borderWidth.js";
import { getElevationStyles } from "../utils/getElevationStyles.js";
import plugin from "tailwindcss/plugin.js";

//#region src/tailwind/plugins/elevation.ts
const getBorderWidthTheme = (config, mergeTokensIntoTailwindTheme) => {
	const elevationBorderWidths = fromEntries(entries(config || {}).map(([level]) => [`elevation-${level}`, `var(--${BORDER_WIDTH_PREFIX}-elevation-${level})`]));
	if (!mergeTokensIntoTailwindTheme) return { [UDS_BORDER_WIDTH_THEME_KEY]: elevationBorderWidths };
	const namespacedBorderWidths = fromEntries(entries(elevationBorderWidths).map(([key, cssVar]) => [`width-${key}`, cssVar]));
	return {
		[UDS_BORDER_WIDTH_THEME_KEY]: elevationBorderWidths,
		borderWidth: namespacedBorderWidths,
		outlineWidth: namespacedBorderWidths,
		outlineOffset: namespacedBorderWidths
	};
};
const elevationPlugin = plugin.withOptions(({ config }) => ({ addUtilities }) => {
	addUtilities(getElevationStyles({ config }));
}, ({ config, disableOverrideTailwindTheme }) => {
	const shouldNotMergeBorderWidthTokensIntoTailwindTheme = shouldNotMergeTokensIntoTailwindTheme(disableOverrideTailwindTheme, "borderWidth");
	const borderColor = fromEntries(entries(config.elevation || {}).map(([level]) => [`elevation-${level}`, `var(--${LINE_COLOR_PREFIX}-elevation-${level})`]));
	return { theme: { extend: {
		borderColor,
		outlineColor: borderColor,
		...getBorderWidthTheme(config.elevation, !shouldNotMergeBorderWidthTokensIntoTailwindTheme)
	} } };
});

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