define(["ember","app","broad","mm","rm"],function(a,b,c,d,e){var f=a.Object.extend({schoolyear:"",semester:"",text:function(){return"%@学年%@学期".fmt(this.get("schoolyear"),"01"==this.get("semester")?"上":"下")}.property("schoolyear","semester")});return b.NavigationRoute=a.Route.extend({model:function(){var b=this,c=[d.request(a.$.extend({Online:b.get("session.online")},b.get("session.appUser").toHash({includeToken:!0})),{module:"instruction",action:"setUser"}).then(function(){return b.get("session.ISO")?void 0:e.setProfile(a.$.extend({id:b.get("session.appUser.PersonID")},b.get("session.appUser").toHash()))})];return c.addObject(this.get("session.online")?this.store.find("growthHistory").then(function(a){var b=[];return a.forEach(function(a){b.findBy("id",a.get("Term")+a.get("Session"))||b.addObject(f.create({id:a.get("Term")+a.get("Session"),schoolyear:parseInt(a.get("Term")),semester:a.get("Session"),subscribe:a.get("Ispayment"),lastpublishtime:a.get("LastUpdatedDate")}))}),b}):e.getProfiles().then(function(a){var c=[].concat(a).findBy("PersonID",b.get("session.appUser.PersonID"));return c&&0!=c.subFolders.length?[].concat(c.subFolders).map(function(a){var b=a.split("-");return f.create({id:a,schoolyear:parseInt(b[0]),semester:b[1],subscribe:!1})}):[]})),a.RSVP.Promise.all(c).then(function(a){var c=a[1].sortBy("schoolyear","semester");b.get("session.schoolyear")&&c.contains(b.get("session.schoolyear"))||b.set("session.schoolyear",c.objectAt(0)),console.log("histories:"),console.log(c),b.set("session.histories",c)})},setupController:function(a,b){var c=this;a.set("model",b),a.get("filteredMenus").findBy("key","download").set("display",c.get("session.online"))},actions:{didTransition:function(){var a=this.router.router.currentHandlerInfos;return a&&a[2]&&this.controllerFor("navigation").set("activeMenu",a[2].name),!0}}})});