define(["jquery","underscore","backbone","util/templar","util/cron","route/index","view/alert","view/primarynav","view/header","view/addmonitor","view/dashboard","view/adddashboard","view/addcategory","view/ecosystem","view/secondarynav","view/settings","model/user","model/dashboard","collection/monitor","collection/dashboard","backbone-mediator","jquery-timepicker","bootstrap"],function(e,r,t,a,i,s,o,n,d,h,l,u,c,p,w,m,b,v,y,f){var V=function(){};return r.extend(V,{initialize:function(){r.bindAll(this),this.auth(),this.alert(),this.primaryNav(),this.header(),this.secondaryNav(),this.addCategory(),t.Mediator.pub("controller:app:init"),this.controllerInit=!0,t.history.start()},addCategory:function(){new c({el:e(".add-category-wrap"),templar:this.templar,user:this.user})},alert:function(){this.auth(),this.alertView=new o({el:e(".alert-wrap"),templar:this.templar})},header:function(){this.auth(),new d({el:e(".header-wrap"),templar:this.templar}).render()},primaryNav:function(){this.auth(),new n({el:e(".primary-nav-wrap"),collection:this.dashboardCollection,user:this.user,templar:this.templar}).render(),new m({el:e(".settings-wrap"),user:this.user,templar:this.templar}).render()},secondaryNav:function(){this.auth(),new w({el:e(".secondary-nav-wrap"),templar:this.templar}).render()},category:function(r,a,i){var s=[];this.auth(),this.destroyViews();var o=new y(null,{dashboardId:r});s.push(new l({el:e(".monitor-panel"),collection:o,dashboardId:r,user:this.user,templar:this.templar,router:this.indexRouter,categoryId:a})),this.renderViews(s),t.Mediator.pub("controller:dashboard:init",{nav:{dashboard:!0},monitorId:i,dashboardId:r})},dashboard:function(r,a){var i=[];this.auth(),this.destroyViews();var s=new y(null,{dashboardId:r});i.push(new l({el:e(".monitor-panel"),collection:s,dashboardId:r,user:this.user,templar:this.templar,router:this.indexRouter})),this.renderViews(i),t.Mediator.pub("controller:dashboard:init",{nav:{dashboard:!0},monitorId:a,dashboardId:r})},ecosystem:function(){var r=[];this.auth(),this.destroyViews(),r.push(new p({el:e(".ecosystem-dashboard-wrap"),collection:this.dashboardCollection,templar:this.templar}));var a=new v;r.push(new u({el:e(".add-dashboard-wrap"),templar:this.templar,model:a,collection:this.dashboardCollection,user:this.user})),this.renderViews(r),t.Mediator.pub("controller:dashboard:init",{nav:{dashboard:!1}})},destroyViews:function(){if(this.currentView)for(;this.currentView.length>0;)this.currentView.pop().destructor()},renderViews:function(e){this.currentView=e;for(var r=this.currentView.length-1;r>=0;r--)this.currentView[r].render()},auth:function(){this.indexRouter=this.indexRouter?this.indexRouter:new s({app:this}),this.user=this.user?this.user:new b,this.dashboardCollection=this.dashboardCollection?this.dashboardCollection:new f,this.templar=this.templar?this.templar:new a(["addcategory","adddashboard","addmonitor","alert","dashboard","dashboardtile","deletemonitor","expandedmonitor","header","primarynav","schedulemonitor","secondarynav","setmetrics","settings","smallmonitor"],{url:rearview.path+"/templates/",version:r.isUndefined(rearview.version)?"0.0.1":rearview.version,cache:r.isUndefined(rearview.cache)?!0:!1})}}),V});