"use client";
import { getRadius, getSize } from "../../core/utils/get-size/get-size.mjs";
import { createVarsResolver } from "../../core/styles-api/create-vars-resolver/create-vars-resolver.mjs";
import { getThemeColor } from "../../core/MantineProvider/color-functions/get-theme-color/get-theme-color.mjs";
import { useProps } from "../../core/MantineProvider/use-props/use-props.mjs";
import { useStyles } from "../../core/styles-api/use-styles/use-styles.mjs";
import { polymorphicFactory } from "../../core/factory/polymorphic-factory.mjs";
import { Box } from "../../core/Box/Box.mjs";
import Badge_module_default from "./Badge.module.mjs";
import { jsx, jsxs } from "react/jsx-runtime";
//#region packages/@mantine/core/src/components/Badge/Badge.tsx
const varsResolver = createVarsResolver((theme, { radius, color, gradient, variant, size, autoContrast, circle }) => {
	const colors = theme.variantColorResolver({
		color: color || theme.primaryColor,
		theme,
		gradient,
		variant: variant || "filled",
		autoContrast
	});
	return { root: {
		"--badge-height": getSize(size, "badge-height"),
		"--badge-padding-x": getSize(size, "badge-padding-x"),
		"--badge-fz": getSize(size, "badge-fz"),
		"--badge-radius": circle || radius === void 0 ? void 0 : getRadius(radius),
		"--badge-bg": color || variant ? colors.background : void 0,
		"--badge-color": color || variant ? colors.color : void 0,
		"--badge-bd": color || variant ? colors.border : void 0,
		"--badge-dot-color": variant === "dot" ? getThemeColor(color, theme) : void 0
	} };
});
const Badge = polymorphicFactory((_props) => {
	const props = useProps("Badge", null, _props);
	const { classNames, className, style, styles, unstyled, vars, radius, color, gradient, leftSection, rightSection, children, variant, fullWidth, autoContrast, circle, mod, attributes, ...others } = props;
	const getStyles = useStyles({
		name: "Badge",
		props,
		classes: Badge_module_default,
		className,
		style,
		classNames,
		styles,
		unstyled,
		attributes,
		vars,
		varsResolver
	});
	return /* @__PURE__ */ jsxs(Box, {
		variant,
		mod: [{
			block: fullWidth,
			circle,
			"with-right-section": !!rightSection,
			"with-left-section": !!leftSection
		}, mod],
		...getStyles("root", { variant }),
		...others,
		children: [
			leftSection && /* @__PURE__ */ jsx("span", {
				...getStyles("section"),
				"data-position": "left",
				children: leftSection
			}),
			/* @__PURE__ */ jsx("span", {
				...getStyles("label"),
				children
			}),
			rightSection && /* @__PURE__ */ jsx("span", {
				...getStyles("section"),
				"data-position": "right",
				children: rightSection
			})
		]
	});
});
Badge.classes = Badge_module_default;
Badge.varsResolver = varsResolver;
Badge.displayName = "@mantine/core/Badge";
//#endregion
export { Badge };

//# sourceMappingURL=Badge.mjs.map