/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
import { __toESM } from "../_virtual/_rolldown/runtime.js";
import { require_plugin } from "../node_modules/.bun/tailwindcss@3.4.19_7500dce058369e0a/node_modules/tailwindcss/plugin.js";
import { shouldNotMergeTokensIntoTailwindTheme } from "../utils/composeTailwindPlugins.js";
import { BORDER_WIDTH_PREFIX } from "../packages/css-tokens/dist/index.js";
import { fromEntries } from "../packages/utils/dist/fromEntries.js";
import { DEFAULT_SCALE_MODE } from "../packages/modes/dist/index.js";
//#region ../tailwind-internal/dist/plugins/borderWidth.js
/*! © 2026 Yahoo, Inc. UDS Tailwind Internal v0.0.0-development */
var import_plugin = /* @__PURE__ */ __toESM(require_plugin(), 1);
const UDS_BORDER_WIDTH_THEME_KEY = "udsBorderWidth";
const udsBorderWidthToCSSVariable = (token) => `var(--${BORDER_WIDTH_PREFIX}-${token})`;
const getBorderWidthTheme = (config, mergeTokensIntoTailwindTheme) => {
	/**
	* Given the UDS border width tokens in config (none, thin, medium, thick), create a tailwind
	* border width theme value that points to the corresponding UDS CSS variables.
	*
	* For example:
	*
	*   {
	*     thin: 'var(--uds-border-width-thin)',
	*     thick: 'var(--uds-border-width-thick)',
	*   }
	*
	* Note: The values of the CSS variables are defined elsewhere. This code only ensures the Tailwind-generated
	* classes are mapped to the correct CSS variable.
	*/
	const udsBorderWidths = fromEntries(Object.keys(config).map((udsAlias) => [udsAlias, udsBorderWidthToCSSVariable(udsAlias)]));
	if (!mergeTokensIntoTailwindTheme) return { [UDS_BORDER_WIDTH_THEME_KEY]: udsBorderWidths };
	const widths = {
		...udsBorderWidths,
		DEFAULT: udsBorderWidthToCSSVariable("thin"),
		"2": udsBorderWidthToCSSVariable("medium"),
		"4": udsBorderWidthToCSSVariable("thick")
	};
	return {
		[UDS_BORDER_WIDTH_THEME_KEY]: udsBorderWidths,
		borderWidth: widths,
		outlineWidth: {
			...widths,
			DEFAULT: "2px"
		},
		outlineOffset: {
			...widths,
			DEFAULT: "2px"
		}
	};
};
const borderWidthPlugin = import_plugin.default.withOptions(() => ({ matchUtilities, theme }) => {
	matchUtilities({
		"uds-border-width": (value) => ({ "border-width": value }),
		"uds-border-width-x": (value) => ({
			"border-left-width": value,
			"border-right-width": value
		}),
		"uds-border-width-y": (value) => ({
			"border-top-width": value,
			"border-bottom-width": value
		}),
		"uds-border-width-top": (value) => ({ "border-top-width": value }),
		"uds-border-width-right": (value) => ({ "border-right-width": value }),
		"uds-border-width-bottom": (value) => ({ "border-bottom-width": value }),
		"uds-border-width-left": (value) => ({ "border-left-width": value }),
		"uds-border-width-start": (value) => ({ "border-inline-start-width": value }),
		"uds-border-width-end": (value) => ({ "border-inline-end-width": value })
	}, { values: theme(UDS_BORDER_WIDTH_THEME_KEY) });
}, ({ config, disableOverrideTailwindTheme }) => {
	const shouldNotMergeBorderWidthTokensIntoTailwindTheme = shouldNotMergeTokensIntoTailwindTheme(disableOverrideTailwindTheme, "borderWidth");
	return { theme: { extend: { ...getBorderWidthTheme(config.scaleMode[DEFAULT_SCALE_MODE].borderWidth, !shouldNotMergeBorderWidthTokensIntoTailwindTheme) } } };
});
//#endregion
export { UDS_BORDER_WIDTH_THEME_KEY, borderWidthPlugin };
