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