import { useCssVars as Ge, computed as b, ref as p, onMounted as Ue, onBeforeUnmount as He, openBlock as i, createElementBlock as v, normalizeClass as O, normalizeStyle as d, createVNode as A, createCommentVNode as m, createBlock as oe, unref as y, createSlots as We, withCtx as _, renderSlot as x, normalizeProps as j, guardReactiveProps as Y, createElementVNode as u, toDisplayString as c, Fragment as E, renderList as G, withKeys as je, createTextVNode as Ye } from "vue";
import { u as qe, c as Ke, t as Je, a as Qe, p as z, b as Ze, o as Ce, e as q, s as T, d as ue, i as K, f as F, X as et, v as tt, w as ne, x as at, y as lt, q as ot, r as ut } from "./index-CguVaFlt.js";
import { t as nt, u as st } from "./useResponsive-NZB-WLRF.js";
import { _ as rt } from "./Title-DbTGPg4G.js";
import { u as it, U as dt } from "./usePrinter-ClsMRVJG.js";
import { _ as ct } from "./Tooltip-u79R5W5y.js";
import { L as Te } from "./Legend-CsVEDSh6.js";
import vt from "./vue-ui-skeleton-ChHLL5Hw.js";
import ht from "./BaseIcon-BNFf4B_v.js";
import pt from "./vue-ui-accordion-w15FGKRN.js";
import { u as Le } from "./useNestedProp-BbEbJmgv.js";
import { _ as yt } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const gt = ["id"], ft = ["onClick"], bt = ["xmlns", "viewBox"], mt = ["id"], _t = ["stop-color"], xt = ["stop-color"], kt = ["x", "y", "width", "height", "fill", "rx"], $t = ["x", "y", "width", "height", "fill", "rx", "stroke", "stroke-width"], wt = ["x2", "y1", "y2", "stroke", "stroke-width"], Ct = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Tt = ["x", "y", "text-anchor", "font-size", "fill", "font-weight"], Lt = ["x", "y", "font-size", "fill", "font-weight"], Nt = ["x", "y", "font-size", "fill", "font-weight"], Pt = ["x", "y", "font-size", "fill", "font-weight"], St = ["y", "width", "height", "fill", "onMouseenter"], Vt = {
  key: 4,
  class: "vue-data-ui-watermark"
}, zt = ["onClick"], Ft = { style: "width:100%;padding-top: 36px;position:relative" }, Mt = { class: "vue-ui-data-table" }, It = { key: 0 }, Bt = { style: { width: "100%" } }, Ot = ["data-cell"], Dt = { style: { display: "flex", "align-items": "center", gap: "5px", "justify-content": "flex-end", width: "100%", "padding-right": "3px" } }, Rt = ["data-cell"], Xt = { style: { display: "flex", "align-items": "center", gap: "5px", "justify-content": "flex-end", width: "100%", "padding-right": "3px" } }, At = ["data-cell"], Et = { style: { display: "flex", "align-items": "center", gap: "5px", "justify-content": "flex-end", width: "100%", "padding-right": "3px" } }, Gt = ["data-cell"], Ut = { style: { display: "flex", "align-items": "center", gap: "5px", "justify-content": "flex-end", width: "100%", "padding-right": "3px" } }, Ht = ["data-cell"], Wt = { style: { display: "flex", "align-items": "center", gap: "5px", "justify-content": "flex-end", width: "100%", "padding-right": "3px" } }, jt = ["data-cell"], Yt = { style: { display: "flex", "align-items": "center", gap: "5px", "justify-content": "flex-end", width: "100%", "padding-right": "3px" } }, qt = ["data-cell"], Kt = { style: { display: "flex", "align-items": "center", gap: "5px", "justify-content": "flex-end", width: "100%", "padding-right": "3px" } }, Jt = {
  __name: "vue-ui-vertical-bar",
  props: {
    config: {
      type: Object,
      default() {
        return {};
      }
    },
    dataset: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  emits: ["selectLegend"],
  setup(Ne, { expose: Pe, emit: Se }) {
    const L = Ne;
    Ge((a) => ({
      "7bc84c58": a.tdo
    }));
    const { vue_ui_vertical_bar: Ve } = qe(), U = b(() => !!L.dataset && L.dataset.length), P = p(Ke()), ze = p(null), J = p(!1), Q = p(""), H = p(0), Fe = p(null), se = p(0), D = p(null), re = p(null), Z = p(null), e = b(() => {
      const a = Le({
        userConfig: L.config,
        defaultConfig: Ve
      });
      return a.theme ? {
        ...Le({
          userConfig: Je.vue_ui_vertical_bar[a.theme] || L.config,
          defaultConfig: a
        }),
        customPalette: Qe[a.theme] || z
      } : a;
    }), { isPrinting: ie, isImaging: de, generatePdf: ce, generateImage: ve } = it({
      elementId: `vue-ui-vertical-bar_${P.value}`,
      fileName: e.value.style.chart.title.text || "vue-ui-vertical-bar"
    }), he = b(() => Ze(e.value.customPalette)), pe = p(null), ye = p(!1), Me = b(() => e.value.table.responsiveBreakpoint), W = p(null);
    Ue(() => {
      if (Ce(L.dataset) && q({
        componentName: "VueUiVerticalBar",
        type: "dataset"
      }), H.value = L.dataset.flatMap((a) => a.children && a.children.length > 0 ? a.children.length : 1).reduce((a, l) => a + l, 0), Ie(), e.value.responsive) {
        const a = nt(() => {
          const { width: l, height: t } = st({
            chart: D.value,
            title: e.value.style.chart.title.text ? re.value : null,
            legend: e.value.style.chart.legend.show ? Z.value : null
          });
          be.value = l, h.value = t / H.value - f.value * 2;
        });
        W.value = new ResizeObserver(a), W.value.observe(D.value.parentNode);
      }
    }), He(() => {
      W.value && W.value.disconnect();
    });
    function Ie() {
      new ResizeObserver((l) => {
        l.forEach((t) => {
          ye.value = t.contentRect.width < Me.value;
        });
      }).observe(pe.value);
    }
    const k = p({
      showTable: e.value.table.show,
      sortDesc: e.value.style.chart.layout.bars.sort === "desc",
      showTooltip: e.value.style.chart.tooltip.show
    }), ge = b(() => k.value.sortDesc), S = b(() => (L.dataset.forEach((a, l) => {
      !a.value && !a.children && q({
        componentName: "VueUiVerticalBar",
        type: "datasetAttributeEmpty",
        property: `value (index ${l})`
      }), a.children && (Ce(a.children) ? q({
        componentName: "VueUiVerticalBar",
        type: "datasetAttributeEmpty",
        property: `children (index ${l})`
      }) : a.children.forEach((t, o) => {
        [null, void 0].includes(t.name) && q({
          componentName: "VueUiVerticalBar",
          type: "datasetSerieAttribute",
          property: "name",
          key: "children",
          index: o
        });
      }));
    }), L.dataset.map((a, l) => {
      const t = `vertical_parent_${l}_${P.value}`, o = !!a.children && a.children.length > 0;
      return {
        ...a,
        id: t,
        shape: "square",
        opacity: w.value.includes(t) ? 0.5 : 1,
        value: T(o ? a.children.map((s) => s.value || 0).reduce((s, r) => s + r, 0) : Math.abs(a.value) || 0),
        sign: a.value >= 0 ? 1 : -1,
        hasChildren: o,
        isChild: !1,
        segregate: () => R(t),
        isSegregated: w.value.includes(t),
        color: ue(a.color) || he.value[l] || z[l] || z[l % z.length],
        children: !a.children || !a.children.length ? [] : a.children.toSorted((s, r) => ge.value ? r.value - s.value : s.value - r.value).map((s, r) => ({
          ...s,
          value: T(Math.abs(s.value)),
          sign: s.value >= 0 ? 1 : -1,
          isChild: !0,
          parentId: t,
          parentName: a.name,
          parentValue: T(a.value || o ? a.children.map((le) => le.value || 0).reduce((le, Ee) => le + Ee, 0) : 0),
          id: `vertical_child_${l}_${r}_${P.value}`,
          childIndex: r,
          color: ue(s.color) || ue(a.color) || he.value[l] || z[l] || z[l % z.length]
        })).map((s, r) => ({
          ...s,
          isFirstChild: r === 0,
          isLastChild: r === a.children.length - 1
        }))
      };
    }).toSorted((a, l) => ge.value ? l.value - a.value : a.value - l.value))), fe = b(() => ({
      cy: "vertical-bar-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" : ""
    })), h = p(e.value.style.chart.layout.bars.height), f = p(e.value.style.chart.layout.bars.gap), Be = b(() => (h.value + f.value) * H.value), be = p(512), g = b(() => ({
      width: be.value,
      height: Be.value,
      padding: {
        top: 12,
        left: 128 + e.value.style.chart.layout.bars.offsetX,
        right: 64 + e.value.style.chart.layout.bars.paddingRight,
        bottom: 12
      }
    })), n = b(() => ({
      fullHeight: g.value.padding.top + g.value.padding.bottom + g.value.height,
      top: g.value.padding.top,
      left: g.value.padding.left,
      right: g.value.width - g.value.padding.right,
      bottom: g.value.padding.top + g.value.height,
      width: g.value.width - (g.value.padding.left + g.value.padding.right)
    }));
    function ee() {
      H.value = V.value.flatMap((a) => a.children && a.children.length > 0 ? a.children.length : 1).reduce((a, l) => a + l, 0);
    }
    const w = p([]);
    function R(a) {
      w.value.includes(a) ? w.value = w.value.filter((l) => l !== a) : w.value.push(a), ee(), Se("selectLegend", V.value);
    }
    const V = b(() => S.value.filter((a) => !w.value.includes(a.id))), C = b(() => V.value.map((a) => Math.abs(a.value)).reduce((a, l) => a + l, 0));
    function me(a, l = !1, t = 0) {
      return l ? F({
        v: T(Math.abs(a) / C.value * 100),
        s: "%",
        r: t
      }) : Math.abs(a) / C.value;
    }
    const M = b(() => V.value.flatMap((a) => a.hasChildren ? a.children : a)), I = b(() => M.value.map((a) => a.sign).includes(-1)), Oe = b(() => Math.max(...V.value.flatMap((a) => a.children && a.children.length ? Math.max(...a.children.map((l) => l.value)) : a.value)));
    function N(a) {
      const l = a / Oe.value;
      return n.value.width / (I.value ? 2 : 1) * l;
    }
    function De(a) {
      return N(a) + n.value.left;
    }
    function B(a, l) {
      const t = V.value.find((r) => r.id === a.parentId), o = n.value.top + (f.value + h.value) * l, s = t.children.length * (f.value + h.value);
      return {
        y: o + s / 2 - e.value.style.chart.layout.bars.parentLabels.fontSize,
        name: t.name,
        value: [void 0, NaN, null].includes(t.value) ? "" : t.sign === 1 ? t.value : -t.value,
        percentageToTotal: isNaN(t.value / C.value) ? "" : me(t.value, !0, e.value.style.chart.layout.bars.dataLabels.percentage.roundingPercentage),
        sign: t.sign
      };
    }
    function Re() {
      return V.value;
    }
    const te = p(null), ae = p(null);
    function Xe(a, l) {
      ae.value = {
        datapoint: a,
        seriesIndex: l,
        series: S.value,
        config: e.value
      }, J.value = !0, te.value = a.id;
      let t = "";
      const o = a.isChild ? a.parentName : a.name, s = a.isChild ? a.name : "", r = e.value.style.chart.tooltip.customFormat;
      at(r) && lt(() => r({
        datapoint: a,
        series: S.value,
        config: e.value,
        seriesIndex: l
      })) ? Q.value = r({
        datapoint: a,
        series: S.value,
        config: e.value,
        seriesIndex: l
      }) : (t += `<div style="width:100%;text-align:center;border-bottom:1px solid ${e.value.style.chart.tooltip.borderColor};padding-bottom:6px;margin-bottom:3px;text-align:left;">
                <div style="display:flex;align-items:center;gap:4px;"><svg viewBox="0 0 12 12" height="14" width="14"><rect x="0" y="0" height="12" width="12" rx="2" stroke="none" fill="${a.color}"/></svg> ${o}</div>
                ${s ? `<div>${s}</div>` : ""}
            </div>`, e.value.style.chart.tooltip.showValue && (t += `<div>${e.value.translations.value}: <b>${K(
        e.value.style.chart.layout.bars.dataLabels.value.formatter,
        a.sign === 1 ? a.value : -a.value,
        F({
          p: e.value.style.chart.tooltip.prefix,
          v: a.sign === 1 ? a.value : -a.value,
          s: e.value.style.chart.tooltip.suffix,
          r: e.value.style.chart.tooltip.roundingValue
        }),
        { datapoint: a, seriesIndex: l }
      )}</b></div>`), e.value.style.chart.tooltip.showPercentage && (t += `<div>${e.value.translations.percentageToTotal} : <b>${F({
        v: Math.abs(a.value) / C.value * 100,
        s: "%",
        r: e.value.style.chart.tooltip.roundingPercentage
      })}</b></div>`, a.isChild && (t += `<div>${e.value.translations.percentageToSerie}: <b>${F({
        v: Math.abs(a.value) / Math.abs(a.parentValue) * 100,
        s: "%",
        r: e.value.style.chart.tooltip.roundingPercentage
      })}</b></div>`)), Q.value = `<div style="text-align:left">${t}</div>`);
    }
    function _e(a, l, t, o) {
      if (!e.value.style.chart.layout.bars.dataLabels.value.show)
        return "";
      const s = K(
        e.value.style.chart.layout.bars.dataLabels.value.formatter,
        T(o === -1 && a >= 0 ? -a : a),
        F({
          p: e.value.style.chart.layout.bars.dataLabels.value.prefix,
          v: T(o === -1 && a >= 0 ? -a : a),
          s: e.value.style.chart.layout.bars.dataLabels.value.suffix,
          r: e.value.style.chart.layout.bars.dataLabels.value.roundingValue
        }),
        { datapoint: l, seriesIndex: t }
      ), r = `(${me(a, !0, e.value.style.chart.layout.bars.dataLabels.percentage.roundingPercentage)})`;
      return `${s}${e.value.style.chart.layout.bars.dataLabels.percentage.show ? ` ${r}` : ""}`;
    }
    const $ = b(() => {
      const a = [
        e.value.translations.parentName,
        e.value.translations.value,
        e.value.translations.percentageToTotal,
        e.value.translations.childName,
        e.value.translations.value,
        e.value.translations.percentageToSerie,
        e.value.translations.percentageToTotal
      ], l = M.value.map((t) => t.isChild ? t.isFirstChild ? {
        color: t.color,
        parentName: t.parentName,
        parentValue: t.parentValue,
        percentageToTotal: t.parentValue / C.value,
        childName: t.name,
        childValue: t.sign === 1 ? t.value : -t.value,
        childPercentageToParent: Math.abs(t.value) / Math.abs(t.parentValue),
        childPercentageToTotal: Math.abs(t.value) / C.value
      } : {
        color: "",
        parentName: "",
        parentValue: "",
        percentageToTotal: "",
        childName: t.name,
        childValue: t.sign === 1 ? t.value : -t.value,
        childPercentageToParent: Math.abs(t.value) / Math.abs(t.parentValue),
        childPercentageToTotal: Math.abs(t.value) / C.value
      } : {
        color: t.color,
        parentName: t.name,
        parentValue: t.sign === 1 ? t.value : -t.value,
        percentageToTotal: Math.abs(t.value) / C.value,
        childName: "",
        childValue: "",
        childPercentageToParent: "",
        childPercentageToTotal: ""
      });
      return { head: a, body: l };
    });
    function xe() {
      const a = [[e.value.style.chart.title.text], [e.value.style.chart.title.subtitle.text], [""]], l = $.value.head, t = $.value.body.map((r) => [
        r.parentName,
        r.parentValue,
        r.percentageToTotal,
        r.childName,
        r.childValue,
        r.childPercentageToParent,
        r.childPercentageToTotal
      ]), o = a.concat([l]).concat(t), s = ot(o);
      ut({ csvContent: s, title: e.value.style.chart.title.text || "vue-ui-vertical-bar" });
    }
    const X = p(!1);
    function Ae(a) {
      X.value = a, se.value += 1;
    }
    function ke() {
      k.value.showTable = !k.value.showTable;
    }
    function $e() {
      k.value.sortDesc = !k.value.sortDesc, ee();
    }
    function we() {
      k.value.showTooltip = !k.value.showTooltip;
    }
    return Pe({
      getData: Re,
      recalculateHeight: ee,
      generatePdf: ce,
      generateCsv: xe,
      generateImage: ve,
      toggleTable: ke,
      toggleSort: $e,
      toggleTooltip: we
    }), (a, l) => (i(), v("div", {
      class: O(`vue-ui-vertical-bar ${X.value ? "vue-data-ui-wrapper-fullscreen" : ""} ${e.value.useCssAnimation ? "" : "vue-ui-dna"}`),
      ref_key: "verticalBarChart",
      ref: D,
      id: `vue-ui-vertical-bar_${P.value}`,
      style: d(`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 ? (i(), v("div", {
        key: 0,
        ref_key: "chartTitle",
        ref: re,
        style: d(`width:100%;background:${e.value.style.chart.backgroundColor};padding-bottom:12px`)
      }, [
        A(rt, {
          config: {
            title: {
              cy: "vertical-bar-div-title",
              ...e.value.style.chart.title
            },
            subtitle: {
              cy: "vertical-bar-div-subtitle",
              ...e.value.style.chart.title.subtitle
            }
          }
        }, null, 8, ["config"])
      ], 4)) : m("", !0),
      e.value.userOptions.show && U.value ? (i(), oe(dt, {
        ref_key: "details",
        ref: ze,
        key: `user_options_${se.value}`,
        backgroundColor: e.value.style.chart.backgroundColor,
        color: e.value.style.chart.color,
        isImaging: y(de),
        isPrinting: y(ie),
        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,
        hasSort: e.value.userOptions.buttons.sort,
        hasFullscreen: e.value.userOptions.buttons.fullscreen,
        isFullscreen: X.value,
        isTooltip: k.value.showTooltip,
        titles: { ...e.value.userOptions.buttonTitles },
        chartElement: D.value,
        onToggleFullscreen: Ae,
        onGeneratePdf: y(ce),
        onGenerateCsv: xe,
        onGenerateImage: y(ve),
        onToggleTable: ke,
        onToggleSort: $e,
        onToggleTooltip: we
      }, We({ _: 2 }, [
        a.$slots.optionTooltip ? {
          name: "optionTooltip",
          fn: _(() => [
            x(a.$slots, "optionTooltip", {}, void 0, !0)
          ]),
          key: "0"
        } : void 0,
        a.$slots.optionPdf ? {
          name: "optionPdf",
          fn: _(() => [
            x(a.$slots, "optionPdf", {}, void 0, !0)
          ]),
          key: "1"
        } : void 0,
        a.$slots.optionCsv ? {
          name: "optionCsv",
          fn: _(() => [
            x(a.$slots, "optionCsv", {}, void 0, !0)
          ]),
          key: "2"
        } : void 0,
        a.$slots.optionImg ? {
          name: "optionImg",
          fn: _(() => [
            x(a.$slots, "optionImg", {}, void 0, !0)
          ]),
          key: "3"
        } : void 0,
        a.$slots.optionTable ? {
          name: "optionTable",
          fn: _(() => [
            x(a.$slots, "optionTable", {}, void 0, !0)
          ]),
          key: "4"
        } : void 0,
        a.$slots.optionLabels ? {
          name: "optionLabels",
          fn: _(() => [
            x(a.$slots, "optionLabels", {}, void 0, !0)
          ]),
          key: "5"
        } : void 0,
        a.$slots.optionSort ? {
          name: "optionSort",
          fn: _(() => [
            x(a.$slots, "optionSort", {}, void 0, !0)
          ]),
          key: "6"
        } : void 0,
        a.$slots.optionFullscreen ? {
          name: "optionFullscreen",
          fn: _(({ toggleFullscreen: t, isFullscreen: o }) => [
            x(a.$slots, "optionFullscreen", j(Y({ toggleFullscreen: t, isFullscreen: o })), void 0, !0)
          ]),
          key: "7"
        } : void 0
      ]), 1032, ["backgroundColor", "color", "isImaging", "isPrinting", "uid", "hasTooltip", "hasPdf", "hasImg", "hasXls", "hasTable", "hasSort", "hasFullscreen", "isFullscreen", "isTooltip", "titles", "chartElement", "onGeneratePdf", "onGenerateImage"])) : m("", !0),
      e.value.style.chart.legend.show && e.value.style.chart.legend.position === "top" ? (i(), v("div", {
        key: 2,
        ref_key: "chartLegend",
        ref: Z
      }, [
        A(Te, {
          legendSet: S.value,
          config: fe.value,
          onClickMarker: l[0] || (l[0] = ({ legend: t }) => R(t.id))
        }, {
          item: _(({ legend: t, index: o }) => [
            u("div", {
              "data-cy-legend-item": "",
              onClick: (s) => R(t.id),
              style: d(`opacity:${w.value.includes(t.id) ? 0.5 : 1}`)
            }, c(t.name) + ": " + c(y(K)(
              e.value.style.chart.layout.bars.dataLabels.value.formatter,
              t.value,
              y(F)({
                p: e.value.style.chart.legend.prefix,
                v: t.value,
                s: e.value.style.chart.legend.suffix,
                r: e.value.style.chart.legend.roundingValue
              }),
              { datapoint: t, seriesIndex: o }
            )), 13, ft)
          ]),
          _: 1
        }, 8, ["legendSet", "config"])
      ], 512)) : m("", !0),
      U.value ? (i(), v("svg", {
        key: 3,
        xmlns: y(et),
        class: O({ "vue-data-ui-fullscreen--on": X.value, "vue-data-ui-fulscreen--off": !X.value }),
        viewBox: `0 0 ${g.value.width <= 0 ? 10 : g.value.width} ${n.value.fullHeight <= 0 ? 10 : n.value.fullHeight}`,
        style: d(`max-width:100%;overflow:visible;background:${e.value.style.chart.backgroundColor};color:${e.value.style.chart.color}`)
      }, [
        (i(!0), v(E, null, G(M.value, (t, o) => (i(), v("linearGradient", {
          x1: "0%",
          y1: "0%",
          x2: "100%",
          y2: "0%",
          id: `vertical_bar_gradient_${P.value}_${o}`
        }, [
          u("stop", {
            offset: "0%",
            "stop-color": t.color
          }, null, 8, _t),
          u("stop", {
            offset: "100%",
            "stop-color": `${y(tt)(t.color, 0.03)}${y(ne)[100 - e.value.style.chart.layout.bars.gradientIntensity]}`
          }, null, 8, xt)
        ], 8, mt))), 256)),
        (i(!0), v(E, null, G(M.value, (t, o) => (i(), v("g", null, [
          u("rect", {
            x: y(T)(I.value ? n.value.left + n.value.width / 2 - (t.sign === 1 ? 0 : N(t.value) <= 0 ? 1e-4 : N(t.value)) : n.value.left),
            y: n.value.top + (f.value + h.value) * o,
            width: y(T)(N(t.value) <= 0 ? 1e-4 : N(t.value)),
            height: h.value <= 0 ? 1e-4 : h.value,
            fill: e.value.style.chart.layout.bars.underlayerColor,
            rx: e.value.style.chart.layout.bars.borderRadius,
            class: O({ animated: e.value.useCssAnimation })
          }, null, 10, kt)
        ]))), 256)),
        (i(!0), v(E, null, G(M.value, (t, o) => (i(), v("g", null, [
          u("rect", {
            x: y(T)(I.value ? n.value.left + n.value.width / 2 - (t.sign === 1 ? 0 : N(t.value) <= 0 ? 1e-4 : N(t.value)) : n.value.left),
            y: n.value.top + (f.value + h.value) * o,
            width: y(T)(N(t.value) <= 0 ? 1e-4 : N(t.value)),
            height: h.value <= 0 ? 1e-4 : h.value,
            fill: e.value.style.chart.layout.bars.useGradient ? `url(#vertical_bar_gradient_${P.value}_${o})` : `${t.color}${y(ne)[e.value.style.chart.layout.bars.fillOpacity]}`,
            rx: e.value.style.chart.layout.bars.borderRadius,
            stroke: e.value.style.chart.layout.bars.useStroke ? t.color : "none",
            "stroke-width": e.value.style.chart.layout.bars.useStroke ? e.value.style.chart.layout.bars.strokeWidth : 0,
            class: O({ animated: e.value.useCssAnimation })
          }, null, 10, $t),
          (!t.isChild || t.isLastChild) && e.value.style.chart.layout.separators.show && o !== M.value.length - 1 ? (i(), v("line", {
            key: 0,
            x1: 0,
            x2: n.value.left,
            y1: h.value + f.value / 2 + n.value.top + (f.value + h.value) * o,
            y2: h.value + f.value / 2 + n.value.top + (f.value + h.value) * o,
            stroke: e.value.style.chart.layout.separators.color,
            "stroke-width": e.value.style.chart.layout.separators.strokeWidth,
            "stroke-linecap": "round"
          }, null, 8, wt)) : m("", !0),
          I.value && e.value.style.chart.layout.separators.show ? (i(), v("line", {
            key: 1,
            x1: n.value.left + n.value.width / 2,
            x2: n.value.left + n.value.width / 2,
            y1: n.value.top,
            y2: n.value.bottom,
            stroke: e.value.style.chart.layout.separators.color,
            "stroke-width": e.value.style.chart.layout.separators.strokeWidth,
            "stroke-linecap": "round"
          }, null, 8, Ct)) : m("", !0),
          u("text", {
            x: I.value ? n.value.left + n.value.width / 2 + (t.sign === 1 ? -12 : 12) + (t.sign === 1 ? -e.value.style.chart.layout.bars.dataLabels.offsetX : e.value.style.chart.layout.bars.dataLabels.offsetX) : De(t.value) + 3 + e.value.style.chart.layout.bars.dataLabels.offsetX,
            y: n.value.top + (f.value + h.value) * o + h.value / 2 + e.value.style.chart.layout.bars.dataLabels.fontSize / 2,
            "text-anchor": !I.value || t.sign === -1 ? "start" : "end",
            "font-size": e.value.style.chart.layout.bars.dataLabels.fontSize,
            fill: e.value.style.chart.layout.bars.dataLabels.color,
            "font-weight": e.value.style.chart.layout.bars.dataLabels.bold ? "bold" : "normal"
          }, c(_e(t.value, t, o, t.sign)), 9, Tt),
          (t.isChild || !t.hasChildren) && e.value.style.chart.layout.bars.nameLabels.show ? (i(), v("text", {
            key: 2,
            "text-anchor": "end",
            x: n.value.left - 3 + e.value.style.chart.layout.bars.nameLabels.offsetX,
            y: n.value.top + (f.value + h.value) * o + h.value / 2 + e.value.style.chart.layout.bars.nameLabels.fontSize / 2,
            "font-size": e.value.style.chart.layout.bars.nameLabels.fontSize,
            fill: e.value.style.chart.layout.bars.nameLabels.color,
            "font-weight": e.value.style.chart.layout.bars.nameLabels.bold ? "bold" : "normal"
          }, c(t.name), 9, Lt)) : m("", !0),
          t.isChild && t.childIndex === 0 && e.value.style.chart.layout.bars.parentLabels.show ? (i(), v("text", {
            key: 3,
            x: 3 + e.value.style.chart.layout.bars.parentLabels.offsetX,
            y: B(t, o).y,
            "font-size": e.value.style.chart.layout.bars.parentLabels.fontSize,
            fill: e.value.style.chart.layout.bars.parentLabels.color,
            "font-weight": e.value.style.chart.layout.bars.parentLabels.bold ? "bold" : "normal",
            "text-anchor": "start"
          }, c(B(t, o).name), 9, Nt)) : m("", !0),
          t.isChild && t.childIndex === 0 && e.value.style.chart.layout.bars.parentLabels.show ? (i(), v("text", {
            key: 4,
            x: 3 + e.value.style.chart.layout.bars.parentLabels.offsetX,
            y: B(t, o).y + e.value.style.chart.layout.bars.parentLabels.fontSize + 6,
            "font-size": e.value.style.chart.layout.bars.parentLabels.fontSize,
            fill: e.value.style.chart.layout.bars.parentLabels.color,
            "font-weight": e.value.style.chart.layout.bars.dataLabels.bold ? "bold" : "normal",
            "text-anchor": "start"
          }, c(_e(B(t, o).value), B(t, o), o, B(t, o).sign), 9, Pt)) : m("", !0),
          u("rect", {
            "data-cy-trap": "",
            x: 0,
            y: n.value.top + (f.value + h.value) * o - f.value / 2,
            width: g.value.width <= 0 ? 1e-4 : g.value.width,
            height: h.value + f.value <= 0 ? 1e-4 : h.value + f.value,
            fill: te.value === t.id ? `${e.value.style.chart.layout.highlighter.color}${y(ne)[e.value.style.chart.layout.highlighter.opacity]}` : "transparent",
            onMouseenter: (s) => Xe(t, o),
            onMouseleave: l[1] || (l[1] = (s) => {
              Fe.value = null, J.value = !1, te.value = null;
            })
          }, null, 40, St)
        ]))), 256)),
        x(a.$slots, "svg", { svg: g.value }, void 0, !0)
      ], 14, bt)) : m("", !0),
      a.$slots.watermark ? (i(), v("div", Vt, [
        x(a.$slots, "watermark", j(Y({ isPrinting: y(ie) || y(de) })), void 0, !0)
      ])) : m("", !0),
      U.value ? m("", !0) : (i(), oe(vt, {
        key: 5,
        config: {
          type: "verticalBar",
          style: {
            backgroundColor: e.value.style.chart.backgroundColor,
            verticalBar: {
              axis: {
                color: "#CCCCCC"
              },
              color: "#CCCCCC"
            }
          }
        }
      }, null, 8, ["config"])),
      e.value.style.chart.legend.show && e.value.style.chart.legend.position === "bottom" ? (i(), v("div", {
        key: 6,
        ref_key: "chartLegend",
        ref: Z
      }, [
        A(Te, {
          legendSet: S.value,
          config: fe.value,
          onClickMarker: l[2] || (l[2] = ({ legend: t }) => R(t.id))
        }, {
          item: _(({ legend: t, index: o }) => [
            u("div", {
              onClick: (s) => R(t.id),
              style: d(`opacity:${w.value.includes(t.id) ? 0.5 : 1}`)
            }, c(t.name) + ": " + c(y(K)(
              e.value.style.chart.layout.bars.dataLabels.value.formatter,
              t.value,
              y(F)({
                p: e.value.style.chart.legend.prefix,
                v: t.value,
                s: e.value.style.chart.legend.suffix,
                r: e.value.style.chart.legend.roundingValue
              }),
              { datapoint: t, seriesIndex: o }
            )), 13, zt)
          ]),
          _: 1
        }, 8, ["legendSet", "config"])
      ], 512)) : m("", !0),
      x(a.$slots, "legend", { legend: S.value }, void 0, !0),
      A(ct, {
        show: k.value.showTooltip && J.value && w.value.length < L.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,
        fontSize: e.value.style.chart.tooltip.fontSize,
        backgroundOpacity: e.value.style.chart.tooltip.backgroundOpacity,
        position: e.value.style.chart.tooltip.position,
        offsetY: e.value.style.chart.tooltip.offsetY,
        parent: D.value,
        content: Q.value,
        isCustom: e.value.style.chart.tooltip.customFormat && typeof e.value.style.chart.tooltip.customFormat == "function"
      }, {
        "tooltip-before": _(() => [
          x(a.$slots, "tooltip-before", j(Y({ ...ae.value })), void 0, !0)
        ]),
        "tooltip-after": _(() => [
          x(a.$slots, "tooltip-after", j(Y({ ...ae.value })), void 0, !0)
        ]),
        _: 3
      }, 8, ["show", "backgroundColor", "color", "borderRadius", "borderColor", "borderWidth", "fontSize", "backgroundOpacity", "position", "offsetY", "parent", "content", "isCustom"]),
      U.value ? (i(), oe(pt, {
        key: 7,
        hideDetails: "",
        config: {
          open: k.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: _(() => [
          u("div", {
            ref_key: "tableContainer",
            ref: pe,
            class: "vue-ui-vertical-bar-table"
          }, [
            u("div", Ft, [
              u("div", {
                role: "button",
                tabindex: "0",
                style: d(`width:32px; position: absolute; top: 0; right:4px; padding: 0 0px; display: flex; align-items:center;justify-content:center;height: 36px; width: 32px; cursor:pointer; background:${e.value.table.th.backgroundColor};`),
                onClick: l[3] || (l[3] = (t) => k.value.showTable = !1),
                onKeypress: l[4] || (l[4] = je((t) => k.value.showTable = !1, ["enter"]))
              }, [
                A(ht, {
                  name: "close",
                  stroke: e.value.table.th.color,
                  "stroke-width": 2
                }, null, 8, ["stroke"])
              ], 36),
              u("div", {
                style: { width: "100%", "container-type": "inline-size" },
                class: O({ "vue-ui-responsive": ye.value })
              }, [
                u("table", Mt, [
                  u("caption", {
                    style: d({ backgroundColor: e.value.table.th.backgroundColor, color: e.value.table.th.color, outline: e.value.table.th.outline }),
                    class: "vue-ui-data-table__caption"
                  }, [
                    Ye(c(e.value.style.chart.title.text) + " ", 1),
                    e.value.style.chart.title.subtitle.text ? (i(), v("span", It, c(e.value.style.chart.title.subtitle.text), 1)) : m("", !0)
                  ], 4),
                  u("thead", null, [
                    u("tr", {
                      role: "row",
                      style: d(`background:${e.value.table.th.backgroundColor};color:${e.value.table.th.color}`)
                    }, [
                      (i(!0), v(E, null, G($.value.head, (t) => (i(), v("th", {
                        style: d(`outline:${e.value.table.th.outline}`)
                      }, [
                        u("div", Bt, c(t), 1)
                      ], 4))), 256))
                    ], 4),
                    u("tr", null, [
                      u("th", {
                        style: d(`background:${e.value.table.th.backgroundColor};color:${e.value.table.th.color};outline:${e.value.table.th.outline}`)
                      }, null, 4),
                      u("th", {
                        style: d(`background:${e.value.table.th.backgroundColor};color:${e.value.table.th.color};outline:${e.value.table.th.outline};text-align:right;padding-right:5px;font-weight:bold`)
                      }, "∑ " + c(e.value.table.td.prefix) + c(isNaN(C.value) ? "" : C.value.toFixed(e.value.table.td.roundingValue)) + c(e.value.table.td.suffix), 5),
                      u("th", {
                        style: d(`background:${e.value.table.th.backgroundColor};color:${e.value.table.th.color};outline:${e.value.table.th.outline};text-align:right;padding-right:5px;font-weight:bold`)
                      }, "100%", 4),
                      u("th", {
                        style: d(`background:${e.value.table.th.backgroundColor};color:${e.value.table.th.color};outline:${e.value.table.th.outline}`)
                      }, null, 4),
                      u("th", {
                        style: d(`background:${e.value.table.th.backgroundColor};color:${e.value.table.th.color};outline:${e.value.table.th.outline}`)
                      }, null, 4),
                      u("th", {
                        style: d(`background:${e.value.table.th.backgroundColor};color:${e.value.table.th.color};outline:${e.value.table.th.outline}`)
                      }, null, 4),
                      u("th", {
                        style: d(`background:${e.value.table.th.backgroundColor};color:${e.value.table.th.color};outline:${e.value.table.th.outline}`)
                      }, null, 4)
                    ])
                  ]),
                  u("tbody", null, [
                    (i(!0), v(E, null, G($.value.body, (t, o) => (i(), v("tr", {
                      class: O({ "vue-ui-data-table__tbody__row": !0, "vue-ui-data-table__tbody__row-even": o % 2 === 0, "vue-ui-data-table__tbody__row-odd": o % 2 !== 0 }),
                      style: d(`background:${e.value.table.td.backgroundColor};color:${e.value.table.td.color}`)
                    }, [
                      u("td", {
                        class: "vue-ui-data-table__tbody__td",
                        style: d(`outline:${e.value.table.td.outline};font-variant-numeric: tabular-nums;`),
                        "data-cell": $.value.head[0] ?? ""
                      }, [
                        u("div", Dt, [
                          t.color ? (i(), v("span", {
                            key: 0,
                            style: d(`color:${t.color};margin-right:3px`)
                          }, "⬤", 4)) : m("", !0),
                          u("span", null, c(t.parentName), 1)
                        ])
                      ], 12, Ot),
                      u("td", {
                        class: "vue-ui-data-table__tbody__td",
                        style: d(`outline:${e.value.table.td.outline}`),
                        "data-cell": $.value.head[1] ?? ""
                      }, [
                        u("div", Xt, c(e.value.table.td.prefix) + c(["", NaN, void 0].includes(t.parentValue) ? "" : t.parentValue.toFixed(e.value.table.td.roundingValue)) + c(e.value.table.td.suffix), 1)
                      ], 12, Rt),
                      u("td", {
                        class: "vue-ui-data-table__tbody__td",
                        style: d(`outline:${e.value.table.td.outline}`),
                        "data-cell": $.value.head[2] ?? ""
                      }, [
                        u("div", Et, c(["", NaN, void 0].includes(t.percentageToTotal) ? "" : `${(t.percentageToTotal * 100).toFixed(e.value.table.td.roundingPercentage)}%`), 1)
                      ], 12, At),
                      u("td", {
                        class: "vue-ui-data-table__tbody__td",
                        style: d(`outline:${e.value.table.td.outline}`),
                        "data-cell": $.value.head[3] ?? ""
                      }, [
                        u("div", Ut, c(t.childName), 1)
                      ], 12, Gt),
                      u("td", {
                        class: "vue-ui-data-table__tbody__td",
                        style: d(`outline:${e.value.table.td.outline}`),
                        "data-cell": $.value.head[4] ?? ""
                      }, [
                        u("div", Wt, c(e.value.table.td.prefix) + c(["", NaN, void 0].includes(t.childValue) ? "" : t.childValue.toFixed(e.value.table.td.roundingValue)) + c(e.value.table.td.suffix), 1)
                      ], 12, Ht),
                      u("td", {
                        class: "vue-ui-data-table__tbody__td",
                        style: d(`outline:${e.value.table.td.outline}`),
                        "data-cell": $.value.head[5] ?? ""
                      }, [
                        u("div", Yt, c(["", NaN, void 0].includes(t.childPercentageToParent) ? "" : `${(t.childPercentageToParent * 100).toFixed(e.value.table.td.roundingPercentage)}%`), 1)
                      ], 12, jt),
                      u("td", {
                        class: "vue-ui-data-table__tbody__td",
                        style: d(`outline:${e.value.table.td.outline}`),
                        "data-cell": $.value.head[6] ?? ""
                      }, [
                        u("div", Kt, c(["", NaN, void 0].includes(t.childPercentageToTotal) ? "" : `${(t.childPercentageToTotal * 100).toFixed(e.value.table.td.roundingPercentage)}%`), 1)
                      ], 12, qt)
                    ], 6))), 256))
                  ])
                ])
              ], 2)
            ])
          ], 512)
        ]),
        _: 1
      }, 8, ["config"])) : m("", !0)
    ], 14, gt));
  }
}, da = /* @__PURE__ */ yt(Jt, [["__scopeId", "data-v-1dd68cde"]]);
export {
  da as default
};
