/*! © 2026 Yahoo, Inc. UDS Tailwind and Purger v0.0.0-development */
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
const require_index = require('../../css-tokens/dist/index.cjs');
const require_index$1 = require('../../modes/dist/index.cjs');
const require_fromEntries = require('../../utils/fromEntries.cjs');
const require_composeTailwindPlugins = require('../utils/composeTailwindPlugins.cjs');
let tailwindcss_plugin_js = require("tailwindcss/plugin.js");
tailwindcss_plugin_js = require_runtime.__toESM(tailwindcss_plugin_js);

//#region src/tailwind/plugins/borderRadius.ts
const UDS_BORDER_RADIUS_THEME_KEY = "udsBorderRadius";
const udsBorderRadiusToCSSVariable = (token) => `var(--${require_index.BORDER_RADIUS_PREFIX}-${token})`;
const getBorderRadiusTheme = (config, mergeTokensIntoTailwindTheme) => {
	/**
	* Given the UDS border radius tokens in config (none, xs, sm, md, lg, xl, full), create a tailwind
	* border radius theme value that points to the corresponding UDS CSS variables.
	*
	* For example:
	*
	*   {
	*     sm: 'var(--uds-border-radius-sm)',
	*     md: 'var(--uds-border-radius-md)',
	*   }
	*
	* 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 udsBorderRadii = require_fromEntries.fromEntries(Object.keys(config).map((udsAlias) => [udsAlias, udsBorderRadiusToCSSVariable(udsAlias)]));
	if (!mergeTokensIntoTailwindTheme) return { [UDS_BORDER_RADIUS_THEME_KEY]: udsBorderRadii };
	return {
		[UDS_BORDER_RADIUS_THEME_KEY]: udsBorderRadii,
		borderRadius: {
			...udsBorderRadii,
			DEFAULT: udsBorderRadiusToCSSVariable("sm"),
			sm: udsBorderRadiusToCSSVariable("xs")
		}
	};
};
const borderRadiusPlugin = tailwindcss_plugin_js.default.withOptions(() => ({ matchUtilities, theme }) => {
	matchUtilities({
		"uds-border-radius": (value) => ({ "border-radius": value }),
		"uds-border-top-start-radius": (value) => ({ "border-start-start-radius": value }),
		"uds-border-top-end-radius": (value) => ({ "border-start-end-radius": value }),
		"uds-border-bottom-start-radius": (value) => ({ "border-end-start-radius": value }),
		"uds-border-bottom-end-radius": (value) => ({ "border-end-end-radius": value })
	}, { values: theme(UDS_BORDER_RADIUS_THEME_KEY) });
}, ({ config, disableOverrideTailwindTheme }) => {
	const shouldNotMergeBorderRadiusTokensIntoTailwindTheme = require_composeTailwindPlugins.shouldNotMergeTokensIntoTailwindTheme(disableOverrideTailwindTheme, "borderRadius");
	return { theme: { extend: { ...getBorderRadiusTheme(config.scaleMode[require_index$1.DEFAULT_SCALE_MODE].borderRadius, !shouldNotMergeBorderRadiusTokensIntoTailwindTheme) } } };
});

//#endregion
exports.UDS_BORDER_RADIUS_THEME_KEY = UDS_BORDER_RADIUS_THEME_KEY;
exports.borderRadiusPlugin = borderRadiusPlugin;