UNPKG

vue-data-ui

Version:

A user-empowering data visualization Vue 3 components library for eloquent data storytelling

1,232 lines 54 kB
import { defineAsyncComponent as Q, ref as d, computed as L, useSlots as Va, onMounted as sa, watch as D, nextTick as pe, shallowRef as Ie, onBeforeUnmount as Ga, createElementBlock as ne, openBlock as S, unref as p, normalizeClass as Za, normalizeStyle as ee, createCommentVNode as X, createBlock as N, createElementVNode as ie, createSlots as ja, withCtx as x, renderSlot as k, normalizeProps as B, guardReactiveProps as _, createVNode as qa, toDisplayString as na, createTextVNode as Ja } from "vue";
import { u as Ka, c as Qa, t as el, p as V, a as al, C as me, b as ll, D as Me, i as ae, f as le, d as ia, a2 as tl, G as ol, aj as rl, o as ul, e as sl, x as va, q as nl, r as il, y as vl, s as ve, l as cl } from "./index-BLtEpj8j.js";
import { d as dl, t as hl, u as yl, c as fl, a as ca, l as C, r as Te, b as R, p as da } from "./useResponsive-DfdjqQps.js";
import { u as ha } from "./useNestedProp-Bw1KcAmj.js";
import { u as gl } from "./usePrinter-DnRwTdvS.js";
import { u as pl } from "./useUserOptionState-BIvW1Kz7.js";
import { u as ml } from "./useChartAccessibility-9icAAmYg.js";
import bl from "./Legend-E7G897sw.js";
import xl from "./Title-DkG60EPg.js";
import { S as Ll } from "./Slicer-D-HtJC7M.js";
import { u as kl } from "./useTimeLabels-DFkUfjfs.js";
import Cl from "./img-D-vWHxhM.js";
import { _ as wl } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const Sl = ["id"], zl = ["onClick"], $l = {
  key: 2,
  class: "vue-data-ui-watermark"
}, Il = ["innerHTML"], Ml = {
  __name: "vue-ui-xy-canvas",
  props: {
    dataset: {
      type: Array,
      default() {
        return [];
      }
    },
    config: {
      type: Object,
      default() {
        return {};
      }
    }
  },
  emits: ["selectLegend"],
  setup(Oe, { expose: ya, emit: fa }) {
    const ga = Q(() => import("./vue-ui-accordion-B6Svdk-2.js")), pa = Q(() => import("./DataTable-CS_V_Adx.js")), ma = Q(() => import("./NonSvgPenAndPaper-C9y-x0_V.js")), ba = Q(() => import("./vue-ui-skeleton-CsMU8DwQ.js")), xa = Q(() => import("./Tooltip-CuHsd1IQ.js")), La = Q(() => import("./UserOptions-DGw0HvSp.js")), { vue_ui_xy_canvas: ka } = Ka(), g = Oe, be = d(Qa()), P = d(null), te = d(null), s = d(null), y = d(1), E = d(1), ce = d(!1), c = d(null), de = d(""), Re = d(null), $ = d([]), G = d(1), H = d(!0), Z = d(!0), xe = d(null), Pe = d(0), Ee = d(0), he = d(!1), Fe = d(null), Ae = d(null), De = d(null), Ne = d(null), Le = d(0), ke = d(0), Ce = d(0), M = d(null), we = L(() => !!g.dataset && g.dataset.length), Ca = fa, wa = Va();
    sa(() => {
      wa["chart-background"] && console.warn("VueUiXyCanvas does not support the #chart-background slot.");
    });
    const a = L({
      get: () => Ue(),
      set: (e) => e
    }), { userOptionsVisible: Se, setUserOptionsVisibility: He, keepUserOptionState: Ye } = pl({ config: a.value }), { svgRef: T } = ml({ config: a.value.style.chart.title });
    function Ue() {
      const e = ha({
        userConfig: g.config,
        defaultConfig: ka
      });
      let l = {};
      return e.theme ? l = {
        ...ha({
          userConfig: al.vue_ui_xy_canvas[e.theme] || g.config,
          defaultConfig: e
        }),
        customPalette: el[e.theme] || V
      } : l = e, g.config && me(g.config, "style.chart.scale.min") ? l.style.chart.scale.min = g.config.style.chart.scale.min : l.style.chart.scale.min = null, g.config && me(g.config, "style.chart.scale.max") ? l.style.chart.scale.max = g.config.style.chart.scale.max : l.style.chart.scale.max = null, g.config && me(g.config, "style.chart.zoom.startIndex") ? l.style.chart.zoom.startIndex = g.config.style.chart.zoom.startIndex : l.style.chart.zoom.startIndex = null, g.config && me(g.config, "style.chart.zoom.endIndex") ? l.style.chart.zoom.endIndex = g.config.style.chart.zoom.endIndex : l.style.chart.zoom.endIndex = null, l;
    }
    D(() => g.config, (e) => {
      a.value = Ue(), Se.value = !a.value.userOptions.showOnChartHover, ze(), Le.value += 1, ke.value += 1, Ce.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 }), D(() => g.dataset, () => {
      ze(), Le.value += 1, ke.value += 1, Ce.value += 1;
    }, { deep: !0 });
    const We = d(a.value.style.chart.aspectRatio), { isPrinting: Xe, isImaging: Be, generatePdf: _e, generateImage: Ve } = gl({
      elementId: `xy_canvas_${be.value}`,
      fileName: a.value.style.chart.title.text || "vue-ui-xy-canvas",
      options: a.value.userOptions.print
    }), u = d({
      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 Ge(e) {
      he.value = e, Ee.value += 1;
    }
    const Ze = L(() => ll(a.value.customPalette)), I = L(() => j.value ? Math.max(...j.value.filter((e, l) => !$.value.includes(e.absoluteIndex)).map((e) => e.series.length)) : 0), t = L(() => {
      const e = y.value - y.value * (a.value.style.chart.paddingProportions.left + a.value.style.chart.paddingProportions.right);
      return {
        canvasWidth: y.value,
        canvasHeight: E.value,
        left: y.value * a.value.style.chart.paddingProportions.left,
        top: E.value * a.value.style.chart.paddingProportions.top,
        right: y.value - y.value * a.value.style.chart.paddingProportions.right,
        bottom: E.value - E.value * a.value.style.chart.paddingProportions.bottom,
        width: e,
        height: E.value - E.value * (a.value.style.chart.paddingProportions.top + a.value.style.chart.paddingProportions.bottom),
        slot: e / (r.value.end - r.value.start)
      };
    });
    function je(e, l) {
      return e / l;
    }
    function Sa({ hasAutoScale: e, series: l, min: o, max: n, scale: i, yOffset: b, individualHeight: v, stackIndex: f = null }) {
      return l.map((U, z) => {
        const A = i.min < 0 ? Math.abs(i.min) : 0, W = je(U + A, A + i.max);
        let ue, se;
        e && (ue = i.min, se = je(U - ue, i.max - ue));
        let O = 0;
        return f === null ? O = t.value.bottom - t.value.height * (e ? se : W) : O = t.value.bottom - b - v * (e ? se : W), {
          x: t.value.left + t.value.slot * z + t.value.slot / 2,
          y: O,
          value: U
        };
      });
    }
    const m = L(() => {
      const e = a.value.style.chart.scale.min !== null ? a.value.style.chart.scale.min : Math.min(...j.value.filter((v, f) => !$.value.includes(v.absoluteIndex)).flatMap((v) => v.series.slice(r.value.start, r.value.end))), l = a.value.style.chart.scale.max !== null ? a.value.style.chart.scale.max : Math.max(...j.value.filter((v, f) => !$.value.includes(v.absoluteIndex)).flatMap((v) => v.series.slice(r.value.start, r.value.end))), o = Me(e < 0 ? e : 0, l === e ? e + 1 < 0 ? 0 : e + 1 : l < 0 ? 0 : l, a.value.style.chart.scale.ticks), n = o.min < 0 ? Math.abs(o.min) : 0, i = t.value.bottom - t.value.height * (n / (o.max + n)), b = o.ticks.map((v) => ({
        y: t.value.bottom - t.value.height * ((v + n) / (o.max + n)),
        x: t.value.left - 8,
        value: v
      }));
      return {
        absoluteMin: n,
        max: l,
        min: e,
        scale: o,
        yLabels: b,
        zero: i
      };
    }), za = L(() => 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>${ae(
      a.value.style.chart.dataLabels.formatter,
      e.series[c.value],
      le({
        p: e.prefix || "",
        v: e.series[c.value],
        s: e.suffix || "",
        r: e.rounding || 0
      }),
      { datapoint: e, seriesIndex: c.value }
    )}</span>
            </div>
        `)), j = L(() => g.dataset.map((e, l) => ({
      ...e,
      series: tl({
        data: ol(e.series),
        threshold: a.value.downsample.threshold
      }),
      absoluteIndex: l,
      color: ia(e.color || Ze.value[l] || V[l] || V[l % V.length])
    })));
    D(I, (e) => {
      e && qe();
    });
    const h = L(() => rl(j.value.filter((e, l) => !$.value.includes(e.absoluteIndex))).map((e, l) => ({
      ...e,
      series: e.series.slice(r.value.start, r.value.end)
    })).map((e, l) => {
      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 i = {
        valueMin: o,
        valueMax: n
      }, b = e.scaleSteps || a.value.style.chart.scale.ticks;
      let v;
      e.autoScaling ? v = Me(i.valueMin, i.valueMax, b) : v = Me(i.valueMin < 0 ? i.valueMin : 0, i.valueMax <= 0 ? 0 : i.valueMax, b);
      const f = u.value.stacked ? t.value.height * (1 - e.cumulatedStackRatio) : 0, U = u.value.stacked ? t.value.height / a.value.style.chart.stackGap : 0, z = u.value.stacked ? t.value.height * e.stackRatio - U : t.value.height, A = v.min < 0 ? Math.abs(v.min) : 0;
      let W;
      e.autoScaling && u.value.stacked && n <= 0 ? W = t.value.bottom - f - z : W = t.value.bottom - f - z * (A / (v.max + A));
      const ue = v.ticks.map((O, _a) => ({
        y: t.value.bottom - f - z * (_a / (v.ticks.length - 1)),
        x: t.value.left - 8,
        value: O
      })), se = Sa({
        hasAutoScale: u.value.stacked && e.autoScaling,
        series: e.series,
        min: u.value.stacked ? o : m.value.min,
        max: u.value.stacked ? n : m.value.max,
        scale: u.value.stacked ? v : m.value.scale,
        yOffset: f,
        individualHeight: z,
        stackIndex: u.value.stacked ? l : null
      });
      return {
        ...e,
        coordinatesLine: se,
        min: o,
        max: n,
        localScale: v,
        localZero: W,
        localMin: A,
        localYLabels: ue,
        yOffset: f,
        individualHeight: z
      };
    })), r = d({
      start: 0,
      end: I.value
    });
    function qe() {
      Je();
    }
    const q = d(null);
    async function Je() {
      (a.value.style.chart.zoom.startIndex !== null || a.value.style.chart.zoom.endIndex !== null) && q.value ? (a.value.style.chart.zoom.startIndex !== null && (await pe(), await pe(), q.value && q.value.setStartValue(a.value.style.chart.zoom.startIndex)), a.value.style.chart.zoom.endIndex !== null && (await pe(), await pe(), q.value && q.value.setEndValue($a(a.value.style.chart.zoom.endIndex + 1)))) : (r.value = {
        start: 0,
        end: I.value
      }, Pe.value += 1);
    }
    function $a(e) {
      const l = I.value;
      return e > l ? l : 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 Ia = L(() => h.value.filter((e) => ["line", "plot", void 0].includes(e.type))), w = L(() => h.value.filter((e) => e.type === "bar"));
    function Ma() {
      if (!T.value)
        return;
      const e = te.value.offsetWidth, l = te.value.offsetHeight;
      T.value.width = e * G.value * 2, T.value.height = l * G.value * 2, y.value = e * G.value * 2, E.value = l * G.value * 2, s.value.scale(G.value, G.value), oe();
    }
    function Ta() {
      if (s.value.clearRect(0, 0, 1e4, 1e4), s.value.fillStyle = a.value.style.chart.backgroundColor, s.value.fillRect(0, 0, t.value.canvasWidth, t.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 l = 0; l < r.value.end - r.value.start + 1; l += 1)
            C(
              s.value,
              [
                {
                  x: t.value.left + t.value.slot * l,
                  y: t.value.bottom - e.yOffset - e.individualHeight
                },
                {
                  x: t.value.left + t.value.slot * l,
                  y: t.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 l = r.value.start; l < r.value.end; l += 1)
            l % Math.floor((r.value.end - r.value.start) / a.value.style.chart.grid.y.timeLabels.modulo) === 0 && C(
              s.value,
              [
                {
                  x: t.value.left + t.value.slot * (l - r.value.start) + t.value.slot / 2,
                  y: t.value.bottom - e.yOffset - e.individualHeight
                },
                {
                  x: t.value.left + t.value.slot * (l - r.value.start) + t.value.slot / 2,
                  y: t.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((l, o) => {
            o < e.localYLabels.length - 1 && Te(
              s.value,
              [
                { x: t.value.left, y: l.y },
                { x: t.value.right, y: l.y },
                { x: t.value.right, y: e.localYLabels[o + 1].y },
                { x: t.value.left, y: e.localYLabels[o + 1].y }
              ],
              {
                fillColor: o % 2 === 0 ? "transparent" : ve(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((l) => {
            C(
              s.value,
              [
                { x: t.value.left, y: l.y },
                { x: t.value.right, y: l.y }
              ],
              {
                color: a.value.style.chart.grid.x.horizontalLines.color
              }
            );
          });
        })), a.value.style.chart.grid.zeroLine.show && h.value.forEach((e) => {
          C(
            s.value,
            [
              { x: t.value.left, y: e.localZero },
              { x: t.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) => {
          C(
            s.value,
            [
              { x: t.value.left, y: t.value.bottom - e.yOffset },
              { x: t.value.left, y: t.value.bottom - e.yOffset - e.individualHeight }
            ],
            {
              color: e.color
            }
          ), C(
            s.value,
            [
              { x: t.value.right, y: t.value.bottom - e.yOffset },
              { x: t.value.right, y: t.value.bottom - e.yOffset - e.individualHeight }
            ],
            {
              color: e.color
            }
          );
        }), h.value.forEach((e) => {
          R(
            s.value,
            e.name,
            y.value / 35,
            t.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)
            C(
              s.value,
              [
                { x: t.value.left + t.value.slot * e, y: t.value.top },
                { x: t.value.left + t.value.slot * e, y: t.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 && C(
              s.value,
              [
                { x: t.value.left + t.value.slot * (e - r.value.start) + t.value.slot / 2, y: t.value.top },
                { x: t.value.left + t.value.slot * (e - r.value.start) + t.value.slot / 2, y: t.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 ? m.value.yLabels.forEach((e, l) => {
          l < m.value.yLabels.length - 1 && Te(
            s.value,
            [
              { x: t.value.left, y: e.y },
              { x: t.value.right, y: e.y },
              { x: t.value.right, y: m.value.yLabels[l + 1].y },
              { x: t.value.left, y: m.value.yLabels[l + 1].y }
            ],
            {
              fillColor: l % 2 === 0 ? "transparent" : ve(a.value.style.chart.grid.x.horizontalLines.color, a.value.style.chart.grid.x.horizontalLines.opacity),
              strokeColor: "transparent"
            }
          );
        }) : m.value.yLabels.forEach((e) => {
          C(
            s.value,
            [
              { x: t.value.left, y: e.y },
              { x: t.value.right, y: e.y }
            ],
            {
              color: a.value.style.chart.grid.x.horizontalLines.color
            }
          );
        })), a.value.style.chart.grid.y.showAxis && C(
          s.value,
          [
            { x: t.value.left, y: t.value.top },
            { x: t.value.left, y: t.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 && C(
          s.value,
          [
            { x: t.value.left, y: t.value.bottom },
            { x: t.value.right, y: t.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 && C(
          s.value,
          [
            { x: t.value.left, y: m.value.zero },
            { x: t.value.right, y: m.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,
        t.value.bottom - t.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,
        E.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 Oa(e) {
      for (let l = 0; l < e.coordinatesLine.length; l += 1) {
        const o = (c.value === l ? y.value / 150 : a.value.style.chart.line.plots.show ? y.value / 200 : 0) * a.value.style.chart.line.plots.radiusRatio;
        ca(
          s.value,
          { x: e.coordinatesLine[l].x, y: e.coordinatesLine[l].y },
          o,
          {
            color: a.value.style.chart.backgroundColor,
            fillStyle: e.color
          }
        );
      }
    }
    function Ra() {
      h.value.forEach((e) => {
        e.showYMarker && re(e) && R(
          s.value,
          ae(
            a.value.style.chart.dataLabels.formatter,
            re(e).value,
            le({
              p: e.prefix || a.value.style.chart.grid.y.axisLabels.prefix || "",
              v: re(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: re(e), seriesIndex: null }
          ),
          t.value.left - 8 + a.value.style.chart.grid.y.axisLabels.offsetX,
          re(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 Pa() {
      a.value.style.chart.grid.y.axisLabels.show && (u.value.stacked ? h.value.forEach((e) => {
        e.localYLabels.forEach((l, o) => {
          R(
            s.value,
            ae(
              a.value.style.chart.dataLabels.formatter,
              l.value,
              le({
                p: e.prefix || a.value.style.chart.grid.y.axisLabels.prefix || "",
                v: l.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: l, seriesIndex: o }
            ),
            l.x + a.value.style.chart.grid.y.axisLabels.offsetX,
            l.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
            }
          );
        });
      }) : m.value.yLabels.forEach((e, l) => {
        R(
          s.value,
          ae(
            a.value.style.chart.dataLabels.formatter,
            e.value,
            le({
              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: l }
          ),
          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 Ea(e) {
      for (let l = 0; l < e.coordinatesLine.length; l += 1)
        R(
          s.value,
          ae(
            a.value.style.chart.dataLabels.formatter,
            e.coordinatesLine[l].value,
            le({
              p: e.prefix || "",
              v: e.coordinatesLine[l].value,
              s: e.suffix || "",
              r: e.rounding || 0
            }),
            { datapoint: e.coordinatesLine[l], seriesIndex: l }
          ),
          e.coordinatesLine[l].x,
          e.coordinatesLine[l].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
          }
        );
    }
    const Y = L(() => kl({
      values: a.value.style.chart.grid.y.timeLabels.values,
      maxDatapoints: I.value,
      formatter: a.value.style.chart.grid.y.timeLabels.datetimeFormatter,
      start: 0,
      end: a.value.style.chart.grid.y.timeLabels.values.length
    }));
    function Fa() {
      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,
          Y.value[e] ? Y.value[e].text : e + 1,
          t.value.left + t.value.slot * (e - r.value.start) + t.value.slot / 2,
          t.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 ? ve(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 Ke() {
      C(
        s.value,
        [
          { x: t.value.left + t.value.slot * c.value + t.value.slot / 2, y: t.value.top },
          { x: t.value.left + t.value.slot * c.value + t.value.slot / 2, y: t.value.bottom }
        ],
        {
          color: a.value.style.chart.selector.color,
          lineDash: a.value.style.chart.selector.dashed ? [8, 8] : [0, 0],
          lineWidth: 2
        }
      );
    }
    function Aa() {
      M.value && C(
        s.value,
        [
          { x: t.value.left, y: M.value },
          { x: t.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 Da() {
      w.value.forEach((e, l) => {
        for (let o = 0; o < e.coordinatesLine.length; o += 1)
          Te(
            s.value,
            [
              {
                x: t.value.left + t.value.slot * o + t.value.slot / 10 + (u.value.stacked ? 0 : t.value.slot / w.value.length * l - (l === 0 ? 0 : t.value.slot / (5 * w.value.length) * l)),
                y: u.value.stacked ? e.localZero : m.value.zero
              },
              {
                x: t.value.left + t.value.slot * o + t.value.slot / 10 + (u.value.stacked ? 0 : t.value.slot / w.value.length * l - (l === 0 ? 0 : t.value.slot / (5 * w.value.length) * l)) + t.value.slot * 0.8 / (u.value.stacked ? 1 : w.value.length),
                y: u.value.stacked ? e.localZero : m.value.zero
              },
              {
                x: t.value.left + t.value.slot * o + t.value.slot / 10 + (u.value.stacked ? 0 : t.value.slot / w.value.length * l - (l === 0 ? 0 : t.value.slot / (5 * w.value.length) * l)) + t.value.slot * 0.8 / (u.value.stacked ? 1 : w.value.length),
                y: e.coordinatesLine[o].y
              },
              {
                x: t.value.left + t.value.slot * o + t.value.slot / 10 + (u.value.stacked ? 0 : t.value.slot / w.value.length * l - (l === 0 ? 0 : t.value.slot / (5 * w.value.length) * l)),
                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 : m.value.zero
                },
                stops: [
                  { offset: 0, color: e.color },
                  { offset: 1, color: a.value.style.chart.bar.gradient.show ? cl(e.color, 0.5) : e.color }
                ]
              }
            }
          ), u.value.showDataLabels && [!0, void 0].includes(e.dataLabels) && R(
            s.value,
            ae(
              a.value.style.chart.dataLabels.formatter,
              e.coordinatesLine[o].value,
              le({
                p: e.prefix || "",
                v: e.coordinatesLine[o].value,
                s: e.suffix || "",
                r: e.rounding || 0
              }),
              { datapoint: e.coordinatesLine[o], seriesIndex: o }
            ),
            t.value.left + t.value.slot * o + t.value.slot / 10 + (u.value.stacked ? 0 : t.value.slot / w.value.length * l - (l === 0 ? 0 : t.value.slot / (5 * w.value.length) * l)) + t.value.slot * 0.4 / (u.value.stacked ? 1 : w.value.length),
            (e.coordinatesLine[o].value < 0 ? u.value.stacked ? e.localZero : m.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 Na(e) {
      e.useArea ? u.value.stacked ? da(
        s.value,
        [{ x: e.coordinatesLine[0].x, y: e.localZero }, ...e.coordinatesLine, { x: e.coordinatesLine.at(-1).x, y: e.localZero }],
        {
          fillColor: ve(e.color, a.value.style.chart.area.opacity),
          strokeColor: "transparent"
        }
      ) : da(
        s.value,
        [{ x: e.coordinatesLine[0].x, y: m.value.zero }, ...e.coordinatesLine, { x: e.coordinatesLine.at(-1).x, y: m.value.zero }],
        {
          fillColor: ve(e.color, a.value.style.chart.area.opacity),
          strokeColor: "transparent"
        }
      ) : C(s.value, e.coordinatesLine, {
        color: e.color,
        lineWidth: 3
      });
    }
    function Ha() {
      h.value.forEach((e, l) => {
        C(
          s.value,
          [
            { x: t.value.left, y: t.value.bottom - e.yOffset },
            { x: t.value.right, y: t.value.bottom - e.yOffset }
          ],
          {
            color: a.value.style.chart.grid.x.horizontalLines.color,
            lineWidth: 1
          }
        );
      });
    }
    function oe() {
      Ta(), H.value ? (c.value !== null && a.value.style.chart.selector.show && Ke(), Da(), u.value.stacked && a.value.style.chart.grid.x.showAxis && Ha(), Ia.value.forEach((e) => {
        (e.type === "line" || !e.type) && Na(e), Z.value && (Oa(e), u.value.showDataLabels && [!0, void 0].includes(e.dataLabels) && Ea(e));
      }), xe.value = fl(T.value)) : (xe.value && (s.value.clearRect(0, 0, 1e4, 1e4), s.value.drawImage(xe.value, 0, 0)), c.value !== null && a.value.style.chart.selector.show && Ke(), 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 && ca(
            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 && Fa(), a.value.style.chart.selector.show && a.value.style.chart.selector.showHorizontalSelector && Aa(), Pa(), Ra(), H.value = !1;
    }
    const ye = dl(() => {
      Z.value = !0, Ma();
    }, I.value > 200 ? 10 : 1, !Z.value);
    function re(e) {
      if ([null, void 0].includes(c.value) || !e.coordinatesLine[c.value]) return !1;
      const { y: l, value: o } = e.coordinatesLine[c.value];
      return { y: l, value: o };
    }
    function Ya(e) {
      const { left: l, top: o } = T.value.getBoundingClientRect(), n = e.clientX - l;
      if (M.value = (e.clientY - o) * 2, (M.value < t.value.top || M.value > t.value.bottom) && (M.value = null), n * 2 < t.value.left || n * 2 > t.value.right) {
        ce.value = !1, c.value = null;
        return;
      }
      const i = n * 2 - t.value.left;
      if (c.value = Math.floor(i / t.value.slot), ce.value = !0, !Z.value) return;
      let b = "";
      const v = a.value.style.chart.tooltip.customFormat;
      va(v) && vl(() => v({
        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((U, z) => z === c.value)
        })),
        series: h.value,
        config: a.value
      })) ? de.value = v({
        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((U, z) => z === 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] && (b += `<div style="padding-bottom: 6px; margin-bottom: 4px; border-bottom: 1px solid ${a.value.style.chart.tooltip.borderColor}; width:100%">${Y.value.slice(r.value.start, r.value.end)[c.value].text}</div>`), b += za.value.join(""), de.value = b), Z.value = !1;
    }
    D(() => c.value, (e) => {
      ye();
    }), D(() => r.value, (e) => {
      H.value = !0, oe();
    }, {
      deep: !0
    }), D(() => u.value.showDataLabels, (e) => {
      H.value = !0, oe();
    }), D(() => M.value, (e) => {
      e && oe();
    }), D(() => u.value.stacked, (e) => {
      H.value = !0, Z.value = !0, ye();
    });
    function Ua() {
      ce.value = !1, c.value = null, de.value = "", M.value = null, oe();
    }
    const F = Ie(null), J = Ie(null), K = Ie(null);
    sa(() => {
      ze();
    });
    function ze() {
      if (ul(g.dataset) ? sl({
        componentName: "VueUiXyCanvas",
        type: "dataset"
      }) : T.value && (s.value = T.value.getContext("2d", { willReadFrequently: !0 })), a.value.responsive) {
        const e = hl(() => {
          const { width: l, height: o } = yl({
            chart: P.value,
            title: a.value.style.chart.title.text ? Fe.value : null,
            legend: a.value.style.chart.legend.show ? Ae.value : null,
            slicer: a.value.style.chart.zoom.show && I.value > 1 ? De.value : null,
            source: Ne.value
          });
          requestAnimationFrame(() => {
            We.value = `${l} / ${o}`;
          });
        });
        F.value && (J.value && F.value.unobserve(J.value), F.value.disconnect()), F.value = new ResizeObserver(e), J.value = P.value.parentNode, F.value.observe(J.value);
      }
      K.value && K.value.disconnect(), K.value = new ResizeObserver((e) => {
        for (const l of e)
          l.contentBoxSize && te.value && (H.value = !0, ye());
      }), K.value.observe(te.value), Je();
    }
    Ga(() => {
      K.value && K.value.disconnect(), F.value && (J.value && F.value.unobserve(J.value), F.value.disconnect());
    });
    function Qe(e) {
      Ca("selectLegend", h.value.find((l) => l.absoluteIndex === e)), $.value.includes(e) ? $.value = $.value.filter((l) => l !== e) : $.value.push(e), H.value = !0, ye();
    }
    const ea = L(() => j.value.map((e, l) => ({
      ...e,
      name: e.name,
      color: ia(e.color) || Ze.value[l] || V[l] || V[l % V.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: () => Qe(e.absoluteIndex),
      isSegregated: $.value.includes(e.absoluteIndex)
    }))), Wa = L(() => ({
      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" : ""
    })), fe = L(() => {
      const e = [""].concat(h.value.map((i) => i.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 l = [];
      for (let i = 0; i < I.value; i += 1) {
        const b = h.value.map((v) => v.series[i] ?? 0).reduce((v, f) => v + f, 0);
        l.push([a.value.style.chart.grid.y.timeLabels.values.slice(r.value.start, r.value.end)[i] ? Y.value.slice(r.value.start, r.value.end)[i].text : i + 1].concat(h.value.map((v) => (v.series[i] ?? 0).toFixed(a.value.table.rounding))).concat((b ?? 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((i) => i.name)).concat(a.value.table.columnNames.total);
      return { head: e, body: l.slice(0, r.value.end - r.value.start), config: o, colNames: n };
    }), aa = L(() => {
      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
      })), l = [];
      for (let o = r.value.start; o < r.value.end; o += 1) {
        const n = [a.value.style.chart.grid.y.timeLabels.values[o] ? Y.value[o].text : o + 1];
        h.value.forEach((i) => {
          n.push(Number((i.series[o] || 0).toFixed(a.value.table.rounding)));
        }), l.push(n);
      }
      return { head: e, body: l };
    });
    function la(e = null) {
      const l = [[a.value.style.chart.title.text], [a.value.style.chart.title.subtitle.text], [""]], o = ["", ...aa.value.head.map((v) => v.label)], n = aa.value.body, i = l.concat([o]).concat(n), b = nl(i);
      e ? e(b) : il({ csvContent: b, title: a.value.style.chart.title.text || "vue-ui-xy-canvas" });
    }
    function Xa() {
      return h.value;
    }
    function ta() {
      u.value.showTable = !u.value.showTable;
    }
    function oa() {
      u.value.showDataLabels = !u.value.showDataLabels;
    }
    function ra() {
      u.value.stacked = !u.value.stacked;
    }
    function ua() {
      u.value.showTooltip = !u.value.showTooltip;
    }
    const ge = d(!1);
    function $e() {
      ge.value = !ge.value;
    }
    async function Ba({ scale: e = 2 } = {}) {
      if (!P.value) return;
      const { width: l, height: o } = P.value.getBoundingClientRect(), n = l / o, { imageUri: i, base64: b } = await Cl({ domElement: P.value, base64: !0, img: !0, scale: e });
      return {
        imageUri: i,
        base64: b,
        title: a.value.style.chart.title.text,
        width: l,
        height: o,
        aspectRatio: n
      };
    }
    return ya({
      getData: Xa,
      getImage: Ba,
      generateCsv: la,
      generatePdf: _e,
      generateImage: Ve,
      toggleTable: ta,
      toggleLabels: oa,
      toggleStack: ra,
      toggleTooltip: ua,
      toggleAnnotator: $e,
      toggleFullscreen: Ge
    }), (e, l) => (S(), ne("div", {
      style: ee(`width:100%; position:relative; ${a.value.responsive ? "height: 100%" : ""}`),
      ref_key: "xy",
      ref: P,
      id: `xy_canvas_${be.value}`,
      class: Za(`vue-ui-donut ${he.value ? "vue-data-ui-wrapper-fullscreen" : ""}`),
      onMouseenter: l[5] || (l[5] = () => p(He)(!0)),
      onMouseleave: l[6] || (l[6] = () => p(He)(!1))
    }, [
      a.value.style.chart.title.text ? (S(), ne("div", {
        key: 0,
        ref_key: "chartTitle",
        ref: Fe,
        style: ee(`width:100%;background:${a.value.style.chart.backgroundColor};`)
      }, [
        (S(), N(xl, {
          key: `title_${Le.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)) : X("", !0),
      a.value.userOptions.show && we.value && (p(Ye) || p(Se)) ? (S(), N(p(La), {
        ref: "details",
        key: `user_option_${Ee.value}`,
        backgroundColor: a.value.style.chart.backgroundColor,
        color: a.value.style.chart.color,
        isPrinting: p(Xe),
        isImaging: p(Be),
        uid: be.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: Oe.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: he.value,
        isTooltip: u.value.showTooltip,
        isStacked: u.value.stacked,
        titles: { ...a.value.userOptions.buttonTitles },
        chartElement: P.value,
        position: a.value.userOptions.position,
        hasAnnotator: a.value.userOptions.buttons.annotator,
        isAnnotation: ge.value,
        callbacks: a.value.userOptions.callbacks,
        printScale: a.value.userOptions.print.scale,
        onToggleFullscreen: Ge,
        onGeneratePdf: p(_e),
        onGenerateCsv: la,
        onGenerateImage: p(Ve),
        onToggleTable: ta,
        onToggleLabels: oa,
        onToggleStack: ra,
        onToggleTooltip: ua,
        onToggleAnnotator: $e,
        style: ee({
          visibility: p(Ye) ? p(Se) ? "visible" : "hidden" : "visible"
        })
      }, ja({ _: 2 }, [
        e.$slots.menuIcon ? {
          name: "menuIcon",
          fn: x(({ isOpen: o, color: n }) => [
            k(e.$slots, "menuIcon", B(_({ isOpen: o, color: n })), void 0, !0)
          ]),
          key: "0"
        } : void 0,
        e.$slots.optionTooltip ? {
          name: "optionTooltip",
          fn: x(() => [
            k(e.$slots, "optionTooltip", {}, void 0, !0)
          ]),
          key: "1"
        } : void 0,
        e.$slots.optionPdf ? {
          name: "optionPdf",
          fn: x(() => [
            k(e.$slots, "optionPdf", {}, void 0, !0)
          ]),
          key: "2"
        } : void 0,
        e.$slots.optionCsv ? {
          name: "optionCsv",
          fn: x(() => [
            k(e.$slots, "optionCsv", {}, void 0, !0)
          ]),
          key: "3"
        } : void 0,
        e.$slots.optionImg ? {
          name: "optionImg",
          fn: x(() => [
            k(e.$slots, "optionImg", {}, void 0, !0)
          ]),
          key: "4"
        } : void 0,
        e.$slots.optionTable ? {
          name: "optionTable",
          fn: x(() => [
            k(e.$slots, "optionTable", {}, void 0, !0)
          ]),
          key: "5"
        } : void 0,
        e.$slots.optionLabels ? {
          name: "optionLabels",
          fn: x(() => [
            k(e.$slots, "optionLabels", {}, void 0, !0)
          ]),
          key: "6"
        } : void 0,
        e.$slots.optionStack ? {
          name: "optionStack",
          fn: x(() => [
            k(e.$slots, "optionStack", {}, void 0, !0)
          ]),
          key: "7"
        } : void 0,
        e.$slots.optionFullscreen ? {
          name: "optionFullscreen",
          fn: x(({ toggleFullscreen: o, isFullscreen: n }) => [
            k(e.$slots, "optionFullscreen", B(_({ toggleFullscreen: o, isFullscreen: n })), void 0, !0)
          ]),
          key: "8"
        } : void 0,
        e.$slots.optionAnnotator ? {
          name: "optionAnnotator",
          fn: x(({ toggleAnnotator: o, isAnnotator: n }) => [
            k(e.$slots, "optionAnnotator", B(_({ toggleAnnotator: o, isAnnotator: n })), void 0, !0)
          ]),
          key: "9"
        } : void 0
      ]), 1032, ["backgroundColor", "color", "isPrinting", "isImaging", "uid", "hasTooltip", "hasPdf", "hasImg", "hasXls", "hasLabel", "hasStack", "hasFullscreen", "hasTable", "isFullscreen", "isTooltip", "isStacked", "titles", "chartElement", "position", "hasAnnotator", "isAnnotation", "callbacks", "printScale", "onGeneratePdf", "onGenerateImage", "style"])) : X("", !0),
      ie("div", {
        class: "vue-ui-xy-canvas",
        style: ee(`position: relative; aspect-ratio: ${We.value}`),
        ref_key: "container",
        ref: te
      }, [
        we.value ? (S(), ne("canvas", {
          key: 0,
          ref_key: "canvas",
          ref: T,
          style: { width: "100%", height: "100%" },
          onMousemove: l[0] || (l[0] = (o) => Ya(o)),
          onMouseleave: Ua
        }, null, 544)) : (S(), N(p(ba), {
          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"])),
        qa(p(xa), {
          show: u.value.showTooltip && ce.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: p(T),
          content: de.value,
          isFullscreen: he.value,
          backgroundOpacity: a.value.style.chart.tooltip.backgroundOpacity,
          isCustom: p(va)(a.value.style.chart.tooltip.customFormat)
        }, {
          "tooltip-before": x(() => [
            k(e.$slots, "tooltip-before", B(_({ ...Re.value })), void 0, !0)
          ]),
          "tooltip-after": x(() => [
            k(e.$slots, "tooltip-after", B(_({ ...Re.value })), void 0, !0)
          ]),
          _: 3
        }, 8, ["show", "backgroundColor", "color", "fontSize", "borderRadius", "borderColor", "borderWidth", "position", "offsetY", "parent", "content", "isFullscreen", "backgroundOpacity", "isCustom"])
      ], 4),
      ie("div", {
        ref_key: "chartSlicer",
        ref: De,
        style: ee(`width:100%;background:${a.value.style.chart.backgroundColor}`),
        "data-dom-to-png-ignore": ""
      }, [
        a.value.style.chart.zoom.show && I.value > 1 ? (S(), N(Ll, {
          ref_key: "slicerComponent",
          ref: q,
          key: `slicer_${Pe.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] ? Y.value[r.value.start].text : "",
          labelRight: a.value.style.chart.grid.y.timeLabels.values[r.value.end - 1] ? Y.value[r.value.end - 1].text : "",
          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": l[1] || (l[1] = (o) => r.value.start = o),
          end: r.value.end,
          "onUpdate:end": l[2] || (l[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: qe
        }, {
          "reset-action": x(({ reset: o }) => [
            k(e.$slots, "reset-action", B(_({ 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"])) : X("", !0)
      ], 4),
      ie("div", {
        ref_key: "chartLegend",
        ref: Ae
      }, [
        a.value.style.chart.legend.show && we.value ? (S(), N(bl, {
          legendSet: ea.value,
          config: Wa.value,
          key: `legend_${Ce.value}`,
          onClickMarker: l[3] || (l[3] = ({ i: o }) => Qe(o))
        }, {
          item: x(({ legend: o, index: n }) => [
            ie("div", {
              onClick: (i) => o.segregate(),
              style: ee(`opacity:${$.value.includes(n) ? 0.5 : 1}`)
            }, na(o.name), 13, zl)
          ]),
          _: 1
        }, 8, ["legendSet", "config"])) : k(e.$slots, "legend", {
          key: 1,
          legend: ea.value
        }, void 0, !0)
      ], 512),
      e.$slots.watermark ? (S(), ne("div", $l, [
        k(e.$slots, "watermark", B(_({ isPrinting: p(Xe) || p(Be) })), void 0, !0)
      ])) : X("", !0),
      e.$slots.source ? (S(), ne("div", {
        key: 3,
        ref_key: "source",
        ref: Ne,
        dir: "auto"
      }, [
        k(e.$slots, "source", {}, void 0, !0)
      ], 512)) : X("", !0),
      r.value.end - r.value.start < 200 ? (S(), N(p(ga), {
        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: x(() => [
          (S(), N(p(pa), {
            key: `table_${ke.value}`,
            colNames: fe.value.colNames,
            head: fe.value.head,
            body: fe.value.body,
            config: fe.value.config,
            title: `${a.value.style.chart.title.text}${a.value.style.chart.title.subtitle.text ? ` : ${a.value.style.chart.title.subtitle.text}` : ""}`,
            onClose: l[4] || (l[4] = (o) => u.value.showTable = !1)
          }, {
            th: x(({ th: o }) => [
              ie("div", { innerHTML: o }, null, 8, Il)
            ]),
            td: x(({ td: o }) => [
              Ja(na(o), 1)
            ]),
            _: 1
          }, 8, ["colNames", "head", "body", "config", "title"]))
        ]),
        _: 1
      }, 8, ["config"])) : X("", !0),
      a.value.userOptions.buttons.annotator && h.value.length ? (S(), N(p(ma), {
        key: 5,
        parent: P.value,
        backgroundColor: a.value.style.chart.backgroundColor,
        color: a.value.style.chart.color,
        active: ge.value,
        onClose: $e
      }, null, 8, ["parent", "backgroundColor", "color", "active"])) : X("", !0)
    ], 46, Sl));
  }
}, Xl = /* @__PURE__ */ wl(Ml, [["__scopeId", "data-v-8ed41bd5"]]);
export {
  Xl as default
};