var __hasProp=Object.prototype.hasOwnProperty,__extends=function(a,b){function d(){this.constructor=a}for(var c in b)__hasProp.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a},__bind=function(a,b){return function(){return a.apply(b,arguments)}};define(["cilantro/vendor/backbone"],function(){var a,b,c,d,e;return a={debug:0,info:1,warning:2,error:3,critical:4},d=function(){function a(){a.__super__.constructor.apply(this,arguments)}return __extends(a,Backbone.Model),a.prototype.defaults={level:"info",timeout:3e3},a}(),b=function(){function a(){this.log=__bind(this.log,this),a.__super__.constructor.apply(this,arguments)}return __extends(a,Backbone.Collection),a.prototype.model=d,a.prototype.initialize=function(){return App.hub.subscribe("log",this.log)},a.prototype.log=function(a){if(a instanceof Backbone.Model)return this.add(a),console.log(a)},a}(),e=function(){function a(){a.__super__.constructor.apply(this,arguments)}return __extends(a,Backbone.View),a.prototype.template=_.template('<div class="message <%= level %>"><%= message %></div>'),a.prototype.render=function(){return this.el=$(this.template(this.model.get("message"))),this},a.prototype.show=function(){return this.el.fadeIn(500)},a.prototype.hide=function(){return this.el.fadeOut(300)},a}(),c=function(){function a(){this.dismiss=__bind(this.dismiss,this),this.log=__bind(this.log,this),a.__super__.constructor.apply(this,arguments)}return __extends(a,Backbone.View),a.prototype.el="#messages",a.prototype.initialize=function(){return App.hub.subscribe("log",this.log),App.hub.subscribe("dismiss",this.dismiss),this.modelViews={}},a.prototype.log=function(a){var b;a instanceof Backbone.View||(b=a,a=new e({model:b}),this.modelViews[b]=a),this.el.append(a.el.hide()),a.show();if(a.timeout)return this._messageTimer=_.delay(function(){return a.hide()},a.timeout)},a.prototype.dismiss=function(a){var b;a instanceof Backbone.View||(b=a,a=this.modelViews[b],delete this.modelViews[b]);if(a)return clearTimeout(this._messageTimer),a.hide()},a}(),{Message:d,MessageView:e,Log:b,LogView:c}})