"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];

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

var _isPromise = _interopRequireDefault(require("is-promise"));

var now = Date.now();
var seed = 0;
var manager = {
  config: {
    duration: 4.5,
    top: 24,
    bottom: 24,
    placement: 'topRight',
    icons: {
      success: 'check',
      info: 'info',
      error: 'error',
      warning: 'warning',
      loading: 'loading'
    }
  },
  instances: new Map(),
  remove: function remove(key) {
    this.instances.forEach(function (instance) {
      if ((0, _isPromise["default"])(instance)) {
        instance.then(function (ins) {
          return ins.removeNotice(key);
        });
      } else {
        instance.removeNotice(key);
      }
    });
  },
  clear: function clear() {
    var instances = this.instances;
    instances.forEach(function (instance) {
      if ((0, _isPromise["default"])(instance)) {
        instance.then(function (ins) {
          return ins.destroy();
        });
      } else {
        instance.destroy();
      }
    });
    instances.clear();
  },
  getUuid: function getUuid() {
    return "c7nNotification_".concat(now, "_").concat(seed++);
  }
};
var _default = manager;
exports["default"] = _default;
//# sourceMappingURL=index.js.map
