import { ref as v, computed as x, useSlots as Ea, onMounted as la, watch as E, nextTick as ye, onBeforeUnmount as Aa, createElementBlock as te, openBlock as z, unref as w, normalizeClass as Da, normalizeStyle as V, createCommentVNode as Y, createBlock as A, createElementVNode as oe, createSlots as Ha, withCtx as m, renderSlot as L, normalizeProps as Z, guardReactiveProps as G, createVNode as Na, toDisplayString as ta, createTextVNode as Ya } from "vue";
import { u as _a, c as Ua, t as Wa, p as _, a as Xa, C as fe, b as Ba, D as ze, i as j, f as q, d as oa, _ as Va, J as Za, a9 as Ga, o as ja, e as qa, x as ra, q as Ja, r as Ka, y as Qa, s as re, l as el } from "./index-CjXfhpMA.js";
import { d as al, t as ll, u as tl, c as ol, a as ua, l as b, r as Se, b as R, p as sa } from "./useResponsive-BWapHhVH.js";
import { _ as rl } from "./Tooltip-p85hmQvg.js";
import { L as ul } from "./Legend-ChuNykfI.js";
import { _ as sl } from "./Title-BfzkycPl.js";
import { S as nl } from "./Slicer-j4m9EOd9.js";
import { u as il, U as vl } from "./usePrinter-bLtFFBkj.js";
import cl from "./vue-ui-accordion-CEdZMQD4.js";
import { D as dl } from "./DataTable-BfXSoPx-.js";
import hl from "./vue-ui-skeleton-B1q5j9VT.js";
import { u as na } from "./useNestedProp-CmXi5M93.js";
import { P as yl } from "./PenAndPaper-OV0eQPcd.js";
import { u as fl } from "./useUserOptionState-BIvW1Kz7.js";
import { u as gl } from "./useChartAccessibility-BWojgys7.js";
import { _ as pl } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const ml = ["id"], bl = ["onClick"], xl = {
  key: 2,
  class: "vue-data-ui-watermark"
}, Ll = ["innerHTML"], kl = {
  __name: "vue-ui-xy-canvas",
  props: {
    dataset: {
      type: Array,
      default() {
        return [];
      }
    },
    config: {
      type: Object,
      default() {
        return {};
      }
    }
  },
  emits: ["selectLegend"],
  setup($e, { expose: ia, emit: va }) {
    const { vue_ui_xy_canvas: ca } = _a(), g = $e, ge = v(Ua()), J = v(null), K = v(null), s = v(null), y = v(1), P = v(1), ue = v(!1), c = v(null), se = v(""), Ie = v(null), $ = v([]), U = v(1), D = v(!0), W = v(!0), pe = v(null), Me = v(0), Te = v(0), ne = v(!1), Oe = v(null), Re = v(null), Pe = v(null), Fe = v(null), me = v(0), be = v(0), xe = v(0), M = v(null), Le = x(() => !!g.dataset && g.dataset.length), da = va, ha = Ea();
    la(() => {
      ha["chart-background"] && console.warn("VueUiXyCanvas does not support the #chart-background slot.");
    });
    const a = x({
      get: () => De(),
      set: (e) => e
    }), { userOptionsVisible: ke, setUserOptionsVisibility: Ee, keepUserOptionState: Ae } = fl({ config: a.value }), { svgRef: T } = gl({ config: a.value.style.chart.title });
    function De() {
      const e = na({
        userConfig: g.config,
        defaultConfig: ca
      });
      let t = {};
      return e.theme ? t = {
        ...na({
          userConfig: Xa.vue_ui_xy_canvas[e.theme] || g.config,
          defaultConfig: e
        }),
        customPalette: Wa[e.theme] || _
      } : t = e, g.config && fe(g.config, "style.chart.scale.min") ? t.style.chart.scale.min = g.config.style.chart.scale.min : t.style.chart.scale.min = null, g.config && fe(g.config, "style.chart.scale.max") ? t.style.chart.scale.max = g.config.style.chart.scale.max : t.style.chart.scale.max = null, g.config && fe(g.config, "style.chart.zoom.startIndex") ? t.style.chart.zoom.startIndex = g.config.style.chart.zoom.startIndex : t.style.chart.zoom.startIndex = null, g.config && fe(g.config, "style.chart.zoom.endIndex") ? t.style.chart.zoom.endIndex = g.config.style.chart.zoom.endIndex : t.style.chart.zoom.endIndex = null, t;
    }
    E(() => g.config, (e) => {
      a.value = De(), ke.value = !a.value.userOptions.showOnChartHover, Ce(), me.value += 1, be.value += 1, xe.value += 1, u.value.showTable = a.value.table.show, u.value.showDataLabels = a.value.style.chart.dataLabels.show, u.value.stacked = a.value.style.chart.stacked, u.value.showTooltip = a.value.style.chart.tooltip.show;
    }, { deep: !0 }), E(() => g.dataset, () => {
      Ce(), me.value += 1, be.value += 1, xe.value += 1;
    }, { deep: !0 });
    const He = v(a.value.style.chart.aspectRatio), { isPrinting: Ne, isImaging: Ye, generatePdf: _e, generateImage: Ue } = il({
      elementId: `xy_canvas_${ge.value}`,
      fileName: a.value.style.chart.title.text || "vue-ui-xy-canvas"
    }), u = v({
      showTable: a.value.table.show,
      showDataLabels: a.value.style.chart.dataLabels.show,
      stacked: a.value.style.chart.stacked,
      showTooltip: a.value.style.chart.tooltip.show
    });
    function ya(e) {
      ne.value = e, Te.value += 1;
    }
    const We = x(() => Ba(a.value.customPalette)), I = x(() => X.value ? Math.max(...X.value.filter((e, t) => !$.value.includes(e.absoluteIndex)).map((e) => e.series.length)) : 0), l = x(() => {
      const e = y.value - y.value * (a.value.style.chart.paddingProportions.left + a.value.style.chart.paddingProportions.right);
      return {
        canvasWidth: y.value,
        canvasHeight: P.value,
        left: y.value * a.value.style.chart.paddingProportions.left,
        top: P.value * a.value.style.chart.paddingProportions.top,
        right: y.value - y.value * a.value.style.chart.paddingProportions.right,
        bottom: P.value - P.value * a.value.style.chart.paddingProportions.bottom,
        width: e,
        height: P.value - P.value * (a.value.style.chart.paddingProportions.top + a.value.style.chart.paddingProportions.bottom),
        slot: e / (r.value.end - r.value.start)
      };
    });
    function Xe(e, t) {
      return e / t;
    }
    function fa({ hasAutoScale: e, series: t, min: o, max: n, scale: d, yOffset: C, individualHeight: i, stackIndex: f = null }) {
      return t.map((H, S) => {
        const F = d.min < 0 ? Math.abs(d.min) : 0, N = Xe(H + F, F + d.max);
        let ae, le;
        e && (ae = d.min, le = Xe(H - ae, d.max - ae));
        let O = 0;
        return f === null ? O = l.value.bottom - l.value.height * (e ? le : N) : O = l.value.bottom - C - i * (e ? le : N), {
          x: l.value.left + l.value.slot * S + l.value.slot / 2,
          y: O,
          value: H
        };
      });
    }
    const p = x(() => {
      const e = a.value.style.chart.scale.min !== null ? a.value.style.chart.scale.min : Math.min(...X.value.filter((i, f) => !$.value.includes(i.absoluteIndex)).flatMap((i) => i.series.slice(r.value.start, r.value.end))), t = a.value.style.chart.scale.max !== null ? a.value.style.chart.scale.max : Math.max(...X.value.filter((i, f) => !$.value.includes(i.absoluteIndex)).flatMap((i) => i.series.slice(r.value.start, r.value.end))), o = ze(e < 0 ? e : 0, t === e ? e + 1 < 0 ? 0 : e + 1 : t < 0 ? 0 : t, a.value.style.chart.scale.ticks), n = o.min < 0 ? Math.abs(o.min) : 0, d = l.value.bottom - l.value.height * (n / (o.max + n)), C = o.ticks.map((i) => ({
        y: l.value.bottom - l.value.height * ((i + n) / (o.max + n)),
        x: l.value.left - 8,
        value: i
      }));
      return {
        absoluteMin: n,
        max: t,
        min: e,
        scale: o,
        yLabels: C,
        zero: d
      };
    }), ga = x(() => h.value.map((e) => `
            <div style="display:flex;flex-direction:row;gap:6px;align-items:center;">
                <svg viewBox="0 0 10 10" height="12" width="12">
                    <circle cx="5" cy="5" r="5" fill="${e.color}"/>
                </svg>
                <span>${e.name ? e.name + ": " : ""}</span>
                <span>${j(
      a.value.style.chart.dataLabels.formatter,
      e.series[c.value],
      q({
        p: e.prefix || "",
        v: e.series[c.value],
        s: e.suffix || "",
        r: e.rounding || 0
      }),
      { datapoint: e, seriesIndex: c.value }
    )}</span>
            </div>
        `)), X = x(() => g.dataset.map((e, t) => ({
      ...e,
      series: Va({
        data: Za(e.series),
        threshold: a.value.downsample.threshold
      }),
      absoluteIndex: t,
      color: oa(e.color || We.value[t] || _[t] || _[t % _.length])
    })));
    E(I, (e) => {
      e && Be();
    });
    const h = x(() => Ga(X.value.filter((e, t) => !$.value.includes(e.absoluteIndex))).map((e, t) => ({
      ...e,
      series: e.series.slice(r.value.start, r.value.end)
    })).map((e, t) => {
      let o = [null, void 0].includes(e.scaleMin) ? Math.min(...e.series) || 0 : e.scaleMin, n = [null, void 0].includes(e.scaleMax) ? Math.max(...e.series) || 1 : e.scaleMax;
      o === n && (o = o >= 0 ? n - 1 : o, n = n >= 0 ? n : o + 1), e.series.filter((O) => ![null, void 0].includes(O)).map((O) => (O - o) / (n - o));
      const d = {
        valueMin: o,
        valueMax: n
      }, C = e.scaleSteps || a.value.style.chart.scale.ticks;
      let i;
      e.autoScaling ? i = ze(d.valueMin, d.valueMax, C) : i = ze(d.valueMin < 0 ? d.valueMin : 0, d.valueMax <= 0 ? 0 : d.valueMax, C);
      const f = u.value.stacked ? l.value.height * (1 - e.cumulatedStackRatio) : 0, H = u.value.stacked ? l.value.height / a.value.style.chart.stackGap : 0, S = u.value.stacked ? l.value.height * e.stackRatio - H : l.value.height, F = i.min < 0 ? Math.abs(i.min) : 0;
      let N;
      e.autoScaling && u.value.stacked && n <= 0 ? N = l.value.bottom - f - S : N = l.value.bottom - f - S * (F / (i.max + F));
      const ae = i.ticks.map((O, Fa) => ({
        y: l.value.bottom - f - S * (Fa / (i.ticks.length - 1)),
        x: l.value.left - 8,
        value: O
      })), le = fa({
        hasAutoScale: u.value.stacked && e.autoScaling,
        series: e.series,
        min: u.value.stacked ? o : p.value.min,
        max: u.value.stacked ? n : p.value.max,
        scale: u.value.stacked ? i : p.value.scale,
        yOffset: f,
        individualHeight: S,
        stackIndex: u.value.stacked ? t : null
      });
      return {
        ...e,
        coordinatesLine: le,
        min: o,
        max: n,
        localScale: i,
        localZero: N,
        localMin: F,
        localYLabels: ae,
        yOffset: f,
        individualHeight: S
      };
    })), r = v({
      start: 0,
      end: I.value
    });
    function Be() {
      Ve();
    }
    const B = v(null);
    async function Ve() {
      (a.value.style.chart.zoom.startIndex !== null || a.value.style.chart.zoom.endIndex !== null) && B.value ? (a.value.style.chart.zoom.startIndex !== null && (await ye(), await ye(), B.value && B.value.setStartValue(a.value.style.chart.zoom.startIndex)), a.value.style.chart.zoom.endIndex !== null && (await ye(), await ye(), B.value && B.value.setEndValue(pa(a.value.style.chart.zoom.endIndex + 1)))) : (r.value = {
        start: 0,
        end: I.value
      }, Me.value += 1);
    }
    function pa(e) {
      const t = I.value;
      return e > t ? t : e < 0 || a.value.style.chart.zoom.startIndex !== null && e < a.value.style.chart.zoom.startIndex ? a.value.style.chart.zoom.startIndex !== null ? a.value.style.chart.zoom.startIndex + 1 : 1 : e;
    }
    const ma = x(() => h.value.filter((e) => ["line", "plot", void 0].includes(e.type))), k = x(() => h.value.filter((e) => e.type === "bar"));
    function ba() {
      if (!T.value)
        return;
      const e = K.value.offsetWidth, t = K.value.offsetHeight;
      T.value.width = e * U.value * 2, T.value.height = t * U.value * 2, y.value = e * U.value * 2, P.value = t * U.value * 2, s.value.scale(U.value, U.value), Q();
    }
    function xa() {
      if (s.value.clearRect(0, 0, 1e4, 1e4), s.value.fillStyle = a.value.style.chart.backgroundColor, s.value.fillRect(0, 0, l.value.canvasWidth, l.value.canvasHeight), u.value.stacked)
        a.value.style.chart.grid.y.verticalLines.show && r.value.end - r.value.start < a.value.style.chart.grid.y.verticalLines.hideUnderXLength ? h.value.forEach((e) => {
          for (let t = 0; t < r.value.end - r.value.start + 1; t += 1)
            b(
              s.value,
              [
                {
                  x: l.value.left + l.value.slot * t,
                  y: l.value.bottom - e.yOffset - e.individualHeight
                },
                {
                  x: l.value.left + l.value.slot * t,
                  y: l.value.bottom - e.yOffset
                }
              ],
              {
                color: a.value.style.chart.grid.y.verticalLines.color
              }
            );
        }) : a.value.style.chart.grid.y.verticalLines.show && r.value.end - r.value.start >= a.value.style.chart.grid.y.verticalLines.hideUnderXLength && h.value.forEach((e) => {
          for (let t = r.value.start; t < r.value.end; t += 1)
            t % Math.floor((r.value.end - r.value.start) / a.value.style.chart.grid.y.timeLabels.modulo) === 0 && b(
              s.value,
              [
                {
                  x: l.value.left + l.value.slot * (t - r.value.start) + l.value.slot / 2,
                  y: l.value.bottom - e.yOffset - e.individualHeight
                },
                {
                  x: l.value.left + l.value.slot * (t - r.value.start) + l.value.slot / 2,
                  y: l.value.bottom - e.yOffset
                }
              ],
              {
                color: a.value.style.chart.grid.y.verticalLines.color
              }
            );
        }), a.value.style.chart.grid.x.horizontalLines.show && (a.value.style.chart.grid.x.horizontalLines.alternate ? h.value.forEach((e) => {
          e.localYLabels.forEach((t, o) => {
            o < e.localYLabels.length - 1 && Se(
              s.value,
              [
                { x: l.value.left, y: t.y },
                { x: l.value.right, y: t.y },
                { x: l.value.right, y: e.localYLabels[o + 1].y },
                { x: l.value.left, y: e.localYLabels[o + 1].y }
              ],
              {
                fillColor: o % 2 === 0 ? "transparent" : re(a.value.style.chart.grid.x.horizontalLines.color, a.value.style.chart.grid.x.horizontalLines.opacity),
                strokeColor: "transparent"
              }
            );
          });
        }) : h.value.forEach((e) => {
          e.localYLabels.slice(r.value.start, r.value.end).forEach((t) => {
            b(
              s.value,
              [
                { x: l.value.left, y: t.y },
                { x: l.value.right, y: t.y }
              ],
              {
                color: a.value.style.chart.grid.x.horizontalLines.color
              }
            );
          });
        })), a.value.style.chart.grid.zeroLine.show && h.value.forEach((e) => {
          b(
            s.value,
            [
              { x: l.value.left, y: e.localZero },
              { x: l.value.right, y: e.localZero }
            ],
            {
              color: a.value.style.chart.grid.zeroLine.color,
              lineDash: a.value.style.chart.grid.zeroLine.dashed ? [10, 10] : [0, 0]
            }
          );
        }), a.value.style.chart.grid.y.axisLabels.show && h.value.forEach((e) => {
          b(
            s.value,
            [
              { x: l.value.left, y: l.value.bottom - e.yOffset },
              { x: l.value.left, y: l.value.bottom - e.yOffset - e.individualHeight }
            ],
            {
              color: e.color
            }
          ), b(
            s.value,
            [
              { x: l.value.right, y: l.value.bottom - e.yOffset },
              { x: l.value.right, y: l.value.bottom - e.yOffset - e.individualHeight }
            ],
            {
              color: e.color
            }
          );
        }), h.value.forEach((e) => {
          R(
            s.value,
            e.name,
            y.value / 35,
            l.value.bottom - e.yOffset - e.individualHeight / 2,
            {
              align: "center",
              rotation: -90,
              color: e.color,
              font: `${Math.round(y.value / 40 * a.value.style.chart.grid.y.axisLabels.fontSizeRatio)}px ${a.value.style.fontFamily}`
            }
          );
        });
      else {
        if (a.value.style.chart.grid.y.verticalLines.show && r.value.end - r.value.start < a.value.style.chart.grid.y.verticalLines.hideUnderXLength)
          for (let e = 0; e < r.value.end - r.value.start + 1; e += 1)
            b(
              s.value,
              [
                { x: l.value.left + l.value.slot * e, y: l.value.top },
                { x: l.value.left + l.value.slot * e, y: l.value.bottom }
              ],
              {
                color: a.value.style.chart.grid.y.verticalLines.color
              }
            );
        else if (a.value.style.chart.grid.y.verticalLines.show && r.value.end - r.value.start >= a.value.style.chart.grid.y.verticalLines.hideUnderXLength)
          for (let e = r.value.start; e < r.value.end; e += 1)
            e % Math.floor((r.value.end - r.value.start) / a.value.style.chart.grid.y.timeLabels.modulo) === 0 && b(
              s.value,
              [
                { x: l.value.left + l.value.slot * (e - r.value.start) + l.value.slot / 2, y: l.value.top },
                { x: l.value.left + l.value.slot * (e - r.value.start) + l.value.slot / 2, y: l.value.bottom }
              ],
              {
                color: a.value.style.chart.grid.y.verticalLines.color
              }
            );
        a.value.style.chart.grid.x.horizontalLines.show && (a.value.style.chart.grid.x.horizontalLines.alternate ? p.value.yLabels.forEach((e, t) => {
          t < p.value.yLabels.length - 1 && Se(
            s.value,
            [
              { x: l.value.left, y: e.y },
              { x: l.value.right, y: e.y },
              { x: l.value.right, y: p.value.yLabels[t + 1].y },
              { x: l.value.left, y: p.value.yLabels[t + 1].y }
            ],
            {
              fillColor: t % 2 === 0 ? "transparent" : re(a.value.style.chart.grid.x.horizontalLines.color, a.value.style.chart.grid.x.horizontalLines.opacity),
              strokeColor: "transparent"
            }
          );
        }) : p.value.yLabels.forEach((e) => {
          b(
            s.value,
            [
              { x: l.value.left, y: e.y },
              { x: l.value.right, y: e.y }
            ],
            {
              color: a.value.style.chart.grid.x.horizontalLines.color
            }
          );
        })), a.value.style.chart.grid.y.showAxis && b(
          s.value,
          [
            { x: l.value.left, y: l.value.top },
            { x: l.value.left, y: l.value.bottom }
          ],
          {
            color: a.value.style.chart.grid.y.axisColor,
            lineWidth: a.value.style.chart.grid.y.axisThickness
          }
        ), a.value.style.chart.grid.x.showAxis && b(
          s.value,
          [
            { x: l.value.left, y: l.value.bottom },
            { x: l.value.right, y: l.value.bottom }
          ],
          {
            color: a.value.style.chart.grid.x.axisColor,
            lineWidth: a.value.style.chart.grid.x.axisThickness
          }
        ), a.value.style.chart.grid.zeroLine.show && b(
          s.value,
          [
            { x: l.value.left, y: p.value.zero },
            { x: l.value.right, y: p.value.zero }
          ],
          {
            color: a.value.style.chart.grid.zeroLine.color,
            lineDash: a.value.style.chart.grid.zeroLine.dashed ? [10, 10] : [0, 0]
          }
        );
      }
      a.value.style.chart.grid.y.axisName && R(
        s.value,
        a.value.style.chart.grid.y.axisName,
        y.value - y.value / 40 * a.value.style.chart.grid.y.axisLabels.fontSizeRatio * 1.2,
        l.value.bottom - l.value.height / 2,
        {
          font: `${a.value.style.chart.grid.y.axisLabels.bold ? "bold " : ""}${Math.round(y.value / 40 * a.value.style.chart.grid.y.axisLabels.fontSizeRatio)}px ${a.value.style.fontFamily}`,
          color: a.value.style.chart.color,
          align: "center",
          rotation: 90
        }
      ), a.value.style.chart.grid.x.axisName && R(
        s.value,
        a.value.style.chart.grid.x.axisName,
        y.value / 2,
        P.value,
        {
          font: `${a.value.style.chart.grid.y.axisLabels.bold ? "bold " : ""}${Math.round(y.value / 40 * a.value.style.chart.grid.y.axisLabels.fontSizeRatio)}px ${a.value.style.fontFamily}`,
          color: a.value.style.chart.color,
          align: "center"
        }
      );
    }
    function La(e) {
      for (let t = 0; t < e.coordinatesLine.length; t += 1) {
        const o = (c.value === t ? y.value / 150 : a.value.style.chart.line.plots.show ? y.value / 200 : 0) * a.value.style.chart.line.plots.radiusRatio;
        ua(
          s.value,
          { x: e.coordinatesLine[t].x, y: e.coordinatesLine[t].y },
          o,
          {
            color: a.value.style.chart.backgroundColor,
            fillStyle: e.color
          }
        );
      }
    }
    function ka() {
      h.value.forEach((e) => {
        e.showYMarker && ee(e) && R(
          s.value,
          j(
            a.value.style.chart.dataLabels.formatter,
            ee(e).value,
            q({
              p: e.prefix || a.value.style.chart.grid.y.axisLabels.prefix || "",
              v: ee(e).value,
              s: e.suffix || a.value.style.chart.grid.y.axisLabels.suffix || "",
              r: e.rounding || a.value.style.chart.grid.y.axisLabels.rounding || 0
            }),
            { datapoint: ee(e), seriesIndex: null }
          ),
          l.value.left - 8 + a.value.style.chart.grid.y.axisLabels.offsetX,
          ee(e).y,
          {
            align: "right",
            font: `${a.value.style.chart.grid.y.axisLabels.bold ? "bold " : ""}${Math.round(y.value / 40 * a.value.style.chart.grid.y.axisLabels.fontSizeRatio)}px ${a.value.style.fontFamily}`,
            color: e.color
          }
        );
      });
    }
    function Ca() {
      a.value.style.chart.grid.y.axisLabels.show && (u.value.stacked ? h.value.forEach((e) => {
        e.localYLabels.forEach((t, o) => {
          R(
            s.value,
            j(
              a.value.style.chart.dataLabels.formatter,
              t.value,
              q({
                p: e.prefix || a.value.style.chart.grid.y.axisLabels.prefix || "",
                v: t.value,
                s: e.suffix || a.value.style.chart.grid.y.axisLabels.suffix || "",
                r: e.rounding || a.value.style.chart.grid.y.axisLabels.rounding || 0
              }),
              { datapoint: t, seriesIndex: o }
            ),
            t.x + a.value.style.chart.grid.y.axisLabels.offsetX,
            t.y,
            {
              align: "right",
              font: `${a.value.style.chart.grid.y.axisLabels.bold ? "bold " : ""}${Math.round(y.value / 40 * a.value.style.chart.grid.y.axisLabels.fontSizeRatio)}px ${a.value.style.fontFamily}`,
              color: e.color,
              globalAlpha: e.showYMarker && ![null, void 0].includes(c.value) ? 0.2 : 1
            }
          );
        });
      }) : p.value.yLabels.forEach((e, t) => {
        R(
          s.value,
          j(
            a.value.style.chart.dataLabels.formatter,
            e.value,
            q({
              p: a.value.style.chart.grid.y.axisLabels.prefix || "",
              v: e.value,
              s: a.value.style.chart.grid.y.axisLabels.suffix || "",
              r: a.value.style.chart.grid.y.axisLabels.rounding || 0
            }),
            { datapoint: e, seriesIndex: t }
          ),
          e.x + a.value.style.chart.grid.y.axisLabels.offsetX,
          e.y,
          {
            align: "right",
            font: `${a.value.style.chart.grid.y.axisLabels.bold ? "bold " : ""}${Math.round(y.value / 40 * a.value.style.chart.grid.y.axisLabels.fontSizeRatio)}px ${a.value.style.fontFamily}`,
            color: a.value.style.chart.grid.y.axisLabels.color,
            globalAlpha: h.value.some((o) => o.showYMarker) && ![null, void 0].includes(c.value) ? 0.2 : 1
          }
        );
      }));
    }
    function wa(e) {
      for (let t = 0; t < e.coordinatesLine.length; t += 1)
        R(
          s.value,
          j(
            a.value.style.chart.dataLabels.formatter,
            e.coordinatesLine[t].value,
            q({
              p: e.prefix || "",
              v: e.coordinatesLine[t].value,
              s: e.suffix || "",
              r: e.rounding || 0
            }),
            { datapoint: e.coordinatesLine[t], seriesIndex: t }
          ),
          e.coordinatesLine[t].x,
          e.coordinatesLine[t].y + a.value.style.chart.dataLabels.offsetY,
          {
            align: "center",
            font: `${a.value.style.chart.dataLabels.bold ? "bold " : ""}${Math.round(y.value / 40 * a.value.style.chart.dataLabels.fontSizeRatio)}px ${a.value.style.fontFamily}`,
            color: a.value.style.chart.dataLabels.useSerieColor ? e.color : a.value.style.chart.dataLabels.color
          }
        );
    }
    function za() {
      for (let e = r.value.start; e < r.value.end; e += 1)
        (r.value.end - r.value.start < a.value.style.chart.grid.y.timeLabels.modulo || r.value.end - r.value.start >= a.value.style.chart.grid.y.timeLabels.modulo && (e % Math.floor((r.value.end - r.value.start) / a.value.style.chart.grid.y.timeLabels.modulo) === 0 || e === c.value + r.value.start && a.value.style.chart.grid.y.timeLabels.showMarker)) && R(
          s.value,
          a.value.style.chart.grid.y.timeLabels.values[e] || e + 1,
          l.value.left + l.value.slot * (e - r.value.start) + l.value.slot / 2,
          l.value.bottom + y.value / a.value.style.chart.grid.y.timeLabels.offsetY,
          {
            align: a.value.style.chart.grid.y.timeLabels.rotation === 0 ? "center" : a.value.style.chart.grid.y.timeLabels.rotation > 0 ? "left" : "right",
            font: `${a.value.style.chart.grid.y.timeLabels.bold ? "bold " : ""}${Math.round(y.value / 40 * a.value.style.chart.grid.y.timeLabels.fontSizeRatio)}px ${a.value.style.fontFamily}`,
            color: a.value.style.chart.grid.y.timeLabels.showMarker ? re(a.value.style.chart.grid.y.timeLabels.color, c.value !== null ? c.value + r.value.start === e ? 100 : 20 : 100) : a.value.style.chart.grid.y.timeLabels.color,
            rotation: a.value.style.chart.grid.y.timeLabels.rotation
          }
        );
    }
    function Ze() {
      b(
        s.value,
        [
          { x: l.value.left + l.value.slot * c.value + l.value.slot / 2, y: l.value.top },
          { x: l.value.left + l.value.slot * c.value + l.value.slot / 2, y: l.value.bottom }
        ],
        {
          color: a.value.style.chart.selector.color,
          lineDash: a.value.style.chart.selector.dashed ? [8, 8] : [0, 0],
          lineWidth: 2
        }
      );
    }
    function Sa() {
      M.value && b(
        s.value,
        [
          { x: l.value.left, y: M.value },
          { x: l.value.right, y: M.value }
        ],
        {
          color: a.value.style.chart.selector.color,
          lineDash: a.value.style.chart.selector.dashed ? [8, 8] : [0, 0],
          lineWidth: 2
        }
      );
    }
    function $a() {
      k.value.forEach((e, t) => {
        for (let o = 0; o < e.coordinatesLine.length; o += 1)
          Se(
            s.value,
            [
              {
                x: l.value.left + l.value.slot * o + l.value.slot / 10 + (u.value.stacked ? 0 : l.value.slot / k.value.length * t - (t === 0 ? 0 : l.value.slot / (5 * k.value.length) * t)),
                y: u.value.stacked ? e.localZero : p.value.zero
              },
              {
                x: l.value.left + l.value.slot * o + l.value.slot / 10 + (u.value.stacked ? 0 : l.value.slot / k.value.length * t - (t === 0 ? 0 : l.value.slot / (5 * k.value.length) * t)) + l.value.slot * 0.8 / (u.value.stacked ? 1 : k.value.length),
                y: u.value.stacked ? e.localZero : p.value.zero
              },
              {
                x: l.value.left + l.value.slot * o + l.value.slot / 10 + (u.value.stacked ? 0 : l.value.slot / k.value.length * t - (t === 0 ? 0 : l.value.slot / (5 * k.value.length) * t)) + l.value.slot * 0.8 / (u.value.stacked ? 1 : k.value.length),
                y: e.coordinatesLine[o].y
              },
              {
                x: l.value.left + l.value.slot * o + l.value.slot / 10 + (u.value.stacked ? 0 : l.value.slot / k.value.length * t - (t === 0 ? 0 : l.value.slot / (5 * k.value.length) * t)),
                y: e.coordinatesLine[o].y
              }
            ],
            {
              strokeColor: a.value.style.chart.backgroundColor,
              gradient: {
                type: "linear",
                start: {
                  x: e.coordinatesLine[o].x,
                  y: e.coordinatesLine[o].y
                },
                end: {
                  x: e.coordinatesLine[o].x,
                  y: u.value.stacked ? e.localZero : p.value.zero
                },
                stops: [
                  { offset: 0, color: e.color },
                  { offset: 1, color: a.value.style.chart.bar.gradient.show ? el(e.color, 0.5) : e.color }
                ]
              }
            }
          ), u.value.showDataLabels && [!0, void 0].includes(e.dataLabels) && R(
            s.value,
            j(
              a.value.style.chart.dataLabels.formatter,
              e.coordinatesLine[o].value,
              q({
                p: e.prefix || "",
                v: e.coordinatesLine[o].value,
                s: e.suffix || "",
                r: e.rounding || 0
              }),
              { datapoint: e.coordinatesLine[o], seriesIndex: o }
            ),
            l.value.left + l.value.slot * o + l.value.slot / 10 + (u.value.stacked ? 0 : l.value.slot / k.value.length * t - (t === 0 ? 0 : l.value.slot / (5 * k.value.length) * t)) + l.value.slot * 0.4 / (u.value.stacked ? 1 : k.value.length),
            (e.coordinatesLine[o].value < 0 ? u.value.stacked ? e.localZero : p.value.zero : e.coordinatesLine[o].y) + a.value.style.chart.dataLabels.offsetY,
            {
              align: "center",
              font: `${Math.round(y.value / 40 * a.value.style.chart.dataLabels.fontSizeRatio)}px ${a.value.style.fontFamily}`,
              color: a.value.style.chart.dataLabels.useSerieColor ? e.color : a.value.style.chart.dataLabels.color,
              strokeColor: a.value.style.chart.backgroundColor,
              lineWidth: 0.8
            }
          );
      });
    }
    function Ia(e) {
      e.useArea ? u.value.stacked ? sa(
        s.value,
        [{ x: e.coordinatesLine[0].x, y: e.localZero }, ...e.coordinatesLine, { x: e.coordinatesLine.at(-1).x, y: e.localZero }],
        {
          fillColor: re(e.color, a.value.style.chart.area.opacity),
          strokeColor: "transparent"
        }
      ) : sa(
        s.value,
        [{ x: e.coordinatesLine[0].x, y: p.value.zero }, ...e.coordinatesLine, { x: e.coordinatesLine.at(-1).x, y: p.value.zero }],
        {
          fillColor: re(e.color, a.value.style.chart.area.opacity),
          strokeColor: "transparent"
        }
      ) : b(s.value, e.coordinatesLine, {
        color: e.color,
        lineWidth: 3
      });
    }
    function Ma() {
      h.value.forEach((e, t) => {
        b(
          s.value,
          [
            { x: l.value.left, y: l.value.bottom - e.yOffset },
            { x: l.value.right, y: l.value.bottom - e.yOffset }
          ],
          {
            color: a.value.style.chart.grid.x.horizontalLines.color,
            lineWidth: 1
          }
        );
      });
    }
    function Q() {
      xa(), D.value ? (c.value !== null && a.value.style.chart.selector.show && Ze(), $a(), u.value.stacked && a.value.style.chart.grid.x.showAxis && Ma(), ma.value.forEach((e) => {
        (e.type === "line" || !e.type) && Ia(e), W.value && (La(e), u.value.showDataLabels && [!0, void 0].includes(e.dataLabels) && wa(e));
      }), pe.value = ol(T.value)) : (pe.value && (s.value.clearRect(0, 0, 1e4, 1e4), s.value.drawImage(pe.value, 0, 0)), c.value !== null && a.value.style.chart.selector.show && Ze(), c.value !== null && h.value.forEach((e) => {
        if (e.type === "line" || !e.type || e.type === "plot") {
          if (!e.coordinatesLine[c.value]) return;
          e.coordinatesLine[c.value].x !== void 0 && e.coordinatesLine[c.value].y !== void 0 && ua(
            s.value,
            {
              x: e.coordinatesLine[c.value].x,
              y: e.coordinatesLine[c.value].y
            },
            y.value / 150 * a.value.style.chart.line.plots.radiusRatio,
            {
              color: a.value.style.chart.backgroundColor,
              fillStyle: e.color
            }
          );
        }
      })), a.value.style.chart.grid.y.timeLabels.show && za(), a.value.style.chart.selector.show && a.value.style.chart.selector.showHorizontalSelector && Sa(), Ca(), ka(), D.value = !1;
    }
    const ie = al(() => {
      W.value = !0, ba();
    }, I.value > 200 ? 10 : 1, !W.value);
    function ee(e) {
      if ([null, void 0].includes(c.value) || !e.coordinatesLine[c.value]) return !1;
      const { y: t, value: o } = e.coordinatesLine[c.value];
      return { y: t, value: o };
    }
    function Ta(e) {
      const { left: t, top: o } = T.value.getBoundingClientRect(), n = e.clientX - t;
      if (M.value = (e.clientY - o) * 2, (M.value < l.value.top || M.value > l.value.bottom) && (M.value = null), n * 2 < l.value.left || n * 2 > l.value.right) {
        ue.value = !1, c.value = null;
        return;
      }
      const d = n * 2 - l.value.left;
      if (c.value = Math.floor(d / l.value.slot), ue.value = !0, !W.value) return;
      let C = "";
      const i = a.value.style.chart.tooltip.customFormat;
      ra(i) && Qa(() => i({
        seriesIndex: c.value,
        datapoint: h.value.map((f) => ({
          shape: f.shape || null,
          name: f.name,
          color: f.color,
          type: f.type || "line",
          value: f.series.find((H, S) => S === c.value)
        })),
        series: h.value,
        config: a.value
      })) ? se.value = i({
        seriesIndex: c.value,
        datapoint: h.value.map((f) => ({
          shape: f.shape || null,
          name: f.name,
          color: f.color,
          type: f.type || "line",
          value: f.series.find((H, S) => S === c.value)
        })),
        series: h.value,
        config: a.value
      }) : (a.value.style.chart.grid.y.timeLabels.values.slice(r.value.start, r.value.end)[c.value] && (C += `<div style="padding-bottom: 6px; margin-bottom: 4px; border-bottom: 1px solid ${a.value.style.chart.tooltip.borderColor}; width:100%">${a.value.style.chart.grid.y.timeLabels.values.slice(r.value.start, r.value.end)[c.value]}</div>`), C += ga.value.join(""), se.value = C), W.value = !1;
    }
    E(() => c.value, (e) => {
      ie();
    }), E(() => r.value, (e) => {
      D.value = !0, Q();
    }, {
      deep: !0
    }), E(() => u.value.showDataLabels, (e) => {
      D.value = !0, Q();
    }), E(() => M.value, (e) => {
      e && Q();
    }), E(() => u.value.stacked, (e) => {
      D.value = !0, W.value = !0, ie();
    });
    function Oa() {
      ue.value = !1, c.value = null, se.value = "", M.value = null, Q();
    }
    const ve = v(null), ce = v(null);
    la(() => {
      Ce();
    });
    function Ce() {
      if (ja(g.dataset) ? qa({
        componentName: "VueUiXyCanvas",
        type: "dataset"
      }) : T.value && (s.value = T.value.getContext("2d", { willReadFrequently: !0 })), a.value.responsive) {
        const e = ll(() => {
          const { width: t, height: o } = tl({
            chart: J.value,
            title: a.value.style.chart.title.text ? Oe.value : null,
            legend: a.value.style.chart.legend.show ? Re.value : null,
            slicer: a.value.style.chart.zoom.show && I.value > 1 ? Pe.value : null,
            source: Fe.value
          });
          requestAnimationFrame(() => {
            He.value = `${t} / ${o}`;
          });
        });
        ve.value = new ResizeObserver(e), ve.value.observe(J.value.parentNode);
      }
      ce.value = new ResizeObserver((e) => {
        for (const t of e)
          t.contentBoxSize && K.value && (D.value = !0, ie());
      }), ce.value.observe(K.value), Ve();
    }
    Aa(() => {
      ce.value && ce.value.disconnect(), ve.value && ve.value.disconnect();
    });
    function Ge(e) {
      da("selectLegend", h.value.find((t) => t.absoluteIndex === e)), $.value.includes(e) ? $.value = $.value.filter((t) => t !== e) : $.value.push(e), D.value = !0, ie();
    }
    const je = x(() => X.value.map((e, t) => ({
      ...e,
      name: e.name,
      color: oa(e.color) || We.value[t] || _[t] || _[t % _.length],
      shape: e.shape || "circle",
      prefix: e.prefix || "",
      suffix: e.suffix || "",
      rounding: e.rounding || 0
    })).map((e) => ({
      ...e,
      opacity: $.value.includes(e.absoluteIndex) ? 0.5 : 1,
      segregate: () => Ge(e.absoluteIndex),
      isSegregated: $.value.includes(e.absoluteIndex)
    }))), Ra = x(() => ({
      cy: "donut-div-legend",
      backgroundColor: a.value.style.chart.legend.backgroundColor,
      color: a.value.style.chart.legend.color,
      fontSize: a.value.style.chart.legend.fontSize,
      paddingBottom: 12,
      fontWeight: a.value.style.chart.legend.bold ? "bold" : ""
    })), de = x(() => {
      const e = [""].concat(h.value.map((d) => d.name)).concat(' <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M18 16v2a1 1 0 0 1 -1 1h-11l6 -7l-6 -7h11a1 1 0 0 1 1 1v2" /></svg>');
      let t = [];
      for (let d = 0; d < I.value; d += 1) {
        const C = h.value.map((i) => i.series[d] ?? 0).reduce((i, f) => i + f, 0);
        t.push([a.value.style.chart.grid.y.timeLabels.values.slice(r.value.start, r.value.end)[d] ?? d + 1].concat(h.value.map((i) => (i.series[d] ?? 0).toFixed(a.value.table.rounding))).concat((C ?? 0).toFixed(a.value.table.rounding)));
      }
      const o = {
        th: {
          backgroundColor: a.value.table.th.backgroundColor,
          color: a.value.table.th.color,
          outline: a.value.table.th.outline
        },
        td: {
          backgroundColor: a.value.table.td.backgroundColor,
          color: a.value.table.td.color,
          outline: a.value.table.td.outline
        },
        breakpoint: a.value.table.responsiveBreakpoint
      }, n = [a.value.table.columnNames.period].concat(h.value.map((d) => d.name)).concat(a.value.table.columnNames.total);
      return { head: e, body: t.slice(0, r.value.end - r.value.start), config: o, colNames: n };
    }), qe = x(() => {
      if (h.value.length === 0) return { head: [], body: [], config: {}, columnNames: [] };
      const e = h.value.map((o) => ({
        label: o.name,
        color: o.color,
        type: o.type
      })), t = [];
      for (let o = r.value.start; o < r.value.end; o += 1) {
        const n = [a.value.style.chart.grid.y.timeLabels.values[o] || o + 1];
        h.value.forEach((d) => {
          n.push(Number((d.series[o] || 0).toFixed(a.value.table.rounding)));
        }), t.push(n);
      }
      return { head: e, body: t };
    });
    function Je() {
      const e = [[a.value.style.chart.title.text], [a.value.style.chart.title.subtitle.text], [""]], t = ["", ...qe.value.head.map((C) => C.label)], o = qe.value.body, n = e.concat([t]).concat(o), d = Ja(n);
      Ka({ csvContent: d, title: a.value.style.chart.title.text || "vue-ui-xy-canvas" });
    }
    function Pa() {
      return h.value;
    }
    function Ke() {
      u.value.showTable = !u.value.showTable;
    }
    function Qe() {
      u.value.showDataLabels = !u.value.showDataLabels;
    }
    function ea() {
      u.value.stacked = !u.value.stacked;
    }
    function aa() {
      u.value.showTooltip = !u.value.showTooltip;
    }
    const he = v(!1);
    function we() {
      he.value = !he.value;
    }
    return ia({
      getData: Pa,
      generateCsv: Je,
      generatePdf: _e,
      generateImage: Ue,
      toggleTable: Ke,
      toggleLabels: Qe,
      toggleStack: ea,
      toggleTooltip: aa,
      toggleAnnotator: we
    }), (e, t) => (z(), te("div", {
      style: V(`width:100%; position:relative; ${a.value.responsive ? "height: 100%" : ""}`),
      ref_key: "xy",
      ref: J,
      id: `xy_canvas_${ge.value}`,
      class: Da(`vue-ui-donut ${ne.value ? "vue-data-ui-wrapper-fullscreen" : ""}`),
      onMouseenter: t[5] || (t[5] = () => w(Ee)(!0)),
      onMouseleave: t[6] || (t[6] = () => w(Ee)(!1))
    }, [
      a.value.style.chart.title.text ? (z(), te("div", {
        key: 0,
        ref_key: "chartTitle",
        ref: Oe,
        style: V(`width:100%;background:${a.value.style.chart.backgroundColor};`)
      }, [
        (z(), A(sl, {
          key: `title_${me.value}`,
          config: {
            title: {
              cy: "xy-canvas-title",
              ...a.value.style.chart.title
            },
            subtitle: {
              cy: "xy-canvas-subtitle",
              ...a.value.style.chart.title.subtitle
            }
          }
        }, null, 8, ["config"]))
      ], 4)) : Y("", !0),
      a.value.userOptions.show && Le.value && (w(Ae) || w(ke)) ? (z(), A(vl, {
        ref: "details",
        key: `user_option_${Te.value}`,
        backgroundColor: a.value.style.chart.backgroundColor,
        color: a.value.style.chart.color,
        isPrinting: w(Ne),
        isImaging: w(Ye),
        uid: ge.value,
        hasTooltip: a.value.userOptions.buttons.tooltip && a.value.style.chart.tooltip.show,
        hasPdf: a.value.userOptions.buttons.pdf,
        hasImg: a.value.userOptions.buttons.img,
        hasXls: a.value.userOptions.buttons.csv,
        hasLabel: a.value.userOptions.buttons.labels,
        hasStack: $e.dataset.length > 1 && a.value.userOptions.buttons.stack,
        hasFullscreen: a.value.userOptions.buttons.fullscreen,
        hasTable: r.value.end - r.value.start < 200 && a.value.userOptions.buttons.table,
        isFullscreen: ne.value,
        isTooltip: u.value.showTooltip,
        isStacked: u.value.stacked,
        titles: { ...a.value.userOptions.buttonTitles },
        chartElement: J.value,
        position: a.value.userOptions.position,
        hasAnnotator: a.value.userOptions.buttons.annotator,
        isAnnotation: he.value,
        onToggleFullscreen: ya,
        onGeneratePdf: w(_e),
        onGenerateCsv: Je,
        onGenerateImage: w(Ue),
        onToggleTable: Ke,
        onToggleLabels: Qe,
        onToggleStack: ea,
        onToggleTooltip: aa,
        onToggleAnnotator: we,
        style: V({
          visibility: w(Ae) ? w(ke) ? "visible" : "hidden" : "visible"
        })
      }, Ha({ _: 2 }, [
        e.$slots.optionTooltip ? {
          name: "optionTooltip",
          fn: m(() => [
            L(e.$slots, "optionTooltip", {}, void 0, !0)
          ]),
          key: "0"
        } : void 0,
        e.$slots.optionPdf ? {
          name: "optionPdf",
          fn: m(() => [
            L(e.$slots, "optionPdf", {}, void 0, !0)
          ]),
          key: "1"
        } : void 0,
        e.$slots.optionCsv ? {
          name: "optionCsv",
          fn: m(() => [
            L(e.$slots, "optionCsv", {}, void 0, !0)
          ]),
          key: "2"
        } : void 0,
        e.$slots.optionImg ? {
          name: "optionImg",
          fn: m(() => [
            L(e.$slots, "optionImg", {}, void 0, !0)
          ]),
          key: "3"
        } : void 0,
        e.$slots.optionTable ? {
          name: "optionTable",
          fn: m(() => [
            L(e.$slots, "optionTable", {}, void 0, !0)
          ]),
          key: "4"
        } : void 0,
        e.$slots.optionLabels ? {
          name: "optionLabels",
          fn: m(() => [
            L(e.$slots, "optionLabels", {}, void 0, !0)
          ]),
          key: "5"
        } : void 0,
        e.$slots.optionStack ? {
          name: "optionStack",
          fn: m(() => [
            L(e.$slots, "optionStack", {}, void 0, !0)
          ]),
          key: "6"
        } : void 0,
        e.$slots.optionFullscreen ? {
          name: "optionFullscreen",
          fn: m(({ toggleFullscreen: o, isFullscreen: n }) => [
            L(e.$slots, "optionFullscreen", Z(G({ toggleFullscreen: o, isFullscreen: n })), void 0, !0)
          ]),
          key: "7"
        } : void 0,
        e.$slots.optionAnnotator ? {
          name: "optionAnnotator",
          fn: m(({ toggleAnnotator: o, isAnnotator: n }) => [
            L(e.$slots, "optionAnnotator", Z(G({ toggleAnnotator: o, isAnnotator: n })), void 0, !0)
          ]),
          key: "8"
        } : void 0
      ]), 1032, ["backgroundColor", "color", "isPrinting", "isImaging", "uid", "hasTooltip", "hasPdf", "hasImg", "hasXls", "hasLabel", "hasStack", "hasFullscreen", "hasTable", "isFullscreen", "isTooltip", "isStacked", "titles", "chartElement", "position", "hasAnnotator", "isAnnotation", "onGeneratePdf", "onGenerateImage", "style"])) : Y("", !0),
      oe("div", {
        class: "vue-ui-xy-canvas",
        style: V(`position: relative; aspect-ratio: ${He.value}`),
        ref_key: "container",
        ref: K
      }, [
        Le.value ? (z(), te("canvas", {
          key: 0,
          ref_key: "canvas",
          ref: T,
          style: { width: "100%", height: "100%" },
          onMousemove: t[0] || (t[0] = (o) => Ta(o)),
          onMouseleave: Oa
        }, null, 544)) : (z(), A(hl, {
          key: 1,
          config: {
            type: "line",
            style: {
              backgroundColor: a.value.style.chart.backgroundColor,
              line: {
                axis: {
                  color: "#CCCCCC"
                },
                path: {
                  color: "#CCCCCC",
                  strokeWidth: 0.5
                }
              }
            }
          }
        }, null, 8, ["config"])),
        Na(rl, {
          show: u.value.showTooltip && ue.value,
          backgroundColor: a.value.style.chart.tooltip.backgroundColor,
          color: a.value.style.chart.tooltip.color,
          fontSize: a.value.style.chart.tooltip.fontSize,
          borderRadius: a.value.style.chart.tooltip.borderRadius,
          borderColor: a.value.style.chart.tooltip.borderColor,
          borderWidth: a.value.style.chart.tooltip.borderWidth,
          position: a.value.style.chart.tooltip.position,
          offsetY: a.value.style.chart.tooltip.offsetY,
          parent: w(T),
          content: se.value,
          isFullscreen: ne.value,
          backgroundOpacity: a.value.style.chart.tooltip.backgroundOpacity,
          isCustom: w(ra)(a.value.style.chart.tooltip.customFormat)
        }, {
          "tooltip-before": m(() => [
            L(e.$slots, "tooltip-before", Z(G({ ...Ie.value })), void 0, !0)
          ]),
          "tooltip-after": m(() => [
            L(e.$slots, "tooltip-after", Z(G({ ...Ie.value })), void 0, !0)
          ]),
          _: 3
        }, 8, ["show", "backgroundColor", "color", "fontSize", "borderRadius", "borderColor", "borderWidth", "position", "offsetY", "parent", "content", "isFullscreen", "backgroundOpacity", "isCustom"])
      ], 4),
      oe("div", {
        ref_key: "chartSlicer",
        ref: Pe,
        style: V(`width:100%;background:${a.value.style.chart.backgroundColor}`),
        "data-html2canvas-ignore": ""
      }, [
        a.value.style.chart.zoom.show && I.value > 1 ? (z(), A(nl, {
          ref_key: "slicerComponent",
          ref: B,
          key: `slicer_${Me.value}`,
          background: a.value.style.chart.zoom.color,
          borderColor: a.value.style.chart.backgroundColor,
          fontSize: a.value.style.chart.zoom.fontSize,
          useResetSlot: a.value.style.chart.zoom.useResetSlot,
          labelLeft: a.value.style.chart.grid.y.timeLabels.values[r.value.start] ? a.value.style.chart.grid.y.timeLabels.values[r.value.start] : "",
          labelRight: a.value.style.chart.grid.y.timeLabels.values[r.value.end - 1] ? a.value.style.chart.grid.y.timeLabels.values[r.value.end - 1] : "",
          textColor: a.value.style.chart.color,
          inputColor: a.value.style.chart.zoom.color,
          selectColor: a.value.style.chart.zoom.highlightColor,
          max: I.value,
          min: 0,
          valueStart: r.value.start,
          valueEnd: r.value.end,
          start: r.value.start,
          "onUpdate:start": t[1] || (t[1] = (o) => r.value.start = o),
          end: r.value.end,
          "onUpdate:end": t[2] || (t[2] = (o) => r.value.end = o),
          refreshStartPoint: a.value.style.chart.zoom.startIndex !== null ? a.value.style.chart.zoom.startIndex : 0,
          refreshEndPoint: a.value.style.chart.zoom.endIndex !== null ? a.value.style.chart.zoom.endIndex + 1 : I.value,
          enableRangeHandles: a.value.style.chart.zoom.enableRangeHandles,
          enableSelectionDrag: a.value.style.chart.zoom.enableSelectionDrag,
          onReset: Be
        }, {
          "reset-action": m(({ reset: o }) => [
            L(e.$slots, "reset-action", Z(G({ reset: o })), void 0, !0)
          ]),
          _: 3
        }, 8, ["background", "borderColor", "fontSize", "useResetSlot", "labelLeft", "labelRight", "textColor", "inputColor", "selectColor", "max", "valueStart", "valueEnd", "start", "end", "refreshStartPoint", "refreshEndPoint", "enableRangeHandles", "enableSelectionDrag"])) : Y("", !0)
      ], 4),
      oe("div", {
        ref_key: "chartLegend",
        ref: Re
      }, [
        a.value.style.chart.legend.show && Le.value ? (z(), A(ul, {
          legendSet: je.value,
          config: Ra.value,
          key: `legend_${xe.value}`,
          onClickMarker: t[3] || (t[3] = ({ i: o }) => Ge(o))
        }, {
          item: m(({ legend: o, index: n }) => [
            oe("div", {
              onClick: (d) => o.segregate(),
              style: V(`opacity:${$.value.includes(n) ? 0.5 : 1}`)
            }, ta(o.name), 13, bl)
          ]),
          _: 1
        }, 8, ["legendSet", "config"])) : L(e.$slots, "legend", {
          key: 1,
          legend: je.value
        }, void 0, !0)
      ], 512),
      e.$slots.watermark ? (z(), te("div", xl, [
        L(e.$slots, "watermark", Z(G({ isPrinting: w(Ne) || w(Ye) })), void 0, !0)
      ])) : Y("", !0),
      e.$slots.source ? (z(), te("div", {
        key: 3,
        ref_key: "source",
        ref: Fe,
        dir: "auto"
      }, [
        L(e.$slots, "source", {}, void 0, !0)
      ], 512)) : Y("", !0),
      r.value.end - r.value.start < 200 ? (z(), A(cl, {
        key: 4,
        hideDetails: "",
        config: {
          open: u.value.showTable,
          maxHeight: 1e4,
          body: {
            backgroundColor: a.value.style.chart.backgroundColor,
            color: a.value.style.chart.color
          },
          head: {
            backgroundColor: a.value.style.chart.backgroundColor,
            color: a.value.style.chart.color
          }
        }
      }, {
        content: m(() => [
          (z(), A(dl, {
            key: `table_${be.value}`,
            colNames: de.value.colNames,
            head: de.value.head,
            body: de.value.body,
            config: de.value.config,
            title: `${a.value.style.chart.title.text}${a.value.style.chart.title.subtitle.text ? ` : ${a.value.style.chart.title.subtitle.text}` : ""}`,
            onClose: t[4] || (t[4] = (o) => u.value.showTable = !1)
          }, {
            th: m(({ th: o }) => [
              oe("div", { innerHTML: o }, null, 8, Ll)
            ]),
            td: m(({ td: o }) => [
              Ya(ta(o), 1)
            ]),
            _: 1
          }, 8, ["colNames", "head", "body", "config", "title"]))
        ]),
        _: 1
      }, 8, ["config"])) : Y("", !0),
      a.value.userOptions.buttons.annotator && h.value.length ? (z(), A(yl, {
        key: 5,
        parent: J.value,
        backgroundColor: a.value.style.chart.backgroundColor,
        color: a.value.style.chart.color,
        active: he.value,
        onClose: we
      }, null, 8, ["parent", "backgroundColor", "color", "active"])) : Y("", !0)
    ], 46, ml));
  }
}, Nl = /* @__PURE__ */ pl(kl, [["__scopeId", "data-v-47eacf52"]]);
export {
  Nl as default
};
