import { CM_ICON_PATHS as e, ICON_SETS as t, getTheme as n, setThemePartial as r } from "../../services/theme-engine/index.js";
//#region src/components/theme/icon-set-picker.ts
var i = {
	Search: "M11 11m-7 0a7 7 0 1 0 14 0 7 7 0 1 0-14 0 M21 21l-4.35-4.35",
	Shield: "M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",
	Settings: "M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6z M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9c.06.55.39 1.04.86 1.34"
};
function a(t, n) {
	let r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
	r.setAttribute("viewBox", `0 0 ${24 * n.length + 8} 24`), r.setAttribute("width", String(24 * n.length + 8)), r.setAttribute("height", "24"), r.setAttribute("class", "theme-studio-icon-tile__row");
	for (let a = 0; a < n.length; a++) {
		let o = n[a];
		if (!o) continue;
		let s = t.brand && e[o] ? e[o] : i[o] ?? "";
		if (!s) continue;
		let c = document.createElementNS("http://www.w3.org/2000/svg", "g");
		c.setAttribute("transform", `translate(${a * 28},0)`), c.setAttribute("fill", "none"), c.setAttribute("stroke", "currentColor"), c.setAttribute("stroke-width", String(t.strokeWidth)), c.setAttribute("stroke-linecap", t.linecap), c.setAttribute("stroke-linejoin", t.linejoin);
		for (let e of s.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), c.appendChild(n);
		}
		r.appendChild(c);
	}
	return r;
}
var o = class {
	el;
	constructor() {
		this.el = document.createElement("div"), this.el.className = "theme-studio-iconsets", this.render(), document.addEventListener("cm:theme-change", () => this.updateActive());
	}
	render() {
		this.el.innerHTML = "";
		let e = n().iconSet, i = [
			"Search",
			"Shield",
			"Settings"
		];
		for (let n of Object.keys(t)) {
			let o = t[n], s = document.createElement("button");
			s.type = "button", s.className = "theme-studio-icon-tile", s.dataset.iconSet = n, n === e && s.classList.add("is-active"), s.setAttribute("aria-pressed", String(n === e)), s.setAttribute("aria-label", `Use ${o.label} icon set`);
			let c = document.createElement("div");
			c.className = "theme-studio-icon-tile__preview", c.appendChild(a(o, i)), s.appendChild(c);
			let l = document.createElement("div");
			l.className = "theme-studio-icon-tile__name", l.textContent = o.label, s.appendChild(l);
			let u = document.createElement("div");
			if (u.className = "theme-studio-icon-tile__desc", u.textContent = o.description, s.appendChild(u), o.brand) {
				let e = document.createElement("span");
				e.className = "theme-studio-icon-tile__badge", e.textContent = "Brand", s.appendChild(e);
			}
			s.addEventListener("click", () => r({ iconSet: n })), this.el.appendChild(s);
		}
	}
	updateActive() {
		let e = n().iconSet, t = this.el.querySelectorAll(".theme-studio-icon-tile");
		for (let n of t) {
			let t = n.dataset.iconSet === e;
			n.classList.toggle("is-active", t), n.setAttribute("aria-pressed", String(t));
		}
	}
};
//#endregion
export { o as IconSetPicker };

//# sourceMappingURL=icon-set-picker.js.map