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