import { GmMessageBox } from '../messageBox/index.mjs';

const confirmBox = async (options, handle) => {
  await GmMessageBox.confirm(options.message, options.title || "\u7CFB\u7EDF\u63D0\u793A", {
    confirmButtonText: "\u786E\u5B9A",
    cancelButtonText: "\u53D6\u6D88",
    type: "warning",
    beforeClose: async (action, instance, done) => {
      if (action === "confirm") {
        instance.confirmButtonLoading = true;
        try {
          await handle?.();
          done();
          instance.confirmButtonDisabled = true;
        } finally {
          instance.confirmButtonLoading = false;
        }
      } else {
        done();
      }
    }
  });
};

export { confirmBox };
//# sourceMappingURL=method.mjs.map
