import { computed as b, ref as v, watch as Te, onMounted as Ae, openBlock as i, createElementBlock as n, normalizeClass as ye, normalizeStyle as E, unref as u, createBlock as S, createCommentVNode as y, createSlots as Le, withCtx as p, renderSlot as f, normalizeProps as I, guardReactiveProps as F, createVNode as he, createElementVNode as d, Fragment as z, renderList as P, toDisplayString as w, createTextVNode as fe, nextTick as Se } from "vue";
import { u as ze, c as Oe, t as Ie, o as Fe, e as Pe, v as h, X as Me, s as W, w as ce, i as k, f as _, x as Ne, y as Re, q as De, r as Ge } from "./index-BbPeL8Gp.js";
import { t as Ue, u as Be } from "./useResponsive-CoxXLe23.js";
import { _ as Ve } from "./Title-aSAft5dl.js";
import { u as Ee, U as We } from "./usePrinter-DaybDVqP.js";
import { _ as Xe } from "./Tooltip-smutPF--.js";
import { D as Ye } from "./DataTable-DGf6RrOJ.js";
import je from "./vue-ui-skeleton-Bniq21d9.js";
import He from "./vue-ui-accordion-5d5iVpr7.js";
import { u as ge } from "./useNestedProp-BN8claGG.js";
import { _ as qe } from "./PackageVersion-CxJghxYD.js";
import { P as Je } from "./PenAndPaper-ZdZEumki.js";
import { u as Ke } from "./useUserOptionState-BIvW1Kz7.js";
import { _ as Qe } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const Ze = ["id"], et = ["xmlns", "viewBox"], tt = ["id"], lt = ["stop-color"], at = ["stop-color"], ot = ["id"], st = ["stop-color"], it = ["stop-color"], ut = ["x", "y", "width", "height", "fill", "rx"], rt = ["x", "y", "width", "height", "fill", "rx"], nt = ["x", "y", "width", "height", "fill", "rx"], dt = ["x", "y", "width", "height", "fill", "rx"], vt = { key: 0 }, yt = ["x", "y", "fill", "font-size", "font-weight"], ht = ["x", "y", "fill", "font-size", "font-weight"], ft = { key: 1 }, ct = ["x", "y", "font-size", "fill", "font-weight"], gt = { key: 2 }, pt = { key: 0 }, bt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], xt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], mt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], wt = ["x", "y", "font-size", "fill", "font-weight"], kt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], _t = ["x", "y", "font-size", "fill", "font-weight"], Ct = ["x", "y", "font-size", "fill", "font-weight"], $t = ["x", "y", "width", "height", "fill", "onMouseover"], Tt = {
  key: 5,
  class: "vue-data-ui-watermark"
}, At = {
  __name: "vue-ui-age-pyramid",
  props: {
    config: {
      type: Object,
      default() {
        return {};
      }
    },
    dataset: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  setup(X, { expose: pe }) {
    const c = X, { vue_ui_age_pyramid: be } = ze(), M = b(() => !!c.dataset && c.dataset.length), x = v(Oe()), xe = v(null), G = v(!1), U = v(""), N = v(null), Y = v(0), C = v(null), j = v(null), H = v(null), q = v(null), J = v(0), K = v(0), e = b({
      get: () => te(),
      set: (t) => t
    }), { userOptionsVisible: Q, setUserOptionsVisibility: Z, keepUserOptionState: ee } = Ke({ config: e.value });
    function te() {
      const t = ge({
        userConfig: c.config,
        defaultConfig: be
      });
      return t.theme ? {
        ...ge({
          userConfig: Ie.vue_ui_age_pyramid[t.theme] || c.config,
          defaultConfig: t
        })
      } : t;
    }
    Te(() => c.config, (t) => {
      e.value = te(), ae(), J.value += 1, K.value += 1;
    }, { deep: !0 });
    const le = v(null);
    Ae(() => {
      ae();
    });
    function ae() {
      if (Fe(c.dataset) && Pe({
        componentName: "VueUiAgePyramid",
        type: "dataset"
      }), e.value.responsive) {
        const t = Ue(() => {
          const { width: o, height: l } = Be({
            chart: C.value,
            title: e.value.style.title.text ? j.value : null,
            source: H.value,
            noTitle: q.value
          });
          g.value.width = o, g.value.height = l;
        });
        le.value = new ResizeObserver(t), le.value.observe(C.value.parentNode);
      }
    }
    const { isPrinting: oe, isImaging: se, generatePdf: ie, generateImage: ue } = Ee({
      elementId: `vue-ui-age-pyramid_${x.value}`,
      fileName: e.value.style.title.text || "vue-ui-age-pyramid"
    }), me = b(() => e.value.userOptions.show && !e.value.style.title.text), m = v({
      showTable: e.value.table.show,
      showTooltip: e.value.style.tooltip.show
    }), g = v({
      height: e.value.style.height,
      width: e.value.style.width
    }), s = b(() => {
      const t = g.value.width - e.value.style.layout.padding.right - e.value.style.layout.padding.left, o = e.value.style.layout.padding.left, l = g.value.width - e.value.style.layout.padding.right;
      return {
        top: e.value.style.layout.padding.top,
        left: o,
        right: l,
        bottom: g.value.height - e.value.style.layout.padding.bottom,
        width: t,
        height: g.value.height - e.value.style.layout.padding.top - e.value.style.layout.padding.bottom,
        centerX: e.value.style.layout.padding.left + t / 2,
        leftChart: {
          width: t / 2 - e.value.style.layout.centerSlit.width,
          right: o + t / 2 - e.value.style.layout.centerSlit.width
        },
        rightChart: {
          width: t / 2 - e.value.style.layout.centerSlit.width,
          left: o + t / 2 + e.value.style.layout.centerSlit.width
        }
      };
    }), we = b(() => c.dataset.map((t) => e.value.style.layout.dataLabels.yAxis.display === "age" ? t[1] : t[0])), $ = b(() => {
      const t = ke(O.value / 5), o = [], l = [];
      for (let a = 0; a <= 5; a += 1) {
        const r = t * a, ve = t * (a - 5);
        o.push({
          value: r,
          x: s.value.left + s.value.width / 2 + e.value.style.layout.centerSlit.width + r / O.value * s.value.leftChart.width
        }), l.push({
          value: Math.abs(ve),
          x: s.value.left + s.value.width / 2 + ve / O.value * s.value.leftChart.width - e.value.style.layout.centerSlit.width
        });
      }
      return {
        right: o,
        left: l
      };
    });
    function ke(t) {
      if (t === 0) return 0;
      const l = 10 ** Math.floor(Math.log10(Math.abs(t)));
      let a;
      return t < 0, a = Math.round(t / l) * l, a;
    }
    const O = b(() => Math.max(...c.dataset.flatMap((t) => t.slice(-2).map((o) => h(o))))), T = b(() => c.dataset.length), _e = b(() => c.dataset.map((t) => ({
      segment: t[0],
      age: t[1],
      left: {
        value: t[2],
        proportionToMax: t[2] / O.value
      },
      right: {
        value: t[3],
        proportionToMax: t[3] / O.value
      }
    }))), A = b(() => _e.value.map((t, o) => {
      const l = s.value.top + s.value.height / T.value * o, a = s.value.height / T.value - e.value.style.layout.bars.gap;
      return {
        segment: t.segment,
        age: t.age,
        left: {
          ...t.left,
          y: l,
          color: e.value.style.layout.bars.left.color,
          x: s.value.leftChart.right - t.left.proportionToMax * s.value.leftChart.width,
          width: h(t.left.proportionToMax * s.value.leftChart.width),
          height: a
        },
        right: {
          ...t.right,
          y: l,
          color: e.value.style.layout.bars.right.color,
          x: s.value.rightChart.left,
          width: h(t.right.proportionToMax * s.value.rightChart.width),
          height: a
        }
      };
    })), B = v(null);
    function Ce(t, o) {
      N.value = t, B.value = {
        datapoint: o,
        seriesIndex: t,
        series: A.value,
        config: e.value
      };
      const l = e.value.style.tooltip.customFormat;
      if (Ne(l) && Re(() => l({
        seriesIndex: t,
        datapoint: {
          segment: o[0],
          index: o[1],
          left: o[2],
          right: o[3]
        },
        series: A.value,
        config: e.value
      })))
        U.value = l({
          seriesIndex: t,
          datapoint: {
            segment: o[0],
            index: o[1],
            left: o[2],
            right: o[3]
          },
          series: A.value,
          config: e.value
        });
      else {
        let a = "";
        const r = A.value[t];
        a += `<div><b>${r.segment}</b></div>`, a += `<div>${e.value.translations.age}: ${k(
          e.value.style.layout.dataLabels.yAxis.formatter,
          h(r.age),
          _({ v: h(r.age) }),
          { datapoint: o, seriesIndex: t }
        )}</div>`, a += `<div style="margin-top:6px;padding-top:6px;border-top:1px solid ${e.value.style.tooltip.borderColor}">`, a += '<div style="display:flex; flex-direction:row;gap:12px">', a += `<div style="display:flex;flex-direction:column;align-items:center;justify-content:center"><svg viewBox="0 0 12 12" height="12" width="12"><rect stroke="none" x="0" y="0" height="12" width="12" rx="2" fill="${e.value.style.layout.bars.gradient.underlayer}"/><rect stroke="none" x="0" y="0" height="12" width="12" rx="2" fill="${e.value.style.layout.bars.gradient.show ? `url(#age_pyramid_left_${x.value})` : e.value.style.layout.bars.left.color}"/></svg><div>${e.value.translations.female}</div><div><b>${k(
          e.value.style.layout.dataLabels.xAxis.formatter,
          h(r.left.value),
          _({ v: h(r.left.value) }),
          { datapoint: o, seriesIndex: t }
        )}</b></div></div>`, a += `<div style="display:flex;flex-direction:column;align-items:center;justify-content:center"><svg viewBox="0 0 12 12" height="12" width="12"><rect stroke="none" x="0" y="0" height="12" width="12" rx="2" fill="${e.value.style.layout.bars.gradient.underlayer}"/><rect stroke="none" x="0" y="0" height="12" width="12" rx="2" fill="${e.value.style.layout.bars.gradient.show ? `url(#age_pyramid_right_${x.value})` : e.value.style.layout.bars.right.color}"/></svg><div>${e.value.translations.male}</div><div><b>${k(
          e.value.style.layout.dataLabels.xAxis.formatter,
          h(r.right.value),
          _({ v: h(r.right.value) }),
          { datapoint: o, seriesIndex: t }
        )}</b></div></div>`, a += "</div>", a += `<div style="margin-top:6px;padding-top:6px;border-top:1px solid ${e.value.style.tooltip.borderColor}"><div>${e.value.translations.total}</div><div><b>${k(
          e.value.style.layout.dataLabels.xAxis.formatter,
          h(r.right.value) + h(r.left.value),
          _({ v: h(r.right.value) + h(r.left.value) }),
          { datapoint: o, seriesIndex: t }
        )}</b></div></div>`, a += "</div>", U.value = `<div>${a}</div>`;
      }
      G.value = !0;
    }
    function re() {
      Se(() => {
        const t = [e.value.translations.year, e.value.translations.age, e.value.translations.female, e.value.translations.male, e.value.translations.total], o = c.dataset.map((r) => [
          r[0],
          r[1],
          r[2],
          r[3],
          r[2] + r[3]
        ]), l = [[e.value.style.title.text], [e.value.style.title.subtitle.text], [[""], [""], [""]]].concat([t]).concat(o), a = De(l);
        Ge({ csvContent: a, title: e.value.style.title.text || "vue-ui-heatmap" });
      });
    }
    const R = b(() => {
      const t = [
        e.value.translations.year,
        e.value.translations.age,
        e.value.translations.female,
        e.value.translations.male,
        e.value.translations.total
      ], o = c.dataset.map((a) => [
        a[0],
        a[1],
        a[2].toLocaleString(),
        a[3].toLocaleString(),
        (a[2] + a[3]).toLocaleString()
      ]), l = {
        th: {
          backgroundColor: e.value.table.th.backgroundColor,
          color: e.value.table.th.color,
          outline: e.value.table.th.outline
        },
        td: {
          backgroundColor: e.value.table.td.backgroundColor,
          color: e.value.table.td.color,
          outline: e.value.table.td.outline
        },
        breakpoint: e.value.table.responsiveBreakpoint
      };
      return { head: t, body: o, config: l, colNames: t };
    }), L = v(!1);
    function $e(t) {
      L.value = t, Y.value += 1;
    }
    function ne() {
      m.value.showTable = !m.value.showTable;
    }
    function de() {
      m.value.showTooltip = !m.value.showTooltip;
    }
    const D = v(!1);
    function V() {
      D.value = !D.value;
    }
    return pe({
      generatePdf: ie,
      generateCsv: re,
      generateImage: ue,
      toggleTable: ne,
      toggleTooltip: de,
      toggleAnnotator: V
    }), (t, o) => (i(), n("div", {
      class: ye(`vue-ui-age-pyramid ${L.value ? "vue-data-ui-wrapper-fullscreen" : ""}`),
      ref_key: "agePyramid",
      ref: C,
      id: `vue-ui-age-pyramid_${x.value}`,
      style: E(`font-family:${e.value.style.fontFamily};width:100%; text-align:center;background:${e.value.style.backgroundColor};${e.value.responsive ? "height:100%" : ""}`),
      onMouseenter: o[2] || (o[2] = () => u(Z)(!0)),
      onMouseleave: o[3] || (o[3] = () => u(Z)(!1))
    }, [
      e.value.userOptions.buttons.annotator ? (i(), S(Je, {
        key: 0,
        parent: C.value,
        backgroundColor: e.value.style.backgroundColor,
        color: e.value.style.color,
        active: D.value,
        onClose: V
      }, null, 8, ["parent", "backgroundColor", "color", "active"])) : y("", !0),
      me.value ? (i(), n("div", {
        key: 1,
        ref_key: "noTitle",
        ref: q,
        class: "vue-data-ui-no-title-space",
        style: "height:36px; width: 100%;background:transparent"
      }, null, 512)) : y("", !0),
      e.value.style.title.text ? (i(), n("div", {
        key: 2,
        ref_key: "chartTitle",
        ref: j,
        style: "width:100%;background:transparent"
      }, [
        (i(), S(Ve, {
          key: `title_${J.value}`,
          config: {
            title: {
              cy: "pyramid-div-title",
              ...e.value.style.title
            },
            subtitle: {
              cy: "pyramid-div-subtitle",
              ...e.value.style.title.subtitle
            }
          }
        }, null, 8, ["config"]))
      ], 512)) : y("", !0),
      e.value.userOptions.show && M.value && (u(ee) || u(Q)) ? (i(), S(We, {
        ref_key: "details",
        ref: xe,
        key: `user_options_${Y.value}`,
        backgroundColor: e.value.style.backgroundColor,
        color: e.value.style.color,
        isImaging: u(se),
        isPrinting: u(oe),
        uid: x.value,
        hasTooltip: e.value.userOptions.buttons.tooltip && e.value.style.tooltip.show,
        hasPdf: e.value.userOptions.buttons.pdf,
        hasXls: e.value.userOptions.buttons.csv,
        hasImg: e.value.userOptions.buttons.img,
        hasTable: e.value.userOptions.buttons.table,
        hasFullscreen: e.value.userOptions.buttons.fullscreen,
        isFullscreen: L.value,
        isTooltip: m.value.showTooltip,
        titles: { ...e.value.userOptions.buttonTitles },
        chartElement: C.value,
        position: e.value.userOptions.position,
        hasAnnotator: e.value.userOptions.buttons.annotator,
        isAnnotation: D.value,
        onToggleFullscreen: $e,
        onGeneratePdf: u(ie),
        onGenerateCsv: re,
        onGenerateImage: u(ue),
        onToggleTable: ne,
        onToggleTooltip: de,
        onToggleAnnotator: V,
        style: E({
          visibility: u(ee) ? u(Q) ? "visible" : "hidden" : "visible"
        })
      }, Le({ _: 2 }, [
        t.$slots.optionTooltip ? {
          name: "optionTooltip",
          fn: p(() => [
            f(t.$slots, "optionTooltip", {}, void 0, !0)
          ]),
          key: "0"
        } : void 0,
        t.$slots.optionPdf ? {
          name: "optionPdf",
          fn: p(() => [
            f(t.$slots, "optionPdf", {}, void 0, !0)
          ]),
          key: "1"
        } : void 0,
        t.$slots.optionCsv ? {
          name: "optionCsv",
          fn: p(() => [
            f(t.$slots, "optionCsv", {}, void 0, !0)
          ]),
          key: "2"
        } : void 0,
        t.$slots.optionImg ? {
          name: "optionImg",
          fn: p(() => [
            f(t.$slots, "optionImg", {}, void 0, !0)
          ]),
          key: "3"
        } : void 0,
        t.$slots.optionTable ? {
          name: "optionTable",
          fn: p(() => [
            f(t.$slots, "optionTable", {}, void 0, !0)
          ]),
          key: "4"
        } : void 0,
        t.$slots.optionFullscreen ? {
          name: "optionFullscreen",
          fn: p(({ toggleFullscreen: l, isFullscreen: a }) => [
            f(t.$slots, "optionFullscreen", I(F({ toggleFullscreen: l, isFullscreen: a })), void 0, !0)
          ]),
          key: "5"
        } : void 0,
        t.$slots.optionAnnotator ? {
          name: "optionAnnotator",
          fn: p(({ toggleAnnotator: l, isAnnotator: a }) => [
            f(t.$slots, "optionAnnotator", I(F({ toggleAnnotator: l, isAnnotator: a })), void 0, !0)
          ]),
          key: "6"
        } : void 0
      ]), 1032, ["backgroundColor", "color", "isImaging", "isPrinting", "uid", "hasTooltip", "hasPdf", "hasXls", "hasImg", "hasTable", "hasFullscreen", "isFullscreen", "isTooltip", "titles", "chartElement", "position", "hasAnnotator", "isAnnotation", "onGeneratePdf", "onGenerateImage", "style"])) : y("", !0),
      M.value ? (i(), n("svg", {
        key: 4,
        xmlns: u(Me),
        class: ye({ "vue-data-ui-fullscreen--on": L.value, "vue-data-ui-fulscreen--off": !L.value }),
        viewBox: `0 0 ${g.value.width <= 0 ? 10 : g.value.width} ${g.value.height <= 0 ? 10 : g.value.height}`,
        style: E(`max-width:100%;overflow:visible;background:transparent;color:${e.value.style.color}`)
      }, [
        he(qe),
        d("defs", null, [
          d("linearGradient", {
            id: `age_pyramid_left_${x.value}`,
            x1: "0%",
            y1: "0%",
            x2: "100%",
            y2: "0%"
          }, [
            d("stop", {
              offset: "0%",
              "stop-color": e.value.style.layout.bars.left.color
            }, null, 8, lt),
            d("stop", {
              offset: "100%",
              "stop-color": u(W)(u(ce)(e.value.style.layout.bars.left.color, e.value.style.layout.bars.gradient.shiftHue), 100 - e.value.style.layout.bars.gradient.intensity)
            }, null, 8, at)
          ], 8, tt),
          d("linearGradient", {
            id: `age_pyramid_right_${x.value}`,
            x1: "0%",
            y1: "0%",
            x2: "100%",
            y2: "0%"
          }, [
            d("stop", {
              offset: "0%",
              "stop-color": u(W)(u(ce)(e.value.style.layout.bars.right.color, e.value.style.layout.bars.gradient.shiftHue), 100 - e.value.style.layout.bars.gradient.intensity)
            }, null, 8, st),
            d("stop", {
              offset: "100%",
              "stop-color": e.value.style.layout.bars.right.color
            }, null, 8, it)
          ], 8, ot)
        ]),
        (i(!0), n(z, null, P(A.value, (l, a) => (i(), n("g", null, [
          d("rect", {
            x: l.left.x,
            y: l.left.y,
            width: u(h)(l.left.width <= 0 ? 1e-4 : l.left.width),
            height: l.left.height <= 0 ? 1e-4 : l.left.height,
            fill: e.value.style.layout.bars.gradient.underlayer,
            rx: e.value.style.layout.bars.borderRadius
          }, null, 8, ut),
          d("rect", {
            x: l.left.x,
            y: l.left.y,
            width: l.left.width <= 0 ? 1e-4 : l.left.width,
            height: l.left.height <= 0 ? 1e-4 : l.left.height,
            fill: e.value.style.layout.bars.gradient.show ? `url(#age_pyramid_left_${x.value})` : l.left.color,
            rx: e.value.style.layout.bars.borderRadius
          }, null, 8, rt),
          d("rect", {
            x: l.right.x,
            y: l.right.y,
            width: l.right.width <= 0 ? 1e-4 : l.right.width,
            height: l.right.height <= 0 ? 1e-4 : l.right.height,
            fill: e.value.style.layout.bars.gradient.underlayer,
            rx: e.value.style.layout.bars.borderRadius
          }, null, 8, nt),
          d("rect", {
            x: l.right.x,
            y: l.right.y,
            width: l.right.width <= 0 ? 1e-4 : l.right.width,
            height: l.right.height <= 0 ? 1e-4 : l.right.height,
            fill: e.value.style.layout.bars.gradient.show ? `url(#age_pyramid_right_${x.value})` : l.right.color,
            rx: e.value.style.layout.bars.borderRadius
          }, null, 8, dt)
        ]))), 256)),
        d("g", null, [
          e.value.style.layout.dataLabels.sideTitles.show ? (i(), n("g", vt, [
            d("text", {
              x: s.value.left,
              y: s.value.top + e.value.style.layout.dataLabels.sideTitles.offsetY,
              fill: e.value.style.layout.dataLabels.sideTitles.useSideColor ? e.value.style.layout.bars.left.color : e.value.style.layout.dataLabels.sideTitles.color,
              "font-size": e.value.style.layout.dataLabels.sideTitles.fontSize,
              "text-anchor": "start",
              "font-weight": e.value.style.layout.dataLabels.sideTitles.bold ? "bold" : "normal"
            }, w(e.value.translations.female), 9, yt),
            d("text", {
              x: s.value.right,
              y: s.value.top + e.value.style.layout.dataLabels.sideTitles.offsetY,
              fill: e.value.style.layout.dataLabels.sideTitles.useSideColor ? e.value.style.layout.bars.right.color : e.value.style.layout.dataLabels.sideTitles.color,
              "font-size": e.value.style.layout.dataLabels.sideTitles.fontSize,
              "text-anchor": "end",
              "font-weight": e.value.style.layout.dataLabels.sideTitles.bold ? "bold" : "normal"
            }, w(e.value.translations.male), 9, ht)
          ])) : y("", !0),
          e.value.style.layout.dataLabels.yAxis.show ? (i(), n("g", ft, [
            (i(!0), n(z, null, P(we.value, (l, a) => (i(), n(z, null, [
              a % e.value.style.layout.dataLabels.yAxis.showEvery === 0 ? (i(), n("text", {
                key: 0,
                x: s.value.centerX,
                y: s.value.top + s.value.height / T.value * a + e.value.style.layout.dataLabels.yAxis.fontSize / 3,
                "text-anchor": "middle",
                "font-size": e.value.style.layout.dataLabels.yAxis.fontSize,
                fill: e.value.style.layout.dataLabels.yAxis.color,
                "font-weight": e.value.style.layout.dataLabels.yAxis.bold ? "bold" : "normal"
              }, w(u(k)(
                e.value.style.layout.dataLabels.yAxis.formatter,
                l,
                u(_)({ v: l }),
                { datapoint: l, seriesIndex: a }
              )), 9, ct)) : y("", !0)
            ], 64))), 256))
          ])) : y("", !0),
          e.value.style.layout.dataLabels.xAxis.show ? (i(), n("g", gt, [
            e.value.style.layout.grid.show ? (i(), n("g", pt, [
              d("line", {
                x1: $.value.right[0].x,
                x2: $.value.right.at(-1).x,
                y1: s.value.bottom + e.value.style.layout.dataLabels.xAxis.fontSize / 2,
                y2: s.value.bottom + e.value.style.layout.dataLabels.xAxis.fontSize / 2,
                stroke: e.value.style.layout.grid.stroke,
                "stroke-width": e.value.style.layout.grid.strokeWidth,
                "stroke-linecap": "round"
              }, null, 8, bt),
              d("line", {
                x1: $.value.left[0].x,
                x2: $.value.left.at(-1).x,
                y1: s.value.bottom + e.value.style.layout.dataLabels.xAxis.fontSize / 2,
                y2: s.value.bottom + e.value.style.layout.dataLabels.xAxis.fontSize / 2,
                stroke: e.value.style.layout.grid.stroke,
                "stroke-width": e.value.style.layout.grid.strokeWidth,
                "stroke-linecap": "round"
              }, null, 8, xt)
            ])) : y("", !0),
            (i(!0), n(z, null, P($.value.right, (l, a) => (i(), n("g", null, [
              e.value.style.layout.grid.show ? (i(), n("line", {
                key: 0,
                x1: l.x,
                x2: l.x,
                y1: s.value.bottom + e.value.style.layout.dataLabels.xAxis.fontSize / 2,
                y2: s.value.bottom + e.value.style.layout.dataLabels.xAxis.fontSize / 4,
                stroke: e.value.style.layout.grid.stroke,
                "stroke-width": e.value.style.layout.grid.strokeWidth,
                "stroke-linecap": "round"
              }, null, 8, mt)) : y("", !0),
              d("text", {
                x: l.x,
                y: s.value.bottom + e.value.style.layout.dataLabels.xAxis.fontSize * 2,
                "font-size": e.value.style.layout.dataLabels.xAxis.fontSize,
                fill: e.value.style.layout.dataLabels.xAxis.color,
                "text-anchor": "middle",
                "font-weight": e.value.style.layout.dataLabels.xAxis.bold ? "bold" : "normal"
              }, w(u(k)(
                e.value.style.layout.dataLabels.xAxis.formatter,
                l.value / e.value.style.layout.dataLabels.xAxis.scale,
                u(_)({
                  v: l.value / e.value.style.layout.dataLabels.xAxis.scale
                }),
                { datapoint: l, seriesIndex: a }
              )), 9, wt)
            ]))), 256)),
            (i(!0), n(z, null, P($.value.left, (l, a) => (i(), n("g", null, [
              e.value.style.layout.grid.show ? (i(), n("line", {
                key: 0,
                x1: l.x,
                x2: l.x,
                y1: s.value.bottom + e.value.style.layout.dataLabels.xAxis.fontSize / 2,
                y2: s.value.bottom + e.value.style.layout.dataLabels.xAxis.fontSize / 4,
                stroke: e.value.style.layout.grid.stroke,
                "stroke-width": e.value.style.layout.grid.strokeWidth,
                "stroke-linecap": "round"
              }, null, 8, kt)) : y("", !0),
              d("text", {
                x: l.x,
                y: s.value.bottom + e.value.style.layout.dataLabels.xAxis.fontSize * 2,
                "font-size": e.value.style.layout.dataLabels.xAxis.fontSize,
                fill: e.value.style.layout.dataLabels.xAxis.color,
                "text-anchor": "middle",
                "font-weight": e.value.style.layout.dataLabels.xAxis.bold ? "bold" : "normal"
              }, w(u(k)(
                e.value.style.layout.dataLabels.xAxis.formatter,
                l.value / e.value.style.layout.dataLabels.xAxis.scale,
                u(_)({
                  v: l.value / e.value.style.layout.dataLabels.xAxis.scale
                }),
                { datapoint: l, seriesIndex: a }
              )), 9, _t)
            ]))), 256)),
            d("text", {
              x: s.value.right,
              y: g.value.height,
              "text-anchor": "end",
              "font-size": e.value.style.layout.dataLabels.xAxis.fontSize,
              fill: e.value.style.layout.dataLabels.xAxis.color,
              "font-weight": e.value.style.layout.dataLabels.xAxis.bold ? "bold" : "normal"
            }, w(e.value.style.layout.dataLabels.xAxis.translation), 9, Ct)
          ])) : y("", !0)
        ]),
        (i(!0), n(z, null, P(X.dataset, (l, a) => (i(), n("g", null, [
          d("rect", {
            x: s.value.left,
            y: s.value.top + s.value.height / T.value * a - e.value.style.layout.bars.gap / 2,
            width: s.value.width <= 0 ? 1e-4 : s.value.width,
            height: s.value.height / T.value <= 0 ? 1e-4 : s.value.height / T.value,
            fill: N.value !== null && N.value === a ? u(W)(e.value.style.highlighter.color, e.value.style.highlighter.opacity) : "transparent",
            onMouseover: (r) => Ce(a, l),
            onMouseleave: o[0] || (o[0] = (r) => {
              N.value = null, G.value = !1;
            })
          }, null, 40, $t)
        ]))), 256)),
        f(t.$slots, "svg", { svg: g.value }, void 0, !0)
      ], 14, et)) : y("", !0),
      t.$slots.watermark ? (i(), n("div", Tt, [
        f(t.$slots, "watermark", I(F({ isPrinting: u(oe) || u(se) })), void 0, !0)
      ])) : y("", !0),
      M.value ? y("", !0) : (i(), S(je, {
        key: 6,
        config: {
          type: "pyramid",
          style: {
            backgroundColor: e.value.style.backgroundColor,
            pyramid: {
              color: "#CCCCCC"
            }
          }
        }
      }, null, 8, ["config"])),
      f(t.$slots, "legend", { legend: A.value }, void 0, !0),
      t.$slots.source ? (i(), n("div", {
        key: 7,
        ref_key: "source",
        ref: H,
        dir: "auto"
      }, [
        f(t.$slots, "source", {}, void 0, !0)
      ], 512)) : y("", !0),
      he(Xe, {
        show: m.value.showTooltip && G.value,
        backgroundColor: e.value.style.tooltip.backgroundColor,
        color: e.value.style.tooltip.color,
        borderRadius: e.value.style.tooltip.borderRadius,
        borderColor: e.value.style.tooltip.borderColor,
        borderWidth: e.value.style.tooltip.borderWidth,
        fontSize: e.value.style.tooltip.fontSize,
        backgroundOpacity: e.value.style.tooltip.backgroundOpacity,
        position: e.value.style.tooltip.position,
        offsetY: e.value.style.tooltip.offsetY,
        parent: C.value,
        content: U.value,
        isFullscreen: L.value,
        isCustom: e.value.style.tooltip.customFormat && typeof e.value.style.tooltip.customFormat == "function"
      }, {
        "tooltip-before": p(() => [
          f(t.$slots, "tooltip-before", I(F({ ...B.value })), void 0, !0)
        ]),
        "tooltip-after": p(() => [
          f(t.$slots, "tooltip-after", I(F({ ...B.value })), void 0, !0)
        ]),
        _: 3
      }, 8, ["show", "backgroundColor", "color", "borderRadius", "borderColor", "borderWidth", "fontSize", "backgroundOpacity", "position", "offsetY", "parent", "content", "isFullscreen", "isCustom"]),
      M.value ? (i(), S(He, {
        key: 8,
        hideDetails: "",
        config: {
          open: m.value.showTable,
          maxHeight: 1e4,
          body: {
            backgroundColor: e.value.style.backgroundColor,
            color: e.value.style.color
          },
          head: {
            backgroundColor: e.value.style.backgroundColor,
            color: e.value.style.color
          }
        }
      }, {
        content: p(() => [
          (i(), S(Ye, {
            key: `table_${K.value}`,
            colNames: R.value.colNames,
            head: R.value.head,
            body: R.value.body,
            config: R.value.config,
            title: `${e.value.style.title.text}${e.value.style.title.subtitle.text ? ` : ${e.value.style.title.subtitle.text}` : ""}`,
            onClose: o[1] || (o[1] = (l) => m.value.showTable = !1)
          }, {
            th: p(({ th: l }) => [
              fe(w(l), 1)
            ]),
            td: p(({ td: l }) => [
              fe(w(l), 1)
            ]),
            _: 1
          }, 8, ["colNames", "head", "body", "config", "title"]))
        ]),
        _: 1
      }, 8, ["config"])) : y("", !0)
    ], 46, Ze));
  }
}, Vt = /* @__PURE__ */ Qe(At, [["__scopeId", "data-v-0934fe8b"]]);
export {
  Vt as default
};
