import * as _vue from "vue";

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; }

import Modal, { destroyFns } from './Modal';
import modalConfirm from './confirm';
import InfoCircleOutlined from '@ant-design/icons-vue/InfoCircleOutlined';
import CheckCircleOutlined from '@ant-design/icons-vue/CheckCircleOutlined';
import CloseCircleOutlined from '@ant-design/icons-vue/CloseCircleOutlined';
import ExclamationCircleOutlined from '@ant-design/icons-vue/ExclamationCircleOutlined'; // export { ActionButtonProps } from './ActionButton'
// export { ModalProps, ModalFuncProps } from './Modal'

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

  return modalConfirm(config);
};

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

  return modalConfirm(config);
};

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

  return modalConfirm(config);
};

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

  return modalConfirm(config);
};

var warn = warning;

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

  return modalConfirm(config);
};

Modal.info = info;
Modal.success = success;
Modal.error = error;
Modal.warning = warning;
Modal.warn = warn;
Modal.confirm = confirm;

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

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


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

export default Modal;