'use strict';

var vue = require('vue');
require('./second-confirmation.vue.js');
var secondConfirmation_vue_vue_type_script_setup_true_lang = require('./second-confirmation.vue2.js');

"use strict";
const useSecondConfirmation = (options) => {
  const { title, message, confirmText, cancelText, icon = null } = options;
  return new Promise((resolve, reject) => {
    const confirmInstance = vue.createApp(secondConfirmation_vue_vue_type_script_setup_true_lang.default, {
      open: true,
      title: title || "\u6E29\u99A8\u63D0\u793A",
      message: message || "\u4F60\u6709\u672A\u4FDD\u5B58\u7684\u66F4\u6539\uFF0C\u786E\u5B9A\u5173\u95ED\uFF1F",
      confirmText,
      cancelText,
      icon,
      onConfirm: () => {
        resolve(true);
        unmount();
      },
      onCancel: () => {
        reject(new Error());
        unmount();
      }
    });
    const unmount = () => {
      confirmInstance.unmount();
      document.body.removeChild(parentNode);
    };
    const parentNode = document.createElement("div");
    document.body.appendChild(parentNode);
    confirmInstance.mount(parentNode);
  });
};

exports.useSecondConfirmation = useSecondConfirmation;
//# sourceMappingURL=use-second-confirmation.js.map
