import "../../node_modules/.pnpm/vue@3.3.4/node_modules/vue/dist/vue.runtime.esm-bundler.mjs";
import "../../node_modules/.pnpm/screenfull@6.0.2/node_modules/screenfull/index.mjs";
import "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_root.mjs";
import "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetTag.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 { isPreview } from "../utils/router.mjs";
import "../store/modules/designStore/designStore.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 "../settings/designSetting.mjs";
import { toRefs } from "../../node_modules/.pnpm/@vue_reactivity@3.3.4/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.mjs";
const useChartInteract = (chartConfig, useChartEditStore2, param, interactEventOn) => {
  if (!isPreview())
    return;
  const chartEditStore = useChartEditStore2();
  const { interactEvents } = chartConfig.events;
  const fnOnEvent = interactEvents.filter((item) => {
    return item.interactOn === interactEventOn;
  });
  if (fnOnEvent.length === 0)
    return;
  fnOnEvent.forEach((item) => {
    const globalConfigPindAprndex = chartEditStore.requestGlobalConfig.requestDataPond.findIndex(
      (cItem) => cItem.dataPondId === item.interactComponentId
    );
    if (globalConfigPindAprndex !== -1) {
      const { Params, Header } = toRefs(chartEditStore.requestGlobalConfig.requestDataPond[globalConfigPindAprndex].dataPondRequestConfig.requestParams);
      Object.keys(item.interactFn).forEach((key) => {
        if (key in Params.value) {
          Params.value[key] = param[item.interactFn[key]];
        }
        if (key in Header.value) {
          Header.value[key] = param[item.interactFn[key]];
        }
      });
    } else {
      const index = chartEditStore.fetchTargetIndex(item.interactComponentId);
      if (index === -1)
        return;
      const { Params, Header } = toRefs(chartEditStore.componentList[index].request.requestParams);
      Object.keys(item.interactFn).forEach((key) => {
        if (key in Params.value) {
          Params.value[key] = param[item.interactFn[key]];
        }
        if (key in Header.value) {
          Header.value[key] = param[item.interactFn[key]];
        }
      });
    }
  });
};
export {
  useChartInteract
};
