function()

in lab1/server/src/main/resources/public/js/bootstrap.esm.js [5094:5253]


function () {
  function Toast(element, config) {
    this._element = element;
    this._config = this._getConfig(config);
    this._timeout = null;

    this._setListeners();

    Data.setData(element, DATA_KEY$a, this);
  } // Getters


  var _proto = Toast.prototype;

  // Public
  _proto.show = function show() {
    var _this = this;

    var showEvent = EventHandler.trigger(this._element, Event$b.SHOW);

    if (showEvent.defaultPrevented) {
      return;
    }

    if (this._config.animation) {
      this._element.classList.add(ClassName$a.FADE);
    }

    var complete = function complete() {
      _this._element.classList.remove(ClassName$a.SHOWING);

      _this._element.classList.add(ClassName$a.SHOW);

      EventHandler.trigger(_this._element, Event$b.SHOWN);

      if (_this._config.autohide) {
        _this._timeout = setTimeout(function () {
          _this.hide();
        }, _this._config.delay);
      }
    };

    this._element.classList.remove(ClassName$a.HIDE);

    reflow(this._element);

    this._element.classList.add(ClassName$a.SHOWING);

    if (this._config.animation) {
      var transitionDuration = getTransitionDurationFromElement(this._element);
      EventHandler.one(this._element, TRANSITION_END, complete);
      emulateTransitionEnd(this._element, transitionDuration);
    } else {
      complete();
    }
  };

  _proto.hide = function hide() {
    var _this2 = this;

    if (!this._element.classList.contains(ClassName$a.SHOW)) {
      return;
    }

    var hideEvent = EventHandler.trigger(this._element, Event$b.HIDE);

    if (hideEvent.defaultPrevented) {
      return;
    }

    var complete = function complete() {
      _this2._element.classList.add(ClassName$a.HIDE);

      EventHandler.trigger(_this2._element, Event$b.HIDDEN);
    };

    this._element.classList.remove(ClassName$a.SHOW);

    if (this._config.animation) {
      var transitionDuration = getTransitionDurationFromElement(this._element);
      EventHandler.one(this._element, TRANSITION_END, complete);
      emulateTransitionEnd(this._element, transitionDuration);
    } else {
      complete();
    }
  };

  _proto.dispose = function dispose() {
    clearTimeout(this._timeout);
    this._timeout = null;

    if (this._element.classList.contains(ClassName$a.SHOW)) {
      this._element.classList.remove(ClassName$a.SHOW);
    }

    EventHandler.off(this._element, Event$b.CLICK_DISMISS);
    Data.removeData(this._element, DATA_KEY$a);
    this._element = null;
    this._config = null;
  } // Private
  ;

  _proto._getConfig = function _getConfig(config) {
    config = _objectSpread2({}, Default$7, {}, Manipulator.getDataAttributes(this._element), {}, typeof config === 'object' && config ? config : {});
    typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
    return config;
  };

  _proto._setListeners = function _setListeners() {
    var _this3 = this;

    EventHandler.on(this._element, Event$b.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
      return _this3.hide();
    });
  } // Static
  ;

  Toast._jQueryInterface = function _jQueryInterface(config) {
    return this.each(function () {
      var data = Data.getData(this, DATA_KEY$a);

      var _config = typeof config === 'object' && config;

      if (!data) {
        data = new Toast(this, _config);
      }

      if (typeof config === 'string') {
        if (typeof data[config] === 'undefined') {
          throw new TypeError("No method named \"" + config + "\"");
        }

        data[config](this);
      }
    });
  };

  Toast._getInstance = function _getInstance(element) {
    return Data.getData(element, DATA_KEY$a);
  };

  _createClass(Toast, null, [{
    key: "VERSION",
    get: function get() {
      return VERSION$a;
    }
  }, {
    key: "DefaultType",
    get: function get() {
      return DefaultType$7;
    }
  }, {
    key: "Default",
    get: function get() {
      return Default$7;
    }
  }]);

  return Toast;
}();