import { computed as b, ref as v, watch as _e, onMounted as Ce, openBlock as i, createElementBlock as r, normalizeClass as re, normalizeStyle as ne, createBlock as S, createCommentVNode as y, unref as d, createSlots as $e, withCtx as p, renderSlot as f, normalizeProps as O, guardReactiveProps as F, createVNode as de, createElementVNode as n, Fragment as z, renderList as P, toDisplayString as w, createTextVNode as ve, nextTick as Te } from "vue";
import { u as Ae, c as Le, t as Se, o as ze, e as Ie, v as h, X as Oe, s as X, w as ye, i as k, f as _, x as Fe, y as Pe, q as Me, r as Ne } from "./index-Cm2_6s9o.js";
import { t as Re, u as De } from "./useResponsive-CoxXLe23.js";
import { _ as Ge } from "./Title-Coit3NcT.js";
import { u as Be, U as Ee } from "./usePrinter-Cx8U1e30.js";
import { _ as We } from "./Tooltip-BBgfUr4a.js";
import { D as Xe } from "./DataTable-NGi-FgLM.js";
import Ue from "./vue-ui-skeleton-BUS6A44x.js";
import Ve from "./vue-ui-accordion-CxrNF8BI.js";
import { u as he } from "./useNestedProp-BYPZJNhi.js";
import { _ as Ye } from "./PackageVersion-CTMY4zeY.js";
import { P as je } from "./PenAndPaper-DJ_d10S-.js";
import { _ as He } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const qe = ["id"], Je = ["xmlns", "viewBox"], Ke = ["id"], Qe = ["stop-color"], Ze = ["stop-color"], et = ["id"], tt = ["stop-color"], lt = ["stop-color"], at = ["x", "y", "width", "height", "fill", "rx"], ot = ["x", "y", "width", "height", "fill", "rx"], st = ["x", "y", "width", "height", "fill", "rx"], it = ["x", "y", "width", "height", "fill", "rx"], ut = { key: 0 }, rt = ["x", "y", "fill", "font-size", "font-weight"], nt = ["x", "y", "fill", "font-size", "font-weight"], dt = { key: 1 }, vt = ["x", "y", "font-size", "fill", "font-weight"], yt = { key: 2 }, ht = { key: 0 }, ft = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], ct = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], gt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], pt = ["x", "y", "font-size", "fill", "font-weight"], bt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], xt = ["x", "y", "font-size", "fill", "font-weight"], mt = ["x", "y", "font-size", "fill", "font-weight"], wt = ["x", "y", "width", "height", "fill", "onMouseover"], kt = {
  key: 5,
  class: "vue-data-ui-watermark"
}, _t = {
  __name: "vue-ui-age-pyramid",
  props: {
    config: {
      type: Object,
      default() {
        return {};
      }
    },
    dataset: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  setup(U, { expose: fe }) {
    const c = U, { vue_ui_age_pyramid: ce } = Ae(), M = b(() => !!c.dataset && c.dataset.length), x = v(Le()), ge = v(null), G = v(!1), B = v(""), N = v(null), V = v(0), C = v(null), Y = v(null), j = v(null), H = v(null), q = v(0), J = v(0), e = b({
      get: () => K(),
      set: (t) => t
    });
    function K() {
      const t = he({
        userConfig: c.config,
        defaultConfig: ce
      });
      return t.theme ? {
        ...he({
          userConfig: Se.vue_ui_age_pyramid[t.theme] || c.config,
          defaultConfig: t
        })
      } : t;
    }
    _e(() => c.config, (t) => {
      e.value = K(), Z(), q.value += 1, J.value += 1;
    }, { deep: !0 });
    const Q = v(null);
    Ce(() => {
      Z();
    });
    function Z() {
      if (ze(c.dataset) && Ie({
        componentName: "VueUiAgePyramid",
        type: "dataset"
      }), e.value.responsive) {
        const t = Re(() => {
          const { width: s, height: l } = De({
            chart: C.value,
            title: e.value.style.title.text ? Y.value : null,
            source: j.value,
            noTitle: H.value
          });
          g.value.width = s, g.value.height = l;
        });
        Q.value = new ResizeObserver(t), Q.value.observe(C.value.parentNode);
      }
    }
    const { isPrinting: ee, isImaging: te, generatePdf: le, generateImage: ae } = Be({
      elementId: `vue-ui-age-pyramid_${x.value}`,
      fileName: e.value.style.title.text || "vue-ui-age-pyramid"
    }), pe = 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
    }), o = b(() => {
      const t = g.value.width - e.value.style.layout.padding.right - e.value.style.layout.padding.left, s = 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: s,
        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: s + t / 2 - e.value.style.layout.centerSlit.width
        },
        rightChart: {
          width: t / 2 - e.value.style.layout.centerSlit.width,
          left: s + t / 2 + e.value.style.layout.centerSlit.width
        }
      };
    }), be = b(() => c.dataset.map((t) => e.value.style.layout.dataLabels.yAxis.display === "age" ? t[1] : t[0])), $ = b(() => {
      const t = xe(I.value / 5), s = [], l = [];
      for (let a = 0; a <= 5; a += 1) {
        const u = t * a, ue = t * (a - 5);
        s.push({
          value: u,
          x: o.value.left + o.value.width / 2 + e.value.style.layout.centerSlit.width + u / I.value * o.value.leftChart.width
        }), l.push({
          value: Math.abs(ue),
          x: o.value.left + o.value.width / 2 + ue / I.value * o.value.leftChart.width - e.value.style.layout.centerSlit.width
        });
      }
      return {
        right: s,
        left: l
      };
    });
    function xe(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 I = b(() => Math.max(...c.dataset.flatMap((t) => t.slice(-2).map((s) => h(s))))), T = b(() => c.dataset.length), me = b(() => c.dataset.map((t) => ({
      segment: t[0],
      age: t[1],
      left: {
        value: t[2],
        proportionToMax: t[2] / I.value
      },
      right: {
        value: t[3],
        proportionToMax: t[3] / I.value
      }
    }))), A = b(() => me.value.map((t, s) => {
      const l = o.value.top + o.value.height / T.value * s, a = o.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: o.value.leftChart.right - t.left.proportionToMax * o.value.leftChart.width,
          width: h(t.left.proportionToMax * o.value.leftChart.width),
          height: a
        },
        right: {
          ...t.right,
          y: l,
          color: e.value.style.layout.bars.right.color,
          x: o.value.rightChart.left,
          width: h(t.right.proportionToMax * o.value.rightChart.width),
          height: a
        }
      };
    })), E = v(null);
    function we(t, s) {
      N.value = t, E.value = {
        datapoint: s,
        seriesIndex: t,
        series: A.value,
        config: e.value
      };
      const l = e.value.style.tooltip.customFormat;
      if (Fe(l) && Pe(() => l({
        seriesIndex: t,
        datapoint: {
          segment: s[0],
          index: s[1],
          left: s[2],
          right: s[3]
        },
        series: A.value,
        config: e.value
      })))
        B.value = l({
          seriesIndex: t,
          datapoint: {
            segment: s[0],
            index: s[1],
            left: s[2],
            right: s[3]
          },
          series: A.value,
          config: e.value
        });
      else {
        let a = "";
        const u = A.value[t];
        a += `<div><b>${u.segment}</b></div>`, a += `<div>${e.value.translations.age}: ${k(
          e.value.style.layout.dataLabels.yAxis.formatter,
          h(u.age),
          _({ v: h(u.age) }),
          { datapoint: s, 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(u.left.value),
          _({ v: h(u.left.value) }),
          { datapoint: s, 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(u.right.value),
          _({ v: h(u.right.value) }),
          { datapoint: s, 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(u.right.value) + h(u.left.value),
          _({ v: h(u.right.value) + h(u.left.value) }),
          { datapoint: s, seriesIndex: t }
        )}</b></div></div>`, a += "</div>", B.value = `<div>${a}</div>`;
      }
      G.value = !0;
    }
    function oe() {
      Te(() => {
        const t = [e.value.translations.year, e.value.translations.age, e.value.translations.female, e.value.translations.male, e.value.translations.total], s = c.dataset.map((u) => [
          u[0],
          u[1],
          u[2],
          u[3],
          u[2] + u[3]
        ]), l = [[e.value.style.title.text], [e.value.style.title.subtitle.text], [[""], [""], [""]]].concat([t]).concat(s), a = Me(l);
        Ne({ 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
      ], s = 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: s, config: l, colNames: t };
    }), L = v(!1);
    function ke(t) {
      L.value = t, V.value += 1;
    }
    function se() {
      m.value.showTable = !m.value.showTable;
    }
    function ie() {
      m.value.showTooltip = !m.value.showTooltip;
    }
    const D = v(!1);
    function W() {
      D.value = !D.value;
    }
    return fe({
      generatePdf: le,
      generateCsv: oe,
      generateImage: ae,
      toggleTable: se,
      toggleTooltip: ie,
      toggleAnnotator: W
    }), (t, s) => (i(), r("div", {
      class: re(`vue-ui-age-pyramid ${L.value ? "vue-data-ui-wrapper-fullscreen" : ""}`),
      ref_key: "agePyramid",
      ref: C,
      id: `vue-ui-age-pyramid_${x.value}`,
      style: ne(`font-family:${e.value.style.fontFamily};width:100%; text-align:center;background:${e.value.style.backgroundColor};${e.value.responsive ? "height:100%" : ""}`)
    }, [
      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: W
      }, null, 8, ["parent", "backgroundColor", "color", "active"])) : y("", !0),
      pe.value ? (i(), r("div", {
        key: 1,
        ref_key: "noTitle",
        ref: H,
        class: "vue-data-ui-no-title-space",
        style: "height:36px; width: 100%;background:transparent"
      }, null, 512)) : y("", !0),
      e.value.style.title.text ? (i(), r("div", {
        key: 2,
        ref_key: "chartTitle",
        ref: Y,
        style: "width:100%;background:transparent"
      }, [
        (i(), S(Ge, {
          key: `title_${q.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 ? (i(), S(Ee, {
        ref_key: "details",
        ref: ge,
        key: `user_options_${V.value}`,
        backgroundColor: e.value.style.backgroundColor,
        color: e.value.style.color,
        isImaging: d(te),
        isPrinting: d(ee),
        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: ke,
        onGeneratePdf: d(le),
        onGenerateCsv: oe,
        onGenerateImage: d(ae),
        onToggleTable: se,
        onToggleTooltip: ie,
        onToggleAnnotator: W
      }, $e({ _: 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", O(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", O(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"])) : y("", !0),
      M.value ? (i(), r("svg", {
        key: 4,
        xmlns: d(Oe),
        class: re({ "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: ne(`max-width:100%;overflow:visible;background:transparent;color:${e.value.style.color}`)
      }, [
        de(Ye),
        n("defs", null, [
          n("linearGradient", {
            id: `age_pyramid_left_${x.value}`,
            x1: "0%",
            y1: "0%",
            x2: "100%",
            y2: "0%"
          }, [
            n("stop", {
              offset: "0%",
              "stop-color": e.value.style.layout.bars.left.color
            }, null, 8, Qe),
            n("stop", {
              offset: "100%",
              "stop-color": d(X)(d(ye)(e.value.style.layout.bars.left.color, e.value.style.layout.bars.gradient.shiftHue), 100 - e.value.style.layout.bars.gradient.intensity)
            }, null, 8, Ze)
          ], 8, Ke),
          n("linearGradient", {
            id: `age_pyramid_right_${x.value}`,
            x1: "0%",
            y1: "0%",
            x2: "100%",
            y2: "0%"
          }, [
            n("stop", {
              offset: "0%",
              "stop-color": d(X)(d(ye)(e.value.style.layout.bars.right.color, e.value.style.layout.bars.gradient.shiftHue), 100 - e.value.style.layout.bars.gradient.intensity)
            }, null, 8, tt),
            n("stop", {
              offset: "100%",
              "stop-color": e.value.style.layout.bars.right.color
            }, null, 8, lt)
          ], 8, et)
        ]),
        (i(!0), r(z, null, P(A.value, (l, a) => (i(), r("g", null, [
          n("rect", {
            x: l.left.x,
            y: l.left.y,
            width: d(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, at),
          n("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, ot),
          n("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, st),
          n("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, it)
        ]))), 256)),
        n("g", null, [
          e.value.style.layout.dataLabels.sideTitles.show ? (i(), r("g", ut, [
            n("text", {
              x: o.value.left,
              y: o.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, rt),
            n("text", {
              x: o.value.right,
              y: o.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, nt)
          ])) : y("", !0),
          e.value.style.layout.dataLabels.yAxis.show ? (i(), r("g", dt, [
            (i(!0), r(z, null, P(be.value, (l, a) => (i(), r(z, null, [
              a % e.value.style.layout.dataLabels.yAxis.showEvery === 0 ? (i(), r("text", {
                key: 0,
                x: o.value.centerX,
                y: o.value.top + o.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(d(k)(
                e.value.style.layout.dataLabels.yAxis.formatter,
                l,
                d(_)({ v: l }),
                { datapoint: l, seriesIndex: a }
              )), 9, vt)) : y("", !0)
            ], 64))), 256))
          ])) : y("", !0),
          e.value.style.layout.dataLabels.xAxis.show ? (i(), r("g", yt, [
            e.value.style.layout.grid.show ? (i(), r("g", ht, [
              n("line", {
                x1: $.value.right[0].x,
                x2: $.value.right.at(-1).x,
                y1: o.value.bottom + e.value.style.layout.dataLabels.xAxis.fontSize / 2,
                y2: o.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, ft),
              n("line", {
                x1: $.value.left[0].x,
                x2: $.value.left.at(-1).x,
                y1: o.value.bottom + e.value.style.layout.dataLabels.xAxis.fontSize / 2,
                y2: o.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, ct)
            ])) : y("", !0),
            (i(!0), r(z, null, P($.value.right, (l, a) => (i(), r("g", null, [
              e.value.style.layout.grid.show ? (i(), r("line", {
                key: 0,
                x1: l.x,
                x2: l.x,
                y1: o.value.bottom + e.value.style.layout.dataLabels.xAxis.fontSize / 2,
                y2: o.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, gt)) : y("", !0),
              n("text", {
                x: l.x,
                y: o.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(d(k)(
                e.value.style.layout.dataLabels.xAxis.formatter,
                l.value / e.value.style.layout.dataLabels.xAxis.scale,
                d(_)({
                  v: l.value / e.value.style.layout.dataLabels.xAxis.scale
                }),
                { datapoint: l, seriesIndex: a }
              )), 9, pt)
            ]))), 256)),
            (i(!0), r(z, null, P($.value.left, (l, a) => (i(), r("g", null, [
              e.value.style.layout.grid.show ? (i(), r("line", {
                key: 0,
                x1: l.x,
                x2: l.x,
                y1: o.value.bottom + e.value.style.layout.dataLabels.xAxis.fontSize / 2,
                y2: o.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, bt)) : y("", !0),
              n("text", {
                x: l.x,
                y: o.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(d(k)(
                e.value.style.layout.dataLabels.xAxis.formatter,
                l.value / e.value.style.layout.dataLabels.xAxis.scale,
                d(_)({
                  v: l.value / e.value.style.layout.dataLabels.xAxis.scale
                }),
                { datapoint: l, seriesIndex: a }
              )), 9, xt)
            ]))), 256)),
            n("text", {
              x: o.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, mt)
          ])) : y("", !0)
        ]),
        (i(!0), r(z, null, P(U.dataset, (l, a) => (i(), r("g", null, [
          n("rect", {
            x: o.value.left,
            y: o.value.top + o.value.height / T.value * a - e.value.style.layout.bars.gap / 2,
            width: o.value.width <= 0 ? 1e-4 : o.value.width,
            height: o.value.height / T.value <= 0 ? 1e-4 : o.value.height / T.value,
            fill: N.value !== null && N.value === a ? d(X)(e.value.style.highlighter.color, e.value.style.highlighter.opacity) : "transparent",
            onMouseover: (u) => we(a, l),
            onMouseleave: s[0] || (s[0] = (u) => {
              N.value = null, G.value = !1;
            })
          }, null, 40, wt)
        ]))), 256)),
        f(t.$slots, "svg", { svg: g.value }, void 0, !0)
      ], 14, Je)) : y("", !0),
      t.$slots.watermark ? (i(), r("div", kt, [
        f(t.$slots, "watermark", O(F({ isPrinting: d(ee) || d(te) })), void 0, !0)
      ])) : y("", !0),
      M.value ? y("", !0) : (i(), S(Ue, {
        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(), r("div", {
        key: 7,
        ref_key: "source",
        ref: j,
        dir: "auto"
      }, [
        f(t.$slots, "source", {}, void 0, !0)
      ], 512)) : y("", !0),
      de(We, {
        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: B.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", O(F({ ...E.value })), void 0, !0)
        ]),
        "tooltip-after": p(() => [
          f(t.$slots, "tooltip-after", O(F({ ...E.value })), void 0, !0)
        ]),
        _: 3
      }, 8, ["show", "backgroundColor", "color", "borderRadius", "borderColor", "borderWidth", "fontSize", "backgroundOpacity", "position", "offsetY", "parent", "content", "isFullscreen", "isCustom"]),
      M.value ? (i(), S(Ve, {
        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(Xe, {
            key: `table_${J.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: s[1] || (s[1] = (l) => m.value.showTable = !1)
          }, {
            th: p(({ th: l }) => [
              ve(w(l), 1)
            ]),
            td: p(({ td: l }) => [
              ve(w(l), 1)
            ]),
            _: 1
          }, 8, ["colNames", "head", "body", "config", "title"]))
        ]),
        _: 1
      }, 8, ["config"])) : y("", !0)
    ], 14, qe));
  }
}, Rt = /* @__PURE__ */ He(_t, [["__scopeId", "data-v-49080726"]]);
export {
  Rt as default
};
