vue-data-ui
Version:
A user-empowering data visualization Vue 3 components library for eloquent data storytelling
1,561 lines • 52.8 kB
JavaScript
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
import { $ as t, D as n, Gt as r, Jt as i, Kt as a, Ot as o, Pt as s, S as c, W as l, X as u, Y as d, i as f, jt as p, q as m, r as h, t as g, tt as _, w as ee, xt as te } from "./lib-Bttd6u5E.js";
import { n as ne, t as re } from "./useHints-Dq_w2E8B.js";
import { t as ie } from "./useConfig-D3scuR88.js";
import { t as ae } from "./usePrinter-DN5bYhTG.js";
import { n as oe, t as se } from "./BaseScanner-DZvpgOjM.js";
import { t as ce } from "./useSvgExport-DH-FfcqQ.js";
import { t as le } from "./useNestedProp-vPNvh7rV.js";
import { t as ue } from "./useThemeCheck-C43Tcqmk.js";
import { t as de } from "./useTransitions-g_zBREk2.js";
import { t as fe } from "./img-Bnokohej.js";
import { n as pe } from "./Title-BE3qg9xl.js";
import { t as me } from "./_plugin-vue_export-helper-B3ysoDQm.js";
import { l as he, t as ge } from "./useResponsive-ZtArZtUf.js";
import { t as _e } from "./DefGrad-DVBqDjhO.js";
import { t as ve } from "./A11yDataTable-DdRsVULz.js";
import { t as ye } from "./useUserOptionState-DK-_1ddE.js";
import { t as be } from "./useChartAccessibility-DYqac8yF.js";
import { t as xe } from "./usePanZoom-CYU3B4T3.js";
import { t as Se } from "./vue_ui_circle_pack-DZC_rdfn.js";
import { Fragment as v, computed as y, createBlock as b, createCommentVNode as x, createElementBlock as S, createElementVNode as C, createSlots as Ce, createTextVNode as we, createVNode as Te, defineAsyncComponent as w, guardReactiveProps as T, mergeProps as Ee, nextTick as De, normalizeClass as E, normalizeProps as D, normalizeStyle as Oe, onBeforeUnmount as ke, onMounted as Ae, openBlock as O, ref as k, renderList as je, renderSlot as A, resolveDynamicComponent as Me, toDisplayString as j, toRefs as Ne, unref as M, useCssVars as Pe, watch as Fe, withCtx as N } from "vue";
//#region src/packCircles.js
function Ie(e, t = 0) {
let n = e.reduce((e, { x: n, r }) => Math.min(e, n - r - t), Infinity), r = e.reduce((e, { x: n, r }) => Math.max(e, n + r + t), -Infinity), i = e.reduce((e, { y: n, r }) => Math.min(e, n - r - t), Infinity), a = e.reduce((e, { y: n, r }) => Math.max(e, n + r + t), -Infinity);
return [
n,
i,
r - n,
a - i
];
}
function Le(e, t, n) {
let r = e._, i = e.next._, a = r.r + i.r, o = (r.x * i.r + i.x * r.r) / a, s = (r.y * i.r + i.y * r.r) / a;
return Math.max(Math.abs(o * n), Math.abs(s * t));
}
function Re(e, t, n) {
let r = Le, i = e.length;
if (!i) return e;
e.sort((e, t) => t.r - e.r);
let a, o, s;
if (a = e[0], a.x = 0, a.y = 0, !(i > 1)) return e;
if (o = e[1], a.x = -o.r, o.x = a.r, o.y = 0, !(i > 2)) return Be(e, n, t), e;
ze(o, a, s = e[2]), a = new qe(a), o = new qe(o), s = new qe(s), a.next = s.previous = o, o.next = a.previous = s, s.next = o.previous = a;
packLoop: for (let c = 3; c < i; ++c) {
ze(a._, o._, s = e[c]), s = new qe(s);
let i = o.next, l = a.previous, u = o._.r, d = a._.r;
do
if (u <= d) {
if (P(i._, s._)) {
o = i, a.next = o, o.previous = a, --c;
continue packLoop;
}
u += i._.r, i = i.next;
} else {
if (P(l._, s._)) {
a = l, a.next = o, o.previous = a, --c;
continue packLoop;
}
d += l._.r, l = l.previous;
}
while (i !== l.next);
s.previous = a, s.next = o, a.next = o.previous = o = s;
let f = a, p = r(a, n, t), m = a.next;
for (; m !== o;) {
let e = r(m, n, t);
e < p && (f = m, p = e), m = m.next;
}
a = f, o = a.next;
}
return Be(e, n, t), Ue(e, n, t), e;
}
function ze(e, t, n) {
let r = e.x - t.x, i = e.y - t.y, a = r * r + i * i;
if (a) {
let o = (t.r + n.r) ** 2, s = (e.r + n.r) ** 2;
if (o > s) {
let t = (a + s - o) / (2 * a), c = Math.sqrt(Math.max(0, s / a - t * t));
n.x = e.x - t * r - c * i, n.y = e.y - t * i + c * r;
} else {
let e = (a + o - s) / (2 * a), c = Math.sqrt(Math.max(0, o / a - e * e));
n.x = t.x + e * r - c * i, n.y = t.y + e * i + c * r;
}
} else n.x = t.x + n.r, n.y = t.y;
}
function P(e, t) {
let n = e.r + t.r - 1e-6, r = t.x - e.x, i = t.y - e.y;
return n > 0 && n * n > r * r + i * i;
}
function Be(e, t, n) {
if (e.length < 4) return;
let r = e[0].r, i = e.findIndex((e) => e.r < r * .6), a = i === -1 ? Math.min(e.length, 12) : i, o = e.slice(0, Math.max(3, a));
for (let t = 0; t < 80; t += 1) {
let t = !1;
for (let n = 0; n < o.length; n += 1) {
let r = o[n], i = .06 * (1 - n / Math.max(1, o.length)), a = r.x * (1 - i), s = r.y * (1 - i);
Ve(r, a, s, e, n) && (r.x = a, r.y = s, t = !0);
}
if (He(o), !t) break;
}
let s = o.reduce((e, t) => e + t.x, 0) / o.length, c = o.reduce((e, t) => e + t.y, 0) / o.length;
for (let t of e) t.x -= s, t.y -= c;
}
function Ve(e, t, n, r) {
let i = e.x, a = e.y;
e.x = t, e.y = n;
for (let t of r) if (t !== e && P(e, t)) return e.x = i, e.y = a, !1;
return e.x = i, e.y = a, !0;
}
function He(e) {
for (let t = 0; t < 6; t += 1) {
let t = !1;
for (let n = 0; n < e.length - 1; n += 1) for (let r = n + 1; r < e.length; r += 1) {
let i = e[n], a = e[r], o = a.x - i.x, s = a.y - i.y, c = Math.sqrt(o * o + s * s) || 1e-6, l = i.r + a.r;
if (c < l) {
let e = (l - c) / 2, n = o / c, r = s / c;
i.x -= n * e, i.y -= r * e, a.x += n * e, a.y += r * e, t = !0;
}
}
if (!t) break;
}
}
function Ue(e, t, n) {
if (e.length < 6) return;
let r = e[0].r, i = e.findIndex((e) => e.r <= r * .45);
if (i !== -1) for (let r = i; r < e.length; r += 1) {
let i = e[r], a = We(i, e.slice(0, r), t, n);
a && (i.x = a.x, i.y = a.y);
}
}
function We(e, t, n, r) {
if (t.length < 2) return null;
let i = null, a = Infinity;
for (let o = 0; o < t.length - 1; o += 1) for (let s = o + 1; s < t.length; s += 1) {
let c = t[o], l = t[s], u = Ge(c, l, e.r);
for (let o of u) {
if (!o) continue;
let s = {
...e,
x: o.x,
y: o.y
};
if (!F(s, t)) continue;
let c = Ke(s, t, n, r);
c < a && (a = c, i = o);
}
}
return i;
}
function Ge(e, t, n) {
let r = e.r + n, i = t.r + n, a = t.x - e.x, o = t.y - e.y, s = a * a + o * o, c = Math.sqrt(s);
if (!c || c > r + i || c < Math.abs(r - i)) return [];
let l = (r * r - i * i + s) / (2 * c), u = r * r - l * l;
if (u < 0) return [];
let d = Math.sqrt(u), f = a / c, p = o / c, m = e.x + l * f, h = e.y + l * p, g = -p * d, _ = f * d;
return [{
x: m + g,
y: h + _
}, {
x: m - g,
y: h - _
}];
}
function F(e, t) {
for (let n of t) if (P(n, e)) return !1;
return !0;
}
function Ke(e, t, n, r) {
let i = e.x / Math.max(1, n), a = e.y / Math.max(1, r), o = i * i + a * a, s = [];
for (let n of t) {
let t = e.x - n.x, r = e.y - n.y, i = Math.sqrt(t * t + r * r) - (e.r + n.r);
s.push(i);
}
s.sort((e, t) => e - t);
let c = s[0] ?? 0, l = s[1] ?? c, u = s[2] ?? l;
return c * 8 + l * 4 + u * 2 + o * e.r * 12;
}
var qe = class {
constructor(e) {
this._ = e, this.next = null, this.previous = null;
}
}, Je = /* @__PURE__ */ e({ default: () => ht }), Ye = ["id"], Xe = ["id"], Ze = [
"xmlns",
"aria-describedby",
"viewBox"
], Qe = [
"x",
"y",
"width",
"height"
], $e = { key: 0 }, et = [
"x",
"y",
"width",
"height",
"stroke",
"stroke-width",
"fill",
"rx",
"onMouseenter",
"onMouseout",
"onClick"
], tt = [
"x",
"y",
"width",
"height",
"stroke",
"stroke-width",
"fill",
"rx"
], nt = [
"x",
"y",
"width",
"height",
"fill",
"rx"
], rt = [
"transform",
"font-size",
"fill",
"font-weight"
], it = [
"transform",
"font-size",
"fill",
"font-weight"
], at = {
key: 1,
style: { pointerEvents: "none" }
}, ot = [
"stroke",
"stroke-width",
"stroke-dasharray",
"opacity",
"d"
], st = [
"x",
"y",
"width",
"height",
"rx",
"ry",
"fill",
"stroke",
"stroke-width",
"filter"
], ct = [
"fill",
"x",
"y",
"rx",
"width",
"height"
], lt = [
"transform",
"font-size",
"fill",
"font-family"
], ut = ["dy"], dt = {
key: 0,
style: {
position: "absolute",
top: "100%",
left: "0",
width: "100%"
},
"data-dom-to-png-ignore": "",
"aria-hidden": "true"
}, ft = {
key: 5,
class: "vue-data-ui-watermark"
}, pt = {
key: 6,
"data-dom-to-png-ignore": "",
class: "reset-wrapper"
}, mt = ["innerHTML"], ht = /*#__PURE__*/ me({
__name: "vue-ui-circle-pack",
props: {
config: {
type: Object,
default() {
return {};
}
},
dataset: {
type: Array,
default() {
return [];
}
}
},
emits: ["selectDatapoint", "copyAlt"],
setup(e, { expose: me, emit: Le }) {
Pe((e) => ({ b4e89302: cr.value }));
let ze = w(() => import("./Tooltip-DhjyfHwz.js")), P = w(() => import("./BaseIcon-BfndwIWE.js").then((e) => e.n)), Be = w(() => import("./vue-ui-accordion-BxGriZik.js").then((e) => e.n)), Ve = w(() => import("./DataTable-BbKgJ5UI.js")), He = w(() => import("./UserOptions-Dt98of5H.js").then((e) => e.n)), Ue = w(() => import("./PenAndPaper-DAE-tnEQ.js").then((e) => e.t)), We = w(() => import("./PackageVersion-D6d8SCp9.js").then((e) => e.t)), Ge = w(() => import("./BaseDraggableDialog-LoqqwRtV.js").then((e) => e.n)), F = e, Ke = Le, { vue_ui_circle_pack: qe } = ie(), { isThemeValid: Je, warnInvalidTheme: ht } = ue(), gt = y(() => !!F.dataset && F.dataset.length), I = k(m()), L = k(null), _t = k(null), vt = k(null), yt = k(0), bt = k(0), xt = k(0), St = k(null), R = k(null), Ct = k(null), wt = k(!1), Tt = k(""), z = k(null), Et = k(!1), Dt = k(!1), B = k(null), Ot = k({
x: 0,
y: 0
}), kt = k("pointer"), At = k(!1), V = k(Lt());
ne({
config: () => V.value,
dataset: () => F.dataset,
component: "VueUiCirclePack",
rules: [
re.emptyArray,
{
test: (e) => e.length === 1 && (!e[0].children || e[0]?.children.length === 0),
message: [
"👀 The dataset only has a single series. Consider:",
"",
"▶️ Using a value display instead of a chart component, or using VueUiKpi."
]
},
{
test: (e) => e.length === 1 && e[0]?.children && e[0]?.children.length < 6,
message: [
"👀 The number of datapoints is probably too low for this type of chart. Consider:",
"",
"▶️ Using VueUiDonut or VueUiWaffle instead."
]
}
]
});
let { transitionEnabled: H } = de({
config: () => V.value.transitions,
dataset: () => F.dataset
}), U = y(() => V.value.userOptions.useCursorPointer), jt = y(() => i({
defaultConfig: {
userOptions: { show: !1 },
table: { show: !1 },
style: { chart: {
backgroundColor: "#99999930",
circles: {
stroke: "#6A6A6A",
labels: {
name: { show: !1 },
value: { show: !1 }
}
}
} }
},
userConfig: V.value.skeletonConfig ?? {}
})), { loading: Mt, FINAL_DATASET: Nt } = oe({
...Ne(F),
FINAL_CONFIG: V,
prepareConfig: Lt,
skeletonDataset: F.config?.skeletonDataset ?? [
{
name: "_",
value: 13,
color: "#F2F2F2"
},
{
name: "_",
value: 8,
color: "#DBDBDB"
},
{
name: "_",
value: 5,
color: "#ADADAD"
},
{
name: "_",
value: 3,
color: "#969696"
},
{
name: "_",
value: 2,
color: "#808080"
},
{
name: "_",
value: 1,
color: "#696969"
}
],
skeletonConfig: i({
defaultConfig: V.value,
userConfig: jt.value
})
}), { svgRef: W } = be({ config: V.value.style.chart.title }), { userOptionsVisible: Pt, setUserOptionsVisibility: Ft, keepUserOptionState: It } = ye({ config: V.value });
function Lt() {
let e = le({
userConfig: F.config,
defaultConfig: qe
}), t = e.theme;
if (!t) return e;
if (!Je.value(e)) return ht(e), e;
let n = le({
userConfig: Se[t] || F.config,
defaultConfig: e
}), r = le({
userConfig: F.config,
defaultConfig: n
});
return {
...r,
customPalette: r.customPalette.length ? r.customPalette : a[t] || s
};
}
Fe(() => F.config, (e) => {
V.value = Lt(), Pt.value = !V.value.userOptions.showOnChartHover, sn(), yt.value += 1, bt.value += 1, G.value.showTable = V.value.table.show, G.value.showTooltip = V.value.style.chart.tooltip.show, G.value.showZoom = V.value.style.chart.zoom?.show ?? !1;
}, { deep: !0 });
let { isPrinting: Rt, isImaging: zt, generatePdf: Bt, generateImage: Vt } = ae({
elementId: `vue-ui-circle-pack_${I.value}`,
fileName: V.value.style.chart.title.text || "vue-ui-circle-pack",
options: V.value.userOptions.print
}), Ht = y(() => V.value.userOptions.show && !V.value.style.chart.title.text), G = k({
showTable: V.value.table.show,
showTooltip: V.value.style.chart.tooltip.show,
showZoom: V.value.style.chart.zoom?.show ?? !1
});
Fe(V, () => {
G.value = {
showTable: V.value.table.show,
showTooltip: V.value.style.chart.tooltip.show,
showZoom: V.value.style.chart.zoom?.show ?? !1
};
}, { immediate: !0 });
let K = k({
h: 10,
w: 10
}), Ut = k([
0,
0,
100,
100
]), Wt = k({
x: 0,
y: 0,
width: 100,
height: 100
}), Gt = y(() => V.value.debug), Kt = y(() => {
let e = V.value.style?.chart || {};
return e.dimensions && typeof e.dimensions.width == "number" ? e.dimensions.width : typeof e.width == "number" ? e.width : 300;
}), qt = y(() => {
let e = V.value.style?.chart || {};
return e.dimensions && typeof e.dimensions.height == "number" ? e.dimensions.height : typeof e.height == "number" ? e.height : 300;
}), q = k([]), J = k([]), Y = k(null), X = k(null);
function Jt(e, t) {
K.value = {
w: e,
h: t
};
let n = ln.value.map(Yt);
if (!n.length) {
let n = {
x: 0,
y: 0,
width: e,
height: t
};
q.value = [], J.value = [], Ut.value = [
n.x,
n.y,
n.width,
n.height
], Wt.value = { ...n }, Tn(n);
return;
}
let r = Re(n, t, e), [i, a, o, s] = Ie(r, 1), c = Math.min(o ? e / o : 1, s ? t / s : 1), l = (e - o * c) / 2, u = (t - s * c) / 2, d = r.map((e) => ({
...e,
x: (e.x - i) * c + l,
y: (e.y - a) * c + u,
r: e.r * c
}));
q.value = tn(d), J.value = q.value;
let f = In({
x: 0,
y: 0,
width: e,
height: t
});
Ut.value = [
f.x,
f.y,
f.width,
f.height
], Wt.value = { ...f }, Tn(f);
}
function Yt(e) {
return {
...e,
children: Array.isArray(e.children) ? e.children.map(Yt) : []
};
}
function Xt(e) {
let t = Number(e?.value);
return Number.isFinite(t) && t > 0 ? t : Array.isArray(e?.children) ? e.children.reduce((e, t) => e + Xt(t), 0) : 0;
}
function Zt(e, t) {
let n = a[V.value.theme || "default"] || s, r = cn.value.length ? cn.value : n.length ? n : s;
return c(e.color) || r[t % r.length] || s[t % s.length];
}
function Qt(e) {
return !Array.isArray(e.children) || !e.children.length ? 1 : e.children.reduce((e, t) => e + Qt(t), 0);
}
function $t(e, t = null, n = 0, r = []) {
return Array.isArray(e) ? e.map((e, i) => {
let a = Xt(e);
if (!Number.isFinite(a) || a <= 0) return null;
let o = m(), s = [...r, i], l = s.reduce((e, t, n) => e + t + n, 0), u = e.color || t?.color ? c(e.color || t?.color) : Zt(e, l), d = $t(e.children, {
id: o,
name: e.name,
color: u,
rootId: t?.rootId ?? o
}, n + 1, s);
return {
...e,
value: a,
r: a,
id: o,
color: u,
depth: n,
parentId: t?.id ?? null,
parentName: t?.name ?? null,
rootId: t?.rootId ?? o,
hasChildren: d.length > 0,
childCount: d.length,
leafCount: d.length ? Qt({ children: d }) : 1,
hierarchyPath: s,
children: d
};
}).filter(Boolean) : [];
}
function en(e) {
if (!Array.isArray(e.children) || !e.children.length) return [];
let t = e.r * 2;
if (!t) return [];
let n = Re(e.children.map(Yt), t, t), [r, i, a, o] = Ie(n, 1), s = Math.min(a ? t / a : 1, o ? t / o : 1) * .9, c = a * s, l = o * s, u = e.x - c / 2, d = e.y - l / 2;
return n.map((e) => ({
...e,
x: (e.x - r) * s + u,
y: (e.y - i) * s + d,
r: e.r * s
}));
}
function tn(e) {
let t = [];
return e.forEach((e) => {
let n = en(e);
t.push({
...e,
children: n
}), t.push(...tn(n));
}), t;
}
function nn(e, t) {
return !e || !t || !Array.isArray(e.hierarchyPath) || !Array.isArray(t.hierarchyPath) || e.hierarchyPath.length <= t.hierarchyPath.length ? !1 : t.hierarchyPath.every((t, n) => e.hierarchyPath[n] === t);
}
function rn(e) {
return e.hasChildren ? V.value.style.chart.circles.labels.parents.show : V.value.style.chart.circles.labels.children.show;
}
function an() {
if (!V.value.responsive || !L.value) return;
let e = he(() => {
let { width: e, height: t } = ge({
chart: L.value,
title: V.value.style.chart.title.text ? _t.value : null,
legend: null,
source: St.value,
noTitle: vt.value
});
requestAnimationFrame(() => {
!e || !t || (W.value && (W.value.setAttribute("width", e), W.value.setAttribute("height", t)), Jt(e, t));
});
});
Y.value && (X.value && Y.value.unobserve(X.value), Y.value.disconnect()), Y.value = new ResizeObserver(e), X.value = L.value.parentNode || L.value, X.value && Y.value.observe(X.value), e();
}
function on() {
Y.value && (X.value && Y.value.unobserve(X.value), Y.value.disconnect(), Y.value = null, X.value = null);
}
async function sn() {
p(F.dataset) && _({
componentName: "VueUiCirclePack",
type: "dataset",
debug: Gt.value
});
let e = Kt.value, t = qt.value;
Jt(e, t), V.value.responsive ? an() : on();
}
Ae(sn), ke(() => {
on();
}), Fe(() => Nt.value, async (e) => {
await sn();
}, { deep: !0 });
let cn = y(() => ee(V.value.customPalette)), ln = y(() => $t(Nt.value)), un = y(() => q.value.length ? Math.max(...q.value.map((e) => e.r)) : 0);
function dn(e, t) {
return un.value ? t / un.value * e : 0;
}
function fn(e, t) {
V.value.events.datapointLeave && V.value.events.datapointLeave({
datapoint: e,
seriesIndex: t
}), (kt.value !== "keyboard" || z.value?.id !== e?.id) && (wt.value = !1, z.value = null, B.value = null, kt.value = "pointer");
}
function pn(e, t) {
Ke("selectDatapoint", e), V.value.events.datapointClick && V.value.events.datapointClick({
datapoint: e,
seriesIndex: t
});
}
let mn = k(null), hn = k(!1);
function gn(e, t, n = "pointer") {
z.value = e, B.value = t, kt.value = n, V.value.events.datapointEnter && V.value.events.datapointEnter({
datapoint: e,
seriesIndex: t
}), mn.value = {
datapoint: e,
seriesIndex: t,
config: V.value,
series: J.value
}, wt.value = !0;
let r = V.value.style.chart.tooltip.customFormat;
if (hn.value = !1, te(r)) try {
let n = r({
seriesIndex: t,
datapoint: e,
series: J.value,
config: V.value
});
typeof n == "string" && (Tt.value = n, hn.value = !0);
} catch {
console.warn("Custom format cannot be applied."), hn.value = !1;
}
if (!hn.value) {
let t = "";
t += `
<div style="display:flex;align-items:center;gap:4px;">
<svg viewBox="0 0 10 10" height="${V.value.style.chart.tooltip.fontSize}" width="${V.value.style.chart.tooltip.fontSize}">
<circle
cx="5"
cy="5"
r="5"
fill="${V.value.style.chart.circles.gradient.show ? `url(#${e.id})` : e.color}"
/>
</svg>
<span>${e.name}: <b>${_n(e)}</b></span>
</div>
`, Tt.value = t;
}
}
function _n(e) {
return f(V.value.style.chart.circles.labels.value.formatter, e.value, u({
p: V.value.style.chart.circles.labels.value.prefix,
v: e.value,
s: V.value.style.chart.circles.labels.value.suffix,
r: V.value.style.chart.circles.labels.value.rounding
}));
}
function vn(e) {
if (!e) return 0;
let t = _n(e), n = e.r / (t.length || 1) * (t.length === 1 ? 1 : 2);
return Math.min(e.r / 2.5, n);
}
let Z = k(!1);
function yn(e) {
Z.value = e, xt.value += 1;
}
let bn = k(!1);
function xn() {
bn.value = !bn.value;
}
let Sn = y(() => !bn.value && G.value.showZoom), { viewBox: Q, resetZoom: Cn, isZoom: wn, setInitialViewBox: Tn } = xe(W, {
x: 0,
y: 0,
width: Math.max(10, K.value.w),
height: Math.max(10, K.value.h)
}, V.value.style.chart.zoom?.speed ?? 1, Sn);
function En(e, t, n = 0) {
return !(e.x + e.width + n < t.x || t.x + t.width + n < e.x || e.y + e.height + n < t.y || t.y + t.height + n < e.y);
}
function Dn(e, t, n = 0) {
let r = Math.min(Math.max(t.x, e.x - n), e.x + e.width + n), i = Math.min(Math.max(t.y, e.y - n), e.y + e.height + n), a = t.x - r, o = t.y - i;
return a * a + o * o <= t.r * t.r;
}
function On(e, t, n = 1) {
let r = Math.max(4 * n, Math.min(t.width, t.height) * .01);
return {
...e,
x: Math.min(Math.max(e.x, t.x + r), t.x + t.width - e.width - r),
y: Math.min(Math.max(e.y, t.y + r), t.y + t.height - e.height - r)
};
}
function kn(e) {
let t = [e.name];
return V.value.style.chart.circles.labels.value.show && t.push(_n(e)), t.filter(Boolean);
}
function An(e, t, n, r, i) {
let a = e.x, o = e.y;
return {
right: {
x: a + e.r + i,
y: o - n / 2,
anchorX: a + e.r,
anchorY: o
},
left: {
x: a - e.r - i - t,
y: o - n / 2,
anchorX: a - e.r,
anchorY: o
},
top: {
x: a - t / 2,
y: o - e.r - i - n,
anchorX: a,
anchorY: o - e.r
},
bottom: {
x: a - t / 2,
y: o + e.r + i,
anchorX: a,
anchorY: o + e.r
},
topRight: {
x: a + e.r * .7 + i,
y: o - e.r * .7 - i - n,
anchorX: a + e.r * .7,
anchorY: o - e.r * .7
},
topLeft: {
x: a - e.r * .7 - i - t,
y: o - e.r * .7 - i - n,
anchorX: a - e.r * .7,
anchorY: o - e.r * .7
},
bottomRight: {
x: a + e.r * .7 + i,
y: o + e.r * .7 + i,
anchorX: a + e.r * .7,
anchorY: o + e.r * .7
},
bottomLeft: {
x: a - e.r * .7 - i - t,
y: o + e.r * .7 + i,
anchorX: a - e.r * .7,
anchorY: o + e.r * .7
}
}[r];
}
function jn(e, t) {
let n = [], r = t.get(e.parentId);
for (; r;) n.push(r), r = t.get(r.parentId);
return n;
}
function Mn(e, t, n, r, i, a) {
let o = e.x, s = e.y, c = t || e, l = a * .6, u = {
right: {
x: c.x + c.r + a,
y: s - r / 2
},
left: {
x: c.x - c.r - a - n,
y: s - r / 2
},
top: {
x: o - n / 2,
y: c.y - c.r - a - r
},
bottom: {
x: o - n / 2,
y: c.y + c.r + a
},
topRight: {
x: c.x + c.r + a,
y: c.y - c.r - a - r - l
},
topLeft: {
x: c.x - c.r - a - n,
y: c.y - c.r - a - r - l
},
bottomRight: {
x: c.x + c.r + a,
y: c.y + c.r + a + l
},
bottomLeft: {
x: c.x - c.r - a - n,
y: c.y + c.r + a + l
}
}[i], d = u.x + n / 2, f = u.y + r / 2, p = Math.atan2(f - s, d - o);
return {
...u,
anchorX: o + Math.cos(p) * e.r,
anchorY: s + Math.sin(p) * e.r
};
}
function Nn(e, t = {}) {
let { clamp: n = !0, scale: r = 1 } = t;
if (!q.value.length || !K.value.w || !K.value.h || !V.value.style.chart.parentTooltips.show) return [];
let i = Math.max(8, V.value.style.chart.parentTooltips.fontSizeRatio * 10) * r, a = i * 1.25, o = i * .75, s = i * .55, c = Math.max(8 * r, Math.min(e.width, e.height) * .025), l = Math.max(2 * r, Math.min(e.width, e.height) * .006), u = [
"right",
"left",
"top",
"bottom",
"topRight",
"topLeft",
"bottomRight",
"bottomLeft"
], d = [], f = new Map(q.value.map((e) => [e.id, e]));
return q.value.filter((e) => e.hasChildren && e.name).sort((e, t) => t.r - e.r).forEach((t) => {
let p = jn(t, f).at(-1), m = kn(t), h = m.reduce((e, t) => Math.max(e, String(t).length), 0), g = Math.max(i * 5, h * i * .62 + o * 2), _ = m.length * a + s * 2, ee = p ? u.map((e) => Mn(t, p, g, _, e, c)) : [], te = u.map((e) => An(t, g, _, e, c)), ne = [...ee, ...te].map((t) => {
let i = n ? On({
x: t.x,
y: t.y,
width: g,
height: _
}, e, r) : {
x: t.x,
y: t.y,
width: g,
height: _
};
return {
...i,
anchorX: t.anchorX,
anchorY: t.anchorY,
lineX: i.x + i.width / 2,
lineY: i.y + i.height / 2
};
}).find((e) => !d.some((t) => En(e, t, l)) && !q.value.some((t) => Dn(e, t, l)));
ne && d.push({
...ne,
datapoint: t,
id: `parent_tooltip_${t.id}`,
color: t.color,
lines: m,
fontSize: i,
lineHeight: a,
paddingX: o,
paddingY: s,
scale: r
});
}), d;
}
function Pn(e) {
let t = Wt.value;
if (!t.width || !t.height || !e.width || !e.height) return 1;
let n = Math.min(e.width / t.width, e.height / t.height);
return Number.isFinite(n) && n > 0 ? n : 1;
}
let Fn = y(() => Nn(Q.value, {
clamp: !0,
scale: Pn(Q.value)
}));
function In(e) {
let t = Nn(e, { clamp: !1 });
if (!t.length) return e;
let n = Math.min(e.x, ...t.map((e) => e.x)), r = Math.min(e.y, ...t.map((e) => e.y)), i = Math.max(e.x + e.width, ...t.map((e) => e.x + e.width)), a = Math.max(e.y + e.height, ...t.map((e) => e.y + e.height)), o = Math.max(8, Math.min(e.width, e.height) * .025);
return {
x: n - o,
y: r - o,
width: i - n + o * 2,
height: a - r + o * 2
};
}
function Ln(e) {
let t = [];
function n(e, r = 0, i = "") {
e.forEach((e) => {
t.push({
name: e.name,
value: e.value,
color: e.color,
parentName: i,
depth: r
}), Array.isArray(e.children) && e.children.length && n(e.children, r + 1, e.name);
});
}
return n(e), t;
}
let Rn = y(() => {
let e = Ln(ln.value);
return {
head: J.value.map((e) => ({
name: e.name,
value: e.value,
color: e.color
})).toSorted((e, t) => t.value - e.value),
body: e.map((e) => e.value),
hierarchy: e
};
}), zn = y(() => Ln(ln.value).map((e) => ({
...e,
name: `${"- ".repeat(e.depth)}${e.name}`
})));
function Bn(e = null) {
De(() => {
let r = zn.value.map((e) => [
[e.name],
[e.parentName || ""],
[e.depth],
[e.value]
]), i = [
[V.value.style.chart.title.text],
[V.value.style.chart.title.subtitle.text],
[
[V.value.table.columnNames.datapoint],
["Parent"],
["Depth"],
[V.value.table.columnNames.value]
]
].concat(r), a = n(i);
e ? e(a) : t({
csvContent: a,
title: V.value.style.chart.title.text || "vue-ui-circle-pack"
});
});
}
let $ = y(() => {
let e = [
V.value.table.columnNames.datapoint,
V.value.table.columnNames.parent,
V.value.table.columnNames.depth,
V.value.table.columnNames.value
], t = Rn.value.hierarchy.map((e) => {
let t = u({
p: V.value.style.chart.circles.labels.value.prefix,
v: e.value,
s: V.value.style.chart.circles.labels.value.suffix,
r: V.value.style.chart.circles.labels.value.rounding
});
return [
{
color: e.color,
name: `${" ".repeat(e.depth)}${e.name}`
},
e.parentName ?? "",
e.depth ?? 0,
t
];
}), n = {
th: {
backgroundColor: V.value.table.th.backgroundColor,
color: V.value.table.th.color,
outline: V.value.table.th.outline
},
td: {
backgroundColor: V.value.table.td.backgroundColor,
color: V.value.table.td.color,
outline: V.value.table.td.outline
},
breakpoint: V.value.table.responsiveBreakpoint
};
return {
colNames: [
V.value.table.columnNames.datapoint,
V.value.table.columnNames.parent,
V.value.table.columnNames.depth,
V.value.table.columnNames.value
],
head: e,
body: t,
config: n
};
});
function Vn() {
G.value.showTable = !G.value.showTable;
}
function Hn() {
G.value.showTooltip = !G.value.showTooltip;
}
function Un() {
G.value.showZoom = !G.value.showZoom;
}
function Wn() {
return ln.value;
}
async function Gn({ scale: e = 2 } = {}) {
if (!L.value) return;
let { width: t, height: n } = L.value.getBoundingClientRect(), r = t / n, { imageUri: i, base64: a } = await fe({
domElement: L.value,
base64: !0,
img: !0,
scale: e
});
return {
imageUri: i,
base64: a,
title: V.value.style.chart.title.text,
width: t,
height: n,
aspectRatio: r
};
}
let Kn = y(() => {
let e = V.value.table.useDialog && !V.value.table.show, t = G.value.showTable;
return {
component: e ? Ge : Be,
title: `${V.value.style.chart.title.text}${V.value.style.chart.title.subtitle.text ? `: ${V.value.style.chart.title.subtitle.text}` : ""}`,
props: e ? {
backgroundColor: V.value.table.th.backgroundColor,
color: V.value.table.th.color,
headerColor: V.value.table.th.color,
headerBg: V.value.table.th.backgroundColor,
isFullscreen: Z.value,
fullscreenParent: L.value,
forcedWidth: Math.min(500, window.innerWidth * .8),
isCursorPointer: U.value
} : {
hideDetails: !0,
config: {
open: t,
maxHeight: 1e4,
body: {
backgroundColor: V.value.style.chart.backgroundColor,
color: V.value.style.chart.color
},
head: {
backgroundColor: V.value.style.chart.backgroundColor,
color: V.value.style.chart.color
}
}
}
};
});
Fe(() => G.value.showTable, (e) => {
V.value.table.show || (e && V.value.table.useDialog && R.value ? R.value.open() : R.value && "close" in R.value && R.value.close());
});
function qn() {
G.value.showTable = !1, Ct.value && Ct.value.setTableIconState(!1);
}
let Jn = y(() => V.value.style.chart.backgroundColor), Yn = y(() => V.value.style.chart.title), { exportSvg: Xn, getSvg: Zn } = ce({
svg: W,
title: Yn,
backgroundColor: Jn
});
async function Qn({ isCb: e }) {
Dt.value = !0, await De();
try {
if (e) {
let { blob: e, url: t, text: n, dataUrl: r } = await Zn();
await Promise.resolve(V.value.userOptions.callbacks.svg({
blob: e,
url: t,
text: n,
dataUrl: r
}));
} else await Promise.resolve(Xn());
} finally {
Dt.value = !1;
}
}
function $n(e) {
if (e?.stage === "start") {
Et.value = !0;
return;
}
if (e?.stage === "end") {
Et.value = !1;
return;
}
Vt();
}
async function er() {
if (Ke("copyAlt", {
config: V.value,
dataset: ln.value,
flattenedDataset: J.value
}), !V.value.userOptions.callbacks.altCopy) {
console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions.");
return;
}
await Promise.resolve(V.value.userOptions.callbacks.altCopy({
config: V.value,
dataset: ln.value,
flattenedDataset: J.value
}));
}
function tr(e) {
if (!Number.isFinite(e) || !W.value) return;
let t = q.value[e];
if (!t) return;
let n = r(t.x, t.y, W.value);
n && (Ot.value = n);
}
function nr() {
if (B.value !== null) {
let e = q.value[B.value];
e && fn(e, B.value);
}
B.value = null, kt.value = "pointer", wt.value = !1, z.value = null;
}
function rr() {
B.value = null, At.value = !0;
}
function ir() {
nr(), At.value = !1;
}
function ar(e, t) {
let n = q.value.length;
return n ? e === null || e < 0 || e >= n ? t === "next" ? 0 : n - 1 : t === "previous" ? (e - 1 + n) % n : (e + 1) % n : null;
}
function or(e) {
if (!W.value || bn.value || document.activeElement !== W.value || !q.value.length) return;
let t = ["ArrowLeft", "ArrowUp"].includes(e.key), n = ["ArrowRight", "ArrowDown"].includes(e.key), r = e.key === "Enter" || e.key === " ", i = e.key === "Escape";
if (!t && !n && !r && !i) return;
if (e.preventDefault(), e.stopPropagation(), i) {
nr();
return;
}
if (r) {
if (B.value === null) return;
let e = q.value[B.value];
if (!e) return;
pn(e, B.value);
return;
}
let a = B.value;
a === null || a < 0 || a >= q.value.length ? a = n ? 0 : q.value.length - 1 : n ? a = ar(a, "next") : t && (a = ar(a, "previous"));
let o = q.value[a];
o && (B.value = a, tr(a), gn(o, a, "keyboard"));
}
let sr = y(() => ({
headers: $.value?.colNames ?? [],
rows: $.value?.body?.map((e) => [e[0]?.name ?? "", e[1]]) ?? []
})), cr = y(() => V.value.style.chart.color);
return me({
getData: Wn,
getImage: Gn,
generateCsv: Bn,
generatePdf: Bt,
generateImage: Vt,
generateSvg: Qn,
toggleTable: Vn,
toggleAnnotator: xn,
toggleFullscreen: yn,
copyAlt: er,
toggleZoom: Un,
resetZoom: Cn
}), (e, t) => (O(), S("div", {
id: `vue-ui-circle-pack_${I.value}`,
class: E(`vue-data-ui-component vue-ui-circle-pack ${Z.value ? "vue-data-ui-wrapper-fullscreen" : ""} ${M(Mt) ? "loading" : ""}`),
ref_key: "circlePackChart",
ref: L,
style: Oe(`font-family:${V.value.style.fontFamily};text-align:center;background:${V.value.style.chart.backgroundColor};`),
onMouseenter: t[2] ||= () => M(Ft)(!0),
onMouseleave: t[3] ||= () => M(Ft)(!1)
}, [
C("div", {
id: `chart-instructions-${I.value}`,
class: "sr-only"
}, [C("p", null, j(V.value.a11y.translations.keyboardNavigation), 1)], 8, Xe),
sr.value?.rows?.length ? (O(), b(ve, {
key: 0,
uid: I.value,
head: sr.value.headers,
body: sr.value.rows,
notice: V.value.a11y.translations.tableAvailable,
caption: V.value.a11y.translations.tableCaption
}, null, 8, [
"uid",
"head",
"body",
"notice",
"caption"
])) : x("", !0),
V.value.userOptions.buttons.annotator ? (O(), b(M(Ue), {
key: 1,
svgRef: M(W),
backgroundColor: V.value.style.chart.backgroundColor,
color: V.value.style.chart.color,
active: bn.value,
scale: un.value / 100,
isCursorPointer: U.value,
onClose: xn
}, {
"annotator-action-close": N(() => [A(e.$slots, "annotator-action-close", {}, void 0, !0)]),
"annotator-action-color": N(({ color: t }) => [A(e.$slots, "annotator-action-color", D(T({ color: t })), void 0, !0)]),
"annotator-action-draw": N(({ mode: t }) => [A(e.$slots, "annotator-action-draw", D(T({ mode: t })), void 0, !0)]),
"annotator-action-undo": N(({ disabled: t }) => [A(e.$slots, "annotator-action-undo", D(T({ disabled: t })), void 0, !0)]),
"annotator-action-redo": N(({ disabled: t }) => [A(e.$slots, "annotator-action-redo", D(T({ disabled: t })), void 0, !0)]),
"annotator-action-delete": N(({ disabled: t }) => [A(e.$slots, "annotator-action-delete", D(T({ disabled: t })), void 0, !0)]),
_: 3
}, 8, [
"svgRef",
"backgroundColor",
"color",
"active",
"scale",
"isCursorPointer"
])) : x("", !0),
A(e.$slots, "userConfig", {}, void 0, !0),
Ht.value ? (O(), S("div", {
key: 2,
ref_key: "noTitle",
ref: vt,
class: "vue-data-ui-no-title-space",
style: "height:36px; width: 100%;background:transparent"
}, null, 512)) : x("", !0),
V.value.style.chart.title.text ? (O(), S("div", {
key: 3,
ref_key: "chartTitle",
ref: _t,
style: "width:100%;background:transparent;padding-bottom:12px"
}, [(O(), b(pe, {
key: `title_${yt.value}`,
config: {
title: {
cy: "donut-div-title",
...V.value.style.chart.title
},
subtitle: {
cy: "donut-div-subtitle",
...V.value.style.chart.title.subtitle
}
}
}, null, 8, ["config"]))], 512)) : x("", !0),
V.value.userOptions.show && gt.value && (M(It) || M(Pt)) ? (O(), b(M(He), {
ref_key: "userOptionsRef",
ref: Ct,
key: `user_option_${xt.value}`,
backgroundColor: V.value.style.chart.backgroundColor,
color: V.value.style.chart.color,
isPrinting: M(Rt),
isImaging: M(zt),
uid: I.value,
hasTooltip: V.value.userOptions.buttons.tooltip,
isTooltip: G.value.showTooltip,
hasLabel: !1,
hasPdf: V.value.userOptions.buttons.pdf,
hasImg: V.value.userOptions.buttons.img,
hasSvg: V.value.userOptions.buttons.svg,
hasXls: V.value.userOptions.buttons.csv,
hasTable: V.value.userOptions.buttons.table,
hasFullscreen: V.value.userOptions.buttons.fullscreen,
hasAltCopy: V.value.userOptions.buttons.altCopy,
isFullscreen: Z.value,
chartElement: L.value,
position: V.value.userOptions.position,
callbacks: V.value.userOptions.callbacks,
printScale: V.value.userOptions.print.scale,
titles: { ...V.value.userOptions.buttonTitles },
hasAnnotator: V.value.userOptions.buttons.annotator,
isAnnotation: bn.value,
tableDialog: V.value.table.useDialog,
isCursorPointer: U.value,
hasZoom: V.value.userOptions.buttons.zoom,
isZoom: G.value.showZoom,
onToggleFullscreen: yn,
onGeneratePdf: M(Bt),
onGenerateCsv: Bn,
onGenerateImage: $n,
onGenerateSvg: Qn,
onToggleTable: Vn,
onToggleTooltip: Hn,
onToggleAnnotator: xn,
onToggleZoom: Un,
onCopyAlt: er,
style: Oe({ visibility: M(It) ? M(Pt) ? "visible" : "hidden" : "visible" })
}, Ce({ _: 2 }, [
e.$slots.menuIcon ? {
name: "menuIcon",
fn: N(({ isOpen: t, color: n }) => [A(e.$slots, "menuIcon", D(T({
isOpen: t,
color: n
})), void 0, !0)]),
key: "0"
} : void 0,
e.$slots.optionTooltip ? {
name: "optionTooltip",
fn: N(() => [A(e.$slots, "optionTooltip", {}, void 0, !0)]),
key: "1"
} : void 0,
e.$slots.optionPdf ? {
name: "optionPdf",
fn: N(() => [A(e.$slots, "optionPdf", {}, void 0, !0)]),
key: "2"
} : void 0,
e.$slots.optionCsv ? {
name: "optionCsv",
fn: N(() => [A(e.$slots, "optionCsv", {}, void 0, !0)]),
key: "3"
} : void 0,
e.$slots.optionImg ? {
name: "optionImg",
fn: N(() => [A(e.$slots, "optionImg", {}, void 0, !0)]),
key: "4"
} : void 0,
e.$slots.optionSvg ? {
name: "optionSvg",
fn: N(() => [A(e.$slots, "optionSvg", {}, void 0, !0)]),
key: "5"
} : void 0,
e.$slots.optionTable ? {
name: "optionTable",
fn: N(() => [A(e.$slots, "optionTable", {}, void 0, !0)]),
key: "6"
} : void 0,
e.$slots.optionFullscreen ? {
name: "optionFullscreen",
fn: N(({ toggleFullscreen: t, isFullscreen: n }) => [A(e.$slots, "optionFullscreen", D(T({
toggleFullscreen: t,
isFullscreen: n
})), void 0, !0)]),
key: "7"
} : void 0,
e.$slots.optionAnnotator ? {
name: "optionAnnotator",
fn: N(({ toggleAnnotator: t, isAnnotator: n }) => [A(e.$slots, "optionAnnotator", D(T({
toggleAnnotator: t,
isAnnotator: n
})), void 0, !0)]),
key: "8"
} : void 0,
e.$slots.optionZoom ? {
name: "optionZoom",
fn: N(({ toggleZoom: t, isZoomLocked: n }) => [A(e.$slots, "optionZoom", D(T({
toggleZoom: t,
isZoomLocked: n
})), void 0, !0)]),
key: "9"
} : void 0,
e.$slots.optionAltCopy ? {
name: "optionAltCopy",
fn: N(({ altCopy: t }) => [A(e.$slots, "optionAltCopy", D(T({ altCopy: t })), void 0, !0)]),
key: "10"
} : void 0,
e.$slots["custom-menu-before"] ? {
name: "custom-menu-before",
fn: N(() => [A(e.$slots, "custom-menu-before", {}, void 0, !0)]),
key: "11"
} : void 0,
e.$slots["custom-menu-after"] ? {
name: "custom-menu-after",
fn: N(() => [A(e.$slots, "custom-menu-after", {}, void 0, !0)]),
key: "12"
} : void 0
]), 1032, /* @__PURE__ */ "backgroundColor.color.isPrinting.isImaging.uid.hasTooltip.isTooltip.hasPdf.hasImg.hasSvg.hasXls.hasTable.hasFullscreen.hasAltCopy.isFullscreen.chartElement.position.callbacks.printScale.titles.hasAnnotator.isAnnotation.tableDialog.isCursorPointer.hasZoom.isZoom.onGeneratePdf.style".split("."))) : x("", !0),
C("div", { class: E({
"vue-ui-circle-pack-svg-container": !0,
"not-responsive": !V.value.responsive
}) }, [(O(), S("svg", {
ref_key: "svgRef",
ref: W,
xmlns: M(g),
"aria-describedby": `chart-instructions-${I.value}`,
viewBox: `${M(Q).x} ${M(Q).y} ${M(Q).width} ${M(Q).height}`,
preserveAspectRatio: "xMidYMid meet",
class: E({
"vue-data-ui-fullscreen--on": Z.value,
"vue-data-ui-fulscreen--off": !Z.value,
"not-responsive": !V.value.responsive,
"vue-data-ui-no-transition": !M(H)
}),
style: Oe(`display:block;${V.value.responsive ? "width:100%;height:auto" : "height:100%;"};overflow:${G.value.showZoom ? "hidden" : "visible"};background:transparent;color:${V.value.style.chart.color};background:${V.value.style.chart.backgroundColor};`),
tabindex: "0",
onFocus: rr,
onBlur: ir,
onKeydown: or
}, [
Te(M(We)),
e.$slots["chart-background"] ? (O(), S("foreignObject", {
key: 0,
x: M(Q).x,
y: M(Q).y,
width: K.value.w,
height: K.value.h,
style: { pointerEvents: "none" }
}, [A(e.$slots, "chart-background", {}, void 0, !0)], 8, Qe)) : x("", !0),
(O(!0), S(v, null, je(q.value, (t, n) => (O(), S(v, { key: t.id }, [
C("defs", null, [Te(_e, {
t: "radial",
id: t.id,
fy: "30%",
stops: [
[
"10%",
M(o)(t.color, V.value.style.chart.circles.gradient.intensity / 100),
1
],
[
"90%",
M(d)(t.color, .1),
1
],
[
"100%",
t.color,
1
]
]
}, null, 8, ["id", "stops"])]),
e.$slots.pattern ? (O(), S("g", $e, [C("defs", null, [A(e.$slots, "pattern", Ee({ ref_for: !0 }, {
...t,
patternId: `pattern_${I.value}_${t.id}`
}), void 0, !0)])])) : x("", !0),
C("rect", {
class: E({ "vue-data-ui-transition": M(H) }),
x: t.x - t.r,
y: t.y - t.r,
width: t.r * 2,
height: t.r * 2,
stroke: V.value.style.chart.circles.stroke,
"vector-effect": "non-scaling-stroke",
"stroke-width": V.value.style.chart.circles.strokeWidth * (un.value || 1) / 100,
fill: V.value.style.chart.circles.gradient.show ? `url(#${t.id})` : t.color,
rx: t.r,
onMouseenter: (e) => gn(t, n, "pointer"),
onMouseout: (e) => fn(t, n),
onClick: (e) => pn(t, n)
}, null, 42, et),
e.$slots.pattern ? (O(), S("rect", {
key: 1,
class: E({ "vue-data-ui-transition": M(H) }),
x: t.x - t.r,
y: t.y - t.r,
width: t.r * 2,
height: t.r * 2,
stroke: V.value.style.chart.circles.stroke,
"vector-effect": "non-scaling-stroke",
"stroke-width": V.value.style.chart.circles.strokeWidth * (un.value || 1) / 100,
fill: `url(#pattern_${I.value}_${t.id})`,
rx: t.r,
style: { pointerEvents: "none" }
}, null, 10, tt)) : x("", !0)
], 64))), 128)),
(O(!0), S(v, null, je(q.value, (e, t) => (O(), S(v, { key: e.id }, [e.hasChildren ? x("", !0) : (O(), S("rect", {
key: 0,
class: E({ "vue-data-ui-transition": M(H) }),
x: e.x - e.r,
y: e.y - e.r,
width: e.r * 2,
height: e.r * 2,
stroke: "none",
fill: z.value && z.value.id === e.id ? V.value.style.chart.circles.gradient.show ? `url(#${e.id})` : e.color : "transparent",
rx: e.r,
style: Oe({
filter: z.value && z.value.id === e.id ? `drop-shadow(0px 0px 6px ${V.value.style.chart.circles.selectedShadowColor})` : "none",
opacity: +!!z.value,
pointerEvents: "none"
})
}, null, 14, nt))], 64))), 128)),
(O(!0), S(v, null, je(q.value, (t, n) => (O(), S(v, { key: `cl_${t.id}` }, [e.$slots["data-label"] && rn(t) ? A(e.$slots, "data-label", Ee({ ref_for: !0 }, {
...t,
createTSpans: M(l),
fontSize: {
name: t.r / 3 * V.value.style.chart.circles.labels.name.fontSizeRatio,
value: vn(t) * V.value.style.chart.circles.labels.value.fontSizeRatio
},
color: V.value.style.chart.circles.labels.name.color ? V.value.style.chart.circles.labels.name.color : M(h)(t.color)
}), void 0, !0, 0) : (O(), S(v, { key: 1 }, [V.value.style.chart.circles.labels.name.show && t.name && rn(t) ? (O(), S("text", {
key: 0,
style: { pointerEvents: "none" },
class: E({ "vue-data-ui-transition": M(H) }),
transform: `translate(${t.x}, ${t.y + dn(t.r, V.value.style.chart.circles.labels.name.offsetY) - t.r / 10})`,
"font-size": t.r / 3 * V.value.style.chart.circles.labels.name.fontSizeRatio,
fill: V.value.style.chart.circles.labels.name.color === "auto" ? M(h)(t.color) : V.value.style.chart.circles.labels.name.color,
"font-weight": V.value.style.chart.circles.labels.name.bold ? "bold" : "normal",
"text-anchor": "middle"
}, j(t.name), 11, rt)) : x("", !0), V.value.style.chart.circles.labels.value.show && rn(t) ? (O(), S("text", {
key: 1,
class: E({ "vue-data-ui-transition": M(H) }),
style: {
pointerEvents: "none",
transition: "opacity 0.2s ease-in-out"
},
transform: `translate(${t.x}, ${t.y + dn(t.r, V.value.style.chart.circles.labels.value.offsetY) + t.r / 2.5})`,
"font-size": vn(t) * V.value.style.chart.circles.labels.value.fontSizeRatio,
fill: V.value.style.chart.circles.labels.value.color === "auto" ? M(h)(t.color) : V.value.style.chart.circles.labels.value.color,
"font-weight": V.value.style.chart.circles.labels.value.bold ? "bold" : "normal",
"text-anchor": "middle"
}, j(_n(t)), 11, it)) : x("", !0)], 64)), A(e.$slots, "circle", Ee({ ref_for: !0 }, {
...t,
showLabel: rn(t),
isSelected: z.value?.id === t.id,
isDescendantOfSelected: nn(t, z.value),
uid: `${n}_${I.value}`
}), void 0, !0)], 64))), 128)),
Fn.value.length && V.value.style.chart.parentTooltips.show ? (O(), S("g", at, [(O(!0), S(v, null, je(Fn.value, (t) => (O(), S("g", { key: `tltp_${t.id}` }, [
C("path", {
class: E({ "vue-data-ui-transition": M(H) }),
stroke: V.value.style.chart.parentTooltips.link.useSerieColor ? t.color : V.value.style.chart.parentTooltips.link.stroke,
"vector-effect": "non-scaling-stroke",
"stroke-width": V.value.style.chart.parentTooltips.link.strokeWidth,
"stroke-linecap": "round",
"stroke-dasharray": V.value.style.chart.parentTooltips.link.strokeDasharray,
opacity: V.value.style.chart.parentTooltips.link.opacity,
d: `M${t.anchorX}, ${t.anchorY} ${t.lineX}, ${t.lineY}`
}, null, 10, ot),
C("rect", {
class: E({ "vue-data-ui-transition": M(H) }),
x: t.x,
y: t.y,
width: t.width,
height: t.height,
rx: Math.max(3 * t.scale, t.fontSize / 2.5) * V.value.style.chart.parentTooltips.borderRadiusRatio,
ry: Math.max(3 * t.scale, t.fontSize / 2.5) * V.value.style.chart.parentTooltips.borderRadiusRatio,
fill: V.value.style.chart.parentTooltips.backgroundColor,
stroke: V.value.style.chart.parentTooltips.useSerieColor ? t.color : V.value.style.chart.parentTooltips.stroke,
"vector-effect": "non-scaling-stroke",
"stroke-width": V.value.style.chart.parentTooltips.strokeWidth,
filter: V.value.style.chart.parentTooltips.filter
}, null, 10, st),
A(e.$slots, "parent-tooltip", Ee({ ref_for: !0 }, { ...t }), () => [C("rect", {
class: E({ "vue-data-ui-transition": M(H) }),
fill: t.color,
x: t.x + t.paddingX * 1.3 - t.fontSize * .35,
y: t.y + t.paddingY + t.lineHeight / 2 - t.fontSize * .35,
rx: t.fontSize * .35,
width: t.fontSize * .7,
height: t.fontSize * .7
}, null, 10, ct), C("text", {
class: E({ "vue-data-ui-transition": M(H) }),
transform: `translate(${t.x + t.paddingX + t.fontSize}, ${t.y + t.paddingY + t.fontSize})`,
"font-size": t.fontSize,
fill: V.value.style.chart.parentTooltips.color,
"font-family": V.value.style.fontFamily,
"text-anchor": "start"
}, [(O(!0), S(v, null, je(t.lines, (e, n) => (O(), S("tspan", {
key: `${t.id}_${n}`,
x: 0,
dy: n === 0 ? 0 : t.lineHeight
}, j(e), 9, ut))), 128))], 10, lt)], !0)
]))), 128))])) : x("", !0),
A(e.$slots, "svg", { svg: {
drawingArea: { ...M(Q) },
width: K.value.w,
height: K.value.h,
isPrintingImg: M(Rt) || M(zt) || Et.value,
isPrintingSvg: Dt.value
} }, void 0, !0)
], 46, Ze)), e.$slots.hint ? (O(), S("div", dt, [A(e.$slots, "hint", D(T({
hint: V.value.a11y.translations.keyboardNavigation,
isVisible: At.value
})), void 0, !0)])) : x("", !0)], 2),
e.$slots.watermark ? (O(), S("div", ft, [A(e.$slots, "watermark", D(T({ isPrinting: M(Rt) || M(zt) || Et.value || Dt.value })), void 0, !0)])) : x("", !0),
M(wn) ? (O(), S("div", pt, [A(e.$slots, "reset-action", { reset: M(Cn) }, () => [C("button", {
"data-cy-reset": "",
tabindex: "0",
role: "button",
class: "vue-data-ui-refresh-button",
style: Oe({
background: V.value.style.chart.backgroundColor,
cursor: U.value ? "pointer" : "default"
}),
onClick: t[0] ||= (e) => M(Cn)(!0)
}, [Te(M(P), {
name: "refresh",
stroke: V.value.style.chart.color
}, null, 8, ["stroke"])], 4)], !0)])) : x("", !0),
e.$slots.source ? (O(), S("div", {
key: 7,
ref_key: "source",
ref: St,
dir: "auto"
}, [A(e.$slots, "source", {}, void 0, !0)], 512)) : x("", !0),
Te(M(ze), {
teleportTo: V.value.style.chart.tooltip.teleportTo,
show: G.value.showTooltip && wt.value,
backgroundColor: V.value.style.chart.tooltip.backgroundColor,
color: V.value.style.chart.tooltip.color,
fontSize: V.value.style.chart.tooltip.fontSize,
borderRadius: V.value.style.chart.tooltip.borderRadius,
borderColor: V.value.style.chart.tooltip.borderColor,
borderWidth: V.value.style.chart.tooltip.borderWidth,
backgroundOpacity: V.value.style.chart.tooltip.backgroundOpacity,
position: V.value.style.chart.tooltip.position,
offsetX: V.value.style.ch