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