import "../../../../../../node_modules/.pnpm/vue@3.3.4/node_modules/vue/dist/vue.runtime.esm-bundler.mjs";
import "../../../../../store/modules/designStore/designStore.mjs";
import "../../../../../settings/designSetting.mjs";
import "../../../../../../node_modules/.pnpm/screenfull@6.0.2/node_modules/screenfull/index.mjs";
import throttle from "../../../../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/throttle.mjs";
import "../../../../../../node_modules/.pnpm/html2canvas@1.4.1/node_modules/html2canvas/dist/html2canvas.esm.mjs";
import "../../../../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseClone.mjs";
import "../../../../../../node_modules/.pnpm/crypto-js@4.1.1/node_modules/crypto-js/index.mjs";
import "../../../../../enums/pageEnum.mjs";
import "../../../../../router/index.mjs";
import "../../../../../../node_modules/.pnpm/vue3-lazyload@0.2.5-beta_a6dezdz3je235ci4e3tu4rayna/node_modules/vue3-lazyload/dist/vue3-lazyload.esm.mjs";
import "../../../../../components/GoSkeleton/index.vue.mjs";
import "../../../../../components/GoLoading/index.mjs";
import { useChartDataFetch } from "../../../../../hooks/useChartDataFetch.hook.mjs";
import "../../../../../api/axios.mjs";
import "../../../../../../node_modules/.pnpm/echarts@5.4.3/node_modules/echarts/index.mjs";
import "../../../../../store/modules/langStore/langStore.mjs";
import { useChartEditStore } from "../../../../../store/modules/chartEditStore/chartEditStore.mjs";
import World from "./code/world/Word.mjs";
import { defineComponent, watch, onMounted, openBlock, createElementBlock } from "../../../../../../node_modules/.pnpm/@vue_runtime-core@3.3.4/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.mjs";
import { ref, toRefs } from "../../../../../../node_modules/.pnpm/@vue_reactivity@3.3.4/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.mjs";
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "index",
  props: {
    chartConfig: {
      type: Object,
      required: true
    }
  },
  setup(__props) {
    const props = __props;
    const chartEditStore = useChartEditStore();
    const chartRef = ref();
    const { w, h } = toRefs(props.chartConfig.attr);
    let threeClassInstance;
    const init = () => {
      const dom = chartRef.value;
      if (dom) {
        threeClassInstance = new World({
          dom,
          data: props.chartConfig.option.dataset,
          width: w.value,
          height: h.value
        });
      }
    };
    const updateData = (data) => {
      try {
        threeClassInstance.updateData(data);
      } catch (error) {
        console.log(error);
      }
    };
    watch(
      () => [w.value, h.value],
      throttle(([newWidth], [newHeight]) => {
        threeClassInstance.updateSize(newWidth, newHeight);
      }, 100)
    );
    watch(
      () => props.chartConfig.option.dataset,
      (newData) => {
        updateData(newData);
      },
      {
        deep: false
      }
    );
    onMounted(() => {
      try {
        if (navigator.userAgent.indexOf("Chrome") < -1 || navigator.userAgent.indexOf("Edg") < -1) {
          window["$message"].error("三维地图组件仅在【谷歌】浏览器上能正常展示！");
          chartEditStore.removeComponentList(void 0, false);
          return;
        }
        init();
      } catch (error) {
        console.log(error);
      }
    });
    useChartDataFetch(props.chartConfig, useChartEditStore, updateData);
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        ref_key: "chartRef",
        ref: chartRef
      }, null, 512);
    };
  }
});
export {
  _sfc_main as default
};
