import { LUCIDE_ICON_NAMES as e, getLucideIconPath as t } from "./icons/lucide.js";
import { getTheme as n, resetTheme as r } from "./services/theme-engine/index.js";
import { AccentSwitcher as i } from "./components/theme/accent-switcher.js";
import { DensitySwitcher as a } from "./components/theme/density-switcher.js";
import { FontStackPicker as o } from "./components/theme/font-stack-picker.js";
import { GlassSlider as s } from "./components/theme/glass-slider.js";
import { IconSetPicker as c } from "./components/theme/icon-set-picker.js";
import { IconUsageMatrix as l } from "./components/theme/icon-usage-matrix.js";
import { RadiusSlider as u } from "./components/theme/radius-slider.js";
import { ThemePresetGrid as d } from "./components/theme/theme-preset-grid.js";
import { ThemePreviewTile as f } from "./components/theme/theme-preview-tile.js";
import { ThemeSwitcher as p } from "./components/theme/theme-switcher.js";
//#region src/components/theme/icon-gallery-browser.ts
function m(e) {
	switch (e) {
		case "heroicons": return {
			label: "Heroicons",
			strokeWidth: 2.4,
			linecap: "round",
			linejoin: "round",
			brand: !1
		};
		case "phosphor": return {
			label: "Phosphor",
			strokeWidth: 1.5,
			linecap: "round",
			linejoin: "round",
			brand: !1
		};
		case "material": return {
			label: "Material",
			strokeWidth: 2,
			linecap: "square",
			linejoin: "miter",
			brand: !1
		};
		case "countermeasure": return {
			label: "CounterMeasure",
			strokeWidth: 1.75,
			linecap: "round",
			linejoin: "round",
			brand: !0
		};
		case "lucide": return {
			label: "Lucide",
			strokeWidth: 2,
			linecap: "round",
			linejoin: "round",
			brand: !1
		};
	}
}
function h(e, t, n) {
	let r = document.createElement("div");
	r.className = "theme-studio-icon-gallery__cell", r.tabIndex = 0, r.setAttribute("role", "img"), r.setAttribute("aria-label", e);
	let i = document.createElementNS("http://www.w3.org/2000/svg", "svg");
	i.setAttribute("viewBox", "0 0 24 24"), i.setAttribute("width", "28"), i.setAttribute("height", "28"), i.setAttribute("fill", "none"), i.setAttribute("stroke", "currentColor"), i.setAttribute("stroke-width", String(n.strokeWidth)), i.setAttribute("stroke-linecap", n.linecap), i.setAttribute("stroke-linejoin", n.linejoin), i.setAttribute("aria-hidden", "true");
	for (let e of t.split(/(?=M)/g)) {
		let t = e.trim();
		if (!t) continue;
		let n = document.createElementNS("http://www.w3.org/2000/svg", "path");
		n.setAttribute("d", t), i.appendChild(n);
	}
	r.appendChild(i);
	let a = document.createElement("span");
	return a.className = "theme-studio-icon-gallery__label", a.textContent = e, r.appendChild(a), r;
}
var g = class {
	el;
	gallery = null;
	toggle = null;
	expanded = !1;
	onThemeChange;
	constructor() {
		this.el = document.createElement("div"), this.el.className = "theme-studio-icon-gallery-browser", this.render(), this.onThemeChange = () => {
			this.expanded && this.renderGallery();
		}, document.addEventListener("cm:theme-change", this.onThemeChange);
	}
	destroy() {
		document.removeEventListener("cm:theme-change", this.onThemeChange);
	}
	render() {
		this.el.replaceChildren();
		let e = document.createElement("button");
		e.type = "button", e.className = "theme-studio-icon-gallery__toggle";
		let t = document.createElement("span");
		t.className = "theme-studio-icon-gallery__toggle-text", t.textContent = "Browse all icons", e.appendChild(t);
		let n = document.createElementNS("http://www.w3.org/2000/svg", "svg");
		n.setAttribute("aria-hidden", "true"), n.setAttribute("focusable", "false"), n.setAttribute("width", "14"), n.setAttribute("height", "14"), n.setAttribute("viewBox", "0 0 24 24"), n.setAttribute("fill", "none"), n.setAttribute("stroke", "currentColor"), n.setAttribute("stroke-width", "2"), n.setAttribute("stroke-linecap", "round"), n.setAttribute("stroke-linejoin", "round");
		let r = document.createElementNS("http://www.w3.org/2000/svg", "path");
		r.setAttribute("d", "m6 9 6 6 6-6"), n.appendChild(r), e.appendChild(n), e.setAttribute("aria-expanded", "false"), e.addEventListener("click", () => this.toggleGallery()), this.toggle = e, this.el.appendChild(e), this.gallery = document.createElement("div"), this.gallery.className = "theme-studio-icon-gallery", this.gallery.hidden = !0, this.el.appendChild(this.gallery);
	}
	toggleGallery() {
		if (this.expanded = !this.expanded, this.gallery && (this.gallery.hidden = !this.expanded, this.expanded && this.renderGallery()), this.toggle) {
			this.toggle.setAttribute("aria-expanded", String(this.expanded)), this.toggle.classList.toggle("is-expanded", this.expanded);
			let e = this.toggle.querySelector(".theme-studio-icon-gallery__toggle-text");
			e && (e.textContent = this.expanded ? "Hide icons" : "Browse all icons");
		}
	}
	renderGallery() {
		if (!this.gallery) return;
		this.gallery.replaceChildren();
		let e = m(n().iconSet), t = e.brand ? this.buildBrandGallerySection(e) : this.buildGallerySection(e);
		this.gallery.appendChild(t);
	}
	buildBrandGallerySection(e) {
		let t = this.buildSectionShell("CounterMeasure Brand Icons");
		return t.grid.appendChild(h("Search", "M11 4l5 3v6l-5 3-5-3V7z M20 21l-4-4", e)), t.grid.appendChild(h("Shield", "M12 2l9 4-3 11-6 5-6-5-3-11z M12 7v10 M7.5 10l9 4 M16.5 10l-9 4", e)), t.grid.appendChild(h("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 9l3 3-3 3-3-3z", e)), t.section;
	}
	buildGallerySection(n) {
		let r = this.buildSectionShell(`All Icons — ${n.label} style`);
		for (let i of e) {
			let e = t(i);
			e && r.grid.appendChild(h(i, e, n));
		}
		return r.section;
	}
	buildSectionShell(e) {
		let t = document.createElement("div");
		t.className = "theme-studio-icon-gallery__section";
		let n = document.createElement("div");
		n.className = "theme-studio-icon-gallery__heading", n.textContent = e, t.appendChild(n);
		let r = document.createElement("div");
		return r.className = "theme-studio-icon-gallery__grid", t.appendChild(r), {
			section: t,
			grid: r
		};
	}
}, _ = {
	showTabs: !0,
	showHeader: !0,
	showBrandSection: !0
};
function v(e, t, n) {
	let r = document.createElement(e);
	return t && (r.className = t), n !== void 0 && (r.textContent = n), r;
}
function y(e, t, n, r) {
	let i = v("section", "theme-studio-section"), a = v("div", "theme-studio-section__head"), o = v("div", "theme-studio-section__titles");
	return o.appendChild(v("h3", "theme-studio-section__title", e)), o.appendChild(v("div", "theme-studio-section__helper", t)), a.appendChild(o), r && a.appendChild(r), i.appendChild(a), i.appendChild(n), i;
}
function b() {
	let e = v("div", "theme-studio-tabs");
	for (let t of [
		"Profile",
		"Organization",
		"Appearance",
		"About"
	]) {
		let n = v("button", "theme-studio-tab", t);
		n.type = "button", t === "Appearance" && n.classList.add("is-active"), n.disabled = t !== "Appearance", e.appendChild(n);
	}
	return e;
}
function x() {
	let e = v("button", "theme-studio-link", "Reset to default");
	return e.type = "button", e.addEventListener("click", () => {
		r();
	}), e;
}
var S = class {
	el;
	options;
	children = [];
	constructor(e = {}) {
		this.options = {
			..._,
			...e
		}, this.el = document.createElement("section"), this.el.className = "theme-studio-pane", this.render();
	}
	render() {
		for (let e of this.children) e.destroy?.();
		if (this.children = [], this.el.replaceChildren(), this.options.showTabs && this.el.appendChild(b()), this.options.showHeader) {
			let e = v("header", "theme-studio-pane__header");
			e.appendChild(v("h1", "theme-studio-pane__title", "Appearance")), e.appendChild(v("p", "theme-studio-pane__subtitle", "Customize how CounterMeasure looks. Pick a preset, tweak the color mode, accent, transparency, typography, and icons. Changes apply immediately and persist on this device.")), this.el.appendChild(e);
		}
		let e = new d();
		this.children.push(e), this.el.appendChild(y("Start from a preset", "Curated combinations of mode, accent, font, and icon style.", e.el, x()));
		let t = new f();
		this.children.push(t), this.el.appendChild(y("Live preview", "A miniature app shell that re-renders as you tweak settings below.", t.el));
		let n = new p();
		this.children.push(n), this.el.appendChild(y("Color Mode", "Choose how the interface looks.", n.el));
		let r = new i();
		this.children.push(r), this.el.appendChild(y("Accent Color", "Pick a color that highlights actions and links.", r.el));
		let a = new s({ expanded: !0 });
		this.children.push(a), this.el.appendChild(y("Surface Transparency", "How translucent panels, hover states, and overlays appear.", a.el));
		let l = new o();
		this.children.push(l), this.el.appendChild(y("Typography", "Select the typeface used throughout the app.", l.el));
		let u = new c(), m = new g();
		this.children.push(u), this.children.push(m);
		let h = v("div", "theme-studio-iconsets-wrap");
		if (h.appendChild(u.el), h.appendChild(m.el), this.el.appendChild(y("Icon Set", "Choose the icon style for navigation and content.", h)), this.options.showBrandSection) {
			let e = v("div", "theme-studio-brand-note");
			e.appendChild(v("p", "theme-studio-brand-note__text", "Brand assets live under design-system brand resources. Switch icon sets to CounterMeasure above to apply the bespoke security glyphs.")), this.el.appendChild(y("Brand", "Logo, wordmark, and brand glyph references.", e));
		}
		this.el.appendChild(this.buildAdvancedSection());
	}
	buildAdvancedSection() {
		let e = document.createElement("details");
		e.className = "theme-studio-section theme-studio-section--advanced";
		let t = document.createElement("summary");
		t.className = "theme-studio-section__head theme-studio-section__head--summary";
		let n = v("div", "theme-studio-section__titles");
		n.appendChild(v("h3", "theme-studio-section__title", "Advanced")), n.appendChild(v("div", "theme-studio-section__helper", "Density, corner radius, and per-icon overrides")), t.appendChild(n);
		let r = v("span", "theme-studio-section__chev", "Show");
		return t.appendChild(r), e.appendChild(t), e.appendChild(this.buildAdvanced()), e.addEventListener("toggle", () => {
			r.textContent = e.open ? "Hide" : "Show";
		}), e;
	}
	buildAdvanced() {
		let e = v("div", "theme-studio-advanced"), t = new a();
		this.children.push(t);
		let n = v("div", "theme-studio-advanced__row");
		n.appendChild(t.el), e.appendChild(n);
		let r = new u();
		this.children.push(r);
		let i = v("div", "theme-studio-advanced__row");
		i.appendChild(r.el), e.appendChild(i);
		let o = v("div", "theme-studio-advanced__matrix-head");
		o.appendChild(v("h4", "theme-studio-advanced__matrix-title", "Per-icon mapping")), o.appendChild(v("p", "theme-studio-advanced__matrix-helper", "Rebind any icon slot. Useful if your team thinks of detection as a bug instead of a shield.")), e.appendChild(o);
		let s = new l();
		return this.children.push(s), e.appendChild(s.el), e;
	}
	destroy() {
		for (let e of this.children) e.destroy?.();
		this.children = [];
	}
};
function C(e, t) {
	let n = new S(t);
	return e.replaceChildren(), e.appendChild(n.el), n;
}
//#endregion
export { C as n, S as t };

//# sourceMappingURL=theme-studio-DKw0d82w.js.map