import { r as e } from "../../sanitize-CDxuPfMB.js";
//#region src/components/status-bar/index.ts
function t(e) {
	if (typeof e == "string") {
		let t = document.querySelector(e);
		if (!t) throw Error(`StatusBar: container not found for selector "${e}"`);
		return t;
	}
	return e;
}
var n = class {
	containerEl;
	rootEl;
	leftEl;
	centerEl;
	rightEl;
	sections = /* @__PURE__ */ new Map();
	sectionElements = /* @__PURE__ */ new Map();
	destroyed = !1;
	constructor(e) {
		if (this.containerEl = t(e.container), this.rootEl = document.createElement("div"), this.rootEl.className = "cmm-status-bar", this.leftEl = document.createElement("div"), this.leftEl.className = "cmm-status-bar__left", this.centerEl = document.createElement("div"), this.centerEl.className = "cmm-status-bar__center", this.rightEl = document.createElement("div"), this.rightEl.className = "cmm-status-bar__right", this.rootEl.appendChild(this.leftEl), this.rootEl.appendChild(this.centerEl), this.rootEl.appendChild(this.rightEl), this.containerEl.appendChild(this.rootEl), e.sections) for (let t of e.sections) this.addSection(t);
	}
	update(t, n) {
		let r = this.sections.get(t), i = this.sectionElements.get(t);
		!r || !i || e(i, r.template(n), { allowSvg: !0 });
	}
	addSection(e) {
		this.sections.set(e.id, e);
		let t = document.createElement("div");
		t.className = "cmm-status-bar__section", t.dataset.sectionId = e.id, this.sectionElements.set(e.id, t), this.getPositionContainer(e.position).appendChild(t);
	}
	destroy() {
		this.destroyed || (this.destroyed = !0, this.rootEl.parentNode && this.rootEl.parentNode.removeChild(this.rootEl), this.sections.clear(), this.sectionElements.clear());
	}
	getPositionContainer(e) {
		return e === "left" ? this.leftEl : e === "center" ? this.centerEl : this.rightEl;
	}
};
//#endregion
export { n as StatusBar };

//# sourceMappingURL=index.js.map