'use strict';

System.register(['src/components/widgets/lively-morph.js', 'src/client/lively.js'], function (_export, _context) {
  "use strict";

  var Morph, lively;
  return {
    setters: [function (_srcComponentsWidgetsLivelyMorphJs) {
      Morph = _srcComponentsWidgetsLivelyMorphJs.default;
    }, function (_srcClientLivelyJs) {
      lively = _srcClientLivelyJs.default;
    }],
    execute: function () {
      _recorder_._src_components_widgets_lively_notification_list_js = _recorder_._src_components_widgets_lively_notification_list_js || {};
      _recorder_._src_components_widgets_lively_notification_list_js.Morph = Morph;
      _recorder_._src_components_widgets_lively_notification_list_js.lively = lively;
      class NotificationList extends _recorder_._src_components_widgets_lively_notification_list_js.Morph {

        addNotification(title, message, timeout, moreCallBack, color) {
          var notification = document.createElement("lively-notification");
          notification.title = title;
          notification.message = message;
          notification.more = moreCallBack;
          notification.color = color;

          _recorder_._src_components_widgets_lively_notification_list_js.lively.components.openIn(this, notification).then(() => {
            this.hidden = false;
            if (timeout === undefined) timeout = 7;
            setTimeout(() => notification.onClose(), timeout * 1000);
          });
        }

        clear() {
          Array.from(this.childNodes).forEach(ea => this.removeChild(ea));
        }

        hideIfEmpty() {
          if (this.childNodes.length === 0) {
            this.hidden = true;
          } else {
            this.hidden = false;
          }
        }
      }

      _export('default', NotificationList);

      _recorder_._src_components_widgets_lively_notification_list_js.NotificationList = NotificationList;
    }
  };
});