/*! © 2026 Yahoo, Inc. UDS Tailwind and Purger v0.0.0-development */
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
const require_index = require('../../fixtures/dist/index.cjs');
const require_index$1 = require('../../css-tokens/dist/index.cjs');
const require_assertUnreachable = require('../../utils/assertUnreachable.cjs');
const require_entries = require('../../utils/entries.cjs');
let lodash_isString_js = require("lodash/isString.js");
lodash_isString_js = require_runtime.__toESM(lodash_isString_js);

//#region src/tailwind/components/getResponsiveTextStyles.ts
const textVariantsSafe = (variant) => variant.replace("/", "-");
const BASE_SIZE = 16;
const toRem = (size) => `${size / BASE_SIZE}rem`;
const mapClassNames = (name) => "." + require_index$1.TEXT_RESPONSIVE_BREAKPOINT_CLASSNAMES[name];
const getValue = (config, variant, key, breakpoint) => {
	const data = config.typography[variant]?.[key];
	if (!data) throw new Error(`Missing typography data for variant "${variant}" and key "${key}"`);
	const value = breakpoint === "base" ? data.base : data.breakpoints?.[breakpoint];
	if (!value) throw new Error(`Missing value for variant "${variant}", key "${key}", and breakpoint "${breakpoint}"`);
	if ((0, lodash_isString_js.default)(value)) return value;
	switch (value.type) {
		case "px": return toRem(value.value);
		case "unitless": return String(value.value);
	}
	return require_assertUnreachable.assertUnreachable(value);
};
const convertFontAlias = (config, value) => {
	if (value in config.font) return `var(--${require_index$1.FONT_FAMILY_PREFIX}-${value})`;
	return value;
};
const cssVariablesForBreakpoint = (config, breakpoint) => Object.fromEntries(require_index.textVariants.flatMap((variant) => {
	const safeVariant = textVariantsSafe(variant);
	return [
		[`--${require_index$1.FONT_FAMILY_PREFIX}-${safeVariant}`, convertFontAlias(config, getValue(config, variant, "fontFamily", breakpoint))],
		[`--${require_index$1.FONT_SIZE_PREFIX}-${safeVariant}`, getValue(config, variant, "fontSize", breakpoint)],
		[`--${require_index$1.FONT_WEIGHT_PREFIX}-${safeVariant}`, getValue(config, variant, "fontWeight", breakpoint)],
		[`--${require_index$1.FONT_SLANT_PREFIX}-${safeVariant}`, getValue(config, variant, "fontSlant", breakpoint)],
		[`--${require_index$1.FONT_WIDTH_PREFIX}-${safeVariant}`, getValue(config, variant, "fontWidth", breakpoint)],
		[`--${require_index$1.LINE_HEIGHT_PREFIX}-${safeVariant}`, getValue(config, variant, "lineHeight", breakpoint)],
		[`--${require_index$1.TEXT_TRANSFORM_PREFIX}-${safeVariant}`, getValue(config, variant, "textTransform", breakpoint)],
		[`--${require_index$1.LETTER_SPACING_PREFIX}-${safeVariant}`, getValue(config, variant, "letterSpacing", breakpoint)]
	];
}));
const tailwindConfigPerVariant = (prefix) => Object.fromEntries(require_index.textVariants.map(textVariantsSafe).map((variant) => [variant, `var(--${prefix}-${variant})`]));
const RESPONSIVE_TAILWIND_CONFIG_MAP = {
	fontFamily: tailwindConfigPerVariant(require_index$1.FONT_FAMILY_PREFIX),
	fontWeight: tailwindConfigPerVariant(require_index$1.FONT_WEIGHT_PREFIX),
	fontSlant: tailwindConfigPerVariant(require_index$1.FONT_SLANT_PREFIX),
	fontWidth: tailwindConfigPerVariant(require_index$1.FONT_WIDTH_PREFIX),
	fontSize: tailwindConfigPerVariant(require_index$1.FONT_SIZE_PREFIX),
	lineHeight: tailwindConfigPerVariant(require_index$1.LINE_HEIGHT_PREFIX),
	textTransform: tailwindConfigPerVariant(require_index$1.TEXT_TRANSFORM_PREFIX),
	letterSpacing: tailwindConfigPerVariant(require_index$1.LETTER_SPACING_PREFIX)
};
const getBaseTextVars = (config) => {
	return cssVariablesForBreakpoint(config, "base");
};
const getResponsiveTextStyles = (config) => {
	const breakpoints = require_entries.entries(config.breakpoints).sort(([, { value: minWidthA }], [, { value: minWidthB }]) => minWidthA - minWidthB);
	return {
		[`.${require_index$1.TEXT_RESPONSIVE_CLASSNAME}`]: Object.fromEntries(breakpoints.map(([name, { value: minWidth }]) => [`@media (min-width: ${minWidth}px)`, cssVariablesForBreakpoint(config, name)])),
		[mapClassNames("base")]: cssVariablesForBreakpoint(config, "base"),
		[mapClassNames("defaultBreakpoint")]: cssVariablesForBreakpoint(config, config.globalDefaults.breakpoint),
		...Object.fromEntries(breakpoints.map(([name]) => [mapClassNames(name), cssVariablesForBreakpoint(config, name)]))
	};
};

//#endregion
exports.RESPONSIVE_TAILWIND_CONFIG_MAP = RESPONSIVE_TAILWIND_CONFIG_MAP;
exports.getBaseTextVars = getBaseTextVars;
exports.getResponsiveTextStyles = getResponsiveTextStyles;
exports.textVariantsSafe = textVariantsSafe;