"use client";
const require_rem = require("../../../utils/units-converters/rem.cjs");
const require_parse_theme_color = require("../parse-theme-color/parse-theme-color.cjs");
const require_darken = require("../darken/darken.cjs");
const require_get_gradient = require("../get-gradient/get-gradient.cjs");
const require_rgba = require("../rgba/rgba.cjs");
//#region packages/@mantine/core/src/core/MantineProvider/color-functions/default-variant-colors-resolver/default-variant-colors-resolver.ts
const defaultVariantColorsResolver = ({ color, theme, variant, gradient, autoContrast }) => {
	const parsed = require_parse_theme_color.parseThemeColor({
		color,
		theme
	});
	const _autoContrast = typeof autoContrast === "boolean" ? autoContrast : theme.autoContrast;
	if (variant === "none") return {
		background: "transparent",
		hover: "transparent",
		color: "inherit",
		border: "none"
	};
	if (variant === "filled") {
		const textColor = _autoContrast ? parsed.isLight ? "var(--mantine-color-black)" : "var(--mantine-color-white)" : "var(--mantine-color-white)";
		if (parsed.isThemeColor) {
			if (parsed.shade === void 0) return {
				background: `var(--mantine-color-${color}-filled)`,
				hover: `var(--mantine-color-${color}-filled-hover)`,
				color: textColor,
				border: `${require_rem.rem(1)} solid transparent`
			};
			return {
				background: `var(--mantine-color-${parsed.color}-${parsed.shade})`,
				hover: `var(--mantine-color-${parsed.color}-${parsed.shade === 9 ? 8 : parsed.shade + 1})`,
				color: textColor,
				border: `${require_rem.rem(1)} solid transparent`
			};
		}
		return {
			background: color,
			hover: require_darken.darken(color, .1),
			color: textColor,
			border: `${require_rem.rem(1)} solid transparent`
		};
	}
	if (variant === "light") {
		if (parsed.isThemeColor) {
			if (parsed.shade === void 0) return {
				background: `var(--mantine-color-${color}-light)`,
				hover: `var(--mantine-color-${color}-light-hover)`,
				color: `var(--mantine-color-${color}-light-color)`,
				border: `${require_rem.rem(1)} solid transparent`
			};
			const parsedColor = theme.colors[parsed.color][parsed.shade];
			return {
				background: parsedColor,
				hover: require_darken.darken(parsedColor, .1),
				color: `var(--mantine-color-${parsed.color}-light-color)`,
				border: `${require_rem.rem(1)} solid transparent`
			};
		}
		return {
			background: require_rgba.rgba(color, .1),
			hover: require_rgba.rgba(color, .12),
			color,
			border: `${require_rem.rem(1)} solid transparent`
		};
	}
	if (variant === "outline") {
		if (parsed.isThemeColor) {
			if (parsed.shade === void 0) return {
				background: "transparent",
				hover: `var(--mantine-color-${color}-outline-hover)`,
				color: `var(--mantine-color-${color}-outline)`,
				border: `${require_rem.rem(1)} solid var(--mantine-color-${color}-outline)`
			};
			return {
				background: "transparent",
				hover: require_rgba.rgba(theme.colors[parsed.color][parsed.shade], .05),
				color: `var(--mantine-color-${parsed.color}-${parsed.shade})`,
				border: `${require_rem.rem(1)} solid var(--mantine-color-${parsed.color}-${parsed.shade})`
			};
		}
		return {
			background: "transparent",
			hover: require_rgba.rgba(color, .05),
			color,
			border: `${require_rem.rem(1)} solid ${color}`
		};
	}
	if (variant === "subtle") {
		if (parsed.isThemeColor) {
			if (parsed.shade === void 0) return {
				background: "transparent",
				hover: `var(--mantine-color-${color}-light-hover)`,
				color: `var(--mantine-color-${color}-light-color)`,
				border: `${require_rem.rem(1)} solid transparent`
			};
			const parsedColor = theme.colors[parsed.color][parsed.shade];
			return {
				background: "transparent",
				hover: require_rgba.rgba(parsedColor, .12),
				color: `var(--mantine-color-${parsed.color}-${Math.min(parsed.shade, 6)})`,
				border: `${require_rem.rem(1)} solid transparent`
			};
		}
		return {
			background: "transparent",
			hover: require_rgba.rgba(color, .12),
			color,
			border: `${require_rem.rem(1)} solid transparent`
		};
	}
	if (variant === "transparent") {
		if (parsed.isThemeColor) {
			if (parsed.shade === void 0) return {
				background: "transparent",
				hover: "transparent",
				color: `var(--mantine-color-${color}-light-color)`,
				border: `${require_rem.rem(1)} solid transparent`
			};
			return {
				background: "transparent",
				hover: "transparent",
				color: `var(--mantine-color-${parsed.color}-${Math.min(parsed.shade, 6)})`,
				border: `${require_rem.rem(1)} solid transparent`
			};
		}
		return {
			background: "transparent",
			hover: "transparent",
			color,
			border: `${require_rem.rem(1)} solid transparent`
		};
	}
	if (variant === "white") {
		if (parsed.isThemeColor) {
			if (parsed.shade === void 0) return {
				background: "var(--mantine-color-white)",
				hover: require_darken.darken(theme.white, .01),
				color: `var(--mantine-color-${color}-filled)`,
				border: `${require_rem.rem(1)} solid transparent`
			};
			return {
				background: "var(--mantine-color-white)",
				hover: require_darken.darken(theme.white, .01),
				color: `var(--mantine-color-${parsed.color}-${parsed.shade})`,
				border: `${require_rem.rem(1)} solid transparent`
			};
		}
		return {
			background: "var(--mantine-color-white)",
			hover: require_darken.darken(theme.white, .01),
			color,
			border: `${require_rem.rem(1)} solid transparent`
		};
	}
	if (variant === "gradient") return {
		background: require_get_gradient.getGradient(gradient, theme),
		hover: require_get_gradient.getGradient(gradient, theme),
		color: "var(--mantine-color-white)",
		border: "none"
	};
	if (variant === "default") return {
		background: "var(--mantine-color-default)",
		hover: "var(--mantine-color-default-hover)",
		color: "var(--mantine-color-default-color)",
		border: `${require_rem.rem(1)} solid var(--mantine-color-default-border)`
	};
	return {};
};
//#endregion
exports.defaultVariantColorsResolver = defaultVariantColorsResolver;

//# sourceMappingURL=default-variant-colors-resolver.cjs.map