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