import { defineComponent as u, watch as i, openBlock as v, createElementBlock as _, createElementVNode as b, unref as w } from "vue";
import { cloneDeep as r, isEqual as E } from "lodash";
import { parseOtherData as O } from "../../utils/parseOtherData.mjs";
import { useChart as g } from "../../core/useChart.mjs";
const k = { class: "zerov-widget" }, D = ["id"], x = u({ name: "zv-chart-other-parallel-mul" }), V = /* @__PURE__ */ u({
  ...x,
  props: {
    basicOption: {},
    sources: {},
    useEvents: {},
    uuid: {}
  },
  emits: [
    "chart-click",
    "chart-dblclick",
    "chart-mousedown",
    "chart-mouseover",
    "chart-mouseout",
    "chart-contextmenu"
  ],
  setup(d, { expose: l, emit: p }) {
    const e = d, h = p, {
      id: m,
      setOption: o,
      chart: f,
      renderChart: c,
      renderData: a
    } = g({
      basicOption: r(e.basicOption),
      useEvents: r(e.useEvents),
      customRenderData: (t) => {
        t = r(t), window.SHJDatasourceV2({
          tId: e.uuid,
          sources: e.sources,
          callback: ({ data: s }) => {
            try {
              window.SHJParseEvent(e.useEvents, "dataListener", s), t.legend.data = s.map((n) => n.key), o(O(r(s), t));
            } catch {
              window.SHJParseEvent(e.useEvents, "dataListener", null), o(t);
            }
          }
        });
      },
      emit: h
    });
    return i(() => e.sources, () => {
      a(e.basicOption);
    }, {
      deep: !0
    }), i(() => r(e.basicOption), (t, s) => {
      E(t, s) || c(t);
    }, {
      deep: !0
    }), l({
      getEchartsInstance: () => f.value,
      refresh: () => {
        e.sources && e.sources.length > 0 && c(e.basicOption), a(e.basicOption);
      },
      refreshView: () => {
        e.sources && e.sources.length > 0 && c(e.basicOption);
      },
      refreshData: () => {
        a(e.basicOption);
      }
    }), (t, s) => (v(), _("div", k, [
      b("div", {
        id: w(m),
        class: "widget"
      }, null, 8, D)
    ]));
  }
});
export {
  V as default
};
