import { t as e } from "../../utils-B7XIe3qq.js";
import { t } from "../../dist-BCCeHAQm.js";
import "react";
import { jsx as n, jsxs as r } from "react/jsx-runtime";
//#region src/react/primitives/cvss-badge.tsx
function i(e) {
	return e <= 0 ? "none" : e <= 3.9 ? "low" : e <= 6.9 ? "medium" : e <= 8.9 ? "high" : "critical";
}
var a = {
	none: "None",
	low: "Low",
	medium: "Medium",
	high: "High",
	critical: "Critical"
}, o = t("inline-flex items-center gap-2 rounded-md border font-semibold tabular-nums transition-all duration-200", {
	variants: {
		severity: {
			none: "border-foreground-muted/25 bg-foreground-muted/[0.12] text-foreground-muted",
			low: "border-accent-cyan/25 bg-accent-cyan/[0.15] text-accent-cyan",
			medium: "border-accent-amber/25 bg-accent-amber/[0.15] text-accent-amber",
			high: "border-accent-rose/25 bg-accent-rose/[0.15] text-accent-rose",
			critical: "border-accent-rose/35 bg-accent-rose/[0.22] text-accent-rose"
		},
		size: {
			sm: "px-2 py-0.5 text-[10px]",
			md: "px-2.5 py-0.5 text-[11px]",
			lg: "px-3 py-1 text-xs"
		}
	},
	defaultVariants: {
		severity: "none",
		size: "md"
	}
});
function s({ className: t, score: s, version: c, vector: l, showVector: u = !1, size: d, ...f }) {
	let p = Math.max(0, Math.min(10, s)), m = i(p);
	return /* @__PURE__ */ r("div", {
		"data-slot": "cvss-badge",
		role: "status",
		"aria-label": `CVSS Score: ${p.toFixed(1)} - ${a[m]}`,
		className: e(o({
			severity: m,
			size: d
		}), t),
		...f,
		children: [
			/* @__PURE__ */ n("span", {
				className: "font-bold",
				children: p.toFixed(1)
			}),
			/* @__PURE__ */ n("span", {
				className: "opacity-80",
				children: a[m]
			}),
			c && /* @__PURE__ */ r("span", {
				className: "text-[0.85em] opacity-60",
				children: ["v", c]
			}),
			u && l && /* @__PURE__ */ n("span", {
				className: "max-w-[120px] truncate text-[0.85em] opacity-60",
				title: l,
				children: l
			})
		]
	});
}
//#endregion
export { s as CvssBadge, o as cvssBadgeVariants };

//# sourceMappingURL=cvss-badge.js.map