import { computed as p, ref as b, onMounted as it, watch as He, createElementBlock as o, openBlock as a, unref as c, normalizeStyle as q, normalizeClass as P, createBlock as D, createCommentVNode as v, renderSlot as S, createSlots as ct, withCtx as F, normalizeProps as J, guardReactiveProps as Q, createVNode as vt, createElementVNode as d, Fragment as k, renderList as _, toDisplayString as m, withKeys as dt, createTextVNode as Me, nextTick as G } from "vue";
import { u as ht, o as yt, e as Z, g as ft, c as Re, t as gt, p as ee, a as bt, C as Ue, b as mt, d as de, J as xt, D as We, m as he, X as pt, s as j, E as kt, i as ye, f as te, j as Xe, k as Ge, n as le, q as _t, r as Ct, K as je } from "./index-CjXfhpMA.js";
import { _ as wt } from "./Title-BfzkycPl.js";
import { u as zt, U as Lt } from "./usePrinter-bLtFFBkj.js";
import { D as St } from "./DataTable-BfXSoPx-.js";
import { L as At } from "./Legend-ChuNykfI.js";
import $t from "./vue-ui-skeleton-B1q5j9VT.js";
import { S as Nt } from "./Slicer-j4m9EOd9.js";
import It from "./vue-ui-accordion-CEdZMQD4.js";
import { u as Be } from "./useNestedProp-CmXi5M93.js";
import { _ as Ft } from "./PackageVersion-ChIRiDpv.js";
import { P as Pt } from "./PenAndPaper-OV0eQPcd.js";
import { u as Ot } from "./useUserOptionState-BIvW1Kz7.js";
import { u as Dt } from "./useChartAccessibility-BWojgys7.js";
import { _ as Tt } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const Et = ["id"], Vt = ["xmlns", "viewBox"], Ht = ["x", "y", "width", "height"], Mt = ["id"], Rt = ["stop-color"], Ut = ["stop-color"], Wt = ["id"], Xt = ["stop-color"], Gt = ["stop-color"], jt = ["stop-color"], Bt = { key: 1 }, Yt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Kt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], qt = { key: 0 }, Jt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Qt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Zt = ["x", "y", "font-size", "fill", "font-weight"], el = ["text-anchor", "font-size", "fill", "transform"], tl = ["x1", "y1", "x2", "y2", "stroke", "stroke-width"], ll = { key: 1 }, al = ["cx", "cy", "r", "fill"], ol = { key: 0 }, ul = { key: 0 }, sl = ["d", "stroke"], nl = ["text-anchor", "x", "y", "fill"], rl = ["cx", "cy", "r", "fill"], il = { key: 0 }, cl = ["cx", "cy", "fill"], vl = { key: 1 }, dl = ["d", "fill", "stroke"], hl = { key: 2 }, yl = ["d", "fill", "stroke"], fl = ["x", "y", "font-size", "fill"], gl = ["x", "y", "width", "fill", "onClick"], bl = ["x", "y", "width", "height", "onMouseenter", "onClick"], ml = {
  key: 4,
  "data-cy-zoom": "",
  class: "vue-ui-donut-evolution-dialog"
}, xl = ["x", "y", "width", "height", "fill"], pl = ["x1", "y1", "x2", "y2", "stroke"], kl = ["x1", "y2", "x2", "y1", "stroke"], _l = ["cx", "cy", "r"], Cl = ["d", "stroke"], wl = ["cx", "cy", "r", "fill"], zl = ["d", "fill", "stroke"], Ll = { class: "vue-ui-donut-evolution-focus" }, Sl = ["text-anchor", "x", "y", "fill"], Al = ["cx", "cy", "r", "fill"], $l = ["cx", "cy", "r", "fill"], Nl = ["x", "y", "fill"], Il = ["x", "y", "font-size", "fill"], Fl = {
  key: 5,
  class: "vue-data-ui-watermark"
}, Pl = ["onClick"], Ol = { key: 0 }, Dl = { key: 1 }, Tl = {
  key: 9,
  ref: "source",
  dir: "auto"
}, El = { key: 0 }, Vl = { key: 1 }, Hl = {
  __name: "vue-ui-donut-evolution",
  props: {
    config: {
      type: Object,
      default() {
        return {};
      }
    },
    dataset: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  emits: ["selectLegend"],
  setup(Ye, { expose: Ke, emit: qe }) {
    const { vue_ui_donut_evolution: Je } = ht(), x = Ye, B = p(() => !!x.dataset && x.dataset.length), h = b({
      start: 0,
      end: Math.max(...x.dataset.map((l) => l.values.length))
    });
    function fe() {
      ge();
    }
    const V = b(null);
    async function ge() {
      (e.value.style.chart.zoom.startIndex !== null || e.value.style.chart.zoom.endIndex !== null) && V.value ? (e.value.style.chart.zoom.startIndex !== null && (await G(), await G(), V.value && V.value.setStartValue(e.value.style.chart.zoom.startIndex)), e.value.style.chart.zoom.endIndex !== null && (await G(), await G(), V.value && V.value.setEndValue(Qe(e.value.style.chart.zoom.endIndex + 1)))) : (h.value = {
        start: 0,
        end: E.value
      }, xe.value += 1);
    }
    function Qe(l) {
      const u = E.value;
      return l > u ? u : l < 0 || e.value.style.chart.zoom.startIndex !== null && l < e.value.style.chart.zoom.startIndex ? e.value.style.chart.zoom.startIndex !== null ? e.value.style.chart.zoom.startIndex + 1 : 1 : l;
    }
    it(() => {
      be();
    });
    function be() {
      yt(x.dataset) ? Z({
        componentName: "VueUiDonutEvolution",
        type: "dataset"
      }) : x.dataset.length && x.dataset.forEach((l, u) => {
        ft({
          datasetObject: l,
          requiredAttributes: ["name", "values"]
        }).forEach((t) => {
          Z({
            componentName: "VueUiDonutEvolution",
            type: "datasetSerieAttribute",
            property: t,
            index: u
          });
        });
      }), ge();
    }
    const T = b(Re()), C = b([]), g = b(null), ae = b(null), A = b(!1), $ = b(null), oe = b(null), Ze = b(null), me = b(0), xe = b(0), pe = b(0), ke = b(0), _e = b(0), Ce = qe, e = p({
      get: () => Le(),
      set: (l) => l
    }), { userOptionsVisible: ue, setUserOptionsVisibility: we, keepUserOptionState: ze } = Ot({ config: e.value }), { svgRef: et } = Dt({ config: e.value.style.chart.title });
    function Le() {
      const l = Be({
        userConfig: x.config,
        defaultConfig: Je
      });
      let u = {};
      return l.theme ? u = {
        ...Be({
          userConfig: bt.vue_ui_donut_evolution[l.theme] || x.config,
          defaultConfig: l
        }),
        customPalette: gt[l.theme] || ee
      } : u = l, x.config && Ue(x.config, "style.chart.zoom.startIndex") ? u.style.chart.zoom.startIndex = x.config.style.chart.zoom.startIndex : u.style.chart.zoom.startIndex = null, x.config && Ue(x.config, "style.chart.zoom.endIndex") ? u.style.chart.zoom.endIndex = x.config.style.chart.zoom.endIndex : u.style.chart.zoom.endIndex = null, u;
    }
    He(() => x.config, (l) => {
      e.value = Le(), ue.value = !e.value.userOptions.showOnChartHover, be(), pe.value += 1, ke.value += 1, _e.value += 1, U.value.showTable = e.value.table.show;
    }, { deep: !0 }), He(() => x.dataset, (l) => {
      fe();
    }, { deep: !0 });
    const { isPrinting: Se, isImaging: Ae, generatePdf: $e, generateImage: Ne } = zt({
      elementId: T.value,
      fileName: e.value.style.chart.title.text || "vue-ui-donut-evolution"
    }), tt = p(() => e.value.userOptions.show && !e.value.style.chart.title.text), lt = p(() => mt(e.value.customPalette)), U = b({
      showTable: e.value.table.show
    }), n = p(() => ({
      top: e.value.style.chart.layout.padding.top,
      right: e.value.style.chart.layout.padding.right,
      bottom: e.value.style.chart.layout.padding.bottom,
      left: e.value.style.chart.layout.padding.left
    })), r = p(() => {
      const l = e.value.style.chart.layout.height, u = e.value.style.chart.layout.width, t = l - n.value.top - n.value.bottom, i = u - n.value.left - n.value.right;
      return {
        absoluteHeight: l,
        absoluteWidth: u,
        centerX: n.value.left + i / 2,
        centerY: n.value.top + t / 2,
        height: t,
        width: i
      };
    }), O = p(() => (x.dataset.forEach((l, u) => {
      [null, void 0].includes(l.name) && Z({
        componentName: "VueUiDonutEvolution",
        type: "datasetSerieAttribute",
        property: "name",
        index: u
      }), [null, void 0].includes(l.values) && Z({
        componentName: "VueUiDonutEvolution",
        type: "datasetSerieAttribute",
        property: "values",
        index: u
      });
    }), x.dataset.map((l, u) => ({
      ...l,
      values: xt(l.values),
      color: de(l.color) || lt.value[u] || ee[u] || ee[u % ee.length],
      length: (l.values || []).length,
      uid: Re()
    })))), W = p(() => O.value.filter((l) => !C.value.includes(l.uid)).map((l) => ({
      ...l,
      values: l.values.filter((u, t) => t >= h.value.start && t <= h.value.end)
    }))), E = p(() => Math.max(...W.value.map((l) => l.length))), z = p(() => r.value.width / (h.value.end - h.value.start)), w = p(() => {
      const l = [];
      for (let s = 0; s < h.value.end - h.value.start; s += 1) {
        const f = W.value.map((I) => I.values[s] ?? null), y = f.filter((I) => [void 0, null].includes(I)).length === f.length, N = f.reduce((I, L) => I + L, 0), ve = f.map((I) => I / N), R = n.value.left + z.value * s + z.value / 2;
        l.push({
          index: s,
          percentages: ve,
          subtotal: y || N < 0 ? null : N,
          values: f,
          x: R
        });
      }
      const u = 0, t = Math.max(...l.map((s) => s.subtotal)), i = l.length === 1 ? t * 2 : t;
      return l.map((s, f) => {
        const y = z.value / 2 * 0.7, N = y > r.value.width / 16 ? r.value.width / 16 : y, ve = g.value === s.index ? r.value.width / 16 : N, R = l.length > 4 ? y * 2 : y * 2 > z.value / 2 * 0.7 ? z.value / 2 * 0.7 : y * 2, I = r.value.absoluteHeight - n.value.bottom - r.value.height * s.subtotal / We(u, i, e.value.style.chart.layout.grid.yAxis.dataLabels.steps).max;
        return {
          ...s,
          y: I,
          radius: N,
          activeRadius: ve,
          hoverRadius: R,
          donut: he({
            series: W.value.map((L, Ve) => ({
              color: L.color,
              name: L.name,
              value: L.values[f] ?? 0
            }))
          }, s.x, I, N, N, 1.99999, 2, 1, 360, 105.25, N / 2),
          donutHover: he({
            series: W.value.map((L, Ve) => ({
              color: L.color,
              name: L.name,
              value: L.values[f] ?? 0
            }))
          }, s.x, I, R, R, 1.99999, 2, 1, 360, 105.25, R / 2),
          donutFocus: he({
            series: W.value.map((L, Ve) => ({
              color: L.color,
              name: L.name,
              value: L.values[f] ?? 0
            }))
          }, r.value.centerX, r.value.centerY, r.value.height / 3.6, r.value.height / 3.6, 1.99999, 2, 1, 360, 105.25, r.value.height / 6)
        };
      });
    });
    function Y(l, u, t) {
      return ye(
        e.value.style.chart.layout.dataLabels.formatter,
        l,
        te({
          p: e.value.style.chart.layout.dataLabels.prefix,
          v: l,
          s: e.value.style.chart.layout.dataLabels.suffix,
          r: e.value.style.chart.layout.dataLabels.rounding
        }),
        { datapoint: u, index: t }
      );
    }
    const se = p(() => ({
      max: Math.max(...w.value.map((l) => l.subtotal)),
      min: 0
    })), H = p(() => {
      const l = w.value.length === 1 ? se.value.max * 2 : se.value.max;
      return We(se.value.min, l, e.value.style.chart.layout.grid.yAxis.dataLabels.steps);
    });
    function at(l) {
      return l / H.value.max;
    }
    const ot = p(() => H.value.ticks.map((l) => ({
      y: r.value.absoluteHeight - n.value.bottom - r.value.height * at(l),
      value: l
    })));
    function Ie(l, u) {
      return isNaN(l.value / je(u, "value")) ? 0 : (l.value / je(u, "value") * 100).toFixed(0) + "%";
    }
    function Fe() {
      A.value || (g.value = null, ae.value = null);
    }
    function ut(l) {
      A.value || (g.value = l.index, ae.value = l);
    }
    const ne = b(null);
    function re(l, u) {
      l.subtotal && (ae.value = null, g.value = null, A.value = !0, $.value = l, [null, void 0].includes(u) || (ne.value = u));
    }
    function Pe() {
      $.value = null, A.value = !1, ne.value = null;
    }
    const Oe = p(() => O.value.map((l, u) => ({
      name: l.name,
      value: l.values.slice(h.value.start, h.value.end).reduce((t, i) => t + i, 0),
      shape: "circle",
      uid: l.uid,
      color: l.color
    })).sort((l, u) => u.value - l.value).map((l) => ({
      ...l,
      opacity: C.value.includes(l.uid) ? 0.5 : 1,
      segregate: () => ie(l.uid),
      isSegregated: C.value.includes(l.uid)
    }))), De = p(() => w.value.map((l) => l.subtotal).reduce((l, u) => l + u, 0)), st = p(() => ({
      cy: "donut-div-legend",
      backgroundColor: e.value.style.chart.legend.backgroundColor,
      color: e.value.style.chart.legend.color,
      fontSize: e.value.style.chart.legend.fontSize,
      paddingBottom: 12,
      fontWeight: e.value.style.chart.legend.bold ? "bold" : ""
    }));
    function ie(l) {
      if (C.value.includes(l))
        C.value = C.value.filter((u) => u !== l), Ce("selectLegend", null);
      else {
        if (C.value.length === O.value.length - 1) return;
        C.value.push(l), Ce("selectLegend", O.value.find((u) => u.uid === l));
      }
      $.value && re(w.value.find((u, t) => t === ne.value));
    }
    const M = p(() => {
      const l = [""].concat(O.value.filter((s) => !C.value.includes(s.uid)).map((s) => ({
        name: s.name,
        color: s.color
      }))).concat(["Σ"]);
      let u = [];
      for (let s = 0; s < E.value; s += 1) {
        const f = O.value.filter((y) => !C.value.includes(y.uid)).map((y) => y.values[s] ?? 0).reduce((y, N) => y + N, 0);
        u.push([e.value.style.chart.layout.grid.xAxis.dataLabels.values[s] ?? "-"].concat(O.value.filter((y) => !C.value.includes(y.uid)).map((y) => ({
          value: y.values[s] ?? 0,
          percentage: y.values[s] ? y.values[s] / f * 100 : 0
        }))).concat([`${e.value.style.chart.layout.dataLabels.prefix}${Number(f.toFixed(e.value.table.td.roundingValue))}${e.value.style.chart.layout.dataLabels.suffix}`]));
      }
      const t = {
        th: {
          backgroundColor: e.value.table.th.backgroundColor,
          color: e.value.table.th.color,
          outline: e.value.table.th.outline
        },
        td: {
          backgroundColor: e.value.table.td.backgroundColor,
          color: e.value.table.td.color,
          outline: e.value.table.td.outline
        },
        breakpoint: e.value.table.responsiveBreakpoint
      }, i = [
        e.value.table.columnNames.period
      ].concat(O.value.filter((s) => !C.value.includes(s.uid)).map((s) => s.name)).concat(e.value.table.columnNames.total);
      return { head: l, body: u, config: t, colNames: i };
    });
    function nt() {
      return O.value;
    }
    function Te() {
      G(() => {
        const l = [[e.value.style.chart.title.text], [e.value.style.chart.title.subtitle.text], [""]], u = [...M.value.head.map((f) => f.name ?? f)], t = [...M.value.body.map((f) => f.map((y) => y.value ?? y))], i = l.concat([u]).concat(t), s = _t(i);
        Ct({ csvContent: s, title: e.value.style.chart.title.text || "vue-ui-donut-evolution" });
      });
    }
    const X = b(!1);
    function rt(l) {
      X.value = l, me.value += 1;
    }
    function Ee() {
      U.value.showTable = !U.value.showTable;
    }
    const K = b(!1);
    function ce() {
      K.value = !K.value;
    }
    return Ke({
      getData: nt,
      generatePdf: $e,
      generateCsv: Te,
      generateImage: Ne,
      toggleTable: Ee,
      toggleAnnotator: ce
    }), (l, u) => (a(), o("div", {
      ref_key: "donutEvolutionChart",
      ref: oe,
      class: P(`vue-ui-donut-evolution ${X.value ? "vue-data-ui-wrapper-fullscreen" : ""} ${e.value.useCssAnimation ? "" : "vue-ui-dna"}`),
      style: q(`font-family:${e.value.style.fontFamily};width:100%; text-align:center;background:${e.value.style.chart.backgroundColor}`),
      id: T.value,
      onMouseenter: u[4] || (u[4] = () => c(we)(!0)),
      onMouseleave: u[5] || (u[5] = () => c(we)(!1))
    }, [
      e.value.userOptions.buttons.annotator ? (a(), D(Pt, {
        key: 0,
        parent: oe.value,
        backgroundColor: e.value.style.chart.backgroundColor,
        color: e.value.style.chart.color,
        active: K.value,
        onClose: ce
      }, null, 8, ["parent", "backgroundColor", "color", "active"])) : v("", !0),
      tt.value ? (a(), o("div", {
        key: 1,
        ref_key: "noTitle",
        ref: Ze,
        class: "vue-data-ui-no-title-space",
        style: "height:36px; width: 100%;background:transparent"
      }, null, 512)) : v("", !0),
      e.value.style.chart.title.text ? (a(), o("div", {
        key: 2,
        style: "width:100%;background:transparent;padding-bottom:24px",
        onMouseleave: Fe
      }, [
        (a(), D(wt, {
          key: `title_${pe.value}`,
          config: {
            title: {
              cy: "donut-evolution-div-title",
              ...e.value.style.chart.title
            },
            subtitle: {
              cy: "donut-evolution-div-subtitle",
              ...e.value.style.chart.title.subtitle
            }
          }
        }, null, 8, ["config"]))
      ], 32)) : v("", !0),
      e.value.userOptions.show && B.value && (c(ze) || c(ue)) ? (a(), D(Lt, {
        ref: "details",
        key: `user_options_${me.value}`,
        backgroundColor: e.value.style.chart.backgroundColor,
        color: e.value.style.chart.color,
        isPrinting: c(Se),
        isImaging: c(Ae),
        uid: T.value,
        hasPdf: e.value.userOptions.buttons.pdf,
        hasImg: e.value.userOptions.buttons.img,
        hasXls: e.value.userOptions.buttons.csv,
        hasTable: e.value.userOptions.buttons.table,
        hasFullscreen: e.value.userOptions.buttons.fullscreen,
        isFullscreen: X.value,
        titles: { ...e.value.userOptions.buttonTitles },
        chartElement: oe.value,
        position: e.value.userOptions.position,
        hasAnnotator: e.value.userOptions.buttons.annotator,
        isAnnotation: K.value,
        onToggleFullscreen: rt,
        onGeneratePdf: c($e),
        onGenerateCsv: Te,
        onGenerateImage: c(Ne),
        onToggleTable: Ee,
        onToggleAnnotator: ce,
        style: q({
          visibility: c(ze) ? c(ue) ? "visible" : "hidden" : "visible"
        })
      }, ct({ _: 2 }, [
        l.$slots.optionPdf ? {
          name: "optionPdf",
          fn: F(() => [
            S(l.$slots, "optionPdf", {}, void 0, !0)
          ]),
          key: "0"
        } : void 0,
        l.$slots.optionCsv ? {
          name: "optionCsv",
          fn: F(() => [
            S(l.$slots, "optionCsv", {}, void 0, !0)
          ]),
          key: "1"
        } : void 0,
        l.$slots.optionImg ? {
          name: "optionImg",
          fn: F(() => [
            S(l.$slots, "optionImg", {}, void 0, !0)
          ]),
          key: "2"
        } : void 0,
        l.$slots.optionTable ? {
          name: "optionTable",
          fn: F(() => [
            S(l.$slots, "optionTable", {}, void 0, !0)
          ]),
          key: "3"
        } : void 0,
        l.$slots.optionFullscreen ? {
          name: "optionFullscreen",
          fn: F(({ toggleFullscreen: t, isFullscreen: i }) => [
            S(l.$slots, "optionFullscreen", J(Q({ toggleFullscreen: t, isFullscreen: i })), void 0, !0)
          ]),
          key: "4"
        } : void 0,
        l.$slots.optionAnnotator ? {
          name: "optionAnnotator",
          fn: F(({ toggleAnnotator: t, isAnnotator: i }) => [
            S(l.$slots, "optionAnnotator", J(Q({ toggleAnnotator: t, isAnnotator: i })), void 0, !0)
          ]),
          key: "5"
        } : void 0
      ]), 1032, ["backgroundColor", "color", "isPrinting", "isImaging", "uid", "hasPdf", "hasImg", "hasXls", "hasTable", "hasFullscreen", "isFullscreen", "titles", "chartElement", "position", "hasAnnotator", "isAnnotation", "onGeneratePdf", "onGenerateImage", "style"])) : v("", !0),
      B.value ? (a(), o("svg", {
        key: 4,
        ref_key: "svgRef",
        ref: et,
        xmlns: c(pt),
        class: P({ "vue-data-ui-fullscreen--on": X.value, "vue-data-ui-fulscreen--off": !X.value }),
        viewBox: `0 0 ${r.value.absoluteWidth} ${r.value.absoluteHeight}`,
        style: q(`max-width:100%; overflow: visible; background:transparent;color:${e.value.style.chart.color}`)
      }, [
        vt(Ft),
        l.$slots["chart-background"] ? (a(), o("foreignObject", {
          key: 0,
          x: n.value.left,
          y: n.value.top,
          width: r.value.width,
          height: r.value.height,
          style: {
            pointerEvents: "none"
          }
        }, [
          S(l.$slots, "chart-background", {}, void 0, !0)
        ], 8, Ht)) : v("", !0),
        d("defs", null, [
          d("linearGradient", {
            id: `hover_${T.value}`,
            x1: "0%",
            y1: "0%",
            x2: "0%",
            y2: "100%"
          }, [
            d("stop", {
              offset: "0%",
              "stop-color": c(j)(e.value.style.chart.backgroundColor, e.value.style.chart.layout.highlighter.opacity)
            }, null, 8, Rt),
            d("stop", {
              offset: "100%",
              "stop-color": c(j)(e.value.style.chart.layout.highlighter.color, e.value.style.chart.layout.highlighter.opacity)
            }, null, 8, Ut)
          ], 8, Mt),
          d("radialGradient", {
            id: `focus_${T.value}`
          }, [
            d("stop", {
              offset: "0%",
              "stop-color": c(j)(c(de)(e.value.style.chart.backgroundColor), 0)
            }, null, 8, Xt),
            d("stop", {
              offset: "77%",
              "stop-color": c(j)("#FFFFFF", 30)
            }, null, 8, Gt),
            d("stop", {
              offset: "100%",
              "stop-color": c(j)(c(de)(e.value.style.chart.backgroundColor), 0)
            }, null, 8, jt)
          ], 8, Wt)
        ]),
        e.value.style.chart.layout.grid.show ? (a(), o("g", Bt, [
          d("line", {
            x1: n.value.left,
            x2: n.value.left,
            y1: n.value.top,
            y2: n.value.top + r.value.height,
            stroke: e.value.style.chart.layout.grid.stroke,
            "stroke-width": e.value.style.chart.layout.grid.strokeWidth,
            "stroke-linecap": "round"
          }, null, 8, Yt),
          d("line", {
            x1: n.value.left,
            x2: r.value.absoluteWidth - n.value.right,
            y1: r.value.absoluteHeight - n.value.bottom,
            y2: r.value.absoluteHeight - n.value.bottom,
            stroke: e.value.style.chart.layout.grid.stroke,
            "stroke-width": e.value.style.chart.layout.grid.strokeWidth,
            "stroke-linecap": "round"
          }, null, 8, Kt),
          e.value.style.chart.layout.grid.showVerticalLines ? (a(), o("g", qt, [
            (a(!0), o(k, null, _(h.value.end - h.value.start, (t, i) => (a(), o("line", {
              x1: n.value.left + (i + 1) * z.value,
              x2: n.value.left + (i + 1) * z.value,
              y1: n.value.top,
              y2: r.value.absoluteHeight - n.value.bottom,
              stroke: e.value.style.chart.layout.grid.stroke,
              "stroke-width": e.value.style.chart.layout.grid.strokeWidth,
              "stroke-linecap": "round"
            }, null, 8, Jt))), 256))
          ])) : v("", !0)
        ])) : v("", !0),
        e.value.style.chart.layout.grid.yAxis.dataLabels.show ? (a(), o("g", {
          key: 2,
          class: P({ "donut-opacity": !0, "donut-behind": g.value !== null || A.value })
        }, [
          (a(!0), o(k, null, _(ot.value, (t, i) => (a(), o("g", null, [
            t.value >= H.value.min && t.value <= H.value.max ? (a(), o("line", {
              key: 0,
              x1: n.value.left,
              x2: n.value.left - 5,
              y1: t.y,
              y2: t.y,
              stroke: e.value.style.chart.layout.grid.stroke,
              "stroke-width": e.value.style.chart.layout.grid.strokeWidth
            }, null, 8, Qt)) : v("", !0),
            t.value >= H.value.min && t.value <= H.value.max ? (a(), o("text", {
              key: 1,
              x: n.value.left - 8 + e.value.style.chart.layout.grid.yAxis.dataLabels.offsetX,
              y: t.y + e.value.style.chart.layout.grid.yAxis.dataLabels.fontSize / 3,
              "font-size": e.value.style.chart.layout.grid.yAxis.dataLabels.fontSize,
              "text-anchor": "end",
              fill: e.value.style.chart.layout.grid.yAxis.dataLabels.color,
              "font-weight": e.value.style.chart.layout.grid.yAxis.dataLabels.bold ? "bold" : "normal"
            }, m(c(kt)(t.value) ? c(ye)(
              e.value.style.chart.layout.dataLabels.formatter,
              t.value,
              c(te)({
                p: e.value.style.chart.layout.dataLabels.prefix,
                v: t.value,
                s: e.value.style.chart.layout.dataLabels.suffix,
                r: e.value.style.chart.layout.grid.yAxis.dataLabels.roundingValue
              }),
              { datapoint: t, seriesIndex: i }
            ) : ""), 9, Zt)) : v("", !0)
          ]))), 256))
        ], 2)) : v("", !0),
        e.value.style.chart.layout.grid.xAxis.dataLabels.show ? (a(), o("g", {
          key: 3,
          class: P({ "donut-opacity": !0, "donut-behind": A.value })
        }, [
          (a(!0), o(k, null, _(h.value.end - h.value.start, (t, i) => (a(), o("g", null, [
            e.value.style.chart.layout.grid.xAxis.dataLabels.showOnlyFirstAndLast && (i === 0 || i === E.value - 1) || !e.value.style.chart.layout.grid.xAxis.dataLabels.showOnlyFirstAndLast ? (a(), o("text", {
              key: 0,
              "text-anchor": e.value.style.chart.layout.grid.xAxis.dataLabels.rotation > 0 ? "start" : e.value.style.chart.layout.grid.xAxis.dataLabels.rotation < 0 ? "end" : "middle",
              "font-size": e.value.style.chart.layout.grid.xAxis.dataLabels.fontSize,
              fill: e.value.style.chart.layout.grid.xAxis.dataLabels.color,
              transform: `translate(${n.value.left + z.value * i + z.value / 2}, ${e.value.style.chart.layout.grid.xAxis.dataLabels.offsetY + r.value.absoluteHeight - n.value.bottom + e.value.style.chart.layout.grid.xAxis.dataLabels.fontSize * 2}), rotate(${e.value.style.chart.layout.grid.xAxis.dataLabels.rotation})`
            }, m(e.value.style.chart.layout.grid.xAxis.dataLabels.values[Number(i) + Number(h.value.start)] ?? ""), 9, el)) : v("", !0)
          ]))), 256))
        ], 2)) : v("", !0),
        (a(!0), o(k, null, _(w.value, (t, i) => (a(), o("g", null, [
          e.value.style.chart.layout.line.show && i < w.value.length - 1 && ![t.subtotal, w.value[i + 1].subtotal].includes(null) ? (a(), o("line", {
            key: 0,
            class: P({ "donut-opacity": !0, "donut-behind": g.value !== null || A.value }),
            x1: t.x,
            y1: t.y,
            x2: w.value[i + 1].x,
            y2: w.value[i + 1].y,
            stroke: e.value.style.chart.layout.line.stroke,
            "stroke-width": e.value.style.chart.layout.line.strokeWidth,
            "stroke-linecap": "round",
            "stroke-linejoin": "round"
          }, null, 10, tl)) : v("", !0),
          t.subtotal !== null ? (a(), o("g", ll, [
            t.subtotal ? (a(), o("circle", {
              key: 0,
              cx: t.x,
              cy: t.y,
              r: t.activeRadius,
              fill: e.value.style.chart.backgroundColor
            }, null, 8, al)) : v("", !0)
          ])) : v("", !0)
        ]))), 256)),
        (a(!0), o(k, null, _(w.value, (t, i) => (a(), o("g", {
          class: P({ "donut-opacity": !0, "donut-behind": i !== g.value && g.value !== null || A.value })
        }, [
          t.subtotal ? (a(), o("g", ol, [
            g.value !== null && g.value === i ? (a(), o("g", ul, [
              (a(!0), o(k, null, _(t.donutHover, (s) => (a(), o("g", null, [
                d("path", {
                  d: c(Xe)(s, { x: s.center.endX, y: s.center.endY }, 12, 12, { x: t.x, y: t.y }, !0, 20),
                  stroke: s.color,
                  "stroke-width": "1",
                  "stroke-linecap": "round",
                  "stroke-linejoin": "round",
                  fill: "none"
                }, null, 8, sl)
              ]))), 256)),
              (a(!0), o(k, null, _(t.donutHover, (s, f) => (a(), o("g", null, [
                d("text", {
                  "data-cy-hover-label": "",
                  "text-anchor": c(le)(s, !0, 0).anchor,
                  x: c(le)(s, !0, 3).x,
                  y: c(Ge)(s),
                  fill: e.value.style.chart.layout.grid.yAxis.dataLabels.color,
                  "font-size": 8,
                  "font-weight": "bold"
                }, m(s.name) + ": " + m(Ie(s, t.donut)) + " (" + m(s.value === null ? "-" : Y(s.value, s, f)) + ") ", 9, nl)
              ]))), 256)),
              d("g", null, [
                d("circle", {
                  cx: t.x,
                  cy: t.y,
                  r: t.hoverRadius,
                  fill: e.value.style.chart.backgroundColor
                }, null, 8, rl)
              ])
            ])) : v("", !0)
          ])) : v("", !0)
        ], 2))), 256)),
        (a(!0), o(k, null, _(w.value, (t, i) => (a(), o("g", {
          class: P({ "donut-opacity": !0, "donut-behind": i !== g.value && g.value !== null || A.value })
        }, [
          t.subtotal !== null ? (a(), o("g", il, [
            t.subtotal === 0 ? (a(), o("circle", {
              key: 0,
              cx: t.x,
              cy: t.y,
              r: 3,
              fill: e.value.style.chart.color
            }, null, 8, cl)) : g.value !== null && g.value === i ? (a(), o("g", vl, [
              (a(!0), o(k, null, _(t.donutHover, (s, f) => (a(), o("path", {
                d: s.arcSlice,
                fill: `${s.color}`,
                "stroke-width": 1,
                stroke: e.value.style.chart.backgroundColor
              }, null, 8, dl))), 256))
            ])) : (a(), o("g", hl, [
              (a(!0), o(k, null, _(t.donut, (s, f) => (a(), o("path", {
                d: s.arcSlice,
                fill: `${s.color}`,
                "stroke-width": 0.5,
                stroke: e.value.style.chart.backgroundColor
              }, null, 8, yl))), 256))
            ]))
          ])) : v("", !0)
        ], 2))), 256)),
        (a(!0), o(k, null, _(w.value, (t, i) => (a(), o("g", {
          class: P({ "donut-opacity": !0, "donut-behind": i !== g.value && g.value !== null || A.value })
        }, [
          t.subtotal !== null && e.value.style.chart.layout.dataLabels.show ? (a(), o("text", {
            key: 0,
            "text-anchor": "middle",
            x: t.x,
            y: g.value === t.index && t.subtotal ? t.y + e.value.style.chart.layout.dataLabels.fontSize / 3 : t.y - t.radius - e.value.style.chart.layout.dataLabels.fontSize + e.value.style.chart.layout.dataLabels.offsetY,
            "font-size": e.value.style.chart.layout.dataLabels.fontSize,
            "font-weight": "bold",
            fill: e.value.style.chart.layout.dataLabels.color
          }, m(Y(t.subtotal, t, i)), 9, fl)) : v("", !0)
        ], 2))), 256)),
        (a(!0), o(k, null, _(w.value, (t, i) => (a(), o("rect", {
          x: n.value.left + i * z.value,
          y: r.value.absoluteHeight - n.value.bottom - 10,
          width: z.value,
          height: 10,
          fill: g.value === t.index ? `url(#hover_${T.value})` : "transparent",
          onClick: (s) => re(t, i),
          class: P({ "donut-hover": g.value === t.index && t.subtotal })
        }, null, 10, gl))), 256)),
        (a(!0), o(k, null, _(w.value, (t, i) => (a(), o("rect", {
          "data-cy-trap": "",
          x: n.value.left + i * z.value,
          y: n.value.top,
          width: z.value,
          height: r.value.height,
          fill: "transparent",
          onMouseenter: (s) => ut(t),
          onMouseleave: Fe,
          onClick: (s) => re(t, i),
          class: P({ "donut-hover": g.value === t.index && t.subtotal })
        }, null, 42, bl))), 256)),
        A.value ? (a(), o("g", ml, [
          d("rect", {
            rx: 4,
            x: n.value.left,
            y: n.value.top,
            width: r.value.width,
            height: r.value.height,
            fill: e.value.style.chart.backgroundColor,
            style: { filter: "drop-shadow(0 12px 12px rgba(0,0,0,0.3))" }
          }, null, 8, xl),
          d("line", {
            "data-html2canvas-ignore": "",
            x1: r.value.absoluteWidth - n.value.right - 15,
            y1: n.value.top + 5,
            x2: r.value.absoluteWidth - n.value.right - 4,
            y2: n.value.top + 15.5,
            "stroke-linecap": "round",
            stroke: e.value.style.chart.color,
            "stroke-width": "1.5"
          }, null, 8, pl),
          d("line", {
            "data-html2canvas-ignore": "",
            x1: r.value.absoluteWidth - n.value.right - 15,
            y2: n.value.top + 5,
            x2: r.value.absoluteWidth - n.value.right - 4,
            y1: n.value.top + 15.5,
            "stroke-linecap": "round",
            stroke: e.value.style.chart.color,
            "stroke-width": "1.5"
          }, null, 8, kl),
          d("circle", {
            "data-cy-close": "",
            onClick: Pe,
            onKeypress: dt(Pe, ["enter"]),
            cx: r.value.absoluteWidth - n.value.right - r.value.width / 40,
            cy: n.value.top + r.value.height / 30,
            r: r.value.height / 12,
            fill: "transparent",
            style: { cursor: "pointer" },
            tabindex: "0"
          }, null, 40, _l),
          (a(!0), o(k, null, _($.value.donutFocus, (t) => (a(), o("g", null, [
            d("path", {
              "data-cy-zoom-donut": "",
              d: c(Xe)(t, { x: r.value.centerX, y: r.value.centerY }, 12, 12, !1, !1, 15),
              stroke: t.color,
              "stroke-width": "1",
              "stroke-linecap": "round",
              "stroke-linejoin": "round",
              fill: "none",
              class: "vue-ui-donut-evolution-focus"
            }, null, 8, Cl)
          ]))), 256)),
          d("circle", {
            cx: n.value.left + r.value.width / 2,
            cy: n.value.top + r.value.height / 2,
            r: r.value.height / 7,
            fill: e.value.style.chart.backgroundColor
          }, null, 8, wl),
          (a(!0), o(k, null, _($.value.donutFocus, (t, i) => (a(), o("path", {
            d: t.arcSlice,
            fill: `${t.color}`,
            "stroke-width": 1,
            stroke: e.value.style.chart.backgroundColor,
            class: "vue-ui-donut-evolution-focus"
          }, null, 8, zl))), 256)),
          (a(!0), o(k, null, _($.value.donutFocus, (t, i) => (a(), o("g", Ll, [
            d("text", {
              "text-anchor": c(le)(t, !0, 20).anchor,
              x: c(le)(t, !0, 10).x,
              y: c(Ge)(t),
              fill: e.value.style.chart.layout.grid.yAxis.dataLabels.color,
              "font-size": 10,
              "font-weight": "bold"
            }, m(t.name) + ": " + m(Ie(t, $.value.donutFocus)) + " (" + m(t.value === null ? "-" : Y(t.value, t, i)) + ") ", 9, Sl)
          ]))), 256)),
          d("circle", {
            cx: n.value.left + r.value.width / 2,
            cy: n.value.top + r.value.height / 2,
            r: r.value.height / 3.8,
            fill: `url(#focus_${T.value})`
          }, null, 8, Al),
          d("circle", {
            cx: n.value.left + r.value.width / 2,
            cy: n.value.top + r.value.height / 2,
            r: r.value.height / 7.7,
            fill: e.value.style.chart.backgroundColor
          }, null, 8, $l),
          d("text", {
            "text-anchor": "middle",
            x: n.value.left + r.value.width / 2,
            y: n.value.top + r.value.height / 2 + 14 / 3,
            "font-size": 14,
            "font-weight": "bold",
            fill: e.value.style.chart.layout.dataLabels.color,
            class: "vue-ui-donut-evolution-focus"
          }, m(Y($.value.subtotal, $.value, null)), 9, Nl),
          e.value.style.chart.layout.grid.xAxis.dataLabels.values[$.value.index] ? (a(), o("text", {
            key: 0,
            x: n.value.left + 6,
            y: n.value.top + e.value.style.chart.layout.grid.xAxis.dataLabels.fontSize * 2,
            "font-size": e.value.style.chart.layout.grid.xAxis.dataLabels.fontSize * 1.6,
            fill: e.value.style.chart.layout.dataLabels.color
          }, m(e.value.style.chart.layout.grid.xAxis.dataLabels.values[Number($.value.index) + Number(h.value.start)]), 9, Il)) : v("", !0)
        ])) : v("", !0),
        S(l.$slots, "svg", { svg: r.value }, void 0, !0)
      ], 14, Vt)) : v("", !0),
      l.$slots.watermark ? (a(), o("div", Fl, [
        S(l.$slots, "watermark", J(Q({ isPrinting: c(Se) || c(Ae) })), void 0, !0)
      ])) : v("", !0),
      B.value ? v("", !0) : (a(), D($t, {
        key: 6,
        config: {
          type: "donutEvolution",
          style: {
            backgroundColor: e.value.style.chart.backgroundColor,
            donutEvolution: {
              axis: {
                color: "#CCCCCC"
              },
              donuts: {
                color: "#CCCCCC"
              }
            }
          }
        }
      }, null, 8, ["config"])),
      E.value > 1 && e.value.style.chart.zoom.show ? (a(), D(Nt, {
        ref_key: "slicerComponent",
        ref: V,
        key: `slicer_${xe.value}`,
        background: e.value.style.chart.zoom.color,
        borderColor: e.value.style.chart.backgroundColor,
        fontSize: e.value.style.chart.zoom.fontSize,
        useResetSlot: e.value.style.chart.zoom.useResetSlot,
        labelLeft: e.value.style.chart.layout.grid.xAxis.dataLabels.values[Number(h.value.start)] || "",
        labelRight: e.value.style.chart.layout.grid.xAxis.dataLabels.values[Number(h.value.end) - 1] || "",
        textColor: e.value.style.chart.color,
        inputColor: e.value.style.chart.zoom.color,
        selectColor: e.value.style.chart.zoom.highlightColor,
        max: E.value,
        min: 0,
        valueStart: h.value.start,
        valueEnd: h.value.end,
        start: h.value.start,
        "onUpdate:start": u[0] || (u[0] = (t) => h.value.start = t),
        end: h.value.end,
        "onUpdate:end": u[1] || (u[1] = (t) => h.value.end = t),
        refreshStartPoint: e.value.style.chart.zoom.startIndex !== null ? e.value.style.chart.zoom.startIndex : 0,
        refreshEndPoint: e.value.style.chart.zoom.endIndex !== null ? e.value.style.chart.zoom.endIndex + 1 : E.value,
        enableRangeHandles: e.value.style.chart.zoom.enableRangeHandles,
        enableSelectionDrag: e.value.style.chart.zoom.enableSelectionDrag,
        onReset: fe
      }, {
        "reset-action": F(({ reset: t }) => [
          S(l.$slots, "reset-action", J(Q({ reset: t })), void 0, !0)
        ]),
        _: 3
      }, 8, ["background", "borderColor", "fontSize", "useResetSlot", "labelLeft", "labelRight", "textColor", "inputColor", "selectColor", "max", "valueStart", "valueEnd", "start", "end", "refreshStartPoint", "refreshEndPoint", "enableRangeHandles", "enableSelectionDrag"])) : v("", !0),
      e.value.style.chart.legend.show ? (a(), D(At, {
        key: `legend_${_e.value}`,
        legendSet: Oe.value,
        config: st.value,
        onClickMarker: u[2] || (u[2] = ({ legend: t }) => ie(t.uid))
      }, {
        item: F(({ legend: t, index: i }) => [
          d("div", {
            onClick: (s) => ie(t.uid),
            style: q(`opacity:${C.value.includes(t.uid) ? 0.5 : 1}`)
          }, [
            Me(m(t.name) + ": " + m(c(ye)(
              e.value.style.chart.layout.dataLabels.formatter,
              t.value,
              c(te)({
                p: e.value.style.chart.layout.dataLabels.prefix,
                v: t.value,
                s: e.value.style.chart.layout.dataLabels.suffix,
                r: e.value.style.chart.legend.roundingValue
              }),
              { datapoint: t, seriesIndex: i }
            )) + " ", 1),
            C.value.includes(t.uid) ? (a(), o("span", Dl, " ( - % ) ")) : (a(), o("span", Ol, " (" + m(isNaN(t.value / De.value) ? "-" : c(te)({
              v: t.value / De.value * 100,
              s: "%",
              r: e.value.style.chart.legend.roundingPercentage
            })) + ") ", 1))
          ], 12, Pl)
        ]),
        _: 1
      }, 8, ["legendSet", "config"])) : v("", !0),
      S(l.$slots, "legend", { legend: Oe.value }, void 0, !0),
      l.$slots.source ? (a(), o("div", Tl, [
        S(l.$slots, "source", {}, void 0, !0)
      ], 512)) : v("", !0),
      B.value ? (a(), D(It, {
        key: 10,
        hideDetails: "",
        config: {
          open: U.value.showTable,
          maxHeight: 1e4,
          body: {
            backgroundColor: e.value.style.chart.backgroundColor,
            color: e.value.style.chart.color
          },
          head: {
            backgroundColor: e.value.style.chart.backgroundColor,
            color: e.value.style.chart.color
          }
        }
      }, {
        content: F(() => [
          (a(), D(St, {
            key: `table_${ke.value}`,
            colNames: M.value.colNames,
            head: M.value.head,
            body: M.value.body,
            config: M.value.config,
            title: `${e.value.style.chart.title.text}${e.value.style.chart.title.subtitle.text ? ` : ${e.value.style.chart.title.subtitle.text}` : ""}`,
            onClose: u[3] || (u[3] = (t) => U.value.showTable = !1)
          }, {
            th: F(({ th: t }) => [
              Me(m(t.name ?? t), 1)
            ]),
            td: F(({ td: t }) => [
              t.value === null ? (a(), o("span", El, "-")) : (a(), o("b", Vl, m(isNaN(t.value) ? "" : e.value.style.chart.layout.dataLabels.prefix) + m(!isNaN(t.value) && t.value !== null ? Number(t.value.toFixed(e.value.table.td.roundingValue)).toLocaleString() : t) + m(isNaN(t.value) ? "" : e.value.style.chart.layout.dataLabels.suffix), 1)),
              d("span", null, m(t.percentage && !isNaN(t.percentage) ? `(${Number(t.percentage.toFixed(e.value.table.td.roundingPercentage)).toLocaleString()}%)` : ""), 1)
            ]),
            _: 1
          }, 8, ["colNames", "head", "body", "config", "title"]))
        ]),
        _: 1
      }, 8, ["config"])) : v("", !0)
    ], 46, Et));
  }
}, ta = /* @__PURE__ */ Tt(Hl, [["__scopeId", "data-v-d10dce87"]]);
export {
  ta as default
};
