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