"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 config = require("./config.js");
const chart = require("../../../../public/chart.js");
const chartEditStore = require("../../../../../store/modules/chartEditStore/chartEditStore.js");
const index = require("../../../../../settings/chartThemes/index.js");
require("../../../../../store/modules/designStore/designStore.js");
require("../../../../../settings/designSetting.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");
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");
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 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/line/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 LinearGradient = require("../../../../../../node_modules/.pnpm/zrender@5.4.4/node_modules/zrender/lib/graphic/LinearGradient.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 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.forEach((value, index2) => {
              value.areaStyle.color = new LinearGradient.default(0, 0, 0, 1, [
                {
                  offset: 0,
                  color: themeColor[3 + index2]
                },
                {
                  offset: 1,
                  color: "rgba(0,0,0, 0)"
                }
              ]);
            });
          }
          option.value = chart.mergeTheme(props.chartConfig.option, props.themeSetting, config.includes);
          props.chartConfig.option = option.value;
        } catch (error) {
          console.log(error);
        }
      },
      {
        immediate: true
      }
    );
    runtimeCore_esmBundler.watch(
      () => props.chartConfig.option.dataset,
      () => {
        option.value = props.chartConfig.option;
      }
    );
    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)(),
        autoresize: ""
      }, null, 8, ["init-options", "theme", "option", "manual-update"]);
    };
  }
});
exports.default = _sfc_main;
