"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");
require("../../../../../../node_modules/.pnpm/echarts-liquidfill@3.1.0_echarts@5.4.3/node_modules/echarts-liquidfill/src/liquidFillSeries.js");
require("../../../../../../node_modules/.pnpm/echarts-liquidfill@3.1.0_echarts@5.4.3/node_modules/echarts-liquidfill/src/liquidFillView.js");
require("../../../../../../node_modules/.pnpm/screenfull@6.0.2/node_modules/screenfull/index.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 type = require("../../../../../utils/type.js");
require("../../../../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseClone.js");
require("../../../../../../node_modules/.pnpm/crypto-js@4.1.1/node_modules/crypto-js/index.js");
const router = require("../../../../../utils/router.js");
const style = require("../../../../../utils/style.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");
require("../../../../../settings/designSetting.js");
const index = require("../../../../../settings/chartThemes/index.js");
const chartEditStore = require("../../../../../store/modules/chartEditStore/chartEditStore.js");
require("../../../../../store/modules/designStore/designStore.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 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 installCanvasRenderer = require("../../../../../../node_modules/.pnpm/echarts@5.4.3/node_modules/echarts/lib/renderer/installCanvasRenderer.js");
const install = require("../../../../../../node_modules/.pnpm/echarts@5.4.3/node_modules/echarts/lib/component/grid/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([installCanvasRenderer.install, install.install]);
    const chartEditStore$1 = chartEditStore.useChartEditStore();
    const option = reactivity_esmBundler.reactive({
      value: {}
    });
    runtimeCore_esmBundler.watch(
      () => chartEditStore$1.getEditCanvasConfig.chartThemeColor,
      (newColor) => {
        try {
          if (!router.isPreview()) {
            const themeColor = style.colorGradientCustomMerge(chartEditStore$1.getEditCanvasConfig.chartCustomThemeColorInfo)[newColor] || style.colorGradientCustomMerge(chartEditStore$1.getEditCanvasConfig.chartCustomThemeColorInfo)[index.defaultTheme];
            props.chartConfig.option.series[0].backgroundStyle.color = themeColor[2];
            props.chartConfig.option.series[0].color[0].colorStops = [
              {
                offset: 0,
                color: themeColor[0]
              },
              {
                offset: 1,
                color: themeColor[1]
              }
            ];
          }
          option.value = props.chartConfig.option;
        } catch (error) {
          console.log(error);
        }
      },
      {
        immediate: true
      }
    );
    const dataHandle = (newData) => {
      newData = type.isString(newData) ? parseFloat(newData) : newData;
      return parseFloat(newData.toFixed(2));
    };
    runtimeCore_esmBundler.watch(
      () => props.chartConfig.option.dataset,
      (newData) => {
        if (!type.isString(newData) && !type.isNumber(newData))
          return;
        props.chartConfig.option.series[0].data = [dataHandle(newData)];
        option.value = props.chartConfig.option;
      },
      {
        immediate: true,
        deep: false
      }
    );
    useChartDataFetch_hook.useChartDataFetch(props.chartConfig, chartEditStore.useChartEditStore, (newData) => {
      option.value.series[0].data = [dataHandle(newData)];
    });
    return (_ctx, _cache) => {
      return runtimeCore_esmBundler.openBlock(), runtimeCore_esmBundler.createBlock(reactivity_esmBundler.unref(index_esm_min.default), {
        theme: __props.themeColor,
        "init-options": reactivity_esmBundler.unref(initOptions),
        option: option.value,
        autoresize: ""
      }, null, 8, ["theme", "init-options", "option"]);
    };
  }
});
exports.default = _sfc_main;
