import { computed as g, ref as i, watch as Ue, onMounted as at, onBeforeUnmount as ot, openBlock as u, createElementBlock as n, normalizeClass as P, normalizeStyle as Q, unref as r, createBlock as D, createCommentVNode as h, createSlots as st, withCtx as m, renderSlot as k, normalizeProps as E, guardReactiveProps as R, createVNode as Be, createElementVNode as p, Fragment as _, renderList as T, toDisplayString as N, createTextVNode as Z, nextTick as ut, pushScopeId as nt, popScopeId as rt } from "vue";
import { u as it, c as dt, t as ct, a as vt, p as j, o as ht, e as M, b as ft, J as Ee, d as yt, m as Re, f as C, X as pt, s as Ge, L as bt, k as U, n as de, i as G, x as Ye, y as gt, q as mt, r as kt } from "./index-MWHrTFPq.js";
import { t as wt, u as $t } from "./useResponsive-CoxXLe23.js";
import { _ as Lt } from "./Title-C7EOYmwp.js";
import { u as _t, U as Ct } from "./usePrinter-CEEgHfhF.js";
import { D as xt } from "./DataTable-DtvVWOjy.js";
import { _ as Ft } from "./Tooltip-Bip4kr-u.js";
import { L as Tt } from "./Legend-CUhyETYn.js";
import St from "./vue-ui-skeleton-Bo8ydREb.js";
import Nt from "./vue-ui-accordion-BnV2tlGp.js";
import { u as Xe } from "./useNestedProp-CTDeT4KA.js";
import { _ as Ot } from "./PackageVersion-CBKqLhAX.js";
import { P as It } from "./PenAndPaper-DtLD2Sq6.js";
import { u as At } from "./useUserOptionState-BIvW1Kz7.js";
import { _ as Pt } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const ce = (B) => (nt("data-v-7b38ae51"), B = B(), rt(), B), Dt = ["id"], zt = ["xmlns", "viewBox"], Vt = ["width", "height"], Mt = ["id"], Ut = /* @__PURE__ */ ce(() => /* @__PURE__ */ p("stop", {
  offset: "0%",
  "stop-color": "#FFFFFF",
  "stop-opacity": "0"
}, null, -1)), Bt = ["offset", "stop-color"], Et = ["offset", "stop-opacity"], Rt = /* @__PURE__ */ ce(() => /* @__PURE__ */ p("stop", {
  offset: "100%",
  "stop-color": "#FFFFFF",
  "stop-opacity": "0"
}, null, -1)), Gt = ["id"], Yt = ["id"], Xt = /* @__PURE__ */ ce(() => /* @__PURE__ */ p("feColorMatrix", {
  type: "saturate",
  values: "0"
}, null, -1)), Ht = ["id"], Wt = ["flood-color"], qt = ["d", "fill", "stroke", "stroke-width", "filter"], Jt = { key: 1 }, Kt = ["d", "fill"], Qt = { key: 2 }, Zt = ["x", "y", "font-size", "font-weight", "fill"], jt = { key: 3 }, el = ["filter"], tl = ["text-anchor", "x", "y", "fill", "font-size", "font-weight"], ll = ["text-anchor", "x", "y", "fill", "font-size", "font-weight"], al = ["text-anchor", "x", "y", "fill", "font-size", "font-weight"], ol = ["d", "fill", "onMouseenter", "onClick"], sl = {
  key: 5,
  class: "vue-data-ui-watermark"
}, ul = {
  key: 0,
  class: "vue-ui-nested-donuts-legend-title"
}, nl = ["onClick"], rl = ["innerHTML"], il = {
  __name: "vue-ui-nested-donuts",
  props: {
    config: {
      type: Object,
      default() {
        return {};
      }
    },
    dataset: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  emits: ["selectLegend", "selectDatapoint"],
  setup(B, { expose: He, emit: ve }) {
    const O = B, { vue_ui_nested_donuts: We } = it(), Y = g(() => !!O.dataset && O.dataset.length), w = i(dt()), ee = i(!1), te = i(""), qe = i(null), he = i(0), z = i(null), fe = i(null), le = i(null), ye = i(null), pe = i(null), be = i(0), ge = i(0), me = i(0), V = i(!1);
    function Je(t) {
      V.value = t, he.value += 1;
    }
    const e = g({
      get: () => $e(),
      set: (t) => t
    }), { userOptionsVisible: ae, setUserOptionsVisibility: ke, keepUserOptionState: we } = At({ config: e.value });
    function $e() {
      const t = Xe({
        userConfig: O.config,
        defaultConfig: We
      });
      return t.theme ? {
        ...Xe({
          userConfig: ct.vue_ui_nested_donuts[t.theme] || O.config,
          defaultConfig: t
        }),
        customPalette: vt[t.theme] || j
      } : t;
    }
    Ue(() => O.config, (t) => {
      e.value = $e(), ae.value = !e.value.showOnChartHover, Le(), be.value += 1, ge.value += 1, me.value += 1;
    }, { deep: !0 });
    const X = i(null);
    at(() => {
      Le();
    });
    function Le() {
      if (ht(O.dataset) && M({
        componentName: "VueUiNestedDonuts",
        type: "dataset"
      }), e.value.responsive) {
        const t = wt(() => {
          const { width: s, height: a } = $t({
            chart: z.value,
            title: e.value.style.chart.title.text ? fe.value : null,
            legend: e.value.style.chart.legend.show ? le.value : null,
            source: ye.value,
            noTitle: pe.value
          });
          v.value.width = s, v.value.height = a;
        });
        X.value = new ResizeObserver(t), X.value.observe(z.value.parentNode);
      }
    }
    ot(() => {
      X.value && X.value.disconnect();
    });
    const { isPrinting: _e, isImaging: Ce, generatePdf: xe, generateImage: Fe } = _t({
      elementId: `nested_donuts_${w.value}`,
      fileName: e.value.style.chart.title.text || "vue-ui-nested-donuts"
    }), Ke = g(() => e.value.userOptions.show && !e.value.style.chart.title.text), Qe = g(() => ft(e.value.customPalette)), $ = i({
      dataLabels: {
        show: e.value.style.chart.layout.labels.dataLabels.show
      },
      showTable: e.value.table.show,
      showTooltip: e.value.style.chart.tooltip.show
    }), v = i({
      height: 512,
      width: 512
    });
    function Ze({ datapoint: t, index: s }) {
      ve("selectDatapoint", { datapoint: t, index: s });
    }
    const y = i([]), x = g(() => (O.dataset.forEach((t, s) => {
      [null, void 0].includes(t.name) && M({
        componentName: "VueUiNestedDonuts",
        type: "datasetSerieAttribute",
        property: "name",
        index: s
      }), [null, void 0].includes(t.series) ? M({
        componentName: "VueUiNestedDonuts",
        type: "datasetSerieAttribute",
        property: "series",
        index: s
      }) : t.series.length === 0 ? M({
        componentName: "VueUiNestedDonuts",
        type: "datasetAttributeEmpty",
        property: `series at index ${s}`
      }) : t.series.forEach((a, o) => {
        [null, void 0].includes(a.name) && M({
          componentName: "VueUiNestedDonuts",
          type: "datasetSerieAttribute",
          property: "name",
          index: o,
          key: "serie"
        }), [null, void 0].includes(a.values) && M({
          componentName: "VueUiNestedDonuts",
          type: "datasetSerieAttribute",
          property: "values",
          index: o,
          key: "serie"
        });
      });
    }), O.dataset.map((t, s) => ({
      ...t,
      total: t.series.filter((a) => !y.value.includes(a.id)).map((a) => Ee(a.values).reduce((o, l) => o + l, 0)).reduce((a, o) => a + o, 0),
      datasetIndex: s,
      id: `${w.value}_${s}`,
      series: t.series.map((a, o) => ({
        name: a.name,
        arcOf: t.name,
        arcOfId: `${w.value}_${s}`,
        id: `${w.value}_${s}_${o}`,
        seriesIndex: o,
        datasetIndex: s,
        color: yt(a.color) || Qe.value[o] || j[o] || j[o % j.length],
        value: Ee(a.values).reduce((l, d) => l + d, 0),
        absoluteValues: a.values || []
      }))
    })))), F = g(() => Math.min(v.value.height, v.value.width) * (e.value.style.chart.layout.donut.strokeWidth / 512)), Te = g(() => [...x.value].map((t, s) => {
      const a = t.series.filter((o) => !y.value.includes(o.id)).map((o) => o.value).reduce((o, l) => o + l, 0);
      return {
        ...t,
        total: a,
        series: t.series.filter((o) => !y.value.includes(o.id)).map((o) => ({
          ...o,
          proportion: o.value / a
        }))
      };
    }));
    function je(t, s, a) {
      let o = 0;
      for (let l = 0; l < t.length; l += 1)
        a.includes(t[l]) && (o += 1);
      return o < s;
    }
    const f = i(Te.value);
    Ue(() => Te.value, (t) => f.value = t);
    const Se = i(null), Ne = i(null);
    function oe(t) {
      ve("selectLegend", t);
      const s = x.value.flatMap((c) => c.series).find((c) => c.id === t.id), a = f.value.flatMap((c) => c.series).find((c) => c.id === t.id);
      let l = a ? a.value : 0;
      const d = x.value.find((c) => c.id === s.arcOfId).series.map((c) => c.id), b = je(d, d.length - 1, y.value);
      if (y.value.includes(t.id)) {
        let c = function() {
          l > s.value ? (cancelAnimationFrame(Se.value), f.value = f.value.map((L) => ({
            ...L,
            series: L.series.map((S) => S.id == t.id ? {
              ...S,
              value: s.value
            } : S)
          }))) : (l += s.value * 0.025, f.value = f.value.map((L) => ({
            ...L,
            series: L.series.map((S) => S.id === t.id ? {
              ...S,
              value: l
            } : S)
          })), Se.value = requestAnimationFrame(c));
        };
        y.value = y.value.filter((L) => L !== t.id), c();
      } else if (b) {
        let c = function() {
          l < 0.1 ? (cancelAnimationFrame(Ne.value), y.value.push(t.id), f.value = f.value.map((L, S) => ({
            ...L,
            series: L.series.map((A) => A.id === t.id ? {
              ...A,
              value: 0
            } : A)
          }))) : (l /= 1.1, f.value = f.value.map((L, S) => ({
            ...L,
            series: L.series.map((A) => A.id === t.id ? {
              ...A,
              value: l
            } : A)
          })), Ne.value = requestAnimationFrame(c));
        };
        c();
      }
    }
    const se = g(() => F.value / x.value.length * e.value.style.chart.layout.donut.spacingRatio), Oe = g(() => f.value.map((t, s) => F.value - s * F.value / x.value.length)), H = g(() => f.value.map((t, s) => {
      const a = s * F.value / x.value.length;
      return {
        ...t,
        radius: F.value - a,
        donut: Re(
          { series: t.series },
          v.value.width / 2,
          v.value.height / 2,
          F.value - a,
          F.value - a,
          1.99999,
          2,
          1,
          360,
          105.25,
          se.value
        )
      };
    })), Ie = g(() => [...x.value].map((t, s) => {
      const a = s * F.value / x.value.length;
      return {
        sizeRatio: a,
        donut: Re(
          { series: [{ value: 1 }] },
          v.value.width / 2,
          v.value.height / 2,
          F.value - a,
          F.value - a,
          1.99999,
          2,
          1,
          360,
          105.25,
          F.value / x.value.length * e.value.style.chart.layout.donut.spacingRatio
        )[0]
      };
    })), Ae = i(null), W = i(null), q = i(null), ue = i(null);
    function et({ datapoint: t, _relativeIndex: s, seriesIndex: a }) {
      Ae.value = t.arcOfId, W.value = t.id, q.value = a, ue.value = {
        datapoint: t,
        seriesIndex: a,
        series: f.value,
        config: e.value
      };
      const o = e.value.style.chart.tooltip.customFormat;
      if (Ye(o) && gt(() => o({
        seriesIndex: a,
        datapoint: t,
        series: f.value,
        config: e.value
      })))
        te.value = o({
          seriesIndex: a,
          datapoint: t,
          series: f.value,
          config: e.value
        });
      else {
        let l = "";
        if (e.value.style.chart.tooltip.showAllItemsAtIndex && y.value.length === 0) {
          const d = f.value.map((b) => b.series.find((c) => c.seriesIndex === a));
          d.forEach((b, c) => {
            if (!b) return "";
            l += `
                    <div style="display:flex; flex-direction: column; justify-content:flex-start; align-items:flex-start;padding:6px 0; ${c < d.length - 1 ? `border-bottom:1px solid ${e.value.style.chart.tooltip.borderColor}` : ""}">
                        <div style="display:flex; flex-direction: row; gap: 3px; justify-content:flex-start; align-items:center;">
                            <svg viewBox="0 0 20 20" height="${e.value.style.chart.tooltip.fontSize}" width="${e.value.style.chart.tooltip.fontSize}">
                                <circle cx="10" cy="10" r="10" fill="${b.color}"/>
                            </svg>
                            <span>
                                ${b.arcOf ?? ""} - ${b.name}
                            </span>
                        </div>
                        <span>
                            ${e.value.style.chart.tooltip.showValue ? `<b>${G(
              e.value.style.chart.layout.labels.dataLabels.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, seriesIndex: a }
            )}
                        </b>` : ""}
                            ${e.value.style.chart.tooltip.showPercentage ? `(${C({
              v: b.proportion * 100,
              s: "%",
              r: e.value.style.chart.tooltip.roundingPercentage
            })})` : ""}
                        </span>
                    </div>
                `;
          });
        } else
          l += `<div style="width:100%;text-align:center;border-bottom:1px solid ${e.value.style.chart.tooltip.borderColor};padding-bottom:6px;margin-bottom:3px;">${t.arcOf ?? ""} - ${t.name}</div>`, l += `<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 && (l += `<b>${G(
            e.value.style.chart.layout.labels.dataLabels.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, seriesIndex: a }
          )}</b>`), e.value.style.chart.tooltip.showPercentage && (e.value.style.chart.tooltip.showValue ? l += `<span>(${C({
            v: t.proportion * 100,
            s: "%",
            r: e.value.style.chart.tooltip.roundingPercentage
          })})</span></div>` : l += `<b>${C({
            v: t.proportion * 100,
            s: "%",
            r: e.value.style.chart.tooltip.roundingPercentage
          })}</b></div>`);
        te.value = `<div style="font-size:${e.value.style.chart.tooltip.fontSize}px">${l}</div>`;
      }
      ee.value = !0;
    }
    function ne(t) {
      return t.proportion * 100 > e.value.style.chart.layout.labels.dataLabels.hideUnderValue;
    }
    function Pe(t, s) {
      if (!e.value.useBlurOnHover)
        return "";
      if (e.value.style.chart.tooltip.showAllItemsAtIndex && y.value.length === 0)
        return [null, void 0].includes(q.value) || q.value === s ? "" : `url(#blur_${w.value})`;
      if (!e.value.style.chart.tooltip.showAllItemsAtIndex || y.value.length)
        return [null, void 0].includes(W.value) || W.value === t.id ? "" : `url(#blur_${w.value})`;
    }
    const re = g(() => x.value.map((t, s) => t.series.map((a, o) => ({
      name: a.name,
      color: a.color,
      value: a.value,
      shape: "circle",
      arcOf: a.arcOf,
      id: a.id,
      seriesIndex: o,
      datasetIndex: s,
      total: t.series.filter((l) => !y.value.includes(l.id)).map((l) => l.value).reduce((l, d) => l + d, 0)
    })).map((a) => ({
      ...a,
      opacity: y.value.includes(a.id) ? 0.5 : 1,
      segregate: () => oe(a),
      isSegregated: y.value.includes(a.id)
    })))), tt = g(() => ({
      cy: "nested-donuts-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" : ""
    })), I = g(() => {
      const t = f.value.flatMap((a) => a.series.map((o) => ({
        name: `${a.name} - ${o.name}`,
        color: o.color,
        total: a.total
      }))), s = f.value.flatMap((a) => a.series.map((o) => o.value));
      return { head: t, body: s };
    });
    function De() {
      ut(() => {
        const t = I.value.head.map((o, l) => [[
          o.name
        ], [I.value.body[l]], [isNaN(I.value.body[l] / o.total) ? "-" : I.value.body[l] / o.total * 100]]), s = [[e.value.style.chart.title.text], [e.value.style.chart.title.subtitle.text], [[""], ["val"], ["%"]]].concat(t), a = mt(s);
        kt({ csvContent: a, title: e.value.style.chart.title.text || "vue-ui-nested-donuts" });
      });
    }
    const J = g(() => {
      const t = [
        e.value.table.columnNames.series,
        e.value.table.columnNames.value,
        e.value.table.columnNames.percentage
      ], s = I.value.head.map((l, d) => {
        const b = C({ p: e.value.style.chart.layout.labels.dataLabels.prefix, v: I.value.body[d], s: e.value.style.chart.layout.labels.dataLabels.suffix, r: e.value.table.td.roundingValue });
        return [
          {
            color: l.color,
            name: l.name
          },
          b,
          isNaN(I.value.body[d] / l.total) ? "-" : C({
            v: I.value.body[d] / l.total * 100,
            s: "%",
            r: e.value.table.td.roundingPercentage
          })
        ];
      }), a = {
        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: s,
        config: a
      };
    });
    function lt() {
      return x.value;
    }
    function ze() {
      $.value.showTable = !$.value.showTable;
    }
    function Ve() {
      $.value.dataLabels.show = !$.value.dataLabels.show;
    }
    function Me() {
      $.value.showTooltip = !$.value.showTooltip;
    }
    const K = i(!1);
    function ie() {
      K.value = !K.value;
    }
    return He({
      getData: lt,
      generatePdf: xe,
      generateCsv: De,
      generateImage: Fe,
      toggleTable: ze,
      toggleLabels: Ve,
      toggleTooltip: Me,
      toggleAnnotator: ie
    }), (t, s) => (u(), n("div", {
      ref_key: "nestedDonutsChart",
      ref: z,
      class: P(`vue-ui-nested-donuts ${V.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: `nested_donuts_${w.value}`,
      onMouseenter: s[3] || (s[3] = () => r(ke)(!0)),
      onMouseleave: s[4] || (s[4] = () => r(ke)(!1))
    }, [
      e.value.userOptions.buttons.annotator ? (u(), D(It, {
        key: 0,
        parent: z.value,
        backgroundColor: e.value.style.chart.backgroundColor,
        color: e.value.style.chart.color,
        active: K.value,
        onClose: ie
      }, null, 8, ["parent", "backgroundColor", "color", "active"])) : h("", !0),
      Ke.value ? (u(), n("div", {
        key: 1,
        ref_key: "noTitle",
        ref: pe,
        class: "vue-data-ui-no-title-space",
        style: "height:36px; width: 100%;background:transparent"
      }, null, 512)) : h("", !0),
      e.value.style.chart.title.text ? (u(), n("div", {
        key: 2,
        ref_key: "chartTitle",
        ref: fe
      }, [
        (u(), D(Lt, {
          key: `title_${be.value}`,
          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"]))
      ], 512)) : h("", !0),
      e.value.userOptions.show && Y.value && (r(we) || r(ae)) ? (u(), D(Ct, {
        ref: "details",
        key: `user_option_${he.value}`,
        backgroundColor: e.value.style.chart.backgroundColor,
        color: e.value.style.chart.color,
        isPrinting: r(_e),
        isImaging: r(Ce),
        uid: w.value,
        hasTooltip: e.value.userOptions.buttons.tooltip && e.value.style.chart.tooltip.show,
        hasPdf: e.value.userOptions.buttons.pdf,
        hasXls: e.value.userOptions.buttons.csv,
        hasImg: e.value.userOptions.buttons.img,
        hasTable: e.value.userOptions.buttons.table,
        hasLabel: e.value.userOptions.buttons.labels,
        hasFullscreen: e.value.userOptions.buttons.fullscreen,
        isFullscreen: V.value,
        isTooltip: $.value.showTooltip,
        titles: { ...e.value.userOptions.buttonTitles },
        chartElement: z.value,
        position: e.value.userOptions.position,
        hasAnnotator: e.value.userOptions.buttons.annotator,
        isAnnotation: K.value,
        onToggleFullscreen: Je,
        onGeneratePdf: r(xe),
        onGenerateCsv: De,
        onGenerateImage: r(Fe),
        onToggleTable: ze,
        onToggleLabels: Ve,
        onToggleTooltip: Me,
        onToggleAnnotator: ie,
        style: Q({
          visibility: r(we) ? r(ae) ? "visible" : "hidden" : "visible"
        })
      }, st({ _: 2 }, [
        t.$slots.optionTooltip ? {
          name: "optionTooltip",
          fn: m(() => [
            k(t.$slots, "optionTooltip", {}, void 0, !0)
          ]),
          key: "0"
        } : void 0,
        t.$slots.optionPdf ? {
          name: "optionPdf",
          fn: m(() => [
            k(t.$slots, "optionPdf", {}, void 0, !0)
          ]),
          key: "1"
        } : void 0,
        t.$slots.optionCsv ? {
          name: "optionCsv",
          fn: m(() => [
            k(t.$slots, "optionCsv", {}, void 0, !0)
          ]),
          key: "2"
        } : void 0,
        t.$slots.optionImg ? {
          name: "optionImg",
          fn: m(() => [
            k(t.$slots, "optionImg", {}, void 0, !0)
          ]),
          key: "3"
        } : void 0,
        t.$slots.optionTable ? {
          name: "optionTable",
          fn: m(() => [
            k(t.$slots, "optionTable", {}, void 0, !0)
          ]),
          key: "4"
        } : void 0,
        t.$slots.optionLabels ? {
          name: "optionLabels",
          fn: m(() => [
            k(t.$slots, "optionLabels", {}, void 0, !0)
          ]),
          key: "5"
        } : void 0,
        t.$slots.optionFullscreen ? {
          name: "optionFullscreen",
          fn: m(({ toggleFullscreen: a, isFullscreen: o }) => [
            k(t.$slots, "optionFullscreen", E(R({ toggleFullscreen: a, isFullscreen: o })), void 0, !0)
          ]),
          key: "6"
        } : void 0,
        t.$slots.optionAnnotator ? {
          name: "optionAnnotator",
          fn: m(({ toggleAnnotator: a, isAnnotator: o }) => [
            k(t.$slots, "optionAnnotator", E(R({ toggleAnnotator: a, isAnnotator: o })), void 0, !0)
          ]),
          key: "7"
        } : void 0
      ]), 1032, ["backgroundColor", "color", "isPrinting", "isImaging", "uid", "hasTooltip", "hasPdf", "hasXls", "hasImg", "hasTable", "hasLabel", "hasFullscreen", "isFullscreen", "isTooltip", "titles", "chartElement", "position", "hasAnnotator", "isAnnotation", "onGeneratePdf", "onGenerateImage", "style"])) : h("", !0),
      Y.value ? (u(), n("svg", {
        key: 4,
        xmlns: r(pt),
        class: P({ "vue-data-ui-fullscreen--on": V.value, "vue-data-ui-fulscreen--off": !V.value }),
        viewBox: `0 0 ${v.value.width <= 0 ? 1e-3 : v.value.width} ${v.value.height < 0 ? 1e-3 : v.value.height}`,
        style: Q(`max-width:100%; overflow: visible; background:transparent;color:${e.value.style.chart.color}`)
      }, [
        Be(Ot),
        t.$slots["chart-background"] ? (u(), n("foreignObject", {
          key: 0,
          x: 0,
          y: 0,
          width: v.value.width <= 0 ? 1e-3 : v.value.width,
          height: v.value.height < 0 ? 1e-3 : v.value.height,
          style: {
            pointerEvents: "none"
          }
        }, [
          k(t.$slots, "chart-background", {}, void 0, !0)
        ], 8, Vt)) : h("", !0),
        p("defs", null, [
          (u(!0), n(_, null, T(Ie.value, (a, o) => (u(), n("radialGradient", {
            id: `radial_${w.value}_${o}`
          }, [
            Ut,
            p("stop", {
              offset: `${(1 - se.value / Oe.value[o]) * 100}%`,
              "stop-color": r(Ge)("#FFFFFF", 0),
              "stop-opacity": "0"
            }, null, 8, Bt),
            p("stop", {
              offset: `${(1 - se.value / Oe.value[o] / 2) * 100}%`,
              "stop-color": "#FFFFFF",
              "stop-opacity": e.value.style.chart.gradientIntensity / 100
            }, null, 8, Et),
            Rt
          ], 8, Mt))), 256))
        ]),
        p("defs", null, [
          p("filter", {
            id: `blur_${w.value}`,
            x: "-50%",
            y: "-50%",
            width: "200%",
            height: "200%"
          }, [
            p("feGaussianBlur", {
              in: "SourceGraphic",
              stdDeviation: 2,
              id: `blur_std_${w.value}`
            }, null, 8, Yt),
            Xt
          ], 8, Gt),
          p("filter", {
            id: `shadow_${w.value}`,
            "color-interpolation-filters": "sRGB"
          }, [
            p("feDropShadow", {
              dx: "0",
              dy: "0",
              stdDeviation: "10",
              "flood-opacity": "0.5",
              "flood-color": e.value.style.chart.layout.donut.shadowColor
            }, null, 8, Wt)
          ], 8, Ht)
        ]),
        (u(!0), n(_, null, T(H.value, (a, o) => (u(), n("g", null, [
          (u(!0), n(_, null, T(a.donut, (l, d) => (u(), n("g", null, [
            p("path", {
              class: "vue-ui-donut-arc-path",
              d: l.arcSlice,
              fill: r(Ge)(l.color, 80),
              stroke: e.value.style.chart.backgroundColor,
              "stroke-width": e.value.style.chart.layout.donut.borderWidth,
              filter: Pe(l, d)
            }, null, 8, qt)
          ]))), 256))
        ]))), 256)),
        e.value.style.chart.useGradient ? (u(), n("g", Jt, [
          (u(!0), n(_, null, T(Ie.value, (a, o) => (u(), n("g", null, [
            p("path", {
              d: a.donut.arcSlice,
              fill: `url(#radial_${w.value}_${o})`,
              stroke: "transparent",
              "stroke-width": "0"
            }, null, 8, Kt)
          ]))), 256))
        ])) : h("", !0),
        e.value.style.chart.layout.labels.dataLabels.showDonutName ? (u(), n("g", Qt, [
          (u(!0), n(_, null, T(H.value, (a, o) => (u(), n("g", null, [
            (u(!0), n(_, null, T(a.donut, (l, d) => (u(), n("g", null, [
              d === 0 && v.value.width && v.value.height ? (u(), n("text", {
                key: 0,
                class: P({ animated: e.value.useCssAnimation }),
                x: v.value.width / 2,
                y: l.startY - e.value.style.chart.layout.labels.dataLabels.fontSize + e.value.style.chart.layout.labels.dataLabels.donutNameOffsetY,
                "text-anchor": "middle",
                "font-size": e.value.style.chart.layout.labels.dataLabels.fontSize,
                "font-weight": e.value.style.chart.layout.labels.dataLabels.boldDonutName ? "bold" : "normal",
                fill: e.value.style.chart.layout.labels.dataLabels.color
              }, N(e.value.style.chart.layout.labels.dataLabels.donutNameAbbreviation ? r(bt)({ source: a.name, length: e.value.style.chart.layout.labels.dataLabels.donutNameMaxAbbreviationSize }) : a.name), 11, Zt)) : h("", !0)
            ]))), 256))
          ]))), 256))
        ])) : h("", !0),
        e.value.style.chart.layout.labels.dataLabels.show ? (u(), n("g", jt, [
          (u(!0), n(_, null, T(H.value, (a, o) => (u(), n("g", null, [
            (u(!0), n(_, null, T(a.donut, (l, d) => (u(), n("g", {
              filter: Pe(l, d)
            }, [
              ne(l) && $.value.dataLabels.show && e.value.style.chart.layout.labels.dataLabels.showPercentage ? (u(), n("text", {
                key: 0,
                class: P({ animated: e.value.useCssAnimation }),
                "text-anchor": r(U)(l, !0).anchor,
                x: r(U)(l, !1, e.value.style.chart.layout.labels.dataLabels.offsetX).x || 0,
                y: r(de)(l, e.value.style.chart.layout.labels.dataLabels.offsetY, e.value.style.chart.layout.labels.dataLabels.offsetY),
                fill: e.value.style.chart.layout.labels.dataLabels.useSerieColor ? l.color : e.value.style.chart.layout.labels.dataLabels.color,
                "font-size": e.value.style.chart.layout.labels.dataLabels.fontSize,
                "font-weight": e.value.style.chart.layout.labels.dataLabels.boldPercentage ? "bold" : "normal"
              }, N(r(C)({ v: l.proportion * 100, s: "%", r: e.value.style.chart.layout.labels.dataLabels.roundingPercentage })), 11, tl)) : h("", !0),
              ne(l) && $.value.dataLabels.show && e.value.style.chart.layout.labels.dataLabels.showPercentage && e.value.style.chart.layout.labels.dataLabels.showValue ? (u(), n("text", {
                key: 1,
                class: P({ animated: e.value.useCssAnimation }),
                "text-anchor": r(U)(l, !0).anchor,
                x: r(U)(l, !1, e.value.style.chart.layout.labels.dataLabels.offsetX).x || 0,
                y: r(de)(l, e.value.style.chart.layout.labels.dataLabels.offsetY, e.value.style.chart.layout.labels.dataLabels.offsetY) + e.value.style.chart.layout.labels.dataLabels.fontSize,
                fill: e.value.style.chart.layout.labels.dataLabels.useSerieColor ? l.color : e.value.style.chart.layout.labels.dataLabels.color,
                "font-size": e.value.style.chart.layout.labels.dataLabels.fontSize,
                "font-weight": e.value.style.chart.layout.labels.dataLabels.boldValue ? "bold" : "normal"
              }, " (" + N(r(G)(
                e.value.style.chart.layout.labels.dataLabels.formatter,
                l.value,
                r(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.dataLabels.roundingValue
                }),
                { datapoint: l, seriesIndex: o, datapointIndex: d }
              )) + ") ", 11, ll)) : h("", !0),
              ne(l) && $.value.dataLabels.show && !e.value.style.chart.layout.labels.dataLabels.showPercentage && e.value.style.chart.layout.labels.dataLabels.showValue ? (u(), n("text", {
                key: 2,
                class: P({ animated: e.value.useCssAnimation }),
                "text-anchor": r(U)(l, !0).anchor,
                x: r(U)(l, !1, e.value.style.chart.layout.labels.dataLabels.offsetX).x || 0,
                y: r(de)(l, e.value.style.chart.layout.labels.dataLabels.offsetY, e.value.style.chart.layout.labels.dataLabels.offsetY),
                fill: e.value.style.chart.layout.labels.dataLabels.useSerieColor ? l.color : e.value.style.chart.layout.labels.dataLabels.color,
                "font-size": e.value.style.chart.layout.labels.dataLabels.fontSize,
                "font-weight": e.value.style.chart.layout.labels.dataLabels.boldValue ? "bold" : "normal"
              }, N(r(G)(
                e.value.style.chart.layout.labels.dataLabels.formatter,
                l.value,
                r(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.dataLabels.roundingValue
                }),
                { datapoint: l, seriesIndex: o, datapointIndex: d }
              )), 11, al)) : h("", !0)
            ], 8, el))), 256))
          ]))), 256))
        ])) : h("", !0),
        (u(!0), n(_, null, T(H.value, (a, o) => (u(), n("g", null, [
          (u(!0), n(_, null, T(a.donut, (l, d) => (u(), n("g", null, [
            p("path", {
              "data-cy-donut-trap": "",
              d: l.arcSlice,
              fill: qe.value === o ? "rgba(0,0,0,0.1)" : "transparent",
              onMouseenter: (b) => et({
                datapoint: l,
                relativeIndex: o,
                seriesIndex: l.seriesIndex
              }),
              onClick: (b) => Ze({ datapoint: l, index: d }),
              onMouseleave: s[0] || (s[0] = (b) => {
                ee.value = !1, Ae.value = null, W.value = null, q.value = null;
              })
            }, null, 40, ol)
          ]))), 256))
        ]))), 256)),
        k(t.$slots, "svg", { svg: v.value }, void 0, !0)
      ], 14, zt)) : h("", !0),
      t.$slots.watermark ? (u(), n("div", sl, [
        k(t.$slots, "watermark", E(R({ isPrinting: r(_e) || r(Ce) })), void 0, !0)
      ])) : h("", !0),
      Y.value ? h("", !0) : (u(), D(St, {
        key: 6,
        config: {
          type: "donut",
          style: {
            backgroundColor: e.value.style.chart.backgroundColor,
            donut: {
              color: "#CCCCCC"
            }
          }
        }
      }, null, 8, ["config"])),
      Be(Ft, {
        show: $.value.showTooltip && ee.value,
        backgroundColor: e.value.style.chart.tooltip.backgroundColor,
        color: e.value.style.chart.tooltip.color,
        borderRadius: e.value.style.chart.tooltip.borderRadius,
        borderColor: e.value.style.chart.tooltip.borderColor,
        borderWidth: e.value.style.chart.tooltip.borderWidth,
        fontSize: e.value.style.chart.tooltip.fontSize,
        backgroundOpacity: e.value.style.chart.tooltip.backgroundOpacity,
        position: e.value.style.chart.tooltip.position,
        offsetY: e.value.style.chart.tooltip.offsetY,
        parent: z.value,
        content: te.value,
        isFullscreen: V.value,
        isCustom: r(Ye)(e.value.style.chart.tooltip.customFormat)
      }, {
        "tooltip-before": m(() => [
          k(t.$slots, "tooltip-before", E(R({ ...ue.value })), void 0, !0)
        ]),
        "tooltip-after": m(() => [
          k(t.$slots, "tooltip-after", E(R({ ...ue.value })), void 0, !0)
        ]),
        _: 3
      }, 8, ["show", "backgroundColor", "color", "borderRadius", "borderColor", "borderWidth", "fontSize", "backgroundOpacity", "position", "offsetY", "parent", "content", "isFullscreen", "isCustom"]),
      e.value.style.chart.legend.show ? (u(), n("div", {
        key: 7,
        ref_key: "chartLegend",
        ref: le,
        class: P({ "vue-ui-nested-donuts-legend": re.value.length > 1 })
      }, [
        (u(!0), n(_, null, T(re.value, (a, o) => (u(), D(Tt, {
          key: `legend_${o}_${me.value}`,
          legendSet: a,
          config: tt.value,
          onClickMarker: s[1] || (s[1] = ({ legend: l }) => oe(l))
        }, {
          legendTitle: m(({ titleSet: l }) => [
            l[0] && l[0].arcOf ? (u(), n("div", ul, N(l[0].arcOf), 1)) : h("", !0)
          ]),
          item: m(({ legend: l, index: d }) => [
            p("div", {
              onClick: (b) => oe(l),
              style: Q(`opacity:${y.value.includes(l.id) ? 0.5 : 1}`)
            }, [
              Z(N(l.name) + ": " + N(r(G)(
                e.value.style.chart.layout.labels.dataLabels.formatter,
                l.value,
                r(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, seriesIndex: d }
              )) + " ", 1),
              y.value.includes(l.id) ? (u(), n(_, { key: 1 }, [
                Z(" ( - % ) ")
              ], 64)) : (u(), n(_, { key: 0 }, [
                Z(" (" + N(isNaN(l.value / l.total) ? "-" : r(C)({ v: l.value / l.total * 100, s: "%", r: e.value.style.chart.legend.roundingPercentage })) + ") ", 1)
              ], 64))
            ], 12, nl)
          ]),
          _: 2
        }, 1032, ["legendSet", "config"]))), 128))
      ], 2)) : h("", !0),
      e.value.style.chart.legend.show ? h("", !0) : (u(), n("div", {
        key: 8,
        ref_key: "chartLegend",
        ref: le
      }, [
        k(t.$slots, "legend", { legend: re.value }, void 0, !0)
      ], 512)),
      t.$slots.source ? (u(), n("div", {
        key: 9,
        ref_key: "source",
        ref: ye,
        dir: "auto"
      }, [
        k(t.$slots, "source", {}, void 0, !0)
      ], 512)) : h("", !0),
      Y.value ? (u(), D(Nt, {
        key: 10,
        hideDetails: "",
        config: {
          open: $.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: m(() => [
          (u(), D(xt, {
            key: `table_${ge.value}`,
            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: s[2] || (s[2] = (a) => $.value.showTable = !1)
          }, {
            th: m(({ th: a }) => [
              p("div", {
                innerHTML: a,
                style: { display: "flex", "align-items": "center" }
              }, null, 8, rl)
            ]),
            td: m(({ td: a }) => [
              Z(N(a.name || a), 1)
            ]),
            _: 1
          }, 8, ["colNames", "head", "body", "config", "title"]))
        ]),
        _: 1
      }, 8, ["config"])) : h("", !0)
    ], 46, Dt));
  }
}, Cl = /* @__PURE__ */ Pt(il, [["__scopeId", "data-v-7b38ae51"]]);
export {
  Cl as default
};
