import { useAttrs as w, ref as y, resolveComponent as r, createBlock as v, openBlock as k, mergeProps as C, unref as S, withCtx as n, renderSlot as u, createVNode as d, createTextVNode as a, toDisplayString as l, createElementVNode as f } from "vue";
import { _ as $ } from "./install-BuMO14Rb.js";
const h = { class: "wt-confirm-dialog__content" }, D = { class: "wt-confirm-dialog__message" }, j = {
  __name: "wt-confirm-dialog",
  props: {
    title: {
      type: String,
      required: !0
    },
    deleteMessage: {
      type: String,
      default: ""
    },
    subject: {
      type: String,
      default: ""
    },
    callback: {
      type: Function,
      required: !0
    }
  },
  emits: [
    "close",
    "confirm"
  ],
  setup(e, { emit: m }) {
    const p = e, g = m, _ = w(), t = y(!1);
    function s() {
      g("close");
    }
    async function i() {
      try {
        t.value = !0, await p.callback(), s();
      } finally {
        t.value = !1;
      }
    }
    return (o, M) => {
      const c = r("wt-button"), b = r("wt-popup");
      return k(), v(b, C(S(_), {
        class: "wt-confirm-dialog",
        size: "sm"
      }, { onClose: s }), {
        title: n(() => [
          a(l(e.title), 1)
        ]),
        main: n(() => [
          u(o.$slots, "main", {}, () => [
            f("div", h, [
              f("p", D, l(e.deleteMessage ? e.deleteMessage : o.$t("webitelUI.deleteConfirmationPopup.askingAlert", {
                subject: e.subject
              })), 1)
            ])
          ], !0)
        ]),
        actions: n(() => [
          u(o.$slots, "actions", {
            isDeleting: t.value,
            confirm: i,
            close: s
          }, () => [
            d(c, {
              disabled: t.value,
              color: "secondary",
              onClick: s
            }, {
              default: n(() => [
                a(l(o.$t("reusable.cancel")), 1)
              ], void 0, !0),
              _: 1
            }, 8, ["disabled"]),
            d(c, {
              loading: t.value,
              color: "error",
              onClick: i
            }, {
              default: n(() => [
                a(l(o.$t("reusable.delete")), 1)
              ], void 0, !0),
              _: 1
            }, 8, ["loading"])
          ], !0)
        ]),
        _: 3
      }, 16);
    };
  }
}, q = /* @__PURE__ */ $(j, [["__scopeId", "data-v-517c5b4a"]]);
export {
  q as default
};
