"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");
const designStore = require("../../../../../store/modules/designStore/designStore.js");
const chartEditStore = require("../../../../../store/modules/chartEditStore/chartEditStore.js");
const useContextMenu_hook = require("../../../hooks/useContextMenu.hook.js");
const chartLayoutStore_d = require("../../../../../store/modules/chartLayoutStore/chartLayoutStore.d.js");
const index$1 = require("../LayersListItem/index.vue.js");
const index = require("../LayersStatus/index.vue.js");
require("../../../../../../node_modules/.pnpm/vue3-lazyload@0.2.5-beta_a6dezdz3je235ci4e3tu4rayna/node_modules/vue3-lazyload/dist/vue3-lazyload.esm.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");
require("../../../../../settings/designSetting.js");
require("../../../../../components/GoLoading/index.js");
require("../../../../../components/GoSkeleton/index.vue.js");
const icon = require("../../../../../plugins/icon.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 runtimeDom_esmBundler = require("../../../../../../node_modules/.pnpm/@vue_runtime-dom@3.3.4/node_modules/@vue/runtime-dom/dist/runtime-dom.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 _hoisted_1 = { class: "go-content-layers-group-list-item" };
const _hoisted_2 = { class: "go-flex-items-center item-content" };
const _sfc_main = /* @__PURE__ */ runtimeCore_esmBundler.defineComponent({
  __name: "index",
  props: {
    componentGroupData: {
      type: Object,
      required: true
    },
    layerMode: {
      type: String,
      default: chartLayoutStore_d.LayerModeEnum.THUMBNAIL
    }
  },
  setup(__props) {
    const props = __props;
    runtimeDom_esmBundler.useCssVars((_ctx) => ({
      "e947bda8": themeColor.value
    }));
    [editPageEnum.MenuEnum.UN_GROUP];
    const designStore$1 = designStore.useDesignStore();
    const { FolderIcon, FolderOpenIcon } = icon.icon.ionicons5;
    const chartEditStore$1 = chartEditStore.useChartEditStore();
    const { handleContextMenu, onClickOutSide } = useContextMenu_hook.useContextMenu();
    const expend = reactivity_esmBundler.ref(false);
    const themeColor = runtimeCore_esmBundler.computed(() => {
      return designStore$1.getAppTheme;
    });
    const selectText = runtimeCore_esmBundler.computed(() => {
      return props.layerMode === chartLayoutStore_d.LayerModeEnum.TEXT;
    });
    const select = runtimeCore_esmBundler.computed(() => {
      const id = props.componentGroupData.id;
      return chartEditStore$1.getTargetChart.selectId.find((e) => e === id);
    });
    const hover = runtimeCore_esmBundler.computed(() => {
      return props.componentGroupData.id === chartEditStore$1.getTargetChart.hoverId;
    });
    const status = runtimeCore_esmBundler.computed(() => {
      return props.componentGroupData.status;
    });
    const optionsHandle = (targetList, allList, targetInstance) => {
      const filter = (menulist) => {
        return allList.filter((i) => menulist.includes(i.key));
      };
      if (chartEditStore$1.getTargetChart.selectId.length > 1) {
        return filter([editPageEnum.MenuEnum.GROUP]);
      } else {
        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 [
          ...filter([editPageEnum.MenuEnum.UN_GROUP]),
          useContextMenu_hook.divider(),
          ...targetList.filter((i) => !statusMenuEnums.includes(i.key))
        ];
      }
    };
    const clickHandle = (e) => {
      var _a;
      if ((_a = window.$KeyboardActive) == null ? void 0 : _a.ctrl)
        return;
      expend.value = !expend.value;
      mousedownHandle(e, props.componentGroupData);
    };
    const groupMousedownHandle = (e) => {
      var _a;
      onClickOutSide();
      const id = props.componentGroupData.id;
      if (e.buttons === editPageEnum.MouseEventButton.LEFT && ((_a = window.$KeyboardActive) == null ? void 0 : _a.ctrl)) {
        if (chartEditStore$1.targetChart.selectId.includes(id)) {
          const exList = chartEditStore$1.targetChart.selectId.filter((e2) => e2 !== id);
          chartEditStore$1.setTargetSelectChart(exList);
        } else {
          chartEditStore$1.setTargetSelectChart(id, true);
        }
        return;
      }
      chartEditStore$1.setTargetSelectChart(id);
    };
    const mousedownHandle = (e, componentInstance, id) => {
      e.preventDefault();
      e.stopPropagation();
      onClickOutSide();
      chartEditStore$1.setTargetSelectChart(id || componentInstance.id);
    };
    const mouseenterHandle = (componentInstance) => {
      chartEditStore$1.setTargetHoverChart(componentInstance.id);
    };
    const mouseleaveHandle = (componentInstance) => {
      chartEditStore$1.setTargetHoverChart(void 0);
    };
    return (_ctx, _cache) => {
      const _component_n_icon = runtimeCore_esmBundler.resolveComponent("n-icon");
      const _component_n_text = runtimeCore_esmBundler.resolveComponent("n-text");
      const _component_n_ellipsis = runtimeCore_esmBundler.resolveComponent("n-ellipsis");
      const _component_n_collapse_transition = runtimeCore_esmBundler.resolveComponent("n-collapse-transition");
      return runtimeCore_esmBundler.openBlock(), runtimeCore_esmBundler.createElementBlock("div", _hoisted_1, [
        runtimeCore_esmBundler.createElementVNode("div", {
          class: shared_esmBundler.normalizeClass(["root-item-content", { hover: hover.value, select: select.value, "list-mini": selectText.value }]),
          onClick: _cache[0] || (_cache[0] = ($event) => clickHandle($event)),
          onMousedown: _cache[1] || (_cache[1] = ($event) => groupMousedownHandle($event)),
          onMouseenter: _cache[2] || (_cache[2] = ($event) => mouseenterHandle(__props.componentGroupData)),
          onMouseleave: _cache[3] || (_cache[3] = ($event) => mouseleaveHandle(__props.componentGroupData)),
          onContextmenu: _cache[4] || (_cache[4] = ($event) => reactivity_esmBundler.unref(handleContextMenu)($event, __props.componentGroupData, optionsHandle))
        }, [
          runtimeCore_esmBundler.createElementVNode("div", _hoisted_2, [
            runtimeCore_esmBundler.createVNode(_component_n_icon, {
              size: "20",
              class: "go-ml-1"
            }, {
              default: runtimeCore_esmBundler.withCtx(() => [
                expend.value ? (runtimeCore_esmBundler.openBlock(), runtimeCore_esmBundler.createBlock(reactivity_esmBundler.unref(FolderOpenIcon), { key: 0 })) : (runtimeCore_esmBundler.openBlock(), runtimeCore_esmBundler.createBlock(reactivity_esmBundler.unref(FolderIcon), { key: 1 }))
              ]),
              _: 1
            }),
            runtimeCore_esmBundler.createVNode(_component_n_ellipsis, { style: { "margin-right": "auto" } }, {
              default: runtimeCore_esmBundler.withCtx(() => [
                runtimeCore_esmBundler.createVNode(_component_n_text, {
                  class: "go-ml-2 list-text",
                  depth: 2
                }, {
                  default: runtimeCore_esmBundler.withCtx(() => [
                    runtimeCore_esmBundler.createTextVNode(shared_esmBundler.toDisplayString(__props.componentGroupData.chartConfig.title), 1)
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }),
            runtimeCore_esmBundler.createVNode(reactivity_esmBundler.unref(index.default), {
              isGroup: false,
              hover: hover.value,
              status: status.value
            }, null, 8, ["hover", "status"])
          ]),
          runtimeCore_esmBundler.createElementVNode("div", {
            class: shared_esmBundler.normalizeClass({ "select-modal": select.value })
          }, null, 2)
        ], 34),
        runtimeCore_esmBundler.createVNode(_component_n_collapse_transition, { show: expend.value }, {
          default: runtimeCore_esmBundler.withCtx(() => [
            (runtimeCore_esmBundler.openBlock(true), runtimeCore_esmBundler.createElementBlock(runtimeCore_esmBundler.Fragment, null, runtimeCore_esmBundler.renderList(__props.componentGroupData.groupList, (element) => {
              return runtimeCore_esmBundler.openBlock(), runtimeCore_esmBundler.createBlock(reactivity_esmBundler.unref(index$1.default), {
                key: element.id,
                componentData: element,
                "layer-mode": __props.layerMode,
                isGroup: true,
                onMousedown: ($event) => mousedownHandle($event, element, __props.componentGroupData.id),
                onMouseenter: ($event) => mouseenterHandle(element),
                onMouseleave: ($event) => mouseleaveHandle(element),
                onContextmenu: _cache[5] || (_cache[5] = ($event) => reactivity_esmBundler.unref(handleContextMenu)($event, __props.componentGroupData, optionsHandle))
              }, null, 8, ["componentData", "layer-mode", "onMousedown", "onMouseenter", "onMouseleave"]);
            }), 128))
          ]),
          _: 1
        }, 8, ["show"])
      ]);
    };
  }
});
exports.default = _sfc_main;
