"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 editPageEnum = require("../../../enums/editPageEnum.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");
require("../../../enums/pageEnum.js");
require("../../../router/index.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 useContextMenu_hook = require("../hooks/useContextMenu.hook.js");
const chartEditStore = require("../../../store/modules/chartEditStore/chartEditStore.js");
const useScale_hook = require("../../preview/hooks/useScale.hook.js");
const useLayout_hook = require("./hooks/useLayout.hook.js");
const useKeyboard_hook = require("../hooks/useKeyboard.hook.js");
const useDrag_hook = require("./hooks/useDrag.hook.js");
const useStyle_hook = require("./hooks/useStyle.hook.js");
const index$3 = require("../ContentBox/index.vue.js");
const index_vue_vue_type_script_setup_true_lang = require("./components/EditGroup/index.vue.js");
const index$1 = require("./components/EditRange/index.vue.js");
const index = require("./components/EditRule/index.vue.js");
const index$2 = require("./components/EditShapeBox/index.vue.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 reactivity_esmBundler = require("../../../../node_modules/.pnpm/@vue_reactivity@3.3.4/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js");
const shared_esmBundler = require("../../../../node_modules/.pnpm/@vue_shared@3.3.4/node_modules/@vue/shared/dist/shared.esm-bundler.js");
const _sfc_main = /* @__PURE__ */ runtimeCore_esmBundler.defineComponent({
  __name: "index",
  setup(__props) {
    const chartEditStore$1 = chartEditStore.useChartEditStore();
    const { handleContextMenu } = useContextMenu_hook.useContextMenu();
    runtimeCore_esmBundler.provide(useScale_hook.SCALE_KEY, null);
    useLayout_hook.useLayout(async () => {
    });
    const { mouseenterHandle, mouseleaveHandle, mousedownHandle, mouseClickHandle } = useDrag_hook.useMouseHandle();
    const optionsHandle = (targetList, allList, targetInstance) => {
      if (chartEditStore$1.getTargetChart.selectId.length > 1) {
        return allList.filter((i) => [editPageEnum.MenuEnum.GROUP, editPageEnum.MenuEnum.DELETE].includes(i.key));
      }
      const statusMenuEnums = [];
      if (targetInstance.status.lock) {
        statusMenuEnums.push(editPageEnum.MenuEnum.LOCK);
      } else {
        statusMenuEnums.push(editPageEnum.MenuEnum.UNLOCK);
      }
      if (targetInstance.status.hide) {
        statusMenuEnums.push(editPageEnum.MenuEnum.HIDE);
      } else {
        statusMenuEnums.push(editPageEnum.MenuEnum.SHOW);
      }
      return targetList.filter((i) => !statusMenuEnums.includes(i.key));
    };
    const themeSetting = runtimeCore_esmBundler.computed(() => {
      const chartThemeSetting = chartEditStore$1.getEditCanvasConfig.chartThemeSetting;
      return chartThemeSetting;
    });
    const themeColor = runtimeCore_esmBundler.computed(() => {
      const colorCustomMergeData = style.colorCustomMerge(chartEditStore$1.getEditCanvasConfig.chartCustomThemeColorInfo);
      return colorCustomMergeData[chartEditStore$1.getEditCanvasConfig.chartThemeColor];
    });
    runtimeCore_esmBundler.computed(() => {
      return chartEditStore$1.getEditCanvasConfig.filterShow;
    });
    const rangeStyle = runtimeCore_esmBundler.computed(() => {
      const background = chartEditStore$1.getEditCanvasConfig.background;
      const backgroundImage = chartEditStore$1.getEditCanvasConfig.backgroundImage;
      const selectColor = chartEditStore$1.getEditCanvasConfig.selectColor;
      const backgroundColor = background ? background : void 0;
      const computedBackground = selectColor ? { background: backgroundColor } : { background: `url(${backgroundImage}) no-repeat center center / cover !important` };
      return {
        ...computedBackground,
        width: "inherit",
        height: "inherit"
      };
    });
    runtimeCore_esmBundler.onMounted(() => {
      useKeyboard_hook.useAddKeyboard();
    });
    return (_ctx, _cache) => {
      return runtimeCore_esmBundler.openBlock(), runtimeCore_esmBundler.createBlock(reactivity_esmBundler.unref(index$3.default), {
        id: "go-chart-edit-layout",
        flex: true,
        showTop: false,
        showBottom: true,
        depth: 1,
        xScroll: true,
        disabledScroll: true,
        onMousedown: reactivity_esmBundler.unref(useDrag_hook.mousedownHandleUnStop),
        onDrop: reactivity_esmBundler.unref(useDrag_hook.dragHandle),
        onDragover: reactivity_esmBundler.unref(useDrag_hook.dragoverHandle),
        onDragenter: reactivity_esmBundler.unref(useDrag_hook.dragoverHandle)
      }, {
        aside: runtimeCore_esmBundler.withCtx(() => []),
        bottom: runtimeCore_esmBundler.withCtx(() => []),
        default: runtimeCore_esmBundler.withCtx(() => [
          runtimeCore_esmBundler.createVNode(reactivity_esmBundler.unref(index.default), null, {
            default: runtimeCore_esmBundler.withCtx(() => [
              runtimeCore_esmBundler.createElementVNode("div", {
                id: "go-chart-edit-content",
                onContextmenu: _cache[0] || (_cache[0] = //@ts-ignore
                (...args) => reactivity_esmBundler.unref(handleContextMenu) && reactivity_esmBundler.unref(handleContextMenu)(...args))
              }, [
                runtimeCore_esmBundler.createVNode(reactivity_esmBundler.unref(index$1.default), null, {
                  default: runtimeCore_esmBundler.withCtx(() => [
                    runtimeCore_esmBundler.createElementVNode("div", {
                      style: shared_esmBundler.normalizeStyle({
                        ...reactivity_esmBundler.unref(style.getFilterStyle)(reactivity_esmBundler.unref(chartEditStore$1).getEditCanvasConfig),
                        ...rangeStyle.value
                      })
                    }, [
                      (runtimeCore_esmBundler.openBlock(true), runtimeCore_esmBundler.createElementBlock(runtimeCore_esmBundler.Fragment, null, runtimeCore_esmBundler.renderList(reactivity_esmBundler.unref(chartEditStore$1).getComponentList, (item, index2) => {
                        return runtimeCore_esmBundler.openBlock(), runtimeCore_esmBundler.createElementBlock("div", {
                          key: item.id
                        }, [
                          item.isGroup ? (runtimeCore_esmBundler.openBlock(), runtimeCore_esmBundler.createBlock(reactivity_esmBundler.unref(index_vue_vue_type_script_setup_true_lang.default), {
                            key: 0,
                            groupData: item,
                            groupIndex: index2
                          }, null, 8, ["groupData", "groupIndex"])) : (runtimeCore_esmBundler.openBlock(), runtimeCore_esmBundler.createBlock(reactivity_esmBundler.unref(index$2.default), {
                            key: 1,
                            "data-id": item.id,
                            index: index2,
                            style: shared_esmBundler.normalizeStyle({
                              ...reactivity_esmBundler.unref(useStyle_hook.useComponentStyle)(item.attr, index2),
                              ...reactivity_esmBundler.unref(style.getBlendModeStyle)(item.styles)
                            }),
                            item,
                            onClick: ($event) => reactivity_esmBundler.unref(mouseClickHandle)($event, item),
                            onMousedown: ($event) => reactivity_esmBundler.unref(mousedownHandle)($event, item),
                            onMouseenter: ($event) => reactivity_esmBundler.unref(mouseenterHandle)($event, item),
                            onMouseleave: ($event) => reactivity_esmBundler.unref(mouseleaveHandle)($event, item),
                            onContextmenu: ($event) => reactivity_esmBundler.unref(handleContextMenu)($event, item, optionsHandle)
                          }, {
                            default: runtimeCore_esmBundler.withCtx(() => [
                              (runtimeCore_esmBundler.openBlock(), runtimeCore_esmBundler.createBlock(runtimeCore_esmBundler.resolveDynamicComponent(item.chartConfig.chartKey), {
                                class: shared_esmBundler.normalizeClass(["edit-content-chart", reactivity_esmBundler.unref(style.animationsClass)(item.styles.animations)]),
                                chartConfig: item,
                                themeSetting: themeSetting.value,
                                themeColor: themeColor.value,
                                style: shared_esmBundler.normalizeStyle({
                                  ...reactivity_esmBundler.unref(useStyle_hook.useSizeStyle)(item.attr),
                                  ...reactivity_esmBundler.unref(style.getFilterStyle)(item.styles),
                                  ...reactivity_esmBundler.unref(style.getTransformStyle)(item.styles)
                                })
                              }, null, 8, ["class", "chartConfig", "themeSetting", "themeColor", "style"]))
                            ]),
                            _: 2
                          }, 1032, ["data-id", "index", "style", "item", "onClick", "onMousedown", "onMouseenter", "onMouseleave", "onContextmenu"]))
                        ]);
                      }), 128))
                    ], 4)
                  ]),
                  _: 1
                })
              ], 32)
            ]),
            _: 1
          })
        ]),
        _: 1
      }, 8, ["onMousedown", "onDrop", "onDragover", "onDragenter"]);
    };
  }
});
exports.default = _sfc_main;
