_.size(b)>0&&Q.selectedFolder.$markOrUnMarkMessagesAsJunk(b).then(function(){varc="/"+Q.account.id+"/folderINBOX";"junk"!=Q.selectedFolder.type&&(c="/"+Q.account.$getMailboxByType("junk").id),Q.selectedFolder.$moveMessages(b,c).then(function(b){r.$virtualMode?a&&e.go("mail.account.virtualMailbox"):G(a,b)})})}functionJ(a){varb=Q.selectedFolder.$selectedMessages();_.size(b)>0&&Q.selectedFolder.$copyMessages(b,"/"+a).then(function(){g.show(g.simple().content(l("%{0} message(s) copied",Q.selectedFolder.$selectedCount())).position("top right").hideDelay(2e3))})}functionK(a){varb=Q.selectedFolder.hasSelectedMessage(),c=Q.selectedFolder.$selectedMessages(),d=Q.selectedFolder.$selectedCount();_.size(c)>0&&Q.selectedFolder.$moveMessages(c,"/"+a).then(function(a){g.show(g.simple().content(l("%{0} message(s) moved",d)).position("top right").hideDelay(2e3)),r.$virtualMode?b&&e.go("mail.account.virtualMailbox"):G(b,a)})}functionL(){vara=0;_.forEach(F(),function(b){for(varc=0,d=b.$messages.length;c<d;c++)b.$messages[c].selected=!0;a+=d}),Q.mode.multiple=a}functionM(){_.forEach(F(),function(a){_.forEach(a.$messages,function(a){a.selected=!1})}),Q.mode.multiple=0}functionN(){vara=Q.selectedFolder.$selectedMessages();_.size(a)>0&&Q.selectedFolder.$flagMessages(a,"\\Flagged","add").then(function(a){_.forEach(a,function(a){a.isflagged=!0})})}functionO(){vara=Q.selectedFolder.$selectedMessages();_.size(a)>0&&Q.selectedFolder.$flagMessages(a,"seen","remove").then(function(a){_.forEach(a,function(a){a.isread&&a.$mailbox.unseenCount++,a.isread=!1})})}functionP(){vara=Q.selectedFolder.$selectedMessages();_.size(a)>0&&Q.selectedFolder.$flagMessages(a,"seen","add").then(function(a){_.forEach(a,function(a){a.isread||a.$mailbox.unseenCount--,a.isread=!0})})}varQ=this,R=angular.element(a.document).find("title").attr("sg-default")||"SOGo",S=[];a.$mailboxController=Q,Q.service=r,Q.accounts=h,Q.account=i,Q.selectedFolder=j,Q.selectMessage=D,Q.messageDialog=null,Q.toggleMessageSelection=E,Q.sort=t,Q.sortedBy=u,Q.searchMode=v,Q.cancelSearch=w,Q.newMessage=x,Q.mode={search:!1,multiple:0},Q.confirmDeleteSelectedMessages=H,Q.markOrUnMarkMessagesAsJunk=I,Q.copySelectedMessages=J,Q.moveSelectedMessages=K,Q.markSelectedMessagesAsFlagged=N,Q.markSelectedMessagesAsUnread=O,Q.markSelectedMessagesAsRead=P,Q.selectAll=L,Q.unselectMessages=M,j.selectFolder(),function(a){a.push(k.createHotkey({key:l("hotkey_search"),description:l("Search"),callback:v})),a.push(k.createHotkey({key:l("hotkey_compose"),description:l("Write a new message"),callback:function(a){null===Q.messageDialog&&x(a)}})),a.push(k.createHotkey({key:l("hotkey_junk"),description:l("Mark the selected messages as junk"),callback:I})),a.push(k.createHotkey({key:"space",description:l("Toggle item"),callback:E})),a.push(k.createHotkey({key:"shift+space",description:l("Toggle range of items"),callback:E})),a.push(k.createHotkey({key:"up",description:l("View next item"),callback:z,preventInClass:["sg-mail-part"]})),a.push(k.createHotkey({key:"down",description:l("View previous item"),callback:A,preventInClass:["sg-mail-part"]})),a.push(k.createHotkey({key:"shift+up",description:l("Add next item to selection"),callback:B,preventInClass:["sg-mail-part"]})),a.push(k.createHotkey({key:"shift+down",description:l("Add previous item to selection"),callback:C,preventInClass:["sg-mail-part"]})),a.push(k.createHotkey({key:"backspace",description:l("Delete selected message or folder"),callback:H})),_.forEach(a,function(a){k.registerHotkey(a)})}(S),angular.element(a).on("beforeunload",s),b.$on("$destroy",function(){angular.element(a).off("beforeunload",s),_.forEach(S,function(a){k.deregisterHotkey(a)})}),b.$watch(function(){returnQ.selectedFolder.unseenCount},function(b){varc=R+" - ";b&&(c+="("+b+") "),c+=Q.selectedFolder.$displayName,a.document.title=c})}functionb(a){returna[0].controller.prototype.resetScroll=function(){"messagesList"==this.$element.parent().attr("id")?this.updateSize():this.scrollTo(0)},a}a.$inject=["$window","$scope","$timeout","$q","$state","$mdDialog","$mdToast","stateAccounts"