//#region src/charts/tooltip.ts
var e = 12, t = "cmm-chart-tooltip", n = class {
	element;
	container;
	constructor(e) {
		this.container = e, this.element = document.createElement("div"), this.element.className = t, this.element.style.position = "absolute", this.element.style.display = "none", this.element.style.pointerEvents = "none", this.element.style.backgroundColor = "#1e293b", this.element.style.color = "#f8fafc", this.element.style.padding = "6px 10px", this.element.style.borderRadius = "4px", this.element.style.fontSize = "12px", this.element.style.fontFamily = "system-ui, sans-serif", this.element.style.lineHeight = "1.4", this.element.style.whiteSpace = "nowrap", this.element.style.zIndex = "1000", this.element.style.boxShadow = "0 2px 8px rgba(0,0,0,0.15)", this.element.style.transition = "opacity 0.15s ease", window.getComputedStyle(this.container).position === "static" && (this.container.style.position = "relative"), this.container.appendChild(this.element);
	}
	show(t, n, r) {
		if (this.element.textContent = "", typeof r == "string") this.element.textContent = r;
		else {
			if (r.title !== void 0) {
				let e = document.createElement("div");
				e.style.fontWeight = "600", e.style.marginBottom = r.items === void 0 ? "0" : "4px", e.textContent = r.title, this.element.appendChild(e);
			}
			if (r.items !== void 0) for (let e of r.items) {
				let t = document.createElement("div");
				if (t.style.display = "flex", t.style.alignItems = "center", t.style.gap = "6px", e.color !== void 0) {
					let n = document.createElement("span");
					n.style.width = "8px", n.style.height = "8px", n.style.borderRadius = "50%", n.style.backgroundColor = e.color, t.appendChild(n);
				}
				let n = document.createElement("span");
				n.textContent = e.label, t.appendChild(n);
				let r = document.createElement("span");
				r.style.marginLeft = "auto", r.style.fontWeight = "600", r.textContent = String(e.value), t.appendChild(r), this.element.appendChild(t);
			}
		}
		this.element.style.display = "block";
		let i = this.container.getBoundingClientRect(), a = this.element.offsetWidth, o = this.element.offsetHeight, s = t + e, c = n - o - e;
		s + a > i.width && (s = t - a - e), c < 0 && (c = n + e), this.element.style.left = `${String(Math.max(0, s))}px`, this.element.style.top = `${String(Math.max(0, c))}px`;
	}
	hide() {
		this.element.style.display = "none";
	}
	destroy() {
		this.element.remove();
	}
};
//#endregion
export { n as ChartTooltip };

//# sourceMappingURL=tooltip.js.map