}functionN(){vara=O.selectedFolder.$selectedMessages();_.size(a)>0&&O.selectedFolder.$flagMessages(a,"seen","remove").then(function(a){_.forEach(a,function(a){a.isread=!1,a.$mailbox.unseenCount++})})}varO=this,P=null,Q=angular.element(a.document).find("title").attr("sg-default")||"SOGo",R=[];a.$mailboxController=O,O.service=q,O.accounts=h,O.account=i,O.selectedFolder=j,O.selectMessage=C,O.toggleMessageSelection=D,O.sort=t,O.sortedBy=u,O.searchMode=v,O.cancelSearch=w,O.newMessage=x,O.mode={search:!1,multiple:0},O.confirmDeleteSelectedMessages=G,O.markOrUnMarkMessagesAsJunk=H,O.copySelectedMessages=I,O.moveSelectedMessages=J,O.markSelectedMessagesAsFlagged=M,O.markSelectedMessagesAsUnread=N,O.selectAll=K,O.unselectMessages=L,j.selectFolder(),r(R),angular.element(a).on("beforeunload",s),b.$on("$destroy",function(){angular.element(a).off("beforeunload",s),_.forEach(R,function(a){k.deregisterHotkey(a)})}),b.$watch(function(){returnO.selectedFolder.unseenCount},function(b){varc=Q+" - ";b&&(c+="("+b+") "),c+=O.selectedFolder.name,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","stateAccount","stateMailbox","sgHotkeys","encodeUriFilter","sgFocus","Dialog","Account","Mailbox"],angular.module("material.components.virtualRepeat").decorator("mdVirtualRepeatContainerDirective",b),b.$inject=["$delegate"],angular.module("SOGo.MailerUI").controller("MailboxController",a)}(),function(){"use strict";functiona(a,b,c,d,e,f,g,h,i,j,k,m,n,o,p,q,r,s,t,u){functionv(a){a.push(o.createHotkey({key:"backspace",description:l("Delete selected message or folder"),callback:function(){q.selectedFolder&&!q.selectedFolder.hasSelectedMessage()&&L(q.selectedFolder)}})),_.forEach(a,function(a){o.registerHotkey(a)})}functionw(a){V.showingAdvancedSearch=!0,V.search.mailbox=a,g(i["gt-md"])||h("left").close()}functionx(){V.showingAdvancedSearch=!1,V.service.$virtualMode=!1,T=V.accounts[0],U=V.searchPreviousMailbox,b.go("mail.account.mailbox",{accountId:T.id,mailboxId:k(U.path)})}functiony(){if(q.selectedFolder.$isLoading)V.virtualMailbox.stopSearch();else{vara,c=[],d=function(a){_.forEach(a,function(a){c.push(a),a.children&&a.children.length>0&&d(a.children)})};V.virtualMailbox=newr(V.accounts[0]),q.$virtualMode||(V.searchPreviousMailbox=q.selectedFolder),q.selectedFolder=V.virtualMailbox,q.$virtualMode=!0,angular.isDefined(V.search.mailbox)?(a=V.accounts[0].$getMailboxByPath(V.search.mailbox),c.push(a),V.search.subfolders&&a.children.length&&d(a.children)):c=V.accounts[0].$flattenMailboxes(),V.virtualMailbox.setMailboxes(c),V.virtualMailbox.startSearch(V.search.match,V.search.params),b.go("mail.account.virtualMailbox",{accountId:V.accounts[0].id})}}functionz(a){returnV.currentSearchParam=a,j("advancedSearch"),!1}functionA(a){if(a.length&&V.currentSearchParam.length){varb=0,c=V.currentSearchParam;returna.startsWith("!")&&(b=1,a=a.substring(1).trim()),V.currentSearchParam="",{searchBy:c,searchInput:a,negative:b}}}functionB(a){a.$expanded=!a.$expanded,a.$flattenMailboxes({reload:!0,saveState:!0}),c(function(){angular.element(d).triggerHandler("resize")},150)}functionC(a){functionb(a,b,c,d){functione(){b.cancel()}varf=this;f.loading=!0,f.filter={name:""},f.metadataForFolder=c,f.account=newp({id:d.id,name:d.name}),f.close=e,f.account.$getMailboxes().then(function(){f.loading=!1})}e.show({templateUrl:a.id+"/subscribe",controller:b,controllerAs:"subscriptions",clickOutsideToClose:!0,escapeToClose:!0,locals:{metadataForFolder:O,srcAccount:a}}).finally(function(){a.$getMailboxes({reload:!0})}),b.$inject=["$scope","$mdDialog","metadataForFolder","srcAccount"]}functionD(a){m.prompt(l("New folder"),l("Enter the new name of your folder :")).then(function(b){a.$newMailbox(a.id,b).then(function(){},function(a,c){m.alert(l('An error occured while creating the mailbox "%{0}".',b),l(a.error))})})}functionE(a){functionb(a,b,c,d){fun