/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
//#region ../tailwind-internal/dist/utils/getNestedBorderRadiusUtilities.js
/*! © 2026 Yahoo, Inc. UDS Tailwind Internal v0.0.0-development */
/******************************************************************************
* Utility Generator
******************************************************************************/
/**
* Generates utility classNames that performs nested border radius calculation.
* @link https://cloudfour.com/thinks/the-math-behind-nesting-rounded-corners
* @link https://twitter.com/jh3yy/status/1711729473142018413
*
* @example
* // Use with getStyles
* <VStack
*   borderRadius="md"
*   spacing="2"
*   nestedBorderRadius={true}
* >
*   <Item /> // Top corners rounded
*   <Item /> // No rounding
*   <Item /> // Bottom corners rounded
* </VStack>
*/
const getNestedBorderRadiusUtilities = () => {
	const cssVar = { "--uds-nested-radius": "clamp(calc(var(--uds-nested-border-radius-size, 0px) * 0.5), calc(var(--uds-nested-border-radius-size, 0px) - max(var(--uds-nested-border-radius-spacing, 0px), var(--uds-nested-border-radius-width, 0px))), var(--uds-nested-border-radius-size, 0px))" };
	const firstStyles = {
		"border-start-start-radius": "var(--uds-nested-radius)",
		"border-start-end-radius": "var(--uds-nested-radius)"
	};
	const lastStyles = {
		"border-end-start-radius": "var(--uds-nested-radius)",
		"border-end-end-radius": "var(--uds-nested-radius)"
	};
	return {
		/**
		* Defines `--uds-nested-radius` for descendants (or the same element) without
		* applying corner radii to children. Pair with nested-border-radius-size/width
		* utilities on the parent.
		*/
		".uds-nested-radius": cssVar,
		".uds-nested-border-radius": {
			...cssVar,
			"& > *:first-child": { ...firstStyles },
			"& > *:last-child": { ...lastStyles }
		},
		".uds-nested-border-radius-first": {
			...cssVar,
			"& > *:first-child": { ...firstStyles }
		},
		".uds-nested-border-radius-last": {
			...cssVar,
			"& > *:last-child": { ...lastStyles }
		}
	};
};
//#endregion
exports.getNestedBorderRadiusUtilities = getNestedBorderRadiusUtilities;
