import { setTheme as e } from "../../ui/index.js";
//#region src/services/theme-engine/palettes.ts
var t = {
	dark: {
		id: "dark",
		label: "Dark",
		icon: "Moon",
		swatch: [
			"#0b0f17",
			"#111827",
			"#161f31"
		],
		surfaceTint: "255, 255, 255"
	},
	light: {
		id: "light",
		label: "Light",
		icon: "Sun",
		swatch: [
			"#ffffff",
			"#f4f5f8",
			"#e4e7ee"
		],
		surfaceTint: "15, 23, 42"
	},
	monokai: {
		id: "monokai",
		label: "Monokai",
		icon: "Code2",
		swatch: [
			"#0a0a0a",
			"#1a1a1a",
			"#272822"
		],
		surfaceTint: "255, 255, 255"
	},
	glass: {
		id: "glass",
		label: "Glass",
		icon: "Layers",
		swatch: [
			"#171a26",
			"#202435",
			"#2a2f44"
		],
		surfaceTint: "255, 255, 255"
	}
}, n = {
	orange: {
		id: "orange",
		label: "Orange",
		brand: "#ff7a00",
		hot: "#ff9233",
		soft: "rgba(255,122,0,0.10)",
		rgb: "255,122,0"
	},
	cyan: {
		id: "cyan",
		label: "Cyan",
		brand: "#06b6d4",
		hot: "#22d3ee",
		soft: "rgba(6,182,212,0.10)",
		rgb: "6,182,212"
	},
	violet: {
		id: "violet",
		label: "Violet",
		brand: "#8b5cf6",
		hot: "#a78bfa",
		soft: "rgba(139,92,246,0.10)",
		rgb: "139,92,246"
	},
	rose: {
		id: "rose",
		label: "Rose",
		brand: "#ef4444",
		hot: "#f87171",
		soft: "rgba(239,68,68,0.10)",
		rgb: "239,68,68"
	},
	emerald: {
		id: "emerald",
		label: "Emerald",
		brand: "#10b981",
		hot: "#34d399",
		soft: "rgba(16,185,129,0.10)",
		rgb: "16,185,129"
	},
	amber: {
		id: "amber",
		label: "Amber",
		brand: "#f59e0b",
		hot: "#fbbf24",
		soft: "rgba(245,158,11,0.10)",
		rgb: "245,158,11"
	}
}, r = {
	inter: {
		id: "inter",
		label: "Inter",
		sample: "Aa Bb Cc 123",
		description: "Default — neutral, professional",
		display: "'Inter', system-ui, -apple-system, sans-serif",
		mono: "'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace",
		google: "Inter:wght@400;500;600;700|IBM+Plex+Mono:wght@400;500;600"
	},
	sora: {
		id: "sora",
		label: "Sora",
		sample: "Aa Bb Cc 123",
		description: "Geometric, modern",
		display: "'Sora', system-ui, sans-serif",
		mono: "'JetBrains Mono', ui-monospace, monospace",
		google: "Sora:wght@400;500;600;700|JetBrains+Mono:wght@400;500;600"
	},
	roboto: {
		id: "roboto",
		label: "Roboto",
		sample: "Aa Bb Cc 123",
		description: "Friendly, classic web",
		display: "'Roboto', system-ui, sans-serif",
		mono: "'Roboto Mono', ui-monospace, monospace",
		google: "Roboto:wght@400;500;700|Roboto+Mono:wght@400;500;600"
	},
	jetbrainsMono: {
		id: "jetbrainsMono",
		label: "JetBrains Mono",
		sample: "Aa Bb Cc 123",
		description: "Mono everywhere — IDE feel",
		display: "'JetBrains Mono', ui-monospace, monospace",
		mono: "'JetBrains Mono', ui-monospace, monospace",
		google: "JetBrains+Mono:wght@400;500;600;700"
	},
	system: {
		id: "system",
		label: "System",
		sample: "Aa Bb Cc 123",
		description: "Use OS native fonts",
		display: "system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif",
		mono: "ui-monospace, \"SF Mono\", Menlo, monospace",
		google: null
	}
};
function i(e) {
	if (!e || typeof document > "u") return;
	let t = `cm-gfont-${e}`;
	if (document.getElementById(t)) return;
	let n = document.createElement("link");
	n.id = t, n.rel = "stylesheet", n.href = "https://fonts.googleapis.com/css2?" + e.split("|").map((e) => `family=${e}`).join("&") + "&display=swap", document.head.appendChild(n);
}
//#endregion
//#region src/services/theme-engine/icons.ts
var a = {
	lucide: {
		id: "lucide",
		label: "Lucide",
		description: "Default — clean 2px stroke",
		strokeWidth: 2,
		linecap: "round",
		linejoin: "round",
		brand: !1
	},
	heroicons: {
		id: "heroicons",
		label: "Heroicons",
		description: "Heavier 2.4px stroke",
		strokeWidth: 2.4,
		linecap: "round",
		linejoin: "round",
		brand: !1
	},
	phosphor: {
		id: "phosphor",
		label: "Phosphor",
		description: "Lighter 1.5px stroke",
		strokeWidth: 1.5,
		linecap: "round",
		linejoin: "round",
		brand: !1
	},
	material: {
		id: "material",
		label: "Material",
		description: "Square caps, geometric",
		strokeWidth: 2,
		linecap: "square",
		linejoin: "miter",
		brand: !1
	},
	countermeasure: {
		id: "countermeasure",
		label: "CounterMeasure",
		description: "Brand set — bespoke marks for security",
		strokeWidth: 1.75,
		linecap: "round",
		linejoin: "round",
		brand: !0
	}
}, o = {
	Shield: "M12 2l9 4-3 11-6 5-6-5-3-11z M12 7v10 M7.5 10l9 4 M16.5 10l-9 4",
	ShieldCheck: "M12 2l9 4-3 11-6 5-6-5-3-11z M8.5 12l3 3 4-5",
	Crosshair: "M12 12m-9 0a9 9 0 1 0 18 0 9 9 0 1 0-18 0 M12 12m-5 0a5 5 0 1 0 10 0 5 5 0 1 0-10 0 M22 12h-2 M4 12H2 M12 4V2 M12 22v-2 M12 12v.01",
	Bug: "M12 3l4 5h-8z M12 8v13 M5 12l-2 2 2 2 M19 12l2 2-2 2 M8 21h8",
	Database: "M4 4h16v5H4z M4 9.5h16v5H4z M4 15h16v5H4z M9 6.5h.01 M9 12h.01 M9 17.5h.01",
	Plug: "M12 2l4 4-4 4-4-4z M12 10v4 M9 14h6v3a3 3 0 0 1-3 3 3 3 0 0 1-3-3z",
	Sparkles: "M12 2l3 7 7 3-7 3-3 7-3-7-7-3 7-3z",
	Rocket: "M12 2l5 8h-3v8h-4v-8H7z M9 22h6",
	Settings: "M12 2l1.5 2.6L16 4l.5 3 3 .5L19 10l2.6 1.5L20 14l1 3-3 1-1 3-3-1-1.5 2.6L11 20l-1 2-3-1L6 18l-3-1 1-3-2.6-1.5L4 11 2 9.5 5 8l-1-3 3-1z M12 12m-3 0a3 3 0 1 0 6 0 3 3 0 1 0-6 0",
	Activity: "M2 12h4l3 8 3-16 3 8 3-4h4",
	Skull: "M12 3l8 7v6l-3 3v3h-2v-3h-2v3h-2v-3h-2v3H7v-3l-3-3v-6z M9 12h.01 M15 12h.01",
	Lightbulb: "M12 3l5 6-5 8-5-8z M9 18h6 M10 21h4",
	Target: "M12 12m-10 0a10 10 0 1 0 20 0 10 10 0 1 0-20 0 M12 12m-5 0a5 5 0 1 0 10 0 5 5 0 1 0-10 0 M12 7l3 3 M12 17l3-3",
	Globe: "M12 2l9 5v10l-9 5-9-5V7z M12 2v20 M3 7l9 5 9-5 M3 17l9-5 9 5"
}, s = [
	{
		id: "nav.search",
		label: "Search",
		defaultIcon: "Search",
		alternates: [
			"Search",
			"Crosshair",
			"Target"
		]
	},
	{
		id: "nav.notifications",
		label: "Notifications",
		defaultIcon: "Bell",
		alternates: [
			"Bell",
			"AlertCircle",
			"Activity"
		]
	},
	{
		id: "nav.help",
		label: "Help",
		defaultIcon: "HelpCircle",
		alternates: [
			"HelpCircle",
			"BookOpen",
			"MessageSquare"
		]
	},
	{
		id: "nav.feedback",
		label: "Feedback",
		defaultIcon: "MessageSquare",
		alternates: [
			"MessageSquare",
			"Send",
			"Mic"
		]
	},
	{
		id: "product.detection",
		label: "Detection",
		defaultIcon: "Shield",
		alternates: [
			"Shield",
			"ShieldCheck",
			"Bug",
			"AlertTriangle"
		]
	},
	{
		id: "product.coverage",
		label: "Coverage",
		defaultIcon: "Crosshair",
		alternates: [
			"Crosshair",
			"Target",
			"Grid3X3"
		]
	},
	{
		id: "product.intel",
		label: "Threat intel",
		defaultIcon: "Skull",
		alternates: [
			"Skull",
			"Bug",
			"AlertTriangle"
		]
	},
	{
		id: "product.connectors",
		label: "Connectors",
		defaultIcon: "Plug",
		alternates: [
			"Plug",
			"Network",
			"Workflow"
		]
	},
	{
		id: "product.detections",
		label: "Detection library",
		defaultIcon: "FileCode",
		alternates: [
			"FileCode",
			"BookOpen",
			"Files"
		]
	},
	{
		id: "product.opps",
		label: "Opportunities",
		defaultIcon: "Lightbulb",
		alternates: [
			"Lightbulb",
			"Sparkles",
			"TrendingUp"
		]
	},
	{
		id: "product.studio",
		label: "Studio (IDE)",
		defaultIcon: "Terminal",
		alternates: [
			"Terminal",
			"Code2",
			"Code"
		]
	},
	{
		id: "system.settings",
		label: "Settings",
		defaultIcon: "Settings",
		alternates: [
			"Settings",
			"SlidersHorizontal",
			"Wrench"
		]
	},
	{
		id: "system.user",
		label: "User",
		defaultIcon: "UserCheck",
		alternates: [
			"UserCheck",
			"UserCog",
			"Users"
		]
	},
	{
		id: "system.logout",
		label: "Sign out",
		defaultIcon: "LogOut",
		alternates: ["LogOut", "LogIn"]
	},
	{
		id: "state.success",
		label: "Success",
		defaultIcon: "CheckCircle",
		alternates: ["CheckCircle", "Check"]
	},
	{
		id: "state.warning",
		label: "Warning",
		defaultIcon: "AlertTriangle",
		alternates: ["AlertTriangle", "AlertCircle"]
	}
], c = [
	{
		id: "mission-control",
		label: "Mission Control",
		description: "CounterMeasure default — dark, restrained, orange accent.",
		theme: {
			mode: "dark",
			accent: "orange",
			font: "inter",
			iconSet: "lucide",
			density: "comfortable",
			radius: 8,
			transparency: .04,
			iconOverrides: {}
		}
	},
	{
		id: "glass-violet",
		label: "Frost & Violet",
		description: "Glassy surfaces with a violet glow. Operations + intel.",
		theme: {
			mode: "glass",
			accent: "violet",
			font: "sora",
			iconSet: "phosphor",
			density: "comfortable",
			radius: 12,
			transparency: .1,
			iconOverrides: {}
		}
	},
	{
		id: "monokai",
		label: "Monokai",
		description: "Pure black, IDE-like. For detection engineers.",
		theme: {
			mode: "monokai",
			accent: "emerald",
			font: "jetbrainsMono",
			iconSet: "countermeasure",
			density: "compact",
			radius: 4,
			transparency: .04,
			iconOverrides: {}
		}
	},
	{
		id: "cyan-mint",
		label: "Cyan Mint",
		description: "Cooler dark surfaces, cyan accent — daytime ops.",
		theme: {
			mode: "dark",
			accent: "cyan",
			font: "inter",
			iconSet: "heroicons",
			density: "comfortable",
			radius: 10,
			transparency: .05,
			iconOverrides: {}
		}
	},
	{
		id: "rose-soc",
		label: "Rose SOC",
		description: "High-energy red accent for incident-response shifts.",
		theme: {
			mode: "dark",
			accent: "rose",
			font: "inter",
			iconSet: "material",
			density: "compact",
			radius: 6,
			transparency: .04,
			iconOverrides: {}
		}
	},
	{
		id: "paper-light",
		label: "Paper",
		description: "Light mode for printouts, executives, daylight.",
		theme: {
			mode: "light",
			accent: "orange",
			font: "inter",
			iconSet: "lucide",
			density: "comfortable",
			radius: 8,
			transparency: .03,
			iconOverrides: {}
		}
	}
], l = "mission-control";
function u() {
	let e = c.find((e) => e.id === l);
	if (!e) throw Error(`THEME_DEFAULT preset "${l}" not found`);
	return JSON.parse(JSON.stringify(e.theme));
}
//#endregion
//#region src/services/theme-engine/engine.ts
var d = "cm-theme-v1", f = "preview:glass-level", p = "preview:density";
function m(e) {
	let t = e;
	try {
		let e = localStorage.getItem(f);
		if (e !== null) {
			let n = Number(e);
			Number.isFinite(n) && (t = {
				...t,
				transparency: Math.max(0, Math.min(.2, n))
			});
		}
	} catch {}
	try {
		let e = localStorage.getItem(p);
		(e === "compact" || e === "comfortable" || e === "cozy") && (t = {
			...t,
			density: e
		});
	} catch {}
	return t;
}
function h() {
	if (typeof localStorage > "u") return u();
	try {
		let e = localStorage.getItem(d);
		if (!e) return m(u());
		let t = JSON.parse(e);
		return {
			...u(),
			...t ?? {}
		};
	} catch {
		return u();
	}
}
function g(e) {
	try {
		typeof localStorage < "u" && localStorage.setItem(d, JSON.stringify(e));
	} catch {}
	v(e);
}
function _(e, t, n) {
	return Number.isFinite(e) ? Math.max(t, Math.min(n, e)) : t;
}
function v(o) {
	if (typeof document > "u") return;
	let s = document.documentElement, c = t[o.mode] ?? t.dark, l = n[o.accent] ?? n.orange, u = r[o.font] ?? r.inter, d = a[o.iconSet] ?? a.lucide, m = s.getAttribute("data-theme"), h = c.id;
	m === h ? s.setAttribute("data-theme", h) : e(h), o.accent === "orange" ? s.removeAttribute("data-accent") : s.setAttribute("data-accent", o.accent), s.setAttribute("data-density", o.density);
	let g = _(Number(o.transparency) || 0, 0, .3), v = c.surfaceTint;
	s.style.setProperty("--bg-glass", `rgba(${v}, ${(g * .5).toFixed(4)})`), s.style.setProperty("--bg-glass-2", `rgba(${v}, ${g.toFixed(4)})`), s.style.setProperty("--bg-glass-3", `rgba(${v}, ${(g * 1.75).toFixed(4)})`), s.style.setProperty("--brand", l.brand), s.style.setProperty("--brand-hot", l.hot), s.style.setProperty("--brand-soft", l.soft), s.style.setProperty("--accent-rgb", l.rgb);
	let y = _(Number(o.radius) || 0, 0, 32);
	s.style.setProperty("--radius-sm", `${y * .5}px`), s.style.setProperty("--radius-md", `${y}px`), s.style.setProperty("--radius-lg", `${y * 1.5}px`), s.style.setProperty("--radius-xl", `${y * 2}px`);
	let b = o.density === "compact" ? 32 : o.density === "cozy" ? 42 : 36;
	s.style.setProperty("--density-row", `${b}px`), i(u.google), s.style.setProperty("--font-display", u.display), s.style.setProperty("--font-mono", u.mono), s.setAttribute("data-icon-set", o.iconSet), s.style.setProperty("--icon-stroke-width", String(d.strokeWidth)), s.style.setProperty("--icon-linecap", d.linecap), s.style.setProperty("--icon-linejoin", d.linejoin);
	try {
		typeof localStorage < "u" && (localStorage.setItem(f, String(o.transparency)), localStorage.setItem(p, o.density));
	} catch {}
	document.dispatchEvent(new CustomEvent("cm:theme-change", { detail: o }));
}
var y = null;
function b() {
	return y ||= h(), y;
}
function x(e) {
	let t = {
		...b(),
		...e
	};
	return y = t, g(t), t;
}
function S(e) {
	return y = e, g(e), e;
}
function C(e) {
	for (let t of c) {
		let n = {
			...t.theme,
			iconOverrides: {}
		}, r = {
			...e,
			iconOverrides: {}
		};
		if (JSON.stringify(n) === JSON.stringify(r)) return t.id;
	}
	return "custom";
}
function w() {
	return S(u());
}
var T = !1, E = null;
function D() {
	if (!(typeof document > "u") && !T) {
		T = !0;
		try {
			v(b());
		} catch {}
		try {
			E = new MutationObserver((e) => {
				for (let t of e) if (t.type === "attributes" && t.attributeName === "data-theme") {
					let e = document.documentElement.getAttribute("data-theme");
					(e === "dark" || e === "light" || e === "monokai" || e === "glass") && y && y.mode !== e && (y = {
						...y,
						mode: e
					}, document.dispatchEvent(new CustomEvent("cm:theme-change", { detail: y })));
				}
			}), E.observe(document.documentElement, {
				attributes: !0,
				attributeFilter: ["data-theme"]
			});
		} catch {}
	}
}
function O() {
	E &&= (E.disconnect(), null), T = !1;
}
function k() {
	y = null;
}
//#endregion
export { n as ACCENT_PALETTES, o as CM_ICON_PATHS, t as COLOR_MODES, r as FONT_STACKS, a as ICON_SETS, s as ICON_USAGES, l as THEME_DEFAULT, d as THEME_LS_KEY, c as THEME_PRESETS, k as _resetCache, v as applyTheme, D as bootstrapTheme, u as defaultTheme, i as ensureGoogleFont, C as findActivePresetId, b as getTheme, h as loadTheme, w as resetTheme, g as saveTheme, S as setThemeFull, x as setThemePartial, O as teardownTheme };

//# sourceMappingURL=index.js.map