import { t as e } from "../../utils-B7XIe3qq.js";
import { t } from "../../dist-BCCeHAQm.js";
import * as n from "react";
import { jsx as r, jsxs as i } from "react/jsx-runtime";
//#region src/react/primitives/mitre-matrix.tsx
var a = [
	"Initial Access",
	"Execution",
	"Persistence",
	"Privilege Escalation",
	"Defense Evasion",
	"Credential Access",
	"Discovery",
	"Lateral Movement",
	"Collection",
	"Command and Control",
	"Exfiltration",
	"Impact"
], o = t("group relative flex flex-col gap-0.5 rounded-lg border px-2.5 py-2 text-left transition-all duration-200", {
	variants: {
		severity: {
			critical: "border-accent-rose/30 hover:border-accent-rose/50",
			high: "border-accent-rose/20 hover:border-accent-rose/40",
			medium: "border-accent-amber/20 hover:border-accent-amber/40",
			low: "border-accent-cyan/20 hover:border-accent-cyan/40"
		},
		detected: {
			true: "bg-accent-emerald/10 border-accent-emerald/30 hover:bg-accent-emerald/15",
			false: "bg-glass border-border-glass hover:bg-glass-hover"
		}
	},
	defaultVariants: { detected: !1 }
});
function s({ technique: t, showCounts: n = !1, highlightDetected: a = !0, onClick: s }) {
	let c = a && t.detected === !0;
	return /* @__PURE__ */ i("div", {
		className: e(c ? o({ detected: !0 }) : t.severity ? o({
			severity: t.severity,
			detected: !1
		}) : o({ detected: !1 }), s && "cursor-pointer"),
		title: `${t.id}: ${t.name}`,
		onClick: s ? () => s(t) : void 0,
		children: [
			/* @__PURE__ */ r("span", {
				className: "truncate text-[11px] font-medium leading-tight text-foreground",
				children: t.name
			}),
			/* @__PURE__ */ i("div", {
				className: "flex items-center justify-between gap-1",
				children: [/* @__PURE__ */ r("span", {
					className: "text-[10px] font-mono text-foreground-muted",
					children: t.id
				}), n && t.count !== void 0 && t.count > 0 && /* @__PURE__ */ r("span", {
					className: "rounded-full bg-accent-violet/15 px-1.5 py-0.5 text-[9px] font-bold tabular-nums text-accent-violet",
					children: t.count
				})]
			}),
			/* @__PURE__ */ i("div", {
				className: "pointer-events-none absolute left-1/2 top-full z-20 mt-1 hidden w-44 -translate-x-1/2 rounded-lg border border-border-glass bg-surface-secondary/95 p-2 shadow-lg backdrop-blur-xl group-hover:block",
				children: [
					/* @__PURE__ */ r("div", {
						className: "text-[10px] font-mono text-foreground-muted",
						children: t.id
					}),
					/* @__PURE__ */ r("div", {
						className: "text-xs font-medium text-foreground",
						children: t.name
					}),
					c && /* @__PURE__ */ r("div", {
						className: "mt-1 text-[10px] font-bold text-accent-emerald",
						children: "Detected"
					}),
					t.count !== void 0 && t.count > 0 && /* @__PURE__ */ i("div", {
						className: "text-[10px] text-foreground-secondary",
						children: ["Detections: ", t.count]
					})
				]
			})
		]
	});
}
function c({ className: t, techniques: o, tactics: c = a, showCounts: l = !1, highlightDetected: u = !0, onTechniqueClick: d, ...f }) {
	let p = n.useMemo(() => {
		let e = /* @__PURE__ */ new Map();
		for (let t of c) e.set(t, []);
		for (let t of o) {
			let n = e.get(t.tactic);
			n && n.push(t);
		}
		return e;
	}, [c, o]);
	return /* @__PURE__ */ r("div", {
		"data-slot": "mitre-matrix",
		role: "grid",
		"aria-label": "MITRE ATT&CK Matrix",
		className: e("overflow-x-auto", t),
		...f,
		children: /* @__PURE__ */ r("div", {
			className: "inline-flex min-w-full gap-2",
			children: c.map((e) => {
				let t = p.get(e) ?? [];
				return /* @__PURE__ */ i("div", {
					role: "gridcell",
					className: "flex w-36 shrink-0 flex-col gap-1.5",
					children: [/* @__PURE__ */ r("div", {
						className: "rounded-lg border border-border-glass bg-surface-secondary px-2.5 py-2 text-center",
						children: /* @__PURE__ */ r("span", {
							className: "text-[11px] font-bold uppercase tracking-wider text-foreground-secondary",
							children: e
						})
					}), t.map((e) => /* @__PURE__ */ r(s, {
						technique: e,
						showCounts: l,
						highlightDetected: u,
						onClick: d
					}, e.id))]
				}, e);
			})
		})
	});
}
//#endregion
export { c as MitreMatrix, o as techniqueVariants };

//# sourceMappingURL=mitre-matrix.js.map