diff --git a/dev/Common/Selector.js b/dev/Common/Selector.js index df13b9587..306c07f74 100644 --- a/dev/Common/Selector.js +++ b/dev/Common/Selector.js @@ -582,6 +582,29 @@ Selector.prototype.scrollToFocused = function () return false; }; +/** + * @param {boolean=} bFast = false + * @return {boolean} + */ +Selector.prototype.scrollToTop = function (bFast) +{ + if (!this.oContentVisible || !this.oContentScrollable) + { + return false; + } + + if (bFast) + { + this.oContentScrollable.scrollTop(0); + } + else + { + this.oContentScrollable.stop().animate({'scrollTop': 0}, 200); + } + + return true; +}; + Selector.prototype.eventClickFunction = function (oItem, oEvent) { var diff --git a/dev/Storages/WebMailData.js b/dev/Storages/WebMailData.js index c4a5ce203..4d66cf2bc 100644 --- a/dev/Storages/WebMailData.js +++ b/dev/Storages/WebMailData.js @@ -218,8 +218,13 @@ function WebMailDataStorage() this.messageListThreadUids([]); }, this); - this.messageListEndSearch = ko.observable(''); this.messageListEndFolder = ko.observable(''); + this.messageListEndSearch = ko.observable(''); + this.messageListEndPage = ko.observable(1); + + this.messageListEndHash = ko.computed(function () { + return this.messageListEndFolder() + '|' + this.messageListEndSearch() + '|' + this.messageListEndPage(); + }, this); this.messageListPageCount = ko.computed(function () { var iPage = Math.ceil(this.messageListCount() / this.messagesPerPage()); @@ -1133,9 +1138,10 @@ WebMailDataStorage.prototype.setMessageList = function (oData, bCached) oRainLoopData.messageListCount(iCount); oRainLoopData.messageListSearch(Utils.isNormal(oData.Result.Search) ? oData.Result.Search : ''); - oRainLoopData.messageListEndSearch(Utils.isNormal(oData.Result.Search) ? oData.Result.Search : ''); - oRainLoopData.messageListEndFolder(Utils.isNormal(oData.Result.Folder) ? oData.Result.Folder : ''); oRainLoopData.messageListPage(Math.ceil((iOffset / oRainLoopData.messagesPerPage()) + 1)); + oRainLoopData.messageListEndFolder(Utils.isNormal(oData.Result.Folder) ? oData.Result.Folder : ''); + oRainLoopData.messageListEndSearch(Utils.isNormal(oData.Result.Search) ? oData.Result.Search : ''); + oRainLoopData.messageListEndPage(oRainLoopData.messageListPage()); oRainLoopData.messageList(aList); oRainLoopData.messageListIsNotCompleted(false); diff --git a/dev/ViewModels/MailBoxMessageListViewModel.js b/dev/ViewModels/MailBoxMessageListViewModel.js index afbc657b4..bb32a0c70 100644 --- a/dev/ViewModels/MailBoxMessageListViewModel.js +++ b/dev/ViewModels/MailBoxMessageListViewModel.js @@ -208,6 +208,10 @@ function MailBoxMessageListViewModel() return oMessage ? oMessage.generateUid() : ''; }); + oData.messageListEndHash.subscribe(function (mValue) { + this.selector.scrollToTop(); + }, this); + oData.layout.subscribe(function (mValue) { this.selector.autoSelect(Enums.Layout.NoPreview !== mValue); }, this); diff --git a/rainloop/v/0.0.0/static/js/app.js b/rainloop/v/0.0.0/static/js/app.js index a8dca932c..d96c7c91e 100644 --- a/rainloop/v/0.0.0/static/js/app.js +++ b/rainloop/v/0.0.0/static/js/app.js @@ -4578,6 +4578,29 @@ Selector.prototype.scrollToFocused = function () return false; }; +/** + * @param {boolean=} bFast = false + * @return {boolean} + */ +Selector.prototype.scrollToTop = function (bFast) +{ + if (!this.oContentVisible || !this.oContentScrollable) + { + return false; + } + + if (bFast) + { + this.oContentScrollable.scrollTop(0); + } + else + { + this.oContentScrollable.stop().animate({'scrollTop': 0}, 200); + } + + return true; +}; + Selector.prototype.eventClickFunction = function (oItem, oEvent) { var @@ -12201,6 +12224,10 @@ function MailBoxMessageListViewModel() return oMessage ? oMessage.generateUid() : ''; }); + oData.messageListEndHash.subscribe(function (mValue) { + this.selector.scrollToTop(); + }, this); + oData.layout.subscribe(function (mValue) { this.selector.autoSelect(Enums.Layout.NoPreview !== mValue); }, this); @@ -15294,8 +15321,13 @@ function WebMailDataStorage() this.messageListThreadUids([]); }, this); - this.messageListEndSearch = ko.observable(''); this.messageListEndFolder = ko.observable(''); + this.messageListEndSearch = ko.observable(''); + this.messageListEndPage = ko.observable(1); + + this.messageListEndHash = ko.computed(function () { + return this.messageListEndFolder() + '|' + this.messageListEndSearch() + '|' + this.messageListEndPage(); + }, this); this.messageListPageCount = ko.computed(function () { var iPage = Math.ceil(this.messageListCount() / this.messagesPerPage()); @@ -16209,9 +16241,10 @@ WebMailDataStorage.prototype.setMessageList = function (oData, bCached) oRainLoopData.messageListCount(iCount); oRainLoopData.messageListSearch(Utils.isNormal(oData.Result.Search) ? oData.Result.Search : ''); - oRainLoopData.messageListEndSearch(Utils.isNormal(oData.Result.Search) ? oData.Result.Search : ''); - oRainLoopData.messageListEndFolder(Utils.isNormal(oData.Result.Folder) ? oData.Result.Folder : ''); oRainLoopData.messageListPage(Math.ceil((iOffset / oRainLoopData.messagesPerPage()) + 1)); + oRainLoopData.messageListEndFolder(Utils.isNormal(oData.Result.Folder) ? oData.Result.Folder : ''); + oRainLoopData.messageListEndSearch(Utils.isNormal(oData.Result.Search) ? oData.Result.Search : ''); + oRainLoopData.messageListEndPage(oRainLoopData.messageListPage()); oRainLoopData.messageList(aList); oRainLoopData.messageListIsNotCompleted(false); 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 ae8fd41da..c013ae13e 100644 --- a/rainloop/v/0.0.0/static/js/app.min.js +++ b/rainloop/v/0.0.0/static/js/app.min.js @@ -1,10 +1,10 @@ /*! RainLoop Webmail Main Module (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ !function(a,b,c,d,e,f,g,h,i,j){"use strict";function k(){this.sBase="#/",this.sCdnStaticDomain=Ob.settingsGet("CdnStaticDomain"),this.sVersion=Ob.settingsGet("Version"),this.sSpecSuffix=Ob.settingsGet("AuthAccountHash")||"0",this.sServer=(Ob.settingsGet("IndexFile")||"./")+"?",this.sCdnStaticDomain=""===this.sCdnStaticDomain?this.sCdnStaticDomain:"/"===this.sCdnStaticDomain.substr(-1)?this.sCdnStaticDomain:this.sCdnStaticDomain+"/"}function l(a,c,d,e){var f=this;f.editor=null,f.iBlurTimer=0,f.fOnBlur=c||null,f.fOnReady=d||null,f.fOnModeChange=e||null,f.$element=b(a),f.init()}function m(a,b,d,e,f,g){this.list=a,this.listChecked=c.computed(function(){return h.filter(this.list(),function(a){return a.checked()})},this).extend({rateLimit:0}),this.isListChecked=c.computed(function(){return 00&&-1b?b:a))},this),this.body=null,this.plainRaw="",this.isRtl=c.observable(!1),this.isHtml=c.observable(!1),this.hasImages=c.observable(!1),this.attachments=c.observableArray([]),this.isPgpSigned=c.observable(!1),this.isPgpEncrypted=c.observable(!1),this.pgpSignedVerifyStatus=c.observable(zb.SignedVerifyStatus.None),this.pgpSignedVerifyUser=c.observable(""),this.priority=c.observable(zb.MessagePriority.Normal),this.readReceipt=c.observable(""),this.aDraftInfo=[],this.sMessageId="",this.sInReplyTo="",this.sReferences="",this.parentUid=c.observable(0),this.threads=c.observableArray([]),this.threadsLen=c.observable(0),this.hasUnseenSubMessage=c.observable(!1),this.hasFlaggedSubMessage=c.observable(!1),this.lastInCollapsedThread=c.observable(!1),this.lastInCollapsedThreadLoading=c.observable(!1),this.threadsLenResult=c.computed(function(){var a=this.threadsLen();return 0===this.parentUid()&&a>0?a+1:""},this)}function A(){this.name=c.observable(""),this.fullName="",this.fullNameRaw="",this.fullNameHash="",this.delimiter="",this.namespace="",this.deep=0,this.interval=0,this.selectable=!1,this.existen=!0,this.type=c.observable(zb.FolderType.User),this.focused=c.observable(!1),this.selected=c.observable(!1),this.edited=c.observable(!1),this.collapsed=c.observable(!0),this.subScribed=c.observable(!0),this.subFolders=c.observableArray([]),this.deleteAccess=c.observable(!1),this.actionBlink=c.observable(!1).extend({falseTimeout:1e3}),this.nameForEdit=c.observable(""),this.name.subscribe(function(a){this.nameForEdit(a)},this),this.edited.subscribe(function(a){a&&this.nameForEdit(this.name())},this),this.privateMessageCountAll=c.observable(0),this.privateMessageCountUnread=c.observable(0),this.collapsedPrivate=c.observable(!0)}function B(a,b){this.email=a,this.deleteAccess=c.observable(!1),this.canBeDalete=c.observable(b)}function C(a,b,d){this.id=a,this.email=c.observable(b),this.name=c.observable(""),this.replyTo=c.observable(""),this.bcc=c.observable(""),this.deleteAccess=c.observable(!1),this.canBeDalete=c.observable(d)}function D(a,b,d,e,f,g,h){this.index=a,this.id=d,this.guid=b,this.user=e,this.email=f,this.armor=h,this.isPrivate=!!g,this.deleteAccess=c.observable(!1)}function E(){r.call(this,"Popups","PopupsFolderClear"),this.selectedFolder=c.observable(null),this.clearingProcess=c.observable(!1),this.clearingError=c.observable(""),this.folderFullNameForClear=c.computed(function(){var a=this.selectedFolder();return a?a.printableFullName():""},this),this.folderNameForClear=c.computed(function(){var a=this.selectedFolder();return a?a.localName():""},this),this.dangerDescHtml=c.computed(function(){return Bb.i18n("POPUPS_CLEAR_FOLDER/DANGER_DESC_HTML_1",{FOLDER:this.folderNameForClear()})},this),this.clearCommand=Bb.createCommand(this,function(){var a=this,b=this.selectedFolder();b&&(Ob.data().message(null),Ob.data().messageList([]),this.clearingProcess(!0),Ob.cache().setFolderHash(b.fullNameRaw,""),Ob.remote().folderClear(function(b,c){a.clearingProcess(!1),zb.StorageResultType.Success===b&&c&&c.Result?(Ob.reloadMessageList(!0),a.cancelCommand()):a.clearingError(c&&c.ErrorCode?Bb.getNotification(c.ErrorCode):Bb.getNotification(zb.Notification.MailServerError))},b.fullNameRaw))},function(){var a=this.selectedFolder(),b=this.clearingProcess();return!b&&null!==a}),t.constructorEnd(this)}function F(){r.call(this,"Popups","PopupsFolderCreate"),Bb.initOnStartOrLangChange(function(){this.sNoParentText=Bb.i18n("POPUPS_CREATE_FOLDER/SELECT_NO_PARENT")},this),this.folderName=c.observable(""),this.folderName.focused=c.observable(!1),this.selectedParentValue=c.observable(yb.Values.UnuseOptionValue),this.parentFolderSelectList=c.computed(function(){var a=Ob.data(),b=[],c=null,d=null,e=a.folderList(),f=function(a){return a?a.isSystemFolder()?a.name()+" "+a.manageFolderSystemName():a.name():""};return b.push(["",this.sNoParentText]),""!==a.namespace&&(c=function(b){return a.namespace!==b.fullNameRaw.substr(0,a.namespace.length)}),Ob.folderListOptionsBuilder([],e,[],b,null,c,d,f)},this),this.createFolder=Bb.createCommand(this,function(){var a=Ob.data(),b=this.selectedParentValue();""===b&&1=a?1:a},this),this.contactsPagenator=c.computed(Bb.computedPagenatorHelper(this.contactsPage,this.contactsPageCount)),this.emptySelection=c.observable(!0),this.viewClearSearch=c.observable(!1),this.viewID=c.observable(""),this.viewReadOnly=c.observable(!1),this.viewProperties=c.observableArray([]),this.viewSaveTrigger=c.observable(zb.SaveSettingsStep.Idle),this.viewPropertiesNames=this.viewProperties.filter(function(a){return-1a)break;b[0]&&b[1]&&b[2]&&b[1]===b[2]&&("PRIVATE"===b[1]?e.privateKeys.importKey(b[0]):"PUBLIC"===b[1]&&e.publicKeys.importKey(b[0])),a--}return e.store(),Ob.reloadOpenPgpKeys(),Bb.delegateRun(this,"cancelCommand"),!0}),t.constructorEnd(this)}function M(){r.call(this,"Popups","PopupsViewOpenPgpKey"),this.key=c.observable(""),this.keyDom=c.observable(null),t.constructorEnd(this)}function N(){r.call(this,"Popups","PopupsGenerateNewOpenPgpKey"),this.email=c.observable(""),this.email.focus=c.observable(""),this.email.error=c.observable(!1),this.name=c.observable(""),this.password=c.observable(""),this.keyBitLength=c.observable(2048),this.submitRequest=c.observable(!1),this.email.subscribe(function(){this.email.error(!1)},this),this.generateOpenPgpKeyCommand=Bb.createCommand(this,function(){var b=this,c="",d=null,e=Ob.data().openpgpKeyring;return this.email.error(""===Bb.trim(this.email())),!e||this.email.error()?!1:(c=this.email(),""!==this.name()&&(c=this.name()+" <"+c+">"),this.submitRequest(!0),h.delay(function(){d=a.openpgp.generateKeyPair(1,Bb.pInt(b.keyBitLength()),c,Bb.trim(b.password())),d&&d.privateKeyArmored&&(e.privateKeys.importKey(d.privateKeyArmored),e.publicKeys.importKey(d.publicKeyArmored),e.store(),Ob.reloadOpenPgpKeys(),Bb.delegateRun(b,"cancelCommand")),b.submitRequest(!1)},100),!0)}),t.constructorEnd(this)}function O(){r.call(this,"Popups","PopupsComposeOpenPgp"),this.notification=c.observable(""),this.sign=c.observable(!0),this.encrypt=c.observable(!0),this.password=c.observable(""),this.password.focus=c.observable(!1),this.buttonFocus=c.observable(!1),this.from=c.observable(""),this.to=c.observableArray([]),this.text=c.observable(""),this.resultCallback=null,this.submitRequest=c.observable(!1),this.doCommand=Bb.createCommand(this,function(){var b=this,c=!0,d=Ob.data(),e=null,f=[];this.submitRequest(!0),c&&this.sign()&&""===this.from()&&(this.notification(Bb.i18n("PGP_NOTIFICATIONS/SPECIFY_FROM_EMAIL")),c=!1),c&&this.sign()&&(e=d.findPrivateKeyByEmail(this.from(),this.password()),e||(this.notification(Bb.i18n("PGP_NOTIFICATIONS/NO_PRIVATE_KEY_FOUND_FOR",{EMAIL:this.from()})),c=!1)),c&&this.encrypt()&&0===this.to().length&&(this.notification(Bb.i18n("PGP_NOTIFICATIONS/SPECIFY_AT_LEAST_ONE_RECIPIENT")),c=!1),c&&this.encrypt()&&(f=[],h.each(this.to(),function(a){var e=d.findPublicKeysByEmail(a);0===e.length&&c&&(b.notification(Bb.i18n("PGP_NOTIFICATIONS/NO_PUBLIC_KEYS_FOUND_FOR",{EMAIL:a})),c=!1),f=f.concat(e)}),!c||0!==f.length&&this.to().length===f.length||(c=!1)),h.delay(function(){if(b.resultCallback&&c)try{e&&0===f.length?b.resultCallback(a.openpgp.signClearMessage([e],b.text())):e&&00&&b>0&&a>b},this),this.hasMessages=c.computed(function(){return 0'),e.after(f),e.remove()),f&&f[0]&&(f.attr("data-href",g).attr("data-theme",a[0]),f&&f[0]&&f[0].styleSheet&&!Bb.isUnd(f[0].styleSheet.cssText)?f[0].styleSheet.cssText=a[1]:f.text(a[1])),d.themeTrigger(zb.SaveSettingsStep.TrueResult))}).always(function(){d.iTimer=a.setTimeout(function(){d.themeTrigger(zb.SaveSettingsStep.Idle)},1e3),d.oLastAjax=null})),Ob.remote().saveSettings(null,{Theme:c})},this)}function lb(){this.openpgpkeys=Ob.data().openpgpkeys,this.openpgpkeysPublic=Ob.data().openpgpkeysPublic,this.openpgpkeysPrivate=Ob.data().openpgpkeysPrivate,this.openPgpKeyForDeletion=c.observable(null).extend({falseTimeout:3e3}).extend({toggleSubscribe:[this,function(a){a&&a.deleteAccess(!1)},function(a){a&&a.deleteAccess(!0)}]})}function mb(){this.useKeyboardShortcuts=c.observable(!0),this.keyScopeReal=c.observable(zb.KeyState.All),this.keyScopeFake=c.observable(zb.KeyState.All),this.keyScope=c.computed({owner:this,read:function(){return this.keyScopeFake()},write:function(a){zb.KeyState.Menu!==a&&(zb.KeyState.Compose===a?Bb.disableKeyFilter():Bb.restoreKeyFilter(),this.keyScopeFake(a),Eb.dropdownVisibility()&&(a=zb.KeyState.Menu)),this.keyScopeReal(a)}}),this.keyScopeReal.subscribe(function(a){j.setScope(a)}),Eb.dropdownVisibility.subscribe(function(a){a?this.keyScope(zb.KeyState.Menu):zb.KeyState.Menu===j.getScope()&&this.keyScope(this.keyScopeFake())},this),Bb.initDataConstructorBySettings(this)}function nb(){mb.call(this);var d=function(a){return function(){var b=Ob.cache().getFolderFromCacheList(a());b&&b.type(zb.FolderType.User)}},e=function(a){return function(b){var c=Ob.cache().getFolderFromCacheList(b);c&&c.type(a)}};this.devEmail="",this.devLogin="",this.devPassword="",this.accountEmail=c.observable(""),this.accountIncLogin=c.observable(""),this.accountOutLogin=c.observable(""),this.projectHash=c.observable(""),this.threading=c.observable(!1),this.lastFoldersHash="",this.remoteSuggestions=!1,this.sentFolder=c.observable(""),this.draftFolder=c.observable(""),this.spamFolder=c.observable(""),this.trashFolder=c.observable(""),this.archiveFolder=c.observable(""),this.sentFolder.subscribe(d(this.sentFolder),this,"beforeChange"),this.draftFolder.subscribe(d(this.draftFolder),this,"beforeChange"),this.spamFolder.subscribe(d(this.spamFolder),this,"beforeChange"),this.trashFolder.subscribe(d(this.trashFolder),this,"beforeChange"),this.archiveFolder.subscribe(d(this.archiveFolder),this,"beforeChange"),this.sentFolder.subscribe(e(zb.FolderType.SentItems),this),this.draftFolder.subscribe(e(zb.FolderType.Draft),this),this.spamFolder.subscribe(e(zb.FolderType.Spam),this),this.trashFolder.subscribe(e(zb.FolderType.Trash),this),this.archiveFolder.subscribe(e(zb.FolderType.Archive),this),this.draftFolderNotEnabled=c.computed(function(){return""===this.draftFolder()||yb.Values.UnuseOptionValue===this.draftFolder()},this),this.displayName=c.observable(""),this.signature=c.observable(""),this.signatureToAll=c.observable(!1),this.replyTo=c.observable(""),this.enableTwoFactor=c.observable(!1),this.accounts=c.observableArray([]),this.accountsLoading=c.observable(!1).extend({throttle:100}),this.identities=c.observableArray([]),this.identitiesLoading=c.observable(!1).extend({throttle:100}),this.allowContactsSync=c.observable(!1),this.enableContactsSync=c.observable(!1),this.contactsSyncUrl=c.observable(""),this.contactsSyncUser=c.observable(""),this.contactsSyncPass=c.observable(""),this.allowContactsSync=c.observable(!!Ob.settingsGet("ContactsSyncIsAllowed")),this.enableContactsSync=c.observable(!!Ob.settingsGet("EnableContactsSync")),this.contactsSyncUrl=c.observable(Ob.settingsGet("ContactsSyncUrl")),this.contactsSyncUser=c.observable(Ob.settingsGet("ContactsSyncUser")),this.contactsSyncPass=c.observable(Ob.settingsGet("ContactsSyncPassword")),this.namespace="",this.folderList=c.observableArray([]),this.folderList.focused=c.observable(!1),this.foldersListError=c.observable(""),this.foldersLoading=c.observable(!1),this.foldersCreating=c.observable(!1),this.foldersDeleting=c.observable(!1),this.foldersRenaming=c.observable(!1),this.foldersChanging=c.computed(function(){var a=this.foldersLoading(),b=this.foldersCreating(),c=this.foldersDeleting(),d=this.foldersRenaming();return a||b||c||d},this),this.foldersInboxUnreadCount=c.observable(0),this.currentFolder=c.observable(null).extend({toggleSubscribe:[null,function(a){a&&a.selected(!1)},function(a){a&&a.selected(!0)}]}),this.currentFolderFullNameRaw=c.computed(function(){return this.currentFolder()?this.currentFolder().fullNameRaw:""},this),this.currentFolderFullName=c.computed(function(){return this.currentFolder()?this.currentFolder().fullName:""},this),this.currentFolderFullNameHash=c.computed(function(){return this.currentFolder()?this.currentFolder().fullNameHash:""},this),this.currentFolderName=c.computed(function(){return this.currentFolder()?this.currentFolder().name():""},this),this.folderListSystemNames=c.computed(function(){var a=["INBOX"],b=this.folderList(),c=this.sentFolder(),d=this.draftFolder(),e=this.spamFolder(),f=this.trashFolder(),g=this.archiveFolder();return Bb.isArray(b)&&0=a?1:a},this),this.mainMessageListSearch=c.computed({read:this.messageListSearch,write:function(a){Hb.setHash(Ob.link().mailBox(this.currentFolderFullNameHash(),1,Bb.trim(a.toString()))) -},owner:this}),this.messageListError=c.observable(""),this.messageListLoading=c.observable(!1),this.messageListIsNotCompleted=c.observable(!1),this.messageListCompleteLoadingThrottle=c.observable(!1).extend({throttle:200}),this.messageListCompleteLoading=c.computed(function(){var a=this.messageListLoading(),b=this.messageListIsNotCompleted();return a||b},this),this.messageListCompleteLoading.subscribe(function(a){this.messageListCompleteLoadingThrottle(a)},this),this.messageList.subscribe(h.debounce(function(a){h.each(a,function(a){a.newForAnimation()&&a.newForAnimation(!1)})},500)),this.staticMessageList=new z,this.message=c.observable(null),this.messageLoading=c.observable(!1),this.messageLoadingThrottle=c.observable(!1).extend({throttle:50}),this.message.focused=c.observable(!1),this.message.subscribe(function(b){b?zb.Layout.NoPreview===this.layout()&&this.message.focused(!0):(this.message.focused(!1),this.hideMessageBodies(),zb.Layout.NoPreview===Ob.data().layout()&&-10?Math.ceil(b/a*100):0},this),this.allowOpenPGP=c.observable(!1),this.openpgpkeys=c.observableArray([]),this.openpgpKeyring=null,this.openpgpkeysPublic=this.openpgpkeys.filter(function(a){return!(!a||a.isPrivate)}),this.openpgpkeysPrivate=this.openpgpkeys.filter(function(a){return!(!a||!a.isPrivate)}),this.googleActions=c.observable(!1),this.googleLoggined=c.observable(!1),this.googleUserName=c.observable(""),this.facebookActions=c.observable(!1),this.facebookLoggined=c.observable(!1),this.facebookUserName=c.observable(""),this.twitterActions=c.observable(!1),this.twitterLoggined=c.observable(!1),this.twitterUserName=c.observable(""),this.customThemeType=c.observable(zb.CustomThemeType.Light),this.purgeMessageBodyCacheThrottle=h.throttle(this.purgeMessageBodyCache,3e4)}function ob(){this.oRequests={}}function pb(){ob.call(this),this.oRequests={}}function qb(){this.oEmailsPicsHashes={},this.oServices={}}function rb(){qb.call(this),this.oFoldersCache={},this.oFoldersNamesCache={},this.oFolderHashCache={},this.oFolderUidNextCache={},this.oMessageListHashCache={},this.oMessageFlagsCache={},this.oNewMessage={},this.oRequestedMessage={}}function sb(a){s.call(this,"settings",a),this.menu=c.observableArray([]),this.oCurrentSubScreen=null,this.oViewModelPlace=null}function tb(){s.call(this,"login",[U])}function ub(){s.call(this,"mailbox",[W,Y,Z,$]),this.oLastRoute={}}function vb(){sb.call(this,[X,_,ab]),Bb.initOnStartOrLangChange(function(){this.sSettingsTitle=Bb.i18n("TITLES/SETTINGS")},this,function(){Ob.setTitle(this.sSettingsTitle)})}function wb(){q.call(this),this.oSettings=null,this.oPlugins=null,this.oLocal=null,this.oLink=null,this.oSubs={},this.isLocalAutocomplete=!0,this.popupVisibilityNames=c.observableArray([]),this.popupVisibility=c.computed(function(){return 0').appendTo("body"),Lb.on("error",function(a){Ob&&a&&a.originalEvent&&a.originalEvent.message&&-1===Bb.inArray(a.originalEvent.message,["Script error.","Uncaught Error: Error calling method on NPObject."])&&Ob.remote().jsError(Bb.emptyFunction,a.originalEvent.message,a.originalEvent.filename,a.originalEvent.lineno,location&&location.toString?location.toString():"",Kb.attr("class"),Bb.microtime()-Eb.now)})}function xb(){wb.call(this),this.oData=null,this.oRemote=null,this.oCache=null,this.oMoveCache={},this.quotaDebounce=h.debounce(this.quota,3e4),this.moveOrDeleteResponseHelper=h.bind(this.moveOrDeleteResponseHelper,this),this.messagesMoveTrigger=h.debounce(this.messagesMoveTrigger,500),a.setInterval(function(){Ob.pub("interval.30s")},3e4),a.setInterval(function(){Ob.pub("interval.1m")},6e4),a.setInterval(function(){Ob.pub("interval.2m")},12e4),a.setInterval(function(){Ob.pub("interval.3m")},18e4),a.setInterval(function(){Ob.pub("interval.5m")},3e5),a.setInterval(function(){Ob.pub("interval.10m")},6e5),b.wakeUp(function(){Ob.remote().jsVersion(function(b,c){zb.StorageResultType.Success===b&&c&&!c.Result&&(a.parent&&Ob.settingsGet("InIframe")?a.parent.location.reload():a.location.reload())},Ob.settingsGet("Version"))},{},36e5)}var yb={},zb={},Ab={},Bb={},Cb={},Db={},Eb={},Fb={settings:[],"settings-removed":[],"settings-disabled":[]},Gb=[],Hb=null,Ib=a.rainloopAppData||{},Jb=a.rainloopI18N||{},Kb=b("html"),Lb=b(a),Mb=b(a.document),Nb=a.Notification&&a.Notification.requestPermission?a.Notification:null,Ob=null,Pb=b("
");Eb.now=(new Date).getTime(),Eb.momentTrigger=c.observable(!0),Eb.dropdownVisibility=c.observable(!1).extend({rateLimit:0}),Eb.langChangeTrigger=c.observable(!0),Eb.iAjaxErrorCount=0,Eb.iTokenErrorCount=0,Eb.iMessageBodyCacheCount=0,Eb.bUnload=!1,Eb.sUserAgent=(navigator.userAgent||"").toLowerCase(),Eb.bIsiOSDevice=-1/g,">").replace(/"/g,""").replace(/'/g,"'"):""},Bb.splitPlainText=function(a,b){var c="",d="",e=a,f=0,g=0;for(b=Bb.isUnd(b)?100:b;e.length>b;)d=e.substring(0,b),f=d.lastIndexOf(" "),g=d.lastIndexOf("\n"),-1!==g&&(f=g),-1===f&&(f=b),c+=d.substring(0,f)+"\n",e=e.substring(f+1);return c+e},Bb.timeOutAction=function(){var b={};return function(c,d,e){Bb.isUnd(b[c])&&(b[c]=0),a.clearTimeout(b[c]),b[c]=a.setTimeout(d,e)}}(),Bb.timeOutActionSecond=function(){var b={};return function(c,d,e){b[c]||(b[c]=a.setTimeout(function(){d(),b[c]=0},e))}}(),Bb.audio=function(){var b=!1;return function(c,d){if(!1===b)if(Eb.bIsiOSDevice)b=null;else{var e=!1,f=!1,g=a.Audio?new a.Audio:null;g&&g.canPlayType&&g.play?(e=""!==g.canPlayType('audio/mpeg; codecs="mp3"'),e||(f=""!==g.canPlayType('audio/ogg; codecs="vorbis"')),e||f?(b=g,b.preload="none",b.loop=!1,b.autoplay=!1,b.muted=!1,b.src=e?c:d):b=null):b=null}return b}}(),Bb.hos=function(a,b){return a&&Object.hasOwnProperty?Object.hasOwnProperty.call(a,b):!1},Bb.i18n=function(a,b,c){var d="",e=Bb.isUnd(Jb[a])?Bb.isUnd(c)?a:c:Jb[a];if(!Bb.isUnd(b)&&!Bb.isNull(b))for(d in b)Bb.hos(b,d)&&(e=e.replace("%"+d+"%",b[d]));return e},Bb.i18nToNode=function(a){h.defer(function(){b(".i18n",a).each(function(){var a=b(this),c="";c=a.data("i18n-text"),c?a.text(Bb.i18n(c)):(c=a.data("i18n-html"),c&&a.html(Bb.i18n(c)),c=a.data("i18n-placeholder"),c&&a.attr("placeholder",Bb.i18n(c)),c=a.data("i18n-title"),c&&a.attr("title",Bb.i18n(c)))})})},Bb.i18nToDoc=function(){a.rainloopI18N&&(Jb=a.rainloopI18N||{},Bb.i18nToNode(Mb),Eb.langChangeTrigger(!Eb.langChangeTrigger())),a.rainloopI18N={}},Bb.initOnStartOrLangChange=function(a,b,c){a&&a.call(b),c?Eb.langChangeTrigger.subscribe(function(){a&&a.call(b),c.call(b)}):a&&Eb.langChangeTrigger.subscribe(a,b)},Bb.inFocus=function(){var a=document.activeElement;return a&&("INPUT"===a.tagName||"TEXTAREA"===a.tagName||"IFRAME"===a.tagName||"DIV"===a.tagName&&"editorHtmlArea"===a.className&&a.contentEditable)},Bb.removeInFocus=function(){if(document&&document.activeElement&&document.activeElement.blur){var a=b(document.activeElement);(a.is("input")||a.is("textarea"))&&document.activeElement.blur()}},Bb.removeSelection=function(){if(a&&a.getSelection){var b=a.getSelection();b&&b.removeAllRanges&&b.removeAllRanges()}else document&&document.selection&&document.selection.empty&&document.selection.empty()},Bb.replySubjectAdd=function(b,c,d){var e=null,f=Bb.trim(c);return f=null===(e=new a.RegExp("^"+b+"[\\s]?\\:(.*)$","gi").exec(c))||Bb.isUnd(e[1])?null===(e=new a.RegExp("^("+b+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$","gi").exec(c))||Bb.isUnd(e[1])||Bb.isUnd(e[2])||Bb.isUnd(e[3])?b+": "+c:e[1]+(Bb.pInt(e[2])+1)+e[3]:b+"[2]: "+e[1],f=f.replace(/[\s]+/g," "),f=(Bb.isUnd(d)?!0:d)?Bb.fixLongSubject(f):f},Bb.fixLongSubject=function(a){var b=0,c=null;a=Bb.trim(a.replace(/[\s]+/," "));do c=/^Re(\[([\d]+)\]|):[\s]{0,3}Re(\[([\d]+)\]|):/gi.exec(a),(!c||Bb.isUnd(c[0]))&&(c=null),c&&(b=0,b+=Bb.isUnd(c[2])?1:0+Bb.pInt(c[2]),b+=Bb.isUnd(c[4])?1:0+Bb.pInt(c[4]),a=a.replace(/^Re(\[[\d]+\]|):[\s]{0,3}Re(\[[\d]+\]|):/gi,"Re"+(b>0?"["+b+"]":"")+":"));while(c);return a=a.replace(/[\s]+/," ")},Bb.roundNumber=function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)},Bb.friendlySize=function(a){return a=Bb.pInt(a),a>=1073741824?Bb.roundNumber(a/1073741824,1)+"GB":a>=1048576?Bb.roundNumber(a/1048576,1)+"MB":a>=1024?Bb.roundNumber(a/1024,0)+"KB":a+"B"},Bb.log=function(b){a.console&&a.console.log&&a.console.log(b)},Bb.getNotification=function(a,b){return a=Bb.pInt(a),zb.Notification.ClientViewError===a&&b?b:Bb.isUnd(Ab[a])?"":Ab[a]},Bb.initNotificationLanguage=function(){Ab[zb.Notification.InvalidToken]=Bb.i18n("NOTIFICATIONS/INVALID_TOKEN"),Ab[zb.Notification.AuthError]=Bb.i18n("NOTIFICATIONS/AUTH_ERROR"),Ab[zb.Notification.AccessError]=Bb.i18n("NOTIFICATIONS/ACCESS_ERROR"),Ab[zb.Notification.ConnectionError]=Bb.i18n("NOTIFICATIONS/CONNECTION_ERROR"),Ab[zb.Notification.CaptchaError]=Bb.i18n("NOTIFICATIONS/CAPTCHA_ERROR"),Ab[zb.Notification.SocialFacebookLoginAccessDisable]=Bb.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE"),Ab[zb.Notification.SocialTwitterLoginAccessDisable]=Bb.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE"),Ab[zb.Notification.SocialGoogleLoginAccessDisable]=Bb.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE"),Ab[zb.Notification.DomainNotAllowed]=Bb.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED"),Ab[zb.Notification.AccountNotAllowed]=Bb.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED"),Ab[zb.Notification.AccountTwoFactorAuthRequired]=Bb.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_REQUIRED"),Ab[zb.Notification.AccountTwoFactorAuthError]=Bb.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_ERROR"),Ab[zb.Notification.CouldNotSaveNewPassword]=Bb.i18n("NOTIFICATIONS/COULD_NOT_SAVE_NEW_PASSWORD"),Ab[zb.Notification.CurrentPasswordIncorrect]=Bb.i18n("NOTIFICATIONS/CURRENT_PASSWORD_INCORRECT"),Ab[zb.Notification.NewPasswordShort]=Bb.i18n("NOTIFICATIONS/NEW_PASSWORD_SHORT"),Ab[zb.Notification.NewPasswordWeak]=Bb.i18n("NOTIFICATIONS/NEW_PASSWORD_WEAK"),Ab[zb.Notification.NewPasswordForbidden]=Bb.i18n("NOTIFICATIONS/NEW_PASSWORD_FORBIDDENT"),Ab[zb.Notification.ContactsSyncError]=Bb.i18n("NOTIFICATIONS/CONTACTS_SYNC_ERROR"),Ab[zb.Notification.CantGetMessageList]=Bb.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST"),Ab[zb.Notification.CantGetMessage]=Bb.i18n("NOTIFICATIONS/CANT_GET_MESSAGE"),Ab[zb.Notification.CantDeleteMessage]=Bb.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE"),Ab[zb.Notification.CantMoveMessage]=Bb.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),Ab[zb.Notification.CantCopyMessage]=Bb.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),Ab[zb.Notification.CantSaveMessage]=Bb.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE"),Ab[zb.Notification.CantSendMessage]=Bb.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE"),Ab[zb.Notification.InvalidRecipients]=Bb.i18n("NOTIFICATIONS/INVALID_RECIPIENTS"),Ab[zb.Notification.CantCreateFolder]=Bb.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"),Ab[zb.Notification.CantRenameFolder]=Bb.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER"),Ab[zb.Notification.CantDeleteFolder]=Bb.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER"),Ab[zb.Notification.CantDeleteNonEmptyFolder]=Bb.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER"),Ab[zb.Notification.CantSubscribeFolder]=Bb.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER"),Ab[zb.Notification.CantUnsubscribeFolder]=Bb.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER"),Ab[zb.Notification.CantSaveSettings]=Bb.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS"),Ab[zb.Notification.CantSavePluginSettings]=Bb.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS"),Ab[zb.Notification.DomainAlreadyExists]=Bb.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS"),Ab[zb.Notification.CantInstallPackage]=Bb.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE"),Ab[zb.Notification.CantDeletePackage]=Bb.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE"),Ab[zb.Notification.InvalidPluginPackage]=Bb.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE"),Ab[zb.Notification.UnsupportedPluginPackage]=Bb.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE"),Ab[zb.Notification.LicensingServerIsUnavailable]=Bb.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE"),Ab[zb.Notification.LicensingExpired]=Bb.i18n("NOTIFICATIONS/LICENSING_EXPIRED"),Ab[zb.Notification.LicensingBanned]=Bb.i18n("NOTIFICATIONS/LICENSING_BANNED"),Ab[zb.Notification.DemoSendMessageError]=Bb.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR"),Ab[zb.Notification.AccountAlreadyExists]=Bb.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS"),Ab[zb.Notification.MailServerError]=Bb.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR"),Ab[zb.Notification.UnknownNotification]=Bb.i18n("NOTIFICATIONS/UNKNOWN_ERROR"),Ab[zb.Notification.UnknownError]=Bb.i18n("NOTIFICATIONS/UNKNOWN_ERROR")},Bb.getUploadErrorDescByCode=function(a){var b="";switch(Bb.pInt(a)){case zb.UploadErrorCode.FileIsTooBig:b=Bb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case zb.UploadErrorCode.FilePartiallyUploaded:b=Bb.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case zb.UploadErrorCode.FileNoUploaded:b=Bb.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case zb.UploadErrorCode.MissingTempFolder:b=Bb.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case zb.UploadErrorCode.FileOnSaveingError:b=Bb.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case zb.UploadErrorCode.FileType:b=Bb.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:b=Bb.i18n("UPLOAD/ERROR_UNKNOWN")}return b},Bb.delegateRun=function(a,b,c,d){a&&a[b]&&(d=Bb.pInt(d),0>=d?a[b].apply(a,Bb.isArray(c)?c:[]):h.delay(function(){a[b].apply(a,Bb.isArray(c)?c:[])},d))},Bb.killCtrlAandS=function(b){if(b=b||a.event,b&&b.ctrlKey&&!b.shiftKey&&!b.altKey){var c=b.target||b.srcElement,d=b.keyCode||b.which;if(d===zb.EventKeyCode.S)return void b.preventDefault();if(c&&c.tagName&&c.tagName.match(/INPUT|TEXTAREA/i))return;d===zb.EventKeyCode.A&&(a.getSelection?a.getSelection().removeAllRanges():a.document.selection&&a.document.selection.clear&&a.document.selection.clear(),b.preventDefault())}},Bb.createCommand=function(a,b,d){var e=b?function(){return e.canExecute&&e.canExecute()&&b.apply(a,Array.prototype.slice.call(arguments)),!1}:function(){};return e.enabled=c.observable(!0),d=Bb.isUnd(d)?!0:d,e.canExecute=c.computed(Bb.isFunc(d)?function(){return e.enabled()&&d.call(a)}:function(){return e.enabled()&&!!d}),e},Bb.initDataConstructorBySettings=function(b){b.editorDefaultType=c.observable(zb.EditorDefaultType.Html),b.showImages=c.observable(!1),b.interfaceAnimation=c.observable(zb.InterfaceAnimation.Full),b.contactsAutosave=c.observable(!1),Eb.sAnimationType=zb.InterfaceAnimation.Full,b.allowThemes=c.observable(!0),b.allowCustomLogin=c.observable(!1),b.allowLanguagesOnSettings=c.observable(!0),b.allowLanguagesOnLogin=c.observable(!0),b.desktopNotifications=c.observable(!1),b.useThreads=c.observable(!0),b.replySameFolder=c.observable(!0),b.useCheckboxesInList=c.observable(!0),b.layout=c.observable(zb.Layout.SidePreview),b.usePreviewPane=c.computed(function(){return zb.Layout.NoPreview!==b.layout()}),b.interfaceAnimation.subscribe(function(a){if(Eb.bMobileDevice||a===zb.InterfaceAnimation.None)Kb.removeClass("rl-anim rl-anim-full").addClass("no-rl-anim"),Eb.sAnimationType=zb.InterfaceAnimation.None;else switch(a){case zb.InterfaceAnimation.Full:Kb.removeClass("no-rl-anim").addClass("rl-anim rl-anim-full"),Eb.sAnimationType=a;break;case zb.InterfaceAnimation.Normal:Kb.removeClass("no-rl-anim rl-anim-full").addClass("rl-anim"),Eb.sAnimationType=a}}),b.interfaceAnimation.valueHasMutated(),b.desktopNotificationsPermisions=c.computed(function(){b.desktopNotifications();var c=zb.DesktopNotifications.NotSupported;if(Nb&&Nb.permission)switch(Nb.permission.toLowerCase()){case"granted":c=zb.DesktopNotifications.Allowed;break;case"denied":c=zb.DesktopNotifications.Denied;break;case"default":c=zb.DesktopNotifications.NotAllowed}else a.webkitNotifications&&a.webkitNotifications.checkPermission&&(c=a.webkitNotifications.checkPermission());return c}),b.useDesktopNotifications=c.computed({read:function(){return b.desktopNotifications()&&zb.DesktopNotifications.Allowed===b.desktopNotificationsPermisions()},write:function(a){if(a){var c=b.desktopNotificationsPermisions();zb.DesktopNotifications.Allowed===c?b.desktopNotifications(!0):zb.DesktopNotifications.NotAllowed===c?Nb.requestPermission(function(){b.desktopNotifications.valueHasMutated(),zb.DesktopNotifications.Allowed===b.desktopNotificationsPermisions()?b.desktopNotifications()?b.desktopNotifications.valueHasMutated():b.desktopNotifications(!0):b.desktopNotifications()?b.desktopNotifications(!1):b.desktopNotifications.valueHasMutated()}):b.desktopNotifications(!1)}else b.desktopNotifications(!1)}}),b.language=c.observable(""),b.languages=c.observableArray([]),b.mainLanguage=c.computed({read:b.language,write:function(a){a!==b.language()?-1=b.diff(c,"hours")?d:b.format("L")===c.format("L")?Bb.i18n("MESSAGE_LIST/TODAY_AT",{TIME:c.format("LT")}):b.clone().subtract("days",1).format("L")===c.format("L")?Bb.i18n("MESSAGE_LIST/YESTERDAY_AT",{TIME:c.format("LT")}):c.format(b.year()===c.year()?"D MMM.":"LL")},a)},Bb.isFolderExpanded=function(a){var b=Ob.local().get(zb.ClientSideKeyName.ExpandedFolders);return h.isArray(b)&&-1!==h.indexOf(b,a)},Bb.setExpandedFolder=function(a,b){var c=Ob.local().get(zb.ClientSideKeyName.ExpandedFolders);h.isArray(c)||(c=[]),b?(c.push(a),c=h.uniq(c)):c=h.without(c,a),Ob.local().set(zb.ClientSideKeyName.ExpandedFolders,c)},Bb.initLayoutResizer=function(a,c,d){var e=b(a),f=b(c),g=Ob.local().get(d)||null,h=function(a,b){b&&b.size&&b.size.width&&(Ob.local().set(d,b.size.width),f.css({left:""+b.size.width+"px"}))};null!==g&&(e.css({width:""+g+"px"}),f.css({left:""+g+"px"})),e.resizable({helper:"ui-resizable-helper",minWidth:120,maxWidth:400,handles:"e",stop:h})},Bb.initBlockquoteSwitcher=function(a){if(a){var c=b("blockquote:not(.rl-bq-switcher)",a).filter(function(){return 0===b(this).parent().closest("blockquote",a).length});c&&0100)&&(a.addClass("rl-bq-switcher hidden-bq"),b('').insertBefore(a).click(function(){a.toggleClass("hidden-bq"),Bb.windowResize()}).after("
").before("
"))})}},Bb.removeBlockquoteSwitcher=function(a){a&&(b(a).find("blockquote.rl-bq-switcher").each(function(){b(this).removeClass("rl-bq-switcher hidden-bq")}),b(a).find(".rlBlockquoteSwitcher").each(function(){b(this).remove()}))},Bb.toggleMessageBlockquote=function(a){a&&a.find(".rlBlockquoteSwitcher").click()},Bb.extendAsViewModel=function(a,b,c){b&&(c||(c=r),b.__name=a,Cb.regViewModelHook(a,b),h.extend(b.prototype,c.prototype))},Bb.addSettingsViewModel=function(a,b,c,d,e){a.__rlSettingsData={Label:c,Template:b,Route:d,IsDefault:!!e},Fb.settings.push(a)},Bb.removeSettingsViewModel=function(a){Fb["settings-removed"].push(a)},Bb.disableSettingsViewModel=function(a){Fb["settings-disabled"].push(a)},Bb.convertThemeName=function(a){return Bb.trim(a.replace(/[^a-zA-Z]/g," ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))},Bb.quoteName=function(a){return a.replace(/["]/g,'\\"')},Bb.microtime=function(){return(new Date).getTime()},Bb.convertLangName=function(a,b){return Bb.i18n("LANGS_NAMES"+(!0===b?"_EN":"")+"/LANG_"+a.toUpperCase().replace(/[^a-zA-Z0-9]+/,"_"),null,a)},Bb.fakeMd5=function(a){var b="",c="0123456789abcdefghijklmnopqrstuvwxyz";for(a=Bb.isUnd(a)?32:Bb.pInt(a);b.length>>32-b}function c(a,b){var c,d,e,f,g;return e=2147483648&a,f=2147483648&b,c=1073741824&a,d=1073741824&b,g=(1073741823&a)+(1073741823&b),c&d?2147483648^g^e^f:c|d?1073741824&g?3221225472^g^e^f:1073741824^g^e^f:g^e^f}function d(a,b,c){return a&b|~a&c}function e(a,b,c){return a&c|b&~c}function f(a,b,c){return a^b^c}function g(a,b,c){return b^(a|~c)}function h(a,e,f,g,h,i,j){return a=c(a,c(c(d(e,f,g),h),j)),c(b(a,i),e)}function i(a,d,f,g,h,i,j){return a=c(a,c(c(e(d,f,g),h),j)),c(b(a,i),d)}function j(a,d,e,g,h,i,j){return a=c(a,c(c(f(d,e,g),h),j)),c(b(a,i),d)}function k(a,d,e,f,h,i,j){return a=c(a,c(c(g(d,e,f),h),j)),c(b(a,i),d)}function l(a){for(var b,c=a.length,d=c+8,e=(d-d%64)/64,f=16*(e+1),g=Array(f-1),h=0,i=0;c>i;)b=(i-i%4)/4,h=i%4*8,g[b]=g[b]|a.charCodeAt(i)<>>29,g}function m(a){var b,c,d="",e="";for(c=0;3>=c;c++)b=a>>>8*c&255,e="0"+b.toString(16),d+=e.substr(e.length-2,2);return d}function n(a){a=a.replace(/rn/g,"n");for(var b="",c=0;cd?b+=String.fromCharCode(d):d>127&&2048>d?(b+=String.fromCharCode(d>>6|192),b+=String.fromCharCode(63&d|128)):(b+=String.fromCharCode(d>>12|224),b+=String.fromCharCode(d>>6&63|128),b+=String.fromCharCode(63&d|128))}return b}var o,p,q,r,s,t,u,v,w,x=Array(),y=7,z=12,A=17,B=22,C=5,D=9,E=14,F=20,G=4,H=11,I=16,J=23,K=6,L=10,M=15,N=21;for(a=n(a),x=l(a),t=1732584193,u=4023233417,v=2562383102,w=271733878,o=0;o/g,">").replace(/")},Bb.draggeblePlace=function(){return b('
 
').appendTo("#rl-hidden")},Bb.defautOptionsAfterRender=function(a,c){c&&!Bb.isUnd(c.disabled)&&a&&b(a).toggleClass("disabled",c.disabled).prop("disabled",c.disabled)},Bb.windowPopupKnockout=function(c,d,e,f){var g=null,h=a.open(""),i="__OpenerApplyBindingsUid"+Bb.fakeMd5()+"__",j=b("#"+d);a[i]=function(){if(h&&h.document.body&&j&&j[0]){var d=b(h.document.body);b("#rl-content",d).html(j.html()),b("html",h.document).addClass("external "+b("html").attr("class")),Bb.i18nToNode(d),t.prototype.applyExternal(c,b("#rl-content",d)[0]),a[i]=null,f(h)}},h.document.open(),h.document.write(''+Bb.encodeHtml(e)+'
'),h.document.close(),g=h.document.createElement("script"),g.type="text/javascript",g.innerHTML="if(window&&window.opener&&window.opener['"+i+"']){window.opener['"+i+"']();window.opener['"+i+"']=null}",h.document.getElementsByTagName("head")[0].appendChild(g)},Bb.settingsSaveHelperFunction=function(a,b,c,d){return c=c||null,d=Bb.isUnd(d)?1e3:Bb.pInt(d),function(e,f,g,i,j){b.call(c,f&&f.Result?zb.SaveSettingsStep.TrueResult:zb.SaveSettingsStep.FalseResult),a&&a.call(c,e,f,g,i,j),h.delay(function(){b.call(c,zb.SaveSettingsStep.Idle)},d)}},Bb.settingsSaveHelperSimpleFunction=function(a,b){return Bb.settingsSaveHelperFunction(null,a,b,1e3)},Bb.htmlToPlain=function(a){var c="",d="> ",e=function(){if(arguments&&1\n",a.replace(/\n([> ]+)/gm,function(){return arguments&&1]*>(.|[\s\S\r\n]*)<\/div>/gim,f),a="\n"+b.trim(a)+"\n"),a}return""},g=function(){return arguments&&1/g,">"):""},h=function(){if(arguments&&1/gim,"\n").replace(/<\/h\d>/gi,"\n").replace(/<\/p>/gi,"\n\n").replace(/<\/li>/gi,"\n").replace(/<\/td>/gi,"\n").replace(/<\/tr>/gi,"\n").replace(/]*>/gim,"\n_______________________________\n\n").replace(/]*>/gim,"").replace(/]*>(.|[\s\S\r\n]*)<\/div>/gim,f).replace(/]*>/gim,"\n__bq__start__\n").replace(/<\/blockquote>/gim,"\n__bq__end__\n").replace(/]*>(.|[\s\S\r\n]*)<\/a>/gim,h).replace(/ /gi," ").replace(/<[^>]*>/gm,"").replace(/>/gi,">").replace(/</gi,"<").replace(/&/gi,"&").replace(/&\w{2,6};/gi,""),c.replace(/\n[ \t]+/gm,"\n").replace(/[\n]{3,}/gm,"\n\n").replace(/__bq__start__(.|[\s\S\r\n]*)__bq__end__/gm,e).replace(/__bq__start__/gm,"").replace(/__bq__end__/gm,"")},Bb.plainToHtml=function(a){return a.toString().replace(/&/g,"&").replace(/>/g,">").replace(/")},Bb.resizeAndCrop=function(b,c,d){var e=new a.Image;e.onload=function(){var a=[0,0],b=document.createElement("canvas"),e=b.getContext("2d");b.width=c,b.height=c,a=this.width>this.height?[this.width-this.height,0]:[0,this.height-this.width],e.fillStyle="#fff",e.fillRect(0,0,c,c),e.drawImage(this,a[0]/2,a[1]/2,this.width-a[0],this.height-a[1],0,0,c,c),d(b.toDataURL("image/jpeg"))},e.src=b},Bb.computedPagenatorHelper=function(a,b){return function(){var c=0,d=0,e=2,f=[],g=a(),h=b(),i=function(a,b,c){var d={current:a===g,name:Bb.isUnd(c)?a.toString():c.toString(),custom:Bb.isUnd(c)?!1:!0,title:Bb.isUnd(c)?"":a.toString(),value:a.toString()};(Bb.isUnd(b)?0:!b)?f.unshift(d):f.push(d)};if(h>1||h>0&&g>h){for(g>h?(i(h),c=h,d=h):((3>=g||g>=h-2)&&(e+=2),i(g),c=g,d=g);e>0;)if(c-=1,d+=1,c>0&&(i(c,!1),e--),h>=d)i(d,!0),e--;else if(0>=c)break;3===c?i(2,!1):c>3&&i(Math.round((c-1)/2),!1,"..."),h-2===d?i(h-1,!0):h-2>d&&i(Math.round((h+d)/2),!0,"..."),c>1&&i(1,!1),h>d&&i(h,!0)}return f}},Bb.selectElement=function(b){if(a.getSelection){var c=a.getSelection();c.removeAllRanges();var d=document.createRange();d.selectNodeContents(b),c.addRange(d)}else if(document.selection){var e=document.body.createTextRange();e.moveToElementText(b),e.select()}},Bb.disableKeyFilter=function(){a.key&&(j.filter=function(){return Ob.data().useKeyboardShortcuts()})},Bb.restoreKeyFilter=function(){a.key&&(j.filter=function(a){if(Ob.data().useKeyboardShortcuts()){var b=a.target||a.srcElement,c=b?b.tagName:"";return c=c.toUpperCase(),!("INPUT"===c||"SELECT"===c||"TEXTAREA"===c||b&&"DIV"===c&&"editorHtmlArea"===b.className&&b.contentEditable)}return!1})},Bb.detectDropdownVisibility=h.debounce(function(){Eb.dropdownVisibility(!!h.find(Gb,function(a){return a.hasClass("open")}))},50),Db={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",urlsafe_encode:function(a){return Db.encode(a).replace(/[+]/g,"-").replace(/[\/]/g,"_").replace(/[=]/g,".")},encode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=Db._utf8_encode(a);j>2,f=(3&b)<<4|c>>4,g=(15&c)<<2|d>>6,h=63&d,isNaN(c)?g=h=64:isNaN(d)&&(h=64),i=i+this._keyStr.charAt(e)+this._keyStr.charAt(f)+this._keyStr.charAt(g)+this._keyStr.charAt(h);return i},decode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");j>4,c=(15&f)<<4|g>>2,d=(3&g)<<6|h,i+=String.fromCharCode(b),64!==g&&(i+=String.fromCharCode(c)),64!==h&&(i+=String.fromCharCode(d));return Db._utf8_decode(i)},_utf8_encode:function(a){a=a.replace(/\r\n/g,"\n");for(var b="",c=0,d=a.length,e=0;d>c;c++)e=a.charCodeAt(c),128>e?b+=String.fromCharCode(e):e>127&&2048>e?(b+=String.fromCharCode(e>>6|192),b+=String.fromCharCode(63&e|128)):(b+=String.fromCharCode(e>>12|224),b+=String.fromCharCode(e>>6&63|128),b+=String.fromCharCode(63&e|128));return b},_utf8_decode:function(a){for(var b="",c=0,d=0,e=0,f=0;cd?(b+=String.fromCharCode(d),c++):d>191&&224>d?(e=a.charCodeAt(c+1),b+=String.fromCharCode((31&d)<<6|63&e),c+=2):(e=a.charCodeAt(c+1),f=a.charCodeAt(c+2),b+=String.fromCharCode((15&d)<<12|(63&e)<<6|63&f),c+=3);return b}},c.bindingHandlers.tooltip={init:function(a,d){if(!Eb.bMobileDevice){var e=b(a),f=e.data("tooltip-class")||"",g=e.data("tooltip-placement")||"top";e.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:g,trigger:"hover",title:function(){return e.is(".disabled")||Eb.dropdownVisibility()?"":''+Bb.i18n(c.utils.unwrapObservable(d()))+""}}).click(function(){e.tooltip("hide")}),Eb.dropdownVisibility.subscribe(function(a){a&&e.tooltip("hide")})}}},c.bindingHandlers.tooltip2={init:function(a,c){var d=b(a),e=d.data("tooltip-class")||"",f=d.data("tooltip-placement")||"top";d.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:f,title:function(){return d.is(".disabled")||Eb.dropdownVisibility()?"":''+c()()+""}}).click(function(){d.tooltip("hide")}),Eb.dropdownVisibility.subscribe(function(a){a&&d.tooltip("hide")})}},c.bindingHandlers.registrateBootstrapDropdown={init:function(a){Gb.push(b(a))}},c.bindingHandlers.openDropdownTrigger={update:function(a,d){if(c.utils.unwrapObservable(d())){var e=b(a);e.hasClass("open")||(e.find(".dropdown-toggle").dropdown("toggle"),Bb.detectDropdownVisibility()),d()(!1)}}},c.bindingHandlers.dropdownCloser={init:function(a){b(a).closest(".dropdown").on("click",".e-item",function(){b(a).dropdown("toggle")})}},c.bindingHandlers.popover={init:function(a,d){b(a).popover(c.utils.unwrapObservable(d()))}},c.bindingHandlers.csstext={init:function(a,d){a&&a.styleSheet&&!Bb.isUnd(a.styleSheet.cssText)?a.styleSheet.cssText=c.utils.unwrapObservable(d()):b(a).text(c.utils.unwrapObservable(d()))},update:function(a,d){a&&a.styleSheet&&!Bb.isUnd(a.styleSheet.cssText)?a.styleSheet.cssText=c.utils.unwrapObservable(d()):b(a).text(c.utils.unwrapObservable(d()))}},c.bindingHandlers.resizecrop={init:function(a){b(a).addClass("resizecrop").resizecrop({width:"100",height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(a,c){c()(),b(a).resizecrop({width:"100",height:"100"})}},c.bindingHandlers.onEnter={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&13===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.onEsc={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&27===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.clickOnTrue={update:function(a,d){c.utils.unwrapObservable(d())&&b(a).click()}},c.bindingHandlers.modal={init:function(a,d){b(a).toggleClass("fade",!Eb.bMobileDevice).modal({keyboard:!1,show:c.utils.unwrapObservable(d())}).on("shown",function(){Bb.windowResize()}).find(".close").click(function(){d()(!1)})},update:function(a,d){b(a).modal(c.utils.unwrapObservable(d())?"show":"hide")}},c.bindingHandlers.i18nInit={init:function(a){Bb.i18nToNode(a)}},c.bindingHandlers.i18nUpdate={update:function(a,b){c.utils.unwrapObservable(b()),Bb.i18nToNode(a)}},c.bindingHandlers.link={update:function(a,d){b(a).attr("href",c.utils.unwrapObservable(d()))}},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=Bb.pInt(e[1]),g=0,h=b(a).offset().top;h>0&&(h+=Bb.pInt(e[2]),g=Lb.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(!Eb.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),Bb.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),Bb.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(){Bb.removeInFocus()})}}},c.bindingHandlers.droppable={init:function(a,c,d){if(!Eb.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){Eb.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){Ob.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=Bb.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(Bb.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},Bb.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=Bb.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=Bb.trim(a),this.hasError(""!==a&&!/^.+@.+$/.test(a))},this),this.valueHasMutated(),this},c.observable.fn.validateFunc=function(a){return this.hasFuncError=c.observable(!1),Bb.isFunc(a)&&(this.subscribe(function(b){this.hasFuncError(!a(b))},this),this.valueHasMutated()),this},k.prototype.root=function(){return this.sBase},k.prototype.attachmentDownload=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},k.prototype.attachmentPreview=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/View/"+a},k.prototype.attachmentPreviewAsPlain=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},k.prototype.upload=function(){return this.sServer+"/Upload/"+this.sSpecSuffix+"/"},k.prototype.uploadContacts=function(){return this.sServer+"/UploadContacts/"+this.sSpecSuffix+"/"},k.prototype.uploadBackground=function(){return this.sServer+"/UploadBackground/"+this.sSpecSuffix+"/"},k.prototype.append=function(){return this.sServer+"/Append/"+this.sSpecSuffix+"/"},k.prototype.change=function(b){return this.sServer+"/Change/"+this.sSpecSuffix+"/"+a.encodeURIComponent(b)+"/"},k.prototype.ajax=function(a){return this.sServer+"/Ajax/"+this.sSpecSuffix+"/"+a},k.prototype.messageViewLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},k.prototype.messageDownloadLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},k.prototype.inbox=function(){return this.sBase+"mailbox/Inbox"},k.prototype.messagePreview=function(){return this.sBase+"mailbox/message-preview"},k.prototype.settings=function(a){var b=this.sBase+"settings";return Bb.isUnd(a)||""===a||(b+="/"+a),b},k.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},k.prototype.mailBox=function(a,b,c){b=Bb.isNormal(b)?Bb.pInt(b):1,c=Bb.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},k.prototype.phpInfo=function(){return this.sServer+"Info"},k.prototype.langLink=function(a){return this.sServer+"/Lang/0/"+encodeURI(a)+"/"+this.sVersion+"/"},k.prototype.getUserPicUrlFromHash=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/UserPic/"+a+"/"+this.sVersion+"/"},k.prototype.emptyContactPic=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/empty-contact.png"},k.prototype.sound=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/sounds/"+a},k.prototype.themePreviewLink=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/themes/"+encodeURI(a)+"/images/preview.png"},k.prototype.notificationMailIcon=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/icom-message-notification.png"},k.prototype.openPgpJs=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/js/openpgp.min.js"},k.prototype.socialGoogle=function(){return this.sServer+"SocialGoogle"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},k.prototype.socialTwitter=function(){return this.sServer+"SocialTwitter"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},k.prototype.socialFacebook=function(){return this.sServer+"SocialFacebook"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},Cb.oViewModelsHooks={},Cb.oSimpleHooks={},Cb.regViewModelHook=function(a,b){b&&(b.__hookName=a)},Cb.addHook=function(a,b){Bb.isFunc(b)&&(Bb.isArray(Cb.oSimpleHooks[a])||(Cb.oSimpleHooks[a]=[]),Cb.oSimpleHooks[a].push(b))},Cb.runHook=function(a,b){Bb.isArray(Cb.oSimpleHooks[a])&&(b=b||[],h.each(Cb.oSimpleHooks[a],function(a){a.apply(null,b)}))},Cb.mainSettingsGet=function(a){return Ob?Ob.settingsGet(a):null},Cb.remoteRequest=function(a,b,c,d,e,f){Ob&&Ob.remote().defaultRequest(a,b,c,d,e,f)},Cb.settingsGet=function(a,b){var c=Cb.mainSettingsGet("Plugins");return c=c&&Bb.isUnd(c[a])?null:c[a],c?Bb.isUnd(c[b])?null:c[b]:null},l.prototype.blurTrigger=function(){if(this.fOnBlur){var b=this;a.clearTimeout(b.iBlurTimer),b.iBlurTimer=a.setTimeout(function(){b.fOnBlur()},200)}},l.prototype.focusTrigger=function(){this.fOnBlur&&a.clearTimeout(this.iBlurTimer)},l.prototype.isHtml=function(){return this.editor?"wysiwyg"===this.editor.mode:!1},l.prototype.checkDirty=function(){return this.editor?this.editor.checkDirty():!1},l.prototype.resetDirty=function(){this.editor&&this.editor.resetDirty()},l.prototype.getData=function(){return this.editor?"plain"===this.editor.mode&&this.editor.plugins.plain&&this.editor.__plain?this.editor.__plain.getRawData():this.editor.getData():""},l.prototype.modeToggle=function(a){this.editor&&(a?"plain"===this.editor.mode&&this.editor.setMode("wysiwyg"):"wysiwyg"===this.editor.mode&&this.editor.setMode("plain"))},l.prototype.setHtml=function(a,b){this.editor&&(this.modeToggle(!0),this.editor.setData(a),b&&this.focus())},l.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()}},l.prototype.init=function(){if(this.$element&&this.$element[0]){var b=this,c=Eb.oHtmlEditorDefaultConfig,d=Ob.settingsGet("Language"),e=!!Ob.settingsGet("AllowHtmlEditorSourceButton");e&&c.toolbarGroups&&!c.toolbarGroups.__SourceInited&&(c.toolbarGroups.__SourceInited=!0,c.toolbarGroups.push({name:"document",groups:["mode","document","doctools"]})),c.language=Eb.oHtmlEditorLangsMap[d]||"en",b.editor=a.CKEDITOR.appendTo(b.$element[0],c),b.editor.on("key",function(a){return a&&a.data&&9===a.data.keyCode?!1:void 0}),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()})}},l.prototype.focus=function(){this.editor&&this.editor.focus()},l.prototype.blur=function(){this.editor&&this.editor.focusManager.blur(!0)},l.prototype.resize=function(){this.editor&&this.__resizable&&this.editor.resize(this.$element.width(),this.$element.innerHeight())},l.prototype.clear=function(a){this.setHtml("",a)},m.prototype.itemSelected=function(a){this.isListChecked()?a||(this.oCallbacks.onItemSelect||this.emptyFunction)(a||null):a&&(this.oCallbacks.onItemSelect||this.emptyFunction)(a)},m.prototype.goDown=function(a){this.newSelectPosition(zb.EventKeyCode.Down,!1,a)},m.prototype.goUp=function(a){this.newSelectPosition(zb.EventKeyCode.Up,!1,a)},m.prototype.init=function(a,d,e){if(this.oContentVisible=a,this.oContentScrollable=d,e=e||"all",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.focusedItem(b),b.checked(!b.checked())))}),j("enter",e,function(){return f.focusedItem()&&f.actionClick(f.focusedItem()),!1}),j("ctrl+up, command+up, ctrl+down, command+down",e,function(){return!1}),j("up, shift+up, down, shift+down, home, end, pageup, pagedown, insert, space",e,function(a,b){if(a&&b&&b.shortcut){var c=0;switch(b.shortcut){case"up":case"shift+up":c=zb.EventKeyCode.Up;break;case"down":case"shift+down":c=zb.EventKeyCode.Down;break;case"insert":c=zb.EventKeyCode.Insert;break;case"space":c=zb.EventKeyCode.Space;break;case"home":c=zb.EventKeyCode.Home;break;case"end":c=zb.EventKeyCode.End;break;case"pageup":c=zb.EventKeyCode.PageUp;break;case"pagedown":c=zb.EventKeyCode.PageDown}if(c>0)return f.newSelectPosition(c,j.shift),!1}})}},m.prototype.autoSelect=function(a){this.bAutoSelect=!!a},m.prototype.getItemUid=function(a){var b="",c=this.oCallbacks.onItemGetUid||null;return c&&a&&(b=c(a)),b.toString()},m.prototype.newSelectPosition=function(a,b,c){var d=0,e=10,f=!1,g=!1,i=null,j=this.list(),k=j?j.length:0,l=this.focusedItem();if(k>0)if(l){if(l)if(zb.EventKeyCode.Down===a||zb.EventKeyCode.Up===a||zb.EventKeyCode.Insert===a||zb.EventKeyCode.Space===a)h.each(j,function(b){if(!g)switch(a){case zb.EventKeyCode.Up:l===b?g=!0:i=b;break;case zb.EventKeyCode.Down:case zb.EventKeyCode.Insert:f?(i=b,g=!0):l===b&&(f=!0)}});else if(zb.EventKeyCode.Home===a||zb.EventKeyCode.End===a)zb.EventKeyCode.Home===a?i=j[0]:zb.EventKeyCode.End===a&&(i=j[j.length-1]);else if(zb.EventKeyCode.PageDown===a){for(;k>d;d++)if(l===j[d]){d+=e,d=d>k-1?k-1:d,i=j[d];break}}else if(zb.EventKeyCode.PageUp===a)for(d=k;d>=0;d--)if(l===j[d]){d-=e,d=0>d?0:d,i=j[d];break}}else zb.EventKeyCode.Down===a||zb.EventKeyCode.Insert===a||zb.EventKeyCode.Space===a||zb.EventKeyCode.Home===a||zb.EventKeyCode.PageUp===a?i=j[0]:(zb.EventKeyCode.Up===a||zb.EventKeyCode.End===a||zb.EventKeyCode.PageDown===a)&&(i=j[j.length-1]);i?(this.focusedItem(i),l&&(b?(zb.EventKeyCode.Up===a||zb.EventKeyCode.Down===a)&&l.checked(!l.checked()):(zb.EventKeyCode.Insert===a||zb.EventKeyCode.Space===a)&&l.checked(!l.checked())),!this.bAutoSelect&&!c||this.isListChecked()||zb.EventKeyCode.Space===a||this.selectedItem(i),this.scrollToFocused()):l&&(!b||zb.EventKeyCode.Up!==a&&zb.EventKeyCode.Down!==a?(zb.EventKeyCode.Insert===a||zb.EventKeyCode.Space===a)&&l.checked(!l.checked()):l.checked(!l.checked()),this.focusedItem(l))},m.prototype.scrollToFocused=function(){if(!this.oContentVisible||!this.oContentScrollable)return!1;var a=20,c=b(this.sItemFocusedSelector,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},m.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},m.prototype.actionClick=function(a,b){if(a){var c=!0,d=this.getItemUid(a);b&&(!b.shiftKey||b.ctrlKey||b.altKey?!b.ctrlKey||b.shiftKey||b.altKey||(c=!1,this.focusedItem(a),this.selectedItem()&&a!==this.selectedItem()&&this.selectedItem().checked(!0),a.checked(!a.checked())):(c=!1,""===this.sLastUid&&(this.sLastUid=d),a.checked(!a.checked()),this.eventClickFunction(a,b),this.focusedItem(a))),c&&(this.focusedItem(a),this.selectedItem(a))}},m.prototype.on=function(a,b){this.oCallbacks[a]=b},n.supported=function(){return!0},n.prototype.set=function(a,c){var d=b.cookie(yb.Values.ClientSideCookieIndexName),e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[a]=c,b.cookie(yb.Values.ClientSideCookieIndexName,JSON.stringify(f),{expires:30}),e=!0}catch(g){}return e},n.prototype.get=function(a){var c=b.cookie(yb.Values.ClientSideCookieIndexName),d=null;try{d=null===c?null:JSON.parse(c),d=d&&!Bb.isUnd(d[a])?d[a]:null}catch(e){}return d},o.supported=function(){return!!a.localStorage},o.prototype.set=function(b,c){var d=a.localStorage[yb.Values.ClientSideCookieIndexName]||null,e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[b]=c,a.localStorage[yb.Values.ClientSideCookieIndexName]=JSON.stringify(f),e=!0}catch(g){}return e},o.prototype.get=function(b){var c=a.localStorage[yb.Values.ClientSideCookieIndexName]||null,d=null;try{d=null===c?null:JSON.parse(c),d=d&&!Bb.isUnd(d[b])?d[b]:null}catch(e){}return d},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.storeAndSetKeyScope=function(){this.sCurrentKeyScope=Ob.data().keyScope(),Ob.data().keyScope(this.sDefaultKeyScope)},r.prototype.restoreKeyScope=function(){Ob.data().keyScope(this.sCurrentKeyScope)},r.prototype.registerPopupEscapeKey=function(){var a=this;Lb.on("keydown",function(b){return b&&zb.EventKeyCode.Esc===b.keyCode&&a.modalVisibility&&a.modalVisibility()?(Bb.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;Bb.isNonEmptyArray(a)&&(c=h.bind(this.onRoute||Bb.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){Bb.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 Bb.isNormal(a)&&(this.oBoot=a),this},t.prototype.screen=function(a){return""===a||Bb.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()),i=null;a.__builded=!0,a.__vm=e,e.data=Ob.data(),e.viewModelName=a.__name,g&&1===g.length?(i=b("
").addClass("rl-view-model").addClass("RL-"+e.viewModelTemplate()).hide().attr("data-bind",'template: {name: "'+e.viewModelTemplate()+'"}, i18nInit: true'),i.appendTo(g),e.viewModelDom=i,a.__dom=i,"Popups"===f&&(e.cancelCommand=e.closeCommand=Bb.createCommand(e,function(){Hb.hideScreenPopup(a)}),e.modalVisibility.subscribe(function(a){var b=this;a?(this.viewModelDom.show(),this.storeAndSetKeyScope(),Ob.popupVisibilityNames.push(this.viewModelName),Bb.delegateRun(this,"onFocus",[],500)):(Bb.delegateRun(this,"onHide"),this.restoreKeyScope(),Ob.popupVisibilityNames.remove(this.viewModelName),h.delay(function(){b.viewModelDom.hide()},300))},e)),Cb.runHook("view-model-pre-build",[a.__name,e,i]),c.applyBindings(e,i[0]),Bb.delegateRun(e,"onBuild",[i]),e&&"Popups"===f&&!e.bDisabeCloseOnEsc&&e.registerPopupEscapeKey(),Cb.runHook("view-model-post-build",[a.__name,e,i])):Bb.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),Cb.runHook("view-model-on-hide",[a.__name,a.__vm]))},t.prototype.showScreenPopup=function(a,b){a&&(this.buildViewModel(a),a.__vm&&a.__dom&&(a.__vm.modalVisibility(!0),Bb.delegateRun(a.__vm,"onShow",b||[]),Cb.runHook("view-model-on-show",[a.__name,a.__vm,b||[]])))},t.prototype.screenOnRoute=function(a,b){var c=this,d=null,e=null;""===Bb.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,Bb.isNonEmptyArray(d.viewModels())&&h.each(d.viewModels(),function(a){this.buildViewModel(a,d)},this),Bb.delegateRun(d,"onBuild")),h.defer(function(){c.oCurrentScreen&&(Bb.delegateRun(c.oCurrentScreen,"onHide"),Bb.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),Bb.delegateRun(a.__vm,"onHide"))})),c.oCurrentScreen=d,c.oCurrentScreen&&(Bb.delegateRun(c.oCurrentScreen,"onShow"),Cb.runHook("screen-on-show",[c.oCurrentScreen.screenName(),c.oCurrentScreen]),Bb.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),Bb.delegateRun(a.__vm,"onShow"),Bb.delegateRun(a.__vm,"onFocus",[],200),Cb.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(),Cb.runHook("screen-pre-start",[a.screenName(),a]),Bb.delegateRun(a,"onStart"),Cb.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(){Kb.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=Bb.isUnd(c)?!1:!!c,(Bb.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},Hb=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=zb.EmailType.Facebook),null===this.privateType&&(this.privateType=zb.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=Bb.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=Bb.trim(a.Name),this.email=Bb.trim(a.Email),b=""!==this.email,this.clearDuplicateName()),b},u.prototype.toLine=function(a,b,c){var d="";return""!==this.email&&(b=Bb.isUnd(b)?!1:!!b,c=Bb.isUnd(c)?!1:!!c,a&&""!==this.name?d=b?'")+'" target="_blank" tabindex="-1">'+Bb.encodeHtml(this.name)+"":c?Bb.encodeHtml(this.name):this.name:(d=this.email,""!==this.name?b?d=Bb.encodeHtml('"'+this.name+'" <')+'")+'" target="_blank" tabindex="-1">'+Bb.encodeHtml(d)+""+Bb.encodeHtml(">"):(d='"'+this.name+'" <'+d+">",c&&(d=Bb.encodeHtml(d))):b&&(d=''+Bb.encodeHtml(this.email)+""))),d},u.prototype.mailsoParse=function(a){if(a=Bb.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=Bb.trim(e).replace(/^[<]+/,"").replace(/[>]+$/,""),d=Bb.trim(d).replace(/^["']+/,"").replace(/["']+$/,""),f=Bb.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(Bb.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++)Bb.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(zb.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(zb.SignedVerifyStatus.None),this.pgpSignedVerifyUser(""),this.priority(zb.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=Ob.data().sentFolder(),b=Ob.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(Bb.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(Bb.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(Bb.pInt(a.ParentThread)),this.threads(Bb.isArray(a.Threads)?a.Threads:[]),this.threadsLen(Bb.pInt(a.ThreadsLen)),this.initFlagsByJson(a),this.computeSenderEmail(),b=!0),b},z.prototype.initUpdateByMessageJson=function(a){var b=!1,c=zb.MessagePriority.Normal;return a&&"Object/Message"===a["@Object"]&&(c=Bb.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 Bb.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 Bb.isArray(this.from)&&this.from[0]?this.from[0].email:""},z.prototype.viewLink=function(){return Ob.link().messageViewLink(this.requestHash)},z.prototype.downloadLink=function(){return Ob.link().messageDownloadLink(this.requestHash)},z.prototype.replyEmails=function(a){var b=[],c=Bb.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=Bb.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(zb.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=Bb.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=Bb.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]}),Lb.resize()),Bb.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=Bb.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=Bb.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]),Bb.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),Ob.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&&Ob.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=Bb.pString(this.body.data("rl-plain-raw")),Ob.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(zb.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=Ob.data().findPublicKeysByEmail(e),g=null,i=null,j="";this.pgpSignedVerifyStatus(zb.SignedVerifyStatus.Error),this.pgpSignedVerifyUser("");try{d=a.openpgp.cleartext.readArmored(this.plainRaw),d&&d.getText&&(this.pgpSignedVerifyStatus(f.length?zb.SignedVerifyStatus.Unverified:zb.SignedVerifyStatus.UnknownPublicKeys),c=d.verify(f),c&&0').text(j)).html(),Pb.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=Ob.data().findPublicKeysByEmail(g),j=Ob.data().findSelfPrivateKey(c),k=null,l=null,m="";this.pgpSignedVerifyStatus(zb.SignedVerifyStatus.Error),this.pgpSignedVerifyUser(""),j||this.pgpSignedVerifyStatus(zb.SignedVerifyStatus.UnknownPrivateKey);try{e=a.openpgp.message.readArmored(this.plainRaw),e&&j&&e.decrypt&&(this.pgpSignedVerifyStatus(zb.SignedVerifyStatus.Unverified),f=e.decrypt(j),f&&(d=f.verify(i),d&&0').text(m)).html(),Pb.empty(),this.replacePlaneTextBody(m)))}catch(n){}this.storePgpVerifyDataToDom()}},z.prototype.replacePlaneTextBody=function(a){this.body&&this.body.html(a).addClass("b-text-part plain")},z.prototype.flagHash=function(){return[this.deleted(),this.unseen(),this.flagged(),this.answered(),this.forwarded(),this.isReadReceipt()].join("")},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()&&!a.isSystemFolder()})},this),this.canBeEdited=c.computed(function(){return zb.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 zb.FolderType.User!==this.type()},this),this.hidden=c.computed(function(){var a=this.isSystemFolder(),b=this.hasSubScribedSubfolders();return a&&!b||!this.selectable&&!b},this),this.selectableForFolderList=c.computed(function(){return!this.isSystemFolder()&&this.selectable},this),this.messageCountAll=c.computed({read:this.privateMessageCountAll,write:function(a){Bb.isPosNumeric(a,!0)?this.privateMessageCountAll(a):this.privateMessageCountAll.valueHasMutated()},owner:this}),this.messageCountUnread=c.computed({read:this.privateMessageCountUnread,write:function(a){Bb.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(zb.FolderType.Inbox===c&&Ob.data().foldersInboxUnreadCount(b),a>0){if(zb.FolderType.Draft===c)return""+a;if(b>0&&zb.FolderType.Trash!==c&&zb.FolderType.Archive!==c&&zb.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(){Bb.timeOutAction("folder-list-folder-visibility-change",function(){Lb.trigger("folder-list-folder-visibility-change")},100)}),this.localName=c.computed(function(){Eb.langChangeTrigger();var a=this.type(),b=this.name();if(this.isSystemFolder())switch(a){case zb.FolderType.Inbox:b=Bb.i18n("FOLDER_LIST/INBOX_NAME");break;case zb.FolderType.SentItems:b=Bb.i18n("FOLDER_LIST/SENT_NAME");break;case zb.FolderType.Draft:b=Bb.i18n("FOLDER_LIST/DRAFTS_NAME");break;case zb.FolderType.Spam:b=Bb.i18n("FOLDER_LIST/SPAM_NAME");break;case zb.FolderType.Trash:b=Bb.i18n("FOLDER_LIST/TRASH_NAME");break;case zb.FolderType.Archive:b=Bb.i18n("FOLDER_LIST/ARCHIVE_NAME")}return b},this),this.manageFolderSystemName=c.computed(function(){Eb.langChangeTrigger();var a="",b=this.type(),c=this.name();if(this.isSystemFolder())switch(b){case zb.FolderType.Inbox:a="("+Bb.i18n("FOLDER_LIST/INBOX_NAME")+")";break;case zb.FolderType.SentItems:a="("+Bb.i18n("FOLDER_LIST/SENT_NAME")+")";break;case zb.FolderType.Draft:a="("+Bb.i18n("FOLDER_LIST/DRAFTS_NAME")+")";break;case zb.FolderType.Spam:a="("+Bb.i18n("FOLDER_LIST/SPAM_NAME")+")";break;case zb.FolderType.Trash:a="("+Bb.i18n("FOLDER_LIST/TRASH_NAME")+")";break;case zb.FolderType.Archive:a="("+Bb.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():'"'+Bb.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,Bb.extendAsViewModel("PopupsFolderClearViewModel",E),E.prototype.clearPopup=function(){this.clearingProcess(!1),this.selectedFolder(null)},E.prototype.onShow=function(a){this.clearPopup(),a&&this.selectedFolder(a)},Bb.extendAsViewModel("PopupsFolderCreateViewModel",F),F.prototype.sNoParentText="",F.prototype.simpleFolderNameValidation=function(a){return/^[^\\\/]+$/g.test(Bb.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)},Bb.extendAsViewModel("PopupsFolderSystemViewModel",G),G.prototype.sChooseOnText="",G.prototype.sUnuseText="",G.prototype.onShow=function(a){var b="";switch(a=Bb.isUnd(a)?zb.SetSystemFoldersNotification.None:a){case zb.SetSystemFoldersNotification.Sent:b=Bb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SENT");break;case zb.SetSystemFoldersNotification.Draft:b=Bb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_DRAFTS");break;case zb.SetSystemFoldersNotification.Spam:b=Bb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SPAM");break;case zb.SetSystemFoldersNotification.Trash:b=Bb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH");break;case zb.SetSystemFoldersNotification.Archive:b=Bb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_ARCHIVE")}this.notification(b)},Bb.extendAsViewModel("PopupsComposeViewModel",H),H.prototype.openOpenPgpPopup=function(){if(this.allowOpenPGP()&&this.oEditor&&!this.oEditor.isHtml()){var a=this;Hb.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=Ob.data().draftFolder();""!==a&&(Ob.cache().setFolderHash(a,""),Ob.data().currentFolderFullNameRaw()===a?Ob.reloadMessageList(!0):Ob.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[Ob.data().accountEmail()]=Ob.data().accountEmail(),b)switch(a){case zb.ComposeType.Empty:d=Ob.data().accountEmail();break;case zb.ComposeType.Reply:case zb.ComposeType.ReplyAll:case zb.ComposeType.Forward:case zb.ComposeType.ForwardAsAttachment:h.find(h.union(b.to,b.cc,b.bcc),e);break;case zb.ComposeType.Draft:h.find(h.union(b.from,b.replyTo),e)}else d=Ob.data().accountEmail();return d},H.prototype.selectIdentity=function(a){a&&this.currentIdentityID(a.optValue)},H.prototype.formattedFrom=function(a){var b=Ob.data().displayName(),c=Ob.data().accountEmail();return""===b?c:(Bb.isUnd(a)?1:!a)?b+" ("+c+")":'"'+Bb.quoteName(b)+'" <'+c+">"},H.prototype.sendMessageResponse=function(b,c){var d=!1,e="";this.sending(!1),zb.StorageResultType.Success===b&&c&&c.Result&&(d=!0,this.modalVisibility()&&Bb.delegateRun(this,"closeCommand")),this.modalVisibility()&&!d&&(c&&zb.Notification.CantSaveMessage===c.ErrorCode?(this.sendSuccessButSaveError(!0),a.alert(Bb.trim(Bb.i18n("COMPOSE/SAVED_ERROR_ON_SEND")))):(e=Bb.getNotification(c&&c.ErrorCode?c.ErrorCode:zb.Notification.CantSendMessage,c&&c.ErrorMessage?c.ErrorMessage:""),this.sendError(!0),a.alert(e||Bb.getNotification(zb.Notification.CantSendMessage)))),this.reloadDraftFolder() -},H.prototype.saveMessageResponse=function(b,c){var d=!1,e=null;this.saving(!1),zb.StorageResultType.Success===b&&c&&c.Result&&c.Result.NewFolder&&c.Result.NewUid&&(this.bFromDraft&&(e=Ob.data().message(),e&&this.draftFolder()===e.folderFullNameRaw&&this.draftUid()===e.uid&&Ob.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&&Bb.isNormal(c)&&(v=Bb.isArray(c)&&1===c.length?c[0]:Bb.isArray(c)?null:c),null!==q&&(p[q]=!0,this.currentIdentityID(this.findIdentityIdByMessage(w,v))),this.reset(),Bb.isNonEmptyArray(d)&&this.to(x(d)),""!==w&&v){switch(j=v.fullFormatDateValue(),k=v.subject(),u=v.aDraftInfo,l=b(v.body).clone(),Bb.removeBlockquoteSwitcher(l),m=l.html(),w){case zb.ComposeType.Empty:break;case zb.ComposeType.Reply:this.to(x(v.replyEmails(p))),this.subject(Bb.replySubjectAdd("Re",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["reply",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Bb.trim(this.sInReplyTo+" "+v.sReferences);break;case zb.ComposeType.ReplyAll:o=v.replyAllEmails(p),this.to(x(o[0])),this.cc(x(o[1])),this.subject(Bb.replySubjectAdd("Re",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["reply",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Bb.trim(this.sInReplyTo+" "+v.references());break;case zb.ComposeType.Forward:this.subject(Bb.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["forward",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Bb.trim(this.sInReplyTo+" "+v.sReferences);break;case zb.ComposeType.ForwardAsAttachment:this.subject(Bb.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["forward",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Bb.trim(this.sInReplyTo+" "+v.sReferences);break;case zb.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=Bb.isNonEmptyArray(u)&&3===u.length?u:null,this.sInReplyTo=v.sInReplyTo,this.sReferences=v.sReferences;break;case zb.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=Bb.isNonEmptyArray(u)&&3===u.length?u:null,this.sInReplyTo=v.sInReplyTo,this.sReferences=v.sReferences}switch(w){case zb.ComposeType.Reply:case zb.ComposeType.ReplyAll:f=v.fromToLine(!1,!0),n=Bb.i18n("COMPOSE/REPLY_MESSAGE_TITLE",{DATETIME:j,EMAIL:f}),m="

"+n+":

"+m+"

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


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

"+m;break;case zb.ComposeType.ForwardAsAttachment:m=""}s&&""!==r&&zb.ComposeType.EditAsNew!==w&&zb.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 zb.ComposeType.Empty===w?(m=this.convertSignature(r),this.editor(function(a){a.setHtml(m,!1),zb.EditorDefaultType.Html!==Ob.data().editorDefaultType()&&a.modeToggle(!1)})):Bb.isNonEmptyArray(c)&&h.each(c,function(a){e.addMessageAsAttachment(a)});t=this.getAttachmentsDownloadsForUpload(),Bb.isNonEmptyArray(t)&&Ob.remote().messageUploadAttachments(function(a,b){if(zb.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;Hb.showScreenPopup(S,[Bb.i18n("POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW"),function(){a.modalVisibility()&&Bb.delegateRun(a,"closeCommand")}])},H.prototype.onBuild=function(){this.initUploader();var a=this,c=null;j("ctrl+q, command+q",zb.KeyState.Compose,function(){return a.identitiesDropdownTrigger(!0),!1}),j("ctrl+s, command+s",zb.KeyState.Compose,function(){return a.saveCommand(),!1}),j("ctrl+enter, command+enter",zb.KeyState.Compose,function(){return a.sendCommand(),!1}),j("esc",zb.KeyState.Compose,function(){return a.tryToClosePopup(),!1}),Lb.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",Ob.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=Bb.pInt(Ob.settingsGet("AttachmentLimit")),c=new g({action:Ob.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;Bb.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=Bb.isUnd(d.FileName)?"":d.FileName.toString(),g=Bb.isNormal(d.Size)?Bb.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(Bb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):!0},this)).on("onStart",h.bind(function(b){var c=null;Bb.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=Bb.getUploadErrorDescByCode(f):g||(e=Bb.i18n("UPLOAD/ERROR_UNKNOWN")),h&&(""!==e&&00&&d>0&&f>d?(e.uploading(!1),e.error(Bb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):(Ob.remote().composeUploadExternals(function(a,b){var c=!1;e.uploading(!1),zb.StorageResultType.Success===a&&b&&b.Result&&b.Result[e.id]&&(c=!0,e.tempName(b.Result[e.id])),c||e.error(Bb.getUploadErrorDescByCode(zb.UploadErrorCode.FileNoUploaded))},[a.link]),!0)},H.prototype.prepearMessageAttachments=function(a,b){if(a){var c=this,d=Bb.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(zb.ComposeType.ForwardAsAttachment===b)this.addMessageAsAttachment(a);else for(;f>e;e++){switch(h=d[e],i=!1,b){case zb.ComposeType.Reply:case zb.ComposeType.ReplyAll:i=h.isLinked;break;case zb.ComposeType.Forward:case zb.ComposeType.Draft:case zb.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(Bb.getUploadErrorDescByCode(zb.UploadErrorCode.FileNoUploaded))},this)},H.prototype.isEmptyForm=function(a){a=Bb.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()},Bb.extendAsViewModel("PopupsContactsViewModel",I),I.prototype.addNewProperty=function(a,b){var c=new w(a,b||"","");c.focused(!0),this.viewProperties.push(c)},I.prototype.addNewEmail=function(){this.addNewProperty(zb.ContactPropertyType.Email,"Home")},I.prototype.addNewPhone=function(){this.addNewProperty(zb.ContactPropertyType.Phone,"Mobile")},I.prototype.initUploader=function(){if(this.importUploaderButton()){var b=new g({action:Ob.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(Bb.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)},c,yb.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,zb.KeyState.ContactList);var d=this;j("delete",zb.KeyState.ContactList,function(){return d.deleteCommand(),!1}),a.on("click",".e-pagenator .e-page",function(){var a=c.dataFor(this);a&&(d.contactsPage(Bb.pInt(a.value)),d.reloadContactList())}),this.initUploader()},I.prototype.onShow=function(){Hb.routeOff(),this.reloadContactList(!0)},I.prototype.onHide=function(){Hb.routeOn(),this.currentContact(null),this.emptySelection(!0),this.search(""),h.each(this.contacts(),function(a){a.checked(!1)})},Bb.extendAsViewModel("PopupsAdvancedSearchViewModel",J),J.prototype.buildSearchStringValue=function(a){return-1 li"),e=c&&"tab"===c.shortcut,f=d.index(d.filter(".active"));return!e&&f>0?f--:e&&f-1&&g.eq(e).removeClass("focused"),38===f&&e>0?e--:40===f&&e1?" ("+(100>a?a:"99+")+")":""},Z.prototype.cancelSearch=function(){this.mainMessageListSearch(""),this.inputMessageListSearchFocus(!1)},Z.prototype.moveSelectedMessagesToFolder=function(a){return this.canBeMoved()&&Ob.moveMessagesToFolder(Ob.data().currentFolderFullNameRaw(),Ob.data().messageListCheckedOrSelectedUidsWithSubMails(),a),!1},Z.prototype.dragAndDronHelper=function(a,b){a&&a.checked(!0);var c=Bb.draggeblePlace();return c.data("rl-folder",Ob.data().currentFolderFullNameRaw()),c.data("rl-uids",Ob.data().messageListCheckedOrSelectedUidsWithSubMails()),c.data("rl-copy",b?"1":"0"),c.find(".text").text((b?"+":"")+""+Ob.data().messageListCheckedOrSelectedUidsWithSubMails().length),c},Z.prototype.onMessageResponse=function(a,b,c){var d=Ob.data();d.hideMessageBodies(),d.messageLoading(!1),zb.StorageResultType.Success===a&&b&&b.Result?d.setMessage(b,c):zb.StorageResultType.Unload===a?(d.message(null),d.messageError("")):zb.StorageResultType.Abort!==a&&(d.message(null),d.messageError(Bb.getNotification(b&&b.ErrorCode?b.ErrorCode:zb.Notification.UnknownError)))},Z.prototype.populateMessageBody=function(a){a&&(Ob.remote().message(this.onMessageResponse,a.folderFullNameRaw,a.uid)?Ob.data().messageLoading(!0):Bb.log("Error: Unknown message request: "+a.folderFullNameRaw+" ~ "+a.uid+" [e-101]"))},Z.prototype.setAction=function(a,b,c){var d=[],e=null,f=Ob.cache(),g=0;if(Bb.isUnd(c)&&(c=Ob.data().messageListChecked()),d=h.map(c,function(a){return a.uid}),""!==a&&01048576?(a.alert(Bb.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(Bb.getUploadErrorDescByCode(d&&d.ErrorCode?d.ErrorCode:zb.UploadErrorCode.Unknown)),this.customThemeUploaderProgress(!1)},this)),!!b}return!1},Bb.addSettingsViewModel(lb,"SettingsOpenPGP","SETTINGS_LABELS/LABEL_OPEN_PGP_NAME","openpgp"),lb.prototype.addOpenPgpKey=function(){Hb.showScreenPopup(L)},lb.prototype.generateOpenPgpKey=function(){Hb.showScreenPopup(N)},lb.prototype.viewOpenPgpKey=function(a){a&&Hb.showScreenPopup(M,[a])},lb.prototype.deleteOpenPgpKey=function(a){a&&a.deleteAccess()&&(this.openPgpKeyForDeletion(null),a&&Ob.data().openpgpKeyring&&(this.openpgpkeys.remove(function(b){return a===b}),Ob.data().openpgpKeyring[a.isPrivate?"privateKeys":"publicKeys"].removeForId(a.guid),Ob.data().openpgpKeyring.store(),Ob.reloadOpenPgpKeys()))},mb.prototype.populateDataOnStart=function(){var a=Bb.pInt(Ob.settingsGet("Layout")),b=Ob.settingsGet("Languages"),c=Ob.settingsGet("Themes");Bb.isArray(b)&&this.languages(b),Bb.isArray(c)&&this.themes(c),this.mainLanguage(Ob.settingsGet("Language")),this.mainTheme(Ob.settingsGet("Theme")),this.allowCustomTheme(!!Ob.settingsGet("AllowCustomTheme")),this.allowAdditionalAccounts(!!Ob.settingsGet("AllowAdditionalAccounts")),this.allowIdentities(!!Ob.settingsGet("AllowIdentities")),this.determineUserLanguage(!!Ob.settingsGet("DetermineUserLanguage")),this.allowThemes(!!Ob.settingsGet("AllowThemes")),this.allowCustomLogin(!!Ob.settingsGet("AllowCustomLogin")),this.allowLanguagesOnLogin(!!Ob.settingsGet("AllowLanguagesOnLogin")),this.allowLanguagesOnSettings(!!Ob.settingsGet("AllowLanguagesOnSettings")),this.editorDefaultType(Ob.settingsGet("EditorDefaultType")),this.showImages(!!Ob.settingsGet("ShowImages")),this.contactsAutosave(!!Ob.settingsGet("ContactsAutosave")),this.interfaceAnimation(Ob.settingsGet("InterfaceAnimation")),this.mainMessagesPerPage(Ob.settingsGet("MPP")),this.desktopNotifications(!!Ob.settingsGet("DesktopNotifications")),this.useThreads(!!Ob.settingsGet("UseThreads")),this.replySameFolder(!!Ob.settingsGet("ReplySameFolder")),this.useCheckboxesInList(!!Ob.settingsGet("UseCheckboxesInList")),this.layout(zb.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)))},nb.prototype.populateDataOnStart=function(){mb.prototype.populateDataOnStart.call(this),this.accountEmail(Ob.settingsGet("Email")),this.accountIncLogin(Ob.settingsGet("IncLogin")),this.accountOutLogin(Ob.settingsGet("OutLogin")),this.projectHash(Ob.settingsGet("ProjectHash")),this.displayName(Ob.settingsGet("DisplayName")),this.replyTo(Ob.settingsGet("ReplyTo")),this.signature(Ob.settingsGet("Signature")),this.signatureToAll(!!Ob.settingsGet("SignatureToAll")),this.enableTwoFactor(!!Ob.settingsGet("EnableTwoFactor")),this.lastFoldersHash=Ob.local().get(zb.ClientSideKeyName.FoldersLashHash)||"",this.remoteSuggestions=!!Ob.settingsGet("RemoteSuggestions"),this.devEmail=Ob.settingsGet("DevEmail"),this.devLogin=Ob.settingsGet("DevLogin"),this.devPassword=Ob.settingsGet("DevPassword")},nb.prototype.initUidNextAndNewMessages=function(b,c,d){if("INBOX"===b&&Bb.isNormal(c)&&""!==c){if(Bb.isArray(d)&&03)i(Ob.link().notificationMailIcon(),Ob.data().accountEmail(),Bb.i18n("MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION",{COUNT:g}));else for(;g>f;f++)i(Ob.link().notificationMailIcon(),z.emailsToLine(z.initEmailsFromJson(d[f].From),!1),d[f].Subject)}Ob.cache().setFolderUidNext(b,c)}},nb.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=Ob.cache().getFolderFromCacheList(g),f||(f=A.newInstanceFromJson(e),f&&(Ob.cache().setFolderToCacheList(g,f),Ob.cache().setFolderFullNameRaw(f.fullNameHash,g))),f&&(f.collapsed(!Bb.isFolderExpanded(f.fullNameHash)),e.Extended&&(e.Extended.Hash&&Ob.cache().setFolderHash(f.fullNameRaw,e.Extended.Hash),Bb.isNormal(e.Extended.MessageCount)&&f.messageCountAll(e.Extended.MessageCount),Bb.isNormal(e.Extended.MessageUnseenCount)&&f.messageCountUnread(e.Extended.MessageUnseenCount)),h=e.SubFolders,h&&"Collection/FolderCollection"===h["@Object"]&&h["@Collection"]&&Bb.isArray(h["@Collection"])&&f.subFolders(this.folderResponseParseRec(a,h["@Collection"])),i.push(f)));return i},nb.prototype.setFolders=function(a){var b=[],c=!1,d=Ob.data(),e=function(a){return""===a||yb.Values.UnuseOptionValue===a||null!==Ob.cache().getFolderFromCacheList(a)?a:""};a&&a.Result&&"Collection/FolderCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&Bb.isArray(a.Result["@Collection"])&&(Bb.isUnd(a.Result.Namespace)||(d.namespace=a.Result.Namespace),this.threading(!!Ob.settingsGet("UseImapThread")&&a.Result.IsThreadsSupported&&!0),b=this.folderResponseParseRec(d.namespace,a.Result["@Collection"]),d.folderList(b),a.Result.SystemFolders&&""==""+Ob.settingsGet("SentFolder")+Ob.settingsGet("DraftFolder")+Ob.settingsGet("SpamFolder")+Ob.settingsGet("TrashFolder")+Ob.settingsGet("ArchiveFolder")+Ob.settingsGet("NullFolder")&&(Ob.settingsSet("SentFolder",a.Result.SystemFolders[2]||null),Ob.settingsSet("DraftFolder",a.Result.SystemFolders[3]||null),Ob.settingsSet("SpamFolder",a.Result.SystemFolders[4]||null),Ob.settingsSet("TrashFolder",a.Result.SystemFolders[5]||null),Ob.settingsSet("ArchiveFolder",a.Result.SystemFolders[12]||null),c=!0),d.sentFolder(e(Ob.settingsGet("SentFolder"))),d.draftFolder(e(Ob.settingsGet("DraftFolder"))),d.spamFolder(e(Ob.settingsGet("SpamFolder"))),d.trashFolder(e(Ob.settingsGet("TrashFolder"))),d.archiveFolder(e(Ob.settingsGet("ArchiveFolder"))),c&&Ob.remote().saveSystemFolders(Bb.emptyFunction,{SentFolder:d.sentFolder(),DraftFolder:d.draftFolder(),SpamFolder:d.spamFolder(),TrashFolder:d.trashFolder(),ArchiveFolder:d.archiveFolder(),NullFolder:"NullFolder"}),Ob.local().set(zb.ClientSideKeyName.FoldersLashHash,a.Result.FoldersHash))},nb.prototype.hideMessageBodies=function(){var a=this.messagesBodiesDom();a&&a.find(".b-text-part").hide()},nb.prototype.getNextFolderNames=function(a){a=Bb.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=Ob.cache().getFolderFromCacheList(a[1]);return e&&(e.interval=d,b.push(a[1])),c<=b.length}),h.uniq(b)},nb.prototype.removeMessagesFromList=function(a,b,c,d){c=Bb.isNormal(c)?c:"",d=Bb.isUnd(d)?!1:!!d,b=h.map(b,function(a){return Bb.pInt(a)});var e=0,f=Ob.data(),g=Ob.cache(),i=f.messageList(),j=Ob.cache().getFolderFromCacheList(a),k=""===c?null:g.getFolderFromCacheList(c||""),l=f.currentFolderFullNameRaw(),m=f.message(),n=l===a?h.filter(i,function(a){return a&&-10&&j.messageCountUnread(0<=j.messageCountUnread()-e?j.messageCountUnread()-e:0)),k&&(k.messageCountAll(k.messageCountAll()+b.length),e>0&&k.messageCountUnread(k.messageCountUnread()+e),k.actionBlink(!0)),0').hide().addClass("rl-cache-class"),g.data("rl-cache-count",++Eb.iMessageBodyCacheCount),Bb.isNormal(a.Result.Html)&&""!==a.Result.Html?(d=!0,g.html(a.Result.Html.toString()).addClass("b-text-part html")):Bb.isNormal(a.Result.Plain)&&""!==a.Result.Plain?(d=!1,j=a.Result.Plain.toString(),(n.isPgpSigned()||n.isPgpEncrypted())&&Ob.data().allowOpenPGP()&&Bb.isNormal(a.Result.PlainRaw)&&(n.plainRaw=Bb.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)),Pb.empty(),k&&n.isPgpSigned()?j=Pb.append(b('
').text(n.plainRaw)).html():l&&n.isPgpEncrypted()&&(j=Pb.append(b('
').text(n.plainRaw)).html()),Pb.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(zb.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&&Bb.initBlockquoteSwitcher(g)),Ob.cache().initMessageFlagsFromCache(n),n.unseen()&&Ob.setMessageSeen(n),Bb.windowResize())},nb.prototype.calculateMessageListHash=function(a){return h.map(a,function(a){return""+a.hash+"_"+a.threadsLen()+"_"+a.flagHash()}).join("|")},nb.prototype.setMessageList=function(a,b){if(a&&a.Result&&"Collection/MessageCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&Bb.isArray(a.Result["@Collection"])){var c=Ob.data(),d=Ob.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=Bb.pInt(a.Result.MessageResultCount),j=Bb.pInt(a.Result.Offset),Bb.isNonEmptyArray(a.Result.LastCollapsedThreadUids)&&(e=a.Result.LastCollapsedThreadUids),p=Ob.cache().getFolderFromCacheList(Bb.isNormal(a.Result.Folder)?a.Result.Folder:""),p&&!b&&(p.interval=l,Ob.cache().setFolderHash(a.Result.Folder,a.Result.FolderHash),Bb.isNormal(a.Result.MessageCount)&&p.messageCountAll(a.Result.MessageCount),Bb.isNormal(a.Result.MessageUnseenCount)&&(Bb.pInt(p.messageCountUnread())!==Bb.pInt(a.Result.MessageUnseenCount)&&(r=!0),p.messageCountUnread(a.Result.MessageUnseenCount)),this.initUidNextAndNewMessages(p.fullNameRaw,a.Result.UidNext,a.Result.NewMessages)),r&&p&&Ob.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?Ob.cache().initMessageFlagsFromCache(o):Ob.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/"+Db.urlsafe_encode([b,c,Ob.data().projectHash(),Ob.data().threading()&&Ob.data().useThreads()?"1":"0"].join(String.fromCharCode(0))),["Message"]),!0):!1},pb.prototype.composeUploadExternals=function(a,b){this.defaultRequest(a,"ComposeUploadExternals",{Externals:b},999e3)},pb.prototype.folderInformation=function(a,b,c){var d=!0,e=Ob.cache(),f=[];Bb.isArray(c)&&0
").addClass("rl-settings-view-model").hide().attr("data-bind",'template: {name: "'+f.__rlSettingsData.Template+'"}, i18nInit: true'),i.appendTo(g),e.data=Ob.data(),e.viewModelDom=i,e.__rlSettingsData=f.__rlSettingsData,f.__dom=i,f.__builded=!0,f.__vm=e,c.applyBindings(e,i[0]),Bb.delegateRun(e,"onBuild",[i])):Bb.log("Cannot find sub settings view model position: SettingsSubScreen")),e&&h.defer(function(){d.oCurrentSubScreen&&(Bb.delegateRun(d.oCurrentSubScreen,"onHide"),d.oCurrentSubScreen.viewModelDom.hide()),d.oCurrentSubScreen=e,d.oCurrentSubScreen&&(d.oCurrentSubScreen.viewModelDom.show(),Bb.delegateRun(d.oCurrentSubScreen,"onShow"),Bb.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)),Bb.windowResize()})):Hb.setHash(Ob.link().settings(),!1,!0)},sb.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(Bb.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},sb.prototype.onBuild=function(){h.each(Fb.settings,function(a){a&&a.__rlSettingsData&&!h.find(Fb["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(Fb["settings-disabled"],function(b){return b&&b===a})})},this),this.oViewModelPlace=b("#rl-content #rl-settings-subscreen")},sb.prototype.routes=function(){var a=h.find(Fb.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=Bb.isUnd(c.subname)?b:Bb.pString(c.subname),[c.subname]}};return[["{subname}/",c],["{subname}",c],["",c]]},h.extend(tb.prototype,s.prototype),tb.prototype.onShow=function(){Ob.setTitle("")},h.extend(ub.prototype,s.prototype),ub.prototype.oLastRoute={},ub.prototype.setNewTitle=function(){var a=Ob.data().accountEmail(),b=Ob.data().foldersInboxUnreadCount();Ob.setTitle((""===a?"":(b>0?"("+b+") ":" ")+a+" - ")+Bb.i18n("TITLES/MAILBOX"))},ub.prototype.onShow=function(){this.setNewTitle(),Ob.data().keyScope(zb.KeyState.MessageList)},ub.prototype.onRoute=function(a,b,c,d){if(Bb.isUnd(d)?1:!d){var e=Ob.data(),f=Ob.cache().getFolderFullNameRaw(a),g=Ob.cache().getFolderFromCacheList(f);g&&(e.currentFolder(g).messageListPage(b).messageListSearch(c),zb.Layout.NoPreview===e.layout()&&e.message()&&(e.message(null),e.messageFullScreenMode(!1)),Ob.reloadMessageList())}else zb.Layout.NoPreview!==Ob.data().layout()||Ob.data().message()||Ob.historyBack()},ub.prototype.onStart=function(){var a=Ob.data(),b=function(){Bb.windowResize()};(Ob.settingsGet("AllowAdditionalAccounts")||Ob.settingsGet("AllowIdentities"))&&Ob.accountsAndIdentities(),h.delay(function(){"INBOX"!==a.currentFolderFullNameRaw()&&Ob.folderInformation("INBOX")},1e3),h.delay(function(){Ob.quota()},5e3),h.delay(function(){Ob.remote().appDelayStart(Bb.emptyFunction)},35e3),Kb.toggleClass("rl-no-preview-pane",zb.Layout.NoPreview===a.layout()),a.folderList.subscribe(b),a.messageList.subscribe(b),a.message.subscribe(b),a.layout.subscribe(function(a){Kb.toggleClass("rl-no-preview-pane",zb.Layout.NoPreview===a)}),a.foldersInboxUnreadCount.subscribe(function(){this.setNewTitle()},this)},ub.prototype.routes=function(){var a=function(){return["Inbox",1,"",!0]},b=function(a,b){return b[0]=Bb.pString(b[0]),b[1]=Bb.pInt(b[1]),b[1]=0>=b[1]?1:b[1],b[2]=Bb.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]=Bb.pString(b[0]),b[1]=Bb.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(vb.prototype,sb.prototype),vb.prototype.onShow=function(){Ob.setTitle(this.sSettingsTitle),Ob.data().keyScope(zb.KeyState.Settings)},h.extend(wb.prototype,q.prototype),wb.prototype.oSettings=null,wb.prototype.oPlugins=null,wb.prototype.oLocal=null,wb.prototype.oLink=null,wb.prototype.oSubs={},wb.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):(Eb.bMobileDevice?(a.open(b,"_self"),a.focus()):this.iframe.attr("src",b),!0)},wb.prototype.link=function(){return null===this.oLink&&(this.oLink=new k),this.oLink},wb.prototype.local=function(){return null===this.oLocal&&(this.oLocal=new p),this.oLocal},wb.prototype.settingsGet=function(a){return null===this.oSettings&&(this.oSettings=Bb.isNormal(Ib)?Ib:{}),Bb.isUnd(this.oSettings[a])?null:this.oSettings[a]},wb.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=Bb.isNormal(Ib)?Ib:{}),this.oSettings[a]=b},wb.prototype.setTitle=function(b){b=(Bb.isNormal(b)&&0l;l++)q.push({id:e[l][0],name:e[l][1],system:!1,seporator:!1,disabled:!1});for(o=!0,l=0,m=b.length;m>l;l++)n=b[l],(h?h.call(null,n):!0)&&(o&&0l;l++)n=c[l],(n.subScribed()||!n.existen)&&(h?h.call(null,n):!0)&&(zb.FolderType.User===n.type()||!j||00&&b>0&&a>b},this),this.hasMessages=c.computed(function(){return 0'),e.after(f),e.remove()),f&&f[0]&&(f.attr("data-href",g).attr("data-theme",a[0]),f&&f[0]&&f[0].styleSheet&&!Bb.isUnd(f[0].styleSheet.cssText)?f[0].styleSheet.cssText=a[1]:f.text(a[1])),d.themeTrigger(zb.SaveSettingsStep.TrueResult))}).always(function(){d.iTimer=a.setTimeout(function(){d.themeTrigger(zb.SaveSettingsStep.Idle)},1e3),d.oLastAjax=null})),Ob.remote().saveSettings(null,{Theme:c})},this)}function lb(){this.openpgpkeys=Ob.data().openpgpkeys,this.openpgpkeysPublic=Ob.data().openpgpkeysPublic,this.openpgpkeysPrivate=Ob.data().openpgpkeysPrivate,this.openPgpKeyForDeletion=c.observable(null).extend({falseTimeout:3e3}).extend({toggleSubscribe:[this,function(a){a&&a.deleteAccess(!1)},function(a){a&&a.deleteAccess(!0)}]})}function mb(){this.useKeyboardShortcuts=c.observable(!0),this.keyScopeReal=c.observable(zb.KeyState.All),this.keyScopeFake=c.observable(zb.KeyState.All),this.keyScope=c.computed({owner:this,read:function(){return this.keyScopeFake()},write:function(a){zb.KeyState.Menu!==a&&(zb.KeyState.Compose===a?Bb.disableKeyFilter():Bb.restoreKeyFilter(),this.keyScopeFake(a),Eb.dropdownVisibility()&&(a=zb.KeyState.Menu)),this.keyScopeReal(a)}}),this.keyScopeReal.subscribe(function(a){j.setScope(a)}),Eb.dropdownVisibility.subscribe(function(a){a?this.keyScope(zb.KeyState.Menu):zb.KeyState.Menu===j.getScope()&&this.keyScope(this.keyScopeFake())},this),Bb.initDataConstructorBySettings(this)}function nb(){mb.call(this);var d=function(a){return function(){var b=Ob.cache().getFolderFromCacheList(a());b&&b.type(zb.FolderType.User)}},e=function(a){return function(b){var c=Ob.cache().getFolderFromCacheList(b);c&&c.type(a)}};this.devEmail="",this.devLogin="",this.devPassword="",this.accountEmail=c.observable(""),this.accountIncLogin=c.observable(""),this.accountOutLogin=c.observable(""),this.projectHash=c.observable(""),this.threading=c.observable(!1),this.lastFoldersHash="",this.remoteSuggestions=!1,this.sentFolder=c.observable(""),this.draftFolder=c.observable(""),this.spamFolder=c.observable(""),this.trashFolder=c.observable(""),this.archiveFolder=c.observable(""),this.sentFolder.subscribe(d(this.sentFolder),this,"beforeChange"),this.draftFolder.subscribe(d(this.draftFolder),this,"beforeChange"),this.spamFolder.subscribe(d(this.spamFolder),this,"beforeChange"),this.trashFolder.subscribe(d(this.trashFolder),this,"beforeChange"),this.archiveFolder.subscribe(d(this.archiveFolder),this,"beforeChange"),this.sentFolder.subscribe(e(zb.FolderType.SentItems),this),this.draftFolder.subscribe(e(zb.FolderType.Draft),this),this.spamFolder.subscribe(e(zb.FolderType.Spam),this),this.trashFolder.subscribe(e(zb.FolderType.Trash),this),this.archiveFolder.subscribe(e(zb.FolderType.Archive),this),this.draftFolderNotEnabled=c.computed(function(){return""===this.draftFolder()||yb.Values.UnuseOptionValue===this.draftFolder()},this),this.displayName=c.observable(""),this.signature=c.observable(""),this.signatureToAll=c.observable(!1),this.replyTo=c.observable(""),this.enableTwoFactor=c.observable(!1),this.accounts=c.observableArray([]),this.accountsLoading=c.observable(!1).extend({throttle:100}),this.identities=c.observableArray([]),this.identitiesLoading=c.observable(!1).extend({throttle:100}),this.allowContactsSync=c.observable(!1),this.enableContactsSync=c.observable(!1),this.contactsSyncUrl=c.observable(""),this.contactsSyncUser=c.observable(""),this.contactsSyncPass=c.observable(""),this.allowContactsSync=c.observable(!!Ob.settingsGet("ContactsSyncIsAllowed")),this.enableContactsSync=c.observable(!!Ob.settingsGet("EnableContactsSync")),this.contactsSyncUrl=c.observable(Ob.settingsGet("ContactsSyncUrl")),this.contactsSyncUser=c.observable(Ob.settingsGet("ContactsSyncUser")),this.contactsSyncPass=c.observable(Ob.settingsGet("ContactsSyncPassword")),this.namespace="",this.folderList=c.observableArray([]),this.folderList.focused=c.observable(!1),this.foldersListError=c.observable(""),this.foldersLoading=c.observable(!1),this.foldersCreating=c.observable(!1),this.foldersDeleting=c.observable(!1),this.foldersRenaming=c.observable(!1),this.foldersChanging=c.computed(function(){var a=this.foldersLoading(),b=this.foldersCreating(),c=this.foldersDeleting(),d=this.foldersRenaming();return a||b||c||d},this),this.foldersInboxUnreadCount=c.observable(0),this.currentFolder=c.observable(null).extend({toggleSubscribe:[null,function(a){a&&a.selected(!1)},function(a){a&&a.selected(!0)}]}),this.currentFolderFullNameRaw=c.computed(function(){return this.currentFolder()?this.currentFolder().fullNameRaw:""},this),this.currentFolderFullName=c.computed(function(){return this.currentFolder()?this.currentFolder().fullName:""},this),this.currentFolderFullNameHash=c.computed(function(){return this.currentFolder()?this.currentFolder().fullNameHash:""},this),this.currentFolderName=c.computed(function(){return this.currentFolder()?this.currentFolder().name():""},this),this.folderListSystemNames=c.computed(function(){var a=["INBOX"],b=this.folderList(),c=this.sentFolder(),d=this.draftFolder(),e=this.spamFolder(),f=this.trashFolder(),g=this.archiveFolder();return Bb.isArray(b)&&0=a?1:a},this),this.mainMessageListSearch=c.computed({read:this.messageListSearch,write:function(a){Hb.setHash(Ob.link().mailBox(this.currentFolderFullNameHash(),1,Bb.trim(a.toString())))},owner:this}),this.messageListError=c.observable(""),this.messageListLoading=c.observable(!1),this.messageListIsNotCompleted=c.observable(!1),this.messageListCompleteLoadingThrottle=c.observable(!1).extend({throttle:200}),this.messageListCompleteLoading=c.computed(function(){var a=this.messageListLoading(),b=this.messageListIsNotCompleted();return a||b},this),this.messageListCompleteLoading.subscribe(function(a){this.messageListCompleteLoadingThrottle(a)},this),this.messageList.subscribe(h.debounce(function(a){h.each(a,function(a){a.newForAnimation()&&a.newForAnimation(!1)})},500)),this.staticMessageList=new z,this.message=c.observable(null),this.messageLoading=c.observable(!1),this.messageLoadingThrottle=c.observable(!1).extend({throttle:50}),this.message.focused=c.observable(!1),this.message.subscribe(function(b){b?zb.Layout.NoPreview===this.layout()&&this.message.focused(!0):(this.message.focused(!1),this.hideMessageBodies(),zb.Layout.NoPreview===Ob.data().layout()&&-10?Math.ceil(b/a*100):0},this),this.allowOpenPGP=c.observable(!1),this.openpgpkeys=c.observableArray([]),this.openpgpKeyring=null,this.openpgpkeysPublic=this.openpgpkeys.filter(function(a){return!(!a||a.isPrivate)}),this.openpgpkeysPrivate=this.openpgpkeys.filter(function(a){return!(!a||!a.isPrivate)}),this.googleActions=c.observable(!1),this.googleLoggined=c.observable(!1),this.googleUserName=c.observable(""),this.facebookActions=c.observable(!1),this.facebookLoggined=c.observable(!1),this.facebookUserName=c.observable(""),this.twitterActions=c.observable(!1),this.twitterLoggined=c.observable(!1),this.twitterUserName=c.observable(""),this.customThemeType=c.observable(zb.CustomThemeType.Light),this.purgeMessageBodyCacheThrottle=h.throttle(this.purgeMessageBodyCache,3e4)}function ob(){this.oRequests={}}function pb(){ob.call(this),this.oRequests={}}function qb(){this.oEmailsPicsHashes={},this.oServices={}}function rb(){qb.call(this),this.oFoldersCache={},this.oFoldersNamesCache={},this.oFolderHashCache={},this.oFolderUidNextCache={},this.oMessageListHashCache={},this.oMessageFlagsCache={},this.oNewMessage={},this.oRequestedMessage={}}function sb(a){s.call(this,"settings",a),this.menu=c.observableArray([]),this.oCurrentSubScreen=null,this.oViewModelPlace=null}function tb(){s.call(this,"login",[U])}function ub(){s.call(this,"mailbox",[W,Y,Z,$]),this.oLastRoute={}}function vb(){sb.call(this,[X,_,ab]),Bb.initOnStartOrLangChange(function(){this.sSettingsTitle=Bb.i18n("TITLES/SETTINGS")},this,function(){Ob.setTitle(this.sSettingsTitle)})}function wb(){q.call(this),this.oSettings=null,this.oPlugins=null,this.oLocal=null,this.oLink=null,this.oSubs={},this.isLocalAutocomplete=!0,this.popupVisibilityNames=c.observableArray([]),this.popupVisibility=c.computed(function(){return 0').appendTo("body"),Lb.on("error",function(a){Ob&&a&&a.originalEvent&&a.originalEvent.message&&-1===Bb.inArray(a.originalEvent.message,["Script error.","Uncaught Error: Error calling method on NPObject."])&&Ob.remote().jsError(Bb.emptyFunction,a.originalEvent.message,a.originalEvent.filename,a.originalEvent.lineno,location&&location.toString?location.toString():"",Kb.attr("class"),Bb.microtime()-Eb.now)})}function xb(){wb.call(this),this.oData=null,this.oRemote=null,this.oCache=null,this.oMoveCache={},this.quotaDebounce=h.debounce(this.quota,3e4),this.moveOrDeleteResponseHelper=h.bind(this.moveOrDeleteResponseHelper,this),this.messagesMoveTrigger=h.debounce(this.messagesMoveTrigger,500),a.setInterval(function(){Ob.pub("interval.30s")},3e4),a.setInterval(function(){Ob.pub("interval.1m")},6e4),a.setInterval(function(){Ob.pub("interval.2m")},12e4),a.setInterval(function(){Ob.pub("interval.3m")},18e4),a.setInterval(function(){Ob.pub("interval.5m")},3e5),a.setInterval(function(){Ob.pub("interval.10m")},6e5),b.wakeUp(function(){Ob.remote().jsVersion(function(b,c){zb.StorageResultType.Success===b&&c&&!c.Result&&(a.parent&&Ob.settingsGet("InIframe")?a.parent.location.reload():a.location.reload())},Ob.settingsGet("Version"))},{},36e5)}var yb={},zb={},Ab={},Bb={},Cb={},Db={},Eb={},Fb={settings:[],"settings-removed":[],"settings-disabled":[]},Gb=[],Hb=null,Ib=a.rainloopAppData||{},Jb=a.rainloopI18N||{},Kb=b("html"),Lb=b(a),Mb=b(a.document),Nb=a.Notification&&a.Notification.requestPermission?a.Notification:null,Ob=null,Pb=b("
");Eb.now=(new Date).getTime(),Eb.momentTrigger=c.observable(!0),Eb.dropdownVisibility=c.observable(!1).extend({rateLimit:0}),Eb.langChangeTrigger=c.observable(!0),Eb.iAjaxErrorCount=0,Eb.iTokenErrorCount=0,Eb.iMessageBodyCacheCount=0,Eb.bUnload=!1,Eb.sUserAgent=(navigator.userAgent||"").toLowerCase(),Eb.bIsiOSDevice=-1/g,">").replace(/"/g,""").replace(/'/g,"'"):""},Bb.splitPlainText=function(a,b){var c="",d="",e=a,f=0,g=0;for(b=Bb.isUnd(b)?100:b;e.length>b;)d=e.substring(0,b),f=d.lastIndexOf(" "),g=d.lastIndexOf("\n"),-1!==g&&(f=g),-1===f&&(f=b),c+=d.substring(0,f)+"\n",e=e.substring(f+1);return c+e},Bb.timeOutAction=function(){var b={};return function(c,d,e){Bb.isUnd(b[c])&&(b[c]=0),a.clearTimeout(b[c]),b[c]=a.setTimeout(d,e)}}(),Bb.timeOutActionSecond=function(){var b={};return function(c,d,e){b[c]||(b[c]=a.setTimeout(function(){d(),b[c]=0},e))}}(),Bb.audio=function(){var b=!1;return function(c,d){if(!1===b)if(Eb.bIsiOSDevice)b=null;else{var e=!1,f=!1,g=a.Audio?new a.Audio:null;g&&g.canPlayType&&g.play?(e=""!==g.canPlayType('audio/mpeg; codecs="mp3"'),e||(f=""!==g.canPlayType('audio/ogg; codecs="vorbis"')),e||f?(b=g,b.preload="none",b.loop=!1,b.autoplay=!1,b.muted=!1,b.src=e?c:d):b=null):b=null}return b}}(),Bb.hos=function(a,b){return a&&Object.hasOwnProperty?Object.hasOwnProperty.call(a,b):!1},Bb.i18n=function(a,b,c){var d="",e=Bb.isUnd(Jb[a])?Bb.isUnd(c)?a:c:Jb[a];if(!Bb.isUnd(b)&&!Bb.isNull(b))for(d in b)Bb.hos(b,d)&&(e=e.replace("%"+d+"%",b[d]));return e},Bb.i18nToNode=function(a){h.defer(function(){b(".i18n",a).each(function(){var a=b(this),c="";c=a.data("i18n-text"),c?a.text(Bb.i18n(c)):(c=a.data("i18n-html"),c&&a.html(Bb.i18n(c)),c=a.data("i18n-placeholder"),c&&a.attr("placeholder",Bb.i18n(c)),c=a.data("i18n-title"),c&&a.attr("title",Bb.i18n(c)))})})},Bb.i18nToDoc=function(){a.rainloopI18N&&(Jb=a.rainloopI18N||{},Bb.i18nToNode(Mb),Eb.langChangeTrigger(!Eb.langChangeTrigger())),a.rainloopI18N={}},Bb.initOnStartOrLangChange=function(a,b,c){a&&a.call(b),c?Eb.langChangeTrigger.subscribe(function(){a&&a.call(b),c.call(b)}):a&&Eb.langChangeTrigger.subscribe(a,b)},Bb.inFocus=function(){var a=document.activeElement;return a&&("INPUT"===a.tagName||"TEXTAREA"===a.tagName||"IFRAME"===a.tagName||"DIV"===a.tagName&&"editorHtmlArea"===a.className&&a.contentEditable)},Bb.removeInFocus=function(){if(document&&document.activeElement&&document.activeElement.blur){var a=b(document.activeElement);(a.is("input")||a.is("textarea"))&&document.activeElement.blur()}},Bb.removeSelection=function(){if(a&&a.getSelection){var b=a.getSelection();b&&b.removeAllRanges&&b.removeAllRanges()}else document&&document.selection&&document.selection.empty&&document.selection.empty()},Bb.replySubjectAdd=function(b,c,d){var e=null,f=Bb.trim(c);return f=null===(e=new a.RegExp("^"+b+"[\\s]?\\:(.*)$","gi").exec(c))||Bb.isUnd(e[1])?null===(e=new a.RegExp("^("+b+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$","gi").exec(c))||Bb.isUnd(e[1])||Bb.isUnd(e[2])||Bb.isUnd(e[3])?b+": "+c:e[1]+(Bb.pInt(e[2])+1)+e[3]:b+"[2]: "+e[1],f=f.replace(/[\s]+/g," "),f=(Bb.isUnd(d)?!0:d)?Bb.fixLongSubject(f):f},Bb.fixLongSubject=function(a){var b=0,c=null;a=Bb.trim(a.replace(/[\s]+/," "));do c=/^Re(\[([\d]+)\]|):[\s]{0,3}Re(\[([\d]+)\]|):/gi.exec(a),(!c||Bb.isUnd(c[0]))&&(c=null),c&&(b=0,b+=Bb.isUnd(c[2])?1:0+Bb.pInt(c[2]),b+=Bb.isUnd(c[4])?1:0+Bb.pInt(c[4]),a=a.replace(/^Re(\[[\d]+\]|):[\s]{0,3}Re(\[[\d]+\]|):/gi,"Re"+(b>0?"["+b+"]":"")+":"));while(c);return a=a.replace(/[\s]+/," ")},Bb.roundNumber=function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)},Bb.friendlySize=function(a){return a=Bb.pInt(a),a>=1073741824?Bb.roundNumber(a/1073741824,1)+"GB":a>=1048576?Bb.roundNumber(a/1048576,1)+"MB":a>=1024?Bb.roundNumber(a/1024,0)+"KB":a+"B"},Bb.log=function(b){a.console&&a.console.log&&a.console.log(b)},Bb.getNotification=function(a,b){return a=Bb.pInt(a),zb.Notification.ClientViewError===a&&b?b:Bb.isUnd(Ab[a])?"":Ab[a]},Bb.initNotificationLanguage=function(){Ab[zb.Notification.InvalidToken]=Bb.i18n("NOTIFICATIONS/INVALID_TOKEN"),Ab[zb.Notification.AuthError]=Bb.i18n("NOTIFICATIONS/AUTH_ERROR"),Ab[zb.Notification.AccessError]=Bb.i18n("NOTIFICATIONS/ACCESS_ERROR"),Ab[zb.Notification.ConnectionError]=Bb.i18n("NOTIFICATIONS/CONNECTION_ERROR"),Ab[zb.Notification.CaptchaError]=Bb.i18n("NOTIFICATIONS/CAPTCHA_ERROR"),Ab[zb.Notification.SocialFacebookLoginAccessDisable]=Bb.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE"),Ab[zb.Notification.SocialTwitterLoginAccessDisable]=Bb.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE"),Ab[zb.Notification.SocialGoogleLoginAccessDisable]=Bb.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE"),Ab[zb.Notification.DomainNotAllowed]=Bb.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED"),Ab[zb.Notification.AccountNotAllowed]=Bb.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED"),Ab[zb.Notification.AccountTwoFactorAuthRequired]=Bb.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_REQUIRED"),Ab[zb.Notification.AccountTwoFactorAuthError]=Bb.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_ERROR"),Ab[zb.Notification.CouldNotSaveNewPassword]=Bb.i18n("NOTIFICATIONS/COULD_NOT_SAVE_NEW_PASSWORD"),Ab[zb.Notification.CurrentPasswordIncorrect]=Bb.i18n("NOTIFICATIONS/CURRENT_PASSWORD_INCORRECT"),Ab[zb.Notification.NewPasswordShort]=Bb.i18n("NOTIFICATIONS/NEW_PASSWORD_SHORT"),Ab[zb.Notification.NewPasswordWeak]=Bb.i18n("NOTIFICATIONS/NEW_PASSWORD_WEAK"),Ab[zb.Notification.NewPasswordForbidden]=Bb.i18n("NOTIFICATIONS/NEW_PASSWORD_FORBIDDENT"),Ab[zb.Notification.ContactsSyncError]=Bb.i18n("NOTIFICATIONS/CONTACTS_SYNC_ERROR"),Ab[zb.Notification.CantGetMessageList]=Bb.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST"),Ab[zb.Notification.CantGetMessage]=Bb.i18n("NOTIFICATIONS/CANT_GET_MESSAGE"),Ab[zb.Notification.CantDeleteMessage]=Bb.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE"),Ab[zb.Notification.CantMoveMessage]=Bb.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),Ab[zb.Notification.CantCopyMessage]=Bb.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),Ab[zb.Notification.CantSaveMessage]=Bb.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE"),Ab[zb.Notification.CantSendMessage]=Bb.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE"),Ab[zb.Notification.InvalidRecipients]=Bb.i18n("NOTIFICATIONS/INVALID_RECIPIENTS"),Ab[zb.Notification.CantCreateFolder]=Bb.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"),Ab[zb.Notification.CantRenameFolder]=Bb.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER"),Ab[zb.Notification.CantDeleteFolder]=Bb.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER"),Ab[zb.Notification.CantDeleteNonEmptyFolder]=Bb.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER"),Ab[zb.Notification.CantSubscribeFolder]=Bb.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER"),Ab[zb.Notification.CantUnsubscribeFolder]=Bb.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER"),Ab[zb.Notification.CantSaveSettings]=Bb.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS"),Ab[zb.Notification.CantSavePluginSettings]=Bb.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS"),Ab[zb.Notification.DomainAlreadyExists]=Bb.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS"),Ab[zb.Notification.CantInstallPackage]=Bb.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE"),Ab[zb.Notification.CantDeletePackage]=Bb.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE"),Ab[zb.Notification.InvalidPluginPackage]=Bb.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE"),Ab[zb.Notification.UnsupportedPluginPackage]=Bb.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE"),Ab[zb.Notification.LicensingServerIsUnavailable]=Bb.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE"),Ab[zb.Notification.LicensingExpired]=Bb.i18n("NOTIFICATIONS/LICENSING_EXPIRED"),Ab[zb.Notification.LicensingBanned]=Bb.i18n("NOTIFICATIONS/LICENSING_BANNED"),Ab[zb.Notification.DemoSendMessageError]=Bb.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR"),Ab[zb.Notification.AccountAlreadyExists]=Bb.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS"),Ab[zb.Notification.MailServerError]=Bb.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR"),Ab[zb.Notification.UnknownNotification]=Bb.i18n("NOTIFICATIONS/UNKNOWN_ERROR"),Ab[zb.Notification.UnknownError]=Bb.i18n("NOTIFICATIONS/UNKNOWN_ERROR")},Bb.getUploadErrorDescByCode=function(a){var b="";switch(Bb.pInt(a)){case zb.UploadErrorCode.FileIsTooBig:b=Bb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case zb.UploadErrorCode.FilePartiallyUploaded:b=Bb.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case zb.UploadErrorCode.FileNoUploaded:b=Bb.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case zb.UploadErrorCode.MissingTempFolder:b=Bb.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case zb.UploadErrorCode.FileOnSaveingError:b=Bb.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case zb.UploadErrorCode.FileType:b=Bb.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:b=Bb.i18n("UPLOAD/ERROR_UNKNOWN")}return b},Bb.delegateRun=function(a,b,c,d){a&&a[b]&&(d=Bb.pInt(d),0>=d?a[b].apply(a,Bb.isArray(c)?c:[]):h.delay(function(){a[b].apply(a,Bb.isArray(c)?c:[])},d))},Bb.killCtrlAandS=function(b){if(b=b||a.event,b&&b.ctrlKey&&!b.shiftKey&&!b.altKey){var c=b.target||b.srcElement,d=b.keyCode||b.which;if(d===zb.EventKeyCode.S)return void b.preventDefault();if(c&&c.tagName&&c.tagName.match(/INPUT|TEXTAREA/i))return;d===zb.EventKeyCode.A&&(a.getSelection?a.getSelection().removeAllRanges():a.document.selection&&a.document.selection.clear&&a.document.selection.clear(),b.preventDefault())}},Bb.createCommand=function(a,b,d){var e=b?function(){return e.canExecute&&e.canExecute()&&b.apply(a,Array.prototype.slice.call(arguments)),!1}:function(){};return e.enabled=c.observable(!0),d=Bb.isUnd(d)?!0:d,e.canExecute=c.computed(Bb.isFunc(d)?function(){return e.enabled()&&d.call(a)}:function(){return e.enabled()&&!!d}),e},Bb.initDataConstructorBySettings=function(b){b.editorDefaultType=c.observable(zb.EditorDefaultType.Html),b.showImages=c.observable(!1),b.interfaceAnimation=c.observable(zb.InterfaceAnimation.Full),b.contactsAutosave=c.observable(!1),Eb.sAnimationType=zb.InterfaceAnimation.Full,b.allowThemes=c.observable(!0),b.allowCustomLogin=c.observable(!1),b.allowLanguagesOnSettings=c.observable(!0),b.allowLanguagesOnLogin=c.observable(!0),b.desktopNotifications=c.observable(!1),b.useThreads=c.observable(!0),b.replySameFolder=c.observable(!0),b.useCheckboxesInList=c.observable(!0),b.layout=c.observable(zb.Layout.SidePreview),b.usePreviewPane=c.computed(function(){return zb.Layout.NoPreview!==b.layout()}),b.interfaceAnimation.subscribe(function(a){if(Eb.bMobileDevice||a===zb.InterfaceAnimation.None)Kb.removeClass("rl-anim rl-anim-full").addClass("no-rl-anim"),Eb.sAnimationType=zb.InterfaceAnimation.None;else switch(a){case zb.InterfaceAnimation.Full:Kb.removeClass("no-rl-anim").addClass("rl-anim rl-anim-full"),Eb.sAnimationType=a;break;case zb.InterfaceAnimation.Normal:Kb.removeClass("no-rl-anim rl-anim-full").addClass("rl-anim"),Eb.sAnimationType=a}}),b.interfaceAnimation.valueHasMutated(),b.desktopNotificationsPermisions=c.computed(function(){b.desktopNotifications();var c=zb.DesktopNotifications.NotSupported;if(Nb&&Nb.permission)switch(Nb.permission.toLowerCase()){case"granted":c=zb.DesktopNotifications.Allowed;break;case"denied":c=zb.DesktopNotifications.Denied;break;case"default":c=zb.DesktopNotifications.NotAllowed}else a.webkitNotifications&&a.webkitNotifications.checkPermission&&(c=a.webkitNotifications.checkPermission());return c}),b.useDesktopNotifications=c.computed({read:function(){return b.desktopNotifications()&&zb.DesktopNotifications.Allowed===b.desktopNotificationsPermisions()},write:function(a){if(a){var c=b.desktopNotificationsPermisions();zb.DesktopNotifications.Allowed===c?b.desktopNotifications(!0):zb.DesktopNotifications.NotAllowed===c?Nb.requestPermission(function(){b.desktopNotifications.valueHasMutated(),zb.DesktopNotifications.Allowed===b.desktopNotificationsPermisions()?b.desktopNotifications()?b.desktopNotifications.valueHasMutated():b.desktopNotifications(!0):b.desktopNotifications()?b.desktopNotifications(!1):b.desktopNotifications.valueHasMutated()}):b.desktopNotifications(!1)}else b.desktopNotifications(!1)}}),b.language=c.observable(""),b.languages=c.observableArray([]),b.mainLanguage=c.computed({read:b.language,write:function(a){a!==b.language()?-1=b.diff(c,"hours")?d:b.format("L")===c.format("L")?Bb.i18n("MESSAGE_LIST/TODAY_AT",{TIME:c.format("LT")}):b.clone().subtract("days",1).format("L")===c.format("L")?Bb.i18n("MESSAGE_LIST/YESTERDAY_AT",{TIME:c.format("LT")}):c.format(b.year()===c.year()?"D MMM.":"LL")},a)},Bb.isFolderExpanded=function(a){var b=Ob.local().get(zb.ClientSideKeyName.ExpandedFolders);return h.isArray(b)&&-1!==h.indexOf(b,a)},Bb.setExpandedFolder=function(a,b){var c=Ob.local().get(zb.ClientSideKeyName.ExpandedFolders);h.isArray(c)||(c=[]),b?(c.push(a),c=h.uniq(c)):c=h.without(c,a),Ob.local().set(zb.ClientSideKeyName.ExpandedFolders,c)},Bb.initLayoutResizer=function(a,c,d){var e=b(a),f=b(c),g=Ob.local().get(d)||null,h=function(a,b){b&&b.size&&b.size.width&&(Ob.local().set(d,b.size.width),f.css({left:""+b.size.width+"px"}))};null!==g&&(e.css({width:""+g+"px"}),f.css({left:""+g+"px"})),e.resizable({helper:"ui-resizable-helper",minWidth:120,maxWidth:400,handles:"e",stop:h})},Bb.initBlockquoteSwitcher=function(a){if(a){var c=b("blockquote:not(.rl-bq-switcher)",a).filter(function(){return 0===b(this).parent().closest("blockquote",a).length});c&&0100)&&(a.addClass("rl-bq-switcher hidden-bq"),b('').insertBefore(a).click(function(){a.toggleClass("hidden-bq"),Bb.windowResize()}).after("
").before("
"))})}},Bb.removeBlockquoteSwitcher=function(a){a&&(b(a).find("blockquote.rl-bq-switcher").each(function(){b(this).removeClass("rl-bq-switcher hidden-bq")}),b(a).find(".rlBlockquoteSwitcher").each(function(){b(this).remove()}))},Bb.toggleMessageBlockquote=function(a){a&&a.find(".rlBlockquoteSwitcher").click()},Bb.extendAsViewModel=function(a,b,c){b&&(c||(c=r),b.__name=a,Cb.regViewModelHook(a,b),h.extend(b.prototype,c.prototype))},Bb.addSettingsViewModel=function(a,b,c,d,e){a.__rlSettingsData={Label:c,Template:b,Route:d,IsDefault:!!e},Fb.settings.push(a)},Bb.removeSettingsViewModel=function(a){Fb["settings-removed"].push(a)},Bb.disableSettingsViewModel=function(a){Fb["settings-disabled"].push(a)},Bb.convertThemeName=function(a){return Bb.trim(a.replace(/[^a-zA-Z]/g," ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))},Bb.quoteName=function(a){return a.replace(/["]/g,'\\"')},Bb.microtime=function(){return(new Date).getTime()},Bb.convertLangName=function(a,b){return Bb.i18n("LANGS_NAMES"+(!0===b?"_EN":"")+"/LANG_"+a.toUpperCase().replace(/[^a-zA-Z0-9]+/,"_"),null,a)},Bb.fakeMd5=function(a){var b="",c="0123456789abcdefghijklmnopqrstuvwxyz";for(a=Bb.isUnd(a)?32:Bb.pInt(a);b.length>>32-b}function c(a,b){var c,d,e,f,g;return e=2147483648&a,f=2147483648&b,c=1073741824&a,d=1073741824&b,g=(1073741823&a)+(1073741823&b),c&d?2147483648^g^e^f:c|d?1073741824&g?3221225472^g^e^f:1073741824^g^e^f:g^e^f}function d(a,b,c){return a&b|~a&c}function e(a,b,c){return a&c|b&~c}function f(a,b,c){return a^b^c}function g(a,b,c){return b^(a|~c)}function h(a,e,f,g,h,i,j){return a=c(a,c(c(d(e,f,g),h),j)),c(b(a,i),e)}function i(a,d,f,g,h,i,j){return a=c(a,c(c(e(d,f,g),h),j)),c(b(a,i),d)}function j(a,d,e,g,h,i,j){return a=c(a,c(c(f(d,e,g),h),j)),c(b(a,i),d)}function k(a,d,e,f,h,i,j){return a=c(a,c(c(g(d,e,f),h),j)),c(b(a,i),d)}function l(a){for(var b,c=a.length,d=c+8,e=(d-d%64)/64,f=16*(e+1),g=Array(f-1),h=0,i=0;c>i;)b=(i-i%4)/4,h=i%4*8,g[b]=g[b]|a.charCodeAt(i)<>>29,g}function m(a){var b,c,d="",e="";for(c=0;3>=c;c++)b=a>>>8*c&255,e="0"+b.toString(16),d+=e.substr(e.length-2,2);return d}function n(a){a=a.replace(/rn/g,"n");for(var b="",c=0;cd?b+=String.fromCharCode(d):d>127&&2048>d?(b+=String.fromCharCode(d>>6|192),b+=String.fromCharCode(63&d|128)):(b+=String.fromCharCode(d>>12|224),b+=String.fromCharCode(d>>6&63|128),b+=String.fromCharCode(63&d|128))}return b}var o,p,q,r,s,t,u,v,w,x=Array(),y=7,z=12,A=17,B=22,C=5,D=9,E=14,F=20,G=4,H=11,I=16,J=23,K=6,L=10,M=15,N=21;for(a=n(a),x=l(a),t=1732584193,u=4023233417,v=2562383102,w=271733878,o=0;o/g,">").replace(/")},Bb.draggeblePlace=function(){return b('
 
').appendTo("#rl-hidden")},Bb.defautOptionsAfterRender=function(a,c){c&&!Bb.isUnd(c.disabled)&&a&&b(a).toggleClass("disabled",c.disabled).prop("disabled",c.disabled)},Bb.windowPopupKnockout=function(c,d,e,f){var g=null,h=a.open(""),i="__OpenerApplyBindingsUid"+Bb.fakeMd5()+"__",j=b("#"+d);a[i]=function(){if(h&&h.document.body&&j&&j[0]){var d=b(h.document.body);b("#rl-content",d).html(j.html()),b("html",h.document).addClass("external "+b("html").attr("class")),Bb.i18nToNode(d),t.prototype.applyExternal(c,b("#rl-content",d)[0]),a[i]=null,f(h)}},h.document.open(),h.document.write(''+Bb.encodeHtml(e)+'
'),h.document.close(),g=h.document.createElement("script"),g.type="text/javascript",g.innerHTML="if(window&&window.opener&&window.opener['"+i+"']){window.opener['"+i+"']();window.opener['"+i+"']=null}",h.document.getElementsByTagName("head")[0].appendChild(g)},Bb.settingsSaveHelperFunction=function(a,b,c,d){return c=c||null,d=Bb.isUnd(d)?1e3:Bb.pInt(d),function(e,f,g,i,j){b.call(c,f&&f.Result?zb.SaveSettingsStep.TrueResult:zb.SaveSettingsStep.FalseResult),a&&a.call(c,e,f,g,i,j),h.delay(function(){b.call(c,zb.SaveSettingsStep.Idle)},d)}},Bb.settingsSaveHelperSimpleFunction=function(a,b){return Bb.settingsSaveHelperFunction(null,a,b,1e3)},Bb.htmlToPlain=function(a){var c="",d="> ",e=function(){if(arguments&&1\n",a.replace(/\n([> ]+)/gm,function(){return arguments&&1]*>(.|[\s\S\r\n]*)<\/div>/gim,f),a="\n"+b.trim(a)+"\n"),a}return""},g=function(){return arguments&&1/g,">"):""},h=function(){if(arguments&&1/gim,"\n").replace(/<\/h\d>/gi,"\n").replace(/<\/p>/gi,"\n\n").replace(/<\/li>/gi,"\n").replace(/<\/td>/gi,"\n").replace(/<\/tr>/gi,"\n").replace(/]*>/gim,"\n_______________________________\n\n").replace(/]*>/gim,"").replace(/]*>(.|[\s\S\r\n]*)<\/div>/gim,f).replace(/]*>/gim,"\n__bq__start__\n").replace(/<\/blockquote>/gim,"\n__bq__end__\n").replace(/]*>(.|[\s\S\r\n]*)<\/a>/gim,h).replace(/ /gi," ").replace(/<[^>]*>/gm,"").replace(/>/gi,">").replace(/</gi,"<").replace(/&/gi,"&").replace(/&\w{2,6};/gi,""),c.replace(/\n[ \t]+/gm,"\n").replace(/[\n]{3,}/gm,"\n\n").replace(/__bq__start__(.|[\s\S\r\n]*)__bq__end__/gm,e).replace(/__bq__start__/gm,"").replace(/__bq__end__/gm,"")},Bb.plainToHtml=function(a){return a.toString().replace(/&/g,"&").replace(/>/g,">").replace(/")},Bb.resizeAndCrop=function(b,c,d){var e=new a.Image;e.onload=function(){var a=[0,0],b=document.createElement("canvas"),e=b.getContext("2d");b.width=c,b.height=c,a=this.width>this.height?[this.width-this.height,0]:[0,this.height-this.width],e.fillStyle="#fff",e.fillRect(0,0,c,c),e.drawImage(this,a[0]/2,a[1]/2,this.width-a[0],this.height-a[1],0,0,c,c),d(b.toDataURL("image/jpeg"))},e.src=b},Bb.computedPagenatorHelper=function(a,b){return function(){var c=0,d=0,e=2,f=[],g=a(),h=b(),i=function(a,b,c){var d={current:a===g,name:Bb.isUnd(c)?a.toString():c.toString(),custom:Bb.isUnd(c)?!1:!0,title:Bb.isUnd(c)?"":a.toString(),value:a.toString()};(Bb.isUnd(b)?0:!b)?f.unshift(d):f.push(d)};if(h>1||h>0&&g>h){for(g>h?(i(h),c=h,d=h):((3>=g||g>=h-2)&&(e+=2),i(g),c=g,d=g);e>0;)if(c-=1,d+=1,c>0&&(i(c,!1),e--),h>=d)i(d,!0),e--;else if(0>=c)break;3===c?i(2,!1):c>3&&i(Math.round((c-1)/2),!1,"..."),h-2===d?i(h-1,!0):h-2>d&&i(Math.round((h+d)/2),!0,"..."),c>1&&i(1,!1),h>d&&i(h,!0)}return f}},Bb.selectElement=function(b){if(a.getSelection){var c=a.getSelection();c.removeAllRanges();var d=document.createRange();d.selectNodeContents(b),c.addRange(d)}else if(document.selection){var e=document.body.createTextRange();e.moveToElementText(b),e.select()}},Bb.disableKeyFilter=function(){a.key&&(j.filter=function(){return Ob.data().useKeyboardShortcuts()})},Bb.restoreKeyFilter=function(){a.key&&(j.filter=function(a){if(Ob.data().useKeyboardShortcuts()){var b=a.target||a.srcElement,c=b?b.tagName:"";return c=c.toUpperCase(),!("INPUT"===c||"SELECT"===c||"TEXTAREA"===c||b&&"DIV"===c&&"editorHtmlArea"===b.className&&b.contentEditable)}return!1})},Bb.detectDropdownVisibility=h.debounce(function(){Eb.dropdownVisibility(!!h.find(Gb,function(a){return a.hasClass("open")}))},50),Db={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",urlsafe_encode:function(a){return Db.encode(a).replace(/[+]/g,"-").replace(/[\/]/g,"_").replace(/[=]/g,".")},encode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=Db._utf8_encode(a);j>2,f=(3&b)<<4|c>>4,g=(15&c)<<2|d>>6,h=63&d,isNaN(c)?g=h=64:isNaN(d)&&(h=64),i=i+this._keyStr.charAt(e)+this._keyStr.charAt(f)+this._keyStr.charAt(g)+this._keyStr.charAt(h);return i},decode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");j>4,c=(15&f)<<4|g>>2,d=(3&g)<<6|h,i+=String.fromCharCode(b),64!==g&&(i+=String.fromCharCode(c)),64!==h&&(i+=String.fromCharCode(d));return Db._utf8_decode(i)},_utf8_encode:function(a){a=a.replace(/\r\n/g,"\n");for(var b="",c=0,d=a.length,e=0;d>c;c++)e=a.charCodeAt(c),128>e?b+=String.fromCharCode(e):e>127&&2048>e?(b+=String.fromCharCode(e>>6|192),b+=String.fromCharCode(63&e|128)):(b+=String.fromCharCode(e>>12|224),b+=String.fromCharCode(e>>6&63|128),b+=String.fromCharCode(63&e|128));return b},_utf8_decode:function(a){for(var b="",c=0,d=0,e=0,f=0;cd?(b+=String.fromCharCode(d),c++):d>191&&224>d?(e=a.charCodeAt(c+1),b+=String.fromCharCode((31&d)<<6|63&e),c+=2):(e=a.charCodeAt(c+1),f=a.charCodeAt(c+2),b+=String.fromCharCode((15&d)<<12|(63&e)<<6|63&f),c+=3);return b}},c.bindingHandlers.tooltip={init:function(a,d){if(!Eb.bMobileDevice){var e=b(a),f=e.data("tooltip-class")||"",g=e.data("tooltip-placement")||"top";e.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:g,trigger:"hover",title:function(){return e.is(".disabled")||Eb.dropdownVisibility()?"":''+Bb.i18n(c.utils.unwrapObservable(d()))+""}}).click(function(){e.tooltip("hide")}),Eb.dropdownVisibility.subscribe(function(a){a&&e.tooltip("hide")})}}},c.bindingHandlers.tooltip2={init:function(a,c){var d=b(a),e=d.data("tooltip-class")||"",f=d.data("tooltip-placement")||"top";d.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:f,title:function(){return d.is(".disabled")||Eb.dropdownVisibility()?"":''+c()()+""}}).click(function(){d.tooltip("hide")}),Eb.dropdownVisibility.subscribe(function(a){a&&d.tooltip("hide")})}},c.bindingHandlers.registrateBootstrapDropdown={init:function(a){Gb.push(b(a))}},c.bindingHandlers.openDropdownTrigger={update:function(a,d){if(c.utils.unwrapObservable(d())){var e=b(a);e.hasClass("open")||(e.find(".dropdown-toggle").dropdown("toggle"),Bb.detectDropdownVisibility()),d()(!1)}}},c.bindingHandlers.dropdownCloser={init:function(a){b(a).closest(".dropdown").on("click",".e-item",function(){b(a).dropdown("toggle")})}},c.bindingHandlers.popover={init:function(a,d){b(a).popover(c.utils.unwrapObservable(d()))}},c.bindingHandlers.csstext={init:function(a,d){a&&a.styleSheet&&!Bb.isUnd(a.styleSheet.cssText)?a.styleSheet.cssText=c.utils.unwrapObservable(d()):b(a).text(c.utils.unwrapObservable(d()))},update:function(a,d){a&&a.styleSheet&&!Bb.isUnd(a.styleSheet.cssText)?a.styleSheet.cssText=c.utils.unwrapObservable(d()):b(a).text(c.utils.unwrapObservable(d()))}},c.bindingHandlers.resizecrop={init:function(a){b(a).addClass("resizecrop").resizecrop({width:"100",height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(a,c){c()(),b(a).resizecrop({width:"100",height:"100"})}},c.bindingHandlers.onEnter={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&13===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.onEsc={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&27===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.clickOnTrue={update:function(a,d){c.utils.unwrapObservable(d())&&b(a).click()}},c.bindingHandlers.modal={init:function(a,d){b(a).toggleClass("fade",!Eb.bMobileDevice).modal({keyboard:!1,show:c.utils.unwrapObservable(d())}).on("shown",function(){Bb.windowResize()}).find(".close").click(function(){d()(!1)})},update:function(a,d){b(a).modal(c.utils.unwrapObservable(d())?"show":"hide")}},c.bindingHandlers.i18nInit={init:function(a){Bb.i18nToNode(a)}},c.bindingHandlers.i18nUpdate={update:function(a,b){c.utils.unwrapObservable(b()),Bb.i18nToNode(a)}},c.bindingHandlers.link={update:function(a,d){b(a).attr("href",c.utils.unwrapObservable(d()))}},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=Bb.pInt(e[1]),g=0,h=b(a).offset().top;h>0&&(h+=Bb.pInt(e[2]),g=Lb.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(!Eb.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),Bb.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),Bb.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(){Bb.removeInFocus()})}}},c.bindingHandlers.droppable={init:function(a,c,d){if(!Eb.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){Eb.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){Ob.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=Bb.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(Bb.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},Bb.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=Bb.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=Bb.trim(a),this.hasError(""!==a&&!/^.+@.+$/.test(a))},this),this.valueHasMutated(),this},c.observable.fn.validateFunc=function(a){return this.hasFuncError=c.observable(!1),Bb.isFunc(a)&&(this.subscribe(function(b){this.hasFuncError(!a(b))},this),this.valueHasMutated()),this},k.prototype.root=function(){return this.sBase},k.prototype.attachmentDownload=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},k.prototype.attachmentPreview=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/View/"+a},k.prototype.attachmentPreviewAsPlain=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},k.prototype.upload=function(){return this.sServer+"/Upload/"+this.sSpecSuffix+"/"},k.prototype.uploadContacts=function(){return this.sServer+"/UploadContacts/"+this.sSpecSuffix+"/"},k.prototype.uploadBackground=function(){return this.sServer+"/UploadBackground/"+this.sSpecSuffix+"/"},k.prototype.append=function(){return this.sServer+"/Append/"+this.sSpecSuffix+"/"},k.prototype.change=function(b){return this.sServer+"/Change/"+this.sSpecSuffix+"/"+a.encodeURIComponent(b)+"/"},k.prototype.ajax=function(a){return this.sServer+"/Ajax/"+this.sSpecSuffix+"/"+a},k.prototype.messageViewLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},k.prototype.messageDownloadLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},k.prototype.inbox=function(){return this.sBase+"mailbox/Inbox"},k.prototype.messagePreview=function(){return this.sBase+"mailbox/message-preview"},k.prototype.settings=function(a){var b=this.sBase+"settings";return Bb.isUnd(a)||""===a||(b+="/"+a),b},k.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},k.prototype.mailBox=function(a,b,c){b=Bb.isNormal(b)?Bb.pInt(b):1,c=Bb.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},k.prototype.phpInfo=function(){return this.sServer+"Info"},k.prototype.langLink=function(a){return this.sServer+"/Lang/0/"+encodeURI(a)+"/"+this.sVersion+"/"},k.prototype.getUserPicUrlFromHash=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/UserPic/"+a+"/"+this.sVersion+"/"},k.prototype.emptyContactPic=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/empty-contact.png"},k.prototype.sound=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/sounds/"+a},k.prototype.themePreviewLink=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/themes/"+encodeURI(a)+"/images/preview.png"},k.prototype.notificationMailIcon=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/icom-message-notification.png"},k.prototype.openPgpJs=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/js/openpgp.min.js"},k.prototype.socialGoogle=function(){return this.sServer+"SocialGoogle"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},k.prototype.socialTwitter=function(){return this.sServer+"SocialTwitter"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},k.prototype.socialFacebook=function(){return this.sServer+"SocialFacebook"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},Cb.oViewModelsHooks={},Cb.oSimpleHooks={},Cb.regViewModelHook=function(a,b){b&&(b.__hookName=a)},Cb.addHook=function(a,b){Bb.isFunc(b)&&(Bb.isArray(Cb.oSimpleHooks[a])||(Cb.oSimpleHooks[a]=[]),Cb.oSimpleHooks[a].push(b))},Cb.runHook=function(a,b){Bb.isArray(Cb.oSimpleHooks[a])&&(b=b||[],h.each(Cb.oSimpleHooks[a],function(a){a.apply(null,b)}))},Cb.mainSettingsGet=function(a){return Ob?Ob.settingsGet(a):null},Cb.remoteRequest=function(a,b,c,d,e,f){Ob&&Ob.remote().defaultRequest(a,b,c,d,e,f)},Cb.settingsGet=function(a,b){var c=Cb.mainSettingsGet("Plugins");return c=c&&Bb.isUnd(c[a])?null:c[a],c?Bb.isUnd(c[b])?null:c[b]:null},l.prototype.blurTrigger=function(){if(this.fOnBlur){var b=this;a.clearTimeout(b.iBlurTimer),b.iBlurTimer=a.setTimeout(function(){b.fOnBlur()},200)}},l.prototype.focusTrigger=function(){this.fOnBlur&&a.clearTimeout(this.iBlurTimer)},l.prototype.isHtml=function(){return this.editor?"wysiwyg"===this.editor.mode:!1},l.prototype.checkDirty=function(){return this.editor?this.editor.checkDirty():!1},l.prototype.resetDirty=function(){this.editor&&this.editor.resetDirty()},l.prototype.getData=function(){return this.editor?"plain"===this.editor.mode&&this.editor.plugins.plain&&this.editor.__plain?this.editor.__plain.getRawData():this.editor.getData():""},l.prototype.modeToggle=function(a){this.editor&&(a?"plain"===this.editor.mode&&this.editor.setMode("wysiwyg"):"wysiwyg"===this.editor.mode&&this.editor.setMode("plain"))},l.prototype.setHtml=function(a,b){this.editor&&(this.modeToggle(!0),this.editor.setData(a),b&&this.focus())},l.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()}},l.prototype.init=function(){if(this.$element&&this.$element[0]){var b=this,c=Eb.oHtmlEditorDefaultConfig,d=Ob.settingsGet("Language"),e=!!Ob.settingsGet("AllowHtmlEditorSourceButton");e&&c.toolbarGroups&&!c.toolbarGroups.__SourceInited&&(c.toolbarGroups.__SourceInited=!0,c.toolbarGroups.push({name:"document",groups:["mode","document","doctools"]})),c.language=Eb.oHtmlEditorLangsMap[d]||"en",b.editor=a.CKEDITOR.appendTo(b.$element[0],c),b.editor.on("key",function(a){return a&&a.data&&9===a.data.keyCode?!1:void 0}),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()})}},l.prototype.focus=function(){this.editor&&this.editor.focus()},l.prototype.blur=function(){this.editor&&this.editor.focusManager.blur(!0)},l.prototype.resize=function(){this.editor&&this.__resizable&&this.editor.resize(this.$element.width(),this.$element.innerHeight())},l.prototype.clear=function(a){this.setHtml("",a)},m.prototype.itemSelected=function(a){this.isListChecked()?a||(this.oCallbacks.onItemSelect||this.emptyFunction)(a||null):a&&(this.oCallbacks.onItemSelect||this.emptyFunction)(a)},m.prototype.goDown=function(a){this.newSelectPosition(zb.EventKeyCode.Down,!1,a)},m.prototype.goUp=function(a){this.newSelectPosition(zb.EventKeyCode.Up,!1,a)},m.prototype.init=function(a,d,e){if(this.oContentVisible=a,this.oContentScrollable=d,e=e||"all",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.focusedItem(b),b.checked(!b.checked())))}),j("enter",e,function(){return f.focusedItem()&&f.actionClick(f.focusedItem()),!1}),j("ctrl+up, command+up, ctrl+down, command+down",e,function(){return!1}),j("up, shift+up, down, shift+down, home, end, pageup, pagedown, insert, space",e,function(a,b){if(a&&b&&b.shortcut){var c=0;switch(b.shortcut){case"up":case"shift+up":c=zb.EventKeyCode.Up;break;case"down":case"shift+down":c=zb.EventKeyCode.Down;break;case"insert":c=zb.EventKeyCode.Insert;break;case"space":c=zb.EventKeyCode.Space;break;case"home":c=zb.EventKeyCode.Home;break;case"end":c=zb.EventKeyCode.End;break;case"pageup":c=zb.EventKeyCode.PageUp;break;case"pagedown":c=zb.EventKeyCode.PageDown}if(c>0)return f.newSelectPosition(c,j.shift),!1}})}},m.prototype.autoSelect=function(a){this.bAutoSelect=!!a},m.prototype.getItemUid=function(a){var b="",c=this.oCallbacks.onItemGetUid||null;return c&&a&&(b=c(a)),b.toString()},m.prototype.newSelectPosition=function(a,b,c){var d=0,e=10,f=!1,g=!1,i=null,j=this.list(),k=j?j.length:0,l=this.focusedItem();if(k>0)if(l){if(l)if(zb.EventKeyCode.Down===a||zb.EventKeyCode.Up===a||zb.EventKeyCode.Insert===a||zb.EventKeyCode.Space===a)h.each(j,function(b){if(!g)switch(a){case zb.EventKeyCode.Up:l===b?g=!0:i=b;break;case zb.EventKeyCode.Down:case zb.EventKeyCode.Insert:f?(i=b,g=!0):l===b&&(f=!0)}});else if(zb.EventKeyCode.Home===a||zb.EventKeyCode.End===a)zb.EventKeyCode.Home===a?i=j[0]:zb.EventKeyCode.End===a&&(i=j[j.length-1]);else if(zb.EventKeyCode.PageDown===a){for(;k>d;d++)if(l===j[d]){d+=e,d=d>k-1?k-1:d,i=j[d];break}}else if(zb.EventKeyCode.PageUp===a)for(d=k;d>=0;d--)if(l===j[d]){d-=e,d=0>d?0:d,i=j[d];break}}else zb.EventKeyCode.Down===a||zb.EventKeyCode.Insert===a||zb.EventKeyCode.Space===a||zb.EventKeyCode.Home===a||zb.EventKeyCode.PageUp===a?i=j[0]:(zb.EventKeyCode.Up===a||zb.EventKeyCode.End===a||zb.EventKeyCode.PageDown===a)&&(i=j[j.length-1]);i?(this.focusedItem(i),l&&(b?(zb.EventKeyCode.Up===a||zb.EventKeyCode.Down===a)&&l.checked(!l.checked()):(zb.EventKeyCode.Insert===a||zb.EventKeyCode.Space===a)&&l.checked(!l.checked())),!this.bAutoSelect&&!c||this.isListChecked()||zb.EventKeyCode.Space===a||this.selectedItem(i),this.scrollToFocused()):l&&(!b||zb.EventKeyCode.Up!==a&&zb.EventKeyCode.Down!==a?(zb.EventKeyCode.Insert===a||zb.EventKeyCode.Space===a)&&l.checked(!l.checked()):l.checked(!l.checked()),this.focusedItem(l))},m.prototype.scrollToFocused=function(){if(!this.oContentVisible||!this.oContentScrollable)return!1;var a=20,c=b(this.sItemFocusedSelector,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},m.prototype.scrollToTop=function(a){return this.oContentVisible&&this.oContentScrollable?(a?this.oContentScrollable.scrollTop(0):this.oContentScrollable.stop().animate({scrollTop:0},200),!0):!1},m.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},m.prototype.actionClick=function(a,b){if(a){var c=!0,d=this.getItemUid(a);b&&(!b.shiftKey||b.ctrlKey||b.altKey?!b.ctrlKey||b.shiftKey||b.altKey||(c=!1,this.focusedItem(a),this.selectedItem()&&a!==this.selectedItem()&&this.selectedItem().checked(!0),a.checked(!a.checked())):(c=!1,""===this.sLastUid&&(this.sLastUid=d),a.checked(!a.checked()),this.eventClickFunction(a,b),this.focusedItem(a))),c&&(this.focusedItem(a),this.selectedItem(a))}},m.prototype.on=function(a,b){this.oCallbacks[a]=b},n.supported=function(){return!0},n.prototype.set=function(a,c){var d=b.cookie(yb.Values.ClientSideCookieIndexName),e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[a]=c,b.cookie(yb.Values.ClientSideCookieIndexName,JSON.stringify(f),{expires:30}),e=!0}catch(g){}return e},n.prototype.get=function(a){var c=b.cookie(yb.Values.ClientSideCookieIndexName),d=null;try{d=null===c?null:JSON.parse(c),d=d&&!Bb.isUnd(d[a])?d[a]:null}catch(e){}return d},o.supported=function(){return!!a.localStorage},o.prototype.set=function(b,c){var d=a.localStorage[yb.Values.ClientSideCookieIndexName]||null,e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[b]=c,a.localStorage[yb.Values.ClientSideCookieIndexName]=JSON.stringify(f),e=!0}catch(g){}return e},o.prototype.get=function(b){var c=a.localStorage[yb.Values.ClientSideCookieIndexName]||null,d=null;try{d=null===c?null:JSON.parse(c),d=d&&!Bb.isUnd(d[b])?d[b]:null}catch(e){}return d},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.storeAndSetKeyScope=function(){this.sCurrentKeyScope=Ob.data().keyScope(),Ob.data().keyScope(this.sDefaultKeyScope)},r.prototype.restoreKeyScope=function(){Ob.data().keyScope(this.sCurrentKeyScope)},r.prototype.registerPopupEscapeKey=function(){var a=this;Lb.on("keydown",function(b){return b&&zb.EventKeyCode.Esc===b.keyCode&&a.modalVisibility&&a.modalVisibility()?(Bb.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;Bb.isNonEmptyArray(a)&&(c=h.bind(this.onRoute||Bb.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){Bb.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 Bb.isNormal(a)&&(this.oBoot=a),this},t.prototype.screen=function(a){return""===a||Bb.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()),i=null;a.__builded=!0,a.__vm=e,e.data=Ob.data(),e.viewModelName=a.__name,g&&1===g.length?(i=b("
").addClass("rl-view-model").addClass("RL-"+e.viewModelTemplate()).hide().attr("data-bind",'template: {name: "'+e.viewModelTemplate()+'"}, i18nInit: true'),i.appendTo(g),e.viewModelDom=i,a.__dom=i,"Popups"===f&&(e.cancelCommand=e.closeCommand=Bb.createCommand(e,function(){Hb.hideScreenPopup(a)}),e.modalVisibility.subscribe(function(a){var b=this;a?(this.viewModelDom.show(),this.storeAndSetKeyScope(),Ob.popupVisibilityNames.push(this.viewModelName),Bb.delegateRun(this,"onFocus",[],500)):(Bb.delegateRun(this,"onHide"),this.restoreKeyScope(),Ob.popupVisibilityNames.remove(this.viewModelName),h.delay(function(){b.viewModelDom.hide()},300))},e)),Cb.runHook("view-model-pre-build",[a.__name,e,i]),c.applyBindings(e,i[0]),Bb.delegateRun(e,"onBuild",[i]),e&&"Popups"===f&&!e.bDisabeCloseOnEsc&&e.registerPopupEscapeKey(),Cb.runHook("view-model-post-build",[a.__name,e,i])):Bb.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),Cb.runHook("view-model-on-hide",[a.__name,a.__vm]))},t.prototype.showScreenPopup=function(a,b){a&&(this.buildViewModel(a),a.__vm&&a.__dom&&(a.__vm.modalVisibility(!0),Bb.delegateRun(a.__vm,"onShow",b||[]),Cb.runHook("view-model-on-show",[a.__name,a.__vm,b||[]])))},t.prototype.screenOnRoute=function(a,b){var c=this,d=null,e=null;""===Bb.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,Bb.isNonEmptyArray(d.viewModels())&&h.each(d.viewModels(),function(a){this.buildViewModel(a,d)},this),Bb.delegateRun(d,"onBuild")),h.defer(function(){c.oCurrentScreen&&(Bb.delegateRun(c.oCurrentScreen,"onHide"),Bb.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),Bb.delegateRun(a.__vm,"onHide")) +})),c.oCurrentScreen=d,c.oCurrentScreen&&(Bb.delegateRun(c.oCurrentScreen,"onShow"),Cb.runHook("screen-on-show",[c.oCurrentScreen.screenName(),c.oCurrentScreen]),Bb.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),Bb.delegateRun(a.__vm,"onShow"),Bb.delegateRun(a.__vm,"onFocus",[],200),Cb.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(),Cb.runHook("screen-pre-start",[a.screenName(),a]),Bb.delegateRun(a,"onStart"),Cb.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(){Kb.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=Bb.isUnd(c)?!1:!!c,(Bb.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},Hb=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=zb.EmailType.Facebook),null===this.privateType&&(this.privateType=zb.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=Bb.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=Bb.trim(a.Name),this.email=Bb.trim(a.Email),b=""!==this.email,this.clearDuplicateName()),b},u.prototype.toLine=function(a,b,c){var d="";return""!==this.email&&(b=Bb.isUnd(b)?!1:!!b,c=Bb.isUnd(c)?!1:!!c,a&&""!==this.name?d=b?'")+'" target="_blank" tabindex="-1">'+Bb.encodeHtml(this.name)+"":c?Bb.encodeHtml(this.name):this.name:(d=this.email,""!==this.name?b?d=Bb.encodeHtml('"'+this.name+'" <')+'")+'" target="_blank" tabindex="-1">'+Bb.encodeHtml(d)+""+Bb.encodeHtml(">"):(d='"'+this.name+'" <'+d+">",c&&(d=Bb.encodeHtml(d))):b&&(d=''+Bb.encodeHtml(this.email)+""))),d},u.prototype.mailsoParse=function(a){if(a=Bb.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=Bb.trim(e).replace(/^[<]+/,"").replace(/[>]+$/,""),d=Bb.trim(d).replace(/^["']+/,"").replace(/["']+$/,""),f=Bb.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(Bb.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++)Bb.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(zb.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(zb.SignedVerifyStatus.None),this.pgpSignedVerifyUser(""),this.priority(zb.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=Ob.data().sentFolder(),b=Ob.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(Bb.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(Bb.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(Bb.pInt(a.ParentThread)),this.threads(Bb.isArray(a.Threads)?a.Threads:[]),this.threadsLen(Bb.pInt(a.ThreadsLen)),this.initFlagsByJson(a),this.computeSenderEmail(),b=!0),b},z.prototype.initUpdateByMessageJson=function(a){var b=!1,c=zb.MessagePriority.Normal;return a&&"Object/Message"===a["@Object"]&&(c=Bb.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 Bb.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 Bb.isArray(this.from)&&this.from[0]?this.from[0].email:""},z.prototype.viewLink=function(){return Ob.link().messageViewLink(this.requestHash)},z.prototype.downloadLink=function(){return Ob.link().messageDownloadLink(this.requestHash)},z.prototype.replyEmails=function(a){var b=[],c=Bb.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=Bb.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(zb.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=Bb.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=Bb.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]}),Lb.resize()),Bb.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=Bb.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=Bb.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]),Bb.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),Ob.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&&Ob.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=Bb.pString(this.body.data("rl-plain-raw")),Ob.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(zb.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=Ob.data().findPublicKeysByEmail(e),g=null,i=null,j="";this.pgpSignedVerifyStatus(zb.SignedVerifyStatus.Error),this.pgpSignedVerifyUser("");try{d=a.openpgp.cleartext.readArmored(this.plainRaw),d&&d.getText&&(this.pgpSignedVerifyStatus(f.length?zb.SignedVerifyStatus.Unverified:zb.SignedVerifyStatus.UnknownPublicKeys),c=d.verify(f),c&&0').text(j)).html(),Pb.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=Ob.data().findPublicKeysByEmail(g),j=Ob.data().findSelfPrivateKey(c),k=null,l=null,m="";this.pgpSignedVerifyStatus(zb.SignedVerifyStatus.Error),this.pgpSignedVerifyUser(""),j||this.pgpSignedVerifyStatus(zb.SignedVerifyStatus.UnknownPrivateKey);try{e=a.openpgp.message.readArmored(this.plainRaw),e&&j&&e.decrypt&&(this.pgpSignedVerifyStatus(zb.SignedVerifyStatus.Unverified),f=e.decrypt(j),f&&(d=f.verify(i),d&&0').text(m)).html(),Pb.empty(),this.replacePlaneTextBody(m)))}catch(n){}this.storePgpVerifyDataToDom()}},z.prototype.replacePlaneTextBody=function(a){this.body&&this.body.html(a).addClass("b-text-part plain")},z.prototype.flagHash=function(){return[this.deleted(),this.unseen(),this.flagged(),this.answered(),this.forwarded(),this.isReadReceipt()].join("")},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()&&!a.isSystemFolder()})},this),this.canBeEdited=c.computed(function(){return zb.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 zb.FolderType.User!==this.type()},this),this.hidden=c.computed(function(){var a=this.isSystemFolder(),b=this.hasSubScribedSubfolders();return a&&!b||!this.selectable&&!b},this),this.selectableForFolderList=c.computed(function(){return!this.isSystemFolder()&&this.selectable},this),this.messageCountAll=c.computed({read:this.privateMessageCountAll,write:function(a){Bb.isPosNumeric(a,!0)?this.privateMessageCountAll(a):this.privateMessageCountAll.valueHasMutated()},owner:this}),this.messageCountUnread=c.computed({read:this.privateMessageCountUnread,write:function(a){Bb.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(zb.FolderType.Inbox===c&&Ob.data().foldersInboxUnreadCount(b),a>0){if(zb.FolderType.Draft===c)return""+a;if(b>0&&zb.FolderType.Trash!==c&&zb.FolderType.Archive!==c&&zb.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(){Bb.timeOutAction("folder-list-folder-visibility-change",function(){Lb.trigger("folder-list-folder-visibility-change")},100)}),this.localName=c.computed(function(){Eb.langChangeTrigger();var a=this.type(),b=this.name();if(this.isSystemFolder())switch(a){case zb.FolderType.Inbox:b=Bb.i18n("FOLDER_LIST/INBOX_NAME");break;case zb.FolderType.SentItems:b=Bb.i18n("FOLDER_LIST/SENT_NAME");break;case zb.FolderType.Draft:b=Bb.i18n("FOLDER_LIST/DRAFTS_NAME");break;case zb.FolderType.Spam:b=Bb.i18n("FOLDER_LIST/SPAM_NAME");break;case zb.FolderType.Trash:b=Bb.i18n("FOLDER_LIST/TRASH_NAME");break;case zb.FolderType.Archive:b=Bb.i18n("FOLDER_LIST/ARCHIVE_NAME")}return b},this),this.manageFolderSystemName=c.computed(function(){Eb.langChangeTrigger();var a="",b=this.type(),c=this.name();if(this.isSystemFolder())switch(b){case zb.FolderType.Inbox:a="("+Bb.i18n("FOLDER_LIST/INBOX_NAME")+")";break;case zb.FolderType.SentItems:a="("+Bb.i18n("FOLDER_LIST/SENT_NAME")+")";break;case zb.FolderType.Draft:a="("+Bb.i18n("FOLDER_LIST/DRAFTS_NAME")+")";break;case zb.FolderType.Spam:a="("+Bb.i18n("FOLDER_LIST/SPAM_NAME")+")";break;case zb.FolderType.Trash:a="("+Bb.i18n("FOLDER_LIST/TRASH_NAME")+")";break;case zb.FolderType.Archive:a="("+Bb.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():'"'+Bb.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,Bb.extendAsViewModel("PopupsFolderClearViewModel",E),E.prototype.clearPopup=function(){this.clearingProcess(!1),this.selectedFolder(null)},E.prototype.onShow=function(a){this.clearPopup(),a&&this.selectedFolder(a)},Bb.extendAsViewModel("PopupsFolderCreateViewModel",F),F.prototype.sNoParentText="",F.prototype.simpleFolderNameValidation=function(a){return/^[^\\\/]+$/g.test(Bb.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)},Bb.extendAsViewModel("PopupsFolderSystemViewModel",G),G.prototype.sChooseOnText="",G.prototype.sUnuseText="",G.prototype.onShow=function(a){var b="";switch(a=Bb.isUnd(a)?zb.SetSystemFoldersNotification.None:a){case zb.SetSystemFoldersNotification.Sent:b=Bb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SENT");break;case zb.SetSystemFoldersNotification.Draft:b=Bb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_DRAFTS");break;case zb.SetSystemFoldersNotification.Spam:b=Bb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SPAM");break;case zb.SetSystemFoldersNotification.Trash:b=Bb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH");break;case zb.SetSystemFoldersNotification.Archive:b=Bb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_ARCHIVE")}this.notification(b)},Bb.extendAsViewModel("PopupsComposeViewModel",H),H.prototype.openOpenPgpPopup=function(){if(this.allowOpenPGP()&&this.oEditor&&!this.oEditor.isHtml()){var a=this;Hb.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=Ob.data().draftFolder();""!==a&&(Ob.cache().setFolderHash(a,""),Ob.data().currentFolderFullNameRaw()===a?Ob.reloadMessageList(!0):Ob.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[Ob.data().accountEmail()]=Ob.data().accountEmail(),b)switch(a){case zb.ComposeType.Empty:d=Ob.data().accountEmail();break;case zb.ComposeType.Reply:case zb.ComposeType.ReplyAll:case zb.ComposeType.Forward:case zb.ComposeType.ForwardAsAttachment:h.find(h.union(b.to,b.cc,b.bcc),e);break;case zb.ComposeType.Draft:h.find(h.union(b.from,b.replyTo),e)}else d=Ob.data().accountEmail();return d},H.prototype.selectIdentity=function(a){a&&this.currentIdentityID(a.optValue) +},H.prototype.formattedFrom=function(a){var b=Ob.data().displayName(),c=Ob.data().accountEmail();return""===b?c:(Bb.isUnd(a)?1:!a)?b+" ("+c+")":'"'+Bb.quoteName(b)+'" <'+c+">"},H.prototype.sendMessageResponse=function(b,c){var d=!1,e="";this.sending(!1),zb.StorageResultType.Success===b&&c&&c.Result&&(d=!0,this.modalVisibility()&&Bb.delegateRun(this,"closeCommand")),this.modalVisibility()&&!d&&(c&&zb.Notification.CantSaveMessage===c.ErrorCode?(this.sendSuccessButSaveError(!0),a.alert(Bb.trim(Bb.i18n("COMPOSE/SAVED_ERROR_ON_SEND")))):(e=Bb.getNotification(c&&c.ErrorCode?c.ErrorCode:zb.Notification.CantSendMessage,c&&c.ErrorMessage?c.ErrorMessage:""),this.sendError(!0),a.alert(e||Bb.getNotification(zb.Notification.CantSendMessage)))),this.reloadDraftFolder()},H.prototype.saveMessageResponse=function(b,c){var d=!1,e=null;this.saving(!1),zb.StorageResultType.Success===b&&c&&c.Result&&c.Result.NewFolder&&c.Result.NewUid&&(this.bFromDraft&&(e=Ob.data().message(),e&&this.draftFolder()===e.folderFullNameRaw&&this.draftUid()===e.uid&&Ob.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&&Bb.isNormal(c)&&(v=Bb.isArray(c)&&1===c.length?c[0]:Bb.isArray(c)?null:c),null!==q&&(p[q]=!0,this.currentIdentityID(this.findIdentityIdByMessage(w,v))),this.reset(),Bb.isNonEmptyArray(d)&&this.to(x(d)),""!==w&&v){switch(j=v.fullFormatDateValue(),k=v.subject(),u=v.aDraftInfo,l=b(v.body).clone(),Bb.removeBlockquoteSwitcher(l),m=l.html(),w){case zb.ComposeType.Empty:break;case zb.ComposeType.Reply:this.to(x(v.replyEmails(p))),this.subject(Bb.replySubjectAdd("Re",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["reply",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Bb.trim(this.sInReplyTo+" "+v.sReferences);break;case zb.ComposeType.ReplyAll:o=v.replyAllEmails(p),this.to(x(o[0])),this.cc(x(o[1])),this.subject(Bb.replySubjectAdd("Re",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["reply",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Bb.trim(this.sInReplyTo+" "+v.references());break;case zb.ComposeType.Forward:this.subject(Bb.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["forward",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Bb.trim(this.sInReplyTo+" "+v.sReferences);break;case zb.ComposeType.ForwardAsAttachment:this.subject(Bb.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["forward",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Bb.trim(this.sInReplyTo+" "+v.sReferences);break;case zb.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=Bb.isNonEmptyArray(u)&&3===u.length?u:null,this.sInReplyTo=v.sInReplyTo,this.sReferences=v.sReferences;break;case zb.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=Bb.isNonEmptyArray(u)&&3===u.length?u:null,this.sInReplyTo=v.sInReplyTo,this.sReferences=v.sReferences}switch(w){case zb.ComposeType.Reply:case zb.ComposeType.ReplyAll:f=v.fromToLine(!1,!0),n=Bb.i18n("COMPOSE/REPLY_MESSAGE_TITLE",{DATETIME:j,EMAIL:f}),m="

"+n+":

"+m+"

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


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

"+m;break;case zb.ComposeType.ForwardAsAttachment:m=""}s&&""!==r&&zb.ComposeType.EditAsNew!==w&&zb.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 zb.ComposeType.Empty===w?(m=this.convertSignature(r),this.editor(function(a){a.setHtml(m,!1),zb.EditorDefaultType.Html!==Ob.data().editorDefaultType()&&a.modeToggle(!1)})):Bb.isNonEmptyArray(c)&&h.each(c,function(a){e.addMessageAsAttachment(a)});t=this.getAttachmentsDownloadsForUpload(),Bb.isNonEmptyArray(t)&&Ob.remote().messageUploadAttachments(function(a,b){if(zb.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;Hb.showScreenPopup(S,[Bb.i18n("POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW"),function(){a.modalVisibility()&&Bb.delegateRun(a,"closeCommand")}])},H.prototype.onBuild=function(){this.initUploader();var a=this,c=null;j("ctrl+q, command+q",zb.KeyState.Compose,function(){return a.identitiesDropdownTrigger(!0),!1}),j("ctrl+s, command+s",zb.KeyState.Compose,function(){return a.saveCommand(),!1}),j("ctrl+enter, command+enter",zb.KeyState.Compose,function(){return a.sendCommand(),!1}),j("esc",zb.KeyState.Compose,function(){return a.tryToClosePopup(),!1}),Lb.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",Ob.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=Bb.pInt(Ob.settingsGet("AttachmentLimit")),c=new g({action:Ob.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;Bb.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=Bb.isUnd(d.FileName)?"":d.FileName.toString(),g=Bb.isNormal(d.Size)?Bb.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(Bb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):!0},this)).on("onStart",h.bind(function(b){var c=null;Bb.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=Bb.getUploadErrorDescByCode(f):g||(e=Bb.i18n("UPLOAD/ERROR_UNKNOWN")),h&&(""!==e&&00&&d>0&&f>d?(e.uploading(!1),e.error(Bb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):(Ob.remote().composeUploadExternals(function(a,b){var c=!1;e.uploading(!1),zb.StorageResultType.Success===a&&b&&b.Result&&b.Result[e.id]&&(c=!0,e.tempName(b.Result[e.id])),c||e.error(Bb.getUploadErrorDescByCode(zb.UploadErrorCode.FileNoUploaded))},[a.link]),!0)},H.prototype.prepearMessageAttachments=function(a,b){if(a){var c=this,d=Bb.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(zb.ComposeType.ForwardAsAttachment===b)this.addMessageAsAttachment(a);else for(;f>e;e++){switch(h=d[e],i=!1,b){case zb.ComposeType.Reply:case zb.ComposeType.ReplyAll:i=h.isLinked;break;case zb.ComposeType.Forward:case zb.ComposeType.Draft:case zb.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(Bb.getUploadErrorDescByCode(zb.UploadErrorCode.FileNoUploaded))},this)},H.prototype.isEmptyForm=function(a){a=Bb.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()},Bb.extendAsViewModel("PopupsContactsViewModel",I),I.prototype.addNewProperty=function(a,b){var c=new w(a,b||"","");c.focused(!0),this.viewProperties.push(c)},I.prototype.addNewEmail=function(){this.addNewProperty(zb.ContactPropertyType.Email,"Home")},I.prototype.addNewPhone=function(){this.addNewProperty(zb.ContactPropertyType.Phone,"Mobile")},I.prototype.initUploader=function(){if(this.importUploaderButton()){var b=new g({action:Ob.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(Bb.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)},c,yb.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,zb.KeyState.ContactList);var d=this;j("delete",zb.KeyState.ContactList,function(){return d.deleteCommand(),!1}),a.on("click",".e-pagenator .e-page",function(){var a=c.dataFor(this);a&&(d.contactsPage(Bb.pInt(a.value)),d.reloadContactList())}),this.initUploader()},I.prototype.onShow=function(){Hb.routeOff(),this.reloadContactList(!0)},I.prototype.onHide=function(){Hb.routeOn(),this.currentContact(null),this.emptySelection(!0),this.search(""),h.each(this.contacts(),function(a){a.checked(!1)})},Bb.extendAsViewModel("PopupsAdvancedSearchViewModel",J),J.prototype.buildSearchStringValue=function(a){return-1 li"),e=c&&"tab"===c.shortcut,f=d.index(d.filter(".active"));return!e&&f>0?f--:e&&f-1&&g.eq(e).removeClass("focused"),38===f&&e>0?e--:40===f&&e1?" ("+(100>a?a:"99+")+")":""},Z.prototype.cancelSearch=function(){this.mainMessageListSearch(""),this.inputMessageListSearchFocus(!1)},Z.prototype.moveSelectedMessagesToFolder=function(a){return this.canBeMoved()&&Ob.moveMessagesToFolder(Ob.data().currentFolderFullNameRaw(),Ob.data().messageListCheckedOrSelectedUidsWithSubMails(),a),!1},Z.prototype.dragAndDronHelper=function(a,b){a&&a.checked(!0);var c=Bb.draggeblePlace();return c.data("rl-folder",Ob.data().currentFolderFullNameRaw()),c.data("rl-uids",Ob.data().messageListCheckedOrSelectedUidsWithSubMails()),c.data("rl-copy",b?"1":"0"),c.find(".text").text((b?"+":"")+""+Ob.data().messageListCheckedOrSelectedUidsWithSubMails().length),c},Z.prototype.onMessageResponse=function(a,b,c){var d=Ob.data();d.hideMessageBodies(),d.messageLoading(!1),zb.StorageResultType.Success===a&&b&&b.Result?d.setMessage(b,c):zb.StorageResultType.Unload===a?(d.message(null),d.messageError("")):zb.StorageResultType.Abort!==a&&(d.message(null),d.messageError(Bb.getNotification(b&&b.ErrorCode?b.ErrorCode:zb.Notification.UnknownError)))},Z.prototype.populateMessageBody=function(a){a&&(Ob.remote().message(this.onMessageResponse,a.folderFullNameRaw,a.uid)?Ob.data().messageLoading(!0):Bb.log("Error: Unknown message request: "+a.folderFullNameRaw+" ~ "+a.uid+" [e-101]"))},Z.prototype.setAction=function(a,b,c){var d=[],e=null,f=Ob.cache(),g=0;if(Bb.isUnd(c)&&(c=Ob.data().messageListChecked()),d=h.map(c,function(a){return a.uid}),""!==a&&01048576?(a.alert(Bb.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(Bb.getUploadErrorDescByCode(d&&d.ErrorCode?d.ErrorCode:zb.UploadErrorCode.Unknown)),this.customThemeUploaderProgress(!1)},this)),!!b}return!1},Bb.addSettingsViewModel(lb,"SettingsOpenPGP","SETTINGS_LABELS/LABEL_OPEN_PGP_NAME","openpgp"),lb.prototype.addOpenPgpKey=function(){Hb.showScreenPopup(L)},lb.prototype.generateOpenPgpKey=function(){Hb.showScreenPopup(N)},lb.prototype.viewOpenPgpKey=function(a){a&&Hb.showScreenPopup(M,[a])},lb.prototype.deleteOpenPgpKey=function(a){a&&a.deleteAccess()&&(this.openPgpKeyForDeletion(null),a&&Ob.data().openpgpKeyring&&(this.openpgpkeys.remove(function(b){return a===b}),Ob.data().openpgpKeyring[a.isPrivate?"privateKeys":"publicKeys"].removeForId(a.guid),Ob.data().openpgpKeyring.store(),Ob.reloadOpenPgpKeys()))},mb.prototype.populateDataOnStart=function(){var a=Bb.pInt(Ob.settingsGet("Layout")),b=Ob.settingsGet("Languages"),c=Ob.settingsGet("Themes");Bb.isArray(b)&&this.languages(b),Bb.isArray(c)&&this.themes(c),this.mainLanguage(Ob.settingsGet("Language")),this.mainTheme(Ob.settingsGet("Theme")),this.allowCustomTheme(!!Ob.settingsGet("AllowCustomTheme")),this.allowAdditionalAccounts(!!Ob.settingsGet("AllowAdditionalAccounts")),this.allowIdentities(!!Ob.settingsGet("AllowIdentities")),this.determineUserLanguage(!!Ob.settingsGet("DetermineUserLanguage")),this.allowThemes(!!Ob.settingsGet("AllowThemes")),this.allowCustomLogin(!!Ob.settingsGet("AllowCustomLogin")),this.allowLanguagesOnLogin(!!Ob.settingsGet("AllowLanguagesOnLogin")),this.allowLanguagesOnSettings(!!Ob.settingsGet("AllowLanguagesOnSettings")),this.editorDefaultType(Ob.settingsGet("EditorDefaultType")),this.showImages(!!Ob.settingsGet("ShowImages")),this.contactsAutosave(!!Ob.settingsGet("ContactsAutosave")),this.interfaceAnimation(Ob.settingsGet("InterfaceAnimation")),this.mainMessagesPerPage(Ob.settingsGet("MPP")),this.desktopNotifications(!!Ob.settingsGet("DesktopNotifications")),this.useThreads(!!Ob.settingsGet("UseThreads")),this.replySameFolder(!!Ob.settingsGet("ReplySameFolder")),this.useCheckboxesInList(!!Ob.settingsGet("UseCheckboxesInList")),this.layout(zb.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)))},nb.prototype.populateDataOnStart=function(){mb.prototype.populateDataOnStart.call(this),this.accountEmail(Ob.settingsGet("Email")),this.accountIncLogin(Ob.settingsGet("IncLogin")),this.accountOutLogin(Ob.settingsGet("OutLogin")),this.projectHash(Ob.settingsGet("ProjectHash")),this.displayName(Ob.settingsGet("DisplayName")),this.replyTo(Ob.settingsGet("ReplyTo")),this.signature(Ob.settingsGet("Signature")),this.signatureToAll(!!Ob.settingsGet("SignatureToAll")),this.enableTwoFactor(!!Ob.settingsGet("EnableTwoFactor")),this.lastFoldersHash=Ob.local().get(zb.ClientSideKeyName.FoldersLashHash)||"",this.remoteSuggestions=!!Ob.settingsGet("RemoteSuggestions"),this.devEmail=Ob.settingsGet("DevEmail"),this.devLogin=Ob.settingsGet("DevLogin"),this.devPassword=Ob.settingsGet("DevPassword")},nb.prototype.initUidNextAndNewMessages=function(b,c,d){if("INBOX"===b&&Bb.isNormal(c)&&""!==c){if(Bb.isArray(d)&&03)i(Ob.link().notificationMailIcon(),Ob.data().accountEmail(),Bb.i18n("MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION",{COUNT:g}));else for(;g>f;f++)i(Ob.link().notificationMailIcon(),z.emailsToLine(z.initEmailsFromJson(d[f].From),!1),d[f].Subject)}Ob.cache().setFolderUidNext(b,c)}},nb.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=Ob.cache().getFolderFromCacheList(g),f||(f=A.newInstanceFromJson(e),f&&(Ob.cache().setFolderToCacheList(g,f),Ob.cache().setFolderFullNameRaw(f.fullNameHash,g))),f&&(f.collapsed(!Bb.isFolderExpanded(f.fullNameHash)),e.Extended&&(e.Extended.Hash&&Ob.cache().setFolderHash(f.fullNameRaw,e.Extended.Hash),Bb.isNormal(e.Extended.MessageCount)&&f.messageCountAll(e.Extended.MessageCount),Bb.isNormal(e.Extended.MessageUnseenCount)&&f.messageCountUnread(e.Extended.MessageUnseenCount)),h=e.SubFolders,h&&"Collection/FolderCollection"===h["@Object"]&&h["@Collection"]&&Bb.isArray(h["@Collection"])&&f.subFolders(this.folderResponseParseRec(a,h["@Collection"])),i.push(f)));return i},nb.prototype.setFolders=function(a){var b=[],c=!1,d=Ob.data(),e=function(a){return""===a||yb.Values.UnuseOptionValue===a||null!==Ob.cache().getFolderFromCacheList(a)?a:""};a&&a.Result&&"Collection/FolderCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&Bb.isArray(a.Result["@Collection"])&&(Bb.isUnd(a.Result.Namespace)||(d.namespace=a.Result.Namespace),this.threading(!!Ob.settingsGet("UseImapThread")&&a.Result.IsThreadsSupported&&!0),b=this.folderResponseParseRec(d.namespace,a.Result["@Collection"]),d.folderList(b),a.Result.SystemFolders&&""==""+Ob.settingsGet("SentFolder")+Ob.settingsGet("DraftFolder")+Ob.settingsGet("SpamFolder")+Ob.settingsGet("TrashFolder")+Ob.settingsGet("ArchiveFolder")+Ob.settingsGet("NullFolder")&&(Ob.settingsSet("SentFolder",a.Result.SystemFolders[2]||null),Ob.settingsSet("DraftFolder",a.Result.SystemFolders[3]||null),Ob.settingsSet("SpamFolder",a.Result.SystemFolders[4]||null),Ob.settingsSet("TrashFolder",a.Result.SystemFolders[5]||null),Ob.settingsSet("ArchiveFolder",a.Result.SystemFolders[12]||null),c=!0),d.sentFolder(e(Ob.settingsGet("SentFolder"))),d.draftFolder(e(Ob.settingsGet("DraftFolder"))),d.spamFolder(e(Ob.settingsGet("SpamFolder"))),d.trashFolder(e(Ob.settingsGet("TrashFolder"))),d.archiveFolder(e(Ob.settingsGet("ArchiveFolder"))),c&&Ob.remote().saveSystemFolders(Bb.emptyFunction,{SentFolder:d.sentFolder(),DraftFolder:d.draftFolder(),SpamFolder:d.spamFolder(),TrashFolder:d.trashFolder(),ArchiveFolder:d.archiveFolder(),NullFolder:"NullFolder"}),Ob.local().set(zb.ClientSideKeyName.FoldersLashHash,a.Result.FoldersHash))},nb.prototype.hideMessageBodies=function(){var a=this.messagesBodiesDom();a&&a.find(".b-text-part").hide()},nb.prototype.getNextFolderNames=function(a){a=Bb.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=Ob.cache().getFolderFromCacheList(a[1]);return e&&(e.interval=d,b.push(a[1])),c<=b.length}),h.uniq(b)},nb.prototype.removeMessagesFromList=function(a,b,c,d){c=Bb.isNormal(c)?c:"",d=Bb.isUnd(d)?!1:!!d,b=h.map(b,function(a){return Bb.pInt(a)});var e=0,f=Ob.data(),g=Ob.cache(),i=f.messageList(),j=Ob.cache().getFolderFromCacheList(a),k=""===c?null:g.getFolderFromCacheList(c||""),l=f.currentFolderFullNameRaw(),m=f.message(),n=l===a?h.filter(i,function(a){return a&&-10&&j.messageCountUnread(0<=j.messageCountUnread()-e?j.messageCountUnread()-e:0)),k&&(k.messageCountAll(k.messageCountAll()+b.length),e>0&&k.messageCountUnread(k.messageCountUnread()+e),k.actionBlink(!0)),0').hide().addClass("rl-cache-class"),g.data("rl-cache-count",++Eb.iMessageBodyCacheCount),Bb.isNormal(a.Result.Html)&&""!==a.Result.Html?(d=!0,g.html(a.Result.Html.toString()).addClass("b-text-part html")):Bb.isNormal(a.Result.Plain)&&""!==a.Result.Plain?(d=!1,j=a.Result.Plain.toString(),(n.isPgpSigned()||n.isPgpEncrypted())&&Ob.data().allowOpenPGP()&&Bb.isNormal(a.Result.PlainRaw)&&(n.plainRaw=Bb.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)),Pb.empty(),k&&n.isPgpSigned()?j=Pb.append(b('
').text(n.plainRaw)).html():l&&n.isPgpEncrypted()&&(j=Pb.append(b('
').text(n.plainRaw)).html()),Pb.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(zb.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&&Bb.initBlockquoteSwitcher(g)),Ob.cache().initMessageFlagsFromCache(n),n.unseen()&&Ob.setMessageSeen(n),Bb.windowResize())},nb.prototype.calculateMessageListHash=function(a){return h.map(a,function(a){return""+a.hash+"_"+a.threadsLen()+"_"+a.flagHash()}).join("|")},nb.prototype.setMessageList=function(a,b){if(a&&a.Result&&"Collection/MessageCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&Bb.isArray(a.Result["@Collection"])){var c=Ob.data(),d=Ob.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=Bb.pInt(a.Result.MessageResultCount),j=Bb.pInt(a.Result.Offset),Bb.isNonEmptyArray(a.Result.LastCollapsedThreadUids)&&(e=a.Result.LastCollapsedThreadUids),p=Ob.cache().getFolderFromCacheList(Bb.isNormal(a.Result.Folder)?a.Result.Folder:""),p&&!b&&(p.interval=l,Ob.cache().setFolderHash(a.Result.Folder,a.Result.FolderHash),Bb.isNormal(a.Result.MessageCount)&&p.messageCountAll(a.Result.MessageCount),Bb.isNormal(a.Result.MessageUnseenCount)&&(Bb.pInt(p.messageCountUnread())!==Bb.pInt(a.Result.MessageUnseenCount)&&(r=!0),p.messageCountUnread(a.Result.MessageUnseenCount)),this.initUidNextAndNewMessages(p.fullNameRaw,a.Result.UidNext,a.Result.NewMessages)),r&&p&&Ob.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?Ob.cache().initMessageFlagsFromCache(o):Ob.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/"+Db.urlsafe_encode([b,c,Ob.data().projectHash(),Ob.data().threading()&&Ob.data().useThreads()?"1":"0"].join(String.fromCharCode(0))),["Message"]),!0):!1},pb.prototype.composeUploadExternals=function(a,b){this.defaultRequest(a,"ComposeUploadExternals",{Externals:b},999e3)},pb.prototype.folderInformation=function(a,b,c){var d=!0,e=Ob.cache(),f=[];Bb.isArray(c)&&0
").addClass("rl-settings-view-model").hide().attr("data-bind",'template: {name: "'+f.__rlSettingsData.Template+'"}, i18nInit: true'),i.appendTo(g),e.data=Ob.data(),e.viewModelDom=i,e.__rlSettingsData=f.__rlSettingsData,f.__dom=i,f.__builded=!0,f.__vm=e,c.applyBindings(e,i[0]),Bb.delegateRun(e,"onBuild",[i])):Bb.log("Cannot find sub settings view model position: SettingsSubScreen")),e&&h.defer(function(){d.oCurrentSubScreen&&(Bb.delegateRun(d.oCurrentSubScreen,"onHide"),d.oCurrentSubScreen.viewModelDom.hide()),d.oCurrentSubScreen=e,d.oCurrentSubScreen&&(d.oCurrentSubScreen.viewModelDom.show(),Bb.delegateRun(d.oCurrentSubScreen,"onShow"),Bb.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)),Bb.windowResize()})):Hb.setHash(Ob.link().settings(),!1,!0)},sb.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(Bb.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},sb.prototype.onBuild=function(){h.each(Fb.settings,function(a){a&&a.__rlSettingsData&&!h.find(Fb["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(Fb["settings-disabled"],function(b){return b&&b===a})})},this),this.oViewModelPlace=b("#rl-content #rl-settings-subscreen")},sb.prototype.routes=function(){var a=h.find(Fb.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=Bb.isUnd(c.subname)?b:Bb.pString(c.subname),[c.subname]}};return[["{subname}/",c],["{subname}",c],["",c]]},h.extend(tb.prototype,s.prototype),tb.prototype.onShow=function(){Ob.setTitle("")},h.extend(ub.prototype,s.prototype),ub.prototype.oLastRoute={},ub.prototype.setNewTitle=function(){var a=Ob.data().accountEmail(),b=Ob.data().foldersInboxUnreadCount();Ob.setTitle((""===a?"":(b>0?"("+b+") ":" ")+a+" - ")+Bb.i18n("TITLES/MAILBOX"))},ub.prototype.onShow=function(){this.setNewTitle(),Ob.data().keyScope(zb.KeyState.MessageList)},ub.prototype.onRoute=function(a,b,c,d){if(Bb.isUnd(d)?1:!d){var e=Ob.data(),f=Ob.cache().getFolderFullNameRaw(a),g=Ob.cache().getFolderFromCacheList(f);g&&(e.currentFolder(g).messageListPage(b).messageListSearch(c),zb.Layout.NoPreview===e.layout()&&e.message()&&(e.message(null),e.messageFullScreenMode(!1)),Ob.reloadMessageList())}else zb.Layout.NoPreview!==Ob.data().layout()||Ob.data().message()||Ob.historyBack()},ub.prototype.onStart=function(){var a=Ob.data(),b=function(){Bb.windowResize()};(Ob.settingsGet("AllowAdditionalAccounts")||Ob.settingsGet("AllowIdentities"))&&Ob.accountsAndIdentities(),h.delay(function(){"INBOX"!==a.currentFolderFullNameRaw()&&Ob.folderInformation("INBOX")},1e3),h.delay(function(){Ob.quota()},5e3),h.delay(function(){Ob.remote().appDelayStart(Bb.emptyFunction)},35e3),Kb.toggleClass("rl-no-preview-pane",zb.Layout.NoPreview===a.layout()),a.folderList.subscribe(b),a.messageList.subscribe(b),a.message.subscribe(b),a.layout.subscribe(function(a){Kb.toggleClass("rl-no-preview-pane",zb.Layout.NoPreview===a)}),a.foldersInboxUnreadCount.subscribe(function(){this.setNewTitle()},this)},ub.prototype.routes=function(){var a=function(){return["Inbox",1,"",!0]},b=function(a,b){return b[0]=Bb.pString(b[0]),b[1]=Bb.pInt(b[1]),b[1]=0>=b[1]?1:b[1],b[2]=Bb.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]=Bb.pString(b[0]),b[1]=Bb.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(vb.prototype,sb.prototype),vb.prototype.onShow=function(){Ob.setTitle(this.sSettingsTitle),Ob.data().keyScope(zb.KeyState.Settings)},h.extend(wb.prototype,q.prototype),wb.prototype.oSettings=null,wb.prototype.oPlugins=null,wb.prototype.oLocal=null,wb.prototype.oLink=null,wb.prototype.oSubs={},wb.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):(Eb.bMobileDevice?(a.open(b,"_self"),a.focus()):this.iframe.attr("src",b),!0)},wb.prototype.link=function(){return null===this.oLink&&(this.oLink=new k),this.oLink},wb.prototype.local=function(){return null===this.oLocal&&(this.oLocal=new p),this.oLocal},wb.prototype.settingsGet=function(a){return null===this.oSettings&&(this.oSettings=Bb.isNormal(Ib)?Ib:{}),Bb.isUnd(this.oSettings[a])?null:this.oSettings[a]},wb.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=Bb.isNormal(Ib)?Ib:{}),this.oSettings[a]=b},wb.prototype.setTitle=function(b){b=(Bb.isNormal(b)&&0l;l++)q.push({id:e[l][0],name:e[l][1],system:!1,seporator:!1,disabled:!1});for(o=!0,l=0,m=b.length;m>l;l++)n=b[l],(h?h.call(null,n):!0)&&(o&&0l;l++)n=c[l],(n.subScribed()||!n.existen)&&(h?h.call(null,n):!0)&&(zb.FolderType.User===n.type()||!j||0