import { defineComponent as u, watch as i, openBlock as v, createElementBlock as _, createElementVNode as b, unref as w } from "vue";
import "echarts-gl";
import { cloneDeep as r, isEqual as E } from "lodash";
import { getPie3D as O } from "./renderPie3d.mjs";
import { useChart as g } from "../../core/useChart.mjs";
const D = { class: "zerov-widget" }, k = ["id"], x = u({ name: "zv-chart-pie-3d" }), 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: p, emit: l }) {
    const e = d, h = l, {
      id: m,
      setOption: a,
      chart: f,
      renderChart: c,
      renderData: o
    } = 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);
              const n = O(s[0].data, t);
              a(n, "canvas");
            } catch {
              window.SHJParseEvent(e.useEvents, "dataListener", null), a(t);
            }
          }
        });
      },
      emit: h
    });
    return i(() => e.sources, () => {
      e.sources && e.sources.length > 0 && o(e.basicOption);
    }, {
      deep: !0
    }), i(() => r(e.basicOption), (t, s) => {
      E(t, s) || c(t);
    }, {
      deep: !0
    }), p({
      getEchartsInstance: () => f.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) => (v(), _("div", D, [
      b("div", {
        id: w(m),
        class: "widget"
      }, null, 8, k)
    ]));
  }
});
export {
  V as default
};
