import { computed as h, ref as i, watch as ke, onMounted as Ue, onBeforeUnmount as Xe, openBlock as s, createElementBlock as u, normalizeClass as B, unref as e, normalizeStyle as U, createBlock as C, createCommentVNode as v, createSlots as Ge, withCtx as g, renderSlot as f, normalizeProps as S, guardReactiveProps as M, createVNode as we, Fragment as F, renderList as N, createElementVNode as O, toDisplayString as P, createTextVNode as Ee, nextTick as He } from "vue";
import { u as We, c as je, t as qe, a as Je, p as $e, b as Ke, o as Qe, e as K, d as Ze, X as et, f as R, i as Q, x as Ce, q as tt, r as ot, y as at } from "./index-WrV3SAID.js";
import { t as lt, u as rt } from "./useResponsive-CoxXLe23.js";
import { _ as nt } from "./Title-BR-xoRp4.js";
import { u as st, U as it } from "./usePrinter-kVpf1iV8.js";
import { L as ut } from "./Legend-7H4oi6Sq.js";
import { D as ct } from "./DataTable-DNPvKWC0.js";
import { _ as dt } from "./Tooltip-ho4JxRm-.js";
import ht from "./vue-ui-skeleton-Qec_XSRf.js";
import ft from "./vue-ui-accordion-BQCDXXDs.js";
import { u as xe } from "./useNestedProp-Cj0kHD7k.js";
import { _ as vt } from "./PackageVersion-1NslmM8M.js";
import { P as gt } from "./PenAndPaper-BF1ZRVm3.js";
import { u as pt } from "./useUserOptionState-BIvW1Kz7.js";
import { _ as yt } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const mt = ["id"], bt = ["xmlns", "viewBox"], kt = ["width", "height"], wt = ["cx", "cy", "r", "stroke", "stroke-width", "stroke-dasharray", "stroke-dashoffset"], $t = ["cx", "cy", "r", "stroke", "stroke-width", "stroke-dasharray", "stroke-dashoffset"], Ct = ["id"], xt = ["stdDeviation"], Tt = ["filter"], _t = ["cx", "cy", "r", "stroke-width", "stroke-dasharray", "stroke-dashoffset"], Ot = ["cx", "cy", "r", "stroke-width", "stroke-dasharray", "stroke-dashoffset", "onMouseenter"], Pt = { key: 2 }, At = ["onMouseenter"], It = ["x", "y", "font-size", "fill", "font-weight"], St = {
  key: 5,
  class: "vue-data-ui-watermark"
}, Mt = ["onClick"], Ft = ["innerHTML"], Nt = {
  __name: "vue-ui-onion",
  props: {
    config: {
      type: Object,
      default() {
        return {};
      }
    },
    dataset: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  emits: ["selectLegend"],
  setup(Te, { expose: _e, emit: Oe }) {
    const { vue_ui_onion: Pe } = We(), k = Te, D = h(() => !!k.dataset && k.dataset.length), x = i(je()), Ae = i(null), Z = i(0), L = i(!1), X = i(""), y = i([]), T = i(null), ee = i(null), te = i(null), oe = i(null), ae = i(null), le = i(0), re = i(0), ne = i(0), t = h({
      get: () => ue(),
      set: (o) => o
    }), { userOptionsVisible: G, setUserOptionsVisibility: se, keepUserOptionState: ie } = pt({ config: t.value });
    function ue() {
      const o = xe({
        userConfig: k.config,
        defaultConfig: Pe
      });
      return o.theme ? {
        ...xe({
          userConfig: qe.vue_ui_onion[o.theme] || k.config,
          defaultConfig: o
        }),
        customPalette: Je[o.theme] || $e
      } : o;
    }
    ke(() => k.config, (o) => {
      t.value = ue(), G.value = !t.value.showOnChartHover, ve(), le.value += 1, re.value += 1, ne.value += 1;
    }, { deep: !0 });
    const { isPrinting: ce, isImaging: de, generatePdf: he, generateImage: fe } = st({
      elementId: `vue-ui-onion_${x.value}`,
      fileName: t.value.style.chart.title.text || "vue-ui-onion"
    }), Ie = h(() => t.value.userOptions.show && !t.value.style.chart.title.text), Se = h(() => Ke(t.value.customPalette)), w = i({
      showTable: t.value.table.show,
      showTooltip: t.value.style.chart.tooltip.show
    }), n = i({
      height: 512,
      width: 512,
      padding: {
        top: 64,
        left: 64,
        right: 64,
        bottom: 64
      },
      minRadius: 64
    }), V = i(null);
    Ue(() => {
      ve();
    });
    function ve() {
      if (Qe(k.dataset) && K({
        componentName: "VueUiOnion",
        type: "dataset"
      }), t.value.responsive) {
        const r = lt(() => {
          const { width: a, height: l } = rt({
            chart: T.value,
            title: t.value.style.chart.title.text ? ee.value : null,
            legend: t.value.style.chart.legend.show ? te.value : null,
            source: oe.value,
            noTitle: ae.value
          });
          n.value.width = a, n.value.height = l, n.value.padding.top = Math.max(a, l) * 0.125, n.value.padding.right = Math.max(a, l) * 0.125, n.value.padding.bottom = Math.max(a, l) * 0.125, n.value.padding.left = Math.max(a, l) * 0.125, n.value.minRadius = Math.min(a, l) * 0.125;
        });
        V.value = new ResizeObserver(r), V.value.observe(T.value.parentNode);
      }
    }
    Xe(() => {
      V.value && V.value.disconnect();
    });
    const c = h(() => ({
      top: n.value.padding.top,
      left: n.value.padding.left,
      right: n.value.width - n.value.padding.right,
      bottom: n.value.height - n.value.padding.bottom,
      centerX: n.value.width / 2,
      centerY: n.value.height / 2,
      width: n.value.width - n.value.padding.right - n.value.padding.left,
      height: n.value.height - n.value.padding.bottom - n.value.padding.top,
      minRadius: n.value.minRadius,
      maxRadius: Math.min(n.value.width, n.value.height) - n.value.padding.top * 2
    })), d = h(() => (k.dataset.forEach((o, r) => {
      [null, void 0].includes(o.name) && K({
        componentName: "VueUiOnion",
        type: "datasetSerieAttribute",
        property: "name",
        index: r
      }), [void 0].includes(o.percentage) && K({
        componentName: "VueUiOnion",
        type: "datasetSerieAttribute",
        property: "percentage",
        index: r
      });
    }), k.dataset.map((o, r) => {
      const a = `onion_serie_${r}_${x.value}`;
      return {
        ...o,
        percentage: o.percentage || 0,
        targetPercentage: o.percentage || 0,
        color: Ze(o.color) || Se.value[r] || $e[r],
        id: a,
        shape: "circle",
        opacity: y.value.includes(a) ? 0.5 : 1,
        absoluteIndex: r,
        segregate: () => ge(a),
        isSegregated: y.value.includes(a)
      };
    }))), A = i(d.value), Me = h(() => t.value.useStartAnimation), Fe = i(null), Ne = h(() => Math.max(...d.value.map((o) => o.percentage))), E = i(!1);
    ke(() => d.value, Re, { immediate: !0 });
    function Re() {
      if (Me.value && !E.value) {
        let r = function() {
          o >= Ne.value ? (cancelAnimationFrame(Fe.value), A.value = d.value, E.value = !0) : (A.value = d.value.map((a) => ({
            ...a,
            percentage: o < a.targetPercentage ? o : a.targetPercentage
          })), o += 1, requestAnimationFrame(r), E.value = !0);
        };
        A.value = d.value.map((a) => ({
          ...a,
          percentage: 0
        }));
        let o = 0;
        r();
      } else
        A.value = d.value;
    }
    const De = h(() => ({
      cy: "onion-div-legend",
      backgroundColor: t.value.style.chart.legend.backgroundColor,
      color: t.value.style.chart.legend.color,
      fontSize: t.value.style.chart.legend.fontSize,
      paddingBottom: 12,
      fontWeight: t.value.style.chart.legend.bold ? "bold" : ""
    })), Le = h(() => d.value.filter((o) => !y.value.includes(o.id)).length), $ = h(() => {
      const o = Math.min(c.value.width, c.value.height) / 2 / d.value.length;
      return {
        gutter: (o > t.value.style.chart.layout.maxThickness ? t.value.style.chart.layout.maxThickness : o) * t.value.style.chart.layout.gutter.width,
        track: (o > t.value.style.chart.layout.maxThickness ? t.value.style.chart.layout.maxThickness : o) * t.value.style.chart.layout.track.width
      };
    }), m = h(() => A.value.filter((o) => !y.value.includes(o.id)).map((o, r) => {
      const a = (c.value.maxRadius - $.value.track) / Le.value / 2 * (1 + r), l = c.value.centerY - a;
      return {
        percentage: o.percentage || 0,
        ...o,
        labelY: l,
        radius: a,
        path: Ve(a, o.percentage || 0)
      };
    }));
    function Ve(o, r) {
      const a = 2 * Math.PI * o, l = a * 0.75, p = `${l} ${a}`, I = l * (1 - r / 100);
      return {
        bgDashArray: `${l} ${a}`,
        bgDashOffset: 0,
        dashArray: p,
        dashOffset: I,
        fullOffset: 0,
        active: `
            M ${c.value.centerX},${c.value.centerY - o} 
            A ${o},${o} 0 1 1 
            ${c.value.centerX + o * Math.cos(Math.PI * 3 / 4)},${c.value.centerY + o * Math.sin(Math.PI * 3 / 4)}
        `.trim()
      };
    }
    const ze = Oe;
    function ge(o) {
      y.value.includes(o) ? y.value = y.value.filter((r) => r !== o) : y.value.push(o), ze("selectLegend", m.value);
    }
    function Ye() {
      return m.value;
    }
    const H = h(() => {
      const o = [t.value.table.translations.serie, t.value.table.translations.percentage, t.value.table.translations.value], r = m.value.map((a) => [
        a.name,
        a.percentage,
        a.value
      ]);
      return { head: o, body: r };
    }), z = h(() => {
      const o = H.value.head, r = m.value.map((l) => [
        `<span style="color:${l.color}">⬤</span> ${l.name}`,
        `${Number(l.percentage ?? 0).toFixed(t.value.table.td.roundingPercentage).toLocaleString()}%`,
        `${l.prefix || ""}${[null, void 0, NaN, "NaN"].includes(l.value) ? "-" : l.value.toFixed(t.value.table.td.roundingValue).toLocaleString()}${l.suffix || ""}`
      ]), a = {
        th: {
          backgroundColor: t.value.table.th.backgroundColor,
          color: t.value.table.th.color,
          outline: t.value.table.th.outline
        },
        td: {
          backgroundColor: t.value.table.td.backgroundColor,
          color: t.value.table.td.color,
          outline: t.value.table.td.outline
        },
        breakpoint: t.value.table.responsiveBreakpoint
      };
      return { head: o, body: r, config: a, colNames: o };
    });
    function pe() {
      He(() => {
        const o = [[t.value.style.chart.title.text], [t.value.style.chart.title.subtitle.text], [""]], r = H.value.head, a = H.value.body, l = o.concat([r]).concat(a), p = tt(l);
        ot({ csvContent: p, title: t.value.style.chart.title.text || "vue-ui-onion" });
      });
    }
    const b = i(void 0), _ = i(!1);
    function Be(o) {
      _.value = o, Z.value += 1;
    }
    const W = i(null);
    function ye({ datapoint: o, seriesIndex: r, show: a = !0 }) {
      const l = o.absoluteIndex;
      b.value = r, W.value = {
        datapoint: o,
        seriesIndex: l,
        series: d.value,
        config: t.value
      }, L.value = a;
      let p = "";
      const I = t.value.style.chart.tooltip.customFormat;
      if (Ce(I) && at(() => I({
        seriesIndex: l,
        datapoint: o,
        series: d.value,
        config: t.value
      })))
        X.value = I({
          seriesIndex: l,
          datapoint: o,
          series: d.value,
          config: t.value
        });
      else {
        const q = t.value.style.chart.tooltip.showPercentage, J = t.value.style.chart.tooltip.showValue;
        p += `<div style="width: 100%; border-bottom: 1px solid ${t.value.style.chart.tooltip.borderColor}; padding-bottom: 6px;margin-bottom:3px;display:flex;flex-direction:row;gap:3px;align-items:center"><svg viewBox="0 0 12 12" height="14" width="14"><circle cx="6" cy="6" r="6" stroke="none" fill="${o.color}"/></svg><span></span>${o.name}</span></div>`, p += `<div style="width:100%;text-align:left;"><b>${q ? R({ p: "", v: o.percentage, s: "%", r: t.value.style.chart.tooltip.roundingPercentage }) : ""}</b> ${q && J ? "(" : ""}${J ? Q(
          t.value.style.chart.layout.labels.value.formatter,
          o.value,
          R({
            p: o.prefix || "",
            v: o.value,
            s: o.suffix || "",
            r: t.value.style.chart.tooltip.roundingValue
          }),
          { datapoint: o, seriesIndex: r }
        ) : ""}${q && J ? ")" : ""}</div>`, X.value = `<div>${p}</div>`;
      }
    }
    function me() {
      w.value.showTable = !w.value.showTable;
    }
    function be() {
      w.value.showTooltip = !w.value.showTooltip;
    }
    const Y = i(!1);
    function j() {
      Y.value = !Y.value;
    }
    return _e({
      getData: Ye,
      generatePdf: he,
      generateCsv: pe,
      generateImage: fe,
      toggleTable: me,
      toggleTooltip: be,
      toggleAnnotator: j
    }), (o, r) => (s(), u("div", {
      class: B(`vue-ui-onion ${e(_) ? "vue-data-ui-wrapper-fullscreen" : ""} ${e(t).useCssAnimation ? "" : "vue-ui-dna"}`),
      ref_key: "onionChart",
      ref: T,
      id: `vue-ui-onion_${e(x)}`,
      style: U(`font-family:${e(t).style.fontFamily};width:100%; ${e(t).responsive ? "height: 100%;" : ""} text-align:center;background:${e(t).style.chart.backgroundColor}`),
      onMouseenter: r[4] || (r[4] = () => e(se)(!0)),
      onMouseleave: r[5] || (r[5] = () => e(se)(!1))
    }, [
      e(t).userOptions.buttons.annotator ? (s(), C(gt, {
        key: 0,
        parent: e(T),
        backgroundColor: e(t).style.chart.backgroundColor,
        color: e(t).style.chart.color,
        active: e(Y),
        onClose: j
      }, null, 8, ["parent", "backgroundColor", "color", "active"])) : v("", !0),
      e(Ie) ? (s(), u("div", {
        key: 1,
        ref_key: "noTitle",
        ref: ae,
        class: "vue-data-ui-no-title-space",
        style: "height:36px; width: 100%;background:transparent"
      }, null, 512)) : v("", !0),
      e(t).style.chart.title.text ? (s(), u("div", {
        key: 2,
        ref_key: "chartTitle",
        ref: ee,
        style: "width:100%;background:transparent"
      }, [
        (s(), C(nt, {
          key: `title_${e(le)}`,
          config: {
            title: {
              cy: "onion-div-title",
              ...e(t).style.chart.title
            },
            subtitle: {
              cy: "onion-div-subtitle",
              ...e(t).style.chart.title.subtitle
            }
          }
        }, null, 8, ["config"]))
      ], 512)) : v("", !0),
      e(t).userOptions.show && e(D) && (e(ie) || e(G)) ? (s(), C(it, {
        ref_key: "details",
        ref: Ae,
        key: `user_options${e(Z)}`,
        backgroundColor: e(t).style.chart.backgroundColor,
        color: e(t).style.chart.color,
        isImaging: e(de),
        isPrinting: e(ce),
        uid: e(x),
        hasTooltip: e(t).userOptions.buttons.tooltip && e(t).style.chart.tooltip.show,
        hasPdf: e(t).userOptions.buttons.pdf,
        hasImg: e(t).userOptions.buttons.img,
        hasXls: e(t).userOptions.buttons.csv,
        hasTable: e(t).userOptions.buttons.table,
        hasFullscreen: e(t).userOptions.buttons.fullscreen,
        isFullscreen: e(_),
        isTooltip: e(w).showTooltip,
        titles: { ...e(t).userOptions.buttonTitles },
        chartElement: e(T),
        position: e(t).userOptions.position,
        hasAnnotator: e(t).userOptions.buttons.annotator,
        isAnnotation: e(Y),
        onToggleFullscreen: Be,
        onGeneratePdf: e(he),
        onGenerateCsv: pe,
        onGenerateImage: e(fe),
        onToggleTable: me,
        onToggleTooltip: be,
        onToggleAnnotator: j,
        style: U({
          visibility: e(ie) ? e(G) ? "visible" : "hidden" : "visible"
        })
      }, Ge({ _: 2 }, [
        o.$slots.optionTooltip ? {
          name: "optionTooltip",
          fn: g(() => [
            f(o.$slots, "optionTooltip", {}, void 0, !0)
          ]),
          key: "0"
        } : void 0,
        o.$slots.optionPdf ? {
          name: "optionPdf",
          fn: g(() => [
            f(o.$slots, "optionPdf", {}, void 0, !0)
          ]),
          key: "1"
        } : void 0,
        o.$slots.optionCsv ? {
          name: "optionCsv",
          fn: g(() => [
            f(o.$slots, "optionCsv", {}, void 0, !0)
          ]),
          key: "2"
        } : void 0,
        o.$slots.optionImg ? {
          name: "optionImg",
          fn: g(() => [
            f(o.$slots, "optionImg", {}, void 0, !0)
          ]),
          key: "3"
        } : void 0,
        o.$slots.optionTable ? {
          name: "optionTable",
          fn: g(() => [
            f(o.$slots, "optionTable", {}, void 0, !0)
          ]),
          key: "4"
        } : void 0,
        o.$slots.optionFullscreen ? {
          name: "optionFullscreen",
          fn: g(({ toggleFullscreen: a, isFullscreen: l }) => [
            f(o.$slots, "optionFullscreen", S(M({ toggleFullscreen: a, isFullscreen: l })), void 0, !0)
          ]),
          key: "5"
        } : void 0,
        o.$slots.optionAnnotator ? {
          name: "optionAnnotator",
          fn: g(({ toggleAnnotator: a, isAnnotator: l }) => [
            f(o.$slots, "optionAnnotator", S(M({ toggleAnnotator: a, isAnnotator: l })), void 0, !0)
          ]),
          key: "6"
        } : void 0
      ]), 1032, ["backgroundColor", "color", "isImaging", "isPrinting", "uid", "hasTooltip", "hasPdf", "hasImg", "hasXls", "hasTable", "hasFullscreen", "isFullscreen", "isTooltip", "titles", "chartElement", "position", "hasAnnotator", "isAnnotation", "onGeneratePdf", "onGenerateImage", "style"])) : v("", !0),
      e(D) ? (s(), u("svg", {
        key: 4,
        xmlns: e(et),
        class: B({ "vue-data-ui-fullscreen--on": e(_), "vue-data-ui-fulscreen--off": !e(_) }),
        viewBox: `0 0 ${e(n).width <= 0 ? 10 : e(n).width} ${e(n).height <= 0 ? 10 : e(n).height}`,
        style: U(`max-width:100%;overflow:visible;background:transparent;color:${e(t).style.chart.color}`)
      }, [
        we(vt),
        o.$slots["chart-background"] ? (s(), u("foreignObject", {
          key: 0,
          x: 0,
          y: 0,
          width: e(n).width <= 0 ? 10 : e(n).width,
          height: e(n).height <= 0 ? 10 : e(n).height,
          style: {
            pointerEvents: "none"
          }
        }, [
          f(o.$slots, "chart-background", {}, void 0, !0)
        ], 8, kt)) : v("", !0),
        (s(!0), u(F, null, N(e(m), (a, l) => (s(), u("circle", {
          cx: e(c).centerX,
          cy: e(c).centerY,
          r: a.radius <= 0 ? 1e-4 : a.radius,
          stroke: e(t).style.chart.layout.gutter.color,
          "stroke-width": e($).gutter,
          fill: "none",
          "stroke-dasharray": a.path.bgDashArray,
          "stroke-dashoffset": a.path.fullOffset,
          "stroke-linecap": "round",
          class: B({ "vue-ui-onion-path": !0, "vue-ui-onion-blur": e(t).useBlurOnHover && ![null, void 0].includes(e(b)) && e(b) !== l }),
          style: { transform: "rotate(-90deg)", "transform-origin": "50% 50%" }
        }, null, 10, wt))), 256)),
        (s(!0), u(F, null, N(e(m), (a, l) => (s(), u("circle", {
          cx: e(c).centerX,
          cy: e(c).centerY,
          r: a.radius < 0 ? 1e-4 : a.radius,
          stroke: `${a.color}`,
          "stroke-width": e($).track,
          fill: "none",
          "stroke-dasharray": a.path.dashArray,
          "stroke-dashoffset": a.path.dashOffset,
          class: B({ "vue-ui-onion-path": !0, "vue-ui-onion-blur": e(t).useBlurOnHover && ![null, void 0].includes(e(b)) && e(b) !== l }),
          "stroke-linecap": "round",
          style: { transform: "rotate(-90deg)", "transform-origin": "50% 50%" }
        }, null, 10, $t))), 256)),
        O("defs", null, [
          O("filter", {
            id: `blur_${e(x)}`,
            x: "-50%",
            y: "-50%",
            width: "200%",
            height: "200%"
          }, [
            O("feGaussianBlur", {
              in: "SourceGraphic",
              stdDeviation: 100 / e(t).style.chart.gradientIntensity
            }, null, 8, xt)
          ], 8, Ct)
        ]),
        e(t).style.chart.useGradient ? (s(), u("g", {
          key: 1,
          filter: `url(#blur_${e(x)})`
        }, [
          (s(!0), u(F, null, N(e(m), (a, l) => (s(), u("circle", {
            cx: e(c).centerX,
            cy: e(c).centerY,
            r: a.radius <= 0 ? 1e-4 : a.radius,
            stroke: "white",
            "stroke-width": e($).track / 3,
            fill: "none",
            "stroke-linecap": "round",
            "stroke-dasharray": a.path.dashArray,
            "stroke-dashoffset": a.path.dashOffset,
            style: { transform: "rotate(-90deg)", "transform-origin": "50% 50%" }
          }, null, 8, _t))), 256))
        ], 8, Tt)) : v("", !0),
        (s(!0), u(F, null, N(e(m), (a, l) => (s(), u("circle", {
          "data-cy-trap": "",
          cx: e(c).centerX,
          cy: e(c).centerY,
          r: a.radius <= 0 ? 1e-4 : a.radius,
          stroke: "transparent",
          "stroke-width": Math.max(e($).track, e($).gutter),
          fill: "none",
          "stroke-dasharray": a.path.bgDashArray,
          "stroke-dashoffset": a.path.fullOffset,
          "stroke-linecap": "round",
          class: "vue-ui-onion-path",
          style: { transform: "rotate(-90deg)", "transform-origin": "50% 50%" },
          onMouseenter: (p) => ye({
            datapoint: a,
            show: !0,
            seriesIndex: l
          }),
          onMouseleave: r[0] || (r[0] = (p) => {
            b.value = void 0, L.value = !1;
          })
        }, null, 40, Ot))), 256)),
        e(t).style.chart.layout.labels.show ? (s(), u("g", Pt, [
          (s(!0), u(F, null, N(e(m), (a, l) => (s(), u("g", {
            onMouseenter: (p) => ye({
              datapoint: a,
              show: !0,
              seriesIndex: l
            }),
            onMouseleave: r[1] || (r[1] = (p) => {
              b.value = void 0, L.value = !1;
            })
          }, [
            e(y).includes(a.id) ? v("", !0) : (s(), u("text", {
              key: 0,
              x: e(n).width / 2 - e($).gutter * 0.8 + e(t).style.chart.layout.labels.offsetX,
              y: a.labelY + e(t).style.chart.layout.labels.offsetY,
              "text-anchor": "end",
              "font-size": e(t).style.chart.layout.labels.fontSize,
              fill: e(t).useBlurOnHover && ![null, void 0].includes(e(b)) && e(b) === l ? a.color : e(t).style.chart.layout.labels.color,
              "font-weight": e(t).style.chart.layout.labels.bold ? "bold" : "normal"
            }, P(a.name ? a.name + ": " : "") + " " + P(e(t).style.chart.layout.labels.percentage.show ? e(R)({
              v: a.percentage,
              s: "%",
              r: e(t).style.chart.layout.labels.roundingPercentage
            }) : "") + " " + P(!e(t).style.chart.layout.labels.percentage.show && e(t).style.chart.layout.labels.value.show ? `: ${e(Q)(
              e(t).style.chart.layout.labels.value.formatter,
              a.value,
              e(R)({
                p: a.prefix || "",
                v: a.value || 0,
                s: a.suffix || "",
                r: e(t).style.chart.layout.labels.roundingValue
              }),
              { datapoint: a, seriesIndex: l }
            )}` : `${e(t).style.chart.layout.labels.value.show && a.value ? `(${e(Q)(
              e(t).style.chart.layout.labels.value.formatter,
              a.value,
              e(R)({
                p: a.prefix || "",
                v: a.value || 0,
                s: a.suffix || "",
                r: e(t).style.chart.layout.labels.roundingValue
              }),
              { datapoint: a, seriesIndex: l }
            )})` : ""}`), 9, It))
          ], 40, At))), 256))
        ])) : v("", !0),
        f(o.$slots, "svg", { svg: e(n) }, void 0, !0)
      ], 14, bt)) : v("", !0),
      o.$slots.watermark ? (s(), u("div", St, [
        f(o.$slots, "watermark", S(M({ isPrinting: e(ce) || e(de) })), void 0, !0)
      ])) : v("", !0),
      e(D) ? v("", !0) : (s(), C(ht, {
        key: 6,
        config: {
          type: "onion",
          style: {
            backgroundColor: e(t).style.chart.backgroundColor,
            onion: {
              color: e(t).style.chart.layout.gutter.color
            }
          }
        }
      }, null, 8, ["config"])),
      O("div", {
        ref_key: "chartLegend",
        ref: te
      }, [
        e(t).style.chart.legend.show ? (s(), C(ut, {
          key: `legend_${e(ne)}`,
          legendSet: e(d),
          config: e(De),
          onClickMarker: r[2] || (r[2] = ({ legend: a }) => ge(a.id))
        }, {
          item: g(({ legend: a }) => [
            O("div", {
              "data-cy-legend-item": "",
              onClick: (l) => a.segregate(),
              style: U(`opacity:${e(y).includes(a.id) ? 0.5 : 1}`)
            }, P(a.name ? a.name + ": " : "") + " " + P((a.percentage || 0).toFixed(e(t).style.chart.legend.roundingPercentage)) + "% ", 13, Mt)
          ]),
          _: 1
        }, 8, ["legendSet", "config"])) : f(o.$slots, "legend", {
          key: 1,
          legend: e(d)
        }, void 0, !0)
      ], 512),
      o.$slots.source ? (s(), u("div", {
        key: 7,
        ref_key: "source",
        ref: oe,
        dir: "auto"
      }, [
        f(o.$slots, "source", {}, void 0, !0)
      ], 512)) : v("", !0),
      we(dt, {
        show: e(w).showTooltip && e(L),
        backgroundColor: e(t).style.chart.tooltip.backgroundColor,
        color: e(t).style.chart.tooltip.color,
        borderRadius: e(t).style.chart.tooltip.borderRadius,
        borderColor: e(t).style.chart.tooltip.borderColor,
        borderWidth: e(t).style.chart.tooltip.borderWidth,
        fontSize: e(t).style.chart.tooltip.fontSize,
        backgroundOpacity: e(t).style.chart.tooltip.backgroundOpacity,
        position: e(t).style.chart.tooltip.position,
        offsetY: e(t).style.chart.tooltip.offsetY,
        parent: e(T),
        content: e(X),
        isFullscreen: e(_),
        isCustom: e(Ce)(e(t).style.chart.tooltip.customFormat)
      }, {
        "tooltip-before": g(() => [
          f(o.$slots, "tooltip-before", S(M({ ...e(W) })), void 0, !0)
        ]),
        "tooltip-after": g(() => [
          f(o.$slots, "tooltip-after", S(M({ ...e(W) })), void 0, !0)
        ]),
        _: 3
      }, 8, ["show", "backgroundColor", "color", "borderRadius", "borderColor", "borderWidth", "fontSize", "backgroundOpacity", "position", "offsetY", "parent", "content", "isFullscreen", "isCustom"]),
      e(D) ? (s(), C(ft, {
        key: 8,
        hideDetails: "",
        config: {
          open: e(w).showTable,
          maxHeight: 1e4,
          head: {
            backgroundColor: e(t).style.chart.backgroundColor,
            color: e(t).style.chart.color
          },
          body: {
            backgroundColor: e(t).style.chart.backgroundColor,
            color: e(t).style.chart.color
          }
        }
      }, {
        content: g(() => [
          (s(), C(ct, {
            key: `table_${e(re)}`,
            colNames: e(z).colNames,
            head: e(z).head,
            body: e(z).body,
            config: e(z).config,
            title: `${e(t).style.chart.title.text}${e(t).style.chart.title.subtitle.text ? ` : ${e(t).style.chart.title.subtitle.text}` : ""}`,
            onClose: r[3] || (r[3] = (a) => e(w).showTable = !1)
          }, {
            th: g(({ th: a }) => [
              Ee(P(a), 1)
            ]),
            td: g(({ td: a }) => [
              O("div", { innerHTML: a }, null, 8, Ft)
            ]),
            _: 1
          }, 8, ["colNames", "head", "body", "config", "title"]))
        ]),
        _: 1
      }, 8, ["config"])) : v("", !0)
    ], 46, mt));
  }
}, Jt = /* @__PURE__ */ yt(Nt, [["__scopeId", "data-v-60ee16cc"]]);
export {
  Jt as default
};
