(function () { function createTip() { var tip = document.createElement("div"); tip.className = "aibui-stats-tip"; tip.style.position = "fixed"; tip.style.zIndex = "99999"; tip.style.pointerEvents = "none"; tip.style.padding = "6px 8px"; tip.style.border = "1px solid #e5e7eb"; tip.style.background = "#111827"; tip.style.color = "#fff"; tip.style.fontSize = "12px"; tip.style.borderRadius = "6px"; tip.style.boxShadow = "0 4px 14px rgba(0,0,0,.15)"; tip.style.transform = "translate(-50%, -120%)"; tip.style.whiteSpace = "nowrap"; tip.style.display = "none"; document.body.appendChild(tip); return tip; } var tipEl = createTip(); function showTip(text, x, y) { tipEl.textContent = text; tipEl.style.left = x + "px"; tipEl.style.top = y + "px"; tipEl.style.display = "block"; } function hideTip() { tipEl.style.display = "none"; } function attach(root) { root.addEventListener("pointerover", function (e) { var t = e.target; if (!(t instanceof Element)) return; var label = t.getAttribute("data-label"); var value = t.getAttribute("data-value"); if (value == null) return; var series = t.getAttribute("data-series") || ""; var parts = []; if (series) parts.push(series); if (label) parts.push(label); parts.push(value); var text = value; var rect = t.getBoundingClientRect(); showTip(text, rect.left + rect.width / 2, rect.top); }); root.addEventListener("pointermove", function (e) { if (tipEl.style.display === "none") return; showTip(tipEl.textContent, e.clientX, e.clientY - 10); }); root.addEventListener("pointerout", function (e) { hideTip(); }); } function boot() { var roots = document.querySelectorAll(".aibui-stats .aibui-stats-svg"); for (var i = 0; i < roots.length; i++) { attach(roots[i]); } } if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", boot); } else { boot(); } })();