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