"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
require("../../../../../../node_modules/.pnpm/vue@3.3.4/node_modules/vue/dist/vue.runtime.esm-bundler.js");
const index_esm_min = require("../../../../../../node_modules/.pnpm/vue-echarts@6.6.1_echarts@5.4.3_vue@3.3.4/node_modules/vue-echarts/dist/index.esm.min.js");
const useCanvasInitOptions_hook = require("../../../../../hooks/useCanvasInitOptions.hook.js");
const chart = require("../../../../public/chart.js");
const config = require("./config.js");
require("../../../../../store/modules/designStore/designStore.js");
require("../../../../../settings/designSetting.js");
require("../../../../../../node_modules/.pnpm/screenfull@6.0.2/node_modules/screenfull/index.js");
const isObject = require("../../../../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObject.js");
require("../../../../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_root.js");
require("../../../../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetTag.js");
require("../../../../../../node_modules/.pnpm/html2canvas@1.4.1/node_modules/html2canvas/dist/html2canvas.esm.js");
const cloneDeep = require("../../../../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/cloneDeep.js");
require("../../../../../../node_modules/.pnpm/crypto-js@4.1.1/node_modules/crypto-js/index.js");
const router = require("../../../../../utils/router.js");
require("../../../../../../node_modules/.pnpm/vue3-lazyload@0.2.5-beta_a6dezdz3je235ci4e3tu4rayna/node_modules/vue3-lazyload/dist/vue3-lazyload.esm.js");
require("../../../../../components/GoSkeleton/index.vue.js");
require("../../../../../components/GoLoading/index.js");
const useChartDataFetch_hook = require("../../../../../hooks/useChartDataFetch.hook.js");
require("../../../../../api/axios.js");
require("../../../../../../node_modules/.pnpm/echarts@5.4.3/node_modules/echarts/index.js");
require("../../../../../store/modules/langStore/langStore.js");
const chartEditStore = require("../../../../../store/modules/chartEditStore/chartEditStore.js");
const runtimeCore_esmBundler = require("../../../../../../node_modules/.pnpm/@vue_runtime-core@3.3.4/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js");
const extension = require("../../../../../../node_modules/.pnpm/echarts@5.4.3/node_modules/echarts/lib/extension.js");
const install = require("../../../../../../node_modules/.pnpm/echarts@5.4.3/node_modules/echarts/lib/component/dataset/install.js");
const installCanvasRenderer = require("../../../../../../node_modules/.pnpm/echarts@5.4.3/node_modules/echarts/lib/renderer/installCanvasRenderer.js");
const install$1 = require("../../../../../../node_modules/.pnpm/echarts@5.4.3/node_modules/echarts/lib/chart/bar/install.js");
const install$2 = require("../../../../../../node_modules/.pnpm/echarts@5.4.3/node_modules/echarts/lib/component/grid/install.js");
const install$3 = require("../../../../../../node_modules/.pnpm/echarts@5.4.3/node_modules/echarts/lib/component/tooltip/install.js");
const install$4 = require("../../../../../../node_modules/.pnpm/echarts@5.4.3/node_modules/echarts/lib/component/legend/install.js");
const reactivity_esmBundler = require("../../../../../../node_modules/.pnpm/@vue_reactivity@3.3.4/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js");
const _sfc_main = /* @__PURE__ */ runtimeCore_esmBundler.defineComponent({
  __name: "index",
  props: {
    themeSetting: {
      type: Object,
      required: true
    },
    themeColor: {
      type: Object,
      required: true
    },
    chartConfig: {
      type: Object,
      required: true
    }
  },
  setup(__props) {
    const props = __props;
    const initOptions = useCanvasInitOptions_hook.useCanvasInitOptions(props.chartConfig.option, props.themeSetting);
    extension.use([install.install, installCanvasRenderer.install, install$1.install, install$2.install, install$3.install, install$4.install]);
    const replaceMergeArr = reactivity_esmBundler.ref();
    const option = runtimeCore_esmBundler.computed(() => {
      return chart.mergeTheme(props.chartConfig.option, props.themeSetting, config.includes);
    });
    runtimeCore_esmBundler.watch(
      () => props.chartConfig.option.dataset,
      (newData, oldData) => {
        try {
          if (!isObject.default(newData) || !("dimensions" in newData))
            return;
          if (Array.isArray(newData == null ? void 0 : newData.dimensions)) {
            const seriesArr = [];
            for (let i = 0; i < newData.dimensions.length - 1; i++) {
              seriesArr.push(cloneDeep.default(config.seriesItem));
            }
            replaceMergeArr.value = ["series"];
            props.chartConfig.option.series = seriesArr;
            runtimeCore_esmBundler.nextTick(() => {
              replaceMergeArr.value = [];
            });
          }
        } catch (error) {
          console.log(error);
        }
      },
      {
        deep: false
      }
    );
    const { vChartRef } = useChartDataFetch_hook.useChartDataFetch(props.chartConfig, chartEditStore.useChartEditStore);
    return (_ctx, _cache) => {
      return runtimeCore_esmBundler.openBlock(), runtimeCore_esmBundler.createBlock(reactivity_esmBundler.unref(index_esm_min.default), {
        ref_key: "vChartRef",
        ref: vChartRef,
        "init-options": reactivity_esmBundler.unref(initOptions),
        theme: __props.themeColor,
        option: option.value,
        "manual-update": reactivity_esmBundler.unref(router.isPreview)(),
        "update-options": {
          replaceMerge: replaceMergeArr.value
        },
        autoresize: ""
      }, null, 8, ["init-options", "theme", "option", "manual-update", "update-options"]);
    };
  }
});
exports.default = _sfc_main;
