"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _vue = _interopRequireWildcard(require("vue"));

var _Modal = _interopRequireWildcard(require("./Modal"));

var _confirm = _interopRequireDefault(require("./confirm"));

var _InfoCircleOutlined = _interopRequireDefault(require("@ant-design/icons-vue/InfoCircleOutlined"));

var _CheckCircleOutlined = _interopRequireDefault(require("@ant-design/icons-vue/CheckCircleOutlined"));

var _CloseCircleOutlined = _interopRequireDefault(require("@ant-design/icons-vue/CloseCircleOutlined"));

var _ExclamationCircleOutlined = _interopRequireDefault(require("@ant-design/icons-vue/ExclamationCircleOutlined"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

// export { ActionButtonProps } from './ActionButton'
// export { ModalProps, ModalFuncProps } from './Modal'
var info = function info(props) {
  var config = _objectSpread({
    type: 'info',
    icon: _vue.createVNode(_InfoCircleOutlined.default, null, null),
    okCancel: false
  }, props);

  return (0, _confirm.default)(config);
};

var success = function success(props) {
  var config = _objectSpread({
    type: 'success',
    icon: _vue.createVNode(_CheckCircleOutlined.default, null, null),
    okCancel: false
  }, props);

  return (0, _confirm.default)(config);
};

var error = function error(props) {
  var config = _objectSpread({
    type: 'error',
    icon: _vue.createVNode(_CloseCircleOutlined.default, null, null),
    okCancel: false
  }, props);

  return (0, _confirm.default)(config);
};

var warning = function warning(props) {
  var config = _objectSpread({
    type: 'warning',
    icon: _vue.createVNode(_ExclamationCircleOutlined.default, null, null),
    okCancel: false
  }, props);

  return (0, _confirm.default)(config);
};

var warn = warning;

var confirm = function confirmFn(props) {
  var config = _objectSpread({
    type: 'confirm',
    okCancel: true
  }, props);

  return (0, _confirm.default)(config);
};

_Modal.default.info = info;
_Modal.default.success = success;
_Modal.default.error = error;
_Modal.default.warning = warning;
_Modal.default.warn = warn;
_Modal.default.confirm = confirm;

_Modal.default.destroyAll = function destroyAllFn() {
  while (_Modal.destroyFns.length) {
    var close = _Modal.destroyFns.pop();

    if (close) {
      close();
    }
  }
};
/* istanbul ignore next */


_Modal.default.install = function (app) {
  app.component(_Modal.default.name, _Modal.default);
};

var _default = _Modal.default;
exports.default = _default;