import { defineComponent as m, ref as d, createBlock as E, openBlock as _, mergeProps as v } from "vue";
import D from "../../../../../commons/components/Chart/index.vue.mjs";
import { cloneDeep as f } from "lodash";
import { EchartsUtils as c } from "../../../../../commons/utils/echartsUtils.mjs";
const y = m({ name: "ShjRadar" }), S = /* @__PURE__ */ m({
  ...y,
  props: {
    option: {},
    sources: {},
    useEvents: {}
  },
  setup(k, { expose: l }) {
    const p = (e, o, h) => {
      e.dataset = c.parseDataset(f(o)), e.series = c.cloneSeries(o, e.series);
      const n = [], u = [];
      e.dataset.source.forEach((s) => {
        for (const r in s)
          if (Object.prototype.hasOwnProperty.call(s, r)) {
            const t = s[r];
            Number(t) && (u.push(Number(t)), n.push(r));
          }
      });
      function i(s) {
        return s.reduce(
          (r, t) => r.includes(t) ? r : [...r, t],
          []
        );
      }
      e.radar.indicator = [], i(n).forEach((s) => {
        e.radar.indicator.push({
          text: s,
          max: 2e3
        });
      }), e.radar.indicator.forEach((s) => {
        s.max = u.sort((r, t) => t - r)[0];
      }), e.dataset = c.parseDataset(
        f(o),
        i(n)
      ), h(e, "canvas");
    }, a = d();
    return l({
      getEchartsInstance: () => {
        var e;
        return (e = a.value) == null ? void 0 : e.getEchartsInstance();
      },
      refresh: () => {
        var e;
        return (e = a.value) == null ? void 0 : e.refresh();
      },
      refreshView: () => {
        var e;
        return (e = a.value) == null ? void 0 : e.refreshView();
      },
      refreshData: () => {
        var e;
        return (e = a.value) == null ? void 0 : e.refreshData();
      }
    }), (e, o) => (_(), E(D, v({
      ref_key: "componentRef",
      ref: a,
      option: e.option,
      sources: e.sources,
      "use-events": e.useEvents,
      "is-multi-series": e.option.isMultiSeries,
      "custom-render-data": p
    }, e.$attrs), null, 16, ["option", "sources", "use-events", "is-multi-series"]));
  }
});
export {
  S as default
};
