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