/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
require("../../../_virtual/_rolldown/runtime.cjs");
const require_index = require("../../../fixtures/dist/index.cjs");
let _yahoo_uds_icons_tokens = require("@yahoo/uds-icons/tokens");
let lodash_es = require("lodash-es");
//#region ../automated-config/dist/utils/getPaginationControlWidthPx.js
/*! © 2026 Yahoo, Inc. UDS Default Config v0.0.0-development */
function resolveSpacingPx(config, alias) {
	if (!alias) return 0;
	const scaleValue = (0, lodash_es.get)(config, [
		"scaleMode",
		"large",
		"spacing",
		alias.replace(".", "_")
	]);
	if (typeof scaleValue === "number") return scaleValue;
	return require_index.spacingMap[alias] ?? 0;
}
function resolveTypographyPx(config, textVariant, property) {
	if (!textVariant) return 0;
	const typographyConfig = config.typography[textVariant];
	if (!typographyConfig) return 0;
	const defaultBreakpoint = config.globalDefaults.breakpoint;
	const value = defaultBreakpoint === "base" ? typographyConfig[property].base : typographyConfig[property].breakpoints[defaultBreakpoint];
	if (typeof value === "number") return value;
	if (value && typeof value === "object" && "value" in value) return value.value;
	return 0;
}
/** Pixel width/height for pagination page circles and prev/next controls. */
function getPaginationControlWidthPx(config, size) {
	const pagination = config.pagination;
	if (!pagination?.variables) return 0;
	const variables = pagination.variables;
	const layerPrefix = `size/${size}`;
	const paddingAlias = variables[`${layerPrefix}/item`]?.spacing?.rest?.value;
	const iconSizeAlias = variables[`${layerPrefix}/icon`]?.size?.rest?.value;
	const textVariant = variables[`${layerPrefix}/text`]?.textVariant?.rest?.value;
	const padding = resolveSpacingPx(config, paddingAlias);
	const iconSize = _yahoo_uds_icons_tokens.ICON_SIZE_MAP[iconSizeAlias ?? "sm"] ?? 16;
	const lineHeight = resolveTypographyPx(config, textVariant, "lineHeight");
	return padding * 2 + Math.max(iconSize, lineHeight || iconSize);
}
function syncPaginationWidthVarForSize(config, size) {
	const itemKey = `size/${size}/item`;
	const widthPx = getPaginationControlWidthPx(config, size);
	const paginationConfig = config;
	const existingItem = paginationConfig.pagination?.variables?.[itemKey] ?? {};
	return {
		...config,
		pagination: {
			...paginationConfig.pagination,
			variables: {
				...paginationConfig.pagination?.variables,
				[itemKey]: {
					...existingItem,
					paginationWidthVar: { rest: {
						type: "positiveIntegers",
						value: widthPx,
						valueType: "alias"
					} }
				}
			}
		}
	};
}
//#endregion
exports.getPaginationControlWidthPx = getPaginationControlWidthPx;
exports.syncPaginationWidthVarForSize = syncPaginationWidthVarForSize;
