import { ref as c, computed as f, onMounted as Ue, onBeforeUnmount as We, watch as Ge, openBlock as s, createElementBlock as r, normalizeClass as I, normalizeStyle as $, unref as y, renderSlot as p, createBlock as z, createCommentVNode as v, createSlots as He, 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 Ee, nextTick as Ve } from "vue";
import { u as Re, c as we, o as qe, e as Ce, g as Ze, b as Je, d as Ke, p as H, D as _e, i as O, f as F, X as Qe, l as et, h as tt, G as lt, t as at, a as st, C as E, x as ot, q as rt, r as nt, F as N } from "./index-BbPeL8Gp.js";
import { u as $e } from "./useNestedProp-BN8claGG.js";
import { u as ut, U as it } from "./usePrinter-DaybDVqP.js";
import { _ as ct } from "./PackageVersion-CxJghxYD.js";
import { L as vt } from "./Legend-BLaZxMge.js";
import { _ as ht } from "./Title-aSAft5dl.js";
import { _ as yt } from "./Tooltip-smutPF--.js";
import { D as dt } from "./DataTable-DGf6RrOJ.js";
import ft from "./vue-ui-accordion-5d5iVpr7.js";
import { P as xt } from "./PenAndPaper-ZdZEumki.js";
import pt from "./vue-ui-skeleton-Bniq21d9.js";
import { t as mt, u as gt } from "./useResponsive-CoxXLe23.js";
import { u as bt } from "./useUserOptionState-BIvW1Kz7.js";
import { _ as kt } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const wt = ["id"], Ct = ["xmlns", "viewBox"], _t = { key: 0 }, $t = ["id"], Mt = ["stop-color"], At = ["stop-color"], Tt = ["stop-color"], Lt = { key: 1 }, St = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], zt = { key: 2 }, Nt = ["x", "y", "fill", "font-size"], Pt = ["transform", "font-size", "fill", "font-weight"], It = { key: 4 }, Ot = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Ft = { key: 5 }, Xt = ["transform", "fill", "font-size", "text-anchor"], Dt = ["x", "y", "font-size", "fill", "font-weight"], Yt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], jt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Bt = ["d", "stroke", "stroke-width"], Ut = ["d", "stroke", "stroke-width"], Wt = ["cx", "cy", "fill", "r"], Gt = ["cx", "cy", "fill", "r", "stroke", "stroke-width"], Ht = { key: 1 }, Et = ["x", "y", "font-size", "fill", "font-weight"], Vt = { key: 2 }, Rt = ["x", "y", "font-size", "font-weight", "fill"], qt = ["cx", "cy", "r", "onMouseenter", "onClick"], Zt = {
  key: 5,
  class: "vue-data-ui-watermark"
}, Jt = ["onClick"], Kt = ["innerHTML"], Qt = {
  __name: "vue-ui-history-plot",
  props: {
    config: {
      type: Object,
      default() {
        return {};
      }
    },
    dataset: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  emits: ["selectLegend", "selectDatapoint"],
  setup(Me, { expose: Ae, emit: J }) {
    const h = Me, { vue_ui_history_plot: Te } = Re(), 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(we()), V = c(!1), R = c(""), g = c([]), U = c(!1), _ = c(null), D = c(!1), oe = c(null), w = f({
      get: () => !!h.dataset && h.dataset.length,
      set: (t) => t
    });
    Ue(re), We(() => {
      B.value && B.value.disconnect();
    });
    function re() {
      if (qe(h.dataset) ? Ce({
        componentName: "VueUiHistoryPlot",
        type: "dataset"
      }) : h.dataset.forEach((t, a) => {
        Ze({
          datasetObject: t,
          requiredAttributes: ["name", "values"]
        }).forEach((l) => {
          w.value = !1, Ce({
            componentName: "VueUiHistoryPlot",
            type: "datasetSerieAttribute",
            property: l,
            index: a
          });
        });
      }), e.value.responsive) {
        const t = mt(() => {
          const { width: a, height: l } = gt({
            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
          });
          d.value.width = a, d.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 = $e({
        userConfig: h.config,
        defaultConfig: Te
      });
      let a = {};
      return t.theme ? a = {
        ...$e({
          userConfig: at.vue_ui_history_plot[t.theme] || h.config,
          defaultConfig: t
        }),
        customPalette: st[t.theme] || H
      } : a = t, h.config && E(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 && E(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 && E(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 && E(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 = f({
      get: () => ne(),
      set: (t) => t
    }), { userOptionsVisible: ue, setUserOptionsVisibility: ie, keepUserOptionState: ce } = bt({ config: e.value });
    Ge(() => h.config, (t) => {
      e.value = ne(), re(), Q.value += 1, le.value += 1, te.value += 1, d.value.height = e.value.style.chart.height, d.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: ve, isImaging: he, generatePdf: ye, generateImage: de } = ut({
      elementId: `history_plot_${X.value}`,
      fileName: e.value.style.chart.title.text || "vue-ui-history-plot"
    }), Le = f(() => e.value.userOptions.show && !e.value.style.chart.title.text), Se = f(() => Je(e.value.customPalette)), M = c({
      showTable: e.value.table.show,
      showTooltip: e.value.style.chart.tooltip.show
    }), d = c({
      height: e.value.style.chart.height,
      width: e.value.style.chart.width
    }), u = f(() => {
      const t = e.value.style.chart.padding.left, a = e.value.style.chart.padding.top;
      return {
        left: t,
        top: a,
        right: d.value.width - e.value.style.chart.padding.right,
        bottom: d.value.height - e.value.style.chart.padding.bottom,
        width: d.value.width - t - e.value.style.chart.padding.right,
        height: d.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
    }), A = f(() => w.value ? h.dataset.map((t, a) => ({
      ...t,
      color: t.color ? Ke(t.color) : Se.value[a] || H[a] || H[a % H.length],
      seriesIndex: a
    })) : []), ze = f(() => w.value ? Math.max(...A.value.filter((t) => !g.value.includes(t.seriesIndex)).flatMap((t) => t.values.map((a) => a.x))) : 1), Ne = f(() => {
      if (!w.value) return 1;
      const t = Math.min(...A.value.filter((a) => !g.value.includes(a.seriesIndex)).flatMap((a) => a.values.map((l) => l.x)));
      return t < 0 ? t : 0;
    }), Pe = f(() => w.value ? Math.max(...A.value.filter((t) => !g.value.includes(t.seriesIndex)).flatMap((t) => t.values.map((a) => a.y))) : 1), Ie = f(() => {
      if (!w.value) return 1;
      const t = Math.min(...A.value.filter((a) => !g.value.includes(a.seriesIndex)).flatMap((a) => a.values.map((l) => l.y)));
      return t < 0 ? t : 0;
    }), x = f(() => {
      const t = _e(
        e.value.style.chart.axes.x.scaleMin === null ? Ne.value : e.value.style.chart.axes.x.scaleMin,
        e.value.style.chart.axes.x.scaleMax === null ? ze.value : e.value.style.chart.axes.x.scaleMax,
        e.value.style.chart.axes.x.ticks
      ), a = _e(
        e.value.style.chart.axes.y.scaleMin === null ? Ie.value : e.value.style.chart.axes.y.scaleMin,
        e.value.style.chart.axes.y.scaleMax === null ? Pe.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 Oe(t) {
      const a = x.value.x.min < 0 ? Math.abs(x.value.x.min) : x.value.x.min > 0 ? -x.value.x.min : 0;
      return u.value.left + ((t || 0) + a) / (x.value.x.max + a) * u.value.width;
    }
    function Fe(t) {
      const a = x.value.y.min < 0 ? Math.abs(x.value.y.min) : x.value.y.min > 0 ? -x.value.y.min : 0;
      return u.value.bottom - ((t || 0) + a) / (x.value.y.max + a) * u.value.height;
    }
    const S = f(() => A.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: Oe(o.x),
        y: Fe(o.y),
        color: t.color,
        seriesName: t.name,
        id: we()
      })), i = l.map((o) => `${o.x},${o.y} `).join("").trim();
      return {
        ...t,
        plots: l,
        path: `M${i}`
      };
    }));
    function fe(t) {
      g.value.includes(t) ? g.value = g.value.filter((a) => a !== t) : g.value.push(t);
    }
    const xe = f(() => A.value.map((t) => ({
      ...t,
      opacity: g.value.includes(t.seriesIndex) ? 0.5 : 1,
      segregate: () => fe(t.seriesIndex),
      isSegregated: g.value.includes(t.seriesIndex),
      shape: "circle"
    }))), Xe = f(() => ({
      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 De(t) {
      J("selectDatapoint", t);
    }
    function pe(t) {
      J("selectLegend", {
        ...t,
        isSegregated: !t.isSegregated,
        opacity: t.isSegregated ? 1 : 0.5
      });
    }
    function Ye(t) {
      U.value = t, ae.value += 1;
    }
    const q = c(null);
    function je({ datapoint: t, plotIndex: a, seriesIndex: l }) {
      q.value = { datapoint: t, seriesIndex: l, plotIndex: a, config: e.value, series: A.value }, _.value = t;
      const i = e.value.style.chart.tooltip.customFormat;
      if (D.value = !1, ot(i))
        try {
          const o = i({
            seriesIndex: l,
            datapoint: t,
            plotIndex: a,
            series: A.value,
            config: e.value
          });
          typeof o == "string" && (R.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"}: ${O(
          e.value.style.chart.axes.x.labels.formatter,
          t.valueX,
          F({
            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"}: ${O(
          e.value.style.chart.axes.y.labels.formatter,
          t.valueY,
          F({
            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>`, R.value = `<div>${o}</div>`;
      }
      V.value = !0;
    }
    f(() => ({ head: S.value.map((a) => ({
      name: a.name,
      color: a.color
    })) }));
    const W = f(() => {
      const t = [
        e.value.table.columnNames.series,
        e.value.table.columnNames.datapoint,
        e.value.table.columnNames.x,
        e.value.table.columnNames.y
      ], a = S.value.flatMap((i) => i.plots.map((o) => [
        {
          color: o.color,
          name: o.seriesName
        },
        o.label,
        O(
          e.value.style.chart.axes.x.labels.formatter,
          o.valueX,
          F({
            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
          })
        ),
        O(
          e.value.style.chart.axes.y.labels.formatter,
          o.valueY,
          F({
            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 me() {
      Ve(() => {
        const t = [
          [e.value.table.columnNames.series],
          [e.value.table.columnNames.datapoint],
          [e.value.table.columnNames.x],
          [e.value.table.columnNames.y]
        ], a = S.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 = rt(l);
        nt({
          csvContent: i,
          title: e.value.style.chart.title.text || "vue-ui-history-plot"
        });
      });
    }
    const G = c(!1);
    function Z() {
      G.value = !G.value;
    }
    function ge() {
      M.value.showTable = !M.value.showTable;
    }
    function be() {
      M.value.showTooltip = !M.value.showTooltip;
    }
    function Be() {
      return S.value;
    }
    return Ae({
      getData: Be,
      generatePdf: ye,
      generateCsv: me,
      generateImage: de,
      toggleTable: ge,
      toggleTooltip: be,
      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": U.value }),
      style: $(`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%" : ""}`),
      onMouseenter: a[3] || (a[3] = () => y(ie)(!0)),
      onMouseleave: a[4] || (a[4] = () => y(ie)(!1))
    }, [
      p(t.$slots, "userConfig", {}, void 0, !0),
      e.value.userOptions.buttons.annotator ? (s(), z(xt, {
        key: 0,
        parent: P.value,
        backgroundColor: e.value.style.chart.backgroundColor,
        color: e.value.style.chart.color,
        active: G.value,
        onClose: Z
      }, null, 8, ["parent", "backgroundColor", "color", "active"])) : v("", !0),
      Le.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: $(`font-family:${e.value.style.fontFamily}`)
      }, [
        (s(), z(ht, {
          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 && (y(ce) || y(ue)) ? (s(), z(it, {
        ref: "details",
        key: `user_option_${ae.value}`,
        backgroundColor: e.value.style.chart.backgroundColor,
        color: e.value.style.chart.color,
        isPrinting: y(ve),
        isImaging: y(he),
        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: U.value,
        chartElement: P.value,
        position: e.value.userOptions.position,
        isTooltip: M.value.showTooltip,
        titles: { ...e.value.userOptions.buttonTitles },
        hasAnnotator: e.value.userOptions.buttons.annotator,
        isAnnotation: G.value,
        onToggleFullscreen: Ye,
        onGeneratePdf: y(ye),
        onGenerateCsv: me,
        onGenerateImage: y(de),
        onToggleTable: ge,
        onToggleTooltip: be,
        onToggleAnnotator: Z,
        style: $({
          visibility: y(ce) ? y(ue) ? "visible" : "hidden" : "visible"
        })
      }, He({ _: 2 }, [
        t.$slots.optionTooltip ? {
          name: "optionTooltip",
          fn: m(() => [
            p(t.$slots, "optionTooltip", {}, void 0, !0)
          ]),
          key: "0"
        } : void 0,
        t.$slots.optionPdf ? {
          name: "optionPdf",
          fn: m(() => [
            p(t.$slots, "optionPdf", {}, void 0, !0)
          ]),
          key: "1"
        } : void 0,
        t.$slots.optionCsv ? {
          name: "optionCsv",
          fn: m(() => [
            p(t.$slots, "optionCsv", {}, void 0, !0)
          ]),
          key: "2"
        } : void 0,
        t.$slots.optionImg ? {
          name: "optionImg",
          fn: m(() => [
            p(t.$slots, "optionImg", {}, void 0, !0)
          ]),
          key: "3"
        } : void 0,
        t.$slots.optionTable ? {
          name: "optionTable",
          fn: m(() => [
            p(t.$slots, "optionTable", {}, void 0, !0)
          ]),
          key: "4"
        } : void 0,
        t.$slots.optionFullscreen ? {
          name: "optionFullscreen",
          fn: m(({ toggleFullscreen: l, isFullscreen: i }) => [
            p(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 }) => [
            p(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", "style"])) : v("", !0),
      w.value ? (s(), r("svg", {
        key: 4,
        xmlns: y(Qe),
        viewBox: `0 0 ${d.value.width < 0 ? 0.1 : d.value.width} ${d.value.height < 0 ? 0.1 : d.value.height}`,
        style: $(`max-width:100%;overflow:visible;background:transparent;color:${e.value.style.chart.color}`)
      }, [
        ke(ct),
        e.value.style.chart.plots.gradient.show ? (s(), r("defs", _t, [
          (s(!0), r(b, null, k(S.value, (l, i) => (s(), r("radialGradient", {
            id: `gradient_${i}_${X.value}`,
            fy: "30%"
          }, [
            T("stop", {
              offset: "10%",
              "stop-color": y(et)(l.color, e.value.style.chart.plots.gradient.intensity / 100)
            }, null, 8, Mt),
            T("stop", {
              offset: "90%",
              "stop-color": y(tt)(l.color, 0.1)
            }, null, 8, At),
            T("stop", {
              offset: "100%",
              "stop-color": l.color
            }, null, 8, Tt)
          ], 8, $t))), 256))
        ])) : v("", !0),
        e.value.style.chart.grid.verticalLines.show ? (s(), r("g", Lt, [
          (s(!0), r(b, null, k(x.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, St))), 256))
        ])) : v("", !0),
        e.value.style.chart.axes.y.labels.show ? (s(), r("g", zt, [
          (s(!0), r(b, null, k(x.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(y(O)(
            e.value.style.chart.axes.y.labels.formatter,
            l.value,
            y(F)({
              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, Nt))), 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}, ${d.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, Pt)) : v("", !0),
        e.value.style.chart.grid.horizontalLines.show ? (s(), r("g", It, [
          (s(!0), r(b, null, k(x.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, Ot))), 256))
        ])) : v("", !0),
        e.value.style.chart.axes.x.labels.show ? (s(), r("g", Ft, [
          (s(!0), r(b, null, k(x.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(y(O)(
            e.value.style.chart.axes.x.labels.formatter,
            l.value,
            y(F)({
              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, Xt))), 256))
        ])) : v("", !0),
        e.value.style.chart.axes.x.name.text ? (s(), r("text", {
          key: 6,
          x: d.value.width / 2 + e.value.style.chart.axes.x.name.offsetX,
          y: d.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, Dt)) : 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, Yt)) : 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, jt)) : v("", !0),
        (s(!0), r(b, null, k(S.value, (l, i) => (s(), r("g", null, [
          e.value.style.chart.paths.show ? (s(), r("g", {
            key: 0,
            style: $({
              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, Bt),
            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, Ut)
          ], 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, Wt))), 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: $({
              opacity: _.value === null || _.value.id === o.id ? 1 : 0.3,
              transition: "opacity 0.2s ease-in-out"
            })
          }, null, 14, Gt))), 256)),
          e.value.style.chart.plots.labels.show ? (s(), r("g", Ht, [
            (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: $({
                opacity: _.value === null || _.value.id === o.id ? 1 : 0.3,
                transition: "opacity 0.2s ease-in-out"
              })
            }, L(o.label), 15, Et))), 256))
          ])) : v("", !0),
          e.value.style.chart.plots.indexLabels.show ? (s(), r("g", Vt, [
            (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 ? y(lt)(l.color) : e.value.style.chart.plots.indexLabels.color,
              "text-anchor": "middle",
              class: I({ animated: e.value.useCssAnimation }),
              style: $({
                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, Rt))), 256))
          ])) : v("", !0)
        ]))), 256)),
        (s(!0), r(b, null, k(S.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) => je({
              datapoint: i,
              plotIndex: o,
              seriesIndex: l.seriesIndex
            }),
            onMouseleave: a[0] || (a[0] = (C) => {
              V.value = !1, _.value = null;
            }),
            onClick: () => De(i)
          }, null, 40, qt))), 256))
        ]))), 256)),
        p(t.$slots, "svg", { svg: d.value }, void 0, !0)
      ], 12, Ct)) : v("", !0),
      t.$slots.watermark ? (s(), r("div", Zt, [
        p(t.$slots, "watermark", Y(j({ isPrinting: y(ve) || y(he) })), void 0, !0)
      ])) : v("", !0),
      w.value ? v("", !0) : (s(), z(pt, {
        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(), z(vt, {
          key: `legend_${te.value}`,
          legendSet: xe.value,
          config: Xe.value,
          onClickMarker: a[1] || (a[1] = ({ legend: l }) => {
            fe(l.seriesIndex), pe(l);
          })
        }, {
          item: m(({ legend: l, index: i }) => [
            T("div", {
              onClick: (o) => {
                l.segregate(), pe(l);
              },
              style: $(`opacity:${g.value.includes(l.seriesIndex) ? 0.5 : 1}`)
            }, L(l.name), 13, Jt)
          ]),
          _: 1
        }, 8, ["legendSet", "config"])) : p(t.$slots, "legend", {
          key: 1,
          legend: xe.value
        }, void 0, !0)
      ], 512),
      t.$slots.source ? (s(), r("div", {
        key: 7,
        ref_key: "source",
        ref: oe,
        dir: "auto"
      }, [
        p(t.$slots, "source", {}, void 0, !0)
      ], 512)) : v("", !0),
      ke(yt, {
        show: M.value.showTooltip && V.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: R.value,
        isCustom: D.value,
        isFullscreen: U.value
      }, {
        "tooltip-before": m(() => [
          p(t.$slots, "tooltip-before", Y(j({ ...q.value })), void 0, !0)
        ]),
        "tooltip-after": m(() => [
          p(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(), z(ft, {
        key: 8,
        hideDetails: "",
        config: {
          open: M.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(), z(dt, {
            key: `table_${le.value}`,
            colNames: W.value.colNames,
            head: W.value.head,
            body: W.value.body,
            config: W.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) => M.value.showTable = !1)
          }, {
            th: m(({ th: l }) => [
              T("div", {
                innerHTML: l,
                style: { display: "flex", "align-items": "center" }
              }, null, 8, Kt)
            ]),
            td: m(({ td: l }) => [
              Ee(L(l.name || l), 1)
            ]),
            _: 1
          }, 8, ["colNames", "head", "body", "config", "title"]))
        ]),
        _: 1
      }, 8, ["config"])) : v("", !0)
    ], 46, wt));
  }
}, fl = /* @__PURE__ */ kt(Qt, [["__scopeId", "data-v-743a6993"]]);
export {
  fl as default
};
