import { computed as c, ref as v, onMounted as Me, onBeforeUnmount as De, openBlock as r, createElementBlock as i, normalizeClass as xe, normalizeStyle as W, createVNode as oe, createCommentVNode as p, createBlock as Q, unref as h, createSlots as Ee, withCtx as m, renderSlot as b, normalizeProps as q, guardReactiveProps as H, createElementVNode as w, Fragment as T, renderList as V, toDisplayString as S, createTextVNode as Ce, nextTick as Ge, pushScopeId as Re, popScopeId as Ue } from "vue";
import { u as je, c as We, t as qe, a as He, p as B, o as Xe, e as ue, g as Ye, b as Je, d as Ke, i as M, f as x, X as Qe, v as Ze, w as et, E as tt, H as lt, x as at, y as ot, q as ut, r as st } from "./index-CguVaFlt.js";
import { t as rt, u as nt } from "./useResponsive-NZB-WLRF.js";
import { _ as it } from "./Title-DbTGPg4G.js";
import { u as ct, U as vt } from "./usePrinter-ClsMRVJG.js";
import { _ as dt } from "./Tooltip-u79R5W5y.js";
import { D as ht } from "./DataTable-BwHWRlRZ.js";
import { L as yt } from "./Legend-CsVEDSh6.js";
import ft from "./vue-ui-skeleton-ChHLL5Hw.js";
import pt from "./vue-ui-accordion-w15FGKRN.js";
import { u as _e } from "./useNestedProp-BbEbJmgv.js";
import { _ as gt } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const $e = (D) => (Re("data-v-876ae247"), D = D(), Ue(), D), mt = ["id"], bt = ["xmlns", "viewBox"], wt = ["id"], kt = ["stop-color"], xt = ["stop-color"], Ct = ["id"], _t = /* @__PURE__ */ $e(() => /* @__PURE__ */ w("feGaussianBlur", {
  in: "SourceGraphic",
  stdDeviation: 2
}, null, -1)), $t = /* @__PURE__ */ $e(() => /* @__PURE__ */ w("feColorMatrix", {
  type: "saturate",
  values: "0"
}, null, -1)), It = [
  _t,
  $t
], Tt = ["x", "y", "height", "width"], St = ["height", "width"], Lt = ["rx", "x", "y", "height", "width", "stroke", "stroke-width", "filter"], Pt = ["rx", "x", "y", "height", "width", "fill", "stroke", "stroke-width", "filter"], zt = ["x", "y", "height", "width", "filter"], Ft = { key: 0 }, Nt = { key: 1 }, Bt = { key: 2 }, Ot = { key: 3 }, At = ["onMouseover", "x", "y", "height", "width"], Vt = {
  key: 3,
  class: "vue-data-ui-watermark"
}, Mt = ["onClick"], Dt = { key: 0 }, Et = { key: 1 }, Gt = ["innerHTML"], Rt = {
  __name: "vue-ui-waffle",
  props: {
    config: {
      type: Object,
      default() {
        return {};
      }
    },
    dataset: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  emits: ["selectLegend"],
  setup(D, { expose: Ie, emit: Te }) {
    const k = D, { vue_ui_waffle: Se } = je(), X = c(() => !!k.dataset && k.dataset.length), L = v(We()), Le = v(null), Z = v(!1), ee = v(""), O = v(null), se = v(0), E = v(null), re = v(null), ne = v(null), e = c(() => {
      const t = _e({
        userConfig: k.config,
        defaultConfig: Se
      });
      return t.theme ? {
        ..._e({
          userConfig: qe.vue_ui_waffle[t.theme] || k.config,
          defaultConfig: t
        }),
        customPalette: He[t.theme] || B
      } : t;
    }), Y = v(null);
    Me(() => {
      if (Xe(k.dataset) ? ue({
        componentName: "VueUiWaffle",
        type: "dataset"
      }) : k.dataset.forEach((t, o) => {
        Ye({
          datasetObject: t,
          requiredAttributes: ["name", "values"]
        }).forEach((l) => {
          ue({
            componentName: "VueUiWaffle",
            type: "datasetSerieAttribute",
            property: l,
            index: o
          });
        });
      }), e.value.responsive) {
        const t = rt(() => {
          const { width: o, height: l } = nt({
            chart: E.value,
            title: e.value.style.chart.title.text ? re.value : null,
            legend: e.value.style.chart.legend.show ? ne.value : null
          });
          P.value.width = o, P.value.height = l, C.value.width = o, C.value.height = l;
        });
        Y.value = new ResizeObserver(t), Y.value.observe(E.value.parentNode);
      }
    }), De(() => {
      Y.value && Y.value.disconnect();
    });
    const { isPrinting: ie, isImaging: ce, generatePdf: ve, generateImage: de } = ct({
      elementId: `vue-ui-waffle_${L.value}`,
      fileName: e.value.style.chart.title.text || "vue-ui-waffle"
    }), he = c(() => Je(e.value.customPalette)), I = v({
      showTable: e.value.table.show,
      showTooltip: e.value.style.chart.tooltip.show
    }), P = v({
      height: 512,
      width: 512
    }), C = v({
      top: 0,
      left: 0,
      height: 512,
      width: 512
    }), z = c(() => (C.value.width - e.value.style.chart.layout.grid.size * e.value.style.chart.layout.grid.spaceBetween) / e.value.style.chart.layout.grid.size), F = c(() => (C.value.height - e.value.style.chart.layout.grid.size * e.value.style.chart.layout.grid.spaceBetween) / e.value.style.chart.layout.grid.size), G = c(() => C.value.width / e.value.style.chart.layout.grid.size), J = c(() => C.value.height / e.value.style.chart.layout.grid.size);
    function ye(t) {
      const o = e.value.style.chart.layout.grid.size * e.value.style.chart.layout.grid.size, l = t.reduce((g, ae) => g + ae, 0), a = t.map((g) => g / l * o), u = a.map(Math.floor), n = a.map((g) => g % 1);
      let f = o - u.reduce((g, ae) => g + ae, 0);
      for (; f > 0; ) {
        let g = n.indexOf(Math.max(...n));
        u[g] += 1, n[g] = 0, f -= 1;
      }
      return u;
    }
    const fe = c(() => k.dataset.map((t, o) => ({
      ...t,
      color: Ke(t.color) || he.value[o] || B[o] || B[o % B.length],
      uid: `serie_${o}`,
      absoluteIndex: o
    }))), d = v(fe.value), Pe = c(() => {
      const t = d.value.filter((o, l) => !y.value.includes(o.uid)).map((o, l) => (o.values || []).reduce((a, u) => a + u, 0));
      return ye(t);
    }), ze = c(() => {
      const t = d.value.map((o, l) => (o.values || []).reduce((a, u) => a + u));
      return ye(t);
    }), R = c(() => (k.dataset.forEach((t, o) => {
      [null, void 0].includes(t.values) && ue({
        componentName: "VueUiWaffle",
        type: "datasetSerieAttribute",
        property: "values (number[])",
        index: o
      });
    }), d.value.filter((t, o) => !y.value.includes(t.uid)).map((t, o) => ({
      absoluteIndex: t.absoluteIndex,
      uid: t.uid,
      name: t.name,
      color: t.color,
      value: (t.values || []).reduce((l, a) => l + a, 0),
      absoluteValues: t.values || [],
      proportion: Pe.value[o]
    })))), Fe = c(() => d.value.map((t, o) => ({
      absoluteIndex: t.absoluteIndex,
      uid: t.uid,
      name: t.name,
      color: t.color,
      value: (t.values || []).reduce((l, a) => l + a, 0),
      absoluteValues: t.values || [],
      proportion: ze.value[o]
    })));
    function Ne() {
      return Fe.value.map((t) => ({
        name: t.name,
        color: t.color,
        value: t.value,
        proportion: t.proportion
      }));
    }
    const Be = c(() => {
      let t = 0;
      return R.value.map((o, l) => {
        const a = t, u = a + o.proportion, n = [];
        for (let f = Math.floor(a); f < Math.floor(u); f += 1)
          n.push(f);
        return t = u, {
          ...o,
          start: a,
          rects: n
        };
      });
    }), s = c(() => Be.value.flatMap((t, o) => t.rects.map((l, a) => ({
      isFirst: a === 0,
      isLongEnough: l.length > 2,
      name: t.name,
      color: t.color,
      value: t.value,
      serieIndex: o,
      absoluteStartIndex: a < 3,
      serieId: t.uid,
      ...t
    }))).map((t, o) => ({
      ...t,
      isAbsoluteFirst: o % e.value.style.chart.layout.grid.size === 0
    }))), U = c(() => {
      const t = [];
      for (let o = 0; o < e.value.style.chart.layout.grid.size; o += 1)
        for (let l = 0; l < e.value.style.chart.layout.grid.size; l += 1)
          t.push({
            isStartOfLine: l === 0,
            position: e.value.style.chart.layout.grid.vertical ? o : l,
            x: (e.value.style.chart.layout.grid.vertical ? o : l) * (z.value + e.value.style.chart.layout.grid.spaceBetween),
            y: (e.value.style.chart.layout.grid.vertical ? l : o) * (F.value + e.value.style.chart.layout.grid.spaceBetween) + C.value.top
          });
      return t;
    }), y = v([]), N = v(!1), pe = v(null), ge = v(null);
    function me(t) {
      if (!e.value.useAnimation) {
        y.value.includes(t) ? y.value = y.value.filter((u) => u !== t) : y.value.length < A.value.length - 1 && A.value.length > 1 && y.value.push(t);
        return;
      }
      const o = fe.value.find((u) => u.uid === t).values.reduce((u, n) => u + n, 0);
      let a = d.value.find((u) => u.uid === t).values.reduce((u, n) => u + n, 0);
      if (y.value.includes(t)) {
        let n = function() {
          a > u ? (cancelAnimationFrame(pe.value), d.value = d.value.map((f, g) => f.uid === t ? {
            ...f,
            values: [u]
          } : f), N.value = !1) : (N.value = !0, a += u * 0.025, d.value = d.value.map((f, g) => f.uid === t ? {
            ...f,
            values: [a]
          } : f), pe.value = requestAnimationFrame(n));
        };
        y.value = y.value.filter((f) => f !== t);
        const u = o;
        n();
      } else if (y.value.length < A.value.length - 1 && A.value.length > 1) {
        let u = function() {
          a < 0.1 ? (cancelAnimationFrame(ge.value), y.value.push(t), d.value = d.value.map((n, f) => n.uid === t ? {
            ...n,
            values: [0]
          } : n), N.value = !1) : (N.value = !0, a /= 1.5, d.value = d.value.map((n, f) => n.uid === t ? {
            ...n,
            values: [a]
          } : n), ge.value = requestAnimationFrame(u));
        };
        u();
      }
      Te("selectLegend", R.value.map((u) => ({
        name: u.name,
        color: u.color,
        value: u.value,
        proportion: u.proportion / Math.pow(e.value.style.chart.layout.grid.size, 2)
      })));
    }
    const A = c(() => d.value.map((t, o) => ({
      name: t.name,
      color: t.color || he[o] || B[o] || B[o % B.length],
      value: (t.values || []).reduce((l, a) => l + a, 0),
      uid: t.uid,
      shape: "square"
    })).map((t, o) => ({
      ...t,
      proportion: t.value / d.value.map((l) => (l.values || []).reduce((a, u) => a + u, 0)).reduce((l, a) => l + a, 0),
      opacity: y.value.includes(t.uid) ? 0.5 : 1,
      segregate: () => me(t.uid),
      isSegregated: y.value.includes(t.uid)
    }))), Oe = c(() => ({
      cy: "waffle-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" : ""
    })), _ = c(() => R.value.map((t) => t.value).reduce((t, o) => t + o, 0)), te = v(null);
    function Ae(t) {
      if (y.value.length === k.dataset.length) return;
      const o = s.value[t];
      te.value = {
        datapoint: o,
        seriesIndex: o.absoluteIndex,
        series: d.value,
        config: e.value
      }, Z.value = !0, O.value = s.value[t].serieIndex;
      const l = e.value.style.chart.tooltip.customFormat;
      if (at(l) && ot(() => l({
        seriesIndex: s.value[t].absoluteIndex,
        datapoint: o,
        series: d.value,
        config: e.value
      })))
        ee.value = l({
          seriesIndex: s.value[t].absoluteIndex,
          datapoint: o,
          series: d.value,
          config: e.value
        });
      else {
        let a = "";
        if (a += `<div style="width:100%;text-align:center;border-bottom:1px solid ${e.value.style.chart.tooltip.borderColor};padding-bottom:6px;margin-bottom:3px;">${o.name}</div>`, a += `<div style="display:flex;flex-direction:row;gap:6px;align-items:center;"><svg viewBox="0 0 12 12" height="14" width="14"><rect x="0" y="0" height="12" width="12" stroke="none" rx="1" fill="${o.color}" /></svg>`, e.value.style.chart.tooltip.showValue && (a += `<b>${M(
          e.value.style.chart.layout.labels.dataLabels.formatter,
          o.value,
          x({
            p: e.value.style.chart.layout.labels.dataLabels.prefix,
            v: o.value,
            s: e.value.style.chart.layout.labels.dataLabels.suffix,
            r: e.value.style.chart.tooltip.roundingValue
          }),
          {
            datapoint: o,
            seriesIndex: s.value[t].absoluteIndex,
            series: d.value
          }
        )}</b>`), e.value.style.chart.tooltip.showPercentage) {
          const u = x({
            v: o.value / _.value * 100,
            s: "%",
            r: e.value.style.chart.tooltip.roundingPercentage
          });
          e.value.style.chart.tooltip.showValue ? a += `<span>(${u})</span></div>` : a += `<b>${u}%</b></div>`;
        }
        ee.value = a;
      }
    }
    const $ = c(() => {
      const t = R.value.map((l) => ({
        name: l.name,
        color: l.color
      })), o = R.value.map((l) => l.value);
      return { head: t, body: o };
    });
    function le(t) {
      return e.value.useBlurOnHover && ![null, void 0].includes(O.value) && O.value !== t ? `url(#blur_${L.value})` : "";
    }
    function be() {
      Ge(() => {
        const t = $.value.head.map((a, u) => [[
          a.name
        ], [$.value.body[u]], [isNaN($.value.body[u] / _.value) ? "-" : $.value.body[u] / _.value * 100]]), o = [[e.value.style.chart.title.text], [e.value.style.chart.title.subtitle.text], [[""], ["val"], ["%"]]].concat(t), l = ut(o);
        st({ csvContent: l, title: e.value.style.chart.title.text || "vue-ui-waffle" });
      });
    }
    const K = c(() => {
      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>',
        M(
          e.value.style.chart.layout.labels.dataLabels.formatter,
          _.value,
          x({
            p: e.value.style.chart.layout.labels.dataLabels.prefix,
            v: _.value,
            s: e.value.style.chart.layout.labels.dataLabels.suffix,
            r: e.value.table.td.roundingValue
          })
        ),
        "100%"
      ], o = $.value.head.map((u, n) => [
        {
          color: u.color,
          name: u.name
        },
        M(
          e.value.style.chart.layout.labels.dataLabels.formatter,
          $.value.body[n],
          x({
            p: e.value.style.chart.layout.labels.dataLabels.prefix,
            v: $.value.body[n],
            s: e.value.style.chart.layout.labels.dataLabels.suffix,
            r: e.value.table.td.roundingValue
          })
        ),
        isNaN($.value.body[n] / _.value) ? "-" : x({
          v: $.value.body[n] / _.value * 100,
          s: "%",
          r: 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
        },
        shape: "square",
        breakpoint: e.value.table.responsiveBreakpoint
      }, a = [
        e.value.table.columnNames.series,
        e.value.table.columnNames.value,
        e.value.table.columnNames.percentage
      ];
      return {
        head: t,
        body: o,
        config: l,
        colNames: a
      };
    }), j = v(!1);
    function Ve(t) {
      j.value = t, se.value += 1;
    }
    function we() {
      I.value.showTable = !I.value.showTable;
    }
    function ke() {
      I.value.showTooltip = !I.value.showTooltip;
    }
    return Ie({
      getData: Ne,
      generatePdf: ve,
      generateCsv: be,
      generateImage: de,
      toggleTable: we,
      toggleTooltip: ke
    }), (t, o) => (r(), i("div", {
      class: xe(`vue-ui-waffle ${j.value ? "vue-data-ui-wrapper-fullscreen" : ""}`),
      ref_key: "waffleChart",
      ref: E,
      id: `vue-ui-waffle_${L.value}`,
      style: W(`font-family:${e.value.style.fontFamily};width:100%; text-align:center;${e.value.style.chart.title.text ? "" : "padding-top:36px"};background:${e.value.style.chart.backgroundColor};${e.value.responsive ? "height: 100%" : ""}`)
    }, [
      e.value.style.chart.title.text ? (r(), i("div", {
        key: 0,
        ref_key: "chartTitle",
        ref: re,
        style: W(`width:100%;background:${e.value.style.chart.backgroundColor};padding-bottom:12px`)
      }, [
        oe(it, {
          config: {
            title: {
              cy: "waffle-title",
              ...e.value.style.chart.title
            },
            subtitle: {
              cy: "waffle-subtitle",
              ...e.value.style.chart.title.subtitle
            }
          }
        }, null, 8, ["config"])
      ], 4)) : p("", !0),
      e.value.userOptions.show && X.value ? (r(), Q(vt, {
        ref_key: "details",
        ref: Le,
        key: `user_options_${se.value}`,
        backgroundColor: e.value.style.chart.backgroundColor,
        color: e.value.style.chart.color,
        isPrinting: h(ie),
        isImaging: h(ce),
        uid: L.value,
        hasTooltip: e.value.userOptions.buttons.tooltip && e.value.style.chart.tooltip.show,
        hasPdf: e.value.userOptions.buttons.pdf,
        hasImg: e.value.userOptions.buttons.img,
        hasXls: e.value.userOptions.buttons.csv,
        hasTable: e.value.userOptions.buttons.table,
        hasFullscreen: e.value.userOptions.buttons.fullscreen,
        isFullscreen: j.value,
        isTooltip: I.value.showTooltip,
        titles: { ...e.value.userOptions.buttonTitles },
        chartElement: E.value,
        onToggleFullscreen: Ve,
        onGeneratePdf: h(ve),
        onGenerateCsv: be,
        onGenerateImage: h(de),
        onToggleTable: we,
        onToggleTooltip: ke
      }, Ee({ _: 2 }, [
        t.$slots.optionTooltip ? {
          name: "optionTooltip",
          fn: m(() => [
            b(t.$slots, "optionTooltip", {}, void 0, !0)
          ]),
          key: "0"
        } : void 0,
        t.$slots.optionPdf ? {
          name: "optionPdf",
          fn: m(() => [
            b(t.$slots, "optionPdf", {}, void 0, !0)
          ]),
          key: "1"
        } : void 0,
        t.$slots.optionCsv ? {
          name: "optionCsv",
          fn: m(() => [
            b(t.$slots, "optionCsv", {}, void 0, !0)
          ]),
          key: "2"
        } : void 0,
        t.$slots.optionImg ? {
          name: "optionImg",
          fn: m(() => [
            b(t.$slots, "optionImg", {}, void 0, !0)
          ]),
          key: "3"
        } : void 0,
        t.$slots.optionTable ? {
          name: "optionTable",
          fn: m(() => [
            b(t.$slots, "optionTable", {}, void 0, !0)
          ]),
          key: "4"
        } : void 0,
        t.$slots.optionFullscreen ? {
          name: "optionFullscreen",
          fn: m(({ toggleFullscreen: l, isFullscreen: a }) => [
            b(t.$slots, "optionFullscreen", q(H({ toggleFullscreen: l, isFullscreen: a })), void 0, !0)
          ]),
          key: "5"
        } : void 0
      ]), 1032, ["backgroundColor", "color", "isPrinting", "isImaging", "uid", "hasTooltip", "hasPdf", "hasImg", "hasXls", "hasTable", "hasFullscreen", "isFullscreen", "isTooltip", "titles", "chartElement", "onGeneratePdf", "onGenerateImage"])) : p("", !0),
      X.value ? (r(), i("svg", {
        key: 2,
        xmlns: h(Qe),
        class: xe({ "vue-data-ui-fullscreen--on": j.value, "vue-data-ui-fulscreen--off": !j.value }),
        viewBox: `0 0 ${P.value.width <= 0 ? 10 : P.value.width} ${P.value.height <= 0 ? 10 : P.value.height}`,
        style: W(`max-width:100%;overflow:visible;background:${e.value.style.chart.backgroundColor};color:${e.value.style.chart.color}`)
      }, [
        w("defs", null, [
          (r(!0), i(T, null, V(s.value, (l, a) => (r(), i("radialGradient", {
            cx: "50%",
            cy: "50%",
            r: "50%",
            fx: "50%",
            fy: "50%",
            id: `gradient_${L.value}_${a}`
          }, [
            w("stop", {
              offset: "0%",
              "stop-color": `${h(Ze)(l.color, 0.05)}${h(et)[100 - e.value.style.chart.layout.rect.gradientIntensity]}`
            }, null, 8, kt),
            w("stop", {
              offset: "100%",
              "stop-color": l.color
            }, null, 8, xt)
          ], 8, wt))), 256))
        ]),
        w("defs", null, [
          w("filter", {
            id: `blur_${L.value}`,
            x: "-50%",
            y: "-50%",
            width: "200%",
            height: "200%"
          }, It, 8, Ct)
        ]),
        e.value.useCustomCells && s.value.length ? (r(!0), i(T, { key: 0 }, V(U.value, (l, a) => (r(), i("foreignObject", {
          x: l.x,
          y: l.y,
          height: F.value <= 0 ? 1e-4 : F.value,
          width: z.value <= 0 ? 1e-4 : z.value,
          class: "vue-ui-waffle-custom-cell-foreignObject"
        }, [
          b(t.$slots, "cell", q(H({ cell: { ...l, color: s.value[a].color, ...s.value[a] }, isSelected: [null, void 0].includes(O.value) ? !0 : s.value[a].serieIndex === O.value })), void 0, !0)
        ], 8, Tt))), 256)) : p("", !0),
        !s.value.length && !e.value.useCustomCells ? (r(), i("rect", {
          key: 1,
          x: 12,
          y: 12,
          height: C.value.height - 24,
          width: C.value.width - 24,
          rx: 3,
          fill: "none",
          stroke: "black"
        }, null, 8, St)) : s.value.length && !e.value.useCustomCells ? (r(), i(T, { key: 2 }, [
          (r(!0), i(T, null, V(U.value, (l, a) => (r(), i("rect", {
            rx: e.value.style.chart.layout.rect.rounded ? e.value.style.chart.layout.rect.rounding : 0,
            x: l.x + e.value.style.chart.layout.grid.spaceBetween / 2,
            y: l.y + e.value.style.chart.layout.grid.spaceBetween / 2,
            height: F.value <= 0 ? 1e-4 : F.value,
            width: z.value <= 0 ? 1e-4 : z.value,
            fill: "white",
            stroke: e.value.style.chart.layout.rect.stroke,
            "stroke-width": e.value.style.chart.layout.rect.strokeWidth,
            filter: le(s.value[a].serieIndex)
          }, null, 8, Lt))), 256)),
          (r(!0), i(T, null, V(U.value, (l, a) => (r(), i("rect", {
            rx: e.value.style.chart.layout.rect.rounded ? e.value.style.chart.layout.rect.rounding : 0,
            x: l.x + e.value.style.chart.layout.grid.spaceBetween / 2,
            y: l.y + e.value.style.chart.layout.grid.spaceBetween / 2,
            height: F.value <= 0 ? 1e-4 : F.value,
            width: z.value <= 0 ? 1e-4 : z.value,
            fill: e.value.style.chart.layout.rect.useGradient && e.value.style.chart.layout.rect.gradientIntensity > 0 ? `url(#gradient_${L.value}_${a})` : s.value[a].color,
            stroke: e.value.style.chart.layout.rect.stroke,
            "stroke-width": e.value.style.chart.layout.rect.strokeWidth,
            filter: le(s.value[a].serieIndex)
          }, null, 8, Pt))), 256))
        ], 64)) : p("", !0),
        (r(!0), i(T, null, V(U.value, (l, a) => (r(), i(T, null, [
          s.value.length && !N.value && !e.value.style.chart.layout.grid.vertical && e.value.style.chart.layout.labels.captions.show && (s.value[a].isFirst && l.position < e.value.style.chart.layout.grid.size - 2 || s.value[a].isAbsoluteFirst && a % e.value.style.chart.layout.grid.size === 0 && s.value[a].absoluteStartIndex) ? (r(), i("foreignObject", {
            key: 0,
            x: l.x + e.value.style.chart.layout.labels.captions.offsetX + e.value.style.chart.layout.grid.spaceBetween / 2,
            y: l.y + e.value.style.chart.layout.labels.captions.offsetY + e.value.style.chart.layout.grid.spaceBetween / 2,
            height: J.value <= 0 ? 1e-4 : J.value,
            width: G.value * e.value.style.chart.layout.grid.size <= 0 ? 1e-4 : G.value * e.value.style.chart.layout.grid.size,
            filter: le(s.value[a].serieIndex)
          }, [
            w("div", {
              class: "vue-ui-waffle-caption",
              style: W(`height: 100%; width: 100%; font-size:${e.value.style.chart.layout.labels.captions.fontSize}px;display:flex;align-items:center;justify-content:flex-start;padding: 0 ${G.value / 12}px;color:${h(tt)(s.value[a].color)};gap:2px`)
            }, [
              e.value.style.chart.layout.labels.captions.showSerieName ? (r(), i("span", Ft, S(e.value.style.chart.layout.labels.captions.serieNameAbbreviation ? h(lt)({ source: s.value[a].name, length: e.value.style.chart.layout.labels.captions.serieNameMaxAbbreviationSize }) : s.value[a].name) + ": ", 1)) : p("", !0),
              e.value.style.chart.layout.labels.captions.showPercentage ? (r(), i("span", Nt, S(h(x)({ v: s.value[a].proportion, s: "%", r: e.value.style.chart.layout.labels.captions.roundingPercentage })), 1)) : p("", !0),
              e.value.style.chart.layout.labels.captions.showPercentage && e.value.style.chart.layout.labels.captions.showValue ? (r(), i("span", Bt, " (" + S(h(M)(
                e.value.style.chart.layout.labels.dataLabels.formatter,
                s.value[a].value,
                h(x)({
                  p: e.value.style.chart.layout.labels.dataLabels.prefix,
                  v: s.value[a].value,
                  s: e.value.style.chart.layout.labels.dataLabels.suffix,
                  r: e.value.style.chart.layout.labels.captions.roundingValue
                }),
                { datapoint: s.value[a], position: l }
              )) + ") ", 1)) : p("", !0),
              !e.value.style.chart.layout.labels.captions.showPercentage && e.value.style.chart.layout.labels.captions.showValue ? (r(), i("span", Ot, S(h(M)(
                e.value.style.chart.layout.labels.dataLabels.formatter,
                s.value[a].value,
                h(x)({
                  p: e.value.style.chart.layout.labels.dataLabels.prefix,
                  v: s.value[a].value,
                  s: e.value.style.chart.layout.labels.dataLabels.suffix,
                  r: e.value.style.chart.layout.labels.captions.roundingValue
                }),
                { datapoint: s.value[a], position: l }
              )), 1)) : p("", !0)
            ], 4)
          ], 8, zt)) : p("", !0)
        ], 64))), 256)),
        (r(!0), i(T, null, V(U.value, (l, a) => (r(), i("rect", {
          onMouseover: (u) => Ae(a),
          onMouseleave: o[0] || (o[0] = (u) => {
            Z.value = !1, O.value = null;
          }),
          x: l.x + e.value.style.chart.layout.grid.spaceBetween / 2,
          y: l.y + e.value.style.chart.layout.grid.spaceBetween / 2,
          height: J.value <= 0 ? 1e-4 : J.value,
          width: G.value <= 0 ? 1e-4 : G.value,
          fill: "transparent",
          stroke: "none"
        }, null, 40, At))), 256)),
        b(t.$slots, "svg", { svg: P.value }, void 0, !0)
      ], 14, bt)) : p("", !0),
      t.$slots.watermark ? (r(), i("div", Vt, [
        b(t.$slots, "watermark", q(H({ isPrinting: h(ie) || h(ce) })), void 0, !0)
      ])) : p("", !0),
      X.value ? p("", !0) : (r(), Q(ft, {
        key: 4,
        config: {
          type: "waffle",
          style: {
            backgroundColor: e.value.style.chart.backgroundColor,
            waffle: {
              color: "#CCCCCC"
            }
          }
        }
      }, null, 8, ["config"])),
      w("div", {
        ref_key: "chartLegend",
        ref: ne
      }, [
        e.value.style.chart.legend.show ? (r(), Q(yt, {
          key: 0,
          legendSet: A.value,
          config: Oe.value,
          onClickMarker: o[1] || (o[1] = ({ legend: l }) => me(l.uid))
        }, {
          item: m(({ legend: l }) => [
            w("div", {
              onClick: (a) => l.segregate(),
              style: W(`opacity:${y.value.includes(l.uid) ? 0.5 : 1}`)
            }, [
              Ce(S(l.name) + ": " + S(h(M)(
                e.value.style.chart.layout.labels.dataLabels.formatter,
                l.value,
                h(x)({
                  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,
                  isAnimating: N.value
                }),
                { datapoint: l }
              )) + " ", 1),
              y.value.includes(l.uid) ? (r(), i("span", Et, " ( - % ) ")) : (r(), i("span", Dt, " (" + S(isNaN(l.value / _.value) ? "-" : h(x)({ v: l.value / _.value * 100, s: "%", r: e.value.style.chart.legend.roundingPercentage, isAnimating: N.value })) + ") ", 1))
            ], 12, Mt)
          ]),
          _: 1
        }, 8, ["legendSet", "config"])) : b(t.$slots, "legend", {
          key: 1,
          legend: A.value
        }, void 0, !0)
      ], 512),
      oe(dt, {
        show: I.value.showTooltip && Z.value && y.value.length < k.dataset.length,
        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,
        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: ee.value,
        isCustom: e.value.style.chart.tooltip.customFormat && typeof e.value.style.chart.tooltip.customFormat == "function",
        fontSize: e.value.style.chart.tooltip.fontSize
      }, {
        "tooltip-before": m(() => [
          b(t.$slots, "tooltip-before", q(H({ ...te.value })), void 0, !0)
        ]),
        "tooltip-after": m(() => [
          b(t.$slots, "tooltip-after", q(H({ ...te.value })), void 0, !0)
        ]),
        _: 3
      }, 8, ["show", "backgroundColor", "color", "borderRadius", "borderColor", "borderWidth", "backgroundOpacity", "position", "offsetY", "parent", "content", "isCustom", "fontSize"]),
      X.value ? (r(), Q(pt, {
        key: 5,
        hideDetails: "",
        config: {
          open: I.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(() => [
          oe(ht, {
            colNames: K.value.colNames,
            head: K.value.head,
            body: K.value.body,
            config: K.value.config,
            title: `${e.value.style.chart.title.text}${e.value.style.chart.title.subtitle.text ? ` : ${e.value.style.chart.title.subtitle.text}` : ""}`,
            onClose: o[2] || (o[2] = (l) => I.value.showTable = !1)
          }, {
            th: m(({ th: l }) => [
              w("div", {
                innerHTML: l,
                style: { display: "flex", "align-items": "center" }
              }, null, 8, Gt)
            ]),
            td: m(({ td: l }) => [
              Ce(S(l.name || l), 1)
            ]),
            _: 1
          }, 8, ["colNames", "head", "body", "config", "title"])
        ]),
        _: 1
      }, 8, ["config"])) : p("", !0)
    ], 14, mt));
  }
}, tl = /* @__PURE__ */ gt(Rt, [["__scopeId", "data-v-876ae247"]]);
export {
  tl as default
};
