import "../../../../node_modules/element-plus/es/index.mjs";
/* empty css                                                          */
/* empty css                                                                */
/* empty css                                                               */
/* empty css                                                               */
import { mergeModels, useModel, computed, ref, createBlock, openBlock, withCtx, createCommentVNode, unref, isRef, createElementVNode, createVNode, createTextVNode } from "vue";
import DataLinkage from "./index.vue.mjs";
import { getEditConfigData, cloneDeep } from "../utils/common.mjs";
/* empty css             */
import _export_sfc from "../../../../_virtual/_plugin-vue_export-helper.mjs";
import { ElDialog } from "../../../../node_modules/element-plus/es/components/dialog/index.mjs";
import { ElButton } from "../../../../node_modules/element-plus/es/components/button/index.mjs";
const _hoisted_1 = { class: "dialog-footer" };
const _sfc_main = {
  __name: "dialog",
  props: /* @__PURE__ */ mergeModels({
    title: {
      type: String,
      default: "联动配置"
    }
  }, {
    "modelValue": { required: true },
    "modelModifiers": {}
  }),
  emits: ["update:modelValue"],
  setup(__props) {
    const dialogVisible = useModel(__props, "modelValue");
    const props = __props;
    const editConfigData = computed(() => {
      return getEditConfigData();
    });
    const linkedConfigData = ref(cloneDeep(editConfigData.value.linkedConfig));
    const onConfirm = () => {
      editConfigData.value.linkedConfig = cloneDeep(linkedConfigData.value);
      dialogVisible.value = false;
    };
    return (_ctx, _cache) => {
      const _component_el_button = ElButton;
      const _component_el_dialog = ElDialog;
      return openBlock(), createBlock(_component_el_dialog, {
        modelValue: dialogVisible.value,
        "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => dialogVisible.value = $event),
        width: "50%",
        title: props.title,
        draggable: "",
        overflow: "",
        "append-to-body": "",
        class: "fec-dev-designer-dialog"
      }, {
        footer: withCtx(() => [
          createElementVNode("div", _hoisted_1, [
            createVNode(_component_el_button, {
              onClick: _cache[1] || (_cache[1] = ($event) => dialogVisible.value = false),
              size: "default"
            }, {
              default: withCtx(() => _cache[3] || (_cache[3] = [
                createTextVNode("取消")
              ])),
              _: 1
            }),
            createVNode(_component_el_button, {
              type: "primary",
              onClick: onConfirm,
              size: "default"
            }, {
              default: withCtx(() => _cache[4] || (_cache[4] = [
                createTextVNode("确定")
              ])),
              _: 1
            })
          ])
        ]),
        default: withCtx(() => [
          dialogVisible.value ? (openBlock(), createBlock(DataLinkage, {
            key: 0,
            linkedConfig: unref(linkedConfigData),
            "onUpdate:linkedConfig": _cache[0] || (_cache[0] = ($event) => isRef(linkedConfigData) ? linkedConfigData.value = $event : null)
          }, null, 8, ["linkedConfig"])) : createCommentVNode("", true)
        ]),
        _: 1
      }, 8, ["modelValue", "title"]);
    };
  }
};
const DataLinkageDialog = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-86f3da95"]]);
export {
  DataLinkageDialog as default
};
