"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
require("../../../../../../node_modules/element-plus/es/index.js");
;/* empty css                                                                */
;/* empty css                                                                    */
;/* empty css                                                                        */
;/* empty css                                                                     */
;/* empty css                                                                     */
;/* empty css                                                                   */
;/* empty css                                                                   */
;/* empty css                                                                        */
;/* empty css                                                                     */
require("../../../../../../node_modules/element-plus/theme-chalk/el-tooltip.css.js");
;/* empty css                                                                   */
require("../../../../../../node_modules/element-plus/theme-chalk/el-sub-menu.css.js");
require("../../../../../../node_modules/element-plus/theme-chalk/el-menu-item.css.js");
const Vue = require("vue");
const config = require("./config.js");
const Advanced = require("./Advanced.vue.js");
const common = require("../../../utils/common.js");
;/* empty css           */
const _pluginVue_exportHelper = require("../../../../../../_virtual/_plugin-vue_export-helper.js");
const index = require("../../../../../../node_modules/element-plus/es/components/container/index.js");
const index$1 = require("../../../../../../node_modules/element-plus/es/components/icon/index.js");
const index$2 = require("../../../../../../node_modules/element-plus/es/components/scrollbar/index.js");
const index$3 = require("../../../../../../node_modules/element-plus/es/components/menu/index.js");
const index$4 = require("../../../../../../node_modules/element-plus/es/components/form/index.js");
const _hoisted_1 = { class: "menu-header" };
const _hoisted_2 = { class: "category-title" };
const _hoisted_3 = { class: "menu-item-text" };
const _hoisted_4 = { class: "action-desc" };
const _sfc_main = {
  __name: "index",
  props: {
    activeData: Object
  },
  setup(__props) {
    const props = __props;
    const selectedMenu = Vue.ref("");
    const selectedComponent = Vue.ref();
    const activeIndex = Vue.ref("");
    const handleMenuSelect = (index2) => {
      activeIndex.value = index2;
      props.activeData.actionType = index2;
      const findItem = (index3) => {
        for (const category of config.default) {
          const item = category.items.find((i) => i.index === index3);
          if (item) return item;
        }
        return null;
      };
      const menuItem = findItem(index2);
      selectedComponent.value = menuItem == null ? void 0 : menuItem.component;
      props.activeData.actionName = menuItem == null ? void 0 : menuItem.label;
      props.activeData.basic = {
        ...common.cloneDeep(menuItem.default),
        ...props.activeData.basic
      };
      selectedMenu.value = menuItem;
    };
    Vue.watch(
      () => props.activeData.actionType,
      (newActionType) => {
        if (newActionType) {
          handleMenuSelect(newActionType);
        } else if (config.default.length > 0 && config.default[0].items.length > 0) {
          const firstItem = config.default[0].items[0];
          activeIndex.value = firstItem.index;
          handleMenuSelect(firstItem.index);
        }
      },
      { immediate: true }
    );
    return (_ctx, _cache) => {
      const _component_setting = Vue.resolveComponent("setting");
      const _component_el_icon = index$1.ElIcon;
      const _component_el_menu_item = index$3.ElMenuItem;
      const _component_el_sub_menu = index$3.ElSubMenu;
      const _component_el_menu = index$3.ElMenu;
      const _component_el_scrollbar = index$2.ElScrollbar;
      const _component_el_aside = index.ElAside;
      const _component_el_header = index.ElHeader;
      const _component_el_form = index$4.ElForm;
      const _component_el_main = index.ElMain;
      const _component_el_container = index.ElContainer;
      return Vue.openBlock(), Vue.createBlock(_component_el_container, {
        class: "action-dialog",
        style: { "height": "500px" }
      }, {
        default: Vue.withCtx(() => [
          Vue.createVNode(_component_el_aside, {
            width: "220px",
            style: { "border-right": "1px solid #ebeef5" }
          }, {
            default: Vue.withCtx(() => [
              Vue.createElementVNode("div", _hoisted_1, [
                Vue.createVNode(_component_el_icon, { class: "header-icon" }, {
                  default: Vue.withCtx(() => [
                    Vue.createVNode(_component_setting)
                  ]),
                  _: 1
                }),
                _cache[0] || (_cache[0] = Vue.createElementVNode("span", { class: "dev-header-title" }, "执行动作", -1))
              ]),
              Vue.createVNode(_component_el_scrollbar, { class: "menu-scrollbar" }, {
                default: Vue.withCtx(() => [
                  Vue.createVNode(_component_el_menu, {
                    "default-openeds": ["page"],
                    "default-active": Vue.unref(activeIndex),
                    onSelect: handleMenuSelect,
                    "background-color": "transparent",
                    "text-color": "#606266",
                    "active-text-color": "#409eff"
                  }, {
                    default: Vue.withCtx(() => [
                      (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(Vue.unref(config.default), (category) => {
                        return Vue.openBlock(), Vue.createBlock(_component_el_sub_menu, {
                          key: category.index,
                          index: category.index,
                          class: "menu-category"
                        }, {
                          title: Vue.withCtx(() => [
                            Vue.createElementVNode("div", _hoisted_2, [
                              Vue.createVNode(_component_el_icon, { class: "category-icon" }, {
                                default: Vue.withCtx(() => [
                                  Vue.createVNode(_component_setting)
                                ]),
                                _: 1
                              }),
                              Vue.createElementVNode("span", null, Vue.toDisplayString(category.label), 1)
                            ])
                          ]),
                          default: Vue.withCtx(() => [
                            (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(category.items, (item) => {
                              return Vue.openBlock(), Vue.createBlock(_component_el_menu_item, {
                                key: item.index,
                                index: item.index,
                                class: "menu-item"
                              }, {
                                default: Vue.withCtx(() => [
                                  Vue.createElementVNode("span", _hoisted_3, Vue.toDisplayString(item.label), 1)
                                ]),
                                _: 2
                              }, 1032, ["index"]);
                            }), 128))
                          ]),
                          _: 2
                        }, 1032, ["index"]);
                      }), 128))
                    ]),
                    _: 1
                  }, 8, ["default-active"])
                ]),
                _: 1
              })
            ]),
            _: 1
          }),
          Vue.createVNode(_component_el_main, { style: { "padding": "0" } }, {
            default: Vue.withCtx(() => [
              Vue.createVNode(_component_el_container, { style: { "height": "100%" } }, {
                default: Vue.withCtx(() => [
                  Vue.createVNode(_component_el_header, { height: "40px" }, {
                    default: Vue.withCtx(() => [
                      _cache[1] || (_cache[1] = Vue.createElementVNode("div", null, "动作说明", -1)),
                      Vue.createElementVNode("div", _hoisted_4, Vue.toDisplayString(Vue.unref(selectedMenu).desc), 1)
                    ]),
                    _: 1
                  }),
                  Vue.createVNode(_component_el_main, { style: { "padding": "12px 20px 0 20px" } }, {
                    default: Vue.withCtx(() => [
                      Vue.createVNode(_component_el_scrollbar, null, {
                        default: Vue.withCtx(() => [
                          Vue.unref(selectedComponent) ? (Vue.openBlock(), Vue.createElementBlock(Vue.Fragment, { key: 0 }, [
                            _cache[2] || (_cache[2] = Vue.createElementVNode("div", { class: "event-behavior-title" }, "基础配置", -1)),
                            Vue.createVNode(_component_el_form, {
                              model: __props.activeData.basic,
                              "label-width": "100px",
                              size: "small",
                              style: { "padding-right": "20px" }
                            }, {
                              default: Vue.withCtx(() => [
                                (Vue.openBlock(), Vue.createBlock(Vue.resolveDynamicComponent(Vue.unref(selectedComponent)), {
                                  formData: __props.activeData.basic,
                                  type: Vue.unref(selectedMenu).index
                                }, null, 8, ["formData", "type"]))
                              ]),
                              _: 1
                            }, 8, ["model"])
                          ], 64)) : Vue.createCommentVNode("", true),
                          _cache[3] || (_cache[3] = Vue.createElementVNode("div", { class: "event-behavior-title" }, "高级配置", -1)),
                          Vue.createVNode(_component_el_form, {
                            model: __props.activeData.advanced,
                            "label-width": "100px",
                            size: "small"
                          }, {
                            default: Vue.withCtx(() => [
                              Vue.createVNode(Advanced.default, {
                                formData: __props.activeData.advanced
                              }, null, 8, ["formData"])
                            ]),
                            _: 1
                          }, 8, ["model"])
                        ]),
                        _: 1
                      })
                    ]),
                    _: 1
                  })
                ]),
                _: 1
              })
            ]),
            _: 1
          })
        ]),
        _: 1
      });
    };
  }
};
const Action = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-d155ddb6"]]);
exports.default = Action;
