"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                                                               */
const Vue = require("vue");
const index$1 = ;/* empty css                      */
const defaultProcessData = require("../eventFlow/defaultProcessData.js");
const common = require("../utils/common.js");
;/* empty css                                                              */
;/* empty css                                                                */
;/* empty css              */
const _pluginVue_exportHelper = require("../../../../_virtual/_plugin-vue_export-helper.js");
const index = require("../../../../node_modules/element-plus/es/components/dialog/index.js");
const index$2 = require("../../../../node_modules/element-plus/es/components/button/index.js");
const index$3 = require("../../../../node_modules/element-plus/es/components/message/index.js");
const _hoisted_1 = { style: { "border": "1px solid #ebeef5", "border-radius": "4px", "height": "600px", "overflow": "auto", "background-color": "#f2f3f5" } };
const _hoisted_2 = { class: "dialog-footer" };
const _sfc_main = {
  __name: "onlyFlow",
  props: /* @__PURE__ */ Vue.mergeModels({
    eventConfig: {
      type: Object,
      default: {}
    },
    title: {
      type: String,
      default: "事件配置"
    },
    onConfirm: Function
  }, {
    "modelValue": { required: true },
    "modelModifiers": {}
  }),
  emits: ["update:modelValue"],
  setup(__props) {
    const dialogVisible = Vue.useModel(__props, "modelValue");
    const props = __props;
    const createEventFlow = () => JSON.parse(JSON.stringify(defaultProcessData.default));
    const eventConfigData = Vue.ref(props.eventConfig || createEventFlow());
    const eventFlowRef = Vue.ref(null);
    const onConfirm = async () => {
      var _a;
      try {
        if ((_a = eventFlowRef.value) == null ? void 0 : _a.validate) {
          await eventFlowRef.value.validate();
        }
        props.onConfirm && props.onConfirm(common.cloneDeep(eventConfigData.value));
        dialogVisible.value = false;
      } catch (error) {
        console.error("事件流校验失败:", error);
        index$3.ElMessage.error("请完善事件配置");
      }
    };
    return (_ctx, _cache) => {
      const _component_el_button = index$2.ElButton;
      const _component_el_dialog = index.ElDialog;
      return Vue.openBlock(), Vue.createBlock(_component_el_dialog, {
        modelValue: dialogVisible.value,
        "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => dialogVisible.value = $event),
        width: "50%",
        title: __props.title,
        draggable: "",
        overflow: "",
        "append-to-body": "",
        class: "fec-dev-designer-dialog"
      }, {
        footer: Vue.withCtx(() => [
          Vue.createElementVNode("div", _hoisted_2, [
            Vue.createVNode(_component_el_button, {
              onClick: _cache[0] || (_cache[0] = ($event) => dialogVisible.value = false)
            }, {
              default: Vue.withCtx(() => _cache[2] || (_cache[2] = [
                Vue.createTextVNode("取消")
              ])),
              _: 1
            }),
            Vue.createVNode(_component_el_button, {
              type: "primary",
              onClick: onConfirm
            }, {
              default: Vue.withCtx(() => _cache[3] || (_cache[3] = [
                Vue.createTextVNode(" 确定 ")
              ])),
              _: 1
            })
          ])
        ]),
        default: Vue.withCtx(() => [
          Vue.createElementVNode("div", _hoisted_1, [
            Vue.createVNode(index$1.default, {
              ref_key: "eventFlowRef",
              ref: eventFlowRef,
              process: eventConfigData.value
            }, null, 8, ["process"])
          ])
        ]),
        _: 1
      }, 8, ["modelValue", "title"]);
    };
  }
};
const OnlyFlowDialog = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-497a8403"]]);
exports.default = OnlyFlowDialog;
