import { toRef as f, inject as g, defineComponent as b, openBlock as C, createBlock as D, unref as i, mergeProps as k, withCtx as p, renderSlot as u, createElementBlock as O, createVNode as m, createTextVNode as y, toDisplayString as v } from "vue";
import { ElDialog as w, ElButton as B } from "element-plus";
const P = Symbol("ModalStateToken"), S = Symbol("ModalIdToken"), V = () => g(P, {}), A = () => g(S, "");
function F() {
  const {
    store: c,
    action: n,
    modalPromise: t
  } = V(), o = A(), s = c[o], a = (r) => n == null ? void 0 : n.show(o, r), d = () => n == null ? void 0 : n.hide(o), e = () => n == null ? void 0 : n.remove(o), l = (r) => t[o].resolve(r), T = (r) => t[o].reject(r);
  return {
    show: a,
    hide: d,
    visible: f(s, "visible"),
    args: f(s, "args"),
    remove: e,
    resolve: l,
    reject: T
  };
}
const M = /* @__PURE__ */ b({
  name: "FsDialog",
  __name: "FsDialog",
  props: {
    removeOnClosed: { type: Boolean, default: !0 },
    appendToBody: { type: Boolean },
    appendTo: {},
    beforeClose: {},
    destroyOnClose: { type: Boolean },
    closeOnClickModal: { type: Boolean, default: !0 },
    closeOnPressEscape: { type: Boolean, default: !0 },
    lockScroll: { type: Boolean, default: !0 },
    modal: { type: Boolean, default: !0 },
    openDelay: { default: 0 },
    closeDelay: { default: 0 },
    top: {},
    modelValue: { type: Boolean },
    modalClass: {},
    width: {},
    zIndex: {},
    trapFocus: { type: Boolean },
    headerAriaLevel: {},
    center: { type: Boolean },
    alignCenter: { type: Boolean },
    closeIcon: {},
    draggable: { type: Boolean },
    overflow: { type: Boolean },
    fullscreen: { type: Boolean },
    showClose: { type: Boolean, default: !0 },
    title: {},
    ariaLevel: {}
  },
  emits: ["open", "opened", "close", "closed", "openAutoFocus", "closeAutoFocus"],
  setup(c, { emit: n }) {
    const t = c, o = n, s = () => {
      o("closed", a.visible.value), t.removeOnClosed && a.remove();
    }, a = F();
    return (d, e) => (C(), D(i(w), k(t, {
      modelValue: i(a).visible.value,
      "onUpdate:modelValue": e[0] || (e[0] = (l) => i(a).visible.value = l),
      onOpen: e[1] || (e[1] = (l) => o("open", l)),
      onOpened: e[2] || (e[2] = (l) => o("opened", l)),
      onCloseAutoFocus: e[3] || (e[3] = (l) => o("closeAutoFocus", l)),
      onClose: e[4] || (e[4] = (l) => o("close", l)),
      onClosed: s
    }), {
      header: p(() => [
        u(d.$slots, "header")
      ]),
      footer: p(() => [
        u(d.$slots, "footer")
      ]),
      default: p(() => [
        u(d.$slots, "default")
      ]),
      _: 3
    }, 16, ["modelValue"]));
  }
}), L = { class: "dialog-footer" }, $ = /* @__PURE__ */ b({
  name: "FsPopupFooter",
  __name: "FsPopupFooter",
  props: {
    confirmLoading: { type: Boolean },
    confirmText: { default: "确认" },
    cancelText: { default: "取消" },
    confirmType: { default: "primary" },
    cancelType: { default: "default" },
    confirmDisabled: { type: Boolean, default: !1 },
    cancelDisabled: { type: Boolean, default: !1 }
  },
  emits: ["confirm", "cancel"],
  setup(c, { emit: n }) {
    const t = F(), o = (e) => {
      t.hide(), t.resolve(e);
    }, s = n, a = () => {
      s("confirm", o);
    }, d = () => {
      s("cancel", o);
    };
    return (e, l) => (C(), O("div", L, [
      m(i(B), {
        type: e.cancelType,
        disabled: e.cancelDisabled,
        loading: e.confirmLoading,
        onClick: d
      }, {
        default: p(() => [
          y(v(e.cancelText), 1)
        ]),
        _: 1
      }, 8, ["type", "disabled", "loading"]),
      m(i(B), {
        type: e.confirmType,
        disabled: e.confirmDisabled,
        loading: e.confirmLoading,
        onClick: a
      }, {
        default: p(() => [
          y(v(e.confirmText), 1)
        ]),
        _: 1
      }, 8, ["type", "disabled", "loading"])
    ]));
  }
});
export {
  M as FsDialog,
  $ as FsPopupFooter
};
//# sourceMappingURL=index.mjs.map
