").addClass("rl-view-model").addClass("RL-"+e.viewModelTemplate()).hide().attr("data-bind",'template: {name: "'+e.viewModelTemplate()+'"}, i18nInit: true'),h.appendTo(g),e.viewModelDom=h,a.__dom=h,"Popups"===f&&(e.cancelCommand=e.closeCommand=sb.createCommand(e,function(){xb.hideScreenPopup(a)})),tb.runHook("view-model-pre-build",[a.__name,e,h]),c.applyBindings(e,h[0]),sb.delegateRun(e,"onBuild",[h]),tb.runHook("view-model-post-build",[a.__name,e,h])):sb.log("Cannot find view model position: "+f)}return a?a.__vm:null},s.prototype.applyExternal=function(a,b){a&&b&&c.applyBindings(a,b)},s.prototype.hideScreenPopup=function(a){a&&a.__vm&&a.__dom&&(a.__vm.modalVisibility(!1),sb.delegateRun(a.__vm,"onHide"),this.popupVisibility(!1),tb.runHook("view-model-on-hide",[a.__name,a.__vm]),h.delay(function(){a.__dom.hide()},300))},s.prototype.showScreenPopup=function(a,b){a&&(this.buildViewModel(a),a.__vm&&a.__dom&&(a.__dom.show(),a.__vm.modalVisibility(!0),sb.delegateRun(a.__vm,"onShow",b||[]),this.popupVisibility(!0),tb.runHook("view-model-on-show",[a.__name,a.__vm,b||[]]),sb.delegateRun(a.__vm,"onFocus",[],500)))},s.prototype.screenOnRoute=function(a,b){var c=this,d=null,e=null;""===sb.pString(a)&&(a=this.sDefaultScreenName),""!==a&&(d=this.screen(a),d||(d=this.screen(this.sDefaultScreenName),d&&(b=a+"/"+b,a=this.sDefaultScreenName)),d&&d.__started&&(d.__builded||(d.__builded=!0,sb.isNonEmptyArray(d.viewModels())&&h.each(d.viewModels(),function(a){this.buildViewModel(a,d)},this),sb.delegateRun(d,"onBuild")),h.defer(function(){c.oCurrentScreen&&(sb.delegateRun(c.oCurrentScreen,"onHide"),sb.isNonEmptyArray(c.oCurrentScreen.viewModels())&&h.each(c.oCurrentScreen.viewModels(),function(a){a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()&&(a.__dom.hide(),a.__vm.viewModelVisibility(!1),sb.delegateRun(a.__vm,"onHide"))})),c.oCurrentScreen=d,c.oCurrentScreen&&(sb.delegateRun(c.oCurrentScreen,"onShow"),tb.runHook("screen-on-show",[c.oCurrentScreen.screenName(),c.oCurrentScreen]),sb.isNonEmptyArray(c.oCurrentScreen.viewModels())&&h.each(c.oCurrentScreen.viewModels(),function(a){a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()&&(a.__dom.show(),a.__vm.viewModelVisibility(!0),sb.delegateRun(a.__vm,"onShow"),sb.delegateRun(a.__vm,"onFocus",[],200),tb.runHook("view-model-on-show",[a.__name,a.__vm]))},c)),e=d.__cross(),e&&e.parse(b)})))},s.prototype.startScreens=function(a){b("#rl-content").css({visibility:"hidden"}),h.each(a,function(a){var b=new a,c=b?b.screenName():"";b&&""!==c&&(""===this.sDefaultScreenName&&(this.sDefaultScreenName=c),this.oScreens[c]=b)},this),h.each(this.oScreens,function(a){a&&!a.__started&&a.__start&&(a.__started=!0,a.__start(),tb.runHook("screen-pre-start",[a.screenName(),a]),sb.delegateRun(a,"onStart"),tb.runHook("screen-post-start",[a.screenName(),a]))},this);var c=d.create();c.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,h.bind(this.screenOnRoute,this)),e.initialized.add(c.parse,c),e.changed.add(c.parse,c),e.init(),b("#rl-content").css({visibility:"visible"}),h.delay(function(){Ab.removeClass("rl-started-trigger").addClass("rl-started")},50)},s.prototype.setHash=function(a,b,c){a="#"===a.substr(0,1)?a.substr(1):a,a="/"===a.substr(0,1)?a.substr(1):a,c=sb.isUnd(c)?!1:!!c,(sb.isUnd(b)?1:!b)?(e.changed.active=!0,e[c?"replaceHash":"setHash"](a),e.setHash(a)):(e.changed.active=!1,e[c?"replaceHash":"setHash"](a),e.changed.active=!0)},s.prototype.bootstart=function(){return this.oBoot&&this.oBoot.bootstart&&this.oBoot.bootstart(),this},xb=new s,t.newInstanceFromJson=function(a){var b=new t;return b.initByJson(a)?b:null},t.prototype.name="",t.prototype.email="",t.prototype.privateType=null,t.prototype.clear=function(){this.email="",this.name="",this.privateType=null},t.prototype.validate=function(){return""!==this.name||""!==this.email},t.prototype.hash=function(a){return"#"+(a?"":this.name)+"#"+this.email+"#"},t.prototype.clearDuplicateName=function(){this.name===this.email&&(this.name="")},t.prototype.type=function(){return null===this.privateType&&(this.email&&"@facebook.com"===this.email.substr(-13)&&(this.privateType=qb.EmailType.Facebook),null===this.privateType&&(this.privateType=qb.EmailType.Default)),this.privateType},t.prototype.search=function(a){return-1<(this.name+" "+this.email).toLowerCase().indexOf(a.toLowerCase())},t.prototype.parse=function(a){this.clear(),a=sb.trim(a);var b=/(?:"([^"]+)")? ?(.*?@[^>,]+)>?,? ?/g,c=b.exec(a);c?(this.name=c[1]||"",this.email=c[2]||"",this.clearDuplicateName()):/^[^@]+@[^@]+$/.test(a)&&(this.name="",this.email=a)},t.prototype.initByJson=function(a){var b=!1;return a&&"Object/Email"===a["@Object"]&&(this.name=sb.trim(a.Name),this.email=sb.trim(a.Email),b=""!==this.email,this.clearDuplicateName()),b},t.prototype.toLine=function(a,b,c){var d="";return""!==this.email&&(b=sb.isUnd(b)?!1:!!b,c=sb.isUnd(c)?!1:!!c,a&&""!==this.name?d=b?'
")+'" target="_blank" tabindex="-1">'+sb.encodeHtml(this.name)+"":c?sb.encodeHtml(this.name):this.name:(d=this.email,""!==this.name?b?d=sb.encodeHtml('"'+this.name+'" <')+'
")+'" target="_blank" tabindex="-1">'+sb.encodeHtml(d)+""+sb.encodeHtml(">"):(d='"'+this.name+'" <'+d+">",c&&(d=sb.encodeHtml(d))):b&&(d='
'+sb.encodeHtml(this.email)+""))),d},t.prototype.mailsoParse=function(a){if(a=sb.trim(a),""===a)return!1;for(var b=function(a,b,c){a+="";var d=a.length;return 0>b&&(b+=d),d="undefined"==typeof c?d:0>c?c+d:c+b,b>=a.length||0>b||b>d?!1:a.slice(b,d)},c=function(a,b,c,d){return 0>c&&(c+=a.length),d=void 0!==d?d:a.length,0>d&&(d=d+a.length-c),a.slice(0,c)+b.substr(0,d)+b.slice(d)+a.slice(c+d)},d="",e="",f="",g=!1,h=!1,i=!1,j=null,k=0,l=0,m=0;m
0&&0===d.length&&(d=b(a,0,m)),h=!0,k=m);break;case">":h&&(l=m,e=b(a,k+1,l-k-1),a=c(a,"",k,l-k+1),l=0,m=0,k=0,h=!1);break;case"(":g||h||i||(i=!0,k=m);break;case")":i&&(l=m,f=b(a,k+1,l-k-1),a=c(a,"",k,l-k+1),l=0,m=0,k=0,i=!1);break;case"\\":m++}m++}return 0===e.length&&(j=a.match(/[^@\s]+@\S+/i),j&&j[0]?e=j[0]:d=a),e.length>0&&0===d.length&&0===f.length&&(d=a.replace(e,"")),e=sb.trim(e).replace(/^[<]+/,"").replace(/[>]+$/,""),d=sb.trim(d).replace(/^["']+/,"").replace(/["']+$/,""),f=sb.trim(f).replace(/^[(]+/,"").replace(/[)]+$/,""),d=d.replace(/\\\\(.)/,"$1"),f=f.replace(/\\\\(.)/,"$1"),this.name=d,this.email=e,this.clearDuplicateName(),!0},t.prototype.inputoTagLine=function(){return 0+$/,""),b=!0),b},w.prototype.isImage=function(){return-1e;e++)d.push(a[e].toLine(b,c));return d.join(", ")},y.initEmailsFromJson=function(a){var b=0,c=0,d=null,e=[];if(sb.isNonEmptyArray(a))for(b=0,c=a.length;c>b;b++)d=t.newInstanceFromJson(a[b]),d&&e.push(d);return e},y.replyHelper=function(a,b,c){if(a&&0d;d++)sb.isUnd(b[a[d].email])&&(b[a[d].email]=!0,c.push(a[d]))},y.prototype.clear=function(){this.folderFullNameRaw="",this.uid="",this.requestHash="",this.subject(""),this.size(0),this.dateTimeStampInUTC(0),this.priority(qb.MessagePriority.Normal),this.fromEmailString(""),this.toEmailsString(""),this.senderEmailsString(""),this.emails=[],this.from=[],this.to=[],this.cc=[],this.bcc=[],this.replyTo=[],this.newForAnimation(!1),this.deleted(!1),this.unseen(!1),this.flagged(!1),this.answered(!1),this.forwarded(!1),this.isReadReceipt(!1),this.selected(!1),this.checked(!1),this.hasAttachments(!1),this.attachmentsMainType(""),this.body=null,this.isRtl(!1),this.isHtml(!1),this.hasImages(!1),this.attachments([]),this.isPgpSigned(!1),this.isPgpEncrypted(!1),this.pgpSignature(""),this.priority(qb.MessagePriority.Normal),this.readReceipt(""),this.aDraftInfo=[],this.sMessageId="",this.sInReplyTo="",this.sReferences="",this.parentUid(0),this.threads([]),this.threadsLen(0),this.hasUnseenSubMessage(!1),this.hasFlaggedSubMessage(!1),this.lastInCollapsedThread(!1),this.lastInCollapsedThreadLoading(!1)},y.prototype.computeSenderEmail=function(){var a=Eb.data().sentFolder(),b=Eb.data().draftFolder();this.senderEmailsString(this.folderFullNameRaw===a||this.folderFullNameRaw===b?this.toEmailsString():this.fromEmailString())},y.prototype.initByJson=function(a){var b=!1;return a&&"Object/Message"===a["@Object"]&&(this.folderFullNameRaw=a.Folder,this.uid=a.Uid,this.requestHash=a.RequestHash,this.size(sb.pInt(a.Size)),this.from=y.initEmailsFromJson(a.From),this.to=y.initEmailsFromJson(a.To),this.cc=y.initEmailsFromJson(a.Cc),this.bcc=y.initEmailsFromJson(a.Bcc),this.replyTo=y.initEmailsFromJson(a.ReplyTo),this.subject(a.Subject),this.dateTimeStampInUTC(sb.pInt(a.DateTimeStampInUTC)),this.hasAttachments(!!a.HasAttachments),this.attachmentsMainType(a.AttachmentsMainType),this.fromEmailString(y.emailsToLine(this.from,!0)),this.toEmailsString(y.emailsToLine(this.to,!0)),this.parentUid(sb.pInt(a.ParentThread)),this.threads(sb.isArray(a.Threads)?a.Threads:[]),this.threadsLen(sb.pInt(a.ThreadsLen)),this.initFlagsByJson(a),this.computeSenderEmail(),b=!0),b},y.prototype.initUpdateByMessageJson=function(a){var b=!1,c=qb.MessagePriority.Normal;return a&&"Object/Message"===a["@Object"]&&(c=sb.pInt(a.Priority),this.priority(-1b;b++)d=w.newInstanceFromJson(a["@Collection"][b]),d&&(""!==d.cidWithOutTags&&0+$/,""),b=h.find(c,function(b){return a===b.cidWithOutTags})),b||null},y.prototype.findAttachmentByContentLocation=function(a){var b=null,c=this.attachments();return sb.isNonEmptyArray(c)&&(b=h.find(c,function(b){return a===b.contentLocation})),b||null},y.prototype.messageId=function(){return this.sMessageId},y.prototype.inReplyTo=function(){return this.sInReplyTo},y.prototype.references=function(){return this.sReferences},y.prototype.fromAsSingleEmail=function(){return sb.isArray(this.from)&&this.from[0]?this.from[0].email:""},y.prototype.viewLink=function(){return Eb.link().messageViewLink(this.requestHash)},y.prototype.downloadLink=function(){return Eb.link().messageDownloadLink(this.requestHash)},y.prototype.replyEmails=function(a){var b=[],c=sb.isUnd(a)?{}:a;return y.replyHelper(this.replyTo,c,b),0===b.length&&y.replyHelper(this.from,c,b),b},y.prototype.replyAllEmails=function(a){var b=[],c=[],d=sb.isUnd(a)?{}:a;return y.replyHelper(this.replyTo,d,b),0===b.length&&y.replyHelper(this.from,d,b),y.replyHelper(this.to,d,b),y.replyHelper(this.cc,d,c),[b,c]},y.prototype.textBodyToString=function(){return this.body?this.body.html():""},y.prototype.attachmentsToStringLine=function(){var a=h.map(this.attachments(),function(a){return a.fileName+" ("+a.friendlySize+")"});return a&&0=0&&e&&!f&&d.attr("src",e)}),c&&a.setTimeout(function(){d.print()},100))})},y.prototype.printMessage=function(){this.viewPopupMessage(!0)},y.prototype.generateUid=function(){return this.folderFullNameRaw+"/"+this.uid},y.prototype.populateByMessageListItem=function(a){return this.folderFullNameRaw=a.folderFullNameRaw,this.uid=a.uid,this.requestHash=a.requestHash,this.subject(a.subject()),this.size(a.size()),this.dateTimeStampInUTC(a.dateTimeStampInUTC()),this.priority(a.priority()),this.fromEmailString(a.fromEmailString()),this.toEmailsString(a.toEmailsString()),this.emails=a.emails,this.from=a.from,this.to=a.to,this.cc=a.cc,this.bcc=a.bcc,this.replyTo=a.replyTo,this.unseen(a.unseen()),this.flagged(a.flagged()),this.answered(a.answered()),this.forwarded(a.forwarded()),this.isReadReceipt(a.isReadReceipt()),this.selected(a.selected()),this.checked(a.checked()),this.hasAttachments(a.hasAttachments()),this.attachmentsMainType(a.attachmentsMainType()),this.moment(a.moment()),this.body=null,this.priority(qb.MessagePriority.Normal),this.aDraftInfo=[],this.sMessageId="",this.sInReplyTo="",this.sReferences="",this.parentUid(a.parentUid()),this.threads(a.threads()),this.threadsLen(a.threadsLen()),this.computeSenderEmail(),this},y.prototype.showExternalImages=function(a){this.body&&this.body.data("rl-has-images")&&(a=sb.isUnd(a)?!1:a,this.hasImages(!1),this.body.data("rl-has-images",!1),b("[data-x-src]",this.body).each(function(){a&&b(this).is("img")?b(this).addClass("lazy").attr("data-original",b(this).attr("data-x-src")).removeAttr("data-x-src"):b(this).attr("src",b(this).attr("data-x-src")).removeAttr("data-x-src")}),b("[data-x-style-url]",this.body).each(function(){var a=sb.trim(b(this).attr("style"));a=""===a?"":";"===a.substr(-1)?a+" ":a+"; ",b(this).attr("style",a+b(this).attr("data-x-style-url")).removeAttr("data-x-style-url")}),a&&(b("img.lazy",this.body).addClass("lazy-inited").lazyload({threshold:400,effect:"fadeIn",skip_invisible:!1,container:b(".RL-MailMessageView .messageView .messageItem .content")[0]}),Bb.resize()),sb.windowResize(500))
+},y.prototype.showInternalImages=function(a){if(this.body&&!this.body.data("rl-init-internal-images")){a=sb.isUnd(a)?!1:a;var c=this;this.body.data("rl-init-internal-images",!0),b("[data-x-src-cid]",this.body).each(function(){var d=c.findAttachmentByCid(b(this).attr("data-x-src-cid"));d&&d.download&&(a&&b(this).is("img")?b(this).addClass("lazy").attr("data-original",d.linkPreview()):b(this).attr("src",d.linkPreview()))}),b("[data-x-src-location]",this.body).each(function(){var d=c.findAttachmentByContentLocation(b(this).attr("data-x-src-location"));d||(d=c.findAttachmentByCid(b(this).attr("data-x-src-location"))),d&&d.download&&(a&&b(this).is("img")?b(this).addClass("lazy").attr("data-original",d.linkPreview()):b(this).attr("src",d.linkPreview()))}),b("[data-x-style-cid]",this.body).each(function(){var a="",d="",e=c.findAttachmentByCid(b(this).attr("data-x-style-cid"));e&&e.linkPreview&&(d=b(this).attr("data-x-style-cid-name"),""!==d&&(a=sb.trim(b(this).attr("style")),a=""===a?"":";"===a.substr(-1)?a+" ":a+"; ",b(this).attr("style",a+d+": url('"+e.linkPreview()+"')")))}),a&&!function(a,b){h.delay(function(){a.addClass("lazy-inited").lazyload({threshold:400,effect:"fadeIn",skip_invisible:!1,container:b})},300)}(b("img.lazy",c.body),b(".RL-MailMessageView .messageView .messageItem .content")[0]),sb.windowResize(500)}},z.newInstanceFromJson=function(a){var b=new z;return b.initByJson(a)?b.initComputed():null},z.prototype.initComputed=function(){return this.hasSubScribedSubfolders=c.computed(function(){return!!h.find(this.subFolders(),function(a){return a.subScribed()})},this),this.canBeEdited=c.computed(function(){return qb.FolderType.User===this.type()&&this.existen&&this.selectable},this),this.visible=c.computed(function(){var a=this.subScribed(),b=this.hasSubScribedSubfolders();return a||b&&(!this.existen||!this.selectable)},this),this.isSystemFolder=c.computed(function(){return qb.FolderType.User!==this.type()},this),this.hidden=c.computed(function(){var a=this.isSystemFolder(),b=this.hasSubScribedSubfolders();return this.isGmailFolder||a&&this.isNamespaceFolder||a&&!b},this),this.selectableForFolderList=c.computed(function(){return!this.isSystemFolder()&&this.selectable},this),this.messageCountAll=c.computed({read:this.privateMessageCountAll,write:function(a){sb.isPosNumeric(a,!0)?this.privateMessageCountAll(a):this.privateMessageCountAll.valueHasMutated()},owner:this}),this.messageCountUnread=c.computed({read:this.privateMessageCountUnread,write:function(a){sb.isPosNumeric(a,!0)?this.privateMessageCountUnread(a):this.privateMessageCountUnread.valueHasMutated()},owner:this}),this.printableUnreadCount=c.computed(function(){var a=this.messageCountAll(),b=this.messageCountUnread(),c=this.type();if(qb.FolderType.Inbox===c&&Eb.data().foldersInboxUnreadCount(b),a>0){if(qb.FolderType.Draft===c)return""+a;if(b>0&&qb.FolderType.Trash!==c&&qb.FolderType.SentItems!==c)return""+b}return""},this),this.canBeDeleted=c.computed(function(){var a=this.isSystemFolder();return!a&&0===this.subFolders().length&&"INBOX"!==this.fullNameRaw},this),this.canBeSubScribed=c.computed(function(){return!this.isSystemFolder()&&this.selectable&&"INBOX"!==this.fullNameRaw},this),this.visible.subscribe(function(){sb.timeOutAction("folder-list-folder-visibility-change",function(){Bb.trigger("folder-list-folder-visibility-change")},100)}),this.localName=c.computed(function(){vb.langChangeTrigger();var a=this.type(),b=this.name();if(this.isSystemFolder())switch(a){case qb.FolderType.Inbox:b=sb.i18n("FOLDER_LIST/INBOX_NAME");break;case qb.FolderType.SentItems:b=sb.i18n("FOLDER_LIST/SENT_NAME");break;case qb.FolderType.Draft:b=sb.i18n("FOLDER_LIST/DRAFTS_NAME");break;case qb.FolderType.Spam:b=sb.i18n("FOLDER_LIST/SPAM_NAME");break;case qb.FolderType.Trash:b=sb.i18n("FOLDER_LIST/TRASH_NAME")}return b},this),this.manageFolderSystemName=c.computed(function(){vb.langChangeTrigger();var a="",b=this.type(),c=this.name();if(this.isSystemFolder())switch(b){case qb.FolderType.Inbox:a="("+sb.i18n("FOLDER_LIST/INBOX_NAME")+")";break;case qb.FolderType.SentItems:a="("+sb.i18n("FOLDER_LIST/SENT_NAME")+")";break;case qb.FolderType.Draft:a="("+sb.i18n("FOLDER_LIST/DRAFTS_NAME")+")";break;case qb.FolderType.Spam:a="("+sb.i18n("FOLDER_LIST/SPAM_NAME")+")";break;case qb.FolderType.Trash:a="("+sb.i18n("FOLDER_LIST/TRASH_NAME")+")"}return(""!==a&&"("+c+")"===a||"(inbox)"===a.toLowerCase())&&(a=""),a},this),this.collapsed=c.computed({read:function(){return!this.hidden()&&this.collapsedPrivate()},write:function(a){this.collapsedPrivate(a)},owner:this}),this.hasUnreadMessages=c.computed(function(){return 0"},B.prototype.formattedNameForCompose=function(){var a=this.name();return""===a?this.email():a+" ("+this.email()+")"},B.prototype.formattedNameForEmail=function(){var a=this.name();return""===a?this.email():'"'+sb.quoteName(a)+'" <'+this.email()+">"},sb.extendAsViewModel("PopupsFolderClearViewModel",C),C.prototype.clearPopup=function(){this.clearingProcess(!1),this.selectedFolder(null)},C.prototype.onShow=function(a){this.clearPopup(),a&&this.selectedFolder(a)},C.prototype.onBuild=function(){var a=this;Bb.on("keydown",function(b){var c=!0;return b&&qb.EventKeyCode.Esc===b.keyCode&&a.modalVisibility()&&(sb.delegateRun(a,"cancelCommand"),c=!1),c})},sb.extendAsViewModel("PopupsFolderCreateViewModel",D),D.prototype.sNoParentText="",D.prototype.simpleFolderNameValidation=function(a){return/^[^\\\/]+$/g.test(sb.trim(a))},D.prototype.clearPopup=function(){this.folderName(""),this.selectedParentValue(""),this.folderName.focused(!1)},D.prototype.onShow=function(){this.clearPopup()},D.prototype.onFocus=function(){this.folderName.focused(!0)},D.prototype.onBuild=function(){var a=this;Bb.on("keydown",function(b){var c=!0;return b&&qb.EventKeyCode.Esc===b.keyCode&&a.modalVisibility()&&(sb.delegateRun(a,"cancelCommand"),c=!1),c})},sb.extendAsViewModel("PopupsFolderSystemViewModel",E),E.prototype.sChooseOnText="",E.prototype.sUnuseText="",E.prototype.onShow=function(a){var b="";switch(a=sb.isUnd(a)?qb.SetSystemFoldersNotification.None:a){case qb.SetSystemFoldersNotification.Sent:b=sb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SENT");break;case qb.SetSystemFoldersNotification.Draft:b=sb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_DRAFTS");break;case qb.SetSystemFoldersNotification.Spam:b=sb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SPAM");break;case qb.SetSystemFoldersNotification.Trash:b=sb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH")}this.notification(b)},E.prototype.onBuild=function(){var a=this;Bb.on("keydown",function(b){var c=!0;return b&&qb.EventKeyCode.Esc===b.keyCode&&a.modalVisibility()&&(sb.delegateRun(a,"cancelCommand"),c=!1),c})},sb.extendAsViewModel("PopupsComposeViewModel",F),F.prototype.findIdentityIdByMessage=function(a,b){var c={},d="",e=function(a){return a&&a.email&&c[a.email]?(d=c[a.email],!0):!1};if(this.bAllowIdentities&&h.each(this.identities(),function(a){c[a.email()]=a.id}),c[Eb.data().accountEmail()]=Eb.data().accountEmail(),b)switch(a){case qb.ComposeType.Empty:case qb.ComposeType.ForwardAsAttachment:d=Eb.data().accountEmail();break;case qb.ComposeType.Reply:case qb.ComposeType.ReplyAll:case qb.ComposeType.Forward:h.find(h.union(b.to,b.cc,b.bcc),e);break;case qb.ComposeType.Draft:h.find(h.union(b.from,b.replyTo),e)}else d=Eb.data().accountEmail();return d},F.prototype.selectIdentity=function(a){a&&this.currentIdentityID(a.optValue)},F.prototype.formattedFrom=function(a){var b=Eb.data().displayName(),c=Eb.data().accountEmail();return""===b?c:(sb.isUnd(a)?1:!a)?b+" ("+c+")":'"'+sb.quoteName(b)+'" <'+c+">"},F.prototype.sendMessageResponse=function(b,c){var d=!1,e="";this.sending(!1),qb.StorageResultType.Success===b&&c&&c.Result&&(d=!0,this.modalVisibility()&&sb.delegateRun(this,"closeCommand")),this.modalVisibility()&&!d&&(c&&qb.Notification.CantSaveMessage===c.ErrorCode?(this.sendSuccessButSaveError(!0),a.alert(sb.trim(sb.i18n("COMPOSE/SAVED_ERROR_ON_SEND")))):(e=sb.getNotification(c&&c.ErrorCode?c.ErrorCode:qb.Notification.CantSendMessage,c&&c.ErrorMessage?c.ErrorMessage:""),this.sendError(!0),a.alert(e||sb.getNotification(qb.Notification.CantSendMessage))))},F.prototype.saveMessageResponse=function(b,c){var d=!1,e=null;this.saving(!1),qb.StorageResultType.Success===b&&c&&c.Result&&c.Result.NewFolder&&c.Result.NewUid&&(this.bFromDraft&&(e=Eb.data().message(),e&&this.draftFolder()===e.folderFullNameRaw&&this.draftUid()===e.uid&&Eb.data().message(null)),this.draftFolder(c.Result.NewFolder),this.draftUid(c.Result.NewUid),this.modalVisibility()&&(this.savedTime(Math.round((new a.Date).getTime()/1e3)),this.savedOrSendingText(0c;c++)e.push(a[c].toLine(!!b));return e.join(", ")};if(c=c||null,c&&sb.isNormal(c)&&(v=sb.isArray(c)&&1===c.length?c[0]:sb.isArray(c)?null:c),null!==q&&(p[q]=!0,this.currentIdentityID(this.findIdentityIdByMessage(w,v))),this.reset(),sb.isNonEmptyArray(d)&&this.to(x(d)),""!==w&&v){switch(j=v.fullFormatDateValue(),k=v.subject(),u=v.aDraftInfo,l=b(v.body).clone(),sb.removeBlockquoteSwitcher(l),m=l.html(),w){case qb.ComposeType.Empty:break;case qb.ComposeType.Reply:this.to(x(v.replyEmails(p))),this.subject(sb.replySubjectAdd("Re",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["reply",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=sb.trim(this.sInReplyTo+" "+v.sReferences);break;case qb.ComposeType.ReplyAll:o=v.replyAllEmails(p),this.to(x(o[0])),this.cc(x(o[1])),this.subject(sb.replySubjectAdd("Re",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["reply",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=sb.trim(this.sInReplyTo+" "+v.references());break;case qb.ComposeType.Forward:this.subject(sb.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["forward",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=sb.trim(this.sInReplyTo+" "+v.sReferences);break;case qb.ComposeType.ForwardAsAttachment:this.subject(sb.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["forward",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=sb.trim(this.sInReplyTo+" "+v.sReferences);break;case qb.ComposeType.Draft:this.to(x(v.to)),this.cc(x(v.cc)),this.bcc(x(v.bcc)),this.bFromDraft=!0,this.draftFolder(v.folderFullNameRaw),this.draftUid(v.uid),this.subject(k),this.prepearMessageAttachments(v,w),this.aDraftInfo=sb.isNonEmptyArray(u)&&3===u.length?u:null,this.sInReplyTo=v.sInReplyTo,this.sReferences=v.sReferences;break;case qb.ComposeType.EditAsNew:this.to(x(v.to)),this.cc(x(v.cc)),this.bcc(x(v.bcc)),this.subject(k),this.prepearMessageAttachments(v,w),this.aDraftInfo=sb.isNonEmptyArray(u)&&3===u.length?u:null,this.sInReplyTo=v.sInReplyTo,this.sReferences=v.sReferences}switch(w){case qb.ComposeType.Reply:case qb.ComposeType.ReplyAll:f=v.fromToLine(!1,!0),n=sb.i18n("COMPOSE/REPLY_MESSAGE_TITLE",{DATETIME:j,EMAIL:f}),m="
"+n+":
"+m+"
";break;case qb.ComposeType.Forward:f=v.fromToLine(!1,!0),g=v.toToLine(!1,!0),i=v.ccToLine(!1,!0),m="
"+sb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TITLE")+"
"+sb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_FROM")+": "+f+"
"+sb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TO")+": "+g+(0"+sb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_CC")+": "+i:"")+"
"+sb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SENT")+": "+sb.encodeHtml(j)+"
"+sb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT")+": "+sb.encodeHtml(k)+"
"+m;break;case qb.ComposeType.ForwardAsAttachment:m=""}s&&""!==r&&qb.ComposeType.EditAsNew!==w&&qb.ComposeType.Draft!==w&&(m=this.convertSignature(r,x(v.from,!0))+"
"+m),this.editor(function(a){a.setHtml(m,!1),v.isHtml()||a.modeToggle(!1)})}else qb.ComposeType.Empty===w?(m=this.convertSignature(r),this.editor(function(a){a.setHtml(m,!1),qb.EditorDefaultType.Html!==Eb.data().editorDefaultType()&&a.modeToggle(!1)})):sb.isNonEmptyArray(c)&&h.each(c,function(a){e.addMessageAsAttachment(a)});t=this.getAttachmentsDownloadsForUpload(),sb.isNonEmptyArray(t)&&Eb.remote().messageUploadAttachments(function(a,b){if(qb.StorageResultType.Success===a&&b&&b.Result){var c=null,d="";if(!e.viewModelVisibility())for(d in b.Result)b.Result.hasOwnProperty(d)&&(c=e.getAttachmentById(b.Result[d]),c&&c.tempName(d))}else e.setMessageAttachmentFailedDowbloadText()},t),this.triggerForResize()},F.prototype.onFocus=function(){""===this.to()?this.to.focusTrigger(!this.to.focusTrigger()):this.oEditor&&this.oEditor.focus(),this.triggerForResize()},F.prototype.tryToClosePopup=function(){var a=this;xb.showScreenPopup(L,[sb.i18n("POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW"),function(){a.modalVisibility()&&sb.delegateRun(a,"closeCommand")}])},F.prototype.onBuild=function(){this.initUploader();var a=this,c=null;Bb.on("keydown",function(b){var c=!0;return b&&a.modalVisibility()&&Eb.data().useKeyboardShortcuts()&&(b.ctrlKey&&qb.EventKeyCode.S===b.keyCode?(a.saveCommand(),c=!1):b.ctrlKey&&qb.EventKeyCode.Enter===b.keyCode?(a.sendCommand(),c=!1):qb.EventKeyCode.Esc===b.keyCode&&(a.tryToClosePopup(),c=!1)),c}),Bb.on("resize",function(){a.triggerForResize()}),this.dropboxEnabled()&&(c=document.createElement("script"),c.type="text/javascript",c.src="https://www.dropbox.com/static/api/1/dropins.js",b(c).attr("id","dropboxjs").attr("data-app-key",Eb.settingsGet("DropboxApiKey")),document.body.appendChild(c))},F.prototype.getAttachmentById=function(a){for(var b=this.attachments(),c=0,d=b.length;d>c;c++)if(b[c]&&a===b[c].id)return b[c];return null},F.prototype.initUploader=function(){if(this.composeUploaderButton()){var a={},b=sb.pInt(Eb.settingsGet("AttachmentLimit")),c=new g({action:Eb.link().upload(),name:"uploader",queueSize:2,multipleSizeLimit:50,disableFolderDragAndDrop:!1,clickElement:this.composeUploaderButton(),dragAndDropElement:this.composeUploaderDropPlace()});c?(c.on("onDragEnter",h.bind(function(){this.dragAndDropOver(!0)},this)).on("onDragLeave",h.bind(function(){this.dragAndDropOver(!1)},this)).on("onBodyDragEnter",h.bind(function(){this.dragAndDropVisible(!0)},this)).on("onBodyDragLeave",h.bind(function(){this.dragAndDropVisible(!1)},this)).on("onProgress",h.bind(function(b,c,d){var e=null;sb.isUnd(a[b])?(e=this.getAttachmentById(b),e&&(a[b]=e)):e=a[b],e&&e.progress(" - "+Math.floor(c/d*100)+"%")},this)).on("onSelect",h.bind(function(a,d){this.dragAndDropOver(!1);var e=this,f=sb.isUnd(d.FileName)?"":d.FileName.toString(),g=sb.isNormal(d.Size)?sb.pInt(d.Size):null,h=new x(a,f,g);return h.cancel=function(a){return function(){e.attachments.remove(function(b){return b&&b.id===a}),c&&c.cancel(a)}}(a),this.attachments.push(h),g>0&&b>0&&g>b?(h.error(sb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):!0},this)).on("onStart",h.bind(function(b){var c=null;sb.isUnd(a[b])?(c=this.getAttachmentById(b),c&&(a[b]=c)):c=a[b],c&&(c.waiting(!1),c.uploading(!0))},this)).on("onComplete",h.bind(function(b,c,d){var e="",f=null,g=null,h=this.getAttachmentById(b);g=c&&d&&d.Result&&d.Result.Attachment?d.Result.Attachment:null,f=d&&d.Result&&d.Result.ErrorCode?d.Result.ErrorCode:null,null!==f?e=sb.getUploadErrorDescByCode(f):g||(e=sb.i18n("UPLOAD/ERROR_UNKNOWN")),h&&(""!==e&&00&&d>0&&f>d?(e.uploading(!1),e.error(sb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):(Eb.remote().composeUploadExternals(function(a,b){var c=!1;e.uploading(!1),qb.StorageResultType.Success===a&&b&&b.Result&&b.Result[e.id]&&(c=!0,e.tempName(b.Result[e.id])),c||e.error(sb.getUploadErrorDescByCode(qb.UploadErrorCode.FileNoUploaded))},[a.link]),!0)},F.prototype.prepearMessageAttachments=function(a,b){if(a){var c=this,d=sb.isNonEmptyArray(a.attachments())?a.attachments():[],e=0,f=d.length,g=null,h=null,i=!1,j=function(a){return function(){c.attachments.remove(function(b){return b&&b.id===a})}};if(qb.ComposeType.ForwardAsAttachment===b)this.addMessageAsAttachment(a);else for(;f>e;e++){switch(h=d[e],i=!1,b){case qb.ComposeType.Reply:case qb.ComposeType.ReplyAll:i=h.isLinked;break;case qb.ComposeType.Forward:case qb.ComposeType.Draft:case qb.ComposeType.EditAsNew:i=!0}i=!0,i&&(g=new x(h.download,h.fileName,h.estimatedSize,h.isInline,h.isLinked,h.cid,h.contentLocation),g.fromMessage=!0,g.cancel=j(h.download),g.waiting(!1).uploading(!0),this.attachments.push(g))}}},F.prototype.removeLinkedAttachments=function(){this.attachments.remove(function(a){return a&&a.isLinked})},F.prototype.setMessageAttachmentFailedDowbloadText=function(){h.each(this.attachments(),function(a){a&&a.fromMessage&&a.waiting(!1).uploading(!1).error(sb.getUploadErrorDescByCode(qb.UploadErrorCode.FileNoUploaded))},this)},F.prototype.isEmptyForm=function(a){a=sb.isUnd(a)?!0:!!a;var b=a?0===this.attachments().length:0===this.attachmentsInReady().length;return 0===this.to().length&&0===this.cc().length&&0===this.bcc().length&&0===this.subject().length&&b&&(!this.oEditor||""===this.oEditor.getData())},F.prototype.reset=function(){this.to(""),this.cc(""),this.bcc(""),this.replyTo(""),this.subject(""),this.requestReadReceipt(!1),this.aDraftInfo=null,this.sInReplyTo="",this.bFromDraft=!1,this.sReferences="",this.bReloadFolder=!1,this.sendError(!1),this.sendSuccessButSaveError(!1),this.savedError(!1),this.savedTime(0),this.savedOrSendingText(""),this.emptyToError(!1),this.showCcAndBcc(!1),this.attachments([]),this.dragAndDropOver(!1),this.dragAndDropVisible(!1),this.draftFolder(""),this.draftUid(""),this.sending(!1),this.saving(!1),this.oEditor&&this.oEditor.clear(!1)},F.prototype.getAttachmentsDownloadsForUpload=function(){return h.map(h.filter(this.attachments(),function(a){return a&&""===a.tempName()}),function(a){return a.id})},F.prototype.triggerForResize=function(){this.resizer(!this.resizer())},sb.extendAsViewModel("PopupsContactsViewModel",G),G.prototype.setShareToNone=function(){this.viewScopeType(qb.ContactScopeType.Default)},G.prototype.setShareToAll=function(){this.viewScopeType(qb.ContactScopeType.ShareAll)},G.prototype.addNewProperty=function(a){var b=new v(a,"");b.focused(!0),this.viewProperties.push(b)},G.prototype.addNewEmail=function(){this.addNewProperty(qb.ContactPropertyType.EmailPersonal)},G.prototype.addNewPhone=function(){this.addNewProperty(qb.ContactPropertyType.MobilePersonal)},G.prototype.initUploader=function(){if(this.importUploaderButton()){var b=new g({action:Eb.link().uploadContacts(),name:"uploader",queueSize:1,multipleSizeLimit:1,disableFolderDragAndDrop:!0,disableDragAndDrop:!0,disableMultiple:!0,disableDocumentDropPrevent:!0,clickElement:this.importUploaderButton()});b&&b.on("onStart",h.bind(function(){this.contacts.importing(!0)},this)).on("onComplete",h.bind(function(b,c,d){this.contacts.importing(!1),this.reloadContactList(),b&&c&&d&&d.Result||a.alert(sb.i18n("CONTACTS/ERROR_IMPORT_FILE"))},this))}},G.prototype.removeCheckedOrSelectedContactsFromList=function(){var a=this,b=this.contacts,c=this.currentContact(),d=this.contacts().length,e=this.contactsCheckedOrSelected();0=d&&(this.bDropPageAfterDelete=!0),h.delay(function(){h.each(e,function(a){b.remove(a)})},500))},G.prototype.deleteSelectedContacts=function(){00?d:0),b.contactsCount(d),b.contacts(e),b.viewClearSearch(""!==b.search()),b.contacts.loading(!1),""!==b.viewID()&&!b.currentContact()&&b.contacts.setSelectedByUid&&b.contacts.setSelectedByUid(""+b.viewID())},c,pb.Defaults.ContactsPerPage,this.search())},G.prototype.onBuild=function(a){this.oContentVisible=b(".b-list-content",a),this.oContentScrollable=b(".content",this.oContentVisible),this.selector.init(this.oContentVisible,this.oContentScrollable);var d=this;c.computed(function(){var a=this.modalVisibility(),b=Eb.data().useKeyboardShortcuts();this.selector.useKeyboard(a&&b)},this).extend({notify:"always"}),a.on("click",".e-pagenator .e-page",function(){var a=c.dataFor(this);a&&(d.contactsPage(sb.pInt(a.value)),d.reloadContactList())}),Bb.on("keydown",function(a){var b=!0;return a&&d.modalVisibility()&&(qb.EventKeyCode.Esc===a.keyCode?(sb.delegateRun(d,"closeCommand"),b=!1):a.ctrlKey&&qb.EventKeyCode.S===a.keyCode&&(d.saveCommand(),b=!1)),b}),this.initUploader()},G.prototype.onShow=function(){xb.routeOff(),this.reloadContactList(!0)},G.prototype.onHide=function(){xb.routeOn(),this.currentContact(null),this.emptySelection(!0),this.search(""),h.each(this.contacts(),function(a){a.checked(!1)})},sb.extendAsViewModel("PopupsAdvancedSearchViewModel",H),H.prototype.buildSearchStringValue=function(a){return-10&&g.messageCountUnread(0<=g.messageCountUnread()-e?g.messageCountUnread()-e:0)),i&&(i.messageCountAll(i.messageCountAll()+b.length),e>0&&i.messageCountUnread(i.messageCountUnread()+e)),0'+a.openpgp.decryptMessage(g,e)+""))}catch(i){}}])},T.prototype.onBuild=function(a){var d=this,e=Eb.data();Cb.on("keydown",function(a){var b=!0,c=a?a.keyCode:0;return c>0&&qb.EventKeyCode.Esc===c&&d.viewModelVisibility()&&e.useKeyboardShortcuts()&&!sb.inFocus()&&e.message()&&(d.fullScreenMode(!1),qb.Layout.NoPreview===e.layout()&&Eb.historyBack(),b=!1),b}),b(".attachmentsPlace",a).magnificPopup({delegate:".magnificPopupImage:visible",type:"image",gallery:{enabled:!0,preload:[1,1],navigateByImgClick:!0},callbacks:{open:function(){e.useKeyboardShortcuts(!1)},close:function(){e.useKeyboardShortcuts(!0)}},mainClass:"mfp-fade",removalDelay:400}),a.on("mousedown","a",function(a){return!(a&&3!==a.which&&Eb.mailToHelper(b(this).attr("href")))}).on("click",".attachmentsPlace .attachmentPreview",function(a){a&&a.stopPropagation&&a.stopPropagation()}).on("click",".attachmentsPlace .attachmentItem",function(){var a=c.dataFor(this);a&&a.download&&Eb.download(a.linkDownload())}),this.oMessageScrollerDom=a.find(".messageItem .content"),this.oMessageScrollerDom=this.oMessageScrollerDom&&this.oMessageScrollerDom[0]?this.oMessageScrollerDom:null},T.prototype.isDraftFolder=function(){return Eb.data().message()&&Eb.data().draftFolder()===Eb.data().message().folderFullNameRaw},T.prototype.isSentFolder=function(){return Eb.data().message()&&Eb.data().sentFolder()===Eb.data().message().folderFullNameRaw},T.prototype.isDraftOrSentFolder=function(){return this.isDraftFolder()||this.isSentFolder()},T.prototype.composeClick=function(){xb.showScreenPopup(F)},T.prototype.editMessage=function(){Eb.data().message()&&xb.showScreenPopup(F,[qb.ComposeType.Draft,Eb.data().message()])},T.prototype.scrollMessageToTop=function(){this.oMessageScrollerDom&&this.oMessageScrollerDom.scrollTop(0)},T.prototype.showImages=function(a){a&&a.showExternalImages&&a.showExternalImages(!0)},T.prototype.readReceipt=function(a){a&&""!==a.readReceipt()&&(Eb.remote().sendReadReceiptMessage(sb.emptyFunction,a.folderFullNameRaw,a.uid,a.readReceipt(),sb.i18n("READ_RECEIPT/SUBJECT",{SUBJECT:a.subject()}),sb.i18n("READ_RECEIPT/BODY",{"READ-RECEIPT":a.readReceipt()})),a.isReadReceipt(!0),Eb.cache().storeMessageFlagsToCache(a),Eb.reloadFlagsCurrentMessageListAndMessageFromCache())},sb.extendAsViewModel("SettingsMenuViewModel",U),U.prototype.link=function(a){return Eb.link().settings(a)},U.prototype.backToMailBoxClick=function(){xb.setHash(Eb.link().inbox())},sb.extendAsViewModel("SettingsPaneViewModel",V),V.prototype.onShow=function(){Eb.data().message(null)},V.prototype.backToMailBoxClick=function(){xb.setHash(Eb.link().inbox())},sb.addSettingsViewModel(W,"SettingsGeneral","SETTINGS_LABELS/LABEL_GENERAL_NAME","general",!0),W.prototype.toggleLayout=function(){this.layout(qb.Layout.NoPreview===this.layout()?qb.Layout.SidePreview:qb.Layout.NoPreview)},W.prototype.onBuild=function(){var a=this;h.delay(function(){var c=Eb.data(),d=sb.settingsSaveHelperSimpleFunction(a.mppTrigger,a);c.language.subscribe(function(c){a.languageTrigger(qb.SaveSettingsStep.Animate),b.ajax({url:Eb.link().langLink(c),dataType:"script",cache:!0}).done(function(){sb.i18nToDoc(),a.languageTrigger(qb.SaveSettingsStep.TrueResult)}).fail(function(){a.languageTrigger(qb.SaveSettingsStep.FalseResult)}).always(function(){h.delay(function(){a.languageTrigger(qb.SaveSettingsStep.Idle)},1e3)}),Eb.remote().saveSettings(sb.emptyFunction,{Language:c})}),c.editorDefaultType.subscribe(function(a){Eb.remote().saveSettings(sb.emptyFunction,{EditorDefaultType:a})}),c.messagesPerPage.subscribe(function(a){Eb.remote().saveSettings(d,{MPP:a})}),c.showImages.subscribe(function(a){Eb.remote().saveSettings(sb.emptyFunction,{ShowImages:a?"1":"0"})}),c.interfaceAnimation.subscribe(function(a){Eb.remote().saveSettings(sb.emptyFunction,{InterfaceAnimation:a})}),c.useDesktopNotifications.subscribe(function(a){sb.timeOutAction("SaveDesktopNotifications",function(){Eb.remote().saveSettings(sb.emptyFunction,{DesktopNotifications:a?"1":"0"})},3e3)}),c.replySameFolder.subscribe(function(a){sb.timeOutAction("SaveReplySameFolder",function(){Eb.remote().saveSettings(sb.emptyFunction,{ReplySameFolder:a?"1":"0"})},3e3)}),c.useThreads.subscribe(function(a){c.messageList([]),Eb.remote().saveSettings(sb.emptyFunction,{UseThreads:a?"1":"0"})}),c.layout.subscribe(function(a){c.messageList([]),Eb.remote().saveSettings(sb.emptyFunction,{Layout:a})}),c.useCheckboxesInList.subscribe(function(a){Eb.remote().saveSettings(sb.emptyFunction,{UseCheckboxesInList:a?"1":"0"})})},50)},W.prototype.onShow=function(){Eb.data().desktopNotifications.valueHasMutated()},W.prototype.selectLanguage=function(){xb.showScreenPopup(K)},sb.addSettingsViewModel(X,"SettingsContacts","SETTINGS_LABELS/LABEL_CONTACTS_NAME","contacts"),X.prototype.toggleShowPassword=function(){this.showPassword(!this.showPassword())},X.prototype.onBuild=function(){Eb.data().contactsAutosave.subscribe(function(a){Eb.remote().saveSettings(sb.emptyFunction,{ContactsAutosave:a?"1":"0"})})},X.prototype.onShow=function(){this.showPassword(!1)},sb.addSettingsViewModel(Y,"SettingsAccounts","SETTINGS_LABELS/LABEL_ACCOUNTS_NAME","accounts"),Y.prototype.addNewAccount=function(){xb.showScreenPopup(I)},Y.prototype.deleteAccount=function(b){if(b&&b.deleteAccess()){this.accountForDeletion(null);var c=function(a){return b===a};b&&(this.accounts.remove(c),Eb.remote().accountDelete(function(b,c){qb.StorageResultType.Success===b&&c&&c.Result&&c.Reload?(xb.routeOff(),xb.setHash(Eb.link().root(),!0),xb.routeOff(),h.defer(function(){a.location.reload()})):Eb.accountsAndIdentities()},b.email))}},sb.addSettingsViewModel(Z,"SettingsIdentity","SETTINGS_LABELS/LABEL_IDENTITY_NAME","identity"),Z.prototype.onHide=function(){this.editor&&this.editor.hideEditorToolbar()},Z.prototype.onFocus=function(){if(!this.editor&&this.signatureDom()){var a=this,b=Eb.data().signature();this.editor=new k(a.signatureDom(),function(){Eb.data().signature((a.editor.isHtml()?":HTML:":"")+a.editor.getData())},function(){":HTML:"===b.substr(0,6)?a.editor.setHtml(b.substr(6),!1):a.editor.setPlain(b,!1)}),this.editor.addInputFormatStyle(),sb.initOnStartOrLangChange(function(){a.editor.setupLang(sb.i18n("EDITOR/TEXT_SWITCHER_RICH_FORMATTING"),sb.i18n("EDITOR/TEXT_SWITCHER_PLAINT_TEXT"))})}},Z.prototype.onBuild=function(){var a=this;h.delay(function(){var b=Eb.data(),c=sb.settingsSaveHelperSimpleFunction(a.displayNameTrigger,a),d=sb.settingsSaveHelperSimpleFunction(a.replyTrigger,a),e=sb.settingsSaveHelperSimpleFunction(a.signatureTrigger,a);b.displayName.subscribe(function(a){Eb.remote().saveSettings(c,{DisplayName:a})}),b.replyTo.subscribe(function(a){Eb.remote().saveSettings(d,{ReplyTo:a})}),b.signature.subscribe(function(a){Eb.remote().saveSettings(e,{Signature:a})}),b.signatureToAll.subscribe(function(a){Eb.remote().saveSettings(null,{SignatureToAll:a?"1":"0"})})},50)},sb.addSettingsViewModel($,"SettingsIdentities","SETTINGS_LABELS/LABEL_IDENTITIES_NAME","identities"),$.prototype.addNewIdentity=function(){xb.showScreenPopup(J)},$.prototype.editIdentity=function(a){xb.showScreenPopup(J,[a])},$.prototype.deleteIdentity=function(a){if(a&&a.deleteAccess()){this.identityForDeletion(null);var b=function(b){return a===b};a&&(this.identities.remove(b),Eb.remote().identityDelete(function(){Eb.accountsAndIdentities()},a.id))}},$.prototype.onHide=function(){this.editor&&this.editor.hideEditorToolbar()},$.prototype.onFocus=function(){if(!this.editor&&this.signatureDom()){var a=this,b=Eb.data().signature();this.editor=new k(a.signatureDom(),function(){Eb.data().signature((a.editor.isHtml()?":HTML:":"")+a.editor.getData())},function(){":HTML:"===b.substr(0,6)?a.editor.setHtml(b.substr(6),!1):a.editor.setPlain(b,!1)}),this.editor.addInputFormatStyle(),sb.initOnStartOrLangChange(function(){a.editor.setupLang(sb.i18n("EDITOR/TEXT_SWITCHER_RICH_FORMATTING"),sb.i18n("EDITOR/TEXT_SWITCHER_PLAINT_TEXT"))})}},$.prototype.onBuild=function(a){var b=this;a.on("click",".identity-item .e-action",function(){var a=c.dataFor(this);a&&b.editIdentity(a)}),h.delay(function(){var a=Eb.data(),c=sb.settingsSaveHelperSimpleFunction(b.displayNameTrigger,b),d=sb.settingsSaveHelperSimpleFunction(b.replyTrigger,b),e=sb.settingsSaveHelperSimpleFunction(b.signatureTrigger,b);a.displayName.subscribe(function(a){Eb.remote().saveSettings(c,{DisplayName:a})}),a.replyTo.subscribe(function(a){Eb.remote().saveSettings(d,{ReplyTo:a})}),a.signature.subscribe(function(a){Eb.remote().saveSettings(e,{Signature:a})}),a.signatureToAll.subscribe(function(a){Eb.remote().saveSettings(null,{SignatureToAll:a?"1":"0"})})},50)},sb.addSettingsViewModel(_,"SettingsSocial","SETTINGS_LABELS/LABEL_SOCIAL_NAME","social"),sb.addSettingsViewModel(ab,"SettingsChangePassword","SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME","change-password"),ab.prototype.onHide=function(){this.changeProcess(!1),this.currentPassword(""),this.newPassword("")},ab.prototype.onChangePasswordResponse=function(a,b){this.changeProcess(!1),qb.StorageResultType.Success===a&&b&&b.Result?(this.currentPassword(""),this.newPassword(""),this.passwordUpdateSuccess(!0)):this.passwordUpdateError(!0)},sb.addSettingsViewModel(bb,"SettingsFolders","SETTINGS_LABELS/LABEL_FOLDERS_NAME","folders"),bb.prototype.folderEditOnEnter=function(a){var b=a?sb.trim(a.nameForEdit()):"";""!==b&&a.name()!==b&&(Eb.local().set(qb.ClientSideKeyName.FoldersLashHash,""),Eb.data().foldersRenaming(!0),Eb.remote().folderRename(function(a,b){Eb.data().foldersRenaming(!1),qb.StorageResultType.Success===a&&b&&b.Result||Eb.data().foldersListError(b&&b.ErrorCode?sb.getNotification(b.ErrorCode):sb.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER")),Eb.folders()},a.fullNameRaw,b),Eb.cache().removeFolderFromCacheList(a.fullNameRaw),a.name(b)),a.edited(!1)},bb.prototype.folderEditOnEsc=function(a){a&&a.edited(!1)},bb.prototype.onShow=function(){Eb.data().foldersListError("")},bb.prototype.createFolder=function(){xb.showScreenPopup(D)},bb.prototype.systemFolder=function(){xb.showScreenPopup(E)},bb.prototype.deleteFolder=function(a){if(a&&a.canBeDeleted()&&a.deleteAccess()&&0===a.privateMessageCountAll()){this.folderForDeletion(null);var b=function(c){return a===c?!0:(c.subFolders.remove(b),!1)};a&&(Eb.local().set(qb.ClientSideKeyName.FoldersLashHash,""),Eb.data().folderList.remove(b),Eb.data().foldersDeleting(!0),Eb.remote().folderDelete(function(a,b){Eb.data().foldersDeleting(!1),qb.StorageResultType.Success===a&&b&&b.Result||Eb.data().foldersListError(b&&b.ErrorCode?sb.getNotification(b.ErrorCode):sb.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER")),Eb.folders()},a.fullNameRaw),Eb.cache().removeFolderFromCacheList(a.fullNameRaw))}else 01048576?(a.alert(sb.i18n("SETTINGS_THEMES/ERROR_FILE_IS_TOO_BIG")),!1):!0},this)).on("onStart",h.bind(function(){this.customThemeUploaderProgress(!0)},this)).on("onComplete",h.bind(function(b,c,d){c&&d&&d.Result?this.customThemeImg(d.Result):a.alert(d&&d.ErrorCode?sb.getUploadErrorDescByCode(d.ErrorCode):sb.getUploadErrorDescByCode(qb.UploadErrorCode.Unknown)),this.customThemeUploaderProgress(!1)},this)),!!b}return!1},db.prototype.populateDataOnStart=function(){var a=sb.pInt(Eb.settingsGet("Layout")),b=Eb.settingsGet("Languages"),c=Eb.settingsGet("Themes");sb.isArray(b)&&this.languages(b),sb.isArray(c)&&this.themes(c),this.mainLanguage(Eb.settingsGet("Language")),this.mainTheme(Eb.settingsGet("Theme")),this.allowCustomTheme(!!Eb.settingsGet("AllowCustomTheme")),this.allowAdditionalAccounts(!!Eb.settingsGet("AllowAdditionalAccounts")),this.allowIdentities(!!Eb.settingsGet("AllowIdentities")),this.determineUserLanguage(!!Eb.settingsGet("DetermineUserLanguage")),this.allowThemes(!!Eb.settingsGet("AllowThemes")),this.allowCustomLogin(!!Eb.settingsGet("AllowCustomLogin")),this.allowLanguagesOnLogin(!!Eb.settingsGet("AllowLanguagesOnLogin")),this.allowLanguagesOnSettings(!!Eb.settingsGet("AllowLanguagesOnSettings")),this.editorDefaultType(Eb.settingsGet("EditorDefaultType")),this.showImages(!!Eb.settingsGet("ShowImages")),this.contactsAutosave(!!Eb.settingsGet("ContactsAutosave")),this.interfaceAnimation(Eb.settingsGet("InterfaceAnimation")),this.mainMessagesPerPage(Eb.settingsGet("MPP")),this.desktopNotifications(!!Eb.settingsGet("DesktopNotifications")),this.useThreads(!!Eb.settingsGet("UseThreads")),this.replySameFolder(!!Eb.settingsGet("ReplySameFolder")),this.useCheckboxesInList(!!Eb.settingsGet("UseCheckboxesInList")),this.layout(qb.Layout.SidePreview),-10&&(c=this.messagesBodiesDom(),c&&(c.find(".rl-cache-class").each(function(){var c=b(this);d>c.data("rl-cache-count")&&(c.addClass("rl-cache-purge"),a++)}),a>0&&h.delay(function(){c.find(".rl-cache-purge").remove()},300)))},eb.prototype.populateDataOnStart=function(){db.prototype.populateDataOnStart.call(this),this.accountEmail(Eb.settingsGet("Email")),this.accountIncLogin(Eb.settingsGet("IncLogin")),this.accountOutLogin(Eb.settingsGet("OutLogin")),this.projectHash(Eb.settingsGet("ProjectHash")),this.displayName(Eb.settingsGet("DisplayName")),this.replyTo(Eb.settingsGet("ReplyTo")),this.signature(Eb.settingsGet("Signature")),this.signatureToAll(!!Eb.settingsGet("SignatureToAll")),this.lastFoldersHash=Eb.local().get(qb.ClientSideKeyName.FoldersLashHash)||"",this.remoteSuggestions=!!Eb.settingsGet("RemoteSuggestions"),this.devEmail=Eb.settingsGet("DevEmail"),this.devLogin=Eb.settingsGet("DevLogin"),this.devPassword=Eb.settingsGet("DevPassword")},eb.prototype.initUidNextAndNewMessages=function(b,c,d){if("INBOX"===b&&sb.isNormal(c)&&""!==c){if(sb.isArray(d)&&03)i(Eb.link().notificationMailIcon(),Eb.data().accountEmail(),sb.i18n("MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION",{COUNT:g}));else for(;g>f;f++)i(Eb.link().notificationMailIcon(),y.emailsToLine(y.initEmailsFromJson(d[f].From),!1),d[f].Subject)}Eb.cache().setFolderUidNext(b,c)}},eb.prototype.folderResponseParseRec=function(a,b){var c=0,d=0,e=null,f=null,g="",h=[],i=[];for(c=0,d=b.length;d>c;c++)e=b[c],e&&(g=e.FullNameRaw,f=Eb.cache().getFolderFromCacheList(g),f||(f=z.newInstanceFromJson(e),f&&(Eb.cache().setFolderToCacheList(g,f),Eb.cache().setFolderFullNameRaw(f.fullNameHash,g),f.isGmailFolder=pb.Values.GmailFolderName.toLowerCase()===g.toLowerCase(),""!==a&&a===f.fullNameRaw+f.delimiter&&(f.isNamespaceFolder=!0),(f.isNamespaceFolder||f.isGmailFolder)&&(f.isUnpaddigFolder=!0))),f&&(f.collapsed(!sb.isFolderExpanded(f.fullNameHash)),e.Extended&&(e.Extended.Hash&&Eb.cache().setFolderHash(f.fullNameRaw,e.Extended.Hash),sb.isNormal(e.Extended.MessageCount)&&f.messageCountAll(e.Extended.MessageCount),sb.isNormal(e.Extended.MessageUnseenCount)&&f.messageCountUnread(e.Extended.MessageUnseenCount)),h=e.SubFolders,h&&"Collection/FolderCollection"===h["@Object"]&&h["@Collection"]&&sb.isArray(h["@Collection"])&&f.subFolders(this.folderResponseParseRec(a,h["@Collection"])),i.push(f)));
+return i},eb.prototype.setFolders=function(a){var b=[],c=!1,d=Eb.data(),e=function(a){return""===a||pb.Values.UnuseOptionValue===a||null!==Eb.cache().getFolderFromCacheList(a)?a:""};a&&a.Result&&"Collection/FolderCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&sb.isArray(a.Result["@Collection"])&&(sb.isUnd(a.Result.Namespace)||(d.namespace=a.Result.Namespace),this.threading(!!Eb.settingsGet("UseImapThread")&&a.Result.IsThreadsSupported&&!0),b=this.folderResponseParseRec(d.namespace,a.Result["@Collection"]),d.folderList(b),a.Result.SystemFolders&&""==""+Eb.settingsGet("SentFolder")+Eb.settingsGet("DraftFolder")+Eb.settingsGet("SpamFolder")+Eb.settingsGet("TrashFolder")+Eb.settingsGet("NullFolder")&&(Eb.settingsSet("SentFolder",a.Result.SystemFolders[2]||null),Eb.settingsSet("DraftFolder",a.Result.SystemFolders[3]||null),Eb.settingsSet("SpamFolder",a.Result.SystemFolders[4]||null),Eb.settingsSet("TrashFolder",a.Result.SystemFolders[5]||null),c=!0),d.sentFolder(e(Eb.settingsGet("SentFolder"))),d.draftFolder(e(Eb.settingsGet("DraftFolder"))),d.spamFolder(e(Eb.settingsGet("SpamFolder"))),d.trashFolder(e(Eb.settingsGet("TrashFolder"))),c&&Eb.remote().saveSystemFolders(sb.emptyFunction,{SentFolder:d.sentFolder(),DraftFolder:d.draftFolder(),SpamFolder:d.spamFolder(),TrashFolder:d.trashFolder(),NullFolder:"NullFolder"}),Eb.local().set(qb.ClientSideKeyName.FoldersLashHash,a.Result.FoldersHash))},eb.prototype.hideMessageBodies=function(){var a=this.messagesBodiesDom();a&&a.find(".b-text-part").hide()},eb.prototype.getNextFolderNames=function(a){a=sb.isUnd(a)?!1:!!a;var b=[],c=10,d=f().unix(),e=d-300,g=[],i=function(b){h.each(b,function(b){b&&"INBOX"!==b.fullNameRaw&&b.selectable&&b.existen&&e>b.interval&&(!a||b.subScribed())&&g.push([b.interval,b.fullNameRaw]),b&&0b[0]?1:0}),h.find(g,function(a){var e=Eb.cache().getFolderFromCacheList(a[1]);return e&&(e.interval=d,b.push(a[1])),c<=b.length}),h.uniq(b)},eb.prototype.setMessage=function(c,d){var e=!1,f=!1,g=!1,h=null,i=null,j="",k="",l=!1,m=!1,n=null,o=this.messagesBodiesDom(),p=this.message();if(c&&p&&c.Result&&"Object/Message"===c.Result["@Object"]&&p.folderFullNameRaw===c.Result.Folder&&p.uid===c.Result.Uid){if(this.messageError(""),p.initUpdateByMessageJson(c.Result),Eb.cache().addRequestedMessage(p.folderFullNameRaw,p.uid),d||p.initFlagsByJson(c.Result),o=o&&o[0]?o:null){if(j="rl-"+p.requestHash.replace(/[^a-zA-Z0-9]/g,""),i=o.find("#"+j),i&&i[0])p.body=i,p.body&&(p.body.data("rl-cache-count",++vb.iMessageBodyCacheCount),p.isRtl(!!p.body.data("rl-is-rtl")),p.isHtml(!!p.body.data("rl-is-html")),p.hasImages(!!p.body.data("rl-has-images")),p.plainRaw=sb.pString(p.body.data("rl-plain-raw")));else{if(f=!!c.Result.HasExternals,g=!!c.Result.HasInternals,h=b('').hide().addClass("rl-cache-class"),h.data("rl-cache-count",++vb.iMessageBodyCacheCount),sb.isNormal(c.Result.Html)&&""!==c.Result.Html)e=!0,h.html(c.Result.Html.toString()).addClass("b-text-part html");else if(sb.isNormal(c.Result.Plain)&&""!==c.Result.Plain){if(e=!1,k=c.Result.Plain.toString(),vb.bAllowOpenPGP&&(p.isPgpSigned()||p.isPgpEncrypted())&&sb.isNormal(c.Result.PlainRaw)){if(m=/---BEGIN PGP MESSAGE---/.test(c.Result.PlainRaw),m||(l=/-----BEGIN PGP SIGNED MESSAGE-----/.test(c.Result.PlainRaw)&&/-----BEGIN PGP SIGNATURE-----/.test(c.Result.PlainRaw)),l&&p.isPgpSigned()&&p.pgpSignature()){k=''+c.Result.PlainRaw+"
";try{n=a.openpgp.cleartext.readArmored(c.Result.PlainRaw)}catch(q){}n&&n.getText?k=n.getText():l=!1}else if(m&&p.isPgpEncrypted()){try{n=a.openpgp.message.readArmored(c.Result.PlainRaw)}catch(q){}k=''+c.Result.PlainRaw+"
"}(l||m)&&(h.data("rl-plain-raw",c.Result.PlainRaw),h.data("rl-plain-pgp-encrypted",m),h.data("rl-plain-pgp-signed",l))}h.html(k).addClass("b-text-part plain")}else e=!1;c.Result.Rtl&&(h.data("rl-is-rtl",!0),h.addClass("rtl-text-part")),p.body=h,p.body&&(o.append(p.body),p.body.data("rl-is-html",e),p.body.data("rl-has-images",f),p.isRtl(!!p.body.data("rl-is-rtl")),p.isHtml(!!p.body.data("rl-is-html")),p.hasImages(!!p.body.data("rl-has-images")),p.plainRaw=sb.pString(p.body.data("rl-plain-raw"))),g&&p.showInternalImages(!0),p.hasImages()&&this.showImages()&&p.showExternalImages(!0),this.purgeMessageBodyCacheThrottle()}vb.bAllowOpenPGP&&p.body?(p.isPgpSigned(!!p.body.data("rl-plain-pgp-signed")),p.isPgpEncrypted(!!p.body.data("rl-plain-pgp-encrypted"))):(p.isPgpSigned(!1),p.isPgpEncrypted(!1)),this.messageActiveDom(p.body),this.hideMessageBodies(),p.body.show(),h&&sb.initBlockquoteSwitcher(h)}Eb.cache().initMessageFlagsFromCache(p),p.unseen()&&Eb.setMessageSeen(p),sb.windowResize()}},eb.prototype.setMessageList=function(a,b){if(a&&a.Result&&"Collection/MessageCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&sb.isArray(a.Result["@Collection"])){var c=Eb.data(),d=Eb.cache(),e=null,g=0,h=0,i=0,j=0,k=[],l=f().unix(),m=c.staticMessageList,n=null,o=null,p=null,q=0,r=!1;for(i=sb.pInt(a.Result.MessageResultCount),j=sb.pInt(a.Result.Offset),sb.isNonEmptyArray(a.Result.LastCollapsedThreadUids)&&(e=a.Result.LastCollapsedThreadUids),p=Eb.cache().getFolderFromCacheList(sb.isNormal(a.Result.Folder)?a.Result.Folder:""),p&&!b&&(p.interval=l,Eb.cache().setFolderHash(a.Result.Folder,a.Result.FolderHash),sb.isNormal(a.Result.MessageCount)&&p.messageCountAll(a.Result.MessageCount),sb.isNormal(a.Result.MessageUnseenCount)&&(sb.pInt(p.messageCountUnread())!==sb.pInt(a.Result.MessageUnseenCount)&&(r=!0),p.messageCountUnread(a.Result.MessageUnseenCount)),this.initUidNextAndNewMessages(p.fullNameRaw,a.Result.UidNext,a.Result.NewMessages)),r&&p&&Eb.cache().clearMessageFlagsFromCacheByFolder(p.fullNameRaw),g=0,h=a.Result["@Collection"].length;h>g;g++)n=a.Result["@Collection"][g],n&&"Object/Message"===n["@Object"]&&(o=m[g],o&&o.initByJson(n)||(o=y.newInstanceFromJson(n)),o&&(d.hasNewMessageAndRemoveFromCache(o.folderFullNameRaw,o.uid)&&5>=q&&(q++,o.newForAnimation(!0)),o.deleted(!1),b?Eb.cache().initMessageFlagsFromCache(o):Eb.cache().storeMessageFlagsToCache(o),o.lastInCollapsedThread(e&&-1(new a.Date).getTime()-l),n&&i.oRequests[n]&&(i.oRequests[n].__aborted&&(e="abort"),i.oRequests[n]=null),i.defaultResponse(c,n,e,b,f,d)}),n&&00?(this.defaultRequest(a,"Message",{},null,"Message/"+ub.urlsafe_encode([b,c,Eb.data().projectHash(),Eb.data().threading()&&Eb.data().useThreads()?"1":"0"].join(String.fromCharCode(0))),["Message"]),!0):!1},gb.prototype.composeUploadExternals=function(a,b){this.defaultRequest(a,"ComposeUploadExternals",{Externals:b},999e3)},gb.prototype.folderInformation=function(a,b,c){var d=!0,e=Eb.cache(),f=[];sb.isArray(c)&&0 ").addClass("rl-settings-view-model").hide().attr("data-bind",'template: {name: "'+f.__rlSettingsData.Template+'"}, i18nInit: true'),i.appendTo(g),e.data=Eb.data(),e.viewModelDom=i,e.__rlSettingsData=f.__rlSettingsData,f.__dom=i,f.__builded=!0,f.__vm=e,c.applyBindings(e,i[0]),sb.delegateRun(e,"onBuild",[i])):sb.log("Cannot find sub settings view model position: SettingsSubScreen")),e&&h.defer(function(){d.oCurrentSubScreen&&(sb.delegateRun(d.oCurrentSubScreen,"onHide"),d.oCurrentSubScreen.viewModelDom.hide()),d.oCurrentSubScreen=e,d.oCurrentSubScreen&&(d.oCurrentSubScreen.viewModelDom.show(),sb.delegateRun(d.oCurrentSubScreen,"onShow"),sb.delegateRun(d.oCurrentSubScreen,"onFocus",[],200),h.each(d.menu(),function(a){a.selected(e&&e.__rlSettingsData&&a.route===e.__rlSettingsData.Route)}),b("#rl-content .b-settings .b-content .content").scrollTop(0)),sb.windowResize()})):xb.setHash(Eb.link().settings(),!1,!0)},jb.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(sb.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},jb.prototype.onBuild=function(){h.each(wb.settings,function(a){a&&a.__rlSettingsData&&!h.find(wb["settings-removed"],function(b){return b&&b===a})&&this.menu.push({route:a.__rlSettingsData.Route,label:a.__rlSettingsData.Label,selected:c.observable(!1),disabled:!!h.find(wb["settings-disabled"],function(b){return b&&b===a})})},this),this.oViewModelPlace=b("#rl-content #rl-settings-subscreen")},jb.prototype.routes=function(){var a=h.find(wb.settings,function(a){return a&&a.__rlSettingsData&&a.__rlSettingsData.IsDefault}),b=a?a.__rlSettingsData.Route:"general",c={subname:/^(.*)$/,normalize_:function(a,c){return c.subname=sb.isUnd(c.subname)?b:sb.pString(c.subname),[c.subname]}};return[["{subname}/",c],["{subname}",c],["",c]]},h.extend(kb.prototype,r.prototype),kb.prototype.onShow=function(){Eb.setTitle("")},h.extend(lb.prototype,r.prototype),lb.prototype.oLastRoute={},lb.prototype.setNewTitle=function(){var a=Eb.data().accountEmail(),b=Eb.data().foldersInboxUnreadCount();Eb.setTitle((""===a?"":(b>0?"("+b+") ":" ")+a+" - ")+sb.i18n("TITLES/MAILBOX"))},lb.prototype.onShow=function(){this.setNewTitle()},lb.prototype.onRoute=function(a,b,c,d){if(sb.isUnd(d)?1:!d){var e=Eb.data(),f=Eb.cache().getFolderFullNameRaw(a),g=Eb.cache().getFolderFromCacheList(f);g&&(e.currentFolder(g).messageListPage(b).messageListSearch(c),qb.Layout.NoPreview===e.layout()&&e.message()&&(e.message(null),e.messageFullScreenMode(!1)),Eb.reloadMessageList())}else qb.Layout.NoPreview!==Eb.data().layout()||Eb.data().message()||Eb.historyBack()},lb.prototype.onStart=function(){var a=Eb.data(),b=function(){sb.windowResize()};(Eb.settingsGet("AllowAdditionalAccounts")||Eb.settingsGet("AllowIdentities"))&&Eb.accountsAndIdentities(),h.delay(function(){"INBOX"!==a.currentFolderFullNameRaw()&&Eb.folderInformation("INBOX")},1e3),h.delay(function(){Eb.quota()},5e3),h.delay(function(){Eb.remote().appDelayStart(sb.emptyFunction)},35e3),Ab.toggleClass("rl-no-preview-pane",qb.Layout.NoPreview===a.layout()),a.folderList.subscribe(b),a.messageList.subscribe(b),a.message.subscribe(b),a.layout.subscribe(function(a){Ab.toggleClass("rl-no-preview-pane",qb.Layout.NoPreview===a)}),a.foldersInboxUnreadCount.subscribe(function(){this.setNewTitle()},this)},lb.prototype.routes=function(){var a=function(){return["Inbox",1,"",!0]},b=function(a,b){return b[0]=sb.pString(b[0]),b[1]=sb.pInt(b[1]),b[1]=0>=b[1]?1:b[1],b[2]=sb.pString(b[2]),""===a&&(b[0]="Inbox",b[1]=1),[decodeURI(b[0]),b[1],decodeURI(b[2]),!1]},c=function(a,b){return b[0]=sb.pString(b[0]),b[1]=sb.pString(b[1]),""===a&&(b[0]="Inbox"),[decodeURI(b[0]),1,decodeURI(b[1]),!1]};return[[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)\/(.+)\/?$/,{normalize_:b}],[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)$/,{normalize_:b}],[/^([a-zA-Z0-9]+)\/(.+)\/?$/,{normalize_:c}],[/^message-preview$/,{normalize_:a}],[/^([^\/]*)$/,{normalize_:b}]]},h.extend(mb.prototype,jb.prototype),mb.prototype.onShow=function(){Eb.setTitle(this.sSettingsTitle)},h.extend(nb.prototype,p.prototype),nb.prototype.oSettings=null,nb.prototype.oPlugins=null,nb.prototype.oLocal=null,nb.prototype.oLink=null,nb.prototype.oSubs={},nb.prototype.download=function(b){var c=null,d=null,e=navigator.userAgent.toLowerCase();return e&&(e.indexOf("chrome")>-1||e.indexOf("chrome")>-1)&&(c=document.createElement("a"),c.href=b,document.createEvent&&(d=document.createEvent("MouseEvents"),d&&d.initEvent&&c.dispatchEvent))?(d.initEvent("click",!0,!0),c.dispatchEvent(d),!0):(vb.bMobileDevice?(a.open(b,"_self"),a.focus()):this.iframe.attr("src",b),!0)},nb.prototype.link=function(){return null===this.oLink&&(this.oLink=new j),this.oLink},nb.prototype.local=function(){return null===this.oLocal&&(this.oLocal=new o),this.oLocal},nb.prototype.settingsGet=function(a){return null===this.oSettings&&(this.oSettings=sb.isNormal(yb)?yb:{}),sb.isUnd(this.oSettings[a])?null:this.oSettings[a]},nb.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=sb.isNormal(yb)?yb:{}),this.oSettings[a]=b},nb.prototype.setTitle=function(b){b=(sb.isNormal(b)&&0