import { computed as w, ref as f, watch as Qe, onMounted as et, onBeforeUnmount as tt, openBlock as g, createElementBlock as k, normalizeClass as ze, normalizeStyle as B, createBlock as G, createCommentVNode as O, unref as C, createSlots as ot, withCtx as x, renderSlot as $, normalizeProps as U, guardReactiveProps as X, createVNode as Pe, Fragment as Ae, renderList as Fe, createElementVNode as S, toDisplayString as Y, createTextVNode as Ie, nextTick as lt, pushScopeId as at, popScopeId as nt } from "vue";
import { u as st, c as Le, t as rt, a as ut, p as T, b as it, o as ct, e as dt, d as ae, i as ne, f as K, X as vt, l as Re, G as De, x as Me, y as ht, q as ft, r as pt } from "./index-Cm2_6s9o.js";
import { _ as gt } from "./Title-Coit3NcT.js";
import { u as yt, U as mt } from "./usePrinter-Cx8U1e30.js";
import { _ as bt } from "./Tooltip-BBgfUr4a.js";
import { L as wt } from "./Legend-DRozxv9L.js";
import kt from "./vue-ui-skeleton-BUS6A44x.js";
import { D as Ct } from "./DataTable-NGi-FgLM.js";
import $t from "./vue-ui-accordion-CxrNF8BI.js";
import { t as xt, u as Tt } from "./useResponsive-CoxXLe23.js";
import { u as Ve } from "./useNestedProp-BYPZJNhi.js";
import { _ as _t } from "./PackageVersion-CTMY4zeY.js";
import { P as Ot } from "./PenAndPaper-DJ_d10S-.js";
import { _ as St } from "./_plugin-vue_export-helper-CHgC5LLL.js";
function Be(a, i) {
  const s = a.length;
  if (s === 0)
    throw new Error(`Max aspect ratio cannot be computed: ${a} is an empty array`);
  {
    let n = 1 / 0, u = -1 / 0, c = 0;
    for (let h = 0; h < s; h += 1) {
      const v = a[h].normalizedValue;
      v < n && (n = v), v > u && (u = v), c += v;
    }
    return Math.max(
      i ** 2 * u / c ** 2,
      c ** 2 / (i ** 2 * n)
    );
  }
}
function We(a) {
  const { xOffset: i, yOffset: s, width: n, height: u } = a;
  return {
    x0: i,
    y0: s,
    x1: i + n,
    y1: s + u
  };
}
function Nt(a, i, s) {
  if (a.length === 0)
    return !0;
  {
    const n = a.concat(i), u = Be(
      a,
      s
    ), c = Be(n, s);
    return u >= c;
  }
}
function zt(a) {
  const i = [], s = a.length;
  for (let n = 0; n < s; n += 1) {
    const u = a[n], c = u.length;
    for (let d = 0; d < c; d += 1)
      i.push(u[d]);
  }
  return i;
}
function Pt(a, i) {
  const s = {
    ...i,
    children: a
  };
  return Ee(s);
}
function At(a) {
  return (a.x1 - a.x0) * (a.y1 - a.y0);
}
function He(a, i) {
  const { width: s, height: n, xOffset: u, yOffset: c } = ce(i), d = a.length, h = a.map((p) => p.normalizedValue || 0).reduce((p, _) => p + _, 0), v = h / n, N = h / s;
  let b = u, z = c;
  const y = [];
  if (s >= n) {
    for (let p = 0; p < d; p += 1) {
      const _ = a[p], P = z + _.normalizedValue / v, R = {
        x0: b,
        y0: z,
        x1: b + v,
        y1: P
      }, A = Object.assign({}, _, R);
      z = P, y.push(A);
    }
    return y;
  } else {
    for (let p = 0; p < d; p += 1) {
      const _ = a[p], P = b + _.normalizedValue / N, R = {
        x0: b,
        y0: z,
        x1: P,
        y1: z + N
      }, A = Object.assign({}, _, R);
      b = P, y.push(A);
    }
    return y;
  }
}
function Ft(a) {
  const i = ce(a), s = i.width, n = i.height;
  return Math.min(s, n);
}
function It(a, i) {
  const s = a.length, n = a.map((v) => v.value ?? 0).reduce((v, N) => v + N, 0), u = i / n, c = [];
  let d, h;
  for (let v = 0; v < s; v += 1)
    h = a[v], d = Object.assign({}, h, {
      normalizedValue: h.value * (u || 0)
    }), c.push(d);
  return c;
}
function ce(a) {
  const { x0: i, y0: s, x1: n, y1: u } = a;
  return {
    xOffset: i,
    yOffset: s,
    width: n - i,
    height: u - s
  };
}
function Lt(a, i, s, n) {
  let u = a, c = i, d = s, h = n;
  for (; ; ) {
    const v = u.length;
    if (v === 0) {
      const y = He(c, d);
      return h.concat(y);
    }
    const N = Ft(d), b = u[0], z = u.slice(1, v);
    if (Nt(c, b, N)) {
      const y = c.concat(b);
      u = z, c = y, d = d, h = h;
    } else {
      const y = c.length;
      let p = 0;
      for (let A = 0; A < y; A += 1)
        p += c[A].normalizedValue;
      const _ = Rt(d, p), P = He(c, d), R = h.concat(P);
      u = u, c = [], d = _, h = R;
    }
  }
}
function Ee(a) {
  if (typeof a.children > "u" || !a.children.length)
    return [a];
  {
    const i = It(
      a.children,
      At(a)
    ), s = Lt(i, [], a, []), n = s.length, u = [];
    for (let d = 0; d < n; d += 1)
      u.push(Ee(s[d]));
    return zt(u);
  }
}
function Rt(a, i) {
  const { width: s, height: n, xOffset: u, yOffset: c } = ce(a);
  if (s >= n) {
    const d = i / n, h = s - d, v = {
      xOffset: u + d,
      yOffset: c,
      width: h,
      height: n
    };
    return We(v);
  } else {
    const d = i / s, h = n - d, v = {
      xOffset: u,
      yOffset: c + d,
      width: s,
      height: h
    };
    return We(v);
  }
}
const Dt = (a) => (at("data-v-69853ca9"), a = a(), nt(), a), Mt = ["id"], Vt = ["xmlns", "viewBox"], Bt = { key: 0 }, Wt = ["id"], Ht = ["stop-color"], Et = ["stop-color"], Gt = ["x", "y", "height", "width", "fill", "rx", "stroke", "stroke-width", "onClick", "onMouseenter"], Ut = ["x", "y", "height", "width"], Xt = {
  style: { width: "100%", height: "100%" },
  class: "vue-ui-treemap-cell"
}, qt = /* @__PURE__ */ Dt(() => /* @__PURE__ */ S("br", null, null, -1)), jt = {
  key: 5,
  class: "vue-data-ui-watermark"
}, Yt = ["onClick"], Zt = { key: 0 }, Jt = { key: 1 }, Kt = ["innerHTML"], Qt = {
  __name: "vue-ui-treemap",
  props: {
    config: {
      type: Object,
      default() {
        return {};
      }
    },
    dataset: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  emits: ["selectLegend", "selectDatapoint"],
  setup(a, { expose: i, emit: s }) {
    const n = a, { vue_ui_treemap: u } = st(), c = w(() => !!n.dataset && n.dataset.length), d = w(() => /^((?!chrome|android).)*safari/i.test(navigator.userAgent)), h = f(Le()), v = f(!1), N = f(""), b = f(!1), z = f(0), y = f([]), p = f(null), _ = f(null), P = f(null), R = f(null), A = f(null), de = f(0), ve = f(0), he = f(0), e = w({
      get: () => fe(),
      set: (t) => t
    });
    function fe() {
      const t = Ve({
        userConfig: n.config,
        defaultConfig: u
      });
      return t.theme ? {
        ...Ve({
          userConfig: rt.vue_ui_treemap[t.theme] || n.config,
          defaultConfig: t
        }),
        customPalette: ut[t.theme] || T
      } : t;
    }
    Qe(() => n.config, (t) => {
      e.value = fe(), de.value += 1, ve.value += 1, he.value += 1;
    }, { deep: !0 });
    const { isPrinting: pe, isImaging: ge, generatePdf: ye, generateImage: me } = yt({
      elementId: `treemap_${h.value}`,
      fileName: e.value.style.chart.title.text || "vue-ui-treemap"
    }), Ge = w(() => e.value.userOptions.show && !e.value.style.chart.title.text), Q = w(() => it(e.value.customPalette)), D = f({
      showTable: e.value.table.show,
      showTooltip: e.value.style.chart.tooltip.show
    }), M = f({
      height: e.value.style.chart.height,
      width: e.value.style.chart.width
    }), W = w(() => ({
      bottom: M.value.height - e.value.style.chart.padding.bottom,
      height: M.value.height - e.value.style.chart.padding.top - e.value.style.chart.padding.bottom,
      left: e.value.style.chart.padding.left,
      right: M.value.width - e.value.style.chart.padding.right,
      top: e.value.style.chart.padding.top,
      vbHeight: M.value.height,
      vbWidth: M.value.width,
      width: M.value.width - e.value.style.chart.padding.left - e.value.style.chart.padding.right
    }));
    function be(t) {
      t.forEach((l, o) => {
        l.id = Le(), l.color = ae(l.color) || Q.value[o] || T[o] || T[o % T.length], l.children && (l.children.forEach((r) => {
          r.parentId = l.id, r.color = l.color;
        }), be(l.children));
      });
    }
    const H = f(n.dataset), ee = f(null);
    et(() => {
      Ue();
    });
    function Ue() {
      if (ct(n.dataset) && dt({
        componentName: "VueUiTreemap",
        type: "dataset"
      }), be(H.value), e.value.responsive) {
        const t = xt(() => {
          const { width: l, height: o } = Tt({
            chart: p.value,
            title: e.value.style.chart.title.text ? _.value : null,
            legend: e.value.style.chart.legend.show ? P.value : null,
            source: R.value,
            noTitle: A.value
          });
          M.value.width = l, M.value.height = o;
        });
        ee.value = new ResizeObserver(t), ee.value.observe(p.value.parentNode);
      }
    }
    tt(() => {
      ee.value && ee.value.disconnect();
    });
    const se = f(H.value), Z = w(() => se.value.map((t, l) => ({
      ...t,
      color: ae(t.color) || Q.value[l] || T[l] || T[l % T.length]
    })).filter((t) => !y.value.includes(t.id))), q = w(() => H.value.filter((t) => !y.value.includes(t.id)).map((t) => t.value || 0).reduce((t, l) => t + l, 0)), we = w({
      get() {
        let t = [...Z.value];
        return e.value.style.chart.layout.sorted && (t = [...Z.value].sort((l, o) => o.value - l.value)), t.map((l) => ({
          ...l
        }));
      },
      set(t) {
        return t;
      }
    });
    function ke(t, l) {
      return t.value / l;
    }
    function Xe(t, l, o) {
      const r = e.value.style.chart.layout.rects.colorRatio - ke(l, o);
      return Re(t, r < 0 ? 0 : r);
    }
    function Ce(t, l, o, r) {
      return t.map((m, V) => {
        const le = Xe(ae(l) || Q.value[V] || T[V] || T[V % T.length], m, r), Ke = ke(m, r);
        return {
          ...m,
          color: le,
          proportion: Ke,
          parentName: o,
          children: m.children ? Ce(m.children, le, m.name, r) : void 0
        };
      });
    }
    const J = w(() => Pt(
      we.value.map((t, l) => {
        const o = t.children ? t.children.reduce((r, m) => r + m.value, 0) : t.value;
        return {
          value: t.value,
          id: t.id,
          children: t.children ? Ce(t.children.sort((r, m) => m.value - r.value), t.color, t.name, o) : void 0,
          color: t.color,
          name: t.name
        };
      }),
      { x0: W.value.left * 2, y0: W.value.top, x1: W.value.width, y1: W.value.height }
    ));
    function $e({ y0: t, y1: l }) {
      return l - t <= 0 ? 1e-4 : l - t;
    }
    function xe({ x0: t, x1: l }) {
      return l - t <= 0 ? 1e-4 : l - t;
    }
    function E(t) {
      const l = e.value.style.chart.layout.labels.fontSize * (t.proportion * 2 > 1 ? 1 : t.proportion * 2);
      return l < e.value.style.chart.layout.labels.minFontSize ? e.value.style.chart.layout.labels.minFontSize : l;
    }
    function qe(t) {
      b.value = t, z.value += 1;
    }
    const j = w(() => ({
      startX: 0,
      startY: 0,
      width: W.value.vbWidth,
      height: W.value.vbHeight
    })), F = f(!1);
    function re(t, l = H.value) {
      for (const o of l) {
        if (o.id === t)
          return o;
        if (o.children) {
          const r = re(t, o.children);
          if (r)
            return r;
        }
      }
      return null;
    }
    function je(t) {
      if (F.value)
        s("selectDatapoint", void 0), se.value = H.value;
      else {
        if (s("selectDatapoint", t), !re(t.parentId))
          return;
        se.value = [re(t.parentId)];
      }
      F.value = !F.value;
    }
    const I = f(null), Te = w(() => H.value.map((t, l) => ({
      ...t,
      color: ae(t.color) || Q.value[l] || T[l] || T[l % T.length],
      shape: "square"
    })).sort((t, l) => l.value - t.value).map((t, l) => ({
      ...t,
      proportion: t.value / H.value.map((o) => o.value).reduce((o, r) => o + r, 0),
      opacity: y.value.includes(t.id) ? 0.5 : 1
    }))), Ye = w(() => ({
      cy: "treemap-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" : ""
    }));
    function _e(t) {
      F.value = !1, I.value = null, y.value.includes(t.id) ? y.value = y.value.filter((l) => l !== t.id) : y.value.length < n.dataset.length - 1 && y.value.push(t.id), s("selectLegend", we.value);
    }
    const ue = f(null);
    function Ze({ datapoint: t, seriesIndex: l }) {
      I.value = t, ue.value = { datapoint: t, seriesIndex: l, config: e.value, series: Z.value };
      const o = e.value.style.chart.tooltip.customFormat;
      if (Me(o) && ht(() => o({
        seriesIndex: l,
        datapoint: t,
        series: Z.value,
        config: e.value
      })))
        N.value = o({
          seriesIndex: l,
          datapoint: t,
          series: Z.value,
          config: e.value
        });
      else {
        let r = "";
        r += `<div style="width:100%;text-align:center;border-bottom:1px solid ${e.value.style.chart.tooltip.borderColor};padding-bottom:6px;margin-bottom:3px;">${t.name}</div>`, r += `<div style="display:flex;flex-direction:row;gap:6px;align-items:center;"><svg viewBox="0 0 12 12" height="14" width="14"><rect x="0" y="0" height="12" width="12" stroke="none" fill="${t.color}"/></svg>`, r += `<b>${ne(
          e.value.style.chart.layout.labels.formatter,
          t.value,
          K({
            p: e.value.style.chart.layout.labels.prefix,
            v: t.value,
            s: e.value.style.chart.layout.labels.suffix,
            r: e.value.style.chart.tooltip.roundingValue
          }),
          { datapoint: t, seriesIndex: l }
        )}</b>`, N.value = `<div>${r}</div>`;
      }
      v.value = !0;
    }
    const L = w(() => {
      const t = J.value.map((o) => ({
        name: o.name,
        color: o.color
      })), l = J.value.map((o) => o.value);
      return { head: t, body: l };
    });
    function Oe() {
      lt(() => {
        const t = L.value.head.map((r, m) => [[
          r.name
        ], [L.value.body[m]], [isNaN(L.value.body[m] / q.value) ? "-" : L.value.body[m] / q.value * 100]]), l = [[e.value.style.chart.title.text], [e.value.style.chart.title.subtitle.text], [[""], ["val"], ["%"]]].concat(t), o = ft(l);
        pt({ csvContent: o, title: e.value.style.chart.title.text || "vue-ui-treemap" });
      });
    }
    const te = w(() => {
      const t = [
        e.value.table.columnNames.series,
        e.value.table.columnNames.value,
        e.value.table.columnNames.percentage
      ], l = L.value.head.map((m, V) => {
        const le = ne(
          e.value.style.chart.layout.labels.formatter,
          L.value.body[V],
          K({
            p: e.value.style.chart.layout.labels.prefix,
            v: L.value.body[V],
            s: e.value.style.chart.layout.labels.suffix,
            r: e.value.table.td.roundingValue
          })
        );
        return [
          {
            color: m.color,
            name: m.name,
            shape: "square"
          },
          le,
          isNaN(L.value.body[V] / q.value) ? "-" : K({
            v: L.value.body[V] / q.value * 100,
            s: "%",
            r: e.value.table.td.roundingPercentage
          })
        ];
      }), o = {
        th: {
          backgroundColor: e.value.table.th.backgroundColor,
          color: e.value.table.th.color,
          outline: e.value.table.th.outline
        },
        td: {
          backgroundColor: e.value.table.td.backgroundColor,
          color: e.value.table.td.color,
          outline: e.value.table.td.outline
        },
        breakpoint: e.value.table.responsiveBreakpoint
      };
      return {
        colNames: [
          e.value.table.columnNames.series,
          e.value.table.columnNames.value
        ],
        head: t,
        body: l,
        config: o
      };
    });
    function Je() {
      return J.value;
    }
    function Se() {
      D.value.showTable = !D.value.showTable;
    }
    function Ne() {
      D.value.showTooltip = !D.value.showTooltip;
    }
    const oe = f(!1);
    function ie() {
      oe.value = !oe.value;
    }
    return i({
      getData: Je,
      generateCsv: Oe,
      generateImage: me,
      generatePdf: ye,
      toggleTable: Se,
      toggleTooltip: Ne,
      toggleAnnotator: ie
    }), (t, l) => (g(), k("div", {
      ref_key: "treemapChart",
      ref: p,
      class: ze(`vue-ui-treemap ${b.value ? "vue-data-ui-wrapper-fullscreen" : ""} ${e.value.useCssAnimation ? "" : "vue-ui-dna"}`),
      style: B(`font-family:${e.value.style.fontFamily};width:100%; ${e.value.responsive ? "height: 100%;" : ""} text-align:center;background:${e.value.style.chart.backgroundColor}`),
      id: `treemap_${h.value}`
    }, [
      e.value.userOptions.buttons.annotator ? (g(), G(Ot, {
        key: 0,
        parent: p.value,
        backgroundColor: e.value.style.chart.backgroundColor,
        color: e.value.style.chart.color,
        active: oe.value,
        onClose: ie
      }, null, 8, ["parent", "backgroundColor", "color", "active"])) : O("", !0),
      Ge.value ? (g(), k("div", {
        key: 1,
        ref_key: "noTitle",
        ref: A,
        class: "vue-data-ui-no-title-space",
        style: "height:36px; width: 100%;background:transparent"
      }, null, 512)) : O("", !0),
      e.value.style.chart.title.text ? (g(), k("div", {
        key: 2,
        ref_key: "chartTitle",
        ref: _,
        style: B(`width:100%;background:${e.value.style.chart.backgroundColor};padding-bottom:6px`)
      }, [
        (g(), G(gt, {
          key: `title_${de.value}`,
          config: {
            title: {
              cy: "treemap-div-title",
              ...e.value.style.chart.title
            },
            subtitle: {
              cy: "treemap-div-subtitle",
              ...e.value.style.chart.title.subtitle
            }
          }
        }, null, 8, ["config"]))
      ], 4)) : O("", !0),
      e.value.userOptions.show && c.value ? (g(), G(mt, {
        ref: "details",
        key: `user_option_${z.value}`,
        backgroundColor: e.value.style.chart.backgroundColor,
        color: e.value.style.chart.color,
        isPrinting: C(pe),
        isImaging: C(ge),
        uid: h.value,
        hasTooltip: e.value.userOptions.buttons.tooltip && e.value.style.chart.tooltip.show,
        hasPdf: e.value.userOptions.buttons.pdf,
        hasXls: e.value.userOptions.buttons.csv,
        hasImg: e.value.userOptions.buttons.img,
        hasTable: e.value.userOptions.buttons.table,
        hasFullscreen: e.value.userOptions.buttons.fullscreen,
        isFullscreen: b.value,
        isTooltip: D.value.showTooltip,
        titles: { ...e.value.userOptions.buttonTitles },
        chartElement: p.value,
        position: e.value.userOptions.position,
        hasAnnotator: e.value.userOptions.buttons.annotator,
        isAnnotation: oe.value,
        onToggleFullscreen: qe,
        onGeneratePdf: C(ye),
        onGenerateCsv: Oe,
        onGenerateImage: C(me),
        onToggleTable: Se,
        onToggleTooltip: Ne,
        onToggleAnnotator: ie
      }, ot({ _: 2 }, [
        t.$slots.optionTooltip ? {
          name: "optionTooltip",
          fn: x(() => [
            $(t.$slots, "optionTooltip", {}, void 0, !0)
          ]),
          key: "0"
        } : void 0,
        t.$slots.optionPdf ? {
          name: "optionPdf",
          fn: x(() => [
            $(t.$slots, "optionPdf", {}, void 0, !0)
          ]),
          key: "1"
        } : void 0,
        t.$slots.optionCsv ? {
          name: "optionCsv",
          fn: x(() => [
            $(t.$slots, "optionCsv", {}, void 0, !0)
          ]),
          key: "2"
        } : void 0,
        t.$slots.optionImg ? {
          name: "optionImg",
          fn: x(() => [
            $(t.$slots, "optionImg", {}, void 0, !0)
          ]),
          key: "3"
        } : void 0,
        t.$slots.optionTable ? {
          name: "optionTable",
          fn: x(() => [
            $(t.$slots, "optionTable", {}, void 0, !0)
          ]),
          key: "4"
        } : void 0,
        t.$slots.optionFullscreen ? {
          name: "optionFullscreen",
          fn: x(({ toggleFullscreen: o, isFullscreen: r }) => [
            $(t.$slots, "optionFullscreen", U(X({ toggleFullscreen: o, isFullscreen: r })), void 0, !0)
          ]),
          key: "5"
        } : void 0,
        t.$slots.optionAnnotator ? {
          name: "optionAnnotator",
          fn: x(({ toggleAnnotator: o, isAnnotator: r }) => [
            $(t.$slots, "optionAnnotator", U(X({ toggleAnnotator: o, isAnnotator: r })), void 0, !0)
          ]),
          key: "6"
        } : void 0
      ]), 1032, ["backgroundColor", "color", "isPrinting", "isImaging", "uid", "hasTooltip", "hasPdf", "hasXls", "hasImg", "hasTable", "hasFullscreen", "isFullscreen", "isTooltip", "titles", "chartElement", "position", "hasAnnotator", "isAnnotation", "onGeneratePdf", "onGenerateImage"])) : O("", !0),
      c.value ? (g(), k("svg", {
        key: 4,
        xmlns: C(vt),
        class: ze({ "vue-data-ui-fullscreen--on": b.value, "vue-data-ui-fulscreen--off": !b.value, "vue-data-ui-zoom-plus": !F.value, "vue-data-ui-zoom-minus": F.value }),
        viewBox: `${j.value.startX} ${j.value.startY} ${j.value.width <= 0 ? 10 : j.value.width} ${j.value.height <= 0 ? 10 : j.value.height}`,
        style: B(`max-width:100%; overflow: hidden; background:transparent;color:${e.value.style.chart.color}`)
      }, [
        Pe(_t),
        (g(!0), k(Ae, null, Fe(J.value, (o, r) => (g(), k("g", null, [
          e.value.style.chart.layout.rects.gradient.show ? (g(), k("defs", Bt, [
            S("radialGradient", {
              id: `tgrad_${o.id}`,
              gradientTransform: "translate(-1, -1.000001) scale(2, 2)"
            }, [
              S("stop", {
                offset: "18%",
                "stop-color": o.color
              }, null, 8, Ht),
              S("stop", {
                offset: "100%",
                "stop-color": C(Re)(o.color, e.value.style.chart.layout.rects.gradient.intensity / 100)
              }, null, 8, Et)
            ], 8, Wt)
          ])) : O("", !0)
        ]))), 256)),
        (g(!0), k(Ae, null, Fe(J.value, (o, r) => (g(), k("g", null, [
          S("rect", {
            x: o.x0,
            y: o.y0,
            height: $e(o),
            width: xe(o),
            fill: d.value ? o.color : e.value.style.chart.layout.rects.gradient.show ? `url(#tgrad_${o.id})` : o.color,
            rx: e.value.style.chart.layout.rects.borderRadius,
            stroke: I.value && I.value.id === o.id ? e.value.style.chart.layout.rects.selected.stroke : e.value.style.chart.layout.rects.stroke,
            "stroke-width": I.value && I.value.id === o.id ? e.value.style.chart.layout.rects.selected.strokeWidth : e.value.style.chart.layout.rects.strokeWidth,
            onClick: (m) => je(o),
            onMouseenter: () => Ze({
              datapoint: o,
              seriesIndex: r
            }),
            onMouseleave: l[0] || (l[0] = (m) => {
              I.value = null, v.value = !1;
            }),
            style: B(`opacity:${I.value ? I.value.id === o.id ? 1 : e.value.style.chart.layout.rects.selected.unselectedOpacity : 1}`),
            class: "vue-ui-treemap-rect"
          }, null, 44, Gt),
          (g(), k("foreignObject", {
            x: o.x0,
            y: o.y0,
            height: $e(o),
            width: xe(o),
            class: "vue-ui-treemap-cell-foreignObject"
          }, [
            S("div", Xt, [
              e.value.style.chart.layout.labels.showDefaultLabels && (o.proportion > e.value.style.chart.layout.labels.hideUnderProportion || F.value) ? (g(), k("div", {
                key: 0,
                class: "vue-ui-treemap-cell-default",
                style: B(`width:calc(100% - ${E(o) / 1.5}px);text-align:left;line-height:${E(o) < 14 ? 14 : E(o)}px;padding:${E(o) / 3}px; color:${C(De)(o.color)}`)
              }, [
                S("span", {
                  style: B(`width:100%;font-size:${E(o)}px;`)
                }, Y(o.name), 5),
                qt,
                S("span", {
                  style: B(`width:100%;font-size:${E(o)}px;`)
                }, Y(C(ne)(
                  e.value.style.chart.layout.labels.formatter,
                  o.value,
                  C(K)({
                    p: e.value.style.chart.layout.labels.prefix,
                    v: o.value,
                    s: e.value.style.chart.layout.labels.suffix,
                    r: e.value.style.chart.layout.labels.rounding
                  }),
                  { datapoint: o }
                )), 5)
              ], 4)) : O("", !0),
              $(t.$slots, "rect", U(X({
                rect: o,
                shouldShow: o.proportion > e.value.style.chart.layout.labels.hideUnderProportion || F.value,
                fontSize: E(o),
                isZoom: F.value,
                textColor: C(De)(o.color)
              })), void 0, !0)
            ])
          ], 8, Ut))
        ]))), 256)),
        $(t.$slots, "svg", U(X({ svg: W.value, isZoom: F.value, rect: I.value, config: e.value })), void 0, !0)
      ], 14, Vt)) : O("", !0),
      t.$slots.watermark ? (g(), k("div", jt, [
        $(t.$slots, "watermark", U(X({ isPrinting: C(pe) || C(ge) })), void 0, !0)
      ])) : O("", !0),
      c.value ? O("", !0) : (g(), G(kt, {
        key: 6,
        config: {
          type: "treemap",
          style: {
            backgroundColor: e.value.style.chart.backgroundColor,
            treemap: {
              color: "#CCCCCC"
            }
          }
        }
      }, null, 8, ["config"])),
      S("div", {
        ref_key: "chartLegend",
        ref: P
      }, [
        e.value.style.chart.legend.show ? (g(), G(wt, {
          key: `legend_${he.value}`,
          legendSet: Te.value,
          config: Ye.value,
          id: `treemap_legend_${h.value}`,
          onClickMarker: l[1] || (l[1] = ({ legend: o }) => _e(o))
        }, {
          item: x(({ legend: o, index: r }) => [
            S("div", {
              onClick: (m) => _e(o),
              style: B(`opacity:${y.value.includes(o.id) ? 0.5 : 1}`)
            }, [
              Ie(Y(o.name) + ": " + Y(C(ne)(
                e.value.style.chart.layout.labels.formatter,
                o.value,
                C(K)({
                  p: e.value.style.chart.layout.labels.prefix,
                  v: o.value,
                  s: e.value.style.chart.layout.labels.suffix,
                  r: e.value.style.chart.legend.roundingValue
                }),
                { datapoint: o }
              )) + " ", 1),
              y.value.includes(o.id) ? (g(), k("span", Jt, " ( - % ) ")) : (g(), k("span", Zt, " (" + Y(isNaN(o.value / q.value) ? "-" : (o.value / q.value * 100).toFixed(e.value.style.chart.legend.roundingPercentage)) + "%) ", 1))
            ], 12, Yt)
          ]),
          _: 1
        }, 8, ["legendSet", "config", "id"])) : $(t.$slots, "legend", {
          key: 1,
          legend: Te.value
        }, void 0, !0)
      ], 512),
      t.$slots.source ? (g(), k("div", {
        key: 7,
        ref_key: "source",
        ref: R,
        dir: "auto"
      }, [
        $(t.$slots, "source", {}, void 0, !0)
      ], 512)) : O("", !0),
      Pe(bt, {
        show: D.value.showTooltip && v.value,
        backgroundColor: e.value.style.chart.tooltip.backgroundColor,
        color: e.value.style.chart.tooltip.color,
        fontSize: e.value.style.chart.tooltip.fontSize,
        borderRadius: e.value.style.chart.tooltip.borderRadius,
        borderColor: e.value.style.chart.tooltip.borderColor,
        borderWidth: e.value.style.chart.tooltip.borderWidth,
        backgroundOpacity: e.value.style.chart.tooltip.backgroundOpacity,
        position: e.value.style.chart.tooltip.position,
        offsetY: e.value.style.chart.tooltip.offsetY,
        parent: p.value,
        content: N.value,
        isFullscreen: b.value,
        isCustom: C(Me)(e.value.style.chart.tooltip.customFormat)
      }, {
        "tooltip-before": x(() => [
          $(t.$slots, "tooltip-before", U(X({ ...ue.value })), void 0, !0)
        ]),
        "tooltip-after": x(() => [
          $(t.$slots, "tooltip-after", U(X({ ...ue.value })), void 0, !0)
        ]),
        _: 3
      }, 8, ["show", "backgroundColor", "color", "fontSize", "borderRadius", "borderColor", "borderWidth", "backgroundOpacity", "position", "offsetY", "parent", "content", "isFullscreen", "isCustom"]),
      c.value ? (g(), G($t, {
        key: 8,
        hideDetails: "",
        config: {
          open: D.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: x(() => [
          (g(), G(Ct, {
            key: `table_${ve.value}`,
            colNames: te.value.colNames,
            head: te.value.head,
            body: te.value.body,
            config: te.value.config,
            title: `${e.value.style.chart.title.text}${e.value.style.chart.title.subtitle.text ? ` : ${e.value.style.chart.title.subtitle.text}` : ""}`,
            onClose: l[2] || (l[2] = (o) => D.value.showTable = !1)
          }, {
            th: x(({ th: o }) => [
              S("div", {
                innerHTML: o,
                style: { display: "flex", "align-items": "center" }
              }, null, 8, Kt)
            ]),
            td: x(({ td: o }) => [
              Ie(Y(o.name || o), 1)
            ]),
            _: 1
          }, 8, ["colNames", "head", "body", "config", "title"]))
        ]),
        _: 1
      }, 8, ["config"])) : O("", !0)
    ], 14, Mt));
  }
}, po = /* @__PURE__ */ St(Qt, [["__scopeId", "data-v-69853ca9"]]);
export {
  po as default
};
