"use strict"; // One source of navigation icons for every sidebar mode (full/compact/split) and the minimized-plugin taskbar. // Keys are stable IDs (core view names, "plugin:"), never translated labels, so icons do not depend on the // language. Unknown or catalog plugins get the neutral "puzzle" icon. (function (root) { const ICON_BY_KEY = Object.freeze({ overview: "layout-dashboard", terminal: "terminal", profiles: "server", updates: "refresh-cw", plugins: "blocks", diagnostics: "activity", settings: "settings", "plugin:chj.hash-checksum": "hash", "plugin:chj.disks": "hard-drive", "plugin:chj.file-manager": "folder-open", "plugin:chj.key-generator": "key-round", "plugin:chj.log-viewer": "scroll-text", "plugin:chj.nginx-manager": "network", "plugin:chj.system-monitor": "chart-no-axes-combined", "plugin:chj.users": "users" }); const FALLBACK = "puzzle"; const SVG_NS = "http://www.w3.org/2000/svg"; function iconName(key) { return ICON_BY_KEY[String(key || "")] || FALLBACK; } // Builds the SVG from vendored element nodes (createElementNS, no markup parsing). Sizing comes from CSS // (.nav-icon), the viewBox keeps the 24-unit Lucide grid so strokes stay sharp at any size. function createIcon(key, className = "nav-icon") { const icons = root.chjLucideIcons || {}; const name = icons[iconName(key)] ? iconName(key) : FALLBACK; const svg = document.createElementNS(SVG_NS, "svg"); svg.setAttribute("class", className); svg.setAttribute("viewBox", "0 0 24 24"); svg.setAttribute("fill", "none"); svg.setAttribute("stroke", "currentColor"); svg.setAttribute("stroke-width", "2"); svg.setAttribute("stroke-linecap", "round"); svg.setAttribute("stroke-linejoin", "round"); svg.setAttribute("aria-hidden", "true"); svg.setAttribute("focusable", "false"); svg.dataset.icon = name; for (const [tag, attributes] of icons[name] || []) { const element = document.createElementNS(SVG_NS, tag); for (const [attribute, value] of Object.entries(attributes)) element.setAttribute(attribute, value); svg.append(element); } return svg; } const exported = Object.freeze({ ICON_BY_KEY, FALLBACK, iconName, createIcon }); if (typeof module === "object" && module.exports) module.exports = exported; else root.chjNavIcons = exported; })(typeof window === "object" ? window : globalThis);