import { ref as c, computed as d, onMounted as Ye, onBeforeUnmount as je, watch as Be, openBlock as s, createElementBlock as r, normalizeClass as I, normalizeStyle as A, renderSlot as x, createBlock as S, createCommentVNode as v, unref as p, createSlots as We, withCtx as m, normalizeProps as Y, guardReactiveProps as j, createVNode as me, Fragment as b, renderList as k, createElementVNode as T, toDisplayString as L, createTextVNode as Ge, nextTick as He } from "vue";
import { u as Ee, c as ge, o as Ue, e as be, g as Re, b as Ve, d as qe, p as E, D as ke, i as F, f as O, X as Ze, l as Je, h as Ke, G as Qe, t as et, a as tt, C as U, x as lt, q as at, r as st, F as N } from "./index-Cm2_6s9o.js";
import { u as we } from "./useNestedProp-BYPZJNhi.js";
import { u as ot, U as rt } from "./usePrinter-Cx8U1e30.js";
import { _ as nt } from "./PackageVersion-CTMY4zeY.js";
import { L as ut } from "./Legend-DRozxv9L.js";
import { _ as it } from "./Title-Coit3NcT.js";
import { _ as ct } from "./Tooltip-BBgfUr4a.js";
import { D as vt } from "./DataTable-NGi-FgLM.js";
import ht from "./vue-ui-accordion-CxrNF8BI.js";
import { P as yt } from "./PenAndPaper-DJ_d10S-.js";
import dt from "./vue-ui-skeleton-BUS6A44x.js";
import { t as ft, u as xt } from "./useResponsive-CoxXLe23.js";
import { _ as pt } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const mt = ["id"], gt = ["xmlns", "viewBox"], bt = { key: 0 }, kt = ["id"], wt = ["stop-color"], Ct = ["stop-color"], _t = ["stop-color"], $t = { key: 1 }, Mt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], At = { key: 2 }, Tt = ["x", "y", "fill", "font-size"], Lt = ["transform", "font-size", "fill", "font-weight"], zt = { key: 4 }, St = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Nt = { key: 5 }, Pt = ["transform", "fill", "font-size", "text-anchor"], It = ["x", "y", "font-size", "fill", "font-weight"], Ft = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Ot = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Xt = ["d", "stroke", "stroke-width"], Dt = ["d", "stroke", "stroke-width"], Yt = ["cx", "cy", "fill", "r"], jt = ["cx", "cy", "fill", "r", "stroke", "stroke-width"], Bt = { key: 1 }, Wt = ["x", "y", "font-size", "fill", "font-weight"], Gt = { key: 2 }, Ht = ["x", "y", "font-size", "font-weight", "fill"], Et = ["cx", "cy", "r", "onMouseenter", "onClick"], Ut = {
  key: 5,
  class: "vue-data-ui-watermark"
}, Rt = ["onClick"], Vt = ["innerHTML"], qt = {
  __name: "vue-ui-history-plot",
  props: {
    config: {
      type: Object,
      default() {
        return {};
      }
    },
    dataset: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  emits: ["selectLegend", "selectDatapoint"],
  setup(Ce, { expose: _e, emit: J }) {
    const h = Ce, { vue_ui_history_plot: $e } = Ee(), P = c(null), K = c(null), Q = c(0), ee = c(null), te = c(0), le = c(0), ae = c(0), B = c(null), se = c(null), X = c(ge()), R = c(!1), V = c(""), g = c([]), W = c(!1), _ = c(null), D = c(!1), oe = c(null), w = d({
      get: () => !!h.dataset && h.dataset.length,
      set: (t) => t
    });
    Ye(re), je(() => {
      B.value && B.value.disconnect();
    });
    function re() {
      if (Ue(h.dataset) ? be({
        componentName: "VueUiHistoryPlot",
        type: "dataset"
      }) : h.dataset.forEach((t, a) => {
        Re({
          datasetObject: t,
          requiredAttributes: ["name", "values"]
        }).forEach((l) => {
          w.value = !1, be({
            componentName: "VueUiHistoryPlot",
            type: "datasetSerieAttribute",
            property: l,
            index: a
          });
        });
      }), e.value.responsive) {
        const t = ft(() => {
          const { width: a, height: l } = xt({
            chart: P.value,
            title: e.value.style.chart.title.text ? K.value : null,
            noTitle: se.value,
            legend: e.value.style.chart.legend.show ? ee.value : null,
            source: oe.value
          });
          y.value.width = a, y.value.height = l, n.value.plots = N({
            relator: Math.min(a, l),
            adjuster: 600,
            source: e.value.style.chart.plots.radius,
            threshold: 3,
            fallback: 3
          }), n.value.indexLabels = N({
            relator: Math.min(a, l),
            adjuster: 600,
            source: e.value.style.chart.plots.indexLabels.fontSize,
            threshold: 6,
            fallback: 6
          }), n.value.labels = N({
            relator: Math.min(a, l),
            adjuster: 600,
            source: e.value.style.chart.plots.labels.fontSize,
            threshold: 6,
            fallback: 6
          }), n.value.xAxisLabels = N({
            relator: Math.min(a, l),
            adjuster: 600,
            source: e.value.style.chart.axes.x.labels.fontSize,
            threshold: 6,
            fallback: 6
          }), n.value.xAxisName = N({
            relator: Math.min(a, l),
            adjuster: 600,
            source: e.value.style.chart.axes.x.name.fontSize,
            threshold: 6,
            fallback: 6
          }), n.value.yAxisLabels = N({
            relator: Math.min(a, l),
            adjuster: 600,
            source: e.value.style.chart.axes.y.labels.fontSize,
            threshold: 6,
            fallback: 6
          }), n.value.yAxisName = N({
            relator: Math.min(a, l),
            adjuster: 600,
            source: e.value.style.chart.axes.y.name.fontSize,
            threshold: 6,
            fallback: 6
          });
        });
        B.value = new ResizeObserver(t), B.value.observe(P.value.parentNode);
      }
    }
    function ne() {
      const t = we({
        userConfig: h.config,
        defaultConfig: $e
      });
      let a = {};
      return t.theme ? a = {
        ...we({
          userConfig: et.vue_ui_history_plot[t.theme] || h.config,
          defaultConfig: t
        }),
        customPalette: tt[t.theme] || E
      } : a = t, h.config && U(h.config, "style.chart.axes.x.scaleMin") ? a.style.chart.axes.x.scaleMin = h.config.style.chart.axes.x.scaleMin : a.style.chart.axes.x.scaleMin = null, h.config && U(h.config, "style.chart.axes.x.scaleMax") ? a.style.chart.axes.x.scaleMax = h.config.style.chart.axes.x.scaleMax : a.style.chart.axes.x.scaleMax = null, h.config && U(h.config, "style.chart.axes.y.scaleMin") ? a.style.chart.axes.y.scaleMin = h.config.style.chart.axes.y.scaleMin : a.style.chart.axes.y.scaleMin = null, h.config && U(h.config, "style.chart.axes.y.scaleMax") ? a.style.chart.axes.y.scaleMax = h.config.style.chart.axes.y.scaleMax : a.style.chart.axes.y.scaleMax = null, a;
    }
    const e = d({
      get: () => ne(),
      set: (t) => t
    });
    Be(() => h.config, (t) => {
      e.value = ne(), re(), Q.value += 1, le.value += 1, te.value += 1, y.value.height = e.value.style.chart.height, y.value.width = e.value.style.chart.width, n.value.plots = e.value.style.chart.plots.radius, n.value.indexLabels = e.value.style.chart.plots.indexLabels.fontSize, n.value.labels = e.value.style.chart.plots.labels.fontSize, n.value.xAxisLabels = e.value.style.chart.axes.x.labels.fontSize, n.value.xAxisName = e.value.style.chart.axes.x.name.fontSize, n.value.yAxisLabels = e.value.style.chart.axes.y.labels.fontSize, n.value.yAxisName = e.value.style.chart.axes.y.name.fontSize;
    }, { deep: !0 });
    const { isPrinting: ue, isImaging: ie, generatePdf: ce, generateImage: ve } = ot({
      elementId: `history_plot_${X.value}`,
      fileName: e.value.style.chart.title.text || "vue-ui-history-plot"
    }), Me = d(() => e.value.userOptions.show && !e.value.style.chart.title.text), Ae = d(() => Ve(e.value.customPalette)), $ = c({
      showTable: e.value.table.show,
      showTooltip: e.value.style.chart.tooltip.show
    }), y = c({
      height: e.value.style.chart.height,
      width: e.value.style.chart.width
    }), u = d(() => {
      const t = e.value.style.chart.padding.left, a = e.value.style.chart.padding.top;
      return {
        left: t,
        top: a,
        right: y.value.width - e.value.style.chart.padding.right,
        bottom: y.value.height - e.value.style.chart.padding.bottom,
        width: y.value.width - t - e.value.style.chart.padding.right,
        height: y.value.height - a - e.value.style.chart.padding.bottom
      };
    }), n = c({
      plots: e.value.style.chart.plots.radius,
      indexLabels: e.value.style.chart.plots.indexLabels.fontSize,
      labels: e.value.style.chart.plots.labels.fontSize,
      xAxisLabels: e.value.style.chart.axes.x.labels.fontSize,
      xAxisName: e.value.style.chart.axes.x.name.fontSize,
      yAxisLabels: e.value.style.chart.axes.y.labels.fontSize,
      yAxisName: e.value.style.chart.axes.y.name.fontSize
    }), M = d(() => w.value ? h.dataset.map((t, a) => ({
      ...t,
      color: t.color ? qe(t.color) : Ae.value[a] || E[a] || E[a % E.length],
      seriesIndex: a
    })) : []), Te = d(() => w.value ? Math.max(...M.value.filter((t) => !g.value.includes(t.seriesIndex)).flatMap((t) => t.values.map((a) => a.x))) : 1), Le = d(() => {
      if (!w.value) return 1;
      const t = Math.min(...M.value.filter((a) => !g.value.includes(a.seriesIndex)).flatMap((a) => a.values.map((l) => l.x)));
      return t < 0 ? t : 0;
    }), ze = d(() => w.value ? Math.max(...M.value.filter((t) => !g.value.includes(t.seriesIndex)).flatMap((t) => t.values.map((a) => a.y))) : 1), Se = d(() => {
      if (!w.value) return 1;
      const t = Math.min(...M.value.filter((a) => !g.value.includes(a.seriesIndex)).flatMap((a) => a.values.map((l) => l.y)));
      return t < 0 ? t : 0;
    }), f = d(() => {
      const t = ke(
        e.value.style.chart.axes.x.scaleMin === null ? Le.value : e.value.style.chart.axes.x.scaleMin,
        e.value.style.chart.axes.x.scaleMax === null ? Te.value : e.value.style.chart.axes.x.scaleMax,
        e.value.style.chart.axes.x.ticks
      ), a = ke(
        e.value.style.chart.axes.y.scaleMin === null ? Se.value : e.value.style.chart.axes.y.scaleMin,
        e.value.style.chart.axes.y.scaleMax === null ? ze.value : e.value.style.chart.axes.y.scaleMax,
        e.value.style.chart.axes.y.ticks
      );
      return {
        x: t,
        y: a,
        tickX: t.ticks.map((l) => ({
          x: u.value.left + (l - t.min) / (t.max - t.min) * u.value.width,
          y1: u.value.top,
          y2: u.value.bottom,
          value: l
        })),
        tickY: a.ticks.map((l) => ({
          y: u.value.bottom - (l - a.min) / (a.max - a.min) * u.value.height,
          x1: u.value.left,
          x2: u.value.right,
          value: l
        }))
      };
    });
    function Ne(t) {
      const a = f.value.x.min < 0 ? Math.abs(f.value.x.min) : f.value.x.min > 0 ? -f.value.x.min : 0;
      return u.value.left + ((t || 0) + a) / (f.value.x.max + a) * u.value.width;
    }
    function Pe(t) {
      const a = f.value.y.min < 0 ? Math.abs(f.value.y.min) : f.value.y.min > 0 ? -f.value.y.min : 0;
      return u.value.bottom - ((t || 0) + a) / (f.value.y.max + a) * u.value.height;
    }
    const z = d(() => M.value.filter((t) => !g.value.includes(t.seriesIndex)).map((t, a) => {
      const l = t.values.map((o, C) => ({
        valueX: o.x,
        valueY: o.y,
        label: o.label,
        x: Ne(o.x),
        y: Pe(o.y),
        color: t.color,
        seriesName: t.name,
        id: ge()
      })), i = l.map((o) => `${o.x},${o.y} `).join("").trim();
      return {
        ...t,
        plots: l,
        path: `M${i}`
      };
    }));
    function he(t) {
      g.value.includes(t) ? g.value = g.value.filter((a) => a !== t) : g.value.push(t);
    }
    const ye = d(() => M.value.map((t) => ({
      ...t,
      opacity: g.value.includes(t.seriesIndex) ? 0.5 : 1,
      segregate: () => he(t.seriesIndex),
      isSegregated: g.value.includes(t.seriesIndex),
      shape: "circle"
    }))), Ie = d(() => ({
      cy: "history-plot-div-legend",
      backgroundColor: e.value.style.chart.legend.backgroundColor,
      color: e.value.style.chart.legend.color,
      fontSize: e.value.style.chart.legend.fontSize,
      paddingBottom: 12,
      fontWeight: e.value.style.chart.legend.bold ? "bold" : ""
    }));
    function Fe(t) {
      J("selectDatapoint", t);
    }
    function de(t) {
      J("selectLegend", {
        ...t,
        isSegregated: !t.isSegregated,
        opacity: t.isSegregated ? 1 : 0.5
      });
    }
    function Oe(t) {
      W.value = t, ae.value += 1;
    }
    const q = c(null);
    function Xe({ datapoint: t, plotIndex: a, seriesIndex: l }) {
      q.value = { datapoint: t, seriesIndex: l, plotIndex: a, config: e.value, series: M.value }, _.value = t;
      const i = e.value.style.chart.tooltip.customFormat;
      if (D.value = !1, lt(i))
        try {
          const o = i({
            seriesIndex: l,
            datapoint: t,
            plotIndex: a,
            series: M.value,
            config: e.value
          });
          typeof o == "string" && (V.value = o, D.value = !0);
        } catch {
          console.warn("Custom format cannot be applied."), D.value = !1;
        }
      if (!D.value) {
        let o = "";
        o += `<div style="display:flex;flex-direction:row;gap:6px;align-items:center;border-bottom:1px solid ${e.value.style.chart.tooltip.borderColor};margin-bottom:3px;padding-bottom:6px;"><svg viewBox="0 0 12 12" height="14" width="14"><circle cx="6" cy="6" r="6" stroke="none" fill="${t.color}"/></svg><span>${t.seriesName}</span></div>`, o += `<div>${t.label}</div>`, o += `<div>${e.value.style.chart.axes.x.name.text || "x"}: ${F(
          e.value.style.chart.axes.x.labels.formatter,
          t.valueX,
          O({
            p: e.value.style.chart.axes.x.labels.prefix,
            v: t.valueX,
            s: e.value.style.chart.axes.x.labels.suffix,
            r: e.value.style.chart.axes.x.labels.rounding
          })
        )}</div>`, o += `<div>${e.value.style.chart.axes.y.name.text || "y"}: ${F(
          e.value.style.chart.axes.y.labels.formatter,
          t.valueY,
          O({
            p: e.value.style.chart.axes.y.labels.prefix,
            v: t.valueY,
            s: e.value.style.chart.axes.y.labels.suffix,
            r: e.value.style.chart.axes.y.labels.rounding
          })
        )}</div>`, V.value = `<div>${o}</div>`;
      }
      R.value = !0;
    }
    d(() => ({ head: z.value.map((a) => ({
      name: a.name,
      color: a.color
    })) }));
    const G = d(() => {
      const t = [
        e.value.table.columnNames.series,
        e.value.table.columnNames.datapoint,
        e.value.table.columnNames.x,
        e.value.table.columnNames.y
      ], a = z.value.flatMap((i) => i.plots.map((o) => [
        {
          color: o.color,
          name: o.seriesName
        },
        o.label,
        F(
          e.value.style.chart.axes.x.labels.formatter,
          o.valueX,
          O({
            p: e.value.style.chart.axes.x.labels.prefix,
            v: o.valueX,
            s: e.value.style.chart.axes.x.labels.suffix,
            r: e.value.style.chart.axes.x.labels.rounding
          })
        ),
        F(
          e.value.style.chart.axes.y.labels.formatter,
          o.valueY,
          O({
            p: e.value.style.chart.axes.y.labels.prefix,
            v: o.valueY,
            s: e.value.style.chart.axes.y.labels.suffix,
            r: e.value.style.chart.axes.y.labels.rounding
          })
        )
      ])), l = {
        th: {
          backgroundColor: e.value.table.th.backgroundColor,
          color: e.value.table.th.color,
          outline: e.value.table.th.outline
        },
        td: {
          backgroundColor: e.value.table.td.backgroundColor,
          color: e.value.table.td.color,
          outline: e.value.table.td.outline
        },
        breakpoint: e.value.table.responsiveBreakpoint
      };
      return {
        head: t,
        body: a,
        config: l,
        colNames: t
      };
    });
    function fe() {
      He(() => {
        const t = [
          [e.value.table.columnNames.series],
          [e.value.table.columnNames.datapoint],
          [e.value.table.columnNames.x],
          [e.value.table.columnNames.y]
        ], a = z.value.flatMap((o) => o.plots.map((C) => [
          [C.seriesName],
          [C.label],
          [C.valueX],
          [C.valueY]
        ])), l = [
          [e.value.style.chart.title.text],
          [e.value.style.chart.title.subtitle.text],
          t
        ].concat(a), i = at(l);
        st({
          csvContent: i,
          title: e.value.style.chart.title.text || "vue-ui-history-plot"
        });
      });
    }
    const H = c(!1);
    function Z() {
      H.value = !H.value;
    }
    function xe() {
      $.value.showTable = !$.value.showTable;
    }
    function pe() {
      $.value.showTooltip = !$.value.showTooltip;
    }
    function De() {
      return z.value;
    }
    return _e({
      getData: De,
      generatePdf: ce,
      generateCsv: fe,
      generateImage: ve,
      toggleTable: xe,
      toggleTooltip: pe,
      toggleAnnotator: Z
    }), (t, a) => (s(), r("div", {
      id: `history_plot_${X.value}`,
      ref_key: "historyPlotChart",
      ref: P,
      class: I({ "vue-ui-history-plot": !0, "vue-data-ui-wrapper-fullscreen": W.value }),
      style: A(`background:${e.value.style.chart.backgroundColor};color:${e.value.style.chart.color};font-family:${e.value.style.fontFamily}; position: relative; ${e.value.responsive ? "height: 100%" : ""}`)
    }, [
      x(t.$slots, "userConfig", {}, void 0, !0),
      e.value.userOptions.buttons.annotator ? (s(), S(yt, {
        key: 0,
        parent: P.value,
        backgroundColor: e.value.style.chart.backgroundColor,
        color: e.value.style.chart.color,
        active: H.value,
        onClose: Z
      }, null, 8, ["parent", "backgroundColor", "color", "active"])) : v("", !0),
      Me.value ? (s(), r("div", {
        key: 1,
        ref_key: "noTitle",
        ref: se,
        class: "vue-data-ui-no-title-space",
        style: "height:36px; width: 100%;background:transparent"
      }, null, 512)) : v("", !0),
      e.value.style.chart.title.text ? (s(), r("div", {
        key: 2,
        ref_key: "chartTitle",
        ref: K,
        class: "vue-ui-xy-title",
        style: A(`font-family:${e.value.style.fontFamily}`)
      }, [
        (s(), S(it, {
          key: `title_${Q.value}`,
          config: {
            title: {
              cy: "history-plot-div-title",
              ...e.value.style.chart.title
            },
            subtitle: {
              cy: "history-plot-div-subtitle",
              ...e.value.style.chart.title.subtitle
            }
          }
        }, null, 8, ["config"]))
      ], 4)) : v("", !0),
      e.value.userOptions.show && w.value ? (s(), S(rt, {
        ref: "details",
        key: `user_option_${ae.value}`,
        backgroundColor: e.value.style.chart.backgroundColor,
        color: e.value.style.chart.color,
        isPrinting: p(ue),
        isImaging: p(ie),
        uid: X.value,
        hasTooltip: e.value.style.chart.tooltip.show && e.value.userOptions.buttons.tooltip,
        hasPdf: e.value.userOptions.buttons.pdf,
        hasImg: e.value.userOptions.buttons.img,
        hasXls: e.value.userOptions.buttons.csv,
        hasTable: e.value.userOptions.buttons.table,
        hasLabel: !1,
        hasFullscreen: e.value.userOptions.buttons.fullscreen,
        isFullscreen: W.value,
        chartElement: P.value,
        position: e.value.userOptions.position,
        isTooltip: $.value.showTooltip,
        titles: { ...e.value.userOptions.buttonTitles },
        hasAnnotator: e.value.userOptions.buttons.annotator,
        isAnnotation: H.value,
        onToggleFullscreen: Oe,
        onGeneratePdf: p(ce),
        onGenerateCsv: fe,
        onGenerateImage: p(ve),
        onToggleTable: xe,
        onToggleTooltip: pe,
        onToggleAnnotator: Z
      }, We({ _: 2 }, [
        t.$slots.optionTooltip ? {
          name: "optionTooltip",
          fn: m(() => [
            x(t.$slots, "optionTooltip", {}, void 0, !0)
          ]),
          key: "0"
        } : void 0,
        t.$slots.optionPdf ? {
          name: "optionPdf",
          fn: m(() => [
            x(t.$slots, "optionPdf", {}, void 0, !0)
          ]),
          key: "1"
        } : void 0,
        t.$slots.optionCsv ? {
          name: "optionCsv",
          fn: m(() => [
            x(t.$slots, "optionCsv", {}, void 0, !0)
          ]),
          key: "2"
        } : void 0,
        t.$slots.optionImg ? {
          name: "optionImg",
          fn: m(() => [
            x(t.$slots, "optionImg", {}, void 0, !0)
          ]),
          key: "3"
        } : void 0,
        t.$slots.optionTable ? {
          name: "optionTable",
          fn: m(() => [
            x(t.$slots, "optionTable", {}, void 0, !0)
          ]),
          key: "4"
        } : void 0,
        t.$slots.optionFullscreen ? {
          name: "optionFullscreen",
          fn: m(({ toggleFullscreen: l, isFullscreen: i }) => [
            x(t.$slots, "optionFullscreen", Y(j({ toggleFullscreen: l, isFullscreen: i })), void 0, !0)
          ]),
          key: "5"
        } : void 0,
        t.$slots.optionAnnotator ? {
          name: "optionAnnotator",
          fn: m(({ toggleAnnotator: l, isAnnotator: i }) => [
            x(t.$slots, "optionAnnotator", Y(j({ toggleAnnotator: l, isAnnotator: i })), void 0, !0)
          ]),
          key: "6"
        } : void 0
      ]), 1032, ["backgroundColor", "color", "isPrinting", "isImaging", "uid", "hasTooltip", "hasPdf", "hasImg", "hasXls", "hasTable", "hasFullscreen", "isFullscreen", "chartElement", "position", "isTooltip", "titles", "hasAnnotator", "isAnnotation", "onGeneratePdf", "onGenerateImage"])) : v("", !0),
      w.value ? (s(), r("svg", {
        key: 4,
        xmlns: p(Ze),
        viewBox: `0 0 ${y.value.width < 0 ? 0.1 : y.value.width} ${y.value.height < 0 ? 0.1 : y.value.height}`,
        style: A(`max-width:100%;overflow:visible;background:transparent;color:${e.value.style.chart.color}`)
      }, [
        me(nt),
        e.value.style.chart.plots.gradient.show ? (s(), r("defs", bt, [
          (s(!0), r(b, null, k(z.value, (l, i) => (s(), r("radialGradient", {
            id: `gradient_${i}_${X.value}`,
            fy: "30%"
          }, [
            T("stop", {
              offset: "10%",
              "stop-color": p(Je)(l.color, e.value.style.chart.plots.gradient.intensity / 100)
            }, null, 8, wt),
            T("stop", {
              offset: "90%",
              "stop-color": p(Ke)(l.color, 0.1)
            }, null, 8, Ct),
            T("stop", {
              offset: "100%",
              "stop-color": l.color
            }, null, 8, _t)
          ], 8, kt))), 256))
        ])) : v("", !0),
        e.value.style.chart.grid.verticalLines.show ? (s(), r("g", $t, [
          (s(!0), r(b, null, k(f.value.tickX, (l) => (s(), r("line", {
            x1: l.x,
            x2: l.x,
            y1: l.y1,
            y2: l.y2,
            stroke: e.value.style.chart.grid.verticalLines.stroke,
            "stroke-width": e.value.style.chart.grid.verticalLines.strokeWidth,
            "stroke-linecap": "round"
          }, null, 8, Mt))), 256))
        ])) : v("", !0),
        e.value.style.chart.axes.y.labels.show ? (s(), r("g", At, [
          (s(!0), r(b, null, k(f.value.tickY, (l) => (s(), r("text", {
            x: u.value.left + e.value.style.chart.axes.y.labels.offsetX - 4,
            y: l.y + n.value.yAxisLabels / 3,
            fill: e.value.style.chart.axes.y.labels.color,
            "font-size": n.value.yAxisLabels,
            "text-anchor": "end"
          }, L(p(F)(
            e.value.style.chart.axes.y.labels.formatter,
            l.value,
            p(O)({
              p: e.value.style.chart.axes.y.labels.prefix,
              v: l.value,
              s: e.value.style.chart.axes.y.labels.suffix,
              r: e.value.style.chart.axes.y.labels.rounding
            })
          )), 9, Tt))), 256))
        ])) : v("", !0),
        e.value.style.chart.axes.y.name.text ? (s(), r("text", {
          key: 3,
          transform: `translate(${e.value.style.chart.axes.y.name.offsetX + n.value.yAxisName}, ${y.value.height / 2 + e.value.style.chart.axes.y.name.offsetY}), rotate(-90)`,
          "font-size": n.value.yAxisName,
          fill: e.value.style.chart.axes.y.name.color,
          "font-weight": e.value.style.chart.axes.y.name.bold ? "bold" : "normal",
          "text-anchor": "middle"
        }, L(e.value.style.chart.axes.y.name.text), 9, Lt)) : v("", !0),
        e.value.style.chart.grid.horizontalLines.show ? (s(), r("g", zt, [
          (s(!0), r(b, null, k(f.value.tickY, (l) => (s(), r("line", {
            x1: l.x1,
            x2: l.x2,
            y1: l.y,
            y2: l.y,
            stroke: e.value.style.chart.grid.horizontalLines.stroke,
            "stroke-width": e.value.style.chart.grid.horizontalLines.strokeWidth,
            "stroke-linecap": "round"
          }, null, 8, St))), 256))
        ])) : v("", !0),
        e.value.style.chart.axes.x.labels.show ? (s(), r("g", Nt, [
          (s(!0), r(b, null, k(f.value.tickX, (l) => (s(), r("text", {
            transform: `translate(${l.x}, ${u.value.bottom + e.value.style.chart.axes.x.labels.offsetY + n.value.xAxisLabels}), rotate(${e.value.style.chart.axes.x.labels.rotation})`,
            fill: e.value.style.chart.axes.x.labels.color,
            "font-size": n.value.xAxisLabels,
            "text-anchor": e.value.style.chart.axes.x.labels.rotation > 0 ? "start" : e.value.style.chart.axes.x.labels.rotation < 0 ? "end" : "middle"
          }, L(p(F)(
            e.value.style.chart.axes.x.labels.formatter,
            l.value,
            p(O)({
              p: e.value.style.chart.axes.x.labels.prefix,
              v: l.value,
              s: e.value.style.chart.axes.x.labels.suffix,
              r: e.value.style.chart.axes.x.labels.rounding
            })
          )), 9, Pt))), 256))
        ])) : v("", !0),
        e.value.style.chart.axes.x.name.text ? (s(), r("text", {
          key: 6,
          x: y.value.width / 2 + e.value.style.chart.axes.x.name.offsetX,
          y: y.value.height + e.value.style.chart.axes.x.name.offsetY,
          "font-size": n.value.xAxisName,
          fill: e.value.style.chart.axes.x.name.color,
          "font-weight": e.value.style.chart.axes.x.name.bold ? "bold" : "normal",
          "text-anchor": "middle"
        }, L(e.value.style.chart.axes.x.name.text), 9, It)) : v("", !0),
        e.value.style.chart.grid.xAxis.show ? (s(), r("line", {
          key: 7,
          x1: u.value.left,
          x2: u.value.left + u.value.width,
          y1: u.value.bottom,
          y2: u.value.bottom,
          stroke: e.value.style.chart.grid.xAxis.stroke,
          "stroke-width": e.value.style.chart.grid.xAxis.strokeWidth,
          "stroke-linecap": "round"
        }, null, 8, Ft)) : v("", !0),
        e.value.style.chart.grid.yAxis.show ? (s(), r("line", {
          key: 8,
          x1: u.value.left,
          x2: u.value.left,
          y1: u.value.top,
          y2: u.value.bottom,
          stroke: e.value.style.chart.grid.yAxis.stroke,
          "stroke-width": e.value.style.chart.grid.yAxis.strokeWidth,
          "stroke-linecap": "round"
        }, null, 8, Ot)) : v("", !0),
        (s(!0), r(b, null, k(z.value, (l, i) => (s(), r("g", null, [
          e.value.style.chart.paths.show ? (s(), r("g", {
            key: 0,
            style: A({
              opacity: _.value === null ? 1 : 0.3
            })
          }, [
            T("path", {
              d: l.path,
              stroke: e.value.style.chart.backgroundColor,
              "stroke-width": e.value.style.chart.paths.strokeWidth + 4,
              fill: "none",
              "stroke-linecap": "round",
              "stroke-linejoin": "round",
              class: I({ animated: e.value.useCssAnimation })
            }, null, 10, Xt),
            T("path", {
              d: l.path,
              stroke: e.value.style.chart.paths.useSerieColor ? l.color : e.value.style.chart.paths.stroke,
              "stroke-width": e.value.style.chart.paths.strokeWidth,
              fill: "none",
              "stroke-linecap": "round",
              "stroke-linejoin": "round",
              class: I({ animated: e.value.useCssAnimation })
            }, null, 10, Dt)
          ], 4)) : v("", !0),
          (s(!0), r(b, null, k(l.plots, (o) => (s(), r("circle", {
            cx: o.x,
            cy: o.y,
            fill: e.value.style.chart.backgroundColor,
            r: n.value.plots,
            stroke: "none"
          }, null, 8, Yt))), 256)),
          (s(!0), r(b, null, k(l.plots, (o) => (s(), r("circle", {
            cx: o.x,
            cy: o.y,
            fill: e.value.style.chart.plots.gradient.show ? `url(#gradient_${i}_${X.value})` : o.color,
            r: n.value.plots,
            stroke: e.value.style.chart.plots.stroke,
            "stroke-width": e.value.style.chart.plots.strokeWidth,
            class: I({ animated: e.value.useCssAnimation }),
            style: A({
              opacity: _.value === null || _.value.id === o.id ? 1 : 0.3,
              transition: "opacity 0.2s ease-in-out"
            })
          }, null, 14, jt))), 256)),
          e.value.style.chart.plots.labels.show ? (s(), r("g", Bt, [
            (s(!0), r(b, null, k(l.plots, (o) => (s(), r("text", {
              x: o.x + e.value.style.chart.plots.labels.offsetX,
              y: o.y + e.value.style.chart.plots.labels.offsetY + n.value.plots + n.value.labels,
              "font-size": n.value.labels,
              fill: e.value.style.chart.plots.labels.color,
              "font-weight": e.value.style.chart.plots.labels.bold ? "bold" : "normal",
              "text-anchor": "middle",
              class: I({ animated: e.value.useCssAnimation }),
              style: A({
                opacity: _.value === null || _.value.id === o.id ? 1 : 0.3,
                transition: "opacity 0.2s ease-in-out"
              })
            }, L(o.label), 15, Wt))), 256))
          ])) : v("", !0),
          e.value.style.chart.plots.indexLabels.show ? (s(), r("g", Gt, [
            (s(!0), r(b, null, k(l.plots, (o, C) => (s(), r("text", {
              x: o.x + e.value.style.chart.plots.indexLabels.offsetX,
              y: o.y + e.value.style.chart.plots.indexLabels.offsetY + n.value.indexLabels / 3,
              "font-size": n.value.indexLabels,
              "font-weight": e.value.style.chart.plots.indexLabels.bold ? "bold" : "normal",
              fill: e.value.style.chart.plots.indexLabels.adaptColorToBackground ? p(Qe)(l.color) : e.value.style.chart.plots.indexLabels.color,
              "text-anchor": "middle",
              class: I({ animated: e.value.useCssAnimation }),
              style: A({
                opacity: _.value === null || _.value.id === o.id ? 1 : 0.3,
                transition: "opacity 0.2s ease-in-out"
              })
            }, L(e.value.style.chart.plots.indexLabels.startAtZero ? C : C + 1), 15, Ht))), 256))
          ])) : v("", !0)
        ]))), 256)),
        (s(!0), r(b, null, k(z.value, (l) => (s(), r("g", null, [
          (s(!0), r(b, null, k(l.plots, (i, o) => (s(), r("circle", {
            cx: i.x,
            cy: i.y,
            fill: "transparent",
            r: n.value.plots,
            stroke: "none",
            onMouseenter: (C) => Xe({
              datapoint: i,
              plotIndex: o,
              seriesIndex: l.seriesIndex
            }),
            onMouseleave: a[0] || (a[0] = (C) => {
              R.value = !1, _.value = null;
            }),
            onClick: () => Fe(i)
          }, null, 40, Et))), 256))
        ]))), 256)),
        x(t.$slots, "svg", { svg: y.value }, void 0, !0)
      ], 12, gt)) : v("", !0),
      t.$slots.watermark ? (s(), r("div", Ut, [
        x(t.$slots, "watermark", Y(j({ isPrinting: p(ue) || p(ie) })), void 0, !0)
      ])) : v("", !0),
      w.value ? v("", !0) : (s(), S(dt, {
        key: 6,
        config: {
          type: "historyPlot",
          style: {
            backgroundColor: e.value.style.chart.backgroundColor,
            historyPlot: {
              color: "#CCCCCC"
            }
          }
        }
      }, null, 8, ["config"])),
      T("div", {
        ref_key: "chartLegend",
        ref: ee
      }, [
        e.value.style.chart.legend.show && w.value ? (s(), S(ut, {
          key: `legend_${te.value}`,
          legendSet: ye.value,
          config: Ie.value,
          onClickMarker: a[1] || (a[1] = ({ legend: l }) => {
            he(l.seriesIndex), de(l);
          })
        }, {
          item: m(({ legend: l, index: i }) => [
            T("div", {
              onClick: (o) => {
                l.segregate(), de(l);
              },
              style: A(`opacity:${g.value.includes(l.seriesIndex) ? 0.5 : 1}`)
            }, L(l.name), 13, Rt)
          ]),
          _: 1
        }, 8, ["legendSet", "config"])) : x(t.$slots, "legend", {
          key: 1,
          legend: ye.value
        }, void 0, !0)
      ], 512),
      t.$slots.source ? (s(), r("div", {
        key: 7,
        ref_key: "source",
        ref: oe,
        dir: "auto"
      }, [
        x(t.$slots, "source", {}, void 0, !0)
      ], 512)) : v("", !0),
      me(ct, {
        show: $.value.showTooltip && R.value,
        backgroundColor: e.value.style.chart.tooltip.backgroundColor,
        color: e.value.style.chart.tooltip.color,
        fontSize: e.value.style.chart.tooltip.fontSize,
        borderRadius: e.value.style.chart.tooltip.borderRadius,
        borderColor: e.value.style.chart.tooltip.borderColor,
        borderWidth: e.value.style.chart.tooltip.borderWidth,
        backgroundOpacity: e.value.style.chart.tooltip.backgroundOpacity,
        position: e.value.style.chart.tooltip.position,
        offsetY: e.value.style.chart.tooltip.offsetY,
        parent: P.value,
        content: V.value,
        isCustom: D.value,
        isFullscreen: W.value
      }, {
        "tooltip-before": m(() => [
          x(t.$slots, "tooltip-before", Y(j({ ...q.value })), void 0, !0)
        ]),
        "tooltip-after": m(() => [
          x(t.$slots, "tooltip-after", Y(j({ ...q.value })), void 0, !0)
        ]),
        _: 3
      }, 8, ["show", "backgroundColor", "color", "fontSize", "borderRadius", "borderColor", "borderWidth", "backgroundOpacity", "position", "offsetY", "parent", "content", "isCustom", "isFullscreen"]),
      w.value ? (s(), S(ht, {
        key: 8,
        hideDetails: "",
        config: {
          open: $.value.showTable,
          maxHeight: 1e4,
          body: {
            backgroundColor: e.value.style.chart.backgroundColor,
            color: e.value.style.chart.color
          },
          head: {
            backgroundColor: e.value.style.chart.backgroundColor,
            color: e.value.style.chart.color
          }
        }
      }, {
        content: m(() => [
          (s(), S(vt, {
            key: `table_${le.value}`,
            colNames: G.value.colNames,
            head: G.value.head,
            body: G.value.body,
            config: G.value.config,
            title: `${e.value.style.chart.title.text}${e.value.style.chart.title.subtitle.text ? ` : ${e.value.style.chart.title.subtitle.text}` : ""}`,
            onClose: a[2] || (a[2] = (l) => $.value.showTable = !1)
          }, {
            th: m(({ th: l }) => [
              T("div", {
                innerHTML: l,
                style: { display: "flex", "align-items": "center" }
              }, null, 8, Vt)
            ]),
            td: m(({ td: l }) => [
              Ge(L(l.name || l), 1)
            ]),
            _: 1
          }, 8, ["colNames", "head", "body", "config", "title"]))
        ]),
        _: 1
      }, 8, ["config"])) : v("", !0)
    ], 14, mt));
  }
}, cl = /* @__PURE__ */ pt(qt, [["__scopeId", "data-v-dbf9aa14"]]);
export {
  cl as default
};
