"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;exports.__esModule = true;exports.ToastStatic = void 0;var _react = _interopRequireDefault(require("react"));
var _reactDom = _interopRequireDefault(require("react-dom"));
var _globalObject = require("@skbkontur/global-object");




var _Toast = require("./Toast");var _ToastStatic;var

ToastStatic = exports.ToastStatic = function ToastStatic() {};_ToastStatic = ToastStatic;ToastStatic.
push = function (
notification,
action,
showTime,
showCloseIcon)
{
  if (!_ToastStatic.node && _globalObject.globalObject.document) {
    _ToastStatic.node = _globalObject.globalObject.document.createElement('div');
    var body = _globalObject.globalObject.document.body;
    if (!body) {
      throw Error('There is no "body" element in "document"');
    }
    body.appendChild(_ToastStatic.node);

    _reactDom.default.render( /*#__PURE__*/
      _react.default.createElement(_Toast.Toast, { "data-tid": _Toast.ToastDataTids.toastStatic, ref: function ref(el) {return _ToastStatic.instance = el;} }),
      _ToastStatic.node,
      function () {return _ToastStatic._push(notification, action, showTime, showCloseIcon);}
    );
  } else {
    _ToastStatic._push(notification, action, showTime, showCloseIcon);
  }
};ToastStatic.

_push = function (
notification,
action,
showTime,
showCloseIcon)
{
  if (_ToastStatic.instance) {
    _ToastStatic.instance.push(notification, action, showTime, showCloseIcon);
  }
};ToastStatic.

close = function () {
  if (_ToastStatic.instance) {
    _ToastStatic.instance.close();
  }
};ToastStatic.


instance = null;