import { computed as g, ref as d, onMounted as Me, onBeforeUnmount as Ge, watch as Ee, openBlock as s, createElementBlock as n, normalizeClass as ue, normalizeStyle as S, renderSlot as p, createVNode as se, createCommentVNode as v, createBlock as Q, unref as o, createSlots as Ue, withCtx as w, normalizeProps as Y, guardReactiveProps as H, createElementVNode as b, Fragment as V, renderList as W, toDisplayString as _, createTextVNode as Se, nextTick as je, pushScopeId as Re, popScopeId as Ye } from "vue";
import { u as He, o as We, e as Te, g as Xe, c as qe, t as Je, a as Ke, p as D, b as Qe, d as Z, m as Ze, f as C, X as el, w as ll, j as tl, E as al, i as T, k as y, n as X, x as ol, q as ul, r as sl } from "./index-CguVaFlt.js";
import { t as rl, u as nl } from "./useResponsive-NZB-WLRF.js";
import { _ as il } from "./Title-DbTGPg4G.js";
import { u as vl, U as cl } from "./usePrinter-ClsMRVJG.js";
import { D as dl } from "./DataTable-BwHWRlRZ.js";
import { _ as hl } from "./Tooltip-u79R5W5y.js";
import { L as yl } from "./Legend-CsVEDSh6.js";
import fl from "./vue-ui-skeleton-ChHLL5Hw.js";
import bl from "./vue-ui-accordion-w15FGKRN.js";
import { u as Fe } from "./useNestedProp-BbEbJmgv.js";
import { _ as gl } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const pl = (M) => (Re("data-v-8cc49fb9"), M = M(), Ye(), M), ml = ["id"], wl = ["xmlns", "viewBox"], kl = ["id"], _l = ["stop-color"], Cl = ["stop-color"], xl = ["stop-color"], $l = ["id"], Ll = ["id"], Sl = /* @__PURE__ */ pl(() => /* @__PURE__ */ b("feColorMatrix", {
  type: "saturate",
  values: "0"
}, null, -1)), Tl = ["id"], Fl = ["flood-color"], zl = ["d", "stroke", "filter"], Nl = ["cx", "cy", "r", "fill", "filter"], Pl = ["stroke", "d"], Ol = ["d", "fill", "stroke", "stroke-width", "filter"], Al = ["cx", "cy", "r", "fill", "stroke"], Dl = ["cx", "cy", "r", "fill"], Il = ["d", "fill", "onMouseenter", "onClick"], Bl = ["cx", "cy", "r", "fill"], Vl = ["x", "y", "fill", "font-size"], Ml = ["x", "y", "fill", "font-size"], Gl = ["x", "y", "fill", "font-size"], El = ["x", "y", "fill", "font-size"], Ul = ["filter"], jl = { key: 0 }, Rl = ["x", "y"], Yl = { key: 1 }, Hl = ["cx", "cy", "fill", "filter", "onClick"], Wl = ["text-anchor", "x", "y", "fill", "font-size", "onClick"], Xl = ["text-anchor", "x", "y", "fill", "font-size", "onClick"], ql = { key: 2 }, Jl = ["x", "y", "width"], Kl = {
  key: 3,
  class: "vue-data-ui-watermark"
}, Ql = ["onClick"], Zl = {
  key: 0,
  style: { "font-variant-numeric": "tabular-nums" }
}, et = { key: 1 }, lt = ["innerHTML"], tt = {
  __name: "vue-ui-donut",
  props: {
    config: {
      type: Object,
      default() {
        return {};
      }
    },
    dataset: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  emits: ["selectLegend", "selectDatapoint"],
  setup(M, { expose: ze, emit: re }) {
    const F = M, { vue_ui_donut: Ne } = He(), G = g({
      get() {
        return !!F.dataset && F.dataset.length;
      },
      set(t) {
        return t;
      }
    }), E = d(null), ne = d(null), ie = d(null), q = d(null);
    Me(() => {
      if (We(F.dataset) ? Te({
        componentName: "VueUiDonut",
        type: "dataset"
      }) : F.dataset.forEach((t, a) => {
        Xe({
          datasetObject: t,
          requiredAttributes: ["name", "values"]
        }).forEach((l) => {
          G.value = !1, Te({
            componentName: "VueUiDonut",
            type: "datasetSerieAttribute",
            property: l,
            index: a
          });
        });
      }), e.value.responsive) {
        const t = rl(() => {
          const { width: a, height: l } = nl({
            chart: E.value,
            title: e.value.style.chart.title.text ? ne.value : null,
            legend: e.value.style.chart.legend.show ? ie.value : null
          });
          i.value.width = a, i.value.height = l;
        });
        q.value = new ResizeObserver(t), q.value.observe(E.value.parentNode);
      }
    }), Ge(() => {
      q.value && q.value.disconnect();
    });
    const x = d(qe()), Pe = d(null), ee = d(!1), le = d(""), z = d(null), ve = d(0), e = g(() => {
      const t = Fe({
        userConfig: F.config,
        defaultConfig: Ne
      });
      return t.theme ? {
        ...Fe({
          userConfig: Je.vue_ui_donut[t.theme] || F.config,
          defaultConfig: t
        }),
        customPalette: Ke[t.theme] || D
      } : t;
    }), { isPrinting: ce, isImaging: de, generatePdf: he, generateImage: ye } = vl({
      elementId: `donut__${x.value}`,
      fileName: e.value.style.chart.title.text || "vue-ui-donut"
    }), fe = g(() => Qe(e.value.customPalette)), f = d({
      dataLabels: {
        show: e.value.style.chart.layout.labels.dataLabels.show
      },
      showTable: e.value.table.show,
      showTooltip: e.value.style.chart.tooltip.show
    }), i = d({
      height: 360,
      width: 512
    }), U = g(() => {
      const t = e.value.style.chart.layout.donut.strokeWidth / 512, a = i.value.width * t;
      return a > $.value / 2 ? e.value.style.chart.layout.donut.strokeWidth : a;
    }), P = g(() => F.dataset.map((t, a) => ({
      name: t.name,
      color: Z(t.color) || fe.value[a] || D[a] || D[a % D.length],
      value: t.values.reduce((l, u) => l + u, 0),
      absoluteValues: t.values,
      comment: t.comment || ""
    }))), k = d(P.value);
    Ee(() => P.value, (t) => k.value = t);
    function Oe() {
      return P.value.map((t) => ({
        name: t.name,
        color: t.color,
        value: t.value
      }));
    }
    const L = d([]), be = d(null), ge = d(null), O = d(!1);
    function pe(t) {
      const a = P.value.find((r, h) => h === t);
      let u = k.value.find((r, h) => h === t).value;
      if (L.value.includes(t)) {
        let h = function() {
          u > r ? (cancelAnimationFrame(be.value), k.value = k.value.map((c, oe) => t === oe ? {
            ...c,
            value: r
          } : c), O.value = !1) : (O.value = !0, u += r * 0.025, k.value = k.value.map((c, oe) => t === oe ? {
            ...c,
            value: u
          } : c), be.value = requestAnimationFrame(h));
        };
        L.value = L.value.filter((c) => c !== t);
        const r = a.value;
        h();
      } else if (L.value.length < P.value.length - 1) {
        let r = function() {
          u < 0.1 ? (cancelAnimationFrame(ge.value), L.value.push(t), k.value = k.value.map((h, c) => t === c ? {
            ...h,
            value: 0
          } : h), O.value = !1) : (O.value = !0, u /= 1.1, k.value = k.value.map((h, c) => t === c ? {
            ...h,
            value: u
          } : h), ge.value = requestAnimationFrame(r));
        };
        r();
      }
      re("selectLegend", I.value.map((r) => ({
        name: r.name,
        color: r.color,
        value: r.value
      })));
    }
    const I = g(() => (k.value.forEach((t, a) => {
      if ([null, void 0].includes(t.values))
        return {
          ...t,
          values: []
        };
    }), k.value.map((t, a) => ({
      ...t,
      seriesIndex: a
    })).filter((t, a) => !L.value.includes(a)))), me = g(() => F.dataset.map((t, a) => ({
      name: t.name,
      color: Z(t.color) || fe.value[a] || D[a] || D[a % D.length],
      value: (t.values || []).reduce((l, u) => l + u, 0),
      shape: "circle"
    })).map((t, a) => ({
      ...t,
      proportion: t.value / F.dataset.map((l) => (l.values || []).reduce((u, r) => u + r, 0)).reduce((l, u) => l + u, 0),
      opacity: L.value.includes(a) ? 0.5 : 1,
      segregate: () => pe(a),
      isSegregated: L.value.includes(a)
    }))), Ae = g(() => ({
      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" : ""
    })), $ = g(() => {
      const t = Math.min(i.value.width / 3, i.value.height / 3);
      return t < 55 ? 55 : t;
    }), A = g(() => Ze({ series: I.value }, i.value.width / 2, i.value.height / 2, $.value, $.value, 1.99999, 2, 1, 360, 105.25, U.value));
    function B(t) {
      return t.proportion * 100 > e.value.style.chart.layout.labels.dataLabels.hideUnderValue;
    }
    function we(t, a) {
      const l = t.value / De(a);
      return isNaN(l) ? 0 : T(
        e.value.style.chart.layout.labels.percentage.formatter,
        l * 100,
        C({
          v: l * 100,
          s: "%",
          r: e.value.style.chart.layout.labels.percentage.rounding
        }),
        { datapoint: t }
      );
    }
    function De(t) {
      return [...t].map((a) => a.value).reduce((a, l) => a + l, 0);
    }
    const m = g(() => I.value.map((t) => t.value).reduce((t, a) => t + a, 0)), ke = g(() => m.value / I.value.length), te = d(null), j = d(!1);
    function Ie({ datapoint: t, relativeIndex: a, seriesIndex: l, show: u = !1 }) {
      te.value = { datapoint: t, seriesIndex: l, config: e.value, series: P.value }, ee.value = u, z.value = a;
      let r = "";
      const h = e.value.style.chart.tooltip.customFormat;
      if (j.value = !1, ol(h))
        try {
          const c = h({
            seriesIndex: l,
            datapoint: t,
            series: P.value,
            config: e.value
          });
          typeof c == "string" && (le.value = c, j.value = !0);
        } catch {
          console.warn("Custom format cannot be applied."), j.value = !1;
        }
      if (!j.value) {
        if (r += `<div style="width:100%;text-align:center;border-bottom:1px solid ${e.value.style.chart.tooltip.borderColor};padding-bottom:6px;margin-bottom:3px;">${t.name}</div>`, r += `<div style="display:flex;flex-direction:row;gap:6px;align-items:center;"><svg viewBox="0 0 12 12" height="14" width="14"><circle cx="6" cy="6" r="6" stroke="none" fill="${t.color}"/></svg>`, e.value.style.chart.tooltip.showValue && (r += `<b>${T(
          e.value.style.chart.layout.labels.value.formatter,
          t.value,
          C({
            p: e.value.style.chart.layout.labels.dataLabels.prefix,
            v: t.value,
            s: e.value.style.chart.layout.labels.dataLabels.suffix,
            r: e.value.style.chart.tooltip.roundingValue
          }),
          {
            datapoint: t,
            relativeIndex: a,
            seriesIndex: l
          }
        )}</b>`), e.value.style.chart.tooltip.showPercentage) {
          const c = T(
            e.value.style.chart.layout.labels.percentage.formatter,
            t.proportion * 100,
            C({
              v: t.proportion * 100,
              s: "%",
              r: e.value.style.chart.tooltip.roundingPercentage
            }),
            {
              datapoint: t,
              relativeIndex: a,
              seriesIndex: l
            }
          );
          e.value.style.chart.tooltip.showValue ? r += `<span>(${c})</span></div>` : r += `<b>${c}%</b></div>`;
        }
        e.value.style.chart.comments.showInTooltip && t.comment && (r += `<div class="vue-data-ui-tooltip-comment" style="background:${t.color}20; padding: 6px; margin-bottom: 6px; margin-top:6px; border-left: 1px solid ${t.color}">${t.comment}</div>`), le.value = `<div>${r}</div>`;
      }
    }
    function ae(t) {
      return e.value.useBlurOnHover && ![null, void 0].includes(z.value) && z.value !== t ? `url(#blur_${x.value})` : "";
    }
    const N = g(() => {
      const t = I.value.map((l) => ({
        name: l.name,
        color: l.color
      })), a = I.value.map((l) => l.value);
      return { head: t, body: a };
    });
    function _e() {
      je(() => {
        const t = N.value.head.map((u, r) => [[
          u.name
        ], [N.value.body[r]], [isNaN(N.value.body[r] / m.value) ? "-" : N.value.body[r] / m.value * 100]]), a = [[e.value.style.chart.title.text], [e.value.style.chart.title.subtitle.text], [[""], ["val"], ["%"]]].concat(t), l = ul(a);
        sl({ csvContent: l, title: e.value.style.chart.title.text || "vue-ui-donut" });
      });
    }
    const J = g(() => {
      const t = [
        ' <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M18 16v2a1 1 0 0 1 -1 1h-11l6 -7l-6 -7h11a1 1 0 0 1 1 1v2" /></svg>',
        C({ p: e.value.style.chart.layout.labels.dataLabels.prefix, v: m.value, s: e.value.style.chart.layout.labels.dataLabels.suffix, r: e.value.table.td.roundingValue }),
        "100%"
      ], a = N.value.head.map((r, h) => {
        const c = C({ p: e.value.style.chart.layout.labels.dataLabels.prefix, v: N.value.body[h], s: e.value.style.chart.layout.labels.dataLabels.suffix, r: e.value.table.td.roundingValue });
        return [
          {
            color: r.color,
            name: r.name
          },
          c,
          isNaN(N.value.body[h] / m.value) ? "-" : (N.value.body[h] / m.value * 100).toFixed(e.value.table.td.roundingPercentage) + "%"
        ];
      }), l = {
        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
      };
      return {
        colNames: [
          e.value.table.columnNames.series,
          e.value.table.columnNames.value,
          e.value.table.columnNames.percentage
        ],
        head: t,
        body: a,
        config: l
      };
    }), R = d(!1);
    function Be(t) {
      R.value = t, ve.value += 1;
    }
    const Ce = g(() => /^((?!chrome|android).)*safari/i.test(navigator.userAgent));
    function Ve(t) {
      return t.toFixed(e.value.style.chart.legend.roundingPercentage).split("").map((a) => "-").join("");
    }
    function K(t, a) {
      re("selectDatapoint", { datapoint: t, index: a });
    }
    function xe() {
      f.value.showTable = !f.value.showTable;
    }
    function $e() {
      f.value.dataLabels.show = !f.value.dataLabels.show;
    }
    function Le() {
      f.value.showTooltip = !f.value.showTooltip;
    }
    return ze({
      getData: Oe,
      generatePdf: he,
      generateCsv: _e,
      generateImage: ye,
      toggleTable: xe,
      toggleLabels: $e,
      toggleTooltip: Le
    }), (t, a) => (s(), n("div", {
      ref_key: "donutChart",
      ref: E,
      class: ue(`vue-ui-donut ${R.value ? "vue-data-ui-wrapper-fullscreen" : ""} ${e.value.useCssAnimation ? "" : "vue-ui-dna"}`),
      style: S(`font-family:${e.value.style.fontFamily};width:100%; ${e.value.responsive ? "height:100%;" : ""} text-align:center;${e.value.style.chart.title.text ? "" : "padding-top:36px"};background:${e.value.style.chart.backgroundColor}`),
      id: `donut__${x.value}`
    }, [
      p(t.$slots, "userConfig", {}, void 0, !0),
      e.value.style.chart.title.text ? (s(), n("div", {
        key: 0,
        ref_key: "chartTitle",
        ref: ne,
        style: S(`width:100%;background:${e.value.style.chart.backgroundColor};padding-bottom:24px`)
      }, [
        se(il, {
          config: {
            title: {
              cy: "donut-div-title",
              ...e.value.style.chart.title
            },
            subtitle: {
              cy: "donut-div-subtitle",
              ...e.value.style.chart.title.subtitle
            }
          }
        }, null, 8, ["config"])
      ], 4)) : v("", !0),
      e.value.userOptions.show && G.value ? (s(), Q(cl, {
        ref_key: "details",
        ref: Pe,
        key: `user_option_${ve.value}`,
        backgroundColor: e.value.style.chart.backgroundColor,
        color: e.value.style.chart.color,
        isPrinting: o(ce),
        isImaging: o(de),
        uid: x.value,
        hasTooltip: e.value.style.chart.tooltip.show && e.value.userOptions.buttons.tooltip,
        hasPdf: e.value.userOptions.buttons.pdf,
        hasImg: e.value.userOptions.buttons.img,
        hasXls: e.value.userOptions.buttons.csv,
        hasTable: e.value.userOptions.buttons.table,
        hasLabel: e.value.userOptions.buttons.labels,
        hasFullscreen: e.value.userOptions.buttons.fullscreen,
        isFullscreen: R.value,
        chartElement: E.value,
        isTooltip: f.value.showTooltip,
        titles: { ...e.value.userOptions.buttonTitles },
        onToggleFullscreen: Be,
        onGeneratePdf: o(he),
        onGenerateCsv: _e,
        onGenerateImage: o(ye),
        onToggleTable: xe,
        onToggleLabels: $e,
        onToggleTooltip: Le
      }, Ue({ _: 2 }, [
        t.$slots.optionTooltip ? {
          name: "optionTooltip",
          fn: w(() => [
            p(t.$slots, "optionTooltip", {}, void 0, !0)
          ]),
          key: "0"
        } : void 0,
        t.$slots.optionPdf ? {
          name: "optionPdf",
          fn: w(() => [
            p(t.$slots, "optionPdf", {}, void 0, !0)
          ]),
          key: "1"
        } : void 0,
        t.$slots.optionCsv ? {
          name: "optionCsv",
          fn: w(() => [
            p(t.$slots, "optionCsv", {}, void 0, !0)
          ]),
          key: "2"
        } : void 0,
        t.$slots.optionImg ? {
          name: "optionImg",
          fn: w(() => [
            p(t.$slots, "optionImg", {}, void 0, !0)
          ]),
          key: "3"
        } : void 0,
        t.$slots.optionTable ? {
          name: "optionTable",
          fn: w(() => [
            p(t.$slots, "optionTable", {}, void 0, !0)
          ]),
          key: "4"
        } : void 0,
        t.$slots.optionLabels ? {
          name: "optionLabels",
          fn: w(() => [
            p(t.$slots, "optionLabels", {}, void 0, !0)
          ]),
          key: "5"
        } : void 0,
        t.$slots.optionFullscreen ? {
          name: "optionFullscreen",
          fn: w(({ toggleFullscreen: l, isFullscreen: u }) => [
            p(t.$slots, "optionFullscreen", Y(H({ toggleFullscreen: l, isFullscreen: u })), void 0, !0)
          ]),
          key: "6"
        } : void 0
      ]), 1032, ["backgroundColor", "color", "isPrinting", "isImaging", "uid", "hasTooltip", "hasPdf", "hasImg", "hasXls", "hasTable", "hasLabel", "hasFullscreen", "isFullscreen", "chartElement", "isTooltip", "titles", "onGeneratePdf", "onGenerateImage"])) : v("", !0),
      G.value ? (s(), n("svg", {
        key: 2,
        xmlns: o(el),
        class: ue({ "vue-data-ui-fullscreen--on": R.value, "vue-data-ui-fulscreen--off": !R.value }),
        viewBox: `0 0 ${i.value.width <= 0 ? 10 : i.value.width} ${i.value.height <= 0 ? 10 : i.value.height}`,
        style: S(`max-width:100%; overflow: visible; background:${e.value.style.chart.backgroundColor};color:${e.value.style.chart.color}`)
      }, [
        b("defs", null, [
          e.value.style.chart.useGradient ? (s(), n("radialGradient", {
            key: 0,
            id: `gradient_${x.value}`
          }, [
            b("stop", {
              offset: "0%",
              "stop-color": `${o(Z)(e.value.style.chart.backgroundColor)}00`
            }, null, 8, _l),
            b("stop", {
              offset: "77%",
              "stop-color": "#FFFFFF" + o(ll)[e.value.style.chart.gradientIntensity]
            }, null, 8, Cl),
            b("stop", {
              offset: "100%",
              "stop-color": `${o(Z)(e.value.style.chart.backgroundColor)}00`
            }, null, 8, xl)
          ], 8, kl)) : v("", !0)
        ]),
        b("defs", null, [
          b("filter", {
            id: `blur_${x.value}`,
            x: "-50%",
            y: "-50%",
            width: "200%",
            height: "200%"
          }, [
            b("feGaussianBlur", {
              in: "SourceGraphic",
              stdDeviation: 2,
              id: `blur_std_${x.value}`
            }, null, 8, Ll),
            Sl
          ], 8, $l),
          b("filter", {
            id: `shadow_${x.value}`,
            "color-interpolation-filters": "sRGB"
          }, [
            b("feDropShadow", {
              dx: "0",
              dy: "0",
              stdDeviation: "10",
              "flood-opacity": "0.5",
              "flood-color": e.value.style.chart.layout.donut.shadowColor
            }, null, 8, Fl)
          ], 8, Tl)
        ]),
        (s(!0), n(V, null, W(A.value, (l, u) => (s(), n("g", null, [
          B(l) && f.value.dataLabels.show ? (s(), n("path", {
            key: 0,
            d: o(tl)(l, { x: i.value.width / 2, y: i.value.height / 2 }, 16, 16, !1, !1, U.value),
            stroke: l.color,
            "stroke-width": "1",
            "stroke-linecap": "round",
            "stroke-linejoin": "round",
            fill: "none",
            filter: ae(u)
          }, null, 8, zl)) : v("", !0)
        ]))), 256)),
        b("circle", {
          cx: i.value.width / 2,
          cy: i.value.height / 2,
          r: $.value <= 0 ? 10 : $.value,
          fill: e.value.style.chart.backgroundColor,
          filter: e.value.style.chart.layout.donut.useShadow ? `url(#shadow_${x.value})` : ""
        }, null, 8, Nl),
        m.value ? (s(), n(V, { key: 0 }, [
          (s(!0), n(V, null, W(A.value, (l, u) => (s(), n("path", {
            stroke: e.value.style.chart.backgroundColor,
            d: l.arcSlice,
            fill: "#FFFFFF"
          }, null, 8, Pl))), 256)),
          (s(!0), n(V, null, W(A.value, (l, u) => (s(), n("path", {
            class: "vue-ui-donut-arc-path",
            d: l.arcSlice,
            fill: `${l.color}CC`,
            stroke: e.value.style.chart.backgroundColor,
            "stroke-width": e.value.style.chart.layout.donut.borderWidth,
            filter: ae(u)
          }, null, 8, Ol))), 256))
        ], 64)) : (s(), n("circle", {
          key: 1,
          cx: i.value.width / 2,
          cy: i.value.height / 2,
          r: $.value <= 0 ? 10 : $.value,
          fill: e.value.style.chart.backgroundColor,
          stroke: o(al)(e.value.style.chart.background)
        }, null, 8, Al)),
        e.value.style.chart.useGradient ? (s(), n("circle", {
          key: 2,
          cx: i.value.width / 2,
          cy: i.value.height / 2,
          r: (
            /* This might require adjustments */
            $.value <= 0 ? 10 : $.value
          ),
          fill: `url(#gradient_${x.value})`
        }, null, 8, Dl)) : v("", !0),
        m.value ? (s(!0), n(V, { key: 3 }, W(A.value, (l, u) => (s(), n("path", {
          "data-cy-donut-trap": "",
          d: l.arcSlice,
          fill: z.value === u ? "rgba(0,0,0,0.1)" : "transparent",
          onMouseenter: (r) => Ie({
            datapoint: l,
            relativeIndex: u,
            seriesIndex: l.seriesIndex,
            show: !0
          }),
          onMouseleave: a[0] || (a[0] = (r) => {
            ee.value = !1, z.value = null;
          }),
          onClick: (r) => K(l, u)
        }, null, 40, Il))), 256)) : v("", !0),
        e.value.style.chart.layout.labels.hollow.show ? (s(), n("circle", {
          key: 4,
          cx: i.value.width / 2,
          cy: i.value.height / 2,
          r: (
            /* This might require adjustments */
            $.value - U.value <= 0 ? 10 : $.value - U.value
          ),
          fill: e.value.style.chart.backgroundColor
        }, null, 8, Bl)) : v("", !0),
        e.value.style.chart.layout.labels.hollow.total.show ? (s(), n("text", {
          key: 5,
          "text-anchor": "middle",
          x: i.value.width / 2,
          y: i.value.height / 2 - (e.value.style.chart.layout.labels.hollow.average.show ? e.value.style.chart.layout.labels.hollow.total.fontSize : 0) + e.value.style.chart.layout.labels.hollow.total.offsetY,
          fill: e.value.style.chart.layout.labels.hollow.total.color,
          "font-size": e.value.style.chart.layout.labels.hollow.total.fontSize,
          style: S(`font-weight:${e.value.style.chart.layout.labels.hollow.total.bold ? "bold" : ""}`)
        }, _(e.value.style.chart.layout.labels.hollow.total.text), 13, Vl)) : v("", !0),
        e.value.style.chart.layout.labels.hollow.total.show ? (s(), n("text", {
          key: 6,
          "text-anchor": "middle",
          x: i.value.width / 2,
          y: i.value.height / 2 + e.value.style.chart.layout.labels.hollow.total.fontSize - (e.value.style.chart.layout.labels.hollow.average.show ? e.value.style.chart.layout.labels.hollow.total.fontSize : 0) + e.value.style.chart.layout.labels.hollow.total.value.offsetY,
          fill: e.value.style.chart.layout.labels.hollow.total.value.color,
          "font-size": e.value.style.chart.layout.labels.hollow.total.value.fontSize,
          style: S(`font-weight:${e.value.style.chart.layout.labels.hollow.total.value.bold ? "bold" : ""}`)
        }, _(o(T)(
          e.value.style.chart.layout.labels.hollow.total.value.formatter,
          m.value,
          o(C)({
            p: e.value.style.chart.layout.labels.hollow.total.value.prefix,
            v: m.value,
            s: e.value.style.chart.layout.labels.hollow.total.value.suffix
          })
        )), 13, Ml)) : v("", !0),
        e.value.style.chart.layout.labels.hollow.average.show ? (s(), n("text", {
          key: 7,
          "text-anchor": "middle",
          x: i.value.width / 2,
          y: i.value.height / 2 + (e.value.style.chart.layout.labels.hollow.total.show ? e.value.style.chart.layout.labels.hollow.average.fontSize : 0) + e.value.style.chart.layout.labels.hollow.average.offsetY,
          fill: e.value.style.chart.layout.labels.hollow.average.color,
          "font-size": e.value.style.chart.layout.labels.hollow.average.fontSize,
          style: S(`font-weight:${e.value.style.chart.layout.labels.hollow.average.bold ? "bold" : ""}`)
        }, _(e.value.style.chart.layout.labels.hollow.average.text), 13, Gl)) : v("", !0),
        e.value.style.chart.layout.labels.hollow.average.show ? (s(), n("text", {
          key: 8,
          "text-anchor": "middle",
          x: i.value.width / 2,
          y: i.value.height / 2 + (e.value.style.chart.layout.labels.hollow.total.show ? e.value.style.chart.layout.labels.hollow.average.fontSize : 0) + e.value.style.chart.layout.labels.hollow.average.fontSize + e.value.style.chart.layout.labels.hollow.average.value.offsetY,
          fill: e.value.style.chart.layout.labels.hollow.average.value.color,
          "font-size": e.value.style.chart.layout.labels.hollow.average.value.fontSize,
          style: S(`font-weight:${e.value.style.chart.layout.labels.hollow.average.value.bold ? "bold" : ""}`)
        }, _(O.value ? "--" : o(T)(
          e.value.style.chart.layout.labels.hollow.average.value.formatter,
          ke.value,
          o(C)({
            p: e.value.style.chart.layout.labels.hollow.average.value.prefix,
            v: ke.value,
            s: e.value.style.chart.layout.labels.hollow.average.value.suffix,
            r: e.value.style.chart.layout.labels.hollow.average.value.rounding
          })
        )), 13, El)) : v("", !0),
        (s(!0), n(V, null, W(A.value, (l, u) => (s(), n("g", {
          filter: ae(u),
          class: ue({ animated: e.value.useCssAnimation })
        }, [
          e.value.style.chart.layout.labels.dataLabels.useLabelSlots ? (s(), n("g", jl, [
            (s(), n("foreignObject", {
              x: o(y)(l, !0).anchor === "end" ? o(y)(l).x - 120 : o(y)(l, !0).anchor === "middle" ? o(y)(l).x - 60 : o(y)(l).x,
              y: o(X)(l) - (Ce.value ? 20 : 0),
              width: "120",
              height: "60",
              style: { overflow: "visible" }
            }, [
              b("div", null, [
                p(t.$slots, "dataLabel", Y(H({
                  datapoint: l,
                  isBlur: !e.value.useBlurOnHover || [null, void 0].includes(z.value) || z.value === u,
                  isSafari: Ce.value,
                  isVisible: B(l) && f.value.dataLabels.show,
                  textAlign: o(y)(l, !0, 16, !0).anchor,
                  flexAlign: o(y)(l, !0, 16).anchor,
                  percentage: we(l, A.value)
                })), void 0, !0)
              ])
            ], 8, Rl))
          ])) : (s(), n("g", Yl, [
            B(l) && f.value.dataLabels.show ? (s(), n("circle", {
              key: 0,
              cx: o(y)(l).x,
              cy: o(X)(l) - 3.5,
              fill: l.color,
              r: 3,
              filter: !e.value.useBlurOnHover || [null, void 0].includes(z.value) || z.value === u ? "" : `url(#blur_${x.value})`,
              onClick: (r) => K(l, u)
            }, null, 8, Hl)) : v("", !0),
            B(l) && f.value.dataLabels.show ? (s(), n("text", {
              key: 1,
              "text-anchor": o(y)(l, !0, 12).anchor,
              x: o(y)(l, !0, 12).x,
              y: o(X)(l),
              fill: e.value.style.chart.layout.labels.percentage.color,
              "font-size": e.value.style.chart.layout.labels.percentage.fontSize,
              style: S(`font-weight:${e.value.style.chart.layout.labels.percentage.bold ? "bold" : ""}`),
              onClick: (r) => K(l, u)
            }, _(we(l, A.value)) + " " + _(e.value.style.chart.layout.labels.value.show ? `(${o(T)(
              e.value.style.chart.layout.labels.value.formatter,
              l.value,
              o(C)({
                p: e.value.style.chart.layout.labels.dataLabels.prefix,
                v: l.value,
                s: e.value.style.chart.layout.labels.dataLabels.suffix,
                r: e.value.style.chart.layout.labels.value.rounding
              }),
              { datapoint: l }
            )})` : ""), 13, Wl)) : v("", !0),
            B(l) && f.value.dataLabels.show ? (s(), n("text", {
              key: 2,
              "text-anchor": o(y)(l).anchor,
              x: o(y)(l, !0, 12).x,
              y: o(X)(l) + e.value.style.chart.layout.labels.percentage.fontSize,
              fill: e.value.style.chart.layout.labels.name.color,
              "font-size": e.value.style.chart.layout.labels.name.fontSize,
              style: S(`font-weight:${e.value.style.chart.layout.labels.name.bold ? "bold" : ""}`),
              onClick: (r) => K(l, u)
            }, _(l.name), 13, Xl)) : v("", !0)
          ])),
          f.value.dataLabels.show && e.value.style.chart.comments.show && l.comment ? (s(), n("g", ql, [
            B(l) ? (s(), n("foreignObject", {
              key: 0,
              x: e.value.style.chart.comments.offsetX + (o(y)(l, !0).anchor === "end" ? o(y)(l).x - e.value.style.chart.comments.width : o(y)(l, !0).anchor === "middle" ? o(y)(l).x - e.value.style.chart.comments.width / 2 : o(y)(l).x),
              y: o(X)(l) + 24 + e.value.style.chart.comments.offsetY,
              width: e.value.style.chart.comments.width,
              height: "200",
              style: { overflow: "visible", "pointer-events": "none" }
            }, [
              b("div", null, [
                p(t.$slots, "plot-comment", {
                  plot: { ...l, textAlign: o(y)(l, !0, 16, !0).anchor, flexAlign: o(y)(l, !0, 16).anchor }
                }, void 0, !0)
              ])
            ], 8, Jl)) : v("", !0)
          ])) : v("", !0)
        ], 10, Ul))), 256)),
        p(t.$slots, "svg", { svg: i.value }, void 0, !0)
      ], 14, wl)) : v("", !0),
      t.$slots.watermark ? (s(), n("div", Kl, [
        p(t.$slots, "watermark", Y(H({ isPrinting: o(ce) || o(de) })), void 0, !0)
      ])) : v("", !0),
      G.value ? v("", !0) : (s(), Q(fl, {
        key: 4,
        config: {
          type: "donut",
          style: {
            backgroundColor: e.value.style.chart.backgroundColor,
            donut: {
              color: "#CCCCCC",
              strokeWidth: U.value * 0.8
            }
          }
        }
      }, null, 8, ["config"])),
      b("div", {
        ref_key: "chartLegend",
        ref: ie
      }, [
        e.value.style.chart.legend.show ? (s(), Q(yl, {
          key: 0,
          legendSet: me.value,
          config: Ae.value,
          onClickMarker: a[1] || (a[1] = ({ i: l }) => pe(l))
        }, {
          item: w(({ legend: l, index: u }) => [
            b("div", {
              onClick: (r) => l.segregate(),
              style: S(`opacity:${L.value.includes(u) ? 0.5 : 1}`)
            }, [
              Se(_(l.name) + ": " + _(o(T)(
                e.value.style.chart.layout.labels.value.formatter,
                l.value,
                o(C)({
                  p: e.value.style.chart.layout.labels.dataLabels.prefix,
                  v: l.value,
                  s: e.value.style.chart.layout.labels.dataLabels.suffix,
                  r: e.value.style.chart.legend.roundingValue
                }),
                {
                  datapoint: l,
                  index: u
                }
              )) + " ", 1),
              L.value.includes(u) ? (s(), n("span", et, " ( " + _(Ve(l.proportion * 100)) + " % ) ", 1)) : (s(), n("span", Zl, " (" + _(isNaN(l.value / m.value) ? "-" : o(T)(
                e.value.style.chart.layout.labels.percentage.formatter,
                O.value ? l.proportion * 100 : l.value / m.value * 100,
                o(C)({
                  v: O.value ? l.proportion * 100 : l.value / m.value * 100,
                  s: "%",
                  r: e.value.style.chart.legend.roundingPercentage
                })
              )) + ") ", 1))
            ], 12, Ql)
          ]),
          _: 1
        }, 8, ["legendSet", "config"])) : v("", !0),
        p(t.$slots, "legend", { legend: me.value }, void 0, !0)
      ], 512),
      se(hl, {
        show: f.value.showTooltip && ee.value,
        backgroundColor: e.value.style.chart.tooltip.backgroundColor,
        color: e.value.style.chart.tooltip.color,
        fontSize: e.value.style.chart.tooltip.fontSize,
        borderRadius: e.value.style.chart.tooltip.borderRadius,
        borderColor: e.value.style.chart.tooltip.borderColor,
        borderWidth: e.value.style.chart.tooltip.borderWidth,
        backgroundOpacity: e.value.style.chart.tooltip.backgroundOpacity,
        position: e.value.style.chart.tooltip.position,
        offsetY: e.value.style.chart.tooltip.offsetY,
        parent: E.value,
        content: le.value,
        isCustom: j.value
      }, {
        "tooltip-before": w(() => [
          p(t.$slots, "tooltip-before", Y(H({ ...te.value })), void 0, !0)
        ]),
        "tooltip-after": w(() => [
          p(t.$slots, "tooltip-after", Y(H({ ...te.value })), void 0, !0)
        ]),
        _: 3
      }, 8, ["show", "backgroundColor", "color", "fontSize", "borderRadius", "borderColor", "borderWidth", "backgroundOpacity", "position", "offsetY", "parent", "content", "isCustom"]),
      G.value ? (s(), Q(bl, {
        key: 5,
        hideDetails: "",
        config: {
          open: f.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: w(() => [
          se(dl, {
            colNames: J.value.colNames,
            head: J.value.head,
            body: J.value.body,
            config: J.value.config,
            title: `${e.value.style.chart.title.text}${e.value.style.chart.title.subtitle.text ? ` : ${e.value.style.chart.title.subtitle.text}` : ""}`,
            onClose: a[2] || (a[2] = (l) => f.value.showTable = !1)
          }, {
            th: w(({ th: l }) => [
              b("div", {
                innerHTML: l,
                style: { display: "flex", "align-items": "center" }
              }, null, 8, lt)
            ]),
            td: w(({ td: l }) => [
              Se(_(l.name ? l.name : isNaN(Number(l)) ? l.includes("%") ? o(T)(
                e.value.style.chart.layout.labels.percentage.formatter,
                l,
                o(C)({
                  v: l,
                  s: "%",
                  r: e.value.style.chart.layout.labels.percentage.rounding
                })
              ) : l : o(T)(
                e.value.style.chart.layout.labels.value.formatter,
                l,
                o(C)({
                  p: e.value.style.chart.layout.labels.dataLabels.prefix,
                  v: l,
                  s: e.value.style.chart.layout.labels.dataLabels.suffix,
                  r: e.value.style.chart.layout.labels.value.rounding
                })
              )), 1)
            ]),
            _: 1
          }, 8, ["colNames", "head", "body", "config", "title"])
        ]),
        _: 1
      }, 8, ["config"])) : v("", !0)
    ], 14, ml));
  }
}, ft = /* @__PURE__ */ gl(tt, [["__scopeId", "data-v-8cc49fb9"]]);
export {
  ft as default
};
