import { computed as m, ref as v, watch as ye, onMounted as fe, onBeforeUnmount as Oe, openBlock as o, createElementBlock as r, normalizeClass as be, normalizeStyle as F, unref as u, createBlock as L, createCommentVNode as h, createSlots as Ge, withCtx as k, renderSlot as _, normalizeProps as U, guardReactiveProps as R, createVNode as Me, Fragment as C, renderList as $, createElementVNode as i, toDisplayString as A, createTextVNode as ge, nextTick as De } from "vue";
import { u as Ie, c as pe, t as Fe, o as Ve, e as me, g as Ee, v as _e, D as He, f as z, X as ke, i as B, l as xe, h as we, q as We, r as Ue } from "./index-BVNcFEqn.js";
import { t as Re, u as Be } from "./useResponsive-CoxXLe23.js";
import { _ as je } from "./Title-DyUTj8GI.js";
import { u as qe, U as Ye } from "./usePrinter-Bcfs_I6G.js";
import { D as Ze } from "./DataTable-DX_jYNWG.js";
import Je from "./vue-ui-skeleton-Bgf16k10.js";
import { L as Ke } from "./Legend-DGUxLqhs.js";
import Qe from "./vue-ui-accordion-GNblUy42.js";
import { u as Ce } from "./useNestedProp-D79dWdel.js";
import { _ as et } from "./PackageVersion-B9_Ed72C.js";
import { P as tt } from "./PenAndPaper-CzjoEhsO.js";
import { u as lt } from "./useUserOptionState-BIvW1Kz7.js";
import { _ as at } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const st = ["id"], ot = ["xmlns", "viewBox"], rt = ["x", "y", "width", "height"], nt = { key: 1 }, ut = ["x1", "x2", "y1", "y2", "stroke", "stroke-width", "stroke-dasharray"], it = { key: 2 }, ct = ["x1", "x2", "y1", "y2", "stroke", "stroke-width", "stroke-dasharray"], dt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width", "stroke-dasharray"], vt = { key: 3 }, ht = ["x", "y", "font-size", "fill", "font-weight"], yt = ["x", "y", "font-size", "fill"], ft = { key: 4 }, bt = ["x", "y", "font-size", "fill", "font-weight"], gt = ["id"], pt = ["stop-color"], mt = ["stop-color"], _t = ["stop-color"], kt = ["id"], xt = ["stop-color"], wt = ["stop-color"], Ct = ["stop-color"], $t = ["id"], Lt = ["stop-color"], At = ["stop-color"], zt = ["id"], St = ["stop-color"], Xt = ["stop-color"], Nt = { key: 0 }, Tt = ["d", "fill"], Pt = { key: 1 }, Ot = ["x", "y", "height", "width", "fill"], Gt = ["cx", "cy", "r", "fill", "stroke", "stroke-width"], Mt = ["cx", "cy", "r", "fill", "stroke", "stroke-width"], Dt = { key: 2 }, It = ["x", "y", "fill", "font-size"], Ft = { key: 3 }, Vt = ["x", "y", "fill", "font-size"], Et = {
  key: 5,
  class: "vue-data-ui-watermark"
}, Ht = ["xmlns", "height", "width"], Wt = ["fill"], Ut = ["innerHTML"], Rt = {
  __name: "vue-ui-dumbbell",
  props: {
    config: {
      type: Object,
      default() {
        return {};
      }
    },
    dataset: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  emits: ["selectDatapoint"],
  setup($e, { expose: Le, emit: Bt }) {
    const p = $e, { vue_ui_dumbbell: Ae } = Ie(), S = m({
      get() {
        return !!p.dataset && p.dataset.length;
      },
      set(l) {
        return l;
      }
    }), f = v(pe()), j = v(0), X = v(null), q = v(null), Y = v(null), Z = v(null), J = v(null), K = v(0), Q = v(0), ee = v(0), e = m({
      get: () => ae(),
      set: (l) => l
    }), { userOptionsVisible: V, setUserOptionsVisibility: te, keepUserOptionState: le } = lt({ config: e.value });
    function ae() {
      const l = Ce({
        userConfig: p.config,
        defaultConfig: Ae
      });
      return l.theme ? {
        ...Ce({
          userConfig: Fe.vue_ui_dumbbell[l.theme] || p.config,
          defaultConfig: l
        })
      } : l;
    }
    ye(() => p.config, (l) => {
      e.value = ae(), V.value = !e.value.showOnChartHover, se(), K.value += 1, Q.value += 1, ee.value += 1, y.value = e.value.style.chart.rowHeight, N.value = e.value.style.chart.width;
    }, { deep: !0 }), ye(() => p.dataset, (l) => {
      ce();
    }, { deep: !0 });
    const P = v(null);
    fe(() => {
      se();
    });
    function se() {
      if (Ve(p.dataset) ? me({
        componentName: "VueUiDumbbell",
        type: "dataset"
      }) : p.dataset.forEach((l, n) => {
        Ee({
          datasetObject: l,
          requiredAttributes: ["name", "start", "end"]
        }).forEach((t) => {
          S.value = !1, me({
            componentName: "VueUiDumbbell",
            type: "datasetSerieAttribute",
            property: t,
            index: n
          });
        });
      }), e.value.responsive) {
        const l = Re(() => {
          const { width: n, height: t } = Be({
            chart: X.value,
            title: e.value.style.chart.title.text ? q.value : null,
            legend: e.value.style.chart.legend.show ? Y.value : null,
            source: Z.value,
            noTitle: J.value
          });
          N.value = n, y.value = t / p.dataset.length, b.value = G();
        });
        P.value = new ResizeObserver(l), P.value.observe(X.value.parentNode);
      }
    }
    Oe(() => {
      P.value && P.value.disconnect();
    });
    const { isPrinting: oe, isImaging: re, generatePdf: ne, generateImage: ue } = qe({
      elementId: `dumbbell_${f.value}`,
      fileName: e.value.style.chart.title.text || "vue-ui-dumbbell"
    }), ze = m(() => e.value.userOptions.show && !e.value.style.chart.title.text), O = v({
      showTable: e.value.table.show
    }), x = m(() => p.dataset.map((l, n) => ({
      ...l,
      start: _e(l.start),
      end: _e(l.end),
      id: pe()
    }))), E = m(() => ({
      max: Math.max(...x.value.flatMap((l) => [l.start, l.end])),
      min: Math.min(...x.value.flatMap((l) => [l.start, l.end]))
    })), d = m(() => He(E.value.min < 0 ? E.value.min : 0, E.value.max, e.value.style.chart.grid.scaleSteps)), y = v(e.value.style.chart.rowHeight), N = v(e.value.style.chart.width), a = m(() => {
      const l = y.value, n = e.value.style.chart.padding.left + e.value.style.chart.padding.right + N.value, t = e.value.style.chart.padding.top + e.value.style.chart.padding.bottom + l * p.dataset.length, s = d.value.ticks.length * (N.value / d.value.ticks.length);
      return {
        left: e.value.style.chart.padding.left,
        right: n - e.value.style.chart.padding.right,
        top: e.value.style.chart.padding.top,
        bottom: t - e.value.style.chart.padding.bottom,
        width: N.value,
        height: l * p.dataset.length,
        rowHeight: l,
        absoluteHeight: t,
        absoluteWidth: n,
        widthPlotReference: s
      };
    });
    function G() {
      return x.value.map((l, n) => {
        const t = a.value.left + (l.start + Math.abs(d.value.min)) / (d.value.max + Math.abs(d.value.min)) * a.value.widthPlotReference, s = a.value.left + (l.end + Math.abs(d.value.min)) / (d.value.max + Math.abs(d.value.min)) * a.value.widthPlotReference, c = t + (s - t) / 2;
        return {
          ...l,
          startX: t,
          endX: s,
          centerX: c,
          y: a.value.top + n * y.value + y.value / 2,
          endVal: l.start
        };
      });
    }
    const b = v([]), ie = v(null), Se = m(() => x.value.map((l) => l.end).reduce((l, n) => l + n, 0));
    fe(() => {
      ce();
    });
    function ce() {
      b.value = G();
      let l = b.value.map((t) => t.start).reduce((t, s) => t + s, 0);
      function n() {
        const t = x.value.map((s) => s.end - s.start);
        l >= Se.value ? (cancelAnimationFrame(ie.value), b.value = G()) : (b.value = b.value.map((s, c) => {
          s.endVal += t[c] * (e.value.animationSpeed / 100);
          const g = a.value.left + (s.start + Math.abs(d.value.min)) / (d.value.max + Math.abs(d.value.min)) * a.value.widthPlotReference, I = a.value.left + (s.endVal + Math.abs(d.value.min)) / (d.value.max + Math.abs(d.value.min)) * a.value.widthPlotReference, W = g + (I - g) / 2;
          return {
            ...s,
            startX: g,
            endX: I,
            centerX: W,
            y: a.value.top + c * y.value + y.value / 2,
            endVal: s.endVal
          };
        }), l = b.value.map((s) => s.endVal).reduce((s, c) => s + c, 0), ie.value = requestAnimationFrame(n));
      }
      e.value.useAnimation ? n() : b.value = G();
    }
    const de = m(() => [
      { name: e.value.style.chart.legend.labelStart, color: e.value.style.chart.plots.gradient.show ? `url(#start_grad_${f.value})` : e.value.style.chart.plots.startColor },
      { name: e.value.style.chart.legend.labelEnd, color: e.value.style.chart.plots.gradient.show ? `url(#end_grad_${f.value})` : e.value.style.chart.plots.endColor }
    ]), Xe = m(() => ({
      cy: "donut-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,
      paddingTop: 12,
      fontWeight: e.value.style.chart.legend.bold ? "bold" : ""
    })), w = m(() => {
      const l = b.value.map((t) => ({
        name: t.name
      })), n = b.value.map((t) => ({
        start: t.start,
        end: t.end
      }));
      return { head: l, body: n };
    }), M = m(() => {
      const l = [
        e.value.table.columnNames.series,
        e.value.table.columnNames.start,
        e.value.table.columnNames.end,
        e.value.table.columnNames.progression
      ], n = w.value.head.map((c, g) => {
        const I = z({
          p: e.value.style.chart.labels.prefix,
          v: w.value.body[g].start,
          s: e.value.style.chart.labels.suffix,
          r: e.value.table.td.roundingValue
        }), W = z({
          p: e.value.style.chart.labels.prefix,
          v: w.value.body[g].end,
          s: e.value.style.chart.labels.suffix,
          r: e.value.table.td.roundingValue
        }), Pe = z({
          v: 100 * (w.value.body[g].end / w.value.body[g].start - 1),
          s: "%",
          r: e.value.table.td.roundingPercentage
        });
        return [
          { name: c.name },
          I,
          W,
          Pe
        ];
      }), t = {
        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 {
        colNames: [
          e.value.table.columnNames.series,
          e.value.table.columnNames.start,
          e.value.table.columnNames.end,
          e.value.table.columnNames.progression
        ],
        head: l,
        body: n,
        config: t
      };
    });
    function ve() {
      De(() => {
        const l = w.value.head.map((s, c) => [[
          s.name
        ], [w.value.body[c].start], [w.value.body[c].end]]), n = [[e.value.style.chart.title.text], [e.value.style.chart.title.subtitle.text], [[e.value.table.columnNames.series], [e.value.table.columnNames.start], [e.value.table.columnNames.end]]].concat(l), t = We(n);
        Ue({ csvContent: t, title: e.value.style.chart.title.text || "vue-ui-dumbbell" });
      });
    }
    const T = v(!1);
    function Ne(l) {
      T.value = l, j.value += 1;
    }
    function Te() {
      return b.value;
    }
    function he() {
      O.value.showTable = !O.value.showTable;
    }
    const D = v(!1);
    function H() {
      D.value = !D.value;
    }
    return Le({
      getData: Te,
      generatePdf: ne,
      generateCsv: ve,
      generateImage: ue,
      toggleTable: he,
      toggleAnnotator: H
    }), (l, n) => (o(), r("div", {
      ref_key: "dumbbellChart",
      ref: X,
      class: be(`vue-ui-dumbbell ${T.value ? "vue-data-ui-wrapper-fullscreen" : ""}`),
      style: F(`font-family:${e.value.style.fontFamily};width:100%; text-align:center;background:${e.value.style.chart.backgroundColor};${e.value.responsive ? "height:100%" : ""}`),
      id: `dumbbell_${f.value}`,
      onMouseenter: n[1] || (n[1] = () => u(te)(!0)),
      onMouseleave: n[2] || (n[2] = () => u(te)(!1))
    }, [
      e.value.userOptions.buttons.annotator ? (o(), L(tt, {
        key: 0,
        parent: X.value,
        backgroundColor: e.value.style.chart.backgroundColor,
        color: e.value.style.chart.color,
        active: D.value,
        onClose: H
      }, null, 8, ["parent", "backgroundColor", "color", "active"])) : h("", !0),
      ze.value ? (o(), r("div", {
        key: 1,
        ref_key: "noTitle",
        ref: J,
        class: "vue-data-ui-no-title-space",
        style: "height:36px; width: 100%;background:transparent"
      }, null, 512)) : h("", !0),
      e.value.style.chart.title.text ? (o(), r("div", {
        key: 2,
        ref_key: "chartTitle",
        ref: q,
        style: "width:100%;background:transparent;padding-bottom:24px"
      }, [
        (o(), L(je, {
          key: `title_${K.value}`,
          config: {
            title: {
              cy: "donut-div-title",
              ...e.value.style.chart.title
            },
            subtitle: {
              cy: "donut-div-subtitle",
              ...e.value.style.chart.title.subtitle
            }
          }
        }, null, 8, ["config"]))
      ], 512)) : h("", !0),
      e.value.userOptions.show && S.value && (u(le) || u(V)) ? (o(), L(Ye, {
        ref: "details",
        key: `user_option_${j.value}`,
        backgroundColor: e.value.style.chart.backgroundColor,
        color: e.value.style.chart.color,
        isPrinting: u(oe),
        isImaging: u(re),
        uid: f.value,
        hasPdf: e.value.userOptions.buttons.pdf,
        hasXls: e.value.userOptions.buttons.csv,
        hasImg: e.value.userOptions.buttons.img,
        hasTable: e.value.userOptions.buttons.table,
        hasFullscreen: e.value.userOptions.buttons.fullscreen,
        isFullscreen: T.value,
        titles: { ...e.value.userOptions.buttonTitles },
        chartElement: X.value,
        position: e.value.userOptions.position,
        hasAnnotator: e.value.userOptions.buttons.annotator,
        isAnnotation: D.value,
        onToggleFullscreen: Ne,
        onGeneratePdf: u(ne),
        onGenerateCsv: ve,
        onGenerateImage: u(ue),
        onToggleTable: he,
        onToggleAnnotator: H,
        style: F({
          visibility: u(le) ? u(V) ? "visible" : "hidden" : "visible"
        })
      }, Ge({ _: 2 }, [
        l.$slots.optionPdf ? {
          name: "optionPdf",
          fn: k(() => [
            _(l.$slots, "optionPdf", {}, void 0, !0)
          ]),
          key: "0"
        } : void 0,
        l.$slots.optionCsv ? {
          name: "optionCsv",
          fn: k(() => [
            _(l.$slots, "optionCsv", {}, void 0, !0)
          ]),
          key: "1"
        } : void 0,
        l.$slots.optionImg ? {
          name: "optionImg",
          fn: k(() => [
            _(l.$slots, "optionImg", {}, void 0, !0)
          ]),
          key: "2"
        } : void 0,
        l.$slots.optionTable ? {
          name: "optionTable",
          fn: k(() => [
            _(l.$slots, "optionTable", {}, void 0, !0)
          ]),
          key: "3"
        } : void 0,
        l.$slots.optionFullscreen ? {
          name: "optionFullscreen",
          fn: k(({ toggleFullscreen: t, isFullscreen: s }) => [
            _(l.$slots, "optionFullscreen", U(R({ toggleFullscreen: t, isFullscreen: s })), void 0, !0)
          ]),
          key: "4"
        } : void 0,
        l.$slots.optionAnnotator ? {
          name: "optionAnnotator",
          fn: k(({ toggleAnnotator: t, isAnnotator: s }) => [
            _(l.$slots, "optionAnnotator", U(R({ toggleAnnotator: t, isAnnotator: s })), void 0, !0)
          ]),
          key: "5"
        } : void 0
      ]), 1032, ["backgroundColor", "color", "isPrinting", "isImaging", "uid", "hasPdf", "hasXls", "hasImg", "hasTable", "hasFullscreen", "isFullscreen", "titles", "chartElement", "position", "hasAnnotator", "isAnnotation", "onGeneratePdf", "onGenerateImage", "style"])) : h("", !0),
      S.value ? (o(), r("svg", {
        key: 4,
        xmlns: u(ke),
        class: be({ "vue-data-ui-fullscreen--on": T.value, "vue-data-ui-fulscreen--off": !T.value }),
        viewBox: `0 0 ${a.value.absoluteWidth <= 0 ? 10 : a.value.absoluteWidth} ${a.value.absoluteHeight <= 0 ? 10 : a.value.absoluteHeight}`,
        style: F(`max-width:100%; overflow: visible; background:transparent;color:${e.value.style.chart.color}`)
      }, [
        Me(et),
        l.$slots["chart-background"] ? (o(), r("foreignObject", {
          key: 0,
          x: a.value.left,
          y: a.value.top,
          width: a.value.width,
          height: a.value.height,
          style: {
            pointerEvents: "none"
          }
        }, [
          _(l.$slots, "chart-background", {}, void 0, !0)
        ], 8, rt)) : h("", !0),
        e.value.style.chart.grid.verticalGrid.show ? (o(), r("g", nt, [
          (o(!0), r(C, null, $(d.value.ticks, (t, s) => (o(), r("line", {
            x1: a.value.left + s * a.value.width / (d.value.ticks.length - 1),
            x2: a.value.left + s * a.value.width / (d.value.ticks.length - 1),
            y1: a.value.top,
            y2: a.value.bottom,
            stroke: e.value.style.chart.grid.verticalGrid.stroke,
            "stroke-width": e.value.style.chart.grid.verticalGrid.strokeWidth,
            "stroke-dasharray": e.value.style.chart.grid.verticalGrid.strokeDasharray
          }, null, 8, ut))), 256))
        ])) : h("", !0),
        e.value.style.chart.grid.horizontalGrid.show ? (o(), r("g", it, [
          (o(!0), r(C, null, $(x.value, (t, s) => (o(), r("line", {
            x1: a.value.left,
            x2: a.value.right,
            y1: a.value.top + s * y.value,
            y2: a.value.top + s * y.value,
            stroke: e.value.style.chart.grid.horizontalGrid.stroke,
            "stroke-width": e.value.style.chart.grid.horizontalGrid.strokeWidth,
            "stroke-dasharray": e.value.style.chart.grid.horizontalGrid.strokeDasharray
          }, null, 8, ct))), 256)),
          i("line", {
            x1: a.value.left,
            x2: a.value.right,
            y1: a.value.bottom,
            y2: a.value.bottom,
            stroke: e.value.style.chart.grid.horizontalGrid.stroke,
            "stroke-width": e.value.style.chart.grid.horizontalGrid.strokeWidth,
            "stroke-dasharray": e.value.style.chart.grid.horizontalGrid.strokeDasharray
          }, null, 8, dt)
        ])) : h("", !0),
        e.value.style.chart.labels.yAxisLabels.show ? (o(), r("g", vt, [
          (o(!0), r(C, null, $(x.value, (t, s) => (o(), r("text", {
            x: a.value.left - 6 + e.value.style.chart.labels.yAxisLabels.offsetX,
            y: a.value.top + s * y.value + (e.value.style.chart.labels.yAxisLabels.showProgression ? y.value / 3 : y.value / 2) + e.value.style.chart.labels.yAxisLabels.fontSize / 3,
            "font-size": e.value.style.chart.labels.yAxisLabels.fontSize,
            fill: e.value.style.chart.labels.yAxisLabels.color,
            "font-weight": e.value.style.chart.labels.yAxisLabels.bold ? "bold" : "normal",
            "text-anchor": "end"
          }, A(t.name), 9, ht))), 256)),
          e.value.style.chart.labels.yAxisLabels.showProgression ? (o(!0), r(C, { key: 0 }, $(x.value, (t, s) => (o(), r("text", {
            x: a.value.left - 6 + e.value.style.chart.labels.yAxisLabels.offsetX,
            y: a.value.top + s * y.value + y.value / 1.3 + e.value.style.chart.labels.yAxisLabels.fontSize / 3,
            "font-size": e.value.style.chart.labels.yAxisLabels.fontSize,
            fill: e.value.style.chart.labels.yAxisLabels.color,
            "text-anchor": "end"
          }, A(u(z)({
            v: 100 * (t.end / t.start - 1),
            s: "%",
            r: e.value.style.chart.labels.yAxisLabels.rounding
          })), 9, yt))), 256)) : h("", !0)
        ])) : h("", !0),
        e.value.style.chart.labels.xAxisLabels.show ? (o(), r("g", ft, [
          (o(!0), r(C, null, $(d.value.ticks, (t, s) => (o(), r("text", {
            x: a.value.left + s * (a.value.width / (d.value.ticks.length - 1)),
            y: a.value.bottom + e.value.style.chart.labels.xAxisLabels.fontSize + e.value.style.chart.labels.xAxisLabels.offsetY,
            "font-size": e.value.style.chart.labels.xAxisLabels.fontSize,
            fill: e.value.style.chart.labels.xAxisLabels.color,
            "font-weight": e.value.style.chart.labels.xAxisLabels.bold ? "bold" : "normal",
            "text-anchor": "middle"
          }, A(u(B)(
            e.value.style.chart.labels.formatter,
            t,
            u(z)({
              p: e.value.style.chart.labels.prefix,
              v: t,
              s: e.value.style.chart.labels.suffix,
              r: e.value.style.chart.labels.xAxisLabels.rounding
            }),
            { datapoint: t, seriesIndex: s }
          )), 9, bt))), 256))
        ])) : h("", !0),
        i("defs", null, [
          i("radialGradient", {
            id: `start_grad_${f.value}`,
            fy: "30%"
          }, [
            i("stop", {
              offset: "10%",
              "stop-color": u(xe)(e.value.style.chart.plots.startColor, e.value.style.chart.plots.gradient.intensity / 100)
            }, null, 8, pt),
            i("stop", {
              offset: "90%",
              "stop-color": u(we)(e.value.style.chart.plots.startColor, 0.1)
            }, null, 8, mt),
            i("stop", {
              offset: "100%",
              "stop-color": e.value.style.chart.plots.startColor
            }, null, 8, _t)
          ], 8, gt),
          i("radialGradient", {
            id: `end_grad_${f.value}`,
            fy: "30%"
          }, [
            i("stop", {
              offset: "10%",
              "stop-color": u(xe)(e.value.style.chart.plots.endColor, e.value.style.chart.plots.gradient.intensity / 100)
            }, null, 8, xt),
            i("stop", {
              offset: "90%",
              "stop-color": u(we)(e.value.style.chart.plots.endColor, 0.1)
            }, null, 8, wt),
            i("stop", {
              offset: "100%",
              "stop-color": e.value.style.chart.plots.endColor
            }, null, 8, Ct)
          ], 8, kt)
        ]),
        (o(!0), r(C, null, $(b.value, (t, s) => (o(), r("g", null, [
          i("defs", null, [
            i("linearGradient", {
              id: `grad_positive_${f.value}`,
              x1: "0%",
              x2: "100%",
              y1: "0%",
              y2: "0%"
            }, [
              i("stop", {
                offset: "0%",
                "stop-color": e.value.style.chart.plots.startColor
              }, null, 8, Lt),
              i("stop", {
                offset: "100%",
                "stop-color": e.value.style.chart.plots.endColor
              }, null, 8, At)
            ], 8, $t),
            i("linearGradient", {
              id: `grad_negative_${f.value}`,
              x1: "0%",
              x2: "100%",
              y1: "0%",
              y2: "0%"
            }, [
              i("stop", {
                offset: "0%",
                "stop-color": e.value.style.chart.plots.endColor
              }, null, 8, St),
              i("stop", {
                offset: "100%",
                "stop-color": e.value.style.chart.plots.startColor
              }, null, 8, Xt)
            ], 8, zt)
          ]),
          e.value.style.chart.plots.link.type === "curved" ? (o(), r("g", Nt, [
            i("path", {
              d: `M 
                            ${t.startX},${t.y + e.value.style.chart.plots.radius / 2} 
                            C ${t.centerX},${t.y} ${t.centerX},${t.y} 
                            ${t.endX},${t.y + e.value.style.chart.plots.radius / 2}
                            L ${t.endX},${t.y - e.value.style.chart.plots.radius / 2}
                            C ${t.centerX},${t.y} ${t.centerX},${t.y}
                            ${t.startX},${t.y - e.value.style.chart.plots.radius / 2}
                            Z
                        `,
              fill: t.endX > t.startX ? `url(#grad_positive_${f.value})` : `url(#grad_negative_${f.value})`
            }, null, 8, Tt)
          ])) : (o(), r("g", Pt, [
            i("rect", {
              x: t.endX > t.startX ? t.startX : t.endX,
              y: t.y - e.value.style.chart.plots.link.strokeWidth / 2,
              height: e.value.style.chart.plots.link.strokeWidth,
              width: Math.abs(t.endX - t.startX),
              fill: t.endX > t.startX ? `url(#grad_positive_${f.value})` : `url(#grad_negative_${f.value})`
            }, null, 8, Ot)
          ])),
          i("circle", {
            cx: t.startX,
            cy: t.y,
            r: e.value.style.chart.plots.radius,
            fill: e.value.style.chart.plots.gradient.show ? `url(#start_grad_${f.value})` : e.value.style.chart.plots.startColor,
            stroke: e.value.style.chart.plots.stroke,
            "stroke-width": e.value.style.chart.plots.strokeWidth
          }, null, 8, Gt),
          i("circle", {
            cx: t.endX,
            cy: t.y,
            r: e.value.style.chart.plots.radius,
            fill: e.value.style.chart.plots.gradient.show ? `url(#end_grad_${f.value})` : e.value.style.chart.plots.endColor,
            stroke: e.value.style.chart.plots.stroke,
            "stroke-width": e.value.style.chart.plots.strokeWidth
          }, null, 8, Mt),
          e.value.style.chart.labels.startLabels.show ? (o(), r("g", Dt, [
            (o(!0), r(C, null, $(b.value, (c, g) => (o(), r("text", {
              x: c.startX,
              y: a.value.top + (g + 1) * y.value - e.value.style.chart.labels.startLabels.fontSize / 3 + e.value.style.chart.labels.startLabels.offsetY,
              fill: e.value.style.chart.labels.startLabels.useStartColor ? e.value.style.chart.plots.startColor : e.value.style.chart.labels.startLabels.color,
              "font-size": e.value.style.chart.labels.startLabels.fontSize,
              "text-anchor": "middle"
            }, A(u(B)(
              e.value.style.chart.labels.formatter,
              c.start,
              u(z)({
                p: e.value.style.chart.labels.prefix,
                v: c.start,
                s: e.value.style.chart.labels.suffix,
                r: e.value.style.chart.labels.startLabels.rounding
              }),
              { datapoint: c, seriesIndex: g }
            )), 9, It))), 256))
          ])) : h("", !0),
          e.value.style.chart.labels.endLabels.show ? (o(), r("g", Ft, [
            (o(!0), r(C, null, $(b.value, (c, g) => (o(), r("text", {
              x: c.endX,
              y: a.value.top + g * y.value + e.value.style.chart.labels.endLabels.fontSize + e.value.style.chart.labels.endLabels.offsetY,
              fill: e.value.style.chart.labels.endLabels.useEndColor ? e.value.style.chart.plots.endColor : e.value.style.chart.labels.endLabels.color,
              "font-size": e.value.style.chart.labels.endLabels.fontSize,
              "text-anchor": "middle"
            }, A(u(B)(
              e.value.style.chart.labels.formatter,
              c.end,
              u(z)({
                p: e.value.style.chart.labels.prefix,
                v: c.end,
                s: e.value.style.chart.labels.suffix,
                r: e.value.style.chart.labels.endLabels.rounding
              }),
              { datapoint: c, seriesIndex: g }
            )), 9, Vt))), 256))
          ])) : h("", !0)
        ]))), 256)),
        _(l.$slots, "svg", { svg: a.value }, void 0, !0)
      ], 14, ot)) : h("", !0),
      l.$slots.watermark ? (o(), r("div", Et, [
        _(l.$slots, "watermark", U(R({ isPrinting: u(oe) || u(re) })), void 0, !0)
      ])) : h("", !0),
      S.value ? h("", !0) : (o(), L(Je, {
        key: 6,
        config: {
          type: "dumbbell",
          style: {
            backgroundColor: e.value.style.chart.backgroundColor,
            dumbbell: {
              color: "#CCCCCC"
            }
          }
        }
      }, null, 8, ["config"])),
      i("div", {
        ref_key: "chartLegend",
        ref: Y
      }, [
        e.value.style.chart.legend.show && S.value ? (o(), L(Ke, {
          key: `legend_${ee.value}`,
          legendSet: de.value,
          config: Xe.value
        }, {
          item: k(({ legend: t }) => [
            i("div", {
              style: F(`display:flex;align-items:center;gap:4px;font-size:${e.value.style.chart.legend.fontSize}px`)
            }, [
              (o(), r("svg", {
                xmlns: u(ke),
                viewBox: "0 0 20 20",
                height: e.value.style.chart.legend.fontSize,
                width: e.value.style.chart.legend.fontSize
              }, [
                i("circle", {
                  cx: 10,
                  cy: 10,
                  r: 9,
                  fill: t.color
                }, null, 8, Wt)
              ], 8, Ht)),
              ge(" " + A(t.name), 1)
            ], 4)
          ]),
          _: 1
        }, 8, ["legendSet", "config"])) : _(l.$slots, "legend", {
          key: 1,
          legend: de.value
        }, void 0, !0)
      ], 512),
      l.$slots.source ? (o(), r("div", {
        key: 7,
        ref_key: "source",
        ref: Z,
        dir: "auto"
      }, [
        _(l.$slots, "source", {}, void 0, !0)
      ], 512)) : h("", !0),
      S.value ? (o(), L(Qe, {
        key: 8,
        hideDetails: "",
        config: {
          open: O.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: k(() => [
          (o(), L(Ze, {
            key: `table_${Q.value}`,
            colNames: M.value.colNames,
            head: M.value.head,
            body: M.value.body,
            config: M.value.config,
            title: `${e.value.style.chart.title.text}${e.value.style.chart.title.subtitle.text ? ` : ${e.value.style.chart.title.subtitle.text}` : ""}`,
            onClose: n[0] || (n[0] = (t) => O.value.showTable = !1)
          }, {
            th: k(({ th: t }) => [
              i("div", {
                innerHTML: t,
                style: { display: "flex", "align-items": "center" }
              }, null, 8, Ut)
            ]),
            td: k(({ td: t }) => [
              ge(A(t.name || t), 1)
            ]),
            _: 1
          }, 8, ["colNames", "head", "body", "config", "title"]))
        ]),
        _: 1
      }, 8, ["config"])) : h("", !0)
    ], 46, st));
  }
}, nl = /* @__PURE__ */ at(Rt, [["__scopeId", "data-v-2f5ef017"]]);
export {
  nl as default
};
