From 3936a818b7dc8b8d01df77fe4e6a79c1e0c61d6c Mon Sep 17 00:00:00 2001 From: RainLoop Team Date: Sun, 6 Apr 2014 16:25:15 +0400 Subject: [PATCH] Fix "Always display external images in message body" setting (Closes #116) --- dev/Storages/WebMailData.js | 3 ++- rainloop/v/0.0.0/static/js/app.js | 3 ++- rainloop/v/0.0.0/static/js/app.min.js | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/dev/Storages/WebMailData.js b/dev/Storages/WebMailData.js index 05792592d..8220b906b 100644 --- a/dev/Storages/WebMailData.js +++ b/dev/Storages/WebMailData.js @@ -955,6 +955,8 @@ WebMailDataStorage.prototype.setMessage = function (oData, bCached) oMessagesBodiesDom.append(oMessage.body); } + oMessage.storeDataToDom(); + if (bHasInternals) { oMessage.showInternalImages(true); @@ -965,7 +967,6 @@ WebMailDataStorage.prototype.setMessage = function (oData, bCached) oMessage.showExternalImages(true); } - oMessage.storeDataToDom(); this.purgeMessageBodyCacheThrottle(); } else diff --git a/rainloop/v/0.0.0/static/js/app.js b/rainloop/v/0.0.0/static/js/app.js index 780e9a03f..e6658aa68 100644 --- a/rainloop/v/0.0.0/static/js/app.js +++ b/rainloop/v/0.0.0/static/js/app.js @@ -15159,6 +15159,8 @@ WebMailDataStorage.prototype.setMessage = function (oData, bCached) oMessagesBodiesDom.append(oMessage.body); } + oMessage.storeDataToDom(); + if (bHasInternals) { oMessage.showInternalImages(true); @@ -15169,7 +15171,6 @@ WebMailDataStorage.prototype.setMessage = function (oData, bCached) oMessage.showExternalImages(true); } - oMessage.storeDataToDom(); this.purgeMessageBodyCacheThrottle(); } else diff --git a/rainloop/v/0.0.0/static/js/app.min.js b/rainloop/v/0.0.0/static/js/app.min.js index 7e0a122c2..1c5e34a5d 100644 --- a/rainloop/v/0.0.0/static/js/app.min.js +++ b/rainloop/v/0.0.0/static/js/app.min.js @@ -5,5 +5,5 @@ }},c.bindingHandlers.title={update:function(a,d){b(a).attr("title",c.utils.unwrapObservable(d()))}},c.bindingHandlers.textF={init:function(a,d){b(a).text(c.utils.unwrapObservable(d()))}},c.bindingHandlers.initDom={init:function(a,b){b()(a)}},c.bindingHandlers.initResizeTrigger={init:function(a,d){var e=c.utils.unwrapObservable(d());b(a).css({height:e[1],"min-height":e[1]})},update:function(a,d){var e=c.utils.unwrapObservable(d()),f=Ab.pInt(e[1]),g=0,h=b(a).offset().top;h>0&&(h+=Ab.pInt(e[2]),g=Jb.height()-h,g>f&&(f=g),b(a).css({height:f,"min-height":f}))}},c.bindingHandlers.appendDom={update:function(a,d){b(a).hide().empty().append(c.utils.unwrapObservable(d())).show()}},c.bindingHandlers.draggable={init:function(d,e,f){if(!Db.bMobileDevice){var g=100,h=3,i=f(),j=i&&i.droppableSelector?i.droppableSelector:"",k={distance:20,handle:".dragHandle",cursorAt:{top:22,left:3},refreshPositions:!0,scroll:!0};j&&(k.drag=function(c){b(j).each(function(){var d=null,e=null,f=b(this),i=f.offset(),j=i.top+f.height();a.clearInterval(f.data("timerScroll")),f.data("timerScroll",!1),c.pageX>=i.left&&c.pageX<=i.left+f.width()&&(c.pageY>=j-g&&c.pageY<=j&&(d=function(){f.scrollTop(f.scrollTop()+h),Ab.windowResize()},f.data("timerScroll",a.setInterval(d,10)),d()),c.pageY>=i.top&&c.pageY<=i.top+g&&(e=function(){f.scrollTop(f.scrollTop()-h),Ab.windowResize()},f.data("timerScroll",a.setInterval(e,10)),e()))})},k.stop=function(){b(j).each(function(){a.clearInterval(b(this).data("timerScroll")),b(this).data("timerScroll",!1)})}),k.helper=function(a){return e()(a&&a.target?c.dataFor(a.target):null,!!a.shiftKey)},b(d).draggable(k).on("mousedown",function(){Ab.removeInFocus()})}}},c.bindingHandlers.droppable={init:function(a,c,d){if(!Db.bMobileDevice){var e=c(),f=d(),g=f&&f.droppableOver?f.droppableOver:null,h=f&&f.droppableOut?f.droppableOut:null,i={tolerance:"pointer",hoverClass:"droppableHover"};e&&(i.drop=function(a,b){e(a,b)},g&&(i.over=function(a,b){g(a,b)}),h&&(i.out=function(a,b){h(a,b)}),b(a).droppable(i))}}},c.bindingHandlers.nano={init:function(a){Db.bDisableNanoScroll||b(a).addClass("nano").nanoScroller({iOSNativeScrolling:!1,preventPageScrolling:!0})}},c.bindingHandlers.saveTrigger={init:function(a){var c=b(a);c.data("save-trigger-type",c.is("input[type=text],input[type=email],input[type=password],select,textarea")?"input":"custom"),"custom"===c.data("save-trigger-type")?c.append('  ').addClass("settings-saved-trigger"):c.addClass("settings-saved-trigger-input")},update:function(a,d){var e=c.utils.unwrapObservable(d()),f=b(a);if("custom"===f.data("save-trigger-type"))switch(e.toString()){case"1":f.find(".animated,.error").hide().removeClass("visible").end().find(".success").show().addClass("visible");break;case"0":f.find(".animated,.success").hide().removeClass("visible").end().find(".error").show().addClass("visible");break;case"-2":f.find(".error,.success").hide().removeClass("visible").end().find(".animated").show().addClass("visible");break;default:f.find(".animated").hide().end().find(".error,.success").removeClass("visible")}else switch(e.toString()){case"1":f.addClass("success").removeClass("error");break;case"0":f.addClass("error").removeClass("success");break;case"-2":break;default:f.removeClass("error success")}}},c.bindingHandlers.emailsTags={init:function(a,c){var d=b(a),e=c();d.inputosaurus({parseOnBlur:!0,inputDelimiters:[",",";"],autoCompleteSource:function(a,b){Mb.getAutocomplete(a.term,function(a){b(h.map(a,function(a){return a.toLine(!1)}))})},parseHook:function(a){return h.map(a,function(a){var b=Ab.trim(a),c=null;return""!==b?(c=new u,c.mailsoParse(b),c.clearDuplicateName(),[c.toLine(!1),c]):[b,null]})},change:h.bind(function(a){d.data("EmailsTagsValue",a.target.value),e(a.target.value)},this)}),e.subscribe(function(a){d.data("EmailsTagsValue")!==a&&(d.val(a),d.data("EmailsTagsValue",a),d.inputosaurus("refresh"))}),e.focusTrigger&&e.focusTrigger.subscribe(function(){d.inputosaurus("focus")})}},c.bindingHandlers.command={init:function(a,d,e,f){var g=b(a),h=d();if(!h||!h.enabled||!h.canExecute)throw new Error("You are not using command function");g.addClass("command"),c.bindingHandlers[g.is("form")?"submit":"click"].init.apply(f,arguments)},update:function(a,c){var d=!0,e=b(a),f=c();d=f.enabled(),e.toggleClass("command-not-enabled",!d),d&&(d=f.canExecute(),e.toggleClass("command-can-not-be-execute",!d)),e.toggleClass("command-disabled disable disabled",!d).toggleClass("no-disabled",!!d),(e.is("input")||e.is("button"))&&e.prop("disabled",!d)}},c.extenders.trimmer=function(a){var b=c.computed({read:a,write:function(b){a(Ab.trim(b.toString()))},owner:this});return b(a()),b},c.extenders.reversible=function(a){var b=a();return a.commit=function(){b=a()},a.reverse=function(){a(b)},a.commitedValue=function(){return b},a},c.extenders.toggleSubscribe=function(a,b){return a.subscribe(b[1],b[0],"beforeChange"),a.subscribe(b[2],b[0]),a},c.extenders.falseTimeout=function(b,c){return b.iTimeout=0,b.subscribe(function(d){d&&(a.clearTimeout(b.iTimeout),b.iTimeout=a.setTimeout(function(){b(!1),b.iTimeout=0},Ab.pInt(c)))}),b},c.observable.fn.validateNone=function(){return this.hasError=c.observable(!1),this},c.observable.fn.validateEmail=function(){return this.hasError=c.observable(!1),this.subscribe(function(a){a=Ab.trim(a),this.hasError(""!==a&&!/^[^@\s]+@[^@\s]+$/.test(a))},this),this.valueHasMutated(),this},c.observable.fn.validateSimpleEmail=function(){return this.hasError=c.observable(!1),this.subscribe(function(a){a=Ab.trim(a),this.hasError(""!==a&&!/^.+@.+$/.test(a))},this),this.valueHasMutated(),this},c.observable.fn.validateFunc=function(a){return this.hasFuncError=c.observable(!1),Ab.isFunc(a)&&(this.subscribe(function(b){this.hasFuncError(!a(b))},this),this.valueHasMutated()),this},j.prototype.root=function(){return this.sBase},j.prototype.attachmentDownload=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},j.prototype.attachmentPreview=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/View/"+a},j.prototype.attachmentPreviewAsPlain=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},j.prototype.upload=function(){return this.sServer+"/Upload/"+this.sSpecSuffix+"/"},j.prototype.uploadContacts=function(){return this.sServer+"/UploadContacts/"+this.sSpecSuffix+"/"},j.prototype.uploadBackground=function(){return this.sServer+"/UploadBackground/"+this.sSpecSuffix+"/"},j.prototype.append=function(){return this.sServer+"/Append/"+this.sSpecSuffix+"/"},j.prototype.change=function(b){return this.sServer+"/Change/"+this.sSpecSuffix+"/"+a.encodeURIComponent(b)+"/"},j.prototype.ajax=function(a){return this.sServer+"/Ajax/"+this.sSpecSuffix+"/"+a},j.prototype.messageViewLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},j.prototype.messageDownloadLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},j.prototype.inbox=function(){return this.sBase+"mailbox/Inbox"},j.prototype.messagePreview=function(){return this.sBase+"mailbox/message-preview"},j.prototype.settings=function(a){var b=this.sBase+"settings";return Ab.isUnd(a)||""===a||(b+="/"+a),b},j.prototype.admin=function(a){var b=this.sBase;switch(a){case"AdminDomains":b+="domains";break;case"AdminSecurity":b+="security";break;case"AdminLicensing":b+="licensing"}return b},j.prototype.mailBox=function(a,b,c){b=Ab.isNormal(b)?Ab.pInt(b):1,c=Ab.pString(c);var d=this.sBase+"mailbox/";return""!==a&&(d+=encodeURI(a)),b>1&&(d=d.replace(/[\/]+$/,""),d+="/p"+b),""!==c&&(d=d.replace(/[\/]+$/,""),d+="/"+encodeURI(c)),d},j.prototype.phpInfo=function(){return this.sServer+"Info"},j.prototype.langLink=function(a){return this.sServer+"/Lang/0/"+encodeURI(a)+"/"+this.sVersion+"/"},j.prototype.getUserPicUrlFromHash=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/UserPic/"+a+"/"+this.sVersion+"/"},j.prototype.emptyContactPic=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/empty-contact.png"},j.prototype.sound=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/sounds/"+a},j.prototype.themePreviewLink=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/themes/"+encodeURI(a)+"/images/preview.png"},j.prototype.notificationMailIcon=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/icom-message-notification.png"},j.prototype.openPgpJs=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/js/openpgp.js"},j.prototype.socialGoogle=function(){return this.sServer+"SocialGoogle"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},j.prototype.socialTwitter=function(){return this.sServer+"SocialTwitter"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},j.prototype.socialFacebook=function(){return this.sServer+"SocialFacebook"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},Bb.oViewModelsHooks={},Bb.oSimpleHooks={},Bb.regViewModelHook=function(a,b){b&&(b.__hookName=a)},Bb.addHook=function(a,b){Ab.isFunc(b)&&(Ab.isArray(Bb.oSimpleHooks[a])||(Bb.oSimpleHooks[a]=[]),Bb.oSimpleHooks[a].push(b))},Bb.runHook=function(a,b){Ab.isArray(Bb.oSimpleHooks[a])&&(b=b||[],h.each(Bb.oSimpleHooks[a],function(a){a.apply(null,b)}))},Bb.mainSettingsGet=function(a){return Mb?Mb.settingsGet(a):null},Bb.remoteRequest=function(a,b,c,d,e,f){Mb&&Mb.remote().defaultRequest(a,b,c,d,e,f)},Bb.settingsGet=function(a,b){var c=Bb.mainSettingsGet("Plugins");return c=c&&Ab.isUnd(c[a])?null:c[a],c?Ab.isUnd(c[b])?null:c[b]:null},k.prototype.blurTrigger=function(){if(this.fOnBlur){var b=this;a.clearTimeout(b.iBlurTimer),b.iBlurTimer=a.setTimeout(function(){b.fOnBlur()},200)}},k.prototype.focusTrigger=function(){this.fOnBlur&&a.clearTimeout(this.iBlurTimer)},k.prototype.isHtml=function(){return this.editor?"wysiwyg"===this.editor.mode:!1},k.prototype.checkDirty=function(){return this.editor?this.editor.checkDirty():!1},k.prototype.resetDirty=function(){this.editor&&this.editor.resetDirty()},k.prototype.getData=function(){return this.editor?"plain"===this.editor.mode&&this.editor.plugins.plain&&this.editor.__plain?this.editor.__plain.getRawData():this.editor.getData():""},k.prototype.modeToggle=function(a){this.editor&&(a?"plain"===this.editor.mode&&this.editor.setMode("wysiwyg"):"wysiwyg"===this.editor.mode&&this.editor.setMode("plain"))},k.prototype.setHtml=function(a,b){this.editor&&(this.modeToggle(!0),this.editor.setData(a),b&&this.focus())},k.prototype.setPlain=function(a,b){if(this.editor){if(this.modeToggle(!1),"plain"===this.editor.mode&&this.editor.plugins.plain&&this.editor.__plain)return this.editor.__plain.setRawData(a);this.editor.setData(a),b&&this.focus()}},k.prototype.init=function(){if(this.$element&&this.$element[0]){var b=this,c=Db.oHtmlEditorDefaultConfig,d=Mb.settingsGet("Language"),e=!!Mb.settingsGet("AllowHtmlEditorSourceButton");e&&c.toolbarGroups&&!c.toolbarGroups.__SourceInited&&(c.toolbarGroups.__SourceInited=!0,c.toolbarGroups.push({name:"document",groups:["mode","document","doctools"]})),c.language=Db.oHtmlEditorLangsMap[d]||"en",b.editor=a.CKEDITOR.appendTo(b.$element[0],c),b.editor.on("blur",function(){b.blurTrigger()}),b.editor.on("mode",function(){b.blurTrigger(),b.fOnModeChange&&b.fOnModeChange("plain"!==b.editor.mode)}),b.editor.on("focus",function(){b.focusTrigger()}),b.fOnReady&&b.editor.on("instanceReady",function(){b.editor.setKeystroke(a.CKEDITOR.CTRL+65,"selectAll"),b.fOnReady(),b.__resizable=!0,b.resize()})}},k.prototype.focus=function(){this.editor&&this.editor.focus()},k.prototype.blur=function(){this.editor&&this.editor.focusManager.blur(!0)},k.prototype.resize=function(){this.editor&&this.__resizable&&this.editor.resize(this.$element.width(),this.$element.innerHeight())},k.prototype.clear=function(a){this.setHtml("",a)},l.prototype.selectItemCallbacks=function(a){(this.oCallbacks.onItemSelect||this.emptyFunction)(a)},l.prototype.goDown=function(){this.newSelectPosition(yb.EventKeyCode.Down,!1)},l.prototype.goUp=function(){this.newSelectPosition(yb.EventKeyCode.Up,!1)},l.prototype.init=function(d,e){if(this.oContentVisible=d,this.oContentScrollable=e,this.oContentVisible&&this.oContentScrollable){var f=this;b(this.oContentVisible).on("selectstart",function(a){a&&a.preventDefault&&a.preventDefault()}).on("click",this.sItemSelector,function(a){f.actionClick(c.dataFor(this),a)}).on("click",this.sItemCheckedSelector,function(a){var b=c.dataFor(this);b&&(a&&a.shiftKey?f.actionClick(b,a):(f.sLastUid=f.getItemUid(b),b.selected()?(b.checked(!1),f.selectedItem(null)):b.checked(!b.checked())))}),b(a.document).on("keydown",function(a){var b=!0;return a&&f.bUseKeyboard&&!Ab.inFocus()&&(-10)if(m){if(m)if(yb.EventKeyCode.Down===b||yb.EventKeyCode.Up===b||yb.EventKeyCode.Insert===b)h.each(k,function(a){if(!i)switch(b){case yb.EventKeyCode.Up:m===a?i=!0:j=a;break;case yb.EventKeyCode.Down:case yb.EventKeyCode.Insert:g?(j=a,i=!0):m===a&&(g=!0)}});else if(yb.EventKeyCode.Home===b||yb.EventKeyCode.End===b)yb.EventKeyCode.Home===b?j=k[0]:yb.EventKeyCode.End===b&&(j=k[k.length-1]);else if(yb.EventKeyCode.PageDown===b){for(;l>e;e++)if(m===k[e]){e+=f,e=e>l-1?l-1:e,j=k[e];break}}else if(yb.EventKeyCode.PageUp===b)for(e=l;e>=0;e--)if(m===k[e]){e-=f,e=0>e?0:e,j=k[e];break}}else yb.EventKeyCode.Down===b||yb.EventKeyCode.Insert===b||yb.EventKeyCode.Home===b||yb.EventKeyCode.PageUp===b?j=k[0]:(yb.EventKeyCode.Up===b||yb.EventKeyCode.End===b||yb.EventKeyCode.PageDown===b)&&(j=k[k.length-1]);j?(m&&(c?(yb.EventKeyCode.Up===b||yb.EventKeyCode.Down===b)&&m.checked(!m.checked()):yb.EventKeyCode.Insert===b&&m.checked(!m.checked())),this.throttleSelection=!0,this.selectedItem(j),this.throttleSelection=!0,0!==this.iSelectTimer?(a.clearTimeout(this.iSelectTimer),this.iSelectTimer=a.setTimeout(function(){d.iSelectTimer=0,d.actionClick(j)},1e3)):(this.iSelectTimer=a.setTimeout(function(){d.iSelectTimer=0},200),this.actionClick(j)),this.scrollToSelected()):m&&(!c||yb.EventKeyCode.Up!==b&&yb.EventKeyCode.Down!==b?yb.EventKeyCode.Insert===b&&m.checked(!m.checked()):m.checked(!m.checked()))},l.prototype.scrollToSelected=function(){if(!this.oContentVisible||!this.oContentScrollable)return!1;var a=20,c=b(this.sItemSelectedSelector,this.oContentScrollable),d=c.position(),e=this.oContentVisible.height(),f=c.outerHeight();return d&&(d.top<0||d.top+f>e)?(this.oContentScrollable.scrollTop(d.top<0?this.oContentScrollable.scrollTop()+d.top-a:this.oContentScrollable.scrollTop()+d.top-e+f+a),!0):!1},l.prototype.eventClickFunction=function(a,b){var c=this.getItemUid(a),d=0,e=0,f=null,g="",h=!1,i=!1,j=[],k=!1;if(b&&b.shiftKey&&""!==c&&""!==this.sLastUid&&c!==this.sLastUid)for(j=this.list(),k=a.checked(),d=0,e=j.length;e>d;d++)f=j[d],g=this.getItemUid(f),h=!1,(g===this.sLastUid||g===c)&&(h=!0),h&&(i=!i),(i||h)&&f.checked(k);this.sLastUid=""===c?"":c},l.prototype.actionClick=function(a,b){if(a){var c=!0,d=this.getItemUid(a);b&&(b.shiftKey?(c=!1,""===this.sLastUid&&(this.sLastUid=d),a.checked(!a.checked()),this.eventClickFunction(a,b)):b.ctrlKey&&(c=!1,this.sLastUid=d,a.checked(!a.checked()))),c&&(this.selectedItem(a),this.sLastUid=d)}},l.prototype.on=function(a,b){this.oCallbacks[a]=b},m.supported=function(){return!0},m.prototype.set=function(a,c){var d=b.cookie(xb.Values.ClientSideCookieIndexName),e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[a]=c,b.cookie(xb.Values.ClientSideCookieIndexName,JSON.stringify(f),{expires:30}),e=!0}catch(g){}return e},m.prototype.get=function(a){var c=b.cookie(xb.Values.ClientSideCookieIndexName),d=null;try{d=null===c?null:JSON.parse(c),d=d&&!Ab.isUnd(d[a])?d[a]:null}catch(e){}return d},n.supported=function(){return!!a.localStorage},n.prototype.set=function(b,c){var d=a.localStorage[xb.Values.ClientSideCookieIndexName]||null,e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[b]=c,a.localStorage[xb.Values.ClientSideCookieIndexName]=JSON.stringify(f),e=!0}catch(g){}return e},n.prototype.get=function(b){var c=a.localStorage[xb.Values.ClientSideCookieIndexName]||null,d=null;try{d=null===c?null:JSON.parse(c),d=d&&!Ab.isUnd(d[b])?d[b]:null}catch(e){}return d},o.prototype.item="armoredRainLoopKeys",o.prototype.load=function(){var b=0,c=0,d=[],e=JSON.parse(a.localStorage.getItem(this.item));if(e&&0b;b++)d.push(a.openpgp.key.readArmored(e[b]).keys[0]);return d},o.prototype.store=function(b){for(var c=0,d=b.length,e=[];d>c;c++)e.push(b[c].armor());a.localStorage.setItem(this.item,JSON.stringify(e))},p.prototype.oDriver=null,p.prototype.set=function(a,b){return this.oDriver?this.oDriver.set("p"+a,b):!1},p.prototype.get=function(a){return this.oDriver?this.oDriver.get("p"+a):null},q.prototype.bootstart=function(){},r.prototype.sPosition="",r.prototype.sTemplate="",r.prototype.viewModelName="",r.prototype.viewModelDom=null,r.prototype.viewModelTemplate=function(){return this.sTemplate},r.prototype.viewModelPosition=function(){return this.sPosition},r.prototype.cancelCommand=r.prototype.closeCommand=function(){},r.prototype.registerPopupEscapeKey=function(){var a=this;Jb.on("keydown",function(b){return b&&yb.EventKeyCode.Esc===b.keyCode&&a.modalVisibility()?(Ab.delegateRun(a,"cancelCommand"),!1):!0})},s.prototype.oCross=null,s.prototype.sScreenName="",s.prototype.aViewModels=[],s.prototype.viewModels=function(){return this.aViewModels},s.prototype.screenName=function(){return this.sScreenName},s.prototype.routes=function(){return null},s.prototype.__cross=function(){return this.oCross},s.prototype.__start=function(){var a=this.routes(),b=null,c=null;Ab.isNonEmptyArray(a)&&(c=h.bind(this.onRoute||Ab.emptyFunction,this),b=d.create(),h.each(a,function(a){b.addRoute(a[0],c).rules=a[1]}),this.oCross=b)},t.constructorEnd=function(a){Ab.isFunc(a.__constructor_end)&&a.__constructor_end.call(a)},t.prototype.sDefaultScreenName="",t.prototype.oScreens={},t.prototype.oBoot=null,t.prototype.oCurrentScreen=null,t.prototype.hideLoading=function(){b("#rl-loading").hide()},t.prototype.routeOff=function(){e.changed.active=!1},t.prototype.routeOn=function(){e.changed.active=!0},t.prototype.setBoot=function(a){return Ab.isNormal(a)&&(this.oBoot=a),this},t.prototype.screen=function(a){return""===a||Ab.isUnd(this.oScreens[a])?null:this.oScreens[a]},t.prototype.buildViewModel=function(a,d){if(a&&!a.__builded){var e=new a(d),f=e.viewModelPosition(),g=b("#rl-content #rl-"+f.toLowerCase()),h=null;a.__builded=!0,a.__vm=e,e.data=Mb.data(),e.viewModelName=a.__name,g&&1===g.length?(h=b("
").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=Ab.createCommand(e,function(){Fb.hideScreenPopup(a)})),Bb.runHook("view-model-pre-build",[a.__name,e,h]),c.applyBindings(e,h[0]),Ab.delegateRun(e,"onBuild",[h]),e&&"Popups"===f&&!e.bDisabeCloseOnEsc&&e.registerPopupEscapeKey(),Bb.runHook("view-model-post-build",[a.__name,e,h])):Ab.log("Cannot find view model position: "+f)}return a?a.__vm:null},t.prototype.applyExternal=function(a,b){a&&b&&c.applyBindings(a,b)},t.prototype.hideScreenPopup=function(a){a&&a.__vm&&a.__dom&&(a.__vm.modalVisibility(!1),Ab.delegateRun(a.__vm,"onHide"),Mb.popupVisibilityNames.remove(a.__name),Bb.runHook("view-model-on-hide",[a.__name,a.__vm]),h.delay(function(){a.__dom.hide()},300))},t.prototype.showScreenPopup=function(a,b){a&&(this.buildViewModel(a),a.__vm&&a.__dom&&(a.__dom.show(),a.__vm.modalVisibility(!0),Ab.delegateRun(a.__vm,"onShow",b||[]),Mb.popupVisibilityNames.push(a.__name),Bb.runHook("view-model-on-show",[a.__name,a.__vm,b||[]]),Ab.delegateRun(a.__vm,"onFocus",[],500)))},t.prototype.screenOnRoute=function(a,b){var c=this,d=null,e=null;""===Ab.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,Ab.isNonEmptyArray(d.viewModels())&&h.each(d.viewModels(),function(a){this.buildViewModel(a,d)},this),Ab.delegateRun(d,"onBuild")),h.defer(function(){c.oCurrentScreen&&(Ab.delegateRun(c.oCurrentScreen,"onHide"),Ab.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),Ab.delegateRun(a.__vm,"onHide"))})),c.oCurrentScreen=d,c.oCurrentScreen&&(Ab.delegateRun(c.oCurrentScreen,"onShow"),Bb.runHook("screen-on-show",[c.oCurrentScreen.screenName(),c.oCurrentScreen]),Ab.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),Ab.delegateRun(a.__vm,"onShow"),Ab.delegateRun(a.__vm,"onFocus",[],200),Bb.runHook("view-model-on-show",[a.__name,a.__vm]))},c)),e=d.__cross(),e&&e.parse(b)})))},t.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(),Bb.runHook("screen-pre-start",[a.screenName(),a]),Ab.delegateRun(a,"onStart"),Bb.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(){Ib.removeClass("rl-started-trigger").addClass("rl-started")},50)},t.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=Ab.isUnd(c)?!1:!!c,(Ab.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)},t.prototype.bootstart=function(){return this.oBoot&&this.oBoot.bootstart&&this.oBoot.bootstart(),this},Fb=new t,u.newInstanceFromJson=function(a){var b=new u;return b.initByJson(a)?b:null},u.prototype.name="",u.prototype.email="",u.prototype.privateType=null,u.prototype.clear=function(){this.email="",this.name="",this.privateType=null},u.prototype.validate=function(){return""!==this.name||""!==this.email},u.prototype.hash=function(a){return"#"+(a?"":this.name)+"#"+this.email+"#"},u.prototype.clearDuplicateName=function(){this.name===this.email&&(this.name="")},u.prototype.type=function(){return null===this.privateType&&(this.email&&"@facebook.com"===this.email.substr(-13)&&(this.privateType=yb.EmailType.Facebook),null===this.privateType&&(this.privateType=yb.EmailType.Default)),this.privateType},u.prototype.search=function(a){return-1<(this.name+" "+this.email).toLowerCase().indexOf(a.toLowerCase())},u.prototype.parse=function(a){this.clear(),a=Ab.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)},u.prototype.initByJson=function(a){var b=!1;return a&&"Object/Email"===a["@Object"]&&(this.name=Ab.trim(a.Name),this.email=Ab.trim(a.Email),b=""!==this.email,this.clearDuplicateName()),b},u.prototype.toLine=function(a,b,c){var d="";return""!==this.email&&(b=Ab.isUnd(b)?!1:!!b,c=Ab.isUnd(c)?!1:!!c,a&&""!==this.name?d=b?'")+'" target="_blank" tabindex="-1">'+Ab.encodeHtml(this.name)+"":c?Ab.encodeHtml(this.name):this.name:(d=this.email,""!==this.name?b?d=Ab.encodeHtml('"'+this.name+'" <')+'")+'" target="_blank" tabindex="-1">'+Ab.encodeHtml(d)+""+Ab.encodeHtml(">"):(d='"'+this.name+'" <'+d+">",c&&(d=Ab.encodeHtml(d))):b&&(d=''+Ab.encodeHtml(this.email)+""))),d},u.prototype.mailsoParse=function(a){if(a=Ab.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;m0&&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=Ab.trim(e).replace(/^[<]+/,"").replace(/[>]+$/,""),d=Ab.trim(d).replace(/^["']+/,"").replace(/["']+$/,""),f=Ab.trim(f).replace(/^[(]+/,"").replace(/[)]+$/,""),d=d.replace(/\\\\(.)/,"$1"),f=f.replace(/\\\\(.)/,"$1"),this.name=d,this.email=e,this.clearDuplicateName(),!0},u.prototype.inputoTagLine=function(){return 0+$/,""),b=!0),b},x.prototype.isImage=function(){return-1e;e++)d.push(a[e].toLine(b,c));return d.join(", ")},z.initEmailsFromJson=function(a){var b=0,c=0,d=null,e=[];if(Ab.isNonEmptyArray(a))for(b=0,c=a.length;c>b;b++)d=u.newInstanceFromJson(a[b]),d&&e.push(d);return e},z.replyHelper=function(a,b,c){if(a&&0d;d++)Ab.isUnd(b[a[d].email])&&(b[a[d].email]=!0,c.push(a[d])) },z.prototype.clear=function(){this.folderFullNameRaw="",this.uid="",this.hash="",this.requestHash="",this.subject(""),this.size(0),this.dateTimeStampInUTC(0),this.priority(yb.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.pgpSignedVerifyStatus(yb.SignedVerifyStatus.None),this.pgpSignedVerifyUser(""),this.priority(yb.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)},z.prototype.computeSenderEmail=function(){var a=Mb.data().sentFolder(),b=Mb.data().draftFolder();this.senderEmailsString(this.folderFullNameRaw===a||this.folderFullNameRaw===b?this.toEmailsString():this.fromEmailString())},z.prototype.initByJson=function(a){var b=!1;return a&&"Object/Message"===a["@Object"]&&(this.folderFullNameRaw=a.Folder,this.uid=a.Uid,this.hash=a.Hash,this.requestHash=a.RequestHash,this.size(Ab.pInt(a.Size)),this.from=z.initEmailsFromJson(a.From),this.to=z.initEmailsFromJson(a.To),this.cc=z.initEmailsFromJson(a.Cc),this.bcc=z.initEmailsFromJson(a.Bcc),this.replyTo=z.initEmailsFromJson(a.ReplyTo),this.subject(a.Subject),this.dateTimeStampInUTC(Ab.pInt(a.DateTimeStampInUTC)),this.hasAttachments(!!a.HasAttachments),this.attachmentsMainType(a.AttachmentsMainType),this.fromEmailString(z.emailsToLine(this.from,!0)),this.toEmailsString(z.emailsToLine(this.to,!0)),this.parentUid(Ab.pInt(a.ParentThread)),this.threads(Ab.isArray(a.Threads)?a.Threads:[]),this.threadsLen(Ab.pInt(a.ThreadsLen)),this.initFlagsByJson(a),this.computeSenderEmail(),b=!0),b},z.prototype.initUpdateByMessageJson=function(a){var b=!1,c=yb.MessagePriority.Normal;return a&&"Object/Message"===a["@Object"]&&(c=Ab.pInt(a.Priority),this.priority(-1b;b++)d=x.newInstanceFromJson(a["@Collection"][b]),d&&(""!==d.cidWithOutTags&&0+$/,""),b=h.find(c,function(b){return a===b.cidWithOutTags})),b||null},z.prototype.findAttachmentByContentLocation=function(a){var b=null,c=this.attachments();return Ab.isNonEmptyArray(c)&&(b=h.find(c,function(b){return a===b.contentLocation})),b||null},z.prototype.messageId=function(){return this.sMessageId},z.prototype.inReplyTo=function(){return this.sInReplyTo},z.prototype.references=function(){return this.sReferences},z.prototype.fromAsSingleEmail=function(){return Ab.isArray(this.from)&&this.from[0]?this.from[0].email:""},z.prototype.viewLink=function(){return Mb.link().messageViewLink(this.requestHash)},z.prototype.downloadLink=function(){return Mb.link().messageDownloadLink(this.requestHash)},z.prototype.replyEmails=function(a){var b=[],c=Ab.isUnd(a)?{}:a;return z.replyHelper(this.replyTo,c,b),0===b.length&&z.replyHelper(this.from,c,b),b},z.prototype.replyAllEmails=function(a){var b=[],c=[],d=Ab.isUnd(a)?{}:a;return z.replyHelper(this.replyTo,d,b),0===b.length&&z.replyHelper(this.from,d,b),z.replyHelper(this.to,d,b),z.replyHelper(this.cc,d,c),[b,c]},z.prototype.textBodyToString=function(){return this.body?this.body.html():""},z.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))})},z.prototype.printMessage=function(){this.viewPopupMessage(!0)},z.prototype.generateUid=function(){return this.folderFullNameRaw+"/"+this.uid},z.prototype.populateByMessageListItem=function(a){return this.folderFullNameRaw=a.folderFullNameRaw,this.uid=a.uid,this.hash=a.hash,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(yb.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},z.prototype.showExternalImages=function(a){this.body&&this.body.data("rl-has-images")&&(a=Ab.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=Ab.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]}),Jb.resize()),Ab.windowResize(500))},z.prototype.showInternalImages=function(a){if(this.body&&!this.body.data("rl-init-internal-images")){this.body.data("rl-init-internal-images",!0),a=Ab.isUnd(a)?!1:a;var c=this;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=Ab.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]),Ab.windowResize(500)}},z.prototype.storeDataToDom=function(){this.body&&(this.body.data("rl-is-rtl",!!this.isRtl()),this.body.data("rl-is-html",!!this.isHtml()),this.body.data("rl-has-images",!!this.hasImages()),this.body.data("rl-plain-raw",this.plainRaw),Mb.data().allowOpenPGP()&&(this.body.data("rl-plain-pgp-signed",!!this.isPgpSigned()),this.body.data("rl-plain-pgp-encrypted",!!this.isPgpEncrypted()),this.body.data("rl-pgp-verify-status",this.pgpSignedVerifyStatus()),this.body.data("rl-pgp-verify-user",this.pgpSignedVerifyUser())))},z.prototype.storePgpVerifyDataToDom=function(){this.body&&Mb.data().allowOpenPGP()&&(this.body.data("rl-pgp-verify-status",this.pgpSignedVerifyStatus()),this.body.data("rl-pgp-verify-user",this.pgpSignedVerifyUser()))},z.prototype.fetchDataToDom=function(){this.body&&(this.isRtl(!!this.body.data("rl-is-rtl")),this.isHtml(!!this.body.data("rl-is-html")),this.hasImages(!!this.body.data("rl-has-images")),this.plainRaw=Ab.pString(this.body.data("rl-plain-raw")),Mb.data().allowOpenPGP()?(this.isPgpSigned(!!this.body.data("rl-plain-pgp-signed")),this.isPgpEncrypted(!!this.body.data("rl-plain-pgp-encrypted")),this.pgpSignedVerifyStatus(this.body.data("rl-pgp-verify-status")),this.pgpSignedVerifyUser(this.body.data("rl-pgp-verify-user"))):(this.isPgpSigned(!1),this.isPgpEncrypted(!1),this.pgpSignedVerifyStatus(yb.SignedVerifyStatus.None),this.pgpSignedVerifyUser("")))},z.prototype.verifyPgpSignedClearMessage=function(){if(this.isPgpSigned()){var c=[],d=null,e=this.from&&this.from[0]&&this.from[0].email?this.from[0].email:"",f=Mb.data().findPublicKeysByEmail(e),g=null,i=null,j="";this.pgpSignedVerifyStatus(yb.SignedVerifyStatus.Error),this.pgpSignedVerifyUser("");try{d=a.openpgp.cleartext.readArmored(this.plainRaw),d&&d.getText&&(this.pgpSignedVerifyStatus(f.length?yb.SignedVerifyStatus.Unverified:yb.SignedVerifyStatus.UnknownPublicKeys),c=d.verify(f),c&&0').text(j)).html(),Nb.empty(),this.replacePlaneTextBody(j)))))}catch(k){}this.storePgpVerifyDataToDom()}},z.prototype.decryptPgpEncryptedMessage=function(c){if(this.isPgpEncrypted()){var d=[],e=null,f=null,g=this.from&&this.from[0]&&this.from[0].email?this.from[0].email:"",i=Mb.data().findPublicKeysByEmail(g),j=Mb.data().findSelfPrivateKey(c),k=null,l=null,m="";this.pgpSignedVerifyStatus(yb.SignedVerifyStatus.Error),this.pgpSignedVerifyUser(""),j||this.pgpSignedVerifyStatus(yb.SignedVerifyStatus.UnknownPrivateKey);try{e=a.openpgp.message.readArmored(this.plainRaw),e&&j&&e.decrypt&&(this.pgpSignedVerifyStatus(yb.SignedVerifyStatus.Unverified),f=e.decrypt(j),f&&(d=f.verify(i),d&&0').text(m)).html(),Nb.empty(),this.replacePlaneTextBody(m)))}catch(n){}this.storePgpVerifyDataToDom()}},z.prototype.replacePlaneTextBody=function(a){this.body&&this.body.html(a).addClass("b-text-part plain")},A.newInstanceFromJson=function(a){var b=new A;return b.initByJson(a)?b.initComputed():null},A.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 yb.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 yb.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){Ab.isPosNumeric(a,!0)?this.privateMessageCountAll(a):this.privateMessageCountAll.valueHasMutated()},owner:this}),this.messageCountUnread=c.computed({read:this.privateMessageCountUnread,write:function(a){Ab.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(yb.FolderType.Inbox===c&&Mb.data().foldersInboxUnreadCount(b),a>0){if(yb.FolderType.Draft===c)return""+a;if(b>0&&yb.FolderType.Trash!==c&&yb.FolderType.Archive!==c&&yb.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(){Ab.timeOutAction("folder-list-folder-visibility-change",function(){Jb.trigger("folder-list-folder-visibility-change")},100)}),this.localName=c.computed(function(){Db.langChangeTrigger();var a=this.type(),b=this.name();if(this.isSystemFolder())switch(a){case yb.FolderType.Inbox:b=Ab.i18n("FOLDER_LIST/INBOX_NAME");break;case yb.FolderType.SentItems:b=Ab.i18n("FOLDER_LIST/SENT_NAME");break;case yb.FolderType.Draft:b=Ab.i18n("FOLDER_LIST/DRAFTS_NAME");break;case yb.FolderType.Spam:b=Ab.i18n("FOLDER_LIST/SPAM_NAME");break;case yb.FolderType.Trash:b=Ab.i18n("FOLDER_LIST/TRASH_NAME");break;case yb.FolderType.Archive:b=Ab.i18n("FOLDER_LIST/ARCHIVE_NAME")}return b},this),this.manageFolderSystemName=c.computed(function(){Db.langChangeTrigger();var a="",b=this.type(),c=this.name();if(this.isSystemFolder())switch(b){case yb.FolderType.Inbox:a="("+Ab.i18n("FOLDER_LIST/INBOX_NAME")+")";break;case yb.FolderType.SentItems:a="("+Ab.i18n("FOLDER_LIST/SENT_NAME")+")";break;case yb.FolderType.Draft:a="("+Ab.i18n("FOLDER_LIST/DRAFTS_NAME")+")";break;case yb.FolderType.Spam:a="("+Ab.i18n("FOLDER_LIST/SPAM_NAME")+")";break;case yb.FolderType.Trash:a="("+Ab.i18n("FOLDER_LIST/TRASH_NAME")+")";break;case yb.FolderType.Archive:a="("+Ab.i18n("FOLDER_LIST/ARCHIVE_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"},C.prototype.formattedNameForCompose=function(){var a=this.name();return""===a?this.email():a+" ("+this.email()+")"},C.prototype.formattedNameForEmail=function(){var a=this.name();return""===a?this.email():'"'+Ab.quoteName(a)+'" <'+this.email()+">"},D.prototype.index=0,D.prototype.id="",D.prototype.guid="",D.prototype.user="",D.prototype.email="",D.prototype.armor="",D.prototype.isPrivate=!1,Ab.extendAsViewModel("PopupsFolderClearViewModel",E),E.prototype.clearPopup=function(){this.clearingProcess(!1),this.selectedFolder(null)},E.prototype.onShow=function(a){this.clearPopup(),a&&this.selectedFolder(a)},Ab.extendAsViewModel("PopupsFolderCreateViewModel",F),F.prototype.sNoParentText="",F.prototype.simpleFolderNameValidation=function(a){return/^[^\\\/]+$/g.test(Ab.trim(a))},F.prototype.clearPopup=function(){this.folderName(""),this.selectedParentValue(""),this.folderName.focused(!1)},F.prototype.onShow=function(){this.clearPopup()},F.prototype.onFocus=function(){this.folderName.focused(!0)},Ab.extendAsViewModel("PopupsFolderSystemViewModel",G),G.prototype.sChooseOnText="",G.prototype.sUnuseText="",G.prototype.onShow=function(a){var b="";switch(a=Ab.isUnd(a)?yb.SetSystemFoldersNotification.None:a){case yb.SetSystemFoldersNotification.Sent:b=Ab.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SENT");break;case yb.SetSystemFoldersNotification.Draft:b=Ab.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_DRAFTS");break;case yb.SetSystemFoldersNotification.Spam:b=Ab.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SPAM");break;case yb.SetSystemFoldersNotification.Trash:b=Ab.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH");break;case yb.SetSystemFoldersNotification.Archive:b=Ab.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_ARCHIVE")}this.notification(b)},Ab.extendAsViewModel("PopupsComposeViewModel",H),H.prototype.openOpenPgpPopup=function(){if(this.allowOpenPGP()&&this.oEditor&&!this.oEditor.isHtml()){var a=this;Fb.showScreenPopup(O,[function(b){a.editor(function(a){a.setPlain(b)})},this.oEditor.getData(),this.currentIdentityResultEmail(),this.to(),this.cc(),this.bcc()])}},H.prototype.reloadDraftFolder=function(){var a=Mb.data().draftFolder();""!==a&&(Mb.cache().setFolderHash(a,""),Mb.data().currentFolderFullNameRaw()===a?Mb.reloadMessageList(!0):Mb.folderInformation(a))},H.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[Mb.data().accountEmail()]=Mb.data().accountEmail(),b)switch(a){case yb.ComposeType.Empty:d=Mb.data().accountEmail();break;case yb.ComposeType.Reply:case yb.ComposeType.ReplyAll:case yb.ComposeType.Forward:case yb.ComposeType.ForwardAsAttachment:h.find(h.union(b.to,b.cc,b.bcc),e);break;case yb.ComposeType.Draft:h.find(h.union(b.from,b.replyTo),e)}else d=Mb.data().accountEmail();return d},H.prototype.selectIdentity=function(a){a&&this.currentIdentityID(a.optValue)},H.prototype.formattedFrom=function(a){var b=Mb.data().displayName(),c=Mb.data().accountEmail();return""===b?c:(Ab.isUnd(a)?1:!a)?b+" ("+c+")":'"'+Ab.quoteName(b)+'" <'+c+">"},H.prototype.sendMessageResponse=function(b,c){var d=!1,e="";this.sending(!1),yb.StorageResultType.Success===b&&c&&c.Result&&(d=!0,this.modalVisibility()&&Ab.delegateRun(this,"closeCommand")),this.modalVisibility()&&!d&&(c&&yb.Notification.CantSaveMessage===c.ErrorCode?(this.sendSuccessButSaveError(!0),a.alert(Ab.trim(Ab.i18n("COMPOSE/SAVED_ERROR_ON_SEND")))):(e=Ab.getNotification(c&&c.ErrorCode?c.ErrorCode:yb.Notification.CantSendMessage,c&&c.ErrorMessage?c.ErrorMessage:""),this.sendError(!0),a.alert(e||Ab.getNotification(yb.Notification.CantSendMessage)))),this.reloadDraftFolder()},H.prototype.saveMessageResponse=function(b,c){var d=!1,e=null;this.saving(!1),yb.StorageResultType.Success===b&&c&&c.Result&&c.Result.NewFolder&&c.Result.NewUid&&(this.bFromDraft&&(e=Mb.data().message(),e&&this.draftFolder()===e.folderFullNameRaw&&this.draftUid()===e.uid&&Mb.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&&Ab.isNormal(c)&&(v=Ab.isArray(c)&&1===c.length?c[0]:Ab.isArray(c)?null:c),null!==q&&(p[q]=!0,this.currentIdentityID(this.findIdentityIdByMessage(w,v))),this.reset(),Ab.isNonEmptyArray(d)&&this.to(x(d)),""!==w&&v){switch(j=v.fullFormatDateValue(),k=v.subject(),u=v.aDraftInfo,l=b(v.body).clone(),Ab.removeBlockquoteSwitcher(l),m=l.html(),w){case yb.ComposeType.Empty:break;case yb.ComposeType.Reply:this.to(x(v.replyEmails(p))),this.subject(Ab.replySubjectAdd("Re",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["reply",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Ab.trim(this.sInReplyTo+" "+v.sReferences);break;case yb.ComposeType.ReplyAll:o=v.replyAllEmails(p),this.to(x(o[0])),this.cc(x(o[1])),this.subject(Ab.replySubjectAdd("Re",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["reply",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Ab.trim(this.sInReplyTo+" "+v.references());break;case yb.ComposeType.Forward:this.subject(Ab.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["forward",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Ab.trim(this.sInReplyTo+" "+v.sReferences);break;case yb.ComposeType.ForwardAsAttachment:this.subject(Ab.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["forward",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Ab.trim(this.sInReplyTo+" "+v.sReferences);break;case yb.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=Ab.isNonEmptyArray(u)&&3===u.length?u:null,this.sInReplyTo=v.sInReplyTo,this.sReferences=v.sReferences;break;case yb.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=Ab.isNonEmptyArray(u)&&3===u.length?u:null,this.sInReplyTo=v.sInReplyTo,this.sReferences=v.sReferences}switch(w){case yb.ComposeType.Reply:case yb.ComposeType.ReplyAll:f=v.fromToLine(!1,!0),n=Ab.i18n("COMPOSE/REPLY_MESSAGE_TITLE",{DATETIME:j,EMAIL:f}),m="

"+n+":

"+m+"

";break;case yb.ComposeType.Forward:f=v.fromToLine(!1,!0),g=v.toToLine(!1,!0),i=v.ccToLine(!1,!0),m="


"+Ab.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TITLE")+"
"+Ab.i18n("COMPOSE/FORWARD_MESSAGE_TOP_FROM")+": "+f+"
"+Ab.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TO")+": "+g+(0"+Ab.i18n("COMPOSE/FORWARD_MESSAGE_TOP_CC")+": "+i:"")+"
"+Ab.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SENT")+": "+Ab.encodeHtml(j)+"
"+Ab.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT")+": "+Ab.encodeHtml(k)+"

"+m;break;case yb.ComposeType.ForwardAsAttachment:m=""}s&&""!==r&&yb.ComposeType.EditAsNew!==w&&yb.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 yb.ComposeType.Empty===w?(m=this.convertSignature(r),this.editor(function(a){a.setHtml(m,!1),yb.EditorDefaultType.Html!==Mb.data().editorDefaultType()&&a.modeToggle(!1)})):Ab.isNonEmptyArray(c)&&h.each(c,function(a){e.addMessageAsAttachment(a)});t=this.getAttachmentsDownloadsForUpload(),Ab.isNonEmptyArray(t)&&Mb.remote().messageUploadAttachments(function(a,b){if(yb.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()},H.prototype.onFocus=function(){""===this.to()?this.to.focusTrigger(!this.to.focusTrigger()):this.oEditor&&this.oEditor.focus(),this.triggerForResize()},H.prototype.editorResize=function(){this.oEditor&&this.oEditor.resize()},H.prototype.tryToClosePopup=function(){var a=this;Fb.showScreenPopup(S,[Ab.i18n("POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW"),function(){a.modalVisibility()&&Ab.delegateRun(a,"closeCommand")}])},H.prototype.onBuild=function(){this.initUploader();var a=this,c=null;Jb.on("keydown",function(b){var c=!0;return b&&a.modalVisibility()&&Mb.data().useKeyboardShortcuts()&&(!b.ctrlKey||b.shiftKey||b.altKey||yb.EventKeyCode.S!==b.keyCode?!b.ctrlKey||b.shiftKey||b.altKey||yb.EventKeyCode.Enter!==b.keyCode?yb.EventKeyCode.Esc===b.keyCode&&(a.tryToClosePopup(),c=!1):(a.sendCommand(),c=!1):(a.saveCommand(),c=!1)),c}),Jb.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",Mb.settingsGet("DropboxApiKey")),document.body.appendChild(c))},H.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},H.prototype.initUploader=function(){if(this.composeUploaderButton()){var a={},b=Ab.pInt(Mb.settingsGet("AttachmentLimit")),c=new g({action:Mb.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;Ab.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=Ab.isUnd(d.FileName)?"":d.FileName.toString(),g=Ab.isNormal(d.Size)?Ab.pInt(d.Size):null,h=new y(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(Ab.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):!0},this)).on("onStart",h.bind(function(b){var c=null;Ab.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=Ab.getUploadErrorDescByCode(f):g||(e=Ab.i18n("UPLOAD/ERROR_UNKNOWN")),h&&(""!==e&&00&&d>0&&f>d?(e.uploading(!1),e.error(Ab.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):(Mb.remote().composeUploadExternals(function(a,b){var c=!1; e.uploading(!1),yb.StorageResultType.Success===a&&b&&b.Result&&b.Result[e.id]&&(c=!0,e.tempName(b.Result[e.id])),c||e.error(Ab.getUploadErrorDescByCode(yb.UploadErrorCode.FileNoUploaded))},[a.link]),!0)},H.prototype.prepearMessageAttachments=function(a,b){if(a){var c=this,d=Ab.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(yb.ComposeType.ForwardAsAttachment===b)this.addMessageAsAttachment(a);else for(;f>e;e++){switch(h=d[e],i=!1,b){case yb.ComposeType.Reply:case yb.ComposeType.ReplyAll:i=h.isLinked;break;case yb.ComposeType.Forward:case yb.ComposeType.Draft:case yb.ComposeType.EditAsNew:i=!0}i=!0,i&&(g=new y(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))}}},H.prototype.removeLinkedAttachments=function(){this.attachments.remove(function(a){return a&&a.isLinked})},H.prototype.setMessageAttachmentFailedDowbloadText=function(){h.each(this.attachments(),function(a){a&&a.fromMessage&&a.waiting(!1).uploading(!1).error(Ab.getUploadErrorDescByCode(yb.UploadErrorCode.FileNoUploaded))},this)},H.prototype.isEmptyForm=function(a){a=Ab.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())},H.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.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)},H.prototype.getAttachmentsDownloadsForUpload=function(){return h.map(h.filter(this.attachments(),function(a){return a&&""===a.tempName()}),function(a){return a.id})},H.prototype.triggerForResize=function(){this.resizer(!this.resizer()),this.editorResizeThrottle()},Ab.extendAsViewModel("PopupsContactsViewModel",I),I.prototype.setShareToNone=function(){this.viewScopeType(yb.ContactScopeType.Default)},I.prototype.setShareToAll=function(){this.viewScopeType(yb.ContactScopeType.ShareAll)},I.prototype.addNewProperty=function(a){var b=new w(a,"");b.focused(!0),this.viewProperties.push(b)},I.prototype.addNewEmail=function(){this.addNewProperty(yb.ContactPropertyType.EmailPersonal)},I.prototype.addNewPhone=function(){this.addNewProperty(yb.ContactPropertyType.MobilePersonal)},I.prototype.initUploader=function(){if(this.importUploaderButton()){var b=new g({action:Mb.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(Ab.i18n("CONTACTS/ERROR_IMPORT_FILE"))},this))}},I.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))},I.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,xb.Defaults.ContactsPerPage,this.search())},I.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=Mb.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(Ab.pInt(a.value)),d.reloadContactList())}),this.initUploader()},I.prototype.onShow=function(){Fb.routeOff(),this.reloadContactList(!0)},I.prototype.onHide=function(){Fb.routeOn(),this.currentContact(null),this.emptySelection(!0),this.search(""),h.each(this.contacts(),function(a){a.checked(!1)})},Ab.extendAsViewModel("PopupsAdvancedSearchViewModel",J),J.prototype.buildSearchStringValue=function(a){return-11?" ("+(100>a?a:"99+")+")":""},Y.prototype.cancelSearch=function(){this.mainMessageListSearch(""),this.inputMessageListSearchFocus(!1)},Y.prototype.moveSelectedMessagesToFolder=function(a){return this.canBeMoved()&&Mb.moveMessagesToFolder(Mb.data().currentFolderFullNameRaw(),Mb.data().messageListCheckedOrSelectedUidsWithSubMails(),a),!1},Y.prototype.dragAndDronHelper=function(a,b){a&&a.checked(!0);var c=Ab.draggeblePlace();return c.data("rl-folder",Mb.data().currentFolderFullNameRaw()),c.data("rl-uids",Mb.data().messageListCheckedOrSelectedUidsWithSubMails()),c.data("rl-copy",b?"1":"0"),c.find(".text").text((b?"+":"")+""+Mb.data().messageListCheckedOrSelectedUidsWithSubMails().length),c},Y.prototype.onMessageResponse=function(a,b,c){var d=Mb.data();d.hideMessageBodies(),d.messageLoading(!1),yb.StorageResultType.Success===a&&b&&b.Result?d.setMessage(b,c):yb.StorageResultType.Unload===a?(d.message(null),d.messageError("")):yb.StorageResultType.Abort!==a&&(d.message(null),d.messageError(Ab.getNotification(b&&b.ErrorCode?b.ErrorCode:yb.Notification.UnknownError)))},Y.prototype.populateMessageBody=function(a){a&&(Mb.remote().message(this.onMessageResponse,a.folderFullNameRaw,a.uid)?Mb.data().messageLoading(!0):Ab.log("Error: Unknown message request: "+a.folderFullNameRaw+" ~ "+a.uid+" [e-101]"))},Y.prototype.setAction=function(a,b,c){var d=[],e=null,f=Mb.cache(),g=0;if(Ab.isUnd(c)&&(c=Mb.data().messageListChecked()),d=h.map(c,function(a){return a.uid}),""!==a&&00&&yb.EventKeyCode.Esc===c&&d.viewModelVisibility()&&e.useKeyboardShortcuts()&&!Ab.inFocus()&&e.message()&&(d.fullScreenMode(!1),yb.Layout.NoPreview===e.layout()&&Mb.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&&Mb.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&&Mb.download(a.linkDownload())}),this.oMessageScrollerDom=a.find(".messageItem .content"),this.oMessageScrollerDom=this.oMessageScrollerDom&&this.oMessageScrollerDom[0]?this.oMessageScrollerDom:null},Z.prototype.isDraftFolder=function(){return Mb.data().message()&&Mb.data().draftFolder()===Mb.data().message().folderFullNameRaw},Z.prototype.isSentFolder=function(){return Mb.data().message()&&Mb.data().sentFolder()===Mb.data().message().folderFullNameRaw},Z.prototype.isSpamFolder=function(){return Mb.data().message()&&Mb.data().spamFolder()===Mb.data().message().folderFullNameRaw},Z.prototype.isSpamDisabled=function(){return Mb.data().message()&&Mb.data().spamFolder()===xb.Values.UnuseOptionValue},Z.prototype.isArchiveFolder=function(){return Mb.data().message()&&Mb.data().archiveFolder()===Mb.data().message().folderFullNameRaw},Z.prototype.isArchiveDisabled=function(){return Mb.data().message()&&Mb.data().archiveFolder()===xb.Values.UnuseOptionValue},Z.prototype.isDraftOrSentFolder=function(){return this.isDraftFolder()||this.isSentFolder()},Z.prototype.composeClick=function(){Fb.showScreenPopup(H)},Z.prototype.editMessage=function(){Mb.data().message()&&Fb.showScreenPopup(H,[yb.ComposeType.Draft,Mb.data().message()])},Z.prototype.scrollMessageToTop=function(){this.oMessageScrollerDom&&this.oMessageScrollerDom.scrollTop(0)},Z.prototype.showImages=function(a){a&&a.showExternalImages&&a.showExternalImages(!0)},Z.prototype.verifyPgpSignedClearMessage=function(a){a&&a.verifyPgpSignedClearMessage()},Z.prototype.decryptPgpEncryptedMessage=function(a){a&&a.decryptPgpEncryptedMessage(this.viewPgpPassword())},Z.prototype.readReceipt=function(a){a&&""!==a.readReceipt()&&(Mb.remote().sendReadReceiptMessage(Ab.emptyFunction,a.folderFullNameRaw,a.uid,a.readReceipt(),Ab.i18n("READ_RECEIPT/SUBJECT",{SUBJECT:a.subject()}),Ab.i18n("READ_RECEIPT/BODY",{"READ-RECEIPT":a.readReceipt()})),a.isReadReceipt(!0),Mb.cache().storeMessageFlagsToCache(a),Mb.reloadFlagsCurrentMessageListAndMessageFromCache())},Ab.extendAsViewModel("SettingsMenuViewModel",$),$.prototype.link=function(a){return Mb.link().settings(a)},$.prototype.backToMailBoxClick=function(){Fb.setHash(Mb.link().inbox())},Ab.extendAsViewModel("SettingsPaneViewModel",_),_.prototype.onShow=function(){Mb.data().message(null)},_.prototype.backToMailBoxClick=function(){Fb.setHash(Mb.link().inbox())},Ab.addSettingsViewModel(ab,"SettingsGeneral","SETTINGS_LABELS/LABEL_GENERAL_NAME","general",!0),ab.prototype.toggleLayout=function(){this.layout(yb.Layout.NoPreview===this.layout()?yb.Layout.SidePreview:yb.Layout.NoPreview)},ab.prototype.onBuild=function(){var a=this;h.delay(function(){var c=Mb.data(),d=Ab.settingsSaveHelperSimpleFunction(a.mppTrigger,a);c.language.subscribe(function(c){a.languageTrigger(yb.SaveSettingsStep.Animate),b.ajax({url:Mb.link().langLink(c),dataType:"script",cache:!0}).done(function(){Ab.i18nToDoc(),a.languageTrigger(yb.SaveSettingsStep.TrueResult)}).fail(function(){a.languageTrigger(yb.SaveSettingsStep.FalseResult)}).always(function(){h.delay(function(){a.languageTrigger(yb.SaveSettingsStep.Idle)},1e3)}),Mb.remote().saveSettings(Ab.emptyFunction,{Language:c})}),c.editorDefaultType.subscribe(function(a){Mb.remote().saveSettings(Ab.emptyFunction,{EditorDefaultType:a})}),c.messagesPerPage.subscribe(function(a){Mb.remote().saveSettings(d,{MPP:a})}),c.showImages.subscribe(function(a){Mb.remote().saveSettings(Ab.emptyFunction,{ShowImages:a?"1":"0"})}),c.interfaceAnimation.subscribe(function(a){Mb.remote().saveSettings(Ab.emptyFunction,{InterfaceAnimation:a})}),c.useDesktopNotifications.subscribe(function(a){Ab.timeOutAction("SaveDesktopNotifications",function(){Mb.remote().saveSettings(Ab.emptyFunction,{DesktopNotifications:a?"1":"0"})},3e3)}),c.replySameFolder.subscribe(function(a){Ab.timeOutAction("SaveReplySameFolder",function(){Mb.remote().saveSettings(Ab.emptyFunction,{ReplySameFolder:a?"1":"0"})},3e3)}),c.useThreads.subscribe(function(a){c.messageList([]),Mb.remote().saveSettings(Ab.emptyFunction,{UseThreads:a?"1":"0"})}),c.layout.subscribe(function(a){c.messageList([]),Mb.remote().saveSettings(Ab.emptyFunction,{Layout:a})}),c.useCheckboxesInList.subscribe(function(a){Mb.remote().saveSettings(Ab.emptyFunction,{UseCheckboxesInList:a?"1":"0"})})},50)},ab.prototype.onShow=function(){Mb.data().desktopNotifications.valueHasMutated()},ab.prototype.selectLanguage=function(){Fb.showScreenPopup(Q)},Ab.addSettingsViewModel(bb,"SettingsContacts","SETTINGS_LABELS/LABEL_CONTACTS_NAME","contacts"),bb.prototype.toggleShowPassword=function(){this.showPassword(!this.showPassword())},bb.prototype.onBuild=function(){Mb.data().contactsAutosave.subscribe(function(a){Mb.remote().saveSettings(Ab.emptyFunction,{ContactsAutosave:a?"1":"0"})})},bb.prototype.onShow=function(){this.showPassword(!1)},Ab.addSettingsViewModel(cb,"SettingsAccounts","SETTINGS_LABELS/LABEL_ACCOUNTS_NAME","accounts"),cb.prototype.addNewAccount=function(){Fb.showScreenPopup(K)},cb.prototype.deleteAccount=function(b){if(b&&b.deleteAccess()){this.accountForDeletion(null);var c=function(a){return b===a};b&&(this.accounts.remove(c),Mb.remote().accountDelete(function(b,c){yb.StorageResultType.Success===b&&c&&c.Result&&c.Reload?(Fb.routeOff(),Fb.setHash(Mb.link().root(),!0),Fb.routeOff(),h.defer(function(){a.location.reload()})):Mb.accountsAndIdentities()},b.email))}},Ab.addSettingsViewModel(db,"SettingsIdentity","SETTINGS_LABELS/LABEL_IDENTITY_NAME","identity"),db.prototype.onFocus=function(){if(!this.editor&&this.signatureDom()){var a=this,b=Mb.data().signature();this.editor=new k(a.signatureDom(),function(){Mb.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) -})}},db.prototype.onBuild=function(){var a=this;h.delay(function(){var b=Mb.data(),c=Ab.settingsSaveHelperSimpleFunction(a.displayNameTrigger,a),d=Ab.settingsSaveHelperSimpleFunction(a.replyTrigger,a),e=Ab.settingsSaveHelperSimpleFunction(a.signatureTrigger,a);b.displayName.subscribe(function(a){Mb.remote().saveSettings(c,{DisplayName:a})}),b.replyTo.subscribe(function(a){Mb.remote().saveSettings(d,{ReplyTo:a})}),b.signature.subscribe(function(a){Mb.remote().saveSettings(e,{Signature:a})}),b.signatureToAll.subscribe(function(a){Mb.remote().saveSettings(null,{SignatureToAll:a?"1":"0"})})},50)},Ab.addSettingsViewModel(eb,"SettingsIdentities","SETTINGS_LABELS/LABEL_IDENTITIES_NAME","identities"),eb.prototype.addNewIdentity=function(){Fb.showScreenPopup(P)},eb.prototype.editIdentity=function(a){Fb.showScreenPopup(P,[a])},eb.prototype.deleteIdentity=function(a){if(a&&a.deleteAccess()){this.identityForDeletion(null);var b=function(b){return a===b};a&&(this.identities.remove(b),Mb.remote().identityDelete(function(){Mb.accountsAndIdentities()},a.id))}},eb.prototype.onFocus=function(){if(!this.editor&&this.signatureDom()){var a=this,b=Mb.data().signature();this.editor=new k(a.signatureDom(),function(){Mb.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)})}},eb.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=Mb.data(),c=Ab.settingsSaveHelperSimpleFunction(b.displayNameTrigger,b),d=Ab.settingsSaveHelperSimpleFunction(b.replyTrigger,b),e=Ab.settingsSaveHelperSimpleFunction(b.signatureTrigger,b);a.displayName.subscribe(function(a){Mb.remote().saveSettings(c,{DisplayName:a})}),a.replyTo.subscribe(function(a){Mb.remote().saveSettings(d,{ReplyTo:a})}),a.signature.subscribe(function(a){Mb.remote().saveSettings(e,{Signature:a})}),a.signatureToAll.subscribe(function(a){Mb.remote().saveSettings(null,{SignatureToAll:a?"1":"0"})})},50)},Ab.addSettingsViewModel(fb,"SettingsSecurity","SETTINGS_LABELS/LABEL_SECURITY_NAME","security"),fb.prototype.createTwoFactor=function(){this.processing(!0),Mb.remote().createTwoFactor(this.onResult)},fb.prototype.enableTwoFactor=function(){this.processing(!0),Mb.remote().enableTwoFactor(this.onResult,this.viewEnable())},fb.prototype.testTwoFactor=function(){Fb.showScreenPopup(R)},fb.prototype.clearTwoFactor=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl(""),this.clearing(!0),Mb.remote().clearTwoFactor(this.onResult)},fb.prototype.onShow=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl("")},fb.prototype.onResult=function(a,b){if(this.processing(!1),this.clearing(!1),yb.StorageResultType.Success===a&&b&&b.Result?(this.viewUser(Ab.pString(b.Result.User)),this.viewEnable(!!b.Result.Enable),this.twoFactorStatus(!!b.Result.IsSet),this.viewSecret(Ab.pString(b.Result.Secret)),this.viewBackupCodes(Ab.pString(b.Result.BackupCodes).replace(/[\s]+/g," ")),this.viewUrl(Ab.pString(b.Result.Url))):(this.viewUser(""),this.viewEnable(!1),this.twoFactorStatus(!1),this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl("")),this.bFirst){this.bFirst=!1;var c=this;this.viewEnable.subscribe(function(a){this.viewEnable.subs&&Mb.remote().enableTwoFactor(function(a,b){yb.StorageResultType.Success===a&&b&&b.Result||(c.viewEnable.subs=!1,c.viewEnable(!1),c.viewEnable.subs=!0)},a)},this)}},fb.prototype.onBuild=function(){this.processing(!0),Mb.remote().getTwoFactor(this.onResult)},Ab.addSettingsViewModel(gb,"SettingsSocial","SETTINGS_LABELS/LABEL_SOCIAL_NAME","social"),Ab.addSettingsViewModel(hb,"SettingsChangePassword","SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME","change-password"),hb.prototype.onHide=function(){this.changeProcess(!1),this.currentPassword(""),this.newPassword("")},hb.prototype.onChangePasswordResponse=function(a,b){this.changeProcess(!1),yb.StorageResultType.Success===a&&b&&b.Result?(this.currentPassword(""),this.newPassword(""),this.passwordUpdateSuccess(!0)):this.passwordUpdateError(!0)},Ab.addSettingsViewModel(ib,"SettingsFolders","SETTINGS_LABELS/LABEL_FOLDERS_NAME","folders"),ib.prototype.folderEditOnEnter=function(a){var b=a?Ab.trim(a.nameForEdit()):"";""!==b&&a.name()!==b&&(Mb.local().set(yb.ClientSideKeyName.FoldersLashHash,""),Mb.data().foldersRenaming(!0),Mb.remote().folderRename(function(a,b){Mb.data().foldersRenaming(!1),yb.StorageResultType.Success===a&&b&&b.Result||Mb.data().foldersListError(b&&b.ErrorCode?Ab.getNotification(b.ErrorCode):Ab.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER")),Mb.folders()},a.fullNameRaw,b),Mb.cache().removeFolderFromCacheList(a.fullNameRaw),a.name(b)),a.edited(!1)},ib.prototype.folderEditOnEsc=function(a){a&&a.edited(!1)},ib.prototype.onShow=function(){Mb.data().foldersListError("")},ib.prototype.createFolder=function(){Fb.showScreenPopup(F)},ib.prototype.systemFolder=function(){Fb.showScreenPopup(G)},ib.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&&(Mb.local().set(yb.ClientSideKeyName.FoldersLashHash,""),Mb.data().folderList.remove(b),Mb.data().foldersDeleting(!0),Mb.remote().folderDelete(function(a,b){Mb.data().foldersDeleting(!1),yb.StorageResultType.Success===a&&b&&b.Result||Mb.data().foldersListError(b&&b.ErrorCode?Ab.getNotification(b.ErrorCode):Ab.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER")),Mb.folders()},a.fullNameRaw),Mb.cache().removeFolderFromCacheList(a.fullNameRaw))}else 01048576?(a.alert(Ab.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(Ab.getUploadErrorDescByCode(d&&d.ErrorCode?d.ErrorCode:yb.UploadErrorCode.Unknown)),this.customThemeUploaderProgress(!1)},this)),!!b}return!1},Ab.addSettingsViewModel(kb,"SettingsOpenPGP","SETTINGS_LABELS/LABEL_OPEN_PGP_NAME","openpgp"),kb.prototype.addOpenPgpKey=function(){Fb.showScreenPopup(L)},kb.prototype.generateOpenPgpKey=function(){Fb.showScreenPopup(N)},kb.prototype.viewOpenPgpKey=function(a){a&&Fb.showScreenPopup(M,[a])},kb.prototype.deleteOpenPgpKey=function(a){if(a&&a.deleteAccess()){this.openPgpKeyForDeletion(null);var b=-1,c=Mb.data().openpgpKeyring,d=function(b){return a===b};a&&c&&(this.openpgpkeys.remove(d),h.each(c.keys,function(c,d){-1===b&&c&&c.primaryKey&&a.guid===c.primaryKey.getFingerprint()&&a.isPrivate===c.isPrivate()&&(b=d)}),b>=0&&c.removeKey(b),c.store(),Mb.reloadOpenPgpKeys())}},lb.prototype.populateDataOnStart=function(){var a=Ab.pInt(Mb.settingsGet("Layout")),b=Mb.settingsGet("Languages"),c=Mb.settingsGet("Themes");Ab.isArray(b)&&this.languages(b),Ab.isArray(c)&&this.themes(c),this.mainLanguage(Mb.settingsGet("Language")),this.mainTheme(Mb.settingsGet("Theme")),this.allowCustomTheme(!!Mb.settingsGet("AllowCustomTheme")),this.allowAdditionalAccounts(!!Mb.settingsGet("AllowAdditionalAccounts")),this.allowIdentities(!!Mb.settingsGet("AllowIdentities")),this.determineUserLanguage(!!Mb.settingsGet("DetermineUserLanguage")),this.allowThemes(!!Mb.settingsGet("AllowThemes")),this.allowCustomLogin(!!Mb.settingsGet("AllowCustomLogin")),this.allowLanguagesOnLogin(!!Mb.settingsGet("AllowLanguagesOnLogin")),this.allowLanguagesOnSettings(!!Mb.settingsGet("AllowLanguagesOnSettings")),this.editorDefaultType(Mb.settingsGet("EditorDefaultType")),this.showImages(!!Mb.settingsGet("ShowImages")),this.contactsAutosave(!!Mb.settingsGet("ContactsAutosave")),this.interfaceAnimation(Mb.settingsGet("InterfaceAnimation")),this.mainMessagesPerPage(Mb.settingsGet("MPP")),this.desktopNotifications(!!Mb.settingsGet("DesktopNotifications")),this.useThreads(!!Mb.settingsGet("UseThreads")),this.replySameFolder(!!Mb.settingsGet("ReplySameFolder")),this.useCheckboxesInList(!!Mb.settingsGet("UseCheckboxesInList")),this.layout(yb.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)))},mb.prototype.populateDataOnStart=function(){lb.prototype.populateDataOnStart.call(this),this.accountEmail(Mb.settingsGet("Email")),this.accountIncLogin(Mb.settingsGet("IncLogin")),this.accountOutLogin(Mb.settingsGet("OutLogin")),this.projectHash(Mb.settingsGet("ProjectHash")),this.displayName(Mb.settingsGet("DisplayName")),this.replyTo(Mb.settingsGet("ReplyTo")),this.signature(Mb.settingsGet("Signature")),this.signatureToAll(!!Mb.settingsGet("SignatureToAll")),this.enableTwoFactor(!!Mb.settingsGet("EnableTwoFactor")),this.lastFoldersHash=Mb.local().get(yb.ClientSideKeyName.FoldersLashHash)||"",this.remoteSuggestions=!!Mb.settingsGet("RemoteSuggestions"),this.devEmail=Mb.settingsGet("DevEmail"),this.devLogin=Mb.settingsGet("DevLogin"),this.devPassword=Mb.settingsGet("DevPassword")},mb.prototype.initUidNextAndNewMessages=function(b,c,d){if("INBOX"===b&&Ab.isNormal(c)&&""!==c){if(Ab.isArray(d)&&03)i(Mb.link().notificationMailIcon(),Mb.data().accountEmail(),Ab.i18n("MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION",{COUNT:g}));else for(;g>f;f++)i(Mb.link().notificationMailIcon(),z.emailsToLine(z.initEmailsFromJson(d[f].From),!1),d[f].Subject)}Mb.cache().setFolderUidNext(b,c)}},mb.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=Mb.cache().getFolderFromCacheList(g),f||(f=A.newInstanceFromJson(e),f&&(Mb.cache().setFolderToCacheList(g,f),Mb.cache().setFolderFullNameRaw(f.fullNameHash,g),f.isGmailFolder=xb.Values.GmailFolderName.toLowerCase()===g.toLowerCase(),""!==a&&a===f.fullNameRaw+f.delimiter&&(f.isNamespaceFolder=!0),(f.isNamespaceFolder||f.isGmailFolder)&&(f.isUnpaddigFolder=!0))),f&&(f.collapsed(!Ab.isFolderExpanded(f.fullNameHash)),e.Extended&&(e.Extended.Hash&&Mb.cache().setFolderHash(f.fullNameRaw,e.Extended.Hash),Ab.isNormal(e.Extended.MessageCount)&&f.messageCountAll(e.Extended.MessageCount),Ab.isNormal(e.Extended.MessageUnseenCount)&&f.messageCountUnread(e.Extended.MessageUnseenCount)),h=e.SubFolders,h&&"Collection/FolderCollection"===h["@Object"]&&h["@Collection"]&&Ab.isArray(h["@Collection"])&&f.subFolders(this.folderResponseParseRec(a,h["@Collection"])),i.push(f)));return i},mb.prototype.setFolders=function(a){var b=[],c=!1,d=Mb.data(),e=function(a){return""===a||xb.Values.UnuseOptionValue===a||null!==Mb.cache().getFolderFromCacheList(a)?a:""};a&&a.Result&&"Collection/FolderCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&Ab.isArray(a.Result["@Collection"])&&(Ab.isUnd(a.Result.Namespace)||(d.namespace=a.Result.Namespace),this.threading(!!Mb.settingsGet("UseImapThread")&&a.Result.IsThreadsSupported&&!0),b=this.folderResponseParseRec(d.namespace,a.Result["@Collection"]),d.folderList(b),a.Result.SystemFolders&&""==""+Mb.settingsGet("SentFolder")+Mb.settingsGet("DraftFolder")+Mb.settingsGet("SpamFolder")+Mb.settingsGet("TrashFolder")+Mb.settingsGet("ArchiveFolder")+Mb.settingsGet("NullFolder")&&(Mb.settingsSet("SentFolder",a.Result.SystemFolders[2]||null),Mb.settingsSet("DraftFolder",a.Result.SystemFolders[3]||null),Mb.settingsSet("SpamFolder",a.Result.SystemFolders[4]||null),Mb.settingsSet("TrashFolder",a.Result.SystemFolders[5]||null),Mb.settingsSet("ArchiveFolder",a.Result.SystemFolders[12]||null),c=!0),d.sentFolder(e(Mb.settingsGet("SentFolder"))),d.draftFolder(e(Mb.settingsGet("DraftFolder"))),d.spamFolder(e(Mb.settingsGet("SpamFolder"))),d.trashFolder(e(Mb.settingsGet("TrashFolder"))),d.archiveFolder(e(Mb.settingsGet("ArchiveFolder"))),c&&Mb.remote().saveSystemFolders(Ab.emptyFunction,{SentFolder:d.sentFolder(),DraftFolder:d.draftFolder(),SpamFolder:d.spamFolder(),TrashFolder:d.trashFolder(),ArchiveFolder:d.archiveFolder(),NullFolder:"NullFolder"}),Mb.local().set(yb.ClientSideKeyName.FoldersLashHash,a.Result.FoldersHash))},mb.prototype.hideMessageBodies=function(){var a=this.messagesBodiesDom();a&&a.find(".b-text-part").hide()},mb.prototype.getNextFolderNames=function(a){a=Ab.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=Mb.cache().getFolderFromCacheList(a[1]);return e&&(e.interval=d,b.push(a[1])),c<=b.length}),h.uniq(b)},mb.prototype.removeMessagesFromList=function(a,b,c,d){c=Ab.isNormal(c)?c:"",d=Ab.isUnd(d)?!1:!!d,b=h.map(b,function(a){return Ab.pInt(a)});var e=0,f=Mb.data(),g=Mb.cache(),i=Mb.cache().getFolderFromCacheList(a),j=""===c?null:g.getFolderFromCacheList(c||""),k=f.currentFolderFullNameRaw(),l=f.message(),m=k===a?h.filter(f.messageList(),function(a){return a&&-10&&i.messageCountUnread(0<=i.messageCountUnread()-e?i.messageCountUnread()-e:0)),j&&(j.messageCountAll(j.messageCountAll()+b.length),e>0&&j.messageCountUnread(j.messageCountUnread()+e),j.actionBlink(!0)),0').hide().addClass("rl-cache-class"),g.data("rl-cache-count",++Db.iMessageBodyCacheCount),Ab.isNormal(a.Result.Html)&&""!==a.Result.Html?(d=!0,g.html(a.Result.Html.toString()).addClass("b-text-part html")):Ab.isNormal(a.Result.Plain)&&""!==a.Result.Plain?(d=!1,j=a.Result.Plain.toString(),(n.isPgpSigned()||n.isPgpEncrypted())&&Mb.data().allowOpenPGP()&&Ab.isNormal(a.Result.PlainRaw)&&(n.plainRaw=Ab.pString(a.Result.PlainRaw),l=/---BEGIN PGP MESSAGE---/.test(n.plainRaw),l||(k=/-----BEGIN PGP SIGNED MESSAGE-----/.test(n.plainRaw)&&/-----BEGIN PGP SIGNATURE-----/.test(n.plainRaw)),Nb.empty(),k&&n.isPgpSigned()?j=Nb.append(b('
').text(n.plainRaw)).html():l&&n.isPgpEncrypted()&&(j=Nb.append(b('
').text(n.plainRaw)).html()),Nb.empty(),n.isPgpSigned(k),n.isPgpEncrypted(l)),g.html(j).addClass("b-text-part plain")):d=!1,n.isHtml(!!d),n.hasImages(!!e),n.pgpSignedVerifyStatus(yb.SignedVerifyStatus.None),n.pgpSignedVerifyUser(""),a.Result.Rtl&&(this.isRtl(!0),g.addClass("rtl-text-part")),n.body=g,n.body&&m.append(n.body),f&&n.showInternalImages(!0),n.hasImages()&&this.showImages()&&n.showExternalImages(!0),n.storeDataToDom(),this.purgeMessageBodyCacheThrottle()),this.messageActiveDom(n.body),this.hideMessageBodies(),n.body.show(),g&&Ab.initBlockquoteSwitcher(g)),Mb.cache().initMessageFlagsFromCache(n),n.unseen()&&Mb.setMessageSeen(n),Ab.windowResize())},mb.prototype.setMessageList=function(a,b){if(a&&a.Result&&"Collection/MessageCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&Ab.isArray(a.Result["@Collection"])){var c=Mb.data(),d=Mb.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=Ab.pInt(a.Result.MessageResultCount),j=Ab.pInt(a.Result.Offset),Ab.isNonEmptyArray(a.Result.LastCollapsedThreadUids)&&(e=a.Result.LastCollapsedThreadUids),p=Mb.cache().getFolderFromCacheList(Ab.isNormal(a.Result.Folder)?a.Result.Folder:""),p&&!b&&(p.interval=l,Mb.cache().setFolderHash(a.Result.Folder,a.Result.FolderHash),Ab.isNormal(a.Result.MessageCount)&&p.messageCountAll(a.Result.MessageCount),Ab.isNormal(a.Result.MessageUnseenCount)&&(Ab.pInt(p.messageCountUnread())!==Ab.pInt(a.Result.MessageUnseenCount)&&(r=!0),p.messageCountUnread(a.Result.MessageUnseenCount)),this.initUidNextAndNewMessages(p.fullNameRaw,a.Result.UidNext,a.Result.NewMessages)),r&&p&&Mb.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=z.newInstanceFromJson(n)),o&&(d.hasNewMessageAndRemoveFromCache(o.folderFullNameRaw,o.uid)&&5>=q&&(q++,o.newForAnimation(!0)),o.deleted(!1),b?Mb.cache().initMessageFlagsFromCache(o):Mb.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/"+Cb.urlsafe_encode([b,c,Mb.data().projectHash(),Mb.data().threading()&&Mb.data().useThreads()?"1":"0"].join(String.fromCharCode(0))),["Message"]),!0):!1},ob.prototype.composeUploadExternals=function(a,b){this.defaultRequest(a,"ComposeUploadExternals",{Externals:b},999e3)},ob.prototype.folderInformation=function(a,b,c){var d=!0,e=Mb.cache(),f=[];Ab.isArray(c)&&01048576?(a.alert(Ab.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(Ab.getUploadErrorDescByCode(d&&d.ErrorCode?d.ErrorCode:yb.UploadErrorCode.Unknown)),this.customThemeUploaderProgress(!1)},this)),!!b}return!1},Ab.addSettingsViewModel(kb,"SettingsOpenPGP","SETTINGS_LABELS/LABEL_OPEN_PGP_NAME","openpgp"),kb.prototype.addOpenPgpKey=function(){Fb.showScreenPopup(L)},kb.prototype.generateOpenPgpKey=function(){Fb.showScreenPopup(N)},kb.prototype.viewOpenPgpKey=function(a){a&&Fb.showScreenPopup(M,[a])},kb.prototype.deleteOpenPgpKey=function(a){if(a&&a.deleteAccess()){this.openPgpKeyForDeletion(null);var b=-1,c=Mb.data().openpgpKeyring,d=function(b){return a===b};a&&c&&(this.openpgpkeys.remove(d),h.each(c.keys,function(c,d){-1===b&&c&&c.primaryKey&&a.guid===c.primaryKey.getFingerprint()&&a.isPrivate===c.isPrivate()&&(b=d)}),b>=0&&c.removeKey(b),c.store(),Mb.reloadOpenPgpKeys())}},lb.prototype.populateDataOnStart=function(){var a=Ab.pInt(Mb.settingsGet("Layout")),b=Mb.settingsGet("Languages"),c=Mb.settingsGet("Themes");Ab.isArray(b)&&this.languages(b),Ab.isArray(c)&&this.themes(c),this.mainLanguage(Mb.settingsGet("Language")),this.mainTheme(Mb.settingsGet("Theme")),this.allowCustomTheme(!!Mb.settingsGet("AllowCustomTheme")),this.allowAdditionalAccounts(!!Mb.settingsGet("AllowAdditionalAccounts")),this.allowIdentities(!!Mb.settingsGet("AllowIdentities")),this.determineUserLanguage(!!Mb.settingsGet("DetermineUserLanguage")),this.allowThemes(!!Mb.settingsGet("AllowThemes")),this.allowCustomLogin(!!Mb.settingsGet("AllowCustomLogin")),this.allowLanguagesOnLogin(!!Mb.settingsGet("AllowLanguagesOnLogin")),this.allowLanguagesOnSettings(!!Mb.settingsGet("AllowLanguagesOnSettings")),this.editorDefaultType(Mb.settingsGet("EditorDefaultType")),this.showImages(!!Mb.settingsGet("ShowImages")),this.contactsAutosave(!!Mb.settingsGet("ContactsAutosave")),this.interfaceAnimation(Mb.settingsGet("InterfaceAnimation")),this.mainMessagesPerPage(Mb.settingsGet("MPP")),this.desktopNotifications(!!Mb.settingsGet("DesktopNotifications")),this.useThreads(!!Mb.settingsGet("UseThreads")),this.replySameFolder(!!Mb.settingsGet("ReplySameFolder")),this.useCheckboxesInList(!!Mb.settingsGet("UseCheckboxesInList")),this.layout(yb.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)))},mb.prototype.populateDataOnStart=function(){lb.prototype.populateDataOnStart.call(this),this.accountEmail(Mb.settingsGet("Email")),this.accountIncLogin(Mb.settingsGet("IncLogin")),this.accountOutLogin(Mb.settingsGet("OutLogin")),this.projectHash(Mb.settingsGet("ProjectHash")),this.displayName(Mb.settingsGet("DisplayName")),this.replyTo(Mb.settingsGet("ReplyTo")),this.signature(Mb.settingsGet("Signature")),this.signatureToAll(!!Mb.settingsGet("SignatureToAll")),this.enableTwoFactor(!!Mb.settingsGet("EnableTwoFactor")),this.lastFoldersHash=Mb.local().get(yb.ClientSideKeyName.FoldersLashHash)||"",this.remoteSuggestions=!!Mb.settingsGet("RemoteSuggestions"),this.devEmail=Mb.settingsGet("DevEmail"),this.devLogin=Mb.settingsGet("DevLogin"),this.devPassword=Mb.settingsGet("DevPassword")},mb.prototype.initUidNextAndNewMessages=function(b,c,d){if("INBOX"===b&&Ab.isNormal(c)&&""!==c){if(Ab.isArray(d)&&03)i(Mb.link().notificationMailIcon(),Mb.data().accountEmail(),Ab.i18n("MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION",{COUNT:g}));else for(;g>f;f++)i(Mb.link().notificationMailIcon(),z.emailsToLine(z.initEmailsFromJson(d[f].From),!1),d[f].Subject)}Mb.cache().setFolderUidNext(b,c)}},mb.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=Mb.cache().getFolderFromCacheList(g),f||(f=A.newInstanceFromJson(e),f&&(Mb.cache().setFolderToCacheList(g,f),Mb.cache().setFolderFullNameRaw(f.fullNameHash,g),f.isGmailFolder=xb.Values.GmailFolderName.toLowerCase()===g.toLowerCase(),""!==a&&a===f.fullNameRaw+f.delimiter&&(f.isNamespaceFolder=!0),(f.isNamespaceFolder||f.isGmailFolder)&&(f.isUnpaddigFolder=!0))),f&&(f.collapsed(!Ab.isFolderExpanded(f.fullNameHash)),e.Extended&&(e.Extended.Hash&&Mb.cache().setFolderHash(f.fullNameRaw,e.Extended.Hash),Ab.isNormal(e.Extended.MessageCount)&&f.messageCountAll(e.Extended.MessageCount),Ab.isNormal(e.Extended.MessageUnseenCount)&&f.messageCountUnread(e.Extended.MessageUnseenCount)),h=e.SubFolders,h&&"Collection/FolderCollection"===h["@Object"]&&h["@Collection"]&&Ab.isArray(h["@Collection"])&&f.subFolders(this.folderResponseParseRec(a,h["@Collection"])),i.push(f)));return i},mb.prototype.setFolders=function(a){var b=[],c=!1,d=Mb.data(),e=function(a){return""===a||xb.Values.UnuseOptionValue===a||null!==Mb.cache().getFolderFromCacheList(a)?a:""};a&&a.Result&&"Collection/FolderCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&Ab.isArray(a.Result["@Collection"])&&(Ab.isUnd(a.Result.Namespace)||(d.namespace=a.Result.Namespace),this.threading(!!Mb.settingsGet("UseImapThread")&&a.Result.IsThreadsSupported&&!0),b=this.folderResponseParseRec(d.namespace,a.Result["@Collection"]),d.folderList(b),a.Result.SystemFolders&&""==""+Mb.settingsGet("SentFolder")+Mb.settingsGet("DraftFolder")+Mb.settingsGet("SpamFolder")+Mb.settingsGet("TrashFolder")+Mb.settingsGet("ArchiveFolder")+Mb.settingsGet("NullFolder")&&(Mb.settingsSet("SentFolder",a.Result.SystemFolders[2]||null),Mb.settingsSet("DraftFolder",a.Result.SystemFolders[3]||null),Mb.settingsSet("SpamFolder",a.Result.SystemFolders[4]||null),Mb.settingsSet("TrashFolder",a.Result.SystemFolders[5]||null),Mb.settingsSet("ArchiveFolder",a.Result.SystemFolders[12]||null),c=!0),d.sentFolder(e(Mb.settingsGet("SentFolder"))),d.draftFolder(e(Mb.settingsGet("DraftFolder"))),d.spamFolder(e(Mb.settingsGet("SpamFolder"))),d.trashFolder(e(Mb.settingsGet("TrashFolder"))),d.archiveFolder(e(Mb.settingsGet("ArchiveFolder"))),c&&Mb.remote().saveSystemFolders(Ab.emptyFunction,{SentFolder:d.sentFolder(),DraftFolder:d.draftFolder(),SpamFolder:d.spamFolder(),TrashFolder:d.trashFolder(),ArchiveFolder:d.archiveFolder(),NullFolder:"NullFolder"}),Mb.local().set(yb.ClientSideKeyName.FoldersLashHash,a.Result.FoldersHash))},mb.prototype.hideMessageBodies=function(){var a=this.messagesBodiesDom();a&&a.find(".b-text-part").hide()},mb.prototype.getNextFolderNames=function(a){a=Ab.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=Mb.cache().getFolderFromCacheList(a[1]);return e&&(e.interval=d,b.push(a[1])),c<=b.length}),h.uniq(b)},mb.prototype.removeMessagesFromList=function(a,b,c,d){c=Ab.isNormal(c)?c:"",d=Ab.isUnd(d)?!1:!!d,b=h.map(b,function(a){return Ab.pInt(a)});var e=0,f=Mb.data(),g=Mb.cache(),i=Mb.cache().getFolderFromCacheList(a),j=""===c?null:g.getFolderFromCacheList(c||""),k=f.currentFolderFullNameRaw(),l=f.message(),m=k===a?h.filter(f.messageList(),function(a){return a&&-10&&i.messageCountUnread(0<=i.messageCountUnread()-e?i.messageCountUnread()-e:0)),j&&(j.messageCountAll(j.messageCountAll()+b.length),e>0&&j.messageCountUnread(j.messageCountUnread()+e),j.actionBlink(!0)),0').hide().addClass("rl-cache-class"),g.data("rl-cache-count",++Db.iMessageBodyCacheCount),Ab.isNormal(a.Result.Html)&&""!==a.Result.Html?(d=!0,g.html(a.Result.Html.toString()).addClass("b-text-part html")):Ab.isNormal(a.Result.Plain)&&""!==a.Result.Plain?(d=!1,j=a.Result.Plain.toString(),(n.isPgpSigned()||n.isPgpEncrypted())&&Mb.data().allowOpenPGP()&&Ab.isNormal(a.Result.PlainRaw)&&(n.plainRaw=Ab.pString(a.Result.PlainRaw),l=/---BEGIN PGP MESSAGE---/.test(n.plainRaw),l||(k=/-----BEGIN PGP SIGNED MESSAGE-----/.test(n.plainRaw)&&/-----BEGIN PGP SIGNATURE-----/.test(n.plainRaw)),Nb.empty(),k&&n.isPgpSigned()?j=Nb.append(b('
').text(n.plainRaw)).html():l&&n.isPgpEncrypted()&&(j=Nb.append(b('
').text(n.plainRaw)).html()),Nb.empty(),n.isPgpSigned(k),n.isPgpEncrypted(l)),g.html(j).addClass("b-text-part plain")):d=!1,n.isHtml(!!d),n.hasImages(!!e),n.pgpSignedVerifyStatus(yb.SignedVerifyStatus.None),n.pgpSignedVerifyUser(""),a.Result.Rtl&&(this.isRtl(!0),g.addClass("rtl-text-part")),n.body=g,n.body&&m.append(n.body),n.storeDataToDom(),f&&n.showInternalImages(!0),n.hasImages()&&this.showImages()&&n.showExternalImages(!0),this.purgeMessageBodyCacheThrottle()),this.messageActiveDom(n.body),this.hideMessageBodies(),n.body.show(),g&&Ab.initBlockquoteSwitcher(g)),Mb.cache().initMessageFlagsFromCache(n),n.unseen()&&Mb.setMessageSeen(n),Ab.windowResize())},mb.prototype.setMessageList=function(a,b){if(a&&a.Result&&"Collection/MessageCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&Ab.isArray(a.Result["@Collection"])){var c=Mb.data(),d=Mb.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=Ab.pInt(a.Result.MessageResultCount),j=Ab.pInt(a.Result.Offset),Ab.isNonEmptyArray(a.Result.LastCollapsedThreadUids)&&(e=a.Result.LastCollapsedThreadUids),p=Mb.cache().getFolderFromCacheList(Ab.isNormal(a.Result.Folder)?a.Result.Folder:""),p&&!b&&(p.interval=l,Mb.cache().setFolderHash(a.Result.Folder,a.Result.FolderHash),Ab.isNormal(a.Result.MessageCount)&&p.messageCountAll(a.Result.MessageCount),Ab.isNormal(a.Result.MessageUnseenCount)&&(Ab.pInt(p.messageCountUnread())!==Ab.pInt(a.Result.MessageUnseenCount)&&(r=!0),p.messageCountUnread(a.Result.MessageUnseenCount)),this.initUidNextAndNewMessages(p.fullNameRaw,a.Result.UidNext,a.Result.NewMessages)),r&&p&&Mb.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=z.newInstanceFromJson(n)),o&&(d.hasNewMessageAndRemoveFromCache(o.folderFullNameRaw,o.uid)&&5>=q&&(q++,o.newForAnimation(!0)),o.deleted(!1),b?Mb.cache().initMessageFlagsFromCache(o):Mb.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/"+Cb.urlsafe_encode([b,c,Mb.data().projectHash(),Mb.data().threading()&&Mb.data().useThreads()?"1":"0"].join(String.fromCharCode(0))),["Message"]),!0):!1},ob.prototype.composeUploadExternals=function(a,b){this.defaultRequest(a,"ComposeUploadExternals",{Externals:b},999e3)},ob.prototype.folderInformation=function(a,b,c){var d=!0,e=Mb.cache(),f=[];Ab.isArray(c)&&0
").addClass("rl-settings-view-model").hide().attr("data-bind",'template: {name: "'+f.__rlSettingsData.Template+'"}, i18nInit: true'),i.appendTo(g),e.data=Mb.data(),e.viewModelDom=i,e.__rlSettingsData=f.__rlSettingsData,f.__dom=i,f.__builded=!0,f.__vm=e,c.applyBindings(e,i[0]),Ab.delegateRun(e,"onBuild",[i])):Ab.log("Cannot find sub settings view model position: SettingsSubScreen")),e&&h.defer(function(){d.oCurrentSubScreen&&(Ab.delegateRun(d.oCurrentSubScreen,"onHide"),d.oCurrentSubScreen.viewModelDom.hide()),d.oCurrentSubScreen=e,d.oCurrentSubScreen&&(d.oCurrentSubScreen.viewModelDom.show(),Ab.delegateRun(d.oCurrentSubScreen,"onShow"),Ab.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)),Ab.windowResize()})):Fb.setHash(Mb.link().settings(),!1,!0)},rb.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(Ab.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},rb.prototype.onBuild=function(){h.each(Eb.settings,function(a){a&&a.__rlSettingsData&&!h.find(Eb["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(Eb["settings-disabled"],function(b){return b&&b===a})})},this),this.oViewModelPlace=b("#rl-content #rl-settings-subscreen")},rb.prototype.routes=function(){var a=h.find(Eb.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=Ab.isUnd(c.subname)?b:Ab.pString(c.subname),[c.subname]}};return[["{subname}/",c],["{subname}",c],["",c]]},h.extend(sb.prototype,s.prototype),sb.prototype.onShow=function(){Mb.setTitle("")},h.extend(tb.prototype,s.prototype),tb.prototype.oLastRoute={},tb.prototype.setNewTitle=function(){var a=Mb.data().accountEmail(),b=Mb.data().foldersInboxUnreadCount();Mb.setTitle((""===a?"":(b>0?"("+b+") ":" ")+a+" - ")+Ab.i18n("TITLES/MAILBOX"))},tb.prototype.onShow=function(){this.setNewTitle()},tb.prototype.onRoute=function(a,b,c,d){if(Ab.isUnd(d)?1:!d){var e=Mb.data(),f=Mb.cache().getFolderFullNameRaw(a),g=Mb.cache().getFolderFromCacheList(f);g&&(e.currentFolder(g).messageListPage(b).messageListSearch(c),yb.Layout.NoPreview===e.layout()&&e.message()&&(e.message(null),e.messageFullScreenMode(!1)),Mb.reloadMessageList())}else yb.Layout.NoPreview!==Mb.data().layout()||Mb.data().message()||Mb.historyBack()},tb.prototype.onStart=function(){var a=Mb.data(),b=function(){Ab.windowResize()};(Mb.settingsGet("AllowAdditionalAccounts")||Mb.settingsGet("AllowIdentities"))&&Mb.accountsAndIdentities(),h.delay(function(){"INBOX"!==a.currentFolderFullNameRaw()&&Mb.folderInformation("INBOX")},1e3),h.delay(function(){Mb.quota()},5e3),h.delay(function(){Mb.remote().appDelayStart(Ab.emptyFunction)},35e3),Ib.toggleClass("rl-no-preview-pane",yb.Layout.NoPreview===a.layout()),a.folderList.subscribe(b),a.messageList.subscribe(b),a.message.subscribe(b),a.layout.subscribe(function(a){Ib.toggleClass("rl-no-preview-pane",yb.Layout.NoPreview===a)}),a.foldersInboxUnreadCount.subscribe(function(){this.setNewTitle()},this)},tb.prototype.routes=function(){var a=function(){return["Inbox",1,"",!0]},b=function(a,b){return b[0]=Ab.pString(b[0]),b[1]=Ab.pInt(b[1]),b[1]=0>=b[1]?1:b[1],b[2]=Ab.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]=Ab.pString(b[0]),b[1]=Ab.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(ub.prototype,rb.prototype),ub.prototype.onShow=function(){Mb.setTitle(this.sSettingsTitle)},h.extend(vb.prototype,q.prototype),vb.prototype.oSettings=null,vb.prototype.oPlugins=null,vb.prototype.oLocal=null,vb.prototype.oLink=null,vb.prototype.oSubs={},vb.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):(Db.bMobileDevice?(a.open(b,"_self"),a.focus()):this.iframe.attr("src",b),!0)},vb.prototype.link=function(){return null===this.oLink&&(this.oLink=new j),this.oLink},vb.prototype.local=function(){return null===this.oLocal&&(this.oLocal=new p),this.oLocal},vb.prototype.settingsGet=function(a){return null===this.oSettings&&(this.oSettings=Ab.isNormal(Gb)?Gb:{}),Ab.isUnd(this.oSettings[a])?null:this.oSettings[a]},vb.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=Ab.isNormal(Gb)?Gb:{}),this.oSettings[a]=b},vb.prototype.setTitle=function(b){b=(Ab.isNormal(b)&&0l;l++)p.push({id:e[l][0],name:e[l][1],disable:!1});for(l=0,m=b.length;m>l;l++)n=b[l],(h?h.call(null,n):!0)&&p.push({id:n.fullNameRaw,system:!0,name:i?i.call(null,n):n.name(),disable:!n.selectable||-1l;l++)n=c[l],n.isGmailFolder||!n.subScribed()&&n.existen||(h?h.call(null,n):!0)&&(yb.FolderType.User===n.type()||!j||!n.isNamespaceFolder&&0